content
stringlengths
5
1.05M
local n1 = { name = "default:dirt_with_grass" } local n2 = { name = "air" } local n3 = { name = "stairs:stair_cobble" } local n4 = { name = "stairs:stair_cobble", param2 = 20 } local n5 = { name = "walls:cobble" } local n6 = { name = "default:dirt" } local n7 = { name = "stairs:stair_cobble", param2 = 1 } local n8 = { name = "default:cobble" } local n9 = { name = "stairs:stair_cobble", param2 = 3 } local n10 = { name = "stairs:stair_cobble", param2 = 23 } local n11 = { name = "default:coalblock" } local n12 = { name = "stairs:stair_cobble", param2 = 21 } local n13 = { name = "fire:permanent_flame" } local n14 = { name = "stairs:slab_cobble" } local n15 = { name = "stairs:stair_cobble", param2 = 2 } local n16 = { name = "stairs:stair_cobble", param2 = 22 } return { yslice_prob = {}, size = {y = 7, x = 3, z = 3}, data = { -- z=-2, y=-6 n1, n1, n1, -- z=-2, y=-5 n2, n3, n2, -- z=-2, y=-4 n2, n2, n2, -- z=-2, y=-3 n2, n4, n2, -- z=-2, y=-2 n2, n5, n2, -- z=-2, y=-1 n2, n3, n2, -- z=-2, y=0 n2, n2, n2, -- z=-1, y=-6 n1, n6, n1, -- z=-1, y=-5 n7, n8, n9, -- z=-1, y=-4 n2, n8, n2, -- z=-1, y=-3 n10, n11, n12, -- z=-1, y=-2 n5, n13, n5, -- z=-1, y=-1 n7, n2, n9, -- z=-1, y=0 n2, n14, n2, -- z=0, y=-6 n1, n1, n1, -- z=0, y=-5 n2, n15, n2, -- z=0, y=-4 n2, n2, n2, -- z=0, y=-3 n2, n16, n2, -- z=0, y=-2 n2, n5, n2, -- z=0, y=-1 n2, n15, n2, -- z=0, y=0 n2, n2, n2, } }
project "imgui" kind "StaticLib" language "C" targetdir ("bin/vendor/%{prj.name}") objdir ("bin-int/vendor/%{prj.name}") files { "imconfig.h", "imgui.h", "imgui_internal.h", "imstb_rectpack.h", "imstb_textedit.h", "imstb_truetype.h", "imgui.cpp", "imgui_demo.cpp", "imgui_draw.cpp", "imgui_tables.cpp", "imgui_tables.cpp", "imgui_widgets.cpp", "backends/imgui_impl_glfw.h", "backends/imgui_impl_glfw.cpp", "backends/imgui_impl_vulkan.cpp", "backends/imgui_impl_vulkan.h", "premake5.lua" } includedirs { "%{wks.location}/Extern/glfw/include", "%{VULKAN_SDK}/Include", "backends", "." } defines { } filter "configurations:Debug" runtime "Debug" symbols "on" filter "configurations:Release" runtime "Release" optimize "on"
return { ada = { name = "Ada", extensions = "a,ada,adb,ads" }, bash = { name = "Bash", extensions = "bash,sh", patterns = "configure" }, batch = { name = "Batch", extensions = "bat" }, coffeescript = { name = "CoffeeScript", extensions = "coffee" }, cpp = { name = "C++", extensions = "c,cpp,cxx,cc,h,hpp,hxx,hh" }, cmake = { name = "CMake", extensions = "cmake", patterns = "CMakeLists.txt" }, csharp = { name = "C#", extensions = "cs" }, css = { name = "CSS", extensions = "css" }, erlang = { name = "Erlang", extensions = "erl,hrl" }, fortran = { name = "Fortran", extensions = "f,for,ftn,f77,f90,f95,f03" }, go = { name = "Go", extensions = "go" }, html = { name = "HTML", extensions = "html" }, ini = { name = "INI", extensions = "ini" }, java = { name = "Java", extensions = "java" }, javascript = { name = "JavaScript", extensions = "js,json" }, less = { name = "Less", extensions = "less" }, lua = { name = "Lua", extensions = "lua,luadoc" }, makefile = { name = "Makefile", patterns = "Makefile" }, markdown = { name = "Markdown", extensions = "md" }, objective_c = { name = "Objective-C", extensions = "m,mm" }, pascal = { name = "Pascal", extensions = "pas" }, perl = { name = "Perl", extensions = "pl,pm" }, php = { name = "PHP", extensions = "php" }, python = { name = "Python", extensions = "py" }, rest = { name = "Rest", extensions = "rst" }, rhtml = { name = "Rails", extensions = "rhtml", patterns = "*.html.erb" }, ruby = { name = "Ruby", extensions = "rb,rbw" }, rust = { name = "Rust", extenstions = "rs" }, sass = { name = "Sass", extensions = "sass,scss" }, scala = { name = "Scala", extensions = "scala" }, sql = { name = "SQL", extensions = "sql" }, swift = { name = "Swift", extensions = "swift" }, tcl = { name = "Tcl", extensions = "tcl" }, vb = { name = "Visual Basic", extensions = "vb" }, vbscript = { name = "VBScript", extensions = "vbs,vbe" }, verilog = { name = "Verilog", extensions = "v,vh" }, vhdl = { name = "VHDL", extensions = "vhd,vhdl" }, wsf = { name = "Windows Script", extensions = "wsf,wsc" }, xml = { name = "XML", extensions = "xml" }, yaml = { name = "YAML", extensions = "yml,yaml" } }
-- test_file.lua -- -- Driver for SMTP dissector sample -- local PDURec = require'pdurecord' local SMTPDissector=require 'smtp' -- usage test_file <filename> if #arg ~= 1 then print("Usage : test_file datafile") return end -- a PDURecord, we will pump this with chunks from the binary file local pdu1 = PDURec.new("bgp", SMTPDissector.new() ) -- pump the PDU record using push_xx() -- it will call dissector:on_record() at the correct time local f = io.open(arg[1]) local payl = f:read( math.random(50) ) local cpos = 1 while payl do pdu1:push_chunk(cpos,payl) cpos = cpos + #payl payl = f:read( math.random(20) ) end
--[[ © 2020 TERRANOVA do not share, re-distribute or modify without permission of its author ([email protected]). --]] ix.command.Add("ViewData", { arguments = { ix.type.character }, OnRun = function(self, client, target) if (!hook.Run("CanPlayerViewData", client, target:GetPlayer())) then return "@cantViewData" end local faction = target:GetFaction() if(faction != FACTION_CITIZEN and faction != FACTION_MPF) then return "Can only view the data of citizens and units." end local data = target:GetData("record", {}) local cid = target:GetData("cid", 00000) netstream.Start(client, "ixViewData", target:GetPlayer(), cid, data) end; })
local History = require('opus.history') local UI = require('opus.ui') local Util = require('opus.util') local colors = _G.colors local os = _G.os local textutils = _G.textutils local term = _G.term local sandboxEnv = setmetatable(Util.shallowCopy(_ENV), { __index = _G }) sandboxEnv.exit = function() UI:quit() end sandboxEnv._echo = function( ... ) return { ... } end _G.requireInjector(sandboxEnv) UI:configure('Lua', ...) local command = '' local counter = 1 local history = History.load('usr/.lua_history', 25) local page = UI.Page { menuBar = UI.MenuBar { buttons = { { text = 'Local', event = 'local' }, { text = 'Global', event = 'global' }, { text = 'Device', event = 'device', name = 'Device' }, }, }, prompt = UI.TextEntry { y = 2, shadowText = 'enter command', accelerators = { enter = 'command_enter', up = 'history_back', down = 'history_forward', mouse_rightclick = 'clear_prompt', [ 'control-space' ] = 'autocomplete', }, }, tabs = UI.Tabs { y = 3, formatted = UI.Tab { title = 'Formatted', index = 1, grid = UI.ScrollingGrid { columns = { { heading = 'Key', key = 'name' }, { heading = 'Value', key = 'value' }, }, sortColumn = 'name', autospace = true, }, }, output = UI.Tab { title = 'Output', index = 2, backgroundColor = 'black', output = UI.Embedded { y = 2, maxScroll = 1000, backgroundColor = 'black', }, draw = function(self) self:write(1, 1, string.rep('\131', self.width), 'black', 'primary') self:drawChildren() end, }, }, } page.grid = page.tabs.formatted.grid page.output = page.tabs.output.output function page:setPrompt(value, focus) self.prompt:setValue(value) if value:sub(-1) == ')' then self.prompt:setPosition(#value - 1) else self.prompt:setPosition(#value) end self.prompt:draw() if focus then page:setFocus(self.prompt) end end function page:enable() UI.Page.enable(self) self:setFocus(self.prompt) end local function autocomplete(env, oLine, x) local sLine = oLine:sub(1, x) local nStartPos = sLine:find("[a-zA-Z0-9_%.]+$") if nStartPos then sLine = sLine:sub(nStartPos) end if #sLine > 0 then local results = textutils.complete(sLine, env) if #results == 1 then return Util.insertString(oLine, results[1], x + 1) elseif #results > 1 then local prefix = results[1] for n = 1, #results do local result = results[n] while #prefix > 0 do if result:find(prefix, 1, true) == 1 then break end prefix = prefix:sub(1, #prefix - 1) end end if #prefix > 0 then return Util.insertString(oLine, prefix, x + 1) end end end return oLine end function page:eventHandler(event) if event.type == 'global' then self:setPrompt('_G', true) self:executeStatement('_G') command = nil elseif event.type == 'local' then self:setPrompt('_ENV', true) self:executeStatement('_ENV') command = nil elseif event.type == 'tab_select' then self:setFocus(self.prompt) elseif event.type == 'show_output' then self.tabs:selectTab(self.tabs.output) elseif event.type == 'autocomplete' then local value = self.prompt.value or '' local sz = #value local pos = self.prompt.entry.pos self:setPrompt(autocomplete(sandboxEnv, value, self.prompt.entry.pos)) self.prompt:setPosition(pos + #(self.prompt.value or '') - sz) self.prompt:updateCursor() elseif event.type == 'device' then self:setPrompt('device', true) self:executeStatement('device') elseif event.type == 'history_back' then local value = history:back() if value then self:setPrompt(value) end elseif event.type == 'history_forward' then self:setPrompt(history:forward() or '') elseif event.type == 'clear_prompt' then self:setPrompt('') history:reset() elseif event.type == 'command_enter' then local s = tostring(self.prompt.value or '') if #s > 0 then self:executeStatement(s) else local t = { } for k = #history.entries, 1, -1 do table.insert(t, { name = #t + 1, value = history.entries[k], isHistory = true, pos = k, }) end history:reset() command = nil self.grid:setValues(t) self.grid:setIndex(1) self.grid:draw() end return true else return UI.Page.eventHandler(self, event) end return true end function page:setResult(result) local t = { } local function safeValue(v) if type(v) == 'string' or type(v) == 'number' then return v end return tostring(v) end if type(result) == 'table' then for k,v in pairs(result) do local entry = { name = safeValue(k), rawName = k, value = safeValue(v), rawValue = v, } if type(v) == 'table' then if Util.size(v) == 0 then entry.value = 'table: (empty)' else entry.value = tostring(v) end end table.insert(t, entry) end else table.insert(t, { name = type(result), value = tostring(result), rawValue = result, }) end self.grid:setValues(t) self.grid:setIndex(1) self.grid:draw() end function page.grid:eventHandler(event) local entry = self:getSelected() local function commandAppend() if entry.isHistory then --history.setPosition(entry.pos) return entry.value end if type(entry.rawValue) == 'function' then if command then return command .. '.' .. entry.name .. '()' end return entry.name .. '()' end if command then if type(entry.rawName) == 'number' then return command .. '[' .. entry.name .. ']' end if entry.name:match("%W") or entry.name:sub(1, 1):match("%d") then return command .. "['" .. tostring(entry.name) .. "']" end return command .. '.' .. entry.name end return entry.name end if event.type == 'grid_focus_row' then if self.focused then page:setPrompt(commandAppend()) end elseif event.type == 'grid_select' then page:setPrompt(commandAppend(), true) page:executeStatement(commandAppend()) elseif event.type == 'copy' then if entry then os.queueEvent('clipboard_copy', entry.rawValue) end else return UI.ScrollingGrid.eventHandler(self, event) end return true end function page:rawExecute(s) local fn, m local wrapped fn = load('return (' ..s.. ')', 'lua', nil, sandboxEnv) if fn then fn = load('return {' ..s.. '}', 'lua', nil, sandboxEnv) wrapped = true end local t = os.clock() if fn then fn, m = pcall(fn) if #m <= 1 and wrapped then m = m[1] end else fn, m = load(s, 'lua', nil, sandboxEnv) if fn then t = os.clock() fn, m = pcall(fn) end end if fn then t = os.clock() - t local bg, fg = term.getBackgroundColor(), term.getTextColor() term.setTextColor(colors.cyan) term.setBackgroundColor(colors.black) term.write(string.format('out [%.2f]: ', t)) term.setBackgroundColor(bg) term.setTextColor(fg) if m or wrapped then Util.print(m or 'nil') else print() end else _G.printError(m) end return fn, m end function page:executeStatement(statement) command = statement history:add(statement) history:back() local s, m local oterm = term.redirect(self.output.win) self.output.win.scrollBottom() local bg, fg = term.getBackgroundColor(), term.getTextColor() term.setBackgroundColor(colors.black) term.setTextColor(colors.green) term.write(string.format('in [%d]: ', counter)) term.setBackgroundColor(bg) term.setTextColor(fg) print(tostring(statement)) pcall(function() s, m = self:rawExecute(command) end) term.redirect(oterm) counter = counter + 1 if s and type(m) ~= "nil" then self:setResult(m) else self.grid:setValues({ }) self.grid:draw() if m and not self.output.enabled then self:emit({ type = 'show_output' }) end end end local args = Util.parse(...) if args[1] then command = 'args[1]' sandboxEnv.args = args page:setResult(args[1]) page:setPrompt(command) end UI:setPage(page) UI:start()
local mat3 = {} function mat3.identity() return {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0} end function mat3.zero() return {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0} end function mat3.transpose(m) return {m[1], m[4], m[7], m[2], m[5], m[8], m[3], m[6], m[9]} end function mat3.mul(a, b) local m = mat3.zero() for c = 1, 3 do for r = 1, 3 do for k = 1, 3 do m[3 * c + r - 3] = m[3 * c + r - 3] + (a[3 * k + r - 3] * b[3 * c + k - 3]) end end end return m end return mat3
game.Players.LocalPlayer.playerstats.Hunger.Value = 100000 wait (0.1) game.Players.LocalPlayer.playerstats.Thirst.Value = 100000
local present, gitsigns = pcall(require, "gitsigns") if not present then return end gitsigns.setup { signs = { add = {hl = "GitSignsAdd", text = " ", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn"}, change = {hl = "GitSignsChange", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn"}, delete = {hl = "GitSignsDelete", text = " ", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn"}, topdelete = {hl = "GitSignsDelete", text = " ", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn"}, changedelete = { hl = "GitSignsChangeDelete", text = "▎", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" } }, numhl = false, keymaps = { -- Default keymap options noremap = true, buffer = true, ["n ]c"] = {expr = true, '&diff ? \']c\' : \'<cmd>lua require"gitsigns".next_hunk()<CR>\''}, ["n [c"] = {expr = true, '&diff ? \'[c\' : \'<cmd>lua require"gitsigns".prev_hunk()<CR>\''}, ["n <leader>hs"] = '<cmd>lua require"gitsigns".stage_hunk()<CR>', ["n <leader>hu"] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>', ["n <leader>hr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>', ["n <leader>hp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>', ["n <leader>hb"] = '<cmd>lua require"gitsigns".blame_line()<CR>' }, watch_index = { interval = 100 }, sign_priority = 5, status_formatter = nil -- Use default }
mp = mp or {} PLAYER = FindMetaTable("Player") gpay.c = gpay.c or {} require 'nw' require 'pon' gpay.Msg = function(...) MsgC(Color(200,162,200),"[MP Donate] ",Color(255,255,255),...,"\n") end gpay.DebugMsg = function(...) if not gpay.c.debug then return end MsgC(Color(255,50,50),"(DEBUG) ",Color(200,162,200),"[MP Donate] ",Color(255,255,255),...,"\n") end gpay.isv = (SERVER) and include or function() end gpay.icl = (SERVER) and AddCSLuaFile or include gpay.ish = function(f) return gpay.icl(f) or gpay.isv(f) end gpay.AddFile = function(f) if string.find(f, '_sv.lua') then return gpay.isv(f) elseif string.find(f, '_cl.lua') then return gpay.icl(f) else return gpay.ish(f) end end gpay.AddDir = function(dir, recursive) local fol = dir .. '/' local files, folders = file.Find(fol .. '*', 'LUA') for _, f in ipairs(files) do gpay.AddFile(fol .. f) end if (recursive ~= false) then for _, f in ipairs(folders) do gpay.AddDir(dir .. '/' .. f) end end end gpay.AddDir('utils',false) gpay.AddFile('mdonate/ui/ns.lua') gpay.AddFile('config_sv.lua') gpay.AddFile('lang.lua') gpay.AddDir('mdonate/providers',false) -- Провайдеры данных, крч я понял всю истерику по поводу MySQL, оставил только его... gpay.AddDir('mdonate/classes',false) -- Тут тупа классы gpay.AddDir('mdonate/managment',false) -- чтоб можно было прикрутить любую админку gpay.AddDir('mdonate/interpreter',false) -- обработчик gpay.AddFile('mdonate/vars.lua') -- Вары, удобно и быстро так сказать) gpay.AddDir('mdonate',false) gpay.AddFile('config.lua') gpay.AddDir('mdonate/ui') -- Визуал, думаю самое парашное из всего что существует тут gpay.AddDir('mdonate/saver') gpay.AddDir('mdonate/hats') -- Думаю тут и так все понятно
local lu = require("luaunit") local Vector = require("lib.vector") TestVector = {} function TestVector:test_to_string() lu.assertEquals(Vector:new{ x = 1, y = 2 }:to_string(), "{x = 1, y = 2}") end function TestVector:test_line_points_vertical() local origin = Vector:new{ x = 5, y = 2 } local termination = Vector:new{ x = 5, y = 0 } local line_points = origin:line_points(termination) lu.assertEquals(#line_points, 3) lu.assertEquals(line_points[1], { x = 5, y = 2 }) lu.assertEquals(line_points[2], { x = 5, y = 1 }) lu.assertEquals(line_points[3], { x = 5, y = 0 }) end function TestVector:test_line_points_diagonal() local origin = Vector:new{ x = 0, y = 3 } local termination = Vector:new{ x = 4, y = -1 } local line_points = origin:line_points(termination) lu.assertEquals(#line_points, 5) lu.assertEquals(line_points[1], { x = 0, y = 3 }) lu.assertEquals(line_points[2], { x = 1, y = 2 }) lu.assertEquals(line_points[3], { x = 2, y = 1 }) lu.assertEquals(line_points[4], { x = 3, y = 0 }) lu.assertEquals(line_points[5], { x = 4, y = -1 }) end function TestVector:test_add() local a = Vector:new{ x = 5, y = -8 } local b = Vector:new{ x = -15, y = 20 } a:add(b) lu.assertEquals(a.x, -10) lu.assertEquals(a.y, 12) lu.assertEquals(b.x, -15) lu.assertEquals(b.y, 20) end function TestVector:test_add3d() local a = Vector:new{ x = 5, y = -8, z = 10 } local b = Vector:new{ x = -15, y = 20, z = -19 } a:add(b) lu.assertEquals(a.x, -10) lu.assertEquals(a.y, 12) lu.assertEquals(a.z, -9) lu.assertEquals(b.x, -15) lu.assertEquals(b.y, 20) lu.assertEquals(b.z, -19) end function TestVector:test_distance() local a = Vector:new{ x = 5, y = -8, z = 35 } local b = Vector:new{ x = -15, y = 20, z = 105 } lu.assertEquals(a:distance(b), 118) end
-- Project: LOOP Class Library -- Release: 2.3 beta -- Title : Reachable Values Crawler -- Author : Renato Maia <[email protected]> local _G = require "_G" local getfenv = _G.getfenv local getmetatable = _G.getmetatable local pairs = _G.pairs local select = _G.select local type = _G.type local package = require "package" local debug = package.loaded.debug -- only if available local coroutine = require "coroutine" local running = coroutine.running local math = require "math" local huge = math.huge local oo = require "loop.base" local class = oo.class local Crawler = class{ metatable = getmetatable, environment = debug and debug.getfenv, upvalue = debug and debug.getupvalue, registry = debug and debug.getregistry, callstack = debug and debug.getinfo, localvar = debug and debug.getlocal, } function Crawler:crawlmetatable(value) local getmetatable = self.metatable if getmetatable then local meta = getmetatable(value) if meta ~= nil then self:found(meta, value, "metatable") end end end function Crawler:crawlenvironment(value) local getenv = self.environment if getenv then local env = getenv(value) if env ~= nil then self:found(env, value, "environment") end end end function Crawler:crawltable(value) for key, entry in pairs(value) do self:found(key, value, "key", entry) self:found(entry, value, "entry", key) end self:crawlmetatable(value) end function Crawler:crawlfunction(value) local getupvalue = self.upvalue if getupvalue then for i = 1, huge do local upname, upvalue = getupvalue(value, i) if upname == nil then break end self:found(upname, value, "upname", upvalue, i) self:found(upvalue, value, "upvalue", upname, i) end end self:crawlenvironment(value) end function Crawler:crawluserdata(value) self:crawlenvironment(value) self:crawlmetatable(value) end function Crawler:crawlthread(value) local getinfo = self.callstack if getinfo then local ignored = 0 if value == self.mythread then repeat ignored = ignored+1 local stack if value == nil then stack = getinfo(ignored, "f") else stack = getinfo(value, ignored, "f") end until stack.func == self.crawl end local getlocal = self.localvar for lvl = ignored+1, huge do local stack if value == nil then stack = getinfo(lvl, "nSf") else stack = getinfo(value, lvl, "nSf") end if stack == nil then break end self:found(stack.func , value, "callfunc" , stack, lvl) self:found(stack.name , value, "callfuncname" , stack, lvl) self:found(stack.namewhat , value, "callfuncnamewhat", stack, lvl) self:found(stack.source , value, "callfuncsource" , stack, lvl) self:found(stack.short_src, value, "callfuncsrc" , stack, lvl) self:found(stack.what , value, "callfuncwhat" , stack, lvl) if getlocal then for loc = 0, huge do local locname, locvalue if value == nil then locname, locvalue = getlocal(lvl, loc) else locname, locvalue = getlocal(value, lvl, loc) end if locname == nil then break end self:found(locname, value, "locname", locvalue, loc, lvl) self:found(locvalue, value, "local", locname, loc, lvl) end end end end if value ~= nil then self:crawlenvironment(value) elseif self.environment then self:found(getfenv(0), value, "environment") end end Crawler["table"] = Crawler.crawltable Crawler["function"] = Crawler.crawlfunction Crawler["userdata"] = Crawler.crawluserdata Crawler["thread"] = Crawler.crawlthread Crawler.input = 0 function Crawler:add(value) local i = self.input+1 self[i] = value self.input = i end function Crawler:remove() local i = self.input local value = self[i] self[i] = nil self.input = i-1 return value end function Crawler:empty() return self.input == 0 end Crawler.output = 1 local function dequeue(self) local i = self.output local value = self[i] self[i] = nil self.output = i+1 return value end local function emptyqueue(self) return self.input < self.output end function Crawler:found(value, ...) local visited = self.visited local regval = visited[value] local ignore = (regval ~= nil) local valtype = type(value) local visitor = self["found"..valtype] or self["foundvalue"] if visitor then if regval == nil and value ~= nil then visited[value] = true end local new, cancel = visitor(self, value, regval, ...) if cancel ~= nil then ignore = cancel end if new ~= nil and value ~= nil then visited[value] = new end elseif value ~= nil then visited[value] = true end if not ignore and self[valtype] then self:add(value) end end function Crawler:crawl(...) -- define default objects that must be ignored during the crawling local visited = self.visited if visited == nil then visited = {} self.visited = visited end visited[visited] = true visited[self] = true -- register current thread so it knows how to ignore this call self.mythread = running() -- change the way the crawling goes, if requested if self.broadsearch then self.remove = dequeue self.empty = emptyqueue end -- define roots of the crawling local count = select("#", ...) if count > 0 then for i = 1, select("#", ...) do self:found(select(i, ...), nil, "root", i) end else self:crawlthread() -- crawl the main thread local getregistry = self.registry if getregistry then self:found(getregistry(), nil, "registry") end end -- do the crawling while not self:empty() do local value = self:remove() local crawler = self[type(value)] if crawler then crawler(self, value) end end end return Crawler
TOOL.Name = "Assimp" TOOL.Directory = "../plugins/Assimp" TOOL.Kind = "Plugin" TOOL.Includes = { "../include", "../plugins/Assimp" } TOOL.ExtIncludes = { "../thirdparty/include" } TOOL.Files = { "../plugins/Assimp/**.hpp", "../plugins/Assimp/**.inl", "../plugins/Assimp/**.cpp" } TOOL.Libraries = { "NazaraCore", "NazaraUtility", "assimp" }
local util = require 'lusty.util' local methods = {} return { handler = function(context) local methodName = string.lower(context.method) local method = methods[methodName] if not method then method = util.inline('lusty-store-mysql.store.mysql.'..methodName, {channel = channel, config = config}).handler methods[methodName] = method end return method(context) end }
local t = Def.Sprite { Texture=NOTESKIN:GetPath( '_Index', 'roll body active' ); Frame0000=0; Delay0000=0.44; Frame0001=1; Delay0001=0.03; Frame0002=2; Delay0002=0.03; Frame0003=3; Delay0003=0.44; Frame0004=2; Delay0004=0.03; Frame0005=1; Delay0005=0.03; }; return t;
fx = { style = "STYLE_BEAM", properties = { property_16 = { name = "LineDistance", type = "VARTYPE_FLOAT", value = 1750, }, property_15 = { name = "WidthEpsilon", type = "VARTYPE_FLOAT", value = 0, }, property_09 = { name = "Texture_U_Offset", type = "VARTYPE_ARRAY_TIMEFLOAT", value = { 0, 0, 1, 6, }, }, property_04 = { name = "SelfIlluminated", type = "VARTYPE_BOOL", value = 1, }, property_03 = { name = "Texture", type = "VARTYPE_STRING", value = "DATA:ART/FX/LIGHTRULER/LIGHTRULER.TGA", }, property_06 = { name = "Length", type = "VARTYPE_ARRAY_TIMEFLOAT", value = { 0, 1, 1, 1, }, }, property_05 = { name = "Offset", type = "VARTYPE_ARRAY_TIMEVECTOR3", value = { entry_00 = { 0, 0, 0, 0, }, entry_01 = { 1, 0, 0, 0, }, }, }, property_08 = { name = "Segments", type = "VARTYPE_ARRAY_TIMEFLOAT", value = { 0, 1, 1, 10, }, }, property_07 = { name = "Noise", type = "VARTYPE_ARRAY_TIMEFLOAT", value = { 0, 0, 1, 0, }, }, property_02 = { name = "Blending", type = "VARTYPE_INT", value = 4, }, property_01 = { name = "Loop", type = "VARTYPE_BOOL", value = 0, }, property_13 = { name = "Arc", type = "VARTYPE_ARRAY_TIMEVECTOR3", value = { entry_00 = { 0, 0, 0, 0, }, entry_01 = { 1, 0, 0, 0, }, }, }, property_14 = { name = "LengthEpsilon", type = "VARTYPE_FLOAT", value = 0, }, property_11 = { name = "Width", type = "VARTYPE_ARRAY_TIMEFLOAT", value = { 0, 0, 0.01375, 0.80000, 0.07375, 1, 0.08625, 3.26667, 0.09875, 1.86667, 0.10750, 3.40000, 0.12625, 4.33333, 0.15250, 2.20000, 0.85750, 2.53333, 0.97625, 1.26667, 1, 0, }, }, property_12 = { name = "Colour", type = "VARTYPE_ARRAY_TIMECOLOUR", value = { entry_02 = { 1, 0, 0, 0, 1, }, entry_00 = { 0, 0, 0, 0, 1, }, entry_01 = { 0.02537, 1, 1, 1, 1, }, }, }, property_00 = { name = "Duration", type = "VARTYPE_FLOAT", value = 0.45000, }, property_10 = { name = "Texture_U_Repeat", type = "VARTYPE_ARRAY_TIMEFLOAT", value = { 0, 10, 1, 10, }, }, }, }
local Packages = script.Parent.Parent.Parent.Packages local Roact = require(Packages.Roact) local StudioTheme = require(Packages.StudioTheme) local Hooks = require(Packages.Hooks) local e = Roact.createElement export type ListLayoutProps = { gap: number?, direction: Enum.FillDirection?, alignX: Enum.HorizontalAlignment?, alignY: Enum.VerticalAlignment?, order: Enum.SortOrder?, onSizeChanged: ((UIListLayout) -> ())?, } local function ListLayout(props: ListLayoutProps, hooks) local _, styles = StudioTheme.useTheme(hooks) return e("UIListLayout", { Padding = UDim.new(0, props.gap or styles.spacing), FillDirection = props.direction, HorizontalAlignment = props.alignX, SortOrder = props.order, VerticalAlignment = props.alignY, [Roact.Change.AbsoluteContentSize] = props.onSizeChanged, }) end return Hooks.new(Roact)(ListLayout, { defaultProps = { direction = Enum.FillDirection.Horizontal, order = Enum.SortOrder.LayoutOrder, alignX = Enum.HorizontalAlignment.Left, alignY = Enum.VerticalAlignment.Top, }, })
-- See LICENSE for terms local ChoOrig_SupplyPod_Shutdown = SupplyPod.Shutdown function SupplyPod:Shutdown(...) CreateGameTimeThread(function() self:ToggleDemolish() end) return ChoOrig_SupplyPod_Shutdown(self, ...) end
local api = vim.api local lsp = vim.lsp local log = require("metals.log") local has_plenary, Float = pcall(require, "plenary.window.float") if not has_plenary then log.warn_and_show("Some features won't work without plenary installed. Please install nvim-lua/plenary.nvim") end --- Module meant to control the Metals doctor. --- It doesn't do a whole lot except create the doctor, and only --- make sure there is one open at one time. local Doctor = {} --- Last win_id of the open doctor, if any. local doctor_win_id = nil --- Determine if the doctor is open by checking whether the doctor_win_id is -- set and it's a valid win_id. ---@return boolean Doctor.is_open = function() if doctor_win_id and api.nvim_win_is_valid(doctor_win_id) then return true else return false end end --- Close doctor. Pretty much only used if the doctor --- is open and the reload doctor command comes in. Doctor.close = function() api.nvim_win_close(doctor_win_id, true) end --- Create the Doctor. -- @param args table of the args give by `metals/executeClientCommand` Doctor.create = function(args) local header_text = lsp.util.convert_input_to_markdown_lines({ args.headerText }) local output = header_text table.insert(output, "") if args.messages then for _, message in ipairs(args.messages) do table.insert(output, string.format("## %s", message.title)) table.insert(output, "") for _, recommendation in ipairs(message.recommendations) do table.insert(output, string.format(" - %s", recommendation)) end end else table.insert(output, "## Build Targets") if args.version then for _, target in ipairs(args.targets) do table.insert(output, "") table.insert(output, string.format("### %s", target.buildTarget)) table.insert(output, string.format(" - target type: %s", target.targetType)) table.insert(output, string.format(" - diagnostics: %s", target.diagnostics)) table.insert(output, string.format(" - interactive: %s", target.interactive)) table.insert(output, string.format(" - semanticdb: %s", target.semanticdb)) table.insert(output, string.format(" - debugging: %s", target.debugging)) table.insert(output, string.format(" - java: %s", target.java)) if target.recommendation ~= "" then table.insert(output, string.format(" - recommendation: %s", target.recommendation)) end end table.insert(output, "") table.insert(output, "## Explanations") for _, explanation in ipairs(args.explanations) do table.insert(output, "") table.insert(output, string.format("### %s", explanation.title)) for _, deep_explanation in ipairs(explanation.explanations) do table.insert(output, string.format("%s", deep_explanation)) end end else for _, target in ipairs(args.targets) do table.insert(output, "") table.insert(output, string.format("### %s", target.buildTarget)) table.insert(output, string.format(" - scala version: %s", target.scalaVersion)) table.insert(output, string.format(" - diagnostics: %s", target.diagnostics)) table.insert(output, string.format(" - goto definition: %s", target.gotoDefinition)) table.insert(output, string.format(" - completions: %s", target.completions)) table.insert(output, string.format(" - find references: %s", target.findReferences)) if target.recommendation ~= "" then table.insert(output, string.format(" - recommendation: %s", target.recommendation)) end end end end local float = Float.percentage_range_window(0.6, 0.4, { winblend = 0 }, { title = args.title, titlehighlight = "MetalsTitle", topleft = "┌", topright = "┐", top = "─", left = "│", right = "│", botleft = "└", botright = "┘", bot = "─", }) -- It's seemingly impossibly to get the hl to work for me with Float, so we -- just manually set them here. api.nvim_win_set_option(float.win_id, "winhl", "NormalFloat:Normal") api.nvim_win_set_option(float.border_win_id, "winhl", "NormalFloat:Normal") api.nvim_buf_set_option(float.bufnr, "filetype", "markdown") api.nvim_buf_set_lines(float.bufnr, 0, -1, false, output) doctor_win_id = float.win_id end return Doctor
--DEPENDENCIES --pamixer local wibox = require('wibox') local gears = require('gears') local awful = require('awful') local beautiful = require('beautiful') local spawn = awful.spawn local dpi = beautiful.xresources.apply_dpi local icons = require('widget.control-center.volume-slider.icons') local clickable_container = require('widget.clickable-container') local colors = require('themes.dracula.colors') local watch = require('awful.widget.watch') local main_color = colors.yellow local widget_name = wibox.widget { text = 'Volume', font = 'Inter Bold 10', align = 'left', widget = wibox.widget.textbox } local widget_icon = wibox.widget { layout = wibox.layout.align.vertical, expand = 'none', nil, { id = 'icon', image = icons.volume, resize = true, widget = wibox.widget.imagebox }, nil } local widget_content = wibox.widget { { { widget_icon, margins = dpi(5), widget = wibox.container.margin }, widget = clickable_container, }, bg = beautiful.groups_bg, shape = function(cr, width, height) gears.shape.rounded_rect(cr, width, height, beautiful.groups_radius) end, widget = wibox.container.background } local slider = wibox.widget { nil, { id = 'volume_slider', bar_shape = gears.shape.rounded_rect, bar_height = dpi(24), bar_color = colors.selection, bar_active_color = main_color, handle_color = main_color, handle_shape = gears.shape.circle, handle_width = dpi(24), maximum = 100, widget = wibox.widget.slider }, nil, expand = 'none', forced_height = dpi(24), layout = wibox.layout.align.vertical } local volume_slider = slider.volume_slider volume_slider:connect_signal( 'property::value', function() local volume_level = volume_slider:get_value() spawn('pamixer --set-volume ' .. volume_level, false ) end ) volume_slider:buttons( gears.table.join( awful.button( {}, 4, nil, function() if volume_slider:get_value() > 100 then volume_slider:set_value(100) return end volume_slider:set_value(volume_slider:get_value() + 5) end ), awful.button( {}, 5, nil, function() if volume_slider:get_value() < 0 then volume_slider:set_value(0) return end volume_slider:set_value(volume_slider:get_value() - 5) end ) ) ) local update_slider = function() awful.spawn.easy_async_with_shell( [[bash -c "pamixer --get-volume"]], function(stdout) local volume = stdout volume_slider:set_value(tonumber(volume)) end ) end local update_slider_mute = function() awful.spawn.easy_async_with_shell( [[bash -c "pamixer --get-mute"]], function(stdout) local status = string.match(stdout, '%a+') if status == 'true' then widget_icon.icon:set_image(icons.mute) elseif status == "false" then widget_icon.icon:set_image(icons.volume) end end ) end watch ( [[bash -c "pamixer --get-mute"]], 2, function(_, stdout) local status = string.match(stdout, '%a+') if status == 'true' then widget_icon.icon:set_image(icons.mute) elseif status == "false" then widget_icon.icon:set_image(icons.volume) end collectgarbage('collect') end ) -- Update on startup update_slider() local mute_toggle = function() awful.spawn.easy_async_with_shell( [[bash -c "pamixer --get-mute"]], function(stdout) local status = string.match(stdout, '%a+') if status == 'true' then spawn('pamixer -u') widget_icon.icon:set_image(icons.volume) elseif status == "false" then spawn('pamixer -m') widget_icon.icon:set_image(icons.mute) end end ) end widget_content:buttons( awful.util.table.join( awful.button( {}, 1, nil, function() mute_toggle() end ) ) ) -- The emit will come from the global keybind awesome.connect_signal( 'widget::volume', function() update_slider() update_slider_mute() end ) local cc_volume = wibox.widget { { { layout = wibox.layout.fixed.vertical, forced_height = dpi(48), spacing = dpi(5), widget_name, { layout = wibox.layout.fixed.horizontal, spacing = dpi(5), { layout = wibox.layout.align.vertical, expand = 'none', nil, { layout = wibox.layout.fixed.horizontal, forced_height = dpi(24), forced_width = dpi(24), widget_content }, nil }, slider }, }, margins = dpi(15), widget = wibox.container.margin }, shape = gears.shape.rounded_rect, bg = colors.background, fg = main_color, widget = wibox.container.background } return cc_volume
local crypt = require'crypt' local password = 'password' local tests = { { method = 'md5'}, { method = 'md5', salt = 'aaaaaaaa'}, { method = 'blowfish', salt = '10$aaaaaaaaaaaaaaaaaaaaaa' }, { method = 'sha' }, { method = 'ssha'}, { method = 'ssha', salt = 'aaaaaaaa'}, { method = 'apr1'}, { method = 'apr1', salt = 'aaaaaaaa'}, { method = 'sha256'}, { method = 'sha256', salt = 'aaaaaaaaaaaaaaaa'}, { method = 'sha512'}, { method = 'sha512', salt = 'aaaaaaaa'}, } for _,v in ipairs(tests) do local hash, err = crypt.encrypt(v.method,password,v.salt) if err then print(err) os.exit(1) else v.hash = hash end if not v.salt then v.salt = '' end print(v.method .. '(' .. password .. ',' .. v.salt .. '): ' .. hash .. '\n') end for _,h in ipairs(tests) do if h.hash then local res = crypt.check(password,h.hash) local res_string = res and 'true' or 'false' print('crypt.check('..password..','..h.hash..') = ' .. res_string) if not res then os.exit(1) end end end
local function run_input_label(wnd, v) if (not valid_vid(wnd.external, TYPE_FRAMESERVER)) then return; end local iotbl = { kind = "digital", label = v.label, translated = true, active = true, devid = 8, subid = 8 }; wnd:input_table(iotbl); iotbl.active = false; wnd:input_table(iotbl); end local function build_labelmenu() local wnd = active_display().selected; if (not wnd or not wnd.input_labels or #wnd.input_labels == 0) then return; end local res = {}; for k,v in ipairs(wnd.input_labels) do table.insert(res, { name = "input_" .. v.label, label = string.format("%s%s", v.label, #v.symbol > 0 and "(" .. v.symbol .. ")" or ""), description = string.format("%s - %s", v.label, v.description), kind = "action", handler = function() run_input_label(wnd, v); end }); end return res; end local function build_unbindmenu() local res = {}; local wnd = active_display().selected; for k,v in pairs(wnd.labels) do table.insert(res, { name = "input_" .. v, label = k .. "=>" .. v, kind = "action", handler = function() wnd.labels[k] = nil; end }); end return res; end local kbd_menu = { { name = "utf8", kind = "action", label = "Bind UTF-8", description = "Add a window-local keyboard key to unicode codepoint binding", eval = function(ctx) local sel = active_display().selected; return (sel and sel.u8_translation) and true or false; end, handler = function() suppl_bind_u8(function(sym, str, sym2) local wnd = active_display().selected; wnd.u8_translation[sym2 and sym2 or sym] = str; SYMTABLE:translation_overlay(wnd.u8_translation); end); end }, { name = "repeat", label = "Repeat Period", kind = "value", description = "Set window-local rate for how fast keyboard inputs should repeat", initial = function() local rate, delay = iostatem_repeat(); return rate; end, hint = "cps (0:disabled - 100)", validator = gen_valid_num(0, 100); handler = function(ctx, num) iostatem_repeat(tonumber(num)); end }, { name = "delay", label = "Initial Delay", description = "Set window-local delay before keyboard input repeats", kind = "value", initial = function() local rate, delay = iostatem_repeat(); return delay * (1000 / CLOCKRATE); end, hint = "ms (0:disable - 1000)", handler = function(ctx, num) iostatem_repeat(nil, tonumber(num)); end } }; local function mouse_lockfun(rx, ry, x, y, wnd, ind, act) -- simulate the normal mouse motion in the case of constrained input if not wnd or not wnd.mousebutton then mouse_lockto(nil, nil); return; end if (ind) then wnd:mousebutton(ind, act, x, y); else wnd:mousemotion(x, y, rx, ry); end end local mouse_menu = { { name = "lock", label = "Lock", kind = "value", description = "Lock mouse input to this window", set = {"Disabled", "Constrain", "Center"}, initial = function() local wnd = active_display().selected; return wnd.mouse_lock and wnd.mouse_lock or "Disabled"; end, handler = function(ctx, val) local wnd = active_display().selected; if (val == "Disabled") then wnd.mouse_lock = nil; wnd.mouse_lock_center = false; mouse_lockto(nil, nil); else wnd.mouse_lock = mouse_lockfun; wnd.mouse_lock_center = val == "Center"; mouse_lockto(wnd.canvas, mouse_lockfun, wnd.mouse_lock_center, wnd); end end }, { name = "cursor", label = "Cursor", kind = "value", description = "Control whether the global cursor should be visible or not", set = {"default", "hidden"}, initial = function() local wnd = active_display().selected; return wnd.cursor == "hidden" and "hidden" or "default"; end, handler = function(ctx, val) if (val == "hidden") then mouse_hide(); else mouse_show(); end active_display().selected.cursor = val; end }, { name = "rlimit", label = "Rate Limit", description = "Limit the rate of mouse events being forwarded", kind = "value", set = {LBL_YES, LBL_NO, LBL_FLIP}, initial = function() return active_display().selected.rate_unlimited and LBL_NO or LBL_YES; end, handler = function(ctx, val) local wnd = active_display().selected; if (val == LBL_FLIP) then val = not wnd.rate_unlimited; else val = val == LBL_YES; end wnd.rate_unlimited = val; end }, }; return { { name = "labels", label = "Labels", kind = "action", submenu = true, description = "Custom client-provided inputs", eval = function(ctx) local sel = active_display().selected; return sel and sel.input_labels and #sel.input_labels > 0; end, handler = build_labelmenu }, { name = "custom", label = "Bind Custom", kind = "action", description = "Create a custom/local meta+key menu path binding", handler = function() local m1, m2 = dispatch_meta(); suppl_binding_helper("", "", function(bind, path) active_display().selected.bindings[bind] = path; end); end }, { name = "unbind", label = "Unbind", kind = "value", description = "Remove a custom/local binding", eval = function() for k,v in pairs(active_display().selected.bindings) do return true; end return false; end, set = function() local wnd = active_display().selected; local lst = {}; for k,v in pairs(active_display().selected.bindings) do table.insert(lst, k); end table.sort(lst); return lst; end, handler = function(ctx, val) active_display().selected.bindings[val] = nil; end }, { name = "keyboard", label = "Keyboard", kind = "action", description = "Local keyboard settings", submenu = true, handler = kbd_menu }, { name = "mouse", label = "Mouse", kind = "action", submenu = true, description = "Local mouse settings", eval = function() return not mouse_blocked(); end, handler = mouse_menu }, { name = "multicast", label = "Multicast", kind = "value", description = "Enable multicast where input is mirrored to children (tile)", set = {LBL_YES, LBL_NO, LBL_FLIP}, initial = function() return active_display().selected.multicast and LBL_YES or LBL_NO; end, handler = function(ctx, val) local wnd = active_display().selected; if (val == LBL_FLIP) then val = not wnd.multicast; else val = val == LBL_YES; end wnd.multicast = val; end } };
AddCSLuaFile() file.CreateDir("voxel") function voxel.SaveGrid(path, grid) local fs = assert(file.Open(path, "wb", "DATA")) fs:Write("GVOX") -- File signature fs:WriteByte(1) -- Version number -- Color table local colors = {} local lookup = {} for _, v in pairs(grid.Items) do local col = tostring(v) if lookup[col] then continue end lookup[col] = table.insert(colors, v) end fs:WriteUShort(#colors) for _, v in ipairs(colors) do fs:WriteByte(v.r) fs:WriteByte(v.g) fs:WriteByte(v.b) fs:WriteByte(v.a) end fs:WriteULong(grid:GetCount()) for index, col in pairs(grid.Items) do local x, y, z = voxel.Grid.FromIndex(index) fs:WriteByte(x + 128) fs:WriteByte(y + 128) fs:WriteByte(z + 128) fs:WriteUShort(lookup[tostring(col)]) end fs:Close() end function voxel.LoadGrid(path, data) local fs = assert(file.Open(path, "rb", data and "DATA" or "LUA")) assert(fs:Read(4) == "GVOX", "Invalid file signature") assert(fs:ReadByte() <= 1, "Unsupported file version") local colors = {} for i = 1, fs:ReadUShort() do colors[i] = Color(fs:ReadByte(), fs:ReadByte(), fs:ReadByte(), fs:ReadByte()) end local grid = voxel.Grid() for i = 1, fs:ReadULong() do grid:Set(fs:ReadByte() - 128, fs:ReadByte() - 128, fs:ReadByte() - 128, colors[fs:ReadUShort()]) end fs:Close() return grid end -- KV6 local function translateColor(tab) return Color(tab[3] * 1.5, tab[2] * 1.5, tab[1] * 1.5) end function voxel.LoadKV6(path, data) local fs = assert(file.Open(path, "rb", data and "DATA" or "LUA")) assert(fs:Read(4) == "Kvxl", "Invalid file signature") local size = Vector(fs:ReadULong(), fs:ReadULong(), fs:ReadULong()) fs:Skip(3 * 4) local blockcount = fs:ReadULong() local blocks = {} for i = 0, blockcount - 1 do blocks[i] = { Color = {fs:ReadByte(), fs:ReadByte(), fs:ReadByte(), fs:ReadByte()}, z = fs:ReadUShort(), Faces = fs:ReadByte(), -- Unused Lighting = fs:ReadByte() -- Unused } end fs:Skip(size.x * 4) local offsets = {} for i = 0, (size.x * size.y) - 1 do offsets[i] = fs:ReadUShort() end local grid = voxel.Grid() local pos = 0 for x = 0, size.x - 1 do for y = 0, size.y - 1 do local span = offsets[x * size.y + y] local z = -1 while (span - 1) >= 0 do local block = blocks[pos] z = block.z grid:Set(x + 1, y + 1, z + 1, translateColor(block.Color)) pos = pos + 1 span = span - 1 end end end return grid end
url = "https://vimfung.github.io/LuaScriptCore/"; local json = require("dkjson"); local tbl = getDeviceInfo(); local str = json.encode (tbl, { indent = true }) print(url); print(str); function add (a, b) return a+b; end function printUrl(url) print (url); end function test() local value = 256; return value * 4, 1111, 'Hello'; end return test();
local trigger = {} trigger.name = "MaxHelpingHand/AllBlackholesStrengthTrigger" trigger.placements = { name = "trigger", data = { strength = "Mild" } } return trigger
--[[ MIT License Copyright (c) 2021 JasonP Love2d maxrects algorithm demo 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. ]] require 'maxrects' -- -- Runs that visualize the maxrects functions -- BinWidth = 256 BinHeight = 256 function DrawARect(rect) love.graphics.setColor(rect.data[1],rect.data[2],rect.data[3],rect.data[4]) love.graphics.rectangle('fill', ULx+rect[1], ULy+rect[2], rect[3], rect[4]) end function DrawARun(self) local g = love.graphics -- the rectangle map shadow g.setColor(0,0.2,0,1.0) g.rectangle('fill', ULx, ULy, BinWidth, BinHeight) -- assigned rects self.mRects:iterate(DrawARect) -- the info text at top g.setColor(0.2, 0.2, 0.2, 1.0) g.rectangle('fill', 0, 0, ScrWidth, 17) g.setColor(0.8, 1.0, 0.8, 1.0) g.print(self.name .. ' ' .. self.status,4,1) end RunOne = { name = "Put 32x32 tiles into " .. BinWidth .. "x" .. BinHeight .. " bin:", done = false, mRects = MaxRects.new(BinWidth,BinHeight), cnt = 0, status = '', rate = 0.2, clck = 0, ColorA = {0.4,0.8,0.4,1.0}, ColorB = {0.4,0.4,0.8,1.0} } function RunOne:Click() self.cnt = self.cnt + 1 local data = self.ColorA if math.fmod(self.cnt,2) == 1 then data = self.ColorB end if not self.mRects:insert(32,32,data) then self.done = true end self.status = tostring(self.cnt) .. ", " .. math.floor(self.mRects:occupancy() * 100) .. "% using " .. self.mRects:algorithmName() end function RunOne:Update(dt) self.clck = self.clck + dt if self.clck > self.rate then self.clck = self.clck - self.rate self:Click() end ULx = ScrWidth/2-(BinWidth/2) ULy = ScrHeight/2-(BinHeight/2) end function RunOne:Draw() DrawARun(self) end RunTwo = { name = "Put 32x32 and 16x16 tiles into " .. BinWidth .. "x" .. BinHeight .. " bin:", done = false, mRects = MaxRects.new(BinWidth,BinHeight), cnt = 0, status = '', rate = 0.2, clck = 0, ColorA = {0.4,0.8,0.4,1.0}, ColorB = {0.4,0.4,0.8,1.0} } function RunTwo:Start() end function RunTwo:Click() self.cnt = self.cnt + 1 local sx, sy, data = 16, 16, self.ColorA if math.fmod(self.cnt,2) == 1 then sx, sy, data = 32, 32, self.ColorB end if not self.mRects:insert(sx,sy,data) then self.done = true end self.status = tostring(self.cnt) .. ", " .. math.floor(self.mRects:occupancy() * 100) .. "% using " .. self.mRects:algorithmName() end function RunTwo:Update(dt) self.clck = self.clck + dt if self.clck > self.rate then self.clck = self.clck - self.rate self:Click() end ULx = ScrWidth/2-(BinWidth/2) ULy = ScrHeight/2-(BinHeight/2) end function RunTwo:Draw() DrawARun(self) end RunThree = { name = "Put 63x31 and 10x10 tiles into " .. BinWidth .. "x" .. BinHeight .. " bin:", done = false, mRects = MaxRects.new(BinWidth,BinHeight), cnt = 0, status = '', rate = 0.2, clck = 0, ColorA = {0.4,0.8,0.4,1.0}, ColorB = {0.4,0.4,0.8,1.0} } function RunThree:Start() end function RunThree:Click() self.cnt = self.cnt + 1 local sx, sy, data = 63, 31, self.ColorA if math.fmod(self.cnt,2) == 1 then sx, sy, data = 10, 10, self.ColorB end if not self.mRects:insert(sx,sy,data) then self.done = true end self.status = tostring(self.cnt) .. ", " .. math.floor(self.mRects:occupancy() * 100) .. "% using " .. self.mRects:algorithmName() end function RunThree:Update(dt) self.clck = self.clck + dt if self.clck > self.rate then self.clck = self.clck - self.rate self:Click() end ULx = ScrWidth/2-(BinWidth/2) ULy = ScrHeight/2-(BinHeight/2) end function RunThree:Draw() DrawARun(self) end RunFour = { name = "Put 63x31 and 10x10 tiles into " .. BinWidth .. "x" .. BinHeight .. " bin:", done = false, mRects = MaxRects.new(BinWidth,BinHeight), cnt = 0, status = '', rate = 0.2, clck = 0, ColorA = {0.4,0.8,0.4,1.0}, ColorB = {0.4,0.4,0.8,1.0} } function RunFour:Start() self.mRects:setAlgorithm("BestLongSideFit") end function RunFour:Click() self.cnt = self.cnt + 1 local sx, sy, data = 63, 31, self.ColorA if math.fmod(self.cnt,2) == 1 then sx, sy, data = 10, 10, self.ColorB end if not self.mRects:insert(sx,sy,data) then self.done = true end self.status = tostring(self.cnt) .. ", " .. math.floor(self.mRects:occupancy() * 100) .. "% using " .. self.mRects:algorithmName() end function RunFour:Update(dt) self.clck = self.clck + dt if self.clck > self.rate then self.clck = self.clck - self.rate self:Click() end ULx = ScrWidth/2-(BinWidth/2) ULy = ScrHeight/2-(BinHeight/2) end function RunFour:Draw() DrawARun(self) end RunFive = { name = "Put 63x31 and 10x10 tiles into " .. BinWidth .. "x" .. BinHeight .. " bin:", done = false, mRects = MaxRects.new(BinWidth,BinHeight), cnt = 0, status = '', rate = 0.2, clck = 0, ColorA = {0.4,0.8,0.4,1.0}, ColorB = {0.4,0.4,0.8,1.0} } function RunFive:Start() self.mRects:setAlgorithm("BestAreaFit") end function RunFive:Click() self.cnt = self.cnt + 1 local sx, sy, data = 63, 31, self.ColorA if math.fmod(self.cnt,2) == 1 then sx, sy, data = 10, 10, self.ColorB end if not self.mRects:insert(sx,sy,data) then self.done = true end self.status = tostring(self.cnt) .. ", " .. math.floor(self.mRects:occupancy() * 100) .. "% using " .. self.mRects:algorithmName() end function RunFive:Update(dt) self.clck = self.clck + dt if self.clck > self.rate then self.clck = self.clck - self.rate self:Click() end ULx = ScrWidth/2-(BinWidth/2) ULy = ScrHeight/2-(BinHeight/2) end function RunFive:Draw() DrawARun(self) end RunSix = { name = "Put 63x31 and 10x10 tiles into " .. BinWidth .. "x" .. BinHeight .. " bin:", done = false, mRects = MaxRects.new(BinWidth,BinHeight), cnt = 0, status = '', rate = 0.2, clck = 0, ColorA = {0.4,0.8,0.4,1.0}, ColorB = {0.4,0.4,0.8,1.0} } function RunSix:Start() self.mRects:setAlgorithm("ContactPointRule") end function RunSix:Click() self.cnt = self.cnt + 1 local sx, sy, data = 63, 31, self.ColorA if math.fmod(self.cnt,2) == 1 then sx, sy, data = 10, 10, self.ColorB end if not self.mRects:insert(sx,sy,data) then self.done = true end self.status = tostring(self.cnt) .. ", " .. math.floor(self.mRects:occupancy() * 100) .. "% using " .. self.mRects:algorithmName() end function RunSix:Update(dt) self.clck = self.clck + dt if self.clck > self.rate then self.clck = self.clck - self.rate self:Click() end ULx = ScrWidth/2-(BinWidth/2) ULy = ScrHeight/2-(BinHeight/2) end function RunSix:Draw() DrawARun(self) end RunTable = { RunOne, RunTwo, RunThree, RunFour, RunFive, RunSix } cRun = 1 TheRun = RunTable[cRun] -- -- DO THE LOVE STUFF -- paused = true function love.load() ScrWidth, ScrHeight = love.graphics.getDimensions() if TheRun.Start then TheRun:Start() end end function love.update(dt) ScrWidth, ScrHeight = love.graphics.getDimensions() if love.keyboard.isDown('space') then paused = false end if not paused then if TheRun and TheRun.done then if TheRun.Stop then TheRun:Stop() end cRun = cRun + 1 TheRun = RunTable[cRun] if TheRun == nil then love.event.quit(0) else TheRun:Start() end end if TheRun then TheRun:Update(dt) end end end function love.draw() if paused then return end if TheRun then TheRun:Draw() end end
object_tangible_deed_vehicle_deed_landspeeder_ab1_deed = object_tangible_deed_vehicle_deed_shared_landspeeder_ab1_deed:new { } ObjectTemplates:addTemplate(object_tangible_deed_vehicle_deed_landspeeder_ab1_deed, "object/tangible/deed/vehicle_deed/landspeeder_ab1_deed.iff")
local RateLimitSubject = require "kong.plugins.header-based-rate-limiting.rate_limit_subject" describe("RateLimitSubject", function() describe("#identifier", function() context("when only one header is used", function() it("should return the content of the header", function() local headers = { ["x-some-header"] = "some_consumer", ["x-unused-headr"] = "some_irrelevant_value" } local subject = RateLimitSubject.from_request_headers({ "x-some-header" }, headers) assert.are.equal("some_consumer", subject:identifier()) end) context("when no identification header is present", function() it("should return empty string", function() local subject = RateLimitSubject.from_request_headers({ "x-some-header" }, {}) assert.are.equal("", subject:identifier()) end) end) end) context("when multiple headers are used", function() it("should compose an identifier from the given headers", function() local headers = { ["x-some-header"] = "some_consumer", ["x-another-header"] = "some_additional_data" } local subject = RateLimitSubject.from_request_headers({ "x-some-header", "x-another-header" }, headers) assert.are.equal( "some_consumer,some_additional_data", subject:identifier() ) end) context("when one or more identifier headers are missing", function() it("should use empty string instead of them", function() local headers = { ["x-some-header"] = "some_consumer", ["x-another-header"] = "some_additional_data" } local subject = RateLimitSubject.from_request_headers({ "x-some-header", "x-another-header", "x-yet-another-header" }, headers) assert.are.equal( "some_consumer,some_additional_data,", subject:identifier() ) end) end) end) context("when an identifier header is present multiple times", function() it("should add the last occurence to the composition", function() local headers = { ["x-some-header"] = "some_consumer", ["x-another-header"] = { "some_additional_data", "yet_another_additional_data" } } local subject = RateLimitSubject.from_request_headers({ "x-some-header", "x-another-header" }, headers) assert.are.equal( "some_consumer,yet_another_additional_data", subject:identifier() ) end) end) context("when there are no request headers", function() it("should return an empty string", function() local subject = RateLimitSubject.from_request_headers({ "x-some-header" }, nil) assert.are.equal("", subject:identifier()) end) end) end) describe("#encoded_identifier_array", function() context("when only one header is used", function() it("should return the content of the header", function() local headers = { ["x-some-header"] = "some_consumer", ["x-unused-headr"] = "some_irrelevant_value" } local subject = RateLimitSubject.from_request_headers({ "x-some-header" }, headers) assert.are.same({ ngx.encode_base64("some_consumer") }, subject:encoded_identifier_array()) end) context("when no identification header is present", function() it("should return empty string", function() local subject = RateLimitSubject.from_request_headers({ "x-some-header" }, {}) assert.are.same({ "" }, subject:encoded_identifier_array()) end) end) end) context("when multiple headers are used", function() it("should compose an identifier from the given headers", function() local headers = { ["x-some-header"] = "some_consumer", ["x-another-header"] = "some_additional_data" } local subject = RateLimitSubject.from_request_headers({ "x-some-header", "x-another-header" }, headers) assert.are.same( { ngx.encode_base64("some_consumer"), ngx.encode_base64("some_additional_data") }, subject:encoded_identifier_array() ) end) context("when one or more identifier headers are missing", function() it("should use empty string instead of them", function() local headers = { ["x-some-header"] = "some_consumer", ["x-another-header"] = "some_additional_data" } local subject = RateLimitSubject.from_request_headers({ "x-some-header", "x-another-header", "x-yet-another-header" }, headers) assert.are.same( { ngx.encode_base64("some_consumer"), ngx.encode_base64("some_additional_data"), "" }, subject:encoded_identifier_array() ) end) end) end) context("when an identifier header is present multiple times", function() it("should add the last occurence to the composition", function() local headers = { ["x-some-header"] = "some_consumer", ["x-another-header"] = { "some_additional_data", "yet_another_additional_data" } } local subject = RateLimitSubject.from_request_headers({ "x-some-header", "x-another-header" }, headers) assert.are.same( { ngx.encode_base64("some_consumer"), ngx.encode_base64("yet_another_additional_data") }, subject:encoded_identifier_array() ) end) end) context("when there are no request headers", function() it("should return an empty string", function() local subject = RateLimitSubject.from_request_headers({ "x-some-header" }, nil) assert.are.same({ "" }, subject:encoded_identifier_array()) end) end) end) end)
--final = final drive ratio of car --gearratio[6] = gear ratio in 6th gear --tcircumference = tire circumference gearratio = {} acceleration = 4.9 redline = 8000 final = 4.62 gearratio[1] = 3.07 gearratio[2] = 1.96 gearratio[3] = 1.43 gearratio[4] = 1.12 gearratio[5] = .91 gearratio[6] = .72 tcircumference = 6.22 price = 115000
--[[ ───────────────────────────────────────────────────────────────── ShotSpotter (client.lua) - Created by ItzEndah Current Version: 1.0.2 (June 2021) Support - ItzEndah#0001 on Discord For the configuration, change the values in the config.lua DO NOT EDIT THIS FILE IF YOU DON'T KNOW WHAT YOU ARE DOING ───────────────────────────────────────────────────────────────── ]]-- -- Notify player GetPlayerName() RegisterNetEvent('gunshotNotify') AddEventHandler('gunshotNotify', function(alert) Wait(Config.NotifyTime) if IsPedInAnyPoliceVehicle(PlayerPedId()) then PlaySoundFrontend(-1, "TIMER_STOP", "HUD_MINI_GAME_SOUNDSET", 1) Notify(alert) end end) -- Show blip on map RegisterNetEvent('gunshotLocation') AddEventHandler('gunshotLocation', function(gx, gy, gz) Wait(Config.NotifyTime) if IsPedInAnyPoliceVehicle(PlayerPedId()) then local gunshotBlip = AddBlipForRadius(gx, gy, gz, Config.BlipRadius) SetBlipSprite(gunshotBlip, 161) SetBlipColour(gunshotBlip, Config.BlipColor) SetBlipAsShortRange(gunshotBlip, 0) Wait(Config.BlipTime) SetBlipSprite(gunshotBlip, 2) end end) -- Gunshot detection Citizen.CreateThread( function() while true do Wait(80) local ped = PlayerPedId() local weapon = GetSelectedPedWeapon(ped) local isSilenced = IsPedCurrentWeaponSilenced(ped) local plyPos = GetEntityCoords(ped, true) local s1, s2 = GetStreetNameAtCoord(plyPos.x, plyPos.y, plyPos.z) local street1 = GetStreetNameFromHashKey(s1) local street2 = GetStreetNameFromHashKey(s2) if IsPedShooting(ped) and not isSilenced and not isBlacklisted(weapon) then TriggerServerEvent('inProgressBlip', plyPos.x, plyPos.y, plyPos.z) if s2 == 0 then TriggerServerEvent('inProgress1S', street1) elseif s2 ~= 0 then TriggerServerEvent('inProgress2S', street1, street2) end Wait(Config.AlertCooldown) end end end) -- Notify function function Notify(text) SetNotificationTextEntry('STRING') AddTextComponentString(text) DrawNotification(false, false) end -- Weapon blacklist function function isBlacklisted(model) for _, blacklistedWeapon in pairs(Config.Blacklist) do if model == GetHashKey(blacklistedWeapon) then return true end end return false end
local repl = require 'resty.repl' describe('resty repl', function() it('should work', function() assert.are_equal('function', type(repl.start)) end) end)
-- pastebin run -f -- openDHD from Asher9 -- https://github.com/Asher9/Asher9-s-Programms/tree/master/openDHD return { pruefeKomponenten = "Pruefe Komponenten\n", verfuegbareVersion = "\nVerfuegbare Version: ", aktualisierenGleich = "Automatische Aktualisierung wenn Stargate untaetig ist.", waehlen = "Waehle ", RedstoneWeiss = "weiss: Status nicht Inaktiv", RedstoneGruen = "gruen: verbunden\n", autoSchliessungAus = "Autoschliessung: Aus", autoSchliessungAn = "Autoschliessung: ", atmosphere = "Atmosphaere: ", atmosphere2 = "Atmosphaere: ", atmosphereNEIN = "gefaehrlich", oeffneIris = "Oeffne Iris", schliesseIris = "Schliesse Iris", naechsteSeite = "Naechste Seite", EinstellungenAendern = "Einstellungen aendern", irisNameSchliessend = "Schliessend", StatusNameUntaetig = "Untaetig", StatusNameWaehlend = "Waehlend", StatusNameSchliessend = "Schliessend", Sprachaenderung = "Sprachaenderung ab naechstem Neustart", speichern = 'zum speichern druecke "Strg + S"', schliessen = 'zum schliessen druecke "Strg + W"', autoclosetime = "in Sekunden -- false fuer keine automatische Schliessung", nichtsAendern = "veraendere nichts ab hier", TastaturFehlt = "Tastatur wird benoetigt", StargateNichtKomplett = "Stargate ist funktionsunfaehig", }
-- Ogni Pokémon con forme alternative ha una tabella associata con -- tutte le informazioni necessarie come sottotabelle: si usano le -- sigle come chiavi, o come elementi stessi se l'informazione della -- tabella è booleana; sono considerati solo i Pokémon le cui forme -- alternative non sono puramente estetiche local t = {} local txt = require('Wikilib-strings') -- luacheck: no unused local tab = require('Wikilib-tables') -- luacheck: no unused local mw = require('mw') -- TODO: refactor link creations --[[ Creates the link for an alternative form. There are two general kinds of link: those pointing to the specific subpage of the Pokémon, and those pointing to general pages (eg: "Forma di Alola"). This function handles boths, depending on the arguments. This function also handles empty form name, yielding no link at all (an empty string). Arguments: - context: a string containing a ${link} replacement. The string is a context in which ${link} is replaced with the actual link - formName: name of the specific form - poke: base name of the Pokémon - general: an optional string argument. If given, the function assumes the link target should be the general page whose title is given by the value of this parameter (eg: for a Megaevoluzione, this parameter should be "Megaevoluzione") --]] local function makeSingleLink(context, formName, poke, general) if formName == "" then return "" end local target if general then target = table.concat{general, "#", t[poke].anchor or string.fu(poke)} else target = table.concat{string.fu(poke), "/Forme"} end return string.interp(context, { link = table.concat{"[[", target, "|", formName, "]]"} }) end --[[ Adds links to alternative forms pointing to a generic page instead of the specific subpage of the Pokémon. This function modifies links only for a given list of abbrs, and doesn't change other links. Arguments: - index: the index in the Pokémon's table at which store the link - context: a context for the link, containin a ${link} replacement - target: the target page name - list: a list of keys to which add the links for this target - abbrs: the list of abbrs to modify --]] local function makeTargetedLink(index, context, target, list, abbrs) for _, name in pairs(list) do t[name][index] = table.map(t[name].names, function(formName, formAbbr) if table.search(abbrs, formAbbr) then return makeSingleLink(context, formName, name, target) else return t[name][index] and t[name][index][formAbbr] end end) end end -- Creates links to alternative forms local function makeIndexLinks(index, context) -- Removing support tables since we don't want to operate on them local stdLinks = table.filter(t, function(_, key) return not table.search({'mega', 'megaxy', 'archeo', 'alola', 'galar', 'gigamax', 'hisui'}, key) end) -- Adds standard links for name, poke in pairs(stdLinks) do poke[index] = table.map(poke.names, function(formName) return makeSingleLink(context, formName, name) end) end -- Adds links of forms with a dedicated page makeTargetedLink(index, context, 'Megaevoluzione', table.merge(t.mega, t.megaxy), {"base", "M", "MX", "MY"}) makeTargetedLink(index, context, 'Archeorisveglio', t.archeo, {"base", "A"}) makeTargetedLink(index, context, 'Forma di Alola', t.alola, {"base", "A"}) makeTargetedLink(index, context, 'Forma di Galar', t.galar, {"base", "G"}) makeTargetedLink(index, context, 'Gigamax', t.gigamax, {"base", "Gi"}) makeTargetedLink(index, context, 'Forma di Hisui', t.hisui, {"base", "H"}) end -- Create all links for alternative forms (black, blue and plain) local function makeLinks() local contexts = { links = '<div class="small-text">${link}</div>', blacklinks = '<div class="small-text black-text">${link}</div>', plainlinks = '${link}', } for index, context in pairs(contexts) do makeIndexLinks(index, context) end end --[[ There's a table for each Pokémon. Some are missing because they would be equal to others, thus there's aliasing at the end of the module. --]] t.pikachu = {} t.eevee = {} t.castform = {} t.deoxys = {} t.wormadam = {} t.cherrim = {} t.rotom = {} t.dialga = {} t.palkia = {} t.giratina = {} t.shaymin = {} t.arceus = {} t.basculin = {} t.darmanitan = {} t.tornadus = {} t.kyurem = {} t.meloetta = {} t.greninja = {} t.meowstic = {} t.aegislash = {} t.pumpkaboo = {} t.zygarde = {} t.hoopa = {} t.lycanroc = {} t.oricorio = {} t.wishiwashi = {} t.silvally = {} t.minior = {} t.necrozma = {} t.toxtricity = {} t.alcremie = {} t.eiscue = {} t.indeedee = {} t.morpeko = {} t.zacian = {} t.zamazenta = {} t.eternatus = {} t.urshifu = {} t.calyrex = {} t.basculegion = {} t.enamorus = {} -- Generazione dinamica delle megaevoluzioni e archeorisveglio -- Tabella con i Pokémon che hanno una sola megaevoluzione t.mega = {'venusaur', 'blastoise', 'beedrill', 'pidgeot', 'alakazam', 'gengar', 'slowbro', 'kangaskhan', 'pinsir', 'gyarados', 'aerodactyl', 'ampharos', 'steelix', 'scizor', 'heracross', 'houndoom', 'tyranitar', 'sceptile', 'blaziken', 'swampert', 'gardevoir', 'sableye', 'mawile', 'aggron', 'medicham', 'manectric', 'sharpedo', 'camerupt', 'altaria', 'banette', 'absol', 'glalie', 'salamence', 'metagross', 'latias', 'latios', 'rayquaza', 'lopunny', 'garchomp', 'lucario', 'abomasnow', 'gallade', 'audino', 'diancie'} -- Tabella contentente i Pokémon che hanno più megaevoluzioni t.megaxy = {'charizard', 'mewtwo'} -- Tabella contenente i Pokémon che hanno un archeorisveglio t.archeo = {'kyogre', 'groudon'} -- Tabella contenente i Pokémon che hanno una forma di Alola: -- per efficienza, alcuni sono alla fine del modulo t.alola = {'rattata', 'raichu', 'sandshrew', 'vulpix', 'diglett', 'meowth', 'persian', 'geodude', 'grimer', 'exeggutor', 'marowak'} -- Tabella contenente i Pokémon che hanno una forma di Galar: -- per efficienza, alcuni sono alla fine del modulo t.galar = {'meowth', 'ponyta', 'slowpoke', 'slowbro', "farfetch'd", 'weezing', 'mr. mime', 'articuno', 'zapdos', 'moltres', 'slowking', 'corsola', 'zigzagoon', 'darumaka', 'yamask', 'stunfisk'} -- Table with Pokémon with a Gigamax t.gigamax = {'venusaur', 'charizard', 'blastoise', 'butterfree', 'meowth', 'machamp', 'gengar', 'kingler', 'lapras', 'eevee', 'snorlax', 'garbodor', 'melmetal', 'rillaboom', 'cinderace', 'inteleon', 'corviknight', 'orbeetle', 'drednaw', 'coalossal', 'flapple', 'appletun', 'sandaconda', 'centiskorch', 'hatterene', 'grimmsnarl', 'alcremie', 'copperajah', 'duraludon'} -- Tabella contenente i Pokémon che hanno una forma di Hisui: -- per efficienza, alcuni sono alla fine del modulo t.hisui = {'growlithe', 'voltorb', 'typhlosion', 'qwilfish', 'sneasel', 'samurott', 'lilligant', 'zorua', 'braviary', 'sliggoo', 'avalugg', 'decidueye'} --[[ Alternative forms names. Keys are the abbr. --]] t.pikachu.names = {Cs = 'Pikachu Cosplay', R = 'Pikachu rockstar', D = 'Pikachu damigella', Cn = 'Pikachu confetto', S = 'Pikachu scienziata', W = 'Pikachu wrestler', Cm = 'Compagno', Gi = 'Pikachu Gigamax', base = ''} t.eevee.names = {Cm = 'Compagno', base = ''} t.castform.names = {S = 'Forma Sole', P = 'Forma Pioggia', N = 'Forma Nuvola di Neve', base = 'Forma Castform'} t.deoxys.names = {A = 'Forma Attacco', D = 'Forma Difesa', V = 'Forma Velocità', base = 'Forma Normale'} t.wormadam.names = {Sa = 'Manto Sabbia', Sc = 'Manto Scarti', base = 'Manto Pianta'} t.cherrim.names = {S = 'Forma Splendore', base = 'Forma Nuvola'} t.rotom.names = {C = 'Rotom Calore', L = 'Rotom Lavaggio', G = 'Rotom Gelo', V = 'Rotom Vortice', T = 'Rotom Taglio', base = 'Forma Rotom'} t.dialga.names = {O = 'Forma Originale', base = ''} t.palkia.names = {O = 'Forma Originale', base = ''} t.giratina.names = {O = 'Forma Originale', base = 'Forma Alterata'} t.shaymin.names = {C = 'Forma Cielo', base = 'Forma Terra'} t.arceus.names = {base = 'Normale', L = 'Lotta', Vo = 'Volante', Ve = 'Veleno', T = 'Terra', R = 'Roccia', Aq = 'Acqua', C = 'Coleottero', Er = 'Erba', P = 'Psico', B = 'Buio', S = 'Spettro', Ai = 'Acciaio', Fu = 'Fuoco', D = 'Drago', Fo = 'Folletto', El = 'Elettro', G = 'Ghiaccio', Sc = 'Sconosciuto'} t.basculin.names = {Bi = 'Forma Lineabianca', B = 'Forma Lineablu', base = 'Forma Linearossa'} t.darmanitan.names = {Z = 'Stato Zen', G = 'Forma di Galar', GZ = "Stato Zen (Galar)", base = 'Stato Normale'} t.tornadus.names = {T = 'Forma Totem', base = 'Forma Incarnazione'} t.kyurem.names = {N = 'Kyurem Nero', B = 'Kyurem Bianco', base = 'Forma di Kyurem'} t.meloetta.names = {D = 'Forma Danza', base = 'Forma Canto'} t.greninja.names = {A = 'Forma Ash', base = ''} t.meowstic.names = {F = 'Femmina', base = 'Maschio'} t.aegislash.names = {S = 'Forma Spada', base = 'Forma Scudo'} t.pumpkaboo.names = {S = 'Mini', L = 'Grande', XL = 'Maxi', base = 'Normale'} t.zygarde.names = {D = 'Forma 10%', P = 'Forma Perfetta', base = 'Forma 50%'} t.hoopa.names = {L = 'Libero', base = 'Vincolato'} t.oricorio.names = {C = 'Stile Cheerdance', H = 'Stile Hula', B = 'Stile Buyō', base = 'Stile Flamenco'} t.lycanroc.names = {N = 'Forma Notte', C = 'Forma Crepuscolo', base = 'Forma Giorno'} t.wishiwashi.names = {B = 'Forma Banco', base = 'Forma Individuale'} t.silvally.names = {base = 'Tipo Normale', L = 'Tipo Lotta', Vo = 'Tipo Volante', Ve = 'Tipo Veleno', T = 'Tipo Terra', R = 'Tipo Roccia', Aq = 'Tipo Acqua', C = 'Tipo Coleottero', Er = 'Tipo Erba', P = 'Tipo Psico', B = 'Tipo Buio', S = 'Tipo Spettro', Ai = 'Tipo Acciaio', Fu = 'Tipo Fuoco', D = 'Tipo Drago', Fo = 'Tipo Folletto', El = 'Tipo Elettro', G = 'Tipo Ghiaccio'} t.minior.names = {R = 'Forma Nucleo', base = 'Forma Meteora'} t.necrozma.names = {V = 'Necrozma Criniera del Vespro', A = "Necrozma Ali dell'Aurora", U = 'UltraNecrozma', base = ''} t.toxtricity.names = {B = 'Forma Basso', Gi = "Toxtricity Gigamax", base = 'Forma Melodia'} t.alcremie.names = {base = ""} t.eiscue.names = {L = "Liquefaccia", base = "Gelofaccia"} t.indeedee.names = {F = 'Femmina', base = 'Maschio'} t.morpeko.names = {V = 'Motivo Panciavuota', base = 'Motivo Panciapiena'} t.zacian.names = {R = 'Re delle Spade', base = 'Eroe di Mille Lotte'} t.zamazenta.names = {R = 'Re degli Scudi', base = 'Eroe di Mille Lotte'} t.eternatus.names = {D = 'Dynamax Infinito', base = ''} t.urshifu.names = {P = 'Stile Pluricolpo', Gi = 'Urshifu Gigamax (Stile Singolcolpo)', PGi = 'Urshifu Gigamax (Stile Pluricolpo)', base = 'Stile Singolcolpo'} t.calyrex.names = {G = "Cavaliere Glaciale", S = "Cavaliere Spettrale", base = ""} t.basculegion.names = {F = 'Femmina', base = 'Maschio'} t.enamorus.names = {T = 'Forma Totem', base = 'Forma Incarnazione'} for _, v in pairs(t.mega) do if not t[v] then t[v] = { names = {base = ''} } end t[v].names.M = 'Mega' .. string.fu(v) end for _, v in pairs(t.megaxy) do if not t[v] then t[v] = { names = {base = ''} } end local fu = string.fu(v) t[v].names.MX = table.concat{'Mega', fu, ' X'} t[v].names.MY = table.concat{'Mega', fu, ' Y'} end for _, v in pairs(t.archeo) do if not t[v] then t[v] = { names = {base = ''} } end t[v].names.A = 'Archeorisveglio' end for _, v in pairs(t.alola) do if not t[v] then t[v] = { names = {base = ''} } end t[v].names.A = 'Forma di Alola' end for _, v in pairs(t.galar) do if not t[v] then t[v] = { names = {base = ''} } end t[v].names.G = 'Forma di Galar' end for _, v in pairs(t.gigamax) do if not t[v] then t[v] = { names = {base = ''} } end t[v].names.Gi = string.fu(v) .. " Gigamax" end for _, v in pairs(t.hisui) do if not t[v] then t[v] = { names = {base = ''} } end t[v].names.H = 'Forma di Hisui' end -- Anchor per i link alle forme alternative, -- se diversi dal nome del Pokémon t.rattata.anchor = 'Rattata e Raticate' t.sandshrew.anchor = 'Sandshrew e Sandslash' t.vulpix.anchor = 'Vulpix e Ninetales' t.diglett.anchor = 'Diglett e Dugtrio' t.persian.anchor = 'Meowth e Persian' t.geodude.anchor = 'Geodude, Graveler e Golem' t.ponyta.anchor = 'Ponyta e Rapidash' t.grimer.anchor = 'Grimer e Muk' t.zigzagoon.anchor = 'Zigzagoon e Linoone' -- t.wormadam.anchor = 'Burmy e Wormadam' -- t.tornadus.anchor = 'Forze della Natura' -- t.pumpkaboo.anchor = 'Pumpkaboo e Gourgeist' -- Table to map extended names to abbrs t.pikachu.ext = {cosplay = 'Cs', rockstar = 'R', damigella = 'D', confetto = 'Cn', scienziata = 'S', wrestler = 'W', compagno = 'Cm', gigamax = 'Gi'} t.eevee.ext = {compagno = 'Cm'} t.castform.ext = {sole = 'S', pioggia = 'P', neve = 'N'} t.deoxys.ext = {attacco = 'A', difesa = 'D', ['velocità'] = 'V'} t.wormadam.ext = {sabbia = 'Sa', scarti = 'Sc'} t.cherrim.ext = {splendore = 'S'} t.rotom.ext = {calore = 'C', lavaggio = 'L', gelo = 'G', vortice = 'V', taglio = 'T'} t.dialga.ext = {originale = 'O', origine = 'O'} t.palkia.ext = {originale = 'O', origine = 'O'} t.giratina.ext = {originale = 'O', origine = 'O'} t.shaymin.ext = {cielo = 'C'} t.arceus.ext = {lotta = 'L', volante = 'Vo', veleno = 'Ve', terra = 'T', roccia = 'R', acqua = 'Aq', coleottero = 'C', erba = 'Er', psico = 'P', buio = 'B', spettro = 'S', acciaio = 'Ai', fuoco = 'Fu', drago = 'D', folletto = 'Fo', elettro = 'El', ghiaccio = 'G', coleot = 'C', sconosciuto = 'Sc'} t.basculin.ext = {lineablu = 'B', lineabianca = 'Bi'} t.darmanitan.ext = {zen = 'Z', galar = 'G', ["galar zen"] = 'GZ'} t.tornadus.ext = {totem = 'T'} t.kyurem.ext = {nero = 'N', bianco = 'B'} t.meloetta.ext = {danza = 'D'} t.greninja.ext = {ash = 'A'} t.meowstic.ext = {femmina = 'F'} t.aegislash.ext = {spada = 'S'} t.pumpkaboo.ext = {mini = 'S', grande = 'L', maxi = 'XL'} t.zygarde.ext = {dieci = 'D', perfetto = 'P'} t.hoopa.ext = {libero = 'L'} t.lycanroc.ext = {notte = 'N', crepuscolo = 'C', giorno = 'base'} t.oricorio.ext = {cheerdance = 'C', hula = 'H', buyo = 'B', flamenco = 'base'} t.wishiwashi.ext = {banco = 'B', individuale = 'base'} t.silvally.ext = mw.clone(t.arceus.ext) t.silvally.ext.sconosciuto = nil t.minior.ext = {nucleo = 'R', meteora = 'base'} t.necrozma.ext = {vespro = 'V', aurora = 'A', ultra = 'U', necrozma = 'base'} t.toxtricity.ext = {basso = 'B', gigamax = 'Gi', melodia = 'base'} t.alcremie.ext = {lattevaniglia = 'base'} t.eiscue.ext = {liquefaccia = 'L', gelofaccia = 'base'} t.indeedee.ext = t.meowstic.ext t.morpeko.ext = {panciavuota = 'V', panciapiena = 'base'} t.zacian.ext = {eroe = 'base', re = 'R'} t.zamazenta.ext = t.zacian.ext t.eternatus.ext = {dynamax = 'D'} t.urshifu.ext = {pluricolpo = 'P', gigamax = "Gi", singolcolpo = 'base'} t.calyrex.ext = {spettrale = 'S', glaciale = 'G'} t.basculegion.ext = {femmina = 'F'} t.enamorus.ext = {totem = 'T'} for _, v in pairs(t.mega) do t[v].ext = t[v].ext or {} t[v].ext.mega = 'M' end for _, v in pairs(t.megaxy) do t[v].ext = t[v].ext or {} t[v].ext.megax = 'MX' t[v].ext.megay = 'MY' end for _, v in pairs(t.archeo) do t[v].ext = t[v].ext or {} t[v].ext.archeo = 'A' end for _, v in pairs(t.alola) do t[v].ext = t[v].ext or {} t[v].ext.alola = 'A' end for _, v in pairs(t.galar) do t[v].ext = t[v].ext or {} t[v].ext.galar = 'G' end for _, v in pairs(t.gigamax) do t[v].ext = t[v].ext or {} t[v].ext.gigamax = "Gi" end for _, v in pairs(t.hisui) do t[v].ext = t[v].ext or {} t[v].ext.hisui = 'H' end --[[ Arrays keeping the order in which alternative forms are listed in the latest game. --]] t.venusaur.gamesOrder = {'base', 'M', 'Gi'} t.charizard.gamesOrder = {'base', 'MX', 'MY', 'Gi'} t.blastoise.gamesOrder = {'base', 'M', 'Gi'} t.pikachu.gamesOrder = {'base', 'Cs', 'R', 'D', 'Cn', 'S', 'W', 'Cm', 'Gi'} t.meowth.gamesOrder = {'base', 'A', 'G', 'Gi'} t.gengar.gamesOrder = {'base', 'M', 'Gi'} t.slowbro.gamesOrder = {'base', 'M', 'G'} t.eevee.gamesOrder = {'base', 'Cm', 'Gi'} t.castform.gamesOrder = {'base', 'S', 'P', 'N'} t.deoxys.gamesOrder = {'base', 'A', 'D', 'V'} t.wormadam.gamesOrder = {'base', 'Sa', 'Sc'} t.cherrim.gamesOrder = {'base', 'S'} t.rotom.gamesOrder = {'base', 'C', 'L', 'G', 'V', 'T'} t.dialga.gamesOrder = {'base', 'O'} t.palkia.gamesOrder = {'base', 'O'} t.giratina.gamesOrder = {'base', 'O'} t.shaymin.gamesOrder = {'base', 'C'} t.arceus.gamesOrder = {'base', 'L', 'Vo', 'Ve', 'T', 'R', 'C', 'S', 'Ai', 'Fu', 'Aq', 'Er', 'El', 'P', 'G', 'D', 'B', 'Fo', 'Sc'} t.basculin.gamesOrder = {'base', 'B', 'Bi'} t.darmanitan.gamesOrder = {'base', 'Z', 'G', 'GZ'} t.tornadus.gamesOrder = {'base', 'T'} t.kyurem.gamesOrder = {'base', 'B', 'N'} t.meloetta.gamesOrder = {'base', 'D'} t.greninja.gamesOrder = {'base', 'A'} t.meowstic.gamesOrder = {'base', 'F'} t.aegislash.gamesOrder = {'base', 'S'} t.pumpkaboo.gamesOrder = {'base', 'S', 'L', 'XL'} t.zygarde.gamesOrder = {'D', 'base', 'P'} t.hoopa.gamesOrder = {'base', 'L'} t.lycanroc.gamesOrder = {'base', 'N', 'C'} t.oricorio.gamesOrder = {'base', 'C', 'H', 'B'} t.wishiwashi.gamesOrder = {'base', 'B'} t.silvally.gamesOrder = mw.clone(t.arceus.gamesOrder) table.remove(t.silvally.gamesOrder) t.minior.gamesOrder = {'base', 'R'} t.necrozma.gamesOrder = {'base', 'V', 'A', 'U'} t.toxtricity.gamesOrder = {'base', 'B', 'Gi'} t.eiscue.gamesOrder = {'base', 'L'} t.indeedee.gamesOrder = t.meowstic.gamesOrder t.morpeko.gamesOrder = {'base', 'V'} t.zacian.gamesOrder = {'base', 'R'} t.zamazenta.gamesOrder = t.zacian.gamesOrder t.eternatus.gamesOrder = {'base', 'D'} t.urshifu.gamesOrder = {'base', 'Gi', 'P', 'PGi'} t.calyrex.gamesOrder = {'base', 'G', 'S'} t.basculegion.gamesOrder = {'base', 'F'} t.enamorus.gamesOrder = {'base', 'T'} for _, v in pairs(t.mega) do t[v].gamesOrder = t[v].gamesOrder or {'base', 'M'} end for _, v in pairs(t.megaxy) do t[v].gamesOrder = t[v].gamesOrder or {'base', 'MX', 'MY'} end for _, v in pairs(t.archeo) do t[v].gamesOrder = t[v].gamesOrder or {'base', 'A'} end for _, v in pairs(t.alola) do t[v].gamesOrder = t[v].gamesOrder or {'base', 'A'} end for _, v in pairs(t.galar) do t[v].gamesOrder = t[v].gamesOrder or {'base', 'G'} end for _, v in pairs(t.gigamax) do t[v].gamesOrder = t[v].gamesOrder or {"base", "Gi"} end for _, v in pairs(t.hisui) do t[v].gamesOrder = t[v].gamesOrder or {'base', 'H'} end --[[ Pokémon with different cries between forms. This array is guaranteed to be a sorted subset of gamesOrder (same sorting) --]] for _, v in pairs(t.mega) do t[v].cries = {'M'} end for _, v in pairs(t.megaxy) do t[v].cries = {'MX', 'MY'} end for _, v in pairs(t.archeo) do t[v].cries = {'A'} end t.slowbro.cries = {'M'} t.shaymin.cries = {'C'} t.tornadus.cries = {'T'} t.kyurem.cries = {'B', 'N'} t.pumpkaboo.cries = {'XL'} t.zygarde.cries = {'D', 'P'} t.hoopa.cries = {'L'} t.oricorio.cries = {'C', 'H', 'B'} t.lycanroc.cries = {'N', 'C'} t.wishiwashi.cries = {'B'} t.necrozma.cries = {'V', 'A', 'U'} --[[ Oldest game in which each form, included base form, appears. --]] t.rattata.since = {A = 'sl', base = 'rb'} t.pikachu.since = {Cs = 'roza', R = 'roza', D = 'roza', Cn = 'roza', S = 'roza', W = 'roza', Cm = 'lgpe', Gi = 'spsc', base = 'rb'} t.raichu.since = {A = 'sl', base = 'rb'} t.sandshrew.since = {A = 'sl', base = 'rb'} t.vulpix.since = {A = 'sl', base = 'rb'} t.diglett.since = {A = 'sl', base = 'rb'} t.meowth.since = {A = 'sl', G = 'spsc', Gi = 'spsc', base = 'rb'} t.persian.since = {A = 'sl', base = 'rb'} t.growlithe.since = {H = 'lpa', base = 'rb'} t.geodude.since = {A = 'sl', base = 'rb'} t.ponyta.since = {G = 'spsc', base = 'rb'} t.slowpoke.since = {G = 'spsc', base = 'rb'} t.slowbro.since = {M = 'roza', G = 'spsc', base = 'rb'} t["farfetch'd"].since = {G = 'spsc', base = 'rb'} t.grimer.since = {A = 'sl', base = 'rb'} t.voltorb.since = {H = 'lpa', base = 'rb'} t.exeggutor.since = {A = 'sl', base = 'rb'} t.marowak.since = {A = 'sl', base = 'rb'} t.weezing.since = {G = 'spsc', base = 'rb'} t['mr. mime'].since = {G = 'spsc', base = 'rb'} t.eevee.since = {Cm = 'lgpe', Gi = 'spsc', base = 'rb'} t.articuno.since = {G = 'spsc', base = 'rb'} t.zapdos.since = {G = 'spsc', base = 'rb'} t.moltres.since = {G = 'spsc', base = 'rb'} t.slowking.since = {G = 'spsc', base = 'oa'} t.typhlosion.since = {H = 'lpa', base = 'oa'} t.qwilfish.since = {H = 'lpa', base = 'oa'} t.sneasel.since = {H = 'lpa', base = 'oa'} t.corsola.since = {G = 'spsc', base = 'oa'} t.zigzagoon.since = {G = 'spsc', base = 'rz'} t.castform.since = {S = 'rz', P = 'rz', N = 'rz', base = 'rz'} t.deoxys.since = {A = 'rfvf', D = 'rfvf', V = 's', base = 'rz'} t.wormadam.since = {Sa = 'dp', Sc = 'dp', base = 'dp'} t.cherrim.since = {S = 'dp', base = 'dp'} t.rotom.since = {C = 'pt', L = 'pt', G = 'pt', V = 'pt', T = 'pt', base = 'dp'} t.dialga.since = {O = 'lpa', base = 'dp'} t.palkia.since = {O = 'lpa', base = 'dp'} t.giratina.since = {O = 'pt', base = 'dp'} t.shaymin.since = {C = 'pt', base = 'dp'} t.arceus.since = {base = 'dp', L = 'dp', Vo = 'dp', Ve = 'dp', T = 'dp', R = 'dp', Aq = 'dp', C = 'dp', Er = 'dp', P = 'dp', B = 'dp', S = 'dp', Ai = 'dp', Fu = 'dp', D = 'dp', Fo = 'xy', El = 'dp', G = 'dp', Sc = 'dp'} t.samurott.since = {H = 'lpa', base = 'nb'} t.lilligant.since = {H = 'lpa', base = 'nb'} t.basculin.since = {B = 'nb', Bi = 'lpa', base = 'nb'} t.darumaka.since = {G = 'spsc', base = 'nb'} t.darmanitan.since = {Z = 'nb', G = 'spsc', GZ = 'spsc', base = 'nb'} t.yamask.since = {G = 'spsc', base = 'rz'} t.zorua.since = {H = 'lpa', base = 'nb'} t.stunfisk.since = {G = 'spsc', base = 'nb'} t.braviary.since = {H = 'lpa', base = 'nb'} t.tornadus.since = {T = 'n2b2', base = 'nb'} t.kyurem.since = {N = 'n2b2', B = 'n2b2', base = 'nb'} t.meloetta.since = {D = 'nb', base = 'nb'} t.greninja.since = {A = 'sl', base = 'xy'} t.meowstic.since = {F = 'xy', base = 'xy'} t.aegislash.since = {S = 'xy', base = 'xy'} t.sliggoo.since = {H = 'lpa', base = 'xy'} t.pumpkaboo.since = {S = 'xy', L = 'xy', XL = 'xy', base = 'xy'} t.avalugg.since = {H = 'lpa', base = 'xy'} t.zygarde.since = {D = 'sl', P = 'sl', base = 'xy'} t.hoopa.since = {L = 'roza', base = 'xy'} t.decidueye.since = {H = 'lpa', base = 'sl'} t.lycanroc.since = {N = 'sl', base = 'sl', C = 'usul'} t.oricorio.since = {C = 'sl', H = 'sl', B = 'sl', base = 'sl'} t.wishiwashi.since = {B = 'sl', base = 'sl'} t.silvally.since = {base = 'sl', L = 'sl', Vo = 'sl', Ve = 'sl', T = 'sl', R = 'sl', Aq = 'sl', C = 'sl', Er = 'sl', P = 'sl', B = 'sl', S = 'sl', Ai = 'sl', Fu = 'sl', D = 'sl', Fo = 'sl', El = 'sl', G = 'sl'} t.minior.since = {base = 'sl', R = 'sl'} t.necrozma.since = {base = 'sl', V = 'usul', A = 'usul', U = 'usul'} t.toxtricity.since = {B = 'spsc', Gi = 'spsc', base = 'spsc'} t.eiscue.since = {L = 'spsc', base = 'spsc'} t.indeedee.since = {F = 'spsc', base = 'spsc'} t.morpeko.since = {base = 'spsc', V = 'spsc'} t.zacian.since = {R = 'spsc', base = 'spsc'} t.zamazenta.since = {R = 'spsc', base = 'spsc'} t.eternatus.since = {D = 'spsc', base = 'spsc'} t.urshifu.since = {P = 'spsc', Gi = 'spsc', PGi = 'spsc', base = 'spsc'} t.calyrex.since = {G = 'spsc', S = 'spsc', base = 'spsc'} t.basculegion.since = {F = 'lpa', base = 'lpa'} t.enamorus.since = {T = 'lpa', base = 'lpa'} t.venusaur.since = {M = 'xy', Gi = 'spsc', base = 'rb'} t.blastoise.since = {M = 'xy', Gi = 'spsc', base = 'rb'} t.beedrill.since = {M = 'roza', base = 'rb'} t.pidgeot.since = {M = 'roza', base = 'rb'} t.alakazam.since = {M = 'xy', base = 'rb'} t.gengar.since = {M = 'xy', Gi = 'spsc', base = 'rb'} t.kangaskhan.since = {M = 'xy', base = 'rb'} t.pinsir.since = {M = 'xy', base = 'rb'} t.gyarados.since = {M = 'xy', base = 'rb'} t.aerodactyl.since = {M = 'xy', base = 'rb'} t.ampharos.since = {M = 'xy', base = 'oa'} t.steelix.since = {M = 'roza', base = 'oa'} t.scizor.since = {M = 'xy', base = 'oa'} t.heracross.since = {M = 'xy', base = 'oa'} t.houndoom.since = {M = 'xy', base = 'oa'} t.tyranitar.since = {M = 'xy', base = 'oa'} t.sceptile.since = {M = 'roza', base = 'rz'} t.blaziken.since = {M = 'xy', base = 'rz'} t.swampert.since = {M = 'roza', base = 'rz'} t.gardevoir.since = {M = 'xy', base = 'rz'} t.sableye.since = {M = 'roza', base = 'rz'} t.mawile.since = {M = 'xy', base = 'rz'} t.aggron.since = {M = 'xy', base = 'rz'} t.medicham.since = {M = 'xy', base = 'rz'} t.manectric.since = {M = 'xy', base = 'rz'} t.banette.since = {M = 'xy', base = 'rz'} t.sharpedo.since = {M = 'roza', base = 'rz'} t.camerupt.since = {M = 'roza', base = 'rz'} t.altaria.since = {M = 'roza', base = 'rz'} t.absol.since = {M = 'xy', base = 'rz'} t.glalie.since = {M = 'roza', base = 'rz'} t.salamence.since = {M = 'roza', base = 'rz'} t.metagross.since = {M = 'roza', base = 'rz'} t.latias.since = {M = 'roza', base = 'rz'} t.latios.since = {M = 'roza', base = 'rz'} t.rayquaza.since = {M = 'roza', base = 'rz'} t.lopunny.since = {M = 'roza', base = 'dp'} t.garchomp.since = {M = 'xy', base = 'dp'} t.lucario.since = {M = 'xy', base = 'dp'} t.abomasnow.since = {M = 'xy', base = 'dp'} t.gallade.since = {M = 'roza', base = 'dp'} t.audino.since = {M = 'roza', base = 'nb'} t.diancie.since = {M = 'roza', base = 'xy'} t.charizard.since = {MX = 'xy', MY = 'xy', Gi = 'spsc', base = 'rb'} t.mewtwo.since = {MX = 'xy', MY = 'xy', base = 'rb'} t.groudon.since = {A = 'roza', base = 'rz'} t.kyogre.since = {A = 'roza', base = 'rz'} t.butterfree.since = {base = 'rb', Gi = 'spsc'} t.machamp.since = {base = 'rb', Gi = 'spsc'} t.kingler.since = {base = 'rb', Gi = 'spsc'} t.lapras.since = {base = 'rb', Gi = 'spsc'} t.snorlax.since = {base = 'rb', Gi = 'spsc'} t.garbodor.since = {base = 'nb', Gi = 'spsc'} t.melmetal.since = {base = 'lgpe', Gi = 'spsc'} t.rillaboom.since = {base = 'spsc', Gi = 'spsc'} t.cinderace.since = {base = 'spsc', Gi = 'spsc'} t.inteleon.since = {base = 'spsc', Gi = 'spsc'} t.corviknight.since = {base = 'spsc', Gi = 'spsc'} t.orbeetle.since = {base = 'spsc', Gi = 'spsc'} t.drednaw.since = {base = 'spsc', Gi = 'spsc'} t.coalossal.since = {base = 'spsc', Gi = 'spsc'} t.flapple.since = {base = 'spsc', Gi = 'spsc'} t.appletun.since = {base = 'spsc', Gi = 'spsc'} t.sandaconda.since = {base = 'spsc', Gi = 'spsc'} t.centiskorch.since = {base = 'spsc', Gi = 'spsc'} t.hatterene.since = {base = 'spsc', Gi = 'spsc'} t.grimmsnarl.since = {base = 'spsc', Gi = 'spsc'} t.alcremie.since = {base = 'spsc', Gi = 'spsc'} t.copperajah.since = {base = 'spsc', Gi = 'spsc'} t.duraludon.since = {base = 'spsc', Gi = 'spsc'} --[[ Tables containing the last game a form is available, base form included. Anything not present defaults to latest games. --]] t.pikachu['until'] = {Cs = 'roza', R = 'roza', D = 'roza', Cn = 'roza', S = 'roza', W = 'roza', Cm = 'lgpe'} t.eevee['until'] = {Cm = 'lgpe'} t.arceus['until'] = {Sc = 'hgss'} -- Alias, messi qui per evitare inutili iterazioni dei cicli precedenti -- Tables are copied since links should be changed t.raticate = table.copy(t.rattata) t.sandslash = table.copy(t.sandshrew) t.ninetales = table.copy(t.vulpix) t.arcanine = table.copy(t.growlithe) t.electrode = table.copy(t.voltorb) t.dugtrio = table.copy(t.diglett) t.graveler = table.copy(t.geodude) t.golem = table.copy(t.geodude) t.rapidash = table.copy(t.ponyta) t.muk = table.copy(t.grimer) t.linoone = table.copy(t.zigzagoon) t.zoroark = table.copy(t.zorua) t.thundurus, t.landorus = table.copy(t.tornadus), table.copy(t.tornadus) t.goodra = table.copy(t.sliggoo) t.gourgeist = table.copy(t.pumpkaboo) -- Adding missing Pokémon to set with a certain kind of forms. Added here -- to avoid useless repetitions of cycles -- Otehr Alola forms table.insert(t.alola, 'raticate') table.insert(t.alola, 'sandslash') table.insert(t.alola, 'ninetales') table.insert(t.alola, 'dugtrio') table.insert(t.alola, 'meowth') table.insert(t.alola, 'graveler') table.insert(t.alola, 'golem') table.insert(t.alola, 'muk') -- Other Galar forms table.insert(t.galar, 'rapidash') table.insert(t.galar, 'linoone') -- Other Hisuian forms table.insert(t.hisui, 'arcanine') table.insert(t.hisui, 'electrode') table.insert(t.hisui, 'zoroark') table.insert(t.hisui, 'goodra') -- Other Gigamax forms table.insert(t.gigamax, 'pikachu') table.insert(t.gigamax, 'toxtricity') table.insert(t.gigamax, 'urshifu') -- Link creation should be done AFTER copying Pokémon with same forms, in order -- to use the right name for the link makeLinks() t[19] = t.rattata t[20] = t.raticate t[25] = t.pikachu t[26] = t.raichu t[27] = t.sandshrew t[28] = t.sandslash t[37] = t.vulpix t[38] = t.ninetales t[50] = t.diglett t[51] = t.dugtrio t[52] = t.meowth t[53] = t.persian t[58] = t.growlithe t[59] = t.arcanine t[74] = t.geodude t[75] = t.graveler t[76] = t.golem t[77] = t.ponyta t[78] = t.rapidash t[79] = t.slowpoke t[80] = t.slowbro t[83] = t["farfetch'd"] t[88] = t.grimer t[89] = t.muk t[100] = t.voltorb t[101] = t.electrode t[103] = t.exeggutor t[105] = t.marowak t[110] = t.weezing t[122] = t['mr. mime'] t[133] = t.eevee t[144] = t.articuno t[145] = t.zapdos t[146] = t.moltres t[157] = t.typhlosion t[199] = t.slowking t[211] = t.qwilfish t[215] = t.sneasel t[222] = t.corsola t[263] = t.zigzagoon t[264] = t.linoone t[351] = t.castform t[386] = t.deoxys t[413] = t.wormadam t[421] = t.cherrim t[479] = t.rotom t[483] = t.dialga t[484] = t.palkia t[487] = t.giratina t[492] = t.shaymin t[493] = t.arceus t[503] = t.samurott t[549] = t.lilligant t[550] = t.basculin t[554] = t.darumaka t[555] = t.darmanitan t[562] = t.yamask t[570] = t.zorua t[571] = t.zoroark t[618] = t.stunfisk t[628] = t.braviary t[641] = t.tornadus t[642] = t.thundurus t[645] = t.landorus t[646] = t.kyurem t[648] = t.meloetta t[658] = t.greninja t[678] = t.meowstic t[681] = t.aegislash t[705] = t.sliggoo t[706] = t.goodra t[710] = t.pumpkaboo t[711] = t.gourgeist t[713] = t.avalugg t[718] = t.zygarde t[720] = t.hoopa t[724] = t.decidueye t[741] = t.oricorio t[745] = t.lycanroc t[746] = t.wishiwashi t[773] = t.silvally t[774] = t.minior t[800] = t.necrozma t[849] = t.toxtricity t[869] = t.alcremie t[875] = t.eiscue t[876] = t.indeedee t[877] = t.morpeko t[888] = t.zacian t[889] = t.zamazenta t[890] = t.eternatus t[892] = t.urshifu t[898] = t.calyrex t[902] = t.basculegion t[905] = t.enamorus t[3] = t.venusaur t[9] = t.blastoise t[15] = t.beedrill t[18] = t.pidgeot t[65] = t.alakazam t[94] = t.gengar t[115] = t.kangaskhan t[127] = t.pinsir t[130] = t.gyarados t[142] = t.aerodactyl t[181] = t.ampharos t[208] = t.steelix t[212] = t.scizor t[214] = t.heracross t[229] = t.houndoom t[248] = t.tyranitar t[254] = t.sceptile t[257] = t.blaziken t[260] = t.swampert t[282] = t.gardevoir t[302] = t.sableye t[303] = t.mawile t[306] = t.aggron t[308] = t.medicham t[310] = t.manectric t[319] = t.sharpedo t[323] = t.camerupt t[334] = t.altaria t[354] = t.banette t[359] = t.absol t[362] = t.glalie t[373] = t.salamence t[376] = t.metagross t[380] = t.latias t[381] = t.latios t[384] = t.rayquaza t[428] = t.lopunny t[445] = t.garchomp t[448] = t.lucario t[460] = t.abomasnow t[475] = t.gallade t[531] = t.audino t[719] = t.diancie t[6] = t.charizard t[150] = t.mewtwo t[382] = t.kyogre t[383] = t.groudon t[12] = t.butterfree t[68] = t.machamp t[99] = t.kingler t[131] = t.lapras t[143] = t.snorlax t[569] = t.garbodor t[809] = t.melmetal t[812] = t.rillaboom t[815] = t.cinderace t[818] = t.inteleon t[823] = t.corviknight t[826] = t.orbeetle t[834] = t.drednaw t[839] = t.coalossal t[841] = t.flapple t[842] = t.appletun t[844] = t.sandaconda t[849] = t.toxtricity t[851] = t.centiskorch t[858] = t.hatterene t[861] = t.grimmsnarl t[869] = t.alcremie t[879] = t.copperajah t[884] = t.duraludon return t
-- resty-gitweb@git/read_blob.lua -- Opens and reads blob by filename and rev -- Copyright (c) 2020 Joshua 'joshuas3' Stockin -- <https://git.joshstock.in/resty-gitweb> -- This software is licensed under the MIT License. local ffi = require("ffi") local bit = require("bit") local git2_error = require("git/git2_error") local _M = function(repo_obj, rev, file_path) local err = 0 -- Get tree root local tree = ffi.new("git_object*[1]") err = git2.git_revparse_single(ffi.cast("git_object**", tree), repo_obj, rev) git2_error(err, "Failed to look up tree from rev name") tree = tree[0] -- Get tree entry object (blob) local blob = ffi.new("git_object*[1]") err = git2.git_object_lookup_bypath(ffi.cast("git_object**", blob), tree, file_path, git2.GIT_OBJECT_BLOB) git2_error(err, "Failed to look up blob") blob = ffi.cast("git_blob*", blob[0]) -- Get blob content local buf = ffi.new("git_buf") err = git2.git_blob_filtered_content(buf, blob, file_path, 0) git2_error(err, "Failed to filter blob") local raw = ffi.string(buf.ptr, buf.size) local is_binary = git2.git_blob_is_binary(blob) == 1 -- Free everything git2.git_buf_free(buf) git2.git_blob_free(blob) git2.git_object_free(tree) return raw, is_binary end return _M
---- -- @file WorldSQLite ---- Brief description. -- <#Description#> -- @return <#return value description#> function WorldSQLite:WorldSQLite() end ---- Brief description. -- <#Description#> -- @param database_name <#database_name description#> -- @return <#return value description#> function WorldSQLite:openDatabase(database_name) end ---- Brief description. -- <#Description#> -- @param key <#key description#> -- @return <#return value description#> function WorldSQLite:getBool(key) end ---- Brief description. -- <#Description#> -- @param key <#key description#> -- @param value <#value description#> -- @return <#return value description#> function WorldSQLite:setBool(key, value) end ---- Brief description. -- <#Description#> -- @param key <#key description#> -- @return <#return value description#> function WorldSQLite:getInt(key) end ---- Brief description. -- <#Description#> -- @param key <#key description#> -- @param value <#value description#> -- @return <#return value description#> function WorldSQLite:setInt(key, value) end ---- Brief description. -- <#Description#> -- @param key <#key description#> -- @return <#return value description#> function WorldSQLite:getFloat(key) end ---- Brief description. -- <#Description#> -- @param key <#key description#> -- @param value <#value description#> -- @return <#return value description#> function WorldSQLite:setFloat(key, value) end ---- Brief description. -- <#Description#> -- @param key <#key description#> -- @return <#return value description#> function WorldSQLite:getString(key) end ---- Brief description. -- <#Description#> -- @param key <#key description#> -- @param value <#value description#> -- @return <#return value description#> function WorldSQLite:setString(key, value) end ---- Brief description. -- <#Description#> -- @param filename <#filename description#> -- @param buffer <#buffer description#> -- @return <#return value description#> function WorldSQLite:createFile(filename, buffer) end ---- Brief description. -- <#Description#> -- @param filename <#filename description#> -- @param filename <#filename description#> -- @param offset <#offset description#> -- @param size <#size description#> -- @param buffer <#buffer description#> -- @return <#return value description#> function WorldSQLite:updateFile(filename, filename, offset, size, buffer) end ---- Brief description. -- <#Description#> -- @param filename <#filename description#> -- @return <#return value description#> function WorldSQLite:deleteFile(filename) end ---- Brief description. -- <#Description#> -- @param void < -- @param size <#size description#> -- @return <#return value description#> function NJLI.WorldSQLite.setBuffer(void, size) end ---- Brief description. -- <#Description#> -- @return <#return value description#> function NJLI.WorldSQLite.createBuffer() end ---- Brief description. -- <#Description#> -- @return <#return value description#> function NJLI.WorldSQLite.deleteBuffer() end ---- Brief description. -- @return <#return value description#> function NJLI.WorldSQLite.WorldSQLite() end ---- Brief description. -- <#Description#> -- @return <#return value description#> function NJLI.WorldSQLite.operator=() end
function updateHudClock() -- watch cellphone PDA if exports.global:hasItem(getLocalPlayer(), 17) or exports.global:hasItem(getLocalPlayer(), 2) or exports.global:hasItem(getLocalPlayer(), 96) then showPlayerHudComponent("clock", true) else showPlayerHudComponent("clock", false) end end addEvent ( "updateHudClock", true ) addEventHandler ( "updateHudClock", getRootElement(), updateHudClock )
--[[ © CloudSixteen.com do not share, re-distribute or modify without permission of its author ([email protected]). Clockwork was created by Conna Wiles (also known as kurozael.) http://cloudsixteen.com/license/clockwork.html --]] local Clockwork = Clockwork; Clockwork.disease = Clockwork.kernel:NewLibrary("Disease"); Clockwork.disease.stored = Clockwork.disease.stored or {}; Clockwork.disease.stored.diseases = Clockwork.disease.stored.diseases or {}; Clockwork.disease.stored.symptoms = Clockwork.disease.stored.symptoms or {}; --[[ @codebase Server @details A function to create a new disease. @param {Unknown} Missing description for uniqueID. @returns {Unknown} --]] function Clockwork.disease:New(uniqueID) if (uniqueID) then if (!self:IsValid(uniqueID)) then self.stored.diseases[uniqueID] = {}; else ErrorNoHalt("Attempting to add already existing disease '"..uniqueID.."'."); end; else ErrorNoHalt("Attempting to add nil disease."); end; end; --[[ @codebase Server @details A function to delete a disease. @param {Unknown} Missing description for uniqueID. @returns {Unknown} --]] function Clockwork.disease:Delete(uniqueID) if (uniqueID) then if (self:IsValid(uniqueID)) then self.stored.diseases[uniqueID] = nil; else ErrorNoHalt("Attempting to delete invalid disease '"..uniqueID.."'."); end; else ErrorNoHalt("Attempting to delete nil disease."); end; end; --[[ @codebase Server @details A function to create a new symptom. @param {Unknown} Missing description for uniqueID. @param {Unknown} Missing description for callback. @returns {Unknown} --]] function Clockwork.disease:NewSymptom(uniqueID, callback) if (uniqueID) then if (!self:IsValidSymptom(uniqueID)) then self.stored.symptoms[uniqueID] = callback; else ErrorNoHalt("Attempting to add already existing symptom '"..uniqueID.."'."); end; else ErrorNoHalt("Attempting to add nil symptom."); end; end; --[[ @codebase Server @details A function to add a symptom to a disease. @param {Unknown} Missing description for diseaseID. @param {Unknown} Missing description for symptomID. @returns {Unknown} --]] function Clockwork.disease:AddSymptom(diseaseID, symptomID) if (diseaseID) then if (self:IsValid(diseaseID)) then if (symptomID) then if (self:IsValidSymptom(symptomID)) then if (!table.HasValue(self.stored.diseases[diseaseID], symptomID)) then table.insert(self.stored.diseases[diseaseID], symptomID); end; else ErrorNoHalt("Attempting to add invalid symptom '"..symptomID.."' to disease '"..diseaseID.."'."); end; else ErrorNoHalt("Attempting to add nil symptom to disease '"..diseaseID.."'."); end; else ErrorNoHalt("Attempting to add symptom to invalid disease '"..diseaseID.."'."); end; else ErrorNoHalt("Attempting to add symptom to nil disease."); end; end; --[[ @codebase Server @details A function to remove a condition from a disease. @param {Unknown} Missing description for diseaseID. @param {Unknown} Missing description for symptomID. @returns {Unknown} --]] function Clockwork.disease:RemoveSymptom(diseaseID, symptomID) if (diseaseID) then if (self:IsValid(diseaseID)) then if (symptomID) then if (self:IsValidSymptom(symptomID)) then table.RemoveByValue(self.stored.diseases[diseaseID], symptomID); else ErrorNoHalt("Attempting to remove invalid symptom '"..symptomID.."' from disease '"..diseaseID.."'."); end; else ErrorNoHalt("Attempting to remove nil symptom from disease '"..diseaseID.."'."); end; else ErrorNoHalt("Attempting to remove symptom from invalid disease '"..diseaseID.."'."); end; else ErrorNoHalt("Attempting to remove symptom from nil disease."); end; end; --[[ @codebase Server @details A function to delete a symptom. @param {Unknown} Missing description for uniqueID. @returns {Unknown} --]] function Clockwork.disease:DeleteSymptom(uniqueID) if (uniqueID) then if (self:IsValidSymptom(uniqueID)) then self.stored.symptoms[uniqueID] = nil; for k, v in pairs(Clockwork.disease:GetAll()) do table.RemoveByValue(v, uniqueID); end; else ErrorNoHalt("Attempting to delete invalid symptom '"..uniqueID.."'."); end; else ErrorNoHalt("Attempting to delete nil symptom."); end; end; --[[ @codebase Server @details A function to get all of a disease's symptomps. @param {Unknown} Missing description for diseaseID. @returns {Unknown} --]] function Clockwork.disease:GetSymptoms(diseaseID) if (diseaseID) then if (self:IsValid(diseaseID)) then local symptoms = {}; for k, v in pairs(self.stored.diseases[diseaseID]) do symptoms[v] = self.stored.symptoms[v]; end; return symptoms; else ErrorNoHalt("Attempting to get symptoms of nonexistant disease '"..diseaseID.."'."); end; else ErrorNoHalt("Attempting to get symptoms of nil disease."); end end; --[[ @codebase Server @details A function to get if a disease is valid. @param {Unknown} Missing description for diseaseID. @returns {Unknown} --]] function Clockwork.disease:IsValid(diseaseID) if (self.stored.diseases[diseaseID]) then return true; else return false; end; end; --[[ @codebase Server @details A function to get if a disease is valid. @param {Unknown} Missing description for symptomID. @returns {Unknown} --]] function Clockwork.disease:IsValidSymptom(symptomID) if (self.stored.symptoms[symptomID]) then return true; else return false; end; end; --[[ @codebase Server @details A function to get all diseases. @returns {Unknown} --]] function Clockwork.disease:GetAll() return self.stored.diseases; end; --[[ @codebase Server @details A function to get all symptoms. @returns {Unknown} --]] function Clockwork.disease:GetAllSymptoms() return self.stored.symptoms; end;
package.path = "../?.lua;"..package.path; --[[ Generate computer keyboard layouts from some structured information You would want to do this to play with generating new graphics that represent a keyboard. Usage: luajit vkeyboardgen.lua outfilename.lua --]] local vkeys = require("vkeys") local ansikeyLayout = { { {pos = 1, x=0, row = 0, scale={x=1, y=1}, caption = "Esc", vkey=vkeys.VK_ESCAPE}; {pos = 2, x=1, row = 0, scale={x=1, y=1}, caption = "F1", vkey=vkeys.VK_F1}; {pos = 3, x=0, row = 0, scale={x=1, y=1}, caption = "F2", vkey=vkeys.VK_F2}; {pos = 4, x=0, row = 0, scale={x=1, y=1}, caption = "F3", vkey=vkeys.VK_F3}; {pos = 5, x=0, row = 0, scale={x=1, y=1}, caption = "F4", vkey=vkeys.VK_F4}; {pos = 6, x=0.5, row = 0, scale={x=1, y=1}, caption = "F5", vkey=vkeys.VK_F5}; {pos = 7, x=0, row = 0, scale={x=1, y=1}, caption = "F6", vkey=vkeys.VK_F6}; {pos = 8, x=0, row = 0, scale={x=1, y=1}, caption = "F7", vkey=vkeys.VK_F7}; {pos = 9, x=0, row = 0, scale={x=1, y=1}, caption = "F8", vkey=vkeys.VK_F8}; {pos = 10, x=0.5, row = 0, scale={x=1, y=1}, caption = "F9", vkey=vkeys.VK_F9}; {pos = 11, x=0, row = 0, scale={x=1, y=1}, caption = "F10", vkey=vkeys.VK_F10}; {pos = 12, x=0, row = 0, scale={x=1, y=1}, caption = "F11", vkey=vkeys.VK_F11}; {pos = 13, x=0, row = 0, scale={x=1, y=1}, caption = "F12", vkey=vkeys.VK_F12}; }; { {pos = 1, x=0, row = 1, scale={x=1, y=1}, caption = "`", vkey=0}; {pos = 2, x=0, row = 1, scale={x=1, y=1}, caption = "1",vkey=vkeys.VK_1}; {pos = 3, x=0, row = 1, scale={x=1, y=1}, caption = "2",vkey=vkeys.VK_2}; {pos = 4, x=0, row = 1, scale={x=1, y=1}, caption = "3",vkey=vkeys.VK_3}; {pos = 5, x=0, row = 1, scale={x=1, y=1}, caption = "4",vkey=vkeys.VK_4}; {pos = 6, x=0, row = 1, scale={x=1, y=1}, caption = "5",vkey=vkeys.VK_5}; {pos = 7, x=0, row = 1, scale={x=1, y=1}, caption = "6",vkey=vkeys.VK_6}; {pos = 8, x=0, row = 1, scale={x=1, y=1}, caption = "7",vkey=vkeys.VK_7}; {pos = 9, x=0, row = 1, scale={x=1, y=1}, caption = "8",vkey=vkeys.VK_8}; {pos = 10, x=0, row = 1, scale={x=1, y=1}, caption = "9",vkey=vkeys.VK_9}; {pos = 11, x=0, row = 1, scale={x=1, y=1}, caption = "0",vkey=vkeys.VK_0}; {pos = 12, x=0, row = 1, scale={x=1, y=1}, caption = "-",vkey=0}; {pos = 13, x=0, row = 1, scale={x=1, y=1}, caption = "=",vkey=0}; {pos = 14, x=0, row = 1, scale={x=2, y=1}, caption = "Backspace",vkey=vkeys.VK_BACK}; }; { {pos = 1, x=0, row = 2, scale={x=1.5, y=1}, caption ="Tab", vkey=vkeys.VK_TAB}; {pos = 2, x=0, row = 2, scale={x=1, y=1}, caption = "Q", vkey=vkeys.VK_Q}; {pos = 3, x=0, row = 2, scale={x=1, y=1}, caption ="W", vkey=vkeys.VK_W}; {pos = 4, x=0, row = 2, scale={x=1, y=1}, caption = "E", vkey=vkeys.VK_E}; {pos = 5, x=0, row = 2, scale={x=1, y=1}, caption = "R", vkey=vkeys.VK_R}; {pos = 6, x=0, row = 2, scale={x=1, y=1}, caption = "T", vkey=vkeys.VK_T}; {pos = 7, x=0, row = 2, scale={x=1, y=1}, caption = "Y", vkey=vkeys.VK_Y}; {pos = 8, x=0, row = 2, scale={x=1, y=1}, caption = "U", vkey=vkeys.VK_U}; {pos = 9, x=0, row = 2, scale={x=1, y=1}, caption = "I", vkey=vkeys.VK_I}; {pos = 10, x=0, row = 2, scale={x=1, y=1}, caption = "O", vkey=vkeys.VK_O}; {pos = 11, x=0, row = 2, scale={x=1, y=1}, caption = "P", vkey=vkeys.VK_P}; {pos = 12, x=0, row = 2, scale={x=1, y=1}, caption = "[", vkey=vkeys.VK_OEM_4}; {pos = 13, x=0, row = 2, scale={x=1, y=1}, caption = "]", vkey=vkeys.VK_OEM_6}; {pos = 14, x=0, row = 2, scale={x=1.5, y=1}, caption = "\\", vkey=vkeys.VK_OEM_5}; }; { {pos = 1, x=0, row = 3, scale={x=1.75, y=1}, caption = "Caps", vkey=vkeys.VK_CAPITAL}; {pos = 2, x=0, row = 3, scale={x=1, y=1}, caption = "A", vkey=vkeys.VK_A}; {pos = 3, x=0, row = 3, scale={x=1, y=1}, caption = "S", vkey=vkeys.VK_S}; {pos = 4, x=0, row = 3, scale={x=1, y=1}, caption = "D", vkey=vkeys.VK_D}; {pos = 5, x=0, row = 3, scale={x=1, y=1}, caption = "F", vkey=vkeys.VK_F}; {pos = 6, x=0, row = 3, scale={x=1, y=1}, caption = "G", vkey=vkeys.VK_G}; {pos = 7, x=0, row = 3, scale={x=1, y=1}, caption = "H", vkey=vkeys.VK_H}; {pos = 8, x=0, row = 3, scale={x=1, y=1}, caption = "J", vkey=vkeys.VK_J}; {pos = 9, x=0, row = 3, scale={x=1, y=1}, caption = "K", vkey=vkeys.VK_K}; {pos = 10, x=0, row = 3, scale={x=1, y=1}, caption = "L", vkey=vkeys.VK_L}; {pos = 11, x=0, row = 3, scale={x=1, y=1}, caption = ";", vkey=vkeys.VK_OEM_1}; {pos = 12, x=0, row = 3, scale={x=1, y=1}, caption = "'", vkey=vkeys.VK_OEM_7}; {pos = 13, x=0, row = 3, scale={x=2.25, y=1}, caption = "Enter", vkey=vkeys.VK_RETURN}; }; { {pos = 1, x=0, row = 4, scale={x=2.25, y=1}, caption = "Shift", vkey=vkeys.VK_LSHIFT}; {pos = 2, x=0, row = 4, scale={x=1, y=1}, caption = 'Z', vkey=vkeys.VK_Z}; {pos = 3, x=0, row = 4, scale={x=1, y=1}, caption = 'X', vkey=vkeys.VK_X}; {pos = 4, x=0, row = 4, scale={x=1, y=1}, caption = 'C', vkey=vkeys.VK_C}; {pos = 5, x=0, row = 4, scale={x=1, y=1}, caption = 'V', vkey=vkeys.VK_V}; {pos = 6, x=0, row = 4, scale={x=1, y=1}, caption = 'B', vkey=vkeys.VK_B}; {pos = 7, x=0, row = 4, scale={x=1, y=1}, caption = 'N', vkey=vkeys.VK_N}; {pos = 8, x=0, row = 4, scale={x=1, y=1}, caption = 'M', vkey=vkeys.VK_M}; {pos = 9, x=0, row = 4, scale={x=1, y=1}, caption = ",", vkey=vkeys.VK_OEM_COMMA}; {pos = 10, x=0, row = 4, scale={x=1, y=1}, caption = ".", vkey=vkeys.VK_OEM_PERIOD}; {pos = 11, x=0, row = 4, scale={x=1, y=1}, caption = "/", vkey=vkeys.VK_OEM_2}; {pos = 12, x=0, row = 4, scale={x=2.75, y=1}, caption = "Shift", vkey=vkeys.VK_RSHIFT}; }; { {pos = 1, x=0, y=0, row = 5, scale={x=1.25, y=1}, caption = "Ctrl", vkey=vkeys.VK_LCONTROL}; {pos = 2, x=0, y=0, row = 5, scale={x=1.25, y=1}, caption = "Win", vkey=vkeys.VK_LWIN}; {pos = 3, x=0, y=0, row = 5, scale={x=1.25, y=1}, caption = "Alt", vkey=vkeys.VK_MENU}; {pos = 4, x=0, y=0, row = 5, scale={x=6.25, y=1}, caption = "Space", vkey=vkeys.VK_SPACE}; {pos = 5, x=0, y=0, row = 5, scale={x=1.25, y=1}, caption = "Alt", vkey=vkeys.VK_MENU}; {pos = 6, x=0, y=0, row = 5, scale={x=1.25, y=1}, caption = "Win", vkey=vkeys.VK_RWIN}; {pos = 7, x=0, y=0, row = 5, scale={x=1.25, y=1}, caption = "Menu", vkey=vkeys.VK_RMENU}; {pos = 8, x=0, y=0, row = 5, scale={x=1.25, y=1}, caption = "Ctrl", vkey=vkeys.VK_RCONTROL}; } } local outputfilename = arg[1] print("OUT: ", outputfilename) if not outputfilename then return false end local of = io.open(outputfilename, "w+") local function generateFrames(keyLayout, unit, obj) unit = unit or 40 obj = obj or {} local xmargin = 4 local xgap = 0 local rowoffset = 4 local ygap = 2 for rowidx, row in ipairs(keyLayout) do local x = xmargin; if rowidx == 2 then rowoffset = unit end for _, key in ipairs(row) do x = x + key.x*unit + xgap local y = rowoffset + key.row*unit + ygap local cx = unit*key.scale.x local cy = unit*key.scale.y local keyloc = {vkey = key.vkey, frame={x=x, y=y, width=cx, height=cy}, caption=key.caption or ""} table.insert(obj, keyloc) local caption = key.caption or '' if caption == '\\' or caption == '"' then caption = '\\'..caption end of:write(string.format('{vkey = 0x%02x, frame = {x=%3.2f, y=%3.2f, width=%3.2f, height=%3.2f}, caption="%s"};\n', key.vkey, x, y, cx, cy, caption)) x = x + cx end end return obj end generateFrames(ansikeyLayout) io.close(of)
local crouched = false Citizen.CreateThread( function() while true do Citizen.Wait( 1 ) local ped = GetPlayerPed( -1 ) if ( DoesEntityExist( ped ) and not IsEntityDead( ped ) ) then DisableControlAction( 0, 36, true ) -- INPUT_DUCK if ( not IsPauseMenuActive() ) then if ( IsDisabledControlJustPressed( 0, 36 ) ) then RequestAnimSet( "move_ped_crouched" ) while ( not HasAnimSetLoaded( "move_ped_crouched" ) ) do Citizen.Wait( 100 ) end if ( crouched == true ) then ResetPedMovementClipset( ped, 0 ) crouched = false elseif ( crouched == false ) then SetPedMovementClipset( ped, "move_ped_crouched", 0.25 ) crouched = true end end end end end end ) Citizen.CreateThread(function() local dict = "missminuteman_1ig_2" RequestAnimDict(dict) while not HasAnimDictLoaded(dict) do Citizen.Wait(100) end local handsup = false while true do Citizen.Wait(0) if IsControlJustPressed(1, 323) and GetLastInputMethod(2) then --Start holding X if not handsup then TaskPlayAnim(GetPlayerPed(-1), dict, "handsup_enter", 8.0, 8.0, -1, 50, 0, false, false, false) handsup = true else handsup = false ClearPedTasks(GetPlayerPed(-1)) end end end end)
return function() local PlayerGui = game:GetService("Players").LocalPlayer.PlayerGui local Roact = require(game.ReplicatedStorage.Roact) --[[ A search bar with an icon and a text box When the icon is clicked, the TextBox captures focus ]] local SearchBar = Roact.Component:extend("SearchBar") function SearchBar:init() self.textBoxRef = Roact.createRef() end function SearchBar:render() return Roact.createElement("Frame", { Size = UDim2.new(0, 300, 0, 50), Position = UDim2.new(0.5, 0, 0.5, 0), AnchorPoint = Vector2.new(0.5, 0.5), }, { SearchIcon = Roact.createElement("TextButton", { Size = UDim2.new(0, 50, 0, 50), AutoButtonColor = false, Text = "=>", -- Handle click events on the search button [Roact.Event.Activated] = function() print("Button clicked; have the TextBox capture focus") self.textBoxRef:getValue():CaptureFocus() end }), SearchTextBox = Roact.createElement("TextBox", { Size = UDim2.new(1, -50, 1, 0), Position = UDim2.new(0, 50, 0, 0), -- Use Roact.Ref to get a reference to the underlying object [Roact.Ref] = self.textBoxRef }), }) end local app = Roact.createElement("ScreenGui", nil, { SearchBar = Roact.createElement(SearchBar), }) local handle = Roact.mount(app, PlayerGui) local function stop() Roact.unmount(handle) end return stop end
--[[-------------------------------------------------------------------]]--[[ Copyright wiltOS Technologies LLC, 2020 Contact: www.wiltostech.com ----------------------------------------]]-- wOS = wOS or {} wOS.ALCS = wOS.ALCS or {} wOS.ALCS.ExecSys = wOS.ALCS.ExecSys or {} local dir = "wos/advswl/execsys" AddCSLuaFile( dir .. "/core/cl_core.lua" ) AddCSLuaFile( dir .. "/core/cl_player_funcs.lua" ) AddCSLuaFile( dir .. "/core/cl_net.lua" ) wOS.ALCS:ServerInclude( dir .. "/core/sv_core.lua" ) wOS.ALCS:ServerInclude( dir .. "/core/sv_player_funcs.lua" ) wOS.ALCS:ServerInclude( dir .. "/core/sv_net.lua" ) wOS.ALCS:ServerInclude( dir .. "/core/sv_exec_register.lua" )
workspace "Raycaster" configurations { "Debug", "Release" } project "Raycaster" location "Raycaster" kind "ConsoleApp" language "C++" targetdir "Bin" objdir "Bin/Intermediates" files { "%{prj.name}/src/**.h", "%{prj.name}/src/**.hpp", "%{prj.name}/src/**.c", "%{prj.name}/src/**.cc", "%{prj.name}/src/**.cpp", "%{prj.name}/res/**.*", } includedirs { "Dependencies/includes" } libdirs { "Dependencies/libs" } links { "glfw3.lib", "gorilla.lib", "legacy_stdio_definitions.lib" } filter "configurations:Debug" symbols "On" filter "configurations:Release" optimize "On"
--[[ This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:26' using the latest game version. NOTE: This file should only be used as IDE support; it should NOT be distributed with addons! **************************************************************************** CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC. **************************************************************************** ]] ZO_CrownGemification_Shared = ZO_Object:Subclass() function ZO_CrownGemification_Shared:New(...) local object = ZO_Object.New(self) object:Initialize(...) return object end function ZO_CrownGemification_Shared:Initialize(listFragment, gemificationSlot, exitKeybindStripDescriptor) self.listFragment = listFragment self.gemificationSlot = gemificationSlot self.exitKeybindStripDescriptor = exitKeybindStripDescriptor CROWN_GEMIFICATION_MANAGER:RegisterCallback("GemifiableListChanged", function() self:OnGemifiableListChanged() end) CROWN_GEMIFICATION_MANAGER:RegisterCallback("GemifiableChanged", function(gemifiable) self:OnGemifiableChanged(gemifiable) end) self.refreshGroup = ZO_Refresh:New() self.refreshGroup:AddRefreshGroup("Gemifiable", { RefreshAll = function() self:RefreshList() end, RefreshSingle = function(gemifiable) self:RefreshGemifiable(gemifiable) end, }) self.listFragment:RegisterCallback("StateChange", function(oldState, newState) if newState == SCENE_FRAGMENT_SHOWING then self:OnShowing() elseif newState == SCENE_FRAGMENT_HIDDEN then self:OnHidden() end end) self.gemificationSlot:RegisterCallback("GemifiableChanged", function() if self.listFragment:IsShowing() then KEYBIND_STRIP:UpdateKeybindButtonGroup(self.sharedKeybindStripDescriptor, self.keybindStripId) end end) self:InitializeSharedKeybinds() end function ZO_CrownGemification_Shared:OnShowing() self:CleanRefreshGroupIfNecessary() self.gemificationSlot:SetGemifiable(nil) self.keybindStripId = KEYBIND_STRIP:PushKeybindGroupState() KEYBIND_STRIP:RemoveDefaultExit(self.keybindStripId) KEYBIND_STRIP:AddKeybindButton(self.exitKeybindStripDescriptor, self.keybindStripId) KEYBIND_STRIP:AddKeybindButtonGroup(self.sharedKeybindStripDescriptor, self.keybindStripId) end function ZO_CrownGemification_Shared:OnHidden() self.gemificationSlot:SetGemifiable(nil) KEYBIND_STRIP:RemoveKeybindButton(self.exitKeybindStripDescriptor, self.keybindStripId) KEYBIND_STRIP:RestoreDefaultExit(self.keybindStripId) KEYBIND_STRIP:RemoveKeybindButtonGroup(self.sharedKeybindStripDescriptor, self.keybindStripId) KEYBIND_STRIP:PopKeybindGroupState() self.keybindStripId = nil ZO_CrownCrates_FireStateMachineTrigger(ZO_CROWN_CRATE_TRIGGER_COMMANDS.GEMIFICATION_HIDDEN) end function ZO_CrownGemification_Shared:InitializeSharedKeybinds() self.sharedKeybindStripDescriptor = { { alignment = KEYBIND_STRIP_ALIGN_CENTER, name = GetString(SI_GEMIFICATION_EXTRACT), keybind = "UI_SHORTCUT_SECONDARY", enabled = function() return self.gemificationSlot:CanGemify() end, callback = function() self.gemificationSlot:GemifyOne() end, }, { alignment = KEYBIND_STRIP_ALIGN_CENTER, name = function() return zo_strformat(SI_GEMIFICATION_EXTRACT_ALL, self.gemificationSlot:GetGemifyAllCount()) end, keybind = "UI_SHORTCUT_TERTIARY", enabled = function() return self.gemificationSlot:CanGemify() end, callback = function() local gemifiable = self.gemificationSlot:GetGemifiable() local count = self.gemificationSlot:GetGemifyAllCount() local name = ZO_WHITE:Colorize(gemifiable.name) local gemTotal = gemifiable.gemTotal ZO_Dialogs_ShowPlatformDialog("EXTRACT_ALL_PROMPT", { gemificationSlot = self.gemificationSlot }, {mainTextParams = { count, name, gemTotal }}) end, } } end function ZO_CrownGemification_Shared:OnGemifiableListChanged() self.refreshGroup:RefreshAll("Gemifiable") self:CleanRefreshGroupIfNecessary() end function ZO_CrownGemification_Shared:OnGemifiableChanged(gemifiable) self.refreshGroup:RefreshSingle("Gemifiable", gemifiable) self:CleanRefreshGroupIfNecessary() end function ZO_CrownGemification_Shared:CleanRefreshGroupIfNecessary() if self.listFragment:IsShowing() then self.refreshGroup:UpdateRefreshGroups() end end function ZO_CrownGemification_Shared:RefreshList() KEYBIND_STRIP:UpdateKeybindButtonGroup(self.sharedKeybindStripDescriptor, self.keybindStripId) end function ZO_CrownGemification_Shared:RefreshGemifiable(gemifiable) KEYBIND_STRIP:UpdateKeybindButtonGroup(self.sharedKeybindStripDescriptor, self.keybindStripId) end function ZO_CrownGemification_Shared:InsertIntoScene() --Override end function ZO_CrownGemification_Shared:RemoveFromScene() --Override end
level={{2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 1, 1}, {2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, spawn={y=4.65, x=5.55}, width=60, height=40, exit={y=34.4, x=3.95}}
local format = {} local buffer = require("buffer") function format:getType() return "raster" end function format:isSupported(file) local signature = file:read(8) local version = string.byte(file:read(1)) return signature == "OGFIMAG\x03" and version == 2 end function format:decode(file) file:read(9) -- skip signature and version file:read(1) -- skip flags local numEntries = string.byte(file:read(1)) for i=1, numEntries do local type = string.unpack("<I1", file:read(1)) local length = string.unpack("<I4", file:read(4)) file:seek("cur", length) end end function format:encode(file, image) file:write("OGFIMAG\x03") -- signature file:write("\x02") -- version file:write("\x00") -- flags: image is not animated file:write("\x01") -- only one entry: Bitmap Image Data local entry = buffer.fromString("") entry:write(string.pack("<I2", image.width)) entry:write(string.pack("<I2", image.height)) entry:write(string.pack("<I1", 3)) -- bit depth = 24-bit entry:write(string.pack("<I1", 0)) -- no compression entry:write(string.pack("<I4", 0)) -- 0 offset = no palette entry:write(string.pack("<I4", image.width * image.height)) -- byte length for _, char in pairs(image.chars) do entry:write() end file:write(string.pack("<I1", 3)) -- entry type 3: Bitmap Image Data file:write(string.pack("<I4", entry.data:len())) file:write(entry.data) end return format
local scene; -- Scene* local window; -- Window* local camera; -- GameObject* local render; -- Render* local skybox; -- Skybox* local cameraComp; -- Camera* local editorGUIScript; -- Script* function CreateTreeScene() local cube_1 = scene:Instance("cube_1"); local cube_2 = scene:Instance("cube_2"); local cube_1_1 = scene:Instance("cube_1_1"); cube_1:AddChild(cube_1_1); local cube_1_2 = scene:Instance("cube_1_2"); cube_1:AddChild(cube_1_2); local cube_1_2_1 = scene:Instance("cube_1_2_1"); cube_1_2:AddChild(cube_1_2_1); end; function GeometryTest() local texture = Texture.Load("steel_cube.png", true, TextureType.Diffuse, TextureFilter.LINEAR); local cubeMesh = Mesh.Load("cube.obj", 0); render:RegisterTexture(texture); for a = 0, 50, 1 do for b = 0, 50, 1 do for g = 0, 0, 1 do local cube = scene:Instance("Cube"); local mesh; if (a == 0 and b == 0 and g == 0) then mesh = cubeMesh; else mesh = cubeMesh:Copy(); end; render:RegisterMesh(mesh); mesh:GetMaterial():SetBloom(true); mesh:GetMaterial():SetDiffuse(texture); mesh:GetMaterial():SetColor(Vector3.FMul(Material.RandomColor3(), 6.0)); cube:AddComponent(mesh:Base()); cube:GetTransform():Translate( Vector3.Sum( Vector3.Sum( Vector3.FMul(cube:GetTransform():Forward(), 8.0 * (a + 1)), Vector3.FMul(cube:GetTransform():Right(), 8.0 * (b + 1)) ), Vector3.FMul(cube:GetTransform():Up(), 8.0 * (g + 1)) ) ); end; end; end; collectgarbage() -- collect memory end; local childRotateGM = nil; function RotationTest() local texture = Texture.Load("steel_cube.png", true, TextureType.Diffuse, TextureFilter.LINEAR); --local texture = Texture.Load("brickwall.jpg", true, TextureType.Diffuse, TextureFilter.LINEAR); local mesh = Mesh.Load("cube.obj", 0); --local mesh = Mesh.Load("monkey_low.obj", 0); render:RegisterTexture(texture); -- first local cube_parent = scene:Instance("Cube parent"); render:RegisterMesh(mesh); mesh:GetMaterial():SetDiffuse(texture); mesh:GetMaterial():SetColor(Vector3.New(1, 2, 1)); cube_parent:AddComponent(mesh:Base()); --cube_parent:GetTransform():Translate( -- Vector3.FMul(cube_parent:GetTransform():Forward(), 2.0) --); -- first -- second local cube_child = scene:Instance("Cube child"); mesh = mesh:Copy(); render:RegisterMesh(mesh); mesh:GetMaterial():SetDiffuse(texture); mesh:GetMaterial():SetColor(Vector3.New(2, 1, 1)); cube_child:AddComponent(mesh:Base()); cube_child:GetTransform():Translate( Vector3.FMul(cube_child:GetTransform():Forward(), 4.0), true ); --cube_child:GetTransform():Translate(Vector3.FMul(cube_child:GetTransform():Up(), 2.0)); cube_parent:AddChild(cube_child); childRotateGM = cube_child; --cube_parent:GetTransform():SetScale(Vector3.New(0.01, 0.01, 0.01), true); -- second end function HierarchyTest() --local texture = Texture.Load("steel_cube.png", true, TextureType.Diffuse, TextureFilter.LINEAR); local texture = Texture.Load("brickwall.jpg", true, TextureType.Diffuse, TextureFilter.LINEAR); --local mesh = Mesh.Load("engine/cube.obj", 0); local mesh = Mesh.Load("skybox3.obj", 0); render:RegisterTexture(texture); -- first local cube_parent = scene:Instance("Cube parent"); render:RegisterMesh(mesh); mesh:GetMaterial():SetDiffuse(texture); mesh:GetMaterial():SetColor(Vector3.New(1, 2, 1)); cube_parent:AddComponent(mesh:Base()); -- first -- second local cube_child = scene:Instance("Cube child"); mesh = mesh:Copy(); render:RegisterMesh(mesh); mesh:GetMaterial():SetDiffuse(texture); mesh:GetMaterial():SetColor(Vector3.New(2, 1, 1)); cube_child:AddComponent(mesh:Base()); cube_child:GetTransform():Translate( Vector3.FMul(cube_child:GetTransform():Right(), 2.0), true ); cube_child:GetTransform():Translate( Vector3.FMul(cube_child:GetTransform():Forward(), 2.0), true ); cube_parent:AddChild(cube_child); -- second -- third local cube_child2 = scene:Instance("Cube child 2"); mesh = mesh:Copy(); render:RegisterMesh(mesh); mesh:GetMaterial():SetDiffuse(texture); mesh:GetMaterial():SetColor(Vector3.New(1, 1, 2)); cube_child2:AddComponent(mesh:Base()); cube_child2:GetTransform():Translate( Vector3.FMul(cube_child2:GetTransform():Right(), 2.0), true ); cube_child:AddChild(cube_child2); -- third end function LoadCamera() camera = scene:Instance("SceneCamera"); cameraComp = Camera.New(4); -- local winSize = window:GetWindowSize(); --cameraComp:SetFrameSize(winSize.x, winSize.y); cameraComp:SetFrameSize(1600, 900); cameraComp:SetDirectOutput(false); window:SetGUIEnabled(true); cameraComp:GetPostProcessing():SetBloom(true); cameraComp:GetPostProcessing():SetBloomIntensity(2.0); cameraComp:GetPostProcessing():SetBloomAmount(5); cameraComp:GetPostProcessing():SetGamma(0.8); camera:AddComponent(cameraComp:Base()); window:AddCamera(cameraComp); cameraComp:WaitBuffersCalculate(); collectgarbage() -- collect memory end; function Init() Debug.Log("Initializing main engine script..."); Script.this:ImportLib("Math"); Script.this:ImportLib("Engine"); Script.this:ImportLib("Graphics"); Script.this:ImportLib("GUI"); scene = Scene.Get(); window = Window.Get(); render = Render.Get(); editorGUIScript = Script.this:LoadScript("editor", true); window:SetCanvas(Canvas.Load(editorGUIScript)); collectgarbage() -- collect memory end; function LoadTools() local rings = Mesh.LoadAll("Engine/ring 3.0.obj"); -- List<Mesh*> local arrows = Mesh.LoadAll("Engine/arrows.obj"); -- List<Mesh*> Mesh.Inverse(rings); --render:RegisterMeshes(arrows); render:GetManipulationTool():SetRings(rings); render:GetManipulationTool():SetArrows(arrows); end; function Start() Debug.Log("Starting main engine script..."); --window:Resize(3840, 2160); --window:Resize(1920, 1080); --window:Resize(1920, 1060); --window:Resize(1680, 1050); window:Resize(1600, 900); window:SetFullScreen(false); --window:Resize(4086, 900); window:CentralizeWindow(); skybox = Skybox.Load( "Sea.jpg", -- images name "engine/skybox" -- shader name ); render:SetSkybox(skybox); -------------------------------------- LoadCamera(); --CreateTreeScene(); HierarchyTest(); --RotationTest(); --GeometryTest(); --LoadTools(); ------------------------------------- render:SetGridEnabled(true); Stack.PushScene(editorGUIScript, scene); Stack.PushCamera(editorGUIScript, cameraComp); editorGUIScript:Call("SetIndices"); --cameraComp:SetDirectOutput(true); --window:SetGUIEnabled(false); --Stack.PushBool(editorGUIScript, false); --editorGUIScript:Call("Enabled"); collectgarbage() -- collect memory end; function MouseUpdate() local dir = Input.GetMouseDrag(); local wheel = Input.GetMouseWheel(); if (wheel ~= 0) then local forward = camera:GetTransform():Forward(); camera:GetTransform():Translate(Vector3.FMul(forward, wheel / -10.0), false); end; if (Input.GetKey(KeyCode.MouseRight)) then --camera:GetTransform():Rotate(Vector3.New(dir.y / -10.0, dir.x / -10.0, 0.0)); camera:GetTransform():Rotate(Vector3.New(dir.y / -10.0, dir.x / -10.0, 0.0), false); end; if (Input.GetKey(KeyCode.MouseMiddle)) then local right = camera:GetTransform():Right(); local up = camera:GetTransform():Up(); camera:GetTransform():Translate( Vector3.Sum( Vector3.FMul(up, dir.y / 100.0), Vector3.FMul(right, dir.x / -100.0) --Vector3.FMul(right, dir.x / -100.0) ), false ); end; end; function FixedUpdate() end; function KeysUpdate() if (Input.GetKeyDown(KeyCode.W)) then --render:GetManipulationTool():SetOperation(Operation.Translate); GUIWindow.SetGuizmoTool(1); else if (Input.GetKeyDown(KeyCode.E)) then --render:GetManipulationTool():SetOperation(Operation.Rotate); GUIWindow.SetGuizmoTool(2); else if (Input.GetKeyDown(KeyCode.R)) then GUIWindow.SetGuizmoTool(3); end end end if (Input.GetKeyDown(KeyCode.P)) then local enabled = cameraComp:IsDirectOutput(); cameraComp:SetDirectOutput(not enabled); window:SetGUIEnabled(enabled); Stack.PushBool(editorGUIScript, enabled); editorGUIScript:Call("Enabled"); end; if (Input.GetKeyDown(KeyCode.B)) then local enabled = cameraComp:GetPostProcessing():GetBloomEnabled(); cameraComp:GetPostProcessing():SetBloom(not enabled); end; --if (Input.GetKeyDown(KeyCode.F)) then scene:Print(); end; --if (Input.GetKeyDown(KeyCode.C)) then Debug.MakeCrash(); end; end function Update() MouseUpdate(); KeysUpdate(); collectgarbage() -- collect memory end; function Close() Debug.Log("Close main engine script..."); Stack.PushBool(editorGUIScript, false); editorGUIScript:Call("Enabled"); if (not (skybox == nil)) then skybox:AwaitDestroy(); skybox:Free(); end; if (not (scene == nil)) then scene:Destroy(); scene:Free(); end; collectgarbage() -- collect memory end;
local v1 = _ENV["require"]("lattice.cell") local v2 = { } v2[ "InitWithFromNode" ] = function(v3, v4) local v5 = { _fromNode = v4, _executable = false } _ENV["setmetatable"](v5, v3) v3[ "__index" ] = v3 return v5 end v2[ "InitStartEdge" ] = function(v6) local v7 = { tag = "StartNode", outCell = v1:InitWithScope({ }) } return v6:InitWithFromNode(v7) end v2[ "isExecutable" ] = function(v8) return v8["_executable"] end v2[ "setExecutable" ] = function(v9) v9[ "_executable" ] = true end v2[ "reset" ] = function(v10) v10[ "_executable" ] = false end v2[ "getFromNode" ] = function(v11) return v11["_fromNode"] end v2[ "getToNode" ] = function(v12) return (v12["_toNode"] or false) end v2[ "setToNode" ] = function(v13, v14) v13[ "_toNode" ] = v14 end v2[ "getLatticeCell" ] = function(v15) return v15["_fromNode"]["outLatticeCell"] end return v2
local current_folder = ... and (...):match '(.-%.?)[^%.]+$' or '' local renderutils = require(current_folder .. ".Renderutils") local Text = require(current_folder .. ".Text") local imgui = require(current_folder .. ".imgui") local Button = {} -- Returns, in this order, if the button was just pressed, if the button is still -- being pressed, and if the button is hovered. local function handle_input(state, x, y, w, h, options) assert(state.input) if imgui.is_mouse_in_rect(state, x, y, w, h) then local pressed if state.input.mouse.buttons[1] and state.input.mouse.buttons[1].pressed then pressed = true else pressed = false end -- We consider this button clicked when the mouse is in the button's area -- and the left mouse button was just clicked, or released local clicked = state.input.mouse.buttons[1] if options and options.trigger_on_release then clicked = clicked and state.input.mouse.buttons[1].releases > 0 else clicked = clicked and state.input.mouse.buttons[1].presses > 0 end return clicked, pressed, true end end -- Draws a button at the indicated position. Returns, in this, order, whether -- it was just triggered, whether it is active, and whether the mouse is inside -- the button's bounding box. Button.draw = function(state, x, y, w, h, label, iconquad, options) x = x or state.layout.next_x y = y or state.layout.next_y local _, _, iconwidth, iconheight = unpack(iconquad and {iconquad:getViewport()} or {}) local labelwidth, labelheight = label and Text.min_width(state, label) or nil, label and 16 or nil local margin_x = 4 if not w then w = (label and (labelwidth + margin_x) or 0) + (iconquad and iconwidth + 3 or 0) + (not label and 3 or not iconquad and margin_x or 0) end if not h then h = math.max(label and labelheight + 2 or 0, iconquad and iconheight + 6 or 0) end -- Also, the button cannot be smaller than the area covered by the border w = math.max(w, 6) h = math.max(h, 6) -- Draw border love.graphics.setColor(255, 255, 255, 255) local quads if options and options.disabled then quads = state.style.quads.button_border_disabled else quads = state.style.quads.button_border end renderutils.draw_border(state.style.stylesheet, quads, x, y, w, h, 3) -- Print label if not options then options = {} end if not options.font_color then options.font_color = state.style.palette.shades.white end local next_x = x if iconquad then love.graphics.setColor(255, 255, 255, 255) local margin_y = (h - iconheight) / 2 love.graphics.draw(state.style.stylesheet, iconquad, x + 3, y + margin_y) next_x = next_x + iconwidth end if label then local margin_y = (h - labelheight) / 2 Text.draw(state, next_x + margin_x, y + margin_y, w - 2*margin_x, h - 2*margin_y, label, options) end state.layout.adv_x = w state.layout.adv_y = h -- Highlight if mouse is over button local clicked, pressed, hovered if state and state.input and not (options and options.disabled) then clicked, pressed, hovered = handle_input(state, x, y, w, h, options) end pressed = pressed or options and options.pressed if pressed then love.graphics.setColor(0, 0, 0, 70) elseif hovered then love.graphics.setColor(255, 255, 255, 70) end if pressed or hovered then love.graphics.rectangle("fill", x + 2, y + 2, w - 4, h - 4) end love.graphics.setColor(255, 255, 255, 255) return clicked, pressed, hovered end -- Draws a borderless button. Here, icons needs to be a table containing quads -- for keys "default", "hovered" and "pressed". Button.draw_flat = function(state, x, y, w, h, label, icons, options) x = x or state.layout.next_x y = y or state.layout.next_y assert(not icons or icons.default and icons.hovered and icons.pressed) local _, _, iconwidth, iconheight = unpack(icons and {icons.default:getViewport()} or {}) local labelwidth, labelheight = label and Text.min_width(state, label) or nil, label and 16 or nil if not w then w = (label and labelwidth+2 or 0) + (icons and iconwidth or 0) end if not h then h = math.max(label and labelheight or 0, icons and iconheight or 0) end love.graphics.setColor(255, 255, 255, 255) -- Handle input before drawing so that we can decide which quad should be drawn local clicked, pressed, hovered if state and state.input and not (options and options.disabled) then clicked, pressed, hovered = handle_input(state, x, y, w, h, options) end pressed = pressed or options and options.pressed if pressed then local pressed_color = options and options.bg_color_pressed or state.style.palette.shades.darkest(90) love.graphics.setColor(pressed_color) elseif hovered then local hovered_color = options and options.bg_color_hovered or state.style.palette.shades.brightest love.graphics.setColor(hovered_color) elseif options and options.bg_color_default then love.graphics.setColor(options.bg_color_default) end if label and (pressed or hovered) and not (options and options.disabled) or options and options.bg_color_default then love.graphics.rectangle("fill", x, y, w, h) end love.graphics.setColor(255, 255, 255, 255) -- Print label if not options then options = {} end if not options.font_color then options.font_color = state.style.palette.shades.white end local next_x = x if icons then local quad if pressed then quad = icons.pressed elseif hovered then quad = icons.hovered else quad = icons.default end love.graphics.setColor(255, 255, 255, 255) local margin_y = (h - iconheight) / 2 love.graphics.draw(state.style.stylesheet, quad, x, y + margin_y) next_x = next_x + iconwidth + 2 -- small margin between icon and label end if label then local margin_y = (h - labelheight) / 2 Text.draw(state, next_x + 1, y + margin_y, w, h, label, options) end state.layout.adv_x = w state.layout.adv_y = h return clicked, pressed, hovered end setmetatable(Button, { __call = Button.new }) return Button
x = {[10] = 20} return x
--- Module for generating 'any' random value. -- @lqc.generators.any -- @alias new local lqc_gen = require 'lqc.lqc_gen' local tbl = require 'lqc.generators.table' local int = require 'lqc.generators.int' local float = require 'lqc.generators.float' local str = require 'lqc.generators.string' local bool = require 'lqc.generators.bool' --- Creates a new generator that can generate a table, string, int, float or bool. -- @param optional_samplesize Amount of times the property is tested, used to guide -- the randomization process. -- @return generator that can generate 1 of the previously mentioned types in -- the description local function new(optional_samplesize) return lqc_gen.oneof { tbl(optional_samplesize), str(optional_samplesize), int(optional_samplesize), float(), bool() } end return new
hook.Add("XYZShitDBConnected", "xyz_pnc_db", function() XYZShit.DataBase.Query("SELECT * FROM pnc_arrests", function(q) for k, v in pairs(q) do if not PNC.Core.Arrests[v.userid] then PNC.Core.Arrests[v.userid] = {} end PNC.Core.Arrests[v.userid][v.time] = util.JSONToTable(v.charges) end end) XYZShit.DataBase.Query("SELECT * FROM pnc_tickets", function(q) for k, v in pairs(q) do if not PNC.Core.Tickets[v.userid] then PNC.Core.Tickets[v.userid] = {} end PNC.Core.Tickets[v.userid][v.time] = util.JSONToTable(v.charges) end end) end)
object_tangible_loot_creature_loot_collections_stormtrooper_head = object_tangible_loot_creature_loot_collections_shared_stormtrooper_head:new { } ObjectTemplates:addTemplate(object_tangible_loot_creature_loot_collections_stormtrooper_head, "object/tangible/loot/creature/loot/collections/stormtrooper_head.iff")
-- luacheck: push -- luacheck: std +busted tostring(setfenv, print(it)) -- luacheck: pop -- luacheck: std other_std tostring(setfenv, print(it))
local tostring = require "stostring" local scall = require "scall" local callbacks = {} local i = 1; local function CreateHTTPPacket( url, id ) return "HTTP,"..tostring(id)..";"..GetLastExecutedSteamID()..";".. PacketSafe(url)..":"; end function HTTPCallback ( id, code, body, err ) if (not callbacks[id]) then return; end local callback = callbacks[id] callbacks[id] = nil local s, e = scall(callback, code, body, err) if ( not s ) then print( "error in http callback '"..id.."' "..e); end end local function HTTP ( url, callback ) assert( type(url) == "string", "bad argument #1 to 'HTTP' (string expected, got " .. type( url ) .. ")", 2 ) assert(url:len() >= 1, "bad argument #1 to 'HTTP' (string len is zero)" ); callbacks[i] = callback writepacket ( CreateHTTPPacket ( url, i ) ) i = i + 1; end return { Fetch = HTTP, }
local args = { ... } local max = tonumber(args[2]) local t = (args[1] == "inf" and 1 or args[1]) + args[2] + args[3] math.randomseed(tonumber(args[3])) function pos(max) return math.floor(math.random(0, max) - max / 2 - max % 2) end for i = 1, args[1] == "inf" and 1/0 or tonumber(args[1]) do os.execute(("xdotool mousemove_relative -- %i %i"):format(pos(max), pos(max))) end
#!/bin/luajit -- TODO -- help -- config - daily_goal albo zmieniać config lub czytać z linni -- dodawanie pomodoro przez cli -- przy stopie dodawać niedokończony czas - test -- maybe use coroutine when when adds alert -- weird output -- 24 notyfikacja 25 → break 1; output jest po tym jak się wykona skrypt czyli będzie notyfikacja -- 4 notyfikacja 5 → work 0 lub package.path = '/home/miro/Documents/dotfiles/common/scripts/.bin/' .. package.path util = require('scriptsUtil') HELP = [[ The pomodoro app for system bar like polybar with support of the work history. pomodoro.lua option [-flags] List of the options: add - add new pomodoro. If session is active it will update it, the description and tag will remain the same if you won't provide them. status - print status message duration - shows daily spent time history - display pomodoro history -h help - show help flags (short options) in a format: -ca d - debug mode c - adds daily pomodoro counter in the status a - sound alert with notification j - display pomodoro history in JSON format s - show secunds in the status - not implemented Examples: pomodoro.lua history -j | jq '.[].tag' - prints history in the JSON format pomodoro.lua status -ac - prints current status with daily ratio of the finished tasks, gives sound alert with notification if status changed [module/pomodoro] type = custom/script exec = pomodoro.lua status -anc click-middle = pomodoro.lua notify click-right = pomodoro.lua stop -n click-left = pomodoro.lua pause -n interval = 60 -- dependency: rofi, ffmpeg ]] POMODORO_DIR = os.getenv('XDG_CONFIG_HOME') .. '/pomodoro' HISTORY_PATH = POMODORO_DIR .. '/history' CURRENT_PATH = POMODORO_DIR .. '/current' CONFIG_PATH = POMODORO_DIR .. '/settings' ALERT_PATH = POMODORO_DIR .. '/alert.mp3' STATUS_PATH = '/tmp/pomodoro' DELIMITER = '|' config = util.getConfigProperties(CONFIG_PATH) flags = util.splitFlags(arg[2]) function getHistoryTasks() local tasks = {} for line in io.lines(HISTORY_PATH) do table.insert(tasks, line) end return tasks end function archiveTask(duration) duration = duration and duration or config['default_pomodoro_duration'] local current = io.open(CURRENT_PATH):read('*a') local file = io.open(HISTORY_PATH, 'a+') file:write(current .. duration, '\n') file:close() end function getModifiedDateDiff() local modifiedDate = io.popen('stat -c%Y ' .. STATUS_PATH):read('*a') assert(#modifiedDate ~= 0, 'Can not get modification file date') local diff = os.difftime(os.time(), tonumber(modifiedDate)) return math.floor(diff/60) end function duplicateTask() local current = io.open(CURRENT_PATH):read('*a') local taskInfo = util.split(current, DELIMITER) taskInfo[1] = os.date('%Y-%m-%dT%H:%M:%S') taskInfo[#taskInfo] = nil local file = io.open(CURRENT_PATH, 'w') file:write(table.concat(taskInfo, DELIMITER) .. DELIMITER) file:close() io.open(STATUS_PATH, 'w'):write(taskInfo[3]) end function pauseStatus() local workDuration = io.open(STATUS_PATH):read('*a') io.write(workDuration, '  ') end function breakStatus() local diff = getModifiedDateDiff() local breakDuration = config['default_break_duration'] and config['default_break_duration'] or 5 io.write(diff, '  ') if diff >= tonumber(breakDuration) then duplicateTask() workStatus() alert('Break finished') end end function workStatus() local diff = getModifiedDateDiff() io.write(diff, '  ') local defaultDuration = config['default_pomodoro_duration'] and config['default_pomodoro_duration'] or 25 if diff >= tonumber(defaultDuration) then archiveTask(defaultDuration) io.open(STATUS_PATH, 'w'):close() breakStatus() alert('Work finished') end end function getState() local file = io.open(STATUS_PATH) if not file then return stateEnum.STOP end local taskStatus = file:read('*a') if taskStatus == '' then state = stateEnum.BREAK elseif type(tonumber(taskStatus)) == 'number' then state = stateEnum.PAUSE else state = stateEnum.WORK end file:close() return state end function add() -- assert(os.execute( "test -f " .. STATUS_PATH ) ~= 0, 'Task exist') local description = util.input('description') local tags = {} for _, line in ipairs(getHistoryTasks()) do local taskInfo = util.split(line, DELIMITER) if taskInfo[2] then tags[taskInfo[2]] = taskInfo[2] end end local selectedTag = util.select(tags, 'Tags') local file local date = os.date('%Y-%m-%dT%H:%M:%S') if getState() == stateEnum.STOP then file = io.open(CURRENT_PATH, 'w') io.open(STATUS_PATH, 'w'):write(description) else file = io.open(CURRENT_PATH, 'r+') local current = file:read('*a') file:seek('set') local taskInfo = util.split(current, DELIMITER) date = taskInfo[1] if selectedTag == '' then selectedTag = taskInfo[2] end if description == '' then description = taskInfo[3] end end file:write(date, DELIMITER, selectedTag, DELIMITER, description, DELIMITER) file:close() end function alert(msg) if flags['n'] then os.execute("dunstify Pomodoro '" .. msg .. "'") end if flags['a'] then os.execute('ffplay -nodisp -autoexit -loglevel -8 -volume 10 ' .. ALERT_PATH) end end function stop() os.execute('rm ' .. STATUS_PATH) if flags['n'] then os.execute("dunstify Pomodoro 'Finished'") end stateEnum.STOP() --TODO save duration when is running -- local stoppedDuration = io.open(CURRENT_PATH):read('*a') -- archiveTask(stoppedDuration) end function pauseToggle() local state = getState() if state == stateEnum.BREAK then -- finish archiveTask() stop() elseif state == stateEnum.WORK then -- pause local difftime = getModifiedDateDiff() local file = io.open(STATUS_PATH, 'w') file:write(difftime) file:close() stateEnum.PAUSE() elseif state == stateEnum.PAUSE then -- restart local file = io.open(STATUS_PATH, 'r+') local workDuration = file:read('*a') file:write('restarted') file:close() assert(os.execute('touch -d "' .. workDuration .. ' minutes ago" ' .. STATUS_PATH) == 0, 'Can not change modification date') stateEnum.WORK() end end function dailyInfo() local today = os.date('%Y%-%m%-%d') local sum = 0 local taskCounter = 0 for _, task in ipairs(getHistoryTasks()) do if task:find(today) then local taskInfo = util.split(task, DELIMITER) sum = sum + taskInfo[#taskInfo] taskCounter = taskCounter + 1 end end return taskCounter .. '/' .. config['daily_goal'], os.date('%M:%S', sum) end function notify() local takskRatio, duration = dailyInfo() local currentTask = io.open(CURRENT_PATH):read('*a') util.notify(currentTask:gsub(DELIMITER, '\n') .. dailyInfo()) end function history() if flags['j'] then tasksJson = '[' for _, historyEntry in ipairs(getHistoryTasks()) do local task = util.split(historyEntry, DELIMITER) tasksJson = tasksJson .. '{"description":"' .. task[3] .. '",' .. '"tag":"' .. task[2] .. '","duration":' .. task[4] .. ', "date":"' .. task[1] .. '"},' end io.write(tasksJson:sub(1,-2), ']') else print(io.open(HISTORY_PATH):read('*a')) end end stateEnum = util.const({STOP = function() print'' end, BREAK = breakStatus, WORK = workStatus, PAUSE = pauseStatus}) local defaultOption = 'status' local options = { ["add"] = add, ["repeat"] = duplicateTask, ["pause"] = pauseToggle, ["status"] = getState, ["notify"] = function() print(notify()) end, ["stop"] = function() print(stop()) end, ["history"] = function() print(history()) end, ["duration"] = function() print(dailyInfo()) end, ["-h"]= function() print(HELP); os.exit() end, } local switch = (function(name,args) local sw = options return (sw[name]and{sw[name]}or{sw[defaultOption]})[1](args) end) local action = arg[1] and arg[1] or defaultOption if action == 'menu' then action = util.menu(options) end local exec, param = switch(action) local ok, val = pcall(exec, param) if flags['d'] and not ok then print(val) end if flags['c'] then local ratio = dailyInfo() io.write(ratio) end
ArcCW.IncompatibleAddons = { ["847269692"] = "Causes viewmodel flickering, may crash when customization menu opens", ["306149085"] = "Makes the customize menu mouse unable to appear.", ["541434990"] = "Neurotec is ancient, half the base is missing, and it flat-out doesn't work. Causes all sorts of problems. For the love of god, let go.", -- Neurotec --["1100368137"] = "May cause Lua errors. Use the wOS version instead.", -- Prone Mod ["476997621"] = "Causes issues with arms.", -- Improved Combine NPCs -- ["1308077613"] = "Will make near-walling look exaggerated; known to conflict with cBobbing.", -- View model bump, should be fixed -- ["1429489453"] = "Causes issues with arms." -- bio annihilation extended sninctbur ["1588705429"] = "Causes damage calculation to not work properly.", -- Realistic Bullet Overhaul } local t = ArcCW.GetTranslation local function ScreenScaleMulti(input) return ScreenScale(input) * GetConVar("arccw_hud_size"):GetFloat() end function ArcCW.MakeIncompatibleWindow(tbl) local startTime = CurTime() local window = vgui.Create( "DFrame" ) window:SetSize( ScrW() * 0.6, ScrH() * 0.6) window:Center() window:SetTitle("") window:SetDraggable(false) window:SetVisible(true) window:ShowCloseButton(false) window:MakePopup() window.Paint = function(self, w, h) surface.SetDrawColor(0, 0, 0, 200) surface.DrawRect(0, 0, w, h) end local title = vgui.Create("DLabel", window) title:SetSize(ScreenScaleMulti(256), ScreenScaleMulti(26)) title:Dock(TOP) title:SetFont("ArcCW_24") title:SetText(t("incompatible.title")) title:DockMargin(ScreenScaleMulti(16), 0, ScreenScaleMulti(16), ScreenScaleMulti(8)) local desc = vgui.Create("DLabel", window) desc:SetSize(ScreenScaleMulti(256), ScreenScaleMulti(12)) desc:Dock(TOP) desc:DockMargin(ScreenScaleMulti(4), 0, ScreenScaleMulti(4), 0) desc:SetFont("ArcCW_12") desc:SetText(t("incompatible.line1")) desc:SetContentAlignment(5) local desc2 = vgui.Create("DLabel", window) desc2:SetSize(ScreenScaleMulti(256), ScreenScaleMulti(12)) desc2:Dock(TOP) desc2:DockMargin(ScreenScaleMulti(4), 0, ScreenScaleMulti(4), ScreenScaleMulti(4)) desc2:SetFont("ArcCW_12") desc2:SetText(t("incompatible.line2")) desc2:SetContentAlignment(5) local neverAgain = vgui.Create("DButton", window) neverAgain:SetSize(ScreenScaleMulti(256), ScreenScaleMulti(20)) neverAgain:SetText("") neverAgain:Dock(BOTTOM) neverAgain:DockMargin(ScreenScaleMulti(48), ScreenScaleMulti(2), ScreenScaleMulti(48), ScreenScaleMulti(2)) neverAgain.OnMousePressed = function(spaa, kc) if CurTime() > startTime + 10 then local simpleTbl = {} for _, v in pairs(tbl) do simpleTbl[tostring(v.wsid)] = true end file.Write("arccw_incompatible.txt", util.TableToJSON(simpleTbl)) window:Close() window:Remove() chat.AddText(Color(255,0,0),t("incompatible.never.confirm")) end end neverAgain.Paint = function(spaa, w, h) local Bfg_col = Color(255, 255, 255, 255) local Bbg_col = Color(0, 0, 0, 200) if CurTime() > startTime + 10 and spaa:IsHovered() then Bbg_col = Color(255, 100, 100, 100) Bfg_col = Color(255, 255, 255, 255) end surface.SetDrawColor(Bbg_col) surface.DrawRect(0, 0, w, h) local txt = (CurTime() > startTime + 10) and (spaa:IsHovered() and t("incompatible.never.hover") or t("incompatible.never")) or t("incompatible.wait", {time = math.ceil(startTime + 10 - CurTime())}) surface.SetTextColor(Bfg_col) surface.SetTextPos(ScreenScaleMulti(8), ScreenScaleMulti(2)) surface.SetFont("ArcCW_12") surface.DrawText(txt) end local addonList = vgui.Create("DScrollPanel", window) addonList:SetText("") addonList:Dock(FILL) addonList.Paint = function(span, w, h) end local sbar = addonList:GetVBar() sbar.Paint = function() end sbar.btnUp.Paint = function(span, w, h) end sbar.btnDown.Paint = function(span, w, h) end sbar.btnGrip.Paint = function(span, w, h) surface.SetDrawColor(255, 255, 255, 255) surface.DrawRect(0, 0, w, h) end local accept = vgui.Create("DButton", window) accept:SetSize(ScreenScaleMulti(256), ScreenScaleMulti(20)) accept:SetText("") accept:Dock(BOTTOM) accept:DockMargin(ScreenScaleMulti(48), ScreenScaleMulti(2), ScreenScaleMulti(48), ScreenScaleMulti(2)) accept.OnMousePressed = function(spaa, kc) if CurTime() > startTime + 5 then window:Close() window:Remove() end end accept.Paint = function(spaa, w, h) local Bfg_col = Color(255, 255, 255, 255) local Bbg_col = Color(0, 0, 0, 200) if CurTime() > startTime + 5 and spaa:IsHovered() then Bbg_col = Color(255, 255, 255, 100) Bfg_col = Color(0, 0, 0, 255) end surface.SetDrawColor(Bbg_col) surface.DrawRect(0, 0, w, h) local txt = t("incompatible.confirm") .. ((CurTime() > startTime + 5) and "" or (" - " .. t("incompatible.wait", {time = math.ceil(startTime + 5 - CurTime())}))) surface.SetTextColor(Bfg_col) surface.SetTextPos(ScreenScaleMulti(8), ScreenScaleMulti(2)) surface.SetFont("ArcCW_12") surface.DrawText(txt) end for _, addon in pairs(tbl) do local addonBtn = vgui.Create("DButton", window) addonBtn:SetSize(ScreenScaleMulti(256), ScreenScaleMulti(28)) addonBtn:Dock(TOP) addonBtn:DockMargin(ScreenScaleMulti(36), ScreenScaleMulti(2), ScreenScaleMulti(36), ScreenScaleMulti(2)) addonBtn:SetFont("ArcCW_12") addonBtn:SetText("") addonBtn:SetContentAlignment(5) addonBtn.Paint = function(spaa, w, h) local Bfg_col = Color(255, 255, 255, 255) local Bbg_col = Color(0, 0, 0, 200) if spaa:IsHovered() then Bbg_col = Color(255, 255, 255, 100) Bfg_col = Color(0, 0, 0, 255) end surface.SetDrawColor(Bbg_col) surface.DrawRect(0, 0, w, h) local txt = addon.title surface.SetTextColor(Bfg_col) surface.SetTextPos(ScreenScaleMulti(18), ScreenScaleMulti(2)) surface.SetFont("ArcCW_12") surface.DrawText(txt) local txt2 = ArcCW.IncompatibleAddons[tostring(addon.wsid)] surface.SetTextColor(Bfg_col) surface.SetTextPos(ScreenScaleMulti(18), ScreenScaleMulti(16)) surface.SetFont("ArcCW_8") surface.DrawText(txt2) end addonBtn.OnMousePressed = function(spaa, kc) gui.OpenURL("https://steamcommunity.com/sharedfiles/filedetails/?id=" .. tostring(addon.wsid)) end end end hook.Add("InitPostEntity", "ArcCW_CheckContent", function() for _, k in pairs(weapons.GetList()) do if weapons.IsBasedOn(k.ClassName, "arccw_base") and k.ClassName != "arccw_base" then return end end chat.AddText(Color(255,255,255), "You have installed ArcCW Base but have no content packs installed. Perhaps you want to install the CS+ pack?") chat.AddText(Color(255,255,255), "https://steamcommunity.com/sharedfiles/filedetails/?id=2131058270") end)
minetest.register_on_player_receive_fields(function(player, formname, fields) register.call_form_handlers(player, formname, fields) end)
local Prop = {} Prop.Name = "Shady Apartments 1-B" Prop.Cat = "Apartments" Prop.Price = 750 Prop.Doors = { Vector( -3880.000000, -7329.000000, -13894.700195 ), Vector( -4272.000000, -7329.000000, -13897.000000 ), Vector( -4184.000000, -7249.000000, -13897.000000 ), } GM.Property:Register( Prop )
-- -- @name init.lua -- @author vincent <[email protected]> -- @description Entrypoint -- -------------------------------------------------- ---- Initialize Variables -------------------------------------------------- local WIFI_AUTH = {} local WIFI_CONFIG = {} local SENSOR_CONFIG = {} local MQTT_CONFIG = {} SENSOR_CONFIG.rate = 3000 WIFI_AUTH.ssid = "VINCENT" WIFI_AUTH.pwd = "wgy12345" WIFI_AUTH.save = false WIFI_CONFIG.ip = "192.168.50.21" WIFI_CONFIG.netmask = "255.255.255.0" WIFI_CONFIG.gateway = "192.168.50.1" MQTT_CONFIG.host = "192.168.50.193" MQTT_CONFIG.port = 1883 MQTT_CONFIG.username = "Vincent0700" MQTT_CONFIG.password = "Secret123" MQTT_CONFIG.connect_rate = 2000 MQTT_CONFIG.publish_rate = 10000 MQTT_CONFIG.id = "bme280_dev" MQTT_CONFIG.timeout = 120 MQTT_CONFIG.topic = "/sensor" MQTT_CONFIG.secure = 0 MQTT_CONFIG.qos = 0 MQTT_CONFIG.retain = 0 local ui = require("ui") local sensor = require("sensor") local init_wifi = require("init_wifi") local init_mqtt = require("init_mqtt") local tmr_disp = tmr.create() local json_data = nil -------------------------------------------------- ---- Setup Screen & Sensor -------------------------------------------------- print("Setting up Screen ...") ui:init() ui:drawLabel(0, "Stat") ui:drawLabel(1, "Temp") ui:drawLabel(2, "Pres") ui:drawLabel(3, "Humi") ui:drawValue(0, "Init BME280") ui:flush() sensor:init() tmr_disp:alarm(SENSOR_CONFIG.rate, tmr.ALARM_AUTO, function() local T, P, H = sensor:getData() json_data = sjson.encode({ temp = T, pres = P, humi = H }) ui:drawValue(1, T .. " C") ui:drawValue(2, P .. " Pa") ui:drawValue(3, H .. " %") ui:flush() end) -------------------------------------------------- ---- Setup WIFI -------------------------------------------------- print("Setting up WIFI ...") ui:drawValue(0, "Connect WIFI") init_wifi(WIFI_CONFIG, WIFI_AUTH, function() -- Setup MQTT Client ui:drawValue(0, "Connect MQTT") local n = 0 init_mqtt(MQTT_CONFIG, function() ui:drawValue(0, "Preparing") end, function() ui:drawValue(0, "Connect MQTT") end, function() n = (n + 1) % 16 ui:drawValue(0, string.rep(">", n)) return json_data end) end, function() -- Connect Error ui:drawValue(0, "Error") end)
local Module = require"Toolbox.Import.Module" return { Transform = Module.Child"Transform"; Object = Module.Child"Object"; Objects = Module.Child"Objects"; }
-- luacheck: globals insulate setup describe it assert mock -- luacheck: globals before_each after_each insulate("About #iron functionality", function() local _ = require('iron.util.tables') before_each(function() _G.vim = mock({ api = { nvim_call_function = function(_, _) return 1 end, nvim_command = function(_) return "" end, nvim_get_option = function(_) return "" end, nvim_get_var = function(_) return "" end, }}) _G.os = mock({ execute = function(_) return 0 end, }) end) after_each(function() package.loaded['iron'] = nil package.loaded['iron.core'] = nil end) describe("default #config", function() it("doesn't assume preferred values", function() local iron = require('iron') assert.are_same(iron.config.preferred.python, nil) end) it("has toggle #visibility enabled", function() local iron = require('iron') assert.are_same(iron.config.visibility, iron.behavior.visibility.toggle) end) end) describe("dynamic #config", function() it("is not called on a stored config", function() local iron = require('iron') iron.config.stuff = 1 local _ = iron.config.stuff assert.stub(_G.vim.api.nvim_get_var).was_called(0) end) end) describe("#memory related", function() it("repl_for", function() local iron = require('iron') local repl = iron.core.repl_for('python') assert.are_same(#(_.keys(repl)), 3) assert.are_same(#(_.keys(iron.memory)), 1) assert.are_not_same(iron.memory.python, nil) assert.are_same(#(_.keys(iron.memory.python)), 1) assert.are_same(repl, iron.ll.get_from_memory('python')) end) end) describe("#core functions", function() it("repl_for", function() local iron = require('iron') iron.core.repl_for("python") assert.spy(_G.vim.api.nvim_command).was_called(2) assert.spy(_G.vim.api.nvim_call_function).was_called(3) end) it("repl_for if repl exists", function() local iron = require('iron') iron.config.visibility = mock(function() end) local mem1 = iron.core.repl_for("python") assert.spy(_G.vim.api.nvim_command).was_called(2) assert.spy(iron.config.visibility).was_called(0) local mem2 = iron.core.repl_for("python") assert.spy(iron.config.visibility).was_called(1) assert.are_same(#(_.keys(iron.memory)), 1) assert.are_same(mem1, mem2) end) end) end)
require('go').setup() function GoImportsSync(timeout_ms) vim.lsp.buf.formatting_sync(nil, 1000) local context = { source = { organizeImports = true } } vim.validate { context = { context, 't', true } } local params = vim.lsp.util.make_range_params() params.context = context local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, timeout_ms) if not result then return end for _, result in pairs(result) do if not result.result then return end result = result.result local edit = result[1].edit vim.lsp.util.apply_workspace_edit(edit) end end vim.cmd [[ augroup config#go autocmd! autocmd BufWritePre *.go lua GoImportsSync(1000) augroup END ]]
--[[ /////// ////////////////// /////// PROJECT: MTA iLife - German Fun Reallife Gamemode /////// VERSION: 1.7.2 /////// DEVELOPERS: See DEVELOPERS.md in the top folder /////// LICENSE: See LICENSE.md in the top folder /////// ///////////////// ]] -- ####################################### -- ## Project: HUD iLife ## -- ## For MTA: San Andreas ## -- ## Name: HudComponentSaver.lua ## -- ## Author: Noneatme ## -- ## Version: 1.0 ## -- ## License: See top Folder ## -- ####################################### -- FUNCTIONS / METHODS -- local cFunc = {}; -- Local Functions local cSetting = {}; -- Local Settings HudComponentSaver = {}; HudComponentSaver.__index = HudComponentSaver; --[[ ]] -- /////////////////////////////// -- ///// New ////// -- ///// Returns: Object ////// -- /////////////////////////////// function HudComponentSaver:New(...) local obj = setmetatable({}, {__index = self}); if obj.Constructor then obj:Constructor(...); end return obj; end -- /////////////////////////////// -- ///// DoCreateNewSettingsFile// -- ///// Returns: void ////// -- /////////////////////////////// function HudComponentSaver:DoCreateNewSettingsFile(componentname, tblComponents) local file = fileCreate("savedfiles/hudsettings/"..componentname..".cfg"); local settings = tblComponents[componentname] local defaultenabled = self.defaultDisabled[componentname] if(defaultenabled == true) then settings.enabled = 0 else settings.enabled = 1 end fileWrite(file, settings.sx..","..settings.sy..","..settings.width..","..settings.height..","..settings.alpha..","..(settings.enabled)) fileFlush(file); fileClose(file); if not(fileExists("savedfiles/hudsettings/DO_NOT_EDIT_ANY_OF_THIS_FILES.important")) then fileClose(fileCreate("savedfiles/hudsettings/DO_NOT_EDIT_ANY_OF_THIS_FILES.important")) end end -- /////////////////////////////// -- ///// CheckForSavedComponents// -- ///// Returns: void ////// -- /////////////////////////////// function HudComponentSaver:CheckForSavedComponents(tblComponents) -- Checking and creating the settings files for componentname, setting in pairs(tblComponents) do if not(fileExists("savedfiles/hudsettings/"..componentname..".cfg")) then self:DoCreateNewSettingsFile(componentname, tblComponents) end end local settingsfile; if(fileExists("savedfiles/hudsettings/global.cfg")) then local settingsfile = fileOpen("savedfiles/hudsettings/global.cfg") local text = fileRead(settingsfile, fileGetSize(settingsfile)); local sx, sy = tonumber(gettok(text, 1, ",")), tonumber(gettok(text, 2, ",")); if(sx and sy) then local sx2, sy2 = guiGetScreenSize() if(sx ~= sx2) or(sy2 ~= sy) then fileClose(settingsfile); fileDelete("savedfiles/hudsettings/global.cfg"); self:CheckForSavedComponents(tblComponents); end end else settingsfile = fileCreate("savedfiles/hudsettings/global.cfg"); local sx, sy = guiGetScreenSize(); fileWrite(settingsfile, sx..","..sy); fileFlush(settingsfile); fileClose(settingsfile); end end -- /////////////////////////////// -- ///// UpdateComponent ////// -- ///// Returns: void ////// -- /////////////////////////////// function HudComponentSaver:UpdateComponent(componentname, tblComponents) if(fileExists("savedfiles/hudsettings/"..componentname..".cfg")) then fileDelete("savedfiles/hudsettings/"..componentname..".cfg") local file = fileCreate("savedfiles/hudsettings/"..componentname..".cfg"); local settings = tblComponents[componentname]; fileWrite(file, settings.sx..","..settings.sy..","..settings.width..","..settings.height..","..settings.alpha..","..(settings.enabled or 1)) fileFlush(file); fileClose(file); else self:CheckForSavedComponents(tblComponents); end end -- /////////////////////////////// -- ///// SetComponentSetting ///// -- ///// Returns: void ////// -- /////////////////////////////// function HudComponentSaver:SetComponentSetting(sComponent, sName, sSetting, sValue) local file = EasyIni:LoadFile("savedfiles/hudsettings/"..sComponent..".ini"); if not(file) then file = EasyIni:NewFile("savedfiles/hudsettings/"..sComponent..".ini"); end file:Set(sName, sSetting, sValue) file:Save(); outputDebugString("[HUD] Saved Component Setting [INI] for Component: "..sComponent.."("..sName..", "..sSetting..")"); return file:Get(sName, sSetting); end -- /////////////////////////////// -- ///// Constructor ////// -- ///// Returns: void ////// -- /////////////////////////////// function HudComponentSaver:Constructor(...) -- Instanzen self.defaultDisabled = { ["netstats"] = true; } -- Funktionen -- Events outputDebugString("[CALLING] HudComponentSaver: Constructor"); end -- EVENT HANDLER --
plr = "NAMEHERE" plrid = game.Players[plr].userId level = 120 pie = game.ReplicatedStorage.leaderstat[plrid] repeat pie.EXP.Value = pie.MaxEXP.Value wait() until pie.Level.Value == level repeat pie.AGTEXP.Value = pie.AGTMaxEXP.Value wait() until pie.AGTLevel.Value == level repeat pie.SMTEXP.Value = pie.SMTMaxEXP.Value wait() until pie.SMTLevel.Value == level repeat pie.STREXP.Value = pie.STRMaxEXP.Value wait() until pie.STRLevel.Value == level repeat pie.STMEXP.Value = pie.STMMaxEXP.Value wait() until pie.STMLevel.Value == level repeat pie.OHSEXP.Value = pie.OHSMaxEXP.Value wait() until pie.OHSLevel.Value == level repeat pie.THSEXP.Value = pie.THSMaxEXP.Value wait() until pie.THSLevel.Value == level repeat pie.KATEXP.Value = pie.KATMaxEXP.Value wait() until pie.KATLevel.Value == level repeat pie.RAPEXP.Value = pie.RPRMaxEXP.Value wait() until pie.RAPLevel.Value == level
object_tangible_quest_must_crash_site_destroyed_terminal = object_tangible_quest_shared_must_crash_site_destroyed_terminal:new { } ObjectTemplates:addTemplate(object_tangible_quest_must_crash_site_destroyed_terminal, "object/tangible/quest/must_crash_site_destroyed_terminal.iff")
local InventoryFunctions = require "util/inventoryfunctions" local CraftFunctions = require "util/craftfunctions" local PREFERRED_AUTO_LIGHT = GetModConfigData("PREFERRED_AUTO_LIGHT", MOD_EQUIPMENT_CONTROL.MODNAME) local CRAFTING_ALLOWED = GetModConfigData("AUTO_EQUIP_LIGHTSOURCE", MOD_EQUIPMENT_CONTROL.MODNAME) == 2 local function GetLightSource(recur) if ThePlayer.components.playercontroller then local lightsources = ThePlayer.components.actioncontroller:GetItemsFromCategory("LIGHTSOURCE") for _, lightsource in ipairs(lightsources) do if lightsource.prefab == PREFERRED_AUTO_LIGHT then return lightsource end end if #lightsources > 0 then return lightsources[1] end if not CRAFTING_ALLOWED or recur then return nil end if CraftFunctions:CanCraft("torch") then CraftFunctions:Craft("torch") if ThePlayer.components.locomotor == nil then Sleep(FRAMES * 3) end -- @TODO Might wanna use an event based trigger here @TAG PERF, REFACTOR while CraftFunctions:IsCrafting() do Sleep(FRAMES) end Sleep(FRAMES * 3) return GetLightSource(true) end end return nil end local function EquipLight() local item = GetLightSource() if not item or InventoryFunctions:IsEquipped(item) then return item end InventoryFunctions:Equip(item) return item end local function Unequip(item) if not InventoryFunctions:IsEquipped(item) or not InventoryFunctions:HasFreeSlot() then return false end SendRPCToServer(RPC.ControllerUseItemOnSelfFromInvTile, ACTIONS.UNEQUIP.code, item) return true end local EmitLookup = { yellowamulet = 0.788, lantern = 0.739, minerhat = 0.739, torch = 0.730, lighter = 0.601, molehat = 0.01, -- Kinda hacky } local function GetEmitValue() local ret = 0 for _, equip in pairs(InventoryFunctions:GetEquips()) do if not equip:HasTag("fueldepleted") and EmitLookup[equip.prefab] then ret = ret + EmitLookup[equip.prefab] end end return ret end local LightTresh = .051 -- .05 from /prefabs/player_common local function IsInDarkness() local emitVal = GetEmitValue() if emitVal > 0 then local lightValue = string.format( "%.3f", ThePlayer.LightWatcher:GetLightValue() ) lightValue = tonumber(lightValue) local lightDelta = lightValue - emitVal if lightDelta < LightTresh then return true end end return false end local function Init() if not ThePlayer or not ThePlayer.LightWatcher then return end StartThread(function() while ThePlayer do if ThePlayer.LightWatcher:GetTimeInDark() > 0 then local lightsource = EquipLight() if lightsource then Sleep(FRAMES * 4) while IsInDarkness() do Sleep(.25) end Unequip(lightsource) end end Sleep(.5) end end, "AutoLightThread") end return Init
--[[ Title: context object Author(s): LiXizhi Date: 2010.10.23 Desc: provides handy function to retrieve data on context object. use the lib: ------------------------------------------------------------ NPL.load("(gl)script/apps/Taurus/WindowManager/wm_context.lua"); local wmContext = commonlib.gettable("PETools.WindowManager.wmContext"); ------------------------------------------------------------ ]] local wmContext = commonlib.inherit(nil, commonlib.gettable("PETools.WindowManager.wmContext")); function wmContext:ctor() -- /* windowmanager context */ self.wm_manager = nil; self.wm_window = nil; self.wm_screen = nil; self.wm_area = nil; self.wm_region = nil; self.wm_menu = nil; self.wm_store = nil; -- the main scene self.main = nil; self.scene = nil; self.recursion = nil; self.render = nil; end function wmContext:get_manager() return self.wm_manager; end function wmContext:set_manager(winManager) self.wm_manager = winManager; self.wm_window = nil; self.wm_screen = nil; self.wm_area = nil; self.wm_region = nil; end function wmContext:get_window() return self.wm_window; end function wmContext:set_window(win) self.wm_window = win; if(win) then self.wm_screen = win.screen; else self.wm_screen = nil; end if(self.wm_screen) then self.scene = self.wm_screen.scene; else self.scene = nil; end self.wm_area = nil; self.wm_region = nil; end function wmContext:get_screen() return self.wm_screen; end function wmContext:set_screen(screen) self.wm_screen = screen; if(self.wm_screen) then self.scene = self.wm_screen.scene; else self.scene = nil; end self.wm_area = nil; self.wm_region = nil; end function wmContext:get_area() return self.wm_area; end function wmContext:set_area(area) self.wm_area = area; self.wm_region = nil; end function wmContext:get_region() return self.wm_region; end function wmContext:set_region(region) self.wm_region = region; end function wmContext:get_menu() return self.wm_menu; end function wmContext:get_store() return self.wm_store; end function wmContext:get_mainscene() return self.wm_store; end function wmContext:get_view3d() if(self.wm_area and self.wm_area.spacetype == "SPACE_VIEW3D") then return self.wm_area.spacedata.first; end end function wmContext:get_region_view3d() if(self.wm_area and self.wm_area.spacetype == "SPACE_VIEW3D") then if(self.wm_region) then return self.wm_region.regiondata; end end end function wmContext:set_main(main) self.main= main; end function wmContext:get_main() return self.main; end function wmContext:set_scene(scene) self.scene= scene; end function wmContext:get_scene() return self.scene; end
data:extend({ { type = "sprite", name = "fp_semitransparent_pixel", filename = "__factoryplanner__/graphics/semitransparent_pixel.png", size = 1, flags = {"gui-icon"} }, { type = "sprite", name = "fp_zone_selection", filename = "__factoryplanner__/graphics/zone_selection.png", size = 32, flags = {"gui-icon"} }, { type = "sprite", name = "fp_generic_assembler", filename = "__factoryplanner__/graphics/generic_assembler.png", size = 64, icon_mipmaps = 2, flags = {"gui-icon"} }, { type = "sprite", name = "fp_sprite_white_square", filename = "__factoryplanner__/graphics/white_square.png", size = 8, icon_mipmaps = 2, flags = {"gui-icon"} }, { type = "sprite", name = "fp_sprite_import_light", filename = "__factoryplanner__/graphics/import_light.png", size = 32, icon_mipmaps = 2, scale = 0.5, flags = {"gui-icon"} }, { type = "sprite", name = "fp_sprite_export_light", filename = "__factoryplanner__/graphics/export_light.png", size = 32, icon_mipmaps = 2, scale = 0.5, flags = {"gui-icon"} }, { type = "sprite", name = "fp_sprite_pause_light", filename = "__factoryplanner__/graphics/pause_light.png", size = 32, icon_mipmaps = 2, scale = 0.5, flags = {"gui-icon"} }, { type = "sprite", name = "fp_sprite_warning_red", filename = "__factoryplanner__/graphics/warning_red.png", size = 32, icon_mipmaps = 2, scale = 0.25, flags = {"gui-icon"} }, { type = "sprite", name = "fp_sprite_archive_dark", filename = "__factoryplanner__/graphics/archive_dark.png", size = 32, icon_mipmaps = 2, flags = {"gui-icon"} } })
local colors = { white = "#FFFFFF", black = "#272822", lightblack = "#2D2E27", lightblack2 = "#383a3e", darkblack = "#211F1C", grey = "#8F908A", lightgrey = "#575b61", darkgrey = "#64645e", warmgrey = "#75715E", pink = "#F93C80", green = "#84F57D", aqua = "#66d9ef", darkaqua = "#4EADE5", yellow = "#FFFF43", orange = "#FFBD37", deepOrange = "#FF8C00", purple = "#ae81ff", darkpurple = "#855dcf", red = "#FF1919", darkred = "#F44747", addfg = "#d7ffaf", addbg = "#5f875f", delbg = "#f75f5f", changefg = "#d7d7ff", changebg = "#5f5f87", } return colors
--[[ Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. Copyright (c) 2012, Christoph Kubisch. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Neither the name of NVIDIA CORPORATION nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Contact: Christoph Kubisch [email protected] ]] fxdebug = true dofile("lua/fxlibprocessor.lua") local function dump(filename,str) local f = io.open(filename,"wb") f:write(str) f:close() end local function dumptech(file,eff,techstr,codestr) local tech = eff.technique[techstr] assert(tech) local codeobj = fxcodegen(tech,codestr,"GLSL::uniform") dump( (file.."_"..eff.class.."_"..eff.name.."_uniform.glsl"),codeobj) local codeobj = fxcodegen(tech,codestr,"GLSL::ubo") dump( (file.."_"..eff.class.."_"..eff.name.."_ubo.glsl"),codeobj) local codeobj = fxcodegen(tech,codestr,"GLSL::nvload") dump( (file.."_"..eff.class.."_"..eff.name.."_nvload.glsl"),codeobj) local codeobj = fxcodegen(tech,codestr,"GLSL::nvloadtex") dump( (file.."_"..eff.class.."_"..eff.name.."_nvloadtex.glsl"),codeobj) local codeobj = fxcodegen(tech,codestr,"GLSL::ubossbotex") dump( (file.."_"..eff.class.."_"..eff.name.."_ubossbotex.glsl"),codeobj) end local function setGeneratorLights() for i,v in ipairs(fxlib.light.effects) do fxlights.effects[i] = v fxlights.max[i] = 16 end end if (true) then fxfile( "test/testfx.luafx") setGeneratorLights() if (true) then dumptech("test/out/testfx",fxlib.material.effects.simple, "GLSL::forward","FragmentShader") dumptech("test/out/testfx",fxlib.material.effects.normals, "GLSL::forward","FragmentShader") dumptech("test/out/testfx",fxlib.material.effects.difflit, "GLSL::forward","FragmentShader") dumptech("test/out/testfx",fxlib.geometry.effects.standard,"GLSL::PosNormalUV","VertexShader") dumptech("test/out/testfx",fxlib.geometry.effects.shrink, "GLSL::PosNormalUV","GeometryShader") dumptech("test/out/testfx",fxlib.geometry.effects.hinttest,"GLSL::Test","VertexShader") end if (false) then local light = fxlib.light.effects.gradient local group = light.group.instance local function storagedump(group,gen) local stype,_,struct = fxgroupstore(group,gen) DisplayOutput(group.name,gen,stype,"\n") for i,v in ipairs(struct) do local str = group.parameter[i] and group.parameter[i].varname or "struct " for n,k in pairs(v) do str = str.."\t"..n..": "..k.."\t" end DisplayOutput(str,"\n") end end storagedump(group,"GLSL::ubo") storagedump(group,"GLSL::nvload") end end
--[[ --- Day 17: Reservoir Research --- ]]-- local printf = function(s,...) return io.write(s:format(...)) end local fname = arg[1] local verbose = (fname == '-v') if verbose then fname = arg[2] end -- arena[y][x] = '#' when there's a clay wall -- '.' when it's open (sand) -- '+' for spring -- '|' for flowing water -- '~' for standing water -- '?' for out of bounds local arena = {} local xmin = 11000000 local xmax = -1 local ymin = 11000000 local ymax = -1 local function getxy (x, y, default) if y < ymin or y > ymax then return '?' end local row = arena[y] if x < xmin or x > xmax then return '?' elseif row == nil then return default or '?' else return row[x] or default or '?' end end local function setxy (x, y, s) if y < ymin then ymin = y elseif y > ymax then ymax = y else -- ok end local row = arena[y] if row == nil then row = {} arena[y] = row end if x < xmin then xmin = x elseif x > xmax then xmax = x else -- ok end row[x] = s end local function readarena () local infile = io.open(fname or "2018_advent_17a.txt") local line = infile:read("l") while line do -- y=1350, x=517..542 -- x=457, y=1253..1259 if line:len() == 0 then -- punt else local l,n,r,f,t = line:match("(%a)=(%d+), (%a)=(%d+)..(%d+)") if l == 'x' then local x = tonumber(n) if r == 'y' then for i = tonumber(f), tonumber(t) do setxy(x,i,'#') end else print("### Wrong r for x", r) end elseif l == 'y' then local y = tonumber(n) if r == 'x' then for i = tonumber(f), tonumber(t) do setxy(i,y,'#') end else print("### Wrong r for x", r) end else print("### Unknown l", l) end end line = infile:read("l") end infile:close() printf("Read %d..%d x %d..%d arena\n", xmin, xmax, ymin, ymax) end --[[ You scan a two-dimensional vertical slice of the ground nearby and discover that it is mostly sand with veins of clay. The scan only provides data with a granularity of square meters, but it should be good enough to determine how much water is trapped there. In the scan, x represents the distance to the right, and y represents the distance down. There is also a spring of water near the surface at x=500, y=0. The scan identifies which square meters are clay (your puzzle input). The spring of water will produce water forever. Water can move through sand, but is blocked by clay. Water always moves down when possible, and spreads to the left and right otherwise, filling space that has clay on both sides and falling out otherwise. ]]-- local function printarena () for y = ymin, ymax do for x = xmin, xmax do printf("%s", getxy(x,y,'.')) end printf("\n") end end local function part1 () readarena() -- make room for spills xmin = xmin - 1 xmax = xmax + 1 -- make room for spring ymin = ymin - 1 local water = xmax * ymax -- plenty to spare --print("Water max", water) setxy(500, ymin, '+') -- spring local work = {} local visited = {} local function pushtask (dir, x, y) local task = {dir=dir, x=x, y=y} work[#work+1] = task end local function poptask () local task = work[#work] if task then work[#work] = nil end return task end local wet = 0 local puddle = 0 local function hashxy (x,y) return x * (ymax + 1) + y end local function drip (x, y) visited[hashxy(x,y)] = true local s = getxy(x, y, '.') if s == '#' or s == '~'then -- hit a floor return false elseif s == '.' then wet = wet + 1 -- new wet space setxy(x, y, '|') -- dripping state return true elseif s == '|' then return true else print("### Unexpected state", s) return false end end while water > 0 do startwater = water visited = {} local task = {dir='down', x=500, y=ymin} while task do if veryverbose then printf("Task: %s (%d,%d)\n", task.dir, task.x, task.y) end if task.dir == 'down' then local x = task.x local y = task.y + 1 if y > ymax then -- flow into the earth task = poptask() elseif drip(x,y) then -- continue dripping task.y = y -- tail call else pushtask('left', task.x, task.y) task.dir = 'right' -- tail call end elseif task.dir == 'downL' then local x = task.x local y = task.y + 1 if y > ymax then -- flow into the earth task = poptask() elseif visited[hashxy(x,y)] then if drip(x,y) then task = poptask() else task.dir = 'left' -- tail call end elseif drip(x,y) then -- continue dripping task.dir = 'down' task.y = y -- tail call else task.dir = 'left' -- tail call end elseif task.dir == 'downR' then local x = task.x local y = task.y + 1 if y > ymax then -- flow into the earth task = poptask() elseif visited[hashxy(x,y)] then if drip(x,y) then task = poptask() else task.dir = 'right' -- tail call end elseif drip(x,y) then -- continue dripping task.dir = 'down' task.y = y -- tail call else task.dir = 'right' -- tail call end elseif task.dir == 'left' then local x = task.x - 1 local y = task.y local v = false -- visited[hashxy(x,y)] if v or not drip(x,y) then local l = getxy(x, y, '?') if (l == '#') then for i = task.x + 1, xmax do local s = getxy(i, y, '.') if (s == '#') then for n = task.x, i-1 do setxy(n, y, '~') puddle = puddle + 1 water = water - 1 end break elseif (s == '|') then if drip(i,y+1) then break -- still more to fill else -- continue end elseif (s == '.') then -- no wall break else print("Wtf", s) end end end task = poptask() else -- continue dripping task.dir = 'downL' task.x = x -- tail call end elseif task.dir == 'right' then local x = task.x + 1 local y = task.y local v = false -- visited[hashxy(x,y)] if v or not drip(x,y) then task = poptask() else -- continue dripping task.dir = 'downR' task.x = x -- tail call end else print("### Unknown dir", task.dir) end end --break -- if water < xmax * ymax - 24 then break end -- debug if startwater == water then break end end if verbose then printarena() end -- local wet2 = 0 -- for y = ymin, ymax do -- for x = xmin, xmax do -- local s = getxy(x,y,'.') -- if s == '~' or s == '|' then -- wet2 = wet2 + 1 -- end -- end -- end printf("Part 1 & 2: %d wet squares %d puddles\n", wet, puddle) end part1() print "Done"
local present, packer = pcall(require, "plugins.packerInit") if not present then return false end local use = packer.use return packer.startup(function() local plugin_settings = require("core.utils").load_config().plugins local override_req = require("core.utils").override_req -- this is arranged on the basis of when a plugin starts -- this is the nvchad core repo containing utilities for some features like theme swticher, no need to lazy load use "Nvchad/extensions" use "nvim-lua/plenary.nvim" use { "wbthomason/packer.nvim", event = "VimEnter", } use { "NvChad/nvim-base16.lua", after = "packer.nvim", config = function() require("colors").init() end, } use { "kyazdani42/nvim-web-devicons", after = "nvim-base16.lua", config = override_req("nvim_web_devicons", "plugins.configs.icons"), } use { "feline-nvim/feline.nvim", disable = not plugin_settings.status.feline, after = "nvim-web-devicons", config = override_req("feline", "plugins.configs.statusline"), } use { "akinsho/bufferline.nvim", disable = not plugin_settings.status.bufferline, after = "nvim-web-devicons", config = override_req("bufferline", "plugins.configs.bufferline"), setup = function() require("core.mappings").bufferline() end, } use { "lukas-reineke/indent-blankline.nvim", disable = not plugin_settings.status.blankline, event = "BufRead", config = override_req("indent_blankline", "(plugins.configs.others).blankline()"), } use { "norcalli/nvim-colorizer.lua", disable = not plugin_settings.status.colorizer, event = "BufRead", config = override_req("nvim_colorizer", "(plugins.configs.others).colorizer()"), } use { "nvim-treesitter/nvim-treesitter", event = "BufRead", config = override_req("nvim_treesitter", "plugins.configs.treesitter"), } -- git stuff use { "lewis6991/gitsigns.nvim", disable = not plugin_settings.status.gitsigns, opt = true, config = override_req("gitsigns", "(plugins.configs.others).gitsigns()"), setup = function() require("core.utils").packer_lazy_load "gitsigns.nvim" end, } -- lsp stuff use { "neovim/nvim-lspconfig", opt = true, setup = function() require("core.utils").packer_lazy_load "nvim-lspconfig" -- reload the current file so lsp actually starts for it vim.defer_fn(function() vim.cmd 'if &ft == "packer" | echo "" | else | silent! e %' end, 0) end, config = override_req("lspconfig", "plugins.configs.lspconfig"), } use { "ray-x/lsp_signature.nvim", disable = not plugin_settings.status.lspsignature, after = "nvim-lspconfig", config = override_req("signature", "(plugins.configs.others).signature()"), } use { "andymass/vim-matchup", disable = not plugin_settings.status.vim_matchup, opt = true, setup = function() require("core.utils").packer_lazy_load "vim-matchup" end, } use { "max397574/better-escape.nvim", disable = not plugin_settings.status.better_escape, event = "InsertEnter", config = override_req("better_escape", "(plugins.configs.others).better_escape()"), } -- load luasnips + cmp related in insert mode only use { "rafamadriz/friendly-snippets", disable = not plugin_settings.status.cmp, event = "InsertEnter", } use { "hrsh7th/nvim-cmp", disable = not plugin_settings.status.cmp, after = "friendly-snippets", config = override_req("nvim_cmp", "plugins.configs.cmp"), } use { "L3MON4D3/LuaSnip", disable = not plugin_settings.status.cmp, wants = "friendly-snippets", after = "nvim-cmp", config = override_req("luasnip", "(plugins.configs.others).luasnip()"), } use { "saadparwaiz1/cmp_luasnip", disable = not plugin_settings.status.cmp, after = "LuaSnip", } use { "hrsh7th/cmp-nvim-lua", disable = not plugin_settings.status.cmp, after = "cmp_luasnip", } use { "hrsh7th/cmp-nvim-lsp", disable = not plugin_settings.status.cmp, after = "cmp-nvim-lua", } use { "hrsh7th/cmp-buffer", disable = not plugin_settings.status.cmp, after = "cmp-nvim-lsp", } use { "hrsh7th/cmp-path", disable = not plugin_settings.status.cmp, after = "cmp-buffer", } -- misc plugins use { "windwp/nvim-autopairs", disable = not plugin_settings.status.autopairs, after = plugin_settings.options.autopairs.loadAfter, config = override_req("nvim_autopairs", "(plugins.configs.others).autopairs()"), } use { "glepnir/dashboard-nvim", disable = not plugin_settings.status.dashboard, config = override_req("dashboard", "plugins.configs.dashboard"), setup = function() require("core.mappings").dashboard() end, } use { "numToStr/Comment.nvim", disable = not plugin_settings.status.comment, module = "Comment", config = override_req("nvim_comment", "(plugins.configs.others).comment()"), setup = function() require("core.utils").packer_lazy_load "Comment.nvim" require("core.mappings").comment() end, } -- file managing , picker etc use { "kyazdani42/nvim-tree.lua", disable = not plugin_settings.status.nvimtree, -- only set "after" if lazy load is disabled and vice versa for "cmd" after = not plugin_settings.options.nvimtree.lazy_load and "nvim-web-devicons", cmd = plugin_settings.options.nvimtree.lazy_load and { "NvimTreeToggle", "NvimTreeFocus" }, config = override_req("nvim_tree", "plugins.configs.nvimtree"), setup = function() require("core.mappings").nvimtree() end, } use { "nvim-telescope/telescope.nvim", cmd = "Telescope", config = override_req("telescope", "plugins.configs.telescope"), setup = function() require("core.mappings").telescope() end, } -- load user defined plugins require("core.hooks").run("install_plugins", use) end)
NarciTooltipMixin = {}; local TP = NarciTooltipMixin; local GetMouseFocus = GetMouseFocus; local IsMouseButtonDown = IsMouseButtonDown; local UIFrameFadeIn = UIFrameFadeIn; local UIFrameFadeOut = UIFrameFadeOut; local FadeFrame = NarciAPI_FadeFrame; local max = math.max; local sin = math.sin; local pi = math.pi; local After = C_Timer.After ----------------------------------- local tooltipAnchor, pointerOffsetX, pointerOffsetY, isHorizontal; local pendingText, pendingTexture; local callbackFunc; local minSize = 48; local textInset = 18; local animDuration = 0.4; local delayDuration = 0.6; local DefaultDelay = 0.6; local DefaultPointerOffset = -8; local fixedWidth = 270; ----------------------------------- -------------LibEasing------------- local function outSine(t, b, c, d) return c * sin(t / d * (pi / 2)) + b end ----------------------------------- local PATH_PREFIX = "Interface/AddOns/Narcissus/Guide/IMG/"; local Images = { [1] = PATH_PREFIX .. "HideTexts", [2] = PATH_PREFIX .. "TopQuality", [3] = PATH_PREFIX .. "GroundShadow", [4] = PATH_PREFIX .. "HidePlayer", [5] = PATH_PREFIX .. "CompactMode", [6] = PATH_PREFIX .. "SaveLayers", [7] = PATH_PREFIX .. "LightSwitch", } ----------------------------------- local Timer = CreateFrame("Frame"); Timer:Hide(); Timer.TimeSinceLastUpdate = 0; local function FadeInTooltip() local tooltip = NarciTooltip; tooltip:Hide(); if not (tooltipAnchor and tooltipAnchor == GetMouseFocus()) then return; end; callbackFunc(); --Set texts tooltip.Pointer:ClearAllPoints(); tooltip:ClearAllPoints(); if not tooltip.UseCustomScale then tooltip:SetScale(tooltipAnchor:GetEffectiveScale()); end local offsetX = pointerOffsetX or 0; local offsetY = pointerOffsetY or DefaultPointerOffset; if isHorizontal then tooltip:SetPoint("RIGHT", tooltipAnchor, "LEFT", offsetX, offsetY); tooltip.Pointer2:SetPoint("CENTER", tooltipAnchor, "LEFT", offsetX - 12); tooltip.Pointer2:Show(); tooltip.Pointer:Hide(); else tooltip:SetPoint("BOTTOM", tooltipAnchor, "TOP", offsetX, offsetY); tooltip.Pointer:SetPoint("CENTER", tooltipAnchor, "TOP", offsetX, offsetY + 12); tooltip.Pointer:Show(); tooltip.Pointer2:Hide(); end After(0, function() UIFrameFadeIn(tooltip, 0.12, 0, 1); end); end local function DelayedEntrance(self, elapsed) if IsMouseButtonDown("LeftButton") then self:Hide(); return; end self.TimeSinceLastUpdate = self.TimeSinceLastUpdate + elapsed; if self.TimeSinceLastUpdate >= delayDuration then self:Hide(); FadeInTooltip(); end end Timer:SetScript("OnUpdate", DelayedEntrance); Timer:SetScript("OnHide", function(self) self.TimeSinceLastUpdate = 0; end) local function SetSingleLine() local tooltip = NarciTooltip; tooltip.IsSignleLine = true; local tex = pendingTexture; tooltip.Icon:Hide(); local TextObject = tooltip.Text0; TextObject:SetSize(0, 0); TextObject:Show(); TextObject:SetText(pendingText); tooltip.Guide:SetAlpha(0); end local function SetMultiLines() local tooltip = NarciTooltip; tooltip.IsSignleLine = false; local tex = pendingTexture; tooltip.Icon:SetTexture(tex[1]); tooltip.Icon:SetTexCoord(tex[2], tex[3], tex[4], tex[5], tex[6], tex[7], tex[8], tex[9]); tooltip.Icon:Show(); tooltip.Header:Show(); tooltip.Text1:Show(); tooltip.Header:SetText(pendingText[1]); tooltip.Text1:SetText(pendingText[2]); local index = tooltip.GuideIndex; if index then if Images[index] then tooltip.Guide.Picture:SetTexture(Images[index]); tooltip.Guide:SetAlpha(1); else tooltip.Guide:SetAlpha(0); end else tooltip.Guide:SetAlpha(0); end end local function GetIconFile(anchorFrame) local texureObject = anchorFrame.icon or anchorFrame.Icon; local texs = {}; if texureObject then local texFile = texureObject:GetTexture(); local ULx, ULy, LLx, LLy, URx, URy, LRx, LRy = texureObject:GetTexCoord(); texs = {texFile, ULx, ULy, LLx, LLy, URx, URy, LRx, LRy}; else texs = {nil, 0, 0, 0, 0, 0, 0, 0, 0}; end return texs; end ----------------------------------- function TP:OnHide() Timer:Hide(); self:ClearAllPoints(); self.Pointer:ClearAllPoints(); self:Hide(); self:SetAlpha(0); self.Text0:Hide(); self.Header:Hide(); self.Text1:Hide(); self.Icon:Hide(); end function TP:OnLoad() self.IsSignleLine = true; self.Scale = 1; end function TP:OnSizeChanged(width, height) self:SetSize(max(minSize, width), max(minSize, height)); local insetHeight = self.inset:GetHeight(); self.Icon:SetSize(insetHeight, insetHeight); end function TP:OnShow() if self.IsSignleLine then local textWidth, textHeight = self.Text0:GetSize(); self:SetSize(textWidth + 2*textInset, textHeight + 2*textInset); else self:SetWidth(fixedWidth); self.Guide:SetHeight(fixedWidth / 2 + 12); local height = (self.Header:GetHeight() + self.Text1:GetHeight() + 2 * (textInset - 6) + 24 + 4 + 1); self:SetHeight(height); end end function TP:FadeOut() if self:IsShown() then UIFrameFadeOut(self, 0.2, self:GetAlpha(), 0); end end function TP:JustHide() self:Hide(); self:SetAlpha(0); Timer:Hide(); end function TP:NewText(texts, offsetX, offsetY, delay, horizontal) Timer:Hide(); --UIFrameFadeOut(self, 0.2, self:GetAlpha(), 0); tooltipAnchor = GetMouseFocus(); if not tooltipAnchor or tooltipAnchor == WorldFrame or not texts then return; end; pointerOffsetX, pointerOffsetY = offsetX, offsetY; delayDuration = delay or DefaultDelay; isHorizontal = horizontal; pendingText = texts; pendingTexture = GetIconFile(tooltipAnchor); self.GuideIndex = tooltipAnchor.GuideIndex; After(0, function() Timer:Show(); if type(texts) == "string" then callbackFunc = SetSingleLine; elseif type(texts) == "table" then callbackFunc = SetMultiLines; end end) end function TP:ShowTooltip(frame, offsetX, offsetY, delay) self:NewText(frame.tooltip, offsetX, offsetY, delay); end function TP:SetColorTheme(index) local minG, maxG; if index and index == 1 then --Bright minG, maxG = 0.82, 1.0; self.Pointer:SetTexCoord(0, 0.5, 0, 1); self.Pointer2:SetTexCoord(0, 1, 0, 0.5); self.Text0:SetTextColor(0, 0, 0); self.Text0:SetShadowColor(1, 1, 1, 0); self.Text1:SetTextColor(0, 0, 0); self.Text1:SetShadowColor(1, 1, 1, 0); self.Header:SetTextColor(0, 0, 0); self.Header:SetShadowColor(1, 1, 1, 0); self.Icon:SetAlpha(0.2); else --Dark minG, maxG = 0.05, 0.12; self.Pointer:SetTexCoord(0.5, 1, 0, 1); self.Pointer2:SetTexCoord(0, 1, 0.5, 1); self.Text0:SetTextColor(1, 1, 1); self.Text0:SetShadowColor(0, 0, 0, 0); self.Text1:SetTextColor(1, 1, 1); self.Text1:SetShadowColor(0, 0, 0, 1); self.Header:SetTextColor(0.25, 0.78, 0.92); self.Header:SetShadowColor(0, 0, 0); self.Icon:SetAlpha(0.1); end self.Gradient:SetGradient("VERTICAL", minG, minG, minG, maxG, maxG, maxG); end function TP:SetCustomScale(scale) if scale then --set scale manually self.UseCustomScale = true; self:SetScale(scale); else --use anchor frame's scale self.UseCustomScale = false; end end --[[ /run NarciTooltip:SetColorTheme(2);NarciTooltip:NewText({NARCI_DRESSING_ROOM, NARCI_DRESSING_ROOM_DESCRIPTION}) /run NarciTooltip:SetSize(160,140) --]]
local surface = surface local draw = draw local Color = Color SKIN = {} SKIN.PrintName = "Computer Derma Skin" SKIN.Author = "SantosRP" SKIN.DermaVersion = 1 SKIN.GwenTexture = Material( "nomad/computer/srpcomputer.png" ) SKIN.bg_color = Color( 101, 100, 105, 255 ) SKIN.bg_color_sleep = Color( 70, 70, 70, 255 ) SKIN.bg_color_dark = Color( 55, 57, 61, 255 ) SKIN.bg_color_bright = Color( 220, 220, 220, 255 ) SKIN.frame_border = Color( 50, 50, 50, 255 ) SKIN.fontFrame = "DermaDefault" SKIN.control_color = Color( 120, 120, 120, 255 ) SKIN.control_color_highlight = Color( 150, 150, 150, 255 ) SKIN.control_color_active = Color( 110, 150, 250, 255 ) SKIN.control_color_bright = Color( 255, 200, 100, 255 ) SKIN.control_color_dark = Color( 100, 100, 100, 255 ) SKIN.bg_alt1 = Color( 50, 50, 50, 255 ) SKIN.bg_alt2 = Color( 55, 55, 55, 255 ) SKIN.listview_hover = Color( 70, 70, 70, 255 ) SKIN.listview_selected = Color( 100, 170, 220, 255 ) SKIN.text_bright = Color( 255, 255, 255, 255 ) SKIN.text_normal = Color( 180, 180, 180, 255 ) SKIN.text_dark = Color( 20, 20, 20, 255 ) SKIN.text_highlight = Color( 255, 20, 20, 255 ) SKIN.texGradientUp = Material( "gui/gradient_up" ) SKIN.texGradientDown = Material( "gui/gradient_down" ) SKIN.combobox_selected = SKIN.listview_selected SKIN.panel_transback = Color( 255, 255, 255, 50 ) SKIN.tooltip = Color( 255, 245, 175, 255 ) SKIN.colPropertySheet = Color( 170, 170, 170, 255 ) SKIN.colTab = SKIN.colPropertySheet SKIN.colTabInactive = Color( 140, 140, 140, 255 ) SKIN.colTabShadow = Color( 0, 0, 0, 170 ) SKIN.colTabText = Color( 255, 255, 255, 255 ) SKIN.colTabTextInactive = Color( 0, 0, 0, 200 ) SKIN.fontTab = "DermaDefault" SKIN.colCollapsibleCategory = Color( 255, 255, 255, 20 ) SKIN.colCategoryText = Color( 255, 255, 255, 255 ) SKIN.colCategoryTextInactive = Color( 200, 200, 200, 255 ) SKIN.fontCategoryHeader = "TabLarge" SKIN.colNumberWangBG = Color( 255, 240, 150, 255 ) SKIN.colTextEntryBG = Color( 240, 240, 240, 255 ) SKIN.colTextEntryBorder = Color( 20, 20, 20, 255 ) SKIN.colTextEntryText = Color( 20, 20, 20, 255 ) SKIN.colTextEntryTextHighlight = Color( 20, 200, 250, 255 ) SKIN.colTextEntryTextCursor = Color( 0, 0, 100, 255 ) SKIN.colMenuBG = Color( 255, 255, 255, 200 ) SKIN.colMenuBorder = Color( 0, 0, 0, 200 ) SKIN.colButtonText = Color( 255, 255, 255, 255 ) SKIN.colButtonTextDisabled = Color( 255, 255, 255, 55 ) SKIN.colButtonBorder = Color( 20, 20, 20, 255 ) SKIN.colButtonBorderHighlight = Color( 255, 255, 255, 50 ) SKIN.colButtonBorderShadow = Color( 0, 0, 0, 100 ) SKIN.tex = {} SKIN.tex.Selection = GWEN.CreateTextureBorder( 384, 32, 31, 31, 4, 4, 4, 4 ) SKIN.tex.Panels = {} SKIN.tex.Panels.Normal = GWEN.CreateTextureBorder( 256, 0, 63, 63, 16, 16, 16, 16 ) SKIN.tex.Panels.Bright = GWEN.CreateTextureBorder( 256+64, 0, 63, 63, 16, 16, 16, 16 ) SKIN.tex.Panels.Dark = GWEN.CreateTextureBorder( 256, 64, 63, 63, 16, 16, 16, 16 ) SKIN.tex.Panels.Highlight = GWEN.CreateTextureBorder( 256+64, 64, 63, 63, 16, 16, 16, 16 ) SKIN.tex.Button = GWEN.CreateTextureBorder( 480, 0, 31, 31, 8, 8, 8, 8 ) SKIN.tex.Button_Hovered = GWEN.CreateTextureBorder( 480, 32, 31, 31, 8, 8, 8, 8 ) SKIN.tex.Button_Dead = GWEN.CreateTextureBorder( 480, 64, 31, 31, 8, 8, 8, 8 ) SKIN.tex.Button_Down = GWEN.CreateTextureBorder( 480, 96, 31, 31, 8, 8, 8, 8 ) SKIN.tex.Shadow = GWEN.CreateTextureBorder( 448, 0, 31, 31, 8, 8, 8, 8 ) SKIN.tex.Tree = GWEN.CreateTextureBorder( 256, 128, 127, 127, 16, 16, 16, 16 ) SKIN.tex.Checkbox_Checked = GWEN.CreateTextureNormal( 448, 32, 15, 15 ) SKIN.tex.Checkbox = GWEN.CreateTextureNormal( 464, 32, 15, 15 ) SKIN.tex.CheckboxD_Checked = GWEN.CreateTextureNormal( 448, 48, 15, 15 ) SKIN.tex.CheckboxD = GWEN.CreateTextureNormal( 464, 48, 15, 15 ) --SKIN.tex.RadioButton_Checked = GWEN.CreateTextureNormal( 448, 64, 15, 15 ) --SKIN.tex.RadioButton = GWEN.CreateTextureNormal( 464, 64, 15, 15 ) --SKIN.tex.RadioButtonD_Checked = GWEN.CreateTextureNormal( 448, 80, 15, 15 ) --SKIN.tex.RadioButtonD = GWEN.CreateTextureNormal( 464, 80, 15, 15 ) SKIN.tex.TreePlus = GWEN.CreateTextureNormal( 448, 96, 15, 15 ) SKIN.tex.TreeMinus = GWEN.CreateTextureNormal( 464, 96, 15, 15 ) --SKIN.tex.Menu_Strip = GWEN.CreateTextureBorder( 0, 128, 127, 21, 1, 1, 1, 1 ) SKIN.tex.TextBox = GWEN.CreateTextureBorder( 0, 150, 127, 21, 4, 4, 4, 4 ) SKIN.tex.TextBox_Focus = GWEN.CreateTextureBorder( 0, 172, 127, 21, 4, 4, 4, 4 ) SKIN.tex.TextBox_Disabled = GWEN.CreateTextureBorder( 0, 194, 127, 21, 4, 4, 4, 4 ) SKIN.tex.MenuBG_Column = GWEN.CreateTextureBorder( 128, 128, 127, 63, 24, 8, 8, 8 ) SKIN.tex.MenuBG = GWEN.CreateTextureBorder( 128, 192, 127, 63, 8, 8, 8, 8 ) SKIN.tex.MenuBG_Hover = GWEN.CreateTextureBorder( 128, 256, 127, 31, 8, 8, 8, 8 ) SKIN.tex.MenuBG_Spacer = GWEN.CreateTextureNormal( 128, 288, 127, 3 ) SKIN.tex.Menu_Strip = GWEN.CreateTextureBorder( 0, 128, 127, 21, 8, 8, 8, 8) SKIN.tex.Menu_Check = GWEN.CreateTextureNormal( 448, 112, 15, 15 ) SKIN.tex.Tab_Control = GWEN.CreateTextureBorder( 0, 256, 127, 127, 8, 8, 8, 8 ) SKIN.tex.TabB_Active = GWEN.CreateTextureBorder( 0, 416, 63, 31, 8, 8, 8, 8 ) SKIN.tex.TabB_Inactive = GWEN.CreateTextureBorder( 0+128, 416, 63, 31, 8, 8, 8, 8 ) SKIN.tex.TabT_Active = GWEN.CreateTextureBorder( 0, 384, 63, 31, 8, 8, 8, 8 ) SKIN.tex.TabT_Inactive = GWEN.CreateTextureBorder( 0+128, 384, 63, 31, 8, 8, 8, 8 ) SKIN.tex.TabL_Active = GWEN.CreateTextureBorder( 64, 384, 31, 63, 8, 8, 8, 8 ) SKIN.tex.TabL_Inactive = GWEN.CreateTextureBorder( 64+128, 384, 31, 63, 8, 8, 8, 8 ) SKIN.tex.TabR_Active = GWEN.CreateTextureBorder( 96, 384, 31, 63, 8, 8, 8, 8 ) SKIN.tex.TabR_Inactive = GWEN.CreateTextureBorder( 96+128, 384, 31, 63, 8, 8, 8, 8 ) SKIN.tex.Tab_Bar = GWEN.CreateTextureBorder( 128, 352, 127, 31, 4, 4, 4, 4 ) SKIN.tex.Window = {} SKIN.tex.Window.Normal = GWEN.CreateTextureBorder( 0, 0, 127, 127, 8, 32, 8, 8 ) SKIN.tex.Window.Inactive = GWEN.CreateTextureBorder( 128, 0, 127, 127, 8, 32, 8, 8 ) SKIN.tex.Window.Close = GWEN.CreateTextureNormal( 32, 448, 31, 31 ) SKIN.tex.Window.Close_Hover = GWEN.CreateTextureNormal( 64, 448, 31, 31 ) SKIN.tex.Window.Close_Down = GWEN.CreateTextureNormal( 96, 448, 31, 31 ) SKIN.tex.Window.Maxi = GWEN.CreateTextureNormal( 32 + 96*2, 448, 31, 31 ) SKIN.tex.Window.Maxi_Hover = GWEN.CreateTextureNormal( 64 + 96*2, 448, 31, 31 ) SKIN.tex.Window.Maxi_Down = GWEN.CreateTextureNormal( 96 + 96*2, 448, 31, 31 ) SKIN.tex.Window.Restore = GWEN.CreateTextureNormal( 32 + 96*2, 448+32, 31, 31 ) SKIN.tex.Window.Restore_Hover = GWEN.CreateTextureNormal( 64 + 96*2, 448+32, 31, 31 ) SKIN.tex.Window.Restore_Down = GWEN.CreateTextureNormal( 96 + 96*2, 448+32, 31, 31 ) SKIN.tex.Window.Mini = GWEN.CreateTextureNormal( 32 + 96, 448, 31, 31 ) SKIN.tex.Window.Mini_Hover = GWEN.CreateTextureNormal( 64 + 96, 448, 31, 31 ) SKIN.tex.Window.Mini_Down = GWEN.CreateTextureNormal( 96 + 96, 448, 31, 31 ) SKIN.tex.Scroller = {} SKIN.tex.Scroller.TrackV = GWEN.CreateTextureBorder( 384, 208, 15, 127, 4, 4, 4, 4 ) SKIN.tex.Scroller.ButtonV_Normal = GWEN.CreateTextureBorder( 384 + 16, 208, 15, 127, 4, 4, 4, 4 ) SKIN.tex.Scroller.ButtonV_Hover = GWEN.CreateTextureBorder( 384 + 32, 208, 15, 127, 4, 4, 4, 4 ) SKIN.tex.Scroller.ButtonV_Down = GWEN.CreateTextureBorder( 384 + 48, 208, 15, 127, 4, 4, 4, 4 ) SKIN.tex.Scroller.ButtonV_Disabled = GWEN.CreateTextureBorder( 384 + 64, 208, 15, 127, 4, 4, 4, 4 ) SKIN.tex.Scroller.TrackH = GWEN.CreateTextureBorder( 384, 128, 127, 15, 4, 4, 4, 4 ) SKIN.tex.Scroller.ButtonH_Normal = GWEN.CreateTextureBorder( 384, 128 + 16, 127, 15, 4, 4, 4, 4 ) SKIN.tex.Scroller.ButtonH_Hover = GWEN.CreateTextureBorder( 384, 128 + 32, 127, 15, 4, 4, 4, 4 ) SKIN.tex.Scroller.ButtonH_Down = GWEN.CreateTextureBorder( 384, 128 + 48, 127, 15, 4, 4, 4, 4 ) SKIN.tex.Scroller.ButtonH_Disabled = GWEN.CreateTextureBorder( 384, 128 + 64, 127, 15, 4, 4, 4, 4 ) SKIN.tex.Scroller.LeftButton_Normal = GWEN.CreateTextureBorder( 464, 208, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.LeftButton_Hover = GWEN.CreateTextureBorder( 480, 208, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.LeftButton_Down = GWEN.CreateTextureBorder( 464, 272, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.LeftButton_Disabled = GWEN.CreateTextureBorder( 480 + 48, 272, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.UpButton_Normal = GWEN.CreateTextureBorder( 464, 208 + 16, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.UpButton_Hover = GWEN.CreateTextureBorder( 480, 208 + 16, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.UpButton_Down = GWEN.CreateTextureBorder( 464, 272 + 16, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.UpButton_Disabled = GWEN.CreateTextureBorder( 480 + 48, 272 + 16, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.RightButton_Normal = GWEN.CreateTextureBorder( 464, 208 + 32, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.RightButton_Hover = GWEN.CreateTextureBorder( 480, 208 + 32, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.RightButton_Down = GWEN.CreateTextureBorder( 464, 272 + 32, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.RightButton_Disabled = GWEN.CreateTextureBorder( 480 + 48, 272 + 32, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.DownButton_Normal = GWEN.CreateTextureBorder( 464, 208 + 48, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.DownButton_Hover = GWEN.CreateTextureBorder( 480, 208 + 48, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.DownButton_Down = GWEN.CreateTextureBorder( 464, 272 + 48, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Scroller.DownButton_Disabled = GWEN.CreateTextureBorder( 480 + 48, 272 + 48, 15, 15, 2, 2, 2, 2 ) SKIN.tex.Menu = {} SKIN.tex.Menu.RightArrow = GWEN.CreateTextureNormal( 464, 112, 15, 15 ) SKIN.tex.Input = {} SKIN.tex.Input.ComboBox = {} SKIN.tex.Input.ComboBox.Normal = GWEN.CreateTextureBorder( 384, 336, 127, 31, 8, 8, 32, 8 ) SKIN.tex.Input.ComboBox.Hover = GWEN.CreateTextureBorder( 384, 336+32, 127, 31, 8, 8, 32, 8 ) SKIN.tex.Input.ComboBox.Down = GWEN.CreateTextureBorder( 384, 336+64, 127, 31, 8, 8, 32, 8 ) SKIN.tex.Input.ComboBox.Disabled = GWEN.CreateTextureBorder( 384, 336+96, 127, 31, 8, 8, 32, 8 ) SKIN.tex.Input.ComboBox.Button = {} SKIN.tex.Input.ComboBox.Button.Normal = GWEN.CreateTextureNormal( 496, 272, 15, 15 ) SKIN.tex.Input.ComboBox.Button.Hover = GWEN.CreateTextureNormal( 496, 272+16, 15, 15 ) SKIN.tex.Input.ComboBox.Button.Down = GWEN.CreateTextureNormal( 496, 272+32, 15, 15 ) SKIN.tex.Input.ComboBox.Button.Disabled = GWEN.CreateTextureNormal( 496, 272+48, 15, 15 ) SKIN.tex.Input.UpDown = {} SKIN.tex.Input.UpDown.Up = {} SKIN.tex.Input.UpDown.Up.Normal = GWEN.CreateTextureCentered( 384, 112, 7, 7 ) SKIN.tex.Input.UpDown.Up.Hover = GWEN.CreateTextureCentered( 384+8, 112, 7, 7 ) SKIN.tex.Input.UpDown.Up.Down = GWEN.CreateTextureCentered( 384+16, 112, 7, 7 ) SKIN.tex.Input.UpDown.Up.Disabled = GWEN.CreateTextureCentered( 384+24, 112, 7, 7 ) SKIN.tex.Input.UpDown.Down = {} SKIN.tex.Input.UpDown.Down.Normal = GWEN.CreateTextureCentered( 384, 120, 7, 7 ) SKIN.tex.Input.UpDown.Down.Hover = GWEN.CreateTextureCentered( 384+8, 120, 7, 7 ) SKIN.tex.Input.UpDown.Down.Down = GWEN.CreateTextureCentered( 384+16, 120, 7, 7 ) SKIN.tex.Input.UpDown.Down.Disabled = GWEN.CreateTextureCentered( 384+24, 120, 7, 7 ) SKIN.tex.Input.Slider = {} SKIN.tex.Input.Slider.H = {} SKIN.tex.Input.Slider.H.Normal = GWEN.CreateTextureNormal( 416, 32, 15, 15 ) SKIN.tex.Input.Slider.H.Hover = GWEN.CreateTextureNormal( 416, 32+16, 15, 15 ) SKIN.tex.Input.Slider.H.Down = GWEN.CreateTextureNormal( 416, 32+32, 15, 15 ) SKIN.tex.Input.Slider.H.Disabled = GWEN.CreateTextureNormal( 416, 32+48, 15, 15 ) SKIN.tex.Input.Slider.V = {} SKIN.tex.Input.Slider.V.Normal = GWEN.CreateTextureNormal( 416+16, 32, 15, 15 ) SKIN.tex.Input.Slider.V.Hover = GWEN.CreateTextureNormal( 416+16, 32+16, 15, 15 ) SKIN.tex.Input.Slider.V.Down = GWEN.CreateTextureNormal( 416+16, 32+32, 15, 15 ) SKIN.tex.Input.Slider.V.Disabled = GWEN.CreateTextureNormal( 416+16, 32+48, 15, 15 ) SKIN.tex.Input.ListBox = {} SKIN.tex.Input.ListBox.Background = GWEN.CreateTextureBorder( 256, 256, 63, 127, 8, 8, 8, 8 ) SKIN.tex.Input.ListBox.Hovered = GWEN.CreateTextureBorder( 320, 320, 31, 31, 8, 8, 8, 8 ) SKIN.tex.Input.ListBox.EvenLine = GWEN.CreateTextureBorder( 352, 256, 31, 31, 8, 8, 8, 8 ) SKIN.tex.Input.ListBox.OddLine = GWEN.CreateTextureBorder( 352, 288, 31, 31, 8, 8, 8, 8 ) SKIN.tex.Input.ListBox.EvenLineSelected = GWEN.CreateTextureBorder( 320, 270, 31, 31, 8, 8, 8, 8 ) SKIN.tex.Input.ListBox.OddLineSelected = GWEN.CreateTextureBorder( 320, 288, 31, 31, 8, 8, 8, 8 ) SKIN.tex.ProgressBar = {} SKIN.tex.ProgressBar.Back = GWEN.CreateTextureBorder( 384, 0, 31, 31, 8, 8, 8, 8 ) SKIN.tex.ProgressBar.Front = GWEN.CreateTextureBorder( 384+32, 0, 31, 31, 8, 8, 8, 8 ) SKIN.tex.CategoryList = {} SKIN.tex.CategoryList.Outer = GWEN.CreateTextureBorder( 256, 384, 63, 63, 8, 8, 8, 8 ) SKIN.tex.CategoryList.Inner = GWEN.CreateTextureBorder( 256 + 64, 384, 63, 63, 8, 21, 8, 8 ) SKIN.tex.CategoryList.Header = GWEN.CreateTextureBorder( 320, 352, 63, 31, 8, 8, 8, 8 ) SKIN.tex.Tooltip = GWEN.CreateTextureBorder( 384, 64, 31, 31, 8, 8, 8, 8 ) SKIN.Colours = {} SKIN.Colours.Window = {} SKIN.Colours.Window.TitleActive = GWEN.TextureColor( 4 + 8 * 0, 508 ) SKIN.Colours.Window.TitleInactive = GWEN.TextureColor( 4 + 8 * 1, 508 ) SKIN.Colours.Button = {} SKIN.Colours.Button.Normal = GWEN.TextureColor( 4 + 8 * 2, 508 ) SKIN.Colours.Button.Hover = GWEN.TextureColor( 4 + 8 * 3, 508 ) SKIN.Colours.Button.Down = GWEN.TextureColor( 4 + 8 * 2, 500 ) SKIN.Colours.Button.Disabled = GWEN.TextureColor( 4 + 8 * 3, 500 ) SKIN.Colours.Tab = {} SKIN.Colours.Tab.Active = {} SKIN.Colours.Tab.Active.Normal = GWEN.TextureColor( 4 + 8 * 4, 508 ) SKIN.Colours.Tab.Active.Hover = GWEN.TextureColor( 4 + 8 * 5, 508 ) SKIN.Colours.Tab.Active.Down = GWEN.TextureColor( 4 + 8 * 4, 500 ) SKIN.Colours.Tab.Active.Disabled = GWEN.TextureColor( 4 + 8 * 5, 500 ) SKIN.Colours.Tab.Inactive = {} SKIN.Colours.Tab.Inactive.Normal = GWEN.TextureColor( 4 + 8 * 6, 508 ) SKIN.Colours.Tab.Inactive.Hover = GWEN.TextureColor( 4 + 8 * 7, 508 ) SKIN.Colours.Tab.Inactive.Down = GWEN.TextureColor( 4 + 8 * 6, 500 ) SKIN.Colours.Tab.Inactive.Disabled = GWEN.TextureColor( 4 + 8 * 7, 500 ) SKIN.Colours.Label = {} SKIN.Colours.Label.Default = GWEN.TextureColor( 4 + 8 * 8, 508 ) SKIN.Colours.Label.Bright = GWEN.TextureColor( 4 + 8 * 9, 508 ) SKIN.Colours.Label.Dark = GWEN.TextureColor( 4 + 8 * 8, 500 ) SKIN.Colours.Label.Highlight = GWEN.TextureColor( 4 + 8 * 9, 500 ) SKIN.Colours.Tree = {} SKIN.Colours.Tree.Lines = GWEN.TextureColor( 4 + 8 * 10, 508 ) ---- !!! SKIN.Colours.Tree.Normal = GWEN.TextureColor( 4 + 8 * 11, 508 ) SKIN.Colours.Tree.Hover = GWEN.TextureColor( 4 + 8 * 10, 500 ) SKIN.Colours.Tree.Selected = GWEN.TextureColor( 4 + 8 * 11, 500 ) SKIN.Colours.Properties = {} SKIN.Colours.Properties.Line_Normal = GWEN.TextureColor( 4 + 8 * 12, 508 ) SKIN.Colours.Properties.Line_Selected = GWEN.TextureColor( 4 + 8 * 13, 508 ) SKIN.Colours.Properties.Line_Hover = GWEN.TextureColor( 4 + 8 * 12, 500 ) SKIN.Colours.Properties.Title = GWEN.TextureColor( 4 + 8 * 13, 500 ) SKIN.Colours.Properties.Column_Normal = GWEN.TextureColor( 4 + 8 * 14, 508 ) SKIN.Colours.Properties.Column_Selected = GWEN.TextureColor( 4 + 8 * 15, 508 ) SKIN.Colours.Properties.Column_Hover = GWEN.TextureColor( 4 + 8 * 14, 500 ) SKIN.Colours.Properties.Border = GWEN.TextureColor( 4 + 8 * 15, 500 ) SKIN.Colours.Properties.Label_Normal = GWEN.TextureColor( 4 + 8 * 16, 508 ) SKIN.Colours.Properties.Label_Selected = GWEN.TextureColor( 4 + 8 * 17, 508 ) SKIN.Colours.Properties.Label_Hover = GWEN.TextureColor( 4 + 8 * 16, 500 ) SKIN.Colours.Category = {} SKIN.Colours.Category.Header = GWEN.TextureColor( 4 + 8 * 18, 500 ) SKIN.Colours.Category.Header_Closed = GWEN.TextureColor( 4 + 8 * 19, 500 ) SKIN.Colours.Category.Line = {} SKIN.Colours.Category.Line.Text = GWEN.TextureColor( 4 + 8 * 20, 508 ) SKIN.Colours.Category.Line.Text_Hover = GWEN.TextureColor( 4 + 8 * 21, 508 ) SKIN.Colours.Category.Line.Text_Selected = GWEN.TextureColor( 4 + 8 * 20, 500 ) SKIN.Colours.Category.Line.Button = GWEN.TextureColor( 4 + 8 * 21, 500 ) SKIN.Colours.Category.Line.Button_Hover = GWEN.TextureColor( 4 + 8 * 22, 508 ) SKIN.Colours.Category.Line.Button_Selected = GWEN.TextureColor( 4 + 8 * 23, 508 ) SKIN.Colours.Category.LineAlt = {} SKIN.Colours.Category.LineAlt.Text = GWEN.TextureColor( 4 + 8 * 22, 500 ) SKIN.Colours.Category.LineAlt.Text_Hover = GWEN.TextureColor( 4 + 8 * 23, 500 ) SKIN.Colours.Category.LineAlt.Text_Selected = GWEN.TextureColor( 4 + 8 * 24, 508 ) SKIN.Colours.Category.LineAlt.Button = GWEN.TextureColor( 4 + 8 * 25, 508 ) SKIN.Colours.Category.LineAlt.Button_Hover = GWEN.TextureColor( 4 + 8 * 24, 500 ) SKIN.Colours.Category.LineAlt.Button_Selected = GWEN.TextureColor( 4 + 8 * 25, 500 ) SKIN.Colours.TooltipText = GWEN.TextureColor( 4 + 8 * 26, 500 ) --[[--------------------------------------------------------- Panel -----------------------------------------------------------]] function SKIN:PaintPanel( panel, w, h ) if ( !panel.m_bBackground ) then return end self.tex.Panels.Normal( 0, 0, w, h, panel.m_bgColor ) end --[[--------------------------------------------------------- Panel -----------------------------------------------------------]] function SKIN:PaintShadow( panel, w, h ) SKIN.tex.Shadow( 0, 0, w, h ) end --[[--------------------------------------------------------- Frame -----------------------------------------------------------]] function SKIN:PaintFrame( panel, w, h ) if ( panel.m_bPaintShadow ) then DisableClipping( true ) SKIN.tex.Shadow( -4, -4, w+10, h+10 ) DisableClipping( false ) end if ( panel:HasHierarchicalFocus() ) then self.tex.Window.Normal( 0, 0, w, h ) else self.tex.Window.Inactive( 0, 0, w, h ) end end --[[--------------------------------------------------------- Button -----------------------------------------------------------]] function SKIN:PaintButton( panel, w, h ) if ( !panel.m_bBackground ) then return end if ( panel.Depressed || panel:IsSelected() || panel:GetToggle() ) then return self.tex.Button_Down( 0, 0, w, h ) end if ( panel:GetDisabled() ) then return self.tex.Button_Dead( 0, 0, w, h ) end if ( panel.Hovered ) then return self.tex.Button_Hovered( 0, 0, w, h ) end self.tex.Button( 0, 0, w, h ) end --[[--------------------------------------------------------- Tree -----------------------------------------------------------]] function SKIN:PaintTree( panel, w, h ) if ( !panel.m_bBackground ) then return end self.tex.Tree( 0, 0, w, h, panel.m_bgColor ) end --[[--------------------------------------------------------- CheckBox -----------------------------------------------------------]] function SKIN:PaintCheckBox( panel, w, h ) if ( panel:GetChecked() ) then if ( panel:GetDisabled() ) then self.tex.CheckboxD_Checked( 0, 0, w, h ) else self.tex.Checkbox_Checked( 0, 0, w, h ) end else if ( panel:GetDisabled() ) then self.tex.CheckboxD( 0, 0, w, h ) else self.tex.Checkbox( 0, 0, w, h ) end end end --[[--------------------------------------------------------- ExpandButton -----------------------------------------------------------]] function SKIN:PaintExpandButton( panel, w, h ) if ( !panel:GetExpanded() ) then self.tex.TreePlus( 0, 0, w, h ) else self.tex.TreeMinus( 0, 0, w, h ) end end --[[--------------------------------------------------------- TextEntry -----------------------------------------------------------]] function SKIN:PaintTextEntry( panel, w, h ) if ( panel.m_bBackground ) then if ( panel:GetDisabled() ) then self.tex.TextBox_Disabled( 0, 0, w, h ) elseif ( panel:HasFocus() ) then self.tex.TextBox_Focus( 0, 0, w, h ) else self.tex.TextBox( 0, 0, w, h ) end end panel:DrawTextEntryText( panel.m_colText, panel.m_colHighlight, panel.m_colCursor ) end function SKIN:SchemeTextEntry( panel ) ---------------------- TODO panel:SetTextColor( self.colTextEntryText ) panel:SetHighlightColor( self.colTextEntryTextHighlight ) panel:SetCursorColor( self.colTextEntryTextCursor ) end --[[--------------------------------------------------------- Menu -----------------------------------------------------------]] function SKIN:PaintMenu( panel, w, h ) if ( panel:GetDrawColumn() ) then self.tex.MenuBG_Column( 0, 0, w, h ) else self.tex.MenuBG( 0, 0, w, h ) end end --[[--------------------------------------------------------- Menu -----------------------------------------------------------]] function SKIN:PaintMenuSpacer( panel, w, h ) self.tex.MenuBG( 0, 0, w, h ) end --[[--------------------------------------------------------- MenuOption -----------------------------------------------------------]] function SKIN:PaintMenuOption( panel, w, h ) if ( panel.m_bBackground && (panel.Hovered || panel.Highlight) ) then self.tex.MenuBG_Hover( 0, 0, w, h ) end if ( panel:GetChecked() ) then self.tex.Menu_Check( 5, h/2-7, 15, 15 ) end end --[[--------------------------------------------------------- MenuRightArrow -----------------------------------------------------------]] function SKIN:PaintMenuRightArrow( panel, w, h ) self.tex.Menu.RightArrow( 0, 0, w, h ) end --[[--------------------------------------------------------- PropertySheet -----------------------------------------------------------]] function SKIN:PaintPropertySheet( panel, w, h ) -- TODO: Tabs at bottom, left, right local ActiveTab = panel:GetActiveTab() local Offset = 0 if ( ActiveTab ) then Offset = ActiveTab:GetTall()-8 end self.tex.Tab_Control( 0, Offset, w, h-Offset ) end --[[--------------------------------------------------------- Tab -----------------------------------------------------------]] function SKIN:PaintTab( panel, w, h ) if ( panel:GetPropertySheet():GetActiveTab() == panel ) then return self:PaintActiveTab( panel, w, h ) end self.tex.TabT_Inactive( 0, 0, w, h ) end function SKIN:PaintActiveTab( panel, w, h ) self.tex.TabT_Active( 0, 0, w, h ) end --[[--------------------------------------------------------- Button -----------------------------------------------------------]] function SKIN:PaintWindowCloseButton( panel, w, h ) if ( !panel.m_bBackground ) then return end if ( panel:GetDisabled() ) then return self.tex.Window.Close( 0, 0, w, h, Color( 255, 255, 255, 50 ) ) end if ( panel.Depressed || panel:IsSelected() ) then return self.tex.Window.Close_Down( 0, 0, w, h ) end if ( panel.Hovered ) then return self.tex.Window.Close_Hover( 0, 0, w, h ) end self.tex.Window.Close( 0, 0, w, h ) end function SKIN:PaintWindowMinimizeButton( panel, w, h ) if ( !panel.m_bBackground ) then return end if ( panel:GetDisabled() ) then return self.tex.Window.Mini( 0, 0, w, h, Color( 255, 255, 255, 50 ) ) end if ( panel.Depressed || panel:IsSelected() ) then return self.tex.Window.Mini_Down( 0, 0, w, h ) end if ( panel.Hovered ) then return self.tex.Window.Mini_Hover( 0, 0, w, h ) end self.tex.Window.Mini( 0, 0, w, h ) end function SKIN:PaintWindowMaximizeButton( panel, w, h ) if ( !panel.m_bBackground ) then return end if ( panel:GetDisabled() ) then return self.tex.Window.Maxi( 0, 0, w, h, Color( 255, 255, 255, 50 ) ) end if ( panel.Depressed || panel:IsSelected() ) then return self.tex.Window.Maxi_Down( 0, 0, w, h ) end if ( panel.Hovered ) then return self.tex.Window.Maxi_Hover( 0, 0, w, h ) end self.tex.Window.Maxi( 0, 0, w, h ) end --[[--------------------------------------------------------- VScrollBar -----------------------------------------------------------]] function SKIN:PaintVScrollBar( panel, w, h ) self.tex.Scroller.TrackV( 0, 0, w, h ) end --[[--------------------------------------------------------- ScrollBarGrip -----------------------------------------------------------]] function SKIN:PaintScrollBarGrip( panel, w, h ) if ( panel:GetDisabled() ) then return self.tex.Scroller.ButtonV_Disabled( 0, 0, w, h ) end if ( panel.Depressed ) then return self.tex.Scroller.ButtonV_Down( 0, 0, w, h ) end if ( panel.Hovered ) then return self.tex.Scroller.ButtonV_Hover( 0, 0, w, h ) end return self.tex.Scroller.ButtonV_Normal( 0, 0, w, h ) end --[[--------------------------------------------------------- ButtonDown -----------------------------------------------------------]] function SKIN:PaintButtonDown( panel, w, h ) if ( !panel.m_bBackground ) then return end if ( panel.Depressed || panel:IsSelected() ) then return self.tex.Scroller.DownButton_Down( 0, 0, w, h ) end if ( panel:GetDisabled() ) then return self.tex.Scroller.DownButton_Dead( 0, 0, w, h ) end if ( panel.Hovered ) then return self.tex.Scroller.DownButton_Hover( 0, 0, w, h ) end self.tex.Scroller.DownButton_Normal( 0, 0, w, h ) end --[[--------------------------------------------------------- ButtonUp -----------------------------------------------------------]] function SKIN:PaintButtonUp( panel, w, h ) if ( !panel.m_bBackground ) then return end if ( panel.Depressed || panel:IsSelected() ) then return self.tex.Scroller.UpButton_Down( 0, 0, w, h ) end if ( panel:GetDisabled() ) then return self.tex.Scroller.UpButton_Dead( 0, 0, w, h ) end if ( panel.Hovered ) then return self.tex.Scroller.UpButton_Hover( 0, 0, w, h ) end self.tex.Scroller.UpButton_Normal( 0, 0, w, h ) end --[[--------------------------------------------------------- ButtonLeft -----------------------------------------------------------]] function SKIN:PaintButtonLeft( panel, w, h ) if ( !panel.m_bBackground ) then return end if ( panel.Depressed || panel:IsSelected() ) then return self.tex.Scroller.LeftButton_Down( 0, 0, w, h ) end if ( panel:GetDisabled() ) then return self.tex.Scroller.LeftButton_Dead( 0, 0, w, h ) end if ( panel.Hovered ) then return self.tex.Scroller.LeftButton_Hover( 0, 0, w, h ) end self.tex.Scroller.LeftButton_Normal( 0, 0, w, h ) end --[[--------------------------------------------------------- ButtonRight -----------------------------------------------------------]] function SKIN:PaintButtonRight( panel, w, h ) if ( !panel.m_bBackground ) then return end if ( panel.Depressed || panel:IsSelected() ) then return self.tex.Scroller.RightButton_Down( 0, 0, w, h ) end if ( panel:GetDisabled() ) then return self.tex.Scroller.RightButton_Dead( 0, 0, w, h ) end if ( panel.Hovered ) then return self.tex.Scroller.RightButton_Hover( 0, 0, w, h ) end self.tex.Scroller.RightButton_Normal( 0, 0, w, h ) end --[[--------------------------------------------------------- ComboDownArrow -----------------------------------------------------------]] function SKIN:PaintComboDownArrow( panel, w, h ) if ( panel.ComboBox:GetDisabled() ) then return self.tex.Input.ComboBox.Button.Disabled( 0, 0, w, h ) end if ( panel.ComboBox.Depressed || panel.ComboBox:IsMenuOpen() ) then return self.tex.Input.ComboBox.Button.Down( 0, 0, w, h ) end if ( panel.ComboBox.Hovered ) then return self.tex.Input.ComboBox.Button.Hover( 0, 0, w, h ) end self.tex.Input.ComboBox.Button.Normal( 0, 0, w, h ) end --[[--------------------------------------------------------- ComboBox -----------------------------------------------------------]] function SKIN:PaintComboBox( panel, w, h ) if ( panel:GetDisabled() ) then return self.tex.Input.ComboBox.Disabled( 0, 0, w, h ) end if ( panel.Depressed || panel:IsMenuOpen() ) then return self.tex.Input.ComboBox.Down( 0, 0, w, h ) end if ( panel.Hovered ) then return self.tex.Input.ComboBox.Hover( 0, 0, w, h ) end self.tex.Input.ComboBox.Normal( 0, 0, w, h ) end --[[--------------------------------------------------------- ComboBox -----------------------------------------------------------]] function SKIN:PaintListBox( panel, w, h ) self.tex.Input.ListBox.Background( 0, 0, w, h ) end --[[--------------------------------------------------------- NumberUp -----------------------------------------------------------]] function SKIN:PaintNumberUp( panel, w, h ) if ( panel:GetDisabled() ) then return self.Input.UpDown.Up.Disabled( 0, 0, w, h ) end if ( panel.Depressed ) then return self.tex.Input.UpDown.Up.Down( 0, 0, w, h ) end if ( panel.Hovered ) then return self.tex.Input.UpDown.Up.Hover( 0, 0, w, h ) end self.tex.Input.UpDown.Up.Normal( 0, 0, w, h ) end --[[--------------------------------------------------------- NumberDown -----------------------------------------------------------]] function SKIN:PaintNumberDown( panel, w, h ) if ( panel:GetDisabled() ) then return self.tex.Input.UpDown.Down.Disabled( 0, 0, w, h ) end if ( panel.Depressed ) then return self.tex.Input.UpDown.Down.Down( 0, 0, w, h ) end if ( panel.Hovered ) then return self.tex.Input.UpDown.Down.Hover( 0, 0, w, h ) end self.tex.Input.UpDown.Down.Normal( 0, 0, w, h ) end function SKIN:PaintTreeNode( panel, w, h ) if ( !panel.m_bDrawLines ) then return end surface.SetDrawColor( self.Colours.Tree.Lines ) if ( panel.m_bLastChild ) then surface.DrawRect( 9, 0, 1, 7 ) surface.DrawRect( 9, 7, 9, 1 ) else surface.DrawRect( 9, 0, 1, h ) surface.DrawRect( 9, 7, 9, 1 ) end end function SKIN:PaintTreeNodeButton( panel, w, h ) if ( !panel.m_bSelected ) then return end -- Don't worry this isn't working out the size every render -- it just gets the cached value from inside the Label local w, _ = panel:GetTextSize() self.tex.Selection( 38, 0, w + 6, h ) end function SKIN:PaintSelection( panel, w, h ) self.tex.Selection( 0, 0, w, h ) end function SKIN:PaintSliderKnob( panel, w, h ) if ( panel:GetDisabled() ) then return self.tex.Input.Slider.H.Disabled( 0, 0, w, h ) end if ( panel.Depressed ) then return self.tex.Input.Slider.H.Down( 0, 0, w, h ) end if ( panel.Hovered ) then return self.tex.Input.Slider.H.Hover( 0, 0, w, h ) end self.tex.Input.Slider.H.Normal( 0, 0, w, h ) end local function PaintNotches( x, y, w, h, num ) if ( !num ) then return end local space = w / num for i=0, num do surface.DrawRect( x + i * space, y + 4, 1, 5 ) end end function SKIN:PaintNumSlider( panel, w, h ) surface.SetDrawColor( Color( 0, 0, 0, 100 ) ) surface.DrawRect( 8, h / 2 - 1, w - 15, 1 ) PaintNotches( 8, h / 2 - 1, w - 16, 1, panel.m_iNotches ) end function SKIN:PaintProgress( panel, w, h ) self.tex.ProgressBar.Back( 0, 0, w, h ) self.tex.ProgressBar.Front( 0, 0, w * panel:GetFraction(), h ) end function SKIN:PaintCollapsibleCategory( panel, w, h ) if ( !panel:GetExpanded() && h < 40 ) then return self.tex.CategoryList.Header( 0, 0, w, h ) end self.tex.CategoryList.Inner( 0, 0, w, h ) end function SKIN:PaintCategoryList( panel, w, h ) self.tex.CategoryList.Outer( 0, 0, w, h ) end function SKIN:PaintCategoryButton( panel, w, h ) if ( panel.AltLine ) then if ( panel.Depressed || panel.m_bSelected ) then surface.SetDrawColor( self.Colours.Category.LineAlt.Button_Selected ) elseif ( panel.Hovered ) then surface.SetDrawColor( self.Colours.Category.LineAlt.Button_Hover ) else surface.SetDrawColor( self.Colours.Category.LineAlt.Button ) end else if ( panel.Depressed || panel.m_bSelected ) then surface.SetDrawColor( self.Colours.Category.Line.Button_Selected ) elseif ( panel.Hovered ) then surface.SetDrawColor( self.Colours.Category.Line.Button_Hover ) else surface.SetDrawColor( self.Colours.Category.Line.Button ) end end surface.DrawRect( 0, 0, w, h ) end function SKIN:PaintListViewLine( panel, w, h ) if ( panel:IsSelected() ) then self.tex.Input.ListBox.EvenLineSelected( 0, 0, w, h ) elseif ( panel.Hovered ) then self.tex.Input.ListBox.Hovered( 0, 0, w, h ) elseif ( panel.m_bAlt ) then self.tex.Input.ListBox.EvenLine( 0, 0, w, h ) end end function SKIN:PaintListView( panel, w, h ) self.tex.Input.ListBox.Background( 0, 0, w, h ) end function SKIN:PaintTooltip( panel, w, h ) self.tex.Tooltip( 0, 0, w, h ) end function SKIN:PaintMenuBar( panel, w, h ) self.tex.Menu_Strip( 0, 0, w, h ) end derma.DefineSkin( "srp_comp", "SRPComputer", SKIN )
-- Test vstruct performance. local vstruct = require "vstruct" local read,write = vstruct.read,vstruct.write local SIZE = 2^14 local data = { strings = {}; numbers = {}; booleans = {}; masks = {}; } for i=1,SIZE do data.strings[i] = "xxxx" data.numbers[i] = i data.booleans[i] = i % 2 == 0 data.masks[i] = { true, true, false, true, false, false, true, true } end local function perf(format, data, file) format = '@0 ' .. SIZE .. ' * ' .. format local wstart,rstart,stop if not file then wstart = os.clock() local buf = write(format, data) rstart = os.clock() read(format, buf) stop = os.clock() else local fd = io.open(file, 'w+') wstart = os.clock() write(format, fd, data) rstart = os.clock() read(format, fd) stop = os.clock() fd:close() end return stop - rstart,rstart - wstart end local wtotal,rtotal = 0,0 local function report(format, read, write) print(("%4s%8.4f%8.4f"):format(format, read, write)) rtotal = rtotal + read wtotal = wtotal + write end local formats = { strings = {'c', 's', 'z'}; numbers = {'f', 'i', 'p8,', 'u'}; booleans = {'b'}; masks = {'m'}; } for _,file in ipairs { false, "/tmp/vstruct_perf" } do if file then print('---- using file ----') else print('---- using string ----') end for type,formats in pairs(formats) do for _,format in ipairs(formats) do for _,size in ipairs { 4, 8 } do report(format..size, perf(format..size, data[type], file)) end end end end print('---- -----') print("total", rtotal, wtotal)
--Creator: MIMI#0001-- if game.Players.LocalPlayer.Character.Humanoid.RigType == Enum.HumanoidRigType.R6 then spawn(function() local speaker = game.Players.LocalPlayer local Anim = Instance.new("Animation") Anim.AnimationId = "rbxassetid://27432686" local bruh = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim) bruh:Play() bruh:AdjustSpeed(0) speaker.Character.Animate.Disabled = true local hi = Instance.new("Sound") hi.Name = "Sound" hi.SoundId = "http://www.roblox.com/asset/?id=8114290584" hi.Volume = 2 hi.Looped = false hi.archivable = false hi.Parent = game.Workspace hi:Play() wait(1.5) local spinSpeed = 40 local Spin = Instance.new("BodyAngularVelocity") Spin.Name = "Spinning" Spin.Parent = game.Players.LocalPlayer.Character.HumanoidRootPart Spin.MaxTorque = Vector3.new(0, math.huge, 0) Spin.AngularVelocity = Vector3.new(0,spinSpeed,0) wait(3.5) while speaker.Character.Humanoid.Health > 0 do wait(0.1) speaker.Character.Humanoid.HipHeight = speaker.Character.Humanoid.HipHeight + 1 end end) else spawn(function() local speaker = game.Players.LocalPlayer local Anim = Instance.new("Animation") Anim.AnimationId = "rbxassetid://507776043" local bruh = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(Anim) bruh:Play() bruh:AdjustSpeed(0) speaker.Character.Animate.Disabled = true local hi = Instance.new("Sound") hi.Name = "Sound" hi.SoundId = "http://www.roblox.com/asset/?id=8114290584" hi.Volume = 2 hi.Looped = false hi.archivable = false hi.Parent = game.Workspace hi:Play() wait(1.5) local spinSpeed = 40 local Spin = Instance.new("BodyAngularVelocity") Spin.Name = "Spinning" Spin.Parent = game.Players.LocalPlayer.Character.HumanoidRootPart Spin.MaxTorque = Vector3.new(0, math.huge, 0) Spin.AngularVelocity = Vector3.new(0,spinSpeed,0) wait(3.5) while speaker.Character.Humanoid.Health > 0 do wait(0.1) speaker.Character.Humanoid.HipHeight = speaker.Character.Humanoid.HipHeight + 1 end end) end
return { wall = function(cutscene, event) -- Open textbox and wait for completion cutscene:text("* The wall seems cracked.") -- If we have Susie, play a cutscene local susie = cutscene:getCharacter("susie") if susie then -- Detach camera and followers (since characters will be moved) cutscene:detachCamera() cutscene:detachFollowers() -- All text from now is spoken by Susie cutscene:setSpeaker(susie) cutscene:text("* Hey, think I can break\nthis wall?", "face_2") -- Get the bottom-center of the broken wall local x = event.x + event.width/2 local y = event.y + event.height/2 -- Move Susie up to the wall cutscene:walkTo(susie, x, y + 40, 4, "up") -- Move other party members behind Susie cutscene:walkTo(Game.world.player, x, y + 100, 2, "up") if cutscene:getCharacter("ralsei") then cutscene:walkTo("ralsei", x + 60, y + 100, 3, "up") end if cutscene:getCharacter("noelle") then cutscene:walkTo("noelle", x - 60, y + 100, 3, "up") end -- Wait 1.5 seconds cutscene:wait(1.5) -- Walk back, cutscene:wait(cutscene:walkTo(susie, x, y + 60, 2, "up")) -- and run forward! cutscene:wait(cutscene:walkTo(susie, x, y + 20, 8)) -- Slam!! Assets.playSound("snd_impact") susie:shake(4) susie:setSprite("shock_up") -- Slide back a bit cutscene:slideTo(susie, x, y + 40, 4) cutscene:wait(1.5) -- owie susie:setSprite("head_hand_left") susie:shake(4) Assets.playSound("snd_wing") cutscene:wait(1) cutscene:text("* Guess not.", "face_3") -- Return things to normal susie:resetSprite() cutscene:attachCamera() cutscene:attachFollowers() end end }
local major = "AceGUI-3.0-SpellLoader" local minor = 1 local SpellLoader = LibStub:NewLibrary(major, minor) if( not SpellLoader ) then return end SpellLoader.predictors = SpellLoader.predictors or {} SpellLoader.spellList = SpellLoader.spellList or {} SpellLoader.spellsLoaded = SpellLoader.spellsLoaded or 0 local SPELLS_PER_RUN = 500 local TIMER_THROTTLE = 0.10 local spells, predictors = SpellLoader.spellList, SpellLoader.predictors function SpellLoader:RegisterPredictor(frame) self.predictors[frame] = true end function SpellLoader:UnregisterPredictor(frame) self.predictors[frame] = nil end function SpellLoader:StartLoading() if( self.loader ) then return end local blacklist = { ["Interface\\Icons\\Trade_Alchemy"] = true, ["Interface\\Icons\\Trade_BlackSmithing"] = true, ["Interface\\Icons\\Trade_BrewPoison"] = true, ["Interface\\Icons\\Trade_Engineering"] = true, ["Interface\\Icons\\Trade_Engraving"] = true, ["Interface\\Icons\\Trade_Fishing"] = true, ["Interface\\Icons\\Trade_Herbalism"] = true, ["Interface\\Icons\\Trade_LeatherWorking"] = true, ["Interface\\Icons\\Trade_Mining"] = true, ["Interface\\Icons\\Trade_Tailoring"] = true, ["Interface\\Icons\\Temp"] = true, } local timeElapsed, totalInvalid, currentIndex = 0, 0, 0 self.loader = CreateFrame("Frame") self.loader:SetScript("OnUpdate", function(self, elapsed) timeElapsed = timeElapsed + elapsed if( timeElapsed < TIMER_THROTTLE ) then return end timeElapsed = timeElapsed - TIMER_THROTTLE -- 5,000 invalid spells in a row means it's a safe assumption that there are no more spells to query if( totalInvalid >= 5000 ) then self:Hide() return end -- Load as many spells in for spellID=currentIndex + 1, currentIndex + SPELLS_PER_RUN do local name, rank, icon = GetSpellInfo(spellID) -- Pretty much every profession spell uses Trade_* and 99% of the random spells use the Trade_Engineering icon -- we can safely blacklist any of these spells as they are not needed. Can get away with this because things like -- Alchemy use two icons, the Trade_* for the actual crafted spell and a different icon for the actual buff -- Passive spells have no use as well, since they are well passive and can't actually be used if( name and not blacklist[icon] and rank ~= SPELL_PASSIVE ) then name = string.lower(name) SpellLoader.spellsLoaded = SpellLoader.spellsLoaded + 1 spells[spellID] = string.lower(name) totalInvalid = 0 else totalInvalid = totalInvalid + 1 end end -- Every ~1 second it will update any visible predictors to make up for the fact that the data is delay loaded if( currentIndex % 5000 == 0 ) then for predictor in pairs(predictors) do if( predictor:IsVisible() ) then predictor:Query() end end end -- Increment and do it all over! currentIndex = currentIndex + SPELLS_PER_RUN end) end
local fs = require 'fs' function cdHandle(inp) local input, exit, err = hilbish.runner.lua(inp) if not err then return input, exit, err end input, exit, err = hilbish.runner.sh(inp) if exit ~= 0 and hilbish.opts.autocd then local ok, stat = pcall(fs.stat, input) if ok and stat.isDir then -- discard here to not append the cd, which will be in history _, exit, err = hilbish.runner.sh('cd ' .. input) end end return input, exit, err end hilbish.runner.setMode(cdHandle)
-- Copyright (c) 2020, The Pallene Developers -- Pallene is licensed under the MIT license. -- Please refer to the LICENSE and AUTHORS files for details -- SPDX-License-Identifier: MIT local ir = require "pallene.ir" local typedecl = require "pallene.typedecl" local constant_propagation = {} local function is_constant_value(v) local tag = v._tag if tag == "ir.Value.Nil" then return true elseif tag == "ir.Value.Bool" then return true elseif tag == "ir.Value.Integer" then return true elseif tag == "ir.Value.Float" then return true elseif tag == "ir.Value.String" then return true elseif tag == "ir.Value.LocalVar" then return false elseif tag == "ir.Value.Upvalue" then return false else typedecl.tag_error(tag) end end -- Stores the constant initializers for local variables and upvalues of a function. local function FuncData(func) local fdata = { n_writes_of_locvar = {}, -- { loc_id => integer } locvar_constant_init = {}, -- { loc_id => ir.Value } constant_val_of_upvalue = {}, -- { upv_id => ir.Value } new_upvalue_id = {}, -- { upv_id => upv_id } } for loc_id = 1, #func.vars do fdata.locvar_constant_init[loc_id] = false fdata.n_writes_of_locvar[loc_id] = 0 end for u_id = 1, #func.captured_vars do fdata.constant_val_of_upvalue[u_id] = false end return fdata end -- Replaces toplevel constant variables by their respective values. -- -- Currently assumes that the toplevel constant variable is initialized with a constant literal. -- Does not currently recognize non-trivial constant expressions as being constant. function constant_propagation.run(module) -- 1) Find which variables are initialized to a constant. local data_of_func = {} -- list of FuncData for _, func in ipairs(module.functions) do table.insert(data_of_func, FuncData(func)) end for f_id, func in ipairs(module.functions) do -- DFS traversal to find the ir.Cmd.Move instructions which have constant -- values as their src. We can look inside initializers in loops and if-statements because -- the `uninitialized.lua` pass takes care of variables that are used before being initialized. local f_data = assert(data_of_func[f_id]) for cmd in ir.iter(func.body) do local tag = cmd._tag if tag == "ir.Cmd.Move" then local id = cmd.dst if is_constant_value(cmd.src) then f_data.locvar_constant_init[id] = cmd.src end elseif tag == "ir.Cmd.SetUpvalues" then for u_id, value in ipairs(cmd.srcs) do local next_f = data_of_func[cmd.f_id] if value._tag == "ir.Value.LocalVar" then local const_init = f_data.locvar_constant_init[value.id] next_f.constant_val_of_upvalue[u_id] = const_init elseif value._tag == "ir.Value.Upvalue" then -- A `NewClosure` or `SetUpvalues` instruction can only reference values in outer scopes, -- which exist in surrounding functions that have a numerically lesser `f_id`. -- Due to this, we can reliable tie the constant initializer of an inner upvalue in a nested -- function to the constantant initializer of the outer upvalue that it captures. local const_init = f_data.constant_val_of_upvalue[value.id] next_f.constant_val_of_upvalue[u_id] = const_init else typedecl.tag_error(value._tag) end end end end for loc_id = 1, #func.typ.arg_types do f_data.locvar_constant_init[loc_id] = false end end -- 2) Find which local variables are never re-initialized. for f_id, func in ipairs(module.functions) do local f_data = assert(data_of_func[f_id]) local n_writes = f_data.n_writes_of_locvar for cmd in ir.iter(func.body) do local tag = cmd._tag if tag == "ir.Cmd.SetUpvalues" then local next_f = assert(data_of_func[cmd.f_id]) for u_id, value in ipairs(cmd.srcs) do if value._tag == "ir.Value.LocalVar" then if n_writes[value.id] ~= 1 then next_f.constant_val_of_upvalue[u_id] = false end elseif value._tag == "ir.Value.Upvalue" then next_f.constant_val_of_upvalue[u_id] = f_data.constant_val_of_upvalue[value.id] else typedecl.tag_error(value._tag) end end else local dsts = ir.get_dsts(cmd) for _, dst_id in ipairs(dsts) do n_writes[dst_id] = n_writes[dst_id] + 1 end end end -- Because of the way the previous compiler passes work, it is guaranteed that an upvalue that has a -- constant initializer always references a local variable with a write count of 1. In other words, -- IR like this is currently not possible: -- ``` -- x1 <- 10 -- loop { -- x2 = NewClosure() -- x2.upvalues <- x1 -- x1 <- 20 -- } -- ``` -- Since x1 is a "mutable upvalue", the assignment_conversion pass turns it into a record type. -- With this loop, we assert this assumption. for cmd in ir.iter(func.body) do local tag = cmd._tag if tag == "ir.Cmd.SetUpvalues" then local next_f = assert(data_of_func[cmd.f_id]) for u_id, value in ipairs(cmd.srcs) do if value._tag == "ir.Value.LocalVar" and next_f.constant_val_of_upvalue[u_id] then assert(n_writes[value.id] == 1) end end end end end -- 3) Remove propagated upvalues from the capture list. for _, func in ipairs(module.functions) do for cmd in ir.iter(func.body) do if cmd._tag == "ir.Cmd.SetUpvalues" then local next_f = assert(data_of_func[cmd.f_id]) local ir_func = module.functions[cmd.f_id] local new_u_id = next_f.new_upvalue_id local new_srcs = {} local new_captured_vars = {} for u_id, value in ipairs(cmd.srcs) do if not next_f.constant_val_of_upvalue[u_id] then table.insert(new_srcs, value) table.insert(new_captured_vars, ir_func.captured_vars[u_id]) new_u_id[u_id] = #new_srcs end end cmd.srcs = new_srcs ir_func.captured_vars = new_captured_vars end end end -- 4) Propagate the constants local variables and upvalues. -- Returns a new `ir.Value` representing `src_val` after constant propagation. -- @param f_data FuncData of the function whose IR contains `src_val`. -- @param func corresponding ir.Function -- @param src_val The value that we may need to update. local function updated_value(f_data, src_val) if src_val._tag == "ir.Value.LocalVar" and f_data.n_writes_of_locvar[src_val.id] == 1 and f_data.locvar_constant_init[src_val.id] then return f_data.locvar_constant_init[src_val.id] elseif src_val._tag == "ir.Value.Upvalue" then if f_data.constant_val_of_upvalue[src_val.id] then return f_data.constant_val_of_upvalue[src_val.id] else local u_id = assert(f_data.new_upvalue_id[src_val.id]) return ir.Value.Upvalue(u_id) end end return src_val end for f_id, func in ipairs(module.functions) do local f_data = data_of_func[f_id] func.body = ir.map_cmd(func.body, function(cmd) local inputs = ir.get_value_field_names(cmd) for _, src_field in ipairs(inputs.src) do cmd[src_field] = updated_value(f_data, cmd[src_field]) end for _, src_field in ipairs(inputs.srcs) do local srcs = cmd[src_field] for i, value in ipairs(srcs) do srcs[i] = updated_value(f_data, value) end end return false end) end ir.clean_all(module) return module, {} end return constant_propagation
return { DOMAIN = 1, PORT = 1, SERVER = 1, TIMEOUT = 1, ZONE = 1, message = 1, send = 1, }
local M = {SemVer = {}, Requirement = {}, } local SemVer = M.SemVer local Requirement = M.Requirement local Range = require("crates.types").Range function SemVer.new(obj) return setmetatable(obj, { __index = SemVer }) end function SemVer:display() local text = "" if self.major then text = text .. self.major end if self.minor then text = text .. "." .. self.minor end if self.patch then text = text .. "." .. self.patch end if self.pre then text = text .. "-" .. self.pre end if self.meta then text = text .. "+" .. self.meta end return text end function M.parse_version(str) local major, minor, patch, pre, meta major, minor, patch, pre, meta = str:match("^([0-9]+)%.([0-9]+)%.([0-9]+)-([^%s]+)%+([^%s]+)$") if major then return SemVer.new({ major = tonumber(major), minor = tonumber(minor), patch = tonumber(patch), pre = pre, meta = meta, }) end major, minor, patch, pre = str:match("^([0-9]+)%.([0-9]+)%.([0-9]+)-([^%s]+)$") if major then return SemVer.new({ major = tonumber(major), minor = tonumber(minor), patch = tonumber(patch), pre = pre, }) end major, minor, patch, meta = str:match("^([0-9]+)%.([0-9]+)%.([0-9]+)%+([^%s]+)$") if major then return SemVer.new({ major = tonumber(major), minor = tonumber(minor), patch = tonumber(patch), meta = meta, }) end major, minor, patch = str:match("^([0-9]+)%.([0-9]+)%.([0-9]+)$") if major then return SemVer.new({ major = tonumber(major), minor = tonumber(minor), patch = tonumber(patch), }) end major, minor = str:match("^([0-9]+)%.([0-9]+)[%.]?$") if major then return SemVer.new({ major = tonumber(major), minor = tonumber(minor), }) end major = str:match("^([0-9]+)[%.]?$") if major then return SemVer.new({ major = tonumber(major), }) end return SemVer.new({}) end function M.parse_requirement(str) local vs, vers_str, ve, rs, re vs, vers_str, ve = str:match("^=%s*()(.+)()$") if vs and vers_str and ve then return { cond = "eq", cond_col = Range.new(0, vs - 1), vers = M.parse_version(vers_str), vers_col = Range.new(vs - 1, ve - 1), } end vs, vers_str, ve = str:match("^<=%s*()(.+)()$") if vs and vers_str and ve then return { cond = "le", cond_col = Range.new(0, vs - 1), vers = M.parse_version(vers_str), vers_col = Range.new(vs - 1, ve - 1), } end vs, vers_str, ve = str:match("^<%s*()(.+)()$") if vs and vers_str and ve then return { cond = "lt", cond_col = Range.new(0, vs - 1), vers = M.parse_version(vers_str), vers_col = Range.new(vs - 1, ve - 1), } end vs, vers_str, ve = str:match("^>=%s*()(.+)()$") if vs and vers_str and ve then return { cond = "ge", cond_col = Range.new(0, vs - 1), vers = M.parse_version(vers_str), vers_col = Range.new(vs - 1, ve - 1), } end vs, vers_str, ve = str:match("^>%s*()(.+)()$") if vs and vers_str and ve then return { cond = "gt", cond_col = Range.new(0, vs - 1), vers = M.parse_version(vers_str), vers_col = Range.new(vs - 1, ve - 1), } end vs, vers_str, ve = str:match("^%~%s*()(.+)()$") if vs and vers_str and ve then return { cond = "tl", cond_col = Range.new(0, vs - 1), vers = M.parse_version(vers_str), vers_col = Range.new(vs - 1, ve - 1), } end vers_str, rs, re = str:match("^(.+)()%.%*()$") if vers_str and rs and re then return { cond = "wl", cond_col = Range.new(rs - 1, re - 1), vers = M.parse_version(vers_str), vers_col = Range.new(0, rs - 1), } end vs, vers_str, ve = str:match("^%^%s*()(.+)()$") if vs and vers_str and ve then return { cond = "cr", cond_col = Range.new(0, vs - 1), vers = M.parse_version(vers_str), vers_col = Range.new(vs - 1, ve - 1), } end return { cond = "bl", cond_col = Range.new(0, 0), vers = M.parse_version(str), vers_col = Range.new(0, str:len()), } end function M.parse_requirements(str) local requirements = {} for rs, r in str:gmatch("[,]?%s*()([^,]+)%s*[,]?") do local s = rs local requirement = M.parse_requirement(r) requirement.vers_col.s = requirement.vers_col.s + s - 1 requirement.vers_col.e = requirement.vers_col.e + s - 1 table.insert(requirements, requirement) end return requirements end local function filled_zeros(version) return { major = version.major or 0, minor = version.minor or 0, patch = version.patch or 0, pre = version.pre, } end local function compare_pre(a, b) if a and b then if a < b then return -1 elseif a == b then return 0 elseif a > b then return 1 end end if a and not b then return -1 elseif not a and not b then return 0 elseif not a and b then return 1 end end local function compare_versions(a, b) local major = a.major - b.major local minor = a.minor - b.minor local patch = a.patch - b.patch local pre = compare_pre(a.pre, b.pre) if major == 0 then if minor == 0 then if patch == 0 then return pre else return patch end else return minor end else return major end end function M.matches_requirement(v, r) if r.cond == "cr" or r.cond == "bl" then if r.vers.major == v.major and not r.vers.minor then return true end local a = filled_zeros(v) local b = filled_zeros(r.vers) local c if b.major == 0 and b.minor == 0 then c = { major = 0, minor = 0, patch = b.patch + 1 } elseif b.major == 0 then c = { major = 0, minor = b.minor + 1, patch = 0 } else c = { major = b.major + 1, minor = 0, patch = 0 } end return compare_versions(a, b) >= 0 and compare_versions(a, c) < 0 end if r.cond == "tl" then local a = v local b = r.vers local c if not b.minor and not b.patch then c = { major = b.major + 1, minor = 0, patch = 0 } else c = { major = b.major, minor = b.minor + 1, patch = 0 } end b = filled_zeros(b) return compare_versions(a, b) >= 0 and compare_versions(a, c) < 0 end if r.cond == "eq" or r.cond == "wl" then if r.vers.major ~= v.major then return false end if r.vers.minor and r.vers.minor ~= v.minor then return false end if r.vers.patch and r.vers.patch ~= v.patch then return false end return r.vers.pre == v.pre and r.vers.meta == v.meta elseif r.cond == "lt" then local a = filled_zeros(v) local b = filled_zeros(r.vers) return compare_versions(a, b) < 0 elseif r.cond == "le" then local a = filled_zeros(v) local b = filled_zeros(r.vers) return compare_versions(a, b) <= 0 elseif r.cond == "gt" then local a = filled_zeros(v) local b = filled_zeros(r.vers) return compare_versions(a, b) > 0 elseif r.cond == "ge" then local a = filled_zeros(v) local b = filled_zeros(r.vers) return compare_versions(a, b) >= 0 end end function M.matches_requirements(version, requirements) for _, r in ipairs(requirements) do if not M.matches_requirement(version, r) then return false end end return true end return M
-- ITS - In The Shadows -- Copyright (C) 2015, 2016, 2017 James Niemira -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- 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 General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- James Niemira "urmane" -- [email protected] newEntity{ define_as = "TO_WORLDMAP", name = "Exit to the World Map", display = '<', color_r=255, color_g=0, color_b=255, back_color=colors.DARK_GREY, always_remember = true, notice = true, change_level = 1, change_zone = "world-of-afeedi", } newEntity{ define_as = "UP", name = "previous level", display = '<', color_r=255, color_g=255, color_b=0, back_color=colors.DARK_GREY, notice = true, always_remember = true, change_level = -1, } newEntity{ define_as = "DOWN", name = "next level", display = '>', color_r=255, color_g=255, color_b=0, back_color=colors.DARK_GREY, notice = true, always_remember = true, change_level = 1, } newEntity{ define_as = "FLOOR", name = "floor", image = "terrain/granite/floor_1.png", display = ' ', color_r=255, color_g=255, color_b=255, back_color=colors.DARK_GREY, } newEntity{ define_as = "WALL", name = "wall", image = "terrain/granite/wall_1.png", display = '#', color_r=255, color_g=255, color_b=255, back_color=colors.GREY, always_remember = true, does_block_move = true, on_block_bump = function(e) end, on_block_bump_msg = "You bump the wall.", can_pass = {pass_wall=1}, block_sight = true, air_level = -20, dig = "FLOOR", } newEntity{ define_as = "WALLGRATE", name = "wall", image = "terrain/granite_wallgrate1.png", display = '#', color_r=255, color_g=255, color_b=255, back_color=colors.GREY, always_remember = true, does_block_move = true, block_sight = false, can_pass = {pass_wall=1}, dig = "FLOOR", } newEntity{ define_as = "DEEP_WATER", name = "deep_water", image = "terrain/deepwater.png", display = '~', color_r=0, color_g=0, color_b=255, back_color=colors.DARK_BLUE, } newEntity{ define_as = "DOOR", name = "door", image = "terrain/granite_door_closed.png", display = '+', color_r=238, color_g=154, color_b=77, back_color=colors.DARK_UMBER, notice = true, always_remember = true, block_sight = true, door_opened = "DOOR_OPEN", dig = "DOOR_OPEN", } newEntity{ define_as = "DOOR_OPEN", name = "open door", image = "terrain/granite_door_open.png", display = "'", color_r=238, color_g=154, color_b=77, back_color=colors.DARK_GREY, always_remember = true, door_closed = "DOOR", } -- putting lock_mfctr here makes them all the same for a level ... hm ... newEntity{ define_as = "DOOR_LOCKED", name = "locked door", image = "terrain/granite_door_closed.png", display = '+', color_r=238, color_g=154, color_b=77, back_color=colors.DARK_UMBER, notice = true, always_remember = true, block_sight = true, door_unlocked = "DOOR", lock_mfctr=game.markov["elvish"]:generateWord("E", 3, 9), lock_value = 10, }
--[[ The MIT License (MIT) Copyright (c) 2014 Socialz (+ soc-i-alz GitHub organization) 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 _outputChatBox = outputChatBox function outputChatBox( text, visibleTo, r, g, b, colorCoded ) if ( string.len( text ) > 128 ) then _outputChatBox( string.sub( text, 1, 127 ), visibleTo, r, g, b, colorCoded ) outputChatBox( " " .. string.sub( text, 128 ), visibleTo, r, g, b, colorCoded ) else _outputChatBox( text, visibleTo, r, g, b, colorCoded ) end end function outputLocalChat( player, message, originalDistance ) if ( not exports.common:isPlayerPlaying( player ) ) then return end local posX, posY, posZ = getElementPosition( player ) local vehicle = getPedOccupiedVehicle( player ) local vehicleModel, vehicleType = "", "Vehicle" local isBike = false local isWindowless = false local isRoofless = false if ( vehicle ) then vehicleModel = getElementModel( vehicle ) or false vehicleType = getVehicleType( vehicle ) or false isBike = exports.vehicles:getBikeModels( )[ vehicleModel ] or false isWindowless = exports.vehicles:getWindowlessModels( )[ vehicleModel ] or false isRoofless = exports.vehicles:getRooflessModels( )[ vehicleModel ] or false end local vehiclePrefix = "" if ( vehicle ) then if ( isBike ) then vehiclePrefix = "(On Bike) " else if ( vehicleType == "Automobile" ) then vehiclePrefix = "(In Car) " else vehiclePrefix = "(In " .. vehicleType .. ") " end end end local senderLanguage, senderSkill = getPlayerLanguage( player, 1 ) if ( not senderLanguage ) then outputChatBox( "Wops, you do not have a language!", player, 230, 95, 95 ) return end local senderLanguageName = getLanguageName( senderLanguage ) local languagePrefix = "[" .. senderLanguageName .. "] " distance = tonumber( originalDistance ) or 3000 * 3000 * 2 for _, targetPlayer in ipairs( getElementsByType( "player" ) ) do local targetX, targetY, targetZ = getElementPosition( targetPlayer ) local targetDistance = getDistanceBetweenPoints3D( posX, posY, posZ, targetX, targetY, targetZ ) if ( distance == 10000 ) or ( targetDistance < distance ) and ( ( getElementInterior( targetPlayer ) == getElementInterior( player ) ) and ( getElementDimension( targetPlayer ) == getElementDimension( player ) ) ) then local r, g, b = 240, 240, 240 if ( targetDistance > 8 ) then r, g, b = r - targetDistance * 2, g - targetDistance * 2, b - targetDistance * 2 end if ( not hasLanguage( targetPlayer, senderLanguage ) ) then if ( player ~= targetPlayer ) then local length = string.len( message ) local percent = 100 - math.min( getPlayerLanguageSkill( targetPlayer, senderLanguage ), senderSkill ) local replace = ( percent / 100 ) * length if ( senderLanguage == 1337 ) then message = hash( "md5", message ) else local i = 1 while ( i < replace ) do local letter = string.sub( message, i, i ) if ( letter ~= "" ) and ( letter ~= " " ) then local replaceLetter if ( string.byte( letter ) >= 65 ) and ( string.byte( letter ) <= 90 ) then replaceLetter = string.char(math.random( 65, 90 ) ) elseif ( string.byte( letter ) >= 97 ) and ( string.byte( letter ) <= 122 ) then replaceLetter = string.char( math.random( 97, 122 ) ) end if ( string.byte( letter ) >= 65 and string.byte( letter ) <= 90 ) or ( string.byte( letter ) >= 97 and string.byte( letter ) <= 122 ) then message = string.gsub( message, tostring( letter ), replaceLetter, 1 ) end end i = i + 1 end end end else if ( senderSkill < 100 ) then if ( senderSkill > getPlayerLanguageSkill( targetPlayer, senderLanguage ) ) or ( getPlayerLanguageSkill( targetPlayer, senderLanguage ) < 85 ) then increaseLanguageSkill( player, senderLanguage ) end end end local typePrefix = "" if ( distance == 0.9 ) then typePrefix = "(Close Whisper) " elseif ( distance == 3 ) then typePrefix = "(Whisper) " elseif ( distance == 40 ) then typePrefix = "(Shout) " elseif ( distance == 60 ) then typePrefix = "(Megaphone) " end local isOnDuty = exports.common:isOnDuty( targetPlayer ) local prefixes = typePrefix .. vehiclePrefix .. ( isOnDuty and languagePrefix or "" ) message = exports.common:cleanString( message ) local firstLetter, restMessage = string.upper( message:sub( 1, 1 ) ), message:sub( 2 ) message = firstLetter .. restMessage if ( distance <= 60 ) then if ( ( vehicle ) and ( ( isOnDuty ) or ( ( not isOnDuty ) and ( exports.vehicles:isVehicleWindowsDown( vehicle ) or isBike or isWindowless or isRoofless or getPedOccupiedVehicle( targetPlayer ) == vehicle ) ) ) or ( not vehicle ) ) then outputChatBox( prefixes .. exports.common:getPlayerName( player ) .. " says: " .. message, targetPlayer, r, g, b, false ) end else if ( originalDistance ) then if ( string.find( originalDistance, "r" ) ) then local frequency = string.gsub( originalDistance, "r", "" ) if ( exports.items:hasItem( targetPlayer, 13, frequency ) ) or ( getDistanceBetweenPoints3D( posX, posY, posZ, targetX, targetY, targetZ ) <= 20 ) then outputChatBox( "[#" .. frequency .. "] " .. prefixes .. exports.common:getPlayerName( player ) .. " says: " .. message, targetPlayer, 95, 95, 220, false ) end end end end end end end function outputLocalActionMe( player, action ) if ( exports.common:isPlayerPlaying( player ) ) then local x, y, z = getElementPosition( player ) local affected = "" action = exports.common:cleanString( action ) for _, targetPlayer in ipairs( getElementsByType( "player" ) ) do local px, py, pz = getElementPosition( targetPlayer ) local distance = getDistanceBetweenPoints3D( px, py, pz, x, y, z ) if ( distance < 30 ) and ( getElementInterior( player ) == getElementInterior( targetPlayer ) ) and ( getElementDimension( player ) == getElementDimension( targetPlayer ) ) then outputChatBox( " *" .. exports.common:getPlayerName( player ) .. " " .. action, targetPlayer, 237, 116, 136, false ) end end end end
--Creates invisible button onload, hidden under the "REFILL" on the deck pad function onLoad() self.createButton({ click_function="click_draw_hero", function_owner=self, position={0,0,0}, label="Draw hero", color={1,1,1,0}, width=2000, height=3000 }) self.createButton({ click_function="click_buy_hero", function_owner=self, position={0,0.01,4}, label="Buy hero", color={1,1,1,1}, width=2000, height=1000, font_size = 250 }) --Local positions for each pile of cards playerBoards = { ["Red"]="8a35bd", ["Green"]="d7ee3e", ["Yellow"]="ed0d43", ["Blue"]="9d82f3", ["White"]="206c9c" } pos_discard = {-0.957, 0.178, 0.222} pos_draw = {0.957, 0.178, 0.222} pos_add2 = {-3.15, 0.178, 0.222} --drawbuyguids drawbuyguids = { ["Red"]="aabe45", ["Green"]="bf3815", ["Yellow"]="11b14c", ["Blue"]="b8a776", ["Silver"]="75241e" } dividedDeckGUIDs = { ["Red"]="4c1868", ["Green"]="8656c3", ["Yellow"]="533311", ["Blue"]="3d3ba7", ["Silver"]="725c5d" } hero_deck_zone_guid = "0cd6a9" twistpileGUID = "4f53f9" kopile_guid = "79d60b" for i,o in pairs(drawbuyguids) do if o == self.guid then divided_deck_guid = dividedDeckGUIDs[i] end end end function click_buy_hero(obj, player_clicker_color) local card = getHero(false) if not card then return nil end local desc = card.getDescription() local schemeParts = getObjectFromGUID("912967").Call('returnSetupParts') if not schemeParts then printToAll("No scheme specified!") schemeParts = {"no scheme"} end if desc:find("WALL%-CRAWL") or schemeParts[1] == "Splice Humans with Spider DNA" then pos = pos_draw card.flip() elseif desc:find("SOARING FLIGHT") then pos = pos_add2 else pos = pos_discard end local playerBoard = getObjectFromGUID(playerBoards[player_clicker_color]) local dest = playerBoard.positionToWorld(pos) if player_clicker_color == "White" then angle = 90 elseif player_clicker_color == "Blue" then angle = -90 else angle = 180 end local brot = {x=0, y=angle, z=0} card.setRotationSmooth(brot) card.setPositionSmooth({x=dest.x,y=dest.y+3,z=dest.z}) click_draw_hero() end function getHero(face,bs) local objects = findObjectsAtPosition({0,0,0}) if not objects then return nil end if not bs then bs = false end local card = nil for _,item in pairs(objects) do if item.tag == "Card" and item.is_face_down == face and item.hasTag("Bystander") == bs then card = item elseif item.tag == "Deck" and item.is_face_down == true and face == true then card = item end end --log (card) if not card then return nil end return card end function getHeroUp() return getHero(false) end function getHeroDown() return getHero(true) end function getBystander() return getHero(false,true) end function getCards() local objects = findObjectsAtPosition({0,0,0}) return objects end function click_draw_hero() local schemeParts = getObjectFromGUID("912967").Call('returnSetupParts') if not schemeParts then printToAll("No scheme specified!") schemeParts = {"no scheme"} end if schemeParts[1] == "Divide and Conquer" then deckToDrawGUID = divided_deck_guid else deckToDrawGUID = hero_deck_zone_guid end hero_deck = get_decks_and_cards_from_zone(deckToDrawGUID) if schemeParts[1] == "Go Back in Time to Slay Heroes' Ancestors" then purge = function(obj) local purgedheroes = get_decks_and_cards_from_zone(twistpileGUID) if purgedheroes[1] then if purgedheroes[1].tag == "Deck" then for _,o in pairs(purgedheroes[1].getObjects()) do if o.name == obj.getName() then broadcastToAll("Purged hero " .. obj.getName() .. " KO'd from HQ") obj.setPositionSmooth(getObjectFromGUID(kopile_guid).getPosition()) click_draw_hero() break end end else if purgedheroes[1].getName() == obj.getName() then broadcastToAll("Purged hero " .. obj.getName() .. " KO'd from HQ") obj.setPositionSmooth(getObjectFromGUID(kopile_guid).getPosition()) click_draw_hero() end end end end else purge = nil end local pos = {self.getPosition().x,self.getPosition().y+5,self.getPosition().z} if hero_deck[1] then if hero_deck[1].tag == "Deck" then takeParams = { position = pos, flip = hero_deck[1].is_face_down, callback_function = purge } hero_deck[1].takeObject(takeParams) else hero_deck[1].flip() hero_deck[1].setPositionSmooth(pos) end else printToAll("No hero deck found") end end function findObjectsAtPosition(localPos) local globalPos = self.positionToWorld(localPos) local objList = Physics.cast({ origin=globalPos, direction={0,1,0}, type=2, size={2,2,2}, max_distance=1, debug=false }) local decksAndCards = {} for _, obj in ipairs(objList) do if obj.hit_object.tag == "Deck" or obj.hit_object.tag == "Card" then table.insert(decksAndCards, obj.hit_object) end end return decksAndCards end function get_decks_and_cards_from_zone(zoneGUID) local zone = getObjectFromGUID(zoneGUID) if zone then decks = zone.getObjects() else return nil end local result = {} if decks then for k, deck in pairs(decks) do local desc = deck.getDescription() if deck.tag == "Deck" or deck.tag == "Card" or deck.getName() == "Shard" then table.insert(result, deck) end end end return result end
local red = 0 local green = 0 local blue = 0 local velocity = nil local counter = 0 local STARTINGCOUNTER = 60 local window local function getNumber() return engine.math.random(0, 128) / 255 end local function makeVelocity() return {r = getNumber(), g = getNumber(), b = getNumber()} end function engine.update(dt) counter = counter - dt if counter < 0 then velocity = makeVelocity() counter = STARTINGCOUNTER end red = red + (velocity.r * dt) if (red > 1.0) or (red < 0.0) then velocity.r = -velocity.r end green = green + (velocity.g * dt) if (green > 1.0) or (green < 0.0) then velocity.g = -velocity.g end blue = blue + (velocity.b * dt) if (blue > 1.0) or (blue < 0.0) then velocity.b = -0.1 end engine.display.set_clear_color(window, red, green, blue, 1.0) end function engine.keyboard(buffer) if (buffer == 'q') then engine.requestshutdown() end end function engine.started() window = engine.createdefaultwindow() engine.display.set_window_title(window, "Color Shifter") end
--[[ This example spawns, rigs, and animates a Luanoid using a modified version of Dogutsune's Dogu15 rig which is a R15 rig with mesh deformation. This example depends on HttpService being enabled to insert the rig. Dogu15 Rig: https://devforum.roblox.com/t/dogu15-an-improved-r15-rig-mesh-deformation/532832 Modified Rig: https://www.roblox.com/library/6324529033/R15Rig ]] local ReplicatedStorage = game:GetService("ReplicatedStorage") local InsertService = game:GetService("InsertService") local RunService = game:GetService("RunService") local PRIORITY = Enum.AnimationPriority local ANIMATIONS = { Climbing = { AnimationId = "http://www.roblox.com/asset/?id=507765644", Priority = PRIORITY.Movement }, Falling = { AnimationId = "http://www.roblox.com/asset/?id=507767968", Priority = PRIORITY.Movement }, Idling = { AnimationId = "http://www.roblox.com/asset/?id=507766388", -- Looking around: 507766666 Priority = PRIORITY.Idle }, Jumping = { AnimationId = "http://www.roblox.com/asset/?id=507765000", Priority = PRIORITY.Movement }, Swimming = { AnimationId = "http://www.roblox.com/asset/?id=913384386", Priority = PRIORITY.Movement }, Walking = { AnimationId = "http://www.roblox.com/asset/?id=913402848", Priority = PRIORITY.Movement }, } local DOGU15_RIG if RunService:IsServer() then DOGU15_RIG = ReplicatedStorage:FindFirstChild("R15Rig") or InsertService:LoadAsset(6324529033).R15Rig DOGU15_RIG.Parent = ReplicatedStorage else DOGU15_RIG = ReplicatedStorage:WaitForChild("R15Rig") end for _,animationData in pairs(ANIMATIONS) do local animation = Instance.new("Animation") animation.AnimationId = animationData.AnimationId animationData.Animation = animation end return function(cf) local luanoid = require(ReplicatedStorage.Luanoid)() luanoid:SetRig(DOGU15_RIG:Clone()) luanoid.RootPart.CFrame = cf or CFrame.new(0, 10, 0) luanoid.Character.Parent = workspace for animationName, animationData in pairs(ANIMATIONS) do luanoid:LoadAnimation( animationData.Animation, animationName, { Priority = animationData[2], } ) end for _,part in ipairs(luanoid.Character:GetDescendants()) do if part:IsA("BasePart") then part.Anchored = false end end return luanoid end
function load(add) player = game:GetService("Players").lordsheen local starter = Instance.new("ScreenGui") starter.Parent = player.PlayerGui script.Parent = starter local Frame = Instance.new("Frame") Frame.Parent = starter Frame.Position = UDim2.new(0,0,0,355) row = 0 for i,a in pairs(game.NetworkServer:GetChildren()) do row = row +1 local pcont = Instance.new("TextLabel") pcont.Text = a.Name .. " = " ..game.Players:children()[i].Name.. " = "..math.floor(game.Players:children()[i].AccountAge/365).." years , "..(game.Players:children()[i].AccountAge%365).." days" --here pcont.Size = UDim2.new(0,500,0,20) pcont.Parent = Frame pcont.FontSize = "Size12" pcont.BorderSizePixel = 3 pcont.Transparency = 0.2 pcont.Name = "OneOfPlayers" pcont.TextColor = BrickColor.new("Really black") pcont.BackgroundColor = BrickColor.new("Bright yellow") pcont.Position = UDim2.new(0,0,0,-200 + row*20) local fref = Instance.new("Frame") fref.Parent = starter fref.Position = UDim2.new(0,50,0,335) local ref = Instance.new("TextButton") ref.Text = "Refresh" ref.Size = UDim2.new(0,140,0,40) ref.Parent = fref ref.FontSize = "Size24" ref.BorderSizePixel = 3 ref.Transparency = 0.2 ref.Name = "clickmelol1" ref.TextColor = BrickColor.new("Really black") ref.BackgroundColor = BrickColor.new("Lime green") ref.Position = UDim2.new(0,0,0,-200) function click() for i,p in pairs(player.PlayerGui:GetChildren()) do if p.className == "ScreenGui" then p:Remove() end end wait() load() end ref.MouseButton1Down:connect(click) end --[[ lego ]]-- end load()
local SP = SmoothyPlates local Utils = SP.Utils local Healers = SP.Addon:NewModule('Healers', 'AceEvent-3.0') local healerclasses = { [65] = 'Paladin: Holy', [105] = 'Druid: Restoration', [256] = 'Priest: Discipline', [257] = 'Priest: Holy', [264] = 'Shaman: Restoration', [270] = 'Monk: Mistweaver' } -- Stolen from Healers have to Die local onlyHealerSpellIds = { -- Priests -- Discipline [047540] = 'PRIEST', -- Penance [109964] = 'PRIEST', -- Spirit shell -- not seen in disc [033206] = 'PRIEST', -- Pain Suppression [000527] = 'PRIEST', -- Purify [081749] = 'PRIEST', -- Atonement [132157] = 'PRIEST', -- Holy Nova -- Holy [000596] = 'PRIEST', -- Prayer of Healing [014914] = 'PRIEST', -- Holy Fire [002060] = 'PRIEST', -- Heal [034861] = 'PRIEST', -- Circle of Healing [064843] = 'PRIEST', -- Divine Hymn [047788] = 'PRIEST', -- Guardian Spirit [032546] = 'PRIEST', -- Binding Heal [077485] = 'PRIEST', -- Mastery: Echo of Light -- the passibe ability -- [077489] = "PRIEST", -- Echo of Light -- the aura applied by the afformentioned [000139] = 'PRIEST', -- Renew -- Druids - Restauration --[018562] = "DRUID", -- Swiftmend -- (also available through restoration afinity talent) [102342] = 'DRUID', -- Ironbark [033763] = 'DRUID', -- Lifebloom [088423] = 'DRUID', -- Nature's Cure -- [008936] = "DRUID", -- Regrowth -- (also available through restoration afinity talent) [033891] = 'DRUID', -- Incarnation: Tree of Life -- [048438] = "DRUID", -- Wild Growth -- disabled in WoW8: In the feral talents, level 45, you can choose Restoration Affinity, which includes Rejuv, Swiftmend, Wild Growth. [000740] = 'DRUID', -- Tranquility -- [145108] = "DRUID", -- Ysera's Gift -- (also available through restoration afinity talent) -- [000774] = "DRUID", -- Rejuvination -- (also available through restoration afinity talent) -- Shamans - Restauration [061295] = 'SHAMAN', -- Riptide [077472] = 'SHAMAN', -- Healing Wave [098008] = 'SHAMAN', -- Spirit link totem [073920] = 'SHAMAN', -- Healing Rain -- Paladins - Holy [020473] = 'PALADIN', -- Holy Shock [053563] = 'PALADIN', -- Beacon of Light [082326] = 'PALADIN', -- Holy Light [085222] = 'PALADIN', -- Light of Dawn -- Monks - Mistweaver [115175] = 'MONK', -- Soothing Mist [115310] = 'MONK', -- Revival --[116670] = "MONK", -- Vivify all monks have it in WoW8 [116680] = 'MONK', -- Thunder Focus Tea [116849] = 'MONK' -- Life Cocoon -- [119611] = "MONK", -- Renewing mist } function Healers:OnEnable() SP.SmoothyPlate.RegisterFrame('Healer Icon', 'HEALER_ICON') self:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED') SP.callbacks.RegisterCallback(self, 'AFTER_SP_CREATION', 'CreateElement_HealerIcon') SP.callbacks.RegisterCallback(self, 'AFTER_SP_UNIT_ADDED', 'UNIT_ADDED') SP.callbacks.RegisterCallback(self, 'BEFORE_SP_UNIT_REMOVED', 'UNIT_REMOVED') end local healerGUIDs = {} SP.hookOnClean( function() healerGUIDs = {} end ) function Healers:CreateElement_HealerIcon(_, plate) local sp = plate.SmoothyPlate.sp local w, h = SP.Layout.HW('HEALER_ICON', self) local a, p, x, y = SP.Layout.APXY('HEALER_ICON', sp, self) local HealerIcon = CreateFrame('Frame', nil, sp) HealerIcon:SetFrameLevel(2) HealerIcon:SetSize(w, h) HealerIcon:SetPoint(a, p, x, y) HealerIcon:SetAlpha(SP.Layout.GET('HEALER_ICON', 'opacity', self)) HealerIcon.textureBack = Utils.createSimpleFrame(nil, HealerIcon, true) HealerIcon.textureBack:SetSize(w, h) HealerIcon.textureBack:SetPoint(a, x, y) Utils.addBorder(HealerIcon.textureBack) HealerIcon.textureBack:SetBackdropColor(0, 0, 0, 0.4) HealerIcon.tex = HealerIcon.textureBack:CreateTexture() HealerIcon.tex:SetTexture(SP.Vars.ui.textures.HEALER_ICON) HealerIcon.tex:SetAllPoints() sp['HEALER_ICON'] = HealerIcon plate.SmoothyPlate:hookFrame('HEALER_ICON') HealerIcon:Hide() end local getPlateByGUID = SP.Nameplates.getPlateByGUID function Healers:UNIT_ADDED(_, plate) local smp = plate.SmoothyPlate if healerGUIDs[smp.guid] then smp.sp.HEALER_ICON:Show() else smp.sp.HEALER_ICON:Hide() end end function Healers:UNIT_REMOVED(_, plate) plate.SmoothyPlate.sp.HEALER_ICON:Hide() end function Healers:COMBAT_LOG_EVENT_UNFILTERED() local _, _, _, sourceGUID, _, _, _, _, _, destFlags, _, spellID, _, _, _ = CombatLogGetCurrentEventInfo() if not CombatLog_Object_IsA(destFlags, COMBATLOG_FILTER_HOSTILE_PLAYERS) or not spellID or not sourceGUID then return end if healerGUIDs[sourceGUID] then return end if onlyHealerSpellIds[spellID] then healerGUIDs[sourceGUID] = true local plate = getPlateByGUID(sourceGUID) if plate then plate.SmoothyPlate.sp.HEALER_ICON:Show() end end end function Healers:isHealer(specId) if not specId then return false end if healerclasses[specId] then return true else return false end end
ROAD_SPEED = -.125 create_actor([[popsicle;2;drawable,spr,vec,dim,col,confined| touchable:no; x:@1; variant:@2; i:@4; ry:.5; sind:70; sh:2; u=@3,; hit=@6,u=@7,i=@5,tl_max_time=5; ]], function(a) if g_pl and g_pl.x+4 > a.x then a:next() end end, function(a) a.dx = ROAD_SPEED if a.variant then a.y = 13 a.iyy = 4 else a.y = 7 a.iyy = -4 a.yf = true end end, function(a) sfx'16' if a.variant then a.dy = -.1 else a.dy = .1 end a.sind = 68 end, function(a, other) if other.vehicle then sfx'10' other:hurt(15, 0) a:kill() end end, function(a) a.sind = t()*2 % 1 < .5 and 68 or 69 end) create_actor([[cannon;2;drawable,spr,vec,dim,confined| x:@1; variant:@2; i:@3; sind:118; tl_max_time=12,; ]], function(a) a.dx = ROAD_SPEED if a.variant then a.y = 14 else a.y = 6 a.yf = true end _g.popsicle(a.x, a.variant, 1+rnd(1)) end) create_actor([[smalltree;2;drawable,spr,vec,dim,confined| x:@1; variant:@2; i:@3; sind:46; sh:2; tl_max_time=12,; ]], function(a) a.dx = ROAD_SPEED a.y = a.variant and 13 or 5.5 end) create_actor([[grass;2;drawable,spr,vec,dim,confined| x:@1; variant:@2; i:@3; sind:61; tl_max_time=12,; ]], function(a) a.dx = ROAD_SPEED a.y = a.variant and 14 or 6 end) create_actor([[road_gen;0;act,vec,pre_drawable,timed,confined| x:0; i:@1; u:@2; d:@3; ]], function(a) a.dx = ROAD_SPEED end, function(a) if a.t % 60 == 0 then local r_num = flr_rnd(3) local variant = flr_rnd(2) == 0 if a.t > 240 and r_num == 0 then _g.cannon(18+a.x%1, variant) elseif r_num == 1 then _g.grass(18+a.x%1,variant) else _g.smalltree(18+a.x%1, variant) end elseif a.t % 30 == 0 then if flr_rnd(2) == 0 then _g.grass(18+a.x%1,variant) end end end, function(a) for x=0,8 do zspr(98, ((a.x+x*2)%18)*8-8, TOP_LANE_Y*8, 2, 2) end for x=0,8 do zspr(96, ((a.x+x*2)%18)*8-8, MID_LANE_Y*8, 2, 2) end for x=0,8 do zspr(100, ((a.x+x*2)%18)*8-8, BOT_LANE_Y*8, 2, 2) end for x=0,8 do zspr(128, ((a.x+x*2)%18)*8-8, 0*8, 2, 1) zspr(128, ((a.x+x*2)%18)*8-8, 1*8, 2, 1) zspr(128, ((a.x+x*2)%18)*8-8, 2*8, 2, 1) zspr(128, ((a.x+x*2)%18)*8-8, 3*8, 2, 1) zspr(128, ((a.x+x*2)%18)*8-8, 4*8, 2, 2) end end)
-- Copyright 2016 The Cartographer 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. -- Copyright 2016 The Cartographer 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. include "map_builder.lua" include "trajectory_builder.lua" options = { map_builder = MAP_BUILDER, trajectory_builder = TRAJECTORY_BUILDER, map_frame = "map", tracking_frame = "gyro_link",-- Adjustable "gyro_link" published_frame = "odom",-- Adjustable "odom" odom_frame = "odom", provide_odom_frame = false, use_odometry = false, num_laser_scans = 1, num_multi_echo_laser_scans = 0, num_subdivisions_per_laser_scan = 1, num_point_clouds = 0, lookup_transform_timeout_sec = 0.2, submap_publish_period_sec = 0.3, pose_publish_period_sec = 5e-3, trajectory_publish_period_sec = 30e-3, rangefinder_sampling_ratio = 1., odometry_sampling_ratio = 1., imu_sampling_ratio = 1., } MAP_BUILDER.use_trajectory_builder_2d = true TRAJECTORY_BUILDER_2D.min_range = 0.1 TRAJECTORY_BUILDER_2D.max_range = 6.0 -- Adjustable TRAJECTORY_BUILDER_2D.missing_data_ray_length = 2.0 TRAJECTORY_BUILDER_2D.use_imu_data = false -- Adjustable TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = true TRAJECTORY_BUILDER_2D.motion_filter.max_time_seconds = 0.3 TRAJECTORY_BUILDER_2D.motion_filter.max_distance_meters = 0.2 -- Adjustable (0.2) TRAJECTORY_BUILDER_2D.motion_filter.max_angle_radians = math.rad(0.3) -- Adjustable (3.) TRAJECTORY_BUILDER_2D.ceres_scan_matcher.translation_weight = 100 -- Adjustable 70 TRAJECTORY_BUILDER_2D.ceres_scan_matcher.rotation_weight = 400 -- Adjustable 80 TRAJECTORY_BUILDER_2D.submaps.resolution = 0.05 TRAJECTORY_BUILDER_2D.submaps.num_range_data = 100 -- Adjustable 120 SPARSE_POSE_GRAPH.optimize_every_n_scans = 4 -- Adjustable SPARSE_POSE_GRAPH.constraint_builder.min_score = 0.82 SPARSE_POSE_GRAPH.constraint_builder.sampling_ratio = 1. SPARSE_POSE_GRAPH.constraint_builder.ceres_scan_matcher = TRAJECTORY_BUILDER_2D.ceres_scan_matcher SPARSE_POSE_GRAPH.constraint_builder.global_localization_min_score = 0.8 SPARSE_POSE_GRAPH.optimization_problem.huber_scale = 1e3 TRAJECTORY_BUILDER.pure_localization = true return options
--[[------------------------------------------------------ # Scheduler TODO: Missing documentation on yield operations --]]------------------------------------------------------ local lub = require 'lub' local lens = require 'lens' local lib = lub.class 'lens.Scheduler' local setmetatable, create, resume, yield, status = setmetatable, coroutine.create, coroutine.resume, coroutine.yield, coroutine.status local format, insert, elapsed, print, type = string.format, table.insert, lens.elapsed, print, type local POLLIN, POLLOUT, VNODE = lens.Poller.Read, lens.Poller.Write, lens.Poller.VNode local operations = {} local scheduleAt, finalizeThread, removeFd, runThread, guiPoll -- Create a new Scheduler object. function lib.new() local self = { -- Points to the next thread to run at_next = nil, -- Counts number of filedescriptors watching fd_count = 0, -- Translates Poller ids to threads. idx_to_thread = {}, -- Default pollser poller = lens.Poller(), } return setmetatable(self, lib) end -- Start running scheduler with a main function. function lib:run(main) scheduleAt(self, nil, lens.Thread.make(main)) -- self.at_next.name = 'main' self.should_run = true self:loop() end function lib:loop() local thread local idx_to_thread = self.idx_to_thread while self.should_run do -- Get next thread to run local thread = self.at_next local now = elapsed() -- To make sure timers are set with the same 'now' value. self.now = now if not thread or thread.at > now then -- No events else -- Extract current elements from list so that newly added threads do not -- alter list (and we give fair chances for threads to run). -- Last element to be run now local last = thread -- Find element past now frame local past = thread.at_next while past and past.at <= now do last = past past = last.at_next end -- New head (can be nil) self.at_next = past if past then -- Cut link last.at_next = nil end -- Run scheduled threads in 'thread' linked list. while thread and self.should_run do -- Run thread -- Need to get next thread before in case the thread being run -- is rescheduled (and breaks at_next link). local ne = thread.at_next if runThread(self, thread) then -- run same thread again else thread = ne end end if not self.should_run then break end end -- Get timeout value local wake_at = -1 thread = self.at_next if thread then wake_at = thread.at end if self.fd_count == 0 and wake_at == -1 then -- No more at events and no more fd self.should_run = false break end -- Poll if not self.poller:poll(wake_at) then -- interrupted self.should_run = false print('') --print(' interrupted') break end -- First collect events so that running the threads (and -- possibly adding new file descriptors) does not alter -- the list. local events = self.poller:events() if events then -- Execute poll events. local i = 1 local ev_idx = events[i] local thread = ev_idx and idx_to_thread[ev_idx] while thread and self.should_run do if thread.filter == VNODE then thread.retval = self.poller:fflags(ev_idx) end if runThread(self, thread) then -- run fd thread again else -- run next fd thread i = i + 1 ev_idx = events[i] if ev_idx then thread = idx_to_thread[ev_idx] if not thread then error(string.format("Unknown thread idx '%i' in poller", ev_idx)) end else thread = nil end end end end end -- while self.should_run if self.restart_func then -- Restart loop self.restart_func() end self:willTerminate() end -- # Callback -- -- Called just before the scheduler stops running. function lib:willTerminate() print('Bye...') end ------------------------------------------------------ PRIVATE function runThread(self, thread) if thread.at == 0 then -- thread starting now thread.at = self.now end local ok, a, b, c = resume(thread.co, thread.retval) if ok then if a then local func = operations[a] if func then if func(self, thread, b, c) then -- resume running thread immediately return true end else error(format("Invalid operation '%s'.", tostring(a))) end elseif status(thread.co) == 'dead' then finalizeThread(self, thread) end else -- Error if thread.error then -- Thread has an error handler, call it thread.error(a, debug.traceback(thread.co)) else print('Error', a, thread.co, debug.traceback(thread.co)) end local re = thread.restart if re then if type(re) == 'function' then re(thread.at, self) finalizeThread(self, thread) else thread.co = create(thread.func) -- TODO: Should we restart an erroring thread right away ?? -- scheduleAt(self, nil, thread) end else finalizeThread(self, thread) end end end -- Add a thread and schedule at thread.at function scheduleAt(self, _, thread) local at = thread.at local prev = self local ne = prev.at_next while true do if not ne or at < ne.at then prev.at_next = thread thread.at_next = ne break else prev = ne end ne = prev.at_next end if self.at_next.at ~= pat then -- FIXME: give some time to GUI ? -- self.poller:resumeAt(self.at_next.at) end -- Return true to resume running thread immediately return true end function removeFd(self, thread) local fd = thread.fd if thread.idx then self.idx_to_thread[thread.idx] = nil end if fd then self.poller:remove(thread.idx) thread.fd = nil self.fd_count = self.fd_count - 1 end thread.idx = nil end function changeFdFilter(self, thread, fd, filter, flags) flags = flags or 0 if thread.fd then if thread.fd == fd then -- same self.poller:modify(thread.idx, filter, fd, flags) else -- changed fd assert(fd, 'Missing fd value. Check waitRead calls.') self.poller:modify(thread.idx, filter, fd, flags) end else -- add fd thread.fd = fd self.fd_count = self.fd_count + 1 thread.idx = self.poller:add(fd, filter, flags) self.idx_to_thread[thread.idx] = thread end -- We need this information in case we change poller and to retrieve filter -- flags. thread.filter = filter end ------------------------------------------------------ OPERATIONS function operations.create(self, _, thread) thread.sched = self return scheduleAt(self, _, thread) end -- nodoc function lib:createThread(thread) operations.create(self, _, thread) end function operations.read(self, thread, fd) changeFdFilter(self, thread, fd, POLLIN) end function operations.write(self, thread, fd) changeFdFilter(self, thread, fd, POLLOUT) end function operations.vnode(self, thread, fd, flags) flags = flags or 0 changeFdFilter(self, thread, fd, VNODE, flags) end function operations.sleep(self, thread, duration) thread.at = elapsed() + duration if thread.fd then removeFd(self, thread) end scheduleAt(self, nil, thread) end function operations.wait(self, thread, duration) thread.at = thread.at + duration if thread.fd then removeFd(self, thread) end scheduleAt(self, nil, thread) end -- Halt scheduler and quit. function operations.halt(self) print('Halt') self.should_run = false end function operations.kill(self, thread, other) if not other then other = thread thread = nil end local p = self local t = self.at_next -- Remove from at list while t do if t == other then p.at_next = t.at_next break end p = t t = t.at_next end finalizeThread(self, other) -- continue after kill if thread then scheduleAt(self, nil, thread) end end function operations.join(self, thread, other) local joins = other.joins if not joins then joins = {} other.joins = joins end insert(joins, thread) end -- nodoc lib.killThread = operations.kill -- Return scheduler to schedule timers without yield from in C-call. function operations.sched(self, thread, fd) -- Resume thread immediately thread.retval = self return true end function operations.poller(self, thread, new_poller) assert(false, 'Poller replacement not yet implemented') end function operations.gui(self, thread) if self.gui_coro then -- Ignore call, this can happen when external libraries do not know if the -- gui is running or not. -- Resume thread immediately. return true end local gui_coro = coroutine.create(function() -- We will run lopp in new coroutine so that calls to -- sched:poll() will yield. self:loop() end) self.gui_coro = gui_coro -- Set poller resume callback to resume coroutine. function self.poller.resume(poller, poll_retval) local ok, wake_at = resume(gui_coro, poll_retval) if not ok then print(wake_at, debug.traceback(gui_coro)) self.should_run = false end -- End of main thread code perform: continue background thread. if self.should_run then return wake_at end end -- Replace poller:poll method to yield. self.poller.poll = guiPoll -- End current loop and restart with coroutine self.restart_func = function() -- Only run once self.restart_func = nil sched = self self.should_run = true -- Run until guiPoll local ok, wake_at = resume(gui_coro) if not ok then print('ERROR in scheduler', wake_at, debug.traceback(gui_coro)) self.should_run = false else -- continue the thread that started the gui scheduleAt(self, nil, thread) -- Future 'resume' operations will be triggered by background thread. self.poller:runGUI(0) end end -- Force end of current run loop self.should_run = false end function setupGuiPoll(poller, wake_at) -- Prepare poller.poll = guiPoll end function guiPoll(poller, wake_at) -- This yield gives control back to background thread and OS will post -- 'resume' callback on main thread when kevent returns. return yield(wake_at) end function finalizeThread(self, thread) -- Coroutine function finished -- Cleanup if thread.fd then removeFd(self, thread) end thread.co = nil local joins = thread.joins if joins then thread.joins = nil for _, t in ipairs(joins) do scheduleAt(self, nil, t) end end end return lib
---@class UITransition : zombie.ui.UITransition ---@field private duration float ---@field private elapsed float ---@field private frac float ---@field private fadeOut boolean ---@field private bIgnoreUpdateTime boolean ---@field private updateTimeMS long ---@field private currentTimeMS long ---@field private elapsedTimeMS long UITransition = {} ---@public ---@param arg0 boolean ---@return void function UITransition:setIgnoreUpdateTime(arg0) end ---@public ---@return void function UITransition:update() end ---@public ---@param arg0 float ---@param arg1 boolean ---@return void function UITransition:init(arg0, arg1) end ---@public ---@return void function UITransition:UpdateAll() end ---@public ---@param arg0 float ---@return void function UITransition:setElapsed(arg0) end ---@public ---@param arg0 boolean ---@return void function UITransition:setFadeIn(arg0) end ---@public ---@return float function UITransition:fraction() end ---@public ---@return void function UITransition:reset() end ---@public ---@return float function UITransition:getElapsed() end
--// options for orderhallbar //-- local _, ns = ... local L = ns.L local LUI = LolzenUI.L local LSM = LibStub("LibSharedMedia-3.0") local f = CreateFrame("Frame") f:RegisterEvent("ADDON_LOADED") f:SetScript("OnEvent", function(self, event, addon) if addon == "LolzenUI_Options" and LolzenUIcfg.modules["orderhallbar"] == true then local title = ns.createTitle("orderhallbar") local about = ns.createDescription("orderhallbar", LUI["desc_orderhallbar"]) local aboutBG = ns.createBackground("orderhallbar", 600, 33) aboutBG:SetPoint("TOPLEFT", about, "BOTTOMLEFT", -4, -14) aboutBG:SetFrameLevel(1) local cb1 = ns.createCheckBox("orderhallbar", "alwaysshow", "|cff5599ff"..L["ohb_always_show"].."|r", LolzenUIcfg.orderhallbar["ohb_always_show"]) cb1:SetPoint("TOPLEFT", about, "BOTTOMLEFT", 0, -20) cb1:SetScript("OnClick", function(self) LolzenUIcfg.orderhallbar["ohb_always_show"] = cb1:GetChecked() LolzenUI.setOHBVisibility() end) local header1 = ns.createHeader("orderhallbar", L["background"]) header1:SetPoint("TOPLEFT", cb1, "BOTTOMLEFT", 0, -7) local header1BG = ns.createBackground("orderhallbar", 600, 40) header1BG:SetPoint("TOPLEFT", header1, "BOTTOMLEFT", -4, -4) header1BG:SetFrameLevel(1) local ohb_bg_text = ns.createFontstring("orderhallbar", L["texture"]..":") ohb_bg_text:SetPoint("TOPLEFT", header1, "BOTTOMLEFT", 4, -18) local ohb_bg = ns.createPicker("orderhallbar", "background", "oh_bg_statusbar", 120, LolzenUIcfg.orderhallbar["ohb_background"]) ohb_bg:SetPoint("LEFT", ohb_bg_text, "RIGHT", -10, -3) ohb_bg.OnClick = function() LolzenUIcfg.orderhallbar["ohb_background"] = UIDropDownMenu_GetSelectedName(ohb_bg) LolzenUI.setOHBBGTexture() self.color:SetTexture(LSM:Fetch("statusbar", LolzenUIcfg.orderhallbar["ohb_background"])) end local color_text = ns.createFontstring("orderhallbar", L["color"]..":") color_text:SetPoint("LEFT", ohb_bg, "RIGHT", -5, 3) local color = ns.createColorTexture("orderhallbar", 16, 16, LolzenUIcfg.orderhallbar["ohb_background_color"], LolzenUIcfg.orderhallbar["ohb_background"]) color:SetPoint("LEFT", color_text, "RIGHT", 10, 0) self.color = color color.setActualColors = function() LolzenUIcfg.orderhallbar["ohb_background_color"] = {color:GetVertexColor()} LolzenUI.setOHBBGColor() end local color_f = ns.createColorPicker("orderhallbar", color, LolzenUIcfg.orderhallbar["ohb_background_color"]) color_f:SetAllPoints(color) local alpha_text = ns.createFontstring("orderhallbar", L["alpha"]..":") alpha_text:SetPoint("LEFT", color, "RIGHT", 10, 0) local alpha = ns.createPicker("orderhallbar", "alpha", "oh_bg_alpha", 45, LolzenUIcfg.orderhallbar["ohb_background_alpha"]) alpha:SetPoint("LEFT", alpha_text, "RIGHT", -10, -3) alpha.OnClick = function() LolzenUIcfg.orderhallbar["ohb_background_alpha"] = tonumber(ns.picker_alpha[UIDropDownMenu_GetSelectedID(alpha)]) LolzenUI.setOHBBGAlpha() end local header2 = ns.createHeader("orderhallbar", L["ohb_zonetext_header"]) header2:SetPoint("TOPLEFT", ohb_bg_text, "BOTTOMLEFT", -4, -20) local header2BG = ns.createBackground("orderhallbar", 600, 63) header2BG:SetPoint("TOPLEFT", header2, "BOTTOMLEFT", -4, -4) header2BG:SetFrameLevel(1) local zone_color_text = ns.createFontstring("orderhallbar", L["color"]..":") zone_color_text:SetPoint("TOPLEFT", header2, "BOTTOMLEFT", 4, -16) local zone_color = ns.createColorTexture("orderhallbar", 16, 16, LolzenUIcfg.orderhallbar["ohb_zone_color"], "LolzenUI Standard") zone_color:SetPoint("LEFT", zone_color_text, "RIGHT", 10, 0) zone_color.setActualColors = function() LolzenUIcfg.orderhallbar["ohb_zone_color"] = {zone_color:GetVertexColor()} LolzenUI.setOHBZoneFontColor() end local zone_color_f = ns.createColorPicker("orderhallbar", zone_color, LolzenUIcfg.orderhallbar["ohb_zone_color"]) zone_color_f:SetAllPoints(zone_color) local zone_font_text = ns.createFontstring("orderhallbar", L["font"]..":") zone_font_text:SetPoint("TOPLEFT", zone_color_text, "BOTTOMLEFT", 0, -14) local zone_font = ns.createPicker("orderhallbar", "font", "orderhallbar_font", 120, LolzenUIcfg.orderhallbar["ohb_zone_font"]) zone_font:SetPoint("LEFT", zone_font_text, "RIGHT", -10, -3) zone_font.OnClick = function() LolzenUIcfg.orderhallbar["ohb_zone_font"] = UIDropDownMenu_GetSelectedName(zone_font) LolzenUI.setOHBZoneFont() end local zone_font_size_text = ns.createFontstring("orderhallbar", L["size"]..":") zone_font_size_text:SetPoint("LEFT", zone_font, "RIGHT", -5, 3) local zone_font_size = ns.createInputbox("orderhallbar", 30, 20, LolzenUIcfg.orderhallbar["ohb_zone_font_size"]) zone_font_size:SetPoint("LEFT", zone_font_size_text, "RIGHT", 10, 0) zone_font_size:SetScript("OnEscapePressed", function(self) self:SetText(self.oldText) self:ClearFocus() end) zone_font_size:SetScript("OnEnterPressed", function(self) LolzenUIcfg.orderhallbar["ohb_zone_font_size"] = tonumber(zone_font_size:GetText()) self.oldText = self:GetText() LolzenUI.setOHBZoneFont() end) zone_font_size:SetScript("OnEditFocusGained", function(self) self.oldText = self:GetText() end) zone_font_size:SetScript("OnEditFocusLost", function(self) self:SetText(self.oldText) self:ClearFocus() end) local zone_font_flag_text = ns.createFontstring("orderhallbar", L["flag"]..":") zone_font_flag_text:SetPoint("LEFT", zone_font_size, "RIGHT", 10, 0) local zone_font_flag = ns.createPicker("orderhallbar", "flag", "orderhallbar_font_flag", 120, LolzenUIcfg.orderhallbar["ohb_zone_font_flag"]) zone_font_flag:SetPoint("LEFT", zone_font_flag_text, "RIGHT", -10, -3) zone_font_flag.OnClick = function() LolzenUIcfg.orderhallbar["ohb_zone_font_flag"] = ns.picker_flags[UIDropDownMenu_GetSelectedID(zone_font_flag)] LolzenUI.setOHBZoneFont() end local header3 = ns.createHeader("orderhallbar", L["ohb_currency_header"]) header3:SetPoint("TOPLEFT", zone_font_text, "BOTTOMLEFT", -4, -16) local header3BG = ns.createBackground("orderhallbar", 600, 63) header3BG:SetPoint("TOPLEFT", header3, "BOTTOMLEFT", -4, -4) header3BG:SetFrameLevel(1) local font_text = ns.createFontstring("orderhallbar", L["font"]..":") font_text:SetPoint("TOPLEFT", header3, "BOTTOMLEFT", 4, -16) local font = ns.createPicker("orderhallbar", "font", "orderhallbar_font", 120, LolzenUIcfg.orderhallbar["ohb_currency_font"]) font:SetPoint("LEFT", font_text, "RIGHT", -10, -3) font.OnClick = function() LolzenUIcfg.orderhallbar["ohb_currency_font"] = UIDropDownMenu_GetSelectedName(font) LolzenUI.setOHBCurrencyFont() end local font_size_text = ns.createFontstring("orderhallbar", L["size"]..":") font_size_text:SetPoint("LEFT", font, "RIGHT", -5, 3) local font_size = ns.createInputbox("orderhallbar", 30, 20, LolzenUIcfg.orderhallbar["ohb_currency_font_size"]) font_size:SetPoint("LEFT", font_size_text, "RIGHT", 10, 0) font_size:SetScript("OnEscapePressed", function(self) self:SetText(self.oldText) self:ClearFocus() end) font_size:SetScript("OnEnterPressed", function(self) LolzenUIcfg.orderhallbar["ohb_currency_font_size"] = tonumber(font_size:GetText()) self.oldText = self:GetText() LolzenUI.setOHBCurrencyFont() end) font_size:SetScript("OnEditFocusGained", function(self) self.oldText = self:GetText() end) font_size:SetScript("OnEditFocusLost", function(self) self:SetText(self.oldText) self:ClearFocus() end) local font_flag_text = ns.createFontstring("orderhallbar", L["flag"]..":") font_flag_text:SetPoint("LEFT", font_size, "RIGHT", 10, 0) local font_flag = ns.createPicker("orderhallbar", "flag", "orderhallbar_font_flag", 120, LolzenUIcfg.orderhallbar["ohb_currency_font_flag"]) font_flag:SetPoint("LEFT", font_flag_text, "RIGHT", -10, -3) font_flag.OnClick = function() LolzenUIcfg.orderhallbar["ohb_currency_font_flag"] = ns.picker_flags[UIDropDownMenu_GetSelectedID(font_flag)] LolzenUI.setOHBCurrencyFont() end local icon_size_text = ns.createFontstring("orderhallbar", L["ohb_icon_size"]..":") icon_size_text:SetPoint("TOPLEFT", font_text, "BOTTOMLEFT", 0, -15) local icon_size = ns.createInputbox("orderhallbar", 30, 20, LolzenUIcfg.orderhallbar["ohb_currency_icon_size"]) icon_size:SetPoint("LEFT", icon_size_text, "RIGHT", 10, 0) icon_size:SetScript("OnEscapePressed", function(self) self:SetText(self.oldText) self:ClearFocus() end) icon_size:SetScript("OnEnterPressed", function(self) LolzenUIcfg.orderhallbar["ohb_currency_icon_size"] = tonumber(icon_size:GetText()) self.oldText = self:GetText() LolzenUI.setOHBCurrenyIconSize() end) icon_size:SetScript("OnEditFocusGained", function(self) self.oldText = self:GetText() end) icon_size:SetScript("OnEditFocusLost", function(self) self:SetText(self.oldText) self:ClearFocus() end) ns["orderhallbar"].default = function(self) LolzenUIcfg.orderhallbar = _G["LolzenUIdefaultcfg"].orderhallbar ReloadUI() end end end)
co = coroutine.create(function() print("hello") end) print(type(co)) --> thread main = coroutine.running() print(type(main)) --> thread print(coroutine.status(main)) --> running co = coroutine.create(function() print(coroutine.status(co)) --> running coroutine.resume(coroutine.create(function() print(coroutine.status(co)) --> normal end)) end) print(coroutine.status(co)) --> suspended coroutine.resume(co) print(coroutine.status(co)) --> dead co = coroutine.create(function(a, b, c) print(a, b, c) while true do print(coroutine.yield()) end end) coroutine.resume(co, 1, 2, 3) --> 1 2 3 coroutine.resume(co, 4, 5, 6) --> 4 5 6 coroutine.resume(co, 7, 8, 9) --> 7 8 9 co = coroutine.create(function() for k, v in pairs({"a", "b", "c"}) do coroutine.yield(k, v) end return "d", 4 end) print(coroutine.resume(co)) --> true 1 a print(coroutine.resume(co)) --> true 2 b print(coroutine.resume(co)) --> true 3 c print(coroutine.resume(co)) --> true d 4 print(coroutine.resume(co)) --> false cannot resume dead coroutin
--[[ · 退选课程 lua 脚本实现 参数 KEYS[1] 为 courseId,值 ARGV[1] 表示 studentId 1. 返回 1 代表退选成功 --]] -- 当前要退选的课程中的学生 KEY local selectedCourseKey = 'course_selected_student_'..KEYS[1] -- 学生要退选的课程 KEY local studentSelected = 'student_selected_course_'..ARGV[1] -- 课程数量剩余 key local courseNumKey = 'course_left_num_'..KEYS[1] -- 剩余课程数量 + 1 redis.call('incrby', courseNumKey, 1) -- 删除学生选择课程中,该课程 id redis.call('lrem', studentSelected, 1, KEYS[1]) -- 删除课程选择信息中,该名学生 id redis.call('srem', selectedCourseKey, ARGV[1])
checkformat = "tex" testfiledir = "testfiles-plain"
local ls = require"luasnip" local s = ls.s local i = ls.insert_node local fmt = require("luasnip.extras.fmt").fmt return { s("doctype", fmt( [[ <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>{}</title> </head> <body> {} </body> </html> ]], { i(1), i(0) } ) ) }
-- luacheck: globals ngx import require 'lua-nucleo.import' local tjson_simple = import 'lua-nucleo/string.lua' { 'tjson_simple' } local go_exists, go_have_action_as, go_initiate_action, go_initiate_scheduled_actions, go_write_geo = import 'go.lua' { 'go_exists', 'go_have_action_as', 'go_initiate_action', 'go_initiate_scheduled_actions', 'go_write_geo' } import 'actions.lua' () -------------------------------------------------------------------------------- local USER_ID local GEO = { } do local uri_args = ngx.req.get_uri_args() USER_ID = uri_args.usr if not USER_ID then ngx.status = ngx.HTTP_BAD_REQUEST ngx.say(tjson_simple({ status = 'ERROR'; message = 'missing user id'; })) return ngx.exit(ngx.status) end GEO.lon = uri_args.lon and tonumber(uri_args.lon) GEO.lat = uri_args.lat and tonumber(uri_args.lat) if not GEO.lon or not GEO.lat then ngx.status = ngx.HTTP_BAD_REQUEST ngx.say(tjson_simple({ status = 'ERROR'; message = 'missing geo coordinates'; })) return ngx.exit(ngx.status) end end if not go_exists(USER_ID) then ngx.status = ngx.HTTP_UNAUTHORIZED ngx.say(tjson_simple({ status = 'ERROR'; message = 'unknown user ID, please /register'; })) return ngx.exit(ngx.status) end go_write_geo(USER_ID, GEO) -------------------------------------------------------------------------------- go_initiate_scheduled_actions() -------------------------------------------------------------------------------- local go_id = ngx.var[1] local action_id = ngx.var[2] if not go_exists(go_id) then ngx.status = ngx.HTTP_NOT_FOUND ngx.say(tjson_simple({ status = 'ERROR', message = 'game object not found' })) ngx.log(ngx.NOTICE, 'go not found ', go_id) return ngx.exit(ngx.status) end if not go_have_action_as(go_id, action_id, USER_ID) then ngx.status = ngx.HTTP_NOT_FOUND ngx.say(tjson_simple({ status = 'ERROR', message = 'action not found' })) ngx.log(ngx.NOTICE, 'action not found go ', go_id, ' act ', action_id, ' user ', USER_ID ) return ngx.exit(ngx.status) end ngx.log( ngx.NOTICE, 'initiate-action go ', go_id, ' act ', action_id, ' user ', USER_ID ) go_initiate_action(go_id, USER_ID, action_id) -------------------------------------------------------------------------------- ngx.say(tjson_simple({ status = 'ok' }))