This commit is contained in:
Florian Brinker 2020-06-16 22:17:00 +02:00
commit 6da1499832
5 changed files with 250 additions and 0 deletions

8
Bindings.xml Normal file
View File

@ -0,0 +1,8 @@
<Bindings>
<Binding name="EasyPotionUse_MP" header="EasyPotionUse_TITLE">
EasyPotionUse_UseItem("mp");
</Binding>
<Binding name="EasyPotionUse_HP">
EasyPotionUse_UseItem("hp");
</Binding>
</Bindings>

150
EasyPotionUse.lua Normal file
View File

@ -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;

5
EasyPotionUse.toc Normal file
View File

@ -0,0 +1,5 @@
## Interface: 11200
## Title: EasyPotionUse
## Notes: Asto's EasyPotionUse Addon || by GreatFlo
localization.en.lua
EasyPotionUse.xml

84
EasyPotionUse.xml Normal file
View File

@ -0,0 +1,84 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<Script file="EasyPotionUse.lua"/>
<Frame name="EasyPotionUse_OptionsFrame" toplevel="true" frameStrata="DIALOG" movable="true" enableMouse="true" hidden="true" parent="UIParent" enableKeyboard="true">
<scripts>
<OnLoad>
this:RegisterForDrag("LeftButton");
EasyPotionUse_ShowInfo();
</OnLoad>
<OnDragStart>
this:StartMoving();
this.isMoving = true;
</OnDragStart>
<OnDragStop>
this:StopMovingOrSizing();
this.isMoving = false;
</OnDragStop>
</scripts>
<Size>
<AbsDimension x="300" y="400"/>
</Size>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<BackgroundInsets>
<AbsInset left="11" right="12" top="12" bottom="11"/>
</BackgroundInsets>
<TileSize>
<AbsValue val="32"/>
</TileSize>
<EdgeSize>
<AbsValue val="32"/>
</EdgeSize>
</Backdrop>
<Layers>
<Layer level="ARTWORK">
<Texture name="$parentHeader" file="Interface\DialogFrame\UI-DialogBox-Header">
<Size>
<AbsDimension x="600" y="64"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="12"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<FontString inherits="GameFontNormal" text="Asto's EasyPotionUse Addon">
<Anchors>
<Anchor point="TOP" relativeTo="$parentHeader">
<Offset>
<AbsDimension x="0" y="-14"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Button name="$parentDone" inherits="OptionsButtonTemplate" text="Done">
<Anchors>
<Anchor point="BOTTOM">
<Offset>
<AbsDimension x="0" y="20"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
EasyPotionUse_OptionsFrame:Hide();
</OnClick>
</Scripts>
</Button>
</Frames>
</Frame>
</Ui>

3
localization.en.lua Normal file
View File

@ -0,0 +1,3 @@
BINDING_HEADER_EasyPotionUse_TITLE = "Easy Potion Use";
BINDING_NAME_EasyPotionUse_MP = "Mana auffüllen";
BINDING_NAME_EasyPotionUse_HP = "Gesundheit auffüllen";