public void GenerateSQL() { mainForm.AreaTrigger_SQLOutput_RichTextBox.Clear(); foreach (var item in areaTriggerActionEntries) { string SQLtext = ""; if (item.Value.Count > 0) { SQLtext = "-- " + GetSpellName(item.Key) + " \r\n"; SQLtext += "DELETE FROM `areatrigger_actions` WHERE `summon_spellId` = " + item.Key + ";\r\n"; SQLtext += "INSERT INTO `areatrigger_actions` (`entry`, `summon_spellId`, `customEntry`, `id`, `moment`, `actionType`, `targetFlags`, `spellId`, `maxCharges`, " + "`aura`, `chargeRecoveryTime`, `hitMaxCount`, `onDespawn`, `comment`) VALUES\r\n"; } uint itr = 0; AreaTriggerTemplateInfo template = GetAreaTriggerTemplateInfo(item.Key); if (!template.IsValidTemplate()) { continue; } foreach (AreaTriggerAction spellDbc in item.Value) { string query = AreaTriggerActionCreator.CreateAreaTriggerInsertValue(spellDbc, template, (int)itr); if (itr + 1 >= item.Value.Count) { query += ";\n"; } else { query += ",\n"; } SQLtext += query; itr++; } SQLtext += "\n\n"; mainForm.AreaTrigger_SQLOutput_RichTextBox.AppendText(SQLtext); } MessageBox.Show("SQL Queries Generated"); }
public void CheckAreaTriggerInfo() { uint spellId = ParseText(mainForm.AreaTrigger_SpellId_TextBox.Text); AreaTriggerTemplateInfo template = GetAreaTriggerTemplateInfo(spellId); if (!template.IsValidTemplate()) { String msg = String.Format("The AreaTrigger with SpellId: {0} doesn't exist in DB", spellId); MessageBox.Show(msg); EnableLockedItems(false); } else { EnableLockedItems(true); } }