Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] development from vmangos:development #585

Merged
merged 2 commits into from
Dec 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
398 changes: 398 additions & 0 deletions sql/migrations/20241228161610_world.sql

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions src/game/Maps/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3740,3 +3740,40 @@ Creature* Map::LoadCreatureSpawnWithGroup(uint32 leaderDbGuid, bool delaySpawn)

return pLeader;
}

GameObject* Map::LoadGameObjectSpawn(uint32 dbGuid, bool delaySpawn)
{
GameObjectData const* pSpawnData = sObjectMgr.GetGOData(dbGuid);
if (!pSpawnData)
return nullptr;

if (GetId() != pSpawnData->position.mapId)
{
sLog.Out(LOG_SCRIPTS, LOG_LVL_ERROR, "Attempt to load gameobject spawn guid %u on wrong map %u.", dbGuid, GetId());
return nullptr;
}

GameObject* pGameObject;
if (pGameObject = GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, pSpawnData->id, dbGuid)))
return pGameObject;

if (!IsLoaded(pSpawnData->position.x, pSpawnData->position.y))
return nullptr;

pGameObject = GameObject::CreateGameObject(pSpawnData->id);
if (!pGameObject->LoadFromDB(dbGuid, this, true))
{
delete pGameObject;
return nullptr;
}

if (delaySpawn)
{
pGameObject->SetRespawnTime(pGameObject->GetRespawnDelay());
if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATELY))
pGameObject->SaveRespawnTime();
}

Add(pGameObject);
return pGameObject;
}
1 change: 1 addition & 0 deletions src/game/Maps/Map.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ class Map : public GridRefManager<NGridType>
Creature* SummonCreature(uint32 entry, float x, float y, float z, float ang, TempSummonType spwtype = TEMPSUMMON_DEAD_DESPAWN, uint32 despwtime = 25000, bool asActiveObject = false);
Creature* LoadCreatureSpawn(uint32 dbGuid, bool delaySpawn = false);
Creature* LoadCreatureSpawnWithGroup(uint32 leaderDbGuid, bool delaySpawn = false);
GameObject* LoadGameObjectSpawn(uint32 dbGuid, bool delaySpawn = false);

Player* GetPlayer(ObjectGuid guid);
GameObject* GetGameObject(ObjectGuid const& guid) { return GetObject<GameObject>(guid); }
Expand Down
16 changes: 1 addition & 15 deletions src/game/Maps/ScriptCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2314,22 +2314,8 @@ bool Map::ScriptCommand_DespawnGameObject(ScriptInfo const& script, WorldObject*
// SCRIPT_COMMAND_LOAD_GAMEOBJECT_SPAWN (82)
bool Map::ScriptCommand_LoadGameObject(ScriptInfo const& script, WorldObject* source, WorldObject* target)
{
GameObjectData const* pGameObjectData = sObjectMgr.GetGOData(script.loadGo.goGuid);

if (GetId() != pGameObjectData->position.mapId)
{
sLog.Out(LOG_SCRIPTS, LOG_LVL_ERROR, "SCRIPT_COMMAND_LOAD_GAMEOBJECT_SPAWN (script id %u) tried to spawn guid %u on wrong map %u.", script.id, script.loadGo.goGuid, GetId());
if (!LoadGameObjectSpawn(script.loadGo.goGuid))
return ShouldAbortScript(script);
}

if (GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, pGameObjectData->id, script.loadGo.goGuid)))
return ShouldAbortScript(script); // already spawned

GameObject* pGameobject = GameObject::CreateGameObject(pGameObjectData->id);
if (!pGameobject->LoadFromDB(script.loadGo.goGuid, this, true))
delete pGameobject;
else
Add(pGameobject);

return false;
}
Expand Down
59 changes: 55 additions & 4 deletions src/game/OutdoorPvP/OutdoorPvPSI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,51 @@ void OutdoorPvPSI::OnPlayerLeave(Player* plr)
OutdoorPvP::OnPlayerLeave(plr);
}

static std::vector<uint32> const sAllianceDustBags = { 9496, 9497, 9498, 9499, 9500, 9501, 9502, 9503, 9504, 9507, 9508 };
static std::vector<uint32> const sHordeDustBags = { 13566, 13567, 13568, 13582, 13583, 13584, 13585, 13587, 13588, 13589, 13590, 13591 };

void OutdoorPvPSI::SpawnDustBags(uint32 resource, std::vector<uint32> const& allBags, std::set<uint32>& spawnedBags)
{
uint32 neededBags = resource / 15;
if (neededBags > spawnedBags.size())
{
for (auto const& dbGuid : allBags)
{
if (spawnedBags.find(dbGuid) == spawnedBags.end())
{
if (GetMap()->LoadGameObjectSpawn(dbGuid))
{
spawnedBags.insert(dbGuid);
if (spawnedBags.size() >= neededBags)
break;
}
}
}
}
}

void OutdoorPvPSI::ResetResourceCount()
{
m_Gathered_A = 0;
m_Gathered_H = 0;

for (auto const& dbGuid : m_allianceDustBags)
{
ObjectGuid guid = ObjectGuid(HIGHGUID_GAMEOBJECT, SI_DUST_BAG, dbGuid);
if (GameObject* pGo = GetMap()->GetGameObject(guid))
pGo->AddObjectToRemoveList();
}
m_allianceDustBags.clear();

for (auto const& dbGuid : m_hordeDustBags)
{
ObjectGuid guid = ObjectGuid(HIGHGUID_GAMEOBJECT, SI_DUST_BAG, dbGuid);
if (GameObject* pGo = GetMap()->GetGameObject(guid))
pGo->AddObjectToRemoveList();
}
m_hordeDustBags.clear();
}

bool OutdoorPvPSI::HandleAreaTrigger(Player* plr, uint32 trigger)
{
/** If the player doesn't have a silithyst */
Expand All @@ -109,12 +154,15 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* plr, uint32 trigger)
TeamApplyBuff(TEAM_ALLIANCE, SI_CENARION_FAVOR);
sWorld.SendZoneText(OutdoorPvPSIBuffZones[0], sObjectMgr.GetMangosStringForDBCLocale(LANG_OPVP_SI_CAPTURE_A));
m_LastController = ALLIANCE;
m_Gathered_A = 0;
m_Gathered_H = 0;
ResetResourceCount();
sLog.Out(LOG_BG, LOG_LVL_DETAIL, "[Silithus] Under Alliance control");
//sGameEventMgr.SetSilithusPVPEventCompleted(true);
//sGameEventMgr.UpdateSilithusPVP();
}
else
{
SpawnDustBags(m_Gathered_A, sAllianceDustBags, m_allianceDustBags);
}
// complete quest
plr->KilledMonsterCredit(SI_TURNIN_QUEST_CM_A, ObjectGuid());
}
Expand All @@ -130,12 +178,15 @@ bool OutdoorPvPSI::HandleAreaTrigger(Player* plr, uint32 trigger)
TeamApplyBuff(TEAM_HORDE, SI_CENARION_FAVOR);
sWorld.SendZoneText(OutdoorPvPSIBuffZones[0], sObjectMgr.GetMangosStringForDBCLocale(LANG_OPVP_SI_CAPTURE_H));
m_LastController = HORDE;
m_Gathered_A = 0;
m_Gathered_H = 0;
ResetResourceCount();
sLog.Out(LOG_BG, LOG_LVL_DETAIL, "[Silithus] Under Horde control");
//sGameEventMgr.SetSilithusPVPEventCompleted(true);
//sGameEventMgr.UpdateSilithusPVP();
}
else
{
SpawnDustBags(m_Gathered_H, sHordeDustBags, m_hordeDustBags);
}
// complete quest
plr->KilledMonsterCredit(SI_TURNIN_QUEST_CM_H, ObjectGuid());
}
Expand Down
9 changes: 7 additions & 2 deletions src/game/OutdoorPvP/OutdoorPvPSI.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ uint32 const SI_TURNIN_QUEST_CM_A = 17090;
uint32 const SI_TURNIN_QUEST_CM_H = 18199;
uint32 const SI_SILITHYST_MOUND = 181597;
uint32 const SI_SILITHYST_GEYSER = 181598;
uint32 const SI_DUST_BAG = 181962;

class OutdoorPvPSI : public OutdoorPvP
{
Expand All @@ -70,12 +71,16 @@ class OutdoorPvPSI : public OutdoorPvP

void UpdateWorldState();

private:
void ResetResourceCount();

void SpawnDustBags(uint32 resource, std::vector<uint32> const& allBags, std::set<uint32>& spawnedBags);

private:
std::set<uint32> m_allianceDustBags;
std::set<uint32> m_hordeDustBags;
uint32 m_Gathered_A;
uint32 m_Gathered_H;
uint32 m_MaxRessources;

uint32 m_LastController;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,6 @@ void instance_naxxramas::OnObjectCreate(GameObject* pGo)
case GO_PLAG_HEIG_ENTRY_DOOR:
UpdateAutomaticBossEntranceDoor(pGo, m_auiEncounter[TYPE_HEIGAN]);
break;
case GO_PLAG_HEIG_EXIT_DOOR:
case GO_PLAG_HEIG_OLD_EXIT_DOOR:
case GO_PLAG_LOAT_DOOR:
UpdateBossGate(pGo, m_auiEncounter[TYPE_HEIGAN]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ enum NaxxGOs : uint32
GO_ARAC_ANUB_DOOR = 181126, //encounter door - open on click after click auto open/close on encounter pull/kill/reset
GO_ARAC_ANUB_GATE = 181195, //open after boss is dead
GO_ARAC_FAER_WEB = 181235, //encounter door
GO_ARAC_FAER_DOOR = 194022, //after faerlina, to outer ring
GO_ARAC_FAER_DOOR = 181167, //after faerlina, to outer ring
GO_ARAC_MAEX_INNER_DOOR = 181197, //encounter door
GO_ARAC_MAEX_OUTER_DOOR = 181209, //right before maex

Expand Down
Loading