aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-07-14 17:28:48 +0200
committerShauren <shauren.trinity@gmail.com>2024-07-14 17:28:48 +0200
commita3aecbdd92000c3338aa14ecfcd3aaca91d99391 (patch)
tree7b77a61cba2fd27e478bc445b14a4a4b2cd57336 /src/server/game/Server
parentfbc18ff4202290470dbe5e153caf8a634f5bac6f (diff)
Core/PacketIO: Ported SMSG_GOSSIP_POI, CMSG_GROUP_INVITE and SMSG_GROUP_INVITE to packet classes
Diffstat (limited to 'src/server/game/Server')
-rw-r--r--src/server/game/Server/Packets/AllPackets.h1
-rw-r--r--src/server/game/Server/Packets/NPCPackets.cpp11
-rw-r--r--src/server/game/Server/Packets/NPCPackets.h15
-rw-r--r--src/server/game/Server/Packets/PartyPackets.cpp48
-rw-r--r--src/server/game/Server/Packets/PartyPackets.h62
-rw-r--r--src/server/game/Server/WorldSession.h9
6 files changed, 144 insertions, 2 deletions
diff --git a/src/server/game/Server/Packets/AllPackets.h b/src/server/game/Server/Packets/AllPackets.h
index 005b4884702..041ea5b7599 100644
--- a/src/server/game/Server/Packets/AllPackets.h
+++ b/src/server/game/Server/Packets/AllPackets.h
@@ -29,6 +29,7 @@
#include "MailPackets.h"
#include "MiscPackets.h"
#include "NPCPackets.h"
+#include "PartyPackets.h"
#include "PetPackets.h"
#include "QueryPackets.h"
#include "QuestPackets.h"
diff --git a/src/server/game/Server/Packets/NPCPackets.cpp b/src/server/game/Server/Packets/NPCPackets.cpp
index 1ecd91c8ef0..63acc6f1903 100644
--- a/src/server/game/Server/Packets/NPCPackets.cpp
+++ b/src/server/game/Server/Packets/NPCPackets.cpp
@@ -45,6 +45,17 @@ WorldPacket const* WorldPackets::NPC::TrainerList::Write()
return &_worldPacket;
}
+WorldPacket const* WorldPackets::NPC::GossipPOI::Write()
+{
+ _worldPacket << int32(Flags);
+ _worldPacket << Pos;
+ _worldPacket << int32(Icon);
+ _worldPacket << int32(Importance);
+ _worldPacket << Name;
+
+ return &_worldPacket;
+}
+
void WorldPackets::NPC::TrainerBuySpell::Read()
{
_worldPacket >> TrainerGUID;
diff --git a/src/server/game/Server/Packets/NPCPackets.h b/src/server/game/Server/Packets/NPCPackets.h
index 9b8d1933fb7..32eee60fba3 100644
--- a/src/server/game/Server/Packets/NPCPackets.h
+++ b/src/server/game/Server/Packets/NPCPackets.h
@@ -20,6 +20,7 @@
#include "Packet.h"
#include "ObjectGuid.h"
+#include "Position.h"
#include <array>
namespace WorldPackets
@@ -67,6 +68,20 @@ namespace WorldPackets
std::string Greeting;
};
+ class GossipPOI final : public ServerPacket
+ {
+ public:
+ GossipPOI() : ServerPacket(SMSG_GOSSIP_POI, 4 + 4 + 4 + 4 + 4 + 32) { }
+
+ WorldPacket const* Write() override;
+
+ uint32 Flags = 0;
+ TaggedPosition<Position::XY> Pos;
+ int32 Icon = 0;
+ int32 Importance = 0;
+ std::string Name;
+ };
+
class TrainerBuySpell final : public ClientPacket
{
public:
diff --git a/src/server/game/Server/Packets/PartyPackets.cpp b/src/server/game/Server/Packets/PartyPackets.cpp
new file mode 100644
index 00000000000..087b4532002
--- /dev/null
+++ b/src/server/game/Server/Packets/PartyPackets.cpp
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "PartyPackets.h"
+#include "Player.h"
+
+void WorldPackets::Party::PartyInviteClient::Read()
+{
+ _worldPacket >> TargetName;
+ _worldPacket >> ProposedRoles;
+}
+
+WorldPacket const* WorldPackets::Party::PartyInvite::Write()
+{
+ _worldPacket << uint8(CanAccept);
+ _worldPacket << InviterName;
+ _worldPacket << uint32(ProposedRoles);
+ _worldPacket << uint8(LfgSlots.size());
+ if (!LfgSlots.empty())
+ _worldPacket.append(LfgSlots.data(), LfgSlots.size());
+
+ _worldPacket << uint32(LfgCompletedMask);
+
+ return &_worldPacket;
+}
+
+void WorldPackets::Party::PartyInvite::Initialize(Player const* inviter, uint32 proposedRoles, bool canAccept)
+{
+ CanAccept = canAccept;
+
+ InviterName = inviter->GetName();
+
+ ProposedRoles = proposedRoles;
+}
diff --git a/src/server/game/Server/Packets/PartyPackets.h b/src/server/game/Server/Packets/PartyPackets.h
new file mode 100644
index 00000000000..fbce8fdc254
--- /dev/null
+++ b/src/server/game/Server/Packets/PartyPackets.h
@@ -0,0 +1,62 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef PartyPackets_h__
+#define PartyPackets_h__
+
+#include "Packet.h"
+
+class Player;
+
+namespace WorldPackets
+{
+ namespace Party
+ {
+ class PartyInviteClient final : public ClientPacket
+ {
+ public:
+ PartyInviteClient(WorldPacket&& packet) : ClientPacket(CMSG_GROUP_INVITE, std::move(packet)) { }
+
+ void Read() override;
+
+ uint32 ProposedRoles = 0;
+ std::string TargetName;
+ };
+
+ class PartyInvite final : public ServerPacket
+ {
+ public:
+ PartyInvite() : ServerPacket(SMSG_GROUP_INVITE, 55) { }
+
+ WorldPacket const* Write() override;
+
+ void Initialize(Player const* inviter, uint32 proposedRoles, bool canAccept);
+
+ bool CanAccept = false;
+
+ // Inviter
+ std::string InviterName;
+
+ // Lfg
+ uint32 ProposedRoles = 0;
+ uint32 LfgCompletedMask = 0;
+ std::vector<uint32> LfgSlots;
+ };
+ }
+}
+
+#endif // PartyPackets_h__
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 843a2565cd5..54ef82b4f26 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -207,6 +207,11 @@ namespace WorldPackets
class TrainerBuySpell;
}
+ namespace Party
+ {
+ class PartyInviteClient;
+ }
+
namespace Pet
{
class DismissCritter;
@@ -577,7 +582,7 @@ class TC_GAME_API WorldSession
void AddInstanceEnterTime(uint32 instanceId, SystemTimePoint enterTime);
void UpdateInstanceEnterTimes();
//auction
- void SendAuctionHello(ObjectGuid guid, Creature* unit);
+ void SendAuctionHello(ObjectGuid guid, Unit const* unit);
void SendAuctionCommandResult(uint32 auctionItemId, AuctionAction command, AuctionError errorCode, InventoryResult bagResult = InventoryResult(0));
void SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint32 bidSum, uint32 diff, uint32 item_template);
void SendAuctionOwnerNotification(AuctionEntry* auction);
@@ -774,7 +779,7 @@ class TC_GAME_API WorldSession
void HandleBattlefieldStatusOpcode(WorldPacket& recvData);
- void HandleGroupInviteOpcode(WorldPacket& recvPacket);
+ void HandleGroupInviteOpcode(WorldPackets::Party::PartyInviteClient& packet);
void HandleGroupAcceptOpcode(WorldPacket& recvPacket);
void HandleGroupDeclineOpcode(WorldPacket& recvPacket);
void HandleGroupUninviteOpcode(WorldPacket& recvPacket);