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

9
Bindings.xml Normal file
View File

@ -0,0 +1,9 @@
<Bindings>
<Binding name="Random_Mount_RARE" header="Random_Mount_TITLE">
Random_Mount_Use("rare");
</Binding>
<Binding name="Random_Mount_EPIC">
Random_Mount_Use("epic");
</Binding>
</Bindings>

220
Random_Mount.lua Normal file
View File

@ -0,0 +1,220 @@
Random_Mount_Mounted = FALSE;
Random_Mount_Bag = 0;
Random_Mount_Slot = 0;
function Random_Mount_Use(type)
-- BEGIN
BreakIt = 0;
stop_it = 0;
Num_rnd = 0;
-- hour, minute = GetGameTime();
-- math.randomseed(GetTime());
-- Rare
ID_rare = {
-- Alliance
[0] = "item:5864:"; -- Gray Ram
[1] = "item:5872:"; -- Brown Ram
[2] = "item:5873:"; -- White Ram
[3] = "item:8632:"; -- Reins of Spotted Frostsaber
[4] = "item:8631:"; -- Reins of Striped Frostsaber
[5] = "item:8629:"; -- Reins of Striped Nightsaber
[6] = "item:5656:"; -- Braunes Pferd
[7] = "item:5655:"; -- Kastanienbraune Stute
[8] = "item:2414:"; -- Schecke
[9] = "item:2411:"; -- Rappenzaumzeug
[10] = "item:8595:"; -- Blauer Roboschreiter
[11] = "item:13321:"; -- Gr&uuml;ner "
[12] = "item:8563:"; -- Roter "
[13] = "item:13322:"; -- Unlackierter "
-- Horde
[14] = "item:13332:"; -- Blaues Skelettpferd
[15] = "item:13333:"; -- Braunes "
[16] = "item:13331:"; -- Rotes "
[17] = "item:15290:"; -- Brauner Kodo
[18] = "item:15277:"; -- Grauer "
[19] = "item:8588:"; -- Pfeife des smaragdfarbenen Raptors
[20] = "item:8591:"; -- " t&uuml;rkisfarbenen "
[21] = "item:8592:"; -- " violetten "
[22] = "item:5668:"; -- Horn des braunen Wolfs
[23] = "item:5665:"; -- " Terrorwolfs
[24] = "item:1132:"; -- " Waldwolfs
-- EMPTY!
[25] = "item:EMPTY:";
[26] = "item:EMPTY:";
[27] = "item:EMPTY:";
[28] = "item:EMPTY:";
[29] = "item:EMPTY:";
[30] = "item:EMPTY:";
[31] = "item:EMPTY:";
[32] = "item:EMPTY:";
[33] = "item:EMPTY:";
[34] = "item:EMPTY:";
[35] = "item:EMPTY:";
[36] = "item:EMPTY:";
[37] = "item:EMPTY:";
[38] = "item:EMPTY:";
[39] = "item:EMPTY:";
[40] = "item:EMPTY:";
[41] = "item:EMPTY:";
[42] = "item:EMPTY:";
[43] = "item:EMPTY:";
[44] = "item:EMPTY:";
[45] = "item:EMPTY:";
[46] = "item:EMPTY:";
[47] = "item:EMPTY:";
[48] = "item:EMPTY:";
[49] = "item:EMPTY:";
[50] = "item:EMPTY:";
[51] = "item:EMPTY:";
[52] = "item:EMPTY:";
[53] = "item:EMPTY:";
[54] = "item:EMPTY:";
[55] = "item:EMPTY:";
};
-- Epic
ID_epic = {
-- Alliance
[0] = "item:18787:"; -- Swift Gray Ram
[1] = "item:18786:"; -- Swift Brown Ram
[2] = "item:18785:"; -- Swift White Ram
[3] = "item:13329:"; -- Frost Ram
[5] = "item:13328:"; -- Black Ram
[6] = "item:12302:"; -- Reins of the Frostsaber
[7] = "item:12303:"; -- Reins of the Nightsaber
[8] = "item:18766:"; -- Reins of the Swift Frostsaber
[9] = "item:18902:"; -- Reins of the Swift Stormsaber
[10] = "item:18242:"; -- Reins of the Black War Tiger
[11] = "item:13086:"; -- Reins of the Winterspring Frostsaber
[12] = "item:13327:"; -- Eisblauer Roboschreiter
[13] = "item:18774:"; -- Schneller gelber "
[14] = "item:18772:"; -- Schneller gr&uuml;ner "
[15] = "item:18773:"; -- Schnelles wei&szlig;er "
[16] = "item:13326:"; -- Wei&szlig;er "
[17] = "item:12354:"; -- Palominozaumzeug
[18] = "item:12353:"; -- Schimmelzaumzeug
[19] = "item:18777:"; -- Schneller Brauner
[20] = "item:18776:"; -- Schnelles Palomino
[21] = "item:18778:"; -- Schnelles wei&szlig;es Ross
[22] = "item:18244:"; -- Schwarzer Kriegswidder
[23] = "item:18243:"; -- Schwarzer Schlachtenschreiter
[24] = "item:18241:"; -- Schwarzes Schlachtrosszaumzeug
[25] = "item:18242:"; -- Z&uuml;gel des schwarzen Kriegstigers
-- Horde
[26] = "item:13334:"; -- Gr&uuml;nes Skelettschlachtross
[27] = "item:18791:"; -- Pruprunes "
[28] = "item:15293:"; -- Graublauer Kodo
[29] = "item:18794:"; -- Gro&szlig;er brauner "
[30] = "item:18795:"; -- " grauer "
[31] = "item:18793:"; -- " wei&szlig;er "
[32] = "item:15292:"; -- Gr&uuml;ner "
[33] = "item:13317:"; -- Pfeife des elfenbeinfarbenen Raptors
[34] = "item:8586:"; -- " scheckigen roten "
[35] = "item:18788:"; -- Schneller blauer "
[36] = "item:18789:"; -- Schneller olivfarbener "
[37] = "item:18790:"; -- Schneller orangerener "
[38] = "item:12351:"; -- Horn des arktischen Wolfs
[39] = "item:12330:"; -- Horn des roten Wolfs
[40] = "item:18796:"; -- Horn des schnellen braunen Wolfs
[41] = "item:18798:"; -- " Grauwolfs
[42] = "item:18797:"; -- " Waldwolfs
[43] = "item:18245:"; -- Horn des schwarzen Kriegswolfs
[44] = "item:18246:"; -- Pfeife des schwarzen Kriegsraptors
[45] = "item:18248:"; -- Rotes Skelettschlachtross
[46] = "item:18247:"; -- Schwarzer Kriegskodo
-- Stuff ;)
[47] = "item:13335:"; -- Deathcharger's Reins
[48] = "item:19902:"; -- Schneller zulianischer Tiger
[49] = "item:19872:"; -- Schneller Razzashiraptor
[50] = "item:21218:"; -- Blauer Qirajiresonanzkristall
[51] = "item:21324:"; -- Gelber "
[52] = "item:21323:"; -- Gr&uuml;ner "
[53] = "item:21321:"; -- Roter "
[54] = "item:19030:"; -- Streitwidder der Stormpike
[55] = "item:19029:"; -- Horn des Frostwolfheulers
};
if (Random_Mount_Mounted == FALSE) then
while ((stop_it < 250) and (BreakIt ~= 1)) do -- search max. 250 rnd numbers for a mount (great chance to hit one ;) )
stop_it = stop_it + 1;
Num_rnd = math.random(0, 55); -- 0, Max. Mount Number
-- Protection against wrong Item IDs ----- hmm official lua manual wrong? ;)
if ((ID_rare[Num_rnd] == "") or (ID_rare[Num_rnd] == NIL)) then
ID_rare[Num_rnd] ="item:EMPTY:";
end;
if ((ID_epic[Num_rnd] == "") or (ID_epic[Num_rnd] == NIL)) then
ID_epic[Num_rnd] ="item:EMPTY:";
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 (type == "rare") then
if ((string.find(GetContainerItemLink(bag, slot), ID_rare[Num_rnd])) and (GetContainerItemCooldown(bag, slot) == 0)) then
UseContainerItem(bag, slot);
BreakIt = 1;
Random_Mount_Bag = bag;
Random_Mount_Slot = slot;
Random_Mount_Mounted = TRUE;
end;
end;
if (type == "epic") then
if ((string.find(GetContainerItemLink(bag, slot), ID_epic[Num_rnd])) and (GetContainerItemCooldown(bag, slot) == 0)) then
UseContainerItem(bag, slot);
BreakIt = 1;
Random_Mount_Bag = bag;
Random_Mount_Slot = slot;
Random_Mount_Mounted = TRUE;
end;
end;
end;
end;
end;
end;
else
UseContainerItem(Random_Mount_Bag, Random_Mount_Slot);
Random_Mount_Bag = 0;
Random_Mount_Slot = 0;
Random_Mount_Mounted = FALSE;
end;
-- END
end;

5
Random_Mount.toc Normal file
View File

@ -0,0 +1,5 @@
## Interface: 11200
## Title: Random Mount
## Notes: Random MountAddon - Use random a mount out of your inventory || by GreatFlo
localization.en.lua
Random_Mount.lua

259
Random_Mount.xml Normal file
View File

@ -0,0 +1,259 @@
<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">
<CheckButton name="EasyPotionUse_TabTemplate" virtual="true" hidden="true">
<Size>
<AbsDimension x="32" y="32"/>
</Size>
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\SpellBook\SpellBook-SkillLineTab">
<Size>
<AbsDimension x="64" y="64"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="-3" y="11"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnClick>
if(EasyPotionUse_OptionsFrame) then EasyPotionUse_TabClick(); end
</OnClick>
<OnEnter>
GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
GameTooltip:SetText(this.tipinfo);
</OnEnter>
<OnLeave>
GameTooltip:Hide();
</OnLeave>
</Scripts>
<NormalTexture/>
<HighlightTexture file="Interface\Buttons\ButtonHilight-Square" alphaMode="ADD"/>
<CheckedTexture file="Interface\Buttons\CheckButtonHilight" alphaMode="ADD"/>
</CheckButton>
<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_onLoad();
</OnLoad>
<OnDragStart>
this:StartMoving();
this.isMoving = true;
</OnDragStart>
<OnDragStop>
this:StopMovingOrSizing();
this.isMoving = false;
</OnDragStop>
<OnEvent>
EPU_OnEvent();
</OnEvent>
</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>
<Layer level="BACKGROUND">
<FontString name="$parent_Type_Text" inherits="GameFontNormal" text="Potiontype to Use first:">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="25" y="-40"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parent_Order_Text" inherits="GameFontNormal" text="Potion Use Order:">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="25" y="-100"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<CheckButton name="EasyPotionUse_OptionsFrame_Tab0" inherits="EasyPotionUse_TabTemplate" id="0" hidden="false">
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-3" y="-35"/>
</Offset>
</Anchor>
</Anchors>
</CheckButton>
<CheckButton name="EasyPotionUse_OptionsFrame_Tab1" inherits="EasyPotionUse_TabTemplate" id="1" hidden="false">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="EasyPotionUse_OptionsFrame_Tab0" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="-3" y="-17"/>
</Offset>
</Anchor>
</Anchors>
</CheckButton>
<Button name="$parent_Type_DropDown" inherits="UIDropDownMenuTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="25" y="-60"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
</Scripts>
</Button>
<Button name="$parent_Order0_DropDown" inherits="UIDropDownMenuTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="25" y="-120"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
</Scripts>
</Button>
<Button name="$parent_Order1_DropDown" inherits="UIDropDownMenuTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="25" y="-150"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
</Scripts>
</Button>
<Button name="$parent_Order2_DropDown" inherits="UIDropDownMenuTemplate">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="25" y="-180"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
</Scripts>
</Button>
<Button name="$parent_Done" 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_Random_Mount_TITLE = "Random Mount";
BINDING_NAME_Random_Mount_RARE = "Use Rare Mount";
BINDING_NAME_Random_Mount_EPIC = "Use Epic Mount";