public static string DetermineAbilityID(AbilityObject ability) { string slotflag = GetSlotFlag(ability.slot); string typeflag = GetTypeFlag(ability.type); string castflag = GetCastFlag(ability.cast); string effectflag = GetEffectFlag(ability.effect.effectKey); string dmg = ability.statistics.damage.ToString("X3"); string cd = ability.statistics.cooldown.ToString("X3"); int comboflag; if (ability.statistics.comboDark == null || ability.statistics.comboDark == "" || ability.statistics.comboLight == null || ability.statistics.comboLight == "") { comboflag = 0; } else { comboflag = 1; } string id = slotflag + "-" + typeflag + "-" + castflag + "-" + effectflag + "-" + dmg + "-" + cd + "-" + comboflag.ToString(); return(id); }
public string ConvertToJson(AbilityObject ability) { ability.id = Utilities.DetermineAbilityID(ability); string json = JsonConvert.SerializeObject(ability, Formatting.Indented); return(json); }
private void PopulateFields(AbilityObject a) { name_textbox.Text = a.name; equip_slot_combobox.Text = a.slot; skill_type_combox.Text = a.type; cast_combobox.Text = a.cast; damage_textbox.Text = a.statistics.damage.ToString(); modifier_textbox.Text = a.statistics.modifier.ToString(); cooldown_textbox.Text = a.statistics.cooldown.ToString(); energycost_textbox.Text = a.statistics.energy.ToString(); corruptioncost_textbox.Text = a.statistics.corruption.ToString(); combo_dark_textbox.Text = a.statistics.comboDark; combo_light_textbox.Text = a.statistics.comboDark; animation_file_textbox.Text = a.information.animationPath; sprite_textbox.Text = a.information.spritePath; animation_key_combobox.Text = a.information.animationKey; hitbox_height_textbox.Text = a.information.hitbox.height.ToString(); hitbox_length_textbox.Text = a.information.hitbox.length.ToString(); description_richTextbox.Text = a.information.description; effecttype_combobox.Text = a.effect.effectKey; effect_animation_textbox.Text = a.effect.animationPath; effect_damage_textbox.Text = a.effect.damage.ToString(); effect_duration_textbox.Text = a.effect.duration.ToString(); effect_rate_textbox.Text = a.effect.rate.ToString(); }
public AbilityWizard() { InitializeComponent(); ability = new AbilityObject(); spritePath = ""; combo_light_textbox.Enabled = false; combo_dark_textbox.Enabled = false; effect_damage.Enabled = false; effect_rate_textbox.Enabled = false; }
public static void UpdateDatabase(AbilityObject oldAbility, AbilityObject edittedAbility, List <AbilityObject> db) { for (int i = 0; i < db.Count; i++) { if (String.Equals(oldAbility.id, db[i].id, StringComparison.OrdinalIgnoreCase)) { db[i] = edittedAbility; } } }
public ARK_AbilityWizard() { InitializeComponent(); abilityDB = new List <AbilityObject>(); spritePath = ""; selectedAbility = new AbilityObject(); if (edit == false) { ControlsEnabled(this, false); } }
public static AbilityObject SearchDataBase(string id, List <AbilityObject> db) { AbilityObject output = new AbilityObject(); foreach (AbilityObject a in db) { if (String.Equals(a.id, id, StringComparison.OrdinalIgnoreCase)) { output = a; } } return(output); }
private void ability_tree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { update_button.Text = "Update"; ControlsEnabled(this, false); if (e.Button == MouseButtons.Right) { treenode_right_click.Show(Cursor.Position); ability_tree.SelectedNode = e.Node; } selectedAbility = Utilities.SearchDataBase(e.Node.Text, abilityDB); PopulateFields(selectedAbility); selected = true; }
private void UpdateTree() { if (selected && !remove) { AbilityObject eddited = GenerateAbility(); Utilities.UpdateDatabase(selectedAbility, eddited, abilityDB); } else if (!remove) { AbilityObject ability = GenerateAbility(); abilityDB.Add(ability); } PopulateTree(); ControlsEnabled(this, false); }
private string CreateToolTip(AbilityObject a) { string s = ""; s = "id:" + a.id + "\n" + "name:" + a.name + "\n" + "slot:" + a.slot + "\n" + "type:" + a.type + "\n" + "cast:" + a.cast + "\n" + "statistics: {\n" + "\t damage:" + a.statistics.damage.ToString() + "\n" + "\t modifier:" + a.statistics.modifier.ToString() + "\n" + "\t cooldown:" + a.statistics.cooldown.ToString() + "\n" + "\t energy:" + a.statistics.energy.ToString() + "\n" + "\t corruption:" + a.statistics.corruption + "\n" + "\t comboDark:" + a.statistics.comboDark + "\n" + "\t comboLight:" + a.statistics.comboLight + "\n\t}\n" + "information{\n" + "\t animationKey:" + a.information.animationKey + "\n" + "\t animationPath:" + a.information.animationPath + "\n" + "\t description:" + a.information.description + "\n" + "\t spritePath:" + a.information.spritePath + "\n" + "\t hitbox{\n" + "\t\t length:" + a.information.hitbox.length.ToString() + "\n" + "\t\t height:" + a.information.hitbox.height.ToString() + "\n\t}\n}\n" + "effect{\n" + "\t effectKey:" + a.effect.effectKey + "\n" + "\t animationPath:" + a.effect.animationPath + "\n" + "\t damage:" + a.effect.damage.ToString() + "\n" + "\t duration:" + a.effect.duration.ToString() + "\n" + "\t rate:" + a.effect.rate.ToString() + "\n}"; return(s); }
public static string ConvertToJson(AbilityObject ability) { string json = JsonConvert.SerializeObject(ability, Formatting.Indented); return(json); }
private void PopulateTree() { ability_tree.Nodes.Clear(); for (int i = 0; i < abilityDB.Count; i++) { TreeNode node; AbilityObject a = abilityDB[i]; node = ability_tree.Nodes.Add(a.id); node = ability_tree.Nodes[i].Nodes.Add("Name"); TreeNode topNode = node; node.Nodes.Add(a.name); node = ability_tree.Nodes[i].Nodes.Add("Slot"); node.Nodes.Add(a.slot); node = ability_tree.Nodes[i].Nodes.Add("Type"); node.Nodes.Add(a.type); node = ability_tree.Nodes[i].Nodes.Add("Cast"); node.Nodes.Add(a.cast); //Statistics node = ability_tree.Nodes[i].Nodes.Add("Statistics"); TreeNode node1 = node; node = node.Nodes.Add("Damage"); node.Nodes.Add(a.statistics.damage.ToString()); node = node1; node = node.Nodes.Add("Modifier"); node.Nodes.Add(a.statistics.modifier.ToString()); node = node1; node = node.Nodes.Add("Cooldown"); node.Nodes.Add(a.statistics.cooldown.ToString()); node = node1; node = node.Nodes.Add("Energy"); node.Nodes.Add(a.statistics.energy.ToString()); node = node1; node = node.Nodes.Add("Corruption"); node.Nodes.Add(a.statistics.corruption.ToString()); node = node1; node = node.Nodes.Add("Dark Comobo"); node.Nodes.Add(a.statistics.comboDark); node = node1; node = node.Nodes.Add("Light Combo"); node.Nodes.Add(a.statistics.comboLight); //Development Information node = ability_tree.Nodes[i].Nodes.Add("Development Information"); node1 = node; node = node.Nodes.Add("Animation Key"); node.Nodes.Add(a.information.animationKey); node = node1; node = node.Nodes.Add("Animation Path"); node.Nodes.Add(a.information.animationPath); node = node1; node = node.Nodes.Add("Description"); node.Nodes.Add(a.information.description); node = node1; node = node.Nodes.Add("SpritePath"); node.Nodes.Add(a.information.spritePath); node = node1; node = node.Nodes.Add("Hitbox"); TreeNode t2Node = node.Nodes.Add("Length"); t2Node.Nodes.Add(a.information.hitbox.length.ToString()); t2Node = node.Nodes.Add("Height"); t2Node.Nodes.Add(a.information.hitbox.height.ToString()); //Effect node = ability_tree.Nodes[i].Nodes.Add("Effect"); node1 = node; node = node.Nodes.Add("Effect Key"); node.Nodes.Add(a.effect.effectKey); node = node1; node = node.Nodes.Add("Animation Path"); node.Nodes.Add(a.effect.animationPath); node = node1; node = node.Nodes.Add("Damage"); node.Nodes.Add(a.effect.damage.ToString()); node = node1; node = node.Nodes.Add("Duration"); node.Nodes.Add(a.effect.duration.ToString()); node = node1; node = node.Nodes.Add("Rate"); node.Nodes.Add(a.effect.rate.ToString()); } }
private AbilityObject GenerateAbility() { AbilityObject ability = new AbilityObject(); if (Utilities.CheckAllFields(this)) { //General Information ability.name = name_textbox.Text; ability.slot = equip_slot_combobox.SelectedItem.ToString(); ability.type = skill_type_combox.SelectedItem.ToString(); ability.cast = cast_combobox.SelectedItem.ToString(); //Statisitics ability.statistics.damage = Int32.Parse(damage_textbox.Text); ability.statistics.modifier = Int32.Parse(modifier_textbox.Text); ability.statistics.cooldown = Int32.Parse(cooldown_textbox.Text); ability.statistics.energy = Int32.Parse(energycost_textbox.Text); ability.statistics.corruption = Int32.Parse(corruptioncost_textbox.Text); if (combo_checkbox.CheckState == CheckState.Checked && combo_light_textbox != null) { ability.statistics.comboLight = combo_light_textbox.Text; ability.statistics.comboDark = combo_dark_textbox.Text; } else { ability.statistics.comboLight = null; ability.statistics.comboDark = null; } //Information ability.information.animationKey = animation_key_combobox.SelectedItem.ToString(); ability.information.animationPath = animation_file_textbox.Text; ability.information.description = description_richTextbox.Text; ability.information.spritePath = sprite_textbox.Text; ability.information.hitbox.length = Int32.Parse(hitbox_length_textbox.Text); ability.information.hitbox.height = Int32.Parse(hitbox_height_textbox.Text); //Effect ability.effect.effectKey = effecttype_combobox.SelectedItem.ToString(); ability.effect.duration = float.Parse(effect_duration_textbox.Text); ability.effect.animationPath = effect_animation_textbox.Text; if (String.Equals(ability.effect.effectKey, "DamageOverTime", StringComparison.OrdinalIgnoreCase) || String.Equals(ability.effect.effectKey, "LifeSteal", StringComparison.OrdinalIgnoreCase)) { ability.effect.damage = Int32.Parse(effect_damage_textbox.Text); ability.effect.rate = float.Parse(effect_rate_textbox.Text); } else if (String.Equals(ability.type, "Movement", StringComparison.OrdinalIgnoreCase) || String.Equals(ability.effect.effectKey, "DamageBuff", StringComparison.OrdinalIgnoreCase)) { ability.effect.damage = 0; ability.effect.rate = float.Parse(effect_rate_textbox.Text); } else { ability.effect.damage = 0; ability.effect.rate = 0; } ability.id = Utilities.DetermineAbilityID(ability); } else { MessageBox.Show("Not all fields are filled in! Please fill in the fields and Try again!", "Fields Missing!", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(ability); }