content
stringlengths
5
1.05M
-- MoneyMoney extension for DeutschlandCard -- -- -- MIT License -- -- Copyright (c) 2020 Mark Wiesemann -- -- 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. WebBanking { version = 1.1, country = "de", url = "https://www.deutschlandcard.de/", services = {"DeutschlandCard-Punkte"}, description = "Deutschlandcard-Punkte" } -- global variables (used in various functions) local cardNumber local pin local connection local headersWithToken local function GetTransactions(url, transactions) content, _, _, _, headers = connection:request("GET", url, "", "application/json", headersWithToken) if (headers["Content-Length"] == "0") then error("API returned an error") end fields = JSON(content):dictionary() for key, monthData in ipairs(fields["result"]) do for key, monthlyTransaction in ipairs(monthData["bookings"]) do _, _, year, month, day = string.find(monthlyTransaction["transactionDate"], "(%d+)-(%d+)-(%d+)") local singleTransaction = { name = monthlyTransaction["partner"], amount = monthlyTransaction["amount"] / 100, purpose = monthlyTransaction["bookingText"], bookingDate = os.time{year = year, month = month, day = day, hour = 0} } table.insert(transactions, singleTransaction) end end return fields["hasMoreResults"], fields["nextSearchParams"] end function SupportsBank(protocol, bankCode) return bankCode == "DeutschlandCard-Punkte" and protocol == ProtocolWebBanking end function InitializeSession2(protocol, bankCode, step, credentials, interactive) if step == 1 then -- Cache card number and PIN for step 2. cardNumber = credentials[1] pin = credentials[2] -- Load reCAPTCHA v3. return {challenge="https://www.recaptcha.net/recaptcha/api.js?render=6Le2S9AUAAAAAD4SMzwje15-swuVJtwV9O1HyL9T"} elseif step == 2 then -- Create HTTPS connection object. connection = Connection() connection.language = "de-de" -- Prepare HTTP headers. headers = {} headers["Accept"] = "application/json" headers["x-recaptcha-v3"] = credentials[1] -- Submit login form. print("Submitting login form.") local postContent = JSON():set{grant_type="password",response_type="id_token token",scope="deutschlandcardapi offline_access",audience="deutschlandcardapi",username=cardNumber,password=pin}:json() local json = JSON(connection:request("POST", url .. "api/v1/auth/connect/token", postContent, "application/json", headers)):dictionary() -- Check for login error. local message = json["data"] and json["data"]["error_description"] if message then print("Response:", message) if message == "invalid credential" then return LoginFailed end end -- Extract access token. if not json["access_token"] then return "Der Server von DeutschlandCard hat kein Access-Token übermittelt. Bitte versuchen Sie es später noch einmal." else headersWithToken = {} headersWithToken["Accept"] = "application/json" headersWithToken["Authorization"] = "Bearer " .. json["access_token"] end end end function EndSession() -- nothing to be done due to the token-based approach (=> the token will expire after an hour) end function ListAccounts(knownAccounts) url = "https://www.deutschlandcard.de/api/v1/profile/memberinfo" content, _, _, _, headers = connection:request("GET", url, "", "application/json", headersWithToken) if (headers["Content-Length"] == "0") then error("API returned an error") end fields = JSON(content):dictionary() return { { name = "DeutschlandCard", owner = fields["firstname"] .. " " .. fields["lastname"], accountNumber = cardNumber, currency = "EUR", type = AccountTypeOther } } end function RefreshAccount(account, since) url = "https://www.deutschlandcard.de/api/v1/profile/memberpoints" content, _, _, _, headers = connection:request("GET", url, "", "application/json", headersWithToken) if (headers["Content-Length"] == "0") then error("API returned an error") end fields = JSON(content):dictionary() balance = fields["balance"] / 100 local transactions = {} local offset = 1 local limit = 1 repeat url = "https://www.deutschlandcard.de/api/v1/profile/bookings?offset=" .. offset .. "&limit=" .. limit hasMoreResults, nextSearchParams = GetTransactions(url, transactions) if (hasMoreResults) then offset = nextSearchParams["offset"] limit = nextSearchParams["limit"] end until (hasMoreResults == false) return {balance=balance, transactions=transactions} end
-------------------------------------------------------------------------------- -- -- _ _ _ -- | | | | | | -- | | ___ __ _ __| | | |_ _ __ _ -- | |/ _ \ / _` |/ _` | | | | | |/ _` | -- | | (_) | (_| | (_| |_| | |_| | (_| | -- |_|\___/ \__,_|\__,_(_)_|\__,_|\__,_| -- -- Jonathan Lowe -- github : https://github.com/jglowe -- figlet font : big -- -- The function to load plugins -------------------------------------------------------------------------------- local add = require("yapm.add") local state = require("yapm.state") local load_plugin = function(plugin) if vim.v.vim_did_enter == 1 then -- Adds the optional plugin to the runtime path and sources it now vim.cmd('packadd ' .. plugin) else -- Adds the optional plugin to the runtime path and sources it later as -- a part of the startup process vim.cmd('packadd! ' .. plugin) end end local load = function(plugin) -- Support both github_user/plugin_name and plugin_name local slash_index = string.find(plugin, "/") local plugin_name if slash_index ~= nil then plugin_name = string.sub(plugin, slash_index + 1, string.len(plugin)) else plugin_name = plugin end local settings = state.get_settings() -- If enabled and the plugin name inclues the git user/path, it will add -- newly specified plugins via the add function if settings.add_new_plugins and slash_index ~= nil then local plugin_folder = settings.repo_path .. "/" .. settings.plugin_path .. "/" .. plugin_name if vim.fn.isdirectory(plugin_folder) == 0 then add(plugin) end end -- keep track of the plugins that are loaded and prevent them from being -- loaded twice if not state.is_plugin_loaded(plugin_name) then load_plugin(plugin_name) state.add_loaded_plugin(plugin_name) end end return load
local vec2d = require('lib.vec2d') local u = require('lib.utility') local clock = { margin = 5 } local font, theme function clock:init(params) font = params.theme.font theme = params.theme end function clock:create(params) params = params or {} local sample_text = '17th Sep(09) 2021 - 08:48:40 PM - Fri' clock.pos = vec2d{ x = params.pos and params.pos.x or 100, y = params.pos and params.pos.y or 100, } clock.dim = vec2d{ x = params.dim and params.dim.x or font:getWidth(sample_text) + clock.margin, y = params.dim and params.dim.y or 30, } clock.text = '-' return clock end function clock:draw() love.graphics.setColor(0, 0, 0) love.graphics.rectangle( 'line', clock.pos.x, clock.pos.y, clock.dim.x, clock.dim.y, 3 ) love.graphics.setColor(u.t_c(theme.font_color)) love.graphics.printf( clock.text, clock.pos.x + clock.margin, clock.pos.y + (clock.dim.y - font:getHeight()) / 2, clock.dim.x - 2 * clock.margin, 'center' ) end function clock:on_tick(time) local day = tonumber(os.date('%d', time)) local suff = u.num_suffix(day) clock.text = string.format( '%.2d%s %s', day, suff, os.date('%b(%m) %Y - %I:%M:%S %p - %a', time) ) end return clock
-- compat.lua local _, debug, jit _, debug = pcall(require, "debug") _, jit = pcall(require, "jit") jit = _ and jit local compat = { debug = debug, lua51 = (_VERSION == "Lua 5.1") and not jit, lua52 = _VERSION == "Lua 5.2", luajit = jit and true or false, jit = jit and jit.status(), -- LuaJIT can optionally support __len on tables. lua52_len = not #setmetatable({},{__len = function()end}), proxies = pcall(function() local prox = newproxy(true) local prox2 = newproxy(prox) assert (type(getmetatable(prox)) == "table" and (getmetatable(prox)) == (getmetatable(prox2))) end), _goto = not not(loadstring or load)"::R::" } return compat -- The Romantic WTF public license. -- -------------------------------- -- a.k.a. version "<3" or simply v3 -- -- -- Dear user, -- -- The LuLPeg library -- -- \ -- '.,__ -- \ / -- '/,__ -- / -- / -- / -- has been / released -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ -- under the Romantic WTF Public License. -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~`,´ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ -- I hereby grant you an irrevocable license to -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ -- do what the gentle caress you want to -- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ -- with this lovely -- ~ ~ ~ ~ ~ ~ ~ ~ -- / thing... -- / ~ ~ ~ ~ -- / Love, -- # / '.' -- ####### · -- ##### -- ### -- # -- -- -- Pierre-Yves -- -- -- P.S.: Even though I poured my heart into this work, -- I _cannot_ provide any warranty regarding -- its fitness for _any_ purpose. You -- acknowledge that I will not be held liable -- for any damage its use could incur.
-- protocol naming p4_udp = Proto('p4_udp','P4_UDPProtocol') -- protocol fields local p4_udp_src_port = ProtoField.string('p4_udp.src_port','src_port') local p4_udp_dst_port = ProtoField.string('p4_udp.dst_port','dst_port') local p4_udp_len = ProtoField.string('p4_udp.len','len') local p4_udp_checksum = ProtoField.string('p4_udp.checksum','checksum') p4_udp.fields = {p4_udp_src_port, p4_udp_dst_port, p4_udp_len, p4_udp_checksum} -- protocol dissector function function p4_udp.dissector(buffer,pinfo,tree) pinfo.cols.protocol = 'P4_UDP' local subtree = tree:add(p4_udp,buffer(),'P4_UDP Protocol Data') subtree:add(p4_udp_src_port,tostring(buffer(0,2):bitfield(0,16))) subtree:add(p4_udp_dst_port,tostring(buffer(2,2):bitfield(0,16))) subtree:add(p4_udp_len,tostring(buffer(4,2):bitfield(0,16))) subtree:add(p4_udp_checksum,tostring(buffer(6,2):bitfield(0,16))) local mydissectortable = DissectorTable.get('p4_udp.dst_port') mydissectortable:try(buffer(2,2):bitfield(0,16), buffer:range(8):tvb(),pinfo,tree) end print( (require 'debug').getinfo(1).source ) -- creation of table for next layer(if required) local newdissectortable = DissectorTable.new('p4_udp.dst_port','P4_UDP.DST_PORT',ftypes.STRING) -- protocol registration my_table = DissectorTable.get('p4_ipv4.protocol') my_table:add(0x11,p4_udp)
local infoview = require('lean.infoview') local helpers = require('tests.helpers') local fixtures = require('tests.fixtures') local position = require('lean._util').make_position_params helpers.setup { infoview = { autoopen = true }, lsp = { enable = true }, lsp3 = { enable = true }, } describe('infoview pin', function() it('setup', function() --- setup helpers.edit_lean_buffer(fixtures.lean_project.some_existing_file) helpers.wait_for_ready_lsp() helpers.wait_for_server_progress() assert.initopened.infoview() vim.api.nvim_win_set_cursor(0, {16, 0}) infoview.__update() assert.pin_pos_changed.infoview() end) describe('new pin', function() local old_pin = infoview.get_current_infoview().info.pin local new_pin it('can be created', function(_) infoview.get_current_infoview().info:add_pin() assert.pinopened.infoview() new_pin = infoview.get_current_infoview().info.pin end) it('can be updated independently', function(_) vim.api.nvim_win_set_cursor(0, {15, 15}) infoview.__update() new_pin:update(true) old_pin:update(true) assert.pin_text_changed{new_pin.id, old_pin.id}.pin_pos_changed.infoview() assert.has_all(new_pin.div:to_string(), {"\n⊢ Type"}) assert.has_all(old_pin.div:to_string(), {"\n⊢ Bool"}) end) it('can be cleared', function(_) infoview.get_current_infoview().info:clear_pins() assert.pindeleted{old_pin.id}.infoview() end) it('can be created again', function(_) infoview.get_current_infoview().info:add_pin() assert.pinopened.infoview() end) end) describe('diff pin', function() local diff_pin it('can be created', function() infoview.get_current_infoview().info:set_diff_pin(position()) diff_pin = infoview.get_current_infoview().info.diff_pin assert.pinopened{diff_pin.id}.diffwinopened.infoview() end) it('is retained on infoview close', function() infoview.get_current_infoview():close() assert.closed.diffwinclosed.infoview() end) it('opens along with infoview on infoview open', function() infoview.get_current_infoview():open() assert.opened.diffwinopened.infoview() end) it('can be cleared', function(_) infoview.get_current_infoview().info:clear_diff_pin() assert.pindeleted{diff_pin.id}.diffwinclosed.infoview() end) it('can be created again', function() infoview.get_current_infoview().info:set_diff_pin(position()) diff_pin = infoview.get_current_infoview().info.diff_pin assert.pinopened{diff_pin.id}.diffwinopened.infoview() end) it('manual window close clears pins', function(_) vim.api.nvim_set_current_win(infoview.get_current_infoview().diff_win) assert.buf.left.tracked() assert.win.left.tracked() vim.api.nvim_command("quit") assert.buf.left.tracked_pending() assert.win.left.tracked_pending() assert.use_pendingbuf.use_pendingwin.pindeleted{diff_pin.id}.diffwinclosed.infoview() end) end) end)
local Skin = { } Skin.Base = "Wand" Skin.Description = [[ Generic Description ]] Skin.ViewModel = Model("models/hpwrewrite/custom/c_hagridwand.mdl") Skin.WorldModel = Model("models/hpwrewrite/custom/w_hagridwand.mdl") Skin.NodeOffset = Vector(1890, 20, 0) Skin.HoldType = "pistol" function Skin:AdjustSpritePosition(vm, m) return (m:GetAngles() + Angle(10, 0, 0)):Up() * 12 end HpwRewrite:AddSkin("Hagrid Wand", Skin)
Config = {} Config.Itemy = { { item = 'bandaz', -- Nazwa itemu <--- heal = 15, -- Ile hp dodać (podstawowo ped ma 200 o ile sie nie myle) <--- czas = 2, -- Czas "bandażowania sie" w sekundach <--- timetocan = 5 -- Czas w sekundach po ilu znowu będzie można użyć itemu (zalecam więcej niż tyle ile sie dało wyżej żeby sie nie bugowało) <--- }, { item = 'medkit', heal = 20, czas = 5, timetocan = 20 } -- { -- item = 'defibrillator', -- timetorevive = 1, -- timetocanrevive = 30 -- } }
local dump = {} local undump = require "luainlua.bytecode.undump" -- needed for sizet info local opcode = require "luainlua.bytecode.opcode" local writer = require "luainlua.bytecode.writer" local utils = require 'luainlua.common.utils' local function generic_list(ctx, list, serializer, size) local n = #list local out = ctx.writer out:int(n, size) for object in utils.loop(list) do serializer(ctx, object) end end function dump.dump_code(ctx, code) local out = ctx.writer generic_list( ctx, code, function(ctx, instruction) out:int(opcode.serialize(instruction), undump.sizeof_instruction) end) end function dump.dump_constants(ctx, constants) local out = ctx.writer generic_list( ctx, constants, function(_, object) local t = type(object) if t == 'number' then out:byte(3) out:double(object) elseif t == 'boolean' then out:byte(1) out:byte(object and 1 or 0) elseif t == 'string' then out:byte(4) out:string(object, undump.sizeof_sizet) else out:byte(0) end end) generic_list(ctx, constants.functions, dump.dump_function) end function dump.dump_upvalues(ctx, upvalues) local out = ctx.writer generic_list( ctx, upvalues, function(_, upvalue) out:byte(upvalue.instack):byte(upvalue.index) end) end function dump.dump_debug(ctx, debug) local out = ctx.writer out:string(debug.source or "", undump.sizeof_sizet) -- debug.source generic_list(ctx, debug.lineinfo or {}, function(_, info) out:int(info) end) generic_list( ctx, debug.locals or {}, function(_, object) out:string(object.name, undump.sizeof_sizet):int(object.first_pc):int(object.last_pc) end) generic_list(ctx, debug.upvalues or {}, function(_, name) out:string(name, undump.sizeof_sizet) end) end function dump.dump_header(ctx) local out = ctx.writer out:int(0x61754c1b) :byte(0x52) :byte(0) :byte(1) :byte(undump.sizeof_int) :byte(undump.sizeof_sizet) :byte(undump.sizeof_instruction) :byte(undump.sizeof_number) :byte(0) :int(0x0a0d9319) :short(0x0a1a) end function dump.dump_function(ctx, closure) local out = ctx.writer out:int(closure.first_line) out:int(closure.last_line) out:byte(closure.nparams) out:byte(closure.is_vararg and 1 or 0) out:byte(100) -- closure.stack_size dump.dump_code(ctx, closure.code) dump.dump_constants(ctx, closure.constants) dump.dump_upvalues(ctx, closure.upvalues) dump.dump_debug(ctx, closure.debug) end function dump.dump(closure) local ctx = {writer = writer.new_writer()} ctx.writer:configure(undump.sizeof_int) dump.dump_header(ctx) dump.dump_function(ctx, closure) return tostring(ctx.writer) end return dump
tmr.alarm(1,3000,1,function() --start web ide, after run this code, go to: http://i.nodeusb.com local ip = wifi.sta.getip() if(ip==nil) then print("Offline") else print(ip) require("d").r(ip,wifi.sta.getmac()) ip=nil tmr.stop(1) tmr.alarm(0,6000,0,function() dofile("i.lc") end) tmr.alarm(2,2000,0,function() d=nil package.loaded["d"]=nil collectgarbage("collect") end) end end)
object_tangible_deed_guild_deed_corellia_guild_03_deed = object_tangible_deed_guild_deed_shared_corellia_guild_03_deed:new { } ObjectTemplates:addTemplate(object_tangible_deed_guild_deed_corellia_guild_03_deed, "object/tangible/deed/guild_deed/corellia_guild_03_deed.iff")
depthShadow=false -- these setting will be auto-detected below stencilShadow=true local st=RE.ogreSceneManager():getShadowTechnique() if st==34 then stencilShadow=false elseif st==37 then stencilShadow=false depthShadow=true end function shadowMaterial(input) if depthShadow then return input.."_depthshadow" end return input end
return { alert = function() ALERT("Hello, world!") end; }
local parameterLv = 0 -- PKG: Begin at 0 local shapeCounter = 0 local layerCounter = 1 -- MUST Begin at 1 local parameterCnt = 1 -- MUST Begin at 1 local staticSegBuf = {} local layerOutputs = {} local _ctrlfp = io.stdout local makeLayer = function(t, paraNum) t.layerId = layerCounter layerCounter = layerCounter + 1 if paraNum > 0 then t.paraLv = parameterLv parameterLv = parameterLv + 1 t.paraId = parameterCnt parameterCnt = parameterCnt + paraNum end end conv2d = function(args) local ret = args makeLayer(ret, 2) ret.op = "conv2d" assert(ret.stride , "conv2d: \"stride\" not set") assert(ret.padding, "conv2d: \"padding\" not set") if not ret.offset then ret.offset = 0 end -- output = conv2d(input, weight, bias, stride, padding, offset, name) ret.format = function(output, info, parals, scope) local name = info.name if not name then name = output end if type(scope) == "string" then name = string.format("%s/%s", scope, name) end parals[info.paraId + 0] = string.format("%03d.w", info.paraLv) parals[info.paraId + 1] = string.format("%03d.b", info.paraLv) layerOutputs[ret.layerId] = output if info.input == nil then if info.layerId - 1 < 1 then assert(nil, "must specify an input for the 1st layer") end info.input = string.format("@%d", info.layerId - 1) end return string.format( "%s = cc_conv2d(%s, __pls[%d], __pls[%d], %d, %d, %d, \"%s\");", output, info.input, info.paraId - 1, info.paraId, info.stride, info.padding, info.offset, name) end return ret end dwConv2d = function(args) local ret = args makeLayer(ret, 2) ret.op = "dwConv2d" assert(ret.stride , "dwConv2d: \"stride\" not set") assert(ret.padding, "dwConv2d: \"padding\" not set") if not ret.offset then ret.offset = 0 end -- output = dwConv2d(input, weight, bias, stride, padding, offset, name) ret.format = function(output, info, parals, scope) local name = info.name if not name then name = output end if type(scope) == "string" then name = string.format("%s/%s", scope, name) end parals[info.paraId + 0] = string.format("%03d.w", info.paraLv) parals[info.paraId + 1] = string.format("%03d.b", info.paraLv) layerOutputs[ret.layerId] = output if info.input == nil then if info.layerId - 1 < 1 then assert(nil, "must specify an input for the 1st layer") end info.input = string.format("@%d", info.layerId - 1) end return string.format( "%s = cc_dw_conv2d(%s, __pls[%d], __pls[%d], %d, %d, %d, \"%s\");", output, info.input, info.paraId - 1, info.paraId, info.stride, info.padding, info.offset, name) end return ret end pwConv2d = function(args) local ret = args makeLayer(ret, 2) ret.op = "pwConv2d" -- output = pwConv2d(input, weight, bias, name) ret.format = function(output, info, parals, scope) local name = info.name if not name then name = output end if type(scope) == "string" then name = string.format("%s/%s", scope, name) end parals[info.paraId + 0] = string.format("%03d.w", info.paraLv) parals[info.paraId + 1] = string.format("%03d.b", info.paraLv) layerOutputs[ret.layerId] = output if info.input == nil then if info.layerId - 1 < 1 then assert(nil, "must specify an input for the 1st layer") end info.input = string.format("@%d", info.layerId - 1) end return string.format( "%s = cc_pw_conv2d(%s, __pls[%d], __pls[%d], \"%s\");", output, info.input, info.paraId - 1, info.paraId, name) end return ret end fullyConnected = function(args) local ret = args makeLayer(ret, 2) ret.op = "fullyConnected" -- output = fullyConnected(input, weight, bias, name) ret.format = function(output, info, parals, scope) local name = info.name if not name then name = output end if type(scope) == "string" then name = string.format("%s/%s", scope, name) end parals[info.paraId + 0] = string.format("%03d.w", info.paraLv) parals[info.paraId + 1] = string.format("%03d.b", info.paraLv) layerOutputs[ret.layerId] = output if info.input == nil then if info.layerId - 1 < 1 then assert(nil, "must specify an input for the 1st layer") end info.input = string.format("@%d", info.layerId - 1) end return string.format( "%s = cc_fully_connected(%s, __pls[%d], __pls[%d], \"%s\");", output, info.input, info.paraId - 1, info.paraId, name) end return ret end relu = function(args) local ret = args makeLayer(ret, 0) ret.op = "relu" --[[ output = relu(input, name) ]] ret.format = function(output, info, parals, scope) local name = info.name if not name then name = "NULL" else if type(scope) == "string" then name = string.format("%s/%s", scope, name) end name = string.format("\"%s\"", name) end layerOutputs[ret.layerId] = output if info.input == nil then if info.layerId - 1 < 1 then assert(nil, "must specify an input for the 1st layer") end info.input = string.format("@%d", info.layerId - 1) end return string.format( "%s = cc_relu(%s, %s);", output, info.input, name) end return ret end softmax = function(args) local ret = args makeLayer(ret, 0) ret.op = "softmax" --[[ output = softmax(input, name) ]] ret.format = function(output, info, parals, scope) local name = info.name if not name then name = "NULL" else if type(scope) == "string" then name = string.format("%s/%s", scope, name) end name = string.format("\"%s\"", name) end layerOutputs[ret.layerId] = output if info.input == nil then if info.layerId - 1 < 1 then assert(nil, "must specify an input for the 1st layer") end info.input = string.format("@%d", info.layerId - 1) end return string.format( "%s = cc_softmax(%s, %s);", output, info.input, name) end return ret end maxPool2d = function(args) local ret = args makeLayer(ret, 0) ret.op = "maxPool2d" assert(ret.stride , "maxPool2d: \"stride\" not set") --[[ output = relu(input, name) ]] ret.format = function(output, info, parals, scope) local name = info.name if not name then name = output end if type(scope) == "string" then name = string.format("%s/%s", scope, name) end layerOutputs[ret.layerId] = output if info.input == nil then if info.layerId - 1 < 1 then assert(nil, "must specify an input for the 1st layer") end info.input = string.format("@%d", info.layerId - 1) end return string.format("%s = cc_max_pool2d(%s, %d, \"%s\");", output, info.input, info.stride, name) end return ret end batchNorm2d = function(args) local ret = args makeLayer(ret, 1) ret.op = "batchNorm2d" --[[ output = relu(input, name) ]] ret.format = function(output, info, parals, scope) local name = info.name if not name then name = output end if type(scope) == "string" then name = string.format("%s/%s", scope, name) end parals[info.paraId] = string.format("%03d.n", info.paraLv) layerOutputs[ret.layerId] = output if info.input == nil then if info.layerId - 1 < 1 then assert(nil, "must specify an input for the 1st layer") end info.input = string.format("@%d", info.layerId - 1) end return string.format( "%s = cc_batch_norm2d(%s, __pls[%d], \"%s\");", output, info.input, info.paraId - 1, name) end return ret end reshape = function(args) local ret = args makeLayer(ret, 0) ret.op = "reshape" assert(ret.shape, "reshape: \"shape\" is required") local buf = string.format( "static int __shape%d[] = {", shapeCounter) for k, v in pairs(ret.shape) do buf = string.format("%s%d, ", buf, v) end buf = string.format("%s0};", buf, v) table.insert(staticSegBuf, buf) ret.shapeId = shapeCounter shapeCounter = shapeCounter + 1 ret.format = function(output, info, parals, scope) if info.input == nil then if info.layerId - 1 < 1 then assert(nil, "must specify an input for the 1st layer") end info.input = string.format("@%d", info.layerId - 1) end local code = string.format( "%s = cc_reshape(%s, __shape%d);", output, info.input, info.shapeId) layerOutputs[ret.layerId] = output return code end return ret end local fputs = function(fp, ...) local args = { ... } for k, v in pairs(args) do fp:write(v) end end local printLine = function(line, indent) if indent == nil then indent = 0 end local lineLimit = 80 local indentOff = indent * 8 local indentStr = string.rep("\t", indent) local csr = 1 local brk = 0 local pos = 0 local nextword = "" repeat if pos == 0 then pos = indentOff fputs(_ctrlfp, indentStr) end brk, _ = string.find(line, ',', csr) if brk ~= nil then nextword = string.sub(line, csr, brk) else nextword = string.sub(line, csr) end csr = csr + #nextword if pos + #nextword >= lineLimit then fputs(_ctrlfp, '\n'); pos = indentOff fputs(_ctrlfp, indentStr) end if pos == indentOff then local off, _ = string.find(nextword, ' ') if off == 1 then nextword = string.sub(nextword, 2) end end fputs(_ctrlfp, string.format("%s", nextword)) pos = pos + #nextword until csr >= #line fputs(_ctrlfp, '\n') end local runningFlag = true ccCodeTranslator = function(net, cfg) assert(runningFlag, "This beta version can only handle 1 network") runningFlag = false local createTsr = {} local keyFilter = {} local codeLines = {} local paraxList = {} local indentOff = 1 local keyWords = {inputLayers = true, outputLayers = true} if type(cfg) == "table" then if type(cfg.file) == "string" then _ctrlfp = io.open(cfg.file, "w+") assert(_ctrlfp, string.format("failed open file: [%s]", cfg.file)) end end local netName = net.networkName assert(netName, "Network's name not set") local netDef = string.format("void %s(", netName) for k, v in pairs(net.inputLayers) do netDef = netDef..string.format("cc_tensor_t *%s, ", v) keyFilter[v] = true end for k, v in pairs(net.outputLayers) do netDef = netDef..string.format("cc_tensor_t **%s, ", v) keyFilter[v] = true end netDef = string.sub(netDef, 1, #netDef - 2)..")" printLine(netDef, 0) printLine("{", 0) for k, v in pairs(staticSegBuf) do printLine(v, 1) end for k, v in pairs(net) do repeat if keyWords[k] then break end if type(v) == "table" then if net.parameterLv ~= nil and v.paraLv ~= nil then v.paraLv = v.paraLv + net.parameterLv end if keyFilter[k] then k = string.format("*%s", k) else createTsr[v.layerId] = k end codeLines[v.layerId] = v.format(k, v, paraxList, net.createScope) end break until true end local paraDef = "static const char *p_namels[] = {" printLine(paraDef, indentOff + 0) paraDef = "" for k,v in pairs(paraxList) do paraDef = paraDef.."\""..v.."\", " end paraDef = string.sub(paraDef, 1, #paraDef - 2).."};" printLine(paraDef, indentOff + 1) printLine(string.format( "static cc_tensor_t *__pls[%d];", #paraxList), indentOff + 0) local layerDef = "cc_tensor_t " for k = 1, #createTsr do v = createTsr[k] layerDef = layerDef..string.format("*%s, ", v) end layerDef = string.sub(layerDef, 1, #layerDef - 2)..";" printLine(layerDef, indentOff + 0) printLine("static int i;", indentOff + 0) printLine(string.format( "for (; i < %d; ++i) {", #paraxList), indentOff + 0) printLine(string.format( "__pls[i] = cc_tsrmgr_get(p_namels[i]);"), indentOff + 1) printLine("}", indentOff + 0) for k = 1, #codeLines do v = codeLines[k] v = string.gsub(v, "@%d*,", function(s) return string.format("%s,", layerOutputs[tonumber(string.sub(s, 2, #s - 1))]) end) printLine(v, indentOff + 0) end printLine("}", 0) if _ctrlfp ~= io.stdout then io.close(_ctrlfp) _ctrlfp = io.stdout end end
-- --Tools -- minetest.register_tool("gocm_carbon:mese_diamond_pick", { description = "Mese Diamond Pick", inventory_image = "tgg_recompressed_pickaxe.png", tool_capabilities = { full_punch_interval = 0.8, max_drop_level=3, groupcaps={ cracky = {times={[1]=1.50, [2]=0.75, [3]=0.35}, uses=40, maxlevel=3}, }, damage_groups = {fleshy=5}, }, sound = {breaks = "default_tool_breaks"}, }) minetest.register_tool("gocm_carbon:mese_diamond_shovel", { description = "Mese Diamond shovel", inventory_image = "tgg_recompressed_shovel.png", wield_image = "tgg_recompressed_shovel.png^[transformR90", tool_capabilities = { full_punch_interval = 0.8, max_drop_level=3, groupcaps={ crumbly = {times={[1]=0.90, [2]=0.45, [3]=0.25}, uses=40, maxlevel=3}, }, damage_groups = {fleshy=5}, }, sound = {breaks = "default_tool_breaks"}, }) minetest.register_tool("gocm_carbon:mese_diamond_axe", { description = "Mese Diamond Axe", inventory_image = "tgg_recompressed_axe.png", tool_capabilities = { full_punch_interval = 0.8, max_drop_level=3, groupcaps={ choppy={times={[1]=1.9, [2]=0.65, [3]=0.38}, uses=30, maxlevel=3}, }, damage_groups = {fleshy=5}, }, sound = {breaks = "default_tool_breaks"}, })
package.path = "src/?.lua;"..package.path async = require("Luaseq").async mutex = require("Luaseq").mutex local function errcheck(perr, f, ...) local ok, err = pcall(f, ...) assert(not ok and not not err:find(perr)) end -- Task do -- test multiple coroutines waiting on a task local t = async() local sum = 0 for i=1,3 do async(function() sum = t:wait()+sum end) end assert(sum == 0) assert(not t:completed()) t(2) assert(t:completed()) assert(sum == 6) end do -- test subsequent completions/waits local t = async() local sum = 0 async(function() for i=1,10 do sum = sum+t:wait() end end) t(2) assert(sum == 20) errcheck("task already completed", t, 3) -- must throw an error -- task can still be waited on async(function(n) for i=1,n do sum = sum+t:wait() end end, 10) assert(sum == 40) end do -- other error checks local t = async() errcheck("async wait outside a coroutine", t.wait, t) -- outside coroutine -- error on first resume errcheck("arithmetic on a nil value", async, function() return 1*nil end) -- error on subsequent resume async(function() t:wait(); return 1*nil end) errcheck("arithmetic on a nil value", t) end -- Mutex do -- test mutex lock/unlock local m = mutex() assert(not m:locked()) local t_begin, t_end = async(), async() local step local function launch(name) async(function() m:lock() step = name.."-lock" t_begin:wait() step = name.."-exec" t_end:wait() m:unlock() end) end launch("first") assert(m:locked()) launch("second") assert(step == "first-lock") t_begin(); assert(step == "first-exec") t_end(); assert(step == "second-exec") assert(not m:locked()) end do -- test reentrant mutex local m = mutex("reentrant") assert(not m:locked()) local t = async() local step local function launch(name) async(function() for i=1,3 do m:lock() end step = name; t:wait() for i=1,3 do m:unlock() end end) end launch("first") assert(m:locked()) launch("second") assert(step == "first") t(); assert(step == "second") assert(not m:locked()) end do -- check errors errcheck("invalid mutex mode", mutex, "rentrant") -- typo local m = mutex() errcheck("mutex lock outside a coroutine", m.lock, m) errcheck("mutex unlock outside a coroutine", m.unlock, m) async(function() errcheck("mutex is not locked", m.unlock, m) m:lock() errcheck("mutex is not reentrant", m.lock, m) end) async(function() errcheck("mutex unlock in wrong thread", m.unlock, m) end) -- check resume error local m2 = mutex() local t = async() async(function() m2:lock(); t:wait() errcheck("arithmetic on a nil value", m2.unlock, m2) end) async(function() m2:lock() local a = 1*nil m2:unlock() end) t() end
local log = libshit.log local type, select, concat, tostring = type, select, table.concat, tostring local function pack(...) return select('#', ...), {...} end -- fix l = log("foo") l:info(...) support local old_check_log = log.check_log function log.check_log(name, level) if type(name) ~= "string" then name = name.name end return old_check_log(name, level) end local old_raw_log = log.raw_log function log.raw_log(name, ...) if type(name) ~= "string" then name = name.name end return old_raw_log(name, ...) end -- ... can be a single function or anything else -- If it's a single function, it's called with zero arguments, and the return -- values are logged. Otherwise the parameters are converted to strings, -- concatenated and logged. function log.log(name, level, ...) if type(name) ~= "string" then name = name.name end if not old_check_log(name, level) then return end local msg = ... local n = select('#', ...) local tbl if n == 1 and type(msg) == 'function' then n, tbl = pack(msg()) else tbl = {...} end for i = 1, n do tbl[i] = tostring(tbl[i]) end return old_raw_log(name, level, concat(tbl, '\t')..'\n') end -- do not remove returns, tail call optimization removes callframe needed to get -- proper file and line values in output function log.err(name, ...) return log.log(name, log.ERROR, ...) end log.error = log.err function log.warn(name, ...) return log.log(name, log.WARNING, ...) end log.warning = log.warn function log.info(name, ...) return log.log(name, log.INFO, ...) end function log.debug(name, level, ...) assert(0 <= level and level < 5, "invalid debug level") return log.log(name, level, ...) end log.__index = log function log.new(name) return setmetatable({name=name}, log) end setmetatable(log, debug.getregistry().libshit_new_mt)
hp = 1000 attack = 275 defense = 210 speed = 55 mdefense = 250 luck = 40 strength = ELEMENT_NONE weakness = ELEMENT_NONE function initId(id) myId = id end function start() end function get_action(step) return COMBAT_ATTACKING, 1, getRandomPlayer() end function die() end
do return end do local t= 123 local dd =1231 end function ffff() do local tt= 123 local ccc =1231 end end
local resortPlatformHelper = require("helpers.resort_platforms") local utils = require("utils") local textures = { "default", "cliffside" } local textureOptions = {} for _, texture in ipairs(textures) do textureOptions[utils.titleCase(texture)] = texture end local movingPlatform = {} movingPlatform.name = "movingPlatform" movingPlatform.depth = 1 movingPlatform.nodeLimits = {1, 1} movingPlatform.fieldInformation = { texture = { options = textureOptions } } movingPlatform.placements = {} for i, texture in ipairs(textures) do movingPlatform.placements[i] = { name = texture, data = { width = 8, texture = texture } } end function movingPlatform.sprite(room, entity) local sprites = {} local x, y = entity.x or 0, entity.y or 0 local nodes = entity.nodes or {{x = 0, y = 0}} local nodeX, nodeY = nodes[1].x, nodes[1].y resortPlatformHelper.addConnectorSprites(sprites, entity, x, y, nodeX, nodeY) resortPlatformHelper.addPlatformSprites(sprites, entity, entity) return sprites end function movingPlatform.nodeSprite(room, entity, node) return resortPlatformHelper.addPlatformSprites({}, entity, node) end movingPlatform.selection = resortPlatformHelper.getSelection local sinkingPlatform = {} sinkingPlatform.name = "sinkingPlatform" sinkingPlatform.depth = 1 sinkingPlatform.fieldInformation = { texture = { options = textureOptions } } sinkingPlatform.placements = {} for i, texture in ipairs(textures) do sinkingPlatform.placements[i] = { name = texture, data = { width = 16, texture = texture } } end function sinkingPlatform.sprite(room, entity) local sprites = {} -- Prevent visual oddities with too long lines local x, y = entity.x or 0, entity.y or 0 local nodeY = room.height - 2 if y > nodeY then nodeY = y end resortPlatformHelper.addConnectorSprites(sprites, entity, x, y, x, nodeY) resortPlatformHelper.addPlatformSprites(sprites, entity, entity) return sprites end sinkingPlatform.selection = resortPlatformHelper.getSelection return { movingPlatform, sinkingPlatform }
local cURL = require "cURL" local csv = require "csv" local listfile_url = "https://wow.tools/casc/listfile/download/csv/unverified" local function HTTP_GET(url, file) local data, idx = {}, 0 cURL.easy{ url = url, writefunction = file or function(str) idx = idx + 1 data[idx] = str end, ssl_verifypeer = false, }:perform():close() return table.concat(data) end function GetListfile(func, force) -- cache listfile local path = string.format("input/listfile.csv") local file = io.open(path, "r") if force or not file then file = io.open(path, "w") HTTP_GET(listfile_url, file) file:close() end -- read listfile local file = csv.open(path, {separator = ";"}) func(file) end
local menubar = require ('menubar') local beautiful = require ('beautiful') local hotkeys_popup = require ('awful.hotkeys_popup') local awful = require ('awful') myawesomemenu = { { "Manual", terminal .. " -e man awesome" }, { "Edit config", editor_cmd .. " " .. awesome.conffile }, { "Quit", function() awesome.quit() end }, } powermenu = { {"Suspend", function() awful.spawn({"systemctl", "suspend"}) end }, {"Lock", function() awful.spawn({"loginctl", "lock-session"}) end }, {"Restart Awesome", awesome.restart }, {"Reboot", function() awful.spawn({"systemctl", "reboot"}) end}, {"Poweroff", function() awful.spawn({"systemctl", "poweroff"}) end}, } editmenu = { { "Text Editor (".. editor .. ")", editor_cmd }, { "Awesome Config", editor_cmd .. ' ' .. awesome.conffile }, { "User Directories", editor_cmd .. ' ' .. awesome.conffile .. '../user-dirs.dirs'}, } utilitymenu = { { "Monitor ("..sysmonitor..")", terminal .. " -e " .. sysmonitor }, { "Change Wallpaper", function() awful.spawn.easy_async("nitrogen" ,function() end) end}, } mymainmenu = awful.menu({ items = { { "Awesome", myawesomemenu, beautiful.awesome_icon }, { "Firefox", function() awful.spawn.easy_async("firefox", function() end) end }, { "Thunar", function() awful.spawn.easy_async("thunar",function() end) end }, { "Steam", function() awful.spawn.easy_async("steam",function() end) end }, { "Hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, { "Terminal", terminal }, { "Edit", editmenu }, { "Utilities", utilitymenu }, { "Power", powermenu } } }) mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu }) menubar.utils.terminal = terminal
#!lua solution "rover-manager" configurations { "Debug", "Release" } files { "../src/*.cpp", "../include/*.h" } includedirs { "../include", "../deps/phoenix-example/include", "../deps/pistache/include" } project "rover-manager" kind "ConsoleApp" language "C++" files { "**.h", "**.cpp" } -- prebuildcommands { "./BuildDeps.sh" } configuration "Debug" defines { "DEBUG" } flags { "Symbols" } libdirs{ "../deps/phoenix-example/lib/x86-64", "../deps/pistache/prefix/lib" } links { "CTRE_Phoenix", "CTRE_PhoenixCCI", "CTRE_PhoenixCanutils", "CTRE_PhoenixPlatformLinuxSocketCan", "pistache", "SDL2", "pthread" } targetdir "../build/x86" configuration "Release" defines { "NDEBUG" } flags { "Optimize" } linkoptions { "-Bstatic" } libdirs{ "../deps/phoenix-example/lib/jetsontx", "../deps/pistache/prefix/lib" } links { "CTRE_Phoenix", "CTRE_PhoenixCCI", "CTRE_PhoenixCanutils", "CTRE_PhoenixPlatformLinuxSocketCan", "pistache", "SDL2", "pthread" } targetdir "../build/jetson"
return function(state, action) state = state or 1 return state end
description = [[ Checks if the website holds a mobile version. ]] --- -- @usage nmap -p80 --script http-mobileversion-checker.nse <host> -- -- This script sets an Android User-Agent header and checks if the request -- will be redirected to a page different than a (valid) browser request -- would be. If so, this page is most likely to be a mobile version of the -- app. -- -- @args newtargets If this is set, add any newly discovered hosts to nmap -- scanning queue. Default: nil -- -- @output -- PORT STATE SERVICE REASON -- 80/tcp open http syn-ack -- |_ http-mobileversion-checker: Found mobile version: https://m.some-very-random-website.com (Redirected to a different host) -- --- categories = {"discovery", "safe"} author = "George Chatzisofroniou" license = "Same as Nmap--See https://nmap.org/book/man-legal.html" local http = require "http" local target = require "target" local shortport = require "shortport" local httpspider = require "httpspider" local stdnse = require "stdnse" getLastLoc = function(host, port, useragent) local options options = {header={}, no_cache=true, redirect_ok=function(host,port) local c = 3 return function(url) if ( c==0 ) then return false end c = c - 1 return true end end } options['header']['User-Agent'] = useragent local response = http.get(host, port, '/', options) if response.location then return response.location[#response.location] or false end return false end portrule = shortport.port_or_service( {80, 443}, {"http", "https"}, "tcp", "open") action = function(host, port) local newtargets = stdnse.get_script_args("newtargets") or nil -- We don't crawl any site. We initialize a crawler to use its iswithinhost method. local crawler = httpspider.Crawler:new(host, port, '/', { scriptname = SCRIPT_NAME } ) local loc = getLastLoc(host, port, "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17") local mobloc = getLastLoc(host, port, "Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30") -- If the mobile browser request is redirected to a different page, that must be the mobile version's page. if loc ~= mobloc then local msg = "Found mobile version: " .. mobloc local mobhost = http.parse_url(mobloc) if not crawler:iswithinhost(mobhost.host) then msg = msg .. " (Redirected to a different host)" if newtargets then target.add(mobhost.host) end end return msg end return "No mobile version detected." end
-- Generated By protoc-gen-lua Do not Edit local protobuf = require "protobuf/protobuf" local OUTLOOK_PB = require("OutLook_pb") local ROLETYPE_PB = require("RoleType_pb") module('RoleBriefInfo_pb') ROLEBRIEFINFO = protobuf.Descriptor(); local ROLEBRIEFINFO_TYPE_FIELD = protobuf.FieldDescriptor(); local ROLEBRIEFINFO_ROLEID_FIELD = protobuf.FieldDescriptor(); local ROLEBRIEFINFO_NAME_FIELD = protobuf.FieldDescriptor(); local ROLEBRIEFINFO_LEVEL_FIELD = protobuf.FieldDescriptor(); local ROLEBRIEFINFO_FASHION_FIELD = protobuf.FieldDescriptor(); local ROLEBRIEFINFO_OUTLOOK_FIELD = protobuf.FieldDescriptor(); local ROLEBRIEFINFO_PPT_FIELD = protobuf.FieldDescriptor(); ROLEBRIEFINFO_TYPE_FIELD.name = "type" ROLEBRIEFINFO_TYPE_FIELD.full_name = ".KKSG.RoleBriefInfo.type" ROLEBRIEFINFO_TYPE_FIELD.number = 1 ROLEBRIEFINFO_TYPE_FIELD.index = 0 ROLEBRIEFINFO_TYPE_FIELD.label = 1 ROLEBRIEFINFO_TYPE_FIELD.has_default_value = false ROLEBRIEFINFO_TYPE_FIELD.default_value = nil ROLEBRIEFINFO_TYPE_FIELD.enum_type = ROLETYPE_PB.ROLETYPE ROLEBRIEFINFO_TYPE_FIELD.type = 14 ROLEBRIEFINFO_TYPE_FIELD.cpp_type = 8 ROLEBRIEFINFO_ROLEID_FIELD.name = "roleID" ROLEBRIEFINFO_ROLEID_FIELD.full_name = ".KKSG.RoleBriefInfo.roleID" ROLEBRIEFINFO_ROLEID_FIELD.number = 2 ROLEBRIEFINFO_ROLEID_FIELD.index = 1 ROLEBRIEFINFO_ROLEID_FIELD.label = 1 ROLEBRIEFINFO_ROLEID_FIELD.has_default_value = false ROLEBRIEFINFO_ROLEID_FIELD.default_value = 0 ROLEBRIEFINFO_ROLEID_FIELD.type = 4 ROLEBRIEFINFO_ROLEID_FIELD.cpp_type = 4 ROLEBRIEFINFO_NAME_FIELD.name = "name" ROLEBRIEFINFO_NAME_FIELD.full_name = ".KKSG.RoleBriefInfo.name" ROLEBRIEFINFO_NAME_FIELD.number = 3 ROLEBRIEFINFO_NAME_FIELD.index = 2 ROLEBRIEFINFO_NAME_FIELD.label = 1 ROLEBRIEFINFO_NAME_FIELD.has_default_value = false ROLEBRIEFINFO_NAME_FIELD.default_value = "" ROLEBRIEFINFO_NAME_FIELD.type = 9 ROLEBRIEFINFO_NAME_FIELD.cpp_type = 9 ROLEBRIEFINFO_LEVEL_FIELD.name = "level" ROLEBRIEFINFO_LEVEL_FIELD.full_name = ".KKSG.RoleBriefInfo.level" ROLEBRIEFINFO_LEVEL_FIELD.number = 4 ROLEBRIEFINFO_LEVEL_FIELD.index = 3 ROLEBRIEFINFO_LEVEL_FIELD.label = 1 ROLEBRIEFINFO_LEVEL_FIELD.has_default_value = false ROLEBRIEFINFO_LEVEL_FIELD.default_value = 0 ROLEBRIEFINFO_LEVEL_FIELD.type = 5 ROLEBRIEFINFO_LEVEL_FIELD.cpp_type = 1 ROLEBRIEFINFO_FASHION_FIELD.name = "fashion" ROLEBRIEFINFO_FASHION_FIELD.full_name = ".KKSG.RoleBriefInfo.fashion" ROLEBRIEFINFO_FASHION_FIELD.number = 5 ROLEBRIEFINFO_FASHION_FIELD.index = 4 ROLEBRIEFINFO_FASHION_FIELD.label = 3 ROLEBRIEFINFO_FASHION_FIELD.has_default_value = false ROLEBRIEFINFO_FASHION_FIELD.default_value = {} ROLEBRIEFINFO_FASHION_FIELD.type = 13 ROLEBRIEFINFO_FASHION_FIELD.cpp_type = 3 ROLEBRIEFINFO_OUTLOOK_FIELD.name = "outlook" ROLEBRIEFINFO_OUTLOOK_FIELD.full_name = ".KKSG.RoleBriefInfo.outlook" ROLEBRIEFINFO_OUTLOOK_FIELD.number = 6 ROLEBRIEFINFO_OUTLOOK_FIELD.index = 5 ROLEBRIEFINFO_OUTLOOK_FIELD.label = 1 ROLEBRIEFINFO_OUTLOOK_FIELD.has_default_value = false ROLEBRIEFINFO_OUTLOOK_FIELD.default_value = nil ROLEBRIEFINFO_OUTLOOK_FIELD.message_type = OUTLOOK_PB.OUTLOOK ROLEBRIEFINFO_OUTLOOK_FIELD.type = 11 ROLEBRIEFINFO_OUTLOOK_FIELD.cpp_type = 10 ROLEBRIEFINFO_PPT_FIELD.name = "ppt" ROLEBRIEFINFO_PPT_FIELD.full_name = ".KKSG.RoleBriefInfo.ppt" ROLEBRIEFINFO_PPT_FIELD.number = 7 ROLEBRIEFINFO_PPT_FIELD.index = 6 ROLEBRIEFINFO_PPT_FIELD.label = 1 ROLEBRIEFINFO_PPT_FIELD.has_default_value = false ROLEBRIEFINFO_PPT_FIELD.default_value = 0 ROLEBRIEFINFO_PPT_FIELD.type = 13 ROLEBRIEFINFO_PPT_FIELD.cpp_type = 3 ROLEBRIEFINFO.name = "RoleBriefInfo" ROLEBRIEFINFO.full_name = ".KKSG.RoleBriefInfo" ROLEBRIEFINFO.nested_types = {} ROLEBRIEFINFO.enum_types = {} ROLEBRIEFINFO.fields = {ROLEBRIEFINFO_TYPE_FIELD, ROLEBRIEFINFO_ROLEID_FIELD, ROLEBRIEFINFO_NAME_FIELD, ROLEBRIEFINFO_LEVEL_FIELD, ROLEBRIEFINFO_FASHION_FIELD, ROLEBRIEFINFO_OUTLOOK_FIELD, ROLEBRIEFINFO_PPT_FIELD} ROLEBRIEFINFO.is_extendable = false ROLEBRIEFINFO.extensions = {} RoleBriefInfo = protobuf.Message(ROLEBRIEFINFO)
local utils = require('restructure.utils') local Pointer = {} Pointer.__index = Pointer local VoidPointer = {} VoidPointer.__index = VoidPointer function Pointer.new(offsetType, type, options) local p = setmetatable({}, Pointer) p.offsetType = offsetType p.options = options or {} p.type = type if p.type == 'void' then p.type = nil end if p.options.type == nil then p.options.type = 'local' end if p.options.allowNull == nil then p.options.allowNull= true end if p.options.nullValue == nil then p.options.nullValue = 0 end if p.options.lazy == nil then p.options.lazy = false end if p.options.relativeTo then p.relativeToGetter = function(ctx) local s = load(string.format("return ctx.%s",p.options.relativeTo), "ld", "bt", {ctx = ctx}) return s() end end return p end function Pointer:decode(stream, ctx) local offset = self.offsetType:decode(stream, ctx) -- handle NULL pointers if offset == self.options.nullValue and self.options.allowNull then return nil end local relative if self.options.type == 'local' then relative = ctx._startOffset elseif self.options.type == 'immediate' then relative = stream.buffer.pos - self.offsetType:size() elseif self.options.typ == 'parent' then relative = ctx.parent._startOffset else -- global local c = ctx while c.parent do c = c.parent end relative = c._startOffset or 0 end if self.options.relativeTo then relative = relative + self.relativeToGetter(ctx) end local ptr = offset + relative if self.type then local val = nil local decodeValue = function() if val ~= nil then return val end local pos = stream.buffer.pos stream.buffer.pos = ptr val = self.type:decode(stream, ctx) stream.buffer.pos = pos return val end -- If this is a lazy pointer, define a getter to decode only when needed. -- This obviously only works when the pointer is contained by a Struct. if self.options.lazy then return utils.PropertyDescriptor.new({get = decodeValue}) end return decodeValue() else return ptr end end function Pointer:size(val, ctx) local parent = ctx if self.options.type == 'parent' then ctx = ctx.parent elseif self.options.type ~= 'local' and self.options.type ~= 'immediate' then while ctx.parent do ctx = ctx.parent end end local type = self.type if type == nil then if not utils.instanceOf(val, VoidPointer) then error("Must be a VoidPointer") end type = val.type val = val.value end if val and ctx then if not ctx.pointerSize then ctx.pointerSize = 0 end ctx.pointerSize = ctx.pointerSize + type:size(val, parent) end return self.offsetType:size() end function Pointer:encode(stream, val, ctx) local parent = ctx if not val then self.offsetType:encode(stream, self.options.nullValue) return end local relative if self.options.type == 'local' then relative = ctx.startOffset elseif self.options.type == 'immediate' then relative = stream.buffer.pos + self.offsetType:size(val, parent) elseif self.options.type == 'parent' then ctx = ctx.parent relative = ctx.startOffset else -- global relative = 0 while ctx.parent do ctx = ctx.parent end end if self.options.relativeTo then relative = relative + self.relativeToGetter(parent.val) end self.offsetType:encode(stream, ctx.pointerOffset - relative) local type = self.type if type == nil then if not utils.instanceOf(val, VoidPointer) then error("Must be a VoidPointer") end type = val.type val = val.value end table.insert(ctx.pointers, { type = type, val = val, parent = parent }) ctx.pointerOffset = ctx.pointerOffset + type:size(val, parent) end function VoidPointer.new(type, value) local v = setmetatable({}, VoidPointer) v.type = type v.value = value return v end local exports = {} exports.Pointer = Pointer exports.VoidPointer = VoidPointer return exports
-- 移動モジュール local Movement = {} -- 初期化 function Movement:initialize(x, y) -- 現在の座標 self.x = x or self.x or 0 self.y = y or self.y or 0 -- 移動先 self.movement = { x = 0, y = 0, startX = self.x, startY = self.y, endX = self.x, endY = self.y, duration = 0, moving = false, timer = 0, } end -- 移動中かどうか返す function Movement:isMoving() return self.movement.moving end -- 更新 function Movement:updateMovement(dt) local move = self.movement -- 移動処理 if move.moving then -- タイマーカウントアップ move.timer = move.timer + dt -- 現在の地点 local lerp = move.timer / move.duration -- 期間を過ぎたら移動終了 if move.timer >= move.duration then lerp = 1 move.moving = false end -- 座標更新 self.x = move.startX + move.x * lerp self.y = move.startY + move.y * lerp end end -- 移動の開始 function Movement:startMovement(x, y, duration) local move = self.movement -- 初期設定 move.duration = duration or 0 move.x = x or 0 move.y = y or 0 move.startX = self.x move.startY = self.y move.endX = move.startX + move.x move.endY = move.startY + move.y move.timer = 0 if move.duration == 0 then -- 移動時間がないなら、すぐ設定 self.x = move.endX self.y = move.endY move.moving = false else -- 移動先を設定 move.moving = true end end return Movement
//All the folders you see here have files that are usually blank, and are mostly unnecessary for first release. //They are simply what needs to be accomplished in time. //Priority wise, work on scoreboard, hud, classes, teams, and menus first. //Classes and teams are just there to help keep the files smaller and neater. //The rest of the folders can be populated any time, though objectives, hitmarkers, and shields would give it a halo feel. /*This is a list of people who have signed up to be perma members ie recognized by game: Hagane: STEAM_0:0:51046670 Blue gameraider: STEAM_0:0:66885172 Blue jimmie_rustler (ask who this is): STEAM_0:0:45590513 blue clock face: STEAM_0:0:46291837 red note must get more. */
-- -- -- Gaussian.lua -- Created by Andrey Kolishchak on 2/14/16. -- -- -- Gaussian sampler Module -- input = {mu, log(sigma^2)} = {mu, log_sq_sigma} -- y = mu + sqrt(exp(log_sq_sigma))*z = mu + exp(0.5*log_sq_sigma))*z, z ~ N(0,1) -- local Gaussian, parent = torch.class('nn.Gaussian', 'nn.Module') function Gaussian:__init() parent.__init(self) self.z = torch.Tensor() self.gradInput = { torch.Tensor(), torch.Tensor() } end function Gaussian:updateOutput(input) local mu, log_sq_sigma = input[1], input[2] self.z:resizeAs(mu):normal(0, 1) -- z ~ N(0,1) self.output:resizeAs(log_sq_sigma):copy(log_sq_sigma):mul(0.5):exp():cmul(self.z):add(mu) -- exp(0.5*log_sq_sigma)*z + mu return self.output end function Gaussian:updateGradInput(input, gradOutput) local mu, log_sq_sigma = input[1], input[2] -- d_y/d_mu = 1 self.gradInput[1]:resizeAs(gradOutput):copy(gradOutput) -- d_y/d_sigma = exp(0.5*log_sq_sigma)*z*0.5 self.gradInput[2]:resizeAs(log_sq_sigma):copy(log_sq_sigma):mul(0.5):exp():cmul(self.z):mul(0.5):cmul(gradOutput) return self.gradInput end
--------------------------------------------------- ------- class Mover -- constructor Mover = class( function(this,_m,_x,_y) this.loc = of.Vec2f(_x,_y) this.vel = of.Vec2f(1,0) this.acc = of.Vec2f(0,0) this.mass = _m end ) function Mover:applyForce(force) f = of.Vec2f() f = force / self.mass self.acc = self.acc + f end function Mover:update() self.vel = self.vel + self.acc self.loc = self.loc + self.vel self.acc = self.acc * 0 end function Mover:draw() of.setColor(40,40,255) of.noFill() of.setLineWidth(2) of.drawCircle(self.loc.x,self.loc.y,self.mass*2) of.setColor(32, 0, 255,100) of.fill() of.drawCircle(self.loc.x,self.loc.y,self.mass*2) end function Mover:repel(mover) force = of.Vec2f() force = self.loc - mover.loc distance = force:length() distance = of.clamp(distance,1.0,10000.0) force = force:normalize() strenght = (g*self.mass*mover.mass) / (distance * distance) force = force * (1-strenght) return force end function Mover:checkEdges() if self.loc.x > OUTPUT_WIDTH then self.loc.x = OUTPUT_WIDTH self.vel.x = self.vel.x * -0.9 elseif self.loc.x < 0 then self.vel.x = -self.vel.x * 0.9 self.loc.x = 0 end if self.loc.y > OUTPUT_HEIGHT then self.vel.y = self.vel.y * -0.9 self.loc.y = OUTPUT_HEIGHT elseif self.loc.y < 0 then self.loc.y = 0 self.vel.y = self.vel.y * -0.9 end end --------------------------------------------------- ------- end class Mover
function start(this_id) id = this_id is_bisou = get_entity_name(id) == "bisou" end function get_should_auto_attack() local name = get_entity_name(id) local melee_attack_name if (name == "egbert") then melee_attack_name = "SLASH" elseif (name == "frogbert") then melee_attack_name = "KICK" else melee_attack_name = "ROLL" end local have_basic_attack = not (player_ability_button(id, "ATTACK") == nil) if (player_ability_button(id, melee_attack_name) == nil and (not have_basic_attack) and (not (name == "egbert" and player_ability_button(id, "THROW")))) then return false end local min, max local name = get_entity_name(id) if (name == "egbert") then local have_throw = not (player_ability_button(id, "THROW") == nil) local have_slash = not (player_ability_button(id, "SLASH") == nil) if (have_throw and (not have_slash or rand(5) == 0)) then min = 0 max = 1 melee_name = "THROW" melee_type = ABILITY_THROW else min = 1 max = 2 melee_name = "SLASH" melee_type = ABILITY_SLASH end elseif (name == "frogbert") then min = 4 max = 5 melee_name = "KICK" melee_type = ABILITY_KICK else min = 7 max = 9 melee_name = "ROLL" melee_type = ABILITY_ROLL end local mod = get_time() % 10 if (not have_basic_attack) then min = 0 if (is_bisou) then max = 7.5 else max = 5.0 end end if (not (player_ability_button(id, melee_name) == nil) and mod >= min and mod <= max) then melee_ability_in_use = true else melee_ability_in_use = false end return true end local MAX_Y_DIST = 12 function decide() local do_long_range local name = get_entity_name(id) local do_burrow = false local do_heal = -1 if (is_bisou) then if (get_player_weapon_name("bisou") == "") then do_long_range = false else local t = get_time() % 10 if (t >= 8.0 and t <= 9.0 and rand(5) == 0 and get_mp(id) >= get_ability_cost(id, "BURROW")) then do_long_range = false do_burrow = true elseif (t >= 9.0 and t <= 10.0 and rand(5) == 0 and get_mp(id) >= get_ability_cost(id, "HEAL")) then do_long_range = true local n = get_num_players() for i=0,n do local _id = get_player_id(i) local hp = get_hp(_id) if (hp < 10) then do_long_range = false do_heal = _id break end end else do_long_range = not (player_ability_button(id, "ATTACK") == nil) end end else local min, max if (name == "egbert") then min = 5 max = 7 long_range_name = "ICE" long_range_type = ABILITY_ICE else min = 7 max = 9 long_range_name = "FIRE" long_range_type = ABILITY_FIRE end local mod = get_time() % 10 if (not (player_ability_button(id, long_range_name) == nil) and mod >= min and mod <= max) then long_range_ability_in_use = true do_long_range = true else long_range_ability_in_use = false do_long_range = false end end if (do_long_range) then local enemy_id = ai_get(id, "nearest_enemy") if (enemy_id == nil) then return "rest " .. (LOGIC_MILLIS/1000) .. " nostop" end local x, y, px, py = ai_get(id, "entity_positions_by_id " .. id .. " " .. enemy_id) local ydiff = y - py if (math.abs(ydiff) > MAX_Y_DIST or get_hp(enemy_id) <= 0) then return "rest " .. (LOGIC_MILLIS/1000) .. " nostop" end if (x < px) then right = true else right = false end set_entity_right(id, right) return "attack nostop rest 0.3 nostop" else if (is_bisou) then if (do_burrow and not (player_ability_button(id, "BURROW") == nil)) then return "do_ability " .. ABILITY_BURROW elseif (not (do_heal == -1) and not (player_ability_button(id, "HEAL") == nil)) then return "heal " .. do_heal end elseif (name == "frogbert") then local t = get_time() % 10 if (t >= 5 and t <= 6 and rand(2) == 0 and get_mp(id) >= get_ability_cost(id, "PLANT") and not (player_ability_button(id, "PLANT") == nil)) then return "do_ability " .. ABILITY_PLANT end end local r = (rand(1000)/1000) * 0.5 return "seek A_ENEMY nostop rest " .. (r+0.5) .. " nostop" end end function get_melee_distance() if (melee_ability_in_use) then if (melee_type == ABILITY_THROW) then return 150 else return 75 end else return nil end end function get_attack_type() if (melee_ability_in_use and get_mp(id) >= get_ability_cost(id, melee_name)) then return melee_type elseif (long_range_ability_in_use and get_mp(id) >= get_ability_cost(id, long_range_name)) then return long_range_type end return ABILITY_ATTACK end function got_hit(hitter) if (get_entity_name(hitter) == "antboss") then call_on_battle_script("launch_player") end end
-- id int 阵营ID -- camp_relations tableString[k:#seq|v:#1(int)] 和阵营1关系(玩家) return { [1] = { id = 1, camp_relations = { [1] = 2, [2] = 1, [3] = 0, }, }, [2] = { id = 2, camp_relations = { [1] = 1, [2] = 2, [3] = 0, }, }, [3] = { id = 3, camp_relations = { [1] = 0, [2] = 0, [3] = 2, }, }, }
local MaintenancePolicy = require('apicast.policy.maintenance_mode') describe('Maintenance mode policy', function() describe('.rewrite', function() before_each(function() stub(ngx, 'say') stub(ngx, 'exit') ngx.header = {} end) context('when using the defaults', function() local maintenance_policy = MaintenancePolicy.new() it('returns 503', function() maintenance_policy:rewrite() assert.stub(ngx.exit).was_called_with(503) end) it('returns the default message', function() maintenance_policy:rewrite() assert.stub(ngx.say).was_called_with('Service Unavailable - Maintenance') end) it('returns the default Content-Type header', function() maintenance_policy:rewrite() assert.equals('text/plain; charset=utf-8', ngx.header['Content-Type']) end) end) context('when using a custom status code', function() it('returns that status code', function() local custom_code = 555 local maintenance_policy = MaintenancePolicy.new( { status = custom_code } ) maintenance_policy:rewrite() assert.stub(ngx.exit).was_called_with(custom_code) end) end) context('when using a custom message', function() it('returns that message', function() local custom_msg = 'Some custom message' local maintenance_policy = MaintenancePolicy.new( { message = custom_msg } ) maintenance_policy:rewrite() assert.stub(ngx.say).was_called_with(custom_msg) end) end) context('when using a custom content type', function() it('sets the Content-Type header accordingly', function() local custom_content_type = 'application/json' local maintenance_policy = MaintenancePolicy.new( { message = '{ "msg": "some_msg" }', message_content_type = custom_content_type } ) maintenance_policy:rewrite() assert.equals('application/json', ngx.header['Content-Type']) end) end) end) end)
Locales['br'] = { ['robbery_cancelled'] = 'O roubo será cancelado, você não ganhará nada!', ['robbery_successful'] = 'O roubo foi um sucesso. Você ganhou ~g~$', ['shop_robbery'] = 'Loja roubavel', ['press_to_rob'] = 'Pressione ~INPUT_CONTEXT~ para roubar ~b~', ['robbery_of'] = 'Loja roubavel: ~r~', ['seconds_remaining'] = '~w~ segundos restantes', ['robbery_cancelled_at'] = '~r~ Roubo cancelado em: ~b~', ['robbery_has_cancelled'] = '~r~ O assalto foi cancelado: ~b~', ['already_robbed'] = 'Esta loja já foi roubada. Por favor, espere: ', ['seconds'] = 'segundos.', ['rob_in_prog'] = '~r~ Assalto em curso em: ~b~', ['started_to_rob'] = 'Você começou a roubar ', ['do_not_move'] = ', Não se afaste!', ['alarm_triggered'] = 'O alarme foi disparado', ['hold_pos'] = 'Segure por 5 minutos e o dinheiro é seu!', ['robbery_complete'] = '~r~ Roubo completo.~s~ ~h~ Corre!', ['robbery_complete_at'] = '~r~ Roubo completo em: ~b~', ['min_two_police'] = 'Deve haver pelo menos ~b~2 policiais~s~ na cidade para roubar.', ['robbery_already'] = '~r~Um assalto já está em andamento.', }
--- Provides utilities for working with Roblox's streaming system -- @module StreamingUtils -- @author Quenty local require = require(script.Parent.loader).load(script) local Promise = require("Promise") local StreamingUtils = {} function StreamingUtils.promiseStreamAround(player, position, timeOut) assert(typeof(player) == "Instance", "Bad player") assert(typeof(position) == "Vector3", "Bad position") assert(type(timeOut) == "number" or timeOut == nil, "Bad timeOut") return Promise.spawn(function(resolve, reject) local ok, err = pcall(function() player:RequestStreamAroundAsync(position, timeOut) end) if not ok then return reject(err) end return resolve() end) end return StreamingUtils
tcg13 = { minimumLevel = 0, maximumLevel = -1, customObjectName = "Dooku Bust ", directObjectTemplate = "object/tangible/tcg/series1/decorative_dooku_bust.iff", craftingValues = { }, customizationStringNames = {}, customizationValues = {} } addLootItemTemplate("tcg13", tcg13)
workspace "chappy" architecture "x64" configurations { "Debug", "Release", "Dist" } outdir = "%{cfg.buildcfg}-%{cfg.system}-${cfg.architecture}" project "chappy" location "chappy" kind "SharedLib" language "C++" targetdir ("bin/" .. outdir .. "/%{prj.name}") objdir ("bin-obj/" .. outdir .. "/%{prj.name}") files { "%{prj.name}/src/**.hpp", "%{prj.name}/src/**.cpp", "%{prj.name}/include/Chappy.h" } includedirs { "chappy/src/modules/spdlog" } filter "system:windows" cppdialect "C++17" systemversion "latest" staticruntime "On" defines { "CP_WINDOWS", "CHAPPY" } postbuildcommands { ("{COPY} %{cfg.buildtarget.relpath} ../bin/" .. outdir .. "/Tests") } filter "configurations:Debug" defines "CP_DEBUG" symbols "On" filter "configurations:Release" defines "CP_DEBUG" optimize "On" filter "configurations:Dist" defines "CP_DIST" optimize "On" project "Tests" location "tests" kind "ConsoleApp" language "C++" targetdir ("bin/" .. outdir .. "/%{prj.name}") objdir ("bin-obj/" .. outdir .. "/%{prj.name}") files { "%{prj.name}/src/**.h", "%{prj.name}/src/**.cpp" } includedirs { "chappy/include", "chappy/src/modules/spdlog" } links { "chappy" } filter "system:windows" cppdialect "C++17" systemversion "latest" staticruntime "On" defines { "CP_WINDOWS" } filter "configurations:Debug" defines "CP_DEBUG" symbols "On" filter "configurations:Debug" defines "CP_DEBUG" symbols "On" filter "configurations:Dist" defines "CP_DIST" symbols "On"
---@class CS.FairyEditor.FObjectFlags ---@field public IN_DOC number ---@field public IN_TEST number ---@field public IN_PREVIEW number ---@field public INSPECTING number ---@field public ROOT number ---@type CS.FairyEditor.FObjectFlags CS.FairyEditor.FObjectFlags = { } ---@return CS.FairyEditor.FObjectFlags function CS.FairyEditor.FObjectFlags.New() end ---@return boolean ---@param flags number function CS.FairyEditor.FObjectFlags.IsDocRoot(flags) end ---@return number ---@param flags number function CS.FairyEditor.FObjectFlags.GetScaleLevel(flags) end return CS.FairyEditor.FObjectFlags
function trunc(x) return x>=0 and math.floor(x) or math.ceil(x) end --[[ (a + b * 10 + c * 100) * (d + e * 10 + f * 100) = a * d + a * e * 10 + a * f * 100 + 10 * (b * d + b * e * 10 + b * f * 100)+ 100 * (c * d + c * e * 10 + c * f * 100) = a * d + a * e * 10 + a * f * 100 + b * d * 10 + b * e * 100 + b * f * 1000 + c * d * 100 + c * e * 1000 + c * f * 10000 = a * d + 10 * ( a * e + b * d) + 100 * (a * f + b * e + c * d) + (c * e + b * f) * 1000 + c * f * 10000 --]] function chiffre (c, m) if c == 0 then return math.fmod(m, 10) else return chiffre(c - 1, trunc(m / 10)) end end local m = 1 for a = 0, 9 do for f = 1, 9 do for d = 0, 9 do for c = 1, 9 do for b = 0, 9 do for e = 0, 9 do local mul = a * d + 10 * (a * e + b * d) + 100 * (a * f + b * e + c * d) + 1000 * (c * e + b * f) + 10000 * c * f if chiffre(0, mul) == chiffre(5, mul) and chiffre(1, mul) == chiffre(4, mul) and chiffre(2, mul) == chiffre(3, mul) then m = math.max(mul, m) end end end end end end end io.write(string.format("%d\n", m))
local spring_path_0 = DoorSlot("spring_path","0") local spring_path_0_hub = DoorSlotHub("spring_path","0",spring_path_0) spring_path_0:setHubIcon(spring_path_0_hub)
object_tangible_smuggler_finely_crafted_toolset = object_tangible_smuggler_shared_finely_crafted_toolset:new { } ObjectTemplates:addTemplate(object_tangible_smuggler_finely_crafted_toolset, "object/tangible/smuggler/finely_crafted_toolset.iff")
AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") AddCSLuaFile("remap.lua") include('shared.lua') include('remap.lua') ENT.WireDebugName = "Wired Keyboard" local All_Enums = {} -- table containing key -> key enum conversion -- Add a few common keys for i = 48, 57 do -- 0 -> 9 All_Enums[i] = _G["KEY_" .. string.char(i)] end for i = 65, 90 do -- A -> Z All_Enums[i] = _G["KEY_" .. string.upper(string.char(i))] end for i = 97, 122 do -- a -> z All_Enums[i] = _G["KEY_" .. string.upper(string.char(i))] end function ENT:Initialize() self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self:SetUseType(SIMPLE_USE) self.Inputs = WireLib.CreateInputs(self, { "Kick", "Reset Output String" }) self.Outputs = WireLib.CreateOutputs(self, { "Memory", "Output [STRING]", "ActiveKeys [ARRAY]", "User [ENTITY]", "InUse" }) self.ActiveKeys = {} -- table containing all currently active keys, used to see when keys are pressed/released self.Buffer = {} -- array containing all currently active keys, value is ascii self.BufferLookup = {} -- lookup table mapping enums to buffer positions self.Buffer[0] = 0 self.OutputString = "" self:TriggerOutputs() end WireLib.AddInputAlias("Kick the bastard out of keyboard", "Kick") function ENT:TriggerInput(name, value) if name == "Kick" then -- It was kicking at the same time as giving output - added tiny delay fixing that race condition timer.Simple(0.1, function() if IsValid(self) then self.Locked = (value ~= 0) self:PlayerDetach() end end) elseif name == "Reset Output String" then self.OutputString = "" self:TriggerOutputs() end end function ENT:TriggerOutputs(key) -- Output key numerical representation if key ~= nil then WireLib.TriggerOutput(self, "Memory", key) end -- Output user if IsValid( self.ply ) then WireLib.TriggerOutput(self, "User", self.ply) WireLib.TriggerOutput(self, "InUse", 1) self:SetOverlayText("In use by " .. self.ply:Nick()) else WireLib.TriggerOutput(self, "User", nil) WireLib.TriggerOutput(self, "InUse", 0) self:SetOverlayText("Not in use") end -- Output currently pressed keys local ActiveKeys_Output, idx = {}, 0 for key_enum,_ in pairs( self.ActiveKeys ) do idx = idx + 1 ActiveKeys_Output[idx] = self:GetRemappedKey(key_enum) end WireLib.TriggerOutput(self, "ActiveKeys", ActiveKeys_Output) -- Output buffer string WireLib.TriggerOutput(self, "Output", self.OutputString) end function ENT:ReadCell(Address) if Address >= 0 and Address < 32 then return self.Buffer[Address] or 0 elseif Address >= 32 and Address < 256 then return self:IsPressedAscii(Address - 32) and 1 or 0 end return 0 end function ENT:WriteCell(Address, value) if Address == 0 then self:UnshiftBuffer() -- User wants to remove the first key in the buffer else self:RemoveFromBufferByKey(value) end return false end util.AddNetworkString("wire_keyboard_blockinput") util.AddNetworkString("wire_keyboard_activatemessage") function ENT:PlayerAttach(ply) if not IsValid(ply) or IsValid(self.ply) then return end -- If the keyboard is already in use, don't attach the player if IsValid(ply.WireKeyboard) then -- If the player is already using a different keyboard if ply.WireKeyboard == self then return end -- If the keyboard is this keyboard, don't re-attach the player ply.WireKeyboard:PlayerDetach() -- If it's another keyboard, detach the player from that keyboard first end -- If the keyboard is locked (Kick input is wired to something other than 0), don't attach the player if self.Locked then return end -- Store player self.ply = ply -- Block keyboard input if self.Synchronous then net.Start("wire_keyboard_blockinput") net.WriteBit(true) net.Send(ply) end net.Start("wire_keyboard_activatemessage") net.WriteBit(true) net.WriteBit(IsValid(self.Pod)) net.Send(ply) -- Set the wire keyboard value on the player ply.WireKeyboard = self -- Ignore the first key (the "Use" key - default "e" - pressed when entering the keyboard) self.IgnoreFirstKey = true -- Reset tables self.BufferLookup = {} self.ActiveKeys = {} self.Buffer = {} self.Buffer[0] = 0 self:TriggerOutputs() end function ENT:PlayerDetach() local ply = self.ply self.ply = nil -- Kick player out of vehicle, if in one if IsValid(self.Pod) and IsValid(self.Pod:GetDriver()) and self.Pod:GetDriver() == ply then self.Pod:GetDriver():ExitVehicle() end if IsValid(ply) then net.Start("wire_keyboard_blockinput") net.WriteBit(false) net.Send(ply) net.Start("wire_keyboard_activatemessage") net.WriteBit(false) net.Send(ply) ply.WireKeyboard = nil end self:TriggerOutputs() end function ENT:Use(ply) if IsValid(self.Pod) then ply:ChatPrint("This keyboard is linked to a pod. Please use the pod instead.") return end self:PlayerAttach(ply) end function ENT:OnRemove() self:UnlinkEnt() self:PlayerDetach() self.BaseClass.OnRemove(self) end function ENT:LinkEnt(pod) if not IsValid(pod) or not pod:IsVehicle() then return false, "Must link to a vehicle" end if IsValid(self.Pod) then self.Pod.WireKeyboard = nil end pod.WireKeyboard = self self.Pod = pod WireLib.SendMarks(self, {pod}) return true end function ENT:UnlinkEnt() if IsValid(self.Pod) then self.Pod.WireKeyboard = nil end self.Pod = nil WireLib.SendMarks(self, {}) return true end hook.Add("PlayerEnteredVehicle", "Wire_Keyboard_PlayerEnteredVehicle", function(ply, pod) if IsValid(pod.WireKeyboard) then pod.WireKeyboard:PlayerAttach(ply) end end) hook.Add("PlayerLeaveVehicle", "wire_keyboard_PlayerLeaveVehicle", function(ply, pod) if IsValid(pod.WireKeyboard) and pod.WireKeyboard.ply == ply then pod.WireKeyboard:PlayerDetach() end end) local unprintable_chars = {} for i=17,20 do unprintable_chars[i] = true end -- arrow keys for i=144,177 do unprintable_chars[i] = true end -- ctrl, alt, shift, break, F1-F12, scroll/num/caps lock, and more local convertable_chars = { [128] = 49, -- numpad 1 [129] = 50, -- numpad 2 [130] = 51, -- numpad 3 [131] = 52, -- numpad 4 [132] = 53, -- numpad 5 [133] = 54, -- numpad 6 [134] = 55, -- numpad 7 [135] = 56, -- numpad 8 [136] = 57, -- numpad 9 [137] = 58, -- numpad 4 [138] = 47, -- / [139] = 42, -- * [140] = 45, -- - [141] = 43, -- + [142] = 10, -- \n [143] = 46, -- . } function ENT:AppendOutputString(key) if unprintable_chars[key] and not convertable_chars[key] then return end if convertable_chars[key] then key = convertable_chars[key] end if key == 127 then local pos = string.match(self.OutputString,"()"..utf8.charpattern.."$") if pos then self.OutputString = string.sub(self.OutputString,1,pos-1) end else self.OutputString = self.OutputString .. utf8.char(key) end self:TriggerOutputs() end --local Wire_Keyboard_Remap = Wire_Keyboard_Remap -- Defined in remap.lua function ENT:GetRemappedKey(key_enum) if not key_enum or key_enum == 0 or key_enum > KEY_LAST then return 0 end -- Above KEY_LAST are joystick and mouse enums local layout = "American" if IsValid(self.ply) then layout = self.ply:GetInfo("wire_keyboard_layout", "American") end local current = Wire_Keyboard_Remap[layout] if not current then return 0 end local ret = current.normal[key_enum] -- Check if a special key is being held down (such as SHIFT) for k,v in pairs(self.ActiveKeys) do if v == true and current[k] and current[k][key_enum] then ret = current[k][key_enum] end end if isstring(ret) then ret = utf8.codepoint(ret) end return ret end function ENT:KeyPressed(key_enum) local key = self:GetRemappedKey(key_enum) if key == nil or key == 0 then return end if not All_Enums[key] then All_Enums[key] = key_enum end self.ActiveKeys[key_enum] = true self:PushBuffer(key, key_enum) self:AppendOutputString(key) self:TriggerOutputs(key) end function ENT:KeyReleased(key_enum) local key = self:GetRemappedKey(key_enum) if key == nil or key == 0 then return end self.ActiveKeys[key_enum] = nil if self.AutoBuffer then self:RemoveFromBufferByKey(key) end self:TriggerOutputs(0) end function ENT:IsPressedEnum(key_enum) return self.ActiveKeys[key_enum] end function ENT:IsPressedAscii(key) local key_enum = All_Enums[key] if not key_enum then return false end return self:IsPressedEnum(key_enum) end function ENT:UnshiftBuffer() self:RemoveFromBufferByPosition(1) end function ENT:PushBuffer(key, key_enum) self.Buffer[0] = self.Buffer[0] + 1 self.Buffer[self.Buffer[0]] = key if not self.BufferLookup[key_enum] then self.BufferLookup[key_enum] = {} end local positions = self.BufferLookup[key_enum] positions[#positions+1] = self.Buffer[0] end function ENT:RemoveFromBufferByPosition(bufferpos) if self.Buffer[0] <= 0 then return end local key = table.remove(self.Buffer, bufferpos) self.Buffer[0] = self.Buffer[0] - 1 -- Move all remaining keys down one step for key_enum,positions in pairs(self.BufferLookup) do for k,pos in pairs(positions) do if bufferpos < pos then positions[k] = positions[k] - 1 end end end end function ENT:RemoveFromBufferByKey(key) local key_enum = All_Enums[key] if not key_enum then return false end -- key is invalid local positions = self.BufferLookup[key_enum] if not positions then return false end -- error, shouldn't happen local bufferpos = table.remove(positions, 1) if not bufferpos then return false end -- error, shouldn't happen self:RemoveFromBufferByPosition(bufferpos) end function ENT:Think() if not IsValid(self.ply) then self:NextThink(CurTime() + 0.3) -- Don't need to update as often return true end if self.IgnoreFirstKey then -- Don't start listening to keys until Use is released if not self.ply.keystate[KEY_E] then self.IgnoreFirstKey = nil end self:NextThink(CurTime()) return true end local leavekey = self.ply:GetInfoNum("wire_keyboard_leavekey", KEY_LALT) -- Remove lifted up keys from our ActiveKeys for key_enum, bool in pairs(self.ActiveKeys) do if not self.ply.keystate[key_enum] then self:KeyReleased(key_enum) end end -- Check for newly pressed keys and add them to our ActiveKeys for key_enum, bool in pairs(self.ply.keystate) do if key_enum == leavekey then if leavekey ~= KEY_ALT or not self:IsPressedEnum(KEY_LCONTROL) then -- if LCONTROL and LALT are being pressed, then the player is trying to use the "ALT GR" key which is available for some languages self:PlayerDetach() -- Pressing the leave key quits the keyboard break end end if not self:IsPressedEnum(key_enum) then self:KeyPressed(key_enum) end end self:NextThink(CurTime()) return true end function ENT:Setup(autobuffer, sync) self.AutoBuffer = autobuffer self.Synchronous = sync end duplicator.RegisterEntityClass("gmod_wire_keyboard", WireLib.MakeWireEnt, "Data", "AutoBuffer", "Synchronous") function ENT:BuildDupeInfo() local info = self.BaseClass.BuildDupeInfo(self) or {} if IsValid(self.Pod) then info.pod = self.Pod:EntIndex() end return info end function ENT:ApplyDupeInfo(ply, ent, info, GetEntByID) self.BaseClass.ApplyDupeInfo(self, ply, ent, info, GetEntByID) self:LinkEnt(GetEntByID(info.pod), true) if info.autobuffer then self.AutoBuffer = info.autobuffer end end
--- Define an object Feature. --- @class Feature Feature = {} Feature.__index = Feature local log = dofile("Log.lua") --- The constructor of the object Feature --- @param i string The MIB of the current Feature --- @param p function The post-condition necessary to checking --- @return Feature The new Feature just created or nil in case of any issues function Feature:new(i, p) if type(i) == "string" and type(p) == "function" then return setmetatable({id = i, post = p}, Feature) else return nil end end local function check_param(mib, param, udp_feature) if (param == nil) then udp_feature:send('mib = "' .. mib .. '"') else udp_feature:send('mib, param = "' .. mib .. '", ' .. param .. '') end end local function check_result(param, current_ip, data_func) if (param == nil) then return load(data_func)()(current_ip) elseif (param == nil and current_ip == nil) then return tonumber(data_func) else return load(data_func)()(param, current_ip) end end --- A stub that searches, verifies, executes and produces the results related to a remote service --- @vararg any The parameters that are called are a regular expression and the parameters on which to perform the operation --- @return table, boolean Produces a boolean indicating whether the operation is successful and a table with the values ​​produced by the requested service function Feature:call(...) if self.id == "*" then return Share:mobile_app() end local set_services = Share:discovery(self.id) if Utilities:get_table_size(set_services) == 0 then log.fatal("[NO SERVICES MATCHED WITH THE SAME MIB]") return "nil" end log.trace("[" .. Utilities:get_table_size(set_services) .. " DEVICE FOUND]") Utilities:print_table(set_services) for current_ip, services in pairs(set_services) do for _, mib in pairs(services) do local socket = require("socket") local udp_feature = socket.udp() udp_feature:settimeout(4) udp_feature:setpeername(current_ip, 8888) check_param(mib, ..., udp_feature) local data_func = udp_feature:receive() if not (data_func:find("return")) then log.info("[A REPLY FROM MOBILE APP!]") log.info("[MSG REDCEIVED: " .. data_func .. "] [FROM: " ..current_ip .. "]") return data_func end print("RICEVO DATA_FUNC "..data_func) if not (data_func == "nil") then log.info("[PRE-CONDITION SUCCESSFUL]") local res = check_result(..., current_ip, data_func) print("RES "..res) if (res and self.post(..., res)) then log.info("[POST-CONDITION SUCCESSFUL]") log.info("[MSG REDCEIVED: " .. res .. "] [FROM: " .. current_ip .. "]") return res else log.fatal("[POST-CONDITION NOT OVERCOME]") end else log.fatal("[PRE-CONDITION NOT SUCCESSFUL]") end end end log.fatal("[NO SERVICES FOUND]") return "nil" end
-- Add a new entity, item, and recipe into the game, -- such that we set a recipe from the circuit network. local assembler_commandor_e = { type = "inserter", -- We use an inserter such that we can find the position of the assembling machine. name = "assembler-commandor", icon = "__base__/graphics/icons/stack-filter-inserter.png", flags = {"placeable-neutral", "placeable-player", "player-creation"}, minable = {hardness = 0.2, mining_time = 0.5, result = "assembler-commandor"}, max_health = 40, corpse = "small-remnants", resistances = { { type = "fire", percent = 90 } }, vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 }, working_sound = { match_progress_to_activity = true, sound = { { filename = "__base__/sound/inserter-fast-1.ogg", volume = 0.75 }, { filename = "__base__/sound/inserter-fast-2.ogg", volume = 0.75 }, { filename = "__base__/sound/inserter-fast-3.ogg", volume = 0.75 }, { filename = "__base__/sound/inserter-fast-4.ogg", volume = 0.75 }, { filename = "__base__/sound/inserter-fast-5.ogg", volume = 0.75 } } }, collision_box = {{-0.15, -0.15}, {0.15, 0.15}}, selection_box = {{-0.4, -0.35}, {0.4, 0.45}}, pickup_position = {-1, -1}, insert_position = {-1.2, -1.2}, -- pick-up at the same location energy_per_movement = 8000, energy_per_rotation = 8000, energy_source = { type = "electric", usage_priority = "secondary-input", drain = "1kW" }, extension_speed = 0.07, rotation_speed = 0.04, filter_count = 1, hand_base_picture = { filename = "__base__/graphics/entity/stack-filter-inserter/stack-filter-inserter-hand-base.png", priority = "extra-high", width = 8, height = 34 }, hand_closed_picture = { filename = "__base__/graphics/entity/stack-filter-inserter/stack-filter-inserter-hand-closed.png", priority = "extra-high", width = 24, height = 41 }, hand_open_picture = { filename = "__base__/graphics/entity/stack-filter-inserter/stack-filter-inserter-hand-open.png", priority = "extra-high", width = 32, height = 41 }, hand_base_shadow = { filename = "__base__/graphics/entity/burner-inserter/burner-inserter-hand-base-shadow.png", priority = "extra-high", width = 8, height = 34 }, hand_closed_shadow = { filename = "__base__/graphics/entity/burner-inserter/burner-inserter-hand-closed-shadow.png", priority = "extra-high", width = 18, height = 41 }, hand_open_shadow = { filename = "__base__/graphics/entity/burner-inserter/burner-inserter-hand-open-shadow.png", priority = "extra-high", width = 18, height = 41 }, platform_picture = { sheet = { filename = "__base__/graphics/entity/stack-filter-inserter/stack-filter-inserter-platform.png", priority = "extra-high", width = 46, height = 46, shift = {0.09375, 0} } }, circuit_wire_connection_point = inserter_circuit_wire_connection_point, circuit_connector_sprites = inserter_circuit_connector_sprites, circuit_wire_max_distance = inserter_circuit_wire_max_distance } local assembler_commandor_r = { type = "recipe", name = "assembler-commandor", enabled = true, ingredients = { {"copper-cable", 5}, {"electronic-circuit", 2}, }, result = "assembler-commandor" } local assembler_commandor_i = { type = "item", name = "assembler-commandor", icon = "__base__/graphics/icons/stack-filter-inserter.png", flags = { "goes-to-quickbar" }, subgroup = "circuit-network", place_result = "assembler-commandor", order = "b[combinators]-a[assembler-commandor]", stack_size= 50, } data:extend({ assembler_commandor_e, assembler_commandor_r, assembler_commandor_i }) table.insert( data.raw["technology"]["circuit-network"].effects, { type = "unlock-recipe", recipe = "assembler-commandor" } )
local types = require 'lulz.types' local class = require 'lulz.types.class' local I = require 'lulz.types.interfaces' local generator = require 'lulz.generator' local str = require 'lulz.str' local stack = class { __name__ = 'stack', __init__ = function(self) rawset(self, '_values', {}) end, __tostring = function(self) return 'stack { ' .. str.join(', ', self._values) .. ' }' end, empty = function(self) return self:count() == 0 end; count = function(self) return #self._values end, __len = function(self) return #self._values end, __get = function() error('Stack get is disabled. Use pop instead.') end, __set = function() error('Stack set is disabled. Use push instead.') end, } stack.__class_call__ = stack.new --[[ Utils ]] local function _stack_data(tbl) if types.isinstance(tbl, stack) then return tbl._values end return tbl end function stack.is_empty(tbl) return next(_stack_data(tbl)) == nil end --[[ Iterators ]] local _stack_iter = generator { gen = function(self, q) while not stack.is_empty(q) do self:yield(stack.pop(q)) end end } I.iterable:impl(stack, { iter = function(tbl) return _stack_iter(_stack_data(tbl)) end }) --[[ Modifiers ]] function stack.push(tbl, value) table.insert(_stack_data(tbl), value) end function stack.pop(tbl) return table.remove(_stack_data(tbl)) end function stack.top(tbl) tbl = _stack_data(tbl) return tbl[#tbl] end return stack
local playsession = { {"Gerkiz", {627450}}, {"Ardordo", {712179}}, {"mewmew", {266752}}, {"alexbw", {710492}}, {"Sigor", {355213}}, {"Zorzzz", {679678}}, {"okan009", {674937}}, {"jobaxter", {588003}}, {"everLord", {571398}}, {"xelaf", {399723}}, {"realDonaldTrump", {535508}}, {"Nikkichu", {411829}}, {"Soeil", {189884}}, {"hmsdexter", {33315}}, {"TkB", {28146}}, {"BINDIN", {8668}}, {"Piewdennis", {30831}}, {"Mullacs", {413029}}, {"raskl", {2727}}, {"Cheeseftw", {102212}}, {"Lithidoria", {22576}}, {"mars_precision", {1985}}, {"perrykain", {3254}}, {"hasannuh", {206472}}, {"XjCyan1de", {19358}}, {"floxys", {65224}}, {"Garsaf", {5895}}, {"Olekplane1", {128978}}, {"Danzou", {32279}}, {"StarP0wer", {50573}}, {"redlabel", {11112}}, {"ZwerOxotnik", {182686}}, {"Morgan3rd", {259626}}, {"Greifenstein", {53324}}, {"vad7ik", {214150}}, {"BACONOCAB", {107561}}, {"ijsmetgijs", {5329}}, {"JorWho", {13422}}, {"Eriksonn", {168566}}, {"V4B1", {44586}}, {"Forty-Bot", {126138}}, {"snoetje", {142056}}, {"CheekyHerbert", {4472}}, {"dzentak", {136729}}, {"untouchablez", {26123}} } return playsession
local what local function mm(a, b) local dbg = debug.getinfo(1) what = dbg.namewhat == "metamethod" and dbg.name or dbg.namewhat.." "..(dbg.name or "?") end local function ck(s) assert(what == s, "bad debug info for metamethod "..s) end local mt = { __index = mm, __newindex = mm, __eq = mm, __add = mm, __sub = mm, __mul = mm, __div = mm, __mod = mm, __pow = mm, __unm = mm, __len = mm, __lt = mm, __le = mm, __concat = mm, __call = mm, } local t = setmetatable({}, mt) local t2 = setmetatable({}, mt) local x = t.x; ck("__index") t.x = 1; ck("__newindex") local x = t + t; ck("__add") local x = t - t; ck("__sub") local x = t * t; ck("__mul") local x = t / t; ck("__div") local x = t % t; ck("__mod") local x = t ^ t; ck("__pow") local x = -t; ck("__unm") --local x = #t; ck("__len") -- Not called for tables local x = t..t; ck("__concat") local x = t(); ck("local t") local x = t == t2; ck("__eq") local x = t ~= t2; ck("__eq") local x = t < t2; ck("__lt") local x = t > t2; ck("__lt") local x = t <= t2; ck("__le") local x = t >= t2; ck("__le") local u = newproxy() local u2 = newproxy() debug.setmetatable(u, mt) debug.setmetatable(u2, mt) local x = u.x; ck("__index") u.x = 1; ck("__newindex") local x = u + u; ck("__add") local x = u - u; ck("__sub") local x = u * u; ck("__mul") local x = u / u; ck("__div") local x = u % u; ck("__mod") local x = u ^ u; ck("__pow") local x = -u; ck("__unm") local x = #u; ck("__len") local x = u..u; ck("__concat") local x = u(); ck("local u") local x = u == u2; ck("__eq") local x = u ~= u2; ck("__eq") local x = u < u2; ck("__lt") local x = u > u2; ck("__lt") local x = u <= u2; ck("__le") local x = u >= u2; ck("__le")
local foxtree = {} local function GetNextLevel(t) local myarray = {} for k,v in ipairs(t.child) do table.insert(myarray, v) -- print("Possisble action/priority: " .. v.goal, v.priority()) end return myarray end function foxtree.DetermineAction(t, bot) -- returns an enum.goal (integer) based on rndnum and the BT local nextlevel = {} nextlevel = GetNextLevel(t) -- gets all the children below the current 'level' -- cycle through all nodes, check if the node is active, and if it is, 'sum' it's priority for later use local totalchance = 0 for k,v in ipairs(nextlevel) do -- cycle through all the nodes in nextlevel - which is really the children of the previous parents -- print("g: " .. v.goal) if v.activate == nil then totalchance = totalchance + v.priority(bot) else -- activate is not nil (but could be false) if v.activate(bot) == true then totalchance = totalchance + v.priority(bot) else -- node is deactivated so don't consider it's priority end end end -- the sum of all priorities is now determined. "Roll the dice" and see which node is actually selected. local rndnum = love.math.random(1, totalchance) -- print("random action: " .. rndnum .. " from a total priority count of " .. totalchance) for k,node in ipairs(nextlevel) do if node.activate == nil or node.activate(bot) == true then -- skips over nodes that are not active if rndnum <= node.priority(bot) then if node.child == nil then -- print("Returning goal: " .. node.goal .. " for agent " .. bot.uid.value) -- for debugging. Comment out if not needed return node.goal else return foxtree.DetermineAction(node, bot) -- node is a node but it is known it has child nodes so recursively repeat the process for them end else rndnum = rndnum - node.priority(bot) end end end end return foxtree
--- Command definitions. -- @module invokation.const.commands local M = {} --- Command definition. -- @table CommandDefinition -- @tfield string name Command name -- @tfield string method `GameMode` method name -- @tfield string help Command help -- @tfield int flags Command flags -- @tfield bool dev Only registered in development environment table.insert(M, { name = "inv_debug", method = "CommandSetDebug", help = "Set debugging (empty - print debug status, 0 - disabled, 1 - enabled)", flags = FCVAR_CHEAT, dev = false, }) table.insert(M, { name = "inv_debug_misc", method = "CommandDebugMisc", help = "Run miscellaneous debug code (use script_reload to reload)", flags = FCVAR_CHEAT, dev = true, }) table.insert(M, { name = "inv_dump_lua_version", method = "CommandDumpLuaVersion", help = "Dump Lua version", flags = FCVAR_CHEAT, dev = true, }) table.insert(M, { name = "inv_dump_global", method = "CommandDumpGlobal", help = "Dump global value (<name:string>)", flags = FCVAR_CHEAT, dev = true, }) table.insert(M, { name = "inv_find_global", method = "CommandFindGlobal", help = "Find global name (<pattern:regex>)", flags = FCVAR_CHEAT, dev = true, }) table.insert(M, { name = "inv_item_query", method = "CommandItemQuery", help = "Query items (<query:string>)", flags = FCVAR_CHEAT, dev = true, }) table.insert(M, { name = "inv_dump_abilities", method = "CommandDumpAbilities", help = "Dump current hero abilities ([simplified:int])", flags = FCVAR_CHEAT, dev = true, }) table.insert(M, { name = "inv_invoke", method = "CommandInvokeAbility", help = "Invoke an ability (<name:string>)", flags = FCVAR_CHEAT, dev = true, }) table.insert(M, { name = "inv_dump_combo_graph", method = "CommandDumpComboGraph", help = "Dumps a combo's finite state machine in DOT format", flags = FCVAR_CHEAT, dev = true, }) table.insert(M, { name = "inv_music_status", method = "CommandChangeMusicStatus", help = "Change music status (<status:int> <intensity:float>)", flags = FCVAR_CHEAT, dev = true, }) table.insert(M, { name = "inv_dump_specials", method = "CommandDumpSpecials", help = "Dump Invoker ability specials ([onlyScaling:int])", flags = FCVAR_CHEAT, dev = true, }) table.insert(M, { name = "inv_debug_specials", method = "CommandDebugSpecials", help = "Run debug operations on ability specials (<dump|findKeys|findValues> <query:string>)", flags = FCVAR_CHEAT, dev = true, }) table.insert(M, { name = "inv_reinsert_ability", method = "CommandReinsertAbility", help = "Reinsert Invoker ability (<name:string>)", flags = FCVAR_CHEAT, dev = true, }) return M
if vim.b.did_ftp == true then return end if vim.g.vimrc_rust_loaded_plugins == nil and vim.o.loadplugins then vim.cmd([[packadd tagbar]]) vim.cmd([[packadd rust.vim]]) vim.g.vimrc_rust_loaded_plugins = true end vim.wo.signcolumn = "yes" vim.bo.suffixesadd = ".rs" vim.opt_local.cursorline = false vim.opt_local.cursorcolumn = false if vim.fn.executable("rustfmt") == 1 then vim.bo.formatprg = "rustfmt" end if vim.fn.executable("rustup") == 1 then vim.bo.keywordprg = "rustup\\ doc" end vim.b.vimrc_rust_analyzer_lsp_signs_enabled = 1 vim.b.vimrc_null_ls_lsp_signs_enabled = 1
local function run (msg, matches)   if matches [1]: lower () == "github>" then     local dat = https.request ( "https://api.github.com/repos/" ..matches [2])     local jdat = JSON.decode (dat)     if jdat.message then       return "address is not correct."       end     local base = "curl 'https://codeload.github.com/"..matches[2].."/zip/master'"     local data = io.popen (base): read ( '* all')     f = io.open ( "file / github.zip", "w +")     f: write (data)     f: close ()     return send_document ( "chat # id" .. msg.to.id, "file / github.zip", ok_cb, false)   else     local dat = https.request ( "https://api.github.com/repos/" ..matches [2])     local jdat = JSON.decode (dat)     if jdat.message then       return "address is not correct."       end     local res = https.request (jdat.owner.url)     local jres = JSON.decode (res)     send_photo_from_url ( "chat # id" .. msg.to.id, jdat.owner.avatar_url)     return "View account: \ n"       .. "Account name:" .. (jres.name or "-----") .. "\ n"       .. "Username:" ..jdat.owner.login .. "\ n"       .. "Name:" .. (jres.company or "-----") .. "\ n"       .. "Website:" .. (jres.blog or "-----") .. "\ n"       .. "Email:" .. (jres.email or "-----") .. "\ n"       .. "Location:" .. (jres.location or "-----") .. "\ n"       .. "The number of projects:" ..jres.public_repos .. "\ n"       .. "The number of followers:" ..jres.followers .. "\ n"       .. "The number followed by:" ..jres.following .. "\ n"       .. "On the construction account:" ..jres.created_at .. "\ n"       .. "Biography:" .. (jres.bio or "-----") .. "\ n \ n"       .. "View project: \ n"       .. "Project Name:" ..jdat.name .. "\ n"       .. "GitHub page:" ..jdat.html_url .. "\ n"       .. "Pkgsrc:" ..jdat.clone_url .. "\ n"       .. "Blog of the project:" .. (jdat.homepage or "-----") .. "\ n"       .. "Created:" ..jdat.created_at .. "\ n"       .. "Last Updated on:" .. (jdat.updated_at or "-----") .. "\ n"       .. "Programming language:" .. (jdat.language or "-----") .. "\ n"       .. "Size script:" ..jdat.size .. "\ n"       .. "Stars:" ..jdat.stargazers_count .. "\ n"       .. "Hits:" ..jdat.watchers_count .. "\ n"       .. "Split:" ..jdat.forks_count .. "\ n"       .. "Customer:" ..jdat.subscribers_count .. "\ n"       .. "About project: \ n" .. (jdat.description or "-----") .. "\ n"   end end return {   description = "Github Informations",   usagehtm = '<tr> <td align = "center"> github project / account </ td> <td align = "right"> address GitHub for project / account Enter <br> example: github shayansoft / umbrella < / td> </ tr> '   .. '<Tr> <td align = "center"> github> Project / Account </ td> <td align = "right"> With this command, you can download the source code to the project. Enter the address projects like high command </ td> </ tr> ',   usage = {     "Github (account / proje): View project and account",     "Github> (account / proje): Download source",     },   patterns = {     "^ ([Gg] ithub>) (. *)",     "^ ([Gg] ithub) (. *)",     },   run = run }
-- Copyright (C) 2019 by davin local headers = ngx.req.get_headers() local raw_headers = 'N/A for HTTP/2' --ngx.log(ngx.ERR, 'http2=[',ngx.var.http2,']') if #ngx.var.http2 == 0 then raw_headers = ngx.req.raw_header() end local str = {} for k,v in pairs(headers) do --ngx.say(k, "\t\t\t\t=>", v) --ngx.say(string.format("%-10s=>", k)) local s = string.format("%-10s=>", k) if type(v) == 'string' then --ngx.say(v) s = s .. v else --ngx.say(table.concat(v, ' ')) s = s .. table.concat(v, ',') end str[#str + 1] = s end str[#str + 1] = "\nraw header is :\n" str = table.concat(str, '\n') --ngx.header['Content-Type'] = 'text/plain' ngx.header['Content-Length'] = #str + #raw_headers ngx.print(str) ngx.print(raw_headers) --ngx.say("\nraw header is :\n") --ngx.say(ngx.req.raw_header())
-- -- basic shader for cells where there is no other specific type to the contents -- return { label = "Cell", version = 1, frag = [[ uniform float border; uniform float obj_opacity; uniform vec2 obj_output_sz; uniform vec2 obj_storage_sz; uniform sampler2D map_tu0; uniform float width; uniform float height; varying vec2 texco; void main() { vec4 col = texture2D(map_tu0, texco).rgba; vec2 sf = obj_output_sz / obj_storage_sz; /* blur below a set scale */ if (sf.x < 0.7 || sf.y < 0.7){ sf = vec2(1.0, 1.0) / obj_storage_sz; vec3 ack = vec3(0.0); ack += texture2D(map_tu0, vec2(texco.s - sf.x, texco.t - sf.y)).rgb; ack += texture2D(map_tu0, vec2(texco.s , texco.t - sf.y)).rgb; ack += texture2D(map_tu0, vec2(texco.s + sf.x, texco.t - sf.y)).rgb; ack += texture2D(map_tu0, vec2(texco.s - sf.x, texco.t)).rgb; ack += col.rgb; ack += texture2D(map_tu0, vec2(texco.s + sf.x, texco.t)).rgb; ack += texture2D(map_tu0, vec2(texco.s - sf.x, texco.t + sf.y)).rgb; ack += texture2D(map_tu0, vec2(texco.s , texco.t + sf.y)).rgb; ack += texture2D(map_tu0, vec2(texco.s + sf.x, texco.t + sf.y)).rgb; col.r = ack.r / 9.0; col.g = ack.g / 9.0; col.b = ack.b / 9.0; } /* opacity is used to indicate selection state */ if (obj_opacity < 1.0){ float avg = 0.2126 * col.r + 0.7152 * col.g + 0.0722 * col.b; gl_FragColor = vec4(avg, avg, avg, obj_opacity); } else gl_FragColor = col; } ]], uniforms = { }, };
---@meta resty_sha384={} function resty_sha384.final(self) end function resty_sha384.new(self) end function resty_sha384.reset(self) end resty_sha384._VERSION="0.11" function resty_sha384.update(self, s) end return resty_sha384
local screenWidth, screenHeight = guiGetScreenSize() serviceLightOn=false serviceStatus="Off" function createText() if serviceLightOn==true then exports.CSGpriyenmisc:dxDrawColorText( "#eeeeeeTaxi Service:#e50005 "..serviceStatus.."", screenWidth*0.09, screenHeight*0.95, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "default-bold" ) exports.CSGpriyenmisc:dxDrawColorText( "#eeeeeeTaxi Service:#e50005 "..serviceStatus.."", screenWidth*0.09, screenHeight*0.95, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "default-bold" ) end end function drawText() local vehicle = getPedOccupiedVehicle(localPlayer) if (vehicle) then if getElementModel(vehicle) == 420 or getElementModel(vehicle) == 438 then if getElementData(localPlayer,"Occupation") == "Taxi Driver" then screenWidth,screenHeight = guiGetScreenSize() exports.CSGpriyenmisc:dxDrawColorText ( "#eeeeeeTaxi Service:#e50005 "..serviceStatus.."", screenWidth*0.08, screenHeight*0.95, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) end end end end addEventHandler("onClientRender",root,drawText) local sx, sy = guiGetScreenSize() local rx, ry = 1920, 1080 if sx == 800 then text = 2.00 text2 = 4 elseif sx == 1024 then text = 1.9 text2 = 3 elseif sx >= 1280 then text = 1 text2 = 2 end function monitorDENjob() if sx == 800 then text = 2.00 text2 = 4 elseif sx == 1024 then text = 1.9 text2 = 3 elseif sx >= 1280 then text = 1 text2 = 2 end end addEventHandler("onClientRender", root, monitorDENjob) function togLight(state) serviceLightOn=state if state==true then serviceStatus="On" exports.NGCdxmsg:createNewDxMessage("Service Status "..serviceStatus..".",0,255,0) else serviceStatus="Off" exports.NGCdxmsg:createNewDxMessage("Service Status "..serviceStatus..".",255,0,0) end end addEvent("NGCtaxi.togLight",true) addEventHandler("NGCtaxi.togLight",localPlayer,togLight) addEventHandler("onClientVehicleEnter",root,function(p) if p ~= localPlayer then return end local v = source if getElementModel(v) == 420 or getElementModel(v) == 438 then if getVehicleController(v) == localPlayer then if serviceLightOn==true then -- addEventHandler("onClientRender",root,createText) end end end end) addEventHandler("onClientVehicleExit",root,function(p) if p ~= localPlayer then return end serviceLightOn=false --- removeEventHandler("onClientRender",root,createText) end) function onElementDataChange( dataName, oldValue ) if dataName == "Occupation" and getElementData(localPlayer,dataName) == "Taxi Driver" then initTaxiOccupation() elseif dataName == "Occupation" then stopTaxiOccupation() end end addEventHandler ( "onClientElementDataChange", localPlayer, onElementDataChange, false ) function onTaxiTeamChange ( oldTeam, newTeam ) if getElementData ( localPlayer, "Occupation" ) == "Taxi Driver" and source == localPlayer then setTimer ( function () if getPlayerTeam( localPlayer ) then local newTeam = getTeamName ( getPlayerTeam( localPlayer ) ) if newTeam == "Unoccupied" then stopTaxiOccupation() elseif getElementData ( localPlayer, "Occupation" ) == "Taxi Driver" and newTeam == "Civilian Workers" then initTaxiOccupation() end end end, 200, 1 ) end end addEventHandler( "onClientPlayerTeamChange", localPlayer, onTaxiTeamChange, false ) function onResourceStart() setTimer ( function () if getPlayerTeam( localPlayer ) then local team = getTeamName ( getPlayerTeam( localPlayer ) ) if getElementData ( localPlayer, "Occupation" ) == "Taxi Driver" and team == "Civilian Workers" then initTaxiOccupation() end end end , 2500, 1 ) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), onResourceStart ) addEvent( "onClientPlayerTeamChange" ) function initTaxiOccupation() if not isTaxi then loadjob() setElementData(localPlayer,"taxi3",0) exports.NGCdxmsg:createNewDxMessage("Bots are marked as Red waypoint blip on the radar",255,255,0) isTaxi = true guiSetVisible(TaxiJobC.window[1],true) end end function stopTaxiOccupation () if isTaxi then disableJob() guiSetVisible(TaxiJobC.window[1],false) triggerServerEvent("cleanPedsFromServer",localPlayer) exports.CSGranks:closePanel() if isTimer(deliverTimer) then killTimer(deliverTimer) end end isTaxi = false end addEventHandler("onClientPedDamage", root, function() if getElementData(source,"StopTaxiKill") == true then cancelEvent() end end ) ------------------------------------------ ----------- JOB local screenWidth, screenHeight = guiGetScreenSize() TaxiJobC = { label = {}, window = {} } TaxiJobC.window[1] = guiCreateWindow((screenWidth+450)/2, (screenHeight-250)/2, 167, 183, "Taxi Counter", false) guiWindowSetSizable(TaxiJobC.window[1], false) guiSetVisible(TaxiJobC.window[1],false) TaxiJobC.label[1] = guiCreateLabel(17, 22, 138, 31, "Total cash : $ 0", false, TaxiJobC.window[1]) guiSetFont(TaxiJobC.label[1], "default-bold-small") guiLabelSetVerticalAlign(TaxiJobC.label[1], "center") TaxiJobC.label[2] = guiCreateLabel(17, 63, 138, 31, "Latest payment : $ 0", false, TaxiJobC.window[1]) guiSetFont(TaxiJobC.label[2], "default-bold-small") guiLabelSetVerticalAlign(TaxiJobC.label[2], "center") TaxiJobC.label[3] = guiCreateLabel(17, 102, 138, 31, "Bot Missions : $ 0", false, TaxiJobC.window[1]) guiSetFont(TaxiJobC.label[3], "default-bold-small") guiLabelSetVerticalAlign(TaxiJobC.label[3], "center") TaxiJobC.label[4] = guiCreateLabel(17, 143, 138, 31, "Mission Timer :", false, TaxiJobC.window[1]) guiSetFont(TaxiJobC.label[4], "default-bold-small") guiLabelSetVerticalAlign(TaxiJobC.label[4], "center") local taxis = { [420]=true, [438]=true } id = 0 addCommandHandler("printjob",function() id = id + 1 local x, y, z = getElementPosition( localPlayer ) local r = getPedRotation ( localPlayer ) outputChatBox("["..id.."] = {"..( math.floor( x * 100 ) / 100 ) .. ", " .. ( math.floor( y * 100 ) / 100 ) .. ", " .. ( math.floor( z * 100 ) / 100 )..","..r.."},",255,255,0) end) addCommandHandler("newjob",function() id = 0 outputChatBox("ID = 0",255,255,0) end) local pos = { [1] = {-1534.01, 975.73, 7.19,113.00604248047}, [2] = {-1672.14, 1298.75, 7.18,129.22711181641}, [3] = {-1969.4, 1322.6, 7.25,173.72088623047}, [4] = {-2618.17, 1356.44, 7.11,269.52923583984}, [5] = {-2834.61, 949.49, 44.09,280.25518798828}, [6] = {-2859.81, 471.07, 4.35,266.15509033203}, [7] = {-2803.08, -105.95, 7.18,85.455810546875}, [8] = {-2798.43, -470.38, 7.18,143.56796264648}, [9] = {-2598.93, -146.65, 4.33,93.216735839844}, [10] = {-2508.23, -117.05, 25.61,274.54254150391}, [11] = {-2395.35, -63.72, 35.32,174.8291015625}, [12] = {-2018.58, -76.1, 35.32,0}, [13] = {-1995.83, 137.98, 27.68,269.76998901367}, [14] = {-1995, 491.37, 35.16,84.756744384766}, [15] = {-1991.68, 722.39, 45.44,359.52926635742}, [16] = {-1995.67, 881.06, 45.44,90.396789550781}, [17] = {-1874.95, 1087.61, 45.44,85.455810546875}, [18] = {-2164.43, 1167.4, 55.72,1.2641296386719}, [19] = {-1757.2, -107.78, 3.71,173.02154541016}, [20] = {-1804.82, -134.56, 6.07,269.6741027832}, [21] = {-2244.19, 215.89, 35.32,89.674072265625}, [22] = {-2308.58, 407.65, 35.17,313.99945068359}, [23] = {-2371.81, 556.56, 24.89,0.37322998046875}, [24] = {-2208.92, 574.55, 35.17,177.31231689453}, [25] = {-2133.16, 655.61, 52.36,89.505676269531}, [26] = {-2116.7, 737.04, 69.56,182.01234436035}, [27] = {-2082.88, 814.47, 69.56,177.69818115234}, [28] = {-2520.35, 822.34, 49.97,87.457336425781}, [29] = {-2585.54, 802.1, 49.98,357.77059936523}, [30] = {-2734.43, 574.95, 14.55,178.63818359375}, } local drops = { [1] = {-2705.32, 405.87, 4.36,0}, [2] = {-2612.63, 209.9, 5.39,5.3632202148438}, [3] = {-2536.6, 141.25, 16.26,207.38562011719}, [4] = {-2453.61, 137.94, 34.96,312.86773681641}, [5] = {-2151.66, 188.6, 35.32,270.80828857422}, [6] = {-1992.46, 291.52, 34.14,161.62219238281}, [7] = {-1815.04, 161.22, 14.97,272.35162353516}, [8] = {-1569.61, 667.7, 7.18,268.10977172852}, [9] = {-1523.39, 838.09, 7.18,81.216461181641}, [10] = {-1859.07, 1380.58, 7.18,183.12316894531}, [11] = {-2373.03, 1215.29, 35.27,274.06314086914}, [12] = {-2492.61, 1206.05, 37.42,205.99671936035}, [13] = {-2585.23, 1360.75, 7.19,223.06184387207}, [14] = {-2866.89, 734.93, 30.07,276.08825683594}, [15] = {-2754.53, 376.32, 4.13,268.32730102539}, [16] = {-2711.78, 212.48, 4.32,268.95397949219}, [17] = {-2203.49, 312.45, 35.32,2.5691528320313}, [18] = {-2026.46, 166.64, 28.83,262.37396240234}, [19] = {-2128.48, -376.55, 35.33,2.1598815917969}, [20] = {-1551.48, -443.31, 6,313.90609741211}, [21] = {-1757.74, 138.58, 3.58,79.266357421875}, [22] = {-1698.18, 373.01, 7.17,210.07250976563}, [23] = {-1890.48, 747.39, 45.44,83.966461181641}, [24] = {-2015.82, 1086.6, 55.71,173.72546386719}, [25] = {-1780.79, 1199.68, 25.12,173.96630859375}, [26] = {-2647.17, 1192.26, 55.57,126.87002563477}, [27] = {-2491.02, 743.59, 35.01,177.05285644531}, [28] = {-2423.03, 316.04, 34.96,239.4557800293}, [29] = {-2019.5, -93.83, 35.16,353.10098266602}, [30] = {-1977.95, -857.11, 32.03,87.415252685547}, } local peds = {} local hitMarkers = {} local TaxiBlips = {} local TaxiBlips2 = {} local t={} function loadjob() num = math.random(1,25) for i=1,#pos do x, y, z, r = pos[i][1], pos[i][2], pos[i][3], pos[i][4] local ped = createPed(math.random(20,90),x,y,z+1,r) local money = math.random(500,1200) if ped then local x,y,z = getElementPosition(ped) local theMarker = createMarker ( x, y, z -2, "cylinder", 3.0, 200, 100, 0, 150 ) addEventHandler("onClientMarkerHit",theMarker,hitTaxiPed) table.insert ( hitMarkers, theMarker ) setElementData(ped,"StopTaxiKill",true) setElementData(ped,"taximoney",money) setElementData(theMarker,"taximoney",money) attachElements(ped,theMarker) local Tax = createBlip(x,y,20,41, 2000) setBlipVisibleDistance(Tax, 2000) table.insert ( TaxiBlips, Tax ) table.insert ( peds, ped ) end end end function disableJob() for k,v in ipairs(hitMarkers) do if isElement(v) then destroyElement(v) end end for k,v in ipairs(peds) do if isElement(v) then destroyElement(v) end end for k,v in ipairs(TaxiBlips) do if isElement(v) then destroyElement(v) end end for k,v in ipairs(TaxiBlips2) do if isElement(v) then destroyElement(v) end end end addEventHandler("onClientPlayerQuit",localPlayer,disableJob) function hitTaxiPed(hitElement) if hitElement ~= localPlayer then return false end if isPedInVehicle(hitElement) and getVehicleController(getPedOccupiedVehicle(hitElement)) == localPlayer then if taxis[getElementModel ( getPedOccupiedVehicle(hitElement) )] then local occc = getElementData(localPlayer,"Occupation") if ( occc == "Taxi Driver") and ( getTeamName( getPlayerTeam( localPlayer) ) == "Civilian Workers") then local attachedElements = getAttachedElements (source) for k,v in ipairs(attachedElements) do if getElementType(v) == "ped" then detachElements(v,source) skin,x,y,z = getElementModel(v),getElementPosition(v) triggerServerEvent("warpPed",hitElement,skin,x,y,z) fadeCamera(false) setTimer(fadeCamera,3000,1,true) if isElement(v) then destroyElement(v) end local money = getElementData(source,"taximoney") disableJob() area = math.random ( 1, #drops ) local x,y,z = getElementPosition(hitElement) local OccupationDistance = getDistanceBetweenPoints3D ( drops[area][1],drops[area][2],drops[area][3], pos[area][1],pos[area][2],pos[area][3] ) if OccupationDistance >= 2000 then timer = 160000 elseif OccupationDistance >= 1000 and OccupationDistance < 2000 then timer = 140000 elseif OccupationDistance < 1000 and OccupationDistance >= 500 then timer = 100000 elseif OccupationDistance < 500 then timer = 70000 end deliverTimer = setTimer(function() clearTaxi() end,timer,1) local theMarker = createMarker ( drops[area][1],drops[area][2],drops[area][3] -1, "cylinder", 3.0, 200, 100, 0, 150 ) local tax2 = createBlip(drops[area][1],drops[area][2],20,41, 5000) setBlipVisibleDistance(tax2, 5000) exports.NGCdxmsg:createNewDxMessage("Drop this passenger in "..getZoneName(drops[area][1],drops[area][2],drops[area][3]).." Street , Red waypoint blip.",0,255,0) table.insert(hitMarkers,theMarker) table.insert(TaxiBlips2,tax2) addEventHandler("onClientMarkerHit",theMarker,hitLastPed) setElementData(theMarker,"taximoneyhd",money) setElementData(theMarker,"taxitimer",timer) end end end end end end function clearTaxi() disableJob() triggerServerEvent("cleanPedsFromServer",localPlayer) loadjob() end function hitLastPed(hitElement) if hitElement ~= localPlayer then return false end if isPedInVehicle(hitElement) and getVehicleController(getPedOccupiedVehicle(hitElement)) == localPlayer then if taxis[getElementModel ( getPedOccupiedVehicle(hitElement) )] then local occc = getElementData(localPlayer,"Occupation") if ( occc == "Taxi Driver") and ( getTeamName( getPlayerTeam( localPlayer) ) == "Civilian Workers") then local money = getElementData(source,"taximoneyhd") fadeCamera(false) setTimer(fadeCamera,3000,1,true) triggerServerEvent("giveTaxiMoney",hitElement,money) setElementData(localPlayer,"taxi3",getElementData(localPlayer,"taxi3")+money) disableJob() if isElement(source) then destroyElement(source) end if isTimer(deliverTimer) then killTimer(deliverTimer) end triggerServerEvent("cleanPedsFromServer",localPlayer) loadjob() end end end end function showDXt() local occc = getElementData(localPlayer,"Occupation") if ( occc == "Taxi Driver") and ( getTeamName( getPlayerTeam( localPlayer) ) == "Civilian Workers") then local playerVehicle = getPedOccupiedVehicle ( localPlayer ) if playerVehicle and ( getElementModel ( playerVehicle) == 420 ) or playerVehicle and ( getElementModel ( playerVehicle) == 438 ) then pass = getElementData(localPlayer, "taxi2") or 0 pass2 = getElementData(localPlayer, "taxi") or 0 pass3 = getElementData(localPlayer, "taxi3") or 0 if isTimer(deliverTimer) then local timeLeft, timeLeftEx, timeTotalEx = getTimerDetails (deliverTimer) local timeLeft = math.floor(timeLeft / 1000) if timeLeft and timeLeft > 0 then guiSetText(TaxiJobC.label[4],"Mission timer: " ..timeLeft.." Seconds") end end guiSetText(TaxiJobC.label[3],"Bot Missions: $ " ..tostring(pass3)) guiSetText(TaxiJobC.label[2],"Last payment: $ " ..tostring(pass2)) guiSetText(TaxiJobC.label[1],"Total cash: $ " ..tostring(pass)) end end end addEventHandler("onClientRender",root,showDXt) function dxDrawFramedText(message, left, top, width, height, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(message, left + 1, top + 1, width + 1, height + 1, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(message, left + 1, top - 1, width + 1, height - 1, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(message, left - 1, top + 1, width - 1, height + 1, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(message, left - 1, top - 1, width - 1, height - 1, tocolor(0, 0, 0, 255), scale, font, alignX, alignY, clip, wordBreak, postGUI) dxDrawText(message, left, top, width, height, color, scale, font, alignX, alignY, clip, wordBreak, postGUI) end addEventHandler("onClientRender", root, function() for index, bMarker in ipairs(getElementsByType("marker", resourceRoot)) do local timeLeft = getElementData(bMarker, "taximoney") local posX, posY, posZ = getElementPosition(bMarker) local camX, camY, camZ = getCameraMatrix() if getDistanceBetweenPoints3D(camX, camY, camZ, posX, posY, posZ) < 25 then local scX, scY = getScreenFromWorldPosition(posX, posY, posZ + 1.6) scX, scY = getScreenFromWorldPosition(posX, posY, posZ + 1.4) if scX then if not timeLeft then return false end if timeLeft and timeLeft > 0 then if timeLeft >= 1010 then r,g,b = 0,255,0 elseif timeLeft > 800 and timeLeft < 1010 then r,g,b = 255,255,0 elseif timeLeft > 600 and timeLeft <= 800 then r,g,b = 255,155,0 elseif timeLeft <= 600 then r,g,b = 255,0,0 end end setMarkerColor(bMarker,r,g,b,0) dxDrawFramedText("Mission payment: $"..timeLeft, scX, scY, scX, scY, tocolor(r,g,b, 255), 1.5-( getDistanceBetweenPoints3D(camX, camY, camZ, posX, posY, posZ)/20), "bankgothic", "center", "center", false, false, false) end end end end ) function togglePilotPanel() if getElementData(localPlayer,"Occupation") == "Taxi Driver" and getPlayerTeam(localPlayer) and getTeamName(getPlayerTeam(localPlayer)) == "Civilian Workers" then exports.CSGranks:openPanel() end end bindKey("F5","down",togglePilotPanel)
require("prototypes.techs")
 local t = {}; for i = 1,10000,1 do t[i] = i; end; local sum = 0; for i = 1,10000,1 do sum = sum + t[i]; end;
optionsActions = {} --7 - 16 function optionsActions.enableSounds (value) enableSound = value end function optionsActions.smoothCamMove (value) local loaded = freecam.setFreecamOption ( "smoothMovement", value ) if ( loaded ) then setFreecamSpeeds() else addEventHandler ( "onClientResourceStart", getRootElement(), waitForFreecam ) end end function waitForFreecam(resource) if resource ~= getResourceFromName("freecam") then return end freecam.setFreecamOption ( "smoothMovement", dialog.smoothCamMove:getValue() ) setFreecamSpeeds() removeEventHandler ( "onClientResourceStart", getRootElement(), waitForFreecam ) end function setFreecamSpeeds() local freecamRes = getResourceFromName("freecam") freecam.setFreecamOption ( "invertMouseLook", dialog.invertMouseLook:getValue() ) freecam.setFreecamOption ( "normalMaxSpeed", dialog.normalMove:getValue() ) freecam.setFreecamOption ( "fastMaxSpeed", dialog.fastMove:getValue() ) freecam.setFreecamOption ( "slowMaxSpeed", dialog.slowMove:getValue() ) freecam.setFreecamOption ( "mouseSensitivity", dialog.mouseSensitivity:getValue() ) end ---This part decides whether gui should be refreshed or not local iconSize,topmenuAlign,bottommenuAlign local doesGUINeedRefreshing = false function dumpGUISettings() doesGUINeedRefreshing = false iconSize = dialog.iconSize:getRow() topmenuAlign = dialog.topAlign:getRow() bottommenuAlign = dialog.bottomAlign:getRow() end local iconSizes = { small = 32, medium = 48, large = 64 } function optionsActions.iconSize (value) guiConfig.iconSize = iconSizes[value] if value ~= iconSize then doesGUINeedRefreshing = true end end function optionsActions.topAlign (value) guiConfig.topMenuAlign = value if value ~= topmenuAlign then doesGUINeedRefreshing = true end end function optionsActions.bottomAlign (value) guiConfig.elementIconsAlign = value if value ~= bottommenuAlign then doesGUINeedRefreshing = true end end function updateGUI() if doesGUINeedRefreshing then destroyAllIconGUI() createGUILayout() refreshElementIcons() nextEDF() end end -- void setRotateSpeeds(num slow, num medium, num fast) -- void setMoveSpeeds(num slow, num medium, num fast) -- void setRotateSpeeds(num slow, num medium, num fast) ---Movement action -- move_cursor -- num num num getRotateSpeeds() -- Command executed! Results: 0.25 [number], 2 [number], 10 [number] -- move_freecam -- num num num getRotateSpeeds() -- Command executed! Results: 1 [number], 8 [number], 40 [number] -- move_keyboard -- num num num getMoveSpeeds() -- Command executed! Results: 0.025 [number], 0.25 [number], 2 [number] -- num num num getRotateSpeeds() -- Command executed! Results: 0.25 [number], 2 [number], 10 [number] function optionsActions.normalElemMove (value) local slow, normal, fast = move_keyboard.getMoveSpeeds () if getResourceFromName("move_keyboard") then setEditorMoveSpeeds() else addEventHandler ( "onClientResourceStart", getRootElement(), waitForResources ) end end local res1,res2,res3 function waitForResources(resource) if getResourceName(resource) == "move_keyboard" then res1 = true elseif getResourceName(resource) == "move_cursor" then res2 = true elseif getResourceName(resource) == "move_freecam" then res3 = true end if ( res1 ) and ( res2 ) and ( res3 ) then setEditorMoveSpeeds() end end function setEditorMoveSpeeds() local kbRes = getResourceFromName("move_keyboard") local cRes = getResourceFromName("move_cursor") local fRes = getResourceFromName("move_freecam") move_keyboard.setMoveSpeeds ( dialog.slowElemMove:getValue(), dialog.normalElemMove:getValue(), dialog.fastElemMove:getValue()) -- move_keyboard.setRotateSpeeds ( dialog.slowElemRotate:getValue(), dialog.normalElemRotate:getValue(), dialog.fastElemRotate:getValue() ) move_cursor.setRotateSpeeds ( dialog.slowElemRotate:getValue(), dialog.normalElemRotate:getValue(), dialog.fastElemRotate:getValue() ) move_freecam.setRotateSpeeds ( dialog.slowElemRotate:getValue(), dialog.normalElemRotate:getValue(), dialog.fastElemRotate:getValue() ) move_keyboard.toggleAxesLock ( dialog.lockToAxes:getValue() ) end function optionsActions.enableDumpSave(value) triggerServerEvent("dumpSaveSettings", getRootElement(), value, dialog.dumpSaveInterval:getValue()) end
local fs = require 'nelua.utils.fs' local tabler = require 'nelua.utils.tabler' local version = {} -- Version number. version.NELUA_VERSION_MAJOR = 0 version.NELUA_VERSION_MINOR = 2 version.NELUA_VERSION_PATCH = 0 version.NELUA_VERSION_SUFFIX = 'dev' -- This values are replaced on install. version.NELUA_GIT_BUILD = 0 version.NELUA_GIT_HASH = "unknown" version.NELUA_GIT_DATE = "unknown" -- Version string. version.NELUA_VERSION = string.format("Nelua %d.%d.%d", version.NELUA_VERSION_MAJOR, version.NELUA_VERSION_MINOR, version.NELUA_VERSION_PATCH) if #version.NELUA_VERSION_SUFFIX > 0 then version.NELUA_VERSION = version.NELUA_VERSION..'-'..version.NELUA_VERSION_SUFFIX end -- Execute git commands inside Nelua's git repository. local function execute_git_command(args) -- try to detect nelua git directory using this script local gitdir = fs.abspath(fs.join(fs.dirname(fs.dirname(fs.scriptname())), '.git')) if fs.isdir(gitdir) then local executor = require 'nelua.utils.executor' local execargs = tabler.insertvalues({'-C', gitdir}, args) local ok, status, stdout = executor.execex('git', execargs) if ok and status and stdout ~= '' then return stdout end end end -- Try to detect information from git repository clones. function version.detect_git_info() -- git hash if version.NELUA_GIT_HASH == "unknown" then local stdout = execute_git_command({'rev-parse', 'HEAD'}) if stdout then local hash = stdout:match('%w+') if hash then version.NELUA_GIT_HASH = hash end end end -- git date if version.NELUA_GIT_DATE == "unknown" then local stdout = execute_git_command({'log', '-1', '--format=%ci'}) if stdout then local date = stdout:match('[^\r\n]+') if date then version.NELUA_GIT_DATE = date end end end -- git build if version.NELUA_GIT_BUILD == 0 then local stdout = execute_git_command({'rev-list', 'HEAD', '--count'}) if stdout then local build = tonumber(stdout) if build then version.NELUA_GIT_BUILD = build end end end end return version
os.execute(arg[-1]..' ../tests/test.lua') os.execute(arg[-1]..' ../tests/test-lom.lua')
local http = require("socket.http") local orphans = {} local list_url = 'https://api.vultr.com/v1/server/list' local headers = {} headers['API-KEY'] = os.getenv('VULTR_API_KEY') local servers = http.request(list_url)
-- Update dimension references to account for intermediate supervision ref.predDim = {dataset.nJoints,5} ref.outputDim = {} paths.dofile('../models/layers/FusionCriterion.lua') criterion = nn.ParallelCriterion() for i = 1,opt.nStack do ref.outputDim[i] = {dataset.nJoints, opt.outputRes, opt.outputRes} criterion:add(nn[opt.crit .. 'Criterion']()) end FusionCriterion = FusionCriterion(opt.regWeight, opt.varWeight) criterion:add(FusionCriterion) -- Function for data augmentation, randomly samples on a normal distribution local function rnd(x) return math.max(-2*x,math.min(2*x,torch.randn(1)[1]*x)) end -- Code to generate training samples from raw images function generateSample(set, idx, tp) if tp == 'h36m' then -- load 3D data local img = dataset:loadImage(idx, tp) local pts, c, s, pts_3d = dataset:getPartInfo(idx, tp) local r = 0 -- Fix torsor annotation discripency between h36m and mpii pts_3d[8] = (pts_3d[13] + pts_3d[14]) / 2 local inp = crop(img, c, s * 224.0 / 200.0, r, opt.inputRes) local outMap = torch.zeros(dataset.nJoints, opt.outputRes, opt.outputRes) local outReg = torch.zeros(dataset.nJoints, 1) for i = 1,dataset.nJoints do local pt = transform3DFloat(pts_3d[i], c, s * dataset.h36mImgSize / 200.0, r, opt.outputRes) local pt_2d = {pt[1], pt[2]} if pts[i][1] > 1 then drawGaussian(outMap[i], pt_2d, opt.hmGauss) end outReg[i][1] = pt[3] / opt.outputRes * 2 - 1 end return inp, outMap, outReg elseif tp == 'mpii' then local img = dataset:loadImage(idx, tp) local pts, c, s = dataset:getPartInfo(idx, tp) local r = 0 if set == 'train' then s = s * (2 ^ rnd(opt.scale)) r = rnd(opt.rotate) if torch.uniform() <= .6 then r = 0 end end local inp = crop(img, c, s, r, opt.inputRes) local out = torch.zeros(dataset.nJoints, opt.outputRes, opt.outputRes) for i = 1,dataset.nJoints do if pts[i][1] > 1 then -- Checks that there is a ground truth annotation drawGaussian(out[i], transform(pts[i], c, s, r, opt.outputRes), opt.hmGauss) end end if set == 'train' then if torch.uniform() < .5 then inp = flip(inp) out = shuffleLR(flip(out)) end inp[1]:mul(torch.uniform(0.6,1.4)):clamp(0,1) inp[2]:mul(torch.uniform(0.6,1.4)):clamp(0,1) inp[3]:mul(torch.uniform(0.6,1.4)):clamp(0,1) end return inp,out elseif tp == 'mpi_inf_3dhp' then local img = dataset:loadImage(idx, tp) local c = torch.ones(2) * dataset.mpiinf3dhpImgSize / 2 local inp = crop(img, c, 1 * dataset.mpiinf3dhpImgSize / 200.0, 0, opt.inputRes) -- 200.0 is the default bbox size in MPII dataset return inp elseif tp == 'demo' then local img = dataset:loadImage(idx, tp):narrow(1, 1, 3) local h, w = img:size(2), img:size(3) local c = torch.Tensor({w / 2, h / 2}) local size = math.max(h, w) local inp = crop(img, c, 1 * size / 200.0, 0, opt.inputRes) return inp end end -- Load in a mini-batch of data function loadData(set, idxs, tps) if type(idxs) == 'table' then idxs = torch.Tensor(idxs) end local nsamples = idxs:size(1) local input,labelMap, labelReg for i = 1, nsamples do tp = tps[i] local tmpInput, tmpLabelMap, tmpLabelReg if tp == 'h36m' then tmpInput,tmpLabelMap, tmpLabelReg = generateSample(set, idxs[i], tp) elseif tp == 'mpii' then tmpInput,tmpLabelMap = generateSample(set, idxs[i], tp) tmpLabelReg = torch.ones(dataset.nJoints, 1) * -1 elseif tp == 'mpi_inf_3dhp' or tp == 'demo' then tmpInput = generateSample(set, idxs[i], tp) tmpLabelMap = torch.ones(dataset.nJoints, opt.outputRes, opt.outputRes) * -1 tmpLabelReg = torch.zeros(dataset.nJoints, 1) * -1 end tmpInput = tmpInput:view(1,unpack(tmpInput:size():totable())) tmpLabelMap = tmpLabelMap:view(1,unpack(tmpLabelMap:size():totable())) tmpLabelReg = tmpLabelReg:view(1,unpack(tmpLabelReg:size():totable())) if not input then input = tmpInput labelMap = tmpLabelMap labelReg = tmpLabelReg else input = input:cat(tmpInput,1) labelMap = labelMap:cat(tmpLabelMap, 1) labelReg = labelReg:cat(tmpLabelReg, 1) end end local newLabel = {} for i = 1,opt.nStack do newLabel[i] = labelMap end newLabel[opt.nStack + 1] = {labelReg, torch.ones(nsamples, dataset.nJoints, 3) * -1} return input,newLabel end function accuracy(output,label) return heatmapAccuracy(output[#output - 1],label[#label - 1],nil,dataset.accIdxs) end function eval(idx, outputReg, outputHM, tp, img) local Reg = outputReg local tmpOutput = outputHM Reg = Reg:view(Reg:size(1), 16, 1) local z = (Reg + 1) * opt.outputRes / 2 local p = getPreds(tmpOutput) for i = 1,p:size(1) do for j = 1,p:size(2) do local hm = tmpOutput[i][j] local pX,pY = p[i][j][1], p[i][j][2] if pX > 1 and pX < opt.outputRes and pY > 1 and pY < opt.outputRes then local diff = torch.Tensor({hm[pY][pX+1]-hm[pY][pX-1], hm[pY+1][pX]-hm[pY-1][pX]}) p[i][j]:add(diff:sign():mul(.25)) end end end p:add(0.5) local dis = 0 local correct = p:size(1) for i = 1,p:size(1) do if tp == 'mpii' or tp == 'demo' then local pred = torch.zeros(dataset.nJoints, 3) for j = 1, dataset.nJoints do pred[j][1], pred[j][2], pred[j][3] = p[i][j][1], p[i][j][2], z[i][j][1] end pred = pred * 4 if opt.DEBUG > 2 then pyFunc('Show3d', {joint=pred, img=img, noPause = torch.zeros(1), id = torch.ones(1) * imgid}) end elseif tp == 'h36m' then local _, c_, s_, gt_3d_ = dataset:getPartInfo(idx[i], tp) local gt_3d, scale, c2d, c3d, c, s, action = dataset:getPartDetail(idx[i]) local pred = torch.zeros(dataset.nJoints, 3) local predVis = torch.zeros(dataset.nJoints, 3) local gtVis = torch.zeros(dataset.nJoints, 3) for j = 1, dataset.nJoints do pred[j][1], pred[j][2], pred[j][3] = p[i][j][1], p[i][j][2], z[i][j][1] end local len_pred = 0 local len_gt = 0 for j = 1, dataset.nBones do len_pred = len_pred + ((pred[dataset.skeletonRef[j][1]][1] - pred[dataset.skeletonRef[j][2]][1]) ^ 2 + (pred[dataset.skeletonRef[j][1]][2] - pred[dataset.skeletonRef[j][2]][2]) ^ 2 + (pred[dataset.skeletonRef[j][1]][3] - pred[dataset.skeletonRef[j][2]][3]) ^ 2) ^ 0.5 end len_gt = 4296.99233013 local root = 7 local proot = pred[root]:clone() for j = 1, dataset.nJoints do pred[j][1] = (pred[j][1] - proot[1]) / len_pred * len_gt + gt_3d[root][1] pred[j][2] = (pred[j][2] - proot[2]) / len_pred * len_gt + gt_3d[root][2] pred[j][3] = (pred[j][3] - proot[3]) / len_pred * len_gt + gt_3d[root][3] end -- Fix torsor annotation discripency between h36m and mpii pred[8] = (pred[7] + pred[9]) / 2 for j = 1, dataset.nJoints do local JDis = ((pred[j][1] - gt_3d[j][1]) * (pred[j][1] - gt_3d[j][1]) + (pred[j][2] - gt_3d[j][2]) * (pred[j][2] - gt_3d[j][2]) + (pred[j][3] - gt_3d[j][3]) * (pred[j][3] - gt_3d[j][3])) ^ 0.5 if JDis > opt.PCK_Threshold and not (j == 7 or j == 8) then correct = correct - 1./14 end dis = dis + JDis / p:size(1) end predVis = predVis * 4 gtVis = gtVis * 4 if opt.DEBUG > 2 then pyFunc('Show3d', {gt=gtVis, joint=predVis, img=img, noPause = torch.zeros(1), id = torch.ones(1) * idx[i]}) end elseif tp == 'mpi_inf_3dhp' then local c, s, gt_3d, action, bbox, gt_2d = dataset:getPartInfo(idx[i], tp) local pred = torch.zeros(dataset.nJoints, 3) local predVis = torch.zeros(dataset.nJoints, 3) local gtVis = torch.zeros(dataset.nJoints, 3) for j = 1, dataset.nJoints do pred[j][1], pred[j][2], pred[j][3] = p[i][j][1], p[i][j][2], z[i][j][1] end local shift = (pred[9] - pred[7]) * 0.2 pred[7] = pred[7] + shift pred[3] = pred[3] + shift pred[4] = pred[4] + shift pred[8] = pred[7] + (pred[9] - pred[7]) / 2 local s_pred, s_gt = 0, 0 for j = 1, dataset.nBones do s_pred = s_pred + ((pred[dataset.skeletonRef[j][1]][1] - pred[dataset.skeletonRef[j][2]][1]) ^ 2 + (pred[dataset.skeletonRef[j][1]][2] - pred[dataset.skeletonRef[j][2]][2]) ^ 2 + (pred[dataset.skeletonRef[j][1]][3] - pred[dataset.skeletonRef[j][2]][3]) ^ 2) ^ 0.5 s_gt = s_gt + ((gt_3d[dataset.skeletonRef[j][1]][1] - gt_3d[dataset.skeletonRef[j][2]][1]) ^ 2 + (gt_3d[dataset.skeletonRef[j][1]][2] - gt_3d[dataset.skeletonRef[j][2]][2]) ^ 2 + (gt_3d[dataset.skeletonRef[j][1]][3] - gt_3d[dataset.skeletonRef[j][2]][3]) ^ 2) ^ 0.5 end local root = 7 local proot = pred[root]:clone() local scale = s_pred / s_gt -- print('scale', scale) for j = 1, dataset.nJoints do predVis[j][1], predVis[j][2], predVis[j][3] = pred[j][1], pred[j][2], pred[j][3] gtVis[j] = (gt_3d[j] - gt_3d[root]) * scale + proot pred[j] = (pred[j] - proot) / scale + gt_3d[root] end local curDis = 0 for j = 1, dataset.nJoints do local JDis = ((pred[j][1] - gt_3d[j][1]) * (pred[j][1] - gt_3d[j][1]) + (pred[j][2] - gt_3d[j][2]) * (pred[j][2] - gt_3d[j][2]) + (pred[j][3] - gt_3d[j][3]) * (pred[j][3] - gt_3d[j][3])) ^ 0.5 if JDis > opt.PCK_Threshold and not (j == 7 or j == 8) then correct = correct - 1./ dataset.mpi_inf_3dhp_num_joint end curDis = JDis / p:size(1) + curDis end dis = dis + curDis predVis = predVis * 4 gtVis = gtVis * 4 if opt.DEBUG > 2 and idx[i] % 40 == 1 then pyFunc('Show3d', {gt=gtVis, joint=predVis, img=img, noPause = torch.zeros(1), id = torch.ones(1) * idx[i]}) end end end return dis / dataset.nJoints, correct end
local guide = require 'parser.guide' local vm = require 'vm.vm' local files = require 'files' local function getGlobalsOfFile(uri) local globals = {} local ast = files.getAst(uri) if not ast then return globals end local env = guide.getENV(ast.ast) local results = guide.requestFields(env) for _, res in ipairs(results) do local name = guide.getSimpleName(res) if name then if not globals[name] then globals[name] = {} end globals[name][#globals[name]+1] = res end end return globals end local function getGlobals(name) local results = {} for uri in files:eachFile() do local cache = files.getCache(uri) cache.globals = cache.globals or getGlobalsOfFile(uri) if cache.globals[name] then for _, source in ipairs(cache.globals[name]) do results[#results+1] = source end end end return results end function vm.getGlobals(name) local cache = vm.getCache('getGlobals')[name] if cache ~= nil then return cache end cache = getGlobals(name) vm.getCache('getGlobals')[name] = cache return cache end
local keyboard = {up='up',left='left',right='right',down='down',confirm='enter',attack='a',jump='space'} function keyboard.isPressing(actionKey) return love.keyboard.isDown(keyboard[actionKey]) end function keyboard.getDirection() local x,y if love.keyboard.isDown(keyboard.down) then y=1 elseif love.keyboard.isDown(keyboard.up) then y=-1 else y=0 end if love.keyboard.isDown(keyboard.right) then x=1 elseif love.keyboard.isDown(keyboard.left) then x=-1 else x=0 end return {x=x,y=y} end local joystick = {up='dpup',left='dpleft',right='dpright',down='dpdown',confirm='start',attack='x',jump='a'} function joystick.isPressing(actionKey,axis) return inputData.joy:isGamepadDown(joystick[actionKey]) end function joystick.getDirection() local x,y = inputData.joy:getAxis(1),inputData.joy:getAxis(2) if x>=0.4 then x=1 elseif x<=-0.4 then x=-1 else x=0 end if y>=0.4 then y=1 elseif y<=-0.4 then y=-1 else y=0 end return {x=x,y=y} end inputData = { curr = nil, joy = nil } function inputData.start() inputData.joy = love.joystick.getJoysticks()[1] if inputData.joy == nil then inputData.curr = keyboard else inputData.curr = joystick end end function inputData.isPressing(actionKey) return inputData.curr.isPressing(actionKey) end function inputData.getDirection() return inputData.curr.getDirection() end
--===========================================================================-- -- Greek -- --===========================================================================-- local translit = thirddata.translit local pcache = translit.parser_cache local lpegmatch = lpeg.match -- Note that the Greek transliteration mapping isn't bijective so transliterated -- texts won't be reversible. (Shouldn't be impossible to make one up using -- diacritics on latin characters to represent all possible combinations of -- Greek breathings + accents.) -- Good reading on composed / precombined unicode: -- http://www.tlg.uci.edu/~opoudjis/unicode/unicode_gaps.html#precomposed ------------------------------------------------- -- Lowercase Greek Initial Position Diphthongs -- ------------------------------------------------- if not translit.done_greek then translit.gr_di_in_low = translit.make_add_dict{ [" αὑ"] = " hau", [" αὕ"] = " hau", [" αὓ"] = " hau", [" αὗ"] = " hau", [" εὑ"] = " heu", [" εὕ"] = " heu", [" εὓ"] = " heu", [" εὗ"] = " heu", [" ηὑ"] = " hēu", [" ηὕ"] = " hēu", [" ηὓ"] = " hēu", [" ηὗ"] = " hēu", [" οὑ"] = " hu", [" οὕ"] = " hu", [" οὓ"] = " hu", [" οὗ"] = " hu", [" ωὑ"] = " hōu", [" ωὕ"] = " hōu", [" ωὓ"] = " hōu", [" ωὗ"] = " hōu" } translit.tables["Greek transliteration initial breathing diphthongs lowercase"] = translit.gr_di_in_low ------------------------------------------------- -- Uppercase Greek Initial Position Diphthongs -- ------------------------------------------------- translit.gr_di_in_upp = translit.make_add_dict{ [" Αὑ"] = " Hau", [" Αὕ"] = " Hau", [" Αὓ"] = " Hau", [" Αὗ"] = " Hau", [" Εὑ"] = " Heu", [" Εὕ"] = " Heu", [" Εὓ"] = " Heu", [" Εὗ"] = " Heu", [" Ηὑ"] = " Hēu", [" Ηὕ"] = " Hēu", [" Ηὓ"] = " Hēu", [" Ηὗ"] = " Hēu", [" Οὑ"] = " Hu", [" Οὕ"] = " Hu", [" Οὓ"] = " Hu", [" Οὗ"] = " Hu", [" Ωὑ"] = " Hōu", [" Ωὕ"] = " Hōu", [" Ωὓ"] = " Hōu", [" Ωὗ"] = " Hōu" } translit.tables["Greek transliteration initial breathing diphthongs uppercase"] = translit.gr_di_in_upp --------------------------------------- -- Lowercase Greek Initial Position -- --------------------------------------- translit.gr_in_low = translit.make_add_dict{ [" ἁ"] = " ha", [" ἅ"] = " ha", [" ἃ"] = " ha", [" ἇ"] = " ha", [" ᾁ"] = " ha", [" ᾅ"] = " ha", [" ᾃ"] = " ha", [" ᾇ"] = " ha", [" ἑ"] = " he", [" ἕ"] = " he", [" ἓ"] = " he", [" ἡ"] = " hē", [" ἥ"] = " hē", [" ἣ"] = " hē", [" ἧ"] = " hē", [" ᾑ"] = " hē", [" ᾕ"] = " hē", [" ᾓ"] = " hē", [" ᾗ"] = " hē", [" ἱ"] = " hi", [" ἵ"] = " hi", [" ἳ"] = " hi", [" ἷ"] = " hi", [" ὁ"] = " ho", [" ὅ"] = " ho", [" ὃ"] = " ho", [" ὑ"] = " hy", [" ὕ"] = " hy", [" ὓ"] = " hy", [" ὗ"] = " hy", [" ὡ"] = " hō", [" ὥ"] = " hō", [" ὣ"] = " hō", [" ὧ"] = " hō", [" ᾡ"] = " hō", [" ᾥ"] = " hō", [" ᾣ"] = " hō", [" ᾧ"] = " hō", } translit.tables["Greek transliteration initial breathing lowercase"] = translit.gr_in_low --------------------------------------- -- Uppercase Greek Initial Position -- --------------------------------------- translit.gr_in_upp = translit.make_add_dict{ [" Ἁ"] = " Ha", [" Ἅ"] = " Ha", [" Ἃ"] = " Ha", [" Ἇ"] = " Ha", [" ᾉ"] = " Ha", [" ᾍ"] = " Ha", [" ᾋ"] = " Ha", [" ᾏ"] = " Ha", [" Ἑ"] = " He", [" Ἕ"] = " He", [" Ἓ"] = " He", [" Ἡ"] = " Hē", [" Ἥ"] = " Hē", [" Ἣ"] = " Hē", [" Ἧ"] = " Hē", [" ᾙ"] = " Hē", [" ᾝ"] = " Hē", [" ᾛ"] = " Hē", [" ᾟ"] = " Hē", [" Ἱ"] = " Hi", [" Ἵ"] = " Hi", [" Ἳ"] = " Hi", [" Ἷ"] = " Hi", [" Ὁ"] = " Ho", [" Ὅ"] = " Ho", [" Ὃ"] = " Ho", [" Ὑ"] = " Hy", [" Ὕ"] = " Hy", [" Ὓ"] = " Hy", [" Ὗ"] = " Hy", [" Ὡ"] = " Hō", [" Ὥ"] = " Hō", [" Ὣ"] = " Hō", [" Ὧ"] = " Hō", [" ᾩ"] = " Hō", [" ᾭ"] = " Hō", [" ᾫ"] = " Hō", [" ᾯ"] = " Hō", } translit.tables["Greek transliteration initial breathing uppercase"] = translit.gr_in_upp --------------------------------- -- Lowercase Greek Diphthongs -- --------------------------------- translit.gr_di_low = translit.make_add_dict{ ["αυ"] = "au", ["αύ"] = "au", ["αὺ"] = "au", ["αῦ"] = "au", ["αὐ"] = "au", ["αὔ"] = "au", ["αὒ"] = "au", ["αὖ"] = "au", ["αὑ"] = "au", ["αὕ"] = "au", ["αὓ"] = "au", ["αὗ"] = "au", ["ευ"] = "eu", ["εύ"] = "eu", ["εὺ"] = "eu", ["εῦ"] = "eu", ["εὐ"] = "eu", ["εὔ"] = "eu", ["εὒ"] = "eu", ["εὖ"] = "eu", ["εὑ"] = "eu", ["εὕ"] = "eu", ["εὓ"] = "eu", ["εὗ"] = "eu", ["ηυ"] = "ēu", ["ηύ"] = "ēu", ["ηὺ"] = "ēu", ["ηῦ"] = "ēu", ["ηὐ"] = "ēu", ["ηὔ"] = "ēu", ["ηὒ"] = "ēu", ["ηὖ"] = "ēu", ["ηὑ"] = "ēu", ["ηὕ"] = "ēu", ["ηὓ"] = "ēu", ["ηὗ"] = "ēu", ["ου"] = "u", ["ου"] = "u", ["ου"] = "u", ["ού"] = "u", ["οὺ"] = "u", ["οῦ"] = "u", ["οὐ"] = "u", ["οὔ"] = "u", ["οὒ"] = "u", ["οὖ"] = "u", ["οὑ"] = "u", ["οὕ"] = "u", ["οὓ"] = "u", ["οὗ"] = "u", ["ωυ"] = "ōu", ["ωύ"] = "ōu", ["ωὺ"] = "ōu", ["ωῦ"] = "ōu", ["ωὐ"] = "ōu", ["ωὔ"] = "ōu", ["ωὒ"] = "ōu", ["ωὖ"] = "ōu", ["ωὑ"] = "ōu", ["ωὕ"] = "ōu", ["ωὓ"] = "ōu", ["ωὗ"] = "ōu", ["ῤῥ"] = "rrh", } translit.tables["Greek transliteration diphthongs lowercase"] = translit.gr_in_low --------------------------------- -- Uppercase Greek Diphthongs -- --------------------------------- translit.gr_di_upp = translit.make_add_dict{ ["Αυ"] = "Au", ["Αύ"] = "Au", ["Αὺ"] = "Au", ["Αῦ"] = "Au", ["Αὐ"] = "Au", ["Αὔ"] = "Au", ["Αὒ"] = "Au", ["Αὖ"] = "Au", ["Αὑ"] = "Au", ["Αὕ"] = "Au", ["Αὓ"] = "Au", ["Αὗ"] = "Au", ["Ευ"] = "Eu", ["Εύ"] = "Eu", ["Εὺ"] = "Eu", ["Εῦ"] = "Eu", ["Εὐ"] = "Eu", ["Εὔ"] = "Eu", ["Εὒ"] = "Eu", ["Εὖ"] = "Eu", ["Εὑ"] = "Eu", ["Εὕ"] = "Eu", ["Εὓ"] = "Eu", ["Εὗ"] = "Eu", ["Ηυ"] = "Ēu", ["Ηύ"] = "Ēu", ["Ηὺ"] = "Ēu", ["Ηῦ"] = "Ēu", ["Ηὐ"] = "Ēu", ["Ηὔ"] = "Ēu", ["Ηὒ"] = "Ēu", ["Ηὖ"] = "Ēu", ["Ηὑ"] = "Ēu", ["Ηὕ"] = "Ēu", ["Ηὓ"] = "Ēu", ["Ηὗ"] = "Ēu", ["Ου"] = "U", ["Ου"] = "U", ["Ου"] = "U", ["Ού"] = "U", ["Οὺ"] = "U", ["Οῦ"] = "U", ["Οὐ"] = "U", ["Οὔ"] = "U", ["Οὒ"] = "U", ["Οὖ"] = "U", ["Οὑ"] = "U", ["Οὕ"] = "U", ["Οὓ"] = "U", ["Οὗ"] = "U", ["Ωυ"] = "Ōu", ["Ωύ"] = "Ōu", ["Ωὺ"] = "Ōu", ["Ωῦ"] = "Ōu", ["Ωὐ"] = "Ōu", ["Ωὔ"] = "Ōu", ["Ωὒ"] = "Ōu", ["Ωὖ"] = "Ōu", ["Ωὑ"] = "Ōu", ["Ωὕ"] = "Ōu", ["Ωὓ"] = "Ōu", ["Ωὗ"] = "Ōu", } translit.tables["Greek transliteration diphthongs uppercase"] = translit.gr_in_upp -- The following will be used in an option that ensures transcription of -- nasalization, e.g. Ἁγχίσης -> “Anchises” (instead of “Agchises”) translit.gr_nrule = translit.make_add_dict{ ["γγ"] = "ng", ["γκ"] = "nk", ["γξ"] = "nx", ["γχ"] = "nch", } translit.tables["Greek transliteration optional nasalization"] = translit.gr_nrule -------------------------------------- -- Lowercase Greek Transliteration -- -------------------------------------- translit.gr_low = translit.make_add_dict{ ["α"] = "a", ["ά"] = "a", ["ὰ"] = "a", ["ᾶ"] = "a", ["ᾳ"] = "a", ["ἀ"] = "a", ["ἁ"] = "a", ["ἄ"] = "a", ["ἂ"] = "a", ["ἆ"] = "a", ["ἁ"] = "a", ["ἅ"] = "a", ["ἃ"] = "a", ["ἇ"] = "a", ["ᾁ"] = "a", ["ᾴ"] = "a", ["ᾲ"] = "a", ["ᾷ"] = "a", ["ᾄ"] = "a", ["ᾂ"] = "a", ["ᾅ"] = "a", ["ᾃ"] = "a", ["ᾆ"] = "a", ["ᾇ"] = "a", ["β"] = "b", ["γ"] = "g", ["δ"] = "d", ["ε"] = "e", ["έ"] = "e", ["ὲ"] = "e", ["ἐ"] = "e", ["ἔ"] = "e", ["ἒ"] = "e", ["ἑ"] = "e", ["ἕ"] = "e", ["ἓ"] = "e", ["ζ"] = "z", ["η"] = "ē", ["η"] = "ē", ["ή"] = "ē", ["ὴ"] = "ē", ["ῆ"] = "ē", ["ῃ"] = "ē", ["ἠ"] = "ē", ["ἤ"] = "ē", ["ἢ"] = "ē", ["ἦ"] = "ē", ["ᾐ"] = "ē", ["ἡ"] = "ē", ["ἥ"] = "ē", ["ἣ"] = "ē", ["ἧ"] = "ē", ["ᾑ"] = "ē", ["ῄ"] = "ē", ["ῂ"] = "ē", ["ῇ"] = "ē", ["ᾔ"] = "ē", ["ᾒ"] = "ē", ["ᾕ"] = "ē", ["ᾓ"] = "ē", ["ᾖ"] = "ē", ["ᾗ"] = "ē", ["θ"] = "th", ["ι"] = "i", ["ί"] = "i", ["ὶ"] = "i", ["ῖ"] = "i", ["ἰ"] = "i", ["ἴ"] = "i", ["ἲ"] = "i", ["ἶ"] = "i", ["ἱ"] = "i", ["ἵ"] = "i", ["ἳ"] = "i", ["ἷ"] = "i", ["ϊ"] = "i", ["ΐ"] = "i", ["ῒ"] = "i", ["ῗ"] = "i", ["κ"] = "k", ["λ"] = "l", ["μ"] = "m", ["ν"] = "n", ["ξ"] = "x", ["ο"] = "o", ["ό"] = "o", ["ὸ"] = "o", ["ὀ"] = "o", ["ὄ"] = "o", ["ὂ"] = "o", ["ὁ"] = "o", ["ὅ"] = "o", ["ὃ"] = "o", ["π"] = "p", ["ρ"] = "r", ["ῤ"] = "r", ["ῥ"] = "rh", ["σ"] = "s", ["ς"] = "s", ["τ"] = "t", ["υ"] = "y", ["ύ"] = "y", ["ὺ"] = "y", ["ῦ"] = "y", ["ὐ"] = "y", ["ὔ"] = "y", ["ὒ"] = "y", ["ὖ"] = "y", ["ὑ"] = "y", ["ὕ"] = "y", ["ὓ"] = "y", ["ὗ"] = "y", ["ϋ"] = "y", ["ΰ"] = "y", ["ῢ"] = "y", ["ῧ"] = "y", ["φ"] = "ph", ["χ"] = "ch", ["ψ"] = "ps", ["ω"] = "ō", ["ώ"] = "ō", ["ὼ"] = "ō", ["ῶ"] = "ō", ["ῳ"] = "ō", ["ὠ"] = "ō", ["ὤ"] = "ō", ["ὢ"] = "ō", ["ὦ"] = "ō", ["ᾠ"] = "ō", ["ὡ"] = "ō", ["ὥ"] = "ō", ["ὣ"] = "ō", ["ὧ"] = "ō", ["ᾡ"] = "ō", ["ῴ"] = "ō", ["ῲ"] = "ō", ["ῷ"] = "ō", ["ᾤ"] = "ō", ["ᾢ"] = "ō", ["ᾥ"] = "ō", ["ᾣ"] = "ō", ["ᾦ"] = "ō", ["ᾧ"] = "ō", } translit.tables["Greek transliteration lowercase"] = translit.gr_low -------------------------------------- -- Uppercase Greek Transliteration -- -------------------------------------- translit.gr_upp = translit.make_add_dict{ ["Α"] = "A", ["Ά"] = "A", ["Ὰ"] = "A", --["ᾶ"] = "A", ["ᾼ"] = "A", ["Ἀ"] = "A", ["Ἁ"] = "A", ["Ἄ"] = "A", ["Ἂ"] = "A", ["Ἆ"] = "A", ["Ἁ"] = "A", ["Ἅ"] = "A", ["Ἃ"] = "A", ["Ἇ"] = "A", ["ᾉ"] = "A", --["ᾴ"] = "A", -- I’d be very happy if anybody could explain to me --["ᾲ"] = "A", -- why there's Ά, ᾌ and ᾼ but no “A + iota subscript --["ᾷ"] = "A", -- + acute” …, same for Η, Υ and Ω + diacritica. ["ᾌ"] = "A", ["ᾊ"] = "A", ["ᾍ"] = "A", ["ᾋ"] = "A", ["ᾎ"] = "A", ["ᾏ"] = "A", ["Β"] = "B", ["Γ"] = "G", ["Δ"] = "D", ["Ε"] = "E", ["Έ"] = "E", ["Ὲ"] = "E", ["Ἐ"] = "E", ["Ἔ"] = "E", ["Ἒ"] = "E", ["Ἑ"] = "E", ["Ἕ"] = "E", ["Ἓ"] = "E", ["Ζ"] = "Z", ["Η"] = "Ē", ["Η"] = "Ē", ["Ή"] = "Ē", ["Ὴ"] = "Ē", --["ῆ"] = "Ē", ["ῌ"] = "Ē", ["Ἠ"] = "Ē", ["Ἤ"] = "Ē", ["Ἢ"] = "Ē", ["Ἦ"] = "Ē", ["ᾘ"] = "Ē", ["Ἡ"] = "Ē", ["Ἥ"] = "Ē", ["Ἣ"] = "Ē", ["Ἧ"] = "Ē", ["ᾙ"] = "Ē", --["ῄ"] = "Ē", --["ῂ"] = "Ē", --["ῇ"] = "Ē", ["ᾜ"] = "Ē", ["ᾚ"] = "Ē", ["ᾝ"] = "Ē", ["ᾛ"] = "Ē", ["ᾞ"] = "Ē", ["ᾟ"] = "Ē", ["Θ"] = "Th", ["Ι"] = "I", ["Ί"] = "I", ["Ὶ"] = "I", --["ῖ"] = "I", ["Ἰ"] = "I", ["Ἴ"] = "I", ["Ἲ"] = "I", ["Ἶ"] = "I", ["Ἱ"] = "I", ["Ἵ"] = "I", ["Ἳ"] = "I", ["Ἷ"] = "I", ["Ϊ"] = "I", --["ΐ"] = "I", --["ῒ"] = "I", --["ῗ"] = "I", ["Κ"] = "K", ["Λ"] = "L", ["Μ"] = "M", ["Ν"] = "N", ["Ξ"] = "X", ["Ο"] = "O", ["Ό"] = "O", ["Ὸ"] = "O", ["Ὀ"] = "O", ["Ὄ"] = "O", ["Ὂ"] = "O", ["Ὁ"] = "O", ["Ὅ"] = "O", ["Ὃ"] = "O", ["Π"] = "P", ["Ρ"] = "R", --["ῤ"] = "R", ["Ῥ"] = "Rh", ["Σ"] = "S", ["Σ"] = "S", ["Τ"] = "T", ["Υ"] = "Y", ["Ύ"] = "Y", ["Ὺ"] = "Y", --["ῦ"] = "Y", --["ὐ"] = "Y", --["ὔ"] = "Y", --["ὒ"] = "Y", --["ὖ"] = "Y", ["Ὑ"] = "Y", ["Ὕ"] = "Y", ["Ὓ"] = "Y", ["Ὗ"] = "Y", ["Ϋ"] = "Y", --["ΰ"] = "Y", --["ῢ"] = "Y", --["ῧ"] = "Y", ["Φ"] = "Ph", ["Χ"] = "Ch", ["Ψ"] = "Ps", ["Ω"] = "Ō", ["Ώ"] = "Ō", ["Ὼ"] = "Ō", --["ῶ"] = "Ō", ["ῼ"] = "Ō", ["Ὠ"] = "Ō", ["Ὤ"] = "Ō", ["Ὢ"] = "Ō", ["Ὦ"] = "Ō", ["ᾨ"] = "Ō", ["Ὡ"] = "Ō", ["Ὥ"] = "Ō", ["Ὣ"] = "Ō", ["Ὧ"] = "Ō", ["ᾩ"] = "Ō", --["ῴ"] = "Ō", --["ῲ"] = "Ō", --["ῷ"] = "Ō", ["ᾬ"] = "Ō", ["ᾪ"] = "Ō", ["ᾭ"] = "Ō", ["ᾫ"] = "Ō", ["ᾮ"] = "Ō", ["ᾯ"] = "Ō", } translit.tables["Greek transliteration uppercase"] = translit.gr_upp ------------ -- Varia -- ------------ translit.gr_other = translit.make_add_dict{ ["ϝ"] = "w", ["Ϝ"] = "W", ["ϙ"] = "q", ["Ϙ"] = "Q", ["ϡ"] = "ss", ["Ϡ"] = "Ss", } translit.tables["Greek transliteration archaic characters"] = translit.gr_other translit.done_greek = true end --===========================================================================-- -- End Of Tables -- --===========================================================================-- local function greek (mode, text) local P, V, Cs = lpeg.P, lpeg.V, lpeg.Cs local addrules = translit.addrules local utfchar = translit.utfchar if mode == "gr" or mode == "gr_n" then local gr_di_in, gr_in, gr_di, gr = translit.make_add_dict{}, translit.make_add_dict{}, translit.make_add_dict{}, translit.make_add_dict{} gr_di_in = gr_di_in + translit.gr_di_in_low + translit.gr_di_in_upp gr_in = gr_in + translit.gr_in_low + translit.gr_in_upp gr_di = gr_di + translit.gr_di_low + translit.gr_di_upp gr = gr + translit.gr_low + translit.gr_upp + translit.gr_other if mode == "gr_n" then gr_di = gr_di + translit.gr_nrule end local p_di_in, p_in, p_di, p p_di_in = addrules( gr_di_in, p_di_in ) p_in = addrules( gr_in, p_in ) p_di = addrules( gr_di, p_di ) p = addrules( gr, p ) local g = P{ -- 2959 rules Cs((V"init_diph" + V"init" + V"diph" + V"other" + utfchar )^0), init_diph = Cs(p_di_in / gr_di_in ), init = Cs(p_in / gr_in ), diph = Cs(p_di / gr_di ), other = Cs(p / gr ), } return g end end translit.methods["gr"] = function (text) p = pcache["gr"] if not p then p = greek("gr") pcache["gr"] = p end return lpegmatch(p, text) end translit.methods["gr_n"] = function (text) p = pcache["gr_n"] if not p then p = greek("gr_n") pcache["gr_n"] = p end return lpegmatch(p, text) end -- vim:ft=lua:sw=4:ts=4
TOOL.Category = "Construction" TOOL.Name = "#tool.balloon.name" TOOL.ClientConVar[ "ropelength" ] = "64" TOOL.ClientConVar[ "force" ] = "500" TOOL.ClientConVar[ "r" ] = "255" TOOL.ClientConVar[ "g" ] = "255" TOOL.ClientConVar[ "b" ] = "0" TOOL.ClientConVar[ "model" ] = "models/MaxOfS2D/balloon_classic.mdl" cleanup.Register( "balloons" ) function TOOL:LeftClick( trace, attach ) if ( IsValid( trace.Entity ) && trace.Entity:IsPlayer() ) then return false end if ( CLIENT ) then return true end -- -- Right click calls this with attach = false -- if ( attach == nil ) then attach = true end -- If there's no physics object then we can't constraint it! if ( SERVER && attach && !util.IsValidPhysicsObject( trace.Entity, trace.PhysicsBone ) ) then return false end local ply = self:GetOwner() local length = self:GetClientNumber( "ropelength", 64 ) local material = "cable/rope" local force = self:GetClientNumber( "force", 500 ) local r = self:GetClientNumber( "r", 255 ) local g = self:GetClientNumber( "g", 0 ) local b = self:GetClientNumber( "b", 0 ) local model = self:GetClientInfo( "model" ) local modeltable = list.Get( "BalloonModels" )[model] -- -- Model is a table index on BalloonModels -- If the model isn't defined then it can't be spawned. -- if ( !modeltable ) then return false end -- -- The model table can disable colouring for its model -- if ( modeltable.nocolor ) then r = 255 g = 255 b = 255 end -- -- Clicked on a balloon - modify the force/color/whatever -- if ( IsValid( trace.Entity) && trace.Entity:GetClass() == "gmod_balloon" && trace.Entity.Player == ply )then local force = self:GetClientNumber( "force", 500 ) trace.Entity:GetPhysicsObject():Wake() trace.Entity:SetColor( Color( r, g, b, 255 ) ) trace.Entity:SetForce( force ) trace.Entity.force = force return true end -- -- Hit the balloon limit, bail -- if ( !self:GetSWEP():CheckLimit( "balloons" ) ) then return false end local Pos = trace.HitPos + trace.HitNormal * 10 local balloon = MakeBalloon( ply, r, g, b, force, { Pos = Pos, Model = modeltable.model, Skin = modeltable.skin } ) undo.Create("Balloon") undo.AddEntity( balloon ) if ( attach ) then -- The real model should have an attachment! local attachpoint = Pos + Vector( 0, 0, 0 ) local LPos1 = balloon:WorldToLocal( attachpoint ) local LPos2 = trace.Entity:WorldToLocal( trace.HitPos ) if ( IsValid( trace.Entity) ) then local phys = trace.Entity:GetPhysicsObjectNum( trace.PhysicsBone ) if ( IsValid( phys ) ) then LPos2 = phys:WorldToLocal( trace.HitPos ) end end local constraint, rope = constraint.Rope( balloon, trace.Entity, 0, trace.PhysicsBone, LPos1, LPos2, 0, length, 0, 0.5, material, nil ) undo.AddEntity( rope ) undo.AddEntity( constraint ) ply:AddCleanup( "balloons", rope ) ply:AddCleanup( "balloons", constraint ) end undo.SetPlayer( ply ) undo.Finish() ply:AddCleanup( "balloons", balloon ) return true end function TOOL:RightClick( trace ) return self:LeftClick( trace, false ) end function TOOL.BuildCPanel( CPanel ) CPanel:AddControl( "Header", { Text = "#tool.balloon.name", Description = "#tool.balloon.help" } ) CPanel:AddControl( "ComboBox", { Label = "#tool.presets", MenuButton = 1, Folder = "balloon", CVars = { "balloon_ropelength", "balloon_force", "balloon_r", "balloon_g", "balloon_b", "balloon_skin" } } ) CPanel:AddControl( "Slider", { Label = "#tool.balloon.ropelength", Type = "Float", Command = "balloon_ropelength", Min = "5", Max = "1000" } ) CPanel:AddControl( "Slider", { Label = "#tool.balloon.force", Type = "Float", Command = "balloon_force", Min = "-1000", Max = "2000", Help = true } ) CPanel:AddControl( "Color", { Label = "#tool.balloon.color", Red = "balloon_r", Green = "balloon_g", Blue = "balloon_b", ShowAlpha = "0", ShowHSV = "1", ShowRGB = "1" } ) CPanel:AddControl( "PropSelect", { Label = "#tool.balloon.model", ConVar = "balloon_model", Height = 6, ModelsTable = list.Get( "BalloonModels" ) } ) end function MakeBalloon( pl, r, g, b, force, Data ) if ( IsValid( pl ) && !pl:CheckLimit( "balloons" ) ) then return nil end local balloon = ents.Create( "gmod_balloon" ) if ( !balloon:IsValid() ) then return end duplicator.DoGeneric( balloon, Data ) balloon:Spawn() duplicator.DoGenericPhysics( balloon, pl, Data ) balloon:SetRenderMode( RENDERMODE_TRANSALPHA ) balloon:SetColor( Color( r, g, b, 255 ) ) balloon:SetForce( force ) balloon:SetPlayer( pl ) balloon:SetMaterial( skin ) balloon.Player = pl balloon.r = r balloon.g = g balloon.b = b balloon.force = force if ( IsValid( pl ) ) then pl:AddCount( "balloons", balloon ) end return balloon end duplicator.RegisterEntityClass( "gmod_balloon", MakeBalloon, "r", "g", "b", "force", "Data" ) list.Set( "BalloonModels", "normal", { model = "models/MaxOfS2D/balloon_classic.mdl", skin = 0, }) list.Set( "BalloonModels", "normal_skin1", { model = "models/MaxOfS2D/balloon_classic.mdl", skin = 1, }) list.Set( "BalloonModels", "normal_skin2", { model = "models/MaxOfS2D/balloon_classic.mdl", skin = 2, }) list.Set( "BalloonModels", "normal_skin3", { model = "models/MaxOfS2D/balloon_classic.mdl", skin = 3, }) list.Set( "BalloonModels", "gman", { model = "models/MaxOfS2D/balloon_gman.mdl", nocolor = true, }) list.Set( "BalloonModels", "mossman", { model = "models/MaxOfS2D/balloon_mossman.mdl", nocolor = true, })
local ROC = {} -- the original version had a problem, as it was not using all the thresholds. In Sklearn they use all the unique values as threshold, and thus the results are slightly lower, but (I think) more correct. -- anyway now this script matches the sklearn so the reported results are comparable. You can change it back to the old version by uncommenting lines 20-22 and 81-86. --Narges -- auxiliary method that quickly simulates the ROC curve computation -- just to estimate how many points the curve will have, -- in order to later allocate just that much memory local function determine_roc_points_needed(responses_sorted, labels_sorted) local npoints = 1 local i = 1 local nsamples = responses_sorted:size()[1] while i<nsamples do local split = responses_sorted[i] while i <= nsamples and responses_sorted[i] == split do i = i+1 end -- while i <= nsamples and labels_sorted[i] == -1 do -- i = i+1 -- end npoints = npoints + 1 end return npoints + 2 end function ROC.points(responses1, labels1) --responses are 100x1 --targets are 100x1 responses = responses1:clone():squeeze():float() labels = labels1:clone():squeeze():float() -- print(responses) -- print(labels) -- --{turning labels from 0,1 to -1,1} labels[torch.lt(labels,0.5)]= -1 -- assertions about the data format expected assert(responses:size():size() == 1, "responses should be a 1D vector") assert(labels:size():size() == 1 , "labels should be a 1D vector") -- assuming labels {-1, 1} local npositives = torch.sum(torch.eq(labels, 1)) local nnegatives = torch.sum(torch.eq(labels, -1)) local nsamples = npositives + nnegatives -- print(nsamples) assert(nsamples == responses:size()[1], "labels should have same length as responses") -- sort by response value local responses_sorted, indexes_sorted = torch.sort(responses) local labels_sorted = labels:index(1, indexes_sorted) -- one could allocate a lua table and grow its size dynamically -- and at the end convert to torch tensor, but here I am chosing -- to allocate only the exact memory needed, and doing two passes -- over the data to estimate first how many points will need local roc_num_points = determine_roc_points_needed(responses_sorted, labels_sorted) local roc_points = torch.Tensor(roc_num_points, 2) roc_points[1][1], roc_points[1][2] = 0.0, 0.0 local npoints = 1 local true_negatives = 0 local false_negatives = 0 local i = 1 while i<nsamples do local split = responses_sorted[i] -- if samples have exactly the same response, can't distinguish -- between them with a threshold in the middle while i <= nsamples and responses_sorted[i] == split do if labels_sorted[i] == -1 then true_negatives = true_negatives + 1 else false_negatives = false_negatives + 1 end i = i+1 end -- while i <= nsamples and labels_sorted[i] == -1 do -- print(i) -- true_negatives = true_negatives + 1 -- print('tnn') -- i = i+1 -- end npoints = npoints + 1 local false_positives = nnegatives - true_negatives local true_positives = npositives - false_negatives local false_positive_rate = (1.0*false_positives)/nnegatives local true_positive_rate = (1.0*true_positives)/npositives roc_points[roc_num_points - npoints + 1][1] = false_positive_rate roc_points[roc_num_points - npoints + 1][2] = true_positive_rate end roc_points[roc_num_points][1], roc_points[roc_num_points][2] = 1.0, 1.0 return roc_points end function ROC.area(roc_points) local area = 0.0 local npoints = roc_points:size()[1] for i=1, npoints-1 do local width = (roc_points[i+1][1] - roc_points[i][1]) local avg_height = (roc_points[i][2]+roc_points[i+1][2])/2.0 area = area + width*avg_height end return area end return ROC
-- {{{ Globals json = require("goluago/encoding/json") strings = require("goluago/strings") word_sep_chars = "()[]{}\"\'\\/ " word_sep_chars_with_punctuation = "()[]{}.\"\'\\/ _-" word_chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789._-" buffers = {} keymaps = {} settings = {} commands = {} root_window = nil current_window = nil keys_entered = key("") _message = "" _message_type = "info" string.join = function(arr, sep) local ret = arr[1] or "" for i = 2, #arr, 1 do ret = ret..sep..arr[i] end return ret end string.contains_char = function(chars, c) for i = 1, #chars, 1 do if c == string.sub(chars, i, i) then return true end end return false end string.find_char_index = function(str, chars) for i = 1, #str, 1 do if string.contains_char(chars, string.sub(str, i, i)) then return i end end return 0 end id_counter = 0 function next_id() id_counter = id_counter + 1 return id_counter end function debug_value(value) screen_quit() if type(value) == "table" then print(json.marshal(value)) else print(value) end os.exit(1) end function chain(a, b, c) return function(...) if a then a(...) end if b then b(...) end if c then c(...) end end end function message(message, message_type) -- get if not message then return _message end -- set _message = message if message_type then _message_type = message_type else _message_type = "info" end end -- }}} -- {{{ Color schemes styles = { line_number = style("yellow"); status_line = style("black,white"); cursor = style("black,white"); identifier = style(""); message_info = style(""); message_warning = style("brightyellow"); message_error = style("brightred"); } function style_for(name) return styles[name] or style("default") end -- }}} -- {{{ Window win_type_hori = "win_type_hori" win_type_vert = "win_type_vert" win_type_leaf = "win_type_leaf" function win_new(typ, a, b) local w if typ == win_type_leaf then w = { buffer = a; scroll_line = 1 } elseif typ == win_type_hori then w = { top = a; bottom = b } elseif typ == win_type_vert then w = { left = a; right = b } else error("win_new: given invalid type") end w.typ = typ w.id = next_id() return w end -- }}} -- {{{ Buffer function buf_new(name, path) return { id = next_id(); name = name; path = path; modified = false; major_mode = "normal"; minor_modes = {}; lines = {""}; x = 1; y = 1; settings = {}; } end function buffer_load(path) local path_parts = strings.split(path, "/") local b = buf_new(path_parts[#path_parts], path) ok, contents = pcall(file_read_all, path) if not ok then message(contents, "error") return end b.lines = strings.split(contents, "\n") if b.lines[#b.lines] == "" then table.remove(b.lines, #b.lines) end table.insert(buffers, b) return b end function buffer_save(b) if not b.path then message("Current buffer has no file path set. Use ':write <name>' to specify one", "warning") return end ok, err_message = pcall(file_write_all, b.path, string.join(b.lines, "\n")) if not ok then message(err_message, "error") return end b.modified = false message("Written buffer to '"..b.path.."'") end function buffer_set_path(b, path) local path_parts = strings.split(path, "/") b.name = path_parts[#path_parts] b.path = path end function buffer_move_to(win, x, y) local b = win.buffer b.y = math.max(1, math.min(y, #b.lines)) -- y first b.x = math.max(1, math.min(x, #b.lines[b.y]+1)) end function buffer_move(win, xmov, ymov) local b = win.buffer buffer_move_to(win, win.buffer.x+xmov, win.buffer.y+ymov) end function buffer_move_left(win) buffer_move(win, -1, 0) end function buffer_move_right(win) buffer_move(win, 1, 0) end function buffer_move_up(win) buffer_move(win, 0, -1) end function buffer_move_down(win) buffer_move(win, 0, 1) end function buffer_move_start(win) buffer_move_to(win, 0, 0) end function buffer_move_end(win) buffer_move_to(win, 0, #win.buffer.lines) end function buffer_move_line_start(win) buffer_move_to(win, 0, win.buffer.y) end function buffer_move_line_end(win) local b = win.buffer buffer_move_to(win, #b.lines[b.y]+1, b.y) end -- skip word separators till 1st word char function _buffer_move_to_word_char(win) local line = string.sub(win.buffer.lines[win.buffer.y], win.buffer.x) local index = string.find_char_index(line, word_chars) if index ~= 0 then buffer_move(win, index-1, 0) end end -- skip current word till 1st word separator function _buffer_move_to_word_separator(win, line_extra) local line = string.sub(win.buffer.lines[win.buffer.y], win.buffer.x)..(line_extra or "") local index = string.find_char_index(line, word_sep_chars) if index ~= 0 then buffer_move(win, index-1, 0) end end function _buffer_move_word_start(win, first_call) local initial_x = win.buffer.x _buffer_move_to_word_separator(win) _buffer_move_to_word_char(win) -- if we didn't move, go to next line if initial_x == win.buffer.x and first_call then buffer_move_to(win, 0, win.buffer.y+1) _buffer_move_word_start(win, false) end end function buffer_move_word_start(win) _buffer_move_word_start(win, true) end function _buffer_move_word_end(win, first_call) local initial_x = win.buffer.x buffer_move(win, 1, 0) -- skip word last char _buffer_move_to_word_char(win) _buffer_move_to_word_separator(win, " ") if win.buffer.x > initial_x+1 then buffer_move(win, -1, 0) else if first_call then -- if we didn't move, go to next line buffer_move_to(win, 0, win.buffer.y+1) _buffer_move_word_end(win, false) end end end function buffer_move_word_end(win) _buffer_move_word_end(win, true) end function _buffer_move_word_start_backwards(win, first_call) local initial_x = win.buffer.x local line = string.reverse(string.sub(win.buffer.lines[win.buffer.y], 1, win.buffer.x-1)) local index = string.find_char_index(line, word_chars) if index ~= 0 then buffer_move(win, 0-index, 0) end line = string.reverse(string.sub(win.buffer.lines[win.buffer.y], 1, win.buffer.x-1)).." " index = string.find_char_index(line, word_sep_chars) if index ~= 0 then buffer_move(win, 0-index+1, 0) end if initial_x == win.buffer.x and first_call then buffer_move_up(win) buffer_move_line_end(win) _buffer_move_word_start_backwards(win, false) end end function buffer_move_word_start_backwards(win) _buffer_move_word_start_backwards(win, true) end function buffer_move_jump_up(win) buffer_move(win, 0, -15) end function buffer_move_jump_down(win) buffer_move(win, 0, 15) end function buffer_center(win) win.buffer.frame_centered = true end function _buffer_insert(win, text) local b = win.buffer local line = b.lines[b.y] b.lines[b.y] = string.sub(line, 0, b.x-1)..text..string.sub(line, b.x) buffer_move(win, #text, 0) b.modified = true end function buffer_insert(win, k) local text = key_str(k) _buffer_insert(win, text) end function buffer_insert_tab(win) _buffer_insert(win, " ") end function buffer_insert_space(win) _buffer_insert(win, " ") end function buffer_insert_return(win) local b = win.buffer local line = b.lines[b.y] b.lines[b.y] = string.sub(line, 0, b.x-1) table.insert(b.lines, win.buffer.y+1, string.sub(line, b.x)) buffer_move_to(win, 0, b.y+1) b.modified = true end function buffer_insert_newline_up(win) table.insert(win.buffer.lines, win.buffer.y, "") buffer_move(win, 0, 0) win.buffer.modified = true end function buffer_insert_newline_down(win) table.insert(win.buffer.lines, win.buffer.y+1, "") buffer_move(win, 0, 1) win.buffer.modified = true end function buffer_delete_char(win) local b = win.buffer local line = b.lines[b.y] if b.x > 1 then b.lines[b.y] = string.sub(line, 0, b.x-1)..string.sub(line, b.x+1) buffer_move(win, 0, 0) elseif b.y > 1 then local prev_line_len = #b.lines[b.y-1] b.lines[b.y-1] = b.lines[b.y-1]..b.lines[b.y] table.remove(b.lines, b.y) buffer_move_to(win, prev_line_len+1, b.y-1) elseif b.x == 1 then b.lines[b.y] = string.sub(line, 0, b.x-1)..string.sub(line, b.x+1) buffer_move(win, 0, 0) else -- we are at beginning or line, first line, can't delete anything return end b.modified = true end function buffer_delete_line(win) table.remove(win.buffer.lines, win.buffer.y) buffer_move(win, 0, 0) win.buffer.modified = true end -- }}} -- {{{ Display function display_window_leaf(win, x, y, w, h) if win == current_window then frame(win, w, h) end local b = win.buffer local s = style_for("identifier") local sln = style_for("line_number") local gutter_w = #tostring(#b.lines)+1 local screen_y = y -- contents for line = win.scroll_line, #b.lines, 1 do screen_write(sln, x, screen_y, pad_left(tostring(line), gutter_w-1, " ")) screen_write(s, x+gutter_w, screen_y, b.lines[line]) if screen_y >= h-1 then -- (-1) for status line break end screen_y = screen_y + 1 end -- write cursor local sc = style_for("cursor") local ch = string.sub(b.lines[b.y].." ", b.x, b.x) screen_write(sc, x+gutter_w+b.x-1, y+b.y-win.scroll_line, ch) -- status line local ssl = style_for("status_line") local text = " "..b.name.." "..b.x..":"..b.y.."/"..#b.lines screen_write(ssl, x, y+h-1, pad_right(text, w, " ")) end function display_window(win, x, y, w, h) if win.typ == win_type_leaf then display_window_leaf(win, x, y, w, h) else error("don't know how to display window") end end function display_bottom_bar(y, width) local s = style_for("message_".._message_type) screen_write(s, 0, y, " ".._message) local text_right = key_str(keys_entered) screen_write(s, width-#text_right-1, y, text_right) end function display() local width, height = screen_size() screen_clear() display_window(root_window, 0, 0, width, height-1) display_bottom_bar(height-1, width) screen_show() end -- scroll window if needed to still show cursor function frame(win, width, height) local b = win.buffer -- After "z z" was pressed if b.frame_centered then b.frame_centered = false win.scroll_line = math.max(b.y - math.floor((height-1)/2), 1) return end -- to low -- (height-1) as height includes status bar -- (scroll_line-1) as scroll_line is 1 based if b.y > height-1 + win.scroll_line-1 then win.scroll_line = math.max(b.y - height-1 + 2, 0) + 1 end -- to high if b.y < win.scroll_line then win.scroll_line = b.y end end -- }}} -- {{{ Keymap function keymap_new(name) return { id = next_id(); name = name; bindings = {}; } end function create_keymap(name) keymaps[name] = keymap_new(name) end function bind(keymap_name, k, func) if not keymaps[keymap_name] then message("bind: '"..keymap_name.."' is not a registered keymap", "error") return end if type(k) ~= "userdata" then message("bind: not given a key but a '"..type(k).."'", "error") return end keymaps[keymap_name].bindings[k] = func end function enter_normal_mode(win) if win.buffer.major_mode == "insert" then buffer_move_left(win) end win.buffer.major_mode = "normal" end function enter_insert_mode(win) win.buffer.major_mode = "insert" end function enter_command_mode(win) message(":") win.buffer.major_mode = "command" end catchall_key = key("c a t c h a l l") create_keymap("normal") bind("normal", key("h"), buffer_move_left) bind("normal", key("j"), buffer_move_down) bind("normal", key("k"), buffer_move_up) bind("normal", key("l"), buffer_move_right) bind("normal", key("g g"), buffer_move_start) bind("normal", key("G"), buffer_move_end) bind("normal", key("0"), buffer_move_line_start) bind("normal", key("^"), buffer_move_line_start) -- should skip whitespace bind("normal", key("$"), buffer_move_line_end) bind("normal", key("w"), buffer_move_word_start) bind("normal", key("W"), buffer_move_word_start) -- should include punctuation bind("normal", key("e"), buffer_move_word_end) bind("normal", key("E"), buffer_move_word_end) -- should include punctuation bind("normal", key("b"), buffer_move_word_start_backwards) bind("normal", key("B"), buffer_move_word_start_backwards) -- should include punctuation bind("normal", key("C-u"), buffer_move_jump_up) bind("normal", key("C-d"), buffer_move_jump_down) bind("normal", key("z z"), buffer_center) bind("normal", key("x"), buffer_delete_char) bind("normal", key("d d"), buffer_delete_line) bind("normal", key("i"), enter_insert_mode) bind("normal", key(":"), enter_command_mode) bind("normal", key("a"), chain(buffer_move_right, enter_insert_mode)) bind("normal", key("A"), chain(buffer_move_line_end, enter_insert_mode)) bind("normal", key("o"), chain(buffer_insert_newline_down, enter_insert_mode)) bind("normal", key("O"), chain(buffer_insert_newline_up, enter_insert_mode)) bind("normal", key("ESC"), function() end) bind("normal", key("C-g"), function() end) create_keymap("insert") bind("insert", key("ESC"), enter_normal_mode) bind("insert", key("RET"), buffer_insert_return) bind("insert", key("SPC"), buffer_insert_space) bind("insert", key("TAB"), buffer_insert_tab) bind("insert", key("BAK2"), chain(buffer_move_left, buffer_delete_char)) bind("insert", key("DEL"), buffer_delete_char) bind("insert", catchall_key, buffer_insert) create_keymap("command") function cmd_exit_command_mode(win, k) message("") enter_normal_mode(win, k) end bind("command", key("ESC"), cmd_exit_command_mode) bind("command", key("C-c"), cmd_exit_command_mode) bind("command", key("C-g"), cmd_exit_command_mode) bind("command", key("RET"), function(win, k) local command_text = string.sub(message(), 2) local command_parts = strings.split(command_text, " ") local command_name = table.remove(command_parts, 1) local command = commands[command_name] if command then command.fn(command_parts) if string.sub(message(), 1, 1) == ":" then message("") end else message("Unknown command '"..command_name.."'", "warning") end enter_normal_mode(win, k) end) bind("command", key("BAK2"), function(win, k) if message() ~= ":" then message(string.sub(message(), 1, #message()-1)) end end) bind("command", catchall_key, function(win, k) local text = key_str(k) if #text == 1 then message(message()..text) end end) -- }}} -- {{{ Commands function cmd_new(name, fn, completion_fn) return { id = next_id(); name = name; fn = fn; completion_fn = completion_fn; } end function add_command(name, fn, completion_fn) commands[name] = cmd_new(name, fn, completion_fn) end function alt_command(alias, name) if not commands[name] then message("alias_command: no command named '"..name.."'", "error") return end commands[alias] = commands[name] end function cmd_quit() local b = current_window.buffer if b.modified then message("Buffer '"..b.name.."' has unsaved changes, save it first or use ':quit!'", "error") return end for i, v in ipairs(buffers) do if v.id == b.id then table.remove(buffers, i) end end if #buffers == 0 then -- quit when no buffer is left screen_quit() os.exit(0) else -- else, switch to buffer left -- TODO better window swap root_window = win_new(win_type_leaf, buffers[1]) current_window = root_window end end function cmd_force_quit() screen_quit() os.exit(0) end function cmd_edit(args) local new_buffer = buffer_load(args[1]) root_window = win_new(win_type_leaf, new_buffer) current_window = root_window end function cmd_write(args) local b = current_window.buffer if args[1] then buffer_set_path(b, args[1]) end buffer_save(b) end add_command("quit", cmd_quit) alt_command("q", "quit") alt_command("close", "quit") add_command("quit!", cmd_force_quit) alt_command("q!", "quit!") add_command("edit", cmd_edit) alt_command("e", "edit") alt_command("ed", "edit") alt_command("open", "edit") alt_command("o", "edit") add_command("write", cmd_write) alt_command("w", "write") add_command("wq", chain(cmd_write, cmd_quit)) -- }}} -- {{{ Main loop function main() -- Load files in ARGS for i = 2, #ARGS, 1 do buffer_load(ARGS[i]) end if #buffers == 0 then local scratch_buffer = buf_new("*scratch*") table.insert(buffers, scratch_buffer) end -- Show first buffer in root window root_window = win_new(win_type_leaf, buffers[1]) current_window = root_window keys_entered = key("") local next_key = screen_next_key() while true do if next_key then keys_entered = key_append(keys_entered, next_key) local current_keymap = keymaps[current_window.buffer.major_mode] local catchall_handler local key_used = false for k,v in pairs(current_keymap.bindings) do if key_matches_part(keys_entered, k) then v(current_window, k) keys_entered = key("") key_used = true break end if key_matches(k, catchall_key) then catchall_handler = v end end if not key_used and catchall_handler then catchall_handler(current_window, keys_entered) keys_entered = key("") end end display() next_key = screen_next_key() end end main() -- }}}
-- nvim-mapper local M = {} -- Set a mapping local function map(virtual, buffnr, mode, keys, cmd, options, category, unique_identifier, description) if vim.g.mapper_records == nil then vim.g.mapper_records = {} end local buffer_only if buffnr == nil then buffer_only = false else buffer_only = true end local record = { mode = mode, keys = keys, cmd = cmd, options = options, category = category, unique_identifier = unique_identifier, description = description, buffer_only = buffer_only } local new_records = vim.g.mapper_records -- Check unique_identifier collisons local already_defined = false for i, _ in pairs(vim.g.mapper_records) do local other_record = vim.g.mapper_records[i] if (other_record.unique_identifier == unique_identifier) then already_defined = true -- If the exact same mapping exists, do not redefine -- If the same unique_identifier exists but the rest is not the same, print error if (other_record.mode == mode and other_record.keys == keys and other_record.cmd == cmd and other_record.category == category and other_record.description == description) then else print( "Mapper error : unique identifier " .. unique_identifier .. " cannot be used twice") end end end if not already_defined then table.insert(new_records, record) end vim.g.mapper_records = new_records -- Set the mapping if not virtual then if buffnr ~= nil then vim.api.nvim_buf_set_keymap(buffnr, mode, keys, cmd, options) else vim.api.nvim_set_keymap(mode, keys, cmd, options) end end end -- Set a buffer mapping function M.map_buf(buffnr, mode, keys, cmd, options, category, unique_identifier, description) map(false, buffnr, mode, keys, cmd, options, category, unique_identifier, description) end -- Set a global mapping function M.map(mode, keys, cmd, options, category, unique_identifier, description) map(false, nil, mode, keys, cmd, options, category, unique_identifier, description) end -- Set a virtual buffer mapping function M.map_buf_virtual(mode, keys, cmd, options, category, unique_identifier, description) map(true, true, mode, keys, cmd, options, category, unique_identifier, description) end -- Set a virtual global mapping function M.map_virtual(mode, keys, cmd, options, category, unique_identifier, description) map(true, nil, mode, keys, cmd, options, category, unique_identifier, description) end function M.setup(opts) -- Keymap if opts.no_map ~= true then if opts.map_toggle == nil then M.map("n", "<leader>MM", ":Telescope mapper<CR>", { silent = true }, "Telescope", "telescope_mapper_toggle", "Show mappings using Telescope") else M.map("n", opts.map_toggle, ":Telescope mapper<CR>", { silent = true }, "Telescope", "telescope_mapper_toggle", "Show mappings using Telescope") end end -- Search path if opts.search_path ~= nil then vim.g.mapper_search_path = opts.search_path else vim.g.mapper_search_path = os.getenv("HOME") .. "/.config/nvim/lua" end end return M
data:extend({ { type = "item-subgroup", name = "programmable-combinator-signal", group = "signals", order = "z[programmable-combinator-signal]" }, { type = "virtual-signal", name = "programmable-combinator-channel", icon = MOD_NAME.."/graphics/programmable-combinator-channel-signal.png", icon_size = 32, subgroup = "programmable-combinator-signal", order = "z[programmable-combinator-signal]" }, })
local CreateThread = CreateThread local Wait = Wait local GetPlayerServerId = GetPlayerServerId local GetPlayerName = GetPlayerName local GetGameTimer = GetGameTimer local GetFrameCount = GetFrameCount CreateThread(function() local playerId = PlayerId() local largeText = GetPlayerName(playerId) local id = GetPlayerServerId(playerId) local prevframes, prevtime, curtime, curframes, fps = 0, 0, 0, 0, 0 SetDiscordAppId(Config.discordId) SetDiscordRichPresenceAsset(Config.largeImage) SetDiscordRichPresenceAssetText(largeText) SetDiscordRichPresenceAction(0, Config.Buttons.One.Text, Config.Buttons.One.Link) SetDiscordRichPresenceAction(1, Config.Buttons.Two.Text, Config.Buttons.Two.Link) while true do curtime = GetGameTimer() curframes = GetFrameCount() if ((curtime - prevtime) > 1000) then fps = (curframes - prevframes) - 1 prevtime = curtime prevframes = curframes end if (fps > 0) and (fps < 1000) then local fpsDisplay = 'ID: ' .. id .. ' | ' .. 'FPS: ' .. fps SetRichPresence(fpsDisplay) end Wait(Config.waitTime) end end)
#!/bin/sh _=[[ . "${0%%/*}/regress.sh" exec runlua "$0" "$@" ]] require"regress".export".*" local context = require"openssl.ssl.context" local function starttls(autoflush, pushback) local cq = cqueues.new() local A, B = check(fileresult(socket.pair())) local cv = condition.new() local key, crt = genkey() local ctx = context.new("SSLv23", true) local text_unsecure = "unsecure" local text_secure = "secure" A:settimeout(2) B:settimeout(2) if autoflush then A:setmode(nil, "fba") else A:setmode(nil, "fbA") end if pushback then B:setmode("fbp", nil) else B:setmode("fbP", nil) end ctx:setCertificate(crt) ctx:setPrivateKey(key) info("test autoflush:%s pushback:%s", tostring(autoflush), tostring(pushback)) cq:wrap(function() info("(A) sending %d bytes", #text_unsecure) check(fileresult(A:write(text_unsecure))) cv:signal() info"(A) initiating TLS handshake" local ok, why, error = fileresult(A:starttls()) info("(A) starttls error: %d", error or 0) if pushback and autoflush then check(ok, "(A) pushback/autoflush test failed (%s)", why) else check(not ok, "(A) pushback/autoflush control test failed") return end info"(A) handshake complete" check(fileresult(A:write(text_secure))) check(fileresult(A:flush())) end) cq:wrap(function() check(fileresult(cv:wait())) info("(B) reading %d bytes", #text_unsecure) local text, why, error = fileresult(B:read(#text_unsecure)) info("(B) read error: %d", error or 0) if autoflush then check(text == text_unsecure, "(B) autoflush test failed (%s)", text or why) else check(text ~= text_unsecure, "(B) autoflush control test failed") return end info"(B) initiating TLS handshake" local ok, why, error = fileresult(B:starttls(ctx)) info("(B) starttls error: %d", error or 0) if pushback then check(ok, "(B) pushback test failed (%s)", why) else check(not ok, "(B) pushback control test failed") return end info"(B) handshake complete" check(check(fileresult(B:read(#text_secure))) == text_secure) end) check(cq:loop()) end starttls(true, false) starttls(false, true) starttls(true, true) say"OK"
--Autoresearch configuration --Allows setting a custom amount of turrets/systems for each rarity level. --If set to 0 the item will never be processed --Subsystems --Petty SSPetty = 3; --Common SSCommon = 5; --Uncommon SSUncommon = 5; --Rare SSRare = 5; --Exceptional SSExceptional = 5; --Exotic SSExotic = 5; --Legendary SSLegendary = 0; --Turrets --Common TCommon = 5; --Uncommon TUncommon = 5; --Rare TRare = 5; --Exceptional TExceptional = 5; --Exotic TExotic = 5; --Legendary TLegendary = 0; --If true turrets of the same type but with different amount of barrels will be treated as the same. TBarrelMerge = true;
-- roles.lua : -- LICENSE: The MIT License (MIT) -- -- Copyright (c) 2016 Pascal TROUVIN -- -- For Microsoft Azure -- Author: Pascal Trouvin -- -- History: -- 20160203: 1st version -- import requirements -- allow either cjson, or th-LuaJSON -- resty-session https://github.com/bungle/lua-resty-session local has_cjson, jsonmod = pcall(require, "cjson") if not has_cjson then jsonmod = require "json" end local http = require "resty.http" local session = require "resty.session".open() local scheme = ngx.var.scheme local server_name = ngx.var.server_name local tenant_id = ngx.var.ngo_tenant_id local uri_args = ngx.req.get_uri_args() local group_id = uri_args["group_id"] or "" local user = ngx.var.cookie_OauthEmail or "UNKNOWN" ngx.log(ngx.ERR, "user:"..user.." GROUP_REQUEST:"..group_id) local access_token = ngx.decode_base64(session.data.access_token or "") local _debug = ngx.var.ngo_debug if _debug == "0" or _debug == "false" then _debug = false; end function getGroupsDetails(group_id) local httpc = http.new() local res, err = httpc:request_uri("https://graph.windows.net:443/"..tenant_id.."/groups/"..group_id.."?api-version=1.0", { method = "GET", headers = { ["Authorization"] = "Bearer "..access_token, ["Host"] = "graph.windows.net" }, ssl_verify = false }) if not res then ngx.log(ngx.ERR, "failed to request: ".. err) return jsonmod.decode(err) end if _debug then ngx.log(ngx.ERR, "DEBUG BODY: "..res.body.." headers: "..jsonmod.encode(res.headers)) end if res.status~=200 then ngx.log(ngx.ERR, "received "..res.status.." : "..res.body.." from https://graph.windows.net:443/"..tenant_id.."/groups/"..group_id.."?api-version=1.0") end return jsonmod.decode(res.body) end -- groupsData : hash table which will be sent back at the end local groupsData={} if string.len(group_id) == 0 then -- retrieve groups id from user OAUTH.access_token -- split and interpret access_token local alg, claims, sign = access_token:match('^([^.]+)[.]([^.]+)[.](.*)') if _debug then ngx.log(ngx.ERR, "DEBUG: token split "..alg..' . '..claims..' . '..sign) end local _claims = ngx.decode_base64( claims ) if _debug then ngx.log(ngx.ERR, "DEBUG: claims JSON ".._claims) end local json_claims = jsonmod.decode(_claims) local groups = json_claims["groups"] if not groups then ngx.log(ngx.ERR, "User: "..user.." unable to retrieve GROUPS from token: ".._claims) return ngx.exit(400) end if _debug then ngx.log(ngx.ERR, "User: "..user.." GROUPS: "..type(groups).." = "..jsonmod.encode(groups)) end for i=1,#groups do local gid=groups[i] groupsData[gid]=getGroupsDetails(gid) end else groupsData[groupd_id]=getGroupsDetails(group_id) end if not uri_args["as_text"] then ngx.header["Content-Type"] = {"application/x-json"} end ngx.say(jsonmod.encode(groupsData))
local F, C, L = unpack(select(2, ...)) local INFOBAR = F:GetModule('Infobar') local format, pairs, wipe, unpack = string.format, pairs, table.wipe, unpack local CLASS_ICON_TCOORDS = CLASS_ICON_TCOORDS local GetMoney = GetMoney local GetContainerNumSlots, GetContainerItemLink, GetItemInfo, GetContainerItemInfo, UseContainerItem = GetContainerNumSlots, GetContainerItemLink, GetItemInfo, GetContainerItemInfo, UseContainerItem local C_Timer_After, IsControlKeyDown, IsShiftKeyDown = C_Timer.After, IsControlKeyDown, IsShiftKeyDown local profit, spent, oldMoney = 0, 0, 0 local myName, myRealm = C.Name, C.Realm local FreeUIMoneyButton = INFOBAR.FreeUIMoneyButton local function formatTextMoney(money) return format('%s: '..C.InfoColor..'%d', 'Gold', money * .0001) end local function getClassIcon(class) local c1, c2, c3, c4 = unpack(CLASS_ICON_TCOORDS[class]) c1, c2, c3, c4 = (c1+.03)*50, (c2-.03)*50, (c3+.03)*50, (c4-.03)*50 local classStr = '|TInterface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes:13:15:0:-1:50:50:'..c1..':'..c2..':'..c3..':'..c4..'|t ' return classStr or '' end local function getGoldString(number) local money = format('%.0f', number/1e4) return GetMoneyString(money*1e4) end StaticPopupDialogs['RESETGOLD'] = { text = L['INFOBAR_RESET_GOLD_COUNT'], button1 = YES, button2 = NO, OnAccept = function() wipe(FreeUIGlobalConfig['totalGold'][myRealm]) FreeUIGlobalConfig['totalGold'][myRealm][myName] = {GetMoney(), C.Class} end, timeout = 0, whileDead = 1, hideOnEscape = true, preferredIndex = 5, } local sellCount, stop, cache = 0, true, {} local errorText = _G.ERR_VENDOR_DOESNT_BUY local function stopSelling(tell) stop = true if sellCount > 0 and tell then print(C.GreenColor..L['INFOBAR_AUTO_SELL_JUNK']..'|r: '..GetMoneyString(sellCount)) if C.notification.enableBanner and C.notification.autoSellJunk then F.Notification(L['NOTIFICATION_SELL'], C.GreenColor..L['INFOBAR_AUTO_SELL_JUNK']..'|r: '..GetMoneyString(sellCount), 'Interface\\ICONS\\INV_Misc_Coin_02') end end sellCount = 0 end local function startSelling() if stop then return end for bag = 0, 4 do for slot = 1, GetContainerNumSlots(bag) do if stop then return end local link = GetContainerItemLink(bag, slot) if link then local price = select(11, GetItemInfo(link)) local _, count, _, quality = GetContainerItemInfo(bag, slot) if quality == 0 and price > 0 and not cache['b'..bag..'s'..slot] then sellCount = sellCount + price*count cache['b'..bag..'s'..slot] = true UseContainerItem(bag, slot) C_Timer_After(.2, startSelling) return end end end end end local function updateSelling(event, ...) if not FreeUIGlobalConfig['autoSellJunk'] then return end local _, arg = ... if event == 'MERCHANT_SHOW' then if IsShiftKeyDown() then return end stop = false wipe(cache) startSelling() F:RegisterEvent('UI_ERROR_MESSAGE', updateSelling) elseif event == 'UI_ERROR_MESSAGE' and arg == errorText then stopSelling(false) elseif event == 'MERCHANT_CLOSED' then stopSelling(true) end end function INFOBAR:Gold() if not C.infobar.enable then return end if not C.infobar.gold then return end FreeUIMoneyButton = INFOBAR:addButton('', INFOBAR.POSITION_RIGHT, 120) FreeUIMoneyButton:RegisterEvent('PLAYER_ENTERING_WORLD') FreeUIMoneyButton:RegisterEvent('PLAYER_MONEY') FreeUIMoneyButton:RegisterEvent('SEND_MAIL_MONEY_CHANGED') FreeUIMoneyButton:RegisterEvent('SEND_MAIL_COD_CHANGED') FreeUIMoneyButton:RegisterEvent('PLAYER_TRADE_MONEY') FreeUIMoneyButton:RegisterEvent('TRADE_MONEY_CHANGED') FreeUIMoneyButton:SetScript('OnEvent', function(self, event) if event == 'PLAYER_ENTERING_WORLD' then oldMoney = GetMoney() self:UnregisterEvent(event) end local newMoney = GetMoney() local change = newMoney - oldMoney if oldMoney > newMoney then spent = spent - change else profit = profit + change end self.Text:SetText(formatTextMoney(newMoney)) --if not FreeUIGlobalConfig['totalGold'] then FreeUIGlobalConfig['totalGold'] = {} end if not FreeUIGlobalConfig['totalGold'][myRealm] then FreeUIGlobalConfig['totalGold'][myRealm] = {} end FreeUIGlobalConfig['totalGold'][myRealm][myName] = {GetMoney(), C.Class} oldMoney = newMoney end) FreeUIMoneyButton.onEnter = function(self) GameTooltip:SetOwner(self, 'ANCHOR_BOTTOM', 0, -15) GameTooltip:ClearLines() GameTooltip:AddLine(CURRENCY, .9, .8, .6) GameTooltip:AddLine(' ') GameTooltip:AddLine(L['INFOBAR_SESSION'], .6,.8,1) GameTooltip:AddDoubleLine(L['INFOBAR_EARNED'], GetMoneyString(profit), 1,1,1, 1, 1, 1) GameTooltip:AddDoubleLine(L['INFOBAR_SPENT'], GetMoneyString(spent), 1,1,1, 1, 1, 1) if profit < spent then GameTooltip:AddDoubleLine(L['INFOBAR_DEFICIT'], GetMoneyString(spent-profit), 1,0,0, 1, 1, 1) elseif profit > spent then GameTooltip:AddDoubleLine(L['INFOBAR_PROFIT'], GetMoneyString(profit-spent), 0,1,0, 1, 1, 1) end GameTooltip:AddLine(' ') local totalGold = 0 GameTooltip:AddLine(L['INFOBAR_CHARACTER'], .6,.8,1) local thisRealmList = FreeUIGlobalConfig['totalGold'][myRealm] for k, v in pairs(thisRealmList) do local gold, class = unpack(v) local r, g, b = F.ClassColor(class) GameTooltip:AddDoubleLine(getClassIcon(class)..k, getGoldString(gold), r,g,b, 1, 1, 1) totalGold = totalGold + gold end GameTooltip:AddLine(' ') GameTooltip:AddDoubleLine(TOTAL, getGoldString(totalGold), .6,.8,1, 1, 1, 1) GameTooltip:AddDoubleLine(' ', C.LineString) GameTooltip:AddDoubleLine(' ', C.LeftButton..L['INFOBAR_AUTO_SELL_JUNK']..': '..(FreeUIGlobalConfig['autoSellJunk'] and '|cff55ff55'..VIDEO_OPTIONS_ENABLED or '|cffff5555'..VIDEO_OPTIONS_DISABLED)..' ', 1,1,1, .9, .8, .6) GameTooltip:AddDoubleLine(' ', C.RightButton..L['INFOBAR_RESET_GOLD_COUNT'], 1,1,1, .9, .8, .6) GameTooltip:Show() end FreeUIMoneyButton:HookScript('OnEnter', FreeUIMoneyButton.onEnter) FreeUIMoneyButton.onMouseUp = function(self, btn) if btn == 'RightButton' then StaticPopup_Show('RESETGOLD') elseif btn == 'LeftButton' then FreeUIGlobalConfig['autoSellJunk'] = not FreeUIGlobalConfig['autoSellJunk'] F.Notification(L['NOTIFICATION_SELL'], L['INFOBAR_AUTO_SELL_JUNK']..': '..(FreeUIGlobalConfig['autoSellJunk'] and '|cff55ff55'..VIDEO_OPTIONS_ENABLED or '|cffff5555'..VIDEO_OPTIONS_DISABLED), 'Interface\\Icons\\INV_Misc_Coin_02') self:onEnter() end end FreeUIMoneyButton:HookScript('OnMouseUp', FreeUIMoneyButton.onMouseUp) FreeUIMoneyButton:HookScript('OnLeave', function() GameTooltip:Hide() end) F:RegisterEvent('MERCHANT_SHOW', updateSelling) F:RegisterEvent('MERCHANT_CLOSED', updateSelling) end
package.path = package.path .. ';../../?.lua' require 'EasyLD' local Player = require 'Player' local i = 1 WINDOW_WIDTH = 1200 WINDOW_HEIGHT = 900 function EasyLD:load() EasyLD.window:resize(WINDOW_WIDTH, WINDOW_HEIGHT) tl = EasyLD.tileset:new("assets/tileset.png", 32) maps = {} maps[1] = EasyLD.map:new("assets/w1.map", tl) maps[2] = EasyLD.map:new("assets/w2.map", tl) maps[3] = EasyLD.map:new("assets/w3.map", tl) p = EasyLD.point:new(0, 0) p.depth = 0 player = Player:new(p.x, p.y, EasyLD.area:new(EasyLD.circle:new(p.x, p.y, 10))) player.depth = 0 player2 = player:copy() player2.pos.x = 100 player2.collideArea.forms[1].c = EasyLD.color:new(255,255,0) nbEntities = 2 slices = {} slices[1] = EasyLD.worldSlice:new(maps[1], EasyLD.point:new(0, -30)) slices[2] = EasyLD.worldSlice:new(maps[2], EasyLD.point:new(0, 30)) slices[3] = EasyLD.worldSlice:new(maps[3], EasyLD.point:new(0, 0)) slices[3]:addEntity(player) slices[3]:addEntity(player2) DM = EasyLD.depthManager:new(player, slices[3], 1, 0, 2) DM:addDepth(1, 0.5, slices[2]) DM:addDepth(2, 0.25, slices[1]) DM:centerOn(0, 0) font = EasyLD.font:new("assets/visitor.ttf") timer = nil end function EasyLD:preCalcul(dt) return dt end function EasyLD:update(dt) p = player.pos if EasyLD.mouse:isPressed("l") then local point = EasyLD.point:new(-100, -100) point.pos = point if DM.follower.y ~= -100 then DM:follow(point, true, 2, "elasticout") else DM:follow(player, true, 2, "elasticout") end end if EasyLD.mouse:isPressed("r") then drawWithoutZoom = not drawWithoutZoom end if EasyLD.mouse:isPressed("m") then if DM.center.x < 200 then DM:centerOn(400, 200, true, 2) else DM:centerOn(0, 0, true, 2) end end if EasyLD.keyboard:isDown("z") then nbEntities = nbEntities + 1 local entity = player:copy() entity.collideArea.forms[1].c = EasyLD.color:new(math.random(22,232),math.random(22,232),math.random(22,232)) entity.update = function(dt) end entity.collide = function() return false end entity.spriteAnimation = entity.collideArea entity.spriteAnimation:moveTo(math.random(50, 800), math.random(0, 200)) entity.pos.x = entity.spriteAnimation.x entity.pos.y = entity.spriteAnimation.y --entity.collideArea = nil slices[3]:addEntity(entity) end if EasyLD.keyboard:isPressed("e") then if timer == nil then local oldDepth, newDepth = math.floor(player.depth), math.floor(player.depth + 1) % 3 timer = EasyLD.flux.to(player, 0.8, {depth = newDepth}):oncomplete(function() timer = nil end) slices[3 - oldDepth]:removeEntity(player) slices[3 - newDepth]:addEntity(player) timer2 = EasyLD.flux.to(DM.depth[newDepth], 0.8, {alpha = 255}):oncomplete(function() timer2 = nil end) timer3 = EasyLD.flux.to(DM.depth[oldDepth], 0.8, {alpha = 150}):oncomplete(function() timer3 = nil end) end end if EasyLD.keyboard:isPressed("q") then if timer == nil then local oldDepth, newDepth = math.floor(player.depth), math.floor(player.depth - 1) % 3 timer = EasyLD.flux.to(player, 0.8, {depth = newDepth}):oncomplete(function() timer = nil end) slices[3 - oldDepth]:removeEntity(player) slices[3 - newDepth]:addEntity(player) timer2 = EasyLD.flux.to(DM.depth[newDepth], 0.8, {alpha = 255}):oncomplete(function() timer2 = nil end) timer3 = EasyLD.flux.to(DM.depth[oldDepth], 0.8, {alpha = 150}):oncomplete(function() timer3 = nil end) end end DM:update(dt) end function EasyLD:draw() DM:draw(drawWithoutZoom) EasyLD.postfx:use('vignette', 0.5, 0.3) font:print([[Q-E: Lower-Upper ground WASD: Move the circle Left click: Change of follower Right click: Draw with or without zoom Middle click: Change of perspective point]], 20, EasyLD.box:new(0, 0, 300, 150), nil, nil, EasyLD.color:new(255,255,255)) font:print("FPS: "..EasyLD:getFPS() .. " Entities: " .. nbEntities, 20, EasyLD.box:new(0, WINDOW_HEIGHT-50, 100, 50), nil, "bottom") end
--Preemptively adds triangles to the world and reuses them to reduce load local buffer = 5000 local TriStorage = {} local tris = {} local container = Instance.new("Model", workspace) container.Name = "triBinContainer" function TriStorage.add(tri) if not tri then tri = Instance.new("WedgePart") end tri.Anchored = true tri.CanCollide = true tri.TopSurface = 0 tri.BottomSurface = 0 tri.Size = Vector3.new(5, 5, 5) tri.CFrame = CFrame.new(0, -500, 0) tri.Parent = container tris[#tris+1] = tri end function TriStorage.get() local tri = tris[1] table.remove(tris, 1) if #tris == 0 then fillBuffer() end return tri end function TriStorage.recycle(tri) tri.Transparency = 0 tri.Material = "SmoothPlastic" TriStorage.add(tri) end function fillBuffer() for i = #tris, buffer do TriStorage.add() end end fillBuffer() return TriStorage
include "Dependencies.lua" workspace "UnitWorld" architecture "x86_64" startproject "Sandbox" configurations { "Debug", "Release" } flags { "MultiProcessorCompile" } outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}" group "Dependencies" include "Vega/vendor/glfw" include "Vega/vendor/glew" include "Vega/vendor/imgui" group "" include "Vega" include "Sandbox"
local __exports = LibStub:NewLibrary("ovale/SpellFlash", 80300) if not __exports then return end local __class = LibStub:GetLibrary("tslib").newClass local __Localization = LibStub:GetLibrary("ovale/Localization") local L = __Localization.L local aceEvent = LibStub:GetLibrary("AceEvent-3.0", true) local _G = _G local GetTime = GetTime local UnitHasVehicleUI = UnitHasVehicleUI local UnitExists = UnitExists local UnitIsDead = UnitIsDead local UnitCanAttack = UnitCanAttack local SpellFlashCore = nil local colorMain = { r = nil, g = nil, b = nil } local colorShortCd = { r = nil, g = nil, b = nil } local colorCd = { r = nil, g = nil, b = nil } local colorInterrupt = { r = nil, g = nil, b = nil } local FLASH_COLOR = { main = colorMain, cd = colorCd, shortcd = colorCd } local COLORTABLE = { aqua = { r = 0, g = 1, b = 1 }, blue = { r = 0, g = 0, b = 1 }, gray = { r = 0.5, g = 0.5, b = 0.5 }, green = { r = 0.1, g = 1, b = 0.1 }, orange = { r = 1, g = 0.5, b = 0.25 }, pink = { r = 0.9, g = 0.4, b = 0.4 }, purple = { r = 1, g = 0, b = 1 }, red = { r = 1, g = 0.1, b = 0.1 }, white = { r = 1, g = 1, b = 1 }, yellow = { r = 1, g = 1, b = 0 } } __exports.OvaleSpellFlashClass = __class(nil, { constructor = function(self, ovaleOptions, ovale, combat, ovaleData, ovaleSpellBook, ovaleStance) self.ovaleOptions = ovaleOptions self.combat = combat self.ovaleData = ovaleData self.ovaleSpellBook = ovaleSpellBook self.ovaleStance = ovaleStance self.OnInitialize = function() SpellFlashCore = _G["SpellFlashCore"] self.module:RegisterMessage("Ovale_OptionChanged", self.Ovale_OptionChanged) self.Ovale_OptionChanged() end self.OnDisable = function() SpellFlashCore = nil self.module:UnregisterMessage("Ovale_OptionChanged") end self.Ovale_OptionChanged = function() local db = self.ovaleOptions.db.profile.apparence.spellFlash colorMain.r = db.colorMain.r colorMain.g = db.colorMain.g colorMain.b = db.colorMain.b colorCd.r = db.colorCd.r colorCd.g = db.colorCd.g colorCd.b = db.colorCd.b colorShortCd.r = db.colorShortCd.r colorShortCd.g = db.colorShortCd.g colorShortCd.b = db.colorShortCd.b colorInterrupt.r = db.colorInterrupt.r colorInterrupt.g = db.colorInterrupt.g colorInterrupt.b = db.colorInterrupt.b end self.module = ovale:createModule("OvaleSpellFlash", self.OnInitialize, self.OnDisable, aceEvent) self.ovaleOptions.options.args.apparence.args.spellFlash = self:getSpellFlashOptions() end, getSpellFlashOptions = function(self) return { type = "group", name = "SpellFlash", disabled = function() return not self:isEnabled() end, get = function(info) return self.ovaleOptions.db.profile.apparence.spellFlash[info[#info]] end, set = function(info, value) self.ovaleOptions.db.profile.apparence.spellFlash[info[#info]] = value self.module:SendMessage("Ovale_OptionChanged") end, args = { enabled = { order = 10, type = "toggle", name = L["Enabled"], desc = L["Flash spells on action bars when they are ready to be cast. Requires SpellFlashCore."], width = "full" }, inCombat = { order = 10, type = "toggle", name = L["En combat uniquement"], disabled = function() return ( not self:isEnabled() or not self.ovaleOptions.db.profile.apparence.spellFlash.enabled) end }, hasTarget = { order = 20, type = "toggle", name = L["Si cible uniquement"], disabled = function() return ( not self:isEnabled() or not self.ovaleOptions.db.profile.apparence.spellFlash.enabled) end }, hasHostileTarget = { order = 30, type = "toggle", name = L["Cacher si cible amicale ou morte"], disabled = function() return ( not self:isEnabled() or not self.ovaleOptions.db.profile.apparence.spellFlash.enabled) end }, hideInVehicle = { order = 40, type = "toggle", name = L["Cacher dans les véhicules"], disabled = function() return ( not self:isEnabled() or not self.ovaleOptions.db.profile.apparence.spellFlash.enabled) end }, brightness = { order = 50, type = "range", name = L["Flash brightness"], min = 0, max = 1, bigStep = 0.01, isPercent = true, disabled = function() return ( not self:isEnabled() or not self.ovaleOptions.db.profile.apparence.spellFlash.enabled) end }, size = { order = 60, type = "range", name = L["Flash size"], min = 0, max = 3, bigStep = 0.01, isPercent = true, disabled = function() return ( not self:isEnabled() or not self.ovaleOptions.db.profile.apparence.spellFlash.enabled) end }, threshold = { order = 70, type = "range", name = L["Flash threshold"], desc = L["Time (in milliseconds) to begin flashing the spell to use before it is ready."], min = 0, max = 1000, step = 1, bigStep = 50, disabled = function() return ( not self:isEnabled() or not self.ovaleOptions.db.profile.apparence.spellFlash.enabled) end }, colors = { order = 80, type = "group", name = L["Colors"], inline = true, disabled = function() return ( not self:isEnabled() or not self.ovaleOptions.db.profile.apparence.spellFlash.enabled) end, get = function(info) local color = self.ovaleOptions.db.profile.apparence.spellFlash[info[#info]] return color.r, color.g, color.b, 1 end, set = function(info, r, g, b, a) local color = self.ovaleOptions.db.profile.apparence.spellFlash[info[#info]] color.r = r color.g = g color.b = b self.module:SendMessage("Ovale_OptionChanged") end, args = { colorMain = { order = 10, type = "color", name = L["Main attack"], hasAlpha = false }, colorCd = { order = 20, type = "color", name = L["Long cooldown abilities"], hasAlpha = false }, colorShortCd = { order = 30, type = "color", name = L["Short cooldown abilities"], hasAlpha = false }, colorInterrupt = { order = 40, type = "color", name = L["Interrupts"], hasAlpha = false } } } } } end, isEnabled = function(self) return SpellFlashCore ~= nil end, IsSpellFlashEnabled = function(self) local enabled = SpellFlashCore ~= nil local db = self.ovaleOptions.db.profile.apparence.spellFlash if enabled and not db.enabled then enabled = false end if enabled and db.inCombat and not self.combat:isInCombat(nil) then enabled = false end if enabled and db.hideInVehicle and UnitHasVehicleUI("player") then enabled = false end if enabled and db.hasTarget and not UnitExists("target") then enabled = false end if enabled and db.hasHostileTarget and (UnitIsDead("target") or not UnitCanAttack("player", "target")) then enabled = false end return enabled end, Flash = function(self, node, element, start, now) local db = self.ovaleOptions.db.profile.apparence.spellFlash now = now or GetTime() if self:IsSpellFlashEnabled() and start and start - now <= db.threshold / 1000 then if element and element.type == "action" then local spellId, spellInfo if element.name == "spell" then spellId = element.positionalParams[1] spellInfo = self.ovaleData.spellInfo[spellId] end local interrupt = spellInfo and spellInfo.interrupt local color = nil local flash = element.namedParams and element.namedParams.flash local iconFlash = node.namedParams.flash local iconHelp = node.namedParams.help if flash and COLORTABLE[flash] then color = COLORTABLE[flash] elseif iconFlash and COLORTABLE[iconFlash] then color = COLORTABLE[iconFlash] elseif iconHelp and FLASH_COLOR[iconHelp] then color = FLASH_COLOR[iconHelp] if interrupt == 1 and iconHelp == "cd" then color = colorInterrupt end end local size = db.size * 100 if iconHelp == "cd" then if interrupt ~= 1 then size = size * 0.5 end end local brightness = db.brightness * 100 if SpellFlashCore then if element.name == "spell" and spellId then if self.ovaleStance:IsStanceSpell(spellId) then SpellFlashCore.FlashForm(spellId, color, size, brightness) end if self.ovaleSpellBook:IsPetSpell(spellId) then SpellFlashCore.FlashPet(spellId, color, size, brightness) end SpellFlashCore.FlashAction(spellId, color, size, brightness) elseif element.name == "item" then local itemId = element.positionalParams[1] SpellFlashCore.FlashItem(itemId, color, size, brightness) end end end end end, })
local definitions = require('utils.definitions') local getAction = require('utils.get_action') local log = require('utils.log') local format = require('utils.format') local reaper_utils = require('custom_actions.utils') local state_interface = require('state_machine.state_interface') local runner = {} function runActionPart(id, midi_command) if type(id) == "function" then id() return end local numeric_id = id if type(id) == 'string' then local action = getAction(id) if action then runner.runAction(action) return end numeric_id = reaper.NamedCommandLookup(id) if numeric_id == 0 then log.error("Could not find action in reaper or action list for: " .. id) return end end if midi_command then reaper.MIDIEditor_LastFocused_OnCommand(numeric_id, false) else reaper.Main_OnCommand(numeric_id, 0) end end function runRegisterAction(registerAction) local register = registerAction['register'] if not register then log.error("Tried to run a register action but got no register!") return end if not type(registerAction[1]) == 'function' then log.error("Did not get passed a proper function for the register action. Got " .. registerAction[1] .. " instead.") end registerAction[1](register) end function runner.runAction(action) if type(action) ~= 'table' then runActionPart(action, false) return end local repetitions = 1 if action['repetitions'] then repetitions = action['repetitions'] end local prefixedRepetitions = 1 if action['prefixedRepetitions'] then prefixedRepetitions = action['prefixedRepetitions'] end if action['registerAction'] then runRegisterAction(action) return end midi_command = false if action['midiCommand'] then midi_command = true end for i=1,repetitions*prefixedRepetitions do for _, sub_action in ipairs(action) do if type(sub_action) == 'table' then runner.runAction(sub_action) else runActionPart(sub_action, midi_command) end end end end function runner.runActionNTimes(action, times) for i=1,times,1 do runner.runAction(action) end end function runner.makeSelectionFromTimelineMotion(timeline_motion, repetitions) local sel_start = reaper.GetCursorPosition() runner.runActionNTimes(timeline_motion, repetitions) local sel_end = reaper.GetCursorPosition() reaper.SetEditCurPos(sel_start, false, false) reaper.GetSet_LoopTimeRange(true, false, sel_start, sel_end, false) end function runner.extendTimelineSelection(movement, args) local left, right = reaper.GetSet_LoopTimeRange(false, false, 0, 0, false) if not left or not right then left, right = start_pos, end_pos end local start_pos = reaper.GetCursorPosition() movement(table.unpack(args)) local end_pos = reaper.GetCursorPosition() if state_interface.getTimelineSelectionSide() == 'right' then if end_pos <= left then state_interface.setTimelineSelectionSide('left') reaper.GetSet_LoopTimeRange(true, false, end_pos, left, false) else reaper.GetSet_LoopTimeRange(true, false, left, end_pos, false) end else if end_pos >= right then state_interface.setTimelineSelectionSide('right') reaper.GetSet_LoopTimeRange(true, false, right, end_pos, false) else reaper.GetSet_LoopTimeRange(true, false, end_pos, right, false) end end end function runner.extendTrackSelection(movement, args) movement(table.unpack(args)) local end_pos = reaper_utils.getTrackPosition() local pivot_i = state_interface.getVisualTrackPivotIndex() runner.runAction("UnselectTracks") local i = end_pos while pivot_i ~= i do local track = reaper.GetTrack(0, i) reaper.SetTrackSelected(track, true) if pivot_i > i then i = i + 1 else i = i - 1 end end local pivot_track = reaper.GetTrack(0, pivot_i) reaper.SetTrackSelected(pivot_track, true) end function runner.makeSelectionFromTrackMotion(track_motion, repetitions) local first_index = reaper_utils.getTrackPosition() runner.runActionNTimes(track_motion, repetitions) local end_track = reaper.GetSelectedTrack(0, 0) if not end_track then local selected_tracks = reaper_utils.getSelectedTracks() return end local second_index = reaper.GetMediaTrackInfo_Value(end_track, "IP_TRACKNUMBER") - 1 if first_index > second_index then local swp = second_index second_index = first_index first_index = swp end for i=first_index,second_index do local track = reaper.GetTrack(0, i) reaper.SetTrackSelected(track, true) end end return runner
-- Ribbon trail demo. -- This sample demonstrates how to use both trail types of RibbonTrail component. require "LuaScripts/Utilities/Sample" local boxNode1 = nil local boxNode2 = nil local swordTrail = nil local ninjaAnimCtrl = nil local timeStepSum = 0.0 local swordTrailStartTime = 0.2 local swordTrailEndTime = 0.46 function Start() -- Execute the common startup for samples SampleStart() -- Create the scene content CreateScene() -- Create the UI content CreateInstructions() -- Setup the viewport for displaying the scene SetupViewport() -- Set the mouse mode to use in the sample SampleInitMouseMode(MM_RELATIVE) -- Hook up to the frame update events SubscribeToEvents() end function CreateScene() scene_ = Scene() -- Create octree, use default volume (-1000, -1000, -1000) to (1000, 1000, 1000) scene_:CreateComponent("Octree") -- Create scene node & StaticModel component for showing a static plane local planeNode = scene_:CreateChild("Plane") planeNode.scale = Vector3(100.0, 1.0, 100.0) local planeObject = planeNode:CreateComponent("StaticModel") planeObject.model = cache:GetResource("Model", "Models/Plane.mdl") planeObject.material = cache:GetResource("Material", "Materials/StoneTiled.xml") -- Create a directional light to the world. local lightNode = scene_:CreateChild("DirectionalLight") lightNode.direction = Vector3(0.6, -1.0, 0.8) -- The direction vector does not need to be normalized local light = lightNode:CreateComponent("Light") light.lightType = LIGHT_DIRECTIONAL light.castShadows = true light.shadowBias = BiasParameters(0.00005, 0.5) -- Set cascade splits at 10, 50 and 200 world units, fade shadows out at 80% of maximum shadow distance light.shadowCascade = CascadeParameters(10.0, 50.0, 200.0, 0.0, 0.8) -- Create first box for face camera trail demo with 1 column. boxNode1 = scene_:CreateChild("Box1") local box1 = boxNode1:CreateComponent("StaticModel") box1.model = cache:GetResource("Model", "Models/Box.mdl") box1.castShadows = true local boxTrail1 = boxNode1:CreateComponent("RibbonTrail") boxTrail1.material = cache:GetResource("Material", "Materials/RibbonTrail.xml") boxTrail1.startColor = Color(1.0, 0.5, 0.0, 1.0) boxTrail1.endColor = Color(1.0, 1.0, 0.0, 0.0) boxTrail1.width = 0.5 boxTrail1.updateInvisible = true -- Create second box for face camera trail demo with 4 column. -- This will produce less distortion than first trail. boxNode2 = scene_:CreateChild("Box2") local box2 = boxNode2:CreateComponent("StaticModel") box2.model = cache:GetResource("Model", "Models/Box.mdl") box2.castShadows = true local boxTrail2 = boxNode2:CreateComponent("RibbonTrail") boxTrail2.material = cache:GetResource("Material", "Materials/RibbonTrail.xml") boxTrail2.startColor = Color(1.0, 0.5, 0.0, 1.0) boxTrail2.endColor = Color(1.0, 1.0, 0.0, 0.0) boxTrail2.width = 0.5 boxTrail2.tailColumn = 4 boxTrail2.updateInvisible = true -- Load ninja animated model for bone trail demo. local ninjaNode = scene_:CreateChild("Ninja") ninjaNode.position = Vector3(5.0, 0.0, 0.0) ninjaNode.rotation = Quaternion(0.0, 180.0, 0.0) local ninja = ninjaNode:CreateComponent("AnimatedModel") ninja.model = cache:GetResource("Model", "Models/NinjaSnowWar/Ninja.mdl") ninja.material = cache:GetResource("Material", "Materials/NinjaSnowWar/Ninja.xml") ninja.castShadows = true -- Create animation controller and play attack animation. ninjaAnimCtrl = ninjaNode:CreateComponent("AnimationController") ninjaAnimCtrl:PlayExclusive("Models/NinjaSnowWar/Ninja_Attack3.ani", 0, true, 0.0) -- Add ribbon trail to tip of sword. local swordTip = ninjaNode:GetChild("Joint29", true) swordTrail = swordTip:CreateComponent("RibbonTrail") -- Set sword trail type to bone and set other parameters. swordTrail.trailType = TT_BONE swordTrail.material = cache:GetResource("Material", "Materials/SlashTrail.xml") swordTrail.lifetime = 0.22 swordTrail.startColor = Color(1.0, 1.0, 1.0, 0.75) swordTrail.endColor = Color(0.2, 0.5, 1.0, 0.0) swordTrail.tailColumn = 4 swordTrail.updateInvisible = true -- Add floating text for info. local boxTextNode1 = scene_:CreateChild("BoxText1") boxTextNode1.position = Vector3(-1.0, 2.0, 0.0) local boxText1 = boxTextNode1:CreateComponent("Text3D") boxText1.text = "Face Camera Trail (4 Column)" boxText1:SetFont(cache:GetResource("Font", "Fonts/BlueHighway.sdf"), 24) local boxTextNode2 = scene_:CreateChild("BoxText2") boxTextNode2.position = Vector3(-6.0, 2.0, 0.0) local boxText2 = boxTextNode2:CreateComponent("Text3D") boxText2.text = "Face Camera Trail (1 Column)" boxText2:SetFont(cache:GetResource("Font", "Fonts/BlueHighway.sdf"), 24) local ninjaTextNode2 = scene_:CreateChild("NinjaText") ninjaTextNode2.position = Vector3(4.0, 2.5, 0.0) local ninjaText = ninjaTextNode2:CreateComponent("Text3D") ninjaText.text = "Bone Trail (4 Column)" ninjaText:SetFont(cache:GetResource("Font", "Fonts/BlueHighway.sdf"), 24) -- Create the camera. cameraNode = scene_:CreateChild("Camera") cameraNode:CreateComponent("Camera") -- Set an initial position for the camera scene node above the plane cameraNode.position = Vector3(0.0, 2.0, -14.0) end function CreateInstructions() -- Construct new Text object, set string to display and font to use local instructionText = ui.root:CreateChild("Text") instructionText:SetText("Use WASD keys and mouse to move") instructionText:SetFont(cache:GetResource("Font", "Fonts/Anonymous Pro.ttf"), 15) -- Position the text relative to the screen center instructionText.horizontalAlignment = HA_CENTER instructionText.verticalAlignment = VA_CENTER instructionText:SetPosition(0, ui.root.height / 4) end function SetupViewport() -- Set up a viewport to the Renderer subsystem so that the 3D scene can be seen. We need to define the scene and the camera -- at minimum. Additionally we could configure the viewport screen size and the rendering path (eg. forward / deferred) to -- use, but now we just use full screen and default render path configured in the engine command line options local viewport = Viewport:new(scene_, cameraNode:GetComponent("Camera")) renderer:SetViewport(0, viewport) end function MoveCamera(timeStep) -- Do not move if the UI has a focused element (the console) if ui.focusElement ~= nil then return end -- Movement speed as world units per second local MOVE_SPEED = 20.0 -- Mouse sensitivity as degrees per pixel local MOUSE_SENSITIVITY = 0.1 -- Use this frame's mouse motion to adjust camera node yaw and pitch. Clamp the pitch between -90 and 90 degrees local mouseMove = input.mouseMove yaw = yaw +MOUSE_SENSITIVITY * mouseMove.x pitch = pitch + MOUSE_SENSITIVITY * mouseMove.y pitch = Clamp(pitch, -90.0, 90.0) -- Construct new orientation for the camera scene node from yaw and pitch. Roll is fixed to zero cameraNode.rotation = Quaternion(pitch, yaw, 0.0) -- Read WASD keys and move the camera scene node to the corresponding direction if they are pressed -- Use the Translate() function (default local space) to move relative to the node's orientation. if input:GetKeyDown(KEY_W) then cameraNode:Translate(Vector3(0.0, 0.0, 1.0) * MOVE_SPEED * timeStep) end if input:GetKeyDown(KEY_S) then cameraNode:Translate(Vector3(0.0, 0.0, -1.0) * MOVE_SPEED * timeStep) end if input:GetKeyDown(KEY_A) then cameraNode:Translate(Vector3(-1.0, 0.0, 0.0) * MOVE_SPEED * timeStep) end if input:GetKeyDown(KEY_D) then cameraNode:Translate(Vector3(1.0, 0.0, 0.0) * MOVE_SPEED * timeStep) end end function SubscribeToEvents() -- Subscribe HandleUpdate() function for processing update events SubscribeToEvent("Update", "HandleUpdate") end function HandleUpdate(eventType, eventData) -- Take the frame time step, which is stored as a float local timeStep = eventData["TimeStep"]:GetFloat() -- Move the camera, scale movement with time step MoveCamera(timeStep) -- Sum of timesteps. timeStepSum = timeStepSum + timeStep -- Move first box with pattern. boxNode1:SetTransform(Vector3(-4.0 + 3.0 * Cos(100.0 * timeStepSum), 0.5, -2.0 * Cos(400.0 * timeStepSum)), Quaternion()) -- Move second box with pattern. boxNode2:SetTransform(Vector3(0.0 + 3.0 * Cos(100.0 * timeStepSum), 0.5, -2.0 * Cos(400.0 * timeStepSum)), Quaternion()) -- Get elapsed attack animation time. local swordAnimTime = ninjaAnimCtrl:GetAnimationState("Models/NinjaSnowWar/Ninja_Attack3.ani").time -- Stop emitting trail when sword is finished slashing. if not swordTrail.emitting and swordAnimTime > swordTrailStartTime and swordAnimTime < swordTrailEndTime then swordTrail.emitting = true elseif swordTrail.emitting and swordAnimTime >= swordTrailEndTime then swordTrail.emitting = false end end
--[[ This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:28' using the latest game version. NOTE: This file should only be used as IDE support; it should NOT be distributed with addons! **************************************************************************** CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC. **************************************************************************** ]] ZO_Dialogs_RegisterCustomDialog( "CONFIRM_UNSAFE_URL", { gamepadInfo = { dialogType = GAMEPAD_DIALOGS.BASIC, }, title = { text = SI_CONFIRM_UNSAFE_URL_TITLE, }, mainText = { text = SI_CONFIRM_UNSAFE_URL_TEXT, }, buttons = { [1] = { text = SI_DIALOG_YES, callback = function(dialog) ConfirmOpenURL(dialog.data.URL) end, }, [2] = { text = SI_DIALOG_NO, } } } ) EVENT_MANAGER:RegisterForEvent("ZoConfirmURL", EVENT_CONFIRM_UNSAFE_URL, function(eventCode, URL) ZO_Dialogs_ReleaseDialog("CONFIRM_UNSAFE_URL") ZO_Dialogs_ShowPlatformDialog("CONFIRM_UNSAFE_URL", { URL = URL }, {mainTextParams = { URL }}) end)
dofile('/home/deepanshu/acads/summer-18/p4-traffictools/samples/basic_postcards/output/wireshark/basic_postcards_1_ipv4.lua') dofile('/home/deepanshu/acads/summer-18/p4-traffictools/samples/basic_postcards/output/wireshark/basic_postcards_2_udp.lua') dofile('/home/deepanshu/acads/summer-18/p4-traffictools/samples/basic_postcards/output/wireshark/basic_postcards_3_hdr_meta.lua')
return { { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "dodgeRate", number = -500 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "dodgeRate", number = -590 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "dodgeRate", number = -680 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "dodgeRate", number = -800 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "dodgeRate", number = -890 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "dodgeRate", number = -980 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "dodgeRate", number = -1100 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "dodgeRate", number = -1220 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "dodgeRate", number = -1340 } } } }, { effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "dodgeRate", number = -1500 } } } }, init_effect = "", name = "蜂鸟侵扰", time = 10, picture = "", desc = "敌方效果-自身机动下降", stack = 1, id = 12215, icon = 12210, last_effect = "Darkness", effect_list = { { type = "BattleBuffAddAttrRatio", trigger = { "onAttach", "onRemove" }, arg_list = { attr = "dodgeRate", number = -500 } } } }
-------------------------------------------------------------------------------- -- Color -------------------------------------------------------------------------------- IMPORT(Script.CLASS) -------------------------------------------------------------------------------- Color = class(function(color, r, g, b) color:set(r, g, b) end) -- get the r g b of the color function Color:get() return self.r, self.g, self.b end -- set the r g b of the color function Color:set(r, g, b) if type(r) == 'table' and getmetatable(r) == Color then local t = r r = t.r g = t.g b = t.b end self.r = Color.fitValue(r) self.g = Color.fitValue(g) self.b = Color.fitValue(b) end -- -- Overrides -- -- override addition -- add a color or an amount to the color function Color.__add(color, value) local rd = 0 local gd = 0 local bg = 0 if type(value) == 'table' and getmetatable(value) == Color then rd = value.r gd = value.g bd = value.b else rd = value gd = value bd = value end local r = Color.fitValue(color.r + rd) local g = Color.fitValue(color.g + gd) local b = Color.fitValue(color.b + bd) return Color(r, g, b) end -- override addition -- subtract a color or an amount from the color function Color.__sub(color, value) local rd = 0 local gd = 0 local bg = 0 if type(value) == 'table' and getmetatable(value) == Color then rd = value.r gd = value.g bd = value.b else rd = value gd = value bd = value end local r = Color.fitValue(color.r - rd) local g = Color.fitValue(color.g - gd) local b = Color.fitValue(color.b - bd) return Color(r, g, b) end -- override multiplication function Color.__mul(color, value) local rd = 0 local gd = 0 local bg = 0 if type(value) == 'table' and getmetatable(value) == Color then rd = value.r gd = value.g bd = value.b else rd = value gd = value bd = value end local r = Color.fitValue(color.r * rd) local g = Color.fitValue(color.g * gd) local b = Color.fitValue(color.b * bd) return Color(r, g, b) end -- override division to return the distance between 2 colors (a bit odd but useful) function Color.__div(color1, color2) return Color.distance(color1, color2) end -- override unary minus function Color.__unm(color) return Color(255 - color.r, 255 - color.g, 255 - color.b) end -- override equality function Color.__eq(color1, color2) return (color1.r == color2.r and color1.g == color2.g and color1.b == color2.b) end -- override concat '..' to average with a value or color function Color.__concat(color, value) local rd = 0 local gd = 0 local bg = 0 if type(value) == 'table' and getmetatable(value) == Color then rd = value.r gd = value.g bd = value.b else rd = value gd = value bd = value end local r = Color.fitValue((color.r + rd) * 0.5) local g = Color.fitValue((color.g + gd) * 0.5) local b = Color.fitValue((color.b + bd) * 0.5) return Color(r, g, b) end -- override exp '^' with brightness factor function Color.__pow(color, power) local r = Color.fitValue((color.r + (255 * power)) / power) local g = Color.fitValue((color.g + (255 * power)) / power) local b = Color.fitValue((color.b + (255 * power)) / power) return Color(r, g, b) end -- override tostring function Color.__tostring(color) return string.format('Color(%i, %i, %i)', color.r, color.g, color.b) end -- -- Methods -- function Color:normalize(ceiling) if (ceiling == nil) then ceiling = 1.0 end local r = (self.r / 255) * ceiling local g = (self.g / 255) * ceiling local b = (self.b / 255) * ceiling return r, g, b end function Color:getHsv() return Color.rgbToHsv(self.r, self.g, self.b) end function Color:setHsv(h, s, v) self.r, self.g, self.b = Color.hsvToRgb(h, s, v) end function Color:getHsl() return Color.rgbToHsl(self.r, self.g, self.b) end function Color:setHsl(h, s, l) self.r, self.g, self.b = Color.hslToRgb(h, s, l) end function Color:getLab() return Color.rgbToLab(self.r, self.g, self.b) end function Color:setLab(l, a, b) self.r, self.g, self.b = Color.labToRgb(l, a, b) end function Color:getDistance(fromColor) return Color.distance(self, fromColor) end -- copy function Color:copy() return Color(self.r, self.g, self.b) end -- -- Utilities -- -- distance (simple CIE76 method, not great but was easy to implement...) function Color.distance(color1, color2) local l1,a1,b1 = Color.rgbToLab(color1.r, color1.g, color1.b) local l2,a2,b2 = Color.rgbToLab(color2.r, color2.g, color2.b) local d = math.sqrt(math.pow(l2 - l1, 2) + math.pow(a2 - a1, 2) + math.pow(b2 - b1, 2)) return d end -- average function Color.average() local r = 0 local g = 0 local b = 0 -- @TODO how to overload in LUA ??? ... --for i,color in arguments --r = r + color.r --g = g + color.g --b = b + color.b --end --r = math.floor(r / arguments.length + 0.5) --g = math.floor(g / arguments.length + 0.5) --b = math.floor(b / arguments.length + 0.5) return Color(r, g, b) end -- rgb to hsl function Color.rgbToHsl(r, g, b) r = r / 255 g = g / 255 b = b / 255 local max = math.max(r, g, b) local min = math.min(r, g, b) local h = (max + min) / 2 local s = h local l = h if (max == min) then h = 0 s = 0 else local d = max - min if (l > 0.5) then s = d / (2 - max - min) else s = d / (max + min) end if (max == r) then local t if (g < b) then t = 6 else t = 0 end h = (g - b) / d + t elseif (max == g) then h = (b - r) / d + 2 elseif (max == b) then h = (r - g) / d + 4 end h = h / 6 end return h, s, l end -- hsl to rgb function Color.hslToRgb(h, s, l) local r local g local b if (s == 0) then r = 1 g = 1 b = 1 else local q if (l < 0.5) then q = l * (1 + s) else q = l + s - 1 * s end local p = 2 * l - q r = Color.hueToRgb(p, q, h + 1/3) g = Color.hueToRgb(p, q, h) b = Color.hueToRgb(p, q, h - 1/3) end return r * 255, g * 255, b * 255 end -- hue to rgb function Color.hueToRgb(p, q, t) if (t < 0) then t = t + 1 end if (t > 1) then t = t - 1 end if (t < 1/6) then return p + (q - p) * 6 * t end if (t < 1/2) then return q end if (t < 2/3) then return p + (q - p) * (2/3 - t) * 6 end return p end -- rgb to hsv function Color.rgbToHsv(r, g, b) r = r / 255 g = g / 255 b = b / 255 local max = math.max(r, g, b) local min = math.min(r, g, b) local h = max local s = max local v = max local d = max - min if (max == 0) then s = 0 else s = d / max end if (max == min) then h = 0 else if (r == max) then local t if (g < b) then t = 6 else t = 0 end h = (g - b) / d + t else if (g == max) then h = (b - r) / d + 2 else if (b == max) then h = (r - g) / d + 4 end h = h / 6 end return h, s, v end -- hsv to rgb function Color.hsvToRgb(h, s, v) local i = math.floor(h * 6) local f = h * 6 - i local p = v * (1 - s) local q = v * (1 - f * s) local t = v * (1 - (1 - f) * s) local n = i % 6 if (n == 0) then r = v g = t b = p else if (n == 1) then r = q g = v b = p else if (n == 2) then r = p g = v b = t else if (n == 3) then r = p g = q b = v else if (n == 4) then r = t g = p b = v else if (n == 5) then r = v g = p b = q end return r * 255, g * 255, b * 255 end Color.rgbToXyz = function(r, g, b) r = r / 255 g = g / 255 b = b / 255 if (r > 0.04045) then r = math.pow((r + 0.055) / 1.055, 2.4) else r = r / 12.92 end if (g > 0.04045) then g = math.pow((g + 0.055) / 1.055, 2.4) else g = g / 12.92 end if (b > 0.04045) then b = math.pow((b + 0.055) / 1.055, 2.4) else b = b / 12.92 end r = r * 100 g = g * 100 b = b * 100 local x = r * 0.4124 + g * 0.3576 + b * 0.1805 local y = r * 0.2126 + g * 0.7152 + b * 0.0722 local z = r * 0.0193 + g * 0.1192 + b * 0.9505 return x, y, z end Color.xyzToRgb = function(x, y, z) x = x / 100 y = y / 100 z = z / 100 local r = x * 3.2406 + y * -1.5372 + z * -0.4986 local g = x * -0.9689 + y * 1.8758 + z * 0.0415 local b = x * 0.0557 + y * -0.2040 + z * 1.0570 if (r > 0.0031308 ) then r = 1.055 * math.pow(r , (1 / 2.4)) - 0.055 else r = 12.92 * r end if (g > 0.0031308 ) then g = 1.055 * math.pow(g , (1 / 2.4)) - 0.055 else g = 12.92 * g end if (b > 0.0031308 ) then b = 1.055 * math.pow(b , (1 / 2.4)) - 0.055 else b = 12.92 * b end local r = math.floor(r * 255 + 0.5) local g = math.floor(g * 255 + 0.5) local b = math.floor(b * 255 + 0.5) return r, g, b end Color.xyzToLab = function(x, y, z) local REF_X = 95.047 local REF_Y = 100.000 local REF_Z = 108.883 x = x / REF_X y = y / REF_Y z = z / REF_Z if (x > 0.008856 ) then x = Math.pow(x , 1/3) else x = (7.787 * x) + (16/116) end if (y > 0.008856 ) then y = Math.pow(y , 1/3) else y = (7.787 * y) + (16/116) end if (z > 0.008856 ) then z = Math.pow(z , 1/3) else z = (7.787 * z) + (16/116) end local l = (116 * y) - 16 local a = 500 * (x - y) local b = 200 * (y - z) return l, a, b end Color.labToXyz = function(l, a, b) local REF_X = 95.047 local REF_Y = 100.000 local REF_Z = 108.883 local y = (l + 16) / 116 local x = a / 500 + y local z = y - b / 200 if (math.pow(y, 3) > 0.008856) then y = math.pow(y, 3) else y = (y - 16 / 116) / 7.787 end if (math.pow(x, 3) > 0.008856) then x = math.pow(x, 3) else x = (x - 16 / 116) / 7.787 end if (math.pow(z, 3) > 0.008856) then z = math.pow(z, 3) else z = (z - 16 / 116) / 7.787 end return REF_X * x, REF_Y * y, REF_Z * z end Color.rgbToLab = function(r, g, b) local x,y,z = Color.rgbToXyz(r, g, b) return Color.xyzToLab(x, y, z) end Color.labToRgb = function(l, a, b) local x, y, z = Color.labToXyz(l, a, b) return Color.xyzToRgb(x, y, z) end Color.fitValue = function(value) value = math.floor(value + 0.5) if (value < 0) then value = 0 end if (value > 255) then value = 255 end return value end
-- The file is in public domain -- nyfair ([email protected]) local ffi = require 'ffi' ffi.cdef[[ int mkdir(const char*, int); ]] function ls(pattern) local files = {} if pattern == nil then pattern = './*' end local output = assert(io.popen('ls '..pattern:gsub(' ', '\\ '))) for line in output:lines() do table.insert(files, line) end return files end function md(dst) ffi.C.mkdir(dst, 493) --0755 end function rm(dst) os.remove(dst) end function mv(src, dst) os.rename(src, dst) end
GUI = {} Menu = {} Menus = {} --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- --==============================================================================================-- -- Settings -- --==============================================================================================-- --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- GUI.maxVisOptions = 10 ------------------------ Max options to show on the menu -- GUI.titleText = {255, 255, 255, 255, 1} ------- Color of title text -- GUI.titleRect = {0, 82, 165, 255} ------------- Color of rectangle [title] -- GUI.optionText = {255, 255, 255, 255, 6} ------ Color of option text -- GUI.optionRect = {40, 40, 40, 190} ------------ Color of option rectangles -- GUI.scroller = {0, 128, 255, 255} ----------- Color of active option -- titleTextSize = {0.85, 0.80} ------------ {p1, Size} -- titleRectSize = {0.16, 0.085} ----------- {Width, Height} -- optionTextSize = {0.5, 0.5} ------------- {p1, Size} -- optionRectSize = {0.16, 0.035} ---------- {Width, Height} -- menuX = 0.75 ----------------------------- X position of the menu -- menuXOption = 0.075 --------------------- X postiion of Menu.Option text -- menuXOtherOption = 0.050 ---------------- X position of Bools, Arrays etc text -- menuYModify = 0.3000 -------------------- Default: 0.1174 ------ Top bar -- menuYOptionDiv = 8.56 ------------------ Default: 3.56 ------ Distance between buttons -- menuYOptionAdd = 0.36 ------------------ Default: 0.142 ------ Move buttons up and down -- --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- --==============================================================================================-- -- Settings -- --==============================================================================================-- --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- local menuOpen = false prevMenu = nil curMenu = nil selectPressed = false leftPressed = false rightPressed = false currentOption = 1 local optionCount = 0 function tablelength(T) local count = 0 for _ in pairs(T) do count = count + 1 end return count end function Menu.IsOpen() return menuOpen == true end function Menu.SetupMenu(menu, title) Menus[menu] = {} Menus[menu].title = title Menus[menu].optionCount = 0 Menus[menu].options = {} Menus[menu].previous = nil --currentOption = 1 end function Menu.addOption(menu, option) if not (Menus[menu].title == nil) then Menus[menu].optionCount = Menus[menu].optionCount + 1 Menus[menu].options[Menus[menu].optionCount] = option end end function Menu.Switch(prevmenu, menu) curMenu = menu prevMenu = prevmenu if Menus[menu] then if Menus[menu].optionCount then if Menus[menu].optionCount < currentOption then currentOption = Menus[menu].optionCount if currentOption == 0 then currentOption = 1 end end end end if prevmenu ~= nil and menu ~= "" then Menus[menu].previous = prevmenu end end function Menu.DisplayCurMenu() if not (curMenu == "") then menuOpen = true Menu.Title(Menus[curMenu].title) for k,v in pairs(Menus[curMenu].options) do v() end Menu.updateSelection() end end function GUI.Text(text, color, position, size, center) SetTextCentre(center) SetTextColour(color[1], color[2], color[3], color[4]) SetTextFont(color[5]) SetTextScale(size[1], size[2]) SetTextEntry("STRING") AddTextComponentString(text) DrawText(position[1], position[2]) end function GUI.Rect(color, position, size) DrawRect(position[1], position[2], size[1], size[2], color[1], color[2], color[3], color[4]) end function Menu.Title(title) GUI.Text(title, GUI.titleText, {menuX, menuYModify - 0.02241}, titleTextSize, true) GUI.Rect(GUI.titleRect, {menuX, menuYModify}, titleRectSize) Menu.PageCounter() end function Menu.PageCounter() GUI.Text(currentOption.."/"..Menus[curMenu].optionCount, GUI.optionText, {menuX + menuXOption - 0.02, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, false) GUI.Rect(GUI.optionRect, { menuX, (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify) }, optionRectSize) RequestStreamedTextureDict("commonmenu", true) DrawSprite("commonmenu", "shop_arrows_upanddown", menuX, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify + 0.015), 0.03, 0.03, 0.0, 255, 255, 255, 255) GUI.Rect(GUI.titleRect, { menuX, (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify + 0.015) }, {optionRectSize[1], optionRectSize[2] - 0.03}) end function Menu.Option(option) optionCount = optionCount + 1 local thisOption = nil if(currentOption == optionCount) then thisOption = true else thisOption = false end if(currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then GUI.Text(option, GUI.optionText, {menuX - menuXOption, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, false) GUI.Rect(GUI.optionRect, { menuX, (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify) }, optionRectSize) if(thisOption) then GUI.Rect(GUI.scroller, { menuX, (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify) }, optionRectSize) end elseif (optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then GUI.Text(option, GUI.optionText, {menuX - menuXOption, ((menuYOptionAdd - 0.018) + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify)}, optionTextSize, false) GUI.Rect(GUI.optionRect, { menuX, (menuYOptionAdd + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify) }, optionRectSize) if(thisOption) then GUI.Rect(GUI.scroller, { menuX, (menuYOptionAdd + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify) }, optionRectSize) end end if (optionCount == currentOption and selectPressed) then return true end return false end function Menu.changeMenu(option, menu) if (Menu.Option(option)) then Menu.Switch(curMenu, menu) end if(currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then GUI.Text(">>", GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, true) elseif(optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then GUI.Text(">>", GUI.optionText, { menuX + 0.068, ((menuYOptionAdd - 0.018) + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify)}, optionTextSize, true) end if (optionCount == currentOption and selectPressed) then return true end return false end function Menu.Bool(option, bool, option2, option3, cb) Menu.Option(option) if(currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then if(bool) then GUI.Text(option2, GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, true) else GUI.Text(option3, GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, true) end elseif(optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then if(bool) then GUI.Text(option2, GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify)}, optionTextSize, true) else GUI.Text(option3, GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify)}, optionTextSize, true) end end if (optionCount == currentOption and selectPressed) then cb(not bool) return true end return false end function Menu.Int(option, int, min, max, cb) Menu.Option(option); if (optionCount == currentOption) then if (leftPressed) then if(int > min) then int = int - 1 else int = max end-- : _int = max; end if (rightPressed) then if(int < max) then int = int + 1 else int = min end end end if (currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then GUI.Text(tostring(int), GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, true) elseif (optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then GUI.Text(tostring(int), GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify)}, optionTextSize, true) end if (optionCount == currentOption and selectPressed) then cb(position) return true elseif (optionCount == currentOption and leftPressed) then cb(position) elseif (optionCount == currentOption and rightPressed) then cb(position) end return false end function Menu.StringArray(option, array, position, cb) Menu.Option(option); if (optionCount == currentOption) then local max = tablelength(array) local min = 1 if (leftPressed) then if(position > min) then position = position - 1 else position = max end end if (rightPressed) then if(position < max) then position = position + 1 else position = min end end end if (currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then GUI.Text(array[position], GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + (optionCount / menuYOptionDiv) * menuYModify)}, optionTextSize, true) elseif (optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then GUI.Text(array[position], GUI.optionText, { menuX + menuXOtherOption, ((menuYOptionAdd - 0.018) + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify)}, optionTextSize, true) end if (optionCount == currentOption and selectPressed) then cb(position) return true elseif (optionCount == currentOption and leftPressed) then cb(position) elseif (optionCount == currentOption and rightPressed) then cb(position) end return false end function Menu.ScrollBarStringSelect(array, min, cb) local currentPosition = min -- Scroller Position local maxPosition = tablelength(array) Menu.Option(array[currentPosition+1]) local bar = { x = menuX, -- X Coordinate of both boxes y = (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify), -- Y Coordinate of both boxes height = optionRectSize[2]/1.5, -- Height of both boxes width = {background_box = optionRectSize[1], scroller = optionRectSize[1]/5}, -- Width?? } if (optionCount == currentOption) then if (leftPressed) then if currentPosition > 0 then currentPosition = currentPosition-1 elseif currentPosition == 0 then currentPosition = maxPosition-1 else currentPosition = min end end if (rightPressed) then -- right if currentPosition < maxPosition-1 then currentPosition = currentPosition+1 elseif currentPosition == maxPosition-1 then currentPosition = 0 else currentPosition = maxPosition-1 end end end if(currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then bar.y = (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify) DrawRect(bar.x, bar.y, bar.width.background_box, bar.height, GUI.optionRect[1], GUI.optionRect[2], GUI.optionRect[3], GUI.optionRect[4]) -- Background local new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) + (((bar.width.background_box - bar.width.scroller) / (maxPosition-1)) * currentPosition) if new_x < (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MIN if new_x > (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MAX DrawRect(new_x,bar.y,bar.width.scroller,bar.height, GUI.scroller[1], GUI.scroller[2]-36, GUI.scroller[3]-72, GUI.scroller[4]) -- Scroller elseif (optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then bar.y = (menuYOptionAdd + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify) DrawRect(bar.x, bar.y, bar.width.background_box, bar.height, GUI.optionRect[1], GUI.optionRect[2], GUI.optionRect[3], GUI.optionRect[4]) -- Background local new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) + (((bar.width.background_box - bar.width.scroller) / (maxPosition-1)) * currentPosition) if new_x < (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MIN if new_x > (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MAX DrawRect(new_x,bar.y,bar.width.scroller,bar.height, GUI.scroller[1], GUI.scroller[2]-36, GUI.scroller[3]-72, GUI.scroller[4]) -- Scroller end if (optionCount == currentOption and selectPressed) then cb(currentPosition) return true elseif (optionCount == currentOption and leftPressed) then cb(currentPosition) return false elseif (optionCount == currentOption and rightPressed) then cb(currentPosition) return false end return false end function Menu.ScrollBarString(array, min, cb) local currentPosition = min -- Scroller Position local maxPosition = tablelength(array) Menu.Option(array[currentPosition+1]) local bar = { x = menuX, -- X Coordinate of both boxes y = (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify), -- Y Coordinate of both boxes height = optionRectSize[2]/1.5, -- Height of both boxes width = {background_box = optionRectSize[1], scroller = optionRectSize[1]/5}, -- Width?? } if (optionCount == currentOption) then if (leftPressed) then if currentPosition > 0 then currentPosition = currentPosition-1 elseif currentPosition == 0 then currentPosition = maxPosition-1 else currentPosition = min end end if (rightPressed) then -- right if currentPosition < maxPosition-1 then currentPosition = currentPosition+1 elseif currentPosition == maxPosition-1 then currentPosition = 0 else currentPosition = maxPosition-1 end end end if(currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then bar.y = (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify) DrawRect(bar.x, bar.y, bar.width.background_box, bar.height, GUI.optionRect[1], GUI.optionRect[2], GUI.optionRect[3], GUI.optionRect[4]) -- Background local new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) + (((bar.width.background_box - bar.width.scroller) / (maxPosition-1)) * currentPosition) if new_x < (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MIN if new_x > (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MAX DrawRect(new_x,bar.y,bar.width.scroller,bar.height, GUI.scroller[1], GUI.scroller[2]-36, GUI.scroller[3]-72, GUI.scroller[4]) -- Scroller elseif (optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then bar.y = (menuYOptionAdd + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify) DrawRect(bar.x, bar.y, bar.width.background_box, bar.height, GUI.optionRect[1], GUI.optionRect[2], GUI.optionRect[3], GUI.optionRect[4]) -- Background local new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) + (((bar.width.background_box - bar.width.scroller) / (maxPosition-1)) * currentPosition) if new_x < (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MIN if new_x > (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MAX DrawRect(new_x,bar.y,bar.width.scroller,bar.height, GUI.scroller[1], GUI.scroller[2]-36, GUI.scroller[3]-72, GUI.scroller[4]) -- Scroller end if (optionCount == currentOption and leftPressed) then cb(currentPosition) return true elseif (optionCount == currentOption and rightPressed) then cb(currentPosition) return true end return false end function Menu.ScrollBarInt(option, min, max, cb) Menu.Option(option) local bar = { x = menuX, -- X Coordinate of both boxes y = (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify), -- Y Coordinate of both boxes height = optionRectSize[2]/1.5, -- Height of both boxes width = {background_box = optionRectSize[1], scroller = optionRectSize[1]/5}, -- Width?? } local currentPosition = min -- Scroller Position local maxPosition = max if (optionCount == currentOption) then if (leftPressed) then if currentPosition > 0 then currentPosition = currentPosition-1 elseif currentPosition == 0 then currentPosition = maxPosition-1 else currentPosition = min end end if (rightPressed) then -- right if currentPosition < maxPosition-1 then currentPosition = currentPosition+1 elseif currentPosition == maxPosition-1 then currentPosition = 0 else currentPosition = maxPosition-1 end end end if(currentOption <= GUI.maxVisOptions and optionCount <= GUI.maxVisOptions) then bar.y = (menuYOptionAdd + (optionCount / menuYOptionDiv) * menuYModify) DrawRect(bar.x, bar.y, bar.width.background_box, bar.height, GUI.optionRect[1], GUI.optionRect[2], GUI.optionRect[3], GUI.optionRect[4]) -- Background local new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) + (((bar.width.background_box - bar.width.scroller) / (maxPosition-1)) * currentPosition) if new_x < (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MIN if new_x > (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MAX DrawRect(new_x,bar.y,bar.width.scroller,bar.height, GUI.scroller[1], GUI.scroller[2]-36, GUI.scroller[3]-72, GUI.scroller[4]) -- Scroller elseif (optionCount > currentOption - GUI.maxVisOptions and optionCount <= currentOption) then bar.y = (menuYOptionAdd + ((optionCount - (currentOption - GUI.maxVisOptions)) / menuYOptionDiv) * menuYModify) DrawRect(bar.x, bar.y, bar.width.background_box, bar.height, GUI.optionRect[1], GUI.optionRect[2], GUI.optionRect[3], GUI.optionRect[4]) -- Background local new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) + (((bar.width.background_box - bar.width.scroller) / (maxPosition-1)) * currentPosition) if new_x < (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x - ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MIN if new_x > (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) then new_x = (bar.x + ((bar.width.background_box - bar.width.scroller)/2)) end ---- SCROLLER MAX DrawRect(new_x,bar.y,bar.width.scroller,bar.height, GUI.scroller[1], GUI.scroller[2]-36, GUI.scroller[3]-72, GUI.scroller[4]) -- Scroller end if (optionCount == currentOption and leftPressed) then cb(currentPosition) return true elseif (optionCount == currentOption and rightPressed) then cb(currentPosition) return true end return false end function Menu.updateSelection() selectPressed = false; leftPressed = false; rightPressed = false; if IsControlJustPressed(1, 173) then if(currentOption < optionCount) then currentOption = currentOption + 1 else currentOption = 1 end elseif IsControlJustPressed(1, 172) then if(currentOption > 1) then currentOption = currentOption - 1 else currentOption = optionCount end elseif IsControlJustPressed(1, 174) then leftPressed = true elseif IsControlJustPressed(1, 175) then rightPressed = true elseif IsControlJustPressed(1, 176) then selectPressed = true elseif IsControlJustPressed(1, 177) then if (prevMenu == nil) then Menu.Switch(nil, "") menuOpen = false if clothing_menu then save() clothing_menu = false end currentOption = 1 end if not (prevMenu == nil) then if not Menus[prevMenu].previous == nil then currentOption = 1 Menu.Switch(nil, prevMenu) Citizen.Trace("IS NOT NIL BUT NIL? "..prevMenu) else if Menus[prevMenu].optionCount < currentOption then currentOption = Menus[prevMenu].optionCount end Menu.Switch(Menus[prevMenu].previous, prevMenu) end end end optionCount = 0 end
--[[ ______ _ _ | ___ \ | | | | | | _ | | ____| |_ _ ____ _ | | ___ | || || |/ _ | | | | / _ |/ || |/ _ \ | || || ( ( | | |\ V ( ( | ( (_| | |_| | |_||_||_|\_||_|_| \_/ \_||_|\____|\___/ malvado - A game programming library with "DIV Game Studio"-style processes for Lua/Love2D. Copyright (C) 2017-present Jeremies Pérez Morata This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. --]] --- Text primitives -- @module malvado.text --- Text align values TextAlign = { ALIGN_TOP_LEFT = 0, ALIGN_TOP = 1, ALIGN_TOP_RIGHT = 2, ALIGN_CENTER_LEFT = 3, ALIGN_CENTER = 4, ALIGN_CENTER_RIGHT = 5, ALIGN_BOTTOM_LEFT = 6, ALIGN_BOTTOM = 7, ALIGN_BOTTOM_RIGHT = 8, } TextProc = process(function(self) while true do local font = self.font love.graphics.setFont(font.font) love.graphics.setColor(font.r, font.g, font.b, font.a) love.graphics.print(self.text, self.x, self.y) frame() end end) local function _calculate_textalign_desp(font, text, text_align) local text_width = font.font:getWidth(text) local text_height = font.font:getHeight() if text_align == TextAlign.ALIGN_TOP_LEFT then return 0, 0 elseif text_align == TextAlign.ALIGN_TOP then return text_width / 2, 0 elseif text_align == TextAlign.ALIGN_TOP_RIGHT then return text_width, 0 elseif text_align == TextAlign.ALIGN_CENTER_LEFT then return 0, text_height / 2 elseif text_align == TextAlign.ALIGN_CENTER then return text_width / 2, text_height / 2 elseif text_align == TextAlign.ALIGN_CENTER_RIGHT then return text_width, text_height / 2 elseif text_align == TextAlign.ALIGN_BOTTOM_LEFT then return 0, text_height elseif text_align == TextAlign.ALIGN_BOTTOM then return text_width / 2, text_height elseif text_align == TextAlign.ALIGN_BOTTOM_RIGHT then return text_width, text_height else error('Invalid text align:' .. text_align) end end --- Create a text to render -- @param _font Font object -- @param _x x -- @param _y y -- @param _text text -- @see malvado.map.font function write(_font, _x, _y, _text, text_align) text_align = text_align or TextAlign.ALIGN_CENTER local xdesp, ydesp = _calculate_textalign_desp(_font, _text, text_align) return TextProc { font = _font, x = _x - xdesp, y = _y - ydesp, text = _text, _internal = true, z = 10000 } end --- Change some value of a created text -- @param text_id text id -- @param _text text -- @param _x x -- @param _y y -- @param _font font function change_text(text_id, _text, _x, _y, _font) local values = {} if (_text) then values["text"] = _text end if (_x) then values["x"] = _x end if (_y) then values["y"] = _y end if (_font) then values["font"] = _font end malvado.mod_process(text_id, values) end --- Delete a text by its identifier -- @param id text id function delete_text(id) if id ~= nil then --malvado.delete_text(id) kill(id) end end
local name, SPELLDB = ... SPELLDB.PALADIN = {} SPELLDB.PALADIN.HOLY = {} SPELLDB.PALADIN.PROTECTION = {} SPELLDB.PALADIN.RETRIBUTION = {} SPELLDB.PALADIN.HOLY.spells = { 208683, 53563 --[[Beacon of Light--]], 4987 --[[Cleanse--]], 26573 --[[Consecration--]], 35395 --[[Crusader Strike--]], 642 --[[Divine Shield--]], 190784 --[[Divine Steed--]], 19750 --[[Flash of Light--]], 853 --[[Hammer of Justice--]], 62124 --[[Hand of Reckoning--]], 82326 --[[Holy Light--]], 20473 --[[Holy Shock--]], 20271 --[[Judgment--]], 7328 --[[Redemption--]], 498 --[[Divine Protection--]], 53576 --[[Infusion of Light--]], 1044 --[[Blessing of Freedom--]], 85222 --[[Light of Dawn--]], 231644 --[[Judgment--]], 32223 --[[Heart of the Crusader--]], 1022 --[[Blessing of Protection--]], 183998 --[[Light of the Martyr--]], 231642 --[[Beacon of Light--]], 633 --[[Lay on Hands--]], 6940 --[[Blessing of Sacrifice--]], 227068 --[[Righteousness--]], 212056 --[[Absolution--]], 31821 --[[Aura Mastery--]], 183997 --[[Mastery: Lightbringer--]], 31842 --[[Avenging Wrath--]], }; SPELLDB.PALADIN.PROTECTION.spells = { 31935 --[[Avenger's Shield--]], 213644 --[[Cleanse Toxins--]], 26573 --[[Consecration--]], 642 --[[Divine Shield--]], 190784 --[[Divine Steed--]], 19750 --[[Flash of Light--]], 853 --[[Hammer of Justice--]], 53595 --[[Hammer of the Righteous--]], 62124 --[[Hand of Reckoning--]], 20271 --[[Judgment--]], 7328 --[[Redemption--]], 53600 --[[Shield of the Righteous--]], 85043 --[[Grand Crusader--]], 498 --[[Divine Protection--]], 96231 --[[Rebuke--]], 1044 --[[Blessing of Freedom--]], 184092 --[[Light of the Protector--]], 231665 --[[Avenger's Shield--]], 231657 --[[Judgment--]], 32223 --[[Heart of the Crusader--]], 1022 --[[Blessing of Protection--]], 31850 --[[Ardent Defender--]], 633 --[[Lay on Hands--]], 6940 --[[Blessing of Sacrifice--]], 86659 --[[Guardian of Ancient Kings--]], 76671 --[[Mastery: Divine Bulwark--]], 31884 --[[Avenging Wrath--]], }; SPELLDB.PALADIN.RETRIBUTION.spells = { 184575 --[[Blade of Justice--]], 213644 --[[Cleanse Toxins--]], 35395 --[[Crusader Strike--]], 642 --[[Divine Shield--]], 190784 --[[Divine Steed--]], 19750 --[[Flash of Light--]], 853 --[[Hammer of Justice--]], 183218 --[[Hand of Hindrance--]], 62124 --[[Hand of Reckoning--]], 20271 --[[Judgment--]], 7328 --[[Redemption--]], 85256 --[[Templar's Verdict--]], 184662 --[[Shield of Vengeance--]], 96231 --[[Rebuke--]], 1044 --[[Blessing of Freedom--]], 53385 --[[Divine Storm--]], 231663 --[[Judgment--]], 32223 --[[Heart of the Crusader--]], 1022 --[[Blessing of Protection--]], 633 --[[Lay on Hands--]], 203538 --[[Greater Blessing of Kings--]], 203539 --[[Greater Blessing of Wisdom--]], 183435 --[[Retribution--]], 76672 --[[Mastery: Divine Judgment--]], 31884 --[[Avenging Wrath--]], }; SPELLDB.PALADIN.HOLY.talents = { 223306 --[[Bestow Faith--]], 114158 --[[Light's Hammer--]], 196926 --[[Crusader's Might--]], 230332 --[[Cavalier--]], 114154 --[[Unbreakable Spirit--]], 214202 --[[Rule of Law--]], 198054 --[[Fist of Justice--]], 20066 --[[Repentance--]], 115750 --[[Blinding Light--]], 183425 --[[Devotion Aura--]], 183416 --[[Aura of Sacrifice--]], 183415 --[[Aura of Mercy--]], 197646 --[[Divine Purpose--]], 105809 --[[Holy Avenger--]], 114165 --[[Holy Prism--]], 196923 --[[Fervent Martyr--]], 53376 --[[Sanctified Wrath--]], 183778 --[[Judgment of Light--]], 156910 --[[Beacon of Faith--]], 197446 --[[Beacon of the Lightbringer--]], 200025 --[[Beacon of Virtue--]], }; SPELLDB.PALADIN.PROTECTION.talents = { 152261 --[[Holy Shield--]], 204019 --[[Blessed Hammer--]], 203785 --[[Consecrated Hammer--]], 203776 --[[First Avenger--]], 204035 --[[Bastion of Light--]], 204023 --[[Crusader's Judgment--]], 198054 --[[Fist of Justice--]], 20066 --[[Repentance--]], 115750 --[[Blinding Light--]], 204018 --[[Blessing of Spellwarding--]], 230332 --[[Cavalier--]], 203797 --[[Retribution Aura--]], 213652 --[[Hand of the Protector--]], 204139 --[[Knight Templar--]], 204077 --[[Final Stand--]], 204150 --[[Aegis of Light--]], 204054 --[[Consecrated Ground--]], 183778 --[[Judgment of Light--]], 204074 --[[Righteous Protector--]], 152262 --[[Seraphim--]], 203791 --[[Last Defender--]], }; SPELLDB.PALADIN.RETRIBUTION.talents = { 198038 --[[Final Verdict--]], 213757 --[[Execution Sentence--]], 205228 --[[Consecration--]], 203316 --[[The Fires of Justice--]], 217020 --[[Zeal--]], 218178 --[[Greater Judgment--]], 234299 --[[Fist of Justice--]], 20066 --[[Repentance--]], 115750 --[[Blinding Light--]], 202271 --[[Virtue's Blade--]], 231832 --[[Blade of Wrath--]], 198034 --[[Divine Hammer--]], 215661 --[[Justicar's Vengeance--]], 205191 --[[Eye for an Eye--]], 210191 --[[Word of Glory--]], 213313 --[[Divine Intervention--]], 230332 --[[Cavalier--]], 183778 --[[Judgment of Light--]], 223817 --[[Divine Purpose--]], 231895 --[[Crusade--]], 210220 --[[Holy Wrath--]], }; SPELLDB.PALADIN.HOLY.pvpTalents = { 208683 --[[Gladiator's Medallion--]], 214027 --[[Adaptation--]], 196029 --[[Relentless--]], 195330 --[[Defender of the Weak--]], 195483 --[[Vim and Vigor--]], 210294 --[[Divine Favor--]], 199324 --[[Divine Vision--]], 199325 --[[Unbound Freedom--]], 199330 --[[Cleanse the Weak--]], 199422 --[[Holy Ritual--]], 199424 --[[Pure of Heart--]], 216327 --[[Light's Grace--]], 199441 --[[Avenging Light--]], 199452 --[[Ultimate Sacrifice--]], 210378 --[[Darkest before the Dawn--]], 199456 --[[Spreading the Word--]], 199454 --[[Blessed Hands--]], 216331 --[[Avenging Crusader--]], }; SPELLDB.PALADIN.PROTECTION.pvpTalents = { 208683 --[[Gladiator's Medallion--]], 214027 --[[Adaptation--]], 196029 --[[Relentless--]], 195338 --[[Relentless Assault--]], 207028 --[[Inquisition--]], 195389 --[[Softened Blows--]], 215652 --[[Shield of Virtue--]], 199325 --[[Unbound Freedom--]], 210341 --[[Warrior of Light--]], 199422 --[[Holy Ritual--]], 236186 --[[Cleansing Light--]], 199428 --[[Luminescence--]], 216868 --[[Hallowed Ground--]], 216855 --[[Guarded by the Light--]], 216853 --[[Sacred Duty--]], 216860 --[[Judgments of the Pure--]], 199542 --[[Steed of Glory--]], 228049 --[[Guardian of the Forgotten Queen--]], }; SPELLDB.PALADIN.RETRIBUTION.pvpTalents = { 208683 --[[Gladiator's Medallion--]], 214027 --[[Adaptation--]], 196029 --[[Relentless--]], 195416 --[[Hardiness--]], 195282 --[[Reinforced Armor--]], 195425 --[[Sparring--]], 204979 --[[Jurisdiction--]], 199325 --[[Unbound Freedom--]], 204934 --[[Law and Order--]], 199422 --[[Holy Ritual--]], 236186 --[[Cleansing Light--]], 199428 --[[Luminescence--]], 210323 --[[Vengeance Aura--]], 210256 --[[Blessing of Sanctuary--]], 204927 --[[Seraphim's Blessing--]], 204898 --[[Lawbringer--]], 204914 --[[Divine Punisher--]], 204939 --[[Hammer of Reckoning--]], };
local module = {} local accessories = require(script.Parent.Accessories) local creation_list = { 'Astolfus', 'Awesome', 'Bed', 'Black', 'Boy', 'Charming', 'Cinnamon', 'Equinox', 'Merry', 'Messy', 'Ponytail', 'Scene', 'Shaggy', 'SpikyBed' } function module.Wear(info, item) return accessories.Wear(info, item, 'Hair') end module.list = creation_list return module
local inputCode = { 1102,34463338,34463338,63,1007,63,34463338,63,1005,63,53,1102,3,1,1000,109,988,209,12,9,1000,209,6,209,3,203,0,1008,1000,1,63,1005,63,65,1008,1000,2,63,1005,63,904,1008,1000,0,63,1005,63,58,4,25,104,0,99,4,0,104,0,99,4,17,104,0,99,0,0,1101,0,33,1017,1101,24,0,1014,1101,519,0,1028,1102,34,1,1004,1101,0,31,1007,1101,0,844,1025,1102,0,1,1020,1102,38,1,1003,1102,39,1,1008,1102,849,1,1024,1101,0,22,1001,1102,25,1,1009,1101,1,0,1021,1101,0,407,1022,1101,404,0,1023,1101,0,35,1013,1101,27,0,1011,1101,0,37,1016,1102,1,26,1019,1102,28,1,1015,1101,0,30,1000,1102,1,36,1005,1101,0,29,1002,1101,23,0,1012,1102,1,32,1010,1102,21,1,1006,1101,808,0,1027,1102,20,1,1018,1101,0,514,1029,1102,1,815,1026,109,14,2107,24,-5,63,1005,63,199,4,187,1105,1,203,1001,64,1,64,1002,64,2,64,109,-1,2108,21,-7,63,1005,63,225,4,209,1001,64,1,64,1106,0,225,1002,64,2,64,109,-16,1201,6,0,63,1008,63,35,63,1005,63,249,1001,64,1,64,1106,0,251,4,231,1002,64,2,64,109,9,2102,1,2,63,1008,63,37,63,1005,63,271,1105,1,277,4,257,1001,64,1,64,1002,64,2,64,109,11,1208,-8,23,63,1005,63,293,1105,1,299,4,283,1001,64,1,64,1002,64,2,64,109,8,21107,40,39,-8,1005,1017,319,1001,64,1,64,1106,0,321,4,305,1002,64,2,64,109,-28,2101,0,6,63,1008,63,39,63,1005,63,341,1106,0,347,4,327,1001,64,1,64,1002,64,2,64,109,19,2107,26,-7,63,1005,63,363,1106,0,369,4,353,1001,64,1,64,1002,64,2,64,109,1,1202,-9,1,63,1008,63,39,63,1005,63,395,4,375,1001,64,1,64,1105,1,395,1002,64,2,64,109,9,2105,1,-3,1106,0,413,4,401,1001,64,1,64,1002,64,2,64,109,-13,1207,-4,26,63,1005,63,435,4,419,1001,64,1,64,1105,1,435,1002,64,2,64,109,-1,21101,41,0,7,1008,1019,41,63,1005,63,461,4,441,1001,64,1,64,1105,1,461,1002,64,2,64,109,7,21107,42,43,-2,1005,1017,479,4,467,1105,1,483,1001,64,1,64,1002,64,2,64,109,-6,21108,43,46,0,1005,1013,499,1106,0,505,4,489,1001,64,1,64,1002,64,2,64,109,17,2106,0,-2,4,511,1105,1,523,1001,64,1,64,1002,64,2,64,109,-27,1202,-1,1,63,1008,63,28,63,1005,63,547,1001,64,1,64,1106,0,549,4,529,1002,64,2,64,109,18,1206,-1,567,4,555,1001,64,1,64,1106,0,567,1002,64,2,64,109,-16,21102,44,1,6,1008,1011,43,63,1005,63,587,1106,0,593,4,573,1001,64,1,64,1002,64,2,64,109,8,21102,45,1,-1,1008,1012,45,63,1005,63,619,4,599,1001,64,1,64,1105,1,619,1002,64,2,64,109,7,1205,1,633,4,625,1106,0,637,1001,64,1,64,1002,64,2,64,109,-8,2102,1,-3,63,1008,63,25,63,1005,63,659,4,643,1105,1,663,1001,64,1,64,1002,64,2,64,109,14,1206,-5,679,1001,64,1,64,1105,1,681,4,669,1002,64,2,64,109,-28,2101,0,2,63,1008,63,30,63,1005,63,707,4,687,1001,64,1,64,1106,0,707,1002,64,2,64,109,21,21101,46,0,0,1008,1019,48,63,1005,63,727,1106,0,733,4,713,1001,64,1,64,1002,64,2,64,109,-3,21108,47,47,1,1005,1017,751,4,739,1106,0,755,1001,64,1,64,1002,64,2,64,109,-13,1207,0,37,63,1005,63,771,1105,1,777,4,761,1001,64,1,64,1002,64,2,64,109,7,2108,21,-9,63,1005,63,797,1001,64,1,64,1105,1,799,4,783,1002,64,2,64,109,22,2106,0,-5,1001,64,1,64,1106,0,817,4,805,1002,64,2,64,109,-4,1205,-8,829,1106,0,835,4,823,1001,64,1,64,1002,64,2,64,109,-4,2105,1,0,4,841,1105,1,853,1001,64,1,64,1002,64,2,64,109,-30,1208,6,30,63,1005,63,871,4,859,1105,1,875,1001,64,1,64,1002,64,2,64,109,-2,1201,9,0,63,1008,63,22,63,1005,63,897,4,881,1106,0,901,1001,64,1,64,4,64,99,21101,27,0,1,21102,1,915,0,1106,0,922,21201,1,66266,1,204,1,99,109,3,1207,-2,3,63,1005,63,964,21201,-2,-1,1,21102,942,1,0,1105,1,922,22101,0,1,-1,21201,-2,-3,1,21101,0,957,0,1106,0,922,22201,1,-1,-2,1105,1,968,21202,-2,1,-2,109,-3,2106,0,0 --104,1125899906842624,99 --1102,34915192,34915192,7,4,7,99,0 --109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99 } function deepcopy(orig) local orig_type = type(orig) local copy if orig_type == 'table' then copy = {} 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 IntCode = require"IntCode" local intCode1 = deepcopy(IntCode) intCode1:setMemory(deepcopy(inputCode)) local intCode2 = deepcopy(IntCode) intCode2:setMemory(deepcopy(inputCode)) print("answer 1 is", intCode1:run(1, true)) print("answer 2 is", intCode2:run(2, true))
-- -- tests/premake5.lua -- Automated test suite for Premake 5.x -- Copyright (c) 2008-2013 Jason Perkins and the Premake project -- dofile("testfx.lua") -- -- Some helper functions -- test.createsolution = function() local sln = solution "MySolution" configurations { "Debug", "Release" } local prj = project "MyProject" language "C++" kind "ConsoleApp" return sln, prj end test.createproject = function(sln) local n = #sln.projects + 1 if n == 1 then n = "" end local prj = project ("MyProject" .. n) language "C++" kind "ConsoleApp" return prj end test.getconfig = function(prj, buildcfg, platform) local sln = premake.oven.bakeSolution(prj.solution) prj = premake.solution.getproject(sln, prj.name) return premake.project.getconfig(prj, buildcfg, platform) end -- -- The test suites -- -- Base API tests dofile("test_dofile.lua") dofile("test_string.lua") dofile("base/test_configset.lua") dofile("base/test_context.lua") dofile("base/test_criteria.lua") dofile("base/test_detoken.lua") dofile("base/test_include.lua") dofile("base/test_os.lua") dofile("base/test_override.lua") dofile("base/test_path.lua") dofile("base/test_premake_command.lua") dofile("base/test_table.lua") dofile("base/test_tree.lua") dofile("base/test_uuid.lua") -- Solution object tests dofile("solution/test_eachconfig.lua") dofile("solution/test_location.lua") dofile("solution/test_objdirs.lua") -- Project object tests dofile("project/test_config_maps.lua") dofile("project/test_eachconfig.lua") dofile("project/test_filename.lua") dofile("project/test_getconfig.lua") dofile("project/test_location.lua") dofile("project/test_vpaths.lua") -- Configuration object tests dofile("config/test_linkinfo.lua") dofile("config/test_links.lua") dofile("config/test_targetinfo.lua") -- Baking tests dofile("oven/test_filtering.lua") -- API tests dofile("api/test_array_kind.lua") dofile("api/test_callback.lua") dofile("api/test_containers.lua") dofile("api/test_directory_kind.lua") dofile("api/test_list_kind.lua") dofile("api/test_path_kind.lua") dofile("api/test_register.lua") dofile("api/test_string_kind.lua") -- Control system tests dofile("test_premake.lua") dofile("base/test_validation.lua") -- Toolset tests dofile("tools/test_dotnet.lua") dofile("tools/test_gcc.lua") dofile("tools/test_msc.lua") dofile("tools/test_snc.lua") -- Visual Studio 2005-2010 C# projects dofile("actions/vstudio/cs2005/test_assembly_refs.lua") dofile("actions/vstudio/cs2005/test_build_events.lua") dofile("actions/vstudio/cs2005/test_compiler_props.lua") dofile("actions/vstudio/cs2005/test_debug_props.lua") dofile("actions/vstudio/cs2005/test_files.lua") dofile("actions/vstudio/cs2005/test_icon.lua") dofile("actions/vstudio/cs2005/test_output_props.lua") dofile("actions/vstudio/cs2005/projectelement.lua") dofile("actions/vstudio/cs2005/test_platform_groups.lua") dofile("actions/vstudio/cs2005/test_project_refs.lua") dofile("actions/vstudio/cs2005/projectsettings.lua") -- Visual Studio 2005-2010 solutions dofile("actions/vstudio/sln2005/test_dependencies.lua") dofile("actions/vstudio/sln2005/test_header.lua") dofile("actions/vstudio/sln2005/test_nested_projects.lua") dofile("actions/vstudio/sln2005/test_projects.lua") dofile("actions/vstudio/sln2005/test_platforms.lua") -- Visual Studio 2002-2008 C/C++ projects dofile("actions/vstudio/vc200x/test_assembly_refs.lua") dofile("actions/vstudio/vc200x/test_build_steps.lua") dofile("actions/vstudio/vc200x/test_configuration.lua") dofile("actions/vstudio/vc200x/test_compiler_block.lua") dofile("actions/vstudio/vc200x/test_debug_settings.lua") dofile("actions/vstudio/vc200x/test_excluded_configs.lua") dofile("actions/vstudio/vc200x/test_external_compiler.lua") dofile("actions/vstudio/vc200x/test_external_linker.lua") dofile("actions/vstudio/vc200x/test_files.lua") dofile("actions/vstudio/vc200x/test_linker_block.lua") dofile("actions/vstudio/vc200x/test_manifest_block.lua") dofile("actions/vstudio/vc200x/test_nmake_settings.lua") dofile("actions/vstudio/vc200x/test_platforms.lua") dofile("actions/vstudio/vc200x/test_project.lua") dofile("actions/vstudio/vc200x/test_project_refs.lua") dofile("actions/vstudio/vc200x/test_resource_compiler.lua") -- Visual Studio 2010 C/C++ projects dofile("actions/vstudio/vc2010/test_assembly_refs.lua") dofile("actions/vstudio/vc2010/test_compile_settings.lua") dofile("actions/vstudio/vc2010/test_config_props.lua") dofile("actions/vstudio/vc2010/test_debug_settings.lua") dofile("actions/vstudio/vc2010/test_excluded_configs.lua") dofile("actions/vstudio/vc2010/test_globals.lua") dofile("actions/vstudio/vc2010/test_header.lua") dofile("actions/vstudio/vc2010/test_files.lua") dofile("actions/vstudio/vc2010/test_filter_ids.lua") dofile("actions/vstudio/vc2010/test_filters.lua") dofile("actions/vstudio/vc2010/test_item_def_group.lua") dofile("actions/vstudio/vc2010/test_link.lua") dofile("actions/vstudio/vc2010/test_manifest.lua") dofile("actions/vstudio/vc2010/test_nmake_props.lua") dofile("actions/vstudio/vc2010/test_output_props.lua") dofile("actions/vstudio/vc2010/test_project_configs.lua") dofile("actions/vstudio/vc2010/test_project_refs.lua") dofile("actions/vstudio/vc2010/test_prop_sheet.lua") dofile("actions/vstudio/vc2010/test_resource_compile.lua") -- Visual Studio 2012 dofile("actions/vs2012/test_csproj_common_props.lua") dofile("actions/vs2012/test_csproj_project_element.lua") dofile("actions/vs2012/test_csproj_project_props.lua") dofile("actions/vs2012/test_csproj_targets.lua") dofile("actions/vs2012/test_sln_header.lua") dofile("actions/vs2012/test_vcxproj_config_props.lua") -- Visual Studio 2013 dofile("actions/vs2013/test_csproj_project_element.lua") dofile("actions/vs2013/test_sln_header.lua") dofile("actions/vs2013/test_vcxproj_config_props.lua") -- Makefile tests dofile("actions/make/test_make_escaping.lua") dofile("actions/make/test_make_tovar.lua") -- Makefile solutions dofile("actions/make/solution/test_config_maps.lua") dofile("actions/make/solution/test_default_config.lua") dofile("actions/make/solution/test_help_rule.lua") dofile("actions/make/solution/test_project_rule.lua") -- Makefile C/C++ projects dofile("actions/make/cpp/test_clang.lua") dofile("actions/make/cpp/test_file_rules.lua") dofile("actions/make/cpp/test_flags.lua") dofile("actions/make/cpp/test_make_pch.lua") dofile("actions/make/cpp/test_make_linking.lua") dofile("actions/make/cpp/test_objects.lua") dofile("actions/make/cpp/test_ps3.lua") dofile("actions/make/cpp/test_target_rules.lua") dofile("actions/make/cpp/test_tools.lua") dofile("actions/make/cpp/test_wiidev.lua") -- Makefile C# projects dofile("actions/make/cs/test_embed_files.lua") dofile("actions/make/cs/test_flags.lua") dofile("actions/make/cs/test_links.lua") dofile("actions/make/cs/test_sources.lua") -- -- Register a test action -- newoption { trigger = "test", description = "A suite or test to run" } newaction { trigger = "test", description = "Run the automated test suite", execute = function () if _OPTIONS["test"] then local t = string.explode(_OPTIONS["test"] or "", ".", true) passed, failed = test.runall(t[1], t[2]) else passed, failed = test.runall() end msg = string.format("%d tests passed, %d failed", passed, failed) if (failed > 0) then -- should probably return an error code here somehow print(msg) else print(msg) end end }
function love.conf(t) t.window.width = 1200 t.window.height = 700 t.console = true end
--- Demo all that FDoc has to offer. -- -- Triple ticks will be automatically recognized as an example. -- ``` -- -- Some example. This comment will appear in the example. -- test(123, player, { test = true }) -- ``` -- -- You can continue writing description after examples. -- All lines that begin with @ will be treated differently. -- -- @warning [Internal] Some custom message to append instead of default message for "Internal". -- @deprecation [Text to display in the warning window. Should be deprecation reason.] -- @deprecation_version [0.8.0] -- @param a=Default Value or Description [Number Some number] -- @param b [Object Some object] -- @param c [Hash Table] -- @return [Foo blank foo object, Number one hundred] -- -- You can also refer to other functions (both variations are valid) -- @see other_function -- @see [MyClass#method] function test(a, b, c) return Foo.new(), 100 end --- Demo variable argument functions. -- @variant foo(a, b) -- @param a [Number This variant accepts a number as the first parameter] -- @param b [String And a string as the second parameter!] -- @variant foo(a) -- @param a [String If you specify a string here it will do something else!] -- @return [Nil You do not have to specify this explicitly if it returns nil, but you can if you want to add a message to it.] -- function foo(a, b) -- ... end
--- Contains the entire world connection graph local GameContext = require('classes/game_context') local World = require('classes/world/world') GameContext:add_serialize_hook('world', function(self, copy, k, v) copy[k] = v:serialize() end) GameContext:add_deserialize_hook('world', function(cls, serd, copy, k, v) copy[k] = World.deserialize(v) end)
#! /usr/bin/env lua -- -- Copyright (c) 2010 The NetBSD Foundation, Inc. -- All rights reserved. -- -- This code is derived from software contributed to The NetBSD Foundation -- by Alistair Crooks ([email protected]) -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions -- are met: -- 1. Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- 2. Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- -- THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -- TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -- PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -- BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. -- -- a short HKP client require("cURL") -- command line args dofile "optparse.lua" opt = OptionParser{usage="%prog [options] file", version="20100226"} opt.add_option{"-V", "--version", action="store_true", dest="version", help="--version"} opt.add_option{"-m", "--mr", action="store_true", dest="mr", help="-m"} opt.add_option{"-o", "--op", action="store", dest="op", help="-o op"} opt.add_option{"-p", "--port", action="store", dest="port", help="-p port"} opt.add_option{"-s", "--server", action="store", dest="server", help="-s server"} -- parse command line args options,args = opt.parse_args() -- set defaults local server = options.server or "pgp.mit.edu" local port = options.port or 11371 local op = options.op or "get" local mr = "" if options.mr then mr = "&options=mr" end -- get output stream f = io.output() c = cURL.easy_init() -- setup url c:setopt_url("http://" .. server .. ":" .. port .. "/pks/lookup?op=" .. op .. "&search=" .. args[1] .. mr) -- perform, invokes callbacks c:perform({writefunction = function(str) f:write(str) end}) -- close output file f:close()
function applyMods() ---------------------- -- Pig Pen Interior -- ---------------------- -- Bar pigpen1 = engineLoadTXD("ls/lee_stripclub1.txd") engineImportTXD(pigpen1, 14831) -- corver stage + seat pigpen2 = engineLoadTXD("ls/lee_stripclub.txd") engineImportTXD(pigpen2, 14832) -- Backwall seats engineImportTXD(pigpen2, 14833) -- columns engineImportTXD(pigpen2, 14835) -- corner seats engineImportTXD(pigpen2, 14837) -- main interior structure engineImportTXD(pigpen2, 14838) ------------------------ -- bus Stop -- ------------------------ busStop = engineLoadTXD("ls/bustopm.txd") engineImportTXD(busStop, 1257) ---------------- -- Gang Tags -- ---------------- tag1 = engineLoadTXD("tags/tags_lafront.txd") -- vG logo engineImportTXD(tag1, 1524) tag2 = engineLoadTXD("tags/tags_lakilo.txd") -- MTA engineImportTXD(tag2, 1525) tag3 = engineLoadTXD ( "tags/tags_larifa.txd" ) -- Crips engineImportTXD ( tag3, 1526 ) -- tag4 = engineLoadTXD ( "tags/tags_larollin.txd" ) -- engineImportTXD ( tag4, 1527 ) -- tag5 = engineLoadTXD ( "tags/tags_laseville.txd" ) -- engineImportTXD ( tag5, 1528 ) -- tag6 = engineLoadTXD ( "tags/tags_latemple.txd" ) -- engineImportTXD ( tag6, 1529 ) -- tag7 = engineLoadTXD ( "tags/tags_lavagos.txd" ) -- engineImportTXD ( tag7, 1530 ) tag8 = engineLoadTXD ( "tags/tags_laazteca.txd" ) -- Los Malvados engineImportTXD ( tag8, 1531 ) --------- -- BTR -- --------- towing = engineLoadTXD ( "ls/eastbeach3c_lae2.txd" ) engineImportTXD ( towing, 17555 ) --------------- -- Moscovian -- --------------- moscovian = engineLoadTXD( "ls/gangblok1_lae2.txd" ) engineImportTXD ( moscovian, 17700 ) end addEventHandler("onClientResourceStart", getResourceRootElement(), applyMods)
ITEM.name = "Modafine Tablets" ITEM.description = "A small blister packet." ITEM.longdesc = "Modafine is a mixture of drugs consisting of a strong nerve agent as well as other stabilizing drugs, often used by STALKERs to cleanse their minds. Shortly after ingesting, a harsh physical discomfort will wash over the user. After the initial complications though, the ingesters mind will start clearing up." ITEM.model = "models/lostsignalproject/items/medical/radioprotector.mdl" ITEM.sound = "stalkersound/inv_eat_pills.mp3" ITEM.width = 1 ITEM.height = 1 ITEM.price = 660 ITEM.quantity = 2 ITEM.psyheal = 50 ITEM.weight = 0.015 ITEM.flatweight = 0.010 ITEM.exRender = true ITEM.iconCam = { pos = Vector(-200, 0, 0), ang = Angle(0, -0, 45), fov = 1.5, } function ITEM:PopulateTooltipIndividual(tooltip) ix.util.PropertyDesc(tooltip, "Medical", Color(64, 224, 208)) ix.util.PropertyDesc(tooltip, "Calms the Mind", Color(64, 224, 208)) end ITEM.functions.use = { name = "Heal", icon = "icon16/stalker/heal.png", OnRun = function(item) local quantity = item:GetData("quantity", item.quantity) item.player:AddBuff("buff_psyheal", 160, { amount = item.psyheal/320 }) --item.player:AddBuff("debuff_psypillmovement", 15, {}) item.player:TakeDamage(15, item.player, item.player) ix.chat.Send(item.player, "iteminternal", "pops out a pill from the "..item.name.." package and swallows it.", false) quantity = quantity - 1 if (quantity >= 1) then item:SetData("quantity", quantity) return false end return true end, OnCanRun = function(item) return (!IsValid(item.entity)) and item.invID == item:GetOwner():GetCharacter():GetInventory():GetID() end }
--[[Player commands: Warp players to you Return players to previous position (Un)Freeze events players Enable/disable weapons Set players health to 10 Enable/Disable players collision Enable/disable players damage Show/Hide players blips Disable/Enable team damage Vehicles Commands: (Un)freeze event vehicles Enable/Disable Vehicle Damage Proof Enable/Disable Vehicle Collision Destroy Event Vehicles Enable/Disable Vehicles bumper ramp (bumper ramp will be added to event vehicles) Fix Event Vehicles Lock Event Vehicles Enable vehicles fly Blow vehicles Weapon commands: Disable/enable explosives (Grenades, Satchels, Teargas, Molotov) Disable/enable rifles (country rifle, sniper) Disable/enable heavy (Minigun, RPG) Disable/enable shotguns (Spas, Shotgun) Disable/enable SMG (MP5, Tec9, Uzi) Disable/enable pistols (Deagle, Pistol, Silenced Pistol) Pickup Commands: Create Health Pickup Create Armor Pickup Create Parachute Pickup Destroy Event Pickups Other/Staff Commands: Add race checkpoint (checkpoint will be added in the current staff postion) Add race finishpoint (same as race checkpoint) Destroy checkpoints Add event marker Add bump ramp (get inside a vehicle first) ]] GUIEditor = { checkbox = {}, edit = {}, button = {}, window = {}, label = {}, gridlist = {} } addEventHandler("onClientResourceStart", resourceRoot, function() local screenW, screenH = guiGetScreenSize() GUIEditor.window[1] = guiCreateWindow((screenW - 862) / 2, (screenH - 684) / 2, 862, 684, "AURORA ~ Event System V2", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.gridlist[1] = guiCreateGridList(10, 33, 318, 555, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[1], "Commands", 0.9) GUIEditor.edit[1] = guiCreateEdit(434, 37, 179, 30, "", false, GUIEditor.window[1]) GUIEditor.label[1] = guiCreateLabel(338, 43, 80, 15, "Event Name:", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(464, 77, 120, 23, "Create Event", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF41F12F") GUIEditor.label[2] = guiCreateLabel(646, 42, 80, 15, "Event Limit:", false, GUIEditor.window[1]) GUIEditor.button[2] = guiCreateButton(716, 77, 120, 23, "Multiple Warps", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFAF225") GUIEditor.checkbox[1] = guiCreateCheckBox(338, 81, 106, 15, "Freeze on warp", false, false, GUIEditor.window[1]) GUIEditor.edit[2] = guiCreateEdit(736, 37, 84, 30, "", false, GUIEditor.window[1]) GUIEditor.label[3] = guiCreateLabel(338, 119, 106, 15, "Event Dimension:", false, GUIEditor.window[1]) GUIEditor.edit[3] = guiCreateEdit(463, 110, 121, 34, "5000", false, GUIEditor.window[1]) GUIEditor.label[4] = guiCreateLabel(338, 159, 106, 15, "Event Interior:", false, GUIEditor.window[1]) GUIEditor.gridlist[2] = guiCreateGridList(338, 189, 219, 279, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[2], "Online Players", 0.9) GUIEditor.edit[4] = guiCreateEdit(437, 478, 120, 26, "MAX 100,000", false, GUIEditor.window[1]) GUIEditor.button[3] = guiCreateButton(338, 478, 89, 25, "Send Money", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FF20F020") GUIEditor.button[4] = guiCreateButton(338, 513, 89, 25, "Send Score", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[4], "NormalTextColour", "FF20F020") GUIEditor.edit[5] = guiCreateEdit(437, 512, 120, 26, "MAX 15", false, GUIEditor.window[1]) GUIEditor.gridlist[3] = guiCreateGridList(621, 189, 225, 279, false, GUIEditor.window[1]) guiGridListAddColumn(GUIEditor.gridlist[3], "Players in Event", 0.9) GUIEditor.button[5] = guiCreateButton(621, 479, 89, 25, "Kick Player", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[5], "NormalTextColour", "FFFE1111") GUIEditor.button[6] = guiCreateButton(747, 479, 99, 25, "(Un)Freeze Player", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[6], "NormalTextColour", "FFFE1111") GUIEditor.button[7] = guiCreateButton(10, 598, 318, 36, "No command selected", false, GUIEditor.window[1]) GUIEditor.label[5] = guiCreateLabel(43, 644, 251, 15, "NOTE: Select a command from the list above", false, GUIEditor.window[1]) guiLabelSetColor(GUIEditor.label[5], 254, 31, 31) GUIEditor.label[6] = guiCreateLabel(687, 566, 95, 16, "Create Vehicles :", false, GUIEditor.window[1]) GUIEditor.edit[6] = guiCreateEdit(619, 592, 233, 24, "Vehicle Name/ID", false, GUIEditor.window[1]) GUIEditor.button[8] = guiCreateButton(618, 626, 89, 35, "Create Vehicle Marker", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[8], "NormalTextColour", "FF4DFE1E") GUIEditor.button[9] = guiCreateButton(757, 626, 89, 35, "Destroy Vehicle Marker", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[9], "NormalTextColour", "FF4DFE1E") GUIEditor.button[10] = guiCreateButton(621, 514, 89, 25, "Give Jetpack", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[10], "NormalTextColour", "FFFE1111") GUIEditor.button[11] = guiCreateButton(747, 514, 99, 25, "Remove Jetpack", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[11], "NormalTextColour", "FFFE1111") GUIEditor.label[7] = guiCreateLabel(611, 134, 72, 15, "Team Warps", false, GUIEditor.window[1]) guiLabelSetColor(GUIEditor.label[7], 34, 248, 200) GUIEditor.button[12] = guiCreateButton(590, 77, 120, 23, "Close Warps", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[12], "NormalTextColour", "FF41F12F") GUIEditor.button[13] = guiCreateButton(590, 107, 120, 23, "Stop Event", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[13], "NormalTextColour", "FF41F12F") GUIEditor.edit[7] = guiCreateEdit(463, 150, 121, 34, "0", false, GUIEditor.window[1]) GUIEditor.button[14] = guiCreateButton(716, 107, 120, 23, "Time Counter", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[14], "NormalTextColour", "FF41F12F") GUIEditor.edit[8] = guiCreateEdit(589, 150, 121, 34, "Team Name", false, GUIEditor.window[1]) GUIEditor.edit[9] = guiCreateEdit(716, 150, 121, 34, "Time (Seconds)", false, GUIEditor.window[1]) GUIEditor.button[15] = guiCreateButton(362, 647, 155, 27, "Close Panel", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[15], "NormalTextColour", "FFE824F5") GUIEditor.label[8] = guiCreateLabel(577, 318, 17, 15, ">>>>", false, GUIEditor.window[1]) GUIEditor.label[9] = guiCreateLabel(362, 608, 155, 16, "Event Players Number:", false, GUIEditor.window[1]) guiLabelSetColor(GUIEditor.label[9], 33, 255, 49) end ) if (fileExists("client.lua")) then fileDelete("client.lua") end