mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-09-20 00:57:24 +00:00
fix claim artefacts
This commit is contained in:
+14
-14
@@ -1739,11 +1739,11 @@ private function loyaltyRegeneration() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($data['t11'] > 0){
|
if($data['t11'] > 0){
|
||||||
if ($isoasis != 0) {
|
if ($isoasis != 0) {
|
||||||
if ($database->canConquerOasis($data['from'],$data['to'])) {
|
if ($database->canConquerOasis($data['from'],$data['to'])) {
|
||||||
$database->conquerOasis($data['from'],$data['to']);
|
$database->conquerOasis($data['from'],$data['to']);
|
||||||
$info_chief = $hero_pic." Your hero has conquered this oasis and gained ".$heroxp." XP";
|
$info_chief = $hero_pic.",Your hero has conquered this oasis and gained ".$heroxp." XP";
|
||||||
} else {
|
} else {
|
||||||
$OasisInfo = $database->getOasisInfo($data['to']);
|
$OasisInfo = $database->getOasisInfo($data['to']);
|
||||||
if ($OasisInfo['conqured'] != 0) {
|
if ($OasisInfo['conqured'] != 0) {
|
||||||
@@ -1751,26 +1751,26 @@ private function loyaltyRegeneration() {
|
|||||||
$database->modifyOasisLoyalty($data['to']);
|
$database->modifyOasisLoyalty($data['to']);
|
||||||
$OasisInfo = $database->getOasisInfo($data['to']);
|
$OasisInfo = $database->getOasisInfo($data['to']);
|
||||||
$Oloyaltynow = $OasisInfo['loyalty'];
|
$Oloyaltynow = $OasisInfo['loyalty'];
|
||||||
$info_chief = $hero_pic." Your hero has reduced oasis loyalty to ".$Oloyaltynow." from ".$Oloyaltybefore." and gained ".$heroxp." XP";
|
$info_chief = $hero_pic.",Your hero has reduced oasis loyalty to ".$Oloyaltynow." from ".$Oloyaltybefore." and gained ".$heroxp." XP";
|
||||||
} else {
|
} else {
|
||||||
if ($heroxp == 0) {
|
if ($heroxp == 0) {
|
||||||
$info_chief = $hero_pic." Your hero had nothing to kill therfore gains no XP at all";
|
$info_chief = $hero_pic.",Your hero had nothing to kill therfore gains no XP at all";
|
||||||
} else {
|
} else {
|
||||||
$info_chief = $hero_pic." Your hero gained ".$heroxp." XP";
|
$info_chief = $hero_pic.",Your hero gained ".$heroxp." XP";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$artifact = $database->getOwnArtefactInfo($data['to']);
|
$artifact = $database->getOwnArtefactInfo($data['to']);
|
||||||
if ($artifact['vref'] == $data['to']){
|
if ($artifact['vref'] == $data['to']) {
|
||||||
if($database->canClaimArtifact($artifact['vref'],$artifact['size'])) {
|
if ($database->canClaimArtifact($data['from'],$artifact['vref'],$artifact['size'])) {
|
||||||
$database->claimArtefact($data['to'],$data['to'],$database->getVillageField($data['from'],"owner"));
|
$database->claimArtefact($data['from'],$data['to'],$database->getVillageField($data['from'],"owner"));
|
||||||
$info_chief = $hero_pic." Your hero is carrying home a artifact, and gained ".$heroxp." XP from the battle";
|
$info_chief = $hero_pic.",Your hero is carrying home a artefact and gained ".$heroxp." XP from the battle";
|
||||||
}else{
|
} else {
|
||||||
$info_chief = $hero_pic." Your hero could not claim the artifact, and gained ".$heroxp." XP from the battle";
|
$info_chief = $hero_pic.",Your hero could not claim the artefact and gained ".$heroxp." XP from the battle";
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2403,67 +2403,63 @@
|
|||||||
$result = mysql_query($q, $this->connection);
|
$result = mysql_query($q, $this->connection);
|
||||||
return mysql_fetch_array($result);
|
return mysql_fetch_array($result);
|
||||||
}
|
}
|
||||||
function claimArtefact($vref, $ovref, $id) {
|
|
||||||
$time = time();
|
|
||||||
$q = "UPDATE " . TB_PREFIX . "artefacts SET vref = $vref, owner = $id WHERE vref = $ovref";
|
|
||||||
$result = mysql_query($q, $this->connection);
|
|
||||||
return mysql_fetch_array($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
## Hero Claim artifact by advocaite
|
function claimArtefact($vref, $ovref, $id) {
|
||||||
public function canClaimArtifact ($vref,$type) {
|
$time = time();
|
||||||
$DefenderFields = $this->getResourceLevel($vref);
|
$q = "UPDATE " . TB_PREFIX . "artefacts SET vref = $vref, owner = $id, conquered = $time WHERE vref = $ovref";
|
||||||
for($i=19;$i<=38;$i++) {
|
return mysql_query($q, $this->connection);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function canClaimArtifact($from,$vref,$type) {
|
||||||
|
$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;
|
||||||
|
} else {
|
||||||
|
$defcanclaim = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$AttackerFields = $this->getResourceLevel($from);
|
||||||
|
for($i=19;$i<=38;$i++) {
|
||||||
if($AttackerFields['f'.$i.'t'] == 27) {
|
if($AttackerFields['f'.$i.'t'] == 27) {
|
||||||
$defcanclaim = FALSE;
|
$attTresuaryLevel = $AttackerFields['f'.$i];
|
||||||
$defTresuaryLevel = $AttackerFields['f'.$i];
|
if ($attTresuaryLevel >= 10) {
|
||||||
} else
|
$villageartifact = TRUE;
|
||||||
{
|
} else {
|
||||||
$defcanclaim = TRUE;
|
$villageartifact = FALSE;
|
||||||
}
|
}
|
||||||
|
if ($attTresuaryLevel >= 20){
|
||||||
|
$accountartifact = TRUE;
|
||||||
|
} else {
|
||||||
|
$accountartifact = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$AttackerFields = $this->getResourceLevel($vref);
|
if ($type == 1) {
|
||||||
for($i=19;$i<=38;$i++) {
|
if ($defcanclaim == TRUE && $villageartifact == TRUE) {
|
||||||
if($AttackerFields['f'.$i.'t'] == 27) {
|
return TRUE;
|
||||||
$attTresuaryLevel = $AttackerFields['f'.$i];
|
} else {
|
||||||
if ($attTresuaryLevel >= 10){
|
return FALSE;
|
||||||
$villageartifact = TRUE;
|
}
|
||||||
}else{
|
} else if ($type == 2) {
|
||||||
$villageartifact = FALSE;
|
if ($defcanclaim == TRUE && $accountartifact == TRUE) {
|
||||||
}
|
return TRUE;
|
||||||
if ($attTresuaryLevel == 20){
|
} else {
|
||||||
$accountartifact = TRUE;
|
return FALSE;
|
||||||
}else{
|
}
|
||||||
$accountartifact = FALSE;
|
} else if ($type == 3) {
|
||||||
}
|
if ($defcanclaim == TRUE && $accountartifact == TRUE) {
|
||||||
}
|
return TRUE;
|
||||||
}
|
} else {
|
||||||
|
return FALSE;
|
||||||
if ($type == 1)
|
}
|
||||||
{
|
} else {
|
||||||
if ($defcanclaim == TRUE && $villageartifact == TRUE)
|
return FALSE;
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
}else if($type == 2)
|
|
||||||
{
|
|
||||||
if ($defcanclaim == TRUE && $accountartifact == TRUE)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}else if($type == 3)
|
|
||||||
{
|
|
||||||
if ($defcanclaim == TRUE && $accountartifact == TRUE)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getArtefactDetails($id) {
|
function getArtefactDetails($id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user