repo_name
stringlengths
6
78
path
stringlengths
4
206
copies
stringclasses
281 values
size
stringlengths
4
7
content
stringlengths
625
1.05M
license
stringclasses
15 values
perky/factorio-circuitgui
helpers/helpers.lua
1
3262
function ModuloTimer( ticks ) return (game.tick % ticks) == 0 end function PrintToAllPlayers( text ) for playerIndex = 1, #game.players do if game.players[playerIndex] ~= nil then game.players[playerIndex].print(text) end end end function FormatTicksToTime( ticks ) local seconds = ticks / 60 local minutes = seconds / 60 local hours = minutes / 60 return string.format("%02d:%02d:%02d", math.floor(hours + 0.5), math.floor(minutes + 0.5) % 60, math.floor(seconds + 0.5) % 60) end function SetGoalForAllPlayers( goalText ) for playerIndex = 1, #game.players do if game.players[playerIndex] ~= nil then game.players[playerIndex].set_goal_description(goalText) end end end function FindTilesInArea( surface, area, tileNameFilter ) local foundTiles = {} local aa = area[1] local bb = area[2] local width = bb.x - aa.x local height = bb.y - aa.y for _y = 0, height do for _x = 0, width do local x = aa.x + _x local y = aa.y + _y local tile = surface.get_tile(x, y) if tile.name == tileNameFilter then table.insert(foundTiles, tile) end end end return foundTiles end function FindTilePropertiesInArea( surface, area, tileNameFilter ) local foundTiles = {} local aa = area[1] local bb = area[2] local width = bb.x - aa.x local height = bb.y - aa.y for _y = 0, height do for _x = 0, width do local pos = { x = aa.x + _x, y = aa.y + _y } local tile = surface.get_tile(pos.x, pos.y) local tileProps = surface.get_tile_properties(pos.x, pos.y) if tile.name == tileNameFilter then table.insert(foundTiles, { name = tile.name, position = pos, }) end end end return foundTiles end function PrettyNumber( number ) if number < 1000 then return string.format("%i", number) elseif number < 1000000 then return string.format("%.1fk", (number/1000)) else return string.format("%.1fm", (number/1000000)) end end --[[ Iterator for looping over an area. returns the x, y co-ordiantes for each position in an area. example: area = {{0, 0}, {10, 20}} for x, y in iarea(area) do end ]] function iarea( area ) local aa = area[1] local bb = area[2] local _x = aa.x local _y = aa.y return function() local x = _x local y = _y _x = _x + 1 if _x > bb.x then _x = aa.x _y = _y + 1 if _y > bb.y then return nil end end return x, y end end function SquareArea( origin, radius ) return { {x=origin.x - radius, y=origin.y - radius}, {x=origin.x + radius, y=origin.y + radius} } end function RemapNumber(number, from1, to1, from2, to2) return (number - from1) / (to1 - from1) * (to2 - from2) + from2 end function ShuffleTable( tbl ) local rand = math.random local count = #tbl local dieRoll for i = count, 2, -1 do dieRoll = rand(i) tbl[i], tbl[dieRoll] = tbl[dieRoll], tbl[i] end end function DistanceSqr( p1, p2 ) local dx = p2.x - p1.x local dy = p2.y - p1.y return dx*dx + dy*dy end function GetNearest( objects, point ) if #objects == 0 then return nil end local maxDist = math.huge local nearest = objects[1] for _, tile in ipairs(objects) do local dist = DistanceSqr(point, tile.position) if dist < maxDist then maxDist = dist nearest = tile end end return nearest end
mit
atosatto/kubernetes-contrib
ingress/controllers/nginx/lua/vendor/lua-resty-http/lib/resty/http_headers.lua
69
1716
local rawget, rawset, setmetatable = rawget, rawset, setmetatable local str_gsub = string.gsub local str_lower = string.lower local _M = { _VERSION = '0.01', } -- Returns an empty headers table with internalised case normalisation. -- Supports the same cases as in ngx_lua: -- -- headers.content_length -- headers["content-length"] -- headers["Content-Length"] function _M.new(self) local mt = { normalised = {}, } mt.__index = function(t, k) local k_hyphened = str_gsub(k, "_", "-") local matched = rawget(t, k) if matched then return matched else local k_normalised = str_lower(k_hyphened) return rawget(t, mt.normalised[k_normalised]) end end -- First check the normalised table. If there's no match (first time) add an entry for -- our current case in the normalised table. This is to preserve the human (prettier) case -- instead of outputting lowercased header names. -- -- If there's a match, we're being updated, just with a different case for the key. We use -- the normalised table to give us the original key, and perorm a rawset(). mt.__newindex = function(t, k, v) -- we support underscore syntax, so always hyphenate. local k_hyphened = str_gsub(k, "_", "-") -- lowercase hyphenated is "normalised" local k_normalised = str_lower(k_hyphened) if not mt.normalised[k_normalised] then mt.normalised[k_normalised] = k_hyphened rawset(t, k_hyphened, v) else rawset(t, mt.normalised[k_normalised], v) end end return setmetatable({}, mt) end return _M
apache-2.0
federicodotta/proxmark3
client/scripts/dumptoemul.lua
8
2920
-- The getopt-functionality is loaded from pm3/getopt.lua -- Have a look there for further details getopt = require('getopt') bin = require('bin') example = "script run dumptoemul -i dumpdata-foobar.bin" author = "Martin Holst Swende" usage = "script run dumptoemul [-i <file>] [-o <file>]" desc =[[ This script takes a dumpfile from 'hf mf dump' and converts it to a format that can be used by the emulator Arguments: -h This help -i <file> Specifies the dump-file (input). If omitted, 'dumpdata.bin' is used -o <filename> Specifies the output file. If omitted, <uid>.eml is used. ]] ------------------------------- -- Some utilities ------------------------------- --- -- A debug printout-function function dbg(args) if DEBUG then print("###", args) end end --- -- This is only meant to be used when errors occur function oops(err) print("ERROR: ",err) end --- -- Usage help function help() print(desc) print("Example usage") print(example) end local function convert_to_ascii(hexdata) if string.len(hexdata) % 32 ~= 0 then return oops(("Bad data, length should be a multiple of 32 (was %d)"):format(string.len(hexdata))) end local js,i = "["; for i = 1, string.len(hexdata),32 do js = js .."'" ..string.sub(hexdata,i,i+31).."',\n" end js = js .. "]" return js end local function readdump(infile) t = infile:read("*all") --print(string.len(t)) len = string.len(t) local len,hex = bin.unpack(("H%d"):format(len),t) --print(len,hex) return hex end local function convert_to_emulform(hexdata) if string.len(hexdata) % 32 ~= 0 then return oops(("Bad data, length should be a multiple of 32 (was %d)"):format(string.len(hexdata))) end local ascii,i = ""; for i = 1, string.len(hexdata),32 do ascii = ascii ..string.sub(hexdata,i,i+31).."\n" end return ascii end local function main(args) local input = "dumpdata.bin" local output for o, a in getopt.getopt(args, 'i:o:h') do if o == "h" then return help() end if o == "i" then input = a end if o == "o" then output = a end end -- Validate the parameters local infile = io.open(input, "rb") if infile == nil then return oops("Could not read file ", input) end local dumpdata = readdump(infile) -- The hex-data is now in ascii-format, -- But first, check the uid local uid = string.sub(dumpdata,1,8) output = output or (uid .. ".eml") -- Format some linebreaks dumpdata = convert_to_emulform(dumpdata) local outfile = io.open(output, "w") if outfile == nil then return oops("Could not write to file ", output) end outfile:write(dumpdata:lower()) io.close(outfile) print(("Wrote an emulator-dump to the file %s"):format(output)) end --[[ In the future, we may implement so that scripts are invoked directly into a 'main' function, instead of being executed blindly. For future compatibility, I have done so, but I invoke my main from here. --]] main(args)
gpl-2.0
harisankarma/Ardupilot
Tools/CHDK-Scripts/kap_uav.lua
183
28512
--[[ KAP UAV Exposure Control Script v3.1 -- Released under GPL by waterwingz and wayback/peabody http://chdk.wikia.com/wiki/KAP_%26_UAV_Exposure_Control_Script @title KAP UAV 3.1 @param i Shot Interval (sec) @default i 15 @range i 2 120 @param s Total Shots (0=infinite) @default s 0 @range s 0 10000 @param j Power off when done? @default j 0 @range j 0 1 @param e Exposure Comp (stops) @default e 6 @values e -2.0 -1.66 -1.33 -1.0 -0.66 -0.33 0.0 0.33 0.66 1.00 1.33 1.66 2.00 @param d Start Delay Time (sec) @default d 0 @range d 0 10000 @param y Tv Min (sec) @default y 0 @values y None 1/60 1/100 1/200 1/400 1/640 @param t Target Tv (sec) @default t 5 @values t 1/100 1/200 1/400 1/640 1/800 1/1000 1/1250 1/1600 1/2000 @param x Tv Max (sec) @default x 3 @values x 1/1000 1/1250 1/1600 1/2000 1/5000 1/10000 @param f Av Low(f-stop) @default f 4 @values f 1.8 2.0 2.2 2.6 2.8 3.2 3.5 4.0 4.5 5.0 5.6 6.3 7.1 8.0 @param a Av Target (f-stop) @default a 7 @values a 1.8 2.0 2.2 2.6 2.8 3.2 3.5 4.0 4.5 5.0 5.6 6.3 7.1 8.0 @param m Av Max (f-stop) @default m 13 @values m 1.8 2.0 2.2 2.6 2.8 3.2 3.5 4.0 4.5 5.0 5.6 6.3 7.1 8.0 @param p ISO Min @default p 1 @values p 80 100 200 400 800 1250 1600 @param q ISO Max1 @default q 2 @values q 100 200 400 800 1250 1600 @param r ISO Max2 @default r 3 @values r 100 200 400 800 1250 1600 @param n Allow use of ND filter? @default n 1 @values n No Yes @param z Zoom position @default z 0 @values z Off 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% @param c Focus @ Infinity Mode @default c 0 @values c None @Shot AFL MF @param v Video Interleave (shots) @default v 0 @values v Off 1 5 10 25 50 100 @param w Video Duration (sec) @default w 10 @range w 5 300 @param u USB Shot Control? @default u 0 @values u None On/Off OneShot PWM @param b Backlight Off? @default b 0 @range b 0 1 @param l Logging @default l 3 @values l Off Screen SDCard Both --]] props=require("propcase") capmode=require("capmode") -- convert user parameter to usable variable names and values tv_table = { -320, 576, 640, 736, 832, 896, 928, 960, 992, 1024, 1056, 1180, 1276} tv96target = tv_table[t+3] tv96max = tv_table[x+8] tv96min = tv_table[y+1] sv_table = { 381, 411, 507, 603, 699, 761, 795 } sv96min = sv_table[p+1] sv96max1 = sv_table[q+2] sv96max2 = sv_table[r+2] av_table = { 171, 192, 218, 265, 285, 322, 347, 384, 417, 446, 477, 510, 543, 576 } av96target = av_table[a+1] av96minimum = av_table[f+1] av96max = av_table[m+1] ec96adjust = (e - 6)*32 video_table = { 0, 1, 5, 10, 25, 50, 100 } video_mode = video_table[v+1] video_duration = w interval = i*1000 max_shots = s poff_if_done = j start_delay = d backlight = b log_mode= l focus_mode = c usb_mode = u if ( z==0 ) then zoom_setpoint = nil else zoom_setpoint = (z-1)*10 end -- initial configuration values nd96offset=3*96 -- ND filter's number of equivalent f-stops (f * 96) infx = 50000 -- focus lock distance in mm (approximately 55 yards) shot_count = 0 -- shot counter blite_timer = 300 -- backlight off delay in 100mSec increments old_console_timeout = get_config_value( 297 ) shot_request = false -- pwm mode flag to request a shot be taken -- check camera Av configuration ( variable aperture and/or ND filter ) if n==0 then -- use of nd filter allowed? if get_nd_present()==1 then -- check for ND filter only Av_mode = 0 -- 0 = ND disabled and no iris available else Av_mode = 1 -- 1 = ND disabled and iris available end else Av_mode = get_nd_present()+1 -- 1 = iris only , 2=ND filter only, 3= both ND & iris end function printf(...) if ( log_mode == 0) then return end local str=string.format(...) if (( log_mode == 1) or (log_mode == 3)) then print(str) end if ( log_mode > 1 ) then local logname="A/KAP.log" log=io.open(logname,"a") log:write(os.date("%Y%b%d %X ")..string.format(...),"\n") log:close() end end tv_ref = { -- note : tv_ref values set 1/2 way between shutter speed values -608, -560, -528, -496, -464, -432, -400, -368, -336, -304, -272, -240, -208, -176, -144, -112, -80, -48, -16, 16, 48, 80, 112, 144, 176, 208, 240, 272, 304, 336, 368, 400, 432, 464, 496, 528, 560, 592, 624, 656, 688, 720, 752, 784, 816, 848, 880, 912, 944, 976, 1008, 1040, 1072, 1096, 1129, 1169, 1192, 1225, 1265, 1376 } tv_str = { ">64", "64", "50", "40", "32", "25", "20", "16", "12", "10", "8.0", "6.0", "5.0", "4.0", "3.2", "2.5", "2.0", "1.6", "1.3", "1.0", "0.8", "0.6", "0.5", "0.4", "0.3", "1/4", "1/5", "1/6", "1/8", "1/10", "1/13", "1/15", "1/20", "1/25", "1/30", "1/40", "1/50", "1/60", "1/80", "1/100", "1/125", "1/160", "1/200", "1/250", "1/320", "1/400", "1/500", "1/640", "1/800", "1/1000","1/1250", "1/1600","1/2000","1/2500","1/3200","1/4000","1/5000","1/6400","1/8000","1/10000","hi" } function print_tv(val) if ( val == nil ) then return("-") end local i = 1 while (i <= #tv_ref) and (val > tv_ref[i]) do i=i+1 end return tv_str[i] end av_ref = { 160, 176, 208, 243, 275, 304, 336, 368, 400, 432, 464, 480, 496, 512, 544, 592, 624, 656, 688, 720, 752, 784 } av_str = {"n/a","1.8", "2.0","2.2","2.6","2.8","3.2","3.5","4.0","4.5","5.0","5.6","5.9","6.3","7.1","8.0","9.0","10.0","11.0","13.0","14.0","16.0","hi"} function print_av(val) if ( val == nil ) then return("-") end local i = 1 while (i <= #av_ref) and (val > av_ref[i]) do i=i+1 end return av_str[i] end sv_ref = { 370, 397, 424, 456, 492, 523, 555, 588, 619, 651, 684, 731, 779, 843, 907 } sv_str = {"n/a","80","100","120","160","200","250","320","400","500","640","800","1250","1600","3200","hi"} function print_sv(val) if ( val == nil ) then return("-") end local i = 1 while (i <= #sv_ref) and (val > sv_ref[i]) do i=i+1 end return sv_str[i] end function pline(message, line) -- print line function fg = 258 bg=259 end -- switch between shooting and playback modes function switch_mode( m ) if ( m == 1 ) then if ( get_mode() == false ) then set_record(1) -- switch to shooting mode while ( get_mode() == false ) do sleep(100) end sleep(1000) end else if ( get_mode() == true ) then set_record(0) -- switch to playback mode while ( get_mode() == true ) do sleep(100) end sleep(1000) end end end -- focus lock and unlock function lock_focus() if (focus_mode > 1) then -- focus mode requested ? if ( focus_mode == 2 ) then -- method 1 : set_aflock() command enables MF if (chdk_version==120) then set_aflock(1) set_prop(props.AF_LOCK,1) else set_aflock(1) end if (get_prop(props.AF_LOCK) == 1) then printf(" AFL enabled") else printf(" AFL failed ***") end else -- mf mode requested if (chdk_version==120) then -- CHDK 1.2.0 : call event proc or levents to try and enable MF mode if call_event_proc("SS.Create") ~= -1 then if call_event_proc("SS.MFOn") == -1 then call_event_proc("PT_MFOn") end elseif call_event_proc("RegisterShootSeqEvent") ~= -1 then if call_event_proc("PT_MFOn") == -1 then call_event_proc("MFOn") end end if (get_prop(props.FOCUS_MODE) == 0 ) then -- MF not set - try levent PressSw1AndMF post_levent_for_npt("PressSw1AndMF") sleep(500) end elseif (chdk_version >= 130) then -- CHDK 1.3.0 : set_mf() if ( set_mf(1) == 0 ) then set_aflock(1) end -- as a fall back, try setting AFL is set_mf fails end if (get_prop(props.FOCUS_MODE) == 1) then printf(" MF enabled") else printf(" MF enable failed ***") end end sleep(1000) set_focus(infx) sleep(1000) end end function unlock_focus() if (focus_mode > 1) then -- focus mode requested ? if (focus_mode == 2 ) then -- method 1 : AFL if (chdk_version==120) then set_aflock(0) set_prop(props.AF_LOCK,0) else set_aflock(0) end if (get_prop(props.AF_LOCK) == 0) then printf(" AFL unlocked") else printf(" AFL unlock failed") end else -- mf mode requested if (chdk_version==120) then -- CHDK 1.2.0 : call event proc or levents to try and enable MF mode if call_event_proc("SS.Create") ~= -1 then if call_event_proc("SS.MFOff") == -1 then call_event_proc("PT_MFOff") end elseif call_event_proc("RegisterShootSeqEvent") ~= -1 then if call_event_proc("PT_MFOff") == -1 then call_event_proc("MFOff") end end if (get_prop(props.FOCUS_MODE) == 1 ) then -- MF not reset - try levent PressSw1AndMF post_levent_for_npt("PressSw1AndMF") sleep(500) end elseif (chdk_version >= 130) then -- CHDK 1.3.0 : set_mf() if ( set_mf(0) == 0 ) then set_aflock(0) end -- fall back so reset AFL is set_mf fails end if (get_prop(props.FOCUS_MODE) == 0) then printf(" MF disabled") else printf(" MF disable failed") end end sleep(100) end end -- zoom position function update_zoom(zpos) local count = 0 if(zpos ~= nil) then zstep=((get_zoom_steps()-1)*zpos)/100 printf("setting zoom to "..zpos.." percent step="..zstep) sleep(200) set_zoom(zstep) sleep(2000) press("shoot_half") repeat sleep(100) count = count + 1 until (get_shooting() == true ) or (count > 40 ) release("shoot_half") end end -- restore camera settings on shutdown function restore() set_config_value(121,0) -- USB remote disable set_config_value(297,old_console_timeout) -- restore console timeout value if (backlight==1) then set_lcd_display(1) end -- display on unlock_focus() if( zoom_setpoint ~= nil ) then update_zoom(0) end if( shot_count >= max_shots) and ( max_shots > 1) then if ( poff_if_done == 1 ) then -- did script ending because # of shots done ? printf("power off - shot count at limit") -- complete power down sleep(2000) post_levent_to_ui('PressPowerButton') else set_record(0) end -- just retract lens end end -- Video mode function check_video(shot) local capture_mode if ((video_mode>0) and(shot>0) and (shot%video_mode == 0)) then unlock_focus() printf("Video mode started. Button:"..tostring(video_button)) if( video_button ) then click "video" else capture_mode=capmode.get() capmode.set('VIDEO_STD') press("shoot_full") sleep(300) release("shoot_full") end local end_second = get_day_seconds() + video_duration repeat wait_click(500) until (is_key("menu")) or (get_day_seconds() > end_second) if( video_button ) then click "video" else press("shoot_full") sleep(300) release("shoot_full") capmode.set(capture_mode) end printf("Video mode finished.") sleep(1000) lock_focus() return(true) else return(false) end end -- PWM USB pulse functions function ch1up() printf(" * usb pulse = ch1up") shot_request = true end function ch1mid() printf(" * usb pulse = ch1mid") if ( get_mode() == false ) then switch_mode(1) lock_focus() end end function ch1down() printf(" * usb pulse = ch1down") switch_mode(0) end function ch2up() printf(" * usb pulse = ch2up") update_zoom(100) end function ch2mid() printf(" * usb pulse = ch2mid") if ( zoom_setpoint ~= nil ) then update_zoom(zoom_setpoint) else update_zoom(50) end end function ch2down() printf(" * usb pulse = ch2down") update_zoom(0) end function pwm_mode(pulse_width) if pulse_width > 0 then if pulse_width < 5 then ch1up() elseif pulse_width < 8 then ch1mid() elseif pulse_width < 11 then ch1down() elseif pulse_width < 14 then ch2up() elseif pulse_width < 17 then ch2mid() elseif pulse_width < 20 then ch2down() else printf(" * usb pulse width error") end end end -- Basic exposure calculation using shutter speed and ISO only -- called for Tv-only and ND-only cameras (cameras without an iris) function basic_tv_calc() tv96setpoint = tv96target av96setpoint = nil local min_av = get_prop(props.MIN_AV) -- calculate required ISO setting sv96setpoint = tv96setpoint + min_av - bv96meter -- low ambient light ? if (sv96setpoint > sv96max2 ) then -- check if required ISO setting is too high sv96setpoint = sv96max2 -- clamp at max2 ISO if so tv96setpoint = math.max(bv96meter+sv96setpoint-min_av,tv96min) -- recalculate required shutter speed down to Tv min -- high ambient light ? elseif (sv96setpoint < sv96min ) then -- check if required ISO setting is too low sv96setpoint = sv96min -- clamp at minimum ISO setting if so tv96setpoint = bv96meter + sv96setpoint - min_av -- recalculate required shutter speed and hope for the best end end -- Basic exposure calculation using shutter speed, iris and ISO -- called for iris-only and "both" cameras (cameras with an iris & ND filter) function basic_iris_calc() tv96setpoint = tv96target av96setpoint = av96target -- calculate required ISO setting sv96setpoint = tv96setpoint + av96setpoint - bv96meter -- low ambient light ? if (sv96setpoint > sv96max1 ) then -- check if required ISO setting is too high sv96setpoint = sv96max1 -- clamp at first ISO limit av96setpoint = bv96meter + sv96setpoint - tv96setpoint -- calculate new aperture setting if ( av96setpoint < av96min ) then -- check if new setting is goes below lowest f-stop av96setpoint = av96min -- clamp at lowest f-stop sv96setpoint = tv96setpoint + av96setpoint - bv96meter -- recalculate ISO setting if (sv96setpoint > sv96max2 ) then -- check if the result is above max2 ISO sv96setpoint = sv96max2 -- clamp at highest ISO setting if so tv96setpoint = math.max(bv96meter+sv96setpoint-av96setpoint,tv96min) -- recalculate required shutter speed down to tv minimum end end -- high ambient light ? elseif (sv96setpoint < sv96min ) then -- check if required ISO setting is too low sv96setpoint = sv96min -- clamp at minimum ISO setting if so tv96setpoint = bv96meter + sv96setpoint - av96setpoint -- recalculate required shutter speed if (tv96setpoint > tv96max ) then -- check if shutter speed now too fast tv96setpoint = tv96max -- clamp at maximum shutter speed if so av96setpoint = bv96meter + sv96setpoint - tv96setpoint -- calculate new aperture setting if ( av96setpoint > av96max ) then -- check if new setting is goes above highest f-stop av96setpoint = av96max -- clamp at highest f-stop tv96setpoint = bv96meter + sv96setpoint - av96setpoint -- recalculate shutter speed needed and hope for the best end end end end -- calculate exposure for cams without adjustable iris or ND filter function exposure_Tv_only() insert_ND_filter = nil basic_tv_calc() end -- calculate exposure for cams with ND filter only function exposure_NDfilter() insert_ND_filter = false basic_tv_calc() if (tv96setpoint > tv96max ) then -- check if shutter speed now too fast insert_ND_filter = true -- flag the ND filter to be inserted bv96meter = bv96meter - nd96offset -- adjust meter for ND offset basic_tv_calc() -- start over, but with new meter value bv96meter = bv96meter + nd96offset -- restore meter for later logging end end -- calculate exposure for cams with adjustable iris only function exposure_iris() insert_ND_filter = nil basic_iris_calc() end -- calculate exposure for cams with both adjustable iris and ND filter function exposure_both() insert_ND_filter = false -- NOTE : assume ND filter never used automatically by Canon firmware basic_iris_calc() if (tv96setpoint > tv96max ) then -- check if shutter speed now too fast insert_ND_filter = true -- flag the ND filter to be inserted bv96meter = bv96meter - nd96offset -- adjust meter for ND offset basic_iris_calc() -- start over, but with new meter value bv96meter = bv96meter + nd96offset -- restore meter for later logging end end -- ========================== Main Program ================================= set_console_layout(1 ,1, 45, 14 ) printf("KAP 3.1 started - press MENU to exit") bi=get_buildinfo() printf("%s %s-%s %s %s %s", bi.version, bi.build_number, bi.build_revision, bi.platform, bi.platsub, bi.build_date) chdk_version= tonumber(string.sub(bi.build_number,1,1))*100 + tonumber(string.sub(bi.build_number,3,3))*10 + tonumber(string.sub(bi.build_number,5,5)) if ( tonumber(bi.build_revision) > 0 ) then build = tonumber(bi.build_revision) else build = tonumber(string.match(bi.build_number,'-(%d+)$')) end if ((chdk_version<120) or ((chdk_version==120)and(build<3276)) or ((chdk_version==130)and(build<3383))) then printf("CHDK 1.2.0 build 3276 or higher required") else if( props.CONTINUOUS_AF == nil ) then caf=-999 else caf = get_prop(props.CONTINUOUS_AF) end if( props.SERVO_AF == nil ) then saf=-999 else saf = get_prop(props.SERVO_AF) end cmode = capmode.get_name() printf("Mode:%s,Continuous_AF:%d,Servo_AF:%d", cmode,caf,saf) printf(" Tv:"..print_tv(tv96target).." max:"..print_tv(tv96max).." min:"..print_tv(tv96min).." ecomp:"..(ec96adjust/96).."."..(math.abs(ec96adjust*10/96)%10) ) printf(" Av:"..print_av(av96target).." minAv:"..print_av(av96minimum).." maxAv:"..print_av(av96max) ) printf(" ISOmin:"..print_sv(sv96min).." ISO1:"..print_sv(sv96max1).." ISO2:"..print_sv(sv96max2) ) printf(" MF mode:"..focus_mode.." Video:"..video_mode.." USB:"..usb_mode) printf(" AvM:"..Av_mode.." int:"..(interval/1000).." Shts:"..max_shots.." Dly:"..start_delay.." B/L:"..backlight) sleep(500) if (start_delay > 0 ) then printf("entering start delay of ".. start_delay.." seconds") sleep( start_delay*1000 ) end -- enable USB remote in USB remote moded if (usb_mode > 0 ) then set_config_value(121,1) -- make sure USB remote is enabled if (get_usb_power(1) == 0) then -- can we start ? printf("waiting on USB signal") repeat wait_click(20) until ((get_usb_power(1) == 1) or ( is_key("menu"))) else sleep(1000) end printf("USB signal received") end -- switch to shooting mode switch_mode(1) -- set zoom position update_zoom(zoom_setpoint) -- lock focus at infinity lock_focus() -- disable flash and AF assist lamp set_prop(props.FLASH_MODE, 2) -- flash off set_prop(props.AF_ASSIST_BEAM,0) -- AF assist off if supported for this camera set_config_value( 297, 60) -- set console timeout to 60 seconds if (usb_mode > 2 ) then repeat until (get_usb_power(2) == 0 ) end -- flush pulse buffer next_shot_time = get_tick_count() script_exit = false if( get_video_button() == 1) then video_button = true else video_button = false end set_console_layout(2 ,0, 45, 4 ) repeat if( ( (usb_mode < 2 ) and ( next_shot_time <= get_tick_count() ) ) or ( (usb_mode == 2 ) and (get_usb_power(2) > 0 ) ) or ( (usb_mode == 3 ) and (shot_request == true ) ) ) then -- time to insert a video sequence ? if( check_video(shot_count) == true) then next_shot_time = get_tick_count() end -- intervalometer timing next_shot_time = next_shot_time + interval -- set focus at infinity ? (maybe redundant for AFL & MF mode but makes sure its set right) if (focus_mode > 0) then set_focus(infx) sleep(100) end -- check exposure local count = 0 local timeout = false press("shoot_half") repeat sleep(50) count = count + 1 if (count > 40 ) then timeout = true end until (get_shooting() == true ) or (timeout == true) -- shoot in auto mode if meter reading invalid, else calculate new desired exposure if ( timeout == true ) then release("shoot_half") repeat sleep(50) until get_shooting() == false shoot() -- shoot in Canon auto mode if we don't have a valid meter reading shot_count = shot_count + 1 printf(string.format('IMG_%04d.JPG',get_exp_count()).." : shot in auto mode, meter reading invalid") else -- get meter reading values (and add in exposure compensation) bv96raw=get_bv96() bv96meter=bv96raw-ec96adjust tv96meter=get_tv96() av96meter=get_av96() sv96meter=get_sv96() -- set minimum Av to larger of user input or current min for zoom setting av96min= math.max(av96minimum,get_prop(props.MIN_AV)) if (av96target < av96min) then av96target = av96min end -- calculate required setting for current ambient light conditions if (Av_mode == 1) then exposure_iris() elseif (Av_mode == 2) then exposure_NDfilter() elseif (Av_mode == 3) then exposure_both() else exposure_Tv_only() end -- set up all exposure overrides set_tv96_direct(tv96setpoint) set_sv96(sv96setpoint) if( av96setpoint ~= nil) then set_av96_direct(av96setpoint) end if(Av_mode > 1) and (insert_ND_filter == true) then -- ND filter available and needed? set_nd_filter(1) -- activate the ND filter nd_string="NDin" else set_nd_filter(2) -- make sure the ND filter does not activate nd_string="NDout" end -- and finally shoot the image press("shoot_full_only") sleep(100) release("shoot_full") repeat sleep(50) until get_shooting() == false shot_count = shot_count + 1 -- update shooting statistic and log as required shot_focus=get_focus() if(shot_focus ~= -1) and (shot_focus < 20000) then focus_string=" foc:"..(shot_focus/1000).."."..(((shot_focus%1000)+50)/100).."m" if(focus_mode>0) then error_string=" **WARNING : focus not at infinity**" end else focus_string=" foc:infinity" error_string=nil end printf(string.format('%d) IMG_%04d.JPG',shot_count,get_exp_count())) printf(" meter : Tv:".. print_tv(tv96meter) .." Av:".. print_av(av96meter) .." Sv:"..print_sv(sv96meter).." "..bv96raw ..":"..bv96meter) printf(" actual: Tv:".. print_tv(tv96setpoint).." Av:".. print_av(av96setpoint).." Sv:"..print_sv(sv96setpoint)) printf(" AvMin:".. print_av(av96min).." NDF:"..nd_string..focus_string ) if ((max_shots>0) and (shot_count >= max_shots)) then script_exit = true end shot_request = false -- reset shot request flag end collectgarbage() end -- check if USB remote enabled in intervalometer mode and USB power is off -> pause if so if ((usb_mode == 1 ) and (get_usb_power(1) == 0)) then printf("waiting on USB signal") unlock_focus() switch_mode(0) repeat wait_click(20) until ((get_usb_power(1) == 1) or ( is_key("menu"))) switch_mode(1) lock_focus() if ( is_key("menu")) then script_exit = true end printf("USB wait finished") sleep(100) end if (usb_mode == 3 ) then pwm_mode(get_usb_power(2)) end if (blite_timer > 0) then blite_timer = blite_timer-1 if ((blite_timer==0) and (backlight==1)) then set_lcd_display(0) end end if( error_string ~= nil) then draw_string( 16, 144, string.sub(error_string.." ",0,42), 258, 259) end wait_click(100) if( not( is_key("no_key"))) then if ((blite_timer==0) and (backlight==1)) then set_lcd_display(1) end blite_timer=300 if ( is_key("menu") ) then script_exit = true end end until (script_exit==true) printf("script halt requested") restore() end --[[ end of file ]]--
gpl-3.0
ffxiphoenix/darkstar
scripts/globals/items/uberkuchen.lua
35
1465
----------------------------------------- -- ID: 5615 -- Item: uberkuchen -- Food Effect: 4Hrs, All Races ----------------------------------------- -- HP 10 -- MP % 3 (cap 13) -- Intelligence 3 -- 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,14400,5615); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 10); target:addMod(MOD_FOOD_MPP, 3); target:addMod(MOD_FOOD_MP_CAP, 13); target:addMod(MOD_MPHEAL, 1); target:addMod(MOD_INT, 3); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 10); target:delMod(MOD_FOOD_MPP, 3); target:delMod(MOD_FOOD_MP_CAP, 13); target:delMod(MOD_MPHEAL, 1); target:delMod(MOD_INT, 3); end;
gpl-3.0
elixboyBW/elixboySPM
plugins/vote.lua
615
2128
do local _file_votes = './data/votes.lua' function read_file_votes () local f = io.open(_file_votes, "r+") if f == nil then print ('Created voting file '.._file_votes) serialize_to_file({}, _file_votes) else print ('Values loaded: '.._file_votes) f:close() end return loadfile (_file_votes)() end function clear_votes (chat) local _votes = read_file_votes () _votes [chat] = {} serialize_to_file(_votes, _file_votes) end function votes_result (chat) local _votes = read_file_votes () local results = {} local result_string = "" if _votes [chat] == nil then _votes[chat] = {} end for user,vote in pairs (_votes[chat]) do if (results [vote] == nil) then results [vote] = user else results [vote] = results [vote] .. ", " .. user end end for vote,users in pairs (results) do result_string = result_string .. vote .. " : " .. users .. "\n" end return result_string end function save_vote(chat, user, vote) local _votes = read_file_votes () if _votes[chat] == nil then _votes[chat] = {} end _votes[chat][user] = vote serialize_to_file(_votes, _file_votes) end function run(msg, matches) if (matches[1] == "ing") then if (matches [2] == "reset") then clear_votes (tostring(msg.to.id)) return "Voting statistics reset.." elseif (matches [2] == "stats") then local votes_result = votes_result (tostring(msg.to.id)) if (votes_result == "") then votes_result = "[No votes registered]\n" end return "Voting statistics :\n" .. votes_result end else save_vote(tostring(msg.to.id), msg.from.print_name, tostring(tonumber(matches[2]))) return "Vote registered : " .. msg.from.print_name .. " " .. tostring(tonumber(matches [2])) end end return { description = "Plugin for voting in groups.", usage = { "!voting reset: Reset all the votes.", "!vote [number]: Cast the vote.", "!voting stats: Shows the statistics of voting." }, patterns = { "^!vot(ing) (reset)", "^!vot(ing) (stats)", "^!vot(e) ([0-9]+)$" }, run = run } end
gpl-2.0
ffxiphoenix/darkstar
scripts/zones/Windurst_Woods/npcs/Forine.lua
42
1106
----------------------------------- -- Area: Windurst Woods -- NPC: Forine -- Involved In Mission: Journey Abroad -- @zone 241 -- @pos -52.677 -0.501 -26.299 ----------------------------------- package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/zones/Metalworks/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x01bd); 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
usstwxy/luarocks
src/luarocks/tools/tar.lua
11
4827
--- A pure-Lua implementation of untar (unpacking .tar archives) --module("luarocks.tools.tar", package.seeall) local tar = {} local fs = require("luarocks.fs") local dir = require("luarocks.dir") local util = require("luarocks.util") local blocksize = 512 local function get_typeflag(flag) if flag == "0" or flag == "\0" then return "file" elseif flag == "1" then return "link" elseif flag == "2" then return "symlink" -- "reserved" in POSIX, "symlink" in GNU elseif flag == "3" then return "character" elseif flag == "4" then return "block" elseif flag == "5" then return "directory" elseif flag == "6" then return "fifo" elseif flag == "7" then return "contiguous" -- "reserved" in POSIX, "contiguous" in GNU elseif flag == "x" then return "next file" elseif flag == "g" then return "global extended header" elseif flag == "L" then return "long name" elseif flag == "K" then return "long link name" end return "unknown" end local function octal_to_number(octal) local exp = 0 local number = 0 for i = #octal,1,-1 do local digit = tonumber(octal:sub(i,i)) if not digit then break end number = number + (digit * 8^exp) exp = exp + 1 end return number end local function checksum_header(block) local sum = 256 for i = 1,148 do sum = sum + block:byte(i) end for i = 157,500 do sum = sum + block:byte(i) end return sum end local function nullterm(s) return s:match("^[^%z]*") end local function read_header_block(block) local header = {} header.name = nullterm(block:sub(1,100)) header.mode = nullterm(block:sub(101,108)) header.uid = octal_to_number(nullterm(block:sub(109,116))) header.gid = octal_to_number(nullterm(block:sub(117,124))) header.size = octal_to_number(nullterm(block:sub(125,136))) header.mtime = octal_to_number(nullterm(block:sub(137,148))) header.chksum = octal_to_number(nullterm(block:sub(149,156))) header.typeflag = get_typeflag(block:sub(157,157)) header.linkname = nullterm(block:sub(158,257)) header.magic = block:sub(258,263) header.version = block:sub(264,265) header.uname = nullterm(block:sub(266,297)) header.gname = nullterm(block:sub(298,329)) header.devmajor = octal_to_number(nullterm(block:sub(330,337))) header.devminor = octal_to_number(nullterm(block:sub(338,345))) header.prefix = block:sub(346,500) if header.magic ~= "ustar " and header.magic ~= "ustar\0" then return false, "Invalid header magic "..header.magic end if header.version ~= "00" and header.version ~= " \0" then return false, "Unknown version "..header.version end if not checksum_header(block) == header.chksum then return false, "Failed header checksum" end return header end function tar.untar(filename, destdir) assert(type(filename) == "string") assert(type(destdir) == "string") local tar_handle = io.open(filename, "r") if not tar_handle then return nil, "Error opening file "..filename end local long_name, long_link_name while true do local block repeat block = tar_handle:read(blocksize) until (not block) or checksum_header(block) > 256 if not block then break end local header, err = read_header_block(block) if not header then util.printerr(err) end local file_data = tar_handle:read(math.ceil(header.size / blocksize) * blocksize):sub(1,header.size) if header.typeflag == "long name" then long_name = nullterm(file_data) elseif header.typeflag == "long link name" then long_link_name = nullterm(file_data) else if long_name then header.name = long_name long_name = nil end if long_link_name then header.name = long_link_name long_link_name = nil end end local pathname = dir.path(destdir, header.name) if header.typeflag == "directory" then local ok, err = fs.make_dir(pathname) if not ok then return nil, err end elseif header.typeflag == "file" then local dirname = dir.dir_name(pathname) if dirname ~= "" then local ok, err = fs.make_dir(dirname) if not ok then return nil, err end end local file_handle = io.open(pathname, "wb") file_handle:write(file_data) file_handle:close() fs.set_time(pathname, header.mtime) if fs.chmod then fs.chmod(pathname, header.mode) end end --[[ for k,v in pairs(header) do util.printout("[\""..tostring(k).."\"] = "..(type(v)=="number" and v or "\""..v:gsub("%z", "\\0").."\"")) end util.printout() --]] end return true end return tar
mit
ffxiphoenix/darkstar
scripts/globals/items/love_chocolate.lua
35
1149
----------------------------------------- -- ID: 5230 -- Item: love_chocolate -- Food Effect: 180Min, All Races ----------------------------------------- -- Magic Regen While Healing 4 ----------------------------------------- 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,5230); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MPHEAL, 4); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MPHEAL, 4); end;
gpl-3.0
Phrohdoh/OpenRA
mods/d2k/maps/ordos-03b/ordos03b-AI.lua
8
1862
--[[ Copyright 2007-2020 The OpenRA Developers (see AUTHORS) This file is part of OpenRA, which is free software. It is made available to you under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. For more information, see COPYING. ]] AttackGroupSize = { easy = 6, normal = 8, hard = 10 } AttackDelays = { easy = { DateTime.Seconds(4), DateTime.Seconds(9) }, normal = { DateTime.Seconds(2), DateTime.Seconds(7) }, hard = { DateTime.Seconds(1), DateTime.Seconds(5) } } HarkonnenInfantryTypes = { "light_inf", "light_inf", "light_inf", "trooper", "trooper" } HarkonnenVehicleTypes = { "trike", "trike", "quad" } InitAIUnits = function() IdlingUnits[harkonnen] = Reinforcements.Reinforce(harkonnen, HarkonnenInitialReinforcements, HarkonnenInitialPath) DefendAndRepairBase(harkonnen, HarkonnenBase, 0.75, AttackGroupSize[Difficulty]) end ActivateAI = function() LastHarvesterEaten[harkonnen] = true Trigger.AfterDelay(0, InitAIUnits) HConyard.Produce(OrdosUpgrades[1]) HConyard.Produce(OrdosUpgrades[2]) local delay = function() return Utils.RandomInteger(AttackDelays[Difficulty][1], AttackDelays[Difficulty][2] + 1) end local infantryToBuild = function() return { Utils.Random(HarkonnenInfantryTypes) } end local vehilcesToBuild = function() return { Utils.Random(HarkonnenVehicleTypes) } end local attackThresholdSize = AttackGroupSize[Difficulty] * 2.5 -- Finish the upgrades first before trying to build something Trigger.AfterDelay(DateTime.Seconds(14), function() ProduceUnits(harkonnen, HBarracks, delay, infantryToBuild, AttackGroupSize[Difficulty], attackThresholdSize) ProduceUnits(harkonnen, HLightFactory, delay, vehilcesToBuild, AttackGroupSize[Difficulty], attackThresholdSize) end) end
gpl-3.0
Quenty/NevermoreEngine
src/pillbacking/src/Client/PillBackingBuilder.lua
1
11169
--[=[ Builds a pill backing for Guis @class PillBackingBuilder ]=] local require = require(script.Parent.loader).load(script) local Table = require("Table") local PillBackingBuilder = {} PillBackingBuilder.__index = PillBackingBuilder PillBackingBuilder.ClassName = "PillBackingBuilder" PillBackingBuilder.CIRCLE_IMAGE_ID = "rbxassetid://633244888" -- White circle PillBackingBuilder.CIRCLE_SIZE = Vector2.new(256, 256) PillBackingBuilder.SHADOW_IMAGE_ID = "rbxassetid://707852973" PillBackingBuilder.SHADOW_SIZE = Vector2.new(128, 128) PillBackingBuilder.PILL_SHADOW_IMAGE_ID = "rbxassetid://1304004290" PillBackingBuilder.PILL_SHADOW_SIZE = Vector2.new(256, 128) PillBackingBuilder.SHADOW_OFFSET_Y = UDim.new(0.05, 0) PillBackingBuilder.SHADOW_TRANSPARENCY = 0.85 local SLICE_SCALE_DEFAULT = 1024 -- Arbitrary large number to scale against so we're always a pill function PillBackingBuilder.new(options) local self = setmetatable({}, PillBackingBuilder) self._options = options or {} return self end function PillBackingBuilder:CreateSingle(gui, options) options = self:_configureOptions(gui, options) local pillBacking = Instance.new("ImageLabel") pillBacking.AnchorPoint = Vector2.new(0.5, 0.5) pillBacking.BackgroundTransparency = 1 pillBacking.ImageColor3 = options.BackgroundColor3 pillBacking.BorderSizePixel = 0 pillBacking.Name = "PillBacking" pillBacking.Position = UDim2.new(0.5, 0, 0.5, 0) pillBacking.Size = UDim2.new(1, 0, 1, 0) pillBacking.ZIndex = options.ZIndex pillBacking.ScaleType = Enum.ScaleType.Slice pillBacking.SliceScale = SLICE_SCALE_DEFAULT pillBacking.SliceCenter = Rect.new( self.CIRCLE_SIZE.x/2, self.CIRCLE_SIZE.x/2, self.CIRCLE_SIZE.y/2, self.CIRCLE_SIZE.y/2) pillBacking.Image = self.CIRCLE_IMAGE_ID gui.BackgroundTransparency = 1 pillBacking.Parent = gui return pillBacking end function PillBackingBuilder:Create(gui, options) warn("Use CreateSingle" .. debug.traceback()) options = self:_configureOptions(gui, options) local diameter = gui.Size.Y local pillBacking = Instance.new("Frame") pillBacking.AnchorPoint = Vector2.new(0.5, 0.5) pillBacking.BackgroundColor3 = options.BackgroundColor3 pillBacking.BorderSizePixel = 0 pillBacking.Name = "PillBacking" pillBacking.Position = UDim2.new(0.5, 0, 0.5, 0) pillBacking.Size = UDim2.new(1 - diameter.Scale, -diameter.Offset, 1, 0) pillBacking.ZIndex = options.ZIndex -- Prevent negative sizes (for circles) local sizeConstraint = Instance.new("UISizeConstraint") sizeConstraint.MaxSize = Vector2.new(math.huge, math.huge) sizeConstraint.MinSize = Vector2.new(0, 0) sizeConstraint.Parent = pillBacking local left = self:_createLeft(options) local right = self:_createRight(options) right.Parent = pillBacking left.Parent = pillBacking gui.BackgroundTransparency = 1 pillBacking.Parent = gui return pillBacking end function PillBackingBuilder:CreateVertical(gui, options) warn("Use CreateSingle" .. debug.traceback()) options = self:_configureOptions(gui, options) local diameter = gui.Size.X local pillBacking = Instance.new("Frame") pillBacking.SizeConstraint = Enum.SizeConstraint.RelativeXX pillBacking.AnchorPoint = Vector2.new(0.5, 0.5) pillBacking.BackgroundColor3 = options.BackgroundColor3 pillBacking.BorderSizePixel = 0 pillBacking.Name = "PillBacking" pillBacking.Position = UDim2.new(0.5, 0, 0.5, 0) pillBacking.Size = UDim2.new(1, 0, 1 - diameter.Scale, -diameter.Offset) pillBacking.ZIndex = options.ZIndex -- Prevent negative sizes (for circles) local sizeConstraint = Instance.new("UISizeConstraint") sizeConstraint.MaxSize = Vector2.new(math.huge, math.huge) sizeConstraint.MinSize = Vector2.new(0, 0) sizeConstraint.Parent = pillBacking local top = self:_createTop(options) top.Parent = pillBacking local bottom = self:_createBottom(options) bottom.Parent = pillBacking gui.BackgroundTransparency = 1 pillBacking.Parent = gui return pillBacking end function PillBackingBuilder:CreateSingleShadow(gui, options) options = self:_configureOptions(gui, options) local diameter = gui.Size.Y local width = gui.Size.X local addedScale = 0 if width.Scale ~= 0 then addedScale = diameter.Scale/width.Scale/2 end local shadow = Instance.new("ImageLabel") shadow.SliceScale = SLICE_SCALE_DEFAULT shadow.AnchorPoint = Vector2.new(0.5, 0.5) shadow.BackgroundTransparency = 1 shadow.BorderSizePixel = 0 shadow.ImageTransparency = self.SHADOW_TRANSPARENCY shadow.Name = "PillShadow" shadow.Position = UDim2.new(0.5, 0, 0.5, self.SHADOW_OFFSET_Y) shadow.Size = UDim2.new(1 + addedScale, diameter.Offset/2, 2, 0) shadow.ZIndex = options.ShadowZIndex shadow.ScaleType = Enum.ScaleType.Slice shadow.SliceCenter = Rect.new(self.SHADOW_SIZE.x/2, self.SHADOW_SIZE.x/2, self.SHADOW_SIZE.y/2, self.SHADOW_SIZE.y/2) shadow.Image = self.SHADOW_IMAGE_ID shadow.Parent = gui return shadow end function PillBackingBuilder:CreateShadow(gui, options) -- warn("Use CreateSingleShadow" .. debug.traceback()) options = self:_configureOptions(gui, options) local diameter = gui.Size.Y local shadow = self:_createPillShadow(options) shadow.SizeConstraint = Enum.SizeConstraint.RelativeXY shadow.AnchorPoint = Vector2.new(0.5, 0.5) shadow.Name = "PillShadow" shadow.ImageRectSize = self.PILL_SHADOW_SIZE * Vector2.new(0.5, 1) shadow.ImageRectOffset = self.PILL_SHADOW_SIZE * Vector2.new(0.25, 0) shadow.Position = UDim2.new(UDim.new(0.5, 0), UDim.new(0.5, 0) + self.SHADOW_OFFSET_Y) shadow.Size = UDim2.new(1 - diameter.Scale, -diameter.Offset, 2, 0) shadow.ZIndex = options.ShadowZIndex -- Prevent negative sizes (for circles) local sizeConstraint = Instance.new("UISizeConstraint") sizeConstraint.MaxSize = Vector2.new(math.huge, math.huge) sizeConstraint.MinSize = Vector2.new(0, 0) sizeConstraint.Parent = shadow local left = self:_createLeftShadow(options) local right = self:_createRightShadow(options) right.Parent = shadow left.Parent = shadow shadow.Parent = gui return shadow end function PillBackingBuilder:CreateCircle(gui, options) options = self:_configureOptions(gui, options) local circle = self:_createCircle(options) circle.ImageTransparency = gui.BackgroundTransparency gui.BackgroundTransparency = 1 circle.Parent = gui return circle end function PillBackingBuilder:CreateCircleShadow(gui, options) options = self:_configureOptions(gui, options) local shadow = Instance.new("ImageLabel") shadow.SliceScale = SLICE_SCALE_DEFAULT shadow.AnchorPoint = Vector2.new(0.5, 0.5) shadow.BackgroundTransparency = 1 shadow.Image = self.SHADOW_IMAGE_ID shadow.ImageTransparency = self.SHADOW_TRANSPARENCY shadow.Name = "CircleShadow" shadow.Position = UDim2.new(UDim.new(0.5, 0), UDim.new(0.5, 0) + self.SHADOW_OFFSET_Y) shadow.Size = UDim2.new(2, 0, 2, 0) shadow.SizeConstraint = Enum.SizeConstraint.RelativeYY shadow.ZIndex = options.ShadowZIndex shadow.Parent = gui return shadow end function PillBackingBuilder:CreateLeft(gui, options) options = self:_configureOptions(gui, options) local left = self:_createLeft(options) left.Parent = gui return left end function PillBackingBuilder:CreateRight(gui, options) options = self:_configureOptions(gui, options) local right = self:_createRight(options) right.Parent = gui return right end function PillBackingBuilder:CreateTop(gui, options) options = self:_configureOptions(gui, options) local top = self:_createTop(options) top.Parent = gui return top end function PillBackingBuilder:CreateBottom(gui, options) options = self:_configureOptions(gui, options) local bottom = self:_createBottom(options) bottom.Parent = gui return bottom end function PillBackingBuilder:_createTop(options) local top = self:_createCircle(options) top.SizeConstraint = Enum.SizeConstraint.RelativeXX top.AnchorPoint = Vector2.new(0.5, 1) top.ImageRectSize = self.CIRCLE_SIZE * Vector2.new(1, 0.5) top.Name = "TopHalfCircle" top.Position = UDim2.new(0.5, 0, 0, 0) top.Size = UDim2.new(1, 0, 0.5, 0) return top end function PillBackingBuilder:_createBottom(options) local bottom = self:_createCircle(options) bottom.SizeConstraint = Enum.SizeConstraint.RelativeXX bottom.AnchorPoint = Vector2.new(0.5, 0) bottom.ImageRectOffset = self.CIRCLE_SIZE * Vector2.new(0, 0.5) bottom.ImageRectSize = self.CIRCLE_SIZE * Vector2.new(1, 0.5) bottom.Name = "BottomHalfCircle" bottom.Position = UDim2.new(0.5, 0, 1, 0) bottom.Size = UDim2.new(1, 0, 0.5, 0) return bottom end function PillBackingBuilder:_createLeft(options) local left = self:_createCircle(options) left.AnchorPoint = Vector2.new(1, 0.5) left.ImageRectSize = self.CIRCLE_SIZE * Vector2.new(0.5, 1) left.Name = "LeftHalfCircle" left.Position = UDim2.new(0, 0, 0.5, 0) left.Size = UDim2.new(0.5, 0, 1, 0) return left end function PillBackingBuilder:_createRight(options) options = self:_configureOptions(options) local right = self:_createCircle(options) right.AnchorPoint = Vector2.new(0, 0.5) right.ImageRectOffset = self.CIRCLE_SIZE * Vector2.new(0.5, 0) right.ImageRectSize = self.CIRCLE_SIZE * Vector2.new(0.5, 1) right.Name = "RightHalfCircle" right.Position = UDim2.new(1, 0, 0.5, 0) right.Size = UDim2.new(0.5, 0, 1, 0) return right end function PillBackingBuilder:_createLeftShadow(options) local left = self:_createPillShadow(options) left.AnchorPoint = Vector2.new(1, 0.5) left.ImageRectSize = self.PILL_SHADOW_SIZE * Vector2.new(0.25, 1) left.Name = "LeftShadow" left.Position = UDim2.new(0, 0, 0.5, 0) left.Size = UDim2.new(0.5, 0, 1, 0) return left end function PillBackingBuilder:_createRightShadow(options) local right = self:_createPillShadow(options) right.AnchorPoint = Vector2.new(0, 0.5) right.ImageRectOffset = self.PILL_SHADOW_SIZE * Vector2.new(0.75, 0) right.ImageRectSize = self.PILL_SHADOW_SIZE * Vector2.new(0.25, 1) right.Name = "RightShadow" right.Position = UDim2.new(1, 0, 0.5, 0) right.Size = UDim2.new(0.5, 0, 1, 0) return right end function PillBackingBuilder:_createCircle(options) local circle = Instance.new("ImageLabel") circle.BackgroundTransparency = 1 circle.Image = self.CIRCLE_IMAGE_ID circle.Name = "Circle" circle.Size = UDim2.new(1, 0, 1, 0) circle.SizeConstraint = Enum.SizeConstraint.RelativeYY -- set options circle.ImageColor3 = options.BackgroundColor3 circle.ZIndex = options.ZIndex return circle end function PillBackingBuilder:_createPillShadow(options) local shadow = Instance.new("ImageLabel") shadow.BackgroundTransparency = 1 shadow.Image = self.PILL_SHADOW_IMAGE_ID shadow.ImageTransparency = self.SHADOW_TRANSPARENCY shadow.Name = "PillShadow" shadow.Size = UDim2.new(1, 0, 1, 0) shadow.SizeConstraint = Enum.SizeConstraint.RelativeYY shadow.ZIndex = options.ShadowZIndex return shadow end function PillBackingBuilder:_configureOptions(gui, options) assert(gui, "Must pass in GUI") options = Table.copy(options or self._options) options.ZIndex = options.ZIndex or gui.ZIndex options.ShadowZIndex = options.ShadowZIndex or options.ZIndex - 1 options.BackgroundColor3 = options.BackgroundColor3 or gui.BackgroundColor3 return options end return PillBackingBuilder
mit
Shulyaka/packages
net/wifidog-ng/files/wifidog-ng/auth.lua
22
6175
--[[ Copyright (C) 2018 Jianhui Zhao <jianhuizhao329@gmail.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA --]] local uh = require "uhttpd" local http = require "socket.http" local util = require "wifidog-ng.util" local config = require "wifidog-ng.config" local M = {} local apple_host = { ["captive.apple.com"] = true, ["www.apple.com"] = true, } local terms = {} local function is_authed_user(mac) local r = os.execute("ipset test wifidog-ng-mac " .. mac .. " 2> /dev/null") return r == 0 end local function allow_user(mac, temppass) if not temppass then terms[mac].authed = true os.execute("ipset add wifidog-ng-mac " .. mac) else local cfg = config.get() os.execute("ipset add wifidog-ng-mac " .. mac .. " timeout " .. cfg.temppass_time) end end local function deny_user(mac) os.execute("ipset del wifidog-ng-mac " .. mac) end function M.get_terms() local r = {} for k, v in pairs(terms) do if v.authed then r[k] = {ip = v.ip} end end return r end function M.new_term(ip, mac, token) terms[mac] = {ip = ip, token = token} if token then terms[mac].authed = true allow_user(mac) end end local function http_callback_auth(cl) local cfg = config.get() local token = cl:get_var("token") local ip = cl:get_remote_addr() local mac = util.arp_get(cfg.gw_ifname, ip) if not mac then uh.log(uh.LOG_ERR, "Not found macaddr for " .. ip) cl:send_error(401, "Unauthorized", "Not found your macaddr") return uh.REQUEST_DONE end if token and #token > 0 then if cl:get_var("logout") then local url = string.format("%s&stage=logout&ip=%s&mac=%s&token=%s", cfg.auth_url, ip, mac, token) http.request(url) deny_user(mac) else local url = string.format("%s&stage=login&ip=%s&mac=%s&token=%s", cfg.auth_url, ip, mac, token) local r = http.request(url) if not r then cl:send_error(401, "Unauthorized") return uh.REQUEST_DONE end local auth = r:match("Auth: (%d)") if auth == "1" then allow_user(mac) cl:redirect(302, string.format("%s&mac=%s", cfg.portal_url, mac)) else cl:redirect(302, string.format("%s&mac=%s", cfg.msg_url, mac)) return uh.REQUEST_DONE end end else cl:send_error(401, "Unauthorized") return uh.REQUEST_DONE end end local function http_callback_temppass(cl) local cfg = config.get() local ip = cl:get_remote_addr() local mac = util.arp_get(cfg.gw_ifname, ip) if not mac then uh.log(uh.LOG_ERR, "Not found macaddr for " .. ip) cl:send_error(401, "Unauthorized", "Not found your macaddr") return uh.REQUEST_DONE end local script = cl:get_var("script") or "" cl:send_header(200, "OK", -1) cl:header_end() allow_user(mac, true) cl:chunk_send(cl:get_var("script") or ""); cl:request_done() return uh.REQUEST_DONE end local function http_callback_404(cl, path) local cfg = config.get() if cl:get_http_method() ~= uh.HTTP_METHOD_GET then cl:send_error(401, "Unauthorized") return uh.REQUEST_DONE end local ip = cl:get_remote_addr() local mac = util.arp_get(cfg.gw_ifname, ip) if not mac then uh.log(uh.LOG_ERR, "Not found macaddr for " .. ip) cl:send_error(401, "Unauthorized", "Not found your macaddr") return uh.REQUEST_DONE end term = terms[mac] if not term then terms[mac] = {ip = ip} end term = terms[mac] if is_authed_user(mac) then cl:redirect(302, "%s&mac=%s", cfg.portal_url, mac) return uh.REQUEST_DONE end cl:send_header(200, "OK", -1) cl:header_end() local header_host = cl:get_header("host") if apple_host[header_host] then local http_ver = cl:get_http_version() if http_ver == uh.HTTP_VER_10 then if not term.apple then cl:chunk_send("fuck you") term.apple = true cl:request_done() return uh.REQUEST_DONE end end end local redirect_html = [[ <!doctype html><html><head><title>Success</title> <script type="text/javascript"> setTimeout(function() {location.replace('%s&ip=%s&mac=%s');}, 1);</script> <style type="text/css">body {color:#FFF}</style></head> <body>Success</body></html> ]] cl:chunk_send(string.format(redirect_html, cfg.login_url, ip, mac)) cl:request_done() return uh.REQUEST_DONE end local function on_request(cl, path) if path == "/wifidog/auth" then return http_callback_auth(cl) elseif path == "/wifidog/temppass" then return http_callback_temppass(cl) end return uh.REQUEST_CONTINUE end function M.init() local cfg = config.get() local srv = uh.new(cfg.gw_address, cfg.gw_port) srv:on_request(on_request) srv:on_error404(http_callback_404) if uh.SSL_SUPPORTED then local srv_ssl = uh.new(cfg.gw_address, cfg.gw_ssl_port) srv_ssl:ssl_init("/etc/wifidog-ng/ssl.crt", "/etc/wifidog-ng/ssl.key") srv_ssl:on_request(on_request) srv_ssl:on_error404(http_callback_404) end end return M
gpl-2.0
ffxiphoenix/darkstar
scripts/zones/Lower_Jeuno/npcs/Aldo.lua
17
1938
----------------------------------- -- Area: Lower Jeuno -- NPC: Aldo -- Involved in Mission: Magicite, Return to Delkfutt's Tower (Zilart) -- @pos 20 3 -58 245 ----------------------------------- package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/zones/Lower_Jeuno/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local ZilartMission = player:getCurrentMission(ZILART); local ZilartStatus = player:getVar("ZilartStatus"); if (player:hasKeyItem(LETTERS_TO_ALDO)) then player:startEvent(0x0098); elseif (player:getCurrentMission(player:getNation()) == 13 and player:getVar("MissionStatus") == 3) then player:startEvent(0x00B7); elseif (ZilartMission == RETURN_TO_DELKFUTTS_TOWER and ZilartStatus == 0) then player:startEvent(0x0068); elseif (ZilartMission == THE_SEALED_SHRINE and ZilartStatus == 1) then player:startEvent(111); 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 == 0x0098) then player:delKeyItem(LETTERS_TO_ALDO); player:addKeyItem(SILVER_BELL); player:messageSpecial(KEYITEM_OBTAINED,SILVER_BELL); player:setVar("MissionStatus",3); elseif (csid == 0x0068) then player:setVar("ZilartStatus",1); end end;
gpl-3.0
moonlight/blues-brothers-rpg
data/scripts/PlayerController.lua
2
2126
-- -- PlayerControllers are used by human players to control pawns. -- -- By Bjorn Lindeijer import("Controller.lua") PlayerController = Controller:subclass { name = "PlayerController"; -- This is where the input handling takes place. When the player is not -- allowed to move (ie. in a cutscene), this function does not get called. -- playerTick = function(self) if (self.pawn and not self.pawn.bDead) then if (not self.pawn.bSleeping) then if (self.bUp and self.pawn.walking == 0) then self.pawn:walk(DIR_UP) end if (self.bLeft and self.pawn.walking == 0) then self.pawn:walk(DIR_LEFT) end if (self.bRight and self.pawn.walking == 0) then self.pawn:walk(DIR_RIGHT) end if (self.bDown and self.pawn.walking == 0) then self.pawn:walk(DIR_DOWN) end end if (self.pawn.walking == 0) then if (self.bActivate and not self.bActivatePrev) then -- Try activating an object local ax, ay = self.pawn.x, self.pawn.y if (self.pawn.onActivate) then self.pawn:onActivate() elseif (not self.pawn.bSleeping) then if (self.pawn.dir == DIR_LEFT) then ax = ax - 1 end if (self.pawn.dir == DIR_RIGHT) then ax = ax + 1 end if (self.pawn.dir == DIR_UP) then ay = ay - 1 end if (self.pawn.dir == DIR_DOWN) then ay = ay + 1 end local objs = m_get_objects_at(ax, ay, self.pawn.map) local activated = false local i = 1 while (i <= #objs and not activated) do if (objs[i].bCanActivate) then -- By returning true, an object can indicate nothing else should be activated -- after this one. activated = objs[i]:activatedBy(self.pawn) end i = i + 1 end end elseif (self.bAttack and not self.pawn.bSleeping) then -- Try attacking self.pawn:attack(self.pawn.dir) end end self.bActivatePrev = self.bActivate end end; defaultproperties = { -- Input variables bUp = false, bLeft = false, bRight = false, bDown = false, bActivate = false, bAttack = false, } }
gpl-2.0
ffxiphoenix/darkstar
scripts/globals/spells/frost.lua
18
1587
----------------------------------------- -- Spell: Frost -- Deals ice damage that lowers an enemy's agility and gradually reduces its HP. ----------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) if (target:getStatusEffect(EFFECT_BURN) ~= nil) then spell:setMsg(75); -- no effect else local dINT = caster:getStat(MOD_INT)-target:getStat(MOD_INT); local resist = applyResistance(caster,spell,target,dINT,36,0); if (resist <= 0.125) then spell:setMsg(85); else if (target:getStatusEffect(EFFECT_CHOKE) ~= nil) then target:delStatusEffect(EFFECT_CHOKE); end; local sINT = caster:getStat(MOD_INT); local DOT = getElementalDebuffDOT(sINT); local effect = target:getStatusEffect(EFFECT_FROST); local noeffect = false; if (effect ~= nil) then if (effect:getPower() >= DOT) then noeffect = true; end; end; if (noeffect) then spell:setMsg(75); -- no effect else if (effect ~= nil) then target:delStatusEffect(EFFECT_FROST); end; spell:setMsg(237); local duration = math.floor(ELEMENTAL_DEBUFF_DURATION * resist); target:addStatusEffect(EFFECT_FROST,DOT, 3, ELEMENTAL_DEBUFF_DURATION,FLAG_ERASBLE); end; end; end; return EFFECT_FROST; end;
gpl-3.0
ffxiphoenix/darkstar
scripts/globals/abilities/pets/meteor_strike.lua
25
1296
--------------------------------------------------- -- Geocrush --------------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); require("scripts/globals/magic"); --------------------------------------------------- function onAbilityCheck(player, target, ability) return 0,0; end; function onPetAbility(target, pet, skill) local dINT = math.floor(pet:getStat(MOD_INT) - target:getStat(MOD_INT)); local tp = skill:getTP(); local master = pet:getMaster(); local merits = 0; if (master ~= nil and master:isPC()) then merits = master:getMerit(MERIT_METEOR_STRIKE); end tp = tp + (merits - 40); if (tp > 300) then tp = 300; end --note: this formula is only accurate for level 75 - 76+ may have a different intercept and/or slope local damage = math.floor(512 + 1.72*(tp+1)); damage = damage + (dINT * 1.5); damage = MobMagicalMove(pet,target,skill,damage,ELE_FIRE,1,TP_NO_EFFECT,0); damage = mobAddBonuses(pet, nil, target, damage.dmg, ELE_FIRE); damage = AvatarFinalAdjustments(damage,pet,skill,target,MOBSKILL_MAGICAL,MOBPARAM_NONE,1); target:delHP(damage); target:updateEnmityFromDamage(pet,damage); return damage; end
gpl-3.0
ffxiphoenix/darkstar
scripts/globals/mobskills/Havoc_Spiral.lua
25
1095
--------------------------------------------- -- Havoc Spiral -- -- Description: Deals damage to players in an area of effect. Additional effect: Sleep -- Type: Physical -- 2-3 Shadows -- Range: Unknown -- Special weaponskill unique to Ark Angel MR. Deals ~100-300 damage. --------------------------------------------- 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) -- TODO: Can skillchain? Unknown property. local numhits = 1; local accmod = 1; local dmgmod = 3; local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_SLASH,MOBPARAM_2_SHADOW); -- Witnessed 280 to a melee, 400 to a BRD, and 500 to a wyvern, so... target:delHP(dmg); MobStatusEffectMove(mob, target, EFFECT_SLEEP_I, 1, 0, math.random(30, 60)); return dmg; end;
gpl-3.0
ffxiphoenix/darkstar
scripts/zones/Port_Bastok/npcs/Blabbivix.lua
17
1227
----------------------------------- -- Area: Port Bastok -- NPC: Blabbivix -- Standard merchant, though he acts like a guild merchant -- @pos -110.209 4.898 22.957 236 ----------------------------------- package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/zones/Port_Bastok/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:sendGuild(60418,11,22,3)) then player:showText(npc,BLABBIVIX_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
RodneyMcKay/x_hero_siege
game/scripts/vscripts/abilities/heroes/hero_enchantress.lua
1
4504
LinkLuaModifier("modifier_tyrande_multiple_arrows", "abilities/heroes/hero_enchantress", LUA_MODIFIER_MOTION_NONE) tyrande_multiple_arrows = tyrande_multiple_arrows or class({}) function tyrande_multiple_arrows:GetIntrinsicModifierName() return "modifier_tyrande_multiple_arrows" end modifier_tyrande_multiple_arrows = modifier_tyrande_multiple_arrows or class({}) function modifier_tyrande_multiple_arrows:IsHidden() return true end function modifier_tyrande_multiple_arrows:DeclareFunctions() return { MODIFIER_EVENT_ON_ATTACK, MODIFIER_PROPERTY_DAMAGEOUTGOING_PERCENTAGE, MODIFIER_PROPERTY_TRANSLATE_ACTIVITY_MODIFIERS, } end function modifier_tyrande_multiple_arrows:OnAttack(keys) if not IsServer() then return end -- "Secondary arrows are not released upon attacking allies." -- The "not keys.no_attack_cooldown" clause seems to make sure the function doesn't trigger on PerformAttacks with that false tag so this thing doesn't crash if keys.attacker == self:GetParent() and keys.target and keys.target:GetTeamNumber() ~= self:GetParent():GetTeamNumber() and not keys.no_attack_cooldown and not self:GetParent():PassivesDisabled() and self:GetAbility():IsTrained() then local enemies = FindUnitsInRadius(self:GetParent():GetTeamNumber(), self:GetParent():GetAbsOrigin(), nil, self:GetParent():Script_GetAttackRange() + self:GetAbility():GetSpecialValueFor("split_shot_bonus_range"), DOTA_UNIT_TARGET_TEAM_ENEMY, DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC, DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES + DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE + DOTA_UNIT_TARGET_FLAG_NO_INVIS + DOTA_UNIT_TARGET_FLAG_NOT_ATTACK_IMMUNE, FIND_ANY_ORDER, false) local target_number = 0 for _, enemy in pairs(enemies) do if enemy ~= keys.target then self.split_shot_target = true self:GetParent():PerformAttack(enemy, false, false, true, true, true, false, false) self.split_shot_target = false target_number = target_number + 1 if target_number >= self:GetAbility():GetSpecialValueFor("arrow_count") then break end end end end end function modifier_tyrande_multiple_arrows:GetModifierDamageOutgoing_Percentage() if not IsServer() then return end if self.split_shot_target then return self:GetAbility():GetSpecialValueFor("damage_modifier") else return 0 end end function modifier_tyrande_multiple_arrows:GetActivityTranslationModifiers() return "split_shot" end LinkLuaModifier("modifier_xhs_trueshot_aura", "abilities/heroes/hero_enchantress", LUA_MODIFIER_MOTION_NONE) LinkLuaModifier("modifier_xhs_trueshot", "abilities/heroes/hero_enchantress", LUA_MODIFIER_MOTION_NONE) xhs_trueshot_aura = xhs_trueshot_aura or class({}) function xhs_trueshot_aura:GetIntrinsicModifierName() return "modifier_xhs_trueshot_aura" end modifier_xhs_trueshot_aura = modifier_xhs_trueshot_aura or class({}) -- Modifier properties function modifier_xhs_trueshot_aura:IsAura() return true end function modifier_xhs_trueshot_aura:IsAuraActiveOnDeath() return false end function modifier_xhs_trueshot_aura:IsDebuff() return false end function modifier_xhs_trueshot_aura:IsHidden() return true end function modifier_xhs_trueshot_aura:IsPermanent() return true end function modifier_xhs_trueshot_aura:IsPurgable() return false end -- Aura properties function modifier_xhs_trueshot_aura:GetAuraRadius() return 99999 end function modifier_xhs_trueshot_aura:GetAuraSearchFlags() return self:GetAbility():GetAbilityTargetFlags() end function modifier_xhs_trueshot_aura:GetAuraSearchTeam() return self:GetAbility():GetAbilityTargetTeam() end function modifier_xhs_trueshot_aura:GetAuraSearchType() return self:GetAbility():GetAbilityTargetType() end function modifier_xhs_trueshot_aura:GetModifierAura() return "modifier_xhs_trueshot" end modifier_xhs_trueshot = modifier_xhs_trueshot or class({}) -- Modifier properties function modifier_xhs_trueshot:IsDebuff() return false end function modifier_xhs_trueshot:IsHidden() return false end function modifier_xhs_trueshot:IsPurgable() return false end function modifier_xhs_trueshot:IsPurgeException() return false end function modifier_xhs_trueshot:DeclareFunctions() return { MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE, } end function modifier_xhs_trueshot:GetModifierPreAttack_BonusDamage() if self:GetCaster().GetAgility then self:SetStackCount(self:GetCaster():GetAgility() / 100 * self:GetAbility():GetSpecialValueFor("trueshot_ranged_damage")) end return self:GetStackCount() end
gpl-2.0
vilarion/Illarion-Content
quest/rutrus_67_cadomyr_wilderness.lua
3
5143
--[[ Illarion Server 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 (at your option) 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/>. ]] -- INSERT INTO "quests" ("qst_id", "qst_script") VALUES (67, 'quest.rutrus_67_cadomyr_wilderness'); local common = require("base.common") local M = {} local GERMAN = Player.german local ENGLISH = Player.english -- Insert the quest title here, in both languages local Title = {} Title[GERMAN] = "Sternenoase" Title[ENGLISH] = "Oasis of Stars" -- Insert an extensive description of each status here, in both languages -- Make sure that the player knows exactly where to go and what to do local Description = {} Description[GERMAN] = {} Description[ENGLISH] = {} Description[GERMAN][1] = "Sammel zehnmal groben Sand und bringe diese Rutrus. Nimm die Schaufel in die Hand und benutzte sie, während du vor einem Stein im Sand stehst." Description[ENGLISH][1] = "Collect ten coarse sand and bring them back to Rutrus. Use the shovel in your hand, while standing in front of a stone in the desert." Description[GERMAN][2] = "Geh zu Rutrus in der Sternenoase. Er hat bestimmt noch eine Aufgabe für dich." Description[ENGLISH][2] = "Go back to Rutrus in the Oasis of Stars, he certainly has another task for you." Description[GERMAN][3] = "Sammel zwanzigmal Quarzsand und bringe diesen Rutrus. Siebe groben Sand um Quarzsand herzustellen. Nimm eine Holzkelle in die Hand und benutzte sie, während du vor einem Sieb stehst." Description[ENGLISH][3] = "Produce twenty quartz sand and bring them back to Rutrus. In order to produce quartz sand stand in front of a sieve with coarse sand in your inventory. Then use a wooden shovel in your hand." Description[GERMAN][4] = "Geh zu Rutrus in der Sternenoase. Er hat bestimmt noch eine Aufgabe für dich." Description[ENGLISH][4] = "Go back to Rutrus in the Oasis of Stars, he certainly has another task for you." Description[GERMAN][5] = "Sammel fünf ungeschliffene Topase und bringe diese Rutrus. Du kannst sie entweder beim Händler kaufen oder in der Mine finden. Nimm hierfür eine Spitzhacke in die Hand und benutzte sie, während du vor einem Stein stehst." Description[ENGLISH][5] = "Collect five raw topaz and bring them back to Rutrus. You can buy them from a merchant or find them in a mine. Use the pick-axe in your hand, while standing in front of a stone to start mining." Description[GERMAN][6] = "Geh zu Rutrus in der Sternenoase. Er hat bestimmt noch eine Aufgabe für dich." Description[ENGLISH][6] = "Go back to Rutrus in the Oasis of Stars, he certainly has another task for you." Description[GERMAN][7] = "Besorge zehn Kohleklumpen und bringe sie Rutrus. Du kannst Kohle entweder beim Händler kaufen oder in der Mine finden. Nimm hierfür eine Spitzhacke in die Hand und benutzte sie, während du vor einem Stein stehst." Description[ENGLISH][7] = "Produce ten lumps of coal and bring them to Rutrus. You can buy coal from a merchant or find it in a mine. Use the pick-axe in your hand, while standing in front of a stone to start mining." Description[GERMAN][8] = "Du hast alle Aufgaben von Rutrus erfüllt." Description[ENGLISH][8] = "You have fulfilled all the tasks for Rutrus." -- Insert the position of the quest start here (probably the position of an NPC or item) local Start = {359, 678, 0} -- For each status insert a list of positions where the quest will continue, i.e. a new status can be reached there local QuestTarget = {} QuestTarget[1] = {position(359, 678, 0), position(350, 675, 0)} -- sandpit QuestTarget[2] = {position(359, 678, 0)} QuestTarget[3] = {position(359, 678, 0), position(139, 592, 0)} -- sieve QuestTarget[4] = {position(359, 678, 0)} QuestTarget[5] = {position(359, 678, 0), position(122, 614, 0), position(169, 607, 0)} -- händler mine QuestTarget[6] = {position(359, 678, 0)} QuestTarget[7] = {position(359, 678, 0), position(122, 614, 0), position(143, 689, 0)} -- händler mine QuestTarget[8] = {position(359, 678, 0)} -- Insert the quest status which is reached at the end of the quest local FINAL_QUEST_STATUS = 8 function M.QuestTitle(user) return common.GetNLS(user, Title[GERMAN], Title[ENGLISH]) end function M.QuestDescription(user, status) local german = Description[GERMAN][status] or "" local english = Description[ENGLISH][status] or "" return common.GetNLS(user, german, english) end function M.QuestStart() return Start end function M.QuestTargets(user, status) return QuestTarget[status] end function M.QuestFinalStatus() return FINAL_QUEST_STATUS end return M
agpl-3.0
ffxiphoenix/darkstar
scripts/globals/keyitems.lua
32
120326
--------------------------------------------- -- -- KEYITEMS IDS -- --------------------------------------------- ZERUHN_REPORT = 1; PALBOROUGH_MINES_LOGS = 2; BLUE_ACIDITY_TESTER = 3; RED_ACIDITY_TESTER = 4; LETTER_TO_THE_CONSULS_SANDORIA = 5; LETTER_TO_THE_CONSULS_BASTOK = 6; LETTER_TO_THE_CONSULS_WINDURST = 7; AIRSHIP_PASS = 8; AIRSHIP_PASS_FOR_KAZHAM = 9; OVERDUE_BOOK_NOTIFICATIONS = 10; LETTERS_FROM_DOMIEN = 11; C_L_REPORTS = 12; KINDRED_CREST = 13; MAGICITE_OPTISTONE = 14; MAGICITE_AURASTONE = 15; MAGICITE_ORASTONE = 16; FOOD_OFFERINGS = 17; DRINK_OFFERINGS = 18; CLOCK_TOWER_OIL = 19; YAGUDO_TORCH = 20; CREST_OF_DAVOI_KI = 21; LETTERS_TO_ALDO = 22; BOUQUETS_FOR_THE_PIONEERS = 23; OLD_TOOLBOX = 24; NOTES_FROM_HARIGAORIGA = 25; NOTES_FROM_IPUPU = 26; ART_FOR_EVERYONE = 27; CRACKED_MANA_ORBS = 28; KINDRED_REPORT = 29; LETTER_TO_THE_AMBASSADOR = 30; SWORD_OFFERING = 31; SHIELD_OFFERING = 32; DULL_SWORD = 33; DARK_KEY = 34; ADVENTURERS_CERTIFICATE = 35; STARWAY_STAIRWAY_BAUBLE = 36; FIRST_DARK_MANA_ORB = 37; CREATURE_COUNTER_MAGIC_DOLL = 38; OFF_OFFERING = 39; WINDURST_WATERS_SCOOP = 40; WINDURST_WALLS_SCOOP = 41; PORT_WINDURST_SCOOP = 42; WINDURST_WOODS_SCOOP = 43; TEMPLE_KNIGHTS_DAVOI_REPORT = 44; SILVER_BELL = 45; CORUSCANT_ROSARY = 46; BLACK_MATINEE_NECKLACE = 47; DUCAL_GUARDS_LANTERN = 48; DUCAL_GUARDS_LANTERN_LIT = 49; HOLY_CANDLE = 50; SECOND_DARK_MANA_ORB = 51; THIRD_DARK_MANA_ORB = 52; FOURTH_DARK_MANA_ORB = 53; FIFTH_DARK_MANA_ORB = 54; SIXTH_DARK_MANA_ORB = 55; ARCHDUCAL_AUDIENCE_PERMIT = 56; SUPER_SOUP_POT = 57; TWO_OF_SWORDS = 58; FIRST_GLOWING_MANA_ORB = 59; SECOND_GLOWING_MANA_ORB = 60; THIRD_GLOWING_MANA_ORB = 61; FOURTH_GLOWING_MANA_ORB = 62; FIFTH_GLOWING_MANA_ORB = 63; SIXTH_GLOWING_MANA_ORB = 64; RESCUE_TRAINING_CERTIFICATE = 65; CHARM_OF_LIGHT = 66; HIDEOUT_KEY = 67; LAPIS_CORAL = 68; MESSAGE_TO_JEUNO_SANDORIA = 69; MESSAGE_TO_JEUNO_BASTOK = 70; MESSAGE_TO_JEUNO_WINDURST = 71; NEW_FEIYIN_SEAL = 72; BURNT_SEAL = 73; SHADOW_FRAGMENT = 74; RONFAURE_SUPPLIES = 75; ZULKHEIM_SUPPLIES = 76; NORVALLEN_SUPPLIES = 77; GUSTABERG_SUPPLIES = 78; DERFLAND_SUPPLIES = 79; SARUTABARUTA_SUPPLIES = 80; KOLSHUSHU_SUPPLIES = 81; ARAGONEU_SUPPLIES = 82; FAUREGANDI_SUPPLIES = 83; VALDEAUNIA_SUPPLIES = 84; LITELOR_SUPPLIES = 85; KUZOTZ_SUPPLIES = 86; VOLLBOW_SUPPLIES = 87; LAPIS_MONOCLE = 88; DONATION_ENVELOPE = 89; ARAGONEU_PIZZA = 90; LAND_CRAB_BISQUE = 91; MHAURAN_COUSCOUS = 92; ETCHED_RING = 93; TRADERS_SACK = 94; FAKE_MOUSTACHE = 95; GARDENIA_PASS = 96; WEAPONS_ORDER = 97; WEAPONS_RECEIPT = 98; SMALL_BAG = 99; RANPIMONPIS_SPECIAL_STEW = 100; FERRY_TICKET = 101; STAMP_SHEET = 102; LOST_DOCUMENT = 103; EAST_BLOCK_CODE = 104; SOUTH_BLOCK_CODE = 105; NORTH_BLOCK_CODE = 106; LETTER_FROM_ROH_LATTEH = 107; PAINTING_OF_A_WINDMILL = 108; TATTERED_MISSION_ORDERS = 109; MONASTIC_CAVERN_KEY = 110; MOON_CRYSTAL = 111; SOUTHEASTERN_STAR_CHARM = 112; WONDER_MAGIC_SET = 113; UNFINISHED_LETTER = 114; NEW_MODEL_HAT = 115; ANGELICAS_AUTOGRAPH = 116; OLD_TIGERS_FANG = 117; TENSHODO_MEMBERS_CARD = 118; RECEIPT_FOR_THE_PRINCE = 119; MAGIC_TRASH = 120; TENSHODO_APPLICATION_FORM = 121; SHARP_GRAY_STONE = 122; CATHEDRAL_DONATION = 123; QUFIM_SUPPLIES = 124; TATTERED_TEST_SHEET = 125; A_SONG_OF_LOVE = 126; STEAMING_SHEEP_INVITATION = 127; BROKEN_WAND = 128; GULEMONTS_DOCUMENT = 129; OLD_RING = 130; WHITE_ORB = 131; PINK_ORB = 132; RED_ORB = 133; BLOOD_ORB = 134; CURSED_ORB = 135; CRIMSON_ORB = 136; KEY_TO_THE_OZTROJA_MINES = 137; CHOCOBO_LICENSE = 138; CURSEPAPER = 139; CORRUPTED_DIRT = 140; STALACTITE_DEW = 141; SQUIRE_CERTIFICATE = 142; BOOK_OF_TASKS = 143; BOOK_OF_THE_EAST = 144; BOOK_OF_THE_WEST = 145; KNIGHTS_SOUL = 146; COLD_MEDICINE = 147; AMAURAS_FORMULA = 148; OVERDUE_BOOK_NOTIFICATION = 149; SCRIPTURE_OF_WATER = 150; SCRIPTURE_OF_WIND = 151; TAMIS_NOTE = 152; THYME_MOSS = 153; COUGH_MEDICINE = 154; SCROLL_OF_TREASURE = 155; CODE_OF_BEASTMASTERS = 156; ORCISH_HUT_KEY = 157; STAR_CRESTED_SUMMONS = 158; BRUGAIRE_GOODS = 159; SMALL_TEACUP = 160; SUSPICIOUS_ENVELOPE = 161; CARRIER_PIGEON_LETTER = 162; CARMELOS_SONG_SHEET = 163; CURILLAS_BOTTLE_EMPTY = 164; CURILLAS_BOTTLE_FULL = 165; NEUTRALIZER = 166; GOLDSMITHING_ORDER = 167; MYTHRIL_HEARTS = 168; TESTIMONIAL = 169; LETTER_FROM_ZEID = 170; SHANTOTTOS_NEW_SPELL = 171; SHANTOTTOS_EXSPELL = 172; BUCKET_OF_DIVINE_PAINT = 173; LETTER_FROM_VIRNAGE = 174; SPIRIT_INCENSE = 175; GANTINEUXS_LETTER = 176; SEAL_OF_BANISHING = 177; MAGICAL_PATTERN = 178; FEIYIN_MAGIC_TOME = 179; SLUICE_SURVEYOR_MK_I = 180; FOE_FINDER_MK_I = 181; EARTHEN_CHARM = 182; LETTER_FROM_THE_TENSHODO = 183; TENSHODO_ENVELOPE = 184; SIGNED_ENVELOPE = 185; GANG_WHEREABOUTS_NOTE = 186; FIRST_FORGED_ENVELOPE = 187; SECOND_FORGED_ENVELOPE = 188; FIRST_SIGNED_FORGED_ENVELOPE = 189; SECOND_SIGNED_FORGED_ENVELOPE = 190; LETTER_FROM_DALZAKK = 191; SANDORIAN_MARTIAL_ARTS_SCROLL = 192; BOMB_INCENSE = 193; PERCHONDS_ENVELOPE = 194; PORTAL_CHARM = 195; ORCISH_DRIED_FOOD = 196; OLD_POCKET_WATCH = 197; OLD_BOOTS = 198; BALGA_CHAMPION_CERTIFICATE = 199; HOLY_ONES_OATH = 200; CRAWLER_BLOOD = 201; CAT_BURGLARS_NOTE = 202; CHIEFTAINNESS_TWINSTONE_EARRING = 203; NORTHERN_VINE = 204; SOUTHERN_VINE = 205; EASTERN_VINE = 206; WESTERN_VINE = 207; SWORD_GRIP_MATERIAL = 208; YASINS_SWORD = 209; OLD_GAUNTLETS = 210; SHADOW_FLAMES = 211; FIREBLOOM_TREE_WOOD = 212; LETTER_TO_ANGELICA = 213; FINAL_FANTASY = 214; RIPPED_FINAL_FANTASY_PAINTING = 215; FINAL_FANTASY_PART_II = 216; TAMERS_WHISTLE = 217; KNIGHTS_BOOTS = 218; MIQUES_PAINTBRUSH = 219; STRANGE_SHEET_OF_PAPER = 220; KNIGHTS_CONFESSION = 221; ROUND_FRIGICITE = 222; SQUARE_FRIGICITE = 223; TRIANGULAR_FRIGICITE = 224; STAR_RING1 = 225; STAR_RING2 = 226; MOON_RING = 227; MERTAIRES_BRACELET = 228; AQUAFLORA1 = 229; AQUAFLORA2 = 230; AQUAFLORA3 = 231; GUIDING_BELL = 232; ORDELLE_WHETSTONE = 233; LETTER_FROM_THE_DARKSTEEL_FORGE = 234; DARKSTEEL_FORMULA = 235; KOHS_LETTER = 236; ROYAL_KNIGHTS_DAVOI_REPORT = 237; SACRIFICIAL_CHAMBER_KEY = 238; FIRE_FRAGMENT = 239; WATER_FRAGMENT = 240; EARTH_FRAGMENT = 241; WIND_FRAGMENT = 242; LIGHTNING_FRAGMENT = 243; ICE_FRAGMENT = 244; LIGHT_FRAGMENT = 245; DARK_FRAGMENT = 246; PRISMATIC_FRAGMENT = 247; SOUTHWESTERN_STAR_CHARM = 248; HOLY_ONES_INVITATION = 249; OPTISTERY_RING = 250; BLANK_BOOK_OF_THE_GODS = 251; BOOK_OF_THE_GODS = 252; NONBERRYS_KNIFE = 253; SUBLIME_STATUE_OF_THE_GODDESS = 254; RAUTEINOTS_PARCEL = 255; TREASURE_MAP = 256; STRANGELY_SHAPED_CORAL = 257; SEALED_DAGGER = 258; ANGELICAS_LETTER = 259; EMPTY_BARREL = 260; BARREL_OF_OPOOPO_BREW = 261; ELSHIMO_LOWLANDS_SUPPLIES = 262; ELSHIMO_UPLANDS_SUPPLIES = 263; JOKER_CARD = 264; ORASTERY_RING = 265; ALTEPA_MOONPEBBLE = 266; RHINOSTERY_CERTIFICATE = 267; DREAMROSE = 268; ANCIENT_SANDORIAN_BOOK = 269; PIECE_OF_PAPER = 270; INVISIBLE_MAN_STICKER = 271; PAINTBRUSH_OF_SOULS = 272; OLD_RUSTY_KEY = 273; ANCIENT_TABLET_FRAGMENT = 274; STAR_SEEKER = 275; AURASTERY_RING = 276; TABLET_OF_ANCIENT_MAGIC = 277; LETTER_FROM_ALFESAR = 278; MAGIC_DRAINED_STAR_SEEKER = 279; RHINOSTERY_RING = 280; MANUSTERY_RING = 281; GLOVE_OF_PERPETUAL_TWILIGHT = 282; ANCIENT_SANDORIAN_TABLET = 283; CRYSTAL_DOWSER = 284; PIECE_OF_A_BROKEN_KEY1 = 285; PIECE_OF_A_BROKEN_KEY2 = 286; PIECE_OF_A_BROKEN_KEY3 = 287; DROPS_OF_AMNIO = 288; REINFORCED_CERMET = 289; LETTER_FROM_WEREI = 290; TONBERRY_KEY = 291; THESIS_ON_ALCHEMY = 292; OLD_PIECE_OF_WOOD = 293; DRAGON_CURSE_REMEDY = 294; SEALED_IRON_BOX = 295; SEA_SERPENT_STATUE = 296; ALTEPA_POLISHING_STONE = 297; CHALLENGE_TO_THE_ROYAL_KNIGHTS = 298; RANCHURIOMES_LEGACY = 299; RONFAURE_EF_INSIGNIA = 300; ZULKHEIM_EF_INSIGNIA = 301; NORVALLEN_EF_INSIGNIA = 302; GUSTABERG_EF_INSIGNIA = 303; DERFLAND_EF_INSIGNIA = 304; SARUTABARUTA_EF_INSIGNIA = 305; KOLSHUSHU_EF_INSIGNIA = 306; ARAGONEU_EF_INSIGNIA = 307; FAUREGANDI_EF_INSIGNIA = 308; VALDEAUNIA_EF_INSIGNIA = 309; QUFIM_EF_INSIGNIA = 310; LITELOR_EF_INSIGNIA = 311; KUZOTZ_EF_INSIGNIA = 312; VOLLBOW_EF_INSIGNIA = 313; ELSHIMO_LOWLANDS_EF_INSIGNIA = 314; ELSHIMO_UPLANDS_EF_INSIGNIA = 315; KEY_ITEM316 = 316; KEY_ITEM317 = 317; KEY_ITEM318 = 318; KEY_ITEM319 = 319; WHISPER_OF_FLAMES = 320; WHISPER_OF_TREMORS = 321; WHISPER_OF_TIDES = 322; WHISPER_OF_GALES = 323; WHISPER_OF_FROST = 324; WHISPER_OF_STORMS = 325; WHISPER_OF_THE_MOON = 326; WHISPER_OF_DREAMS = 327; TUNING_FORK_OF_FIRE = 328; TUNING_FORK_OF_EARTH = 329; TUNING_FORK_OF_WATER = 330; TUNING_FORK_OF_WIND = 331; TUNING_FORK_OF_ICE = 332; TUNING_FORK_OF_LIGHTNING = 333; MOON_BAUBLE = 334; VIAL_OF_DREAM_INCENSE = 335; ORCISH_CREST = 336; QUADAV_CREST = 337; YAGUDO_CREST = 338; UN_MOMENT = 339; LEPHEMERE = 340; LANCIENNE = 341; CHANSON_DE_LIBERTE = 342; WEAPON_TRAINING_GUIDE = 343; MAP_TO_THE_ANNALS_OF_TRUTH = 344; ANNALS_OF_TRUTH = 345; COMPLETION_CERTIFICATE = 346; DYNAMIS_DEBUGGER = 347; DROPPED_ITEM = 348; WHITE_CARD = 349; RED_CARD = 350; BLACK_CARD = 351; HOLLA_GATE_CRYSTAL = 352; DEM_GATE_CRYSTAL = 353; MEA_GATE_CRYSTAL = 354; VAHZL_GATE_CRYSTAL = 355; YHOATOR_GATE_CRYSTAL = 356; ALTEPA_GATE_CRYSTAL = 357; PROMYVION_HOLLA_SLIVER = 358; PROMYVION_DEM_SLIVER = 359; PROMYVION_MEA_SLIVER = 360; WHISPER_OF_THE_WYRMKING = 361; NOTE_WRITTEN_BY_ESHANTARL = 362; RAINBOW_RESONATOR = 363; FADED_RUBY = 364; TATTERED_MAZE_MONGER_POUCH = 365; CRIMSON_STRATUM_ABYSSITE = 366; CRIMSON_STRATUM_ABYSSITE_II = 367; CRIMSON_STRATUM_ABYSSITE_III = 368; CRIMSON_STRATUM_ABYSSITE_IV = 369; INDIGO_STRATUM_ABYSSITE = 370; INDIGO_STRATUM_ABYSSITE_II = 371; INDIGO_STRATUM_ABYSSITE_III = 372; INDIGO_STRATUM_ABYSSITE_IV = 373; JADE_STRATUM_ABYSSITE = 374; JADE_STRATUM_ABYSSITE_II = 375; JADE_STRATUM_ABYSSITE_III = 376; JADE_STRATUM_ABYSSITE_IV = 377; SHODDY_METAL_CLASP = 378; BUNDLE_OF_SUNDRY_PLANTS = 379; SQUARE_OF_ULTIMATE_CLOTH = 380; PLIABLE_LIZARD_SKIN = 381; SQUARE_OF_LIZARD_LEATHER = 382; MAP_OF_ABDH_ISLE_PURGONORGO = 383; MAP_OF_THE_SAN_DORIA_AREA = 385; MAP_OF_THE_BASTOK_AREA = 386; MAP_OF_THE_WINDURST_AREA = 387; MAP_OF_THE_JEUNO_AREA = 388; MAP_OF_QUFIM_ISLAND = 389; MAP_OF_THE_NORTHLANDS_AREA = 390; MAP_OF_KING_RANPERRES_TOMB = 391; MAP_OF_THE_DANGRUF_WADI = 392; MAP_OF_THE_HORUTOTO_RUINS = 393; MAP_OF_BOSTAUNIEUX_OUBLIETTE = 394; MAP_OF_THE_ZERUHN_MINES = 395; MAP_OF_THE_TORAIMARAI_CANAL = 396; MAP_OF_ORDELLES_CAVES = 397; MAP_OF_THE_GUSGEN_MINES = 398; MAP_OF_THE_MAZE_OF_SHAKHRAMI = 399; MAP_OF_THE_ELDIEME_NECROPOLIS = 400; MAP_OF_THE_CRAWLERS_NEST = 401; MAP_OF_THE_GARLAIGE_CITADEL = 402; MAP_OF_THE_RANGUEMONT_PASS = 403; MAP_OF_GHELSBA = 404; MAP_OF_DAVOI = 405; MAP_OF_THE_PALBOROUGH_MINES = 406; MAP_OF_BEADEAUX = 407; MAP_OF_GIDDEUS = 408; MAP_OF_CASTLE_OZTROJA = 409; MAP_OF_DELKFUTTS_TOWER = 410; MAP_OF_FEIYIN = 411; MAP_OF_CASTLE_ZVAHL = 412; MAP_OF_THE_ELSHIMO_REGIONS = 413; MAP_OF_THE_KUZOTZ_REGION = 414; MAP_OF_THE_LITELOR_REGION = 415; MAP_OF_THE_RUAUN_GARDENS = 416; MAP_OF_NORG = 417; MAP_OF_THE_TEMPLE_OF_UGGALEPIH = 418; MAP_OF_THE_DEN_OF_RANCOR = 419; MAP_OF_THE_KORROLOKA_TUNNEL = 420; MAP_OF_THE_KUFTAL_TUNNEL = 421; MAP_OF_THE_BOYAHDA_TREE = 422; MAP_OF_THE_VELUGANNON_PALACE = 423; MAP_OF_IFRITS_CAULDRON = 424; MAP_OF_THE_QUICKSAND_CAVES = 425; MAP_OF_THE_SEA_SERPENT_GROTTO = 426; MAP_OF_THE_VOLLBOW_REGION = 427; MAP_OF_THE_LABYRINTH_OF_ONZOZO = 428; MAP_OF_CARPENTERS_LANDING = 429; MAP_OF_BIBIKI_BAY = 430; MAP_OF_THE_ULEGUERAND_RANGE = 431; MAP_OF_THE_ATTOHWA_CHASM = 432; MAP_OF_PSOXJA = 433; MAP_OF_OLDTON_MOVALPOLOS = 434; MAP_OF_NEWTON_MOVALPOLOS = 435; MAP_OF_PROMYVION_HOLLA = 436; MAP_OF_PROMYVION_DEM = 437; MAP_OF_PROMYVION_MEA = 438; MAP_OF_PROMYVION_VAHZL = 439; MAP_OF_TAVNAZIA = 440; MAP_OF_THE_AQUEDUCTS = 441; MAP_OF_THE_SACRARIUM = 442; MAP_OF_CAPE_RIVERNE = 443; MAP_OF_ALTAIEU = 444; MAP_OF_HUXZOI = 445; MAP_OF_RUHMET = 446; MAP_OF_DIO_ABDHALJS_GHELSBA = 447; DAZEBREAKER_CHARM = 448; SHINY_EARRING = 449; CARBUNCLES_TEAR = 450; SCRAP_OF_PAPYRUS = 451; CERULEAN_CRYSTAL = 452; HANDFUL_OF_CRYSTAL_SCALES = 453; CHARRED_HELM = 454; SHARD_OF_APATHY = 455; SHARD_OF_ARROGANCE = 456; SHARD_OF_COWARDICE = 457; SHARD_OF_ENVY = 458; SHARD_OF_RAGE = 459; TRICK_BOX = 460; WASHUS_TASTY_WURST = 461; YOMOTSU_FEATHER = 462; YOMOTSU_HIRASAKA = 463; FADED_YOMOTSU_HIRASAKA = 464; SEANCE_STAFF = 465; SMILING_STONE = 466; SCOWLING_STONE = 467; SOMBER_STONE = 468; SPIRITED_STONE = 469; OLD_TRICK_BOX = 470; LARGE_TRICK_BOX = 471; INDIGESTED_STALAGMITE = 472; INDIGESTED_ORE = 473; INDIGESTED_MEAT = 474; LETTER_FROM_ZONPAZIPPA = 475; MOONDROP = 476; MIRACLESALT = 477; ANCIENT_VERSE_OF_ROMAEVE = 478; ANCIENT_VERSE_OF_ALTEPA = 479; ANCIENT_VERSE_OF_UGGALEPIH = 480; FIGURE_OF_LEVIATHAN = 481; FIGURE_OF_GARUDA = 482; FIGURE_OF_TITAN = 483; DARK_MANA_ORB = 484; MOONGATE_PASS = 485; HYDRA_CORPS_COMMAND_SCEPTER = 486; HYDRA_CORPS_EYEGLASS = 487; HYDRA_CORPS_LANTERN = 488; HYDRA_CORPS_TACTICAL_MAP = 489; HYDRA_CORPS_INSIGNIA = 490; HYDRA_CORPS_BATTLE_STANDARD = 491; VIAL_OF_SHROUDED_SAND = 492; DIARY_OF_MUKUNDA = 493; LETTER_TO_THE_BAS_CONFLICT_CMD1 = 494; LETTER_TO_THE_WIN_CONFLICT_CMD1 = 495; LETTER_TO_THE_SAN_CONFLICT_CMD1 = 496; LETTER_TO_THE_WIN_CONFLICT_CMD2 = 497; LETTER_TO_THE_SAN_CONFLICT_CMD2 = 498; LETTER_TO_THE_BAS_CONFLICT_CMD2 = 499; BALLISTA_EARRING = 500; DRAWING_OF_A_MALE_HUME = 501; DRAWING_OF_A_FEMALE_HUME = 502; DRAWING_OF_A_MALE_ELVAAN = 503; DRAWING_OF_A_FEMALE_ELVAAN = 504; DRAWING_OF_A_MALE_TARUTARU = 505; DRAWING_OF_A_FEMALE_TARUTARU = 506; DRAWING_OF_A_MITHRA = 507; DRAWING_OF_A_GALKA = 508; YE_OLDE_MANNEQUIN_CATALOGUE = 509; MANNEQUIN_JOINT_DIAGRAMS = 510; CLAMMING_KIT = 511; MOGHANCEMENT_FIRE = 512; MOGHANCEMENT_ICE = 513; MOGHANCEMENT_WIND = 514; MOGHANCEMENT_EARTH = 515; MOGHANCEMENT_LIGHTNING = 516; MOGHANCEMENT_WATER = 517; MOGHANCEMENT_LIGHT = 518; MOGHANCEMENT_DARK = 519; MOGHANCEMENT_EXPERIENCE = 520; MOGHANCEMENT_GARDENING = 521; MOGHANCEMENT_DESYNTHESIS = 522; MOGHANCEMENT_FISHING = 523; MOGHANCEMENT_WOODWORKING = 524; MOGHANCEMENT_SMITHING = 525; MOGHANCEMENT_GOLDSMITHING = 526; MOGHANCEMENT_CLOTHCRAFT = 527; MOGHANCEMENT_LEATHERCRAFT = 528; MOGHANCEMENT_BONECRAFT = 529; MOGHANCEMENT_ALCHEMY = 530; MOGHANCEMENT_COOKING = 531; MOGHANCEMENT_CONQUEST = 532; MOGHANCEMENT_REGION = 533; MOGHANCEMENT_FISHINGITEMS = 534; MOGHANCEMENT_SAN_CONQUEST = 535; MOGHANCEMENT_BAS_CONQUEST = 536; MOGHANCEMENT_WIN_CONQUEST = 537; MOGHANCEMENT_MONEY = 538; MOGHANCEMENT_CAMPAIGN = 539; MOGLIFICATION_FISHING = 544; MOGLIFICATION_WOODWORKING = 545; MOGLIFICATION_SMITHING = 546; MOGLIFICATION_GOLDSMITHING = 547; MOGLIFICATION_CLOTHCRAFT = 548; MOGLIFICATION_LEATHERCRAFT = 549; MOGLIFICATION_BONECRAFT = 550; MOGLIFICATION_ALCHEMY = 551; MOGLIFICATION_COOKING = 552; MEGA_MOGLIFICATION_FISHING = 553; MEGA_MOGLIFICATION_WOODWORK = 554; MEGA_MOGLIFICATION_SMITHING = 555; MEGA_MOGLIFICATION_GOLDSMITH = 556; MEGA_MOGLIFICATION_CLOTHCRAFT = 557; MEGA_MOGLIFICATION_LEATHRCRFT = 558; MEGA_MOGLIFICATION_BONECRAFT = 559; MEGA_MOGLIFICATION_ALCHEMY = 560; MEGA_MOGLIFICATION_COOKING = 561; BALLISTA_LICENSE = 576; BALLISTA_INSTAWARP = 577; BALLISTA_INSTAPORT = 578; MYSTERIOUS_AMULET = 579; MYSTERIOUS_AMULET_DRAINED = 580; CRACKED_MIMEO_MIRROR = 581; RELIQUIARIUM_KEY = 582; MIMEO_STONE = 583; MYSTIC_ICE = 584; KEY_ITEM585 = 585; MIMEO_JEWEL = 586; MIMEO_FEATHER = 587; SECOND_MIMEO_FEATHER = 588; THIRD_MIMEO_FEATHER = 589; LIGHT_OF_HOLLA = 590; LIGHT_OF_DEM = 591; LIGHT_OF_MEA = 592; LIGHT_OF_VAHZL = 593; LIGHT_OF_ALTAIEU = 594; BLUE_BRACELET = 595; GREEN_BRACELET = 596; DUSTY_TOME = 597; POINTED_JUG = 598; CRACKED_CLUB = 599; PEELING_HAIRPIN = 600; OLD_NAMETAG = 601; TINY_WRISTLET = 602; WHISPERING_CONCH = 603; PSOXJA_PASS = 604; PIECE_OF_RIPPED_FLOORPLANS = 605; LIMIT_BREAKER = 606; HYPER_ALTIMETER = 607; MOLYBDENUM_BOX = 608; ALABASTER_HAIRPIN = 609; DAWN_TALISMAN = 610; SILVER_COMETS_COLLAR = 611; ENVELOPE_FROM_MONBERAUX = 612; DELKFUTT_RECOGNITION_DEVICE = 613; DEED_TO_PURGONORGO_ISLE = 614; PHOENIX_ARMLET = 615; PHOENIX_PEARL = 616; MANACLIPPER_TICKET = 617; BARGE_TICKET = 618; ALLYOUCANRIDEPASS = 619; TAVNAZIAN_ARCHIPELAGO_SUPPLIES = 620; RIVERNEWORT = 621; TAVNAZIAN_COOKBOOK = 622; WASHUS_FLASK = 623; FLASK_OF_CLAM_WATER = 624; PUNGENT_PROVIDENCE_POT = 625; TORN_OUT_PAGES = 626; TONBERRY_BLACKBOARD = 627; LETTER_FROM_MUCKVIX = 628; LETTER_FROM_MAGRIFFON = 629; PROVIDENCE_POT = 630; CARE_PACKAGE = 631; GLITTERING_FRAGMENT = 632; STOREROOM_KEY = 633; ZEELOZOKS_EARPLUG = 634; POTION_VOUCHER = 635; HIPOTION_VOUCHER = 636; XPOTION_VOUCHER = 637; ETHER_VOUCHER = 638; HIETHER_VOUCHER = 639; SUPER_ETHER_VOUCHER = 640; ELIXER_VOUCHER = 641; REVITALIZER_VOUCHER = 642; BODY_BOOST_VOUCHER = 643; MANA_BOOST_VOUCHER = 644; DRACHENESSENCE_VOUCHER = 645; BARFIRE_OINTMENT_VOUCHER = 646; BARBLIZZARD_OINTMENT_VOUCHER = 647; BARAERO_OINTMENT_VOUCHER = 648; BARSTONE_OINTMENT_VOUCHER = 649; BARTHUNDER_OINTMENT_VOUCHER = 650; BARWATER_OINTMENT_VOUCHER = 651; BARGE_MULTITICKET = 652; MANACLIPPER_MULTITICKET = 653; FIGHTERS_ARMOR_CLAIM_SLIP = 654; TEMPLE_ATTIRE_CLAIM_SLIP = 655; HEALERS_ATTIRE_CLAIM_SLIP = 656; WIZARDS_ATTIRE_CLAIM_SLIP = 657; WARLOCKS_ARMOR_CLAIM_SLIP = 658; ROGUES_ATTIRE_CLAIM_SLIP = 659; GALLANT_ARMOR_CLAIM_SLIP = 660; CHAOS_ARMOR_CLAIM_SLIP = 661; BEAST_ARMOR_CLAIM_SLIP = 662; CHORAL_ATTIRE_CLAIM_SLIP = 663; HUNTERS_ATTIRE_CLAIM_SLIP = 664; MYOCHIN_ARMOR_CLAIM_SLIP = 665; NINJAS_GARB_CLAIM_SLIP = 666; DRACHEN_ARMOR_CLAIM_SLIP = 667; EVOKERS_ATTIRE_CLAIM_SLIP = 668; VESSEL_OF_LIGHT = 669; CENSER_OF_ABANDONMENT = 670; CENSER_OF_ANTIPATHY = 671; CENSER_OF_ANIMUS = 672; CENSER_OF_ACRIMONY = 673; MONARCH_BEARD = 674; ASTRAL_COVENANT = 675; SHAFT_2716_OPERATING_LEVER = 676; ZEPHYR_FAN = 677; MIASMA_FILTER = 678; PARTICULARLY_POIGNANT_PETAL = 679; ANTIQUE_AMULET = 680; CATHEDRAL_MEDALLION = 681; GOLD_BALLISTA_CHEVRON = 682; MYTHRIL_BALLISTA_CHEVRON = 683; SILVER_BALLISTA_CHEVRON = 684; BRONZE_BALLISTA_CHEVRON = 685; BLOODY_BALLISTA_CHEVRON = 686; ORANGE_BALLISTA_CHEVRON = 687; WHITE_BALLISTA_CHEVRON = 688; BLACK_BALLISTA_CHEVRON = 689; RED_BALLISTA_CHEVRON = 690; GREEN_BALLISTA_CHEVRON = 691; SPARKING_BALLISTA_CHEVRON = 692; EBON_BALLISTA_CHEVRON = 693; FURRY_BALLISTA_CHEVRON = 694; BROWN_BALLISTA_CHEVRON = 695; OCHRE_BALLISTA_CHEVRON = 696; JADE_BALLISTA_CHEVRON = 697; TRANSPARENT_BALLISTA_CHEVRON = 698; PURPLE_BALLISTA_CHEVRON = 699; RAINBOW_BALLISTA_CHEVRON = 700; LETTERS_FROM_ULMIA_AND_PRISHE = 701; PETRA_EATER_VOUCHER = 702; CATHOLICON_VOUCHER = 703; RED_OIL = 704; MARBLE_BRIDGE_COASTER = 705; LAMP_LIGHTERS_MEMBERSHIP_CARD = 706; SHAFT_GATE_OPERATING_DIAL = 707; MYSTERIOUS_AMULET = 708; MIRE_INCENSE = 709; BRAND_OF_DAWN = 710; BRAND_OF_TWILIGHT = 711; ORNAMENTED_SCROLL = 712; BETTER_HUMES_AND_MANNEQUINS = 713; PETRA_SHOVEL = 714; CALIGINOUS_BLADE = 715; TEAR_OF_ALTANA = 716; BALLISTA_BAND = 717; SHADED_CRUSE = 718; LETTER_FROM_SHIKAREE_X = 719; MONARCH_LINN_PATROL_PERMIT = 720; LETTER_FROM_SHIKAREE_Y = 721; LETTER_FROM_THE_MITHRAN_TRACKER = 722; COMMUNICATION_FROM_TZEE_XICU = 723; ORCISH_SEEKER_BATS = 724; VAULT_QUIPUS = 725; GOBLIN_RECOMMENDATION_LETTER = 726; COSTUME_KIT = 727; JAR_OF_REVERSION_DUST = 728; REMEDY_VOUCHER = 729; PANACEA_VOUCHER = 730; SMELLING_SALTS_VOUCHER = 731; VITRALLUM = 732; OPALESCENT_STONE = 733; COSMOCLEANSE = 734; OLD_WOMANS_PORTRAIT = 735; GLIMMERING_MICA = 736; MISTROOT = 737; LUNASCENT_LOG = 738; DYNAMIS_VALKURM_SLIVER = 739; DYNAMIS_BUBURIMU_SLIVER = 740; DYNAMIS_QUFIM_SLIVER = 741; DYNAMIS_TAVNAZIA_SLIVER = 742; RED_SENTINEL_BADGE = 743; BLUE_SENTINEL_BADGE = 744; GREEN_SENTINEL_BADGE = 745; WHITE_SENTINEL_BADGE = 746; EYE_OF_FLAMES = 747; EYE_OF_TREMORS = 748; EYE_OF_TIDES = 749; EYE_OF_GALES = 750; EYE_OF_FROST = 751; EYE_OF_STORMS = 752; RED_INVITATION_CARD = 753; BLUE_INVITATION_CARD = 754; GREEN_INVITATION_CARD = 755; WHITE_INVITATION_CARD = 756; HEALING_POWDER_VOUCHER = 757; BRENNER_SHOVEL = 758; BRENNER_BAND = 759; SILVER_SEA_FERRY_TICKET = 760; MOONLIGHT_ORE = 761; LEUJAOAM_ASSAULT_ORDERS = 762; MAMOOL_JA_ASSAULT_ORDERS = 763; LEBROS_ASSAULT_ORDERS = 764; PERIQIA_ASSAULT_ORDERS = 765; ILRUSI_ASSAULT_ORDERS = 766; DKHAAYAS_RESEARCH_JOURNAL = 767; ELECTROCELL = 768; ELECTROPOT = 769; ELECTROLOCOMOTIVE = 770; MARK_OF_ZAHAK = 771; VIAL_OF_LUMINOUS_WATER = 772; IMAGE_RECORDER = 773; CAST_METAL_PLATE = 774; SUPPLIES_PACKAGE = 775; RAINBOW_BERRY = 776; SAPPHIRE_BALLISTA_CHEVRON = 777; CORAL_BALLISTA_CHEVRON = 778; SILK_BALLISTA_CHEVRON = 779; PSC_WILDCAT_BADGE = 780; BOARDING_PERMIT = 781; RUNIC_PORTAL_USE_PERMIT = 782; PFC_WILDCAT_BADGE = 783; SP_WILDCAT_BADGE = 784; RAILLEFALS_LETTER = 785; EPHRAMADIAN_GOLD_COIN = 786; IMPERIAL_ARMY_ID_TAG = 787; RAILLEFALS_NOTE = 788; DARK_RIDER_HOOFPRINT = 789; BAG_OF_GOLD_PIECES = 790; FORGOTTEN_HEXAGUN = 791; PLASMA_OIL = 792; PLASMA_ROCK = 793; LC_WILDCAT_BADGE = 794; C_WILDCAT_BADGE = 795; POT_OF_TSETSEROONS_STEW = 796; ASSAULT_ARMBAND = 797; ANTIQUE_AUTOMATON = 798; RED_BELL = 799; BLUE_BELL = 800; MUSICAL_SCORE_1ST_PAGE = 801; MUSICAL_SCORE_2ND_PAGE = 802; MERROW_HOMUNCULUS = 803; LAMIA_HOMUNCULUS = 804; MUNAHDAS_PACKAGE = 805; WHITE_HANDKERCHIEF = 806; CONFIDENTIAL_IMPERIAL_ORDER = 807; SECRET_IMPERIAL_ORDER = 808; HANDKERCHIEF = 809; DIRTY_HANDKERCHIEF = 810; REPLAY_DEBUGGER = 811; ASTRAL_COMPASS = 812; VIAL_OF_SPECTRAL_SCENT = 813; EMPTY_TEST_TUBE_1 = 814; EMPTY_TEST_TUBE_2 = 815; EMPTY_TEST_TUBE_3 = 816; EMPTY_TEST_TUBE_4 = 817; EMPTY_TEST_TUBE_5 = 818; TEST_TUBE_1 = 819; TEST_TUBE_2 = 820; TEST_TUBE_3 = 821; TEST_TUBE_4 = 822; TEST_TUBE_5 = 823; QUARTZ_TRANSMITTER = 824; S_WILDCAT_BADGE = 825; SM_WILDCAT_BADGE = 826; CS_WILDCAT_BADGE = 827; CHUNK_OF_GLITTERING_ORE = 828; BRAND_OF_THE_SPRINGSERPENT = 829; BRAND_OF_THE_GALESERPENT = 830; BRAND_OF_THE_FLAMESERPENT = 831; BRAND_OF_THE_SKYSERPENT = 832; BRAND_OF_THE_STONESERPENT = 833; MAGUS_ORDER_SLIP = 834; SEALED_IMMORTAL_ENVELOPE = 835; STORY_OF_AN_IMPATIENT_CHOCOBO = 837; STORY_OF_A_CURIOUS_CHOCOBO = 838; STORY_OF_A_WORRISOME_CHOCOBO = 839; STORY_OF_A_YOUTHFUL_CHOCOBO = 840; STORY_OF_A_HAPPY_CHOCOBO = 841; MAMOOL_JA_MANDATE = 842; VALKENGS_MEMORY_CHIP = 843; TOGGLE_SWITCH = 844; LELEROONS_LETTER_GREEN = 845; LELEROONS_LETTER_BLUE = 846; LELEROONS_LETTER_RED = 847; LIFE_FLOAT = 848; WHEEL_LOCK_TRIGGER = 849; STORY_OF_A_DILIGENT_CHOCOBO = 850; PRAIRIE_CHOCOGRAPH = 851; BUSH_CHOCOGRAPH = 852; LETTER_FROM_BERNAHN = 853; REMNANTS_PERMIT = 854; LILAC_RIBBON = 855; COASTAL_CHOCOGRAPH = 856; DUNE_CHOCOGRAPH = 857; JUNGLE_CHOCOGRAPH = 858; DESERT_CHOCOGRAPH = 859; PERIQIA_ASSAULT_AREA_ENTRY_PERMIT = 860; WARRIORS_ARMOR_CLAIM_SLIP = 861; MELEE_ATTIRE_CLAIM_SLIP = 862; CLERICS_ATTIRE_CLAIM_SLIP = 863; SORCERERS_ATTIRE_CLAIM_SLIP = 864; DUELISTS_ARMOR_CLAIM_SLIP = 865; ASSASSINS_ATTIRE_CLAIM_SLIP = 866; VALOR_ARMOR_CLAIM_SLIP = 867; ABYSS_ARMOR_CLAIM_SLIP = 868; MONSTER_ARMOR_CLAIM_SLIP = 869; BARDS_ATTIRE_CLAIM_SLIP = 870; SCOUTS_ATTIRE_CLAIM_SLIP = 871; SAOTOME_ARMOR_CLAIM_SLIP = 872; KOGA_GARB_CLAIM_SLIP = 873; WYRM_ARMOR_CLAIM_SLIP = 874; SUMMONERS_ATTIRE_CLAIM_SLIP = 875; SCOURSHROOM = 876; PERCIPIENT_EYE = 877; NYZUL_ISLE_ASSAULT_ORDERS = 878; RUNIC_DISC = 879; RUNIC_KEY = 880; GYSAHL_MEDAL = 881; ROSSWEISSES_FEATHER = 882; GRIMGERDES_FEATHER = 883; SIEGRUNES_FEATHER = 884; HELMWIGES_FEATHER = 885; SCHWERTLEITES_FEATHER = 886; WALTRAUTES_FEATHER = 887; ORTLINDES_FEATHER = 888; GERHILDES_FEATHER = 889; BRUNHILDES_FEATHER = 890; MARK_OF_THE_EINHERJAR = 891; PHOTOPTICATOR = 892; LUMINIAN_DAGGER = 893; SL_WILDCAT_BADGE = 894; BIYAADAS_LETTER = 895; OFFICER_ACADEMY_MANUAL = 896; ALLIED_COUNCIL_SUMMONS = 897; NYZUL_ISLE_ROUTE = 898; MYTHRIL_MIRROR = 899; FL_WILDCAT_BADGE = 900; CHOCOBO_CIRCUIT_GRANDSTAND_PASS = 908; CAPTAIN_WILDCAT_BADGE = 909; PURE_WHITE_FEATHER = 910; STARDUST_PEBBLE = 911; LEFT_MAP_PIECE = 912; MIDDLE_MAP_PIECE = 913; RIGHT_MAP_PIECE = 914; SEQUINED_BALLISTA_CHEVRON = 915; VELVET_BALLISTA_CHEVRON = 916; BATTLE_RATIONS = 917; CLUMP_OF_ANIMAL_HAIR = 918; XHIFHUT = 919; WARNING_LETTER = 920; RED_RECOMMENDATION_LETTER = 921; BLUE_RECOMMENDATION_LETTER = 922; GREEN_RECOMMENDATION_LETTER = 923; BRONZE_RIBBON_OF_SERVICE = 924; BRASS_RIBBON_OF_SERVICE = 925; ALLIED_RIBBON_OF_BRAVERY = 926; ALLIED_RIBBON_OF_GLORY = 927; BRONZE_STAR = 928; STERLING_STAR = 929; MYTHRIL_STAR = 930; GOLDEN_STAR = 931; COPPER_EMBLEM_OF_SERVICE = 932; IRON_EMBLEM_OF_SERVICE = 933; STEELKNIGHT_EMBLEM = 934; HOLYKNIGHT_EMBLEM = 935; BRASS_WINGS_OF_SERVICE = 936; MYTHRIL_WINGS_OF_SERVICE = 937; WINGS_OF_INTEGRITY = 938; WINGS_OF_HONOR = 939; STARLIGHT_MEDAL = 940; MOONLIGHT_MEDAL = 941; DAWNLIGHT_MEDAL = 942; MEDAL_OF_ALTANA = 943; SLICED_POLE = 944; SUPPLY_ORDER = 945; GRIMOIRE = 946; ZONPAZIPPAS_ALLPURPOSE_PUTTY = 947; SCOOPDEDICATED_LINKPEARL = 948; FIREPOWER_CASE = 949; CHARRED_PROPELLER = 950; PIECE_OF_SHATTERED_LUMBER = 951; OXIDIZED_PLATE = 952; PIECE_OF_KIONITE = 953; RANPIMONPI_SPECIALTY = 954; CULINARY_KNIFE = 955; FIREBLOSSOM = 956; THE_HEALING_HERB = 957; SMALL_STARFRUIT = 958; INKY_BLACK_YAGUDO_FEATHER = 959; CAMPAIGN_SUPPLIES = 960; MINE_SHAFT_KEY = 961; THE_ESSENCE_OF_DANCE = 962; JUGNER_GATE_CRYSTAL = 963; PASHHOW_GATE_CRYSTAL = 964; MERIPHATAUD_GATE_CRYSTAL = 965; VUNKERL_HERB = 966; VUNKERL_HERB_MEMO = 967; EVIL_WARDING_SEAL = 968; ORNATE_PACKAGE = 969; SHEAF_OF_HANDMADE_INCENSE = 970; LEATHERBOUND_BOOK = 971; LYNX_PELT = 972; WYATTS_PROPOSAL = 973; FORT_KEY = 974; ULBRECHTS_SEALED_LETTER = 975; SCHULTS_SEALED_LETTER = 976; UNADDRESSED_SEALED_LETTER = 977; PORTING_MAGIC_TRANSCRIPT = 978; SAMPLE_OF_GRAUBERG_CHERT = 979; DROGAROGAN_BONEMEAL = 980; SLUG_MUCUS = 981; DJINN_EMBER = 982; RAFFLESIA_DREAMSPIT = 983; PEISTE_DUNG = 984; ULBRECHTS_MORTARBOARD = 985; BEASTMEN_CONFEDERATE_CRATE = 986; MILITARY_SCRIP = 987; SILVERMINE_KEY = 988; RED_PRIZE_BALLOON = 989; BLUE_PRIZE_BALLOON = 990; GREEN_PRIZE_BALLOON = 991; TRAVONCES_ESCORT_AWARD = 992; KENS_ESCORT_AWARD = 993; EMPTINESS_INVESTIGATION_NOTE = 994; TIGRIS_STONE = 995; DIAMOND_SEAL = 996; XICUS_ROSARY = 997; MAROON_SEAL = 998; APPLE_GREEN_SEAL = 999; CHARCOAL_GREY_SEAL = 1000; DEEP_PURPLE_SEAL = 1001; CHESTNUT_COLORED_SEAL = 1002; LILAC_COLORED_SEAL = 1003; CERISE_SEAL = 1004; SALMON_COLORED_SEAL = 1005; PURPLISH_GREY_SEAL = 1006; GOLD_COLORED_SEAL = 1007; COPPER_COLORED_SEAL = 1008; BRIGHT_BLUE_SEAL = 1009; PINE_GREEN_SEAL = 1010; AMBER_COLORED_SEAL = 1011; FALLOW_COLORED_SEAL = 1012; TAUPE_COLORED_SEAL = 1013; SIENNA_COLORED_SEAL = 1014; LAVENDER_COLORED_SEAL = 1015; SICKLEMOON_SALT = 1016; SILVER_SEA_SALT = 1017; CYAN_DEEP_SALT = 1018; ORCISH_WARMACHINE_BODY = 1019; PAPAROONS_SEALED_INVITATION = 1020; DATA_ANALYZER_AND_LOGGER_EX = 1021; MAYAKOV_SHOW_TICKET = 1022; SERPENTKING_ZAHAK_RELIEF = 1023; SAKURA_RACING_BADGE = 1024; SERPENTKING_ZAHAK_RELIEF_SHARD = 1025; IMPERIAL_LINEAGE_CHAPTER_I = 1026; IMPERIAL_LINEAGE_CHAPTER_II = 1027; IMPERIAL_LINEAGE_CHAPTER_III = 1028; IMPERIAL_LINEAGE_CHAPTER_IV = 1029; IMPERIAL_LINEAGE_CHAPTER_V = 1030; IMPERIAL_LINEAGE_CHAPTER_VI = 1031; IMPERIAL_LINEAGE_CHAPTER_VII = 1032; IMPERIAL_LINEAGE_CHAPTER_VIII = 1033; THE_WORDS_OF_DONHU_I = 1034; THE_WORDS_OF_DONHU_II = 1035; THE_WORDS_OF_DONHU_III = 1036; THE_WORDS_OF_DONHU_IV = 1037; THE_WORDS_OF_DONHU_V = 1038; THE_WORDS_OF_DONHU_VI = 1039; THE_WORDS_OF_DONHU_VII = 1040; THE_WORDS_OF_DONHU_VIII = 1041; HABALOS_ECLOGUE_VERSE_I = 1042; HABALOS_ECLOGUE_VERSE_II = 1043; HABALOS_ECLOGUE_VERSE_III = 1044; HABALOS_ECLOGUE_VERSE_IV = 1045; HABALOS_ECLOGUE_VERSE_V = 1046; HABALOS_ECLOGUE_VERSE_VI = 1047; HABALOS_ECLOGUE_VERSE_VII = 1048; HABALOS_ECLOGUE_VERSE_VIII = 1049; SIGNAL_FIRECRACKER = 1050; NUMBER_EIGHT_SHELTER_KEY = 1051; TORN_PATCHES_OF_LEATHER = 1052; REPAIRED_HANDBAG = 1053; MIRAGE_ATTIRE_CLAIM_SLIP = 1054; COMMODORE_ATTIRE_CLAIM_SLIP = 1055; PANTIN_ATTIRE_CLAIM_SLIP = 1056; ETOILE_ATTIRE_CLAIM_SLIP = 1057; ARGUTE_ATTIRE_CLAIM_SLIP = 1058; ARGENT_ATTIRE_CLAIM_SLIP = 1059; CONQUEST_PROMOTION_VOUCHER = 1060; CERNUNNOS_RESIN = 1061; COUNT_BORELS_LETTER = 1062; UNDERPASS_HATCH_KEY = 1063; BOTTLE_OF_TREANT_TONIC = 1064; TIMBER_SURVEY_CHECKLIST = 1065; SNOWTHEMED_GIFT_TOKEN = 1066; STARTHEMED_GIFT_TOKEN = 1067; BELLTHEMED_GIFT_TOKEN = 1068; FLARE_GRENADE = 1069; RONFAURE_MAPLE_SYRUP = 1070; LONGLIFE_BISCUITS = 1071; FLASK_OF_KINGDOM_WATER = 1072; BISCUIT_A_LA_RHOLONT = 1073; LETTER_TO_COUNT_AURCHIAT = 1074; LENGTH_OF_JUGNER_IVY = 1075; DARKFIRE_CINDER = 1076; FLOELIGHT_STONE = 1077; LIQUID_QUICKSILVER = 1078; GELID_SULFUR = 1079; BEASTBANE_BULLETS = 1080; GLEIPNIR = 1081; SCINTILLANT_STRAND = 1082; REFULGENT_STRAND = 1083; IRRADIANT_STRAND = 1084; BOWL_OF_BLAND_GOBLIN_SALAD = 1085; JUG_OF_GREASY_GOBLIN_JUICE = 1086; CHUNK_OF_SMOKED_GOBLIN_GRUB = 1087; SEEDSPALL_ROSEUM = 1088; SEEDSPALL_CAERULUM = 1089; SEEDSPALL_VIRIDIS = 1090; MARK_OF_SEED = 1091; AMICITIA_STONE = 1092; VERITAS_STONE = 1093; SAPIENTIA_STONE = 1094; SANCTITAS_STONE = 1095; FELICITAS_STONE = 1096; DIVITIA_STONE = 1097; STUDIUM_STONE = 1098; AMORIS_STONE = 1099; CARITAS_STONE = 1100; CONSTANTIA_STONE = 1101; SPEI_STONE = 1102; SALUS_STONE = 1103; OMNIS_STONE = 1104; CRIMSON_KEY = 1105; VIRIDIAN_KEY = 1106; AMBER_KEY = 1107; AZURE_KEY = 1108; IVORY_KEY = 1109; EBON_KEY = 1110; DELKFUTT_KEY = 1111; BEASTBANE_ARROWHEADS = 1112; RED_LABELED_CRATE = 1113; BLUE_LABELED_CRATE = 1114; GREEN_LABELED_CRATE = 1115; ELITE_TRAINING_INTRODUCTION = 1116; ELITE_TRAINING_CHAPTER_1 = 1117; ELITE_TRAINING_CHAPTER_2 = 1118; ELITE_TRAINING_CHAPTER_3 = 1119; ELITE_TRAINING_CHAPTER_4 = 1120; ELITE_TRAINING_CHAPTER_5 = 1121; ELITE_TRAINING_CHAPTER_6 = 1122; ELITE_TRAINING_CHAPTER_7 = 1123; UNADORNED_RING = 1124; MOG_KUPON_A_DBCD = 1125; MOG_KUPON_A_DXAR = 1126; PRISMATIC_KEY = 1127; SHADOW_BUG = 1128; WHITE_CORAL_KEY = 1129; BLUE_CORAL_KEY = 1130; PEACH_CORAL_KEY = 1131; BLACK_CORAL_KEY = 1132; RED_CORAL_KEY = 1133; ANGEL_SKIN_KEY = 1134; OXBLOOD_KEY = 1135; STURDY_METAL_STRIP = 1136; PIECE_OF_RUGGED_TREE_BARK = 1137; SAVORY_LAMB_ROAST = 1138; ORB_OF_SWORDS = 1139; ORB_OF_CUPS = 1140; ORB_OF_BATONS = 1141; ORB_OF_COINS = 1142; RIPE_STARFRUIT = 1143; MOLDY_WORMEATEN_CHEST = 1144; STONE_OF_SURYA = 1145; STONE_OF_CHANDRA = 1146; STONE_OF_MANGALA = 1147; STONE_OF_BUDHA = 1148; STONE_OF_BRIHASPATI = 1149; STONE_OF_SHUKRA = 1150; STONE_OF_SHANI = 1151; STONE_OF_RAHU = 1152; STONE_OF_KETU = 1153; TRIVIA_CHALLENGE_KUPON = 1154; GAUNTLET_CHALLENGE_KUPON = 1155; FESTIVAL_SOUVENIR_KUPON = 1156; POCKET_MOGBOMB = 1157; NAVARATNA_TALISMAN = 1158; MEGA_BONANZA_KUPON = 1159; AROMA_BUG = 1160; UMBRA_BUG = 1161; NORTHBOUND_PETITION = 1162; PONONOS_CHARM = 1163; DELICATE_WOOL_THREAD = 1164; DELICATE_LINEN_THREAD = 1165; DELICATE_COTTON_THREAD = 1166; ENCHANTED_WOOL_THREAD = 1167; ENCHANTED_LINEN_THREAD = 1168; ENCHANTED_COTTON_THREAD = 1169; WAX_SEAL = 1170; SACK_OF_VICTUALS = 1171; COMMANDERS_ENDORSEMENT = 1172; SUCCULENT_DRAGON_FRUIT = 1173; SHARD_OF_OPTISTONE = 1174; SHARD_OF_AURASTONE = 1175; SHARD_OF_ORASTONE = 1176; PROSPECTORS_PAN = 1177; CORKED_AMPOULE = 1178; AMPOULE_OF_GOLD_DUST = 1179; VIAL_OF_MILITARY_PRISM_POWDER = 1180; LANCE_FISH = 1181; PALADIN_LOBSTER = 1182; SCUTUM_CRAB = 1183; MOOGLE_KEY = 1184; BIRD_KEY = 1185; CACTUAR_KEY = 1186; BOMB_KEY = 1187; CHOCOBO_KEY = 1188; TONBERRY_KEY = 1189; BEHEMOTH_KEY = 1190; DOMINAS_SCARLET_SEAL = 1191; DOMINAS_CERULEAN_SEAL = 1192; DOMINAS_EMERALD_SEAL = 1193; DOMINAS_AMBER_SEAL = 1194; DOMINAS_VIOLET_SEAL = 1195; DOMINAS_AZURE_SEAL = 1196; SCARLET_COUNTERSEAL = 1197; CERULEAN_COUNTERSEAL = 1198; EMERALD_COUNTERSEAL = 1199; AMBER_COUNTERSEAL = 1200; VIOLET_COUNTERSEAL = 1201; AZURE_COUNTERSEAL = 1202; BLACK_BOOK = 1203; LUMINOUS_RED_FRAGMENT = 1204; LUMINOUS_BEIGE_FRAGMENT = 1205; LUMINOUS_GREEN_FRAGMENT = 1206; LUMINOUS_YELLOW_FRAGMENT = 1207; LUMINOUS_PURPLE_FRAGMENT = 1208; LUMINOUS_BLUE_FRAGMENT = 1209; FIRE_SAP_CRYSTAL = 1210; WATER_SAP_CRYSTAL = 1211; WIND_SAP_CRYSTAL = 1212; EARTH_SAP_CRYSTAL = 1213; LIGHTNING_SAP_CRYSTAL = 1214; ICE_SAP_CRYSTAL = 1215; LIGHT_SAP_CRYSTAL = 1216; DARK_SAP_CRYSTAL = 1217; TABLET_OF_HEXES_GREED = 1218; TABLET_OF_HEXES_ENVY = 1219; TABLET_OF_HEXES_MALICE = 1220; TABLET_OF_HEXES_DECEIT = 1221; TABLET_OF_HEXES_PRIDE = 1222; TABLET_OF_HEXES_BALE = 1223; TABLET_OF_HEXES_DESPAIR = 1224; TABLET_OF_HEXES_REGRET = 1225; TABLET_OF_HEXES_RAGE = 1226; TABLET_OF_HEXES_AGONY = 1227; TABLET_OF_HEXES_DOLOR = 1228; TABLET_OF_HEXES_RANCOR = 1229; TABLET_OF_HEXES_STRIFE = 1230; TABLET_OF_HEXES_PENURY = 1231; TABLET_OF_HEXES_BLIGHT = 1232; TABLET_OF_HEXES_DEATH = 1233; SYNERGY_CRUCIBLE = 1234; MOG_KUPON_AW_ABS = 1235; MOG_KUPON_AW_PAN = 1236; MAGELIGHT_SIGNAL_FLARE = 1237; ALCHEMICAL_SIGNAL_FLARE = 1238; DISTRESS_SIGNAL_FLARE = 1239; IMPERIAL_MISSIVE = 1240; SANDORIAN_APPROVAL_LETTER = 1241; BASTOKAN_APPROVAL_LETTER = 1242; WINDURSTIAN_APPROVAL_LETTER = 1243; JEUNOAN_APPROVAL_LETTER = 1244; PRESENT_FOR_MEGOMAK = 1245; LIGHTNING_CELL = 1246; MEGOMAKS_SHOPPING_LIST = 1247; WHISPER_OF_RADIANCE = 1248; TALISMAN_OF_THE_REBEL_GODS = 1249; MESSAGE_FROM_YOYOROON = 1250; WHISPER_OF_GLOOM = 1251; SPATIAL_PRESSURE_BAROMETER = 1252; CLEAR_ABYSSITE = 1253; COLORFUL_ABYSSITE = 1254; BLUE_ABYSSITE = 1255; ORANGE_ABYSSITE = 1256; BROWN_ABYSSITE = 1257; YELLOW_ABYSSITE = 1258; PURPLE_ABYSSITE = 1259; BLACK_ABYSSITE = 1260; MAGIAN_TRIAL_LOG = 1261; MOG_KUPON_A_LUM = 1262; TALISMAN_KEY = 1263; LETTER_FROM_HALVER = 1264; LETTER_FROM_NAJI = 1265; LETTER_FROM_ZUBABA = 1266; LETTER_FROM_MAAT = 1267; LETTER_FROM_DESPACHIAIRE = 1268; LETTER_FROM_JAKOH_WAHCONDALO = 1269; ZVAHL_PASSKEY = 1270; TRAVERSER_STONE1 = 1271; TRAVERSER_STONE2 = 1272; TRAVERSER_STONE3 = 1273; TRAVERSER_STONE4 = 1274; TRAVERSER_STONE5 = 1275; TRAVERSER_STONE6 = 1276; POET_GODS_KEY = 1277; ORCISH_INFILTRATION_KIT = 1278; ATMA_OF_THE_LION = 1279; ATMA_OF_THE_STOUT_ARM = 1280; ATMA_OF_THE_TWIN_CLAW = 1281; ATMA_OF_ALLURE = 1282; ATMA_OF_ETERNITY = 1283; ATMA_OF_THE_HEAVENS = 1284; ATMA_OF_THE_BAYING_MOON = 1285; ATMA_OF_THE_EBON_HOOF = 1286; ATMA_OF_TREMORS = 1287; ATMA_OF_THE_SAVAGE_TIGER = 1288; ATMA_OF_THE_VORACIOUS_VIOLET = 1289; ATMA_OF_CLOAK_AND_DAGGER = 1290; ATMA_OF_THE_STORMBIRD = 1291; ATMA_OF_THE_NOXIOUS_FANG = 1292; ATMA_OF_VICISSITUDE = 1293; ATMA_OF_THE_BEYOND = 1294; ATMA_OF_STORMBREATH = 1295; ATMA_OF_GALES = 1296; ATMA_OF_THRASHING_TENDRILS = 1297; ATMA_OF_THE_DRIFTER = 1298; ATMA_OF_THE_STRONGHOLD = 1299; ATMA_OF_THE_HARVESTER = 1300; ATMA_OF_DUNES = 1301; ATMA_OF_THE_COSMOS = 1302; ATMA_OF_THE_SIREN_SHADOW = 1303; ATMA_OF_THE_IMPALER = 1304; ATMA_OF_THE_ADAMANTINE = 1305; ATMA_OF_CALAMITY = 1306; ATMA_OF_THE_CLAW = 1307; ATMA_OF_BALEFUL_BONES = 1308; ATMA_OF_THE_CLAWED_BUTTERFLY = 1309; ATMA_OF_THE_DESERT_WORM = 1310; ATMA_OF_THE_UNDYING = 1311; ATMA_OF_THE_IMPREGNABLE_TOWER = 1312; ATMA_OF_THE_SMOLDERING_SKY = 1313; ATMA_OF_THE_DEMONIC_SKEWER = 1314; ATMA_OF_THE_GOLDEN_CLAW = 1315; ATMA_OF_THE_GLUTINOUS_OOZE = 1316; ATMA_OF_THE_LIGHTNING_BEAST = 1317; ATMA_OF_THE_NOXIOUS_BLOOM = 1318; ATMA_OF_THE_GNARLED_HORN = 1319; ATMA_OF_THE_STRANGLING_WIND = 1320; ATMA_OF_THE_DEEP_DEVOURER = 1321; ATMA_OF_THE_MOUNTED_CHAMPION = 1322; ATMA_OF_THE_RAZED_RUINS = 1323; ATMA_OF_THE_BLUDGEONING_BRUTE = 1324; ATMA_OF_THE_RAPID_REPTILIAN = 1325; ATMA_OF_THE_WINGED_ENIGMA = 1326; ATMA_OF_THE_CRADLE = 1327; ATMA_OF_THE_UNTOUCHED = 1328; ATMA_OF_THE_SANGUINE_SCYTHE = 1329; ATMA_OF_THE_TUSKED_TERROR = 1330; ATMA_OF_THE_MINIKIN_MONSTROSITY = 1331; ATMA_OF_THE_WOULD_BE_KING = 1332; ATMA_OF_THE_BLINDING_HORN = 1333; ATMA_OF_THE_DEMONIC_LASH = 1334; ATMA_OF_APPARITIONS = 1335; ATMA_OF_THE_SHIMMERING_SHELL = 1336; ATMA_OF_THE_MURKY_MIASMA = 1337; ATMA_OF_THE_AVARICIOUS_APE = 1338; ATMA_OF_THE_MERCILESS_MATRIARCH = 1339; ATMA_OF_THE_BROTHER_WOLF = 1340; ATMA_OF_THE_EARTH_WYRM = 1341; ATMA_OF_THE_ASCENDING_ONE = 1342; ATMA_OF_THE_SCORPION_QUEEN = 1343; ATMA_OF_A_THOUSAND_NEEDLES = 1344; ATMA_OF_THE_BURNING_EFFIGY = 1345; ATMA_OF_THE_SMITING_BLOW = 1346; ATMA_OF_THE_LONE_WOLF = 1347; ATMA_OF_THE_CRIMSON_SCALE = 1348; ATMA_OF_THE_SCARLET_WING = 1349; ATMA_OF_THE_RAISED_TAIL = 1350; ATMA_OF_THE_SAND_EMPEROR = 1351; ATMA_OF_THE_OMNIPOTENT = 1352; ATMA_OF_THE_WAR_LION = 1353; ATMA_OF_THE_FROZEN_FETTERS = 1354; ATMA_OF_THE_PLAGUEBRINGER = 1355; ATMA_OF_THE_SHRIEKING_ONE = 1356; ATMA_OF_THE_HOLY_MOUNTAIN = 1357; ATMA_OF_THE_LAKE_LURKER = 1358; ATMA_OF_THE_CRUSHING_CUDGEL = 1359; ATMA_OF_PURGATORY = 1360; ATMA_OF_BLIGHTED_BREATH = 1361; ATMA_OF_THE_PERSISTENT_PREDATOR = 1362; ATMA_OF_THE_STONE_GOD = 1363; ATMA_OF_THE_SUN_EATER = 1364; ATMA_OF_THE_DESPOT = 1365; ATMA_OF_THE_SOLITARY_ONE = 1366; ATMA_OF_THE_WINGED_GLOOM = 1367; ATMA_OF_THE_SEA_DAUGHTER = 1368; ATMA_OF_THE_HATEFUL_STREAM = 1369; ATMA_OF_THE_FOE_FLAYER = 1370; ATMA_OF_THE_ENDLESS_NIGHTMARE = 1371; ATMA_OF_THE_SUNDERING_SLASH = 1372; ATMA_OF_ENTWINED_SERPENTS = 1373; ATMA_OF_THE_HORNED_BEAST = 1374; ATMA_OF_AQUATIC_ARDOR = 1375; ATMA_OF_THE_FALLEN_ONE = 1376; ATMA_OF_FIRES_AND_FLARES = 1377; ATMA_OF_THE_APOCALYPSE = 1378; IVORY_ABYSSITE_OF_SOJOURN = 1379; SCARLET_ABYSSITE_OF_SOJOURN = 1380; JADE_ABYSSITE_OF_SOJOURN = 1381; SAPPHIRE_ABYSSITE_OF_SOJOURN = 1382; INDIGO_ABYSSITE_OF_SOJOURN = 1383; EMERALD_ABYSSITE_OF_SOJOURN = 1384; AZURE_ABYSSITE_OF_CELERITY = 1385; CRIMSON_ABYSSITE_OF_CELERITY = 1386; IVORY_ABYSSITE_OF_CELERITY = 1387; VIRIDIAN_ABYSSITE_OF_AVARICE = 1388; IVORY_ABYSSITE_OF_AVARICE = 1389; VERMILLION_ABYSSITE_OF_AVARICE = 1390; IVORY_ABYSSITE_OF_CONFLUENCE = 1391; CRIMSON_ABYSSITE_OF_CONFLUENCE = 1392; INDIGO_ABYSSITE_OF_CONFLUENCE = 1393; IVORY_ABYSSITE_OF_EXPERTISE = 1394; JADE_ABYSSITE_OF_EXPERTISE = 1395; EMERALD_ABYSSITE_OF_EXPERTISE = 1396; IVORY_ABYSSITE_OF_FORTUNE = 1397; SAPPHIRE_ABYSSITE_OF_FORTUNE = 1398; EMERALD_ABYSSITE_OF_FORTUNE = 1399; SCARLET_ABYSSITE_OF_KISMET = 1400; IVORY_ABYSSITE_OF_KISMET = 1401; VERMILLION_ABYSSITE_OF_KISMET = 1402; AZURE_ABYSSITE_OF_PROSPERITY = 1403; JADE_ABYSSITE_OF_PROSPERITY = 1404; IVORY_ABYSSITE_OF_PROSPERITY = 1405; VIRIDIAN_ABYSSITE_OF_DESTINY = 1406; CRIMSON_ABYSSITE_OF_DESTINY = 1407; IVORY_ABYSSITE_OF_DESTINY = 1408; IVORY_ABYSSITE_OF_ACUMEN = 1409; CRIMSON_ABYSSITE_OF_ACUMEN = 1410; EMERALD_ABYSSITE_OF_ACUMEN = 1411; SCARLET_ABYSSITE_OF_LENITY = 1412; AZURE_ABYSSITE_OF_LENITY = 1413; VIRIDIAN_ABYSSITE_OF_LENITY = 1414; JADE_ABYSSITE_OF_LENITY = 1415; SAPPHIRE_ABYSSITE_OF_LENITY = 1416; CRIMSON_ABYSSITE_OF_LENITY = 1417; VERMILLION_ABYSSITE_OF_LENITY = 1418; INDIGO_ABYSSITE_OF_LENITY = 1419; EMERALD_ABYSSITE_OF_LENITY = 1420; SCARLET_ABYSSITE_OF_PERSPICACITY = 1421; IVORY_ABYSSITE_OF_PERSPICACITY = 1422; VERM_ABYSSITE_OF_PERSPICACITY = 1423; AZURE_ABYSSITE_OF_THE_REAPER = 1424; IVORY_ABYSSITE_OF_THE_REAPER = 1425; INDIGO_ABYSSITE_OF_THE_REAPER = 1426; VIRIDIAN_ABYSSITE_OF_GUERDON = 1427; IVORY_ABYSSITE_OF_GUERDON = 1428; VERMILLION_ABYSSITE_OF_GUERDON = 1429; SCARLET_ABYSSITE_OF_FURTHERANCE = 1430; SAPPHIRE_ABYSSITE_OF_FURTHERANCE = 1431; IVORY_ABYSSITE_OF_FURTHERANCE = 1432; AZURE_ABYSSITE_OF_MERIT = 1433; VIRIDIAN_ABYSSITE_OF_MERIT = 1434; JADE_ABYSSITE_OF_MERIT = 1435; SAPPHIRE_ABYSSITE_OF_MERIT = 1436; IVORY_ABYSSITE_OF_MERIT = 1437; INDIGO_ABYSSITE_OF_MERIT = 1438; LUNAR_ABYSSITE1 = 1439; LUNAR_ABYSSITE2 = 1440; LUNAR_ABYSSITE3 = 1441; ABYSSITE_OF_DISCERNMENT = 1442; ABYSSITE_OF_THE_COSMOS = 1443; WHITE_STRATUM_ABYSSITE = 1444; WHITE_STRATUM_ABYSSITE_II = 1445; WHITE_STRATUM_ABYSSITE_III = 1446; ASHEN_STRATUM_ABYSSITE = 1447; ASHEN_STRATUM_ABYSSITE_II = 1448; ASHEN_STRATUM_ABYSSITE_III = 1449; WHITE_STRATUM_ABYSSITE_IV = 1450; WHITE_STRATUM_ABYSSITE_V = 1451; WHITE_STRATUM_ABYSSITE_VI = 1452; LEGION_TOME_PAGE_MAXIMUS = 1453; LEGION_MEDAL_AN = 1454; LEGION_MEDAL_KI = 1455; LEGION_MEDAL_IM = 1456; LEGION_MEDAL_MURU = 1457; LEGION_TOME_PAGE_MINIMUS = 1458; FRAGRANT_TREANT_PETAL = 1459; FETID_RAFFLESIA_STALK = 1460; DECAYING_MORBOL_TOOTH = 1461; TURBID_SLIME_OIL = 1462; VENOMOUS_PEISTE_CLAW = 1463; TATTERED_HIPPOGRYPH_WING = 1464; CRACKED_WIVRE_HORN = 1465; MUCID_AHRIMAN_EYEBALL = 1466; TWISTED_TONBERRY_CROWN = 1467; VEINOUS_HECTEYES_EYELID = 1468; TORN_BAT_WING = 1469; GORY_SCORPION_CLAW = 1470; MOSSY_ADAMANTOISE_SHELL = 1471; FAT_LINED_COCKATRICE_SKIN = 1472; SODDEN_SANDWORM_HUSK = 1473; LUXURIANT_MANTICORE_MANE = 1474; STICKY_GNAT_WING = 1475; OVERGROWN_MANDRAGORA_FLOWER = 1476; CHIPPED_SANDWORM_TOOTH = 1477; MARBLED_MUTTON_CHOP = 1478; BLOODIED_SABER_TOOTH = 1479; BLOOD_SMEARED_GIGAS_HELM = 1480; GLITTERING_PIXIE_CHOKER = 1481; DENTED_GIGAS_SHIELD = 1482; WARPED_GIGAS_ARMBAND = 1483; SEVERED_GIGAS_COLLAR = 1484; PELLUCID_FLY_EYE = 1485; SHIMMERING_PIXIE_PINION = 1486; SMOLDERING_CRAB_SHELL = 1487; VENOMOUS_WAMOURA_FEELER = 1488; BULBOUS_CRAWLER_COCOON = 1489; DISTENDED_CHIGOE_ABDOMEN = 1490; MUCID_WORM_SEGMENT = 1491; SHRIVELED_HECTEYES_STALK = 1492; BLOTCHED_DOOMED_TONGUE = 1493; CRACKED_SKELETON_CLAVICLE = 1494; WRITHING_GHOST_FINGER = 1495; RUSTED_HOUND_COLLAR = 1496; HOLLOW_DRAGON_EYE = 1497; BLOODSTAINED_BUGARD_FANG = 1498; GNARLED_LIZARD_NAIL = 1499; MOLTED_PEISTE_SKIN = 1500; JAGGED_APKALLU_BEAK = 1501; CLIPPED_BIRD_WING = 1502; BLOODIED_BAT_FUR = 1503; GLISTENING_OROBON_LIVER = 1504; DOFFED_POROGGO_HAT = 1505; SCALDING_IRONCLAD_SPIKE = 1506; BLAZING_CLUSTER_SOUL = 1507; INGROWN_TAURUS_NAIL = 1508; OSSIFIED_GARGOUILLE_HAND = 1509; IMBRUED_VAMPYR_FANG = 1510; GLOSSY_SEA_MONK_SUCKER = 1511; SHIMMERING_PUGIL_SCALE = 1512; DECAYED_DVERGR_TOOTH = 1513; PULSATING_SOULFLAYER_BEARD = 1514; CHIPPED_IMPS_OLIFANT = 1515; WARPED_SMILODON_CHOKER = 1516; MALODOROUS_MARID_FUR = 1517; BROKEN_IRON_GIANT_SPIKE = 1518; RUSTED_CHARIOT_GEAR = 1519; STEAMING_CERBERUS_TONGUE = 1520; BLOODIED_DRAGON_EAR = 1521; RESPLENDENT_ROC_QUILL = 1522; WARPED_IRON_GIANT_NAIL = 1523; DENTED_CHARIOT_SHIELD = 1524; TORN_KHIMAIRA_WING = 1525; BEGRIMED_DRAGON_HIDE = 1526; DECAYING_DIREMITE_FANG = 1527; SHATTERED_IRON_GIANT_CHAIN = 1528; WARPED_CHARIOT_PLATE = 1529; VENOMOUS_HYDRA_FANG = 1530; VACANT_BUGARD_EYE = 1531; VARIEGATED_URAGNITE_SHELL = 1532; BATTLE_TROPHY_1ST_ECHELON = 1533; BATTLE_TROPHY_2ND_ECHELON = 1534; BATTLE_TROPHY_3RD_ECHELON = 1535; BATTLE_TROPHY_4TH_ECHELON = 1536; BATTLE_TROPHY_5TH_ECHELON = 1537; CRIMSON_TRAVERSER_STONE = 1538; VOIDSTONE1 = 1539; VOIDSTONE2 = 1540; VOIDSTONE3 = 1541; VOIDSTONE4 = 1542; VOIDSTONE5 = 1543; VOIDSTONE6 = 1544; CRIMSON_GRANULES_OF_TIME = 1545; AZURE_GRANULES_OF_TIME = 1546; AMBER_GRANULES_OF_TIME = 1547; ALABASTER_GRANULES_OF_TIME = 1548; OBSIDIAN_GRANULES_OF_TIME = 1549; PRISMATIC_HOURGLASS = 1550; MOG_KUPON_W_R90 = 1551; MOG_KUPON_W_M90 = 1552; MOG_KUPON_W_E90 = 1553; MOG_KUPON_A_E2 = 1554; MOG_KUPON_I_SEAL = 1555; BEGUILING_PETRIFACT = 1556; SEDUCTIVE_PETRIFACT = 1557; MADDENING_PETRIFACT = 1558; VAT_OF_MARTELLO_FUEL = 1559; FUEL_RESERVOIR = 1560; EMPTY_FUEL_VAT = 1561; CRACKED_FUEL_RESERVOIR = 1562; VIAL_OF_LAMBENT_POTION = 1563; CLEAR_DEMILUNE_ABYSSITE = 1564; COLORFUL_DEMILUNE_ABYSSITE = 1565; SCARLET_DEMILUNE_ABYSSITE = 1566; AZURE_DEMILUNE_ABYSSITE = 1567; VIRIDIAN_DEMILUNE_ABYSSITE = 1568; ANTI_ABYSSEAN_GRENADE_01 = 1569; ANTI_ABYSSEAN_GRENADE_02 = 1570; ANTI_ABYSSEAN_GRENADE_03 = 1571; RAINBOW_PEARL = 1572; CHIPPED_WIND_CLUSTER = 1573; PIECE_OF_DRIED_EBONY_LUMBER = 1574; CAPTAIN_RASHIDS_LINKPEARL = 1575; CAPTAIN_ARGUSS_LINKPEARL = 1576; CAPTAIN_HELGAS_LINKPEARL = 1577; SEAL_OF_THE_RESISTANCE = 1578; SUNBEAM_FRAGMENT = 1579; LUGARHOOS_EYEBALL = 1580; VIAL_OF_PURIFICATION_AGENT_BLK = 1581; VIAL_OF_PURIFICATION_AGENT_BRZ = 1582; VIAL_OF_PURIFICATION_AGENT_SLV = 1583; VIAL_OF_PURIFICATION_AGENT_GLD = 1584; BLACK_LABELED_VIAL = 1585; BRONZE_LABELED_VIAL = 1586; SILVER_LABELED_VIAL = 1587; GOLD_LABELED_VIAL = 1588; RAINBOW_COLORED_LINKPEARL = 1589; GREY_ABYSSITE = 1590; RIPE_STARFRUIT_ABYSSEA = 1591; VIAL_OF_FLOWER_WOWER_FERTILIZER = 1592; TAHRONGI_TREE_NUT = 1593; BUCKET_OF_COMPOUND_COMPOST = 1594; CUP_OF_TAHRONGI_CACTUS_WATER = 1595; HASTILY_SCRAWLED_POSTER = 1596; BLOODIED_ARROW = 1597; CRIMSON_BLOODSTONE = 1598; KUPOFRIEDS_MEDALLION = 1599; PINCH_OF_MOIST_DANGRUF_SULFUR = 1600; NAJIS_GAUGER_PLATE = 1601; NAJIS_LINKPEARL = 1602; POT_OF_MARTIAL_RELISH = 1603; THIERRIDES_BEAN_CREATION = 1604; TINY_MEMORY_FRAGMENT1 = 1605; LARGE_MEMORY_FRAGMENT1 = 1606; FEY_STONE = 1607; LARGE_MEMORY_FRAGMENT2 = 1608; TORN_RECIPE_PAGE = 1609; MINERAL_GAUGE_FOR_DUMMIES = 1610; TUBE_OF_ALCHEMICAL_FERTILIZER = 1611; LARGE_MEMORY_FRAGMENT3 = 1612; LARGE_MEMORY_FRAGMENT4 = 1613; PULSE_MARTELLO_REPAIR_PACK = 1614; CLONE_WARD_REINFORCEMENT_PACK = 1615; PACK_OF_OUTPOST_REPAIR_TOOLS = 1616; PARRADAMO_SUPPLY_PACK1 = 1617; PARRADAMO_SUPPLY_PACK2 = 1618; PARRADAMO_SUPPLY_PACK3 = 1619; PARRADAMO_SUPPLY_PACK4 = 1620; PARRADAMO_SUPPLY_PACK5 = 1621; GASPONIA_STAMEN = 1622; ROCKHOPPER = 1623; PHIAL_OF_COUNTERAGENT = 1624; DAMAGED_STEWPOT = 1625; NARURUS_STEWPOT = 1626; MAGICKED_HEMPEN_SACK = 1627; MAGICKED_FLAXEN_SACK = 1628; PARALYSIS_TRAP_FLUID = 1629; PARALYSIS_TRAP_FLUID_BOTTLE = 1630; WEAKENING_TRAP_FLUID = 1631; WEAKENING_TRAP_FLUID_BOTTLE = 1632; IRON_EATERS_PEARLSACK = 1633; MEDICAL_SUPPLY_CHEST = 1635; WOODWORKERS_BELT = 1636; ESPIONAGE_PEARLSACK = 1637; CHIPPED_LINKSHELL = 1638; GRIMY_LINKSHELL = 1639; CRACKED_LINKSHELL = 1640; POCKET_SUPPLY_PACK = 1641; STANDARD_SUPPLY_PACK = 1642; HEFTY_SUPPLY_PACK = 1643; PACK_OF_MOLTEN_SLAG = 1644; LETTER_OF_RECEIPT = 1645; SMUDGED_LETTER = 1646; YELLOW_LINKPEARL = 1647; JESTERS_HAT = 1648; JADE_DEMILUNE_ABYSSITE = 1649; SAPPHIRE_DEMILUNE_ABYSSITE = 1650; CRIMSON_DEMILUNE_ABYSSITE = 1651; EMERALD_DEMILUNE_ABYSSITE = 1652; VERMILLION_DEMILUNE_ABYSSITE = 1653; INDIGO_DEMILUNE_ABYSSITE = 1654; ATMA_OF_THE_HEIR = 1655; ATMA_OF_THE_HERO = 1656; ATMA_OF_THE_FULL_MOON = 1657; ATMA_OF_ILLUSIONS = 1658; ATMA_OF_THE_BANISHER = 1659; ATMA_OF_THE_SELLSWORD = 1660; ATMA_OF_A_FUTURE_FABULOUS = 1661; ATMA_OF_CAMARADERIE = 1662; ATMA_OF_THE_TRUTHSEEKER = 1663; ATMA_OF_THE_AZURE_SKY = 1664; ATMA_OF_ECHOES = 1665; ATMA_OF_DREAD = 1666; ATMA_OF_AMBITION = 1667; ATMA_OF_THE_BEAST_KING = 1668; ATMA_OF_THE_KIRIN = 1669; ATMA_OF_HELLS_GUARDIAN = 1670; ATMA_OF_LUMINOUS_WINGS = 1671; ATMA_OF_THE_DRAGON_RIDER = 1672; ATMA_OF_THE_IMPENETRABLE = 1673; ATMA_OF_ALPHA_AND_OMEGA = 1674; ATMA_OF_THE_ULTIMATE = 1675; ATMA_OF_THE_HYBRID_BEAST = 1676; ATMA_OF_THE_DARK_DEPTHS = 1677; ATMA_OF_THE_ZENITH = 1678; ATMA_OF_PERFECT_ATTENDANCE = 1679; ATMA_OF_THE_RESCUER = 1680; ATMA_OF_NIGHTMARES = 1681; ATMA_OF_THE_EINHERJAR = 1682; ATMA_OF_THE_ILLUMINATOR = 1683; ATMA_OF_THE_BUSHIN = 1684; ATMA_OF_THE_ACE_ANGLER = 1685; ATMA_OF_THE_MASTER_CRAFTER = 1686; ATMA_OF_INGENUITY = 1687; ATMA_OF_THE_GRIFFONS_CLAW = 1688; ATMA_OF_THE_FETCHING_FOOTPAD = 1689; ATMA_OF_UNDYING_LOYALTY = 1690; ATMA_OF_THE_ROYAL_LINEAGE = 1691; ATMA_OF_THE_SHATTERING_STAR = 1692; ATMA_OF_THE_COBRA_COMMANDER = 1693; ATMA_OF_ROARING_LAUGHTER = 1694; ATMA_OF_THE_DARK_BLADE = 1695; ATMA_OF_THE_DUCAL_GUARD = 1696; ATMA_OF_HARMONY = 1697; ATMA_OF_REVELATIONS = 1698; ATMA_OF_THE_SAVIOR = 1699; TINY_MEMORY_FRAGMENT2 = 1700; TINY_MEMORY_FRAGMENT3 = 1701; EX_01_MARTELLO_CORE = 1702; EX_02_MARTELLO_CORE = 1703; EX_03_MARTELLO_CORE = 1704; EX_04_MARTELLO_CORE = 1705; EX_05_MARTELLO_CORE = 1706; EX_06_MARTELLO_CORE = 1707; EX_07_MARTELLO_CORE = 1708; MOG_KUPON_W_E85 = 1709; MOG_KUPON_A_RJOB = 1710; SILVER_POCKET_WATCH = 1711; ELEGANT_GEMSTONE = 1712; WIVRE_EGG1 = 1713; WIVRE_EGG2 = 1714; WIVRE_EGG3 = 1715; TORCH_COAL = 1716; SUBNIVEAL_MINES = 1717; PIECE_OF_SODDEN_OAK_LUMBER = 1718; SODDEN_LINEN_CLOTH = 1719; DHORME_KHIMAIRAS_MANE = 1720; IMPERIAL_PEARL = 1721; RONFAURE_DAWNDROP = 1722; LA_VAULE_DAWNDROP = 1723; JUGNER_DAWNDROP = 1724; BEAUCEDINE_DAWNDROP = 1725; XARCABARD_DAWNDROP = 1726; THRONE_ROOM_DAWNDROP = 1727; WALK_OF_ECHOES_DAWNDROP = 1728; SANDORIA_DAWNDROP = 1729; BOTTLED_PUNCH_BUG = 1730; PRIMAL_GLOW = 1731; MOONSHADE_EARRING = 1732; PINCH_OF_PIXIE_DUST = 1733; WEDDING_INVITATION = 1734; SNOLL_REFLECTOR = 1735; FROSTED_SNOLL_REFLECTOR = 1736; EXPERIMENT_CHEAT_SHEET = 1737; JOB_GESTURE_WARRIOR = 1738; JOB_GESTURE_MONK = 1739; JOB_GESTURE_WHITE_MAGE = 1740; JOB_GESTURE_BLACK_MAGE = 1741; JOB_GESTURE_RED_MAGE = 1742; JOB_GESTURE_THIEF = 1743; JOB_GESTURE_PALADIN = 1744; JOB_GESTURE_DARK_KNIGHT = 1745; JOB_GESTURE_BEASTMASTER = 1746; JOB_GESTURE_BARD = 1747; JOB_GESTURE_RANGER = 1748; JOB_GESTURE_SAMURAI = 1749; JOB_GESTURE_NINJA = 1750; JOB_GESTURE_DRAGOON = 1751; JOB_GESTURE_SUMMONER = 1752; JOB_GESTURE_BLUE_MAGE = 1753; JOB_GESTURE_CORSAIR = 1754; JOB_GESTURE_PUPPETMASTER = 1755; JOB_GESTURE_DANCER = 1756; JOB_GESTURE_SCHOLAR = 1757; FROSTBLOOM1 = 1758; FROSTBLOOM2 = 1759; FROSTBLOOM3 = 1760; MOON_PENDANT = 1761; WYVERN_EGG = 1762; WYVERN_EGG_SHELL = 1763; WAUGYLS_CLAW = 1764; BOTTLE_OF_MILITARY_INK = 1765; MILITARY_INK_PACKAGE = 1766; MAGIAN_LEARNERS_LOG = 1767; MAGIAN_MOOGLEHOOD_MISSIVE1 = 1768; MAGIAN_MOOGLEHOOD_MISSIVE2 = 1769; MAGIAN_MOOGLEHOOD_MISSIVE3 = 1770; MAGIAN_MOOGLEHOOD_MISSIVE4 = 1771; MAGIAN_MOOGLEHOOD_MISSIVE5 = 1772; MAGIAN_MOOGLEHOOD_MISSIVE6 = 1773; PERIAPT_OF_EMERGENCE1 = 1774; PERIAPT_OF_EMERGENCE2 = 1775; PERIAPT_OF_EMERGENCE3 = 1776; PERIAPT_OF_GUIDANCE = 1777; PERIAPT_OF_PERCIPIENCE = 1778; VIVID_PERIAPT_OF_CONCORD = 1779; DUSKY_PERIAPT_OF_CONCORD = 1780; VIVID_PERIAPT_OF_CATALYSIS = 1781; DUSKY_PERIAPT_OF_CATALYSIS = 1782; VIVID_PERIAPT_OF_EXPLORATION = 1783; DUSKY_PERIAPT_OF_EXPLORATION = 1784; VIVID_PERIAPT_OF_FRONTIERS = 1785; DUSKY_PERIAPT_OF_FRONTIERS = 1786; NEUTRAL_PERIAPT_OF_FRONTIERS = 1787; VIVID_PERIAPT_OF_CONCENTRATION = 1788; DUSKY_PERIAPT_OF_CONCENTRATION = 1789; VIVID_PERIAPT_OF_GLORY = 1790; DUSKY_PERIAPT_OF_GLORY = 1791; VIVID_PERIAPT_OF_FOCUS = 1792; DUSKY_PERIAPT_OF_FOCUS = 1793; VIVID_PERIAPT_OF_INTENSITY = 1794; DUSKY_PERIAPT_OF_INTENSITY = 1795; VIVID_PERIAPT_OF_READINESS = 1796; DUSKY_PERIAPT_OF_READINESS = 1797; VIVID_PERIAPT_OF_ADAPTABILITY = 1798; DUSKY_PERIAPT_OF_ADAPTABILITY = 1799; VIVID_PERIAPT_OF_VIGILANCE = 1800; DUSKY_PERIAPT_OF_VIGILANCE = 1801; VIVID_PERIAPT_OF_PRUDENCE = 1802; DUSKY_PERIAPT_OF_PRUDENCE = 1803; PERIAPT_OF_RECOMPENSE = 1804; VOID_CLUSTER = 1805; ATMACITE_OF_DEVOTION = 1806; ATMACITE_OF_PERSISTENCE = 1807; ATMACITE_OF_EMINENCE = 1808; ATMACITE_OF_ONSLAUGHT = 1809; ATMACITE_OF_INCURSION = 1810; ATMACITE_OF_ENTICEMENT = 1811; ATMACITE_OF_DESTRUCTION = 1812; ATMACITE_OF_TEMPERANCE = 1813; ATMACITE_OF_DISCIPLINE = 1814; ATMACITE_OF_COERCION = 1815; ATMACITE_OF_FINESSE = 1816; ATMACITE_OF_LATITUDE = 1817; ATMACITE_OF_MYSTICISM = 1818; ATMACITE_OF_RAPIDITY = 1819; ATMACITE_OF_PREPAREDNESS = 1820; ATMACITE_OF_DELUGES = 1821; ATMACITE_OF_UNITY = 1822; ATMACITE_OF_EXHORTATION = 1823; ATMACITE_OF_SKYBLAZE = 1824; ATMACITE_OF_THE_SLAYER = 1825; ATMACITE_OF_THE_ADAMANT = 1826; ATMACITE_OF_THE_VALIANT = 1827; ATMACITE_OF_THE_SHREWD = 1828; ATMACITE_OF_THE_VANGUARD = 1829; ATMACITE_OF_ASSAILMENT = 1830; ATMACITE_OF_CATAPHRACT = 1831; ATMACITE_OF_THE_PARAPET = 1832; ATMACITE_OF_IMPERIUM = 1833; ATMACITE_OF_THE_SOLIPSIST = 1834; ATMACITE_OF_PROVENANCE = 1835; ATMACITE_OF_DARK_DESIGNS = 1836; ATMACITE_OF_THE_FORAGER = 1837; ATMACITE_OF_GLACIERS = 1838; ATMACITE_OF_AFFINITY = 1839; ATMACITE_OF_THE_DEPTHS = 1840; ATMACITE_OF_THE_ASSASSIN = 1841; ATMACITE_OF_APLOMB = 1842; ATMACITE_OF_THE_TROPICS = 1843; ATMACITE_OF_CURSES = 1844; ATMACITE_OF_PRESERVATION = 1845; POUCH_OF_WEIGHTED_STONES = 1846; GOSSAMER_BALLISTA_CHEVRON = 1847; STEEL_BALLISTA_CHEVRON = 1848; PERIAPT_OF_SAPIENCE = 1854; PERIAPT_OF_CLARITY = 1855; MAP_OF_AL_ZAHBI = 1856; MAP_OF_NASHMAU = 1857; MAP_OF_WAJAOM_WOODLANDS = 1858; MAP_OF_CAEDARVA_MIRE = 1859; MAP_OF_MOUNT_ZHAYOLM = 1860; MAP_OF_AYDEEWA_SUBTERRANE = 1861; MAP_OF_MAMOOK = 1862; MAP_OF_HALVUNG = 1863; MAP_OF_ARRAPAGO_REEF = 1864; MAP_OF_ALZADAAL_RUINS = 1865; MAP_OF_LEUJAOAM_SANCTUM = 1866; MAP_OF_THE_TRAINING_GROUNDS = 1867; MAP_OF_LEBROS_CAVERN = 1868; MAP_OF_ILRUSI_ATOLL = 1869; MAP_OF_PERIQIA = 1870; MAP_OF_NYZUL_ISLE = 1871; MAP_OF_THE_CHOCOBO_CIRCUIT = 1872; MAP_OF_THE_COLOSSEUM = 1873; MAP_OF_BHAFLAU_THICKETS = 1874; MAP_OF_ZHAYOLM_REMNANTS = 1875; MAP_OF_ARRAPAGO_REMNANTS = 1876; MAP_OF_BHAFLAU_REMNANTS = 1877; MAP_OF_SILVER_SEA_REMNANTS = 1878; MAP_OF_VUNKERL_INLET = 1879; MAP_OF_EVERBLOOM_HOLLOW = 1880; MAP_OF_GRAUBERG = 1881; MAP_OF_RUHOTZ_SILVERMINES = 1882; MAP_OF_FORT_KARUGONARUGO = 1883; MAP_OF_GHOYUS_REVERIE = 1884; MAP_OF_ABYSSEA_LA_THEINE = 1885; MAP_OF_ABYSSEA_KONSCHTAT = 1886; MAP_OF_ABYSSEA_TAHRONGI = 1887; MAP_OF_ABYSSEA_ATTOHWA = 1888; MAP_OF_ABYSSEA_MISAREAUX = 1889; MAP_OF_ABYSSEA_VUNKERL = 1890; MAP_OF_ABYSSEA_ALTEPA = 1891; MAP_OF_ABYSSEA_ULEGUERAND = 1892; MAP_OF_ABYSSEA_GRAUBERG = 1893; MAP_OF_DYNAMIS_SANDORIA = 1894; MAP_OF_DYNAMIS_BASTOK = 1895; MAP_OF_DYNAMIS_WINDURST = 1896; MAP_OF_DYNAMIS_JEUNO = 1897; MAP_OF_DYNAMIS_BEAUCEDINE = 1898; MAP_OF_DYNAMIS_XARCABARD = 1899; MAP_OF_DYNAMIS_VALKURM = 1900; MAP_OF_DYNAMIS_BUBURIMU = 1901; MAP_OF_DYNAMIS_QUFIM = 1902; MAP_OF_DYNAMIS_TAVNAZIA = 1903; MAP_OF_ADOULIN = 1904; MAP_OF_RALA_WATERWAYS = 1905; MAP_OF_YAHSE_HUNTING_GROUNDS = 1906; MAP_OF_CEIZAK_BATTLEGROUNDS = 1907; MAP_OF_FORET_DE_HENNETIEL = 1908; MAP_OF_YORCIA_WEALD = 1909; MAP_OF_MORIMAR_BASALT_FIELDS = 1910; MAP_OF_MARJAMI_RAVINE = 1911; MAP_OF_KAMIHR_DRIFTS = 1912; MAP_OF_SIH_GATES = 1913; MAP_OF_MOH_GATES = 1914; MAP_OF_CIRDAS_CAVERNS = 1915; MAP_OF_DHO_GATES = 1916; MAP_OF_WOH_GATES = 1917; MAP_OF_OUTER_RAKAZNAR = 1918; IRON_CHAINMAIL_CLAIM_SLIP = 1920; SHADE_HARNESS_CLAIM_SLIP = 1921; BRASS_SCALE_MAIL_CLAIM_SLIP = 1922; WOOL_ROBE_CLAIM_SLIP = 1923; EISENPLATTE_ARMOR_CLAIM_SLIP = 1924; SOIL_GI_CLAIM_SLIP = 1925; SEERS_TUNIC_CLAIM_SLIP = 1926; STUDDED_ARMOR_CLAIM_SLIP = 1927; CENTURION_SCALE_MAIL_CLAIM_SLIP = 1928; MRCCPT_DOUBLET_CLAIM_SLIP = 1929; GARISH_TUNIC_CLAIM_SLIP = 1930; NOCT_DOUBLET_CLAIM_SLIP = 1931; CUSTOM_ARMOR_MALE_CLAIM_SLIP = 1932; CUSTOM_ARMOR_FEMALE_CLAIM_SLIP = 1933; MAGNA_ARMOR_MALE_CLAIM_SLIP = 1934; MAGNA_ARMOR_FEMALE_CLAIM_SLIP = 1935; WONDER_ARMOR_CLAIM_SLIP = 1936; SAVAGE_ARMOR_CLAIM_SLIP = 1937; ELDER_ARMOR_CLAIM_SLIP = 1938; LINEN_CLOAK_CLAIM_SLIP = 1939; PADDED_ARMOR_CLAIM_SLIP = 1940; SILVER_CHAINMAIL_CLAIM_SLIP = 1941; GAMBISON_CLAIM_SLIP = 1942; IRON_SCALE_ARMOR_CLAIM_SLIP = 1943; CUIR_ARMOR_CLAIM_SLIP = 1944; VELVET_ROBE_CLAIM_SLIP = 1945; OPALINE_DRESS_CLAIM_SLIP = 1946; RYLSQR_CHAINMAIL_CLAIM_SLIP = 1947; PLATE_ARMOR_CLAIM_SLIP = 1948; COMBAT_CASTERS_CLOAK_CLAIM_SLIP = 1949; ALUMINE_HAUBERT_CLAIM_SLIP = 1950; CARAPACE_HARNESS_CLAIM_SLIP = 1951; BANDED_MAIL_CLAIM_SLIP = 1952; HARA_ATE_CLAIM_SLIP = 1953; RAPTOR_ARMOR_CLAIM_SLIP = 1954; STEEL_SCALE_CLAIM_SLIP = 1955; WOOL_GAMBISON_CLAIM_SLIP = 1956; SHINOBI_GI_CLAIM_SLIP = 1957; IRNMSK_CUIRASS_CLAIM_SLIP = 1958; TCTMGC_CLOAK_CLAIM_SLIP = 1959; WHITE_CLOAK_CLAIM_SLIP = 1960; AUSTERE_ROBE_CLAIM_SLIP = 1961; MYTHRIL_PLATE_ARMOR_CLAIM_SLIP = 1962; CROW_JUPON_CLAIM_SLIP = 1963; MAGUS_ATTIRE_CLAIM_SLIP = 1964; CORSAIRS_ATTIRE_CLAIM_SLIP = 1965; PUPPETRY_ATTIRE_CLAIM_SLIP = 1966; DANCERS_ATTIRE_CLAIM_SLIP = 1967; DANCERS_ATTIRE_CLAIM_SLIP = 1968; SCHOLARS_ATTIRE_CLAIM_SLIP = 1969; AMIR_ARMOR_CLAIM_SLIP = 1970; PAHLUWAN_ARMOR_CLAIM_SLIP = 1971; YIGIT_ARMOR_CLAIM_SLIP = 1972; FROG_FISHING = 1976; SERPENT_RUMORS = 1977; MOOCHING = 1978; ANGLERS_ALMANAC = 1979; SPIFFY_SYNTH1 = 1980; SPIFFY_SYNTH2 = 1981; SPIFFY_SYNTH3 = 1982; SPIFFY_SYNTH4 = 1983; WOOD_PURIFICATION = 1984; WOOD_ENSORCELLMENT = 1985; LUMBERJACK = 1986; BOLTMAKER = 1987; WAY_OF_THE_CARPENTER = 1988; SPIFFY_SYNTH5 = 1989; SPIFFY_SYNTH6 = 1990; SPIFFY_SYNTH7 = 1991; METAL_PURIFICATION = 1992; METAL_ENSORCELLMENT = 1993; CHAINWORK = 1994; SHEETING = 1995; WAY_OF_THE_BLACKSMITH = 1996; SPIFFY_SYNTH8 = 1997; SPIFFY_SYNTH9 = 1998; SPIFFY_SYNTH10 = 1999; GOLD_PURIFICATION = 2000; GOLD_ENSORCELLMENT = 2001; CLOCKMAKING = 2002; WAY_OF_THE_GOLDSMITH = 2003; SPIFFY_SYNTH11 = 2004; SPIFFY_SYNTH12 = 2005; SPIFFY_SYNTH13 = 2006; SPIFFY_SYNTH14 = 2007; CLOTH_PURIFICATION = 2008; CLOTH_ENSORCELLMENT = 2009; SPINNING = 2010; FLETCHING = 2011; WAY_OF_THE_WEAVER = 2012; SPIFFY_SYNTH15 = 2013; SPIFFY_SYNTH16 = 2014; SPIFFY_SYNTH17 = 2015; LEATHER_PURIFICATION = 2016; LEATHER_ENSORCELLMENT = 2017; TANNING = 2018; WAY_OF_THE_TANNER = 2019; SPIFFY_SYNTH18 = 2020; SPIFFY_SYNTH19 = 2021; SPIFFY_SYNTH20 = 2022; SPIFFY_SYNTH21 = 2023; BONE_PURIFICATION = 2024; BONE_ENSORCELLMENT = 2025; FILING = 2026; WAY_OF_THE_BONEWORKER = 2027; SPIFFY_SYNTH22 = 2028; SPIFFY_SYNTH23 = 2029; SPIFFY_SYNTH24 = 2030; SPIFFY_SYNTH25 = 2031; ANIMA_SYNTHESIS = 2032; ALCHEMIC_PURIFICATION = 2033; ALCHEMIC_ENSORCELLMENT = 2034; TRITURATION = 2035; CONCOCTION = 2036; IATROCHEMISTRY = 2037; MIASMAL_COUNTERAGENT_RECIPE = 2038; WAY_OF_THE_ALCHEMIST = 2039; RAW_FISH_HANDLING = 2040; NOODLE_KNEADING = 2041; PATISSIER = 2042; STEWPOT_MASTERY = 2043; WAY_OF_THE_CULINARIAN = 2044; SPIFFY_SYNTH26 = 2045; SPIFFY_SYNTH27 = 2046; SPIFFY_SYNTH28 = 2047; VOIDWATCH_ALARUM = 2048; VOIDWATCHERS_EMBLEM_JEUNO = 2049; VOIDWATCHERS_EMBLEM_QUFIM = 2050; LOADSTONE = 2051; SOUL_GEM = 2052; SOUL_GEM_CLASP = 2053; TRICOLOR_VOIDWATCHERS_EMBLEM = 2054; STARLIGHT_VOIDWATCHERS_EMBLEM = 2055; RED_PRESENT = 2056; BLUE_PRESENT = 2057; GREEN_PRESENT = 2058; HEART_OF_THE_BUSHIN = 2059; HYACINTH_STRATUM_ABYSSITE = 2060; HYACINTH_STRATUM_ABYSSITE_II = 2061; AMBER_STRATUM_ABYSSITE = 2062; AMBER_STRATUM_ABYSSITE_II = 2063; CLAIRVOY_ANT = 2064; KUPOFRIEDS_CORUNDUM = 2065; KUPOFRIEDS_CORUNDUM = 2066; KUPOFRIEDS_CORUNDUM = 2067; BRONZE_ASTRARIUM = 2068; SILVER_ASTRARIUM = 2069; MYTHRIL_ASTRARIUM = 2070; GOLD_ASTRARIUM = 2071; PLATINUM_ASTRARIUM = 2072; DEMONS_IN_THE_RYE_CHRONICLE = 2073; MONSTROUS_MAYHEM_REPORT = 2074; CULLING_IS_CARING_POSTER = 2075; MERRY_MOOGLE_MEMORIAL_GUIDE = 2076; CONNORS_COMMUNIQUE = 2077; PERNICIOUS_PRESENTS_BRIEF = 2078; LITTLE_GOBLINS_ADVENTURE_VOL1 = 2079; LITTLE_GOBLINS_ADVENTURE_VOL2 = 2080; LITTLE_GOBLINS_ADVENTURE_VOL3 = 2081; LITTLE_GOBLINS_ADVENTURE_VOL4 = 2082; LITTLE_GOBLINS_ADVENTURE_VOL5 = 2083; LITTLE_GOBLINS_ADVENTURE_VOL6 = 2084; LITTLE_GOBLINS_ADVENTURE_VOL7 = 2085; LITTLE_GOBLINS_ADVENTURE_VOL8 = 2086; VANADIEL_TRIBUNE_VOL00 = 2087; VANADIEL_TRIBUNE_VOL01 = 2088; VANADIEL_TRIBUNE_VOL02 = 2089; VANADIEL_TRIBUNE_VOL03 = 2090; VANADIEL_TRIBUNE_VOL04 = 2091; VANADIEL_TRIBUNE_VOL05 = 2092; VANADIEL_TRIBUNE_VOL06 = 2093; VANADIEL_TRIBUNE_VOL07 = 2094; VANADIEL_TRIBUNE_VOL08 = 2095; VANADIEL_TRIBUNE_VOL09 = 2096; VANADIEL_TRIBUNE_VOL10 = 2097; VANADIEL_TRIBUNE_VOL11 = 2098; VANADIEL_TRIBUNE_VOL12 = 2099; VANADIEL_TRIBUNE_VOL13 = 2100; VANADIEL_TRIBUNE_VOL15 = 2102; VANADIEL_TRIBUNE_VOL16 = 2103; VANADIEL_TRIBUNE_VOL17 = 2104; VANADIEL_TRIBUNE_VOL18 = 2105; VANADIEL_TRIBUNE_VOL19 = 2106; VANADIEL_TRIBUNE_VOL20 = 2107; VANADIEL_TRIBUNE_VOL21 = 2108; VANADIEL_TRIBUNE_VOL22 = 2109; VANADIEL_TRIBUNE_VOL23 = 2110; VANADIEL_TRIBUNE_VOL24 = 2111; VANADIEL_TRIBUNE_VOL25 = 2112; VANADIEL_TRIBUNE_VOL26 = 2113; VANADIEL_TRIBUNE_VOL27 = 2114; VANADIEL_TRIBUNE_II_NO01 = 2115; VANADIEL_TRIBUNE_II_NO02 = 2116; VANADIEL_TRIBUNE_II_NO03 = 2117; VANADIEL_TRIBUNE_II_NO04 = 2118; VANADIEL_TRIBUNE_II_NO05 = 2119; VANADIEL_TRIBUNE_II_NO06 = 2120; VANADIEL_TRIBUNE_II_NO07 = 2121; VANADIEL_TRIBUNE_II_NO08 = 2122; VANADIEL_TRIBUNE_II_NO09 = 2123; VANADIEL_TRIBUNE_II_NO10 = 2124; VANADIEL_TRIBUNE_II_NO11 = 2125; VANADIEL_TRIBUNE_II_NO12 = 2126; VANADIEL_TRIBUNE_II_NO13 = 2127; VANADIEL_TRIBUNE_II_NO14 = 2128; VANADIEL_TRIBUNE_II_NO15 = 2129; VANADIEL_TRIBUNE_II_NO16 = 2130; HANDCRAFTED_SPATULA = 2131; TRANSMUTED_CANDLE = 2132; GOURMET_WHIPPED_CREAM = 2133; ANCIENT_PAPYRUS_SHRED1 = 2134; ANCIENT_PAPYRUS_SHRED2 = 2135; ANCIENT_PAPYRUS_SHRED3 = 2136; EXORAY_MOLD_CRUMB1 = 2137; EXORAY_MOLD_CRUMB2 = 2138; EXORAY_MOLD_CRUMB3 = 2139; BOMB_COAL_FRAGMENT1 = 2140; BOMB_COAL_FRAGMENT2 = 2141; BOMB_COAL_FRAGMENT3 = 2142; SHINING_FRAGMENT = 2143; GLOSSY_FRAGMENT = 2144; GRIMOIRE_PAGE = 2145; MOBLIN_PHEROMONE_SACK = 2146; GOLDEN_WING = 2147; MOSS_COVERED_SHARD = 2148; ESSENCE_OF_PERFERVIDITY = 2149; BRANDED_WING = 2150; MALICIOUS_HORN = 2151; SHEET_OF_SAN_DORIAN_TUNES = 2152; SHEET_OF_BASTOKAN_TUNES = 2153; SHEET_OF_WINDURSTIAN_TUNES = 2154; GEOMAGNETRON = 2155; ADOULINIAN_CHARTER_PERMIT = 2156; PIONEERS_BADGE = 2157; TEMPORARY_GEOMAGNETRON = 2158; AGED_MATRIARCH_NAAKUAL_CREST = 2159; AGED_RIPTIDE_NAAKUAL_CREST = 2160; AGED_FIREBRAND_NAAKUAL_CREST = 2161; AGED_LIGNEOUS_NAAKUAL_CREST = 2162; AGED_BOOMING_NAAKUAL_CREST = 2163; AGED_FLASHFROST_NAAKUAL_CREST = 2164; PROTOTYPE_ATTUNER = 2166; WATERCRAFT = 2167; RESTRAINMENT_RESILIENCE = 2171; CUPFUL_OF_DUST_LADEN_SAP = 2179; MANTID_BAIT = 2180; VIAL_OF_TOXIC_ZOLDEFF_WATER = 2185; FISTFUL_OF_PRISTINE_SAND = 2186; RIME_ICE_FRAGMENT = 2190; BROKEN_HARPOON = 2192; EXTRAVAGANT_HARPOON = 2193; GEOMAGNETIC_COMPASS = 2196; OCULAR_ORB = 2197; PILE_OF_NOXIOUS_GRIME = 2198; PULSATING_SHARD = 2199; DINNER_INVITATION = 2200; ROCKBERRY1 = 2201; ROCKBERRY2 = 2202; ROCKBERRY3 = 2203; LOGGING = 2204; WATERCRAFTING = 2205; DEMOLISHING = 2206; TOXIN_RESILIENCE = 2207; PARESIS_RESILIENCE = 2208; CALOR_RESILIENCE = 2209; HEN_FS_BUILDING_MAT_CONTAINER = 2210; MOR_FS_BUILDING_MAT_CONTAINER = 2211; HEN_FS_RESOURCE_CONTAINER = 2212; MOR_FS_RESOURCE_CONTAINER = 2213; CEI_FB_OP_MATERIALS_CONTAINER = 2214; HEN_FB_OP_MATERIALS_CONTAINER = 2215; MOR_FB_OP_MATERIALS_CONTAINER = 2216; LOST_ARTICLE1 = 2217; LOST_ARTICLE2 = 2218; FLAYED_MANTID_CORPSE = 2220; CHAPULI_HORN = 2221; HOT_SPRING_REPORT_1 = 2225; HOT_SPRING_REPORT_2 = 2226; HOT_SPRING_REPORT_3 = 2227; HOT_SPRING_REPORT_4 = 2228; HOT_SPRING_REPORT_5 = 2229; MAGMA_SURVEY_REPORT = 2232; REIVE_UNITY = 2234; CRITICAL_CHOP = 2236; CHERISHED_AXE = 2237; CRITICAL_SMASH = 2238; CHERISHED_PICK = 2239; CRITICAL_SLICE = 2240; CHERISHED_SICKLE = 2241; SAN_DORIA_WARP_RUNE = 2248; BASTOK_WARP_RUNE = 2249; WINDURST_WARP_RUNE = 2250; SELBINA_WARP_RUNE = 2251; MHAURA_WARP_RUNE = 2252; KAZHAM_WARP_RUNE = 2253; RABAO_WARP_RUNE = 2254; NORG_WARP_RUNE = 2255; TAVNAZIA_WARP_RUNE = 2256; WHITEGATE_WARP_RUNE = 2257; NASHMAU_WARP_RUNE = 2258; RUSTED_PICKAXE = 2261; TINY_SEED = 2262; BOTTLE_OF_FERTILIZER_X = 2263; WAYPOINT_SCANNER_KIT = 2264; ROYAL_FIAT_BANNING_COLONIZATION = 2265; RECORD_OF_THE_17TH_ASSEMBLY = 2266; COPY_OF_THE_ALLIANCE_AGREEMENT = 2267; ULBUKAN_NAVIGATION_CHART = 2268; COPY_OF_ADOULINS_PATRONESS = 2269; MEMO_FROM_MIDRAS = 2270; CIDS_CATALYST = 2271; CHUNK_OF_MILKY_WHITE_MINERALS = 2272; FAIL_BADGE = 2273; WESTERN_ADOULIN_PATROL_ROUTE = 2274; MISDELIVERED_PARCEL = 2275; EASTERN_ADOULIN_PATROL_ROUTE = 2276; HOT_SPRINGS_CARE_PACKAGE = 2277; FISTFUL_OF_HOMELAND_SOIL = 2278; YAHSE_WILDFLOWER_PETAL = 2279; HABITUAL_BEHAVIOR_BAROMETER = 2280; BRIER_PROOF_NET = 2281; COMPASS_OF_TRANSFERENCE = 2282; MAGMA_MITIGATION_SET = 2283; RESURRECTION_RETARDANT_AXE = 2284; INSULATOR_TABLET = 2285; ANTI_GLACIATION_GEAR = 2286; LAND_OF_MILK_AND_HONEY_HIVE = 2288; FULL_LAND_OF_MILK_AND_HONEY_HIVE = 2289; LUOPAN = 2290; RALA_SIMULACRUM = 2291; YORCIA_SIMULACRUM = 2292; CIRDAS_SIMULACRUM = 2293; RAKAZNAR_SIMULACRUM = 2294; CELADON_YANTRIC_PLANCHETTE = 2296; ZAFFRE_YANTRIC_PLANCHETTE = 2297; ALIZARIN_YANTRIC_PLANCHETTE = 2298; DETACHED_STINGER = 2299; CRAGGY_FIN = 2300; FLAME_SCARRED_SKULL = 2301; MAP_OF_RALA_WATERWAYS_U = 2302; MAP_OF_YORCIA_WEALD_U = 2303; MAP_OF_CIRDAS_CAVERNS_U = 2304; MAP_OF_OUTER_RAKAZNAR_U = 2305; MOG_KUPON_A_DEII = 2334; MOG_KUPON_A_DE = 2335; MOG_KUPON_A_SAL = 2336; MOG_KUPON_A_NYZ = 2337; MOG_KUPON_I_S5 = 2338; MOG_KUPON_I_S2 = 2339; MOG_KUPON_I_ORCHE = 2340; SHEET_OF_E_ADOULINIAN_TUNES = 2341; SHEET_OF_W_ADOULINIAN_TUNES = 2342; HENNEBLOOM_LEAF = 2343; IMPURE_CELADON_YGGZI = 2344; SEMI_PURE_CELADON_YGGZI = 2345; IMPURE_ZAFFRE_YGGZI = 2346; SEMI_PURE_ZAFFRE_YGGZI = 2347; IMPURE_ALIZARIN_YGGZI = 2348; SEMI_PURE_ALIZARIN_YGGZI = 2349; RING_OF_SUPERNAL_DISJUNCTION = 2350; EPHEMERAL_ENDEAVOR = 2352; ENLIGHTENED_ENDEAVOR = 2353; RUNE_SABER = 2354; FLASK_OF_FRUISERUM = 2355; FROST_ENCRUSTED_FLAME_GEM = 2356; LETTER_FROM_OCTAVIEN = 2357; STONE_OF_IGNIS = 2358; STONE_OF_GELUS = 2359; STONE_OF_FLABRA = 2360; STONE_OF_TELLUS = 2361; STONE_OF_SULPOR = 2362; STONE_OF_UNDA = 2363; STONE_OF_LUX = 2364; STONE_OF_TENEBRAE = 2365; STONE_OF_UNKNOWN_RUNIC_ORIGINS1 = 2366; STONE_OF_UNKNOWN_RUNIC_ORIGINS2 = 2367; STONE_OF_UNKNOWN_RUNIC_ORIGINS3 = 2368; SECRETS_OF_RUNIC_ENHANCEMENT = 2369; RUNIC_KINEGRAVER = 2370; VIAL_OF_VIVID_RAINBOW_EXTRACT = 2371; INSIDIOS_EXTINGUISHED_LANTERN = 2372; VESSEL_OF_SUMMONING = 2373; SILVER_LUOPAN = 2374; LHAISO_NEFTEREHS_BELL = 2375; MIDRASS_EXPLOSIVE_SAMPLE = 2376; REPORT_ON_MIDRASS_EXPLOSIVE = 2377; TRAY_OF_ADOULINIAN_DELICACIES = 2378; SMALL_BAG_OF_ADOULINIAN_DELICACIES = 2379; WAYPOINT_RECALIBRATION_KIT = 2380; TWELVE_ORDERS_DOSSIER = 2381; RAVINE_WATER_TESTING_KIT = 2382; FISTFUL_OF_NUMBING_SOIL = 2383; HUNK_OF_BEDROCK = 2384; YORCIAS_TEAR = 2385; BLIGHTBERRY = 2386; LARGE_STRIP_OF_VELKK_HIDE = 2387; CLIMBING = 2388; BOX_OF_ADOULINIAN_TOMATOES = 2389; KALEIDOSCOPIC_CLAM = 2390; GLASS_PENDULUM = 2391; IVORY_WING_TALISMAN = 2393; BRONZE_MATTOCK_CORDON = 2394; BRONZE_SHOVEL_CORDON = 2395; TARUTARU_SAUCE_INVOICE = 2396; TARUTARU_SAUCE_RECEIPT = 2397; GPS_CRYSTAL = 2398; PAIR_OF_VELKK_GLOVES = 2399; LOST_ARTICLE1 = 2400; LOST_ARTICLE2 = 2401; GEOMANCER_CLAIM_TICKET = 2402; MAR_FB_OP_MATERIALS_CONTAINER = 2403; YOR_FB_OP_MATERIALS_CONTAINER = 2404; MAR_FS_BUILDING_MAT_CONTAINER = 2405; YOR_FS_BUILDING_MAT_CONTAINER = 2406; PROOF_OF_ORDER_RUNIC_HEADGEAR1 = 2407; PROOF_OF_ORDER_RUNIC_HANDGEAR2 = 2408; PROOF_OF_ORDER_RUNIC_FOOTGEAR4 = 2409; ROSULATIAS_POME = 2410; CELENNIA_MEMORIAL_LIBRARY_CARD = 2411; SOWYOURSEED = 2412; MY_FIRST_FURROW = 2413; FIELDS_AND_FERTILIZING = 2414; DESIGNER_FARMING = 2415; HOMESTEADERS_COMPENDIUM = 2416; MHMU_TREATISE_ON_AGRONOMY = 2417; GIVE_MY_REGARDS_TO_REODOAN = 2419; ADOULINS_TOPIARY_TREASURES = 2420; GRANDILOQUENT_GROVES = 2421; ARBOREAL_ABRACADABRA = 2422; VERDANT_AND_VERDONTS = 2423; MHMU_TREATISE_ON_FORESTRY = 2424; MYTHRIL_MARATHON_QUARTERLY = 2426; TAKE_A_LODE_OFF = 2427; VARICOSE_MINERAL_VEINS = 2428; TALES_FROM_THE_TUNNEL = 2429; THE_GUSGEN_MINES_TRAGEDY = 2430; MHMU_TREATISE_ON_MINERALOGY = 2431; A_FAREWELL_TO_FRESHWATER = 2433; WATER_WATER_EVERYWHERE = 2434; DREDGINGS_NO_DRUDGERY = 2435; ALL_THE_WAYS_TO_SKIN_A_CARP = 2436; ANATOMY_OF_AN_ANGLER = 2437; MHMU_TREATISE_ON_FISH_I = 2438; THE_OLD_MEN_OF_THE_SEA = 2440; BLACK_FISH_OF_THE_FAMILY = 2442; TWENTY_THOUSAND_YALMS_UNDER_THE_SEA = 2443; ENCYCLOPEDIA_ICTHYONNICA = 2444; MHMU_TREATISE_ON_FISH_II = 2445; MAR_FS_RESOURCE_CONTAINER = 2447; YOR_FS_RESOURCE_CONTAINER = 2448; NOTE_DETAILING_SEDITIOUS_PLANS = 2449; WATERWAY_FACILITY_CRANK = 2450; VIAL_OF_TRANSLURRY = 2451; GIL_REPOSITORY = 2452; CRAB_CALLER = 2453; PIECE_OF_A_STONE_WALL = 2454; VIAL_OF_UNTAINTED_HOLY_WATER = 2455; ETERNAL_FLAME = 2456; WEATHER_VANE_WINGS = 2457; AUREATE_BALL_OF_FUR = 2458; INVENTORS_COALITION_PICKAXE = 2459; TINTINNABULUM = 2460; FRAGMENTING = 2461; PAIR_OF_FUZZY_EARMUFFS = 2462; KAM_FB_OP_MATERIALS_CONTAINER = 2463; KAM_FS_BUILDING_MAT_CONTAINER = 2464; KAM_FS_RESOURCE_CONTAINER = 2465; MEMORANDOLL = 2466; SHADOW_LORD_PHANTOM_GEM = 2468; CELESTIAL_NEXUS_PHANTOM_GEM = 2469; STELLAR_FULCRUM_PHANTOM_GEM = 2470; PHANTOM_GEM_OF_APATHY = 2471; PHANTOM_GEM_OF_ARROGANCE = 2472; PHANTOM_GEM_OF_ENVY = 2473; PHANTOM_GEM_OF_COWARDICE = 2474; PHANTOM_GEM_OF_RAGE = 2475; P_PERPETRATOR_PHANTOM_GEM = 2476; COPPER_AMAN_VOUCHER = 2477; MATRIARCH_NAAKUAL_PARAGON = 2482; RIPTIDE_NAAKUAL_PARAGON = 2483; FIREBRAND_NAAKUAL_PARAGON = 2484; LIGNEOUS_NAAKUAL_PARAGON = 2485; BOOMING_NAAKUAL_PARAGON = 2486; FLASHFROST_NAAKUAL_PARAGON = 2487; MOG_KUPON_I_AF109 = 2489; MOG_KUPON_W_EWS = 2490; MOG_KUPON_AW_WK = 2491; MOG_KUPON_I_S3 = 2492; MOG_KUPON_A_PK109 = 2493; MOG_KUPON_I_S1 = 2494; MOG_KUPON_I_SKILL = 2495; GREEN_INSTITUTE_CARD = 2496; WINDURST_TRUST_PERMIT = 2497; BLUE_INSTITUTE_CARD = 2498; BASTOK_TRUST_PERMIT = 2499; RED_INSTITUTE_CARD = 2500; SAN_DORIA_TRUST_PERMIT = 2501; MOG_KUPON_I_RME = 2502; PULVERIZING = 2503; LERENES_PATEN = 2504; AMCHUCHUS_MISSIVE = 2505; TEMPLE_KNIGHT_KEY = 2506; UNBLEMISHED_PIONEERS_BADGE = 2507; SILVERY_PLATE = 2508; SOUL_SIPHON = 2509; TAPESTRY_OF_BAGUA_POETRY = 2511; FUTHARKIC_CONCEPTS_IN_FLUX = 2512; CRYSTALLIZED_LIFESTREAM_ESSENCE = 2513; STRAND_OF_RAKAZNAR_FILAMENT = 2514; ORDER_SLIP_LIFESTREAM_HEADGEAR = 2515; ORDER_SLIP_LIFESTREAM_BODYGEAR = 2516; ORDER_SLIP_LIFESTREAM_HANDGEAR = 2517; ORDER_SLIP_LIFESTREAM_LEGGEAR = 2518; ORDER_SLIP_LIFESTREAM_FOOTGEAR = 2519; ORDER_SLIP_LOGOMORPH_HEADGEAR = 2520; ORDER_SLIP_LOGOMORPH_BODYGEAR = 2521; ORDER_SLIP_LOGOMORPH_HANDGEAR = 2522; ORDER_SLIP_LOGOMORPH_LEGGEAR = 2523; ORDER_SLIP_LOGOMORPH_FOOTGEAR = 2524; PRISTINE_HAIR_RIBBON = 2525; VIAL_OF_TRANSMELANGE = 2526; LOST_ARTICLE = 2527; BREATH_OF_DAWN = 2528; PHLOX_YANTRIC_PLANCHETTE = 2529; RUSSET_YANTRIC_PLANCHETTE = 2530; ASTER_YANTRIC_PLANCHETTE = 2531; SPARKING_TAIL_FEATHER = 2532; PIECE_OF_INVIOLABLE_BARK = 2533; FROSTED_INCISOR = 2534; IMPURE_PHLOX_YGGZI = 2535; SEMI_PURE_PHLOX_YGGZI = 2536; IMPURE_RUSSET_YGGZI = 2537; SEMI_PURE_RUSSET_YGGZI = 2538; IMPURE_ASTER_YGGZI = 2539; SEMI_PURE_ASTER_YGGZI = 2540; BREATH_OF_DAWN1 = 2541; BREATH_OF_DAWN2 = 2542; BREATH_OF_DAWN3 = 2543; JOB_BREAKER = 2544;
gpl-3.0
degarashi/resonant
resource/sys_script/Camera3D.lua
1
1164
require("sysfunc") return { -- 実行時調整可能な値定義 _variable = { -- 変数名 fov = { -- 値をどのように適用するか -- self: ターゲットオブジェクトハンドル -- value: セットする値 (number or Vec[2-4]) apply = function(self, value) self:setFov(Degree.New(value)) end, -- 値操作の方式 manip = "linear", -- 一回の操作で加える量 step = 1, -- デフォルト値 value = 60 }, nearz = { apply = function(self, value) self:setNearZ(value) end, manip = "linear", step = 1, value = 1 }, farz = { -- 文字列なら同名のcpp関数をそのまま呼ぶ仕様 apply = "setFarZ", manip = "exp", step = 1, base = 2, value = 100 }, offset = { apply = function(self, value) local pose = self:refPose() pose:setOffset(value) end, manip = "linear", step = 1, value = {1,0,1} } }, _renamefunc = RS.RenameFunc( {"setPose", "setPose<spn::Pose3D>"}, {"setFov", "setFov<spn::RadF>"}, {"setAspect", "setAspect<float>"}, {"setNearZ", "setNearZ<float>"}, {"setFarZ", "setFarZ<float>"} ) }
mit
dromozoa/dromozoa-json
dromozoa/json/is_array.lua
4
1067
-- Copyright (C) 2015 Tomoyuki Fujimori <moyu@dromozoa.com> -- -- This file is part of dromozoa-json. -- -- dromozoa-json 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 3 of the License, or -- (at your option) any later version. -- -- dromozoa-json 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 dromozoa-json. If not, see <http://www.gnu.org/licenses/>. local floor = math.floor return function (t) local m = 0 local n = 0 for k, v in pairs(t) do if type(k) == "number" and k > 0 and floor(k) == k then if m < k then m = k end n = n + 1 else return nil end end if m <= n * 2 then return m else return nil end end
gpl-3.0
ffxiphoenix/darkstar
scripts/zones/Southern_San_dOria/npcs/Phamelise.lua
30
2057
----------------------------------- -- Area: Southern San d'Oria -- NPC: Phamelise -- Only sells when San d'Oria controlls Zulkheim Region ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/events/harvest_festivals"); require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/globals/conquest"); require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script if (player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE) == 1) then if (trade:hasItemQty(532,1) == true and trade:getItemCount() == 1) then player:messageSpecial(FLYER_REFUSED); end else onHalloweenTrade(player,trade,npc); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) RegionOwner = GetRegionOwner(ZULKHEIM); if (RegionOwner ~= SANDORIA) then player:showText(npc,PHAMELISE_CLOSED_DIALOG); else player:showText(npc,PHAMELISE_OPEN_DIALOG); stock = {0x1114,44, --Giant Sheep Meat 0x026e,44, --Dried Marjoram 0x0262,55, --San d'Orian Flour 0x0263,36, --Rye Flour 0x0730,1840, --Semolina 0x110e,22, --La Theine Cabbage 0x111a,55} --Selbina Milk showShop(player,SANDORIA,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
vilarion/Illarion-Content
monster/race_0_human/base.lua
5
2448
--[[ Illarion Server 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 (at your option) 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/>. ]] local base = require("monster.base.base") local messages = require("base.messages") --Random Messages local msgs = messages.Messages() msgs:addMessage("#me flucht vor sich hin.", "#me swears to himself.") msgs:addMessage("#me grinst siegessicher.", "#me grins, certain of success.") msgs:addMessage("#me ist in Schweiß gebadet.", "#me is bathed in sweat.") msgs:addMessage("#me lacht laut.", "#me laughs.") msgs:addMessage("#me spuckt auf den Boden.", "#me spits at the ground.") msgs:addMessage("#me tippelt hin und her.", "#me hops on the spot.") msgs:addMessage("Achtung! Alarm!", "Careful! Alert!") msgs:addMessage("Das war's!", "That does it!") msgs:addMessage("Die Leute werden auch immer schwächer!", "People get weaker every day!") msgs:addMessage("Dieses Gebiet gehört mir!", "This area belongs to me!") msgs:addMessage("Ein Drache ist nichts gegen mich!", "A dragon is nothing compared to me!") msgs:addMessage("Fressen oder gefressen werden, so läuft das.", "Kill or be killed, that's the way it is") msgs:addMessage("Für die Götter!", "For the gods!") msgs:addMessage("Geld oder Leben!", "Money or life!") msgs:addMessage("Heute ist ein guter Tag zum Töten.", "This day is a good day for killing.") msgs:addMessage("Ich bin der Stärkste!", "I am the strongest!") msgs:addMessage("Ich zerquetsche jeden Feind wie 'ne kleine Fee!", "I crush every enemy like a little fairy!") msgs:addMessage("Niemand wird mich je besiegen!", "No one will ever defeat me!") msgs:addMessage("Rollende Köpfe sind immer eine schöne Abwechslung.", "Rolling heads are always welcome.") msgs:addMessage("Verboten!", "Verboten!") msgs:addMessage("Wer wagt es mich zu stören?", "Who dares to bother me?") local M = {} function M.generateCallbacks() return base.generateCallbacks(msgs) end return M
agpl-3.0
vilarion/Illarion-Content
npc/base/basic.lua
1
19153
--[[ Illarion Server 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 (at your option) 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/>. ]] --- Base NPC script for basic NPCs -- -- This script bundles the functions the most other specific components of the -- NPC require to work. Its the basic script of the NPC framework and the only -- one that requires regular from the actual NPC script. -- -- Author: Martin Karing local common = require("base.common") local class = require("base.class") local mutedNPCs = {} local langCodeToSkill local displayLanguageConfusion local isAdminOnField --- Constructor for the baseNPC. This does not take any paramters. -- -- The sole purpose is to prepare all required values in the NPC script. local baseNPC = class(function(self) --- Constant for the state value of the NPC. --- If this constant is set the NPC is currently in the normal mode. self.stateNormal = 0 --- Constant for the state value of the NPC. --- If this constant is set the NPC is currently busy talking with a specified --- character and is not to walk around or anything like this. self.stateBusyTalking = 1 -- The state of the NPC. This value can be used to have the special parts -- of the NPC communicating with each other. self["state"] = self.stateNormal -- The cycle functions are called during the next cycle method of this base -- NPC struct. Each special NPC class is able to register functions in this -- class. self["_cycleFunctions"] = nil -- The receive text functions are called during the receive text method of -- the NPC. Each special NPC class is able to register functions in this -- class. self["_receiveTextFunctions"] = nil -- The cycle counter counts the calls of the next cycle method in order to -- find out when to execute the next time all the next cycle methods. This -- is used to reduce the server load caused by this method. self["_cycleCounter"] = 0 -- This variable stores then to call the cycle methods the next time in -- order to execute all functions of the NPC properly. self["_nextCycleCalls"] = 0 -- This variable holds a list that stores the constants of the languages -- the NPC is able to use. self["_npcLanguages"] = {} -- This variable holds the amount of languages added to the list of -- languages of this NPC. self["_npcLanguageCount"] = 0 -- This variable stores the language the NPC is expected to use by default. self["_defaultLanguage"] = 0 -- This variable stores the german lookAt message of the NPC. self["_lookAtMsgDE"] = "" -- This variable stores the english lookAt message of the NPC. self["_lookAtMsgUS"] = "" -- This variable stores the german message that is said by the NPC in case -- the player performs a use operation on the NPC. self["_useMsgDE"] = "" -- This variable stores the english message that is said by the NPC in case -- the player performs a use operation on the NPC. self["_useMsgUS"] = "" -- This variable stores the german message that is shown in case the players -- talk to the NPC in a language the NPC does not understand. self["_confusedDE"] = "" -- This variable stores the english message that is shown in case the -- players talk to the NPC in a language the NPC does not understand. self["_confusedUS"] = "" -- This list is used to store the equipment that shall be set to the NPC at -- the first run. Once the equipment is set, the list is destroyed. self["_equipmentList"] = {} -- The town this NPC is affiliated to. self["_affiliation"] = 0 end) --- This method adds one function to the functions that are called during the --- next cycles. -- -- @param receiver the receiver is a object that defines a nextCycle function -- that is called in given time intervals. The only paramter -- of this function is the time since the last call. The return -- value has to be the time when the next call of this function -- is expected. Its possible that the function is called ealier -- but not later. function baseNPC:addCycle(receiver) if (type(receiver) ~= "table") then return end if (type(receiver.nextCycle) ~= "function") then return end if (self._cycleFunctions == nil) then self._cycleFunctions = {} end table.insert(self._cycleFunctions, receiver) end --- This method adds one function to the functions that are called during when --- a text is received by the NPC. -- -- @param receiver the receiver is a object that defines a receiveText function -- that is called all times the basic npc receives a text. The -- receive text function has to take as first paramter the -- character who is talking and as second parameter the text -- that was spoken. In case the receiveText function returns -- true the spoken text is not forwarded to any more possible -- receivers. function baseNPC:addRecvText(receiver) if (type(receiver) ~= "table") then return end if (type(receiver.receiveText) ~= "function") then return end if (self._receiveTextFunctions == nil) then self._receiveTextFunctions = {} end table.insert(self._receiveTextFunctions, receiver) end --- This method has to be called during each next cycle call of an NPC. It --- manages and calls the functions registered this NPC. This function will be --- removed during its first call. Instead the function originally named --- baseNPC:nextCycle2() will take its place and serve its actual purpose. -- -- @param npcChar the NPC character function baseNPC:nextCycle(npcChar) if (self.initLanguages ~= nil) then self:initLanguages(npcChar) end if (self._equipmentList ~= nil) then local tempList = self._equipmentList self["_equipmentList"] = nil for _, value in pairs(tempList) do npcChar:createAtPos(value[1], value[2], 1) local item = npcChar:getItemAt(value[1]) item.wear = 255 item.quality = 999 world:changeItem(item) end end self.nextCycle = self.nextCycle2 self.nextCycle2 = nil end --- This method has to be called during each next cycle call of an NPC. It --- manages and calls the functions registered this NPC. This function will be --- copied to baseNPC:nextCycle() once the initialization is done. -- -- @param npcChar the NPC character function baseNPC:nextCycle2(npcChar) if (self._cycleFunctions == nil) then return end if isAdminOnField(npcChar.pos) then return end if (self._cycleCounter < self._nextCycleCalls) then self._cycleCounter = self._cycleCounter + 1 return end npcChar.activeLanguage = self._defaultLanguage local oldCycle = self._cycleCounter self._cycleCounter = 0 self._nextCycleCalls = 2147483648 local nextRequestedCall = 0 for _, value in pairs(self._cycleFunctions) do nextRequestedCall = value:nextCycle(npcChar, oldCycle) if (nextRequestedCall ~= nil and nextRequestedCall >= 0) then self._nextCycleCalls = math.min(self._nextCycleCalls, nextRequestedCall) end end end --- This method should be called at each call of the receive text method. This --- method will maintain all functions registered to this class and call them --- properly in case its needed. -- -- @param npcChar the NPC character -- @param textType the type that was used to send the text -- @param speaker the character struct who said some text -- @param text the text that was spoken -- @return true in case the text was handled properly by one of the receive text handlers function baseNPC:receiveText(npcChar, texttype, speaker, text) if not npcChar:isInRange(speaker, 2) then return false end if speaker:isAdmin() then local npcName = npcChar.name if string.find(text, "unmute") then mutedNPCs[npcChar.id] = nil speaker:inform("You unmute " .. npcName) return false elseif string.find(text, "mute") then mutedNPCs[npcChar.id] = true speaker:inform("You mute " .. npcName) return false end end if mutedNPCs[npcChar.id] == true then local npcName = npcChar.name speaker:inform(npcName .. " scheint heute nicht sehr gesprächig." , npcName .. " doesn't seem to be in a chatty mood today.") return false end if (self._receiveTextFunctions == nil) then return false end if isAdminOnField(npcChar.pos) then return false end if not npcChar:isInRange(speaker, 2) then return false end if (speaker.id == npcChar.id) then return false end if (speaker:getType() ~= 0) then return false end if not self:checkLanguageOK(speaker) then displayLanguageConfusion(npcChar, self) return false end npcChar.activeLanguage = speaker.activeLanguage text = string.lower(text) for _, value in pairs(self._receiveTextFunctions) do if (value:receiveText(npcChar, texttype, speaker, text)) then return true end end return false end --- This function checks if the language currently spoken by a character is --- valid to be used by this NPC. -- -- @param speak the character who is speaking -- @return true in case the NPC is able to speak the language of the player function baseNPC:checkLanguageOK(speaker) if (speaker.activeLanguage == self._defaultLanguage) then return true end for i=1, self._npcLanguageCount do if (speaker.activeLanguage == self._npcLanguages[i]) then return true end end return false end --- This function adds a language constant to the list of enabled languages of --- this NPC. -- -- @param langCode the code of the language the NPC is supposed to know function baseNPC:addLanguage(langCode) table.insert(self._npcLanguages, langCode) self._npcLanguageCount = self._npcLanguageCount + 1 end --- This function sets the language the NPC is supposed to use by default. The --- only case it is switching the language is, in case he answeres to a player --- talking in another language. -- -- @param langCode the code value of the language to use function baseNPC:setDefaultLanguage(langCode) self._defaultLanguage = langCode end --- This function sets the texts that are displayed when someone is looking at --- the NPC. -- -- @param german the german message -- @param english the english message function baseNPC:setLookat(german, english) self._lookAtMsgDE = german self._lookAtMsgUS = english end --- This function sets the text that are displayed when someone is using the --- NPC. -- -- @param german the german message -- @param english the english message function baseNPC:setUseMessage(german, english) self._useMsgDE = german self._useMsgUS = english end --- This function sets the text that is displayed in case a player is talking --- in the wrong language with the NPC. -- -- @param german the german message -- @param english the english message function baseNPC:setConfusedMessage(german, english) self._confusedDE = german self._confusedUS = english end --- This method handles the lookat requests that are send to the NPC. If set --- properly a message will be returned describing the appearance of the NPC. -- -- @param npcChar the NPC character -- @param char the character who is looking at the NPC -- @param mode the mode used to look at the NPC (no effect) function baseNPC:lookAt(npcChar, char, mode) char:sendCharDescription(npcChar.id, common.GetNLS(char, self._lookAtMsgDE, self._lookAtMsgUS)) end --- This method handles all use methods that are done to the NPC. When ever a --- NPC is used by the player this one is called. -- -- @param npcChar the NPC character -- @param char the character who is looking at the NPC -- @param mode the mode used to look at the NPC (no effect) function baseNPC:use(npcChar, char) if char:isAdmin() then local lastSpoken = char.lastSpokenText if string.find(string.lower(lastSpoken), "teleport") then local coords = {} for coord in lastSpoken:gmatch("%-?%d+") do table.insert(coords, tonumber(coord)) end if coords[1] and coords[2] and coords[3] then npcChar:forceWarp(position(coords[1], coords[2], coords[3])) end end end if mutedNPCs[npcChar.id] == true then local npcName = npcChar.name char:inform(npcName .. " scheint heute nicht sehr gesprächig." , npcName .. " doesn't seem to be in a chatty mood today.") return end if isAdminOnField(npcChar.pos) then return end npcChar.activeLanguage = self._defaultLanguage local getText = function(deText,enText) return common.GetNLS(char, deText, enText) end local callback = function(dialog) local success = dialog:getSuccess() if success then local selected = dialog:getSelectedIndex() if selected == 5 then --free input local callbackInput = function(dialogInput) if not dialogInput:getSuccess() then return; else local text = dialogInput:getInput() char:talk(Character.say, text, text) end end local dialogInput dialogInput = InputDialog(npcChar.name, getText("Über welches Thema möchtest du sprechen?","Select the topic you want to talk about."), false, 255, callbackInput) char:requestInputDialog(dialogInput) else local textDE={} local textEN={} textDE[0]="Seid gegrüßt." textEN[0]="Be greeted." textDE[1]="Ich benötige Hilfe." textEN[1]="Please help me." textDE[2]="Habt Ihr eine Aufgabe für mich?" textEN[2]="Do you have a task for me?" textDE[3]="Ich möchte Waren handeln." textEN[3]="I'd like to trade some goods." textDE[4]="Auf wiedersehen." textEN[4]="Farewell." char:talk(Character.say, getText(textDE[selected], textEN[selected])) end end end local dialog = SelectionDialog(npcChar.name, getText("Über welches Thema möchtest du sprechen?","Select the topic you want to talk about."), callback) dialog:setCloseOnMove() dialog:addOption(0, getText("Begrüßen", "Greetings")) dialog:addOption(0, getText("Hilfe", "Help")) dialog:addOption(0, getText("Quest", "Quest")) dialog:addOption(0, getText("Handel", "Trade")) dialog:addOption(0, getText("Verabschieden", "Farewell")) dialog:addOption(0, getText("(Etwas anderes)", "(Other)")) char:requestSelectionDialog(dialog) end --- This equipment sets the equipment an NPC gets at first start. This is needed --- so the NPC looks good with paperdolling. -- -- @param slot the slot the item is to be placed in -- @param item the item ID that shall be created function baseNPC:setEquipment(slot, item) table.insert(self["_equipmentList"], {slot, item}) end --- This function is used to set the affiliation of the NPC. -- -- @param affiliation the index of the town this NPC is assigned to function baseNPC:setAffiliation(affiliation) self["_affiliation"] = affiliation end --- This is a cleanup function that should be called once the initialization of --- the NPC is done. It will free the memory taken by all the functions that are --- needed to fill data into the NPC. function baseNPC:initDone() self["addCycle"] = nil self["addRecvText"] = nil self["addLanguageCode"] = nil self["setDefaultLanguage"] = nil self["setLookat"] = nil self["setUseMessage"] = nil self["setConfusedMessage"] = nil self["setEquipment"] = nil self["initDone"] = nil end function baseNPC:setAutoIntroduceMode(autointroduce) end --- This function learns the NPC the languages skills needed to work properly. --- Check if this function is not nil before you call it, because it destructs --- itself after it was called once. -- -- @param npcChar the NPC character function baseNPC:initLanguages(npcChar) for _, value in pairs(self._npcLanguages) do npcChar:increaseSkill(langCodeToSkill(value), 100) end self["initLanguages"] = nil end --- This function translates a language code value to the skill that belongs to --- this number. This skill name is needed to set the skill value of the NPC in --- so the NPC is able to talk in the needed language perfectly. -- -- @param langCode the language code -- @return the skill fitting to the language code function langCodeToSkill(langCode) if (langCode == 0) then return Character.commonLanguage elseif (langCode == 1) then return Character.humanLanguage elseif (langCode == 2) then return Character.dwarfLanguage elseif (langCode == 3) then return Character.elfLanguage elseif (langCode == 4) then return Character.lizardLanguage elseif (langCode == 5) then return Character.orcLanguage elseif (langCode == 10) then return Character.ancientLanguage else return Character.commonLanguage end end --- This function is used to display the message that the NPC is not able to --- understand the language the player character is speaking. It should be --- called every time the languageOK check is failing because it has its own --- protection against spamming. -- -- @param npcChar the NPC character -- @param npc the baseNPC instance that is referred to function displayLanguageConfusion(npcChar, npc) if not common.spamProtect(npcChar, 60) then npcChar.activeLanguage = npc._defaultLanguage npcChar:talk(Character.say, npc._confusedDE, npc._confusedUS) end end -- check if there is a GM "possessing" the NPC function isAdminOnField(pos) local stackedChar = world:getCharacterOnField(pos) if stackedChar:isAdmin() then return true end return false end return baseNPC
agpl-3.0
ffxiphoenix/darkstar
scripts/zones/Apollyon/mobs/Carnagechief_Jackbodokk.lua
16
2435
----------------------------------- -- Area: Apollyon CS -- NPC: Carnagechief_Jackbodokk ----------------------------------- package.loaded["scripts/zones/Apollyon/TextIDs"] = nil; ----------------------------------- require("scripts/globals/limbus"); require("scripts/zones/Apollyon/TextIDs"); ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) mob:setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); end; ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) local mobID = mob:getID(); local X = mob:getXPos(); local Y = mob:getYPos(); local Z = mob:getZPos(); SpawnMob(16933130):setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); SpawnMob(16933131):setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); SpawnMob(16933132):setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); end; ----------------------------------- -- onMobFight Action ----------------------------------- function onMobFight(mob,target) local mobID = mob:getID(); local X = mob:getXPos(); local Y = mob:getYPos(); local Z = mob:getZPos(); local lifepourcent= ((mob:getHP()/mob:getMaxHP())*100); local instancetime = target:getSpecialBattlefieldLeftTime(5); if (lifepourcent < 50 and GetNPCByID(16933245):getAnimation() == 8) then SpawnMob(16933134):setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); SpawnMob(16933135):setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); SpawnMob(16933133):setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); SpawnMob(16933136):setMobMod(MOBMOD_SUPERLINK, mob:getShortID()); GetNPCByID(16933245):setAnimation(9); end if (instancetime < 13) then if (IsMobDead(16933144)==false) then --link dee wapa GetMobByID(16933144):updateEnmity(target); elseif (IsMobDead(16933137)==false) then --link na qba GetMobByID(16933137):updateEnmity(target); end end end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob,killer) if ((IsMobDead(16933144)==false or IsMobDead(16933137)==false) and alreadyReceived(killer,1,GetInstanceRegion(1294)) == false) then killer:addTimeToSpecialBattlefield(5,5); addLimbusList(killer,1,GetInstanceRegion(1294)); end end;
gpl-3.0
Quenty/NevermoreEngine
src/meshutils/src/Shared/MeshUtils.lua
1
1483
--[=[ Mesh utility methods @class MeshUtils ]=] local MeshUtils = {} --[=[ Get or create a mesh object for a part @param part BasePart @return Mesh? ]=] function MeshUtils.getOrCreateMesh(part) local dataModelMesh = part:FindFirstChildWhichIsA("DataModelMesh") if dataModelMesh then return dataModelMesh end if part:IsA("Part") then if part.Shape == Enum.PartType.Ball then local mesh = Instance.new("SpecialMesh") mesh.MeshType = Enum.MeshType.Wedge mesh.Parent = part return mesh elseif part.Shape == Enum.PartType.Cylinder then local mesh = Instance.new("SpecialMesh") mesh.MeshType = Enum.MeshType.Cylinder mesh.Parent = part return mesh elseif part.Shape == Enum.PartType.Block then local mesh = Instance.new("BlockMesh") mesh.Parent = part return mesh else warn(("Unsupported part shape %q"):format(tostring(part.Shape))) return nil end elseif part:IsA("VehicleSeat") or part:IsA("Seat") then local mesh = Instance.new("BlockMesh") mesh.Parent = part return mesh elseif part:IsA("MeshPart") then local mesh = Instance.new("SpecialMesh") mesh.MeshType = Enum.MeshType.FileMesh mesh.MeshId = part.MeshId mesh.TextureId = part.TextureID -- yeah, inconsistent APIs FTW mesh.Parent = part return mesh elseif part:IsA("WedgePart") then local mesh = Instance.new("SpecialMesh") mesh.MeshType = Enum.MeshType.Wedge mesh.Parent = part return mesh else return nil end end return MeshUtils
mit
ffxiphoenix/darkstar
scripts/zones/South_Gustaberg/TextIDs.lua
8
1292
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6393; -- You cannot obtain the item <item>. Come back after sorting your inventory. ITEM_OBTAINED = 6398; -- Obtained: <item>. GIL_OBTAINED = 6399; -- Obtained <number> gil. KEYITEM_OBTAINED = 6401; -- Obtained key item: <keyitem>. FISHING_MESSAGE_OFFSET = 7216; -- You can't fish here. -- Standard Text FIRE_GOOD = 7385; -- The fire seems to be good enough for cooking. FIRE_PUT = 7386; -- You put$ in the fire. FIRE_TAKE = 7387; -- You take$ out of the fire. FIRE_LONGER = 7388; -- It may take a little while more to cook MEAT_ALREADY_PUT = 7389; -- is already in the fire -- Other dialog NOTHING_HAPPENS = 133; -- Nothing happens... NOTHING_OUT_OF_ORDINARY = 6412; -- There is nothing out of the ordinary here. MONSTER_TRACKS = 7381; -- You see monster tracks on the ground. MONSTER_TRACKS_FRESH = 7382; -- You see fresh monster tracks on the ground. -- conquest Base CONQUEST_BASE = 7057; -- Tallying conquest results... --chocobo digging DIG_THROW_AWAY = 7229; -- You dig up$, but your inventory is full. You regretfully throw the # away. FIND_NOTHING = 7231; -- You dig and you dig, but find nothing.
gpl-3.0
ffxiphoenix/darkstar
scripts/globals/items/dish_of_spag_vongole_rosso_+1.lua
35
1658
----------------------------------------- -- ID: 5198 -- Item: dish_of_spag_vongole_rosso_+1 -- Food Effect: 60Min, All Races ----------------------------------------- -- Health % 20 -- Health Cap 95 -- Vitality 2 -- Mind -1 -- Defense % 25 -- Defense Cap 35 -- Store TP 6 ----------------------------------------- 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,3600,5198); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_FOOD_HPP, 20); target:addMod(MOD_FOOD_HP_CAP, 95); target:addMod(MOD_VIT, 2); target:addMod(MOD_MND, -1); target:addMod(MOD_FOOD_DEFP, 25); target:addMod(MOD_FOOD_DEF_CAP, 35); target:addMod(MOD_STORETP, 6); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_FOOD_HPP, 20); target:delMod(MOD_FOOD_HP_CAP, 95); target:delMod(MOD_VIT, 2); target:delMod(MOD_MND, -1); target:delMod(MOD_FOOD_DEFP, 25); target:delMod(MOD_FOOD_DEF_CAP, 35); target:delMod(MOD_STORETP, 6); end;
gpl-3.0
lxl1140989/sdk-for-tb
feeds/luci/modules/admin-full/luasrc/model/cbi/admin_system/admin.lua
79
3356
--[[ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth <steven@midlink.org> 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 $Id$ ]]-- local fs = require "nixio.fs" m = Map("system", translate("Router Password"), translate("Changes the administrator password for accessing the device")) s = m:section(TypedSection, "_dummy", "") s.addremove = false s.anonymous = true pw1 = s:option(Value, "pw1", translate("Password")) pw1.password = true pw2 = s:option(Value, "pw2", translate("Confirmation")) pw2.password = true function s.cfgsections() return { "_pass" } end function m.on_commit(map) local v1 = pw1:formvalue("_pass") local v2 = pw2:formvalue("_pass") if v1 and v2 and #v1 > 0 and #v2 > 0 then if v1 == v2 then if luci.sys.user.setpasswd(luci.dispatcher.context.authuser, v1) == 0 then m.message = translate("Password successfully changed!") else m.message = translate("Unknown Error, password not changed!") end else m.message = translate("Given password confirmation did not match, password not changed!") end end end if fs.access("/etc/config/dropbear") then m2 = Map("dropbear", translate("SSH Access"), translate("Dropbear offers <abbr title=\"Secure Shell\">SSH</abbr> network shell access and an integrated <abbr title=\"Secure Copy\">SCP</abbr> server")) s = m2:section(TypedSection, "dropbear", translate("Dropbear Instance")) s.anonymous = true s.addremove = true ni = s:option(Value, "Interface", translate("Interface"), translate("Listen only on the given interface or, if unspecified, on all")) ni.template = "cbi/network_netlist" ni.nocreate = true ni.unspecified = true pt = s:option(Value, "Port", translate("Port"), translate("Specifies the listening port of this <em>Dropbear</em> instance")) pt.datatype = "port" pt.default = 22 pa = s:option(Flag, "PasswordAuth", translate("Password authentication"), translate("Allow <abbr title=\"Secure Shell\">SSH</abbr> password authentication")) pa.enabled = "on" pa.disabled = "off" pa.default = pa.enabled pa.rmempty = false ra = s:option(Flag, "RootPasswordAuth", translate("Allow root logins with password"), translate("Allow the <em>root</em> user to login with password")) ra.enabled = "on" ra.disabled = "off" ra.default = ra.enabled gp = s:option(Flag, "GatewayPorts", translate("Gateway ports"), translate("Allow remote hosts to connect to local SSH forwarded ports")) gp.enabled = "on" gp.disabled = "off" gp.default = gp.disabled s2 = m2:section(TypedSection, "_dummy", translate("SSH-Keys"), translate("Here you can paste public SSH-Keys (one per line) for SSH public-key authentication.")) s2.addremove = false s2.anonymous = true s2.template = "cbi/tblsection" function s2.cfgsections() return { "_keys" } end keys = s2:option(TextValue, "_data", "") keys.wrap = "off" keys.rows = 3 keys.rmempty = false function keys.cfgvalue() return fs.readfile("/etc/dropbear/authorized_keys") or "" end function keys.write(self, section, value) if value then fs.writefile("/etc/dropbear/authorized_keys", value:gsub("\r\n", "\n")) end end end return m, m2
gpl-2.0
dail8859/ScintilluaPlusPlus
ext/scintillua/lexers/cpp.lua
4
2938
-- Copyright 2006-2017 Mitchell mitchell.att.foicica.com. See LICENSE. -- C++ LPeg lexer. local l = require('lexer') local token, word_match = l.token, l.word_match local P, R, S = lpeg.P, lpeg.R, lpeg.S local M = {_NAME = 'cpp'} -- Whitespace. local ws = token(l.WHITESPACE, l.space^1) -- Comments. local line_comment = '//' * l.nonnewline_esc^0 local block_comment = '/*' * (l.any - '*/')^0 * P('*/')^-1 local comment = token(l.COMMENT, line_comment + block_comment) -- Strings. local sq_str = P('L')^-1 * l.delimited_range("'", true) local dq_str = P('L')^-1 * l.delimited_range('"', true) local string = token(l.STRING, sq_str + dq_str) -- Numbers. local number = token(l.NUMBER, l.float + l.integer) -- Preprocessor. local preproc_word = word_match{ 'define', 'elif', 'else', 'endif', 'error', 'if', 'ifdef', 'ifndef', 'import', 'line', 'pragma', 'undef', 'using', 'warning' } local preproc = #l.starts_line('#') * (token(l.PREPROCESSOR, '#' * S('\t ')^0 * preproc_word) + token(l.PREPROCESSOR, '#' * S('\t ')^0 * 'include') * (token(l.WHITESPACE, S('\t ')^1) * token(l.STRING, l.delimited_range('<>', true, true)))^-1) -- Keywords. local keyword = token(l.KEYWORD, word_match{ 'asm', 'auto', 'break', 'case', 'catch', 'class', 'const', 'const_cast', 'continue', 'default', 'delete', 'do', 'dynamic_cast', 'else', 'explicit', 'export', 'extern', 'false', 'for', 'friend', 'goto', 'if', 'inline', 'mutable', 'namespace', 'new', 'operator', 'private', 'protected', 'public', 'register', 'reinterpret_cast', 'return', 'sizeof', 'static', 'static_cast', 'switch', 'template', 'this', 'throw', 'true', 'try', 'typedef', 'typeid', 'typename', 'using', 'virtual', 'volatile', 'while', -- Operators 'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not', 'not_eq', 'or', 'or_eq', 'xor', 'xor_eq', -- C++11 'alignas', 'alignof', 'constexpr', 'decltype', 'final', 'noexcept', 'override', 'static_assert', 'thread_local' }) -- Types. local type = token(l.TYPE, word_match{ 'bool', 'char', 'double', 'enum', 'float', 'int', 'long', 'short', 'signed', 'struct', 'union', 'unsigned', 'void', 'wchar_t', -- C++11 'char16_t', 'char32_t', 'nullptr' }) -- Identifiers. local identifier = token(l.IDENTIFIER, l.word) -- Operators. local operator = token(l.OPERATOR, S('+-/*%<>!=^&|?~:;,.()[]{}')) M._rules = { {'whitespace', ws}, {'keyword', keyword}, {'type', type}, {'identifier', identifier}, {'string', string}, {'comment', comment}, {'number', number}, {'preproc', preproc}, {'operator', operator}, } M._foldsymbols = { _patterns = {'%l+', '[{}]', '/%*', '%*/', '//'}, [l.PREPROCESSOR] = { region = 1, endregion = -1, ['if'] = 1, ifdef = 1, ifndef = 1, endif = -1 }, [l.OPERATOR] = {['{'] = 1, ['}'] = -1}, [l.COMMENT] = {['/*'] = 1, ['*/'] = -1, ['//'] = l.fold_line_comments('//')} } return M
gpl-2.0
ffxiphoenix/darkstar
scripts/zones/Norg/npcs/HomePoint#2.lua
19
1167
----------------------------------- -- Area: Norg -- NPC: HomePoint#2 -- @pos -65 -5 54 252 ----------------------------------- package.loaded["scripts/zones/Norg/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/zones/Norg/TextIDs"); require("scripts/globals/homepoint"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) homepointMenu( player, 0x21fd, 104); 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 == 0x21fd) then if (option == 1) then player:setHomePoint(); player:messageSpecial(HOMEPOINT_SET); else hpTeleport( player, option); end end end;
gpl-3.0
zeliklil/zplayer
zplay.lua
1
2133
#! /usr/bin/env lua -- ZPlayer local lgi = require 'lgi' local GLib = lgi.GLib local Gtk = lgi.Gtk local Gdk = lgi.Gdk local GdkX11 = lgi.GdkX11 local Gio = lgi.Gio local gstPlayer = require 'gst_backend' local app = Gtk.Application.new ('org.zplayer',Gio.ApplicationFlags.HANDLES_OPEN) window = nil local player = gstPlayer() function player:on_eos() self:destroy() window:destroy() end local function updateInfo() window.title = player:get_info() end keybindings = { [string.byte(' ')] = function() player:toggle_pause() end, [Gdk.KEY_Left] = function() player:seek(-10) end, [Gdk.KEY_Right] = function() player:seek(10) end, [Gdk.KEY_Down] = function() player:seek(-60) end, [Gdk.KEY_Up] = function() player:seek(60) end, [Gdk.KEY_Escape] = function() player:on_eos() end, [string.byte('*')] = function() player:raise_volume(0.1) end, [string.byte('/')] = function() player:raise_volume(-0.1) end, [string.byte('d')] = function() player:debug() end, [string.byte('o')] = function() window.title = player:get_info() end, } function create_window() local window = Gtk.Window { application = app, title = "ZPlayer", Gtk.Box { orientation = 'VERTICAL', Gtk.DrawingArea { id = 'video', expand = true, width = 300, height = 150, }, } } function window.child.video:on_realize() player:attach(self.window:get_xid()) player:play() end function window:on_key_press_event(event) f = keybindings[event.keyval] if f then f() updateInfo() end end window:show_all() return window end function app:on_activate() window = create_window() end function app:on_open(files) file = files[1] and files[1]:get_parse_name() --or 'v4l2:///dev/video' if(file) then if (string.find(file, '://')) then uri = file else uri = 'file://' .. file end end print('Playing', uri) player:init() player:setURI(uri) window = create_window() end app:run { arg[0], ... } -- vim:expandtab:softtabstop=3:shiftwidth=3
mit
ffxiphoenix/darkstar
scripts/zones/Hall_of_Transference/npcs/_0e2.lua
32
1335
----------------------------------- -- Area: Hall of Transference -- NPC: Cermet Gate - Mea -- @pos 280 -86 -19 ----------------------------------- package.loaded["scripts/zones/Hall_of_Transference/TextIDs"] = nil; ----------------------------------- require("scripts/globals/missions"); require("scripts/zones/Hall_of_Transference/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getCurrentMission(COP) > BELOW_THE_ARKS) then player:startEvent(0x0096); else player:messageSpecial(NO_RESPONSE_OFFSET+1); -- The door is firmly shut. 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 == 0x0096 and option == 1) then player:setPos(-93.268, 0, 170.749, 162, 20); -- To Promyvion Mea {R} end end;
gpl-3.0
ffxiphoenix/darkstar
scripts/zones/Buburimu_Peninsula/TextIDs.lua
9
1577
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6406; -- You cannot obtain the item <item>. Come back after sorting your inventory. ITEM_OBTAINED = 6411; -- Obtained: <item>. GIL_OBTAINED = 6412; -- Obtained <number> gil. KEYITEM_OBTAINED = 6414; -- Obtained key item: <keyitem>. BEASTMEN_BANNER = 7151; -- There is a beastmen's banner. FISHING_MESSAGE_OFFSET = 7235; -- You can't fish here. -- Conquest CONQUEST = 7393; -- You've earned conquest points! -- Logging LOGGING_IS_POSSIBLE_HERE = 7377; -- Logging is possible here if you have -- Dialog Texts FIVEOFSPADES_DIALOG = 7229; -- GiMmefIvE! FiVe isA cArdIanOF WiN-DuRst! FIvEiS OnpA-tRol! YOU_CANNOT_ENTER_DYNAMIS = 7876; -- You cannot enter Dynamis MYSTERIOUS_VOICE = 7877; -- You hear a mysterious, floating voice: The guiding aura has not yet faded... Bring forth the PLAYERS_HAVE_NOT_REACHED_LEVEL = 7878; -- Players who have not reached levelare prohibited from entering Dynamis. -- Signs SIGN_1 = 7372; -- West: Tahrongi Canyon Southeast: Mhaura SIGN_2 = 7373; -- West: Tahrongi Canyon South: Mhaura SIGN_3 = 7374; -- West: Tahrongi Canyon Southwest: Mhaura SIGN_4 = 7375; -- West: Mhaura and Tahrongi Canyon SIGN_5 = 7376; -- West: Mhaura Northwest: Tahrongi Canyon -- conquest Base CONQUEST_BASE = 7070; -- Tallying conquest results... --chocobo digging DIG_THROW_AWAY = 7248; -- You dig up$, but your inventory is full. You regretfully throw the # away. FIND_NOTHING = 7250; -- You dig and you dig, but find nothing.
gpl-3.0
ffxiphoenix/darkstar
scripts/zones/Bastok_Mines/npcs/Pavvke.lua
36
2173
----------------------------------- -- Area: Bastok Mines -- NPC: Pavvke -- Starts Quests: Fallen Comrades (100%) ----------------------------------- package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/settings"); require("scripts/zones/Bastok_Mines/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) count = trade:getItemCount(); SilverTag = trade:hasItemQty(13116,1); Fallen = player:getQuestStatus(BASTOK,FALLEN_COMRADES); if (Fallen == 1 and SilverTag == true and count == 1) then player:tradeComplete(); player:startEvent(0x005b); elseif (Fallen == 2 and SilverTag == true and count == 1) then player:tradeComplete(); player:startEvent(0x005c); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) Fallen = player:getQuestStatus(BASTOK,FALLEN_COMRADES); pLevel = player:getMainLvl(player); pFame = player:getFameLevel(BASTOK); if (Fallen == 0 and pLevel >= 12 and pFame >= 2) then player:startEvent(0x005a); else player:startEvent(0x004b); 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); if (csid == 0x005a) then player:addQuest(BASTOK,FALLEN_COMRADES); elseif (csid == 0x005b) then player:completeQuest(BASTOK,FALLEN_COMRADES); player:addFame(BASTOK,BAS_FAME*120); player:addGil(GIL_RATE*550); player:messageSpecial(GIL_OBTAINED,GIL_RATE*550); elseif (csid == 0x005c) then player:addFame(BASTOK,BAS_FAME*8); player:addGil(GIL_RATE*550); player:messageSpecial(GIL_OBTAINED,GIL_RATE*550); end end;
gpl-3.0
ffxiphoenix/darkstar
scripts/globals/weaponskills/backhand_blow.lua
30
1352
----------------------------------- -- Backhand Blow -- Hand-to-Hand weapon skill -- Skill Level: 100 -- Deals params.critical damage. Chance of params.critical hit varies with TP. -- Aligned with the Breeze Gorget. -- Aligned with the Breeze Belt. -- Element: None -- Modifiers: STR:30% ; DEX:30% -- 100%TP 200%TP 300%TP -- 1.00 1.00 1.00 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID) local params = {}; params.numHits = 1; params.ftp100 = 1; params.ftp200 = 1; params.ftp300 = 1; params.str_wsc = 0.3; params.dex_wsc = 0.3; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.0; params.crit100 = 0.4; params.crit200 = 0.6; params.crit300 = 0.8; params.canCrit = true; params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0; params.atkmulti = 1; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.str_wsc = 0.5; params.dex_wsc = 0.5; end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params); damage = damage * WEAPON_SKILL_POWER return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
Phrohdoh/OpenRA
mods/ra/maps/allies-08a/allies08a.lua
3
6462
--[[ Copyright 2007-2020 The OpenRA Developers (see AUTHORS) This file is part of OpenRA, which is free software. It is made available to you under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. For more information, see COPYING. ]] AlliedBoatReinforcements = { "dd", "dd" } TimerTicks = DateTime.Minutes(21) ObjectiveBuildings = { Chronosphere, AlliedTechCenter } ScientistTypes = { "chan", "chan", "chan", "chan" } ScientistDiscoveryFootprint = { CPos.New(28, 83), CPos.New(29, 83) } ScientistEvacuationFootprint = { CPos.New(29, 60), CPos.New(29, 61), CPos.New(29, 62), CPos.New(29, 63), CPos.New(29, 64), CPos.New(29, 65), CPos.New(29, 66) } InitialAlliedReinforcements = function() Trigger.AfterDelay(DateTime.Seconds(2), function() Media.PlaySpeechNotification(greece, "ReinforcementsArrived") Reinforcements.Reinforce(greece, { "mcv" }, { MCVEntry.Location, MCVStop.Location }) Reinforcements.Reinforce(greece, AlliedBoatReinforcements, { DDEntry.Location, DDStop.Location }) end) end CreateScientists = function() scientists = Reinforcements.Reinforce(greece, ScientistTypes, { ScientistsExit.Location }) Utils.Do(scientists, function(s) s.Move(s.Location + CVec.New(0, 1)) s.Scatter() end) local flare = Actor.Create("flare", true, { Owner = greece, Location = DefaultCameraPosition.Location + CVec.New(-1, 0) }) Trigger.AfterDelay(DateTime.Seconds(2), function() Media.PlaySpeechNotification(player, "SignalFlareNorth") end) Trigger.OnAnyKilled(scientists, function() Media.PlaySpeechNotification(greece, "ObjectiveNotMet") greece.MarkFailedObjective(EvacuateScientists) end) -- Add the footprint trigger in a frame end task (delay 0) to avoid crashes local left = #scientists Trigger.AfterDelay(0, function() local changeOwnerTrigger = Trigger.OnEnteredFootprint(ScientistEvacuationFootprint, function(a, id) if a.Owner == greece and a.Type == "chan" then a.Owner = germany a.Stop() a.Move(MCVEntry.Location) -- Constantly try to reach the exit (and thus avoid getting stuck if the path was blocked) Trigger.OnIdle(a, function() a.Move(MCVEntry.Location) end) end end) -- Use a cell trigger to destroy the scientists preventing the player from causing glitchs by blocking the path Trigger.OnEnteredFootprint({ MCVEntry.Location }, function(a, id) if a.Owner == germany then a.Stop() a.Destroy() left = left - 1 if left == 0 then Trigger.RemoveFootprintTrigger(id) Trigger.RemoveFootprintTrigger(changeOwnerTrigger) flare.Destroy() if not greece.IsObjectiveCompleted(EvacuateScientists) and not greece.IsObjectiveFailed(EvacuateScientists) then Media.PlaySpeechNotification(greece, "ObjectiveMet") greece.MarkCompletedObjective(EvacuateScientists) end end end end) end) end DefendChronosphereCompleted = function() local cells = Utils.ExpandFootprint({ ChronoshiftLocation.Location }, false) local units = { } for i = 1, #cells do local unit = Actor.Create("2tnk", true, { Owner = greece, Facing = Angle.North }) units[unit] = cells[i] end Chronosphere.Chronoshift(units) UserInterface.SetMissionText("The experiment is a success!", greece.Color) Trigger.AfterDelay(DateTime.Seconds(3), function() greece.MarkCompletedObjective(DefendChronosphere) greece.MarkCompletedObjective(KeepBasePowered) end) end ticked = TimerTicks Tick = function() ussr.Cash = 5000 if ussr.HasNoRequiredUnits() then greece.MarkCompletedObjective(DefendChronosphere) greece.MarkCompletedObjective(KeepBasePowered) end if greece.HasNoRequiredUnits() then ussr.MarkCompletedObjective(BeatAllies) end if ticked > 0 then UserInterface.SetMissionText("Chronosphere experiment completes in " .. Utils.FormatTime(ticked), TimerColor) ticked = ticked - 1 elseif ticked == 0 and (greece.PowerState ~= "Normal") then greece.MarkFailedObjective(KeepBasePowered) elseif ticked == 0 then DefendChronosphereCompleted() ticked = ticked - 1 end end WorldLoaded = function() greece = Player.GetPlayer("Greece") ussr = Player.GetPlayer("USSR") germany = Player.GetPlayer("Germany") DefendChronosphere = greece.AddPrimaryObjective("Defend the Chronosphere and the Tech Center\nat all costs.") KeepBasePowered = greece.AddPrimaryObjective("The Chronosphere must have power when the\ntimer runs out.") EvacuateScientists = greece.AddSecondaryObjective("Evacuate all scientists from the island to\nthe west.") BeatAllies = ussr.AddPrimaryObjective("Defeat the Allied forces.") Trigger.OnObjectiveCompleted(greece, function(p, id) Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective completed") end) Trigger.OnObjectiveFailed(greece, function(p, id) Media.DisplayMessage(p.GetObjectiveDescription(id), "Objective failed") end) Trigger.OnPlayerLost(greece, function() Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(greece, "MissionFailed") end) end) Trigger.OnPlayerWon(greece, function() Trigger.AfterDelay(DateTime.Seconds(1), function() Media.PlaySpeechNotification(greece, "MissionAccomplished") end) end) Trigger.AfterDelay(DateTime.Minutes(1), function() Media.PlaySpeechNotification(greece, "TwentyMinutesRemaining") end) Trigger.AfterDelay(DateTime.Minutes(11), function() Media.PlaySpeechNotification(greece, "TenMinutesRemaining") end) Trigger.AfterDelay(DateTime.Minutes(16), function() Media.PlaySpeechNotification(greece, "WarningFiveMinutesRemaining") end) Trigger.AfterDelay(DateTime.Minutes(18), function() Media.PlaySpeechNotification(greece, "WarningThreeMinutesRemaining") end) Trigger.AfterDelay(DateTime.Minutes(20), function() Media.PlaySpeechNotification(greece, "WarningOneMinuteRemaining") end) PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr }) Camera.Position = DefaultCameraPosition.CenterPosition TimerColor = greece.Color Trigger.OnAnyKilled(ObjectiveBuildings, function() greece.MarkFailedObjective(DefendChronosphere) end) Trigger.OnEnteredFootprint(ScientistDiscoveryFootprint, function(a, id) if a.Owner == greece and not scientistsTriggered then scientistsTriggered = true Trigger.RemoveFootprintTrigger(id) CreateScientists() end end) InitialAlliedReinforcements() ActivateAI() end
gpl-3.0
lxl1140989/sdk-for-tb
feeds/luci/applications/luci-freifunk-widgets/luasrc/model/cbi/freifunk/widgets/widget.lua
78
1243
--[[ LuCI - Lua Configuration Interface Copyright 2012 Manuel Munz <freifunk at somakoma dot de> 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 uci = require "luci.model.uci".cursor() local dsp = require "luci.dispatcher" local utl = require "luci.util" local widget = uci:get("freifunk-widgets", arg[1], "template") local title = uci:get("freifunk-widgets", arg[1], "title") or "" m = Map("freifunk-widgets", translate("Widget")) m.redirect = luci.dispatcher.build_url("admin/freifunk/widgets") if not arg[1] or m.uci:get("freifunk-widgets", arg[1]) ~= "widget" then luci.http.redirect(m.redirect) return end wdg = m:section(NamedSection, arg[1], "widget", translate("Widget") .. " " .. title) wdg.anonymous = true wdg.addremove = false local en = wdg:option(Flag, "enabled", translate("Enable")) en.rmempty = false local title = wdg:option(Value, "title", translate("Title")) title.rmempty = true local form = loadfile( utl.libpath() .. "/model/cbi/freifunk/widgets/%s.lua" % widget ) if form then setfenv(form, getfenv(1))(m, wdg) end return m
gpl-2.0
ffxiphoenix/darkstar
scripts/globals/spells/sandstorm.lua
31
1153
-------------------------------------- -- Spell: Sandstorm -- Changes the weather around target party member to "dusty." -------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) target:delStatusEffectSilent(EFFECT_FIRESTORM); target:delStatusEffectSilent(EFFECT_SANDSTORM); target:delStatusEffectSilent(EFFECT_RAINSTORM); target:delStatusEffectSilent(EFFECT_WINDSTORM); target:delStatusEffectSilent(EFFECT_HAILSTORM); target:delStatusEffectSilent(EFFECT_THUNDERSTORM); target:delStatusEffectSilent(EFFECT_AURORASTORM); target:delStatusEffectSilent(EFFECT_VOIDSTORM); local merit = caster:getMerit(MERIT_STORMSURGE); local power = 0; if merit > 0 then power = merit + caster:getMod(MOD_STORMSURGE_EFFECT) + 2; end target:addStatusEffect(EFFECT_SANDSTORM,power,0,180); return EFFECT_SANDSTORM; end;
gpl-3.0
RodneyMcKay/x_hero_siege
game/scripts/vscripts/components/battlepass/modifiers/modifier_patreon_donator.lua
1
1442
modifier_patreon_donator = class({}) function modifier_patreon_donator:IsHidden() return true end function modifier_patreon_donator:IsPurgable() return false end function modifier_patreon_donator:OnCreated() if IsServer() then self:SetStackCount(api:GetDonatorStatus(self:GetParent():GetPlayerID())) self:StartIntervalThink(0.2) self.current_effect_name = "" self.effect_name = api:GetPlayerEmblem(self:GetParent():GetPlayerID()) end end function modifier_patreon_donator:OnIntervalThink() for _, v in ipairs(SHARED_NODRAW_MODIFIERS) do if self:GetParent():HasModifier(v) then -- print("hide donator effect...") self.effect_name = "" self:RefreshEffect() return end end -- print(self.effect_name) self:RefreshEffect() end function modifier_patreon_donator:RefreshEffect() if self.current_effect_name ~= self.effect_name then -- print("Old Effect:", self.current_effect_name) -- print("Effect:", self.effect_name) if self.pfx then ParticleManager:DestroyParticle(self.pfx, false) ParticleManager:ReleaseParticleIndex(self.pfx) end self.pfx = ParticleManager:CreateParticle(self.effect_name, PATTACH_ABSORIGIN_FOLLOW, self:GetParent()) self.current_effect_name = self.effect_name end end function modifier_patreon_donator:OnDestroy() if IsServer() then if self.pfx then ParticleManager:DestroyParticle(self.pfx, false) ParticleManager:ReleaseParticleIndex(self.pfx) end end end
gpl-2.0
DrayChou/telegram-bot
plugins/bot_tuling123.lua
1
3504
do local tuling_config = load_from_file('data/tuling.lua') -- 图灵机器人的KEY local tuling_url = "http://www.tuling123.com/openapi/api" local consumer_key = tuling_config.consumer_key local function getTuling(user_id,info) local url = tuling_url.."?key="..consumer_key url = url.."&info="..info url = url.."&userid="..user_id vardump(url) local res,status = http.request(url) vardump(res) if status ~= 200 then return nil end local data = json:decode(res) local text = data.text -- 如果有链接 if data.url then text = "\n"..text.." "..data.url end -- 如果是新闻 if data.code == 302000 then for k,new in pairs(data.list) do text = text.."\n 标题:".." "..new.article text = text.."\n 来源:".." "..new.source text = text.."\n".." "..new.detailurl text = text.."\n".." "..new.icon if k >= 3 then break; end end end -- 如果是菜谱 if data.code == 308000 then for k,new in pairs(data.list) do text = text.."\n 名称:".." "..new.name text = text.."\n 详情:".." "..new.info text = text.."\n".." "..new.detailurl text = text.."\n".." "..new.icon if k >= 3 then break; end end end -- 如果是列车 if data.code == 305000 then for k,new in pairs(data.list) do text = text.."\n 车次:".." "..new.trainnum text = text.."\n 起始站:".." "..new.start text = text.."\n 到达站:".." "..new.terminal text = text.."\n 开车时间:".." "..new.starttime text = text.."\n 到达时间:".." "..new.endtime text = text.."\n".." "..new.detailurl text = text.."\n".." "..new.icon if k >= 3 then break; end end end -- 如果是航班 if data.code == 306000 then for k,new in pairs(data.list) do text = text.."\n 航班:".." "..new.flight text = text.."\n 航班路线:".." "..new.route text = text.."\n 开车时间:".." "..new.starttime text = text.."\n 到达时间:".." "..new.endtime text = text.."\n 航班状态:".." "..new.state text = text.."\n".." "..new.detailurl text = text.."\n".." "..new.icon if k >= 3 then break; end end end return text end local function run(msg, matches) return getTuling(msg.from.id,matches[1]) end return { description = "询问图灵小机器人", usage = { "!bot info: 请求图灵的机器人接口,并返回回答。", "Request Turing robot, and return the results. Only support Chinese.", "升级链接|Upgrade link:http://www.tuling123.com/openapi/record.do?channel=98150", "图灵机器人注册邀请地址,每有一个用户通过此地址注册账号,增加本接口可调用次数 1000次/天。", "Turing robot registration invitation address, each user has a registered account through this address, increase the number of calls this interface can be 1000 times / day. Translation from Google!" }, patterns = { "^[!|#|/][Bb]ot (.*)$" }, run = run } end
gpl-2.0
ffxiphoenix/darkstar
scripts/zones/Selbina/npcs/Lombaria.lua
32
1031
----------------------------------- -- Area: Selbina -- NPC: Lombaria -- Map Seller NPC ----------------------------------- package.loaded["scripts/zones/Selbina/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Selbina/TextIDs"); require("scripts/globals/magic_maps"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) CheckMaps(player, npc, 0x01f4); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) if (csid == 0x01f4) then CheckMapsUpdate(player, option, NOT_HAVE_ENOUGH_GIL, KEYITEM_OBTAINED); end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) end;
gpl-3.0
ffxiphoenix/darkstar
scripts/zones/Abyssea-Grauberg/Zone.lua
32
1549
----------------------------------- -- -- Zone: Abyssea - Grauberg -- ----------------------------------- package.loaded["scripts/zones/Abyssea-Grauberg/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Abyssea-Grauberg/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos(-555,31,-760,0); end if (player:getQuestStatus(ABYSSEA, THE_TRUTH_BECKONS) == QUEST_ACCEPTED and player:getVar("1stTimeAyssea") == 0) then player:setVar("1stTimeAyssea",1); 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); end;
gpl-3.0
ffxiphoenix/darkstar
scripts/zones/Bastok_Markets_[S]/npcs/Weldon.lua
34
1109
---------------------------------- -- Area: Bastok Markets [S] -- NPC: Weldon -- Type: Item Deliverer -- @pos -191.575 -8 36.688 87 ----------------------------------- package.loaded["scripts/zones/Bastok_Markets_[S]/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Bastok_Markets_[S]/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc, WELDON_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
ffxiphoenix/darkstar
scripts/zones/Port_Windurst/npcs/Puo_Rhen.lua
38
1037
----------------------------------- -- Area: Port Windurst -- NPC: Puo Rhen -- Type: Mission Starter -- @zone: 240 -- @pos -227.964 -9 187.087 -- -- Auto-Script: Requires Verification (Verfied By Brawndo) ----------------------------------- package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0048); 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
azukiapp/busted
src/languages/en.lua
1
1222
local s = require('say') s:set_namespace("en") -- "Pending: test.lua @ 12 \n description s:set("output.pending", "Pending") s:set("output.failure", "Failure") s:set("output.success", "Success") s:set("output.pending_plural", "pending") s:set("output.failure_plural", "failures") s:set("output.success_plural", "successes") s:set("output.pending_zero", "pending") s:set("output.failure_zero", "failures") s:set("output.success_zero", "successes") s:set("output.pending_single", "pending") s:set("output.failure_single", "failure") s:set("output.success_single", "success") s:set("output.seconds", "seconds") -- definitions following are not used within the 'say' namespace return { failure_messages = { "You have %d busted specs", "Your specs are busted", "Your code is bad and you should feel bad", "Your code is in the Danger Zone", "Strange game. The only way to win is not to test", "My grandmother wrote better specs on a 3 86", "Every time there's a failure, drink another beer", "Feels bad man" }, success_messages = { "Aww yeah, passing specs", "Doesn't matter, had specs", "Feels good, man", "Great success", "Tests pass, drink another beer", } }
mit
ffxiphoenix/darkstar
scripts/zones/Port_San_dOria/npcs/Liloune.lua
36
1373
----------------------------------- -- Area: Port San d'Oria -- NPC: Liloune -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/zones/Port_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then count = trade:getItemCount(); 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:startEvent(0x252); 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
jacks0nX/cqui
PQ/StrategicView_MapPlacement.lua
3
20766
-- =========================================================================== -- Input for placing items on the world map. -- Copyright 2015-2016, Firaxis Games -- -- To hot-reload, save this then re-save the file that imports the file -- (e.g., WorldInput) -- =========================================================================== include("SupportFunctions.lua"); include("AdjacencyBonusSupport.lua"); -- =========================================================================== -- MEMBERS -- =========================================================================== local m_hexesDistrictPlacement :table = {}; -- Re-usable collection of hexes; what is sent across the wire. local m_cachedSelectedPlacementPlotId :number = -1; -- Hex the cursor is currently focused on -- =========================================================================== -- Code related to the Wonder Placement interface mode -- =========================================================================== function ConfirmPlaceWonder( pInputStruct:table ) local plotId = UI.GetCursorPlotID(); local pSelectedCity = UI.GetHeadSelectedCity(); if (not Map.IsPlot(plotId) or not GameInfo.Districts['DISTRICT_CITY_CENTER'].IsPlotValid(pSelectedCity, plotId)) then return false; end local kPlot = Map.GetPlotByIndex(plotId); local eBuilding = UI.GetInterfaceModeParameter(CityOperationTypes.PARAM_BUILDING_TYPE); local tParameters = {}; tParameters[CityOperationTypes.PARAM_X] = kPlot:GetX(); tParameters[CityOperationTypes.PARAM_Y] = kPlot:GetY(); tParameters[CityOperationTypes.PARAM_BUILDING_TYPE] = eBuilding; tParameters[CityOperationTypes.PARAM_INSERT_MODE] = CityOperationTypes.VALUE_EXCLUSIVE; if (pSelectedCity ~= nil) then local pBuildingInfo = GameInfo.Buildings[eBuilding]; local bCanStart, tResults = CityManager.CanStartOperation( pSelectedCity, CityOperationTypes.BUILD, tParameters, true); if pBuildingInfo ~= nil and bCanStart then local sConfirmText :string = Locale.Lookup("LOC_DISTRICT_ZONE_CONFIRM_WONDER_POPUP", pBuildingInfo.Name); if (tResults ~= nil and tResults[CityOperationResults.SUCCESS_CONDITIONS] ~= nil) then if (table.count(tResults[CityOperationResults.SUCCESS_CONDITIONS]) ~= 0) then sConfirmText = sConfirmText .. "[NEWLINE]"; end for i,v in ipairs(tResults[CityOperationResults.SUCCESS_CONDITIONS]) do sConfirmText = sConfirmText .. "[NEWLINE]" .. Locale.Lookup(v); end end local pPopupDialog :table = PopupDialog:new("PlaceWonderAt_X" .. kPlot:GetX() .. "_Y" .. kPlot:GetY()); -- unique identifier pPopupDialog:AddText(sConfirmText); pPopupDialog:AddButton(Locale.Lookup("LOC_YES"), function() --CityManager.RequestOperation(pSelectedCity, CityOperationTypes.BUILD, tParameters); local tProductionQueueParameters = { tParameters=tParameters, plotId=plotId, pSelectedCity=pSelectedCity, buildingHash=eBuilding } LuaEvents.StrageticView_MapPlacement_ProductionClose(tProductionQueueParameters); UI.PlaySound("Build_Wonder"); ExitPlacementMode(); end); pPopupDialog:AddButton(Locale.Lookup("LOC_NO"), nil); pPopupDialog:Open(); end else ExitPlacementMode( true ); end return true; end -- =========================================================================== -- Find the artdef (texture) for the plots we are considering -- =========================================================================== function RealizePlotArtForWonderPlacement() -- Reset the master table of hexes, tracking what will be sent to the engine. m_hexesDistrictPlacement = {}; m_cachedSelectedPlacementPlotId = -1; local kNonShadowHexes:table = {}; -- Holds plot IDs of hexes to not be shadowed. UIManager:SetUICursor(CursorTypes.RANGE_ATTACK); UILens.SetActive("DistrictPlacement"); -- turn on all district layers and district adjacency bonus layers local pSelectedCity = UI.GetHeadSelectedCity(); if pSelectedCity ~= nil then local buildingHash:number = UI.GetInterfaceModeParameter(CityOperationTypes.PARAM_BUILDING_TYPE); local building:table = GameInfo.Buildings[buildingHash]; local tParameters :table = {}; tParameters[CityOperationTypes.PARAM_BUILDING_TYPE] = buildingHash; local tResults :table = CityManager.GetOperationTargets( pSelectedCity, CityOperationTypes.BUILD, tParameters ); -- Highlight the plots where the city can place the wonder if (tResults[CityOperationResults.PLOTS] ~= nil and table.count(tResults[CityOperationResults.PLOTS]) ~= 0) then local kPlots = tResults[CityOperationResults.PLOTS]; for i, plotId in ipairs(kPlots) do if(GameInfo.Districts['DISTRICT_CITY_CENTER'].IsPlotValid(pSelectedCity, plotId)) then local kPlot :table = Map.GetPlotByIndex(plotId); local plotInfo :table = GetViewPlotInfo( kPlot ); plotInfo.hexArtdef = "Placement_Valid"; plotInfo.selectable = true; m_hexesDistrictPlacement[plotId]= plotInfo; table.insert( kNonShadowHexes, plotId ); else -- TODO: Perhaps make it clear that it is reserved by the queue end end end -- Plots that aren't owned, but could be (and hence, could be a great spot for that wonder!) tParameters = {}; tParameters[CityCommandTypes.PARAM_PLOT_PURCHASE] = UI.GetInterfaceModeParameter(CityCommandTypes.PARAM_PLOT_PURCHASE); local tResults = CityManager.GetCommandTargets( pSelectedCity, CityCommandTypes.PURCHASE, tParameters ); if (tResults[CityCommandResults.PLOTS] ~= nil and table.count(tResults[CityCommandResults.PLOTS]) ~= 0) then local kPurchasePlots = tResults[CityCommandResults.PLOTS]; for i, plotId in ipairs(kPurchasePlots) do -- Highlight any purchaseable plot the Wonder could go on local kPlot :table = Map.GetPlotByIndex(plotId); if kPlot:CanHaveWonder(building.Index, pSelectedCity:GetOwner(), pSelectedCity:GetID()) then local plotInfo :table = GetViewPlotInfo( kPlot ); plotInfo.hexArtdef = "Placement_Purchase"; plotInfo.selectable = true; plotInfo.purchasable = true; m_hexesDistrictPlacement[plotId]= plotInfo; end end end -- Send all the hex information to the engine for visualization. local hexIndexes:table = {}; for i,plotInfo in pairs(m_hexesDistrictPlacement) do UILens.SetAdjacencyBonusDistict( plotInfo.index, plotInfo.hexArtdef, plotInfo.adjacent ); end LuaEvents.StrategicView_MapPlacement_AddDistrictPlacementShadowHexes( kNonShadowHexes ); end end -- =========================================================================== -- Mode to place a Wonder Building -- =========================================================================== function OnInterfaceModeEnter_BuildingPlacement( eNewMode:number ) UIManager:SetUICursor(CursorTypes.RANGE_ATTACK); --here? RealizePlotArtForWonderPlacement(); end -- =========================================================================== -- Guaranteed to be called when leaving building placement -- =========================================================================== function OnInterfaceModeLeave_BuildingPlacement( eNewMode:number ) LuaEvents.StrategicView_MapPlacement_ClearDistrictPlacementShadowHexes(); end -- =========================================================================== -- Explicitly leaving district placement; may not be called if the user -- is entering another mode by selecting a different UI element which in-turn -- triggers the exit. -- =========================================================================== function ExitPlacementMode( isCancelled:boolean ) -- UI.SetInterfaceMode(InterfaceModeTypes.SELECTION); -- if isCancelled then -- LuaEvents.StrageticView_MapPlacement_ProductionOpen(); -- end end -- =========================================================================== -- Confirm before placing a district down -- =========================================================================== function ConfirmPlaceDistrict(pInputStruct:table) local plotId = UI.GetCursorPlotID(); local pSelectedCity = UI.GetHeadSelectedCity(); if (not Map.IsPlot(plotId) or not GameInfo.Districts['DISTRICT_CITY_CENTER'].IsPlotValid(pSelectedCity, plotId)) then return; end local kPlot = Map.GetPlotByIndex(plotId); local districtHash:number = UI.GetInterfaceModeParameter(CityOperationTypes.PARAM_DISTRICT_TYPE); local tParameters = {}; tParameters[CityOperationTypes.PARAM_X] = kPlot:GetX(); tParameters[CityOperationTypes.PARAM_Y] = kPlot:GetY(); tParameters[CityOperationTypes.PARAM_DISTRICT_TYPE] = districtHash; tParameters[CityOperationTypes.PARAM_INSERT_MODE] = CityOperationTypes.VALUE_EXCLUSIVE; if (pSelectedCity ~= nil) then local pDistrictInfo = GameInfo.Districts[districtHash]; local bCanStart, tResults = CityManager.CanStartOperation( pSelectedCity, CityOperationTypes.BUILD, tParameters, true); if pDistrictInfo ~= nil and bCanStart then local sConfirmText :string = Locale.Lookup("LOC_DISTRICT_ZONE_CONFIRM_DISTRICT_POPUP", pDistrictInfo.Name); if (tResults ~= nil and tResults[CityOperationResults.SUCCESS_CONDITIONS] ~= nil) then if (table.count(tResults[CityOperationResults.SUCCESS_CONDITIONS]) ~= 0) then sConfirmText = sConfirmText .. "[NEWLINE]"; end for i,v in ipairs(tResults[CityOperationResults.SUCCESS_CONDITIONS]) do sConfirmText = sConfirmText .. "[NEWLINE]" .. Locale.Lookup(v); end end local pPopupDialog :table = PopupDialog:new("PlaceDistrictAt_X" .. kPlot:GetX() .. "_Y" .. kPlot:GetY()); -- unique identifier pPopupDialog:AddText(sConfirmText); pPopupDialog:AddButton(Locale.Lookup("LOC_YES"), function() --CityManager.RequestOperation(pSelectedCity, CityOperationTypes.BUILD, tParameters); local tProductionQueueParameters = { tParameters=tParameters, plotId=plotId, pSelectedCity=pSelectedCity, buildingHash=districtHash } LuaEvents.StrageticView_MapPlacement_ProductionClose(tProductionQueueParameters); ExitPlacementMode(); end); pPopupDialog:AddButton(Locale.Lookup("LOC_NO"), nil); pPopupDialog:Open(); end else ExitPlacementMode( true ); end end -- =========================================================================== -- Adds a plot and all the adjacencent plots, unless already added. -- ARGS: plot, gamecore plot object -- RETURNS: A new/updated plotInfo table -- =========================================================================== function GetViewPlotInfo( kPlot:table ) local plotId :number = kPlot:GetIndex(); local plotInfo :table = m_hexesDistrictPlacement[plotId]; if plotInfo == nil then plotInfo = { index = plotId, x = kPlot:GetX(), y = kPlot:GetY(), adjacent= {}, -- adjacent edge bonuses selectable = false, -- change state with mouse over? purchasable = false }; end --print( " plot: " .. plotInfo.x .. "," .. plotInfo.y..": " .. tostring(plotInfo.iconArtdef) ); return plotInfo; end -- =========================================================================== -- Obtain a table of adjacency bonuses -- =========================================================================== function AddAdjacentPlotBonuses( kPlot:table, districtType:string, pSelectedCity:table ) local x :number = kPlot:GetX(); local y :number = kPlot:GetY(); for _,direction in pairs(DirectionTypes) do if direction ~= DirectionTypes.NO_DIRECTION and direction ~= DirectionTypes.NUM_DIRECTION_TYPES then local adjacentPlot :table= Map.GetAdjacentPlot( x, y, direction); if adjacentPlot ~= nil then local artdefIconName:string = GetAdjacentIconArtdefName( districtType, adjacentPlot, pSelectedCity, direction ); --print( "Checking from: (" .. tostring(x) .. ", " .. tostring(y) .. ") to (" .. tostring(adjacentPlot:GetX()) .. ", " .. tostring(adjacentPlot:GetY()) .. ") Artdef:'"..artdefIconName.."'"); if artdefIconName ~= nil and artdefIconName ~= "" then local districtViewInfo :table = GetViewPlotInfo( adjacentPlot ); local oppositeDirection :number = -1; if direction == DirectionTypes.DIRECTION_NORTHEAST then oppositeDirection = DirectionTypes.DIRECTION_SOUTHWEST; end if direction == DirectionTypes.DIRECTION_EAST then oppositeDirection = DirectionTypes.DIRECTION_WEST; end if direction == DirectionTypes.DIRECTION_SOUTHEAST then oppositeDirection = DirectionTypes.DIRECTION_NORTHWEST; end if direction == DirectionTypes.DIRECTION_SOUTHWEST then oppositeDirection = DirectionTypes.DIRECTION_NORTHEAST; end if direction == DirectionTypes.DIRECTION_WEST then oppositeDirection = DirectionTypes.DIRECTION_EAST; end if direction == DirectionTypes.DIRECTION_NORTHWEST then oppositeDirection = DirectionTypes.DIRECTION_SOUTHEAST; end table.insert( districtViewInfo.adjacent, { direction = oppositeDirection, iconArtdef = artdefIconName, inBonus = false, outBonus = true } ); m_hexesDistrictPlacement[adjacentPlot:GetIndex()] = districtViewInfo; end end end end end -- =========================================================================== -- Find the artdef (texture) for the plot itself as well as the icons -- that are on the borders signifying why a hex receives a certain bonus. -- =========================================================================== function RealizePlotArtForDistrictPlacement() -- Reset the master table of hexes, tracking what will be sent to the engine. m_hexesDistrictPlacement = {}; m_cachedSelectedPlacementPlotId = -1; local kNonShadowHexes:table = {}; -- Holds plot IDs of hexes to not be shadowed. UIManager:SetUICursor(CursorTypes.RANGE_ATTACK); UILens.SetActive("DistrictPlacement"); -- turn on all district layers and district adjacency bonus layers local pSelectedCity = UI.GetHeadSelectedCity(); if pSelectedCity ~= nil then local districtHash:number = UI.GetInterfaceModeParameter(CityOperationTypes.PARAM_DISTRICT_TYPE); local district:table = GameInfo.Districts[districtHash]; local tParameters :table = {}; tParameters[CityOperationTypes.PARAM_DISTRICT_TYPE] = districtHash; local tResults :table = CityManager.GetOperationTargets( pSelectedCity, CityOperationTypes.BUILD, tParameters ); -- Highlight the plots where the city can place the district if (tResults[CityOperationResults.PLOTS] ~= nil and table.count(tResults[CityOperationResults.PLOTS]) ~= 0) then local kPlots = tResults[CityOperationResults.PLOTS]; for i, plotId in ipairs(kPlots) do if(GameInfo.Districts['DISTRICT_CITY_CENTER'].IsPlotValid(pSelectedCity, plotId)) then local kPlot :table = Map.GetPlotByIndex(plotId); local plotInfo :table = GetViewPlotInfo( kPlot ); plotInfo.hexArtdef = "Placement_Valid"; plotInfo.selectable = true; m_hexesDistrictPlacement[plotId]= plotInfo; AddAdjacentPlotBonuses( kPlot, district.DistrictType, pSelectedCity ); table.insert( kNonShadowHexes, plotId ); end end end --[[ -- antonjs: Removing blocked plots from the UI display. Now that district placement can automatically remove features, resources, and improvements, -- as long as the player has the tech, there is not much need to show blocked plots and they end up being confusing. -- Plots that can host a district, after some action(s) are first taken. if (tResults[CityOperationResults.BLOCKED_PLOTS] ~= nil and table.count(tResults[CityOperationResults.BLOCKED_PLOTS]) ~= 0) then local kPlots = tResults[CityOperationResults.BLOCKED_PLOTS]; for i, plotId in ipairs(kPlots) do local kPlot :table = Map.GetPlotByIndex(plotId); local plotInfo :table = GetViewPlotInfo( kPlot ); plotInfo.hexArtdef = "Placement_Blocked"; m_hexesDistrictPlacement[plotId]= plotInfo; AddAdjacentPlotBonuses( kPlot, district.DistrictType, pSelectedCity ); table.insert( kNonShadowHexes, plotId ); end end --]] -- Plots that a player will NEVER be able to place a district on -- if (tResults[CityOperationResults.MOUNTAIN_PLOTS] ~= nil and table.count(tResults[CityOperationResults.MOUNTAIN_PLOTS]) ~= 0) then -- local kPlots = tResults[CityOperationResults.MOUNTAIN_PLOTS]; -- for i, plotId in ipairs(kPlots) do -- local kPlot :table = Map.GetPlotByIndex(plotId); -- local plotInfo :table = GetViewPlotInfo( kPlot ); -- plotInfo.hexArtdef = "Placement_Invalid"; -- m_hexesDistrictPlacement[plotId]= plotInfo; -- end -- end -- Plots that arent't owned, but could be (and hence, could be a great spot for that district!) tParameters = {}; tParameters[CityCommandTypes.PARAM_PLOT_PURCHASE] = UI.GetInterfaceModeParameter(CityCommandTypes.PARAM_PLOT_PURCHASE); local tResults = CityManager.GetCommandTargets( pSelectedCity, CityCommandTypes.PURCHASE, tParameters ); if (tResults[CityCommandResults.PLOTS] ~= nil and table.count(tResults[CityCommandResults.PLOTS]) ~= 0) then local kPurchasePlots = tResults[CityCommandResults.PLOTS]; for i, plotId in ipairs(kPurchasePlots) do -- Only highlight certain plots (usually if there is a bonus to be gained). local kPlot :table = Map.GetPlotByIndex(plotId); local isValid :boolean = IsShownIfPlotPurchaseable( district.Index, pSelectedCity, kPlot ); if isValid and kPlot:CanHaveDistrict(district.DistrictType, pSelectedCity:GetOwner(), pSelectedCity:GetID()) then local plotInfo :table = GetViewPlotInfo( kPlot ); plotInfo.hexArtdef = "Placement_Purchase"; plotInfo.selectable = true; plotInfo.purchasable = true; m_hexesDistrictPlacement[plotId]= plotInfo; end end end -- Send all the hex information to the engine for visualization. local hexIndexes:table = {}; for i,plotInfo in pairs(m_hexesDistrictPlacement) do UILens.SetAdjacencyBonusDistict( plotInfo.index, plotInfo.hexArtdef, plotInfo.adjacent ); end LuaEvents.StrategicView_MapPlacement_AddDistrictPlacementShadowHexes( kNonShadowHexes ); end end -- =========================================================================== -- Show the different potential district placement areas... -- =========================================================================== function OnInterfaceModeEnter_DistrictPlacement( eNewMode:number ) RealizePlotArtForDistrictPlacement(); UI.SetFixedTiltMode( true ); end function OnInterfaceModeLeave_DistrictPlacement( eNewMode:number ) LuaEvents.StrategicView_MapPlacement_ClearDistrictPlacementShadowHexes(); UI.SetFixedTiltMode( false ); end -- =========================================================================== -- -- =========================================================================== function OnCityMadePurchase_StrategicView_MapPlacement(owner:number, cityID:number, plotX:number, plotY:number, purchaseType, objectType) if owner ~= Game.GetLocalPlayer() then return; end if purchaseType == EventSubTypes.PLOT then -- Make sure city made purchase and it's the right mode. if (UI.GetInterfaceMode() == InterfaceModeTypes.DISTRICT_PLACEMENT) then -- Clear existing art then re-realize UILens.ClearLayerHexes( LensLayers.ADJACENCY_BONUS_DISTRICTS ); UILens.ClearLayerHexes( LensLayers.DISTRICTS ); RealizePlotArtForDistrictPlacement(); elseif (UI.GetInterfaceMode() == InterfaceModeTypes.BUILDING_PLACEMENT) then -- Clear existing art then re-realize UILens.ClearLayerHexes( LensLayers.ADJACENCY_BONUS_DISTRICTS ); UILens.ClearLayerHexes( LensLayers.DISTRICTS ); RealizePlotArtForWonderPlacement(); end end end -- =========================================================================== -- Whenever the mouse moves while in district or wonder placement mode. -- =========================================================================== function RealizeCurrentPlaceDistrictOrWonderPlot() local currentPlotId :number = UI.GetCursorPlotID(); if (not Map.IsPlot(currentPlotId)) then return; end if currentPlotId == m_cachedSelectedPlacementPlotId then return; end -- Reset the artdef for the currently selected hex if m_cachedSelectedPlacementPlotId ~= nil and m_cachedSelectedPlacementPlotId ~= -1 then local hex:table = m_hexesDistrictPlacement[m_cachedSelectedPlacementPlotId]; if hex ~= nil and hex.hexArtdef ~= nil and hex.selectable then UILens.UnFocusHex( LensLayers.DISTRICTS, hex.index, hex.hexArtdef ); end end m_cachedSelectedPlacementPlotId = currentPlotId; -- New HEX update it to the selected form. if m_cachedSelectedPlacementPlotId ~= -1 then local hex:table = m_hexesDistrictPlacement[m_cachedSelectedPlacementPlotId]; if hex ~= nil and hex.hexArtdef ~= nil and hex.selectable then UILens.FocusHex( LensLayers.DISTRICTS, hex.index, hex.hexArtdef ); end end end
mit
ld-test/argparse
src/argparse.lua
5
29166
-- The MIT License (MIT) -- Copyright (c) 2013 - 2015 Peter Melnichenko -- Permission is hereby granted, free of charge, to any person obtaining a copy of -- this software and associated documentation files (the "Software"), to deal in -- the Software without restriction, including without limitation the rights to -- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -- the Software, and to permit persons to whom the Software is furnished to do so, -- subject to the following conditions: -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. local function deep_update(t1, t2) for k, v in pairs(t2) do if type(v) == "table" then v = deep_update({}, v) end t1[k] = v end return t1 end -- A property is a tuple {name, callback}. -- properties.args is number of properties that can be set as arguments -- when calling an object. local function class(prototype, properties, parent) -- Class is the metatable of its instances. local cl = {} cl.__index = cl if parent then cl.__prototype = deep_update(deep_update({}, parent.__prototype), prototype) else cl.__prototype = prototype end if properties then local names = {} -- Create setter methods and fill set of property names. for _, property in ipairs(properties) do local name, callback = property[1], property[2] cl[name] = function(self, value) if not callback(self, value) then self["_" .. name] = value end return self end names[name] = true end function cl.__call(self, ...) -- When calling an object, if the first argument is a table, -- interpret keys as property names, else delegate arguments -- to corresponding setters in order. if type((...)) == "table" then for name, value in pairs((...)) do if names[name] then self[name](self, value) end end else local nargs = select("#", ...) for i, property in ipairs(properties) do if i > nargs or i > properties.args then break end local arg = select(i, ...) if arg ~= nil then self[property[1]](self, arg) end end end return self end end -- If indexing class fails, fallback to its parent. local class_metatable = {} class_metatable.__index = parent function class_metatable.__call(self, ...) -- Calling a class returns its instance. -- Arguments are delegated to the instance. local object = deep_update({}, self.__prototype) setmetatable(object, self) return object(...) end return setmetatable(cl, class_metatable) end local function typecheck(name, types, value) for _, type_ in ipairs(types) do if type(value) == type_ then return true end end error(("bad property '%s' (%s expected, got %s)"):format(name, table.concat(types, " or "), type(value))) end local function typechecked(name, ...) local types = {...} return {name, function(_, value) typecheck(name, types, value) end} end local multiname = {"name", function(self, value) typecheck("name", {"string"}, value) for alias in value:gmatch("%S+") do self._name = self._name or alias table.insert(self._aliases, alias) end -- Do not set _name as with other properties. return true end} local function parse_boundaries(str) if tonumber(str) then return tonumber(str), tonumber(str) end if str == "*" then return 0, math.huge end if str == "+" then return 1, math.huge end if str == "?" then return 0, 1 end if str:match "^%d+%-%d+$" then local min, max = str:match "^(%d+)%-(%d+)$" return tonumber(min), tonumber(max) end if str:match "^%d+%+$" then local min = str:match "^(%d+)%+$" return tonumber(min), math.huge end end local function boundaries(name) return {name, function(self, value) typecheck(name, {"number", "string"}, value) local min, max = parse_boundaries(value) if not min then error(("bad property '%s'"):format(name)) end self["_min" .. name], self["_max" .. name] = min, max end} end local actions = {} local option_action = {"action", function(_, value) typecheck("action", {"function", "string"}, value) if type(value) == "string" and not actions[value] then error(("unknown action '%s'"):format(value)) end end} local option_init = {"init", function(self) self._has_init = true end} local option_default = {"default", function(self, value) if type(value) ~= "string" then self._init = value self._has_init = true return true end end} local add_help = {"add_help", function(self, value) typecheck("add_help", {"boolean", "string", "table"}, value) if self._has_help then table.remove(self._options) self._has_help = false end if value then local help = self:flag() :description "Show this help message and exit." :action(function() print(self:get_help()) os.exit(0) end) if value ~= true then help = help(value) end if not help._name then help "-h" "--help" end self._has_help = true end end} local Parser = class({ _arguments = {}, _options = {}, _commands = {}, _mutexes = {}, _require_command = true, _handle_options = true }, { args = 3, typechecked("name", "string"), typechecked("description", "string"), typechecked("epilog", "string"), typechecked("usage", "string"), typechecked("help", "string"), typechecked("require_command", "boolean"), typechecked("handle_options", "boolean"), typechecked("action", "function"), typechecked("command_target", "string"), add_help }) local Command = class({ _aliases = {} }, { args = 3, multiname, typechecked("description", "string"), typechecked("epilog", "string"), typechecked("target", "string"), typechecked("usage", "string"), typechecked("help", "string"), typechecked("require_command", "boolean"), typechecked("handle_options", "boolean"), typechecked("action", "function"), typechecked("command_target", "string"), add_help }, Parser) local Argument = class({ _minargs = 1, _maxargs = 1, _mincount = 1, _maxcount = 1, _defmode = "unused", _show_default = true }, { args = 5, typechecked("name", "string"), typechecked("description", "string"), option_default, typechecked("convert", "function", "table"), boundaries("args"), typechecked("target", "string"), typechecked("defmode", "string"), typechecked("show_default", "boolean"), typechecked("argname", "string", "table"), option_action, option_init }) local Option = class({ _aliases = {}, _mincount = 0, _overwrite = true }, { args = 6, multiname, typechecked("description", "string"), option_default, typechecked("convert", "function", "table"), boundaries("args"), boundaries("count"), typechecked("target", "string"), typechecked("defmode", "string"), typechecked("show_default", "boolean"), typechecked("overwrite", "boolean"), typechecked("argname", "string", "table"), option_action, option_init }, Argument) function Argument:_get_argument_list() local buf = {} local i = 1 while i <= math.min(self._minargs, 3) do local argname = self:_get_argname(i) if self._default and self._defmode:find "a" then argname = "[" .. argname .. "]" end table.insert(buf, argname) i = i+1 end while i <= math.min(self._maxargs, 3) do table.insert(buf, "[" .. self:_get_argname(i) .. "]") i = i+1 if self._maxargs == math.huge then break end end if i < self._maxargs then table.insert(buf, "...") end return buf end function Argument:_get_usage() local usage = table.concat(self:_get_argument_list(), " ") if self._default and self._defmode:find "u" then if self._maxargs > 1 or (self._minargs == 1 and not self._defmode:find "a") then usage = "[" .. usage .. "]" end end return usage end function actions.store_true(result, target) result[target] = true end function actions.store_false(result, target) result[target] = false end function actions.store(result, target, argument) result[target] = argument end function actions.count(result, target, _, overwrite) if not overwrite then result[target] = result[target] + 1 end end function actions.append(result, target, argument, overwrite) result[target] = result[target] or {} table.insert(result[target], argument) if overwrite then table.remove(result[target], 1) end end function actions.concat(result, target, arguments, overwrite) if overwrite then error("'concat' action can't handle too many invocations") end result[target] = result[target] or {} for _, argument in ipairs(arguments) do table.insert(result[target], argument) end end function Argument:_get_action() local action, init if self._maxcount == 1 then if self._maxargs == 0 then action, init = "store_true", nil else action, init = "store", nil end else if self._maxargs == 0 then action, init = "count", 0 else action, init = "append", {} end end if self._action then action = self._action end if self._has_init then init = self._init end if type(action) == "string" then action = actions[action] end return action, init end -- Returns placeholder for `narg`-th argument. function Argument:_get_argname(narg) local argname = self._argname or self:_get_default_argname() if type(argname) == "table" then return argname[narg] else return argname end end function Argument:_get_default_argname() return "<" .. self._name .. ">" end function Option:_get_default_argname() return "<" .. self:_get_default_target() .. ">" end -- Returns label to be shown in the help message. function Argument:_get_label() return self._name end function Option:_get_label() local variants = {} local argument_list = self:_get_argument_list() table.insert(argument_list, 1, nil) for _, alias in ipairs(self._aliases) do argument_list[1] = alias table.insert(variants, table.concat(argument_list, " ")) end return table.concat(variants, ", ") end function Command:_get_label() return table.concat(self._aliases, ", ") end function Argument:_get_description() if self._default and self._show_default then if self._description then return ("%s (default: %s)"):format(self._description, self._default) else return ("default: %s"):format(self._default) end else return self._description or "" end end function Command:_get_description() return self._description or "" end function Option:_get_usage() local usage = self:_get_argument_list() table.insert(usage, 1, self._name) usage = table.concat(usage, " ") if self._mincount == 0 or self._default then usage = "[" .. usage .. "]" end return usage end function Argument:_get_default_target() return self._name end function Option:_get_default_target() local res for _, alias in ipairs(self._aliases) do if alias:sub(1, 1) == alias:sub(2, 2) then res = alias:sub(3) break end end res = res or self._name:sub(2) return (res:gsub("-", "_")) end function Option:_is_vararg() return self._maxargs ~= self._minargs end function Parser:_get_fullname() local parent = self._parent local buf = {self._name} while parent do table.insert(buf, 1, parent._name) parent = parent._parent end return table.concat(buf, " ") end function Parser:_update_charset(charset) charset = charset or {} for _, command in ipairs(self._commands) do command:_update_charset(charset) end for _, option in ipairs(self._options) do for _, alias in ipairs(option._aliases) do charset[alias:sub(1, 1)] = true end end return charset end function Parser:argument(...) local argument = Argument(...) table.insert(self._arguments, argument) return argument end function Parser:option(...) local option = Option(...) if self._has_help then table.insert(self._options, #self._options, option) else table.insert(self._options, option) end return option end function Parser:flag(...) return self:option():args(0)(...) end function Parser:command(...) local command = Command():add_help(true)(...) command._parent = self table.insert(self._commands, command) return command end function Parser:mutex(...) local options = {...} for i, option in ipairs(options) do assert(getmetatable(option) == Option, ("bad argument #%d to 'mutex' (Option expected)"):format(i)) end table.insert(self._mutexes, options) return self end local max_usage_width = 70 local usage_welcome = "Usage: " function Parser:get_usage() if self._usage then return self._usage end local lines = {usage_welcome .. self:_get_fullname()} local function add(s) if #lines[#lines]+1+#s <= max_usage_width then lines[#lines] = lines[#lines] .. " " .. s else lines[#lines+1] = (" "):rep(#usage_welcome) .. s end end -- This can definitely be refactored into something cleaner local mutex_options = {} local vararg_mutexes = {} -- First, put mutexes which do not contain vararg options and remember those which do for _, mutex in ipairs(self._mutexes) do local buf = {} local is_vararg = false for _, option in ipairs(mutex) do if option:_is_vararg() then is_vararg = true end table.insert(buf, option:_get_usage()) mutex_options[option] = true end local repr = "(" .. table.concat(buf, " | ") .. ")" if is_vararg then table.insert(vararg_mutexes, repr) else add(repr) end end -- Second, put regular options for _, option in ipairs(self._options) do if not mutex_options[option] and not option:_is_vararg() then add(option:_get_usage()) end end -- Put positional arguments for _, argument in ipairs(self._arguments) do add(argument:_get_usage()) end -- Put mutexes containing vararg options for _, mutex_repr in ipairs(vararg_mutexes) do add(mutex_repr) end for _, option in ipairs(self._options) do if not mutex_options[option] and option:_is_vararg() then add(option:_get_usage()) end end if #self._commands > 0 then if self._require_command then add("<command>") else add("[<command>]") end add("...") end return table.concat(lines, "\n") end local margin_len = 3 local margin_len2 = 25 local margin = (" "):rep(margin_len) local margin2 = (" "):rep(margin_len2) local function make_two_columns(s1, s2) if s2 == "" then return margin .. s1 end s2 = s2:gsub("\n", "\n" .. margin2) if #s1 < (margin_len2-margin_len) then return margin .. s1 .. (" "):rep(margin_len2-margin_len-#s1) .. s2 else return margin .. s1 .. "\n" .. margin2 .. s2 end end function Parser:get_help() if self._help then return self._help end local blocks = {self:get_usage()} if self._description then table.insert(blocks, self._description) end local labels = {"Arguments:", "Options:", "Commands:"} for i, elements in ipairs{self._arguments, self._options, self._commands} do if #elements > 0 then local buf = {labels[i]} for _, element in ipairs(elements) do table.insert(buf, make_two_columns(element:_get_label(), element:_get_description())) end table.insert(blocks, table.concat(buf, "\n")) end end if self._epilog then table.insert(blocks, self._epilog) end return table.concat(blocks, "\n\n") end local function get_tip(context, wrong_name) local context_pool = {} local possible_name local possible_names = {} for name in pairs(context) do if type(name) == "string" then for i = 1, #name do possible_name = name:sub(1, i - 1) .. name:sub(i + 1) if not context_pool[possible_name] then context_pool[possible_name] = {} end table.insert(context_pool[possible_name], name) end end end for i = 1, #wrong_name + 1 do possible_name = wrong_name:sub(1, i - 1) .. wrong_name:sub(i + 1) if context[possible_name] then possible_names[possible_name] = true elseif context_pool[possible_name] then for _, name in ipairs(context_pool[possible_name]) do possible_names[name] = true end end end local first = next(possible_names) if first then if next(possible_names, first) then local possible_names_arr = {} for name in pairs(possible_names) do table.insert(possible_names_arr, "'" .. name .. "'") end table.sort(possible_names_arr) return "\nDid you mean one of these: " .. table.concat(possible_names_arr, " ") .. "?" else return "\nDid you mean '" .. first .. "'?" end else return "" end end local ElementState = class({ invocations = 0 }) function ElementState:__call(state, element) self.state = state self.result = state.result self.element = element self.target = element._target or element:_get_default_target() self.action, self.result[self.target] = element:_get_action() return self end function ElementState:error(fmt, ...) self.state:error(fmt, ...) end function ElementState:convert(argument) local converter = self.element._convert if converter then local ok, err if type(converter) == "function" then ok, err = converter(argument) else ok = converter[argument] end if ok == nil then self:error(err and "%s" or "malformed argument '%s'", err or argument) end argument = ok end return argument end function ElementState:default(mode) return self.element._defmode:find(mode) and self.element._default end local function bound(noun, min, max, is_max) local res = "" if min ~= max then res = "at " .. (is_max and "most" or "least") .. " " end local number = is_max and max or min return res .. tostring(number) .. " " .. noun .. (number == 1 and "" or "s") end function ElementState:invoke(alias) self.open = true self.name = ("%s '%s'"):format(alias and "option" or "argument", alias or self.element._name) self.overwrite = false if self.invocations >= self.element._maxcount then if self.element._overwrite then self.overwrite = true else self:error("%s must be used %s", self.name, bound("time", self.element._mincount, self.element._maxcount, true)) end else self.invocations = self.invocations + 1 end self.args = {} if self.element._maxargs <= 0 then self:close() end return self.open end function ElementState:pass(argument) argument = self:convert(argument) table.insert(self.args, argument) if #self.args >= self.element._maxargs then self:close() end return self.open end function ElementState:complete_invocation() while #self.args < self.element._minargs do self:pass(self.element._default) end end function ElementState:close() if self.open then self.open = false if #self.args < self.element._minargs then if self:default("a") then self:complete_invocation() else if #self.args == 0 then if getmetatable(self.element) == Argument then self:error("missing %s", self.name) elseif self.element._maxargs == 1 then self:error("%s requires an argument", self.name) end end self:error("%s requires %s", self.name, bound("argument", self.element._minargs, self.element._maxargs)) end end local args = self.args if self.element._maxargs <= 1 then args = args[1] end if self.element._maxargs == 1 and self.element._minargs == 0 and self.element._mincount ~= self.element._maxcount then args = self.args end self.action(self.result, self.target, args, self.overwrite) end end local ParseState = class({ result = {}, options = {}, arguments = {}, argument_i = 1, element_to_mutexes = {}, mutex_to_used_option = {}, command_actions = {} }) function ParseState:__call(parser, error_handler) self.parser = parser self.error_handler = error_handler self.charset = parser:_update_charset() self:switch(parser) return self end function ParseState:error(fmt, ...) self.error_handler(self.parser, fmt:format(...)) end function ParseState:switch(parser) self.parser = parser if parser._action then table.insert(self.command_actions, {action = parser._action, name = parser._name}) end for _, option in ipairs(parser._options) do option = ElementState(self, option) table.insert(self.options, option) for _, alias in ipairs(option.element._aliases) do self.options[alias] = option end end for _, mutex in ipairs(parser._mutexes) do for _, option in ipairs(mutex) do if not self.element_to_mutexes[option] then self.element_to_mutexes[option] = {} end table.insert(self.element_to_mutexes[option], mutex) end end for _, argument in ipairs(parser._arguments) do argument = ElementState(self, argument) table.insert(self.arguments, argument) argument:invoke() end self.handle_options = parser._handle_options self.argument = self.arguments[self.argument_i] self.commands = parser._commands for _, command in ipairs(self.commands) do for _, alias in ipairs(command._aliases) do self.commands[alias] = command end end end function ParseState:get_option(name) local option = self.options[name] if not option then self:error("unknown option '%s'%s", name, get_tip(self.options, name)) else return option end end function ParseState:get_command(name) local command = self.commands[name] if not command then if #self.commands > 0 then self:error("unknown command '%s'%s", name, get_tip(self.commands, name)) else self:error("too many arguments") end else return command end end function ParseState:invoke(option, name) self:close() if self.element_to_mutexes[option.element] then for _, mutex in ipairs(self.element_to_mutexes[option.element]) do local used_option = self.mutex_to_used_option[mutex] if used_option and used_option ~= option then self:error("option '%s' can not be used together with %s", name, used_option.name) else self.mutex_to_used_option[mutex] = option end end end if option:invoke(name) then self.option = option end end function ParseState:pass(arg) if self.option then if not self.option:pass(arg) then self.option = nil end elseif self.argument then if not self.argument:pass(arg) then self.argument_i = self.argument_i + 1 self.argument = self.arguments[self.argument_i] end else local command = self:get_command(arg) self.result[command._target or command._name] = true if self.parser._command_target then self.result[self.parser._command_target] = command._name end self:switch(command) end end function ParseState:close() if self.option then self.option:close() self.option = nil end end function ParseState:finalize() self:close() for i = self.argument_i, #self.arguments do local argument = self.arguments[i] if #argument.args == 0 and argument:default("u") then argument:complete_invocation() else argument:close() end end if self.parser._require_command and #self.commands > 0 then self:error("a command is required") end for _, option in ipairs(self.options) do local name = option.name or ("option '%s'"):format(option.element._name) if option.invocations == 0 then if option:default("u") then option:invoke(name) option:complete_invocation() option:close() end end local mincount = option.element._mincount if option.invocations < mincount then if option:default("a") then while option.invocations < mincount do option:invoke(name) option:close() end elseif option.invocations == 0 then self:error("missing %s", name) else self:error("%s must be used %s", name, bound("time", mincount, option.element._maxcount)) end end end for i = #self.command_actions, 1, -1 do self.command_actions[i].action(self.result, self.command_actions[i].name) end end function ParseState:parse(args) for _, arg in ipairs(args) do local plain = true if self.handle_options then local first = arg:sub(1, 1) if self.charset[first] then if #arg > 1 then plain = false if arg:sub(2, 2) == first then if #arg == 2 then self:close() self.handle_options = false else local equals = arg:find "=" if equals then local name = arg:sub(1, equals - 1) local option = self:get_option(name) if option.element._maxargs <= 0 then self:error("option '%s' does not take arguments", name) end self:invoke(option, name) self:pass(arg:sub(equals + 1)) else local option = self:get_option(arg) self:invoke(option, arg) end end else for i = 2, #arg do local name = first .. arg:sub(i, i) local option = self:get_option(name) self:invoke(option, name) if i ~= #arg and option.element._maxargs > 0 then self:pass(arg:sub(i + 1)) break end end end end end end if plain then self:pass(arg) end end self:finalize() return self.result end function Parser:error(msg) io.stderr:write(("%s\n\nError: %s\n"):format(self:get_usage(), msg)) os.exit(1) end -- Compatibility with strict.lua and other checkers: local default_cmdline = rawget(_G, "arg") or {} function Parser:_parse(args, error_handler) return ParseState(self, error_handler):parse(args or default_cmdline) end function Parser:parse(args) return self:_parse(args, self.error) end local function xpcall_error_handler(err) return tostring(err) .. "\noriginal " .. debug.traceback("", 2):sub(2) end function Parser:pparse(args) local parse_error local ok, result = xpcall(function() return self:_parse(args, function(_, err) parse_error = err error(err, 0) end) end, xpcall_error_handler) if ok then return true, result elseif not parse_error then error(result, 0) else return false, parse_error end end return function(...) return Parser(default_cmdline[0]):add_help(true)(...) end
mit
ffxiphoenix/darkstar
scripts/globals/mobskills/Tebbad_Wing.lua
18
1240
--------------------------------------------- -- Tebbad Wing -- -- Description: A hot wind deals Fire damage to enemies within a very wide area of effect. Additional effect: Plague -- Type: Magical -- Utsusemi/Blink absorb: Wipes shadows -- Range: 30' radial. -- Notes: Used only by Tiamat, Smok and Ildebrann --------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); --------------------------------------------- function onMobSkillCheck(target,mob,skill) if (mob:hasStatusEffect(EFFECT_MIGHTY_STRIKES)) then return 1; elseif (mob:AnimationSub() == 1) then return 1; elseif (target:isBehind(mob, 48) == true) then return 1; end return 0; end; function onMobWeaponSkill(target, mob, skill) local typeEffect = EFFECT_PLAGUE; MobStatusEffectMove(mob, target, typeEffect, 10, 0, 120); local dmgmod = 1; local info = MobMagicalMove(mob,target,skill,mob:getWeaponDmg()*5,ELE_FIRE,dmgmod,TP_NO_EFFECT); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_MAGICAL,MOBPARAM_FIRE,MOBPARAM_WIPE_SHADOWS); target:delHP(dmg); return dmg; end;
gpl-3.0
steplebr/domoticz
scripts/lua/JSON.lua
28
50533
-- -*- coding: utf-8 -*- -- -- Simple JSON encoding and decoding in pure Lua. -- -- Copyright 2010-2016 Jeffrey Friedl -- http://regex.info/blog/ -- Latest version: http://regex.info/blog/lua/json -- -- This code is released under a Creative Commons CC-BY "Attribution" License: -- http://creativecommons.org/licenses/by/3.0/deed.en_US -- -- It can be used for any purpose so long as the copyright notice above, -- the web-page links above, and the 'AUTHOR_NOTE' string below are -- maintained. Enjoy. -- local VERSION = 20160916.19 -- version history at end of file local AUTHOR_NOTE = "-[ JSON.lua package by Jeffrey Friedl (http://regex.info/blog/lua/json) version 20160916.19 ]-" -- -- The 'AUTHOR_NOTE' variable exists so that information about the source -- of the package is maintained even in compiled versions. It's also -- included in OBJDEF below mostly to quiet warnings about unused variables. -- local OBJDEF = { VERSION = VERSION, AUTHOR_NOTE = AUTHOR_NOTE, } -- -- Simple JSON encoding and decoding in pure Lua. -- JSON definition: http://www.json.org/ -- -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local lua_value = JSON:decode(raw_json_text) -- -- local raw_json_text = JSON:encode(lua_table_or_value) -- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability -- -- -- -- DECODING (from a JSON string to a Lua table) -- -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local lua_value = JSON:decode(raw_json_text) -- -- If the JSON text is for an object or an array, e.g. -- { "what": "books", "count": 3 } -- or -- [ "Larry", "Curly", "Moe" ] -- -- the result is a Lua table, e.g. -- { what = "books", count = 3 } -- or -- { "Larry", "Curly", "Moe" } -- -- -- The encode and decode routines accept an optional second argument, -- "etc", which is not used during encoding or decoding, but upon error -- is passed along to error handlers. It can be of any type (including nil). -- -- -- -- ERROR HANDLING -- -- With most errors during decoding, this code calls -- -- JSON:onDecodeError(message, text, location, etc) -- -- with a message about the error, and if known, the JSON text being -- parsed and the byte count where the problem was discovered. You can -- replace the default JSON:onDecodeError() with your own function. -- -- The default onDecodeError() merely augments the message with data -- about the text and the location if known (and if a second 'etc' -- argument had been provided to decode(), its value is tacked onto the -- message as well), and then calls JSON.assert(), which itself defaults -- to Lua's built-in assert(), and can also be overridden. -- -- For example, in an Adobe Lightroom plugin, you might use something like -- -- function JSON:onDecodeError(message, text, location, etc) -- LrErrors.throwUserError("Internal Error: invalid JSON data") -- end -- -- or even just -- -- function JSON.assert(message) -- LrErrors.throwUserError("Internal Error: " .. message) -- end -- -- If JSON:decode() is passed a nil, this is called instead: -- -- JSON:onDecodeOfNilError(message, nil, nil, etc) -- -- and if JSON:decode() is passed HTML instead of JSON, this is called: -- -- JSON:onDecodeOfHTMLError(message, text, nil, etc) -- -- The use of the fourth 'etc' argument allows stronger coordination -- between decoding and error reporting, especially when you provide your -- own error-handling routines. Continuing with the the Adobe Lightroom -- plugin example: -- -- function JSON:onDecodeError(message, text, location, etc) -- local note = "Internal Error: invalid JSON data" -- if type(etc) = 'table' and etc.photo then -- note = note .. " while processing for " .. etc.photo:getFormattedMetadata('fileName') -- end -- LrErrors.throwUserError(note) -- end -- -- : -- : -- -- for i, photo in ipairs(photosToProcess) do -- : -- : -- local data = JSON:decode(someJsonText, { photo = photo }) -- : -- : -- end -- -- -- -- -- -- DECODING AND STRICT TYPES -- -- Because both JSON objects and JSON arrays are converted to Lua tables, -- it's not normally possible to tell which original JSON type a -- particular Lua table was derived from, or guarantee decode-encode -- round-trip equivalency. -- -- However, if you enable strictTypes, e.g. -- -- JSON = assert(loadfile "JSON.lua")() --load the routines -- JSON.strictTypes = true -- -- then the Lua table resulting from the decoding of a JSON object or -- JSON array is marked via Lua metatable, so that when re-encoded with -- JSON:encode() it ends up as the appropriate JSON type. -- -- (This is not the default because other routines may not work well with -- tables that have a metatable set, for example, Lightroom API calls.) -- -- -- ENCODING (from a lua table to a JSON string) -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local raw_json_text = JSON:encode(lua_table_or_value) -- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability -- local custom_pretty = JSON:encode(lua_table_or_value, etc, { pretty = true, indent = "| ", align_keys = false }) -- -- On error during encoding, this code calls: -- -- JSON:onEncodeError(message, etc) -- -- which you can override in your local JSON object. -- -- The 'etc' in the error call is the second argument to encode() -- and encode_pretty(), or nil if it wasn't provided. -- -- -- ENCODING OPTIONS -- -- An optional third argument, a table of options, can be provided to encode(). -- -- encode_options = { -- -- options for making "pretty" human-readable JSON (see "PRETTY-PRINTING" below) -- pretty = true, -- indent = " ", -- align_keys = false, -- -- -- other output-related options -- null = "\0", -- see "ENCODING JSON NULL VALUES" below -- stringsAreUtf8 = false, -- see "HANDLING UNICODE LINE AND PARAGRAPH SEPARATORS FOR JAVA" below -- } -- -- json_string = JSON:encode(mytable, etc, encode_options) -- -- -- -- For reference, the defaults are: -- -- pretty = false -- null = nil, -- stringsAreUtf8 = false, -- -- -- -- PRETTY-PRINTING -- -- Enabling the 'pretty' encode option helps generate human-readable JSON. -- -- pretty = JSON:encode(val, etc, { -- pretty = true, -- indent = " ", -- align_keys = false, -- }) -- -- encode_pretty() is also provided: it's identical to encode() except -- that encode_pretty() provides a default options table if none given in the call: -- -- { pretty = true, align_keys = false, indent = " " } -- -- For example, if -- -- JSON:encode(data) -- -- produces: -- -- {"city":"Kyoto","climate":{"avg_temp":16,"humidity":"high","snowfall":"minimal"},"country":"Japan","wards":11} -- -- then -- -- JSON:encode_pretty(data) -- -- produces: -- -- { -- "city": "Kyoto", -- "climate": { -- "avg_temp": 16, -- "humidity": "high", -- "snowfall": "minimal" -- }, -- "country": "Japan", -- "wards": 11 -- } -- -- The following three lines return identical results: -- JSON:encode_pretty(data) -- JSON:encode_pretty(data, nil, { pretty = true, align_keys = false, indent = " " }) -- JSON:encode (data, nil, { pretty = true, align_keys = false, indent = " " }) -- -- An example of setting your own indent string: -- -- JSON:encode_pretty(data, nil, { pretty = true, indent = "| " }) -- -- produces: -- -- { -- | "city": "Kyoto", -- | "climate": { -- | | "avg_temp": 16, -- | | "humidity": "high", -- | | "snowfall": "minimal" -- | }, -- | "country": "Japan", -- | "wards": 11 -- } -- -- An example of setting align_keys to true: -- -- JSON:encode_pretty(data, nil, { pretty = true, indent = " ", align_keys = true }) -- -- produces: -- -- { -- "city": "Kyoto", -- "climate": { -- "avg_temp": 16, -- "humidity": "high", -- "snowfall": "minimal" -- }, -- "country": "Japan", -- "wards": 11 -- } -- -- which I must admit is kinda ugly, sorry. This was the default for -- encode_pretty() prior to version 20141223.14. -- -- -- HANDLING UNICODE LINE AND PARAGRAPH SEPARATORS FOR JAVA -- -- If the 'stringsAreUtf8' encode option is set to true, consider Lua strings not as a sequence of bytes, -- but as a sequence of UTF-8 characters. -- -- Currently, the only practical effect of setting this option is that Unicode LINE and PARAGRAPH -- separators, if found in a string, are encoded with a JSON escape instead of being dumped as is. -- The JSON is valid either way, but encoding this way, apparently, allows the resulting JSON -- to also be valid Java. -- -- AMBIGUOUS SITUATIONS DURING THE ENCODING -- -- During the encode, if a Lua table being encoded contains both string -- and numeric keys, it fits neither JSON's idea of an object, nor its -- idea of an array. To get around this, when any string key exists (or -- when non-positive numeric keys exist), numeric keys are converted to -- strings. -- -- For example, -- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) -- produces the JSON object -- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} -- -- To prohibit this conversion and instead make it an error condition, set -- JSON.noKeyConversion = true -- -- -- ENCODING JSON NULL VALUES -- -- Lua tables completely omit keys whose value is nil, so without special handling there's -- no way to get a field in a JSON object with a null value. For example -- JSON:encode({ username = "admin", password = nil }) -- produces -- {"username":"admin"} -- -- In order to actually produce -- {"username":"admin", "password":null} -- one can include a string value for a "null" field in the options table passed to encode().... -- any Lua table entry with that value becomes null in the JSON output: -- JSON:encode({ username = "admin", password = "xyzzy" }, nil, { null = "xyzzy" }) -- produces -- {"username":"admin", "password":null} -- -- Just be sure to use a string that is otherwise unlikely to appear in your data. -- The string "\0" (a string with one null byte) may well be appropriate for many applications. -- -- The "null" options also applies to Lua tables that become JSON arrays. -- JSON:encode({ "one", "two", nil, nil }) -- produces -- ["one","two"] -- while -- NULL = "\0" -- JSON:encode({ "one", "two", NULL, NULL}, nil, { null = NULL }) -- produces -- ["one","two",null,null] -- -- -- -- -- HANDLING LARGE AND/OR PRECISE NUMBERS -- -- -- Without special handling, numbers in JSON can lose precision in Lua. -- For example: -- -- T = JSON:decode('{ "small":12345, "big":12345678901234567890123456789, "precise":9876.67890123456789012345 }') -- -- print("small: ", type(T.small), T.small) -- print("big: ", type(T.big), T.big) -- print("precise: ", type(T.precise), T.precise) -- -- produces -- -- small: number 12345 -- big: number 1.2345678901235e+28 -- precise: number 9876.6789012346 -- -- Precision is lost with both 'big' and 'precise'. -- -- This package offers ways to try to handle this better (for some definitions of "better")... -- -- The most precise method is by setting the global: -- -- JSON.decodeNumbersAsObjects = true -- -- When this is set, numeric JSON data is encoded into Lua in a form that preserves the exact -- JSON numeric presentation when re-encoded back out to JSON, or accessed in Lua as a string. -- -- (This is done by encoding the numeric data with a Lua table/metatable that returns -- the possibly-imprecise numeric form when accessed numerically, but the original precise -- representation when accessed as a string. You can also explicitly access -- via JSON:forceString() and JSON:forceNumber()) -- -- Consider the example above, with this option turned on: -- -- JSON.decodeNumbersAsObjects = true -- -- T = JSON:decode('{ "small":12345, "big":12345678901234567890123456789, "precise":9876.67890123456789012345 }') -- -- print("small: ", type(T.small), T.small) -- print("big: ", type(T.big), T.big) -- print("precise: ", type(T.precise), T.precise) -- -- This now produces: -- -- small: table 12345 -- big: table 12345678901234567890123456789 -- precise: table 9876.67890123456789012345 -- -- However, within Lua you can still use the values (e.g. T.precise in the example above) in numeric -- contexts. In such cases you'll get the possibly-imprecise numeric version, but in string contexts -- and when the data finds its way to this package's encode() function, the original full-precision -- representation is used. -- -- Even without using the JSON.decodeNumbersAsObjects option, you can encode numbers -- in your Lua table that retain high precision upon encoding to JSON, by using the JSON:asNumber() -- function: -- -- T = { -- imprecise = 123456789123456789.123456789123456789, -- precise = JSON:asNumber("123456789123456789.123456789123456789") -- } -- -- print(JSON:encode_pretty(T)) -- -- This produces: -- -- { -- "precise": 123456789123456789.123456789123456789, -- "imprecise": 1.2345678912346e+17 -- } -- -- -- -- A different way to handle big/precise JSON numbers is to have decode() merely return -- the exact string representation of the number instead of the number itself. -- This approach might be useful when the numbers are merely some kind of opaque -- object identifier and you want to work with them in Lua as strings anyway. -- -- This approach is enabled by setting -- -- JSON.decodeIntegerStringificationLength = 10 -- -- The value is the number of digits (of the integer part of the number) at which to stringify numbers. -- -- Consider our previous example with this option set to 10: -- -- JSON.decodeIntegerStringificationLength = 10 -- -- T = JSON:decode('{ "small":12345, "big":12345678901234567890123456789, "precise":9876.67890123456789012345 }') -- -- print("small: ", type(T.small), T.small) -- print("big: ", type(T.big), T.big) -- print("precise: ", type(T.precise), T.precise) -- -- This produces: -- -- small: number 12345 -- big: string 12345678901234567890123456789 -- precise: number 9876.6789012346 -- -- The long integer of the 'big' field is at least JSON.decodeIntegerStringificationLength digits -- in length, so it's converted not to a Lua integer but to a Lua string. Using a value of 0 or 1 ensures -- that all JSON numeric data becomes strings in Lua. -- -- Note that unlike -- JSON.decodeNumbersAsObjects = true -- this stringification is simple and unintelligent: the JSON number simply becomes a Lua string, and that's the end of it. -- If the string is then converted back to JSON, it's still a string. After running the code above, adding -- print(JSON:encode(T)) -- produces -- {"big":"12345678901234567890123456789","precise":9876.6789012346,"small":12345} -- which is unlikely to be desired. -- -- There's a comparable option for the length of the decimal part of a number: -- -- JSON.decodeDecimalStringificationLength -- -- This can be used alone or in conjunction with -- -- JSON.decodeIntegerStringificationLength -- -- to trip stringification on precise numbers with at least JSON.decodeIntegerStringificationLength digits after -- the decimal point. -- -- This example: -- -- JSON.decodeIntegerStringificationLength = 10 -- JSON.decodeDecimalStringificationLength = 5 -- -- T = JSON:decode('{ "small":12345, "big":12345678901234567890123456789, "precise":9876.67890123456789012345 }') -- -- print("small: ", type(T.small), T.small) -- print("big: ", type(T.big), T.big) -- print("precise: ", type(T.precise), T.precise) -- -- produces: -- -- small: number 12345 -- big: string 12345678901234567890123456789 -- precise: string 9876.67890123456789012345 -- -- -- -- -- -- SUMMARY OF METHODS YOU CAN OVERRIDE IN YOUR LOCAL LUA JSON OBJECT -- -- assert -- onDecodeError -- onDecodeOfNilError -- onDecodeOfHTMLError -- onEncodeError -- -- If you want to create a separate Lua JSON object with its own error handlers, -- you can reload JSON.lua or use the :new() method. -- --------------------------------------------------------------------------- local default_pretty_indent = " " local default_pretty_options = { pretty = true, align_keys = false, indent = default_pretty_indent } local isArray = { __tostring = function() return "JSON array" end } isArray.__index = isArray local isObject = { __tostring = function() return "JSON object" end } isObject.__index = isObject function OBJDEF:newArray(tbl) return setmetatable(tbl or {}, isArray) end function OBJDEF:newObject(tbl) return setmetatable(tbl or {}, isObject) end local function getnum(op) return type(op) == 'number' and op or op.N end local isNumber = { __tostring = function(T) return T.S end, __unm = function(op) return getnum(op) end, __concat = function(op1, op2) return tostring(op1) .. tostring(op2) end, __add = function(op1, op2) return getnum(op1) + getnum(op2) end, __sub = function(op1, op2) return getnum(op1) - getnum(op2) end, __mul = function(op1, op2) return getnum(op1) * getnum(op2) end, __div = function(op1, op2) return getnum(op1) / getnum(op2) end, __mod = function(op1, op2) return getnum(op1) % getnum(op2) end, __pow = function(op1, op2) return getnum(op1) ^ getnum(op2) end, __lt = function(op1, op2) return getnum(op1) < getnum(op2) end, __eq = function(op1, op2) return getnum(op1) == getnum(op2) end, __le = function(op1, op2) return getnum(op1) <= getnum(op2) end, } isNumber.__index = isNumber function OBJDEF:asNumber(item) if getmetatable(item) == isNumber then -- it's already a JSON number object. return item elseif type(item) == 'table' and type(item.S) == 'string' and type(item.N) == 'number' then -- it's a number-object table that lost its metatable, so give it one return setmetatable(item, isNumber) else -- the normal situation... given a number or a string representation of a number.... local holder = { S = tostring(item), -- S is the representation of the number as a string, which remains precise N = tonumber(item), -- N is the number as a Lua number. } return setmetatable(holder, isNumber) end end -- -- Given an item that might be a normal string or number, or might be an 'isNumber' object defined above, -- return the string version. This shouldn't be needed often because the 'isNumber' object should autoconvert -- to a string in most cases, but it's here to allow it to be forced when needed. -- function OBJDEF:forceString(item) if type(item) == 'table' and type(item.S) == 'string' then return item.S else return tostring(item) end end -- -- Given an item that might be a normal string or number, or might be an 'isNumber' object defined above, -- return the numeric version. -- function OBJDEF:forceNumber(item) if type(item) == 'table' and type(item.N) == 'number' then return item.N else return tonumber(item) end end local function unicode_codepoint_as_utf8(codepoint) -- -- codepoint is a number -- if codepoint <= 127 then return string.char(codepoint) elseif codepoint <= 2047 then -- -- 110yyyxx 10xxxxxx <-- useful notation from http://en.wikipedia.org/wiki/Utf8 -- local highpart = math.floor(codepoint / 0x40) local lowpart = codepoint - (0x40 * highpart) return string.char(0xC0 + highpart, 0x80 + lowpart) elseif codepoint <= 65535 then -- -- 1110yyyy 10yyyyxx 10xxxxxx -- local highpart = math.floor(codepoint / 0x1000) local remainder = codepoint - 0x1000 * highpart local midpart = math.floor(remainder / 0x40) local lowpart = remainder - 0x40 * midpart highpart = 0xE0 + highpart midpart = 0x80 + midpart lowpart = 0x80 + lowpart -- -- Check for an invalid character (thanks Andy R. at Adobe). -- See table 3.7, page 93, in http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#G28070 -- if ( highpart == 0xE0 and midpart < 0xA0 ) or ( highpart == 0xED and midpart > 0x9F ) or ( highpart == 0xF0 and midpart < 0x90 ) or ( highpart == 0xF4 and midpart > 0x8F ) then return "?" else return string.char(highpart, midpart, lowpart) end else -- -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx -- local highpart = math.floor(codepoint / 0x40000) local remainder = codepoint - 0x40000 * highpart local midA = math.floor(remainder / 0x1000) remainder = remainder - 0x1000 * midA local midB = math.floor(remainder / 0x40) local lowpart = remainder - 0x40 * midB return string.char(0xF0 + highpart, 0x80 + midA, 0x80 + midB, 0x80 + lowpart) end end function OBJDEF:onDecodeError(message, text, location, etc) if text then if location then message = string.format("%s at char %d of: %s", message, location, text) else message = string.format("%s: %s", message, text) end end if etc ~= nil then message = message .. " (" .. OBJDEF:encode(etc) .. ")" end if self.assert then self.assert(false, message) else assert(false, message) end end OBJDEF.onDecodeOfNilError = OBJDEF.onDecodeError OBJDEF.onDecodeOfHTMLError = OBJDEF.onDecodeError function OBJDEF:onEncodeError(message, etc) if etc ~= nil then message = message .. " (" .. OBJDEF:encode(etc) .. ")" end if self.assert then self.assert(false, message) else assert(false, message) end end local function grok_number(self, text, start, options) -- -- Grab the integer part -- local integer_part = text:match('^-?[1-9]%d*', start) or text:match("^-?0", start) if not integer_part then self:onDecodeError("expected number", text, start, options.etc) end local i = start + integer_part:len() -- -- Grab an optional decimal part -- local decimal_part = text:match('^%.%d+', i) or "" i = i + decimal_part:len() -- -- Grab an optional exponential part -- local exponent_part = text:match('^[eE][-+]?%d+', i) or "" i = i + exponent_part:len() local full_number_text = integer_part .. decimal_part .. exponent_part if options.decodeNumbersAsObjects then return OBJDEF:asNumber(full_number_text), i end -- -- If we're told to stringify under certain conditions, so do. -- We punt a bit when there's an exponent by just stringifying no matter what. -- I suppose we should really look to see whether the exponent is actually big enough one -- way or the other to trip stringification, but I'll be lazy about it until someone asks. -- if (options.decodeIntegerStringificationLength and (integer_part:len() >= options.decodeIntegerStringificationLength or exponent_part:len() > 0)) or (options.decodeDecimalStringificationLength and (decimal_part:len() >= options.decodeDecimalStringificationLength or exponent_part:len() > 0)) then return full_number_text, i -- this returns the exact string representation seen in the original JSON end local as_number = tonumber(full_number_text) if not as_number then self:onDecodeError("bad number", text, start, options.etc) end return as_number, i end local function grok_string(self, text, start, options) if text:sub(start,start) ~= '"' then self:onDecodeError("expected string's opening quote", text, start, options.etc) end local i = start + 1 -- +1 to bypass the initial quote local text_len = text:len() local VALUE = "" while i <= text_len do local c = text:sub(i,i) if c == '"' then return VALUE, i + 1 end if c ~= '\\' then VALUE = VALUE .. c i = i + 1 elseif text:match('^\\b', i) then VALUE = VALUE .. "\b" i = i + 2 elseif text:match('^\\f', i) then VALUE = VALUE .. "\f" i = i + 2 elseif text:match('^\\n', i) then VALUE = VALUE .. "\n" i = i + 2 elseif text:match('^\\r', i) then VALUE = VALUE .. "\r" i = i + 2 elseif text:match('^\\t', i) then VALUE = VALUE .. "\t" i = i + 2 else local hex = text:match('^\\u([0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) if hex then i = i + 6 -- bypass what we just read -- We have a Unicode codepoint. It could be standalone, or if in the proper range and -- followed by another in a specific range, it'll be a two-code surrogate pair. local codepoint = tonumber(hex, 16) if codepoint >= 0xD800 and codepoint <= 0xDBFF then -- it's a hi surrogate... see whether we have a following low local lo_surrogate = text:match('^\\u([dD][cdefCDEF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) if lo_surrogate then i = i + 6 -- bypass the low surrogate we just read codepoint = 0x2400 + (codepoint - 0xD800) * 0x400 + tonumber(lo_surrogate, 16) else -- not a proper low, so we'll just leave the first codepoint as is and spit it out. end end VALUE = VALUE .. unicode_codepoint_as_utf8(codepoint) else -- just pass through what's escaped VALUE = VALUE .. text:match('^\\(.)', i) i = i + 2 end end end self:onDecodeError("unclosed string", text, start, options.etc) end local function skip_whitespace(text, start) local _, match_end = text:find("^[ \n\r\t]+", start) -- [http://www.ietf.org/rfc/rfc4627.txt] Section 2 if match_end then return match_end + 1 else return start end end local grok_one -- assigned later local function grok_object(self, text, start, options) if text:sub(start,start) ~= '{' then self:onDecodeError("expected '{'", text, start, options.etc) end local i = skip_whitespace(text, start + 1) -- +1 to skip the '{' local VALUE = self.strictTypes and self:newObject { } or { } if text:sub(i,i) == '}' then return VALUE, i + 1 end local text_len = text:len() while i <= text_len do local key, new_i = grok_string(self, text, i, options) i = skip_whitespace(text, new_i) if text:sub(i, i) ~= ':' then self:onDecodeError("expected colon", text, i, options.etc) end i = skip_whitespace(text, i + 1) local new_val, new_i = grok_one(self, text, i, options) VALUE[key] = new_val -- -- Expect now either '}' to end things, or a ',' to allow us to continue. -- i = skip_whitespace(text, new_i) local c = text:sub(i,i) if c == '}' then return VALUE, i + 1 end if text:sub(i, i) ~= ',' then self:onDecodeError("expected comma or '}'", text, i, options.etc) end i = skip_whitespace(text, i + 1) end self:onDecodeError("unclosed '{'", text, start, options.etc) end local function grok_array(self, text, start, options) if text:sub(start,start) ~= '[' then self:onDecodeError("expected '['", text, start, options.etc) end local i = skip_whitespace(text, start + 1) -- +1 to skip the '[' local VALUE = self.strictTypes and self:newArray { } or { } if text:sub(i,i) == ']' then return VALUE, i + 1 end local VALUE_INDEX = 1 local text_len = text:len() while i <= text_len do local val, new_i = grok_one(self, text, i, options) -- can't table.insert(VALUE, val) here because it's a no-op if val is nil VALUE[VALUE_INDEX] = val VALUE_INDEX = VALUE_INDEX + 1 i = skip_whitespace(text, new_i) -- -- Expect now either ']' to end things, or a ',' to allow us to continue. -- local c = text:sub(i,i) if c == ']' then return VALUE, i + 1 end if text:sub(i, i) ~= ',' then self:onDecodeError("expected comma or '['", text, i, options.etc) end i = skip_whitespace(text, i + 1) end self:onDecodeError("unclosed '['", text, start, options.etc) end grok_one = function(self, text, start, options) -- Skip any whitespace start = skip_whitespace(text, start) if start > text:len() then self:onDecodeError("unexpected end of string", text, nil, options.etc) end if text:find('^"', start) then return grok_string(self, text, start, options.etc) elseif text:find('^[-0123456789 ]', start) then return grok_number(self, text, start, options) elseif text:find('^%{', start) then return grok_object(self, text, start, options) elseif text:find('^%[', start) then return grok_array(self, text, start, options) elseif text:find('^true', start) then return true, start + 4 elseif text:find('^false', start) then return false, start + 5 elseif text:find('^null', start) then return nil, start + 4 else self:onDecodeError("can't parse JSON", text, start, options.etc) end end function OBJDEF:decode(text, etc, options) -- -- If the user didn't pass in a table of decode options, make an empty one. -- if type(options) ~= 'table' then options = {} end -- -- If they passed in an 'etc' argument, stuff it into the options. -- (If not, any 'etc' field in the options they passed in remains to be used) -- if etc ~= nil then options.etc = etc end if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onDecodeError("JSON:decode must be called in method format", nil, nil, options.etc) end if text == nil then self:onDecodeOfNilError(string.format("nil passed to JSON:decode()"), nil, nil, options.etc) elseif type(text) ~= 'string' then self:onDecodeError(string.format("expected string argument to JSON:decode(), got %s", type(text)), nil, nil, options.etc) end if text:match('^%s*$') then return nil end if text:match('^%s*<') then -- Can't be JSON... we'll assume it's HTML self:onDecodeOfHTMLError(string.format("html passed to JSON:decode()"), text, nil, options.etc) end -- -- Ensure that it's not UTF-32 or UTF-16. -- Those are perfectly valid encodings for JSON (as per RFC 4627 section 3), -- but this package can't handle them. -- if text:sub(1,1):byte() == 0 or (text:len() >= 2 and text:sub(2,2):byte() == 0) then self:onDecodeError("JSON package groks only UTF-8, sorry", text, nil, options.etc) end -- -- apply global options -- if options.decodeNumbersAsObjects == nil then options.decodeNumbersAsObjects = self.decodeNumbersAsObjects end if options.decodeIntegerStringificationLength == nil then options.decodeIntegerStringificationLength = self.decodeIntegerStringificationLength end if options.decodeDecimalStringificationLength == nil then options.decodeDecimalStringificationLength = self.decodeDecimalStringificationLength end local success, value = pcall(grok_one, self, text, 1, options) if success then return value else -- if JSON:onDecodeError() didn't abort out of the pcall, we'll have received the error message here as "value", so pass it along as an assert. if self.assert then self.assert(false, value) else assert(false, value) end -- and if we're still here, return a nil and throw the error message on as a second arg return nil, value end end local function backslash_replacement_function(c) if c == "\n" then return "\\n" elseif c == "\r" then return "\\r" elseif c == "\t" then return "\\t" elseif c == "\b" then return "\\b" elseif c == "\f" then return "\\f" elseif c == '"' then return '\\"' elseif c == '\\' then return '\\\\' else return string.format("\\u%04x", c:byte()) end end local chars_to_be_escaped_in_JSON_string = '[' .. '"' -- class sub-pattern to match a double quote .. '%\\' -- class sub-pattern to match a backslash .. '%z' -- class sub-pattern to match a null .. '\001' .. '-' .. '\031' -- class sub-pattern to match control characters .. ']' local LINE_SEPARATOR_as_utf8 = unicode_codepoint_as_utf8(0x2028) local PARAGRAPH_SEPARATOR_as_utf8 = unicode_codepoint_as_utf8(0x2029) local function json_string_literal(value, options) local newval = value:gsub(chars_to_be_escaped_in_JSON_string, backslash_replacement_function) if options.stringsAreUtf8 then -- -- This feels really ugly to just look into a string for the sequence of bytes that we know to be a particular utf8 character, -- but utf8 was designed purposefully to make this kind of thing possible. Still, feels dirty. -- I'd rather decode the byte stream into a character stream, but it's not technically needed so -- not technically worth it. -- newval = newval:gsub(LINE_SEPARATOR_as_utf8, '\\u2028'):gsub(PARAGRAPH_SEPARATOR_as_utf8,'\\u2029') end return '"' .. newval .. '"' end local function object_or_array(self, T, etc) -- -- We need to inspect all the keys... if there are any strings, we'll convert to a JSON -- object. If there are only numbers, it's a JSON array. -- -- If we'll be converting to a JSON object, we'll want to sort the keys so that the -- end result is deterministic. -- local string_keys = { } local number_keys = { } local number_keys_must_be_strings = false local maximum_number_key for key in pairs(T) do if type(key) == 'string' then table.insert(string_keys, key) elseif type(key) == 'number' then table.insert(number_keys, key) if key <= 0 or key >= math.huge then number_keys_must_be_strings = true elseif not maximum_number_key or key > maximum_number_key then maximum_number_key = key end else self:onEncodeError("can't encode table with a key of type " .. type(key), etc) end end if #string_keys == 0 and not number_keys_must_be_strings then -- -- An empty table, or a numeric-only array -- if #number_keys > 0 then return nil, maximum_number_key -- an array elseif tostring(T) == "JSON array" then return nil elseif tostring(T) == "JSON object" then return { } else -- have to guess, so we'll pick array, since empty arrays are likely more common than empty objects return nil end end table.sort(string_keys) local map if #number_keys > 0 then -- -- If we're here then we have either mixed string/number keys, or numbers inappropriate for a JSON array -- It's not ideal, but we'll turn the numbers into strings so that we can at least create a JSON object. -- if self.noKeyConversion then self:onEncodeError("a table with both numeric and string keys could be an object or array; aborting", etc) end -- -- Have to make a shallow copy of the source table so we can remap the numeric keys to be strings -- map = { } for key, val in pairs(T) do map[key] = val end table.sort(number_keys) -- -- Throw numeric keys in there as strings -- for _, number_key in ipairs(number_keys) do local string_key = tostring(number_key) if map[string_key] == nil then table.insert(string_keys , string_key) map[string_key] = T[number_key] else self:onEncodeError("conflict converting table with mixed-type keys into a JSON object: key " .. number_key .. " exists both as a string and a number.", etc) end end end return string_keys, nil, map end -- -- Encode -- -- 'options' is nil, or a table with possible keys: -- -- pretty -- If true, return a pretty-printed version. -- -- indent -- A string (usually of spaces) used to indent each nested level. -- -- align_keys -- If true, align all the keys when formatting a table. -- -- null -- If this exists with a string value, table elements with this value are output as JSON null. -- -- stringsAreUtf8 -- If true, consider Lua strings not as a sequence of bytes, but as a sequence of UTF-8 characters. -- (Currently, the only practical effect of setting this option is that Unicode LINE and PARAGRAPH -- separators, if found in a string, are encoded with a JSON escape instead of as raw UTF-8. -- The JSON is valid either way, but encoding this way, apparently, allows the resulting JSON -- to also be valid Java.) -- -- local encode_value -- must predeclare because it calls itself function encode_value(self, value, parents, etc, options, indent, for_key) -- -- keys in a JSON object can never be null, so we don't even consider options.null when converting a key value -- if value == nil or (not for_key and options and options.null and value == options.null) then return 'null' elseif type(value) == 'string' then return json_string_literal(value, options) elseif type(value) == 'number' then if value ~= value then -- -- NaN (Not a Number). -- JSON has no NaN, so we have to fudge the best we can. This should really be a package option. -- return "null" elseif value >= math.huge then -- -- Positive infinity. JSON has no INF, so we have to fudge the best we can. This should -- really be a package option. Note: at least with some implementations, positive infinity -- is both ">= math.huge" and "<= -math.huge", which makes no sense but that's how it is. -- Negative infinity is properly "<= -math.huge". So, we must be sure to check the ">=" -- case first. -- return "1e+9999" elseif value <= -math.huge then -- -- Negative infinity. -- JSON has no INF, so we have to fudge the best we can. This should really be a package option. -- return "-1e+9999" else return tostring(value) end elseif type(value) == 'boolean' then return tostring(value) elseif type(value) ~= 'table' then self:onEncodeError("can't convert " .. type(value) .. " to JSON", etc) elseif getmetatable(value) == isNumber then return tostring(value) else -- -- A table to be converted to either a JSON object or array. -- local T = value if type(options) ~= 'table' then options = {} end if type(indent) ~= 'string' then indent = "" end if parents[T] then self:onEncodeError("table " .. tostring(T) .. " is a child of itself", etc) else parents[T] = true end local result_value local object_keys, maximum_number_key, map = object_or_array(self, T, etc) if maximum_number_key then -- -- An array... -- local ITEMS = { } for i = 1, maximum_number_key do table.insert(ITEMS, encode_value(self, T[i], parents, etc, options, indent)) end if options.pretty then result_value = "[ " .. table.concat(ITEMS, ", ") .. " ]" else result_value = "[" .. table.concat(ITEMS, ",") .. "]" end elseif object_keys then -- -- An object -- local TT = map or T if options.pretty then local KEYS = { } local max_key_length = 0 for _, key in ipairs(object_keys) do local encoded = encode_value(self, tostring(key), parents, etc, options, indent, true) if options.align_keys then max_key_length = math.max(max_key_length, #encoded) end table.insert(KEYS, encoded) end local key_indent = indent .. tostring(options.indent or "") local subtable_indent = key_indent .. string.rep(" ", max_key_length) .. (options.align_keys and " " or "") local FORMAT = "%s%" .. string.format("%d", max_key_length) .. "s: %s" local COMBINED_PARTS = { } for i, key in ipairs(object_keys) do local encoded_val = encode_value(self, TT[key], parents, etc, options, subtable_indent) table.insert(COMBINED_PARTS, string.format(FORMAT, key_indent, KEYS[i], encoded_val)) end result_value = "{\n" .. table.concat(COMBINED_PARTS, ",\n") .. "\n" .. indent .. "}" else local PARTS = { } for _, key in ipairs(object_keys) do local encoded_val = encode_value(self, TT[key], parents, etc, options, indent) local encoded_key = encode_value(self, tostring(key), parents, etc, options, indent, true) table.insert(PARTS, string.format("%s:%s", encoded_key, encoded_val)) end result_value = "{" .. table.concat(PARTS, ",") .. "}" end else -- -- An empty array/object... we'll treat it as an array, though it should really be an option -- result_value = "[]" end parents[T] = false return result_value end end function OBJDEF:encode(value, etc, options) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onEncodeError("JSON:encode must be called in method format", etc) end -- -- If the user didn't pass in a table of decode options, make an empty one. -- if type(options) ~= 'table' then options = {} end return encode_value(self, value, {}, etc, options) end function OBJDEF:encode_pretty(value, etc, options) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onEncodeError("JSON:encode_pretty must be called in method format", etc) end -- -- If the user didn't pass in a table of decode options, use the default pretty ones -- if type(options) ~= 'table' then options = default_pretty_options end return encode_value(self, value, {}, etc, options) end function OBJDEF.__tostring() return "JSON encode/decode package" end OBJDEF.__index = OBJDEF function OBJDEF:new(args) local new = { } if args then for key, val in pairs(args) do new[key] = val end end return setmetatable(new, OBJDEF) end return OBJDEF:new() -- -- Version history: -- -- 20160916.19 Fixed the isNumber.__index assignment (thanks to Jack Taylor) -- -- 20160730.18 Added JSON:forceString() and JSON:forceNumber() -- -- 20160728.17 Added concatenation to the metatable for JSON:asNumber() -- -- 20160709.16 Could crash if not passed an options table (thanks jarno heikkinen <jarnoh@capturemonkey.com>). -- -- Made JSON:asNumber() a bit more resilient to being passed the results of itself. -- -- 20160526.15 Added the ability to easily encode null values in JSON, via the new "null" encoding option. -- (Thanks to Adam B for bringing up the issue.) -- -- Added some support for very large numbers and precise floats via -- JSON.decodeNumbersAsObjects -- JSON.decodeIntegerStringificationLength -- JSON.decodeDecimalStringificationLength -- -- Added the "stringsAreUtf8" encoding option. (Hat tip to http://lua-users.org/wiki/JsonModules ) -- -- 20141223.14 The encode_pretty() routine produced fine results for small datasets, but isn't really -- appropriate for anything large, so with help from Alex Aulbach I've made the encode routines -- more flexible, and changed the default encode_pretty() to be more generally useful. -- -- Added a third 'options' argument to the encode() and encode_pretty() routines, to control -- how the encoding takes place. -- -- Updated docs to add assert() call to the loadfile() line, just as good practice so that -- if there is a problem loading JSON.lua, the appropriate error message will percolate up. -- -- 20140920.13 Put back (in a way that doesn't cause warnings about unused variables) the author string, -- so that the source of the package, and its version number, are visible in compiled copies. -- -- 20140911.12 Minor lua cleanup. -- Fixed internal reference to 'JSON.noKeyConversion' to reference 'self' instead of 'JSON'. -- (Thanks to SmugMug's David Parry for these.) -- -- 20140418.11 JSON nulls embedded within an array were being ignored, such that -- ["1",null,null,null,null,null,"seven"], -- would return -- {1,"seven"} -- It's now fixed to properly return -- {1, nil, nil, nil, nil, nil, "seven"} -- Thanks to "haddock" for catching the error. -- -- 20140116.10 The user's JSON.assert() wasn't always being used. Thanks to "blue" for the heads up. -- -- 20131118.9 Update for Lua 5.3... it seems that tostring(2/1) produces "2.0" instead of "2", -- and this caused some problems. -- -- 20131031.8 Unified the code for encode() and encode_pretty(); they had been stupidly separate, -- and had of course diverged (encode_pretty didn't get the fixes that encode got, so -- sometimes produced incorrect results; thanks to Mattie for the heads up). -- -- Handle encoding tables with non-positive numeric keys (unlikely, but possible). -- -- If a table has both numeric and string keys, or its numeric keys are inappropriate -- (such as being non-positive or infinite), the numeric keys are turned into -- string keys appropriate for a JSON object. So, as before, -- JSON:encode({ "one", "two", "three" }) -- produces the array -- ["one","two","three"] -- but now something with mixed key types like -- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) -- instead of throwing an error produces an object: -- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} -- -- To maintain the prior throw-an-error semantics, set -- JSON.noKeyConversion = true -- -- 20131004.7 Release under a Creative Commons CC-BY license, which I should have done from day one, sorry. -- -- 20130120.6 Comment update: added a link to the specific page on my blog where this code can -- be found, so that folks who come across the code outside of my blog can find updates -- more easily. -- -- 20111207.5 Added support for the 'etc' arguments, for better error reporting. -- -- 20110731.4 More feedback from David Kolf on how to make the tests for Nan/Infinity system independent. -- -- 20110730.3 Incorporated feedback from David Kolf at http://lua-users.org/wiki/JsonModules: -- -- * When encoding lua for JSON, Sparse numeric arrays are now handled by -- spitting out full arrays, such that -- JSON:encode({"one", "two", [10] = "ten"}) -- returns -- ["one","two",null,null,null,null,null,null,null,"ten"] -- -- In 20100810.2 and earlier, only up to the first non-null value would have been retained. -- -- * When encoding lua for JSON, numeric value NaN gets spit out as null, and infinity as "1+e9999". -- Version 20100810.2 and earlier created invalid JSON in both cases. -- -- * Unicode surrogate pairs are now detected when decoding JSON. -- -- 20100810.2 added some checking to ensure that an invalid Unicode character couldn't leak in to the UTF-8 encoding -- -- 20100731.1 initial public release --
gpl-3.0
brianchenito/PartyHud
modinfo.lua
1
1203
name="PartyHUD" description= "A DST mod that displays the health status of other players. Set Position and layout in config." author= "Brian Chen (Chenito)" version="0.985" forumthread="" api_version = 10-- the current version of the modding api dont_starve_compatible = true reign_of_giants_compatible = true dst_compatible = true all_clients_require_mod = true client_only_mod = false priority = -1000-- low priority mod, loads last ish icon_atlas = "modicon.xml" -- for when we get custom icons icon = "modicon.tex" -- some really bizzare binary encoding of an image, just send psds to brian or something server_filter_tags = {"party hud"} configuration_options= { { name="layout", label="HUD Layout", hover="Choose the Layout of the health indicators", options={ {description = "Compact Grid", data = 0}, {description = "Horizontal", data = 1} }, default=1, }, { name="position", label="HUD Position", hover="Choose the placement of the health indicators. Minimap settings are compatible with Squeek's minimap HUD", options={ {description = "Minimap", data = 0}, {description = "Minimap XL", data = 1}, {description = "Standard", data = 2} }, default=0, }, }
unlicense
damnever/dotfiles
config/nvim/lua/lib.lua
1
3081
local vim = vim local function dump(o) if type(o) == 'table' then local s = '{ ' for k, v in pairs(o) do if type(k) ~= 'number' then k = '"' .. k .. '"' end s = s .. '[' .. k .. '] = ' .. dump(v) .. ',' end return s .. '} ' else return tostring(o) end end local function split_file_path(path) return string.match(path, "(.-)([^\\/]-%.?([^%.\\/]*))$") end local function data_cache_dir(name) return os.getenv("HOME") .. '/.cache/nvim/' .. name end local function ensure_data_cache_dir(name) local dir = data_cache_dir(name) if vim.fn.isdirectory(dir) == 0 then os.execute("mkdir -p " .. dir) end return dir end -- fn must be function(dir, file, isdir, dirctx) -> (number, subdirctx), -- the return values: 0 stop, 1 ok, 2 skip directory, subdirctx is related to directory. local function walk_directory(dir, fn, dirctx) for _, file in pairs(vim.fn.readdir(dir)) do local path = dir .. '/' .. file local isdir = vim.fn.isdirectory(path) ~= 0 local state, subdirctx = fn(dir, file, isdir, dirctx) if state == 0 then return end if state == 1 and isdir then walk_directory(path, fn, subdirctx) end end end local function list_modules(module_prefix, root_dir, ignores_pattern) ignores_pattern = ignores_pattern or '^$' local modules = {} walk_directory(root_dir, function(dir, file, isdir, dirctx) if string.match(dir .. '/' .. file, ignores_pattern) then return 2, nil end if isdir then return 1, { module_prefix = dirctx.module_prefix .. '/' .. file } end if string.match(file, '.+%.lua$') then -- Only lua files. table.insert(modules, dirctx.module_prefix .. '/' .. string.gsub(file, "%.lua$", "")) end return 1, nil end, { module_prefix = module_prefix }) return modules end local function parse_golang_module_name() local mod_file = vim.fn.expand('go.mod') if vim.fn.filereadable(mod_file) == 0 then return '' end for _, line in ipairs(vim.fn.readfile(mod_file)) do if string.match(line, '^module%s+.+') then return string.gsub(line, '^module%s+', '') end end return '' end ------------------------------------ -- VIM API enhancements. local vimbatch = { keymaps = function(keymaps) keymaps = keymaps or {} for _, keymap in ipairs(keymaps) do -- unpack? vim.keymap.set(keymap.mode, keymap.lhs, keymap.rhs, keymap.opts) end end, global_vars = function(vars) vars = vars or {} for k, v in pairs(vars) do vim.g[k] = v end end } return { dump_table = dump, split_file_path = split_file_path, data_cache_dir = data_cache_dir, ensure_data_cache_dir = ensure_data_cache_dir, list_modules = list_modules, parse_golang_module_name = parse_golang_module_name, vimbatch = vimbatch, }
mit
ffxiphoenix/darkstar
scripts/zones/Aht_Urhgan_Whitegate/npcs/Yafaaf.lua
38
1080
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Yafaaf -- Type: Standard Merchant -- @pos 76.889 -7 -140.379 50 ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/globals/shop"); require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc, YAFAAF_SHOP_DIALOG); 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
noooway/love2d_arkanoid_tutorial
3-03_MouseControls/bricks.lua
3
5102
local vector = require "vector" local bricks = {} bricks.image = love.graphics.newImage( "img/800x600/bricks.png" ) bricks.tile_width = 64 bricks.tile_height = 32 bricks.tileset_width = 384 bricks.tileset_height = 160 bricks.rows = 11 bricks.columns = 8 bricks.top_left_position = vector( 47, 34 ) bricks.brick_width = bricks.tile_width bricks.brick_height = bricks.tile_height bricks.horizontal_distance = 0 bricks.vertical_distance = 0 bricks.current_level_bricks = {} bricks.no_more_bricks = false local simple_break_sound = love.audio.newSource( "sounds/recordered_glass_norm.ogg", "static") local armored_hit_sound = love.audio.newSource( "sounds/qubodupImpactMetal_short_norm.ogg", "static") local armored_break_sound = love.audio.newSource( "sounds/armored_glass_break_short_norm.ogg", "static") local ball_heavyarmored_sound = love.audio.newSource( "sounds/cast_iron_clangs_11_short_norm.ogg", "static") function bricks.new_brick( position, width, height, bricktype ) return( { position = position, width = width or bricks.brick_width, height = height or bricks.brick_height, bricktype = bricktype, quad = bricks.bricktype_to_quad( bricktype ) } ) end function bricks.update_brick( single_brick ) end function bricks.draw_brick( single_brick ) if single_brick.quad then love.graphics.draw( bricks.image, single_brick.quad, single_brick.position.x, single_brick.position.y ) end end function bricks.bricktype_to_quad( bricktype ) if bricktype == nil or bricktype <= 10 then return nil end local row = math.floor( bricktype / 10 ) local col = bricktype % 10 local x_pos = bricks.tile_width * ( col - 1 ) local y_pos = bricks.tile_height * ( row - 1 ) return love.graphics.newQuad( x_pos, y_pos, bricks.tile_width, bricks.tile_height, bricks.tileset_width, bricks.tileset_height ) end function bricks.construct_level( level_bricks_arrangement ) bricks.no_more_bricks = false for row_index, row in ipairs( level_bricks_arrangement ) do for col_index, bricktype in ipairs( row ) do if bricktype ~= 0 then local new_brick_position_x = bricks.top_left_position.x + ( col_index - 1 ) * ( bricks.brick_width + bricks.horizontal_distance ) local new_brick_position_y = bricks.top_left_position.y + ( row_index - 1 ) * ( bricks.brick_height + bricks.vertical_distance ) local new_brick_position = vector( new_brick_position_x, new_brick_position_y ) local new_brick = bricks.new_brick( new_brick_position, bricks.brick_width, bricks.brick_height, bricktype ) table.insert( bricks.current_level_bricks, new_brick ) end end end end function bricks.clear_current_level_bricks() for i in pairs( bricks.current_level_bricks ) do bricks.current_level_bricks[i] = nil end end function bricks.update( dt ) local no_more_bricks = true for _, brick in pairs( bricks.current_level_bricks ) do if bricks.is_heavyarmored( brick ) then no_more_bricks = no_more_bricks and true else no_more_bricks = no_more_bricks and false end end bricks.no_more_bricks = no_more_bricks end function bricks.draw() for _, brick in pairs( bricks.current_level_bricks ) do bricks.draw_brick( brick ) end end function bricks.brick_hit_by_ball( i, brick, shift_ball ) if bricks.is_simple( brick ) then table.remove( bricks.current_level_bricks, i ) simple_break_sound:play() elseif bricks.is_armored( brick ) then bricks.armored_to_scrathed( brick ) armored_hit_sound:play() elseif bricks.is_scratched( brick ) then bricks.scrathed_to_cracked( brick ) armored_hit_sound:play() elseif bricks.is_cracked( brick ) then table.remove( bricks.current_level_bricks, i ) armored_break_sound:play() elseif bricks.is_heavyarmored( brick ) then ball_heavyarmored_sound:play() end end function bricks.is_simple( single_brick ) local row = math.floor( single_brick.bricktype / 10 ) return ( row == 1 ) end function bricks.is_armored( single_brick ) local row = math.floor( single_brick.bricktype / 10 ) return ( row == 2 ) end function bricks.is_scratched( single_brick ) local row = math.floor( single_brick.bricktype / 10 ) return ( row == 3 ) end function bricks.is_cracked( single_brick ) local row = math.floor( single_brick.bricktype / 10 ) return ( row == 4 ) end function bricks.is_heavyarmored( single_brick ) local row = math.floor( single_brick.bricktype / 10 ) return ( row == 5 ) end function bricks.armored_to_scrathed( single_brick ) single_brick.bricktype = single_brick.bricktype + 10 single_brick.quad = bricks.bricktype_to_quad( single_brick.bricktype ) end function bricks.scrathed_to_cracked( single_brick ) single_brick.bricktype = single_brick.bricktype + 10 single_brick.quad = bricks.bricktype_to_quad( single_brick.bricktype ) end return bricks
mit
dail8859/ScintilluaPlusPlus
ext/scintillua/lexers/wsf.lua
3
3236
-- Copyright 2006-2017 Mitchell mitchell.att.foicica.com. See LICENSE. -- WSF LPeg lexer (based on XML). -- Contributed by Jeff Stone. local l = require('lexer') local token, word_match = l.token, l.word_match local P, R, S, V = lpeg.P, lpeg.R, lpeg.S, lpeg.V local M = {_NAME = 'wsf'} -- Whitespace. local ws = token(l.WHITESPACE, l.space^1) -- Comments. local comment = token(l.COMMENT, '<!--' * (l.any - '-->')^0 * P('-->')^-1) -- Strings. local sq_str = l.delimited_range("'", false, true) local dq_str = l.delimited_range('"', false, true) local string = #S('\'"') * l.last_char_includes('=') * token(l.STRING, sq_str + dq_str) local in_tag = P(function(input, index) local before = input:sub(1, index - 1) local s, e = before:find('<[^>]-$'), before:find('>[^<]-$') if s and e then return s > e and index or nil end if s then return index end return input:find('^[^<]->', index) and index or nil end) -- Numbers. local number = #l.digit * l.last_char_includes('=') * token(l.NUMBER, l.digit^1 * P('%')^-1) * in_tag local alpha = R('az', 'AZ', '\127\255') local word_char = l.alnum + S('_-:.??') local identifier = (l.alpha + S('_-:.??')) * word_char^0 -- Elements. local element = token('element', '<' * P('/')^-1 * identifier) -- Attributes. local attribute = token('attribute', identifier) * #(l.space^0 * '=') -- Closing tags. local tag_close = token('element', P('/')^-1 * '>') -- Equals. local equals = token(l.OPERATOR, '=') * in_tag -- Entities. local entity = token('entity', '&' * word_match{ 'lt', 'gt', 'amp', 'apos', 'quot' } * ';') M._rules = { {'whitespace', ws}, {'comment', comment}, {'element', element}, {'tag_close', tag_close}, {'attribute', attribute}, {'equals', equals}, {'string', string}, {'number', number}, {'entity', entity} } M._tokenstyles = { element = l.STYLE_KEYWORD, attribute = l.STYLE_TYPE, entity = l.STYLE_OPERATOR } M._foldsymbols = { _patterns = {'</?', '/>', '<!%-%-', '%-%->'}, element = {['<'] = 1, ['/>'] = -1, ['</'] = -1}, [l.COMMENT] = {['<!--'] = 1, ['-->'] = -1}, } -- Finally, add JavaScript and VBScript as embedded languages -- Tags that start embedded languages. M.embed_start_tag = element * (ws^1 * attribute * ws^0 * equals * ws^0 * string)^0 * ws^0 * tag_close M.embed_end_tag = element * tag_close -- Embedded JavaScript. local js = l.load('javascript') local js_start_rule = #(P('<script') * (P(function(input, index) if input:find('^%s+language%s*=%s*(["\'])[jJ][ava]*[sS]cript%1', index) then return index end end) + '>')) * M.embed_start_tag -- <script language="javascript"> local js_end_rule = #('</script' * ws^0 * '>') * M.embed_end_tag -- </script> l.embed_lexer(M, js, js_start_rule, js_end_rule) -- Embedded VBScript. local vbs = l.load('vbscript') local vbs_start_rule = #(P('<script') * (P(function(input, index) if input:find('^%s+language%s*=%s*(["\'])[vV][bB][sS]cript%1', index) then return index end end) + '>')) * M.embed_start_tag -- <script language="vbscript"> local vbs_end_rule = #('</script' * ws^0 * '>') * M.embed_end_tag -- </script> l.embed_lexer(M, vbs, vbs_start_rule, vbs_end_rule) return M
gpl-2.0
ffxiphoenix/darkstar
scripts/zones/East_Ronfaure/npcs/Logging_Point.lua
29
1101
----------------------------------- -- Area: East Ronfaure -- NPC: Logging Point ----------------------------------- package.loaded["scripts/zones/East_Ronfaure/TextIDs"] = nil; ------------------------------------- require("scripts/globals/logging"); require("scripts/zones/East_Ronfaure/TextIDs"); ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) startLogging(player,player:getZoneID(),npc,trade,0x0385); end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) player:messageSpecial(LOGGING_IS_POSSIBLE_HERE,1021); 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
ffxiphoenix/darkstar
scripts/zones/Monarch_Linn/bcnms/savage.lua
17
1700
----------------------------------- -- Area: Monarch Linn -- Name: savage ----------------------------------- require("scripts/globals/titles"); require("scripts/globals/missions"); -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) end; -- Leaving the BCNM by every mean possible, given by the LeaveCode -- 1=Select Exit on circle -- 2=Winning the BC -- 3=Disconnected or warped out -- 4=Losing the BC -- via bcnmLeave(1) or bcnmLeave(2). LeaveCodes 3 and 4 are called -- from the core when a player disconnects or the time limit is up, etc function onBcnmLeave(player,instance,leavecode) --printf("leavecode: %u",leavecode); if (leavecode == 2) then -- play end CS. Need time and battle id for record keeping + storage if (player:getCurrentMission(COP) == THE_SAVAGE and player:getVar("PromathiaStatus") == 1) then player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,1,0); else player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,1,1); end elseif (leavecode == 4) then player:startEvent(0x7d02); end end; function onEventUpdate(player,csid,option) -- print("bc update csid "..csid.." and option "..option); end; function onEventFinish(player,csid,option) if (csid == 0x7d01) then player:addExp(1500); player:addTitle(MIST_MELTER); if (player:getCurrentMission(COP) == THE_SAVAGE and player:getVar("PromathiaStatus") == 1) then player:setVar("PromathiaStatus",2); end end end;
gpl-3.0
Quenty/NevermoreEngine
src/scrollingframe/src/Client/Scrollbar.lua
1
2485
--[=[ @class Scrollbar ]=] local require = require(script.Parent.loader).load(script) local Maid = require("Maid") local SCROLL_TYPE = require("SCROLL_TYPE") local Signal = require("Signal") local Table = require("Table") local Scrollbar = {} Scrollbar.ClassName = "Scrollbar" Scrollbar.__index = Scrollbar function Scrollbar.new(gui, scrollType) local self = setmetatable({}, Scrollbar) self.Gui = gui or error("No gui") self.DraggingBegan = Signal.new() self._maid = Maid.new() self._container = self.Gui.Parent or error("No container") self._scrollType = scrollType or SCROLL_TYPE.Vertical return self end function Scrollbar.fromContainer(container, scrollType) local gui = Instance.new("ImageButton") gui.Size = UDim2.new(1, 0, 1, 0) gui.Name = "ScrollBar" gui.BackgroundColor3 = Color3.new(0.8, 0.8, 0.8) gui.BorderSizePixel = 0 gui.Image = "" gui.Parent = container gui.AutoButtonColor = false gui.ZIndex = container.ZIndex gui.Parent = container return Scrollbar.new(gui, scrollType) end function Scrollbar:SetScrollType(scrollType) assert(Table.contains(SCROLL_TYPE, scrollType)) self._scrollType = scrollType end function Scrollbar:SetScrollingFrame(scrollingFrame) self._scrollingFrame = scrollingFrame or error("No scrollingFrame") self._model = self._scrollingFrame:GetModel() self._maid:GiveTask(self.Gui.InputBegan:Connect(function(inputObject) if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then self._maid._updateMaid = self._scrollingFrame:StartScrollbarScrolling(self._container, inputObject) end end)) self:UpdateRender() end function Scrollbar:UpdateRender() if self._model.TotalContentLength > self._model.ViewSize then local percentSize = self._model.RenderedContentScrollPercentSize local pos = (1-percentSize) * self._model.RenderedContentScrollPercent if self._scrollType == SCROLL_TYPE.Vertical then self.Gui.Size = UDim2.new(self.Gui.Size.X, UDim.new(percentSize, 0)) self.Gui.Position = UDim2.new(self.Gui.Position.X, UDim.new(pos, 0)) elseif self._scrollType == SCROLL_TYPE.Horizontal then self.Gui.Size = UDim2.new(UDim.new(percentSize, 0), self.Gui.Size.Y) self.Gui.Position = UDim2.new(UDim.new(pos, 0), self.Gui.Position.Y) else error("[Scrollbar] - Bad ScrollType") end self.Gui.Visible = true else self.Gui.Visible = false end end function Scrollbar:Destroy() self._maid:DoCleaning() self._maid = nil setmetatable(self, nil) end return Scrollbar
mit
vilarion/Illarion-Content
quest/valandil_elensar_69_wilderness.lua
2
5177
--[[ Illarion Server 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 (at your option) 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/>. ]] -- INSERT INTO "quests" ("qst_id", "qst_script") VALUES (69, 'quest.valandil_elensar_69_wilderness'); local common = require("base.common") local M = {} local GERMAN = Player.german local ENGLISH = Player.english -- Insert the quest title here, in both languages local Title = {} Title[GERMAN] = "Elsbaumwald" Title[ENGLISH] = "Elstree Forest" -- Insert an extensive description of each status here, in both languages -- Make sure that the player knows exactly where to go and what to do local Description = {} Description[GERMAN] = {} Description[ENGLISH] = {} Description[GERMAN][1] = "Sammel zehn Scheite Naldorholz und bringe diese Valandil Elensar. Um Holz zu sammeln, nimmst du das Beil in die Hand und benutzt es, während du vor einem Naldorbaum stehst." Description[ENGLISH][1] = "Collect ten logs of naldor wood and take them back to Valandil Elensar. To collect the wood use the hatchet in your hand, whilst standing in front of a naldor tree." Description[GERMAN][2] = "Geh zu Valandil Elensar im Elsbaumwald. Er hat bestimmt noch eine Aufgabe für dich." Description[ENGLISH][2] = "Go back to Valandil Elensar in the Elstree Forest, he will certainly have another task for you." Description[GERMAN][3] = "Sammel zwanzig Scheite Kirschholz und bringe diese Valandil Elensar. Um Holz zu sammeln, nimmst du das Beil in die Hand und benutzt es, während du vor einem Kirschbaum stehst." Description[ENGLISH][3] = "Collect twenty logs of cherry wood and take them back to Valandil Elensar. To collect the wood use the hatchet in your hand, whilst standing in front of a cherry tree." Description[GERMAN][4] = "Geh zu Valandil Elensar im Elsbaumwald. Er hat bestimmt noch eine Aufgabe für dich." Description[ENGLISH][4] = "Go back to Valandil Elensar in the Elstree Forest, he will certainly have another task for you." Description[GERMAN][5] = "Sammel fünf Zweige und bringe diese Valandil Elensar. Um Zweige zu sammeln, nimmst du das Beil in die Hand und benutzt es, während du vor einer Tanne oder Scandrel­Kiefer stehst." Description[ENGLISH][5] = "Collect five branches and take them back to Valandil Elensar. To collect branches use the hatchet in your hand, whilst standing in front of a fir tree or scandrel pine." Description[GERMAN][6] = "Geh zu Valandil Elensar im Elsbaumwald. Er hat bestimmt noch eine Aufgabe für dich." Description[ENGLISH][6] = "Go back to Valandil Elensar in the Elstree Forest, he will certainly have another task for you." Description[GERMAN][7] = "Besorge zehn Bündel Getreide und bringe sie Valandil Elensar. Du kannst Getreide auf einem Feld anbauen und mit einer Sense ernten oder die Getreidebündel bei einem Händler kaufen." Description[ENGLISH][7] = "Obtain ten bundles of grain and take them to Valandil Elensar. You can grow grain on a field and harvest it with a scythe or buy the bundles of grain from a merchant." Description[GERMAN][8] = "Du hast alle Aufgaben von Valandil Elensar erfüllt." Description[ENGLISH][8] = "You have fulfilled all the tasks for Valandil Elensar." -- Insert the position of the quest start here (probably the position of an NPC or item) local Start = {840, 470, 0} -- For each status insert a list of positions where the quest will continue, i.e. a new status can be reached there local QuestTarget = {} QuestTarget[1] = {position(840, 470, 0), position(826, 464, 0)} -- Naldorbaum QuestTarget[2] = {position(840, 470, 0)} QuestTarget[3] = {position(840, 470, 0), position(855, 463, 0)} -- Kirschbaum QuestTarget[4] = {position(840, 470, 0)} QuestTarget[5] = {position(840, 470, 0), position(855, 463, 0)} -- Kirschbaum QuestTarget[6] = {position(840, 470, 0)} QuestTarget[7] = {position(840, 470, 0), position(791, 798, 0), position(847, 828, 0), position(959, 842, 0), position(430, 261, 0), position(361, 266,0)} QuestTarget[8] = {position(840, 470, 0)} -- Insert the quest status which is reached at the end of the quest local FINAL_QUEST_STATUS = 8 function M.QuestTitle(user) return common.GetNLS(user, Title[GERMAN], Title[ENGLISH]) end function M.QuestDescription(user, status) local german = Description[GERMAN][status] or "" local english = Description[ENGLISH][status] or "" return common.GetNLS(user, german, english) end function M.QuestStart() return Start end function M.QuestTargets(user, status) return QuestTarget[status] end function M.QuestFinalStatus() return FINAL_QUEST_STATUS end return M
agpl-3.0
bgarrels/vlc-2.1
share/lua/intf/modules/common.lua
48
4964
--[[ This code is public domain (since it really isn't very interesting) ]]-- module("common",package.seeall) -- Iterate over a table in the keys' alphabetical order function pairs_sorted(t) local s = {} for k,_ in pairs(t) do table.insert(s,k) end table.sort(s) local i = 0 return function () i = i + 1; return s[i], t[s[i]] end end -- Return a function such as skip(foo)(a,b,c) = foo(b,c) function skip(foo) return function(discard,...) return foo(...) end end -- Return a function such as setarg(foo,a)(b,c) = foo(a,b,c) function setarg(foo,a) return function(...) return foo(a,...) end end -- Trigger a hotkey function hotkey(arg) local id = vlc.misc.action_id( arg ) if id ~= nil then vlc.var.set( vlc.object.libvlc(), "key-action", id ) return true else return false end end -- Take a video snapshot function snapshot() local vout = vlc.object.vout() if not vout then return end vlc.var.set(vout,"video-snapshot",nil) end -- Naive (non recursive) table copy function table_copy(t) c = {} for i,v in pairs(t) do c[i]=v end return c end -- tonumber() for decimals number, using a dot as decimal separator -- regardless of the system locale function us_tonumber(str) local s, i, d = string.match(str, "^([+-]?)(%d*)%.?(%d*)$") if not s or not i or not d then return nil end if s == "-" then s = -1 else s = 1 end if i == "" then i = "0" end if d == nil or d == "" then d = "0" end return s * (tonumber(i) + tonumber(d)/(10^string.len(d))) end -- tostring() for decimals number, using a dot as decimal separator -- regardless of the system locale function us_tostring(n) s = tostring(n):gsub(",", ".", 1) return s end -- strip leading and trailing spaces function strip(str) return string.gsub(str, "^%s*(.-)%s*$", "%1") end -- print a table (recursively) function table_print(t,prefix) local prefix = prefix or "" if not t then print(prefix.."/!\\ nil") return end for a,b in pairs_sorted(t) do print(prefix..tostring(a),b) if type(b)==type({}) then table_print(b,prefix.."\t") end end end -- print the list of callbacks registered in lua -- useful for debug purposes function print_callbacks() print "callbacks:" table_print(vlc.callbacks) end -- convert a duration (in seconds) to a string function durationtostring(duration) return string.format("%02d:%02d:%02d", math.floor(duration/3600), math.floor(duration/60)%60, math.floor(duration%60)) end -- realpath function realpath(path) return string.gsub(string.gsub(string.gsub(string.gsub(path,"/%.%./[^/]+","/"),"/[^/]+/%.%./","/"),"/%./","/"),"//","/") end -- parse the time from a string and return the seconds -- time format: [+ or -][<int><H or h>:][<int><M or m or '>:][<int><nothing or S or s or ">] function parsetime(timestring) local seconds = 0 local hourspattern = "(%d+)[hH]" local minutespattern = "(%d+)[mM']" local secondspattern = "(%d+)[sS\"]?$" local _, _, hoursmatch = string.find(timestring, hourspattern) if hoursmatch ~= nil then seconds = seconds + tonumber(hoursmatch) * 3600 end local _, _, minutesmatch = string.find(timestring, minutespattern) if minutesmatch ~= nil then seconds = seconds + tonumber(minutesmatch) * 60 end local _, _, secondsmatch = string.find(timestring, secondspattern) if secondsmatch ~= nil then seconds = seconds + tonumber(secondsmatch) end if string.sub(timestring,1,1) == "-" then seconds = seconds * -1 end return seconds end -- seek function seek(value) local input = vlc.object.input() if input ~= nil and value ~= nil then if string.sub(value,-1) == "%" then local number = us_tonumber(string.sub(value,1,-2)) if number ~= nil then local posPercent = number/100 if string.sub(value,1,1) == "+" or string.sub(value,1,1) == "-" then vlc.var.set(input,"position",vlc.var.get(input,"position") + posPercent) else vlc.var.set(input,"position",posPercent) end end else local posTime = parsetime(value) if string.sub(value,1,1) == "+" or string.sub(value,1,1) == "-" then vlc.var.set(input,"time",vlc.var.get(input,"time") + posTime) else vlc.var.set(input,"time",posTime) end end end end function volume(value) if type(value)=="string" and string.sub(value,1,1) == "+" or string.sub(value,1,1) == "-" then vlc.volume.set(vlc.volume.get()+tonumber(value)) else vlc.volume.set(tostring(value)) end end
gpl-2.0
kitala1/darkstar
scripts/zones/Cloister_of_Frost/TextIDs.lua
4
1042
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6379; -- You cannot obtain the item <item> come back again after sorting your inventory ITEM_OBTAINED = 6382; -- Obtained: <item> GIL_OBTAINED = 6383; -- Obtained <number> gil KEYITEM_OBTAINED = 6385; -- Obtained key item: <keyitem> -- Quest dialog YOU_CANNOT_ENTER_THE_BATTLEFIELD = 7197; -- You cannot enter the battlefield at present. SHIVA_UNLOCKED = 7555; -- You are now able to summon -- ZM4 Dialog CANNOT_REMOVE_FRAG = 7645; -- It is an oddly shaped stone monument ALREADY_OBTAINED_FRAG = 7646; -- You have already obtained this monument ALREADY_HAVE_ALL_FRAGS = 7647; -- You have obtained all of the fragments FOUND_ALL_FRAGS = 7648; -- You have obtained ! You now have all 8 fragments of light! ZILART_MONUMENT = 7649; -- It is an ancient Zilart monument -- Other PROTOCRYSTAL = 7221; -- It is a giant crystal. -- conquest Base CONQUEST_BASE = 7036; -- Tallying conquest results...
gpl-3.0
kitala1/darkstar
scripts/globals/items/coral_fungus.lua
35
1204
----------------------------------------- -- ID: 4450 -- Item: coral_fungus -- Food Effect: 5Min, All Races ----------------------------------------- -- Strength -4 -- Mind 2 ----------------------------------------- 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,4450); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_STR, -4); target:addMod(MOD_MND, 2); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_STR, -4); target:delMod(MOD_MND, 2); end;
gpl-3.0
kitala1/darkstar
scripts/zones/Giddeus/npcs/HomePoint#1.lua
11
1233
----------------------------------- -- Area: Giddeus -- NPC: HomePoint#1 -- @pos -132 -3 -303 145 ----------------------------------- package.loaded["scripts/zones/Giddeus/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/zones/Giddeus/TextIDs"); require("scripts/globals/homepoint"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) homepointMenu( player, 0x21fc, 54); 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 == 0x21fc) then if (option == 1) then player:setHomePoint(); player:messageSpecial(HOMEPOINT_SET); else hpTeleport( player, option); end end end;
gpl-3.0
apletnev/koreader
frontend/ui/elements/refresh_menu_table.lua
11
2516
local UIManager = require("ui/uimanager") local util = require("ffi/util") local _ = require("gettext") local function custom_1() return G_reader_settings:readSetting("refresh_rate_1") or 12 end local function custom_2() return G_reader_settings:readSetting("refresh_rate_2") or 22 end local function custom_3() return G_reader_settings:readSetting("refresh_rate_3") or 99 end local function custom_input(name) return { title = _("Input page number for a full refresh"), type = "number", hint = "(1 - 99)", callback = function(input) local rate = tonumber(input) G_reader_settings:saveSetting(name, rate) UIManager:setRefreshRate(rate) end, } end return { text = _("E-ink full refresh rate"), sub_item_table = { { text = _("Every page"), checked_func = function() return UIManager:getRefreshRate() == 1 end, callback = function() UIManager:setRefreshRate(1) end, }, { text = _("Every 6 pages"), checked_func = function() return UIManager:getRefreshRate() == 6 end, callback = function() UIManager:setRefreshRate(6) end, }, { text_func = function() return util.template( _("Custom 1: %1 pages"), custom_1() ) end, checked_func = function() return UIManager:getRefreshRate() == custom_1() end, callback = function() UIManager:setRefreshRate(custom_1()) end, hold_input = custom_input("refresh_rate_1") }, { text_func = function() return util.template( _("Custom 2: %1 pages"), custom_2() ) end, checked_func = function() return UIManager:getRefreshRate() == custom_2() end, callback = function() UIManager:setRefreshRate(custom_2()) end, hold_input = custom_input("refresh_rate_2") }, { text_func = function() return util.template( _("Custom 3: %1 pages"), custom_3() ) end, checked_func = function() return UIManager:getRefreshRate() == custom_3() end, callback = function() UIManager:setRefreshRate(custom_3()) end, hold_input = custom_input("refresh_rate_3") }, } }
agpl-3.0
kitala1/darkstar
scripts/globals/weaponskills/impulse_drive.lua
30
1509
----------------------------------- -- Impulse Drive -- Polearm weapon skill -- Skill Level: 240 -- Delivers a two-hit attack. Damage varies with TP. -- In order to obtain Impulse Drive, the quest Methods Create Madness must be completed. -- Will stack with Sneak Attack. -- Aligned with the Shadow Gorget, Soil Gorget & Snow Gorget. -- Aligned with the Shadow Belt, Soil Belt & Snow Belt. -- Element: None -- Modifiers: STR:50% -- 100%TP 200%TP 300%TP -- 1.00 1.50 2.50 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID) local params = {}; params.numHits = 2; params.ftp100 = 1; params.ftp200 = 1.5; params.ftp300 = 2.5; params.str_wsc = 0.5; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.0; params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0; params.canCrit = false; params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0; params.atkmulti = 1; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.ftp200 = 3; params.ftp300 = 5.5; params.str_wsc = 1.0; end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params); damage = damage * WEAPON_SKILL_POWER return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
kitala1/darkstar
scripts/zones/Windurst_Woods/npcs/Bopa_Greso.lua
19
1724
----------------------------------- -- Area: Windurst Woods -- NPC: Bopa Greso -- Type: Standard NPC -- @zone: 241 -- @pos 59.773 -6.249 216.766 -- -- Auto-Script: Requires Verification (Verfied by Brawndo) ----------------------------------- package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/globals/keyitems"); require("scripts/zones/Windurst_Woods/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) thickAsThieves = player:getQuestStatus(WINDURST,AS_THICK_AS_THIEVES); thickAsThievesCS = player:getVar("thickAsThievesCS"); if(thickAsThieves == QUEST_ACCEPTED) then player:startEvent(0x01FA); if (thickAsThievesCS == 1) then player:setVar("thickAsThievesCS",2); elseif (thickAsThievesCS == 3) then player:setVar("thickAsThievesCS",4); rand1 = math.random(2,7); player:setVar("thickAsThievesGrapplingCS",rand1); player:setVar("thickAsThievesGamblingCS",1); end else player:startEvent(0x004d); -- standard cs 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
kidaa/MoonGen
lua/include/error.lua
5
4941
--------------------------------- --- @file error.lua --- @brief Error ... --- @todo TODO docu --------------------------------- local mod = {} mod.errors = { [1] = "Operation not permitted", [2] = "No such file or directory", [3] = "No such process", [4] = "Interrupted system call", [5] = "I/O error", [6] = "No such device or address", [7] = "Argument list too long", [8] = "Exec format error", [9] = "Bad file number", [10] = "No child processes", [11] = "Try again", [12] = "Out of memory", [13] = "Permission denied", [14] = "Bad address", [15] = "Block device required", [16] = "Device or resource busy", [17] = "File exists", [18] = "Cross-device link", [19] = "No such device", [20] = "Not a directory", [21] = "Is a directory", [22] = "Invalid argument", [23] = "File table overflow", [24] = "Too many open files", [25] = "Not a typewriter", [26] = "Text file busy", [27] = "File too large", [28] = "No space left on device", [29] = "Illegal seek", [30] = "Read-only file system", [31] = "Too many links", [32] = "Broken pipe", [33] = "Math argument out of domain of func", [34] = "Math result not representable", [35] = "Resource deadlock would occur", [36] = "File name too long", [37] = "No record locks available", [38] = "Function not implemented", [39] = "Directory not empty", [40] = "Too many symbolic links encountered", [42] = "No message of desired type", [43] = "Identifier removed", [44] = "Channel number out of range", [45] = "Level 2 not synchronized", [46] = "Level 3 halted", [47] = "Level 3 reset", [48] = "Link number out of range", [49] = "Protocol driver not attached", [50] = "No CSI structure available", [51] = "Level 2 halted", [52] = "Invalid exchange", [53] = "Invalid request descriptor", [54] = "Exchange full", [55] = "No anode", [56] = "Invalid request code", [57] = "Invalid slot", [59] = "Bad font file format", [60] = "Device not a stream", [61] = "No data available", [62] = "Timer expired", [63] = "Out of streams resources", [64] = "Machine is not on the network", [65] = "Package not installed", [66] = "Object is remote", [67] = "Link has been severed", [68] = "Advertise error", [69] = "Srmount error", [70] = "Communication error on send", [71] = "Protocol error", [72] = "Multihop attempted", [73] = "RFS specific error", [74] = "Not a data message", [75] = "Value too large for defined data type", [76] = "Name not unique on network", [77] = "File descriptor in bad state", [78] = "Remote address changed", [79] = "Can not access a needed shared library", [80] = "Accessing a corrupted shared library", [81] = ".lib section in a.out corrupted", [82] = "Attempting to link in too many shared libraries", [83] = "Cannot exec a shared library directly", [84] = "Illegal byte sequence", [85] = "Interrupted system call should be restarted", [86] = "Streams pipe error", [87] = "Too many users", [88] = "Socket operation on non-socket", [89] = "Destination address required", [90] = "Message too long", [91] = "Protocol wrong type for socket", [92] = "Protocol not available", [93] = "Protocol not supported", [94] = "Socket type not supported", [95] = "Operation not supported on transport endpoint", [96] = "Protocol family not supported", [97] = "Address family not supported by protocol", [98] = "Address already in use", [99] = "Cannot assign requested address", [100] = "Network is down", [101] = "Network is unreachable", [102] = "Network dropped connection because of reset", [103] = "Software caused connection abort", [104] = "Connection reset by peer", [105] = "No buffer space available", [106] = "Transport endpoint is already connected", [107] = "Transport endpoint is not connected", [108] = "Cannot send after transport endpoint shutdown", [109] = "Too many references: cannot splice", [110] = "Connection timed out", [111] = "Connection refused", [112] = "Host is down", [113] = "No route to host", [114] = "Operation already in progress", [115] = "Operation now in progress", [116] = "Stale file handle", [117] = "Structure needs cleaning", [118] = "Not a XENIX named type file", [119] = "No XENIX semaphores available", [120] = "Is a named type file", [121] = "Remote I/O error", [122] = "Quota exceeded", [123] = "No medium found", [124] = "Wrong medium type", [125] = "Operation Canceled", [126] = "Required key not available", [127] = "Key has expired", [128] = "Key has been revoked", [129] = "Key was rejected by service", [130] = "Owner died", [131] = "State not recoverable", [132] = "Operation not possible due to RF-kill", [133] = "Memory page has hardware error" } function mod.getstr(n) return "Code " .. tostring(n) .. ": " .. mod.errors[n] or ("Unknown error: " .. tostring(n)) end return mod
mit
fastmailops/prosody
tests/test_util_ip.lua
1
3257
function match(match, _M) local _ = _M.new_ip; local ip = _"10.20.30.40"; assert_equal(match(ip, _"10.0.0.0", 8), true); assert_equal(match(ip, _"10.0.0.0", 16), false); assert_equal(match(ip, _"10.0.0.0", 24), false); assert_equal(match(ip, _"10.0.0.0", 32), false); assert_equal(match(ip, _"10.20.0.0", 8), true); assert_equal(match(ip, _"10.20.0.0", 16), true); assert_equal(match(ip, _"10.20.0.0", 24), false); assert_equal(match(ip, _"10.20.0.0", 32), false); assert_equal(match(ip, _"0.0.0.0", 32), false); assert_equal(match(ip, _"0.0.0.0", 0), true); assert_equal(match(ip, _"0.0.0.0"), false); assert_equal(match(ip, _"10.0.0.0", 255), false, "excessive number of bits"); assert_equal(match(ip, _"10.0.0.0", -8), true, "negative number of bits"); assert_equal(match(ip, _"10.0.0.0", -32), true, "negative number of bits"); assert_equal(match(ip, _"10.0.0.0", 0), true, "zero bits"); assert_equal(match(ip, _"10.0.0.0"), false, "no specified number of bits (differing ip)"); assert_equal(match(ip, _"10.20.30.40"), true, "no specified number of bits (same ip)"); assert_equal(match(_"127.0.0.1", _"127.0.0.1"), true, "simple ip"); assert_equal(match(_"8.8.8.8", _"8.8.0.0", 16), true); assert_equal(match(_"8.8.4.4", _"8.8.0.0", 16), true); end function parse_cidr(parse_cidr, _M) local new_ip = _M.new_ip; assert_equal(new_ip"0.0.0.0", new_ip"0.0.0.0") local function assert_cidr(cidr, ip, bits) local parsed_ip, parsed_bits = parse_cidr(cidr); assert_equal(new_ip(ip), parsed_ip, cidr.." parsed ip is "..ip); assert_equal(bits, parsed_bits, cidr.." parsed bits is "..tostring(bits)); end assert_cidr("0.0.0.0", "0.0.0.0", nil); assert_cidr("127.0.0.1", "127.0.0.1", nil); assert_cidr("127.0.0.1/0", "127.0.0.1", 0); assert_cidr("127.0.0.1/8", "127.0.0.1", 8); assert_cidr("127.0.0.1/32", "127.0.0.1", 32); assert_cidr("127.0.0.1/256", "127.0.0.1", 256); assert_cidr("::/48", "::", 48); end function new_ip(new_ip) local v4, v6 = "IPv4", "IPv6"; local function assert_proto(s, proto) local ip = new_ip(s); if proto then assert_equal(ip and ip.proto, proto, "protocol is correct for "..("%q"):format(s)); else assert_equal(ip, nil, "address is invalid"); end end assert_proto("127.0.0.1", v4); assert_proto("::1", v6); assert_proto("", nil); assert_proto("abc", nil); assert_proto(" ", nil); end function commonPrefixLength(cpl, _M) local new_ip = _M.new_ip; local function assert_cpl6(a, b, len, v4) local ipa, ipb = new_ip(a), new_ip(b); if v4 then len = len+96; end assert_equal(cpl(ipa, ipb), len, "common prefix length of "..a.." and "..b.." is "..len); assert_equal(cpl(ipb, ipa), len, "common prefix length of "..b.." and "..a.." is "..len); end local function assert_cpl4(a, b, len) return assert_cpl6(a, b, len, "IPv4"); end assert_cpl4("0.0.0.0", "0.0.0.0", 32); assert_cpl4("255.255.255.255", "0.0.0.0", 0); assert_cpl4("255.255.255.255", "255.255.0.0", 16); assert_cpl4("255.255.255.255", "255.255.255.255", 32); assert_cpl4("255.255.255.255", "255.255.255.255", 32); assert_cpl6("::1", "::1", 128); assert_cpl6("abcd::1", "abcd::1", 128); assert_cpl6("abcd::abcd", "abcd::", 112); assert_cpl6("abcd::abcd", "abcd::abcd:abcd", 96); end
mit
kitala1/darkstar
scripts/zones/Meriphataud_Mountains/npcs/Three_Steps_IM.lua
30
3077
----------------------------------- -- Area: Meriphataud Mountains -- NPC: Three Steps, I.M. -- Type: Border Conquest Guards -- @pos -120.393 -25.822 -592.604 119 ----------------------------------- package.loaded["scripts/zones/Meriphataud_Mountains/TextIDs"] = nil; ----------------------------------- require("scripts/globals/conquest"); require("scripts/zones/Meriphataud_Mountains/TextIDs"); local guardnation = BASTOK; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno local guardtype = 4; -- 1: city, 2: foreign, 3: outpost, 4: border local region = ARAGONEU; local csid = 0x7ff8; ----------------------------------- -- 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
kitala1/darkstar
scripts/zones/Cape_Teriggan/npcs/Salimardi_RK.lua
28
3126
----------------------------------- -- Area: Cape Teriggan -- NPC: Bright Moon -- Type: Outpost Conquest Guards -- @pos -185 7 -63 113 ----------------------------------- package.loaded["scripts/zones/Cape_Teriggan/TextIDs"] = nil; ----------------------------------- require("scripts/globals/conquest"); require("scripts/zones/Cape_Teriggan/TextIDs"); local guardnation = SANDORIA; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno local guardtype = 3; -- 1: city, 2: foreign, 3: outpost, 4: border local region = VOLLBOW; local csid = 0x7ffb; ----------------------------------- -- 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
crabman77/minetest-minetestforfun-server
mods/whoison/init.lua
4
3880
whoison = {} whoison.lastrun = os.time() whoison.lastseen = {} local filename = minetest.get_worldpath().."/online-players" local seenfile = minetest.get_worldpath().."/last-seen" function whoison.createFile(loopit) local file = io.open(filename, "w") file:write(os.time().."\n") file:write(minetest.get_server_status().."\n") for _,player in ipairs(minetest.get_connected_players()) do local name = player:get_player_name() whoison.updateStats(name) local ppos = minetest.pos_to_string(player:getpos()) local datastring = name.."|"..ppos.."\n" file:write( datastring ) end file:close() if ( loopit == true ) then minetest.after(300,whoison.createFile,true) end whoison.lastrun = os.time() end function whoison.saveLastSeen() local f = io.open(seenfile,"w") f:write(minetest.serialize(whoison.lastseen)) f:close() end function whoison.loadLastSeen() local f = io.open(seenfile,"r") if ( f ~= nil ) then local ls = f:read("*all") f:close() if ( ls ~= nil and ls ~= "" ) then whoison.lastseen = minetest.deserialize(ls) end end end function whoison.getLastOnline(name) whoison.updateFormat(name) return whoison.lastseen[name]['lastonline'] end function whoison.getTimeOnline(name) whoison.updateFormat(name) return whoison.lastseen[name]['timeonline'] end function whoison.updateStats(name) whoison.updateFormat(name) whoison.lastseen[name]['timeonline'] = whoison.lastseen[name]['timeonline'] + ( os.time() - whoison.lastrun ) whoison.lastseen[name]['lastonline'] = os.time() end function whoison.updateFormat(name) if ( type(whoison.lastseen[name]) ~= "table" ) then -- update old data to new format minetest.log("action",name.." lastseen is not a table... fixing...") local lo = whoison.lastseen[name] whoison.lastseen[name] = {timeonline=0,lastonline=lo} end end minetest.register_on_joinplayer(function (player) whoison.createFile(false) whoison.saveLastSeen() end) minetest.register_on_leaveplayer(function (player) whoison.createFile(false) whoison.saveLastSeen() end) minetest.register_chatcommand("seen",{ param = "<name>", description = "Tells the last time a player was online", func = function (name, param) if ( param ~= nil ) then local t = whoison.getLastOnline(param) if ( t ~= nil ) then local diff = (os.time() - t) minetest.chat_send_player(name,param.." was last online "..breakdowntime(diff).." ago") else minetest.chat_send_player(name,"Sorry, I have no record of "..param) end else minetest.chat_send_player(name,"Usage is /seen <name>") end end }) minetest.register_chatcommand("timeonline",{ param = "<name>", description = "Shows the cumulative time a player has been online", func = function (name, param) if ( param ~= nil ) then if param == "" then param = name end local t = whoison.getTimeOnline(param) if ( t ~= nil ) then minetest.chat_send_player(name,param.." has been online for "..breakdowntime(t)) else minetest.chat_send_player(name,"Sorry, I have no record of "..param) end else minetest.chat_send_player(name,"Usage is /timeonline [<name>]") end end }) --minetest.register_chatcommand("timeonline", core.chatcommands["played"]) function breakdowntime(t) local countdown = t local answer = "" if countdown >= 86400 then local days = math.floor(countdown / 86400) countdown = countdown % 86400 answer = days .. " days " end if countdown >= 3600 then local hours = math.floor(countdown / 3600) countdown = countdown % 3600 answer = answer .. hours .. " hours " end if countdown >= 60 then local minutes = math.floor(countdown / 60) countdown = countdown % 60 answer = answer .. minutes .. " minutes " end local seconds = countdown answer = answer .. seconds .. " seconds" return answer end minetest.after(10,whoison.createFile,true) whoison.loadLastSeen()
unlicense
kitala1/darkstar
scripts/zones/Lower_Jeuno/npcs/_l05.lua
36
1559
----------------------------------- -- Area: Lower Jeuno -- NPC: Streetlamp -- Involved in Quests: Community Service -- @zone 245 -- @pos -61.132 6 -75.010 ----------------------------------- package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Lower_Jeuno/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local hour = VanadielHour(); if (hour >= 18 and hour < 21) then if (player:getQuestStatus(JEUNO,COMMUNITY_SERVICE) == QUEST_ACCEPTED) then if (player:getVar("cService") == 6) then player:setVar("cService",7); end elseif (hour >= 18 and hour < 21) then if (player:getQuestStatus(JEUNO,COMMUNITY_SERVICE) == QUEST_COMPLETED) then if (player:getVar("cService") == 19) then player:setVar("cService",20); end end end 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
cjkoenig/packages
net/mwan3-luci/files/usr/lib/lua/luci/model/cbi/mwan/member.lua
111
1535
-- ------ member configuration ------ -- ds = require "luci.dispatcher" m5 = Map("mwan3", translate("MWAN Member Configuration")) m5:append(Template("mwan/config_css")) mwan_member = m5:section(TypedSection, "member", translate("Members"), translate("Members are profiles attaching a metric and weight to an MWAN interface<br />" .. "Names may contain characters A-Z, a-z, 0-9, _ and no spaces<br />" .. "Members may not share the same name as configured interfaces, policies or rules")) mwan_member.addremove = true mwan_member.dynamic = false mwan_member.sectionhead = "Member" mwan_member.sortable = true mwan_member.template = "cbi/tblsection" mwan_member.extedit = ds.build_url("admin", "network", "mwan", "configuration", "member", "%s") function mwan_member.create(self, section) TypedSection.create(self, section) m5.uci:save("mwan3") luci.http.redirect(ds.build_url("admin", "network", "mwan", "configuration", "member", section)) end interface = mwan_member:option(DummyValue, "interface", translate("Interface")) interface.rawhtml = true function interface.cfgvalue(self, s) return self.map:get(s, "interface") or "&#8212;" end metric = mwan_member:option(DummyValue, "metric", translate("Metric")) metric.rawhtml = true function metric.cfgvalue(self, s) return self.map:get(s, "metric") or "1" end weight = mwan_member:option(DummyValue, "weight", translate("Weight")) weight.rawhtml = true function weight.cfgvalue(self, s) return self.map:get(s, "weight") or "1" end return m5
gpl-2.0
d-o/LUA-LIB
src/autostart.lua
2
5603
------------------------------------------------------------------------------- --- Autostart support and failure recovery. -- -- This can never be called from an application, it exists to start applications -- only. -- -- @module autostart -- @author Pauli -- @copyright 2014 Rinstrum Pty Ltd ------------------------------------------------------------------------------- local posix = require 'posix' local utils = require 'rinSystem.utilities' local threshold = 30 -- Seconds running to consider the start a failure local failure = 3 -- Number of sequential failures before terminating ------------------------------------------------------------------------------- -- Return a current time. This isn't fixed to any specific base and is only -- useful for determing time differences. -- @return Monotonic time from arbitrary base -- @local local function time() local s, n = posix.clock_gettime "monotonic" return s + n * 0.000000001 end return function(directory, main) local count = 0 while count <= failure do local s = time() local r = os.execute('cd ' .. directory .. ' && /usr/local/bin/lua ' .. main) if r == 0 then count = 0 else if time() - s < threshold then count = count + 1 else count = 1 end end end -- Only get here if something goes horribly wrong local rinApp = require 'rinApp' local usb = require "rinLibrary.rinUSB" local dev = rinApp.addK400('K401') local usbPath, usbPackages = nil, nil ------------------------------------------------------------------------------- -- Convert a string into a case insensitive glob string -- @param s String -- @return Glob string -- @local local function mix(s) local r = {} for i = 1, #s do local c = s:sub(i, i) local cu, cl = string.upper(c), string.lower(c) table.insert(r, (cu == cl) and c or ('['..cu..cl..']')) end return table.concat(r) end ------------------------------------------------------------------------------- -- Copy the execution directory to USB as a tar file -- @local local function copyTo() dev.write('topRight', 'SAVE', 'wait, time=.3') local yr, mo, da = dev.RTCreadDate() local hr, mi, se = dev.RTCreadTime() local dest = string.format('%s/save-%s-%s%s%s%s%s%s.tar', usbPath, dev.getSerialNumber():gsub('%s+', ''), yr, mo, da, hr, mi, se) os.execute('tar cf ' .. dest .. ' ' .. directory) utils.sync() dev.write('topRight', 'DONE SAVE', 'time=1, clear') return true end ------------------------------------------------------------------------------- -- Copy lua, ini, csv, ris and txt files from the USB to the execution directory -- @local local function copyFrom() dev.write('topRight', 'LOAD', 'wait, time=.3') for _, s in pairs{ 'lua', 'luac', 'ini', 'csv', 'ris', 'txt' } do os.execute('cp '..usbPath..'/*.'..mix(s)..' '..directory..'/') end utils.sync() dev.write('topRight', 'DONE LOAD', 'time=1, clear') return true end ------------------------------------------------------------------------------- -- Install all available packages from the USB -- @local local function installPackages() dev.write('topRight', 'PKGS', 'wait, time=.3') for _, pkg in pairs(usbPackages) do os.execute('/usr/local/bin/rinfwupgrade ' .. pkg) end -- Package installation kills the Lua infrastructure so reboot now utils.reboot() end ------------------------------------------------------------------------------- -- Change the mutable display fields -- @local local function updateDisplay() local f2, f3, f4 if usbPath ~= nil then local prompt = 'F1 EXIT F2 USB> F3 >USB' if usbPackages then prompt = prompt .. ' OK PKGS' f4 = installPackages end dev.write('bottomLeft', 'READY') dev.write('bottomRight', prompt, 'align=right') f2, f3 = copyFrom, copyTo else dev.write('bottomLeft', 'WAIT USB') dev.write('bottomRight', 'F1 EXIT', 'align=right') end dev.setKeyCallback('f2', f2, 'short') dev.setKeyCallback('f3', f3, 'short') dev.setKeyCallback('ok', f4, 'short') end dev.clearAnnunciators('all') dev.writeTopUnits('none') dev.writeBotUnits('none', 'none') dev.write('topRight', '') dev.write('topLeft', 'RECVRY') usb.setStorageAddedCallback(function(where) usbPath = where usbPackages = posix.glob(where .. '/*.[oOrR][Pp][kK]') local recover = posix.glob(where .. mix('/recovery.lua')) if recover then dev.write('bottomRight', #recover > 1 and 'SCRIPTS' or 'SCRIPT') dev.write('bottomLeft', 'RUNNING', 'wait, time=.3, align=right') for _, s in pairs(recover) do os.execute('/usr/local/bin/lua ' .. s) end end updateDisplay() end) usb.setStorageRemovedCallback(function() usbPath = nil usbPackages = nil updateDisplay() end) dev.setKeyCallback('f1', rinApp.finish, 'short') dev.setKeyGroupCallback('all', function() return true end) rinApp.addIdleEvent(updateDisplay) rinApp.run() utils.reboot() end
gpl-3.0
raingloom/thranduil
examples/chatbox/ui/init.lua
5
3194
local ui_path = ... .. '.' local UI = {} require(ui_path .. 'utf8-l') UI.Object = require(ui_path .. 'classic.classic') UI.Input = require(ui_path .. 'Input.Input') UI.Text = require(ui_path .. 'popo.Text') UI.Math = require(ui_path .. 'mlib.mlib') UI.keypressed = function(key) for _, t in ipairs(UI.elements) do t.input:keypressed(key) end end UI.keyreleased = function(key) for _, t in ipairs(UI.elements) do t.input:keyreleased(key) end end UI.mousepressed = function(x, y, button) for _, t in ipairs(UI.elements) do t.input:mousepressed(x, y, button) end end UI.mousereleased = function(x, y, button) for _, t in ipairs(UI.elements) do t.input:mousereleased(x, y, button) end end UI.gamepadpressed = function(joystick, button) for _, t in ipairs(UI.elements) do t.input:gamepadpressed(joystick, button) end end UI.gamepadreleased = function(joystick, button) for _, t in ipairs(UI.elements) do t.input:gamepadreleased(joystick, button) end end UI.gamepadaxis = function(joystick, axis, value) for _, t in ipairs(UI.elements) do t.input:gamepadaxis(joystick, axis, value) end end UI.textinput = function(text) for _, t in ipairs(UI.elements) do if t.textinput then t:textinput(text) end end end UI.registerEvents = function() local callbacks = {'keypressed', 'keyreleased', 'mousepressed', 'mousereleased', 'gamepadpressed', 'gamepadreleased', 'gamepadaxis', 'textinput'} local old_functions = {} local empty_function = function() end for _, f in ipairs(callbacks) do old_functions[f] = love[f] or empty_function love[f] = function(...) old_functions[f](...) UI[f](...) end end end UI.uids = {} UI.getUID = function(id) if id then if not UI.uids[id] then UI.uids[id] = true return id else error("id conflict: #" .. id) end else local i = 1 while true do if not UI.uids[i] then UI.uids[i] = true return i end i = i + 1 end end end UI.elements = setmetatable({}, {__mode = 'v'}) UI.addToElementsList = function(element) table.insert(UI.elements, element) return UI.getUID() end UI.removeFromElementsList = function(id) for i, element in ipairs(UI.elements) do if element.id == id then table.remove(UI.elements, i) return end end end local Button = require(ui_path .. 'Button') UI.Button = function(...) return Button(UI, ...) end local Checkbox = require(ui_path .. 'Checkbox') UI.Checkbox = function(...) return Checkbox(UI, ...) end local Frame = require(ui_path .. 'Frame') UI.Frame = function(...) return Frame(UI, ...) end local Scrollarea = require(ui_path .. 'Scrollarea') UI.Scrollarea = function(...) return Scrollarea(UI, ...) end local Slider = require(ui_path .. 'Slider') UI.Slider = function(...) return Slider(UI, ...) end local Textarea = require(ui_path .. 'Textarea') UI.Textarea = function(...) return Textarea(UI, ...) end return UI
mit
kaustavha/rackspace-monitoring-agent
runners/hostinfo_runner.lua
3
2931
--[[ Copyright 2015 Rackspace 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 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --]] local HostInfo = require('../hostinfo') local upper = require('string').upper local function run(...) local argv = require("options") .usage('Usage: -a') .describe("a", "Get debug info for all hostinfos") .usage('Usage: -d') .describe("d", "Generate documentation") .usage('Usage: -t') .describe("t", "Print all implemented hostinfo types") .usage('Usage: -T') .describe("T", "Print run times for all implemented hostinfo types") .usage('Usage: -S') .describe("S", "Print size in bytes for all implemented hostinfo types") .usage('Usage: -x [Host Info Type]') .describe("x", "Host info type to run") .usage('Usage: -f [File name]') .describe("f", "Filename to write to. Can be used with either -x for a single hostinfo or -a for all of them") .usage('Usage: -F [Folder name]') .describe("F", "Folder name to write to. Can only be used with the -a option") .argv("adtx:f:F:") local args = argv.args local folderName, fileName, typeName if args.f then fileName = args.f end if args.x then typeName = upper(args.x) end if args.F then folderName = args.F end if args.a and args.F then local function cb() print('Generated debug info for all hostinfo in folder ' .. folderName) end return HostInfo.debugInfoAllToFolder(folderName, cb) elseif args.x and args.f then local function cb() print('Debug info written to file ' .. fileName .. ' for host info type ' .. typeName) end return HostInfo.debugInfoToFile(typeName, fileName, cb) elseif args.a and args.f then local function cb() print('Debug info written to file '.. fileName) end return HostInfo.debugInfoAllToFile(fileName, cb) elseif args.x and not args.f then return HostInfo.debugInfo(typeName, print) elseif args.a and not args.f then return HostInfo.debugInfoAll(print) elseif args.d and args.F then table.foreach(HostInfo.getTypes(), function(_, v) print(string.format('- [%s](https://github.com/virgo-agent-toolkit/rackspace-monitoring-agent/blob/master/hostinfo/%s/%s)', v, folderName, v..'.json')) end) return elseif args.t then return print(table.concat(HostInfo.getTypes(), '\n')) elseif args.T then HostInfo.debugInfoAllTime(print) elseif args.S then HostInfo.debugInfoAllSize(print) else print(argv._usage) return process:exit(0) end end return { run = run }
apache-2.0
Pulse-Eight/drivers
Control4/cec_source_pulse-eight/p8system.lua
2
1526
require "lib.json" function P8INT:GET_DETAILS(idBinding) LogTrace("Updating System Details") local uri = P8INT:GET_MATRIX_URL() .. "/System/Details" C4:urlGet(uri, {}, false, function(ticketId, strData, responseCode, tHeaders, strError) if responseCode ~= 200 or strError ~= nil then LogWarn("Unable to connect to system") LogWarn("Error = " .. strError) LogWarn("Response Code = " .. responseCode) UpdateProperty("Connected To Network", "No") UpdateProperty("System Status", "Unable to connect to system") return end local jsonResponse = JSON:decode(strData) if jsonResponse.Result then UpdateProperty("System Status", jsonResponse.StatusMessage) UpdateProperty("Connected To Network", "Yes") UpdateProperty("Version", jsonResponse.Version) UpdateProperty("Serial", jsonResponse.Serial) if jsonResponse.Model == "FFMB44" then UpdateProperty("Model", "neo:4 Basic") elseif jsonResponse.Model == "FFMS44" then UpdateProperty("Model", "neo:4 Professional") elseif jsonResponse.Model == "MM88" then UpdateProperty("Model", "neo:8 Modular") else UpdateProperty("Model", "Unknown Model " .. jsonResponse.Model .. " (You may have loaded the wrong driver)") end else UpdateProperty("Model", "Unknown") UpdateProperty("Version", "Unknown") UpdateProperty("Serial", "Unknown") UpdateProperty("Connected To Network", "No") UpdateProperty("System Status", jsonResponse.ErrorMessage) end end) end
apache-2.0
kitala1/darkstar
scripts/globals/abyssea.lua
15
8651
----------------------------------- -- Abyssea functions, vars, tables -- DO NOT mess with the order -- or change things to "elseif"! ----------------------------------- require("scripts/globals/keyitems"); ----------------------------------- -- getMaxTravStones -- returns Traverser Stone KI cap ----------------------------------- function getMaxTravStones(player) local MaxTravStones = 3; if(player:hasKeyItem(VIRIDIAN_ABYSSITE_OF_AVARICE)) then MaxTravStones = MaxTravStones + 1; end if(player:hasKeyItem(IVORY_ABYSSITE_OF_AVARICE)) then MaxTravStones = MaxTravStones + 1; end if(player:hasKeyItem(VERMILLION_ABYSSITE_OF_AVARICE)) then MaxTravStones = MaxTravStones + 1; end return MaxTravStones; end; ----------------------------------- -- getTravStonesTotal -- returns total Traverser Stone KI -- (NOT the reserve value from currency menu) ----------------------------------- function getTravStonesTotal(player) local STONES = 0; if(player:hasKeyItem(TRAVERSER_STONE1)) then STONES = STONES + 1; end if(player:hasKeyItem(TRAVERSER_STONE2)) then STONES = STONES + 1; end if(player:hasKeyItem(TRAVERSER_STONE3)) then STONES = STONES + 1; end if(player:hasKeyItem(TRAVERSER_STONE4)) then STONES = STONES + 1; end if(player:hasKeyItem(TRAVERSER_STONE5)) then STONES = STONES + 1; end if(player:hasKeyItem(TRAVERSER_STONE6)) then STONES = STONES + 1; end return STONES; end; ----------------------------------- -- spendTravStones -- removes Traverser Stone KIs ----------------------------------- function spendTravStones(player,spentstones) if(spentstones == 4) then if(player:hasKeyItem(TRAVERSER_STONE6)) then spentstones = 3; player:delKeyItem(TRAVERSER_STONE6); elseif(player:hasKeyItem(TRAVERSER_STONE5)) then spentstones = 3; player:delKeyItem(TRAVERSER_STONE5); elseif(player:hasKeyItem(TRAVERSER_STONE4)) then spentstones = 3; player:delKeyItem(TRAVERSER_STONE4); elseif(player:hasKeyItem(TRAVERSER_STONE3)) then spentstones = 3; player:delKeyItem(TRAVERSER_STONE3); elseif(player:hasKeyItem(TRAVERSER_STONE2)) then spentstones = 3; player:delKeyItem(TRAVERSER_STONE2); elseif(player:hasKeyItem(TRAVERSER_STONE1)) then spentstones = 3; player:delKeyItem(TRAVERSER_STONE1); end end if(spentstones == 3) then if(player:hasKeyItem(TRAVERSER_STONE6)) then spentstones = 2; player:delKeyItem(TRAVERSER_STONE6); elseif(player:hasKeyItem(TRAVERSER_STONE5)) then spentstones = 2; player:delKeyItem(TRAVERSER_STONE5); elseif(player:hasKeyItem(TRAVERSER_STONE4)) then spentstones = 2; player:delKeyItem(TRAVERSER_STONE4); elseif(player:hasKeyItem(TRAVERSER_STONE3)) then spentstones = 2; player:delKeyItem(TRAVERSER_STONE3); elseif(player:hasKeyItem(TRAVERSER_STONE2)) then spentstones = 2; player:delKeyItem(TRAVERSER_STONE2); elseif(player:hasKeyItem(TRAVERSER_STONE1)) then spentstones = 2; player:delKeyItem(TRAVERSER_STONE1); end end if(spentstones == 2) then if(player:hasKeyItem(TRAVERSER_STONE6)) then spentstones = 1; player:delKeyItem(TRAVERSER_STONE6); elseif(player:hasKeyItem(TRAVERSER_STONE5)) then spentstones = 1; player:delKeyItem(TRAVERSER_STONE5); elseif(player:hasKeyItem(TRAVERSER_STONE4)) then spentstones = 1; player:delKeyItem(TRAVERSER_STONE4); elseif(player:hasKeyItem(TRAVERSER_STONE3)) then spentstones = 1; player:delKeyItem(TRAVERSER_STONE3); elseif(player:hasKeyItem(TRAVERSER_STONE2)) then spentstones = 1; player:delKeyItem(TRAVERSER_STONE2); elseif(player:hasKeyItem(TRAVERSER_STONE1)) then spentstones = 1; player:delKeyItem(TRAVERSER_STONE1); end end if(spentstones == 1) then if(player:hasKeyItem(TRAVERSER_STONE6)) then player:delKeyItem(TRAVERSER_STONE6); elseif(player:hasKeyItem(TRAVERSER_STONE5)) then player:delKeyItem(TRAVERSER_STONE5); elseif(player:hasKeyItem(TRAVERSER_STONE4)) then player:delKeyItem(TRAVERSER_STONE4); elseif(player:hasKeyItem(TRAVERSER_STONE3)) then player:delKeyItem(TRAVERSER_STONE3); elseif(player:hasKeyItem(TRAVERSER_STONE2)) then player:delKeyItem(TRAVERSER_STONE2); elseif(player:hasKeyItem(TRAVERSER_STONE1)) then player:delKeyItem(TRAVERSER_STONE1); end end end; ----------------------------------- -- getAbyssiteTotal -- returns total "Abyssite of <thing>" ----------------------------------- function getAbyssiteTotal(player,Type) local SOJOURN = 0; local FURTHERANCE = 0; local MERIT = 0; if (Type == "SOJOURN") then if(player:hasKeyItem(IVORY_ABYSSITE_OF_SOJOURN)) then SOJOURN = SOJOURN + 1; end if(player:hasKeyItem(SCARLET_ABYSSITE_OF_SOJOURN)) then SOJOURN = SOJOURN + 1; end if(player:hasKeyItem(JADE_ABYSSITE_OF_SOJOURN)) then SOJOURN = SOJOURN + 1; end if(player:hasKeyItem(SAPPHIRE_ABYSSITE_OF_SOJOURN)) then SOJOURN = SOJOURN + 1; end if(player:hasKeyItem(INDIGO_ABYSSITE_OF_SOJOURN)) then SOJOURN = SOJOURN + 1; end if(player:hasKeyItem(EMERALD_ABYSSITE_OF_SOJOURN)) then SOJOURN = SOJOURN + 1; end return SOJOURN; elseif (Type == "FURTHERANCE") then if (player:hasKeyItem(SCARLET_ABYSSITE_OF_FURTHERANCE)) then FURTHERANCE = FURTHERANCE + 1; end if (player:hasKeyItem(SAPPHIRE_ABYSSITE_OF_FURTHERANCE)) then FURTHERANCE = FURTHERANCE + 1; end if (player:hasKeyItem(IVORY_ABYSSITE_OF_FURTHERANCE)) then FURTHERANCE = FURTHERANCE + 1; end return FURTHERANCE; elseif (Type == "MERIT") then if (player:hasKeyItem(AZURE_ABYSSITE_OF_MERIT)) then MERIT = MERIT + 1; end if (player:hasKeyItem(VIRIDIAN_ABYSSITE_OF_MERIT)) then MERIT = MERIT + 1; end if (player:hasKeyItem(JADE_ABYSSITE_OF_MERIT)) then MERIT = MERIT + 1; end if (player:hasKeyItem(SAPPHIRE_ABYSSITE_OF_MERIT)) then MERIT = MERIT + 1; end if (player:hasKeyItem(IVORY_ABYSSITE_OF_MERIT)) then MERIT = MERIT + 1; end if (player:hasKeyItem(INDIGO_ABYSSITE_OF_MERIT)) then MERIT = MERIT + 1; end return MERIT; end end; ----------------------------------- -- getDemiluneAbyssite -- returns total value of Demulune KeyItems ----------------------------------- function getDemiluneAbyssite(player) local Demilune = 0; if (player:hasKeyItem(CLEAR_DEMILUNE_ABYSSITE)) then Demilune = Demilune + 1; end if (player:hasKeyItem(COLORFUL_DEMILUNE_ABYSSITE)) then Demilune = Demilune + 2; end if (player:hasKeyItem(SCARLET_DEMILUNE_ABYSSITE)) then Demilune = Demilune + 4; end if (player:hasKeyItem(AZURE_DEMILUNE_ABYSSITE)) then Demilune = Demilune + 8; end if (player:hasKeyItem(VIRIDIAN_DEMILUNE_ABYSSITE)) then Demilune = Demilune + 16; end if (player:hasKeyItem(JADE_DEMILUNE_ABYSSITE)) then Demilune = Demilune + 32; end if (player:hasKeyItem(SAPPHIRE_DEMILUNE_ABYSSITE)) then Demilune = Demilune + 64; end if (player:hasKeyItem(CRIMSON_DEMILUNE_ABYSSITE)) then Demilune = Demilune + 128; end if (player:hasKeyItem(EMERALD_DEMILUNE_ABYSSITE)) then Demilune = Demilune + 256; end if (player:hasKeyItem(VERMILLION_DEMILUNE_ABYSSITE)) then Demilune = Demilune + 512; end if (player:hasKeyItem(INDIGO_DEMILUNE_ABYSSITE)) then Demilune = Demilune + 1024; end return Demilune; end;
gpl-3.0
fqrouter/luci
applications/luci-statistics/luasrc/statistics/rrdtool/definitions/processes.lua
78
2188
--[[ Luci statistics - processes plugin diagram definition (c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> 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 $Id$ ]]-- module("luci.statistics.rrdtool.definitions.processes", package.seeall) function rrdargs( graph, plugin, plugin_instance, dtype ) return { { title = "%H: Processes", vlabel = "Processes/s", data = { instances = { ps_state = { "sleeping", "running", "paging", "blocked", "stopped", "zombies" } }, options = { ps_state_sleeping = { color = "0000ff" }, ps_state_running = { color = "008000" }, ps_state_paging = { color = "ffff00" }, ps_state_blocked = { color = "ff5000" }, ps_state_stopped = { color = "555555" }, ps_state_zombies = { color = "ff0000" } } } }, { title = "%H: CPU time used by %pi", vlabel = "Jiffies", data = { sources = { ps_cputime = { "syst", "user" } }, options = { ps_cputime__user = { color = "0000ff", overlay = true }, ps_cputime__syst = { color = "ff0000", overlay = true } } } }, { title = "%H: Threads and processes belonging to %pi", vlabel = "Count", detail = true, data = { sources = { ps_count = { "threads", "processes" } }, options = { ps_count__threads = { color = "00ff00" }, ps_count__processes = { color = "0000bb" } } } }, { title = "%H: Page faults in %pi", vlabel = "Pagefaults", detail = true, data = { sources = { ps_pagefaults = { "minflt", "majflt" } }, options = { ps_pagefaults__minflt = { color = "ff0000" }, ps_pagefaults__majflt = { color = "ff5500" } } } }, { title = "%H: Virtual memory size of %pi", vlabel = "Bytes", detail = true, number_format = "%5.1lf%sB", data = { types = { "ps_rss" }, options = { ps_rss = { color = "0000ff" } } } } } end
apache-2.0
Roblox/Core-Scripts
CoreScriptsRoot/Modules/DevConsole/Components/Log/LogOutput.lua
1
5819
local CorePackages = game:GetService("CorePackages") local TextService = game:GetService("TextService") local Roact = require(CorePackages.Roact) local Constants = require(script.Parent.Parent.Parent.Constants) local FONT_SIZE = Constants.DefaultFontSize.MainWindow local FONT = Constants.Font.Log local ICON_PADDING = Constants.LogFormatting.IconHeight local FRAME_HEIGHT = Constants.LogFormatting.TextFrameHeight local LINE_PADDING = Constants.LogFormatting.TextFramePadding local MAX_STRING_SIZE = Constants.LogFormatting.MaxStringSize local MAX_STR_MSG = " -- Could not display entire %d character message because message exceeds max displayable length of %d" local LogOutput = Roact.Component:extend("LogOutput") function LogOutput:init(props) local initLogOutput = props.initLogOutput and props.initLogOutput() self.onCanvasPosChanged = function() local canvasPos = self.ref.current.CanvasPosition if self.state.canvasPos ~= canvasPos then self:setState({ canvasPos = canvasPos, }) end end self.ref = Roact.createRef() self.state = { logData = initLogOutput, absSize = Vector2.new(), canvasPos = UDim2.new(), } end function LogOutput:willUpdate(nextProps, nextState) self._canvasSignal:Disconnect() end function LogOutput:didUpdate() self._canvasSignal = self.ref.current:GetPropertyChangedSignal("CanvasPosition"):Connect(self.onCanvasPosChanged) if self.state.absSize ~= self.ref.current.AbsoluteSize then self:setState({ absSize = self.ref.current.AbsoluteSize, }) end end function LogOutput:didMount() self.logConnector = self.props.targetSignal:Connect(function(data) self:setState({ logData = data }) end) self._canvasSignal = self.ref.current:GetPropertyChangedSignal("CanvasPosition"):Connect(self.onCanvasPosChanged) self:setState({ absSize = self.ref.current.AbsoluteSize, canvasPos = self.ref.current.CanvasPosition, wordWrap = true, }) end function LogOutput:willUnmount() self.logConnector:Disconnect() self.logConnector = nil end function LogOutput:render() local layoutOrder = self.props.layoutOrder local size = self.props.size local logData = self.state.logData local absSize = self.state.absSize local canvasPos = self.state.canvasPos local wordWrap = self.state.wordWrap if self.ref.current then canvasPos = self.ref.current.CanvasPosition end local elements = {} local messageCount = 1 local scrollingFrameHeight = 0 if self.ref.current and logData then -- FRAME_HEIGHT is used to offset the text for the icon local frameWidth = absSize.X - FRAME_HEIGHT local paddingHeight = -1 local usedFrameSpace = 0 local msgIter = logData:iterator() local message = msgIter:next() while message do local fmtMessage = message.Message local charCount = message.CharCount local msgDimsY = message.Dims.Y if wordWrap then msgDimsY = message.Dims.Y * math.ceil(message.Dims.X / frameWidth) end messageCount = messageCount + 1 if scrollingFrameHeight + msgDimsY >= canvasPos.Y then if usedFrameSpace < absSize.Y then local color = Constants.Color.Text local image = "" if message.Type == Enum.MessageType.MessageOutput.Value then color = Constants.Color.Text elseif message.Type == Enum.MessageType.MessageInfo.Value then color = Constants.Color.HighlightBlue image = Constants.Image.Info elseif message.Type == Enum.MessageType.MessageWarning.Value then color = Constants.Color.WarningYellow image = Constants.Image.Warning elseif message.Type == Enum.MessageType.MessageError.Value then color = Constants.Color.ErrorRed image = Constants.Image.Errors end elements[messageCount] = Roact.createElement("Frame", { Size = UDim2.new(1, 0, 0, msgDimsY), BackgroundTransparency = 1, LayoutOrder = messageCount, }, { image = Roact.createElement("ImageLabel", { Image = image, Size = UDim2.new(0, ICON_PADDING , 0, ICON_PADDING), Position = UDim2.new(0, ICON_PADDING / 4, .5, -ICON_PADDING / 2), BackgroundTransparency = 1, }), msg = Roact.createElement("TextLabel", { Text = fmtMessage, TextColor3 = color, TextSize = FONT_SIZE, Font = FONT, TextXAlignment = Enum.TextXAlignment.Left, TextWrapped = wordWrap, Size = UDim2.new(1, 0, 0, msgDimsY), Position = UDim2.new(0, FRAME_HEIGHT, 0, 0), BackgroundTransparency = 1, }) }) end if paddingHeight < 0 then paddingHeight = scrollingFrameHeight else usedFrameSpace = usedFrameSpace + msgDimsY + LINE_PADDING end end scrollingFrameHeight = scrollingFrameHeight + msgDimsY + LINE_PADDING if charCount < MAX_STRING_SIZE then message = msgIter:next() else local maxStrMsg = string.format(MAX_STR_MSG, charCount, MAX_STRING_SIZE) message = { Message = maxStrMsg, CharCount = #maxStrMsg, Type = message.Type, Dims = TextService:GetTextSize(maxStrMsg, FONT_SIZE, FONT, Vector2.new()) } end end elements["UIListLayout"] = Roact.createElement("UIListLayout", { HorizontalAlignment = Enum.HorizontalAlignment.Left, VerticalAlignment = Enum.VerticalAlignment.Top, SortOrder = Enum.SortOrder.LayoutOrder, Padding = UDim.new(0, LINE_PADDING), }) elements["WindowingPadding"] = Roact.createElement("Frame", { Size = UDim2.new(1, 0, 0, paddingHeight), BackgroundTransparency = 1, LayoutOrder = 1, }) end return Roact.createElement("ScrollingFrame", { Size = size, BackgroundTransparency = 1, VerticalScrollBarInset = 1, ScrollBarThickness = 6, CanvasSize = UDim2.new(1, 0, 0, scrollingFrameHeight), LayoutOrder = layoutOrder, [Roact.Ref] = self.ref, }, elements) end return LogOutput
apache-2.0
kitala1/darkstar
scripts/zones/Dynamis-Xarcabard/mobs/Count_Vine.lua
19
1287
----------------------------------- -- Area: Dynamis Xarcabard -- NPC: Count Vine ----------------------------------- require("scripts/globals/status"); 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 + 4096; 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
JacobFischer/Joueur.lua
games/pirates/player.lua
2
3140
-- Player: A player in this game. Every AI controls one player. -- DO NOT MODIFY THIS FILE -- Never try to directly create an instance of this class, or modify its member variables. -- Instead, you should only be reading its variables and calling its functions. local class = require("joueur.utilities.class") local GameObject = require("games.pirates.gameObject") -- <<-- Creer-Merge: requires -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs. -- you can add additional require(s) here -- <<-- /Creer-Merge: requires -->> --- A player in this game. Every AI controls one player. -- @classmod Player local Player = class(GameObject) -- initializes a Player with basic logic as provided by the Creer code generator function Player:init(...) GameObject.init(self, ...) -- The following values should get overridden when delta states are merged, but we set them here as a reference for you to see what variables this class has. --- What type of client this is, e.g. 'Python', 'JavaScript', or some other language. For potential data mining purposes. self.clientType = "" --- The amount of gold this Player has in reserve. self.gold = 0 --- The amount of infamy this Player has. self.infamy = 0 --- If the player lost the game or not. self.lost = false --- The name of the player. self.name = "Anonymous" --- This player's opponent in the game. self.opponent = nil --- The Port owned by this Player. self.port = nil --- The reason why the player lost the game. self.reasonLost = "" --- The reason why the player won the game. self.reasonWon = "" --- The amount of time (in ns) remaining for this AI to send commands. self.timeRemaining = 0 --- Every Unit owned by this Player. self.units = Table() --- If the player won the game or not. self.won = false --- (inherited) String representing the top level Class that this game object is an instance of. Used for reflection to create new instances on clients, but exposed for convenience should AIs want this data. -- @field[string] self.gameObjectName -- @see GameObject.gameObjectName --- (inherited) A unique id for each instance of a GameObject or a sub class. Used for client and server communication. Should never change value after being set. -- @field[string] self.id -- @see GameObject.id --- (inherited) Any strings logged will be stored here. Intended for debugging. -- @field[{string, ...}] self.logs -- @see GameObject.logs end --- (inherited) Adds a message to this GameObject's logs. Intended for your own debugging purposes, as strings stored here are saved in the gamelog. -- @function Player:log -- @see GameObject:log -- @tparam string message A string to add to this GameObject's log. Intended for debugging. -- <<-- Creer-Merge: functions -->> - Code you add between this comment and the end comment will be preserved between Creer re-runs. -- if you want to add any client side logic this is where you can add them -- <<-- /Creer-Merge: functions -->> return Player
mit
apletnev/koreader
spec/unit/readerdictionary_spec.lua
5
1138
describe("Readerdictionary module", function() local DocumentRegistry, ReaderUI, UIManager, Screen setup(function() require("commonrequire") DocumentRegistry = require("document/documentregistry") ReaderUI = require("apps/reader/readerui") UIManager = require("ui/uimanager") Screen = require("device").screen end) local readerui, rolling, dictionary setup(function() local sample_epub = "spec/front/unit/data/leaves.epub" readerui = ReaderUI:new{ document = DocumentRegistry:openDocument(sample_epub), } rolling = readerui.rolling dictionary = readerui.dictionary end) it("should show quick lookup window", function() local name = "screenshots/reader_dictionary.png" UIManager:quit() UIManager:show(readerui) rolling:onGotoPage(100) dictionary:onLookupWord("test") UIManager:scheduleIn(1, function() UIManager:close(dictionary.dict_window) UIManager:close(readerui) end) UIManager:run() Screen:shot(name) end) end)
agpl-3.0
kitala1/darkstar
scripts/zones/Metalworks/npcs/Takiyah.lua
17
1291
----------------------------------- -- Area: Metalworks -- NPC: Takiyah -- Type: Regional Merchant ----------------------------------- package.loaded["scripts/zones/Metalworks/TextIDs"] = nil; ----------------------------------- require("scripts/globals/shop"); require("scripts/globals/conquest"); require("scripts/zones/Metalworks/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if(GetRegionOwner(QUFIMISLAND) ~= BASTOK) then player:showText(npc,TAKIYAH_CLOSED_DIALOG); else player:showText(npc,TAKIYAH_OPEN_DIALOG); stock = {0x03ba,4121} -- Magic Pot Shard 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
apletnev/koreader
plugins/evernote.koplugin/slt2.lua
6
5442
--[[ -- slt2 - Simple Lua Template 2 -- -- Project page: https://github.com/henix/slt2 -- -- @License -- MIT License --]] local slt2 = {} -- a tree fold on inclusion tree -- @param init_func: must return a new value when called local function include_fold(template, start_tag, end_tag, fold_func, init_func) local result = init_func() start_tag = start_tag or '#{' end_tag = end_tag or '}#' local start_tag_inc = start_tag..'include:' local start1, end1 = string.find(template, start_tag_inc, 1, true) local start2 local end2 = 0 while start1 ~= nil do if start1 > end2 + 1 then -- for beginning part of file result = fold_func(result, string.sub(template, end2 + 1, start1 - 1)) end start2, end2 = string.find(template, end_tag, end1 + 1, true) assert(start2, 'end tag "'..end_tag..'" missing') do -- recursively include the file local filename = assert(loadstring('return '..string.sub(template, end1 + 1, start2 - 1)))() assert(filename) local fin = assert(io.open(filename)) -- TODO: detect cyclic inclusion? result = fold_func(result, include_fold(fin:read('*a'), start_tag, end_tag, fold_func, init_func), filename) fin:close() end start1, end1 = string.find(template, start_tag_inc, end2 + 1, true) end result = fold_func(result, string.sub(template, end2 + 1)) return result end -- preprocess included files -- @return string function slt2.precompile(template, start_tag, end_tag) return table.concat(include_fold(template, start_tag, end_tag, function(acc, v) if type(v) == 'string' then table.insert(acc, v) elseif type(v) == 'table' then table.insert(acc, table.concat(v)) else error('Unknown type: '..type(v)) end return acc end, function() return {} end)) end -- unique a list, preserve order local function stable_uniq(t) local existed = {} local res = {} for _, v in ipairs(t) do if not existed[v] then table.insert(res, v) existed[v] = true end end return res end -- @return { string } function slt2.get_dependency(template, start_tag, end_tag) return stable_uniq(include_fold(template, start_tag, end_tag, function(acc, v, name) if type(v) == 'string' then return acc elseif type(v) == 'table' then if name ~= nil then table.insert(acc, name) end for _, subname in ipairs(v) do table.insert(acc, subname) end else error('Unknown type: '..type(v)) end return acc end, function() return {} end)) end -- @return { name = string, code = string / function} function slt2.loadstring(template, start_tag, end_tag, tmpl_name) -- compile it to lua code local lua_code = {} start_tag = start_tag or '#{' end_tag = end_tag or '}#' local output_func = "coroutine.yield" template = slt2.precompile(template, start_tag, end_tag) local start1, end1 = string.find(template, start_tag, 1, true) local start2 local end2 = 0 local cEqual = string.byte('=', 1) while start1 ~= nil do if start1 > end2 + 1 then table.insert(lua_code, output_func..'('..string.format("%q", string.sub(template, end2 + 1, start1 - 1))..')') end start2, end2 = string.find(template, end_tag, end1 + 1, true) assert(start2, 'end_tag "'..end_tag..'" missing') if string.byte(template, end1 + 1) == cEqual then table.insert(lua_code, output_func..'('..string.sub(template, end1 + 2, start2 - 1)..')') else table.insert(lua_code, string.sub(template, end1 + 1, start2 - 1)) end start1, end1 = string.find(template, start_tag, end2 + 1, true) end table.insert(lua_code, output_func..'('..string.format("%q", string.sub(template, end2 + 1))..')') local ret = { name = tmpl_name or '=(slt2.loadstring)' } if setfenv == nil then -- lua 5.2 ret.code = table.concat(lua_code, '\n') else -- lua 5.1 ret.code = assert(loadstring(table.concat(lua_code, '\n'), ret.name)) end return ret end -- @return { name = string, code = string / function } function slt2.loadfile(filename, start_tag, end_tag) local fin = assert(io.open(filename)) local all = fin:read('*a') fin:close() return slt2.loadstring(all, start_tag, end_tag, filename) end local mt52 = { __index = _ENV } local mt51 = { __index = _G } -- @return a coroutine function function slt2.render_co(t, env) local f if setfenv == nil then -- lua 5.2 if env ~= nil then setmetatable(env, mt52) end f = assert(load(t.code, t.name, 't', env or _ENV)) else -- lua 5.1 if env ~= nil then setmetatable(env, mt51) end f = setfenv(t.code, env or _G) end return f end -- @return string function slt2.render(t, env) local result = {} local co = coroutine.create(slt2.render_co(t, env)) while coroutine.status(co) ~= 'dead' do local ok, chunk = coroutine.resume(co) if not ok then error(chunk) end table.insert(result, chunk) end return table.concat(result) end return slt2
agpl-3.0
Taracque/epgp
LibGuildStorage-1.2.lua
1
13860
-- This library handles storing information in officer notes. It -- streamlines and optimizes access to these notes. It should be noted -- that the library does not have correct information until -- PLAYER_ENTERING_WORLD is fired (for Ace authors this is after OnInitialize -- is called). The API is as follows: -- -- GetNote(name): Returns the officer note of member 'name' -- -- SetNote(name, note): Sets the officer note of member 'name' to -- 'note' -- -- GetClass(name): Returns the class of member 'name' -- -- GetGuildInfo(): Returns the guild info text -- -- IsCurrentState(): Return true if the state of the library is current. -- -- Snapshot(table) -- DEPRECATED: Write out snapshot in the table -- provided. table.guild_info will contain the epgp clause in guild -- info and table.notes a table of {name, class, note}. -- -- The library also fires the following messages, which you can -- register for through RegisterCallback and unregister through -- UnregisterCallback. You can also unregister all messages through -- UnregisterAllCallbacks. -- -- GuildInfoChanged(info): Fired when guild info has changed since its -- previous state. The info is the new guild info. -- -- GuildNoteChanged(name, note): Fired when a guild note changes. The -- name is the name of the member of which the note changed and the -- note is the new note. -- -- StateChanged(): Fired when the state of the guild storage cache has -- changed. -- -- SetOutsidersEnabled(isOutsidersEnabled): Allows developers to enable/ -- disable the outsiders patch, which allows raidleaders to store EPGP -- data of non-guildies in a lvl 1 character which is in guild. local MAJOR_VERSION = "LibGuildStorage-1.2" local MINOR_VERSION = tonumber(("$Revision$"):match("%d+")) or 0 local ADDON_MESSAGE_PREFIX = "GuildStorage10" RegisterAddonMessagePrefix(ADDON_MESSAGE_PREFIX) local lib, oldMinor = LibStub:NewLibrary(MAJOR_VERSION, MINOR_VERSION) if not lib then return end local Debug = LibStub("LibDebug-1.0") local GUILDFRAMEVISIBLE = false local OUTSIDERSENABLED = false local CallbackHandler = LibStub("CallbackHandler-1.0") if not lib.callbacks then lib.callbacks = CallbackHandler:New(lib) end local callbacks = lib.callbacks local AceHook = LibStub("AceHook-3.0") AceHook:Embed(lib) lib:UnhookAll() if lib.frame then lib.frame:UnregisterAllEvents() lib.frame:SetScript("OnEvent", nil) lib.frame:SetScript("OnUpdate", nil) else lib.frame = CreateFrame("Frame", MAJOR_VERSION .. "_Frame") end local frame = lib.frame frame:Show() frame:SetScript("OnEvent", function(self, event, ...) lib[event](lib, ...) end) local SendAddonMessage = _G.SendAddonMessage if ChatThrottleLib then SendAddonMessage = function(...) ChatThrottleLib:SendAddonMessage( "ALERT", ADDON_MESSAGE_PREFIX, ...) end end local SetState -- state of the cache: UNINITIALIZED, STALE, -- STALE_WAITING_FOR_ROSTER_UPDATE, CURRENT, FLUSHING, REMOTE_FLUSHING -- -- A complete graph of state changes is found in LibGuildStorage-1.0.dot local state = "STALE_WAITING_FOR_ROSTER_UPDATE" local initialized local index -- name -> {note=, seen=, class=} local cache = {} -- pending notes to write out local pending_note = {} local guild_info = "" function lib:GetNote(name) local e = cache[name] if e then return e.note end end function lib:SetNote(name, note) local e = cache[name] if e then if pending_note[name] then DEFAULT_CHAT_FRAME:AddMessage( string.format("Ignoring attempt to set note before flushing pending ".. "note for %s! ".. "current=[%s] pending=[%s] new[%s]. ".. "Please report this bug along with the actions that ".. "lead to this on http://epgp.googlecode.com", tostring(name), tostring(e.note), tostring(pending_note[name]), tostring(note))) else pending_note[name] = note SetState("FLUSHING") end return e.note end end function lib:GetClass(name) local e = cache[name] if e then return e.class end end function lib:GetRank(name) local e = cache[name] if e then return e.rank end end function lib:GetGuildInfo() return guild_info end function lib:IsCurrentState() return state == "CURRENT" end -- This is kept for historical reasons. See: -- http://code.google.com/p/epgp/issues/detail?id=350. function lib:Snapshot(t) assert(type(t) == "table") t.guild_info = guild_info:match("%-EPGP%-\n(.*)\n\%-EPGP%-") t.roster_info = {} for name,info in pairs(cache) do table.insert(t.roster_info, {name, info.class, info.note}) end end -- This function allows users to enable or disable the outsiders patch function lib:SetOutsidersEnabled(isOutsidersEnabled) -- Dont do anything if the boolean is the same if (OUTSIDERSENABLED == isOutsidersEnabled) then return end OUTSIDERSENABLED = isOutsidersEnabled Debug("outsider changed, now is ", OUTSIDERSENABLED) -- Force reloading of guildnotes index = nil SetState("STALE") end -- -- Event handlers -- frame:RegisterEvent("PLAYER_GUILD_UPDATE") frame:RegisterEvent("GUILD_ROSTER_UPDATE") frame:RegisterEvent("CHAT_MSG_ADDON") frame:RegisterEvent("PLAYER_ENTERING_WORLD") function lib:CHAT_MSG_ADDON(prefix, msg, type, sender) Debug("CHAT_MSG_ADDON: %s, %s, %s, %s", prefix, msg, type, sender) if prefix ~= MAJOR_VERSION or sender == UnitName("player") then return end if msg == "CHANGES_PENDING" then SetState("REMOTE_FLUSHING") elseif msg == "CHANGES_FLUSHED" then SetState("STALE_WAITING_FOR_ROSTER_UPDATE") end end function lib:PLAYER_GUILD_UPDATE() if IsInGuild() then frame:Show() else frame:Hide() end SetState("STALE_WAITING_FOR_ROSTER_UPDATE") end function lib:PLAYER_ENTERING_WORLD() lib:PLAYER_GUILD_UPDATE() end function lib:GUILD_ROSTER_UPDATE(loc) Debug("GUILD_ROSTER_UPDATE(%s)", tostring(loc)) if loc then SetState("FLUSHING") -- SetState("STALE_WAITING_FOR_ROSTER_UPDATE") else if state ~= "UNINITIALIZED" then SetState("STALE") index = nil end end end -- -- Locally defined functions -- local valid_transitions = { UNINITIALIZED = { CURRENT = true, }, STALE = { CURRENT = true, REMOTE_FLUSHING = true, STALE_WAITING_FOR_ROSTER_UPDATE = true, }, STALE_WAITING_FOR_ROSTER_UPDATE = { STALE = true, FLUSHING = true, }, CURRENT = { FLUSHING = true, REMOTE_FLUSHING = true, STALE = true, }, FLUSHING = { STALE_WAITING_FOR_ROSTER_UPDATE = true, }, REMOTE_FLUSHING = { STALE_WAITING_FOR_ROSTER_UPDATE = true, }, } function SetState(new_state) if state == new_state then return end if not valid_transitions[state][new_state] then Debug("Ignoring state change %s -> %s", state, new_state) return else Debug("StateChanged: %s -> %s", state, new_state) state = new_state if new_state == FLUSHING then SendAddonMessage("CHANGES_PENDING", "GUILD") end callbacks:Fire("StateChanged") end end local function ForceShowOffline() -- We need to always show offline members in the roster otherwise this -- lib won't work. if GUILDFRAMEVISIBLE then return true end SetGuildRosterShowOffline(true) return false end local function Frame_OnUpdate(self, elapsed) local startTime = debugprofilestop() if ForceShowOffline() then return end if state == "CURRENT" then return end if state == "STALE_WAITING_FOR_ROSTER_UPDATE" then GuildRoster() return end local num_guild_members = GetNumGuildMembers() -- Sometimes GetNumGuildMembers returns 0. In this case return now, -- so that we call it again and get a proper value. if num_guild_members == 0 then return end if not index or index >= num_guild_members then index = 1 end -- Check guild info for changes. if index == 1 then local new_guild_info = GetGuildInfoText() or "" if new_guild_info ~= guild_info then guild_info = new_guild_info callbacks:Fire("GuildInfoChanged", guild_info) end end -- Read up to 100 members at a time. local last_index = math.min(index + 100, num_guild_members) if not initialized then last_index = num_guild_members end Debug("Processing from %d to %d members", index, last_index) for i = index, last_index do local name, rank, _, _, _, _, pubNote, note, _, _, class = GetGuildRosterInfo(i) -- strip off the -server portion of roster info local name = Ambiguate(name, "mail") -- Start of outsiders patch if OUTSIDERSENABLED then local extName = strmatch(pubNote, 'ext:%s-(%S+)%s-') local holder if extName then -- the name is now the note and the external name is the new name. local entry = cache[extName] if not entry then entry = {} cache[extName] = entry end local ep_test = EPGP:DecodeNote(note) if not ep_test then --current character does not contain epgp info in its note, map to the character who contains holder = note else holder = name end Debug("Entry " .. holder .. " is " .. extName) -- Mark this note as seen entry.seen = true if entry.note ~= holder then entry.note = holder local _, unitClass = UnitClass(extName) entry.rank = "Outsider("..name..")" -- instead of using '' when there's no "unitClass", using the "class" of the placeholderalt -- (don't know if this is needed with resetting "seen"-flag. This was my first good try to avoid -- a bug : \epgp\ui.lua line 1203: attempt to index local 'c' (a nil value) -- local c = RAID_CLASS_COLORS[EPGP:GetClass(row.name)]) entry.class = unitClass or class if initialized then callbacks:Fire("GuildNoteChanged", extName, holder) end if entry.pending_note then callbacks:Fire("InconsistentNote", extName, holder, entry.note, entry.pending_note) end end if entry.pending_note then GuildRosterSetOfficerNote(i, entry.pending_note) entry.pending_note = nil end end end -- if OUTSIDERSENABLED if name then local entry = cache[name] local pending = pending_note[name] if not entry then entry = {} cache[name] = entry end entry.rank = rank entry.class = class -- Mark this note as seen entry.seen = true if entry.note ~= note then entry.note = note -- We want to delay all GuildNoteChanged calls until we have a -- complete view of the guild, otherwise alts might not be -- rejected (we read alts note before we even know about the -- main). if initialized then callbacks:Fire("GuildNoteChanged", name, note) end if pending then callbacks:Fire("InconsistentNote", name, note, entry.note, pending) end end if pending then GuildRosterSetOfficerNote(i, pending) pending_note[name] = nil end end end index = last_index if index >= num_guild_members then -- We are done, we need to clear the seen marks and delete the -- unmarked entries. We also fire events for removed members now. for name, t in pairs(cache) do if t.seen then t.seen = nil else cache[name] = nil callbacks:Fire("GuildNoteDeleted", name) end end if not initialized then -- Now make all GuildNoteChanged calls because we have a full -- state. for name, t in pairs(cache) do callbacks:Fire("GuildNoteChanged", name, t.note) end initialized = true callbacks:Fire("StateChanged") end if state == "STALE" then SetState("CURRENT") elseif state == "FLUSHING" then if not next(pending_note) then SetState("STALE_WAITING_FOR_ROSTER_UPDATE") SendAddonMessage("CHANGES_FLUSHED", "GUILD") end end end Debug(tostring(debugprofilestop() - startTime).."ms for LibGuildStorage:OnUpdate") end -- Disable updates when the guild roster is open. -- This is a temporary hack until we get a better location for data storage lib:RawHook("GuildFrame_LoadUI", function(...) SetGuildRosterShowOffline(EPGP.db.profile.blizzard_show_offline) lib.hooks.GuildFrame_LoadUI(...) lib:RawHookScript(GuildRosterFrame, "OnShow", function(frame, ...) GUILDFRAMEVISIBLE = true if GuildRosterShowOfflineButton then GuildRosterShowOfflineButton:SetChecked(EPGP.db.profile.blizzard_show_offline) GuildRosterShowOfflineButton:Enable() end SetGuildRosterShowOffline(EPGP.db.profile.blizzard_show_offline) lib.hooks[frame].OnShow(frame, ...) end) lib:RawHookScript(GuildRosterFrame, "OnHide", function(frame, ...) GUILDFRAMEVISIBLE = false EPGP.db.profile.blizzard_show_offline = GetGuildRosterShowOffline() lib.hooks[frame].OnHide(frame, ...) SetGuildRosterShowOffline(true) end) lib:Unhook("GuildFrame_LoadUI") SetGuildRosterShowOffline(true) end, true) ForceShowOffline() frame:SetScript("OnUpdate", Frame_OnUpdate) GuildRoster()
bsd-3-clause
hanxi/cocos2d-x-v3.1
frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/PhysicsJoint.lua
6
1960
-------------------------------- -- @module PhysicsJoint -------------------------------- -- @function [parent=#PhysicsJoint] getBodyA -- @param self -- @return PhysicsBody#PhysicsBody ret (return value: cc.PhysicsBody) -------------------------------- -- @function [parent=#PhysicsJoint] getBodyB -- @param self -- @return PhysicsBody#PhysicsBody ret (return value: cc.PhysicsBody) -------------------------------- -- @function [parent=#PhysicsJoint] getMaxForce -- @param self -- @return float#float ret (return value: float) -------------------------------- -- @function [parent=#PhysicsJoint] setMaxForce -- @param self -- @param #float float -------------------------------- -- @function [parent=#PhysicsJoint] isEnabled -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- @function [parent=#PhysicsJoint] setEnable -- @param self -- @param #bool bool -------------------------------- -- @function [parent=#PhysicsJoint] setCollisionEnable -- @param self -- @param #bool bool -------------------------------- -- @function [parent=#PhysicsJoint] getWorld -- @param self -- @return PhysicsWorld#PhysicsWorld ret (return value: cc.PhysicsWorld) -------------------------------- -- @function [parent=#PhysicsJoint] setTag -- @param self -- @param #int int -------------------------------- -- @function [parent=#PhysicsJoint] removeFormWorld -- @param self -------------------------------- -- @function [parent=#PhysicsJoint] isCollisionEnabled -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- @function [parent=#PhysicsJoint] getTag -- @param self -- @return int#int ret (return value: int) -------------------------------- -- @function [parent=#PhysicsJoint] destroy -- @param self -- @param #cc.PhysicsJoint physicsjoint return nil
mit
kitala1/darkstar
scripts/zones/Xarcabard/npcs/Telepoint.lua
17
1637
----------------------------------- -- Area: Xarcabard -- NPC: Telepoint -- @pos 150.258 -21.047 -37.256 112 ----------------------------------- package.loaded["scripts/zones/Xarcabard/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/zones/Xarcabard/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) item = trade:getItem(); if(trade:getItemCount() == 1 and item > 4095 and item < 4104) then if(player:getFreeSlotsCount() > 0 and player:hasItem(613) == false) then player:tradeComplete(); player:addItem(613); player:messageSpecial(ITEM_OBTAINED,613); -- Faded Crystal else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,613); -- Faded Crystal end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if(player:hasKeyItem(VAHZL_GATE_CRYSTAL) == false) then player:addKeyItem(VAHZL_GATE_CRYSTAL); player:messageSpecial(KEYITEM_OBTAINED,VAHZL_GATE_CRYSTAL); else player:messageSpecial(ALREADY_OBTAINED_TELE); 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
kitala1/darkstar
scripts/globals/items/plate_of_friture_de_la_misareaux.lua
35
1636
----------------------------------------- -- ID: 5159 -- Item: plate_of_friture_de_la_misareaux -- Food Effect: 240Min, All Races ----------------------------------------- -- Health 3 -- Dexterity 3 -- Vitality 3 -- Mind -3 -- Defense 5 -- Ranged ATT % 7 -- Ranged ATT Cap 15 ----------------------------------------- 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,5159); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 3); target:addMod(MOD_DEX, 3); target:addMod(MOD_VIT, 3); target:addMod(MOD_MND, -3); target:addMod(MOD_DEF, 5); target:addMod(MOD_FOOD_RATTP, 7); target:addMod(MOD_FOOD_RATT_CAP, 15); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 3); target:delMod(MOD_DEX, 3); target:delMod(MOD_VIT, 3); target:delMod(MOD_MND, -3); target:delMod(MOD_DEF, 5); target:delMod(MOD_FOOD_RATTP, 7); target:delMod(MOD_FOOD_RATT_CAP, 15); end;
gpl-3.0
kitala1/darkstar
scripts/zones/Sauromugue_Champaign/npcs/Tiger_Bones.lua
17
1726
----------------------------------- -- Area: Sauromugue Champaign -- NPC: Tiger Bones -- Involed in Quest: The Fanged One. -- @pos 666 -8 -379 120 ------------------------------------- package.loaded["scripts/zones/Sauromugue_Champaign/TextIDs"] = nil; ------------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/zones/Sauromugue_Champaign/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if(player:getQuestStatus(WINDURST,THE_FANGED_ONE) == QUEST_ACCEPTED) then deadTiger = player:getVar("TheFangedOne_Died"); if(deadTiger == 1 and player:hasKeyItem(OLD_TIGERS_FANG) == false) then player:addKeyItem(OLD_TIGERS_FANG); player:messageSpecial(KEYITEM_OBTAINED, OLD_TIGERS_FANG); elseif(deadTiger == 0) then if(GetMobAction(17268808) == 0) then SpawnMob(17268808):addStatusEffect(EFFECT_POISON,40,10,210); player:messageSpecial(OLD_SABERTOOTH_DIALOG_I); player:setVar("TheFangedOne_Died",1); end end 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
kitala1/darkstar
scripts/globals/items/roast_trout.lua
35
1278
----------------------------------------- -- ID: 4404 -- Item: roast_trout -- Food Effect: 30Min, All Races ----------------------------------------- -- Dexterity 3 -- Mind -1 -- Ranged ATT % 14 ----------------------------------------- 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,1800,4404); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_DEX, 3); target:addMod(MOD_MND, -1); target:addMod(MOD_RATTP, 14); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_DEX, 3); target:delMod(MOD_MND, -1); target:delMod(MOD_RATTP, 14); end;
gpl-3.0
apletnev/koreader
frontend/ui/trapper.lua
3
28279
--[[-- Trapper module: provides methods for simple interaction with UI, without the need for explicit callbacks, for use by linear jobs between their steps. Allows code to trap UI (give progress info to UI, ask for user choice), or get trapped by UI (get interrupted). Mostly done with coroutines, but hides their usage for simplicity. ]] local ConfirmBox = require("ui/widget/confirmbox") local InfoMessage = require("ui/widget/infomessage") local TrapWidget = require("ui/widget/trapwidget") local UIManager = require("ui/uimanager") local ffiutil = require("ffi/util") local dump = require("dump") local logger = require("logger") local _ = require("gettext") local Trapper = {} --[[-- Executes a function and allows it to be trapped (that is: to use our other methods). Simple wrapper function for a coroutine, which is a prerequisite for all our methods (this simply abstracts the @{coroutine} business to our callers), and execute it. (If some code is not wrap()'ed, most of the other methods, when called, will simply log or fallback to a non-UI action or OK choice.) This call should be the last step in some event processing code, as it may return early (the first @{coroutine.yield|coroutine.yield()} in any of the other methods will return from this function), and later be resumed by @{ui.uimanager|UIManager}. So any following (unwrapped) code would be then executed while `func` is half-done, with unintended consequences. @param func function reference to function to wrap and execute ]] function Trapper:wrap(func) -- Catch and log any error happening in func (an error happening -- in a coroutine just aborts silently the coroutine) local pcalled_func = function() -- we use xpcall as it can give a whole stacktrace, unlike pcall local ok, err = xpcall(func, debug.traceback) if not ok then logger.warn("error in wrapped function:", err) return false end return true -- As a coroutine, we will return at first coroutine.yield(), -- and the above true/false won't probably be caught by -- any code, but let's do it anyway. end local co = coroutine.create(pcalled_func) return coroutine.resume(co) end --- Returns if code is wrapped -- -- @treturn boolean true if code is wrapped by Trapper, false otherwise function Trapper:isWrapped() if coroutine.running() then return true end return false end --- Clears left-over widget function Trapper:clear() if self:isWrapped() then if self.current_widget then UIManager:close(self.current_widget) UIManager:forceRePaint() self.current_widget = nil end end end --- Clears left-over widget and resets Trapper state function Trapper:reset() self:clear() -- Reset some properties self.paused_text = nil self.paused_continue_text = nil self.paused_abort_text = nil return true end --[[-- Displays an InfoMessage, and catches dismissal. Display a InfoMessage with text, or keep existing InfoMessage if text = nil, and return true. UNLESS the previous widget was itself a InfoMessage and it has been dismissed (by Tap on the screen), in which case the new InfoMessage is not displayed, and false is returned. One can only know a InfoMessage has been dismissed when trying to display a new one (we can't do better than that with coroutines). So, don't hesitate to call it regularly (each call costs 100ms), between steps of the work, to provide good responsiveness. Trapper:info() is a shortcut to get dismiss info while keeping the existing InfoMessage displayed. Optional fast_refresh parameter should only be used when displaying an InfoMessage over a previous InfoMessage of the exact same size. @string text text to display as an InfoMessage (or nil to keep existing one) @boolean fast_refresh[opt=false] true for faster refresh @treturn boolean true if InfoMessage was not dismissed, false if dismissed @usage Trapper:info("some text about step or progress") go_on = Trapper:info() ]] function Trapper:info(text, fast_refresh) local _coroutine = coroutine.running() if not _coroutine then logger.info("unwrapped info:", text) return true -- not dismissed end if self.current_widget and self.current_widget.is_infomessage then -- We are replacing a InfoMessage with a new InfoMessage: we want to check -- if the previous one was dismissed. -- We added a dismiss_callback to our previous InfoMessage. For a Tap -- to get processed and get our dismiss_callback called, we need to give -- control for a short time to UIManager: this will be done with -- the coroutine.yield() that follows. -- If no dismiss_callback was fired, we need to get this code resumed: -- that will be done with the following go_on_func schedule in 0.1 second. local go_on_func = function() coroutine.resume(_coroutine, true) end -- delay matters: 0.05 or 0.1 seems fine -- 0.01 is too fast: go_on_func is called before our dismiss_callback is processed UIManager:scheduleIn(0.1, go_on_func) local go_on = coroutine.yield() -- gives control back to UIManager -- go_on is the 2nd arg given to the coroutine.resume() that got us resumed: -- false if it was a dismiss_callback -- true if it was the schedule go_on_func if not go_on then -- dismiss_callback called UIManager:unschedule(go_on_func) -- no more need for this scheduled action -- Don't just return false without confirmation (this tap may have been -- made by error, and we don't want to just cancel a long running job) local abort_box = ConfirmBox:new{ text = self.paused_text and self.paused_text or _("Paused"), -- ok and cancel reversed, as tapping outside will -- get cancel_callback called: if tap outside was the -- result of a tap error, we want to continue. Cancelling -- will need an explicit tap on the ok_text button. cancel_text = self.paused_continue_text and self.paused_continue_text or _("Continue"), ok_text = self.paused_abort_text and self.paused_abort_text or _("Abort"), cancel_callback = function() coroutine.resume(_coroutine, true) end, ok_callback = function() coroutine.resume(_coroutine, false) end, } UIManager:show(abort_box) -- no need to forceRePaint, UIManager will do it when we yield() go_on = coroutine.yield() -- abort_box ok/cancel from their coroutine.resume() UIManager:close(abort_box) if not go_on then UIManager:close(self.current_widget) UIManager:forceRePaint() return false end if self.current_widget then -- Re-show current widget that was dismissed -- (this is fine for our simple InfoMessage) UIManager:show(self.current_widget) end UIManager:forceRePaint() end -- go_on_func returned result = true, or abort_box did not abort: -- continue processing end -- TODO We should try to flush any pending tap, so past -- events won't be considered action on the yet to be displayed -- widget -- If fast_refresh option, avoid UIManager refresh overhead if fast_refresh and self.current_widget and self.current_widget.is_infomessage then local orig_moved_offset = self.current_widget.movable:getMovedOffset() self.current_widget:free() self.current_widget.text = text self.current_widget:init() self.current_widget.movable:setMovedOffset(orig_moved_offset) local Screen = require("device").screen self.current_widget:paintTo(Screen.bb, 0,0) local d = self.current_widget[1][1].dimen Screen.refreshUI(Screen, d.x, d.y, d.w, d.h) else -- We're going to display a new widget, close previous one if self.current_widget then UIManager:close(self.current_widget) -- no repaint here, we'll do that below when a new one is shown end -- dismiss_callback will be checked for at start of next call self.current_widget = InfoMessage:new{ text = text, dismiss_callback = function() coroutine.resume(_coroutine, false) end, is_infomessage = true -- flag on our InfoMessages } logger.dbg("Showing InfoMessage:", text) UIManager:show(self.current_widget) UIManager:forceRePaint() end return true end --[[-- Overrides text and button texts on the Paused ConfirmBox. A ConfirmBox is displayed when an InfoMessage is dismissed in Trapper:info(), with default text "Paused", and default buttons "Abort" and "Continue". @string text ConfirmBox text (default: "Paused") @string abort_text ConfirmBox "Abort" button text (Trapper:info() returns false) @string continue_text ConfirmBox "Continue" button text ]] function Trapper:setPausedText(text, abort_text, continue_text) if self:isWrapped() then self.paused_text = text self.paused_abort_text = abort_text self.paused_continue_text = continue_text end end --[[-- Displays a ConfirmBox and gets user's choice. Display a ConfirmBox with the text and cancel_text/ok_text buttons, block and wait for user's choice, and return the choice made: false if Cancel tapped or dismissed, true if OK tapped @string text text to display in a ConfirmBox @string cancel_text text for ConfirmBox Cancel button @string ok_text text for ConfirmBox Ok button @treturn boolean false if Cancel tapped or dismissed, true if OK tapped @usage go_on = Trapper:confirm("Do you want to go on?") that_selected = Trapper:confirm("Do you want to do this or that?", "this", "that")) ]] function Trapper:confirm(text, cancel_text, ok_text) -- With ConfirmBox, Cancel button is on the left, OK button on the right, -- so buttons order is consistent with this function args local _coroutine = coroutine.running() if not _coroutine then logger.info("unwrapped confirm, returning true to:", text) return true -- always select "OK" in ConfirmBox if no UI end -- TODO We should try to flush any pending tap, so past -- events won't be considered action on the yet to be displayed -- widget -- Close any previous widget if self.current_widget then UIManager:close(self.current_widget) -- no repaint here, we'll do that below when a new one is shown end -- We will yield(), and both callbacks will resume() us self.current_widget = ConfirmBox:new{ text = text, ok_text = ok_text, cancel_text = cancel_text, cancel_callback = function() coroutine.resume(_coroutine, false) end, ok_callback = function() coroutine.resume(_coroutine, true) end, } logger.dbg("Showing ConfirmBox and waiting for answer:", text) UIManager:show(self.current_widget) -- no need to forceRePaint, UIManager will do it when we yield() local ret = coroutine.yield() -- wait for ConfirmBox callback logger.dbg("ConfirmBox answers", ret) return ret end --[[-- Dismissable wrapper for @{io.popen|io.popen(`cmd`)}. Notes and limitations: 1) It is dismissable as long as `cmd` as not yet output anything. Once output has started, the reading will block till it is done. (Some shell tricks, included in `cmd`, could probably be used to accumulate `cmd` output in some variable, and to output the whole variable to stdout at the end.) 2) `cmd` needs to output something (we will wait till some data is available) If there are chances for it to not output anything, append `"; echo"` to `cmd` 3) We need a @{ui.widget.trapwidget|TrapWidget} or @{ui.widget.infomessage|InfoMessage}, that, as a modal, will catch any @{ui.event|Tap event} happening during `cmd` execution. This can be an existing already displayed widget, or provided as a string (a new TrapWidget will be created). If nil, an invisible TrapWidget will be used instead. If we really need to have more control, we would need to use `select()` via `ffi` or do low level non-blocking reading on the file descriptor. If there are `cmd` that may not exit, that we would be trying to collect indefinitely, the best option would be to compile any `timeout.c` and use it as a wrapper. @string cmd shell `cmd` to execute and get output from @param trap_widget_or_string already shown widget, string or nil @treturn boolean completed (`true` if not interrupted, `false` if dismissed) @treturn string output of command ]] function Trapper:dismissablePopen(cmd, trap_widget_or_string) local _coroutine = coroutine.running() -- assert(_coroutine ~= nil, "Need to be called from a coroutine") if not _coroutine then logger.warn("unwrapped dismissablePopen(), falling back to blocking io.popen()") local std_out = io.popen(cmd, "r") if std_out then local output = std_out:read("*all") std_out:close() return true, output end return false end local trap_widget local own_trap_widget = false local own_trap_widget_invisible = false if type(trap_widget_or_string) == "table" then -- Assume it is a usable already displayed trap'able widget with -- a dismiss_callback (ie: InfoMessage or TrapWidget) trap_widget = trap_widget_or_string else if type(trap_widget_or_string) == "string" then -- Use a TrapWidget with this as text trap_widget = TrapWidget:new{ text = trap_widget_or_string, } UIManager:show(trap_widget) UIManager:forceRePaint() else -- Use an invisible TrapWidget that resend event trap_widget = TrapWidget:new{ text = nil, resend_event = true, } UIManager:show(trap_widget) own_trap_widget_invisible = true end own_trap_widget = true end trap_widget.dismiss_callback = function() -- this callback will resume us at coroutine.yield() below -- with a go_on = false coroutine.resume(_coroutine, false) end local collect_interval_sec = 5 -- collect cancelled cmd every 5 second, no hurry local check_interval_sec = 0.125 -- start with checking for output every 125ms local check_num = 0 local completed = false local output = nil local std_out = io.popen(cmd, "r") if std_out then -- We check regularly if data is available to be read, and we give control -- in the meantime to UIManager so our trap_widget's dismiss_callback -- get a chance to be triggered, in which case we won't wait for reading, -- We'll schedule a background function to collect the uneeded output and -- close the pipe later. while true do -- Every 10 iterations, increase interval until a max of 1 sec is reached check_num = check_num + 1 if check_interval_sec < 1 and check_num % 10 == 0 then check_interval_sec = math.min(check_interval_sec * 2, 1) end -- The following function will resume us at coroutine.yield() below -- with a go_on = true local go_on_func = function() coroutine.resume(_coroutine, true) end UIManager:scheduleIn(check_interval_sec, go_on_func) -- called in 100ms by default local go_on = coroutine.yield() -- gives control back to UIManager if not go_on then -- the dismiss_callback resumed us UIManager:unschedule(go_on_func) -- We forget cmd here, but something has to collect -- its output and close the pipe to not leak file handles and -- zombie processes. local collect_and_clean collect_and_clean = function() if ffiutil.getNonBlockingReadSize(std_out) ~= 0 then -- cmd started outputing std_out:read("*all") std_out:close() logger.dbg("collected cancelled cmd output") else -- no output yet, reschedule UIManager:scheduleIn(collect_interval_sec, collect_and_clean) logger.dbg("cancelled cmd output not yet collectable") end end UIManager:scheduleIn(collect_interval_sec, collect_and_clean) break end -- The go_on_func resumed us: we have not been dismissed. -- Check if pipe is ready to be read if ffiutil.getNonBlockingReadSize(std_out) ~= 0 then -- Some data is available for reading: read it all, -- but we may block from now on output = std_out:read("*all") std_out:close() completed = true break end -- logger.dbg("no cmd output yet, will check again soon") end end if own_trap_widget then -- Remove our own trap_widget UIManager:close(trap_widget) if not own_trap_widget_invisible then UIManager:forceRePaint() end end -- return what we got or not to our caller return completed, output end --[[-- Run a function (task) in a sub-process, allowing it to be dismissed, and returns its return value(s). Notes and limitations: 1) As function is run in a sub-process, it can't modify the main KOReader process (its parent). It has access to the state of KOReader at the time the sub-process was started. It should not use any service/driver that would make the parent process vision of the device state incoherent (ie: it should not use UIManager, display widgets, change settings, enable wifi...). It is allowed to modify the filesystem, as long as KOreader has not a cached vision of this filesystem part. Its returned value(s) are returned to the parent. 2) task may return complex data structures (but with simple lua types, no function) or a single string. If task returns a string or nil, set task_returns_simple_string to true, allowing for some optimisations to be made. 3) If dismissed, the sub-process is killed with SIGKILL, and task is aborted without any chance for cleanup work: use of temporary files should so be limited (do some cleanup of dirty files from previous aborted executions at the start of each new execution if needed), and try to keep important operations as atomic as possible. 4) We need a @{ui.widget.trapwidget|TrapWidget} or @{ui.widget.infomessage|InfoMessage}, that, as a modal, will catch any @{ui.event|Tap event} happening during `cmd` execution. This can be an existing already displayed widget, or provided as a string (a new TrapWidget will be created). If nil, an invisible TrapWidget will be used instead. @function task lua function to execute and get return values from @param trap_widget_or_string already shown widget, string or nil @boolean task_returns_simple_string[opt=false] true if task returns a single string @treturn boolean completed (`true` if not interrupted, `false` if dismissed) @return ... return values of task ]] function Trapper:dismissableRunInSubprocess(task, trap_widget_or_string, task_returns_simple_string) local _coroutine = coroutine.running() if not _coroutine then logger.warn("unwrapped dismissableRunInSubprocess(), falling back to blocking in-process run") return true, task() end local trap_widget local own_trap_widget = false local own_trap_widget_invisible = false if type(trap_widget_or_string) == "table" then -- Assume it is a usable already displayed trap'able widget with -- a dismiss_callback (ie: InfoMessage or TrapWidget) trap_widget = trap_widget_or_string else if type(trap_widget_or_string) == "string" then -- Use a TrapWidget with this as text trap_widget = TrapWidget:new{ text = trap_widget_or_string, } UIManager:show(trap_widget) UIManager:forceRePaint() else -- Use an invisible TrapWidget that resend event trap_widget = TrapWidget:new{ text = nil, resend_event = true, } UIManager:show(trap_widget) own_trap_widget_invisible = true end own_trap_widget = true end trap_widget.dismiss_callback = function() -- this callback will resume us at coroutine.yield() below -- with a go_on = false coroutine.resume(_coroutine, false) end local collect_interval_sec = 5 -- collect cancelled cmd every 5 second, no hurry local check_interval_sec = 0.125 -- start with checking for output every 125ms local check_num = 0 local completed = false local ret_values = nil local pid, parent_read_fd = ffiutil.runInSubProcess(function(pid, child_write_fd) local output_str = "" if task_returns_simple_string then -- task is assumed to return only a string or nil, avoid -- possibly expensive dump()/dofile() local result = task() if type(result) == "string" then output_str = result elseif result ~= nil then logger.warn("returned value from task is not a string:", result) end else -- task may return complex data structures, that we dump() -- Note: be sure these data structures contain only classic types, -- and no function (dofile() with fail if it meets -- "function: 0x55949671c670"...) -- task may also return multiple return values, so we -- wrap them in a table (beware the { } construct may stop -- at the first nil met) local results = { task() } output_str = "return "..dump(results).."\n" end ffiutil.writeToFD(child_write_fd, output_str, true) end, true) -- with_pipe = true if pid then -- We check regularly if subprocess is done, and we give control -- in the meantime to UIManager so our trap_widget's dismiss_callback -- get a chance to be triggered, in which case we'll terminate the -- subprocess and schedule a background function to collect it. while true do -- Every 10 iterations, increase interval until a max of 1 sec is reached check_num = check_num + 1 if check_interval_sec < 1 and check_num % 10 == 0 then check_interval_sec = math.min(check_interval_sec * 2, 1) end -- The following function will resume us at coroutine.yield() below -- with a go_on = true local go_on_func = function() coroutine.resume(_coroutine, true) end UIManager:scheduleIn(check_interval_sec, go_on_func) -- called in 100ms by default local go_on = coroutine.yield() -- gives control back to UIManager if not go_on then -- the dismiss_callback resumed us UIManager:unschedule(go_on_func) -- We kill and forget the sub-process here, but something has -- to collect it so it does not become a zombie ffiutil.terminateSubProcess(pid) local collect_and_clean collect_and_clean = function() if ffiutil.isSubProcessDone(pid) then if parent_read_fd then ffiutil.readAllFromFD(parent_read_fd) -- close it end logger.dbg("collected previously dismissed subprocess") else if parent_read_fd and ffiutil.getNonBlockingReadSize(parent_read_fd) ~= 0 then -- If subprocess started outputing to fd, read from it, -- so its write() stops blocking and subprocess can exit ffiutil.readAllFromFD(parent_read_fd) -- We closed our fd, don't try again to read or close it parent_read_fd = nil end -- reschedule to collect it UIManager:scheduleIn(collect_interval_sec, collect_and_clean) logger.dbg("previously dismissed subprocess not yet collectable") end end UIManager:scheduleIn(collect_interval_sec, collect_and_clean) break end -- The go_on_func resumed us: we have not been dismissed. -- Check if sub process has ended -- Depending on the the size of what the child has to write, -- it may has ended (if data fits in the kernel pipe buffer) or -- it may still be alive blocking on write() (if data exceeds -- the kernel pipe buffer) local subprocess_done = ffiutil.isSubProcessDone(pid) local stuff_to_read = parent_read_fd and ffiutil.getNonBlockingReadSize(parent_read_fd) ~=0 logger.dbg("subprocess_done:", subprocess_done, " stuff_to_read:", stuff_to_read) if subprocess_done or stuff_to_read then -- Subprocess is gone or nearly gone completed = true if stuff_to_read then local ret_str = ffiutil.readAllFromFD(parent_read_fd) if task_returns_simple_string then ret_values = { ret_str } else local ok, results = pcall(load(ret_str)) if ok and results then ret_values = results else logger.warn("load() failed:", results) end end if not subprocess_done then -- We read the output while process was still alive. -- It may be dead now, or it may exit soon, and we -- need to collect it. -- Schedule that in 1 second (it should be dead), so -- we can return our result now. local collect_and_clean collect_and_clean = function() if ffiutil.isSubProcessDone(pid) then logger.dbg("collected subprocess") else -- reschedule UIManager:scheduleIn(1, collect_and_clean) logger.dbg("subprocess not yet collectable") end end UIManager:scheduleIn(1, collect_and_clean) end else -- subprocess_done: process exited with no output ffiutil.readAllFromFD(parent_read_fd) -- close our fd -- no ret_values end break end logger.dbg("process not yet done, will check again soon") end end if own_trap_widget then -- Remove our own trap_widget UIManager:close(trap_widget) if not own_trap_widget_invisible then UIManager:forceRePaint() end end -- return what we got or not to our caller if ret_values then return completed, unpack(ret_values) end return completed end return Trapper
agpl-3.0
leezhongshan/skynet
lualib/skynet/inject.lua
61
1373
local function getupvaluetable(u, func, unique) local i = 1 while true do local name, value = debug.getupvalue(func, i) if name == nil then return end local t = type(value) if t == "table" then u[name] = value elseif t == "function" then if not unique[value] then unique[value] = true getupvaluetable(u, value, unique) end end i=i+1 end end return function(skynet, source, filename , ...) if filename then filename = "@" .. filename else filename = "=(load)" end local output = {} local function print(...) local value = { ... } for k,v in ipairs(value) do value[k] = tostring(v) end table.insert(output, table.concat(value, "\t")) end local u = {} local unique = {} local funcs = { ... } for k, func in ipairs(funcs) do getupvaluetable(u, func, unique) end local p = {} local proto = u.proto if proto then for k,v in pairs(proto) do local name, dispatch = v.name, v.dispatch if name and dispatch and not p[name] then local pp = {} p[name] = pp getupvaluetable(pp, dispatch, unique) end end end local env = setmetatable( { print = print , _U = u, _P = p}, { __index = _ENV }) local func, err = load(source, filename, "bt", env) if not func then return { err } end local ok, err = skynet.pcall(func) if not ok then table.insert(output, err) end return output end
mit
xyproto/wordsworth
login/data.lua
1
1335
title = "Chat" local active = Set("active") local said = List("said") local userInfo = HashMap("userInfo") function setlines(username, lines) userInfo:set(username, "lines", tostring(lines)) end function getlines(username) local val = userInfo:get(username, "lines") if val == "" then -- The default number of lines return 20 end return tostring(val) end -- Mark a user as seen function seen(username) -- Save the value in seconds userInfo:set(username, "lastseen", tostring(os.time())) end function seenlately(username) local duration_seconds = os.difftime(os.time(), userInfo:get(username, "lastseen")) -- Approximately less than 12 hours ago? return duration_seconds * 10000 < 3600 * 12 end function getlastseen(username) timestamp = userInfo:get(username, "lastseen") if timestamp == "" then return "never" end return os.date("%d.%m.%Y", timestamp) end function ischatting(username) -- to implement end function setchatting(username, val) -- to implement end function joinchat(username) -- Join the chat active:add(username) -- Change the chat status for the user setchatting(username, true) -- Mark the user as seen seen(username) end -- the rest of the functions also needs to be implemented -- joinchat(Username()) function hi() return "Hi "..Username() end
mit
kitala1/darkstar
scripts/globals/items/slice_of_coeurl_meat.lua
17
1347
----------------------------------------- -- ID: 4377 -- Item: slice_of_coeurl_meat -- Food Effect: 5Min, Galka only ----------------------------------------- -- Strength 5 -- Intelligence -7 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:getRace() ~= 8) then result = 247; end if(target:getMod(MOD_EAT_RAW_MEAT) == 1) then result = 0; end 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,4377); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_STR, 5); target:addMod(MOD_INT, -7); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_STR, 5); target:delMod(MOD_INT, -7); end;
gpl-3.0
kitala1/darkstar
scripts/zones/Waughroon_Shrine/Zone.lua
15
1871
----------------------------------- -- -- Zone: Waughroon_Shrine (144) -- ----------------------------------- package.loaded["scripts/zones/Waughroon_Shrine/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Waughroon_Shrine/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then player:setPos(-361.434,101.798,-259.996,0); end if(player:getQuestStatus(OUTLANDS,A_THIEF_IN_NORG) == QUEST_ACCEPTED and player:getVar("aThiefinNorgCS") == 4) then cs = 0x0002; 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 == 0x0002) then player:setVar("aThiefinNorgCS",5); end end;
gpl-3.0
Elv2/imageGeneration
clothDataset.lua
1
2909
require 'nn' require 'image' require 'xlua' local DataSet = torch.class 'DataSet' function DataSet:__init(full) local source = '/home/caoqingxing/crawler/cloth_test/female_images/female_formatted_attributes_part_random_index.txt' local impath = {} local attri = {} local sampleCount = 0 local attriCount = -1 -- load image path text file io.input(source) for line in io.lines() do xlua.progress(sampleCount,253983) sampleCount = sampleCount+1 attriCount = -1 attri[sampleCount] = {} for word in string.gmatch(line,'[^\t]+') do attriCount = attriCount+1 if attriCount == 0 then impath[sampleCount] = word else attri[sampleCount][attriCount] = tonumber(word) end end end -- load dataset self.trainData = { data = {}, impath_rootFolder = '/home/caoqingxing/crawler/cloth_test/female_images/', labels = torch.Tensor(attri), imPath = impath, size = function() return sampleCount end } self.indices = torch.randperm(sampleCount) local trainData = self.trainData local indices = self.indices -- Mean Std Normalise if paths.filep('cache/meanfile.t7') then meanStdv = torch.load('cache/meanfile.t7') trainData.mean = meanStdv[1] trainData.std = meanStdv[2] print('Loaded Mean and Std') else print('Normalising') mean = {} -- store the mean, to normalize the test set in the future stdv = {} -- store the standard-deviation for the future data = torch.Tensor(10000, 3, 256, 256) for i = 1,10000 do data[i] = image.load(trainData.impath_rootFolder..trainData.imPath[indices[i]]) end for i=1,3 do -- over each image channel mean[i] = data[{ {}, {i}, {}, {} }]:mean() -- mean estimation stdv[i] = data[{ {}, {i}, {}, {} }]:std() -- std estimation end trainData.mean = mean trainData.std = stdv paths.mkdir('cache') torch.save('cache/meanfile.t7',{mean,stdv}) end collectgarbage() end function DataSet:initLoad() local trainData = self.trainData local indices = self.indices if dataNorm == '01' then setmetatable(trainData.data, {__index = function(self, index) im = image.load(trainData.impath_rootFolder..trainData.imPath[index]) --if torch.max(im) <= 1.5 then im:div(255) end return im end}) else setmetatable(trainData.data, {__index = function(self, index) im = image.load(trainData.impath_rootFolder..trainData.imPath[index]) for channel=1,3 do im[{ {channel}, {}, {} }]:add(-trainData.mean[channel]) im[{ {channel}, {}, {} }]:div(trainData.std[channel]) end return im end}) end end function DataSet:shuffle() self.indices = torch.randperm(self.trainData.size()) end
mit