Пример #1
0
        public static void OnTradeRequest(WorldClient client, INetPacketStream packet)
        {
            var tradePacket = new TradeRequestPacket(packet);
            var tradeEvent  = new TradeRequestEventArgs(tradePacket.Target);

            client.Player.NotifySystem <TradeSystem>(tradeEvent);
        }
Пример #2
0
        /// <summary>
        /// Send a new trade request
        /// </summary>
        /// <param name="player"></param>
        /// <param name="e"></param>
        private static void TradeRequest(IPlayerEntity player, TradeRequestEventArgs e)
        {
            Logger.Debug("Trade request");

            if (e.TargetId == player.Id)
            {
                throw new RhisisSystemException($"Can't start a Trade with ourselve ({player.Object.Name})");
            }

            if (IsTrading(player))
            {
                throw new RhisisSystemException($"Can't start a Trade when one is already in progress ({player.Object.Name})");
            }

            var target = GetEntityFromContextOf(player, e.TargetId);

            if (IsTrading(target))
            {
                throw new RhisisSystemException($"Can't start a Trade when one is already in progress ({target.Object.Name})");
            }

            WorldPacketFactory.SendTradeRequest(target, player.Id);
        }