commit 6da149983200df119829ee6e703e78575be48acc Author: Florian Brinker Date: Tue Jun 16 22:17:00 2020 +0200 init diff --git a/Bindings.xml b/Bindings.xml new file mode 100644 index 0000000..08cdd9a --- /dev/null +++ b/Bindings.xml @@ -0,0 +1,8 @@ + + + EasyPotionUse_UseItem("mp"); + + + EasyPotionUse_UseItem("hp"); + + diff --git a/EasyPotionUse.lua b/EasyPotionUse.lua new file mode 100644 index 0000000..bd13adf --- /dev/null +++ b/EasyPotionUse.lua @@ -0,0 +1,150 @@ +function EasyPotionUse_ShowInfo() + -- Slash commands + SlashCmdList["EasyPotionUseCOMMAND"] = EasyPotionUse_SlashHandler; + SLASH_EasyPotionUseCOMMAND1 = "/easypotionuse"; + SLASH_EasyPotionUseCOMMAND2 = "/epu"; +end; + +function EasyPotionUse_SlashHandler(msg) + + if (not msg or msg == "") then + if(EasyPotionUse_OptionsFrame:IsVisible()) then + EasyPotionUse_OptionsFrame:Hide(); + else + EasyPotionUse_OptionsFrame:Show(); + ChatFrame1:AddMessage(">>> Type '/epu help' for Help. <<<"); + end; + + elseif (string.lower(msg) == "help") then + ChatFrame1:AddMessage("/epu help - |cFF0000FFAlpha|r Test\n'/epu hp' nimmt einen Gesundheitsstein (falls vorhanden bzw. bereit) ansonsten einen Heiltrank.\n'/epu mp' nimmt einen ManaRubin (falls vorhanden bzw. bereit) ansonsten einen Manatrank. Wenn auch dieser nicht vorhanden / bereit ist, eine Dunkelrune.\nDas Addon nimmt automatisch zuerst den kleinsten Typ des Elements, das im Inventar gefunden wurde (z.B. Erst einen geringen Heiltrank, anstelle eines erheblichen.\n Das Optionsfenster ist noch nicht implementiert. Außerdem folgt ein Übersichtsframe.\nIm Tastaturbelegungsmenü kann das nehmen eines Heiltranks oder Manatranks je auf eine Taste gelegt werden.\nDanke fuers Testen,\neuer Asto"); + + elseif (string.lower(msg) == "mp") then + EasyPotionUse_UseItem("mp"); + + elseif (string.lower(msg) == "hp") then + EasyPotionUse_UseItem("hp"); + + else + ChatFrame1:AddMessage(">>> Fehler. Falscher Parameter! <<<"); + + end; + +end; + + +function EasyPotionUse_UseItem(ss) + + + + +Name_MP = {}; +Bag_MP = {}; +Slot_MP = {}; + +Name_HP = {}; +Bag_HP = {}; +Slot_HP = {}; + +BreakIt = 0; +Used = 0; + +-- Mana + +Name_MP[0] = "item:5514:"; -- Manaachat +Name_MP[1] = "item:5513:"; -- Manajadestein +Name_MP[2] = "item:8007:"; -- Manacitrin +Name_MP[3] = "item:8008:"; -- Manarubin + +Name_MP[4] = "item:2455:"; -- Normal ManaPotions +Name_MP[5] = "item:3385:"; +Name_MP[6] = "item:3827:"; +Name_MP[7] = "item:6149:"; +Name_MP[8] = "item:13443:"; +Name_MP[9] = "item:13444:"; + +Name_MP[10] = "item:20520:"; -- Dark Rune + +-- Health + +Name_HP[0] = "item:5512:"; +Name_HP[1] = "item:19004:"; -- skilled healthstone 1 +Name_HP[2] = "item:19005:"; -- skilled healthstone 2 + +Name_HP[3] = "item:5511:"; +Name_HP[4] = "item:19006:"; -- skilled healthstone 1 +Name_HP[5] = "item:19007:"; -- skilled healthstone 2 + +Name_HP[6] = "item:5509:"; +Name_HP[7] = "item:19008:"; -- skilled healthstone 1 +Name_HP[8] = "item:19009:"; -- skilled healthstone 2 + +Name_HP[9] = "item:5510:"; +Name_HP[10] = "item:19010:"; -- skilled healthstone 1 +Name_HP[11] = "item:19011:"; -- skilled healthstone 2 + +Name_HP[12] = "item:9421:"; +Name_HP[13] = "item:19012:"; -- skilled healthstone 1 +Name_HP[14] = "item:19013:"; -- skilled healthstone 2 + +Name_HP[15] = "item:118:"; -- Normal HealthPotions +Name_HP[16] = "item:858:"; +Name_HP[17] = "item:929:"; +Name_HP[18] = "item:1710:"; +Name_HP[19] = "item:3928:"; +Name_HP[20] = "item:13446:"; + + +for i=0,20 do + if (BreakIt == 1) then + break; + end; + + for bag=0,4 do + if (BreakIt == 1) then + break; + end; + + for slot=1,GetContainerNumSlots(bag) do + if (BreakIt == 1) then + break; + end; + + if GetContainerItemLink(bag,slot) then + + if (ss == "mp") then + if ((string.find(GetContainerItemLink(bag,slot), Name_MP[i])) and (GetContainerItemCooldown(bag, slot) == 0) and (UnitMana("player") < UnitManaMax("player"))) then + UseContainerItem(bag,slot); + ChatFrame1:AddMessage("|cFF0000FF>>> Mana aufgefuellt mit: "..GetContainerItemLink(bag,slot).."|cFF0000FF <<<"); + BreakIt = 1; + end; + elseif (ss == "hp") then + if ((string.find(GetContainerItemLink(bag,slot), Name_HP[i])) and (GetContainerItemCooldown(bag, slot) == 0) and (UnitHealth("player") < UnitHealthMax("player"))) then + UseContainerItem(bag,slot); + ChatFrame1:AddMessage("|cFFFF0000>>> Gesundheit aufgefuellt mit: "..GetContainerItemLink(bag,slot).."|cFFFF0000 <<<"); + BreakIt = 1; + Used = 1; + end; + end; + + end; + + end; + + end; + +end; + +if (Used == 0) then + if ((UnitClass("player") == "Warrior") and (UnitHealth("player") < UnitHealthMax("player"))) then + MaxHP = UnitHealthMax("player"); + CastSpellByName("Last Stand"); + if (MaxHP < UnitHealthMax("player")) then + ChatFrame1:AddMessage("|cFFFF0000>>> Benutze |rLetztes Gefecht|cFFFF0000 - |rVerliere in 20sek " .. UnitHealthMax("player")/100*30 .. "HP|cFFFF0000 <<<"); + SendChatMessage("Benutze letztes Gefecht!", "YELL", GetDefaultLanguage("player")); + SendChatMessage("Verliere in >>> 20sek <> " .. UnitHealthMax/100*30 .. "HP!", "YELL", GetDefaultLanguage("player")); + end; + end; +end; + + +end; \ No newline at end of file diff --git a/EasyPotionUse.toc b/EasyPotionUse.toc new file mode 100644 index 0000000..4c457ed --- /dev/null +++ b/EasyPotionUse.toc @@ -0,0 +1,5 @@ +## Interface: 11200 +## Title: EasyPotionUse +## Notes: Asto's EasyPotionUse Addon || by GreatFlo +localization.en.lua +EasyPotionUse.xml diff --git a/EasyPotionUse.xml b/EasyPotionUse.xml new file mode 100644 index 0000000..6e83d46 --- /dev/null +++ b/EasyPotionUse.xml @@ -0,0 +1,84 @@ + + +