WoWInterface SVN QuickMountEquip

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 1 to Rev 2
    Reverse comparison

Rev 1 → Rev 2

trunk/QuickMountEquip/QuickMountEquip.xml New file
0,0 → 1,549
<!--
QuickMountEquip
 
by Robert Jenkins (Merrem@Perenolde), based on Totem Stomper by AlexYoshi
-->
<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="QuickMountEquip.lua"/>
 
<CheckButton name="QuickMountCheckButtonTemplate" inherits="UICheckButtonTemplate" virtual="true">
<Size>
<AbsDimension x="24" y="24"/>
</Size>
<Layers>
<Layer level="ARTWORK">
<FontString name="$parentText" inherits="GameFontNormalSmall" text="" justifyH="LEFT">
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT"/>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
QuickMountCheckButton_OnClick();
</OnClick>
<OnEnter>
QuickMountCheckButton_OnEnter();
</OnEnter>
<OnLeave>
QuickMountCheckButton_OnLeave();
</OnLeave>
</Scripts>
</CheckButton>
 
<CheckButton name="QuickMountButtonTemplate" virtual="true" inherits="ActionButtonTemplate">
<Scripts>
<OnLoad>
QuickMount_ButtonLoad();
</OnLoad>
<OnShow>
QuickMount_ButtonUpdate(this);
</OnShow>
<OnDragStart>
QuickMount_ButtonDragStart();
</OnDragStart>
<OnReceiveDrag>
QuickMount_ButtonDragEnd();
</OnReceiveDrag>
<OnClick>
QuickMount_ButtonClick(arg1);
</OnClick>
<OnEnter>
QuickMount_ButtonEnter();
</OnEnter>
<OnLeave>
QuickMount_ButtonLeave();
</OnLeave>
<OnEvent>
QuickMount_ButtonEvent(event);
</OnEvent>
</Scripts>
</CheckButton>
 
<!-- Frame Bar Template -->
<Frame name="QuickMountEquipSetTemplate" virtual="true" id="1">
<Size>
<AbsDimension x="384" y="48"/>
</Size>
<Frames>
<CheckButton name="$parent1" inherits="QuickMountButtonTemplate" id ="1">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="105" y="-10" />
</Offset>
</Anchor>
</Anchors>
</CheckButton>
<CheckButton name="$parent2" inherits="QuickMountButtonTemplate" id ="2">
<Anchors>
<Anchor point="LEFT" relativeTo="$parent1" relativePoint="RIGHT">
<Offset>
<AbsDimension x="8" y="0" />
</Offset>
</Anchor>
</Anchors>
</CheckButton>
<CheckButton name="$parent3" inherits="QuickMountButtonTemplate" id ="3">
<Anchors>
<Anchor point="LEFT" relativeTo="$parent2" relativePoint="RIGHT">
<Offset>
<AbsDimension x="8" y="0" />
</Offset>
</Anchor>
</Anchors>
</CheckButton>
<CheckButton name="$parent4" inherits="QuickMountButtonTemplate" id ="4">
<Anchors>
<Anchor point="LEFT" relativeTo="$parent3" relativePoint="RIGHT">
<Offset>
<AbsDimension x="8" y="0" />
</Offset>
</Anchor>
</Anchors>
</CheckButton>
</Frames>
<!-- Layers -->
<Layers>
<Layer level="ARTWORK">
<!-- Portrait Texture -->
<Texture name="$parentPortrait">
<Size>
<AbsDimension x="32" y="32"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativePoint="LEFT">
<Offset>
<AbsDimension x="48" y="10"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
 
<!-- Text Labels -->
<FontString name="$parentLabel" inherits="GameFontHighlightLarge" text="A">
<Size>
<AbsDimension x="150" y="14"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativePoint="LEFT">
<Offset>
<AbsDimension x="70" y="-5"/>
</Offset>
</Anchor>
</Anchors>
<Color r=".9" g=".6" b="0.3"/>
</FontString>
<FontString name="$parentEquip1Text" inherits="GameFontHighlight" text="1">
<Size>
<AbsDimension x="100" y="14"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativePoint="TOP">
<Offset>
<AbsDimension x="-70" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentEquip2Text" inherits="GameFontHighlight" text="2">
<Size>
<AbsDimension x="100" y="14"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativePoint="TOP">
<Offset>
<AbsDimension x="-26" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentEquip3Text" inherits="GameFontHighlight" text="3">
<Size>
<AbsDimension x="100" y="14"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativePoint="TOP">
<Offset>
<AbsDimension x="18" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="$parentEquip4Text" inherits="GameFontHighlight" text="4">
<Size>
<AbsDimension x="100" y="14"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativePoint="TOP">
<Offset>
<AbsDimension x="62" y="0"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
</Frame>
 
 
<!-- Flight Form Frame Bar Template -->
<Frame name="QuickMountEquipCrowSetTemplate" virtual="true" id="1">
<Size>
<AbsDimension x="100" y="48"/>
</Size>
<Frames>
<CheckButton name="$parent1" inherits="QuickMountButtonTemplate" id ="1">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="-110" y="-10" />
</Offset>
</Anchor>
</Anchors>
</CheckButton>
</Frames>
<!-- Layers -->
<Layers>
<Layer level="ARTWORK">
<!-- Portrait Texture -->
<Texture name="$parentPortrait">
<Size>
<AbsDimension x="32" y="32"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativePoint="LEFT">
<Offset>
<AbsDimension x="48" y="10"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
 
<!-- Text Labels -->
<FontString name="$parentEquip1Text" inherits="GameFontHighlight" text="FlightForm">
<Size>
<AbsDimension x="100" y="14"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativePoint="TOP">
<Offset>
<AbsDimension x="-140" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Color r=".9" g=".6" b="0.3"/>
</FontString>
</Layer>
</Layers>
</Frame>
 
<Frame name="QuickMountFrame" toplevel="true" enableMouse="true" frameStrata="HIGH" movable="true" parent="UIParent" hidden="true">
<Size>
<AbsDimension x="384" y="514"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="400" y="-104"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentMainIcon" file="Interface\AddOns\QuickMountEquip\MountIcon">
<Size>
<AbsDimension x="64" y="64"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="4" y="-4"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
<Layer level="ARTWORK">
<Texture name="$parentTopLeft" file="Interface\ClassTrainerFrame\UI-ClassTrainer-TopLeft">
<Size>
<AbsDimension x="256" y="256"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT"/>
</Anchors>
</Texture>
<Texture name="$parentTopRight" file="Interface\ClassTrainerFrame\UI-ClassTrainer-TopRight">
<Size>
<AbsDimension x="128" y="256"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT"/>
</Anchors>
</Texture>
<Texture name="$parentBotLeft" file="Interface\ClassTrainerFrame\UI-ClassTrainer-BotLeft">
<Size>
<AbsDimension x="256" y="256"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="-256"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<Texture name="$parentBotRight" file="Interface\ClassTrainerFrame\UI-ClassTrainer-BotRight">
<Size>
<AbsDimension x="128" y="256"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="0" y="-256"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
<FontString name="$parentTitleText" inherits="GameFontHighlight" text="SOME_TITLE">
<Size>
<AbsDimension x="300" y="14"/>
</Size>
<Anchors>
<Anchor point="TOP" relativePoint="TOP">
<Offset>
<AbsDimension x="0" y="-16"/>
</Offset>
</Anchor>
</Anchors>
</FontString>
<FontString name="QuickMountFrameHelpText" inherits="GameFontNormalSmall" justifyH="LEFT">
<Size>
<AbsDimension x="260" y="60"/>
</Size>
<Anchors>
<Anchor point="TOP" relativePoint="TOP">
<Offset>
<AbsDimension x="20" y="-33"/>
</Offset>
</Anchor>
</Anchors>
<Color r="0.6" g="0.6" b="0.8"/>
</FontString>
</Layer>
</Layers>
<Frames>
<Button name="$parentCloseButton" inherits="UIPanelCloseButton">
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="-30" y="-8"/>
</Offset>
</Anchor>
</Anchors>
</Button>
<Button name="$parentExitButton" inherits="UIPanelButtonTemplate" text="Exit">
<Size>
<AbsDimension x="77" y="21"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentBotRight" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-43" y="81"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
HideUIPanel(this:GetParent());
</OnClick>
</Scripts>
</Button>
<Frame name="$parentVersion">
<Size>
<AbsDimension x="70" y="22"/>
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="$parentBotLeft" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="63" y="92"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentLabel" inherits="GameFontNormalSmall" justifyH="LEFT"/>
<FontString name="$parentText" inherits="GameFontHighlightSmall" justifyH="RIGHT"/>
</Layer>
</Layers>
</Frame>
<Frame name="QuickMountButtonSet1" inherits="QuickMountEquipSetTemplate">
<Anchors>
<Anchor point="TOP" relativeTo="QuickMountFrame" relativePoint="TOP">
<Offset>
<AbsDimension x="0" y="-118"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
this:SetID("1");
getglobal(this:GetName().."Label"):SetText("Mount");
</OnLoad>
</Scripts>
</Frame>
<Frame name="QuickMountButtonSet2" inherits="QuickMountEquipSetTemplate">
<Anchors>
<Anchor point="TOP" relativeTo="QuickMountButtonSet1" relativePoint="BOTTOM">
<Offset>
<AbsDimension x="0" y="-8"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
this:SetID("2");
getglobal(this:GetName().."Label"):SetText("Unmount");
</OnLoad>
</Scripts>
</Frame>
<Frame name="QuickMountButtonSet3" inherits="QuickMountEquipCrowSetTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="QuickMountButtonSet1" relativePoint="RIGHT">
<Offset>
<AbsDimension x="8" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
this:SetID("3");
</OnLoad>
</Scripts>
</Frame>
<Frame name="QuickMountButtonSet4" inherits="QuickMountEquipCrowSetTemplate">
<Anchors>
<Anchor point="LEFT" relativeTo="QuickMountButtonSet2" relativePoint="RIGHT">
<Offset>
<AbsDimension x="8" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
this:SetID("4");
</OnLoad>
</Scripts>
</Frame>
<Frame name="QuickMountOptions">
<Size>
<AbsDimension x="100" y="40"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="QuickMountButtonSet2" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="40" y="-25"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="QuickMountOptionsLabel" inherits="GameFontHighlightLarge" justifyH="LEFT"/>
</Layer>
</Layers>
</Frame>
<CheckButton name="QuickMountCheck1" inherits="QuickMountCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="QuickMountOptions" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="10" y="5"/>
</Offset>
</Anchor>
</Anchors>
</CheckButton>
<CheckButton name="QuickMountCheck2" inherits="QuickMountCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="QuickMountCheck1" relativePoint="BOTTOMLEFT" />
</Anchors>
</CheckButton>
<CheckButton name="QuickMountCheck3" inherits="QuickMountCheckButtonTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="QuickMountCheck2" relativePoint="BOTTOMLEFT" />
</Anchors>
</CheckButton>
<Button name="$parentResetButton" inherits="UIPanelButtonTemplate" text="Reset">
<Size>
<AbsDimension x="77" y="21"/>
</Size>
<Anchors>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentBotRight" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="-124" y="81"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
if ( this.reset ) then
-- QuickMount_Reset();
this.reset = nil;
else
this.reset = 1;
end
QuickMount_OnShow();
</OnClick>
</Scripts>
</Button>
</Frames>
<Scripts>
<OnLoad>
getglobal(this:GetName().."VersionLabel"):SetText("Version");
getglobal(this:GetName().."VersionText"):SetText(QuickMount_Version);
getglobal("QuickMountOptionsLabel"):SetText("Options:");
-- Make Frame Moveable.
tinsert(UISpecialFrames, "QuickMountFrame");
UIPanelWindows["QuickMountFrame"] = { area = "left", pushable = 11 };
this:RegisterForDrag("LeftButton");
QuickMount_OnLoad();
</OnLoad>
<OnShow>
QuickMount_OnShow();
</OnShow>
<OnHide>
QuickMount_OnHide();
</OnHide>
<OnEvent>
QuickMount_OnEvent(event);
</OnEvent>
<OnDragStart>
this:StartMoving();
</OnDragStart>
<OnDragStop>
this:StopMovingOrSizing();
</OnDragStop>
<OnMouseUp>
this:StopMovingOrSizing();
</OnMouseUp>
</Scripts>
</Frame>
<Frame name="QuickMountChecker" toplevel="true" enableMouse="true" frameStrata="HIGH" movable="false" parent="UIParent" hidden="true">
<Size>
<AbsDimension x="0" y="0"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnUpdate>
QuickMount_OnUpdate(arg1);
</OnUpdate>
</Scripts>
</Frame>
<GameTooltip name="QuickMountTooltip" inherits="GameTooltipTemplate" parent="UIParent" hidden="true"/>
</Ui>
trunk/QuickMountEquip/QuickMountEquip.lua New file
0,0 → 1,1055
--[[
 
QuickMountEquip
Robert Jenkins (Merrem@Perenolde / Flarin@Sen'Jin) - robj@suvangi.com
Currently Maintained by:
Robloblaw @ Hellscream - gajillion@gmail.com
Latest Maintained by:
Arbi @ Gul'dan
Casting Fix by :
Xtro (Dashfyra in EU Executus)
 
3.1.6 - Update for 3.0.2, changed PLAYER_AURAS_CHANGED to use the new UNIT_AURA mechanic.
3.1.5 - Small changes by Merrem to bring Xtro branch into the main branch
3.1.4 - Secure function hook is added. That must solve the bug while poisoning or oiling a weapon
3.1.3 - Item swap delay after a casting is now 0.8 sec. That sould be ok but you can change it in code if you still interrupted frequently
- Chat command is changed into /qme from /mountequip
3.1.2 - Casting Fix
3.1.1 - Minor bug fix and delete using flightform slot option. now automatically detect druid class.
3.1.0 - Added flight form slot
3.0.7 - Special check for Taxis.
3.0.6 - Now using the new IsMounted() function provided by WoW 2.0 - Merrem
3.0.5 - general cleanup of the UnitBuff functions - Merrem
3.0.1 - fixes for auto-detect - Robloblaw
3.0.0 - initial changes for WoW 2.0 - Robloblaw
2.x.x - original versions - Merrem
 
Automates equipping of items when mounting/dismounting
 
UI based on Totem Stomper by AlexYoshi
 
]]
 
QuickMount_Version = "3.1.6";
 
QuickMount_ConfigMap = nil;
QuickMount_Disabled = false;
 
-- Current Player information...
QMCP = "";
 
QuickMount_SavedBagFunc = nil;
QuickMount_SavedInvFunc = nil;
QuickMount_SavedUseFunc = nil;
 
local QM_update_time = 0;
local combat_flag = false;
local casting_flag = false; -- xtro
local attack_button = 0;
local crowform = false;
local QM_druid = false;
 
local MOUNT = 1;
local UNMOUNT = 2;
local QM_SET_COUNT = 2;
local QM_SET_SIZE = 4;
local IGNORE_SWITCH = false;
 
local QM_NIL = -100;
 
local QuickMount_CurrentID = QM_NIL;
local QuickMount_CurrentBag = QM_NIL;
local QuickMount_CurrentSlot = QM_NIL;
local QuickMount_CurrentName = "";
local QuickMount_CurrentTexture = "";
 
local QuickMount_AutoDetect = false;
 
function QuickMount_RegisterEvents()
this:RegisterEvent("VARIABLES_LOADED") -- configuration loading
if not Fetch_Frame then
this:RegisterEvent("UNIT_NAME_UPDATE") -- configuration loading
end
local _, class = UnitClass("player")
if class == "DRUID" then
QM_druid = true;
end
this:RegisterEvent("UNIT_AURA") -- crowform buff check
this:RegisterEvent("PLAYER_REGEN_DISABLED") -- combat check
this:RegisterEvent("PLAYER_REGEN_ENABLED") -- combat check
this:RegisterEvent("DELETE_ITEM_CONFIRM") -- delete check
this:RegisterEvent("UNIT_SPELLCAST_START") -- xtro
this:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") -- xtro
this:RegisterEvent("UNIT_SPELLCAST_STOP") -- xtro
this:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED") -- xtro
this:RegisterEvent("UNIT_SPELLCAST_FAILED") -- xtro
end
 
function QuickMount_UnregisterEvents()
this:UnregisterEvent("UNIT_AURA") -- mount buff check
this:UnregisterEvent("PLAYER_REGEN_DISABLED") -- combat check
this:UnregisterEvent("PLAYER_REGEN_ENABLED") -- combat check
this:UnregisterEvent("UNIT_SPELLCAST_START") -- xtro
this:UnregisterEvent("UNIT_SPELLCAST_SUCCEEDED") -- xtro
this:UnregisterEvent("UNIT_SPELLCAST_STOP") -- xtro
this:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTED") -- xtro
this:UnregisterEvent("UNIT_SPELLCAST_FAILED") -- xtro
end
 
function QuickMount_ShowUsage()
QM_Print("/qme on | off | quiet | verbose | auto [on/off] | config | status | load profileName | save profileName | delete profileName | profiles \n");
end
 
function QuickMount_Toggle()
QuickMount_Config("config");
end
 
-- Show/hide the Main Frame
function QuickMount_Config(msg)
if QuickMount_CheckPlayer() == false then
QM_Print("Sorry, QuickMountEquip variables aren't loaded yet.");
return;
end
if msg == nil or msg == "" then
msg = "config";
end
 
local args = {n=0}
local function helper(word) table.insert(args, word) end
string.gsub(msg, "[_%w]+", helper);
 
if args[1] == 'off' then
QuickMount_Disabled = true;
QM_Print("QuickMountEquip disabled.");
elseif args[1] == 'on' then
QuickMount_Disabled = false;
QM_Print("QuickMountEquip enabled.");
elseif args[1] == 'quiet' then
QuickMount_ConfigMap[QMCP]["Quiet"] = true;
QM_Print("QuickMountEquip verbosity off.");
elseif args[1] == 'verbose' then
QuickMount_ConfigMap[QMCP]["Quiet"] = false;
QM_Print("QuickMountEquip verbosity on.");
elseif args[1] == 'save' then
if args[2] == nil or args[2] == '' then
QM_Print("No profile name specified.");
else
QuickMount_ConfigMap["Profile" .. args[2]] = QuickMount_ConfigMap[QMCP];
QM_Print("QuickMountEquip profile '" .. args[2] .. "' saved.");
end
elseif args[1] == 'load' then
if args[2] == nil or args[2] == '' then
QM_Print("No profile name specified.");
else
if QuickMount_ConfigMap["Profile" .. args[2]] then
local last_action = QuickMount_ConfigMap[QMCP]["last_action"];
QuickMount_ConfigMap[QMCP] = QuickMount_ConfigMap["Profile" .. args[2]];
QuickMount_ConfigMap[QMCP]["last_action"] = last_action;
QM_Print("QuickMountEquip profile '" .. args[2] .. "' loaded.");
else
QM_Print("QuickMountEquip profile '" .. args[2] .. "' not found!");
end
end
elseif args[1] == 'delete' then
if args[2] == nil or args[2] == '' then
QM_Print("No profile name specified.");
else
if QuickMount_ConfigMap["Profile" .. args[2]] then
QuickMount_ConfigMap["Profile" .. args[2]] = nil;
QM_Print("QuickMountEquip profile '" .. args[2] .. "' deleted.");
else
QM_Print("QuickMountEquip profile '" .. args[2] .. "' not found!");
end
end
elseif args[1] == 'profiles' then
QM_Print("Profiles:");
table.foreach(QuickMount_ConfigMap, function(k,v) if string.find(k, "Profile") then QM_Print(string.gsub(k, "Profile", '')) end end);
elseif args[1] == 'auto' then
local status = "";
if args[2] == nil or args[2] == '' then
if QuickMount_ConfigMap[QMCP]["auto-reconfig"] == true then
QuickMount_ConfigMap[QMCP]["auto-reconfig"] = false;
status = "toggled OFF";
else
QuickMount_ConfigMap[QMCP]["auto-reconfig"] = true;
status = "toggled ON";
end
elseif args[2] == 'on' then
QuickMount_ConfigMap[QMCP]["auto-reconfig"] = true;
status = "ON";
elseif args[2] == 'off' then
QuickMount_ConfigMap[QMCP]["auto-reconfig"] = false;
status = "OFF";
end
QM_Print("Auto-reconfiguring is now " .. status);
elseif args[1] == 'status' then
QuickMount_ShowUsage();
local status = "QuickMountEquip is currently";
if QuickMount_Disabled == true then
status = status .. " disabled";
else
status = status .. " enabled";
end
status = status .. ", auto-reconfigure is";
if QuickMount_ConfigMap[QMCP]["auto-reconfig"] == false then
status = status .. " off";
else
status = status .. " on";
end
if QuickMount_ConfigMap[QMCP]["Quiet"] == false then
status = status .. ", and is in verbose mode.";
else
status = status .. ", and is in quiet mode.";
end
QM_Print(status);
elseif args[1] == 'config' then
-- Reset attack_button, just in case they rearranged hot keys.
attack_button = 0
if ( QuickMountFrame ) then
if ( QuickMountFrame:IsVisible() ) then
HideUIPanel(QuickMountFrame);
else
ShowUIPanel(QuickMountFrame);
end
else
QM_Print("QuickMountEquip did not load. Please check your logs/FrameXML.log file and report this error");
end
else
QuickMount_ShowUsage();
end
end
 
function QuickMount_CheckPlayer()
if QMCP == "" then
local playername;
if Fetch_Frame then
if not Fetch_Done then
return false;
else
playername = Fetch_PlayerName
end
else
playername = UnitName("player");
if playername == nil or playername == UKNOWNBEING or playername == UNKNOWNOBJECT then
return false;
end
end
QMCP = GetCVar("realmName") .. "." .. playername;
-- Convert old config
if QuickMount_ButtonMap ~= nil and QuickMount_ButtonMap[1] ~= nil then
QuickMount_ConfigMap = {};
QuickMount_ConfigMap[QMCP] = QuickMount_ButtonMap;
QuickMount_ConfigMap[QMCP]["Quiet"] = true;
QuickMount_ConfigMap[QMCP]["FlightPoint"] = false;
QuickMount_ConfigMap[QMCP]["auto-reconfig"] = false;
end
if QuickMount_ConfigMap == nil or QuickMount_ConfigMap[QMCP] == nil or QuickMount_ConfigMap[QMCP][3] == nil then
QuickMount_Reset();
end
if QuickMount_ConfigMap[QMCP]["FlightPoint"] == nil then
QuickMount_ConfigMap[QMCP]["FlightPoint"] = false;
end
if QuickMount_ConfigMap[QMCP]["UseDetectedIcon"] == nil then
QuickMount_ConfigMap[QMCP]["UseDetectedIcon"] = false;
end
if QuickMount_ConfigMap[QMCP]["auto-reconfig"] == nil then
QuickMount_ConfigMap[QMCP]["auto-reconfig"] = false;
end
QuickMount_UpdateAllSets();
end
if QMCP == "" or QMCP == "NONE" then
return false;
else
return true;
end
end
 
-- Reset QuickMount
function QuickMount_Reset()
if QuickMount_CheckPlayer() == false then
return;
end
if QuickMount_ConfigMap == nil then
QuickMount_ConfigMap = {};
end
QuickMount_ConfigMap[QMCP]={index=nil;};
for i=1,QM_SET_COUNT,1 do
QuickMount_ConfigMap[QMCP][i]={index=nil;};
for j=1,QM_SET_SIZE,1 do
QuickMount_ConfigMap[QMCP][i][j]= {id=QM_NIL;bag=QM_NIL;slot=QM_NIL;texture="";name="";};
end
QuickMount_ConfigMap[QMCP]["Quiet"] = true;
QuickMount_ConfigMap[QMCP]["FlightPoint"] = false;
QuickMount_ConfigMap[QMCP]["UseDetectedIcon"] = false;
QuickMount_ConfigMap[QMCP]["DetectedIcon"] = nil;
QuickMount_ConfigMap[QMCP]["auto-reconfig"] = false;
end
QuickMount_ConfigMap[QMCP][3]={index=nil;};
QuickMount_ConfigMap[QMCP][4]={index=nil;};
QuickMount_ConfigMap[QMCP][3][1]= {id=QM_NIL;bag=QM_NIL;slot=QM_NIL;texture="";name="";};
QuickMount_ConfigMap[QMCP][4][1]= {id=QM_NIL;bag=QM_NIL;slot=QM_NIL;texture="";name="";};
end
 
function QuickMount_GetItemName(bag, slot)
local bagNumber = bag;
local name = "";
if ( type(bagNumber) ~= "number" ) then
bagNumber = tonumber(bag);
end
QuickMountTooltip:SetOwner(UIParent, "ANCHOR_NONE");
if (bagNumber <= QM_NIL) then
QuickMountTooltip:SetInventoryItem("player", slot);
else
QuickMountTooltip:SetBagItem(bag, slot);
end
name = QuickMountTooltipTextLeft1:GetText();
if name == nil then
name = "";
end
return name;
end
 
function QuickMount_PickupContainerItem(bag, slot)
local empty = true;
local autoflag = false;
local name = '';
-- If we are set to auto-reconfigure, and we're unmounted and they are manually swapping items, configure.
if ( QuickMount_CheckPlayer() == true and IGNORE_SWITCH == false and QuickMount_ConfigMap[QMCP]["auto-reconfig"] == true and QuickMount_ConfigMap[QMCP]["last_action"] ~= true and QuickMount_CurrentBag == QM_NIL and QuickMount_CurrentName ~= '' and CursorHasItem() ) then
autoflag = true;
end
if ( QuickMount_SavedBagFunc ) then
QuickMount_SavedBagFunc(bag, slot);
end
local texture, itemCount, locked = GetContainerItemInfo(bag, slot);
if ( texture ) then
name = QuickMount_GetItemName(bag, slot)
end
if IGNORE_SWITCH == false and CursorHasItem() then
QuickMount_PickupItem(bag, slot, name, texture)
empty = false
end
if ( autoflag and not CursorHasItem() and name ~= nil and name ~= '') then
-- Check the UNMOUNT config for this item, swap if found
for i in next,QuickMount_ConfigMap[QMCP][UNMOUNT] do
if QuickMount_ConfigMap[QMCP][UNMOUNT][i].id > 0 and QuickMount_ConfigMap[QMCP][UNMOUNT][i].name == QuickMount_CurrentName then
QuickMount_PickupItem(bag, slot, name, texture);
QuickMount_ConfigMap[QMCP][UNMOUNT][i] = {id=QuickMount_CurrentID,bag=QuickMount_CurrentBag,slot=QuickMount_CurrentSlot,name=QuickMount_CurrentName,texture=QuickMount_CurrentTexture};
QuickMount_UpdateSet("QuickMountButtonSet",UNMOUNT,QM_SET_SIZE);
end
end
end
if empty then
QuickMount_ResetItem();
end
end
 
function QuickMount_PickupInventoryItem(slot)
local empty = true;
local autoflag = false;
local name = '';
 
-- If we are set to auto-reconfigure, and we're unmounted and they are manually swapping items, configure.
if ( QuickMount_CheckPlayer() == true and IGNORE_SWITCH == false and QuickMount_ConfigMap[QMCP]["auto-reconfig"] == true and QuickMount_ConfigMap[QMCP]["last_action"] ~= true and QuickMount_CurrentBag ~= QM_NIL and CursorHasItem()==nil ) then
autoflag = true;
end
 
--[[
if ( QuickMount_CheckPlayer() == true) then
QM_Print("check:true");
if (IGNORE_SWITCH == false) then
QM_Print("switch:true");
if (QuickMount_ConfigMap[QMCP]["auto-reconfig"] == true) then
QM_Print("auto-reconfig:true");
if (QuickMount_ConfigMap[QMCP]["last_action"] ~= true) then
QM_Print("last:true");
if (QuickMount_CurrentBag ~= QM_NIL) then
QM_Print("bag:true");
if (CursorHasItem()==nil) then
QM_Print("item:true");
autoflag = true;
QM_Print("autoflag:yes");
end
end
end
end
end
end
]]--
 
if ( QuickMount_SavedInvFunc ) then
QuickMount_SavedInvFunc(slot);
end
 
local texture = GetInventoryItemTexture("player", slot);
 
if ( texture ) then
name = QuickMount_GetItemName(QM_NIL, slot)
end
if IGNORE_SWITCH == false and CursorHasItem() and name ~= '' then
QuickMount_PickupItem(QM_NIL, slot, name, texture)
empty = false
end
 
if ( autoflag and not CursorHasItem() and name ~= nil and name ~= '') then
-- Check the UNMOUNT config for this item, swap if found
for i in next,QuickMount_ConfigMap[QMCP][UNMOUNT] do
if QuickMount_ConfigMap[QMCP][UNMOUNT][i].id > 0 and QuickMount_ConfigMap[QMCP][UNMOUNT][i].name == name then
QuickMount_ConfigMap[QMCP][UNMOUNT][i] = {id=QuickMount_CurrentID,bag=QuickMount_CurrentBag,slot=QuickMount_CurrentSlot,name=QuickMount_CurrentName,texture=QuickMount_CurrentTexture};
QuickMount_UpdateSet("QuickMountButtonSet",UNMOUNT,QM_SET_SIZE);
end
end
end
if empty then
QuickMount_ResetItem();
end
end
 
function QuickMount_UseContainerItem(bag, slot)
local empty = true;
local autoflag = false;
local name_before = '';
local name_after = '';
 
if ( bag >= 0 and QuickMount_CheckPlayer() == true and IGNORE_SWITCH == false and QuickMount_ConfigMap[QMCP]["auto-reconfig"] == true and QuickMount_ConfigMap[QMCP]["last_action"] ~= true and QuickMount_CurrentBag == QM_NIL and QuickMount_CurrentName == '' and CursorHasItem() ~= true ) then
autoflag = true;
 
local texture_before, itemCount_before, locked_before = GetContainerItemInfo(bag, slot);
if ( texture_before ) then
name_before = QuickMount_GetItemName(bag, slot);
end
end
 
if ( QuickMount_SavedUseFunc ) then
QuickMount_SavedUseFunc(bag, slot);
end
if ( autoflag ) then
local texture_after, itemCount_after, locked_after = GetContainerItemInfo(bag, slot);
 
if ( texture_after ) then
name_after = QuickMount_GetItemName(bag, slot)
end
 
--if ( (not CursorHasItem()) and (name_before ~= name_after) and (name_before ~= nil) and (name_before ~= '') and (name_after ~= nil) and (name_after ~= '') ) then
if ( (not CursorHasItem()) and (name_before ~= nil) and (name_before ~= '') and (name_after ~= nil) and (name_after ~= '') ) then
-- Check the UNMOUNT config for this item, swap if found
for i in next,QuickMount_ConfigMap[QMCP][UNMOUNT] do
if QuickMount_ConfigMap[QMCP][UNMOUNT][i].id > 0 and QuickMount_ConfigMap[QMCP][UNMOUNT][i].name == name_after then
QuickMount_PickupItem(bag, slot, name_before, texture_before);
QuickMount_ConfigMap[QMCP][UNMOUNT][i] = {id=QuickMount_CurrentID,bag=QuickMount_CurrentBag,slot=QuickMount_CurrentSlot,name=QuickMount_CurrentName,texture=QuickMount_CurrentTexture};
QuickMount_UpdateSet("QuickMountButtonSet",UNMOUNT,QM_SET_SIZE);
end
end
end
end
end
 
function QuickMount_OnLoad()
-- Set the header
local name = this:GetName();
local header = getglobal(name.."TitleText");
 
if ( header ) then
header:SetText("|cFFee9966Mount Equipment|r");
end
 
QuickMount_Reset();
-- RegisterForSave("QuickMount_ConfigMap");
QuickMount_RegisterEvents();
 
--[[
 
local temp = PickupContainerItem;
if ( QuickMount_HookFunction("PickupContainerItem", "QuickMount_PickupContainerItem") ) then
QuickMount_SavedBagFunc = temp;
end
 
local temp = PickupInventoryItem;
if ( QuickMount_HookFunction("PickupInventoryItem", "QuickMount_PickupInventoryItem") ) then
QuickMount_SavedInvFunc = temp;
end
 
local temp = UseContainerItem;
if ( QuickMount_HookFunction("UseContainerItem", "QuickMount_UseContainerItem") ) then
QuickMount_SavedUseFunc = temp;
end
]]--
 
--[[
local temp = PickupContainerItem;
if(hooksecurefunc("PickupContainerItem",QuickMount_PickupContainerItem) ) then
QuickMount_SavedBagFunc = temp;
end
local temp = PickupInventoryItem;
if ( hooksecurefunc("PickupInventoryItem", QuickMount_PickupInventoryItem) ) then
QuickMount_SavedInvFunc = temp;
end
 
local temp = UseContainerItem;
if ( hooksecurefunc("UseContainerItem", QuickMount_UseContainerItem) ) then
QuickMount_SavedUseFunc = temp;
end
]]--
hooksecurefunc("PickupContainerItem",QuickMount_PickupContainerItem);
hooksecurefunc("PickupInventoryItem", QuickMount_PickupInventoryItem);
 
-- Slash Commands
SlashCmdList["MOUNTEQUIP"] = function(msg) QuickMount_Config(msg); end
setglobal("SLASH_MOUNTEQUIP1", "/qme");
setglobal("SLASH_MOUNTEQUIP2", "/mountequip");
 
if ( Earth and EarthFeature_AddButton ) then
EarthFeature_AddButton (
{
id = "QME",
name = "Mount Equipment",
subtext = "Auto-Equip Spurs",
tooltip = "This allows you to select \nequipment to be auto-equipped \nas you mount/dismount",
icon = "Interface\\Icons\\Ability_Mount_RidingHorse",
callback = function()
QuickMount_Toggle();
return true; -- The button is enabled
end
}
);
elseif ( Cosmos_RegisterButton ) then
Cosmos_RegisterButton (
"Mount Equipment",
"Auto-Equip Spurs",
"This allows you to select \nequipment to be auto-equipped \nas you mount/dismount",
"Interface\\Icons\\Ability_Mount_RidingHorse",
QuickMount_Toggle,
function()
return true; -- The button is enabled
end
);
end
end
 
function QuickMount_HookFunction(func, newfunc)
local oldValue = getglobal(func);
if ( oldValue ~= getglobal(newfunc) ) then
setglobal(func, getglobal(newfunc));
return true;
end
return false;
end
 
function QuickMount_ShowHelp()
local helptext = getglobal("QuickMountFrameHelpText");
if helptext then
helptext:SetText("Drag Equipment you want auto-equipped into the squares. (Spurs, etc.) Shift click to clear item. Items that go in the same inventory slot should 'line up'. (Boots in slot 1, Trinkets in slot 2, etc.)");
end
end
 
function QuickMount_Enable_Toggle(which)
if which then
QuickMount_Disabled = false;
else
QuickMount_Disabled = true;
end
end
 
function QuickMount_Quiet_Toggle(which)
QuickMount_ConfigMap[QMCP]["Quiet"] = which;
end
 
function QuickMount_AutoReconfig_Toggle(which)
QuickMount_ConfigMap[QMCP]["auto-reconfig"] = which;
end
 
function QuickMount_OnShow()
local checked;
 
QuickMount_ShowHelp()
 
-- Configure checkboxes
if (QuickMount_Disabled == false) then
checked = 1;
else
checked = 0;
end
 
QuickMountCheck1:SetChecked(checked);
QuickMountCheck1Text:SetText("QuickMountEquip enabled.");
QuickMountCheck1.myToolTip = "Check to enable QuickMountEquip.";
QuickMountCheck1.ExecuteCommand = QuickMount_Enable_Toggle;
 
if (QuickMount_ConfigMap[QMCP]["Quiet"] == true) then
checked = 1;
else
checked = 0;
end
 
QuickMountCheck2:SetChecked(checked);
QuickMountCheck2Text:SetText("Don't show equip message spam.");
QuickMountCheck2.myToolTip = "Check to disable equip messages.";
QuickMountCheck2.ExecuteCommand = QuickMount_Quiet_Toggle;
 
if (QuickMount_ConfigMap[QMCP]["auto-reconfig"] == true) then
checked = 1;
else
checked = 0;
end
 
QuickMountCheck3:SetChecked(checked);
QuickMountCheck3Text:SetText("Auto-reconfigure.");
QuickMountCheck3.myToolTip = "Check to enable Auto-reconfiguring.\nThis will automatically reconfigure the add-on if you\nmanually swap a configured item with another.\nOnly works while unmounted and with the\nunmounted equipment line.";
QuickMountCheck3.ExecuteCommand = QuickMount_AutoReconfig_Toggle;
end
 
function QuickMount_OnHide()
QuickMount_DropItem();
if MYADDONS_ACTIVE_OPTIONSFRAME == this then
ShowUIPanel(myAddOnsFrame);
end
end
 
function QuickMount_OnEvent(event)
local mounted = false
local sheeped = false
local clogged = false
 
if event == "VARIABLES_LOADED" then
QMCP = "";
clogged = true;
-- Add myAddOns support
if myAddOnsList then
myAddOnsList.QuickMountEquip = {name = "QuickMountEquip", description = "Automatically switches gear when you mount", version = QuickMount_Version, frame = "QuickMountFrame", optionsframe = "QuickMountFrame"};
end
end
 
if event == "UNIT_NAME_UPDATE" and arg1 == "player" then
QMCP = "";
clogged = true;
end
 
if QuickMount_CheckPlayer() == false then
return;
end
 
if clogged == true or QuickMount_Disabled == true then
return;
end
 
if (event == "UNIT_AURA" or event == "UNIT_SPELLCAST_START" or
event == "UNIT_SPELLCAST_SUCCEEDED" or event == "UNIT_SPELLCAST_STOP" or
event == "UNIT_SPELLCAST_INTERRUPTED" or event == "UNIT_SPELLCAST_FAILED")
and (arg1 ~= "player") then
return;
end
 
if QM_druid == true and event == "UNIT_AURA" and arg1 == "player" then
for i = 1, BUFF_MAX_DISPLAY do
local _, _, texture = UnitBuff("player", i);
if texture and string.find(texture, "Interface\\Icons\\Ability_Druid_FlightForm") then
crowform = true
MOUNT = 3;
UNMOUNT = 4;
break
else
crowform = false
end
end
end
 
if event == "DELETE_ITEM_CONFIRM" then
-- If the GUI frame is open, don't let them delete anything.
if ( QuickMountFrame and QuickMountFrame:IsVisible() ) then
QuickMount_DropItem();
end
return;
end
 
-- xtro vvvvvvvvvvvvvvv
if (event == "UNIT_SPELLCAST_START") and (arg1 == "player") then
casting_flag = true
return;
end
if (event == "UNIT_SPELLCAST_SUCCEEDED" or event == "UNIT_SPELLCAST_STOP" or event == "UNIT_SPELLCAST_INTERRUPTED" or event == "UNIT_SPELLCAST_FAILED" or event == "UNIT_SPELLCAST_FAILED") and (arg1 == "player") then
casting_flag = false
end
-- xtro ^^^^^^^^^^^^^^^^
 
if event == "PLAYER_REGEN_DISABLED" then
combat_flag = true
return;
end
if event == "PLAYER_REGEN_ENABLED" then
combat_flag = false
end
QM_update_time = 0;
ShowUIPanel(QuickMountChecker); -- Show the frame, so we update
end
 
function QuickMount_OnUpdate(elapsed)
QM_update_time = QM_update_time + elapsed;
 
if QM_update_time < 0.8 then return end; -- not so fast -- xtro
 
if QM_update_time > 2.0 then
HideUIPanel(QuickMountChecker); -- Hide the frame, so we don't check again
return;
end
 
-- Can't switch inventory while in combat, so ignore if in combat
-- Can't switch inventory while casting -- xtro
if combat_flag == false and casting_flag == false then -- xtro
 
-- 2.0 function!! No more checking buffs, etc...
if IsMounted() == 1 then
mounted = true;
MOUNT = 1;
UNMOUNT = 2;
elseif crowform == true then
mounted = true;
else
mounted = false;
end
 
-- Don't equip stuff if we're on a taxi, no matter what.
if UnitOnTaxi("player") == 1 then
mounted = false;
end
 
-- Only attempt to equip if it's different from last time.
if QuickMount_ConfigMap[QMCP]["last_action"] == nil or QuickMount_ConfigMap[QMCP]["last_action"] ~= mounted then
QuickMount_ConfigMap[QMCP]["last_action"] = mounted
local row1, row2;
if mounted then
row1 = MOUNT;
row2 = UNMOUNT;
else
row1 = UNMOUNT;
row2 = MOUNT;
end
IGNORE_SWITCH = true;
items = "";
HideUIPanel(QuickMountChecker); -- Hide the frame, so we don't check again
QM_update_time = 3;
for i in next,QuickMount_ConfigMap[QMCP][row1] do
local x, y;
x = QM_NIL; y = QM_NIL;
if QuickMount_ConfigMap[QMCP][row1][i].id > 0 and QuickMount_ConfigMap[QMCP][row2][i].id > 0 and QuickMount_ConfigMap[QMCP][row1][i].name ~= QuickMount_ConfigMap[QMCP][row2][i].name then
-- Swap Items
x, y = QuickMount_FindInvItem(QuickMount_ConfigMap[QMCP][row2][i].name, true);
if CursorHasItem() then
x, y = QuickMount_FindBagItem(QuickMount_ConfigMap[QMCP][row1][i].name, true);
if CursorHasItem() then
y = QM_NIL;
AutoEquipCursorItem();
end
else
x, y = QuickMount_FindBagItem(QuickMount_ConfigMap[QMCP][row1][i].name, true, true);
end
elseif QuickMount_ConfigMap[QMCP][row1][i].id > 0 then
x, y = QuickMount_FindBagItem(QuickMount_ConfigMap[QMCP][row1][i].name, true, true);
end
if y >= 0 then
items = items .. ' "' .. QuickMount_ConfigMap[QMCP][row1][i].name .. '"';
end
end
if items ~= "" and QuickMount_ConfigMap[QMCP]["Quiet"] == false then
QM_Print("Equipped" .. items);
end
IGNORE_SWITCH = false;
end -- last_action
end -- combat_flag
end
 
function QM_Print(msg)
DEFAULT_CHAT_FRAME:AddMessage(msg);
end
 
function QuickMount_ButtonLoad()
this:RegisterForDrag("LeftButton", "RightButton");
this:RegisterForClicks("LeftButtonUp", "RightButtonUp");
end
 
function QuickMount_FindBagItem(name, pickup, equip)
if name == nil then
return QM_NIL, QM_NIL;
end
-- Look in bags.
for i = 0, 4, 1 do
local numSlot = GetContainerNumSlots(i);
for y = 1, numSlot, 1 do
if (strupper(QuickMount_GetItemName(i, y)) == strupper(name)) then
if pickup or equip then
PickupContainerItem(i,y);
if equip then
AutoEquipCursorItem();
end
end
return i,y;
end
end
end
 
return QM_NIL, QM_NIL;
end
 
function QuickMount_FindInvItem(name, pickup)
if name == nil then
return QM_NIL, QM_NIL;
end
 
-- Look in inventory.
for i = 1, 19, 1 do
if (strupper(QuickMount_GetItemName(QM_NIL, i)) == strupper(name)) then
if pickup then
PickupInventoryItem(i);
end
return QM_NIL, i;
end
end
 
return QM_NIL, QM_NIL;
end
 
function QuickMount_FindItem(bag, slot, name, pickup, equip)
if name == nil then
return QM_NIL, QM_NIL;
end
-- First look where it's suggested we look.
--[[ NOT WORKING... Cacheing problem?
if (strupper(QuickMount_GetItemName(bag,slot)) == strupper(name)) then
if pickup then
if bag >= 0 then
PickupContainerItem(bag,slot);
else
PickupInventoryItem(slot);
end
end
return bag, slot;
end
]]
 
local x, y = QuickMount_FindBagItem(name, pickup, equip);
 
if equip then
return x, y;
end
 
if x < 0 then
x, y = QuickMount_FindInvItem(name, pickup);
end
 
return x, y;
end
 
-- Erases the old button with the hand
function QuickMount_SetButton(row, col)
if QuickMount_CheckPlayer() == false then
return;
end
-- Set the new button
QuickMount_ConfigMap[QMCP][row][col] = {id=QuickMount_CurrentID,bag=QuickMount_CurrentBag,slot=QuickMount_CurrentSlot,name=QuickMount_CurrentName,texture=QuickMount_CurrentTexture};
QuickMount_DropItem();
 
QuickMount_ButtonUpdate(this);
end
 
-- Swaps the specified button into hand
function QuickMount_SwapButton(row,col)
if QuickMount_CheckPlayer() == false then
return;
end
-- Store the old value if one exists
local temp = nil;
if ( QuickMount_ConfigMap[QMCP][row][col].id > 0 ) then
temp = QuickMount_ConfigMap[QMCP][row][col];
end
 
-- Drop the current button
QuickMount_SetButton(row, col);
 
-- Load the old one into the cursor
if ( temp ) then
if ( temp.id > 0 ) then
local bag, slot = QuickMount_FindItem(temp.bag, temp.slot, temp.name, true);
QuickMount_PickupItem(bag, slot, temp.name, temp.texture);
end
end
end
 
 
-- Button Event Handler
function QuickMount_ButtonEvent(event)
end
 
-- Move the Equipment around
function QuickMount_ButtonDragStart()
local col, row = QuickMount_GetCurrentLocation(this);
 
-- Pick up the current item
QuickMount_SwapButton(row,col);
end
 
--
-- Swap or pick up if clicked with or without a full hand
--
function QuickMount_ButtonClick(button)
if QuickMount_CheckPlayer() == false then
return;
end
local col, row = QuickMount_GetCurrentLocation(this);
 
if IsShiftKeyDown() then
QuickMount_ConfigMap[QMCP][row][col] = {id=QM_NIL;bag=QM_NIL;slot=QM_NIL;texture="";name="";};
QuickMount_ButtonUpdate(this);
elseif IsAltKeyDown() then
-- PrintTable(QuickMount_ConfigMap[QMCP][row][col]);
else
-- Pick up the current item
QuickMount_SwapButton(row,col);
end
end
 
function QuickMount_ButtonDragEnd()
if QuickMount_CheckPlayer() == false then
return;
end
if( QuickMount_CurrentID > 0 ) then
local col, row = QuickMount_GetCurrentLocation(this);
QuickMount_SwapButton(row,col);
end
end
 
-- Displays the tooltip of the item in the box.
function QuickMount_ButtonEnter()
if QuickMount_CheckPlayer() == false then
return;
end
local col, row = QuickMount_GetCurrentLocation(this);
 
local id = QuickMount_ConfigMap[QMCP][row][col].id;
local tooltip = QuickMount_ConfigMap[QMCP][row][col].name;
 
if ( id > 0 ) then
GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
if ( GameTooltip:SetText(tooltip) ) then
this.updateTooltip = TOOLTIP_UPDATE_TIME;
else
this.updateTooltip = nil;
end
end
end
 
function QuickMount_ButtonLeave()
GameTooltip:Hide();
end
 
function QuickMount_ButtonLoad()
end
 
-- Self Texture Button
function QuickMount_SetSelfTexture(button, row, col)
if QuickMount_CheckPlayer() == false then
return;
end
local name = button:GetName();
local icon = getglobal(name.."Icon");
 
if ( QuickMount_ConfigMap[QMCP][row] == nil ) then return end
local id = QuickMount_ConfigMap[QMCP][row][col].id;
 
if ( id > 0 ) then
-- Set the pretty texture
local texture = QuickMount_ConfigMap[QMCP][row][col].texture;
if ( texture ) then
icon:SetTexture(texture);
icon:Show();
else
icon:Hide();
end
else
icon:Hide();
end
end
 
-- Button Update
function QuickMount_ButtonUpdate(button)
-- Check the button
if ( button == nil ) then return; end
 
-- Uncheck it
button:SetChecked("false");
local col, row = QuickMount_GetCurrentLocation(button);
 
-- Check for errors
if ( col == nil or row == nil ) then return; end
 
-- Enable the button
button:Enable();
QuickMount_SetSelfTexture(button, row, col);
end
 
function QuickMount_UpdateSet(setbasename,set,size)
if set == nil then return; end
 
for i=1,size,1 do
QuickMount_ButtonUpdate(getglobal(setbasename..set..i));
end
end
 
function QuickMount_UpdateAllSets()
for set=1,QM_SET_COUNT,1 do
QuickMount_UpdateSet("QuickMountButtonSet",set,QM_SET_SIZE);
end
QuickMount_UpdateSet("QuickMountButtonSet",3,1);
QuickMount_UpdateSet("QuickMountButtonSet",4,1);
end
 
-- Tracks the last item picked up
function QuickMount_PickupItem(bag, slot, name, texture)
QuickMount_CurrentID = 1;
QuickMount_CurrentBag = bag;
QuickMount_CurrentSlot = slot;
QuickMount_CurrentName = name;
QuickMount_CurrentTexture = texture;
end
 
function QuickMount_ResetItem()
QuickMount_CurrentID = QM_NIL;
QuickMount_CurrentBag = QM_NIL;
QuickMount_CurrentSlot = QM_NIL;
QuickMount_CurrentName = "";
QuickMount_CurrentTexture = "";
end
 
function QuickMount_DropItem()
if CursorHasItem() then
if QuickMount_CurrentBag >= 0 then
PickupContainerItem(QuickMount_CurrentBag,QuickMount_CurrentSlot);
elseif QuickMount_CurrentSlot >= 0 then
PickupInventoryItem(QuickMount_CurrentSlot);
end
end
QuickMount_ResetItem();
end
 
function QuickMountCheckButton_OnClick()
if (this:GetChecked()) then
this.ExecuteCommand(true);
else
this.ExecuteCommand(false);
end
end
 
function QuickMountCheckButton_OnEnter()
GameTooltip:SetOwner(this, "ANCHOR_RIGHT");
if ( GameTooltip:SetText(this.myToolTip) ) then
this.updateTooltip = TOOLTIP_UPDATE_TIME;
else
this.updateTooltip = nil;
end
end
 
function QuickMountCheckButton_OnLeave()
GameTooltip:Hide();
end
 
-- Returns the current button location
function QuickMount_GetCurrentLocation(object)
return object:GetID(), object:GetParent():GetID();
end
trunk/QuickMountEquip/MountIcon.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
trunk/QuickMountEquip/MountIconTransparent.tga Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes : Added: svn:mime-type + application/octet-stream
trunk/QuickMountEquip/QuickMountEquip.toc New file
0,0 → 1,8
## Interface: 30000
## SavedVariables: QuickMount_ConfigMap
## Title: QuickMountEquip
## Title-koKR: 자동 박차 착용
## Notes: Allows the user to auto-equip spurs, etc. when mounting/dismounting
## Notes-koKR: 탈것을 탈 때와 내릴때 박차, 장신구 등을 자동으로 교체해주는 기능입니다.
## OptionalDeps: myAddOns, Sea, Earth, Fetch, Cosmos
QuickMountEquip.xml
trunk/QuickMountEquip/Changelog-QuickMountEquip-3.1.5.txt New file
0,0 → 1,42
------------------------------------------------------------------------
r5 | merrem | 2008-10-09 20:24:38 +0000 (Thu, 09 Oct 2008) | 1 line
Changed paths:
A /tags/3.1.5 (from /trunk:4)
 
Tagging as 3.1.5.
------------------------------------------------------------------------
r4 | merrem | 2008-10-09 20:23:59 +0000 (Thu, 09 Oct 2008) | 2 lines
Changed paths:
A /trunk/MountIcon.tga
A /trunk/MountIconTransparent.tga
D /trunk/QuickMountEquip
A /trunk/QuickMountEquip.lua
A /trunk/QuickMountEquip.toc
A /trunk/QuickMountEquip.xml
A /trunk/ReadMe.txt
 
Moved files up one level.
 
------------------------------------------------------------------------
r2 | merrem | 2008-10-09 20:14:40 +0000 (Thu, 09 Oct 2008) | 3 lines
Changed paths:
A /trunk/QuickMountEquip
A /trunk/QuickMountEquip/MountIcon.tga
A /trunk/QuickMountEquip/MountIconTransparent.tga
A /trunk/QuickMountEquip/QuickMountEquip.lua
A /trunk/QuickMountEquip/QuickMountEquip.toc
A /trunk/QuickMountEquip/QuickMountEquip.xml
A /trunk/QuickMountEquip/ReadMe.txt
 
Updated to 3.1.5
 
 
------------------------------------------------------------------------
r1 | root | 2008-10-01 17:01:23 +0000 (Wed, 01 Oct 2008) | 1 line
Changed paths:
A /branches
A /tags
A /trunk
 
"quick-mount-equip/mainline: Initial Import"
------------------------------------------------------------------------
trunk/QuickMountEquip/ReadMe.txt New file
0,0 → 1,216
QuickMountEquip By
Merrem @ Perenolde - robj@suvangi.com
and Robloblaw @ Hellscream - gajillion@gmail.com
 
Currently maintained by
Robloblaw @ Hellscream - gajillion@gmail.com
 
Latest maintained by
Arbi @ Gul'Dan
Casting Fix by :
Xtro (Dashfyra in EU Executus)
 
VERSION
 
3.1.7 - 2008/11/01 - Merrem
 
Switched to UNIT_AURA, updated for WoW 3.0.2
 
3.1.4 - 2008/08/12 - Xtro
 
Secure function hook is added. That must solve the bug while poisoning or oiling a weapon
 
3.1.3 - 2008/07/29 - Xtro
 
Item swap delay after a casting is now 0.8 sec. That sould be ok but you can change it in code if you still interrupted frequently
Chat command is changed into /qme from /mountequip
 
 
3.1.2 - Xtro
 
Casting Fix
 
3.1.1 - 2007/06/07 - Arbi
 
Minor bug fix and delete using flightform slot option
Now automatically detect druid class.
 
3.1.0 - 2007/06/04 - Arbi
 
Added flight form slot (for druid epic flight form trinket)
 
3.0.5 - 2007/01/20 - Merrem
 
General UnitBuff and UnitDebuff cleanup (now uses the new 2.0 calls)
 
3.0.1 - 2007/01/04 - Robloblaw
 
Working on auto-detect
 
3.0.0 - 2006/12/26 - Robloblaw
 
Fixed for BG patches and Lua 5.1 update (WoW 2.0)
 
2.21 - 2006/03/30 - Merrem
 
fix for patch 1.10 (again)
 
2.20 - 2006/03/28 - Merrem
 
patch 1.10 compatible
 
2.19 - 2005/08/22 - Merrem
 
Added Earth (Khaos) configuration option. Thanks to Marsman for the heads-up.
 
2.18 - 2005/07/18 - Merrem
 
.toc changed to 1600
Added an option to auto-reconfigure, for those that like to manually switch trinkets.
Unfortunately, right-click to equip won't auto-reconfigure. You have to drag
and drop to re-equip.
Hopefully improved the equip functionality for same-name items.
Added German "Aspekt" check.
 
 
2.17 - 2005/06/01 - Merrem
 
Cleaned up 'detect' option a little.
Changed which functions are Hooked. This should fix incompatibilities with AddOns like AdvancedBags and AIOI.
 
2.16 - 2005/03/30 - Merrem
 
.toc changed to 1300
Added optional Fetch support.
Added profile saving and loading. (For people that have multiple equipment sets.)
Added fix for items named the same switching when you first login.
Made flightpoint (Griffin) checking configurable. Off by default now.
Expanded GUI to include options like Quiet and FlightPoint check.
Added initial support for a 'detect' option. If the AddOn isn't properly detecting
when you mount, you can try to manually detect the mount and then use that
setting. **Advanced**
 
2.14 - 2005/03/05 - Merrem
 
Fixed myAddOns support a little.
 
2.13 - 2005/03/05 - Merrem
 
Added support for the myAddOns AddOn.
 
2.12 - 2005/02/26 - Merrem
 
Added optional check for Sea.util.hook for the new Cosmos Alpha.
Changed .zip to include full Interface\AddOns\QuickMountEquip path.
Added Interface\AddOns\QuickMountEquip.nopatch for Cosmos users.
 
2.11 - 2005/02/22 - Merrem
 
Changed .toc to 4216
 
2.10 - 2005/02/16 - Merrem
 
Changed .toc version number to match latest US servers. (4211)
Switched from RegisterForSave to SavedVariables in .toc
Made the flight point check a little more efficient.
Still requires an attack button somewhere in the first 72 hotkeys, but will only
search once. If none is found, the Wind Rider/Griffin check is disabled. Reportedly
spurs/carrot/etc don't work on them, but I like switching anyway, so I'm leaving the
check in.
 
2.09 - 2005/02/12 - Merrem
 
Made it so that it's impossible to destroy items when the configuration frame is open.
 
2.08 - 2005/01/31 - Merrem
 
Fixed typo in ReadMe.txt
Added check for Tiger's Fury
Added check for Polymorph
Added fix for Flexbar conflict
 
2.07 - 2005/01/28 - Merrem
 
Added check for Kodo Mounts.
 
2.06 - 2005/01/28 - Merrem
 
Fixed error that occured on characters other than the first.
 
2.05 - 2005/01/27 - Merrem
 
Added new Paladin/Warlock Mount check.
Added a check for Hunter "Aspect of the Pack" buff that was triggering the swap.
Mounting should no longer interfere with the main tooltip.
Equipping multiple trinkets should work now. Items of similar types must "line up" in the config GUI now, however.
 
2.04 - 2005/01/26 - Merrem
 
Fixed typo in config loading.
 
2.03 - 2005/01/26 - Merrem
 
Added the ability to turn off and on the AddOn using "/mountequip on" or "/mountequip off"
Added the ability to turn on/off equip messages.
Configuration is now saved on a Realm/Player basis.
(So if you have multiple players each will have their own config.)
Misc. Cleanup / Error checking on initial loading...
Shortened the messages that show-up when multiple items are equipped at once.
 
2.02 - 2005/01/25 - Merrem
 
Removed the need for Cosmos.
 
2.00 - 2005/01/24 - Merrem
 
Initial public release. Required Cosmos.
 
 
FEATURES
 
Whenever you Mount or Dismount it will automatically switch to the gear you specify.
 
Full GUI to configure which gear to switch to. /mountequip to show GUI.
 
Optionally will automatically detects Griffins and switches then also. (Off by default)
 
If you get automatically dismounted due to water, or running into buildings, etc... it will switch gear correctly.
 
If you get dismounted while aggroed by a foe, WoW won't let you switch equipment. But as soon as combat or aggro is clear, it will automatically switch gear correctly.
 
 
USAGE
 
/mountequip - This is the main interface to the configuration options.
 
There are several options available: on, off, quiet, verbose, flightpoint, config, status, load, save, delete, profiles, detect
 
/mountequip config - This will open up the GUI interface to select which items you want equipped when you mount/dismount.
 
/mountequip on - Turns on the auto-equip functionality (default)
 
/mountequip off - Turns off the auto-equip functionality
 
/mountequip verbose - Informs you when it auto-equips items. (default)
 
/mountequip quiet - Doesn't inform you when it auto-equips items.
 
/mountequip flightpoint on - Turns on flightpoint (Griffin) checking
 
/mountequip flightpoint off - Turns off flightpoint (Griffin) checking (default)
 
/mountequip flightform on - Turns on flight form slot (for druid epic flight form trinket)
 
/mountequip flightform off - Turns off flight form slot (for druid epic flight form trinket) (default)
 
/mountequip status - Shows you the status of the settings, and a usage statement.
 
/mountequip save "ProfileName" - Saves the profile named "ProfileName"
 
/mountequip load "ProfileName" - Loads the profile named "ProfileName"
 
/mountequip profiles - lists all saved profiles
 
/mountequip delete "ProfileName" - Deletes the profile named "ProfileName"
 
/mountequip detect now|on|off|clear - Attempts to detect the name of your mount. Should only be used if the AddOn doesn't work at all when you mount-up normally.