void WorldSession::SendSpiritResurrect() { _player->ResurrectPlayer(0.5f, true); _player->DurabilityLossAll(0.25f, true); // get corpse nearest graveyard WorldSafeLocsEntry const* corpseGrave = NULL; WorldLocation corpseLocation = _player->GetCorpseLocation(); if (_player->HasCorpse()) { corpseGrave = sObjectMgr->GetClosestGraveYard(corpseLocation.GetPositionX(), corpseLocation.GetPositionY(), corpseLocation.GetPositionZ(), corpseLocation.GetMapId(), _player->GetTeam()); } // now can spawn bones _player->SpawnCorpseBones(); // teleport to nearest from corpse graveyard, if different from nearest to player ghost if (corpseGrave) { WorldSafeLocsEntry const* ghostGrave = sObjectMgr->GetClosestGraveYard( _player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeam()); if (corpseGrave != ghostGrave) _player->TeleportTo(corpseGrave->map_id, corpseGrave->x, corpseGrave->y, corpseGrave->z, _player->GetOrientation()); // or update at original position else _player->UpdateObjectVisibility(); } // or update at original position else _player->UpdateObjectVisibility(); }
SpellCastResult CheckElevation() { Unit* caster = GetCaster(); WorldLocation* dest = const_cast<WorldLocation*>(GetExplTargetDest()); if (!dest) return SPELL_FAILED_DONT_REPORT; if (dest->GetPositionZ() > caster->GetPositionZ() + 5.0f) return SPELL_FAILED_NOPATH; else if (caster->HasAuraType(SPELL_AURA_MOD_ROOT)) return SPELL_FAILED_ROOTED; return SPELL_CAST_OK; }
void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recvData*/) { if (!_player->HasCorpse()) { WorldPacket data(MSG_CORPSE_QUERY, 1); data << uint8(0); // corpse not found SendPacket(&data); return; } WorldLocation corpseLocation = _player->GetCorpseLocation(); uint32 corpseMapID = corpseLocation.GetMapId(); uint32 mapID = corpseLocation.GetMapId(); float x = corpseLocation.GetPositionX(); float y = corpseLocation.GetPositionY(); float z = corpseLocation.GetPositionZ(); // if corpse at different map if (mapID != _player->GetMapId()) { // search entrance map for proper show entrance if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(mapID)) { if (corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0) { // if corpse map have entrance if (Map const* entranceMap = sMapMgr->CreateBaseMap(corpseMapEntry->entrance_map)) { mapID = corpseMapEntry->entrance_map; x = corpseMapEntry->entrance_x; y = corpseMapEntry->entrance_y; z = entranceMap->GetHeight(GetPlayer()->GetPhaseMask(), x, y, MAX_HEIGHT); } } } } WorldPacket data(MSG_CORPSE_QUERY, 1+(6*4)); data << uint8(1); // corpse found data << int32(mapID); data << float(x); data << float(y); data << float(z); data << int32(corpseMapID); data << uint32(0); // unknown SendPacket(&data); }