forked from ppfun/pixelplanet
Change mooncanvas size
This commit is contained in:
parent
ba81c4ec3c
commit
b339f28f2f
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -6,6 +6,9 @@ players.json
|
|||
.digitalocean
|
||||
database.sqlite
|
||||
.ftpquota
|
||||
lol.png
|
||||
lol-cleaned.png
|
||||
clean.png
|
||||
|
||||
|
||||
# Created by https://www.gitignore.io/api/node,webstorm
|
||||
|
|
|
@ -83,7 +83,7 @@
|
|||
[ 122, 148, 156 ],
|
||||
[ 174, 215, 185 ]
|
||||
],
|
||||
"size" : 1024,
|
||||
"size" : 4096,
|
||||
"cli": 2,
|
||||
"bcd": 15000,
|
||||
"pcd": 15000,
|
||||
|
@ -206,6 +206,6 @@
|
|||
"ranked" : false,
|
||||
"req": 0,
|
||||
"sd": "2020-03-15",
|
||||
"desc": "Special canvas to spread aweareness of coronavirus (doesn't count towards statistics)"
|
||||
"desc": "Special canvas to spread awareness of SARS-CoV2 (doesn't count towards statistics)"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,3 +57,6 @@ Usage: `./liveLog.sh LOGFILE CANVASID STARTX_STARTY ENDX_ENDY`
|
|||
|
||||
## pp-center\*.png
|
||||
center logo of pixelplanet
|
||||
|
||||
## change-canvasbackup
|
||||
just a script that got run once to add the missing tiles in historical view when increasing the size of the moon canvas.
|
||||
|
|
2
utils/change-canvasbackup/README.md
Normal file
2
utils/change-canvasbackup/README.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
This script got used while increasing the size of the moon canvas.
|
||||
It just adds additional empty tiles in the daily backup to pad the size in historical view, no big deal.
|
BIN
utils/change-canvasbackup/empty.png
Normal file
BIN
utils/change-canvasbackup/empty.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 565 B |
BIN
utils/change-canvasbackup/emptybl.png
Normal file
BIN
utils/change-canvasbackup/emptybl.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 567 B |
102
utils/change-canvasbackup/move.sh
Normal file
102
utils/change-canvasbackup/move.sh
Normal file
|
@ -0,0 +1,102 @@
|
|||
#!/bin/bash
|
||||
# this script creates tiles in the backup folder for the moon canvas
|
||||
# to be able to increase its size from 1024 to 4096
|
||||
# If it wouldn't be padded by those additional tiles, it would show loading tiles
|
||||
# in historical view at the parts that exceed the previous size
|
||||
# (which wouldn't be too bad tbh. but let be save and put those there)
|
||||
|
||||
CANVAS=1
|
||||
|
||||
for DATEFOLDERS in `ls`
|
||||
do
|
||||
TILEFOLDER="${DATEFOLDERS}/${CANVAS}/tiles"
|
||||
if [ -d "${TILEFOLDER}" ]
|
||||
then
|
||||
y=15
|
||||
while [ $y -ge 0 ]
|
||||
do
|
||||
TILEYDIR="${TILEFOLDER}/${y}"
|
||||
if [ ! -d "${TILEYDIR}" ]
|
||||
then
|
||||
mkdir "${TILEYDIR}"
|
||||
fi
|
||||
|
||||
if [ $y -lt 4 ]
|
||||
then
|
||||
newy=$(( $y + 6 ))
|
||||
NEWTILEYDIR="${TILEFOLDER}/${newy}"
|
||||
echo "Move ${TILEYDIR} to ${NEWTILEYDIR}"
|
||||
mv "${NEWTILEYDIR}" ./tmptiledir
|
||||
mv "${TILEYDIR}" "${NEWTILEYDIR}"
|
||||
mv ./tmptiledir "${TILEYDIR}"
|
||||
|
||||
x=15
|
||||
while [ $x -ge 0 ]
|
||||
do
|
||||
TILE="${NEWTILEYDIR}/${x}.png"
|
||||
if [ $x -lt 4 ]
|
||||
then
|
||||
newx=$(( $x + 6 ))
|
||||
NEWTILE="${NEWTILEYDIR}/${newx}.png"
|
||||
echo "Move ${TILE} to ${NEWTILE}"
|
||||
mv "${NEWTILE}" ./tmptile.png
|
||||
mv "${TILE}" "${NEWTILE}"
|
||||
mv ./tmptile.png "${TILE}"
|
||||
else
|
||||
if [ ! -f "${TILE}" ]
|
||||
then
|
||||
cp ./empty.png "${TILE}"
|
||||
echo "Create ${TILE}"
|
||||
fi
|
||||
fi
|
||||
x=$(( $x - 1 ))
|
||||
done
|
||||
else
|
||||
x=0
|
||||
while [ $x -lt 16 ]
|
||||
do
|
||||
TILE="${TILEYDIR}/${x}.png"
|
||||
if [ ! -f "${TILE}" ]
|
||||
then
|
||||
cp ./empty.png "${TILE}"
|
||||
echo "Create ${TILE}"
|
||||
fi
|
||||
x=$(( $x + 1 ))
|
||||
done
|
||||
fi
|
||||
y=$(( $y - 1 ))
|
||||
done
|
||||
fi
|
||||
done
|
||||
|
||||
for DATEFOLDERS in `ls -d */`
|
||||
do
|
||||
CANVASFOLDER="${DATEFOLDERS}${CANVAS}"
|
||||
if [ -d "${CANVASFOLDER}" ]
|
||||
then
|
||||
for TIMES in `ls ${CANVASFOLDER}`
|
||||
do
|
||||
if [ "${TIMES}" != "tiles" ]
|
||||
then
|
||||
TIMEFOLDER="${CANVASFOLDER}/${TIMES}"
|
||||
for y in `ls -r "${TIMEFOLDER}"`
|
||||
do
|
||||
newy=$(( $y + 6 ))
|
||||
TILEYDIR="${TIMEFOLDER}/${y}"
|
||||
NEWTILEYDIR="${TIMEFOLDER}/${newy}"
|
||||
echo "Move ${TILEYDIR} to ${NEWTILEYDIR}"
|
||||
mv "${TILEYDIR}" "${NEWTILEYDIR}"
|
||||
for XNAME in `ls -r ${NEWTILEYDIR}`
|
||||
do
|
||||
x=`echo ${XNAME} | sed 's/.png//'`
|
||||
newx=$(( $x + 6 ))
|
||||
TILE="${NEWTILEYDIR}/${x}.png"
|
||||
NEWTILE="${NEWTILEYDIR}/${newx}.png"
|
||||
echo "Move ${TILE} to ${NEWTILE} "
|
||||
mv "${TILE}" "${NEWTILE}"
|
||||
done
|
||||
done
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
38
utils/change-canvasbackup/redisMove.js
Normal file
38
utils/change-canvasbackup/redisMove.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
/* @flow */
|
||||
// move chunks to the middle when changing size on moon canvas from 1024 to 4096
|
||||
|
||||
import redis from 'redis';
|
||||
import bluebird from 'bluebird';
|
||||
bluebird.promisifyAll(redis.RedisClient.prototype);
|
||||
bluebird.promisifyAll(redis.Multi.prototype);
|
||||
|
||||
//ATTENTION Make sure to set the rdis URLs right!!!
|
||||
const oldurl = "redis://localhost:6380";
|
||||
const oldredis = redis.createClient(oldurl, { return_buffers: true });
|
||||
const newurl = "redis://localhost:6379";
|
||||
const newredis = redis.createClient(newurl, { return_buffers: true });
|
||||
|
||||
async function copyChunks() {
|
||||
for (let x = 0; x < 5; x++) {
|
||||
for (let y = 0; y < 5; y++) {
|
||||
const oldkey = `ch:1:${x}:${y}`;
|
||||
const newkey = `ch:1:${x + 6}:${y + 6}`;
|
||||
const chunk = await oldredis.getAsync(oldkey);
|
||||
if (chunk) {
|
||||
const setNXArgs = [newkey, chunk];
|
||||
await oldredis.sendCommandAsync('SET', setNXArgs);
|
||||
await oldredis.delAsync(oldkey);
|
||||
console.log("Created Chunk ", newkey);
|
||||
}
|
||||
const chunkl = await newredis.getAsync(oldkey);
|
||||
if (chunkl) {
|
||||
const setNXArgs = [newkey, chunkl];
|
||||
await newredis.sendCommandAsync('SET', setNXArgs);
|
||||
await newredis.delAsync(oldkey);
|
||||
console.log("Created Chunk ", newkey);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
copyChunks();
|
Loading…
Reference in New Issue
Block a user