Statchecker.zzs
import filetest.*;
/*宣言*/
ftp = new FTP;
info = new ZzInfo();
stats = new Array(12);
/*宣言終わり*/
/*SETUP */
ftpdir = 'nanto';
ftp.debug
= true;
ftp.host
= 'server';
ftp.userid
= 'root';
ftp.password
= '1942';
sleepingTime = 30000; //ミリ秒
/* SETEND */
function statfile(filename, text){
file = new File(filename + '.txt');
try{
file.open('w');
for(a=0;a<text.length;a++){
file.writeln(text[a]);
}
}
catch(e){
println(e);
}
finally{
file.close();
}
}
function uplord(){
playername = info.playerName;
ftp.connect
();
try{
ftp.changeDir(ftpdir
);
println(ftp.printWorkDir
());
ftp.type('I'
);
ftp.upload(playername
+ '.txt','charstat.txt');
} finally{
ftp.disconnect
();
}
}
function statscheck() {
nowhp = info.playerHits;
maxhit = info.playerHitsMax;
nowstm = info.playerStam;
maxstm = info.playerStamMax;
nowmana = info.playerMana;
maxmana = info.playerManaMax;
nowgold = info.playerGold;
nowAR = info.playerResistPhysical;
nowFR = info.playerResistFire;
nowCR = info.playerResistCold;
nowPR = info.playerResistPoison;
nowER = info.playerResistEnergy;
nowWeight = info.playerWeight;
maxWeight = info.playerWeightMax;
nowTithingPoint = info.playerTithing;
playername = info.playerName;
var timestamp = new Date();
println( 'HP:' + nowhp + '/' + maxhit );
println( 'STM:' + nowstm + '/' + maxstm );
println( 'MANA:' + nowmana + '/' + maxmana );
println( 'GOLD:' + nowgold );
println( 'AR:' + nowAR );
println( 'FR:' + nowFR );
println( 'CR:' + nowCR );
println( 'PR:' + nowPR );
println( 'ER:' + nowER );
println( 'Weight:' + nowWeight + '/' + maxWeight );
println( 'TithingPoint:' + nowTithingPoint );
stats[0] = ( 'NAME: ' + playername );
stats[1] = ( 'HP: ' + nowhp + '/' + maxhit );
stats[2] = ( 'STM: ' + nowstm + '/' + maxstm );
stats[3] = ( 'MANA: ' + nowmana + '/' + maxmana );
stats[4] = ( 'GOLD: ' + nowgold );
stats[5] = ( 'AR: ' + nowAR );
stats[6] = ( 'FR: ' + nowFR );
stats[7] = ( 'CR: ' + nowCR );
stats[8] = ( 'PR: ' + nowPR );
stats[9] = ( 'ER: ' + nowER );
stats[10] = ( 'Weight: ' + nowWeight + '/' + maxWeight );
stats[11] = ( 'TithingPoint: ' + nowTithingPoint );
stats[12] = ( 'Lastupdate: ' + timestamp );
statfile(playername, stats);
}
while(1){
statscheck();
uplord();
sleep(sleepingTime);
}