Exemple #1
0
        private void loadSpellsButton_Click(object sender, EventArgs e)
        {
            SkillLineItem   skillLineItem = (SkillLineItem)skillLineList.SelectedItem;
            MySqlConnection con           = new MySqlConnection();
            string          conString     = "SERVER=127.0.0.1;PORT=3306;DATABASE=world70;UID=root;PASSWORD=ascent;";

            con.ConnectionString = conString;
            con.Open();

            foreach (var skillLineID in skillLineItem.skillLines)
            {
                foreach (var pair in skillLineAbilityDict)
                {
                    SkillLineAbility skillLineAbility = pair.Value;
                    if (skillLineID != skillLineAbility.skillLine)
                    {
                        continue;
                    }
                    if (skillLineAbility.skillLine != skillLineID)
                    {
                        continue;
                    }

                    /* Spells which we should modify */
                    if (!spellDict.Keys.Contains(skillLineAbility.spell))
                    {
                        continue;
                    }
                    Spell spell = spellDict[skillLineAbility.spell];

                    //Filtering out obsolete spells
                    //if (spell.StartRecoveryCategory == 0 || spell.StartRecoveryTime == 0
                    //  || spell.baseLevel == 0) continue;

                    if (spell.baseLevel == 0)
                    {
                        continue;
                    }

                    try
                    {
                        string query = $"INSERT INTO custom_spell_system (spellID, spellName, spellLevel)VALUES ({spell.Entry},\"{spellReader.StringTable[(int)spell.SpellName_0]}\", {spell.spellLevel});";
                        //MessageBox.Show(query);
                        MySqlCommand    cmd    = new MySqlCommand(query, con);
                        MySqlDataReader reader = cmd.ExecuteReader();
                        reader.Close();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }

                    combinedSpellList.Items.Add($"{spell.Entry}, {spellReader.StringTable[(int)spell.SpellName_0]}, {spellReader.StringTable[(int)spell.Description_0]}");
                }
            }
        }
Exemple #2
0
        //20 rage = 200 powercost (manaCost in DB files)
        //20 energy = 20 powercost (manaCost in DB files)
        private void handleManaLine()
        {
            SkillLineItem skillLineItem = (SkillLineItem)skillLineList.SelectedItem;

            foreach (var skillLineID in skillLineItem.skillLines)
            {
                foreach (var pair in skillLineAbilityDict)
                {
                    SkillLineAbility skillLineAbility = pair.Value;
                    if (skillLineID != skillLineAbility.skillLine)
                    {
                        continue;
                    }
                    if (skillLineAbility.skillLine != skillLineID)
                    {
                        continue;
                    }

                    /* Spells which we should modify */
                    if (!spellDict.Keys.Contains(skillLineAbility.spell))
                    {
                        continue;
                    }
                    Spell spell = spellDict[skillLineAbility.spell];
                    //if (spell.Entry != 116) continue;

                    //So we don't edit spells which have already been converted or use the energy resource
                    if (spell.powerType != (uint)PowerType.MANA)
                    {
                        continue;
                    }
                    spell.powerType = (uint)PowerType.ENERGY;

                    //Let's say a frostbolt costs 11 mana pct, now it costs 33 energy, if it's above 75 it will become 75.
                    double baseEnergyCost = Convert.ToDouble(spell.ManaCostPercentage);
                    baseEnergyCost *= 1.5;
                    if (baseEnergyCost > 40)
                    {
                        baseEnergyCost = 40;
                    }

                    spell.manaCost           = Convert.ToUInt32(baseEnergyCost); //manaCost is Power Cost in spell editor, 20 energy =
                    spell.ManaCostPercentage = 0;

                    spellDict[skillLineAbility.spell] = spell;
                }
            }
        }