print icon("error", $er) . "<br>"; } if (!$er) { runsql("update ut_gladiators g set Price=round(power(1.18,'{$level}')*(12/(10-Talent)-1)*(select Coefficient from ut_gladiator_types where TypeID=g.TypeID)*1.5*EXP((Age-23)*(Age-23)/-200)*100) where GladiatorID='{$id}'"); $rst = $auth->rst; $q = select("select Price from ut_gladiators where GladiatorID='{$id}'"); $rst[Gladiators][$id][Price] = $q[0]; $rst[Gladiators][$id][Level] = $level; $rst[Gladiators][$id][Vit] = $_GET['Vit']; $rst[Gladiators][$id][Dex] = $_GET['Dex']; $rst[Gladiators][$id][Acc] = $_GET['Acc']; $rst[Gladiators][$id][Str] = $_GET['Str']; $auth->rst = $rst; write_rst($auth->user, $rst); } unlock_rst($auth->user); header("Location:/xml/gladiators/train.php"); } require $site_path . "up.php"; require $site_path . "left.php"; $gladiator = $auth->rst[Gladiators][$id]; $k = $id; unset($serialized); $gladiator[Exp] = round($gladiator[Exp] + expgained($auth->rst)); $exp = $gladiator[Exp]; $q = select("select Level from ut_exp where Points<='{$exp}' order by Level desc limit 0,1"); $points = ($q[Level] - $gladiator[Level]) * 3; if ($id && $gladiator && $points > 0) { ?> <table border=0 bgcolor=#78746C cellspacing=1 cellpadding=4>
} if ($rst[Gladiators][$k][StatusID] > 1) { $salary += round($rst[Gladiators][$k][Price] / 10); } } $rst[TrainDate] = mktime(); $money = moneygained($rst, 1); $rst[ShopDate] = mktime(); //print "$money,1,$r[UserID] (лавка)<br>---------------"; if ($money > 0) { $rst = short_transfer_money($rst, $money, 1, $r[UserID], 20, 0); } //print "$salary,$r[UserID],1 (зарплата гладиаторов)<br>---------------"; if ($salary > 0) { $rst = short_transfer_money($rst, $salary, $r[UserID], 1, 19, 0); } //print $staffsalary[$r[UserID]].",$r[UserID],1 (зарплата спецов)<br>---------------"; if ($staffsalary[$r[UserID]] > 0) { $rst = short_transfer_money($rst, $staffsalary[$r[UserID]], $r[UserID], 1, 9, 0); } //print $repair[$r[UserID]].",$r[UserID],1 (поддержка построек)<br>---------------"; if ($repair[$r[UserID]] > 0) { $rst = short_transfer_money($rst, $repair[$r[UserID]], $r[UserID], 1, 7, 0); } //write_rst($r[UserID],$rst); mysql_query("update fn_accounts set Money='{$rst['Money']}' where UserID='{$r['UserID']}'"); unlock_rst($r[UserID]); } //mysql_query("delete from ut_races where Date<unix_timestamp()-86400*7"); //mysql_query("delete from ut_stakes where Date<unix_timestamp()-86400*7"); $db->close();
<?php include "../config.php"; $user = 20; lock_rst($user); $rst = read_rst($user); $rst[Status][4] = strval(100); $rst[Status][8] = strval(100); $rst[Status][2] = strval(100); write_rst($user, $rst); unlock_rst($user);
$rst2[Gladiators][$k][Injury] = $v[Injury]; $rst2[Gladiators][$k][Stamina] = $v[Stamina]; $rst2[Gladiators][$k][Exp] += round($v[Exp], 3); //print "[$k][Morale]=$v[Morale]<br>"; //print "[$k][Injury]=$v[Injury]<br>"; //print "[$k][Stamina]=$v[Stamina]<br>"; //print "[$k][Exp]=$v[Exp]<br>"; } } //exit; $rst1[Date] = mktime(); $rst2[Date] = mktime(); write_rst($user1, $rst1); write_rst($user2, $rst2); unlock_rst($user1); unlock_rst($user2); //exit; header("Location:online.php?id={$id}"); } } else { print "До боя осталось: <input type=\"text\" id=\"Timer\" style=\"border:0;background-color:3B484C;color:E5CEA6\" readonly size=4>"; print "<br><a href=/builder/?id={$id}>Вернуться к настройкам</a>"; ?> <script language="JavaScript"> <!-- www.cgi.ru --> var up, down; var min1, sec1;
function sell_building($user, $id, $level, $price) { global $REMOTE_ADDR; $q = select("select BuildingID, max(LeveL) from tm_buildings where BuildingID='{$id}' and UserID='{$user}' group by BuildingID"); if ($q[1] != $level) { return 0; } if (!$id || !$level || !$user || !$price) { return 0; } lock_rst($user); transfer_money($price, 1, $user, 22, 0); runsql("delete from tm_buildings where BuildingID='{$id}' and Level='{$level}' and UserID='{$user}'"); unlock_rst($user); }