Skip to content

Commit

Permalink
Impement additional Search in Spell Info
Browse files Browse the repository at this point in the history
  • Loading branch information
Konctantin committed Apr 20, 2010
1 parent 5f777a4 commit f4bbf33
Show file tree
Hide file tree
Showing 5 changed files with 193 additions and 41 deletions.
10 changes: 10 additions & 0 deletions SpellWork/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,16 @@ public static int ToInt32(this Object val)
return num;
}

public static float ToFloat(this Object val)
{
if (val == null)
return 0;

float num;
float.TryParse(val.ToString().Replace(',', '.'), out num);
return num;
}

// Time methods
public static Int32 MsDiff(DateTime time1, DateTime time2)
{
Expand Down
143 changes: 103 additions & 40 deletions SpellWork/MainForm.Designer.cs

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

77 changes: 76 additions & 1 deletion SpellWork/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private void _bSearch_Click(object sender, EventArgs e)
switch (b.Name)
{
case "_bSearch":
Search(_lvSpellList, _tbSearch);
Search(_lvSpellList, _tbSearchId);
break;
case "_bProcSearch":
Search(_lvProcSpellList, _tbProcSeach);
Expand Down Expand Up @@ -243,5 +243,80 @@ private void SetProcAtribute(SpellEntry spell)
_tbChance.Text = spell.ProcChance.ToString();
_tbCooldown.Text = (spell.RecoveryTime / 1000f).ToString();
}

private void GetProcAttribute(SpellEntry spell)
{
// test
var statusproc = String.Format("Spell ({0}) {1}. Proc Event ==>SchoolMask 0x{2:X2}, SpellFamily {3}, 0x{4:X8} {5:X8} {6:X8}, procFlag {7:X8}, PPMRate {8}",
spell.ID,
spell.SpellNameRank,
_clbSchools.GetFlagsValue(),
_cbProcFitstSpellFamily.ValueMember,
spell.SpellFamilyFlags1,
spell.SpellFamilyFlags2,
spell.SpellFamilyFlags3,
spell.ProcFlags,
_tbPPM.Text.ToFloat());

_gSpellProcEvent.Text = "Spell Proc Event " + statusproc;
}

private void _clbSchools_SelectedIndexChanged(object sender, EventArgs e)
{
if (ProcInfo.SpellProc.ID != 0)
{
GetProcAttribute(ProcInfo.SpellProc);
}
}

private void _tbSearchId_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
AdditionalSeach();
}
}

private void _bSearch_Click_1(object sender, EventArgs e)
{
AdditionalSeach();
}

private void AdditionalSeach()
{
_lvSpellList.Items.Clear();

string name = _tbSearchId.Text;
uint id = _tbSearchId.Text.ToUInt32();
uint ic = _tbSearchIcon.Text.ToUInt32();
uint at = _tbSearchAttributes.Text.ToUInt32();

var query = from spell in DBC.Spell
where (id == 0 || (id == 0 || spell.Key == id)
&& (id != 0 || ContainText(spell.Value.SpellName, name)))

&& (ic == 0 || spell.Value.SpellIconID == ic)

&& (at == 0 || spell.Value.Attributes == at
|| spell.Value.AttributesEx == at
|| spell.Value.AttributesEx2 == at
|| spell.Value.AttributesEx3 == at
|| spell.Value.AttributesEx4 == at
|| spell.Value.AttributesEx5 == at
|| spell.Value.AttributesEx6 == at
|| spell.Value.AttributesExG == at)
select spell;

if (query.Count() == 0) return;

foreach (var element in query)
{
_lvSpellList.Items.Add(new ListViewItem(new String[]
{
element.Key.ToString(),
element.Value.SpellNameRank
}));
}
}
}
}
2 changes: 2 additions & 0 deletions SpellWork/ProcInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ namespace SpellWork
{
public static class ProcInfo
{
public static SpellEntry SpellProc { get; set; }

public static void BuildFamilyTree(TreeView familyTree, SpellFamilyNames spellfamily)
{
familyTree.Nodes.Clear();
Expand Down
2 changes: 2 additions & 0 deletions SpellWork/SpellInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class SpellInfo
{
public static void View(RichTextBox sb, SpellEntry spell)
{
ProcInfo.SpellProc = spell;

sb.Clear();
sb.SetBold();
sb.AppendFormatLine("ID - {0} {1}", spell.ID, spell.SpellNameRank);
Expand Down

0 comments on commit f4bbf33

Please sign in to comment.