private void load_hero_build(HabProperties hpsHero) { // set level Current.unit.Level = hpsHero.GetIntValue("Level"); // set stats Current.unit.set_naked_attr(PrimAttrType.Str, hpsHero.GetIntValue("Str")); Current.unit.set_naked_attr(PrimAttrType.Agi, hpsHero.GetIntValue("Agi")); Current.unit.set_naked_attr(PrimAttrType.Int, hpsHero.GetIntValue("Int")); // get aquisition order HabPropertiesCollection hpcAcquisition = hpsHero.GetHpcValue("acquisition"); // items List <string> items = hpsHero.GetStringListValue("items"); // abilities List <string> abilities = hpsHero.GetStringListValue("abilities"); // process acquisition order // make sure triggers will not screw things up Current.unit.Inventory.DisableMessages(); for (int i = 0; i < hpcAcquisition.Count; i++) { HabProperties hpsAcquired = hpcAcquisition[i + ""]; string codeID = hpsAcquired.GetStringValue("codeID"); if (items.Contains(codeID)) { Current.unit.Inventory.put_item(new item(codeID), hpsAcquired.GetIntValue("slot")); } else if (abilities.Contains(codeID)) { DBABILITY ability = Current.unit.heroAbilities.GetByAlias(codeID); int level = hpsAcquired.GetIntValue("level"); for (int j = 1; j <= level; j++) { ability.Level = j; } } } // restore original state Current.unit.Inventory.EnableMessages(); UpdateHeroLeveling(); }
private void load_hero_build(HabProperties hpsHero) { // set level Current.unit.Level = hpsHero.GetIntValue("Level"); // set stats Current.unit.set_naked_attr(PrimAttrType.Str, hpsHero.GetIntValue("Str")); Current.unit.set_naked_attr(PrimAttrType.Agi, hpsHero.GetIntValue("Agi")); Current.unit.set_naked_attr(PrimAttrType.Int, hpsHero.GetIntValue("Int")); // get aquisition order HabPropertiesCollection hpcAcquisition = hpsHero.GetHpcValue("acquisition"); // items List<string> items = hpsHero.GetStringListValue("items"); // abilities List<string> abilities = hpsHero.GetStringListValue("abilities"); // process acquisition order // make sure triggers will not screw things up Current.unit.Inventory.DisableMessages(); for (int i = 0; i < hpcAcquisition.Count; i++) { HabProperties hpsAcquired = hpcAcquisition[i + ""]; string codeID = hpsAcquired.GetStringValue("codeID"); if (items.Contains(codeID)) Current.unit.Inventory.put_item(new item(codeID), hpsAcquired.GetIntValue("slot")); else if (abilities.Contains(codeID)) { DBABILITY ability = Current.unit.heroAbilities.GetByAlias(codeID); int level = hpsAcquired.GetIntValue("level"); for (int j = 1; j <= level; j++) ability.Level = j; } } // restore original state Current.unit.Inventory.EnableMessages(); UpdateHeroLeveling(); }