Beispiel #1
0
 public function indexAction()
 {
     $departModel = M('Depart');
     $allDepart = $departModel->select();
     $adminuid = C('users')['666666'];
     $allDepart = get_one($allDepart, 'id');
     if ($this->uid != $adminuid) {
         $allDepart = array($allDepart[$this->uid]);
     }
     $this->assign('departList', $allDepart);
     $this->display();
 }
Beispiel #2
0
 public function caravan_send($config, $player, $town, $wood, $stone, $iron)
 {
     $town = textV($town);
     $wood = (int) $wood;
     $stone = (int) $stone;
     $iron = (int) $iron;
     if ($wood + $stone + $iron < 1) {
         $msg = 'wyślij minimum 1 sztukę jakiegoś surowca';
     } elseif ($player->clan_id == 0) {
         $msg = 'nie jesteś w klanie, karawany można wysyłać tylko do sojuszników w swoim klanie';
     } elseif ($player->town->t_wood < $wood || $player->town->t_stone < $stone || $player->town->t_iron < $iron) {
         $msg = 'nie posiadasz tyle surowców';
     } else {
         $can = get_row($q = "select clan_id, t_id from users inner join towns on t_usr_id = usr_id where t_name = '" . $town . "' limit 1");
         if (empty($can)) {
             $msg = 'takie miasto nie istnieje';
         } elseif ($can->clan_id != $player->clan_id) {
             $msg = 'te miasto nie jest w tym samym klanie co ty';
         } else {
             $event_check = get_one("select count(*) from events where (e_type = 20 or e_type = 21) and e_done = 0 and e_t_id = " . $player->actual_town);
             if ($event_check > 9) {
                 $msg = 'masz już maksymalną ilość karawan w podróży';
             } else {
                 $market_lvl = get_one("select go_lvl from game_objects where go_type = 1 and go_subtype = 6 and go_t_id = " . $player->actual_town);
                 if (empty($market_lvl)) {
                     $msg = 'nie posiadasz rynku, jak chcesz wysłać karawanę??';
                 } elseif ($market_lvl <= $event_check) {
                     $msg = 'masz już maksymalną ilość karawan w podróży';
                 } else {
                     $y = get_row("select * from map where m_t_id =" . $can->t_id);
                     $x = get_row("select * from map where m_t_id =" . $player->actual_town);
                     if ($x->m_x != $y->m_x && $x->m_y == $y->m_y) {
                         $range = abs($y->m_x - $x->m_x) * 300;
                     } elseif ($x->m_x == $y->m_x && $x->m_y != $y->m_y) {
                         $range = abs($y->m_y - $x->m_y) * 300;
                     } else {
                         $range = floor(sqrt(pow(abs($y->m_x - $x->m_x), 2) + pow(abs($y->m_y - $x->m_y), 2))) * 300;
                     }
                     call("insert into caravan(ca_from, ca_to, ca_wood, ca_stone, ca_iron)\n\t\t\t\t\t\t\tvalue(" . $player->actual_town . "," . $can->t_id . "," . $wood . "," . $stone . "," . $iron . ")");
                     $ca = get_row("select last_insert_id() as ca, unix_timestamp() as estart");
                     require_once 'functions/TownMgr.php';
                     $TownMgr = new TownMgr();
                     $TownMgr->change_resources($config, $player->actual_town, -$wood, -$stone, -$iron, 0);
                     require_once 'functions/EventsMgr.php';
                     $EventMgr = new EventsMgr();
                     $EventMgr->event_add($config, $player->actual_town, 20, $can->t_id, $ca->ca, 0, $ca->estart, $ca->estart + $range, 0);
                     $msg = 'wysłano karawanę do miasta ' . $town;
                 }
             }
         }
     }
     return $msg;
 }
Beispiel #3
0
 public function buy_coins($config, $player, $code)
 {
     $code = textV($code);
     $can = get_one($q = "select usr_id from vip_code where code ='" . $code . "' limit 1");
     if (!isset($can) || $can > 0) {
         $msg = 'niepoprawny kod';
     } else {
         call("update users set coins = coins + 100 where usr_id = " . $player->usr_id);
         call("update vip_code set usr_id = " . $player->usr_id . ", date = now() where code = '" . $code . "'");
         $msg = 'dodano 100 monet';
     }
     return $msg;
 }
Beispiel #4
0
 public function msg_send($config, $user, $to, $text)
 {
     $user = (int) $user;
     $to = textV($to);
     $text = textV($text);
     $to_user = get_one("select usr_id from users where login ='******' limit 1");
     if (!empty($to_user)) {
         call("insert into messages (m_from, m_to, m_type, m_text, m_date)\n\t\t\t\t  values(" . $user . "," . $to_user . ",2,'" . $text . "',now()),(" . $user . "," . $to_user . ",1,'" . $text . "',now())");
         return "wiadomość wysłano";
     } else {
         return "nie ma takiego użytkownika";
     }
 }
Beispiel #5
0
 public function new_town($config, $player)
 {
     if ($player->actual_town == 0) {
         $is = get_one("select count(*) from towns where t_name ='" . $player->town . "'");
         if ($is == 1) {
             $player->town .= date("His");
         }
         call("\n\t\t\tinsert into towns (t_usr_id, t_name, t_nation, t_last_inc)\n\t\t\tvalue (" . $player->usr_id . ",'" . $player->town . "'," . $player->nation . ", unix_timestamp())\n\t\t\t");
         $town_id = get_one("select last_insert_id()");
         call("\n\t\t\tupdate map\n\t\t\tset m_t_id = {$town_id}\n\t\t\twhere m_t_id = 0\n\t\t\torder by rand() limit 1\n\t\t\t");
         call("\n\t\t\tupdate users\n\t\t\tset actual_town = {$town_id}\n\t\t\twhere usr_id = " . $player->usr_id);
         call("\n\t\t\tinsert into town_objects (to_t_id, to_gop_id, to_can)\n\t\t\tselect " . $town_id . ", gop_id, gop_can\n\t\t\tfrom game_objects_param\n\t\t\twhere gop_nation = " . $player->nation);
         reload($config, 'town', '');
     }
 }
Beispiel #6
0
 public function login($config, $login, $pass)
 {
     $msg = '';
     $login = textV($login);
     $pass = md5(textV($pass));
     $user = get_one("select usr_id from arena_users where login = '******' and pass = '******' limit 1");
     if (!empty($user) && is_numeric($user) && $user > 0) {
         $_SESSION = array();
         $_SESSION['user'] = $user;
         call("update arena_users set last_login = unix_timestamp() where usr_id = " . $user);
         call("update arena_map inner join users on m_who = usr_id set m_who = 0, m_status = 1 where last_action <= unix_timestamp() - 300");
         reload($config, 'hero', '');
     } else {
         $msg = 'Wprowadzono błędne dane ';
     }
     return $msg;
 }
Beispiel #7
0
 /**
  * Verifies if the user is logged in and authenticates if not and POST contains username, else displays the login form
  * @return bool Returns true when the user has been logged in
  */
 function require_auth()
 {
     global $errors;
     // If user has already logged in...
     if ($this->logged_in) {
         return TRUE;
     }
     // Authenticate by POST data
     if (isset($_POST['username'])) {
         $username = $_POST['username'];
         $password = $_POST['password'];
         $user_id = get_one("SELECT user_id FROM user WHERE username = '******' AND password = '******'");
         if (!empty($user_id)) {
             $_SESSION['user_id'] = $user_id;
             return true;
         } else {
             $errors[] = "Vale kasutajanimi või parool";
         }
     }
     // Display the login form
     require 'templates/auth_template.php';
     // Prevent loading the requested controller (not authenticated)
     exit;
 }
Beispiel #8
0
<?php

require "config.php";
require "system/database.php";
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    if (isset($_GET["kuupaeva_id"]) && !empty($_GET["kuupaeva_id"])) {
        $id = intval($_GET["kuupaeva_id"]);
        $inimeste_arv = get_one("SELECT SUM(inimeste_arv) FROM broneering WHERE kuupaeva_id = {$id}");
        $vabad = 26 - $inimeste_arv;
        echo $vabad;
    }
} else {
    echo "Sa oled vales kohas. <a href='/do'>Mine tagasi esilehele!</a>";
}
Beispiel #9
0
require_once 'funkcje/podstawowe.php';
isUser($config);
$player = getUser($config);
if (empty($_GET['type'])) {
    $_GET['type'] = 0;
}
if (empty($_GET['subtype'])) {
    $_GET['subtype'] = 0;
}
if (empty($_GET['mid'])) {
    $_GET['mid'] = 0;
}
$_GET['mid'] = intV($_GET['mid']);
$_GET['type'] = intV($_GET['type']);
$_GET['subtype'] = intV($_GET['subtype']);
$object = get_one("select m_id from arena_map inner join arena_monsters on mo_id = m_subtype  where m_type = 5 and m_subtype =  " . $_GET['subtype'] . " and m_id = " . $_GET['mid'] . " limit 1");
if (!empty($object)) {
    switch ($_GET['subtype']) {
        case 1:
            $items = get_all("select * from arena_items_param ");
            echo "\n\t\t\t\t\t\t\t<div class='highslide-header'><b>Meglash</b> [esc - wyjście]\n\t\t\t\t\t\t\t\t<ul>\n\t\t\t\t\t\t\t\t\t<li class='highslide-move'>\n\t\t\t\t\t\t\t\t\t\t<a style='color:#000000'  href='#' title='przesuń' onclick='return false'>\n\t\t\t\t\t\t\t\t\t\t\t<span>&lt;&gt;</span>\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t<li class='highslide-close'>\n\t\t\t\t\t\t\t\t\t\t<a style='color:#000000'  href='#' title='zamknij' onclick='hs.height = 120; hs.width = 220; return hs.close(this)'>\n\t\t\t\t\t\t\t\t\t\t\t<span>zamknij</span>\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t";
            $echo = '';
            if (is_array($items)) {
                foreach ($items as $item) {
                    $options = '';
                    if ($item->ip_gold <= $player->gold) {
                        $options .= "<a style='color:#000000'  href='?action=map&item_buy=" . $item->ip_id . "' >[ kup ]</a>";
                    }
                    $item->ip_text .= "<br/>";
                    if ($item->ip_attack > 0) {
                        $item->ip_text .= "Zwiększa <span class='red'>atak</span> herosa o <span class='red'>" . 1 * $item->ip_attack . "</span><br/>";
Beispiel #10
0
}
$skills = get_all("select * from arena_skills_param left join arena_user_skills on sp_id = us_sp_id and us_usr_id =" . $player->usr_id);
$echo = '';
foreach ($skills as $skill) {
    if (empty($skill->us_lvl)) {
        $skill->us_lvl = 0;
        $skill->us_active = 0;
        $price = 1;
    } else {
        $price = $skill->us_lvl;
    }
    $options = '';
    if ($skill->us_active == 0 && $player->skills > $skill->us_lvl) {
        $options = "<a  href='?action=skills&skillup=" . $skill->sp_id . "'>[ zwiększ za " . $price . " PU ]</a> ";
    }
    $limit = get_one("select count(*) from arena_user_skills where us_usr_id = " . $player->usr_id . " and us_active = 1");
    if ($skill->us_active == 0 && $skill->us_lvl > 0 && $limit < 3) {
        $options .= "<a style='color:#F39604' href='?action=skills&active=" . $skill->sp_id . "'>[ aktywuj ]</a>";
    } elseif ($skill->us_active == 1 && $skill->us_lvl > 0) {
        $options .= "<a  href='?action=skills&deactive=" . $skill->sp_id . "'>[ deaktywuj ]</a>";
    }
    $skill->sp_text .= "<br/>";
    if ($skill->sp_attack > 0) {
        $skill->sp_text .= "Aktywowana zdolność będzie zwiększać <span class='red'>atak</span> herosa o <span class='red'>" . $price * $skill->sp_attack . "</span> [" . $skill->sp_attack . " na każdy poziom ]<br/>";
    }
    if ($skill->sp_defence > 0) {
        $skill->sp_text .= "Aktywowana zdolność będzie zwiększać <span class='red'>obronę</span> herosa o <span class='red'>" . $price * $skill->sp_defence . "</span> [" . $skill->sp_defence . " na każdy poziom ]<br/>";
    }
    if ($skill->sp_absorb > 0) {
        $skill->sp_text .= "Aktywowana zdolność będzie zwiększać <span class='red'>absorbcję</span> herosa o <span class='red'>" . $price * $skill->sp_absorb . "</span> [" . $skill->sp_absorb . " na każdy poziom ]<br/>";
    }
Beispiel #11
0
<?php

require_once 'includes/load.php';
//ucitaj pomocne fajlove
include_once 'includes/header_admin.php';
//ukljuci admin menu
confirm_logged_in();
//potvrdi ulogovanost
if (isset($_GET['id'])) {
    //ako je prosledjen id
    $id = $_GET['id'];
    //preuzmi id
    $news = get_one('news', $id);
    //preuzmi podatke
} else {
    //ako nije prosledjen
    echo redirect('staff.php');
    //prebaci ga na staff.php
}
?>
<!-- POCETAK - prikazi sadrzaj vijesti -->
<h2><?php 
echo $news['title'];
?>
</h2>

<?php 
if (file_exists($news['img_path'])) {
    echo '<center><img src="' . $news['img_path'] . '" width="400"></center>';
}
?>
Beispiel #12
0
 public function build_end($town, $type, $subtype, $count, $start, $end)
 {
     //pobierz dane obiektu
     $object = get_row("\n\t\t\tselect * from game_objects_param \n\t\t\tleft join game_objects \n\t\t\ton go_t_id = " . $town . "\n\t\t\tand go_gop_id = gop_id\n\t\t\twhere gop_type = " . $type . " and gop_subtype = " . $subtype . "\n\t\t\tlimit 1\n\t\t");
     //jeżeli obiektu nie ma na liście obiektów wybudowanych, to bierz pod uwagę parametry startowe
     if (empty($object->go_id)) {
         $object->go_lvl = 0;
     }
     switch ($type) {
         case 1:
             switch ($subtype) {
                 case 1:
                     //tartak
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_wood_inc = t_wood_inc + 50 where t_id = {$town}");
                     } else {
                         call("update towns set t_wood_inc = t_wood_inc * 1.2 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 2:
                     //cegielnia
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_stone_inc = t_stone_inc + 50 where t_id = {$town}");
                     } else {
                         call("update towns set t_stone_inc = t_stone_inc * 1.2 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 3:
                     //Kopalnia złota
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_iron_inc = t_iron_inc + 50 where t_id = {$town}");
                     } else {
                         call("update towns set t_iron_inc = t_iron_inc * 1.2 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 4:
                     //młyn
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_pop_max = t_pop_max * 1.3  where t_id = {$town}");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                         call("update towns set t_pop_max = t_pop_max * 1.3 where t_id = {$town}");
                         if ($object->go_lvl == 2) {
                             call("update town_objects set to_can = 1 where to_gop_id = 7 and to_t_id = {$town}");
                         }
                     }
                     break;
                 case 5:
                     //koszary
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 9 or to_gop_id = 21");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                         switch ($object->go_lvl) {
                             case 2:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 10");
                                 break;
                             case 4:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 11 or to_gop_id = 22");
                                 break;
                             case 5:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 15");
                                 break;
                             case 6:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 12");
                                 break;
                             case 9:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 13 or to_gop_id = 23");
                                 break;
                             case 14:
                                 call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id = 14");
                                 break;
                             default:
                                 break;
                         }
                     }
                     break;
                 case 7:
                     //ratusz
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update town_objects set to_can = 1 where to_t_id = {$town} and to_gop_id >= 16 and to_gop_id <= 20");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                         if ($object->go_lvl == 2) {
                             call("update town_objects set to_can = 1 where to_gop_id = 6 and to_t_id = {$town}");
                         } elseif ($object->go_lvl == 1) {
                             call("update town_objects set to_can = 1 where to_gop_id = 5 and to_t_id = {$town}");
                         }
                     }
                     break;
                 case 8:
                     //magazyn
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_res_max = t_res_max * 1.3  where t_id = {$town}");
                     } else {
                         call("update towns set t_res_max = t_res_max * 1.3  where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 default:
                     //inne
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
             }
             break;
         case 2:
             switch ($subtype) {
                 case 1:
                     //Wycinka Drzew
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_wood_inc = t_wood_inc * 1.1 where t_id = {$town}");
                     } else {
                         call("update towns set t_wood_inc = t_wood_inc * 1.1 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 2:
                     //Wiedza o glebie
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_stone_inc = t_stone_inc * 1.1 where t_id = {$town}");
                     } else {
                         call("update towns set t_stone_inc = t_stone_inc * 1.1where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 3:
                     //Wiedza o skałach
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_iron_inc = t_iron_inc * 1.1 where t_id = {$town}");
                     } else {
                         call("update towns set t_iron_inc = t_iron_inc * 1.1 where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
                 case 4:
                     //higiena
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_pop_max = t_pop_max * 1.1  where t_id = {$town}");
                     } else {
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                         call("update towns set t_pop_max = t_pop_max * 1.1  where t_id = {$town}");
                     }
                     break;
                 case 5:
                     //magazynynowanie
                     if ($object->go_lvl == 0) {
                         call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} * ((100 + {$object->gop_res_inc})/100), {$object->gop_stone} * ((100 + {$object->gop_res_inc})/100), {$object->gop_iron} * ((100 + {$object->gop_res_inc})/100), {$object->gop_pop} * ((100 + {$object->gop_res_inc})/100), {$object->gop_time} * ((100 + {$object->gop_time_inc})/100))");
                         call("update towns set t_res_max = t_res_max * 1.2  where t_id = {$town}");
                     } else {
                         call("update towns set t_res_max = t_res_max * 1.2  where t_id = {$town}");
                         call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + 1, go_wood = go_wood * ((100 + {$object->gop_res_inc})/100), go_stone = go_stone * ((100 + {$object->gop_res_inc})/100), go_iron =  go_iron * ((100 + {$object->gop_res_inc})/100), go_pop= go_pop * ((100 + {$object->gop_res_inc})/100), go_time = go_time * ((100 + {$object->gop_time_inc})/100)\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
                     }
                     break;
             }
             break;
         case 3:
             //units
             $is_unit = get_one("select go_id from game_objects where go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype} limit 1");
             if (empty($is_unit)) {
                 call("\n\t\t\t\t\t\t\tinsert into game_objects (go_t_id, go_type, go_subtype, go_gop_id, go_wood, go_stone, go_iron, go_pop, go_time, go_attack, go_defence, go_life, go_range, go_lvl)\n\t\t\t\t\t\t\tvalue(  {$town}, {$type}, {$subtype}, {$object->gop_id}, {$object->gop_wood} , {$object->gop_stone} , {$object->gop_iron}, {$object->gop_pop}, {$object->gop_time},{$object->gop_attack}, {$object->gop_defence}, {$object->gop_life}, {$object->gop_range}, {$count})");
             } else {
                 call("\n\t\t\t\t\t\t\tupdate game_objects \n\t\t\t\t\t\t\tset go_lvl = go_lvl + {$count}\n\t\t\t\t\t\t\twhere go_t_id = {$town} and go_type = {$type} and go_subtype = {$subtype}");
             }
             break;
         case 10:
             require_once 'functions/SpyMgr.php';
             $SpyMgr = new SpyMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $SpyMgr->spy_battle($config, $newevent);
             break;
         case 11:
             require_once 'functions/SpyMgr.php';
             $SpyMgr = new SpyMgr();
             $SpyMgr->spy_dismis($config, $town, $count);
             break;
         case 20:
             require_once 'functions/MarketMgr.php';
             $MarketMgr = new MarketMgr();
             $MarketMgr->caravan_unload($config, $subtype, $count);
             $back = $MarketMgr->caravan_back($config, $town, $count);
             break;
         case 21:
             require_once 'functions/MarketMgr.php';
             $MarketMgr = new MarketMgr();
             $MarketMgr->caravan_unload($config, $town, $count);
             $back = $MarketMgr->caravan_dismis($config, $count);
             break;
         case 30:
             require_once 'functions/ArmyMgr.php';
             $ArmyMgr = new ArmyMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $ArmyMgr->army_battle($config, $newevent);
             break;
         case 31:
             require_once 'functions/ArmyMgr.php';
             $ArmyMgr = new ArmyMgr();
             $ArmyMgr->army_dismis($config, $town, $count);
             break;
         case 70:
             require_once 'functions/ColectorsMgr.php';
             $ColectorsMgr = new ColectorsMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $ColectorsMgr->colectors_work($config, $newevent);
             break;
         case 71:
             require_once 'functions/ColectorsMgr.php';
             $ColectorsMgr = new ColectorsMgr();
             $back = $ColectorsMgr->colectors_dismis($config, $town, $count);
             break;
         case 80:
             require_once 'functions/ThiefsMgr.php';
             $ThiefsMgr = new ThiefsMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $ThiefsMgr->thiefs_work($config, $newevent);
             break;
         case 81:
             require_once 'functions/ThiefsMgr.php';
             $ThiefsMgr = new ThiefsMgr();
             $back = $ThiefsMgr->thiefs_dismis($config, $town, $count);
             break;
         case 90:
             require_once 'functions/AssasinsMgr.php';
             $AssasinsMgr = new AssasinsMgr();
             $newevent->e_t_id = $town;
             $newevent->e_type = $type;
             $newevent->e_subtype = $subtype;
             $newevent->e_count = $count;
             $newevent->e_start = $start;
             $newevent->e_end = $end;
             $AssasinsMgr->assasins_battle($config, $newevent);
             break;
         case 91:
             require_once 'functions/AssasinsMgr.php';
             $AssasinsMgr = new AssasinsMgr();
             $AssasinsMgr->assasins_dismis($config, $town, $count);
             break;
         default:
             break;
     }
 }
Beispiel #13
0
function getUser($config)
{
    $player = get_row("select *, unix_timestamp() as tnow from users where usr_id = {$_SESSION['user']}");
    $player->msg = get_one("select count(*) from messages where m_status = 0 and m_type = 1 and  m_to = " . $player->usr_id);
    return $player;
}
Beispiel #14
0
$echo = '';
foreach ($player_towns as $town) {
    $echo .= "<LI><a href='?action=town&set_town=" . $town->t_id . "'>{$town->t_name}</a></LI>";
}
echo $echo;
?>
		</UL>
	</div>
</DIV>
<DIV id="content" class="contentNormal">
	<?php 
if (!empty($_POST['name'])) {
    $_POST['name'] = textV($_POST['name']);
    if (!empty($_POST['name'])) {
        if (strlen($_POST['name']) >= 5 && strlen($_POST['name']) <= 15) {
            $ok = get_one("select count(*) from towns where t_name = '" . $_POST['name'] . "'");
            if ($ok > 0) {
                echo "ta nazwa jest zajęta<hr/>";
            } else {
                call("update towns set t_name = '" . $_POST['name'] . "' where t_id = " . $player->town->t_id);
                reload($config, 'town', '');
            }
        } else {
            echo "nieodpowiednia długość nazwy miasta (5-15znaków)<hr/>";
        }
    }
}
?>
	<form action='?action=town' method='post'>
		<input type='text' name='name' value ='<?php 
echo $player->town->t_name;
Beispiel #15
0
 public function send_app($config, $player, $clan)
 {
     $clan = (int) $clan;
     $msg = '';
     if ($player->clan_id > 0) {
         $msg = 'jesteś już w klanie';
     } else {
         $can = get_one("select c_id from clans where c_id = " . $clan);
         $is = get_one("select count(*)  from clans_users where cu_c_id = " . $clan . " and cu_usr_id = " . $player->usr_id);
         if (empty($can)) {
             $msg = 'nie ma takiego klanu';
         } elseif ($is > 0) {
             $msg = 'już złożyłeś podanie do tego klanu';
         } else {
             call("insert into clans_users (cu_c_id, cu_usr_id) value (" . $clan . "," . $player->usr_id . ")");
             $msg = 'wysłano podanie ';
         }
     }
     return $msg;
 }
Beispiel #16
0
function rand_lucky_phone()
{
    //随机拿一条
    $sql = "SELECT * FROM `cxg_phone` AS t1 JOIN (SELECT ROUND(RAND() * ((SELECT MAX(id) FROM `cxg_phone`)-(SELECT MIN(id) FROM `cxg_phone`))+(SELECT MIN(id) FROM `cxg_phone`)) AS id) AS t2 WHERE t1.isLucky = 0 and t1.id >= t2.id ORDER BY t1.id LIMIT 1";
    $data = get_one($sql);
    return $data;
}
Beispiel #17
0
}
if (empty($_GET['subtype'])) {
    $_GET['subtype'] = 0;
}
if (empty($_GET['who'])) {
    $_GET['who'] = '';
}
if (empty($_GET['mid'])) {
    $_GET['mid'] = 0;
}
$_GET['mid'] = intV($_GET['mid']);
$_GET['type'] = intV($_GET['type']);
$_GET['subtype'] = intV($_GET['subtype']);
$_GET['who'] = textV($_GET['who']);
if (!empty($_GET['who'])) {
    $who = get_one("select usr_id from arena_users where login = '******'who'] . "'");
    $object = get_row("select * from arena_map where m_who = " . $who . " limit 1");
    $player_map = get_row("select * from arena_map where m_who = " . $player->usr_id . " limit 1");
    if (!empty($object)) {
        if ($player_map->m_x >= $object->m_x - 1 && $player_map->m_x <= $object->m_x + 1 && $player_map->m_y >= $object->m_y - 1 && $player_map->m_y <= $object->m_y + 1) {
            echo "\n\t\t\t<div class='highslide-header'><b>" . $_GET['who'] . "</b> [esc - wyjście]\n\t\t\t\t<ul>\n\t\t\t\t\t<li class='highslide-move'>\n\t\t\t\t\t\t<a style='color:#000000'  href='#' style='color:#000000' title='przesuń' onclick='return false'>\n\t\t\t\t\t\t\t<span>&lt;&gt;</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li class='highslide-close'>\n\t\t\t\t\t\t<a style='color:#000000'  href='#' title='zamknij' onclick='hs.height = 120; hs.width = 220; return hs.close(this)'>\n\t\t\t\t\t\t\t<span>zamknij</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\n\t\t\t<p>\n\t\t\thello\n\t\t\t</p>\n\t\t\t\n\t\t\t";
        } else {
            echo "\n\t\t\t<div class='highslide-header'><b>" . $_GET['who'] . "</b> [esc - wyjście]\n\t\t\t\t<ul>\n\t\t\t\t\t<li class='highslide-move'>\n\t\t\t\t\t\t<a style='color:#000000'  href='#' title='przesuń' onclick='return false'>\n\t\t\t\t\t\t\t<span>&lt;&gt;</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li class='highslide-close'>\n\t\t\t\t\t\t<a style='color:#000000'  href='#' title='zamknij' onclick='hs.height = 120; hs.width = 220; return hs.close(this)'>\n\t\t\t\t\t\t\t<span>zamknij</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\n\t\t\t<p>\n\t\t\tza daleko\n\t\t\t</p>\n\t\t\t\n\t\t\t";
        }
    } else {
        echo "\n\t\t\t<div class='highslide-header'><b>...</b> [esc - wyjście]\n\t\t\t\t<ul>\n\t\t\t\t\t<li class='highslide-move'>\n\t\t\t\t\t\t<a style='color:#000000'  href='#' title='przesuń' onclick='return false'>\n\t\t\t\t\t\t\t<span>&lt;&gt;</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t\t<li class='highslide-close'>\n\t\t\t\t\t\t<a style='color:#000000'  href='#' title='zamknij' onclick='hs.height = 120; hs.width = 220; return hs.close(this)'>\n\t\t\t\t\t\t\t<span>zamknij</span>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t</li>\n\t\t\t\t</ul>\n\t\t\t</div>\n\n\t\t\t\n\t\t\t";
    }
} else {
    $object = get_row("select * from arena_map left join arena_monsters on mo_id = m_subtype  where m_type = " . $_GET['type'] . " and m_subtype =  " . $_GET['subtype'] . " and m_id = " . $_GET['mid'] . " limit 1");
    $player_map = get_row("select * from arena_map where m_who = " . $player->usr_id . " limit 1");
    if (!empty($object)) {
Beispiel #18
0
<?php

require_once 'includes/load.php';
confirm_logged_in();
if (isset($_GET['id'])) {
    //ako je prosledjen id korisnika kroz URL
    $id = $_GET['id'];
    //preuzmi id
    $user = get_one('users', $id);
    //preuzmi podatke od njemu
    if ($user) {
        //da li postoji takav korisnik u bazi
        $query = "DELETE FROM users WHERE id='{$id}'";
        $result = mysqli_query($conn, $query);
        confirm_query($result);
        if (mysqli_affected_rows($conn) == 1) {
            //provjeri da li je obrisan jedan red iz baze
            echo redirect('logout.php');
            //preusmjeri ga na logout jer taj korisnik vise ne postoji u bazi
        }
    }
}
echo redirect('staff.php');
Beispiel #19
0
 public function build($config, $player, $type, $subtype, $count)
 {
     //mini walidacja, wszystkie dane powinny być liczbowe
     $type = (int) $type;
     $subtype = (int) $subtype;
     $count = (int) $count;
     //jeżeli w dziwny nie wiadomy sposób przesłano ilość mniejszą niż 1 to ustaw = 1
     if ($count < 1) {
         $count = 1;
     }
     //jeżeli budujemy coś innego niż jdnostkę to ilość = 1
     if ($type != 3) {
         $count = 1;
     }
     //ustaw nr błędu = 1 /nieokreślony
     $error = 1;
     //pobierz dane obiektu
     $object = get_row("\n\t\t\tselect * from game_objects_param \n\t\t\tleft join game_objects \n\t\t\ton go_t_id = " . $player->actual_town . "\n\t\t\tand go_gop_id = gop_id\n\t\t\twhere gop_type = " . $type . " and gop_subtype = " . $subtype . "\n\t\t\tlimit 1\n\t\t");
     //jeżeli obiektu nie ma na liście obiektów wybudowanych, to bierz pod uwagę parametry startowe
     if (empty($object->go_id)) {
         if (!empty($object->gop_id)) {
             $object->go_wood = $object->gop_wood;
             $object->go_stone = $object->gop_stone;
             $object->go_iron = $object->gop_iron;
             $object->go_pop = $object->gop_pop;
             $object->go_time = $object->gop_time;
             $object->go_lvl = 0;
         } else {
             //jeżeli w ogóle nie ma takiego obiektu ustaw error = 2
             $error = 2;
         }
     }
     //jeżeli obiekt to jednostka to ustaw max_lvl > lvl (de facto sprawdzane potem, bo przy jednostce nie ma limitów)
     if ($type == 3) {
         $object->gop_max_lvl = $object->go_lvl + 1;
     }
     //jeżeli nie wywaliło erroru 2
     if ($error == 1) {
         $object->go_wood = $object->go_wood * $count;
         $object->go_stone = $object->go_stone * $count;
         $object->go_iron = $object->go_iron * $count;
         $object->go_pop = $object->go_pop * $count;
         $object->go_time = $object->go_time * $count;
         if ($player->town->t_wood < $object->go_wood || $player->town->t_iron < $object->go_iron || $player->town->t_stone < $object->go_stone || $player->town->t_pop_max - $player->town->t_pop < $object->go_pop) {
             //jeżeli za mało surowców ustaw error = 3
             $error = 3;
         } else {
             if ($object->go_lvl == $object->gop_max_lvl) {
                 //jeżeli osiągnięto poziom maksymalny ustaw error = 4
                 $error = 4;
             } else {
                 //jeżeli nie to pobierz ilość aktywnych zdarzeń w kolejce dla danego typu
                 $events_check = get_one("select count(*) from events where e_t_id = " . $player->actual_town . " and e_type = " . $type . " and e_done = 0");
                 // w zależności od typu ustaw limit kolejki
                 switch ($type) {
                     case 1:
                         $max_events = 3;
                         break;
                         //budynki
                     //budynki
                     case 2:
                         $max_events = 2;
                         break;
                         //technologie
                     //technologie
                     case 3:
                         $max_events = 5;
                         break;
                         //jednostki
                     //jednostki
                     default:
                         $max_events = 0;
                         break;
                 }
                 $isbuild = get_one("select count(*) from events where e_t_id = " . $player->actual_town . " and e_type = " . $type . " and e_done = 0 and e_subtype = " . $subtype . "");
                 if ($events_check >= $max_events) {
                     //jeżeli osiągnięto limit kolejki dla danego typu  ustaw error = 5
                     $error = 5;
                 } elseif ($isbuild > 0) {
                     $error = 6;
                 } else {
                     //pobierz ostatni wykonywany element w kolejce
                     $last_event_time = get_one("select e_end from events where e_t_id = " . $player->actual_town . " and e_type = " . $type . " and e_done = 0 order by e_id desc");
                     $utime = get_one("select unix_timestamp()");
                     //jeżeli jest coś w kolejce to ustaw odpowiednio czas
                     if (!empty($last_event_time)) {
                         $start = $last_event_time;
                         $end = $object->go_time + $last_event_time;
                     } else {
                         $start = $utime;
                         $end = $utime + $object->go_time;
                     }
                     //dodaj element do kolejki
                     require_once 'functions/EventsMgr.php';
                     $event = new EventsMgr();
                     $event->event_add($config, $player->actual_town, $type, $subtype, $count, 0, $start, $end, 0);
                     //odejmij surowce
                     require_once 'functions/TownMgr.php';
                     $town = new TownMgr();
                     $town->change_resources($config, $player->actual_town, -$object->go_wood, -$object->go_stone, -$object->go_iron, $object->go_pop);
                     //zwróć error = 0 /nie ma błędu
                     $error = 0;
                 }
             }
         }
     }
     return $error;
 }
Beispiel #20
0
 public function skill_active($config, $player, $skill)
 {
     $skill = intV($skill);
     $can = get_row("select * from arena_skills_param inner join arena_user_skills on us_usr_id = " . $player->usr_id . " and us_sp_id = " . $skill . " where sp_id = " . $skill . " limit 1");
     $limit = get_one("select count(*) from arena_user_skills where us_usr_id = " . $player->usr_id . " and us_active = 1");
     if (empty($can)) {
         $msg = 'nie ma takiego skila';
     } elseif ($limit >= 3) {
         $msg = 'możesz mieć tylko 3 aktywne umiejętności';
     } elseif ($can->us_active == 1) {
         $msg = 'już aktywne';
     } else {
         call("update arena_user_skills set us_active = 1 where us_usr_id = " . $player->usr_id . " and us_sp_id = " . $skill);
         $this->add_stats($config, $player, $can->us_lvl * $can->sp_attack, $can->us_lvl * $can->sp_defence, $can->us_lvl * $can->sp_absorb, $can->us_lvl * $can->sp_life_max, $can->us_lvl * $can->sp_energy_max, $can->us_lvl * $can->sp_life_inc, $can->us_lvl * $can->sp_energy_inc, $can->us_lvl * $can->sp_dam_min, $can->us_lvl * $can->sp_dam_max);
         $msg = 'aktywowano umiejętność';
     }
     return $msg;
 }
Beispiel #21
0
         }
     } else {
         echo "brak podań";
     }
     break;
 case 'clan_msg':
     if ($player->clan_id == 0) {
         reload($config, 'clan');
     }
     echo "\n\t\t\t<form action='?action=clan&act=clan_msg' method='post'>\n\t\t\t\tWyślij wiadomość do wszystkich w klanie<br/>\n\t\t\t\t<textarea name='text' cols=40 get_rows =6></textarea><br/>\n\t\t\t\t<input type='submit' value='wyślij wiadomość'/>\n\t\t\t</form>\n\t\t\t";
     break;
 default:
     if ($status == 0) {
         echo "\n\t\t\tNie jesteś w klanie, załóż własny klan i przyłącz innych graczy!<br/><br/>\n\t\t\t<form action='?action=clan' method='post'>\n\t\t\t\tpodaj nazwę klanu: <input type='text' name='clan_name' />\n\t\t\t\t<input type='submit' value='załóż klan'/>\n\t\t\t</form>\n\t\t\t";
     } else {
         $name = get_one("select c_name from clans where c_id = " . $player->clan_id . " limit 1 ");
         echo "\n\t\t\t<h3>Klan: <I>{$name}</I></h3>";
         if ($status == 2) {
             echo "<a href='?action=clan&del=true'>[ usuń klan ]</a><br/><br/>";
         } else {
             echo "<a href='?action=clan&run=true'>[ odejdź ]</a><br/><br/>";
         }
         echo "\n\t\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<th>Gracz</th>\n\t\t\t\t<th>Ranga</th>\n\t\t\t\t<th>Miast</th>\n\t\t\t\t<th></th>\n\t\t\t</tr>\n\t\t\t";
         $clans = get_all("select login, cu_status, usr_id, cu_id,(select count(*) from towns  where t_usr_id = usr_id) as townc  from users inner join clans on clan_id = c_id inner join clans_users on cu_usr_id = usr_id where cu_c_id = " . $player->clan_id . " and cu_status > 0");
         if (is_array($clans)) {
             foreach ($clans as $clan) {
                 $del = '';
                 if ($clan->cu_status == 1) {
                     $ranga = 'klanowicz';
                 } else {
                     $ranga = 'mistrz';
Beispiel #22
0
 public function army_send($config, $player, $town, $units)
 {
     $town = textV($town);
     $sum = 0;
     foreach ($units as $unit) {
         $unit = (int) $unit;
         $sum += $unit;
     }
     if ($sum < 1) {
         $msg = 'wyślij minimum 1 jednostkę';
     } else {
         $check = count($units);
         foreach ($units as $key => $value) {
             $can = get_row("select * from game_objects where go_type = 3 and go_subtype = {$key} and go_t_id =" . $player->actual_town . " and go_lvl >= {$value}");
             if (!empty($can)) {
                 $check--;
             }
             $units1[$key]->data = $can;
             $units1[$key]->count = $value;
         }
         if ($check != 0) {
             $msg = 'nie posiadasz tyle jednostek';
         } else {
             $event_check = get_one("select count(*) from events where (e_type = 30 or e_type = 31) and e_done = 0 and e_t_id = " . $player->actual_town);
             if ($event_check > 9) {
                 $msg = 'masz już maksymalną ilość wysłanych wypraw wojskowych';
             } else {
                 $can = get_row("select t_id, t_usr_id from towns where t_name ='" . $town . "' limit 1");
                 if (empty($can)) {
                     $msg = 'nie ma takiego miasta';
                 } elseif ($can->t_usr_id == $player->usr_id) {
                     $msg = 'nie atakuj swojego miasta';
                 } else {
                     $y = get_row("select * from map where m_t_id =" . $can->t_id);
                     $x = get_row("select * from map where m_t_id =" . $player->actual_town);
                     if ($x->m_x != $y->m_x && $x->m_y == $y->m_y) {
                         $range = abs($y->m_x - $x->m_x) * 300;
                     } elseif ($x->m_x == $y->m_x && $x->m_y != $y->m_y) {
                         $range = abs($y->m_y - $x->m_y) * 300;
                     } else {
                         $range = floor(sqrt(pow(abs($y->m_x - $x->m_x), 2) + pow(abs($y->m_y - $x->m_y), 2))) * 300;
                     }
                     $tnow = get_one("select unix_timestamp()");
                     call("insert into army (a_t_id, a_vs_id) value (" . $player->actual_town . "," . $can->t_id . ")");
                     $army_id = get_one("select last_insert_id()");
                     $insert = "insert into army_units(au_a_id, au_gop_subtype, au_counts, au_attack, au_defence, au_life, au_range) values ";
                     foreach ($units1 as $unit) {
                         call("update game_objects set go_lvl = go_lvl - " . $unit->count . " where go_type = 3 and go_subtype = " . $unit->data->go_subtype . " and go_t_id =" . $player->actual_town);
                         $insert .= "(" . $army_id . "," . $unit->data->go_subtype . "," . $unit->count . "," . $unit->data->go_attack . "," . $unit->data->go_defence . "," . $unit->data->go_life . "," . $unit->data->go_range . "),";
                     }
                     $insert = substr($insert, 0, -1);
                     call($insert);
                     require_once 'functions/EventsMgr.php';
                     $EventMgr = new EventsMgr();
                     $EventMgr->event_add($config, $player->actual_town, 30, $can->t_id, $army_id, 0, $tnow, $tnow + $range, 0);
                     $msg = 'wysłano wyprawę do miasta ' . $town;
                 }
             }
         }
     }
     return $msg;
 }
Beispiel #23
0
<?php

include "../include/init.php";
//包含配置文件
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$sql = "SELECT COUNT(*) AS c FROM {$wd_}nav";
$count = get_one($sql);
$limit = 8;
$size = 5;
$start = ($page - 1) * $limit;
$sql = "SELECT * FROM {$wd_}nav ORDER BY nav_order ASC LIMIT {$start},{$limit}";
$nav_list = get_all($sql);
$page_str = page($page, $count['c'], $limit, $size, $class = 'sabrosus');
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>导航管理</title>
<link rel="stylesheet" href="styles/style.css" type="text/css" media="all">
<link rel="stylesheet" href="../css/css.css" type="text/css" media="all">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/common.js"></script>
</head>
<body>
<div class="container">
    <h3 class="marginbot">导航列表<a href="nav_add.php" class="sgbtn">添加导航</a></h3>
    <div class="mainbox">
        <form action="" method="post">
            <table class="datalist fixwidth">
Beispiel #24
0
    foreach ($army_events as $earmy) {
        if ($earmy->e_type == 80) {
            $text = 'Wyprawa kieruje się na miasto <b>' . $earmy->t_name . '</b>';
            $actions = ' [ <a href="?action=thiefs&back=' . $earmy->e_id . '">zawróć</a> ] ';
        } else {
            $text = 'Wyprawa powraca z miasta <b>' . $earmy->t_name . '</b>';
            $actions = '';
        }
        echo "\n\t\t<tr>\n\t\t\t<td>" . $text . "</td>\n\t\t\t<td>\n\t\t\t\t<span id='s" . $earmy->e_id . "'>" . date("H:i:s", $earmy->etime - 3600) . "</span>\n\t\t\t\t<script type='text/javascript'>liczCzas2('s" . $earmy->e_id . "'," . $earmy->etime . ")</script>\n\t\t\t</td>\n\t\t\t<td>" . $actions . "</td>\n\t\t</tr>\n\t\t";
    }
    echo "\n\t\t</tbody>\n        </table>\n\t";
}
?>

<?php 
$max = get_one("select go_lvl from game_objects where go_type = 3 and go_subtype = 9 and go_t_id = " . $player->actual_town);
if (empty($max)) {
    $max = 0;
}
echo $msg . "<br/>";
if ($max > 0) {
    ?>
<form action='?action=thiefs' method='post'>
<table>
<tr>
	<td>Wyślij złodzieji na miasto: </td>
	<td><input type='text' name='town' value='<?php 
    echo $_GET['town'];
    ?>
'/></td>
</tr>
Beispiel #25
0
 public function colectors_send($config, $player, $town, $count)
 {
     $town = textV($town);
     $count = (int) $count;
     if ($count < 1) {
         $msg = 'wyślij minimum 1 zwiadowcę';
     } else {
         $can = get_row($q = "select go_lvl from game_objects where go_type = 3 and go_subtype = 8 and go_t_id =" . $player->actual_town);
         if (empty($can)) {
             $msg = 'nie posiadasz zbieraczy';
         } elseif ($can->go_lvl < $count) {
             $msg = 'nie posiadasz zbieraczy';
         } else {
             $event_check = get_one("select count(*) from events where (e_type = 70 or e_type = 71) and e_done = 0 and e_t_id = " . $player->actual_town);
             if ($event_check > 9) {
                 $msg = 'masz już maksymalną ilość wysłanych grup zbieraczy';
             } else {
                 $can = get_row("select t_id, t_usr_id from towns where t_name ='" . $town . "' limit 1");
                 if (empty($can)) {
                     $msg = 'nie ma takiego miasta';
                 } else {
                     $y = get_row("select * from map where m_t_id =" . $can->t_id);
                     $x = get_row("select * from map where m_t_id =" . $player->actual_town);
                     if ($x->m_x != $y->m_x && $x->m_y == $y->m_y) {
                         $range = abs($y->m_x - $x->m_x) * 300;
                     } elseif ($x->m_x == $y->m_x && $x->m_y != $y->m_y) {
                         $range = abs($y->m_y - $x->m_y) * 300;
                     } else {
                         $range = floor(sqrt(pow(abs($y->m_x - $x->m_x), 2) + pow(abs($y->m_y - $x->m_y), 2))) * 300;
                     }
                     $tnow = get_one("select unix_timestamp()");
                     call("update game_objects set go_lvl = go_lvl - {$count} where go_type = 3 and go_subtype = 8 and go_t_id =" . $player->actual_town);
                     call("insert into colectors (co_counts) value (" . $count . ")");
                     $id = get_one("select last_insert_id()");
                     require_once 'functions/EventsMgr.php';
                     $EventMgr = new EventsMgr();
                     $EventMgr->event_add($config, $player->actual_town, 70, $can->t_id, $id, 0, $tnow, $tnow + $range, 0);
                     $msg = 'wysłano wyprawę do miasta ' . $town;
                 }
             }
         }
     }
     return $msg;
 }
Beispiel #26
0
function goto_output($id)
{
    if (is_int($id)) {
        $id = id_shorten($id);
    }
    echo <<<EOR
<!DOCTYPE HTML>
<html><head><title>Your graph</title></head><body>
<p>Graph is ready! (<a href="{$id}.png">Direct link</a>)
<p><img src="{$id}.png">
<p><a href="index.php">Generate another graph</a>
</body></html>
EOR;
    exit;
}
if ($graph_id = get_one("SELECT graph_id FROM graphs WHERE graph_code = '{$hash}'")) {
    goto_output(intval($graph_id));
}
# build graph
$def = "{$type} G {\n{$def}\n}\n";
$engine = $type == 'graph' ? 'neato' : 'dot';
$p = proc_open("/usr/bin/{$engine} -Tpng", array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
if (!is_resource($p)) {
    die("Couldn't start graphing engine, sorry!");
}
fwrite($pipes[0], $def);
fclose($pipes[0]);
$png = stream_get_contents($pipes[1]);
fclose($pipes[1]);
$err = stream_get_contents($pipes[2]);
fclose($pipes[2]);
Beispiel #27
0
function hero_go($hero, $move)
{
    $data = get_row("select m_x, m_y, m_ms_id, m_id, m_ms_id from arena_map where m_who = {$hero}");
    if (!empty($data)) {
        $data2 = get_row("select ms_max_x, ms_max_y from arena_maps where ms_id = " . $data->m_ms_id);
        switch ($move) {
            case 1:
                $mid = get_one("select m_id from arena_map   where m_status = 1  and m_x = " . $data->m_x . " - 1 and m_y = " . $data->m_y . " and m_ms_id = " . $data->m_ms_id . " limit 1");
                $data->m_x--;
                break;
            case 2:
                $mid = get_one("select m_id from arena_map   where m_status = 1  and m_x = " . $data->m_x . " + 1 and m_y = " . $data->m_y . " and m_ms_id = " . $data->m_ms_id . " limit 1");
                $data->m_x++;
                break;
            case 3:
                $mid = get_one("select m_id from arena_map   where m_status = 1  and m_y = " . $data->m_y . " - 1 and m_x = " . $data->m_x . " and m_ms_id = " . $data->m_ms_id . " limit 1");
                $data->m_y--;
                break;
            case 4:
                $mid = get_one("select m_id from arena_map   where m_status = 1  and m_y = " . $data->m_y . " + 1 and m_x = " . $data->m_x . " and m_ms_id = " . $data->m_ms_id . " limit 1");
                $data->m_y++;
                break;
            default:
                break;
        }
        if (!empty($mid) && $mid != $data->m_id) {
            if ($data->m_x <= $data2->ms_max_x && $data->m_y <= $data2->ms_max_y) {
                call("update arena_map set m_who = 0, m_status = 1 where m_id = " . $data->m_id);
                call("update arena_map set m_who = {$hero}, m_status = 0 where m_id = {$mid}");
                call("update arena_users set last_pos_x = " . $data->m_x . ", last_pos_y =" . $data->m_y . " where usr_id = {$hero} limit 1");
            }
        }
    }
}
Beispiel #28
0
<?php 
require_once 'config.php';
require_once 'common.php';
$company = $mysql->get_one('select * from `company`');
$new_info = $mysql->get_all('select * from `article` limit 3');
$link = $mysql->get_all('select * from `friendlink` limit 3');
if (!empty($_POST)) {
    $check_res = get_one('select `message_id` from `message` where `username`="' . trim($_POST['username']) . '"');
    if ($check_res) {
        exit('该名称已存在!');
    }
    $data = array('username' => trim($_POST['username']), 'content' => trim($_POST['content']), 'add_time' => time());
    $insert = insert($data, 'message');
    if ($insert) {
        jump('留言成功!', 'gbook.php');
    } else {
        jump('留言失败!');
    }
} else {
    $message = get_all('select * from `message`');
}
$smarty->assign('company', $company);
$smarty->assign('new_info', $new_info);
$smarty->assign('link', $link);
#显示模板文件
$smarty->display('gbook.html');
Beispiel #29
0
<?php

require_once 'includes/load.php';
confirm_logged_in();
if (isset($_GET['id'])) {
    //ako je prosledjen id kategorije kroz URL
    $id = $_GET['id'];
    //preuzmi id
    $category = get_one('categories', $id);
    //preuzmi podatke
    if ($category) {
        //da li postoji takva kategorija u bazi
        $query = "DELETE FROM categories WHERE id='{$id}'";
        $result = mysqli_query($conn, $query);
        confirm_query($result);
    }
}
echo redirect('staff.php');
//u svakom slucaju (ne)brisanja preusmjerenje ide na staff.php
Beispiel #30
0
							<th>Pop</th>
							<th>Czas</th>
							<th></th>
						</tr>
						<?php 
            $echo = "";
            foreach ($technology as $tech) {
                if (empty($tech->go_id)) {
                    $tech->go_wood = $tech->gop_wood;
                    $tech->go_stone = $tech->gop_stone;
                    $tech->go_iron = $tech->gop_iron;
                    $tech->go_pop = $tech->gop_pop;
                    $tech->go_time = $tech->gop_time;
                    $tech->go_lvl = 0;
                }
                $tech_event_check = get_one("select count(*) from events where e_t_id = " . $player->actual_town . " and e_type = 2 and e_done = 0");
                $can = "<a href='?action=build&type=2&subtype={$tech->gop_subtype}&tech=1'>buduj</a>";
                if (!empty($tech->e_id)) {
                    $tech->time_end = $tech->etime - 1;
                    $can = "do końca budowy pozostało: <span id='timer{$tech->gop_subtype}'>" . date("H:i:s", $tech->etime - 3600) . "</span> <a href='?action=build&type=7&subtype={$tech->gop_subtype}&techstop={$tech->e_id}'>[x]</a>";
                } elseif ($tech->go_lvl == $tech->gop_max_lvl) {
                    $can = "osiągnięto maksymalny poziom budynku";
                } elseif ($tech->to_can == 0) {
                    $can = "brak wymaganego obiektu";
                } elseif ($player->town->t_wood < $tech->go_wood || $player->town->t_stone < $tech->go_stone || $player->town->t_iron < $tech->go_iron || $player->town->t_pop_max - $player->town->t_pop < $tech->go_pop) {
                    $can = "brak surowców";
                } elseif ($event_check > 2) {
                    $can = "kolejka zajęta";
                }
                $tech->go_time = date("H:i:s", $tech->go_time - 3600);
                $echo .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td><span title='{$tech->gop_text}' style='cursor:pointer'>[info]</span> {$tech->gop_name} [{$tech->go_lvl}/{$tech->gop_max_lvl}]</td>\n\t\t\t\t\t\t\t\t<td>{$tech->go_wood}</td>\n\t\t\t\t\t\t\t\t<td>{$tech->go_stone}</td>\n\t\t\t\t\t\t\t\t<td>{$tech->go_iron}</td>\n\t\t\t\t\t\t\t\t<td>{$tech->go_pop}</td>\n\t\t\t\t\t\t\t\t<td>{$tech->go_time}</td>\n\t\t\t\t\t\t\t\t<td>{$can}";