Skip to content

Commit

Permalink
If there are no gaps in the table, get guids higher than the last val…
Browse files Browse the repository at this point in the history
…ue of the table (happens with game_event)

Add creature_equip_template
  • Loading branch information
DDuarte committed May 27, 2012
1 parent 4f5197c commit c1874c4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions UnusedGuidSearcher/MainForm.cs
Expand Up @@ -8,13 +8,15 @@ namespace UnusedGuidSearcher
{
public partial class MainForm : Form
{
private readonly Dictionary<object, string> _supportedTables = new Dictionary<object, string>
// table name, primary key
private readonly Dictionary<string, string> _supportedTables = new Dictionary<string, string>
{
{"`creature`", "`guid`"},
{"`gameobject`", "`guid`"},
{"`waypoint_scripts`", "`guid`"},
{"`pool_template`", "`entry`"},
{"`game_event`", "`eventEntry`"},
{"`creature_equip_template`", "`entry`"},
};

private static string _connectionString;
Expand All @@ -28,7 +30,7 @@ public MainForm(string connectionString)
private void MainFormLoad(object sender, EventArgs e)
{
// Defaults
TableComboBox.Items.AddRange(_supportedTables.Keys.ToArray());
TableComboBox.Items.AddRange(_supportedTables.Keys.Cast<object>().ToArray());
TableComboBox.Text = (string)TableComboBox.Items[0];
RandomRadio.Checked = true;
}
Expand Down Expand Up @@ -58,7 +60,9 @@ private void GoButtonClick(object sender, EventArgs e)
IEnumerable<int> missingGuids = possibleGuids.Except(existingGuids);
IEnumerable<int> selectedMissingGuids = null;

if (RandomRadio.Checked)
if (!missingGuids.Any())
selectedMissingGuids = Enumerable.Range(existingGuids.Last() + 1, (int)GuidCountUpDown.Value);
else if (RandomRadio.Checked)
selectedMissingGuids = missingGuids.Take((int)GuidCountUpDown.Value);
else if (ConsecutiveRadio.Checked)
selectedMissingGuids = GetConsecutiveGuids(missingGuids.ToArray(), (int)GuidCountUpDown.Value);
Expand Down

0 comments on commit c1874c4

Please sign in to comment.