public void Add(Mobile m) { var mi = this[m]; if (mi != null) { return; } var ns = m.NetState; Members.Add(new PartyMemberInfo(m)); m.Party = this; Span <byte> memberList = stackalloc byte[PartyPackets.GetPartyMemberListPacketLength(this)].InitializePacket(); Span <byte> attrsPacket = stackalloc byte[OutgoingMobilePackets.MobileAttributesPacketLength].InitializePacket(); for (var i = 0; i < Members.Count; ++i) { var f = Members[i].Mobile; PartyPackets.CreatePartyMemberList(memberList, this); f.NetState?.Send(memberList); if (f != m) { f.NetState.SendMobileStatusCompact(m, m.CanBeRenamedBy(f)); OutgoingMobilePackets.CreateMobileAttributes(attrsPacket, m, true); f.NetState?.Send(attrsPacket); ns.SendMobileStatusCompact(f, f.CanBeRenamedBy(m)); ns.SendMobileAttributes(f, true); } } }
public void Add(Mobile m) { var mi = this[m]; if (mi == null) { var ns = m.NetState; Members.Add(new PartyMemberInfo(m)); m.Party = this; var memberList = Packet.Acquire(new PartyMemberList(this)); Span <byte> attrsPacket = stackalloc byte[OutgoingMobilePackets.MobileAttributesPacketLength]; OutgoingMobilePackets.CreateMobileAttributes(attrsPacket, m, true); for (var i = 0; i < Members.Count; ++i) { var f = Members[i].Mobile; f.Send(memberList); if (f != m) { f.NetState.SendMobileStatusCompact(m, m.CanBeRenamedBy(f)); f.NetState?.Send(attrsPacket); ns.SendMobileStatusCompact(f, f.CanBeRenamedBy(m)); ns.SendMobileAttributes(f, true); } } Packet.Release(memberList); } }
protected override void OnTick() { var p = Get(m_Mobile); if (p == null) { return; } m_Mobile.SendLocalizedMessage(1005437); // You have rejoined the party. m_Mobile.Send(new PartyMemberList(p)); Span <byte> buffer = stackalloc byte[OutgoingMessagePackets.GetMaxMessageLocalizedAffixLength(m_Mobile.Name, "")]; buffer.InitializePacket(); Span <byte> attrsPacket = stackalloc byte[OutgoingMobilePackets.MobileAttributesPacketLength]; OutgoingMobilePackets.CreateMobileAttributes(attrsPacket, m_Mobile, true); var ns = m_Mobile.NetState; foreach (var mi in p.Members) { var m = mi.Mobile; if (m != m_Mobile) { if (buffer[0] == 0) { var length = OutgoingMessagePackets.CreateMessageLocalizedAffix( buffer, Serial.MinusOne, -1, MessageType.Label, 0x3B2, 3, 1008087, "", AffixType.Prepend | AffixType.System, m_Mobile.Name ); buffer = buffer.Slice(0, length); // Adjust to the actual size } m.NetState?.Send(buffer); m.NetState.SendMobileStatusCompact(m_Mobile, m_Mobile.CanBeRenamedBy(m)); m.NetState?.Send(attrsPacket); ns.SendMobileStatusCompact(m, m.CanBeRenamedBy(m_Mobile)); ns.SendMobileAttributes(m, true); } } }