From: Miguel A. B. L. <ari...@us...> - 2008-04-20 17:05:14
|
Update of /cvsroot/arianne/stendhal_website/scripts In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv26747/scripts Modified Files: monsters.php players.php Log Message: Added a few hints for refactoring. It will need stendhal server modification. Index: monsters.php =================================================================== RCS file: /cvsroot/arianne/stendhal_website/scripts/monsters.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** monsters.php 15 Apr 2008 08:21:38 -0000 1.8 --- monsters.php 20 Apr 2008 17:05:06 -0000 1.9 *************** *** 92,96 **** * Amount of times this creature has been killed by a player or another creature. */ ! $result = mysql_query('select dayofyear(timedate) as day, count(*) as amount from gameEvents where event="killed" and param1="'.addslashes($this->name).'" and datediff(now(),timedate)<='.$numberOfDays.' group by dayofyear(timedate)', getGameDB()); $this->kills=array(); --- 92,121 ---- * Amount of times this creature has been killed by a player or another creature. */ ! $result = mysql_query(' ! select ! dayofyear(timedate) as day, ! count(*) as amount ! from gameEvents ! where ! event="killed" and ! param1="'.addslashes($this->name).'" and ! datediff(now(),timedate)<='.$numberOfDays.' ! group by dayofyear(timedate)', getGameDB()); ! ! /* ! * TODO: Refactoring ! * Expected table: ! * ! * create table Killed( ! * timedate timedate, ! * ! * killed varchar(32), ! * killedIscreature boolean, ! * ! * killer varchar(32), ! * killerIscreature boolean, ! * ) ! * ! */ $this->kills=array(); *************** *** 110,115 **** * Amount of times this creature has killed a player. */ ! $result = mysql_query('select dayofyear(timedate) as day, count(*) as amount from gameEvents where event="killed" and source="'.addslashes($this->name).'" and datediff(now(),timedate)<='.$numberOfDays.' and param1 not in ('.listOfMonsters(getMonsters()).') group by dayofyear(timedate)', getGameDB()); ! $this->killed=array(); --- 135,154 ---- * Amount of times this creature has killed a player. */ ! $result = mysql_query(' ! select ! dayofyear(timedate) as day, ! count(*) as amount ! from gameEvents ! where ! event="killed" and ! source="'.addslashes($this->name).'" and ! datediff(now(),timedate)<='.$numberOfDays.' and ! param1 not in ('.listOfMonsters(getMonsters()).') ! group by dayofyear(timedate)', getGameDB()); ! ! /* ! * TODO: Refactoring ! */ ! $this->killed=array(); Index: players.php =================================================================== RCS file: /cvsroot/arianne/stendhal_website/scripts/players.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** players.php 9 Apr 2008 12:26:37 -0000 1.5 --- players.php 20 Apr 2008 17:05:06 -0000 1.6 *************** *** 74,79 **** ## ! $result = mysql_query('select timedate, source from gameEvents where event="killed" and param1="'.addslashes($this->name).'" and datediff(now(),timedate)<=7*52 order by timedate desc limit 4', getGameDB()); ! $kills=array(); while($row=mysql_fetch_assoc($result)) { --- 74,93 ---- ## ! $result = mysql_query(' ! select ! timedate, ! source ! from gameEvents ! where ! event="killed" and ! param1="'.addslashes($this->name).'" and ! datediff(now(),timedate)<=7*52 ! order by timedate ! desc limit 4', getGameDB()); ! $kills=array(); ! ! /* ! * TODO: Refactor to use the new table. ! */ while($row=mysql_fetch_assoc($result)) { |