Ejemplo n.º 1
0
 public void EquipItem(EquippableItem itemToEquip, InvBaseItem.Slot slotPlaced)
 {
     Debug.Log("Adding Item...");
     playerLightScript = itemToEquip.GetComponentInChildren<Light>();
     if (playerLightScript)
     {
         Debug.Log("Item was a light.");
         playerLightTransform = itemToEquip.transform;
         relativeLightPosition = playerLightTransform.localPosition;
         lightRotationOffset = playerLightTransform.localRotation;
         playerLightScript = playerLightTransform.GetComponentInChildren<Light>();
         itemCollider = itemToEquip.interactionZone;
     }
     switch(handEquip)
     {
     case HandEquipStates.left:
         if(slotPlaced == InvBaseItem.Slot.RightHand)
             handEquip = HandEquipStates.both;
         break;
     case HandEquipStates.right:
         if(slotPlaced == InvBaseItem.Slot.LeftHand)
             handEquip = HandEquipStates.both;
         break;
     case HandEquipStates.none:
         if(slotPlaced == InvBaseItem.Slot.LeftHand)
             handEquip = HandEquipStates.left;
         if(slotPlaced == InvBaseItem.Slot.RightHand)
             handEquip = HandEquipStates.right;
         break;
     }
     SetArmLayerWeight(0f, 0f);
 }
 public InvGameItem(int id, InvBaseItem bi)
 {
     this.quality = Quality.Sturdy;
     this.itemLevel = 1;
     this.mBaseItemID = id;
     this.mBaseItem = bi;
 }
Ejemplo n.º 3
0
	/// <summary>
	/// Helper function that sets the index to the index of the specified item.
	/// </summary>

	public static void SelectIndex (InvDatabase db, InvBaseItem item)
	{
		mIndex = 0;

		foreach (InvBaseItem i in db.items)
		{
			if (i == item) break;
			++mIndex;
		}
	}
 public InvGameItem GetItem(InvBaseItem.Slot slot)
 {
     if (slot != InvBaseItem.Slot.None)
     {
         int index = ((int) slot) - 1;
         if ((this.mItems != null) && (index < this.mItems.Length))
         {
             return this.mItems[index];
         }
     }
     return null;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Whether the specified slot currently has an item equipped.
 /// </summary>
 public bool HasEquipped(InvBaseItem.Slot slot)
 {
     if (mItems != null)
     {
         for (int i = 0, imax = mItems.Length; i < imax; ++i)
         {
             InvBaseItem baseItem = mItems[i].baseItem;
             if (baseItem != null && baseItem.slot == slot) return true;
         }
     }
     return false;
 }
Ejemplo n.º 6
0
 public InvGameItem GetItem(InvBaseItem.Slot slot)
 {
     if (slot != InvBaseItem.Slot.None)
     {
         int num = slot - InvBaseItem.Slot.Weapon;
         if (this.mItems != null && num < this.mItems.Length)
         {
             return this.mItems[num];
         }
     }
     return null;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Whether the specified slot currently has an item equipped.
 /// </summary>
 public bool HasEquipped(InvBaseItem.Slot slot)
 {
     if (mItems != null)
     {
         foreach (InvGameItem i in mItems)
         {
             InvBaseItem baseItem = i.baseItem;
             if (baseItem != null && baseItem.slot == slot) return true;
         }
     }
     return false;
 }
Ejemplo n.º 8
0
    /// <summary>
    /// Retrieves the item in the specified slot.
    /// </summary>
    public InvGameItem GetItem(InvBaseItem.Slot slot)
    {
        if (slot != InvBaseItem.Slot.None)
        {
            int index = (int)slot - 1;

            if (mItems != null && index < mItems.Length)
            {
                return mItems[index];
            }
        }
        return null;
    }
Ejemplo n.º 9
0
    /// <summary>
    /// Show a tooltip for the item.
    /// </summary>

    void OnTooltip(bool show)
    {
        InvGameItem item = show ? mItem : null;

        if (item != null)
        {
            InvBaseItem bi = item.baseItem;

            if (bi != null)
            {
                string t = "[" + NGUITools.EncodeColor(item.color) + "]" + item.name + "[-]\n";

                t += "[AFAFAF]Level " + item.itemLevel + " " + bi.slot;

                List <InvStat> stats = item.CalculateStats();

                for (int i = 0, imax = stats.Count; i < imax; ++i)
                {
                    InvStat stat = stats[i];
                    if (stat.amount == 0)
                    {
                        continue;
                    }

                    if (stat.amount < 0)
                    {
                        t += "\n[FF0000]" + stat.amount;
                    }
                    else
                    {
                        t += "\n[00FF00]+" + stat.amount;
                    }

                    if (stat.modifier == InvStat.Modifier.Percent)
                    {
                        t += "%";
                    }
                    t += " " + stat.id;
                    t += "[-]";
                }

                if (!string.IsNullOrEmpty(bi.description))
                {
                    t += "\n[FF9900]" + bi.description;
                }
                UITooltip.ShowText(t);
                return;
            }
        }
        UITooltip.ShowText(null);
    }
Ejemplo n.º 10
0
    public static int FindItemID(InvBaseItem item)
    {
        int i = 0;

        for (int num = list.Length; i < num; i++)
        {
            InvDatabase invDatabase = list[i];
            if (invDatabase.items.Contains(item))
            {
                return((invDatabase.databaseID << 16) | item.id16);
            }
        }
        return(-1);
    }
Ejemplo n.º 11
0
    private InvBaseItem GetItem(int id16)
    {
        int i = 0;

        for (int count = items.Count; i < count; i++)
        {
            InvBaseItem invBaseItem = items[i];
            if (invBaseItem.id16 == id16)
            {
                return(invBaseItem);
            }
        }
        return(null);
    }
Ejemplo n.º 12
0
    public InvGameItem Replace(InvBaseItem.Slot slot, InvGameItem item)
    {
        InvBaseItem invBaseItem = (item == null) ? null : item.baseItem;

        if (slot == InvBaseItem.Slot.None)
        {
            if (item != null)
            {
                Debug.LogWarning("Can't equip \"" + item.name + "\" because it doesn't specify an item slot");
            }
            return(item);
        }
        if (invBaseItem != null && invBaseItem.slot != slot)
        {
            return(item);
        }
        if (this.mItems == null)
        {
            int num = 8;
            this.mItems = new InvGameItem[num];
        }
        InvGameItem result = this.mItems[slot - InvBaseItem.Slot.Weapon];

        this.mItems[slot - InvBaseItem.Slot.Weapon] = item;
        if (this.mAttachments == null)
        {
            this.mAttachments = base.GetComponentsInChildren <InvAttachmentPoint>();
        }
        int i    = 0;
        int num2 = this.mAttachments.Length;

        while (i < num2)
        {
            InvAttachmentPoint invAttachmentPoint = this.mAttachments[i];
            if (invAttachmentPoint.slot == slot)
            {
                GameObject gameObject = invAttachmentPoint.Attach((invBaseItem == null) ? null : invBaseItem.attachment);
                if (invBaseItem != null && gameObject != null)
                {
                    Renderer component = gameObject.GetComponent <Renderer>();
                    if (component != null)
                    {
                        component.material.color = invBaseItem.color;
                    }
                }
            }
            i++;
        }
        return(result);
    }
Ejemplo n.º 13
0
    // Token: 0x06000683 RID: 1667 RVA: 0x00050580 File Offset: 0x0004E780
    public InvGameItem FKEECBBDPFF(InvBaseItem.EKIPQNMFBLN COQJPLDFJBB, InvGameItem PDIBIIKFBDH)
    {
        InvBaseItem invBaseItem = (PDIBIIKFBDH == null) ? null : PDIBIIKFBDH.baseItem;

        if (COQJPLDFJBB == InvBaseItem.EKIPQNMFBLN.None)
        {
            if (PDIBIIKFBDH != null)
            {
                Debug.LogWarning("Can't equip \"" + PDIBIIKFBDH.name + "\" because it doesn't specify an item slot");
            }
            return(PDIBIIKFBDH);
        }
        if (invBaseItem != null && invBaseItem.slot != COQJPLDFJBB)
        {
            return(PDIBIIKFBDH);
        }
        if (this.OBPHQMNEMCK == null)
        {
            this.OBPHQMNEMCK = new InvGameItem[8];
        }
        InvGameItem result = this.OBPHQMNEMCK[COQJPLDFJBB - InvBaseItem.EKIPQNMFBLN.Weapon];

        this.OBPHQMNEMCK[COQJPLDFJBB - InvBaseItem.EKIPQNMFBLN.Weapon] = PDIBIIKFBDH;
        if (this.PMLMLFNIPHK == null)
        {
            this.PMLMLFNIPHK = base.GetComponentsInChildren <MGPKIPNIGLC>();
        }
        int i   = 0;
        int num = this.PMLMLFNIPHK.Length;

        while (i < num)
        {
            MGPKIPNIGLC mgpkipniglc = this.PMLMLFNIPHK[i];
            if (mgpkipniglc.COQJPLDFJBB == COQJPLDFJBB)
            {
                GameObject gameObject = mgpkipniglc.MQHPDBBJPDO((invBaseItem == null) ? null : invBaseItem.attachment);
                if (invBaseItem != null && gameObject != null)
                {
                    Renderer component = gameObject.GetComponent <Renderer>();
                    if (component != null)
                    {
                        component.material.color = invBaseItem.color;
                    }
                }
            }
            i++;
        }
        return(result);
    }
Ejemplo n.º 14
0
    // Token: 0x06000684 RID: 1668 RVA: 0x00050680 File Offset: 0x0004E880
    public InvGameItem JQGGPEGENOO(InvBaseItem.EKIPQNMFBLN COQJPLDFJBB, InvGameItem PDIBIIKFBDH)
    {
        InvBaseItem invBaseItem = (PDIBIIKFBDH == null) ? null : PDIBIIKFBDH.baseItem;

        if (COQJPLDFJBB == InvBaseItem.EKIPQNMFBLN.None)
        {
            if (PDIBIIKFBDH != null)
            {
                Debug.LogWarning("Powers up Steel-type moves." + PDIBIIKFBDH.name + "4");
            }
            return(PDIBIIKFBDH);
        }
        if (invBaseItem != null && invBaseItem.slot != COQJPLDFJBB)
        {
            return(PDIBIIKFBDH);
        }
        if (this.OBPHQMNEMCK == null)
        {
            this.OBPHQMNEMCK = new InvGameItem[1];
        }
        InvGameItem result = this.OBPHQMNEMCK[COQJPLDFJBB - InvBaseItem.EKIPQNMFBLN.Weapon];

        this.OBPHQMNEMCK[COQJPLDFJBB - InvBaseItem.EKIPQNMFBLN.Weapon] = PDIBIIKFBDH;
        if (this.PMLMLFNIPHK == null)
        {
            this.PMLMLFNIPHK = base.GetComponentsInChildren <MGPKIPNIGLC>();
        }
        int i   = 0;
        int num = this.PMLMLFNIPHK.Length;

        while (i < num)
        {
            MGPKIPNIGLC mgpkipniglc = this.PMLMLFNIPHK[i];
            if (mgpkipniglc.COQJPLDFJBB == COQJPLDFJBB)
            {
                GameObject gameObject = mgpkipniglc.GBDLCJPMHCD((invBaseItem == null) ? null : invBaseItem.attachment);
                if (invBaseItem != null && gameObject != null)
                {
                    Renderer component = gameObject.GetComponent <Renderer>();
                    if (component != null)
                    {
                        component.material.color = invBaseItem.color;
                    }
                }
            }
            i += 0;
        }
        return(result);
    }
Ejemplo n.º 15
0
    // Token: 0x0600066D RID: 1645 RVA: 0x00050098 File Offset: 0x0004E298
    public InvGameItem LDGOBEFKNGE(InvBaseItem.EKIPQNMFBLN COQJPLDFJBB, InvGameItem PDIBIIKFBDH)
    {
        InvBaseItem invBaseItem = (PDIBIIKFBDH == null) ? null : PDIBIIKFBDH.LQDNPBBFFCM();

        if (COQJPLDFJBB == InvBaseItem.EKIPQNMFBLN.None)
        {
            if (PDIBIIKFBDH != null)
            {
                Debug.LogWarning("substitute" + PDIBIIKFBDH.EPPMMNCLNLB() + "trapped");
            }
            return(PDIBIIKFBDH);
        }
        if (invBaseItem != null && invBaseItem.slot != COQJPLDFJBB)
        {
            return(PDIBIIKFBDH);
        }
        if (this.OBPHQMNEMCK == null)
        {
            this.OBPHQMNEMCK = new InvGameItem[1];
        }
        InvGameItem result = this.OBPHQMNEMCK[COQJPLDFJBB - InvBaseItem.EKIPQNMFBLN.Weapon];

        this.OBPHQMNEMCK[COQJPLDFJBB - InvBaseItem.EKIPQNMFBLN.None] = PDIBIIKFBDH;
        if (this.PMLMLFNIPHK == null)
        {
            this.PMLMLFNIPHK = base.GetComponentsInChildren <MGPKIPNIGLC>();
        }
        int i   = 1;
        int num = this.PMLMLFNIPHK.Length;

        while (i < num)
        {
            MGPKIPNIGLC mgpkipniglc = this.PMLMLFNIPHK[i];
            if (mgpkipniglc.COQJPLDFJBB == COQJPLDFJBB)
            {
                GameObject gameObject = mgpkipniglc.MDHPIKLCLHI((invBaseItem == null) ? null : invBaseItem.attachment);
                if (invBaseItem != null && gameObject != null)
                {
                    Renderer component = gameObject.GetComponent <Renderer>();
                    if (component != null)
                    {
                        component.material.color = invBaseItem.color;
                    }
                }
            }
            i += 0;
        }
        return(result);
    }
Ejemplo n.º 16
0
    // Token: 0x06000676 RID: 1654 RVA: 0x00050354 File Offset: 0x0004E554
    public InvGameItem MLHGDGKOLPI(InvBaseItem.EKIPQNMFBLN COQJPLDFJBB, InvGameItem PDIBIIKFBDH)
    {
        InvBaseItem invBaseItem = (PDIBIIKFBDH == null) ? null : PDIBIIKFBDH.LMKGKPEOBHG();

        if (COQJPLDFJBB == InvBaseItem.EKIPQNMFBLN.None)
        {
            if (PDIBIIKFBDH != null)
            {
                Debug.LogWarning("Player/Body" + PDIBIIKFBDH.KBJMQECFGDM() + "1|");
            }
            return(PDIBIIKFBDH);
        }
        if (invBaseItem != null && invBaseItem.slot != COQJPLDFJBB)
        {
            return(PDIBIIKFBDH);
        }
        if (this.OBPHQMNEMCK == null)
        {
            this.OBPHQMNEMCK = new InvGameItem[0];
        }
        InvGameItem result = this.OBPHQMNEMCK[COQJPLDFJBB - InvBaseItem.EKIPQNMFBLN.None];

        this.OBPHQMNEMCK[COQJPLDFJBB - InvBaseItem.EKIPQNMFBLN.None] = PDIBIIKFBDH;
        if (this.PMLMLFNIPHK == null)
        {
            this.PMLMLFNIPHK = base.GetComponentsInChildren <MGPKIPNIGLC>();
        }
        int i   = 0;
        int num = this.PMLMLFNIPHK.Length;

        while (i < num)
        {
            MGPKIPNIGLC mgpkipniglc = this.PMLMLFNIPHK[i];
            if (mgpkipniglc.COQJPLDFJBB == COQJPLDFJBB)
            {
                GameObject gameObject = mgpkipniglc.GPBEQIPPBOB((invBaseItem == null) ? null : invBaseItem.attachment);
                if (invBaseItem != null && gameObject != null)
                {
                    Renderer component = gameObject.GetComponent <Renderer>();
                    if (component != null)
                    {
                        component.material.color = invBaseItem.color;
                    }
                }
            }
            i++;
        }
        return(result);
    }
Ejemplo n.º 17
0
    /// <summary>
    /// Whether the specified slot currently has an item equipped.
    /// </summary>

    public bool HasEquipped(InvBaseItem.Slot slot)
    {
        if (mItems != null)
        {
            for (int i = 0, imax = mItems.Length; i < imax; ++i)
            {
                InvBaseItem baseItem = mItems[i].baseItem;
                if (baseItem != null && baseItem.slot == slot)
                {
                    return(true);
                }
            }
        }
        return(false);
    }
Ejemplo n.º 18
0
 public static int FindItemID(InvBaseItem item)
 {
     int i = 0;
     int num = InvDatabase.list.Length;
     while (i < num)
     {
         InvDatabase invDatabase = InvDatabase.list[i];
         if (invDatabase.items.Contains(item))
         {
             return invDatabase.databaseID << 16 | item.id16;
         }
         i++;
     }
     return -1;
 }
Ejemplo n.º 19
0
    /// <summary>
    /// Whether the specified slot currently has an item equipped.
    /// </summary>

    public bool HasEquipped(InvBaseItem.Slot slot)
    {
        if (mItems != null)
        {
            foreach (InvGameItem i in mItems)
            {
                InvBaseItem baseItem = i.baseItem;
                if (baseItem != null && baseItem.slot == slot)
                {
                    return(true);
                }
            }
        }
        return(false);
    }
 public static int FindItemID(InvBaseItem item)
 {
     int index = 0;
     int length = list.Length;
     while (index < length)
     {
         InvDatabase database = list[index];
         if (database.items.Contains(item))
         {
             return ((database.databaseID << 0x10) | item.id16);
         }
         index++;
     }
     return -1;
 }
Ejemplo n.º 21
0
    public InvGameItem Replace(InvBaseItem.Slot slot, InvGameItem item)
    {
        InvBaseItem item2 = (item == null) ? null : item.baseItem;

        if (slot != InvBaseItem.Slot.None)
        {
            if ((item2 != null) && (item2.slot != slot))
            {
                return(item);
            }
            if (this.mItems == null)
            {
                int num = 8;
                this.mItems = new InvGameItem[num];
            }
            InvGameItem item3 = this.mItems[((int)slot) - 1];
            this.mItems[((int)slot) - 1] = item;
            if (this.mAttachments == null)
            {
                this.mAttachments = base.GetComponentsInChildren <InvAttachmentPoint>();
            }
            int index  = 0;
            int length = this.mAttachments.Length;
            while (index < length)
            {
                InvAttachmentPoint point = this.mAttachments[index];
                if (point.slot == slot)
                {
                    GameObject obj2 = point.Attach((item2 == null) ? null : item2.attachment);
                    if ((item2 != null) && (obj2 != null))
                    {
                        Renderer renderer = obj2.renderer;
                        if (renderer != null)
                        {
                            renderer.material.color = item2.color;
                        }
                    }
                }
                index++;
            }
            return(item3);
        }
        if (item != null)
        {
            Debug.LogWarning("Can't equip \"" + item.name + "\" because it doesn't specify an item slot");
        }
        return(item);
    }
Ejemplo n.º 22
0
	/// <summary>
	/// Equip the specified item automatically replacing an existing one.
	/// </summary>

	public InvGameItem Replace (InvBaseItem.Slot slot, InvGameItem item)
	{
		InvBaseItem baseItem = (item != null) ? item.baseItem : null;

		if (slot != InvBaseItem.Slot.None)
		{
			// If the item is not of appropriate type, we shouldn't do anything
			if (baseItem != null && baseItem.slot != slot) return item;

			if (mItems == null)
			{
				// Automatically figure out how many item slots we need
				int count = (int)InvBaseItem.Slot._LastDoNotUse;
				mItems = new InvGameItem[count];
			}

			// Equip this item
			InvGameItem prev = mItems[(int)slot - 1];
			mItems[(int)slot - 1] = item;

			// Get the list of all attachment points
			if (mAttachments == null) mAttachments = GetComponentsInChildren<InvAttachmentPoint>();

			// Equip the item visually
			for (int i = 0, imax = mAttachments.Length; i < imax; ++i)
			{
				InvAttachmentPoint ip = mAttachments[i];

				if (ip.slot == slot)
				{
					GameObject go = ip.Attach(baseItem != null ? baseItem.attachment : null);

					if (baseItem != null && go != null)
					{
						//Renderer ren = go.renderer;
						Renderer ren = go.GetComponent<Renderer>();
						if (ren != null) ren.material.color = baseItem.color;
					}
				}
			}
			return prev;
		}
		else if (item != null)
		{
			Debug.LogWarning("Can't equip \"" + item.name + "\" because it doesn't specify an item slot");
		}
		return item;
	}
Ejemplo n.º 23
0
    // Token: 0x0600065A RID: 1626 RVA: 0x0004FD2C File Offset: 0x0004DF2C
    public static int QQKCNLIEFOP(InvBaseItem PDIBIIKFBDH)
    {
        int i   = 0;
        int num = QJFLHFDQNPN.FNCJDMODFGC().Length;

        while (i < num)
        {
            QJFLHFDQNPN qjflhfdqnpn = QJFLHFDQNPN.NGDBDCQFDHI[i];
            if (qjflhfdqnpn.MKHIFDNEFBD.Contains(PDIBIIKFBDH))
            {
                return(qjflhfdqnpn.LKJDOFBQIHE << 5 | PDIBIIKFBDH.id16);
            }
            i++;
        }
        return(-1);
    }
Ejemplo n.º 24
0
    // Token: 0x06000662 RID: 1634 RVA: 0x0004FE80 File Offset: 0x0004E080
    public static int GOCJGLQGIQL(InvBaseItem PDIBIIKFBDH)
    {
        int i   = 0;
        int num = QJFLHFDQNPN.BBHEKMJMBGL().Length;

        while (i < num)
        {
            QJFLHFDQNPN qjflhfdqnpn = QJFLHFDQNPN.BBHEKMJMBGL()[i];
            if (qjflhfdqnpn.MKHIFDNEFBD.Contains(PDIBIIKFBDH))
            {
                return(qjflhfdqnpn.LKJDOFBQIHE << -106 | PDIBIIKFBDH.id16);
            }
            i += 0;
        }
        return(-1);
    }
Ejemplo n.º 25
0
    // Token: 0x0600063A RID: 1594 RVA: 0x0004F8E8 File Offset: 0x0004DAE8
    public static int IKGPONMHFBG(InvBaseItem PDIBIIKFBDH)
    {
        int i   = 0;
        int num = QJFLHFDQNPN.BBHEKMJMBGL().Length;

        while (i < num)
        {
            QJFLHFDQNPN qjflhfdqnpn = QJFLHFDQNPN.GGFPHQBKJBJ()[i];
            if (qjflhfdqnpn.MKHIFDNEFBD.Contains(PDIBIIKFBDH))
            {
                return(qjflhfdqnpn.LKJDOFBQIHE << -87 | PDIBIIKFBDH.id16);
            }
            i++;
        }
        return(-1);
    }
Ejemplo n.º 26
0
    // Token: 0x06002FA3 RID: 12195 RVA: 0x000E8924 File Offset: 0x000E6D24
    public static int FindItemID(InvBaseItem item)
    {
        int i   = 0;
        int num = InvDatabase.list.Length;

        while (i < num)
        {
            InvDatabase invDatabase = InvDatabase.list[i];
            if (invDatabase.items.Contains(item))
            {
                return(invDatabase.databaseID << 16 | item.id16);
            }
            i++;
        }
        return(-1);
    }
Ejemplo n.º 27
0
    // Token: 0x06002F9F RID: 12191 RVA: 0x000E87F0 File Offset: 0x000E6BF0
    private InvBaseItem GetItem(int id16)
    {
        int i     = 0;
        int count = this.items.Count;

        while (i < count)
        {
            InvBaseItem invBaseItem = this.items[i];
            if (invBaseItem.id16 == id16)
            {
                return(invBaseItem);
            }
            i++;
        }
        return(null);
    }
Ejemplo n.º 28
0
    // Token: 0x06000635 RID: 1589 RVA: 0x0004F824 File Offset: 0x0004DA24
    public static int FMDBLMKBQHC(InvBaseItem PDIBIIKFBDH)
    {
        int i   = 0;
        int num = QJFLHFDQNPN.NGDBDCQFDHI.Length;

        while (i < num)
        {
            QJFLHFDQNPN qjflhfdqnpn = QJFLHFDQNPN.NGDBDCQFDHI[i];
            if (qjflhfdqnpn.MKHIFDNEFBD.Contains(PDIBIIKFBDH))
            {
                return(qjflhfdqnpn.LKJDOFBQIHE << 16 | PDIBIIKFBDH.id16);
            }
            i++;
        }
        return(-1);
    }
Ejemplo n.º 29
0
    // Token: 0x06000644 RID: 1604 RVA: 0x0004FA64 File Offset: 0x0004DC64
    private InvBaseItem QDMQEBHOENL(int JDLDQIMDNMQ)
    {
        int i     = 0;
        int count = this.MKHIFDNEFBD.Count;

        while (i < count)
        {
            InvBaseItem invBaseItem = this.MKHIFDNEFBD[i];
            if (invBaseItem.id16 == JDLDQIMDNMQ)
            {
                return(invBaseItem);
            }
            i++;
        }
        return(null);
    }
Ejemplo n.º 30
0
    public static int FindItemID(InvBaseItem item)
    {
        int index  = 0;
        int length = list.Length;

        while (index < length)
        {
            InvDatabase database = list[index];
            if (database.items.Contains(item))
            {
                return((database.databaseID << 0x10) | item.id16);
            }
            index++;
        }
        return(-1);
    }
Ejemplo n.º 31
0
    // Token: 0x06000645 RID: 1605 RVA: 0x0004FAA4 File Offset: 0x0004DCA4
    private InvBaseItem JJOICNKDQPG(int JDLDQIMDNMQ)
    {
        int i     = 1;
        int count = this.MKHIFDNEFBD.Count;

        while (i < count)
        {
            InvBaseItem invBaseItem = this.MKHIFDNEFBD[i];
            if (invBaseItem.id16 == JDLDQIMDNMQ)
            {
                return(invBaseItem);
            }
            i++;
        }
        return(null);
    }
Ejemplo n.º 32
0
    // Token: 0x06000636 RID: 1590 RVA: 0x0004F870 File Offset: 0x0004DA70
    private InvBaseItem NFCNOPLODQF(int JDLDQIMDNMQ)
    {
        int i     = 0;
        int count = this.MKHIFDNEFBD.Count;

        while (i < count)
        {
            InvBaseItem invBaseItem = this.MKHIFDNEFBD[i];
            if (invBaseItem.id16 == JDLDQIMDNMQ)
            {
                return(invBaseItem);
            }
            i += 0;
        }
        return(null);
    }
Ejemplo n.º 33
0
    // Token: 0x0600065C RID: 1628 RVA: 0x0004FDC4 File Offset: 0x0004DFC4
    public static int KGKLOOOLGBE(InvBaseItem PDIBIIKFBDH)
    {
        int i   = 0;
        int num = QJFLHFDQNPN.FNCJDMODFGC().Length;

        while (i < num)
        {
            QJFLHFDQNPN qjflhfdqnpn = QJFLHFDQNPN.BBHEKMJMBGL()[i];
            if (qjflhfdqnpn.MKHIFDNEFBD.Contains(PDIBIIKFBDH))
            {
                return(qjflhfdqnpn.LKJDOFBQIHE << 73 | PDIBIIKFBDH.id16);
            }
            i++;
        }
        return(-1);
    }
Ejemplo n.º 34
0
    // Token: 0x0600065B RID: 1627 RVA: 0x0004FD78 File Offset: 0x0004DF78
    public static int ONBICCHHHPK(InvBaseItem PDIBIIKFBDH)
    {
        int i   = 0;
        int num = QJFLHFDQNPN.NGDBDCQFDHI.Length;

        while (i < num)
        {
            QJFLHFDQNPN qjflhfdqnpn = QJFLHFDQNPN.BBBCFDQHLEQ()[i];
            if (qjflhfdqnpn.MKHIFDNEFBD.Contains(PDIBIIKFBDH))
            {
                return(qjflhfdqnpn.LKJDOFBQIHE << 45 | PDIBIIKFBDH.id16);
            }
            i++;
        }
        return(-1);
    }
Ejemplo n.º 35
0
    private InvBaseItem GetItem(int id16)
    {
        int num   = 0;
        int count = this.items.Count;

        while (num < count)
        {
            InvBaseItem item = this.items[num];
            if (item.id16 == id16)
            {
                return(item);
            }
            num++;
        }
        return(null);
    }
Ejemplo n.º 36
0
    /// <summary>
    /// Equip the specified item and return the item that was replaced.
    /// </summary>

    public InvGameItem Equip(InvGameItem item)
    {
        if (item != null)
        {
            InvBaseItem baseItem = item.baseItem;
            if (baseItem != null)
            {
                return(Replace(baseItem.slot, item));
            }
            else
            {
                Debug.LogWarning("Can't resolve the item ID of " + item.baseItemID);
            }
        }
        return(item);
    }
 public InvGameItem Replace(InvBaseItem.Slot slot, InvGameItem item)
 {
     InvBaseItem item2 = (item == null) ? null : item.baseItem;
     if (slot != InvBaseItem.Slot.None)
     {
         if ((item2 != null) && (item2.slot != slot))
         {
             return item;
         }
         if (this.mItems == null)
         {
             int num = 8;
             this.mItems = new InvGameItem[num];
         }
         InvGameItem item3 = this.mItems[((int) slot) - 1];
         this.mItems[((int) slot) - 1] = item;
         if (this.mAttachments == null)
         {
             this.mAttachments = base.GetComponentsInChildren<InvAttachmentPoint>();
         }
         int index = 0;
         int length = this.mAttachments.Length;
         while (index < length)
         {
             InvAttachmentPoint point = this.mAttachments[index];
             if (point.slot == slot)
             {
                 GameObject obj2 = point.Attach((item2 == null) ? null : item2.attachment);
                 if ((item2 != null) && (obj2 != null))
                 {
                     Renderer renderer = obj2.renderer;
                     if (renderer != null)
                     {
                         renderer.material.color = item2.color;
                     }
                 }
             }
             index++;
         }
         return item3;
     }
     if (item != null)
     {
         Debug.LogWarning("Can't equip \"" + item.name + "\" because it doesn't specify an item slot");
     }
     return item;
 }
Ejemplo n.º 38
0
    public InvGameItem Replace(InvBaseItem.Slot slot, InvGameItem item)
    {
        InvBaseItem invBaseItem = item?.baseItem;

        if (slot != 0)
        {
            if (invBaseItem != null && invBaseItem.slot != slot)
            {
                return(item);
            }
            if (mItems == null)
            {
                int num = 8;
                mItems = new InvGameItem[num];
            }
            InvGameItem result = mItems[(int)(slot - 1)];
            mItems[(int)(slot - 1)] = item;
            if (mAttachments == null)
            {
                mAttachments = GetComponentsInChildren <InvAttachmentPoint>();
            }
            int i = 0;
            for (int num2 = mAttachments.Length; i < num2; i++)
            {
                InvAttachmentPoint invAttachmentPoint = mAttachments[i];
                if (invAttachmentPoint.slot != slot)
                {
                    continue;
                }
                GameObject gameObject = invAttachmentPoint.Attach(invBaseItem?.attachment);
                if (invBaseItem != null && gameObject != null)
                {
                    Renderer renderer = gameObject.renderer;
                    if (renderer != null)
                    {
                        renderer.material.color = invBaseItem.color;
                    }
                }
            }
            return(result);
        }
        if (item != null)
        {
            Debug.LogWarning("Can't equip \"" + item.name + "\" because it doesn't specify an item slot");
        }
        return(item);
    }
Ejemplo n.º 39
0
    private void OnTooltip(bool show)
    {
        InvGameItem item = !show ? null : this.mItem;

        if (item != null)
        {
            InvBaseItem baseItem = item.baseItem;
            if (baseItem != null)
            {
                string[]       textArray1  = new string[] { "[", NGUITools.EncodeColor(item.color), "]", item.name, "[-]\n" };
                string         str2        = string.Concat(textArray1);
                object[]       objArray1   = new object[] { str2, "[AFAFAF]Level ", item.itemLevel, " ", baseItem.slot };
                string         tooltipText = string.Concat(objArray1);
                List <InvStat> list        = item.CalculateStats();
                int            num         = 0;
                int            count       = list.Count;
                while (num < count)
                {
                    InvStat stat = list[num];
                    if (stat.amount != 0)
                    {
                        if (stat.amount < 0)
                        {
                            tooltipText = tooltipText + "\n[FF0000]" + stat.amount;
                        }
                        else
                        {
                            tooltipText = tooltipText + "\n[00FF00]+" + stat.amount;
                        }
                        if (stat.modifier == InvStat.Modifier.Percent)
                        {
                            tooltipText = tooltipText + "%";
                        }
                        tooltipText = (tooltipText + " " + stat.id) + "[-]";
                    }
                    num++;
                }
                if (!string.IsNullOrEmpty(baseItem.description))
                {
                    tooltipText = tooltipText + "\n[FF9900]" + baseItem.description;
                }
                UITooltip.ShowText(tooltipText);
                return;
            }
        }
        UITooltip.ShowText(null);
    }
Ejemplo n.º 40
0
 private void OnClick()
 {
     if (!(equipment == null))
     {
         List <InvBaseItem> items = InvDatabase.list[0].items;
         if (items.Count != 0)
         {
             int         max         = 12;
             int         num         = Random.Range(0, items.Count);
             InvBaseItem invBaseItem = items[num];
             InvGameItem invGameItem = new InvGameItem(num, invBaseItem);
             invGameItem.quality   = (InvGameItem.Quality)Random.Range(0, max);
             invGameItem.itemLevel = NGUITools.RandomRange(invBaseItem.minItemLevel, invBaseItem.maxItemLevel);
             equipment.Equip(invGameItem);
         }
     }
 }
Ejemplo n.º 41
0
 public bool HasEquipped(InvBaseItem.Slot slot)
 {
     if (this.mItems != null)
     {
         int i = 0;
         int num = this.mItems.Length;
         while (i < num)
         {
             InvBaseItem baseItem = this.mItems[i].baseItem;
             if (baseItem != null && baseItem.slot == slot)
             {
                 return true;
             }
             i++;
         }
     }
     return false;
 }
Ejemplo n.º 42
0
 public bool HasEquipped(InvBaseItem.Slot slot)
 {
     if (this.mItems != null)
     {
         int index  = 0;
         int length = this.mItems.Length;
         while (index < length)
         {
             InvBaseItem baseItem = this.mItems[index].baseItem;
             if ((baseItem != null) && (baseItem.slot == slot))
             {
                 return(true);
             }
             index++;
         }
     }
     return(false);
 }
Ejemplo n.º 43
0
 public bool HasEquipped(InvBaseItem.Slot slot)
 {
     if (this.mItems != null)
     {
         int i   = 0;
         int num = this.mItems.Length;
         while (i < num)
         {
             InvBaseItem baseItem = this.mItems[i].baseItem;
             if (baseItem != null && baseItem.slot == slot)
             {
                 return(true);
             }
             i++;
         }
     }
     return(false);
 }
 public bool HasEquipped(InvBaseItem.Slot slot)
 {
     if (this.mItems != null)
     {
         int index = 0;
         int length = this.mItems.Length;
         while (index < length)
         {
             InvBaseItem baseItem = this.mItems[index].baseItem;
             if ((baseItem != null) && (baseItem.slot == slot))
             {
                 return true;
             }
             index++;
         }
     }
     return false;
 }
Ejemplo n.º 45
0
	/// <summary>
	/// Draw the inspector widget.
	/// </summary>

	public override void OnInspectorGUI ()
	{
		EditorGUIUtility.LookLikeControls(80f);
		InvDatabase db = target as InvDatabase;
		NGUIEditorTools.DrawSeparator();

		InvBaseItem item = null;

		if (db.items == null || db.items.Count == 0)
		{
			mIndex = 0;
		}
		else
		{
			mIndex = Mathf.Clamp(mIndex, 0, db.items.Count - 1);
			item = db.items[mIndex];
		}

		if (mConfirmDelete)
		{
			// Show the confirmation dialog
			GUILayout.Label("Are you sure you want to delete '" + item.name + "'?");
			NGUIEditorTools.DrawSeparator();

			GUILayout.BeginHorizontal();
			{
				GUI.backgroundColor = Color.green;
				if (GUILayout.Button("Cancel")) mConfirmDelete = false;
				GUI.backgroundColor = Color.red;

				if (GUILayout.Button("Delete"))
				{
					NGUIEditorTools.RegisterUndo("Delete Inventory Item", db);
					db.items.RemoveAt(mIndex);
					mConfirmDelete = false;
				}
				GUI.backgroundColor = Color.white;
			}
			GUILayout.EndHorizontal();
		}
		else
		{
			// Database icon atlas
			UIAtlas atlas = EditorGUILayout.ObjectField("Icon Atlas", db.iconAtlas, typeof(UIAtlas), false) as UIAtlas;

			if (atlas != db.iconAtlas)
			{
				NGUIEditorTools.RegisterUndo("Databse Atlas change", db);
				db.iconAtlas = atlas;
				foreach (InvBaseItem i in db.items) i.iconAtlas = atlas;
			}

			// Database ID
			int dbID = EditorGUILayout.IntField("Database ID", db.databaseID);

			if (dbID != db.databaseID)
			{
				NGUIEditorTools.RegisterUndo("Database ID change", db);
				db.databaseID = dbID;
			}

			// "New" button
			GUI.backgroundColor = Color.green;

			if (GUILayout.Button("New Item"))
			{
				NGUIEditorTools.RegisterUndo("Add Inventory Item", db);

				InvBaseItem bi = new InvBaseItem();
				bi.iconAtlas = db.iconAtlas;
				bi.id16 = (db.items.Count > 0) ? db.items[db.items.Count - 1].id16 + 1 : 0;
				db.items.Add(bi);
				mIndex = db.items.Count - 1;

				if (item != null)
				{
					bi.name = "Copy of " + item.name;
					bi.description = item.description;
					bi.slot = item.slot;
					bi.color = item.color;
					bi.iconName = item.iconName;
					bi.attachment = item.attachment;
					bi.minItemLevel = item.minItemLevel;
					bi.maxItemLevel = item.maxItemLevel;

					foreach (InvStat stat in item.stats)
					{
						InvStat copy = new InvStat();
						copy.id = stat.id;
						copy.amount = stat.amount;
						copy.modifier = stat.modifier;
						bi.stats.Add(copy);
					}
				}
				else
				{
					bi.name = "New Item";
					bi.description = "Item Description";
				}

				item = bi;
			}
			GUI.backgroundColor = Color.white;

			if (item != null)
			{
				NGUIEditorTools.DrawSeparator();

				// Navigation section
				GUILayout.BeginHorizontal();
				{
					if (mIndex == 0) GUI.color = Color.grey;
					if (GUILayout.Button("<<")) { mConfirmDelete = false; --mIndex; }
					GUI.color = Color.white;
					mIndex = EditorGUILayout.IntField(mIndex + 1, GUILayout.Width(40f)) - 1;
					GUILayout.Label("/ " + db.items.Count, GUILayout.Width(40f));
					if (mIndex + 1 == db.items.Count) GUI.color = Color.grey;
					if (GUILayout.Button(">>")) { mConfirmDelete = false; ++mIndex; }
					GUI.color = Color.white;
				}
				GUILayout.EndHorizontal();

				NGUIEditorTools.DrawSeparator();

				// Item name and delete item button
				GUILayout.BeginHorizontal();
				{
					string itemName = EditorGUILayout.TextField("Item Name", item.name);

					GUI.backgroundColor = Color.red;

					if (GUILayout.Button("Delete", GUILayout.Width(55f)))
					{
						mConfirmDelete = true;
					}
					GUI.backgroundColor = Color.white;

					if (!itemName.Equals(item.name))
					{
						NGUIEditorTools.RegisterUndo("Rename Item", db);
						item.name = itemName;
					}
				}
				GUILayout.EndHorizontal();

				string itemDesc = GUILayout.TextArea(item.description, 200, GUILayout.Height(100f));
				InvBaseItem.Slot slot = (InvBaseItem.Slot)EditorGUILayout.EnumPopup("Slot", item.slot);
				string iconName = "";
				float iconSize = 64f;
				bool drawIcon = false;
				float extraSpace = 0f;

				if (item.iconAtlas != null)
				{
					BetterList<string> sprites = item.iconAtlas.GetListOfSprites();
					sprites.Insert(0, "<None>");

					int index = 0;
					string spriteName = (item.iconName != null) ? item.iconName : sprites[0];

					// We need to find the sprite in order to have it selected
					if (!string.IsNullOrEmpty(spriteName))
					{
						for (int i = 1; i < sprites.size; ++i)
						{
							if (spriteName.Equals(sprites[i], System.StringComparison.OrdinalIgnoreCase))
							{
								index = i;
								break;
							}
						}
					}

					// Draw the sprite selection popup
					index = EditorGUILayout.Popup("Icon", index, sprites.ToArray());
					UIAtlas.Sprite sprite = (index > 0) ? item.iconAtlas.GetSprite(sprites[index]) : null;

					if (sprite != null)
					{
						iconName = sprite.name;

						Material mat = item.iconAtlas.spriteMaterial;

						if (mat != null)
						{
							Texture2D tex = mat.mainTexture as Texture2D;

							if (tex != null)
							{
								drawIcon = true;
								Rect rect = sprite.outer;

								if (item.iconAtlas.coordinates == UIAtlas.Coordinates.Pixels)
								{
									rect = NGUIMath.ConvertToTexCoords(rect, tex.width, tex.height);
								}

								GUILayout.Space(4f);
								GUILayout.BeginHorizontal();
								{
									GUILayout.Space(Screen.width - iconSize);
									NGUIEditorTools.DrawSprite(tex, rect, null, false);
								}
								GUILayout.EndHorizontal();

								extraSpace = iconSize * (float)sprite.outer.height / sprite.outer.width;
							}
						}
					}
				}

				// Item level range
				GUILayout.BeginHorizontal();
				GUILayout.Label("Level Range", GUILayout.Width(77f));
				int min = EditorGUILayout.IntField(item.minItemLevel, GUILayout.MinWidth(40f));
				int max = EditorGUILayout.IntField(item.maxItemLevel, GUILayout.MinWidth(40f));
				if (drawIcon) GUILayout.Space(iconSize);
				GUILayout.EndHorizontal();

				// Game Object attachment field, left of the icon
				GUILayout.BeginHorizontal();
				GameObject go = (GameObject)EditorGUILayout.ObjectField("Attachment", item.attachment, typeof(GameObject), false);
				if (drawIcon) GUILayout.Space(iconSize);
				GUILayout.EndHorizontal();

				// Color tint field, left of the icon
				GUILayout.BeginHorizontal();
				Color color = EditorGUILayout.ColorField("Color", item.color);
				if (drawIcon) GUILayout.Space(iconSize);
				GUILayout.EndHorizontal();

				// Calculate the extra spacing necessary for the icon to show up properly and not overlap anything
				if (drawIcon)
				{
					extraSpace = Mathf.Max(0f, extraSpace - 60f);
					GUILayout.Space(extraSpace);
				}

				// Item stats
				NGUIEditorTools.DrawSeparator();

				if (item.stats != null)
				{
					for (int i = 0; i < item.stats.Count; ++i)
					{
						InvStat stat = item.stats[i];

						GUILayout.BeginHorizontal();
						{
							InvStat.Identifier iden = (InvStat.Identifier)EditorGUILayout.EnumPopup(stat.id, GUILayout.Width(80f));

							// Color the field red if it's negative, green if it's positive
							if (stat.amount > 0) GUI.backgroundColor = Color.green;
							else if (stat.amount < 0) GUI.backgroundColor = Color.red;
							int amount = EditorGUILayout.IntField(stat.amount, GUILayout.Width(40f));
							GUI.backgroundColor = Color.white;

							InvStat.Modifier mod = (InvStat.Modifier)EditorGUILayout.EnumPopup(stat.modifier);

							GUI.backgroundColor = Color.red;
							if (GUILayout.Button("X", GUILayout.Width(20f)))
							{
								NGUIEditorTools.RegisterUndo("Delete Item Stat", db);
								item.stats.RemoveAt(i);
								--i;
							}
							else if (iden != stat.id || amount != stat.amount || mod != stat.modifier)
							{
								NGUIEditorTools.RegisterUndo("Item Stats", db);
								stat.id = iden;
								stat.amount = amount;
								stat.modifier = mod;
							}
							GUI.backgroundColor = Color.white;
						}
						GUILayout.EndHorizontal();
					}
				}

				if (GUILayout.Button("Add Stat", GUILayout.Width(80f)))
				{
					NGUIEditorTools.RegisterUndo("Add Item Stat", db);
					InvStat stat = new InvStat();
					stat.id = InvStat.Identifier.Armor;
					item.stats.Add(stat);
				}

				// Save all values
				if (!itemDesc.Equals(item.description) ||
					slot	!= item.slot ||
					go		!= item.attachment ||
					color	!= item.color ||
					min		!= item.minItemLevel ||
					max		!= item.maxItemLevel ||
					!iconName.Equals(item.iconName))
				{
					NGUIEditorTools.RegisterUndo("Item Properties", db);
					item.description = itemDesc;
					item.slot = slot;
					item.attachment = go;
					item.color = color;
					item.iconName = iconName;
					item.minItemLevel = min;
					item.maxItemLevel = max;
				}
			}
		}
	}
Ejemplo n.º 46
0
 public InvGameItem Replace(InvBaseItem.Slot slot, InvGameItem item)
 {
     InvBaseItem invBaseItem = (item == null) ? null : item.baseItem;
     if (slot == InvBaseItem.Slot.None)
     {
         if (item != null)
         {
             Debug.LogWarning("Can't equip \"" + item.name + "\" because it doesn't specify an item slot");
         }
         return item;
     }
     if (invBaseItem != null && invBaseItem.slot != slot)
     {
         return item;
     }
     if (this.mItems == null)
     {
         int num = 8;
         this.mItems = new InvGameItem[num];
     }
     InvGameItem result = this.mItems[slot - InvBaseItem.Slot.Weapon];
     this.mItems[slot - InvBaseItem.Slot.Weapon] = item;
     if (this.mAttachments == null)
     {
         this.mAttachments = base.GetComponentsInChildren<InvAttachmentPoint>();
     }
     int i = 0;
     int num2 = this.mAttachments.Length;
     while (i < num2)
     {
         InvAttachmentPoint invAttachmentPoint = this.mAttachments[i];
         if (invAttachmentPoint.slot == slot)
         {
             GameObject gameObject = invAttachmentPoint.Attach((invBaseItem == null) ? null : invBaseItem.attachment);
             if (invBaseItem != null && gameObject != null)
             {
                 Renderer component = gameObject.GetComponent<Renderer>();
                 if (component != null)
                 {
                     component.material.color = invBaseItem.color;
                 }
             }
         }
         i++;
     }
     return result;
 }
Ejemplo n.º 47
0
    /// <summary>
    /// Equip the specified item automatically replacing an existing one.
    /// </summary>
    public InvGameItem Replace(InvBaseItem.Slot slot, InvGameItem item)
    {
        InvBaseItem baseItem = (item != null) ? item.baseItem : null;

        if (slot != InvBaseItem.Slot.None)
        {
            return doReplace(slot, item, baseItem);
        }
        else if (item != null)
        {
            Debug.LogWarning("Can't equip \"" + item.name + "\" because it doesn't specify an item slot");
        }
        return item;
    }
Ejemplo n.º 48
0
 /// <summary>
 /// Get the full 32-bit ID of the specified item.
 /// Use this to get a list of items on the character that can get saved out to an external database or file.
 /// </summary>
 public static int FindItemID(InvBaseItem item)
 {
     foreach (InvDatabase db in list)
     {
         if (db.items.Contains(item))
         {
             return (db.databaseID << 16) | item.id16;
         }
     }
     return -1;
 }
Ejemplo n.º 49
0
    InvGameItem doReplace(InvBaseItem.Slot slot, InvGameItem item, InvBaseItem baseItem)
    {
        Debug.Log("replacing...");
        // If the item is not of appropriate type, we shouldn't do anything
        if (baseItem != null && baseItem.slot == InvBaseItem.Slot.EitherHand && (slot == InvBaseItem.Slot.LeftHand || slot == InvBaseItem.Slot.RightHand)){}
        else if (baseItem != null && baseItem.slot != slot) return item;

        if (mItems == null)
        {
            // Automatically figure out how many item slots we need
            int count = (int)InvBaseItem.Slot._LastDoNotUse;
            mItems = new InvGameItem[count];
        }

        // Equip this item
        InvGameItem prev = mItems[(int)slot - 1];
        string s = "previous item: ";
        if(prev == null)
            s+="null!";
        else
            s+=prev.name;
        Debug.Log(s);
        mItems[(int)slot - 1] = item;
        //Debug.Log("previous item at slot number: "+(InvBaseItem.Slot)((int)slot - 1)+": "+prev.name);

        // Get the list of all attachment points
        if (mAttachments == null) mAttachments = GetComponentsInChildren<InvAttachmentPoint>();

        // Equip the item visually
        for (int i = 0, imax = mAttachments.Length; i < imax; ++i)
        {
            InvAttachmentPoint ip = mAttachments[i];

            if (ip.slot == slot)
            {
                GameObject go = ip.Attach(baseItem != null ? baseItem.attachment : null);

                if (baseItem != null && go != null)
                {
                    InvBaseItem.Slot send = (InvBaseItem.Slot)((int)slot);
                    GetComponent<PlayerInteraction>().EquipItem(go.GetComponent<EquippableItem>(), send);
                    Renderer ren = go.renderer;
                    if (ren != null) ren.material.color = baseItem.color;
                }
                else
                {
                    InvBaseItem.Slot send = (InvBaseItem.Slot)((int)slot);
                    GetComponent<PlayerInteraction>().UnEquipItem(send);
                }
            }
        }
        return prev;
    }
Ejemplo n.º 50
0
 /// <summary>
 /// Unequip the item from the specified slot, returning the item that was unequipped.
 /// </summary>
 public InvGameItem Unequip(InvBaseItem.Slot slot)
 {
     return Replace(slot, null);
 }
Ejemplo n.º 51
0
 public void UnEquipItem(InvBaseItem.Slot slotRemoved)
 {
     switch(slotRemoved)
     {
     case InvBaseItem.Slot.LeftHand:
         if(handEquip == HandEquipStates.both)
             handEquip = HandEquipStates.right;
         if(handEquip == HandEquipStates.left)
             handEquip = HandEquipStates.none;
         break;
     case InvBaseItem.Slot.RightHand:
         if(handEquip == HandEquipStates.both)
             handEquip = HandEquipStates.left;
         if(handEquip == HandEquipStates.right)
             handEquip = HandEquipStates.none;
         break;
     }
     SetArmLayerWeight(0f, 0f);
 }
Ejemplo n.º 52
0
	/// <summary>
	/// Get the full 32-bit ID of the specified item.
	/// Use this to get a list of items on the character that can get saved out to an external database or file.
	/// </summary>

	static public int FindItemID (InvBaseItem item)
	{
		for (int i = 0, imax = list.Length; i < imax; ++i)
		{
			InvDatabase db = list[i];

			if (db.items.Contains(item))
			{
				return (db.databaseID << 16) | item.id16;
			}
		}
		return -1;
	}
Ejemplo n.º 53
0
 /// <summary>
 /// Create a game item with the specified ID and base item.
 /// </summary>
 public InvGameItem(int id, InvBaseItem bi)
 {
     mBaseItemID = id; mBaseItem = bi; partsNeeded = bi.combinableNetwork.Count - 1;
 }
Ejemplo n.º 54
0
 /// <summary>
 /// Create a game item with the specified ID and base item.
 /// </summary>
 public InvGameItem(int id, InvBaseItem bi)
 {
     mBaseItemID = id; mBaseItem = bi;
 }