Mercurial > wow > mylilpony
comparison MyLilPony.lua @ 34:1d9a8aa6d72e
Merging localization work from branch.
| author | syzler |
|---|---|
| date | Sat, 30 Apr 2011 22:26:16 +0000 |
| parents | af32bee5a3d1 |
| children | 83e9649a6606 |
comparison
equal
deleted
inserted
replaced
| 32:37f948cacc7d | 34:1d9a8aa6d72e |
|---|---|
| 41 SlashCmdList["MyLilPony"] = MyLilPony.SlashHandler; | 41 SlashCmdList["MyLilPony"] = MyLilPony.SlashHandler; |
| 42 SLASH_MyLilPony1 = "/pony"; | 42 SLASH_MyLilPony1 = "/pony"; |
| 43 SLASH_MyLilPony2 = "/mlp"; | 43 SLASH_MyLilPony2 = "/mlp"; |
| 44 SLASH_MyLilPony3 = "/mylilpony"; | 44 SLASH_MyLilPony3 = "/mylilpony"; |
| 45 | 45 |
| 46 MyLilPony.Log(format("Version %s loaded", MYLILPONY_VERSION)); | 46 MyLilPony.Log(format(L["msgVersionLoaded"], MYLILPONY_VERSION)); |
| 47 MyLilPony.LoadDefaults(); | 47 MyLilPony.LoadDefaults(); |
| 48 end | 48 end |
| 49 | 49 |
| 50 function MyLilPony.LoadDefaults() | 50 function MyLilPony.LoadDefaults() |
| 51 if MyLilPony.AutoDismount == nil then MyLilPony.AutoDismount = true end | 51 if MyLilPony.AutoDismount == nil then MyLilPony.AutoDismount = true end |
| 52 end | 52 end |
| 53 | 53 |
| 54 function MyLilPony.AutoMount() | 54 function MyLilPony.AutoMount() |
| 55 if UnitIsDead("player") or UnitIsGhost("player") then | 55 if UnitIsDead("player") or UnitIsGhost("player") then |
| 56 MyLilPony.Log("You are dead"); | 56 MyLilPony.Log(L["msgYouAreDead"]); |
| 57 return; | 57 return; |
| 58 end | 58 end |
| 59 | 59 |
| 60 if InCombatLockdown() then | 60 if InCombatLockdown() then |
| 61 MyLilPony.Log("You are in combat"); | 61 MyLilPony.Log(L["msgYouAreInCombat"]); |
| 62 return; | 62 return; |
| 63 end | 63 end |
| 64 | 64 |
| 65 if IsMounted() and not MyLilPony.AutoDismount then | 65 if IsMounted() and not MyLilPony.AutoDismount then |
| 66 MyLilPony.Log("You are already mounted"); | 66 MyLilPony.Log(L["msgYouAreMounted"]); |
| 67 return; | 67 return; |
| 68 end | 68 end |
| 69 | 69 |
| 70 if IsMounted() and IsFlying() then | 70 if IsMounted() and IsFlying() then |
| 71 MyLilPony.Log("You are already flying"); | 71 MyLilPony.Log(L["msgYouAreFlying"]); |
| 72 return; | 72 return; |
| 73 end | 73 end |
| 74 | 74 |
| 75 local zone = GetRealZoneText(); | 75 local zone = GetRealZoneText(); |
| 76 | 76 |
| 152 or MyLilPony.StringMatchIgnoreCase(arg, "^tgt$") | 152 or MyLilPony.StringMatchIgnoreCase(arg, "^tgt$") |
| 153 or MyLilPony.StringMatchIgnoreCase(arg, "^t$") then | 153 or MyLilPony.StringMatchIgnoreCase(arg, "^t$") then |
| 154 if unit == "" or unit == nil then unit = "target" end | 154 if unit == "" or unit == nil then unit = "target" end |
| 155 local result = MyLilPony.CallMountByMatch(unit); | 155 local result = MyLilPony.CallMountByMatch(unit); |
| 156 if not result then | 156 if not result then |
| 157 MyLilPony.Log("No matching mounts were found"); | 157 MyLilPony.Log(L["msgNoMatchingMountsFound"]); |
| 158 end | 158 end |
| 159 elseif MyLilPony.StringMatchIgnoreCase(arg, "^exact .+$") | 159 elseif MyLilPony.StringMatchIgnoreCase(arg, "^exact .+$") |
| 160 or MyLilPony.StringMatchIgnoreCase(arg, "^x .+$") then | 160 or MyLilPony.StringMatchIgnoreCase(arg, "^x .+$") then |
| 161 local param = MyLilPony.StringMatchIgnoreCase(arg, "^.+ (.+)$"); | 161 local param = MyLilPony.StringMatchIgnoreCase(arg, "^.+ (.+)$"); |
| 162 local result = MyLilPony.CallMountByName(param); | 162 local result = MyLilPony.CallMountByName(param); |
| 163 if not result then | 163 if not result then |
| 164 MyLilPony.Log(format("No matching mounts were found with NAME='%s'", param)); | 164 MyLilPony.Log(format(L["msgNoMatchingMountsForName"], param)); |
| 165 end | 165 end |
| 166 elseif MyLilPony.StringMatchIgnoreCase(arg, "^list .+$") | 166 elseif MyLilPony.StringMatchIgnoreCase(arg, "^list .+$") |
| 167 or MyLilPony.StringMatchIgnoreCase(arg, "^find .+$") | 167 or MyLilPony.StringMatchIgnoreCase(arg, "^find .+$") |
| 168 or MyLilPony.StringMatchIgnoreCase(arg, "^l .+$") then | 168 or MyLilPony.StringMatchIgnoreCase(arg, "^l .+$") then |
| 169 local param = MyLilPony.StringMatchIgnoreCase(arg, "^.+ (.+)$"); | 169 local param = MyLilPony.StringMatchIgnoreCase(arg, "^.+ (.+)$"); |
| 170 local result = MyLilPony.ListMountsByPattern(param); | 170 local result = MyLilPony.ListMountsByPattern(param); |
| 171 if not result then | 171 if not result then |
| 172 MyLilPony.Log(format("No matching mounts were found with NAME like '%s'", param)); | 172 MyLilPony.Log(format(L["msgNoMatchingMountsForPattern"], param)); |
| 173 else | 173 else |
| 174 for _, name in pairs(result) do | 174 for _, name in pairs(result) do |
| 175 MyLilPony.Print(name); | 175 MyLilPony.Print(name); |
| 176 end | 176 end |
| 177 MyLilPony.Print(format(L["msgCountMatchingMountsForPattern"], #result)); | |
| 177 end | 178 end |
| 178 elseif MyLilPony.StringMatchIgnoreCase(arg, "^%d+$") then | 179 elseif MyLilPony.StringMatchIgnoreCase(arg, "^%d+$") then |
| 179 local result = MyLilPony.CallMountById(tonumber(arg)); | 180 local result = MyLilPony.CallMountById(tonumber(arg)); |
| 180 if not result then | 181 if not result then |
| 181 MyLilPony.Log(format("No matching mounts were found with ID=%s", arg)); | 182 MyLilPony.Log(format(L["msgNoMatchingMountsForId"], arg)); |
| 182 end | 183 end |
| 183 elseif MyLilPony.StringMatchIgnoreCase(arg, "^.+$") then | 184 elseif MyLilPony.StringMatchIgnoreCase(arg, "^.+$") then |
| 184 local result = MyLilPony.CallMountByPattern(arg); | 185 local result = MyLilPony.CallMountByPattern(arg); |
| 185 if not result then | 186 if not result then |
| 186 MyLilPony.Log(format("No matching mounts were found with NAME like '%s'", arg)); | 187 MyLilPony.Log(format(L["msgNoMatchingMountsForPattern"], arg)); |
| 187 end | 188 end |
| 188 else | 189 else |
| 189 MyLilPony.Print(format("MyLilPony %s", MYLILPONY_VERSION)); | 190 MyLilPony.Print(format("MyLilPony %s", MYLILPONY_VERSION)); |
| 190 MyLilPony.Print("Slash Command: /mylilpony (/pony, /mlp)"); | 191 MyLilPony.Print(L["szCommandHelp"].." (/mylilpony, /pony, /mlp)"); |
| 191 MyLilPony.Print(" /mylilpony auto - Summons a \"suitable\" mount"); | 192 MyLilPony.Print(" /mylilpony auto - "..L["msgHelpCommandAuto"]); |
| 192 MyLilPony.Print(" /mylilpony random - Summons random mount"); | 193 MyLilPony.Print(" /mylilpony random - "..L["msgHelpCommandRandom"]); |
| 193 MyLilPony.Print(" /mylilpony ground - Summons random ground mount"); | 194 MyLilPony.Print(" /mylilpony ground - "..L["msgHelpCommandGround"]); |
| 194 MyLilPony.Print(" /mylilpony flying - Summons random flying mount"); | 195 MyLilPony.Print(" /mylilpony flying - "..L["msgHelpCommandFlying"]); |
| 195 MyLilPony.Print(" /mylilpony aquatic - Summons random aquatic mount"); | 196 MyLilPony.Print(" /mylilpony aquatic - "..L["msgHelpCommandAquatic"]); |
| 196 MyLilPony.Print(" /mylilpony match - Summons same mount as targeted unit"); | 197 MyLilPony.Print(" /mylilpony match - "..L["msgHelpCommandTarget"]); |
| 197 MyLilPony.Print(" /mylilpony [@<UNITID>] match - Summons same mount as specified unit"); | 198 MyLilPony.Print(" /mylilpony [@<UNITID>] match - "..L["msgHelpCommandMatch"]); |
| 198 MyLilPony.Print(" /mylilpony list <NAME> - Lists mounts matching name"); | 199 MyLilPony.Print(" /mylilpony list <NAME> - "..L["msgHelpCommandList"]); |
| 199 MyLilPony.Print(" /mylilpony exact <NAME> - Summons mount by exact name"); | 200 MyLilPony.Print(" /mylilpony exact <NAME> - "..L["msgHelpCommandExact"]); |
| 200 MyLilPony.Print(" /mylilpony <ID> - Summons mount by spell or creature ID"); | 201 MyLilPony.Print(" /mylilpony <ID> - "..L["msgHelpCommandId"]); |
| 201 MyLilPony.Print(" /mylilpony <NAME> - Summons random mount matching name"); | 202 MyLilPony.Print(" /mylilpony <NAME> - "..L["msgHelpCommandName"]); |
| 202 end | 203 end |
| 203 end | 204 end |
| 204 | 205 |
| 205 MyLilPony.OnLoad(); | 206 MyLilPony.OnLoad(); |
