mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-15 00:56:09 +00:00
hero update
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
#################################################################################
|
||||
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ##
|
||||
## --------------------------------------------------------------------------- ##
|
||||
## Filename addTroops.php ##
|
||||
## Developed by: Dzoki & Advocatie ##
|
||||
## License: TravianZ Project ##
|
||||
## Reworks by: ronix ##
|
||||
## Copyright: TravianZ (c) 2010-2014. All rights reserved. ##
|
||||
## ##
|
||||
#################################################################################
|
||||
|
||||
if(!isset($_SESSION)) session_start();
|
||||
if($_SESSION['access'] < 9) die("Access Denied: You are not Admin!");
|
||||
include_once("../../Database.php");
|
||||
$status="&ce=1";
|
||||
if(isset($_POST['id'])) {
|
||||
$_POST['hname'] = trim(stripslashes($_POST['hname']));
|
||||
if ($_POST['hname']=="") {
|
||||
header("Location: ../../../Admin/admin.php?p=editHero&uid=".$_POST['id']."&e=1");
|
||||
exit;
|
||||
}
|
||||
|
||||
include_once("../../Data/hero_full.php");
|
||||
|
||||
$id = $_POST['id'];
|
||||
|
||||
$q = "UPDATE ".TB_PREFIX."hero SET unit=".$_POST['hunit'].", name='".$_POST['hname']."', level=".$_POST['hlvl'].", points=".$_POST['exp'].", experience=".$hero_levels[$_POST['hlvl']].", health=".$_POST['hhealth'].",
|
||||
attack=".$_POST['hatk'].", defence=".$_POST['hdef'].", attackbonus=".$_POST['hob'].", defencebonus=".$_POST['hdb'].", regeneration=".$_POST['hrege']." WHERE uid = ".$id;
|
||||
$return=$database->query($q);
|
||||
if($return) {
|
||||
$database->query("Insert into ".TB_PREFIX."admin_log values (0,".$_SESSION['id'].",'Changed hero info',".time().")");
|
||||
$status="&cs=1";
|
||||
}
|
||||
}
|
||||
header("Location: ../../../Admin/admin.php?p=player&uid=".$id.$status);
|
||||
?>
|
||||
@@ -70,6 +70,44 @@ class funct {
|
||||
case "logout":
|
||||
$this->LogOut();
|
||||
break;
|
||||
case "killHero":
|
||||
$varray = $database->getProfileVillages($get['uid']);
|
||||
$killhero=false;
|
||||
$error="";
|
||||
for ($i = 0; $i <= count($varray)-1; $i++) {
|
||||
$killhero=$database->FindHeroInVil($varray[$i]['wref']);
|
||||
if ($killhero) break;
|
||||
$killhero=$database->FindHeroInDef($varray[$i]['wref']);
|
||||
if ($killhero) break;
|
||||
$killhero=$database->FindHeroInMovement($varray[$i]['wref']);
|
||||
if ($killhero) break;
|
||||
}
|
||||
if (!$killhero){
|
||||
$killhero=$database->FindHeroInOasis($get['uid']);
|
||||
}
|
||||
if ($killhero) {
|
||||
$database->KillMyHero($get['uid']);
|
||||
$error="&kc=1";
|
||||
}else $error="&e=1";
|
||||
header("Location: admin.php?p=player&uid=".$get['uid'].$error);
|
||||
exit;
|
||||
case "reviveHero":
|
||||
$result=$database->query("SELECT * FROM ".TB_PREFIX."hero WHERE uid='".$get['uid']."'");
|
||||
$hdata=mysql_fetch_array($result);
|
||||
$database->query("UPDATE ".TB_PREFIX."units SET hero = 1 WHERE vref = ".$hdata['wref']);
|
||||
$database->query("UPDATE ".TB_PREFIX."hero SET `dead` = '0', `inrevive` = '0', `health` = '100', `lastupdate` = ".time()." WHERE `uid` = '".$get['uid']."'");
|
||||
header("Location: admin.php?p=player&uid=".$get['uid']."&rc=1");
|
||||
exit;
|
||||
case "addHero":
|
||||
$user = $database->getUserArray($get['uid'],1);
|
||||
$vilarray=$database->getVrefCapital($get['uid']);
|
||||
|
||||
$database->query("INSERT INTO ".TB_PREFIX."hero (`uid`, `wref`, `regeneration`, `unit`, `name`, `level`, `points`,
|
||||
`experience`, `dead`, `health`, `attack`, `defence`, `attackbonus`, `defencebonus`, `trainingtime`, `autoregen`,
|
||||
`intraining`) VALUES ('".$get['uid']."', '" . $vilarray['wref'] . "', '0', '".$get['u']."', '".addslashes($user['username'])."',
|
||||
'0', '5', '0', '0', '100', '0', '0', '0', '0', '".time()."', '50', '0')");
|
||||
header("Location: admin.php?p=player&uid=".$get['uid']."&ac=1");
|
||||
exit;
|
||||
}
|
||||
if($get['action'] == 'logout'){
|
||||
header("Location: admin.php");
|
||||
|
||||
Reference in New Issue
Block a user