mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Packets Fix SMSG_START_TIMER struct & update to new packet system (#22614)
This commit is contained in:
@@ -411,16 +411,16 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
// Send packet every 10 seconds until the 2nd field reach 0
|
||||
if (m_CountdownTimer >= 10000)
|
||||
{
|
||||
uint32 countdownMaxForBGType = isArena() ? ARENA_COUNTDOWN_MAX : BATTLEGROUND_COUNTDOWN_MAX;
|
||||
int32 countdownMaxForBGType = isArena() ? ARENA_COUNTDOWN_MAX : BATTLEGROUND_COUNTDOWN_MAX;
|
||||
|
||||
WorldPacket data(SMSG_START_TIMER, 4+4+4);
|
||||
data << uint32(0); // unk
|
||||
data << uint32(countdownMaxForBGType - (GetElapsedTime() / 1000));
|
||||
data << uint32(countdownMaxForBGType);
|
||||
WorldPackets::Misc::StartTimer startTimer;
|
||||
startTimer.Type = 0;
|
||||
startTimer.TimeLeft = countdownMaxForBGType - (GetElapsedTime() / 1000);
|
||||
startTimer.TotalTime = countdownMaxForBGType;
|
||||
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (Player* player = ObjectAccessor::FindPlayer(itr->first))
|
||||
player->SendDirectMessage(&data);
|
||||
player->SendDirectMessage(startTimer.Write());
|
||||
|
||||
m_CountdownTimer = 0;
|
||||
}
|
||||
@@ -1088,11 +1088,12 @@ void Battleground::AddPlayer(Player* player)
|
||||
player->CastSpell(player, SPELL_PREPARATION, true); // reduces all mana cost of spells.
|
||||
|
||||
int32 countdownMaxForBGType = isArena() ? ARENA_COUNTDOWN_MAX : BATTLEGROUND_COUNTDOWN_MAX;
|
||||
WorldPacket data(SMSG_START_TIMER, 4+4+4);
|
||||
data << uint32(0); // unk
|
||||
data << uint32(countdownMaxForBGType - (GetElapsedTime() / 1000));
|
||||
data << uint32(countdownMaxForBGType);
|
||||
player->SendDirectMessage(&data);
|
||||
|
||||
WorldPackets::Misc::StartTimer startTimer;
|
||||
startTimer.Type = 0;
|
||||
startTimer.TimeLeft = countdownMaxForBGType - (GetElapsedTime() / 1000);
|
||||
startTimer.TotalTime = countdownMaxForBGType;
|
||||
player->SendDirectMessage(startTimer.Write());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -699,3 +699,12 @@ void WorldPackets::Misc::CloseInteraction::Read()
|
||||
{
|
||||
_worldPacket >> SourceGuid;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::StartTimer::Write()
|
||||
{
|
||||
_worldPacket << int32(TimeLeft);
|
||||
_worldPacket << int32(TotalTime);
|
||||
_worldPacket << int32(Type);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -902,6 +902,18 @@ namespace WorldPackets
|
||||
|
||||
ObjectGuid SourceGuid;
|
||||
};
|
||||
|
||||
class StartTimer final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
StartTimer() : ServerPacket(SMSG_START_TIMER, 12) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 Type = 0;
|
||||
int32 TimeLeft = 0;
|
||||
int32 TotalTime = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1821,7 +1821,7 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_START_ELAPSED_TIMERS, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_START_LOOT_ROLL, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_START_MIRROR_TIMER, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_START_TIMER, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_START_TIMER, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_STOP_ELAPSED_TIMER, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_STOP_MIRROR_TIMER, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_STOP_SPEAKERBOT_SOUND, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
|
||||
Reference in New Issue
Block a user