Skip to content
Closed
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
31 changes: 16 additions & 15 deletions src/server/game/Entities/Transport/Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,22 +532,23 @@ void Transport::UpdatePosition(float x, float y, float z, float o)

void Transport::LoadStaticPassengers()
{
if (uint32 mapId = GetGOInfo()->moTransport.mapID)
uint32 mapId = GetGOInfo()->moTransport.mapID;
if (!mapId)
return;

CellObjectGuidsMap const* cells = sObjectMgr->GetMapObjectGuids(mapId, GetMap()->GetSpawnMode());
if (!cells)
return;

for (auto const& [cellId, guids] : *cells)
{
CellObjectGuidsMap const& cells = sObjectMgr->GetMapObjectGuids(mapId, GetMap()->GetSpawnMode());
CellGuidSet::const_iterator guidEnd;
for (CellObjectGuidsMap::const_iterator cellItr = cells.begin(); cellItr != cells.end(); ++cellItr)
{
// Creatures on transport
guidEnd = cellItr->second.creatures.end();
for (CellGuidSet::const_iterator guidItr = cellItr->second.creatures.begin(); guidItr != guidEnd; ++guidItr)
CreateNPCPassenger(*guidItr, sObjectMgr->GetCreatureData(*guidItr));

// GameObjects on transport
guidEnd = cellItr->second.gameobjects.end();
for (CellGuidSet::const_iterator guidItr = cellItr->second.gameobjects.begin(); guidItr != guidEnd; ++guidItr)
CreateGOPassenger(*guidItr, sObjectMgr->GetGameObjectData(*guidItr));
}
// GameObjects on transport
for (ObjectGuid::LowType spawnId : guids.gameobjects)
CreateGOPassenger(spawnId, sObjectMgr->GetGameObjectData(spawnId));

// Creatures on transport
for (ObjectGuid::LowType spawnId : guids.creatures)
CreateNPCPassenger(spawnId, sObjectMgr->GetCreatureData(spawnId));
}
}

Expand Down
13 changes: 13 additions & 0 deletions src/server/game/Globals/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2338,6 +2338,19 @@ void ObjectMgr::LoadCreatures()
TC_LOG_INFO("server.loading", ">> Loaded {} creatures in {} ms", _creatureDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
}

CellObjectGuids const* ObjectMgr::GetCellObjectGuids(uint16 mapid, uint8 spawnMode, uint32 cell_id)
{
if (CellObjectGuidsMap const* mapGuids = Trinity::Containers::MapGetValuePtr(_mapObjectGuidsStore, MAKE_PAIR32(mapid, spawnMode)))
return Trinity::Containers::MapGetValuePtr(*mapGuids, cell_id);

return nullptr;
}

CellObjectGuidsMap const* ObjectMgr::GetMapObjectGuids(uint16 mapid, uint8 spawnMode)
{
return Trinity::Containers::MapGetValuePtr(_mapObjectGuidsStore, MAKE_PAIR32(mapid, spawnMode));
}

void ObjectMgr::AddCreatureToGrid(ObjectGuid::LowType guid, CreatureData const* data)
{
uint8 mask = data->spawnMask;
Expand Down
10 changes: 2 additions & 8 deletions src/server/game/Globals/ObjectMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1281,15 +1281,9 @@ class TC_GAME_API ObjectMgr
return nullptr;
}

CellObjectGuids const& GetCellObjectGuids(uint16 mapid, uint8 spawnMode, uint32 cell_id)
{
return _mapObjectGuidsStore[MAKE_PAIR32(mapid, spawnMode)][cell_id];
}
CellObjectGuids const* GetCellObjectGuids(uint16 mapid, uint8 spawnMode, uint32 cell_id);

CellObjectGuidsMap const& GetMapObjectGuids(uint16 mapid, uint8 spawnMode)
{
return _mapObjectGuidsStore[MAKE_PAIR32(mapid, spawnMode)];
}
CellObjectGuidsMap const* GetMapObjectGuids(uint16 mapid, uint8 spawnMode);

/**
* Gets temp summon data for all creatures of specified group.
Expand Down
8 changes: 4 additions & 4 deletions src/server/game/Grids/ObjectGridLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T>
void ObjectGridLoader::Visit(GameObjectMapType &m)
{
CellCoord cellCoord = i_cell.GetCellCoord();
CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cellCoord.GetId());
LoadHelper(cell_guids.gameobjects, cellCoord, m, i_gameObjects, i_map);
if (CellObjectGuids const* cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cellCoord.GetId()))
LoadHelper(cell_guids->gameobjects, cellCoord, m, i_gameObjects, i_map);
}

void ObjectGridLoader::Visit(CreatureMapType &m)
{
CellCoord cellCoord = i_cell.GetCellCoord();
CellObjectGuids const& cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cellCoord.GetId());
LoadHelper(cell_guids.creatures, cellCoord, m, i_creatures, i_map);
if (CellObjectGuids const* cell_guids = sObjectMgr->GetCellObjectGuids(i_map->GetId(), i_map->GetSpawnMode(), cellCoord.GetId()))
LoadHelper(cell_guids->creatures, cellCoord, m, i_creatures, i_map);
}

void ObjectWorldLoader::Visit(CorpseMapType& /*m*/)
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Maps/Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4438,7 +4438,7 @@ DynamicObject* Map::GetDynamicObject(ObjectGuid const& guid)

void Map::UpdateIteratorBack(Player* player)
{
if (m_mapRefIter == player->GetMapRef())
if (&*m_mapRefIter == &player->GetMapRef())
m_mapRefIter = m_mapRefIter->nocheck_prev();
}

Expand Down
11 changes: 4 additions & 7 deletions src/server/scripts/Custom/Solocraft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -492,23 +492,20 @@ class solocraft_player_instance_handler : public PlayerScript {
if (difficulty > 0)
{
// Announce to player - Buff
ss << "|cffFF0000[SoloCraft] |cffFF8000" << player->GetName() << " entered {} - Difficulty Offset: %0.2f. Spellpower Bonus: {}. Class Balance Weight: {}";
ChatHandler(player->GetSession()).PSendSysMessage(ss.str().c_str(), map->GetMapName(), difficulty, SpellPowerBonus, classBalance);
ChatHandler(player->GetSession()).PSendSysMessage("|cffFF0000[SoloCraft] |cffFF8000 Player: %s entered %s - Difficulty Offset: %f. Spellpower Bonus: %i. Class Balance Weight: %i.", player->GetName().c_str(), map->GetMapName(), difficulty, SpellPowerBonus, classBalance);
}
else
{
// Announce to player - Debuff
ss << "|cffFF0000[SoloCraft] |cffFF8000" << player->GetName() << " entered {} - |cffFF0000BE ADVISED - You have been debuffed by offset: %0.2f with a Class Balance Weight: {}. |cffFF8000 A group member already inside has the dungeon's full buff offset. No Spellpower buff will be applied to spell casters. ALL group members must exit the dungeon and re-enter to receive a balanced offset.";
ChatHandler(player->GetSession()).PSendSysMessage(ss.str().c_str(), map->GetMapName(), difficulty, classBalance);
ChatHandler(player->GetSession()).PSendSysMessage("|cffFF0000[SoloCraft] |cffFF8000 Player: %s entered %s - | cffFF0000BE ADVISED - You have been debuffed by offset : %f with a Class Balance Weight : %i. | cffFF8000 A group member already inside has the dungeon's full buff offset. No Spellpower buff will be applied to spell casters. ALL group members must exit the dungeon and re-enter to receive a balanced offset.", player->GetName().c_str(), map->GetMapName(), difficulty, classBalance);
}
// Save Player Dungeon Offsets to Database
CharacterDatabase.PExecute("REPLACE INTO custom_solocraft_character_stats (GUID, Difficulty, GroupSize, SpellPower, Stats) VALUES ({}, {}, {}, {}, {})", player->GetGUID(), difficulty, numInGroup, SpellPowerBonus, SoloCraftStatsMult);
}
else
{
// Announce to player - Over Max Level Threshold
ss << "|cffFF0000[SoloCraft] |cffFF8000" << player->GetName() << " entered {} - |cffFF0000You have not been buffed. |cffFF8000 Your level is higher than the max level ({}) threshold for this dungeon.";
ChatHandler(player->GetSession()).PSendSysMessage(ss.str().c_str(), map->GetMapName(), dunLevel + SolocraftLevelDiff);
ChatHandler(player->GetSession()).PSendSysMessage("|cffFF0000[SoloCraft] |cffFF8000 Player: %s entered %s - |cffFF0000You have not been buffed. |cffFF8000 Your level is higher than the max level (%u) threshold for this dungeon.", player->GetName().c_str(), map->GetMapName(), dunLevel + SolocraftLevelDiff);
ClearBuffs(player, map); //Check to revert player back to normal
}

Expand Down Expand Up @@ -558,7 +555,7 @@ class solocraft_player_instance_handler : public PlayerScript {
float StatsMultPct = (*result)[4].GetFloat();
// Inform the player
std::ostringstream ss;
ss << "|cffFF0000[SoloCraft] |cffFF8000" << player->GetName() << " exited to {} - Reverting Difficulty Offset: %0.2f. Spellpower Bonus Removed: {}";
ss << "|cffFF0000[SoloCraft] |cffFF8000" << player->GetName() << " exited to {} - Reverting Difficulty Offset: {}. Spellpower Bonus Removed: {}";
ChatHandler(player->GetSession()).PSendSysMessage(ss.str().c_str(), map->GetMapName(), difficulty, SpellPowerBonus);
// Clear the buffs
for (int32 i = STAT_STRENGTH; i < MAX_STATS; ++i)
Expand Down
10 changes: 0 additions & 10 deletions src/server/shared/Dynamic/LinkedList.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,6 @@ class LinkedListHead
bool operator==(Iterator const& _Right) const = default;
// test for iterator equality

bool operator==(pointer const& _Right) const
{ // test for pointer equality
return (_Ptr != _Right);
}

bool operator==(const_reference _Right) const
{ // test for reference equality
return (_Ptr == &_Right);
}

protected:
pointer _Ptr; // pointer to node
};
Expand Down