Esempio n. 1
0
 public void Invite(int invitor, int invitee) => OnlyWithLeader(invitor, ldr =>
 {
     var toInvite = CenterServer.Instance.FindCharacter(invitee);
     if (toInvite == null)
     {
         ldr.SendPacket(PartyPacket.PartyError(PartyFunction.UNABLE_TO_FIND_PLAYER));
     }
     else if (Invites.ContainsKey(toInvite.ID))
     {
         ldr.SendPacket(PartyPacket.PartyErrorWithName(PartyFunction.INVITE_USER_ALREADY_HAS_INVITE, toInvite.Name));
     }
     else if (toInvite.PartyID != 0)
     {
         ldr.SendPacket(PartyPacket.PartyError(PartyFunction.JOIN_ALREADY_JOINED));
     }
     else if (IsFull())
     {
         ldr.SendPacket(PartyPacket.PartyError(PartyFunction.JOIN_ALREADY_FULL));
     }
     else
     {
         _log.Debug($"Sending invite from party {partyId} from character {invitor} to {invitee}");
         toInvite.SendPacket(PartyPacket.PartyInvite(this));
         Invites.Add(toInvite.ID, this);
         //TODO do invites expire?
     }
 });
Esempio n. 2
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);
     }
 }