Exemplo n.º 1
0
        private void Add(CommandContext commandContext)
        {
            // find item in inventory
            var item = ItemHelper.FindInventoryItem(Session.Player, commandContext.ArgumentString);

            if (item == null)
            {
                Session.WriteLine("You don't have that item");
                return;
            }

            // add to traderitems
            Session.Player.Inventory.Remove(item.Key);
            _trade.AddItem(Session.Player.Key, item.Key);

            Session.WriteLine("You add {0} to the trade.", item.Name);
            _otherSession.WriteLine("{0} added {1} to the trade.", Session.Player.Forename, item.Name);

            ResetTradeApproval();
        }
Exemplo n.º 2
0
        public override void Execute(Session session, CommandContext context)
        {
            if (context.Arguments.Count == 0)
            {
                PerformLookAtRoom(session);
                return;
            }

            // todo: look at a directional exit

            var room = Server.Current.Database.Get <Room>(session.Player.Location);

            if (room == null)
            {
                session.WriteLine("Couldn't find anything to look at");
                return;
            }

            var player = room.LookUpPlayer(session.Player, context.ArgumentString);

            if (player != null)
            {
                if (realCommandName == "look")
                {
                    PerformLookAtPlayer(session, room, player);
                }
                else
                {
                    PerformExaminePlayer(session, room, player);
                }
                return;
            }

            var npc = room.LookUpNpc(context.ArgumentString);

            if (npc != null)
            {
                if (realCommandName == "look")
                {
                    PerformLookAtNpc(session, room, npc);
                }
                else
                {
                    PerformExamineNpc(session, room, npc);
                }
                return;
            }

            // find item to look at
            var item = ItemHelper.FindInventoryItem(session.Player, context.ArgumentString);

            if (item == null)
            {
                item = ItemHelper.FindFloorItem(room, context.ArgumentString);
            }

            if (item != null)
            {
                item.LookAt(session);
                return;
            }

            session.WriteLine("You couldn't find anything like that.");
        }