Skip to content

Commit

Permalink
New commands and search by range option.
Browse files Browse the repository at this point in the history
  • Loading branch information
brotalnia committed Jun 15, 2018
1 parent 5ce524e commit ca892ba
Show file tree
Hide file tree
Showing 21 changed files with 395 additions and 24 deletions.
8 changes: 8 additions & 0 deletions ScriptEditor/DataFinderForms/FormAreaFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ protected override void AddById(uint id)
AddAreaToListView(area);
}
}
protected override void AddByIdRange(uint minId, uint maxId)
{
foreach (AreaInfo area in GameData.AreaInfoList)
{
if ((area.ID >= minId) && (area.ID <= maxId))
AddAreaToListView(area);
}
}
protected override void AddByText(string searchText)
{
foreach (AreaInfo area in GameData.AreaInfoList)
Expand Down
23 changes: 20 additions & 3 deletions ScriptEditor/DataFinderForms/FormConditionFinder.Designer.cs

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

15 changes: 15 additions & 0 deletions ScriptEditor/DataFinderForms/FormConditionFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,32 @@ protected override void AddById(uint id)
AddConditionToListView(condition);
}
}
protected override void AddByIdRange(uint minId, uint maxId)
{
foreach (ConditionInfo condition in GameData.ConditionInfoList)
{
if ((condition.ID >= minId) && (condition.ID <= maxId))
AddConditionToListView(condition);
}
}
private void AddConditionToListView(ConditionInfo condition)
{
ListViewItem lvi = new ListViewItem();
lvi.Text = condition.ID.ToString();
lvi.SubItems.Add(GameData.FindConditionName(condition.Type));
lvi.SubItems.Add(condition.Value1.ToString());
lvi.SubItems.Add(condition.Value2.ToString());
lvi.SubItems.Add(condition.Value3.ToString());
lvi.SubItems.Add(condition.Value4.ToString());
lvi.SubItems.Add(condition.Flags.ToString());

// Add this condition to the listview.
lstData.Items.Add(lvi);
}

private void FormConditionFinder_ResizeEnd(object sender, EventArgs e)
{
lstData.Columns[1].Width = lstData.ClientSize.Width - lstData.Columns[0].Width - lstData.Columns[2].Width - lstData.Columns[3].Width - lstData.Columns[4].Width - lstData.Columns[5].Width - lstData.Columns[6].Width;
}
}
}
8 changes: 8 additions & 0 deletions ScriptEditor/DataFinderForms/FormCreatureFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ protected override void AddById(uint id)
AddCreatureToListView(creature);
}
}
protected override void AddByIdRange(uint minId, uint maxId)
{
foreach (CreatureInfo creature in GameData.CreatureInfoList)
{
if ((creature.ID >= minId) && (creature.ID <= maxId))
AddCreatureToListView(creature);
}
}
protected override void AddByText(string searchText)
{
foreach (CreatureInfo creature in GameData.CreatureInfoList)
Expand Down
41 changes: 38 additions & 3 deletions ScriptEditor/DataFinderForms/FormDataFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,56 @@ private void btnSelectNone_Click(object sender, EventArgs e)
Close();
}

private bool ExtractIdRange(ref uint minEntryId, ref uint maxEntryId)
{
if (txtSearch.Text.Contains("-"))
{
string[] idRanges = txtSearch.Text.Split('-');

if (idRanges.Length == 2)
{
uint minId = 0;
uint maxId = 0;
if (uint.TryParse(idRanges[0], out minId) && uint.TryParse(idRanges[1], out maxId))
{
if (minId < maxId)
{
minEntryId = minId;
maxEntryId = maxId;
return true;
}
}
}
}
return false;
}

private void btnSearch_Click(object sender, EventArgs e)
{
lstData.Items.Clear();

uint itemId;
uint minEntryId = 0;
uint maxEntryId = 0;

if (txtSearch.Text == "") // Display all texts.
{
lstData.ListViewItemSorter = null; // Disable sorter or it will take forever.
AddAllData();
}
else if (uint.TryParse(txtSearch.Text, out itemId)) // If content is numeric search for id.
else if (uint.TryParse(txtSearch.Text, out minEntryId)) // If content is numeric search for id.
{
AddById(itemId);
AddById(minEntryId);
lstData.ListViewItemSorter = textComparer;
}
else if (ExtractIdRange(ref minEntryId, ref maxEntryId)) // Check if a range is provided
{
if (minEntryId + 1000 < maxEntryId)
lstData.ListViewItemSorter = null;
else
lstData.ListViewItemSorter = textComparer;

AddByIdRange(minEntryId, maxEntryId);
}
else // Add items that contain this text.
{
AddByText(txtSearch.Text);
Expand All @@ -95,6 +129,7 @@ private void btnSearch_Click(object sender, EventArgs e)
}
protected virtual void AddAllData() { }
protected virtual void AddById(uint id) { }
protected virtual void AddByIdRange(uint minId, uint maxId) { }
protected virtual void AddByText(string searchText) { }
private void lstData_ColumnClick(object sender, ColumnClickEventArgs e)
{
Expand Down
8 changes: 8 additions & 0 deletions ScriptEditor/DataFinderForms/FormEventFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ protected override void AddById(uint id)
AddGameEventToListView(game_event);
}
}
protected override void AddByIdRange(uint minId, uint maxId)
{
foreach (GameEventInfo game_event in GameData.GameEventInfoList)
{
if ((game_event.ID >= minId) && (game_event.ID <= maxId))
AddGameEventToListView(game_event);
}
}
protected override void AddByText(string searchText)
{
foreach (GameEventInfo game_event in GameData.GameEventInfoList)
Expand Down
8 changes: 8 additions & 0 deletions ScriptEditor/DataFinderForms/FormFactionTemplateFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ protected override void AddById(uint id)
AddFactionToListView(faction);
}
}
protected override void AddByIdRange(uint minId, uint maxId)
{
foreach (FactionTemplateInfo faction in GameData.FactionTemplateInfoList)
{
if ((faction.ID >= minId) && (faction.ID <= maxId))
AddFactionToListView(faction);
}
}
protected override void AddByText(string searchText)
{
foreach (FactionTemplateInfo faction in GameData.FactionTemplateInfoList)
Expand Down
8 changes: 8 additions & 0 deletions ScriptEditor/DataFinderForms/FormGameObjectFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ protected override void AddById(uint id)
AddGameObjectToListView(gameobject);
}
}
protected override void AddByIdRange(uint minId, uint maxId)
{
foreach (GameObjectInfo gameobject in GameData.GameObjectInfoList)
{
if ((gameobject.ID >= minId) && (gameobject.ID <= maxId))
AddGameObjectToListView(gameobject);
}
}
protected override void AddByText(string searchText)
{
foreach (GameObjectInfo gameobject in GameData.GameObjectInfoList)
Expand Down
8 changes: 8 additions & 0 deletions ScriptEditor/DataFinderForms/FormItemFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ protected override void AddById(uint id)
AddItemToListView(item);
}
}
protected override void AddByIdRange(uint minId, uint maxId)
{
foreach (ItemInfo item in GameData.ItemInfoList)
{
if ((item.ID >= minId) && (item.ID <= maxId))
AddItemToListView(item);
}
}
protected override void AddByText(string searchText)
{
foreach (ItemInfo item in GameData.ItemInfoList)
Expand Down
8 changes: 8 additions & 0 deletions ScriptEditor/DataFinderForms/FormQuestFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ protected override void AddById(uint id)
AddQuestToListView(quest);
}
}
protected override void AddByIdRange(uint minId, uint maxId)
{
foreach (QuestInfo quest in GameData.QuestInfoList)
{
if ((quest.ID >= minId) && (quest.ID <= maxId))
AddQuestToListView(quest);
}
}
protected override void AddByText(string searchText)
{
foreach (QuestInfo quest in GameData.QuestInfoList)
Expand Down
8 changes: 8 additions & 0 deletions ScriptEditor/DataFinderForms/FormSoundFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ protected override void AddById(uint id)
AddSoundToListView(sound);
}
}
protected override void AddByIdRange(uint minId, uint maxId)
{
foreach (SoundInfo sound in GameData.SoundInfoList)
{
if ((sound.ID >= minId) && (sound.ID <= maxId))
AddSoundToListView(sound);
}
}
protected override void AddByText(string searchText)
{
foreach (SoundInfo sound in GameData.SoundInfoList)
Expand Down
8 changes: 8 additions & 0 deletions ScriptEditor/DataFinderForms/FormSpellFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,14 @@ protected override void AddById(uint id)
AddSpellToListView(spell);
}
}
protected override void AddByIdRange(uint minId, uint maxId)
{
foreach (SpellInfo spell in GameData.SpellInfoList)
{
if ((spell.ID >= minId) && (spell.ID <= maxId))
AddSpellToListView(spell);
}
}
protected override void AddByText(string searchText)
{
foreach (SpellInfo spell in GameData.SpellInfoList)
Expand Down
8 changes: 8 additions & 0 deletions ScriptEditor/DataFinderForms/FormTaxiFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ protected override void AddById(uint id)
AddPathToListView(path);
}
}
protected override void AddByIdRange(uint minId, uint maxId)
{
foreach (TaxiInfo path in GameData.TaxiInfoList)
{
if ((path.ID >= minId) && (path.ID <= maxId))
AddPathToListView(path);
}
}
protected override void AddByText(string searchText)
{
foreach (TaxiInfo path in GameData.TaxiInfoList)
Expand Down
8 changes: 8 additions & 0 deletions ScriptEditor/DataFinderForms/FormTextFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ protected override void AddById(uint id)
AddTextToListView(bc);
}
}
protected override void AddByIdRange(uint minId, uint maxId)
{
foreach (BroadcastText bc in GameData.BroadcastTextsList)
{
if ((bc.ID >= minId) && (bc.ID <= maxId))
AddTextToListView(bc);
}
}
protected override void AddByText(string searchText)
{
foreach (BroadcastText bc in GameData.BroadcastTextsList)
Expand Down
8 changes: 8 additions & 0 deletions ScriptEditor/DataFinderForms/FormWeaponFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ protected override void AddById(uint id)
AddItemToListView(item);
}
}
protected override void AddByIdRange(uint minId, uint maxId)
{
foreach (ItemInfo item in GameData.ItemInfoList)
{
if ((item.ID >= minId) && (item.ID <= maxId))
AddItemToListView(item);
}
}
protected override void AddByText(string searchText)
{
foreach (ItemInfo item in GameData.ItemInfoList)
Expand Down
Loading

0 comments on commit ca892ba

Please sign in to comment.