コード例 #1
0
ファイル: UnequipItem.cs プロジェクト: tomba/dwarrowdelf
        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;
            }
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
ファイル: UnequipItem.cs プロジェクト: jaenudin86/dwarrowdelf
        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);
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
        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;
        }
コード例 #8
0
ファイル: EquipItemHelper.cs プロジェクト: qmhoang/SKR
        protected void Unequip(string slot)
        {
            var action = new UnequipItemAction(Entity, slot);

            action.OnProcess();
        }