Beispiel #1
0
<?php

require '../../config.php';
$form_width = 170;
require $engine_path . "cls/auth/session.php";
$type = "gladiators/train";
$act = "distribution";
$rst = $auth->rst;
unset($r);
if ($step) {
    lock_rst($auth->user);
    $gladiator = $auth->rst[Gladiators][$id];
    $k = $id;
    $exp = round($gladiator[Exp] + expgained($auth->rst));
    $q = select("select Level from ut_exp where Points<='{$exp}' order by Level desc limit 0,1");
    $points = ($q[Level] - $gladiator[Level]) * 3;
    $level = $q[Level];
    unset($er);
    if (!$id) {
        $er = "error 1";
    }
    if ($_GET['Vit'] + $_GET['Dex'] + $_GET['Acc'] + $_GET['Str'] - ($gladiator[Vit] + $gladiator[Dex] + $gladiator[Acc] + $gladiator[Str]) != $points) {
        $er = "error 2";
    }
    if ($_GET['Vit'] < $gladiator[Vit] || !$_GET['Vit']) {
        $er = "error 3";
    }
    if ($_GET['Dex'] < $gladiator[Dex] || !$_GET['Dex']) {
        $er = "error 4";
    }
    if ($_GET['Acc'] < $gladiator[Acc] || !$_GET['Acc']) {
Beispiel #2
0
<?php

require 'config.php';
$res = runsql("select UserID from ut_users");
while ($r = mysql_fetch_array($res)) {
    lock_rst($r[UserID]);
    $rst = read_rst($r[UserID]);
    $serialized = $rst[Gladiators];
    $salary = 0;
    foreach ($rst[Gladiators] as $k => $gladiator) {
        //старение---------------------
        if (round(date("d", mktime())) == 1) {
            $rst[Gladiators][$k][Age] = $rst[Gladiators][$k][Age] + 1;
        }
        //тренировка--------------------
        $exp = expgained($rst, 1);
        if ($k == 103) {
            print "{$exp} -- ";
            exit;
        }
        if (strlen($exp)) {
            $rst[Gladiators][$k][Exp] = floor($rst[Gladiators][$k][Exp] + $exp);
            //print "$k=> ".$rst[Gladiators][$k][Exp]." = ".expgained($rst,1)."<br>";
            $rst[Gladiators][$k][NextTrain] = 0;
            runsql("update ut_gladiators \nset \nExp='" . $rst[Gladiators][$k][Exp] . "',\nLevel='" . $rst[Gladiators][$k][Level] . "',\nTypeID='" . $rst[Gladiators][$k][TypeID] . "',\nRating='" . $rst[Gladiators][$k][Rating] . "',\nVit='" . $rst[Gladiators][$k][Vit] . "',\nDex='" . $rst[Gladiators][$k][Dex] . "',\nAcc='" . $rst[Gladiators][$k][Acc] . "',\nStr='" . $rst[Gladiators][$k][Str] . "',\nVit='" . $rst[Gladiators][$k][Vit] . "',\n\nWin='" . $rst[Gladiators][$k][Win] . "',\nTie='" . $rst[Gladiators][$k][Tie] . "',\nLose='" . $rst[Gladiators][$k][Lose] . "'\n\nwhere GladiatorID='{$k}'");
        }
        if ($rst[Gladiators][$k][StatusID] > 1) {
            $salary += round($rst[Gladiators][$k][Price] / 10);
        }
    }
    $rst[TrainDate] = mktime();
Beispiel #3
0
<?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);
Beispiel #4
0
 runsql("delete from ft_agreements where RecordID='{$id}'");
 fclose($file);
 $res = exec("/var/www/gladiators_admin/gladcore /var/www/gladiators.ru/files/gam/{$id}.gam");
 //$fname=$site_path."files/gam/".$id.".gam";
 //$f=fopen($fname,"r");
 //$gam=unserialize(substr(fread($f,filesize($fname)),39));
 $user1 = $q[UserID1];
 $user2 = $q[UserID2];
 //$fname=$site_path."files/gam/".$id.".res";
 //$f=fopen($fname,"r");
 $ar = unserialize($res);
 //print "1) ".$ar[Score].$ar[Score][0]."<br>";
 //print "2) ".$ar[Score][1]."<br>";
 //print "деньги: ".$ar[Money]."<br>";
 lock_rst($user1);
 lock_rst($user2);
 $rst1 = read_rst($user1);
 $rst2 = read_rst($user2);
 foreach ($rst1[Gladiators] as $k => $v) {
     if (!$rst1[Gladiators][$k][PercentTrain]) {
         $rst1[Gladiators][$k][PercentTrain] = 0;
     }
     $coef = 10 + (100 - $rst1[Gladiators][$k][PercentTrain]) * 30 / 100;
     $rst1[Gladiators][$k][Stamina] = intval($rst1[Gladiators][$k][Stamina] + $coef * (mktime() - $r[Date]) / 3600);
     if ($rst1[Gladiators][$k][Morale] != 0) {
         $mor = intval(round($rst1[Gladiators][$k][Morale] - $rst1[Gladiators][$k][Morale] / abs($rst1[Gladiators][$k][Morale]) * (mktime() - $r[Date]) / 3600));
         if ($mor * $rst1[Gladiators][$k][Morale] < 0) {
             $rst1[Gladiators][$k][Morale] = 0;
         } else {
             $rst1[Gladiators][$k][Morale] = $mor;
         }
Beispiel #5
0
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);
}