Skip to content
Snippets Groups Projects
Commit 1fe7f705 authored by mcmlxxix's avatar mcmlxxix
Browse files

game now assigns fewer points for 3 and 4 player games, uses logging.js module...

game now assigns fewer points for 3 and 4 player games, uses logging.js module for game logs (instead of built in functions)
parent f6e8d476
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
load("sbbsdefs.js"); load("sbbsdefs.js");
load("graphic.js"); load("graphic.js");
load("logging.js");
var game_dir; var game_dir;
try { barfitty.barf(barf); } catch(e) { game_dir = e.fileName; } try { barfitty.barf(barf); } catch(e) { game_dir = e.fileName; }
game_dir = game_dir.replace(/[^\/\\]*$/,''); game_dir = game_dir.replace(/[^\/\\]*$/,'');
...@@ -45,27 +46,16 @@ ...@@ -45,27 +46,16 @@
//######################### DO NOT CHANGE THIS SECTION ########################## //######################### DO NOT CHANGE THIS SECTION ##########################
var log_list=[];
if(!file_isdir(game_dir+"logs")) mkdir(game_dir+"logs"); if(!file_isdir(game_dir+"logs")) mkdir(game_dir+"logs");
else log_list=directory(game_dir + "logs/*.log"); var gamelog=new Logger(game_dir + "logs/","dice");
var logfile=new File(game_dir + "logs/dice" + log_list.length + ".log");
logfile.open('w+',false);
logfile.writeln("######DICE WARZ LOG DATA####### " + system.datestr() +" - "+ system.timestr());
//TODO: MAKE BETTER USER OF THE USER FILES. CAN BE USED FOR REALTIME MULTIPLAYER, AND FOR USER PRESENCE DETECTION
// IN THE EVENT A USER IS BEING NOTIFIED OF HIS OR HER TURN IN A GAME, THE TELEGRAMS WILL BE SUPPRESSED IF THE USER IS ALREADY RUNNING THE PROGRAM
var userFileName=game_dir + user.alias + ".usr"; var userFileName=game_dir + user.alias + ".usr";
var userFile=new File(userFileName); var userFile=new File(userFileName);
userFile.open('a'); userFile.open('a');
userFile.close(); userFile.close();
//TODO: MAKE REALTIME MULTIPLAYER FEATURES POSSIBLY USING THE EXISTING FILE LOCK SYSTEM OR QUEUES
// var dataQueue= new Queue(dice);
const daySeconds= 86400; const daySeconds= 86400;
const startRow= 4; const startRow= 4;
const startColumn= 3; const startColumn= 3;
const menuRow= 1; const menuRow= 1;
const menuColumn= 50; const menuColumn= 50;
const columns= 9; const columns= 9;
...@@ -1592,7 +1582,7 @@ function GameStatusInfo() ...@@ -1592,7 +1582,7 @@ function GameStatusInfo()
} }
function GameLog(data) function GameLog(data)
{ {
logfile.writeln(data); gamelog.Log(data);
} }
SplashScreen(); SplashScreen();
......
...@@ -195,8 +195,9 @@ function Map(c,r,p,gn) ...@@ -195,8 +195,9 @@ function Map(c,r,p,gn)
} }
else else
{ {
scores[this.winner].score+=2; var points=this.players.length<5?1:2;
GameLog("giving 2 points to user " + this.winner); scores[this.winner].score+=points;
GameLog("giving " + points + " points to user " + this.winner);
} }
games.StoreRankings(); games.StoreRankings();
} }
...@@ -217,8 +218,9 @@ function Map(c,r,p,gn) ...@@ -217,8 +218,9 @@ function Map(c,r,p,gn)
} }
else else
{ {
pointBuffer=7-this.maxPlayers; var pointBuffer=7-this.maxPlayers;
pts=points[pointBuffer+(this.eliminated.length-1)]; var offset=(this.players.length<5?2:1);
pts=points[pointBuffer+(this.eliminated.length-offset)];
scores[dead.user].score+=pts; scores[dead.user].score+=pts;
GameLog("giving " + pts + " points to user " + system.username(dead.user)); GameLog("giving " + pts + " points to user " + system.username(dead.user));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment