<?php
/*
+---------------------------------------------------------------------------
| > This program is free software; you can redistribute it and/or
| > modify it under the terms of the GNU General Public License
| > as published by the Free Software Foundation; either version 2
| > of the License, or (at your option) any later version.
| >
| > This program is distributed in the hope that it will be useful,
| > but WITHOUT ANY WARRANTY; without even the implied warranty of
| > MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
| > GNU General Public License for more details.
| >
| > You should have received a copy of the GNU General Public License
| > along with this program; if not, write to the Free Software
| > Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+---------------------------------------------------------------------------
*/
$username = "root";
$password = "";
$hostname = "localhost";
$database = "rpgdb";
$prefix = "NUKE_";
$dbi = mysql_connect($hostname, $username, $password);
mysql_select_db($database, $dbi);
$query = "select charid,willpower, willpowertemp, currentvitae, maxvitae, dayscur, daysmax, fedtoday from ".$prefix."character_characters where active = '1' and vampire = '1'";
$result = mysql_query($query, $dbi);
//echo "charid\twillpower\twillpowertemp\tcurrentvitae\tmaxvitae\tdayscur\tdaysmax\tfedtoday\n";
while(list($charid, $willpower, $willpowertemp, $currentvitae, $maxvitae, $dayscur, $daysmax, $fedtoday) =mysql_fetch_array($result))
{
//echo $charid."\t".$willpower."\t\t".$willpowertemp."\t\t".$currentvitae."\t\t".$maxvitae."\t\t".$dayscur."\t".$daysmax."\t".$fedtoday."\n";
if($willpowertemp < $willpower)
$willpowertemp ++;
if($dayscur > 0)
$dayscur--;
else
{
if($currentvitae > 0)
$currentvitae--;
$dayscur = $daysmax;
}
$queryloop = "UPDATE ".$prefix."character_characters SET willpowertemp = '$willpowertemp', currentvitae = '$currentvitae', dayscur = '$dayscur', fedtoday = '0' where charid = '$charid'";
//echo $queryloop."\n";
mysql_query($queryloop,$dbi);
}
mysql_close($dbi);
?>