ActionState ProcessAction(UnequipItemAction action) { if (this.ActionTicksUsed == 1) { var item = this.Inventory.FirstOrDefault(o => o.ObjectID == action.ItemID); if (CheckUnequipItem(item) == false) return ActionState.Fail; this.ActionTotalTicks = 10; return ActionState.Ok; } else if (this.ActionTicksUsed < this.ActionTotalTicks) { return ActionState.Ok; } else { var item = this.Inventory.FirstOrDefault(o => o.ObjectID == action.ItemID); if (CheckUnequipItem(item) == false) return ActionState.Fail; this.UnequipItem(item); var report = new UnequipItemActionReport(this, item); SendReport(report); return ActionState.Done; } }
private void RemoveButton_Click(object sender, RoutedEventArgs e) { foreach (ItemObject item in inventoryListBox.SelectedItems) { GameAction action; if (item.IsArmor || item.IsWeapon) { action = new UnequipItemAction(item); } else { continue; } AddAction(action); } }
ActionState ProcessAction(UnequipItemAction action) { if (this.ActionTicksUsed == 1) { var item = this.Inventory.FirstOrDefault(o => o.ObjectID == action.ItemID); if (CheckUnequipItem(item) == false) { return(ActionState.Fail); } this.ActionTotalTicks = 10; return(ActionState.Ok); } else if (this.ActionTicksUsed < this.ActionTotalTicks) { return(ActionState.Ok); } else { var item = this.Inventory.FirstOrDefault(o => o.ObjectID == action.ItemID); if (CheckUnequipItem(item) == false) { return(ActionState.Fail); } this.UnequipItem(item); var report = new UnequipItemActionReport(this, item); SendReport(report); return(ActionState.Done); } }
static void HandleRemoveItem(string str) { var living = GameData.Data.FocusedObject; var obs = living.Inventory.Where(o => o.IsEquipped); if (obs.Any() == false) { return; } var dlg = new ItemSelectorDialog(); dlg.Owner = App.Current.MainWindow; dlg.DataContext = obs; dlg.Title = "Remove Item"; var ret = dlg.ShowDialog(); if (ret.HasValue && ret.Value == true) { var ob = (ItemObject)dlg.SelectedItem; GameAction action; if (ob.IsArmor || ob.IsWeapon) { action = new UnequipItemAction(ob); } else { throw new Exception(); } action.GUID = new ActionGUID(living.World.PlayerID, 0); living.RequestAction(action); } }
private void RemoveButton_Click(object sender, RoutedEventArgs e) { foreach (ItemObject item in inventoryListBox.SelectedItems) { GameAction action; if (item.IsArmor || item.IsWeapon) action = new UnequipItemAction(item); else continue; AddAction(action); } }
static void HandleRemoveItem(string str) { var living = GameData.Data.FocusedObject; var obs = living.Inventory.Where(o => o.IsEquipped); if (obs.Any() == false) return; var dlg = new ItemSelectorDialog(); dlg.Owner = App.Current.MainWindow; dlg.DataContext = obs; dlg.Title = "Remove Item"; var ret = dlg.ShowDialog(); if (ret.HasValue && ret.Value == true) { var ob = (ItemObject)dlg.SelectedItem; GameAction action; if (ob.IsArmor || ob.IsWeapon) action = new UnequipItemAction(ob); else throw new Exception(); action.GUID = new ActionGUID(living.World.PlayerID, 0); living.RequestAction(action); } }
void RemoveItemHandler(object sender, ExecutedRoutedEventArgs e) { var living = m_mainWindow.FocusedObject; if (living == null) return; var obs = living.Inventory.OfType<ItemObject>().Where(o => o.IsEquipped); if (obs.Any() == false) return; var dlg = new ItemSelectorDialog(); dlg.Owner = m_mainWindow; dlg.DataContext = obs; dlg.Title = "Remove Item"; var ret = dlg.ShowDialog(); if (ret.HasValue && ret.Value == true) { var ob = dlg.SelectedItem; GameAction action; if (ob.IsArmor || ob.IsWeapon) action = new UnequipItemAction(ob); else throw new Exception(); action.MagicNumber = 1; living.RequestAction(action); } e.Handled = true; }
protected void Unequip(string slot) { var action = new UnequipItemAction(Entity, slot); action.OnProcess(); }