Skip to content

Commit

Permalink
Add new chat type.
Browse files Browse the repository at this point in the history
  • Loading branch information
brotalnia committed Dec 24, 2023
1 parent 131a9b9 commit 595b725
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 26 deletions.
5 changes: 3 additions & 2 deletions ScriptEditor/DataFinderForms/FormTextFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ public FormTextFinder()
languages[33] = "Gutterspeak";

// Chat Type Names
chattypes = new string[7];
chattypes = new string[8];
chattypes[0] = "Say";
chattypes[1] = "Yell";
chattypes[2] = "Emote";
chattypes[3] = "Zone Emote";
chattypes[3] = "Boss Emote";
chattypes[4] = "Whisper";
chattypes[5] = "Boss Whisper";
chattypes[6] = "Zone Yell";
chattypes[7] = "Zone Emote";
}
protected override void AddAllData()
{
Expand Down
34 changes: 26 additions & 8 deletions ScriptEditor/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions ScriptEditor/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@ public Form1()
uint flags = 0;
Helpers.ShowFlagInputDialog(ref flags, "Spell Mechanic Mask", GameData.SpellMechanicMaskList);
};
tsmiFlagsSpellProc.Click += (sender, e) =>
{
uint flags = 0;
Helpers.ShowFlagInputDialog(ref flags, "Spell Proc Flags", GameData.SpellProcFlagsList);
};
tsmiFlagsSpellProcEx.Click += (sender, e) =>
{
uint flags = 0;
Helpers.ShowFlagInputDialog(ref flags, "Spell Proc Flags Ex", GameData.SpellProcFlagsExList);
};
}

private void picScriptEditor_MouseEnter(object sender, EventArgs e)
Expand Down
4 changes: 2 additions & 2 deletions ScriptEditor/FormEventEditor.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 21 additions & 11 deletions ScriptEditor/FormEventEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public partial class FormEventEditor : Form
"Target Missing Aura", // 28
"Movement Inform", // 29
"Leave Combat", // 30
"Map Event Happened", // 31
"Script Event Happened", // 31
"Group Member Died", // 32
"Victim Rooted", // 33
"Hit By Aura", // 34
Expand Down Expand Up @@ -1063,20 +1063,20 @@ private void lstEvents_ColumnClick(object sender, ColumnClickEventArgs e)
private void btnEventAdd_Click(object sender, EventArgs e)
{
// First we find the highest id in the event list.
uint max_id = 0;
uint maxId = currentCreatureId * 100;
foreach (ListViewItem item in lstEvents.Items)
{
CreatureEvent creature_event = (CreatureEvent)item.Tag;
CreatureEvent creatureEvent = (CreatureEvent)item.Tag;

if (creature_event.Id > max_id)
max_id = creature_event.Id;
if (creatureEvent.Id > maxId)
maxId = creatureEvent.Id;
}

max_id++;
maxId++;

ListViewItem newItem = new ListViewItem();

CreatureEvent newEvent= new CreatureEvent(max_id, currentCreatureId);
CreatureEvent newEvent= new CreatureEvent(maxId, currentCreatureId);

// We show only id, event type, and comment in the listview.
newItem.Text = newEvent.Id.ToString();
Expand Down Expand Up @@ -1184,13 +1184,23 @@ private string GenerateSaveQuery()
query = "-- Removing unused script actions.\nDELETE FROM `creature_ai_scripts` WHERE `id` IN (" + unusedScripts + ");\n\n";
}
query += "-- Events list for " + GameData.FindCreatureName(currentCreatureId) + "\nDELETE FROM `creature_ai_events` WHERE `creature_id`=" + currentCreatureId.ToString() + ";\n";
foreach (ListViewItem lvi in lstEvents.Items)
if (lstEvents.Items.Count > 0)
{
// Get the associated CreatureEvent.
CreatureEvent currentEvent = (CreatureEvent)lvi.Tag;
query += "INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES\n";
for (int i = 0; i < lstEvents.Items.Count; ++i)
{
// Get the associated CreatureEvent.
ListViewItem lvi = lstEvents.Items[i];
CreatureEvent currentEvent = (CreatureEvent)lvi.Tag;

query += "INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (" + currentEvent.Id.ToString() + ", " + currentEvent.CreatureId.ToString() + ", " + currentEvent.ConditionId.ToString() + ", " + currentEvent.Type.ToString() + ", " + currentEvent.InversePhaseMask.ToString() + ", " + currentEvent.Chance.ToString() + ", " + currentEvent.Flags.ToString() + ", " + currentEvent.Param1.ToString() + ", " + currentEvent.Param2.ToString() + ", " + currentEvent.Param3.ToString() + ", " + currentEvent.Param4.ToString() + ", " + currentEvent.ScriptId1.ToString() + ", " + currentEvent.ScriptId2.ToString() + ", " + currentEvent.ScriptId3.ToString() + ", '" + Helpers.MySQLEscape(currentEvent.Comment) + "');\n";
if (i > 0)
query += ",\n";

query += "(" + currentEvent.Id.ToString() + ", " + currentEvent.CreatureId.ToString() + ", " + currentEvent.ConditionId.ToString() + ", " + currentEvent.Type.ToString() + ", " + currentEvent.InversePhaseMask.ToString() + ", " + currentEvent.Chance.ToString() + ", " + currentEvent.Flags.ToString() + ", " + currentEvent.Param1.ToString() + ", " + currentEvent.Param2.ToString() + ", " + currentEvent.Param3.ToString() + ", " + currentEvent.Param4.ToString() + ", " + currentEvent.ScriptId1.ToString() + ", " + currentEvent.ScriptId2.ToString() + ", " + currentEvent.ScriptId3.ToString() + ", '" + Helpers.MySQLEscape(currentEvent.Comment) + "')";
}
query += ";\n";
}

return query;
}
private void btnSave_Click(object sender, EventArgs e)
Expand Down
50 changes: 50 additions & 0 deletions ScriptEditor/GameData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public static class GameData
public static readonly List<Tuple<string, uint>> SpellAttributesEx2List = new List<Tuple<string, uint>>();
public static readonly List<Tuple<string, uint>> SpellAttributesEx3List = new List<Tuple<string, uint>>();
public static readonly List<Tuple<string, uint>> SpellAttributesEx4List = new List<Tuple<string, uint>>();
public static readonly List<Tuple<string, uint>> SpellProcFlagsList = new List<Tuple<string, uint>>();
public static readonly List<Tuple<string, uint>> SpellProcFlagsExList = new List<Tuple<string, uint>>();

public static int FindIndexOfMap(uint id)
{
Expand Down Expand Up @@ -2588,6 +2590,54 @@ static GameData()
SpellAttributesEx4List.Add(new Tuple<string, uint>("Allow Cast While Casting", 128));
SpellAttributesEx4List.Add(new Tuple<string, uint>("Ignore Damage Taken Modifiers", 256));
SpellAttributesEx4List.Add(new Tuple<string, uint>("Combat Feedback When Usable", 512));

// Spell Proc Flags
SpellProcFlagsList.Add(new Tuple<string, uint>("Heartbeat", 1));
SpellProcFlagsList.Add(new Tuple<string, uint>("Kill", 2));
SpellProcFlagsList.Add(new Tuple<string, uint>("Deal Melee Swing", 4));
SpellProcFlagsList.Add(new Tuple<string, uint>("Take Melee Swing", 8));
SpellProcFlagsList.Add(new Tuple<string, uint>("Deal Melee Ability", 16));
SpellProcFlagsList.Add(new Tuple<string, uint>("Take Melee Ability", 32));
SpellProcFlagsList.Add(new Tuple<string, uint>("Deal Ranged Attack", 64));
SpellProcFlagsList.Add(new Tuple<string, uint>("Take Ranged Attack", 128));
SpellProcFlagsList.Add(new Tuple<string, uint>("Deal Ranged Ability", 256));
SpellProcFlagsList.Add(new Tuple<string, uint>("Take Ranged Ability", 512));
SpellProcFlagsList.Add(new Tuple<string, uint>("Deal Helpful Ability", 1024));
SpellProcFlagsList.Add(new Tuple<string, uint>("Take Helpful Ability", 2048));
SpellProcFlagsList.Add(new Tuple<string, uint>("Deal Harmful Ability", 4096));
SpellProcFlagsList.Add(new Tuple<string, uint>("Take Harmful Ability", 8192));
SpellProcFlagsList.Add(new Tuple<string, uint>("Deal Helpful Spell", 16384));
SpellProcFlagsList.Add(new Tuple<string, uint>("Take Helpful Spell", 32768));
SpellProcFlagsList.Add(new Tuple<string, uint>("Deal Harmful Spell", 65536));
SpellProcFlagsList.Add(new Tuple<string, uint>("Take Harmful Spell", 131072));
SpellProcFlagsList.Add(new Tuple<string, uint>("Deal Harmful Periodic", 262144));
SpellProcFlagsList.Add(new Tuple<string, uint>("Take Harmful Periodic", 524288));
SpellProcFlagsList.Add(new Tuple<string, uint>("Taken Any Damage", 1048576));
SpellProcFlagsList.Add(new Tuple<string, uint>("On Trap Activation", 2097152));
SpellProcFlagsList.Add(new Tuple<string, uint>("Main Hand Weapon Swing", 4194304));
SpellProcFlagsList.Add(new Tuple<string, uint>("Off Hand Weapon Swing", 8388608));

// Spell Proc Flags Ex
SpellProcFlagsExList.Add(new Tuple<string, uint>("Normal Hit", 1));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Critical Hit", 2));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Miss", 4));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Resist", 8));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Dodge", 16));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Parry", 32));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Block", 64));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Evade", 128));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Immune", 256));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Deflect", 512));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Absorb", 1024));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Reflect", 2048));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Interrupt", 4096));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Reserved1", 8192));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Reserved2", 16384));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Reserved3", 32768));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Trigger Always", 65536));
SpellProcFlagsExList.Add(new Tuple<string, uint>("No Periodic", 131072));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Periodic Positive", 262144));
SpellProcFlagsExList.Add(new Tuple<string, uint>("Cast End", 524288));
}
}
public struct BroadcastText
Expand Down
4 changes: 3 additions & 1 deletion ScriptEditor/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ public static DialogResult ShowFlagInputDialog(ref uint flags, string name, List
{
foreach (var item in valuesList)
{
int neededSize = 20 + item.Item1.Length * 6;
int neededSize = 20;
foreach (char chr in item.Item1)
neededSize += (Char.IsUpper(chr) ? 9 : 6);
if (neededSize > columnSize)
columnSize = neededSize;
}
Expand Down
4 changes: 2 additions & 2 deletions ScriptEditor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("8.5.0.0")]
[assembly: AssemblyFileVersion("8.5.0.0")]
[assembly: AssemblyVersion("8.6.0.0")]
[assembly: AssemblyFileVersion("8.6.0.0")]

0 comments on commit 595b725

Please sign in to comment.