content
stringlengths
5
1.05M
-- ffi_def_create_headers.lua print() print(" -- ffi_def_create_headers.lua start -- ") if jit then print(jit.version) else print(_VERSION) end print() local arg = {...} local noParse = false if arg[1] then noParse = arg[1] == "n" end local util = require "lib_util" local osname if true then -- keep ffi valid only inside if to make ZeroBrane debugger work local ffi = require("ffi") osname = string.lower(ffi.os) end osname = "windows" -- for running in osx local timeUsed = util.seconds() -- http://gcc.gnu.org/onlinedocs/gfortran/Preprocessing-Options.html local addToWindowsInclude = '#define _WIN32_WINNT 0x0602 // inserted header for Lua, Windows 8 == 0x0602\n#define WINVER _WIN32_WINNT\n' addToWindowsInclude = addToWindowsInclude..'#define WIN32_LEAN_AND_MEAN\n#pragma comment (lib, "Ws2_32.lib")\n' -- use ONLY '\n', not '\r' in addToWindowsInclude local target_path = "c_include/"..osname.."/" local useCccIncludeDir = true -- comment sourcepaths to match this local sourcepaths = { --["windows"] = "C:/mingw64/mingw/include/", ["windows"] = "C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/Include/", ["windows2"] = "C:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/include/", ["osx"] = "/usr/include/", --["osx2"] = "", ["linux"] = "/usr/include/", ["linux2"] = "/usr/include/i386-linux-gnu/" } sourcefiles = { ["windows"] = [[ #include <windows.h> #include <winsock2.h> #include <ws2tcpip.h> ]], ["osx"] = [[ #include <sys/types.h> ]], ["linux"] = [[ #include <sys/types.h> ]], } local prfFileName = "ffi_def_create_headers_prf.lua" if util.file_exists(prfFileName) then dofile(prfFileName) end local sourcepath = sourcepaths[osname] local sourcepath2 = sourcepaths[osname.."2"] local sourcefile = sourcefiles[osname] sourcefile = sourcefile:gsub("#include <", "") sourcefile = sourcefile:gsub(">", "") local copy_commad = "cp " local preprocessor_commad = "gcc -E -P -D".." " -- -dD -C = leave comments if util.isWin then copy_commad = "copy " --preprocessor_commad = "CL /EP" -- /showIncludes /FI /D_WIN32_WINNT=0x0601 preprocessor_commad = "gcc.exe -E -dD -C" if useCccIncludeDir then preprocessor_commad = preprocessor_commad.." -I "..'"'..sourcepath..'"' if sourcepath2 then preprocessor_commad = preprocessor_commad.." -I "..'"'..sourcepath2..'"' end end preprocessor_commad = preprocessor_commad.." " -- -dD -dN -dI -D _WIN32_WINNT=0x0602 end local define_length = #("#define ") local define_pos = define_length + 1 local function defineLine(line) local comment local s,e = line:find("%/%/") if not s then s,e = line:find("%/%*") end if s then comment = line:sub(s) comment = " "..comment:match("^%s*(.-)%s*$") -- remove whitespaces line = line:sub(1, s - 1) end local value = line:sub(define_pos) local s,e = value:find(" ") if not e then value = "" else value = value:sub(e + 1) end if value == "" then line = "" else local name = line:sub(define_pos, define_pos + s - 2) name = name:match("^%s*(.-)%s*$") -- remove leading and trailing whitespace value = value:match("^%s*(.-)%s*$") -- remove leading and trailing whitespace if value:match('".*%"$') then line = "static const char "..name.." = "..value..";" elseif value:match(".*%dL$") then line = "static const long "..name.." = "..value..";" elseif value:match(".*%dLL$") then line = "static const long long "..name.." = "..value..";" elseif value:match(".*%dF$") then line = "static const double "..name.." = "..value..";" -- float elseif value:match(".*%dDF$") then line = "static const double "..name.." = "..value..";" elseif value:match(".*%dDD$") then line = "static const double "..name.." = "..value..";" elseif value:match(".*%dDL$") then line = "static const long double "..name.." = "..value..";" elseif value:match("%d%.%d") then line = "static const double "..name.." = "..value..";" else line = "static const int "..name.." = "..value..";" end if comment then line = line..comment end end return line end local filecount = 0 local parsecount = 0 local define_found = false for file in sourcefile:gmatch("[^\r\n]+") do if file ~= "" and not util.string_starts(file, "//") then -- not empty and not commented lines local destfile = file:gsub("/", "_") if util.isWin then file= file:gsub("/", "\\") sourcepath = sourcepath:gsub("/", "\\") if sourcepath2 then sourcepath2 = sourcepath2:gsub("/", "\\") end end local copypath = target_path.."original/"..destfile if not util.file_exists(copypath) then local cmd if util.string_starts(file, "/") then cmd = copy_commad..'"'..file..'" "'..util.currentPath()..copypath..'"' else cmd = copy_commad..'"'..sourcepath..file..'" "'..copypath..'"' if not util.file_exists(sourcepath..file) then if sourcepath2 then cmd = copy_commad..'"'..sourcepath2..file..'" "'..copypath..'"' end end end if util.isWin then cmd = cmd:gsub("/", "\\") end print(cmd) os.execute(cmd) if addToWindowsInclude then print(" ... add prefix to file: "..copypath) local code = util.readFile(copypath) code = addToWindowsInclude..code util.writeFile(copypath, code) end end local destpath = target_path..destfile if not util.file_exists(destpath) then local cmd = preprocessor_commad..copypath.." > "..destpath print(cmd) os.execute(cmd) filecount = filecount + 1 end if not util.file_exists(destpath) then print("*** file creation failed: "..destpath) elseif not noParse then parsecount = parsecount + 1 local filecomment = "\n\n// *** "..parsecount..". "..file.." ***" local code = util.readFile(destpath) print(destpath) local crlfLen = #code code = code:gsub("\r\n", "\n") code = code:gsub("\n\n", "\n") local _,linecount = code:gsub("\n", ".") print(" ... empty lines removed: "..util.format_num(crlfLen - #code, 0)..", size: "..util.fileSize(#code, 2)) _ = nil -- release memory collectgarbage() print(" ... linecount: "..util.format_num(linecount, 0)) local codeout = {} local i = 0 for line in code:gmatch("[^\r\n]+") do i = i + 1 if i%5000 == 0 then print(" ... line: "..util.format_num(i, 0).." / "..util.format_num(linecount, 0)) end local is_define = false --line:sub(1, define_length) if line:find("^#define ") then is_define = true define_found = true line = defineLine(line) end if line ~= "" and not line:find("^%s+$") and line ~= "\n" and line:find("#undef") ~= 1 then codeout[#codeout+1] = line.."\n" end end local definecount = 0 if not define_found then -- read #define's from original header print(" ... creating defines from original header...") local definecode = util.readFile(destpath) if not definecode:find(" --- defines\n\n") then definecode = util.readFile(copypath) local defineout = {} local i = 0 for line in definecode:gmatch("[^\r\n]+") do i = i + 1 if i%5000 == 0 then print(" ... line: "..util.format_num(i, 0).." / "..util.format_num(linecount, 0)) end if line:find("^#define ") then line = defineLine(line) if line ~= "" then definecount = definecount +1 defineout[#defineout+1] = line.."\n" end end end codeout[#codeout+1] = filecomment.." --- defines\n\n"..table.concat(defineout) end end define_found = false codeout = table.concat(codeout) util.appendFile(target_path.."ffi_types.h", filecomment.."\n"..codeout) print(" ... final size: "..util.fileSize(#codeout, 2)..", defines: "..definecount) print() util.writeFile(destpath, codeout) end end end if codeout ~= "" then -- add "ffi_types.h" to written filecount filecount = filecount + 1 end timeUsed = util.seconds(timeUsed) print() print("created: "..(filecount).." files in "..util.format_num(timeUsed, 3).." seconds") print() if jit then print(jit.version) else print(_VERSION) end print(" -- ffi_def_create_headers.lua end -- ") print() --[[ 32-bit: Single (binary32), decimal32 64-bit: Double (binary64), decimal64 128-bit: Quadruple (binary128), decimal128 _Decimal32 DF _Decimal64 DD _Decimal128 DL long L long long LL char " ]]
return { name = "Catcher_Sprite"; w = 56; h = 64; fmt = ".png"; numf = 28; anim = { [1] = {0, 0, 56, 64, 6}; --Down [2] = {0, 66, 56, 64, 6}; --Up [3] = {0, 134, 56, 64, 6}; --Right [4] = {0, 200, 56, 64, 6}; --Left [5] = {0, 264, 54, 96, 5}; [6] = {0, 360, 54, 70, 5}; [7] = {0, 428, 96, 68, 5}; [8] = {0, 496, 96, 66, 5}; name = "anim" } }
local function make_counter() local counter = 1 return function() local value = counter counter = counter + 1 -- trace: value return value end end local a = make_counter() local b = make_counter() for i = 1, 10 do a() b() end
include('lib/track') include('lib/engine') QuantumPhysics = include('lib/engines/quantumphysics') GraphTheory = include('lib/engines/graphtheory') TimeWaver = include('lib/engines/timewaver') function Buffer:render_double_buffer (grid,dbuf) if self.grid.height~=dbuf.grid.height or self.grid.width~=dbuf.grid.width then return end for row = 1, self.height do for col = 1, self.width do local v = self.grid[row][col] if v~=dbuf.grid[row][col] then grid:led(col, row, v) dbuf.grid[row][col] = v end end end end Info = include('lib/misc/info') include('lib/docu') engines = {GraphTheory.name,QuantumPhysics.name,TimeWaver.name} engine_icons = {GraphTheory.icon,QuantumPhysics.icon,TimeWaver.icon} new_engine = {GraphTheory.new,QuantumPhysics.new,TimeWaver.new} midi_slots = {} -- midi_sync_id = nil setup_device_slots = function (d_list) -- for i,d in pairs(d_list) do midi_slots[i] = {device=midi.connect(d), name=midi.vports[d].name} end for i,dev in pairs(midi.vports) do if dev.connected and #midi_slots<4 then print("slot "..i,dev.name) midi_slots[#midi_slots+1] = {device=midi.connect(i), name=dev.name, index=i} end end end --[[sync_midi_devices = function () if midi_sync_id then return end midi_sync_id = clock.run( function () while true do for _,s in pairs(midi_slots) do s.device:clock() end clock.sync(1/24) end end ) end start_midi_devices = function () for _,s in pairs(midi_slots) do s.device:start() end sync_midi_devices() end continue_midi_devices = function () end stop_midi_devices = function () for _,s in pairs(midi_slots) do s.device:stop() end clock.cancel(midi_sync_id) midi_sync_id = nil end--]] main_clock = nil clock.transport.start = function () print("start") BRAIN:start() for _,t in pairs(BRAIN.tracks) do if BRAIN.transport_state=="pre_play" then clock.run(function (tr) clock.sync(4) tr:play() end, t) elseif BRAIN.transport_state=="stop" then t:stop() end end -- MIDI SLOTS if not main_clock then -- start: 24PPQ main_clock = clock.run( function () while true do for _,d in pairs(midi_slots) do d.device:clock() end clock.sync(1/24) end end ) end -- start on next 4 clock.run( function () local t = clock.get_beats() local st = util.round_up(t,4) local d = st-t - 1/48 -- between 24PPQ pulse clock.sleep(clock.get_beat_sec()*d) for _,d in pairs(midi_slots) do d.device:start() end end ) end clock.transport.stop = function () print("stop") BRAIN:stop() if main_clock then for _,d in pairs(midi_slots) do d.device:stop() end end end Brain = function (g) return { grid = g, grid_handler = include('lib/grid/grid_handler').new(), keys = include('lib/isomorphic_keyboard'), buffer = Buffer.new(16,8), d_buffer = Buffer.new(16,8), tracks = {}, ui_mode = "apps", -- "apps","settings","presets" preset_mode = "load", -- "save" or "load" preset = 1, focus = 1, transport_state = "stop", overlay = {text="superbrain",time=util.time()+3}, help = false, init = function (self) self.tracks = {} for i=1,4 do self.tracks[i] = new_track(i,self.keys) end self:load_preset(1) self.grid:all(0) self.grid:refresh() self.grid.key = function (x,y,z) self:key(x,y,z) end self.grid_handler.grid_event = function (e) self:grid_event(e) end -- DRAW clock.run(function (self) while true do self:redraw() clock.sleep(1/30) end end ,self) end, set_overlay = function (self,t,st,duration) self.overlay = {text="",subtext="",time=0} self.overlay.text = t self.overlay.subtext = st self.overlay.time = util.time()+(duration and duration or 2) end, draw_help = function (info) local x_off = 1 local y_off = 20 local w = 4 -- NAME if info.name then screen.level(15) screen.font_size(8) screen.move(x_off,8) screen.text(info.name) end screen.level(2) screen.move(106,8) screen.text("focus") info:draw_lpx(x_off,y_off,w) i = info[highlight] info:draw(MENU_ENC,x_off,y_off,w) end, redraw_screen = function (self) screen.move(8,60) screen.font_size(8) screen.level(self.help and 15 or 2) screen.text("help") local info = Docu[self.tracks[self.focus].engine.name] if self.help and info then self.draw_help(info) return end -- OUT screen.line_width(1) for _,n in pairs(self.tracks[self.focus].output.active_notes) do local x = util.linlin(1,127,9,121,n.note) screen.pixel(x,2) screen.stroke() end -- TOP LINE screen.level(15) screen.move(9,5) screen.line(121,5) screen.stroke() -- PLAY / STOP local level = self.transport_state=="pre_play" and 2 or 15 -- if self.transport_state=="play" then level = math.floor(util.linlin(0,1,15,2,math.fmod(clock.get_beats(),1))) end screen.level(level) if self.transport_state=="stop" then screen.rect(10,9,6,6) else screen.move(10,9) screen.line(16,12) screen.line(10,15) end screen.fill() -- STEP screen.level(self.transport_state=="pre_play" and 15 or 2) screen.move(13,25) screen.font_size(8) screen.text_center(1+math.fmod(math.floor(clock.get_beats()),4)) -- SELECTED TRACK screen.level(15) screen.rect(113,9,8,8) screen.stroke() screen.move(117,15) screen.font_size(8) screen.text_center(self.focus) -- OVERLAY if self.overlay then -- TEXT screen.level(15) screen.font_size(16) screen.move(64,40) screen.text_center(self.overlay.text) -- SUBTEXT if self.overlay.subtext then screen.level(2) screen.font_size(8) screen.move(64,56) screen.text_center(self.overlay.subtext) end -- REMOVE OVERLAY if util.time() > self.overlay.time then self.overlay = nil end else -- DRAW TRACK self.tracks[self.focus]:redraw() end end, redraw = function (self) local sel_tr = self.tracks[self.focus] --self.grid:all(0) self.buffer:led_level_all(0) -- TRANSPORT --self.grid:led(10,1,self.transport_state=="play" and 15 or 2) --self.grid:led(10,2,2) -- TRACK SELECTION for i=1,#self.tracks do --self.grid:led(1,4+i,i==self.focus and 15 or 2) self.buffer:led_level_set(1,4+i,i==self.focus and 15 or 2) end -- KEYBOARD if true then self.keys:redraw(self.buffer) end if self.ui_mode=="apps" then -- FOCUSSED TRACK if sel_tr.visible and sel_tr.engine then sel_tr.engine:redraw(self.buffer) end -- KEYBOARD --if self.keys.visible then self.keys:redraw(self.grid) end elseif self.ui_mode=="settings" then sel_tr:show_settings(self.buffer) end --[[ elseif self.ui_mode=="presets" then local folder = _path.data.."SUPER_BRAIN/" listing = util.scandir(folder) --tab.print(listing) for i=1,64 do local file_path = _path.data.."SUPER_BRAIN/preset_"..i..".txt" if util.file_exists (file_path) then local pos = index_to_pos[i] self.grid:led(pos.x,pos.y,3) end end local pos = index_to_pos[self.preset] self.grid:led(pos.x,pos.y,5,"fade") end --]] --self.buffer:render(self.grid) self.buffer:render_double_buffer(self.grid,self.d_buffer) self.grid:refresh() end, grid_event = function (self,e) local sel_tr = self.tracks[self.focus] -- TRACKS local t = m_index(e,1,5,1,4) if t then self:set_visible(t) if (e.type=="double_click") then self.tracks[t]:reset_engine() elseif e.type=="hold" then self.ui_mode = "settings" elseif e.type=="release" then self.ui_mode = "apps" end return end -- SIDEBUTTONS if e.x==16 and (e.y>4) and self.ui_mode=="apps" then sel_tr.engine:grid_event(e) -- TRANSPOSE elseif e.x==14 and (e.y==5 or e.y==6) and self.ui_mode=="apps" then if (e.type=="press" or e.type=="double") then self.keys:transpose(e.y==5 and 1 or -1) end end -- MATRIX if e.x<=16 and e.y<5 then -- APPS if self.ui_mode=="apps" then if self.ui_mode=="apps" then sel_tr.engine:grid_event(e) end elseif self.ui_mode=="settings" then sel_tr:handle_settings(e) end end -- OLD STUFF IS BELOW HERE if true then return end -- TOP BAR if e.x==10 then -- TRANSPORT if e.y<3 then if e.type=="press" or e.type=="double" then self:play_stop() end -- -- PRESETS elseif e.y==3 then if not USE_GRID128 then if e.type=="hold" then self.ui_mode = "presets" elseif e.type=="release" and self.ui_mode=="presets" then self.ui_mode = "apps" end end -- TRACKS elseif e.y>8-#self.tracks then local t = e.y-(8-#self.tracks) self:set_visible(t) if (e.type=="double_click") then self.tracks[t]:reset_engine() elseif e.type=="hold" then self.ui_mode = "settings" elseif e.type=="release" then self.ui_mode = "apps" end end -- ADAPTED TO NEW LPX INDICES -- -- ========================== -- -- ENGINE SIDE BUTTONS if e.x==9 and (e.y<5) and self.ui_mode=="apps" then sel_tr.engine:grid_event(e) -- TRANSPOSE elseif e.x==14 and (e.y==5 or e.y==6) and self.ui_mode=="apps" then if (e.type=="press" or e.type=="double") then self.keys:transpose(e.y==5 and 1 or -1) end end -- MATRIX elseif e.x<9 and e.y<9 then -- APPS if self.ui_mode=="apps" then if self.ui_mode=="apps" then sel_tr.engine:grid_event(e) end -- SETTINGS elseif self.ui_mode=="settings" and (e.type=="press" or e.type=="double") and e.y<9 then sel_tr:handle_settings(e) -- PRESETS elseif self.ui_mode=="presets" and e.y<9 then local pre_nr = (e.y-1)*8+e.x if USE_GRID128 then if self.preset_mode == "save" then self:save_preset(pre_nr) self:set_overlay("save "..pre_nr, "") elseif self.preset_mode == "load" then self.preset = pre_nr self:load_preset(pre_nr) self:set_overlay("load "..pre_nr, "") end else if e.type=="click" then print("select",pre_nr) self.preset = pre_nr self:load_preset(pre_nr) elseif e.type=="hold" then print("save to",pre_nr) self:save_preset(pre_nr) end end end end end, key = function (self,x,y,z) if self.ui_mode=="apps" or self.ui_mode=="settings" then -- KEYBOARD if self.keys.area:in_area(x,y) then self.keys:key(x,y,z) return end end self.grid_handler:key(x,y,z) end, set_visible = function (self, index) self.tracks[self.focus]:set_unvisible() self.focus = util.clamp(index,1,#self.tracks) self.tracks[self.focus]:set_visible() end, play_stop = function (self) local s = self.transport_state self.transport_state = s=="stop" and "pre_play" or "stop" for _,t in pairs(self.tracks) do if self.transport_state=="pre_play" then clock.run(function (tr) clock.sync(4) tr:play() end, t) elseif self.transport_state=="stop" then t:stop() end end if self.transport_state=="pre_play" then clock.transport.start() clock.run(function (b) clock.sync(4) b.transport_state="play" end, self) elseif self.transport_state=="stop" then clock.transport.stop() end end, start = function (self) local s = self.transport_state self.transport_state = s=="stop" and "pre_play" or "stop" if self.transport_state ~= "pre_play" then return end for _,t in pairs(self.tracks) do clock.run(function (tr) clock.sync(4) tr:play() end, t) end clock.run(function (b) clock.sync(4) b.transport_state="play" end, self) end, stop = function (self) local s = self.transport_state self.transport_state = s=="stop" and "pre_play" or "stop" if self.transport_state ~= "stop" then return end for _,t in pairs(self.tracks) do t:stop() end end, save_preset = function (self,pre_nr) local preset_table = {} for i,t in pairs(self.tracks) do -- local s = {id=t.id, engine=t.engine, output=t.output:get()} preset_table[i] = t:get_state_for_preset() end tabutil.save(preset_table, _path.data.."SUPER_BRAIN/preset_"..pre_nr..".txt") end, load_preset = function (self, pre_nr) local file_path = _path.data.."SUPER_BRAIN/preset_"..pre_nr..".txt" if false and util.file_exists (file_path) then -- load from file local saved_data = tabutil.load(file_path) for i,t in pairs(self.tracks) do t:load_preset(saved_data[i]) end print("loaded "..pre_nr) else for i,t in pairs(self.tracks) do --t:default() print("set to default") end end end, cleanup = function (self) for _,t in pairs(self.tracks) do if t.output then t.output:kill_all_notes() end end if self.grid.enter_mode then self.grid:enter_mode("live") end end } end -- return BRAIN
-- oUF_OrbsConfig: global -- zork, 2018 ----------------------------- -- Variables ----------------------------- local A, L = ... ----------------------------- -- Global Config ----------------------------- --scale L.C.scale = 0.6 --colors L.C.colors = {} --colors bgMultiplier L.C.colors.bgMultiplier = 0.3 --colors castbar L.C.colors.castbar = { default = {1,0.7,0}, shielded = {.8,.8,.8} } --colors healthbar L.C.colors.healthbar = { default = {0,1,0}, threat = {1,0,0}, threatInvers = {0,1,0}, absorb = {0,1,1} }
-- Copyright (c) 2020 Trevor Redfern -- -- This software is released under the MIT License. -- https://opensource.org/licenses/MIT -- Copyright (c) 2020 Trevor Redfern -- -- This software is released under the MIT License. -- https://opensource.org/licenses/MIT local store = require "moonpie.redux.store" local tables = require "moonpie.tables" local mock_reducer = function(state, action) if action.type == "mock_store_update_state" then state = action.payload end return tables.assign({}, state, { actions = tables.concatArray(state.actions, { action }) }) end function store.get_action_groups() local actions = store.getState().actions or {} return tables.groupBy(actions, function(a) return a.type end) end function store.get_actions(type) local groups = store.get_action_groups() return groups[type] end function store.simulate_change(new_state) store.dispatch{ type = "mock_store_update_state", payload = new_state} end return function(stub_state) stub_state = stub_state or {} store.clearSubscribers() store.createStore(mock_reducer, stub_state) return store end
--[[ Copyright (c) 2014 by Adam Hellberg. 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 NAME, T = ... T.BodyguardFrame = {} local bf = T.BodyguardFrame local locked = true local frame local created = false local function Create() if created then return end -- A global name required for dropdown functionality frame = CreateFrame("Button", "BodyguardHealthFrame", UIParent, "SecureActionButtonTemplate") -- DEBUG bf.Frame = frame frame:Hide() --frame:EnableMouse(false) frame:SetMovable(false) frame.statusLabel = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") frame.statusLabel:SetWidth(70) frame.statusLabel:SetHeight(16) frame.statusLabel:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -5, -5) frame.statusLabel:SetText("Unknown") frame.statusLabel:SetJustifyH("RIGHT") frame.nameLabel = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") frame.nameLabel:SetWidth(100) frame.nameLabel:SetHeight(16) frame.nameLabel:SetPoint("TOPLEFT", frame, "TOPLEFT", 5, -5) frame.nameLabel:SetPoint("RIGHT", frame.statusLabel, "LEFT", -5, 0) frame.nameLabel:SetText("Bodyguard") frame.nameLabel:SetJustifyH("LEFT") frame.healthBar = CreateFrame("StatusBar", nil, frame) local hb = frame.healthBar hb:SetMinMaxValues(0, 1) hb:SetValue(1) hb:SetPoint("TOP", frame.nameLabel, "BOTTOM", 0, -5) hb:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", 5, 5) hb:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -5, 5) hb:SetStatusBarColor(0, 1, 0) frame.healthLabel = hb:CreateFontString(nil, "OVERLAY", "GameFontNormal") frame.healthLabel:SetHeight(25) frame.healthLabel:SetPoint("TOPLEFT", frame.healthBar, "TOPLEFT") frame.healthLabel:SetPoint("BOTTOMRIGHT", frame.healthBar, "BOTTOMRIGHT") frame.healthLabel:SetTextColor(1, 1, 1) frame.healthLabel:SetText("No HP data") created = true bf:UpdateSettings() end function bf:ResetSettings() Create() frame:ClearAllPoints() frame:SetWidth(200) frame:SetHeight(60) frame:SetScale(1) frame:SetPoint("CENTER") self:SaveSettings() end function bf:UpdateSettings() if T.InCombat then return end Create() local settings = T.DB.profile.FrameSettings frame:ClearAllPoints() frame:SetWidth(settings.Width or 200) frame:SetHeight(settings.Height or 60) if settings.RelPoint then frame:SetPoint(settings.Point or "CENTER", nil, settings.RelPoint, settings.Offset.X or 0, settings.Offset.Y or 0) else frame:SetPoint(settings.Point or "CENTER", settings.Offset.X or 0, settings.Offset.Y or 0) end if settings.Scale <= 0 then settings.Scale = 1 end frame:SetScale(settings.Scale) local lsm = T.LSM local backdrop = { bgFile = lsm:Fetch(lsm.MediaType.BACKGROUND, settings.Backdrop.Background), edgeFile = lsm:Fetch(lsm.MediaType.BORDER, settings.Backdrop.Border), tile = settings.Backdrop.Tile, edgeSize = settings.Backdrop.BorderSize, tileSize = settings.Backdrop.TileSize, insets = { left = settings.Backdrop.Insets.Left, right = settings.Backdrop.Insets.Right, top = settings.Backdrop.Insets.Top, bottom = settings.Backdrop.Insets.Bottom } } frame:SetBackdrop(backdrop) local bdcolor = settings.Backdrop.Color frame:SetBackdropColor(bdcolor.R, bdcolor.G, bdcolor.B, bdcolor.A) local bdbcolor = settings.Backdrop.BorderColor frame:SetBackdropBorderColor(bdbcolor.R, bdbcolor.G, bdbcolor.B, bdbcolor.A) frame.healthBar:SetStatusBarTexture(lsm:Fetch(lsm.MediaType.STATUSBAR, settings.Texture), "ARTWORK") local fontFlags = settings.FontFlags if fontFlags == "NONE" then fontFlags = nil end frame.healthLabel:SetFont(lsm:Fetch(lsm.MediaType.FONT, settings.Font), settings.FontSize, fontFlags) frame.healthLabel:SetTextColor(settings.FontColor.R, settings.FontColor.G, settings.FontColor.B, settings.FontColor.A) frame:SetAlpha(settings.Opacity / 100) self:SaveSettings() end function bf:SaveSettings() Create() local settings = T.DB.profile.FrameSettings settings.Width = frame:GetWidth() settings.Height = frame:GetHeight() settings.Scale = frame:GetScale() local point, _, relPoint, x, y = frame:GetPoint(1) settings.Point = point settings.RelPoint = relPoint settings.Offset.X = x settings.Offset.Y = y --settings.Texture = hb:GetStatusBarTexture():GetTexture() end function bf:UpdateName(name) Create() frame.nameLabel:SetText(name) if not T.DB.profile.FrameSettings.ClickThrough and not T.InCombat then frame:SetAttribute("macrotext1", "/targetexact " .. name) end end function bf:UpdateStatus(status) Create() local text = "Unknown" for label, id in pairs(T.LBG.Status) do if id == status then text = label break end end frame.statusLabel:SetText(text) end local function round(num) return math.floor(num + 0.5) end local at_warn_threshold = false local health_warnings = {5, 10, 20, 30} local health_warns = {} local shown_by_unlock = false local BreakUpLargeNumbers = BreakUpLargeNumbers local suffixes = {"k", "M"} -- Upvalue since this is used from combat events local format = string.format local gsub = string.gsub local function shorten(number) local suffix = "" local suffixIndex = 0 while number > 1000 and suffixIndex < #suffixes do number = number / 1000 suffixIndex = suffixIndex + 1 suffix = suffixes[suffixIndex] end -- The gsub will strip trailing zeroes and decimal points when needed -- 100.00 becomes 100, but 100.02 stays the same return gsub(format("%.2f", number), "%.?0+$", "") .. suffix end local text_formatters = { NONE = function() return "" end, PERCENTAGE = function(health, maxHealth, pct) return format("%d%%", pct) end, SHORT = function(health) return shorten(health) end, LONG = function(health) return BreakUpLargeNumbers(health) end, MIXED = function(health, maxHealth, pct) return format("%s (%d%%)", shorten(health), pct) end } function bf:UpdateHealthBar(health, maxHealth) health = health or T.DB.char.Health or T.LBG:GetHealth() maxHealth = maxHealth or T.DB.char.MaxHealth or T.LBG:GetMaxHealth() Create() local red = 1 local green = 1 local blue = 0 local ratio = (maxHealth > 0) and (health / maxHealth) or 0 if T.DB.profile.FrameSettings.HealthBasedColor then if ratio > 0.5 then red = 2 - ratio * 2 elseif ratio < 0.5 then green = ratio * 2 end else red = T.DB.profile.FrameSettings.CustomColor.R green = T.DB.profile.FrameSettings.CustomColor.G blue = T.DB.profile.FrameSettings.CustomColor.B end local hb = frame.healthBar hb:SetStatusBarColor(red, green, blue) hb:SetMinMaxValues(0, maxHealth) hb:SetValue(health) local percentage = round(ratio * 100) local style = T.DB.profile.FrameSettings.HealthTextStyle local text = text_formatters[style](health, maxHealth, percentage) frame.healthLabel:SetText(text) if T.LBG:GetStatus() == T.LBG.Status.Inactive then return end if percentage <= 30 then at_warn_threshold = true for i = 1, #health_warnings do local threshold = health_warnings[i] if percentage <= threshold then if not health_warns[i] then if T.DB.profile.EnableWarn then PlaySoundFile(T.LSM.Fetch(T.LSM.MediaType.SOUND, T.DB.WarnSound), "Master") RaidNotice_AddMessage(RaidWarningFrame, ("%s @ %d%%!"):format(T.LBG:GetName(), percentage), ChatTypeInfo["RAID_WARNING"]) end health_warns[i] = true end break end end elseif at_warn_threshold then at_warn_threshold = false for i = 1, #health_warnings do health_warns[i] = false end end end function bf:SetMenu(enabled) Create() if enabled then frame:EnableMouse(true) frame:SetAttribute("type1", "macro") local name = T.LBG:GetName() if name then frame:SetAttribute("macrotext1", "/targetexact " .. name) end frame:SetScript("OnMouseUp", function(self, button) if button ~= "RightButton" or T.InCombat then return end T.Dropdown:Show(frame) end) else frame:SetAttribute("type1", nil) frame:SetScript("OnMouseUp", nil) frame:EnableMouse(false) end T.DB.profile.FrameSettings.ClickThrough = not enabled end function bf:EnableMenu() self:SetMenu(true) end function bf:DisableMenu() self:SetMenu(false) end function bf:Show(force) if T.InCombat then T:Log("Tried to show frame in combat, queueing action.", true) T:QueueShow() return end if not force and (self:IsShowing() or not T.DB.profile.Enabled) then return end if not force then shown_by_unlock = false end Create() self:UpdateSettings() frame:Show() end function bf:Hide() if T.InCombat then T:Log("Tried to hide frame in combat, queueing action.", true) T:QueueHide() return end if not self:IsShowing() then return end Create() frame:Hide() shown_by_unlock = false end function bf:IsShowing() return created and frame:IsVisible() end function bf:IsLocked() return locked end function bf:Unlock() Create() frame:SetMovable(true) frame:SetScript("OnMouseDown", function(f) f:StartMoving() end) frame:SetScript("OnMouseUp", function(f) f:StopMovingOrSizing() bf:SaveSettings() end) if not self:IsShowing() then self:Show(true) shown_by_unlock = true end locked = false end function bf:Lock() Create() frame:SetMovable(false) frame:SetScript("OnMouseDown", nil) frame:SetScript("OnMouseUp", nil) self:SaveSettings() locked = true if not T.DB.profile.FrameSettings.ClickThrough then self:EnableMenu() else frame:EnableMouse(false) end if not T.DB.profile.Enabled or not T.DB.char.HasBodyguard or shown_by_unlock then self:Hide() end shown_by_unlock = false end function bf:EnterCombat() if T.DB.profile.FrameSettings.UseCombatOpacity then frame:SetAlpha(T.DB.profile.FrameSettings.CombatOpacity / 100) end end
Player = game.Players:findFirstChild("xSoulStealerx") local M = Instance.new("ScreenGui") M.Parent = Player.PlayerGui local c = Instance.new("Frame") c.Parent = M c.Position = UDim2.new(0,9,0,562) c.Size = UDim2.new(0,556,0,46) c.BackgroundColor = BrickColor.new("Really black") c.BorderColor = BrickColor.new("New Yeller") local s = Instance.new("TextButton") s.Parent = M s.Position = UDim2.new(0,470,0,570) s.Size = UDim2.new(0,86,0,30) s.Text = "->" s.FontSize = "Size24" s.BackgroundColor = BrickColor.new("Really black") s.TextColor = BrickColor.new("New Yeller") s.BorderColor = BrickColor.new("New Yeller") local b = Instance.new("TextBox") b.Parent = M b.Position = UDim2.new(0,12,0,565) b.Size = UDim2.new(0,450,0,18) b.Text = "Insert your message here, "..M.Parent.Parent.Name.."." b.FontSize = "Size9" b.TextXAlignment = "Left" b.BackgroundColor = BrickColor.new("Really black") b.TextColor = BrickColor.new("Lime green") b.BorderColor = BrickColor.new("Lime green") local j = Instance.new("TextBox") j.Parent = M j.Position = UDim2.new(0,12,0,587) j.Size = UDim2.new(0,200,0,18) j.Text = "Player name here, "..M.Parent.Parent.Name.."." j.FontSize = "Size9" j.BackgroundColor = BrickColor.new("Really black") j.TextColor = BrickColor.new("Lime green") j.BorderColor = BrickColor.new("Lime green") local x = Instance.new("TextLabel") x.Parent = M x.Position = UDim2.new(0,62,0,608) x.Size = UDim2.new(0,120,0,16) x.Text = "Player name here" x.FontSize = "Size10" x.BackgroundColor = BrickColor.new("Really black") x.TextColor = BrickColor.new("New Yeller") x.BorderColor = BrickColor.new("New Yeller") local z = Instance.new("TextLabel") z.Parent = M z.Position = UDim2.new(0,62,0,546) z.Size = UDim2.new(0,120,0,16) z.Text = "Message here" z.FontSize = "Size10" z.BackgroundColor = BrickColor.new("Really black") z.TextColor = BrickColor.new("New Yeller") z.BorderColor = BrickColor.new("New Yeller") local q = Instance.new("TextButton") q.Parent = M q.Position = UDim2.new(0,200,0,548) q.Size = UDim2.new(0,60,0,14) q.Text = "Hide" q.FontSize = "Size10" q.BackgroundColor = BrickColor.new("Really black") q.TextColor = BrickColor.new("New Yeller") q.BorderColor = BrickColor.new("New Yeller") local p = Instance.new("TextButton") p.Parent = M p.Position = UDim2.new(0,200,0,548) p.Size = UDim2.new(0,60,0,14) p.Text = "Show" p.FontSize = "Size10" p.BackgroundColor = BrickColor.new("Really black") p.TextColor = BrickColor.new("New Yeller") p.BorderColor = BrickColor.new("New Yeller") p.BackgroundTransparency = 0.7 p.Visible = false p.TextTransparency = 0.6 function clicked() plrs = game.Players:GetChildren() for i = 1, #plrs do if plrs[i].Name:lower() == j.Text then local msg = Instance.new("ScreenGui") msg.Parent = plrs[i].PlayerGui local mg = Instance.new("TextLabel") mg.Parent = msg mg.Text = Player.Name.." says: "..b.Text mg.Position = UDim2.new(0,150,0,200) mg.Size = UDim2.new(0,700,0,30) mg.FontSize = "Size10" mg.BackgroundColor = BrickColor.new("Really black") mg.TextColor = BrickColor.new("New Yeller") mg.BorderColor = BrickColor.new("New Yeller") local ms = Instance.new("TextLabel") ms.Parent = M ms.Text = "Message sent to "..j.Text ms.Position = UDim2.new(0,370,0,100) ms.Size = UDim2.new(0,300,0,30) ms.FontSize = "Size10" ms.BackgroundColor = BrickColor.new("Really black") ms.TextColor = BrickColor.new("New Yeller") ms.BorderColor = BrickColor.new("New Yeller") wait(1.5) ms:remove() wait(6) msg:remove() end end end function clickah() c.Visible = false s.Visible = false b.Visible = false j.Visible = false x.Visible = false z.Visible = false q.Visible = false p.Visible = true end function clickarr() c.Visible = true s.Visible = true b.Visible = true j.Visible = true x.Visible = true z.Visible = true q.Visible = true p.Visible = false end s.MouseButton1Click:connect(clicked) q.MouseButton1Click:connect(clickah) p.MouseButton1Click:connect(clickarr) local sc = Instance.new("ScreenGui") sc.Parent = Player.PlayerGui local j = Instance.new("Frame") j.Parent = sc j.Size = UDim2.new(0, 300, 0, 80) j.Position = UDim2.new(0, 60, 0, 100) j.BackgroundColor = BrickColor.new("Really black") j.BorderColor = BrickColor.new("New Yeller") local k = Instance.new("TextButton") k.Parent = sc k.Size = UDim2.new(0, 100, 0, 60) k.Position = UDim2.new(0, 250, 0, 110) k.Text = "Send" k.FontSize = "Size12" k.BackgroundColor = BrickColor.new("Really black") k.TextColor = BrickColor.new("New Yeller") k.BorderColor = BrickColor.new("New Yeller") local h = Instance.new("TextBox") h.Parent = sc h.Size = UDim2.new(0, 180, 0, 16) h.Position = UDim2.new(0, 65, 0, 110) h.Text = "Line 1" h.BackgroundColor = BrickColor.new("Really black") h.TextColor = BrickColor.new("Lime green") h.BorderColor = BrickColor.new("Lime green") local l = Instance.new("TextBox") l.Parent = sc l.Size = UDim2.new(0, 180, 0, 16) l.Position = UDim2.new(0, 65, 0, 130) l.Text = "Line 2" l.BackgroundColor = BrickColor.new("Really black") l.TextColor = BrickColor.new("Lime green") l.BorderColor = BrickColor.new("Lime green") local g = Instance.new("TextBox") g.Parent = sc g.Size = UDim2.new(0, 180, 0, 16) g.Position = UDim2.new(0, 65, 0, 150) g.Text = "Line 3" g.BackgroundColor = BrickColor.new("Really black") g.TextColor = BrickColor.new("Lime green") g.BorderColor = BrickColor.new("Lime green") function click() local m = Instance.new("BillboardGui") m.Parent = Game.Workspace m.Adornee = Player.Character.Head m.Size = UDim2.new(0,150,0,150) local b = Instance.new("ImageLabel") b.Size = UDim2.new(0,200,0,133) b.Position = UDim2.new(0,-150,0,-70) b.Parent = m b.Image = "http://www.roblox.com/asset/?id=37079090" b.BackgroundTransparency = 1 local f = Instance.new("TextLabel") f.Parent = m f.Size = UDim2.new(0, 130, 0, 10) f.Position = UDim2.new(0,-110,0,-30) f.Text = h.Text f.TextColor = BrickColor.new("New Yeller") f.BackgroundTransparency = 1 f.FontSize = "Size10" local d = Instance.new("TextLabel") d.Parent = m d.Size = UDim2.new(0, 130, 0, 10) d.Position = UDim2.new(0,-110,0,-10) d.Text = l.Text d.BackgroundTransparency = 1 d.FontSize = "Size10" d.TextColor = BrickColor.new("New Yeller") local s = Instance.new("TextLabel") s.Parent = m s.Size = UDim2.new(0, 130, 0, 10) s.Position = UDim2.new(0,-110,0,10) s.Text = g.Text s.BackgroundTransparency = 1 s.FontSize = "Size10" s.TextColor = BrickColor.new("New Yeller") wait(6) m:remove() end k.MouseButton1Click:connect(click) local o = Instance.new("TextButton") o.Parent = sc o.Size = UDim2.new(0, 100, 0, 40) o.Position = UDim2.new(0, 10, 0, 230) o.Text = "Troll a playa" o.BackgroundColor = BrickColor.new("Really black") o.TextColor = BrickColor.new("New Yeller") o.BorderColor = BrickColor.new("New Yeller") local g = Instance.new("TextBox") g.Parent = sc g.Size = UDim2.new(0, 100, 0, 16) g.Position = UDim2.new(0, 10, 0, 270) g.Text = "Name here" g.BackgroundColor = BrickColor.new("Really black") g.TextColor = BrickColor.new("Lime green") g.BorderColor = BrickColor.new("Lime green") function claa() plrs = game.Players:GetChildren() for i = 1, #plrs do if plrs[i].Name:lower() == g.Text then local sgg = Instance.new("ScreenGui") sgg.Parent = plrs[i].PlayerGui local kk = Instance.new("ScreenGui") kk.Parent = Player.PlayerGui local y = Instance.new("ImageLabel") y.Size = UDim2.new(0,1024,0,768) y.Parent = sgg y.Position = UDim2.new(0, 0, 0, -20) y.Image = "http://www.roblox.com/asset/?id=29658197" y.BackgroundTransparency = 1 local ty = Instance.new("TextLabel") ty.Parent = kk ty.Text = g.Text.." trolled." ty.Position = UDim2.new(0,400,0,200) ty.Size = UDim2.new(0,200,0,30) ty.FontSize = "Size10" ty.BackgroundColor = BrickColor.new("Really black") ty.TextColor = BrickColor.new("New Yeller") ty.BorderColor = BrickColor.new("New Yeller") local w = Instance.new("TextLabel") w.Parent = sgg w.Text = "You just got trolled." w.Position = UDim2.new(0,370,0,15) w.Size = UDim2.new(0,260,0,30) w.FontSize = "Size10" w.BackgroundColor = BrickColor.new("Really black") w.TextColor = BrickColor.new("New Yeller") w.BorderColor = BrickColor.new("New Yeller") local sound = Instance.new("Sound") sound.Name = "Sound" sound.Pitch = 2.9 sound.SoundId = "http://www.roblox.com/asset/?id=1372260" sound.Volume = 0.5 sound.Looped = false sound.archivable = false sound.Parent = plrs[i] sound:play() y.Image = "http://www.roblox.com/asset/?id=29658197" wait(0.9) y.Image = "" wait(0.1) y.Image = "http://www.roblox.com/asset/?id=29658197" wait(0.9) y.Image = "" wait(0.1) y.Image = "http://www.roblox.com/asset/?id=29658197" ty:remove() wait(0.9) y.Image = "" sgg.Parent.Parent.Character.Humanoid.Health = sgg.Parent.Parent.Character.Humanoid.Health - 20 wait(0.1) y.Image = "http://www.roblox.com/asset/?id=29658197" wait(0.9) y.Image = "" wait(0.1) y.Image = "http://www.roblox.com/asset/?id=29658197" wait(0.9) y.Image = "" wait(0.1) y.Image = "http://www.roblox.com/asset/?id=29658197" wait(0.9) y.Image = "" sgg.Parent.Parent.Character.Humanoid.Health = sgg.Parent.Parent.Character.Humanoid.Health - 20 wait(0.1) y.Image = "http://www.roblox.com/asset/?id=29658197" wait(0.9) y.Image = "" sgg.Parent.Parent.Character.Humanoid.Health = sgg.Parent.Parent.Character.Humanoid.Health - 20 wait(0.1) y.Image = "http://www.roblox.com/asset/?id=29658197" wait(0.9) y.Image = "" wait(0.1) y.Image = "http://www.roblox.com/asset/?id=29658197" w:remove() wait(0.9) y.Image = "" sgg.Parent.Parent.Character.Humanoid.Health = sgg.Parent.Parent.Character.Humanoid.Health - 20 wait(0.1) y.Image = "http://www.roblox.com/asset/?id=29658197" wait(0.9) y.Image = "" wait(0.1) y.Image = "http://www.roblox.com/asset/?id=29658197" wait(0.9) y.Image = "" sgg.Parent.Parent.Character.Humanoid.Health = sgg.Parent.Parent.Character.Humanoid.Health - 20 wait(0.1) y.Image = "http://www.roblox.com/asset/?id=29658197" wait(0.9) y.Image = "" sgg.Parent.Parent.Character.Humanoid.Health = sgg.Parent.Parent.Character.Humanoid.Health - 20 wait(0.1) y.Image = "http://www.roblox.com/asset/?id=29658197" wait(0.9) y.Image = "" sgg.Parent.Parent.Character.Humanoid.Health = 0 wait(0.8) sgg:remove() wait(2) sound:stop() wait() sound:remove() end end end o.MouseButton1Click:connect(claa) local r = Instance.new("Frame") r.Parent = M r.Position = UDim2.new(0,850,0,70) r.Size = UDim2.new(0,140,0,100) r.BackgroundColor = BrickColor.new("Really black") r.BorderColor = BrickColor.new("New Yeller") local i = Instance.new("TextBox") i.Parent = M i.Position = UDim2.new(0,850,0,150) i.Size = UDim2.new(0,140,0,20) i.BackgroundColor = BrickColor.new("Really black") i.BorderColor = BrickColor.new("Lime green") i.TextColor = BrickColor.new("Lime green") i.Text = "Decal ID here" i.FontSize = "Size9" local ted = Instance.new("TextButton") ted.Parent = M ted.Position = UDim2.new(0,855,0,75) ted.Size = UDim2.new(0,130,0,70) ted.BackgroundColor = BrickColor.new("Really black") ted.BorderColor = BrickColor.new("New Yeller") ted.TextColor = BrickColor.new("New Yeller") ted.Text = "Send" ted.FontSize = "Size24" function clkk() local ll = Instance.new("BillboardGui") ll.Parent = Game.Workspace ll.Adornee = Player.Character.Head ll.Size = UDim2.new(0,150,0,150) local bbv = Instance.new("ImageLabel") bbv.Size = UDim2.new(0,200,0,133) bbv.Position = UDim2.new(0,0,0,-100) bbv.Parent = ll bbv.Image = "http://www.roblox.com/asset/?id="..i.Text bbv.BackgroundTransparency = 1 local tyf = Instance.new("TextLabel") tyf.Parent = M tyf.Text = "Succesfully sent." tyf.Position = UDim2.new(0,400,0,200) tyf.Size = UDim2.new(0,200,0,30) tyf.FontSize = "Size10" tyf.BackgroundColor = BrickColor.new("Really black") tyf.TextColor = BrickColor.new("New Yeller") tyf.BorderColor = BrickColor.new("New Yeller") wait(1.5) tyf:remove() wait(4) ll:remove() end ted.MouseButton1Click:connect(clkk)
local _M = {} local admin_utils = require "api-umbrella.utils.admin" local cmsgpack = require "cmsgpack" local cjson = require "cjson" local invert_table = require "api-umbrella.utils.invert_table" local lrucache = require "resty.lrucache.pureffi" local mongo = require "api-umbrella.utils.mongo" local shcache = require "shcache" local types = require "pl.types" local utils = require "api-umbrella.proxy.utils" local idp = require "api-umbrella.utils.idp" local cache_computed_settings = utils.cache_computed_settings local is_empty = types.is_empty local function lookup_user(api_key) local raw_user local ext_user local db_err local idp_err -- Checking the field of api_key ["key_type"], if the key_type is api_key -- the api_key value is checked in the database and retrieve the user information -- else if the key_type is token, the token is checked using the corresponding IdP -- registred in the api-backend and the user information is retrieved if not api_key["key_type"] or api_key["key_type"] == "api_key" then raw_user, db_err = mongo.first("api_users", { query = { api_key = api_key["key_value"], }, }) elseif api_key["key_type"] == "token" and api_key["idp"]then ext_user, idp_err = idp.first(api_key) end -- Check if there are errors reading database or external user if idp_err then ngx.log(ngx.ERR, "failed to autenticate , status code:", idp_err) elseif db_err then ngx.log(ngx.ERR, "failed to fetch user from mongodb", db_err) end -- If the external user has been provided, use email information to locate an internal user if not raw_user and ext_user then raw_user, db_err = mongo.first("api_users", { query = { email = ext_user["email"] }, }) if not raw_user then local err; ngx.log(ngx.ERR, "failed to fetch user from mongodb, creating user", db_err) -- The external user is correct, but it does not exists locally -- Create new user, using external idp info raw_user, err = admin_utils.create_user(ext_user) if err then ngx.log(ngx.ERR, "New user could not be created", db_err) end end end if raw_user then local user = utils.pick_where_present(raw_user, { "created_at", "disabled_at", "email", "email_verified", "registration_source", "roles", "settings", "throttle_by_ip", }) -- Ensure IDs get stored as strings, even if Mongo ObjectIds are in use. if raw_user["_id"] and raw_user["_id"]["$oid"] then user["id"] = raw_user["_id"]["$oid"] else user["id"] = raw_user["_id"] end -- Invert the array of roles into a hashy table for more optimized -- lookups (so we can just check if the key exists, rather than -- looping over each value). -- Moreover, in case that the user information have been retrieved using a token validation, -- the roles associated with the token are stored in user ["roles"] if api_key["idp"] and api_key["key_type"] == "token" and api_key["idp"]["backend_name"] == "fiware-oauth2" and ext_user.roles then user["roles"] = invert_table(ext_user.roles) elseif user["roles"] then user["roles"] = invert_table(user["roles"]) end if user["created_at"] and user["created_at"]["$date"] then user["created_at"] = user["created_at"]["$date"] end if user["settings"] and user["settings"] ~= cjson.null then user["settings"] = utils.pick_where_present(user["settings"], { "allowed_ips", "allowed_referers", "rate_limit_mode", "rate_limits", }) if is_empty(user["settings"]) then user["settings"] = nil else cache_computed_settings(user["settings"]) end end return user end end local local_cache = lrucache.new(500) local EMPTY_DATA = "_EMPTY_" function _M.get(api_key) if not config["gatekeeper"]["api_key_cache"] then return lookup_user(api_key) end local user = local_cache:get(api_key["key_value"]) if user then if user == EMPTY_DATA then return nil else return user end end local shared_cache, err = shcache:new(ngx.shared.api_users, { encode = cmsgpack.pack, decode = cmsgpack.unpack, external_lookup = lookup_user, external_lookup_arg = api_key, }, { positive_ttl = config["gatekeeper"]["positive_ttl"], negative_ttl = config["gatekeeper"]["negative_ttl"], }) if err then ngx.log(ngx.ERR, "failed to initialize shared cache for users: ", err) return nil end user = shared_cache:load(api_key["key_value"]) if user then local_cache:set(api_key["key_value"], user, 2) else local_cache:set(api_key["key_value"], EMPTY_DATA, 2) end return user end return _M
server { location /lua-jsonrpc-server { default_type "application/json"; content_by_lua ' local jsonrpc_server = require "resty.jsonrpc_server" local jsonrpc_demo = require "resty.jsonrpc_demo" local server = jsonrpc_server:new() local add1 = function(a, b) return a + b end local subtract = function(subtrahend, minuend) return subtrahend - minuend end local update = function(...) return nil end local register = server:register([[addition]], add1) local binder = server:bind([[addition1]], jsonrpc_demo, [[add1]]) server:register("subtract", subtract) server:register("update", update) ngx.req.read_body() local data = ngx.var.request_body local result = server:execute(data) ngx.say(result); '; } }
require("common/commonSocketWriter"); require("hall/onlineSocket/globalSocketCmd"); GlobalSocketWriter = class(CommonSocketWriter); GlobalSocketWriter.onSendLoginHall = function(self,packetId,info) self.m_socket:writeInt(packetId,info.userId); self.m_socket:writeShort(packetId,0); self.m_socket:writeShort(packetId,info.api); self.m_socket:writeInt(packetId, 1); self.m_socket:writeString(packetId,info.plateInfo); self.m_socket:writeString(packetId,info.guid or ""); self.m_socket:writeString(packetId,info.version or ""); self.m_socket:writeInt(packetId, info.appid or 0); self.m_socket:writeInt(packetId, info.hallVersion); end GlobalSocketWriter.onSendRoomLogout = function(self,packetId) end GlobalSocketWriter.onDefendAttackSendIpPort = function(self, packetId, info) Log.v("GlobalSocketWriter.onDefendAttackSendIpPort info = ", info); self.m_socket:writeString(packetId, info.ip); self.m_socket:writeShort(packetId, info.port); end GlobalSocketWriter.s_clientCmdFunMap = { [HALL_SEND_LOGIN] = GlobalSocketWriter.onSendLoginHall; [ROOM_SEND_LOGOUT] = GlobalSocketWriter.onSendRoomLogout; [SERVER_DEFEND_ATTACK_SEND_IP_PORT] = GlobalSocketWriter.onDefendAttackSendIpPort; };
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --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 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 program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. object_draft_schematic_droid_shared_bounty_probot_transmitter = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_bounty_probot_transmitter.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1941968174, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_bounty_probot_transmitter, "object/draft_schematic/droid/shared_bounty_probot_transmitter.iff") object_draft_schematic_droid_shared_bounty_seeker_transmitter = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_bounty_seeker_transmitter.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2758845308, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_bounty_seeker_transmitter, "object/draft_schematic/droid/shared_bounty_seeker_transmitter.iff") object_draft_schematic_droid_shared_droid_3p0 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_3p0.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1389615347, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_3p0, "object/draft_schematic/droid/shared_droid_3p0.iff") object_draft_schematic_droid_shared_droid_3p0_advanced = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_3p0_advanced.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1306893282, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_3p0_advanced, "object/draft_schematic/droid/shared_droid_3p0_advanced.iff") object_draft_schematic_droid_shared_droid_binary_load_lifter = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_binary_load_lifter.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 4286041096, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_binary_load_lifter, "object/draft_schematic/droid/shared_droid_binary_load_lifter.iff") object_draft_schematic_droid_shared_droid_binary_load_lifter_advanced = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_binary_load_lifter_advanced.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3404292567, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_binary_load_lifter_advanced, "object/draft_schematic/droid/shared_droid_binary_load_lifter_advanced.iff") object_draft_schematic_droid_shared_droid_customization_kit = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_customization_kit.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2443661159, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff", "object/draft_schematic/item/shared_item_base_tool.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_customization_kit, "object/draft_schematic/droid/shared_droid_customization_kit.iff") object_draft_schematic_droid_shared_droid_damage_repair_kit_a = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_damage_repair_kit_a.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2525304754, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_damage_repair_kit_a, "object/draft_schematic/droid/shared_droid_damage_repair_kit_a.iff") object_draft_schematic_droid_shared_droid_damage_repair_kit_b = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_damage_repair_kit_b.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1301462821, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_damage_repair_kit_b, "object/draft_schematic/droid/shared_droid_damage_repair_kit_b.iff") object_draft_schematic_droid_shared_droid_damage_repair_kit_c = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_damage_repair_kit_c.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 77584552, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_damage_repair_kit_c, "object/draft_schematic/droid/shared_droid_damage_repair_kit_c.iff") object_draft_schematic_droid_shared_droid_damage_repair_kit_d = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_damage_repair_kit_d.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 4286378940, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_damage_repair_kit_d, "object/draft_schematic/droid/shared_droid_damage_repair_kit_d.iff") object_draft_schematic_droid_shared_droid_dz70 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_dz70.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 708846051, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_dz70, "object/draft_schematic/droid/shared_droid_dz70.iff") object_draft_schematic_droid_shared_droid_dz70_advanced = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_dz70_advanced.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2942797773, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_dz70_advanced, "object/draft_schematic/droid/shared_droid_dz70_advanced.iff") object_draft_schematic_droid_shared_droid_interplanetary_survey = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_interplanetary_survey.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 5645596, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_interplanetary_survey, "object/draft_schematic/droid/shared_droid_interplanetary_survey.iff") object_draft_schematic_droid_shared_droid_le_repair = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_le_repair.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2934220330, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_le_repair, "object/draft_schematic/droid/shared_droid_le_repair.iff") object_draft_schematic_droid_shared_droid_le_repair_advanced = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_le_repair_advanced.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2527796117, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_le_repair_advanced, "object/draft_schematic/droid/shared_droid_le_repair_advanced.iff") object_draft_schematic_droid_shared_droid_mse = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_mse.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 901463605, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_mse, "object/draft_schematic/droid/shared_droid_mse.iff") object_draft_schematic_droid_shared_droid_mse_advanced = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_mse_advanced.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 118884910, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_mse_advanced, "object/draft_schematic/droid/shared_droid_mse_advanced.iff") object_draft_schematic_droid_shared_droid_power = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_power.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 385422826, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_power, "object/draft_schematic/droid/shared_droid_power.iff") object_draft_schematic_droid_shared_droid_power_advanced = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_power_advanced.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 495736923, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_power_advanced, "object/draft_schematic/droid/shared_droid_power_advanced.iff") object_draft_schematic_droid_shared_droid_probot = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_probot.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 270329060, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_probot, "object/draft_schematic/droid/shared_droid_probot.iff") object_draft_schematic_droid_shared_droid_probot_advanced = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_probot_advanced.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3398676938, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_probot_advanced, "object/draft_schematic/droid/shared_droid_probot_advanced.iff") object_draft_schematic_droid_shared_droid_r2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_r2.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 823031027, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_r2, "object/draft_schematic/droid/shared_droid_r2.iff") object_draft_schematic_droid_shared_droid_r2_advanced = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_r2_advanced.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 783926207, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_r2_advanced, "object/draft_schematic/droid/shared_droid_r2_advanced.iff") object_draft_schematic_droid_shared_droid_r3 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_r3.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2013467518, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_r3, "object/draft_schematic/droid/shared_droid_r3.iff") object_draft_schematic_droid_shared_droid_r3_advanced = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_r3_advanced.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1766722942, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_r3_advanced, "object/draft_schematic/droid/shared_droid_r3_advanced.iff") object_draft_schematic_droid_shared_droid_r4 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_r4.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2212509802, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_r4, "object/draft_schematic/droid/shared_droid_r4.iff") object_draft_schematic_droid_shared_droid_r4_advanced = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_r4_advanced.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3125311630, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_r4_advanced, "object/draft_schematic/droid/shared_droid_r4_advanced.iff") object_draft_schematic_droid_shared_droid_r5 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_r5.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3404554215, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_r5, "object/draft_schematic/droid/shared_droid_r5.iff") object_draft_schematic_droid_shared_droid_r5_advanced = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_r5_advanced.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 4257199695, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_r5_advanced, "object/draft_schematic/droid/shared_droid_r5_advanced.iff") object_draft_schematic_droid_shared_droid_stimpack_a = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_stimpack_a.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 670345241, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff", "object/draft_schematic/item/shared_item_base_tool.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_stimpack_a, "object/draft_schematic/droid/shared_droid_stimpack_a.iff") object_draft_schematic_droid_shared_droid_stimpack_b = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_stimpack_b.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 4242735246, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff", "object/draft_schematic/item/shared_item_base_tool.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_stimpack_b, "object/draft_schematic/droid/shared_droid_stimpack_b.iff") object_draft_schematic_droid_shared_droid_stimpack_c = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_stimpack_c.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3052300035, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff", "object/draft_schematic/item/shared_item_base_tool.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_stimpack_c, "object/draft_schematic/droid/shared_droid_stimpack_c.iff") object_draft_schematic_droid_shared_droid_stimpack_d = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_stimpack_d.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1309494295, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff", "object/draft_schematic/item/shared_item_base_tool.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_stimpack_d, "object/draft_schematic/droid/shared_droid_stimpack_d.iff") object_draft_schematic_droid_shared_droid_surgical = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_surgical.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 4168988413, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_surgical, "object/draft_schematic/droid/shared_droid_surgical.iff") object_draft_schematic_droid_shared_droid_surgical_advanced = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_surgical_advanced.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 4113263864, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_surgical_advanced, "object/draft_schematic/droid/shared_droid_surgical_advanced.iff") object_draft_schematic_droid_shared_droid_treadwell = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_treadwell.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 201412072, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_treadwell, "object/draft_schematic/droid/shared_droid_treadwell.iff") object_draft_schematic_droid_shared_droid_treadwell_advanced = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_treadwell_advanced.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3172777822, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_treadwell_advanced, "object/draft_schematic/droid/shared_droid_treadwell_advanced.iff") object_draft_schematic_droid_shared_droid_vitapack_a = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_vitapack_a.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2984466830, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff", "object/draft_schematic/item/shared_item_base_tool.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_vitapack_a, "object/draft_schematic/droid/shared_droid_vitapack_a.iff") object_draft_schematic_droid_shared_droid_vitapack_b = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_vitapack_b.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1794437401, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff", "object/draft_schematic/item/shared_item_base_tool.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_vitapack_b, "object/draft_schematic/droid/shared_droid_vitapack_b.iff") object_draft_schematic_droid_shared_droid_vitapack_c = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_vitapack_c.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 603559572, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff", "object/draft_schematic/item/shared_item_base_tool.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_vitapack_c, "object/draft_schematic/droid/shared_droid_vitapack_c.iff") object_draft_schematic_droid_shared_droid_wound_repair_kit_a = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_wound_repair_kit_a.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 376516854, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_wound_repair_kit_a, "object/draft_schematic/droid/shared_droid_wound_repair_kit_a.iff") object_draft_schematic_droid_shared_droid_wound_repair_kit_b = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_wound_repair_kit_b.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3446052961, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_wound_repair_kit_b, "object/draft_schematic/droid/shared_droid_wound_repair_kit_b.iff") object_draft_schematic_droid_shared_droid_wound_repair_kit_c = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_wound_repair_kit_c.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2221670380, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_wound_repair_kit_c, "object/draft_schematic/droid/shared_droid_wound_repair_kit_c.iff") object_draft_schematic_droid_shared_droid_wound_repair_kit_d = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_droid_wound_repair_kit_d.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 2139673848, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_droid_wound_repair_kit_d, "object/draft_schematic/droid/shared_droid_wound_repair_kit_d.iff") object_draft_schematic_droid_shared_navicomputer_1 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_navicomputer_1.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 783582353, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_navicomputer_1, "object/draft_schematic/droid/shared_navicomputer_1.iff") object_draft_schematic_droid_shared_navicomputer_2 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_navicomputer_2.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 4121111558, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_navicomputer_2, "object/draft_schematic/droid/shared_navicomputer_2.iff") object_draft_schematic_droid_shared_navicomputer_3 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_navicomputer_3.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3165539211, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_navicomputer_3, "object/draft_schematic/droid/shared_navicomputer_3.iff") object_draft_schematic_droid_shared_navicomputer_4 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_navicomputer_4.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 1196253343, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_navicomputer_4, "object/draft_schematic/droid/shared_navicomputer_4.iff") object_draft_schematic_droid_shared_navicomputer_5 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_navicomputer_5.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 239077138, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_navicomputer_5, "object/draft_schematic/droid/shared_navicomputer_5.iff") object_draft_schematic_droid_shared_navicomputer_6 = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/droid/shared_navicomputer_6.iff" --Data below here is deprecated and loaded from the tres, keeping for easy lookups --[[ appearanceFilename = "", arrangementDescriptorFilename = "abstract/slot/arrangement/arrangement_datapad.iff", clearFloraRadius = 0, clientDataFile = "", clientGameObjectType = 2049, collisionActionBlockFlags = 0, collisionActionFlags = 0, collisionActionPassFlags = 0, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 0, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 0, detailedDescription = "string_id_table", gameObjectType = 2049, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "string_id_table", onlyVisibleInTools = 0, portalLayoutFilename = "", scale = 0, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 0, surfaceType = 0, totalCellNumber = 0, clientObjectCRC = 3579293573, derivedFromTemplates = {"object/object/base/shared_base_object.iff", "object/intangible/base/shared_base_intangible.iff", "object/draft_schematic/base/shared_base_draft_schematic.iff"} ]] } ObjectTemplates:addClientTemplate(object_draft_schematic_droid_shared_navicomputer_6, "object/draft_schematic/droid/shared_navicomputer_6.iff")
local PrVeh = "prop_vehicle_jeep" local Cat = "TDM Cars" local V = { Name = "Ford Focus RS", Class = PrVeh, Category = Cat, Author = "TheDanishMaster, Turn 10", Information = "A drivable Ford Focus RS by TheDanishMaster", Model = "models/tdmcars/focusrs.mdl", KeyValues = { vehiclescript = "scripts/vehicles/TDMCars/focusrs.txt" } } list.Set("Vehicles", "focusrstdm", V) local V = { Name = "Ford Focus RS '16", Class = PrVeh, Category = Cat, Author = "TheDanishMaster, NM", Information = "A drivable Ford Focus RS '16 by TheDanishMaster", Model = "models/tdmcars/for_focus_rs16.mdl", KeyValues = { vehiclescript = "scripts/vehicles/TDMCars/for_focus_rs16.txt" } } list.Set("Vehicles", "for_focus_rs16tdm", V) local V = { Name = "Ford Crown Victoria Taxi", Class = PrVeh, Category = Cat, Author = "TheDanishMaster, freemmaann, Turn 10", Information = "A drivable Ford Crown Victoria Taxi by TheDanishMaster", Model = "models/tdmcars/crownvic_taxi.mdl", KeyValues = { vehiclescript = "scripts/vehicles/TDMCars/crownvic_taxi.txt" } } list.Set("Vehicles", "crownvic_taxitdm", V) local V = { Name = "Ford Deluxe Coupe 1940", Class = PrVeh, Category = Cat, Author = "TheDanishMaster, freemmaann, Turn 10", Information = "A drivable Ford Deluxe Coupe 1940 by TheDanishMaster", Model = "models/tdmcars/ford_coupe_40.mdl", KeyValues = { vehiclescript = "scripts/vehicles/TDMCars/coupe40.txt" } } list.Set("Vehicles", "coupe40tdm", V) local V = { Name = "Ford F100", Class = PrVeh, Category = Cat, Author = "TheDanishMaster, Turn 10", Information = "A drivable Ford F100 by TheDanishMaster", Model = "models/tdmcars/for_f100.mdl", KeyValues = { vehiclescript = "scripts/vehicles/TDMCars/f100.txt" } } list.Set("Vehicles", "f100tdm", V) local V = { Name = "Ford F350 SuperDuty", Class = PrVeh, Category = Cat, Author = "TheDanishMaster, Ubisoft", Information = "A drivable Ford F350 SuperDuty by TheDanishMaster", Model = "models/tdmcars/for_f350.mdl", KeyValues = { vehiclescript = "scripts/vehicles/TDMCars/f350.txt" } } list.Set("Vehicles", "f350tdm", V) local V = { Name = "Ford Focus SVT", Class = PrVeh, Category = Cat, Author = "TheDanishMaster, Turn 10", Information = "A drivable Ford Focus SVT by TheDanishMaster", Model = "models/tdmcars/for_focussvt.mdl", KeyValues = { vehiclescript = "scripts/vehicles/TDMCars/focussvt.txt" } } list.Set("Vehicles", "focussvttdm", V) local V = { Name = "Ford GT 05", Class = PrVeh, Category = Cat, Author = "TheDanishMaster, freemmaann, Turn 10", Information = "A drivable Ford GT 05 by TheDanishMaster", Model = "models/tdmcars/gt05.mdl", KeyValues = { vehiclescript = "scripts/vehicles/TDMCars/gt05.txt" } } list.Set("Vehicles", "gt05tdm", V) local V = { Name = "Ford Raptor SVT", Class = PrVeh, Category = Cat, Author = "TheDanishMaster, Turn 10", Information = "A drivable Ford Raptor SVT by TheDanishMaster", Model = "models/tdmcars/for_raptor.mdl", KeyValues = { vehiclescript = "scripts/vehicles/TDMCars/raptorsvt.txt" } } list.Set("Vehicles", "raptorsvttdm", V) local V = { Name = "Ford Transit", Class = PrVeh, Category = Cat, Author = "TheDanishMaster, freemmaann, Turn 10", Information = "A drivable Ford Transit by TheDanishMaster", Model = "models/tdmcars/ford_transit.mdl", KeyValues = { vehiclescript = "scripts/vehicles/TDMCars/transit.txt" } } list.Set("Vehicles", "transittdm", V) local V = { Name = "Ford Mustang GT", Class = PrVeh, Category = Cat, Author = "TheDanishMaster, Turn 10", Information = "A drivable Ford Mustang GT by TheDanishMaster", Model = "models/tdmcars/for_mustanggt.mdl", KeyValues = { vehiclescript = "scripts/vehicles/TDMCars/mustanggt.txt" } } list.Set("Vehicles", "mustanggttdm", V) local V = { Name = "Ford Shelby GT500", Class = PrVeh, Category = Cat, Author = "TheDanishMaster, Turn 10", Information = "A drivable Ford Shelby GT500 by TheDanishMaster", Model = "models/tdmcars/for_she_gt500.mdl", KeyValues = { vehiclescript = "scripts/vehicles/TDMCars/for_she_gt500.txt" } } list.Set("Vehicles", "for_she_gt500tdm", V)
--[[ Copyright 2018 The Nakama Authors 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. --]] --require("nakama").match_create("match", {debug = true}) local nk = require("nakama") --[[ Called when the matchmaker has found a match for some set of users. Context represents information about the match and server, for information purposes. Format: { env = {}, -- key-value data set in the runtime.env server configuration. execution_mode = "Matchmaker", } Matchmaker users will contain a table array of the users that have matched together and their properties. Format: { { presence: { user_id: "user unique ID", session_id: "session ID of the user's current connection", username: "user's unique username", node: "name of the Nakama node the user is connected to" }, properties: { foo: "any properties the client set when it started its matchmaking process", baz: 1.5 } }, ... } Expected to return an authoritative match ID for a match ready to receive these users, or `nil` if the match should proceed through the peer-to-peer relayed mode. --]] local function matchmaker_matched(context, matchmaker_users) if #matchmaker_users ~= 2 then return nil end if matchmaker_users[1].properties["mode"] ~= "authoritative" then return nil end if matchmaker_users[2].properties["mode"] ~= "authoritative" then return nil end return nk.match_create("match", {debug = true, expected_users = matchmaker_users}) end nk.register_matchmaker_matched(matchmaker_matched)
-- The field names used here are the same as for the iostat -- program. -- That program uses a 'struct io_stats' -- Here we simply use a lua table local function decoder(path) path = path or "/proc/diskstats" local tbl = {} -- If you were using 'C', this would be a 'scanf' template local pattern = "(%d+)%s+(%d+)%s+(%g+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)%s+(%d+)" -- The statistics are gathered for all devices, whether they are actual -- devices, partitions, or virtual devices. Something else can determine -- which of these are to be filtered out. for str in io.lines(path) do local major, minor, dev_name, rd_ios, rd_merges_or_rd_sec, rd_sec_or_wr_ios, rd_ticks_or_wr_sec, wr_ios, wr_merges, wr_sec, wr_ticks, ios_pgr, tot_ticks, rq_ticks = str:match(pattern) -- add entry to table tbl[dev_name] = { major = tonumber(major), minor = tonumber(minor), rd_ios = tonumber(rd_ios), rd_merges_or_rd_sec = tonumber(rd_merges_or_rd_sec), rd_sec_or_wr_ios = tonumber(rd_sec_or_wr_ios), rd_ticks_or_wr_sec = tonumber(rd_ticks_or_wr_sec), wr_ios = tonumber(wr_ios), wr_merges = tonumber(wr_merges), wr_sec = tonumber(wr_sec), wr_ticks = tonumber(wr_ticks), ios_pgr = tonumber(ios_pgr), tot_ticks = tonumber(tot_ticks), rq_ticks = tonumber(rq_ticks) } end return tbl; end return { decoder = decoder; }
function onStepIn(cid, item, frompos, item2, topos) if not isPlayer(cid) then return true end if getPlayerStorageValue(cid, 17000) >= 1 then return true end if getPlayerStorageValue(cid, 17001) >= 1 then return true end doRemoveCondition(cid, CONDITION_OUTFIT) setPlayerStorageValue(cid, 10, 0) end
require('possession').setup { commands = { save = 'SSave', load = 'SLoad', delete = 'SDelete', list = 'SList' } }
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB local S = E:GetModule('Skins') --Cache global variables --Lua functions local _G = _G --WoW API / Variables --Global variables that we don't cache, list them here for mikk's FindGlobals script -- GLOBALS: local function LoadSkin() if E.private.skins.blizzard.enable ~= true or E.private.skins.blizzard.petition ~= true then return end local PetitionFrame = _G["PetitionFrame"] PetitionFrame:StripTextures(true) PetitionFrame:SetTemplate("Transparent") PetitionFrameInset:Kill() S:HandleButton(PetitionFrameSignButton) S:HandleButton(PetitionFrameRequestButton) S:HandleButton(PetitionFrameRenameButton) S:HandleButton(PetitionFrameCancelButton) S:HandleCloseButton(PetitionFrameCloseButton) PetitionFrameCharterTitle:SetTextColor(1, 1, 0) PetitionFrameCharterName:SetTextColor(1, 1, 1) PetitionFrameMasterTitle:SetTextColor(1, 1, 0) PetitionFrameMasterName:SetTextColor(1, 1, 1) PetitionFrameMemberTitle:SetTextColor(1, 1, 0) for i=1, 9 do _G["PetitionFrameMemberName"..i]:SetTextColor(1, 1, 1) end PetitionFrameInstructions:SetTextColor(1, 1, 1) PetitionFrameRenameButton:Point("LEFT", PetitionFrameRequestButton, "RIGHT", 3, 0) PetitionFrameRenameButton:Point("RIGHT", PetitionFrameCancelButton, "LEFT", -3, 0) end S:AddCallback("Petition", LoadSkin)
-- sumneko_lua require("olrtg.lsp.lua") -- emmet_ls require("olrtg.lsp.emmet") -- tailwindcss require("olrtg.lsp.tailwindcss") -- bashls require("olrtg.lsp.bash") lvim.lsp.automatic_servers_installation = false local utils = require("olrtg.utils") local formatters = require("lvim.lsp.null-ls.formatters") local linters = require("lvim.lsp.null-ls.linters") local project_has_prettier_config = function() return (vim.fn.glob(".prettierrc*") ~= "" or utils.is_in_package_json("prettier")) end local project_has_eslint_config = function() return (vim.fn.glob(".eslintrc*") ~= "" or utils.is_in_package_json("eslint")) end -- Formatters local formatters_table = { { command = "stylua" }, { command = "gofumpt" }, { exe = "shfmt", filetypes = { "sh", "shell", "bash", "zsh", }, }, { exe = "markdownlint", filetype = { "markdown", }, }, } if project_has_prettier_config() == true then table.insert(formatters_table, { command = "prettier", extra_args = { "--no-semi", "--single-quote", "--trailing-comma=all", "--arrow-parens=avoid" }, filetypes = { "html", "javascript", "javascriptreact", "json", "markdown", "svelte", "typescript", "typescriptreact", "vue", "yaml", }, }) else table.insert(formatters_table, { command = "prettier", filetypes = { "html", "json", "markdown", "yaml", }, }) end if project_has_eslint_config() == true then table.insert(formatters_table, { command = "eslint_d" }) end if utils.project_has_tailwindcss_dependency() == true then table.insert(formatters_table, { command = "rustywind" }) end -- Linters local linters_table = { { command = "jsonlint" }, { command = "shellcheck", filetypes = { "sh", "shell", "bash", "zsh", }, }, { exe = "markdownlint", filetype = { "markdown", }, }, { exe = "write-good", filetype = { "markdown", }, }, { exe = "stylelint", filetypes = { "css", "scss", "sass", "less", }, }, } if project_has_eslint_config() == true then table.insert(linters_table, { command = "eslint_d" }) else table.insert(linters_table, { command = "tsc", filetypes = { "typescript" } }) end formatters.setup(formatters_table) linters.setup(linters_table) -- Disable formatting capability of tsserver and jsonls -- as we use prettier and/or eslint_d to format/fix lvim.lsp.on_attach_callback = function(client, _) if client.name ~= "tsserver" and client.name ~= "jsonls" then return end client.resolved_capabilities.document_formatting = false client.resolved_capabilities.document_range_formatting = false end
--[[ Description: CGene class represents a GNN cell (i.e. GNN layer) ]] CGene = torch.class('nn.CGene', 'nn.Module') function getGeneAndTFRanges(taGERanges, strGene, taInputNames) local taMins = { output = 0, inputs = torch.zeros(#taInputNames) } local taMaxs = { output = 1, inputs = torch.ones(#taInputNames) } if taGERanges ~= nil then taMins.output = taGERanges[strGene].min taMaxs.output = taGERanges[strGene].max for i=1, #taInputNames do taMins.inputs[i] = taGERanges[taInputNames[i]].min taMaxs.inputs[i] = taGERanges[taInputNames[i]].max end end return taMins, taMaxs end function CGene:__init(CModel, strGene, oDepGraph, taGERanges, oParamCache) self.strGene = strGene self.oDepGraph = oDepGraph self.nInput = oDepGraph:getnBefore(self.strGene) self.nOutput = self.nInput + 1 self.nNonTFId = self.nInput - oDepGraph.nTFs + 1 local taInputNames self.taInputIdx, taInputNames = self.oDepGraph:getDepIds(self.strGene) self.taMins, self.taMaxs = getGeneAndTFRanges(taGERanges, strGene, taInputNames) self.dBasal = 0 self.model = CModel.new(#self.taInputIdx, self.taMins, self.taMaxs, oParamCache) -- self.model = CLinear.new(#self.taInputIdx) -- using linear model for now -- self.model = CSyng.new(#self.taInputIdx, self.taMins, self.taMaxs, oParamCache) self.weight = self.model:getParamPointer() self.gradWeight = self.model:getGradParamPointer() self.taDebug = {strGene = self.strGene} end function CGene:pri_ensureOutput(input) self.output = {torch.cat(input[1], torch.zeros(input[1]:size(1), 1)), input[2]} end function CGene:pri_tmpTableToCsvString(taInput) local strR = "" for k, v in pairs(self.taInputIdx) do strR = strR .. "," .. v end return strR end function CGene:pri_getInputSlice(teInput) -- Create a slice including only the dependant input columns --io.write("TFs: " .. self:pri_tmpTableToCsvString(self.taInputIdx) .. "\n") local teInputSlice = torch.Tensor(teInput:size(1), #self.taInputIdx) for i, depId in pairs(self.taInputIdx) do teInputSlice:narrow(2, i, 1):copy(teInput:narrow(2, depId, 1)) end return teInputSlice end function CGene:pri_getKOSlice(teKO) -- return single slice with 1 where it's knockout and 0 elsewhere local teKOSlice = teKO:narrow(2, self.nNonTFId, 1) return teKOSlice:eq(torch.zeros(teKOSlice:size())) end function CGene:pri_updateInputDebugInfo(teInputSlice) self.taDebug.teInputMean = torch.mean(teInputSlice, 1):select(1, 1) end function CGene:pri_updateOutputSliceCalc(teInput, teOutputSlice) local teInputSlice = self:pri_getInputSlice(teInput) teOutputSlice:copy(self.model:predict(teInputSlice)) end function CGene:pri_updateOutputSliceKO(teKO, teOutputSlice) local teKOSlice = self:pri_getKOSlice(teKO) teOutputSlice:maskedFill(teKOSlice, self.dBasal) end function CGene:updateOutput(input) --[[ io.write("fw(" .. self.strGene .. ")") if self.strGene == "csgD" then print("just for debugging") end--]] self:pri_ensureOutput(input) local teOutputSlice = self.output[1]:narrow(2, self.output[1]:size(2), 1) self:pri_updateOutputSliceCalc(input[1], teOutputSlice) self:pri_updateOutputSliceKO(input[2], teOutputSlice) return self.output end function CGene:pri_updateGradInputSlice(gradInput, teLocalGradInputSlice) for i, depId in pairs(self.taInputIdx) do gradInput:narrow(2, depId, 1):copy(teLocalGradInputSlice:narrow(2, i, 1)) end end function CGene:pri_ensureGradInput(teInput) self.gradInput = self.gradInput or torch.Tensor() self.gradInput:resizeAs(teInput) end function CGene:updateGradInput(input, gradOutput) -- 1) create gradInput, with same size of input[1] self:pri_ensureGradInput(input[1]) -- 2) copy gradOutput into gradInput (except for this gene's output. ( TFs, don't care about TF's gradInput, can ignore them.) self.gradInput:copy(gradOutput:narrow(2, 1, gradOutput:size(2) - 1)) -- 3) Calculate gradInput given (a) gradOutput's last column (for this gene), (b) dependencies of this gene. -- Note; need to "add" calculated to existing values coming from gradOutput. local teInputSlice = self:pri_getInputSlice(input[1]) local teGradOutputSlice = gradOutput:narrow(2, self.gradInput:size(2), 1) local teLocalGradInputSlice = self.model:getGradInput(teInputSlice, teGradOutputSlice) self:pri_updateGradInputSlice(self.gradInput, teLocalGradInputSlice) return self.gradInput end function CGene:pri_getInputReal(taData) local nRows = taData.input[1]:size(1) local teR = torch.Tensor(nRows, #self.taInputIdx) for i, depId in pairs(self.taInputIdx) do if depId <= self.oDepGraph.nTFs then -- look for it in the input teR:narrow(2, i, 1):copy(taData.input[1]:narrow(2, depId, 1)) else -- look for it in the target local nTargetId = depId - self.oDepGraph.nTFs teR:narrow(2, i, 1):copy(taData.target:narrow(2, nTargetId, 1)) end end return teR end function CGene:pri_getTargetReal(teTarget) return teTarget:narrow(2, self.nNonTFId, 1):clone() end function CGene:pri_getMasked(teInput, teMask) --local nRowsMasked = teMask:select(2, 1):sum() local teIdx = teMask:nonzero() local teR = teInput:gather(1, teIdx:narrow(2, 1, 1):expand(teIdx:size(1), teInput:size(2))) return teR end function CGene:accGradParameters(input, gradOutput, scale) local teInputSlice = self:pri_getInputSlice(input[1]) local teGradOutputSlice = gradOutput:narrow(2, input[1]:size(2), 1) self.model:accGradParameters(teInputSlice, teGradOutputSlice, scale) end function CGene:pri_getBasal(teKOSlice, teInputReal) if teKOSlice:sum() == 0 then -- if no KO if no KO info, then will pick zero. return self.taMins.output else return torch.mean(teInputReal:maskedSelect(teKOSlice)) end end function CGene:initTrain(taData, isFast, isReplaceTargetAfter, outputPrev) local teInputReal = self:pri_getInputReal(taData) local teTargetReal = self:pri_getTargetReal(taData.target) local teKOSlice = self:pri_getKOSlice(taData.input[2]) self.dBasal = self:pri_getBasal(teKOSlice, teTargetReal) teInputReal = self:pri_getMasked(teInputReal, teKOSlice:ne(1)) teTargetReal = self:pri_getMasked(teTargetReal, teKOSlice:ne(1)) -- ToDo: crate new tensors for "non-KO" rows io.write("train " .. self.strGene .. ":") io.flush() self.taDebug.teP, self.taDebug.dTrainErr = self.model:train(teInputReal, teTargetReal, isFast) self:pri_updateInputDebugInfo(teInputReal) self.taDebug.teTargetMean = torch.mean(teTargetReal) io.write("\n") if isReplaceTargetAfter then local tePred = self:updateOutput(outputPrev)[1] local tePredSlice = tePred:narrow(2, tePred:size(2), 1) local teTargetSlice = taData.target:narrow(2, self.nNonTFId, 1) teTargetSlice:copy(tePredSlice) end end function CGene:getDebugInfo() return self.taDebug end
if GetLocale() ~= "frFR" then return end NO_SELL_PRICE_TEXT = "Pas de prix de vente"
local framework = require('framework') local CommandOutputDataSource = framework.CommandOutputDataSource local PollerCollection = framework.PollerCollection local DataSourcePoller = framework.DataSourcePoller local Plugin = framework.Plugin local os = require('os') local table = require('table') local string = require('string') local gsplit = framework.string.gsplit local isEmpty = framework.string.isEmpty local clone = framework.table.clone local params = framework.params params.name = 'Boundary Pingcheck plugin' params.version = '1.1' params.tags = "ping" local commands = { linux = { path = '/bin/ping', args = {'-n', '-w 2', '-c 1'} }, win32 = { path = 'C:/windows/system32/ping.exe', args = {'-n', '1', '-w', '3000'} }, darwin = { path = '/sbin/ping', args = {'-n', '-t 2', '-c 1'} } } local ping_command = commands[string.lower(os.type())] if ping_command == nil then print("_bevent:"..(Plugin.name or params.name)..":"..(Plugin.version or params.version)..":Your platform is not supported. We currently support Linux, Windows and OSX|t:error|tags:lua,plugin"..(Plugin.tags and framework.string.concat(Plugin.tags, ',') or params.tags)) process.exit(-1) end local function createPollers (params, cmd) local pollers = PollerCollection:new() for _, item in ipairs(params.items) do cmd = clone(cmd) table.insert(cmd.args, item.host) cmd.info = item.source local data_source = CommandOutputDataSource:new(cmd) local poll_interval = tonumber(item.pollInterval or params.pollInterval) * 1000 local poller = DataSourcePoller:new(poll_interval, data_source) pollers:add(poller) end return pollers end local function parseOutput(context, output) assert(output ~= nil, 'parseOutput expect some data') if isEmpty(output) then context:emit('error', 'Unable to obtain any output.') return -1 elseif string.find(output, "unknown host") or string.find(output, "could not find host.") then context:emit('error', 'The host ' .. context.args[#context.args] .. ' was not found.') return -1 end for line in gsplit(output, '\n') do local time = string.match(line, "time=([0-9]*%.?[0-9]+)") if time then return tonumber(time) end end return -1 end local pollers = createPollers(params, ping_command) local plugin = Plugin:new(params, pollers) function plugin:onParseValues(data) local result = {} local value = parseOutput(self, data['output']) result['PING_RESPONSETIME'] = { value = value, source = data['info'] } return result end plugin:run()
-- Copyright (c) 2015-present, Facebook, Inc. -- All rights reserved. -- -- This source code is licensed under the BSD-style license found in the -- LICENSE file in the root directory of this source tree. An additional grant -- of patent rights can be found in the PATENTS file in the same directory. local stringx = require('pl.stringx') local tds = require('tds') local cmd = torch.CmdLine() -- parameters for memory nets cmd:option("-batch_size",32,"batch size") cmd:option("-token_size",0,"number of tokens") cmd:option("-init_weight",0.01, "initialization weight") cmd:option("-N_hop",3,"number of MemmNet hops") cmd:option("-nepochs",20, "number of epochs") cmd:option("-thres",40,"threshold for gradient clipping") cmd:option("-negative",5,"number of negative samples"); cmd:option("-gpu_index",1,"the index of GPU to use") cmd:option("-dataset","movieQA","the dataset to use, whether" .."it is babi or movieQA") cmd:option("-setting","RBI","the model setting") cmd:option("-task",3,"task 2,3,4,6") -- parameters for movie dataset cmd:option("-randomness",0.2,"-random exploration rate") cmd:option("-simulator_batch_size",32,"simulator batch size") cmd:option("-REINFORCE",false, "whether to enable REINFORCE for training") cmd:option("-REINFORCE_reg", 0.1, "entropy regularizer for the REINFORCE algorithm") cmd:option("-RF_lr", 0.0005, "lr used by REINFORCE baseline (multiplied by lr)") cmd:option("-log_freq", 200, "how often we log") cmd:option("-balance",false,"enable label balancing for FP") local babi_name_match={} local Tasks={ "rl1_pure_imitation", "rl2_pos_neg", "rl3_with_ans", "rl4_with_hints", "rl5_told_sf", "rl6_only_some_rewards", "rl7_no_feedback", "rl8_imitation_plus_rl", "rl9_ask_for_answer", "rl10_ask_for_sf", } local params= cmd:parse(arg) params.tasks=tds.hash() if params.setting=="RBI+FP" then params.policyGrad=true; params.FP=true; elseif params.setting=="RBI" then params.policyGrad=true; params.FP=false; elseif params.setting=="FP"then params.FP=true; params.policyGrad=false params.N_hop=1 elseif params.setting=="IM" then params.policyGrad=false; params.FP=false end if params.dataset=="movieQA" then params.dic_file="./data/movieQA.dict" params.trainData="./data/movieQA_"..Tasks[params.task].."_train.txt" params.devData="./data/movieQA_"..Tasks[params.task].."_dev.txt" params.testData="./data/movieQA_"..Tasks[params.task].."_test.txt" params.IncorrectResponse="./data/movieQA_"..Tasks[params.task].."_incorrect_feedback" params.dimension=50; if params.setting=="RBI" then params.lr=0.2; else params.lr=0.05 end else params.dic_file="./data/babi.dict" params.trainData="./data/babi1_"..Tasks[params.task].."_train.txt" params.devData="./data/babi1_"..Tasks[params.task].."_dev.txt" params.testData="./data/babi1_"..Tasks[params.task].."_test.txt" params.IncorrectResponse="./data/babi1_"..Tasks[params.task].."_incorrect_feedback" params.dimension=20; params.lr=0.01 end return params
setenv("TACC_PETSC_VERSION","3.3")
require("__5dim_core__.lib.nuclear.generation-heat-exchanger") local speed = 2 local modules = 2 local energy = 10 local emisions = 1000 local techCount = 500 -- Electric furnace 01 genHeatExchangers { number = "01", subgroup = "nuclear-heat", craftingSpeed = speed, moduleSlots = modules, energyUsage = energy, new = false, order = "a", ingredients = { {"steel-plate", 10}, {"copper-plate", 100}, {"pipe", 10} }, pollution = emisions, nextUpdate = "5d-heat-exchanger-02", tech = nil } speed = speed + 1 modules = modules + 1 energy = energy + 5 emisions = emisions + 15 -- Electric furnace 02 genHeatExchangers { number = "02", subgroup = "nuclear-heat", craftingSpeed = speed, moduleSlots = modules, energyUsage = energy, new = true, order = "b", ingredients = { {"heat-exchanger", 1}, {"steel-plate", 10}, {"copper-plate", 100}, {"pipe", 10} }, pollution = emisions, nextUpdate = "5d-heat-exchanger-03", tech = { number = 1, count = techCount * 1, packs = { {"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}, {"production-science-pack", 1}, {"utility-science-pack", 1} }, prerequisites = { "nuclear-power", "utility-science-pack" } } } speed = speed + 1 energy = energy + 5 emisions = emisions + 15 -- Electric furnace 03 genHeatExchangers { number = "03", subgroup = "nuclear-heat", craftingSpeed = speed, moduleSlots = modules + 1, energyUsage = energy, new = true, order = "c", ingredients = { {"5d-heat-exchanger-02", 1}, {"steel-plate", 10}, {"copper-plate", 100}, {"pipe", 20} }, pollution = emisions, nextUpdate = "5d-heat-exchanger-04", tech = { number = 2, count = techCount * 2, packs = { {"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}, {"production-science-pack", 1}, {"utility-science-pack", 1} }, prerequisites = { "5d-nuclear-reactor-1", "5d-steam-turbine-1", "5d-heat-pipe-1", "5d-heat-exchanger-1" } } } speed = speed + 1 modules = modules + 1 energy = energy + 5 emisions = emisions + 15 -- Electric furnace 04 genHeatExchangers { number = "04", subgroup = "nuclear-heat", craftingSpeed = speed, moduleSlots = modules, energyUsage = energy, new = true, order = "d", ingredients = { {"5d-heat-exchanger-03", 1}, {"steel-plate", 10}, {"copper-plate", 100}, {"pipe", 10}, {"low-density-structure", 1} }, pollution = emisions, nextUpdate = "5d-heat-exchanger-05", tech = { number = 3, count = techCount * 3, packs = { {"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}, {"production-science-pack", 1}, {"utility-science-pack", 1}, {"space-science-pack", 1} }, prerequisites = { "5d-nuclear-reactor-2", "5d-steam-turbine-2", "5d-heat-pipe-2", "5d-heat-exchanger-2", "space-science-pack" } } } speed = speed + 1 energy = energy + 5 emisions = emisions + 15 -- Electric furnace 05 genHeatExchangers { number = "05", subgroup = "nuclear-heat", craftingSpeed = speed, moduleSlots = modules + 1, energyUsage = energy, new = true, order = "e", ingredients = { {"5d-heat-exchanger-04", 1}, {"steel-plate", 10}, {"copper-plate", 100}, {"pipe", 10}, {"low-density-structure", 1}, {"effectivity-module", 1} }, pollution = emisions, nextUpdate = "5d-heat-exchanger-06", tech = { number = 4, count = techCount * 4, packs = { {"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}, {"production-science-pack", 1}, {"utility-science-pack", 1}, {"space-science-pack", 1} }, prerequisites = { "5d-nuclear-reactor-3", "5d-steam-turbine-3", "5d-heat-pipe-3", "5d-heat-exchanger-3" } } } speed = speed + 1 modules = modules + 1 energy = energy + 5 emisions = emisions + 15 -- Electric furnace 06 genHeatExchangers { number = "06", subgroup = "nuclear-heat", craftingSpeed = speed, moduleSlots = modules, energyUsage = energy, new = true, order = "f", ingredients = { {"5d-heat-exchanger-05", 1}, {"steel-plate", 10}, {"copper-plate", 100}, {"pipe", 10}, {"low-density-structure", 1}, {"effectivity-module", 1} }, pollution = emisions, nextUpdate = "5d-heat-exchanger-07", tech = { number = 5, count = techCount * 5, packs = { {"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}, {"production-science-pack", 1}, {"utility-science-pack", 1}, {"space-science-pack", 1} }, prerequisites = { "5d-nuclear-reactor-4", "5d-steam-turbine-4", "5d-heat-pipe-4", "5d-heat-exchanger-4" } } } speed = speed + 1 energy = energy + 5 emisions = emisions + 15 -- Electric furnace 07 genHeatExchangers { number = "07", subgroup = "nuclear-heat", craftingSpeed = speed, moduleSlots = modules + 1, energyUsage = energy, new = true, order = "g", ingredients = { {"5d-heat-exchanger-06", 1}, {"steel-plate", 10}, {"copper-plate", 100}, {"pipe", 10}, {"low-density-structure", 1}, {"effectivity-module-2", 1} }, pollution = emisions, nextUpdate = "5d-heat-exchanger-08", tech = { number = 6, count = techCount * 6, packs = { {"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}, {"production-science-pack", 1}, {"utility-science-pack", 1}, {"space-science-pack", 1} }, prerequisites = { "5d-nuclear-reactor-5", "5d-steam-turbine-5", "5d-heat-pipe-5", "5d-heat-exchanger-5" } } } speed = speed + 1 modules = modules + 1 energy = energy + 5 emisions = emisions + 15 -- Electric furnace 08 genHeatExchangers { number = "08", subgroup = "nuclear-heat", craftingSpeed = speed, moduleSlots = modules, energyUsage = energy, new = true, order = "h", ingredients = { {"5d-heat-exchanger-07", 1}, {"steel-plate", 10}, {"copper-plate", 100}, {"pipe", 10}, {"low-density-structure", 1}, {"effectivity-module-2", 1} }, pollution = emisions, nextUpdate = "5d-heat-exchanger-09", tech = { number = 7, count = techCount * 7, packs = { {"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}, {"production-science-pack", 1}, {"utility-science-pack", 1}, {"space-science-pack", 1} }, prerequisites = { "5d-nuclear-reactor-6", "5d-steam-turbine-6", "5d-heat-pipe-6", "5d-heat-exchanger-6" } } } speed = speed + 1 energy = energy + 5 emisions = emisions + 15 -- Electric furnace 09 genHeatExchangers { number = "09", subgroup = "nuclear-heat", craftingSpeed = speed, moduleSlots = modules + 1, energyUsage = energy, new = true, order = "i", ingredients = { {"5d-heat-exchanger-08", 1}, {"steel-plate", 10}, {"copper-plate", 100}, {"pipe", 10}, {"low-density-structure", 1}, {"effectivity-module-3", 1} }, pollution = emisions, nextUpdate = "5d-heat-exchanger-10", tech = { number = 8, count = techCount * 8, packs = { {"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}, {"production-science-pack", 1}, {"utility-science-pack", 1}, {"space-science-pack", 1} }, prerequisites = { "5d-nuclear-reactor-7", "5d-steam-turbine-7", "5d-heat-pipe-7", "5d-heat-exchanger-7" } } } speed = speed + 1 modules = modules + 1 energy = energy + 5 emisions = emisions + 15 -- Electric furnace 10 genHeatExchangers { number = "10", subgroup = "nuclear-heat", craftingSpeed = speed, moduleSlots = modules + 1, energyUsage = energy, new = true, order = "j", ingredients = { {"5d-heat-exchanger-09", 1}, {"steel-plate", 10}, {"copper-plate", 100}, {"pipe", 10}, {"low-density-structure", 1}, {"effectivity-module-3", 1} }, pollution = emisions, tech = { number = 9, count = techCount * 9, packs = { {"automation-science-pack", 1}, {"logistic-science-pack", 1}, {"chemical-science-pack", 1}, {"production-science-pack", 1}, {"utility-science-pack", 1}, {"space-science-pack", 1} }, prerequisites = { "5d-nuclear-reactor-8", "5d-steam-turbine-8", "5d-heat-pipe-8", "5d-heat-exchanger-8" } } }
require('os') local lfs = require('lfs') local helpers = require('test.functional.helpers') local eval = helpers.eval local command = helpers.command local eq, neq = helpers.eq, helpers.neq local tempfile = os.tmpname() -- os.tmpname() also creates the file on POSIX systems. Remove it again. -- We just need the name, ignoring any race conditions. if lfs.attributes(tempfile, 'uid') then os.remove(tempfile) end local function assert_file_exists(filepath) -- Use 2-argument lfs.attributes() so no extra table gets created. -- We don't really care for the uid. neq(nil, lfs.attributes(filepath, 'uid')) end local function assert_file_exists_not(filepath) eq(nil, lfs.attributes(filepath, 'uid')) end describe(':profile', function() before_each(helpers.clear) after_each(function() if lfs.attributes(tempfile, 'uid') ~= nil then os.remove(tempfile) end end) it('dump', function() eq(0, eval('v:profiling')) command('profile start ' .. tempfile) eq(1, eval('v:profiling')) assert_file_exists_not(tempfile) command('profile dump') assert_file_exists(tempfile) end) it('stop', function() command('profile start ' .. tempfile) assert_file_exists_not(tempfile) command('profile stop') assert_file_exists(tempfile) eq(0, eval('v:profiling')) end) end)
local race = { { _id = "kobold", is_extra = true, _ordering = 20010, elona_id = 1, properties = { breed_power = 250, image = "elona.chara_kobold", }, male_ratio = 50, height = 150, age_min = 15, age_max = 44, skills = { ["elona.stat_life"] = 90, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 8, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 5, ["elona.stat_perception"] = 3, ["elona.stat_learning"] = 2, ["elona.stat_will"] = 2, ["elona.stat_magic"] = 4, ["elona.stat_charisma"] = 2, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.pickpocket"] = 3, ["elona.stealth"] = 2, ["elona.magic_device"] = 3, }, body_parts = { "elona.head", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "orc", is_extra = true, _ordering = 20020, elona_id = 2, properties = { breed_power = 300, image = "elona.chara_orc", }, male_ratio = 51, height = 150, age_min = 15, age_max = 44, skills = { ["elona.stat_life"] = 130, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 5, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 3, ["elona.stat_perception"] = 2, ["elona.stat_learning"] = 2, ["elona.stat_will"] = 3, ["elona.stat_magic"] = 4, ["elona.stat_charisma"] = 2, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 1, ["elona.healing"] = 3, ["elona.heavy_armor"] = 3, ["elona.shield"] = 3, }, body_parts = { "elona.head", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "troll", is_extra = true, _ordering = 20030, elona_id = 3, properties = { breed_power = 250, image = "elona.chara_troll", pv_correction = 150, }, male_ratio = 51, height = 400, age_min = 15, age_max = 44, skills = { ["elona.stat_life"] = 90, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 10, ["elona.stat_constitution"] = 9, ["elona.stat_dexterity"] = 1, ["elona.stat_perception"] = 2, ["elona.stat_learning"] = 2, ["elona.stat_will"] = 2, ["elona.stat_magic"] = 3, ["elona.stat_charisma"] = 3, ["elona.stat_speed"] = 60, ["elona.martial_arts"] = 3, ["elona.healing"] = 40, }, body_parts = { "elona.head", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.arm", "elona.waist" }, }, { _id = "lizardman", is_extra = true, _ordering = 20040, elona_id = 4, properties = { breed_power = 300, image = "elona.chara_lizardman", dv_correction = 120, }, male_ratio = 51, height = 240, age_min = 15, age_max = 44, skills = { ["elona.stat_life"] = 120, ["elona.stat_mana"] = 70, ["elona.stat_strength"] = 7, ["elona.stat_constitution"] = 5, ["elona.stat_dexterity"] = 6, ["elona.stat_perception"] = 7, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 4, ["elona.stat_magic"] = 5, ["elona.stat_charisma"] = 3, ["elona.stat_speed"] = 80, ["elona.martial_arts"] = 2, ["elona.polearm"] = 3, ["elona.shield"] = 3, ["elona.evasion"] = 2, }, body_parts = { "elona.head", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "minotaur", is_extra = true, _ordering = 20050, elona_id = 5, properties = { breed_power = 300, image = "elona.chara_minotaur", }, male_ratio = 51, height = 350, age_min = 15, age_max = 44, skills = { ["elona.stat_life"] = 160, ["elona.stat_mana"] = 60, ["elona.stat_strength"] = 12, ["elona.stat_constitution"] = 8, ["elona.stat_dexterity"] = 3, ["elona.stat_perception"] = 4, ["elona.stat_learning"] = 3, ["elona.stat_will"] = 4, ["elona.stat_magic"] = 7, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 65, ["elona.martial_arts"] = 3, ["elona.tactics"] = 4, ["elona.eye_of_mind"] = 3, }, body_parts = { "elona.head", "elona.body", "elona.hand", "elona.hand", "elona.ring", "elona.waist", "elona.leg" }, }, { _id = "yerles", is_extra = false, _ordering = 10010, elona_id = 6, properties = { breed_power = 220, male_image = "elona.chara_human_male", female_image = "elona.chara_human_female", }, traits = { ["elona.perm_skill_point"] = 1, }, male_ratio = 52, height = 165, age_min = 15, age_max = 34, skills = { ["elona.stat_life"] = 110, ["elona.stat_mana"] = 90, ["elona.stat_strength"] = 7, ["elona.stat_constitution"] = 8, ["elona.stat_dexterity"] = 8, ["elona.stat_perception"] = 8, ["elona.stat_learning"] = 12, ["elona.stat_will"] = 8, ["elona.stat_magic"] = 8, ["elona.stat_charisma"] = 7, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.firearm"] = 5, ["elona.literacy"] = 3, ["elona.negotiation"] = 2, ["elona.throwing"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "norland", is_extra = true, _ordering = 20060, elona_id = 7, properties = { breed_power = 220, male_image = "elona.chara_human_male", female_image = "elona.chara_human_female", }, male_ratio = 52, height = 170, age_min = 15, age_max = 34, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 90, ["elona.stat_strength"] = 8, ["elona.stat_constitution"] = 8, ["elona.stat_dexterity"] = 6, ["elona.stat_perception"] = 6, ["elona.stat_learning"] = 7, ["elona.stat_will"] = 9, ["elona.stat_magic"] = 7, ["elona.stat_charisma"] = 6, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.casting"] = 3, ["elona.tactics"] = 3, ["elona.two_hand"] = 3, ["elona.control_magic"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "eulderna", is_extra = false, _ordering = 10020, elona_id = 8, properties = { breed_power = 180, male_image = "elona.chara_eulderna_male", female_image = "elona.chara_eulderna_female", }, male_ratio = 52, height = 175, age_min = 16, age_max = 35, traits = { ["elona.perm_magic"] = 1, }, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 100, ["elona.stat_strength"] = 6, ["elona.stat_constitution"] = 7, ["elona.stat_dexterity"] = 7, ["elona.stat_perception"] = 10, ["elona.stat_learning"] = 8, ["elona.stat_will"] = 10, ["elona.stat_magic"] = 12, ["elona.stat_charisma"] = 8, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.casting"] = 5, ["elona.literacy"] = 3, ["elona.magic_device"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "fairy", is_extra = false, _ordering = 10030, elona_id = 9, properties = { breed_power = 180, image = "elona.chara_fairy", dv_correction = 250, }, male_ratio = 52, height = 50, age_min = 5, age_max = 104, traits = { ["elona.perm_resist"] = 1, ["elona.perm_weak"] = 1, }, skills = { ["elona.stat_life"] = 40, ["elona.stat_mana"] = 130, ["elona.stat_strength"] = 3, ["elona.stat_constitution"] = 4, ["elona.stat_dexterity"] = 9, ["elona.stat_perception"] = 10, ["elona.stat_learning"] = 8, ["elona.stat_will"] = 8, ["elona.stat_magic"] = 13, ["elona.stat_charisma"] = 12, ["elona.stat_speed"] = 120, ["elona.martial_arts"] = 1, ["elona.casting"] = 5, ["elona.pickpocket"] = 3, ["elona.light_armor"] = 3, }, resistances = { ["elona.magic"] = 200, ["elona.darkness"] = 200, ["elona.nerve"] = 200, ["elona.nether"] = 200, ["elona.mind"] = 200, ["elona.sound"] = 200, ["elona.chaos"] = 200, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "asura", is_extra = true, _ordering = 20070, elona_id = 10, properties = { breed_power = 100, image = "elona.chara_asura", dv_correction = 200, }, male_ratio = 52, height = 220, age_min = 15, age_max = 34, skills = { ["elona.stat_life"] = 90, ["elona.stat_mana"] = 70, ["elona.stat_strength"] = 11, ["elona.stat_constitution"] = 9, ["elona.stat_dexterity"] = 14, ["elona.stat_perception"] = 6, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 4, ["elona.stat_magic"] = 5, ["elona.stat_charisma"] = 5, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.dual_wield"] = 30, ["elona.greater_evasion"] = 6, ["elona.anatomy"] = 4, }, body_parts = { "elona.hand", "elona.hand", "elona.hand", "elona.hand", "elona.neck" }, }, { _id = "slime", is_extra = true, _ordering = 20080, elona_id = 11, properties = { breed_power = 700, image = "elona.chara_race_slime", cast_style = "spill", tone = "elona.slime" }, male_ratio = 54, height = 40, age_min = 1, age_max = 10, skills = { ["elona.stat_life"] = 80, ["elona.stat_mana"] = 100, ["elona.stat_strength"] = 4, ["elona.stat_constitution"] = 5, ["elona.stat_dexterity"] = 7, ["elona.stat_perception"] = 5, ["elona.stat_learning"] = 6, ["elona.stat_will"] = 8, ["elona.stat_magic"] = 4, ["elona.stat_charisma"] = 13, ["elona.stat_speed"] = 55, ["elona.martial_arts"] = 2, ["elona.evasion"] = 2, ["elona.performer"] = 3, }, body_parts = { "elona.head" }, }, { _id = "wolf", is_extra = true, _ordering = 20090, elona_id = 12, properties = { breed_power = 800, image = "elona.chara_wolf", dv_correction = 140, }, male_ratio = 55, height = 100, age_min = 2, age_max = 11, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 8, ["elona.stat_constitution"] = 8, ["elona.stat_dexterity"] = 6, ["elona.stat_perception"] = 11, ["elona.stat_learning"] = 7, ["elona.stat_will"] = 8, ["elona.stat_magic"] = 4, ["elona.stat_charisma"] = 6, ["elona.stat_speed"] = 80, ["elona.martial_arts"] = 2, ["elona.evasion"] = 2, ["elona.greater_evasion"] = 2, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.arm", "elona.leg" }, }, { _id = "dwarf", is_extra = false, _ordering = 10040, elona_id = 13, properties = { breed_power = 150, image = "elona.chara_dwarf", }, male_ratio = 56, height = 100, age_min = 20, age_max = 79, traits = { ["elona.perm_poison"] = 2, ["elona.perm_darkness"] = 1, }, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 100, ["elona.stat_strength"] = 10, ["elona.stat_constitution"] = 11, ["elona.stat_dexterity"] = 8, ["elona.stat_perception"] = 6, ["elona.stat_learning"] = 6, ["elona.stat_will"] = 7, ["elona.stat_magic"] = 6, ["elona.stat_charisma"] = 6, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.cooking"] = 4, ["elona.jeweler"] = 3, ["elona.mining"] = 4, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "juere", is_extra = false, _ordering = 10050, elona_id = 14, properties = { breed_power = 210, male_image = "elona.chara_juere_male", female_image = "elona.chara_juere_female", }, male_ratio = 50, height = 165, age_min = 15, age_max = 44, traits = { ["elona.perm_slow_food"] = 1, ["elona.perm_material"] = 1, }, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 100, ["elona.stat_strength"] = 7, ["elona.stat_constitution"] = 8, ["elona.stat_dexterity"] = 12, ["elona.stat_perception"] = 10, ["elona.stat_learning"] = 10, ["elona.stat_will"] = 8, ["elona.stat_magic"] = 8, ["elona.stat_charisma"] = 11, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.performer"] = 4, ["elona.lock_picking"] = 2, ["elona.negotiation"] = 2, ["elona.throwing"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "zombie", is_extra = true, _ordering = 20100, elona_id = 15, properties = { breed_power = 100, image = "elona.chara_zombie", }, male_ratio = 50, height = 160, age_min = 10, age_max = 209, skills = { ["elona.stat_life"] = 120, ["elona.stat_mana"] = 100, ["elona.stat_strength"] = 10, ["elona.stat_constitution"] = 8, ["elona.stat_dexterity"] = 2, ["elona.stat_perception"] = 2, ["elona.stat_learning"] = 1, ["elona.stat_will"] = 6, ["elona.stat_magic"] = 6, ["elona.stat_charisma"] = 2, ["elona.stat_speed"] = 45, ["elona.martial_arts"] = 3, ["elona.cooking"] = 3, ["elona.fishing"] = 3, }, resistances = { ["elona.darkness"] = 500, ["elona.nerve"] = 500, ["elona.nether"] = 500, ["elona.fire"] = 80, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.ring", "elona.arm", "elona.waist" }, }, { _id = "elea", is_extra = false, _ordering = 10060, elona_id = 16, properties = { breed_power = 120, male_image = "elona.chara_eulderna_male", female_image = "elona.chara_eulderna_female", }, male_ratio = 53, height = 180, age_min = 10, age_max = 209, traits = { ["elona.perm_res_ether"] = 1, ["elona.perm_capacity"] = 1, }, skills = { ["elona.stat_life"] = 90, ["elona.stat_mana"] = 110, ["elona.stat_strength"] = 6, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 8, ["elona.stat_perception"] = 8, ["elona.stat_learning"] = 8, ["elona.stat_will"] = 12, ["elona.stat_magic"] = 13, ["elona.stat_charisma"] = 10, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.magic_capacity"] = 5, ["elona.casting"] = 2, ["elona.memorization"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "rabbit", is_extra = true, _ordering = 20110, elona_id = 17, properties = { breed_power = 800, image = "elona.chara_rabbit", }, male_ratio = 53, height = 40, age_min = 2, age_max = 6, skills = { ["elona.stat_life"] = 90, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 5, ["elona.stat_constitution"] = 4, ["elona.stat_dexterity"] = 6, ["elona.stat_perception"] = 11, ["elona.stat_learning"] = 5, ["elona.stat_will"] = 4, ["elona.stat_magic"] = 4, ["elona.stat_charisma"] = 10, ["elona.stat_speed"] = 100, ["elona.martial_arts"] = 1, ["elona.riding"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.arm" }, }, { _id = "sheep", is_extra = true, _ordering = 20120, elona_id = 18, properties = { breed_power = 1000, image = "elona.chara_sheep", }, male_ratio = 53, height = 150, age_min = 2, age_max = 6, skills = { ["elona.stat_life"] = 130, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 6, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 5, ["elona.stat_perception"] = 6, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 5, ["elona.stat_magic"] = 4, ["elona.stat_charisma"] = 8, ["elona.stat_speed"] = 60, ["elona.martial_arts"] = 1, ["elona.healing"] = 3, ["elona.anatomy"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.arm", "elona.leg" }, }, { _id = "frog", is_extra = true, _ordering = 20130, elona_id = 19, properties = { breed_power = 600, image = "elona.chara_frog", }, male_ratio = 53, height = 10, age_min = 2, age_max = 6, skills = { ["elona.stat_life"] = 80, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 6, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 6, ["elona.stat_perception"] = 8, ["elona.stat_learning"] = 5, ["elona.stat_will"] = 5, ["elona.stat_magic"] = 5, ["elona.stat_charisma"] = 6, ["elona.stat_speed"] = 60, ["elona.martial_arts"] = 1, ["elona.performer"] = 3, ["elona.investing"] = 2, }, body_parts = { "elona.body" }, }, { _id = "centipede", is_extra = true, _ordering = 20140, elona_id = 20, properties = { breed_power = 400, image = "elona.chara_centipede", }, male_ratio = 53, height = 10, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 90, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 6, ["elona.stat_constitution"] = 5, ["elona.stat_dexterity"] = 5, ["elona.stat_perception"] = 6, ["elona.stat_learning"] = 3, ["elona.stat_will"] = 2, ["elona.stat_magic"] = 2, ["elona.stat_charisma"] = 2, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 1, ["elona.eye_of_mind"] = 3, }, body_parts = { "elona.back", "elona.ring", "elona.ring" }, }, { _id = "snail", is_extra = false, _ordering = 10070, elona_id = 21, properties = { breed_power = 500, image = "elona.chara_snail", }, male_ratio = 53, height = 8, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 4, ["elona.stat_constitution"] = 5, ["elona.stat_dexterity"] = 3, ["elona.stat_perception"] = 6, ["elona.stat_learning"] = 3, ["elona.stat_will"] = 4, ["elona.stat_magic"] = 2, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 25, ["elona.martial_arts"] = 1, ["elona.throwing"] = 5, }, body_parts = { "elona.back" }, }, { _id = "mandrake", is_extra = true, _ordering = 20150, elona_id = 22, properties = { breed_power = 80, image = "elona.chara_mandrake", }, male_ratio = 53, height = 25, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 70, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 5, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 5, ["elona.stat_perception"] = 10, ["elona.stat_learning"] = 8, ["elona.stat_will"] = 8, ["elona.stat_magic"] = 10, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 60, ["elona.martial_arts"] = 2, ["elona.memorization"] = 3, ["elona.literacy"] = 2, ["elona.magic_capacity"] = 3, }, body_parts = { "elona.head", "elona.back" }, }, { _id = "beetle", is_extra = true, _ordering = 20160, elona_id = 23, properties = { breed_power = 750, image = "elona.chara_beetle", pv_correction = 140, }, male_ratio = 53, height = 10, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 80, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 5, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 5, ["elona.stat_perception"] = 7, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 5, ["elona.stat_magic"] = 4, ["elona.stat_charisma"] = 3, ["elona.stat_speed"] = 75, ["elona.martial_arts"] = 2, ["elona.detection"] = 3, ["elona.stealth"] = 3, }, body_parts = { "elona.neck" }, }, { _id = "mushroom", is_extra = true, _ordering = 20170, elona_id = 24, properties = { breed_power = 440, image = "elona.chara_mushroom", melee_style = "elona.spore", cast_style = "spore", }, male_ratio = 53, height = 20, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 50, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 5, ["elona.stat_constitution"] = 7, ["elona.stat_dexterity"] = 4, ["elona.stat_perception"] = 8, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 8, ["elona.stat_magic"] = 10, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 60, ["elona.martial_arts"] = 1, ["elona.tailoring"] = 3, ["elona.alchemy"] = 2, }, body_parts = { "elona.head", "elona.neck" }, }, { _id = "bat", is_extra = true, _ordering = 20180, elona_id = 25, properties = { breed_power = 350, image = "elona.chara_bat", melee_style = "elona.bite", dv_correction = 320, }, male_ratio = 53, height = 70, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 10, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 3, ["elona.stat_constitution"] = 5, ["elona.stat_dexterity"] = 9, ["elona.stat_perception"] = 9, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 3, ["elona.stat_magic"] = 6, ["elona.stat_charisma"] = 2, ["elona.stat_speed"] = 140, ["elona.martial_arts"] = 2, ["elona.greater_evasion"] = 3, }, body_parts = { "elona.head" }, }, { _id = "ent", is_extra = true, _ordering = 20190, elona_id = 26, properties = { breed_power = 35, image = "elona.chara_ent", }, male_ratio = 53, height = 1500, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 170, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 9, ["elona.stat_constitution"] = 12, ["elona.stat_dexterity"] = 4, ["elona.stat_perception"] = 6, ["elona.stat_learning"] = 2, ["elona.stat_will"] = 3, ["elona.stat_magic"] = 6, ["elona.stat_charisma"] = 2, ["elona.stat_speed"] = 50, ["elona.martial_arts"] = 3, ["elona.healing"] = 2, ["elona.carpentry"] = 4, }, body_parts = { "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.leg" }, }, { _id = "lich", is_extra = false, _ordering = 10080, elona_id = 27, properties = { breed_power = 25, image = "elona.chara_lich", dv_correction = 190, pv_correction = 150, }, male_ratio = 53, height = 180, age_min = 10, age_max = 19, traits = { ["elona.perm_cold"] = 1, ["elona.perm_darkness"] = 2, ["elona.perm_poison"] = 1 }, skills = { ["elona.stat_life"] = 80, ["elona.stat_mana"] = 140, ["elona.stat_strength"] = 5, ["elona.stat_constitution"] = 8, ["elona.stat_dexterity"] = 7, ["elona.stat_perception"] = 10, ["elona.stat_learning"] = 10, ["elona.stat_will"] = 13, ["elona.stat_magic"] = 15, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 3, ["elona.meditation"] = 5, ["elona.magic_device"] = 3, ["elona.casting"] = 3, }, resistances = { ["elona.darkness"] = 500, ["elona.nerve"] = 500, ["elona.nether"] = 500, ["elona.fire"] = 80, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "hound", is_extra = true, _ordering = 20200, elona_id = 28, properties = { breed_power = 540, image = "elona.chara_hound", melee_style = "elona.bite", dv_correction = 120, }, male_ratio = 53, height = 160, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 8, ["elona.stat_constitution"] = 9, ["elona.stat_dexterity"] = 11, ["elona.stat_perception"] = 10, ["elona.stat_learning"] = 5, ["elona.stat_will"] = 4, ["elona.stat_magic"] = 3, ["elona.stat_charisma"] = 3, ["elona.stat_speed"] = 90, ["elona.martial_arts"] = 2, ["elona.detection"] = 4, ["elona.performer"] = 2, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.leg" }, }, { _id = "ghost", is_extra = true, _ordering = 20210, elona_id = 29, properties = { breed_power = 30, image = "elona.chara_ghost", melee_style = "elona.touch", dv_correction = 160, }, male_ratio = 53, height = 180, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 60, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 4, ["elona.stat_constitution"] = 8, ["elona.stat_dexterity"] = 6, ["elona.stat_perception"] = 14, ["elona.stat_learning"] = 7, ["elona.stat_will"] = 6, ["elona.stat_magic"] = 11, ["elona.stat_charisma"] = 11, ["elona.stat_speed"] = 60, ["elona.martial_arts"] = 2, ["elona.magic_capacity"] = 4, ["elona.magic_device"] = 2, }, resistances = { ["elona.darkness"] = 500, ["elona.nerve"] = 500, ["elona.nether"] = 500, ["elona.fire"] = 80, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring" }, }, { _id = "spirit", is_extra = true, _ordering = 20220, elona_id = 30, properties = { breed_power = 25, image = "elona.chara_spirit", }, male_ratio = 53, height = 100, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 5, ["elona.stat_constitution"] = 9, ["elona.stat_dexterity"] = 5, ["elona.stat_perception"] = 7, ["elona.stat_learning"] = 8, ["elona.stat_will"] = 10, ["elona.stat_magic"] = 13, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 60, ["elona.martial_arts"] = 2, ["elona.casting"] = 3, ["elona.control_magic"] = 2, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring" }, }, { _id = "eye", is_extra = true, _ordering = 20230, elona_id = 31, properties = { breed_power = 50, image = "elona.chara_eye", melee_style = "elona.gaze", }, male_ratio = 53, height = 40, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 3, ["elona.stat_constitution"] = 9, ["elona.stat_dexterity"] = 4, ["elona.stat_perception"] = 6, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 7, ["elona.stat_magic"] = 10, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 25, ["elona.martial_arts"] = 2, ["elona.detection"] = 3, ["elona.anatomy"] = 3, }, body_parts = { "elona.head" }, }, { _id = "wyvern", is_extra = true, _ordering = 20240, elona_id = 32, properties = { breed_power = 100, image = "elona.chara_wyvern", melee_style = "elona.claw", }, male_ratio = 53, height = 1600, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 190, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 11, ["elona.stat_constitution"] = 13, ["elona.stat_dexterity"] = 8, ["elona.stat_perception"] = 9, ["elona.stat_learning"] = 5, ["elona.stat_will"] = 7, ["elona.stat_magic"] = 8, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 3, ["elona.literacy"] = 3, ["elona.traveling"] = 3, }, body_parts = { "elona.neck", "elona.body", "elona.ring", "elona.ring" }, }, { _id = "wasp", is_extra = true, _ordering = 20250, elona_id = 33, properties = { breed_power = 580, image = "elona.chara_wasp", melee_style = "elona.sting", dv_correction = 220, }, male_ratio = 53, height = 80, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 50, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 7, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 13, ["elona.stat_perception"] = 11, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 6, ["elona.stat_magic"] = 3, ["elona.stat_charisma"] = 2, ["elona.stat_speed"] = 100, ["elona.martial_arts"] = 2, ["elona.greater_evasion"] = 2, }, body_parts = { "elona.head" }, }, { _id = "giant", is_extra = true, _ordering = 20260, elona_id = 34, properties = { breed_power = 60, image = "elona.chara_giant", }, male_ratio = 53, height = 1800, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 200, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 12, ["elona.stat_constitution"] = 14, ["elona.stat_dexterity"] = 9, ["elona.stat_perception"] = 4, ["elona.stat_learning"] = 8, ["elona.stat_will"] = 5, ["elona.stat_magic"] = 6, ["elona.stat_charisma"] = 3, ["elona.stat_speed"] = 60, ["elona.martial_arts"] = 4, ["elona.anatomy"] = 3, ["elona.magic_device"] = 2, ["elona.carpentry"] = 3, }, body_parts = { "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.arm", "elona.leg" }, }, { _id = "imp", is_extra = true, _ordering = 20270, elona_id = 35, properties = { breed_power = 240, image = "elona.chara_imp", melee_style = "elona.claw", dv_correction = 200, }, male_ratio = 53, height = 80, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 70, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 5, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 8, ["elona.stat_perception"] = 8, ["elona.stat_learning"] = 8, ["elona.stat_will"] = 4, ["elona.stat_magic"] = 7, ["elona.stat_charisma"] = 3, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.memorization"] = 3, ["elona.control_magic"] = 3, }, body_parts = { "elona.neck", "elona.body", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.ring" }, }, { _id = "hand", is_extra = true, _ordering = 20280, elona_id = 36, properties = { breed_power = 160, image = "elona.chara_hand", }, male_ratio = 53, height = 70, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 8, ["elona.stat_constitution"] = 9, ["elona.stat_dexterity"] = 9, ["elona.stat_perception"] = 4, ["elona.stat_learning"] = 8, ["elona.stat_will"] = 6, ["elona.stat_magic"] = 5, ["elona.stat_charisma"] = 2, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.eye_of_mind"] = 4, }, body_parts = { "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm" }, }, { _id = "snake", is_extra = true, _ordering = 20290, elona_id = 37, properties = { breed_power = 430, image = "elona.chara_snake", melee_style = "elona.bite", }, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 6, ["elona.stat_constitution"] = 9, ["elona.stat_dexterity"] = 8, ["elona.stat_perception"] = 10, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 6, ["elona.stat_magic"] = 6, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.stealth"] = 4, }, male_ratio = 53, height = 50, age_min = 10, age_max = 19, body_parts = { "elona.body" }, }, { _id = "drake", is_extra = true, _ordering = 20300, elona_id = 38, properties = { breed_power = 120, image = "elona.chara_drake", melee_style = "elona.claw", pv_correction = 120, }, male_ratio = 53, height = 1400, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 160, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 11, ["elona.stat_constitution"] = 12, ["elona.stat_dexterity"] = 11, ["elona.stat_perception"] = 8, ["elona.stat_learning"] = 6, ["elona.stat_will"] = 9, ["elona.stat_magic"] = 8, ["elona.stat_charisma"] = 7, ["elona.stat_speed"] = 85, ["elona.martial_arts"] = 3, ["elona.traveling"] = 3, ["elona.fishing"] = 2, }, body_parts = { "elona.neck", "elona.body", "elona.ring", "elona.ring" }, }, { _id = "goblin", is_extra = false, _ordering = 10090, elona_id = 39, properties = { breed_power = 290, image = "elona.chara_goblin", }, male_ratio = 53, height = 140, age_min = 10, age_max = 19, traits = { ["elona.perm_darkness"] = 1, ["elona.perm_material"] = 1 }, skills = { ["elona.stat_life"] = 110, ["elona.stat_mana"] = 90, ["elona.stat_strength"] = 8, ["elona.stat_constitution"] = 8, ["elona.stat_dexterity"] = 5, ["elona.stat_perception"] = 5, ["elona.stat_learning"] = 8, ["elona.stat_will"] = 7, ["elona.stat_magic"] = 7, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.healing"] = 5, ["elona.fishing"] = 2, ["elona.mining"] = 2, ["elona.eye_of_mind"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "bear", is_extra = true, _ordering = 20310, elona_id = 40, properties = { breed_power = 350, image = "elona.chara_bear", melee_style = "elona.claw", }, male_ratio = 53, height = 280, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 160, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 9, ["elona.stat_constitution"] = 10, ["elona.stat_dexterity"] = 5, ["elona.stat_perception"] = 6, ["elona.stat_learning"] = 6, ["elona.stat_will"] = 6, ["elona.stat_magic"] = 3, ["elona.stat_charisma"] = 5, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.healing"] = 3, ["elona.performer"] = 2, ["elona.eye_of_mind"] = 3, }, body_parts = { "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "armor", is_extra = true, _ordering = 20320, elona_id = 41, properties = { breed_power = 40, image = "elona.chara_armor", breaks_into_debris = true, pv_correction = 300, }, male_ratio = 53, height = 550, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 40, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 8, ["elona.stat_constitution"] = 4, ["elona.stat_dexterity"] = 7, ["elona.stat_perception"] = 5, ["elona.stat_learning"] = 6, ["elona.stat_will"] = 6, ["elona.stat_magic"] = 7, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 50, ["elona.martial_arts"] = 2, ["elona.lock_picking"] = 3, ["elona.magic_device"] = 2, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.arm", "elona.waist" }, }, { _id = "medusa", is_extra = true, _ordering = 20330, elona_id = 42, properties = { breed_power = 180, image = "elona.chara_medusa", dv_correction = 140, }, male_ratio = 53, height = 160, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 110, ["elona.stat_strength"] = 7, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 8, ["elona.stat_perception"] = 7, ["elona.stat_learning"] = 7, ["elona.stat_will"] = 9, ["elona.stat_magic"] = 11, ["elona.stat_charisma"] = 5, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 3, ["elona.magic_capacity"] = 3, ["elona.control_magic"] = 3, }, body_parts = { "elona.body", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.leg" }, }, { _id = "cupid", is_extra = true, _ordering = 20340, elona_id = 43, properties = { breed_power = 350, image = "elona.chara_cupid", dv_correction = 200, }, male_ratio = 53, height = 120, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 80, ["elona.stat_mana"] = 130, ["elona.stat_strength"] = 6, ["elona.stat_constitution"] = 7, ["elona.stat_dexterity"] = 9, ["elona.stat_perception"] = 8, ["elona.stat_learning"] = 8, ["elona.stat_will"] = 7, ["elona.stat_magic"] = 12, ["elona.stat_charisma"] = 8, ["elona.stat_speed"] = 80, ["elona.martial_arts"] = 2, ["elona.literacy"] = 4, ["elona.control_magic"] = 3, }, body_parts = { "elona.neck", "elona.body", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm" }, }, { _id = "phantom", is_extra = true, _ordering = 20350, elona_id = 44, properties = { breed_power = 35, image = "elona.chara_phantom", breaks_into_debris = true, pv_correction = 200, }, male_ratio = 53, height = 450, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 60, ["elona.stat_mana"] = 90, ["elona.stat_strength"] = 6, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 8, ["elona.stat_perception"] = 7, ["elona.stat_learning"] = 6, ["elona.stat_will"] = 6, ["elona.stat_magic"] = 9, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 85, ["elona.martial_arts"] = 2, ["elona.stealth"] = 3, ["elona.disarm_trap"] = 3, }, resistances = { ["elona.darkness"] = 500, ["elona.nerve"] = 500, ["elona.nether"] = 500, ["elona.fire"] = 80, }, body_parts = { "elona.neck", "elona.body", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm" }, }, { _id = "harpy", is_extra = true, _ordering = 20360, elona_id = 45, properties = { breed_power = 420, image = "elona.chara_harpy", dv_correction = 150, }, male_ratio = 53, height = 140, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 90, ["elona.stat_mana"] = 100, ["elona.stat_strength"] = 8, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 9, ["elona.stat_perception"] = 9, ["elona.stat_learning"] = 6, ["elona.stat_will"] = 8, ["elona.stat_magic"] = 9, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 80, ["elona.martial_arts"] = 2, ["elona.magic_capacity"] = 3, ["elona.magic_device"] = 2, }, body_parts = { "elona.neck", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.leg", "elona.leg" }, }, { _id = "dragon", is_extra = true, _ordering = 20370, elona_id = 46, properties = { breed_power = 20, image = "elona.chara_dragon", melee_style = "elona.claw", pv_correction = 120, }, male_ratio = 53, height = 2400, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 220, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 13, ["elona.stat_constitution"] = 15, ["elona.stat_dexterity"] = 10, ["elona.stat_perception"] = 9, ["elona.stat_learning"] = 10, ["elona.stat_will"] = 9, ["elona.stat_magic"] = 13, ["elona.stat_charisma"] = 9, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 3, ["elona.traveling"] = 3, ["elona.jeweler"] = 3, }, body_parts = { "elona.neck", "elona.body", "elona.ring", "elona.ring" }, }, { _id = "dinosaur", is_extra = true, _ordering = 20380, elona_id = 47, properties = { breed_power = 100, image = "elona.chara_dinosaur", melee_style = "elona.claw", pv_correction = 120, }, male_ratio = 53, height = 2000, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 140, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 8, ["elona.stat_constitution"] = 10, ["elona.stat_dexterity"] = 6, ["elona.stat_perception"] = 5, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 5, ["elona.stat_magic"] = 6, ["elona.stat_charisma"] = 5, ["elona.stat_speed"] = 120, ["elona.martial_arts"] = 4, ["elona.traveling"] = 3, ["elona.greater_evasion"] = 2, }, body_parts = { "elona.neck", "elona.body", "elona.ring", "elona.ring" }, }, { _id = "cerberus", is_extra = true, _ordering = 20390, elona_id = 48, properties = { breed_power = 80, image = "elona.chara_cerberus", melee_style = "elona.claw", }, male_ratio = 53, height = 1200, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 160, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 11, ["elona.stat_constitution"] = 9, ["elona.stat_dexterity"] = 10, ["elona.stat_perception"] = 11, ["elona.stat_learning"] = 6, ["elona.stat_will"] = 8, ["elona.stat_magic"] = 7, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 85, ["elona.martial_arts"] = 3, ["elona.detection"] = 3, ["elona.tailoring"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.arm", "elona.leg", "elona.leg" }, }, { _id = "spider", is_extra = true, _ordering = 20400, elona_id = 49, properties = { breed_power = 560, image = "elona.chara_spider", melee_style = "elona.bite", cast_style = "spider", dv_correction = 170, tone = "elona.spider", can_pass_through_webs = true, }, male_ratio = 53, height = 60, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 50, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 5, ["elona.stat_constitution"] = 5, ["elona.stat_dexterity"] = 9, ["elona.stat_perception"] = 12, ["elona.stat_learning"] = 5, ["elona.stat_will"] = 6, ["elona.stat_magic"] = 8, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 120, ["elona.martial_arts"] = 2, ["elona.stealth"] = 3, ["elona.anatomy"] = 5, }, body_parts = { "elona.ring", "elona.ring" }, }, { _id = "golem", is_extra = false, _ordering = 10100, elona_id = 50, properties = { breed_power = 40, image = "elona.chara_golem", breaks_into_debris = true, pv_correction = 140, tone = "elona.golem" }, male_ratio = 53, height = 700, age_min = 10, age_max = 19, traits = { ["elona.perm_dim"] = 1, ["elona.perm_poison"] = 2, }, skills = { ["elona.stat_life"] = 150, ["elona.stat_mana"] = 70, ["elona.stat_strength"] = 10, ["elona.stat_constitution"] = 14, ["elona.stat_dexterity"] = 4, ["elona.stat_perception"] = 5, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 9, ["elona.stat_magic"] = 6, ["elona.stat_charisma"] = 3, ["elona.stat_speed"] = 45, ["elona.martial_arts"] = 4, ["elona.weight_lifting"] = 5, ["elona.mining"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, -- >>>>>>>> shade2/chara_func.hsp:934 if cnRace(tc)="golem":f=false ... effect_immunities = { "elona.dimming" } -- <<<<<<<< shade2/chara_func.hsp:934 if cnRace(tc)="golem":f=false .. }, { _id = "rock", is_extra = true, _ordering = 20410, elona_id = 51, properties = { breed_power = 200, image = "elona.chara_rock", breaks_into_debris = true, pv_correction = 200, }, male_ratio = 53, height = 500, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 40, ["elona.stat_mana"] = 50, ["elona.stat_strength"] = 8, ["elona.stat_constitution"] = 22, ["elona.stat_dexterity"] = 3, ["elona.stat_perception"] = 8, ["elona.stat_learning"] = 2, ["elona.stat_will"] = 3, ["elona.stat_magic"] = 4, ["elona.stat_charisma"] = 10, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 1, ["elona.weight_lifting"] = 3, ["elona.mining"] = 3, }, body_parts = { "elona.head" }, }, { _id = "crab", is_extra = true, _ordering = 20420, elona_id = 52, properties = { breed_power = 420, image = "elona.chara_crab", melee_style = "elona.claw", pv_correction = 150, }, male_ratio = 53, height = 50, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 60, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 6, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 7, ["elona.stat_perception"] = 7, ["elona.stat_learning"] = 3, ["elona.stat_will"] = 4, ["elona.stat_magic"] = 4, ["elona.stat_charisma"] = 3, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.disarm_trap"] = 2, ["elona.shield"] = 3, }, body_parts = { "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.leg" }, }, { _id = "skeleton", is_extra = true, _ordering = 20430, elona_id = 53, properties = { breed_power = 30, image = "elona.chara_skeleton", breaks_into_debris = true, }, male_ratio = 53, height = 160, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 8, ["elona.stat_constitution"] = 7, ["elona.stat_dexterity"] = 8, ["elona.stat_perception"] = 6, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 6, ["elona.stat_magic"] = 9, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.long_sword"] = 3, ["elona.shield"] = 2, ["elona.lock_picking"] = 3, }, resistances = { ["elona.darkness"] = 500, ["elona.nerve"] = 500, ["elona.nether"] = 500, ["elona.fire"] = 80, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "piece", is_extra = true, _ordering = 20440, elona_id = 54, properties = { breed_power = 25, image = "elona.chara_piece", breaks_into_debris = true, pv_correction = 150, }, male_ratio = 53, height = 750, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 120, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 9, ["elona.stat_constitution"] = 7, ["elona.stat_dexterity"] = 6, ["elona.stat_perception"] = 4, ["elona.stat_learning"] = 5, ["elona.stat_will"] = 9, ["elona.stat_magic"] = 10, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.magic_capacity"] = 2, ["elona.literacy"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist" }, }, { _id = "cat", is_extra = true, _ordering = 20450, elona_id = 55, properties = { breed_power = 950, image = "elona.chara_cat", melee_style = "elona.claw", cast_style = "gaze", tone = "elona.cat" }, male_ratio = 53, height = 60, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 120, ["elona.stat_mana"] = 120, ["elona.stat_strength"] = 6, ["elona.stat_constitution"] = 7, ["elona.stat_dexterity"] = 7, ["elona.stat_perception"] = 7, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 4, ["elona.stat_magic"] = 7, ["elona.stat_charisma"] = 12, ["elona.stat_speed"] = 110, ["elona.martial_arts"] = 2, ["elona.performer"] = 2, ["elona.greater_evasion"] = 3, ["elona.evasion"] = 2, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.leg", "elona.leg" }, }, { _id = "dog", is_extra = true, _ordering = 20460, elona_id = 56, properties = { breed_power = 920, image = "elona.chara_dog", melee_style = "elona.bite", }, male_ratio = 53, height = 80, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 120, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 7, ["elona.stat_constitution"] = 8, ["elona.stat_dexterity"] = 7, ["elona.stat_perception"] = 7, ["elona.stat_learning"] = 8, ["elona.stat_will"] = 7, ["elona.stat_magic"] = 7, ["elona.stat_charisma"] = 7, ["elona.stat_speed"] = 85, ["elona.martial_arts"] = 2, ["elona.weight_lifting"] = 3, ["elona.performer"] = 2, ["elona.detection"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.leg", "elona.leg" }, }, { _id = "roran", is_extra = true, _ordering = 20470, elona_id = 57, properties = { breed_power = 220, image = "elona.chara_roran", dv_correction = 150, }, male_ratio = 0, height = 150, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 4, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 5, ["elona.stat_perception"] = 7, ["elona.stat_learning"] = 7, ["elona.stat_will"] = 6, ["elona.stat_magic"] = 7, ["elona.stat_charisma"] = 10, ["elona.stat_speed"] = 95, ["elona.martial_arts"] = 2, ["elona.meditation"] = 3, ["elona.literacy"] = 4, ["elona.investing"] = 2, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "rat", is_extra = true, _ordering = 20480, elona_id = 58, properties = { breed_power = 1100, image = "elona.chara_rat", melee_style = "elona.bite", tone = "elona.rat", }, male_ratio = 53, height = 30, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 80, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 5, ["elona.stat_constitution"] = 4, ["elona.stat_dexterity"] = 8, ["elona.stat_perception"] = 10, ["elona.stat_learning"] = 3, ["elona.stat_will"] = 3, ["elona.stat_magic"] = 2, ["elona.stat_charisma"] = 3, ["elona.stat_speed"] = 75, ["elona.martial_arts"] = 1, ["elona.stealth"] = 3, ["elona.anatomy"] = 2, }, body_parts = { "elona.back", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "shell", is_extra = true, _ordering = 20490, elona_id = 59, properties = { breed_power = 450, image = "elona.chara_shell", melee_style = "elona.claw", pv_correction = 340, }, male_ratio = 53, height = 120, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 7, ["elona.stat_constitution"] = 7, ["elona.stat_dexterity"] = 5, ["elona.stat_perception"] = 4, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 5, ["elona.stat_magic"] = 3, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 20, ["elona.martial_arts"] = 1, ["elona.meditation"] = 3, ["elona.sense_quality"] = 3, }, body_parts = { "elona.leg" }, }, { _id = "catgod", is_extra = true, _ordering = 20500, elona_id = 60, properties = { breed_power = 5, image = "elona.chara_catgod", melee_style = "elona.claw", dv_correction = 250, }, male_ratio = 0, height = 120, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 120, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 12, ["elona.stat_constitution"] = 13, ["elona.stat_dexterity"] = 21, ["elona.stat_perception"] = 28, ["elona.stat_learning"] = 8, ["elona.stat_will"] = 13, ["elona.stat_magic"] = 12, ["elona.stat_charisma"] = 25, ["elona.stat_speed"] = 500, ["elona.martial_arts"] = 3, ["elona.evasion"] = 3, ["elona.greater_evasion"] = 3, ["elona.eye_of_mind"] = 2, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.hand", "elona.ring", "elona.arm", "elona.leg" }, }, { _id = "machinegod", is_extra = true, _ordering = 20510, elona_id = 61, properties = { breed_power = 5, image = "elona.chara_machinegod", breaks_into_debris = true, pv_correction = 150, }, male_ratio = 53, height = 3000, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 200, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 15, ["elona.stat_constitution"] = 14, ["elona.stat_dexterity"] = 11, ["elona.stat_perception"] = 24, ["elona.stat_learning"] = 12, ["elona.stat_will"] = 15, ["elona.stat_magic"] = 8, ["elona.stat_charisma"] = 10, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 5, ["elona.firearm"] = 30, }, body_parts = { "elona.head", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "undeadgod", is_extra = true, _ordering = 20520, elona_id = 62, properties = { breed_power = 5, image = "elona.chara_undeadgod", }, male_ratio = 53, height = 1500, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 150, ["elona.stat_mana"] = 500, ["elona.stat_strength"] = 10, ["elona.stat_constitution"] = 13, ["elona.stat_dexterity"] = 14, ["elona.stat_perception"] = 18, ["elona.stat_learning"] = 16, ["elona.stat_will"] = 18, ["elona.stat_magic"] = 28, ["elona.stat_charisma"] = 7, ["elona.stat_speed"] = 110, ["elona.martial_arts"] = 4, ["elona.control_magic"] = 3, ["elona.magic_capacity"] = 5, }, body_parts = { "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring" }, }, { _id = "machine", is_extra = true, _ordering = 20530, elona_id = 63, properties = { breed_power = 15, image = "elona.chara_machine", cast_style = "machine", breaks_into_debris = true, }, male_ratio = 53, height = 240, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 7, ["elona.stat_constitution"] = 10, ["elona.stat_dexterity"] = 7, ["elona.stat_perception"] = 9, ["elona.stat_learning"] = 5, ["elona.stat_will"] = 12, ["elona.stat_magic"] = 5, ["elona.stat_charisma"] = 6, ["elona.stat_speed"] = 65, ["elona.martial_arts"] = 2, ["elona.meditation"] = 3, ["elona.lock_picking"] = 3, ["elona.disarm_trap"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "wisp", is_extra = true, _ordering = 20540, elona_id = 64, properties = { breed_power = 25, image = "elona.chara_wisp", melee_style = "elona.gaze", }, male_ratio = 53, height = 40, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 150, ["elona.stat_mana"] = 150, ["elona.stat_strength"] = 5, ["elona.stat_constitution"] = 10, ["elona.stat_dexterity"] = 10, ["elona.stat_perception"] = 20, ["elona.stat_learning"] = 10, ["elona.stat_will"] = 15, ["elona.stat_magic"] = 15, ["elona.stat_charisma"] = 4, ["elona.stat_speed"] = 35, ["elona.martial_arts"] = 1, ["elona.control_magic"] = 3, ["elona.magic_capacity"] = 5, }, body_parts = { "elona.head" }, }, { _id = "chicken", is_extra = true, _ordering = 20550, elona_id = 65, properties = { breed_power = 1000, image = "elona.chara_chicken", melee_style = "elona.bite", }, male_ratio = 53, height = 40, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 80, ["elona.stat_mana"] = 80, ["elona.stat_strength"] = 5, ["elona.stat_constitution"] = 8, ["elona.stat_dexterity"] = 10, ["elona.stat_perception"] = 11, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 4, ["elona.stat_magic"] = 5, ["elona.stat_charisma"] = 7, ["elona.stat_speed"] = 60, ["elona.martial_arts"] = 1, ["elona.anatomy"] = 3, ["elona.meditation"] = 3, }, body_parts = { "elona.head" }, }, { _id = "stalker", is_extra = true, _ordering = 20560, elona_id = 66, properties = { breed_power = 25, image = "elona.chara_stalker", melee_style = "elona.claw", dv_correction = 130, }, male_ratio = 53, height = 180, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 120, ["elona.stat_mana"] = 140, ["elona.stat_strength"] = 9, ["elona.stat_constitution"] = 8, ["elona.stat_dexterity"] = 5, ["elona.stat_perception"] = 11, ["elona.stat_learning"] = 7, ["elona.stat_will"] = 6, ["elona.stat_magic"] = 9, ["elona.stat_charisma"] = 3, ["elona.stat_speed"] = 100, ["elona.martial_arts"] = 2, ["elona.eye_of_mind"] = 3, ["elona.stealth"] = 4, }, resistances = { ["elona.darkness"] = 500, ["elona.nerve"] = 500, ["elona.nether"] = 500, ["elona.fire"] = 80, }, body_parts = { "elona.neck", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm" }, }, { _id = "catsister", is_extra = true, _ordering = 20570, elona_id = 67, properties = { breed_power = 5, image = "elona.chara_catsister", melee_style = "elona.claw", }, male_ratio = 0, height = 140, age_min = 10, age_max = 13, skills = { ["elona.stat_life"] = 30, ["elona.stat_mana"] = 100, ["elona.stat_strength"] = 7, ["elona.stat_constitution"] = 5, ["elona.stat_dexterity"] = 13, ["elona.stat_perception"] = 15, ["elona.stat_learning"] = 8, ["elona.stat_will"] = 10, ["elona.stat_magic"] = 13, ["elona.stat_charisma"] = 22, ["elona.stat_speed"] = 200, ["elona.martial_arts"] = 4, ["elona.two_hand"] = 6, ["elona.tactics"] = 4, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "mutant", is_extra = false, _ordering = 10110, elona_id = 68, properties = { breed_power = 50, image = "elona.chara_mutant", }, male_ratio = 53, height = 180, age_min = 25, age_max = 74, traits = { ["elona.perm_chaos_shape"] = 1, }, skills = { ["elona.stat_life"] = 100, ["elona.stat_mana"] = 100, ["elona.stat_strength"] = 9, ["elona.stat_constitution"] = 5, ["elona.stat_dexterity"] = 5, ["elona.stat_perception"] = 7, ["elona.stat_learning"] = 7, ["elona.stat_will"] = 9, ["elona.stat_magic"] = 7, ["elona.stat_charisma"] = 1, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 2, ["elona.magic_capacity"] = 3, ["elona.healing"] = 4, }, body_parts = { "elona.body", "elona.hand" }, }, { _id = "yeek", is_extra = true, _ordering = 20580, elona_id = 69, properties = { breed_power = 500, image = "elona.chara_yeek", }, male_ratio = 50, height = 90, age_min = 15, age_max = 44, skills = { ["elona.stat_life"] = 80, ["elona.stat_mana"] = 90, ["elona.stat_strength"] = 4, ["elona.stat_constitution"] = 7, ["elona.stat_dexterity"] = 6, ["elona.stat_perception"] = 7, ["elona.stat_learning"] = 6, ["elona.stat_will"] = 4, ["elona.stat_magic"] = 6, ["elona.stat_charisma"] = 6, ["elona.stat_speed"] = 90, ["elona.martial_arts"] = 1, ["elona.meditation"] = 3, ["elona.negotiation"] = 4, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "yith", is_extra = true, _ordering = 20590, elona_id = 70, properties = { breed_power = 25, image = "elona.chara_yith", melee_style = "elona.touch", cast_style = "tentacle", }, male_ratio = 53, height = 950, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 150, ["elona.stat_mana"] = 200, ["elona.stat_strength"] = 13, ["elona.stat_constitution"] = 14, ["elona.stat_dexterity"] = 9, ["elona.stat_perception"] = 15, ["elona.stat_learning"] = 6, ["elona.stat_will"] = 5, ["elona.stat_magic"] = 11, ["elona.stat_charisma"] = 11, ["elona.stat_speed"] = 70, ["elona.martial_arts"] = 3, ["elona.control_magic"] = 4, ["elona.meditation"] = 3, ["elona.faith"] = 4, }, body_parts = { "elona.hand", "elona.hand", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.ring", "elona.ring" }, }, { _id = "servant", is_extra = true, _ordering = 20600, elona_id = 71, properties = { breed_power = 5, image = "elona.chara_servant", }, male_ratio = 52, height = 165, age_min = 100, age_max = 299, skills = { ["elona.stat_life"] = 90, ["elona.stat_mana"] = 150, ["elona.stat_strength"] = 6, ["elona.stat_constitution"] = 6, ["elona.stat_dexterity"] = 6, ["elona.stat_perception"] = 6, ["elona.stat_learning"] = 6, ["elona.stat_will"] = 6, ["elona.stat_magic"] = 6, ["elona.stat_charisma"] = 6, ["elona.stat_speed"] = 100, ["elona.martial_arts"] = 3, ["elona.tactics"] = 3, ["elona.casting"] = 4, ["elona.negotiation"] = 3, ["elona.throwing"] = 3, ["elona.dual_wield"] = 4, ["elona.firearm"] = 4, ["elona.two_hand"] = 3, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.waist", "elona.leg" }, }, { _id = "horse", is_extra = true, _ordering = 20610, elona_id = 72, properties = { breed_power = 1000, image = "elona.chara_horse", melee_style = "elona.bite", }, male_ratio = 53, height = 250, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 150, ["elona.stat_mana"] = 50, ["elona.stat_strength"] = 9, ["elona.stat_constitution"] = 8, ["elona.stat_dexterity"] = 4, ["elona.stat_perception"] = 5, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 4, ["elona.stat_magic"] = 3, ["elona.stat_charisma"] = 6, ["elona.stat_speed"] = 125, ["elona.martial_arts"] = 1, ["elona.healing"] = 4, }, body_parts = { "elona.body", "elona.leg", "elona.leg" }, }, { _id = "god", is_extra = true, _ordering = 20620, elona_id = 73, properties = { breed_power = 1, image = "elona.chara_lulwy", dv_correction = 300, pv_correction = 200, }, male_ratio = 0, height = 180, age_min = 999999, age_max = 999999, skills = { ["elona.stat_life"] = 200, ["elona.stat_mana"] = 100, ["elona.stat_strength"] = 17, ["elona.stat_constitution"] = 13, ["elona.stat_dexterity"] = 19, ["elona.stat_perception"] = 17, ["elona.stat_learning"] = 16, ["elona.stat_will"] = 25, ["elona.stat_magic"] = 24, ["elona.stat_charisma"] = 21, ["elona.stat_speed"] = 150, ["elona.martial_arts"] = 6, ["elona.evasion"] = 3, ["elona.greater_evasion"] = 3, ["elona.eye_of_mind"] = 2, ["elona.firearm"] = 8, ["elona.bow"] = 7, ["elona.dual_wield"] = 7, ["elona.two_hand"] = 5, ["elona.tactics"] = 7, }, body_parts = { "elona.hand", "elona.hand" }, }, { _id = "quickling", is_extra = true, _ordering = 20630, elona_id = 74, properties = { breed_power = 1, image = "elona.chara_quickling", dv_correction = 550, }, male_ratio = 53, height = 25, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 3, ["elona.stat_mana"] = 40, ["elona.stat_strength"] = 2, ["elona.stat_constitution"] = 4, ["elona.stat_dexterity"] = 18, ["elona.stat_perception"] = 16, ["elona.stat_learning"] = 5, ["elona.stat_will"] = 8, ["elona.stat_magic"] = 9, ["elona.stat_charisma"] = 7, ["elona.stat_speed"] = 750, ["elona.martial_arts"] = 1, ["elona.stealth"] = 3, ["elona.evasion"] = 7, ["elona.greater_evasion"] = 6, }, resistances = { ["elona.magic"] = 500, }, body_parts = { "elona.head", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.arm", "elona.leg" }, }, { _id = "metal", is_extra = true, _ordering = 20640, elona_id = 75, properties = { breed_power = 1, image = "elona.chara_metal", melee_style = "elona.bite", dv_correction = 150, pv_correction = 1000, tone = "elona.metal" }, male_ratio = 53, height = 12, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 1, ["elona.stat_mana"] = 100, ["elona.stat_strength"] = 4, ["elona.stat_constitution"] = 1, ["elona.stat_dexterity"] = 3, ["elona.stat_perception"] = 32, ["elona.stat_learning"] = 2, ["elona.stat_will"] = 4, ["elona.stat_magic"] = 4, ["elona.stat_charisma"] = 16, ["elona.stat_speed"] = 640, ["elona.martial_arts"] = 1, ["elona.magic_capacity"] = 4, ["elona.greater_evasion"] = 6, }, resistances = { ["elona.magic"] = 500, }, body_parts = { "elona.head", "elona.body", "elona.back" }, }, { _id = "bike", is_extra = true, _ordering = 20650, elona_id = 76, properties = { breed_power = 15, image = "elona.chara_bike", cast_style = "machine", breaks_into_debris = true, pv_correction = 150, }, male_ratio = 53, height = 240, age_min = 10, age_max = 19, skills = { ["elona.stat_life"] = 170, ["elona.stat_mana"] = 60, ["elona.stat_strength"] = 11, ["elona.stat_constitution"] = 13, ["elona.stat_dexterity"] = 4, ["elona.stat_perception"] = 3, ["elona.stat_learning"] = 4, ["elona.stat_will"] = 5, ["elona.stat_magic"] = 3, ["elona.stat_charisma"] = 11, ["elona.stat_speed"] = 155, ["elona.martial_arts"] = 2, ["elona.evasion"] = 11, ["elona.lock_picking"] = 3, ["elona.disarm_trap"] = 3, }, body_parts = { "elona.head", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.waist", "elona.leg", "elona.leg" }, }, -- For debug { _id = "slug", _ordering = 0, is_extra = true, properties = { dv_correction = 1000, }, skills = { ["elona.stat_life"] = 1000, ["elona.stat_mana"] = 1000, ["elona.stat_strength"] = 100, ["elona.stat_constitution"] = 100, ["elona.stat_dexterity"] = 100, ["elona.stat_perception"] = 100, ["elona.stat_learning"] = 100, ["elona.stat_will"] = 100, ["elona.stat_magic"] = 100, ["elona.stat_charisma"] = 100, ["elona.stat_speed"] = 500, ["elona.mining"] = 100, }, body_parts = { "elona.head", "elona.neck", "elona.body", "elona.back", "elona.hand", "elona.hand", "elona.ring", "elona.ring", "elona.ring", "elona.waist", "elona.leg" }, }, } data:add_multi("base.race", race)
ys = ys or {} slot1 = ys.Battle.BattleConst ys.Battle.AttackOxyState = class("AttackOxyState", ys.Battle.IOxyState) ys.Battle.AttackOxyState.__name = "AttackOxyState" ys.Battle.AttackOxyState.Ctor = function (slot0) slot0.super.Ctor(slot0) end ys.Battle.AttackOxyState.GetWeaponUseableList = function (slot0) return { slot0.OXY_STATE.DIVE, slot0.OXY_STATE.FLOAT } end ys.Battle.AttackOxyState.GetDiveState = function (slot0) return slot0.OXY_STATE.FLOAT end ys.Battle.AttackOxyState.GetBubbleFlag = function (slot0) return false end ys.Battle.AttackOxyState.IsVisible = function (slot0) return true end return
local M = {} M.namespace = vim.api.nvim_create_namespace("WhichKey") ---@class Options local defaults = { plugins = { marks = true, -- shows a list of your marks on ' and ` registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode -- the presets plugin, adds help for a bunch of default keybindings in Neovim -- No actual key bindings are created spelling = { enabled = false, -- enabling this will show WhichKey when pressing z= to select spelling suggestions suggestions = 20, -- how many suggestions should be shown in the list? }, presets = { operators = true, -- adds help for operators like d, y, ... motions = true, -- adds help for motions text_objects = true, -- help for text objects triggered after entering an operator windows = true, -- default bindings on <c-w> nav = true, -- misc bindings to work with windows z = true, -- bindings for folds, spelling and others prefixed with z g = true, -- bindings for prefixed with g }, }, -- add operators that will trigger motion and text object completion -- to enable all native operators, set the preset / operators plugin above operators = { gc = "Comments" }, key_labels = { -- override the label used to display some keys. It doesn't effect WK in any other way. -- For example: -- ["<space>"] = "SPC", -- ["<cr>"] = "RET", -- ["<tab>"] = "TAB", }, motions = { count = true, }, icons = { breadcrumb = "»", -- symbol used in the command line area that shows your active key combo separator = "➜", -- symbol used between a key and it's label group = "+", -- symbol prepended to a group }, window = { border = "none", -- none, single, double, shadow position = "bottom", -- bottom, top margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left] padding = { 1, 2, 1, 2 }, -- extra window padding [top, right, bottom, left] }, layout = { height = { min = 4, max = 25 }, -- min and max height of the columns width = { min = 20, max = 50 }, -- min and max width of the columns spacing = 3, -- spacing between columns align = "left", -- align columns left, center or right }, ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "^:", "^ ", "^call ", "^lua " }, -- hide mapping boilerplate show_help = true, -- show a help message in the command line for using WhichKey triggers = "auto", -- automatically setup triggers -- triggers = {"<leader>"} -- or specifiy a list manually triggers_nowait = {}, -- list of triggers, where WhichKey should not wait for timeoutlen and show immediately triggers_blacklist = { -- list of mode / prefixes that should never be hooked by WhichKey -- this is mostly relevant for keymaps that start with a native binding i = { "j", "k" }, v = { "j", "k" }, }, } ---@type Options M.options = {} ---@return Options function M.setup(options) M.options = vim.tbl_deep_extend("force", {}, defaults, options or {}) end M.setup() return M
-- -- client.lua -- send "Hello" to a server using SDL_net -- local net = require "SDL.net" -- Init net net.init() -- Create and connect local addr = net.resolveHost("localhost", 5959) local s = net.openTcp(addr) s:send("Hello") net.quit()
-- lua/rs/Shift.lua if Server then -- SHIFT local UpdateShiftButtons = debug.getupvaluex(Shift.OnUpdate, "UpdateShiftButtons") if UpdateShiftButtons then local kEchoCooldown = 1 local function OnShiftButtonsCallback(self) UpdateShiftButtons(self) self.echoActive = self.timeLastEcho + kEchoCooldown > Shared.GetTime() return self:GetIsAlive() end local originalShiftOnCreate = Shift.OnCreate function Shift:OnCreate() originalShiftOnCreate(self) self:AddTimedCallback(OnShiftButtonsCallback, 2) end local originalShiftOnInitialized = Shift.OnInitialized function Shift:OnInitialized() originalShiftOnInitialized(self) InitMixin(self, SleeperMixin) end end function Shift:GetCanSleep() return not self.moving and self:GetIsBuilt() and not self:GetHasOrder() and self:GetIsAlive() and not self.isRepositioning end function Shift:OnUpdate(deltaTime) PROFILE("Shift:OnUpdate") ScriptActor.OnUpdate(self, deltaTime) UpdateAlienStructureMove(self, deltaTime) end function Shift:OnOrderGiven(order) if order then self:WakeUp() end end -- END SHIFT end
------------------------------------------------------------ -- SiegeOfOrgrimmar.lua -- -- Abin -- 2013/9/12 ------------------------------------------------------------ local module = CompactRaid:GetModule("RaidDebuff") if not module then return end local TIER = 5 -- Mists of Panaria local INSTANCE = 369 -- Siege of Orgrimmar local BOSS -- Immerseus (852) BOSS = 852 module:RegisterDebuff(TIER, INSTANCE, BOSS, 143437, 5) -- The Fallen Protectors (849) BOSS = 849 module:RegisterDebuff(TIER, INSTANCE, BOSS, 143962) module:RegisterDebuff(TIER, INSTANCE, BOSS, 144396) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143023) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143009) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143840, 5) module:RegisterDebuff(TIER, INSTANCE, BOSS, 147383, 1) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143198, 4) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143301) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143879) -- Norushen (866) BOSS = 866 module:RegisterDebuff(TIER, INSTANCE, BOSS, 146124) -- Sha of Pride (867) BOSS = 867 module:RegisterDebuff(TIER, INSTANCE, BOSS, 144364) module:RegisterDebuff(TIER, INSTANCE, BOSS, 146595, 1) module:RegisterDebuff(TIER, INSTANCE, BOSS, 146817, 4) module:RegisterDebuff(TIER, INSTANCE, BOSS, 144843) module:RegisterDebuff(TIER, INSTANCE, BOSS, 144351, 5) module:RegisterDebuff(TIER, INSTANCE, BOSS, 144358) module:RegisterDebuff(TIER, INSTANCE, BOSS, 144684) module:RegisterDebuff(TIER, INSTANCE, BOSS, 144774) module:RegisterDebuff(TIER, INSTANCE, BOSS, 147207) module:RegisterDebuff(TIER, INSTANCE, BOSS, 147028) -- Galakras (881) BOSS = 881 module:RegisterDebuff(TIER, INSTANCE, BOSS, 146902) module:RegisterDebuff(TIER, INSTANCE, BOSS, 147705) module:RegisterDebuff(TIER, INSTANCE, BOSS, 146764, 2) module:RegisterDebuff(TIER, INSTANCE, BOSS, 147068, 4) module:RegisterDebuff(TIER, INSTANCE, BOSS, 147042) -- Iron Juggernaut (864) BOSS = 864 module:RegisterDebuff(TIER, INSTANCE, BOSS, 144459) module:RegisterDebuff(TIER, INSTANCE, BOSS, 144467) module:RegisterDebuff(TIER, INSTANCE, BOSS, 144498) -- Kor'kron Dark Shaman (856) BOSS = 856 module:RegisterDebuff(TIER, INSTANCE, BOSS, 144304) module:RegisterDebuff(TIER, INSTANCE, BOSS, 144215) module:RegisterDebuff(TIER, INSTANCE, BOSS, 144107, 1) module:RegisterDebuff(TIER, INSTANCE, BOSS, 144331, 5) -- General Nazgrim (850) BOSS = 850 module:RegisterDebuff(TIER, INSTANCE, BOSS, 143494) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143638) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143480) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143882) -- Malkorok (846) BOSS = 846 module:RegisterDebuff(TIER, INSTANCE, BOSS, 142990, 4) module:RegisterDebuff(TIER, INSTANCE, BOSS, 142863) module:RegisterDebuff(TIER, INSTANCE, BOSS, 142864) module:RegisterDebuff(TIER, INSTANCE, BOSS, 142865) module:RegisterDebuff(TIER, INSTANCE, BOSS, 142913, 5) -- Spoils of Pandaria (870) BOSS = 870 module:RegisterDebuff(TIER, INSTANCE, BOSS, 142983) module:RegisterDebuff(TIER, INSTANCE, BOSS, 145218) module:RegisterDebuff(TIER, INSTANCE, BOSS, 122962) module:RegisterDebuff(TIER, INSTANCE, BOSS, 146289) -- Thok the Bloodthirsty (851) BOSS = 851 module:RegisterDebuff(TIER, INSTANCE, BOSS, 143426) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143452) module:RegisterDebuff(TIER, INSTANCE, BOSS, 146540) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143780) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143791) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143773, 4) module:RegisterDebuff(TIER, INSTANCE, BOSS, 133636) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143767) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143777, 4) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143766, 5) -- Siegecrafter Blackfuse (865) BOSS = 865 module:RegisterDebuff(TIER, INSTANCE, BOSS, 143385) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143856) -- Paragons of the Klaxxi (853) BOSS = 853 module:RegisterDebuff(TIER, INSTANCE, BOSS, 142931, 5) module:RegisterDebuff(TIER, INSTANCE, BOSS, 142315) module:RegisterDebuff(TIER, INSTANCE, BOSS, 142929) module:RegisterDebuff(TIER, INSTANCE, BOSS, 142877) module:RegisterDebuff(TIER, INSTANCE, BOSS, 142668) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143702, 4) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143275) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143279) module:RegisterDebuff(TIER, INSTANCE, BOSS, 143339) module:RegisterDebuff(TIER, INSTANCE, BOSS, 142948, 4) -- Garrosh Hellscream (869) BOSS = 869 module:RegisterDebuff(TIER, INSTANCE, BOSS, 144582, 4) module:RegisterDebuff(TIER, INSTANCE, BOSS, 145183, 4) module:RegisterDebuff(TIER, INSTANCE, BOSS, 145175, 5) -- Common module:RegisterDebuff(TIER, INSTANCE, 0, 145553, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 25195) module:RegisterDebuff(TIER, INSTANCE, 0, 145999) module:RegisterDebuff(TIER, INSTANCE, 0, 145861) module:RegisterDebuff(TIER, INSTANCE, 0, 136670, 4) module:RegisterDebuff(TIER, INSTANCE, 0, 147642) module:RegisterDebuff(TIER, INSTANCE, 0, 146537, 5) module:RegisterDebuff(TIER, INSTANCE, 0, 147554) module:RegisterDebuff(TIER, INSTANCE, 0, 148456)
if SERVER then return end net.Receive("TFAStarWars_nfy", function() local msg = net.ReadString() local ntype = net.ReadInt(6) local time = net.ReadInt(16) TFAStarWars:DoNotify(msg, ntype, time) end) net.Receive("TFAStarWars_Snd", function() surface.PlaySound(net.ReadString()) end)
local GLayer = require("graphic.core.GLayer") local GmLayer = class("GmLayer", GLayer) local gmConfig = {} for i=1,100 do table.insert(gmConfig, {name="获取版本信息"..i,command="版本"..i}) end function GmLayer:ctor() GLayer.ctor(self) end function GmLayer:init() GLayer.init(self) local go = self:loadUiPrefab("Sandbox/Prefabs/UI/gm.prefab") local btn = go.transform:Find("send").gameObject self:registerClick(btn) local contentGo = go.transform:Find("ScrollView/Viewport/Content").gameObject contentGo:GetComponent(typeof(RectTransform)).sizeDelta = Vector2(0, #gmConfig*30) self._goList = {} local imageGo = contentGo.transform:Find("Image").gameObject for i,v in ipairs(gmConfig) do if i > 20 then break end local go = GameObject.Instantiate(imageGo) go.transform:SetParent(contentGo.transform, false) go:GetComponent(typeof(RectTransform)).anchoredPosition = Vector2(0, 15-30*i) local textGo = go.transform:Find("GameObject").gameObject textGo:GetComponent(typeof(UI.Text)).text = v.name if i%2 == 0 then go:GetComponent(typeof(UI.Image)).color = Color(245/255,245/255,245/255,1) textGo:GetComponent(typeof(UI.Text)).color = Color(130/255,130/255,130/255,1) else go:GetComponent(typeof(UI.Image)).color = Color(210/255,210/255,210/255,1) textGo:GetComponent(typeof(UI.Text)).color = Color(83/255,83/255,83/255,1) end table.insert(self._goList, go) end imageGo:SetActive(false) self._rootGo = go self:bindTouchHandler() -- local go = self._rootGo.transform:Find("input").gameObject -- local input = go:GetComponent(typeof(UI.InputField)) -- input.onValueChanged:AddListener(function() print("onValueChanged") end) local scrollView = go.transform:Find("ScrollView").gameObject local scrollRect = scrollView:GetComponent(typeof(UI.ScrollRect)) print(scrollRect.onValueChanged) scrollRect.onValueChanged:AddListener(function(vec2) self:scroll(vec2) end) self._indexOffset = 0 end function GmLayer:scroll(vec2) local displayCount = 20 local totalCount = #gmConfig local p = Mathf.Clamp(vec2.y,0,1) local endIndex = math.ceil(totalCount + (displayCount - totalCount)*p) for i=1,displayCount do local index = endIndex + 1 - i local go = self._goList[ index%displayCount +1 ] go:GetComponent(typeof(RectTransform)).anchoredPosition = Vector2(0, 15-30*index) local v = gmConfig[index] local textGo = go.transform:Find("GameObject").gameObject textGo:GetComponent(typeof(UI.Text)).text = v.name end end function GmLayer:OnPointerClick(data) local go = self._rootGo.transform:Find("ScrollView/Viewport").gameObject local rect = go:GetComponent(typeof(RectTransform)) local isOk, pos = RectTransformUtility.ScreenPointToLocalPointInRectangle(rect, data.position, data.pressEventCamera) if isOk then if rect.rect:Contains(pos) == true then local go = self._rootGo.transform:Find("ScrollView/Viewport/Content").gameObject local isOk, pos = RectTransformUtility.ScreenPointToLocalPointInRectangle(go:GetComponent(typeof(RectTransform)), data.position, data.pressEventCamera) if isOk then local i = math.floor(math.abs(pos.y)/30) + 1 local go = self._rootGo.transform:Find("input").gameObject local input = go:GetComponent(typeof(UI.InputField)) input.text = gmConfig[i].name end end end end function GmLayer:handleClick(name) if name == "send" then self:send() end end function GmLayer:send() local go = self._rootGo.transform:Find("input/Text").gameObject local str = go:GetComponent(typeof(UI.Text)) if str == "append" then print("click append") event.broadcast(event.ui.appendTabLayer, {config={layerName=enum.ui.layer.sdkLogin, name="xsdk", class="ui.login.SdkLoginLayer"}, index=2}) elseif str == "remove" then print("click remove") event.broadcast(event.ui.removeTabLayer, {name=enum.ui.layer.sdkLogin}) else print(str) end end return GmLayer
local quat = require "modules.quat" local vec3 = require "modules.vec3" local utils = require "modules.utils" local constants = require "modules.constants" describe("quat:", function() it("creates an identity quaternion", function() local a = quat() assert.is.equal(0, a.x) assert.is.equal(0, a.y) assert.is.equal(0, a.z) assert.is.equal(1, a.w) assert.is_true(a:is_quat()) assert.is_true(a:is_real()) end) it("creates a quaternion from numbers", function() local a = quat(0, 0, 0, 0) assert.is.equal(0, a.x) assert.is.equal(0, a.y) assert.is.equal(0, a.z) assert.is.equal(0, a.w) assert.is_true(a:is_zero()) assert.is_true(a:is_imaginary()) end) it("creates a quaternion from a list", function() local a = quat { 2, 3, 4, 1 } assert.is.equal(2, a.x) assert.is.equal(3, a.y) assert.is.equal(4, a.z) assert.is.equal(1, a.w) end) it("creates a quaternion from a record", function() local a = quat { x=2, y=3, z=4, w=1 } assert.is.equal(2, a.x) assert.is.equal(3, a.y) assert.is.equal(4, a.z) assert.is.equal(1, a.w) end) it("creates a quaternion from a direction", function() local v = vec3(-80, 80, -80):normalize() local a = quat.from_direction(v, vec3.unit_z) assert.is_true(utils.tolerance(-0.577-a.x, 0.001)) assert.is_true(utils.tolerance(-0.577-a.y, 0.001)) assert.is_true(utils.tolerance( 0 -a.z, 0.001)) assert.is_true(utils.tolerance( 0.423-a.w, 0.001)) end) it("clones a quaternion", function() local a = quat() local b = a:clone() assert.is.equal(a.x, b.x) assert.is.equal(a.y, b.y) assert.is.equal(a.z, b.z) assert.is.equal(a.w, b.w) end) it("adds a quaternion to another", function() local a = quat(2, 3, 4, 1) local b = quat(3, 6, 9, 1) local c = a:add(b) local d = a + b assert.is.equal(5, c.x) assert.is.equal(9, c.y) assert.is.equal(13, c.z) assert.is.equal(2, c.w) assert.is.equal(c, d) end) it("subtracts a quaternion from another", function() local a = quat(2, 3, 4, 1) local b = quat(3, 6, 9, 1) local c = a:sub(b) local d = a - b assert.is.equal(-1, c.x) assert.is.equal(-3, c.y) assert.is.equal(-5, c.z) assert.is.equal( 0, c.w) assert.is.equal(c, d) end) it("multiplies a quaternion by another", function() local a = quat(2, 3, 4, 1) local b = quat(3, 6, 9, 1) local c = a:mul(b) local d = a * b assert.is.equal( 8, c.x) assert.is.equal( 3, c.y) assert.is.equal( 16, c.z) assert.is.equal(-59, c.w) assert.is.equal(c, d) end) it("multiplies a quaternion by a scale factor", function() local a = quat(2, 3, 4, 1) local s = 3 local b = a:scale(s) local c = a * s assert.is.equal(6, b.x) assert.is.equal(9, b.y) assert.is.equal(12, b.z) assert.is.equal(3, b.w) assert.is.equal(b, c) end) it("inverts a quaternion", function() local a = quat(2, 3, 4, 1) local b = -a assert.is.equal(-a.x, b.x) assert.is.equal(-a.y, b.y) assert.is.equal(-a.z, b.z) assert.is.equal(-a.w, b.w) end) it("multiplies a quaternion by a vec3", function() local a = quat(2, 3, 4, 1) local v = vec3(3, 4, 5) local b = a:mul_vec3(v) local c = a * v assert.is.equal(-21, c.x) assert.is.equal( 4, c.y) assert.is.equal( 17, c.z) assert.is.equal(b, c) end) it("verifies quat composition order", function() local a = quat(2, 3, 4, 1):normalize() -- Only the normal quaternions represent rotations local b = quat(3, 6, 9, 1):normalize() local c = a * b local v = vec3(3, 4, 5) local cv = c * v local abv = a * (b * v) assert.is_true((abv - cv):len() < 1e-07) -- Verify (a*b)*v == a*(b*v) within an epsilon end) it("multiplies a quaternion by an exponent of 0", function() local a = quat(2, 3, 4, 1):normalize() local e = 0 local b = a:pow(e) local c = a^e assert.is.equal(0, b.x) assert.is.equal(0, b.y) assert.is.equal(0, b.z) assert.is.equal(1, b.w) assert.is.equal(b, c) end) it("multiplies a quaternion by a positive exponent", function() local a = quat(2, 3, 4, 1):normalize() local e = 0.75 local b = a:pow(e) local c = a^e assert.is_true(utils.tolerance(-0.3204+b.x, 0.0001)) assert.is_true(utils.tolerance(-0.4805+b.y, 0.0001)) assert.is_true(utils.tolerance(-0.6407+b.z, 0.0001)) assert.is_true(utils.tolerance(-0.5059+b.w, 0.0001)) assert.is.equal( b, c) end) it("multiplies a quaternion by a negative exponent", function() local a = quat(2, 3, 4, 1):normalize() local e = -1 local b = a:pow(e) local c = a^e assert.is_true(utils.tolerance( 0.3651+b.x, 0.0001)) assert.is_true(utils.tolerance( 0.5477+b.y, 0.0001)) assert.is_true(utils.tolerance( 0.7303+b.z, 0.0001)) assert.is_true(utils.tolerance(-0.1826+b.w, 0.0001)) assert.is.equal(b, c) end) it("inverts a quaternion", function() local a = quat(1, 1, 1, 1):inverse() assert.is.equal(-0.5, a.x) assert.is.equal(-0.5, a.y) assert.is.equal(-0.5, a.z) assert.is.equal( 0.5, a.w) end) it("normalizes a quaternion", function() local a = quat(1, 1, 1, 1):normalize() assert.is.equal(0.5, a.x) assert.is.equal(0.5, a.y) assert.is.equal(0.5, a.z) assert.is.equal(0.5, a.w) end) it("dots two quaternions", function() local a = quat(1, 1, 1, 1) local b = quat(4, 4, 4, 4) local c = a:dot(b) assert.is.equal(16, c) end) it("dots two quaternions (negative)", function() local a = quat(-1, 1, 1, 1) local b = quat(4, 4, 4, 4) local c = a:dot(b) assert.is.equal(8, c) end) it("dots two quaternions (tiny)", function() local a = quat(0.1, 0.1, 0.1, 0.1) local b = quat(0.4, 0.4, 0.4, 0.4) local c = a:dot(b) assert.is_true(utils.tolerance(0.16-c, 0.001)) end) it("gets the length of a quaternion", function() local a = quat(2, 3, 4, 5):len() assert.is.equal(math.sqrt(54), a) end) it("gets the square length of a quaternion", function() local a = quat(2, 3, 4, 5):len2() assert.is.equal(54, a) end) it("interpolates between two quaternions", function() local a = quat(3, 3, 3, 3) local b = quat(6, 6, 6, 6) local s = 0.1 local c = a:lerp(b, s) assert.is.equal(0.5, c.x) assert.is.equal(0.5, c.y) assert.is.equal(0.5, c.z) assert.is.equal(0.5, c.w) end) it("interpolates between two quaternions (spherical)", function() local a = quat(3, 3, 3, 3) local b = quat(6, 6, 6, 6) local s = 0.1 local c = a:slerp(b, s) assert.is.equal(0.5, c.x) assert.is.equal(0.5, c.y) assert.is.equal(0.5, c.z) assert.is.equal(0.5, c.w) end) it("unpacks a quaternion", function() local x, y, z, w = quat(2, 3, 4, 1):unpack() assert.is.equal(2, x) assert.is.equal(3, y) assert.is.equal(4, z) assert.is.equal(1, w) end) it("converts quaternion to a vec3", function() local v = quat(2, 3, 4, 1):to_vec3() assert.is.equal(2, v.x) assert.is.equal(3, v.y) assert.is.equal(4, v.z) end) it("gets the conjugate quaternion", function() local a = quat(2, 3, 4, 1):conjugate() assert.is.equal(-2, a.x) assert.is.equal(-3, a.y) assert.is.equal(-4, a.z) assert.is.equal( 1, a.w) end) it("gets the reciprocal quaternion", function() local a = quat(1, 1, 1, 1) local b = a:reciprocal() local c = b:reciprocal() assert.is_not.equal(a.x, b.x) assert.is_not.equal(a.y, b.y) assert.is_not.equal(a.z, b.z) assert.is_not.equal(a.w, b.w) assert.is.equal(a.x, c.x) assert.is.equal(a.y, c.y) assert.is.equal(a.z, c.z) assert.is.equal(a.w, c.w) end) it("converts between a quaternion and angle/axis", function() local a = quat.from_angle_axis(math.pi, vec3.unit_z) local angle, axis = a:to_angle_axis() assert.is.equal(math.pi, angle) assert.is.equal(vec3.unit_z, axis) end) it("converts between a quaternion and angle/axis (specify by component)", function() local a = quat.from_angle_axis(math.pi, vec3.unit_z.x, vec3.unit_z.y, vec3.unit_z.z) local angle, axis = a:to_angle_axis() assert.is.equal(math.pi, angle) assert.is.equal(vec3.unit_z, axis) end) it("converts between a quaternion and angle/axis (w=2)", function() local angle, axis = quat(1, 1, 1, 2):to_angle_axis() assert.is_true(utils.tolerance(1.427-angle, 0.001)) assert.is_true(utils.tolerance(0.577-axis.x, 0.001)) assert.is_true(utils.tolerance(0.577-axis.y, 0.001)) assert.is_true(utils.tolerance(0.577-axis.z, 0.001)) end) it("converts between a quaternion and angle/axis (w=2) (by component)", function() local angle, x,y,z = quat(1, 1, 1, 2):to_angle_axis_unpack() assert.is_true(utils.tolerance(1.427-angle, 0.001)) assert.is_true(utils.tolerance(0.577-x, 0.001)) assert.is_true(utils.tolerance(0.577-y, 0.001)) assert.is_true(utils.tolerance(0.577-z, 0.001)) end) it("converts between a quaternion and angle/axis (w=1)", function() local angle, axis = quat(1, 2, 3, 1):to_angle_axis() assert.is.equal(0, angle) assert.is.equal(1, axis.x) assert.is.equal(2, axis.y) assert.is.equal(3, axis.z) end) it("converts between a quaternion and angle/axis (identity quaternion) (by component)", function() local angle, x,y,z = quat():to_angle_axis_unpack() assert.is.equal(0, angle) assert.is.equal(0, x) assert.is.equal(0, y) assert.is.equal(1, z) end) it("converts between a quaternion and angle/axis (identity quaternion with fallback)", function() local angle, axis = quat():to_angle_axis(vec3(2,3,4)) assert.is.equal(0, angle) assert.is.equal(2, axis.x) assert.is.equal(3, axis.y) assert.is.equal(4, axis.z) end) it("gets a string representation of a quaternion", function() local a = quat():to_string() assert.is.equal("(+0.000,+0.000,+0.000,+1.000)", a) end) end)
local function setup(args) local xplr = xplr local COMMANDS = {} local COMMAND_HISTORY = {} local CURR_CMD_INDEX = 1 -- Parse args args = args or {} args.mode = args.mode or "default" args.key = args.key or ":" args.remap_action_mode_to = args.remap_action_mode_to or { mode = "default", key = ";" } xplr.config.modes.builtin[args.remap_action_mode_to.mode].key_bindings.on_key[args.remap_action_mode_to.key] = xplr.config.modes.builtin.default.key_bindings.on_key[":"] xplr.config.modes.builtin[args.mode].key_bindings.on_key[args.key] = { help = "command mode", messages = { "PopMode", { SwitchModeCustom = "command_mode" }, { SetInputBuffer = "" }, }, } xplr.config.modes.custom.command_mode = { name = "command mode", key_bindings = { on_key = { enter = { help = "execute", messages = { { CallLuaSilently = "custom.command_mode.execute" }, "PopMode", }, }, esc = { help = "cancel", messages = { "PopMode" }, }, tab = { help = "try complete", messages = { { CallLuaSilently = "custom.command_mode.try_complete" }, }, }, up = { help = "prev", messages = { { CallLuaSilently = "custom.command_mode.prev_command" }, }, }, down = { help = "next", messages = { { CallLuaSilently = "custom.command_mode.next_command" }, }, }, ["!"] = { help = "shell", messages = { { Call = { command = "bash", args = { "-i" } } }, "ExplorePwdAsync", "PopMode", }, }, ["?"] = { help = "list commands", messages = { { CallLua = "custom.command_mode.list" }, }, }, }, default = { messages = { "UpdateInputBufferFromKey", }, }, }, } xplr.fn.custom.command_mode = {} xplr.fn.custom.command_mode.fn = {} -- Define an interactive command xplr.fn.custom.command_mode.cmd = function(name, help) return function(fn) xplr.fn.custom.command_mode.fn[name] = fn COMMANDS[name] = { help = help, fn = fn, silent = false } end end -- Define a silent command xplr.fn.custom.command_mode.silent_cmd = function(name, help) return function(fn) xplr.fn.custom.command_mode.fn[name] = fn COMMANDS[name] = { help = help, fn = fn, silent = true } end end xplr.fn.custom.command_mode.execute = function(app) local name = app.input_buffer if name then local cmd = COMMANDS[name] if cmd then if COMMAND_HISTORY[CURR_CMD_INDEX] ~= cmd then table.insert(COMMAND_HISTORY, name) CURR_CMD_INDEX = CURR_CMD_INDEX + 1 end if cmd.silent then return cmd.fn(app) else return { { CallLua = "custom.command_mode.fn." .. name }, } end end end end xplr.fn.custom.command_mode.try_complete = function(app) local cmd = app.input_buffer or "" local match = nil for name, _ in pairs(COMMANDS) do if string.sub(name, 1, string.len(cmd)) == cmd then if match then match = nil else match = name end end end if match then return { { SetInputBuffer = match }, } end end xplr.fn.custom.command_mode.list = function(_) local maxlen = 0 for name, _ in pairs(COMMANDS) do local len = string.len(name) if len > maxlen then maxlen = len end end local text = "" for name, cmd in pairs(COMMANDS) do local help = cmd.help or "" text = text .. name for _ = 0, maxlen - string.len(name), 1 do text = text .. " " end text = text .. "\t" .. help .. "\n" end print(text) io.write("[Press ENTER to continue]") io.read() end xplr.fn.custom.command_mode.prev_command = function(_) if CURR_CMD_INDEX > 1 then CURR_CMD_INDEX = CURR_CMD_INDEX - 1 else for i, _ in ipairs(COMMAND_HISTORY) do CURR_CMD_INDEX = i + 1 end end local cmd = COMMAND_HISTORY[CURR_CMD_INDEX] if cmd then return { { SetInputBuffer = cmd }, } end end xplr.fn.custom.command_mode.next_command = function(_) local len = 0 for i, _ in ipairs(COMMAND_HISTORY) do len = i end if CURR_CMD_INDEX >= len then CURR_CMD_INDEX = 1 else CURR_CMD_INDEX = CURR_CMD_INDEX + 1 end local cmd = COMMAND_HISTORY[CURR_CMD_INDEX] if cmd then return { { SetInputBuffer = cmd }, } end end xplr.fn.custom.command_mode.map = function(mode, key, name) local cmd = COMMANDS[name] if cmd then local messages = { "PopMode" } if cmd.silent then table.insert( messages, { CallLuaSilently = "custom.command_mode.fn." .. name } ) else table.insert(messages, { CallLua = "custom.command_mode.fn." .. name }) end xplr.config.modes.builtin[mode].key_bindings.on_key[key] = { help = cmd.help, messages = messages, } end end end return { setup = setup }
Title = {} function Title:new() local titleOptions = { text = "Snakes!", x = 12.5, y = 2, width = 13, height = 3, fontSize = 3, align = "center" } return display.newText(titleOptions) end return Title
-- Copyright 2008 Steven Barth <[email protected]> -- Copyright 2011 Jo-Philipp Wich <[email protected]> -- Licensed to the public under the Apache License 2.0. local fs = require "nixio.fs" m = Map("system", translate("Router Password")) 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.parse(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 Map.parse(map) end if fs.access("/etc/config/dropbear") then m2 = Map("dropbear", translate("SSH Access")) s = m2:section(TypedSection, "dropbear", translate("Dropbear Instance")) s.anonymous = true s.addremove = true ni = s:option(Value, "Interface", translate("Interface")) ni.template = "cbi/network_netlist" ni.nocreate = true ni.unspecified = true pt = s:option(Value, "Port", translate("Port")) pt.datatype = "port" pt.default = 22 pa = s:option(Flag, "PasswordAuth", translate("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")) ra.enabled = "on" ra.disabled = "off" ra.default = ra.enabled gp = s:option(Flag, "GatewayPorts", translate("Gateway ports")) gp.enabled = "on" gp.disabled = "off" gp.default = gp.disabled s2 = m2:section(TypedSection, "_dummy", translate("SSH-Keys")) 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 function keys.cfgvalue() return fs.readfile("/etc/dropbear/authorized_keys") or "" end function keys.write(self, section, value) return fs.writefile("/etc/dropbear/authorized_keys", value:gsub("\r\n", "\n")) end function keys.remove(self, section, value) return fs.writefile("/etc/dropbear/authorized_keys", "") end end return m, m2
object_tangible_furniture_house_cleanup_xeno_rug = object_tangible_furniture_house_cleanup_shared_xeno_rug:new { } ObjectTemplates:addTemplate(object_tangible_furniture_house_cleanup_xeno_rug, "object/tangible/furniture/house_cleanup/xeno_rug.iff")
--[[ MOB SPAWN LIST mob(<mob_spawner_alias>, <mob_id>, <mob_count>, <spawner_limit>, <spawn_interval>, <spawner_range>, <map_id>, <x_pos>, <y_pos>, <z_pos>); --]] mob("", 101, 1, 2, 10, 9, 1, 5408.55, 5467.28, 12.58); mob("", 102, 1, 2, 10, 9, 1, 5408.55, 5467.28, 12.58); mob("", 102, 1, 2, 10, 9, 1, 5408.55, 5467.28, 12.58); mob("", 101, 2, 3, 20, 38, 1, 5457.87, 5452.51, 9.95); mob("", 101, 1, 3, 20, 38, 1, 5457.87, 5452.51, 9.95); mob("", 102, 1, 3, 20, 38, 1, 5457.87, 5452.51, 9.95); mob("", 102, 2, 3, 20, 38, 1, 5457.87, 5452.51, 9.95); mob("", 101, 3, 3, 20, 38, 1, 5457.87, 5452.51, 9.95); mob("", 103, 2, 3, 20, 38, 1, 5457.87, 5452.51, 9.95); mob("", 205, 1, 3, 20, 38, 1, 5457.87, 5452.51, 9.95); mob("", 316, 1, 7, 14, 10, 1, 5255.551, 5355.771, 6.351748); mob("", 61, 1, 7, 14, 10, 1, 5255.551, 5355.771, 6.351748); mob("", 62, 1, 7, 14, 10, 1, 5255.551, 5355.771, 6.351748); mob("", 62, 2, 3, 12, 11, 1, 5167.25, 5409.56, 10.53); mob("", 316, 2, 7, 7, 10, 1, 5194.13, 5318.71, 1.45); mob("", 317, 1, 7, 7, 10, 1, 5194.13, 5318.71, 1.45); mob("", 301, 2, 7, 7, 10, 1, 5194.13, 5318.71, 1.45); mob("", 101, 2, 6, 17, 22, 1, 5173.85, 5379.46, 8.34); mob("", 102, 1, 6, 17, 22, 1, 5173.85, 5379.46, 8.34); mob("", 62, 1, 6, 17, 22, 1, 5173.85, 5379.46, 8.34); mob("", 101, 2, 6, 17, 22, 1, 5173.85, 5379.46, 8.34); mob("", 316, 2, 7, 18, 10, 1, 5234.39, 5326.31, 1); mob("", 317, 1, 7, 18, 10, 1, 5234.39, 5326.31, 1); mob("", 301, 2, 7, 18, 10, 1, 5234.39, 5326.31, 1); mob("", 316, 2, 7, 13, 15, 1, 5158.43, 5415.31, 10.56); mob("", 317, 1, 7, 13, 15, 1, 5158.43, 5415.31, 10.56); mob("", 318, 1, 7, 13, 15, 1, 5158.43, 5415.31, 10.56); mob("", 301, 2, 7, 13, 15, 1, 5158.43, 5415.31, 10.56); mob("", 101, 2, 6, 12, 25, 1, 5194.09, 5353.36, 6.69); mob("", 102, 1, 6, 12, 25, 1, 5194.09, 5353.36, 6.69); mob("", 62, 1, 6, 12, 25, 1, 5194.09, 5353.36, 6.69); mob("", 101, 2, 6, 12, 25, 1, 5194.09, 5353.36, 6.69); mob("", 101, 1, 6, 12, 25, 1, 5194.09, 5353.36, 6.69); mob("", 102, 1, 6, 12, 25, 1, 5194.09, 5353.36, 6.69); mob("", 101, 2, 2, 7, 29, 1, 5272.08, 5372.85, 5.3); mob("", 102, 1, 2, 7, 29, 1, 5272.08, 5372.85, 5.3); mob("", 102, 2, 2, 7, 29, 1, 5272.08, 5372.85, 5.3); mob("", 101, 1, 2, 7, 29, 1, 5272.08, 5372.85, 5.3); mob("", 103, 1, 2, 7, 29, 1, 5272.08, 5372.85, 5.3); mob("", 102, 1, 5, 13, 30, 1, 5243.8, 5388.21, 8.92); mob("", 101, 1, 5, 13, 30, 1, 5243.8, 5388.21, 8.92); mob("", 101, 2, 5, 13, 30, 1, 5243.8, 5388.21, 8.92); mob("", 102, 2, 5, 13, 30, 1, 5243.8, 5388.21, 8.92); mob("", 103, 1, 5, 13, 30, 1, 5243.8, 5388.21, 8.92); mob("", 316, 2, 3, 15, 16, 1, 5276.83, 5320.87, 0.99); mob("", 302, 1, 3, 15, 16, 1, 5276.83, 5320.87, 0.99); mob("", 301, 2, 3, 15, 16, 1, 5276.83, 5320.87, 0.99); mob("", 102, 1, 6, 8, 41, 1, 5338.492, 5330.355, 1.486084); mob("", 101, 2, 6, 8, 41, 1, 5338.492, 5330.355, 1.486084); mob("", 101, 1, 6, 8, 41, 1, 5338.492, 5330.355, 1.486084); mob("", 102, 2, 6, 8, 41, 1, 5338.492, 5330.355, 1.486084); mob("", 103, 1, 6, 8, 41, 1, 5338.492, 5330.355, 1.486084); mob("", 101, 2, 4, 12, 20, 1, 5377.02, 5394.41, 8.7); mob("", 101, 1, 4, 12, 20, 1, 5377.02, 5394.41, 8.7); mob("", 102, 2, 4, 12, 20, 1, 5377.02, 5394.41, 8.7); mob("", 102, 1, 4, 12, 20, 1, 5377.02, 5394.41, 8.7); mob("", 101, 2, 4, 12, 20, 1, 5377.02, 5394.41, 8.7); mob("", 102, 1, 4, 12, 20, 1, 5377.02, 5394.41, 8.7); mob("", 103, 1, 4, 12, 20, 1, 5377.02, 5394.41, 8.7); mob("", 103, 2, 5, 10, 24, 1, 5423.78, 5418.25, 13.59); mob("", 101, 1, 5, 10, 24, 1, 5423.78, 5418.25, 13.59); mob("", 102, 2, 5, 10, 24, 1, 5423.78, 5418.25, 13.59); mob("", 101, 1, 5, 10, 24, 1, 5423.78, 5418.25, 13.59); mob("", 101, 2, 5, 10, 24, 1, 5423.78, 5418.25, 13.59); mob("", 103, 2, 5, 10, 24, 1, 5423.78, 5418.25, 13.59); mob("", 102, 1, 5, 10, 24, 1, 5423.78, 5418.25, 13.59); mob("", 103, 1, 5, 17, 25, 1, 5371.83, 5327.35, 5.3); mob("", 101, 1, 5, 17, 25, 1, 5371.83, 5327.35, 5.3); mob("", 102, 2, 5, 17, 25, 1, 5371.83, 5327.35, 5.3); mob("", 101, 1, 6, 11, 30, 1, 5318.38, 5395.66, 8.29); mob("", 101, 1, 6, 11, 30, 1, 5318.38, 5395.66, 8.29); mob("", 102, 2, 6, 11, 30, 1, 5318.38, 5395.66, 8.29); mob("", 102, 1, 6, 11, 30, 1, 5318.38, 5395.66, 8.29); mob("", 103, 2, 6, 11, 30, 1, 5318.38, 5395.66, 8.29); mob("", 103, 1, 6, 11, 30, 1, 5318.38, 5395.66, 8.29); mob("", 102, 1, 4, 10, 22, 1, 5469.261, 5398.657, 6.93581); mob("", 101, 1, 4, 10, 22, 1, 5469.261, 5398.657, 6.93581); mob("", 101, 1, 4, 10, 22, 1, 5469.261, 5398.657, 6.93581); mob("", 102, 1, 4, 10, 22, 1, 5469.261, 5398.657, 6.93581); mob("", 62, 2, 2, 10, 23, 1, 5502.748, 5303.553, 0.9610644); mob("", 102, 1, 4, 13, 12, 1, 5465.05, 5348.13, 4.87); mob("", 101, 1, 4, 13, 12, 1, 5465.05, 5348.13, 4.87); mob("", 101, 1, 4, 13, 12, 1, 5465.05, 5348.13, 4.87); mob("", 103, 1, 4, 13, 12, 1, 5465.05, 5348.13, 4.87); mob("", 101, 1, 3, 10, 11, 1, 5464.09, 5311.24, 9.46); mob("", 101, 1, 3, 10, 11, 1, 5464.09, 5311.24, 9.46); mob("", 102, 1, 3, 10, 11, 1, 5464.09, 5311.24, 9.46); mob("", 103, 1, 3, 10, 11, 1, 5464.09, 5311.24, 9.46); mob("", 301, 2, 24, 20, 100, 1, 5238.419, 5171.129, 4.377998); mob("", 301, 3, 14, 16, 85, 1, 5120.826, 5135.664, 10.00001); mob("", 301, 3, 17, 21, 70, 1, 5139.818, 5194.485, 9.999999); mob("", 316, 2, 18, 10, 80, 1, 5198.542, 5155.854, 3.017402); mob("", 317, 3, 18, 10, 80, 1, 5198.542, 5155.854, 3.017402); mob("", 318, 2, 18, 10, 80, 1, 5198.542, 5155.854, 3.017402); mob("", 318, 2, 18, 10, 80, 1, 5198.542, 5155.854, 3.017402); mob("", 101, 1, 5, 12, 29, 1, 5399.752, 5165.522, -2.537158); mob("", 102, 1, 5, 12, 29, 1, 5399.752, 5165.522, -2.537158); mob("", 101, 2, 5, 12, 29, 1, 5399.752, 5165.522, -2.537158); mob("", 101, 1, 5, 12, 29, 1, 5399.752, 5165.522, -2.537158); mob("", 102, 1, 5, 12, 29, 1, 5399.752, 5165.522, -2.537158); mob("", 103, 1, 5, 12, 29, 1, 5399.752, 5165.522, -2.537158); mob("", 101, 2, 5, 18, 58, 1, 5428.13, 5122.24, -0.46); mob("", 63, 1, 5, 18, 58, 1, 5428.13, 5122.24, -0.46); mob("", 64, 2, 5, 18, 58, 1, 5428.13, 5122.24, -0.46); mob("", 101, 1, 5, 18, 58, 1, 5428.13, 5122.24, -0.46); mob("", 102, 1, 5, 18, 58, 1, 5428.13, 5122.24, -0.46); mob("", 205, 1, 5, 18, 58, 1, 5428.13, 5122.24, -0.46); mob("", 102, 1, 5, 18, 58, 1, 5428.13, 5122.24, -0.46); mob("", 62, 1, 6, 12, 28, 1, 5378.83, 5249.99, -1.22); mob("", 302, 1, 6, 12, 28, 1, 5378.83, 5249.99, -1.22); mob("", 63, 1, 6, 12, 28, 1, 5378.83, 5249.99, -1.22); mob("", 101, 2, 6, 12, 28, 1, 5378.83, 5249.99, -1.22); mob("", 102, 1, 6, 12, 28, 1, 5378.83, 5249.99, -1.22); mob("", 102, 2, 2, 13, 24, 1, 5417.54, 5221.85, -2.73); mob("", 101, 1, 2, 13, 24, 1, 5417.54, 5221.85, -2.73); mob("", 101, 2, 2, 13, 24, 1, 5417.54, 5221.85, -2.73); mob("", 102, 1, 2, 13, 24, 1, 5417.54, 5221.85, -2.73); mob("", 103, 1, 2, 13, 24, 1, 5417.54, 5221.85, -2.73); mob("", 102, 1, 2, 13, 24, 1, 5417.54, 5221.85, -2.73); mob("", 101, 1, 2, 13, 24, 1, 5417.54, 5221.85, -2.73); mob("", 101, 2, 4, 7, 17, 1, 5471.8, 5243.42, -2.68); mob("", 102, 1, 4, 7, 17, 1, 5471.8, 5243.42, -2.68); mob("", 101, 1, 4, 7, 17, 1, 5471.8, 5243.42, -2.68); mob("", 316, 2, 5, 10, 9, 1, 5267.82, 5064.14, 0.82); mob("", 317, 1, 5, 10, 9, 1, 5267.82, 5064.14, 0.82); mob("", 301, 1, 5, 10, 9, 1, 5267.82, 5064.14, 0.82); mob("", 61, 1, 3, 12, 16, 1, 5215.61, 5058.33, -0.09); mob("", 62, 1, 3, 12, 16, 1, 5215.61, 5058.33, -0.09); mob("", 63, 1, 2, 10, 12, 1, 5186.86, 5049.12, 0); mob("", 62, 1, 2, 10, 12, 1, 5186.86, 5049.12, 0); mob("", 61, 1, 2, 10, 12, 1, 5186.86, 5049.12, 0); mob("", 63, 1, 3, 16, 25, 1, 5330.486, 5051.842, -0.6644726); mob("", 62, 2, 3, 16, 25, 1, 5330.486, 5051.842, -0.6644726); mob("", 302, 1, 3, 16, 25, 1, 5330.486, 5051.842, -0.6644726); mob("", 63, 1, 3, 16, 25, 1, 5330.486, 5051.842, -0.6644726); mob("", 64, 1, 3, 16, 25, 1, 5330.486, 5051.842, -0.6644726); mob("", 62, 2, 3, 14, 27, 1, 5387.32, 5103.069, -1.226113); mob("", 101, 1, 3, 14, 27, 1, 5387.32, 5103.069, -1.226113); mob("", 102, 1, 3, 14, 27, 1, 5387.32, 5103.069, -1.226113); mob("", 102, 1, 3, 14, 27, 1, 5387.32, 5103.069, -1.226113); mob("", 301, 2, 4, 15, 14, 1, 5285.26, 5043.89, -0.25); mob("", 301, 1, 4, 15, 14, 1, 5285.26, 5043.89, -0.25); mob("", 316, 2, 4, 15, 14, 1, 5285.26, 5043.89, -0.25); mob("", 302, 1, 4, 15, 14, 1, 5285.26, 5043.89, -0.25); mob("", 62, 1, 4, 17, 20, 1, 5378.98, 5059.28, 0.71); mob("", 63, 1, 4, 17, 20, 1, 5378.98, 5059.28, 0.71); mob("", 61, 2, 4, 17, 20, 1, 5378.98, 5059.28, 0.71); mob("", 62, 1, 4, 17, 20, 1, 5378.98, 5059.28, 0.71);
--local abr = minetest.get_mapgen_setting('active_block_range') local node_lava = nil --local min=math.min --local max=math.max --local spawn_rate = 1 - 0.2 --local spawn_reduction = 0.75 local function lava_dmg(self,dmg) node_lava = node_lava or minetest.registered_nodes[minetest.registered_aliases.mapgen_lava_source] if node_lava then local pos=self.object:get_pos() local box = self.object:get_properties().collisionbox local pos1={x=pos.x+box[1],y=pos.y+box[2],z=pos.z+box[3]} local pos2={x=pos.x+box[4],y=pos.y+box[5],z=pos.z+box[6]} local nodes=mobkit.get_nodes_in_area(pos1,pos2) if nodes[node_lava] then mobkit.hurt(self,dmg) end end end local function soldier_brain(self) -- vitals should be checked every step if mobkit.timer(self,1) then lava_dmg(self,6) end mobkit.vitals(self) if self.hp <= 0 then mobkit.clear_queue_high(self) -- cease all activity mobkit.hq_die(self) -- kick the bucket return end if mobkit.timer(self,1) then -- decision making needn't happen every engine step local prty = mobkit.get_queue_priority(self) if prty < 20 and self.isinliquid then mobkit.hq_liquid_recovery(self,20) return end renowned_jam.make_formation_step(self, prty) --local pos=self.object:get_pos() -- -- hunt -- if prty < 10 then -- if not busy with anything important -- local prey = mobkit.get_closest_entity(self,'new_rpg:npc') -- look for prey -- if prey then -- mobkit.hq_hunt(self,10,prey) -- and chase it -- end -- end -- if self._leader then -- if prty < 9 and self._targetPos ~= nil then -- hq_moveto(self, 9, self._targetPos) -- end -- else -- if self._leading_obj ~= nil then -- mobkit.clear_queue_high(self) -- --print(dump(self._leading_obj:get_pos())) -- hq_moveto(self, 9, self._leading_obj:get_pos()) -- else -- if prty < 9 and self._targetPos ~= nil then -- hq_moveto(self, 9, self._targetPos) -- end -- end -- end -- local plyr = mobkit.get_nearby_player(self) -- if plyr and vector.distance(pos,plyr:get_pos()) < 10 then -- if player close -- --mobkit.hq_warn(self,9,plyr) -- try to repel them -- --mobkit.animate(self,"mine") -- --mobkit.make_sound(self, "attack") -- mobkit.hq_follow(self, 9, plyr) -- --print(dump(plyr:get_properties())) -- end -- hq_warn will trigger subsequent bhaviors if needed -- fool around --if mobkit.is_queue_empty_high(self) then --mobkit.hq_roam(self,0) --end end end -- local function spawnstep(dtime) -- for _,plyr in ipairs(minetest.get_connected_players()) do -- if math.random()<dtime*0.2 then -- each player gets a spawn chance every 5s on average -- local vel = plyr:get_player_velocity() -- local spd = vector.length(vel) -- local chance = spawn_rate * 1/(spd*0.75+1) -- chance is quadrupled for speed=4 -- local yaw -- if spd > 1 then -- -- spawn in the front arc -- yaw = plyr:get_look_horizontal() + math.random()*0.35 - 0.75 -- else -- -- random yaw -- yaw = math.random()*math.pi*2 - math.pi -- end -- local pos = plyr:get_pos() -- local dir = vector.multiply(minetest.yaw_to_dir(yaw),abr*16) -- local pos2 = vector.add(pos,dir) -- pos2.y=pos2.y-5 -- local height, liquidflag = mobkit.get_terrain_height(pos2,32) -- if height and height >= 0 and not liquidflag -- and math.abs(height-pos2.y) <= 30 testin -- and mobkit.nodeatpos({x=pos2.x,y=height-0.01,z=pos2.z}).is_ground_content then -- local objs = minetest.get_objects_inside_radius(pos,abr*16+5) -- local ccnt=0 -- for _,obj in ipairs(objs) do -- count mobs in abrange -- if not obj:is_player() then -- local luaent = obj:get_luaentity() -- if luaent and luaent.name:find('renowned_jam:') then -- chance=chance + (1-chance)*spawn_reduction -- chance reduced for every mob in range -- if luaent.name == 'renowned_jam:soldier' then ccnt=ccnt+1 end -- end -- end -- end -- if chance < math.random() then -- -- if no wolves and at least one deer spawn wolf, else deer -- local mobname = "renowned_jam:soldier" -- pos2.y = height+0.5 -- objs = minetest.get_objects_inside_radius(pos2,abr*16-2) -- for _,obj in ipairs(objs) do -- do not spawn if another player around -- if obj:is_player() then return end -- end -- minetest.add_entity(pos2,mobname) -- ok spawn it already damnit -- end -- end -- end -- end -- end local function soldier_actfunc(self, staticdata, dtime_s) mobkit.actfunc(self, staticdata, dtime_s) local props = {} props.textures = self.textures[self.texture_no or 1] self.object:set_properties(props) end minetest.register_entity("renowned_jam:soldier", { -- common props physical = true, stepheight = 0.6, collide_with_objects = true, collisionbox = {-0.3, 0.0, -0.3, 0.3, 1.7, 0.3}, visual = "mesh", mesh = "3d_armor_character.b3d", textures = { { "character.png", "3d_armor_trans.png^3d_armor_helmet_steel.png^3d_armor_chestplate_steel.png^" .. "shields_shield_steel.png^3d_armor_leggings_steel.png^3d_armor_boots_steel.png", wieldview:get_item_texture("default:sword_steel") }, }, visual_size = {x = 1, y = 1}, static_save = true, makes_footstep_sound = true, on_step = mobkit.stepfunc, on_activate = soldier_actfunc, get_staticdata = mobkit.statfunc, -- api props springiness=0, buoyancy = 0.75, -- portion of hitbox submerged max_speed = 5, jump_height = 1.26, view_range = 24, lung_capacity = 20, -- seconds max_hp = 20, timeout=600, attack={ range=1, damage_groups={fleshy=6}}, sounds = { attack='renowned_jam_man_fight', warn = 'renowned_jam_man_yell', mumble = 'renowned_jam_man_mumble', }, animation = { stand={range={x=0,y=79},speed=30,loop=true}, lay={range={x=162,y=166},speed=30,loop=true}, walk={range={x=168,y=187},speed=30,loop=true}, mine={range={x=189,y=198},speed=30,loop=true}, walk_mine={range={x=200,y=219},speed=30,loop=true}, sit={range={x=81,y=160},speed=30,loop=true}, }, brainfunc = soldier_brain, on_punch=function(self, puncher, time_from_last_punch, tool_capabilities, dir) if mobkit.is_alive(self) then local hvel = vector.multiply(vector.normalize({x=dir.x,y=0,z=dir.z}),4) self.object:set_velocity({x=hvel.x,y=2,z=hvel.z}) mobkit.hurt(self,tool_capabilities.damage_groups.fleshy or 1) -- if type(puncher)=='userdata' and puncher:is_player() then -- if hit by a player -- mobkit.clear_queue_high(self) -- abandon whatever they've been doing -- mobkit.hq_hunt(self,10,puncher) -- get revenge -- end end end, on_rightclick = function(self, clicker) print(dump(clicker:get_properties())) end, })
AuctionatorBuyingItemTooltipMixin = {} function AuctionatorBuyingItemTooltipMixin:OnLoad() Auctionator.EventBus:Register(self, { Auctionator.Buying.Events.Show }) end function AuctionatorBuyingItemTooltipMixin:OnEnter() GameTooltip:SetOwner(self, "ANCHOR_TOP") GameTooltip:SetHyperlink(self.itemLink) GameTooltip:Show() end function AuctionatorBuyingItemTooltipMixin:OnLeave() GameTooltip:Hide() end function AuctionatorBuyingItemTooltipMixin:ReceiveEvent(eventName, eventData) self.itemLink = eventData.itemLink self.Icon:SetTexture(eventData.iconTexture) self.Text:SetText(eventData.itemName) end
--------------------------------------------- -- Geist Wall -- -- Description: Party memory erase. -- Type: Enfeebling -- Notes: Removes one detrimental magic effect for party members within area of effect. --------------------------------------------- require("scripts/globals/monstertpmoves") require("scripts/globals/settings") require("scripts/globals/status") require("scripts/globals/msg") --------------------------------------------- function onMobSkillCheck(target, mob, skill) return 0 end function onMobWeaponSkill(target, mob, skill) local dispel = target:eraseStatusEffect() if (dispel == tpz.effect.NONE) then -- no effect skill:setMsg(tpz.msg.basic.SKILL_NO_EFFECT) -- no effect else skill:setMsg(tpz.msg.basic.SKILL_ERASE) end return dispel end
----------------------------------- -- Area: Palborough Mines -- NM: Qu'Vho Deathhurler ----------------------------------- mixins = {require("scripts/mixins/job_special")} require("scripts/globals/hunts") ----------------------------------- function onMobDeath(mob, player, isKiller) tpz.hunts.checkHunt(mob, player, 221) end function onMobDespawn(mob) UpdateNMSpawnPoint(mob:getID()) mob:setRespawnTime(math.random(3600, 4200)) end
--[[ Copyright (c) 2009 Peter "Corsix" Cawley 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 object = {} object.id = "screen" object.thob = 16 object.name = _S.object.screen object.tooltip = _S.tooltip.objects.screen object.ticks = false object.build_preview_animation = 926 object.show_in_town_map = true object.idle_animations = { north = 1022, } object.orientations = { north = { footprint = { {-1, -1, only_passable = true}, {-1, 0}, {0, -1}, {0, 0} }, render_attach_position = {-1, 0}, use_position = "passable", }, } return object
local skynet = require "skynet" function main() skynet.newservice("httplistener", skynet.getenv("LOGIN_WEB_PORT")) skynet.newservice("mongo") skynet.call("mongo", "lua", "start") skynet.newservice("account_mgr") skynet.call("account_mgr", "lua", "start") skynet.exit() end skynet.start(main)
--GLOBAL.CHEATS_ENABLED = true --GLOBAL.require( 'debugkeys' ) Assets = { Asset("ANIM", "anim/ATTACK_level_meter.zip"), Asset("ANIM", "anim/BUILD_level_meter.zip"), Asset("ANIM", "anim/CHOP_level_meter.zip"), Asset("ANIM", "anim/DIG_level_meter.zip"), Asset("ANIM", "anim/EAT_level_meter.zip"), Asset("ANIM", "anim/MINE_level_meter.zip"), Asset("ANIM", "anim/PICK_level_meter.zip"), Asset("ANIM", "anim/PLANT_level_meter.zip"), Asset("ATLAS", "images/dsmmo_recipes.xml"), Asset("ATLAS", "images/dsmmo_ui.xml") } local ui_elements = {} if not GLOBAL.KnownModIndex:IsModEnabled("DsMMO") then --if we are on a single player world, this would mess everything up. ModRPCs are a mess. Why is this necessary anyway...? AddModRPCHandler("DsMMO", "client_enabled", function() print("If this is in your log, something went terribly wrong") end) AddModRPCHandler("DsMMO", "client_is_setup", function() print("If this is in your log, something went terribly wrong") end) AddModRPCHandler("DsMMO", "use_cannibalism_skill", function() print("If this is in your log, something went terribly wrong") end) end --if not GLOBAL.TheNet or not GLOBAL.TheNet:GetIsServer() then if not GLOBAL.TheNet or not GLOBAL.TheNet:IsDedicated() then AddClassPostConstruct("widgets/statusdisplays", function(self) ui_elements.statusdisplays = self end) AddClassPostConstruct("widgets/controls", function(self) ui_elements.right_root = self.right_root end) AddPlayerPostInit(function(player) player:DoTaskInTime(3, function(player) if player.HUD == nil then print("not player") return end player:AddComponent("DsMMO_client") player.components.DsMMO_client:add_display(ui_elements) end) end) end
function Altor_OnCombat(Unit, Event) Unit:SendChatMessage(14, 0, "You dare tread in the Halls of Old?! I'll send you back to your wretched hovels!") Unit:RegisterEvent("ThunderClap", 10000, 0) Unit:RegisterEvent("ConstrictingChains", 20000, 0) Unit:RegisterEvent("CharredEarth", 15000, 0) end function ThunderClap(Unit, Event) Unit:FullCastSpellOnTarget(56062, Unit:GetRandomPlayer(0)) end function ConstrictingChains(Unit, Event) Unit:FullCastSpellOnTarget(58823, Unit:GetRandomPlayer(0)) end function CharredEarth(Unit, Event) Unit:FullCastSpellOnTarget(30129, Unit:GetRandomPlayer(0)) end function Altor_OnLeaveCombat(Unit, Event) Unit:RemoveEvents() end function Altor_OnKilledTarget(Unit, Event) Unit:SendChatMessage(14, 0, "The price paid for setting foot in the halls of the old gods!") end function Altor_OnDied(Unit, Event, Player) Unit:SendChatMessage(14, 0, "I have failed. May the creator smite your wretched souls.") Unit:RemoveEvents() for k,v in pairs(GetPlayersInWorld()) do v:SendBroadcastMessage("" ..Player:GetName().."[" ..Player:GetLevel().. "] has slain " ..Unit:GetName().."!") end end RegisterUnitEvent(700002,1,"Altor_OnCombat") RegisterUnitEvent(700002,2,"Altor_OnLeaveCombat") RegisterUnitEvent(700002,3,"Altor_OnKilledTarget") RegisterUnitEvent(700002,4,"Altor_OnDied")
--- === BrightnessControl === --- --- Enters a transient mode in which the left and right arrow keys decrease and increase the system's brightness, respectively. local Hotkey = require("hs.hotkey") local Eventtap = require("hs.eventtap") local obj = {} obj.__index = obj obj.name = "BrightnessControl" obj.version = "1.0" obj.author = "roeybiran <[email protected]>" obj.homepage = "https://github.com/Hammerspoon/Spoons" obj.license = "MIT - https://opensource.org/licenses/MIT" local brightnessControlModal = nil local function systemKey(key) Eventtap.event.newSystemKeyEvent(string.upper(key), true):post() Eventtap.event.newSystemKeyEvent(string.upper(key), false):post() end local function increaseBrightness() systemKey("BRIGHTNESS_UP") end local function decreaseBrightness() systemKey("BRIGHTNESS_DOWN") end --- BrightnessControl:start() --- Method --- Starts the module. function obj.start() brightnessControlModal:enter() end --- BrightnessControl:stop() --- Method --- Stops the module. Bound to the escape and return keys. function obj.stop() brightnessControlModal:exit() end --- BrightnessControl.increaseBrightnessKey --- Variable --- A hotkey that increases brightness. It's a table that must include 2 keys, "mods" and "key", each must be of the same type as the first 2 parameters to the `hs.hotkey.bind` method. Defaults to →. obj.increaseBrightnessKey = {mods = {}, key = "right"} --- BrightnessControl.decreaseBrightnessKey --- Variable --- A hotkey that decreases brightness. It's a table that must include 2 keys, "mods" and "key", each must be of the same type as the first 2 parameters to the `hs.hotkey.bind` method. Defaults to ←. obj.decreaseBrightnessKey = {mods = {}, key = "left"} function obj.init() brightnessControlModal = Hotkey.modal.new() brightnessControlModal:bind( obj.increaseBrightnessKey.mods, obj.increaseBrightnessKey.key, nil, increaseBrightness, increaseBrightness, nil ) brightnessControlModal:bind( obj.decreaseBrightnessKey.mods, obj.decreaseBrightnessKey.key, nil, decreaseBrightness, decreaseBrightness, nil ) brightnessControlModal:bind({}, "escape", nil, obj.stop, nil, nil) brightnessControlModal:bind({}, "return", nil, obj.stop, nil, nil) end return obj
-------------------------------- -- @module LayerColor -- @extend Layer,BlendProtocol -- @parent_module cc ---@class cc.LayerColor:cc.Layer,cc.BlendProtocol local LayerColor = {} cc.LayerColor = LayerColor -------------------------------- --- Change width and height in Points. --- param w The width of layer. --- param h The Height of layer. --- since v0.8 ---@param w number ---@param h number ---@return cc.LayerColor function LayerColor:changeWidthAndHeight(w, h) end -------------------------------- --- BlendFunction. Conforms to BlendProtocol protocol --- lua NA ---@return cc.BlendFunc function LayerColor:getBlendFunc() end -------------------------------- --- code --- When this function bound into js or lua,the parameter will be changed --- In js: var setBlendFunc(var src, var dst) --- In lua: local setBlendFunc(local src, local dst) --- endcode ---@param blendFunc cc.BlendFunc ---@return cc.LayerColor function LayerColor:setBlendFunc(blendFunc) end -------------------------------- --- Change width in Points. --- param w The width of layer. ---@param w number ---@return cc.LayerColor function LayerColor:changeWidth(w) end -------------------------------- --- ---@param color color4b_table ---@param width number ---@param height number ---@return boolean ---@overload fun(self:cc.LayerColor, color:color4b_table):boolean function LayerColor:initWithColor(color, width, height) end -------------------------------- --- Change height in Points. --- param h The height of layer. ---@param h number ---@return cc.LayerColor function LayerColor:changeHeight(h) end -------------------------------- --- Creates a Layer with color, width and height in Points.<br> -- param color The color of layer.<br> -- param width The width of layer.<br> -- param height The height of layer.<br> -- return An autoreleased LayerColor object. ---@param color color4b_table ---@param width number ---@param height number ---@return cc.LayerColor ---@overload fun(self:cc.LayerColor):cc.LayerColor ---@overload fun(self:cc.LayerColor, color:color4b_table):cc.LayerColor function LayerColor:create(color, width, height) end -------------------------------- --- ---@param renderer cc.Renderer ---@param transform mat4_table ---@param flags number ---@return cc.LayerColor function LayerColor:draw(renderer, transform, flags) end -------------------------------- --- ---@return boolean function LayerColor:init() end -------------------------------- --- ---@param var size_table ---@return cc.LayerColor function LayerColor:setContentSize(var) end -------------------------------- --- ---@return cc.LayerColor function LayerColor:LayerColor() end return nil
FAdmin.StartHooks["Chatmute"] = function() FAdmin.Access.AddPrivilege("Chatmute", 2) FAdmin.Commands.AddCommand("Chatmute", nil, "<Player>") FAdmin.Commands.AddCommand("UnChatmute", nil, "<Player>") FAdmin.ScoreBoard.Player:AddActionButton(function(ply) if ply:FAdmin_GetGlobal("FAdmin_chatmuted") then return "Unmute chat" end return "Mute chat" end, function(ply) if ply:FAdmin_GetGlobal("FAdmin_chatmuted") then return "FAdmin/icons/chatmute" end return "FAdmin/icons/chatmute", "FAdmin/icons/disable" end, Color(255, 130, 0, 255), function(ply) return FAdmin.Access.PlayerHasPrivilege(LocalPlayer(), "Chatmute", ply) end, function(ply, button) if not ply:FAdmin_GetGlobal("FAdmin_chatmuted") then FAdmin.PlayerActions.addTimeMenu(function(secs) RunConsoleCommand("_FAdmin", "chatmute", ply:UserID(), secs) button:SetImage2("null") button:SetText("Unmute chat") button:GetParent():InvalidateLayout() end) else RunConsoleCommand("_FAdmin", "UnChatmute", ply:UserID()) end button:SetImage2("FAdmin/icons/disable") button:SetText("Mute chat") button:GetParent():InvalidateLayout() end) end
local wv_util = {} local debug_checks = working_villages.setting_enabled("debug_checks",true) function wv_util.get_euclidean_neighbors() local base = vector.new() local neigh = {} for _,v in pairs({"x","y","z"}) do local pos, neg = vector.new(base),vector.new(base) pos[v] = 1 neg[v] = -1 neigh["+"..v] = pos neigh["-"..v] = neg end return neigh end --TODO: add generator to iterate through euclidean neigbors spiraling outward function wv_util.get_eneigbor_offsets(radius,adjacent) local r = radius or 1 local a = adjacent or "xzy" if type(a) == "string" then local n = wv_util.get_euclidean_neighbors() local tab = {} for l in a:gmatch(".") do table.insert(tab,n["+"..l]) table.insert(tab,n["-"..l]) end a = tab elseif type(a) == "table" then if debug_checks then for i,v in ipairs(a) do assert(type(v) == "table","neigbor distance table contains non-table element at "..i..": "..dump(v)) assert(type(v.x) == "number", "neigbor distance table has no x value in element "..i) assert(type(v.y) == "number", "neigbor distance table has no y value in element "..i) assert(type(v.z) == "number", "neigbor distance table has no z value in element "..i) end end else error("expected string or table as third argument (neighbor distances)",2) end local list = {vector.new()} local lb = {list[1]} local hs = {} for d = 1,r do local nb = {} for _,b in ipairs(lb) do for _,n in ipairs(a) do local off = vector.add(n,b) local hash = (off.x + r) + (off.y + r) * ((r+1) * 2) + (off.z + r) * ((r+1) * 2)^2 if hash < 0 then print("oof") end if not hs[hash] then hs[hash] = true table.insert(list,off) table.insert(nb,off) end end end lb = nb end return list end return wv_util
---@class AceDB-3.0 local AceDB = {} ---@class AceDBObject-3.0 ---@field profile table Contains the active profile ---@field profiles table Contains all profiles ---@field keys table ---@field sv table ---@field defaults table Cache of defaults ---@field parent table local DBObjectLib = {} ---@param defaults table A table of defaults for this database --- --- ---[Documentation](https://www.wowace.com/projects/ace3/pages/api/ace-db-3-0#title-8) function DBObjectLib:RegisterDefaults(defaults) end ---@param name string The name of the profile to set as the current profile --- Callback: OnProfileChanged, database, newProfileKey --- --- ---[Documentation](https://www.wowace.com/projects/ace3/pages/api/ace-db-3-0#title-12) function DBObjectLib:SetProfile(name) end ---@return table #Contains the names of the existing profiles in the database. ---@param tbl table A table to store the profile names in (optional) --- --- ---[Documentation](https://www.wowace.com/projects/ace3/pages/api/ace-db-3-0#title-7) function DBObjectLib:GetProfiles(tbl) end ---@return string -- Returns the current profile name used by the database --- --- ---[Documentation](https://www.wowace.com/projects/ace3/pages/api/ace-db-3-0#title-5) function DBObjectLib:GetCurrentProfile() end ---@param name string The name of the profile to be deleted ---@param silent? boolean If true, do not raise an error when the profile does not exist --- --- ---[Documentation](https://www.wowace.com/projects/ace3/pages/api/ace-db-3-0#title-4) function DBObjectLib:DeleteProfile(name, silent) end ---@param name string The name of the profile to be copied into the current profile ---@param silent? boolean If true, do not raise an error when the profile does not exist --- --- ---[Documentation](https://www.wowace.com/projects/ace3/pages/api/ace-db-3-0#title-3) function DBObjectLib:CopyProfile(name, silent) end ---@param noChildren boolean if set to true, the reset will not be populated to the child namespaces of this DB object ---@param noCallbacks boolean if set to true, won't fire the OnProfileReset callback --- --- ---[Documentation](https://www.wowace.com/projects/ace3/pages/api/ace-db-3-0#title-11) function DBObjectLib:ResetProfile(noChildren, noCallbacks) end ---@param defaultProfile string The profile name to use as the default --- --- ---[Documentation](https://www.wowace.com/projects/ace3/pages/api/ace-db-3-0#title-10) function DBObjectLib:ResetDB(defaultProfile) end ---@param name string The name of the new namespace ---@param defaults table A table of values to use as defaults ---@return AceDBObject-3.0 The created database --- --- ---[Documentation](https://www.wowace.com/projects/ace3/pages/api/ace-db-3-0#title-9) function DBObjectLib:RegisterNamespace(name, defaults) end ---@param name string The name of the new namespace ---@param silent? boolean if true, the addon is optional, silently return nil if its not found ---@return table -- the namespace object if found --- --- ---[Documentation](https://www.wowace.com/projects/ace3/pages/api/ace-db-3-0#title-6) function DBObjectLib:GetNamespace(name, silent) end --[[------------------------------------------------------------------------- AceDB Exposed Methods ---------------------------------------------------------------------------]] ---@param tbl string|table The name of variable, or table to use for the database ---@param defaults? table A table of database defaults ---@param defaultProfile? string|boolean The name of the default profile. If not set, a character specific profile will be used as the default. ---@return AceDBObject-3.0 DB --- --- ---[Documentation](https://www.wowace.com/projects/ace3/pages/api/ace-db-3-0#title-2) function AceDB:New(tbl, defaults, defaultProfile) end
--[[ luws.lua - Luup WebSocket implemented (for Vera Luup and openLuup systems) Copyright 2020 Patrick H. Rigney, All Rights Reserved. http://www.toggledbits.com/ Works best with SockProxy installed. Ref: RFC6455 NOTA BENE: 64-bit payload length not supported. See CHANGELOG.md for release notes at https://github.com/toggledbits/LuWS --]] --luacheck: std lua51,module,read globals luup,ignore 542 611 612 614 111/_,no max line length module("luws", package.seeall) _VERSION = 20358 debug_mode = false local math = require "math" local string = require "string" local socket = require "socket" local bit = require "bit" -- local ltn12 = require "ltn12" -- local WSGUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" local STATE_START = "start" local STATE_READLEN1 = "len" local STATE_READLEN161 = "len16-1" local STATE_READLEN162 = "len16-2" local STATE_READDATA = "data" local STATE_SYNC = "sync" -- local STATE_RESYNC1 = "resync1" -- local STATE_RESYNC2 = "resync2" local STATE_READMASK = "mask" local MAXMESSAGE = 65535 -- maximum WS message size local CHUNKSIZE = 2048 local DEFAULTMSGTIMEOUT = 0 -- drop connection if no message in this time (0=no timeout) local timenow = socket.gettime or os.time -- use hi-res time if available local unpack = unpack or table.unpack -- luacheck: ignore 143 local LOG = (luup and luup.log) or ( function(msg,level) print(level or 50,msg) end ) function dump(t, seen) if t == nil then return "nil" end if seen == nil then seen = {} end local sep = "" local str = "{ " for k,v in pairs(t) do local val if type(v) == "table" then if seen[v] then val = "(recursion)" else seen[v] = true val = dump(v, seen) end elseif type(v) == "string" then if #v > 255 then val = string.format("%q", v:sub(1,252).."...") else val = string.format("%q", v) end elseif type(v) == "number" and (math.abs(v-os.time()) <= 86400) then val = tostring(v) .. "(" .. os.date("%x.%X", v) .. ")" else val = tostring(v) end str = str .. sep .. k .. "=" .. val sep = ", " end str = str .. " }" return str end local function L(msg, ...) -- luacheck: ignore 212 local str local level = 50 if type(msg) == "table" then str = "luws: " .. tostring(msg.msg or msg[1]) level = msg.level or level else str = "luws: " .. tostring(msg) end str = string.gsub(str, "%%(%d+)", function( n ) n = tonumber(n, 10) if n < 1 or n > #arg then return "nil" end local val = arg[n] if type(val) == "table" then return dump(val) elseif type(val) == "string" then return string.format("%q", val) elseif type(val) == "number" and math.abs(val-os.time()) <= 86400 then return tostring(val) .. "(" .. os.date("%x.%X", val) .. ")" end return tostring(val) end ) LOG(str, level) end local function D(msg, ...) if debug_mode then L( { msg=msg, prefix="luws[debug]: " }, ... ) end end local function default( val, dflt ) return ( val == nil ) and dflt or val end local function split( str, sep ) sep = sep or "," local arr = {} if str == nil or #str == 0 then return arr, 0 end local rest = string.gsub( str or "", "([^" .. sep .. "]*)" .. sep, function( m ) table.insert( arr, m ) return "" end ) table.insert( arr, rest ) return arr, #arr end -- Upgrade an HTTP socket to websocket local function wsupgrade( wsconn ) D("wsupgrade(%1)", wsconn) local mime = require "mime" -- Upgrade headers. Map/dict provided; flatten to array and join. local uhead = {} for k,v in pairs( wsconn.options.upgrade_headers or {} ) do table.insert( uhead, k .. ": " .. v ) end uhead = table.concat( uhead, "\r\n" ); -- Generate key/nonce, 16 bytes base64-encoded local key = {} for k=1,16 do key[k] = string.char( math.random( 0, 255 ) ) end key = mime.b64( table.concat( key, "" ) ) -- Ref: https://stackoverflow.com/questions/18265128/what-is-sec-websocket-key-for local req = string.format("GET %s HTTP/1.1\r\nHost: %s\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Key: %s\r\nSec-WebSocket-Version: 13\r\n%s\r\n", wsconn.path, wsconn.ip, key, uhead) -- Send request. D("wsupgrade() sending %1", req) wsconn.socket:settimeout( 5, "b" ) wsconn.socket:settimeout( 5, "r" ) local nb,err = wsconn.socket:send( req ) if nb == nil then return false, "Failed to send upgrade request: "..tostring(err) end -- Read until we get two consecutive linefeeds. wsconn.socket:settimeout( 5, "b" ) wsconn.socket:settimeout( 5, "r" ) local buf = {} local ntotal = 0 while true do nb,err = wsconn.socket:receive("*l") D("wsupgrade() received %1, %2", nb, err) if nb == nil then L("wsupgrade() error while reading upgrade response, %1", err) return false end if #nb == 0 then break end -- blank line ends table.insert( buf, nb ) ntotal = ntotal + #nb if ntotal >= MAXMESSAGE then buf = {} L({level=1,msg="Buffer overflow reading websocket upgrade response; aborting."}) break; end end -- Check response -- local resp = table.concat( buf, "\n" ) D("wsupdate() upgrade response: %1", buf) if buf[1]:match( "^HTTP/1%.. 101 " ) then -- ??? check response key TO-DO D("wsupgrade() upgrade succeeded!") wsconn.readstate = STATE_START return true -- Flag now in websocket protocol end return false, "upgrade failed; "..tostring(buf[1]) end local function connect( ip, port ) local sock = socket.tcp() if not sock then return nil, "Can't get socket for connection" end sock:settimeout( 15 ) local r, e = sock:connect( ip, port ) if r then return sock end pcall( function() sock:close() end ) -- crash resistant return nil, string.format("Connection to %s:%s failed: %s", ip, port, tostring(e)) end function wsopen( url, handler, options ) D("wsopen(%1)", url) options = options or {} options.receive_timeout = default( options.receive_timeout, DEFAULTMSGTIMEOUT ) options.receive_chunk_size = default( options.receive_chunk_size, CHUNKSIZE ) options.max_payload_size = default( options.max_payload_size, MAXMESSAGE ) options.use_masking = default( options.use_masking, true ) -- RFC required, but settable options.connect = default( options.connect, connect ) options.control_handler = default( options.control_handler, nil ) options.upgrade_headers = default( options.upgrade_headers, nil ) local port local proto, ip, ps = url:match("^(wss?)://([^:/]+)(.*)") if not proto then error("Invalid protocol/address for WebSocket open in " .. url) end port = proto == "wss" and 443 or 80 local p,path = ps:match("^:(%d+)(.*)") if p then port = tonumber(p) or port else path = ps end if path == "" then path = "/" end local wsconn = {} wsconn.connected = false wsconn.proto = proto wsconn.ip = ip wsconn.port = port wsconn.path = path wsconn.readstate = STATE_START wsconn.msg = nil wsconn.msghandler = handler wsconn.options = options -- This call is async -- it returns immediately. local sock,err = options.connect( ip, port ) if not sock then return false, err end wsconn.socket = sock wsconn.socket:setoption( 'keepalive', true ) if proto == "wss" then D("wsopen() preping for SSL connection") local ssl = require "ssl" local opts = { mode=default( options.ssl_mode, 'client' ) , verify=default( options.ssl_verify, 'none' ) , protocol=default( options.ssl_protocol, (ssl._VERSION or ""):match( "^0%.[654]" ) and 'tlsv1_2' or 'any' ) , options=split( default( options.ssl_options, 'all' ) ) } D("wsopen() wrap %1 %2", wsconn.socket, opts) sock = ssl.wrap( wsconn.socket, opts ) D("wsopen() starting handshake"); if sock and sock:dohandshake() then D("wsopen() successful SSL/TLS negotiation") wsconn.socket = sock -- save wrapped socket else D("wsopen() failed SSL negotation") wsconn.socket:close() wsconn.socket = nil return false, "Failed SSL negotation" end end D("wsopen() upgrading connection to WebSocket") local st st,err = wsupgrade( wsconn ) if st then wsconn.connected = true wsconn.lastMessage = timenow() wsconn.lastPing = timenow() local m = getmetatable(wsconn) or {} m.__tostring = function( o ) return string.format("luws-websock[%s:%s]", o.ip, o.port) end -- m.__newindex = function( o, n, v ) error("Immutable luws-websock, can't set "..n) end setmetatable(wsconn, m) D("wsopen() successful WebSocket startup, wsconn %1", wsconn) return wsconn end pcall( function() wsconn.socket:close() end ) -- crash-resistant wsconn.socket = nil return false, err end local function send_frame( wsconn, opcode, fin, s ) D("send_frame(%1,%2,%3,<%4 bytes>)", wsconn, opcode, fin, #s) local mask = wsconn.options.use_masking local t = {} local b = bit.bor( fin and 0x80 or 0, opcode ) table.insert( t, string.char(b) ) if #s < 126 then table.insert( t, string.char(#s + ( mask and 128 or 0)) ) elseif #s < 65536 then table.insert( t, string.char(126 + ( mask and 128 or 0)) ) -- indicate 16-bit length follows table.insert( t, string.char( math.floor( #s / 256 ) ) ) table.insert( t, string.char( #s % 256 ) ) else -- We don't currently support 64-bit frame length (caller shouldn't be trying, either) error("Super-long frame length not implemented") end local frame if mask then -- Generate mask and append to frame. local mb = { 0,0,0,0 } for k=1,4 do mb[k] = math.random(0,255) table.insert( t, string.char( mb[k] ) ) end D("send_frame() mask bytes %1", string.format( "%02x %02x %02x %02x", mb[1], mb[2], mb[3], mb[4] ) ) -- Apply mask to data and append. for k=1,#s do table.insert( t, string.char( bit.bxor( string.byte( s, k ), mb[((k-1)%4)+1] ) ) ) end frame = table.concat( t, "" ) else -- No masking, just concatenate string as we got it (not RFC for client). frame = table.concat( t, "" ) .. s end t = nil -- luacheck: ignore 311 D("send_frame() sending frame of %1 bytes for %2", #frame, s) wsconn.socket:settimeout( 5, "b" ) wsconn.socket:settimeout( 5, "r" ) -- ??? need retry while nb < payload length while #frame > 0 do local nb,err = wsconn.socket:send( frame ) if not nb then return false, "send error: "..tostring(err) end frame = frame:sub( nb + 1 ) end return true end -- Send WebSocket message (opcode and payload). The payload can be an LTN12 source, -- in which case each chunk from the source is sent as a fragment. function wssend( wsconn, opcode, s ) D("wssend(%1,%2,%3)", wsconn, opcode, s) if not ( wsconn and wsconn.connected ) then return false, "not connected" end if wsconn.closing then return false, "closing" end if opcode == 0x08 then wsconn.closing = true -- sending close frame end if type(s) == "function" then -- A function as data is assumed to be an LTN12 source local chunk, err = s() -- get first chunk while chunk do local next_chunk, nerr = s() -- get another local fin = next_chunk == nil -- no more? assert( #chunk < 65536, "LTN12 source returned excessively long chunk" ) send_frame( wsconn, opcode, fin, chunk ) -- send last opcode = 0 -- continuations from here out chunk,err = next_chunk, nerr -- new becomes last end return err == nil, err end -- Send as string buffer if type(s) ~= "string" then s = tostring(s) end if #s < 65535 then return send_frame( wsconn, opcode, true, s ) -- single frame else -- Long goes out in 64K-1 chunks; op + noFIN first, op0 + noFIN continuing, op0+FIN final. repeat local chunk = s:sub( 1, 65535 ) s = s:sub( 65536 ) local fin = #s == 0 -- fin when out of data (last chunk) if not send_frame( wsconn, opcode, fin, chunk ) then return false, "send error" end opcode = 0 -- all following fragments go as continuation until #s == 0 end return true end -- Disconnect websocket interface, if connected (safe to call any time) function wsclose( wsconn ) D("wsclose(%1)", wsconn) if wsconn then -- This is not in keeping with the RFC, but may be as good as we can reliably do. -- We don't wait for a close reply, just send it and shut down. if wsconn.socket and wsconn.connected and not wsconn.closing then wsconn.closing = true wssend( wsconn, 0x08, "" ) end if wsconn.socket then pcall( function() wsconn.socket:close() end ) -- crash-resistant wsconn.socket = nil end wsconn.connected = false end end -- Handle a control frame. Caller is given option first. local function handle_control_frame( wsconn, opcode, data ) D("handle_control_frame(%1,%2,%3)", wsconn, opcode, data ) if wsconn.options.control_handler and false == wsconn.options.control_handler( wsconn, opcode, data, unpack(wsconn.options.handler_args or {}) ) then -- If custom handler returns exactly boolean false, don't do default actions return end if opcode == 0x08 then -- close if not wsconn.closing then wsconn.closing = true wssend( wsconn, 0x08, "" ) end -- Notify pcall( wsconn.msghandler, wsconn, false, "receiver error: closed", unpack(wsconn.options.handler_args or {}) ) elseif opcode == 0x09 then -- Ping. Reply with pong. wssend( wsconn, 0x0a, "" ) elseif opcode == 0x0a then -- Pong; no action else -- Other unsupported control frame end end -- Take incoming fragment and accumulate into message (or, maybe it's the whole -- message, or a control message). Dispatch complete and control messages. -- ??? best application for LTN12 here? local function wshandlefragment( fin, op, data, wsconn ) -- D("wshandlefragment(%1,%2,<%3 bytes>,%4)", fin, op, #data, wsconn) if fin then -- FIN frame wsconn.lastMessage = timenow() wsconn.lastPing = timenow() -- any complete frame advances ping timer if op >= 8 then handle_control_frame( wsconn, op, data ) return elseif (wsconn.msg or "") == "" then -- Control frame or FIN on first packet, handle immediately, no copy/buffering D("wshandlefragment() fast dispatch %1 byte message for op %2", #data, op) return pcall( wsconn.msghandler, wsconn, op, data, unpack(wsconn.options.handler_args or {}) ) end -- Completion of continuation; RFC6455 requires final fragment to be op 0 (we tolerate same op) if op ~= 0 and op ~= wsconn.msgop then return pcall( wsconn.msghandler, wsconn, false, "ws completion error", unpack(wsconn.options.handler_args or {}) ) end -- Append to buffer and send message local maxn = math.max( 0, wsconn.options.max_payload_size - #wsconn.msg ) if maxn < #data then D("wshandlefragment() buffer overflow, have %1, incoming %2, max %3; message truncated.", #wsconn.msg, #data, wsconn.options.max_payload_size) end if maxn > 0 then wsconn.msg = wsconn.msg .. data:sub(1, maxn) end D("wshandlefragment() dispatch %2 byte message for op %1", wsconn.msgop, #wsconn.msg) wsconn.lastMessage = timenow() local ok, err = pcall( wsconn.msghandler, wsconn, wsconn.msgop, wsconn.msg, unpack(wsconn.options.handler_args or {}) ) if not ok then L("wsandlefragment() message handler threw error:", err) end wsconn.msg = nil else -- No FIN if (wsconn.msg or "") == "" then -- First fragment, also save op (first determines for all) -- D("wshandlefragment() no fin, first fragment") wsconn.msgop = op wsconn.msg = data else -- D("wshandlefragment() no fin, additional fragment") -- RFC6455 requires op on continuations to be 0. if op ~= 0 then return pcall( wsconn.msghandler, wsconn, false, "ws continuation error", unpack(wsconn.options.handler_args or {}) ) end local maxn = math.max( 0, wsconn.options.max_payload_size - #wsconn.msg ) if maxn < #data then L("wshandlefragment() buffer overflow, have %1, incoming %2, max %3; message truncated", #wsconn.msg, #data, wsconn.options.max_payload_size) end if maxn > 0 then wsconn.msg = wsconn.msg .. data:sub(1, maxn) end end end end -- Unmask buffered data fragments local function unmask( fragt, maskt ) local r = {} for _,d in ipairs( fragt or {} ) do for l=1,#d do local k = (#r % 4) + 1 -- convenient table.insert( r, string.char( bit.bxor( string.byte( d, l ), maskt[k] ) ) ) end end return table.concat( r, "" ) end -- Handle a block of data. The block does not need to contain an entire message -- (or fragment). A series of blocks as small as one byte can be passed and the -- message accumulated properly within the protocol. function wshandleincoming( data, wsconn ) D("wshandleincoming(<%1 bytes>,%2) in state %3", #data, wsconn, wsconn.readstate) local state = wsconn local ix = 1 while ix <= #data do local b = data:byte( ix ) -- D("wshandleincoming() at %1/%2 byte %3 (%4) state %5", ix, #data, b, string.format("%02X", b), state.readstate) if state.readstate == STATE_READDATA then -- ??? WHAT ABOUT UNMASKING??? -- Performance: this at top; table > string concatenation; handle more than one byte, too. -- D("wshandleincoming() read state, %1 bytes pending, %2 to go in message", #data, state.flen) local nlast = math.min( ix + state.flen - 1, #data ) -- D("wshandleincoming() nlast is %1, length accepting %2", nlast, nlast-ix+1) table.insert( state.frag, data:sub( ix, nlast ) ) state.flen = state.flen - ( nlast - ix + 1 ) if debug_mode and state.flen % 500 == 0 then D("wshandleincoming() accepted, now %1 bytes to go", state.flen) end if state.flen <= 0 then local delta = math.max( timenow() - state.start, 0.001 ) D("wshandleincoming() message received, %1 bytes in %2 secs, %3 bytes/sec, %4 chunks", state.size, delta, state.size / delta, #state.frag) local f = state.masked and unmask( state.frag, state.mask ) or table.concat( state.frag, "" ) state.frag = nil -- gc eligible state.readstate = STATE_START -- ready for next frame wshandlefragment( state.fin, state.opcode, f, wsconn ) end ix = nlast elseif state.readstate == STATE_START then -- D("wshandleincoming() start at %1 byte %2", ix, string.format("%02X", b)) state.fin = bit.band( b, 128 ) > 0 state.opcode = bit.band( b, 15 ) state.flen = 0 -- remaining data bytes to receive state.size = 0 -- keep track of original size state.masked = nil state.mask = nil state.masklen = nil state.frag = {} state.readstate = STATE_READLEN1 state.start = timenow() -- D("wshandleincoming() start of frame, opcode %1 fin %2", state.opcode, state.fin) elseif state.readstate == STATE_READLEN1 then state.masked = bit.band( b, 128 ) > 0 state.flen = bit.band( b, 127 ) if state.flen == 126 then -- Payload length in 16 bit integer that follows, read 2 bytes (big endian) state.readstate = STATE_READLEN161 elseif state.flen == 127 then -- 64-bit length (unsupported, ignore message) L{level=2,msg="Ignoring 64-bit length frame, not supported"} state.readstate = STATE_SYNC else -- 7-bit payload length -- D("wshandleincoming() short length, expecting %1 byte payload", state.flen) state.size = state.flen if state.flen > 0 then -- Transition to reading data. state.readstate = state.masked and STATE_READMASK or STATE_READDATA else -- No data with this opcode, process and return to start state. wshandlefragment( state.fin, state.opcode, "", wsconn ) state.readstate = STATE_START end end -- D("wshandleincoming() opcode %1 len %2 next state %3", state.opcode, state.flen, state.readstate) elseif state.readstate == STATE_READLEN161 then state.flen = b * 256 state.readstate = STATE_READLEN162 elseif state.readstate == STATE_READLEN162 then state.flen = state.flen + b state.size = state.flen state.readstate = state.masked and STATE_READMASK or STATE_READDATA -- D("wshandleincoming() finished 16-bit length read, expecting %1 byte payload", state.size) elseif state.readstate == STATE_READMASK then -- ??? According to RFC6455, we MUST error and close for masked data from server [5.1] if not state.mask then state.mask = { b } else table.insert( state.mask, b ) if #state.mask >= 4 then state.readstate = STATE_READDATA end end -- D("wshandleincoming() received %1 mask bytes, now %2", state.masklen, state.mask) elseif state.readstate == STATE_SYNC then return pcall( state.msghandler, wsconn, false, "lost sync", unpack(wsconn.options.handler_args or {}) ) else assert(false, "Invalid state in wshandleincoming: "..tostring(state.readstate)) end ix = ix + 1 end D("wshandleincoming() ending state is %1", state.readstate) end -- Receiver task. Use non-blocking read. Returns nil,err on error, otherwise true/false is the -- receiver believes there may immediately be more data to process. function wsreceive( wsconn ) D("wsreceive(%1)", wsconn) if not ( wsconn and wsconn.connected ) then return nil, "not connected" end wsconn.socket:settimeout( 0, "b" ) wsconn.socket:settimeout( 0, "r" ) --[[ PHR 20140: Make sure we provide a number of bytes. Failing to do so apparently kicks-in the special handling of special characters, including 0 bytes, CR, LF, etc. We want the available data completely unmolested. --]] local nb,err,bb = wsconn.socket:receive( wsconn.options.receive_chunk_size or CHUNKSIZE ) if nb == nil then if err == "timeout" or err == "wantread" then if bb and #bb > 0 then D("wsreceive() %1; handling partial result %2 bytes", err, #bb) wshandleincoming( bb, wsconn ) return false, #bb -- timeout, say no more data elseif wsconn.options.receive_timeout > 0 and ( timenow() - wsconn.lastMessage ) > wsconn.options.receive_timeout then pcall( wsconn.msghandler, wsconn, false, "message timeout", unpack(wsconn.options.handler_args or {}) ) return nil, "message timeout" end return false, 0 -- not error, no data was handled end -- ??? error pcall( wsconn.msghandler, wsconn, false, "receiver error: "..err, unpack(wsconn.options.handler_args or {}) ) return nil, err end D("wsreceive() handling %1 bytes", #nb) if #nb > 0 then wshandleincoming( nb, wsconn ) end return #nb > 0, #nb -- data handled, maybe more? end -- Reset receiver state. Brutal resync; may or may not be usable, but worth having the option. function wsreset( wsconn ) D("wsreset(%1)", wsconn) if wsconn then wsconn.msg = nil -- gc eligible wsconn.frag = nil -- gc eligible wsconn.readstate = STATE_START -- ready for next frame end end function wslastping( wsconn ) D("wslastping(%1)", wsconn) return wsconn and wsconn.lastPing or 0 end
local combat = createCombatObject() setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE) setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false) local condition = createConditionObject(CONDITION_ATTRIBUTES) setConditionParam(condition, CONDITION_PARAM_TICKS, 10000) setConditionParam(condition, CONDITION_PARAM_SKILL_DISTANCEPERCENT, 150) setConditionParam(condition, CONDITION_PARAM_BUFF, true) setCombatCondition(combat, condition) local speed = createConditionObject(CONDITION_PARALYZE) setConditionParam(speed, CONDITION_PARAM_TICKS, 10000) setConditionFormula(speed, -0.7, 56, -0.7, 56) setCombatCondition(combat, speed) local exhaust = createConditionObject(CONDITION_EXHAUST) setConditionParam(exhaust, CONDITION_PARAM_SUBID, 2) setConditionParam(exhaust, CONDITION_PARAM_TICKS, 10000) setCombatCondition(combat, exhaust) function onCastSpell(cid, var) return doCombat(cid, combat, var) end
require('luacov') local testcase = require('testcase') local status = require('reflex.status') function testcase.status() -- test that field names and values are correct for k, v in pairs(status) do local code if type(k) == 'string' then -- name/code pairs assert.match(k, '^[A-Z][A-Z_]*[A-Z]$', false) code = v elseif type(k) == 'number' then -- code/message pairs assert.equal(type(v), 'string') code = k end -- test that code is valid assert.match(tostring(code), '^%d+$', false) assert.greater_or_equal(code, 100) assert.less_or_equal(code, 599) end end
create_actor([[pl;3;post_drawable_1,spr,spr_obj,mov,x_bounded,tcol,popper,col,confined,y_bounded| x:@1; y:@2; xf:@3; ix:.85; iy:.85; touching_ground:no; jump_speed:.75; wall_jump_xspeed:.75; wall_jump_yspeed:.5; sind:1; iyy:-1; i:@4; u:@5; tile_hit:@6; destroyed:@8; d:@9; tl_max_time=.125,; -- time to wait before jumping in bucket. shooting=no,u=@5,i=nf,hit=@7,; shooting=yes,tl_max_time=.25; tl_next=2,; ]], function(a) a.dy = -a.jump_speed end, function(a) if xbtn() != 0 then a.xf = xbtn() == -1 end -- set the sind if not a.touching_ground then if a.touching_left_wall and btn(0) then a.sind = 6 a.iyy = -1 a.xf = false elseif a.touching_right_wall and btn(1) then a.sind = 6 a.iyy = -1 a.xf = true else a.sind = 1 a.iyy = -1 end else if a.ax == 0 then a.sind = 2 a.iyy = -1 elseif a.ax != 0 then if a.tl_tim*60 % 16 < 4 then a.sind = 3 a.iyy = -2 elseif a.tl_tim*60 % 16 < 8 then a.sind = 2 a.iyy = -1 elseif a.tl_tim*60 % 16 < 12 then a.sind = 4 a.iyy = -1 else a.sind = 2 a.iyy = -1 end end end if not a.shooting then a.ax = xbtn()*.035 a.ay = .04 if not a.touching_ground then if a.touching_left_wall and btn(0) then a.ay = .0117 elseif a.touching_right_wall and btn(1) then a.ay = .0117 end end if btnp(4) then if a.touching_ground then a.dy = -a.jump_speed sfx'25' elseif a.touching_left_wall then a.dx = a.wall_jump_xspeed a.dy = (btn(3) and 1 or -1) * a.wall_jump_yspeed sfx'25' elseif a.touching_right_wall then a.dx = -a.wall_jump_xspeed a.dy = (btn(3) and 1 or -1) * a.wall_jump_yspeed sfx'25' elseif a.tl_tim > .125 then sfx'7' end end if btnp(5) then if g_water_gauge:can_shoot() then xdir, ydir = get_direction_for_shooting(a.xf) if xdir != 0 and a.touching_left_wall then xdir = 1 elseif xdir != 0 and a.touching_right_wall then xdir = -1 end g_water_gauge:empty() _g.water_shot(a.x, a.y, xdir, ydir) local ang = atan2(-xdir, -ydir) a.dx += a.jump_speed * cos(ang) a.dy += a.jump_speed * sin(ang) a.ax, a.ay = 0, 0 a:next() else sfx'7' end end end -- die if below screen local bot_of_screen = g_main_view.y + g_main_view.h/2 if a.y > g_main_view.y + g_main_view.h/2 then g_card_shake_x = 4 if a.y > bot_of_screen + 2 then a:kill() end end local top_of_screen = g_main_view.y - g_main_view.h/2 + 1.5 if a.y < top_of_screen then a.dy += .05 if a.y < top_of_screen - 1.5 then g_card_shake_x = 4 end if a.y < top_of_screen - 3 then a:kill() end end a.touching_ground = false if not a.shooting then a.touching_left_wall = false a.touching_right_wall = false end end, function(a, dir) if dir == 3 then a.touching_ground = true end if dir == 0 then a.touching_left_wall = true end if dir == 1 then a.touching_right_wall = true end end, function(a, other) shared_pl_col_logic(a, other) if other.balloon then a.dy = -a.jump_speed/2 end if other.bucket_parent then a.into_bucket = true a:kill() sfx'26' other.pl_in_bucket = true other.xf = a.xf elseif other.bad then a.died_from_enemy = true a:kill() end end, function(a) if not a.into_bucket then sfx'15' _g.fader_out(.5, nf, levelend) if a.died_from_enemy then _g.pl_dead(a.x, a.y, a.xf) end if g_cur_level != 0 then g_stats.deaths += 1 end end end, function(a) a:draw_spr() end)
-- _ _ -- _ __ ___ (_)_ __ | | __ -- | '_ ` _ \| | '_ \| |/ / -- | | | | | | | | | | < -- |_| |_| |_|_|_| |_|_|\_\ -- -- SPDX-License-Identifier: MIT -- -- -- imports local M = require("mink")(...) local lunajson = require("lunajson") local inspect = require("inspect") -- get data local m_data = M.get_args() local j_data = m_data[1][1] local data = lunajson.decode(j_data) -- csum check if data.params.csum == nil or data.params.csum == "" then return nil end -- create new descriptor local tmp_f = os.tmpname() -- get id local id = tmp_f:gsub(".*_(.*)", "%1") -- add csum and byte counter local h = io.open(tmp_f, "w") h:write(data.params.csum .. ";" .. 0 .. "\n") h:close() -- return firmware id return '{ "firmware_id": "' .. id .. '" }'
scrollingtext = class("scrollingtext") function scrollingtext:init(s, x, y) self.x = x-xscroll self.y = y-yscroll self.s = s self.timer = 0 end function scrollingtext:update(dt) self.timer = self.timer + dt if self.timer > scrollingscoretime then return true end return false end function scrollingtext:draw() properprintbackground(self.s, self.x*16*scale, (self.y-.5-self.timer)*16*scale, true, nil, scale) end
require("test/bustedhelper_game") local speaker_component = require("dialogue/speaker_component") local animated_sprite = require("engine/render/animated_sprite") local character_info = require("content/character_info") local visual_data = require("resources/visual_data") local character = require("story/character") require("engine/core/math") describe('speaker_component', function () local mock_character_info = character_info(2, "employee", 5) local c local s before_each(function () c = character(mock_character_info, horizontal_dirs.right, vector(20, 60)) s = speaker_component(c) end) describe('init', function () it('should init a speaker_component', function () assert.are_equal(c, s.entity) assert.are_same({animated_sprite(visual_data.anim_sprites.button_o), bubble_types.speech, nil, false, false}, {s.continue_hint_sprite, s.bubble_type, s.current_text, s.wait_for_input, s.higher_text}) end) end) describe('get_final_bubble_tail_pos', function () it('(right, speech, not higher text) should return speech bubble tail pos', function () s.bubble_type = bubble_types.speech s.current_text = "hello" s.higher_text = false local expected_bubble_tail_pos = vector(20, 60) + visual_data.bubble_tail_offset_right_by_bubble_type[bubble_types.speech] assert.are_equal(expected_bubble_tail_pos, s:get_final_bubble_tail_pos()) end) it('(right, speech, higher text) should return speech bubble tail pos + first speaker offset', function () s.bubble_type = bubble_types.speech s.current_text = "hello" s.higher_text = true local expected_bubble_tail_pos = vector(20, 60) + visual_data.bubble_tail_offset_right_by_bubble_type[bubble_types.speech] expected_bubble_tail_pos = expected_bubble_tail_pos + vector(0, visual_data.first_speaker_tail_offset_y) assert.are_equal(expected_bubble_tail_pos, s:get_final_bubble_tail_pos()) end) it('(right, thought, not higher text) should return thought bubble tail pos', function () s.bubble_type = bubble_types.thought s.current_text = "hello" s.higher_text = false local expected_bubble_tail_pos = vector(20, 60) + visual_data.bubble_tail_offset_right_by_bubble_type[bubble_types.thought] assert.are_equal(expected_bubble_tail_pos, s:get_final_bubble_tail_pos()) end) it('(left, speech, higher text) should return speech bubble tail pos (mirrored x) + first speaker offset', function () c.direction = horizontal_dirs.left s.bubble_type = bubble_types.speech s.current_text = "hello" s.higher_text = true local expected_bubble_tail_pos = vector(20, 60) + visual_data.bubble_tail_offset_right_by_bubble_type[bubble_types.speech]:mirrored_x() expected_bubble_tail_pos = expected_bubble_tail_pos + vector(0, visual_data.first_speaker_tail_offset_y) assert.are_equal(expected_bubble_tail_pos, s:get_final_bubble_tail_pos()) end) it('(left, thought, not higher text) should return thought bubble tail pos (mirrored x)', function () c.direction = horizontal_dirs.left s.bubble_type = bubble_types.thought s.current_text = "hello" s.higher_text = false local expected_bubble_tail_pos = vector(20, 60) + visual_data.bubble_tail_offset_right_by_bubble_type[bubble_types.thought]:mirrored_x() assert.are_equal(expected_bubble_tail_pos, s:get_final_bubble_tail_pos()) end) it('(left, thought, higher text) should return thought bubble tail pos (mirrored x) + first speaker offset', function () c.direction = horizontal_dirs.left s.bubble_type = bubble_types.thought s.current_text = "hello" s.higher_text = true local expected_bubble_tail_pos = vector(20, 60) + visual_data.bubble_tail_offset_right_by_bubble_type[bubble_types.thought]:mirrored_x() expected_bubble_tail_pos = expected_bubble_tail_pos + vector(0, visual_data.first_speaker_tail_offset_y) assert.are_equal(expected_bubble_tail_pos, s:get_final_bubble_tail_pos()) end) end) describe('say & think', function () setup(function () stub(speaker_component, "show_bubble") end) teardown(function () speaker_component.show_bubble:revert() end) after_each(function () speaker_component.show_bubble:clear() end) it('say should call show_bubble with speech bubble type', function () s:say("hello", false, true) local spy = assert.spy(speaker_component.show_bubble) spy.was_called(1) spy.was_called_with(match.ref(s), bubble_types.speech, "hello", false, true) end) it('think should call show_bubble with speech bubble type', function () s:think("hello", false, true) local spy = assert.spy(speaker_component.show_bubble) spy.was_called(1) spy.was_called_with(match.ref(s), bubble_types.thought, "hello", false, true) end) end) describe('show_bubble', function () setup(function () stub(animated_sprite, "play") end) teardown(function () animated_sprite.play:revert() end) after_each(function () animated_sprite.play:clear() end) it('should set the bubble type and the current text with wait_for_input = false and higher_text = false by default', function () s:show_bubble(bubble_types.thought, "hello") assert.are_same({bubble_types.thought, "hello", false, false}, {s.bubble_type, s.current_text, s.wait_for_input, s.higher_text}) end) it('should set wait_for_input to the passed value', function () s:show_bubble(bubble_types.speech, "hello", true) assert.is_true(s.wait_for_input) end) it('should set higher_text to the passed value', function () s:show_bubble(bubble_types.thought, "hello", nil, true) assert.is_true(s.higher_text) end) it('should play continue hint sprite press_loop anim if waiting for input', function () -- animated_sprite.play is called in character:init (before_each), so clear call count now animated_sprite.play:clear() s:show_bubble(bubble_types.thought, "hello", true) local spy = assert.spy(animated_sprite.play) spy.was_called(1) spy.was_called_with(match.ref(s.continue_hint_sprite), 'press_loop') end) it('should not play continue hint sprite press_loop anim if not waiting for input', function () -- animated_sprite.play is called in character:init (before_each), so clear call count now animated_sprite.play:clear() s:show_bubble(bubble_types.thought, "hello", false) local spy = assert.spy(animated_sprite.play) spy.was_not_called() end) end) describe('stop', function () setup(function () stub(animated_sprite, "stop") end) teardown(function () animated_sprite.stop:revert() end) after_each(function () animated_sprite.stop:clear() end) it('should reset the current text', function () s.current_text = "hello" s.wait_for_input = false s:stop() assert.is_nil(s.current_text) end) it('(not waiting for input) should keep wait_for_input false and not stop continue hint sprite', function () s.current_text = "hello" s.wait_for_input = false s:stop() assert.is_false(false, s.wait_for_input) local spy = assert.spy(animated_sprite.stop) spy.was_not_called() end) it('should reset wait_for_input and stop continue hint sprite', function () s.current_text = "hello" s.wait_for_input = true s:stop() assert.is_false(false, s.wait_for_input) local spy = assert.spy(animated_sprite.stop) spy.was_called(1) spy.was_called_with(match.ref(s.continue_hint_sprite)) end) end) end)
local nvim = require 'neovim' local sys = require 'sys' local is_file = require('utils.files').is_file local realpath = require('utils.files').realpath local executable = require('utils.files').executable local plugins = require('neovim').plugins local M = { pyignores = { -- 'E121', -- -- 'E123', -- -- 'E126', -- 'E203', -- Whitespace before : -- 'E221', -- 'E226', -- Whitespace around operators -- 'E228', -- 'E231', -- Missing whitespace after ',' -- 'E24', -- -- 'E251', -- 'E261', -- 2 spaces before inline comment 'E262', -- Comments should start with '#' 'E265', -- Block comment should start with '#' -- 'E27', -- 'E302', -- Expected 2 lines between funcs/classes -- 'E501', -- -- 'E701', -- -- 'E704', -- -- 'H233', -- 'W391', -- Blank line and the EOF -- 'W503', -- -- 'W504', -- }, formatprg = { black = { '-l', '120', efm = { '%trror: cannot format %f: Cannot parse %l:c: %m', '%trror: cannot format %f: %m', }, }, autopep8 = { '-i', '--experimental', '--aggressive', '--max-line-length', '120', }, yapf = { '-i', '--style', 'pep8', }, isort = {}, }, makeprg = { mypy = { efm = { '%f:%l: %trror: %m', '%f:%l: %tarning: %m', '%f:%l: %tote: %m', '%f: %trror: %m', '%f: %tarning: %m', '%f: %tote: %m', '%f:%l:%c: %t%n %m', '%f:%l:%c:%t: %m', '%f:%l:%c: %m', }, }, }, } M.makeprg.flake8 = { '--max-line-length=120', '--ignore=' .. table.concat(M.pyignores, ',') } M.makeprg.pycodestyle = M.makeprg.flake8 function M.get_formatter() local project = vim.fn.findfile('pyproject.toml', '.;') project = project ~= '' and realpath(project) or nil local cmd if executable 'black' then cmd = { 'black' } if not project then vim.list_extend(cmd, M.formatprg[cmd[1]]) else vim.list_extend(cmd, { '--config', project }) end elseif executable 'yapf' or executable 'autopep8' then cmd = { executable 'yapf' and 'yapf' or 'autopep8' } if not project then vim.list_extend(cmd, M.formatprg[cmd[1]]) else table.insert(cmd, '-i') end end return cmd end function M.get_linter() local cmd if executable 'flake8' then cmd = { 'flake8' } local global_settings = vim.fn.expand(sys.name == 'windows' and '~/.flake8' or '~/.config/flake8') if not is_file(global_settings) and not is_file './tox.ini' and not is_file './.flake8' and not is_file './setup.cfg' -- and not is_file './setup.py' -- and not is_file './pyproject.toml' then vim.list_extend(cmd, M.makeprg[cmd[1]]) end elseif executable 'pycodestyle' then cmd = { 'pycodestyle' } vim.list_extend(cmd, M.makeprg[cmd[1]]) -- else -- cmd = {'python3', '-c', [["import py_compile,sys; sys.stderr=sys.stdout; py_compile.compile(r'%')"]]} end return cmd end function M.setup() if not plugins['vim-apathy'] then local buf = nvim.get_current_buf() local merge_uniq_list = require('utils.tables').merge_uniq_list if not vim.b.python_path then -- local pypath = {} local pyprog = vim.g.python3_host_prog or vim.g.python_host_prog or (executable 'python3' and 'python3') local get_path = RELOAD('jobs'):new { cmd = pyprog, args = { '-c', 'import sys; print(",".join(sys.path), flush=True)' }, silent = true, } get_path:callback_on_success(function(job) -- NOTE: output is an array of stdout lines, we must join the array in a str -- split it into a single array local output = vim.split(table.concat(job:output(), ','), ',') -- BUG: No idea why this fails -- local path = vim.split(vim.api.nvim_buf_get_option(buf, 'path'), ',') local path = vim.opt_local.path:get() if type(path) == type '' then path = vim.split(path, ',') end merge_uniq_list(path, output) vim.bo[buf].path = table.concat(path, ',') end) get_path:start() else assert( type(vim.b.python_path) == type '' or type(vim.b.python_path) == type {}, debug.traceback 'b:python_path must be either a string or list' ) if type(vim.b.python_path) == type '' then vim.b.python_path = vim.split(vim.b.python_path, ',') end local path = vim.split(vim.bo[buf].path, ',') merge_uniq_list(path, vim.b.python_path) vim.bo[buf].path = table.concat(path, ',') end end nvim.command.set('Execute', function(cmd_opts) local exepath = vim.fn.exepath local buffer = nvim.buf.get_name(nvim.get_current_buf()) local filename = is_file(buffer) and buffer or vim.fn.tempname() if not is_file(buffer) then require('utils.files').writefile(filename, nvim.buf.get_lines(0, 0, -1, true)) end local opts = { cmd = executable 'python3' and exepath 'python3' or exepath 'python', { '-u', filename, }, } vim.list_extend(opts.args, cmd_opts.fargs) require('utils.functions').async_execute(opts) end, { nargs = '*', buffer = true }) end function M.pynvim_setup() -- NOTE: This should speed up startup times -- lets just asume that if we have this two, any user could install pynvim if executable 'python3' and executable 'pip3' then vim.g.python3_host_prog = vim.fn.exepath 'python3' vim.g.loaded_python_provider = 0 elseif executable 'python2' and executable 'pip2' then vim.g.python_host_prog = vim.fn.exepath 'python2' vim.g.loaded_python3_provider = 0 else vim.g.loaded_python_provider = 0 vim.g.loaded_python3_provider = 0 end end return M
-- @Author: Webster -- @Date: 2016-01-20 09:31:57 -- @Last Modified by: WilliamChan -- @Last Modified time: 2018-01-02 00:19:43 local _L = JH.LoadLangPack local GKP_LOOT_ANCHOR = { s = "CENTER", r = "CENTER", x = 0, y = 0 } local GKP_LOOT_INIFILE = JH.GetAddonInfo().szRootPath .. "JH_GKP/ui/GKP_Loot.ini" local GKP_LOOT_BOSS -- 散件老板 local GKP_ALL_FRAME = {} local GKP_LOOT_HUANGBABA = { [JH.GetItemName(72592)] = true, [JH.GetItemName(68363)] = true, [JH.GetItemName(66190)] = true, [JH.GetItemName(153897)] = true, } local GKP_LOOT_AUTO = {} local GKP_LOOT_AUTO_LIST = { -- 记录分配上次的物品 -- 材料 [153532] = true, [153533] = true, [153534] = true, [153535] = true, -- 五行石 [153190] = true, -- 五彩石 [150241] = true, [150242] = true, [150243] = true, -- 90 [72591] = true, [68362] = true, [66189] = true, [4097] = true, [73214] = true, [74368] = true, [153896] = true, } -- setmetatable(GKP_LOOT_AUTO_LIST, { __index = function() return true end }) GKP_Loot_Base = class() GKP_Loot = { bVertical = true, bSetColor = true, } JH.RegisterCustomData("GKP_Loot") local Loot = {} function GKP_Loot_Base.OnFrameCreate() this:RegisterEvent("UI_SCALED") this:RegisterEvent("PARTY_LOOT_MODE_CHANGED") this:RegisterEvent("PARTY_DISBAND") this:RegisterEvent("PARTY_DELETE_MEMBER") this:RegisterEvent("DOODAD_LEAVE_SCENE") this:RegisterEvent("GKP_LOOT_RELOAD") this:RegisterEvent("GKP_LOOT_BOSS") this.dwDoodadID = arg0 local a = GKP_LOOT_ANCHOR this:SetPoint(a.s, 0, 0, a.r, a.x, a.y) GKP_ALL_FRAME[arg0] = this end function GKP_Loot_Base.OnFrameDestroy() GKP_ALL_FRAME[this.dwDoodadID] = nil end function GKP_Loot_Base.OnEvent(szEvent) if szEvent == "DOODAD_LEAVE_SCENE" then if arg0 == this.dwDoodadID then Wnd.CloseWindow(this) -- 不加动画 是系统关闭而不是手动 PlaySound(SOUND.UI_SOUND, g_sound.CloseFrame) end elseif szEvent == "PARTY_LOOT_MODE_CHANGED" then if arg1 ~= PARTY_LOOT_MODE.DISTRIBUTE then -- Wnd.CloseWindow(this) end elseif szEvent == "PARTY_DISBAND" or szEvent == "PARTY_DELETE_MEMBER" then if szEvent == "PARTY_DELETE_MEMBER" and arg1 ~= UI_GetClientPlayerID() then return end Wnd.CloseWindow(this) PlaySound(SOUND.UI_SOUND, g_sound.CloseFrame) elseif szEvent == "UI_SCALED" then local a = this.anchor or GKP_LOOT_ANCHOR this:SetPoint(a.s, 0, 0, a.r, a.x, a.y) elseif szEvent == "GKP_LOOT_RELOAD" or szEvent == "GKP_LOOT_BOSS" then Loot.DrawLootList(this.dwDoodadID) end end function GKP_Loot_Base.OnFrameDragEnd() this:CorrectPos() local anchor = GetFrameAnchor(this, "LEFTTOP") GKP_LOOT_ANCHOR = anchor this.anchor = anchor end function GKP_Loot_Base.OnLButtonClick() local szName = this:GetName() if szName == "Btn_Close" then Loot.CloseFrame(this:GetRoot().dwDoodadID) elseif szName == "Btn_Style" then local ui = this:GetRoot() local menu = { { szOption = _L["Set Force Color"], bCheck = true, bChecked = GKP_Loot.bSetColor, fnAction = function() GKP_Loot.bSetColor = not GKP_Loot.bSetColor FireUIEvent("GKP_LOOT_RELOAD") end }, { bDevide = true }, { szOption = _L["Link All Item"], fnAction = function() local szName, data, bSpecial = Loot.GetDoodad(ui.dwDoodadID) local t = {} for k, v in ipairs(data) do table.insert(t, GKP.GetFormatLink(v.item)) end JH.Talk(t) end }, { bDevide = true }, { szOption = _L["switch styles"], fnAction = function() JH.Animate(ui):FadeOut(200, function() GKP_Loot.bVertical = not GKP_Loot.bVertical FireUIEvent("GKP_LOOT_RELOAD") JH.Animate(ui):FadeIn(200) end) end }, { bDevide = true }, { szOption = _L["About"], fnAction = function() JH.Alert(_L["GKP_TIPS"]) end } } PopupMenu(menu) elseif szName == "Btn_Boss" then Loot.GetBossAction(this:GetRoot().dwDoodadID, type(GKP_LOOT_BOSS) == "nil") end end function GKP_Loot_Base.OnRButtonClick() local szName = this:GetName() if szName == "Btn_Boss" then Loot.GetBossAction(this:GetRoot().dwDoodadID, true) end end function GKP_Loot_Base.OnItemLButtonDown() local szName = this:GetName() if szName == "Handle_Item" then this = this:Lookup("Box_Item") this.OnItemLButtonDown() end end function GKP_Loot_Base.OnItemLButtonUp() local szName = this:GetName() if szName == "Handle_Item" then this = this:Lookup("Box_Item") this.OnItemLButtonUp() end end function GKP_Loot_Base.OnItemMouseEnter() local szName = this:GetName() if szName == "Handle_Item" or szName == "Box_Item" then if szName == "Handle_Item" then this:Lookup("Image_Copper"):Show() this = this:Lookup("Box_Item") this.OnItemMouseEnter() elseif szName == "Box_Item" then local hParent = this:GetParent() if hParent then local szParent = hParent:GetName() if szParent == "Handle_Item" then hParent:Lookup("Image_Copper"):Show() end end end -- local item = this.data.item -- if itme and item.nGenre == ITEM_GENRE.EQUIPMENT then -- if itme.nSub == EQUIPMENT_SUB.MELEE_WEAPON then -- this:SetOverText(3, g_tStrings.WeapenDetail[item.nDetail]) -- else -- this:SetOverText(3, g_tStrings.tEquipTypeNameTable[item.nSub]) -- end -- end end end function GKP_Loot_Base.OnItemMouseLeave() local szName = this:GetName() if szName == "Handle_Item" or szName == "Box_Item" then if szName == "Handle_Item" then if this:Lookup("Image_Copper") and this:Lookup("Image_Copper"):IsValid() then this:Lookup("Image_Copper"):Hide() this = this:Lookup("Box_Item") this.OnItemMouseLeave() end elseif szName == "Box_Item" then local hParent = this:GetParent() if hParent then local szParent = hParent:GetName() if szParent == "Handle_Item" then if hParent:Lookup("Image_Copper") and hParent:Lookup("Image_Copper"):IsValid() then hParent:Lookup("Image_Copper"):Hide() end end end end -- if this and this:IsValid() and this.SetOverText then -- this:SetOverText(3, "") -- end end end -- 分配菜单 function GKP_Loot_Base.OnItemLButtonClick() local szName = this:GetName() if IsCtrlKeyDown() or IsAltKeyDown() then return end if szName == "Handle_Item" or szName == "Box_Item" then local box = szName == "Handle_Item" and this:Lookup("Box_Item") or this local data = box.data local me, team = GetClientPlayer(), GetClientTeam() local frame = this:GetRoot() local dwDoodadID = frame.dwDoodadID local doodad = GetDoodad(dwDoodadID) -- if data.bDist or JH.bDebugClient then if not data.bDist and not data.bBidding then if doodad.CanDialog(me) then OpenDoodad(me, doodad) else JH.Topmsg(g_tStrings.TIP_TOO_FAR) end end if data.bDist then if not doodad then JH.Debug("Doodad does not exist!") return Wnd.CloseWindow(frame) end if not Loot.AuthCheck(dwDoodadID) then return end if IsShiftKeyDown() and GKP_LOOT_AUTO[data.item.nUiId] then return Loot.DistributeItem(GKP_LOOT_AUTO[data.item.nUiId], dwDoodadID, data.dwID, data, true) else return PopupMenu(Loot.GetDistributeMenu(dwDoodadID, data)) end elseif data.bBidding then if team.nLootMode ~= PARTY_LOOT_MODE.BIDDING then return OutputMessage("MSG_ANNOUNCE_RED", g_tStrings.GOLD_CHANGE_BID_LOOT) end JH.Sysmsg(_L["GKP does not support bidding, please re open loot list."]) elseif data.bNeedRoll then JH.Topmsg(g_tStrings.ERROR_LOOT_ROLL) else -- 左键摸走 LootItem(frame.dwDoodadID, data.dwID) end end end -- 右键拍卖 function GKP_Loot_Base.OnItemRButtonClick() local szName = this:GetName() if szName == "Handle_Item" or szName == "Box_Item" then local box = szName == "Handle_Item" and this:Lookup("Box_Item") or this local data = box.data if not data.bDist then return end local me, team = GetClientPlayer(), GetClientTeam() local frame = this:GetRoot() local dwDoodadID = frame.dwDoodadID if not Loot.AuthCheck(dwDoodadID) then return end local menu = {} table.insert(menu, { szOption = data.szName , bDisable = true }) table.insert(menu, { bDevide = true }) table.insert(menu, { szOption = "Roll", fnAction = function() if MY_RollMonitor then if MY_RollMonitor.OpenPanel and MY_RollMonitor.Clear then MY_RollMonitor.OpenPanel() MY_RollMonitor.Clear({echo=false}) end end JH.Talk({ GKP.GetFormatLink(data.item), GKP.GetFormatLink(_L["Roll the dice if you wang"]) }) end }) table.insert(menu, { bDevide = true }) for k, v in ipairs(GKP.GetConfig().Scheme) do if v[2] then table.insert(menu, { szOption = v[1], fnAction = function() GKP_Chat.OpenFrame(data.item, Loot.GetDistributeMenu(dwDoodadID, data), { dwDoodadID = dwDoodadID, data = data, }) JH.Talk({ GKP.GetFormatLink(data.item), GKP.GetFormatLink(_L(" %d Gold Start Bidding, off a price if you want.", v[1])) }) end }) end end PopupMenu(menu) end end function Loot.GetBossAction(dwDoodadID, bMenu) if not Loot.AuthCheck(dwDoodadID) then return end local szName, data = Loot.GetDoodad(dwDoodadID) local fnAction = function() local tEquipment = {} for k, v in ipairs(data) do if (v.item.nGenre == ITEM_GENRE.EQUIPMENT or IsCtrlKeyDown()) and v.item.nSub ~= EQUIPMENT_SUB.WAIST_EXTEND and v.item.nSub ~= EQUIPMENT_SUB.BACK_EXTEND and v.item.nSub ~= EQUIPMENT_SUB.HORSE and v.item.nSub ~= EQUIPMENT_SUB.PACKAGE and v.item.nSub ~= EQUIPMENT_SUB.FACE_EXTEND and v.item.nSub ~= EQUIPMENT_SUB.L_SHOULDER_EXTEND and v.item.nSub ~= EQUIPMENT_SUB.R_SHOULDER_EXTEND and v.item.nSub ~= EQUIPMENT_SUB.BACK_CLOAK_EXTEND and v.bDist then -- 按住Ctrl的情况下 无视分类 否则只给装备 table.insert(tEquipment, v.item) end end if #tEquipment == 0 then return JH.Alert(_L["No Equiptment left for Equiptment Boss"]) end local aPartyMember = Loot.GetaPartyMember(GetDoodad(dwDoodadID)) local p = aPartyMember(GKP_LOOT_BOSS) if p and p.bOnlineFlag then -- 这个人存在团队的情况下 local szXml = GetFormatText(_L["Are you sure you want the following item\n"], 162, 255, 255, 255) local r, g, b = JH.GetForceColor(p.dwForceID) for k, v in ipairs(tEquipment) do local r, g, b = GetItemFontColorByQuality(v.nQuality) szXml = szXml .. GetFormatText("[".. GetItemNameByItem(v) .."]\n", 166, r, g, b) end szXml = szXml .. GetFormatText(_L["All distrubute to"], 162, 255, 255, 255) szXml = szXml .. GetFormatText("[".. p.szName .."]", 162, r, g, b) local msg = { szMessage = szXml, szName = "GKP_Distribute", szAlignment = "CENTER", bRichText = true, { szOption = g_tStrings.STR_HOTKEY_SURE, fnAction = function() for k, v in ipairs(tEquipment) do Loot.DistributeItem(GKP_LOOT_BOSS, dwDoodadID, v.dwID, {}, true) end end }, { szOption = g_tStrings.STR_HOTKEY_CANCEL }, } MessageBox(msg) else return JH.Alert(_L["No Pick up Object, may due to Network off - line"]) end end if bMenu then local menu = GKP.GetTeamMemberMenu(function(v) GKP_LOOT_BOSS = v.dwID fnAction() end, false, true) table.insert(menu, 1, { bDevide = true }) table.insert(menu, 1, { szOption = _L["select equip boss"], bDisable = true }) PopupMenu(menu) else fnAction() end end function Loot.AuthCheck(dwID) local me, team = GetClientPlayer(), GetClientTeam() local doodad = GetDoodad(dwID) if not doodad then return JH.Debug("Doodad does not exist!") end local nLootMode = team.nLootMode local dwBelongTeamID = doodad.GetBelongTeamID() if nLootMode ~= PARTY_LOOT_MODE.DISTRIBUTE and not JH.bDebugClient then -- 需要分配者模式 OutputMessage("MSG_ANNOUNCE_RED", g_tStrings.GOLD_CHANGE_DISTRIBUTE_LOOT) return false end if not JH.IsDistributer() and not JH.bDebugClient then -- 需要自己是分配者 OutputMessage("MSG_ANNOUNCE_RED", g_tStrings.ERROR_LOOT_DISTRIBUTE) return false end if dwBelongTeamID ~= team.dwTeamID then OutputMessage("MSG_ANNOUNCE_RED", g_tStrings.ERROR_LOOT_DISTRIBUTE) return false end return true end -- 拾取对象 function Loot.GetaPartyMember(doodad) local team = GetClientTeam() local aPartyMember = doodad.GetLooterList() if not aPartyMember then return JH.Sysmsg(_L["Pick up time limit exceeded, please try again."]) end for k, v in ipairs(aPartyMember) do local player = team.GetMemberInfo(v.dwID) aPartyMember[k].dwForceID = player.dwForceID aPartyMember[k].dwMapID = player.dwMapID end setmetatable(aPartyMember, { __call = function(me, dwID) for k, v in ipairs(me) do if v.dwID == dwID or v.szName == dwID then return v end end end }) return aPartyMember end -- 严格判断 function Loot.DistributeItem(dwID, dwDoodadID, dwItemID, info, bShift) local doodad = GetDoodad(dwDoodadID) if not Loot.AuthCheck(dwDoodadID) then return end local me = GetClientPlayer() local item = GetItem(dwItemID) if not item then JH.Debug("Item does not exist, check!!") local szName, data = Loot.GetDoodad(dwDoodadID) for k, v in ipairs(data) do if v.item.nQuality == info.nQuality and GetItemNameByItem(v.item) == info.szName then dwItemID = v.item.dwID JH.Debug("Item matching, " .. GetItemNameByItem(v.item)) break end end end local item = GetItem(dwItemID) local team = GetClientTeam() local player = team.GetMemberInfo(dwID) local aPartyMember = Loot.GetaPartyMember(doodad) if item then if not player or (player and not player.bIsOnLine) then -- 不在线 return JH.Alert(_L["No Pick up Object, may due to Network off - line"]) end if not aPartyMember(dwID) then -- 给不了 return JH.Alert(_L["No Pick up Object, may due to Network off - line"]) end if player.dwMapID ~= me.GetMapID() then -- 不在同一地图 return JH.Alert(_L["No Pick up Object, Please confirm that in the Dungeon."]) end local tab = { szPlayer = player.szName, nUiId = item.nUiId, szNpcName = doodad.szName, dwDoodadID = doodad.dwID, dwTabType = item.dwTabType, dwIndex = item.dwIndex, nVersion = item.nVersion, nTime = GetCurrentTime(), nQuality = item.nQuality, dwForceID = player.dwForceID, szName = GetItemNameByItem(item), nGenre = item.nGenre, } if item.bCanStack and item.nStackNum > 1 then tab.nStackNum = item.nStackNum end if item.nGenre == ITEM_GENRE.BOOK then tab.nBookID = item.nBookID end if GKP.bOn then GKP.Record(tab, item, IsShiftKeyDown() or bShift) else -- 关闭的情况所有东西全部绕过 tab.nMoney = 0 GKP("GKP_Record", tab) end if GKP_LOOT_AUTO_LIST[item.nUiId] then GKP_LOOT_AUTO[item.nUiId] = dwID end doodad.DistributeItem(dwItemID, dwID) else JH.Sysmsg(_L["Userdata is overdue, distribut failed, please try again."]) end end function Loot.GetMessageBox(dwID, dwDoodadID, dwItemID, data, bShift) local team = GetClientTeam() local info = team.GetMemberInfo(dwID) local fr, fg, fb = JH.GetForceColor(info.dwForceID) local ir, ig, ib = GetItemFontColorByQuality(data.nQuality) local msg = { szMessage = FormatLinkString( g_tStrings.PARTY_DISTRIBUTE_ITEM_SURE, "font=162", GetFormatText("[".. data.szName .. "]", 166, ir, ig, ib), GetFormatText("[".. info.szName .. "]", 162, fr, fg, fb) ), szName = "GKP_Distribute", bRichText = true, { szOption = g_tStrings.STR_HOTKEY_SURE, fnAction = function() Loot.DistributeItem(dwID, dwDoodadID, dwItemID, data, bShift) end }, { szOption = g_tStrings.STR_HOTKEY_CANCEL }, } MessageBox(msg) end function Loot.GetDistributeMenu(dwDoodadID, data) local me, team = GetClientPlayer(), GetClientTeam() local dwMapID = me.GetMapID() local doodad = GetDoodad(dwDoodadID) local aPartyMember = Loot.GetaPartyMember(doodad) table.sort(aPartyMember, function(a, b) return a.dwForceID < b.dwForceID end) local menu = { { szOption = data.szName, bDisable = true }, { bDevide = true } } local fnGetMenu = function(v, szName) local szIcon, nFrame = GetForceImage(v.dwForceID) return { szOption = v.szName .. (szName and " - " .. szName or ""), bDisable = not v.bOnlineFlag, rgb = { JH.GetForceColor(v.dwForceID) }, szIcon = szIcon, nFrame = nFrame, fnAutoClose = function() return not frame or false end, szLayer = "ICON_RIGHTMOST", fnAction = function() if data.nQuality >= 3 then Loot.GetMessageBox(v.dwID, dwDoodadID, data.dwID, data, szName and true) else Loot.DistributeItem(v.dwID, dwDoodadID, data.dwID, data, szName and true) end end } end if GKP_LOOT_AUTO[data.item.nUiId] then local member = aPartyMember(GKP_LOOT_AUTO[data.item.nUiId]) if member then table.insert(menu, fnGetMenu(member, data.szName)) table.insert(menu, { bDevide = true }) end end for k, v in ipairs(aPartyMember) do table.insert(menu, fnGetMenu(v)) end return menu end function Loot.DrawLootList(dwID) local frame = Loot.GetFrame(dwID) local szName, data, bSpecial = Loot.GetDoodad(dwID) local nCount = #data JH.Debug(string.format("Doodad %d, items %d.", dwID, nCount)) if not frame or not szName or nCount == 0 then if frame then return Wnd.CloseWindow(frame) end return JH.Debug("Doodad does not exist!") end -- 修改UI大小 local handle = frame:Lookup("", "Handle_Box") handle:Clear() if GKP_Loot.bVertical then frame:Lookup("", "Image_Bg"):SetSize(280, nCount * 56 + 35) frame:Lookup("", "Image_Title"):SetSize(280, 30) frame:Lookup("Btn_Close"):SetRelPos(250, 4) frame:Lookup("Btn_Boss"):SetRelPos(210, 3) frame:SetSize(280, nCount * 56 + 35) handle:SetHandleStyle(3) else if nCount <= 6 then frame:Lookup("", "Image_Bg"):SetSize(6 * 72, 110) frame:Lookup("", "Image_Title"):SetSize(6 * 72, 30) frame:SetSize(6 * 72, 110) else frame:Lookup("", "Image_Bg"):SetSize(6 * 72, 30 + math.ceil(nCount / 6) * 75) frame:Lookup("", "Image_Title"):SetSize(6 * 72, 30) frame:SetSize(6 * 72, 8 + 30 + math.ceil(nCount / 6) * 75) end local w, h = frame:GetSize() frame:Lookup("Btn_Close"):SetRelPos(w - 30, 4) frame:Lookup("Btn_Boss"):SetRelPos(w - 70, 3) handle:SetHandleStyle(0) end if bSpecial then frame:Lookup("", "Image_Bg"):FromUITex("ui/Image/OperationActivity/RedEnvelope2.uitex", 14) frame:Lookup("", "Image_Title"):FromUITex("ui/Image/OperationActivity/RedEnvelope2.uitex", 14) frame:Lookup("", "Text_Title"):SetAlpha(255) frame:Lookup("", "SFX"):Show() handle:SetRelPos(5, 30) handle:GetParent():FormatAllItemPos() end for k, v in ipairs(data) do local item = v.item local szName = GetItemNameByItem(item) local box if GKP_Loot.bVertical then local h = handle:AppendItemFromIni(GKP_LOOT_INIFILE, "Handle_Item") box = h:Lookup("Box_Item") local txt = h:Lookup("Text_Item") txt:SetText(szName) txt:SetFontColor(GetItemFontColorByQuality(item.nQuality)) if GKP_Loot.bSetColor and item.nGenre == ITEM_GENRE.MATERIAL then for k, v in pairs(g_tStrings.tForceTitle) do if szName:find(v) then txt:SetFontColor(JH.GetForceColor(k)) break end end end else handle:AppendItemFromString("<Box>name=\"Box_Item\" w=64 h=64 </Box>") box = handle:Lookup(k - 1) -- append box local x, y = (k - 1) % 6, math.ceil(k / 6) - 1 box:SetRelPos(x * 70 + 5, y * 70 + 5) end UpdateBoxObject(box, UI_OBJECT_ITEM_ONLY_ID, item.dwID) -- box:SetOverText(3, "") -- box:SetOverTextFontScheme(3, 15) -- box:SetOverTextPosition(3, ITEM_POSITION.LEFT_TOP) box.data = { dwID = item.dwID, nQuality = item.nQuality, szName = szName, bNeedRoll = v.bNeedRoll, bDist = v.bDist, bBidding = v.bBidding, item = v.item, } if GKP_LOOT_AUTO[item.nUiId] then box:SetObjectStaring(true) end end handle:FormatAllItemPos() -- frame:Lookup("", "Text_Title"):SetText(g_tStrings.STR_LOOT_SHOW_LIST .. " - " .. szName) frame:Lookup("", "Text_Title"):SetText(szName) end function Loot.GetFrame(dwID) return Station.Lookup("Normal/GKP_Loot_" .. dwID) end function Loot.OpenFrame(dwID) local frame = Wnd.OpenWindow(GKP_LOOT_INIFILE, "GKP_Loot_" .. dwID) frame.ani = true Loot.DrawLootList(dwID) PlaySound(SOUND.UI_SOUND, g_sound.OpenFrame) JH.Animate(frame, 200):Scale(0.6):FadeIn(function() frame.ani = nil Loot.DrawLootList(dwID) end) end -- 手动关闭 不适用自定关闭 function Loot.CloseFrame(dwID) local frame = Loot.GetFrame(dwID) if frame then PlaySound(SOUND.UI_SOUND, g_sound.CloseFrame) JH.Animate(frame, 200):Scale(0.6, true):FadeOut(function() if frame and not frame.ani then Wnd.CloseWindow(frame) end end) end end -- 检查物品 function Loot.GetDoodad(dwID) local me = GetClientPlayer() local d = GetDoodad(dwID) local data = {} local szName local bSpecial = false if me and d then szName = d.szName local nLootItemCount = d.GetItemListCount() for i = 0, nLootItemCount - 1 do local item, bNeedRoll, bDist, bBidding = d.GetLootItem(i, me) if item and item.nQuality > 0 then local szItemName = GetItemNameByItem(item) if GKP_LOOT_HUANGBABA[szItemName] then bSpecial = true end -- bSpecial = true -- debug table.insert(data, { item = item, bNeedRoll = bNeedRoll, bDist = bDist, bBidding = bBidding }) end end end return szName, data, bSpecial end -- 摸箱子 JH.RegisterEvent("OPEN_DOODAD", function() if arg1 == UI_GetClientPlayerID() then local team = GetClientTeam() if not team or team and team.nLootMode ~= PARTY_LOOT_MODE.DISTRIBUTE -- and not (GKP.bDebug2 and JH.bDebugClient) then return end local doodad = GetDoodad(arg0) local nM = doodad.GetLootMoney() or 0 if nM > 0 then LootMoney(arg0) PlaySound(SOUND.UI_SOUND, g_sound.PickupMoney) end local szName, data = Loot.GetDoodad(arg0) local frame = Loot.GetFrame(arg0) if #data == 0 then if frame then Wnd.CloseWindow(frame) end return elseif not frame then Loot.OpenFrame(arg0) else if not frame.ani then Loot.DrawLootList(arg0) end end JH.Debug("Open Doodad: " .. arg0) -- local hLoot = Station.Lookup("Normal/LootList") -- if hLoot then -- hLoot:SetAbsPos(4096, 4096) -- end -- Wnd.CloseWindow("LootList") end end) -- 刷新箱子 JH.RegisterEvent("SYNC_LOOT_LIST", function() local frame = Loot.GetFrame(arg0) if (GKP.bDebug2 and JH.bDebugClient) or frame then if not frame then local szName, data = Loot.GetDoodad(arg0) if #data > 0 then Loot.OpenFrame(arg0) end end if Loot.GetFrame(arg0) then if frame and not frame.ani then Loot.DrawLootList(arg0) end end end end) JH.RegisterEvent("GKP_LOOT_BOSS", function() if not arg0 then GKP_LOOT_BOSS = nil GKP_LOOT_AUTO = {} else local team = GetClientTeam() if team then for k, v in ipairs(team.GetTeamMemberList()) do local info = GetClientTeam().GetMemberInfo(v) if info.szName == arg0 then GKP_LOOT_BOSS = v break end end end end end) local function pubg() local me = GetClientPlayer() for k, v in pairs(GKP_ALL_FRAME) do if v and v:IsValid() and v.dwDoodadID then local dwDoodadID = v.dwDoodadID local doodad = GetDoodad(dwDoodadID) Output(44) if doodad.CanDialog(me) then local szName, data = Loot.GetDoodad(v.dwDoodadID) for kk, vv in ipairs(data) do -- 自动减白色以上装备 或者不是装备的道具 if ( vv.item.nGenre == ITEM_GENRE.EQUIPMENT and vv.item.nQuality > 1 ) or vv.item.nGenre ~= ITEM_GENRE.EQUIPMENT then LootItem(v.dwDoodadID, vv.item.dwID) end end else -- JH.Topmsg(g_tStrings.TIP_TOO_FAR) end end end end JH.RegisterEvent("LOADING_END", function() if GetClientPlayer().GetMapID() == 296 then JH.BreatheCall("gkp-pubg", pubg) else JH.UnBreatheCall("gkp-pubg") end end) local ui = { GetMessageBox = Loot.GetMessageBox, GetaPartyMember = Loot.GetaPartyMember } setmetatable(GKP_Loot, { __index = ui, __newindex = function() end, __metatable = true })
local tonumber = tonumber local random = require "resty.random".bytes local var = ngx.var local defaults = { length = tonumber(var.session_random_length, 10) or 16 } return function(session) local config = session.random or defaults local length = tonumber(config.length, 10) or defaults.length return random(length, true) or random(length) end
return { map_id = 10008, id = 1012500, stages = { { stageIndex = 1, failCondition = 1, timeCount = 180, passCondition = 1, backGroundStageID = 1, totalArea = { -80, 20, 90, 70 }, playerArea = { -80, 20, 45, 68 }, enemyArea = {}, mainUnitPosition = { { Vector3(-105, 0, 58), Vector3(-105, 0, 78), Vector3(-105, 0, 38) }, [-1] = { Vector3(15, 0, 58), Vector3(15, 0, 78), Vector3(15, 0, 38) } }, fleetCorrdinate = { -80, 0, 75 }, waves = { { triggerType = 1, waveIndex = 100, preWaves = {}, triggerParams = { timeout = 0.5 } }, { triggerType = 1, waveIndex = 202, preWaves = {}, triggerParams = { timeout = 18 } }, { triggerType = 1, waveIndex = 203, preWaves = {}, triggerParams = { timeout = 33 } }, { triggerType = 1, waveIndex = 204, preWaves = {}, triggerParams = { timeout = 44 } }, { triggerType = 0, waveIndex = 101, conditionType = 1, preWaves = { 100 }, triggerParam = {}, spawn = { { monsterTemplateID = 10052001, moveCast = true, delay = 0, score = 0, corrdinate = { 10, 0, 70 }, buffList = { 8001, 8007 } }, { monsterTemplateID = 10052009, reinforceDelay = 8, score = 0, delay = 0, moveCast = true, corrdinate = { -15, 0, 75 } }, { monsterTemplateID = 10052001, moveCast = true, delay = 0, score = 0, corrdinate = { 0, 0, 55 }, buffList = { 8001, 8007 } }, { monsterTemplateID = 10052010, reinforceDelay = 8, score = 0, delay = 0, moveCast = true, corrdinate = { -15, 0, 35 } }, { monsterTemplateID = 10052001, moveCast = true, delay = 0, score = 0, corrdinate = { 10, 0, 40 }, buffList = { 8001, 8007 } } }, reinforcement = { { monsterTemplateID = 10052017, moveCast = true, delay = 0, score = 0, corrdinate = { 30, 0, 55 }, buffList = { 8001, 8002 } } } }, { triggerType = 0, waveIndex = 102, conditionType = 1, preWaves = { 101, 202 }, triggerParam = {}, spawn = { { monsterTemplateID = 10052001, moveCast = true, delay = 0, score = 0, corrdinate = { 15, 0, 75 }, buffList = { 8001, 8007 } }, { monsterTemplateID = 10052012, moveCast = true, delay = 0, score = 0, corrdinate = { -15, 0, 65 } }, { monsterTemplateID = 10052007, moveCast = true, delay = 0, score = 0, corrdinate = { -15, 0, 45 } }, { monsterTemplateID = 10052001, moveCast = true, delay = 0, score = 0, corrdinate = { 15, 0, 35 }, buffList = { 8001, 8007 } } }, airFighter = { { interval = 10, onceNumber = 2, formation = 10006, delay = 0, templateID = 520107, totalNumber = 2, weaponID = { 520205 }, attr = { airPower = 40, maxHP = 15, attackRating = 23 } } } }, { triggerType = 0, waveIndex = 103, conditionType = 1, preWaves = { 102, 203 }, triggerParam = {}, spawn = { { monsterTemplateID = 10052004, moveCast = true, delay = 0, score = 0, corrdinate = { -15, 0, 75 } }, { monsterTemplateID = 10052005, moveCast = true, delay = 0, score = 0, corrdinate = { -15, 0, 55 } }, { monsterTemplateID = 10052006, moveCast = true, delay = 0, score = 0, corrdinate = { -15, 0, 45 } } } }, { triggerType = 0, waveIndex = 104, conditionType = 1, preWaves = { 103, 204 }, triggerParam = {}, spawn = { { monsterTemplateID = 10052014, reinforceDelay = 8, score = 0, delay = 0, moveCast = true, corrdinate = { -10, 0, 55 } } }, reinforcement = { { monsterTemplateID = 10052001, moveCast = true, delay = 0, score = 0, corrdinate = { 10, 0, 75 }, buffList = { 8001, 8007 } }, { monsterTemplateID = 10052001, moveCast = true, delay = 0, score = 0, corrdinate = { 10, 0, 35 }, buffList = { 8001, 8007 } } }, airFighter = { { interval = 10, onceNumber = 2, formation = 10006, delay = 0, templateID = 520108, totalNumber = 2, weaponID = { 520204 }, attr = { airPower = 40, maxHP = 15, attackRating = 23 } } } }, { triggerType = 5, waveIndex = 400, preWaves = { 104, 103, 102, 101 }, triggerParams = { bgm = "battle-boss-1" } }, { triggerType = 3, waveIndex = 500, preWaves = { 104, 103, 102, 101 }, triggerParams = { id = "ZHUNUO9" } }, { triggerType = 0, waveIndex = 105, conditionType = 0, preWaves = { 500 }, triggerParam = {}, spawn = { { score = 0, reinforceDelay = 7, monsterTemplateID = 10055004, delay = 0, moveCast = true, corrdinate = { 0, 0, 45 }, bossData = { hpBarNum = 80, icon = "genaisennao" }, phase = { { index = 0, switchType = 2, switchTo = 1, switchParam = 0.7, addWeapon = { 520513, 520514, 520516, 520517, 520518 } }, { index = 1, switchType = 2, switchTo = 2, switchParam = 0.4, addBuff = { 8503 } }, { index = 2, setAI = 70027, removeBuff = { 8503 }, addBuff = { 8504 }, removeWeapon = { 520513, 520514, 520516, 520517, 520518 }, addWeapon = { 520515 } } } }, { score = 0, reinforceDelay = 7, monsterTemplateID = 10055003, delay = 0, moveCast = true, corrdinate = { 0, 0, 75 }, bossData = { hpBarNum = 80, icon = "shaenhuosite" }, phase = { { index = 0, switchType = 2, switchTo = 1, switchParam = 0.7, addWeapon = { 520519, 520520, 520522, 520523, 520524 } }, { index = 1, switchType = 2, switchTo = 2, switchParam = 0.4, addBuff = { 8503 } }, { index = 2, setAI = 70028, removeBuff = { 8503 }, addBuff = { 8504 }, removeWeapon = { 520519, 520520, 520522, 520523, 520524 }, addWeapon = { 520521 } } } } }, reinforcement = { { monsterTemplateID = 10052016, moveCast = true, delay = 0, score = 10, corrdinate = { 10, 0, 80 }, buffList = { 8001, 8007 } }, { monsterTemplateID = 10052001, moveCast = true, delay = 0, score = 10, corrdinate = { 20, 0, 65 }, buffList = { 8001, 8007 } }, { monsterTemplateID = 10052017, moveCast = true, delay = 0, score = 10, corrdinate = { 30, 0, 55 }, buffList = { 8001, 8002 } }, { monsterTemplateID = 10052001, moveCast = true, delay = 0, score = 10, corrdinate = { 20, 0, 45 }, buffList = { 8001, 8007 } }, { monsterTemplateID = 10052016, moveCast = true, delay = 0, score = 10, corrdinate = { 10, 0, 30 }, buffList = { 8001, 8007 } } } }, { triggerType = 8, waveIndex = 900, preWaves = { 105 }, triggerParams = {} }, { triggerType = 1, waveIndex = 205, preWaves = { 105 }, triggerParams = { timeout = 1 } }, { triggerType = 3, waveIndex = 501, preWaves = { 205 }, triggerParams = { id = "ZHUNUO10", progress = 100 } }, { triggerType = 1, key = true, waveIndex = 206, conditionType = 0, preWaves = { 501 }, triggerParams = { timeout = 0.5 } } } } }, fleet_prefab = {} }
-- Taiidan Number_Properties_Priority = 1.0 Number_Properties = { cfg_race_is_playable = 1.0, cfg_race_index_sort = 6.0, cfg_race_select_weight = 1.0, cfg_race_is_random = 0.0, cfg_build_by_ships = 1.0, --CPU Build persona_demand_scale_fighters = 7, persona_demand_scale_corvettes = 5, persona_demand_scale_frigates = 1, -- AI Default persona_build_ships_scalar = 4.0, persona_build_ships_befull = 0.0, persona_build_open_chan_adjust = 0.0, persona_bigspender = 1.0, -- Resource persona_mil_2_collector_scale = 0.3, -- Military persona_comp_scale0 = 1.25, persona_comp_scale1 = 1.5, persona_comp_scale2 = 1.75, persona_comp_scale3 = 2, persona_group_scale = 3, cfg_hyperspace_effect_time = 9.5, cfg_buildable_subsystems = 0.0, ai_demand_reset_value = 3.0, persona_rus_for_builder = 1500.0, persona_demand_builder_adjust = -2.25, } String_Properties_Priority = 1.0 String_Properties = { cfg_hyperspace_effect_fx = "hyperspace_gate", cfg_hyperspace_effect_audio = [[etg/special/SPECIAL_ABILITIES_HYPERSPACE_IN]], path_build = [[data:scripts/races/taiidan_hwce/scripts/def_build.lua]], path_research = [[data:scripts/races/taiidan_hwce/scripts/def_research.lua]], path_ai = [[data:scripts/races/taiidan_hwce/scripts/def_ai.lua]], -- doesn't exist path_ai_special = [[data:scripts/races/taiidan_hwce/scripts/ai_special.lua]], path_ai_research = [[data:scripts/races/taiidan_hwce/scripts/ai_upgrades.lua]], path_ai_build = [[data:scripts/races/taiidan_hwce/scripts/ai_build.lua]], -- these should not be required anymore -- path_crate_locate = [[data:scripts/races/taiidan_hwce/scripts/crate_locate.lua]], -- path_crate_ships = [[data:scripts/races/taiidan_hwce/scripts/crate_ships.lua]], -- def_type_mothership = "tai_mothership", -- def_type_carrier = "tai_carrier", -- def_type_scout = "tai_scout", }
object_tangible_holiday_love_day_rewards_11_love_day_prop_2011_flowers_s01_r = object_tangible_holiday_love_day_rewards_11_shared_love_day_prop_2011_flowers_s01_r:new { } ObjectTemplates:addTemplate(object_tangible_holiday_love_day_rewards_11_love_day_prop_2011_flowers_s01_r, "object/tangible/holiday/love_day/rewards_11/love_day_prop_2011_flowers_s01_r.iff")
local M = {} local ERROR = vim.lsp.protocol.DiagnosticSeverity.Error local pattern = 'Error:%s+([%a+_?]+)%s+%(line:%s+(%d+),%s+col:%s+(%d+)%):%s+(.*)$' local diagnostic_skeleton = { source = 'norminette', severity = ERROR } M.parser = function(output) local result = vim.fn.split(output, "\n") local diagnostics = {} for idx, message in ipairs(result) do if idx == 1 then goto continue end -- Jump first line of Norminette output. E.g: "File.c: OK!" local code, lineno, offset, msg = string.match(message, pattern) lineno = tonumber(lineno or 1) - 1 offset = tonumber(offset or 1) - 1 local d = vim.deepcopy(diagnostic_skeleton) -- HACK: Need a better idea to ignore norminette errors. if msg == nil then goto continue end table.insert(diagnostics, vim.tbl_deep_extend('force', d, { code = code, range = { ['start'] = {line = lineno, character = offset}, ['end'] = {line = lineno, character = offset + 1} }, message = 'NORME: ' .. msg .. '(' .. code .. ')', })) ::continue:: end return diagnostics end return M
local wibox = require("wibox") local awful = require("awful") local naughty = require("naughty") local watch = require("awful.widget.watch") local path_to_icons = "/usr/share/icons/Arc/actions/22/" email_widget = wibox.widget.textbox() email_widget:set_font('Play 9') email_icon = wibox.widget.imagebox() email_icon:set_image(path_to_icons .. "/mail-mark-new.png") local script_path ="/home/giao/.config/awesome/awesome-wm-widgets/email-widget/" watch( "python " .. script_path .. "count_unread_emails_xdays.py", 20, --"python " .. script_path .. "count_unread_emails.py", 300, function(widget, stdout, stderr, exitreason, exitcode) local unread_emails_num = tonumber(stdout) or -1 if (unread_emails_num > 0) then email_icon:set_image(path_to_icons .. "/mail-mark-unread.png") --email_icon:set_image(path_to_icons .. "star.png") email_widget:set_text(stdout) elseif (unread_emails_num == 0) then email_icon:set_image(path_to_icons .. "/mail-message-new.png") --email_icon:set_image(path_to_icons .. "exit.png") email_widget:set_text(stdout) else email_icon:set_image(path_to_icons .. "exit.png") --email_widget:set_text("cant access mail server ?") email_widget:set_text(stdout) end end ) function show_emails() awful.spawn.easy_async([[bash -c 'python /home/giao/.config/awesome/awesome-wm-widgets/email-widget/read_unread_emails_xdays.py']], function(stdout, stderr, reason, exit_code) naughty.notify{ text = stdout, title = "Unread Emails", timeout = 10, hover_timeout = 1, width = 400, } end ) end email_icon:connect_signal("mouse::enter", function() show_emails() end)
-- Advanced Vehicles by Andrey01 adv_vehicles = {} global_nodenames_list = {} -- Creates a list with all registered nodes. local i = 0 for node_name, def in pairs(minetest.registered_nodes) do i = i+1 global_nodenames_list[i] = node_name end -- DEPRECATED Rounds 'num' to the tenth and return the rounded number. local function round_num(num) local int, frac = math.modf(num) local to_str = tostring(num) local to_str_frac = tostring(frac) local dot_ind = string.find(to_str_frac, '.') local tenth_rank = string.sub(to_str_frac, dot_ind+2, dot_ind+2) local new_frac = string.gsub(to_str_frac, tenth_rank, "0") local new_frac_to_int = tonumber(new_frac) local new_frac2 = string.gsub(to_str, tenth_rank, tostring(tonumber(tenth_rank)+1)) local rounded_num = (new_frac_to_int < 0.05 and num-new_frac) or (new_frac_to_int >= 0.05 and tonumber(string.sub(new_frac2, 1, dot_ind+2))) return rounded_num end --[[adv_vehicles.get_obj_and_seat_pos = function(name) minetest.debug(dump(vehs[name])) return vehs[name] end]] local is_car_driven = nil -- The method calculates new position for any car seat (for example, after a car turning) adv_vehicles.rotate_point_around_other_point = function (circle_centre_pos, rotating_point_pos, fixed_point_yaw, current_point_yaw) local turn_angle = current_point_yaw-fixed_point_yaw local new_pos = {x=rotating_point_pos.x, y=circle_centre_pos.y, z=rotating_point_pos.z} new_pos.x = circle_centre_pos.x + (rotating_point_pos.x-circle_centre_pos.x) * math.cos(turn_angle) - (rotating_point_pos.z-circle_centre_pos.z) * math.sin(turn_angle) new_pos.z = circle_centre_pos.z + (rotating_point_pos.z-circle_centre_pos.z) * math.cos(turn_angle) + (rotating_point_pos.x-circle_centre_pos.x) * math.sin(turn_angle) return new_pos end vehs = {} -- The method attaches a player to the car adv_vehicles.attach_player_to_veh = function(player, vehicle, seated, model, animation) if vehicle.seats_list[seated].busy_by then minetest.chat_send_player(player:get_player_name(), "This seat is busy by" .. vehicle.seats_list[seated].busy_by .. "!") return end local name = player:get_player_name() vehs[name] = {} --vehs[name].obj = vehicle vehicle.seats_list[seated].busy_by = player:get_player_name() local veh_rot = vehicle.object:get_rotation() local new_seat_pos = adv_vehicles.rotate_point_around_other_point({x=0, y=0, z=0}, vehicle.seats_list[seated].pos, vehicle.fixed_veh_rotate_angle, veh_rot.y) vehs[name].r_seat_pos = new_seat_pos new_seat_pos.y = 9 vehicle.seats_list[seated].pos = new_seat_pos local meta = player:get_meta() meta:set_string("is_sit", minetest.serialize({veh_name, seated})) local new_player_rot = {x=math.deg(veh_rot.x), y=veh_rot.y+180, z=math.deg(veh_rot.z)} local p=vehicle.object:get_pos() --player:set_pos({x=p.x+new_seat_pos.x, y=p.y, z=p.z+new_seat_pos.z}) local eye_offset_fi, eye_offset_th = player:get_eye_offset() if vehicle.seats_list[seated].eye_offset then local eye_off = vehicle.seats_list[seated].eye_offset player:set_eye_offset({x=eye_offset_fi.x+eye_off.x, y=eye_offset_fi.y+(eye_off.y or 0), z=eye_offset_fi.z+eye_off.z}, eye_offset_th) end player:set_attach(vehicle.object, "", new_seat_pos, new_player_rot) --[[if not vehicle.seats_list[seated].eye_offset then player:set_eye_offset({x=vehicle.seats_list[seated].pos.x, y=0, z=vehicle.seats_list[seated].pos.z}, eye_offset) else player:set_eye_offset({z=vehicle.seats_list[seated].eye_offset.x, y=0, z=vehicle.seats_list[seated].eye_offset.z}, eye_offset) end]] --player:set_eye_offset({x=-4.0, y=-3.0, z=3.0}, eye_offset) if model then player:set_properties({mesh=model}) end if animation then player:set_animation({x=animation.x, y=animation.y}) end end -- The method detaches a player from the car adv_vehicles.detach_player_from_veh = function (player, vehicle, seated, model, animation) if not vehicle.seats_list[seated].busy_by then return end local name = player:get_player_name() vehs[name] = nil local meta = player:get_meta() meta:set_string("is_sit", "") vehicle.seats_list[seated].busy_by = nil player:set_detach() player:set_eye_offset({x=0, y=0, z=0}, {x=0, y=0, z=0}) if model then player:set_properties({mesh=model}) end if animation then player:set_animation({x=animation.x, y=animation.y}) end end -- Moves a point around the centre dependently on the rotation angle and returns derived new position of that point. -- *old_yaw is a fixed_veh_rotation_angle is saved in an entity. -- *old_acc_vect_pos is an acceleration vector position is also saved in the entity. adv_vehicles.pave_vector = function (vehicle, old_acc_vect_pos, old_yaw) local yaw = vehicle.object:get_yaw() if yaw == old_yaw then return vehicle.acc_vector_pos, yaw end local new_acc_vect_pos = adv_vehicles.rotate_point_around_other_point({x=0, y=0, z=0}, old_acc_vect_pos, old_yaw, yaw) return new_acc_vect_pos, yaw end -- WARNING! This method doesn`t work properly currently. adv_vehicles.rotate_collisionbox = function (vehicle, yaw) if yaw % 90 ~= 0 then return end local veh_cbox = vehicle.object:get_properties().collisionbox local cur_cbox_dir = vehicle.collisionbox_yaw.along_axis local axle_num local new_axle_num = 1 local axises_table = {"z", "x", "-z", "-x"} for num, axis in pairs(axises_table) do if axis == cur_cbox_dir then axle_num = num break end end local times = yaw / 90 for i = 1, math.abs(times)+1 do if times < 0 then if axises_table[1] == cur_cbox_dir then new_axle_num = axises_table[#axises_table] else new_axle_num = new_axle_num - 1 end else if axises_table[#axises_table] == cur_cbox_dir then new_axle_num = axises_table[1] else new_axle_num = new_axle_num + 1 end end end local new_cbox_dir = axises_table[new_axle_num] local cboxes = { ["z"] = {veh_cbox[1], veh_cbox[2], veh_cbox[3], veh_cbox[4], veh_cbox[5], veh_cbox[6]}, ["x"] = {veh_cbox[3], veh_cbox[2], veh_cbox[1], veh_cbox[6], veh_cbox[5], veh_cbox[4]}, ["-z"] = {veh_cbox[1]*-1, veh_cbox[2], veh_cbox[3]*-1, veh_cbox[4]*-1, veh_cbox[5], veh_cbox[6]*-1}, ["-x"] = {veh_cbox[3]*-1, veh_cbox[2], veh_cbox[1]*-1, veh_cbox[6]*-1, veh_cbox[5], veh_cbox[4]*-1} } local new_cbox = cboxes[new_cbox_dir] vehicle.object:set_properties({collisionbox=new_cbox}) local old_cbox_yaw = vehicle.collisionbox_yaw.val vehicle.collisionbox_yaw = {val=old_cbox_yaw+yaw, along_axis=new_cbox_dir} end local is_fallen -- Bounces a car only due to the falling. adv_vehicles.collide = function (vehicle) local vel = vehicle.object:get_velocity() local fixed_vel = vehicle.y_vel local seats_list = vehicle.seats_list local hp = vehicle.object:get_hp() if vel.y == 0 and fixed_vel ~= 0 then if not is_fallen then is_fallen = true local acc = vehicle.object:get_acceleration() vehicle.object:set_acceleration({x=acc.x, y=math.abs(fixed_vel)*10, z=acc.z}) vehicle.object:set_hp(hp-math.abs(math.ceil(fixed_vel)), {type="fall"}) for seated, data in pairs(seats_list) do if seated.busy_by then local player = minetest.get_player_by_name(seated.busy_by) local player_hp = player:get_hp() player:set_hp(player_hp-math.abs(math.ceil(fixed_vel)), {type="fall"}) end end end else is_fallen = nil end end -- Called in each 0.1 second in the globalstep, decelerates the vehicle speed. -- *vector_l is a vector length adv_vehicles.vehicle_braking = function (vehicle, vector_l) local obj = vehicle.object local vel = obj:get_velocity() local vel_l = vector.length(vel) local acc_x = -(vel.x*vector_l/vel_l) local acc_z = -(vel.z*vector_l/vel_l) local acc_y = obj:get_acceleration().y obj:set_acceleration({x=acc_x, y=acc_y, z=acc_z}) local new_acc = obj:get_acceleration() local new_vel = obj:get_velocity() if vector.length(new_vel) < 0.03 and not is_car_driven then obj:set_velocity({x=0, y=new_vel.y, z=0}) obj:set_acceleration({x=0, y=new_acc.y, z=0}) end end local R_ANGLE_TURN_ACC = 1 -- Acceleration value of turn (to right) local L_ANGLE_TURN_ACC = 1 -- Acceleration value of turn (to left) -- Implements vehicle controls (turning, moving forward/backwards). adv_vehicles.vehicle_handle = function (vehicle, controls, yaw) local vel_l = vector.length(vehicle.object:get_velocity()) local new_yaw=math.deg(yaw) local acc = vehicle.object:get_acceleration() if controls.right and vel_l ~= 0 then vehicle.object:set_yaw(yaw-math.rad(R_ANGLE_TURN_ACC)) if R_ANGLE_TURN_ACC < 25 then R_ANGLE_TURN_ACC = R_ANGLE_TURN_ACC+vel_l-acc.y end new_yaw = math.deg(vehicle.object:get_yaw()) local fixed_cbox_yaw = vehicle.collisionbox_yaw.val if new_yaw-fixed_cbox_yaw <= -90 then --minetest.debug("1") adv_vehicles.rotate_collisionbox(vehicle, -90) end else if R_ANGLE_TURN_ACC > 1 then -- If the vehicle was turned with an acceleration in last step, then decelerates the vehicle turn. R_ANGLE_TURN_ACC = R_ANGLE_TURN_ACC - 1 vehicle.object:set_yaw(yaw+math.rad(R_ANGLE_TURN_ACC)) else R_ANGLE_TURN_ACC = 1 end end if controls.left and vel_l ~= 0 then vehicle.object:set_yaw(yaw+math.rad(L_ANGLE_TURN_ACC)) if L_ANGLE_TURN_ACC < 25 then L_ANGLE_TURN_ACC = L_ANGLE_TURN_ACC+vel_l-acc.y end new_yaw = math.deg(vehicle.object:get_yaw()) local fixed_cbox_yaw = vehicle.collisionbox_yaw.val if new_yaw+fixed_cbox_yaw >= 90 then --minetest.debug("2") adv_vehicles.rotate_collisionbox(vehicle, 90) end else if L_ANGLE_TURN_ACC > 1 then L_ANGLE_TURN_ACC = L_ANGLE_TURN_ACC - 1 vehicle.object:set_yaw(yaw-math.rad(L_ANGLE_TURN_ACC)) else L_ANGLE_TURN_ACC = 1 end end local up_and_down_vals = {controls.up, controls.down} local t = {1, -1} local s for i, v in pairs(up_and_down_vals) do if v then s = t[i] end end if (controls.up and s) or (controls.down and s) then is_car_driven=true vehicle.object:set_acceleration({x=vehicle.acc_vector_pos.x*s, y=acc.y, z=vehicle.acc_vector_pos.z*s}) else is_car_driven=nil end --[[if controls.up then is_car_driven=true vehicle.object:set_acceleration({x=vehicle.acc_vector_pos.x, y=acc.y, z=vehicle.acc_vector_pos.z}) else is_car_driven=nil end if controls.down then is_car_driven=true vehicle.object:set_acceleration({x=vehicle.acc_vector_pos.x*-1, y=acc.y, z=vehicle.acc_vector_pos.z*-1}) else is_car_driven=nil end ]] return math.rad(new_yaw) end --[[adv_cars.nearby_nodes_are = function (car) local vel = car.object:get_velocity() local pos = car.object:get_pos() local meta = minetest.deserialize(minetest.get_meta():get_string("is_sit")) local z_face = minetest.registered_entities[meta.car_name].collisionbox[6] if (vel.x and vel.y and vel.z) ~= 0 then local nearby_nodes = minetest.find_node_near(pos, z_face, global_nodenames_list)]] -- Registers a vehicle to the world and creates a spawner item for it with a crafting recipe. adv_vehicles.register_vehicle = function (vehname, veh_properties, veh_item) minetest.register_entity("adv_vehicles:"..vehname, { visual = "mesh", physical = true, mass = veh_properties.mass or 2000, acc_vector_length = veh_properties.acc_vector_length, max_vel = veh_properties.max_vel or 120, collide_with_objects = true, collisionbox = veh_properties.cbox, selectionbox = veh_properties.sbox or veh_properties.cbox, pointable=true, mesh = veh_properties.model, textures = veh_properties.textures, visual_size = veh_properties.visual_size or {x=1, y=1, z=1}, use_texture_alpha = true, on_activate = function (self, staticdata, dtime_s) -- Fixed vehicle rotation angle (in rads). Necessary for calculating a point position. self.fixed_veh_rotate_angle = math.rad(0) self.collisionbox_yaw = {val=0, along_axis="z"} -- Entitysting of an object. self.entity_name = "adv_vehicles:"..vehname -- List of a vehicle seats. Fields: 'driver'/'passenger', both keep 'busy_by' (playername) and 'pos' (of the seat) inside. self.seats_list = {} for seated, data in pairs(veh_properties.seats) do self.seats_list[seated] = data self.seats_list[seated].pos.y = 0 end self.y_vel = 0 local acc = self.object:get_acceleration() local gravity_strength = veh_properties.mass * -9.8 self.object:set_acceleration({x=acc.x, y=gravity_strength, z=acc.z}) local acc2 = self.object:get_acceleration() -- Original acceleration vector position (along to -z dir). self.acc_vector_pos = {x=0, y=acc2.y, z=veh_properties.acc_vector_length*-1} yaw = self.object:get_yaw() --Called in each 0.1 second. minetest.register_globalstep(function(dtime) local entity = self.object:get_luaentity() if entity then local obj = entity.object local vel = obj:get_velocity() if vel.y ~= 0 then entity.y_vel = vel.y end local acc = obj:get_acceleration() if acc.y > 0 then obj:set_acceleration({x=acc.x, y=gravity_strength, z=acc.z}) end adv_vehicles.collide(entity) -- Further it will get new position for the acceleration vector dependently on fixed rotation angle and fix new rotation angles. entity.acc_vector_pos, entity.fixed_veh_rotate_angle = adv_vehicles.pave_vector(entity, entity.acc_vector_pos, entity.fixed_veh_rotate_angle) if entity.seats_list["driver"].busy_by then local player = minetest.get_player_by_name(entity.seats_list["driver"].busy_by) yaw = entity.on_handle(entity, player:get_player_control(), yaw) end -- If a length of the velocity vector exceeds a 'max_vel' value, sets to zero the acceleration vector. local vel_length = vector.length(vel) if vel_length >= veh_properties.max_vel then obj:set_acceleration({x=0, y=gravity_strength, z=0}) end if not is_car_driven and vel_length ~= 0 then adv_vehicles.vehicle_braking(entity, 8) end end end) end, on_handle = adv_vehicles.vehicle_handle, on_death = function (self, killer) for seated, data in pairs(self.seats_list) do if self.seats_list[seated].busy_by and minetest.get_player_by_name(self.seats_list[seated].busy_by) then local player = minetest.get_player_by_name(self.seats_list[seated].busy_by) adv_vehicles.detach_player_from_veh(player, self, seated, "character.b3d") end end end, --[[on_attach_child = function (self, child) local meta = minetest.deserialize(child:get_meta():get_string("is_sit")) minetest.debug(dump(meta)) if meta.passenger then minetest.debug(child:get_player_name()) return end minetest.register_globalstep(function(dtime) local entity = self.object:get_luaentity() if entity then if entity.seats_list.driver.busy_by then local yaw = entity.object:get_yaw() local new_yaw = self.on_handle(entity, child:get_player_control(), yaw) yaw = new_yaw end end end) end, ]] on_rightclick = function (self, clicker) local seats_list = self.seats_list for seated, data in pairs(seats_list) do if data.busy_by == nil then if seated == "driver" then adv_vehicles.attach_player_to_veh(clicker, self, seated, "driver.b3d") self.is_veh_stopping=nil else adv_vehicles.attach_player_to_veh(clicker, self, seated, nil, {x=81, y=81}) end break elseif data.busy_by == clicker:get_player_name() then if seated == "driver" then adv_vehicles.detach_player_from_veh(clicker, self, seated, "character.b3d") self.is_veh_stopping=true else adv_vehicles.detach_player_from_veh(clicker, self, seated, nil, {x=1, y=80}) end break end end end }) if veh_item then minetest.register_craftitem("adv_vehicles:"..vehname, { description = veh_item.description, inventory_image = veh_item.inv_image, on_place = function (itemstack, placer, pointed_thing) if pointed_thing.type == "node" then local object = minetest.add_entity(pointed_thing.above, "adv_vehicles:"..vehname) local yaw = math.deg(placer:get_look_horizontal()) object:set_yaw(math.rad(yaw+180)) end end }) minetest.register_craft({ output = "adv_vehicles:"..vehname, recipe = veh_item.craft_recipe }) end end --[[minetest.register_on_joinplayer(function (player) local meta = player:get_meta() local attach = player:get_attach() if attach then local parent = attach[1] local entity = parent:get_luaentity() if entity then local seat_num = meta:get_string("is_sit").seat_num entity.seats_list[seat_num] = nil adv_cars.attach_player_to_car(player, parent, seat_num, "driver.b3d") end end end)]] --[[minetest.register_on_leaveplayer(function(player) if not vehs then vehs = {} end local meta = minetest.deserialize(player:get_meta():get_string("is_sit")) if meta then local name = player:get_player_name() local attached_to = vehs[name] = ]] --[[minetest.register_on_joinplayer(function(player) --minetest.debug(dump(vehs)) local meta = minetest.deserialize(player:get_meta():get_string("is_sit")) if meta then local yaw = player:get_yaw() local name = player:get_player_name() local data = adv_vehicles.get_obj_and_seat_pos(name) --local new_obj = data.obj:get_luaentity() --player:set_attach(new_obj, "", data.r_seat_pos, yaw) end end)]] minetest.register_on_dieplayer(function (player) local meta = player:get_meta() if meta:get_string("is_sit") ~= (nil or "") then local attach = player:get_attach() local player_meta = minetest.deserialize(meta:get_string("is_sit")) local seated = player_meta.seated adv_vehicles.detach_player_from_veh(player, attach[1], seated, "character.b3d") end end)
local L = LibStub("AceLocale-3.0"):NewLocale("StableSnapshot", "esMX") if not L then return end --@localization(locale="esMX", format="lua_additive_table", handle-unlocalized="english", handle-subnamespaces="concat")@
local Long = require("metaint") local MillerRabinTest = require("RSA/Math/MillerRabinTest") local RandomNum = require("RSA/Math/RandomNum") local function mulNum(op1,op2) -- костыль // применяем правила умножения для обработки целых чисел поверх натуральных local inv1 = op1.inv local inv2 = op2.inv local res = op1*op2 res.inv = inv1 ~= inv2 return res end local function subNum(op1,op2) -- костыль // применяем правила вычитания для обработки целых чисел поверх натуральных local inv1 = op1.inv local inv2 = op2.inv if inv1 and inv2 then if op1 > op2 then local res = op1-op2 res.inv = true return res else return op2-op1 end elseif inv1 and not inv2 then local res = op1 + op2 res.inv = true return res elseif not inv1 and inv2 then return op1 + op2 elseif not inv1 and not inv2 then if op1 > op2 then return op1 - op2 else local res = op2 - op1 res.inv = true return res end end end local function addNum(op1,op2) --костыль // применяем a + b = a - (-b) для обработки целых чисел поверх натуральных local op2b = Long(op2) op2b.inv = not op2.inv return subNum(op1,op2b) end local longOne = Long(1) local longZero = Long(0) local longTwo = Long(2) local function extendedEuclideanAlgorithm(a,b) a,b = Long(a),Long(b) local x, xx, y, yy = longOne,longZero,longZero,longOne local q while b > 0 do dontLetTLWY() q = a/b --metaint поддерживает только целочисленное деление a,b = b, a%b x, xx = xx, subNum(x,mulNum(xx,q)) y, yy = yy, subNum(y,mulNum(yy,q)) end return x,y,a end local function modular_inversion(a,m) local x,y,d = extendedEuclideanAlgorithm(a,m) if d == longOne then local m2 = Long(m) m2.inv = true return subNum(x,m2)%m end --print("D",x,y,d) return 0 end -- local function fermaTest(p) --тест ферма над числом 8 раз -- local count = 0 -- local i = Long(1) -- repeat -- i = i + 1 -- if i % p ~= 0 then -- local res = i:pow(p - 1, p) == Long(1) -- if res == false then return false,count end -- count = count + 1 -- end -- dontLetTLWY() -- until count > 8 -- return true -- end local function Prime(L,debug) -- поиск простого числа среди множества чисел длиной L local prime repeat prime = RandomNum(L) --local result,count = fermaTest(prime) dontLetTLWY() local result, chance = MillerRabinTest(prime,L) local accuracy = chance if result then accuracy = 1-accuracy end if debug then print("PRIME FINDING",prime,result,tostring(accuracy*100) .. "% accuracy") end until result return prime end local function fastEncodeOrSign(C,d,p,q,dp,dq,qinv) C = Long(C) if not qinv then dp = d%(p-1) dq = d%(q-1) qinv = modular_inversion(q,p) end local m1 = C:pow(dp,p) local m2 = C:pow(dq,q) local h = (mulNum(subNum(m1,m2),qinv))%p return m2 + h*q end return { modular_inversion = modular_inversion, generate_prime = Prime, fast_EOS = fastEncodeOrSign, }
local oop = require("oop") local stringutils = require("stringutils") local libGUI = require("libGUI") local colors = require("libGUI/colors") local frame_base = require("libGUI/frame") local reactorState = require("brgc/reactor_state") local regulationState = require("brgc/regulation_state") local reactor_load_bar = require("brgc/gui/reactor_load_bar") local grid_controller = require("brgc/grid_controller") local controller_info_big = { mReactorLoadBarLabel = nil, mReactorLoadBar = nil, mReactorLoadText = nil, mTurbineLoadBarLabel = nil, mTurbineLoadBar = nil, mTurbineLoadText = nil, mTotalLoadBarLabel = nil, mTotalLoadBar = nil, mTotalLoadText = nil, mInfoList = nil, mModeLabel = nil, mEnergyStoredLabel = nil, mEnergyProductionLabel = nil, mEnergyDemandLabel = nil, mStorageBar = nil, mModeButtonGroup = nil } oop.inherit(controller_info_big, frame_base) function controller_info_big:construct() frame_base.construct(self) self.mReactorLoadBarLabel = libGUI.newFrame("label", "Reactors", "right") self.mReactorLoadBar = reactor_load_bar() self.mReactorLoadText = libGUI.newFrame("label", nil, "left") self.mTurbineLoadBarLabel = libGUI.newFrame("label", "Turbines", "right") self.mTurbineLoadBar = libGUI.newFrame("bar") self.mTurbineLoadBar:setBorderWidth(0) self.mTurbineLoadText = libGUI.newFrame("label", nil, "left") self.mStorageBar = libGUI.newFrame("bar") self.mStorageBar:setBorderWidth(2) self.mStorageBar:setBarPalette({{math.huge, colors.red}}) self.mTotalLoadBarLabel = libGUI.newFrame("label", "Total", "right") self.mTotalLoadBar = reactor_load_bar() self.mTotalLoadText = libGUI.newFrame("label", nil, "left") self.mModeLabel = libGUI.newFrame("label", nil, "right") self.mEnergyStoredLabel = libGUI.newFrame("label", nil, "right") self.mEnergyProductionLabel = libGUI.newFrame("label", nil, "right") self.mEnergyDemandLabel = libGUI.newFrame("label", nil, "right") local infoListFrame = libGUI.newFrame("list") infoListFrame:addChild(libGUI.newFrame("label", "Mode", "left")) infoListFrame:addChild(self.mModeLabel) infoListFrame:addChild(libGUI.newFrame("label", "Energy Stored / Energy Max")) infoListFrame:addChild(self.mEnergyStoredLabel) infoListFrame:addChild(libGUI.newFrame("label", "Energy Generation Rate (Optimal)", "left")) infoListFrame:addChild(self.mEnergyProductionLabel) infoListFrame:addChild(libGUI.newFrame("label", "Energy Demand (Weighted)", "left")) infoListFrame:addChild(self.mEnergyDemandLabel) self.mModeButtonGroup = libGUI.newFrame("horizontal_layout", 1) local btnOnOff = libGUI.newFrame("toggle_button", "ON/OFF", "center") local btnCharge = libGUI.newFrame("toggle_button", "Charge", "center") function btnOnOff:onStateChange() if not self:getToggleState() then grid_controller.start() else grid_controller.stop() end end function btnOnOff:getToggleState() return grid_controller.isRunning() end function btnCharge:onStateChange() grid_controller.setChargeMode(not grid_controller.getChargeMode()) end function btnCharge:getToggleState() return grid_controller.getChargeMode() end self.mModeButtonGroup:addChild(btnCharge) self.mModeButtonGroup:addChild(btnOnOff) self:addChild(self.mStorageBar) self:addChild(self.mReactorLoadBarLabel) self:addChild(self.mReactorLoadBar) self:addChild(self.mReactorLoadText) self:addChild(self.mTurbineLoadBarLabel) self:addChild(self.mTurbineLoadBar) self:addChild(self.mTurbineLoadText) self:addChild(self.mTotalLoadBarLabel) self:addChild(self.mTotalLoadBar) self:addChild(self.mTotalLoadText) self:addChild(infoListFrame) self:addChild(self.mModeButtonGroup) self.mInfoList = infoListFrame end function controller_info_big:updateInfo() if grid_controller.isRunning() then local energyStoredMax = grid_controller.getMaxEnergyStored() local energyStoredCurrent = grid_controller.getEnergyStored() local energyProducedReactors = grid_controller.getEnergyProductionRateReactors() local energyProducedTurbines = grid_controller.getEnergyProductionRateTurbines() local energyProducedTotal = grid_controller.getEnergyProductionRate() local energyProductionReactorsMax = grid_controller.getEnergyProductionRateReactorsMax() local energyProductionTurbinesMax = grid_controller.getEnergyProductionRateTurbinesMax() local energyProductionTotalMax = energyProductionReactorsMax + energyProductionTurbinesMax local energyProductionTotalOpt = grid_controller.getOptEnergyProduction() local energyProductionReactorOpt = energyProductionTotalOpt - energyProductionTurbinesMax self.mReactorLoadText:setText(stringutils.formatRFt(energyProducedReactors), false) self.mTurbineLoadText:setText(stringutils.formatRFt(energyProducedTurbines), false) self.mTotalLoadText:setText(stringutils.formatRFt(energyProducedTotal), false) if energyProductionReactorsMax <= 0 then self.mReactorLoadBar:setPercentage(0, false) else self.mReactorLoadBar:setPercentage(energyProducedReactors / energyProductionReactorsMax, false) end if self.mReactorLoadBar:getPercentageOptimal() ~= energyProductionReactorOpt / energyProductionReactorsMax then self.mReactorLoadBar:setPercentageOptimal(energyProductionReactorOpt / energyProductionReactorsMax) end if energyProductionTurbinesMax <= 0 then self.mTurbineLoadBar:setPercentage(0, false) else self.mTurbineLoadBar:setPercentage(energyProducedTurbines / energyProductionTurbinesMax, false) end if energyProductionTotalMax <= 0 then self.mTotalLoadBar:setPercentage(0, false) else self.mTotalLoadBar:setPercentage(energyProducedTotal / energyProductionTotalMax, false) end if self.mTotalLoadBar:getPercentageOptimal() ~= energyProductionTotalOpt / energyProductionTotalMax then self.mTotalLoadBar:setPercentageOptimal(energyProductionTotalOpt / energyProductionTotalMax) end if energyStoredMax <= 0 then self.mStorageBar:setPercentage(0, false) else self.mStorageBar:setPercentage(energyStoredCurrent / energyStoredMax, false) end if grid_controller.mState == 2 then self.mModeLabel:setText("HOLDING CHARGE", false) elseif grid_controller.getChargeMode() then self.mModeLabel:setText("CHARGING", false) elseif grid_controller.mState == 1 then self.mModeLabel:setText("INCREASING CHARGE", false) elseif grid_controller.mState == 0 then self.mModeLabel:setText("DECREASING CHARGE", false) else self.mModeLabel:setText("UNKNOWN", false) end self.mEnergyStoredLabel:setText( " " .. stringutils.formatNumber(energyStoredCurrent, "RF", 0, 3) .. " / " .. stringutils.formatNumber(energyStoredMax, "RF", 0, 3) .. string.format(" ( %5.02f%% )", 100 * energyStoredCurrent / energyStoredMax), false) self.mEnergyProductionLabel:setText(stringutils.formatRFt(energyProducedTotal) .. " (" .. stringutils.formatRFt(energyProductionTotalOpt) .. ")", false) self.mEnergyDemandLabel:setText(stringutils.formatRFt(grid_controller.getEnergyExtractionRate()) .. " (" .. stringutils.formatRFt(grid_controller.getEnergyExtractionRateWeighted()) .. ")", false) else self.mModeLabel:setText("DISABLED", false) self.mReactorLoadBar:setPercentage(0, false) self.mTurbineLoadBar:setPercentage(0, false) self.mTotalLoadBar:setPercentage(0, false) self.mStorageBar:setPercentage(0, false) self.mEnergyStoredLabel:setText("---", false) self.mEnergyProductionLabel:setText("---", false) self.mEnergyDemandLabel:setText("--- (---)", false) end end function controller_info_big:onDraw(allowPartial) self:updateInfo() frame_base.onDraw(self, allowPartial) end function controller_info_big:onResize() frame_base.onResize(self) local width, height = self:getSize() self.mStorageBar:setRegion(2, 2, 8, height - 2) self.mReactorLoadBarLabel:setRegion(13, 2, 8, 1) self.mReactorLoadBar:setRegion(22, 2, width - 35, 1) self.mReactorLoadText:setRegion(width - 12, 2, 11, 1) self.mTurbineLoadBarLabel:setRegion(13, 3, 8, 1) self.mTurbineLoadBar:setRegion(22, 3, width - 35, 1) self.mTurbineLoadText:setRegion(width - 12, 3, 11, 1) self.mTotalLoadBarLabel:setRegion(13, 4, 8, 1) self.mTotalLoadBar:setRegion(22, 4, width - 35, 1) self.mTotalLoadText:setRegion(width - 12, 4, 11, 1) if height < 10 and self.mInfoList:getParent() ~= nil then self:removeChild(self.mInfoList) elseif height >= 10 and self.mInfoList:getParent() == nil then self:addChild(self.mInfoList) end if self.mInfoList:getParent() ~= nil then self.mInfoList:setRegion(13, 6, width - 13, math.min(#self.mInfoList.mChildren, height - 9)) end self.mModeButtonGroup:setRegion(12, height - 3, width - 12, 3) end return controller_info_big
----------------------------------- -- Area: The Shrine of Ru'Avitau -- NPC: ??? (Spawn Olla Pequena) -- !pos 851 0.1 92 178 ----------------------------------- local ID = require("scripts/zones/The_Shrine_of_RuAvitau/IDs") require("scripts/globals/status") require("scripts/globals/npc_util") ----------------------------------- function onTrade(player,npc,trade) if trade:hasItemQty(1195, 1) and trade:getItemCount() == 1 then -- Trade Ro'Maeve Water for i = ID.mob.OLLAS_OFFSET, ID.mob.OLLAS_OFFSET + 2 do if GetMobByID(i):isSpawned() then return end end player:tradeComplete() npcUtil.popFromQM(player, npc, ID.mob.OLLAS_OFFSET) end end function onTrigger(player,npc) player:messageSpecial(ID.text.SMALL_HOLE_HERE) end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) end
do local _ = { ['map-settings'] = { max_failed_behavior_count = 3, enemy_evolution = {time_factor = 4e-06, destroy_factor = 0.002, pollution_factor = 9e-07, enabled = true}, pollution = { pollution_restored_per_tree_damage = 10, expected_max_per_chunk = 150, pollution_with_max_forest_damage = 150, enemy_attack_pollution_consumption_modifier = 1, pollution_per_tree_damage = 50, max_pollution_to_restore_trees = 20, ageing = 1, enabled = true, min_to_diffuse = 15, min_pollution_to_damage_trees = 60, diffusion_ratio = 0.02, min_to_show_per_chunk = 50 }, difficulty_settings = { technology_difficulty = 0, technology_price_multiplier = 1, research_queue_setting = 'after-victory', recipe_difficulty = 0 }, unit_group = { max_member_slowdown_when_ahead = 0.6, max_gathering_unit_groups = 30, tick_tolerance_when_member_arrives = 60, member_disown_distance = 10, max_unit_group_size = 200, max_member_speedup_when_behind = 1.4, max_wait_time_for_late_members = 7200, min_group_radius = 5, max_group_member_fallback_factor = 3, min_group_gathering_time = 3600, max_group_gathering_time = 36000, max_group_radius = 30, max_group_slowdown_factor = 0.3 }, type = 'map-settings', steering = { moving = { separation_force = 0.01, separation_factor = 3, radius = 3, force_unit_fuzzy_goto_behavior = false }, default = { separation_force = 0.005, separation_factor = 1.2, radius = 1.2, force_unit_fuzzy_goto_behavior = false } }, enemy_expansion = { max_expansion_distance = 7, max_colliding_tiles_coefficient = 0.9, building_coefficient = 0.1, enemy_building_influence_radius = 2, settler_group_min_size = 5, min_expansion_cooldown = 14400, max_expansion_cooldown = 216000, friendly_base_influence_radius = 2, enabled = true, settler_group_max_size = 20, other_base_coefficient = 2, neighbouring_chunk_coefficient = 0.5, neighbouring_base_chunk_coefficient = 0.4 }, path_finder = { cache_max_connect_to_cache_steps_multiplier = 100, start_to_goal_cost_multiplier_to_terminate_path_find = 2000, stale_enemy_with_same_destination_collision_penalty = 30, min_steps_to_check_path_find_termination = 2000, negative_cache_accept_path_end_distance_ratio = 0.3, ignore_moving_enemy_collision_distance = 5, enemy_with_different_destination_collision_penalty = 30, cache_accept_path_end_distance_ratio = 0.15, cache_path_end_distance_rating_multiplier = 20, cache_accept_path_start_distance_ratio = 0.2, fwd2bwd_ratio = 5, general_entity_collision_penalty = 10, general_entity_subsequent_collision_penalty = 3, overload_multipliers = {2, 3, 4}, short_request_max_steps = 1000, goal_pressure_ratio = 2, long_cache_size = 25, short_cache_min_algo_steps_to_cache = 50, extended_collision_penalty = 3, use_path_cache = true, short_request_ratio = 0.5, short_cache_size = 5, cache_path_start_distance_rating_multiplier = 10, overload_levels = {0, 100, 500}, max_work_done_per_tick = 8000, negative_cache_accept_path_start_distance_ratio = 0.3, short_cache_min_cacheable_distance = 10, negative_path_cache_delay_interval = 20, max_steps_worked_per_tick = 1000, direct_distance_to_consider_short_request = 100, long_cache_min_cacheable_distance = 30, max_clients_to_accept_any_new_request = 10, max_clients_to_accept_short_new_request = 100 }, name = 'map-settings' } }; return _; end
return function(c, s, cs) -- 'glepnir/lspsaga.nvim' return { -- {'LspSagaDiagnosticBorder', c.nord12}, -- {'LspSagaDiagnosticHeader', c.nord12, c.none, s.bold}, -- {'LspSagaDiagnosticTruncateLine', c.nord12}, -- {'LspDiagnosticsFloatingWarn', c.nord12}, -- {'LspDiagnosticsFloatingInfor', c.nord10}, -- {'LspSagaShTruncateLine', c.nord1}, -- {'LspSagaDocTruncateLine', c.nord1}, -- {'LspSagaCodeActionTitle', c.nord12, c.none, s.bold}, -- {'LspSagaCodeActionTruncateLine', c.nord1}, -- {'LspSagaCodeActionContent', c.nord14, c.none, s.bold}, -- {'LspSagaRenamePromptPrefix', c.nord14}, -- {'LspSagaRenameBorder', c.nord7}, -- {'LspSagaHoverBorder', c.nord9}, -- {'LspSagaSignatureHelpBorder', c.nord14}, -- {'LspSagaLspFinderBorder', c.nord10}, -- {'LspSagaCodeActionBorder', c.nord8}, -- {'LspSagaAutoPreview', c.nord12}, -- {'LspSagaDefPreviewBorder', c.nord8} } end
require "util" require "config" require "stdlib.area.tile" require "stdlib.entity.entity" require "stdlib.event.event" require "stdlib.time" local list_initialised = false local entity_list = {} local function count_fluids( entity ) local _fluids = 0 if entity.fluidbox and #entity.fluidbox > 0 then for _, _fluid_box in pairs(entity.fluidbox) do _fluids = _fluids + _fluid_box.amount end end return _fluids end local function clear_fluids( _entity ) for i = 1, #entity.fluidbox do local _fluid_box = entity.fluidbox[i] _fluid_box.amount = 0.0 entity.fluidbox[i] = _fluid_box end end local function create_pollution_at( position, surface, amount ) -- immediatey create some air pollution surface.pollute(position, amount * Config.air_pollution_ratio) -- find some unpolluted ground to contaminate local _new_tiles = {} position = Tile.from_position(position) while amount > 0.0 do local _tile = surface.get_tile(position.x, position.y) if _tile.name ~= "waste" then if _tile.collides_with("water-tile") then table.insert( _new_tiles, { name = "waste-water", position = position } ) else table.insert( _new_tiles, { name = "waste", position = position } ) end amount = amount - 1.0 end position = Tile.adjacent(surface, position, false)[math.random(1,4)] end surface.set_tiles( _new_tiles ) end Event.register(defines.events.on_tick, function(event) if not list_initialised then entity_list = {} for _, _surface in pairs(game.surfaces) do local _entities = _surface.find_entities_filtered({name = "waste-processor"}) for _, _entity in pairs(_entities) do table.insert( entity_list, _entity ) end _entities = _surface.find_entities_filtered({name = "waste-liquid-processor"}) for _, _entity in pairs(_entities) do table.insert( entity_list, _entity ) end end list_initialised = true end -- only continue every second if (event.tick % Time.SECOND) ~= 0 then return end -- for each waste processor for _, _entity in pairs(entity_list) do if _entity.valid then local _existing_pollution = Entity.get_data(_entity) or 0.0 -- item pollution if _entity.get_item_count() > 0 then _existing_pollution = _existing_pollution + _entity.get_item_count() * Config.item_pollution.managed _entity.get_inventory(defines.inventory.chest).clear() end -- fluid pollution local _fluid_amount = count_fluids( _entity ) if _fluid_amount > 0.0 then _existing_pollution = _existing_pollution + _fluid_amount * Config.fluid_pollution.managed clear_fluids( _entity ) end -- apply managed pollution if _existing_pollution >= 1.0 then create_pollution_at( _entity.position, _entity.surface, math.floor(_existing_pollution) ) _existing_pollution = _existing_pollution - math.floor(_existing_pollution) end -- set remaining pollution Entity.set_data(_entity, _existing_pollution) end end end) Event.register( { defines.events.on_built_entity, defines.events.on_robot_built_entity }, function(event) -- add waste box to list if event.created_entity.name == "waste-processor" or event.created_entity.name == "waste-liquid-processor" then table.insert( entity_list, event.created_entity ) end end) Event.register(defines.events.on_entity_died, function(event) -- create unmanaged pollution local _pollution = math.ceil( event.entity.get_item_count() * Config.item_pollution.unmanaged ) local _fluids = count_fluids( event.entity ) if _fluids > 0.0 then _pollution = _pollution + math.ceil( _fluids * Config.fluid_pollution.unmanaged ) end create_pollution_at( event.entity.position, event.entity.surface, _pollution ) end) Event.register( { defines.events.on_preplayer_mined_item, defines.events.on_robot_pre_mined }, function(event) -- create unmanaged pollution on mining fluid boxes local _fluids = count_fluids( event.entity ) if _fluids > 0.0 then create_pollution_at( event.entity.position, event.entity.surface, math.ceil( _fluids * Config.fluid_pollution.unmanaged ) ) end end)
vim.cmd 'colorscheme solarized'
-- Touch -- Stephen Leitnick -- March 14, 2021 local UserInputService = game:GetService("UserInputService") local Janitor = require(script.Parent.Parent.Janitor) local Signal = require(script.Parent.Parent.Signal) --[=[ @class Touch @client The Touch class is part of the Input package. ```lua local Touch = require(packages.Input).Touch ``` ]=] local Touch = {} Touch.ClassName = "Touch" Touch.__index = Touch --[=[ @within Touch @prop TouchTapInWorld Signal<(position: Vector2, processed: boolean)> @tag Event Proxy for [UserInputService.TouchTapInWorld](https://developer.roblox.com/en-us/api-reference/event/UserInputService/TouchTapInWorld). ]=] --[=[ @within Touch @prop TouchPan Signal<(touchPositions: {Vector2}, totalTranslation: Vector2, velocity: Vector2, state: Enum.UserInputState, processed: boolean)> @tag Event Proxy for [UserInputService.TouchPan](https://developer.roblox.com/en-us/api-reference/event/UserInputService/TouchPan). ]=] --[=[ @within Touch @prop TouchPinch Signal<(touchPositions: {Vector2}, scale: number, velocity: Vector2, state: Enum.UserInputState, processed: boolean)> @tag Event Proxy for [UserInputService.TouchPinch](https://developer.roblox.com/en-us/api-reference/event/UserInputService/TouchPinch). ]=] --[=[ Constructs a new Touch input capturer. ]=] function Touch.new() local self = setmetatable({}, Touch) self.Janitor = Janitor.new() self.TouchEnded = Signal.Wrap(UserInputService.TouchEnded, self.Janitor) self.TouchLongPress = Signal.Wrap(UserInputService.TouchLongPress, self.Janitor) self.TouchMoved = Signal.Wrap(UserInputService.TouchMoved, self.Janitor) self.TouchPan = Signal.Wrap(UserInputService.TouchPan, self.Janitor) self.TouchPinch = Signal.Wrap(UserInputService.TouchPinch, self.Janitor) self.TouchRotate = Signal.Wrap(UserInputService.TouchRotate, self.Janitor) self.TouchStarted = Signal.Wrap(UserInputService.TouchStarted, self.Janitor) self.TouchSwipe = Signal.Wrap(UserInputService.TouchSwipe, self.Janitor) self.TouchTap = Signal.Wrap(UserInputService.TouchTap, self.Janitor) self.TouchTapInWorld = Signal.Wrap(UserInputService.TouchTapInWorld, self.Janitor) return self end --[=[ Destroys the Touch input capturer. ]=] function Touch:Destroy() self.Janitor:Destroy() end function Touch:__tostring() return "Touch" end export type Touch = typeof(Touch.new()) table.freeze(Touch) return Touch
local reportListScroll, mainSection local activeReport local function showReportInfo(data) activeReport = data.id mainSection:Clear() surface.SetFont("adminme_btn_small") local tW, tH = surface.GetTextSize("X") local headerPanel = vgui.Create("am.HeaderPanel", mainSection) headerPanel:SetSize(mainSection:GetWide() - 20, mainSection:GetTall() - 20) headerPanel:SetHHeight(80) headerPanel:SetHText("ID: " .. data.id) headerPanel:SetPos(10, 10) local infoScroll = vgui.Create("DScrollPanel", headerPanel) infoScroll:SetSize(headerPanel:GetWide(), headerPanel:GetTall() - 65) infoScroll:SetPos(10, 45) local sbar = infoScroll:GetVBar() sbar:SetSize(0, 0) // Layout for all the warnings local liLay = vgui.Create("DIconLayout", infoScroll) liLay:SetSize(infoScroll:GetWide(), infoScroll:GetTall()) liLay:SetPos(0, 0) liLay:SetSpaceY(10) local creator = liLay:Add("DLabel") creator:SetSize(headerPanel:GetWide() - 20, tH) creator:SetFont("adminme_btn_small") creator:SetTextColor(cols.header_text) creator:SetText("Created By: " .. data.creator_nick .. " (" .. data.creator_steamid .. ")") local against = liLay:Add("DLabel") against:SetSize(headerPanel:GetWide() - 20, tH) against:SetFont("adminme_btn_small") against:SetTextColor(cols.header_text) against:SetText("Against: " .. data.target_nick .. " (" .. data.target_steamid .. ")") // Show the server local server = liLay:Add("DLabel") server:SetSize(headerPanel:GetWide() - 20, tH) server:SetFont("adminme_btn_small") server:SetTextColor(cols.header_text) server:SetText("Server: " .. (ndoc.table.am.servers[data.serverid] && ndoc.table.am.servers[data.serverid].name || "can't find server")) // Show the state (we only show in review reports right now) local state = liLay:Add("DLabel") state:SetSize(headerPanel:GetWide() - 20, tH) state:SetFont("adminme_btn_small") state:SetTextColor(cols.header_text) state:SetText("State: In Review") local reasonText = "Reason: " .. data.reason local reasonHeight = am.getVerticalSize(reasonText, "adminme_btn_small", headerPanel:GetWide() - 20) // Show the reason local reason = liLay:Add("DLabel") reason:SetSize(headerPanel:GetWide() - 20, reasonHeight) reason:SetFont("adminme_btn_small") reason:SetTextColor(cols.header_text) reason:SetText(reasonText) reason:SetWrap(true) // Show the notes local originalNotes = data.admin_notes local defaultNotes = "Click to modify admin notes" local notes = liLay:Add("am.DTextEntry") notes:SetSize(headerPanel:GetWide() - 20, 400) notes:SetPos(10, 10) notes:SetFont("adminme_ctrl") notes:SetMultiline(true) if (data.admin_notes && #data.admin_notes > 0) then notes:SetText(data.admin_notes) else notes:SetText(defaultNotes) end // Holds the actions local actionContainer = liLay:Add("DPanel") actionContainer:SetSize(310, 35) function actionContainer:Paint(w, h) draw.RoundedBox(0, 0, 0, w, h, Color(0, 0, 0, 0)) end // Control to just update any admin notes of the report local saveNotes = vgui.Create("DButton", actionContainer) saveNotes:SetSize(150, 35) saveNotes:SetPos(0, 0) saveNotes:SetText("") saveNotes:SetDisabled(true) function saveNotes:Paint(w, h) local col = cols.main_btn_bg local textCol = Color(0, 0, 0) if (self:IsHovered()) then col = cols.main_btn_hover end if (self:GetDisabled()) then col = cols.main_btn_disabled end draw.RoundedBox(0, 0, 0, w, h, cols.main_btn_outline) draw.RoundedBox(0, 1, 1, w - 2, h - 2, col) draw.SimpleText("Save Notes", "adminme_btn_small", w / 2, h / 2, textCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end function saveNotes:DoClick() RunConsoleCommand("am_updatereport", data.id, notes:GetText()) timer.Simple(1, function() net.Start("am.requestReportList") net.SendToServer() end) end function notes:OnTextChanged() if (self:GetText() != originalNotes) then saveNotes:SetDisabled(false) else saveNotes:SetDisabled(true) end end // Control to close and upate the notes of rthe report local closeReport = vgui.Create("DButton", actionContainer) closeReport:SetSize(150, 35) closeReport:SetPos(160, 0) closeReport:SetText("") function closeReport:Paint(w, h) local col = cols.main_btn_bg local textCol = Color(0, 0, 0) if (self:IsHovered()) then col = cols.main_btn_hover end if (self:GetDisabled()) then col = cols.main_btn_disabled end draw.RoundedBox(0, 0, 0, w, h, cols.main_btn_outline) draw.RoundedBox(0, 1, 1, w - 2, h - 2, col) draw.SimpleText("Close Report", "adminme_btn_small", w / 2, h / 2, textCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end function closeReport:DoClick() local notesToAdd = notes:GetText() if (defaultNotes == notesToAdd) then notesToAdd = nil end RunConsoleCommand("am_creport", data.id, notesToAdd) timer.Simple(1, function() net.Start("am.requestReportList") net.SendToServer() end) end end local reportList = nil local function repopulateList(scroller, main, search_text) scroller:Clear() if (!reportList) then return end local spacer = vgui.Create("DPanel", reportListScroll) spacer:SetSize(reportListScroll:GetWide(), 50) function spacer:Paint(w, h) draw.RoundedBox(0, 0, 0, w, h, Color(255, 255, 255, 0)) end local tW, tH = surface.GetTextSize("X") for k, v in pairs(reportList) do if (!string.find(v["target_nick"], search_text) && !string.find(v["target_steamid"], search_text) && !string.find(v["creator_nick"], search_text) && !string.find(v["creator_steamid"], search_text) && search_text != "") then continue end local btn = reportListScroll:Add("DButton") btn:SetText("") btn:SetSize(scroller:GetWide(), tH + 20) function btn:DoClick() showReportInfo(v) end function btn:Paint(w, h) local col = cols.item_btn_bg local textCol = cols.item_btn_text if (self:IsHovered()) then col = cols.item_btn_bg_hover textCol = cols.item_btn_text_hover end local adjustedWidth = w - 20 if (activeReport == v["id"]) then col = cols.item_btn_bg_active textCol = cols.item_btn_text_active adjustedWidth = w - 10 end draw.RoundedBox(0, 10, 0, adjustedWidth, h, col) draw.SimpleText(v["target_nick"], "adminme_btn_small", w / 2, h / 2, textCol, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) end end end net.Receive("am.syncReportList", function() local res = net.ReadTable() reportListScroll:Clear() mainSection:Clear() activeReport = nil if (#res == 0) then return end reportList = res repopulateList(reportListScroll, mainSection, "") end) hook.Add("AddAdditionalMenuSections", "am.addReportMenu", function(stor) local function populateList(scroller, main, frame) main:Clear() activeReport = nil mainSection = main reportListScroll = scroller local posX = frame:GetWide() - main:GetWide() - scroller:GetWide() local search_bg = vgui.Create("DPanel", frame) search_bg:SetSize(scroller:GetWide(), 50) search_bg:SetPos(posX, 0) function search_bg:Paint(w, h) draw.RoundedBox(0, 0, 0, w, h, cols.item_scroll_bg) end local search = vgui.Create("am.DTextEntry", search_bg) search:SetSize(search_bg:GetWide() - 20, search_bg:GetTall() - 20) search:SetPos(10, 10) search:SetFont("adminme_ctrl") search:SetPlaceholder("Search for report...") frame.extras = {search_bg, search} function search:OnChange() repopulateList(scroller, main, self:GetText()) end net.Start("am.requestReportList") net.SendToServer() end if (LocalPlayer():hasPerm("creport")) then stor["Reports"] = {cback = populateList, useItemList = true} end end)
function read_bin_file(path) local file, errorMessage = io.open(path, "rb") if not file then error("Could not read the file:" .. errorMessage .. "\n") end local content = file:read "*all" file:close() return content end local Boundary = "----WebKitFormBoundaryePkpFF7tjBAqx29L" local BodyBoundary = "--" .. Boundary local LastBoundary = "--" .. Boundary .. "--" local CRLF = "\r\n" local Filename = "cat.jpg" local FileBody = read_bin_file(Filename) local ContentDisposition = "Content-Disposition: form-data; name=\"file\"; filename=\"" .. Filename .. "\"" wrk.method = "POST" wrk.headers["Content-Type"] = "multipart/form-data; boundary=" .. Boundary wrk.body = BodyBoundary .. CRLF .. ContentDisposition .. CRLF .. CRLF .. FileBody .. CRLF .. LastBoundary
--############################################################################# --# Corona HTML5 Base64 Plugin --# (c)2018 C. Byerley (develephant) --############################################################################# local lib local platform = system.getInfo("platform") if platform == 'html5' then lib = require("base64_js") else -- wrapper for non web platforms local CoronaLibrary = require "CoronaLibrary" -- Create stub library for simulator lib = CoronaLibrary:new{ name='base64', publisherId='com.develephant' } -- Alert for non-HTML5 platforms local function defaultFunction() print( "WARNING: The '" .. lib.name .. "' library is not available on this platform." ) end lib.encode = defaultFunction lib.decode = defaultFunction end return lib
local _, class = UnitClass("PLAYER") local armormult local function round(arg1, decplaces) if (decplaces == nil) then decplaces = 0 end if arg1 == nil then arg1 = 0 end return string.format ("%."..decplaces.."f", arg1) end local function findpattern(text, pattern, start) if (text and pattern and (string.find(text, pattern, start))) then return string.sub(text, string.find(text, pattern, start)) else return "" end end local red, green, blue, first local a = TheoryCraft_TooltipOrs local leftline, rightline, rightlinewasnil, _, doheal, timer local returnvalue, colour function TheoryCraft_AddTooltipInfo(frame, dontshow) -- if TheoryCraft_Settings["off"] then return frame end if true then return frame end local tooltipdata = TheoryCraft_GetSpellDataByFrame(frame, true) if tooltipdata == nil then if (frame:NumLines() == 1) and (getglobal(frame:GetName().."TextLeft1"):GetText() ~= "Attack") then local _, _, name, rank = strfind(getglobal(frame:GetName().."TextLeft1"):GetText(), "(.+)%((%d+)%)") if not name then return nil end rank = tonumber(rank) local spellname, spellrank local i2 = 1 while (true) do spellname, spellrank = GetSpellBookItemName(i2,BOOKTYPE_SPELL) if spellname == nil then return end spellrank = tonumber(findpattern(spellrank2, "%d+")) if spellrank == nil then spellrank2 = 0 end if ((spellname == name) or (name == string.sub(spellname, 1, string.len(name)))) and (spellrank == rank) then frame:SetSpell(i2,BOOKTYPE_SPELL) return frame end i2 = i2 + 1 end end frame:Show() return frame end timer = GetTime() doheal = (tooltipdata["minheal"]) and (((tooltipdata["drain"] == nil) and (tooltipdata["holynova"] == nil)) or (TheoryCraft_Settings["healanddamage"])) local function docolour(r, g, b) r = tonumber(r) g = tonumber(g) b = tonumber(b) if (not r) or (not g) or (not b) then return "invalid colour" end if (r > 1) or (r < 0) or (g > 1) or (g < 0) or (b > 1) or (b < 0) then return "invalid colour" end if first then red = r green = g blue = b first = false else return "|c"..string.format("%.2x", math.floor(r*255)).. string.format("%.2x", math.floor(g*255)).. string.format("%.2x", math.floor(b*255)).."ff" end end local function dowork(n) local _, _, n2 = strfind(n, "|(.+)|") n = string.gsub(n, "%|.+%|", "") if (not doheal) and ((n == "nextcritheal") or (n == "healrange") or (n == "hps") or (n == "hpsdam") or (n == "crithealrange")) then return "$NOT FOUND$" end if n == "spellrank" then if tooltipdata.spellrank == 0 then return "$NOT FOUND$" end end if TheoryCraft_Data["outfit"] ~= 1 then if n == "outfitname" then if (TheoryCraft_Data["outfit"] == 2) and (TheoryCraft_Settings["CustomOutfitName"]) then return TheoryCraft_Settings["CustomOutfitName"] else if TheoryCraft_Outfits[TheoryCraft_Data["outfit"]] then return TheoryCraft_Outfits[TheoryCraft_Data["outfit"]].name end end end end if n == "hitorheal" then if tooltipdata.isheal then return a.hitorhealheal else return a.hitorhealhit end end if n == "damorheal" then if tooltipdata.isheal then return a.damorhealheal else return a.damorhealdam end end if n == "damorap" then if tooltipdata.ismelee or tooltipdata.isranged then return a.damorapap else return a.damorapdam end end -- if rightlinewasnil then -- if tooltipdata["test"] then -- if tooltipdata["test"][n] ~= tooltipdata[n] then -- colour = "#c0.9,0.9,0#" -- else -- colour = "#c0.5,0.5,0.5#" -- end -- if rightline then -- rightline = rightline.."#IF, $|test|"..n.."$IF#" -- else -- rightline = colour.."#IF$|test|"..n.."$IF#" -- end -- end -- end local _, _, roundfactor = strfind(n, ",(%d+)") if roundfactor then roundfactor = tonumber(roundfactor) end n = string.gsub(n, ",%d+", "") if n == "penetration" and tonumber(tooltipdata["penetration"]) == 0 then return "$NOT FOUND$" end if n == "basemanacost" and tooltipdata["dontshowmana"] then return "$NOT FOUND$" end if n == "healrange" and tooltipdata["minheal"] then if tooltipdata["minheal"] == tooltipdata["maxheal"] then return round(tooltipdata["minheal"]) else return round(tooltipdata["minheal"])..TheoryCraft_Locale.to..round(tooltipdata["maxheal"]) end end if n == "dmgrange" and tooltipdata["mindamage"] then if tooltipdata["mindamage"] == tooltipdata["maxdamage"] then return round(tooltipdata["mindamage"]) else return round(tooltipdata["mindamage"])..TheoryCraft_Locale.to..round(tooltipdata["maxdamage"]) end end if ((n == "critdmgrange") or (n == "igniterange")) and (tooltipdata["critdmgmin"]) then if ((TheoryCraft_Settings["sepignite"]) and (n == "critdmgrange")) and (tooltipdata["critdmgmaxminusignite"]) then if tooltipdata["critdmgminminusignite"] == tooltipdata["critdmgmaxminusignite"] then return round(tooltipdata["critdmgminminusignite"]) else return round(tooltipdata["critdmgminminusignite"])..TheoryCraft_Locale.to..round(tooltipdata["critdmgmaxminusignite"]) end else if (tooltipdata["critdmgminminusignite"] == nil) and (n == "igniterange") then return "$NOT FOUND$" end if tooltipdata["critdmgmin"] == tooltipdata["critdmgmax"] then return round(tooltipdata["critdmgmin"]) else return round(tooltipdata["critdmgmin"])..TheoryCraft_Locale.to..round(tooltipdata["critdmgmax"]) end end end if ((n == "crithealrange") and (tooltipdata["crithealmin"])) then if tooltipdata["crithealmin"] == tooltipdata["crithealmax"] then return round(tooltipdata["crithealmin"]) else return round(tooltipdata["crithealmin"])..TheoryCraft_Locale.to..round(tooltipdata["crithealmax"]) end end if n2 then if tooltipdata[n2] == nil then return "$NOT FOUND$" end if tooltipdata[n2][n] == nil then return "$NOT FOUND$" end returnvalue = tooltipdata[n2][n] else if tooltipdata[n] == nil then return "$NOT FOUND$" end returnvalue = tooltipdata[n] end if (n == "maxoomdam") or (n == "maxevocoomdam") or (n == "maxoomheal") or (n == "maxevocoodam") then if returnvalue < 0 then returnvalue = "Infinite" else returnvalue = round(returnvalue/1000, 2).."k" end end if (roundfactor) and (tonumber(returnvalue)) then return round(returnvalue, roundfactor) elseif (tonumber(returnvalue)) then return round(returnvalue) else return returnvalue end end local function door(first, second) if strfind(first, "%$NOT FOUND%$") then first = nil end if strfind(second, "%$NOT FOUND%$") then second = nil end return first or second or "$NOT FOUND$" end local function doif(line) if strfind(line, "%$NOT FOUND%$") then return end return line end do tooltipdata["cooldownremaining"] = nil local i = 1 local tmpstring while getglobal(frame:GetName().."TextLeft"..i) do tmpstring = getglobal(frame:GetName().."TextLeft"..i):GetText() or "" if string.find(tmpstring, (TheoryCraft_Locale.CooldownRem) or "Cooldown remaining: ") then tooltipdata["cooldownremaining"] = getglobal(frame:GetName().."TextLeft"..i):GetText() end i = i + 1 end end frame:ClearLines() local a = TheoryCraft_TooltipFormat local dr, dg, db = TheoryCraft_Colours["AddedLine"][1], TheoryCraft_Colours["AddedLine"][2], TheoryCraft_Colours["AddedLine"][3] local _, tr, tg, tb, titletext, lr, lg, lb local bool for k, line in pairs(a) do bool = line.show if bool == "critmelee" then bool = (TheoryCraft_Settings["crit"]) and ((tooltipdata.ismelee) or (tooltipdata.isranged)) elseif bool == "critwithdam" then bool = (TheoryCraft_Settings["crit"] and TheoryCraft_Settings["critdam"]) and (tooltipdata.ismelee == nil) and (tooltipdata.isranged == nil) elseif bool == "critwithoutdam" then bool = (TheoryCraft_Settings["crit"] and (not TheoryCraft_Settings["critdam"])) and (tooltipdata.ismelee == nil) and (tooltipdata.isranged == nil) elseif bool == "averagedam" then bool = TheoryCraft_Settings["averagedam"] and (not TheoryCraft_Settings["averagedamnocrit"]) elseif bool == "averagedamnocrit" then bool = TheoryCraft_Settings["averagedam"] and TheoryCraft_Settings["averagedamnocrit"] elseif bool == "max" then bool = TheoryCraft_Settings["max"] and (not TheoryCraft_Settings["maxtime"]) elseif bool == "maxtime" then bool = TheoryCraft_Settings["max"] and TheoryCraft_Settings["maxtime"] elseif bool == "maxevoc" then bool = TheoryCraft_Settings["maxevoc"] and (not TheoryCraft_Settings["maxtime"]) elseif bool == "maxevoctime" then bool = TheoryCraft_Settings["maxevoc"] and TheoryCraft_Settings["maxtime"] elseif bool ~= true then bool = TheoryCraft_Settings[bool] end if line.inverse then bool = not bool end if (bool) then leftline = line.left rightline = line.right rightlinewasnil = rightline == nil if leftline then leftline = string.gsub(leftline, "%$(.-)%$", dowork) leftline = string.gsub(leftline, "#OR(.-)/(.-)OR#", door) leftline = string.gsub(leftline, "#IF(.-)IF#", doif) end if rightline then rightline = string.gsub(rightline, "%$(.-)%$", dowork) rightline = string.gsub(rightline, "#OR(.-)/(.-)OR#", door) rightline = string.gsub(rightline, "#IF(.-)IF#", doif) end if leftline and strfind(leftline, "%$NOT FOUND%$") then leftline = nil end if rightline and strfind(rightline, "%$NOT FOUND%$") then rightline = nil end red, green, blue = dr, dg, db first = true if leftline then leftline = string.gsub(leftline, "#c(.-),(.-),(.-)#", docolour) lr, lg, lb = red, green, blue rr, rg, rb = red, green, blue end if leftline and strfind(leftline, "#TITLE=(.-)#") then _, _, titletext = strfind(leftline, "#TITLE=(.-)#") tr = lr tg = lg tb = lb leftline = nil rightline = nil end first = true if rightline then rightline = string.gsub(rightline, "#c(.-),(.-),(.-)#", docolour) rr, rg, rb = red, green, blue end if leftline then if titletext then frame:AddLine(titletext, tr, tg, tb) titletext = nil end if strfind(leftline, "#WRAP#") then leftline = string.gsub(leftline, "#WRAP#", "") frame:AddLine(leftline, lr, lg, lb, true) elseif rightline then frame:AddDoubleLine(leftline, rightline, lr, lg, lb, rr, rg, rb) else frame:AddLine(leftline, lr, lg, lb) end end end end frame:Show() return frame end
ys = ys or {} slot2 = ys.Battle.BattleConfig slot3 = ys.Battle.BattleFormulas slot4 = ys.Battle.BattleConst.WeaponSuppressType slot5 = ys.Battle.BattleConst.WeaponSearchType slot6 = ys.Battle.BattleDataFunction slot7 = ys.Battle.BattleAttr slot8 = class("BattleWeaponUnit") ys.Battle.BattleWeaponUnit = slot8 slot8.__name = "BattleWeaponUnit" slot8.INTERNAL = "internal" slot8.EXTERNAL = "external" slot8.EMITTER_NORMAL = "BattleBulletEmitter" slot8.EMITTER_SHOTGUN = "BattleShotgunEmitter" slot8.STATE_DISABLE = "DISABLE" slot8.STATE_READY = "READY" slot8.STATE_PRECAST = "PRECAST" slot8.STATE_PRECAST_FINISH = "STATE_PRECAST_FINISH" slot8.STATE_ATTACK = "ATTACK" slot8.STATE_OVER_HEAT = "OVER_HEAT" slot8.Ctor = function (slot0) slot0.EventDispatcher.AttachEventDispatcher(slot0) slot0._currentState = slot0.STATE_READY slot0._equipmentIndex = -1 slot0._dataProxy = slot0.Battle.BattleDataProxy.GetInstance() slot0._tempEmittersList = {} slot0._dumpedEmittersList = {} slot0._reloadFacotrList = {} slot0._diveEnabled = true slot0._comboIDList = {} slot0._jammingTime = 0 slot0._reloadBoostList = {} slot0._CLDCount = 0 slot0._damageSum = 0 slot0._CTSum = 0 slot0._ACCSum = 0 end slot8.HostOnEnemy = function (slot0) slot0._hostOnEnemy = true end slot8.SetPotentialFactor = function (slot0, slot1) slot0._potential = slot1 if slot0._correctedDMG then slot0._correctedDMG = slot0:WeaponDamagePreCorrection() end end slot8.GetEquipmentLabel = function (slot0) return slot0._equipmentLabelList or {} end slot8.SetEquipmentLabel = function (slot0, slot1) slot0._equipmentLabelList = slot1 end slot8.SetTemplateData = function (slot0, slot1) slot0._potential = slot0._potential or 1 slot0._tmpData = slot1 slot0._maxRangeSqr = slot1.range slot0._minRangeSqr = slot1.min_range slot0._fireFXFlag = slot1.fire_fx_loop_type slot0._oxyList = slot1.oxy_type slot0._bulletList = slot1.bullet_ID slot0._majorEmitterList = {} slot0:ShiftBarrage(slot1.barrage_ID) slot0._GCD = slot1.recover_time slot0._preCastInfo = slot1.precast_param slot0._correctedDMG = slot0:WeaponDamagePreCorrection() slot0._convertedAtkAttr = slot0:WeaponAtkAttrPreRatio() slot0:FlushReloadMax(1) end slot8.createMajorEmitter = function (slot0, slot1, slot2, slot3, slot4, slot5) function slot6(slot0, slot1, slot2, slot3, slot4) slot6 = slot0:Spawn(slot5, slot4, slot2.INTERNAL) slot6:SetOffsetPriority(slot3) slot6:SetShiftInfo(slot0, slot1) if slot0._tmpData.aim_type == slot3.WeaponAimType.AIM and slot4 ~= nil then slot6:SetRotateInfo(slot4:GetBeenAimedPosition(), slot0:GetBaseAngle(), slot2) else slot6:SetRotateInfo(nil, slot0:GetBaseAngle(), slot2) end slot0:DispatchBulletEvent(slot6) return slot6 end slot0._majorEmitterList[#slot0._majorEmitterList + 1] = slot2.Battle[slot3 or slot0.EMITTER_NORMAL].New(slot4 or slot6, slot5 or function () for slot3, slot4 in ipairs(slot0._majorEmitterList) do if slot4:GetState() ~= slot4.STATE_STOP then return end end slot0:EnterCoolDown() end, slot1) return slot2.Battle[slot3 or slot0.EMITTER_NORMAL].New(slot4 or slot6, slot5 or function () for slot3, slot4 in ipairs(slot0._majorEmitterList) do if slot4.GetState() ~= slot4.STATE_STOP then return end end slot0.EnterCoolDown() end, slot1) end slot8.interruptAllEmitter = function (slot0) if slot0._majorEmitterList then for slot4, slot5 in ipairs(slot0._majorEmitterList) do slot5:Interrupt() end end for slot4, slot5 in ipairs(slot0._tempEmittersList) do for slot9, slot10 in ipairs(slot5) do slot10:Interrupt() end end for slot4, slot5 in ipairs(slot0._dumpedEmittersList) do for slot9, slot10 in ipairs(slot5) do slot10:Interrupt() end end end slot8.cacheSectorData = function (slot0) slot0._upperEdge = math.deg2Rad * slot0:GetAttackAngle() / 2 slot0._lowerEdge = -1 * slot0._upperEdge slot2 = math.deg2Rad * slot0._tmpData.axis_angle if slot0:GetDirection() == slot0.UnitDir.LEFT then slot0._normalizeOffset = math.pi - slot2 elseif slot0:GetDirection() == slot0.UnitDir.RIGHT then slot0._normalizeOffset = slot2 end slot0._wholeCircle = math.pi - slot0._normalizeOffset slot0._negativeCircle = -math.pi - slot0._normalizeOffset slot0._wholeCircleNormalizeOffset = slot0._normalizeOffset - math.pi * 2 slot0._negativeCircleNormalizeOffset = slot0._normalizeOffset + math.pi * 2 end slot8.cacheSquareData = function (slot0) slot0._frontRange = slot0._tmpData.angle slot0._backRange = slot0._tmpData.axis_angle slot0._upperRange = slot0._tmpData.min_range slot0._lowerRange = slot0._tmpData.range end slot8.SetModelID = function (slot0, slot1) slot0._modelID = slot1 end slot8.SetSkinData = function (slot0, slot1) slot0._skinID = slot1 slot0:SetModelID(slot0.GetEquipSkin(slot0._skinID)) end slot8.SetDerivateSkin = function (slot0, slot1) slot0._derivateSkinID = slot1 slot2, slot0._derivateBullet, slot0._derivateTorpedo, slot0._derivateBoom = slot0.GetEquipSkin(slot0._derivateSkinID) end slot8.GetSkinID = function (slot0) return slot0._skinID end slot8.setBulletSkin = function (slot0, slot1, slot2) if slot0._derivateSkinID then if slot0.GetBulletTmpDataFromID(slot2).type == slot1.BulletType.BOMB then slot1:SetModleID(slot0._derivateBoom) elseif slot3 == slot1.BulletType.TORPEDO then slot1:SetModleID(slot0._derivateTorpedo) else slot1:SetModleID(slot0._derivateBullet) end elseif slot0._modelID then slot3 = 0 if slot0._skinID then slot3 = slot0.GetEquipSkinDataFromID(slot0._skinID).mirror end slot1:SetModleID(slot0._modelID, slot3) end end slot8.SetSrcEquipmentID = function (slot0, slot1) slot0._srcEquipID = slot1 end slot8.SetEquipmentIndex = function (slot0, slot1) slot0._equipmentIndex = slot1 end slot8.GetEquipmentIndex = function (slot0) return slot0._equipmentIndex end slot8.SetHostData = function (slot0, slot1) slot0._host = slot1 slot0._hostUnitType = slot0._host:GetUnitType() slot0._hostIFF = slot1:GetIFF() if slot0._tmpData.search_type == slot0.SECTOR then slot0:cacheSectorData() slot0.outOfFireRange = slot0.IsOutOfAngle slot0.IsOutOfFireArea = slot0.IsOutOfSector elseif slot0._tmpData.search_type == slot0.SQUARE then slot0:cacheSquareData() slot0.outOfFireRange = slot0.IsOutOfSquare slot0.IsOutOfFireArea = slot0.IsOutOfSquare end if slot0:GetDirection() == slot1.UnitDir.RIGHT then slot0._baseAngle = 0 else slot0._baseAngle = 180 end end slot8.SetStandHost = function (slot0, slot1) slot0._standHost = slot1 end slot8.OverrideGCD = function (slot0, slot1) slot0._GCD = slot1 end slot8.updateMovementInfo = function (slot0) slot0._hostPos = slot0._host:GetPosition() end slot8.GetWeaponId = function (slot0) return slot0._tmpData.id end slot8.GetTemplateData = function (slot0) return slot0._tmpData end slot8.GetType = function (slot0) return slot0._tmpData.type end slot8.GetPotential = function (slot0) return slot0._potential or 1 end slot8.GetSrcEquipmentID = function (slot0) return slot0._srcEquipID end slot8.IsAttacking = function (slot0) return slot0._currentState == slot0.STATE_ATTACK or slot0._currentState == slot0.STATE_PRECAST end slot8.Update = function (slot0) slot0:UpdateReload() if not slot0._diveEnabled then return end if slot0._currentState == slot0.STATE_READY then slot0:updateMovementInfo() if slot0._tmpData.suppress == slot0.SUPPRESSION or slot0:CheckPreCast() then if slot0._preCastInfo.time == nil or not slot0._hostOnEnemy then slot0._currentState = slot0.STATE_PRECAST_FINISH else slot0:PreCast() end end end if slot0._currentState == slot0.STATE_PRECAST_FINISH then slot0:updateMovementInfo() slot0:Fire(slot0:Tracking()) end end slot8.CheckReloadTimeStamp = function (slot0) return slot0._CDstartTime and slot0:GetReloadFinishTimeStamp() <= pg.TimeMgr.GetInstance():GetCombatTime() end slot8.UpdateReload = function (slot0) if slot0._CDstartTime and not slot0._jammingStartTime then if slot0:GetReloadFinishTimeStamp() <= pg.TimeMgr.GetInstance():GetCombatTime() then slot0:handleCoolDown() else return end end end slot8.CheckPreCast = function (slot0) for slot4, slot5 in pairs(slot0:GetFilteredList()) do return true end return false end slot8.ChangeDiveState = function (slot0) if slot0._host:GetOxyState() then slot1 = slot0._host:GetOxyState():GetWeaponType() for slot5, slot6 in ipairs(slot0._oxyList) do if table.contains(slot1, slot6) then slot0._diveEnabled = true return end end slot0._diveEnabled = false end end slot8.getTrackingHost = function (slot0) return slot0._host end slot8.Tracking = function (slot0) if slot0.GetCurrent(slot0._host, "TargetChoise") == "farthest" then return slot0:TrackingFarthest(slot0:GetFilteredList()) elseif slot1 == "leastHP" then return slot0:TrackingLeastHP(slot0:GetFilteredList()) elseif type(slot1) == "number" and slot1 > 0 then return slot0:TrackingModelID(slot0:GetFilteredList(), slot1) elseif slot1 == 0 then return slot0:TrackingNearest(slot0:GetFilteredList()) else return slot0:TrackingTag(slot0:GetFilteredList(), slot1) end end slot8.GetFilteredList = function (slot0) slot1 = slot0:FilterTarget() if slot0._tmpData.search_type == slot0.SECTOR then slot1 = slot0:FilterAngle(slot0:FilterRange(slot1)) elseif slot0._tmpData.search_type == slot0.SQUARE then slot1 = slot0:FilterSquare(slot1) end return slot1 end slot8.FixWeaponRange = function (slot0, slot1, slot2, slot3, slot4) slot0._maxRangeSqr = slot1 or slot0._tmpData.range slot0._minRangeSqr = slot3 or slot0._tmpData.min_range slot0._fixBulletRange = slot2 slot0._bulletRangeOffset = slot4 end slot8.GetFixBulletRange = function (slot0) return slot0._fixBulletRange, slot0._bulletRangeOffset end slot8.TrackingNearest = function (slot0, slot1) slot2 = slot0._maxRangeSqr slot3 = nil for slot7, slot8 in ipairs(slot1) do if slot0:getTrackingHost():GetDistance(slot8) <= slot2 then slot2 = slot9 slot3 = slot8 end end return slot3 end slot8.TrackingFarthest = function (slot0, slot1) slot2 = 0 slot3 = nil for slot7, slot8 in ipairs(slot1) do if slot2 < slot0:getTrackingHost():GetDistance(slot8) then slot2 = slot9 slot3 = slot8 end end return slot3 end slot8.TrackingLeastHP = function (slot0, slot1) slot2 = math.huge slot3 = nil for slot7, slot8 in ipairs(slot1) do if slot8:GetCurrentHP() < slot2 then slot3 = slot8 slot2 = slot9 end end return slot3 end slot8.TrackingModelID = function (slot0, slot1, slot2) slot3 = nil for slot7, slot8 in ipairs(slot1) do if slot8:GetTemplateID() == slot2 then slot3 = slot8 end end return slot3 end slot8.TrackingRandom = function (slot0, slot1) slot2 = {} for slot6, slot7 in pairs(slot1) do table.insert(slot2, slot7) end slot3 = #slot2 if #slot2 == 0 then return nil else return slot2[math.random(#slot2)] end end slot8.TrackingTag = function (slot0, slot1, slot2) slot3 = {} for slot7, slot8 in ipairs(slot1) do if slot8:ContainsLabelTag({ slot2 }) then table.insert(slot3, slot8) end end if #slot3 == 0 then return slot0:TrackingNearest(slot1) else return slot3[math.random(#slot3)] end end slot8.FilterTarget = function (slot0) slot1 = nil slot1 = (slot0._hostIFF ~= slot0._dataProxy:GetFriendlyCode() or slot0._dataProxy:GetFoeShipList()) and slot0._dataProxy:GetFriendlyShipList() slot2 = {} slot3 = 1 slot4 = slot0._tmpData.search_condition for slot8, slot9 in pairs(slot1) do slot10 = slot9:GetCurrentOxyState() if slot0.IsCloak(slot9) then elseif not table.contains(slot4, slot10) then else slot12 = true if slot10 == slot1.OXY_STATE.FLOAT then elseif slot10 == slot1.OXY_STATE.DIVE and not slot9:IsRunMode() and not slot9:GetDiveDetected() and slot9:GetDiveInvisible() then slot12 = false end if slot12 then slot2[slot3] = slot9 slot3 = slot3 + 1 end end end return slot2 end slot8.FilterAngle = function (slot0, slot1) if slot0:GetAttackAngle() >= 360 then return slot1 end for slot5 = #slot1, 1, -1 do if slot0:IsOutOfAngle(slot1[slot5]) then table.remove(slot1, slot5) end end return slot1 end slot8.FilterRange = function (slot0, slot1) for slot5 = #slot1, 1, -1 do if slot0:IsOutOfRange(slot1[slot5]) then table.remove(slot1, slot5) end end return slot1 end slot8.FilterSquare = function (slot0, slot1) slot6 = slot0.Battle.BattleTargetChoise.TargetWeightiest(slot0._host, nil, slot5) for slot10 = #slot1, 1, -1 do if slot0:IsOutOfSquare(slot1[slot10]) then table.remove(slot1, slot10) end end for slot10 = #slot1, 1, -1 do if not table.contains(slot6, slot1[slot10]) then table.remove(slot1, slot10) end end return slot1 end slot8.GetAttackAngle = function (slot0) return slot0._tmpData.angle end slot8.IsOutOfAngle = function (slot0, slot1) if slot0:GetAttackAngle() >= 360 then return false end if slot0._lowerEdge < ((slot0._wholeCircle < math.atan2(slot1:GetPosition().z - slot0._hostPos.z, slot1.GetPosition().x - slot0._hostPos.x) and slot3 + slot0._wholeCircleNormalizeOffset) or (slot3 < slot0._negativeCircle and slot3 + slot0._negativeCircleNormalizeOffset) or slot3 + slot0._normalizeOffset) and slot3 < slot0._upperEdge then return false else return true end end slot8.IsOutOfRange = function (slot0, slot1) return slot0._maxRangeSqr < slot0:getTrackingHost():GetDistance(slot1) or slot2 < slot0:GetMinimumRange() end slot8.IsOutOfSector = function (slot0, slot1) return slot0:IsOutOfRange(slot1) or slot0:IsOutOfAngle(slot1) end slot8.IsOutOfSquare = function (slot0, slot1) slot3 = false slot4 = (slot1:GetPosition().x - slot0._hostPos.x) * slot0:GetDirection() if slot0._backRange < 0 then if slot4 > 0 and slot4 <= slot0._frontRange and math.abs(slot0._backRange) <= slot4 then slot3 = true end elseif (slot4 > 0 and slot4 <= slot0._frontRange) or (slot4 < 0 and math.abs(slot4) < slot0._backRange) then slot3 = true end if not slot3 then return true else return false end end slot8.LockUnit = function (slot0, slot1) slot1:Tag(slot0) end slot8.UnlockUnit = function (slot0, slot1) slot1:UnTag(slot0) end slot8.GetLockRequiredTime = function (slot0) return 0 end slot8.PreCast = function (slot0) slot0._currentState = slot0.STATE_PRECAST slot0:AddPreCastTimer() if slot0._preCastInfo.armor then slot0._precastArmor = slot0._preCastInfo.armor end slot0._host:SetWeaponPreCastBound(true) slot0:DispatchEvent(slot0.Event.New(slot0.Battle.BattleUnitEvent.WEAPON_PRE_CAST, slot1)) end slot8.Fire = function (slot0, slot1) if not slot0._host:IsCease() then slot0:DispatchGCD() slot0._currentState = slot0.STATE_ATTACK if slot0._tmpData.action_index == "" then slot0:DoAttack(slot1) else slot0:DispatchFireEvent(slot1, slot0._tmpData.action_index) end end return true end slot8.DoAttack = function (slot0, slot1) if slot1 == nil or not slot1:IsAlive() or slot0:outOfFireRange(slot1) then slot1 = nil end slot2 = slot0:GetDirection() slot3 = slot0:GetAttackAngle() slot0:cacheBulletID() slot0:TriggerBuffOnSteday() for slot7, slot8 in ipairs(slot0._majorEmitterList) do slot8:Ready() end for slot7, slot8 in ipairs(slot0._majorEmitterList) do slot8:Fire(slot1, slot2, slot3) end slot0._host:CloakExpose(slot0._tmpData.expose) slot0.Battle.PlayBattleSFX(slot0._tmpData.fire_sfx) slot0:TriggerBuffOnFire() slot0:CheckAndShake() end slot8.TriggerBuffOnSteday = function (slot0) slot0._host:TriggerBuff(slot0.BuffEffectType.ON_WEAPON_STEDAY, { equipIndex = slot0._equipmentIndex }) end slot8.TriggerBuffOnFire = function (slot0) slot0._host:TriggerBuff(slot0.BuffEffectType.ON_FIRE, { equipIndex = slot0._equipmentIndex }) end slot8.TriggerBuffOnReady = function (slot0) return end slot8.UpdateCombo = function (slot0, slot1) if slot0._hostUnitType ~= slot0.UnitType.PLAYER_UNIT or not slot0._host:IsAlive() then return end if #slot1 > 0 then slot2 = 0 for slot6, slot7 in ipairs(slot1) do if table.contains(slot0._comboIDList, slot7) then slot2 = slot2 + 1 end slot0._host:TriggerBuff(slot0.BuffEffectType.ON_COMBO, { equipIndex = slot0._equipmentIndex, matchUnitCount = slot2 }) break end slot0._comboIDList = slot1 end end slot8.SingleFire = function (slot0, slot1, slot2, slot3, slot4) slot0._tempEmittersList[#slot0._tempEmittersList + 1] = {} if slot1 and slot1:IsAlive() then else slot1 = nil end slot2 = slot2 or slot0.EMITTER_NORMAL for slot9, slot10 in ipairs(slot0._barrageList) do function slot11(slot0, slot1, slot2, slot3) slot6 = slot1:Spawn(slot5, slot3, (slot0 and slot1._tmpData.bullet_ID) or slot1._bulletList.EXTERNAL) slot6:SetOffsetPriority(slot3) slot6:SetShiftInfo(slot0, slot1) if slot3 ~= nil then slot6:SetRotateInfo(slot3:GetBeenAimedPosition(), slot1:GetBaseAngle(), slot2) else slot6:SetRotateInfo(nil, slot1:GetBaseAngle(), slot2) end slot1:DispatchBulletEvent(slot6) end slot5[#slot5 + 1] = slot1.Battle[slot2].New(slot11, function () for slot3, slot4 in ipairs(ipairs) do if slot4:GetState() ~= slot4.STATE_STOP then return end end for slot3, slot4 in ipairs(ipairs) do slot4:Destroy() end slot0 = nil for slot4, slot5 in ipairs(slot1._tempEmittersList) do if slot5 == slot0 then slot0 = slot4 end end table.remove(slot1._tempEmittersList, slot0) slot0 = nil table.remove._fireFXFlag = slot1._tmpData.fire_fx_loop_type if slot1._tmpData.fire_fx_loop_type then slot2() end end, slot10) end for slot9, slot10 in ipairs(slot5) do slot10:Ready() slot10:Fire(slot1, slot0:GetDirection(), slot0:GetAttackAngle()) end slot0._host:CloakExpose(slot0._tmpData.expose) slot0:CheckAndShake() end slot8.SetModifyInitialCD = function (slot0) slot0._modInitCD = true end slot8.GetModifyInitialCD = function (slot0) return slot0._modInitCD end slot8.InitialCD = function (slot0) if slot0._tmpData.initial_over_heat == 1 then slot0:AddCDTimer(slot0:GetReloadTime()) end end slot8.EnterCoolDown = function (slot0) slot0._fireFXFlag = slot0._tmpData.fire_fx_loop_type slot0:AddCDTimer(slot0:GetReloadTime()) end slot8.UpdatePrecastArmor = function (slot0, slot1) if slot0._currentState ~= slot0.STATE_PRECAST or not slot0._precastArmor then return end slot0._precastArmor = slot0._precastArmor + slot1 if slot0._precastArmor <= 0 then slot0:Interrupt() end end slot8.Interrupt = function (slot0) slot0:DispatchEvent(slot2) slot0:DispatchEvent(slot0.Event.New(slot0.Battle.BattleUnitEvent.WEAPON_INTERRUPT, slot1)) slot0:RemovePrecastTimer() slot0:EnterCoolDown() end slot8.Cease = function (slot0) if slot0._currentState == slot0.STATE_ATTACK or slot0._currentState == slot0.STATE_PRECAST or slot0._currentState == slot0.STATE_PRECAST_FINISH then slot0:interruptAllEmitter() slot0:EnterCoolDown() end end slot8.AppendReloadBoost = function (slot0) return end slot8.DispatchGCD = function (slot0) if slot0._GCD > 0 then slot0._host:EnterGCD(slot0._GCD, slot0._tmpData.queue) end end slot8.Clear = function (slot0) slot0:RemovePrecastTimer() if slot0._majorEmitterList then for slot4, slot5 in ipairs(slot0._majorEmitterList) do slot5:Destroy() end end for slot4, slot5 in ipairs(slot0._tempEmittersList) do for slot9, slot10 in ipairs(slot5) do slot10:Destroy() end end for slot4, slot5 in ipairs(slot0._dumpedEmittersList) do for slot9, slot10 in ipairs(slot5) do slot10:Destroy() end end end slot8.Dispose = function (slot0) slot0.EventDispatcher.DetachEventDispatcher(slot0) slot0:RemovePrecastTimer() slot0._dataProxy = nil end slot8.AddCDTimer = function (slot0, slot1) slot0._currentState = slot0.STATE_OVER_HEAT slot0._CDstartTime = pg.TimeMgr.GetInstance():GetCombatTime() slot0._reloadRequire = slot1 end slot8.handleCoolDown = function (slot0) slot0._currentState = slot0.STATE_READY slot0._CDstartTime = nil slot0._jammingTime = 0 end slot8.OverHeat = function (slot0) slot0._currentState = slot0.STATE_OVER_HEAT end slot8.RemovePrecastTimer = function (slot0) pg.TimeMgr.GetInstance():RemoveBattleTimer(slot0._precastTimer) slot0._host:SetWeaponPreCastBound(false) slot0._precastArmor = nil slot0._precastTimer = nil end slot8.AddPreCastTimer = function (slot0) slot0._precastTimer = pg.TimeMgr.GetInstance().AddBattleTimer(slot2, "weaponPrecastTimer", 0, slot0._preCastInfo.time, function () slot0._currentState = slot0.STATE_PRECAST_FINISH slot0:RemovePrecastTimer() slot0:DispatchEvent(slot0.Event.New(slot1.Battle.BattleUnitEvent.WEAPON_PRE_CAST_FINISH, slot0)) slot0:Tracking() end, true) end slot8.Spawn = function (slot0, slot1, slot2) slot3 = nil slot4 = slot0._dataProxy:CreateBulletUnit(slot1, slot0._host, slot0, (slot2 ~= nil or Vector3.zero) and slot2:GetPosition()) slot0:setBulletSkin(slot4, slot1) slot0:TriggerBuffWhenSpawn(slot4) return slot4 end slot8.FixAmmo = function (slot0, slot1) slot0._fixedAmmo = slot1 end slot8.GetFixAmmo = function (slot0) return slot0._fixedAmmo end slot8.ShiftBullet = function (slot0, slot1) slot2 = {} for slot6 = 1, #slot0._bulletList, 1 do slot2[slot6] = slot1 end slot0._bulletList = slot2 end slot8.RevertBullet = function (slot0) slot0._bulletList = slot0._tmpData.bullet_ID end slot8.cacheBulletID = function (slot0) slot0._emitBulletIDList = slot0._bulletList end slot8.ShiftBarrage = function (slot0, slot1) for slot5, slot6 in ipairs(slot0._majorEmitterList) do table.insert(slot0._dumpedEmittersList, slot6) end slot0._majorEmitterList = {} if type(slot1) == "number" then slot2 = {} for slot6 = 1, #slot0._barrageList, 1 do slot2[slot6] = slot1 end slot0._barrageList = slot2 elseif type(slot1) == "table" then slot0._barrageList = slot1 end for slot5, slot6 in ipairs(slot0._barrageList) do slot0:createMajorEmitter(slot6, slot5) end end slot8.RevertBarrage = function (slot0) slot0:ShiftBarrage(slot0._tmpData.barrage_ID) end slot8.GetPrimalAmmoType = function (slot0) return slot0.GetBulletTmpDataFromID(slot0._tmpData.bullet_ID[1]).ammo_type end slot8.TriggerBuffWhenSpawn = function (slot0, slot1, slot2) slot0._host:TriggerBuff(slot2 or slot0.BuffEffectType.ON_BULLET_CREATE, { _bullet = slot1, equipIndex = slot0._equipmentIndex }) end slot8.DispatchBulletEvent = function (slot0, slot1, slot2) slot3 = slot2 slot4 = slot0._tmpData slot5 = nil if slot0._fireFXFlag ~= 0 then slot5 = slot4.fire_fx if slot0._fireFXFlag ~= -1 then slot0._fireFXFlag = slot0._fireFXFlag - 1 end end if type(slot4.spawn_bound) == "table" then slot3 = slot3 or ((not slot0._dataProxy:GetStageInfo().mainUnitPosition or not slot6[slot0._hostIFF] or Clone(slot6[slot0._hostIFF][slot4.spawn_bound[1]])) and Clone(slot0.MAIN_UNIT_POS[slot0._hostIFF][slot4.spawn_bound[1]])) slot0:DispatchEvent(slot1.Event.New(slot1.Battle.BattleUnitEvent.CREATE_BULLET, slot6)) return end end slot8.DispatchFireEvent = function (slot0, slot1, slot2) slot0:DispatchEvent(slot0.Event.New(slot0.Battle.BattleUnitEvent.FIRE, slot3)) end slot8.CheckAndShake = function (slot0) if slot0._tmpData.shakescreen ~= 0 then slot0.Battle.BattleCameraUtil.GetInstance():StartShake(pg.shake_template[slot0._tmpData.shakescreen]) end end slot8.GetBaseAngle = function (slot0) return slot0._baseAngle end slot8.GetHost = function (slot0) return slot0._host end slot8.GetStandHost = function (slot0) return slot0._standHost end slot8.GetPosition = function (slot0) return slot0._hostPos end slot8.GetDirection = function (slot0) return slot0._host:GetDirection() end slot8.GetCurrentState = function (slot0) return slot0._currentState end slot8.GetReloadTime = function (slot0) if slot0._reloadMax ~= slot0._cacheReloadMax or slot0._host:GetAttr().loadSpeed ~= slot0._cacheHostReload then slot0._cacheReloadMax = slot0._reloadMax slot0._cacheHostReload = slot0._host:GetAttr().loadSpeed slot0._cacheReloadTime = slot0.ReloadTime(slot0._reloadMax, slot0._host:GetAttr()) end return slot0._cacheReloadTime end slot8.GetReloadFinishTimeStamp = function (slot0) slot1 = 0 for slot5, slot6 in ipairs(slot0._reloadBoostList) do slot1 = slot1 + slot6 end if slot1 ~= 0 then return slot0._reloadRequire + slot0._CDstartTime + slot0._jammingTime + ((slot1 >= 0 or math.max(slot1, (slot0._reloadRequire - (pg.TimeMgr.GetInstance():GetCombatTime() - slot0._jammingTime - slot0._CDstartTime)) * -1)) and math.min(slot1, pg.TimeMgr.GetInstance().GetCombatTime() - slot0._jammingTime - slot0._CDstartTime)) end end slot8.AppendFactor = function (slot0, slot1) return end slot8.StartJamming = function (slot0) slot0._jammingStartTime = pg.TimeMgr.GetInstance():GetCombatTime() end slot8.JammingEliminate = function (slot0) if not slot0._jammingStartTime then return end slot0._jammingTime = pg.TimeMgr.GetInstance():GetCombatTime() - slot0._jammingStartTime slot0._jammingStartTime = nil end slot8.FlushReloadMax = function (slot0, slot1) slot0._reloadMax = slot0._tmpData.reload_max * (slot1 or 1) end slot8.AppendReloadFactor = function (slot0, slot1, slot2) slot0._reloadFacotrList[slot1] = slot2 end slot8.RemoveReloadFactor = function (slot0, slot1) if slot0._reloadFacotrList[slot1] then slot0._reloadFacotrList[slot1] = nil end end slot8.GetReloadFactorList = function (slot0) return slot0._reloadFacotrList end slot8.FlushReloadRequire = function (slot0) if not slot0._CDstartTime then return true end slot0._reloadRequire = pg.TimeMgr.GetInstance():GetCombatTime() - slot0._CDstartTime + slot0.ReloadTime(slot4, slot0._host:GetAttr()) end slot8.GetMinimumRange = function (slot0) return slot0._minRangeSqr end slot8.GetCorrectedDMG = function (slot0) return slot0._correctedDMG end slot8.GetConvertedAtkAttr = function (slot0) return slot0._convertedAtkAttr end slot8.SetAtkAttrTrasnform = function (slot0, slot1, slot2, slot3) slot0._atkAttrTrans = slot1 slot0._atkAttrTransA = slot2 slot0._atkAttrTransB = slot3 end slot8.GetAtkAttrTrasnform = function (slot0, slot1) slot2 = nil if slot0._atkAttrTrans then slot2 = math.min((slot1[slot0._atkAttrTrans] or 0) / slot0._atkAttrTransA, slot0._atkAttrTransB) end return slot2 end slot8.IsReady = function (slot0) return slot0._currentState == slot0.STATE_READY end slot8.GetReloadRate = function (slot0) if slot0._currentState == slot0.STATE_READY then return 0 elseif slot0._CDstartTime then return (slot0:GetReloadFinishTimeStamp() - pg.TimeMgr.GetInstance():GetCombatTime()) / slot0._reloadRequire else return 1 end end slot8.WeaponStatistics = function (slot0, slot1, slot2, slot3) slot0._CLDCount = slot0._CLDCount + 1 slot0._damageSum = slot1 + slot0._damageSum if slot2 then slot0._CTSum = slot0._CTSum + 1 end if not slot3 then slot0._ACCSum = slot0._ACCSum + 1 end end slot8.GetDamageSUM = function (slot0) return slot0._damageSum end slot8.GetCTRate = function (slot0) return slot0._CTSum / slot0._CLDCount end slot8.GetACCRate = function (slot0) return slot0._ACCSum / slot0._CLDCount end return
return { ['&lsquo;'] = "‘", ['&rsquo;'] = "’", ['&ldquo;'] = "“", ['&rdquo;'] = "”", ['&quot;'] = "\"", ['&#039;'] = "'", ['&mdash;'] = "—", ['&eacute;'] = "é", }
dofile("common.inc"); local distance_scale = 0.50; -- only scans pixels within a distance of this percentage from the center of the screen function getCenterPos() xyWindowSize = srGetWindowSize(); local ret = {}; ret[0] = xyWindowSize[0] / 2; ret[1] = xyWindowSize[1] / 2; return ret; end function isWithinRange(x, y) local radius = xyWindowSize[0] * 0.15; local dx, dy, d; dx = x - getCenterPos()[0]; dy = y - getCenterPos()[1]; if (dx*dx + dy*dy <= radius*radius) then return 1; end return nil; end function clickMouseSplatter(x, y, right) --srSetMousePos(x, y); srClickMouse(x + math.random(-2, 2), y + math.random(-2, 2), right); srReadScreen(); unpin = srFindImage("UnPin.png") if unpin then clickAllImages("Unpin.png", 5, 3, 1); end end function clickAllImages(image_name, offsetX, offsetY, rightClick, tol) if not image_name then error("Incorrect number of arguments for clickAllImages()"); end srReadScreen(); local buttons = findAllImages(image_name, nil, tol); clickAllPoints(buttons, offsetX, offsetY, rightClick); return #buttons; end function doit() askForWindow("Click Silt while you run around.\nRequires Automato v2.32 or above.\n\nUse F5 camera zoomed out about half way.\n\nRun around with arrows keys after macro begins, stop moving if it fails to pick something.\n\nInterface Options | Right-Click opens a Menu as Pinned must be ON.\n\nVideo | Time-of-Day Lighting must be at LOWEST (off)."); getCenterPos(); srReadScreen(); while true do local frame_start = lsGetTimer(); statusScreen("Watching for Silt (Red Dots)", nil, 0.7, 0.7); -- Looks for pixels whose red is between 0xA0 and 0xFF (160-255), and green/blue are less than 0x60 clusters = lsAnalyzeCustom(7, 40, 1, xyWindowSize[0] * distance_scale, 0xcac2b7FF, 0xe7e2d9FF, true); local clicked = nil; if clusters then for i = 1, #clusters do -- bias because it seems to drag to the upper left, take this off -- if I fix the downsampling clusters[i][0] = clusters[i][0] + 5; --clusters[i][1] = clusters[i][1] + 5; if isWithinRange(clusters[i][0], clusters[i][1]) then -- srClickMouse(clusters[i][0], clusters[i][1], 1); -- srSetMousePos(clusters[i][0], clusters[i][1]); -- code to try to make sure the pixel is the right color -- off by a few pixels in translation, maybe? needs to be pixel accurate! local good; local r, g, b; if nil then pxval = srReadPixel(clusters[i][0], clusters[i][1]); a = pxval % 256; pxval = (pxval - a) / 256; b = pxval % 256; pxval = (pxval - b) / 256; g = pxval % 256; pxval = (pxval - g) / 256; r = pxval % 256; if (r > 130 and g > 130 and b < 20 and math.abs(r - g) < 20) then good = 1; end else r = 0; g = 0; b = 0; good = 1; end if good then lsPrint(10, 80 + i*20, 0, 0.7, 0.7, 0xFFFFFFff, clusters[i][0] .. ", " .. clusters[i][1] .. " : " .. r .. "," .. g .. "," .. b); clickMouseSplatter(clusters[i][0], clusters[i][1], 1); clicked = 1; else lsPrint(10, 80 + i*20, 0, 0.7, 0.7, 0xFF7F7Fff, clusters[i][0] .. ", " .. clusters[i][1] .. " : " .. r .. "," .. g .. "," .. b); end else lsPrint(10, 80 + i*20, 0, 0.7, 0.7, 0x7F7F7Fff, clusters[i][0] .. ", " .. clusters[i][1] ); end end end lsSleep(50); end end
local xresources = require("beautiful.xresources") local dpi = xresources.apply_dpi theme = {} theme.wallpaper = "~/.config/awesome/wallpapers/pas.jpg" -- blue | gray | green | purple | red | yellow | zen theme.colour = "purple" --{{--- Style --------------------------------------------------------------------------------------------------------------------------- cyan = "#7f4de6" lblue = "#6c9eab" black = "#3f3f3f" lgrey = "#d2d2d2" dgrey = "#333333" white = "#ffffff" dblue = "#00ccff" gray = "#7d7d7d" green = "#84df19" red = "#eb2f6d" yellow = "#f6be57" zen = "#cacaa8" purple = "#8476ad" -- blue = dblue | gray = gray | green = dgreen | purple = purple | red = red | yellow = yellow | zen = zen main_colour = purple --theme.font = "Consolas 8" --theme.font = "Terminus 9" theme.font = "Inconsolata 9" theme.fg_normal = "#AAAAAA" --theme.fg_focus = "#F0DFAF" theme.fg_focus = main_colour theme.fg_urgent = "#CC9393" theme.bg_normal = "#222222" theme.bg_focus = "#1E2320" theme.bg_urgent = "#3F3F3F" theme.border_width = "1" theme.border_normal = "#3F3F3F" theme.border_focus = main_colour theme.border_marked = "#CC9393" theme.titlebar_bg_focus = "#3F3F3F" theme.titlebar_bg_normal = "#3F3F3F" theme.binclock_bg = "#777e76" theme.binclock_fga = "#CCCCCC" theme.binclock_fgi = "#444444" --theme.taglist_bg_focus = black theme.taglist_fg_focus = main_colour theme.tasklist_bg_focus = "#222222" theme.tasklist_fg_focus = main_colour theme.textbox_widget_as_label_font_color = white theme.textbox_widget_margin_top = dpi(1) theme.text_font_color_1 = green theme.text_font_color_2 = main_colour theme.text_font_color_3 = white theme.notify_font_color_1 = green theme.notify_font_color_2 = main_colour theme.notify_font_color_3 = black theme.notify_font_color_4 = white --theme.notify_font = "Consolas 10" --theme.notify_font = "Terminus 9" theme.notify_font = "Inconsolata 10" theme.notify_fg = theme.fg_normal theme.notify_bg = theme.bg_normal theme.notify_border = theme.border_focus theme.awful_widget_bckgrd_color = dgrey theme.awful_widget_border_color = dgrey theme.awful_widget_color = main_colour theme.awful_widget_gradien_color_1 = orange theme.awful_widget_gradien_color_2 = orange theme.awful_widget_gradien_color_3 = orange theme.awful_widget_height = dpi(14) theme.awful_widget_margin_top = dpi(2) theme.mouse_finder_color = "#CC9393" theme.menu_height = dpi(16) theme.menu_width = dpi(200) -- Temporary --theme.bg_systray = white theme.systray_icon_spacing = dpi(5) --{{--- Titlebar ------------------------------------------------------------------------------------------------------------------------ theme.titlebar_close_button_focus = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/close_focus.png" theme.titlebar_close_button_normal = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/close_normal.png" theme.titlebar_ontop_button_focus_active = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/ontop_focus_active.png" theme.titlebar_ontop_button_normal_active = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/ontop_normal_active.png" theme.titlebar_ontop_button_focus_inactive = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/ontop_focus_inactive.png" theme.titlebar_ontop_button_normal_inactive = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/ontop_normal_inactive.png" theme.titlebar_sticky_button_focus_active = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/sticky_focus_active.png" theme.titlebar_sticky_button_normal_active = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/sticky_normal_active.png" theme.titlebar_sticky_button_focus_inactive = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/sticky_focus_inactive.png" theme.titlebar_sticky_button_normal_inactive = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/sticky_normal_inactive.png" theme.titlebar_floating_button_focus_active = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/floating_focus_active.png" theme.titlebar_floating_button_normal_active = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/floating_normal_active.png" theme.titlebar_floating_button_focus_inactive = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/floating_focus_inactive.png" theme.titlebar_floating_button_normal_inactive = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/floating_normal_inactive.png" theme.titlebar_maximized_button_focus_active = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/maximized_focus_active.png" theme.titlebar_maximized_button_normal_active = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/maximized_normal_active.png" theme.titlebar_maximized_button_focus_inactive = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/maximized_focus_inactive.png" theme.titlebar_maximized_button_normal_inactive = "~/.config/awesome/theme/" .. theme.colour .. "/titlebar/maximized_normal_inactive.png" --{{--- Taglist ------------------------------------------------------------------------------------------------------------------------- theme.taglist_squares_sel = "~/.config/awesome/theme/" .. theme.colour .. "/taglist/squaref_a.png" theme.taglist_squares_unsel = "~/.config/awesome/theme/" .. theme.colour .. "/taglist/square_a.png" --{{--- Layout -------------------------------------------------------------------------------------------------------------------------- theme.layout_tile = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-huge/tile.png" theme.layout_tileleft = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-huge/tileleft.png" theme.layout_tilebottom = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-huge/tilebottom.png" theme.layout_tiletop = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-huge/tiletop.png" theme.layout_fairv = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-huge/fairv.png" theme.layout_fairh = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-huge/fairh.png" theme.layout_spiral = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-huge/spiral.png" theme.layout_dwindle = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-huge/dwindle.png" theme.layout_max = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-huge/max.png" theme.layout_fullscreen = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-huge/fullscreen.png" theme.layout_magnifier = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-huge/magnifier.png" theme.layout_floating = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-huge/floating.png" --{{--- Lain layout --------------------------------------------------------------------------------------------------------------------- --theme.useless_gap_width = 9 --theme.layout_cascade = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-lain/cascade.png" --theme.layout_cascadetile = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-lain/cascadebrowse.png" --theme.layout_centerfair = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-lain/centerfair.png" --theme.layout_centerhwork = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-lain/centerwork.png" --theme.layout_centerwork = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-lain/floating.png" --theme.layout_centerworkd = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-lain/floating.png" --theme.layout_termfair = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-lain/termfair.png" --theme.layout_uselessfair = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-lain/floating.png" --theme.layout_uselesspiral = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-lain/floating.png" --theme.layout_uselesstile = "~/.config/awesome/theme/" .. theme.colour .. "/layouts-lain/floating.png" --{{--- Theme icons --------------------------------------------------------------------------------------------------------------------- theme.awesome_icon = "~/.config/awesome/theme/" .. theme.colour .. "/blank.png" theme.menu_submenu_icon = "~/.config/awesome/theme/" .. theme.colour .. "/submenu.png" theme.icon_theme = Papirus --{{--- Battery icons ------------------------------------------------------------------------------------------------------------------- theme.battery_missing = "~/.config/awesome/theme/icons/battery/battery_missing.png" theme.battery_empty = "~/.config/awesome/theme/icons/battery/battery_empty.png" theme.battery_full = "~/.config/awesome/theme/icons/battery/battery_full.png" theme.battery_1 = "~/.config/awesome/theme/icons/battery/battery_1.png" theme.battery_2 = "~/.config/awesome/theme/icons/battery/battery_2.png" theme.battery_3 = "~/.config/awesome/theme/icons/battery/battery_3.png" theme.battery_4 = "~/.config/awesome/theme/icons/battery/battery_4.png" theme.battery_5 = "~/.config/awesome/theme/icons/battery/battery_5.png" theme.battery_charging_empty = "~/.config/awesome/theme/icons/battery/battery_charging_empty.png" theme.battery_charging_full = "~/.config/awesome/theme/icons/battery/battery_charging_full.png" theme.battery_charging_1 = "~/.config/awesome/theme/icons/battery/battery_charging_1.png" theme.battery_charging_2 = "~/.config/awesome/theme/icons/battery/battery_charging_2.png" theme.battery_charging_3 = "~/.config/awesome/theme/icons/battery/battery_charging_3.png" theme.battery_charging_4 = "~/.config/awesome/theme/icons/battery/battery_charging_4.png" theme.battery_charging_5 = "~/.config/awesome/theme/icons/battery/battery_charging_5.png" --{{--- Volume icons -------------------------------------------------------------------------------------------------------------------- theme.volume_high = "~/.config/awesome/theme/icons/volume/volume-high.png" theme.volume_medium = "~/.config/awesome/theme/icons/volume/volume-medium.png" theme.volume_low = "~/.config/awesome/theme/icons/volume/volume-low.png" theme.volume_muted = "~/.config/awesome/theme/icons/volume/volume-muted.png" theme.volume_off = "~/.config/awesome/theme/icons/volume/volume-off.png" --{{--- Taskbar icons ------------------------------------------------------------------------------------------------------------------- theme.wclock_icon = "~/.config/awesome/theme/icons/bar/clock.png" --{{--- User icons ---------------------------------------------------------------------------------------------------------------------- theme.package_icon = "~/.config/awesome/theme/icons/apps/package.png" theme.packages_icon = "~/.config/awesome/theme/icons/apps/packages.png" theme.settings_icon = "~/.config/awesome/theme/icons/apps/settings.png" theme.system_monitor_icon = "~/.config/awesome/theme/icons/apps/system_monitor.png" theme.terminal_icon = "~/.config/awesome/theme/icons/apps/terminal.png" theme.terminator_icon = "~/.config/awesome/theme/icons/apps/terminator.png" theme.awesone_default = "~/.config/awesome/theme/icons/awesome-default.png" theme.manual_icon = "~/.config/awesome/theme/icons/apps/manual.png" theme.edit_icon = "~/.config/awesome/theme/icons/apps/edit.png" theme.reload_icon = "~/.config/awesome/theme/icons/apps/reload.png" theme.quit_icon = "~/.config/awesome/theme/icons/apps/quit.png" --theme.shutdown_icon = "~/.config/awesome/theme/icons/apps/shutdown.png" theme.shutdown_icon = "~/.config/awesome/theme/icons/papirus-icon-theme/Papirus-Light/48x48/apps/system-shutdown.svg" theme.restart_icon = "~/.config/awesome/theme/icons/apps/restart.png" theme.hibernate_icon = "~/.config/awesome/theme/icons/apps/hibernate.png" theme.thunderbird_icon = "~/.config/awesome/theme/icons/apps/thunderbird.png" --{{------------------------------------------------------------------------------------------------------------------------------------- return theme
local Data = require("game.Data") print('----- init -----') do local spell = Data.get('core.ability', 'core.healing') print(spell) local spells = Data.get_table('core.ability') print(spells) end print('----------') -- do -- local spell = data.raw['core.ability']['core.healing'] -- print(spell) -- local spells = data.raw['core.ability'] -- print(spells) -- end
local ffi = require("ffi") local requireffi = require("requireffi.requireffi") ffi.cdef([[ void lock( void ); bool try_lock( void ); void unlock( void ); unsigned int version( void ); ]]) local BM, loadedLibraryPath = requireffi("BM.BadMutex.BadMutex") local BMVersion = 0x000100 local libVer = BM.version() if libVer < BMVersion or math.floor(libVer / 65536 % 256) > math.floor(BMVersion / 65536 % 256) then error("Library version mismatch. Wanted " .. tostring(BMVersion) .. ", got " .. tostring(libVer) .. ".") end local BadMutex BadMutex = { lock = function() return BM.lock() end, tryLock = function() return BM.try_lock() end, unlock = function() return BM.unlock() end, version = 0x000103, __depCtrlInit = function(DependencyControl) BadMutex.version = DependencyControl({ name = "BadMutex", version = BadMutex.version, description = "A global mutex.", author = "torque", url = "https://github.com/torque/ffi-experiments", moduleName = "BM.BadMutex", feed = "https://raw.githubusercontent.com/torque/ffi-experiments/master/DependencyControl.json" }) end, loadedLibraryPath = loadedLibraryPath } return BadMutex
--Thanks To HessaFTW And His Slave BlueHunter --Hessa Is the one that made this compalation --BlueHunter was the test subject --Have eny scripts that arent in here send them to HessaFTW and he will test and put in for next update bill = Instance.new("BillboardGui", game.Players.LocalPlayer.Character.Head) bill.Size = UDim2.new(4, 0, 4.5, 0) bill.AlwaysOnTop = true label = Instance.new("TextLabel", bill) label.Size = UDim2.new(2, 0, 1, 0) label.Position = UDim2.new(-0.5, 0, -0.5, 0) label.BackgroundTransparency = 1 label.FontSize = "Size14" while true do label.TextColor3 = Color3.new(math.random(),math.random(),math.random()) wait(.09) label.TextStrokeColor3 = Color3.new(0 ,0 ,0) label.TextStrokeTransparency = 0 label.Text = "HessaFTW" end --Change HessaFTW To what u want to be named
-------------------------------------------------------------------------------- -- client -------------------------------------------------------------------------------- local slen = string.len local channel = tengine.channel local INFO_MSG = tengine.INFO_MSG local DEBUG_MSG = tengine.DEBUG_MSG local ERROR_MSG = tengine.ERROR_MSG local p = tengine.p local protocol = require('framework.protocol') local behavior = require("client.behavior") local connected = function(self) return self.channel ~= nil end local connect = function(self, address) local on_read = function(data, size) p("on_read", data, size) local err, type, name, message = protocol.decode(data, size) if err then ERROR_MSG(succ) return end p(name, message) self.behavior:run({'net', self, name, message}) end local on_closed = function(err) self.channel = nil end self.channel = channel.connect(address, on_read, on_closed) return self:connected() end local disconnect = function(self) if self.channel then self.channel:close() self.channel = nil end end local send = function(self, name, message) if self.channel then local buff = protocol.encode(name, message) self.channel:send(buff, slen(buff)) end end local start = function(self, address) if not self:connect(address) then ERROR_MSG("client start failed !!!") return end self.behavior:run({'system', self}) end local methods = { connect = connect, connected = connected, send = send, start = start, } local new = function(account, version) local self = setmetatable({}, {__index = methods}) self.behavior = behavior.new() self.account = account self.version = version or 0 return self end return { new = new }
--[[ LipNet: End-to-End Sentence-level Lipreading. arXiv preprint arXiv:1611.01599 (2016). Copyright (C) 2017 Yannis M. Assael, Brendan Shillingford, Shimon Whiteson, Nando de Freitas 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 TemporalJitter, parent = torch.class('nn.TemporalJitter', 'nn.Module') function TemporalJitter:__init(p, l) parent.__init(self) assert(type(p) == 'number', 'input is not scalar!') self.p = p or 0.05 self.compute_len = l or false self.train = true end function TemporalJitter:training() self.train = true end function TemporalJitter:evaluate() self.train = false end function TemporalJitter:updateOutput(input) assert(input:dim() == 5 or input:dim() == 4, 'boom') if self.train then local input_dim4 = false if input:dim() == 4 then input_dim4 = true input = input:view(1,input:size(1),input:size(2),input:size(3),input:size(4)) end local len = input:size(3) self.output:resizeAs(input):copy(input) for b = 1, input:size(1) do local prob_del = torch.Tensor(len):bernoulli(self.p) local prob_dup = prob_del:index(1 ,torch.linspace(len,1,len):long()) local output_count = 1 for t = 1, len do if prob_del[t] == 0 then self.output[{{b},{},{output_count},{}}] = input[{{b},{},{t},{}}] output_count = output_count + 1 end if prob_dup[t] == 1 and output_count > 1 then self.output[{{b},{},{output_count},{}}] = self.output[{{b},{},{output_count-1},{}}] output_count = output_count + 1 end end end if input_dim4 then return self.output[1] end else self.output:resizeAs(input) self.output:copy(input) end return self.output end function TemporalJitter:updateGradInput(input, gradOutput) self.gradInput:resizeAs(gradOutput) self.gradInput:copy(gradOutput) return self.gradInput end
local Object = require "object" local Vector2 = Object:extend() function Vector2:__new(x, y) self.x = x or 0 self.y = y or 0 end function Vector2:copy() return Vector2(self.x, self.y) end function Vector2.__add(a, b) return Vector2(a.x + b.x, a.y + b.y) end function Vector2.__sub(a, b) return Vector2(a.x - b.x, a.y - b.y) end function Vector2.__eq(a, b) return a.x == b.x and a.y == b.y end function Vector2.__mul(a, b) return Vector2(a.x * b, a.y * b) end function Vector2:__tostring() return "x: " .. self.x .. " y: " .. self.y end Vector2.UP = Vector2(0, -1) Vector2.RIGHT = Vector2(1, 0) Vector2.DOWN = Vector2(0, 1) Vector2.LEFT = Vector2(-1, 0) Vector2.UP_RIGHT = Vector2(1, -1) Vector2.UP_LEFT = Vector2(-1, -1) Vector2.DOWN_RIGHT = Vector2(1, 1) Vector2.DOWN_LEFT = Vector2(-1, 1) return Vector2
-- Stats tracking FCStats = {} function FCStats.Inc( name ) local gcid = FCDevice.GetGameCenterID() if gcid == nil then gcid = "local" end val = FCPersistentData.GetNumber( "stats." .. gcid .. "." .. name ) if val then val = val + 1 else val = 1 end FCPersistentData.SetNumber( "stats." .. gcid .. "." .. name, val ) end function FCStats.Get( name ) local gcid = FCDevice.GetGameCenterID() if gcid == nil then gcid = "local" end return FCPersistentData.GetNumber( "stats." .. gcid .. "." .. name ) end
require('actors/Projectile.lua') local image = passion.graphics.getImage('images/image.png') local quad1 = passion.graphics.newQuad(image, 0,32, 16,16 ) local quad2 = passion.graphics.newQuad(image, 16,32, 16,16 ) local quad3 = passion.graphics.newQuad(image, 32,32, 16,16 ) PlasmaProjectile = class('PlasmaProjectile', Projectile) function PlasmaProjectile:initialize(x,y,velX,velY,angle,groupIndex,quad) super.initialize(self, x,y,velX,velY,angle,groupIndex, 0.5, 1, quad) end PlasmaProjectile1 = class('PlasmaProjectile1', PlasmaProjectile) function PlasmaProjectile1:initialize(x,y,velX,velY,angle,groupIndex) super.initialize(self, x,y,velX,velY,angle,groupIndex,quad1) end PlasmaProjectile2 = class('PlasmaProjectile2', PlasmaProjectile) function PlasmaProjectile2:initialize(x,y,velX,velY,angle,groupIndex) super.initialize(self, x,y,velX,velY,angle,groupIndex,quad2) end PlasmaProjectile3 = class('PlasmaProjectile3', PlasmaProjectile) function PlasmaProjectile3:initialize(x,y,velX,velY,angle,groupIndex) super.initialize(self, x,y,velX,velY,angle,groupIndex,quad3) end
local IsAnimated = false Citizen.CreateThread(function() while ESX == nil do TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) Citizen.Wait(0) end end) --------------------- client parapluie bleu RegisterNetEvent('esx_extraitems:umbrellablue') AddEventHandler('esx_extraitems:umbrellablue', function() local playerPed = GetPlayerPed(-1) if not IsAnimated then local prop_name = 'p_amb_brolly_01' IsAnimated = true Citizen.CreateThread(function() local x,y,z = table.unpack(GetEntityCoords(playerPed)) prop = CreateObject(GetHashKey(prop_name), x, y, z+0.2, true, true, true) RequestAnimDict('amb@code_human_wander_drinking@beer@male@base') while not HasAnimDictLoaded('amb@code_human_wander_drinking@beer@male@base') do Citizen.Wait(1) end AttachEntityToEntity(prop, playerPed, GetPedBoneIndex(playerPed, 57005), 0.10, 0, -0.001, 80.0, 150.0, 200.0, true, true, false, true, 1, true) TaskPlayAnim(playerPed, "amb@code_human_wander_drinking@beer@male@base", "static", 3.5, -8, -1, 49, 0, 0, 0, 0) end) elseif IsAnimated then IsAnimated = false ClearPedSecondaryTask(playerPed) DeleteObject(prop) end end) --------------------- client parapluie gris RegisterNetEvent('esx_extraitems:umbrellagrey') AddEventHandler('esx_extraitems:umbrellagrey', function() local playerPed = GetPlayerPed(-1) if not IsAnimated then local prop_name = 'p_amb_brolly_01_s' -- IsAnimated = true -- Citizen.CreateThread(function() local x,y,z = table.unpack(GetEntityCoords(playerPed)) prop = CreateObject(GetHashKey(prop_name), x, y, z+0.2, true, true, true) RequestAnimDict('amb@code_human_wander_drinking@beer@male@base') while not HasAnimDictLoaded('amb@code_human_wander_drinking@beer@male@base') do Citizen.Wait(1) end AttachEntityToEntity(prop, playerPed, GetPedBoneIndex(playerPed, 57005), 0.10, 0, -0.001, 80.0, 150.0, 200.0, true, true, false, true, 1, true) TaskPlayAnim(playerPed, "amb@code_human_wander_drinking@beer@male@base", "static", 3.5, -8, -1, 49, 0, 0, 0, 0) end) elseif IsAnimated then IsAnimated = false ClearPedSecondaryTask(playerPed) DeleteObject(prop) end end) --------------------- partie client valise tactic gris RegisterNetEvent('esx_extraitems:handbagtacticgrey') AddEventHandler('esx_extraitems:handbagtacticgrey', function() local playerPed = GetPlayerPed(-1) if not IsAnimated then local prop_name = 'prop_security_case_01' -- IsAnimated = true -- Citizen.CreateThread(function() local x,y,z = table.unpack(GetEntityCoords(playerPed)) prop = CreateObject(GetHashKey(prop_name), x, y, z+0.2, true, true, true) RequestAnimDict('missheistdocksprep1hold_cellphone') while not HasAnimDictLoaded('missheistdocksprep1hold_cellphone') do Citizen.Wait(1) end AttachEntityToEntity(prop, playerPed, GetPedBoneIndex(playerPed, 57005), 0.15, 0, 0, 0, 270.0, 60.0, true, true, false, true, 1, true) TaskPlayAnim(playerPed, "missheistdocksprep1hold_cellphone", "static", 1.0, -1, -1, 50, 0, 0, 0, 0) end) elseif IsAnimated then IsAnimated = false DeleteObject(prop) ClearPedSecondaryTask(playerPed) end end) --[[------------------- partie client valise tactic noir -- changer l'orientation RegisterNetEvent('esx_extraitems:handbagtacticblack') AddEventHandler('esx_extraitems:handbagtacticblack', function() local playerPed = GetPlayerPed(-1) if not IsAnimated then ---------------- local prop_name = 'prop_idol_case_02' -- IsAnimated = true -- Citizen.CreateThread(function() local x,y,z = table.unpack(GetEntityCoords(playerPed)) prop = CreateObject(GetHashKey(prop_name), x, y, z+0.2, true, true, true) RequestAnimDict('missheistdocksprep1hold_cellphone') while not HasAnimDictLoaded('missheistdocksprep1hold_cellphone') do Citizen.Wait(1) end AttachEntityToEntity(prop, playerPed, GetPedBoneIndex(playerPed, 57005), 0.15, 0, 0, 0, 180.0, 90.0, true, true, false, true, 1, true) TaskPlayAnim(playerPed, "missheistdocksprep1hold_cellphone", "static", 1.0, -1, -1, 50, 0, 0, 0, 0) end) elseif IsAnimated then IsAnimated = false DeleteObject(prop) ClearPedSecondaryTask(playerPed) end end) --]] --------------------- partie client Valise vacance tissu RegisterNetEvent('esx_extraitems:handbagholiday') AddEventHandler('esx_extraitems:handbagholiday', function() local playerPed = GetPlayerPed(-1) if not IsAnimated then local prop_name = 'prop_ld_suitcase_01' -- IsAnimated = true -- Citizen.CreateThread(function() local x,y,z = table.unpack(GetEntityCoords(playerPed)) prop = CreateObject(GetHashKey(prop_name), x, y, z+0.2, true, true, true) RequestAnimDict('missheistdocksprep1hold_cellphone') while not HasAnimDictLoaded('missheistdocksprep1hold_cellphone') do Citizen.Wait(1) end AttachEntityToEntity(prop, playerPed, GetPedBoneIndex(playerPed, 57005), 0.35, 0, 0, 0, 270.0, 60.0, true, true, false, true, 1, true) TaskPlayAnim(playerPed, "missheistdocksprep1hold_cellphone", "static", 1.0, -1, -1, 50, 0, 0, 0, 0) end) elseif IsAnimated then IsAnimated = false DeleteObject(prop) ClearPedSecondaryTask(playerPed) end end) --------------------- partie client Valise vacance resitance RegisterNetEvent('esx_extraitems:handbagholidayhard') AddEventHandler('esx_extraitems:handbagholidayhard', function() local playerPed = GetPlayerPed(-1) if not IsAnimated then local prop_name = 'prop_ld_suitcase_02' -- IsAnimated = true -- Citizen.CreateThread(function() local x,y,z = table.unpack(GetEntityCoords(playerPed)) prop = CreateObject(GetHashKey(prop_name), x, y, z+0.2, true, true, true) RequestAnimDict('missheistdocksprep1hold_cellphone') while not HasAnimDictLoaded('missheistdocksprep1hold_cellphone') do Citizen.Wait(1) end AttachEntityToEntity(prop, playerPed, GetPedBoneIndex(playerPed, 57005), 0.35, 20, 0, 0, 270.0, 60.0, true, true, false, true, 1, true) TaskPlayAnim(playerPed, "missheistdocksprep1hold_cellphone", "static", 1.0, -1, -1, 50, 0, 0, 0, 0) end) elseif IsAnimated then IsAnimated = false DeleteObject(prop) ClearPedSecondaryTask(playerPed) end end) --------------------- partie client valise avocat RegisterNetEvent('esx_extraitems:handbag') AddEventHandler('esx_extraitems:handbag', function() local playerPed = GetPlayerPed(-1) if not IsAnimated then local prop_name = 'prop_ld_case_01' -- IsAnimated = true -- Citizen.CreateThread(function() local x,y,z = table.unpack(GetEntityCoords(playerPed)) prop = CreateObject(GetHashKey(prop_name), x, y, z+0.2, true, true, true) RequestAnimDict('missheistdocksprep1hold_cellphone') while not HasAnimDictLoaded('missheistdocksprep1hold_cellphone') do Citizen.Wait(1) end AttachEntityToEntity(prop, playerPed, GetPedBoneIndex(playerPed, 57005), 0.15, 0, 0, 0, 270.0, 60.0, true, true, false, true, 1, true) TaskPlayAnim(playerPed, "missheistdocksprep1hold_cellphone", "static", 1.0, -1, -1, 50, 0, 0, 0, 0) end) elseif IsAnimated then IsAnimated = false DeleteObject(prop) ClearPedSecondaryTask(playerPed) end end) RegisterNetEvent('esx_extraitem:bong') AddEventHandler('esx_extraitem:bong', function() local playerPed = GetPlayerPed(-1) if not IsAnimated then local prop_name = 'prop_bong_01' local prop_name2 = 'p_cs_lighter_01' -- IsAnimated = true Citizen.CreateThread(function() local x,y,z = table.unpack(GetEntityCoords(playerPed)) prop = CreateObject(GetHashKey(prop_name), x, y, z+0.2, true, true, true) prop2= CreateObject(GetHashKey(prop_name2), x, y, z+0.2, true, true, true) RequestAnimDict('anim@safehouse@bong') while not HasAnimDictLoaded('anim@safehouse@bong') do Citizen.Wait(0) end AttachEntityToEntity(prop, playerPed, GetPedBoneIndex(playerPed, 57005), 0.10, 0.0, 0, 99.0, 192.0, 180.0, true, true, false, true, 1, true) AttachEntityToEntity(prop, playerPed, GetPedBoneIndex(playerPed, 18905), 0.10, -0.25, 0, 95.0, 190.0, 180.0, true, true, false, true, 1, true) TaskPlayAnim(playerPed, "anim@safehouse@bong", "bong_stage1", 3.5, -8, -1, 49, 0, 0, 0, 0) Citizen.Wait(1500) Citizen.Wait(8000) IsAnimated = false DeleteObject(prop) DeleteObject(prop2) ClearPedSecondaryTask(playerPed) TriggerServerEvent('esx_extraitem:bong') end) end end)
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end if msgcontains(msg, "mission") then if Player(cid):getStorageValue(Storage.hiddenCityOfBeregar.RoyalRescue) == 3 then npcHandler:say("I warn you, those trolls are WAY more dangerous than the usual kind. Alone, I can't do anything for my brothers. Find a way to the trolls' hideout and rescue my brothers. Are you willing to help me?", cid) npcHandler.topic[cid] = 1 end elseif msgcontains(msg, "yes") then if npcHandler.topic[cid] == 1 then Player(cid):setStorageValue(Storage.hiddenCityOfBeregar.RoyalRescue, 4) npcHandler:say(" Great! I hope you find my brothers. Good luck!", cid) npcHandler.topic[cid] = 0 end end return true end npcHandler:setMessage(MESSAGE_WALKAWAY, "See you my friend.") npcHandler:setMessage(MESSAGE_FAREWELL, "See you my friend.") npcHandler:setMessage(MESSAGE_GREET, "Hello. I'm so glad someone has found me. Did you meet THEM?!") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
local spec_helper = require "spec.spec_helpers" local utils = require "kong.tools.utils" local http_client = require "kong.tools.http_client" local cjson = require "cjson" local rex = require "rex_pcre" -- Load everything we need from the spec_helper local env = spec_helper.get_env() -- test environment local dao_factory = env.dao_factory local configuration = env.configuration configuration.cassandra = configuration.databases_available[configuration.database].properties local PROXY_SSL_URL = spec_helper.PROXY_SSL_URL local PROXY_URL = spec_helper.PROXY_URL local STUB_GET_URL = spec_helper.STUB_GET_URL local STUB_POST_URL = spec_helper.STUB_POST_URL local function provision_code() local response = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "email", response_type = "code", state = "hello", authenticated_userid = "userid123" }, {host = "oauth2.com"}) local body = cjson.decode(response) local matches = rex.gmatch(body.redirect_uri, "^http://google\\.com/kong\\?code=([\\w]{32,32})&state=hello$") local code for line in matches do code = line end local data = dao_factory.oauth2_authorization_codes:find_by_keys({code = code}) return data[1].code end local function provision_token() local code = provision_code() local response = http_client.post(PROXY_SSL_URL.."/oauth2/token", { code = code, client_id = "clientid123", client_secret = "secret123", grant_type = "authorization_code" }, {host = "oauth2.com"}) return cjson.decode(response) end describe("Authentication Plugin", function() local function prepare() spec_helper.drop_db() spec_helper.insert_fixtures { api = { { name = "tests oauth2", request_host = "oauth2.com", upstream_url = "http://mockbin.com" }, { name = "tests oauth2 with path", request_host = "mockbin-path.com", upstream_url = "http://mockbin.com", request_path = "/somepath/" }, { name = "tests oauth2 with hide credentials", request_host = "oauth2_3.com", upstream_url = "http://mockbin.com" }, { name = "tests oauth2 client credentials", request_host = "oauth2_4.com", upstream_url = "http://mockbin.com" }, { name = "tests oauth2 password grant", request_host = "oauth2_5.com", upstream_url = "http://mockbin.com" } }, consumer = { { username = "auth_tests_consumer" } }, plugin = { { name = "oauth2", config = { scopes = { "email", "profile" }, mandatory_scope = true, provision_key = "provision123", token_expiration = 5, enable_implicit_grant = true }, __api = 1 }, { name = "oauth2", config = { scopes = { "email", "profile" }, mandatory_scope = true, provision_key = "provision123", token_expiration = 5, enable_implicit_grant = true }, __api = 2 }, { name = "oauth2", config = { scopes = { "email", "profile" }, mandatory_scope = true, provision_key = "provision123", token_expiration = 5, enable_implicit_grant = true, hide_credentials = true }, __api = 3 }, { name = "oauth2", config = { scopes = { "email", "profile" }, mandatory_scope = true, provision_key = "provision123", token_expiration = 5, enable_client_credentials = true, enable_authorization_code = false }, __api = 4 }, { name = "oauth2", config = { scopes = { "email", "profile" }, mandatory_scope = true, provision_key = "provision123", token_expiration = 5, enable_password_grant = true, enable_authorization_code = false }, __api = 5 } }, oauth2_credential = { { client_id = "clientid123", client_secret = "secret123", redirect_uri = "http://google.com/kong", name="testapp", __consumer = 1 } } } end setup(function() spec_helper.prepare_db() end) teardown(function() spec_helper.stop_kong() end) before_each(function() spec_helper.restart_kong() -- Required because the uuid function doesn't seed itself every millisecond, but every second prepare() end) describe("OAuth2 Authorization", function() describe("Code Grant", function() it("should return an error when no provision_key is being sent", function() local response, status, headers = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_provision_key", body.error) assert.are.equal("Invalid Kong provision_key", body.error_description) -- Checking headers assert.are.equal("no-store", headers["cache-control"]) assert.are.equal("no-cache", headers["pragma"]) end) it("should return an error when no parameter is being sent", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_authenticated_userid", body.error) assert.are.equal("Missing authenticated_userid parameter", body.error_description) end) it("should return an error when only provision_key and authenticated_userid are sent", function() local response, status, headers = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("Invalid client_id", body.error_description) -- Checking headers assert.are.equal("no-store", headers["cache-control"]) assert.are.equal("no-cache", headers["pragma"]) end) it("should return an error when only the client_is being sent", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(1, utils.table_size(body)) assert.are.equal("http://google.com/kong?error=invalid_scope&error_description=You%20must%20specify%20a%20scope", body.redirect_uri) end) it("should return an error when an invalid scope is being sent", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "wot" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(1, utils.table_size(body)) assert.are.equal("http://google.com/kong?error=invalid_scope&error_description=%22wot%22%20is%20an%20invalid%20scope", body.redirect_uri) end) it("should return an error when no response_type is being sent", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "email" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(1, utils.table_size(body)) assert.are.equal("http://google.com/kong?error=unsupported_response_type&error_description=Invalid%20response_type", body.redirect_uri) end) it("should return an error with a state when no response_type is being sent", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "email", state = "somestate" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(1, utils.table_size(body)) assert.are.equal("http://google.com/kong?error=unsupported_response_type&state=somestate&error_description=Invalid%20response_type", body.redirect_uri) end) it("should return error when the redirect_uri does not match", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "email", response_type = "code", redirect_uri = "http://hello.com/" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(1, utils.table_size(body)) assert.are.equal("http://google.com/kong?error=invalid_request&error_description=Invalid%20redirect_uri%20that%20does%20not%20match%20with%20the%20one%20created%20with%20the%20application", body.redirect_uri) end) it("should fail when not under HTTPS", function() local response, status = http_client.post(PROXY_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "email", response_type = "code" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("access_denied", body.error) assert.are.equal("You must use HTTPS", body.error_description) end) it("should return success", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "email", response_type = "code" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equal(1, utils.table_size(body)) assert.truthy(rex.match(body.redirect_uri, "^http://google\\.com/kong\\?code=[\\w]{32,32}$")) end) it("should fail with a path when using the DNS", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123a", authenticated_userid = "id123", client_id = "clientid123", scope = "email", response_type = "code" }, {host = "mockbin-path.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_provision_key", body.error) assert.are.equal("Invalid Kong provision_key", body.error_description) end) it("should return success with a path", function() local response, status = http_client.post(PROXY_SSL_URL.."/somepath/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "email", response_type = "code" }, {host = "mockbin-path.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equal(1, utils.table_size(body)) assert.truthy(rex.match(body.redirect_uri, "^http://google\\.com/kong\\?code=[\\w]{32,32}$")) end) it("should return success when requesting the url with final slash", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/authorize/", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "email", response_type = "code" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equal(1, utils.table_size(body)) assert.truthy(rex.match(body.redirect_uri, "^http://google\\.com/kong\\?code=[\\w]{32,32}$")) end) it("should return success with a state", function() local response, status, headers = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "email", response_type = "code", state = "hello" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equal(1, utils.table_size(body)) assert.truthy(rex.match(body.redirect_uri, "^http://google\\.com/kong\\?code=[\\w]{32,32}&state=hello$")) -- Checking headers assert.are.equal("no-store", headers["cache-control"]) assert.are.equal("no-cache", headers["pragma"]) end) it("should return success and store authenticated user properties", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "email", response_type = "code", state = "hello", authenticated_userid = "userid123" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equal(1, utils.table_size(body)) assert.truthy(rex.match(body.redirect_uri, "^http://google\\.com/kong\\?code=[\\w]{32,32}&state=hello$")) local matches = rex.gmatch(body.redirect_uri, "^http://google\\.com/kong\\?code=([\\w]{32,32})&state=hello$") local code for line in matches do code = line end local data = dao_factory.oauth2_authorization_codes:find_by_keys({code = code}) assert.are.equal(1, #data) assert.are.equal(code, data[1].code) assert.are.equal("userid123", data[1].authenticated_userid) assert.are.equal("email", data[1].scope) end) end) describe("Implicit Grant", function() it("should return success", function() local response, status, headers = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "email", response_type = "token" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equal(1, utils.table_size(body)) assert.truthy(rex.match(body.redirect_uri, "^http://google\\.com/kong\\?token_type=bearer&access_token=[\\w]{32,32}$")) -- Checking headers assert.are.equal("no-store", headers["cache-control"]) assert.are.equal("no-cache", headers["pragma"]) end) it("should return success and the state", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "email", response_type = "token", state = "wot" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equal(1, utils.table_size(body)) assert.truthy(rex.match(body.redirect_uri, "^http://google\\.com/kong\\?token_type=bearer&state=wot&access_token=[\\w]{32,32}$")) end) it("should return success and store authenticated user properties", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/authorize", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", scope = "email profile", response_type = "token", authenticated_userid = "userid123" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equal(1, utils.table_size(body)) assert.truthy(rex.match(body.redirect_uri, "^http://google\\.com/kong\\?token_type=bearer&access_token=[\\w]{32,32}$")) local matches = rex.gmatch(body.redirect_uri, "^http://google\\.com/kong\\?token_type=bearer&access_token=([\\w]{32,32})$") local access_token for line in matches do access_token = line end local data = dao_factory.oauth2_tokens:find_by_keys({access_token = access_token}) assert.are.equal(1, #data) assert.are.equal(access_token, data[1].access_token) assert.are.equal("userid123", data[1].authenticated_userid) assert.are.equal("email profile", data[1].scope) -- Checking that there is no refresh token since it's an implicit grant assert.are.equal(0, data[1].expires_in) assert.falsy(data[1].refresh_token) end) end) describe("Client Credentials", function() it("should return an error when client_secret is not sent", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { client_id = "clientid123", scope = "email", response_type = "token" }, {host = "oauth2_4.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("Invalid client_secret", body.error_description) end) it("should return an error when client_secret is not sent", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { client_id = "clientid123", client_secret="secret123", scope = "email", response_type = "token" }, {host = "oauth2_4.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("Invalid grant_type", body.error_description) end) it("should fail when not under HTTPS", function() local response, status = http_client.post(PROXY_URL.."/oauth2/token", { client_id = "clientid123", client_secret="secret123", scope = "email", grant_type = "client_credentials" }, {host = "oauth2_4.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("access_denied", body.error) assert.are.equal("You must use HTTPS", body.error_description) end) it("should return success", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { client_id = "clientid123", client_secret="secret123", scope = "email", grant_type = "client_credentials" }, {host = "oauth2_4.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equals(4, utils.table_size(body)) assert.truthy(body.refresh_token) assert.truthy(body.access_token) assert.are.equal("bearer", body.token_type) assert.are.equal(5, body.expires_in) end) it("should return success with authorization header", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { scope = "email", grant_type = "client_credentials" }, {host = "oauth2_4.com", authorization = "Basic Y2xpZW50aWQxMjM6c2VjcmV0MTIz"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equals(4, utils.table_size(body)) assert.truthy(body.refresh_token) assert.truthy(body.access_token) assert.are.equal("bearer", body.token_type) assert.are.equal(5, body.expires_in) end) it("should return an error with a wrong authorization header", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { scope = "email", grant_type = "client_credentials" }, {host = "oauth2_4.com", authorization = "Basic Y2xpZW50aWQxMjM6c2VjcmV0MTI0"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("Invalid client_secret", body.error_description) end) end) describe("Password Grant", function() it("should return an error when client_secret is not sent", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { client_id = "clientid123", scope = "email", response_type = "token" }, {host = "oauth2_5.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("Invalid client_secret", body.error_description) end) it("should return an error when client_secret is not sent", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { client_id = "clientid123", client_secret="secret123", scope = "email", response_type = "token" }, {host = "oauth2_5.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("Invalid grant_type", body.error_description) end) it("should fail when no provision key is being sent", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { client_id = "clientid123", client_secret="secret123", scope = "email", grant_type = "password" }, {host = "oauth2_5.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_provision_key", body.error) assert.are.equal("Invalid Kong provision_key", body.error_description) end) it("should fail when no provision key is being sent", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { client_id = "clientid123", client_secret="secret123", scope = "email", grant_type = "password" }, {host = "oauth2_5.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_provision_key", body.error) assert.are.equal("Invalid Kong provision_key", body.error_description) end) it("should fail when no authenticated user id is being sent", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { provision_key = "provision123", client_id = "clientid123", client_secret="secret123", scope = "email", grant_type = "password" }, {host = "oauth2_5.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_authenticated_userid", body.error) assert.are.equal("Missing authenticated_userid parameter", body.error_description) end) it("should return success", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { provision_key = "provision123", authenticated_userid = "id123", client_id = "clientid123", client_secret="secret123", scope = "email", grant_type = "password" }, {host = "oauth2_5.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equals(4, utils.table_size(body)) assert.truthy(body.refresh_token) assert.truthy(body.access_token) assert.are.equal("bearer", body.token_type) assert.are.equal(5, body.expires_in) end) it("should return success with authorization header", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { provision_key = "provision123", authenticated_userid = "id123", scope = "email", grant_type = "password" }, {host = "oauth2_5.com", authorization = "Basic Y2xpZW50aWQxMjM6c2VjcmV0MTIz"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equals(4, utils.table_size(body)) assert.truthy(body.refresh_token) assert.truthy(body.access_token) assert.are.equal("bearer", body.token_type) assert.are.equal(5, body.expires_in) end) it("should return an error with a wrong authorization header", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { provision_key = "provision123", authenticated_userid = "id123", scope = "email", grant_type = "password" }, {host = "oauth2_5.com", authorization = "Basic Y2xpZW50aWQxMjM6c2VjcmV0MTI0"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("Invalid client_secret", body.error_description) end) end) end) describe("OAuth2 Access Token", function() it("should return an error when nothing is being sent", function() local response, status, headers = http_client.post(PROXY_SSL_URL.."/oauth2/token", { }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("Invalid client_id", body.error_description) -- Checking headers assert.are.equal("no-store", headers["cache-control"]) assert.are.equal("no-cache", headers["pragma"]) end) it("should return an error when only the code is being sent", function() local code = provision_code() local response, status, headers = http_client.post(PROXY_SSL_URL.."/oauth2/token", { code = code }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("Invalid client_id", body.error_description) -- Checking headers assert.are.equal("no-store", headers["cache-control"]) assert.are.equal("no-cache", headers["pragma"]) end) it("should return an error when only the code and client_secret are being sent", function() local code = provision_code() local response, status, headers = http_client.post(PROXY_SSL_URL.."/oauth2/token", { code = code, client_secret = "secret123" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("Invalid client_id", body.error_description) -- Checking headers assert.are.equal("no-store", headers["cache-control"]) assert.are.equal("no-cache", headers["pragma"]) end) it("should return an error when only the code and client_secret and client_id are being sent", function() local code = provision_code() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { code = code, client_id = "clientid123", client_secret = "secret123" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("Invalid grant_type", body.error_description) end) it("should return an error with a wrong code", function() local code = provision_code() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { code = code.."hello", client_id = "clientid123", client_secret = "secret123", grant_type = "authorization_code" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("Invalid code", body.error_description) end) it("should return success without state", function() local code = provision_code() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { code = code, client_id = "clientid123", client_secret = "secret123", grant_type = "authorization_code" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equals(4, utils.table_size(body)) assert.truthy(body.refresh_token) assert.truthy(body.access_token) assert.are.equal("bearer", body.token_type) assert.are.equal(5, body.expires_in) end) it("should return success with state", function() local code = provision_code() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { code = code, client_id = "clientid123", client_secret = "secret123", grant_type = "authorization_code", state = "wot" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equals(5, utils.table_size(body)) assert.truthy(body.refresh_token) assert.truthy(body.access_token) assert.are.equal("bearer", body.token_type) assert.are.equal(5, body.expires_in) assert.are.equal("wot", body.state) end) end) describe("Making a request", function() it("should return an error when nothing is being sent", function() local response, status = http_client.post(STUB_GET_URL, { }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(403, status) assert.are.equal("Invalid authentication credentials", body.message) end) it("should return an error when a wrong access token is being sent", function() local response, status = http_client.get(STUB_GET_URL, { access_token = "hello" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(403, status) assert.are.equal("Invalid authentication credentials", body.message) end) it("should work when a correct access_token is being sent in the querystring", function() local token = provision_token() local _, status = http_client.post(STUB_GET_URL, { access_token = token.access_token }, {host = "oauth2.com"}) assert.are.equal(200, status) end) it("should work when a correct access_token is being sent in a form body", function() local token = provision_token() local _, status = http_client.post(STUB_POST_URL, { access_token = token.access_token }, {host = "oauth2.com"}) assert.are.equal(200, status) end) it("should work when a correct access_token is being sent in an authorization header (bearer)", function() local token = provision_token() local _, status = http_client.post(STUB_POST_URL, { }, {host = "oauth2.com", authorization = "bearer "..token.access_token}) assert.are.equal(200, status) end) it("should work when a correct access_token is being sent in an authorization header (token)", function() local token = provision_token() local response, status = http_client.post(STUB_POST_URL, { }, {host = "oauth2.com", authorization = "token "..token.access_token}) local body = cjson.decode(response) assert.are.equal(200, status) local consumer = dao_factory.consumers:find_by_keys({username = "auth_tests_consumer"})[1] assert.are.equal(consumer.id, body.headers["x-consumer-id"]) assert.are.equal(consumer.username, body.headers["x-consumer-username"]) assert.are.equal("userid123", body.headers["x-authenticated-userid"]) assert.are.equal("email", body.headers["x-authenticated-scope"]) end) it("should not work when a correct access_token is being sent in an authorization header (bearer)", function() local token = provision_token() local response, status = http_client.post(STUB_POST_URL, { }, {host = "oauth2.com", authorization = "bearer "..token.access_token.."hello"}) local body = cjson.decode(response) assert.are.equal(403, status) assert.are.equal("Invalid authentication credentials", body.message) end) end) describe("Refresh Token", function() it("should not refresh an invalid access token", function() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { refresh_token = "hello", client_id = "clientid123", client_secret = "secret123", grant_type = "refresh_token" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("Invalid refresh_token", body.error_description) end) it("should refresh an valid access token", function() local token = provision_token() local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { refresh_token = token.refresh_token, client_id = "clientid123", client_secret = "secret123", grant_type = "refresh_token" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equals(4, utils.table_size(body)) assert.truthy(body.refresh_token) assert.truthy(body.access_token) assert.are.equal("bearer", body.token_type) assert.are.equal(5, body.expires_in) end) it("should expire after 5 seconds", function() local token = provision_token() local _, status = http_client.post(STUB_POST_URL, { }, {host = "oauth2.com", authorization = "bearer "..token.access_token}) assert.are.equal(200, status) local id = dao_factory.oauth2_tokens:find_by_keys({access_token = token.access_token })[1].id assert.truthy(dao_factory.oauth2_tokens:find_by_primary_key({id=id})) -- But waiting after the cache expiration (5 seconds) should block the request os.execute("sleep "..tonumber(6)) local response, status = http_client.post(STUB_POST_URL, { }, {host = "oauth2.com", authorization = "bearer "..token.access_token}) local body = cjson.decode(response) assert.are.equal(400, status) assert.are.equal(2, utils.table_size(body)) assert.are.equal("invalid_request", body.error) assert.are.equal("access_token expired", body.error_description) -- Refreshing the token local response, status = http_client.post(PROXY_SSL_URL.."/oauth2/token", { refresh_token = token.refresh_token, client_id = "clientid123", client_secret = "secret123", grant_type = "refresh_token" }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equal(4, utils.table_size(body)) assert.truthy(body.refresh_token) assert.truthy(body.access_token) assert.are.equal("bearer", body.token_type) assert.are.equal(5, body.expires_in) assert.falsy(token.access_token == body.access_token) assert.falsy(token.refresh_token == body.refresh_token) assert.falsy(dao_factory.oauth2_tokens:find_by_primary_key({id=id})) end) end) describe("Hide Credentials", function() it("should not hide credentials in the body", function() local token = provision_token() local response, status = http_client.post(STUB_POST_URL, { access_token = token.access_token }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equal(token.access_token, body.postData.params.access_token) end) it("should hide credentials in the body", function() local token = provision_token() local response, status = http_client.post(STUB_POST_URL, { access_token = token.access_token }, {host = "oauth2_3.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.falsy(body.postData.params.access_token) end) it("should not hide credentials in the querystring", function() local token = provision_token() local response, status = http_client.get(STUB_GET_URL, { access_token = token.access_token }, {host = "oauth2.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equal(token.access_token, body.queryString.access_token) end) it("should hide credentials in the querystring", function() local token = provision_token() local response, status = http_client.get(STUB_GET_URL, { access_token = token.access_token }, {host = "oauth2_3.com"}) local body = cjson.decode(response) assert.are.equal(200, status) assert.falsy(body.queryString.access_token) end) it("should not hide credentials in the header", function() local token = provision_token() local response, status = http_client.get(STUB_GET_URL, {}, {host = "oauth2.com", authorization = "bearer "..token.access_token}) local body = cjson.decode(response) assert.are.equal(200, status) assert.are.equal("bearer "..token.access_token, body.headers.authorization) end) it("should hide credentials in the header", function() local token = provision_token() local response, status = http_client.get(STUB_GET_URL, {}, {host = "oauth2_3.com", authorization = "bearer "..token.access_token}) local body = cjson.decode(response) assert.are.equal(200, status) assert.falsy(body.headers.authorization) end) end) end)
-------------------- -- Sassilization -- By Sassafrass / Spacetech / LuaPineapple -------------------- ENT.Type = "anim" ENT.Base = "base_anim" ENT.Attackable = true ENT.Building = true ENT.Refundable = true ENT.AutomaticFrameAdvance = true function ValidBuilding( bldg ) return bldg and bldg:IsValid() and not bldg.Destroyed end function ENT:SetupDataTables() self:DTVar("Int", 0, "iEmpireID") self:DTVar("Int", 1, "iLevel") self:DTVar("Bool", 0, "bDestroyed") self:DTVar("Bool", 1, "bBuilt") -- Init to invalid empire ID (Do here b/c someone overrode ENT.Init and didn't call baseclass constructor! self.iEmpireIDLast = 0 self.empOwner = nil end function ENT:Think() if SERVER then if (self.Plummeted) then self:SetPos(self:GetPos() - Vector(0,0,2)) if self.Connected then for k,v in pairs(self.Connected) do if v:IsValid() then v:SetPos(v:GetPos() - Vector(0,0,2)) end end end end self:SV_Think( CurTime() ) end end function ENT:GetRandomPosInOBB() local mins, maxs = self:OBBMins(), self:OBBMaxs() return Vector( math.Rand( mins.x, maxs.x ), math.Rand( mins.y, maxs.y ), math.Rand( mins.z, maxs.z ) ) end -- Somewhat inelegant, but much more reliable and little overhead. function ENT:CheckForOwnershipChange() if self.dt.iEmpireID == self.iEmpireIDLast then return end self:_SetEmpireInternal( empire.GetByID(self.dt.iEmpireID), self.empOwner) end function ENT:OnOwnershipChanged( empOld, empNew ) end function ENT:SetEmpire(empNew) self:_SetEmpireInternal(empNew, self:GetEmpire()) end function ENT:GetEmpire() self:CheckForOwnershipChange() -- Make sure self.empOwner isn't stale return self.empOwner end function ENT:_SetEmpireInternal(empNew, empOld) if empOld == empNew then return end if empOld then empOld:GetBuildings()[self] = nil end if empNew then empNew:GetBuildings()[self] = self end local iEmpireID = 0 if empNew then iEmpireID = empNew:GetID() end self.dt.iEmpireID = iEmpireID self.iEmpireIDLast = iEmpireID self.empOwner = empNew self:OnOwnershipChanged( empOld, empNew ) end function ENT:IsDestroyed() return self.dt.bDestroyed end function ENT:IsBuilt() return self.dt.bBuilt and not self:IsDestroyed() end function ENT:GetLevel() return self.dt.iLevel end function ENT:IsUpgradeable() if( not self:IsBuilt() ) then return false end local Levels = building.GetBuildingKey(self:GetType(), "Levels") if(Levels) then if(#Levels > self:GetLevel()) then return true end end return false end
-- logic: first_run, setup module and _G {{{ local first_run = not _G.bfredl local bfredl = _G.bfredl or {} if not first_run then require'plenary.reload'.reload_module'bfredl.' end do local status, err = pcall(vim.cmd, [[ runtime! autoload/bfredl.vim ]]) if not status then vim.api.nvim_err_writeln(err) end end local function each(z) return (function (x) return x(x) end) (function (x) return function (y) z(y) return x(x) end end) end local h = bfredl -- TODO(bfredl):: _G.h should be shorthand for the _last_ edited/reloaded .lua module _G.h = bfredl -- }}} -- packages {{{ local packer = require'packer' packer.init {} packer.reset() do each (packer.use) 'norcalli/snippets.nvim' 'norcalli/nvim-colorizer.lua' 'vim-conf-live/pres.vim' --use 'norek/bbbork' 'nvim-treesitter/nvim-treesitter' 'nvim-treesitter/playground' 'neovim/nvim-lspconfig' 'jose-elias-alvarez/null-ls.nvim' {'nvim-telescope/telescope.nvim', requires = {'nvim-lua/popup.nvim', 'nvim-lua/plenary.nvim'}} -- TODO(packer): this should not be an error: -- 'nvim-lua/plenary.nvim' '~/dev/nvim-miniyank' '~/dev/nvim-bufmngr' '~/dev/nvim-luadev' '~/dev/ibus-chords' '~/dev/nvim-ipy' '~/dev/vim-argclinic' '~/dev/nsync.nvim/' { '~/dev/nvim-miniluv/', rocks = 'openssl' } 'mileszs/ack.vim' 'Lokaltog/vim-easymotion' 'justinmk/vim-sneak' 'tommcdo/vim-exchange' -- tpope section 'tpope/vim-repeat' 'tpope/vim-surround' 'tpope/vim-fugitive' 'airblade/vim-gitgutter' 'hotwatermorning/auto-git-diff' 'vim-scripts/a.vim' -- filetypes 'numirias/semshi' {'davidhalter/jedi-vim', ft = {'python'}} 'ziglang/zig.vim' 'JuliaEditorSupport/julia-vim' 'lervag/vimtex' -- them colors 'morhetz/gruvbox' 'eemed/sitruuna.vim' end vim.cmd [[ noremap ø :update<cr>:so $MYVIMRC<cr>:PackerUpdate<cr> ]] -- <Plug>ch:,r -- }}} -- utils and API shortcuts {{{ for k,v in pairs(require'bfredl.util') do h[k] = v end local a, buf, win, tabpage = h.a, h.buf, h.win, h.tabpage _G.a = a local v, set = vim.cmd, h.set -- }}} -- basic options {{{ 'hidden' 'title' 'number' 'smartcase' 'ignorecase' 'expandtab' 'sw' (2) 'ts' (2) 'sts' (2) 'linebreak' 'incsearch' 'mouse' "a" 'updatetime' (1666) 'foldmethod' "marker" 'nomodeline' 'splitbelow' 'notimeout' 'ttimeout' 'ttimeoutlen' (10) v 'set cpo-=_' v 'set diffopt+=vertical' if first_run then -- I liked this better: vim.o.dir = '.,'..vim.o.dir end -- }}} -- them basic bindings {{{ -- test v [[map <Plug>ch:mw <cmd>lua print("howdy")<cr>]] -- TODO(bfredl): reload all the filetypes when reloading bfred/init.lua v [[ augroup bfredlft au FileType lua noremap <buffer> <Plug>ch:,l <cmd>update<cr><cmd>luafile %<cr> augroup END ]] -- }}} -- vimenter stuff {{{ function h.vimenter(startup) if startup then require'colorizer'.setup() if a._fork_serve then _G.prepfork = true a._fork_serve() _G.postfork = true -- because reasons a._stupid_test() end end end -- }}} require'bfredl.snippets'.setup() -- LSP {{{ if not vim.g.bfredl_nolsp then local lspconfig = require'lspconfig' if vim.fn.executable('clangd') ~= 0 then lspconfig.clangd.setup {} end if vim.fn.executable('ra_lsp_server') ~= 0 then lspconfig.rust_analyzer.setup {} end if vim.fn.executable('zls') ~= 0 then -- lspconfig.zls.setup {} end require'null-ls'.config { sources = { require'null-ls'.builtins.diagnostics.zig_astcheck }; } if lspconfig['null-ls'].setup then lspconfig['null-ls'].setup {} end end -- }}} -- tree sitter stuff {{{ function h.ts_setup() h.did_ts = true require'nvim-treesitter.configs'.setup { --ensure_installed = "all", -- one of "all", "language", or a list of languages highlight = { enable = true; -- false will disable the whole extension }; incremental_selection = { enable = true; keymaps = { init_selection = "gnn"; node_incremental = "gxn"; scope_incremental = "grc"; node_decremental = "grm"; }; }; refactor = { highlight_definitions = { enable = true }; --highlight_current_scope = { enable = false }; }; playground = { enable = true; disable = {}; updatetime = 25, -- Debounced time for highlighting nodes in the playground from source cod; persist_queries = false; -- Whether the query persists across vim sessions }; } v [[ nmap <plug>ch:ht grn ]] end if true or h.did_ts then h.ts_setup() end -- }}} -- telescope {{{ require'telescope'.setup { defaults = { winblend = 20; border = false; }; } -- }}} -- color {{{ local colors = require'bfredl.colors' h.colors = colors if os.getenv'NVIM_INSTANCE' then colors.defaults() else v [[ hi EndOfBuffer guibg=#222222 guifg=#666666 ]] v [[ hi Folded guifg=#000000 ]] end function h.xcolor() local out = io.popen("xcolor"):read("*a") return vim.trim(out) end v 'inoremap <F3> <c-r>=v:lua.bfredl.init.xcolor()<cr>' -- }}} if os.getenv'NVIM_INSTANCE' then require'bfredl.miniline'.setup() end h.f = require'bfredl.floaty'.f _G.f = h.f -- HAIII -- autocmds {{{ v [[ augroup bfredlua augroup END ]] -- }}} if os.getenv'NVIM_INSTANCE' and not os.getenv'NVIM_DEV' then v [[ color sitruuna_bfredl ]] end v [[ hi MsgArea blend=15 guibg=#281811]] return bfredl
--Define Axinite_Pickaxe crafting recipe minetest.register_craft({ output = "axinitium:axinite_pickaxe", recipe = { {"axinitium:axinite_block", "axinitium:axinite_block", "axinitium:axinite_block", ""}, {"", "default:stick", "", ""}, {"", "default:stick", "", ""} } }) --Define Axinite Axe crafting recipe minetest.register_craft({ output = "axinitium:axinite_axe", recipe = { {"axinitium:axinite_block", "axinitium:axinite_block", "", ""}, {"axinitium:axinite_block", "default:stick", "", ""}, {"", "default:stick", "", ""} } }) --Define Axinite shovel crafting recipe minetest.register_craft({ output = "axinitium:axinite_shovel", recipe = { {"", "axinitium:axinite_block", "", ""}, {"", "default:stick", "", ""}, {"", "default:stick", "", ""} } }) --Define Axinite sword crafting recipe minetest.register_craft({ output = "axinitium:axinite_sword", recipe = { {"", "axinitium:axinite_block", "", ""}, {"", "axinitium:axinite_block", "", ""}, {"", "default:stick", "", ""} } }) --Define Axinite Block crafting recipe minetest.register_craft({ output = "axinitium:axinite_block", recipe = { {"axinitium:axinite_ore_ingot", "axinitium:axinite_ore_ingot", "axinitium:axinite_ore_ingot"}, {"axinitium:axinite_ore_ingot", "axinitium:axinite_ore_ingot", "axinitium:axinite_ore_ingot"}, {"axinitium:axinite_ore_ingot", "axinitium:axinite_ore_ingot", "axinitium:axinite_ore_ingot"} } }) minetest.register_craft({ type = "shapeless", output = 'axinitium:axinite_ore_ingot 9', recipe = {'axinitium:axinite_block'}, }) --Define Axinite_Ore Smelt Recipe minetest.register_craft({ type = "cooking", output = "axinitium:axinite_ore_ingot", recipe = "axinitium:axinite_ore", cooktime = 50, inventory_image = "axinite_ore.png", }) --Define Axinite wood crafting recipe minetest.register_craft({ output = "axinitium:wood 4", recipe = {{"axinitium:tree"}}, }) --Define Axinitium crystal seed crafting recipe minetest.register_craft({ output = "axinitium:axinitium_crystal_seed", recipe = { {'axinitium:axinite_block','axinitium:bucket_axinite','axinitium:axinite_block'}, {'axinitium:bucket_axinite','axinitium:axinite_block','axinitium:bucket_axinite'}, {'axinitium:axinite_block','axinitium:bucket_axinite','axinitium:axinite_block'}, } }) --Define crystaline_bell crafting recipe minetest.register_craft({ output = "axinitium:crystaline_bell", recipe = { {'magmatools:magma_crystal_block'}, {'default:glass'}, {'default:stick'}, } }) --Define Axinite bucket crafting recipe minetest.register_craft({ output = 'axinitium:bucket_empty 1', recipe = { {'axinitium:axinite_block', '', 'axinitium:axinite_block'}, {'', 'axinitium:axinite_block', ''}, } })