Exemple #1
0
        public Item AddItem(TItem template, bool sort = false)
        {
            if (equipment.Count >= maxItems)
                return null;

            if (equipment.Exists(x => x.Template.code == template.code))
                return null;

            int seqSeed = seq + 1;
            byte[] baseSeq = new byte[8];
            byte[] seed = Encoding.UTF8.GetBytes(template.name);
            byte[] codeSeed = Encoding.UTF8.GetBytes(template.code);
            for (int i = 0; i < seed.Length && i < 5; i++)
                baseSeq[i] = (byte)(seed[i] ^ seed[seed.Length - 1 - i]);

            for (int i = 0; i < 3; i++)
                baseSeq[i] ^= codeSeed[i];

            long itemSeq = BitConverter.ToInt64(baseSeq, 0) * seqSeed;
            Item.USAGE usage = Item.USAGE.UNEQUIP;
            Item item = new Item(itemSeq, template, template.code, usage, -1, 0, 1000);
            equipment.Add(item);

            if (sort)
                Sort();

            return item;
        }
Exemple #2
0
        public void hMyInfoManagerSetItemUsage(long seq, string code, Item.USAGE usage)
        {
            Item item = ClientExtension.instance.inventory.equipment.Find(x => x.Seq == seq);

            if (item != null)
            {
                item.Usage = usage;
            }

            MyInfoManagerSetItemUsageHook.CallOriginal(MyInfoManager.Instance, new object[] { seq, code, usage });
        }
Exemple #3
0
    private void DrawItemIcon(Item item, Rect crdIcon)
    {
        Color color = GUI.color;

        Item.USAGE usage = item.Usage;
        if (usage == Item.USAGE.DELETED)
        {
            GUI.color = disabledColor;
        }
        TextureUtil.DrawTexture(crdIcon, item.Template.CurIcon(), ScaleMode.StretchToFill);
        GUI.color = color;
    }