Example #1
0
    public AT.Battle.Unequip BattleUnequip(EquipmentSlotType t)
    {
        AT.Battle.Unequip action = new AT.Battle.Unequip(InventoryView.instance.CurrentActor);
        (action.ActionOptions [0] as EquipmentSlotTypeOption).chosenChoice = new EquipmentSlotTypeChoice(t);

        return(action);
    }
Example #2
0
    void SetDollPreviewSprite(Image img, Equipment e, EquipmentSlotType type)
    {
        if (e == null)
        {
            img.sprite = null;
        }
        else
        {
            if (type == EquipmentSlotType.OFF_HAND && e is GenericWeapon)
            {
                img.sprite = EquipmentAnimationDispenser.instance.GetPaperDollSpriteByName((e as GenericWeapon).OffhandAnimationControllerName);
//				img.transform.localScale = new Vector3 (-1f, 1f, 1f);
            }
            else
            {
                img.sprite = EquipmentAnimationDispenser.instance.GetPaperDollSpriteByName(e.AnimationControllerName);
//				img.transform.localScale = new Vector3 (1f, 1f, 1f);
            }
        }


        if (img.sprite == null)
        {
            img.color = new Color(1f, 1f, 1f, 0f);
        }
        else
        {
            img.color = new Color(1f, 1f, 1f, 1f);
        }
    }
            public override void Perform()
            {
                CallOnBegan();

                Debug.LogError("AM I AN INTERACTION uunnnnnnEQUOPISD???!! " + IsInteraction);



                EquipmentSlotTypeOption slotopt    = ActionOptions [0] as EquipmentSlotTypeOption;
                EquipmentSlotTypeChoice slotchoice = slotopt.chosenChoice as EquipmentSlotTypeChoice;
                EquipmentSlotType       targetSlot = slotchoice.slotType;

                //if there's already an item on the slot, remove it, and get the slot it's currently on, and the item.
                Equipment unequipped = actor.CharSheet.PaperDoll.EquippedOn(targetSlot);

                if (unequipped != null)
                {
                    Debug.LogError("unequipps");
                    actor.CharSheet.Unequip(unequipped);
                }

                actor.CharSheet.inventory.AddItem(unequipped);


                CallOnFinished();
            }
Example #4
0
    public EquipmentSlotData GetEquipmentSlot(EquipmentSlotType type)
    {
        switch (type)
        {
        case EquipmentSlotType.Head:
            return(head);

        case EquipmentSlotType.LeftArm:
            return(leftArm);

        case EquipmentSlotType.Legs:
            return(legs);

        case EquipmentSlotType.Feet:
            return(feet);

        case EquipmentSlotType.RightArm:
            return(rightArm);

        case EquipmentSlotType.Torso:
            return(torso);

        default:
            return(null);
        }
    }
Example #5
0
 public void Handle(ItemEquipMessage message)
 {
     if (message.Type == ItemEquipMessage.EventType.Equip)
     {
         lastEquippedSlotType = message.EqSlotType;
     }
 }
Example #6
0
 public AT.Battle.Equip BattleEquip(InventoryItem i, EquipmentSlotType t)
 {
     AT.Battle.Equip action = new AT.Battle.Equip(InventoryView.instance.CurrentActor);
     (action.ActionOptions [0] as ItemsOnPersonOption).chosenChoice     = new InventoryItemChoice(i);
     (action.ActionOptions [1] as EquipmentSlotTypeOption).chosenChoice = new EquipmentSlotTypeChoice(t);
     return(action);
 }
Example #7
0
        public Equipment EquippedOn(EquipmentSlotType eqSlot)
        {
            Equipment e = null;

            if (slots.TryGetValue(eqSlot, out e))
            {
                return(e);
            }
            return(null);
        }
Example #8
0
    public void EquipItem(Equipment equipment)
    {
        if (equipment == null)
        {
            return;
        }
        EquipmentSlotType slotType = GetSlotForItem(equipment.EquipmentBase.EquipmentType);

        EquipItem(slotType, equipment);
    }
Example #9
0
    public List <Entity.EquipmentSlot> GetEquipmentSlotsForSlotType(EquipmentSlotType slotType)
    {
        if (!_slotDictionary.ContainsKey(slotType))
        {
            Debug.Log($@"Invalid Equipment Slot Type: {slotType}");
            return(null);
        }

        return(_slotDictionary[slotType]);
    }
Example #10
0
    public void Equip(EquipmentSlotType slotType, ScriptableItem itemToEquip)
    {
        GetSlot(slotType).equipmentSlot.Equip(itemToEquip);

        // @ Animator Updates
        GetComponent <Animator>().SetBool(Constants.IS_DUAL_WIELDING, IsDualWielding());

        // @ Notify subscribed scripts
        EquipEvent.Invoke();
    }
    private void ClearAnimation(EquipmentSlotType slot)
    {
        Animator anim = AnimatorFromEquipmentType(slot);
        EquipmentAnimatorMapping map = MappingFromEquipmentType(slot);

        map.current = EquipmentAnimationControllerName.NOT_SET;

        anim.runtimeAnimatorController = null;
        anim.GetComponent <SpriteRenderer> ().sprite = null;
    }
Example #12
0
            public override void Perform()
            {
                CallOnBegan();

//			Debug.LogError ("AM I AN INTERACTION EQUOPISD???!! " + IsInteraction);


                ItemsOnPersonOption itemopt    = ActionOptions [0] as ItemsOnPersonOption;
                InventoryItemChoice itemchoice = itemopt.chosenChoice as InventoryItemChoice;
                Equipment           equipment  = itemchoice.item as Equipment;

                EquipmentSlotTypeOption slotopt    = ActionOptions [1] as EquipmentSlotTypeOption;
                EquipmentSlotTypeChoice slotchoice = slotopt.chosenChoice as EquipmentSlotTypeChoice;
                EquipmentSlotType       targetSlot = slotchoice.slotType;

                //if there's already an item on the slot, remove it, and get the slot it's currently on, and the item.
                Equipment unequipped = actor.CharSheet.PaperDoll.EquippedOn(targetSlot);

                if (unequipped != null)
                {
                    actor.CharSheet.Unequip(unequipped);
                }

                if (actor.CharSheet.inventory.ListOfItems().Contains(itemchoice.item as Equipment))
                {
                    //then remove the item from inventory
                    actor.CharSheet.inventory.RemoveItem(itemchoice.item);
                    if (unequipped != null)
                    {
                        actor.CharSheet.inventory.AddItem(unequipped);
                    }
                }
                else
                {
                    //Assume the item is on the paper doll.
                    EquipmentSlotType fromSlot = actor.CharSheet.PaperDoll.SlotFor(itemchoice.item as Equipment);
                    actor.CharSheet.Unequip(itemchoice.item as Equipment);

                    //try to equip the item unequipped on the fromSlot
                    if (unequipped.FittingSlotTypes.Contains(fromSlot))
                    {
                        actor.CharSheet.Equip(fromSlot, unequipped);
                    }
                    else
                    {
                        actor.CharSheet.inventory.AddItem(unequipped);
                    }
                }

                actor.CharSheet.Equip(targetSlot, itemchoice.item as Equipment);



                CallOnFinished();
            }
Example #13
0
    public void Unequip(EquipmentSlotType slot)
    {
        if (CanUnequip(slot) != CanUnequipStatus.Yes)
        {
            return;
        }
        ItemData unequippedItem = equipmentData.GetEquipmentSlot(slot).Item;

        Add(unequippedItem);
        equipmentData.Unequip(slot);
    }
Example #14
0
 public EquipmentSlotCombination GetSlotCombinationWithSecondarySlot(EquipmentSlotType secondarySlot)
 {
     foreach (var slotCombination in slotCombinations)
     {
         if (slotCombination.SecondarySlots.Contains(secondarySlot))
         {
             return(slotCombination);
         }
     }
     return(null);
 }
 public EquipmentAnimatorMapping MappingFromEquipmentType(EquipmentSlotType t)
 {
     foreach (EquipmentAnimatorMapping map in animators)
     {
         if (map.type == t)
         {
             return(map);
         }
     }
     return(null);
 }
Example #16
0
 public EquipmentSlotCombination GetSlotCombination(EquipmentSlotType primarySlot)
 {
     foreach (var slotCombination in slotCombinations)
     {
         if (slotCombination.PrimarySlot == primarySlot)
         {
             return(slotCombination);
         }
     }
     return(null);
 }
Example #17
0
    public Slot GetSlot(EquipmentSlotType slotType)
    {
        Slot slot = slots.Find(entry => entry.type == slotType);

        if (slot != null)
        {
            return(slot);
        }

        return(null);
    }
 public void SetLockStatus(EquipmentSlotType est, bool locked)
 {
     if (locked && !LockedSlots.Contains(est))
     {
         LockedSlots.Add(est);
     }
     else if (!locked && LockedSlots.Contains(est))
     {
         LockedSlots.Remove(est);
     }
 }
    public void UnequippedUpdateMapping(Sheet s, EquipmentSlotType slotType, Equipment e)
    {
        EquipmentAnimatorMapping map = MappingFromEquipmentType(slotType);

        if (map != null)           //can be null if the slot type is not a weapon, body, or head gear type as of 04/2017
//			Debug.Log(slotType + ": will remove");
        {
            ClearAnimation(slotType);
            RefreshAnimations();
        }
    }
 public void SetMappingName(EquipmentSlotType t, EquipmentAnimationControllerName name)
 {
     foreach (EquipmentAnimatorMapping map in animators)
     {
         if (map.type == t)
         {
             map.current = name;
             break;
         }
     }
 }
Example #21
0
    public void Unequip(EquipmentSlotType slotType)
    {
        EquipmentSlot slot = GetSlot(slotType).equipmentSlot;

        slot.Unequip();

        // @ Animator Updates
        GetComponent <Animator>().SetBool(Constants.IS_DUAL_WIELDING, IsDualWielding());

        // @ Notify subscribed scripts
        UnequipEvent.Invoke();
    }
Example #22
0
    public EquipmentSlot GetSlot(EquipmentSlotType type)
    {
        foreach (EquipmentSlot slot in EquipmentSlots)
        {
            if (slot.GetSlotType() == type)
            {
                return(slot);
            }
        }

        return(null);
    }
    public void EquippedUpdateMapping(Sheet s, EquipmentSlotType slotType, Equipment e)
    {
        EquipmentAnimatorMapping map = MappingFromEquipmentType(slotType);

        if (map != null)           //can be null if the slot type is not a weapon, body, or head gear type as of 04/2017
//			Debug.Log(slotType + ": will add!");
        {
            map.animator = AnimatorFromEquipmentType(slotType);
            map.current  = e.AnimationControllerName;
            RefreshAnimations();
        }
    }
Example #24
0
 public bool DeepEquals(InventoryItemEquippingBlock other)
 {
     return(other != null &&
            GearsetItem.DeepEquals(other.GearsetItem) &&
            AmmoType == other.AmmoType &&
            Attributes == other.Attributes &&
            DisplayStrings.DeepEqualsReadOnlySimpleCollection(other.DisplayStrings) &&
            EquipmentSlotType.DeepEquals(other.EquipmentSlotType) &&
            EquippingSoundHash == other.EquippingSoundHash &&
            HornSoundHash == other.HornSoundHash &&
            UniqueLabel == other.UniqueLabel &&
            UniqueLabelHash == other.UniqueLabelHash);
 }
Example #25
0
    private void AddWeaponIfExists(EquipmentSlotType slotType)
    {
        ScriptableItem item = equipmentManager.GetEquippedItem(slotType);

        if (item is ScriptableWeapon)
        {
            weapons.Add(new Weapon(
                            this.gameObject,
                            (ScriptableWeapon)item,
                            equipmentManager.GetEquippedItemGameObject(slotType)
                            ));
        }
    }
Example #26
0
        public bool Equip(EquipmentSlotType slotType, ContainedSlot slot, out ContainedSlot itemTaken)
        {
            itemTaken = null;

            var internalPosition = new Vector2I(0, (int)slotType);
            var actualSlot       = PeekSlot(internalPosition);

            if (actualSlot == null || actualSlot.CanStackWith(slot))
            {
                return(PutItem(slot.Item, internalPosition, slot.ItemsCount));
            }

            return(PutItemExchange(slot.Item, internalPosition, slot.ItemsCount, out itemTaken));
        }
Example #27
0
    public void EquipItem(EquipmentSlotType slotType, Equipment equipment, bool removeToInventory = true)
    {
        if (slotType == EquipmentSlotType.None || equipment == null)
        {
            return;
        }

        TryToRemoveEquipment(slotType, removeToInventory);
        _currentEquipment[slotType] = equipment;
        EquipmentSlot slot = _player.PlayerEquipmentUI.GetEquipmentSlotByType(slotType);

        slot.RightPointerClicked += RemoveItem;
        slot.AddItemToSlot(equipment);
    }
Example #28
0
    public EquipmentParams GetParamsByType(EquipmentSlotType type)
    {
        switch (type)
        {
        case EquipmentSlotType.ItemRigth:
            return(_rightHand);

        case EquipmentSlotType.ItemLeft:
            return(_leftHand);

        default:
            Debug.LogError(type + " is not supported yet");
            return(null);
        }
    }
Example #29
0
        public static bool CanBeEquiped(EquipmentType type, EquipmentSlotType slotType)
        {
            switch (type)
            {
            case EquipmentType.Weapon:
                return(slotType == EquipmentSlotType.ItemRigth);

            case EquipmentType.Shield:
                return(slotType == EquipmentSlotType.ItemLeft);

            default:
                Debug.Log("Not supported type");
                return(false);
            }
        }
        public static BuildItem FromXml(XmlElement xe)
        {
            try
            {
                DDOItemData item = DatasetManager.Dataset.Items.Find(i => i.Name == xe.GetAttribute("item"));
                if (item == null)
                {
                    return(null);
                }
                EquipmentSlotType est = (EquipmentSlotType)Enum.Parse(typeof(EquipmentSlotType), xe.GetAttribute("slot"));
                if (est == EquipmentSlotType.None)
                {
                    return(null);
                }
                BuildItem bi = new BuildItem(item, est);
                if (!xe.HasChildNodes)
                {
                    return(bi);
                }
                List <ItemProperty> found = new List <ItemProperty>();
                foreach (XmlElement xc in xe.ChildNodes)
                {
                    string property = xc.InnerText;
                    string type     = xc.GetAttribute("type");
                    foreach (var ip in item.Properties)
                    {
                        if (ip.Options != null && !found.Contains(ip))
                        {
                            foreach (var op in ip.Options)
                            {
                                if (op.Property == property && ((string.IsNullOrWhiteSpace(op.Type) && type == "untyped") || op.Type == type))
                                {
                                    bi.OptionProperties.Add(op);
                                    found.Add(ip);
                                    break;
                                }
                            }
                        }
                    }
                }

                return(bi);
            }
            catch
            {
                return(null);
            }
        }