private Seven(string configPath) : base(configPath) { Data = new DataStore(typeof(FF7).Assembly); SavePath = Configuration.GetNode("/config/savePath").InnerText; }
public static string GetCharacterStats(string character, int level) { DataStore data = new DataStore(typeof(Seven).Assembly); Party p = new Party(data); Character c = (Character)typeof(Party).GetProperty(character).GetValue(p, null); while (c.Level < level) { c.GainExperience(c.ExpToNextLevel + 10); } return c.ToString(); }
public Materiatory(DataStore data, XmlNode savegame) : this() { foreach (XmlNode node in savegame.SelectNodes("./materiatory/orb")) { if (node.NodeType == XmlNodeType.Comment) { continue; } string id = node.Attributes ["id"].Value; int ap = Int32.Parse(node.Attributes ["ap"].Value); int slot = Int32.Parse(node.Attributes ["slot"].Value); _materiatory[slot] = data.GetMateria(id, ap); } }
public Party(DataStore data) : this() { Clock = new Clock(); InitCharacters(data); AddCharacters(); _party[0] = Cloud; Materiatory = new Materiatory(); Inventory = new Inventory(); Reserves = new Character[3, 3]; Gil = 100; BattleSpeed = DEFAULT_BATTLE_SPEED; }
public Party(DataStore data, XmlNode savegame) : this() { InitCharacters(savegame, data); AddCharacters(); for (int k = 0; k <= 2; k++) { XmlNode node = savegame.SelectSingleNode("./slot" + k.ToString()); if (node != null) { if (!String.IsNullOrEmpty(node.InnerText)) { _party[k] = _characters[node.InnerText]; } } } Materiatory = new Materiatory(data, savegame); Inventory = new Inventory(data, savegame); Reserves = new Character[3, 3]; int i = 0; int j = 0; foreach (XmlNode node in savegame.SelectNodes("./reserve")) { if (node.NodeType == XmlNodeType.Comment) { continue; } Reserves[j, i] = _characters[node.InnerXml]; i++; if (i % 3 == 0) { j++; i = 0; } } Gil = Int32.Parse(savegame.SelectSingleNode("./gil").InnerXml); int time = Int32.Parse(savegame.SelectSingleNode("./time").InnerText); Clock = new Clock(time, true); BattleSpeed = Int32.Parse(savegame.SelectSingleNode("./battleSpeed").InnerText); for (int a = 0; a < 4; a++) { XmlNode cornerNode = savegame.SelectSingleNode("./config/menu/corner" + a); int r = Int32.Parse(cornerNode.Attributes["r"].Value); int g = Int32.Parse(cornerNode.Attributes["g"].Value); int b = Int32.Parse(cornerNode.Attributes["b"].Value); Menu.Menu.SetCornerColor(a, r, g, b); } }
private void InitCharacters(DataStore data) { XmlDocument characterData = Resource.GetXmlFromResource("data.characters.xml", data.Assembly); Cloud = new Character(characterData.SelectSingleNode("./characters/Cloud"), data); Tifa = new Character(characterData.SelectSingleNode("./characters/Tifa"), data); Aeris = new Character(characterData.SelectSingleNode("./characters/Aeris"), data); Barret = new Character(characterData.SelectSingleNode("./characters/Barret"), data); RedXIII = new Character(characterData.SelectSingleNode("./characters/RedXIII"), data); Yuffie = new Character(characterData.SelectSingleNode("./characters/Yuffie"), data); CaitSith = new Character(characterData.SelectSingleNode("./characters/CaitSith"), data); Vincent = new Character(characterData.SelectSingleNode("./characters/Vincent"), data); Cid = new Character(characterData.SelectSingleNode("./characters/Cid"), data); Sephiroth = new Character(characterData.SelectSingleNode("./characters/Sephiroth"), data); }
/// <summary> /// Loads a saved character. /// </summary> /// <param name="savexmlstring"></param> /// <param name="dataxmlstring"></param> public Character(XmlNode savexml, XmlNode dataxml, DataStore data) : this() { _halve = new List<Element>(); _void = new List<Element>(); _absorb = new List<Element>(); _immune = new List<Status>(); Name = savexml.Name; // Stats _strength_base = Int32.Parse(savexml.SelectSingleNode("./stats/str").InnerText); _dexterity_base = Int32.Parse(savexml.SelectSingleNode("./stats/dex").InnerText); _vitality_base = Int32.Parse(savexml.SelectSingleNode("./stats/vit").InnerText); _magic_base = Int32.Parse(savexml.SelectSingleNode("./stats/mag").InnerText); _spirit_base = Int32.Parse(savexml.SelectSingleNode("./stats/spi").InnerText); _luck_base = Int32.Parse(savexml.SelectSingleNode("./stats/lck").InnerText); _level = Int32.Parse(savexml.SelectSingleNode("./stats/lvl").InnerText); // Experience and Level _exp = Int32.Parse(savexml.SelectSingleNode("./exp").InnerText); _limitlvl = Int32.Parse(savexml.SelectSingleNode("./limitlvl").InnerText); // HP _hp = Int32.Parse(savexml.SelectSingleNode("./hp").InnerText); _maxhp = Int32.Parse(savexml.SelectSingleNode("./maxhp").InnerText); if (_hp > _maxhp) { throw new SaveStateException("HP > MAXHP for " + Name); } //_death = (_hp == 0); // MP _mp = Int32.Parse(savexml.SelectSingleNode("./mp").InnerText); _maxmp = Int32.Parse(savexml.SelectSingleNode("./maxmp").InnerText); if (_mp > _maxmp) { throw new SaveStateException("MP > MAXMP for " + Name); } // Fury/Sadness Sadness = Boolean.Parse(savexml.SelectSingleNode("./sadness").InnerText); Fury = Boolean.Parse(savexml.SelectSingleNode("./fury").InnerText); if (Sadness && Fury) { throw new SaveStateException("Can't be both sad and furious"); } // Sex _sex = (Sex)Enum.Parse(typeof(Sex), dataxml.SelectSingleNode("./sex").InnerText); // Back row? BackRow = Boolean.Parse(savexml.SelectSingleNode("./backRow").InnerText); // Equipment _weapon = data.GetWeapon(savexml.SelectSingleNode("./weapon/name").InnerText); foreach (XmlNode orb in savexml.SelectNodes("./weapon/materia/orb")) { string id = orb.Attributes["id"].Value; int ap = Int32.Parse(orb.Attributes["ap"].Value); int slot = Int32.Parse(orb.Attributes["slot"].Value); if (slot >= _weapon.Slots.Length) { throw new SaveStateException("Materia orb assigned to slot that doesnt exist on weapon."); } _weapon.Slots[slot] = data.GetMateria(id, ap); } _armor = data.GetArmor(savexml.SelectSingleNode("./armor/name").InnerText); foreach (XmlNode orb in savexml.SelectNodes("./armor/materia/orb")) { string id = orb.Attributes["id"].Value; int ap = Int32.Parse(orb.Attributes["ap"].Value); int slot = Int32.Parse(orb.Attributes["slot"].Value); if (slot >= _weapon.Slots.Length) { throw new SaveStateException("Materia orb assigned to slot that doesnt exist on armor."); } _armor.Slots[slot] = data.GetMateria(id, ap); } string acc = savexml.SelectSingleNode("./accessory").InnerText; _accessory = String.IsNullOrEmpty(acc) ? null : data.GetAccessory(acc); // Q-Values _qvals = InitTable(dataxml.SelectSingleNode("./qvals").InnerText); // Luck base/gradient tables _lck_base = InitTable(dataxml.SelectSingleNode("./lbvals").InnerText); _lck_gradient = InitTable(dataxml.SelectSingleNode("./lgvals").InnerText); // HP base/gradient tables _hp_base = InitTable(dataxml.SelectSingleNode("./hpbvals").InnerText); _hp_gradient = InitTable(dataxml.SelectSingleNode("./hpgvals").InnerText); // MP base/gradient tables _mp_base = InitTable(dataxml.SelectSingleNode("./mpbvals").InnerText); _mp_gradient = InitTable(dataxml.SelectSingleNode("./mpgvals").InnerText); // Stat ranks _stat_ranks = InitTable(dataxml.SelectSingleNode("./ranks").InnerText); Profile = new Gdk.Pixbuf(data.Assembly, "charfull." + Name.ToLower() + ".jpg"); ProfileSmall = new Gdk.Pixbuf(data.Assembly, "charsmall." + Name.ToLower() + ".jpg"); ProfileTiny = new Gdk.Pixbuf(data.Assembly, "chartiny." + Name.ToLower() + ".jpg"); // Sanity checks. Sometimes we'll load materia onto a save file which // causes the max to drop, but we don't otherwise modify the current // values. So we'll do that here. if (_hp > _maxhp) { _hp = _maxhp; } else if (_hp <= 0) { _hp = 0; InflictDeath(); } if (_mp > _maxmp) { _mp = _maxmp; } else if (_mp < 0) { _mp = 0; } CharacterMetrics = data.CharacterMetrics; }
/// <summary> /// Creates a character from scratch with initial stats/equipment. /// </summary> /// <param name="dataxmlstring"></param> public Character(XmlNode dataxml, DataStore data) : this(dataxml, dataxml, data) { }