Beispiel #1
0
        private void ExchangeMoveKamas(string data, GameClient receiverClient, Exchange exchangeSession)
        {
            if (_client.Character.State != Character.CharacterState.OnExchange) return;

            var kamas = int.Parse(data);

            if (_client.Character.Kamas >= kamas)
                exchangeSession.AddKamas(_client.Character, kamas, _client, receiverClient);
        }
Beispiel #2
0
        private void ExchangeMoveObject(string data, GameClient receiverClient, Exchange exchangeSession)
        {
            if (_client.Character.State != Character.CharacterState.OnExchange) return;

            var state = data[0];
            var itemId = int.Parse(data.Substring(1).Split('|')[0]);
            var quantity = int.Parse(data.Substring(1).Split('|')[1]);

            var item =
                DatabaseProvider.InventoryItems.Find(
                    x => x.Character == _client.Character && x.Id == itemId && x.Quantity >= quantity);

            if (item == null) return;

            if (item.ItemPosition != StatsManager.Position.None) return;

            switch (state)
            {
                case '+':
                    exchangeSession.AddItem(_client.Character, item, quantity, _client, receiverClient);
                    break;
                case '-':
                    exchangeSession.RemoveItem(_client.Character, item, quantity, _client, receiverClient);
                    break;
            }
        }
Beispiel #3
0
 public static void CloseExchangeSession(Exchange exchange)
 {
     lock (Exchanges)
         Exchanges.Remove(exchange);
 }