Пример #1
0
 public static void CloseCharacterTradeShopRequest(IRealmClient client, RealmPacketIn packet)
 {
     if (client.ActiveCharacter.PrivateShop == null)
     {
         Asda2PrivateShopHandler.SendCloseCharacterTradeShopToOwnerResponse(client,
                                                                            Asda2PrivateShopClosedToOwnerResult.Ok);
     }
     else
     {
         client.ActiveCharacter.PrivateShop.Exit(client.ActiveCharacter);
     }
 }
Пример #2
0
        public void Exit(Character activeCharacter)
        {
            if (activeCharacter == Owner)
            {
                using (RealmPacketOut shopToOwnerResponse =
                           Asda2PrivateShopHandler.CreateCloseCharacterTradeShopToOwnerResponse(
                               Asda2PrivateShopClosedToOwnerResult.HostClosedShop))
                {
                    foreach (Character joinedCharacter in JoinedCharacters)
                    {
                        joinedCharacter.Send(shopToOwnerResponse, false);
                        joinedCharacter.PrivateShop = null;
                        --joinedCharacter.Stunned;
                    }
                }

                JoinedCharacters.Clear();
                _joinedCharacters           = null;
                _itemsOnTrade               = null;
                activeCharacter.PrivateShop = null;
                activeCharacter.IsAsda2TradeDescriptionEnabled = false;
                activeCharacter.Asda2TradeDescription          = "";
                Asda2PrivateShopHandler.SendCloseCharacterTradeShopToOwnerResponse(activeCharacter.Client,
                                                                                   Asda2PrivateShopClosedToOwnerResult.Ok);
            }
            else
            {
                JoinedCharacters.Remove(activeCharacter);
                List <Character> characterList = new List <Character>
                {
                    Owner
                };
                characterList.AddRange(JoinedCharacters);
                using (RealmPacketOut notificationResponse =
                           Asda2PrivateShopHandler.CreatePrivateShopChatNotificationResponse(activeCharacter.AccId,
                                                                                             Asda2PrivateShopNotificationType.Left))
                {
                    foreach (Character character in characterList)
                    {
                        character.Send(notificationResponse, false);
                    }
                }

                --activeCharacter.Stunned;
                activeCharacter.PrivateShop = null;
                Asda2PrivateShopHandler.SendCloseCharacterTradeShopToOwnerResponse(activeCharacter.Client,
                                                                                   Asda2PrivateShopClosedToOwnerResult.Ok);
            }
        }