示例#1
0
        public static ItemData Map(ItemManager.ItemData itemData)
        {
            var mappedData = new ItemData();

            return(mappedData);
        }
示例#2
0
        public static void AddNewItem()
        {
            int    itemNumber    = 30;
            int    newitemNumber = 147;
            string itemName      = "Grenade V2";

            ItemManager.ItemData sourceItem = Manager.GetItemManager().GetAllItems().Where(i => i.m_ID == itemNumber).First();

            ItemManager.ItemData newItem = new ItemManager.ItemData();

            newItem.m_ID           = newitemNumber;
            newItem.m_FriendlyName = itemName;
            //energyGeneratorV2.m_AbilityIDs.Add();
            //energyGeneratorV2.m_LocName = "Energy Generator V3";

            try { newItem.m_AbilityIDs = sourceItem.m_AbilityIDs.ToList(); } catch { }
            try { newItem.m_AbilityMasks = sourceItem.m_AbilityMasks.ToList(); } catch { }
            try { newItem.m_BlueprintCost = sourceItem.m_BlueprintCost; } catch { }
            try { newItem.m_Cost = sourceItem.m_Cost; } catch { }
            try { newItem.m_GearSubCategory = sourceItem.m_GearSubCategory; } catch { }
            try { newItem.m_MinResearchersRequired = sourceItem.m_MinResearchersRequired; } catch { }
            try { newItem.m_Modifiers = sourceItem.m_Modifiers.ToArray(); } catch { }
            try { newItem.m_PrereqID = sourceItem.m_PrereqID; } catch { }
            try { newItem.m_Slot = sourceItem.m_Slot; } catch { }
            try { newItem.m_UIIcon = sourceItem.m_UIIcon; } catch { }
            try { newItem.m_BlueprintProgressionValue = sourceItem.m_BlueprintProgressionValue; } catch { }
            try { newItem.m_CurrentResearchCost = sourceItem.m_CurrentResearchCost; } catch { }
            try { newItem.m_Expanded = sourceItem.m_Expanded; } catch { }
            try { newItem.m_FindBlueprintCost = sourceItem.m_FindBlueprintCost; } catch { }
            try { newItem.m_FindPrototypeCost = sourceItem.m_FindPrototypeCost; } catch { }
            try { newItem.m_OverrideAmmo = sourceItem.m_OverrideAmmo; } catch { }
            try { newItem.m_PlayerCanResearchFromStart = sourceItem.m_PlayerCanResearchFromStart; } catch { }
            try { newItem.m_Progression = sourceItem.m_Progression; } catch { }
            try { newItem.m_PrototypeCost = sourceItem.m_PrototypeCost; } catch { }
            try { newItem.m_PrototypeIsInTheWorld = sourceItem.m_PrototypeIsInTheWorld; } catch { }
            try { newItem.m_PrototypeProgressionValue = sourceItem.m_PrototypeProgressionValue; } catch { }
            try { newItem.m_PrototypeRandomReleaseStage = sourceItem.m_PrototypeRandomReleaseStage; } catch { }
            try { newItem.m_ResearchCost = sourceItem.m_ResearchCost; } catch { }
            try { newItem.m_ResearchDataPoints = sourceItem.m_ResearchDataPoints; } catch { }
            try { newItem.m_StealthVsCombat = sourceItem.m_StealthVsCombat; } catch { }
            try { newItem.m_ValidWeaponAugmentationWeaponMask = sourceItem.m_ValidWeaponAugmentationWeaponMask; } catch { }
            try { newItem.m_WeaponType = sourceItem.m_WeaponType; } catch { }
            try {  } catch { }
            try {  } catch { }
            try {  } catch { }
            try {  } catch { }
            try {  } catch { }
            try {  } catch { }
            try {  } catch { }
            try {  } catch { }
            try {  } catch { }

            var langLookup = TextManager.Get().GetFieldValue <Dictionary <string, TextManager.LocElement> >("m_FastLanguageLookup");
            var name       = langLookup.Where(l => l.Key == $"ITEM_{itemNumber}_NAME").First().Value;
            var company    = langLookup.Where(l => l.Key == $"ITEM_{itemNumber}_COMPANY").First().Value;
            var desc       = langLookup.Where(l => l.Key == $"ITEM_{itemNumber}_DESCRIPTION").First().Value;

            TextManager.LocElement newItemName = new TextManager.LocElement();
            newItemName.m_token           = $"ITEM_{newitemNumber}_NAME";
            newItemName.m_Translations    = name.m_Translations.ToArray();
            newItemName.m_Translations[2] = itemName;
            langLookup.Add(newItemName.m_token, newItemName);

            try
            {
                TextManager.LocElement newItemCompany = new TextManager.LocElement();
                newItemCompany.m_token        = $"ITEM_{newitemNumber}_COMPANY";
                newItemCompany.m_Translations = company.m_Translations.ToArray();
                langLookup.Add(newItemCompany.m_token, newItemCompany);
            }
            catch { }

            newItem.m_PlayerHasPrototype  = true;
            newItem.m_PlayerHasBlueprints = true;
            newItem.m_Count = 5;

            TextManager.LocElement newItemDescription = new TextManager.LocElement();
            newItemDescription.m_token           = $"ITEM_{newitemNumber}_DESCRIPTION";
            newItemDescription.m_Translations    = desc.m_Translations.ToArray();
            newItemDescription.m_Translations[2] = @"Grenade V2 now with even more bang.";
            langLookup.Add(newItemDescription.m_token, newItemDescription);

            Manager.GetItemManager().m_ItemDefinitions.Add(newItem);
        }