void UpdateAI(uint32 diff) override { switch (phase) { case 1: if (timer < diff) { me->SetEntry(RIFT_SPAWN_ENTRY); Talk(1); EnterEvadeMode(); } else { GameObject * obj = me->FindNearestGameObject(CONTAINMENT_COFFER, 0.1f); if (obj) { obj->Delete(); Creature * summon = me->SummonCreature(ELM_GENERAL_PURPOSE_BUNNY, me->GetPosition(), TEMPSUMMON_TIMED_DESPAWN, 15000); summon->AI()->DoCast(9010); me->DespawnOrUnsummon(); phase = 2; } timer -= diff; } break; default: break; } DoMeleeAttackIfReady(); }
void BattleGroundWS::RespawnFlagAfterDrop(uint32 team) { if (GetStatus() != STATUS_IN_PROGRESS) return; RespawnFlag(team,false); if (team == ALLIANCE) { SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); SendMessageToAll(GetTrinityString(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED)); } else { SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); SendMessageToAll(GetTrinityString(LANG_BG_WS_HORDE_FLAG_RESPAWNED)); } PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); Map * tmpMap = GetMap(); if (!tmpMap) return; GameObject *obj = tmpMap->GetGameObject(GetDroppedFlagGUID(team)); if (obj) obj->Delete(); else sLog.outLog(LOG_DEFAULT, "ERROR: unknown droped flag bg, guid: %u",GUID_LOPART(GetDroppedFlagGUID(team))); SetDroppedFlagGUID(0,team); m_BothFlagsKept = false; }
void BattleGroundWS::RespawnFlagAfterDrop(uint32 team) { if (GetStatus() != STATUS_IN_PROGRESS) return; RespawnFlag(team,false); if (team == ALLIANCE) { SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); SendMessageToAll(LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); } else { SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); SendMessageToAll(LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); } PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); GameObject *obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID(team)); if (obj) obj->Delete(); else sLog.outError("unknown droped flag bg, guid: %u",GUID_LOPART(GetDroppedFlagGUID(team))); SetDroppedFlagGUID(0,team); }
bool ChatHandler::HandleDelObjectCommand(const char* args) { if(!*args) return false; uint32 lowguid = atoi((char*)args); if(!lowguid) return false; GameObject* obj = ObjectAccessor::Instance().GetGameObject(*m_session->GetPlayer(), MAKE_GUID(lowguid, HIGHGUID_GAMEOBJECT)); if(!obj) { PSendSysMessage("Game Object (GUID: %u) not found", lowguid); return true; } if(obj->isReferenced()) { PSendSysMessage("Game Object (GUID: %u) have references in some Unit GO list, can't be deleted.", obj->GetGUIDLow()); return true; } obj->Delete(); obj->DeleteFromDB(); PSendSysMessage("Game Object (GUID: %u) removed", obj->GetGUIDLow()); return true; }
void BattlegroundTP::RespawnFlagAfterDrop(uint32 team) { if (GetStatus() != STATUS_IN_PROGRESS) return; RespawnFlag(team, false); if (team == ALLIANCE) { SpawnBGObject(BG_TP_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY); SendMessageToAll(LANG_BG_TP_ALLIANCE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); } else { SpawnBGObject(BG_TP_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY); SendMessageToAll(LANG_BG_TP_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL); } PlaySoundToAll(BG_TP_SOUND_FLAGS_RESPAWNED); GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team)); if (obj) obj->Delete(); else sLog->outError("unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team))); SetDroppedFlagGUID(0, team); m_BothFlagsKept = false; }
bool OPvPCapturePoint::DelObject(uint32 type) { if (!m_Objects[type]) return false; if (!m_PvP->GetMap()) { sLog.outLog(LOG_DEFAULT, "ERROR: opvp capture point couldn't get map to find creature"); return false; } GameObject *obj = m_PvP->GetMap()->GetGameObject(m_Objects[type]); if (!obj) { m_Objects[type] = 0; return false; } uint32 guid = obj->GetDBTableGUIDLow(); obj->SetRespawnTime(0); // not save respawn time obj->Delete(); sObjectMgr.DeleteGOData(guid); m_ObjectTypes[m_Objects[type]] = 0; m_Objects[type] = 0; return true; }
bool OutdoorPvPObjective::DelCapturePoint() { Map* map = m_PvP->GetMap(); if (m_CapturePoint) { GameObject *obj = map->GetGameObject(m_CapturePoint); if (obj) { obj->SetRespawnTime(0); // not save respawn time obj->Delete(); } m_CapturePoint = 0; } if (m_CapturePointCreature) { Creature *cr = map->GetCreature(m_CapturePointCreature); if (cr) cr->AddObjectToRemoveList(); m_CapturePointCreature = 0; } return true; }
bool OPvPCapturePoint::DelObject(uint32 type) { if(!m_Objects[type]) return false; Map* map = sMapMgr.FindMap(530); if(!map) { m_Objects[type] = 0; return false; } GameObject *obj = map->GetGameObject(m_Objects[type]); if(!obj) { m_Objects[type] = 0; return false; } uint32 guid = obj->GetDBTableGUIDLow(); obj->SetRespawnTime(0); // not save respawn time obj->Delete(); sObjectMgr.DeleteGOData(guid); m_ObjectTypes[m_Objects[type]] = 0; m_Objects[type] = 0; return true; }
void BattleGroundDS::DespawnBGObject(uint64 const& guid) { Map* map = GetBgMap(); GameObject *obj = map->GetGameObject(guid); if(obj) obj->Delete(); }
//delete object by selection or guid static bool HandleGameObjectDeleteCommand(ChatHandler* handler, char const* args) { // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r char* id = handler->extractKeyFromLink((char*)args, "Hgameobject"); if (!id && !args) return false; uint32 guidLow = (args) ? handler->GetSession()->GetPlayer()->GetSelectedGobject(): atoi(id); if (!guidLow) return false; if (handler->GetSession()->GetSecurity() == SEC_MODERATOR && handler->GetSession()->GetPlayer()->GetPhaseMask() == 1) { handler->SendSysMessage("You cannot permanently delete GameObjects in the main phase. Use .modify phase $number to delete your GameObject."); return true; } if (handler->GetSession()->GetSecurity() == SEC_MODERATOR && handler->GetSession()->GetPlayer()->GetPhaseMask() == -1) { handler->SendSysMessage("You cannot permanently delete GameObjects in the main phase. Use .modify phase $number to delete your GameObject."); return true; } GameObject* object = NULL; // by DB guid if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow)) object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id); if (!object) { handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow); handler->SetSentErrorMessage(true); return false; } uint64 ownerGuid = object->GetOwnerGUID(); if (ownerGuid) { Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), ownerGuid); if (!owner || !IS_PLAYER_GUID(ownerGuid)) { handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(ownerGuid), object->GetGUIDLow()); handler->SetSentErrorMessage(true); return false; } owner->RemoveGameObject(object, false); } object->SetRespawnTime(0); // not save respawn time object->Delete(); object->DeleteFromDB(); handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, object->GetGUIDLow()); return true; }
void GameObject::CallDelete(ObjectMaster *obj) { GameObject *cgo = (GameObject *)obj->Data2; cgo->Delete(); obj->Data2 = nullptr; cgo->objData = nullptr; if (cgo->initFromObj) delete cgo; }
void SpawnObjects(MapMgr *pmgr) { if(pmgr->GetMapId() != 530) return; const static sgodata godata[] = { { 182173, -290.016f, 3702.42f, 56.6729f, 0.0349066f, 0, 0, 0.0174524f, 0.999848f, 1, 32, 0, 1 }, // stadium { 182174, -184.889f, 3476.93f, 38.205f, -0.0174535f, 0, 0, 0.00872664f, -0.999962f, 1, 32, 0, 1 }, // overlook { 182175, -471.462f, 3451.09f, 34.6432f, 0.174533f, 0, 0, 0.0871557f, 0.996195f, 1, 32, 0, 1 }, // brokenhill { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, }; const static sgodata godata_banner[] = { { 183515, -289.61f, 3696.83f, 75.9447f, 3.12414f, 0, 0, 0.999962f, 0.00872656f, 1, 32, 1375, 1 }, // stadium { 182525, -187.887f, 3459.38f, 60.0403f, -3.12414f, 0, 0, 0.999962f, -0.00872653f, 1, 32, 1375, 1 }, // overlook { 183514, -467.078f, 3528.17f, 64.7121f, 3.14159f, 0, 0, 1, -4.37114E-8f, 1, 32, 1375, 1 }, // brokenhill { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, }; for(uint32 i = 0; i < 3; ++i) { GameObject *pGo = pmgr->GetInterface()->SpawnGameObject(godata[i].entry, godata[i].posx, godata[i].posy, godata[i].posz, godata[i].facing, false, 0, 0); if(pGo == NULL) continue; GameObject *pGo2 = pmgr->GetInterface()->SpawnGameObject(godata_banner[i].entry, godata_banner[i].posx, godata_banner[i].posy, godata_banner[i].posz, godata_banner[i].facing, false, 0, 0); if(pGo2 == NULL) { pGo->Delete(); continue; } pGo->SetUInt32Value(GAMEOBJECT_STATE, godata[i].state); pGo->SetUInt32Value(GAMEOBJECT_FLAGS, godata[i].flags); pGo->SetUInt32Value(GAMEOBJECT_FACTION, godata[i].faction); pGo2->SetUInt32Value(GAMEOBJECT_STATE, godata_banner[i].state); pGo2->SetUInt32Value(GAMEOBJECT_FLAGS, godata_banner[i].flags); pGo2->SetUInt32Value(GAMEOBJECT_FACTION, godata_banner[i].faction); for(uint32 j = 0; j < 4; ++j) { pGo->SetFloatValue(GAMEOBJECT_ROTATION + j, godata[i].orientation[j]); pGo2->SetFloatValue(GAMEOBJECT_ROTATION + j, godata_banner[i].orientation[j]); } // now make his script pGo->SetScript(new HellfirePeninsulaBannerAI(pGo)); dynamic_cast<HellfirePeninsulaBannerAI*>(pGo->GetScript())->pBanner = pGo2; pGo->AddToWorld(pmgr); pGo2->AddToWorld(pmgr); dynamic_cast<HellfirePeninsulaBannerAI*>(pGo->GetScript())->SetupGo(pmgr); } }
bool RewardReached(GameObject *reward) { GameObject *target = FindGameObject(GO_LOOT_BOX, 10, me); if(target) { me->CastSpell(me, SPELL_SMASH, false); // CHECKME: should do some emote that he is opening chest target->Delete(); } return true; }
void BattlegroundEY::RespawnFlagAfterDrop() { RespawnFlag(true); GameObject* obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID()); if (obj) obj->Delete(); else TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Unknown dropped flag guid: %s", GetDroppedFlagGUID().ToString().c_str()); SetDroppedFlagGUID(ObjectGuid::Empty); }
void BattlegroundEY::RespawnFlagAfterDrop() { RespawnFlag(true); GameObject* obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID()); if (obj) obj->Delete(); else TC_LOG_ERROR(LOG_FILTER_BATTLEGROUND, "BattlegroundEY: Unknown dropped flag guid: %u", GUID_LOPART(GetDroppedFlagGUID())); SetDroppedFlagGUID(0); }
void MovementInform(uint32 /*type*/, uint32 id) { if(id == 1) { GameObject* Keg = me->FindNearestGameObject(GO_KEG, 20); if(Keg) Keg->Delete(); me->HandleEmoteCommand(7); me->SetReactState(REACT_AGGRESSIVE); me->GetMotionMaster()->MoveTargetedHome(); } }
void BattleGroundEY::RespawnFlagAfterDrop() { RespawnFlag(true); GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID()); if (obj) obj->Delete(); else sLog.outError("BattleGroundEY: Unknown dropped flag guid: %u",GUID_LOPART(GetDroppedFlagGUID())); SetDroppedFlagGUID(0); }
void BattlegroundEY::RespawnFlagAfterDrop() { RespawnFlag(true); GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID()); if (obj) obj->Delete(); else TC_LOG_ERROR("bg.battleground", "BattlegroundEY: Unknown dropped flag (%s).", GetDroppedFlagGUID().ToString().c_str()); SetDroppedFlagGUID(ObjectGuid::Empty); }
void BattleGroundEY::RespawnDroppedFlag() { RespawnFlag(); GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGuid()); if (obj) obj->Delete(); else sLog.outError("BattleGroundEY: Unknown dropped flag: %s", GetDroppedFlagGuid().GetString().c_str()); ClearDroppedFlagGuid(); }
void BattleGroundEY::RespawnFlagAfterDrop() { RespawnFlag(true); GameObject *obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID()); if(obj) obj->Delete(); else sLog.outError("BattleGroundEY: Unknown dropped flag guid: %u",GetDroppedFlagGUID()); SetDroppedFlagGUID(0); }
bool BattleGround::DelObject(uint32 type) { GameObject *obj = HashMapHolder<GameObject>::Find(m_BgObjects[type]); if(!obj) { sLog.outError("Can't find gobject guid: %u",m_BgObjects[type]); return false; } obj->SetRespawnTime(0); // not save respawn time obj->Delete(); m_BgObjects[type] = 0; return true; }
void UpdateAI(const uint32 /*diff*/) { GameObject* pool = me->FindNearestGameObject(OBJECT_TOXIC_POOL, 2.0f); if (pool) { if (Player* player = me->GetCharmerOrOwnerPlayerOrPlayerItself()) { me->Say(SAY_MULTI_BOT, LANG_UNIVERSAL, 0); me->CastSpell(me, SPELL_CLEAN_UP_TOXIC_POOL, true); me->CastSpell(player, SPELL_TOXIC_POOL_CREDIT_TO_MASTER, true); pool->Delete(); } } }
void UnsummonPortal() { if (summoned) { GameObject *PortalToWintergrasp = GameObject::GetGameObject(*me, PortalGUID); if (!PortalToWintergrasp) PortalToWintergrasp = me->FindNearestGameObject(PORTAL_TO_WINTERGRASP, 10); if (PortalToWintergrasp) { PortalToWintergrasp->Delete(); PortalGUID = 0; } summoned = false; } }
void SpellHitTarget(Unit *target, const SpellEntry *entry) { GameObject *go = FindGameObject(GO_ASHLI_VASE, 5, target); if(!YellAshliVaseDone[1] && MovePoint == 3) { DoScriptText(YELL_ASHLI_VASE2, me); YellAshliVaseDone[1] = true; } if(!YellAshliVaseDone[2] && MovePoint == 6) { DoScriptText(YELL_ASHLI_VASE3, me); YellAshliVaseDone[2] = true; } if(go) go->Delete(); }
void MovementInform(uint32 /*type*/, uint32 id) { Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); if (id == 1) { GameObject* Keg = me->FindNearestGameObject(GO_KEG, 20); if (Keg) Keg->Delete(); me->HandleEmoteCommand(7); me->SetReactState(REACT_AGGRESSIVE); me->GetMotionMaster()->MoveTargetedHome(); Creature* Credit = me->FindNearestCreature(NPC_QUEST_CREDIT, 50, true); if (pPlayer && Credit) pPlayer->KilledMonster(Credit->GetCreatureInfo(), Credit->GetGUID()); } }
//delete object by selection or guid static bool HandleGameObjectDeleteCommand (ChatHandler* handler, const char* args) { // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r char* cId = handler->extractKeyFromLink((char*) args, "Hgameobject"); if (!cId) return false; uint32 lowguid = atoi(cId); if (!lowguid) return false; GameObject* obj = NULL; // by DB guid if (GameObjectData const* go_data = sObjectMgr->GetGOData(lowguid)) obj = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(lowguid, go_data->id); if (!obj) { handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, lowguid); handler->SetSentErrorMessage(true); return false; } uint64 owner_guid = obj->GetOwnerGUID(); if (owner_guid) { Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), owner_guid); if (!owner || !IS_PLAYER_GUID(owner_guid)) { handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(owner_guid), obj->GetGUIDLow()); handler->SetSentErrorMessage(true); return false; } owner->RemoveGameObject(obj, false); } obj->SetRespawnTime(0); // not save respawn time obj->Delete(); obj->DeleteFromDB(); handler->PSendSysMessage(LANG_COMMAND_DELOBJMESSAGE, obj->GetGUIDLow()); sLog->outSQLDev("DELETE FROM gameobject WHERE guid = %u;", obj->GetGUIDLow()); return true; }
bool BattleGround::DelObject(uint32 type) { if (!m_BgObjects[type]) return true; GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]); if (!obj) { sLog.outError("Can't find gobject guid: %u",GUID_LOPART(m_BgObjects[type])); return false; } obj->SetRespawnTime(0); // not save respawn time obj->Delete(); m_BgObjects[type] = 0; return true; }
//delete object by selection or guid static bool HandleGameObjectDeleteCommand(ChatHandler* handler, char const* args) { // number or [name] Shift-click form |color|Hgameobject:go_guid|h[name]|h|r char* id = handler->extractKeyFromLink((char*)args, "Hgameobject"); if (!id) return false; uint32 guidLow = atoi(id); if (!guidLow) return false; GameObject* object = NULL; // by DB guid if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow)) object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id); if (!object) { handler->PSendSysMessage(LANGUAGE_COMMAND_OBJNOTFOUND, guidLow); handler->SetSentErrorMessage(true); return false; } uint64 ownerGuid = object->GetOwnerGUID(); if (ownerGuid) { Unit* owner = ObjectAccessor::GetUnit(*handler->GetSession()->GetPlayer(), ownerGuid); if (!owner || !IS_PLAYER_GUID(ownerGuid)) { handler->PSendSysMessage(LANGUAGE_COMMAND_DELOBJREFERCREATURE, GUID_LOPART(ownerGuid), object->GetGUIDLow()); handler->SetSentErrorMessage(true); return false; } owner->RemoveGameObject(object, false); } object->SetRespawnTime(0); // not save respawn time object->Delete(); object->DeleteFromDB(); handler->PSendSysMessage(LANGUAGE_COMMAND_DELOBJMESSAGE, object->GetGUIDLow()); return true; }
bool OPvPCapturePoint::DelObject(uint32 type) { if (!m_Objects[type]) return false; GameObject *obj = HashMapHolder<GameObject>::Find(m_Objects[type]); if (!obj) { m_Objects[type] = 0; return false; } uint32 guid = obj->GetDBTableGUIDLow(); obj->SetRespawnTime(0); // not save respawn time obj->Delete(); sObjectMgr->DeleteGOData(guid); m_ObjectTypes[m_Objects[type]] = 0; m_Objects[type] = 0; return true; }
bool OutdoorPvPObjective::DelCapturePoint() { if(!m_CapturePoint) return false; GameObject *obj = HashMapHolder<GameObject>::Find(m_CapturePoint); if(!obj) { sLog.outError("OutdoorPvPObjective: Can't find gobject guid: %u", GUID_LOPART(m_CapturePoint)); return false; } uint32 guid = obj->GetDBTableGUIDLow(); obj->SetRespawnTime(0); // not save respawn time obj->Delete(); objmgr.DeleteGOData(guid); m_CapturePoint = 0; return true; }