public CraftedEquipment(CraftedEquipment template) : base()
    {
        minLevelReq     = template.minLevelReq;
        maxLevelReq     = template.maxLevelReq;
        dexterityMin    = template.dexterityMin;
        dexterityMax    = template.dexterityMax;
        intelligenceMin = template.intelligenceMin;
        intelligenceMax = template.intelligenceMax;
        mightMin        = template.mightMin;
        mightMax        = template.mightMax;
        baseName        = template.baseName;
        //tarType = template.tarType;

        ItemName     = template.baseName;
        Dexterity    = UnityEngine.Random.Range(template.dexterityMin, template.dexterityMax);
        Might        = UnityEngine.Random.Range(template.dexterityMin, template.dexterityMax);
        Intelligence = UnityEngine.Random.Range(template.dexterityMin, dexterityMax);
        LevelReq     = UnityEngine.Random.Range(template.minLevelReq, template.maxLevelReq);
        bonusHealth  = UnityEngine.Random.Range(template.minBonusHealth, template.maxBonusHealth);

        Intelligence = Mathf.Clamp(Intelligence, 0, 999999);
        Might        = Mathf.Clamp(Might, 0, 999999);
        Dexterity    = Mathf.Clamp(Dexterity, 0, 999999);
        Icon         = null;
    }
Esempio n. 2
0
 public void CopyStats(CraftedEquipment original)
 {
     Debug.Log("Creating: " + original.ItemName);
     name         = original.ItemName;
     might        = UnityEngine.Random.Range(original.mightMin, original.mightMax);
     intelligence = UnityEngine.Random.Range(original.intelligenceMin, original.intelligenceMax);
     dexterity    = UnityEngine.Random.Range(original.dexterityMin, original.dexterityMax);
     levelReq     = UnityEngine.Random.Range(original.minLevelReq, original.maxLevelReq);
     bonusHealth  = UnityEngine.Random.Range(original.minBonusHealth, original.maxBonusHealth);
     perks        = original.perks;
 }
Esempio n. 3
0
 public CraftedWeapon(CraftedEquipment template) : base(template)
 {
     itemType = CraftedItemType.WEAPON;
     tarType  = (template as CraftedWeapon).tarType;
 }
Esempio n. 4
0
    public void UpdateProfessionInterface()
    {
        if (currentSelectedItem != null && (currentSelectedItem.MyCraftedItemType == CraftedItemType.WEAPON || currentSelectedItem.MyCraftedItemType == CraftedItemType.ARMOR))
        {
            CraftedEquipment item2 = (currentSelectedItem as CraftedEquipment);
            if (item2 == null)
            {
                return;
            }

            SelectedItem.Find("Background/AttributeBG/Top/ItemValues").GetComponent <Text>().text = item2.dexterityMin + " - " + item2.dexterityMax + "\n" + item2.mightMin + " - " + item2.mightMax + "\n" + item2.intelligenceMin + " - " + item2.intelligenceMax + "\n";
            if (currentSelectedItem.MyCraftedItemType == CraftedItemType.ARMOR)
            {
                SelectedItem.Find("Background/Icon").GetComponent <Image>().sprite = item2.Icon;
            }
            else if (currentSelectedItem.MyCraftedItemType == CraftedItemType.WEAPON)
            {
                SelectedItem.Find("Background/Icon").GetComponent <Image>().sprite = (currentSelectedItem as CraftedWeapon).Icon;
            }

            ClearCraftingReagents();
            Transform reagentTransform = SelectedItem.Find("Background/AttributeBG/Bottom");
            SelectedItem.Find("Background/Actions/CraftButton").GetComponent <Button>().interactable = true;
            foreach (Reagent r in item2.RequiredReagents)
            {
                GameObject cardRef      = Instantiate(reagentCard, reagentTransform, false);
                int        ownedReagent = Player_Accessor_Script.InventoryScript.GetResourceQuantity(r.ReagentName);
                if (ownedReagent > -1)
                {
                    Text nameComp     = cardRef.transform.Find("Name").GetComponent <Text>();
                    Text quantityComp = cardRef.transform.Find("Quantity").GetComponent <Text>();
                    nameComp.text     = r.ReagentName;
                    quantityComp.text = ownedReagent + "/" + r.ReagentQuantity;
                    SelectedItem.Find("Background/Actions/CraftButton").GetComponent <Button>().interactable = true;

                    if (ownedReagent < r.ReagentQuantity)
                    {
                        nameComp.color     = Color.red;
                        quantityComp.color = Color.red;
                        SelectedItem.Find("Background/Actions/CraftButton").GetComponent <Button>().interactable = false;
                    }
                }
                else
                {
                    Text nameComp     = cardRef.transform.Find("Name").GetComponent <Text>();
                    Text quantityComp = cardRef.transform.Find("Quantity").GetComponent <Text>();
                    nameComp.color     = Color.red;
                    nameComp.text      = "???";
                    quantityComp.color = Color.red;
                    quantityComp.text  = 0 + "/" + r.ReagentQuantity;
                    SelectedItem.Find("Background/Actions/CraftButton").GetComponent <Button>().interactable = false;
                }
            }
        }
        else if (currentSelectedItem != null && currentSelectedItem.MyCraftedItemType == CraftedItemType.REAGENT)
        {
            CraftableReagent item2 = (currentSelectedItem as CraftableReagent);
            if (item2 == null)
            {
                return;
            }

            SelectedItem.Find("Background/AttributeBG/Top/ItemValues").GetComponent <Text>().text = "";
            SelectedItem.Find("Background/Icon").GetComponent <Image>().sprite = item2.Icon;
            ClearCraftingReagents();
            Transform reagentTransform = SelectedItem.Find("Background/AttributeBG/Bottom");
            SelectedItem.Find("Background/Actions/CraftButton").GetComponent <Button>().interactable = true;

            foreach (Reagent r in item2.RequiredReagents)
            {
                GameObject cardRef      = Instantiate(reagentCard, reagentTransform, false);
                int        ownedReagent = Player_Accessor_Script.InventoryScript.GetResourceQuantity(r.ReagentName);
                if (ownedReagent > -1)
                {
                    Text nameComp     = cardRef.transform.Find("Name").GetComponent <Text>();
                    Text quantityComp = cardRef.transform.Find("Quantity").GetComponent <Text>();
                    nameComp.text     = r.ReagentName;
                    quantityComp.text = ownedReagent + "/" + r.ReagentQuantity;
                    SelectedItem.Find("Background/Actions/CraftButton").GetComponent <Button>().interactable = true;

                    if (ownedReagent < r.ReagentQuantity)
                    {
                        nameComp.color     = Color.red;
                        quantityComp.color = Color.red;
                        SelectedItem.Find("Background/Actions/CraftButton").GetComponent <Button>().interactable = false;
                    }
                }
                else
                {
                    print(r.ReagentName);
                    Text nameComp     = cardRef.transform.Find("Name").GetComponent <Text>();
                    Text quantityComp = cardRef.transform.Find("Quantity").GetComponent <Text>();
                    nameComp.color     = Color.red;
                    nameComp.text      = "???";
                    quantityComp.color = Color.red;
                    quantityComp.text  = 0 + "/" + r.ReagentQuantity;
                    SelectedItem.Find("Background/Actions/CraftButton").GetComponent <Button>().interactable = false;
                }
            }
        }
    }
Esempio n. 5
0
    public void SaveDesign()
    {
        int ind = craftingController.CraftableItems.IndexOf(currItem);

        if (displayAltPane && currItem != null)
        {
            currItem.MyCraftedItemType = CraftedItemType.REAGENT;
        }

        if (!displayAltPane || (currItem != null && (currItem.MyCraftedItemType == CraftedItemType.WEAPON || currItem.MyCraftedItemType == CraftedItemType.ARMOR)))
        {
            Transform mainItemPane = recipeCreatorTransform.Find("ContentBG/ItemTab");
            if (mainItemPane.Find("Name/Name").GetComponent <InputField>().text == "")
            {
                return;
            }

            CraftedEquipment itemRecipe = null;
            if (currItem == null)
            {
                itemRecipe = new CraftedEquipment();
            }
            else
            {
                if (currItem.MyCraftedItemType == CraftedItemType.WEAPON)
                {
                    itemRecipe = currItem as CraftedWeapon;
                }
                else if (currItem.MyCraftedItemType == CraftedItemType.ARMOR)
                {
                    itemRecipe = currItem as CraftedArmor;
                }
            }

            Dropdown dropList = mainItemPane.Find("ItemType").GetComponent <Dropdown>();
            if (dropList.GetComponent <UI_WeaponType_Controller>().displayingWeapons)
            {
                itemRecipe.MyCraftedItemType = CraftedItemType.WEAPON;
            }
            else
            {
                itemRecipe.MyCraftedItemType = CraftedItemType.ARMOR;
            }

            if (itemRecipe.MyCraftedItemType == CraftedItemType.ARMOR)
            {
                itemRecipe = new CraftedArmor();
                (itemRecipe as CraftedArmor).tarType = ArmorTypeParse(dropList.options[dropList.value].text);
            }
            else if (itemRecipe.MyCraftedItemType == CraftedItemType.WEAPON)
            {
                itemRecipe = new CraftedWeapon();
                (itemRecipe as CraftedWeapon).tarType = WeaponTypeParse(dropList.options[dropList.value].text);
            }

            itemRecipe.ItemName        = mainItemPane.Find("Name/Name").GetComponent <InputField>().text;
            itemRecipe.baseName        = mainItemPane.Find("Name/Name").GetComponent <InputField>().text;
            itemRecipe.dexterityMin    = int.Parse(mainItemPane.Find("Dexterity/Min").GetComponent <InputField>().text);
            itemRecipe.dexterityMax    = int.Parse(mainItemPane.Find("Dexterity/Max").GetComponent <InputField>().text);
            itemRecipe.mightMin        = int.Parse(mainItemPane.Find("Might/Min").GetComponent <InputField>().text);
            itemRecipe.mightMax        = int.Parse(mainItemPane.Find("Might/Max").GetComponent <InputField>().text);
            itemRecipe.intelligenceMin = int.Parse(mainItemPane.Find("Intelligence/Min").GetComponent <InputField>().text);
            itemRecipe.intelligenceMax = int.Parse(mainItemPane.Find("Intelligence/Max").GetComponent <InputField>().text);
            itemRecipe.minLevelReq     = int.Parse(mainItemPane.Find("LevelRange/Min").GetComponent <InputField>().text);
            itemRecipe.maxLevelReq     = int.Parse(mainItemPane.Find("LevelRange/Max").GetComponent <InputField>().text);
            itemRecipe.minBonusHealth  = int.Parse(mainItemPane.Find("Health/Min").GetComponent <InputField>().text);
            itemRecipe.maxBonusHealth  = int.Parse(mainItemPane.Find("Health/Max").GetComponent <InputField>().text);

            dropList = mainItemPane.Find("ProfGroup/ProfessionType").GetComponent <Dropdown>();
            itemRecipe.RequiredProfession = Player_Skills_Script.ConvertStringToSkill(dropList.options[dropList.value].text);
            if (itemRecipe.RequiredProfession == Skills.None)
            {
                print("Failed to find skill for: " + itemRecipe.ItemName);
            }
            itemRecipe.RequiredProfLevel = int.Parse(mainItemPane.Find("ProfGroup/RequiredLevel").GetComponent <InputField>().text);
            itemRecipe.RewardedExp       = int.Parse(mainItemPane.Find("ProfGroup/RewardedExp").GetComponent <InputField>().text);
            reagentController.SaveReagentList();
            itemRecipe.RequiredReagents = new List <Reagent>();
            itemRecipe.RequiredReagents = reagentController.reagentList;
            itemRecipe.perks            = activePerks;
            currItem = itemRecipe;
        }
        else if (displayAltPane || currItem.MyCraftedItemType == CraftedItemType.REAGENT)
        {
            Transform        mainItemPane = recipeCreatorTransform.Find("ReagentBG/ItemTab");
            CraftableReagent tempReagent  = new CraftableReagent();

            tempReagent.ItemName          = mainItemPane.Find("Name/Name").GetComponent <InputField>().text;
            tempReagent.RewardedExp       = int.Parse(mainItemPane.Find("ProfGroup/RewardedExp").GetComponent <InputField>().text);
            tempReagent.RequiredProfLevel = int.Parse(mainItemPane.Find("ProfGroup/RequiredLevel").GetComponent <InputField>().text);

            Dropdown dropList = mainItemPane.Find("ProfGroup/ProfessionType").GetComponent <Dropdown>();
            tempReagent.RequiredProfession = Player_Skills_Script.ConvertStringToSkill(dropList.options[dropList.value].text);

            tempReagent.SpritePath = mainItemPane.Find("SpriteIcon/InputField").GetComponent <InputField>().text;
            reagentController.availableReagents.Add(tempReagent);
            tempReagent.RequiredReagents = reagentController.reagentList;
            currItem = tempReagent;
            reagentController.SaveReagentList();
        }

        if (ind == -1)
        {
            if (currItem.MyCraftedItemType != CraftedItemType.REAGENT)
            {
                craftingController.CraftableItems.Add(currItem);
            }
            else
            {
                if (!craftingController.CraftableReagents.Contains(currItem as CraftableReagent))
                {
                    craftingController.CraftableReagents.Add(currItem as CraftableReagent);
                }
            }
        }
        else
        {
            craftingController.CraftableItems[ind] = currItem;
        }
        craftingController.SaveRecipes();
        LoadDesignList();
        ClearTemplate();
    }
Esempio n. 6
0
	public CraftedArmor(CraftedEquipment template) : base(template)
	{
		itemType = CraftedItemType.ARMOR;
		tarType = (template as CraftedArmor).tarType;
	}