feat: update game interface to support planet pictures

This commit is contained in:
Emmanuel BENOîT 2024-12-31 19:53:17 +01:00
parent 4d48fba21b
commit da42f6db52
Signed by: Emmanuel BENOîT
SSH key fingerprint: SHA256:l7PFUUF5TCDsvYeQC9OnTNz08dFY7Fvf4Hv3neIqYpg
10 changed files with 28 additions and 15 deletions

View file

@ -5,6 +5,7 @@ RUN <<EOF
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
apt-get update && apt-get dist-upgrade -uy
apt-get -y install lsb-release ca-certificates curl
curl -sSLo /tmp/debsuryorg-archive-keyring.deb \
https://packages.sury.org/debsuryorg-archive-keyring.deb
@ -16,13 +17,15 @@ RUN <<EOF
apt-get install -y apache2 libapache2-mod-php8.3 \
php8.3-cli php8.3-opcache php8.3-pgsql \
php8.3-xml socat
a2dismod mpm_event
a2enmod mpm_prefork
adduser --system --ingroup www-data \
--shell '/usr/bin/php /opt/lwb5/scripts/ticks.php' \
--comment 'LWB5 Ticks' \
--home /opt/lwb5 --no-create-home \
lwticks
a2dismod mpm_event
a2enmod mpm_prefork
/bin/echo -e "Listen 80\nListen 81" > /etc/apache2/ports.conf
cat > /etc/apache2/sites-available/lwb5-main.conf <<EOC
<VirtualHost *:80>
@ -59,7 +62,16 @@ EOC
a2dissite 000-default
a2ensite lwb5-main
a2ensite lwb5-admin
mkdir /var/cache/lw
chmod 1777 /var/cache/lw
mkdir /var/spool/pgen
chgrp www-data /var/spool/pgen
chmod 1775 /var/spool/pgen
EOF
VOLUME /var/spool/pgen /var/cache/lw
EXPOSE 80 81
ENTRYPOINT ["/opt/lwb5/run-lwb5.sh"]

View file

@ -12,7 +12,7 @@ $config = array(
"scriptdir" => __DIR__,
// Path to the cache
"cachedir" => "/tmp/lwcache",
"cachedir" => "/var/cache/lw",
// Debugging level
"debug" => 2,

View file

@ -14,7 +14,7 @@
<Param name="sessname" value="legacy_alpha_sid" />
<!-- Planet generator script -->
<Param name="pgenreq" value="/tmp/pgen" />
<Param name="pgenreq" value="/var/cache/pgen" />
</MainParams>
<!-- This part configures the general ticks that are not related to a

View file

@ -115,7 +115,8 @@ class page_layout {
// JavaScript variables (static access URL, color, etc...)
$jsConf = "var staticurl=\"".config::$main['staticurl']
. "\";\nvar color=\"$col\";\nvar ttFontSize = '" . ($fs + 9) . "px';\n"
. "var ttDelay = " . ($tt * 500) . ";\n";
. "var ttDelay = " . ($tt * 500) . ";\nvar gameId = \""
. input::$game->name . "\";\n";
// AJAX-specified initialization code
if (ajax::$init != "" || $tt) {

View file

@ -649,7 +649,7 @@ function drawPlanetListContents()
if (lsPlanets[idx].underAttack == 1)
str += ' class="attack"';
str += '><td class="pcoord">' + lsPlanets[idx].coords + '</td>';
str += '<td class="picon"><img src="'+staticurl+'/beta5/pics/pl/s/' + lsPlanets[idx].id + '.png" alt="[' + lsPlanets[idx].id + ']" /></td>';
str += '<td class="picon"><img src="'+staticurl+'/beta5/pics/pl/' + gameId + '/s/' + lsPlanets[idx].id + '.png" alt="[' + lsPlanets[idx].id + ']" /></td>';
str += '<td><a ' + alltt[71] + ' href="planet?id=' + lsPlanets[idx].id + '">' + lsPlanets[idx].name + '</a></td>';
str += '<td>' + (lsPlanets[idx].msOwner != "" ? ('<a ' + alltt[72] + ' href="message?a=c&ct=0&id='+lsPlanets[idx].msOwner+'">') : '');
str += lsPlanets[idx].owner + (lsPlanets[idx].msOwner != "" ? '</a>' : '') + '</td>';
@ -927,7 +927,7 @@ function drawMilitaryListContents() {
else if (lsAttacks[idx].attPower >= 3* lsAttacks[idx].defPower)
str += ' class="attack"';
str += '><td class="pcoord">(' + lsAttacks[idx].coords + ')</td>';
str += '<td class="picon"><img src="'+staticurl+'/beta5/pics/pl/s/' + lsAttacks[idx].planetId + '.png" alt="[' + lsAttacks[idx].planetId + ']" /></td>';
str += '<td class="picon"><img src="'+staticurl+'/beta5/pics/pl/' + gameId + '/s/' + lsAttacks[idx].planetId + '.png" alt="[' + lsAttacks[idx].planetId + ']" /></td>';
str += '<td><a ' + alltt[71] + ' href="planet?id=' + lsAttacks[idx].planetId + '">' + lsAttacks[idx].planetName + '</a></td>';
if (alPrivileges[0] > 1)
{

View file

@ -37,7 +37,7 @@ function Planet_drawName()
+ (this.system.protection ? ' style="background-color:#00274f"' : '') + '>';
} else {
str += '<td class="pimg"' + (this.system.protection ? ' style="background-color:#00274f"' : '')
+ '><img src="' + staticurl + '/beta5/pics/pl/s/' + this.id
+ '><img src="' + staticurl + '/beta5/pics/pl/' + gameId + '/s/' + this.id
+ '.png" alt="[P]" /></td><td class="planet'
+ (this.relation == 0 ? 'n' : (this.relation == 1 ? 'a' : 'o')) + '"'
+ (this.system.protection ? ' style="background-color:#00274f"' : '') + '>';
@ -54,7 +54,7 @@ function Planet_drawTag()
+ '/beta5/pics/prem_s.png" alt="[P]" /></td><td class="prem">N/A</td></tr>';
} else {
str += '<td class="pimg"' + (this.system.protection ? ' style="background-color:#00274f"' : '')
+ '><img src="' + staticurl + '/beta5/pics/pl/s/' + this.id
+ '><img src="' + staticurl + '/beta5/pics/pl/' + gameId + '/s/' + this.id
+ '.png" alt="[P]" /></td><td class="planet'
+ (this.relation == 0 ? 'n' : (this.relation == 1 ? 'a' : 'o')) + '"'
+ (this.system.protection ? ' style="background-color:#00274f"' : '') + '>'
@ -450,7 +450,7 @@ function Map_list() {
str += '<td';
if (this.list[i].system.nebula == 0) {
if (this.list[i].planet.opacity == 0) {
str += ' class="pimg"><img src="' + staticurl + '/beta5/pics/pl/s/'
str += ' class="pimg"><img src="' + staticurl + '/beta5/pics/pl/' + gameId + '/s/'
+ this.list[i].planet.id + '.png" alt="[P]" /></td><td class="pname">';
} else {
str += ' class="pimg"><img src="' + staticurl

View file

@ -896,7 +896,7 @@ function drawPrice(v)
// Planet sales listing functions
function drawPSName(v)
{
var str = '<td class="pimg"><img src="'+staticurl+'/beta5/pics/pl/s/'+v.id+'.png" alt="[P]" /></td>';
var str = '<td class="pimg"><img src="'+staticurl+'/beta5/pics/pl/' + gameId + '/s/'+v.id+'.png" alt="[P]" /></td>';
str += '<td class="pname"><a href="planet?id='+v.id+'">'+v.name+'</td>';
return str;
}
@ -991,7 +991,7 @@ function sortPSActDesc(a,b)
// Fleet sales listing function
function drawFSLocation(v)
{
var str = '<td class="pimg"><img src="'+staticurl+'/beta5/pics/pl/s/'+v.plId+'.png" alt="[P]" /></td>';
var str = '<td class="pimg"><img src="'+staticurl+'/beta5/pics/pl/' + gameId + '/s/'+v.plId+'.png" alt="[P]" /></td>';
str += '<td class="pname" colspan="2"><a href="planet?id='+v.plId+'">'+v.plName+'</td>';
return str;
}

View file

@ -45,7 +45,7 @@ function displayPage(data) {
var pdat = a[(i+1)*2].split('#');
var tmp = parseInt(pdat[4], 10) + parseInt(pdat[5], 10);
str += '<tr><td class="picon"><img class="picon" src="'+staticurl
+ '/beta5/pics/pl/s/' + pdat[0] + '.png" alt="[P-' + pdat[0] + '" border="0" />'
+ '/beta5/pics/pl/' + gameId + '/s/' + pdat[0] + '.png" alt="[P-' + pdat[0] + '" border="0" />'
+ '</td><td class="pname"><a ' + montt[3] + ' href="planet?id=' + pdat[0] + '">' + name
+ '</a></td><td>&euro;' + formatNumber(pdat[2]) + '</td><td>' + formatNumber(pdat[7])
+ '</td><td>&euro;' + formatNumber(pdat[3]) + '</td><td>&euro;' + formatNumber(pdat[4])

View file

@ -96,7 +96,7 @@ function Remains_drawLayout()
// Planet
function Planet_drawLayout()
{
document.getElementById('pimg').innerHTML = '<img src="'+staticurl+'/beta5/pics/pl/l/'+this.orbit.id+'.png" alt="Planet" />';
document.getElementById('pimg').innerHTML = '<img src="'+staticurl+'/beta5/pics/pl/' + gameId + '/l/'+this.orbit.id+'.png" alt="Planet" />';
var str = '<h2>Planet Overview</h2><table cellspacing="0" cellpadding="0"><tr>';
str += '<td class="div20">&nbsp;</td>';
str += '<td class="pc40">Coordinates: ('+this.orbit.drawCoords()+')</td>';

View file

@ -57,7 +57,7 @@ function buildPlanetLine(ipl) {
var cs0 = cs1 + csb;
var str = '<tr>'
+ '<td style="width:32px;height:32px' + csb + '" rowspan="2"><img src="' + staticurl
+ '/beta5/pics/pl/s/' + id + '.png" alt="[P]" style="border-width:0px' + csb + '" /></td>'
+ '/beta5/pics/' + gameId + '/pl/s/' + id + '.png" alt="[P]" style="border-width:0px' + csb + '" /></td>'
+ '<td colspan="2" style="text-align:left;vertical-align:top' + csb + '">'
+ '<a href="planet?id=' + id + '">' + planets[ipl].name + '</a></td>'
+ '<td rowspan="2" style="width:10%;max-width:80px' + cs0 + '">(' + planets[ipl].x