void DropItemHandler(object sender, ExecutedRoutedEventArgs e)
        {
            var living = m_mainWindow.FocusedObject;

            if (living == null)
                return;

            var dlg = new ItemSelectorDialog();
            dlg.Owner = m_mainWindow;
            dlg.DataContext = living.Inventory;
            dlg.Title = "Drop Item";

            var ret = dlg.ShowDialog();

            if (ret.HasValue && ret.Value == true)
            {
                var ob = dlg.SelectedItem;

                var action = new DropItemAction(ob);
                action.MagicNumber = 1;
                living.RequestAction(action);
            }

            e.Handled = true;
        }
Exemplo n.º 2
0
        ActionState ProcessAction(DropItemAction action)
        {
            if (this.ActionTicksUsed == 1)
                this.ActionTotalTicks = 1;

            if (this.Environment == null)
            {
                SendFailReport(new DropItemActionReport(this, null), "no environment");
                return ActionState.Fail;
            }

            if (this.ActionTicksUsed < this.ActionTotalTicks)
                return ActionState.Ok;

            var item = this.World.FindObject<ItemObject>(action.ItemID);

            if (CheckDropItemAction(item) == false)
                return ActionState.Fail;

            if (item.MoveTo(this.Environment, this.Location) == false)
            {
                SendFailReport(new DropItemActionReport(this, item), "failed to move");
                return ActionState.Fail;
            }

            if (this.CarriedItem == item)
                this.CarriedItem = null;

            SendReport(new DropItemActionReport(this, item));

            return ActionState.Done;
        }
Exemplo n.º 3
0
        protected override GameAction PrepareNextActionOverride(out JobStatus progress)
        {
            var action = new DropItemAction(m_item);

            progress = JobStatus.Ok;
            return(action);
        }
Exemplo n.º 4
0
        private void DropButton_Click(object sender, RoutedEventArgs e)
        {
            if (inventoryListBox.SelectedItems.Count == 0)
                return;

            foreach (ItemObject item in inventoryListBox.SelectedItems)
            {
                var action = new DropItemAction(item);
                AddAction(action);
            }
        }
Exemplo n.º 5
0
        private void DropButton_Click(object sender, RoutedEventArgs e)
        {
            if (inventoryListBox.SelectedItems.Count == 0)
            {
                return;
            }

            foreach (ItemObject item in inventoryListBox.SelectedItems)
            {
                var action = new DropItemAction(item);
                AddAction(action);
            }
        }
Exemplo n.º 6
0
        static void HandleDropItem(string str)
        {
            var living = GameData.Data.FocusedObject;

            var dlg = new ItemSelectorDialog();

            dlg.Owner       = App.Current.MainWindow;
            dlg.DataContext = living.Inventory;
            dlg.Title       = "Drop Item";

            var ret = dlg.ShowDialog();

            if (ret.HasValue && ret.Value == true)
            {
                var ob = (ItemObject)dlg.SelectedItem;

                var action = new DropItemAction(ob);
                action.GUID = new ActionGUID(living.World.PlayerID, 0);
                living.RequestAction(action);
            }
        }
Exemplo n.º 7
0
        ActionState ProcessAction(DropItemAction action)
        {
            if (this.ActionTicksUsed == 1)
            {
                this.ActionTotalTicks = 1;
            }

            if (this.Environment == null)
            {
                SendFailReport(new DropItemActionReport(this, null), "no environment");
                return(ActionState.Fail);
            }

            if (this.ActionTicksUsed < this.ActionTotalTicks)
            {
                return(ActionState.Ok);
            }

            var item = this.World.FindObject <ItemObject>(action.ItemID);

            if (CheckDropItemAction(item) == false)
            {
                return(ActionState.Fail);
            }

            if (item.MoveTo(this.Environment, this.Location) == false)
            {
                SendFailReport(new DropItemActionReport(this, item), "failed to move");
                return(ActionState.Fail);
            }

            if (this.CarriedItem == item)
            {
                this.CarriedItem = null;
            }

            SendReport(new DropItemActionReport(this, item));

            return(ActionState.Done);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DropItemHandler"/> class.
 /// </summary>
 public DropItemHandler()
 {
     this.dropAction = new DropItemAction();
 }
Exemplo n.º 9
0
        static void HandleDropItem(string str)
        {
            var living = GameData.Data.FocusedObject;

            var dlg = new ItemSelectorDialog();
            dlg.Owner = App.Current.MainWindow;
            dlg.DataContext = living.Inventory;
            dlg.Title = "Drop Item";

            var ret = dlg.ShowDialog();

            if (ret.HasValue && ret.Value == true)
            {
                var ob = (ItemObject)dlg.SelectedItem;

                var action = new DropItemAction(ob);
                action.GUID = new ActionGUID(living.World.PlayerID, 0);
                living.RequestAction(action);
            }
        }
Exemplo n.º 10
0
 protected override GameAction PrepareNextActionOverride(out JobStatus progress)
 {
     var action = new DropItemAction(m_item);
     progress = JobStatus.Ok;
     return action;
 }
Exemplo n.º 11
0
        protected void Drop(Entity item, int amount = 1)
        {
            var action = new DropItemAction(Entity, item, amount);

            action.OnProcess();
        }