- Joined
- Jun 20, 2011
- Messages
- 582
- Reaction score
- 182
what about quest? is it 100% fixed now?
Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!
Join Today! public function finishAll() {
global $database,$session,$logging,$village,$bid18,$bid10,$bid11,$technology,$_SESSION;
if($session->access!=BANNED){
$finish = 0;
foreach($this->buildArray as $jobs) {
if($jobs['wid']==$village->wid){
$finish=2;
$wwvillage = $database->getResourceLevel($jobs['wid']);
if($wwvillage['f99t']!=40){
$level = $jobs['level'];
if($jobs['type'] != 25 AND $jobs['type'] != 26 AND $jobs['type'] != 40) {
$finish = 1;
$resource = $this->resourceRequired($jobs['field'],$jobs['type']);
if($jobs['master'] == 0){
$q = "UPDATE ".TB_PREFIX."fdata set f".$jobs['field']." = ".$jobs['level'].", f".$jobs['field']."t = ".$jobs['type']." where vref = ".$jobs['wid'];
}else{
$villwood = $database->getVillageField($jobs['wid'],'wood');
$villclay = $database->getVillageField($jobs['wid'],'clay');
$villiron = $database->getVillageField($jobs['wid'],'iron');
$villcrop = $database->getVillageField($jobs['wid'],'crop');
$type = $jobs['type'];
$buildarray = $GLOBALS["bid".$type];
$buildwood = $buildarray[$level]['wood'];
$buildclay = $buildarray[$level]['clay'];
$buildiron = $buildarray[$level]['iron'];
$buildcrop = $buildarray[$level]['crop'];
if($buildwood < $villwood && $buildclay < $villclay && $buildiron < $villiron && $buildcrop < $villcrop){
$newgold = $session->gold-1;
$database->updateUserField($session->uid, "gold", $newgold, 1);
$enought_res = 1;
$q = "UPDATE ".TB_PREFIX."fdata set f".$jobs['field']." = ".$jobs['level'].", f".$jobs['field']."t = ".$jobs['type']." where vref = ".$jobs['wid'];
}
}
if($database->query($q) && ($enought_res == 1 or $jobs['master'] == 0)) {
$database->modifyPop($jobs['wid'],$resource['pop'],0);
$database->addCP($jobs['wid'],$resource['cp']);
$q = "DELETE FROM ".TB_PREFIX."bdata where id = ".$jobs['id'];
$database->query($q);
if($jobs['type'] == 18) {
$owner = $database->getVillageField($jobs['wid'],"owner");
$max = $bid18[$level]['attri'];
$q = "UPDATE ".TB_PREFIX."alidata set max = $max where leader = $owner";
$database->query($q);
}
}
if(($jobs['field'] >= 19 && ($session->tribe == 1 || ALLOW_ALL_TRIBE)) || (!ALLOW_ALL_TRIBE && $session->tribe != 1)) { $innertimestamp = $jobs['timestamp']; }
}
}
}
}
if($finish == 1 or $finish==0){
$database->finishDemolition($village->wid);
$technology->finishTech();
$logging->goldFinLog($village->wid);
$database->modifyGold($session->uid,2,0);
$stillbuildingarray = $database->getJobs($village->wid);
if(count($stillbuildingarray) == 1) {
if($stillbuildingarray[0]['loopcon'] == 1) {
//$q = "UPDATE ".TB_PREFIX."bdata SET loopcon=0,timestamp=".(time()+$stillbuildingarray[0]['timestamp']-$innertimestamp)." WHERE id=".$stillbuildingarray[0]['id'];
$q = "UPDATE ".TB_PREFIX."bdata SET loopcon=0 WHERE id=".$stillbuildingarray[0]['id'];
$database->query($q);
}
}
}
header("Location: ".$session->referrer);
}else{
header("Location: banned.php");
}
}
<?php
$ty=(isset($_GET['ty']))? $_GET['ty']:"";
if($_REQUEST["cancel"] == "1") {
if($session->access != BANNED){
$database->delDemolition($village->wid);
header("Location: build.php?gid=15&ty=$ty&cancel=0&demolish=0");
}else{
header("Location: banned.php");
}
}
if(!empty($_REQUEST["demolish"]) && $_REQUEST["c"] == $session->mchecker) {
if($session->access != BANNED){
if($_REQUEST["type"] != null) {
$type = $_REQUEST['type'];
$database->addDemolition($village->wid,$type);
$session->changeChecker();
header("Location: build.php?gid=15&ty=$type&cancel=0&demolish=0");
}
}else{
header("Location: banned.php");
}
}
if($village->resarray['f'.$id] >= DEMOLISH_LEVEL_REQ) {
echo "<h2>Demolition of the building:</h2><p>If you no longer need a building, you can order the demolition of the building.</p>";
$VillageResourceLevels = $database->getResourceLevel($village->wid);
$DemolitionProgress = $database->getDemolition($village->wid);
if (!empty($DemolitionProgress)) {
$Demolition = $DemolitionProgress[0];
echo "<b>";
echo "<a href='build.php?id=".$_GET['id']."&ty=".$ty."&cancel=1'><img src='img/x.gif' class='del' title='cancel' alt='cancel'></a> ";
echo "Demolition of ".$building->procResType($VillageResourceLevels['f'.$Demolition['buildnumber'].'t']).": <span id=timer1>".$generator->getTimeFormat($Demolition['timetofinish']-time())."</span>";
if($session->gold >= 2) {
if($session->access!=BANNED){
?> <a href="?id=15&buildingFinish=1&ty=<?php echo $ty;?>" title="Finish all construction and research orders in this village immediately for 2 Gold?"><img class="clock" alt="Finish all construction and research orders in this village immediately for 2 Gold?" src="img/x.gif"/></a>
<?php
}else{
?> <a href="banned.php" title="Finish all construction and research orders in this village immediately for 2 Gold?"><img class="clock" alt="Finish all construction and research orders in this village immediately for 2 Gold?" src="img/x.gif"/></a>
<?php
}
}
echo "</b>";
} else {
echo "
<form action=\"build.php?gid=15&demolish=1&cancel=0&c=".$session->mchecker."\" method=\"POST\" style=\"display:inline\">
<select name=\"type\" class=\"dropdown\">";
for ($i=19; $i<=41; $i++) {
$select=($i==$ty)? " SELECTED":"";
if ($VillageResourceLevels['f'.$i] >= 1 && !$building->isCurrent($i) && !$building->isLoop($i)) {
echo "<option value=".$i.$select.">".$i.". ".$building->procResType($VillageResourceLevels['f'.$i.'t'])." (lvl ".$VillageResourceLevels['f'.$i].")</option>";
}
}
echo "</select><input id=\"btn_demolish\" name=\"demolish\" class=\"dynamic_img\" value=\"Demolish\" type=\"image\" src=\"img/x.gif\" alt=\"Demolish\" title=\"Demolish\" /></form>";
}
}
?>
if($_GET['buildingFinish'] == 1) {
if($session->gold >= 2) {
$building->finishAll();
header("Location: build.php?gid=".$_GET['id']."&ty=".$_GET['ty']);
}
}
<a href="?buildingFinish=1" onclick="return confirm('Finish all construction and research orders in this village immediately for 2 Gold?');" title="Finish all construction and research orders in this village immediately for 2 Gold?"><img class="clock" alt="Finish all construction and research orders in this village immediately for 2 Gold?" src="img/x.gif"/></a>
<a href="?buildingFinish=1" title="Finish all construction and research orders in this village immediately for 2 Gold?"><img class="clock" alt="Finish all construction and research orders in this village immediately for 2 Gold?" src="img/x.gif"/></a>
@ ronix : have any ideea how to fix oases conquer? Loiality just decrese to 0 and no conquer
$OasisInfo = $database->getOasisInfo($data['to']);
if ($OasisInfo['conqured'] != 0) {
//$Oloyaltybefore = $OasisInfo['loyalty'];
$Oloyaltybefore = intval($OasisInfo['loyalty']);
$database->modifyOasisLoyalty($data['to']);
$OasisInfo = $database->getOasisInfo($data['to']);
//$Oloyaltynow = $OasisInfo['loyalty'];
$Oloyaltynow = intval($OasisInfo['loyalty']);
$info_chief = $hero_pic.",Your hero has reduced oasis loyalty to ".$Oloyaltynow." from ".$Oloyaltybefore." and gained ".$heroxp." XP";
//$newloyalty = min(100,$loyalty['loyalty']+$value*(time()-$loyalty['lastupdate'])/(60*60));
$newloyalty = min(100,$loyalty['loyalty']+$value*(time()-$loyalty['lastupdated'])/(60*60));
$q = "UPDATE ".TB_PREFIX."odata SET loyalty = $newloyalty, lastupdated=".time()." WHERE wref = '".$loyalty['wref']."'";
$database->query($q);
//if(!file_exists("GameEngine/Prevention/loyalty.txt") or time()-filemtime("GameEngine/Prevention/loyalty.txt")>50) {
if(!file_exists("GameEngine/Prevention/loyalty.txt") or time()-filemtime("GameEngine/Prevention/loyalty.txt")>60) {
$this->loyaltyRegeneration();
}
private function loyaltyRegeneration() {
if(file_exists("GameEngine/Prevention/loyalty.txt")) {
unlink("GameEngine/Prevention/loyalty.txt");
}
//create new file to check filetime
//not every click regenerate but 1 minute or after
$ourFileHandle = fopen("GameEngine/Prevention/loyalty.txt", 'w');
fclose($ourFileHandle);
global $database;
//if(file_exists("GameEngine/Prevention/loyalty.txt")) {
// unlink("GameEngine/Prevention/loyalty.txt");
//}
public function modifyOasisLoyalty($wref) {
if($this->isVillageOases($wref) != 0) {
$OasisInfo = $this->getOasisInfo($wref);
if($OasisInfo['conqured'] != 0) {
$LoyaltyAmendment = floor(100 / min(3,(4-$this->VillageOasisCount($OasisInfo['conqured']))));
//$q = "UPDATE `".TB_PREFIX."odata` SET loyalty=loyalty-$LoyaltyAmendment WHERE wref=$wref";
$q = "UPDATE `".TB_PREFIX."odata` SET loyalty=loyalty-$LoyaltyAmendment, lastupdated=".time()." WHERE wref=$wref";
return mysql_query($q, $this->connection);
}
}
}
if($OasisInfo['conqured'] == 0 || $OasisInfo['conqured'] != 0 && $OasisInfo['loyalty'] < 99 / min(3,(4-$this->VillageOasisCount($OasisInfo['conqured']))) && $troopcount == 0) {
if($OasisInfo['conqured'] == 0 || $OasisInfo['conqured'] != 0 && intval($OasisInfo['loyalty']) < 99 / min(3,(4-$this->VillageOasisCount($OasisInfo['conqured']))) && $troopcount == 0) {
//if(file_exists("GameEngine/Prevention/starvation.txt")) {
// unlink("GameEngine/Prevention/starvation.txt");
//}
Omg...you are so good! I'm proud of you!
Could you fix the battle and combat simulator?
ronix, i think you can also fix bugs 1,13,17... If these 3 major bugs are fixed, the server will be stable and playable. Hmm, maybe bug 17 is already fixed by cata7007, but i'm not sure of this..
Ty for all what you do for this project... My list has been updated, your name has been added on it!
CREATE TABLE IF NOT EXISTS `%PREFIX%odata` (
`loyalty` int(11) NOT NULL DEFAULT '100',
`loyalty` float(9,6) unsigned NOT NULL DEFAULT '100',
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) > 1) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".${'r'.$i}['wood']."&r2=".${'r'.$i}['clay']."&r3=".${'r'.$i}['iron']."&r4=".${'r'.$i}['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) > 0) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".${'u'.$i}['wood']."&r2=".${'u'.$i}['clay']."&r3=".${'u'.$i}['iron']."&r4=".${'u'.$i}['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
that for train settler.. NPC trade links have appeared on the market level 1 instead of level 2 and above. and fix for total resource for NPCWhat fix at NPC that part? Can you please explain?
public function canClaimArtifact($from,$vref,$type,$kind) {
//fix by Ronix
global $session, $form;
$type1 = $type2 = $type3 = 0;
$artifact = $this->getOwnArtefactInfo($from);
if (!empty($artifact)) {
$form->addError("error","Treasury is full. Your hero could not claim the artefact and");
return false;
}
$uid=$session->uid;
$q="SELECT Count(type) AS totals,
SUM(IF(type = '1',1,0)) small,
SUM(IF(type = '2',1,0)) great,
SUM(IF(type = '3',1,0)) unique,
FROM ".TB_PREFIX."artefacts WHERE owner = ".$uid;
$result = mysql_query($q, $this->connection);
$artifact= $this->mysql_fetch_all($result);
if($artifact['totals'] < 3) {
$DefenderFields = $this->getResourceLevel($vref);
$defcanclaim = TRUE;
for($i=19;$i<=38;$i++) {
if($DefenderFields['f'.$i.'t'] == 27) {
$defTresuaryLevel = $DefenderFields['f'.$i];
if($defTresuaryLevel > 0) {
$defcanclaim = FALSE;
$form->addError("error","Treasury has not been destroyed. Your hero could not claim the artefact and");
return false;
} else {
$defcanclaim = TRUE;
}
}
}
$AttackerFields = $this->getResourceLevel($from,2);
for($i=19;$i<=38;$i++) {
if($AttackerFields['f'.$i.'t'] == 27) {
$attTresuaryLevel = $AttackerFields['f'.$i];
if ($attTresuaryLevel >= 10) {
$villageartifact = TRUE;
} else {
$villageartifact = FALSE;
}
if ($attTresuaryLevel >= 20){
$accountartifact = TRUE;
} else {
$accountartifact = FALSE;
}
}
}
if (($artifact['great']>0 || $artifact['unique']>0) && $type>1) {
$form->addError("error","Max num. of great/unique artefacts. Your hero could not claim the artefact and");
return FALSE;
}
if (($type == 1 && ($villageartifact || $accountartifact)) || (($type == 2 || $type == 3)&& $accountartifact)) {
return TRUE;
} else {
$form->addError("error","Level treasury is low. Your hero could not claim the artefact and");
return FALSE;
}
} else {
$form->addError("error","Max num. of artefacts. Your hero could not claim the artefact and");
return FALSE;
}
}
$artifact = $database->getOwnArtefactInfo($data['to']);
if ($artifact['vref'] == $data['to']) {
if ($database->canClaimArtifact($data['from'],$artifact['vref'],$artifact['size'],$artifact['type'])) {
$database->claimArtefact($data['from'],$data['to'],$database->getVillageField($data['from'],"owner"));
$info_chief = $hero_pic.",Your hero is carrying home a artefact and gained ".$heroxp." XP from the battle";
} else {
$info_chief = $hero_pic.",Your hero could not claim the artefact and gained ".$heroxp." XP from the battle";
}
}
global $form;
if ($heroxp == 0) {
$xp=" no XP from the battle";
} else {
$xp=" gained ".$heroxp." XP from the battle";
}
$artifact = $database->getOwnArtefactInfo($data['to']);
if (!empty($artifact)) {
if ($database->canClaimArtifact($data['from'],$artifact['vref'],$artifact['size'],$artifact['type'])) {
$database->claimArtefact($data['from'],$data['to'],$database->getVillageField($data['from'],"owner"));
$info_chief = $hero_pic.",Your hero is carrying home a artefact and".$xp;
} else {
$info_chief = $hero_pic.",".$form->getError("error").$xp;
}
}
ronix, your latest fix is fixing bug 14?
//$key = key($this->rankarray);
for($key=0;$key<count($this->rankarray);$key++){
if($this->rankarray[$key]!="pad") {
if($this->rankarray[$key][$field] == $name) {
return $key;
break;
}
}
}