public static bool HasDebuffType(this WoWUnit unit, string type) { string luaString = @"hasDebuff = false; for i=1,40 do local _, _ debuffType = UnitDebuff(""{1}"", i); if debuffType == ""{0}"" then hasDebuff = true break; end end"; return Lua.LuaDoString<bool>(FormatLua(luaString, type, CombatUtil.GetLuaId(unit)), "hasDebuff"); }
public static bool IsPlayer(this WoWUnit unit) { string luaString = @"isPlayer = (UnitIsPlayer(""{0}"") == 1)"; return(Lua.LuaDoString <bool>(FormatLua(luaString, CombatUtil.GetLuaId(unit)), "isPlayer")); }
public static bool IsCreatureType(this WoWUnit unit, string type) { string luaString = @"isCreatureType = (UnitCreatureType(""{1}"") == ""{0}"" or false);"; return(Lua.LuaDoString <bool>(FormatLua(luaString, type, CombatUtil.GetLuaId(unit)), "isCreatureType")); }
public static bool HasMana(this WoWUnit unit) { string luaString = @"return (UnitPowerType(""{0}"") == 0 and UnitMana(""{0}"") > 1)"; return(Lua.LuaDoString <bool>(FormatLua(luaString, CombatUtil.GetLuaId(unit)))); }