Exemple #1
0
 public function initEntity()
 {
     parent::initEntity();
     if ($this->getDataProperty(self::DATA_AGEABLE_FLAGS) === null) {
         $this->setDataProperty(self::DATA_AGEABLE_FLAGS, self::DATA_TYPE_BYTE, 0);
     }
 }
Exemple #2
0
 public function spawnTo(Player $player)
 {
     $pk = $this->addEntityDataPacket($player);
     $pk->type = Villager::NETWORK_ID;
     $player->dataPacket($pk);
     parent::spawnTo($player);
 }
Exemple #3
0
        echo 'Unfortunately you do not have any Nether creatures right now."</i><br><br>';
    } else {
        echo '"</i><br><br>
			
			<form method="POST" action="index.php?page=travel&action=submitscholarname">
			';
        tBegin();
        $array = array();
        while ($row = $db->fetch_array($result)) {
            $creature = new Creature($row);
            $row["skill"] = $creature->data["sortskill"];
            $array[] = $row;
        }
        gSortCreatures($array);
        foreach ($array as $row) {
            $creature = new Creature($row);
            $url = array("<input type='checkbox' name='summons[", "#id", "]'>&nbsp;&nbsp;", "#creaturename");
            $creature->echoCreature($url);
        }
        echo '
			</table>
			<br><br>
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
			<td width="20%">
			</td>
			<td width="60%">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			';
        fText("Brimstone:", "brimstone", "0");
        fText("Crystal:", "crystal", "0");
            $classname = strtolower($gdClass[$challenge["class"] - 1]["name"]);
            if ($acc[$classname] < $challenge["value"]) {
                echo 'Invalid chid.<br>';
                $no = 1;
            }
        }
    }
    if ($no == 0) {
        tBegin($challenge["name"] . " challenge");
        $sql = "SELECT {$gdChallengeCreatureSelect}, cc.xp FROM (challengecreatures AS cc, creatures AS c, races AS r) LEFT JOIN items AS i ON cc.item = i.id WHERE cc.challenge = '{$chid}' AND cc.creature = c.id AND c.race = r.id ORDER BY c.name ASC";
        $result = $db->query($sql);
        $numrows = $db->num_rows($result);
        echo 'To beat this challenge, you have to defeat the ', $numrows, ' following creatures.<br><br>';
        tBegin();
        while ($row = $db->fetch_array($result)) {
            $creature = new Creature($row);
            $creature->echoCreature();
        }
        echo '</table>';
        echo '<br><a href="index.php?page=character&action=trychallenge&chid=', $chid, '">Try this challenge!</a><br>';
        tEnd();
    }
}
if ($action == "trychallenge") {
    $no = 0;
    if (!$chid) {
        echo 'Invalid data.<br>';
        $no = 1;
    } else {
        $sql = "SELECT * FROM challenges WHERE id = '{$chid}'";
        $result = $db->query($sql);
}
if (!$action) {
    $sql = "SELECT {$gdCreatureSelect} FROM (summons AS s, creatures AS c, races AS r) LEFT JOIN accitems AS ai ON s.item = ai.id LEFT JOIN items AS i ON ai.item = i.id WHERE s.account = '{$acc['id']}' AND s.creature = c.id AND c.race = r.id";
    $result = $db->query($sql);
    $numrows = $db->num_rows($result);
    if ($numrows == 0) {
        echo 'You don\'t have any creatures yet.';
    } else {
        unset($array);
        $dead = 0;
        $busy = 0;
        $passive = 0;
        $cost = 0;
        $array = array();
        while ($row = $db->fetch_array($result)) {
            $creature = new Creature($row);
            $row["skill"] = $creature->data["sortskill"];
            $array[] = $row;
            if ($row["dead"] == 1) {
                $dead++;
                $cost += round($creature->powerSkill() * gdResurrectMultiplier);
            } elseif ($row["status"] == 2 || $row["status"] == 3 || $row["status"] == 4 || $row["status"] == 6) {
                $busy++;
            } else {
                $passive++;
            }
        }
        echo "<br>{$numrows} creatures: {$passive} passive, {$busy} busy and {$dead} dead.<br>";
        if ($dead > 0) {
            if ($acc["power"] < $cost) {
                echo '<a href="index.php?page=creatures&action=resurrectall">Resurrect as many creatures as possible</a> (', $cost, ' power)<br>';
Exemple #6
0
 public function __construct($x, $y)
 {
     parent::__construct($x, $y);
     $this->code = 'A';
 }
<?php
ini_set('display_errors', ON);
error_reporting(E_ALL);


require_once('config.php');
require_once('classes/database.php');
require_once('classes/model.php');
require_once('classes/item.php');
require_once('classes/creature.php');
require_once('classes/template.php');

$db = Database::start();
if(isset($_GET['id'])){
	$creature_id = (int)$_GET['id'];	
	$creature = Creature::find($creature_id);
	if($creature){
		$loot = $creature->loot;
		$hero_loot = $creature->hero_loot;
	} else {
		$message = "No Creature With ID $creature_id Found!";
	}
	echo Template::render('head', array('creature' => $creature, 'creature_id' => $creature_id));
} else {
	echo Template::render('head');
}
?>	
	<?php if(isset($message)){ ?>
		<div id="message"><?php echo $message ?></div>
	<?php } ?>
		
Exemple #8
0
 public function close()
 {
     if (!$this->closed) {
         if (!$this instanceof Player or $this->loggedIn) {
             foreach ($this->inventory->getViewers() as $viewer) {
                 $viewer->removeWindow($this->inventory);
             }
         }
         parent::close();
     }
 }
     $mult = "steal1";
 }
 // fetch player data
 $sql = "SELECT * FROM accounts WHERE id = '{$targetid}'";
 $result = $db->query($sql);
 $target = $db->fetch_array($result);
 $target["level"] = gCalcLvl($target["xp"], $gdXpVar, $gdStartXp);
 $sql = "SELECT * FROM accounts WHERE id = '{$accountid}'";
 $result = $db->query($sql);
 $account = $db->fetch_array($result);
 $account["level"] = gCalcLvl($account["xp"], $gdXpVar, $gdStartXp);
 // set attacker/defender arrays
 $attackers_array = array("id" => $accountid, "Itherian" => $attackers_Itherian, "level" => $account["level"]);
 $creatures_array = array("id" => $targetid, "Itherian" => $creatures_Itherian, "level" => $target["level"]);
 for ($m = 0; $m < count($attackers); $m++) {
     $attacker = new Creature($attackers[$m]);
     if ($battle["resource"] == "arcane") {
         $attacker->data[$mult] = 100;
     }
     if (!$attacker->data["defender"]) {
         // raid
         // execute items
         $attacker->addItherian($attackers_Itherian);
         $attacker->execAbility("prebattle", gDummyCreature(), $attackers);
         $resources += round($attacker->data["skill"] * $gdRaidResourcesStolen);
         $attackername = $attacker->data["creaturename"];
         $attreport .= "<font class=\"alert\"><i>Your {$attackername} was left undefended and could steal a lot of resources.</i></font><br><br>";
         $defreport .= "<font class=\"head\"><i>Your opponent\\'s {$attackername} was left undefended and could steal a lot of resources.</i></font><br><br>";
         $gotthrough++;
         $stealmultiplier += $attacker->getStealMultiplier() * $attacker->data[$mult] / 100;
         // end of raid
Exemple #10
0
 function __construct($gender, $age)
 {
     parent::__construct(true);
     $this->gender = $gender;
     $this->age = $age;
 }
 } else {
     $health = 0;
 }
 $resources = 0;
 $buildingdamage = 0;
 $longreport = $report;
 // treasury
 if ($kdb["building"] == 0) {
     $mult = "steal2";
 } elseif ($kdb["building"] == -1) {
     $mult = "steal3";
 } else {
     $mult = "steal1";
 }
 for ($m = 0; $m < count($attackers); $m++) {
     $attacker = new Creature($attackers[$m]);
     foreach ($wavedata as $data) {
         if (!is_null($data["attacker_enchantment"]) && $attacker->data["cid"] == $data["attacker_enchantment_creature"]) {
             $attacker->gemSpellEffect[] = $data["attacker_enchantment_effect"];
             $attacker->gemSpell[] = $data["attacker_enchantment_effect_type"];
         }
     }
     if (is_null($attacker->data["defender"])) {
         // raid
         // execute items
         $attacker->execAbility("preprebattle", gDummyCreature(), $attackers);
         $attacker->addItherian($attackers_Itherian);
         $attacker->execAbility("prebattle", gDummyCreature(), $attackers);
         $amount = round($attacker->data["skill"] * gdKingdomRaidResourcesStolen);
         $attackername = $attacker->data["creaturename"];
         $accid = $attacker->data["accid"];
Exemple #12
0
 function __construct($object_id, $point, $map_object)
 {
     parent::__construct($object_id, $point, $map_object);
     $this->_enter_crossing_count = 0;
 }