Exemplo n.º 1
0
        public void Start(Character player1, Character player2)
        {
            var request = new TradeRequest();

            player1.TradeManager.Request = request;
            player2.TradeManager.Request = request;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Starts trade between 2 players.
        /// </summary>
        private void StartTrade(Character player1, Character player2)
        {
            var request = new TradeRequest();

            player1.TradeRequest = request;
            player2.TradeRequest = request;

            SendTradeStart(player1.Client, player1.TradePartner.Id);
            SendTradeStart(player2.Client, player2.TradePartner.Id);
        }
Exemplo n.º 3
0
        private void ClearTrade()
        {
            PartnerId = 0;

            if (Request is null)
            {
                return;
            }

            foreach (var key in Request.TradeItems.Keys.Where(x => x.CharacterId == _ownerId).ToList())
            {
                Request.TradeItems.TryRemove(key, out var itm);
            }

            Request.TradeMoney.TryRemove(_ownerId, out var m);

            if (Request.TradeItems.IsEmpty && Request.TradeMoney.IsEmpty)
            {
                Request = null;
            }
        }