public void ParsePacket(ref PacketBufferReader p) { byte code = p.ReadByte(); bool partyGiga487 = false; bool add = false; byte count = 0; switch (code) { case 1: add = true; if (!partyGiga487) { goto case 2; //giga487, trovo molto confuso questa parte di codice, la riscrivo. } else { count = p.ReadByte(); if (count <= 1) { } for (int i = 0; i < count; i++) { uint serial = p.ReadUInt(); //InsertPartyElement(serial, wme.Name); //inserisce l'elemento del party libero Members[i] = new PartyMember(serial); } } break; case 2: count = p.ReadByte(); if (count <= 1) //se ho 2 elementi e ne rimuovo uno { Leader = 0; Inviter = 0; for (int i = 0; i < PARTY_SIZE; i++) { if (Members[i] == null || Members[i].Serial == 0) { break; } BaseHealthBarGump gump = UIManager.GetGump <BaseHealthBarGump>(Members[i].Serial); if (gump != null) { if (code == 2) { Members[i].Serial = 0; } gump.RequestUpdateContents(); } } Clear(); UIManager.GetGump <PartyGump>()?.RequestUpdateContents(); break; } Clear(); uint to_remove = 0xFFFF_FFFF; if (!add) { to_remove = p.ReadUInt(); UIManager.GetGump <BaseHealthBarGump>(to_remove)?.RequestUpdateContents(); } bool remove_all = !add && to_remove == World.Player; int done = 0; for (int i = 0; i < count; i++) { uint serial = p.ReadUInt(); bool remove = !add && serial == to_remove; if (remove && serial == to_remove && i == 0) { remove_all = true; } if (!remove && !remove_all) { if (!Contains(serial)) { Members[i] = new PartyMember(serial); } done++; } if (i == 0 && !remove && !remove_all) { Leader = serial; } BaseHealthBarGump gump = UIManager.GetGump <BaseHealthBarGump>(serial); if (gump != null) { gump.RequestUpdateContents(); } else { if (serial == World.Player) { } } } if (done <= 1 && !add) { for (int i = 0; i < PARTY_SIZE; i++) { if (Members[i] != null && SerialHelper.IsValid(Members[i].Serial)) { uint serial = Members[i].Serial; Members[i] = null; UIManager.GetGump <BaseHealthBarGump>(serial)?.RequestUpdateContents(); } } Clear(); } UIManager.GetGump <PartyGump>()?.RequestUpdateContents(); NetClient.Socket.Send(new PQueryPartyPosition()); break; case 3: case 4: /* questo รจ il messaggio di chat */ uint ser = p.ReadUInt(); string name = p.ReadUnicode(); for (int i = 0; i < PARTY_SIZE; i++) { if (Members[i] != null && Members[i].Serial == ser) { MessageManager.HandleMessage ( null, name, Members[i].Name, ProfileManager.CurrentProfile.PartyMessageHue, MessageType.Party, 3, TextType.GUILD_ALLY ); break; } } break; case 7: Inviter = p.ReadUInt(); if (ProfileManager.CurrentProfile.PartyInviteGump) { UIManager.Add(new PartyInviteGump(Inviter)); } break; } }
public void ParsePacket(Packet p) { byte code = p.ReadByte(); bool add = false; switch (code) { case 1: add = true; goto case 2; case 2: byte count = p.ReadByte(); if (count <= 1) { Leader = 0; Inviter = 0; for (int i = 0; i < PARTY_SIZE; i++) { if (Members[i] == null || Members[i].Serial == 0) { break; } BaseHealthBarGump gump = UIManager.GetGump <BaseHealthBarGump>(Members[i].Serial); if (gump != null) { if (code == 2) { Members[i].Serial = 0; } gump.RequestUpdateContents(); } } Clear(); UIManager.GetGump <PartyGump>()?.RequestUpdateContents(); break; } Clear(); uint to_remove = 0xFFFF_FFFF; if (!add) { to_remove = p.ReadUInt(); UIManager.GetGump <BaseHealthBarGump>(to_remove)?.RequestUpdateContents(); } bool remove_all = !add && to_remove == World.Player; int done = 0; for (int i = 0; i < count; i++) { uint serial = p.ReadUInt(); bool remove = !add && (/*count <= 2 || */ serial == to_remove); if (remove && serial == to_remove && i == 0) { remove_all = true; } if (!remove && !remove_all) { if (!Contains(serial)) { Members[i] = new PartyMember(serial); } done++; } if (i == 0 && !remove && !remove_all) { Leader = serial; } BaseHealthBarGump gump = UIManager.GetGump <BaseHealthBarGump>(serial); if (gump != null) { gump.RequestUpdateContents(); } else { if (serial == World.Player) { } } } if (done <= 1 && !add) { for (int i = 0; i < PARTY_SIZE; i++) { if (Members[i] != null && SerialHelper.IsValid(Members[i].Serial)) { uint serial = Members[i].Serial; Members[i] = null; UIManager.GetGump <BaseHealthBarGump>(serial)?.RequestUpdateContents(); } } Clear(); } UIManager.GetGump <PartyGump>()?.RequestUpdateContents(); break; case 3: case 4: uint ser = p.ReadUInt(); string name = p.ReadUnicode(); for (int i = 0; i < PARTY_SIZE; i++) { if (Members[i] != null && Members[i].Serial == ser) { MessageManager.HandleMessage(null, name, Members[i].Name, ProfileManager.Current.PartyMessageHue, MessageType.Party, 3, TEXT_TYPE.SYSTEM); break; } } break; case 7: Inviter = p.ReadUInt(); if (ProfileManager.Current.PartyInviteGump) { UIManager.Add(new PartyInviteGump(Inviter)); } break; } }
public void ParsePacket(Packet p) { byte code = p.ReadByte(); bool add = false; switch (code) { case 1: add = true; goto case 2; case 2: byte count = p.ReadByte(); if (count <= 1) { Leader = 0; Inviter = 0; for (int i = 0; i < PARTY_SIZE; i++) { if (Members[i] == null || Members[i].Serial == 0) { break; } BaseHealthBarGump gump = UIManager.GetGump <BaseHealthBarGump>(Members[i].Serial); if (gump != null) { if (code == 2) { Members[i].Serial = 0; } gump.Update(); } } Clear(); UIManager.GetGump <PartyGump>()?.Update(); break; } Clear(); if (!add) { UIManager.GetGump <BaseHealthBarGump>(p.ReadUInt())?.Update(); } for (int i = 0; i < count; i++) { uint serial = p.ReadUInt(); Members[i] = new PartyMember(serial); if (i == 0) { Leader = serial; } BaseHealthBarGump gump = UIManager.GetGump <BaseHealthBarGump>(serial); if (gump != null) { GameActions.RequestMobileStatus(serial); gump.Update(); } else { if (serial == World.Player) { } } } UIManager.GetGump <PartyGump>()?.Update(); break; case 3: case 4: uint ser = p.ReadUInt(); string name = p.ReadUnicode(); for (int i = 0; i < PARTY_SIZE; i++) { if (Members[i] != null && Members[i].Serial == ser) { Chat.HandleMessage(null, name, Members[i].Name, ProfileManager.Current.PartyMessageHue, MessageType.Party, 3); break; } } break; case 7: Inviter = p.ReadUInt(); if (ProfileManager.Current.PartyInviteGump) { UIManager.Add(new PartyInviteGump(Inviter)); } break; } }