150 строки
4.5 KiB
Lua
150 строки
4.5 KiB
Lua
![]() |
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<41>erdem folgt ein <20>bersichtsframe.\nIm Tastaturbelegungsmen<65> 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;
|