本文整理汇总了PHP中Item::getID方法的典型用法代码示例。如果您正苦于以下问题:PHP Item::getID方法的具体用法?PHP Item::getID怎么用?PHP Item::getID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Item
的用法示例。
在下文中一共展示了Item::getID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValue
/**
* @return float
*/
function getValue()
{
if (isset($this->value)) {
return $this->value;
}
if ($this->item_->getAttribute('price')) {
$this->value = (double) $this->item_->getAttribute('price');
return $this->value;
} else {
if ($this->item_->getAttribute('basePrice')) {
$this->value = (double) $this->item_->getAttribute('basePrice');
return $this->value;
}
}
$qry = DBFactory::getDBQuery();
$qry->execute("SELECT basePrice, price\n\t\t\t\t\tFROM kb3_invtypes\n\t\t\t\t\tLEFT JOIN kb3_item_price ON kb3_invtypes.typeID=kb3_item_price.typeID\n\t\t\t\t\tWHERE kb3_invtypes.typeID='" . $this->item_->getID() . "'");
if ($row = $qry->getRow()) {
if ($row['price']) {
$this->value = (double) $row['price'];
} else {
$this->value = (double) $row['basePrice'];
}
} else {
$this->value = 0;
}
return $this->value;
}
示例2: onActivate
public function onActivate(Item $item, Player $player)
{
if ($item->getID() === DYE and $item->getMetadata() === 0xf) {
//Bonemeal
TreeObject::growTree($this->level, $this, new Random(), $this->meta & 0x3);
if (($player->gamemode & 0x1) === 0) {
$item->count--;
}
return true;
}
return false;
}
示例3: onActivate
public function onActivate(Item $item, Player $player)
{
if ($item->getID() === DYE and $item->getMetadata() === 0xf) {
//Bonemeal
$this->meta = 0x7;
$this->level->setBlock($this, $this, true, false, true);
if (($player->gamemode & 0x1) === 0) {
$item->count--;
}
return true;
}
return false;
}
示例4: generate
function generate()
{
global $smarty;
$this->toplist->generate();
while ($row = $this->toplist->getRow()) {
$item = new Item($row['itm_id']);
$rows[] = array('rank' => false, 'name' => $item->getName(), 'uri' => edkURI::build(array('a', 'invtype', true), array('id', $item->getID(), true)), 'icon' => $item->getIcon(32), 'count' => $row['cnt']);
}
$smarty->assign('tl_name', Language::get('weapon'));
$smarty->assign('tl_type', Language::get('kills'));
$smarty->assignByRef('tl_rows', $rows);
return $smarty->fetch(get_tpl('toplisttable'));
}
示例5: onActivate
public function onActivate(Item $item, Player $player)
{
if ($item->getID() === FLINT_STEEL) {
if (($player->gamemode & 0x1) === 0) {
$item->useOn($this);
}
$data = array("x" => $this->x + 0.5, "y" => $this->y + 0.5, "z" => $this->z + 0.5, "power" => 4, "fuse" => 20 * 4);
$this->level->setBlock($this, new AirBlock(), false, false, true);
$e = ServerAPI::request()->api->entity->add($this->level, ENTITY_OBJECT, OBJECT_PRIMEDTNT, $data);
ServerAPI::request()->api->entity->spawnToAll($e);
return true;
}
return false;
}
示例6: onActivate
public function onActivate(Item $item, Player $player)
{
if ($item->getID() === DYE and $item->getMetadata() === 0xf) {
if (($player->gamemode & 0x1) === 0) {
$item->count--;
}
TallGrassObject::growGrass($this->level, $this, new Random(), 8, 2);
return true;
} elseif ($item->isHoe()) {
if (($player->gamemode & 0x1) === 0) {
$item->useOn($this);
}
$this->level->setBlock($this, new FarmlandBlock());
return true;
}
return false;
}
示例7: onActivate
public function onActivate(Item $item, Player $player)
{
if ($item->getID() === DYE and $item->getMetadata() === 0xf) {
//Bonemeal
if ($this->getSide(0)->getID() !== SUGARCANE_BLOCK) {
for ($y = 1; $y < 3; ++$y) {
$b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z));
if ($b->getID() === AIR) {
$this->level->setBlock($b, new SugarcaneBlock(), true, false, true);
break;
}
}
$this->meta = 0;
$this->level->setBlock($this, $this, true, false, true);
}
if (($player->gamemode & 0x1) === 0) {
$item->count--;
}
return true;
}
return false;
}
示例8: addShipment
public function addShipment(Item $item)
{
$this->shipments[$item->getID()] = $item;
}
示例9: putSlot
protected function putSlot(Item $item)
{
$this->putShort($item->getID());
$this->putByte($item->count);
$this->putShort($item->getMetadata());
}
示例10: W_replace
private function W_replace($selection, Item $block1, $blocks2, &$output = null)
{
if (!is_array($selection) or $selection[0] === false or $selection[1] === false or $selection[0][3] !== $selection[1][3]) {
$output .= "Make a selection first.\n";
return false;
}
$totalCount = $this->countBlocks($selection);
if ($totalCount > 524288) {
$send = false;
} else {
$send = true;
}
$level = $selection[0][3];
$id1 = $block1->getID();
$meta1 = $block1->getMetadata();
$bcnt2 = count($blocks2) - 1;
if ($bcnt2 < 0) {
$output .= "Incorrect blocks.\n";
return false;
}
$startX = min($selection[0][0], $selection[1][0]);
$endX = max($selection[0][0], $selection[1][0]);
$startY = min($selection[0][1], $selection[1][1]);
$endY = max($selection[0][1], $selection[1][1]);
$startZ = min($selection[0][2], $selection[1][2]);
$endZ = max($selection[0][2], $selection[1][2]);
$count = 0;
for ($x = $startX; $x <= $endX; ++$x) {
for ($y = $startY; $y <= $endY; ++$y) {
for ($z = $startZ; $z <= $endZ; ++$z) {
$b = $level->getBlock(new Vector3($x, $y, $z));
if ($b->getID() === $id1 and ($meta1 === false or $b->getMetadata() === $meta1)) {
$count += (int) $level->setBlockRaw($b, $blocks2[mt_rand(0, $bcnt2)]->getBlock(), false, $send);
}
unset($b);
}
}
}
if ($send === false) {
$forceSend = function ($X, $Y, $Z) {
$this->changedCount[$X . ":" . $Y . ":" . $Z] = 4096;
};
$forceSend->bindTo($level, $level);
for ($X = $startX >> 4; $X <= $endX >> 4; ++$X) {
for ($Y = $startY >> 4; $Y <= $endY >> 4; ++$Y) {
for ($Z = $startZ >> 4; $Z <= $endZ >> 4; ++$Z) {
$forceSend($X, $Y, $Z);
}
}
}
}
$output .= "{$count} block(s) have been changed.\n";
return true;
}
示例11: drop
public function drop(Position $pos, Item $item)
{
if ($item->getID() === AIR or $item->count <= 0) {
return;
}
$data = array("x" => $pos->x + mt_rand(-10, 10) / 50, "y" => $pos->y + 0.19, "z" => $pos->z + mt_rand(-10, 10) / 50, "level" => $pos->level, "speedY" => mt_rand(5, 8) / 2, "item" => $item);
if ($this->server->api->handle("item.drop", $data) !== false) {
for ($count = $item->count; $count > 0;) {
$item->count = min($item->getMaxStackSize(), $count);
$count -= $item->count;
$e = $this->add($pos->level, ENTITY_ITEM, $item->getID(), $data);
$this->spawnToAll($e);
$this->server->api->handle("entity.motion", $e);
}
}
}
示例12: setSlot
public function setSlot($s, Item $item, $update = true, $offset = 0)
{
$i = $this->getSlotIndex($s);
$d = array("Count" => $item->count, "Slot" => $s, "id" => $item->getID(), "Damage" => $item->getMetadata());
if ($i === false) {
return false;
} elseif ($item->getID() === AIR or $item->count <= 0) {
if ($i >= 0) {
unset($this->data["Items"][$i]);
}
} elseif ($i < 0) {
$this->data["Items"][] = $d;
} else {
$this->data["Items"][$i] = $d;
}
$this->server->api->dhandle("tile.container.slot", array("tile" => $this, "slot" => $s, "offset" => $offset, "slotdata" => $item));
if ($update === true and $this->scheduledUpdate === false) {
$this->update();
}
return true;
}
示例13: parse
//.........这里部分代码省略.........
unset($systemname);
} else {
$victimname = $systemname;
}
}
if (strcmp($corpname, 'Unknown') == 0) {
$this->error('Victim has no corp.');
unset($corpname);
}
if (strcmp($shipname, 'Unknown') == 0) {
$this->error('Victim has no ship type.');
unset($shipname);
}
if (strcmp($systemname, 'Unknown') == 0) {
$this->error('Killmail lacks solar system information.');
unset($systemname);
}
if ($pos == 1) {
$victimname = $moon;
}
if (!isset($timestamp) || !isset($factionname) || !isset($alliancename) || !isset($corpname) || !isset($victimname) || !isset($shipname) || !isset($systemname) || !isset($systemsec)) {
return 0;
}
if ($checkauth) {
$authorized = false;
} else {
$authorized = true;
}
// populate/update database
$alliance = $this->fetchAlliance($alliancename);
$corp = $this->fetchCorp($corpname, $alliance, $timestamp);
$victim = $this->fetchPilot($victimname, $corp, $timestamp);
$system = SolarSystem::lookup($systemname);
if (!$system || !$system->getID()) {
$this->error('System not found.', $systemname);
$system = new SolarSystem();
}
$ship = Ship::lookup($shipname);
if (!$ship || !$ship->getID()) {
$this->error('Ship not found.', $shipname);
$ship = new Ship();
}
$kill = new Kill();
if ($this->externalID) {
$kill->setExternalID($this->externalID);
}
$kill->setTimeStamp($timestamp);
$kill->setVictim($victim);
$kill->setVictimID($victim->getID());
$kill->setVictimCorpID($corp->getID());
$kill->setVictimAllianceID($alliance->getID());
$kill->setVictimShip($ship);
$kill->setSolarSystem($system);
if ($dmgtaken) {
$kill->set('dmgtaken', $dmgtaken);
}
if (config::get('cfg_allianceid') && in_array($alliance->getID(), config::get('cfg_allianceid'))) {
$authorized = true;
} elseif (config::get('cfg_corpid') && in_array($corp->getID(), config::get('cfg_corpid'))) {
$authorized = true;
} elseif (config::get('cfg_pilotid') && in_array($victim->getID(), config::get('cfg_pilotid'))) {
$authorized = true;
}
// involved parties section
$end = strpos($this->killmail_, "Destroyed items:");
if ($end == 0) {
示例14: W_replace
private function W_replace($selection, Item $block1, $blocks2, &$output = null)
{
if (!is_array($selection) or $selection[0] === false or $selection[1] === false or $selection[0][3] !== $selection[1][3]) {
$output .= "Make a selection first.\n";
return false;
}
$level = $selection[0][3];
$id1 = $block1->getID();
$meta1 = $block1->getMetadata();
$bcnt2 = count($blocks2) - 1;
if ($bcnt2 < 0) {
$output .= "Incorrect blocks.\n";
return false;
}
$startX = min($selection[0][0], $selection[1][0]);
$endX = max($selection[0][0], $selection[1][0]);
$startY = min($selection[0][1], $selection[1][1]);
$endY = max($selection[0][1], $selection[1][1]);
$startZ = min($selection[0][2], $selection[1][2]);
$endZ = max($selection[0][2], $selection[1][2]);
$count = 0;
for ($x = $startX; $x <= $endX; ++$x) {
for ($y = $startY; $y <= $endY; ++$y) {
for ($z = $startZ; $z <= $endZ; ++$z) {
$b = $level->getBlock(new Vector3($x, $y, $z));
if ($b->getID() === $id1 and ($meta1 === false or $b->getMetadata() === $meta1)) {
$count += (int) $level->setBlock($b, $blocks2[mt_rand(0, $bcnt2)]->getBlock(), false);
}
}
}
}
$output .= "{$count} block(s) have been changed.\n";
return true;
}
示例15: Conexion
$result_c .= "}";
} else {
if ($bandera == 2) {
$get->c_nombre = base64_decode($get->c_nombre);
$get->c_descripcion = base64_decode($get->c_descripcion);
if ($get->c_nombre != "" && $get->c_descripcion != "") {
$result_c = "{{" . $get->c_nombre . ", " . $get->c_descripcion . "}}";
} else {
$vacio = true;
}
}
}
$data = $result_c;
if ($get->referencia != "" && $get->nombre != "" && $get->descripcion != "" && $get->unidad != "" && $get->iva != "" && $get->tipo != "" && !$vacio) {
$conexion = new Conexion();
$item = new Item($item->getID(), $conexion);
$item->instanciarMateriaprima($conexion);
$mp = $item->getMateriaprima();
$operation = $mp->modificar($get->nombre, $get->descripcion, $data, $conexion);
if ($operation['ejecution'] && $operation['result']) {
$operation = $item->modificar($get->referencia, $get->iva, $get->unidad, $get->tipo, $conexion);
if ($operation['ejecution'] && $operation['result']) {
/*$item->instanciarMateriaprima($conexion);
$mp = $item->getMateriaprima();*/
$operation['message'] = "Se actualizó correctamente la información.";
$log = Log::registro($usuario->getID(), "info", "Actualización de información - Item. {" . $get->referencia . ", " . $get->iva . ", " . $get->unidad . ", " . $get->tipo . "}", $conexion);
$log = Log::registro($usuario->getID(), "info", "Actualización de información - Materia Prima. {" . $get->nombre . ", " . $get->descripcion . ", " . $data . "}", $conexion);
}
}
$_SESSION['item'] = serialize($item);
}