Compare commits

...

18 Commits

Author SHA1 Message Date
SaW
dc21abf03d
Merge 5c78a349443eb48508837bd5c1ff9ba5eaa8dbee into b80da061523e9b730a84c0776a4706d043abe785 2025-02-19 09:18:34 +08:00
55Honey
b80da06152
fix(Core/Auth): prevent expansion overflow in SendAuthResponse (#21503) 2025-02-18 20:41:11 +01:00
github-actions[bot]
86ee1a994c chore(DB): import pending files
Referenced commit(s): fca4ee32cde06aa42b4120e2540b16b52c165278
2025-02-18 17:50:05 +00:00
Rocco Silipo
fca4ee32cd
fix (DB/Creature) Alarmed Blightguards now spawn as they should. (#21489) 2025-02-18 18:49:00 +01:00
SaW
5c78a34944
Remove brackets for (Creature* cre : updateList) loop 2025-02-17 11:48:46 +01:00
SaW
e30602e27c
Update Map.cpp
Immediately continue if if (!player || !player->IsInWorld())
2025-02-16 23:39:38 +01:00
Kitzunu
18f2a0c736
Merge branch 'master' into mapdev 2025-02-16 23:12:53 +01:00
Kitzunu
c1036ddfb2
Merge branch 'master' into mapdev 2025-02-15 23:12:16 +01:00
SaW
cd1d52050d
Merge branch 'master' into mapdev 2025-02-15 11:38:55 +01:00
SaW
31d5530b29
Revert i_scriptLock 2025-02-11 18:30:03 +01:00
SaW
0ea1c61bd4
Revert i_scriptLock 2025-02-11 18:28:35 +01:00
SaW
15d628a00f
Revert i_scriptLock 2025-02-11 18:27:37 +01:00
SaW
2f597cbe74
Improve HasEnoughWater
Removes unnecessary function calls – Instead of fetching LiquidData and passing it to another function, do all the checks right here.
2025-01-30 19:01:36 +01:00
SaW
13620e5a2c
Merge branch 'master' into mapdev 2025-01-30 18:51:26 +01:00
SaW
0f1b8a75b2
Update Map.cpp 2025-01-28 21:15:34 +01:00
SaW
af3707c2ce
Codestyle 2025-01-28 21:11:12 +01:00
SaW
1fb40e4269
Update Map.cpp 2025-01-28 21:07:27 +01:00
SaW
8cfc306889
Change i_scriptLock to mutex and some general code improvements
Change i_scriptLock to mutex and some general code improvements
2025-01-28 20:43:18 +01:00
3 changed files with 64 additions and 45 deletions

View File

@ -0,0 +1,21 @@
-- DB update 2025_02_16_03 -> 2025_02_18_00
-- Remove Wrong Spawns
DELETE FROM `creature` WHERE `id1` = 28745;
-- Blight Cauldron Bunny 00 SmartAI
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 28739;
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 28739);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(28739, 0, 0, 1, 8, 0, 100, 0, 52227, 0, 0, 0, 0, 0, 11, 52228, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Blight Cauldron Bunny 00 - On Spellhit \'Dilute Blight Cauldron\' - Cast \'Kill Credit\''),
(28739, 0, 1, 2, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 52231, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Blight Cauldron Bunny 00 - On Spellhit \'Dilute Blight Cauldron\' - Cast \'Cauldron Diluted Effect\''),
(28739, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 12, 28745, 4, 30000, 0, 0, 0, 202, 20, 3, 1, 0, 0, 0, 0, 0, 'Blight Cauldron Bunny 00 - On Spellhit \'Dilute Blight Cauldron\' - Summon Creature \'Alarmed Blightguard\''),
(28739, 0, 3, 0, 1, 0, 100, 512, 30000, 30000, 30000, 30000, 0, 0, 28, 52231, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Blight Cauldron Bunny 00 - Out of Combat - Remove Aura \'Cauldron Diluted Effect\'');
-- Set Random Movement for Alarmed Blightguard
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 28745;
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 28745);
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(28745, 0, 0, 0, 25, 0, 100, 0, 0, 0, 0, 0, 0, 0, 89, 10, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Alarmed Blightguard - On Reset - Start Random Movement');

View File

@ -26,7 +26,12 @@ void WorldSession::SendAuthResponse(uint8 code, bool shortForm, uint32 queuePos)
packet << uint32(0); // BillingTimeRemaining packet << uint32(0); // BillingTimeRemaining
packet << uint8(0); // BillingPlanFlags packet << uint8(0); // BillingPlanFlags
packet << uint32(0); // BillingTimeRested packet << uint32(0); // BillingTimeRested
packet << uint8(Expansion()); // 0 - normal, 1 - TBC, 2 - WOTLK, must be set in database manually for each account uint8 exp = Expansion(); // 0 - normal, 1 - TBC, 2 - WOTLK, must be set in database manually for each account
if (exp >= MAX_EXPANSIONS)
exp = MAX_EXPANSIONS - 1;
packet << uint8(exp);
if (!shortForm) if (!shortForm)
{ {

View File

@ -588,16 +588,20 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
if (t_diff) if (t_diff)
_dynamicTree.update(t_diff); _dynamicTree.update(t_diff);
/// update worldsessions for existing players // Update world sessions and players
for (m_mapRefIter = m_mapRefMgr.begin(); m_mapRefIter != m_mapRefMgr.end(); ++m_mapRefIter) for (m_mapRefIter = m_mapRefMgr.begin(); m_mapRefIter != m_mapRefMgr.end(); ++m_mapRefIter)
{ {
Player* player = m_mapRefIter->GetSource(); Player* player = m_mapRefIter->GetSource();
if (player && player->IsInWorld()) if (player && player->IsInWorld())
{ {
//player->Update(t_diff); // Update session
WorldSession* session = player->GetSession(); WorldSession* session = player->GetSession();
MapSessionFilter updater(session); MapSessionFilter updater(session);
session->Update(s_diff, updater); session->Update(s_diff, updater);
// update players at tick
if (!t_diff)
player->Update(s_diff);
} }
} }
@ -605,17 +609,6 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
if (!t_diff) if (!t_diff)
{ {
for (m_mapRefIter = m_mapRefMgr.begin(); m_mapRefIter != m_mapRefMgr.end(); ++m_mapRefIter)
{
Player* player = m_mapRefIter->GetSource();
if (!player || !player->IsInWorld())
continue;
// update players at tick
player->Update(s_diff);
}
HandleDelayedVisibility(); HandleDelayedVisibility();
return; return;
} }
@ -624,36 +617,35 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
resetMarkedCells(); resetMarkedCells();
resetMarkedCellsLarge(); resetMarkedCellsLarge();
// Prepare object updaters
Acore::ObjectUpdater updater(t_diff, false); Acore::ObjectUpdater updater(t_diff, false);
// for creature // For creature
TypeContainerVisitor<Acore::ObjectUpdater, GridTypeMapContainer > grid_object_update(updater); TypeContainerVisitor<Acore::ObjectUpdater, GridTypeMapContainer> grid_object_update(updater);
// for pets
TypeContainerVisitor<Acore::ObjectUpdater, WorldTypeMapContainer > world_object_update(updater);
// for large creatures // For pets
TypeContainerVisitor<Acore::ObjectUpdater, WorldTypeMapContainer> world_object_update(updater);
// For large creatures
Acore::ObjectUpdater largeObjectUpdater(t_diff, true); Acore::ObjectUpdater largeObjectUpdater(t_diff, true);
TypeContainerVisitor<Acore::ObjectUpdater, GridTypeMapContainer > grid_large_object_update(largeObjectUpdater); TypeContainerVisitor<Acore::ObjectUpdater, GridTypeMapContainer> grid_large_object_update(largeObjectUpdater);
TypeContainerVisitor<Acore::ObjectUpdater, WorldTypeMapContainer > world_large_object_update(largeObjectUpdater); TypeContainerVisitor<Acore::ObjectUpdater, WorldTypeMapContainer> world_large_object_update(largeObjectUpdater);
// pussywizard: container for far creatures in combat with players // pussywizard: container for far creatures in combat with players
std::vector<Creature*> updateList; std::vector<Creature*> updateList;
updateList.reserve(10); updateList.reserve(10);
// non-player active objects, increasing iterator in the loop in case of object removal // Update non-player active objects
for (m_activeNonPlayersIter = m_activeNonPlayers.begin(); m_activeNonPlayersIter != m_activeNonPlayers.end();) for (m_activeNonPlayersIter = m_activeNonPlayers.begin(); m_activeNonPlayersIter != m_activeNonPlayers.end();)
{ {
WorldObject* obj = *m_activeNonPlayersIter; WorldObject* obj = *m_activeNonPlayersIter;
++m_activeNonPlayersIter; ++m_activeNonPlayersIter;
if (!obj || !obj->IsInWorld()) if (obj && obj->IsInWorld())
continue; VisitNearbyCellsOf(obj, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
VisitNearbyCellsOf(obj, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
} }
// the player iterator is stored in the map object // Update players and their associated objects
// to make sure calls to Map::Remove don't invalidate it
for (m_mapRefIter = m_mapRefMgr.begin(); m_mapRefIter != m_mapRefMgr.end(); ++m_mapRefIter) for (m_mapRefIter = m_mapRefMgr.begin(); m_mapRefIter != m_mapRefMgr.end(); ++m_mapRefIter)
{ {
Player* player = m_mapRefIter->GetSource(); Player* player = m_mapRefIter->GetSource();
@ -661,12 +653,10 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
if (!player || !player->IsInWorld()) if (!player || !player->IsInWorld())
continue; continue;
// update players at tick
player->Update(s_diff); player->Update(s_diff);
VisitNearbyCellsOfPlayer(player, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update); VisitNearbyCellsOfPlayer(player, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
// If player is using far sight, visit that object too // If player is using far sight, update viewpoint
if (WorldObject* viewPoint = player->GetViewpoint()) if (WorldObject* viewPoint = player->GetViewpoint())
{ {
if (Creature* viewCreature = viewPoint->ToCreature()) if (Creature* viewCreature = viewPoint->ToCreature())
@ -684,7 +674,8 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
{ {
updateList.clear(); updateList.clear();
float rangeSq = player->GetGridActivationRange() - 1.0f; float rangeSq = player->GetGridActivationRange() - 1.0f;
rangeSq = rangeSq * rangeSq; rangeSq *= rangeSq;
HostileReference* ref = player->getHostileRefMgr().getFirst(); HostileReference* ref = player->getHostileRefMgr().getFirst();
while (ref) while (ref)
{ {
@ -694,20 +685,20 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
updateList.push_back(cre); updateList.push_back(cre);
ref = ref->next(); ref = ref->next();
} }
for (std::vector<Creature*>::const_iterator itr = updateList.begin(); itr != updateList.end(); ++itr)
VisitNearbyCellsOf(*itr, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update); for (Creature* cre : updateList)
VisitNearbyCellsOf(cre, grid_object_update, world_object_update, grid_large_object_update, world_large_object_update);
} }
} }
for (_transportsUpdateIter = _transports.begin(); _transportsUpdateIter != _transports.end();) // pussywizard: transports updated after VisitNearbyCellsOf, grids around are loaded, everything ok // Update transports - pussywizard: transports updated after VisitNearbyCellsOf, grids around are loaded, everything ok
for (_transportsUpdateIter = _transports.begin(); _transportsUpdateIter != _transports.end();)
{ {
MotionTransport* transport = *_transportsUpdateIter; MotionTransport* transport = *_transportsUpdateIter;
++_transportsUpdateIter; ++_transportsUpdateIter;
if (!transport->IsInWorld()) if (transport->IsInWorld())
continue; transport->Update(t_diff);
transport->Update(t_diff);
} }
SendObjectUpdates(); SendObjectUpdates();
@ -1674,14 +1665,16 @@ bool Map::IsUnderWater(uint32 phaseMask, float x, float y, float z, float collis
bool Map::HasEnoughWater(WorldObject const* searcher, float x, float y, float z) const bool Map::HasEnoughWater(WorldObject const* searcher, float x, float y, float z) const
{ {
LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(searcher->GetPhaseMask(), x, y, z, searcher->GetCollisionHeight(), MAP_ALL_LIQUIDS); LiquidData const& liquidData = const_cast<Map*>(this)->GetLiquidData(
return (liquidData.Status & MAP_LIQUID_STATUS_SWIMMING) != 0 && HasEnoughWater(searcher, liquidData); searcher->GetPhaseMask(), x, y, z, searcher->GetCollisionHeight(), MAP_ALL_LIQUIDS);
}
if ((liquidData.Status & MAP_LIQUID_STATUS_SWIMMING) == 0)
return false;
bool Map::HasEnoughWater(WorldObject const* searcher, LiquidData const& liquidData) const
{
float minHeightInWater = searcher->GetMinHeightInWater(); float minHeightInWater = searcher->GetMinHeightInWater();
return liquidData.Level > INVALID_HEIGHT && liquidData.Level > liquidData.DepthLevel && liquidData.Level - liquidData.DepthLevel >= minHeightInWater; return liquidData.Level > INVALID_HEIGHT &&
liquidData.Level > liquidData.DepthLevel &&
liquidData.Level - liquidData.DepthLevel >= minHeightInWater;
} }
char const* Map::GetMapName() const char const* Map::GetMapName() const