This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local vocTable = { | |
__add = function (t1, t2) | |
local ret = {} | |
for i, v in ipairs(t1) do | |
table.insert(ret, v) | |
end | |
for i, v in ipairs(t2) do | |
table.insert(ret, v) | |
end | |
return ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Player.getTotalSavedKills(self) | |
local Info = db.storeQuery("SELECT `frags` FROM `players` WHERE `id` = " .. self:getGuid()) | |
local frags = result.getDataInt(Info, 'frags') | |
result.free(Info) | |
return frags | |
end | |
function Player.getTotalSavedDeaths(self) | |
local Info = db.storeQuery("SELECT `deaths` FROM `players` WHERE `id` = " .. self:getGuid()) | |
local deaths = result.getDataInt(Info, 'deaths') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local spellsFile = io.open("data/test/spells.xml", "r") | |
local spellsFolder = "data/test/scripts/" | |
local convertsFolder = "data/test/converts/" | |
local instantSpells = {} | |
local function tobool(v) | |
return v and ( (type(v)=="number") and (v==1) or ( (type(v)=="string") and (v=="true") ) ) | |
end | |
local function cleanSpaces(s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MonsterLimits = {} | |
Global_Monster_Limit = 3 | |
local startup = CreatureEvent("MonsterLimitStartup") | |
function startup.onLogin(player) | |
local guid = player:getGuid() | |
if not MonsterLimits[guid] then | |
MonsterLimits[guid] = {} | |
player:registerEvent("MonsterKillCounter") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getOS() | |
-- ask LuaJIT first | |
if jit then | |
return jit.os | |
end | |
-- Unix, Linux variants | |
local fh,err = assert(io.popen("uname -o 2>/dev/null","r")) | |
if fh then | |
osname = fh:read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- configuration | |
LOOP_EVENT_DELAY = 5 * 1000 -- (in milliseconds) | |
-- register list of affected creatures and protect them from reload | |
if not LOOP_EVENT_REGISTERED_CREATURES then | |
LOOP_EVENT_REGISTERED_CREATURES = {} | |
end | |
-- store session id to reload the loop without duplicating it | |
if LOOP_EVENT_SESSION_ID then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- usage: just call it in a Lua environment and look for a file called out.txt | |
-- lists all global variables in a file | |
function writeAllGlobals() | |
local file = io.open("out.txt", "w+") | |
local seen={} | |
local function dump(t,i) | |
seen[t]=true | |
local s={} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- replace your mw script with this | |
local combat = Combat() | |
combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) | |
combat:setParameter(COMBAT_PARAM_CREATEITEM, ITEM_MAGICWALL) | |
local function tile_timer(id, pos, delay, color) | |
if not Tile(pos):getItemById(id) then | |
return true | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- async iterate area | |
-- for when you want to execute a script on a large area, but dont want lags on your server | |
local defaultChunkSize = 16 | |
local defaultDelay = 200 | |
Area = setmetatable ({ }, | |
{ | |
__call = function (area, ...) | |
return area.new (...) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
project.exe test.txt | |
pause |
NewerOlder