Mercurial > wow > mylilpony
view MyLilPony.lua @ 48:83e9649a6606 1.1.7
Fixed Abyssal Seahorse mounting in certain subzones of Vashj'ir
author | syzler |
---|---|
date | Thu, 20 Sep 2012 01:28:44 -0400 |
parents | af32bee5a3d1 |
children | 22011265a16f |
line wrap: on
line source
-- Copyright (c) 2011, Syzler -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions -- are met: -- -- * Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in -- the documentation and/or other materials provided with the -- distribution. -- * Neither the name of the MyLilPony Project nor the names of its -- contributors may be used to endorse or promote products derived -- from this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -- COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -- ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------ -- Project: MyLilPony -- Project Version: @project-version@ -- Last Author: @file-author@ -- Last Updated: @file-date-iso@ -- -- Main addon code ------------------------------------------------------------------------ function MyLilPony.OnLoad() SlashCmdList["MyLilPony"] = MyLilPony.SlashHandler; SLASH_MyLilPony1 = "/pony"; SLASH_MyLilPony2 = "/mlp"; SLASH_MyLilPony3 = "/mylilpony"; MyLilPony.Log(format(L["msgVersionLoaded"], MYLILPONY_VERSION)); MyLilPony.LoadDefaults(); end function MyLilPony.LoadDefaults() if MyLilPony.AutoDismount == nil then MyLilPony.AutoDismount = true end end function MyLilPony.AutoMount() if UnitIsDead("player") or UnitIsGhost("player") then MyLilPony.Log(L["msgYouAreDead"]); return; end if InCombatLockdown() then MyLilPony.Log(L["msgYouAreInCombat"]); return; end if IsMounted() and not MyLilPony.AutoDismount then MyLilPony.Log(L["msgYouAreMounted"]); return; end if IsMounted() and IsFlying() then MyLilPony.Log(L["msgYouAreFlying"]); return; end local zone = GetRealZoneText(); -- player is in Temple of Ahn'Qiraj (AQ40) if zone == "Ahn'Qiraj" then if not IsModifierKeyDown() and MyLilPony.CallMountByPattern("Qiraji Battle Tank") then return; end end -- player is in Wintergrasp if zone == "Wintergrasp" then -- always call ground mount if Wintergrasp is in progress local _, _, wintergraspInProgress, _, _, _ = GetWorldPVPAreaInfo(1); if wintergraspInProgress and MyLilPony.CallGroundMount() then return; end end -- player is swimming in Vashj'ir if IsSwimming() and (zone == "Shimmering Expanse" or zone == "Kelp'thar Forest" or zone == "Abyssal Depths" or zone == "Ruins of Vashj'ir" or zone == "Beth'mora Ridge" or zone == "The Undershell") then -- normal behaviour in Vashj'ir is to call the Abyssal Seahorse -- modified behaviour is to attempt flight (i.e. you're at the surface) if not IsModifierKeyDown() and MyLilPony.CallMountByName("Abyssal Seahorse") then return; elseif MyLilPony.CanFlyHere() and MyLilPony.CallFlyingMount() then return; elseif MyLilPony.CallAquaticMount() then return; end end -- player is in flyable area and knows how to fly here too if MyLilPony.CanFlyHere() then -- normal behaviour in flyable area is to call flying mount if not IsModifierKeyDown() and MyLilPony.CallFlyingMount() then return; elseif IsSwimming() and MyLilPony.CallAquaticMount() then return; end end -- player is swimming if IsSwimming() then -- normal behaviour while swimming is to call aquatic mount if not IsModifierKeyDown() and MyLilPony.CallAquaticMount() then return; end end MyLilPony.CallGroundMount(); end function MyLilPony.SlashHandler(args) local arg, unit = SecureCmdOptionParse(args); if MyLilPony.StringMatchIgnoreCase(arg, "^auto$") then MyLilPony.AutoMount(); elseif MyLilPony.StringMatchIgnoreCase(arg, "^random$") or MyLilPony.StringMatchIgnoreCase(arg, "^rand$") or MyLilPony.StringMatchIgnoreCase(arg, "^rng$") or MyLilPony.StringMatchIgnoreCase(arg, "^r$") then MyLilPony.CallMount(); elseif MyLilPony.StringMatchIgnoreCase(arg, "^ground$") or MyLilPony.StringMatchIgnoreCase(arg, "^g$") then MyLilPony.CallGroundMount(); elseif MyLilPony.StringMatchIgnoreCase(arg, "^flying$") or MyLilPony.StringMatchIgnoreCase(arg, "^fly$") or MyLilPony.StringMatchIgnoreCase(arg, "^air$") or MyLilPony.StringMatchIgnoreCase(arg, "^a$") then MyLilPony.CallFlyingMount(); elseif MyLilPony.StringMatchIgnoreCase(arg, "^aquatic$") or MyLilPony.StringMatchIgnoreCase(arg, "^aqua$") or MyLilPony.StringMatchIgnoreCase(arg, "^swim$") or MyLilPony.StringMatchIgnoreCase(arg, "^s$") then MyLilPony.CallAquaticMount(); elseif MyLilPony.StringMatchIgnoreCase(arg, "^match$") or MyLilPony.StringMatchIgnoreCase(arg, "^m$") or MyLilPony.StringMatchIgnoreCase(arg, "^target$") or MyLilPony.StringMatchIgnoreCase(arg, "^tgt$") or MyLilPony.StringMatchIgnoreCase(arg, "^t$") then if unit == "" or unit == nil then unit = "target" end local result = MyLilPony.CallMountByMatch(unit); if not result then MyLilPony.Log(L["msgNoMatchingMountsFound"]); end elseif MyLilPony.StringMatchIgnoreCase(arg, "^exact .+$") or MyLilPony.StringMatchIgnoreCase(arg, "^x .+$") then local param = MyLilPony.StringMatchIgnoreCase(arg, "^.+ (.+)$"); local result = MyLilPony.CallMountByName(param); if not result then MyLilPony.Log(format(L["msgNoMatchingMountsForName"], param)); end elseif MyLilPony.StringMatchIgnoreCase(arg, "^list .+$") or MyLilPony.StringMatchIgnoreCase(arg, "^find .+$") or MyLilPony.StringMatchIgnoreCase(arg, "^l .+$") then local param = MyLilPony.StringMatchIgnoreCase(arg, "^.+ (.+)$"); local result = MyLilPony.ListMountsByPattern(param); if not result then MyLilPony.Log(format(L["msgNoMatchingMountsForPattern"], param)); else for _, name in pairs(result) do MyLilPony.Print(name); end MyLilPony.Print(format(L["msgCountMatchingMountsForPattern"], #result)); end elseif MyLilPony.StringMatchIgnoreCase(arg, "^%d+$") then local result = MyLilPony.CallMountById(tonumber(arg)); if not result then MyLilPony.Log(format(L["msgNoMatchingMountsForId"], arg)); end elseif MyLilPony.StringMatchIgnoreCase(arg, "^.+$") then local result = MyLilPony.CallMountByPattern(arg); if not result then MyLilPony.Log(format(L["msgNoMatchingMountsForPattern"], arg)); end else MyLilPony.Print(format("MyLilPony %s", MYLILPONY_VERSION)); MyLilPony.Print(L["szCommandHelp"].." (/mylilpony, /pony, /mlp)"); MyLilPony.Print(" /mylilpony auto - "..L["msgHelpCommandAuto"]); MyLilPony.Print(" /mylilpony random - "..L["msgHelpCommandRandom"]); MyLilPony.Print(" /mylilpony ground - "..L["msgHelpCommandGround"]); MyLilPony.Print(" /mylilpony flying - "..L["msgHelpCommandFlying"]); MyLilPony.Print(" /mylilpony aquatic - "..L["msgHelpCommandAquatic"]); MyLilPony.Print(" /mylilpony match - "..L["msgHelpCommandTarget"]); MyLilPony.Print(" /mylilpony [@<UNITID>] match - "..L["msgHelpCommandMatch"]); MyLilPony.Print(" /mylilpony list <NAME> - "..L["msgHelpCommandList"]); MyLilPony.Print(" /mylilpony exact <NAME> - "..L["msgHelpCommandExact"]); MyLilPony.Print(" /mylilpony <ID> - "..L["msgHelpCommandId"]); MyLilPony.Print(" /mylilpony <NAME> - "..L["msgHelpCommandName"]); end end MyLilPony.OnLoad();