public Armor(StatsSet set) : base(set) { Type = Utilz.GetEnumFromString(set.GetString("armor_type", "none"), ArmorTypeId.None); AvoidModifier = set.GetInt("avoid_modify"); Pdef = set.GetInt("p_def"); Mdef = set.GetInt("m_def"); MpBonus = set.GetInt("mp_bonus"); HpBonus = set.GetInt("hp_bonus"); int bodyPart = BodyPart; if ((bodyPart == SlotNeck) || (bodyPart == SlotFace) || (bodyPart == SlotHair) || (bodyPart == SlotHairall) || ((bodyPart & SlotREar) != 0) || ((bodyPart & SlotLFinger) != 0) || ((bodyPart & SlotBack) != 0)) { Type1 = Type1WeaponRingEarringNecklace; Type2 = Type2Accessory; } else { if ((Type == ArmorType.None.Id) && (BodyPart == SlotLHand)) // retail define shield as NONE { Type = ArmorType.Shield.Id; } Type1 = Type1ShieldArmor; Type2 = Type2ShieldArmor; } }
protected ItemTemplate(StatsSet set) { ItemId = set.GetInt("item_id"); Name = set.GetString("name"); Type1 = set.GetInt("type1"); Type2 = set.GetInt("type2"); Weight = set.GetInt("weight"); MaterialType = (MaterialType)set.GetInt("material"); Duration = set.GetInt("duration", -1); BodyPart = ItemTable.Instance.Slots[set.GetString("bodypart", "none")]; ReferencePrice = set.GetInt("price"); CrystalType = CrystalType.Values.FirstOrDefault(x => x.Id == (CrystalTypeId)set.GetInt("crystal_type")); _crystalCount = set.GetInt("crystal_count"); Stackable = set.GetBool("stackable"); Sellable = set.GetBool("sellable", true); Dropable = set.GetBool("dropable", true); Destroyable = set.GetBool("destroyable", true); Tradable = set.GetBool("tradeable", true); //Depositable = set.GetBool("is_depositable", true); HeroItem = ((ItemId >= 6611) && (ItemId <= 6621)) || (ItemId == 6842); //IsOlyRestricted = set.GetBool("is_oly_restricted"); //DefaultAction = (ActionType)set.GetInt("default_action"); }
public CharTemplate(StatsSet set) { BaseStr = set.GetInt("str", 40); BaseCon = set.GetInt("con", 21); BaseDex = set.GetInt("dex", 30); BaseInt = set.GetInt("int", 20); BaseWit = set.GetInt("wit", 43); BaseMen = set.GetInt("men", 20); _baseHpMax = set.GetDouble("hp"); _baseMpMax = set.GetDouble("mp"); BaseHpReg = set.GetDouble("hpRegen", 1.5d); BaseMpReg = set.GetDouble("mpRegen", 0.9d); BasePAtk = set.GetDouble("pAtk"); BaseMAtk = set.GetDouble("mAtk"); BasePDef = set.GetDouble("pDef"); BaseMDef = set.GetDouble("mDef"); BasePAtkSpd = set.GetInt("atkSpd", 300); BaseCritRate = set.GetInt("crit", 4); BaseWalkSpd = set.GetInt("walkSpd"); BaseRunSpd = set.GetInt("runSpd", 1); CollisionRadius = set.GetInt("radius"); CollisionHeight = set.GetInt("height"); }
private void initialize() { Upgrade defaultState = new Upgrade(); StatsSet firstUpgrade = buildUpgradeStats(120, 10.0f, 0.0f, 0.0f, 75.0f); addGraphicsUpdate(firstUpgrade, 0, Color.yellow); addGraphicsUpdate(firstUpgrade, 3, Color.yellow); addGraphicsUpdate(firstUpgrade, 4, Color.yellow); Upgrade FU = new Upgrade(firstUpgrade); StatsSet secondUpgrade = buildUpgradeStats(150, 15.0f, 0.0f, 0.1f, 100.0f); addGraphicsUpdate(secondUpgrade, 0, Color.red); addGraphicsUpdate(secondUpgrade, 3, Color.red); addGraphicsUpdate(secondUpgrade, 4, Color.red); Upgrade SU = new Upgrade(secondUpgrade); Upgrade[] cannonTowerUpgrades = { defaultState, FU, SU }; _towerUpgrades.Add("Torre Cañón", cannonTowerUpgrades); }
public static void Initialize() { XmlDocument doc = new XmlDocument(); string[] xmlFilesArray = Directory.GetFiles(@"data\xml\npcs\"); try { StatsSet set = new StatsSet(); foreach (string i in xmlFilesArray) { doc.Load(i); XmlNodeList nodes = doc.DocumentElement?.SelectNodes("/list/npc"); if (nodes == null) { continue; } foreach (XmlNode node in nodes) { XmlElement ownerElement = node.Attributes?[0].OwnerElement; if (ownerElement != null && node.Attributes != null && ownerElement.Name == "npc") { XmlNamedNodeMap attrs = node.Attributes; int npcId = int.Parse(attrs.GetNamedItem("id").Value); int templateId = attrs.GetNamedItem("idTemplate") == null ? npcId : int.Parse(attrs.GetNamedItem("idTemplate").Value); set.Set("id", npcId); set.Set("idTemplate", templateId); set.Set("name", attrs.GetNamedItem("name").Value); set.Set("title", attrs.GetNamedItem("title").Value); foreach (XmlNode innerData in node.ChildNodes) { if (innerData.Attributes["name"] != null && innerData.Attributes["val"] != null) { string value = innerData.Attributes["val"].Value; string name = innerData.Attributes["name"].Value; set.Set(name, value); } } _npcs.Add(npcId, new NpcTemplate(set)); } set.Clear(); } } Log.Info($"Loaded {_npcs.Count} npcs."); } catch (Exception e) { Log.Error(e, "Error parsing NPC templates: "); } }
public void TestMethod1() { //const string folderPath = @"./data/xml/classes"; //foreach (string file in Directory.EnumerateFiles(folderPath, "*.xml")) //{ // //string contents = File.ReadAllText(file); //} XmlDocument doc = new XmlDocument(); string[] xmlFilesArray = Directory.GetFiles(@"data\xml\classes\"); foreach (string i in xmlFilesArray) { doc.Load(i); XmlNodeList nodes = doc.DocumentElement?.SelectNodes("/list/class"); if (nodes == null) { continue; } foreach (XmlNode node in nodes) { XmlElement ownerElement = node.Attributes?[0].OwnerElement; if ((ownerElement == null) || !"class".Equals(ownerElement.Name)) { continue; } //ClassIds classId = (ClassIds)int.Parse(attrs.Item(0).Value); StatsSet set = new StatsSet(); for (XmlNode cd = node.FirstChild; cd != null; cd = cd.NextSibling) { if ((cd.NextSibling != null) && "set".Equals(cd.NextSibling.Name) && (cd.NextSibling != null)) { XmlNamedNodeMap attrs = cd.NextSibling.Attributes; if (attrs == null) { continue; } string name = attrs.GetNamedItem("name").Value; string value = attrs.GetNamedItem("val").Value; set.Set(name, value); } else { break; } } ////PcTemplate pcTempl = new PcTemplate(classId, set); ////templates.Add((int)pcTempl.ClassId, pcTempl); //System.Diagnostics.Trace.WriteLine($"Added template for: {pcTempl.ClassId}"); } } }
public CreatureTemplate(StatsSet set) { _name = set.getString("name"); _resourceRelativePath = set.getString("relativeModelPath"); _bounds.size = new Vector3(0, 0, 0); _assetSource = Resources.Load("Models/" + _resourceRelativePath); }
public Upgrade(StatsSet set) { _price = set.getInt("price"); _attackBoost = set.getFloat("attackBoost"); _attackSpeedBoost = set.getFloat("speedBoost"); _rangeBoost = set.getFloat("rangeBoost"); _healthBoost = set.getFloat("healthBoost"); _newAmmunition = set.getObject("ammunition") as Ammunition; _graphicsUpgrade = set.getObject("graphicsUpgrade") as Dictionary <int, Color>; }
public void Initialize() { XmlDocument doc = new XmlDocument(); string[] xmlFilesArray = Directory.GetFiles(@"data\xml\classes\"); foreach (string i in xmlFilesArray) { doc.Load(i); XmlNodeList nodes = doc.DocumentElement?.SelectNodes("/list/class"); if (nodes == null) { continue; } foreach (XmlNode node in nodes) { XmlElement ownerElement = node.Attributes?[0].OwnerElement; if ((ownerElement == null) || (node.Attributes == null) || !"class".Equals(ownerElement.Name)) { continue; } XmlNamedNodeMap attrs = node.Attributes; ClassId classId = ClassId.Values.FirstOrDefault(x => ((int)x.Id).Equals(Convert.ToInt32(attrs.Item(0).Value))); StatsSet set = new StatsSet(); for (XmlNode cd = node.FirstChild; cd != null; cd = cd.NextSibling) { if ((cd.NextSibling != null) && "set".Equals(cd.NextSibling.Name) && (cd.NextSibling != null)) { attrs = cd.NextSibling.Attributes; if (attrs == null) { continue; } string name = attrs.GetNamedItem("name").Value; string value = attrs.GetNamedItem("val").Value; set.Set(name, value); } else { break; } } PcTemplate pcTempl = new PcTemplate(classId, set); Templates.Add((int)pcTempl.ClassId.Id, pcTempl); } } Log.Info($"CharTemplateTable: Loaded {Templates.Count} character templates."); }
public GameEnemy(StatsSet set) : base(set) { _health = set.getFloat("health"); _attackDmg = set.getFloat("attackDamage"); _attackRange = set.getFloat("attackRange"); _attackFreq = set.getFloat("attackFrequency"); _onKillCoinReward = set.getInt("killReward"); _runtimeAnimationController = Resources.Load("Models/" + set.getString("animationController")); }
private StatsSet buildUpgradeStats(int price, float attackB, float rangeB, float speedB, float healthB) { StatsSet set = new StatsSet(); set.set("price", price); set.set("attackBoost", attackB); set.set("speedBoost", speedB); set.set("rangeBoost", rangeB); set.set("healthBoost", healthB); return(set); }
public Henna(StatsSet set) { SymbolId = set.GetInt("symbol_id"); Dye = set.GetInt("dye"); Price = set.GetInt("price"); StatInt = set.GetInt("INT"); StatStr = set.GetInt("STR"); StatCon = set.GetInt("CON"); StatMen = set.GetInt("MEN"); StatDex = set.GetInt("DEX"); StatWit = set.GetInt("WIT"); }
public void Test() { Dictionary <int, NpcTemplate> _npcs = new Dictionary <int, NpcTemplate>(); XmlDocument doc = new XmlDocument(); string[] xmlFilesArray = Directory.GetFiles(@"data\xml\npcs\"); try { StatsSet set = new StatsSet(); //StatsSet petSet = new StatsSet(); foreach (string i in xmlFilesArray) { doc.Load(i); XmlNodeList nodes = doc.DocumentElement?.SelectNodes("/list/npc"); if (nodes == null) { continue; } foreach (XmlNode node in nodes) { XmlElement ownerElement = node.Attributes?[0].OwnerElement; if ((ownerElement != null) && (node.Attributes != null) && "npc".Equals(ownerElement.Name)) { XmlNamedNodeMap attrs = node.Attributes; int npcId = int.Parse(attrs.GetNamedItem("id").Value); int templateId = attrs.GetNamedItem("idTemplate") == null ? npcId : int.Parse(attrs.GetNamedItem("idTemplate").Value); set.Set("id", npcId); set.Set("idTemplate", templateId); set.Set("name", attrs.GetNamedItem("name").Value); set.Set("title", attrs.GetNamedItem("title").Value); _npcs.Add(npcId, new NpcTemplate(set)); } set.Clear(); } } } catch (Exception e) { Console.WriteLine($"MapRegionTest Error: {e.Message}"); //_log.log(Level.SEVERE, "NpcTable: Error parsing NPC templates : ", e); } }
private void CalculateValues() { var player = GameState.Instance.PlayerRpgState; int levels = RpgValues.LevelsForExperience(player); for (int i = 0, tLevel = player.Level; i < levels; i++, tLevel++) { PotentialPoints += RpgValues.PotentialPointsForLevel(tLevel, player); } NewLevel = player.Level + levels; //copy stats set NewStats = new StatsSet(player.BaseStats); }
public GameTower(StatsSet set) : base(set) { _attackFrequency = set.getFloat("attackFrequency"); _damagePerAttack = set.getFloat("attackDamage"); _attackRange = set.getFloat("attackRange"); _health = set.getFloat("health"); _ammunition = set.getObject("ammunition") as Ammunition; _coinPrice = set.getInt("coinPrice"); _attackPS = set.getString("attackParticleSystem"); _attackSound = set.getString("attackSound"); _repairCostPerPS = set.getFloat("repairCostPerPS"); _fracturedAsset = Resources.Load("Models/" + set.getString("fracturedAssetPath")); _towerIconAsset = Resources.Load(set.getString("towerIcon"), typeof(Sprite)) as Sprite; }
private EnemyTable() { _enemies = new Dictionary <string, GameEnemy> (); StatsSet spiderSet = new StatsSet(); spiderSet.set("name", "Araña Exploradora"); spiderSet.set("relativeModelPath", "Spider_Scout/spider_scout_walk"); spiderSet.set("health", 350.0f); spiderSet.set("attackDamage", 50.0f); spiderSet.set("attackRange", 5.0f); spiderSet.set("attackFrequency", 1.0f); spiderSet.set("killReward", 15); spiderSet.set("animationController", "Spider_Scout/spider_scout_controller"); registerEnemy(new GameEnemy(spiderSet)); }
public Weapon(StatsSet set) : base(set) { Type = Utilz.GetEnumFromString(set.GetString("weaponType", "none"), WeaponTypeId.None); SoulshotCount = set.GetInt("soulshots"); SpiritshotCount = set.GetInt("spiritshots"); PDam = set.GetInt("p_dam"); RndDam = set.GetInt("rnd_dam"); Critical = set.GetInt("critical"); HitModifier = set.GetDouble("hit_modify"); AvoidModifier = set.GetInt("avoid_modify"); ShieldDef = set.GetInt("shield_def"); ShieldDefRate = set.GetDouble("shield_def_rate"); AtkSpeed = set.GetInt("atk_speed"); AtkReuse = set.GetInt("atk_reuse", Type == WeaponTypeId.Bow ? 1500 : 0); MpConsume = set.GetInt("mp_consume"); MDam = set.GetInt("m_dam"); }
public void TestMethod1() { string folderPath = @"./data/xml/classes"; foreach (string file in Directory.EnumerateFiles(folderPath, "*.xml")) { string contents = File.ReadAllText(file); } XmlDocument doc = new XmlDocument(); string[] xmlFilesArray = Directory.GetFiles(@"data\xml\classes\"); for (int i = 0; i < xmlFilesArray.Length; i++) { doc.Load(xmlFilesArray[i]); XmlNodeList nodes = doc.DocumentElement.SelectNodes("/list/class"); foreach (XmlNode node in nodes) { if ("class".Equals(node.Attributes[0].OwnerElement.Name)) { XmlNamedNodeMap attrs = node.Attributes; ClassIds classId = (ClassIds)int.Parse(attrs.Item(0).Value); StatsSet set = new StatsSet(); for (XmlNode cd = node.FirstChild; cd != null; cd = cd.NextSibling) { if ("set".Equals(cd.NextSibling.Name) && cd.NextSibling != null) { attrs = cd.NextSibling.Attributes; string name = attrs.GetNamedItem("name").Value; string value = attrs.GetNamedItem("val").Value; set.Set(name, value); } else { break; } } ////PcTemplate pcTempl = new PcTemplate(classId, set); ////templates.Add((int)pcTempl.ClassId, pcTempl); //System.Diagnostics.Trace.WriteLine("Added template for: " + pcTempl.ClassId); } } } }
private void PaintStats() { StringBuilder statsSB = new StringBuilder(); //really can't guess here var player = GameState.Instance.PlayerRpgState; StatsSet baseStats = player.BaseStats; StatsSet derivedStats = player.DerivedStats; //level and XP statsSB.AppendFormat("Level {0} ({1}/{2})\n\n", player.Level, player.Experience, RpgValues.XPToNext(player.Level)); //base statistics foreach (StatType value in Enum.GetValues(typeof(StatType))) { string name = Enum.GetName(typeof(StatType), value); if (GameParams.HideStats.Contains(name)) { continue; } int baseValue = baseStats.Stats[value]; int derivedValue = derivedStats.Stats[value]; statsSB.AppendFormat("{0}: {1} [{2}]\n", Sub.Replace(name, SubList), baseValue, derivedValue); } statsSB.AppendLine(); //damage resistance and threshold foreach (int value in Enum.GetValues(typeof(DamageType))) { string name = Enum.GetName(typeof(DamageType), value); float baseDR = baseStats.DamageResistance[(DamageType)value]; float baseDT = baseStats.DamageThreshold[(DamageType)value]; float derivedDR = derivedStats.DamageResistance[(DamageType)value]; float derivedDT = derivedStats.DamageThreshold[(DamageType)value]; statsSB.AppendFormat("{0}: DR({1:f1} [{2:f1}]) | DT({3:f1} [{4:f1}])\n", name.Substring(0, Math.Min(4, name.Length)), baseDR, derivedDR, baseDT, derivedDT); } statsSB.AppendLine(); //max health statsSB.AppendFormat("Max Health: {0:f1} [{1:f1}]", baseStats.MaxHealth, derivedStats.MaxHealth); StatsText.text = statsSB.ToString(); }
public static GameTargetInstance instantiate() { int objectId = IDFactory.getNextID(); if (_templateObject == null) { StatsSet set = new StatsSet(); set.set("name", "Castillo"); set.set("relativeModelPath", "Target_Castle/target_castle"); set.set("health", 2500.0f); _templateObject = new GameTarget(set); } GameTargetInstance gti = new GameTargetInstance(objectId, _templateObject); World.getInstance().registerTarget(gti); return(gti); }
private void addGraphicsUpdate(StatsSet s, int index, Color c) { Dictionary <int, Color> graphics = s.getObject("graphicsUpgrade") as Dictionary <int, Color>; if (graphics == null) { graphics = new Dictionary <int, Color> (); graphics.Add(index, c); s.set("graphicsUpgrade", graphics); } else if (graphics.ContainsKey(index)) { graphics [index] = c; } else { graphics.Add(index, c); } }
public void Initialize() { XmlDocument doc = new XmlDocument(); string[] xmlFilesArray = Directory.GetFiles(@"data\xml\classes\"); for (int i = 0; i < xmlFilesArray.Length; i++) { doc.Load(xmlFilesArray[i]); XmlNodeList nodes = doc.DocumentElement.SelectNodes("/list/class"); foreach (XmlNode node in nodes) { if ("class".Equals(node.Attributes[0].OwnerElement.Name)) { XmlNamedNodeMap attrs = node.Attributes; ClassId classId = ClassId.Values.FirstOrDefault(x => ((int)x.Id).Equals(Convert.ToInt32(attrs.Item(0).Value))); StatsSet set = new StatsSet(); for (XmlNode cd = node.FirstChild; cd != null; cd = cd.NextSibling) { if ("set".Equals(cd.NextSibling.Name) && cd.NextSibling != null) { attrs = cd.NextSibling.Attributes; string name = attrs.GetNamedItem("name").Value; string value = attrs.GetNamedItem("val").Value; set.Set(name, value); } else { break; } } PcTemplate pcTempl = new PcTemplate(classId, set); templates.Add((int)pcTempl.ClassId.Id, pcTempl); } } } Log.Info($"Loaded { templates.Count } character templates."); }
private void PaintSkills() { var player = GameState.Instance.PlayerRpgState; StatsSet baseStats = player.BaseStats; StatsSet derivedStats = player.DerivedStats; StringBuilder skillsSB = new StringBuilder(baseStats.Skills.Keys.Count * 16); foreach (SkillType value in Enum.GetValues(typeof(SkillType))) { string name = Enum.GetName(typeof(SkillType), value); if (GameParams.HideSkills.Contains(name)) { continue; } int baseSkill = baseStats.Skills[value]; int derivedSkill = derivedStats.Skills[value]; skillsSB.AppendFormat("{0}: {1} [{2}]\n", Sub.Replace(name, SubList), baseSkill, derivedSkill); } SkillsText.text = skillsSB.ToString(); }
private void LoadEtcItemModels() { Dictionary <int, EtcItemModel> etcItemModels = ItemService.GetAllEtcItemModelsDict(); foreach (KeyValuePair <int, EtcItemModel> modelPair in etcItemModels) { StatsSet set = new StatsSet(); EtcItemModel model = modelPair.Value; EtcItem etcItem = new EtcItem(set) { Type = Utilz.GetEnumFromString(model.ItemType, EtcItemTypeId.None), ItemId = model.ItemId, Name = model.Name, Sellable = model.Sellable, Dropable = model.Dropable, Destroyable = model.Destroyable, Tradable = model.Tradeable, Weight = model.Weight, Duration = model.Duration }; EtcItems.Add(modelPair.Key, etcItem); } }
private TowerTable() { _towers = new Dictionary <string, GameTower> (); Ammunition cannonBall = new Ammunition("Cannon_Ball/cannon_ball", 50.0f); StatsSet cannon = new StatsSet(); cannon.set("name", "Torre Cañón"); cannon.set("relativeModelPath", "Tower_Cannon/cannon_tower"); cannon.set("fracturedAssetPath", "Tower_Cannon/Fractured/cannon_tower_fractured"); cannon.set("attackFrequency", 1.0f); cannon.set("attackDamage", 100.0f); cannon.set("attackRange", 15.0f); cannon.set("health", 500.0f); cannon.set("ammunition", cannonBall); cannon.set("coinPrice", 100); cannon.set("attackParticleSystem", "PS_CannonBurst"); cannon.set("attackSound", "sound_cannon"); cannon.set("towerIcon", "Icons/Tower_Thumbnails/cannon_tower"); cannon.set("repairCostPerPS", 0.1f); registerTower(new GameTower(cannon)); }
private void LoadWeaponModels() { Dictionary <int, WeaponModel> weaponModels = ItemService.GetAllWeaponModelsDict(); foreach (KeyValuePair <int, WeaponModel> modelPair in weaponModels) { StatsSet set = new StatsSet(); WeaponModel model = modelPair.Value; Weapon weapon = new Weapon(set) { Type = Utilz.GetEnumFromString(model.WeaponType, WeaponTypeId.None), ItemId = model.ItemId, Name = model.Name, BodyPart = Slots[model.BodyPart], Sellable = model.Sellable, Dropable = model.Dropable, Destroyable = model.Destroyable, Tradable = model.Tradeable, Weight = model.Weight, Duration = model.Duration, ReferencePrice = model.Price, SpiritshotCount = model.Spiritshots, SoulshotCount = model.Soulshots, PDam = model.Pdam, RndDam = model.RndDam, Critical = model.Critical, HitModifier = model.HitModify, AvoidModifier = model.AvoidModify, ShieldDef = model.ShieldDef, ShieldDefRate = model.ShieldDefRate, AtkSpeed = model.AtkSpeed, MpConsume = model.MpConsume, MDam = model.Mdam }; Weapons.Add(modelPair.Key, weapon); } }
private void LoadArmorModels() { Dictionary <int, ArmorModel> armorsModels = ItemService.GetAllArmorModelsDict(); foreach (KeyValuePair <int, ArmorModel> modelPair in armorsModels) { StatsSet set = new StatsSet(); ArmorModel model = modelPair.Value; Armor armor = new Armor(set) { Type = Utilz.GetEnumFromString(model.ArmorType, ArmorTypeId.None), ItemId = model.ItemId, Name = model.Name, BodyPart = Slots[model.BodyPart], Sellable = model.Sellable, Dropable = model.Dropable, Destroyable = model.Destroyable, Tradable = model.Tradeable, Weight = model.Weight, Duration = model.Duration }; Armors.Add(modelPair.Key, armor); } }
public virtual void ApplyToSkills(StatsSet original, StatsSet target) { }
public EtcItem(StatsSet set) : base(set) { Type = Utilz.GetEnumFromString(set.GetString("item_type", "None"), EtcItemTypeId.None); }
public virtual void ApplyToDerived(StatsSet original, StatsSet target) { }