List <Formula> _tier3Formulas; // Formulas that modify other attribute through precentage [ex: dmd=str*0,1] #endregion #region Constructor public CharacterSheet Init(string nameId, string description, Dictionary <string, AttributeTRPG> attributes, SpecTemplate classs, SpecTemplate specialization, List <ItemTemplate> items, List <PassiveTemplate> passives) // Constructs the CharacterSheet { _nameId = nameId; _description = description; _baseAttributes = new Dictionary <string, double>(); foreach (KeyValuePair <string, AttributeTRPG> kv in attributes) { _baseAttributes[kv.Key] = (double)kv.Value.value; } /* * _baseAttributes=new Dictionary<string, IsoUnityBasicType>(); * foreach (var kv in attributes.Values.ToList().ConvertAll(v=>new KeyValuePair<string,object>(v.id,v.value))) * { * var value=IsoUnityTypeFactory.Instance.getIsoUnityType(kv.Value); * _baseAttributes.Add(kv.Key,value as IsoUnityBasicType); #if UNITY_EDITOR * if (Application.isEditor && !Application.isPlaying && (UnityEditor.AssetDatabase.IsMainAsset(this) || UnityEditor.AssetDatabase.IsSubAsset(this))) * { * (value as ScriptableObject).hideFlags = HideFlags.HideInHierarchy; * UnityEditor.AssetDatabase.AddObjectToAsset(value as UnityEngine.Object, this); * } #endif * } */ _class = classs; _specialization = specialization; _items = items; _passives = passives; return(this); }
///-------------------------------------------------------------------------------- /// <summary>This method loads templates from a directory into the view model.</summary> /// /// <param name="directory">The directory to load.</param> /// <param name="refresh">Flag whether to refresh view.</param> ///-------------------------------------------------------------------------------- public void LoadTemplateDirectory(string directory, bool refresh = true) { if (!String.IsNullOrEmpty(directory) && Directory.Exists(directory)) { foreach (string file in Directory.GetFiles(directory, "*.mps")) { SpecTemplate template = new SpecTemplate(); template.TemplateID = Guid.NewGuid(); template.Solution = Solution; template.FilePath = file; template.LoadTemplateFileData(); Solution.SpecTemplates[template.TemplateKey] = template; template.SpecificationDirectory = SpecificationDirectory; AddTemplate(new SpecTemplateViewModel(template, Solution, null, SpecificationDirectory), refresh); } foreach (string subDirectory in Directory.GetDirectories(directory)) { LoadTemplateDirectory(subDirectory, refresh); } } if (refresh == true) { Refresh(true); } }
///-------------------------------------------------------------------------------- /// <summary>This method is used to copy/paste a new item.</summary> /// /// <param name="copyItem">The item to copy/paste.</param> /// <param name="savePaste">Flag to determine whether to save the results of the paste.</param> ///-------------------------------------------------------------------------------- public SpecTemplateViewModel PasteSpecTemplate(SpecTemplateViewModel copyItem, bool savePaste = true) { SpecTemplate newItem = new SpecTemplate(); newItem.ReverseInstance = new SpecTemplate(); newItem.TransformDataFromObject(copyItem.SpecTemplate, null, false); newItem.TemplateID = Guid.NewGuid(); newItem.IsAutoUpdated = false; newItem.Solution = Solution; newItem.Solution = Solution; SpecTemplateViewModel newView = new SpecTemplateViewModel(newItem, Solution); newView.ResetModified(true); AddSpecTemplate(newView); // paste children if (savePaste == true) { Solution.SpecTemplateList.Add(newItem); newView.OnUpdated(this, null); Solution.ResetModified(true); } return(newView); }
private void constructCurrentSpecTemplate() // Constructs a new SpecTemplate according to whatever is shown in the fields. After this // method is finished this SpecTemplate could be added to database as a new SpecTemplate or just // modify one that already exists (in this case destroys the old SpecTemplate in database // and adds the new one) { /* * specTags=new List<string>(); * for (int i=0; i<specTagsCount; i++) * { * string tag=specTagsInDatabaseArray[selectedSpecTag[i]]; * specTags.Add(tag); * } */ specFormulas = new List <Formula>(); for (int i = 0; i < formulaCount; i++) { Formula formula = new Formula(attribsInDatabaseArray[selectedAttribInEachFormula[i]], formulasArray[i], 1); specFormulas.Add(formula); } specAllowedSlots = new SlotsConfig(); List <Dictionary <string, string> > passiveCfg = new List <Dictionary <string, string> >(); List <ItemConfig> itemCfg = new List <ItemConfig>(); List <SpecConfig> specCfg = new List <SpecConfig>(); for (int i = 0; i < slotsCount; i++) { if (slotTypesAllowedArray[selectedTemplateTypeInEachSlot[i]] == "Passive") { Dictionary <string, string> actual = new Dictionary <string, string>(); actual.Add("When", passiveWhenTagsInDatabaseArray[selectedWhenPassive[i]]); actual.Add("To whom", passiveToWhomTagsInDatabaseArray[selectedToWhomPassive[i]]); passiveCfg.Add(actual); } else if (slotTypesAllowedArray[selectedTemplateTypeInEachSlot[i]] == "Item") { ItemConfig ic; ic.itemMask = itemTagMasks[i]; ic.itemIds = itemTagsInDatabaseList; itemCfg.Add(ic); } else if (slotTypesAllowedArray[selectedTemplateTypeInEachSlot[i]] == "Specialization") { SpecConfig sc; sc.specMask = specTagMasks[i]; sc.specIds = specsInDatabaseForSlotsList; specCfg.Add(sc); } } specAllowedSlots.PassiveCfg = passiveCfg; specAllowedSlots.ItemCfg = itemCfg; specAllowedSlots.SpecCfg = specCfg; currentSpecTemplate = new SpecTemplate(specNameId, specDescription, specIsBasicClass, specFormulas, specAllowedSlots); }
private void loadSlotsFromDatabase() { // Getting the list of slot types allowed (Passive, Item) for this ItemTemplate Template t = new SpecTemplate(); slotTypesAllowedList = new List <string>(d.getAllowedSlots(t)); slotTypesAllowedList.Insert(0, "Choose..."); slotTypesAllowedArray = slotTypesAllowedList.ToArray(); // Getting the number of slots every SpecTemplate has slotsCountForEachSpecList = getSlotsCountForEachSpec(); slotsCountForEachSpecArray = slotsCountForEachSpecList.ToArray(); }
///-------------------------------------------------------------------------------- /// <summary>Create the instance with the designer view and other data.</summary> /// /// <param name="specTemplate">The SpecTemplate to load.</param> /// <param name="solution">The associated solution.</param> /// <param name="templateURL">The Template file path.</param> /// <param name="specificationDirectory">The parent specification directory.</param> ///-------------------------------------------------------------------------------- public SpecTemplateViewModel(SpecTemplate specTemplate, Solution solution, string templateURL, string specificationDirectory = null) { WorkspaceID = Guid.NewGuid(); Solution = solution; LoadSpecTemplate(specTemplate); SpecificationDirectory = specificationDirectory; if (!String.IsNullOrEmpty(templateURL)) { SpecTemplate.FilePath = templateURL; } TemplatePath = SpecTemplate.FilePath; IsConfigTabActive = true; }
private void constructCurrentCharacter() // Constructs a new CharacterSheet according to whatever is shown in the fields and lets the CharacterManager // store it { Dictionary <string, AttributeTRPG> actualAttributes = new Dictionary <string, AttributeTRPG>(d.Attributes); // Resetting all attributes to 0 foreach (KeyValuePair <string, AttributeTRPG> attr in actualAttributes) { attr.Value.value = 0; } // Filling basic attributes actualAttributes["EXP"].value = _exp; actualAttributes["HPS"].value = _maxHP; actualAttributes["MPS"].value = _maxMP; // Filling core attributes for (int i = 0; i < _coreAttribsIdList.Count; i++) { actualAttributes[_coreAttribsIdList[i]].value = _coreAttribsValueList[i]; } // Filling the class and specialization SpecTemplate actualClass = d.Specs[_classArray[_selectedClass]]; // SpecTemplate actualClass=ScriptableObject.CreateInstance<SpecTemplate>().Init("Human","Humans are flesh and bones",true,humanFormulas,humanSlotsConfig); SpecTemplate actualSpec = d.Specs[_specArray[_selectedSpec]]; // Filling the items List <ItemTemplate> actualItems = new List <ItemTemplate>(); for (int i = 0; i < _itemSlotsCount; i++) { List <string> auxList = _possibleItemsList[i]; if (_equipedItemsList[i] && auxList[_selectedItemInEachOptionArray[i]] != "<EMPTY>") { actualItems.Add(d.Items[auxList[_selectedItemInEachOptionArray[i]]]); } } // Filling the passives List <PassiveTemplate> actualPassives = new List <PassiveTemplate>(); for (int i = 0; i < _passiveSlotsCount; i++) { List <string> auxList = _possiblePassivesList[i]; if (auxList[_selectedPassiveInEachOptionArray[i]] != "<EMPTY>") { actualPassives.Add(d.Passives[auxList[_selectedPassiveInEachOptionArray[i]]]); } } CharacterSheet actualSheet = ScriptableObject.CreateInstance <CharacterSheet>().Init(_nameId, _description, actualAttributes, actualClass, actualSpec, actualItems, actualPassives); cm.addCharacter(actualSheet); }
public void addDemoCharacters() { #region Player 1 Dictionary <string, AttributeTRPG> actualAttributes1 = new Dictionary <string, AttributeTRPG>(Database.Instance.Attributes); // Resetting all attributes to 0 foreach (KeyValuePair <string, AttributeTRPG> attr in actualAttributes1) { attr.Value.value = 0; } // Filling attributes actualAttributes1["EXP"].value = 0; actualAttributes1["HPS"].value = 100; actualAttributes1["MPS"].value = 50; actualAttributes1["STR"].value = 1; actualAttributes1["INT"].value = 1; actualAttributes1["WIS"].value = 1; actualAttributes1["DEX"].value = 1; actualAttributes1["CON"].value = 1; actualAttributes1["CHA"].value = 1; // Filling the class and specialization SpecTemplate actualClass1 = Database.Instance.Specs["Human"]; SpecTemplate actualSpec1 = Database.Instance.Specs["Swordman"]; // Filling the items List <ItemTemplate> actualItems1 = new List <ItemTemplate>(); actualItems1.Add(Database.Instance.Items["Shield"]); actualItems1.Add(Database.Instance.Items["Trousers"]); actualItems1.Add(Database.Instance.Items["Shirt"]); actualItems1.Add(Database.Instance.Items["Boots"]); actualItems1.Add(Database.Instance.Items["Sword"]); // Filling the passives List <PassiveTemplate> actualPassives1 = new List <PassiveTemplate>(); CharacterSheet actualSheet1 = ScriptableObject.CreateInstance <CharacterSheet>().Init("Aragorn", "King of the humans", actualAttributes1, actualClass1, actualSpec1, actualItems1, actualPassives1); addCharacter(actualSheet1); //Debug.Log("Aragorn added"); #endregion #region Player 2 Dictionary <string, AttributeTRPG> actualAttributes2 = new Dictionary <string, AttributeTRPG>(Database.Instance.Attributes); // Resetting all attributes to 0 foreach (KeyValuePair <string, AttributeTRPG> attr in actualAttributes2) { attr.Value.value = 0; } // Filling attributes actualAttributes2["EXP"].value = 0; actualAttributes2["HPS"].value = 100; actualAttributes2["MPS"].value = 50; actualAttributes2["STR"].value = 2; actualAttributes2["INT"].value = 2; actualAttributes2["WIS"].value = 2; actualAttributes2["DEX"].value = 2; actualAttributes2["CON"].value = 2; actualAttributes2["CHA"].value = 2; // Filling the class and specialization SpecTemplate actualClass2 = Database.Instance.Specs["Human"]; SpecTemplate actualSpec2 = Database.Instance.Specs["Bowman"]; // Filling the items List <ItemTemplate> actualItems2 = new List <ItemTemplate>(); actualItems2.Add(Database.Instance.Items["Trousers"]); actualItems2.Add(Database.Instance.Items["Shirt"]); actualItems2.Add(Database.Instance.Items["Boots"]); actualItems2.Add(Database.Instance.Items["Bow"]); // Filling the passives List <PassiveTemplate> actualPassives2 = new List <PassiveTemplate>(); CharacterSheet actualSheet2 = ScriptableObject.CreateInstance <CharacterSheet>().Init("Robin Hood", "Most famous archer", actualAttributes2, actualClass2, actualSpec2, actualItems2, actualPassives2); addCharacter(actualSheet2); //Debug.Log("Robin Hood added"); #endregion #region Player 3 Dictionary <string, AttributeTRPG> actualAttributes3 = new Dictionary <string, AttributeTRPG>(Database.Instance.Attributes); // Resetting all attributes to 0 foreach (KeyValuePair <string, AttributeTRPG> attr in actualAttributes3) { attr.Value.value = 0; } // Filling attributes actualAttributes3["EXP"].value = 0; actualAttributes3["HPS"].value = 100; actualAttributes3["MPS"].value = 0; actualAttributes3["STR"].value = 0; actualAttributes3["INT"].value = 0; actualAttributes3["WIS"].value = 0; actualAttributes3["DEX"].value = 0; actualAttributes3["CON"].value = 0; actualAttributes3["CHA"].value = 0; // Filling the class and specialization SpecTemplate actualClass3 = Database.Instance.Specs["Dummy"]; SpecTemplate actualSpec3 = Database.Instance.Specs["Light Carrier"]; // Filling the items List <ItemTemplate> actualItems3 = new List <ItemTemplate>(); actualItems3.Add(Database.Instance.Items["Light helmet"]); actualItems3.Add(Database.Instance.Items["Light armor"]); actualItems3.Add(Database.Instance.Items["Light armbands"]); actualItems3.Add(Database.Instance.Items["Light gloves"]); actualItems3.Add(Database.Instance.Items["Light legbands"]); actualItems3.Add(Database.Instance.Items["Light boots"]); // Filling the passives List <PassiveTemplate> actualPassives3 = new List <PassiveTemplate>(); CharacterSheet actualSheet3 = ScriptableObject.CreateInstance <CharacterSheet>().Init("Light dummy", "Ready to be killed", actualAttributes3, actualClass3, actualSpec3, actualItems3, actualPassives3); addCharacter(actualSheet3); //Debug.Log("Light dummy added"); #endregion #region Player 4 Dictionary <string, AttributeTRPG> actualAttributes4 = new Dictionary <string, AttributeTRPG>(Database.Instance.Attributes); // Resetting all attributes to 0 foreach (KeyValuePair <string, AttributeTRPG> attr in actualAttributes4) { attr.Value.value = 0; } // Filling attributes actualAttributes4["EXP"].value = 0; actualAttributes4["HPS"].value = 100; actualAttributes4["MPS"].value = 0; actualAttributes4["STR"].value = 0; actualAttributes4["INT"].value = 0; actualAttributes4["WIS"].value = 0; actualAttributes4["DEX"].value = 0; actualAttributes4["CON"].value = 0; actualAttributes4["CHA"].value = 0; // Filling the class and specialization SpecTemplate actualClass4 = Database.Instance.Specs["Dummy"]; SpecTemplate actualSpec4 = Database.Instance.Specs["Heavy Carrier"]; // Filling the items List <ItemTemplate> actualItems4 = new List <ItemTemplate>(); actualItems4.Add(Database.Instance.Items["Iron helmet"]); actualItems4.Add(Database.Instance.Items["Iron armor"]); actualItems4.Add(Database.Instance.Items["Iron armbands"]); actualItems4.Add(Database.Instance.Items["Iron gloves"]); actualItems4.Add(Database.Instance.Items["Iron legbands"]); actualItems4.Add(Database.Instance.Items["Iron boots"]); // Filling the passives List <PassiveTemplate> actualPassives4 = new List <PassiveTemplate>(); CharacterSheet actualSheet4 = ScriptableObject.CreateInstance <CharacterSheet>().Init("Heavy dummy", "Ready to be killed too", actualAttributes4, actualClass4, actualSpec4, actualItems4, actualPassives4); addCharacter(actualSheet4); //Debug.Log("Heavy dummy added"); #endregion UnityEditor.AssetDatabase.SaveAssets(); //Debug.Log("Character database filled as 'Demo Character Database'!"); }
private void createTestDatabase() // Creates an Example Database for testing purpouses. Typically called from constructor. It follows // the way an user would create things from editor. { // Filling the tags and options fillTags("test"); // Filling core core '_attributes' (exist in every RPG) Attribute experience = new Attribute(true, "EXP", "Experience", "Experience acumulated", 1, 100000000); Attribute hp = new Attribute(true, "HPS", "HealthPoints", "Character health points", 0, 1000); Attribute mp = new Attribute(true, "MPS", "MagicPoints", "Character magic points", 0, 1000); _attributes.Add("EXP", experience); _attributes.Add("HPS", hp); _attributes.Add("MPS", mp); // Filling core '_attributes' (exist in every RPG slitghtly different) Attribute strength = new Attribute(true, "STR", "Strength", "Strength necessary to fisical strikes", 1, 100); Attribute intelligence = new Attribute(true, "INT", "Intelligence", "Intelligence to trade and find things", 1, 100); Attribute wisdom = new Attribute(true, "WIS", "Wisdom", "Wisdom helps you interacting and upgrading things", 1, 100); Attribute dexterity = new Attribute(true, "DEX", "Dexterity", "Dexterity helps in a lot of things", 1, 100); Attribute constitution = new Attribute(true, "CON", "Constitution", "Constitution is for wearing things", 1, 100); Attribute charisma = new Attribute(true, "CHA", "Charisma", "Charisma could save you without using a weapon", 1, 100); _attributes.Add("STR", strength); _attributes.Add("INT", intelligence); _attributes.Add("WIS", wisdom); _attributes.Add("DEX", dexterity); _attributes.Add("CON", constitution); _attributes.Add("CHA", charisma); // Filling derived '_attributes' Attribute level = new Attribute(false, "lvl", "Level", "Character level", 1, 100); Attribute damage = new Attribute(false, "dmg", "Damage", "Base damage for a weapon", 1, 10000); Attribute critical = new Attribute(false, "cri", "Critical", "Chance of a crtical strike", 1, 10000); Attribute trading = new Attribute(false, "tra", "Trading", "Trading capabilities", 1, 10000); Attribute dodging = new Attribute(false, "dod", "Dodging", "Dodging probability", 1, 10000); Attribute defense = new Attribute(false, "def", "Defense", "Defense probability", 1, 10000); Attribute fireDamage = new Attribute(false, "fdg", "Fire damage", "Fire damage for a weapon", 1, 10000); _attributes.Add("lvl", level); _attributes.Add("dmg", damage); _attributes.Add("cri", critical); _attributes.Add("tra", trading); _attributes.Add("dod", dodging); _attributes.Add("def", defense); _attributes.Add("fdg", fireDamage); // Filling '_passives' /* * // Kindness passive * List<Formula> kindnessFormula=new List<Formula>(); * kindnessFormula.Add(new Formula("CHA","CHA+3",1)); * PassiveTemplate kindness=new PassiveTemplate("Kindness","More charisma for being kind",kindnessFormula,null); * passives.Add("kindness",kindness); * // Doping passive * List<Formula> dopingFormula=new List<Formula>(); * dopingFormula.Add(new Formula("HPS","HPS+10",1)); * PassiveTemplate doping=new PassiveTemplate("Doping","Gets a health boost",dopingFormula,null); * passives.Add("doping",doping); * // Tired passive * List<Formula> tiredFormula=new List<Formula>(); * tiredFormula.Add(new Formula("HPS","HPS-10",1)); * PassiveTemplate tired=new PassiveTemplate("Tired","Gets tired",tiredFormula,null); * passives.Add("tired",tired); * // Tenacity passive * List<Formula> tenacityFormula=new List<Formula>(); * tenacityFormula.Add(new Formula("def","STR*2+DEX*3",1)); * PassiveTemplate tenacity=new PassiveTemplate("Tenacity","Resilence to endure strikes",tenacityFormula,null); * passives.Add("tenacity",tenacity); */ // Filling '_items' // Club item List <Formula> clubFormulas = new List <Formula>(); clubFormulas.Add(new Formula("dmg", "2", 1)); List <string> clubTags = new List <string>(); clubTags.Add("Wearable"); clubTags.Add("Weapon"); clubTags.Add("Melee"); clubTags.Add("Common"); SlotsConfig clubSlotsConfig = new SlotsConfig(); ItemTemplate club = new ItemTemplate("Club", "Common melee weapon", clubTags, clubFormulas, clubSlotsConfig); _items.Add("Club", club); // Sword item List <Formula> swordFormulas = new List <Formula>(); swordFormulas.Add(new Formula("DEX", "DEX+3", 1)); swordFormulas.Add(new Formula("dmg", "6", 1)); List <string> swordTags = new List <string>(); swordTags.Add("Wearable"); swordTags.Add("Weapon"); swordTags.Add("Melee"); swordTags.Add("Sword"); SlotsConfig swordSlotsConfig = new SlotsConfig(); List <ItemConfig> listSwordIc = new List <ItemConfig>(); ItemConfig swordIc; swordIc.itemIds = new List <string> { "Wearable", "Weapon", "Melee", "Addon" }; swordIc.itemMask = 4103; listSwordIc.Add(swordIc); swordSlotsConfig.ItemCfg = listSwordIc; ItemTemplate sword = new ItemTemplate("Sword", "Normal sword", swordTags, swordFormulas, swordSlotsConfig); _items.Add("Sword", sword); // Fire Sword item List <Formula> fireSwordFormulas = new List <Formula>(); fireSwordFormulas.Add(new Formula("DEX", "DEX+3", 1)); fireSwordFormulas.Add(new Formula("dmg", "6", 1)); fireSwordFormulas.Add(new Formula("fdg", "3", 1)); List <string> fireSwordTags = new List <string>(); fireSwordTags.Add("Wearable"); fireSwordTags.Add("Weapon"); fireSwordTags.Add("Melee"); fireSwordTags.Add("Sword"); SlotsConfig fireSwordSlotsConfig = new SlotsConfig(); List <ItemConfig> listFireSwordIc = new List <ItemConfig>(); ItemConfig fireSwordIc; fireSwordIc.itemIds = new List <string> { "Wearable", "Weapon", "Melee", "Addon" }; fireSwordIc.itemMask = 4103; listFireSwordIc.Add(fireSwordIc); fireSwordSlotsConfig.ItemCfg = listFireSwordIc; List <Dictionary <string, string> > listFireSwordPc = new List <Dictionary <string, string> >(); Dictionary <string, string> fireSwordPc = new Dictionary <string, string>(); fireSwordPc.Add("When", "Turn"); fireSwordPc.Add("To whom", "Enemy"); listFireSwordPc.Add(fireSwordPc); fireSwordSlotsConfig.PassiveCfg = listFireSwordPc; ItemTemplate fireSword = new ItemTemplate("Fire sword", "Fire sword", fireSwordTags, fireSwordFormulas, fireSwordSlotsConfig); _items.Add("Fire sword", fireSword); // Axe item List <Formula> axeFormulas = new List <Formula>(); axeFormulas.Add(new Formula("dmg", "8", 1)); List <string> axeTags = new List <string>(); axeTags.Add("Wearable"); axeTags.Add("Weapon"); axeTags.Add("Melee"); axeTags.Add("Axe"); SlotsConfig axeSlotsConfig = new SlotsConfig(); List <ItemConfig> listAxeIc = new List <ItemConfig>(); ItemConfig axeIc; axeIc.itemIds = new List <string> { "Wearable", "Weapon", "Melee", "Addon" }; axeIc.itemMask = 4103; listAxeIc.Add(axeIc); axeSlotsConfig.ItemCfg = listAxeIc; ItemTemplate axe = new ItemTemplate("Axe", "Normal axe", axeTags, axeFormulas, axeSlotsConfig); _items.Add("Axe", axe); // Bow item List <Formula> bowFormulas = new List <Formula>(); bowFormulas.Add(new Formula("dmg", "2", 1)); List <string> bowTags = new List <string>(); bowTags.Add("Wearable"); bowTags.Add("Weapon"); bowTags.Add("Ranged"); bowTags.Add("Bow"); SlotsConfig bowSlotsConfig = new SlotsConfig(); List <ItemConfig> listBowIc = new List <ItemConfig>(); ItemConfig bowIc; bowIc.itemIds = new List <string> { "Wearable", "Weapon", "Ranged", "Addon" }; bowIc.itemMask = 4107; listBowIc.Add(bowIc); bowSlotsConfig.ItemCfg = listBowIc; ItemTemplate bow = new ItemTemplate("Bow", "Normal bow", bowTags, bowFormulas, bowSlotsConfig); _items.Add("Bow", bow); // Filling basic 'specs' // Human spec List <Formula> humanFormulas = new List <Formula>(); humanFormulas.Add(new Formula("cri", "STR*3", 1)); humanFormulas.Add(new Formula("tra", "INT*2+WIS*3+CHA", 2)); SlotsConfig humanSlotsConfig = new SlotsConfig(); List <ItemConfig> listHumanIc = new List <ItemConfig>(); ItemConfig humanIc1; humanIc1.itemIds = new List <string> { "Wearable", "Weapon", "Melee" }; humanIc1.itemMask = 7; listHumanIc.Add(humanIc1); ItemConfig humanIc2; humanIc2.itemIds = new List <string> { "Wearable", "Weapon", "Ranged" }; humanIc2.itemMask = 11; listHumanIc.Add(humanIc2); ItemConfig humanIc3; humanIc3.itemIds = new List <string> { "Wearable", "Cloth", "Head" }; humanIc3.itemMask = 49; listHumanIc.Add(humanIc3); ItemConfig humanIc4; humanIc4.itemIds = new List <string> { "Wearable", "Cloth", "Chest" }; humanIc4.itemMask = 81; listHumanIc.Add(humanIc4); ItemConfig humanIc5; humanIc5.itemIds = new List <string> { "Wearable", "Cloth", "Neck" }; humanIc5.itemMask = 145; listHumanIc.Add(humanIc5); ItemConfig humanIc6; humanIc6.itemIds = new List <string> { "Wearable", "Cloth", "Arms" }; humanIc6.itemMask = 273; listHumanIc.Add(humanIc6); ItemConfig humanIc7; humanIc7.itemIds = new List <string> { "Wearable", "Cloth", "Hands" }; humanIc7.itemMask = 529; listHumanIc.Add(humanIc7); ItemConfig humanIc8; humanIc8.itemIds = new List <string> { "Wearable", "Cloth", "Finger" }; humanIc8.itemMask = 1041; listHumanIc.Add(humanIc8); ItemConfig humanIc9; humanIc9.itemIds = new List <string> { "Wearable", "Cloth", "Feet" }; humanIc9.itemMask = 2065; listHumanIc.Add(humanIc9); ItemConfig humanIc10; humanIc10.itemIds = new List <string> { "Wearable", "Cloth", "Legs" }; humanIc10.itemMask = 4113; listHumanIc.Add(humanIc10); humanSlotsConfig.ItemCfg = listHumanIc; SpecTemplate human = new SpecTemplate("Human", "Humans are flesh and bones", true, humanFormulas, humanSlotsConfig); _specs.Add("Human", human); // Elf spec List <Formula> elfFormulas = new List <Formula>(); elfFormulas.Add(new Formula("cri", "cri+1", 1)); elfFormulas.Add(new Formula("tra", "INT*2+WIS*3+CHA", 2)); SlotsConfig elfSlotsConfig = new SlotsConfig(); List <ItemConfig> listElfIc = new List <ItemConfig>(); ItemConfig elfIc1; elfIc1.itemIds = new List <string> { "Wearable", "Weapon", "Melee" }; elfIc1.itemMask = 7; listElfIc.Add(elfIc1); ItemConfig elfIc2; elfIc2.itemIds = new List <string> { "Wearable", "Weapon", "Ranged" }; elfIc2.itemMask = 11; listElfIc.Add(elfIc2); ItemConfig elfIc3; elfIc3.itemIds = new List <string> { "Wearable", "Cloth", "Head" }; elfIc3.itemMask = 49; listElfIc.Add(elfIc3); ItemConfig elfIc4; elfIc4.itemIds = new List <string> { "Wearable", "Cloth", "Chest" }; elfIc4.itemMask = 81; listElfIc.Add(elfIc4); ItemConfig elfIc5; elfIc5.itemIds = new List <string> { "Wearable", "Cloth", "Neck" }; elfIc5.itemMask = 145; listElfIc.Add(elfIc5); ItemConfig elfIc6; elfIc6.itemIds = new List <string> { "Wearable", "Cloth", "Arms" }; elfIc6.itemMask = 273; listElfIc.Add(elfIc6); ItemConfig elfIc7; elfIc7.itemIds = new List <string> { "Wearable", "Cloth", "Hands" }; elfIc7.itemMask = 529; listElfIc.Add(elfIc7); ItemConfig elfIc8; elfIc8.itemIds = new List <string> { "Wearable", "Cloth", "Finger" }; elfIc8.itemMask = 1041; listElfIc.Add(elfIc8); ItemConfig elfIc9; elfIc9.itemIds = new List <string> { "Wearable", "Cloth", "Feet" }; elfIc9.itemMask = 2065; listElfIc.Add(elfIc9); ItemConfig elfIc10; elfIc10.itemIds = new List <string> { "Wearable", "Cloth", "Legs" }; elfIc10.itemMask = 4113; listElfIc.Add(elfIc10); elfSlotsConfig.ItemCfg = listElfIc; SpecTemplate elf = new SpecTemplate("Elf", "Elves have pointy ears", true, elfFormulas, elfSlotsConfig); _specs.Add("Elf", elf); // Orc spec List <Formula> orcFormulas = new List <Formula>(); orcFormulas.Add(new Formula("cri", "STR*10", 1)); orcFormulas.Add(new Formula("tra", "INT*2+WIS*4+CHA*2", 2)); SlotsConfig orcSlotsConfig = new SlotsConfig(); List <ItemConfig> listOrcIc = new List <ItemConfig>(); ItemConfig orcIc1; orcIc1.itemIds = new List <string> { "Wearable", "Weapon", "Melee" }; orcIc1.itemMask = 7; listOrcIc.Add(orcIc1); ItemConfig orcIc2; orcIc2.itemIds = new List <string> { "Wearable", "Weapon", "Ranged" }; orcIc2.itemMask = 11; listOrcIc.Add(orcIc2); ItemConfig orcIc3; orcIc3.itemIds = new List <string> { "Wearable", "Cloth", "Head" }; orcIc3.itemMask = 49; listOrcIc.Add(orcIc3); ItemConfig orcIc4; orcIc4.itemIds = new List <string> { "Wearable", "Cloth", "Chest" }; orcIc4.itemMask = 81; listOrcIc.Add(orcIc4); ItemConfig orcIc5; orcIc5.itemIds = new List <string> { "Wearable", "Cloth", "Neck" }; orcIc5.itemMask = 145; listOrcIc.Add(orcIc5); ItemConfig orcIc6; orcIc6.itemIds = new List <string> { "Wearable", "Cloth", "Arms" }; orcIc6.itemMask = 273; listOrcIc.Add(orcIc6); ItemConfig orcIc7; orcIc7.itemIds = new List <string> { "Wearable", "Cloth", "Hands" }; orcIc7.itemMask = 529; listOrcIc.Add(orcIc7); ItemConfig orcIc8; orcIc8.itemIds = new List <string> { "Wearable", "Cloth", "Finger" }; orcIc8.itemMask = 1041; listOrcIc.Add(orcIc8); ItemConfig orcIc9; orcIc9.itemIds = new List <string> { "Wearable", "Cloth", "Feet" }; orcIc9.itemMask = 2065; listOrcIc.Add(orcIc9); ItemConfig orcIc10; orcIc10.itemIds = new List <string> { "Wearable", "Cloth", "Legs" }; orcIc10.itemMask = 4113; listOrcIc.Add(orcIc10); orcSlotsConfig.ItemCfg = listOrcIc; SpecTemplate orc = new SpecTemplate("Orc", "Orcs are typically green and ugly", true, orcFormulas, orcSlotsConfig); _specs.Add("Orc", orc); // Filling derived 'specs' // Swordman spec List <Formula> swordmanFormulas = new List <Formula>(); swordmanFormulas.Add(new Formula("dod", "CON*3", 1)); SlotsConfig swordmanSlotsConfig = new SlotsConfig(); List <ItemConfig> listSwordmanIc = new List <ItemConfig>(); ItemConfig swordmanIc1; swordmanIc1.itemIds = new List <string> { "Wearable", "Weapon", "Melee", "Sword" }; swordmanIc1.itemMask = 65543; listSwordmanIc.Add(swordmanIc1); swordmanSlotsConfig.ItemCfg = listSwordmanIc; SpecTemplate swordman = new SpecTemplate("Swordman", "Swordman is a human/elf spec in which they can use swords", false, swordmanFormulas, swordmanSlotsConfig); _specs.Add("Swordman", swordman); Debug.Log("Test database created!"); }