void Teleport::__addThing(Creature* actor, int32_t index, Thing* thing) { Tile* destTile = g_game.getParentTile(getDestPos().x, getDestPos().y, getDestPos().z); if(destTile){ if(Creature* creature = thing->getCreature()){ getParentTile()->moveCreature(actor, creature, destTile, true); g_game.addMagicEffect(destTile->getPosition(), MAGIC_EFFECT_BLUE_BUBBLE); } else if(Item* item = thing->getItem()){ g_game.internalMoveItem(actor, getParentTile(), destTile, INDEX_WHEREEVER, item, item->getItemCount(), NULL); } } }
Item* Creature::dropCorpse() { Item* splash = NULL; if(getRace() == RACE_VENOM) splash = Item::CreateItem(ITEM_FULLSPLASH, FLUID_SLIME); else if(getRace() == RACE_BLOOD) splash = Item::CreateItem(ITEM_FULLSPLASH, FLUID_BLOOD); Tile* tile = getParentTile(); if(splash){ if(g_game.internalAddItem(NULL, tile, splash, INDEX_WHEREEVER, FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE) == RET_NOERROR){ g_game.startDecay(splash); } else{ g_game.FreeThing(splash); } } Item* corpse = createCorpse(); if(corpse){ if(g_game.internalAddItem(NULL, tile, corpse, INDEX_WHEREEVER, FLAG_IGNOREBLOCKITEM | FLAG_IGNOREBLOCKCREATURE) == RET_NOERROR){ dropLoot(corpse->getContainer()); g_game.startDecay(corpse); return corpse; } else{ g_game.FreeThing(corpse); } } return NULL; }
ZoneType Creature::getZone() const { const Tile* tile = getParentTile(); if(tile->hasFlag(TILEPROP_PROTECTIONZONE)){ return ZONE_PROTECTION; } else if(tile->hasFlag(TILEPROP_NOPVPZONE)){ return ZONE_NOPVP; } else if(tile->hasFlag(TILEPROP_PVPZONE)){ return ZONE_PVP; } else{ return ZONE_NORMAL; } }
int32_t Creature::getStepDuration() const { if(isRemoved()){ return 0; } int32_t duration = 0; const Tile* tile = getParentTile(); if(tile && tile->ground){ uint32_t groundId = tile->ground->getID(); uint16_t groundSpeed = Item::items[groundId].speed; uint32_t stepSpeed = getStepSpeed(); if(stepSpeed != 0){ duration = (1000 * groundSpeed) / stepSpeed; } } return duration * lastStepCost; }
void Creature::onRemovedCreature() { g_game.onMoveCreature(this, this, getParentTile(), NULL); }
void Creature::onPlacedCreature() { g_game.onMoveCreature(this, this, NULL, getParentTile()); }