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; }
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; }
protected override GameAction PrepareNextActionOverride(out JobStatus progress) { var action = new DropItemAction(m_item); progress = JobStatus.Ok; return(action); }
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); } }
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); } }
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); } }
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); }
/// <summary> /// Initializes a new instance of the <see cref="DropItemHandler"/> class. /// </summary> public DropItemHandler() { this.dropAction = new DropItemAction(); }
protected override GameAction PrepareNextActionOverride(out JobStatus progress) { var action = new DropItemAction(m_item); progress = JobStatus.Ok; return action; }
protected void Drop(Entity item, int amount = 1) { var action = new DropItemAction(Entity, item, amount); action.OnProcess(); }