コード例 #1
0
        private void FillCombatFields(CombatAIEventDataEntry script)
        {
            this.mainForm.CombatAI_NpcEntry_TextBox.Text            = script.NpcEntry.ToString();
            this.mainForm.CombatAI_InitMin_TextBox.Text             = script.StartMin.ToString();
            this.mainForm.CombatAI_InitMax_TextBox.Text             = script.StartMax.ToString();
            this.mainForm.CombatAI_RepeatMin_TextBox.Text           = script.RepeatMin.ToString();
            this.mainForm.CombatAI_RepeatMax_TextBox.Text           = script.RepeatMax.ToString();
            this.mainForm.CombatAI_Spell_Id_TextBox.Text            = script.SpellId.ToString();
            this.mainForm.CombatAI_EventType_ComboBox.SelectedIndex = (int)script.EventCheck;

            long flags = (long)script.EventFlags;

            CheckedListBox eventFlags = this.mainForm.CombatAI_EventFlags_CheckedBox;

            for (int idx = 0; idx < eventFlags.Items.Count; ++idx)
            {
                eventFlags.SetItemChecked(idx, false);

                if ((flags & 1 << idx) != 0)
                {
                    eventFlags.SetItemChecked(idx, true);
                }
            }

            this.mainForm.CombatAI_AttackDist_TextBox.Text = script.AttackDist.ToString();
        }
コード例 #2
0
        static public string CreateCombatEntryValues(CombatAIEventDataEntry combatData, uint id)
        {
            string npcName = "";

            string creatureNameQuery = "SELECT `Name1` FROM `creature_template_wdb` WHERE `entry` = " + combatData.NpcEntry + ";";
            var    creatureNameDs    = Properties.Settings.Default.UsingDB ? SQLModule.DatabaseSelectQuery(creatureNameQuery) : null;

            if (creatureNameDs != null)
            {
                foreach (DataRow row in creatureNameDs.Tables["table"].Rows)
                {
                    npcName = row[0].ToString();
                }
            }

            if (npcName == "")
            {
                return("");
            }

            string spellName = SpellInfoOverrideCreator.GetSpellName(combatData.SpellId);

            string comment = "\"" + npcName + " -- " + spellName + "\"";
            string query   = "(" + combatData.NpcEntry + ", " + id + ", " + combatData.StartMin + ", " + combatData.StartMax +
                             ", " + combatData.RepeatMin + ", " + combatData.RepeatMax + ", " + combatData.RepeatFail + ", " + combatData.SpellId + ", " +
                             combatData.EventCheck + ", " + combatData.EventFlags + ", " + combatData.AttackDist + ", " + combatData.DifficultyMask + ", "
                             + comment + ")";

            return(query);
        }
コード例 #3
0
        public void UpdateRowSelected()
        {
            int rowIndex = this.mainForm.CombatAI_SpellGrid_DataGrid.CurrentRow.Index;
            CombatAIEventDataEntry entry = this.GenerateScriptData();

            if (!combatAIEntries.ContainsKey(entry.NpcEntry))
            {
                return;
            }

            for (int idx = 0; idx < this.combatAIEntries[entry.NpcEntry].Count; ++idx)
            {
                if (idx == rowIndex)
                {
                    this.combatAIEntries[entry.NpcEntry][idx] = entry;
                    MessageBox.Show("CombatAI Data Updated");
                    this.UpdateCombatGridData(entry.NpcEntry);
                    return;
                }
            }
        }
コード例 #4
0
        public void AddCombatAIData()
        {
            uint NpcEntry = uint.Parse(mainForm.CombatAI_NpcEntry_TextBox.Text);

            if (!ValidateNpcEntry(NpcEntry))
            {
                String msg = String.Format("The Creature with Entry: {0} doesn't exist in world DB",
                                           NpcEntry);

                MessageBox.Show(msg);
                return;
            }

            uint InitMin = 0;

            if (mainForm.CombatAI_InitMin_TextBox.Text.Length > 0)
            {
                InitMin = uint.Parse(mainForm.CombatAI_InitMin_TextBox.Text);
            }

            uint InitMax = 0;

            if (mainForm.CombatAI_InitMax_TextBox.Text.Length > 0)
            {
                InitMax = uint.Parse(mainForm.CombatAI_InitMax_TextBox.Text);
            }

            uint RepeatMin = 0;

            if (mainForm.CombatAI_RepeatMin_TextBox.Text.Length > 0)
            {
                RepeatMin = uint.Parse(mainForm.CombatAI_RepeatMin_TextBox.Text);
            }

            uint RepeatMax = 0;

            if (mainForm.CombatAI_RepeatMax_TextBox.Text.Length > 0)
            {
                RepeatMax = uint.Parse(mainForm.CombatAI_RepeatMax_TextBox.Text);
            }

            uint EventType = 0;

            if (mainForm.CombatAI_EventType_ComboBox.SelectedIndex != -1)
            {
                EventType = Convert.ToUInt32(mainForm.CombatAI_EventType_ComboBox.SelectedIndex);
            }

            uint EventFlags = 0;

            for (int idx = 0; idx < mainForm.CombatAI_EventFlags_CheckedBox.Items.Count; ++idx)
            {
                var option = mainForm.CombatAI_EventFlags_CheckedBox.Items[idx];

                if (mainForm.CombatAI_EventFlags_CheckedBox.GetItemChecked(idx))
                {
                    EventFlags |= eventFlagsValues[idx];
                }
            }

            float AttackDist = 0.0f;

            if (mainForm.CombatAI_AttackDist_TextBox.Text.Length > 0)
            {
                AttackDist = float.Parse(mainForm.CombatAI_AttackDist_TextBox.Text);
            }

            uint SpellId = 0;

            if (mainForm.CombatAI_Spell_Id_TextBox.Text.Length > 0)
            {
                SpellId = uint.Parse(mainForm.CombatAI_Spell_Id_TextBox.Text);
            }

            if (DBC.DBC.IsLoaded() && !DBC.DBC.SpellName.ContainsKey((int)SpellId))
            {
                String msg = String.Format("The Spell Id: {0} doesn't exist in DBC",
                                           SpellId);

                MessageBox.Show(msg);
                return;
            }

            CombatAIEventDataEntry combatData = new CombatAIEventDataEntry(NpcEntry, InitMin, InitMax, RepeatMin, RepeatMax, SpellId, AttackDist, EventType, EventFlags);

            if (!combatAIEntries.ContainsKey(NpcEntry))
            {
                combatAIEntries.Add(NpcEntry, new ArrayList());
            }

            combatAIEntries[NpcEntry].Add(combatData);
            MessageBox.Show("Combat Script Info added to Npc: " + NpcEntry);
        }