MCPcopy Create free account
hub / github.com/crossuo/crossuo / ParsePacketData

Method ParsePacketData

src/Party.cpp:63–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63void CParty::ParsePacketData(CDataReader &reader)
64{
65 uint8_t code = reader.ReadUInt8();
66
67 switch (code)
68 {
69 case 1: //Add member
70 {
71 }
72 case 2: //Remove member
73 {
74 uint8_t count = reader.ReadUInt8();
75
76 if (count <= 1)
77 {
78 Leader = 0;
79 Inviter = 0;
80 for (int i = 0; i < 10; i++)
81 {
82 CPartyObject &member = Member[i];
83 if (member.Character == nullptr)
84 {
85 break;
86 }
87 CGumpStatusbar *gump = (CGumpStatusbar *)g_GumpManager.UpdateContent(
88 member.Character->Serial, 0, GT_STATUSBAR);
89 if (gump != nullptr)
90 {
91 gump->WantRedraw = true;
92 }
93 }
94 Clear();
95 g_GumpManager.UpdateContent(0, 0, GT_PARTY_MANIFEST);
96 break;
97 }
98 Clear();
99 CPoint2Di oldPos = g_MouseManager.Position;
100 CPoint2Di mousePos(76, 30);
101 g_MouseManager.Position = mousePos;
102 CGumpStatusbar *prevGump = nullptr;
103
104 for (int i = 0; i < count; i++)
105 {
106 uint32_t serial = reader.ReadUInt32BE();
107 Member[i].Serial = serial;
108 Member[i].Character = g_World->FindWorldCharacter(serial);
109 if (i == 0)
110 {
111 g_Party.Leader = serial;
112 }
113
114 CGumpStatusbar *gump =
115 (CGumpStatusbar *)g_GumpManager.UpdateContent(serial, 0, GT_STATUSBAR);
116
117 if (gump == nullptr)
118 {
119 g_Game.OpenStatus(serial);
120 gump = (CGumpStatusbar *)g_GumpManager.UpdateContent(serial, 0, GT_STATUSBAR);

Callers 1

PACKET_HANDLERFunction · 0.80

Calls 13

ClearFunction · 0.85
str_fromFunction · 0.85
ReadUInt8Method · 0.80
ReadUInt32BEMethod · 0.80
FindWorldCharacterMethod · 0.80
OpenStatusMethod · 0.80
AddStatusbarMethod · 0.80
ReadWStringBEMethod · 0.80
CreateTextMessageMethod · 0.80
UpdateContentMethod · 0.45
SendMethod · 0.45

Tested by

no test coverage detected