public static void Button(String AbilityName, int Duration) { for (int i = 0; i < BindingsList.Count; i++) { if (BindingsList[i].AbilityName == AbilityName) {//Shift, Control, Alt Ability[] TempArray = BindingsList.ToArray(); TempArray[i].LastUse = DateTime.Now; BindingsList.Clear(); for (int n = 0; n < TempArray.Length; n++) { Abilities.BindingsList.Add(TempArray[n]); } if (BindingsList[i].AbilityType == 0) //Instant { AbilityStatus = "Instant"; } else { AbilityStatus = "Casting"; WowControl.Stop(); } StartCast = DateTime.Now; EndCast = DateTime.Now.AddMilliseconds(BindingsList[i].CastTime * 1000); if (CheckString(BindingsList[i].Modifiers, "Alt") == true) { WowControl.KeyToWnd(0x12, false); } if (CheckString(BindingsList[i].Modifiers, "Control") == true) { WowControl.KeyToWnd(0x11, false); } if (CheckString(BindingsList[i].Modifiers, "Shift") == true) { WowControl.KeyToWnd(0x10, false); } WowControl.KeyToWnd(BindingsList[i].Key, false); WowControl.Sleep(Duration); WowControl.KeyToWnd(BindingsList[i].Key, true); if (CheckString(BindingsList[i].Modifiers, "Alt") == true) { WowControl.KeyToWnd(0x12, true); } if (CheckString(BindingsList[i].Modifiers, "Control") == true) { WowControl.KeyToWnd(0x11, true); } if (CheckString(BindingsList[i].Modifiers, "Shift") == true) { WowControl.KeyToWnd(0x10, true); } } } }
public static void Button(String AbilityName) { bool Founded = false; for (int i = 0; i < BindingsList.Count; i++) { if (BindingsList[i].AbilityName == AbilityName) {//Shift, Control, Alt if (BindingsList[i].Key != 0) { Founded = true; } Ability[] TempArray = BindingsList.ToArray(); TempArray[i].LastUse = DateTime.Now; BindingsList.Clear(); for (int n = 0; n < TempArray.Length; n++) { BindingsList.Add(TempArray[n]); } if (BindingsList[i].AbilityType == 0) //Instant { AbilityStatus = "Instant"; } else { AbilityStatus = "Casting"; WowControl.Stop(); } StartCast = DateTime.Now; EndCast = DateTime.Now.AddMilliseconds(BindingsList[i].CastTime * 1000); if (CheckString(BindingsList[i].Modifiers, "Alt") == true) { WowControl.KeyToWnd(0x12, false); } if (CheckString(BindingsList[i].Modifiers, "Control") == true) { WowControl.KeyToWnd(0x11, false); } if (CheckString(BindingsList[i].Modifiers, "Shift") == true) { WowControl.KeyToWnd(0x10, false); } WowControl.KeyToWnd(BindingsList[i].Key, false); WowControl.KeyToWnd(BindingsList[i].Key, true); if (CheckString(BindingsList[i].Modifiers, "Alt") == true) { WowControl.KeyToWnd(0x12, true); } if (CheckString(BindingsList[i].Modifiers, "Control") == true) { WowControl.KeyToWnd(0x11, true); } if (CheckString(BindingsList[i].Modifiers, "Shift") == true) { WowControl.KeyToWnd(0x10, true); } } } if ((Founded == false) & (AbilityName != "Mote xtrtr")) { WowControl.UpdateStatus("Not found bind for ability: " + AbilityName + "."); } }