예제 #1
0
 public static void Exec(ClientInfo _cInfo, EntityPlayer _player)
 {
     if (GameManager.Instance.World.Players.dict.Count > 1)
     {
         foreach (KeyValuePair <int, EntityPlayer> player in GameManager.Instance.World.Players.dict)
         {
             if (_player.entityId != player.Value.entityId)
             {
                 if (_player.partyInvites != null && _player.partyInvites.Contains(player.Value))
                 {
                     return;
                 }
                 PersistentPlayerData ppd2 = PersistentOperations.GetPersistentPlayerDataFromEntityId(player.Key);
                 if (ppd2 != null)
                 {
                     if (PersistentContainer.Instance.Players[ppd2.UserIdentifier.CombinedString].AutoPartyInvite != null &&
                         PersistentContainer.Instance.Players[ppd2.UserIdentifier.CombinedString].AutoPartyInvite.Count > 0)
                     {
                         List <string[]> autoInvites = PersistentContainer.Instance.Players[ppd2.UserIdentifier.CombinedString].AutoPartyInvite;
                         for (int i = 0; i < autoInvites.Count; i++)
                         {
                             if (autoInvites[i][0] == _cInfo.entityId.ToString())
                             {
                                 PersistentPlayerData ppd1 = PersistentOperations.GetPersistentPlayerDataFromEntityId(_player.entityId);
                                 if (ppd1 != null && ppd1.ACL.Contains(ppd2.UserIdentifier) && ppd2.ACL.Contains(ppd1.UserIdentifier))
                                 {
                                     EntityPlayer player2 = player.Value;
                                     if ((player2.IsInParty() && player2.IsPartyLead() == player2 && player2.Party != null && player2.Party.MemberList.Count < Constants.cMaxPartySize) || !player2.IsInParty())
                                     {
                                         _player.AddPartyInvite(player.Key);
                                         _cInfo.SendPackage(NetPackageManager.GetPackage <NetPackagePartyActions>().Setup(NetPackagePartyActions.PartyActions.SendInvite, player.Key, _player.entityId, null));
                                         Phrases.Dict.TryGetValue("AutoPartyInvite7", out string phrase);
                                         phrase = phrase.Replace("{PlayerName}", player2.EntityName);
                                         ChatHook.ChatMessage(_cInfo, Config.Chat_Response_Color + phrase + "[-]", -1, Config.Server_Response_Name, EChatType.Whisper, null);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }