Esempio n. 1
0
        public void LoadConfig()
        {
            if (!File.Exists(Path.Combine(ModuleFolder, "Config.ini")))
            {
                File.Create(Path.Combine(ModuleFolder, "Config.ini")).Dispose();
                config = new IniParser(Path.Combine(ModuleFolder, "Config.ini"));
                config.Save();
                foreach (ItemDataBlock item in Bundling.LoadAll <ItemDataBlock>())
                {
                    if (itemList.ItemList.Contains(item.name))
                    {
                        config.AddSetting("Config", item.name + ":" + item.uniqueID.ToString(), item._maxUses.ToString());
                    }
                }
                config.Save();
            }
            config = new IniParser(Path.Combine(ModuleFolder, "Config.ini"));

            foreach (string itemid in config.EnumSection("Config"))
            {
                int id     = int.Parse(itemid.Split(':')[1]);
                int amount = int.Parse(config.GetSetting("Config", itemid));
                _stackSizes.Add(id, amount);
                DatablockDictionary.GetByUniqueID(id)._maxUses = amount;
            }
        }
Esempio n. 2
0
        private void Confirm()
        {
            Datablock refValue;

            switch ((this.type_f & 0x7f))
            {
            case 1:
                refValue = (Datablock)this.refValue;
                break;

            case 2:
                refValue = ((InventoryItem)this.refValue).datablock;
                break;

            case 3:
                refValue = DatablockDictionary.GetByName((string)this.refValue);
                break;

            case 4:
                refValue = DatablockDictionary.GetByUniqueID(this.uid);
                break;

            default:
                this = new Datablock.Ident();
                return;
            }
            if (refValue != null)
            {
                this = new Datablock.Ident(refValue, refValue.uniqueID, 1);
            }
            else
            {
                this = new Datablock.Ident();
            }
        }
Esempio n. 3
0
 private static BlueprintDataBlock FindBlueprint(int uniqueID)
 {
     if (uniqueID == 0)
     {
         return(null);
     }
     return((BlueprintDataBlock)DatablockDictionary.GetByUniqueID(uniqueID));
 }
Esempio n. 4
0
    public static ArmorModel GetArmorModelByUniqueID(int uniqueID, ArmorModelSlot slot)
    {
        ArmorDataBlock byUniqueID = DatablockDictionary.GetByUniqueID(uniqueID) as ArmorDataBlock;

        if (!byUniqueID)
        {
            return(null);
        }
        return(byUniqueID.GetArmorModel(slot));
    }
Esempio n. 5
0
    protected void uLink_OnNetworkInstantiate(uLink.NetworkMessageInfo info)
    {
        this._parentViewID = info.networkView.initialData.ReadNetworkViewID();
        int num = info.networkView.initialData.ReadInt32();

        this._datablock = (HeldItemDataBlock)DatablockDictionary.GetByUniqueID(num);
        if (!this.CheckParent())
        {
            Debug.Log("No parent for item rep (yet)", this);
        }
    }
Esempio n. 6
0
    public static TArmorModel GetArmorModelByUniqueID <TArmorModel>(int uniqueID)
        where TArmorModel : ArmorModel, new()
    {
        ArmorDataBlock byUniqueID = DatablockDictionary.GetByUniqueID(uniqueID) as ArmorDataBlock;

        if (!byUniqueID)
        {
            return((TArmorModel)null);
        }
        return(byUniqueID.GetArmorModel <TArmorModel>());
    }
Esempio n. 7
0
    protected void Mods(byte[] data)
    {
        this.ClearMods();
        uLink.BitStream stream = new uLink.BitStream(data, false);
        byte            num    = stream.ReadByte();

        if (num > 0)
        {
            CharacterStateFlags characterStateFlags = this.GetCharacterStateFlags();
            for (int i = 0; i < num; i++)
            {
                ItemModDataBlock byUniqueID = (ItemModDataBlock)DatablockDictionary.GetByUniqueID(stream.ReadInt32());
                this._itemMods.InstallMod(i, this, byUniqueID, characterStateFlags);
                this._modFlags |= byUniqueID.modFlag;
            }
        }
    }
Esempio n. 8
0
    public void ReceiveBoundBPs(byte[] data, uLink.NetworkMessageInfo info)
    {
        this._boundBPs = this._boundBPs ?? new List <BlueprintDataBlock>();
        this._boundBPs.Clear();
        uLink.BitStream bitStream = new uLink.BitStream(data, false);
        int             num       = bitStream.ReadInt32();

        for (int i = 0; i < num; i++)
        {
            ItemDataBlock byUniqueID = DatablockDictionary.GetByUniqueID(bitStream.ReadInt32());
            if (byUniqueID)
            {
                this._boundBPs.Add(byUniqueID as BlueprintDataBlock);
            }
        }
        this.Refresh();
    }
Esempio n. 9
0
        private void Confirm()
        {
            Datablock byName;

            switch (this.type_f & 127)
            {
            case 1:
            {
                byName = (Datablock)this.refValue;
                break;
            }

            case 2:
            {
                byName = ((InventoryItem)this.refValue).datablock;
                break;
            }

            case 3:
            {
                byName = DatablockDictionary.GetByName((string)this.refValue);
                break;
            }

            case 4:
            {
                byName = DatablockDictionary.GetByUniqueID(this.uid);
                break;
            }

            default:
            {
                this = new Datablock.Ident();
                return;
            }
            }
            if (!byName)
            {
                this = new Datablock.Ident();
            }
            else
            {
                this = new Datablock.Ident(byName, byName.uniqueID, 1);
            }
        }
Esempio n. 10
0
    protected override void OnBitStreamRead(uLink.BitStream stream)
    {
        base.OnBitStreamRead(stream);
        this.SetTotalModSlotCount(stream.ReadInvInt());
        this.SetUsedModSlotCount(stream.ReadInvInt());
        int usedModSlots = this.usedModSlots;

        for (int i = 0; i < 5; i++)
        {
            if (i < usedModSlots)
            {
                this._itemMods[i] = DatablockDictionary.GetByUniqueID(stream.ReadInt32()) as ItemModDataBlock;
            }
            else
            {
                this._itemMods[i] = null;
            }
        }
    }
Esempio n. 11
0
    public void ReceiveBoundBPs(byte[] data, uLink.NetworkMessageInfo info)
    {
        if (this._boundBPs == null)
        {
        }
        this._boundBPs = new System.Collections.Generic.List <BlueprintDataBlock>();
        this._boundBPs.Clear();
        uLink.BitStream stream = new uLink.BitStream(data, false);
        int             num    = stream.ReadInt32();

        for (int i = 0; i < num; i++)
        {
            ItemDataBlock byUniqueID = DatablockDictionary.GetByUniqueID(stream.ReadInt32());
            if (byUniqueID != null)
            {
                BlueprintDataBlock item = byUniqueID as BlueprintDataBlock;
                this._boundBPs.Add(item);
            }
        }
        this.Refresh();
    }
Esempio n. 12
0
 protected void SAAM(int footArmorUID, int legArmorUID, int torsoArmorUID, int headArmorUID)
 {
     if (footArmorUID == 0)
     {
         this.footArmor = null;
     }
     else
     {
         this.footArmor = (ArmorDataBlock)DatablockDictionary.GetByUniqueID(footArmorUID);
     }
     if (legArmorUID == 0)
     {
         this.legArmor = null;
     }
     else
     {
         this.legArmor = (ArmorDataBlock)DatablockDictionary.GetByUniqueID(legArmorUID);
     }
     if (torsoArmorUID == 0)
     {
         this.torsoArmor = null;
     }
     else
     {
         this.torsoArmor = (ArmorDataBlock)DatablockDictionary.GetByUniqueID(torsoArmorUID);
     }
     if (headArmorUID == 0)
     {
         this.headArmor = null;
     }
     else
     {
         this.headArmor = (ArmorDataBlock)DatablockDictionary.GetByUniqueID(headArmorUID);
     }
     this.RebindRenderers();
 }
Esempio n. 13
0
 public void StackSizes(int uniqueid, int stacksize)
 {
     DatablockDictionary.GetByUniqueID(uniqueid)._maxUses = stacksize;
 }
Esempio n. 14
0
 protected void PKIS(int itemName)
 {
     this.StoreItemInfo(DatablockDictionary.GetByUniqueID(itemName), 1);
 }
Esempio n. 15
0
 protected void PKIF(int itemName, byte itemAmount)
 {
     this.StoreItemInfo(DatablockDictionary.GetByUniqueID(itemName), (int)itemAmount);
 }