Exemple #1
0
        ActionState ProcessAction(EquipItemAction action)
        {
            if (this.ActionTicksUsed == 1)
            {
                var item = this.Inventory.FirstOrDefault(o => o.ObjectID == action.ItemID);

                if (CheckEquipItem(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 (CheckEquipItem(item) == false)
                    return ActionState.Fail;

                this.EquipItem(item);

                var report = new EquipItemActionReport(this, item);
                SendReport(report);

                return ActionState.Done;
            }
        }
Exemple #2
0
 private void WearButton_Click(object sender, RoutedEventArgs e)
 {
     foreach (ItemObject item in inventoryListBox.SelectedItems)
     {
         var action = new EquipItemAction(item);
         AddAction(action);
     }
 }
Exemple #3
0
    protected override void CopyTo(ClubPenguin.Actions.Action _destWarper)
    {
        EquipItemAction equipItemAction = _destWarper as EquipItemAction;

        equipItemAction.TargetBoneName    = TargetBoneName;
        equipItemAction.ItemPrefab        = ItemPrefab;
        equipItemAction.StoreExistingProp = StoreExistingProp;
        base.CopyTo(_destWarper);
    }
    private void AddStackedItemButton(ItemCollector itemCollector, ItemType type, int quantity, int offset)
    {
        GameObject btn = Instantiate(itemButtonPrefab, itemsDisplay.transform);

        btn.transform.position -= new Vector3(0.0f, offset * buttonOffset, 0.0f);
        btn.GetComponentInChildren <Text>().text = type.ToString() + "(" + quantity.ToString() + ")";

        if (ItemRegistry.GetItemPropsForType(type).Equipable)
        {
            btn.GetComponent <Button>().interactable = true;
            EquipItemAction btnClick = btn.GetComponent <EquipItemAction>();
            btnClick.SetItem(itemCollector.GetFirstItemOfType(type));
            btnClick.SetItemEquipper(itemEquipper);
        }
        else
        {
            btn.GetComponent <Button>().interactable = false;
        }
    }
    private void AddItemButton(IItem item, int offset)
    {
        GameObject btn = Instantiate(itemButtonPrefab, itemsDisplay.transform);

        btn.transform.position -= new Vector3(0.0f, offset * buttonOffset, 0.0f);
        btn.GetComponentInChildren <Text>().text = item.Type.ToString();

        if (item.Properties.Equipable)
        {
            btn.GetComponent <Button>().interactable = true;
            EquipItemAction btnClick = btn.GetComponent <EquipItemAction>();
            btnClick.SetItem(item);
            btnClick.SetItemEquipper(itemEquipper);
        }
        else
        {
            btn.GetComponent <Button>().interactable = false;
        }
    }
Exemple #6
0
        static void HandleWearItem(string str)
        {
            var living = GameData.Data.FocusedObject;

            var obs = living.Inventory
                      .Where(o => ((o.IsArmor || o.IsWeapon) && o.IsEquipped == false));

            if (obs.Any() == false)
            {
                return;
            }

            var dlg = new ItemSelectorDialog();

            dlg.Owner       = App.Current.MainWindow;
            dlg.DataContext = obs;
            dlg.Title       = "Wear/Wield 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 EquipItemAction(ob);
                }
                else
                {
                    throw new Exception();
                }
                action.GUID = new ActionGUID(living.World.PlayerID, 0);
                living.RequestAction(action);
            }
        }
Exemple #7
0
        ActionState ProcessAction(EquipItemAction action)
        {
            if (this.ActionTicksUsed == 1)
            {
                var item = this.Inventory.FirstOrDefault(o => o.ObjectID == action.ItemID);

                if (CheckEquipItem(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 (CheckEquipItem(item) == false)
                {
                    return(ActionState.Fail);
                }

                this.EquipItem(item);

                var report = new EquipItemActionReport(this, item);
                SendReport(report);

                return(ActionState.Done);
            }
        }
 private void WearButton_Click(object sender, RoutedEventArgs e)
 {
     foreach (ItemObject item in inventoryListBox.SelectedItems)
     {
         var action = new EquipItemAction(item);
         AddAction(action);
     }
 }
        static void HandleWearItem(string str)
        {
            var living = GameData.Data.FocusedObject;

            var obs = living.Inventory
                .Where(o => ((o.IsArmor || o.IsWeapon) && o.IsEquipped == false));

            if (obs.Any() == false)
                return;

            var dlg = new ItemSelectorDialog();
            dlg.Owner = App.Current.MainWindow;
            dlg.DataContext = obs;
            dlg.Title = "Wear/Wield 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 EquipItemAction(ob);
                else
                    throw new Exception();
                action.GUID = new ActionGUID(living.World.PlayerID, 0);
                living.RequestAction(action);
            }
        }
        void WearItemHandler(object sender, ExecutedRoutedEventArgs e)
        {
            var living = m_mainWindow.FocusedObject;

            if (living == null)
                return;

            var obs = living.Inventory.OfType<ItemObject>()
                .Where(o => ((o.IsArmor || o.IsWeapon) && o.IsEquipped == false));

            if (obs.Any() == false)
                return;

            var dlg = new ItemSelectorDialog();
            dlg.Owner = m_mainWindow;
            dlg.DataContext = obs;
            dlg.Title = "Wear/Wield Item";

            var ret = dlg.ShowDialog();

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

                GameAction action;
                if (ob.IsArmor || ob.IsWeapon)
                    action = new EquipItemAction(ob);
                else
                    throw new Exception();
                action.MagicNumber = 1;
                living.RequestAction(action);
            }

            e.Handled = true;
        }
        private void WearButton_Click(object sender, RoutedEventArgs e)
        {
            var living = (LivingObject)this.DataContext;

            foreach (ItemObject item in inventoryListBox.SelectedItems)
            {
                var action = new EquipItemAction(item);
                AddAction(action);
            }
        }
Exemple #12
0
        protected void Equip(string slot, Entity item)
        {
            var action = new EquipItemAction(Entity, item, slot, true);

            action.OnProcess();
        }