repo_name
stringlengths
6
69
path
stringlengths
6
178
copies
stringclasses
278 values
size
stringlengths
4
7
content
stringlengths
671
917k
license
stringclasses
15 values
hooksta4/darkstar
scripts/zones/zones/Quicksand_Caves/npcs/_5sb.lua
2
1223
----------------------------------- -- Area: Quicksand Caves -- NPC: Ornate Door -- Door blocked by Weight system -- @pos -420 0 735 208 ----------------------------------- package.loaded["scripts/zones/Quicksand_Caves/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Quicksand_Caves/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local difX = player:getXPos()-(-420); local difZ = player:getZPos()-(726); local Distance = math.sqrt( math.pow(difX,2) + math.pow(difZ,2) ); if (Distance < 3) then return -1; end player:messageSpecial(DOOR_FIRMLY_SHUT); return 1; end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
prosody-modules/import2
mod_listusers/mod_listusers.lua
34
2522
function module.command(args) local action = table.remove(args, 1); if not action then -- Default, list registered users local data_path = CFG_DATADIR or "data"; if not pcall(require, "luarocks.loader") then pcall(require, "luarocks.require"); end local lfs = require "lfs"; function decode(s) return s:gsub("%%([a-fA-F0-9][a-fA-F0-9])", function (c) return string.char(tonumber("0x"..c)); end); end for host in lfs.dir(data_path) do local accounts = data_path.."/"..host.."/accounts"; if lfs.attributes(accounts, "mode") == "directory" then for user in lfs.dir(accounts) do if user:sub(1,1) ~= "." then print(decode(user:gsub("%.dat$", "")).."@"..decode(host)); end end end end elseif action == "--connected" then -- List connected users local socket = require "socket"; local default_local_interfaces = { }; if socket.tcp6 and config.get("*", "use_ipv6") ~= false then table.insert(default_local_interfaces, "::1"); end if config.get("*", "use_ipv4") ~= false then table.insert(default_local_interfaces, "127.0.0.1"); end local console_interfaces = config.get("*", "console_interfaces") or config.get("*", "local_interfaces") or default_local_interfaces console_interfaces = type(console_interfaces)~="table" and {console_interfaces} or console_interfaces; local console_ports = config.get("*", "console_ports") or 5582 console_ports = type(console_ports) ~= "table" and { console_ports } or console_ports; local st, conn = pcall(assert,socket.connect(console_interfaces[1], console_ports[1])); if (not st) then print("Error"..(conn and ": "..conn or "")); return 1; end local banner = config.get("*", "console_banner"); if ( (not banner) or ( (type(banner) == "string") and (banner:match("^| (.+)$")) ) ) then repeat local rec_banner = conn:receive() until rec_banner == "" or rec_banner == nil; -- skip banner end conn:send("c2s:show()\n"); conn:settimeout(1); -- Only hit in case of failure repeat local line = conn:receive() if not line then break; end local jid = line:match("^| (.+)$"); if jid then jid = jid:gsub(" %- (%w+%(%d+%))$", "\t%1"); print(jid); elseif line:match("^| OK:") then return 0; end until false; end return 0; end
mit
gedadsbranch/Darkstar-Mission
scripts/zones/Port_Jeuno/npcs/Omiro-Zamiro.lua
20
1362
----------------------------------- -- Area: Port Jeuno -- NPC: Omiro-Zamiro -- @zone 246 -- @pos 3 7 -54 ----------------------------------- package.loaded["scripts/zones/Port_Jeuno/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/zones/Port_Jeuno/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if(player:hasKeyItem(AIRSHIP_PASS) == true and player:getGil() >= 200) then player:startEvent(0x0027); else player:startEvent(0x002f); end return 1; end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if(csid == 0x0027) then Z = player:getZPos(); if(Z >= -61 and Z <= -58) then player:delGil(200); end end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Southern_San_dOria/npcs/Leuveret.lua
13
1539
----------------------------------- -- Area: Southern San d'Oria -- NPC: Leuveret -- General Info NPC ------------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE) ==QUEST_ACCEPTED) then if (trade:hasItemQty(532,1) and trade:getItemCount() == 1 and player:getVar("tradeLeuveret") == 0) then player:messageSpecial(8709); player:setVar("FFR",player:getVar("FFR") - 1); player:setVar("tradeLeuveret",1); player:messageSpecial(FLYER_ACCEPTED); player:tradeComplete(); elseif (player:getVar("tradeLeuveret") ==1) then player:messageSpecial(8710); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x26D); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
henry4k/konstrukt-pkman
packagemanager-gui/ArtProvider.lua
1
8771
local wx = require 'wx' local path = require 'path' local utils = require 'packagemanager-gui/utils' local fs = require 'packagemanager/fs' local ArtProvider = wx.wxLuaArtProvider() local IgnoreCallbacks = false local function IconStack( osDependantIconStacks ) local os = utils.getOperatingSystem() local stack = osDependantIconStacks[os] if not stack then print('No icon stack defined for '..os) end return stack end --[[ Windows: wxART_ERROR wxART_QUESTION wxART_WARNING wxART_INFORMATION wxART_HELP wxART_FOLDER wxART_FOLDER_OPEN wxART_DELETE wxART_FIND wxART_HARDDISK wxART_FLOPPY wxART_CDROM wxART_REMOVABLE Mac OSX: wxART_ERROR wxART_INFORMATION wxART_WARNING wxART_QUESTION wxART_FOLDER wxART_FOLDER_OPEN wxART_NORMAL_FILE wxART_EXECUTABLE_FILE wxART_CDROM wxART_FLOPPY wxART_HARDDISK wxART_REMOVABLE wxART_PRINT wxART_DELETE wxART_GO_BACK wxART_GO_FORWARD wxART_GO_HOME wxART_HELP_SETTINGS wxART_HELP_PAGE wxART_HELP_FOLDER ]] local IconStacks = { ['changes'] = IconStack{Unix = {{type = 'system', name = 'view-refresh'}}, Windows = {{type = 'bitmap', file = 'changes?.png'}}, Mac = {{type = 'bitmap', file = 'changes?.png'}}}, ['requirements'] = IconStack{Unix = {{type = 'system', name = 'bookmarks-organize'}, {type = 'system', name = 'bookmarks'}, {type = 'system', name = 'user-bookmarks'}}, Windows = {{type = 'bitmap', file = 'bookmark?.png'}}, Mac = {{type = 'bitmap', file = 'bookmark?.png'}}}, ['settings'] = IconStack{Unix = {{type = 'system', name = 'configure'}, {type = 'system', name = 'gtk-properties'}}, Windows = {{type = 'bitmap', file = 'settings?.png'}}, Mac = {{type = 'bitmap', file = 'settings?.png'}}}, ['repository'] = IconStack{Unix = {{type = 'system', name = 'server-database'}}, Windows = {{type = 'bitmap', file = 'repository?.png'}}, Mac = {{type = 'bitmap', file = 'repository?.png'}}}, ['package-search'] = IconStack{Unix = {{type = 'system', name = 'system-search'}, {type = 'system', name = 'wxART_FIND'}}, Windows = {{type = 'bitmap', file = 'search?.png'}}, Mac = {{type = 'bitmap', file = 'search?.png'}}}, ['package-available'] = IconStack{Unix = {{type = 'bitmap', file = 'empty?.png'}}, Windows = {{type = 'bitmap', file = 'empty?.png'}}, Mac = {{type = 'bitmap', file = 'empty?.png'}}}, ['package-installed-updated'] = IconStack{Unix = {{type = 'system', name = 'document-save'}}, Windows = {{type = 'bitmap', file = 'download?.png'}}, Mac = {{type = 'bitmap', file = 'download?.png'}}}, ['package-install'] = IconStack{Unix = {{type = 'system', name = 'list-add'}}, Windows = {{type = 'bitmap', file = 'add?.png'}}, Mac = {{type = 'bitmap', file = 'add?.png'}}}, ['package-uninstall'] = IconStack{Unix = {{type = 'system', name = 'list-remove'}}, Windows = {{type = 'bitmap', file = 'remove?.png'}}, Mac = {{type = 'bitmap', file = 'remove?.png'}}}, ['sort-ascending'] = IconStack{Unix = {{type = 'system', name = 'view-sort-ascending'}}, Windows = {{type = 'bitmap', file = 'sort-ascending?.png'}}, Mac = {{type = 'bitmap', file = 'sort-ascending?.png'}}}, ['sort-descending'] = IconStack{Unix = {{type = 'system', name = 'view-sort-descending'}}, Windows = {{type = 'bitmap', file = 'sort-descending?.png'}}, Mac = {{type = 'bitmap', file = 'sort-descending?.png'}}}, ['edit'] = IconStack{Unix = {{type = 'system', name = 'gtk-edit'}}, Windows = {{type = 'bitmap', file = 'edit?.png'}}, Mac = {{type = 'bitmap', file = 'edit?.png'}}}, ['wxART_UNDO'] = IconStack{Unix = {{type = 'system', name = 'wxART_UNDO'}}, Windows = {{type = 'bitmap', file = 'undo?.png'}}, Mac = {{type = 'bitmap', file = 'undo?.png'}}}, ['wxART_FILE_SAVE'] = IconStack{Unix = {{type = 'system', name = 'wxART_FILE_SAVE'}}, Windows = {{type = 'system', name = 'wxART_FLOPPY'}}, Mac = {{type = 'system', name = 'wxART_FLOPPY'}}}, ['wxART_FILE_OPEN'] = IconStack{Unix = {{type = 'system', name = 'wxART_FILE_OPEN'}}, Windows = {{type = 'system', name = 'wxART_FILE_OPEN'}}, Mac = {{type = 'system', name = 'wxART_FILE_OPEN'}}}, ['wxART_INFORMATION'] = IconStack{Unix = {{type = 'system', name = 'wxART_INFORMATION'}}, Windows = {{type = 'system', name = 'wxART_INFORMATION'}}, Mac = {{type = 'system', name = 'wxART_INFORMATION'}}}, ['wxART_HELP'] = IconStack{Unix = {{type = 'system', name = 'wxART_HELP'}}, Windows = {{type = 'system', name = 'wxART_HELP'}}, Mac = {{type = 'system', name = 'wxART_HELP', {type = 'system', name = 'wxART_HELP_PAGE'}}}}, ['wxART_NEW'] = IconStack{Unix = {{type = 'system', name = 'list-add'}, {type = 'system', name = 'wxART_NEW'}}, Windows = {{type = 'bitmap', file = 'add?.png'}}, Mac = {{type = 'bitmap', file = 'add?.png'}}}, ['wxART_DELETE'] = IconStack{Unix = {{type = 'system', name = 'list-remove'}, {type = 'system', name = 'wxART_DELETE'}}, Windows = {{type = 'bitmap', file = 'remove?.png'}}, Mac = {{type = 'system', name = 'wxART_DELETE'}}}, ['wxART_FIND'] = IconStack{Unix = {{type = 'system', name = 'wxART_FIND'}}, Windows = {{type = 'system', name = 'wxART_FIND'}}, Mac = {{type = 'bitmap', file = 'search?.png'}}}, ['wxART_ERROR'] = IconStack{Unix = {{type = 'system', name = 'wxART_ERROR'}}, Windows = {{type = 'system', name = 'wxART_ERROR'}}, Mac = {{type = 'system', name = 'wxART_ERROR'}}}, ['wxART_WARNING'] = IconStack{Unix = {{type = 'system', name = 'wxART_WARNING'}}, Windows = {{type = 'system', name = 'wxART_WARNING'}}, Mac = {{type = 'system', name = 'wxART_WARNING'}}}, ['wxART_MISSING_IMAGE'] = IconStack{Unix = {{type = 'system', name = 'wxART_MISSING_IMAGE'}}, Windows = {{type = 'bitmap', file = 'remove?.png'}}, Mac = {{type = 'bitmap', file = 'remove?.png'}}} } function ArtProvider:DoGetSizeHint( client ) if IgnoreCallbacks then return wx.NULL end print('ArtProvider:DoGetSizeHint', client) return self.GetSizeHint(client, true) end function ArtProvider:CreateBitmap( id, client, size ) if IgnoreCallbacks then return wx.NULL end IgnoreCallbacks = true local iconStack = IconStacks[id] local result if iconStack then for _, iconSource in ipairs(iconStack) do if iconSource.type == 'system' then result = wx.wxArtProvider.GetBitmap(iconSource.name, client, size) elseif iconSource.type == 'bitmap' then if not iconSource.file then print(id) end local size = wx.wxArtProvider.GetSizeHint(client, true) local baseName = iconSource.file:gsub('%?', size:GetWidth()) local fileName = fs.here(path.join('icons', baseName)) result = wx.wxBitmap(fileName) else error(id..': Unknown icon source '..iconSource.type..'.') end if result:Ok() then break end end end if not result or not result:Ok() then result = wx.wxArtProvider.GetBitmap('wxART_ERROR', client, size) if not iconStack then print(id..': No item stack found.') else print(id..': Stack found, but no icon available.') end end IgnoreCallbacks = false return result end return ArtProvider
mit
unigent/openwrt-3.10.14
package/ramips/ui/luci-mtk/src/protocols/ppp/luasrc/model/cbi/admin_network/proto_l2tp.lua
59
1868
--[[ LuCI - Lua Configuration Interface Copyright 2011 Jo-Philipp Wich <xm@subsignal.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 ]]-- local map, section, net = ... local server, username, password local ipv6, defaultroute, metric, peerdns, dns, mtu server = section:taboption("general", Value, "server", translate("L2TP Server")) server.datatype = "host" username = section:taboption("general", Value, "username", translate("PAP/CHAP username")) password = section:taboption("general", Value, "password", translate("PAP/CHAP password")) password.password = true if luci.model.network:has_ipv6() then ipv6 = section:taboption("advanced", Flag, "ipv6", translate("Enable IPv6 negotiation on the PPP link")) ipv6.default = ipv6.disabled end defaultroute = section:taboption("advanced", Flag, "defaultroute", translate("Use default gateway"), translate("If unchecked, no default route is configured")) defaultroute.default = defaultroute.enabled metric = section:taboption("advanced", Value, "metric", translate("Use gateway metric")) metric.placeholder = "0" metric.datatype = "uinteger" metric:depends("defaultroute", defaultroute.enabled) peerdns = section:taboption("advanced", Flag, "peerdns", translate("Use DNS servers advertised by peer"), translate("If unchecked, the advertised DNS server addresses are ignored")) peerdns.default = peerdns.enabled dns = section:taboption("advanced", DynamicList, "dns", translate("Use custom DNS servers")) dns:depends("peerdns", "") dns.datatype = "ipaddr" dns.cast = "string" mtu = section:taboption("advanced", Value, "mtu", translate("Override MTU")) mtu.placeholder = "1500" mtu.datatype = "max(9200)"
gpl-2.0
skwerlman/ccsquish
vio/vio.lua
3
1401
local vio = {}; vio.__index = vio; function vio.open(string) return setmetatable({ pos = 1, data = string }, vio); end function vio:read(format, ...) if self.pos >= #self.data then return; end if format == "*a" then local oldpos = self.pos; self.pos = #self.data; return self.data:sub(oldpos, self.pos); elseif format == "*l" then local data; data, self.pos = self.data:match("([^\r\n]*)\r?\n?()", self.pos) return data; elseif format == "*n" then local data; data, self.pos = self.data:match("(%d+)()", self.pos) return tonumber(data); elseif type(format) == "number" then local oldpos = self.pos; self.pos = self.pos + format; return self.data:sub(oldpos, self.pos-1); end end function vio:seek(whence, offset) if type(whence) == "number" then whence, offset = "cur", whence; end offset = offset or 0; if whence == "cur" then self.pos = self.pos + offset; elseif whence == "set" then self.pos = offset + 1; elseif whence == "end" then self.pos = #self.data - offset; end return self.pos; end local function _readline(f) return f:read("*l"); end function vio:lines() return _readline, self; end function vio:write(...) for i=1,select('#', ...) do local dat = tostring(select(i, ...)); self.data = self.data:sub(1, self.pos-1)..dat..self.data:sub(self.pos+#dat, -1); end end function vio:close() self.pos, self.data = nil, nil; end
mit
hooksta4/darkstar
scripts/zones/zones/RuLude_Gardens/npcs/Tillecoe.lua
38
1037
----------------------------------- -- Area: Ru'Lude Gardens -- NPC: Tillecoe -- Type: Standard NPC -- @zone: 243 -- @pos 38.528 -0.997 -6.363 -- -- Auto-Script: Requires Verification (Verfied by Brawndo) ----------------------------------- package.loaded["scripts/zones/RuLude_Gardens/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0046); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/mobskills/Sand_Blast.lua
4
1244
--------------------------------------------------- -- Sand Blast -- Deals Earth damage to targets in a fan-shaped area of effect. Additional effect: Blind -- Range: 8' cone --------------------------------------------------- require("/scripts/globals/settings"); require("/scripts/globals/status"); require("/scripts/globals/monstertpmoves"); --------------------------------------------------- function onMobSkillCheck(target,mob,skill) if (mob:getID()==16806242) then -- Feeler Anltion if (mob:getLocalVar("SAND_BLAST")==1 and math.random(1,99)>80) then -- spawn shit else return 1; end end; return 0; end; function onMobWeaponSkill(target, mob, skill) local typeEffect = EFFECT_BLINDNESS; skill:setMsg(MobStatusEffectMove(mob, target, typeEffect, 20, 0, 120)); if (mob:getID()==16806242) then -- Feeler Anltion mob:setLocalVar("SAND_BLAST",0); -- Used it for the last time! if (GetMobAction(16806248) == 0) then -- Alastor Antlion local alastorAntlion = GetMobByID(16806248); alastorAntlion:setSpawn(mob:getXPos()+1,mob:getYPos()+1,mob:getZPos()+1); -- Set its spawn location. SpawnMob(16806248, 120):updateEnmity(target); end end return typeEffect; end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Promyvion-Vahzl/npcs/_0m0.lua
2
1352
----------------------------------- -- Area: Promyvion vahzl -- NPC: Memory flux (3) ----------------------------------- package.loaded["scripts/zones/Promyvion-Vahzl/TextIDs"] = nil; ----------------------------------- require("scripts/globals/missions"); require("scripts/zones/Promyvion-Vahzl/TextIDs"); require("scripts/globals/keyitems"); ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) if (player:getCurrentMission(COP) == DESIRES_OF_EMPTINESS and player:getVar("PromathiaStatus")==5) then SpawnMob(16867329,240):updateClaim(player); elseif (player:getCurrentMission(COP) == DESIRES_OF_EMPTINESS and player:getVar("PromathiaStatus")==6) then player:startEvent(0x0035); else player:messageSpecial(OVERFLOWING_MEMORIES); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) if (csid == 0x0035) then player:setVar("PromathiaStatus",7); end end;
gpl-3.0
Hax0rs-Game-Off/game-off-2016
src/util/resources.lua
2
1043
-- resources require("util/helper") Resources = class("Resources") function Resources:__init(prefix) self.prefix = prefix self.imageQueue = {} self.musicQueue = {} self.fontQueue = {} self.images = {} self.music = {} self.fonts = {} end function Resources:addFont(name, src, size) self.fontQueue[name] = {src, size} end function Resources:addImage(name, src) self.imageQueue[name] = src end function Resources:addMusic(name, src) self.musicQueue[name] = src end function Resources:load(threaded) for name, pair in pairs(self.fontQueue) do self.fonts[name] = love.graphics.newFont(self.prefix .. pair[1], pair[2]) self.fontQueue[name] = nil end for name, src in pairs(self.imageQueue) do self.images[name] = love.graphics.newImage(self.prefix .. src) self.imageQueue[name] = nil end for name, src in pairs(self.musicQueue) do self.music[name] = love.audio.newSource(self.prefix .. src) self.musicQueue[name] = nil end end
gpl-3.0
warrenseine/premake
src/base/globals.lua
2
3282
-- -- globals.lua -- Replacements and extensions to Lua's global functions. -- Copyright (c) 2002-2013 Jason Perkins and the Premake project -- -- -- Helper for the dofile() and include() function: locate a script on the -- standard search paths of: the /scripts argument provided on the command -- line, then the PREMAKE_PATH environment variable. -- -- @param ... -- A list of file names for which to search. The first one discovered -- is the one that will be returned. -- @return -- The path to file if found, or nil if not. -- local function locate(...) for i = 1, select("#",...) do local fname = select(i,...) -- is this a direct path to a file? if os.isfile(fname) then return fname end -- find it on my paths local dir = os.pathsearch(fname, _OPTIONS["scripts"], os.getenv("PREMAKE_PATH")) if dir then return path.join(dir, fname) end end end -- -- A replacement for Lua's built-in dofile() function, this one sets the -- current working directory to the script's location, enabling script-relative -- referencing of other files and resources. -- local builtin_dofile = dofile function dofile(fname) -- remember the current working directory and file; I'll restore it shortly local oldcwd = os.getcwd() local oldfile = _SCRIPT -- find it; if I can't just continue with the name and let the -- built-in dofile() handle reporting the error as it will fname = locate(fname) or fname -- use the absolute path to the script file, to avoid any file name -- ambiguity if an error should arise _SCRIPT = path.getabsolute(fname) -- switch the working directory to the new script location local newcwd = path.getdirectory(_SCRIPT) os.chdir(newcwd) -- run the chunk. How can I catch variable return values? local a, b, c, d, e, f = builtin_dofile(_SCRIPT) -- restore the previous working directory when done _SCRIPT = oldfile os.chdir(oldcwd) return a, b, c, d, e, f end -- -- Find and execute a Lua source file present on the filesystem, but -- continue without error if the file is not present. This is used to -- handle optional files such as the premake-system.lua script. -- -- @param fname -- The name of the file to load. This may be specified as a single -- file path or an array of file paths, in which case the first -- file found is run. -- @return -- True if a file was found and executed, nil otherwise. -- function dofileopt(fname) if type(fname) == "string" then fname = {fname} end for i = 1, #fname do local found = locate(fname[i]) if found then dofile(found) return true end end end -- -- Load and run an external script file, with a bit of extra logic to make -- including projects easier. if "path" is a directory, will look for -- path/premake5.lua. And each file is tracked, and loaded only once. -- io._includedFiles = {} function include(fname) local found = locate(fname) if not found then found = locate(path.join(fname, "premake5.lua")) end if not found then found = locate(path.join(fname, "premake4.lua")) end -- but only load each file once fname = path.getabsolute(found or fname) if not io._includedFiles[fname] then io._includedFiles[fname] = true dofile(fname) end end
bsd-3-clause
gedadsbranch/Darkstar-Mission
scripts/zones/Tavnazian_Safehold/npcs/Meret.lua
19
5479
----------------------------------- -- Area: Tavnazian Safehold -- NPC: Meret -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Tavnazian_Safehold/TextIDs"] = nil; require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/zones/Tavnazian_Safehold/TextIDs"); --Meret 24A 586 recompense local Sin_of_Indulgence=1915; local FUTSUNO_MITAMA=17810; local Sin_of_Indolence=1914; local AUREOLE=18245; local Sin_of_Invidiousness=1916; local RAPHAEL_ROD=18398; local Sin_of_Indignation=1913; local NINURTA_SASH=15458; local Sin_of_Insolence=1917; local MARS_RING=15548; local Sin_of_Infatuation=1918; local BELLONA_RING=15549; local Sin_of_Intemperance=1919; local MINERVA_RING =15550; local Aura_of_Adulation=1911; local NOVIO_EARRING=14808; local Aura_of_Voracity=1912; local NOVIA_EARRING =14809; local Vice_of_Antipathy=1901; local MERCIFUL_CAPE=15471; local Vice_of_Avarice=1902; local ALTRUISTIC_CAPE=15472; local Vice_of_Aspersion=1903; local ASTUTE_CAPE=15473; -------------------------------------- local AERN_ORGAN=1786; local EUVHI_ORGAN=1818; local HPEMDE_ORGAN=1787; local PHUABO_ORGAN=1784; local XZOMIT_ORGAN=1785; local YOVRA_ORGAN=1788; local LUMINON_Chip=1819; local LUMINIAN_Tissue=1783; local VIRTUE_STONE_POUCH=5410; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local reward = 0; local item = 0; local NameOfScience = player:getQuestStatus(OTHER_AREAS,IN_THE_NAME_OF_SCIENCE); if(NameOfScience == QUEST_COMPLETED and trade:getItemCount()==1)then if(trade:hasItemQty(Sin_of_Indulgence,1))then item = Sin_of_Indulgence; reward = FUTSUNO_MITAMA; elseif(trade:hasItemQty(Sin_of_Indolence,1))then item = Sin_of_Indolence; reward = AUREOLE; elseif(trade:hasItemQty(Sin_of_Invidiousness,1))then item = Sin_of_Invidiousness;reward = RAPHAEL_ROD; elseif(trade:hasItemQty(Sin_of_Indignation,1))then item = Sin_of_Indignation;reward = NINURTA_SASH; elseif(trade:hasItemQty(Sin_of_Insolence,1))then item = Sin_of_Insolence;reward = MARS_RING; elseif(trade:hasItemQty(Sin_of_Infatuation,1))then item = Sin_of_Infatuation; reward = BELLONA_RING; elseif(trade:hasItemQty(Sin_of_Intemperance,1))then item = Sin_of_Intemperance; reward = MINERVA_RING; elseif(trade:hasItemQty(Aura_of_Adulation,1))then item = Aura_of_Adulation;reward = NOVIO_EARRING; elseif(trade:hasItemQty(Aura_of_Voracity,1))then item = Aura_of_Voracity;reward = NOVIA_EARRING; elseif(trade:hasItemQty(Vice_of_Antipathy,1))then item = Vice_of_Antipathy;reward = MERCIFUL_CAPE; elseif(trade:hasItemQty(Vice_of_Avarice,1))then item = Vice_of_Avarice;reward = ALTRUISTIC_CAPE; elseif(trade:hasItemQty(Vice_of_Aspersion,1))then item = Vice_of_Aspersio;reward = ASTUTE_CAPE; -------------------------------------- elseif(trade:hasItemQty(AERN_ORGAN,1))then item =AERN_ORGAN; reward = VIRTUE_STONE_POUCH; elseif(trade:hasItemQty(EUVHI_ORGAN,1))then item =EUVHI_ORGAN; reward = VIRTUE_STONE_POUCH; elseif(trade:hasItemQty(HPEMDE_ORGAN,1))then item =HPEMDE_ORGAN; reward = VIRTUE_STONE_POUCH; elseif(trade:hasItemQty(PHUABO_ORGAN,1))then item =PHUABO_ORGAN; reward = VIRTUE_STONE_POUCH; elseif(trade:hasItemQty(XZOMIT_ORGAN,1))then item =XZOMIT_ORGAN; reward = VIRTUE_STONE_POUCH; elseif( trade:hasItemQty(YOVRA_ORGAN,1))then item =YOVRA_ORGAN; reward = VIRTUE_STONE_POUCH; elseif(trade:hasItemQty(LUMINON_Chip,1))then item =LUMINON_Chip; reward = VIRTUE_STONE_POUCH; elseif(trade:hasItemQty(LUMINIAN_Tissue,1))then item =LUMINIAN_Tissue; reward = VIRTUE_STONE_POUCH; end if (reward > 0)then player:startEvent(0x024A,item,reward); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local NameOfScience = player:getQuestStatus(OTHER_AREAS,IN_THE_NAME_OF_SCIENCE); local rnd= math.random(); if(player:hasKeyItem(LIGHT_OF_ALTAIEU))then if(NameOfScience == QUEST_COMPLETED)then if(rnd < 0.5)then player:startEvent(0x0246); else player:startEvent(0x0247); end else player:startEvent(0x0249); end else player:startEvent(0x0248); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if(csid == 0x024A)then if (player:getFreeSlotsCount()==0 or (option ~= VIRTUE_STONE_POUCH and player:hasItem(option)==true))then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,option); else player:tradeComplete(); player:addItem(option); player:messageSpecial(ITEM_OBTAINED,option); -- Item end end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Aht_Urhgan_Whitegate/npcs/Sharin-Garin.lua
19
1899
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Sharin-Garin -- Type: Adventurer's Assistant -- @pos 122.658 -1.315 33.001 50 ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/globals/besieged"); require("scripts/globals/keyitems"); require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local runicpass = 0; if (player:hasKeyItem(RUNIC_PORTAL_USE_PERMIT)) then runicpass = 1; end local cost = 200 -- 200 IS to get a permit if (getMercenaryRank(player) == 11) then captain = 1; else captain = 0; end; local merc = 2 -- Probably could be done, but not really important atm player:startEvent(0x008C,0,merc,runicpass,player:getCurrency("imperial_standing"),getAstralCandescence(),cost,captain); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x008C and option == 1) then player:addKeyItem(RUNIC_PORTAL_USE_PERMIT); player:messageSpecial(KEYITEM_OBTAINED,RUNIC_PORTAL_USE_PERMIT); player:delCurrency("imperial_standing", 200); elseif (csid == 0x008C and option == 2) then player:addKeyItem(RUNIC_PORTAL_USE_PERMIT); player:messageSpecial(KEYITEM_OBTAINED,RUNIC_PORTAL_USE_PERMIT); end end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/FeiYin/Zone.lua
10
3499
----------------------------------- -- -- Zone: FeiYin (204) -- ----------------------------------- package.loaded["scripts/zones/FeiYin/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/globals/missions"); require("scripts/globals/zone"); require("scripts/zones/FeiYin/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) local tomes = {17613260,17613261}; SetGroundsTome(tomes); -- Capricious Cassie SetRespawnTime(17613130, 900, 10800); UpdateTreasureSpawnPoint(17613235); end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local pNation = player:getNation(); local currentMission = player:getCurrentMission(pNation); local MissionStatus = player:getVar("MissionStatus"); local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos(99.98,-1.768,275.993,70); end if (player:getVar("peaceForTheSpiritCS") == 1 and player:hasItem(1093) == false) then -- Antique Coin SpawnMob(17612849); -- RDM AF end if (prevZone == 111 and currentMission == 14 and MissionStatus == 10) then cs = 0x0001; -- MISSION 5-1 elseif (currentMission == THE_HEIR_TO_THE_LIGHT and MissionStatus == 2)then cs = 0x0017; -- San d'Oria 9-2 elseif (player:getCurrentMission(ACP) == THOSE_WHO_LURK_IN_SHADOWS_I) then cs = 0x001D; elseif (prevZone == 206 and player:getQuestStatus(BASTOK,THE_FIRST_MEETING) == QUEST_ACCEPTED and player:hasKeyItem(LETTER_FROM_DALZAKK) == false) then cs = 0x0010; -- MNK AF elseif (prevZone == 111 and player:getQuestStatus(SANDORIA,PIEUJE_S_DECISION) == QUEST_ACCEPTED and player:getVar("pieujesDecisionCS") == 0) then cs = 0x0013; -- WHM AF player:setVar("pieujesDecisionCS",1); end return cs; end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x0001) then player:setVar("MissionStatus",11); elseif (csid == 0x0010) then player:addKeyItem(LETTER_FROM_DALZAKK); player:messageSpecial(KEYITEM_OBTAINED,LETTER_FROM_DALZAKK); elseif (csid == 0x0017) then player:setVar("MissionStatus",3); elseif (csid == 0x001D) then player:completeMission(ACP,THOSE_WHO_LURK_IN_SHADOWS_I); player:addMission(ACP,THOSE_WHO_LURK_IN_SHADOWS_II); end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Bhaflau_Thickets/mobs/Sea_Puk.lua
25
1222
----------------------------------- -- Area: Bhaflau Thickets -- MOB: Sea Puk -- Note: Place holder Nis Puk ----------------------------------- require("scripts/zones/Bhaflau_Thickets/MobIDs"); ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob,killer) -- Get Sea Puk ID and check if it is a PH of NP mob = mob:getID(); -- Check if Sea Puk is within the Nis_Puk_PH table if (Nis_Puk_PH[mob] ~= nil) then -- printf("%u is a PH",mob); -- Get NP's previous ToD NP_ToD = GetServerVariable("[POP]Nis_Puk"); -- Check if NP window is open, and there is not an NP popped already(ACTION_NONE = 0) if (NP_ToD <= os.time(t) and GetMobAction(Nis_Puk) == 0) then -- printf("NP window open"); -- Give Sea Puk 5 percent chance to pop NP if (math.random(1,20) >= 1) then -- printf("NP will pop"); UpdateNMSpawnPoint(Nis_Puk); GetMobByID(Nis_Puk):setRespawnTime(GetMobRespawnTime(mob)); SetServerVariable("[PH]Nis_Puk", mob); DeterMob(mob, true); end end end end;
gpl-3.0
Hostle/openwrt-luci-multi-user
modules/luci-base/luasrc/model/network.lua
8
33786
-- Copyright 2009-2015 Jo-Philipp Wich <jow@openwrt.org> -- Licensed to the public under the Apache License 2.0. local type, next, pairs, ipairs, loadfile, table = type, next, pairs, ipairs, loadfile, table local tonumber, tostring, math = tonumber, tostring, math local require = require local nxo = require "nixio" local nfs = require "nixio.fs" local ipc = require "luci.ip" local sys = require "luci.sys" local utl = require "luci.util" local dsp = require "luci.dispatcher" local uci = require "luci.model.uci" local lng = require "luci.i18n" module "luci.model.network" IFACE_PATTERNS_VIRTUAL = { } IFACE_PATTERNS_IGNORE = { "^wmaster%d", "^wifi%d", "^hwsim%d", "^imq%d", "^ifb%d", "^mon%.wlan%d", "^sit%d", "^gre%d", "^lo$" } IFACE_PATTERNS_WIRELESS = { "^wlan%d", "^wl%d", "^ath%d", "^%w+%.network%d" } protocol = utl.class() local _protocols = { } local _interfaces, _bridge, _switch, _tunnel local _ubusnetcache, _ubusdevcache, _ubuswificache local _uci_real, _uci_state function _filter(c, s, o, r) local val = _uci_real:get(c, s, o) if val then local l = { } if type(val) == "string" then for val in val:gmatch("%S+") do if val ~= r then l[#l+1] = val end end if #l > 0 then _uci_real:set(c, s, o, table.concat(l, " ")) else _uci_real:delete(c, s, o) end elseif type(val) == "table" then for _, val in ipairs(val) do if val ~= r then l[#l+1] = val end end if #l > 0 then _uci_real:set(c, s, o, l) else _uci_real:delete(c, s, o) end end end end function _append(c, s, o, a) local val = _uci_real:get(c, s, o) or "" if type(val) == "string" then local l = { } for val in val:gmatch("%S+") do if val ~= a then l[#l+1] = val end end l[#l+1] = a _uci_real:set(c, s, o, table.concat(l, " ")) elseif type(val) == "table" then local l = { } for _, val in ipairs(val) do if val ~= a then l[#l+1] = val end end l[#l+1] = a _uci_real:set(c, s, o, l) end end function _stror(s1, s2) if not s1 or #s1 == 0 then return s2 and #s2 > 0 and s2 else return s1 end end function _get(c, s, o) return _uci_real:get(c, s, o) end function _set(c, s, o, v) if v ~= nil then if type(v) == "boolean" then v = v and "1" or "0" end return _uci_real:set(c, s, o, v) else return _uci_real:delete(c, s, o) end end function _wifi_iface(x) local _, p for _, p in ipairs(IFACE_PATTERNS_WIRELESS) do if x:match(p) then return true end end return false end function _wifi_state(key, val, field) local radio, radiostate, ifc, ifcstate if not next(_ubuswificache) then _ubuswificache = utl.ubus("network.wireless", "status", {}) or {} -- workaround extended section format for radio, radiostate in pairs(_ubuswificache) do for ifc, ifcstate in pairs(radiostate.interfaces) do if ifcstate.section and ifcstate.section:sub(1, 1) == '@' then local s = _uci_real:get_all('wireless.%s' % ifcstate.section) if s then ifcstate.section = s['.name'] end end end end end for radio, radiostate in pairs(_ubuswificache) do for ifc, ifcstate in pairs(radiostate.interfaces) do if ifcstate[key] == val then return ifcstate[field] end end end end function _wifi_lookup(ifn) -- got a radio#.network# pseudo iface, locate the corresponding section local radio, ifnidx = ifn:match("^(%w+)%.network(%d+)$") if radio and ifnidx then local sid = nil local num = 0 ifnidx = tonumber(ifnidx) _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device == radio then num = num + 1 if num == ifnidx then sid = s['.name'] return false end end end) return sid -- looks like wifi, try to locate the section via state vars elseif _wifi_iface(ifn) then local sid = _wifi_state("ifname", ifn, "section") if not sid then _uci_state:foreach("wireless", "wifi-iface", function(s) if s.ifname == ifn then sid = s['.name'] return false end end) end return sid end end function _iface_virtual(x) local _, p for _, p in ipairs(IFACE_PATTERNS_VIRTUAL) do if x:match(p) then return true end end return false end function _iface_ignore(x) local _, p for _, p in ipairs(IFACE_PATTERNS_IGNORE) do if x:match(p) then return true end end return _iface_virtual(x) end function init(cursor) _uci_real = cursor or _uci_real or uci.cursor() _uci_state = _uci_real:substate() _interfaces = { } _bridge = { } _switch = { } _tunnel = { } _ubusnetcache = { } _ubusdevcache = { } _ubuswificache = { } -- read interface information local n, i for n, i in ipairs(nxo.getifaddrs()) do local name = i.name:match("[^:]+") local prnt = name:match("^([^%.]+)%.") if _iface_virtual(name) then _tunnel[name] = true end if _tunnel[name] or not _iface_ignore(name) then _interfaces[name] = _interfaces[name] or { idx = i.ifindex or n, name = name, rawname = i.name, flags = { }, ipaddrs = { }, ip6addrs = { } } if prnt then _switch[name] = true _switch[prnt] = true end if i.family == "packet" then _interfaces[name].flags = i.flags _interfaces[name].stats = i.data _interfaces[name].macaddr = i.addr elseif i.family == "inet" then _interfaces[name].ipaddrs[#_interfaces[name].ipaddrs+1] = ipc.IPv4(i.addr, i.netmask) elseif i.family == "inet6" then _interfaces[name].ip6addrs[#_interfaces[name].ip6addrs+1] = ipc.IPv6(i.addr, i.netmask) end end end -- read bridge informaton local b, l for l in utl.execi("brctl show") do if not l:match("STP") then local r = utl.split(l, "%s+", nil, true) if #r == 4 then b = { name = r[1], id = r[2], stp = r[3] == "yes", ifnames = { _interfaces[r[4]] } } if b.ifnames[1] then b.ifnames[1].bridge = b end _bridge[r[1]] = b elseif b then b.ifnames[#b.ifnames+1] = _interfaces[r[2]] b.ifnames[#b.ifnames].bridge = b end end end return _M end function save(self, ...) _uci_real:save(...) _uci_real:load(...) end function commit(self, ...) _uci_real:commit(...) _uci_real:load(...) end function ifnameof(self, x) if utl.instanceof(x, interface) then return x:name() elseif utl.instanceof(x, protocol) then return x:ifname() elseif type(x) == "string" then return x:match("^[^:]+") end end function get_protocol(self, protoname, netname) local v = _protocols[protoname] if v then return v(netname or "__dummy__") end end function get_protocols(self) local p = { } local _, v for _, v in ipairs(_protocols) do p[#p+1] = v("__dummy__") end return p end function register_protocol(self, protoname) local proto = utl.class(protocol) function proto.__init__(self, name) self.sid = name end function proto.proto(self) return protoname end _protocols[#_protocols+1] = proto _protocols[protoname] = proto return proto end function register_pattern_virtual(self, pat) IFACE_PATTERNS_VIRTUAL[#IFACE_PATTERNS_VIRTUAL+1] = pat end function has_ipv6(self) return nfs.access("/proc/net/ipv6_route") end function add_network(self, n, options) local oldnet = self:get_network(n) if n and #n > 0 and n:match("^[a-zA-Z0-9_]+$") and not oldnet then if _uci_real:section("network", "interface", n, options) then return network(n) end elseif oldnet and oldnet:is_empty() then if options then local k, v for k, v in pairs(options) do oldnet:set(k, v) end end return oldnet end end function get_network(self, n) if n and _uci_real:get("network", n) == "interface" then return network(n) end end function get_networks(self) local nets = { } local nls = { } _uci_real:foreach("network", "interface", function(s) nls[s['.name']] = network(s['.name']) end) local n for n in utl.kspairs(nls) do nets[#nets+1] = nls[n] end return nets end function del_network(self, n) local r = _uci_real:delete("network", n) if r then _uci_real:delete_all("network", "alias", function(s) return (s.interface == n) end) _uci_real:delete_all("network", "route", function(s) return (s.interface == n) end) _uci_real:delete_all("network", "route6", function(s) return (s.interface == n) end) _uci_real:foreach("wireless", "wifi-iface", function(s) local net local rest = { } for net in utl.imatch(s.network) do if net ~= n then rest[#rest+1] = net end end if #rest > 0 then _uci_real:set("wireless", s['.name'], "network", table.concat(rest, " ")) else _uci_real:delete("wireless", s['.name'], "network") end end) end return r end function rename_network(self, old, new) local r if new and #new > 0 and new:match("^[a-zA-Z0-9_]+$") and not self:get_network(new) then r = _uci_real:section("network", "interface", new, _uci_real:get_all("network", old)) if r then _uci_real:foreach("network", "alias", function(s) if s.interface == old then _uci_real:set("network", s['.name'], "interface", new) end end) _uci_real:foreach("network", "route", function(s) if s.interface == old then _uci_real:set("network", s['.name'], "interface", new) end end) _uci_real:foreach("network", "route6", function(s) if s.interface == old then _uci_real:set("network", s['.name'], "interface", new) end end) _uci_real:foreach("wireless", "wifi-iface", function(s) local net local list = { } for net in utl.imatch(s.network) do if net == old then list[#list+1] = new else list[#list+1] = net end end if #list > 0 then _uci_real:set("wireless", s['.name'], "network", table.concat(list, " ")) end end) _uci_real:delete("network", old) end end return r or false end function get_interface(self, i) if _interfaces[i] or _wifi_iface(i) then return interface(i) else local ifc local num = { } _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device then num[s.device] = num[s.device] and num[s.device] + 1 or 1 if s['.name'] == i then ifc = interface( "%s.network%d" %{s.device, num[s.device] }) return false end end end) return ifc end end function get_interfaces(self) local iface local ifaces = { } local seen = { } local nfs = { } local baseof = { } -- find normal interfaces _uci_real:foreach("network", "interface", function(s) for iface in utl.imatch(s.ifname) do if not _iface_ignore(iface) and not _wifi_iface(iface) then seen[iface] = true nfs[iface] = interface(iface) end end end) for iface in utl.kspairs(_interfaces) do if not (seen[iface] or _iface_ignore(iface) or _wifi_iface(iface)) then nfs[iface] = interface(iface) end end -- find vlan interfaces _uci_real:foreach("network", "switch_vlan", function(s) if not s.device then return end local base = baseof[s.device] if not base then if not s.device:match("^eth%d") then local l for l in utl.execi("swconfig dev %q help 2>/dev/null" % s.device) do if not base then base = l:match("^%w+: (%w+)") end end if not base or not base:match("^eth%d") then base = "eth0" end else base = s.device end baseof[s.device] = base end local vid = tonumber(s.vid or s.vlan) if vid ~= nil and vid >= 0 and vid <= 4095 then local iface = "%s.%d" %{ base, vid } if not seen[iface] then seen[iface] = true nfs[iface] = interface(iface) end end end) for iface in utl.kspairs(nfs) do ifaces[#ifaces+1] = nfs[iface] end -- find wifi interfaces local num = { } local wfs = { } _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device then num[s.device] = num[s.device] and num[s.device] + 1 or 1 local i = "%s.network%d" %{ s.device, num[s.device] } wfs[i] = interface(i) end end) for iface in utl.kspairs(wfs) do ifaces[#ifaces+1] = wfs[iface] end return ifaces end function ignore_interface(self, x) return _iface_ignore(x) end function get_wifidev(self, dev) if _uci_real:get("wireless", dev) == "wifi-device" then return wifidev(dev) end end function get_wifidevs(self) local devs = { } local wfd = { } _uci_real:foreach("wireless", "wifi-device", function(s) wfd[#wfd+1] = s['.name'] end) local dev for _, dev in utl.vspairs(wfd) do devs[#devs+1] = wifidev(dev) end return devs end function get_wifinet(self, net) local wnet = _wifi_lookup(net) if wnet then return wifinet(wnet) end end function add_wifinet(self, net, options) if type(options) == "table" and options.device and _uci_real:get("wireless", options.device) == "wifi-device" then local wnet = _uci_real:section("wireless", "wifi-iface", nil, options) return wifinet(wnet) end end function del_wifinet(self, net) local wnet = _wifi_lookup(net) if wnet then _uci_real:delete("wireless", wnet) return true end return false end function get_status_by_route(self, addr, mask) local _, object for _, object in ipairs(utl.ubus()) do local net = object:match("^network%.interface%.(.+)") if net then local s = utl.ubus(object, "status", {}) if s and s.route then local rt for _, rt in ipairs(s.route) do if not rt.table and rt.target == addr and rt.mask == mask then return net, s end end end end end end function get_status_by_address(self, addr) local _, object for _, object in ipairs(utl.ubus()) do local net = object:match("^network%.interface%.(.+)") if net then local s = utl.ubus(object, "status", {}) if s and s['ipv4-address'] then local a for _, a in ipairs(s['ipv4-address']) do if a.address == addr then return net, s end end end if s and s['ipv6-address'] then local a for _, a in ipairs(s['ipv6-address']) do if a.address == addr then return net, s end end end end end end function get_wannet(self) local net = self:get_status_by_route("0.0.0.0", 0) return net and network(net) end function get_wandev(self) local _, stat = self:get_status_by_route("0.0.0.0", 0) return stat and interface(stat.l3_device or stat.device) end function get_wan6net(self) local net = self:get_status_by_route("::", 0) return net and network(net) end function get_wan6dev(self) local _, stat = self:get_status_by_route("::", 0) return stat and interface(stat.l3_device or stat.device) end function network(name, proto) if name then local p = proto or _uci_real:get("network", name, "proto") local c = p and _protocols[p] or protocol return c(name) end end function protocol.__init__(self, name) self.sid = name end function protocol._get(self, opt) local v = _uci_real:get("network", self.sid, opt) if type(v) == "table" then return table.concat(v, " ") end return v or "" end function protocol._ubus(self, field) if not _ubusnetcache[self.sid] then _ubusnetcache[self.sid] = utl.ubus("network.interface.%s" % self.sid, "status", { }) end if _ubusnetcache[self.sid] and field then return _ubusnetcache[self.sid][field] end return _ubusnetcache[self.sid] end function protocol.get(self, opt) return _get("network", self.sid, opt) end function protocol.set(self, opt, val) return _set("network", self.sid, opt, val) end function protocol.ifname(self) local ifname if self:is_floating() then ifname = self:_ubus("l3_device") else ifname = self:_ubus("device") end if not ifname then local num = { } _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device then num[s.device] = num[s.device] and num[s.device] + 1 or 1 local net for net in utl.imatch(s.network) do if net == self.sid then ifname = "%s.network%d" %{ s.device, num[s.device] } return false end end end end) end return ifname end function protocol.proto(self) return "none" end function protocol.get_i18n(self) local p = self:proto() if p == "none" then return lng.translate("Unmanaged") elseif p == "static" then return lng.translate("Static address") elseif p == "dhcp" then return lng.translate("DHCP client") else return lng.translate("Unknown") end end function protocol.type(self) return self:_get("type") end function protocol.name(self) return self.sid end function protocol.uptime(self) return self:_ubus("uptime") or 0 end function protocol.expires(self) local a = tonumber(_uci_state:get("network", self.sid, "lease_acquired")) local l = tonumber(_uci_state:get("network", self.sid, "lease_lifetime")) if a and l then l = l - (nxo.sysinfo().uptime - a) return l > 0 and l or 0 end return -1 end function protocol.metric(self) return tonumber(_uci_state:get("network", self.sid, "metric")) or 0 end function protocol.ipaddr(self) local addrs = self:_ubus("ipv4-address") return addrs and #addrs > 0 and addrs[1].address end function protocol.netmask(self) local addrs = self:_ubus("ipv4-address") return addrs and #addrs > 0 and ipc.IPv4("0.0.0.0/%d" % addrs[1].mask):mask():string() end function protocol.gwaddr(self) local _, route for _, route in ipairs(self:_ubus("route") or { }) do if route.target == "0.0.0.0" and route.mask == 0 then return route.nexthop end end end function protocol.dnsaddrs(self) local dns = { } local _, addr for _, addr in ipairs(self:_ubus("dns-server") or { }) do if not addr:match(":") then dns[#dns+1] = addr end end return dns end function protocol.ip6addr(self) local addrs = self:_ubus("ipv6-address") if addrs and #addrs > 0 then return "%s/%d" %{ addrs[1].address, addrs[1].mask } else addrs = self:_ubus("ipv6-prefix-assignment") if addrs and #addrs > 0 then return "%s/%d" %{ addrs[1].address, addrs[1].mask } end end end function protocol.gw6addr(self) local _, route for _, route in ipairs(self:_ubus("route") or { }) do if route.target == "::" and route.mask == 0 then return ipc.IPv6(route.nexthop):string() end end end function protocol.dns6addrs(self) local dns = { } local _, addr for _, addr in ipairs(self:_ubus("dns-server") or { }) do if addr:match(":") then dns[#dns+1] = addr end end return dns end function protocol.is_bridge(self) return (not self:is_virtual() and self:type() == "bridge") end function protocol.opkg_package(self) return nil end function protocol.is_installed(self) return true end function protocol.is_virtual(self) return false end function protocol.is_floating(self) return false end function protocol.is_empty(self) if self:is_floating() then return false else local rv = true if (self:_get("ifname") or ""):match("%S+") then rv = false end _uci_real:foreach("wireless", "wifi-iface", function(s) local n for n in utl.imatch(s.network) do if n == self.sid then rv = false return false end end end) return rv end end function protocol.add_interface(self, ifname) ifname = _M:ifnameof(ifname) if ifname and not self:is_floating() then -- if its a wifi interface, change its network option local wif = _wifi_lookup(ifname) if wif then _append("wireless", wif, "network", self.sid) -- add iface to our iface list else _append("network", self.sid, "ifname", ifname) end end end function protocol.del_interface(self, ifname) ifname = _M:ifnameof(ifname) if ifname and not self:is_floating() then -- if its a wireless interface, clear its network option local wif = _wifi_lookup(ifname) if wif then _filter("wireless", wif, "network", self.sid) end -- remove the interface _filter("network", self.sid, "ifname", ifname) end end function protocol.get_interface(self) if self:is_virtual() then _tunnel[self:proto() .. "-" .. self.sid] = true return interface(self:proto() .. "-" .. self.sid, self) elseif self:is_bridge() then _bridge["br-" .. self.sid] = true return interface("br-" .. self.sid, self) else local ifn = nil local num = { } for ifn in utl.imatch(_uci_real:get("network", self.sid, "ifname")) do ifn = ifn:match("^[^:/]+") return ifn and interface(ifn, self) end ifn = nil _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device then num[s.device] = num[s.device] and num[s.device] + 1 or 1 local net for net in utl.imatch(s.network) do if net == self.sid then ifn = "%s.network%d" %{ s.device, num[s.device] } return false end end end end) return ifn and interface(ifn, self) end end function protocol.get_interfaces(self) if self:is_bridge() or (self:is_virtual() and not self:is_floating()) then local ifaces = { } local ifn local nfs = { } for ifn in utl.imatch(self:get("ifname")) do ifn = ifn:match("^[^:/]+") nfs[ifn] = interface(ifn, self) end for ifn in utl.kspairs(nfs) do ifaces[#ifaces+1] = nfs[ifn] end local num = { } local wfs = { } _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device then num[s.device] = num[s.device] and num[s.device] + 1 or 1 local net for net in utl.imatch(s.network) do if net == self.sid then ifn = "%s.network%d" %{ s.device, num[s.device] } wfs[ifn] = interface(ifn, self) end end end end) for ifn in utl.kspairs(wfs) do ifaces[#ifaces+1] = wfs[ifn] end return ifaces end end function protocol.contains_interface(self, ifname) ifname = _M:ifnameof(ifname) if not ifname then return false elseif self:is_virtual() and self:proto() .. "-" .. self.sid == ifname then return true elseif self:is_bridge() and "br-" .. self.sid == ifname then return true else local ifn for ifn in utl.imatch(self:get("ifname")) do ifn = ifn:match("[^:]+") if ifn == ifname then return true end end local wif = _wifi_lookup(ifname) if wif then local n for n in utl.imatch(_uci_real:get("wireless", wif, "network")) do if n == self.sid then return true end end end end return false end function protocol.adminlink(self) return dsp.build_url("admin", "network", "network", self.sid) end interface = utl.class() function interface.__init__(self, ifname, network) local wif = _wifi_lookup(ifname) if wif then self.wif = wifinet(wif) self.ifname = _wifi_state("section", wif, "ifname") end self.ifname = self.ifname or ifname self.dev = _interfaces[self.ifname] self.network = network end function interface._ubus(self, field) if not _ubusdevcache[self.ifname] then _ubusdevcache[self.ifname] = utl.ubus("network.device", "status", { name = self.ifname }) end if _ubusdevcache[self.ifname] and field then return _ubusdevcache[self.ifname][field] end return _ubusdevcache[self.ifname] end function interface.name(self) return self.wif and self.wif:ifname() or self.ifname end function interface.mac(self) return (self:_ubus("macaddr") or "00:00:00:00:00:00"):upper() end function interface.ipaddrs(self) return self.dev and self.dev.ipaddrs or { } end function interface.ip6addrs(self) return self.dev and self.dev.ip6addrs or { } end function interface.type(self) if self.wif or _wifi_iface(self.ifname) then return "wifi" elseif _bridge[self.ifname] then return "bridge" elseif _tunnel[self.ifname] then return "tunnel" elseif self.ifname:match("%.") then return "vlan" elseif _switch[self.ifname] then return "switch" else return "ethernet" end end function interface.shortname(self) if self.wif then return "%s %q" %{ self.wif:active_mode(), self.wif:active_ssid() or self.wif:active_bssid() } else return self.ifname end end function interface.get_i18n(self) if self.wif then return "%s: %s %q" %{ lng.translate("Wireless Network"), self.wif:active_mode(), self.wif:active_ssid() or self.wif:active_bssid() } else return "%s: %q" %{ self:get_type_i18n(), self:name() } end end function interface.get_type_i18n(self) local x = self:type() if x == "wifi" then return lng.translate("Wireless Adapter") elseif x == "bridge" then return lng.translate("Bridge") elseif x == "switch" then return lng.translate("Ethernet Switch") elseif x == "vlan" then return lng.translate("VLAN Interface") elseif x == "tunnel" then return lng.translate("Tunnel Interface") else return lng.translate("Ethernet Adapter") end end function interface.adminlink(self) if self.wif then return self.wif:adminlink() end end function interface.ports(self) local members = self:_ubus("bridge-members") if members then local _, iface local ifaces = { } for _, iface in ipairs(members) do ifaces[#ifaces+1] = interface(iface) end end end function interface.bridge_id(self) if self.br then return self.br.id else return nil end end function interface.bridge_stp(self) if self.br then return self.br.stp else return false end end function interface.is_up(self) return self:_ubus("up") or false end function interface.is_bridge(self) return (self:type() == "bridge") end function interface.is_bridgeport(self) return self.dev and self.dev.bridge and true or false end function interface.tx_bytes(self) local stat = self:_ubus("statistics") return stat and stat.tx_bytes or 0 end function interface.rx_bytes(self) local stat = self:_ubus("statistics") return stat and stat.rx_bytes or 0 end function interface.tx_packets(self) local stat = self:_ubus("statistics") return stat and stat.tx_packets or 0 end function interface.rx_packets(self) local stat = self:_ubus("statistics") return stat and stat.rx_packets or 0 end function interface.get_network(self) return self:get_networks()[1] end function interface.get_networks(self) if not self.networks then local nets = { } local _, net for _, net in ipairs(_M:get_networks()) do if net:contains_interface(self.ifname) or net:ifname() == self.ifname then nets[#nets+1] = net end end table.sort(nets, function(a, b) return a.sid < b.sid end) self.networks = nets return nets else return self.networks end end function interface.get_wifinet(self) return self.wif end wifidev = utl.class() function wifidev.__init__(self, dev) self.sid = dev self.iwinfo = dev and sys.wifi.getiwinfo(dev) or { } end function wifidev.get(self, opt) return _get("wireless", self.sid, opt) end function wifidev.set(self, opt, val) return _set("wireless", self.sid, opt, val) end function wifidev.name(self) return self.sid end function wifidev.hwmodes(self) local l = self.iwinfo.hwmodelist if l and next(l) then return l else return { b = true, g = true } end end function wifidev.get_i18n(self) local t = "Generic" if self.iwinfo.type == "wl" then t = "Broadcom" elseif self.iwinfo.type == "madwifi" then t = "Atheros" end local m = "" local l = self:hwmodes() if l.a then m = m .. "a" end if l.b then m = m .. "b" end if l.g then m = m .. "g" end if l.n then m = m .. "n" end if l.ac then m = "ac" end return "%s 802.11%s Wireless Controller (%s)" %{ t, m, self:name() } end function wifidev.is_up(self) if _ubuswificache[self.sid] then return (_ubuswificache[self.sid].up == true) end local up = false _uci_state:foreach("wireless", "wifi-iface", function(s) if s.device == self.sid then if s.up == "1" then up = true return false end end end) return up end function wifidev.get_wifinet(self, net) if _uci_real:get("wireless", net) == "wifi-iface" then return wifinet(net) else local wnet = _wifi_lookup(net) if wnet then return wifinet(wnet) end end end function wifidev.get_wifinets(self) local nets = { } _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device == self.sid then nets[#nets+1] = wifinet(s['.name']) end end) return nets end function wifidev.add_wifinet(self, options) options = options or { } options.device = self.sid local wnet = _uci_real:section("wireless", "wifi-iface", nil, options) if wnet then return wifinet(wnet, options) end end function wifidev.del_wifinet(self, net) if utl.instanceof(net, wifinet) then net = net.sid elseif _uci_real:get("wireless", net) ~= "wifi-iface" then net = _wifi_lookup(net) end if net and _uci_real:get("wireless", net, "device") == self.sid then _uci_real:delete("wireless", net) return true end return false end wifinet = utl.class() function wifinet.__init__(self, net, data) self.sid = net local num = { } local netid _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device then num[s.device] = num[s.device] and num[s.device] + 1 or 1 if s['.name'] == self.sid then netid = "%s.network%d" %{ s.device, num[s.device] } return false end end end) local dev = _wifi_state("section", self.sid, "ifname") or netid self.netid = netid self.wdev = dev self.iwinfo = dev and sys.wifi.getiwinfo(dev) or { } self.iwdata = data or _uci_state:get_all("wireless", self.sid) or _uci_real:get_all("wireless", self.sid) or { } end function wifinet.get(self, opt) return _get("wireless", self.sid, opt) end function wifinet.set(self, opt, val) return _set("wireless", self.sid, opt, val) end function wifinet.mode(self) return _uci_state:get("wireless", self.sid, "mode") or "ap" end function wifinet.ssid(self) return _uci_state:get("wireless", self.sid, "ssid") end function wifinet.bssid(self) return _uci_state:get("wireless", self.sid, "bssid") end function wifinet.network(self) return _uci_state:get("wifinet", self.sid, "network") end function wifinet.id(self) return self.netid end function wifinet.name(self) return self.sid end function wifinet.ifname(self) local ifname = self.iwinfo.ifname if not ifname or ifname:match("^wifi%d") or ifname:match("^radio%d") then ifname = self.wdev end return ifname end function wifinet.get_device(self) if self.iwdata.device then return wifidev(self.iwdata.device) end end function wifinet.is_up(self) local ifc = self:get_interface() return (ifc and ifc:is_up() or false) end function wifinet.active_mode(self) local m = _stror(self.iwinfo.mode, self.iwdata.mode) or "ap" if m == "ap" then m = "Master" elseif m == "sta" then m = "Client" elseif m == "adhoc" then m = "Ad-Hoc" elseif m == "mesh" then m = "Mesh" elseif m == "monitor" then m = "Monitor" end return m end function wifinet.active_mode_i18n(self) return lng.translate(self:active_mode()) end function wifinet.active_ssid(self) return _stror(self.iwinfo.ssid, self.iwdata.ssid) end function wifinet.active_bssid(self) return _stror(self.iwinfo.bssid, self.iwdata.bssid) or "00:00:00:00:00:00" end function wifinet.active_encryption(self) local enc = self.iwinfo and self.iwinfo.encryption return enc and enc.description or "-" end function wifinet.assoclist(self) return self.iwinfo.assoclist or { } end function wifinet.frequency(self) local freq = self.iwinfo.frequency if freq and freq > 0 then return "%.03f" % (freq / 1000) end end function wifinet.bitrate(self) local rate = self.iwinfo.bitrate if rate and rate > 0 then return (rate / 1000) end end function wifinet.channel(self) return self.iwinfo.channel or tonumber(_uci_state:get("wireless", self.iwdata.device, "channel")) end function wifinet.signal(self) return self.iwinfo.signal or 0 end function wifinet.noise(self) return self.iwinfo.noise or 0 end function wifinet.country(self) return self.iwinfo.country or "00" end function wifinet.txpower(self) local pwr = (self.iwinfo.txpower or 0) return pwr + self:txpower_offset() end function wifinet.txpower_offset(self) return self.iwinfo.txpower_offset or 0 end function wifinet.signal_level(self, s, n) if self:active_bssid() ~= "00:00:00:00:00:00" then local signal = s or self:signal() local noise = n or self:noise() if signal < 0 and noise < 0 then local snr = -1 * (noise - signal) return math.floor(snr / 5) else return 0 end else return -1 end end function wifinet.signal_percent(self) local qc = self.iwinfo.quality or 0 local qm = self.iwinfo.quality_max or 0 if qc > 0 and qm > 0 then return math.floor((100 / qm) * qc) else return 0 end end function wifinet.shortname(self) return "%s %q" %{ lng.translate(self:active_mode()), self:active_ssid() or self:active_bssid() } end function wifinet.get_i18n(self) return "%s: %s %q (%s)" %{ lng.translate("Wireless Network"), lng.translate(self:active_mode()), self:active_ssid() or self:active_bssid(), self:ifname() } end function wifinet.adminlink(self) return dsp.build_url("admin", "network", "wireless", self.netid) end function wifinet.get_network(self) return self:get_networks()[1] end function wifinet.get_networks(self) local nets = { } local net for net in utl.imatch(tostring(self.iwdata.network)) do if _uci_real:get("network", net) == "interface" then nets[#nets+1] = network(net) end end table.sort(nets, function(a, b) return a.sid < b.sid end) return nets end function wifinet.get_interface(self) return interface(self:ifname()) end -- setup base protocols _M:register_protocol("static") _M:register_protocol("dhcp") _M:register_protocol("none") -- load protocol extensions local exts = nfs.dir(utl.libpath() .. "/model/network") if exts then local ext for ext in exts do if ext:match("%.lua$") then require("luci.model.network." .. ext:gsub("%.lua$", "")) end end end
apache-2.0
hooksta4/darkstar
scripts/zones/Port_Windurst/npcs/Sattsuh_Ahkanpari.lua
16
1538
----------------------------------- -- Area: Port Windurst -- NPC: Sattsuh Ahkanpari -- Regional Marchant NPC -- Only sells when Windurst controlls Elshimo Uplands -- Confirmed shop stock, August 2013 ----------------------------------- require("scripts/globals/shop"); require("scripts/globals/conquest"); package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil; require("scripts/zones/Port_Windurst/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) RegionOwner = GetRegionOwner(ELSHIMOUPLANDS); if (RegionOwner ~= WINDURST) then player:showText(npc,SATTSUHAHKANPARI_CLOSED_DIALOG); else player:showText(npc,SATTSUHAHKANPARI_OPEN_DIALOG); stock = { 0x0585, 1656, --Cattleya 0x0274, 239, --Cinnamon 0x1174, 73, --Pamamas 0x02d1, 147 --Rattan Lumber } showShop(player,WINDURST,stock); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/globals/items/bowl_of_delicious_puls.lua
35
1320
----------------------------------------- -- ID: 4533 -- Item: Bowl of Delicious Puls -- Food Effect: 240Min, All Races ----------------------------------------- -- Dexterity -1 -- Vitality 3 -- Health Regen While Healing 5 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,14400,4533); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_DEX, -1); target:addMod(MOD_VIT, 3); target:addMod(MOD_HPHEAL, 5); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_DEX, -1); target:delMod(MOD_VIT, 3); target:delMod(MOD_HPHEAL, 5); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Windurst_Waters/npcs/Hariga-Origa.lua
2
3432
----------------------------------- -- Area: Windurst Waters -- NPC: Hariga-Origa -- Starts & Finishes Quest: Glyph Hanger -- Involved in Mission 2-1 -- @pos -62 -6 105 238 ----------------------------------- package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/globals/keyitems"); require("scripts/zones/Windurst_Waters/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) smudgeStatus = player:getQuestStatus(WINDURST,A_SMUDGE_ON_ONE_S_RECORD); if (smudgeStatus == QUEST_ACCEPTED and trade:hasItemQty(637,1) and trade:hasItemQty(4382,1)) then player:startEvent(0x01a1,3000); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) GlyphHanger = player:getQuestStatus(WINDURST,GLYPH_HANGER); chasingStatus = player:getQuestStatus(WINDURST,CHASING_TALES); smudgeStatus = player:getQuestStatus(WINDURST,A_SMUDGE_ON_ONE_S_RECORD); Fame = player:getFameLevel(WINDURST); if (smudgeStatus == QUEST_COMPLETED and player:needToZone() == true) then player:startEvent(0x01a2); elseif (smudgeStatus == QUEST_ACCEPTED) then player:startEvent(0x019e,0,637,4382); elseif (smudgeStatus == QUEST_AVAILABLE and chasingStatus == QUEST_COMPLETED and Fame >= 4) then player:startEvent(0x019d,0,637,4382); elseif (GlyphHanger == QUEST_COMPLETED and chasingStatus ~= QUEST_COMPLETED) then player:startEvent(0x0182); elseif (GlyphHanger == QUEST_ACCEPTED) then if (player:hasKeyItem(NOTES_FROM_IPUPU)) then player:startEvent(0x0181); else player:startEvent(0x017e); end elseif (GlyphHanger == QUEST_AVAILABLE) then player:startEvent(0x017d); else player:startEvent(0x0174); -- The line will never be executed end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x017d and option == 0) then player:addQuest(WINDURST,GLYPH_HANGER); player:addKeyItem(NOTES_FROM_HARIGAORIGA); player:messageSpecial(KEYITEM_OBTAINED,NOTES_FROM_HARIGAORIGA); elseif (csid == 0x0181) then player:needToZone(true); player:delKeyItem(NOTES_FROM_IPUPU); if (player:hasKeyItem(MAP_OF_THE_HORUTOTO_RUINS) == false) then player:addKeyItem(MAP_OF_THE_HORUTOTO_RUINS); player:messageSpecial(KEYITEM_OBTAINED,MAP_OF_THE_HORUTOTO_RUINS); end player:addFame(WINDURST,WIN_FAME*120); player:completeQuest(WINDURST,GLYPH_HANGER); elseif (csid == 0x019d and option == 0) then player:addQuest(WINDURST,A_SMUDGE_ON_ONE_S_RECORD); elseif (csid == 0x01a1) then player:needToZone(true); player:addGil(GIL_RATE*3000); player:messageSpecial(GIL_OBTAINED,GIL_RATE*3000); if (player:hasKeyItem(MAP_OF_FEIYIN) == false) then player:addKeyItem(MAP_OF_FEIYIN); player:messageSpecial(KEYITEM_OBTAINED,MAP_OF_FEIYIN); end player:addFame(WINDURST,WIN_FAME*120); player:completeQuest(WINDURST,A_SMUDGE_ON_ONE_S_RECORD); end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Temenos/bcnms/Central_Temenos_1st_Floor.lua
19
1075
----------------------------------- -- Area: Temenos -- Name: ----------------------------------- -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) SetServerVariable("[C_Temenos_1st]UniqueID",GenerateLimbusKey()); HideArmouryCrates(GetInstanceRegion(1303),TEMENOS); HideTemenosDoor(GetInstanceRegion(1303)); player:setVar("Limbus_Trade_Item-T",0); end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) player:setVar("limbusbitmap",0); player:setVar("characterLimbusKey",GetServerVariable("[C_Temenos_1st]UniqueID")); player:setVar("LimbusID",1303); player:delKeyItem(COSMOCLEANSE); player:delKeyItem(WHITE_CARD); end; -- Leaving by every mean possible, given by the LeaveCode -- 3=Disconnected or warped out (if dyna is empty: launch 4 after 3) -- 4=Finish he dynamis function onBcnmLeave(player,instance,leavecode) --print("leave code "..leavecode); if (leavecode == 4) then player:setPos(580,-1.5,4.452,192); ResetPlayerLimbusVariable(player) end end;
gpl-3.0
jpuigcerver/Laia
laia/util/base.lua
1
1280
laia = laia or {} laia.log = laia.log or require 'laia.util.log' laia.log.loglevel = 'warn' -- Overload assert to use Laia's own logging system assert = function(test, msg, ...) if not test then local function getfileline(filename, lineno) local n = 1 for l in io.lines(filename) do if n == lineno then return l end n = n + 1 end end -- Get the lua source code that caused the exception local info = debug.getinfo(2, 'Sl') local source = info.source if string.sub(source, 1, 1) == '@' then source = getfileline(string.sub(source, 2, #source), info.currentline):gsub("^%s*(.-)%s*$", "%1") end msg = msg or ('Assertion %q failed'):format(source) laia.log.fatal{fmt = msg, arg = {...}, level = 3} end return test end -- Overload error to use Laia's own logging system -- TODO(jpuigcerver): If we overload this, wrequire (due to pcall) -- does not work properly (it crashes anyway). --error = function(msg, ...) -- laia.log.fatal{fmt = msg, arg = {...}, level = 3} --end -- Require with graceful warning, for optional modules function wrequire(name) local ok, m = pcall(require, name) if not ok then laia.log.warn(('Optional lua module %q was not found!'):format(name)) end return m or nil end
mit
Moodstocks/nn
View.lua
41
2232
local View, parent = torch.class('nn.View', 'nn.Module') function View:__init(...) parent.__init(self) if select('#', ...) == 1 and torch.typename(select(1, ...)) == 'torch.LongStorage' then self.size = select(1, ...) else self.size = torch.LongStorage({...}) end self.numElements = 1 local inferdim = false for i = 1,#self.size do local szi = self.size[i] if szi >= 0 then self.numElements = self.numElements * self.size[i] else assert(szi == -1, 'size should be positive or -1') assert(not inferdim, 'only one dimension can be at -1') inferdim = true end end self.output = nil self.gradInput = nil self.numInputDims = nil end function View:setNumInputDims(numInputDims) self.numInputDims = numInputDims return self end local function batchsize(input, size, numInputDims, numElements) local ind = input:nDimension() local isz = input:size() local maxdim = numInputDims and numInputDims or ind local ine = 1 for i=ind,ind-maxdim+1,-1 do ine = ine * isz[i] end if ine % numElements ~= 0 then error(string.format( 'input view (%s) and desired view (%s) do not match', table.concat(input:size():totable(), 'x'), table.concat(size:totable(), 'x'))) end -- the remainder is either the batch... local bsz = ine / numElements -- ... or the missing size dim for i=1,size:size() do if size[i] == -1 then bsz = 1 break end end -- for dim over maxdim, it is definitively the batch for i=ind-maxdim,1,-1 do bsz = bsz * isz[i] end -- special card if bsz == 1 and (not numInputDims or input:nDimension() <= numInputDims) then return end return bsz end function View:updateOutput(input) local bsz = batchsize(input, self.size, self.numInputDims, self.numElements) if bsz then self.output = input:view(bsz, table.unpack(self.size:totable())) else self.output = input:view(self.size) end return self.output end function View:updateGradInput(input, gradOutput) self.gradInput = gradOutput:view(input:size()) return self.gradInput end
bsd-3-clause
hooksta4/darkstar
scripts/zones/Dynamis-San_dOria/bcnms/dynamis_sandoria.lua
16
1180
----------------------------------- -- Area: Dynamis San d'Oria -- Name: Dynamis San d'Oria ----------------------------------- -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) SetServerVariable("[DynaSandoria]UniqueID",player:getDynamisUniqueID(1281)); SetServerVariable("[DynaSandoria]Boss_Trigger",0); SetServerVariable("[DynaSandoria]Already_Received",0); end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) player:setVar("DynamisID",GetServerVariable("[DynaSandoria]UniqueID")); local realDay = os.time(); local dynaWaitxDay = player:getVar("dynaWaitxDay"); if ((dynaWaitxDay + (BETWEEN_2DYNA_WAIT_TIME * 24 * 60 * 60)) < realDay) then player:setVar("dynaWaitxDay",realDay); end end; -- Leaving the Dynamis by every mean possible, given by the LeaveCode -- 3=Disconnected or warped out (if dyna is empty: launch 4 after 3) -- 4=Finish he dynamis function onBcnmLeave(player,instance,leavecode) --print("leave code "..leavecode); if (leavecode == 4) then GetNPCByID(17535224):setStatus(2); SetServerVariable("[DynaSandoria]UniqueID",0); end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Dynamis-San_dOria/bcnms/dynamis_sandoria.lua
16
1180
----------------------------------- -- Area: Dynamis San d'Oria -- Name: Dynamis San d'Oria ----------------------------------- -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) SetServerVariable("[DynaSandoria]UniqueID",player:getDynamisUniqueID(1281)); SetServerVariable("[DynaSandoria]Boss_Trigger",0); SetServerVariable("[DynaSandoria]Already_Received",0); end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) player:setVar("DynamisID",GetServerVariable("[DynaSandoria]UniqueID")); local realDay = os.time(); local dynaWaitxDay = player:getVar("dynaWaitxDay"); if ((dynaWaitxDay + (BETWEEN_2DYNA_WAIT_TIME * 24 * 60 * 60)) < realDay) then player:setVar("dynaWaitxDay",realDay); end end; -- Leaving the Dynamis by every mean possible, given by the LeaveCode -- 3=Disconnected or warped out (if dyna is empty: launch 4 after 3) -- 4=Finish he dynamis function onBcnmLeave(player,instance,leavecode) --print("leave code "..leavecode); if (leavecode == 4) then GetNPCByID(17535224):setStatus(2); SetServerVariable("[DynaSandoria]UniqueID",0); end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Metalworks/npcs/Topuru-Kuperu.lua
38
1044
----------------------------------- -- Area: Metalworks -- NPC: Topuru-Kuperu -- Type: Standard NPC -- @zone: 237 -- @pos 28.284 -17.39 42.269 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Metalworks/TextIDs"] = nil; require("scripts/zones/Metalworks/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x00fb); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Windurst_Waters/npcs/Hakeem.lua
12
1768
----------------------------------- -- Area: Windurst Waters -- NPC: Hakeem -- Type: Cooking Image Support -- @pos -123.120 -2.999 65.472 238 ----------------------------------- package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Windurst_Waters/TextIDs"); require("scripts/globals/status"); require("scripts/globals/crafting"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local guildMember = isGuildMember(player,4); local SkillCap = getCraftSkillCap(player,16); local SkillLevel = player:getSkillLevel(16); if (guildMember == 1) then if (player:hasStatusEffect(EFFECT_COOKING_IMAGERY) == false) then player:startEvent(0x2721,SkillCap,SkillLevel,2,495,player:getGil(),0,4095,0); -- p1 = skill level else player:startEvent(0x2721,SkillCap,SkillLevel,2,495,player:getGil(),7094,4095,0); end else player:startEvent(0x2721); -- Standard Dialogue end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if (csid == 0x2721 and option == 1) then player:messageSpecial(COOKING_SUPPORT,0,8,2); player:addStatusEffect(EFFECT_COOKING_IMAGERY,1,0,120); end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Port_Jeuno/npcs/Red_Ghost.lua
4
2023
----------------------------------- -- Area: Port Jeuno -- NPC: Red Ghost -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Port_Jeuno/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Port_Jeuno/TextIDs"); require("scripts/globals/quests"); require("scripts/globals/pathfind"); local path = { -96.823616, 0.001000, -3.722488, -96.761887, 0.001000, -2.632236, -96.698341, 0.001000, -1.490001, -96.636963, 0.001000, -0.363672, -96.508736, 0.001000, 2.080966, -96.290009, 0.001000, 6.895948, -96.262505, 0.001000, 7.935584, -96.282127, 0.001000, 6.815756, -96.569176, 0.001000, -7.781419, -96.256729, 0.001000, 8.059505, -96.568405, 0.001000, -7.745419, -96.254066, 0.001000, 8.195477, -96.567200, 0.001000, -7.685426 }; function onSpawn(npc) npc:initNpcAi(); npc:setPos(pathfind.first(path)); onPath(npc); end; function onPath(npc) pathfind.patrol(npc, path); end; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local WildcatJeuno = player:getVar("WildcatJeuno"); if (player:getQuestStatus(JEUNO,LURE_OF_THE_WILDCAT_JEUNO) == QUEST_ACCEPTED and player:getMaskBit(WildcatJeuno,15) == false) then player:startEvent(314); else player:startEvent(0x22); end -- wait until event is over npc:wait(-1); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option,npc) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if (csid == 314) then player:setMaskBit(player:getVar("WildcatJeuno"),"WildcatJeuno",15,true); end npc:wait(0); end;
gpl-3.0
snabbco/snabb
lib/ljsyscall/syscall/linux/mips/ioctl.lua
24
2047
-- MIPS ioctl differences local arch = { IOC = { SIZEBITS = 13, DIRBITS = 3, NONE = 1, READ = 2, WRITE = 4, }, ioctl = function(_IO, _IOR, _IOW, _IORW) return { FIONREAD = 0x467f, TCSBRK = 0x5405, TCXONC = 0x5406, TCFLSH = 0x5407, TCGETS = {number = 0x540d, read = true, type = "termios"}, TCSETS = 0x540e, TCSETSW = 0x540f, TCSETSF = 0x5410, TIOCPKT = 0x5470, TIOCNOTTY = 0x5471, TIOCSTI = 0x5472, TIOCSCTTY = 0x5480, TIOCGSOFTCAR = 0x5481, TIOCSSOFTCAR = 0x5482, TIOCLINUX = 0x5483, TIOCGSERIAL = 0x5484, TIOCSSERIAL = 0x5485, TCSBRKP = 0x5486, TIOCSERCONFIG = 0x5488, TIOCSERGWILD = 0x5489, TIOCSERSWILD = 0x548a, TIOCGLCKTRMIOS = 0x548b, TIOCSLCKTRMIOS = 0x548c, TIOCSERGSTRUCT = 0x548d, TIOCSERGETLSR = 0x548e, TIOCSERGETMULTI= 0x548f, TIOCSERSETMULTI= 0x5490, TIOCMIWAIT = 0x5491, TIOCGICOUNT = 0x5492, FIOCLEX = 0x6601, FIONCLEX = 0x6602, FIOASYNC = 0x667d, FIONBIO = 0x667e, FIOQSIZE = 0x667f, TIOCGETD = 0x7400, TIOCSETD = 0x7401, TIOCEXCL = 0x740d, TIOCNXCL = 0x740e, TIOCGSID = 0x7416, TIOCMSET = 0x741a, TIOCMBIS = 0x741b, TIOCMBIC = 0x741c, TIOCMGET = 0x741d, TIOCOUTQ = 0x7472, FIOGETOWN = _IOR('f', 123, "int"), FIOSETOWN = _IOW('f', 124, "int"), SIOCATMARK = _IOR('s', 7, "int"), SIOCSPGRP = _IOW('s', 8, "pid"), SIOCGPGRP = _IOR('s', 9, "pid"), TIOCSWINSZ = _IOW('t', 103, "winsize"), TIOCGWINSZ = _IOR('t', 104, "winsize"), TIOCSPGRP = _IOW('t', 118, "int"), TIOCGPGRP = _IOR('t', 119, "int"), TIOCCONS = _IOW('t', 120, "int"), } end, } return arch
apache-2.0
gedadsbranch/Darkstar-Mission
scripts/zones/Aht_Urhgan_Whitegate/npcs/Furious_Boulder.lua
34
1040
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Furious Boulder -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x00E6); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Rolanberry_Fields/npcs/Saarlan.lua
10
8608
----------------------------------- -- Area: Rolanberry Fields -- NPC: Saarlan -- Legion NPC -- @pos 242 24.395 468 ----------------------------------- package.loaded["scripts/zones/Rolanberry_Fields/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/titles"); require("scripts/zones/Rolanberry_Fields/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local TITLE = 0; local MAXIMUS = 0; local LP = player:getCurrency("legion_point"); local MINIMUS = 0; if (player:hasKeyItem(LEGION_TOME_PAGE_MAXIMUS)) then MAXIMUS = 1; end if (player:hasKeyItem(LEGION_TOME_PAGE_MINIMUS)) then MINIMUS = 1; end if (player:hasTitle(SUBJUGATOR_OF_THE_LOFTY)) then TITLE = TITLE+1; end if (player:hasTitle(SUBJUGATOR_OF_THE_MIRED)) then TITLE = TITLE+2; end if (player:hasTitle(SUBJUGATOR_OF_THE_SOARING)) then TITLE = TITLE+4; end if (player:hasTitle(SUBJUGATOR_OF_THE_VEILED)) then TITLE = TITLE+8; end if (player:hasTitle(LEGENDARY_LEGIONNAIRE)) then TITLE = TITLE+16; end if (player:getVar("LegionStatus") == 0) then player:startEvent(8004); elseif (player:getVar("LegionStatus") == 1) then player:startEvent(8005, 0, TITLE, MAXIMUS, LP, MINIMUS); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u", csid); -- printf("RESULT: %u", option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u", csid); -- printf("RESULT: %u", option); local GIL = player:getGil(); local LP = player:getCurrency("legion_point"); local LP_COST = 0; local ITEM = 0; if (csid == 8004) then player:setVar("LegionStatus",1) elseif (csid == 8005) then if (option == 0x0001000A) then if (GIL >= 360000) then player:addKeyItem(LEGION_TOME_PAGE_MAXIMUS); player:delGil(360000); player:messageSpecial(KEYITEM_OBTAINED, LEGION_TOME_PAGE_MAXIMUS) else player:messageSpecial(NOT_ENOUGH_GIL); end elseif(option == 0x0001000B) then if (GIL >= 180000) then player:addKeyItem(LEGION_TOME_PAGE_MINIMUS); player:delGil(180000); player:messageSpecial(KEYITEM_OBTAINED, LEGION_TOME_PAGE_MINIMUS) else player:messageSpecial(NOT_ENOUGH_GIL); end elseif(option == 0x00000002) then -- Gaiardas Ring LP_COST = 1000; ITEM = 10775 elseif(option == 0x00010002) then -- Gaubious Ring LP_COST = 1000; ITEM = 10776; elseif(option == 0x00020002) then -- Caloussu Ring LP_COST = 1000; ITEM = 10777; elseif(option == 0x00030002) then -- Nanger Ring LP_COST = 1000; ITEM = 10778; elseif(option == 0x00040002) then -- Sophia Ring LP_COST = 1000; ITEM = 10779; elseif(option == 0x00050002) then -- Quies Ring LP_COST = 1000; ITEM = 10780; elseif(option == 0x00060002) then -- Cynosure Ring LP_COST = 1000; ITEM = 10781; elseif(option == 0x00070002) then -- Ambuscade Ring LP_COST = 1000; ITEM = 10782; elseif(option == 0x00080002) then -- Veneficium Ring LP_COST = 1000; ITEM = 10783; elseif(option == 0x00090002) then -- Calma Armet ...Requires title: "Subjugator of the Lofty" LP_COST = 4500; ITEM = 10890; elseif(option == 0x000A0002) then -- Mustela Mask ...Requires title: "Subjugator of the Lofty" LP_COST = 4500; ITEM = 10891; elseif(option == 0x000B0002) then -- Magavan Beret ...Requires title: "Subjugator of the Lofty" LP_COST = 4500; ITEM = 10892; elseif(option == 0x000C0002) then -- Calma Gauntlets ...Requires title: "Subjugator of the Mired" LP_COST = 3000; ITEM = 10512; elseif(option == 0x000D0002) then -- Mustela Gloves ...Requires title: "Subjugator of the Mired" LP_COST = 3000; ITEM = 10513; elseif(option == 0x000E0002) then -- Magavan Mitts ...Requires title: "Subjugator of the Mired" LP_COST = 3000; ITEM = 10514; elseif(option == 0x000F0002) then -- Calma Hose ...Requires title: "Subjugator of the Soaring" LP_COST = 4500; ITEM = 11980; elseif(option == 0x00100002) then -- Mustela Brais ...Requires title: "Subjugator of the Soaring" LP_COST = 4500; ITEM = 11981; elseif(option == 0x00110002) then -- Magavan Slops ...Requires title: "Subjugator of the Soaring" LP_COST = 4500; ITEM = 11982; elseif(option == 0x00120002) then -- Calma Leggings ...Requires title: "Subjugator of the Veiled" LP_COST = 3000; ITEM = 10610; elseif(option == 0x00130002) then -- Mustela Boots ...Requires title: "Subjugator of the Veiled" LP_COST = 3000; ITEM = 10611; elseif(option == 0x00140002) then -- Magavan Clogs ...Requires title: "Subjugator of the Veiled" LP_COST = 3000; ITEM = 10612; elseif(option == 0x00150002) then -- Calma Breastplate ...Requires title: "Legendary Legionnaire" LP_COST = 10000; ITEM = 10462; elseif(option == 0x00160002) then -- Mustela Harness ...Requires title: "Legendary Legionnaire" LP_COST = 10000; ITEM = 10463; elseif(option == 0x00170002) then -- Magavan Frock ...Requires title: "Legendary Legionnaire" LP_COST = 10000; ITEM = 10464; elseif(option == 0x00180002) then -- Corybant Pearl ...Requires title: "Subjugator of the Lofty" LP_COST = 3000; ITEM = 11044; elseif(option == 0x00190002) then -- Saviesa Pearl ...Requires title: "Subjugator of the Mired" LP_COST = 3000; ITEM = 11045; elseif(option == 0x001A0002) then -- Ouesk Pearl ...Requires title: "Subjugator of the Soaring" LP_COST = 3000; ITEM = 11046; elseif(option == 0x001B0002) then -- Belatz Pearl ...Requires title: "Subjugator of the Soaring" LP_COST = 3000; ITEM = 11047; elseif(option == 0x001C0002) then -- Cytherea Pearl ...Requires title: "Subjugator of the Veiled" LP_COST = 3000; ITEM = 11048; elseif(option == 0x001D0002) then -- Myrddin Pearl ...Requires title: "Subjugator of the Veiled" LP_COST = 3000; ITEM = 11049; elseif(option == 0x001E0002) then -- Puissant Pearl ...Requires title: "Subjugator of the Veiled" LP_COST = 3000; ITEM = 11050; elseif(option == 0x001F0002) then -- Dhanurveda Ring ...Requires title: "Legendary Legionnaire" LP_COST = 6000; ITEM = 10784; elseif(option == 0000200002) then -- Provocare Ring ......Requires title: "Legendary Legionnaire" LP_COST = 6000; ITEM = 10785; elseif(option == 0000210002) then -- Mediator's Ring ...Requires title: "Legendary Legionnaire" LP_COST = 6000; ITEM = 10786; end end if (LP < LP_COST) then player:messageSpecial(LACK_LEGION_POINTS); elseif (ITEM > 0) then if (player:getFreeSlotsCount() >=1) then player:delCurrency("legion_point", LP_COST); player:addItem(ITEM, 1); player:messageSpecial(ITEM_OBTAINED, ITEM); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, ITEM); end end end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Toraimarai_Canal/npcs/Grounds_Tome.lua
34
1145
----------------------------------- -- Area: Toraimarai Canal -- NPC: Grounds Tome ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/groundsofvalor"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) startGov(GOV_EVENT_TORAIMARAI_CANAL,player); end; ----------------------------------- -- onEventSelection ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); updateGov(player,csid,option,618,619,620,621,622,623,624,625,0,0); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); finishGov(player,csid,option,618,619,620,621,622,623,624,625,0,0,GOV_MSG_TORAIMARAI_CANAL); end;
gpl-3.0
p5n/notion
contrib/styles/look_cleansteel_trans.lua
3
4766
-- Authors: Steve Pomeroy <steve@staticfree.info> -- License: Unknown -- Last Changed: Unknown -- -- look-cleansteel_trans.lua drawing engine configuration file for Ion. -- Based on the default cleansteel look, but with added transparency -- and a few other things that I like. -Steve Pomeroy <steve@staticfree.info> if not gr.select_engine("de") then return end de.reset() de.defstyle("*", { shadow_colour = "#404040", highlight_colour = "#707070", background_colour = "#505050", foreground_colour = "#a0a0a0", padding_pixels = 1, highlight_pixels = 1, shadow_pixels = 1, border_style = "elevated", font = "-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*", text_align = "center", transparent_background = false, }) de.defstyle("frame", { based_on = "*", --shadow_colour = "#404040", --highlight_colour = "#707070", padding_colour = "#505050", background_colour = "#000000", foreground_colour = "#ffffff", padding_pixels = 1, highlight_pixels = 1, shadow_pixels = 1, --de.substyle("active", { -- shadow_colour = "#203040", -- highlight_colour = "#607080", -- padding_colour = "#405060", -- foreground_colour = "#ffffff", --}), border_style = "ridge", transparent_background = true, }) de.defstyle("frame-tiled", { based_on = "frame", spacing = 1, padding_pixels = 0, highlight_pixels = 0, shadow_pixels = 0, }) --de.defstyle("frame-floatframe", { -- based_on = "frame", --}) de.defstyle("tab", { based_on = "*", font = "-*-helvetica-medium-r-normal-*-10-*-*-*-*-*-*-*", de.substyle("active-selected", { shadow_colour = "#304050", highlight_colour = "#708090", background_colour = "#506070", foreground_colour = "#ffffff", }), de.substyle("active-unselected", { shadow_colour = "#203040", highlight_colour = "#607080", background_colour = "#405060", foreground_colour = "#a0a0a0", }), de.substyle("inactive-selected", { shadow_colour = "#404040", highlight_colour = "#909090", background_colour = "#606060", foreground_colour = "#a0a0a0", }), de.substyle("inactive-unselected", { shadow_colour = "#404040", highlight_colour = "#707070", background_colour = "#505050", foreground_colour = "#a0a0a0", }), text_align = "center", transparent_background = true, }) de.defstyle("tab-frame", { based_on = "tab", de.substyle("*-*-*-*-activity", { shadow_colour = "#404040", highlight_colour = "#707070", background_colour = "#990000", foreground_colour = "#eeeeee", }), }) de.defstyle("tab-frame-ionframe", { based_on = "tab-frame", spacing = 1, }) de.defstyle("tab-menuentry", { based_on = "tab", text_align = "left", highlight_pixels = 0, shadow_pixels = 0, }) de.defstyle("tab-menuentry-big", { based_on = "tab-menuentry", font = "-*-helvetica-medium-r-normal-*-*-*-*-*-*-*-*-*", padding_pixels = 7, }) de.defstyle("input", { based_on = "*", shadow_colour = "#404040", highlight_colour = "#707070", background_colour = "#000030", foreground_colour = "#ffffff", padding_pixels = 1, highlight_pixels = 1, shadow_pixels = 1, transparent_background = false, border_style = "elevated", de.substyle("*-cursor", { background_colour = "#ffffff", foreground_colour = "#000000", }), de.substyle("*-selection", { background_colour = "#505050", foreground_colour = "#ffffff", }), }) de.defstyle("input-edln", { based_on = "input", -- this is taken from the URxvt default font on my system. -SP font = "-misc-fixed-medium-r-semicondensed--13-*-*-*-c-60-*-*", }) de.defstyle("input-menu", { based_on = "*", transparent_background = true, de.substyle("active", { shadow_colour = "#304050", highlight_colour = "#708090", background_colour = "#506070", foreground_colour = "#ffffff", }), }) de.defstyle("stdisp", { based_on = "*", shadow_pixels = 0, highlight_pixels = 0, background_colour = "#000000", foreground_colour = "grey", text_align = "left", de.substyle("important", { foreground_colour = "green", }), de.substyle("critical", { foreground_colour = "red", }), de.substyle("actnotify", { foreground_colour = "red", }), }) de.defstyle("actnotify", { based_on = "*", shadow_colour = "#404040", highlight_colour = "#707070", background_colour = "#990000", foreground_colour = "#eeeeee", }) gr.refresh()
lgpl-2.1
hooksta4/darkstar
scripts/zones/Port_Bastok/npcs/Bagnobrok.lua
16
1527
----------------------------------- -- Area: Port Bastok -- NPC: Bagnobrok -- Only sells when Bastok controls Movalpolos -- Confirmed shop stock, August 2013 ----------------------------------- require("scripts/globals/shop"); require("scripts/globals/conquest"); package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil; require("scripts/zones/Port_Bastok/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) RegionOwner = GetRegionOwner(MOVALPOLOS); if (RegionOwner ~= BASTOK) then player:showText(npc,BAGNOBROK_CLOSED_DIALOG); else player:showText(npc,BAGNOBROK_OPEN_DIALOG); stock = { 0x0280, 11, --Copper Ore 0x1162, 694, --Coral Fungus 0x1117, 4032, --Danceshroom 0x0672, 6500, --Kopparnickel Ore 0x142D, 736 --Movalpolos Water } showShop(player,BASTOK,stock); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Port_Bastok/npcs/Bagnobrok.lua
16
1527
----------------------------------- -- Area: Port Bastok -- NPC: Bagnobrok -- Only sells when Bastok controls Movalpolos -- Confirmed shop stock, August 2013 ----------------------------------- require("scripts/globals/shop"); require("scripts/globals/conquest"); package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil; require("scripts/zones/Port_Bastok/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) RegionOwner = GetRegionOwner(MOVALPOLOS); if (RegionOwner ~= BASTOK) then player:showText(npc,BAGNOBROK_CLOSED_DIALOG); else player:showText(npc,BAGNOBROK_OPEN_DIALOG); stock = { 0x0280, 11, --Copper Ore 0x1162, 694, --Coral Fungus 0x1117, 4032, --Danceshroom 0x0672, 6500, --Kopparnickel Ore 0x142D, 736 --Movalpolos Water } showShop(player,BASTOK,stock); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Metalworks/npcs/Lorena.lua
10
2527
----------------------------------- -- Area: Metalworks -- NPC: Lorena -- Type: Blacksmithing Guildworker's Union Representative -- @zone: 237 -- @pos -104.990 1 30.995 ----------------------------------- package.loaded["scripts/zones/Metalworks/TextIDs"] = nil; require("scripts/zones/Metalworks/TextIDs"); require("scripts/globals/keyitems"); require("scripts/globals/crafting"); local keyitems = { [0] = { id = METAL_PURIFICATION, rank = 3, cost = 40000 }, [1] = { id = METAL_ENSORCELLMENT, rank = 3, cost = 40000 }, [2] = { id = CHAINWORK, rank = 3, cost = 10000 }, [3] = { id = SHEETING, rank = 3, cost = 10000 }, [4] = { id = WAY_OF_THE_BLACKSMITH, rank = 9, cost = 20000 } }; local items = { [2] = { id = 15445, rank = 3, cost = 10000 }, [3] = { id = 14831, rank = 5, cost = 70000 }, [4] = { id = 14393, rank = 7, cost = 100000 }, [5] = { id = 153, rank = 9, cost = 150000 }, [6] = { id = 334, rank = 9, cost = 200000 }, [7] = { id = 15820, rank = 6, cost = 80000 }, [8] = { id = 3661, rank = 7, cost = 50000 }, [9] = { id = 3324, rank = 9, cost = 15000 } }; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) unionRepresentativeTrade(player, npc, trade, 0x321, 2); end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) unionRepresentativeTrigger(player, 2, 0x320, "guild_smithing", keyitems); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x320) then unionRepresentativeTriggerFinish(player, option, target, 2, "guild_smithing", keyitems, items); elseif(csid == 0x321) then player:messageSpecial(GP_OBTAINED, option); end end;
gpl-3.0
FishFilletsNG/fillets-data
script/ufo/models.lua
1
3923
createRoom(48, 30, "images/"..codename.."/ufo-pozadi-1.png") setRoomWaves(5, 10, 5) room = addModel("item_fixed", 0, 0, [[ ........XX......XXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXX .......XX......XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ......XX......XXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXX .....XX.......XXXXXXXXXXXXX.....XXXXX.....XXXXX. ....XX........XXXXXXXXXXXXX......XXX.......XXX.. ...XX.........XXXXXXXXXXXX........XX.......XXX.. ..XX..........XXXXX.XXXXX.........X........XXX.. .XX...........XXXXX.XXXXXX.................XXX.. XX.............XXXX..XXXXXX................XXX.. X...............XXX....XXXXX...............XXX.. .................XX.....XX.................XXX.. ..................X........................XX... ..................................X........X.... ..................................X..........X.. ...................X..............XX.........X.. .XXXXXX............XXX............XX.......X.X.. XXXXXXXX...........XXX...........XXX.......XXX.. XXXXXXXXX..........XXX...........XXX.......XXX.. XXXXXXXXXX..........XX.X.........XXX.......XXX.. XXXXXXXXXXX.........XXXX.........XXX.......XXX.. XXXXX....XX.........XXXX.........XXXX......XXX.. XXXX....XXXX.........XXXX........XXXX......XXX.. XXXXX..XXXXX.........XXXXX.......XXXX......XXX.. XXXXXXXXXXXX........XXXXXXXXXXXXXXXXX.....XXXXX. XXXXXXXXXXX........XXXXXXXXXXXXXXXXXXX....XXXXXX XXXXXXXXXXXX.....XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ]]) addItemAnim(room, "images/"..codename.."/ufo-prostredi.png") item_heavy = addModel("item_heavy", 0, 9, [[ .X. .XX XX. X.. X.. X.. X.. ]]) addItemAnim(item_heavy, "images/"..codename.."/15-ocel.png") small = addModel("fish_small", 39, 12, [[ XXX ]]) addFishAnim(small, LOOK_LEFT, "images/fishes/small") big = addModel("fish_big", 38, 14, [[ XXXX XXXX ]]) addFishAnim(big, LOOK_LEFT, "images/fishes/big") item_heavy = addModel("item_heavy", 30, 16, [[ X.X XXX X.X XXX X.X XXX X.X ]]) addItemAnim(item_heavy, "images/"..codename.."/3-ocel.png") item_heavy = addModel("item_heavy", 22, 14, [[ X X X X X ]]) addItemAnim(item_heavy, "images/"..codename.."/5-ocel.png") item_light = addModel("item_light", 36, 19, [[ XXXX ]]) addItemAnim(item_light, "images/"..codename.."/atikad.png") item_heavy = addModel("item_heavy", 19, 12, [[ X X ]]) addItemAnim(item_heavy, "images/"..codename.."/6-ocel.png") item_heavy = addModel("item_heavy", 19, 10, [[ XX X. ]]) addItemAnim(item_heavy, "images/"..codename.."/7-ocel.png") item_heavy = addModel("item_heavy", 19, 7, [[ X. X. XX ]]) addItemAnim(item_heavy, "images/"..codename.."/8-ocel.png") item_light = addModel("item_light", 23, 17, [[ XXX ]]) addItemAnim(item_light, "images/"..codename.."/atikaa.png") item_heavy = addModel("item_heavy", 15, 20, [[ X X X X ]]) addItemAnim(item_heavy, "images/"..codename.."/10-ocel.png") item_heavy = addModel("item_heavy", 15, 24, [[ X X X ]]) addItemAnim(item_heavy, "images/"..codename.."/11-ocel.png") item_heavy = addModel("item_heavy", 12, 8, [[ X.X.. XXXX. ...XX ...X. ...X. ...X. ...X. ...X. ...X. ...X. ...X. ...X. ]]) addItemAnim(item_heavy, "images/"..codename.."/12-ocel.png") item_heavy = addModel("item_heavy", 7, 11, [[ XXXXXXX X...X.. X...... ]]) addItemAnim(item_heavy, "images/"..codename.."/13-ocel.png") dlouha = addModel("item_heavy", 32, 8, [[ X X X X X X X X ]]) addItemAnim(dlouha, "images/"..codename.."/17-ocel.png") item_light = addModel("item_light", 40, 22, [[ XXX ]]) addItemAnim(item_light, "images/"..codename.."/atikac.png") item_light = addModel("item_light", 41, 21, [[ X ]]) addItemAnim(item_light, "images/"..codename.."/hlava_m-_00.png") -- extsize=2; first="hlava m-1.BMP" item_heavy = addModel("item_heavy", 7, 14, [[ X X ]]) addItemAnim(item_heavy, "images/"..codename.."/6-ocel.png")
gpl-2.0
hooksta4/darkstar
scripts/zones/zones/Valkurm_Dunes/npcs/qm4.lua
37
1033
----------------------------------- -- Area: Valkurm Dunes -- NPC: qm4 (???) -- Involved in quest: Pirate's Chart -- @pos -160 4 -131 103 ----------------------------------- package.loaded["scripts/zones/Valkurm_Dunes/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Valkurm_Dunes/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(MONSTERS_KILLED_ADVENTURERS); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
kkragenbrink/shroud-addon
lib/AceGUI-3.0-SharedMediaWidgets/Libs/AceGUI-3.0/widgets/AceGUIContainer-InlineGroup.lua
59
2966
--[[----------------------------------------------------------------------------- InlineGroup Container Simple container widget that creates a visible "box" with an optional title. -------------------------------------------------------------------------------]] local Type, Version = "InlineGroup", 21 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end -- Lua APIs local pairs = pairs -- WoW APIs local CreateFrame, UIParent = CreateFrame, UIParent --[[----------------------------------------------------------------------------- Methods -------------------------------------------------------------------------------]] local methods = { ["OnAcquire"] = function(self) self:SetWidth(300) self:SetHeight(100) self:SetTitle("") end, -- ["OnRelease"] = nil, ["SetTitle"] = function(self,title) self.titletext:SetText(title) end, ["LayoutFinished"] = function(self, width, height) if self.noAutoHeight then return end self:SetHeight((height or 0) + 40) end, ["OnWidthSet"] = function(self, width) local content = self.content local contentwidth = width - 20 if contentwidth < 0 then contentwidth = 0 end content:SetWidth(contentwidth) content.width = contentwidth end, ["OnHeightSet"] = function(self, height) local content = self.content local contentheight = height - 20 if contentheight < 0 then contentheight = 0 end content:SetHeight(contentheight) content.height = contentheight end } --[[----------------------------------------------------------------------------- Constructor -------------------------------------------------------------------------------]] local PaneBackdrop = { bgFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeFile = "Interface\\Tooltips\\UI-Tooltip-Border", tile = true, tileSize = 16, edgeSize = 16, insets = { left = 3, right = 3, top = 5, bottom = 3 } } local function Constructor() local frame = CreateFrame("Frame", nil, UIParent) frame:SetFrameStrata("FULLSCREEN_DIALOG") local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") titletext:SetPoint("TOPLEFT", 14, 0) titletext:SetPoint("TOPRIGHT", -14, 0) titletext:SetJustifyH("LEFT") titletext:SetHeight(18) local border = CreateFrame("Frame", nil, frame) border:SetPoint("TOPLEFT", 0, -17) border:SetPoint("BOTTOMRIGHT", -1, 3) border:SetBackdrop(PaneBackdrop) border:SetBackdropColor(0.1, 0.1, 0.1, 0.5) border:SetBackdropBorderColor(0.4, 0.4, 0.4) --Container Support local content = CreateFrame("Frame", nil, border) content:SetPoint("TOPLEFT", 10, -10) content:SetPoint("BOTTOMRIGHT", -10, 10) local widget = { frame = frame, content = content, titletext = titletext, type = Type } for method, func in pairs(methods) do widget[method] = func end return AceGUI:RegisterAsContainer(widget) end AceGUI:RegisterWidgetType(Type, Constructor, Version)
mit
RAlexis/ArcEmu_MoP
src/scripts/lua/LuaBridge/AUCHINDOUN/SHADOW_LABYRINTH/blackheart.lua
13
4516
--?!MAP=555 assert( include("shadowlabyrinth.lua") , "Failed to load shadowlabyrinth.lua") local mod = require("DUNGEON_AUCHINDOUN.INSTANCE_SHADOW_LABYRINTH") assert(mod) module(mod._NAME..".BLACKHEART_THE_INCITER",package.seeall) local self = getfenv(1) function OnSpawn(unit) local say = math.random(1,3) if(say == 1) then unit:PlaySoundToSet(10482) unit:MonsterYell("All flesh must burn!") elseif(say == 2) then unit:MonsterYell("All creation must be unmade!") unit:PlaySoundToSet(10483) elseif(say == 3) then unit:PlaySoundToSet(10484) unit:MonsterYell("Power will be yours!") elseif(say == 4) then unit:PlaySoundToSet(10492) unit:MonsterYell("Be ready for Dark One's return.") elseif(say == 5) then unit:MonsterYell("So we have place new universe!") unit:PlaySoundToSet(10493) else unit:MonsterYell("Dark One... promise...") unit:PlaySoundToSet(10494) end end function OnCombat(unit) self[tostring(unit)] = { stomp = math.random(15,30), charge = math.random(15,30), incite = 20 } local say = math.random(1,6) if(say == 1) then unit:PlaySoundToSet(10486) unit:MonsterYell("You'll be sorry!") elseif(say == 2) then unit:PlaySoundToSet(10487) unit:MonsterYell("Time for fun!") elseif(say == 3) then unit:PlaySoundToSet(10488) unit:MonsterYell("I see dead people!") elseif(say == 4) then unit:PlaySoundToSet(10497) unit:MonsterYell("Time to kill!") else unit:PlaySoundToSet(10498) unit:MonsterYell("YOU be dead people.") end unit:RegisterAIUpdateEvent(1000) local allies = unit:GetInRangeFriends() for _,v in pairs(allies) do if(unit:GetDistanceYards(v) <= 100) then local target = v:GetRandomEnemy() v:AttackReaction(target,1,0) end end end function OnWipe(unit) self[tostring(unit)] = nil unit:RemoveAIUpdateEvent(1000) unit:RemoveEvents() end function OnKill(unit) local say = math.random(1,4) if(say == 1) then unit:PlaySoundToSet(10489) unit:MonsterYell("NO coming back for you!") elseif(say == 2) then unit:PlaySoundToSet(10490) unit:MonsterYell("Nice try!") elseif(say == 3) then unit:PlaySoundToSet(10499) unit:MonsterYell("Now you gone for good!") else unit:PlaySoundToSet(10500) unit:MonsterYell("You fail!") end end function OnDeath(unit) local say = math.random(0,1) if(say) then unit:PlaySoundToSet(10491) unit:MonsterYell("This no... good..") else unit:PlaySoundToSet(10501) unit:MonsterYell("<screaming>") end local gate = unit:GetGameObjectNearestCoords(-375.146210,-39.748650,12.688822,183296) if(gate) then gate:Open() end end function InciteEvent(unit,phase) if(phase == 1) then unit:FullCastSpell(33676) unit:RegisterLuaEvent(InciteEvent,3000,0,2) elseif(phase == 2) then local target = unit:GetRandomEnemy() unit:SetNextTarget(target) unit:Emote(LCF.EMOTE_ONESHOT_LAUGH,0) else unit:RemoveEvents() unit:DisableMelee(false) local enemy = unit:GetRandomEnemy() unit:AttackReaction(enemy,1,0) unit:RegisterAIUpdateEvent(1000) end end function AIUpdate(unit) if(unit:IsCasting() ) then return end if(unit:GetNextTarget() == nil) then unit:WipeThreatList() return end local vars = self[tostring(unit)] vars.stomp = vars.stomp - 1 vars.charge = vars.charge - 1 vars.incite = vars.incite - 1 if(vars.incite <= 0) then vars.incite = 40 unit:RemoveAIUpdateEvent() unit:DisableMelee(true) unit:PlaySoundToSet(10487) unit:MonsterYell("Time for fun!") unit:RegisterLuaEvent(InciteEvent,3000,1,1) unit:RegisterLuaEvent(InciteEvent,15000,1,3) elseif(vars.stomp <= 0) then unit:FullCastSpell(33707) vars.stomp = math.random(20,30) vars.charge = 1 elseif(vars.charge <= 0) then local target = unit:GetRandomEnemy() unit:FullCastSpellOnTarget(33709,target) vars.charge = math.random(20,30) end end RegisterUnitEvent(18667,18,OnSpawn) RegisterUnitEvent(18667,1,OnCombat) RegisterUnitEvent(18667,2,OnWipe) RegisterUnitEvent(18667,3,OnKill) RegisterUnitEvent(18667,4,OnDeath) RegisterUnitEvent(18667,21,AIUpdate) function InciteChaosEffect(_,spell) local caster = spell:GetCaster() local enemies = caster:GetInRangeEnemies() for _,v in pairs(enemies) do caster:FullCastSpellOnTarget(33684,v) if(v:IsPlayer() ) then v:UseAI(true) end v:FlagFFA(true) v:RegisterLuaEvent(InciteChaosEnd,15000,1) end end function InciteChaosEnd(victim) if(victim:IsPlayer() ) then victim:UseAI(false) end victim:FlagFFA(false) end RegisterDummySpell(33676,InciteChaosEffect) --todo script player behavior under mc.
agpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Port_Windurst/npcs/Pyo_Nzon.lua
36
2750
----------------------------------- -- Area: Port Windurst -- NPC: Pyo Nzon ----------------------------------- package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/settings"); require("scripts/zones/Port_Windurst/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) TruthJusticeOnionWay = player:getQuestStatus(WINDURST,TRUTH_JUSTICE_AND_THE_ONION_WAY); KnowOnesOnions = player:getQuestStatus(WINDURST,KNOW_ONE_S_ONIONS); InspectorsGadget = player:getQuestStatus(WINDURST,INSPECTOR_S_GADGET); OnionRings = player:getQuestStatus(WINDURST,ONION_RINGS); CryingOverOnions = player:getQuestStatus(WINDURST,CRYING_OVER_ONIONS); ThePromise = player:getQuestStatus(WINDURST,THE_PROMISE); if (ThePromise == QUEST_COMPLETED) then Message = math.random(0,1) if (Message == 1) then player:startEvent(0x021b); else player:startEvent(0x020f); end elseif (ThePromise == QUEST_ACCEPTED) then player:startEvent(0x0205); elseif (CryingOverOnions == QUEST_COMPLETED) then player:startEvent(0x01fe); elseif (CryingOverOnions == QUEST_ACCEPTED) then player:startEvent(0x01f6); elseif (OnionRings == QUEST_COMPLETED) then player:startEvent(0x01bb); elseif (OnionRings == QUEST_ACCEPTED ) then player:startEvent(0x01b5); elseif (InspectorsGadget == QUEST_COMPLETED) then player:startEvent(0x01aa); elseif (InspectorsGadget == QUEST_ACCEPTED) then player:startEvent(0x01a2); elseif (KnowOnesOnions == QUEST_COMPLETED) then player:startEvent(0x0199); elseif (KnowOnesOnions == QUEST_ACCEPTED) then KnowOnesOnionsVar = player:getVar("KnowOnesOnions"); if (KnowOnesOnionsVar == 2) then player:startEvent(0x0198); else player:startEvent(0x018c); end elseif (TruthJusticeOnionWay == QUEST_COMPLETED) then player:startEvent(0x017e); elseif (TruthJusticeOnionWay == QUEST_ACCEPTED) then player:startEvent(0x0177); else player:startEvent(0x016e); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID2: %u",csid); --printf("RESULT2: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
AnySDK/Sample_Lua
src/cocos/cocostudio/DeprecatedCocoStudioFunc.lua
39
3421
--tip local function deprecatedTip(old_name,new_name) print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") end --functions of GUIReader will be deprecated begin local GUIReaderDeprecated = { } function GUIReaderDeprecated.shareReader() deprecatedTip("GUIReader:shareReader","ccs.GUIReader:getInstance") return ccs.GUIReader:getInstance() end GUIReader.shareReader = GUIReaderDeprecated.shareReader function GUIReaderDeprecated.purgeGUIReader() deprecatedTip("GUIReader:purgeGUIReader","ccs.GUIReader:destroyInstance") return ccs.GUIReader:destroyInstance() end GUIReader.purgeGUIReader = GUIReaderDeprecated.purgeGUIReader --functions of GUIReader will be deprecated end --functions of SceneReader will be deprecated begin local SceneReaderDeprecated = { } function SceneReaderDeprecated.sharedSceneReader() deprecatedTip("SceneReader:sharedSceneReader","ccs.SceneReader:getInstance") return ccs.SceneReader:getInstance() end SceneReader.sharedSceneReader = SceneReaderDeprecated.sharedSceneReader function SceneReaderDeprecated.purgeSceneReader(self) deprecatedTip("SceneReader:purgeSceneReader","ccs.SceneReader:destroyInstance") return self:destroyInstance() end SceneReader.purgeSceneReader = SceneReaderDeprecated.purgeSceneReader --functions of SceneReader will be deprecated end --functions of ccs.GUIReader will be deprecated begin local CCSGUIReaderDeprecated = { } function CCSGUIReaderDeprecated.purgeGUIReader() deprecatedTip("ccs.GUIReader:purgeGUIReader","ccs.GUIReader:destroyInstance") return ccs.GUIReader:destroyInstance() end ccs.GUIReader.purgeGUIReader = CCSGUIReaderDeprecated.purgeGUIReader --functions of ccs.GUIReader will be deprecated end --functions of ccs.ActionManagerEx will be deprecated begin local CCSActionManagerExDeprecated = { } function CCSActionManagerExDeprecated.destroyActionManager() deprecatedTip("ccs.ActionManagerEx:destroyActionManager","ccs.ActionManagerEx:destroyInstance") return ccs.ActionManagerEx:destroyInstance() end ccs.ActionManagerEx.destroyActionManager = CCSActionManagerExDeprecated.destroyActionManager --functions of ccs.ActionManagerEx will be deprecated end --functions of ccs.SceneReader will be deprecated begin local CCSSceneReaderDeprecated = { } function CCSSceneReaderDeprecated.destroySceneReader(self) deprecatedTip("ccs.SceneReader:destroySceneReader","ccs.SceneReader:destroyInstance") return self:destroyInstance() end ccs.SceneReader.destroySceneReader = CCSSceneReaderDeprecated.destroySceneReader --functions of ccs.SceneReader will be deprecated end --functions of CCArmatureDataManager will be deprecated begin local CCArmatureDataManagerDeprecated = { } function CCArmatureDataManagerDeprecated.sharedArmatureDataManager() deprecatedTip("CCArmatureDataManager:sharedArmatureDataManager","ccs.ArmatureDataManager:getInstance") return ccs.ArmatureDataManager:getInstance() end CCArmatureDataManager.sharedArmatureDataManager = CCArmatureDataManagerDeprecated.sharedArmatureDataManager function CCArmatureDataManagerDeprecated.purge() deprecatedTip("CCArmatureDataManager:purge","ccs.ArmatureDataManager:destoryInstance") return ccs.ArmatureDataManager:destoryInstance() end CCArmatureDataManager.purge = CCArmatureDataManagerDeprecated.purge --functions of CCArmatureDataManager will be deprecated end
mit
gedadsbranch/Darkstar-Mission
scripts/globals/spells/spirited_etude.lua
13
1759
----------------------------------------- -- Spell: Spirited Etude -- Static MND Boost, BRD 24 ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) local sLvl = caster:getSkillLevel(SKILL_SNG); -- Gets skill level of Singing local iLvl = caster:getWeaponSkillLevel(SLOT_RANGED); local power = 0; if (sLvl+iLvl <= 181) then power = 3; elseif((sLvl+iLvl >= 182) and (sLvl+iLvl <= 235)) then power = 4; elseif((sLvl+iLvl >= 236) and (sLvl+iLvl <= 288)) then power = 5; elseif((sLvl+iLvl >= 289) and (sLvl+iLvl <= 342)) then power = 6; elseif((sLvl+iLvl >= 343) and (sLvl+iLvl <= 396)) then power = 7; elseif((sLvl+iLvl >= 397) and (sLvl+iLvl <= 449)) then power = 8; elseif(sLvl+iLvl >= 450) then power = 9; end local iBoost = caster:getMod(MOD_ETUDE_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT); power = power + iBoost; if (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then power = power * 2; elseif (caster:hasStatusEffect(EFFECT_MARCATO)) then power = power * 1.5; end caster:delStatusEffect(EFFECT_MARCATO); local duration = 120; duration = duration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1); if (caster:hasStatusEffect(EFFECT_TROUBADOUR)) then duration = duration * 2; end if not (target:addBardSong(caster,EFFECT_ETUDE,power,0,duration,caster:getID(), MOD_MND, 1)) then spell:setMsg(75); end return EFFECT_ETUDE; end;
gpl-3.0
dberga/arcbliz
src/scripts/lua/LuaBridge/AUCHINDOUN/AUCHENAI_CRYPTS/shirrak.lua
13
2873
--?!MAP=558 assert( include("acrypts.lua") , "Failed to load acrypts.lua") local mod = require("DUNGEON_AUCHINDOUN.INSTANCE_ACRYPTS") assert(mod) module(mod._NAME..".SHIRRAK_THE_DEAD_WATCHER",package.seeall) local self = getfenv(1) local FocusFire; --WorldDBQuery("DELETE FROM ai_agents WHERE entry = 18371;") function OnCombat(unit,_,mAggro) self[tostring(unit)] = { bite = math.random(8,12), inhibit = math.random(2,5), attract = math.random(20,30), f_fire = 2, heroic = (mAggro:IsPlayer() and TO_PLAYER(mAggro):IsHeroic() ) } unit:RegisterAIUpdateEvent(1000) end function OnWipe(unit) unit:RemoveAIUpdateEvent() unit:RemoveEvents() unit:StopChannel() self[tostring(unit)] = nil unit:DisableCombat(false) end function AIUpdate(unit) if(unit:IsCasting() ) then return end if(unit:GetNextTarget() == nil) then unit:WipeThreatList() return end local vars = self[tostring(unit)] vars.bite = vars.bite - 1 vars.inhibit = vars.inhibit - 1 vars.attract = vars.attract - 1 vars.f_fire = vars.f_fire - 1 if(vars.f_fire <= 0) then FocusFire(unit,1) vars.f_fire = math.random(20,25) +3 elseif(vars.inhibit <= 0) then print("Inhibit") unit:FullCastSpell(32264) vars.inhibit = math.random(2,5) elseif(vars.bite <= 0) then print("Bite") if(vars.isHeroic) then unit:FullCastSpell(39382) else unit:FullCastSpell(36383) end vars.bite = math.random(8,12) elseif(vars.attract <= 0) then print("Attract") unit:FullCastSpell(32265) vars.bite = 0 -- have him bite asap. vars.attract = math.random(20,30) end end function FocusFire(unit,spell_phase) -- HACKS! if(spell_phase == 1) then local target = unit:GetRandomEnemy() unit:BossRaidEmote(unit:GetInfo().Name.." focuses his energy on "..TO_PLAYER(target):GetName() ) unit:DisableCombat(true) unit:ChannelSpell(43515,target) unit:SetChannelTarget(target) unit:RegisterEvent(FocusFire,4000,1,2) elseif(spell_phase == 2) then local target = unit:GetChannelTarget() unit:SetChannelTarget(nil) local focus = target:SpawnLocalCreature(18374,unit:GetFaction(),0) focus:SetUnselectable() focus:SetUnattackable() focus:DisableCombat(true) focus:SetDisplayID(17200) unit:FullCastSpellOnTarget(32300,focus) unit:DisableCombat(false) unit:SetCreatedBy(focus) unit:RegisterEvent(FocusFire,1500,1,3) elseif(spell_phase == 3) then local focus = TO_CREATURE(unit:GetCreatedBy() ) unit:SetCreatedBy(nil) if(self[tostring(unit)].isHeroic) then for i = 1,math.random(3,6) do focus:EventCastSpell(focus,20203,i*500,1) end else for i = 1,math.random(3,6) do focus:EventCastSpell(focus,23462,i*500,1) end end focus:Despawn(3500,0) end end function FocusFire_Explode(unit,spell) unit:FullCastSpell(spell) end RegisterUnitEvent(18371,1,OnCombat) RegisterUnitEvent(18371,2,OnWipe) RegisterUnitEvent(18371,21,AIUpdate)
agpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Aht_Urhgan_Whitegate/npcs/Bhoy_Yhupplo.lua
30
3598
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Bhoy Yhupplo -- Type: Assault Mission Giver -- @pos 127.474 0.161 -30.418 50 ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); require("scripts/globals/besieged"); require("scripts/globals/missions"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local rank = getMercenaryRank(player); local haveimperialIDtag; local assaultPoints = player:getAssaultPoint(ILRUSI_ASSAULT_POINT); if (player:hasKeyItem(IMPERIAL_ARMY_ID_TAG)) then haveimperialIDtag = 1; else haveimperialIDtag = 0; end if (rank > 0) then player:startEvent(277,rank,haveimperialIDtag,assaultPoints,player:getCurrentAssault()); else player:startEvent(283); -- no rank end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 277) then local selectiontype = bit.band(option, 0xF); if (selectiontype == 1) then -- taken assault mission player:addAssault(bit.rshift(option,4)); player:delKeyItem(IMPERIAL_ARMY_ID_TAG); player:addKeyItem(ILRUSI_ASSAULT_ORDERS); player:messageSpecial(KEYITEM_OBTAINED,ILRUSI_ASSAULT_ORDERS); elseif (selectiontype == 2) then -- purchased an item local item = bit.rshift(option,14); local itemID = 0; local price = 0; -- Copy/pasted from Famad, TODO: fill in the actual IDs/prices for Bhoy Yhupplo --[[if (item == 1) then itemID = 15972; price = 3000; elseif (item == 2) then itemID = 15777; price = 5000; elseif (item == 3) then itemID = 15523; price = 8000; elseif (item == 4) then itemID = 15886; price = 10000; elseif (item == 5) then itemID = 15492; price = 10000; elseif (item == 6) then itemID = 18583; price = 10000; elseif (item == 7) then itemID = 18388; price = 15000; elseif (item == 8) then itemID = 18417; price = 15000; elseif (item == 9) then itemID = 14940; price = 15000; elseif (item == 10) then itemID = 15690; price = 20000; elseif (item == 11) then itemID = 14525; price = 20000; else return; end player:addItem(itemID); player:messageSpecial(ITEM_OBTAINED,itemID); player:delAssaultPoint(LEBROS_ASSAULT_POINT,price);]] end end end;
gpl-3.0
AnySDK/Sample_Lua
frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/Animation.lua
10
4139
-------------------------------- -- @module Animation -- @extend Ref -- @parent_module cc -------------------------------- -- Gets the times the animation is going to loop. 0 means animation is not animated. 1, animation is executed one time, ... -- @function [parent=#Animation] getLoops -- @param self -- @return unsigned int#unsigned int ret (return value: unsigned int) -------------------------------- -- Adds a SpriteFrame to a Animation.<br> -- The frame will be added with one "delay unit". -- @function [parent=#Animation] addSpriteFrame -- @param self -- @param #cc.SpriteFrame frame -------------------------------- -- Sets whether to restore the original frame when animation finishes -- @function [parent=#Animation] setRestoreOriginalFrame -- @param self -- @param #bool restoreOriginalFrame -------------------------------- -- -- @function [parent=#Animation] clone -- @param self -- @return Animation#Animation ret (return value: cc.Animation) -------------------------------- -- Gets the duration in seconds of the whole animation. It is the result of totalDelayUnits * delayPerUnit -- @function [parent=#Animation] getDuration -- @param self -- @return float#float ret (return value: float) -------------------------------- -- Sets the array of AnimationFrames -- @function [parent=#Animation] setFrames -- @param self -- @param #array_table frames -------------------------------- -- Gets the array of AnimationFrames -- @function [parent=#Animation] getFrames -- @param self -- @return array_table#array_table ret (return value: array_table) -------------------------------- -- Sets the times the animation is going to loop. 0 means animation is not animated. 1, animation is executed one time, ... -- @function [parent=#Animation] setLoops -- @param self -- @param #unsigned int loops -------------------------------- -- Sets the delay in seconds of the "delay unit" -- @function [parent=#Animation] setDelayPerUnit -- @param self -- @param #float delayPerUnit -------------------------------- -- Adds a frame with an image filename. Internally it will create a SpriteFrame and it will add it.<br> -- The frame will be added with one "delay unit".<br> -- Added to facilitate the migration from v0.8 to v0.9. -- @function [parent=#Animation] addSpriteFrameWithFile -- @param self -- @param #string filename -------------------------------- -- Gets the total Delay units of the Animation. -- @function [parent=#Animation] getTotalDelayUnits -- @param self -- @return float#float ret (return value: float) -------------------------------- -- Gets the delay in seconds of the "delay unit" -- @function [parent=#Animation] getDelayPerUnit -- @param self -- @return float#float ret (return value: float) -------------------------------- -- Checks whether to restore the original frame when animation finishes. -- @function [parent=#Animation] getRestoreOriginalFrame -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- Adds a frame with a texture and a rect. Internally it will create a SpriteFrame and it will add it.<br> -- The frame will be added with one "delay unit".<br> -- Added to facilitate the migration from v0.8 to v0.9. -- @function [parent=#Animation] addSpriteFrameWithTexture -- @param self -- @param #cc.Texture2D pobTexture -- @param #rect_table rect -------------------------------- -- @overload self, array_table, float, unsigned int -- @overload self -- @function [parent=#Animation] create -- @param self -- @param #array_table arrayOfAnimationFrameNames -- @param #float delayPerUnit -- @param #unsigned int loops -- @return Animation#Animation ret (return value: cc.Animation) -------------------------------- -- -- @function [parent=#Animation] createWithSpriteFrames -- @param self -- @param #array_table arrayOfSpriteFrameNames -- @param #float delay -- @param #unsigned int loops -- @return Animation#Animation ret (return value: cc.Animation) return nil
mit
FishFilletsNG/fillets-data
script/briefcase/dialogs_ru.lua
1
9379
dialogId("kuf-m-je", "font_small", "Oh no, not again...") dialogStr("О нет, только не это опять...") dialogId("kuf-v-noco", "font_big", "You know there’s nothing we can do about it.") dialogStr("Ты ведь знаешь, мы ничего не можем с этим поделать.") dialogId("kuf-v-hod", "font_big", "Let’s push it down so we can take a look at it.") dialogStr("Давай столкнём его вниз, чтобы посмотреть на это.") dialogId("kuf-v-doprace", "font_big", "Well, let’s get to work.") dialogStr("Что ж, за работу.") dialogId("kuf-v-dotoho", "font_big", "So, now we can finally get started.") dialogStr("Итак, теперь мы можем, наконец, начать.") dialogId("kuf-m-ven", "font_small", "Our first task is to get out of this room.") dialogStr("Наша первая задача — выбраться из этой комнаты.") dialogId("kuf-v-ukol", "font_big", "This, by the way, is going to be our task in all the other rooms as well.") dialogStr("Впрочем, это будет нашей задачей и во всех остальных помещениях.") dialogId("kuf-v-jeste", "font_big", "Should we watch it again?") dialogStr("Может, стоит посмотреть это видео еще раз?") dialogId("kuf-m-disk", "font_small", "How? The disk self-destructed.") dialogStr("Как? Диск автоматически уничтожился.") dialogId("kuf-v-restart", "font_big", "We could restart the level.") dialogStr("Мы можем перезапустить уровень.") dialogId("kuf-m-pravda", "font_small", "That’s true...") dialogStr("Да, действительно.") dialogId("kuf-m-dodilny", "font_small", "Come on, let’s take the player into the workshop and show him the work safety regulations.") dialogStr("Ладно, пойдём покажем игроку нашу мастерскую и расскажем о правилах техники безопасности.") dialogId("kuf-v-napad", "font_big", "Good idea.") dialogStr("Хорошая идея.") dialogId("kuf-m-nezvednu", "font_small", "I can’t lift it. Can you give it a try?") dialogStr("Я не могу поднять это. Может, ты попробуешь?") dialogId("kuf-m-kousek", "font_small", "Just a little bit higher so I can swim underneath you.") dialogStr("Ещё чуточку выше, чтобы я смогла проплыть под тобой.") dialogId("help1", "font_small", "For now, don’t touch anything, just watch and learn. We’ll show you what you should and shouldn’t do with us as well as what things we’re capable of.") dialogStr("А теперь ничего не трогайте, просто смотрите и запоминайте. Мы покажем, что следует, а чего не следует делать с нами, а также на что мы умеем.") dialogId("help2", "font_big", "Before entering the workshop, let’s save the game - just press the F2 key.") dialogStr("Прежде чем начнём, давайте сохраним игру — просто нажмите клавишу F2.") dialogId("help3", "font_small", "First we’ll show you what can hurt us.") dialogStr("Сперва мы покажем, как можно сделать нам больно.") dialogId("help4", "font_big", "I’ll volunteer to be the dummy.") dialogStr("Выступаю добровольцем на роль подопытного.") dialogId("help5", "font_small", "First of all, we shouldn’t drop things on each other.") dialogStr("Прежде всего, нам не следует скидывать вещи друг на друга.") dialogId("help6", "font_small", "We also can’t swim downwards when carrying an object, because it would fall on us.") dialogStr("Также мы не можем плыть вниз, если держим какой-либо предмет, потому что он упадёт и раздавит нас.") dialogId("help7", "font_big", "Now we’ll start again - or we can load the saved game by pressing the F3 key.") dialogStr("Теперь нам остаётся либо начать сначала, либо загрузить игру с помощью клавиши F3 (не нажимайте).") dialogId("help8", "font_big", "And now we’re back where we last saved the game.") dialogStr("Теперь мы вернулись к моменту последнего сохранения игры.") dialogId("help9", "font_small", "Another thing we must not do is push objects along our back.") dialogStr("Ещё одна вещь, которую нам не следует делать, — это толкать предмет, лежащий на спине товарища.") dialogId("help10", "font_small", "Some objects are shaped in such a way that we could hold them and push them at the same time - but we’re not allowed to do this either.") dialogStr("Некоторые предметы имеют форму, позволяющую одновременно поднимать и толкать их в сторону. Но так делать тоже не стоит.") dialogId("help11", "font_big", "Again, we load a saved game by pressing the F3 key.") dialogStr("Итак, мы снова загружаем сохранённую игру нажатием клавишы F3.") dialogId("help12", "font_small", "We also can’t drop additional objects on a pile that one of us is carrying.") dialogStr("Также мы не можем скидывать предметы на другие предметы, если их держит товарищ.") dialogId("help13", "font_small", "And unlike my bigger partner, I can’t move or even carry steel objects.") dialogStr("И, в отличие от своего сильного друга, я не могу двигать и поднимать стальные предметы.") dialogId("help14", "font_big", "We have loaded our saved game for the last time. Now we’ll show you all the things we’re capable of.") dialogStr("Мы снова загрузили игру. Обещаем, это был последний раз. Теперь мы покажем Вам, что мы умеем.") dialogId("help15", "font_small", "We can always pick up objects and then let them fall.") dialogStr("Мы всегда можем поднять предмет, а затем, выплыв из-под него, уронить.") dialogId("help16", "font_small", "We can push an object along each other’s back only if the object will then be pushed onto another support...") dialogStr("Мы можем двигать предметы, которые лежат на спине партнёра, только если в результате движения предмет окажется на опоре...") dialogId("help17", "font_small", "... and even let it drop on each other in this case.") dialogStr("...и даже скидывать их друг на друга в таком случае.") dialogId("help18", "font_small", "I can even do this alone... I can swim down under it... or put it on this ledge.") dialogStr("Я даже могу сделать это одна — заплыть под этот молоток и положить его на выступ.") dialogId("help19", "font_small", "We can also push one object along the top of another object which we are supporting, but we can’t move the object that is directly on our back.") dialogStr("Также мы можем подвинуть предмет, находящийся на другом, который, в свою очередь, держит напарник. Главное — не двигать предмет, лежащий непосредственно на спине товарища.") dialogId("help20", "font_big", "We can also swim freely under an object which we are supporting and pass it to the other fish.") dialogStr("С таким же успехом мы можем перемещаться под предметами, которые держим, и передавать их напарнику.") dialogId("help21", "font_small", "And we can push objects off of each other’s back, as long as the object falls down immediately.") dialogStr("А также двигать предмет, который держит напарник, при условии, что он сразу же упадёт вниз.") dialogId("help22", "font_big", "That’s about it for the rules. If you want to know more, press F1 and read the help section.") dialogStr("Вот, вроде бы, и всё о правилах. Если что, Вы можете нажать F1 для вызова справки.") dialogId("help23", "font_small", "In summary, we can only lift objects, let them drop, push them along a solid surface, push them onto a surface, and push them off of each other.") dialogStr("Итак, мы можем поднимать предметы, скидывать их вниз, двигать по твёрдой поверхности, класть их на поверхность и сбрасывать друг с друга.")
gpl-2.0
hooksta4/darkstar
scripts/zones/zones/Dynamis-Qufim/mobs/Manifest_Icon.lua
1
2195
----------------------------------- -- Area: Dynamis-Qufim -- NPC: Manifest_Icon ----------------------------------- package.loaded["scripts/zones/Dynamis-Qufim/TextIDs"] = nil; ----------------------------------- require("scripts/globals/dynamis"); require("scripts/zones/Dynamis-Qufim/TextIDs"); ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) mob:setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); end; ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) local X = mob:getXPos(); local Y = mob:getYPos(); local Z = mob:getZPos(); local spawnList = QufimYagudoList; --printf(" statueID => mob %u \n",mob:getID()); if (mob:getStatPoppedMobs() == false) then mob:setStatPoppedMobs(true); for nb = 1, table.getn(spawnList), 2 do if (mob:getID() == spawnList[nb]) then -- si l'id du mob engager correpond a un ID de la list for nbi = 1, table.getn(spawnList[nb + 1]), 1 do if ((nbi % 2) == 0) then X=X+2; Z=Z+2; else X=X-2; Z=Z-2; end local mobNBR = spawnList[nb + 1][nbi]; -- printf("Serjeant_Tombstone => mob %u \n",mobNBR); if (mobNBR ~= nil) then -- Spawn Mob SpawnMob(mobNBR):setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); GetMobByID(mobNBR):setPos(X,Y,Z); GetMobByID(mobNBR):setSpawn(X,Y,Z); -- Spawn Pet for BST, DRG, and SMN local MJob = GetMobByID(mobNBR):getMainJob(); -- printf("Serjeant_Tombstone => mob %u \n",mobNBR); -- printf("mobjob %u \n",MJob); if (MJob == 9 or MJob == 14 or MJob == 15) then -- Spawn Pet for BST , DRG , and SMN SpawnMob(mobNBR + 1):setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); GetMobByID(mobNBR + 1):setPos(X,Y,Z); GetMobByID(mobNBR + 1):setSpawn(X,Y,Z); end end end end end end end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob,killer) killer:addCurrency("mweya_plasm",10); killer:PrintToPlayer( "You earned 10 Mweya Plasm!"); --local mobID = mob:getID(); end;
gpl-3.0
hooksta4/darkstar
scripts/globals/items/handful_of_roasted_almonds.lua
36
1079
----------------------------------------- -- ID: 5649 -- Item: Handful of Roasted Almonds -- Food Effect: 5Min, All Races ----------------------------------------- -- HP 30 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) result = 0 if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,300,5649); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 30); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 30); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Mhaura/npcs/Emyr.lua
19
1051
----------------------------------- -- Area: Mhaura -- NPC: Emyr -- Type: Standard NPC -- @pos 45.021 -9 37.095 249 ----------------------------------- package.loaded["scripts/zones/Mhaura/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Mhaura/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getZPos() >= 39) then player:startEvent(0x00E4); else player:startEvent(0x00DF); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
m13790115/Fast-and-farioo
plugins/stats.lua
236
3989
do -- Returns a table with `name` and `msgs` local function get_msgs_user_chat(user_id, chat_id) local user_info = {} local uhash = 'user:'..user_id local user = redis:hgetall(uhash) local um_hash = 'msgs:'..user_id..':'..chat_id user_info.msgs = tonumber(redis:get(um_hash) or 0) user_info.name = user_print_name(user)..' ['..user_id..']' return user_info end local function chat_stats(chat_id) -- Users on chat local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) local users_info = {} -- Get user info for i = 1, #users do local user_id = users[i] local user_info = get_msgs_user_chat(user_id, chat_id) table.insert(users_info, user_info) end -- Sort users by msgs number table.sort(users_info, function(a, b) if a.msgs and b.msgs then return a.msgs > b.msgs end end) local text = 'users in this chat \n' for k,user in pairs(users_info) do text = text..user.name..' = '..user.msgs..'\n' end local file = io.open("./groups/"..chat_id.."stats.txt", "w") file:write(text) file:flush() file:close() send_document("chat#id"..chat_id,"./groups/"..chat_id.."stats.txt", ok_cb, false) return --text end local function chat_stats2(chat_id) -- Users on chat local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) local users_info = {} -- Get user info for i = 1, #users do local user_id = users[i] local user_info = get_msgs_user_chat(user_id, chat_id) table.insert(users_info, user_info) end -- Sort users by msgs number table.sort(users_info, function(a, b) if a.msgs and b.msgs then return a.msgs > b.msgs end end) local text = 'users in this chat \n' for k,user in pairs(users_info) do text = text..user.name..' = '..user.msgs..'\n' end return text end -- Save stats, ban user local function bot_stats() local redis_scan = [[ local cursor = '0' local count = 0 repeat local r = redis.call("SCAN", cursor, "MATCH", KEYS[1]) cursor = r[1] count = count + #r[2] until cursor == '0' return count]] -- Users local hash = 'msgs:*:'..our_id local r = redis:eval(redis_scan, 1, hash) local text = 'Users: '..r hash = 'chat:*:users' r = redis:eval(redis_scan, 1, hash) text = text..'\nGroups: '..r return text end local function run(msg, matches) if matches[1]:lower() == 'teleseed' then -- Put everything you like :) local about = _config.about_text local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] used /teleseed ") return about end if matches[1]:lower() == "statslist" then if not is_momod(msg) then return "For mods only !" end local chat_id = msg.to.id local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ") return chat_stats2(chat_id) end if matches[1]:lower() == "stats" then if not matches[2] then if not is_momod(msg) then return "For mods only !" end if msg.to.type == 'chat' then local chat_id = msg.to.id local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ") return chat_stats(chat_id) else return end end if matches[2] == "teleseed" then -- Put everything you like :) if not is_admin(msg) then return "For admins only !" else return bot_stats() end end if matches[2] == "group" then if not is_admin(msg) then return "For admins only !" else return chat_stats(matches[3]) end end end end return { patterns = { "^[!/]([Ss]tats)$", "^[!/]([Ss]tatslist)$", "^[!/]([Ss]tats) (group) (%d+)", "^[!/]([Ss]tats) (teleseed)",-- Put everything you like :) "^[!/]([Tt]eleseed)"-- Put everything you like :) }, run = run } end
gpl-2.0
FishFilletsNG/fillets-data
script/reef/dialogs_pl.lua
1
2474
dialogId("uts-m-otresy", "font_small", "My goodness, the impact created cave-in!") dialogStr("A niech to, uderzenie spowodowało zawał!") dialogId("uts-v-projet0", "font_big", "I can’t go through this cave-in, we have to find another exit.") dialogStr("Nie przepłynę przez ten zawał. Musimy znaleźć inne wyjście.") dialogId("uts-v-projet1", "font_big", "This is not the way.") dialogStr("Tędy się nie przecisnę.") dialogId("uts-v-sam", "font_big", "I won’t make it alone.") dialogStr("Sam nie dam rady.") dialogId("uts-m-lastura", "font_small", "I probably should have had lifted that shell first.") dialogStr("Chyba powinnam była najpierw podnieść tę muszlę...") dialogId("uts-v-poradi", "font_big", "Maybe we have to switch these objects.") dialogStr("Może powinniśmy zamienić te przedmioty miejscami?") dialogId("uts-m-matrace", "font_small", "A mattress. The best thing you can get under water.") dialogStr("Materac. Najlepsze, co możesz znaleźć pod wodą.") dialogId("uts-m-snek", "font_small", "Now we can drop the snail on the mattress.") dialogStr("Teraz możemy zrzucić ślimaka na materac.") dialogId("uts-m-nezvedneme", "font_small", "It will be difficult to pick up that snail from there.") dialogStr("Już tego ślimaka stamtąd nie wyciągniemy.") dialogId("uts-v-konecne", "font_big", "Finally, it’s there.") dialogStr("W końcu jest.") dialogId("uts-m-chudak", "font_small", "The poor snail...") dialogStr("Biedny ślimaczek...") dialogId("uts-v-koraly", "font_big", "We should search the coral reefs.") dialogStr("Powinniśmy przeszukać rafę.") dialogId("uts-m-tvorove", "font_small", "There are going to be many interesting beings to investigate there.") dialogStr("Tam z pewnością kryje się mnóstwo ciekawych stworzeń.") dialogId("uts-v-mikroskop", "font_big", "Don’t we need a microscope to investigate corals?") dialogStr("Nie potrzebujemy przypadkiem mikroskopu, aby zbadać korale?") dialogId("uts-m-zivocich", "font_small", "Yes, they are small. But there can be other life forms.") dialogStr("No, małe są. Ale mogą tam być i inne formy życia.") dialogId("uts-m-zelvy", "font_small", "Coral turtles, for example.") dialogStr("Na przykład żółwie koralowe.") dialogId("uts-m-batyskaf", "font_small", "And moreover I have a suspicion that there’s a microscope in a bathyscaph.") dialogStr("Poza tym wydaje mi się, że mikroskop może być w takim jednym batyskafie...")
gpl-2.0
gedadsbranch/Darkstar-Mission
scripts/zones/Norg/npcs/Heizo.lua
19
3109
----------------------------------- -- Area: Norg -- NPC: Heizo -- Starts and Ends Quest: Like Shining Leggings -- @pos -1 -5 25 252 ----------------------------------- package.loaded["scripts/zones/Norg/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Norg/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) ShiningLeggings = player:getQuestStatus(OUTLANDS,LIKE_A_SHINING_LEGGINGS); Legging = trade:getItemQty(14117); if(Legging > 0 and Legging == trade:getItemCount()) then TurnedInVar = player:getVar("shiningLeggings_nb"); if(ShiningLeggings == QUEST_ACCEPTED and TurnedInVar + Legging >= 10) then -- complete quest player:startEvent(0x0081); elseif(ShiningLeggings == QUEST_ACCEPTED and TurnedInVar <= 9) then -- turning in less than the amount needed to finish the quest TotalLeggings = Legging + TurnedInVar player:tradeComplete(); player:setVar("shiningLeggings_nb",TotalLeggings); player:startEvent(0x0080,TotalLeggings); -- Update player on number of leggings turned in end else if(ShiningLeggings == QUEST_ACCEPTED) then player:startEvent(0x0080,TotalLeggings); -- Update player on number of leggings turned in, but doesn't accept anything other than leggings else player:startEvent(0x007e); -- Give standard conversation if items are traded but no quest is accepted end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) ShiningLeggings = player:getQuestStatus(OUTLANDS,LIKE_A_SHINING_LEGGINGS); if(ShiningLeggings == QUEST_AVAILABLE and player:getFameLevel(NORG) >= 3) then player:startEvent(0x007f); -- Start Like Shining Leggings elseif(ShiningLeggings == QUEST_ACCEPTED) then player:startEvent(0x0080,player:getVar("shiningSubligar_nb")); -- Update player on number of Leggings turned in else player:startEvent(0x007e); -- Standard Conversation end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if(csid == 0x007f) then player:addQuest(OUTLANDS,LIKE_A_SHINING_LEGGINGS); elseif (csid == 0x0081) then player:tradeComplete(); player:addItem(4958); -- Scroll of Dokumori: Ichi player:messageSpecial(ITEM_OBTAINED, 4958); -- Scroll of Dokumori: Ichi player:addFame(OUTLANDS,NORG_FAME*100); player:addTitle(LOOKS_GOOD_IN_LEGGINGS); player:setVar("shiningLeggings_nb",0); player:completeQuest(OUTLANDS,LIKE_A_SHINING_LEGGINGS); end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Windurst_Woods/npcs/Hauh_Colphioh.lua
2
2685
----------------------------------- -- Area: Windurst Woods -- NPC: Hauh Colphioh -- Type: Guildworker's Union Representative -- @zone: 241 -- @pos -38.173 -1.25 -113.679 ----------------------------------- package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil; require("scripts/globals/keyitems"); require("scripts/globals/crafting"); require("scripts/zones/Windurst_Woods/TextIDs"); local keyitems = { [0] = { id = CLOTH_PURIFICATION, rank = 3, cost = 40000 }, [1] = { id = CLOTH_ENSORCELLMENT, rank = 3, cost = 40000 }, [2] = { id = SPINNING, rank = 3, cost = 10000 }, [3] = { id = FLETCHING, rank = 3, cost = 10000 }, [4] = { id = WAY_OF_THE_WEAVER, rank = 9, cost = 20000 } }; local items = { [2] = { id = 15447, -- Weaver's Belt rank = 4, cost = 10000 }, [3] = { id = 13946, -- Magnifying Spectacles rank = 6, cost = 70000 }, [4] = { id = 14395, -- Weaver's Apron rank = 7, cost = 100000 }, [5] = { id = 198, -- Gilt Tapestry rank = 9, cost = 150000 }, [6] = { id = 337, -- Weaver's Signboard rank = 9, cost = 200000 }, [7] = { id = 15822, -- Tailor's Ring rank = 6, cost = 80000 }, [8] = { id = 3665, -- Spinning Wheel rank = 7, cost = 50000 }, [9] = { id = 3327, -- Weavers' Emblem rank = 9, cost = 15000 } }; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) unionRepresentativeTrade(player, npc, trade, 0x2729, 4); end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) unionRepresentativeTrigger(player, 4, 0x2728, "guild_weaving", keyitems); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option,target) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x2728) then unionRepresentativeTriggerFinish(player, option, target, 4, "guild_weaving", keyitems, items); elseif (csid == 0x2729) then player:messageSpecial(GP_OBTAINED, option); end end;
gpl-3.0
Hostle/openwrt-luci-multi-user
libs/luci-lib-nixio/docsrc/nixio.bit.lua
171
2044
--- Bitfield operators and mainpulation functions. -- Can be used as a drop-in replacement for bitlib. module "nixio.bit" --- Bitwise OR several numbers. -- @class function -- @name bor -- @param oper1 First Operand -- @param oper2 Second Operand -- @param ... More Operands -- @return number --- Invert given number. -- @class function -- @name bnot -- @param oper Operand -- @return number --- Bitwise AND several numbers. -- @class function -- @name band -- @param oper1 First Operand -- @param oper2 Second Operand -- @param ... More Operands -- @return number --- Bitwise XOR several numbers. -- @class function -- @name bxor -- @param oper1 First Operand -- @param oper2 Second Operand -- @param ... More Operands -- @return number --- Left shift a number. -- @class function -- @name lshift -- @param oper number -- @param shift bits to shift -- @return number --- Right shift a number. -- @class function -- @name rshift -- @param oper number -- @param shift bits to shift -- @return number --- Arithmetically right shift a number. -- @class function -- @name arshift -- @param oper number -- @param shift bits to shift -- @return number --- Integer division of 2 or more numbers. -- @class function -- @name div -- @param oper1 Operand 1 -- @param oper2 Operand 2 -- @param ... More Operands -- @return number --- Cast a number to the bit-operating range. -- @class function -- @name cast -- @param oper number -- @return number --- Sets one or more flags of a bitfield. -- @class function -- @name set -- @param bitfield Bitfield -- @param flag1 First Flag -- @param ... More Flags -- @return altered bitfield --- Unsets one or more flags of a bitfield. -- @class function -- @name unset -- @param bitfield Bitfield -- @param flag1 First Flag -- @param ... More Flags -- @return altered bitfield --- Checks whether given flags are set in a bitfield. -- @class function -- @name check -- @param bitfield Bitfield -- @param flag1 First Flag -- @param ... More Flags -- @return true when all flags are set, otherwise false
apache-2.0
hooksta4/darkstar
scripts/zones/Dynamis-San_dOria/Zone.lua
21
2392
----------------------------------- -- -- Zone: Dynamis-San_dOria -- ----------------------------------- package.loaded["scripts/zones/Dynamis-San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Dynamis-San_dOria/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; local realDay = os.time(); local dynaWaitxDay = player:getVar("dynaWaitxDay"); if ((dynaWaitxDay + (BETWEEN_2DYNA_WAIT_TIME * 24 * 60 * 60)) < realDay or player:getVar("DynamisID") == GetServerVariable("[DynaSandoria]UniqueID")) then if (player:isBcnmsFull() == 1) then if (player:hasStatusEffect(EFFECT_DYNAMIS, 0) == false) then inst = player:addPlayerToDynamis(1281); if (inst == 1) then player:bcnmEnter(1281); else cs = 0; end else player:bcnmEnter(1281); end else inst = player:bcnmRegister(1281); if (inst == 1) then player:bcnmEnter(1281); else cs = 0; end end else cs = 0; end return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0) then player:setPos(161.000,-2.000,161.000,94,0xE6); end end;
gpl-3.0
chihyang/koreader
frontend/apps/reader/modules/readerdictionary.lua
2
4737
local InputContainer = require("ui/widget/container/inputcontainer") local DictQuickLookup = require("ui/widget/dictquicklookup") local InfoMessage = require("ui/widget/infomessage") local DataStorage = require("datastorage") local UIManager = require("ui/uimanager") local Screen = require("device").screen local Device = require("device") local JSON = require("json") local DEBUG = require("dbg") local _ = require("gettext") local T = require("ffi/util").template local ReaderDictionary = InputContainer:new{ data_dir = nil, } function ReaderDictionary:init() self.ui.menu:registerToMainMenu(self) self.data_dir = os.getenv("STARDICT_DATA_DIR") or DataStorage:getDataDir() .. "/data/dict" end function ReaderDictionary:addToMainMenu(tab_item_table) table.insert(tab_item_table.plugins, { text = _("Dictionary lookup"), tap_input = { title = _("Enter a word to look up"), type = "text", callback = function(input) self:onLookupWord(input) end, }, }) end function ReaderDictionary:onLookupWord(word, box, highlight) self.highlight = highlight self:stardictLookup(word, box) return true end local function tidy_markup(results) local cdata_tag = "<!%[CDATA%[(.-)%]%]>" local format_escape = "&[29Ib%+]{(.-)}" for _, result in ipairs(results) do local def = result.definition -- preserve the <br> tag for line break def = def:gsub("<[bB][rR] ?/?>", "\n") -- parse CDATA text in XML if def:find(cdata_tag) then def = def:gsub(cdata_tag, "%1") -- ignore format strings while def:find(format_escape) do def = def:gsub(format_escape, "%1") end end -- ignore all markup tags def = def:gsub("%b<>", "") result.definition = def end return results end function ReaderDictionary:stardictLookup(word, box) DEBUG("lookup word:", word, box) if word then word = require("util").stripePunctuations(word) DEBUG("stripped word:", word) -- escape quotes and other funny characters in word local results_str = nil if Device:isAndroid() then local A = require("android") results_str = A.stdout("./sdcv", "--utf8-input", "--utf8-output", "-nj", word, "--data-dir", self.data_dir) else local std_out = io.popen("./sdcv --utf8-input --utf8-output -nj " .. ("%q"):format(word) .. " --data-dir " .. self.data_dir, "r") if std_out then results_str = std_out:read("*all") std_out:close() end end --DEBUG("result str:", word, results_str) local ok, results = pcall(JSON.decode, results_str) if ok and results then --DEBUG("lookup result table:", word, results) self:showDict(word, tidy_markup(results), box) else DEBUG("JSON data cannot be decoded", results) -- dummy results results = { { dict = "", word = word, definition = _("No definition found."), } } DEBUG("dummy result table:", word, results) self:showDict(word, results, box) end end end function ReaderDictionary:showDict(word, results, box) if results and results[1] then DEBUG("showing quick lookup window") self.dict_window = DictQuickLookup:new{ ui = self.ui, highlight = self.highlight, dialog = self.dialog, -- original lookup word word = word, results = results, dictionary = self.default_dictionary, width = Screen:getWidth() - Screen:scaleBySize(80), word_box = box, -- differentiate between dict and wiki wiki = self.wiki, } UIManager:show(self.dict_window) end end function ReaderDictionary:onUpdateDefaultDict(dict) DEBUG("make default dictionary:", dict) self.default_dictionary = dict UIManager:show(InfoMessage:new{ text = T(_("%1 is now the default dictionary for this document."), dict), timeout = 2, }) return true end function ReaderDictionary:onReadSettings(config) self.default_dictionary = config:readSetting("default_dictionary") end function ReaderDictionary:onSaveSettings() DEBUG("save default dictionary", self.default_dictionary) self.ui.doc_settings:saveSetting("default_dictionary", self.default_dictionary) end return ReaderDictionary
agpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/RoMaeve/Zone.lua
6
2256
----------------------------------- -- -- Zone: RoMaeve (122) -- ----------------------------------- package.loaded["scripts/zones/RoMaeve/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/RoMaeve/TextIDs"); require("scripts/globals/zone"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) local manuals = {17277227,17277228}; SetFieldManual(manuals); end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then player:setPos(-0.008,-33.595,123.478,62); end return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onGameDay ----------------------------------- function onGameDay() -- Moongates local Moongate_Offset = 17277195; -- _3e0 in npc_list local direction = VanadielMoonDirection(); local phase = VanadielMoonPhase(); if(((direction == 2 and phase >= 90) or (direction == 1 and phase >= 95)) and GetNPCByID(Moongate_Offset):getWeather() == 0) then GetNPCByID(Moongate_Offset):openDoor(432); GetNPCByID(Moongate_Offset+1):openDoor(432); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Southern_San_dOria/npcs/Rouva.lua
17
1709
----------------------------------- -- Area: Southern San d'Oria -- NPC: Rouva -- Involved in Quest: Lure of the Wildcat (San d'Oria) -- @pos -17 2 10 230 ------------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if(player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE) == QUEST_ACCEPTED) then if(trade:hasItemQty(532,1) and trade:getItemCount() == 1) then -- Trade Magicmart_flyer player:messageSpecial(FLYER_REFUSED); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local WildcatSandy = player:getVar("WildcatSandy"); if(player:getQuestStatus(SANDORIA,LURE_OF_THE_WILDCAT_SAN_D_ORIA) == QUEST_ACCEPTED and player:getMaskBit(WildcatSandy,2) == false) then player:startEvent(0x0328); else player:startEvent(0x0298); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if(csid == 0x0328) then player:setMaskBit(player:getVar("WildcatSandy"),"WildcatSandy",2,true); end end;
gpl-3.0
dberga/arcbliz
src/scripts/lua/Lua/Stable Scripts/Azeroth/Karazhan/BOSS_Karazhan_Moroes.lua
30
1211
function Moroes_Enrage(Unit, event, miscunit, misc) if Unit:GetHealthPct() < 30 and Didthat == 0 then Unit:FullCastSpell(44779) Didthat = 1 else end end function Moroes_Gouge(Unit, event, miscunit, misc) print "Moroes Gouge" Unit:FullCastSpellOnTarget(28456,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Gouge on you...") end function Moroes_Blind(Unit, event, miscunit, misc) print "Moroes Blind" Unit:FullCastSpellOnTarget(34654,Unit:GetClosestPlayer()) Unit:SendChatMessage(11, 0, "Ho, your blind...") end function Moroes_Vanish(Unit, event, miscunit, misc) print "Moroes Vanish" Unit:FullCastSpell(41476) Unit:SendChatMessage(11, 0, "You dont see me anymore...") end function Moroes_Garrote(Unit, event, miscunit, misc) print "Moroes Garrote" Unit:FullCastSpellOnTarget(37066,Unit:GetRandomPlayer()) Unit:SendChatMessage(11, 0, "I choose you...") end function Moroes(unit, event, miscunit, misc) print "Moroes" unit:RegisterEvent("Moroes_Enrage",1000,1) unit:RegisterEvent("Moroes_Gouge",15000,0) unit:RegisterEvent("Moroes_Blind",20000,0) unit:RegisterEvent("Moroes_Vanish",60000,0) unit:RegisterEvent("Moroes_Garrote",75000,0) end RegisterUnitEvent(15687,1,"Moroes")
agpl-3.0
FishFilletsNG/fillets-data
script/nowall/dialogs_en.lua
1
1166
dialogId("m-zvlastni", "font_small", "This is a very strange room.") dialogId("v-zadne", "font_big", "There are no squares of walls here.") dialogId("m-zeme", "font_small", "Or rather squares of the Earth.") dialogId("m-uvedomit", "font_small", "You need to realize that the steel cylinder surrounding us") dialogId("v-nad", "font_big", "... rather above me ...") dialogId("m-predmet", "font_small", "is only an object.") dialogId("v-krehci", "font_big", "Therefore I am more tender then usualy.") dialogId("m-otazka0", "font_small", "Am I in UFO?") dialogId("m-otazka1", "font_small", "So why is starlit sky on the background?") dialogId("m-otazka2", "font_small", "And why are the stars moving?") dialogId("m-otazka3", "font_small", "It is rotating very quick.") dialogId("m-otazka4", "font_small", "I thought we are in the space.") dialogId("v-odpoved0", "font_big", "You can’t be there, it is just another elevator.") dialogId("v-odpoved1", "font_big", "Because it’s night now.") dialogId("v-odpoved2", "font_big", "Because the globe is rotating around its axis.") dialogId("v-odpoved3", "font_big", "It does not matter to us. We are in the water.")
gpl-2.0
hooksta4/darkstar
scripts/zones/Port_Windurst/npcs/_6o6.lua
2
1349
----------------------------------- -- Area: Port Windurst -- NPC: Door: Departures Exit -- @zone 240 -- @pos 218 -5 114 ----------------------------------- package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/zones/Port_Windurst/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasKeyItem(AIRSHIP_PASS) == true and player:getGil() >= 200) then player:startEvent(0x00b5,0,8,0,0,0,0,0,200); else player:startEvent(0x00b7,0,8); end return 1; end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if (csid == 0x00b5) then X = player:getXPos(); if (X >= 221 and X <= 225) then player:delGil(200); end end end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Bastok_Markets/Zone.lua
28
2870
----------------------------------- -- -- Zone: Bastok_Markets (235) -- ----------------------------------- package.loaded["scripts/zones/Bastok_Markets/TextIDs"] = nil; ----------------------------------- require("scripts/globals/chocobo"); require("scripts/globals/events/harvest_festivals"); require("scripts/globals/settings"); require("scripts/globals/zone"); require("scripts/zones/Bastok_Markets/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) applyHalloweenNpcCostumes(zone:getID()) setChocoboPrices(); end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; -- FIRST LOGIN (START CS) if (player:getPlaytime(false) == 0) then if (OPENING_CUTSCENE_ENABLE == 1) then --cs = 0x00; end player:setPos(-280,-12,-91,15); player:setHomePoint(); end -- MOG HOUSE EXIT if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then position = math.random(1,5) - 33; player:setPos(-177,-8,position,127); if (player:getMainJob() ~= player:getVar("PlayerMainJob")) then cs = 0x7534; end player:setVar("PlayerMainJob",0); end return cs; end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onGameDay ----------------------------------- function onGameDay() -- Removes daily the bit mask that tracks the treats traded for Harvest Festival. if (isHalloweenEnabled() ~= 0) then clearVarFromAll("harvestFestTreats"); clearVarFromAll("harvestFestTreats2"); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x00) then player:messageSpecial(ITEM_OBTAINED,0x218); elseif (csid == 0x7534 and option == 0) then player:setHomePoint(); player:messageSpecial(HOMEPOINT_SET); end end;
gpl-3.0
prosody-modules/import2
mod_delegation/mod_delegation.lua
16
17451
-- XEP-0355 (Namespace Delegation) -- Copyright (C) 2015 Jérôme Poisson -- -- This module is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. -- This module manage namespace delegation, a way to delegate server features -- to an external entity/component. Only the admin mode is implemented so far -- TODO: client mode local jid = require("util/jid") local st = require("util/stanza") local set = require("util/set") local delegation_session = module:shared("/*/delegation/session") if delegation_session.connected_cb == nil then -- set used to have connected event listeners -- which allow a host to react on events from -- other hosts delegation_session.connected_cb = set.new() end local connected_cb = delegation_session.connected_cb local _DELEGATION_NS = 'urn:xmpp:delegation:1' local _FORWARDED_NS = 'urn:xmpp:forward:0' local _DISCO_NS = 'http://jabber.org/protocol/disco#info' local _DATA_NS = 'jabber:x:data' local _MAIN_SEP = '::' local _BARE_SEP = ':bare:' local _MAIN_PREFIX = _DELEGATION_NS.._MAIN_SEP local _BARE_PREFIX = _DELEGATION_NS.._BARE_SEP local _PREFIXES = {_MAIN_PREFIX, _BARE_PREFIX} local disco_nest module:log("debug", "Loading namespace delegation module "); --> Configuration management <-- local ns_delegations = module:get_option("delegations", {}) local jid2ns = {} for namespace, ns_data in pairs(ns_delegations) do -- "connected" contain the full jid of connected managing entity ns_data.connected = nil if ns_data.jid then if jid2ns[ns_data.jid] == nil then jid2ns[ns_data.jid] = {} end jid2ns[ns_data.jid][namespace] = ns_data module:log("debug", "Namespace %s is delegated%s to %s", namespace, ns_data.filtering and " (with filtering)" or "", ns_data.jid) else module:log("warn", "Ignoring delegation for %s: no jid specified", tostring(namespace)) ns_delegations[namespace] = nil end end local function advertise_delegations(session, to_jid) -- send <message/> stanza to advertise delegations -- as expained in § 4.2 local message = st.message({from=module.host, to=to_jid}) :tag("delegation", {xmlns=_DELEGATION_NS}) -- we need to check if a delegation is granted because the configuration -- can be complicated if some delegations are granted to bare jid -- and other to full jids, and several resources are connected. local have_delegation = false for namespace, ns_data in pairs(jid2ns[to_jid]) do if ns_data.connected == to_jid then have_delegation = true message:tag("delegated", {namespace=namespace}) if type(ns_data.filtering) == "table" then for _, attribute in pairs(ns_data.filtering) do message:tag("attribute", {name=attribute}):up() end message:up() end end end if have_delegation then session.send(message) end end local function set_connected(entity_jid) -- set the "connected" key for all namespace managed by entity_jid -- if the namespace has already a connected entity, ignore the new one local function set_config(jid_) for namespace, ns_data in pairs(jid2ns[jid_]) do if ns_data.connected == nil then ns_data.connected = entity_jid disco_nest(namespace, entity_jid) end end end local bare_jid = jid.bare(entity_jid) set_config(bare_jid) -- We can have a bare jid of a full jid specified in configuration -- so we try our luck with both (first connected resource will -- manage the namespaces in case of bare jid) if bare_jid ~= entity_jid then set_config(entity_jid) jid2ns[entity_jid] = jid2ns[bare_jid] end end local function on_presence(event) local session = event.origin local bare_jid = jid.bare(session.full_jid) if jid2ns[bare_jid] or jid2ns[session.full_jid] then set_connected(session.full_jid) advertise_delegations(session, session.full_jid) end end local function on_component_connected(event) -- method called by the module loaded by the component -- /!\ the event come from the component host, -- not from the host of this module local session = event.session local bare_jid = jid.join(session.username, session.host) local jid_delegations = jid2ns[bare_jid] if jid_delegations ~= nil then set_connected(bare_jid) advertise_delegations(session, bare_jid) end end local function on_component_auth(event) -- react to component-authenticated event from this host -- and call the on_connected methods from all other hosts -- needed for the component to get delegations advertising for callback in connected_cb:items() do callback(event) end end connected_cb:add(on_component_connected) module:hook('component-authenticated', on_component_auth) module:hook('presence/initial', on_presence) --> delegated namespaces hook <-- local managing_ent_error local stanza_cache = {} -- we cache original stanza to build reply local function managing_ent_result(event) -- this function manage iq results from the managing entity -- it do a couple of security check before sending the -- result to the managed entity local stanza = event.stanza if stanza.attr.to ~= module.host then module:log("warn", 'forwarded stanza result has "to" attribute not addressed to current host, id conflict ?') return end module:unhook("iq-result/host/"..stanza.attr.id, managing_ent_result) module:unhook("iq-error/host/"..stanza.attr.id, managing_ent_error) -- lot of checks to do... local delegation = stanza.tags[1] if #stanza ~= 1 or delegation.name ~= "delegation" or delegation.attr.xmlns ~= _DELEGATION_NS then module:log("warn", "ignoring invalid iq result from managing entity %s", stanza.attr.from) stanza_cache[stanza.attr.from][stanza.attr.id] = nil return true end local forwarded = delegation.tags[1] if #delegation ~= 1 or forwarded.name ~= "forwarded" or forwarded.attr.xmlns ~= _FORWARDED_NS then module:log("warn", "ignoring invalid iq result from managing entity %s", stanza.attr.from) stanza_cache[stanza.attr.from][stanza.attr.id] = nil return true end local iq = forwarded.tags[1] if #forwarded ~= 1 or iq.name ~= "iq" or iq.attr.xmlns ~= 'jabber:client' or (iq.attr.type =='result' and #iq ~= 1) or (iq.attr.type == 'error' and #iq > 2) then module:log("warn", "ignoring invalid iq result from managing entity %s", stanza.attr.from) stanza_cache[stanza.attr.from][stanza.attr.id] = nil return true end iq.attr.xmlns = nil local original = stanza_cache[stanza.attr.from][stanza.attr.id] stanza_cache[stanza.attr.from][stanza.attr.id] = nil -- we get namespace from original and not iq -- because the namespace can be lacking in case of error local namespace = original.tags[1].attr.xmlns local ns_data = ns_delegations[namespace] if stanza.attr.from ~= ns_data.connected or (iq.attr.type ~= "result" and iq.attr.type ~= "error") or iq.attr.id ~= original.attr.id or iq.attr.to ~= original.attr.from then module:log("warn", "ignoring forbidden iq result from managing entity %s, please check that the component is no trying to do something bad (stanza: %s)", stanza.attr.from, tostring(stanza)) module:send(st.error_reply(original, 'cancel', 'service-unavailable')) return true end -- at this point eveything is checked, -- and we (hopefully) can send the the result safely module:send(iq) return true end function managing_ent_error(event) local stanza = event.stanza if stanza.attr.to ~= module.host then module:log("warn", 'Stanza result has "to" attribute not addressed to current host, id conflict ?') return end module:unhook("iq-result/host/"..stanza.attr.id, managing_ent_result) module:unhook("iq-error/host/"..stanza.attr.id, managing_ent_error) local original = stanza_cache[stanza.attr.from][stanza.attr.id] stanza_cache[stanza.attr.from][stanza.attr.id] = nil module:log("warn", "Got an error after forwarding stanza to "..stanza.attr.from) module:send(st.error_reply(original, 'cancel', 'service-unavailable')) return true end local function forward_iq(stanza, ns_data) local to_jid = ns_data.connected stanza.attr.xmlns = 'jabber:client' local iq_stanza = st.iq({ from=module.host, to=to_jid, type="set" }) :tag("delegation", { xmlns=_DELEGATION_NS }) :tag("forwarded", { xmlns=_FORWARDED_NS }) :add_child(stanza) local iq_id = iq_stanza.attr.id -- we save the original stanza to check the managing entity result if not stanza_cache[to_jid] then stanza_cache[to_jid] = {} end stanza_cache[to_jid][iq_id] = stanza module:hook("iq-result/host/"..iq_id, managing_ent_result) module:hook("iq-error/host/"..iq_id, managing_ent_error) module:log("debug", "stanza forwarded") module:send(iq_stanza) end local function iq_hook(event) -- general hook for all the iq which forward delegated ones -- and continue normal behaviour else. If a namespace is -- delegated but managing entity is offline, a service-unavailable -- error will be sent, as requested by the XEP local session, stanza = event.origin, event.stanza if #stanza == 1 and stanza.attr.type == 'get' or stanza.attr.type == 'set' then local namespace = stanza.tags[1].attr.xmlns local ns_data = ns_delegations[namespace] if ns_data then if stanza.attr.from == ns_data.connected then -- we don't forward stanzas from managing entity itself return end if ns_data.filtering then local first_child = stanza.tags[1] for _, attribute in ns_data.filtering do -- if any filtered attribute if not present, -- we must continue the normal bahaviour if not first_child.attr[attribute] then -- Filtered attribute is not present, we do normal workflow return; end end end if not ns_data.connected then module:log("warn", "No connected entity to manage "..namespace) session.send(st.error_reply(stanza, 'cancel', 'service-unavailable')) else forward_iq(stanza, ns_data) end return true else -- we have no delegation, we continue normal behaviour return end end end module:hook("iq/self", iq_hook, 2^32) module:hook("iq/bare", iq_hook, 2^32) module:hook("iq/host", iq_hook, 2^32) --> discovery nesting <-- -- disabling internal features/identities local function find_form_type(stanza) local form_type = nil for field in stanza.childtags('field', 'jabber:x:data') do if field.attr.var=='FORM_TYPE' and field.attr.type=='hidden' then local value = field:get_child('value') if not value then module:log("warn", "No value found in FORM_TYPE field: "..tostring(stanza)) else form_type=value.get_text() end end end return form_type end -- modules whose features/identities are managed by delegation local disabled_modules = set.new() local disabled_identities = set.new() local function identity_added(event) local source = event.source if disabled_modules:contains(source) then local item = event.item local category, type_, name = item.category, item.type, item.name module:log("debug", "Removing (%s/%s%s) identity because of delegation", category, type_, name and "/"..name or "") disabled_identities:add(item) source:remove_item("identity", item) end end local function feature_added(event) local source, item = event.source, event.item for namespace, _ in pairs(ns_delegations) do if source ~= module and string.sub(item, 1, #namespace) == namespace then module:log("debug", "Removing %s feature which is delegated", item) source:remove_item("feature", item) disabled_modules:add(source) if source.items and source.items.identity then -- we remove all identities added by the source module -- that can cause issues if the module manages several features/identities -- but this case is probably rare (or doesn't happen at all) -- FIXME: any better way ? for _, identity in pairs(source.items.identity) do identity_added({source=source, item=identity}) end end end end end local function extension_added(event) local source, stanza = event.source, event.item local form_type = find_form_type(stanza) if not form_type then return; end for namespace, _ in pairs(ns_delegations) do if source ~= module and string.sub(form_type, 1, #namespace) == namespace then module:log("debug", "Removing extension which is delegated: %s", tostring(stanza)) source:remove_item("extension", stanza) end end end -- for disco nesting (see § 7.2) we need to remove internal features -- we use handle_items as it allow to remove already added features -- and catch the ones which can come later module:handle_items("feature", feature_added, function(_) end) module:handle_items("identity", identity_added, function(_) end, false) module:handle_items("extension", extension_added, function(_) end) -- managing entity features/identities collection local disco_error local bare_features = set.new() local bare_identities = {} local bare_extensions = {} local function disco_result(event) -- parse result from disco nesting request -- and fill module features/identities and bare_features/bare_identities accordingly local session, stanza = event.origin, event.stanza if stanza.attr.to ~= module.host then module:log("warn", 'Stanza result has "to" attribute not addressed to current host, id conflict ?') return end module:unhook("iq-result/host/"..stanza.attr.id, disco_result) module:unhook("iq-error/host/"..stanza.attr.id, disco_error) local query = stanza:get_child("query", _DISCO_NS) if not query or not query.attr.node then session.send(st.error_reply(stanza, 'modify', 'not-acceptable')) return true end local node = query.attr.node local main if string.sub(node, 1, #_MAIN_PREFIX) == _MAIN_PREFIX then main=true elseif string.sub(node, 1, #_BARE_PREFIX) == _BARE_PREFIX then main=false else module:log("warn", "Unexpected node: "..node) session.send(st.error_reply(stanza, 'modify', 'not-acceptable')) return true end for feature in query:childtags("feature") do local namespace = feature.attr.var if main then module:add_feature(namespace) else bare_features:add(namespace) end end for identity in query:childtags("identity") do local category, type_, name = identity.attr.category, identity.attr.type, identity.attr.name if main then module:add_identity(category, type_, name) else table.insert(bare_identities, {category=category, type=type_, name=name}) end end for extension in query:childtags("x", _DATA_NS) do if main then module:add_extension(extension) else table.insert(bare_extensions, extension) end end end function disco_error(event) local stanza = event.stanza if stanza.attr.to ~= module.host then module:log("warn", 'Stanza result has "to" attribute not addressed to current host, id conflict ?') return end module:unhook("iq-result/host/"..stanza.attr.id, disco_result) module:unhook("iq-error/host/"..stanza.attr.id, disco_error) module:log("warn", "Got an error while requesting disco for nesting to "..stanza.attr.from) module:log("warn", "Ignoring disco nesting") end function disco_nest(namespace, entity_jid) -- manage discovery nesting (see § 7.2) -- first we reset the current values if module.items then module.items['feature'] = nil module.items['identity'] = nil module.items['extension'] = nil bare_features = set.new() bare_identities = {} bare_extensions = {} end for _, prefix in ipairs(_PREFIXES) do local node = prefix..namespace local iq = st.iq({from=module.host, to=entity_jid, type='get'}) :tag('query', {xmlns=_DISCO_NS, node=node}) local iq_id = iq.attr.id module:hook("iq-result/host/"..iq_id, disco_result) module:hook("iq-error/host/"..iq_id, disco_error) module:send(iq) end end -- disco to bare jids special case module:hook("account-disco-info", function(event) -- this event is called when a disco info request is done on a bare jid -- we get the final reply and filter delegated features/identities/extensions local reply = event.reply; reply.tags[1]:maptags(function(child) if child.name == 'feature' then local feature_ns = child.attr.var for namespace, _ in pairs(ns_delegations) do if string.sub(feature_ns, 1, #namespace) == namespace then module:log("debug", "Removing feature namespace %s which is delegated", feature_ns) return nil end end elseif child.name == 'identity' then for item in disabled_identities:items() do if item.category == child.attr.category and item.type == child.attr.type -- we don't check name, because mod_pep use a name for main disco, but not in account-disco-info hook -- and item.name == child.attr.name then module:log("debug", "Removing (%s/%s%s) identity because of delegation", item.category, item.type, item.name and "/"..item.name or "") return nil end end elseif child.name == 'x' and child.attr.xmlns == _DATA_NS then local form_type = find_form_type(child) if form_type then for namespace, _ in pairs(ns_delegations) do if string.sub(form_type, 1, #namespace) == namespace then module:log("debug", "Removing extension which is delegated: %s", tostring(child)) return nil end end end end return child end) for feature in bare_features:items() do reply:tag('feature', {var=feature}):up() end for _, item in ipairs(bare_identities) do reply:tag('identity', {category=item.category, type=item.type, name=item.name}):up() end for _, stanza in ipairs(bare_extensions) do reply:add_child(stanza) end end, -2^32);
mit
snabbco/snabb
lib/ljsyscall/syscall/netbsd/nr.lua
24
9205
-- NetBSD syscall numbers local nr = { SYS = { syscall = 0, exit = 1, fork = 2, read = 3, write = 4, open = 5, close = 6, compat_50_wait4 = 7, compat_43_ocreat = 8, link = 9, unlink = 10, chdir = 12, fchdir = 13, compat_50_mknod = 14, chmod = 15, chown = 16, ["break"] = 17, compat_20_getfsstat = 18, compat_43_olseek = 19, getpid = 20, compat_40_mount = 21, unmount = 22, setuid = 23, getuid = 24, geteuid = 25, ptrace = 26, recvmsg = 27, sendmsg = 28, recvfrom = 29, accept = 30, getpeername = 31, getsockname = 32, access = 33, chflags = 34, fchflags = 35, sync = 36, kill = 37, compat_43_stat43 = 38, getppid = 39, compat_43_lstat43 = 40, dup = 41, pipe = 42, getegid = 43, profil = 44, ktrace = 45, compat_13_sigaction13 = 46, getgid = 47, compat_13_sigprocmask13 = 48, __getlogin = 49, __setlogin = 50, acct = 51, compat_13_sigpending13 = 52, compat_13_sigaltstack13 = 53, ioctl = 54, compat_12_oreboot = 55, revoke = 56, symlink = 57, readlink = 58, execve = 59, umask = 60, chroot = 61, compat_43_fstat43 = 62, compat_43_ogetkerninfo = 63, compat_43_ogetpagesize = 64, compat_12_msync = 65, vfork = 66, sbrk = 69, sstk = 70, compat_43_ommap = 71, vadvise = 72, munmap = 73, mprotect = 74, madvise = 75, mincore = 78, getgroups = 79, setgroups = 80, getpgrp = 81, setpgid = 82, compat_50_setitimer = 83, compat_43_owait = 84, compat_12_oswapon = 85, compat_50_getitimer = 86, compat_43_ogethostname = 87, compat_43_osethostname = 88, compat_43_ogetdtablesize = 89, dup2 = 90, fcntl = 92, compat_50_select = 93, fsync = 95, setpriority = 96, compat_30_socket = 97, connect = 98, compat_43_oaccept = 99, getpriority = 100, compat_43_osend = 101, compat_43_orecv = 102, compat_13_sigreturn13 = 103, bind = 104, setsockopt = 105, listen = 106, compat_43_osigvec = 108, compat_43_osigblock = 109, compat_43_osigsetmask = 110, compat_13_sigsuspend13 = 111, compat_43_osigstack = 112, compat_43_orecvmsg = 113, compat_43_osendmsg = 114, compat_50_gettimeofday = 116, compat_50_getrusage = 117, getsockopt = 118, readv = 120, writev = 121, compat_50_settimeofday = 122, fchown = 123, fchmod = 124, compat_43_orecvfrom = 125, setreuid = 126, setregid = 127, rename = 128, compat_43_otruncate = 129, compat_43_oftruncate = 130, flock = 131, mkfifo = 132, sendto = 133, shutdown = 134, socketpair = 135, mkdir = 136, rmdir = 137, compat_50_utimes = 138, compat_50_adjtime = 140, compat_43_ogetpeername = 141, compat_43_ogethostid = 142, compat_43_osethostid = 143, compat_43_ogetrlimit = 144, compat_43_osetrlimit = 145, compat_43_okillpg = 146, setsid = 147, compat_50_quotactl = 148, compat_43_oquota = 149, compat_43_ogetsockname = 150, nfssvc = 155, compat_43_ogetdirentries = 156, compat_20_statfs = 157, compat_20_fstatfs = 158, compat_30_getfh = 161, compat_09_ogetdomainname = 162, compat_09_osetdomainname = 163, compat_09_ouname = 164, sysarch = 165, compat_10_osemsys = 169, compat_10_omsgsys = 170, compat_10_oshmsys = 171, pread = 173, pwrite = 174, compat_30_ntp_gettime = 175, ntp_adjtime = 176, setgid = 181, setegid = 182, seteuid = 183, lfs_bmapv = 184, lfs_markv = 185, lfs_segclean = 186, compat_50_lfs_segwait = 187, compat_12_stat12 = 188, compat_12_fstat12 = 189, compat_12_lstat12 = 190, pathconf = 191, fpathconf = 192, getrlimit = 194, setrlimit = 195, compat_12_getdirentries = 196, mmap = 197, __syscall = 198, lseek = 199, truncate = 200, ftruncate = 201, __sysctl = 202, mlock = 203, munlock = 204, undelete = 205, compat_50_futimes = 206, getpgid = 207, reboot = 208, poll= 209, compat_14___semctl = 220, semget = 221, semop = 222, semconfig = 223, compat_14_msgctl = 224, msgget = 225, msgsnd = 226, msgrcv = 227, shmat = 228, compat_14_shmctl = 229, shmdt = 230, shmget = 231, compat_50_clock_gettime = 232, compat_50_clock_settime = 233, compat_50_clock_getres = 234, timer_create = 235, timer_delete = 236, compat_50_timer_settime = 237, compat_50_timer_gettime = 238, timer_getoverrun = 239, compat_50_nanosleep = 240, fdatasync = 241, mlockall = 242, munlockall = 243, compat_50___sigtimedwait = 244, sigqueueinfo = 245, _ksem_init = 247, _ksem_open = 248, _ksem_unlink = 249, _ksem_close = 250, _ksem_post = 251, _ksem_wait = 252, _ksem_trywait = 253, _ksem_getvalue = 254, _ksem_destroy = 255, mq_open = 257, mq_close = 258, mq_unlink = 259, mq_getattr = 260, mq_setattr = 261, mq_notify = 262, mq_send = 263, mq_receive = 264, compat_50_mq_timedsend = 265, compat_50_mq_timedreceive = 266, __posix_rename = 270, swapctl = 271, compat_30_getdents = 272, minherit = 273, lchmod = 274, lchown = 275, compat_50_lutimes = 276, __msync13 = 277, compat_30___stat13 = 278, compat_30___fstat13 = 279, compat_30___lstat13 = 280, __sigaltstack14 = 281, __vfork14 = 282, __posix_chown = 283, __posix_fchown = 284, __posix_lchown = 285, getsid = 286, __clone = 287, fktrace = 288, preadv = 289, pwritev = 290, compat_16___sigaction14 = 291, __sigpending14 = 292, __sigprocmask14 = 293, __sigsuspend14 = 294, compat_16___sigreturn14 = 295, __getcwd = 296, fchroot = 297, compat_30_fhopen = 298, compat_30_fhstat = 299, compat_20_fhstatfs = 300, compat_50_____semctl13 = 301, compat_50___msgctl13 = 302, compat_50___shmctl13 = 303, lchflags = 304, issetugid = 305, utrace = 306, getcontext = 307, setcontext = 308, _lwp_create = 309, _lwp_exit = 310, _lwp_self = 311, _lwp_wait = 312, _lwp_suspend = 313, _lwp_continue = 314, _lwp_wakeup = 315, _lwp_getprivate = 316, _lwp_setprivate = 317, _lwp_kill = 318, _lwp_detach = 319, compat_50__lwp_park = 320, _lwp_unpark = 321, _lwp_unpark_all = 322, _lwp_setname = 323, _lwp_getname = 324, _lwp_ctl = 325, compat_60_sa_register = 330, compat_60_sa_stacks = 331, compat_60_sa_enable = 332, compat_60_sa_setconcurrency = 333, compat_60_sa_yield = 334, compat_60_sa_preempt = 335, __sigaction_sigtramp = 340, pmc_get_info = 341, pmc_control = 342, rasctl = 343, kqueue = 344, compat_50_kevent = 345, _sched_setparam = 346, _sched_getparam = 347, _sched_setaffinity = 348, _sched_getaffinity = 349, sched_yield = 350, fsync_range = 354, uuidgen = 355, getvfsstat = 356, statvfs1 = 357, fstatvfs1 = 358, compat_30_fhstatvfs1 = 359, extattrctl = 360, extattr_set_file = 361, extattr_get_file = 362, extattr_delete_file = 363, extattr_set_fd = 364, extattr_get_fd = 365, extattr_delete_fd = 366, extattr_set_link = 367, extattr_get_link = 368, extattr_delete_link = 369, extattr_list_fd = 370, extattr_list_file = 371, extattr_list_link = 372, compat_50_pselect = 373, compat_50_pollts = 374, setxattr = 375, lsetxattr = 376, fsetxattr = 377, getxattr = 378, lgetxattr = 379, fgetxattr = 380, listxattr = 381, llistxattr = 382, flistxattr = 383, removexattr = 384, lremovexattr = 385, fremovexattr = 386, compat_50___stat30 = 387, compat_50___fstat30 = 388, compat_50___lstat30 = 389, __getdents30 = 390, compat_30___fhstat30 = 392, compat_50___ntp_gettime30 = 393, __socket30 = 394, __getfh30 = 395, __fhopen40 = 396, __fhstatvfs140 = 397, compat_50___fhstat40 = 398, aio_cancel = 399, aio_error = 400, aio_fsync = 401, aio_read = 402, aio_return = 403, compat_50_aio_suspend = 404, aio_write = 405, lio_listio = 406, __mount50 = 410, mremap = 411, pset_create = 412, pset_destroy = 413, pset_assign = 414, _pset_bind = 415, __posix_fadvise50 = 416, __select50 = 417, __gettimeofday50 = 418, __settimeofday50 = 419, __utimes50 = 420, __adjtime50 = 421, __lfs_segwait50 = 422, __futimes50 = 423, __lutimes50 = 424, __setitimer50 = 425, __getitimer50 = 426, __clock_gettime50 = 427, __clock_settime50 = 428, __clock_getres50 = 429, __nanosleep50 = 430, ____sigtimedwait50 = 431, __mq_timedsend50 = 432, __mq_timedreceive50 = 433, compat_60__lwp_park = 434, __kevent50 = 435, __pselect50 = 436, __pollts50 = 437, __aio_suspend50 = 438, __stat50 = 439, __fstat50 = 440, __lstat50 = 441, ____semctl50 = 442, __shmctl50 = 443, __msgctl50 = 444, __getrusage50 = 445, __timer_gettime50 = 447, __ntp_gettime50 = 448, __wait450 = 449, __mknod50 = 450, __fhstat50 = 451, pipe2 = 453, dup3 = 454, kqueue1 = 455, paccept = 456, linkat = 457, renameat = 458, mkfifoat = 459, mknodat = 460, mkdirat = 461, faccessat = 462, fchmodat = 463, fchownat = 464, fexecve = 465, fstatat = 466, utimensat = 467, openat = 468, readlinkat = 469, symlinkat = 470, unlinkat = 471, futimens = 472, __quotactl = 473, posix_spawn = 474, recvmmsg = 475, sendmmsg = 476, clock_nanosleep = 477, ___lwp_park60 = 478, } } return nr
apache-2.0
dberga/arcbliz
src/scripts/lua/LuaBridge/Stable Scripts/Outland/Magisters Terrace/UNIT-MagistersTerrace-SunbladeMageGuard.lua
30
1409
--[[ ******************************** * * * The Moon Project * * * ******************************** This software is provided as free and open source by the staff of The Moon Project, in accordance with the GPL license. This means we provide the software we have created freely and it has been thoroughly tested to work for the developers, but NO GUARANTEE is made it will work for you as well. Please give credit where credit is due, if modifying, redistributing and/or using this software. Thank you. Staff of Moon Project, Feb 2008 ~~End of License Agreement --Moon April 2008]] function SunbladeMageGuard_OnCombat(Unit, Event) Unit:RegisterAIUpdateEvent(7000) end function SunbladeMageGuard_GlaiveThrow(Unit) local FlipGlaive = math.random(2) if FlipGlaive ==1 and Unit:GetRandomPlayer(7) then Unit:CastSpellOnTarget(44478, Unit:GetRandomPlayer(7)) else Unit:CastSpellOnTarget(46028, Unit:GetRandomPlayer(7)) end end function SunbladeMageGuard_LeaveCombat(Unit, Event) Unit:RemoveAIUpdateEvent() end function SunbladeMageGuard_Died(Unit, Event) Unit:RemoveAIUpdateEvent() end RegisterUnitEvent(24683, 1, "SunbladeMageGuard_OnCombat") RegisterUnitEvent(24683, 21, "SunbladeMageGuard_GlaiveThrow") RegisterUnitEvent(24683, 2, "SunbladeMageGuard_LeaveCombat") RegisterUnitEvent(24683, 4, "SunbladeMageGuard_Died")
agpl-3.0
dberga/arcbliz
src/scripts/lua/Lua/Stable Scripts/Outland/Magisters Terrace/UNIT-MagistersTerrace-SunbladeMageGuard.lua
30
1409
--[[ ******************************** * * * The Moon Project * * * ******************************** This software is provided as free and open source by the staff of The Moon Project, in accordance with the GPL license. This means we provide the software we have created freely and it has been thoroughly tested to work for the developers, but NO GUARANTEE is made it will work for you as well. Please give credit where credit is due, if modifying, redistributing and/or using this software. Thank you. Staff of Moon Project, Feb 2008 ~~End of License Agreement --Moon April 2008]] function SunbladeMageGuard_OnCombat(Unit, Event) Unit:RegisterAIUpdateEvent(7000) end function SunbladeMageGuard_GlaiveThrow(Unit) local FlipGlaive = math.random(2) if FlipGlaive ==1 and Unit:GetRandomPlayer(7) then Unit:CastSpellOnTarget(44478, Unit:GetRandomPlayer(7)) else Unit:CastSpellOnTarget(46028, Unit:GetRandomPlayer(7)) end end function SunbladeMageGuard_LeaveCombat(Unit, Event) Unit:RemoveAIUpdateEvent() end function SunbladeMageGuard_Died(Unit, Event) Unit:RemoveAIUpdateEvent() end RegisterUnitEvent(24683, 1, "SunbladeMageGuard_OnCombat") RegisterUnitEvent(24683, 21, "SunbladeMageGuard_GlaiveThrow") RegisterUnitEvent(24683, 2, "SunbladeMageGuard_LeaveCombat") RegisterUnitEvent(24683, 4, "SunbladeMageGuard_Died")
agpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Port_San_dOria/TextIDs.lua
5
4857
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED_1 = 6414; -- You cannot obtain the <<<Possible Special Code: 01>>><<<Possible Special Code: 05>>>#<<<BAD CHAR: 8280>>><<<BAD CHAR: 80>>><<<BAD CHAR: 80>>>.<<<Prompt>>> ITEM_CANNOT_BE_OBTAINED_2 = 6415; -- You cannot obtain the <<<Possible Special Code: 01>>><<<Possible Special Code: 05>>>#<<<BAD CHAR: 8280>>><<<BAD CHAR: 80>>><<<BAD CHAR: 80>>>. Come back after sorting your inventory. ITEM_CANNOT_BE_OBTAINED_3 = 6416; -- You cannot obtain the item. Come back after sorting your inventory. FULL_INVENTORY_AFTER_TRADE = 6417; -- You cannot obtain the <<<Possible Special Code: 01>>><<<Possible Special Code: 05>>>#<<<BAD CHAR: 8280>>><<<BAD CHAR: 80>>><<<BAD CHAR: 80>>>. Try trading again after sorting your inventory. ITEM_OBTAINED = 6418; -- Obtained: <<<Unknown Parameter (Type: 80) 1>>><<<Possible Special Code: 01>>><<<Possible Special Code: 05>>>#<<<BAD CHAR: 8280>>><<<BAD CHAR: 80>>><<<BAD CHAR: 80>>>. GIL_OBTAINED = 6419; -- Obtained <<<Numeric Parameter 0>>> gil. KEYITEM_OBTAINED = 6421; -- Obtained key item: <<<Unknown Parameter (Type: 80) 1>>><<<Possible Special Code: 01>>><<<Possible Special Code: 05>>>3<<<BAD CHAR: 8280>>><<<BAD CHAR: 80>>><<<BAD CHAR: 80>>>. HOMEPOINT_SET = 24; -- Home point set! FISHING_MESSAGE_OFFSET = 7178; -- You can't fish here. ITEM_DELIVERY_DIALOG = 7893; -- Now delivering parcels to rooms everywhere! -- Dialogs FLYER_REFUSED = 7505; -- This person isn't interested. FLYER_ALREADY = 7506; -- This person already has a flyer. FLYER_ACCEPTED = 7507; -- Your flyer is accepted! FLYERS_HANDED = 7508; -- You've handed outflyer(s). PORTAURE_DIALOG = 7770; -- What's this? A magic shop? Hmm...I could use a new line of work, and magic just might be the ticket! ANSWALD_DIALOG = 7790; -- A magic shop? Oh, it's right near here. I'll go check it out sometime. PRIETTA_DIALOG = 7814; -- This is the first I've heard of a magic shop here in San d'Oria. Such arts have never been popular in the Kingdom. AUVARE_DIALOG = 7821; -- What have I got here? Look, I can't read, but I takes what I gets, and you ain't getting it back! MIENE_DIALOG = 7874; -- Oh, a magic shop... Here in San d'Oria? I'd take a look if I got more allowance. ANSWALD_MESSAGE = 8367; -- Answald looks over curiously for a moment. PRIETTA_MESSAGE = 8368; -- Prietta looks over curiously for a moment. MIENE_MESSAGE = 8369; -- Miene looks over curiously for a moment. PORTAURE_MESSAGE = 8370; -- Portaure looks over curiously for a moment. AUVARE_MESSAGE = 8371; -- Auvare looks over curiously for a moment. -- Shop Texts ALBINIE_SHOP_DIALOG = 7834; -- Welcome to my simple shop. COULLAVE_SHOP_DIALOG = 7880; -- Can I help you? CROUMANGUE_SHOP_DIALOG = 7881; -- Can't fight on an empty stomach. How about some nourishment? VENDAVOQ_OPEN_DIALOG = 7888; -- Vandoolin! Vendavoq vring voods vack vrom Vovalpolos! Vuy! Vuy! VENDAVOQ_CLOSED_DIALOG = 7889; -- Vandoolin... Vendavoq's vream vo vell voods vrom vometown vf Vovalpolos... FIVA_OPEN_DIALOG = 7882; -- I've got imports from Kolshushu! MILVA_OPEN_DIALOG = 7883; -- How about some produce from Sarutabaruta? FIVA_CLOSED_DIALOG = 7884; -- I'm trying to sell goods from Kolshushu. But I can't because we don't have enough influence there. MILVA_CLOSED_DIALOG = 7885; -- I want to import produce from Sarutabaruta... But I can't do anything until we control that region! NIMIA_CLOSED_DIALOG = 7886; -- I can't sell goods from the lowlands of Elshimo because it's under foreign control. PATOLLE_CLOSED_DIALOG = 7887; -- I'm trying to find goods from Kuzotz. But how can I when it's under foreign control? DEGUERENDARS_OPEN_DIALOG = 7890; -- Welcome! Have a look at these rare goods from Tavnazia! DEGUERENDARS_CLOSED_DIALOG = 7891; -- With that other nation in control of the region, there is no way for me to import goods from Tavnazia... DEGUERENDARS_COP_NOT_COMPLETED = 7892; -- Why must I wait for the Kingdom to issue a permit allowing me to set up shop? How am I to feed my children in the meantime!? BONMAURIEUT_CLOSED_DIALOG = 8227; -- I would like to sell goods from the Elshimo Uplands, but I cannot, as it's under foreign control. NIMIA_OPEN_DIALOG = 8228; -- Hello, friend! Can I interest you in specialty goods from the Elshimo Lowlands? PATOLLE_OPEN_DIALOG = 8229; -- How about some specialty goods from Kuzotz? BONMAURIEUT_OPEN_DIALOG = 8230; -- My shipment is in! Would you like to see what has just arrived from the Elshimo Uplands? -- conquest Base CONQUEST_BASE = 7019; -- Tallying conquest results...
gpl-3.0
m13790115/Fast-and-farioo
plugins/banhammer.lua
35
12823
local function pre_process(msg) -- SERVICE MESSAGE if msg.action and msg.action.type then local action = msg.action.type -- Check if banned user joins chat by link if action == 'chat_add_user_link' then local user_id = msg.from.id print('Checking invited user '..user_id) local banned = is_banned(user_id, msg.to.id) if banned or is_gbanned(user_id) then -- Check it with redis print('User is banned!') local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] is banned and kicked ! ")-- Save to logs kick_user(user_id, msg.to.id) end end -- Check if banned user joins chat if action == 'chat_add_user' then local user_id = msg.action.user.id print('Checking invited user '..user_id) local banned = is_banned(user_id, msg.to.id) if banned or is_gbanned(user_id) then -- Check it with redis print('User is banned!') local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] added a banned user >"..msg.action.user.id)-- Save to logs kick_user(user_id, msg.to.id) local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id redis:incr(banhash) local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id local banaddredis = redis:get(banhash) if banaddredis then if tonumber(banaddredis) == 4 and not is_owner(msg) then kick_user(msg.from.id, msg.to.id)-- Kick user who adds ban ppl more than 3 times end if tonumber(banaddredis) == 8 and not is_owner(msg) then ban_user(msg.from.id, msg.to.id)-- Kick user who adds ban ppl more than 7 times local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id redis:set(banhash, 0)-- Reset the Counter end end end if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['settings'] then if data[tostring(msg.to.id)]['settings']['lock_bots'] then bots_protection = data[tostring(msg.to.id)]['settings']['lock_bots'] end end local bots_protection = "Yes" local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)]['settings']['lock_bots'] then bots_protection = data[tostring(msg.to.id)]['settings']['lock_bots'] end if msg.action.user.username ~= nil then if string.sub(msg.action.user.username:lower(), -3) == 'bot' and not is_momod(msg) and bots_protection == "yes" then --- Will kick bots added by normal users local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] added a bot > @".. msg.action.user.username)-- Save to logs kick_user(msg.action.user.id, msg.to.id) end end end -- No further checks return msg end -- banned user is talking ! if msg.to.type == 'chat' then local data = load_data(_config.moderation.data) local group = msg.to.id local texttext = 'groups' --if not data[tostring(texttext)][tostring(msg.to.id)] and not is_realm(msg) then -- Check if this group is one of my groups or not --chat_del_user('chat#id'..msg.to.id,'user#id'..our_id,ok_cb,false) --return --end local user_id = msg.from.id local chat_id = msg.to.id local banned = is_banned(user_id, chat_id) if banned or is_gbanned(user_id) then -- Check it with redis print('Banned user talking!') local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] banned user is talking !")-- Save to logs kick_user(user_id, chat_id) msg.text = '' end end return msg end local function kick_ban_res(extra, success, result) --vardump(result) --vardump(extra) local member_id = result.id local user_id = member_id local member = result.username local chat_id = extra.chat_id local from_id = extra.from_id local get_cmd = extra.get_cmd local receiver = "chat#id"..chat_id if get_cmd == "kick" then if member_id == from_id then return send_large_msg(receiver, "You can't kick yourself") end if is_momod2(member_id, chat_id) and not is_admin2(sender) then return send_large_msg(receiver, "You can't kick mods/owner/admins") end return kick_user(member_id, chat_id) elseif get_cmd == 'ban' then if is_momod2(member_id, chat_id) and not is_admin2(sender) then return send_large_msg(receiver, "You can't ban mods/owner/admins") end send_large_msg(receiver, 'User @'..member..' ['..member_id..'] banned') return ban_user(member_id, chat_id) elseif get_cmd == 'unban' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] unbanned') local hash = 'banned:'..chat_id redis:srem(hash, member_id) return 'User '..user_id..' unbanned' elseif get_cmd == 'banall' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] globally banned') return banall_user(member_id, chat_id) elseif get_cmd == 'unbanall' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] un-globally banned') return unbanall_user(member_id, chat_id) end end local function run(msg, matches) if matches[1]:lower() == 'id' then if msg.to.type == "user" then return "Bot ID: "..msg.to.id.. "\n\nYour ID: "..msg.from.id end if type(msg.reply_id) ~= "nil" then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] used /id ") id = get_message(msg.reply_id,get_message_callback_id, false) elseif matches[1]:lower() == 'id' then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] used /id ") return "Group ID for " ..string.gsub(msg.to.print_name, "_", " ").. ":\n\n"..msg.to.id end end local receiver = get_receiver(msg) if matches[1]:lower() == 'kickme' then-- /kickme if msg.to.type == 'chat' then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] left using kickme ")-- Save to logs chat_del_user("chat#id"..msg.to.id, "user#id"..msg.from.id, ok_cb, false) end end if not is_momod(msg) then -- Ignore normal users return nil end if matches[1]:lower() == "banlist" then -- Ban list ! local chat_id = msg.to.id if matches[2] and is_admin(msg) then chat_id = matches[2] end return ban_list(chat_id) end if matches[1]:lower() == 'ban' then-- /ban if type(msg.reply_id)~="nil" and is_momod(msg) then if is_admin(msg) then local msgr = get_message(msg.reply_id,ban_by_reply_admins, false) else msgr = get_message(msg.reply_id,ban_by_reply, false) end end local user_id = matches[2] local chat_id = msg.to.id if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return end if not is_admin(msg) and is_momod2(tonumber(matches[2]), msg.to.id) then return "you can't ban mods/owner/admins" end if tonumber(matches[2]) == tonumber(msg.from.id) then return "You can't ban your self !" end local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] baned user ".. matches[2]) ban_user(user_id, chat_id) else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'ban', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if matches[1]:lower() == 'unban' then -- /unban if type(msg.reply_id)~="nil" and is_momod(msg) then local msgr = get_message(msg.reply_id,unban_by_reply, false) end local user_id = matches[2] local chat_id = msg.to.id local targetuser = matches[2] if string.match(targetuser, '^%d+$') then local user_id = targetuser local hash = 'banned:'..chat_id redis:srem(hash, user_id) local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] unbaned user ".. matches[2]) return 'User '..user_id..' unbanned' else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'unban', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if matches[1]:lower() == 'kick' then if type(msg.reply_id)~="nil" and is_momod(msg) then if is_admin(msg) then local msgr = get_message(msg.reply_id,Kick_by_reply_admins, false) else msgr = get_message(msg.reply_id,Kick_by_reply, false) end end if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return end if not is_admin(msg) and is_momod2(matches[2], msg.to.id) then return "you can't kick mods/owner/admins" end if tonumber(matches[2]) == tonumber(msg.from.id) then return "You can't kick your self !" end local user_id = matches[2] local chat_id = msg.to.id name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] kicked user ".. matches[2]) kick_user(user_id, chat_id) else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'kick', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if msg.to.type == 'chat' then local user_id = matches[2] local chat_id = msg.to.id if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return end if not is_admin(msg) and is_momod2(matches[2], msg.to.id) then return "you can't kick mods/owner/admins" end if tonumber(matches[2]) == tonumber(msg.from.id) then return "You can't kick your self !" end local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] kicked user ".. matches[2]) kick_user(user_id, chat_id) else local member = string.gsub(matches[2], '@', '') local get_cmd = 'kick' local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] kicked user ".. matches[2]) chat_info(receiver, username_id, {get_cmd=get_cmd, receiver=receiver, chat_id=msg.to.id, member=member}) end else return 'This isn\'t a chat group' end end if not is_admin(msg) then return end if matches[1]:lower() == 'banall' then -- Global ban if type(msg.reply_id) ~="nil" and is_admin(msg) then return get_message(msg.reply_id,banall_by_reply, false) end local user_id = matches[2] local chat_id = msg.to.id local targetuser = matches[2] if string.match(targetuser, '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return false end banall_user(targetuser) return 'User ['..user_id..' ] globally banned' else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'banall', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if matches[1]:lower() == 'unbanall' then -- Global unban local user_id = matches[2] local chat_id = msg.to.id if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return false end unbanall_user(user_id) return 'User ['..user_id..' ] removed from global ban list' else local cbres_extra = { chat_id = msg.to.id, get_cmd = 'unbanall', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') res_user(username, kick_ban_res, cbres_extra) end end if matches[1]:lower() == "gbanlist" then -- Global ban list return banall_list() end end return { patterns = { "^[!/]([Bb]anall) (.*)$", "^[!/]([Bb]anall)$", "^[!/]([Bb]anlist) (.*)$", "^[!/]([Bb]anlist)$", "^[!/]([Gg]banlist)$", "^[!/]([Bb]an) (.*)$", "^[!/]([Kk]ick)$", "^[!/]([Uu]nban) (.*)$", "^[!/]([Uu]nbanall) (.*)$", "^[!/]([Uu]nbanall)$", "^[!/]([Kk]ick) (.*)$", "^[!/]([Kk]ickme)$", "^[!/]([Bb]an)$", "^[!/]([Uu]nban)$", "^[!/]([Ii]d)$", "^!!tgservice (.+)$" }, run = run, pre_process = pre_process }
gpl-2.0
gedadsbranch/Darkstar-Mission
scripts/zones/Windurst_Waters/npcs/Kopopo.lua
33
1196
----------------------------------- -- Area: Windurst Waters -- NPC: Kopopo -- Guild Merchant NPC: Cooking Guild -- @pos -103.935 -2.875 74.304 238 ----------------------------------- package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/zones/Windurst_Waters/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:sendGuild(530,5,20,7)) then player:showText(npc,KOPOPO_SHOP_DIALOG); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
AnySDK/Sample_Lua
frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/UserDefault.lua
10
3039
-------------------------------- -- @module UserDefault -- @parent_module cc -------------------------------- -- brief Set integer value by key.<br> -- js NA -- @function [parent=#UserDefault] setIntegerForKey -- @param self -- @param #char pKey -- @param #int value -------------------------------- -- @overload self, char, float -- @overload self, char -- @function [parent=#UserDefault] getFloatForKey -- @param self -- @param #char pKey -- @param #float defaultValue -- @return float#float ret (return value: float) -------------------------------- -- @overload self, char, bool -- @overload self, char -- @function [parent=#UserDefault] getBoolForKey -- @param self -- @param #char pKey -- @param #bool defaultValue -- @return bool#bool ret (return value: bool) -------------------------------- -- brief Set double value by key.<br> -- js NA -- @function [parent=#UserDefault] setDoubleForKey -- @param self -- @param #char pKey -- @param #double value -------------------------------- -- brief Set float value by key.<br> -- js NA -- @function [parent=#UserDefault] setFloatForKey -- @param self -- @param #char pKey -- @param #float value -------------------------------- -- @overload self, char, string -- @overload self, char -- @function [parent=#UserDefault] getStringForKey -- @param self -- @param #char pKey -- @param #string defaultValue -- @return string#string ret (return value: string) -------------------------------- -- brief Set string value by key.<br> -- js NA -- @function [parent=#UserDefault] setStringForKey -- @param self -- @param #char pKey -- @param #string value -------------------------------- -- brief Save content to xml file<br> -- js NA -- @function [parent=#UserDefault] flush -- @param self -------------------------------- -- @overload self, char, int -- @overload self, char -- @function [parent=#UserDefault] getIntegerForKey -- @param self -- @param #char pKey -- @param #int defaultValue -- @return int#int ret (return value: int) -------------------------------- -- @overload self, char, double -- @overload self, char -- @function [parent=#UserDefault] getDoubleForKey -- @param self -- @param #char pKey -- @param #double defaultValue -- @return double#double ret (return value: double) -------------------------------- -- brief Set bool value by key.<br> -- js NA -- @function [parent=#UserDefault] setBoolForKey -- @param self -- @param #char pKey -- @param #bool value -------------------------------- -- js NA -- @function [parent=#UserDefault] destroyInstance -- @param self -------------------------------- -- js NA -- @function [parent=#UserDefault] getXMLFilePath -- @param self -- @return string#string ret (return value: string) -------------------------------- -- js NA -- @function [parent=#UserDefault] isXMLFileExist -- @param self -- @return bool#bool ret (return value: bool) return nil
mit
dberga/arcbliz
src/scripts/lua/LuaBridge/0Misc/0LCF_Includes/LCF_Unit.lua
13
6802
--[[ /* * ArcEmu MMORPG Server * Copyright (C) 2005-2007 Ascent Team <http://www.ascentemu.com/> * Copyright (C) 2008-2010 <http://www.ArcEmu.org/> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ ]] assert( include("LCF.lua") ) local UNIT = LCF.UnitMethods assert(UNIT) local function alias(LHAname, LBname) UNIT[LHAname] = function(self, ...) return self[LBname](self, ...); end end function UNIT:FullCastSpell( id) self:CastSpell(self, id, false) end function UNIT:FullCastSpellOnTarget( target, id) self:CastSpell( target, id, false) end function UNIT:CastSpell(id) self:CastSpell(self, id, true) end function UNIT:CastSpellOnTarget(target, id) self:CastSpell(target, id, true) end function UNIT:SetChannelTarget(target) local guid = nil if(target) then guid = target:GetGUID() end self:SetUInt64Value(LCF.UNIT_FIELD_CHANNEL_OBJECT,guid) end function UNIT:SetChannelSpell( spell) self:SetUInt32Value(LCF.UNIT_CHANNEL_SPELL, spell) end function UNIT:GetChannelTarget() local guid = self:GetUInt64Value(LCF.UNIT_FIELD_CHANNEL_OBJECT) print( tostring(guid) ) if(guid) then return MapMgr:GetObject(guid) end return nil end function UNIT:GetChannelSpell() return self:GetUInt32Value( LCF.UNIT_CHANNEL_SPELL ) end function UNIT:ChannelSpell( spell, target) self:SetChannelTarget( target) self:SetChannelSpell( spell) end function UNIT:StopChannel() self:SetChannelTarget( nil) self:SetChannelSpell( 0 ) end function UNIT:SetCreatedBy(creator) local guid = 0 if(creator) then guid = creator:GetGUID() end self:SetUInt64Value(LCF.UNIT_FIELD_CREATEDBY, guid) end function UNIT:SetSummonedBy( summoner) local guid = 0 if(summoner) then guid = summoner:GetGUID() end self:SetUInt64Value( LCF.UNIT_FIELD_SUMMONEDBY, summoner:GetGUID() ) end function UNIT:GetCreatedBy() return self:GetObject( self:GetUInt64Value(LCF.UNIT_FIELD_CREATEDBY) ) end function UNIT:GetSummonedBy() return self:GetObject( self:GetUInt64Value(LCF.UNIT_FIELD_SUMMONEDBY) ) end function UNIT:CastSpellAoFID(x,y,z,id) self:CastSpellAoF(x, y, z, dbcSpell.LookupEntry(id), true) end alias("CastSpellAoE", "CastSpellAoF") function UNIT:QuickChannel(id, tar) self:CastSpell(tar, id, true) self:ChannelSpell(id, tar) end alias("DeMorph", "Demorph") alias("EventChat", "SendChatMessage") function UNIT:FullCastSpellAoF(x,y,z,id) self:CastSpellAoF(x, y, z, dbcSpell.LookupEntry(id), false); end alias("FullCastSpellAoE", "FullCastSpellAoF") function UNIT:GetCreatureNearestCoords(x,y,z,e) return MapMgr:GetInterface():GetCreatureNearestCoords(x,y,z,e); end function UNIT:GetGameObjectNearestCoords(x,y,z,e) return MapMgr:GetInterface():getGameObjectNearestCoords(x,y,z,e); end alias("GetDisplay", "GetDisplayId") alias("GetGender", "getGender") alias("GetLevel", "getLevel") function UNIT:GetMana() return self:GetPower(0); end function UNIT:GetMaxMana() return self:GetMaxPower(0); end alias("GetNativeDisplay", "GetNativeDisplayId") alias("IsAlive", "isAlive") function UNIT:IsInCombat() return self.CombatStatus:IsInCombat(); end alias("SetAttackTimer", "setAttackTimer") alias("SetGender", "setGender") alias("SetLevel", "setLevel") function UNIT:SetMana(value) self:SetPower(0, value); end function UNIT:SetMaxMana(value) self:SetMaxPower(0, value); end alias("SetModel", "SetDisplayId") function UNIT:SetNPCFlags(value) self:SetUInt32Value(LCF.UNIT_NPC_FLAGS, value); end function UNIT:SetZoneWeather(zoneid, _type, density) return SetWeather("zone", zoneid, _type, density); end function UNIT:SpawnCreature(entry, x, y, z, o, fac, duration, e1, e2, e3, phase, save) return EasySpawn(1, entry, x, y, z, o, fac, duration, e1, e2, e3, save, phase) end function UNIT:SpawnGameObject(entry, x, y, z, o, duration, scale, phase, save) return EasySpawn(2, entry, x, y, z, o, scale, duration, nil, nil, nil, save, phase) end function UNIT:CreateGuardian(entry, duration, angle, lvl) return self:create_guardian(entry, duration, angle, lvl, 0) end alias("Emote", "EventAddEmote") local oldSendChatMessage = getregistry("Unit").SendChatMessage; getregistry("Unit").SendChatMessage = function(self, _type, lang, msg, delay) delay = delay or 0; oldSendChatMessage(self, _type, lang, msg, delay) end local oldGetPower = getregistry("Unit").GetPower; getregistry("Unit").GetPower = function(self, powtype) powtype = powtype or self:GetPowerType(); oldGetPower(self, powtype) end function UNIT:GetPowerPct(idx) return (self:GetPower(idx) / self:GetMaxPower(idx)) * 100; end local oldGetMaxPower = getregistry("Unit").GetMaxPower; getregistry("Unit").GetMaxPower = function(self, powtype) powtype = powtype or self:GetPowerType(); oldGetMaxPower(self, powtype) end local oldSetPower = getregistry("Unit").SetPower; getregistry("Unit").SetPower = function(self, powtype) powtype = powtype or self:GetPowerType(); oldSetPower(self, powtype) end function UNIT:SetPowerPct(pct, _type) self:SetPower(_type, (pct / 100) * self:GetMaxPower(_type)); end local oldSetMaxPower = getregistry("Unit").SetMaxPower; getregistry("Unit").SetMaxPower = function(self, powtype) powtype = powtype or self:GetPowerType(); oldSetMaxPower(self, powtype) end function UNIT:GetAreaId() return MapMgr:GetAreaID(self:GetX(), self:GetY()); end function UNIT:Actual() if (self:IsCreature()) then return TO_CREATURE(self); else return TO_PLAYER(self); end end alias("AddAuraObject", "AddAura") function UNIT:AddAuraByID(spellid, duration, temp) local aura = Aura(dbcSpell:LookupEntry(spellid), duration, self, self, temp) self:AddAura(aura) return true end --------------------------------- RE-DEFINED 'alias' here------------------------------ alias = function(_func, ...) for _,label in ipairs(arg) do UNIT[label] = _func end end alias( function(self, id, ...) for _,target in ipairs(arg) do self:CastSpell(target, id, false) end end, "FullCastSpellOnTargets", "fullCastSpellOnTargets", "fullcastspellontargets") alias( function(self, id, ...) for _,target in ipairs(arg) do self:CastSpell(target, id, true) end end, "CastSpellOnTargets", "castSpellOnTargets", "castspellontargets")
agpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/items/moon_carrot.lua
35
1194
----------------------------------------- -- ID: 4567 -- Item: moon_carrot -- Food Effect: 5Min, All Races ----------------------------------------- -- Agility 1 -- Vitality -1 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,300,4567); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_AGI, 1); target:addMod(MOD_VIT, -1); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_AGI, 1); target:delMod(MOD_VIT, -1); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Grand_Palace_of_HuXzoi/Zone.lua
19
4371
----------------------------------- -- -- Zone: Grand_Palace_of_HuXzoi (34) -- ----------------------------------- package.loaded["scripts/zones/Grand_Palace_of_HuXzoi/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Grand_Palace_of_HuXzoi/TextIDs"); require("scripts/zones/Grand_Palace_of_HuXzoi/MobIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) zone:registerRegion(1, -102, -4, 541, -97, 4, 546); -- elvaan tower L-6 52?? zone:registerRegion(2, 737, -4, 541, 742, 4, 546); -- elvaan tower L-6 52?? zone:registerRegion(3, 661, -4, 87, 667, 4, 103); zone:registerRegion(4, -178, -4, 97, -173, 4, 103); zone:registerRegion(5, 340, -4, 97, 347, 4, 102); zone:registerRegion(6, -497, -4, 97, -492, 4, 102); zone:registerRegion(7, 97, -4, 372, 103, 4, 378); zone:registerRegion(8, -742, -4, 372, -736, 4, 379); zone:registerRegion(9, 332, -4, 696, 338, 4, 702); zone:registerRegion(10, -507, -4, 697, -501, 4, 702); -- Give Temperance a random PH local JoT_PH = math.random(1,5); SetServerVariable("[SEA]Jailer_of_Temperance_PH", Jailer_of_Temperance_PH[JoT_PH]); end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos(-20,-1.5,-355.482,192); end player:setVar("Hu-Xzoi-TP",0); return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) if (player:getVar("Hu-Xzoi-TP") == 0 and player:getAnimation() == 0) then -- prevent 2cs at same time switch (region:GetRegionID()): caseof { [1] = function (x) player:startEvent(0x0097); end, [2] = function (x) player:startEvent(0x009c); end, [3] = function (x) player:startEvent(0x009D); end, [4] = function (x) player:startEvent(0x0098); end, [5] = function (x) player:startEvent(0x009E); end, [6] = function (x) player:startEvent(0x0099); end, [7] = function (x) player:startEvent(0x009F); end, [8] = function (x) player:startEvent(0x009A); end, [9] = function (x) player:startEvent(0x009B); end, [10] = function (x) player:startEvent(0x0096); end, } end end; ----------------------------------- -- onRegionLeave ----------------------------------- function onRegionLeave(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid >0x0095 and csid < 0x00A0) then player:setVar("Hu-Xzoi-TP",1); end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid >0x0095 and csid < 0x00A0) then player:setVar("Hu-Xzoi-TP",0); end end; ----------------------------------- -- onGameHour ----------------------------------- function onGameHour(npc, mob, player) local VanadielHour = VanadielHour(); if (VanadielHour % 6 == 0) then -- Change the Jailer of Temperance PH every 6 hours (~15 mins). JoT_ToD = GetServerVariable("[SEA]Jailer_of_Temperance_POP"); if (GetMobAction(Jailer_of_Temperance) == 0 and JoT_ToD <= os.time(t)) then -- Don't want to set a PH if it's already up; also making sure it's been 15 mins since it died last local JoT_PH = math.random(1,5); SetServerVariable("[SEA]Jailer_of_Temperance_PH", Jailer_of_Temperance_PH[JoT_PH]); end end end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/abilities/celerity.lua
28
1156
----------------------------------- -- Ability: Celerity -- Reduces the casting time and the recast time of your next white magic spell by 50%. -- Obtained: Scholar Level 25 -- Recast Time: Stratagem Charge -- Duration: 1 white magic spell or 60 seconds, whichever occurs first. -- -- Level |Charges |Recharge Time per Charge -- ----- -------- --------------- -- 10 |1 |4:00 minutes -- 30 |2 |2:00 minutes -- 50 |3 |1:20 minutes -- 70 |4 |1:00 minute -- 90 |5 |48 seconds ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); ----------------------------------- -- onAbilityCheck ----------------------------------- function onAbilityCheck(player,target,ability) if player:hasStatusEffect(EFFECT_CELERITY) then return MSGBASIC_EFFECT_ALREADY_ACTIVE, 0; end return 0,0; end; ----------------------------------- -- onUseAbility ----------------------------------- function onUseAbility(player,target,ability) player:addStatusEffect(EFFECT_CELERITY,1,0,60); return EFFECT_CELERITY; end;
gpl-3.0
hgl888/flatbuffers
tests/namespace_test/NamespaceC/TableInC.lua
12
1513
-- automatically generated by the FlatBuffers compiler, do not modify -- namespace: NamespaceC local flatbuffers = require('flatbuffers') local TableInC = {} -- the module local TableInC_mt = {} -- the class metatable function TableInC.New() local o = {} setmetatable(o, {__index = TableInC_mt}) return o end function TableInC.GetRootAsTableInC(buf, offset) local n = flatbuffers.N.UOffsetT:Unpack(buf, offset) local o = TableInC.New() o:Init(buf, n + offset) return o end function TableInC_mt:Init(buf, pos) self.view = flatbuffers.view.New(buf, pos) end function TableInC_mt:ReferToA1() local o = self.view:Offset(4) if o ~= 0 then local x = self.view:Indirect(o + self.view.pos) local obj = require('NamespaceA.TableInFirstNS').New() obj:Init(self.view.bytes, x) return obj end end function TableInC_mt:ReferToA2() local o = self.view:Offset(6) if o ~= 0 then local x = self.view:Indirect(o + self.view.pos) local obj = require('NamespaceA.SecondTableInA').New() obj:Init(self.view.bytes, x) return obj end end function TableInC.Start(builder) builder:StartObject(2) end function TableInC.AddReferToA1(builder, referToA1) builder:PrependUOffsetTRelativeSlot(0, referToA1, 0) end function TableInC.AddReferToA2(builder, referToA2) builder:PrependUOffsetTRelativeSlot(1, referToA2, 0) end function TableInC.End(builder) return builder:EndObject() end return TableInC -- return the module
apache-2.0
gedadsbranch/Darkstar-Mission
scripts/zones/Temenos/bcnms/Temenos_Western_Tower.lua
13
1038
----------------------------------- -- Area: Temenos -- Name: ----------------------------------- -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) SetServerVariable("[Temenos_W_Tower]UniqueID",GenerateLimbusKey()); HideArmouryCrates(GetInstanceRegion(1298),TEMENOS); HideTemenosDoor(GetInstanceRegion(1298)); end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) player:setVar("limbusbitmap",0); player:setVar("characterLimbusKey",GetServerVariable("[Temenos_W_Tower]UniqueID")); player:setVar("LimbusID",1298); player:delKeyItem(COSMOCLEANSE); player:delKeyItem(WHITE_CARD); end; -- Leaving by every mean possible, given by the LeaveCode -- 3=Disconnected or warped out (if dyna is empty: launch 4 after 3) -- 4=Finish he dynamis function onBcnmLeave(player,instance,leavecode) --print("leave code "..leavecode); if(leavecode == 4) then player:setPos(580,-1.5,4.452,192); ResetPlayerLimbusVariable(player) end end;
gpl-3.0
Hxrmn/gToolkit
data/data_binary.lua
1
3424
--BINARY FUNCTIONS print("DATA BINARY") module("zdata", package.seeall, package.inherit(bit)) MIN_SIGNED_BYTE = -128 MAX_SIGNED_BYTE = 127 MAX_UNSIGNED_BYTE = 255 MIN_SIGNED_SHORT = -32768 MAX_SIGNED_SHORT = 32767 MAX_UNSIGNED_SHORT = 65535 MIN_SIGNED_LONG = -2147483648 MAX_SIGNED_LONG = 2147483647 MAX_UNSIGNED_LONG = 4294967295 local function sbrsh(v, b) return string.char(band(rshift(v, b), 0xFF)) end local function sblsh(s, e, b) return lshift(s:byte(e), b) end local function printBin(v, bits) local s = "" for i=1, bits do s = s .. band(v, 1) v = rshift(v, 1) end print(string.reverse(s)) end --[[ function float2str(value) local s=value<0 and 1 or 0 if math.abs(value)==1/0 then return (s==1 and "\0\0\0\255" or "\0\0\0\127") end if value~=value then return "\170\170\170\255" end local fr,exp=math.frexp(math.abs(value)) return string.char(math.floor(fr*2^24)%256).. string.char(math.floor(fr*2^16)%256).. string.char(math.floor(fr*2^8)%256).. string.char(math.floor(exp+64)%128+128*s) end function str2float(str) local fr, b = str:byte(1)/2^24+str:byte(2)/2^16+str:byte(3)/2^8, sblsh(str, 4, 0) local exp, s = band(b, 0x7F) - 0x40, math.floor(b/128) if exp==63 then return (fr==0 and (1-2*s)/0 or 0/0) end local n = (1-2*s)*fr*2^exp --fix wonky rounding if n - math.ceil(n) < 0.000001 then n = n + 0.000001 return math.floor(n*100000)/100000 end return n end ]] local INF = 1/0 function float2str(value) local s=value<0 and 1 or 0 if math.abs(value)==INF then return (s==1 and "\0\0\0\255" or "\0\0\0\127") end if value~=value then return "\170\170\170\255" end local fr, exp = 0, 0 if value ~= 0.0 then fr,exp=math.frexp(math.abs(value)) fr = math.floor(math.ldexp(fr, 24)) exp = exp + 126 end local ec = band(lshift(exp, 7), 0x80) local mc = band(rshift(fr, 16), 0x7f) local a = sbrsh(fr, 0) local b = sbrsh(fr, 8) local c = string.char( bor(ec, mc) ) local d = string.char( bor(s==1 and 0x80 or 0x00, rshift(exp, 1)) ) return a .. b .. c .. d end function str2float(str) local b4, b3 = str:byte(4), str:byte(3) local fr = lshift(band(b3, 0x7F), 16) + sblsh(str, 2, 8) + sblsh(str, 1, 0) local exp = band(b4, 0x7F) * 2 + rshift(b3, 7) local s = ((b4 > 127) and -1 or 1) return exp == 0 and 0 or math.ldexp((math.ldexp(fr, -23) + 1) * s, exp - 127) end function int2str(value, signed) if not signed then value = value + MAX_SIGNED_LONG + 1 end return sbrsh(value,24) .. sbrsh(value,16) .. sbrsh(value,8) .. sbrsh(value, 0) end function str2int(str, signed) local v = sblsh(str, 1, 24) + sblsh(str, 2, 16) + sblsh(str, 3, 8) + sblsh(str, 4, 0) return signed and v or (MAX_SIGNED_LONG + v + 1) end function short2str(value, signed) if signed then value = value - MIN_SIGNED_SHORT end return sbrsh(value, 8) .. sbrsh(value, 0) end function str2short(str, signed) local v = sblsh(str, 1, 8) + sblsh(str, 2, 0) return signed and (MIN_SIGNED_SHORT + v) or v end function byte2str(value, signed) if signed then value = value - MIN_SIGNED_BYTE end return sbrsh(value, 0) end function str2byte(str, signed) local v = sblsh(str, 1, 0) return signed and (MIN_SIGNED_BYTE + v) or v end --[[print(MAX_UNSIGNED_LONG) print(str2int( int2str(MAX_UNSIGNED_LONG, false), false ) )]] print(str2float( float2str(1.125) ))
mit
gedadsbranch/Darkstar-Mission
scripts/zones/Aht_Urhgan_Whitegate/npcs/Sulbahn.lua
10
2042
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Sulbahn -- Type: Alchemy Adv. Image Support -- @pos -10.470 -6.25 -141.700 241 ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); require("scripts/globals/status"); require("scripts/globals/crafting"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local guildMember = isGuildMember(player,1); if (guildMember == 1) then if (trade:hasItemQty(2184,1) and trade:getItemCount() == 1) then if (player:hasStatusEffect(EFFECT_ALCHEMY_IMAGERY) == false) then player:tradeComplete(); player:startEvent(0x027D,17160,1,19405,21215,30030,0,7,0); else npc:showText(npc, IMAGE_SUPPORT_ACTIVE); end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local guildMember = isGuildMember(player,1); local SkillLevel = player:getSkillLevel(2); if (guildMember == 1) then player:startEvent(0x027C,2,SkillLevel,0,511,0,0,7,2184); else player:startEvent(0x027C,0,0,0,0,0,0,7,0); -- Standard Dialogue end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if (csid == 0x027D) then player:messageSpecial(IMAGE_SUPPORT,0,7,0); player:addStatusEffect(EFFECT_ALCHEMY_IMAGERY,3,0,480); end end;
gpl-3.0
neukleus/LXML
src/LXML.lua
1
32233
-- XML Parser module written entirely in Lua -- Using code from http://manoelcampos.com/files/LuaXML-0.0.1-(lua5).tar.gz -- Updated to be a module -- Updated to run in Lua 5.2 local table = table local pairs = pairs local string = string local io = io local type = type -- Create the module table here local M = {} package.loaded[...] = M if setfenv then setfenv(1,M) -- Lua 5.1 else _ENV = M -- Lua 5.2 end -- Create the module table ends -- Module varaiables _VERSION = "1.2014.9.2" -- To hold the handler creation functions handlers = {} -- Other support functions -- getElementsByTagName --######################################################################## -- XMLPARSER FILE (1 FUNCTION) --######################################################################## -- FUNCTION Parser --- -- Overview: -- ========= -- -- This function provides a non-validating XML stream parser in Lua. -- -- Features: -- ========= -- -- * Tokenises well-formed XML (relatively robustly) -- * Flexible handler based event API (see below) -- * Parses all XML Infoset elements - ie. -- - Tags -- - Text -- - Comments -- - CDATA -- - XML Decl -- - Processing Instructions -- - DOCTYPE declarations -- * Provides limited well-formedness checking -- (checks for basic syntax & balanced tags only) -- * Flexible whitespace handling (selectable) -- * Entity Handling (selectable) -- -- Limitations: -- ============ -- -- * Non-validating -- * No charset handling -- * No namespace support -- * Shallow well-formedness checking only (fails -- to detect most semantic errors) -- -- API: -- ==== -- -- The parser provides a partially object-oriented API with -- functionality split into tokeniser and handler components. -- -- The handler instance is passed to the tokeniser and receives -- callbacks for each XML element processed (if a suitable handler -- function is defined). The API is conceptually similar to the -- SAX API but implemented differently. -- -- The following events are generated by the tokeniser -- -- handler:start - Start Tag -- handler:end - End Tag -- handler:text - Text -- handler:decl - XML Declaration -- handler:pi - Processing Instruction -- handler:comment - Comment -- handler:dtd - DOCTYPE definition -- handler:cdata - CDATA -- -- The function prototype for all the callback functions is -- -- callback(val,attrs,start,end) -- -- where attrs is a table and val/attrs are overloaded for -- specific callbacks - ie. -- -- Callback val attrs (table) -- -------- --- ------------- -- start name { attributes (name=val).. } -- end name nil -- text <text> nil -- cdata <text> nil -- decl "xml" { attributes (name=val).. } -- pi pi name { attributes (if present).. -- _text = <PI Text> -- } -- comment <text> nil -- dtd root element { _root = <Root Element>, -- _type = SYSTEM|PUBLIC, -- _name = <name>, -- _uri = <uri>, -- _internal = <internal dtd> -- } -- -- (start & end provide the character positions of the start/end -- of the element) -- -- XML data is passed to the parser instance through the 'parse' -- method (Note: must be passed a single string currently) -- -- Options -- ======= -- -- Parser options are controlled through the 'self.options' table. -- Available options are - -- -- * stripWS -- -- Strip non-significant whitespace (leading/trailing) -- and do not generate events for empty text elements -- -- * expandEntities -- -- Expand entities (standard entities + single char -- numeric entities only currently - could be extended -- at runtime if suitable DTD parser added elements -- to table (see obj._ENTITIES). May also be possible -- to expand multibyre entities for UTF-8 only -- -- * errorHandler -- -- Custom error handler function -- -- NOTE: Boolean options must be set to 'nil' not '0' -- -- Usage -- ===== -- -- Create a handler instance - -- -- h = { start = function(t,a,s,e) .... end, -- end = function(t,a,s,e) .... end, -- text = function(t,a,s,e) .... end, -- cdata = text } -- -- (or use predefined handler - see handler.lua) -- -- Create parser instance - -- -- p = Parser(h) -- -- Set options - -- -- p.options.xxxx = nil -- -- Parse XML data - -- -- p:parse("<?xml... ") -- -- Use the handler object to use the xml data -- -- License: -- ======== -- -- This code is freely distributable under the terms of the Lua license -- (http://www.lua.org/copyright.html) -- -- History -- ======= -- Added parameter parseAttributes (boolean) in xmlParser.parse method -- If true (default value), tag attributtes are parsed. -- by Manoel Campos da Silva Filho -- http://manoelcampos.com -- http://about.me/manoelcampos -- -- $Id: xml.lua,v 1.1.1.1 2001/11/28 06:11:33 paulc Exp $ -- -- $Log: xml.lua,v $ -- Revision 1.1.1.1 2001/11/28 06:11:33 paulc -- Initial Import -- --@author Paul Chakravarti (paulc@passtheaardvark.com)<p/> ---Parses a XML string --@param handler Handler object to be used to convert the XML string --to another formats. @see handler.lua Parser = function(handler) local obj = {} -- Public attributes obj.options = { stripWS = 1, expandEntities = 1, errorHandler = function(err,pos) return nil,string.format("%s [char=%d]\n", err or "Parse Error",pos) end, } -- Public methods obj.parse = function(self, str, parseAttributes) if parseAttributes == nil then parseAttributes = true end self._handler.parseAttributes = parseAttributes -- Check if the string begins with UTF-8 BOM if str:byte(1,1) == 0xEF and str:byte(2,2) == 0xBB and str:byte(3,3) == 0xBF then -- string begins with UTF-8 BOM, ignore those characters str = str:sub(4,-1) end local match,endmatch,pos = 0,0,1 local text,endt1,endt2,tagstr,tagname,attrs,starttext,endtext local errstart,errend,extstart,extend while match do -- Get next tag (first pass - fix exceptions below) match,endmatch,text,endt1,tagstr,endt2 = string.find(str,self._XML,pos) if not match then if string.find(str, self._WS,pos) then -- No more text - check document complete if #self._stack ~= 0 then return self:_err(self._errstr.incompleteXmlErr,pos) else break end else -- Unparsable text return self:_err(self._errstr.xmlErr,pos) end end -- Handle leading text starttext = match endtext = match + string.len(text) - 1 match = match + string.len(text) text = self:_parseEntities(self:_stripWS(text)) if text ~= "" and self._handler.text then self._handler:text(text,nil,match,endtext) end -- Test for tag type if string.find(string.sub(tagstr,1,5),"?xml%s") then -- XML Declaration match,endmatch,text = string.find(str,self._PI,pos) if not match then return self:_err(self._errstr.declErr,pos) end if match ~= 1 then -- Must be at start of doc if present return self:_err(self._errstr.declStartErr,pos) end tagname,attrs = self:_parseTag(text) -- TODO: Check attributes are valid -- Check for version (mandatory) if attrs.version == nil then return self:_err(self._errstr.declAttrErr,pos) end if self._handler.decl then self._handler:decl(tagname,attrs,match,endmatch) end elseif string.sub(tagstr,1,1) == "?" then -- Processing Instruction match,endmatch,text = string.find(str,self._PI,pos) if not match then return self:_err(self._errstr.piErr,pos) end if self._handler.pi then -- Parse PI attributes & text tagname,attrs = self:_parseTag(text) local pi = string.sub(text,string.len(tagname)+1) if pi ~= "" then if attrs then attrs._text = pi else attrs = { _text = pi } end end self._handler:pi(tagname,attrs,match,endmatch) end elseif string.sub(tagstr,1,3) == "!--" then -- Comment match,endmatch,text = string.find(str,self._COMMENT,pos) if not match then return self:_err(self._errstr.commentErr,pos) end if self._handler.comment then text = self:_parseEntities(self:_stripWS(text)) self._handler:comment(text,next,match,endmatch) end elseif string.sub(tagstr,1,8) == "!DOCTYPE" then -- DTD match,endmatch,attrs = self:_parseDTD(string,pos) if not match then return self:_err(self._errstr.dtdErr,pos) end if self._handler.dtd then self._handler:dtd(attrs._root,attrs,match,endmatch) end elseif string.sub(tagstr,1,8) == "![CDATA[" then -- CDATA match,endmatch,text = string.find(str,self._CDATA,pos) if not match then return self:_err(self._errstr.cdataErr,pos) end if self._handler.cdata then self._handler:cdata(text,nil,match,endmatch) end else -- Normal tag -- Need check for embedded '>' in attribute value and extend -- match recursively if necessary eg. <tag attr="123>456"> while 1 do errstart,errend = string.find(tagstr,self._ATTRERR1) if errend == nil then errstart,errend = string.find(tagstr,self._ATTRERR2) if errend == nil then break end end extstart,extend,endt2 = string.find(str,self._TAGEXT,endmatch+1) tagstr = tagstr .. string.sub(string,endmatch,extend-1) if not match then return self:_err(self._errstr.xmlErr,pos) end endmatch = extend end -- Extract tagname/attrs tagname,attrs = self:_parseTag(tagstr) if (endt1=="/") then -- End tag if self._handler.endtag then if attrs then -- Shouldnt have any attributes in endtag return self:_err(string.format("%s (/%s)", self._errstr.endTagErr, tagname) ,pos) end if table.remove(self._stack) ~= tagname then return self:_err(string.format("%s (/%s)", self._errstr.unmatchedTagErr, tagname) ,pos) end local err,msg = self._handler:endtag(tagname,nil,match,endmatch) if not err then return nil,msg end end else -- Start Tag table.insert(self._stack,tagname) if self._handler.starttag then self._handler:starttag(tagname,attrs,match,endmatch) end --TODO: Tags com fechamento automático estão sendo --retornadas como uma tabela, o que complica --para a app NCLua tratar isso. É preciso --fazer com que seja retornado um campo string vazio. -- Self-Closing Tag if (endt2=="/") then table.remove(self._stack) if self._handler.endtag then local err,msg = self._handler:endtag(tagname,nil,match,endmatch) if not err then return nil,msg end end end end end pos = endmatch + 1 end end -- Private attribures/functions obj._handler = handler obj._stack = {} obj._XML = '^([^<]*)<(%/?)([^>]-)(%/?)>' obj._ATTR1 = '([%w-:_]+)%s*=%s*"(.-)"' obj._ATTR2 = '([%w-:_]+)%s*=%s*\'(.-)\'' obj._CDATA = '<%!%[CDATA%[(.-)%]%]>' obj._PI = '<%?(.-)%?>' obj._COMMENT = '<!%-%-(.-)%-%->' obj._TAG = '^(.-)%s.*' obj._LEADINGWS = '^%s+' obj._TRAILINGWS = '%s+$' obj._WS = '^%s*$' obj._DTD1 = '<!DOCTYPE%s+(.-)%s+(SYSTEM)%s+["\'](.-)["\']%s*(%b[])%s*>' obj._DTD2 = '<!DOCTYPE%s+(.-)%s+(PUBLIC)%s+["\'](.-)["\']%s+["\'](.-)["\']%s*(%b[])%s*>' obj._DTD3 = '<!DOCTYPE%s+(.-)%s*(%b[])%s*>' obj._DTD4 = '<!DOCTYPE%s+(.-)%s+(SYSTEM)%s+["\'](.-)["\']%s*>' obj._DTD5 = '<!DOCTYPE%s+(.-)%s+(PUBLIC)%s+["\'](.-)["\']%s+["\'](.-)["\']%s*>' obj._ATTRERR1 = '=%s*"[^"]*$' obj._ATTRERR2 = '=%s*\'[^\']*$' obj._TAGEXT = '(%/?)>' obj._ENTITIES = { ["&lt;"] = "<", ["&gt;"] = ">", ["&amp;"] = "&", ["&quot;"] = '"', ["&apos;"] = "'", ["&#(%d+);"] = function (x) local d = tonumber(x) if d >= 0 and d < 256 then return string.char(d) else return "&#"..d..";" end end, ["&#x(%x+);"] = function (x) local d = tonumber(x,16) if d >= 0 and d < 256 then return string.char(d) else return "&#x"..x..";" end end, } obj._err = function(self,err,pos) if self.options.errorHandler then self.options.errorHandler(err,pos) end end obj._errstr = { xmlErr = "Error Parsing XML", declErr = "Error Parsing XMLDecl", declStartErr = "XMLDecl not at start of document", declAttrErr = "Invalid XMLDecl attributes", piErr = "Error Parsing Processing Instruction", commentErr = "Error Parsing Comment", cdataErr = "Error Parsing CDATA", dtdErr = "Error Parsing DTD", endTagErr = "End Tag Attributes Invalid", unmatchedTagErr = "Unbalanced Tag", incompleteXmlErr = "Incomplete XML Document", } obj._stripWS = function(self,s) if self.options.stripWS then s = string.gsub(s,'^%s+','') s = string.gsub(s,'%s+$','') end return s end obj._parseEntities = function(self,s) if self.options.expandEntities then --for k,v in self._ENTITIES do for k,v in pairs(self._ENTITIES) do --print (k, v) s = string.gsub(s,k,v) end end return s end obj._parseDTD = function(self,s,pos) -- match,endmatch,root,type,name,uri,internal local m,e,r,t,n,u,i m,e,r,t,u,i = string.find(s,self._DTD1,pos) if m then return m,e,{_root=r,_type=t,_uri=u,_internal=i} end m,e,r,t,n,u,i = string.find(s,self._DTD2,pos) if m then return m,e,{_root=r,_type=t,_name=n,_uri=u,_internal=i} end m,e,r,i = string.find(s,self._DTD3,pos) if m then return m,e,{_root=r,_internal=i} end m,e,r,t,u = string.find(s,self._DTD4,pos) if m then return m,e,{_root=r,_type=t,_uri=u} end m,e,r,t,n,u = string.find(s,self._DTD5,pos) if m then return m,e,{_root=r,_type=t,_name=n,_uri=u} end return nil end ---Parses a string representing a tag --@param s String containing tag text --@return Returns a string containing the tagname and a table attrs --containing the atributtes of tag obj._parseTag = function(self,s) local attrs = {} local tagname = string.gsub(s,self._TAG,'%1') string.gsub(s,self._ATTR1,function (k,v) --attrs[string.lower(k)]=self:_parseEntities(v) attrs[k]=self:_parseEntities(v) -- storing the attribute name without case translation -- Milind Gupta 9/1/2014 attrs._ = 1 end) string.gsub(s,self._ATTR2,function (k,v) --attrs[string.lower(k)]=self:_parseEntities(v) attrs[k]=self:_parseEntities(v) -- storing the attribute name without case translation -- Milind Gupta 9/1/2014 attrs._ = 1 end) if attrs._ then attrs._ = nil else attrs = nil end return tagname,attrs end return obj end --######################################################################## -- HANDLER FILE --######################################################################## --- -- Overview: -- ========= -- Standard XML event handler(s) for XML parser module (xml.lua) -- -- Features: -- ========= -- printHandler - Generate XML event trace -- domHandler - Generate DOM-like node tree -- simpleTreeHandler - Generate 'simple' node tree -- -- API: -- ==== -- Must be called as handler function from xmlParser -- and implement XML event callbacks (see xmlParser.lua -- for callback API definition) -- -- printHandler: -- ------------- -- -- printHandler prints event trace for debugging -- -- domHandler: -- ----------- -- -- domHandler generates a DOM-like node tree structure with -- a single ROOT node parent - each node is a table comprising -- fields below. -- -- node = { _name = <Element Name>, -- _type = ROOT|ELEMENT|TEXT|COMMENT|PI|DECL|DTD, -- _attr = { Node attributes - see callback API }, -- _parent = <Parent Node> -- _children = { List of child nodes - ROOT/NODE only } -- } -- -- The dom structure is capable of representing any valid XML document -- -- simpleTreeHandler -- ----------------- -- -- simpleTreeHandler is a simplified handler which attempts -- to generate a more 'natural' table based structure which -- supports many common XML formats. -- -- The XML tree structure is mapped directly into a recursive -- table structure with node names as keys and child elements -- as either a table of values or directly as a string value -- for text. Where there is only a single child element this -- is inserted as a named key - if there are multiple -- elements these are inserted as a vector (in some cases it -- may be preferable to always insert elements as a vector -- which can be specified on a per element basis in the -- options). Attributes are inserted as a child element with -- a key of '_attr'. -- -- Only Tag/Text & CDATA elements are processed - all others -- are ignored. -- -- This format has some limitations - primarily -- -- * Mixed-Content behaves unpredictably - the relationship -- between text elements and embedded tags is lost and -- multiple levels of mixed content does not work -- * If a leaf element has both a text element and attributes -- then the text must be accessed through a vector (to -- provide a container for the attribute) -- -- In general however this format is relatively useful. -- -- It is much easier to understand by running some test -- data through 'textxml.lua -simpletree' than to read this) -- -- Options -- ======= -- simpleTreeHandler.options.noReduce = { <tag> = bool,.. } -- -- - Nodes not to reduce children vector even if only -- one child -- -- domHandler.options.(comment|pi|dtd|decl)Node = bool -- -- - Include/exclude given node types -- -- Usage -- ===== -- Pased as delegate in xmlParser constructor and called -- as callback by xmlParser:parse(xml) method. -- -- See textxml.lua for examples -- License: -- ======== -- -- This code is freely distributable under the terms of the Lua license -- (<a href="http://www.lua.org/copyright.html">http://www.lua.org/copyright.html</a>) -- -- History -- ======= -- $Id: handler.lua,v 1.1.1.1 2001/11/28 06:11:33 paulc Exp $ -- -- $Log: handler.lua,v $ -- Revision 1.1.1.1 2001/11/28 06:11:33 paulc -- Initial Import --@author Paul Chakravarti (paulc@passtheaardvark.com)<p/> ---Handler to generate a string prepresentation of a table --Convenience function for printHandler (Does not support recursive tables). --@param t Table to be parsed --@returns Returns a string representation of table --[[local function showTable(t) local sep = '' local res = '' if type(t) ~= 'table' then return t end for k,v in pairs(t) do if type(v) == 'table' then v = showTable(v) end res = res .. sep .. string.format("%s=%s",k,v) sep = ',' end res = '{'..res..'}' return res end]] ---Handler to generate a simple event trace local printHandler = function() local obj = {} obj.starttag = function(self,t,a,s,e) io.write("Start : "..t.."\n") if a then for k,v in pairs(a) do io.write(string.format(" + %s='%s'\n",k,v)) end end return true end obj.endtag = function(self,t,s,e) io.write("End : "..t.."\n") return true end obj.text = function(self,t,s,e) io.write("Text : "..t.."\n") return true end obj.cdata = function(self,t,s,e) io.write("CDATA : "..t.."\n") return true end obj.comment = function(self,t,s,e) io.write("Comment : "..t.."\n") return true end obj.dtd = function(self,t,a,s,e) io.write("DTD : "..t.."\n") if a then for k,v in pairs(a) do io.write(string.format(" + %s='%s'\n",k,v)) end end return true end obj.pi = function(self,t,a,s,e) io.write("PI : "..t.."\n") if a then for k,v in pairs(a) do io. write(string.format(" + %s='%s'\n",k,v)) end end return true end obj.decl = function(self,t,a,s,e) io.write("XML Decl : "..t.."\n") if a then for k,v in pairs(a) do io.write(string.format(" + %s='%s'\n",k,v)) end end return true end return obj end --Obtém a primeira chave de uma tabela --@param Tabela de onde deverá ser obtido o primeiro elemento --@return Retorna a primeira chave da tabela --[[local function getFirstKey(tb) if type(tb) == "table" then --O uso da função next não funciona para pegar o primeiro elemento. Trava aqui --k, v = next(tb) --return k for k, v in pairs(tb) do return k end return nil else return tb end end]] ---Handler to generate a lua table from a XML content string local function simpleTreeHandler() local obj = {} obj.root = {} obj.stack = {obj.root;n=1} obj.options = {noreduce = {}} obj.reduce = function(self,node,key,parent) -- Recursively remove redundant vectors for nodes -- with single child elements for k,v in pairs(node) do if type(v) == 'table' then self:reduce(v,k,node) end end if table.getn(node) == 1 and not self.options.noreduce[key] and node._attr == nil then parent[key] = node[1] else node.n = nil end return true end --@param t Table that represents a XML tag --@param a Attributes table (_attr) obj.starttag = function(self,t,a) local node = {} if self.parseAttributes == true then node._attr=a end local current = self.stack[table.getn(self.stack)] if current[t] then table.insert(current[t],node) else current[t] = {node;n=1} end table.insert(self.stack,node) return true end --@param t Tag name obj.endtag = function(self,t,s) --Tabela que representa a tag atualmente sendo processada local current = self.stack[table.getn(self.stack)] --Tabela que representa a tag na qual a tag --atual está contida. local prev = self.stack[table.getn(self.stack)-1] if not prev[t] then return nil, "XML Error - Unmatched Tag ["..s..":"..t.."]\n" end if prev == self.root then -- Once parsing complete recursively reduce tree self:reduce(prev,nil,nil) end --local firstKey = getFirstKey(current) local firstKey if type(current) == "table" then for k,v in pairs(current) do firstKey = k break end else firstKey = current end --Se a primeira chave da tabela que representa --a tag atual não possui nenhum elemento, --é porque não há nenhum valor associado à tag -- (como nos casos de tags automaticamente fechadas como <senha />). --Assim, atribui uma string vazia a mesma para --que seja retornado vazio no lugar da tag e não --uma tabela. Retornando uma string vazia --simplifica para as aplicações NCLua --para imprimir tal valor. if firstKey == nil then current[t] = "" prev[t] = "" end table.remove(self.stack) return true end obj.text = function(self,t) local current = self.stack[table.getn(self.stack)] table.insert(current,t) return true end obj.cdata = obj.text return obj end --- domHandler local function domHandler() local obj = {} obj.options = {commentNode=1,piNode=1,dtdNode=1,declNode=1} obj.root = { _children = {n=0}, _type = "ROOT" } obj.current = obj.root obj.starttag = function(self,t,a) local node = { _type = 'ELEMENT', _name = t, _attr = a, _parent = self.current, _children = {n=0} } table.insert(self.current._children,node) self.current = node return true end obj.endtag = function(self,t,s) if t ~= self.current._name then return nil,"XML Error - Unmatched Tag ["..s..":"..t.."]\n" end self.current = self.current._parent return true end obj.text = function(self,t) local node = { _type = "TEXT", _parent = self.current, _text = t } table.insert(self.current._children,node) return true end obj.comment = function(self,t) if self.options.commentNode then local node = { _type = "COMMENT", _parent = self.current, _text = t } table.insert(self.current._children,node) end return true end obj.pi = function(self,t,a) if self.options.piNode then local node = { _type = "PI", _name = t, _attr = a, _parent = self.current } table.insert(self.current._children,node) end return true end obj.decl = function(self,t,a) if self.options.declNode then local node = { _type = "DECL", _name = t, _attr = a, _parent = self.current } table.insert(self.current._children,node) end return true end obj.dtd = function(self,t,a) if self.options.dtdNode then local node = { _type = "DTD", _name = t, _attr = a, _parent = self.current } table.insert(self.current._children,node) end return true end obj.cdata = obj.text -- get the array of dom elements with the name = t -- t = tag name -- full = boolean, if true then even if a element matches tag its child hierarchy is still checked otherwise skipped obj.getElementsByTagName = function(nodeList,t,full) if type(t) ~= "string" then return nil, "Need a tag name as a string" end local list = {} local function getMatchedElements(listNode,full) local goIn for i = 1,#listNode do goIn = true if listNode[i]._type == "ELEMENT" and listNode[i]._name == t then list[#list + 1] = listNode[i] if not full then goIn = false end end if goIn and listNode[i]._children then getMatchedElements(listNode[i]._children,full) end end end getMatchedElements(nodeList,full) return list end -- Function to generate the XML string representation of the DOM object obj.toXML = function(obj) end return obj end handlers.printHandler = printHandler handlers.simpleTreeHandler = simpleTreeHandler handlers.domHandler = domHandler
mit
guanbaiqiang/notion-scripts
statusd/statusd_apm.lua
2
2377
-- Adds capability for OpenBSD APM info in ion3 statusbar. -- -- Originally written by Greg Steuck and released into the Public Domain -- 2006-10-28 modified by Darrin Chandler <dwchandler@stilyagin.com> -- to work with OpenBSD 4.0 apm output. -- -- To install: -- Save this file as ~/.ion3/statusd_apm.lua, -- Change ~/.ion3/cfg_statusbar.lua like so: -- Add "apm={}," to mod_statusbar.launch_statusd, -- Modify "template" to include %apm_ variables -- e.g. template="[ %date || load:% %>load || bat: %apm_pct%%, A/C %apm_ac ]," -- -- Available variables: -- %apm_state high, low, critical -- %apm_pct battery life (in percent) -- %apm_estimate battery life (in minutes) -- %apm_ac External A/C charger state -- %apm_mode Adjustment mode (manual, auto, cool running) -- %apm_speed CPU speed local unknown = "?", "?", "?", "?", "?", "?" function get_apm() local f=io.popen('/usr/sbin/apm', 'r') if not f then return unknown end local s=f:read('*all') f:close() local _, _, state, pct, estimate, ac, mode, speed = string.find(s, "Battery state: (%S+), ".. "(%d+)%% remaining, ".. "([0-9]*) minutes life estimate\n".. "A/C adapter state: ([^\n]*)\n".. "Performance adjustment mode:%s(.+)%s".. "%((.+)%)\n".. ".*" ) if not state then return unknown end return state, pct, estimate, ac, mode, speed end local function inform(key, value) statusd.inform("apm_"..key, value) end local apm_timer local function update_apm() local state, pct, estimate, ac, mode, speed = get_apm() local hint if statusd ~= nil then inform("state", state) inform("pct", pct) inform("estimate", estimate) if state == "high" then hint = "normal" elseif state == "low" then hint = "important" else hint = "critical" end if hint ~= nil then inform("state_hint", hint) inform("pct_hint", hint) inform("estimate_hint", hint) end inform("ac", ac) if ac == "connected" then hint = "important" else hint = "critical" end inform("ac_hint", hint) inform("mode", mode) inform("speed", speed) apm_timer:set(30*1000, update_apm) else io.stdout:write("Batt: "..pct.."% ("..state.. ", "..estimate.." mins)\n".. "A/C: "..ac.."\n".. "Mode: "..mode.."\n".. "CPU Speed: "..speed.."\n" ) end end if statusd ~= nil then apm_timer = statusd.create_timer() end update_apm()
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Southern_San_dOria/npcs/Vaquelage.lua
4
1468
----------------------------------- -- Area: Southern San dOria -- NPC: Vaquelage -- Type: Item Deliverer NPC -- @pos 17.396 1.699 -29.357 230 ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script local FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then local count = trade:getItemCount(); local MagicFlyer = trade:hasItemQty(532,1); if (MagicFlyer == true and count == 1) then player:messageSpecial(FLYER_REFUSED); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc, ITEM_DELIVERY_DIALOG); player:openSendBox(); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/zones/Port_Bastok/npcs/Fo_Mocorho.lua
59
1038
----------------------------------- -- Area: Port Bastok -- NPC: Fo Mocorho -- Type: Weather Reporter ----------------------------------- package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Port_Bastok/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0074,0,0,0,0,0,0,0,VanadielTime()); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
AnySDK/Sample_Lua
frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/Animate3D.lua
4
2650
-------------------------------- -- @module Animate3D -- @extend ActionInterval -- @parent_module cc -------------------------------- -- -- @function [parent=#Animate3D] setSpeed -- @param self -- @param #float speed -------------------------------- -- -- @function [parent=#Animate3D] setWeight -- @param self -- @param #float weight -------------------------------- -- get & set speed, negative speed means playing reverse -- @function [parent=#Animate3D] getSpeed -- @param self -- @return float#float ret (return value: float) -------------------------------- -- get & set blend weight, weight must positive -- @function [parent=#Animate3D] getWeight -- @param self -- @return float#float ret (return value: float) -------------------------------- -- @overload self, cc.Animation3D, float, float -- @overload self, cc.Animation3D -- @function [parent=#Animate3D] create -- @param self -- @param #cc.Animation3D animation -- @param #float fromTime -- @param #float duration -- @return Animate3D#Animate3D ret (return value: cc.Animate3D) -------------------------------- -- animate transistion time -- @function [parent=#Animate3D] getTransitionTime -- @param self -- @return float#float ret (return value: float) -------------------------------- -- create Animate3D by frame section, [startFrame, endFrame)<br> -- param animation used to generate animate3D<br> -- param startFrame<br> -- param endFrame<br> -- param frameRate default is 30 per second<br> -- return Animate3D created using animate -- @function [parent=#Animate3D] createWithFrames -- @param self -- @param #cc.Animation3D animation -- @param #int startFrame -- @param #int endFrame -- @param #float frameRate -- @return Animate3D#Animate3D ret (return value: cc.Animate3D) -------------------------------- -- -- @function [parent=#Animate3D] startWithTarget -- @param self -- @param #cc.Node target -------------------------------- -- -- @function [parent=#Animate3D] reverse -- @param self -- @return Animate3D#Animate3D ret (return value: cc.Animate3D) -------------------------------- -- -- @function [parent=#Animate3D] clone -- @param self -- @return Animate3D#Animate3D ret (return value: cc.Animate3D) -------------------------------- -- -- @function [parent=#Animate3D] stop -- @param self -------------------------------- -- -- @function [parent=#Animate3D] update -- @param self -- @param #float t -------------------------------- -- -- @function [parent=#Animate3D] step -- @param self -- @param #float dt return nil
mit
hooksta4/darkstar
scripts/zones/West_Ronfaure/npcs/Ballie_RK.lua
30
3051
----------------------------------- -- Area: West Ronfaure -- NPC: Ballie, R.K. -- Type: Border Conquest Guards -- @pos -560.292 -0.961 -576.655 100 ----------------------------------- package.loaded["scripts/zones/West_Ronfaure/TextIDs"] = nil; ----------------------------------- require("scripts/globals/conquest"); require("scripts/zones/West_Ronfaure/TextIDs"); local guardnation = SANDORIA; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno local guardtype = 4; -- 1: city, 2: foreign, 3: outpost, 4: border local region = RONFAURE; local csid = 0x7ffa; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) tradeConquestGuard(player,npc,trade,guardnation,guardtype); end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then if (supplyRunFresh(player) == 1) then player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies ! else player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use." player:delKeyItem(getSupplyKey(region)); player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region)); player:setVar("supplyQuest_region",0); end else local arg1 = getArg1(guardnation, player) - 1; if (arg1 >= 1792) then -- foreign, non-allied player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0); else -- citizen or allied player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0); end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); if (option == 1) then local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600; player:delStatusEffect(EFFECT_SIGIL); player:delStatusEffect(EFFECT_SANCTION); player:delStatusEffect(EFFECT_SIGNET); player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet elseif (option == 2) then player:delKeyItem(getSupplyKey(region)); player:addCP(supplyReward[region + 1]) player:messageSpecial(CONQUEST); -- "You've earned conquest points!" if (hasOutpost(player, region+5) == 0) then local supply_quests = 2^(region+5); player:addNationTeleport(guardnation,supply_quests); player:setVar("supplyQuest_region",0); end elseif (option == 4) then if (player:delGil(giltosetHP(guardnation,player))) then player:setHomePoint(); player:messageSpecial(CONQUEST + 94); -- "Your home point has been set." else player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here." end end end;
gpl-3.0
gorkinovich/DefendersOfMankind
Exes/media/scripts/test3.lua
1
1195
print("\nOh my god... that's the funky shit!!!\n"); SPANISH_TEXT = { ["TXT001"] = "Tras muchos años de profunda reflexión..."; ["TXT002"] = "he llegado a la irrevocable conclusión..."; ["TXT003"] = "que jugar mola más que desarrollar... xDD"; }; -- ******************************************************************************** -- Objects in lua test -- http://www.lua.org/manual/5.1/ -- http://lua-users.org/wiki/MetamethodsTutorial -- http://lua-users.org/wiki/ObjectOrientationTutorial -- http://lua-users.org/wiki/InheritanceTutorial FooClass = {}; FooClass_MetaTable = { __index = FooClass }; function FooClass:new(a, b, c) return setmetatable({ prop1 = a or "Hello", prop2 = b or 42, prop3 = c or { 1, 2, 3 } }, FooClass_MetaTable); end function FooClass:print() print("FooClass:print()"); print(self.prop1); print(self.prop2); print(self.prop3); print(); end function testFooPrint() local testFoo = { FooClass:new(), FooClass:new(1), FooClass:new(1, 2), FooClass:new(1, 2, 3) }; for k, v in pairs(testFoo) do v:print(); end end testFooPrint();
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/commands/adddynatime.lua
7
1216
--------------------------------------------------------------------------------------------------- -- func: adddynatime -- auth: <Unknown> :: Modded by atom0s. -- desc: Adds an amount of time to the given target. If no target; then to the current player. --------------------------------------------------------------------------------------------------- cmdprops = { permission = 1, parameters = "si" }; function onTrigger(player, arg1, arg2) if (arg2 ~= nil) then local target = GetPlayerByName(arg1); if (target == nil) then player:PrintToPlayer(string.format( "Player named '%s' not found!", arg1 )); else -- Ensure the target is in Dynamis.. if (target:isInDynamis()) then target:addTimeToDynamis(arg2); end end else local amount = tonumber(arg1); if (amount == nil) then player:PrintToPlayer("Enter a valid amount of time (as a number)!"); else -- Ensure the player is in Dynamis.. if (player:isInDynamis()) then player:addTimeToDynamis(amount); end end end end
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Bhaflau_Thickets/npcs/qm1.lua
16
1188
----------------------------------- -- Area: Bhaflau Thickets -- NPC: ??? (Spawn Lividroot Amooshah(ZNM T2)) -- @pos 334 -10 184 52 ----------------------------------- package.loaded["scripts/zones/Bhaflau_Thickets/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Bhaflau_Thickets/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (trade:hasItemQty(2578,1) and trade:getItemCount() == 1) then -- Trade Oily Blood player:tradeComplete(); SpawnMob(16990473,180):updateClaim(player); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(NOTHING_HAPPENS); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
gflima/nclua
tests/test-event-stopwatch-get-time.lua
1
1465
--[[ Copyright (C) 2013-2018 PUC-Rio/Laboratorio TeleMidia This file is part of NCLua. NCLua is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. NCLua is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with NCLua. If not, see <https://www.gnu.org/licenses/>. ]]-- local tests = require ('tests') local ASSERT = tests.ASSERT local ASSERT_ERROR = tests.ASSERT_ERROR local TRACE_SEP = tests.trace_sep local TRACE = tests.trace local stopwatch = require ('nclua.event.stopwatch') _ENV = nil -- Sanity checks. local clock = stopwatch.new () ASSERT_ERROR (stopwatch.get_time) ASSERT_ERROR (stopwatch.get_time, clock, 'unknown') -- Sleep for 1s and check if get_time() gives the expected results. clock:start () tests.sleep (1) ASSERT (tests.numeq (clock:get_time ('us'), 10^6, .5 * 10^6)) ASSERT (tests.numeq (clock:get_time ('ms'), 10^3, .5 * 10^3)) ASSERT (tests.numeq (clock:get_time ('s'), 1, .5)) -- Check if start() and stop() change state. ASSERT (clock:get_state () == 'started') clock:stop () ASSERT (clock:get_state () == 'stopped')
gpl-2.0
snabbco/snabb
src/dasm_mm.lua
22
3988
--wrappers around mmap to support dynamic code exection. --Written by Cosmin Apreutesei. Public Domain. --Tested with Windows, Linux and OSX, x86 and x86-64. local ffi = require'ffi' local C = ffi.C local function checkh(ptr) return assert(ptr ~= nil and ptr) end local function checkz(ret) assert(ret == 0) end local function checknz(ret) assert(ret ~= 0) end local new, free, protect --Using VirtualAlloc allows memory protection, but can only allocate memory in multiple-of-64K chunks. local USE_VIRTUALALLOC = false if ffi.os == 'Windows' then if USE_VIRTUALALLOC then ffi.cdef[[ void* VirtualAlloc(void* lpAddress, size_t dwSize, uint32_t flAllocationType, uint32_t flProtect); int VirtualFree(void* lpAddress, size_t dwSize, uint32_t dwFreeType); int VirtualProtect(void* lpAddress, size_t dwSize, uint32_t flNewProtect, uint32_t* lpflOldProtect); ]] local PAGE_READWRITE = 0x04 local PAGE_EXECUTE_READ = 0x20 local MEM_COMMIT = 0x1000 local MEM_RESERVE = 0x2000 local MEM_RELEASE = 0x8000 function new(size) return checkh(C.VirtualAlloc(nil, size, bit.bor(MEM_RESERVE, MEM_COMMIT), PAGE_READWRITE)) end function protect(addr, size) local oldprotect = ffi.new'uint32_t[1]' --because null not accepted checknz(C.VirtualProtect(addr, size, PAGE_EXECUTE_READ, oldprotect)) end function free(addr, size) assert(size, 'size required') --on other platforms checknz(C.VirtualFree(addr, 0, MEM_RELEASE)) end else local HEAP_NO_SERIALIZE = 0x00000001 local HEAP_ZERO_MEMORY = 0x00000008 local HEAP_CREATE_ENABLE_EXECUTE = 0x00040000 ffi.cdef[[ void* HeapCreate(uint32_t flOptions, size_t dwInitialSize, size_t dwMaximumSize); void* HeapAlloc(void* hHeap, uint32_t dwFlags, size_t dwBytes); int HeapFree(void* hHeap, uint32_t dwFlags, void* lpMem); ]] local heap function new(size) heap = heap or checkh(C.HeapCreate(bit.bor(HEAP_NO_SERIALIZE, HEAP_CREATE_ENABLE_EXECUTE), 0, 0)) return checkh(C.HeapAlloc(heap, HEAP_ZERO_MEMORY, size)) end function protect(addr, size) end function free(addr, size) assert(size, 'size required') --on other platforms checknz(C.HeapFree(heap, HEAP_NO_SERIALIZE, addr)) end end elseif ffi.os == 'Linux' or ffi.os == 'OSX' then if ffi.os == 'OSX' then ffi.cdef'typedef int64_t off_t;' else ffi.cdef'typedef long int off_t;' end ffi.cdef[[ void* mmap(void *addr, size_t length, int prot, int flags, int fd, off_t offset); int munmap(void *addr, size_t length); int mprotect(void *addr, size_t len, int prot); ]] local PROT_READ = 1 local PROT_WRITE = 2 local PROT_EXEC = 4 local MAP_PRIVATE = 2 local MAP_ANON = ffi.os == 'Linux' and 0x20 or 0x1000 function new(size) local ret = C.mmap(nil, size, bit.bor(PROT_READ, PROT_WRITE), bit.bor(MAP_PRIVATE, MAP_ANON), -1, 0) if ffi.cast('intptr_t', ret) == ffi.cast('intptr_t', -1) then error(string.format('mmap errno: %d', ffi.errno())) end return checkh(ret) end function protect(addr, size) checkz(C.mprotect(addr, size, bit.bor(PROT_READ, PROT_EXEC))) end function free(addr, size) checkz(C.munmap(addr, size)) end end local new = function(size) --override for hooking to gc local addr = new(size) ffi.gc(addr, function(addr) free(addr, size) ffi.gc(addr, nil) end) return addr end if not ... then local function test(size) local addr = new(size) print(addr) addr = ffi.cast('int32_t*', addr) assert(addr[0] == 0) addr[0] = 1234 --writable assert(addr[0] == 1234) protect(addr, size) --addr[0] = 4321 --uncomment this to get a crash (r/o memory); TODO: test if executable --addr = nil; collectgarbage() --enable this to fail the assertion below return addr end local a1 = test(64*1024*1000) --64MB local a2 = test(16) --16 bytes assert(a1 ~= a2) --different pages a1 = nil a2 = nil collectgarbage() --TODO: test if finalizer was called end return {new = new, free = free, protect = protect}
apache-2.0
hooksta4/darkstar
scripts/zones/Dynamis-Xarcabard/mobs/Marquis_Sabnak.lua
2
1207
----------------------------------- -- Area: Dynamis Xarcabard -- NPC: Marquis Sabnak ----------------------------------- require("scripts/globals/dynamis"); require("scripts/zones/Dynamis-Xarcabard/TextIDs"); ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) end; ----------------------------------- -- onMobFight Action ----------------------------------- function onMobFight(mob,target) end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob,killer) local Animate_Trigger = GetServerVariable("[DynaXarcabard]Boss_Trigger"); if (mob:isInBattlefieldList() == false) then mob:addInBattlefieldList(); Animate_Trigger = Animate_Trigger + 64; SetServerVariable("[DynaXarcabard]Boss_Trigger",Animate_Trigger); if (Animate_Trigger == 32767) then SpawnMob(17330911); -- 142 SpawnMob(17330912); -- 143 SpawnMob(17330183); -- 177 SpawnMob(17330184); -- 178 activateAnimatedWeapon(); -- Change subanim of all animated weapon end end if (Animate_Trigger == 32767) then killer:messageSpecial(PRISON_OF_SOULS_HAS_SET_FREE); end end;
gpl-3.0
gedadsbranch/Darkstar-Mission
scripts/globals/items/bowl_of_mushroom_soup.lua
35
1384
----------------------------------------- -- ID: 4419 -- Item: mushroom_soup -- Food Effect: 3hours, All Races ----------------------------------------- -- Magic Points 20 -- Strength -1 -- Mind 2 -- MP Recovered While Healing 1 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,10800,4419); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MP, 20); target:addMod(MOD_STR, -1); target:addMod(MOD_MND, 2); target:addMod(MOD_MPHEAL, 1); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MP, 20); target:delMod(MOD_STR, -1); target:delMod(MOD_MND, 2); target:delMod(MOD_MPHEAL, 1); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/Upper_Jeuno/npcs/Ajithaam.lua
2
4176
----------------------------------- -- Area: Upper Jeuno -- NPC: Ajithaam -- @pos -82 0.1 160 244 ----------------------------------- package.loaded["scripts/zones/Upper_Jeuno/TextIDs"] = nil; package.loaded["scripts/globals/settings"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/globals/missions"); require("scripts/globals/teleports"); require("scripts/globals/keyitems"); require("scripts/zones/Upper_Jeuno/TextIDs"); --[[ Bitmask Designations: Ru'Lude Gardens (South to North) 00001 (H-9) Albiona (near the downstairs fountain and embassies) 00002 (G-8) Crooked Arrow (by the steps leading to the Auction House) 00004 (H-7) Muhoho (upstairs on the palace balcony) 00008 (G-7) Adolie (in the palace Guard Post) 00010 (I-6) Yavoraile (in the palace Dining Hall) Upper Jeuno (North to South) 00020 (G-7) Sibila-Mobla (wanders outside M&P's Market) 00040 (G-8) Shiroro (in the house with Nekha Shachaba outside) 00080 (G-8) Luto Mewrilah (north-west of the Temple of the Goddess) 00100 (H-9) Renik (Just east of the Temple of the Goddess) 00200 (H-9) Hinda (inside the Temple of the Goddess, she is the first person on the left as you enter) Lower Jeuno (North to South) 00400 (J-7) Sutarara (Neptune's Spire Inn, 2nd door on the left, outside of the Tenshodo) 00800 (I-7) Saprut (top of the stairs above AH) 01000 (H-9) Bluffnix (Gobbiebag quest NPC, in Muckvix's Junk Shop) 02000 (H-10) Naruru (Merchant's House on the middle level above Muckvix's Junk Shop) 04000 (G-10) Gurdern (across from the Chocobo Stables) Port Jeuno (West to East) 08000 (G-8) Red Ghost (pacing back and forth between Bastok & San d'Oria Air Travel Agencies) 10000 (H-8) Karl (Show all three kids the badge) 20000 (H-8) Shami (BCNM Orb NPC) 40000 (I-8) Rinzei (west of the Windurst Airship Agency, next to Sagheera) 80000 (I-8) Sagheera (west of the Windurst Airship Agency) ]]-- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (trade:getGil() == 300 and trade:getItemCount() == 1 and player:getQuestStatus(JEUNO,LURE_OF_THE_WILDCAT_JEUNO) == QUEST_COMPLETED and player:getCurrentMission(TOAU) > IMMORTAL_SENTRIES) then -- Needs a check for at least traded an invitation card to Naja Salaheem player:startEvent(10177); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local LureJeuno = player:getQuestStatus(JEUNO,LURE_OF_THE_WILDCAT_JEUNO); local WildcatJeuno = player:getVar("WildcatJeuno"); if (LureJeuno ~= 2 and ENABLE_TOAU == 1) then if (LureJeuno == 0) then player:startEvent(10088); else if (WildcatJeuno == 0) then player:startEvent(10089); elseif (player:isMaskFull(WildcatJeuno,20) == true) then player:startEvent(10091); else player:startEvent(10090); end end elseif (player:getCurrentMission(TOAU) >= 2) then player:startEvent(10176); else player:startEvent(10092); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if (csid == 10088) then player:addQuest(JEUNO,LURE_OF_THE_WILDCAT_JEUNO); player:setVar("WildcatJeuno",0); player:addKeyItem(WHITE_SENTINEL_BADGE); player:messageSpecial(KEYITEM_OBTAINED,WHITE_SENTINEL_BADGE); elseif (csid == 10091) then player:completeQuest(JEUNO,LURE_OF_THE_WILDCAT_JEUNO); player:addFame(JEUNO, JEUNO_FAME*150); player:setVar("WildcatJeuno",0); player:delKeyItem(WHITE_SENTINEL_BADGE); player:addKeyItem(WHITE_INVITATION_CARD); player:messageSpecial(KEYITEM_LOST,WHITE_SENTINEL_BADGE); player:messageSpecial(KEYITEM_OBTAINED,WHITE_INVITATION_CARD); elseif (csid == 10177) then player:tradeComplete(); toAhtUrhganWhitegate(player); end end;
gpl-3.0
guanbaiqiang/notion-scripts
styles/look_awesome.lua
2
4272
-- look-awesome.lua drawing engine configuration file for Ion. if not gr.select_engine("de") then return end de.reset() de.defstyle("*", { shadow_colour = "#99A", highlight_colour = "#99A", background_colour = "#667", foreground_colour = "#FFF", padding_colour = "#99A", transparent_background = false, border_style = "elevated", highlight_pixels = 0, shadow_pixels = 0, padding_pixels = 0, spacing = 0, font = "-xos4-terminus-medium-r-normal--14-*-*-*-*-*-*-*", text_align = "center", }) de.defstyle("frame", { based_on = "*", -- this sets the color between tabs as well, I could not figure out any way to make it transparent background_colour = "black", transparent_background = true, -- de.substyle("active", { -- }), -- de.substyle("inactive", { -- }), }) de.defstyle("frame-ionframe", { based_on = "frame", -- de.substyle("active", { -- }), -- de.substyle("inactive", { -- }), }) de.defstyle("frame-floatframe", { based_on = "frame", padding_pixels = 1, de.substyle("active", { padding_colour = "#99A", }), de.substyle("inactive", { padding_colour = "#666", }), }) de.defstyle("tab", { based_on = "*", highlight_pixels = 1, shadow_pixels = 1, padding_pixels = 1, spacing = 1, transparent_background = true, text_align = "center", de.substyle("active-selected", { shadow_colour = "#99A", highlight_colour = "#99A", background_colour = "#667", foreground_colour = "#FFF", }), de.substyle("active-unselected", { shadow_colour = "#667", highlight_colour = "#667", background_colour = "#334", foreground_colour = "#999", }), de.substyle("inactive-selected", { shadow_colour = "#666", highlight_colour = "#666", background_colour = "#333", foreground_colour = "#888", }), de.substyle("inactive-unselected", { shadow_colour = "#333", highlight_colour = "#333", background_colour = "#111", foreground_colour = "#777", }), }) de.defstyle("tab-frame", { based_on = "tab", padding_pixels = 3, -- de.substyle("*-*-tagged", { -- }), -- de.substyle("*-*-*-dragged", { -- }), de.substyle("active-*-*-*-activity", { shadow_colour = "red", highlight_colour = "red", background_colour = "#800", foreground_colour = "#FFF", }), de.substyle("inactive-*-*-*-activity", { shadow_colour = "#800", highlight_colour = "#800", background_colour = "#400", foreground_colour = "#888", }), }) de.defstyle("tab-frame-ionframe", { based_on = "tab-frame", }) de.defstyle("tab-frame-floatframe", { based_on = "tab-frame", padding_pixels = 4, }) de.defstyle("tab-menuentry", { based_on = "tab", padding_pixels = 6, spacing = 4, font = "-xos4-terminus-medium-r-normal--16-*-*-*-*-*-*-*", text_align = "left", -- de.substyle("*-*-submenu", { -- }), }) de.defstyle("tab-menuentry-big", { based_on = "tab-menuentry", padding_pixels = 8, font = "-xos4-terminus-medium-r-normal--28-*-*-*-*-*-*-*", }) de.defstyle("input", { based_on = "*", foreground_colour = "#FFF", background_colour = "#667", padding_colour = "#667", transparent_background = false, border_style = "elevated", padding_pixels = 2, }) de.defstyle("input-edln", { based_on = "input", de.substyle("*-cursor", { background_colour = "#FFF", foreground_colour = "#667", }), de.substyle("*-selection", { background_colour = "#AAA", foreground_colour = "#334", }), }) de.defstyle("input-message", { based_on = "input", }) de.defstyle("input-menu", { based_on = "input", transparent_background = true, highlight_pixels = 0, shadow_pixels = 0, padding_pixels = 0, spacing = 0, }) de.defstyle("input-menu-big", { based_on = "input-menu", }) de.defstyle("moveres_display", { based_on = "input", }) de.defstyle("dock", { --based_on = "frame-ionframe", border = 7, outline_style = "each", }) gr.refresh()
gpl-3.0
rrampage/monitor
lua/consumers/mail.lua
2
1802
-- http://serverfault.com/questions/230749/how-to-use-nginx-to-proxy-to-a-host-requiring-authentication local m = require 'model_helpers' local c = require 'consumer_helpers' local inspect = require 'inspect' local lock = require 'lock' local fn = require 'functional' local Config = require 'models.config' local http_ng = require 'http_ng' local async_resty = require 'http_ng.backend.async_resty' local http = http_ng.new{ backend = async_resty } local api_user = os.getenv('SLUG_SENDGRID_USER') local api_key = os.getenv('SLUG_SENDGRID_KEY') local from_mail_address = os.getenv('SLUG_FROM_MAIL_ADDR') local send_mail_sg = function(job) local response = http.urlencoded.post( 'https://api.sendgrid.com/api/mail.send.json', { api_user = api_user, api_key = api_key, to = job.to, from = from_mail_address, subject = job.subject or 'apitools message', text = job.body, }) return response.status == 200 end local send_mail = send_mail_sg local remove_from_queue = function(queue, id) return m.delete(queue, id) end local mailer = { name = 'mailer', has_to_act_on = function(job) -- return job.level == 'info' return true end } mailer.next_job = c.next_job(mailer) mailer.run = function() lock.around(mailer.name, function() local stand_by = {} local job = mailer.next_job() local count = 0 mailer.has_to_act_on = function(job) return fn.none(function(x) return x == job._id end, stand_by) end while job and count < 5 do count = count + 1 if not job then return end if send_mail(job) then remove_from_queue('events', job._id) else table.insert(stand_by, job._id) end job = mailer.next_job() end end) end mailer.send_mail = send_mail return mailer
mit
gedadsbranch/Darkstar-Mission
scripts/zones/Gusgen_Mines/npcs/_5g0.lua
34
1096
----------------------------------- -- Area: Gusgen Mines -- NPC: _5g0 (Door C) -- @pos 44 -42.4 -25.5 196 ----------------------------------- package.loaded["scripts/zones/Gusgen_Mines/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Gusgen_Mines/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (npc:getAnimation() == 9) then player:messageSpecial(LOCK_OTHER_DEVICE) else return 0; end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Chateau_dOraguille/npcs/_6h4.lua
2
3510
----------------------------------- -- Area: Chateau d'Oraguille -- Door: Great Hall -- Involved in Missions: 3-3, 5-2, 6-1, 8-2, 9-1 -- @pos 0 -1 13 233 ----------------------------------- package.loaded["scripts/zones/Chateau_dOraguille/TextIDs"] = nil; package.loaded["scripts/globals/missions"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/zones/Chateau_dOraguille/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local currentMission = player:getCurrentMission(SANDORIA); local MissionStatus = player:getVar("MissionStatus"); -- Mission San D'Oria 9-2 The Heir to the Light if (currentMission == THE_HEIR_TO_THE_LIGHT and MissionStatus == 5) then player:startEvent(0x0008); -- Mission San D'Oria 9-1 Breaking Barriers elseif (currentMission == BREAKING_BARRIERS and MissionStatus == 4) then if (player:hasKeyItem(FIGURE_OF_TITAN) and player:hasKeyItem(FIGURE_OF_GARUDA) and player:hasKeyItem(FIGURE_OF_LEVIATHAN)) then player:startEvent(0x004c); end elseif (currentMission == BREAKING_BARRIERS and MissionStatus == 0) then player:startEvent(0x0020); -- Mission San D'Oria 8-2 Lightbringer elseif (currentMission == LIGHTBRINGER and MissionStatus == 6) then player:startEvent(0x0068); elseif (currentMission == LIGHTBRINGER and MissionStatus == 0) then player:startEvent(0x0064); -- Mission San D'Oria 6-1 Leaute's Last Wishes elseif (currentMission == LEAUTE_S_LAST_WISHES and MissionStatus == 1) then player:startEvent(87); -- Mission San D'Oria 5-2 The Shadow Lord elseif (currentMission == THE_SHADOW_LORD and MissionStatus == 5) then player:startEvent(0x003D); -- Mission San D'Oria 3-3 Appointment to Jeuno elseif (currentMission == APPOINTMENT_TO_JEUNO and MissionStatus == 2) then player:startEvent(0x0219); else player:startEvent(0x202); end return 1; end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if (csid == 0x0219) then player:setVar("MissionStatus",3); player:addKeyItem(LETTER_TO_THE_AMBASSADOR); player:messageSpecial(KEYITEM_OBTAINED,LETTER_TO_THE_AMBASSADOR); elseif (csid == 0x003D) then finishMissionTimeline(player,3,csid,option); elseif (csid == 87) then player:setVar('MissionStatus',2); elseif (csid == 0x0064) then player:setVar("Mission8-1Completed",0) -- dont need this var anymore. JP midnight is done and prev mission completed. player:setVar("MissionStatus",1); elseif (csid == 0x0068) then player:setVar("Mission8-2Kills",0); finishMissionTimeline(player,3,csid,option); elseif (csid == 0x0008) then player:setVar("MissionStatus",6); elseif (csid == 0x0020) then player:setVar("Cutscenes_8-2",0); -- dont need this var now that mission is flagged and cs have been triggered to progress player:setVar("MissionStatus",1); elseif (csid == 0x004c) then finishMissionTimeline(player,3,csid,option); end end;
gpl-3.0
hooksta4/darkstar
scripts/zones/zones/Bastok_Markets/npcs/Reet.lua
3
1299
----------------------------------- -- Area: Bastok Markets -- NPC: Reet -- Adventurer's Assistant -- @zone 235 -- @pos -237 -12 -41 ------------------------------------- package.loaded["scripts/zones/Bastok_Markets/TextIDs"] = nil; ------------------------------------- require("scripts/globals/settings"); require("scripts/zones/Bastok_Markets/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (trade:getItemCount() == 1 and trade:hasItemQty(536,1) == true) then player:startEvent(0x0006); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0005); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if (csid == 0x0006) then player:tradeComplete(); player:addGil(GIL_RATE*50); player:messageSpecial(GIL_OBTAINED,GIL_RATE*50); end end;
gpl-3.0
aoseeh003/aoooose
plugins/sof2.lua
2
7071
local function run(msg, matches) if #matches < 2 then return "بعد هذا الأمر، من خلال تحديد كلمة المسافة أو العبارة التي تريد إدخال الكتابة الجميلة" end if string.len(matches[2]) > 44 then return "الحد الأقصى المسموح به 40 حرفاالأحرف الإنجليزية والأرقام" end local font_base = "ء,ئ,ا,ب,ت,ث,ج,ح,خ,د,ذ,ر,ز,س,ش,ص,ض,ط,ظ,ع,غ,ق,ف,ك,ل,م,ن,ه,و,ي,0,9,8,7,6,5,4,3,2,1,.,_" local font_hash = "ي,و,ه,ن,م,ل,ك,ف,ق,غ,ع,ظ,ط,ض,ص,ش,س,ز,ر,ذ,د,خ,ح,ج,ث,ت,ب,ا,ئ,ء,0,1,2,3,4,5,6,7,8,9,.,_" local fonts = { "ء,ئ,ٳ,ٻً,تہ,ثہ,جہ,حہ,خہ,دٍ,ذً,ر,ڒٍ,سہ,شہ,صً,ض,طہ,ظً,عـ,غہ,قـً,فُہ,كُہ,لہ,مـْ,نٍ,ه,ﯝ,يہ,0ً,1,2ً,3ً,4ً,5ً,6ً,7َ,8ً,9ً,.,_", "ء,ئ,آ̲,ب̲,ت̲,ث̲,ج̲,ح̲,خ̲,د̲,ذ̲,ر̲,ز̲,س̲,ش̲,ص̲,ض,ط̲,ظً̲,ع̲,غ̲,ق̲,ف̲,ك̲,ل̲,م̲,ن̲,ہ̲,ۆ̲,ي̲,0̲,1̲,2̲,3̲,4̲,5̲,6̲,7̲,8̲,9̲,.,_", "ء,ئ,آ̯͡,ب̯͡,ت̯͡,ث̯͡,ج̯͡,ح̯͡,خ̯͡,د̯͡,ذ̯͡,ر̯͡,ز̯͡,س̯͡,ش̯͡,ص̯͡,ض,ط̯͡,ظ̯͡,ع̯͡,غ̯͡,ق̯͡,ف̯͡,ك̯͡,ل̯͡,م̯͡,ن̯͡,ہ̯͡,ۆ̯͡,ي̯͡,0̯͡,1̯͡,2̯͡,3̯͡,4̯͡,5̯͡,6̯͡,7̯͡,8̯͡,9̯͡,.,_", "ء,ئ,آ͠,ب͠,ت͠,ث͠,ج͠,ح͠,خ͠,د͠,ذ͠,ر,ز͠,س͠,ش͠,ص͠,ض,ط͠,ظ͠,ع͠,غ͠,ق͠,ف͠,گ͠,ل͠,م͠,ن͠,ه͠,و͠,ي͠,0͠,1͠,2͠,3͠,4͠,5͠,6͠,7͠,8͠,9͠,.,_", "ء,ئ,آ,ب,ت,ث,جٍ,حٍ,خـ,دِ,ڌ,رٍ,ز,س,شُ,ص,ض,طُ,ظً,عٍ,غ,ق,فَ,گ,لُ,م,ن,ہ,ۆ,يَ,₀,₁,₂,₃,₄,₅,₆,₇,₈,₉,.,_", "ء,ئ,إآ,̜̌ب,تـ,,ثـ,جٍ,و,خ,ﮃ,ذ,رٍ,زً,سًٌُُ,شُ,ص,ض,طُ,ظً,۶,غ,ق,فَ,گ,لُ,مـ,ن,ه̷̸̐,ۈ,يَ,0,⇂,Շ,Ɛ,h,ʢ,9,L,8,6,.,_", "ء,ئ,آ,ب,ت,ث,جٍ,حٍ,خـ,دِ,ڌ,رٍ,ز,س,شُ,ص,ض,طُ,ظً,عٍ,غ,ق,فَ,گ,لُ,م,ن,ہ,ۆ,يَ,₀,₁,₂,₃,₄,₅,₆,₇,₈,₉,.,_", "ء,ئ,ٵ̷ ,ب̷,ت̷,ث̷,ج̷,ح̷,خ̷,د̷ِ,ذ̷,ر̷,ز̷,س̷,ش̷ُ,ص̷,ض,ط̷ُ,ظ̷ً,ع̷ٍ,غ̷,ق̷,ف̷َ,گ̷,ل̷,م̷,ن̷,ہ̷,ۆ̷,ي̷,0̷,1̷,2̷,3̷,4̷,5̷,6̷,7̷,8̷,9̷,.,_", "ء,ئ,آإ,بـ♥̨̥̬̩,تـ♥̨̥̬̩,ثـ♥̨̥̬̩,جـ♥̨̥̬̩,حـ♥̨̥̬̩,خ,د,ذ,ر,ز,س,ش,ص,ض,ط♥̨̥̬̩,ظ♥̨̥̬̩,ع,غ♥̨̥̬̩,قـ♥̨̥̬̩,ف,گ♥̨̥̬̩,ل,مـ♥̨̥̬̩,ن,هـ♥̨̥̬̩,و,ي,⁰,¹,²,³,⁴,⁵,⁶,⁷,⁸,⁹,.,_", "ء,ئ,آ,بُ,تْ,ثُ,ج,ح,ځ,ڊ,ڏ,ر,ڒٍ,ڛ,شُ,صً,ض,طُ,ظً,عٌ,غٍ,قٌ,فُ,ڪ,لُ,مْ,نْ,ﮩ,وُ,يُ,0,1,2,3,4,5,6,7,8,9,.,_", "ء,ئ,آ,بَ,ت,ث,جٍ,حٍ,خـ,دِ,ذَ,رٍ,زْ,س,شُ,ص,ض,طُ,ظً,عٍ,غ,قٌ,فُ,ڪ,لُِ,م,ن,هـ,وُ,ي,0̲̣̣̥,1̣̣̝̇̇,2̲̣̣̣̥,3̍̍̍̊,4̩̥,5̲̣̥,6̥̥̲̣̥,7̣̣̣̝̇̇̇,8̣̝̇,9̲̣̣̥,.,_", "ء,ئ,آ,ب,ت,ث,جٍ,حٍ,خـ,دِ,ڌ,رٍ,ز,س,شُ,ص,ض,طُ,ظً,عٍ,غ,ق,فَ,گ,لُ,م,ن,ہ,ۆ,يَ,₀,₁,₂,₃,₄,₅,₆,₇,₈,₉,.,_", "ء,ئ,ٵ̷ ,ب̷,ت̷,ث̷,ج̷,ح̷,خ̷,د̷ِ,ذ̷,ر̷,ز̷,س̷,ش̷ُ,ص̷,ض,ط̷ُ,ظ̷ً,ع̷ٍ,غ̷,ق̷,ف̷َ,گ̷,ل̷,م̷,ن̷,ہ̷,ۆ̷,ي̷,0̷,1̷,2̷,3̷,4̷,5̷,6̷,7̷,8̷,9̷,.,_", "ء,ئ,آ͠,ب͠,ت͠,ث͠,ج͠,ح͠,خ͠,د͠,ذ͠,ر,ز͠,س͠,ش͠,ص͠,ض,ط͠,ظ͠,ع͠,غ͠,ق͠,ف͠,گ͠,ل͠,م͠,ن͠,ه͠,و͠,ي͠,0͠,1͠,2͠,3͠,4͠,5͠,6͠,7͠,8͠,9͠,.,_", "ء,ئ,آ̯͡,ب̯͡,ت̯͡,ث̯͡,ج̯͡,ح̯͡,خ̯͡,د̯͡,ذ̯͡,ر̯͡,ز̯͡,س̯͡,ش̯͡,ص̯͡,ض,ط̯͡,ظ̯͡,ع̯͡,غ̯͡,ق̯͡,ف̯͡,ك̯͡,ل̯͡,م̯͡,ن̯͡,ہ̯͡,ۆ̯͡,ي̯͡,0̯͡,1̯͡,2̯͡,3̯͡,4̯͡,5̯͡,6̯͡,7̯͡,8̯͡,9̯͡,.,_", "ء,ئ,آإ,بـ♥̨̥̬̩,تـ♥̨̥̬̩,ثـ♥̨̥̬̩,جـ♥̨̥̬̩,حـ♥̨̥̬̩,خ,د,ذ,ر,ز,س,ش,ص,ض,ط♥̨̥̬̩,ظ♥̨̥̬̩,ع,غ♥̨̥̬̩,قـ♥̨̥̬̩,ف,گ♥̨̥̬̩,ل,مـ♥̨̥̬̩,ن,هـ♥̨̥̬̩,و,ي,⁰,¹,²,³,⁴,⁵,⁶,⁷,⁸,⁹,̴.̴,̴_̴", } ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local result = {} i=0 for k=1,#fonts do i=i+1 local tar_font = fonts[i]:split(",") local text = matches[2] local text = text:gsub("ء",tar_font[1]) local text = text:gsub("ئ",tar_font[2]) local text = text:gsub("ا",tar_font[3]) local text = text:gsub("ب",tar_font[4]) local text = text:gsub("ت",tar_font[5]) local text = text:gsub("ث",tar_font[6]) local text = text:gsub("ج",tar_font[7]) local text = text:gsub("ح",tar_font[8]) local text = text:gsub("خ",tar_font[9]) local text = text:gsub("د",tar_font[10]) local text = text:gsub("ذ",tar_font[11]) local text = text:gsub("ر",tar_font[12]) local text = text:gsub("ز",tar_font[13]) local text = text:gsub("س",tar_font[14]) local text = text:gsub("ش",tar_font[15]) local text = text:gsub("ص",tar_font[16]) local text = text:gsub("ض",tar_font[17]) local text = text:gsub("ط",tar_font[18]) local text = text:gsub("ظ",tar_font[19]) local text = text:gsub("ع",tar_font[20]) local text = text:gsub("غ",tar_font[21]) local text = text:gsub("ق",tar_font[22]) local text = text:gsub("ف",tar_font[23]) local text = text:gsub("ك",tar_font[24]) local text = text:gsub("ل",tar_font[25]) local text = text:gsub("م",tar_font[26]) local text = text:gsub("ن",tar_font[27]) local text = text:gsub("ه",tar_font[28]) local text = text:gsub("و",tar_font[29]) local text = text:gsub("ي",tar_font[30]) local text = text:gsub("0",tar_font[31]) local text = text:gsub("9",tar_font[32]) local text = text:gsub("8",tar_font[33]) local text = text:gsub("7",tar_font[34]) local text = text:gsub("6",tar_font[35]) local text = text:gsub("5",tar_font[36]) local text = text:gsub("4",tar_font[37]) local text = text:gsub("3",tar_font[38]) local text = text:gsub("2",tar_font[39]) local text = text:gsub("1",tar_font[40]) table.insert(result, text) end local result_text = "❣ زخرفة : "..matches[2].."\n❣ تصميم "..tostring(#fonts).." خط :\n______________________________\n" a=0 for v=1,#result do a=a+1 result_text = result_text..a.."- "..result[a].."\n\n" end return result_text.."______________________________\n❣ #Dev @xXxDev_iqxXx" end return { description = "Fantasy Writer", usagehtm = '<tr><td align="center">decoration متن</td><td align="right">مع هذا البرنامج المساعد يمكن النصوص الخاصة بك مع مجموعة متنوعة من الخطوط والتصميم الجميل. أحرف الحد الأقصى المسموح به هو 20 ويمكن فقط استخدام الأحرف الإنجليزية والأرقام</td></tr>', usage = {"decoration [text] : زخرفه النص",}, patterns = { "^(زخرفه) (.*)", "^(زخرفه)$", }, run = run }
gpl-2.0
gedadsbranch/Darkstar-Mission
scripts/globals/mobskills/Pinning_Shot.lua
6
1055
--------------------------------------------- -- Pinning Shot -- -- Description: Delivers a threefold ranged attack to targets in an area of effect. Additional effect: Bind -- Type: Physical -- Utsusemi/Blink absorb: 2-3 shadows -- Range: Unknown -- Notes: Used only by Medusa. --------------------------------------------- require("/scripts/globals/settings"); require("/scripts/globals/status"); require("/scripts/globals/monstertpmoves"); --------------------------------------------- function onMobSkillCheck(target,mob,skill) return 0; end; function onMobWeaponSkill(target, mob, skill) local numhits = math.random(2, 3); local accmod = 1; local dmgmod = 1; local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_RANGED,MOBPARAM_PIERCE,info.hitslanded); local typeEffect = EFFECT_BIND; MobPhysicalStatusEffectMove(mob, target, skill, typeEffect, 1, 0, 60); target:delHP(dmg); return dmg; end;
gpl-3.0