This commit is contained in:
Eduardo Bart 2012-10-04 19:35:02 -03:00
parent 68f9af376f
commit 8119428d41
2 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,10 @@ function string:starts(start)
return string.sub(self, 1, #start) == start return string.sub(self, 1, #start) == start
end end
function string.ends(s, test)
return test =='' or string.sub(s,-string.len(test)) == test
end
function string:trim() function string:trim()
return string.match(self, '^%s*(.*%S)') or '' return string.match(self, '^%s*(.*%S)') or ''
end end

View File

@ -10,7 +10,7 @@ function g_game.isCreatureNameFormatEnabled()
end end
function g_game.chooseRsa(host) function g_game.chooseRsa(host)
if host:match('.*\.tibia\.com') or host:match('.*\.cipsoft\.com') then if string.ends(host, '.tibia.com') or string.ends(host, '.cipsoft.com') then
g_game.setRsa(CIPSOFT_RSA) g_game.setRsa(CIPSOFT_RSA)
else else
g_game.setRsa(OTSERV_RSA) g_game.setRsa(OTSERV_RSA)