Exemple #1
0
 public void DeclineInvite(Character decliner)
 {
     if (Invites.ContainsKey(decliner.ID))
     {
         _log.Debug($"Invite to party {partyId} has been declined by {decliner.ID}");
         Invites.Remove(decliner.ID);
         leader.SendPacket(PartyPacket.PartyErrorWithName(PartyFunction.INVITE_REJECTED, decliner.Name));
     }
     else
     {
         Program.MainForm.LogAppend("Trying to decline party invite while no invite exists. CharacterID: {0}, party ID {1}", decliner.ID, partyId);
     }
 }
Exemple #2
0
        public void Chat(int chatter, string text)
        {
            PartyMember chr = GetById(chatter);

            if (members.Count(e => e?.IsOnline ?? false) <= 1)
            {
                chr.SendPacket(PartyPacket.NoneOnline());
            }
            else
            {
                // Send to all other members
                ForAllMembers(m => m.SendPacket(PartyPacket.PartyChat(chr.name, text, 1)), chatter);
            }
        }
Exemple #3
0
        public void UpdateDoor(DoorInformation newDoor, int charId)
        {
            Program.MainForm.LogDebug("UPDATING DOOR: " + charId);
            var member = GetById(charId);

            if (member != null)
            {
                member.door = newDoor;
                int idx = GetCharacterSlot(member);
                ForAllMembers(m => { if (m.GetChannel() == member.GetChannel())
                                     {
                                         m.SendPacket(PartyPacket.UpdateDoor(newDoor, (byte)idx));
                                     }
                              });
            }
        }
Exemple #4
0
        private void UpdateAllDoors()
        {
            var mems  = members.Where(m => m != null);
            var doors = mems.Select(m => m.door);

            foreach (var door in doors.ToList())
            {
                var doorOwner = GetById(door.OwnerId);
                foreach (var m in mems.ToList())
                {
                    var idx = (byte)GetCharacterSlot(door.OwnerId);
                    if (m.GetMap() == door.DstMap && m.GetChannel() == doorOwner.GetChannel())
                    {
                        m.SendPacket(PartyPacket.UpdateDoor(door, idx));
                    }
                }
            }
        }
Exemple #5
0
        private void Join(Character chr)
        {
            var slot = GetFirstFreeSlot();

            if (slot == -1)
            {
                _log.Error($"Trying to join the party, but the free slot is -1??? Party {partyId} Character {chr.ID}");
                return;
            }

            _log.Debug($"{chr.ID} joins the party {partyId} under slot {slot}");

            chr.PartyID = partyId;
            var member = new PartyMember(chr.ID, chr.Name, false);

            members[slot] = member;

            ForAllMembers(m => m.SendPacket(PartyPacket.JoinParty(member, this)));
            member.SendHpUpdate();
            SendUpdatePartyData();
            UpdateAllDoors();
        }
Exemple #6
0
        public void SendHpUpdate()
        {
            Character chr = GetCharacter(true);

            if (chr != null)
            {
                CenterServer.Instance.World.GameServers[chr.ChannelID].Connection.SendPacket(PartyPacket.RequestHpUpdate(chr.ID));
            }
        }