static private string GenerateActionComment(AreaTriggerAction action) { string comment = ""; comment += areaTriggerActionsComments[action.ActionType]; string spellName = GetSpellName(action.ActionSpellId); if (spellName.Length > 0) { if (action.ActionType >= 0 && action.ActionType < 5) { comment += spellName + "-" + action.ActionSpellId + " "; } if ((action.TargetFlags & 8) != 0) { comment += "On Player"; } else { comment += "On Creature"; } } return(comment); }
static private string CreateAreaTriggerInsertValue(AreaTriggerAction action, AreaTriggerTemplateInfo template, int id) { string query = "(" + template.Entry + ", " + template.SpellId + ", " + template.CustomEntry + ", " + id + ", " + action.Moment + ", " + action.ActionType + ", " + action.TargetFlags + ", " + action.ActionSpellId + ", " + action.MaxCharges + ", " + action.HasAura + ", " + action.ChargeRestoreTimer + ", " + action.MaxTargetHitted + ", " + action.DespawnAfterAction + ',' + GenerateActionComment(action) + ")"; return(query); }
public void AddActionEntry() { uint SpellId = ParseText(mainForm.AreaTrigger_SpellId_TextBox.Text); AreaTriggerAction action = new AreaTriggerAction(); action.ActionType = mainForm.AreaTrigger_AreaAction_ListBox.SelectedIndex != -1 ? (uint)mainForm.AreaTrigger_AreaAction_ListBox.SelectedIndex : 0; action.TargetFlags = GetMaskOfSelectedValuesInCheckBox(mainForm.AreaTrigger_TargetFlags_CheckBox); action.Moment = GetMaskOfSelectedValuesInCheckBox(mainForm.AreaTrigger_Moment_CheckBox); action.ActionSpellId = ParseText(mainForm.AreaTrigger_ActionSpellId_TextBox.Text); action.ChargeRestoreTimer = ParseText(mainForm.AreaTrigger_ChargeRestoreTimer_TextBox.Text); action.MaxCharges = (uint)mainForm.AreaTrigger_MaxCharges_NumericUpDown.Value; action.HasAura = ParseText(mainForm.AreaTrigger_HasAura_TextBox.Text); action.MaxTargetHitted = (uint)mainForm.AreaTrigger_MaxTargetHitted_NumericUpDown.Value; action.DespawnAfterAction = mainForm.AreaTriggerDespawn_RadioButton.Checked ? 1u : 0; if (DBC.DBC.IsLoaded() && !DBC.DBC.SpellName.ContainsKey((int)action.ActionSpellId)) { String msg = String.Format("The Action Spell Id: {0} doesn't exist in DBC", SpellId); MessageBox.Show(msg); return; } if (!areaTriggerActionEntries.ContainsKey(SpellId)) { areaTriggerActionEntries.Add(SpellId, new ArrayList()); areaTriggerActionEntries[SpellId].Add(action); } else { areaTriggerActionEntries[SpellId].Add(action); } MessageBox.Show("Action added correctly to AreaTrigger with Spell Id: " + SpellId); UpdateAreaTriggerActionsListView(); }