Ejemplo n.º 1
0
        public void Dissmiss(Character dissmiser, uint targetAccId)
        {
            lock (this)
            {
                if (dissmiser != this.Owner || (int)dissmiser.EntityId.Low == (int)targetAccId)
                {
                    dissmiser.SendInfoMsg("You are not chat room owner.");
                    ChatMgr.SendDissmisedFromCharRoomResultResponse(dissmiser.Client,
                                                                    DissmissCharacterFromChatRoomResult.Fail);
                }

                if (!this.Members.ContainsKey(targetAccId))
                {
                    dissmiser.SendInfoMsg("Target not founded.");
                    ChatMgr.SendDissmisedFromCharRoomResultResponse(dissmiser.Client,
                                                                    DissmissCharacterFromChatRoomResult.Fail);
                }

                Character member = this.Members[targetAccId];
                ChatMgr.SendChatRoomEventResponse(this, ChatRoomEventType.Banned, member);
                member.ChatRoom = (Asda2Chatroom)null;
                this.Members.Remove(targetAccId);
                ChatMgr.SendChatRoomClosedResponse(member.Client, ChatRoomClosedStatus.Banned);
                ChatMgr.SendDissmisedFromCharRoomResultResponse(dissmiser.Client,
                                                                DissmissCharacterFromChatRoomResult.Ok);
            }
        }
Ejemplo n.º 2
0
 public void Leave(Character leaver)
 {
     lock (this)
     {
         Members.Remove(leaver.AccId);
     }
     leaver.ChatRoom = null;
     ChatMgr.SendChatRoomEventResponse(this, ChatRoomEventType.Left, leaver);
     if (Owner == leaver && Members.Count > 0)
     {
         Owner = Members.Values.First();
         ChatMgr.SendChatRoomEventResponse(this, ChatRoomEventType.LeaderChanged, Owner);
         ChatMgr.SendChatRoomVisibleResponse(Owner, ChatRoomVisibilityStatus.Visible, this);
     }
     ChatMgr.SendChatRoomVisibleResponse(leaver, ChatRoomVisibilityStatus.Closed, null);
 }
Ejemplo n.º 3
0
        public void Leave(Character leaver)
        {
            lock (this)
                this.Members.Remove(leaver.AccId);
            leaver.ChatRoom = (Asda2Chatroom)null;
            ChatMgr.SendChatRoomEventResponse(this, ChatRoomEventType.Left, leaver);
            if (this.Owner == leaver && this.Members.Count > 0)
            {
                this.Owner = this.Members.Values.First <Character>();
                ChatMgr.SendChatRoomEventResponse(this, ChatRoomEventType.LeaderChanged, this.Owner);
                ChatMgr.SendChatRoomVisibleResponse(this.Owner, ChatRoomVisibilityStatus.Visible, this,
                                                    (Character)null);
            }

            ChatMgr.SendChatRoomVisibleResponse(leaver, ChatRoomVisibilityStatus.Closed, (Asda2Chatroom)null,
                                                (Character)null);
        }
Ejemplo n.º 4
0
 public void TryJoin(Character joiner, string password)
 {
     if (MaxMembersCount <= Members.Count)
     {
         ChatMgr.SendEnterChatRoomResultResponse(joiner.Client, EnterChatRoomStatus.RoomisFull, null);
         return;
     }
     if (IsPrivate && password != Password)
     {
         ChatMgr.SendEnterChatRoomResultResponse(joiner.Client, EnterChatRoomStatus.WrongPassword, null);
         return;
     }
     lock (this)
     {
         Members.Add(joiner.AccId, joiner);
     }
     joiner.ChatRoom = this;
     ChatMgr.SendChatRoomEventResponse(this, ChatRoomEventType.Joined, joiner);
     ChatMgr.SendEnterChatRoomResultResponse(joiner.Client, EnterChatRoomStatus.Ok, this);
 }
Ejemplo n.º 5
0
 public void TryJoin(Character joiner, string password)
 {
     if ((int)this.MaxMembersCount <= this.Members.Count)
     {
         ChatMgr.SendEnterChatRoomResultResponse(joiner.Client, EnterChatRoomStatus.RoomisFull,
                                                 (Asda2Chatroom)null);
     }
     else if (this.IsPrivate && password != this.Password)
     {
         ChatMgr.SendEnterChatRoomResultResponse(joiner.Client, EnterChatRoomStatus.WrongPassword,
                                                 (Asda2Chatroom)null);
     }
     else
     {
         lock (this)
             this.Members.Add(joiner.AccId, joiner);
         joiner.ChatRoom = this;
         ChatMgr.SendChatRoomEventResponse(this, ChatRoomEventType.Joined, joiner);
         ChatMgr.SendEnterChatRoomResultResponse(joiner.Client, EnterChatRoomStatus.Ok, this);
     }
 }
Ejemplo n.º 6
0
 public void Dissmiss(Character dissmiser, uint targetAccId)
 {
     lock (this)
     {
         if (dissmiser != Owner || dissmiser.EntityId.Low == targetAccId)
         {
             dissmiser.SendInfoMsg("You are not chat room owner.");
             ChatMgr.SendDissmisedFromCharRoomResultResponse(dissmiser.Client, DissmissCharacterFromChatRoomResult.Fail);
         }
         if (!Members.ContainsKey(targetAccId))
         {
             dissmiser.SendInfoMsg("Target not founded.");
             ChatMgr.SendDissmisedFromCharRoomResultResponse(dissmiser.Client, DissmissCharacterFromChatRoomResult.Fail);
         }
         var target = Members[targetAccId];
         ChatMgr.SendChatRoomEventResponse(this, ChatRoomEventType.Banned, target);
         target.ChatRoom = null;
         Members.Remove(targetAccId);
         ChatMgr.SendChatRoomClosedResponse(target.Client, ChatRoomClosedStatus.Banned);
         ChatMgr.SendDissmisedFromCharRoomResultResponse(dissmiser.Client, DissmissCharacterFromChatRoomResult.Ok);
     }
 }