Ejemplo n.º 1
0
        public void AddFriend(string name, bool blocked = false)
        {
            CharacterInfo info = Envir.GetCharacterInfo(name);

            if (info == null)
            {
                ReceiveChat("Player doesn't exist", ChatType.System);
                return;
            }

            if (Name == name)
            {
                ReceiveChat("Cannot add yourself", ChatType.System);
                return;
            }

            if (Info.Friends.Any(e => e.Index == info.Index))
            {
                ReceiveChat("Player already added", ChatType.System);
                return;
            }

            FriendInfo friend = new FriendInfo(info, blocked);

            Info.Friends.Add(friend);

            GetFriends();
        }
Ejemplo n.º 2
0
        public void AddFriend(int index)
        {
            CharacterInfo info = Envir.GetCharacterInfo(index);

            if (info == null) return;

            if (Info.Friends.Any(e => e.CharacterIndex == index)) return;

            FriendInfo friend = new FriendInfo(index);

            Info.Friends.Add(friend);
        }