mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-01 01:54:22 +00:00
fix ww buildingplans, fix pop and cp of ww and buildingplan villages, fix dissapering of chief when conquer village and add select password for create natars
This commit is contained in:
@@ -20,16 +20,15 @@ $amt = $_POST['vill_amount'];
|
||||
for($i=1;$i<=$amt;$i++) {
|
||||
|
||||
$kid = rand(1,4);
|
||||
|
||||
$wid = $database->generateBase($kid);
|
||||
$database->setFieldTaken($wid);
|
||||
$time = time();
|
||||
$pop = rand(50,233);
|
||||
$cp = $pop-1;
|
||||
$q = "insert into ".TB_PREFIX."vdata (`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`) values ('$wid','3','WW Buildingplan',0,$pop,$cp,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,1314968914)";
|
||||
$q = "insert into ".TB_PREFIX."vdata (`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`) values ('$wid','3','WW Buildingplan',0,0,0,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,1314968914)";
|
||||
mysql_query($q) or die(mysql_error());
|
||||
$q = "insert into ".TB_PREFIX."fdata (`vref`,`f1`,`f1t`,`f2`,`f2t`,`f3`,`f3t`,`f4`,`f4t`,`f5`,`f5t`,`f6`,`f6t`,`f7`,`f7t`,`f8`,`f8t`,`f9`,`f9t`,`f10`,`f10t`,`f11`,`f11t`,`f12`,`f12t`,`f13`,`f13t`,`f14`,`f14t`,`f15`,`f15t`,`f16`,`f16t`,`f17`,`f17t`,`f18`,`f18t`,`f19`,`f19t`,`f20`,`f20t`,`f21`,`f21t`,`f22`,`f22t`,`f23`,`f23t`,`f24`,`f24t`,`f25`,`f25t`,`f26`,`f26t`,`f27`,`f27t`,`f28`,`f28t`,`f29`,`f29t`,`f30`,`f30t`,`f31`,`f31t`,`f32`,`f32t`,`f33`,`f33t`,`f34`,`f34t`,`f35`,`f35t`,`f36`,`f36t`,`f37`,`f37t`,`f38`,`f38t`,`f39`,`f39t`,`f40`,`f40t`,`f99`,`f99t`,`wwname`) values ($wid,0,1,0,4,0,1,0,3,0,2,0,2,0,3,0,4,0,4,0,3,0,3,0,4,0,4,0,1,0,4,0,2,0,1,0,2,20,17,20,11,10,27,20,10,10,22,10,25,0,0,20,15,10,19,0,0,0,0,0,0,10,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0,0,0,'World Wonder')";
|
||||
mysql_query($q);
|
||||
$pop = $automation->recountPop($wid);
|
||||
$cp = $automation->recountPop($wid);
|
||||
$database->addUnits($wid);
|
||||
$database->addTech($wid);
|
||||
$database->addABTech($wid);
|
||||
|
||||
@@ -24,12 +24,12 @@ for($i=1;$i<=$amt;$i++) {
|
||||
$wid = $database->generateBase($kid);
|
||||
$database->setFieldTaken($wid);
|
||||
$time = time();
|
||||
$pop = rand(50,233);
|
||||
$cp = $pop-1;
|
||||
$q = "insert into ".TB_PREFIX."vdata (`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`,`natar`) values ('$wid','3','WW village',0,$pop,$cp,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,$time,1)";
|
||||
$q = "insert into ".TB_PREFIX."vdata (`wref`,`owner`,`name`,`capital`,`pop`,`cp`,`celebration`,`type`,`wood`,`clay`,`iron`,`maxstore`,`crop`,`maxcrop`,`lastupdate`,`loyalty`,`exp1`,`exp2`,`exp3`,`created`,`natar`) values ('$wid','3','WW village',0,0,0,0,0,80000.00,80000.00,80000.00,80000,80000.00,80000,1314974534,100,0,0,0,$time,1)";
|
||||
mysql_query($q) or die(mysql_error());
|
||||
$q = "insert into ".TB_PREFIX."fdata (`vref`,`f1`,`f1t`,`f2`,`f2t`,`f3`,`f3t`,`f4`,`f4t`,`f5`,`f5t`,`f6`,`f6t`,`f7`,`f7t`,`f8`,`f8t`,`f9`,`f9t`,`f10`,`f10t`,`f11`,`f11t`,`f12`,`f12t`,`f13`,`f13t`,`f14`,`f14t`,`f15`,`f15t`,`f16`,`f16t`,`f17`,`f17t`,`f18`,`f18t`,`f19`,`f19t`,`f20`,`f20t`,`f21`,`f21t`,`f22`,`f22t`,`f23`,`f23t`,`f24`,`f24t`,`f25`,`f25t`,`f26`,`f26t`,`f27`,`f27t`,`f28`,`f28t`,`f29`,`f29t`,`f30`,`f30t`,`f31`,`f31t`,`f32`,`f32t`,`f33`,`f33t`,`f34`,`f34t`,`f35`,`f35t`,`f36`,`f36t`,`f37`,`f37t`,`f38`,`f38t`,`f39`,`f39t`,`f40`,`f40t`,`f99`,`f99t`,`wwname`) values ($wid,0,1,0,4,0,1,0,3,0,2,0,2,0,3,0,4,0,4,0,3,0,3,0,4,0,4,0,1,0,4,0,2,0,1,0,2,20,17,20,11,20,15,20,10,10,22,10,25,0,0,0,0,10,19,0,0,0,0,0,0,10,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,16,0,0,0,40,'World Wonder')";
|
||||
mysql_query($q);
|
||||
$pop = $automation->recountPop($wid);
|
||||
$cp = $automation->recountPop($wid);
|
||||
$database->addUnits($wid);
|
||||
$database->addTech($wid);
|
||||
$database->addABTech($wid);
|
||||
|
||||
@@ -98,6 +98,26 @@ class Automation {
|
||||
return $popTot;
|
||||
|
||||
}
|
||||
|
||||
function recountCP($vid){
|
||||
global $database;
|
||||
$fdata = $database->getResourceLevel($vid);
|
||||
$popTot = 0;
|
||||
|
||||
for ($i = 1; $i <= 40; $i++) {
|
||||
$lvl = $fdata["f".$i];
|
||||
$building = $fdata["f".$i."t"];
|
||||
if($building){
|
||||
$popTot += $this->buildingCP($building,$lvl);
|
||||
}
|
||||
}
|
||||
|
||||
$q = "UPDATE ".TB_PREFIX."vdata set pop = $popTot where wref = $vid";
|
||||
mysql_query($q);
|
||||
|
||||
return $popTot;
|
||||
|
||||
}
|
||||
|
||||
function buildingPOP($f,$lvl){
|
||||
$name = "bid".$f;
|
||||
@@ -109,6 +129,18 @@ class Automation {
|
||||
$popT += $dataarray[$i]['pop'];
|
||||
}
|
||||
return $popT;
|
||||
}
|
||||
|
||||
function buildingCP($f,$lvl){
|
||||
$name = "bid".$f;
|
||||
global $$name;
|
||||
$popT = 0;
|
||||
$dataarray = $$name;
|
||||
|
||||
for ($i = 0; $i <= $lvl; $i++) {
|
||||
$popT += $dataarray[$i]['cp'];
|
||||
}
|
||||
return $popT;
|
||||
}
|
||||
|
||||
public function Automation() {
|
||||
@@ -1122,7 +1154,7 @@ class Automation {
|
||||
$troopsdead6 = $dead6;
|
||||
$troopsdead7 = $dead7;
|
||||
$troopsdead8 = $dead8;
|
||||
$troopsdead9 = $dead9-1;
|
||||
$troopsdead9 = $dead9+1;
|
||||
$troopsdead10 = $dead10;
|
||||
$troopsdead11 = $dead11;
|
||||
for($i=1;$i<=50;$i++) {
|
||||
|
||||
@@ -7,9 +7,9 @@ $needed_plan = 1;
|
||||
}else{
|
||||
$needed_plan = 0;
|
||||
}
|
||||
if($session->alliance != 0){
|
||||
$alli_users = $database->getUserByAlliance($session->alliance);
|
||||
$wwbuildingplan = 0;
|
||||
|
||||
foreach($alli_users as $users){
|
||||
$villages = $database->getVillagesID($users['id']);
|
||||
foreach($villages as $village1){
|
||||
@@ -19,6 +19,15 @@ $wwbuildingplan += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$villages = $database->getVillagesID($session->uid);
|
||||
foreach($villages as $village1){
|
||||
$plan = count($database->getOwnArtefactInfoByType2($village1,11));
|
||||
if($plan > 0){
|
||||
$wwbuildingplan += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($wwbuildingplan > $needed_plan){
|
||||
if($bindicate == 1) {
|
||||
|
||||
+103
-8
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
/** --------------------------------------------------- **\
|
||||
| ********* DO NOT REMOVE THIS COPYRIGHT NOTICE ********* |
|
||||
@@ -19,12 +19,59 @@
|
||||
/**
|
||||
* If user is not administrator, access is denied!
|
||||
*/
|
||||
if($session->access < ADMIN)
|
||||
if($session->access < ADMIN){
|
||||
die("Access Denied: You are not Admin!");
|
||||
}else{
|
||||
|
||||
$start = $generator->pageLoadTimeStart();
|
||||
|
||||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo SERVER_NAME ?></title>
|
||||
<link REL="shortcut icon" HREF="favicon.ico"/>
|
||||
<meta http-equiv="cache-control" content="max-age=0" />
|
||||
<meta http-equiv="pragma" content="no-cache" />
|
||||
<meta http-equiv="expires" content="0" />
|
||||
<meta http-equiv="imagetoolbar" content="no" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<script src="mt-full.js?0faaa" type="text/javascript"></script>
|
||||
<script src="unx.js?0faaa" type="text/javascript"></script>
|
||||
<script src="new.js?0faaa" type="text/javascript"></script>
|
||||
<link href="<?php echo GP_LOCATE; ?>lang/en/compact.css?e21d2" rel="stylesheet" type="text/css" />
|
||||
<link href="<?php echo GP_LOCATE; ?>lang/en/lang.css?e21d2" rel="stylesheet" type="text/css" />
|
||||
<?php
|
||||
if($session->gpack == null || GP_ENABLE == false) {
|
||||
echo "
|
||||
<link href='".GP_LOCATE."travian.css?e21d2' rel='stylesheet' type='text/css' />
|
||||
<link href='".GP_LOCATE."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
|
||||
} else {
|
||||
echo "
|
||||
<link href='".$session->gpack."travian.css?e21d2' rel='stylesheet' type='text/css' />
|
||||
<link href='".$session->gpack."lang/en/lang.css?e21d2' rel='stylesheet' type='text/css' />";
|
||||
}
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
window.addEvent('domready', start);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
||||
<body class="v35 ie ie8">
|
||||
<div class="wrapper">
|
||||
<img style="filter:chroma();" src="img/x.gif" id="msfilter" alt="" />
|
||||
<div id="dynamic_header">
|
||||
</div>
|
||||
<?php include("Templates/header.tpl"); ?>
|
||||
<div id="mid">
|
||||
<?php include("Templates/menu.tpl"); ?>
|
||||
<div id="content" class="village1">
|
||||
<?php
|
||||
/**
|
||||
* Functions
|
||||
*/
|
||||
if($_POST['password'] != ""){
|
||||
function generateBase($kid, $uid, $username) {
|
||||
global $database, $message;
|
||||
if($kid == 0) {
|
||||
@@ -48,7 +95,7 @@
|
||||
* Creating account & capital village
|
||||
*/
|
||||
$username = "Natars";
|
||||
$password = md5('013ab00e4' . rand(999999999999, 9999999999999999999999999) . 'f248588ed');
|
||||
$password = md5($_POST['password']);
|
||||
$email = "natars@travianx.com";
|
||||
$tribe = 5;
|
||||
$desc = "********************
|
||||
@@ -370,8 +417,56 @@
|
||||
Artefact($uid, 8, 3, 'Artefact of the unique fool', '' . $vname . '', '' . $desc . '', '' . $effect . '', 'type8.gif');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Done?
|
||||
*/
|
||||
echo "Done";
|
||||
|
||||
echo "Done";
|
||||
}else{
|
||||
?>
|
||||
<form action="create_account.php" method="post">
|
||||
|
||||
<p>
|
||||
<span>Choose Password</span>
|
||||
<table>
|
||||
<tr><td>Password:</td><td><input type="text" name="password" value=""></td></tr>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<center>
|
||||
<input type="submit" name="Submit" id="Submit" value="Submit"></center>
|
||||
</form>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div id="side_info">
|
||||
<?php
|
||||
include("Templates/quest.tpl");
|
||||
include("Templates/news.tpl");
|
||||
include("Templates/multivillage.tpl");
|
||||
include("Templates/links.tpl");
|
||||
?>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<div class="footer-stopper"></div>
|
||||
<div class="clear"></div>
|
||||
|
||||
<?php
|
||||
include("Templates/footer.tpl");
|
||||
include("Templates/res.tpl")
|
||||
?>
|
||||
<div id="stime">
|
||||
<div id="ltime">
|
||||
<div id="ltimeWrap">
|
||||
<?php echo CALCULATED_IN;?> <b><?php
|
||||
echo round(($generator->pageLoadTimeEnd()-$start)*1000);
|
||||
?></b> ms
|
||||
|
||||
<br /><?php echo SEVER_TIME;?> <span id="tp1" class="b"><?php echo date('H:i:s'); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ce"></div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user