comparison MyLilPony.lua @ 25:830b2ccf349d i18n

Added more strings.
author syzler
date Sat, 16 Apr 2011 17:14:41 +0000
parents 7bc67e937603
children af32bee5a3d1
comparison
equal deleted inserted replaced
23:ed1d946e5df5 25:830b2ccf349d
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 end 177 end
178 elseif MyLilPony.StringMatchIgnoreCase(arg, "^%d+$") then 178 elseif MyLilPony.StringMatchIgnoreCase(arg, "^%d+$") then
179 local result = MyLilPony.CallMountById(tonumber(arg)); 179 local result = MyLilPony.CallMountById(tonumber(arg));
180 if not result then 180 if not result then
181 MyLilPony.Log(format("No matching mounts were found with ID=%s", arg)); 181 MyLilPony.Log(format(L["msgNoMatchingMountsForId"], arg));
182 end 182 end
183 elseif MyLilPony.StringMatchIgnoreCase(arg, "^.+$") then 183 elseif MyLilPony.StringMatchIgnoreCase(arg, "^.+$") then
184 local result = MyLilPony.CallMountByPattern(arg); 184 local result = MyLilPony.CallMountByPattern(arg);
185 if not result then 185 if not result then
186 MyLilPony.Log(format("No matching mounts were found with NAME like '%s'", arg)); 186 MyLilPony.Log(format(L["msgNoMatchingMountsForPattern"], arg));
187 end 187 end
188 else 188 else
189 MyLilPony.Print(format("MyLilPony %s", MYLILPONY_VERSION)); 189 MyLilPony.Print(format("MyLilPony %s", MYLILPONY_VERSION));
190 MyLilPony.Print(L["szSlashCommand"]..": /mylilpony (/pony, /mlp)"); 190 MyLilPony.Print(L["szCommandHelp"].." (/mylilpony, /pony, /mlp)");
191 MyLilPony.Print(" /mylilpony auto - "..L["msgHelpCommandAuto"]); 191 MyLilPony.Print(" /mylilpony auto - "..L["msgHelpCommandAuto"]);
192 MyLilPony.Print(" /mylilpony random - "..L["msgHelpCommandRandom"]); 192 MyLilPony.Print(" /mylilpony random - "..L["msgHelpCommandRandom"]);
193 MyLilPony.Print(" /mylilpony ground - "..L["msgHelpCommandGround"]); 193 MyLilPony.Print(" /mylilpony ground - "..L["msgHelpCommandGround"]);
194 MyLilPony.Print(" /mylilpony flying - "..L["msgHelpCommandFlying"]); 194 MyLilPony.Print(" /mylilpony flying - "..L["msgHelpCommandFlying"]);
195 MyLilPony.Print(" /mylilpony aquatic - "..L["msgHelpCommandAquatic"]); 195 MyLilPony.Print(" /mylilpony aquatic - "..L["msgHelpCommandAquatic"]);