content
stringlengths
5
1.05M
-- FXVersion Version fx_version 'adamant' games { 'gta5' } -- Client Scripts client_script 'client/main.lua' -- Server Scripts server_script 'server/main.lua' -- NUI Default Page ui_page "client/html/index.html" -- Files needed for NUI -- DON'T FORGET TO ADD THE SOUND FILES TO THIS! files { 'client/html/index.html', -- Begin Sound Files Here... -- client/html/sounds/ ... .ogg 'client/html/sounds/*.ogg', 'client/html/sounds/Clothes1.ogg', 'client/html/sounds/StashOpen.ogg', 'client/html/sounds/DoorOpen.ogg', }
local queue = {} local MAX_QUEUE_SIZE = 10000 local FLUSH_INTERVAL = 1 local _M = {} local function flush_queue() local current_queue = queue queue = {} for _,v in ipairs(current_queue) do v.func(unpack(v.args)) end end function _M.init_worker() local _, err = ngx.timer.every(FLUSH_INTERVAL, flush_queue) if err then ngx.log(ngx.ERR, string.format("error when setting up timer.every for flush_queue: %s", tostring(err))) end end function _M.enqueue(func, ...) if #queue >= MAX_QUEUE_SIZE then return "deferred timer queue full" end table.insert(queue, { func = func, args = {...} }) end if _TEST then _M.MAX_QUEUE_SIZE = MAX_QUEUE_SIZE _M.get_queue = function() return queue end _M.flush_queue = flush_queue end return _M
--[[------------------------------------------------------------------------- * * ReadyCheck module for PerfectRaid addon. * * Written by: Panoramix * Version: 1.0 * ---------------------------------------------------------------------------]] local ReadyCheck = PerfectRaid:NewModule("PerfectRaid-ReadyCheck") local frames -- the duration to fade the ready check status ReadyCheck.fadeDuration = 4 function ReadyCheck:Initialize() frames = PerfectRaid.frames self:RegisterEvent("READY_CHECK", "UpdateReadyCheck") self:RegisterEvent("READY_CHECK_CONFIRM", "UpdateReadyCheck") self:RegisterEvent("READY_CHECK_FINISHED", "UpdateReadyCheck") self.started = false end function ReadyCheck:ConfigureButton( button ) button.readycheck = CreateFrame("Frame", nil, button.leftbox) button.readycheck.indicator = button.readycheck:CreateTexture(nil, "OVERLAY") end function ReadyCheck:UpdateButtonLayout( button ) button.readycheck:ClearAllPoints() button.readycheck:SetWidth(button:GetHeight( )) button.readycheck:SetHeight(button:GetHeight( )) button.readycheck:SetFrameLevel(button.leftbox:GetFrameLevel()+1) button.readycheck.indicator:SetAllPoints() button.readycheck.indicator:SetTexture(READY_CHECK_READY_TEXTURE) button.readycheck:SetPoint("RIGHT", button.name, "RIGHT", 0, 0) button.readycheck:Hide() end --[[ event = READY_CHECK | READY_CHECK_CONFIRM(unit)| READY_CHECK_FINISHED status = GetReadyCheckStatus( unit ) = "ready" | "notready" | "waiting" ]]-- function ReadyCheck:UpdateReadyCheck( event, target ) -- a ready check is initiated, update all frames if event == "READY_CHECK" then for unit, tbl in pairs(frames) do local status = GetReadyCheckStatus( unit ) for frame in pairs(frames[unit]) do ReadyCheck:SetReadyCheckStatus( frame, status ) end end -- a ready check is confirmed or declined, update frames of the unit elseif event == "READY_CHECK_CONFIRM" then for unit, tbl in pairs(frames) do if UnitIsUnit( target, unit ) then local status = GetReadyCheckStatus( unit ) for frame in pairs(frames[unit]) do ReadyCheck:SetReadyCheckStatus( frame, status ) end break end end -- the ready check has finished, wrap it up elseif event == "READY_CHECK_FINISHED" then -- update any ~ready status for unit, tbl in pairs(frames) do for frame in pairs(frames[unit]) do if frame.readycheck.status then -- update status to not ready if frame.readycheck.status ~= "ready" then ReadyCheck:SetReadyCheckStatus( frame, "notready" ) end -- start fade timer frame.readycheck.elapsed = ReadyCheck.fadeDuration frame.readycheck:SetScript("OnUpdate", function(self, elapsed) self.elapsed = self.elapsed - elapsed self:SetAlpha( self.elapsed / ReadyCheck.fadeDuration ) if self.elapsed <= 0 then self:Hide() self:SetScript("OnUpdate", nil) end end) end end end end end function ReadyCheck:SetReadyCheckStatus( frame, status ) frame.readycheck.status = status if not status then return end if( status == "ready" ) then frame.readycheck.indicator:SetTexture(READY_CHECK_READY_TEXTURE) elseif( status == "notready" ) then frame.readycheck.indicator:SetTexture(READY_CHECK_NOT_READY_TEXTURE) elseif( status == "waiting" ) then frame.readycheck.indicator:SetTexture(READY_CHECK_WAITING_TEXTURE) end frame.readycheck:SetAlpha( 1.0 ) frame.readycheck:Show() end
require("tests/testsuite") DocumentSet.addons.smartquotes.singlequotes = false DocumentSet.addons.smartquotes.doublequotes = false DocumentSet.addons.smartquotes.notinraw = true Cmd.InsertStringIntoParagraph("'Hello, world!'") Cmd.SplitCurrentParagraph() Cmd.InsertStringIntoParagraph('"Hello, world!"') Cmd.SplitCurrentParagraph() Cmd.InsertStringIntoParagraph("flob's") Cmd.SplitCurrentParagraph() Cmd.SetStyle("b") Cmd.InsertStringIntoParagraph("'fnord'") Cmd.SplitCurrentParagraph() Cmd.SetStyle("o") Cmd.SetStyle("i") Cmd.InsertStringIntoParagraph("'") Cmd.SetStyle("b") Cmd.InsertStringIntoParagraph("fnord'") Cmd.SetStyle("o") Cmd.SplitCurrentParagraph() Cmd.ChangeParagraphStyle("RAW") Cmd.InsertStringIntoParagraph("not'd") AssertEquals("RAW", Document[Document.cp].style) Cmd.SplitCurrentParagraph() Cmd.ChangeParagraphStyle("P") Cmd.InsertStringIntoParagraph([["Once upon a time," said K'trx'frn, "there was an aardvark called Albert."]]) Cmd.SplitCurrentParagraph() Cmd.InsertStringIntoParagraph("\"'nested'\"") Cmd.SplitCurrentParagraph() Cmd.GotoBeginningOfDocument() Cmd.SetMark() Cmd.GotoEndOfDocument() DocumentSet.addons.smartquotes.singlequotes = true DocumentSet.addons.smartquotes.doublequotes = true Cmd.Smartquotify() AssertTableEquals({"‘Hello,", "world!’"}, Document[1]) AssertTableEquals({"“Hello,", "world!”"}, Document[2]) AssertTableEquals({"flob’s"}, Document[3]) AssertTableEquals({"\24‘fnord’"}, Document[4]) AssertTableEquals({"\17‘\25fnord’"}, Document[5]) AssertEquals("RAW", Document[6].style) AssertTableEquals({"not'd"}, Document[6]) AssertTableEquals({"“Once", "upon", "a", "time,”", "said", "K’trx’frn,", "“there", "was", "an", "aardvark", "called", "Albert.”"}, Document[7]) AssertTableEquals({"“‘nested’”"}, Document[8]) Cmd.GotoBeginningOfDocument() Cmd.Find("'Hello", "XXXX") Cmd.ReplaceThenFind() Cmd.GotoBeginningOfDocument() Cmd.Find('"Hello', "YYYY") Cmd.ReplaceThenFind() AssertTableEquals({"XXXX,", "world!’"}, Document[1]) AssertTableEquals({"YYYY,", "world!”"}, Document[2]) Cmd.GotoEndOfDocument() Cmd.GotoPreviousParagraph() Cmd.SetMark() Cmd.GotoPreviousParagraph() Cmd.GotoBeginningOfParagraph() Cmd.Unsmartquotify() AssertTableEquals({'"Once', "upon", "a", 'time,"', "said", "K'trx'frn,", '"there', "was", "an", "aardvark", "called", 'Albert."'}, Document[7])
local ReplicatedStorage = game:GetService("ReplicatedStorage") local Modules = ReplicatedStorage.Modules local Roact = require(Modules.Roact) local RoactRodux = require(Modules.RoactRodux) local Character = require(script.Parent.Character) local VisibleCharacters = Roact.Component:extend("VisibleCharacters") function VisibleCharacters:render() local children = {} for characterId, character in ipairs(self.props.characters) do children[tostring(characterId)] = Roact.createElement(Character, { character = character, }) end return Roact.createElement("Folder", nil, children) end VisibleCharacters = RoactRodux.connect( function(state) return { characters = state.characters, } end )(VisibleCharacters) return VisibleCharacters
UnicornJob_Config = { drinks = { alcool = { }, noalcool = { {item = "water", label = "Eau minérale"} } }, clothes = { [1] = { label = "Tenue de serveur", male = { tshirt_1 = 59, tshirt_2 = 1, torso_1 = 55, torso_2 = 0, decals_1 = 0, decals_2 = 0, arms = 41, pants_1 = 25, pants_2 = 0, shoes_1 = 25, shoes_2 = 0, helmet_1 = 46, helmet_2 = 0, chain_1 = 0, chain_2 = 0, ears_1 = 2, ears_2 = 0 }, female = { tshirt_1 = 36, tshirt_2 = 1, torso_1 = 48, torso_2 = 0, decals_1 = 0, decals_2 = 0, arms = 44, pants_1 = 34, pants_2 = 0, shoes_1 = 27, shoes_2 = 0, helmet_1 = 45, helmet_2 = 0, chain_1 = 0, chain_2 = 0, ears_1 = 2, ears_2 = 0 } }, } } pzCore.jobs["unicorn"] = {} pzCore.jobs["unicorn"].config = UnicornJob_Config
return { id = 64, furnitures_1 = { { id = 64103, parent = 0, y = 20, dir = 1, x = 12, child = {} }, { id = 64001, parent = 0, y = 0, dir = 1, x = 0, child = {} }, { id = 64104, parent = 0, y = 12, dir = 1, x = 17, child = {} }, { id = 64002, parent = 0, y = 0, dir = 1, x = 0, child = {} }, { id = 64117, parent = 0, y = 22, dir = 1, x = 22, child = {} }, { id = 64106, parent = 0, y = 21, dir = 1, x = 17, child = {} }, { id = 64114, parent = 0, y = 19, dir = 1, x = 22, child = {} }, { id = 64112, parent = 0, y = 12, dir = 1, x = 21, child = {} } }, furnitures_2 = { { id = 64103, parent = 0, y = 11, dir = 1, x = 8, child = {} }, { id = 64112, parent = 0, y = 8, dir = 1, x = 21, child = {} }, { id = 64105, parent = 0, y = 19, dir = 1, x = 8, child = {} }, { id = 64106, parent = 0, y = 12, dir = 1, x = 13, child = {} }, { id = 64107, parent = 0, y = 12, dir = 1, x = 19, child = {} }, { id = 64001, parent = 0, y = 0, dir = 1, x = 0, child = {} }, { id = 64108, parent = 0, y = 18, dir = 1, x = 22, child = {} }, { id = 64002, parent = 0, y = 0, dir = 1, x = 0, child = {} }, { id = 64101, parent = 0, y = 18, dir = 1, x = 17, child = {} }, { id = 64117, parent = 0, y = 22, dir = 1, x = 22, child = {} }, { id = 64102, parent = 0, y = 18, dir = 1, x = 20, child = {} }, { id = 64104, parent = 0, y = 8, dir = 1, x = 16, child = {} } }, furnitures_3 = { { id = 64111, parent = 0, y = 9, dir = 1, x = 18, child = {} }, { id = 64001, parent = 0, y = 0, dir = 1, x = 0, child = {} }, { id = 64002, parent = 0, y = 0, dir = 1, x = 0, child = {} }, { id = 64117, parent = 0, y = 8, dir = 1, x = 21, child = {} }, { id = 64117, parent = 0, y = 22, dir = 1, x = 22, child = {} }, { id = 64102, parent = 0, y = 13, dir = 1, x = 22, child = {} }, { id = 64103, parent = 0, y = 12, dir = 1, x = 6, child = {} }, { id = 64104, parent = 0, y = 7, dir = 1, x = 4, child = {} }, { id = 64105, parent = 0, y = 19, dir = 1, x = 4, child = {} }, { id = 64106, parent = 0, y = 16, dir = 1, x = 14, child = {} }, { id = 64107, parent = 0, y = 8, dir = 1, x = 9, child = {} }, { id = 64108, parent = 0, y = 11, dir = 1, x = 13, child = {} }, { id = 64104, parent = 0, y = 5, dir = 1, x = 21, child = {} }, { id = 64109, parent = 0, y = 9, dir = 1, x = 16, child = {} }, { id = 64101, parent = 0, y = 13, dir = 1, x = 19, child = {} }, { id = 64110, parent = 0, y = 9, dir = 1, x = 17, child = {} }, { id = 64114, parent = 0, y = 10, dir = 1, x = 22, child = {} } }, furnitures_4 = { { id = 64111, parent = 0, y = 20, dir = 1, x = 7, child = {} }, { id = 64103, parent = 0, y = 13, dir = 1, x = 6, child = {} }, { id = 64113, parent = 0, y = 0, dir = 1, x = 19, child = {} }, { id = 64106, parent = 0, y = 9, dir = 1, x = 0, child = {} }, { id = 64114, parent = 0, y = 8, dir = 1, x = 22, child = {} }, { id = 64117, parent = 0, y = 6, dir = 1, x = 20, child = {} }, { id = 64116, parent = 0, y = 0, dir = 1, x = 3, child = {} }, { id = 64101, parent = 0, y = 12, dir = 1, x = 17, child = {} }, { id = 64001, parent = 0, y = 0, dir = 1, x = 0, child = {} }, { id = 64102, parent = 0, y = 12, dir = 1, x = 19, child = {} }, { id = 64002, parent = 0, y = 0, dir = 1, x = 0, child = {} }, { id = 64103, parent = 0, y = 13, dir = 1, x = 1, child = {} }, { id = 64112, parent = 0, y = 0, dir = 1, x = 13, child = {} }, { id = 64104, parent = 0, y = 5, dir = 1, x = 15, child = {} }, { id = 64115, parent = 0, y = 2, dir = 1, x = 10, child = {} }, { id = 64105, parent = 0, y = 19, dir = 1, x = 0, child = {} }, { id = 64118, parent = 0, y = 0, dir = 1, x = 16, child = {} }, { id = 64106, parent = 0, y = 9, dir = 1, x = 5, child = {} }, { id = 64104, parent = 0, y = 13, dir = 1, x = 13, child = {} }, { id = 64107, parent = 0, y = 19, dir = 1, x = 14, child = {} }, { id = 64118, parent = 0, y = 0, dir = 1, x = 8, child = {} }, { id = 64108, parent = 0, y = 8, dir = 1, x = 12, child = {} }, { id = 64104, parent = 0, y = 5, dir = 1, x = 0, child = {} }, { id = 64109, parent = 0, y = 20, dir = 1, x = 11, child = {} }, { id = 64118, parent = 0, y = 0, dir = 1, x = 0, child = {} }, { id = 64110, parent = 0, y = 20, dir = 1, x = 9, child = {} }, { id = 64117, parent = 0, y = 22, dir = 1, x = 22, child = {} } } }
local function messenger_require(name) return require ('app.messenger.resources.classes.' .. name) end local uv = require "lluv" local ut = require "lluv.utils" local esl = require "lluv.esl" local utils = messenger_require "Messenger.Utils" local BaseChannel = messenger_require "Messenger.Channels.Base" local Logger = messenger_require "Messenger.Logger" local log = Logger.get('chann.sip') local STATUS = utils.STATUS local function sip_contact(cnn, user, cb) cnn:api("sofia_contact " .. user, function(self, err, reply) local contact if not err then contact = (reply:getHeader('Content-Type') == 'api/response') and reply:getBody() end return cb(self, err, contact, reply) end) end local function sip_message_continue(cnn, options, cb) local event = esl.Event('custom', 'SMS::SEND_MESSAGE'); event:addHeader('proto', 'sip'); event:addHeader('dest_proto', 'sip'); event:addHeader('from', options.from) event:addHeader('from_full', 'sip:' .. options.from) event:addHeader('to', options.to) event:addHeader('sip_profile', options.profile) event:addHeader('subject', options.subject or 'SIP SIMPLE') if options.waitReport then event:addHeader('blocking', 'true') end local content_type = options.type or 'text/plain' event:addBody(options.body, content_type) event:addHeader('type', content_type) cnn:sendEvent(event, function(self, err, reply) if err then return cb(self, err) end local uuid = reply:getReplyOk() if not uuid then return cb(self, nil, reply) end local eventName = 'esl::event::CUSTOM::' .. uuid local timeout cnn:on(eventName, function(self, event, reply) -- luacheck: ignore self reply event if (reply:getHeader('Nonblocking-Delivery') == 'true') or reply:getHeader('Delivery-Failure') then self:off(eventName) timeout:close() cb(self, nil, reply) end end) timeout = uv.timer():start(options.timeout * 1000, function() self:off(eventName) cb(self, 'timeout') end) end) end local function sip_message(cnn, options, cb) assert(options.to) assert(options.from) options.subject = options.subject or options.to options.body = options.body or '' options.timeout = options.timeout or 120 if (not options.profile) or options.checkContact then sip_contact(cnn, options.to, function(self, err, contact, reply) local profile if contact then profile = string.match(contact, '^sofia/(.-)/') end if profile then options.profile = options.profile or profile uv.defer(sip_message_continue, cnn, options, cb) else cb(self, err, reply) end end) return end return sip_message_continue(cnn, options, cb) end local SipChannel = ut.class(BaseChannel) do local super = ut.class.super(SipChannel) function SipChannel:__init(messenger, channel_info) self = super(self, '__init', messenger, channel_info) self._settings = channel_info.settings local host, port, auth = self._settings.host, self._settings.port, self._settings.auth self._cnn = esl.Connection{ host, port, auth, reconnect = 5, no_execute_result = true, no_bgapi = true; subscribe = {'CUSTOM SMS::SEND_MESSAGE'}; filter = { ["Nonblocking-Delivery"] = "true", ["Delivery-Failure"] = {"true", "false"}, }; } -- luacheck: push ignore eventName self._cnn:on('esl::reconnect', function(_, eventName) log.info('[%s] esl connected', self:name()) log.info("[%s] ready", self:name()) end) self._cnn:on('esl::disconnect', function(_, eventName, err) local msg = '[%s] esl disconnected' if err then msg = msg .. ': ' tostring(err) end log.info(msg, self:name()) end) self._cnn:on('esl::error::**', function(_, eventName, err) log.info('[%s] esl error: %s', self:name(), tostring(err)) end) self._cnn:on('esl::close', function(_, eventName, err) log.info('[%s] %s %s', self:name(), eventName, err) end) -- luacheck: pop self._cnn:open() return self end function SipChannel:send(message, settings) local messenger = self._messenger local cnn = self._cnn messenger:message_register(self:id(), message, settings, function(message_uuid, res) -- luacheck: ignore res -- @todo check `res` parameter local sip_message_optins = { from = message.source; to = message.destination; body = message.text; -- profile = 'internal'; -- subject = '----'; type = message.content_type or 'text/plain'; waitReport = true; checkContact = true; -- timeout = 120; } sip_message(cnn, sip_message_optins, function(_, err, res) -- luacheck: ignore res if err then log.error('[%s] Fail send message: %s', self:name(), err) return messenger:message_status(message_uuid, self:id(), STATUS.FAIL, tostring(err)) end -- We send message without waiting response. So we really can not -- be sure either this message delivery or not. if res:getHeader('Nonblocking-Delivery') == 'true' then messenger:message_status(message_uuid, self:id(), STATUS.SUCCESS, 'async send without delivery report') return log.info("[%s] Async send - pass", self:name()) end -- We send message with waiting response if res:getHeader('Delivery-Failure') then local code = res:getHeader('Delivery-Result-Code') or '--' local status, msg if res:getHeader('Delivery-Failure') == 'true' then status = STATUS.FAIL msg = 'Sync send - fail (' .. code .. ')' else status = STATUS.SUCCESS msg = 'Sync send - pass (' .. code .. ')' end log.info('[%s] %s', self:name(), msg) return messenger:message_status(message_uuid, self:id(), status, msg) end -- E.g. if we use `sip_contact` to get profile and user not registered. if nil == res:getReply() then local reply = res:getBody() or '----' log.info('[%s] Fail send message: %s', self:name(), reply) return messenger:message_status(message_uuid, self:id(), STATUS.FAIL, reply) end -- This can be if `sendEvent` returns error? local _, _, reply = res:getReply() reply = reply or '----' log.info('[%s] Fail send message: %s', self:name(), reply) return messenger:message_status(message_uuid, self:id(), STATUS.FAIL, reply) end) end) end function SipChannel:close(cb) self._cnn:close(function(_, err) if err then log.error('[%s] error while closing esl connection: %s', self:name(), err) end super(self, 'close', cb) end) end end return SipChannel
hook.Add("PlayerInitialSpawn", "bSecure.CheckFamilyShare", function(pPlayer) if pPlayer:IsBot() then return end local serverguard_bans, ulib_bans local OwnerSteamID = pPlayer:OwnerSteamID64() if OwnerSteamID == pPlayer:SteamID64() then return end if serverguard then serverguard_bans = sql.Query(("SELECT * FROM serverguard_bans WHERE community_id='%s' OR ip_address = '%s'"):format(OwnerSteamID, bSecure.FormatIP(pPlayer:IPAddress()))) end if ULib then ulib_bans = sql.Query(("SELECT * FROM ulib_bans WHERE steamid='%s'"):format(OwnerSteamID)) end if ulib_bans and ulib_bans[1] then hook.Run("bSecure.FamilyShareAltDetected", pPlayer, OwnerSteamID) --ULib.Ban(pPlayer, 0, "Bypassing a ban via an alt: " .. ulib_bans[1].reason) bSecure.Ban(pPlayer, "Bypassing a ban via an alt: ".. ulib_bans[1].reason) elseif serverguard_bans and serverguard_bans[1] then hook.Run("bSecure.FamilyShareAltDetected", pPlayer, OwnerSteamID) --serverguard:BanPlayer(nil, pPlayer, 0, "Bypassing a ban via an alt: " .. serverguard_bans[1].reason, true, false) bSecure.CreateDataLog{Player = pPlayer, Code = "101A", Details = "Joined the server on a family shared alt account of ".. OwnerSteamID64} bSecure.Ban(pPlayer, "Bypassing a ban via an alt: ".. serverguard_bans[1].reason) end end)
local ffi = require "ffi" local clang = require "clang" local llvm = require "ffi.llvm" print(jit.version) local format = string.format --[[ around 1ms for a lua_CFunction to multiply a number by 2. around + 0.25ms for lua.h goes up to 3.5ms for 100 multiplies optimizer adds about 1ms more for realistic code, we might expect around 10ms however... the llvm version comes out around 4.6ms the clang version comes out around 4.9ms Seems like the difference isn't worth it. --]] -- olevel is an integer to specify -O0, -O1, -O2, -O3 -- returns 0 if no changes made function optimize(M, olevel) local pm = llvm.PassManager() local pmb = llvm.PassManagerBuilder() pmb:SetOptLevel(olevel or 2) pmb:PopulateModulePassManager(pm) return pm:RunPassManager(M) end function ctest(debug) local code = {[[ extern "C" { #include <lua.h> } ]]} local F = { "extern \"C\" int foo(lua_State * L) {" } F[#F+1] = "double v = lua_tonumber(L, 1);" F[#F+1] = "double two = 2.;" for i = 1, 100 do F[#F+1] = "v = v * two;" end F[#F+1] = "lua_pushnumber(L, v);" F[#F+1] = "return 1;" F[#F+1] = "}" code[#code + 1] = table.concat(F, "\n\t") code = table.concat(code, "\n") cc = clang.Compiler() cc:include("headers") cc:compile(code) cc:optimize("O2") if debug then cc:dump() end jit = cc:jit() return jit:pushcfunction("foo") end -- TEST -- function test(debug) -- create a module: local M = llvm.Module("test") local C = M:GetModuleContext() -- a bit of the lua.h API: local C = M:GetModuleContext() local doubleTy = C:DoubleTypeInContext() local voidTy = C:VoidTypeInContext() local voidPtrTy = voidTy:PointerType(0) local int32Ty = C:Int32TypeInContext() local int32PtrTy = int32Ty:PointerType(0) local int8Ty = C:Int8TypeInContext() local strTy = int8Ty:PointerType(0) local sizeTy = int32Ty local luaStateTy = C:StructCreateNamed("lua_State") local luaStatePtrTy = luaStateTy:PointerType(0) local luaCFunctionTy = llvm.FunctionType(int32Ty, {luaStatePtrTy}) local lua_close = M:AddFunction("lua_close", llvm.FunctionType(voidTy, {luaStatePtrTy})) local lua_newthread = M:AddFunction("lua_newthread", llvm.FunctionType(luaStatePtrTy, {luaStatePtrTy})) local lua_gettop = M:AddFunction("lua_gettop", llvm.FunctionType(int32Ty, {luaStatePtrTy})) local lua_settop = M:AddFunction("lua_settop", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty})) local lua_pushvalue = M:AddFunction("lua_pushvalue", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty})) local lua_remove = M:AddFunction("lua_remove", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty})) local lua_insert = M:AddFunction("lua_insert", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty})) local lua_replace = M:AddFunction("lua_replace", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty})) local lua_checkstack = M:AddFunction("lua_checkstack", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) local lua_xmove = M:AddFunction("lua_xmove", llvm.FunctionType(voidTy, {luaStatePtrTy, luaStatePtrTy, int32Ty})) local lua_isnumber = M:AddFunction("lua_isnumber", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) local lua_isstring = M:AddFunction("lua_isstring", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) local lua_iscfunction = M:AddFunction("lua_iscfunction", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) local lua_isuserdata = M:AddFunction("lua_isuserdata", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) local lua_type = M:AddFunction("lua_type", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) local lua_typename = M:AddFunction("lua_typename", llvm.FunctionType(strTy, {luaStatePtrTy, int32Ty})) local lua_equal = M:AddFunction("lua_equal", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty, int32Ty})) local lua_rawequal = M:AddFunction("lua_rawequal", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty, int32Ty})) local lua_lessthan = M:AddFunction("lua_lessthan", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty, int32Ty})) local lua_tonumber = M:AddFunction("lua_tonumber", llvm.FunctionType(doubleTy, {luaStatePtrTy, int32Ty})) local lua_tointeger = M:AddFunction("lua_tointeger", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) local lua_toboolean = M:AddFunction("lua_toboolean", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) local lua_tolstring = M:AddFunction("lua_tolstring", llvm.FunctionType(strTy, {luaStatePtrTy, int32Ty, int32PtrTy})) local lua_objlen = M:AddFunction("lua_objlen", llvm.FunctionType(sizeTy, {luaStatePtrTy, int32Ty})) local lua_tocfunction = M:AddFunction("lua_tocfunction", llvm.FunctionType(luaCFunctionTy, {luaStatePtrTy, int32Ty})) local lua_touserdata = M:AddFunction("lua_touserdata", llvm.FunctionType(voidPtrTy, {luaStatePtrTy, int32Ty})) local lua_tothread = M:AddFunction("lua_tothread", llvm.FunctionType(luaStatePtrTy, {luaStatePtrTy, int32Ty})) local lua_topointer = M:AddFunction("lua_topointer", llvm.FunctionType(voidPtrTy, {luaStatePtrTy, int32Ty})) local lua_pushnil = M:AddFunction("lua_pushnil", llvm.FunctionType(voidTy, {luaStatePtrTy})) local lua_pushnumber = M:AddFunction("lua_pushnumber", llvm.FunctionType(voidTy, {luaStatePtrTy, doubleTy})) local lua_pushinteger = M:AddFunction("lua_pushinteger", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty})) local lua_pushlstring = M:AddFunction("lua_pushlstring", llvm.FunctionType(voidTy, {luaStatePtrTy, strTy, int32Ty})) local lua_pushstring = M:AddFunction("lua_pushstring", llvm.FunctionType(voidTy, {luaStatePtrTy, strTy})) local lua_pushcclosure = M:AddFunction("lua_pushcclosure", llvm.FunctionType(voidTy, {luaStatePtrTy, luaCFunctionTy, int32Ty})) local lua_pushboolean = M:AddFunction("lua_pushboolean", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty})) local lua_pushlightuserdata = M:AddFunction("lua_pushlightuserdata", llvm.FunctionType(voidTy, {luaStatePtrTy, voidPtrTy})) local lua_pushthread = M:AddFunction("lua_pushthread", llvm.FunctionType(int32Ty, {luaStatePtrTy})) local lua_gettable = M:AddFunction("lua_gettable", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty})) local lua_getfield = M:AddFunction("lua_getfield", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty, strTy})) local lua_rawget = M:AddFunction("lua_rawget", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty})) local lua_rawgeti = M:AddFunction("lua_rawgeti", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty, int32Ty})) local lua_createtable = M:AddFunction("lua_createtable", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty, int32Ty})) local lua_newuserdata = M:AddFunction("lua_newuserdata", llvm.FunctionType(voidPtrTy, {luaStatePtrTy, int32Ty})) local lua_getmetatable = M:AddFunction("lua_getmetatable", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) local lua_getfenv = M:AddFunction("lua_getfenv", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty})) local lua_settable = M:AddFunction("lua_settable", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty})) local lua_setfield = M:AddFunction("lua_setfield", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty, strTy})) local lua_rawset = M:AddFunction("lua_rawset", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty})) local lua_rawseti = M:AddFunction("lua_rawseti", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty, int32Ty})) local lua_setmetatable = M:AddFunction("lua_setmetatable", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) local lua_setfenv = M:AddFunction("lua_setfenv", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) local lua_call = M:AddFunction("lua_call", llvm.FunctionType(voidTy, {luaStatePtrTy, int32Ty, int32Ty})) local lua_pcall = M:AddFunction("lua_pcall", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty, int32Ty, int32Ty})) local lua_cpcall = M:AddFunction("lua_cpcall", llvm.FunctionType(int32Ty, {luaStatePtrTy, luaCFunctionTy, voidPtrTy})) local lua_yield = M:AddFunction("lua_yield", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) local lua_resume = M:AddFunction("lua_resume", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) local lua_status = M:AddFunction("lua_status", llvm.FunctionType(int32Ty, {luaStatePtrTy})) local lua_gc = M:AddFunction("lua_gc", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty, int32Ty})) local lua_error = M:AddFunction("lua_error", llvm.FunctionType(int32Ty, {luaStatePtrTy})) local lua_next = M:AddFunction("lua_next", llvm.FunctionType(int32Ty, {luaStatePtrTy, int32Ty})) -- create an instruction builder: local B = llvm.Builder() -- create Function * local F = M:AddFunction("foo", luaCFunctionTy) F:SetLinkage(llvm.ExternalLinkage) -- get arguments as LLVMValueRef: local L0 = F:GetParam(0) L0:SetValueName("L") -- create body entry BasicBlock: local entryBB = F:AppendBasicBlock("entry") -- add to BB using the builder: B:PositionBuilderAtEnd(entryBB) -- get from stack local l1 = B:Call(lua_tonumber, "l1", L0, int32Ty:ConstInt(1, true)) -- multiply by 2: local v0 = doubleTy:ConstReal(2) for i = 1, 200 do v0 = B:BuildFMul(l1, v0, format("v%d", i)) end -- push result local l1 = B:Call(lua_pushnumber, "l2", L0, v0) B:BuildRet(int32Ty:ConstInt(1, true)) optimize(M, 2) -- dump contents: if debug then M:DumpModule() end -- wrap module with JIT engine: local EE = llvm.ExecutionEngine(M) return EE:GetLuaFunction(F) end function measure(f) local uv = require "uv" local t0 = uv.hrtime() local runs = 1000 local tests = {} for i = 1, runs do tests[i] = coroutine.wrap(f) end for j = 1, 1 do for i = 1, runs do tests[i]() end end local us2ms = 0.000001 local total = (uv.hrtime() - t0) * us2ms print(string.format("avg over %d runs = %.3f (ms)", runs, total/runs)) end local f = test(true) collectgarbage() print(f, f(0.9)) local f = ctest(true) collectgarbage() print(f, f(0.9)) measure(test) measure(ctest) return llvm
local machine = script.Parent.Parent local selection1Name = "Flavors" local selection2Name = "Toppings" local origModel = machine.IceCream local origTool = script["Ice Cream"] local instruction1 = "Select flavor" local instruction2 = "Select topping" local function handleSelection1(ice, button) ice.Scoop.BrickColor = button.Color.Value end local function handleSelection2(ice, button) ice.Scoop.Topping.Texture = button.ToppingID.Value end local module = game.ServerScriptService:FindFirstChild("FoodMachineHandler") if not module then -- install script module = script.FoodMachineHandler module.Parent = game.ServerScriptService else script.FoodMachineHandler:Destroy() end require(module):Add(machine, selection1Name, selection2Name, origModel, origTool, instruction1, instruction2, handleSelection1, handleSelection2)
-------------------------------- -- @module MWSvgSprite -- @extend Sprite -- @parent_module mw -------------------------------- -- -- @function [parent=#MWSvgSprite] setVectorScale -- @param self -- @param #float scale -------------------------------- -- -- @function [parent=#MWSvgSprite] getVectorScale -- @param self -- @return float#float ret (return value: float) -------------------------------- -- Create svg sprite by an svg vector image path.<br> -- param svgPath SVG file path.<br> -- param dpi Preferred dpi. -- @function [parent=#MWSvgSprite] createWithFile -- @param self -- @param #string svgPath -- @param #float dpi -- @return MWSvgSprite#MWSvgSprite ret (return value: mw.MWSvgSprite) -------------------------------- -- Create svg sprite with binary data.<br> -- param imgData SVG binary data.<br> -- param dpi Preferred dpi. -- @function [parent=#MWSvgSprite] createWithRawData -- @param self -- @param #mw.MWBinaryData imgData -- @param #float dpi -- @return MWSvgSprite#MWSvgSprite ret (return value: mw.MWSvgSprite) return nil
-------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- -- file: unit_smart_select.lua -- version: 1.36 -- brief: Selects units as you drag over them and provides selection modifier hotkeys -- original author: Ryan Hileman (aegis) -- -- Copyright (C) 2011. -- Public Domain. -- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function widget:GetInfo() return { name = "SmartSelect", desc = "Selects units as you drag over them. (SHIFT: select all, Z: same type, SPACE: new idle units, CTRL: invert selection) /selectionmode toggles filtering buildings in selection", author = "aegis", date = "Jan 2, 2011", license = "Public Domain", layer = 0, enabled = false } end ----------------------------------------------------------------- -- user config section ----------------------------------------------------------------- -- whether to select buildings when mobile units are inside selection rectangle local selectBuildingsWithMobile = false local includeNanosAsMobile = true -- only select new units identical to those already selected local sameSelectKey = 'z' -- only select new idle units local idleSelectKey = 'space' ----------------------------------------------------------------- -- manually generated locals because I don't have trepan's script ----------------------------------------------------------------- local GetTimer = Spring.GetTimer local GetMouseState = Spring.GetMouseState local GetModKeyState = Spring.GetModKeyState local GetKeyState = Spring.GetKeyState local TraceScreenRay = Spring.TraceScreenRay local WorldToScreenCoords = Spring.WorldToScreenCoords local GetMyTeamID = Spring.GetMyTeamID local GetMyPlayerID = Spring.GetMyPlayerID local GetPlayerInfo = Spring.GetPlayerInfo local GetTeamUnits = Spring.GetTeamUnits local GetAllUnits = Spring.GetAllUnits local GetSelectedUnits = Spring.GetSelectedUnits local GetUnitsInRectangle = Spring.GetUnitsInRectangle local SelectUnitArray = Spring.SelectUnitArray local GetActiveCommand = Spring.GetActiveCommand local GetUnitTeam = Spring.GetUnitTeam local GetGroundHeight = Spring.GetGroundHeight local GetMiniMapGeometry = Spring.GetMiniMapGeometry local IsAboveMiniMap = Spring.IsAboveMiniMap local GetUnitDefID = Spring.GetUnitDefID local GetUnitPosition = Spring.GetUnitPosition local GetUnitCommands = Spring.GetUnitCommands local UnitDefs = UnitDefs local min = math.min local max = math.max local glColor = gl.Color local glVertex = gl.Vertex local glLineWidth = gl.LineWidth local glDepthTest = gl.DepthTest local glBeginEnd = gl.BeginEnd local GL_LINE_STRIP = GL.LINE_STRIP local GaiaTeamID = Spring.GetGaiaTeamID() ----------------------------------------------------------------- -- end function locals ------------------------------------------ ----------------------------------------------------------------- sameSelectKey = Spring.GetKeyCode(sameSelectKey) idleSelectKey = Spring.GetKeyCode(idleSelectKey) local minimapOnLeft = (Spring.GetMiniMapDualScreen() == "left") local combatFilter, builderFilter, buildingFilter, mobileFilter local referenceCoords local referenceScreenCoords local referenceSelection local referenceSelectionTypes local lastSelection local minimapRect local lastCoords local lastMeta local filtered local myPlayerID local function sort(v1, v2) if v1 > v2 then return v2, v1 else return v1, v2 end end local mapWidth, mapHeight = Game.mapSizeX, Game.mapSizeZ local function MinimapToWorldCoords(x, y) px, py, sx, sy = GetMiniMapGeometry() local plx = 0 if (minimapOnLeft) then plx = sx end x = ((x - px + plx) / sx) * mapWidth local z = (1 - ((y - py) / sy)) * mapHeight y = GetGroundHeight(x, z) return x, y, z end local function GetUnitsInMinimapRectangle(x1, y1, x2, y2, team) left, _, top = MinimapToWorldCoords(x1, y1) right, _, bottom = MinimapToWorldCoords(x2, y2) local left, right = sort(left, right) local bottom, top = sort(bottom, top) minimapRect = {left, bottom, right, top} return GetUnitsInRectangle(left, bottom, right, top, team) end local function GetUnitsInScreenRectangle(x1, y1, x2, y2, team) local units if (team) then units = GetTeamUnits(team) else units = GetAllUnits() end local left, right = sort(x1, x2) local bottom, top = sort(y1, y2) local result = {} for i=1, #units do local uid = units[i] x, y, z = GetUnitPosition(uid) x, y = WorldToScreenCoords(x, y, z) if (left <= x and x <= right) and (top >= y and y >= bottom) then result[#result+1] = uid end end return result end function widget:MousePress(x, y, button) if (button == 1) then referenceSelection = GetSelectedUnits() referenceSelectionTypes = {} for i=1, #referenceSelection do udid = GetUnitDefID(referenceSelection[i]) referenceSelectionTypes[udid] = 1 end referenceScreenCoords = {x, y} lastMeta = nil lastSelection = nil filtered = false if (IsAboveMiniMap(x, y)) then referenceCoords = {0, 0, 0} lastCoords = {0, 0, 0} else local _, c = TraceScreenRay(x, y, true, false, true) referenceCoords = c lastCoords = c end end end function widget:TextCommand(command) if (string.find(command, "selectionmode") == 1 and string.len(command) == 13) then selectBuildingsWithMobile = not selectBuildingsWithMobile if selectBuildingsWithMobile then Spring.Echo("SmartSelect: Selects whatever comes under selection rectangle.") else Spring.Echo("SmartSelect: Ignores buildings if it can select mobile units.") end end if (string.find(command, "selectionnanos") == 1 and string.len(command) == 14) then includeNanosAsMobile = not includeNanosAsMobile init() if includeNanosAsMobile then Spring.Echo("SmartSelect: Treats nanos like mobile units and wont exclude them") else Spring.Echo("SmartSelect: Stops treating nanos as if they are mobile units") end end end function widget:GetConfigData(data) savedTable = {} savedTable.selectBuildingsWithMobile = selectBuildingsWithMobile savedTable.includeNanosAsMobile = includeNanosAsMobile return savedTable end function widget:SetConfigData(data) if data.selectBuildingsWithMobile ~= nil then selectBuildingsWithMobile = data.selectBuildingsWithMobile end if data.includeNanosAsMobile ~= nil then includeNanosAsMobile = data.includeNanosAsMobile end end function widget:Update() --[[ local newUpdate = GetTimer() if (DiffTimers(newUpdate, lastUpdate) < 0.1) then return end lastUpdate = newUpdate --]] if (referenceCoords ~= nil and GetActiveCommand() == 0) then x, y, pressed = GetMouseState() local px, py, sx, sy = GetMiniMapGeometry() if (pressed) and (referenceSelection ~= nil) then local alt, ctrl, meta, shift = GetModKeyState() if (#referenceSelection == 0) then -- no point in inverting an empty selection ctrl = false end local sameSelect = GetKeyState(sameSelectKey) local idleSelect = GetKeyState(idleSelectKey) local sameLast = (referenceScreenCoords ~= nil) and (x == referenceScreenCoords[1] and y == referenceScreenCoords[2]) if (sameLast and lastCoords == referenceCoords) then return end if sameLast and (lastMeta ~= nil) and (alt == lastMeta[1] and ctrl == lastMeta[2] and meta == lastMeta[3] and shift == lastMeta[4]) then return end lastCoords = {x, y} lastMeta = {alt, ctrl, meta, shift} local mouseSelection, originalMouseSelection local r = referenceScreenCoords local playing = GetPlayerInfo(myPlayerID).spectating == false local team = (playing and GetMyTeamID()) if (r ~= nil and IsAboveMiniMap(r[1], r[2])) then local mx, my = max(px, min(px+sx, x)), max(py, min(py+sy, y)) mouseSelection = GetUnitsInMinimapRectangle(r[1], r[2], x, y, nil) else local d = referenceCoords local x1, y1 = WorldToScreenCoords(d[1], d[2], d[3]) mouseSelection = GetUnitsInScreenRectangle(x, y, x1, y1, nil) end originalMouseSelection = mouseSelection -- filter gaia units local filteredselection = {} for i=1, #mouseSelection do if GetUnitTeam(mouseSelection[i]) ~= GaiaTeamID then table.insert(filteredselection, mouseSelection[i]) end end mouseSelection = filteredselection filteredselection = nil local newSelection = {} local uid, udid, udef, tmp if (idleSelect) then tmp = {} for i=1, #mouseSelection do uid = mouseSelection[i] udid = GetUnitDefID(uid) if (mobileFilter[udid] or builderFilter[udid]) and (#GetUnitCommands(uid, 1) == 0) then tmp[#tmp+1] = uid end end mouseSelection = tmp end if (sameSelect) and (#referenceSelection > 0) then -- only select new units identical to those already selected tmp = {} for i=1, #mouseSelection do uid = mouseSelection[i] udid = GetUnitDefID(uid) if (referenceSelectionTypes[udid] ~= nil) then tmp[#tmp+1] = uid end end mouseSelection = tmp end if (alt) then -- only select mobile combat units if (ctrl == false) then tmp = {} for i=1, #referenceSelection do uid = referenceSelection[i] udid = GetUnitDefID(uid) if (combatFilter[udid]) then -- is a combat unit tmp[#tmp+1] = uid end end newSelection = tmp end tmp = {} for i=1, #mouseSelection do uid = mouseSelection[i] udid = GetUnitDefID(uid) if (combatFilter[udid]) then -- is a combat unit tmp[#tmp+1] = uid end end mouseSelection = tmp elseif (selectBuildingsWithMobile == false) and (shift == false) and (ctrl == false) then -- only select mobile units, not buildings local mobiles = false for i=1, #mouseSelection do uid = mouseSelection[i] udid = GetUnitDefID(uid) if (mobileFilter[udid]) then mobiles = true break end end if (mobiles) then tmp = {} for i=1, #mouseSelection do uid = mouseSelection[i] udid = GetUnitDefID(uid) if (buildingFilter[udid] == false) then tmp[#tmp+1] = uid end end mouseSelection = tmp end end if (#newSelection < 1) then newSelection = referenceSelection end if (ctrl) then -- deselect units inside the selection rectangle, if we already had units selected local negative = {} for i=1, #mouseSelection do uid = mouseSelection[i] negative[uid] = 1 end tmp = {} for i=1, #newSelection do uid = newSelection[i] if (negative[uid] == nil) then tmp[#tmp+1] = uid end end newSelection = tmp SelectUnitArray(newSelection) elseif (shift) then -- append units inside selection rectangle to current selection SelectUnitArray(newSelection) SelectUnitArray(mouseSelection, true) elseif (#mouseSelection > 0) then -- select units inside selection rectangle SelectUnitArray(mouseSelection) elseif (#originalMouseSelection > 0) and (#mouseSelection == 0) then SelectUnitArray({}) else -- keep current selection while dragging until more things are selected SelectUnitArray(referenceSelection) lastSelection = nil return end lastSelection = GetSelectedUnits() elseif (lastSelection ~= nil) then SelectUnitArray(lastSelection) lastSelection = nil referenceSelection = nil referenceSelectionTypes = nil referenceCoords = nil minimapRect = nil else referenceSelection = nil referenceSelectionTypes = nil referenceCoords = nil minimapRect = nil end end end function init() myPlayerID = GetMyPlayerID() combatFilter = {} builderFilter = {} buildingFilter = {} mobileFilter = {} for udid, udef in pairs(UnitDefs) do local mobile = (udef.canMove and udef.speed > 0.000001) or (includeNanosAsMobile and (UnitDefs[udid].name == "armnanotc" or UnitDefs[udid].name == "cornanotc" or UnitDefs[udid].name == "armnanotcplat" or UnitDefs[udid].name == "cornanotcplat")) local builder = (udef.canReclaim and udef.reclaimSpeed > 0) or --(udef.builder and udef.buildSpeed > 0) or -- udef.builder = deprecated it seems (udef.canResurrect and udef.resurrectSpeed > 0) or (udef.canRepair and udef.repairSpeed > 0) local building = (mobile == false) local combat = (builder == false) and (mobile == true) and (#udef.weapons > 0) combatFilter[udid] = combat builderFilter[udid] = builder buildingFilter[udid] = building mobileFilter[udid] = mobile end end function widget:Shutdown() WG['smartselect'] = nil end function widget:Initialize() WG['smartselect'] = {} WG['smartselect'].getIncludeBuildings = function() return selectBuildingsWithMobile end WG['smartselect'].setIncludeBuildings = function(value) selectBuildingsWithMobile = value end init() end local function DrawRectangle(r) local x1, y1, x2, y2 = r[1], r[2], r[3], r[4] glVertex(r[1], 0, r[2]) glVertex(r[1], 0, r[4]) glVertex(r[3], 0, r[4]) glVertex(r[3], 0, r[2]) glVertex(r[1], 0, r[2]) end function widget:DrawWorld() if (minimapRect ~= nil) then glColor(1, 1, 1, 1) glLineWidth(1.0) glDepthTest(false) glBeginEnd(GL_LINE_STRIP, DrawRectangle, minimapRect) end end
bot_token = "283727744:AAF4hVqCVi-c1xz6BEBcthLvhcaiZsiy_2E " send_api = "https://api.telegram.org/bot"..bot_token bot_version = "6.0" sudo_name = "Mbdev" sudo_id = 127882811 admingp = -127882811 sudo_num = "989351372038" sudo_user = "shayan_soft" sudo_ch = "UmbrellaTeam"
-- Hopefully in a future update the entire spawn menu will be moved to Lua -- For now, in your gamemode, you could use the spawn menu keys to do something else --[[--------------------------------------------------------- If false is returned then the spawn menu is never created. This saves load times if your mod doesn't actually use the spawn menu for any reason. -----------------------------------------------------------]] function GM:SpawnMenuEnabled() return false end --[[--------------------------------------------------------- Called when spawnmenu is trying to be opened. Return false to dissallow it. -----------------------------------------------------------]] function GM:SpawnMenuOpen() return true end --[[--------------------------------------------------------- Called when context menu is trying to be opened. Return false to dissallow it. -----------------------------------------------------------]] function GM:ContextMenuOpen() return false end --[[--------------------------------------------------------- Called to populate the Scripted Tool menu. Overridden by the sandbox gamemode. -----------------------------------------------------------]] function GM:PopulateSTOOLMenu() end --[[--------------------------------------------------------- Called right before the Lua Loaded tool menus are reloaded -----------------------------------------------------------]] function GM:PreReloadToolsMenu() end --[[--------------------------------------------------------- Called right after the Lua Loaded tool menus are reloaded This is a good place to set up any ControlPanels -----------------------------------------------------------]] function GM:PostReloadToolsMenu() end --[[--------------------------------------------------------- Guess what this does. See the bottom of stool.lua -----------------------------------------------------------]] function GM:PopulateToolMenu() end --[[--------------------------------------------------------- +menu binds -----------------------------------------------------------]] concommand.Add( "+menu", function() hook.Call( "OnSpawnMenuOpen", GAMEMODE ) end, nil, "Opens the spawnmenu", { FCVAR_DONTRECORD } ) concommand.Add( "-menu", function() if ( input.IsKeyTrapping() ) then return end hook.Call( "OnSpawnMenuClose", GAMEMODE ) end, nil, "Closes the spawnmenu", { FCVAR_DONTRECORD } ) --[[--------------------------------------------------------- +menu_context binds -----------------------------------------------------------]] concommand.Add( "+menu_context", function() hook.Call( "OnContextMenuOpen", GAMEMODE ) end, nil, "Opens the context menu", { FCVAR_DONTRECORD } ) concommand.Add( "-menu_context", function() if ( input.IsKeyTrapping() ) then return end hook.Call( "OnContextMenuClose", GAMEMODE ) end, nil, "Closes the context menu", { FCVAR_DONTRECORD } )
#!/usr/local/bin/lua -i function arrayPrinter(array) for _,v in ipairs(array) do print(v) end end function test() arrayPrinter({1,2,3,4,5}) end
-- threescale_utils.lua local M = {} -- public interface -- private -- Logging Helpers function M.show_table(t, ...) local indent = 0 --arg[1] or 0 local indentStr="" for i = 1,indent do indentStr=indentStr.." " end for k,v in pairs(t) do if type(v) == "table" then msg = indentStr .. M.show_table(v or '', indent+1) else msg = indentStr .. k .. " => " .. v end M.log_message(msg) end end function M.log_message(str) ngx.log(0, str) end function M.newline() ngx.log(0," --- ") end function M.log(content) if type(content) == "table" then M.log_message(M.show_table(content)) else M.log_message(content) end M.newline() end -- End Logging Helpers -- Table Helpers function M.keys(t) local n=0 local keyset = {} for k,v in pairs(t) do n=n+1 keyset[n]=k end return keyset end -- End Table Helpers function M.dump(o) if type(o) == 'table' then local s = '{ ' for k,v in pairs(o) do if type(k) ~= 'number' then k = '"'..k..'"' end s = s .. '['..k..'] = ' .. M.dump(v) .. ',' end return s .. '} ' else return tostring(o) end end function M.sha1_digest(s) local str = require "resty.string" return str.to_hex(ngx.sha1_bin(s)) end -- returns true iif all elems of f_req are among actual's keys function M.required_params_present(f_req, actual) local req = {} for k,v in pairs(actual) do req[k] = true end for i,v in ipairs(f_req) do if not req[v] then return false end end return true end function M.connect_redis(red) local ok, err = red:connect("127.0.0.1", 6379) if not ok then ngx.say("failed to connect: ", err) ngx.exit(ngx.HTTP_OK) end return ok, err end -- error and exist function M.error(text) ngx.say(text) ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR) end function M.missing_args(text) ngx.say(text) ngx.exit(ngx.HTTP_OK) end --- -- Builds a query string from a table. -- -- This is the inverse of <code>parse_query</code>. -- @param query A dictionary table where <code>table['name']</code> = -- <code>value</code>. -- @return A query string (like <code>"name=value2&name=value2"</code>). ----------------------------------------------------------------------------- function M.build_query(query) local qstr = "" for i,v in pairs(query) do qstr = qstr .. ngx.escape_uri(i) .. '=' .. ngx.escape_uri(v) .. '&' end return string.sub(qstr, 0, #qstr-1) end --[[ Aux function to split a string ]]-- function string:split(delimiter) local result = { } local from = 1 local delim_from, delim_to = string.find( self, delimiter, from ) if delim_from == nil then return {self} end while delim_from do table.insert( result, string.sub( self, from , delim_from-1 ) ) from = delim_to + 1 delim_from, delim_to = string.find( self, delimiter, from ) end table.insert( result, string.sub( self, from ) ) return result end return M -- -- Example usage: -- local MM = require 'mymodule' -- MM.bar()
local AgentUserData = { time = 0 } local function jump(v1, v2, height, t) local out = {} out.x = v1.x + t * (v2.x - v1.x) out.y = v1.y + t * (v2.y - v1.y) out.z = v1.z + t * (v2.z - v1.z) out.y = out.y + height * math.sin(math.pi * t) return out end local actionManager = cc.Director:getInstance():getActionManager() ---------------------------------------- ----NavMeshBaseTestDemo ---------------------------------------- local NavMeshBaseTestDemo = class("NavMeshBaseTestDemo", function () -- body local scene = cc.Scene:createWithPhysics() return scene end) function NavMeshBaseTestDemo:ctor() TestCastScene.initWithLayer(self) TestCastScene.titleLabel:setString(self:title()) TestCastScene.subtitleLabel:setString(self:subtitle()) self:init() local function onNodeEvent(event) if "enter" == event then self:onEnter() elseif "exit" == event then self:onExit() end end self:registerScriptHandler(onNodeEvent) end function NavMeshBaseTestDemo:title() return "Physics3D Test" end function NavMeshBaseTestDemo:subtitle() return "" end function NavMeshBaseTestDemo:init() self._angle = 0.0 self._agents = {} local size = cc.Director:getInstance():getWinSize() self._camera = cc.Camera:createPerspective(30.0, size.width / size.height, 1.0, 1000.0) self._camera:setPosition3D(cc.vec3(0.0, 50.0, 100.0)) self._camera:lookAt(cc.vec3(0.0, 0.0, 0.0), cc.vec3(0.0, 1.0, 0.0)) self._camera:setCameraFlag(cc.CameraFlag.USER1) self:addChild(self._camera) self:registerTouchEvent() self:initScene() self:scheduleUpdateWithPriorityLua(function(dt) if #self._agents == 0 then return end if not self._resumeFlag and nil ~= self._agentNode then self._resumeFlag = true actionManager:resumeTarget(self._agentNode) end local currentVelocity = nil local speed = 0 for i = 1, #self._agents do currentVelocity = self._agents[i][1]:getCurrentVelocity() speed = math.sqrt(currentVelocity.x * currentVelocity.x + currentVelocity.y * currentVelocity.y + currentVelocity.z * currentVelocity.z) * 0.2 if speed < 0 then speed = 0.0 end self._agents[i][2]:setSpeed(speed) end end, 0) self:extend() end function NavMeshBaseTestDemo:onEnter() local hitResult = {} local ret = false local physicsWorld = self:getPhysics3DWorld() ret, hitResult = physicsWorld:rayCast(cc.vec3(0.0, 50.0, 0.0), cc.vec3(0.0, -50.0, 0.0), hitResult) self:createAgent(hitResult.hitPosition) end function NavMeshBaseTestDemo:onExit() self:unscheduleUpdate() end function NavMeshBaseTestDemo:registerTouchEvent() end function NavMeshBaseTestDemo:extend() end function NavMeshBaseTestDemo:initScene() self:getPhysics3DWorld():setDebugDrawEnable(false) local trianglesList = cc.Bundle3D:getTrianglesList("NavMesh/scene.obj") local rbDes = {} rbDes.mass = 0.0 rbDes.shape = cc.Physics3DShape:createMesh(trianglesList, math.floor(#trianglesList / 3)) local rigidBody = cc.Physics3DRigidBody:create(rbDes) local component = cc.Physics3DComponent:create(rigidBody) local sprite = cc.Sprite3D:create("NavMesh/scene.obj") sprite:addComponent(component) sprite:setCameraMask(cc.CameraFlag.USER1) self:addChild(sprite) self:setPhysics3DDebugCamera(self._camera) local navMesh = cc.NavMesh:create("NavMesh/all_tiles_tilecache.bin", "NavMesh/geomset.txt") navMesh:setDebugDrawEnable(true) self:setNavMesh(navMesh) self:setNavMeshDebugCamera(self._camera) local ambientLight = cc.AmbientLight:create(cc.c3b(64, 64, 64)) ambientLight:setCameraMask(cc.CameraFlag.USER1) self:addChild(ambientLight) local dirLight = cc.DirectionLight:create(cc.vec3(1.2, -1.1, 0.5), cc.c3b(255, 255, 255)) dirLight:setCameraMask(cc.CameraFlag.USER1) self:addChild(dirLight) end function NavMeshBaseTestDemo:createAgent(pos) local filePath = "Sprite3DTest/girl.c3b" local navMeshAgentParam = {} navMeshAgentParam.radius = 2.0 navMeshAgentParam.height = 8.0 navMeshAgentParam.maxSpeed = 8.0 local agent = cc.NavMeshAgent:create(navMeshAgentParam) local agentNode = cc.Sprite3D:create(filePath) agent:setOrientationRefAxes(cc.vec3(-1.0, 0.0, 1.0)) agent.userdata = 0.0 agentNode:setScale(0.05) agentNode:addComponent(agent) local node = cc.Node:create() node:addChild(agentNode) node:setPosition3D(pos) node:setCameraMask(cc.CameraFlag.USER1) self:addChild(node) local animation = cc.Animation3D:create(filePath) local animate = cc.Animate3D:create(animation) if nil ~= animate then agentNode:runAction(cc.RepeatForever:create(animate)) animate:setSpeed(0.0) end self._agents[#self._agents + 1] = {agent, animate} end function NavMeshBaseTestDemo:createObstacle(pos) local obstacle = cc.NavMeshObstacle:create(2.0, 8.0) local obstacleNode = cc.Sprite3D:create("Sprite3DTest/cylinder.c3b") obstacleNode:setPosition3D(cc.vec3(pos.x, pos.y -0.5, pos.z)) obstacleNode:setRotation3D(cc.vec3(-90.0, 0.0, 0.0)) obstacleNode:setScale(0.3) obstacleNode:addComponent(obstacle) obstacleNode:setCameraMask(cc.CameraFlag.USER1) self:addChild(obstacleNode) end function NavMeshBaseTestDemo:moveAgents(des) if #self._agents == 0 then return end local agent = nil for i = 1, #self._agents do self._agents[i][1]:move(des, function (agent, totalTimeAfterMove) local data = agent.userdata if agent:isOnOffMeshLink() then agent:setAutoTraverseOffMeshLink(false) agent:setAutoOrientation(false) local linkdata = agent:getCurrentOffMeshLinkData() agent:getOwner():setPosition3D(jump(linkdata.startPosition, linkdata.endPosition, 10.0, data)) local dir = cc.vec3sub(linkdata.endPosition, linkdata.startPosition) dir.y = 0.0 dir = cc.vec3normalize(dir) local axes = cc.vec3(0.0, 0.0, 0.0) local refAxes = cc.vec3(-1.0, 0.0, 1.0) refAxes = cc.vec3normalize(refAxes) axes = vec3_cross(refAxes, dir, axes) local angle = cc.vec3dot(refAxes, dir) local quaternion = cc.quaternion_createFromAxisAngle(axes, math.acos(angle)) agent:getOwner():setRotationQuat(quaternion) agent.userdata = agent.userdata + 0.01 if 1.0 < agent.userdata then agent:completeOffMeshLink() agent:setAutoOrientation(true) agent.userdata = 0.0 end end end) end end ---------------------------------------- ----NavMeshBaseTestDemo ---------------------------------------- local NavMeshBasicTestDemo = class("NavMeshBasicTestDemo", NavMeshBaseTestDemo) function NavMeshBasicTestDemo:title() return "Navigation Mesh Test" end function NavMeshBasicTestDemo:subtitle() return "Basic Test" end function NavMeshBasicTestDemo:registerTouchEvent() local listener = cc.EventListenerTouchAllAtOnce:create() listener:registerScriptHandler(function(touches, event) self._needMoveAgents = true end,cc.Handler.EVENT_TOUCHES_BEGAN) listener:registerScriptHandler(function(touches, event) if #touches > 0 and self._camera ~= nil then local touch = touches[1] local delta = touch:getDelta() self._angle = self._angle - delta.x * math.pi / 180.0 self._camera:setPosition3D(cc.vec3(100.0 * math.sin(self._angle), 50.0, 100.0 * math.cos(self._angle))) self._camera:lookAt(cc.vec3(0.0, 0.0, 0.0), cc.vec3(0.0, 1.0, 0.0)) if (delta.x * delta.x + delta.y * delta.y) > 16 then self._needMoveAgents = false end end end, cc.Handler.EVENT_TOUCHES_MOVED) listener:registerScriptHandler(function(touches, event) if not self._needMoveAgents then return end local physicsWorld = self:getPhysics3DWorld() if #touches > 0 then local touch = touches[1] local location = touch:getLocationInView() local nearP = cc.vec3(location.x, location.y, 0.0) local farP = cc.vec3(location.x, location.y, 1.0) local size = cc.Director:getInstance():getWinSize() nearP = self._camera:unproject(size, nearP, nearP) farP = self._camera:unproject(size, farP, farP) local hitResult = {} local ret = false ret, hitResult = physicsWorld:rayCast(nearP, farP, hitResult) self:moveAgents(hitResult.hitPosition) end end, cc.Handler.EVENT_TOUCHES_ENDED) local eventDispatcher = self:getEventDispatcher() eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self) end function NavMeshBasicTestDemo:extend() local ttfConfig = {} ttfConfig.fontFilePath = "fonts/arial.ttf" ttfConfig.fontSize = 15 local debugLabel = cc.Label:createWithTTF(ttfConfig,"Debug Draw ON") local menuItem = cc.MenuItemLabel:create(debugLabel) menuItem:registerScriptTapHandler(function (tag, sender) local scene = cc.Director:getInstance():getRunningScene() local enabledDebug = not scene:getNavMesh():isDebugDrawEnabled() scene:getNavMesh():setDebugDrawEnable(enabledDebug) if enabledDebug then debugLabel:setString("DebugDraw ON") else debugLabel:setString("DebugDraw OFF") end end) menuItem:setAnchorPoint(cc.p(0.0, 1.0)) menuItem:setPosition(cc.p(VisibleRect:left().x, VisibleRect:top().y - 100)) local menu = cc.Menu:create(menuItem) menu:setPosition(cc.p(0.0, 0.0)) self:addChild(menu) end ---------------------------------------- ----NavMeshAdvanceTestDemo ---------------------------------------- local NavMeshAdvanceTestDemo = class("NavMeshAdvanceTestDemo", NavMeshBaseTestDemo) function NavMeshAdvanceTestDemo:title() return "Navigation Mesh Test" end function NavMeshAdvanceTestDemo:subtitle() return "Advance Test" end function NavMeshAdvanceTestDemo:registerTouchEvent() local listener = cc.EventListenerTouchAllAtOnce:create() listener:registerScriptHandler(function(touches, event) self._needMoveAgents = true end,cc.Handler.EVENT_TOUCHES_BEGAN) listener:registerScriptHandler(function(touches, event) if #touches > 0 and self._camera ~= nil then local touch = touches[1] local delta = touch:getDelta() self._angle = self._angle - delta.x * math.pi / 180.0 self._camera:setPosition3D(cc.vec3(100.0 * math.sin(self._angle), 50.0, 100.0 * math.cos(self._angle))) self._camera:lookAt(cc.vec3(0.0, 0.0, 0.0), cc.vec3(0.0, 1.0, 0.0)) if (delta.x * delta.x + delta.y * delta.y) > 16 then self._needMoveAgents = false end end end, cc.Handler.EVENT_TOUCHES_MOVED) listener:registerScriptHandler(function(touches, event) if not self._needMoveAgents then return end local physicsWorld = self:getPhysics3DWorld() if #touches > 0 then local touch = touches[1] local location = touch:getLocationInView() local nearP = cc.vec3(location.x, location.y, 0.0) local farP = cc.vec3(location.x, location.y, 1.0) local size = cc.Director:getInstance():getWinSize() nearP = self._camera:unproject(size, nearP, nearP) farP = self._camera:unproject(size, farP, farP) local hitResult = {} local ret = false ret, hitResult = physicsWorld:rayCast(nearP, farP, hitResult) self:moveAgents(hitResult.hitPosition) end end, cc.Handler.EVENT_TOUCHES_ENDED) local eventDispatcher = self:getEventDispatcher() eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self) end function NavMeshAdvanceTestDemo:extend() local ttfConfig = {} ttfConfig.fontFilePath = "fonts/arial.ttf" ttfConfig.fontSize = 15 local obstacleLabel = cc.Label:createWithTTF(ttfConfig,"Create Obstacle") local menuItem0 = cc.MenuItemLabel:create(obstacleLabel) menuItem0:registerScriptTapHandler(function (tag, sender) local scene = cc.Director:getInstance():getRunningScene() local x = math.random(-50, 50) local z = math.random(-50.0, 50.0) local hitResult = {} local ret = false ret, hitResult = scene:getPhysics3DWorld():rayCast(cc.vec3(x, 50.0, z), cc.vec3(x, -50.0, z), hitResult) self:createObstacle(hitResult.hitPosition) end) menuItem0:setAnchorPoint(cc.p(0.0, 1.0)) menuItem0:setPosition(cc.p(VisibleRect:left().x, VisibleRect:top().y - 50)) local agentLabel = cc.Label:createWithTTF(ttfConfig,"Create Agent") local menuItem1 = cc.MenuItemLabel:create(agentLabel) menuItem1:registerScriptTapHandler(function (tag, sender) local scene = cc.Director:getInstance():getRunningScene() local x = math.random(-50, 50) local z = math.random(-50.0, 50.0) local hitResult = {} local ret = false ret, hitResult = scene:getPhysics3DWorld():rayCast(cc.vec3(x, 50.0, z), cc.vec3(x, -50.0, z), hitResult) self:createAgent(hitResult.hitPosition) end) menuItem1:setAnchorPoint(cc.p(0.0, 1.0)) menuItem1:setPosition(cc.p(VisibleRect:left().x, VisibleRect:top().y - 100)) local debugLabel = cc.Label:createWithTTF(ttfConfig,"Debug Draw ON") local menuItem2 = cc.MenuItemLabel:create(debugLabel) menuItem2:registerScriptTapHandler(function (tag, sender) local scene = cc.Director:getInstance():getRunningScene() local enabledDebug = not scene:getNavMesh():isDebugDrawEnabled() scene:getNavMesh():setDebugDrawEnable(enabledDebug) if enabledDebug then debugLabel:setString("DebugDraw ON") else debugLabel:setString("DebugDraw OFF") end end) menuItem2:setAnchorPoint(cc.p(0.0, 1.0)) menuItem2:setPosition(cc.p(VisibleRect:left().x, VisibleRect:top().y - 150)) local menu = cc.Menu:create(menuItem0, menuItem1, menuItem2) menu:setPosition(cc.p(0.0, 0.0)) self:addChild(menu) end ---------------------------------------- ----NavMeshTest ---------------------------------------- function NavMeshTest() Helper.usePhysics = true TestCastScene.createFunctionTable = { NavMeshBasicTestDemo.create, NavMeshAdvanceTestDemo.create, } local scene = NavMeshBasicTestDemo.create() scene:addChild(CreateBackMenuItem()) return scene end
ITEM.name = "Duct Tape" ITEM.model = Model("models/props_hla/props/duct_tape.mdl") ITEM.description = "A roll of tape with adhesive glue." ITEM.width = 2 ITEM.height = 1 ITEM.price = 5 ITEM.category = "Crafting" ITEM.rarity = "Rare" ITEM.noBusiness = true ITEM.maxStack = 5; ITEM.defaultStack = 1;
hs.window.animationDuration = 0 hs.hotkey.bind({ "cmd", "alt", "ctrl" }, "Up", function() local window = hs.window.focusedWindow() local screen = window:screen():frame() local frame = hs.geometry.rect(screen.x + 10, screen.y + 10, screen.w - 20, screen.h - 20) window:setFrame(frame) end) hs.hotkey.bind({ "cmd", "alt", "ctrl" }, "Left", function() local window = hs.window.focusedWindow() local screen = window:screen():frame() local frame = hs.geometry.rect(screen.x + 10, screen.y + 10, (screen.w / 2) - 15, screen.h - 20) window:setFrame(frame) end) hs.hotkey.bind({ "cmd", "alt", "ctrl" }, "Right", function() local window = hs.window.focusedWindow() local screen = window:screen():frame() local frame = hs.geometry.rect(screen.w / 2 + 5, screen.y + 10, (screen.w / 2) - 15, screen.h - 20) window:setFrame(frame) end) hs.hotkey.bind({ "cmd", "alt", "ctrl" }, "Down", function() local window = hs.window.focusedWindow() local frame = window:frame() local frame = hs.geometry.rect( frame.x + frame.w * 0.5 - frame.w * 0.8 * 0.5, frame.y + frame.h * 0.5 - frame.h * 0.8 * 0.5, frame.w * 0.8, frame.h * 0.8 ) window:setFrame(frame) end)
-- Plugin manager boilerplate return require('packer').startup(function(use) use 'wbthomason/packer.nvim' -- Prelude, aka dependencies use 'nvim-lua/popup.nvim' use 'nvim-lua/plenary.nvim' -- Theme use 'rhysd/vim-color-spring-night' use 'EdenEast/nightfox.nvim' -- Surround use 'tpope/vim-surround' -- Status line use { 'nvim-lualine/lualine.nvim', requires = {'kyazdani42/nvim-web-devicons', opt = true} } -- Snippets use 'l3mon4d3/luasnip' -- Code completion use { 'hrsh7th/nvim-cmp', requires = { 'neovim/nvim-lspconfig', 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-path', 'hrsh7th/cmp-cmdline' } } -- Telescope (fuzzy finder and more) use 'nvim-telescope/telescope.nvim' -- Harpoon, advanced buffer navigation use 'theprimeagen/harpoon' -- Enhance lsp, since prettier & eslint don't play nice by default use 'jose-elias-alvarez/null-ls.nvim' -- Git integration use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } } -- Terminal icons use { '~/projects/nvim-nonicons', requires = {'kyazdani42/nvim-web-devicons'}, } -- Pretty lsp completion use 'onsails/lspkind-nvim' -- Better syntax highlighting use 'sheerun/vim-polyglot' end)
return { talon_paladium = { acceleration = 0.015, airsightdistance = 1000, activatewhenbuilt = true, brakerate = 0.015, buildangle = 16384, buildcostenergy = 3380221, buildcostmetal = 170923, buildpic = "talon_paladium.dds", buildtime = 2100000, canattack = true, canguard = true, canmove = true, canpatrol = true, canstop = 1, category = "ALL HUGE MOBILE SURFACE UNDERWATER", collisionvolumeoffsets = "0 -32 0", collisionvolumescales = "130 160 470", collisionvolumetype = "Ell", corpse = "dead", defaultmissiontype = "Standby", description = "Flagship", energystorage = 1500, explodeas = "EXO_BLAST", firestandorders = 1, floater = true, footprintx = 12, footprintz = 12, icontype = "sea", idleautoheal = 5, idletime = 1800, immunetoparalyzer = 1, losemitheight = 84, maneuverleashlength = 640, mass = 170923, maxdamage = 352100, maxvelocity = 1.25, minwaterdepth = 32, mobilestandorders = 1, movementclass = "HDBOAT12", name = "Paladium", noautofire = false, objectname = "talon_paladium", radardistance = 2500, radaremitheight = 126, selfdestructas = "MKL_BLAST", selfdestructcountdown = 10, sightdistance = 1500, sonardistance = 850, standingfireorder = 2, standingmoveorder = 1, steeringmode = 1, turninplaceanglelimit = 120, turninplacespeedlimit = 1.0, turnrate = 75, unitname = "talon_paladium", waterline = 6, customparams = { buildpic = "talon_paladium.dds", faction = "TALON", }, featuredefs = { dead = { blocking = false, damage = 35825, description = "Paladium Wreckage", footprintx = 8, footprintz = 8, metal = 33937, object = "talon_paladium_dead", reclaimable = true, customparams = { fromunit = 1, }, }, }, sfxtypes = { explosiongenerators = { --[1] = "custom:MEDIUMFLARE", --[2] = "custom:goliathflare", }, pieceexplosiongenerators = { [1] = "piecetrail0", [2] = "piecetrail1", [3] = "piecetrail2", [4] = "piecetrail3", [5] = "piecetrail4", [6] = "piecetrail6", }, }, sounds = { canceldestruct = "cancel2", underattack = "warning1", cant = { [1] = "cantdo4", }, count = { [1] = "count6", [2] = "count5", [3] = "count4", [4] = "count3", [5] = "count2", [6] = "count1", }, ok = { [1] = "sharmmov", }, select = { [1] = "sharmsel", }, }, weapondefs = { rapid_cannon_talon = { accuracy = 375, areaofeffect = 128, avoidfeature = false, cegtag = "Trail_cannon_med", craterareaofeffect = 192, craterboost = 0, cratermult = 0, energypershot = 450, gravityaffected = "TRUE", name = "Heavy Plasma Cannon", nogap = 1, range = 2550, reloadtime = 0.16, rgbcolor = "0.91 0.71 0", separation = 0.25, size = 2.06, sizedecay = -0.15, soundhitdry = "S_rocket_hit", soundhitwet = "splslrg", soundhitwetvolume = 0.6, soundstart = "tyrnt_fire", stages = 20, tolerance = 750, turret = true, weapontype = "Cannon", weaponvelocity = 760, damage = { commanders = 100, default = 500, subs = 5, }, }, cannon_talon = { accuracy = 375, areaofeffect = 128, avoidfeature = false, cegtag = "Trail_cannon_med", craterareaofeffect = 196, craterboost = 0, cratermult = 0, energypershot = 450, gravityaffected = "TRUE", name = "Heavy Plasma Cannon", nogap = 1, range = 2550, reloadtime = 0.25, rgbcolor = "0.91 0.71 0", separation = 0.25, size = 2.06, sizedecay = -0.15, soundhitdry = "S_rocket_hit", soundhitwet = "splslrg", soundhitwetvolume = 0.6, soundstart = "tyrnt_fire", stages = 20, tolerance = 750, turret = true, weapontype = "Cannon", weaponvelocity = 760, damage = { commanders = 100, default = 500, subs = 5, }, }, adv_torpedo = { areaofeffect = 16, avoidfeature = false, avoidfriendly = false, burnblow = true, collidefriendly = false, craterareaofeffect = 0, craterboost = 0, cratermult = 0, explosiongenerator = "custom:FLASH3", impactonly = 1, impulseboost = 0.123, impulsefactor = 0.123, model = "weapon_advtorpedo", name = "advTorpedo", noselfdamage = true, range = 850, reloadtime = 1.5, soundhitdry = "xplodep1", soundhitwet = "xplodep1", soundstart = "torpedo1", startvelocity = 150, tracks = true, turnrate = 1500, turret = true, waterweapon = true, weaponacceleration = 25, weapontimer = 4, weapontype = "TorpedoLauncher", weaponvelocity = 250, damage = { default = 600, }, }, talon_flak_gun = { accuracy = 1000, areaofeffect = 144, avoidfeature = false, burnblow = true, canattackground = false, cegtag = "talonflak-fx", craterareaofeffect = 288, craterboost = 0, cratermult = 0, edgeeffectiveness = 0.85, explosiongenerator = "custom:FLASH3", gravityaffected = true, impulseboost = 0, impulsefactor = 0, name = "FlakCannon", noselfdamage = true, range = 1000, reloadtime = 0.2, rgbcolor = "1.0 0.5 0.0", size = 5, soundhitdry = "flakhit", soundhitwet = "splslrg", soundhitwetvolume = 0.6, soundstart = "flakfire", turret = true, weapontimer = 1, weapontype = "Cannon", weaponvelocity = 1550, damage = { areoship = 62.5, default = 5, priority_air = 250, unclassed_air = 250, }, }, gatling = { accuracy = 10, areaofeffect = 8, burnblow = false, corethickness = 0.5, craterareaofeffect = 0, craterboost = 0, cratermult = 0, energypershot = 0, explosiongenerator = "custom:armfurie_fire_explosion", impulseboost = 0, impulsefactor = 0, intensity = 1, name = "Gauss Cannon2", range = 1400, reloadtime = 0.15, rgbcolor = "0.15 0.15 1", soundhitdry = "xplomed2", soundhitwet = "sizzle", soundhitwetvolume = 0.5, soundstart = "gatling", soundtrigger = true, texture1 = "beamrifle", texture2 = "NULL", texture3 = "NULL", thickness = 1.5, tolerance = 500, turret = true, weapontimer = 1, weapontype = "LaserCannon", weaponvelocity = 900, damage = { commanders = 150, default = 750, subs = 5, }, }, }, weapons = { [1] = { badtargetcategory = "TINY SMALL LARGE", def = "rapid_cannon_talon", maindir = "0 0 1", maxangledif = 300, onlytargetcategory = "SURFACE", }, [2] = { badtargetcategory = "TINY SMALL LARGE", def = "cannon_talon", maindir = "0 0 1", maxangledif = 270, onlytargetcategory = "SURFACE", }, [3] = { badtargetcategory = "TINY SMALL LARGE", def = "cannon_talon", maindir = "0 0 -1", maxangledif = 270, onlytargetcategory = "SURFACE", }, [4] = { badtargetcategory = "TINY SMALL LARGE", def = "GATLING", maindir = "0 0 -1", maxangledif = 160, onlytargetcategory = "SURFACE", }, [5] = { badtargetcategory = "SURFACE", def = "adv_torpedo", maindir = "-1 0 0", maxangledif = 220, onlytargetcategory = "UNDERWATER", }, [6] = { badtargetcategory = "SURFACE", def = "adv_torpedo", maindir = "-1 0 0", maxangledif = 220, onlytargetcategory = "UNDERWATER", }, [7] = { badtargetcategory = "SURFACE", def = "adv_torpedo", maindir = "1 0 0", maxangledif = 220, onlytargetcategory = "UNDERWATER", }, [8] = { badtargetcategory = "SURFACE", def = "adv_torpedo", maindir = "1 0 0", maxangledif = 220, onlytargetcategory = "UNDERWATER", }, [9] = { badtargetcategory = "SCOUT SUPERSHIP", --Ground AA def = "talon_flak_gun", maindir = "0.8 0 -0.2", maxangledif = 220, onlytargetcategory = "VTOL", }, [10] = { badtargetcategory = "SCOUT SUPERSHIP", --Ground AA def = "talon_flak_gun", maindir = "0.8 0 0.2", maxangledif = 220, onlytargetcategory = "VTOL", }, [11] = { badtargetcategory = "SCOUT SUPERSHIP", --Ground AA def = "talon_flak_gun", maindir = "-0.8 0 -0.2", maxangledif = 220, onlytargetcategory = "VTOL", }, [12] = { badtargetcategory = "SCOUT SUPERSHIP", --Ground AA def = "talon_flak_gun", maindir = "-0.8 0 0.2", maxangledif = 220, onlytargetcategory = "VTOL", }, }, }, }
WireToolSetup.setCategory( "Physics" ) WireToolSetup.open( "detonator", "Detonator", "gmod_wire_detonator", nil, "Detonators" ) if CLIENT then language.Add( "tool.wire_detonator.name", "Detonator Tool (Wire)" ) language.Add( "tool.wire_detonator.desc", "Spawns a Detonator for use with the wire system." ) TOOL.Information = { { name = "left", text = "Create/Update " .. TOOL.Name } } end WireToolSetup.BaseLang() WireToolSetup.SetupMax( 20 ) if SERVER then ModelPlug_Register("detonator") function TOOL:GetConVars() return self:GetClientNumber( "damage" ) end function TOOL:MakeEnt(ply, model, Ang, trace) local ent = WireToolObj.MakeEnt(self, ply, model, Ang, trace ) ent.target = trace.Entity return ent end end TOOL.ClientConVar = { damage = 1, model = "models/props_combine/breenclock.mdl" } function TOOL.BuildCPanel(panel) WireToolHelpers.MakePresetControl(panel, "wire_detonator") panel:NumSlider("#Damage", "wire_detonator_damage", 1, 200, 0) ModelPlug_AddToCPanel(panel, "detonator", "wire_detonator", true, 1) end
object_tangible_food_foraged_edible_jar_fungus_generic = object_tangible_food_foraged_shared_edible_jar_fungus_generic:new { } ObjectTemplates:addTemplate(object_tangible_food_foraged_edible_jar_fungus_generic, "object/tangible/food/foraged/edible_jar_fungus_generic.iff")
repeat wait() until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Torso") and game.Players.LocalPlayer.Character:findFirstChild("Humanoid") local mouse = game.Players.LocalPlayer:GetMouse() repeat wait() until mouse local plr = game.Players.LocalPlayer local torso = plr.Character.Torso local flying = true local deb = true local ctrl = {f = 0, b = 0, l = 0, r = 0} local lastctrl = {f = 0, b = 0, l = 0, r = 0} local maxspeed = 50 local speed = 0 function Fly() local bg = Instance.new("BodyGyro", torso) bg.P = 9e4 bg.maxTorque = Vector3.new(9e9, 9e9, 9e9) bg.cframe = torso.CFrame local bv = Instance.new("BodyVelocity", torso) bv.velocity = Vector3.new(0,0.1,0) bv.maxForce = Vector3.new(9e9, 9e9, 9e9) repeat wait() plr.Character.Humanoid.PlatformStand = true if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then speed = speed+.5+(speed/maxspeed) if speed > maxspeed then speed = maxspeed end elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then speed = speed-1 if speed < 0 then speed = 0 end end if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then bv.velocity = ((game.Workspace.CurrentCamera.CoordinateFrame.lookVector * (ctrl.f+ctrl.b)) + ((game.Workspace.CurrentCamera.CoordinateFrame * CFrame.new(ctrl.l+ctrl.r,(ctrl.f+ctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CoordinateFrame.p))*speed lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r} elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then bv.velocity = ((game.Workspace.CurrentCamera.CoordinateFrame.lookVector * (lastctrl.f+lastctrl.b)) + ((game.Workspace.CurrentCamera.CoordinateFrame * CFrame.new(lastctrl.l+lastctrl.r,(lastctrl.f+lastctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CoordinateFrame.p))*speed else bv.velocity = Vector3.new(0,0.1,0) end bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0) until not flying ctrl = {f = 0, b = 0, l = 0, r = 0} lastctrl = {f = 0, b = 0, l = 0, r = 0} speed = 0 bg:Destroy() bv:Destroy() plr.Character.Humanoid.PlatformStand = false end mouse.KeyDown:connect(function(key) if key:lower() == "e" then if flying then flying = false else flying = true Fly() end elseif key:lower() == "w" then ctrl.f = 1 elseif key:lower() == "s" then ctrl.b = -1 elseif key:lower() == "a" then ctrl.l = -1 elseif key:lower() == "d" then ctrl.r = 1 end end) mouse.KeyUp:connect(function(key) if key:lower() == "w" then ctrl.f = 0 elseif key:lower() == "s" then ctrl.b = 0 elseif key:lower() == "a" then ctrl.l = 0 elseif key:lower() == "d" then ctrl.r = 0 end end) Fly()
Media = Object:extend() Media:implement(State) function Media:init(name) self:init_state(name) end function Media:on_enter(from) camera.x, camera.y = gw/2, gh/2 self.main = Group() self.effects = Group() self.ui = Group() graphics.set_background_color(fg[0]) end function Media:update(dt) self.main:update(dt*slow_amount) self.effects:update(dt*slow_amount) self.ui:update(dt*slow_amount) end function Media:draw() self.main:draw() self.effects:draw() self.ui:draw() end --[[ build your party: hire heroes, rank them up and defeat endless waves of enemies make synergies: combine heroes of the same class to unlock unique class passives find passive items: further enhance your party with powerful passive items create your build: explore the possibilities and combinations to create your own unique build ]]--
geldispenser = class("geldispenser") function geldispenser:init(x, y, r) --PHYSICS STUFF self.cox = x self.coy = y self.x = x-1 self.y = y-1 self.r = r self.speedy = 0 self.speedx = 0 self.width = 2 self.height = 2 self.static = true self.active = true self.category = 7 self.mask = {true, false, false, false, false, false} self.dir = "down" self.id = 1 self.timer = 0 self.input1state = "off" self.dropping = true --Input list self.r = {unpack(r)} table.remove(self.r, 1) table.remove(self.r, 1) --DIR if #self.r > 0 then self.dir = self.r[1] table.remove(self.r, 1) end --ID if #self.r > 0 then self.id = tonumber(self.r[1]) table.remove(self.r, 1) end --POWER if #self.r > 0 and self.r[1] ~= "link" then if self.r[1] == "true" then self.dropping = false end table.remove(self.r, 1) end self:link() end function geldispenser:link() while #self.r > 3 do for j, w in pairs(outputs) do for i, v in pairs(objects[w]) do if tonumber(self.r[3]) == v.cox and tonumber(self.r[4]) == v.coy then v:addoutput(self, self.r[2]) end end end table.remove(self.r, 1) table.remove(self.r, 1) table.remove(self.r, 1) table.remove(self.r, 1) end end function geldispenser:update(dt) if self.dropping then self.timer = self.timer + dt while self.timer > geldispensespeed do self.timer = self.timer - geldispensespeed if self.dir == "down" then table.insert(objects["gel"], gel:new(self.x+1.5 + (math.random()-0.5)*1, self.y+12/16, self.id)) objects["gel"][#objects["gel"]].speedy = 10 elseif self.dir == "right" then table.insert(objects["gel"], gel:new(self.x+14/16, self.y+1.5 + (math.random()-0.5)*1, self.id)) objects["gel"][#objects["gel"]].speedx = 20 objects["gel"][#objects["gel"]].speedy = -4 elseif self.dir == "left" then table.insert(objects["gel"], gel:new(self.x+30/16, self.y+1.5 + (math.random()-0.5)*1, self.id)) objects["gel"][#objects["gel"]].speedx = -20 objects["gel"][#objects["gel"]].speedy = -4 elseif self.dir == "up" then table.insert(objects["gel"], gel:new(self.x+1.5 + (math.random()-0.5)*1, self.y+12/16, self.id)) objects["gel"][#objects["gel"]].speedy = -30 end end end return false end function geldispenser:draw() if self.dir == "down" then love.graphics.draw(geldispenserimg, math.floor((self.cox-xscroll-1)*16*scale), (self.coy-yscroll-1.5)*16*scale, 0, scale, scale, 0, 0) elseif self.dir == "right" then love.graphics.draw(geldispenserimg, math.floor((self.cox-xscroll-1)*16*scale), (self.coy-yscroll+.5)*16*scale, math.pi*1.5, scale, scale, 0, 0) elseif self.dir == "left" then love.graphics.draw(geldispenserimg, math.floor((self.cox-xscroll+1)*16*scale), (self.coy-yscroll-1.5)*16*scale, math.pi*0.5, scale, scale, 0, 0) elseif self.dir == "up" then love.graphics.draw(geldispenserimg, math.floor((self.cox-xscroll+1)*16*scale), (self.coy-yscroll+.5)*16*scale, math.pi, scale, scale, 0, 0) end end function geldispenser:input(t, input) if input == "power" then if t == "on" and self.input1state == "off" then self.dropping = not self.dropping elseif t == "off" and self.input1state == "on" then self.dropping = not self.dropping elseif t == "toggle" then self.dropping = not self.dropping end self.input1state = t end end
local present, lualine = pcall(require, "lualine") if not present then return end local gps_present, gps = pcall(require, "nvim-gps") local lsp_present, lsp_status = pcall(require, "lsp-status") local lualine_c = {} if lsp_present then lsp_status.config({ indicator_ok = '', status_symbol = '', }) table.insert(lualine_c, { lsp_status.status}) end table.insert(lualine_c, "filename") if gps_present then table.insert(lualine_c, { gps.get_location, condition = gps.is_available, lower = false }) end local function indentation() local indent_style = vim.api.nvim_buf_get_option(0, "expandtab") == true and "Spaces" or "Tabs" local indent_size = vim.api.nvim_buf_get_option(0, "tabstop") return indent_style .. ": " .. indent_size end local lualine_a = { { 'mode', fmt = string.lower } } local lualine_b = { "branch" } lualine.setup({ options = { icons_enabled = true, section_separators = {'', ''}, component_separators = {'', ''}, theme = "base16_256", disabled_filetypes = { "outline" } }, sections = { lualine_a = lualine_a, lualine_b = lualine_b, lualine_c = lualine_c, lualine_x = { indentation, "encoding", "fileformat", "filetype" }, lualine_z = { "location" } } })
local brute = require "brute" local coroutine = require "coroutine" local creds = require "creds" local shortport = require "shortport" local stdnse = require "stdnse" local xmpp = require "xmpp" description = [[ Performs brute force password auditing against XMPP (Jabber) instant messaging servers. ]] --- -- @usage -- nmap -p 5222 --script xmpp-brute <host> -- -- @output -- PORT STATE SERVICE -- 5222/tcp open xmpp-client -- | xmpp-brute: -- | Accounts -- | CampbellJ:arthur321 - Valid credentials -- | CampbellA:joan123 - Valid credentials -- | WalkerA:auggie123 - Valid credentials -- | Statistics -- |_ Performed 6237 guesses in 5 seconds, average tps: 1247 -- -- @args xmpp-brute.auth authentication mechanism to use LOGIN, PLAIN, CRAM-MD5 -- or DIGEST-MD5 -- @args xmpp-brute.servername needed when host name cannot be automatically -- determined (eg. when running against an IP, instead of hostname) -- -- Version 0.1 -- Created 07/21/2011 - v0.1 - created by Patrik Karlsson <patrik@cqure.net> author = "Patrik Karlsson" license = "Same as Nmap--See http://nmap.org/book/man-legal.html" categories = {"brute", "intrusive"} portrule = shortport.port_or_service(5222, {"jabber", "xmpp-client"}) local mech ConnectionPool = {} Driver = { -- Creates a new driver instance -- @param host table as received by the action method -- @param port table as received by the action method -- @param pool an instance of the ConnectionPool new = function(self, host, port, options ) local o = { host = host, port = port, options = options } setmetatable(o, self) self.__index = self return o end, -- Connects to the server (retrieves a connection from the pool) connect = function( self ) self.helper = ConnectionPool[coroutine.running()] if ( not(self.helper) ) then self.helper = xmpp.Helper:new( self.host, self.port, self.options ) local status, err = self.helper:connect() if ( not(status) ) then return false, err end ConnectionPool[coroutine.running()] = self.helper end return true end, -- Attempts to login to the server -- @param username string containing the username -- @param password string containing the password -- @return status true on success, false on failure -- @return brute.Error on failure and brute.Account on success login = function( self, username, password ) local status, err = self.helper:login( username, password, mech ) if ( status ) then self.helper:close() self.helper:connect() return true, brute.Account:new(username, password, creds.State.VALID) end if ( err:match("^ERROR: Failed to .* data$") ) then self.helper:close() self.helper:connect() local err = brute.Error:new( err ) -- This might be temporary, set the retry flag err:setRetry( true ) return false, err end return false, brute.Error:new( "Incorrect password" ) end, -- Disconnects from the server (release the connection object back to -- the pool) disconnect = function( self ) return true end, } action = function(host, port) local options = { servername = stdnse.get_script_args("xmpp-brute.servername") } local helper = xmpp.Helper:new(host, port, options) local status, err = helper:connect() if ( not(status) ) then return "\n ERROR: Failed to connect to XMPP server" end local mechs = helper:getAuthMechs() if ( not(mechs) ) then return "\n ERROR: Failed to retreive authentication mechs from XMPP server" end local mech_prio = stdnse.get_script_args("xmpp-brute.auth") mech_prio = ( mech_prio and { mech_prio } ) or { "PLAIN", "LOGIN", "CRAM-MD5", "DIGEST-MD5"} for _, mp in ipairs(mech_prio) do for m, _ in pairs(mechs) do if ( mp == m ) then mech = m; break end end if ( mech ) then break end end if ( not(mech) ) then return "\n ERROR: Failed to find suitable authentication mechanism" end local engine = brute.Engine:new(Driver, host, port, options) engine.options.script_name = SCRIPT_NAME local result status, result = engine:start() return result end
Player=Object:extend() function Player:new() self.image = love.graphics.newImage("sprites/canon.png") --self.image = love.graphics.newImage("panda.png") self.x = love.graphics.getWidth() / 2 self.y = love.graphics.getHeight() - self.image:getHeight() - 10 self.speed = 500 self.width = self.image:getWidth() self.height = self.image:getHeight() end function Player:update(dt) if love.keyboard.isDown("left") then self.x = self.x - self.speed * dt elseif love.keyboard.isDown("right") then self.x = self.x + self.speed * dt end --check for edge of screen local window_width = love.graphics.getWidth() if self.x < 0 then self.x = 0 elseif self.x + self.width > window_width then self.x = window_width - self.width end end function Player:keyPressed(key) if key == "space" then love.audio.play(player_shoot_snd) table.insert(listOfBullets, Bullet(self.x + (self.width/2) - 5, self.y - self.height)) end end function Player:draw() love.graphics.draw(self.image, self.x, self.y) end
-- Generated by Luapress v3.0 -- pages_dir and posts_dir added local config = { url = '/tests/directories/build', posts_dir = 'post', pages_dir = 'page', archive_title = 'Old Posts' } return config
ITEM.Name = 'SMG' ITEM.Price = 200 ITEM.Model = 'models/weapons/w_smg1.mdl' ITEM.WeaponClass = 'weapon_smg1' ITEM.SingleUse = true function ITEM:OnBuy(ply) if (!ply:HasWeapon(self.WeaponClass)) then ply:Give(self.WeaponClass) else ply:GiveAmmo(180, "SMG1", false) end ply:SelectWeapon(self.WeaponClass) end function ITEM:OnSell(ply) ply:StripWeapon(self.WeaponClass) end
Config = {} Config.Locale = 'en' Config.RequiredCopsRob = 1 Config.RequiredCopsSell = 1 Config.MinJewels = 8 Config.MaxJewels = 20 Config.MaxWindows = 20 Config.SecBetwNextRob = 7200 --2 hour Config.MaxJewelsSell = 35 Config.PriceForOneJewel = 500 Config.EnableMarker = true Config.NeedBag = false Config.Borsoni = {40, 41, 44, 45} Stores = { ["jewelry"] = { position = { ['x'] = -629.99, ['y'] = -236.542, ['z'] = 38.05 }, nameofstore = "jewelry", lastrobbed = 0 } }
--get the addon namespace local addon, ns = ... --get the config values local cfg = ns.cfg local barcfg = cfg.bars.micromenu local NUM_MICRO = 12 if not barcfg.disable then local bar = CreateFrame("Frame","rABS_MicroMenu",UIParent, "SecureHandlerStateTemplate") bar:SetWidth(NUM_MICRO*25.2+20) bar:SetHeight(50) bar:SetPoint(barcfg.pos.a1,barcfg.pos.af,barcfg.pos.a2,barcfg.pos.x,barcfg.pos.y) bar:SetHitRectInsets(-cfg.barinset, -cfg.barinset, -cfg.barinset, -cfg.barinset) if barcfg.testmode then bar:SetBackdrop(cfg.backdrop) bar:SetBackdropColor(1,0.8,1,0.6) end bar:SetScale(barcfg.barscale) cfg.applyDragFunctionality(bar,barcfg.userplaced,barcfg.locked) --mircro menu local MicroButtons = { CharacterMicroButton, SpellbookMicroButton, TalentMicroButton, AchievementMicroButton, QuestLogMicroButton, GuildMicroButton, PVPMicroButton, LFDMicroButton, EJMicroButton, RaidMicroButton, HelpMicroButton, MainMenuMicroButton, } local function movebuttons() for _, f in pairs(MicroButtons) do f:SetParent(bar) end CharacterMicroButton:ClearAllPoints(); CharacterMicroButton:SetPoint("BOTTOMLEFT", 10, 5) end movebuttons() local switcher = -1 local function lighton(alpha) for _, f in pairs(MicroButtons) do f:SetAlpha(alpha) switcher = alpha end end if barcfg.showonmouseover then bar:EnableMouse(true) bar:SetScript("OnEnter", function(self) lighton(1) end) bar:SetScript("OnLeave", function(self) lighton(0) end) for _, f in pairs(MicroButtons) do f:SetAlpha(0) f:HookScript("OnEnter", function(self) lighton(1) end) f:HookScript("OnLeave", function(self) lighton(0) end) end bar:RegisterEvent("PLAYER_ENTERING_WORLD") --fix for the talent button display while micromenu onmouseover local function rABS_TalentButtonAlphaFunc(self,alpha) if switcher ~= alpha then switcher = 0 self:SetAlpha(0) end end hooksecurefunc(TalentMicroButton, "SetAlpha", rABS_TalentButtonAlphaFunc) end bar:SetScript("OnEvent", function(self,event) if event == "PLAYER_TALENT_UPDATE" or event == "ACTIVE_TALENT_GROUP_CHANGED" then if not InCombatLockdown() then movebuttons() end elseif event == "PLAYER_ENTERING_WORLD" then lighton(0) end end) bar:RegisterEvent("PLAYER_TALENT_UPDATE") bar:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED") end
-- This file is under copyright, and is bound to the agreement stated in the EULA. -- Any 3rd party content has been used as either public domain or with permission. -- © Copyright 2014-2018 Aritz Beobide-Cardinal All rights reserved. include('shared.lua') ENT.RenderGroup = RENDERGROUP_OPAQUE ENT.ScreenMsg = {} function ENT:Initialize() self.SScreenScroll = 1 self.SScreenScrollDelay = CurTime() + 0.1 self.ScreenScroll = 1 self.ScreenScrollDelay = CurTime() + 0.1 self.TopScreenText = "**ARCBank**" self.BottomScreenText = ARCBank.Msgs.CardMsgs.NoOwner net.Start( "ARCCHIPMACHINE_STRINGS" ) net.WriteEntity(self) net.SendToServer() self.FromAccount = ARCBank.Msgs.ATMMsgs.PersonalAccount self.ToAccount = ARCBank.Msgs.ATMMsgs.PersonalAccount self.InputNum = 0 self.Reason = ARCBank.Msgs.Items.PinMachine end function ENT:Think() end function ENT:Draw() self:DrawModel() self:DrawShadow( true ) self.DisplayPos = self:GetPos() + ((self:GetAngles():Up() * 1.1) + (self:GetAngles():Forward() * -4.01) + (self:GetAngles():Right()*2.55)) self.displayangle1 = self:GetAngles() self.displayangle1:RotateAroundAxis( self.displayangle1:Up(), 90 ) --self.displayangle1:RotateAroundAxis( self.displayangle1:Forward(), -13 ) if #self.BottomScreenText > 0 then if self.ScreenScrollDelay < CurTime() && utf8.len(self.BottomScreenText) > 11 then self.ScreenScrollDelay = CurTime() + 0.1 self.ScreenScroll = self.ScreenScroll + 1 if (self.ScreenScroll) > utf8.len(self.BottomScreenText) then self.ScreenScroll = -11 end end end if #self.TopScreenText > 0 then if self.SScreenScrollDelay < CurTime() && utf8.len(self.TopScreenText) > 11 then self.SScreenScrollDelay = CurTime() + 0.1 self.SScreenScroll = self.SScreenScroll + 1 if (self.SScreenScroll) > utf8.len(self.TopScreenText) then self.SScreenScroll = -11 end end end cam.Start3D2D(self.DisplayPos, self.displayangle1, 0.055) surface.SetDrawColor( 0, 255, 0, 200 ) surface.DrawRect( 0, 0, 77, 24 ) if utf8.len(self.TopScreenText) > 11 then draw.SimpleText( ARCLib.ScrollChars(self.TopScreenText,self.SScreenScroll,11), "ARCBankATM",0,0, Color(0,0,0,255), TEXT_ALIGN_LEFT , TEXT_ALIGN_TOP ) else draw.SimpleText( self.TopScreenText, "ARCBankATM",0,0, Color(0,0,0,255), TEXT_ALIGN_LEFT , TEXT_ALIGN_TOP ) end if utf8.len(self.BottomScreenText) > 11 then draw.SimpleText( ARCLib.ScrollChars(self.BottomScreenText,self.ScreenScroll,11), "ARCBankATM",0,12, Color(0,0,0,255), TEXT_ALIGN_LEFT , TEXT_ALIGN_TOP ) else draw.SimpleText( self.BottomScreenText, "ARCBankATM",0,12, Color(0,0,0,255), TEXT_ALIGN_LEFT , TEXT_ALIGN_TOP ) end cam.End3D2D() end --lollolol net.Receive( "ARCCHIPMACHINE_STRINGS", function(length) local ent = net.ReadEntity() local topstring = net.ReadString() local bottomstring = net.ReadString() local ply = net.ReadEntity() ent.TopScreenText = topstring ent.BottomScreenText = bottomstring ent.ScreenScroll = 11 ent.SScreenScroll = 11 ent._Owner = ply end) net.Receive( "ARCCHIPMACHINE_MENU_CUSTOMER", function(length) local ent = net.ReadEntity() --DarkRP pocket doesn't save CS values if not IsValid(ent) then return end local accounts = net.ReadTable() local moneh = net.ReadUInt(32) if ent.FromAccount == "" then ent.FromAccount = ARCBank.Msgs.ATMMsgs.PersonalAccount end local DermaPanel = vgui.Create( "DFrame" ) DermaPanel:SetPos( surface.ScreenWidth()/2-130,surface.ScreenHeight()/2-100 ) DermaPanel:SetSize( 260, 104 ) DermaPanel:SetTitle( ARCBank.Msgs.CardMsgs.AccountPay ) DermaPanel:SetVisible( true ) DermaPanel:SetDraggable( true ) DermaPanel:ShowCloseButton( false ) DermaPanel:MakePopup() local NumLabel2 = vgui.Create( "DLabel", DermaPanel ) NumLabel2:SetPos( 10, 26 ) NumLabel2:SetText( string.Replace( string.Replace( ARCBank.Settings["money_format"], "$", ARCBank.Settings.money_symbol ) , "0", string.Comma(moneh)) ) NumLabel2:SizeToContents() local AccountSelect = vgui.Create( "DComboBox", DermaPanel ) AccountSelect:SetPos( 10,44 ) AccountSelect:SetSize( 240, 20 ) function AccountSelect:OnSelect(index,value,data) ent:EmitSound("buttons/button18.wav",75,255) ent.FromAccount = value end--$é AccountSelect:SetText(ent.FromAccount or ARCBank.Msgs.ATMMsgs.PersonalAccount) AccountSelect:AddChoice(ARCBank.Msgs.ATMMsgs.PersonalAccount) for i=1,#accounts do AccountSelect:AddChoice(accounts[i]) end local OkButton = vgui.Create( "DButton", DermaPanel ) OkButton:SetText( ARCBank.Msgs.ATMMsgs.OK ) OkButton:SetPos( 10, 74 ) OkButton:SetSize( 115, 20 ) OkButton.DoClick = function() ent:EmitSound("buttons/button18.wav",75,255) DermaPanel:Remove() if ent.FromAccount == ARCBank.Msgs.ATMMsgs.PersonalAccount then ent.FromAccount = "" end net.Start( "ARCCHIPMACHINE_MENU_CUSTOMER" ) net.WriteEntity(ent) net.WriteString(ent.FromAccount) net.SendToServer() end local CancelButton = vgui.Create( "DButton", DermaPanel ) CancelButton:SetText( ARCBank.Msgs.ATMMsgs.Cancel ) CancelButton:SetPos( 135, 74 ) CancelButton:SetSize( 115, 20 ) CancelButton.DoClick = function() DermaPanel:Remove() end end) net.Receive( "ARCCHIPMACHINE_MENU_OWNER", function(length) local ent = net.ReadEntity() if not IsValid(ent) then return end --DarkRP pocket doesn't save CS values local accounts = net.ReadTable() if ent.ToAccount == "" then ent.ToAccount = ARCBank.Msgs.ATMMsgs.PersonalAccount end local DermaPanel = vgui.Create( "DFrame" ) DermaPanel:SetPos( surface.ScreenWidth()/2-130,surface.ScreenHeight()/2-120 ) DermaPanel:SetSize( 260, 240 ) DermaPanel:SetTitle( ARCBank.Msgs.Items.PinMachine ) DermaPanel:SetVisible( true ) DermaPanel:SetDraggable( true ) DermaPanel:ShowCloseButton( false ) DermaPanel:MakePopup() local NumLabel1 = vgui.Create( "DLabel", DermaPanel ) NumLabel1:SetPos( 10, 25 ) NumLabel1:SetText( ARCBank.Msgs.CardMsgs.Charge ) NumLabel1:SizeToContents() local EnterNum = vgui.Create( "DNumberWang", DermaPanel ) EnterNum:SetPos( 76, 40 ) EnterNum:SetSize( 175, 20 ) EnterNum:SetMinMax( 0 , 2147483647) EnterNum:SetDecimals(0) EnterNum.OnValueChanged = function( pan, val ) ent.InputNum = val end EnterNum:SetValue( ent.InputNum ) local ErrorLabel = vgui.Create( "DLabel", DermaPanel ) ErrorLabel:SetPos( 76, 64 ) ErrorLabel:SetText( "" ) ErrorLabel:SetSize( 175, 50 ) ErrorLabel:SetWrap(true) local button = {} for i=1,12 do button[i] = vgui.Create( "DButton", DermaPanel ) if i == 10 then button[i]:SetText( "<--" ) button[i].DoClick = function() ent:EmitSound("buttons/button18.wav",75,255) ent.InputNum = math.floor(ent.InputNum/10) EnterNum:SetValue( ent.InputNum ) end elseif i == 11 then button[i]:SetText( "0" ) button[i].DoClick = function() ent:EmitSound("buttons/button18.wav",75,255) if (ent.InputNum*10) >= 2^31 then ErrorLabel:SetText( string.Replace( ARCBank.Msgs.ATMMsgs.NumberTooHigh, "%NUM%", string.Comma(2^31-1)) ) return end ent.InputNum = (ent.InputNum*10) EnterNum:SetValue( ent.InputNum ) end elseif i== 12 then button[i]:SetText( "X" ) button[i].DoClick = function() ent:EmitSound("buttons/button18.wav",75,255) ent.InputNum = 0 EnterNum:SetValue( ent.InputNum ) end else button[i]:SetText( tostring(i) ) button[i].DoClick = function() ent:EmitSound("buttons/button18.wav",75,255) if ((ent.InputNum*10) + i) >= 2^31 then ErrorLabel:SetText( string.Replace( ARCBank.Msgs.ATMMsgs.NumberTooHigh, "%NUM%", string.Comma(2^31-1)) ) return end ent.InputNum = (ent.InputNum*10) + i EnterNum:SetValue( ent.InputNum ) end end button[i]:SetSize( 20, 20 ) button[i]:SetPos( 10+(20*((i-1)%3)), 40+(20*math.floor((i-1)/3)) ) end local NumLabel2 = vgui.Create( "DLabel", DermaPanel ) NumLabel2:SetPos( 10, 122 ) NumLabel2:SetText( ARCBank.Msgs.CardMsgs.Account ) NumLabel2:SizeToContents() local AccountSelect = vgui.Create( "DComboBox", DermaPanel ) AccountSelect:SetPos( 10,140 ) AccountSelect:SetSize( 240, 20 ) function AccountSelect:OnSelect(index,value,data) ent:EmitSound("buttons/button18.wav",75,255) ent.ToAccount = value end AccountSelect:SetText(ent.ToAccount or ARCBank.Msgs.ATMMsgs.PersonalAccount) AccountSelect:AddChoice(ARCBank.Msgs.ATMMsgs.PersonalAccount) for i=1,#accounts do AccountSelect:AddChoice(accounts[i]) end local NumLabel3 = vgui.Create( "DLabel", DermaPanel ) NumLabel3:SetPos( 10, 162 ) NumLabel3:SetText( ARCBank.Msgs.CardMsgs.Label ) NumLabel3:SizeToContents() local ReasonSelect = vgui.Create( "DTextEntry", DermaPanel ) ReasonSelect:SetPos( 10,180 ) ReasonSelect:SetTall( 20 ) ReasonSelect:SetWide( 240 ) ReasonSelect:SetEnterAllowed( true ) ReasonSelect:SetValue(ent.Reason) local OkButton = vgui.Create( "DButton", DermaPanel ) OkButton:SetText( ARCBank.Msgs.ATMMsgs.OK ) OkButton:SetPos( 10, 210 ) OkButton:SetSize( 115, 20 ) OkButton.DoClick = function() ent:EmitSound("buttons/button18.wav",75,255) DermaPanel:Remove() if ent.ToAccount == ARCBank.Msgs.ATMMsgs.PersonalAccount then ent.ToAccount = "" end net.Start( "ARCCHIPMACHINE_MENU_OWNER" ) net.WriteEntity(ent) net.WriteString(ent.ToAccount) net.WriteUInt(ent.InputNum,32) net.WriteString(ent.Reason) net.SendToServer() end local CancelButton = vgui.Create( "DButton", DermaPanel ) CancelButton:SetText( ARCBank.Msgs.ATMMsgs.Cancel ) CancelButton:SetPos( 135, 210 ) CancelButton:SetSize( 115, 20 ) CancelButton.DoClick = function() DermaPanel:Remove() end end)
--[[ This file is part of ClearTables @author Paul Norman <penorman@mac.com> @copyright 2015-2016 Paul Norman, MIT license ]]-- require ("common") print("common.lua tests") print("TESTING: oneway") assert(oneway(nil) == nil, "test failed: oneway(nil) == nil") assert(oneway('-1') == 'reverse', "test failed: oneway('-1') == 'reverse'") assert(oneway('no') == 'false', "test failed: oneway('no') == 'false'") assert(oneway('false') == 'false', "test failed: oneway('false') == 'false'") assert(oneway('yes') == 'true', "test failed: oneway('yes') == 'true'") assert(oneway('foo') == 'true', "test failed: oneway('foo') == 'true'") print("TESTING: layer") assert(layer(nil) == "0", "test failed: nil") assert(layer("0") == "0", "test failed: 0") assert(layer("-1") == "-1", "test failed: -1") assert(layer("1") == "1", "test failed: 1") assert(layer("1.5") == "0", "test failed: 1.5") assert(layer("foo") == "0", "test failed: text") assert(layer("f1") == "0", "test failed: char num") assert(layer("1f") == "0", "test failed: num char") print("TESTING: access") assert(access(nil) == nil, "test failed: nil") assert(access("foo") == nil, "test failed: unknown") assert(access("yes") == "yes", "test failed: yes") assert(access("private") == "no", "test failed: private") assert(access("no") == "no", "test failed: no") assert(access("permissive") == "yes", "test failed: permissive") assert(access("delivery") == "partial", "test failed: delivery") assert(access("designated") == "yes", "test failed: designated") assert(access("destination") == "partial", "test failed: destination") assert(access("customers") == "partial", "test failed: customers") print("TESTING: height") assert(height(nil) == nil, "test failed: nil") assert(height("foo") == nil, "test failed: unknown") assert(height("5") == "5", "test failed: 1 digit") assert(height("56") == "56", "test failed: multi-digit") assert(height("5.6") == "5.6", "test failed: decimal") assert(height("5e6") == nil, "test failed: number with text") assert(height("10000000000") == nil, "test failed: overflow") print("TESTING: names") assert(names(nil) == nil, "test failed: nil") assert(names({}) == nil, "test failed: empty") assert(names({foo="bar"}) == nil, "test failed: non-names") assert(names({["name:foo"]="bar"}) == '"foo"=>"bar"', "test failed: one lang") local name1 = names({["name:aa"]="foo", ["name:zz"]="bar"}) assert(name1 == '"aa"=>"foo","zz"=>"bar"' or name1 == '"zz"=>"bar","aa"=>"foo"', "test failed: two langs") -- Language filtering assert(names({["name:foo:baz"]="bar"}) == nil, "test failed: one filtered lang with :") assert(names({["name:foo1"]="bar"}) == nil, "test failed: one filtered lang with number") assert(names({["name:prefix"]="bar"}) == nil, "test failed: one filtered lang with prefix") assert(names({["name:genitive"]="bar"}) == nil, "test failed: one filtered lang with genitive") assert(names({["name:etymology"]="bar"}) == nil, "test failed: one filtered lang with etymology") assert(names({["name:botanical"]="bar"}) == nil, "test failed: one filtered lang with botanical") assert(names({["name:left"]="bar"}) == nil, "test failed: one filtered lang with left") assert(names({["name:right"]="bar"}) == nil, "test failed: one filtered lang with right") assert(names({["name:foo"]="bar", ["name:foo1"]="baz"}) == '"foo"=>"bar"', "test failed: one filtered lang with non-filtered")
minetest.register_globalstep(function(dtime) minetest.set_timeofday(0.5) end)
local mtstates = require("mtstates") local s1 = mtstates.newstate("return function() return 3 end") local id = s1:id() local s2 = mtstates.state(id) local s3 = mtstates.state(id) assert(s1:isowner() == true) assert(s2:isowner() == false) assert(s3:isowner() == false) s2 = nil collectgarbage() assert(s3:call() == 3) assert(mtstates.state(id):id() == id) s1 = nil collectgarbage() local _, err = pcall(function() s3:call() end) assert(err:match(mtstates.error.object_closed)) local _, err = pcall(function() mtstates.state(id) end) assert(err:match(mtstates.error.unknown_object))
local Processer = require 'dataset.processer' local cmd = torch.CmdLine() cmd:option('-batch_size', 128, 'batch size') local opt = cmd:parse(arg) local directory = 'dataset/text8/' local text_file = directory .. 'text8' local tensor_text_file = directory .. 'text8.t7' local vocab_file = directory .. 'vocab.t7' local train_file = directory .. 'train.t7' local valid_file = directory .. 'valid.t7' local test_file = directory .. 'test.t7' local test_nb_characters = 5e6 local proc = Processer() proc:process(text_file, tensor_text_file, vocab_file) proc:split(tensor_text_file, test_nb_characters, opt.batch_size, train_file, valid_file, test_file)
-- ULX GlobalBan System -- Adobe and NigNog ------------------ //Load the inital file for the server! if SERVER then print('[ULX GB] - Loading.....'); include('globalban/gb_generic.lua'); include('globalban/gb_mysqloo.lua'); end
ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "Dazzle Dust" ENT.Author = "Rickster" ENT.Spawnable = false function ENT:SetupDataTables() self:NetworkVar("Int", 0, "price") self:NetworkVar("Entity", 1, "owning_ent") end hook.Add("Move", "DazzleDruggedPlayer", function(ply, mv) if not ply.isDazzleDrugged then return end if ply:IsOnGround() and mv:KeyPressed(IN_JUMP) then local vec = mv:GetVelocity() vec.z = 200 -- Adds on to the jump power mv:SetVelocity(vec) end end)
--- The elasticsearch module -- -- Requirements: -- lua >= 5.1 -- -- @module elasticsearch -- @author Dhaval Kapil ------------------------------------------------------------------------------- -- Importing modules ------------------------------------------------------------------------------- local Client = require "elasticsearch.Client" local helpers = require "elasticsearch.helpers" ------------------------------------------------------------------------------- -- Declaring module ------------------------------------------------------------------------------- local elasticsearch = {} ------------------------------------------------------------------------------- -- The helper's module ------------------------------------------------------------------------------- elasticsearch.helpers = helpers ------------------------------------------------------------------------------- -- Returns an instance of a client object -- -- @param params The params of the client -- -- @return table The client instance ------------------------------------------------------------------------------- function elasticsearch.client(params) return Client:new(params) end return elasticsearch
function onCreate() makeAnimatedLuaSprite('backG','Cgstage/CGBG',-1000,-740); setLuaSpriteScrollFactor('backG', 0.9, 0.9); scaleObject('backG', 1.36,1.2); addLuaSprite('backG', false); addAnimationByPrefix('backG', 'idle', 'new', 40, true); makeAnimatedLuaSprite('personaje1','Cgstage/bopper1',-370,100); setLuaSpriteScrollFactor('personaje1', 0.9, 0.9); scaleObject('personaje1', 1.5,1.5); makeAnimatedLuaSprite('free','Cgstage/crowd-free',-400,470); setLuaSpriteScrollFactor('free', 0.9, 0.9); scaleObject('free', 1.5,1.5); addLuaSprite('free', true); addAnimationByPrefix('free', 'idle', 'crowd-van', 40, true); makeLuaSprite('DOWN LIGHT', 'Cgstage/DOWN LIGHT', 2,0); scaleObject('DOWN LIGHT', 0.81,1.01); setObjectCamera('DOWN LIGHT', 'hud'); makeLuaSprite('LEFT LIGHT', 'Cgstage/LEFT LIGHT', 2,0); scaleObject('LEFT LIGHT', 0.81,1.01); setObjectCamera('LEFT LIGHT', 'hud'); makeLuaSprite('RIGHT LIGHT', 'Cgstage/RIGHT LIGHT', 2,0); scaleObject('RIGHT LIGHT', 0.81,1.01); setObjectCamera('RIGHT LIGHT', 'hud'); makeLuaSprite('UP LIGHT', 'Cgstage/UP LIGHT', 2,0); scaleObject('UP LIGHT', 0.81,1.01); setObjectCamera('UP LIGHT', 'hud'); addLuaSprite('personaje1', false); addAnimationByPrefix('personaje1', 'idle', 'crowd1', 30, true); makeAnimatedLuaSprite('personaje2','Cgstage/bopper2',-280,100); setLuaSpriteScrollFactor('personaje2', 0.9, 0.9); scaleObject('personaje2', 1.5,1.5); addLuaSprite('personaje2', false); addAnimationByPrefix('personaje2', 'idle', 'crowd1', 30, true); makeAnimatedLuaSprite('free2','Cgstage/crowd-free2',150,470); setLuaSpriteScrollFactor('free2', 0.9, 0.9); scaleObject('free2', 1.5,1.5); addLuaSprite('free2', true); addAnimationByPrefix('free2', 'idle', 'crowd-van', 30, true); makeLuaSprite('layer', 'Cgstage/BGLAYER', 2,0); scaleObject('layer', 0.81,1.01); setObjectCamera('layer', 'hud'); addLuaSprite('layer', false); addLuaSprite('DOWN LIGHT', true); addLuaSprite('LEFT LIGHT', true); addLuaSprite('RIGHT LIGHT', true); addLuaSprite('UP LIGHT', true); setProperty('DOWN LIGHT.visible', false); setProperty('LEFT LIGHT.visible', false); setProperty('RIGHT LIGHT.visible', false); setProperty('UP LIGHT.visible', false); end function onUpdate(elapsed) -- start of "update", some variables weren't updated yet if keyJustPressed('left') then setProperty('DOWN LIGHT.visible', false); setProperty('LEFT LIGHT.visible', true); setProperty('RIGHT LIGHT.visible', false); setProperty('UP LIGHT.visible', false); elseif keyJustPressed('down') then setProperty('DOWN LIGHT.visible', true); setProperty('LEFT LIGHT.visible', false); setProperty('RIGHT LIGHT.visible', false); setProperty('UP LIGHT.visible', false); elseif keyJustPressed('up') then setProperty('DOWN LIGHT.visible', false); setProperty('LEFT LIGHT.visible', false); setProperty('RIGHT LIGHT.visible', false); setProperty('UP LIGHT.visible', true); elseif keyJustPressed('right') then setProperty('DOWN LIGHT.visible', false); setProperty('LEFT LIGHT.visible', false); setProperty('RIGHT LIGHT.visible', true); setProperty('UP LIGHT.visible',false); end end
-- @see demo-transport-belt-pictures fast_belt_animation_set = { animation_set = { filename = "__base__/graphics/entity/fast-transport-belt/fast-transport-belt.png", priority = "extra-high", width = 64, height = 64, frame_count = 32, direction_count = 20, hr_version = { filename = "__base__/graphics/entity/fast-transport-belt/hr-fast-transport-belt.png", priority = "extra-high", width = 128, height = 128, scale = 0.5, frame_count = 32, direction_count = 20 } }, --east_index = 1, --west_index = 2, --north_index = 3, --south_index = 4, --east_to_north_index = 5, --north_to_east_index = 6, --west_to_north_index = 7, --north_to_west_index = 8, --south_to_east_index = 9, --east_to_south_index = 10, --south_to_west_index = 11, --west_to_south_index = 12, --starting_south_index = 13, --ending_south_index = 14, --starting_west_index = 15, --ending_west_index = 16, --starting_north_index = 17, --ending_north_index = 18, --starting_east_index = 19, --ending_east_index = 20 } express_belt_animation_set = { animation_set = { filename = "__base__/graphics/entity/express-transport-belt/express-transport-belt.png", priority = "extra-high", width = 64, height = 64, frame_count = 32, direction_count = 20, hr_version = { filename = "__base__/graphics/entity/express-transport-belt/hr-express-transport-belt.png", priority = "extra-high", width = 128, height = 128, scale = 0.5, frame_count = 32, direction_count = 20 } }, --east_index = 1, --west_index = 2, --north_index = 3, --south_index = 4, --east_to_north_index = 5, --north_to_east_index = 6, --west_to_north_index = 7, --north_to_west_index = 8, --south_to_east_index = 9, --east_to_south_index = 10, --south_to_west_index = 11, --west_to_south_index = 12, --starting_south_index = 13, --ending_south_index = 14, --starting_west_index = 15, --ending_west_index = 16, --starting_north_index = 17, --ending_north_index = 18, --starting_east_index = 19, --ending_east_index = 20 }
local nilAssertion = flow.assertionFactory.new(function(data) return data == nil, "TYPE_RESTRICTION_VIOLATION", "Nil expected, got " .. type(data); end); return nilAssertion;
projectiles = {}
username = "root" password = "rewt" db = "rp" host = "localhost" port = 3306 function getMySQLUsername() return username end function getMySQLPassword() return password end function getMySQLDBName() return db end function getMySQLHost() return host end function getMySQLPort() return port end
--[[ Name: "cl_auto.lua". Product: "nexus". --]] local MOUNT = MOUNT; NEXUS:IncludePrefixed("sh_auto.lua"); NEXUS:HookDataStream("MapScene", function(data) MOUNT.mapScene = data; end);
AddCSLuaFile() SWEP.DrawWeaponInfoBox = false SWEP.Author = "TankNut" SWEP.Slot = 2 SWEP.AdminOnly = false SWEP.Spawnable = false SWEP.DrawCrosshair = true SWEP.ViewModel = Model("models/weapons/c_pistol.mdl") SWEP.WorldModel = Model("models/weapons/w_smg1.mdl") SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Ammo = "" SWEP.Primary.Automatic = true SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Ammo = "" SWEP.Secondary.Automatic = false SWEP.Model = "smg" SWEP.ModelScale = 1 SWEP.MuzzleEffect = false SWEP.TracerEffect = "voxel_tracer_ar2" SWEP.HoldType = "ar2" SWEP.HoldTypeLower = "passive" SWEP.Damage = 29 SWEP.DamageType = DMG_BULLET SWEP.Spread = 0.012 SWEP.Delay = 0.1 SWEP.Recoil = Vector(0.00005, 0.0125, 0) SWEP.RecoilMult = 2 SWEP.ConstantRecoil = false SWEP.AimDistance = 10 SWEP.Scope = {} SWEP.Sound = {} SWEP.FireAnimation = true SWEP.ReloadTime = 2.5 SWEP.VMOffset = { Pos = Vector(12, -6, -8), } SWEP.WMOffset = { Pos = Vector(2, 0.5, 0), Ang = Angle() } SWEP.VMLower = { Pos = Vector(0, 3, -1), Ang = Angle(20, 45, 0) } SWEP.ReloadLower = { Pos = Vector(0, 0, -1), Ang = Angle(30, 0, 0) } SWEP.Attachments = {} SWEP.ActivityOverrides = {} AddCSLuaFile("cl_draw.lua") AddCSLuaFile("cl_hud.lua") AddCSLuaFile("cl_model.lua") if CLIENT then include("cl_draw.lua") include("cl_hud.lua") include("cl_model.lua") end include("sh_helpers.lua") include("sh_recoil.lua") if SERVER then include("sv_npc.lua") end function SWEP:Initialize() local mins, maxs = voxel.GetHull(self.Model, self.ModelScale) self.PhysCollide = CreatePhysCollideBox(mins, maxs) self:SetCollisionBounds(mins, maxs) if SERVER then self:PhysicsInitBox(mins, maxs) self:SetSolid(SOLID_VPHYSICS) local phys = self:GetPhysicsObject() if IsValid(phys) then phys:Wake() end end if CLIENT then self:SetRenderBounds(mins, maxs) self.StorePos = self.VMLower.Pos self.StoreAng = self.VMLower.Ang self.LastVMTime = CurTime() end self:DrawShadow(false) self:EnableCustomCollisions(true) self:SetHoldType(self.HoldType) self.LastThink = CurTime() self:SetZoomIndex(1) end function SWEP:SetupDataTables() self:NetworkVar("Float", 0, "FireDuration") self:NetworkVar("Float", 1, "FinishReload") self:NetworkVar("Int", 0, "ZoomIndex") end function SWEP:Deploy() if game.SinglePlayer() then self:CallOnClient("Deploy") end self:SetHoldType(self.HoldType) if CLIENT then self.StorePos = self.VMLower.Pos self.StoreAng = self.VMLower.Ang self.LastVMTime = CurTime() end end function SWEP:Holster() if self:IsReloading() then return false end return true end function SWEP:CanAttack() if self:ShouldLower() then return false end if self:IsReloading() then return false end return true end function SWEP:GetDelay() return self.Delay end function SWEP:PrimaryAttack() if not self:CanAttack() then return end if self.Primary.ClipSize > 0 and self:Clip1() <= 0 then self:EmitSound("voxel/empty.wav") self:SetNextPrimaryFire(CurTime() + 0.2) return end local ply = self.Owner if not self:IsFiring() and IsFirstTimePredicted() then self:SetFireDuration(0) self:StartFiring() end if ply:IsPlayer() then math.randomseed(ply:GetCurrentCommand():CommandNumber()) end if IsFirstTimePredicted() and self.MuzzleEffect then local ed = EffectData() ed:SetEntity(self) ed:SetScale(1) ed:SetOrigin(self:GetPos()) util.Effect(self.MuzzleEffect, ed) end if self.FireAnimation then ply:SetAnimation(PLAYER_ATTACK1) end self:FireWeapon(ply) self:TakePrimaryAmmo(1) if ply:IsPlayer() then self:DoRecoil() end self:SetNextPrimaryFire(CurTime() + self:GetDelay()) end function SWEP:FireWeapon(ply) local cone = self:GetSpread() local aimcone = Angle(math.Rand(-cone, cone) * 25, 0, 0) aimcone:RotateAroundAxis(Vector(1, 0, 0), math.Rand(0, 360)) self:FireBullets({ Src = ply:GetShootPos(), Dir = (self:GetAimAngle() + aimcone):Forward(), Attacker = self.Owner, Spread = Vector(0, 0, 0), TracerName = self.TracerEffect, Tracer = 1, Damage = self.Damage, Callback = function(attacker, tr, dmg) dmg:SetDamageType(self.DamageType) end }) self:PlaySound(self.Sound.Fire) end function SWEP:SecondaryAttack() end function SWEP:CanReload() if self:GetFinishReload() > CurTime() then return false end if self:GetReserveAmmo() <= 0 then return false end if self:Clip1() == self.Primary.ClipSize then return false end return true end function SWEP:Reload() if not self:CanReload() then return end self.Owner:SetAnimation(PLAYER_RELOAD) self:PlaySound(self.Sound.Reload) self:SetFinishReload(CurTime() + self.ReloadTime) end function SWEP:Think() local delta = CurTime() - self.LastThink if self:ShouldLower() then self:SetHoldType(self.HoldTypeLower) else self:SetHoldType(self.HoldType) end if SERVER then local duration = self:GetFireDuration() if duration != -1 and self.Owner:KeyDown(IN_ATTACK) and self:CanAttack() then self:SetFireDuration(duration + delta) else if duration != -1 then self:StopFiring() end self:SetFireDuration(-1) end end self:ReloadThink(delta) self:ScopeThink() self.LastThink = CurTime() end function SWEP:ReloadThink(delta) local finish = self:GetFinishReload() if finish != 0 and finish <= CurTime() then self:SetFinishReload(0) local clip = self:Clip1() local ammo = math.min(self.Primary.ClipSize - clip, self:GetReserveAmmo()) self:SetClip1(clip + ammo) self.Owner:RemoveAmmo(ammo, self:GetPrimaryAmmoType()) end end function SWEP:ScopeThink() if not self.Scope.Enabled then return end if self:AimingDownSights() and istable(self.Scope.Zoom) and (not game.SinglePlayer() or SERVER) then local cmd = self.Owner:GetCurrentCommand() local wheel = math.Clamp(cmd:GetMouseWheel(), -1, 1) if wheel != 0 then local index = self:GetZoomIndex() + wheel if index > 0 and index <= #self.Scope.Zoom then self:SetZoomIndex(index) end end end if CLIENT then if not self:AimingDownSights() or self:IsReloading() then self.Scoped = false elseif not self.Scoped and self:GetADSFactor() > 0.9 then self.Scoped = true end end end function SWEP:StartFiring() end function SWEP:StopFiring() end if CLIENT then local fov = GetConVar("fov_desired") local ratio = GetConVar("zoom_sensitivity_ratio") function SWEP:AdjustMouseSensitivity() return (LocalPlayer():GetFOV() / fov:GetFloat()) * ratio:GetFloat() end end function SWEP:GetZoomLevel() local zoom = self.Scope.Zoom if istable(zoom) then zoom = zoom[self:GetZoomIndex()] end return zoom end function SWEP:TranslateFOV(fov) if not self.Scope.Enabled then return fov end if (CLIENT and self.Scoped) or (SERVER and self:AimingDownSights()) then return fov / self:GetZoomLevel() end end function SWEP:SetupMove(ply, mv) if self:IsReloading() then mv:SetMaxClientSpeed(ply:GetWalkSpeed()) elseif self:AimingDownSights() then mv:SetMaxClientSpeed(ply:GetWalkSpeed() * 0.6) end end function SWEP:TranslateActivity(act) local ply = self.Owner if ply:IsNPC() then return self.ActivityTranslateAI[act] or -1 end local holdtype = self:GetHoldType() local overrides = self.ActivityOverrides[holdtype] if overrides and overrides[act] then return overrides[act] end return self.ActivityTranslate[act] or -1 end function SWEP:TestCollision(start, delta, isbox, extends) if not IsValid(self.PhysCollide) then return end local max = extends local min = -extends max.z = max.z - min.z min.z = 0 local hit, norm, frac = self.PhysCollide:TraceBox(self:GetPos(), self:GetAngles(), start, start + delta, min, max) if not hit then return end return { HitPos = hit, Normal = norm, Fraction = frac } end
-- -- Created by IntelliJ IDEA. -- User: apatterson -- Date: 6/28/18 -- Time: 7:25 PM -- To change this template use File | Settings | File Templates. -- local mapBinder = require("../binder/mapBinder") local keyModifierMapFactory = require("../binder/maps/keyModifierMapFactory") local module = {}; local modifiers = {"ctrl" } local keys = {"pad1","pad2","pad3","pad4","pad5","pad6","pad7","pad8","pad9","pad1","pad1","pad1","pad1","pad0", "pad-", "pad+"}; local includeEmptyModifierSet = true function module.bind(f) local keyModifierMap = keyModifierMapFactory.createWithExhaustiveCombinations(keys, modifiers, f, includeEmptyModifierSet) mapBinder.bind(keyModifierMap) end return module
----------------------------------------- -- Spell: Cursed Sphere -- Deals water damage to enemies within area of effect -- Spell cost: 36 MP -- Monster Type: Vermin -- Spell Type: Magical (Water) -- Blue Magic Points: 2 -- Stat Bonus: MND+1 -- Level: 18 -- Casting Time: 3 seconds -- Recast Time: 19.5 seconds -- Magic Bursts on: Reverberation, Distortion, and Darkness -- Combos: Magic Attack Bonus ----------------------------------------- require("scripts/globals/bluemagic") require("scripts/globals/status") require("scripts/globals/magic") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0 end function onSpellCast(caster,target,spell) local params = {} -- This data should match information on http://wiki.ffxiclopedia.org/wiki/Calculating_Blue_Magic_Damage params.multiplier = 1.50 params.tMultiplier = 1.0 params.duppercap = 30 params.str_wsc = 0.0 params.dex_wsc = 0.0 params.vit_wsc = 0.0 params.agi_wsc = 0.0 params.int_wsc = 0.3 params.mnd_wsc = 0.0 params.chr_wsc = 0.0 damage = BlueMagicalSpell(caster, target, spell, params, INT_BASED) damage = BlueFinalAdjustments(caster, target, spell, damage, params) return damage end
//loader Plugin loader //Load Plugins local function LoadPlugins() if DAK.config ~= nil and DAK.config.loader ~= nil then for i = 1, #DAK.config.loader.PluginsList do local Plugin = DAK.config.loader.PluginsList[i] if Plugin ~= nil and Plugin ~= "" then local filename = string.format("lua/plugins/%s.lua", Plugin) Script.Load(filename) //Shared.Message(string.format("Plugin %s loaded.", Plugin)) end end else Shared.Message("Something may be wrong with your config file.") end end LoadPlugins() local function ResetandLoadPlugins() DAK:ExecuteEventHooks("OnPluginUnloaded") LoadPlugins() end DAK:CreateServerAdminCommand("Console_sv_reloadplugins", ResetandLoadPlugins, "Reloads all plugins.") local function OnCommandListPlugins(client) ServerAdminPrint(client, string.format("Loader v%s is installed.", DAK.version)) ServerAdminPrint(client, string.format("Loader is %s.", ConditionalValue(DAK.enabled, "enabled", "disabled"))) for i = 1, #DAK.config.loader.PluginsList do local Plugin = DAK.config.loader.PluginsList[i] if Plugin ~= nil then local message = string.format("Plugin %s is loaded.", Plugin) ServerAdminPrint(client, message) end end end DAK:CreateServerAdminCommand("Console_sv_listplugins", OnCommandListPlugins, "Will list the state of all plugins.")
-- n, v, i are mode names local function termcodes(str) return vim.api.nvim_replace_termcodes(str, true, true, true) end local M = {} M.general = { i = { -- go to beginning and end ["<C-b>"] = { "<ESC>^i", "論 beginning of line" }, ["<C-e>"] = { "<End>", "壟 end of line" }, -- navigate within insert mode ["<C-h>"] = { "<Left>", " move left" }, ["<C-l>"] = { "<Right>", " move right" }, ["<C-j>"] = { "<Down>", " move down" }, ["<C-k>"] = { "<Up>", " move up" }, }, n = { ["<ESC>"] = { "<cmd> noh <CR>", " no highlight" }, -- switch between windows ["<C-h>"] = { "<C-w>h", " window left" }, ["<C-l>"] = { "<C-w>l", " window right" }, ["<C-j>"] = { "<C-w>j", " window down" }, ["<C-k>"] = { "<C-w>k", " window up" }, -- save ["<C-s>"] = { "<cmd> w <CR>", "﬚ save file" }, -- Copy all ["<C-c>"] = { "<cmd> %y+ <CR>", " copy whole file" }, -- line numbers ["<leader>n"] = { "<cmd> set nu! <CR>", " toggle line number" }, ["<leader>rn"] = { "<cmd> set rnu! <CR>", " toggle relative number" }, -- update nvchad ["<leader>uu"] = { "<cmd> :NvChadUpdate <CR>", " update nvchad" }, ["<leader>tt"] = { function() require("base46").toggle_theme() end, " toggle theme", }, }, t = { ["<C-x>"] = { termcodes "<C-\\><C-N>", " escape terminal mode" }, }, } M.bufferline = { n = { -- new buffer ["<S-b>"] = { "<cmd> enew <CR>", "烙 new buffer" }, -- cycle through buffers ["<TAB>"] = { "<cmd> BufferLineCycleNext <CR>", " cycle next buffer" }, ["<S-Tab>"] = { "<cmd> BufferLineCyclePrev <CR>", " cycle prev buffer" }, -- close buffer + hide terminal buffer ["<leader>x"] = { function() nvchad.close_buffer() end, " close buffer", }, }, } M.comment = { -- toggle comment in both modes n = { ["<leader>/"] = { function() require("Comment.api").toggle_current_linewise() end, "蘒 toggle comment", }, }, v = { ["<leader>/"] = { "<ESC><cmd>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>", "蘒 toggle comment", }, }, } M.lspconfig = { -- See `<cmd> :help vim.lsp.*` for documentation on any of the below functions n = { ["gD"] = { function() vim.lsp.buf.declaration() end, " lsp declaration", }, ["gd"] = { function() vim.lsp.buf.definition() end, " lsp definition", }, ["K"] = { function() vim.lsp.buf.hover() end, " lsp hover", }, ["gi"] = { function() vim.lsp.buf.implementation() end, " lsp implementation", }, ["<leader>ls"] = { function() vim.lsp.buf.signature_help() end, " lsp signature_help", }, ["<leader>D"] = { function() vim.lsp.buf.type_definition() end, " lsp definition type", }, ["<leader>ra"] = { function() vim.lsp.buf.rename() end, " lsp rename", }, ["<leader>ca"] = { function() vim.lsp.buf.code_action() end, " lsp code_action", }, ["gr"] = { function() vim.lsp.buf.references() end, " lsp references", }, ["<leader>f"] = { function() vim.diagnostic.open_float() end, " floating diagnostic", }, ["[d"] = { function() vim.diagnostic.goto_prev() end, " goto prev", }, ["d]"] = { function() vim.diagnostic.goto_next() end, " goto_next", }, ["<leader>q"] = { function() vim.diagnostic.setloclist() end, " diagnostic setloclist", }, ["<leader>fm"] = { function() vim.lsp.buf.formatting() end, " lsp formatting", }, ["<leader>wa"] = { function() vim.lsp.buf.add_workspace_folder() end, " add workspace folder", }, ["<leader>wr"] = { function() vim.lsp.buf.remove_workspace_folder() end, " remove workspace folder", }, ["<leader>wl"] = { function() print(vim.inspect(vim.lsp.buf.list_workspace_folders())) end, " list workspace folders", }, }, } M.nvimtree = { n = { -- toggle ["<C-n>"] = { "<cmd> NvimTreeToggle <CR>", " toggle nvimtree" }, -- focus ["<leader>e"] = { "<cmd> NvimTreeFocus <CR>", " focus nvimtree" }, }, } M.telescope = { n = { -- find ["<leader>ff"] = { "<cmd> Telescope find_files <CR>", " find files" }, ["<leader>fa"] = { "<cmd> Telescope find_files follow=true no_ignore=true hidden=true <CR>", " find all" }, ["<leader>fw"] = { "<cmd> Telescope live_grep <CR>", " live grep" }, ["<leader>fb"] = { "<cmd> Telescope buffers <CR>", " find buffers" }, ["<leader>fh"] = { "<cmd> Telescope help_tags <CR>", " help page" }, ["<leader>fo"] = { "<cmd> Telescope oldfiles <CR>", " find oldfiles" }, ["<leader>tk"] = { "<cmd> Telescope keymaps <CR>", " show keys" }, -- git ["<leader>cm"] = { "<cmd> Telescope git_commits <CR>", " git commits" }, ["<leader>gt"] = { "<cmd> Telescope git_status <CR>", " git status" }, -- pick a hidden term ["<leader>pt"] = { "<cmd> Telescope terms <CR>", " pick hidden term" }, -- theme switcher ["<leader>th"] = { "<cmd> Telescope themes <CR>", " nvchad themes" }, }, } M.nvterm = { t = { -- toggle in terminal mode ["<A-i>"] = { function() require("nvterm.terminal").toggle "float" end, " toggle floating term", }, ["<A-h>"] = { function() require("nvterm.terminal").toggle "horizontal" end, " toggle horizontal term", }, ["<A-v>"] = { function() require("nvterm.terminal").toggle "vertical" end, " toggle vertical term", }, }, n = { -- toggle in normal mode ["<A-i>"] = { function() require("nvterm.terminal").toggle "float" end, " toggle floating term", }, ["<A-h>"] = { function() require("nvterm.terminal").toggle "horizontal" end, " toggle horizontal term", }, ["<A-v>"] = { function() require("nvterm.terminal").toggle "vertical" end, " toggle vertical term", }, -- new ["<leader>h"] = { function() require("nvterm.terminal").new "horizontal" end, " new horizontal term", }, ["<leader>v"] = { function() require("nvterm.terminal").new "vertical" end, " new vertical term", }, }, } M.whichkey = { n = { ["<leader>wK"] = { function() vim.cmd "WhichKey" end, " which-key all keymaps", }, ["<leader>wk"] = { function() local input = vim.fn.input "WhichKey: " vim.cmd("WhichKey " .. input) end, " which-key query lookup", }, }, } return M
local IItemReadable = class.interface("IItemReadable", { on_read = "function" }) return IItemReadable
local playsession = { {"Jhumekes", {632374}}, {"Menander", {1022963}}, {"Gorlos", {11317}}, {"supra90", {1100578}}, {"everLord", {1352418}}, {"adieclay", {8173}}, {"MeggalBozale", {1176869}}, {"matam666", {1124455}}, {"lemarkiz", {10724}}, {"Augustona", {599619}}, {"tanneman", {594971}}, {"Collider", {68090}}, {"RainSolid", {338267}}, {"mustyoshi", {12750}}, {"freek18", {11011}}, {"houdhakker2", {81109}}, {"jackazzm", {892697}}, {"wolfspike", {24831}}, {"kaimix", {7979}}, {"C4pT_H0oK", {24626}}, {"McSafety", {305434}}, {"Falcrum", {845}}, {"Reyand", {435503}}, {"wvwisokee", {5216}}, {"Bozan", {422413}}, {"Impatient", {11199}}, {"Combat564", {17127}}, {"AurelienG", {196048}}, {"amek87", {8942}}, {"PogomanD", {301685}}, {"evileddy60", {11247}}, {"Nickske157", {138246}}, {"peca_", {45182}}, {"Default_Sound", {9993}}, {"acroca", {7446}}, {"ksb4145", {170514}}, {"banakeg", {2542}}, {"Morgan3rd", {5471}}, {"CidWizzard", {2120}} } return playsession
local stores = { ["paleto_twentyfourseven"] = { position = { ['x'] = 1730.35949707031, ['y'] = 6416.7001953125, ['z'] = 35.0372161865234 }, reward = 1000, nameofstore = "Paleto Bay", lastrobbed = 0 }, ["sandyshores_twentyfoursever"] = { position = { ['x'] = 1960.4197998047, ['y'] = 3742.9755859375, ['z'] = 32.343738555908 }, reward = 1000, nameofstore = "Sandy Shores", lastrobbed = 0 }, ["bar_one"] = { position = { ['x'] = 1986.1240234375, ['y'] = 3053.8747558594, ['z'] = 47.215171813965 }, reward = 1000, nameofstore = "Yellow Jack", lastrobbed = 0 }, ["groove_street"] = { position = { ['x'] = -43.0, ['y'] = -1748.700, ['z'] = 28.80 }, reward = 5000, nameofstore = "Groove street (à côté de l'armurerie)", lastrobbed = 0 }, ["clinton_avenue"] = { position = { ['x'] = 378.110, ['y'] = 333.063, ['z'] = 102.60 }, reward = 5000, nameofstore = "Bowl (Près du casino)", lastrobbed = 0 }, ["littleseoul_twentyfourseven"] = { position = { ['x'] = -709.17022705078, ['y'] = -904.21722412109, ['z'] = 19.215591430664 }, reward = 5000, nameofstore = "Little Seoul", lastrobbed = 0 } } local robbers = {} function get3DDistance(x1, y1, z1, x2, y2, z2) return math.sqrt(math.pow(x1 - x2, 2) + math.pow(y1 - y2, 2) + math.pow(z1 - z2, 2)) end RegisterServerEvent('es_holdup:toofar') AddEventHandler('es_holdup:toofar', function(robb) if(robbers[source])then TriggerClientEvent('es_holdup:toofarlocal', source) robbers[source] = nil TriggerClientEvent('chatMessage', -1, 'NEWS', {255, 0, 0}, "Braquage annulé au: ^2" .. stores[robb].nameofstore) end end) RegisterServerEvent('es_holdup:rob') AddEventHandler('es_holdup:rob', function(robb) if stores[robb] then local store = stores[robb] if (os.time() - store.lastrobbed) < 600 and store.lastrobbed ~= 0 then TriggerClientEvent('chatMessage', source, 'ROBBERY', {255, 0, 0}, "Le coffre est vide. Tu dois attendre: ^2" .. (3600 - (os.time() - store.lastrobbed)) .. "^0 seconde(s).") return end TriggerClientEvent('chatMessage', -1, 'ALERTE', {255, 0, 0}, "Braquage en cours au ^2" .. store.nameofstore) TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "Vous commencez le braquage du: ^2" .. store.nameofstore .. "^0, ne vous éloignez pas du coffre !") TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "L'alarme se déclenche!") TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, "Tenez bon ^12 ^0minutes et le coffre sera à vous !") TriggerClientEvent('es_holdup:currentlyrobbing', source, robb) stores[robb].lastrobbed = os.time() robbers[source] = robb local savedSource = source SetTimeout(120000, function() if(robbers[savedSource])then TriggerClientEvent('es_holdup:robberycomplete', savedSource, job) TriggerEvent('es:getPlayerFromId', savedSource, function(target) if(target)then --target:addDirty_Money(store.reward) target:addMoney(store.reward) TriggerClientEvent('chatMessage', -1, 'ALERTE', {255, 0, 0}, "Le braquage est terminé au: ^2" .. store.nameofstore) end end) end end) end end)
minetest.register_on_newplayer(function(player) player:get_inventory():add_item('main', 'default:sword_steel') player:get_inventory():add_item('main', 'default:torch 8') end)
local _, G = ... local function asPrefList(a, b) local allList = true for _, x in pairs(a) do allList = allList and type(x) == 'table' end if allList then return a end local aa = {} for n, f in pairs(a) do local bns = {} for bn in pairs(b) do table.insert(bns, bn) end table.sort(bns, f) aa[n] = bns end return aa end local function asPrefFunction(a) local allFunc = true for _, x in pairs(a) do allFunc = allFunc and type(x) == 'function' end if allFunc then return a end local aa = {} for n, bns in pairs(a) do local ranks = {} for i, bn in ipairs(bns) do ranks[bn] = i end aa[n] = function(x, y) return ranks[x] < ranks[y] end end return aa end G.StableMarriage = function(men, women) local tmen = asPrefList(men, women) local fwomen = asPrefFunction(women, men) local freeMen = {} local nextPref = {} for man in pairs(tmen) do freeMen[man] = true nextPref[man] = 1 end local engagements = {} for man in next, freeMen do local prefs = tmen[man] local idx = nextPref[man] local woman = prefs[idx] nextPref[man] = idx + 1 local fiance = engagements[woman] or man if fwomen[woman](man, fiance) then freeMen[fiance] = true fiance = man end engagements[woman] = fiance freeMen[fiance] = nil end return engagements end
-- Scanline floodfill, uses a self made stack that can either be a LIFO queue (depth-first search) -- or a simple queue (breadth-first search) -- See http://en.wikipedia.org/wiki/Flood_fill#Scanline_fill local function floodStackScanline(x,y,grid,stack) stack:clear() local y1 local spanLeft, spanRight if grid:has(x,y) and grid._map[y][x].v==0 then stack:push(grid._map[y][x]) end while not stack:isEmpty() do local p = stack:pop() x, y = p.x, p.y y1 = y while ((y1>=1) and grid:has(x,y1) and grid._map[y1][x].v==0) do y1 = y1 - 1 end y1 = y1 + 1 spanLeft, spanRight = false, false while (y1<=grid._height and grid:has(x,y1) and grid._map[y1][x].v==0) do grid:set(x,y1,1) if (not spanLeft and x>0 and grid:has(x-1,y1) and grid._map[y1][x-1].v==0) then stack:push(grid._map[y1][x-1]) spanLeft = true elseif (spanLeft and x>0 and grid:has(x-1,y1) and grid._map[y1][x-1].v~=0)then spanLeft = false end if (not spanRight and x<=grid._width and grid:has(x+1,y1) and grid._map[y1][x+1].v==0) then stack:push(grid._map[y1][x+1]) spanRight = true elseif (spanRight and x<=grid._width and grid:has(x+1,y1) and grid._map[y1][x+1].v~=0) then spanRight = false end y1 = y1+1 end end end return floodStackScanline
Materials = script.Parent.Materials Color = script.Parent.Colors while wait() do local Humanoid = script.Parent.Parent:FindFirstChild("Humanoid") -- Find the players humanoid Materials.Value = "None" if Humanoid.FloorMaterial == Enum.Material.SmoothPlastic or Humanoid.FloorMaterial == Enum.Material.Plastic then Materials.Value = "Plastic" elseif Humanoid.FloorMaterial == Enum.Material.Brick then Materials.Value = "Brick" elseif Humanoid.FloorMaterial == Enum.Material.Neon then Materials.Value = "Neon" elseif Humanoid.FloorMaterial == Enum.Material.Cobblestone then Materials.Value = "Cobblestone" elseif Humanoid.FloorMaterial == Enum.Material.Concrete then Materials.Value = "Concrete" elseif Humanoid.FloorMaterial == Enum.Material.CorrodedMetal then Materials.Value = "CorrodedMetal" elseif Humanoid.FloorMaterial == Enum.Material.DiamondPlate then Materials.Value = "DiamondPlate" elseif Humanoid.FloorMaterial == Enum.Material.Fabric then Materials.Value = "Fabric" elseif Humanoid.FloorMaterial == Enum.Material.Snow or Humanoid.FloorMaterial == Enum.Material.Salt then Materials.Value = "Snow" elseif Humanoid.FloorMaterial == Enum.Material.Glass or Humanoid.FloorMaterial == Enum.Material.Foil then Materials.Value = "Foil" elseif Humanoid.FloorMaterial == Enum.Material.Granite or Humanoid.FloorMaterial == Enum.Material.Rock or Humanoid.FloorMaterial == Enum.Material.Pavement then Materials.Value = "Granite" elseif Humanoid.FloorMaterial == Enum.Material.Grass then Materials.Value = "Grass" elseif Humanoid.FloorMaterial == Enum.Material.Ice then Materials.Value = "Ice" elseif Humanoid.FloorMaterial == Enum.Material.Marble or Humanoid.FloorMaterial == Enum.Material.Glacier or Humanoid.FloorMaterial == Enum.Material.CrackedLava then Materials.Value = "Marble" elseif Humanoid.FloorMaterial == Enum.Material.Metal then Materials.Value = "Metal" elseif Humanoid.FloorMaterial == Enum.Material.Pebble or Humanoid.FloorMaterial == Enum.Material.Asphalt or Humanoid.FloorMaterial == Enum.Material.Basalt then Materials.Value = "Pebble" elseif Humanoid.FloorMaterial == Enum.Material.Sand or Humanoid.FloorMaterial == Enum.Material.Mud or Humanoid.FloorMaterial == Enum.Material.Ground then Materials.Value = "Sand" elseif Humanoid.FloorMaterial == Enum.Material.Slate or Humanoid.FloorMaterial == Enum.Material.Sandstone or Humanoid.FloorMaterial == Enum.Material.Limestone then Materials.Value = "Slate" elseif Humanoid.FloorMaterial == Enum.Material.Wood or Humanoid.FloorMaterial == Enum.Material.WoodPlanks then Materials.Value = "Wood" elseif Humanoid.FloorMaterial == Enum.Material.LeafyGrass then Materials.Value = "LeafyGrass" elseif Humanoid.FloorMaterial == Enum.Material.ForceField then Materials.Value = "ForceField" end end --[[ --Instructions-- -For every material you want, you must add a new elseif statement, set "Enum.Materal" to the material you want. For example "Enum.Material.Glass" -Then just change the properties of the sound within that elseif statement to what you want. -Don't forget to edit the "Running" Script! --]] --CREDITS FOR BUILDING THIS SCRIPT: --Spathi --Edited by Dragon_Spikie...
local igwin = require"imgui.window" --local win = igwin:SDL(800,400, "widgets",{vsync=true,use_implot=true}) local win = igwin:GLFW(800,400, "widgets",{vsync=true}) win.ig.ImPlot_CreateContext() local ffi = require"ffi" local xs2, ys2 = ffi.new("float[?]",11),ffi.new("float[?]",11) for i = 0,10 do xs2[i] = i * 0.1; ys2[i] = xs2[i] * xs2[i]; end local gettercb = ffi.cast("ImPlotPoint_getter", function(data,idx,ipp) ipp[0].x = idx*0.001; ipp[0].y=0.5 + 0.5 * math.sin(50 * ipp[0].x); end) function win:draw(ig) ig.ImPlot_ShowDemoWindow() ig.Begin("Ploters") if (ig.ImPlot_BeginPlot("Line Plot", "x", "f(x)", ig.ImVec2(-1,-1))) then ig.ImPlot_PlotLineG("Line Plot",gettercb,nil,1000,0) ig.ImPlot_AnnotateClamped(0.25,1.1,ig.ImVec2(15,15),ig.ImPlot_GetLastItemColor(),"function %f %s",1,"hello"); ig.ImPlot_SetNextMarkerStyle(ig.lib.ImPlotMarker_Circle); ig.ImPlot_PlotLine("x^2", xs2, ys2, 11); ig.ImPlot_EndPlot(); end ig.End() end local function clean() win.ig.ImPlot_DestroyContext() end win:start(clean)
return require("packer").startup(function() use "wbthomason/packer.nvim" use { "nvim-treesitter/nvim-treesitter", run = ":TSUpdate", config = function() require("nvim-treesitter.configs").setup { context_commentstring = { enable = true } } end } use { "nvim-telescope/telescope.nvim", requires = { {"nvim-lua/plenary.nvim"} } } use { "folke/trouble.nvim", requires = "kyazdani42/nvim-web-devicons", config = function() require("trouble").setup { -- your configuration comes here -- or leave it empty to use the default settings } end } use "romgrk/nvim-treesitter-context" use "b3nj5m1n/kommentary" use "JoosepAlviste/nvim-ts-context-commentstring" use "neovim/nvim-lspconfig" use { "folke/which-key.nvim", config = function() require("which-key").setup { plugins = { spelling = { enabled = true, suggestions = 20, }, }, } end } end)
---@meta ---@class cc.EaseQuinticActionIn :cc.ActionEase local EaseQuinticActionIn={ } cc.EaseQuinticActionIn=EaseQuinticActionIn ---* ---@param action cc.ActionInterval ---@return self function EaseQuinticActionIn:create (action) end ---* ---@return self function EaseQuinticActionIn:clone () end ---* ---@param time float ---@return self function EaseQuinticActionIn:update (time) end ---* ---@return cc.ActionEase function EaseQuinticActionIn:reverse () end ---* ---@return self function EaseQuinticActionIn:EaseQuinticActionIn () end
-------------- -- Includes -- -------------- #include 'include/internal_events.lua' #include 'include/config.lua' -------------------------------- -- Local function definitions -- -------------------------------- local VIP_PRICE = 0.6 local g_VipRes = Resource('rafalh_vip') -- name = { -- cost - item cost, -- onBuy - handler (returns true to add item), -- onUse - handler (if false this item cannot be used and can be bought only once; returns true to remove item) }, -- field - database field g_ShopItems = {} PlayersTable:addColumns{ {'bidlvl', 'SMALLINT UNSIGNED', default = 1}, {'mapBoughtTimestamp', 'INT UNSIGNED', default = 0}, {'joinmsg', 'VARCHAR(128)', default = false, null = true}, {'ownedTeam', 'INT', default = false, null = true, fk = {'teams', 'id'}}, {'health100', 'TINYINT UNSIGNED', default = 0}, {'selfdestr', 'TINYINT UNSIGNED', default = 0}, {'mines', 'TINYINT UNSIGNED', default = 0}, {'oil', 'TINYINT UNSIGNED', default = 0}, {'beers', 'TINYINT UNSIGNED', default = 0}, {'invisibility', 'TINYINT UNSIGNED', default = 0}, {'godmodes30', 'TINYINT UNSIGNED', default = 0}, {'flips', 'TINYINT UNSIGNED', default = 0}, {'thunders', 'TINYINT UNSIGNED', default = 0}, {'smoke', 'TINYINT UNSIGNED', default = 0}, {'spikeStrips', 'TINYINT UNSIGNED', default = 0}, } function ShpSyncInventory(player) local inventory = {} for itemId, item in pairs(g_ShopItems) do if(item.field) then inventory[itemId] = player.accountData[item.field] end end local isVip = g_VipRes:isReady() and g_VipRes:call('isVip', player.el) triggerClientInternalEvent(player.el, $(EV_CLIENT_INVENTORY), player.el, inventory, isVip) end local function ShpGetInventoryRequest() local player = Player.fromEl(client) ShpSyncInventory(player) end local function ShpBuyShopItemRequest(itemId) local item = itemId and g_ShopItems[itemId] if(not item) then return end if(ShpBuyItem(itemId, client)) then local player = Player.fromEl(client) ShpSyncInventory(player) end end local function ShpSellShopItemRequest(itemId) local item = itemId and g_ShopItems[itemId] if(not item) then return end local pdata = Player.fromEl(client) local val = item.field and pdata.accountData:get(item.field) if(item.onSell(client, val)) then pdata.accountData:add('cash', math.floor(item.cost / 2)) ShpSyncInventory(pdata) end end local function ShpUseShopItemRequest(itemId) local item = itemId and g_ShopItems[itemId] if(not item) then return end if(ShpUseItem(itemId, client)) then local player = Player.fromEl(client) ShpSyncInventory(player) end end --------------------------------- -- Global function definitions -- --------------------------------- function ShpBuyItem(itemId, player) local item = g_ShopItems[itemId] local pdata = Player.fromEl(player) assert(item and pdata) if(item.clientSideBuy) then RPC('ShpBuyItem', itemId):setClient(player):exec() return true end assert(item.onBuy) local price = ShpGetItemPrice(itemId, player) if(pdata.accountData:get('cash') < price) then return false end local val = item.field and pdata.accountData:get(item.field) local success = item.onBuy(player, val) if(success == false) then return false elseif(success == nil) then Debug.warn('Expected returned status ('..tostring(itemId)..')') end pdata.accountData:add('cash', -price) return price end function ShpUseItem(itemId, player) local pdata = Player.fromEl(player) local item = g_ShopItems[itemId] assert(item) local room = pdata.room local map = getCurrentMap(room) local mapType = map and map:getType() local disabledShopItems = mapType and mapType.disabled_shop_items if (table.find(disabledShopItems, itemId)) then return false end if(item.onUse) then local val = item.field and pdata.accountData:get(item.field) return item.onUse(player, val) end return false end function ShpGetItemPrice(itemId, player) local item = g_ShopItems[itemId] local price = item.cost if(player and not item.noDiscount) then local isVip = g_VipRes:isReady() and g_VipRes:call('isVip', player) if(isVip) then price = math.ceil(price * VIP_PRICE) end end return price end function ShpRegisterItem(item) assert(type(item) == 'table' and item.id and not g_ShopItems[item.id]) item.cost = 10000 -- default price g_ShopItems[item.id] = item end local function ShpPrepareItems() for id, item in pairs(g_ShopItems) do local itemConfig = Shop.Config.get(id) if (itemConfig) then item.cost = itemConfig.price else g_ShopItems[id] = nil Debug.info('Disabled Shop item: '..id) end end end ------------ -- Events -- ------------ addInitFunc(function() addInternalEventHandler($(EV_BUY_SHOP_ITEM_REQUEST), ShpBuyShopItemRequest) addInternalEventHandler($(EV_SELL_SHOP_ITEM_REQUEST), ShpSellShopItemRequest) addInternalEventHandler($(EV_USE_SHOP_ITEM_REQUEST), ShpUseShopItemRequest) addInternalEventHandler($(EV_GET_INVENTORY_REQUEST), ShpGetInventoryRequest) ShpPrepareItems() end)
-- Pure LuaJIT implementation of quite OK image format (QOI) -- MIT license local ffi = require('ffi') local bit = require('bit') local band, bor, bxor = bit.band, bit.bor, bit.bxor local lshift, rshift, rol = bit.lshift, bit.rshift, bit.rol -- Constants local QOI_SRGB = 0 local QOI_LINEAR = 1 local QOI_OP_INDEX = 0x00 local QOI_OP_DIFF = 0x40 local QOI_OP_LUMA = 0x80 local QOI_OP_RUN = 0xC0 local QOI_OP_RGB = 0xFE local QOI_OP_RGBA = 0xFF local QOI_MASK_2 = 0xC0 local QOI_MAGIC = 0x716F6966 -- ASCII: qoif local QOI_HEADER_SIZE = 14 local QOI_PIXELS_MAX = 400000000 -- Structures local qoi_desc = ffi.cdef[[ typedef struct { unsigned int width; unsigned int height; unsigned char channels; unsigned char colorspace; } qoi_desc; ]] local qoi_rgba_t = ffi.cdef[[ typedef union { struct { unsigned char r, g, b, a; } rgba; int v; } qoi_rgba_t; ]] local qoi_padding = ffi.new("unsigned char[8]", {0,0,0,0,0,0,0,1}) -- Utility local function qoi_desc(t) return ffi.new('qoi_desc', t) end local function color_hash(c) return c.rgba.r*3 + c.rgba.g*5 + c.rgba.b*7 + c.rgba.a*11 end local function qoi_write_32(bytes, p, v) bytes[p] = rshift(band(0xFF000000, v), 24); p=p+1 bytes[p] = rshift(band(0x00FF0000, v), 16); p=p+1 bytes[p] = rshift(band(0x0000FF00, v), 08); p=p+1 bytes[p] = band(0x000000FF, v) ; p=p+1 return p end local function qoi_read_32(bytes, p) local a,b,c,d = bytes[p], bytes[p+1], bytes[p+2], bytes[p+3] a = lshift(a, 24) b = lshift(b, 16) c = lshift(c, 08) return bor(d, bor(c, bor(a, b))), p + 4 end local function qoi_encode(data, desc) local i, max_size, p, run = 0, 0, 0, 0 local px_len, px_end, px_pos, channels = 0, 0, 0, 0 local bytes --unsigned char local pixels --const unsigned char local index = ffi.new('qoi_rgba_t[?]', 64) local px, px_prev = ffi.new('qoi_rgba_t'), ffi.new('qoi_rgba_t') if data == nil or desc == nil or desc.width == 0 or desc.height == 0 or desc.channels < 3 or desc.channels > 4 or desc.colorspace > 1 or desc.height >= QOI_PIXELS_MAX / desc.width then return nil, 'Bad header' end max_size = desc.width * desc.height * (desc.channels + 1) + QOI_HEADER_SIZE + ffi.sizeof(qoi_padding) p = 0 bytes = ffi.new('unsigned char[?]', max_size) if bytes == nil then return nil, 'Unable to allocate' end p = qoi_write_32(bytes, p, QOI_MAGIC) p = qoi_write_32(bytes, p, desc.width) p = qoi_write_32(bytes, p, desc.height) bytes[p+0], bytes[p+1] = desc.channels, desc.colorspace p = p + 2 pixels = ffi.cast('const unsigned char*', data) ch4pixels = ffi.cast('qoi_rgba_t*', data) px_prev.rgba.r = 0 px_prev.rgba.g = 0 px_prev.rgba.b = 0 px_prev.rgba.a = 255 px.rgba.r = 0 px.rgba.g = 0 px.rgba.b = 0 px.rgba.a = 255 px_len = desc.width * desc.height * desc.channels px_end = px_len - desc.channels channels = desc.channels px_pos = 0 while px_pos < px_len do if channels == 4 then px = ch4pixels[px_pos/4] else px.rgba.r = pixels[px_pos + 0] px.rgba.g = pixels[px_pos + 1] px.rgba.b = pixels[px_pos + 2] end if px.v == px_prev.v then run = run + 1 if run == 62 or px_pos == px_end then bytes[p] = bor(QOI_OP_RUN, run - 1) p = p + 1 run = 0 end else if run > 0 then bytes[p] = bor(QOI_OP_RUN, run - 1) p = p + 1 run = 0 end local index_pos = color_hash(px) % 64 if index[index_pos].v == px.v then bytes[p] = bor(QOI_OP_INDEX, index_pos) p = p + 1 else ffi.copy(index[index_pos], px, ffi.sizeof(px)) if px.rgba.a == px_prev.rgba.a then local vr = px.rgba.r - px_prev.rgba.r local vg = px.rgba.g - px_prev.rgba.g local vb = px.rgba.b - px_prev.rgba.b local vgr = vr - vg local vgb = vb - vg if vr > -3 and vr < 2 and vg > -3 and vg < 2 and vb > -3 and vb < 2 then local vc = QOI_OP_DIFF vc = bor(vc, lshift(vr + 2, 4)) vc = bor(vc, lshift(vg + 2, 2)) vc = bor(vc, vb + 2) bytes[p] = vc p = p + 1 elseif vgr > -9 and vgr < 8 and vg > -33 and vg < 32 and vgb > -9 and vgb < 8 then bytes[p] = bor(QOI_OP_LUMA, vg + 32); p = p + 1 bytes[p] = bor(lshift(vgr + 8, 4), vgb + 8); p = p + 1 else bytes[p] = QOI_OP_RGB; p = p + 1 bytes[p] = px.rgba.r; p = p + 1 bytes[p] = px.rgba.g; p = p + 1 bytes[p] = px.rgba.b; p = p + 1 end else bytes[p] = QOI_OP_RGBA; p = p + 1 bytes[p] = px.rgba.r; p = p + 1 bytes[p] = px.rgba.g; p = p + 1 bytes[p] = px.rgba.b; p = p + 1 bytes[p] = px.rgba.a; p = p + 1 end end end ffi.copy(px_prev, px, ffi.sizeof(px)) px_pos = px_pos + channels end local i = 0 while i < ffi.sizeof(qoi_padding) do bytes[p] = qoi_padding[i] p = p + 1 i = i + 1 end return bytes, p end local function qoi_decode(data, size, channels) if data == nil or (channels ~= nil and channels ~= 3 and channels ~= 4) or size < QOI_HEADER_SIZE + ffi.sizeof(qoi_padding) then return nil, 'Invalid data' end local bytes = data; local p, run = 0, 0 local desc = qoi_desc({ width = 0, height = 0, channels = 0, colorspace = 0 }) local header_magic = 0 header_magic, p = qoi_read_32(bytes, p) desc.width, p = qoi_read_32(bytes, p) desc.height, p = qoi_read_32(bytes, p) desc.channels = bytes[p]; p = p + 1 desc.colorspace = bytes[p]; p = p + 1 if desc.width == 0 or desc.height == 0 or desc.channels < 3 or desc.channels > 4 or desc.colorspace > 1 or header_magic ~= QOI_MAGIC or desc.height >= QOI_PIXELS_MAX / desc.width then return nil, 'Bad header' end channels = channels or desc.channels local px_len = desc.width * desc.height * channels local pixels = ffi.new('unsigned char[?]', px_len) local ch4pixels = ffi.cast('qoi_rgba_t*', pixels) if pixels == nil then return nil, 'Unable to allocate' end local index = ffi.new('qoi_rgba_t[?]', 64) local px = ffi.new('qoi_rgba_t') px.rgba.r = 0 px.rgba.g = 0 px.rgba.b = 0 px.rgba.a = 255 local chunks_len = size - ffi.sizeof(qoi_padding) local px_pos = 0 while px_pos < px_len do if run > 0 then run = run - 1 elseif p < chunks_len then local b1 = bytes[p]; p = p + 1 if b1 == QOI_OP_RGB then px.rgba.r = bytes[p]; p = p + 1 px.rgba.g = bytes[p]; p = p + 1 px.rgba.b = bytes[p]; p = p + 1 elseif b1 == QOI_OP_RGBA then px.rgba.r = bytes[p]; p = p + 1 px.rgba.g = bytes[p]; p = p + 1 px.rgba.b = bytes[p]; p = p + 1 px.rgba.a = bytes[p]; p = p + 1 elseif band(b1, QOI_MASK_2) == QOI_OP_INDEX then --px = index[b1] ffi.copy(px, index[b1], ffi.sizeof(px)) elseif band(b1, QOI_MASK_2) == QOI_OP_DIFF then px.rgba.r = px.rgba.r + (band(rshift(b1, 4), 0x3) - 2) px.rgba.g = px.rgba.g + (band(rshift(b1, 2), 0x3) - 2) px.rgba.b = px.rgba.b + (band(b1, 0x3) - 2) elseif band(b1, QOI_MASK_2) == QOI_OP_LUMA then local b2 = bytes[p]; p = p + 1 local vg = band(b1, 0x3f) - 32 px.rgba.r = px.rgba.r + vg - 8 + (band(rshift(b2, 4), 0x0f)) px.rgba.g = px.rgba.g + vg px.rgba.b = px.rgba.b + vg - 8 + (band(b2, 0x0f)) elseif band(b1, QOI_MASK_2) == QOI_OP_RUN then run = band(b1, 0x3f) end local hash = color_hash(px) % 64 ffi.copy(index[hash], px, ffi.sizeof(px)) end if channels == 4 then ch4pixels[px_pos/4] = px else pixels[px_pos + 0] = px.rgba.r pixels[px_pos + 1] = px.rgba.g pixels[px_pos + 2] = px.rgba.b end px_pos = px_pos + channels end return pixels, desc end local function qoi_write(filename, data, desc) if type(desc) == 'table' then desc = qoi_desc(desc) end local f = io.open(filename, 'wb') if f == nil then return nil, 'Unable to open file' end local encoded, len = qoi_encode(data, desc) if encoded == nil then f:close() return nil, 'Unable to encode data' end local str = ffi.string(encoded, len) f:write(str) f:close() return len end local function qoi_read(filename, channels) if type(desc) == 'table' then desc = qoi_desc(desc) end local f = io.open(filename, "rb") if f == nil then return nil, 'Unable to open file' end local data = f:read("*all") f:close() local len = string.len(data) local bytes = ffi.cast("const unsigned char*", data) local pixels, desc = qoi_decode(bytes, len, channels) return pixels, desc end return { read = qoi_read, write = qoi_write, decode = qoi_decode, encode = qoi_encode, SRGB = QOI_SRGB, LINEAR = QOI_LINEAR }
-- @module gamecenter -- @group Services -- @brief The Game Center integration. -- @brief The listeners. local listeners = {} -- @brief Indicates if the player has been authenticated. local authenticatedFlag -- @brief Indicates if the login view is visible. local loginViewVisibleFlag -- @brief Indicates if the achievements have been loaded. local achievementsLoadedFlag -- @brief Notifies all the listeners. -- @param funcName The name of the function to call. local function notifyListeners(funcName) for _,listener in ipairs(listeners) do if listener[funcName] then listener[funcName]() end end end -- @brief Called when the login view is about to be shown. -- Never call this function directly. function gamecenter.willShowLoginView() ae.log.trace('gamecenter.willShowLoginView()') loginViewVisibleFlag = true notifyListeners('willShowLoginView') end -- @brief Called when the local player has been authenticated. -- Never call this function directly. function gamecenter.authenticated() ae.log.trace('gamecenter.authenticated()') authenticatedFlag = true notifyListeners('authenticated') gamecenter.loginViewHidden() end -- @brief Called when the local player has not been authenticated. -- Never call this function directly. function gamecenter.notAuthenticated() ae.log.trace('gamecenter.notAuthenticated()') notifyListeners('notAuthenticated') gamecenter.loginViewHidden() end -- @brief Called when the local player has not been authenticated -- due to an error. Never call this function directly. function gamecenter.notAuthenticatedWithError() gamecenter.notAuthenticated() end -- @brief Called when the login view has been hidden. -- Never call this function directly. function gamecenter.loginViewHidden() ae.log.trace('gamecenter.loginViewHidden()') loginViewVisibleFlag = false notifyListeners('loginViewHidden') end -- @brief Called when the achievements have been loaded (retrieved from -- the server). Never call this function directly. function gamecenter.achievementsLoaded() ae.log.trace('gamecenter.achievementsLoaded()') achievementsLoadedFlag = true notifyListeners('achievementsLoaded') end -- @brief Adds a listener. -- @param listener The listener. function gamecenter.addListener(listener) ae.itable.append(listeners,listener) end -- @brief Checks if the login view is visible. -- @return `true` if visible, `false` otherwise. function gamecenter.isLoginViewVisible() return loginViewVisibleFlag end -- @brief Checks if the player has been authenticated. -- @return `true` if authenticated, `false` otherwise. function gamecenter.isAuthenticated() return authenticatedFlag end -- @brief Checks if the achievements have been loaded. -- @return `true` if loaded, `false` otherwise. function gamecenter.areAchievementsLoaded() return achievementsLoadedFlag end
--setBufferName("recording09.lua") --print2(inspect(recorder.notes)) recorder.notes = { { frame = 96, midi = { 144, 72, 73 } }, { frame = 114, midi = { 144, 79, 76 } }, { frame = 115, midi = { 128, 72, 64 } }, { frame = 117, midi = { 128, 79, 64 } }, { frame = 131, midi = { 144, 74, 84 } }, { frame = 136, midi = { 128, 74, 64 } }, { frame = 148, midi = { 144, 77, 55 } }, { frame = 153, midi = { 144, 75, 80 } }, { frame = 154, midi = { 128, 77, 64 } }, { frame = 157, midi = { 144, 74, 65 } }, { frame = 158, midi = { 128, 75, 64 } }, { frame = 161, midi = { 144, 75, 92 } }, { frame = 162, midi = { 128, 74, 64 } }, { frame = 164, midi = { 144, 48, 41 } }, { frame = 174, midi = { 128, 75, 64 } }, { frame = 177, midi = { 128, 48, 64 } }, { frame = 181, midi = { 144, 55, 50 } }, { frame = 184, midi = { 128, 55, 64 } }, { frame = 186, midi = { 144, 75, 60 } }, { frame = 190, midi = { 144, 74, 51 } }, { frame = 191, midi = { 128, 75, 64 } }, { frame = 194, midi = { 128, 74, 64 } }, { frame = 194, midi = { 144, 72, 61 } }, { frame = 199, midi = { 144, 71, 70 } }, { frame = 199, midi = { 144, 50, 46 } }, { frame = 201, midi = { 128, 72, 64 } }, { frame = 203, midi = { 128, 50, 64 } }, { frame = 206, midi = { 128, 71, 64 } }, { frame = 215, midi = { 144, 71, 62 } }, { frame = 217, midi = { 144, 53, 48 } }, { frame = 221, midi = { 128, 53, 64 } }, { frame = 222, midi = { 128, 71, 64 } }, { frame = 223, midi = { 144, 72, 53 } }, { frame = 226, midi = { 128, 72, 64 } }, { frame = 228, midi = { 144, 74, 49 } }, { frame = 231, midi = { 128, 74, 64 } }, { frame = 231, midi = { 144, 72, 41 } }, { frame = 235, midi = { 128, 72, 64 } }, { frame = 236, midi = { 144, 51, 40 } }, { frame = 249, midi = { 144, 72, 74 } }, { frame = 251, midi = { 128, 72, 64 } }, { frame = 252, midi = { 144, 74, 71 } }, { frame = 255, midi = { 128, 74, 64 } }, { frame = 256, midi = { 144, 72, 45 } }, { frame = 259, midi = { 144, 71, 55 } }, { frame = 260, midi = { 128, 72, 64 } }, { frame = 265, midi = { 128, 51, 64 } }, { frame = 266, midi = { 144, 72, 54 } }, { frame = 266, midi = { 128, 71, 64 } }, { frame = 270, midi = { 128, 72, 64 } }, { frame = 274, midi = { 144, 74, 76 } }, { frame = 275, midi = { 144, 47, 71 } }, { frame = 281, midi = { 128, 74, 64 } }, { frame = 292, midi = { 144, 74, 73 } }, { frame = 294, midi = { 128, 74, 64 } }, { frame = 294, midi = { 144, 75, 77 } }, { frame = 297, midi = { 128, 75, 64 } }, { frame = 298, midi = { 144, 74, 52 } }, { frame = 302, midi = { 144, 72, 55 } }, { frame = 303, midi = { 128, 74, 64 } }, { frame = 306, midi = { 128, 72, 64 } }, { frame = 307, midi = { 144, 74, 58 } }, { frame = 311, midi = { 128, 74, 64 } }, { frame = 313, midi = { 144, 48, 51 } }, { frame = 314, midi = { 144, 75, 64 } }, { frame = 314, midi = { 128, 47, 64 } }, { frame = 316, midi = { 128, 75, 64 } }, { frame = 319, midi = { 144, 74, 73 } }, { frame = 320, midi = { 128, 48, 64 } }, { frame = 323, midi = { 128, 74, 64 } }, { frame = 326, midi = { 144, 75, 81 } }, { frame = 329, midi = { 128, 75, 64 } }, { frame = 333, midi = { 144, 77, 73 } }, { frame = 333, midi = { 144, 50, 50 } }, { frame = 339, midi = { 144, 75, 63 } }, { frame = 340, midi = { 128, 77, 64 } }, { frame = 340, midi = { 128, 50, 64 } }, { frame = 344, midi = { 128, 75, 64 } }, { frame = 346, midi = { 144, 77, 51 } }, { frame = 350, midi = { 128, 77, 64 } }, { frame = 352, midi = { 144, 51, 45 } }, { frame = 352, midi = { 144, 79, 71 } }, { frame = 357, midi = { 144, 77, 50 } }, { frame = 358, midi = { 128, 51, 64 } }, { frame = 358, midi = { 128, 79, 64 } }, { frame = 360, midi = { 144, 75, 76 } }, { frame = 360, midi = { 128, 77, 64 } }, { frame = 364, midi = { 144, 74, 68 } }, { frame = 367, midi = { 128, 75, 64 } }, { frame = 369, midi = { 144, 72, 63 } }, { frame = 370, midi = { 128, 74, 64 } }, { frame = 370, midi = { 144, 53, 46 } }, { frame = 374, midi = { 128, 53, 64 } }, { frame = 375, midi = { 128, 72, 64 } }, { frame = 375, midi = { 144, 74, 53 } }, { frame = 382, midi = { 128, 74, 64 } }, { frame = 382, midi = { 144, 72, 61 } }, { frame = 388, midi = { 128, 72, 64 } }, { frame = 391, midi = { 144, 55, 48 } }, { frame = 391, midi = { 144, 72, 55 } }, { frame = 395, midi = { 128, 72, 64 } }, { frame = 395, midi = { 144, 71, 71 } }, { frame = 398, midi = { 144, 72, 84 } }, { frame = 400, midi = { 128, 71, 64 } }, { frame = 401, midi = { 128, 72, 64 } }, { frame = 402, midi = { 144, 71, 62 } }, { frame = 405, midi = { 144, 69, 59 } }, { frame = 406, midi = { 128, 71, 64 } }, { frame = 412, midi = { 128, 69, 64 } }, { frame = 412, midi = { 144, 71, 52 } }, { frame = 416, midi = { 128, 71, 64 } }, { frame = 419, midi = { 144, 72, 64 } }, { frame = 422, midi = { 128, 72, 64 } }, { frame = 426, midi = { 144, 74, 84 } }, { frame = 429, midi = { 128, 74, 64 } }, { frame = 433, midi = { 144, 67, 81 } }, { frame = 447, midi = { 128, 55, 64 } }, { frame = 452, midi = { 144, 55, 60 } }, { frame = 460, midi = { 144, 57, 58 } }, { frame = 461, midi = { 128, 55, 64 } }, { frame = 468, midi = { 128, 57, 64 } }, { frame = 469, midi = { 144, 59, 50 } }, { frame = 474, midi = { 128, 67, 64 } }, { frame = 475, midi = { 128, 59, 64 } }, { frame = 475, midi = { 144, 60, 79 } }, { frame = 493, midi = { 144, 67, 78 } }, { frame = 497, midi = { 128, 67, 64 } }, { frame = 500, midi = { 144, 69, 76 } }, { frame = 505, midi = { 128, 69, 64 } }, { frame = 507, midi = { 144, 71, 63 } }, { frame = 510, midi = { 128, 71, 64 } }, { frame = 514, midi = { 144, 72, 50 } }, { frame = 517, midi = { 128, 72, 64 } }, { frame = 519, midi = { 144, 67, 63 } }, { frame = 525, midi = { 128, 67, 64 } }, { frame = 526, midi = { 144, 72, 56 } }, { frame = 529, midi = { 128, 72, 64 } }, { frame = 533, midi = { 144, 59, 48 } }, { frame = 533, midi = { 144, 74, 63 } }, { frame = 533, midi = { 128, 60, 64 } }, { frame = 536, midi = { 128, 74, 64 } }, { frame = 538, midi = { 128, 59, 64 } }, { frame = 539, midi = { 144, 67, 60 } }, { frame = 543, midi = { 128, 67, 64 } }, { frame = 545, midi = { 144, 74, 56 } }, { frame = 549, midi = { 128, 74, 64 } }, { frame = 554, midi = { 144, 60, 50 } }, { frame = 554, midi = { 144, 75, 67 } }, { frame = 559, midi = { 128, 60, 64 } }, { frame = 560, midi = { 128, 75, 64 } }, { frame = 561, midi = { 144, 67, 71 } }, { frame = 567, midi = { 128, 67, 64 } }, { frame = 568, midi = { 144, 75, 72 } }, { frame = 571, midi = { 128, 75, 64 } }, { frame = 576, midi = { 144, 62, 44 } }, { frame = 576, midi = { 144, 77, 74 } }, { frame = 580, midi = { 128, 62, 64 } }, { frame = 582, midi = { 128, 77, 64 } }, { frame = 582, midi = { 144, 67, 64 } }, { frame = 588, midi = { 128, 67, 64 } }, { frame = 589, midi = { 144, 77, 52 } }, { frame = 593, midi = { 128, 77, 64 } }, { frame = 596, midi = { 144, 63, 53 } }, { frame = 596, midi = { 144, 79, 84 } }, { frame = 604, midi = { 144, 77, 63 } }, { frame = 606, midi = { 128, 79, 64 } }, { frame = 607, midi = { 144, 75, 79 } }, { frame = 607, midi = { 128, 77, 64 } }, { frame = 610, midi = { 144, 74, 70 } }, { frame = 614, midi = { 128, 75, 64 } }, { frame = 614, midi = { 144, 72, 67 } }, { frame = 616, midi = { 144, 65, 61 } }, { frame = 616, midi = { 128, 74, 64 } }, { frame = 617, midi = { 128, 63, 64 } }, { frame = 622, midi = { 144, 74, 55 } }, { frame = 622, midi = { 128, 72, 64 } }, { frame = 629, midi = { 144, 72, 71 } }, { frame = 629, midi = { 128, 74, 64 } }, { frame = 634, midi = { 128, 72, 64 } }, { frame = 636, midi = { 144, 67, 55 } }, { frame = 636, midi = { 144, 72, 58 } }, { frame = 637, midi = { 128, 65, 64 } }, { frame = 641, midi = { 144, 71, 73 } }, { frame = 642, midi = { 128, 72, 64 } }, { frame = 645, midi = { 144, 72, 71 } }, { frame = 646, midi = { 128, 71, 64 } }, { frame = 647, midi = { 128, 72, 64 } }, { frame = 648, midi = { 144, 71, 70 } }, { frame = 651, midi = { 144, 69, 61 } }, { frame = 651, midi = { 128, 71, 64 } }, { frame = 657, midi = { 128, 69, 64 } }, { frame = 658, midi = { 144, 71, 65 } }, { frame = 662, midi = { 128, 71, 64 } }, { frame = 665, midi = { 144, 72, 62 } }, { frame = 669, midi = { 128, 72, 64 } }, { frame = 671, midi = { 144, 71, 60 } }, { frame = 675, midi = { 128, 71, 64 } }, { frame = 679, midi = { 144, 72, 39 } }, { frame = 683, midi = { 128, 72, 64 } }, { frame = 686, midi = { 144, 74, 74 } }, { frame = 695, midi = { 128, 67, 64 } }, { frame = 706, midi = { 128, 74, 64 } }, { frame = 708, midi = { 144, 71, 70 } }, { frame = 708, midi = { 144, 67, 66 } }, { frame = 713, midi = { 128, 71, 64 } }, { frame = 715, midi = { 144, 69, 68 } }, { frame = 715, midi = { 128, 67, 64 } }, { frame = 721, midi = { 128, 69, 64 } }, { frame = 722, midi = { 144, 71, 65 } }, { frame = 725, midi = { 128, 71, 64 } }, { frame = 729, midi = { 144, 68, 77 } }, { frame = 729, midi = { 144, 72, 61 } }, { frame = 733, midi = { 128, 68, 64 } }, { frame = 734, midi = { 128, 72, 64 } }, { frame = 734, midi = { 144, 71, 56 } }, { frame = 740, midi = { 128, 71, 64 } }, { frame = 741, midi = { 144, 72, 57 } }, { frame = 745, midi = { 128, 72, 64 } }, { frame = 748, midi = { 144, 67, 65 } }, { frame = 749, midi = { 144, 74, 67 } }, { frame = 753, midi = { 128, 67, 64 } }, { frame = 754, midi = { 128, 74, 64 } }, { frame = 754, midi = { 144, 72, 53 } }, { frame = 761, midi = { 144, 74, 66 } }, { frame = 762, midi = { 128, 72, 64 } }, { frame = 766, midi = { 128, 74, 64 } }, { frame = 769, midi = { 144, 65, 51 } }, { frame = 769, midi = { 144, 75, 75 } }, { frame = 772, midi = { 128, 65, 64 } }, { frame = 775, midi = { 144, 74, 45 } }, { frame = 776, midi = { 128, 75, 64 } }, { frame = 781, midi = { 128, 74, 64 } }, { frame = 782, midi = { 144, 75, 49 } }, { frame = 787, midi = { 128, 75, 64 } }, { frame = 789, midi = { 144, 77, 65 } }, { frame = 790, midi = { 144, 63, 39 } }, { frame = 795, midi = { 128, 77, 64 } }, { frame = 796, midi = { 144, 75, 70 } }, { frame = 801, midi = { 128, 75, 64 } }, { frame = 802, midi = { 144, 77, 62 } }, { frame = 807, midi = { 128, 77, 64 } }, { frame = 809, midi = { 144, 79, 63 } }, { frame = 814, midi = { 144, 77, 55 } }, { frame = 815, midi = { 128, 79, 64 } }, { frame = 820, midi = { 144, 79, 61 } }, { frame = 821, midi = { 128, 77, 64 } }, { frame = 826, midi = { 128, 79, 64 } }, { frame = 828, midi = { 144, 80, 83 } }, { frame = 828, midi = { 128, 63, 64 } }, { frame = 829, midi = { 144, 62, 51 } }, { frame = 855, midi = { 128, 62, 64 } }, { frame = 859, midi = { 144, 60, 49 } }, { frame = 865, midi = { 144, 59, 59 } }, { frame = 865, midi = { 128, 60, 64 } }, { frame = 872, midi = { 144, 60, 58 } }, { frame = 872, midi = { 128, 59, 64 } }, { frame = 877, midi = { 144, 62, 64 } }, { frame = 878, midi = { 128, 60, 64 } }, { frame = 885, midi = { 128, 62, 64 } }, { frame = 885, midi = { 144, 63, 72 } }, { frame = 892, midi = { 144, 65, 64 } }, { frame = 892, midi = { 128, 63, 64 } }, { frame = 899, midi = { 128, 80, 64 } }, { frame = 899, midi = { 144, 67, 68 } }, { frame = 899, midi = { 128, 65, 64 } }, { frame = 905, midi = { 128, 67, 64 } }, { frame = 906, midi = { 144, 68, 82 } }, { frame = 906, midi = { 144, 80, 85 } }, { frame = 911, midi = { 128, 80, 64 } }, { frame = 911, midi = { 144, 79, 64 } }, { frame = 915, midi = { 144, 80, 84 } }, { frame = 916, midi = { 128, 79, 64 } }, { frame = 920, midi = { 144, 79, 71 } }, { frame = 920, midi = { 128, 80, 64 } }, { frame = 921, midi = { 144, 77, 76 } }, { frame = 922, midi = { 128, 79, 64 } }, { frame = 929, midi = { 128, 77, 64 } }, { frame = 929, midi = { 144, 75, 76 } }, { frame = 935, midi = { 128, 75, 64 } }, { frame = 937, midi = { 144, 74, 66 } }, { frame = 941, midi = { 128, 74, 64 } }, { frame = 943, midi = { 144, 72, 76 } }, { frame = 948, midi = { 128, 72, 64 } }, { frame = 951, midi = { 144, 67, 54 } }, { frame = 951, midi = { 128, 68, 64 } }, { frame = 951, midi = { 144, 72, 56 } }, { frame = 957, midi = { 144, 71, 71 } }, { frame = 957, midi = { 128, 72, 64 } }, { frame = 960, midi = { 144, 72, 86 } }, { frame = 961, midi = { 128, 71, 64 } }, { frame = 962, midi = { 128, 72, 64 } }, { frame = 963, midi = { 144, 71, 66 } }, { frame = 969, midi = { 144, 69, 61 } }, { frame = 969, midi = { 128, 71, 64 } }, { frame = 973, midi = { 128, 69, 64 } }, { frame = 980, midi = { 144, 71, 73 } }, { frame = 981, midi = { 128, 67, 64 } }, { frame = 982, midi = { 144, 55, 54 } }, { frame = 985, midi = { 128, 71, 64 } }, { frame = 989, midi = { 144, 72, 69 } }, { frame = 993, midi = { 128, 72, 64 } }, { frame = 999, midi = { 144, 74, 74 } }, { frame = 1002, midi = { 128, 74, 64 } }, { frame = 1014, midi = { 144, 72, 63 } }, { frame = 1014, midi = { 144, 60, 58 } }, { frame = 1015, midi = { 128, 55, 64 } }, { frame = 1017, midi = { 128, 72, 64 } }, { frame = 1017, midi = { 144, 74, 65 } }, { frame = 1019, midi = { 128, 74, 64 } }, { frame = 1020, midi = { 144, 72, 65 } }, { frame = 1024, midi = { 144, 71, 70 } }, { frame = 1025, midi = { 128, 72, 64 } }, { frame = 1029, midi = { 128, 71, 64 } }, { frame = 1033, midi = { 144, 72, 76 } }, { frame = 1038, midi = { 128, 72, 64 } }, { frame = 1041, midi = { 144, 74, 71 } }, { frame = 1041, midi = { 144, 55, 64 } }, { frame = 1046, midi = { 128, 74, 64 } }, { frame = 1047, midi = { 128, 55, 64 } }, { frame = 1047, midi = { 144, 75, 79 } }, { frame = 1052, midi = { 128, 75, 64 } }, { frame = 1055, midi = { 144, 77, 74 } }, { frame = 1059, midi = { 128, 77, 64 } }, { frame = 1063, midi = { 144, 79, 74 } }, { frame = 1064, midi = { 144, 51, 41 } }, { frame = 1067, midi = { 128, 51, 64 } }, { frame = 1069, midi = { 128, 79, 64 } }, { frame = 1070, midi = { 144, 80, 59 } }, { frame = 1075, midi = { 128, 80, 64 } }, { frame = 1077, midi = { 144, 79, 53 } }, { frame = 1083, midi = { 128, 79, 64 } }, { frame = 1084, midi = { 144, 77, 58 } }, { frame = 1085, midi = { 144, 50, 47 } }, { frame = 1089, midi = { 128, 50, 64 } }, { frame = 1092, midi = { 128, 77, 64 } }, { frame = 1093, midi = { 144, 79, 60 } }, { frame = 1100, midi = { 144, 77, 74 } }, { frame = 1102, midi = { 128, 79, 64 } }, { frame = 1105, midi = { 128, 77, 64 } }, { frame = 1109, midi = { 144, 48, 45 } }, { frame = 1110, midi = { 144, 75, 80 } }, { frame = 1119, midi = { 128, 75, 64 } }, { frame = 1123, midi = { 144, 79, 65 } }, { frame = 1130, midi = { 128, 79, 64 } }, { frame = 1130, midi = { 144, 75, 75 } }, { frame = 1136, midi = { 128, 75, 64 } }, { frame = 1141, midi = { 144, 74, 76 } }, { frame = 1146, midi = { 128, 74, 64 } }, { frame = 1150, midi = { 144, 79, 65 } }, { frame = 1153, midi = { 128, 79, 64 } }, { frame = 1160, midi = { 144, 74, 65 } }, { frame = 1166, midi = { 128, 74, 64 } }, { frame = 1174, midi = { 144, 72, 73 } }, { frame = 1179, midi = { 128, 72, 64 } }, { frame = 1180, midi = { 144, 74, 67 } }, { frame = 1183, midi = { 144, 75, 85 } }, { frame = 1183, midi = { 128, 74, 64 } }, { frame = 1187, midi = { 128, 75, 64 } }, { frame = 1187, midi = { 144, 74, 76 } }, { frame = 1191, midi = { 144, 72, 74 } }, { frame = 1192, midi = { 128, 74, 64 } }, { frame = 1196, midi = { 144, 71, 76 } }, { frame = 1197, midi = { 128, 72, 64 } }, { frame = 1202, midi = { 128, 71, 64 } }, { frame = 1208, midi = { 144, 68, 82 } }, { frame = 1213, midi = { 128, 68, 64 } }, { frame = 1220, midi = { 144, 67, 71 } }, { frame = 1224, midi = { 128, 60, 64 } }, { frame = 1225, midi = { 128, 67, 64 } }, { frame = 1234, midi = { 144, 65, 62 } }, { frame = 1238, midi = { 128, 48, 64 } }, { frame = 1241, midi = { 128, 65, 64 } }, { frame = 1255, midi = { 144, 48, 59 } }, { frame = 1255, midi = { 144, 36, 66 } }, { frame = 1255, midi = { 144, 64, 55 } }, { frame = 1256, midi = { 144, 67, 58 } }, { frame = 1256, midi = { 144, 72, 60 } }, { frame = 1357, midi = { 128, 36, 64 } }, { frame = 1357, midi = { 128, 64, 64 } }, { frame = 1357, midi = { 128, 67, 64 } }, { frame = 1358, midi = { 128, 72, 64 } }, { frame = 1359, midi = { 128, 48, 64 } } }
local wrapper = require("core.lib.wrapper") local Combat = wrapper.loadBundleScript("lib/Combat"); local CombatErrors = wrapper.loadBundleScript("lib/CombatErrors"); local B = require("core.Broadcast") local Logger = require("core.Logger") return { usage = "consider <target>", command = function(state) return function(self, args, player) if not args or #args < 1 then return B.sayAt(player, "Who do you want to size up for a fight?"); end local target local ok, e = xpcall(function() target = Combat.findCombatant(player, args) end, debug.traceback) if not ok then if e == CombatErrors.CombatSelfError or e == CombatErrors.CombatNonPvpError or e == CombatErrors.CombatInvalidTargetError or e == CombatErrors.CombatPacifistError then return B.sayAt(player, tostring(e)) end Logger.error(e) end if not target then return B.sayAt(player, "They aren't here."); end local description = ""; local levelDiff = player.level - target.level if levelDiff > 4 then description = "They are much weaker than you. You would have no trouble dealing with a few of them at once."; elseif levelDiff > 9 then description = "They are <b>much</b> stronger than you. They will kill you and it will hurt the whole time you're dying."; elseif levelDiff > 5 then description = "They are quite a bit more powerful than you. You would need to get lucky to defeat them."; elseif levelDiff > 3 then description = "They are a bit stronger than you. You may survive but it would be hard won."; else description = "You are nearly evenly matched. You should be wary fighting more than one at a time."; end B.sayAt(player, description); end end, };
$file "demo.lua" $line 1 -- -- $Id: mips.lua 3 2006-04-29 13:17:19Z lindig $ -- -- Sample Generator for Quest. R = Rand Mips = {} Mips.members = R.choose(1,4) -- for structs, unions Mips.argc = R.choose(1,8) Mips.vargc = R.oneof { R.unit(0), R.choose(1,4) } -- vargv length Mips.simple = ANSI.simple Mips.simple_varg = ANSI.simple_varg Mips.array_size = R.freq { 2, R.unit(1) , 1, R.unit(2) , 1, R.unit(3) } -- -- argument -- regular function argument function Mips.arg_ (issimple) if issimple then return Mips.simple else return R.smaller{ R.freq { 2, R.any_int , 2, R.any_float , 1, R.pointer(Mips.arg) , 1, R.array(Mips.arg,Mips.array_size) , 3, R.struct(R.list(Mips.members,Mips.arg)) , 3, R.union (R.list(Mips.members,Mips.arg)) }} end end Mips.arg = R.bind(R.iszero,Mips.arg_) -- var arg -- -- a var arg must not be smaller than an int or a double, according to -- the ANSI C specification. I am not sure, but unsigned simple values, -- are prohibited, too. However, all these types are allowed as part of -- complex types. Mips.small = R.oneof -- illegal types for varargs { R.char , R.unsigned(R.char) , R.short , R.unsigned(R.short) , R.float } Mips.big = R.oneof { R.int , R.unsigned(R.int) , R.long , R.unsigned(R.long) , R.longlong , R.unsigned(R.longlong) , R.double } function Mips.varg_ (issimple) if issimple then return Mips.big else return R.smaller { Mips.big , R.pointer(Mips.arg) , R.struct(R.list(Mips.members,Mips.arg)) , R.union (R.list(Mips.members,Mips.arg)) } end end Mips.varg = R.bind(R.iszero,Mips.varg_) -- result type -- no arrays, because this would be illegal in C function Mips.result_ (issimple) if issimple then return Mips.simple else return R.smaller { R.any_int , R.any_float , R.pointer(Mips.result) , R.struct(R.list(Mips.members,Mips.arg)) , R.union (R.list(Mips.members,Mips.arg)) } end end Mips.result = R.bind(R.iszero,Mips.result_) -- -- This function assembles the different generators into one table -- and returns it. Because it is a function we can change the values of -- global variables (like Mips.argc) from the command line before the -- function is evaluated. -- function Mips.test () return { args = R.list(Mips.argc,Mips.arg) , varargs = R.list(Mips.vargc,Mips.varg) , result = Mips.result , static = R.flip } end -- -- The following assignment makes the new generator visible -- for the -list and -test command line options and hence registers the -- new generator. Test.mips = { doc = "ANSI C, tuned for MIPS" , test = Mips.test }
--[[ -- -- Copyright (c) 2013-2017 Wilson Kazuo Mizutani -- -- 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 -- --]] --- LUX's terminal utility module. -- -- <p> -- The terminal output functions take strings with formatted colors as -- arguments. That means sush string may have a color tag. There are three types -- of color tags: attributes, foreground and background colors. Tags must be -- given between <code> < </code>and<code> ></code>. Once used, a tag remains -- active in the terminal, until some other tag overwrites it. Note that the -- color tag remains active even after the program has finished. -- </p> -- -- <p>Atribute tags:</p> -- <ul> -- <li><code>reset</code></li> -- <li><code>clear</code></li> -- <li><code>bright</code></li> -- <li><code>dim</code></li> -- <li><code>underscore</code></li> -- <li><code>blink</code></li> -- <li><code>reverse</code></li> -- <li><code>hidden</code></li> -- </ul> -- -- <p>Foreground color tags:</p> -- <ul> -- <li><code>black</code></li> -- <li><code>red</code></li> -- <li><code>green</code></li> -- <li><code>yellow</code></li> -- <li><code>blue</code></li> -- <li><code>magenta</code></li> -- <li><code>cyan</code></li> -- <li><code>white</code></li> -- </ul> -- -- <p>Background color tags:</p> -- <ul> -- <li><code>onblack</code></li> -- <li><code>onred</code></li> -- <li><code>ongreen</code></li> -- <li><code>onyellow</code></li> -- <li><code>onblue</code></li> -- <li><code>onmagenta</code></li> -- <li><code>oncyan</code></li> -- <li><code>onwhite</code></li> -- </ul> -- @module lux.color local terminal = {} local color = require "lux.term.ansicolors" local tostring = tostring local gsub = string.gsub local io = io local function formatColor (str) return gsub( str, "<(%a+)>", function (tag) local colorcode = color[tag] return colorcode and tostring(colorcode) or "<"..tag..">" end ) end --- Print a line with formatted colors. -- @param text A string possibly containing color tags. function terminal.line (text) terminal.write(text.."\n") end --- Writes to the standard output with formatted colors. -- @param text A string possibly containing color tags. function terminal.write (text) -- used to throw out extra returned values local output = formatColor(text) io.write(output) end return terminal
local lpack = require 'lpack' local schar = string.char local tunpack = _G.unpack or table.unpack for k, v in pairs(lpack) do string[k] = v end local TYPE = { NIL = 'N', TRUE = 'T', FALSE = 'F', INT0 = '0', INT = 'I', FLOAT0 = '.', FLOAT = '*', STRING = 'S', TABLES = '{', TABLEF = '}', UNIT = 'U', POINT = 'P', FUNCTION = 'C', } local encodeValue, decodeValue local function encodeBoolean(buf, b) if b then buf[#buf+1] = TYPE.TRUE else buf[#buf+1] = TYPE.FALSE end end local function encodeNil(buf, b) buf[#buf+1] = TYPE.NIL end local function isInteger(n) return n % 1 == 0 end local function encodeNumber(buf, n) if isInteger(n) == 'integer' then if n == 0 then buf[#buf+1] = TYPE.INT0 return end buf[#buf+1] = ('c1i4'):pack(TYPE.INT, n) else if n == 0.0 then buf[#buf+1] = TYPE.FLOAT0 return end buf[#buf+1] = ('c1f'):pack(TYPE.FLOAT, n) end end local function encodeString(buf, s) buf[#buf+1] = ('c1s2'):pack(TYPE.STRING, s) end local function encodeTable(buf, t) buf[#buf+1] = TYPE.TABLES for k, v in next, t do encodeValue(buf, k) encodeValue(buf, v) end buf[#buf+1] = TYPE.TABLEF end local function encodeFunction(buf, f) for i = 1, 100 do local name = debug.getupvalue(f, i) if not name then break end if name ~= '_ENV' then error('传递函数不能包含任何上值:' .. name) return end end local stream = string.dump(f) buf[#buf+1] = ('c1s2'):pack(TYPE.FUNCTION, stream) end function encodeValue(buf, o) local tp = type(o) if tp == 'boolean' then encodeBoolean(buf, o) elseif tp == 'nil' then encodeNil(buf, o) elseif tp == 'number' then encodeNumber(buf, o) elseif tp == 'string' then encodeString(buf, o) elseif tp == 'table' then encodeTable(buf, o) elseif tp == 'function' then encodeFunction(buf, o) end end function decodeValue(stream, index) local ot = stream:sub(index, index) index = index + 1 if ot == TYPE.TRUE then return true, index elseif ot == TYPE.FALSE then return false, index elseif ot == TYPE.NIL then return nil, index elseif ot == TYPE.INT0 then return 0, index elseif ot == TYPE.INT then return ('i4'):unpack(stream, index) elseif ot == TYPE.FLOAT0 then return 0.0, index elseif ot == TYPE.FLOAT then return ('f'):unpack(stream, index) elseif ot == TYPE.STRING then return ('s2'):unpack(stream, index) elseif ot == TYPE.TABLES then local t = {} local k, v while stream:sub(index, index) ~= TYPE.TABLEF do k, index = decodeValue(stream, index) v, index = decodeValue(stream, index) if k ~= nil then t[k] = v end end return t, index + 1 elseif ot == TYPE.FUNCTION then local dump dump, index = ('s2'):unpack(stream, index) local f, err = load(dump, dump, 'b') if not f then error(err) end return f, index else error('未知的类型:' .. tostring(ot)) end end local function revert(stream, n) local t = {stream:byte(1, -1)} for i = 1, #t do t[i] = (t[i] + n * i) % 256 end return schar(tunpack(t)) end local function encode(o) local buf = {} encodeValue(buf, o) local stream = table.concat(buf) -- 翻转全部字节 stream = revert(stream, 131) return stream end local function decode(stream) -- 翻转全部字节 stream = revert(stream, -131) return decodeValue(stream, 1) end return { encode = encode, decode = decode, }
ITEM.name = ".22LR" ITEM.model = "models/lostsignalproject/items/ammo/9x19.mdl" ITEM.ammo = ".22LR" // type of the ammo ITEM.ammoAmount = 60 // amount of the ammo ITEM.description = "" ITEM.quantdesc = "A box that contains %s rounds of .22LR ammo. " ITEM.longdesc = "This small .22LR round is primarily used for pest control, but also sports shooting and entry-level shooting." ITEM.price = 450 ITEM.busflag = {"ammo"} ITEM.img = ix.util.GetMaterial("cotz/icons/ammo/ammo_short_11_3.png") ITEM.weight = 0.0025 ITEM.flatweight = 0.05 function ITEM:GetWeight() return self.flatweight + (self.weight * self:GetData("quantity", self.ammoAmount)) end
--[[********************************** * * Multi Theft Auto - Admin Panel * * client\main\admin_bans.lua * * Original File by lil_Toady * **************************************]] aBansTab = { List = {} } function aBansTab.Create(tab) aBansTab.Tab = tab aBansTab.BansListSearch = guiCreateEdit(0.01, 0.02, 0.3, 0.04, "", true, aBansTab.Tab) guiCreateInnerImage("client\\images\\search.png", aBansTab.BansListSearch) guiHandleInput(aBansTab.BansListSearch) aBansTab.BansList = guiCreateGridList(0.01, 0.07, 0.80, 0.91, true, aBansTab.Tab) guiGridListAddColumn(aBansTab.BansList, "Name", 0.22) guiGridListAddColumn(aBansTab.BansList, "IP", 0.25) guiGridListAddColumn(aBansTab.BansList, "Serial", 0.25) guiGridListAddColumn(aBansTab.BansList, "Username", 0.25) guiGridListAddColumn(aBansTab.BansList, "Date", 0.17) guiGridListAddColumn(aBansTab.BansList, "Banned by", 0.22) guiGridListAddColumn(aBansTab.BansList, "Temporary", 0.22) aBansTab.Details = guiCreateButton(0.82, 0.07, 0.17, 0.04, "Details", true, aBansTab.Tab) aBansTab.Unban = guiCreateButton(0.82, 0.12, 0.17, 0.04, "Unban", true, aBansTab.Tab, "unban") aBansTab.BansRefresh = guiCreateButton(0.82, 0.94, 0.17, 0.04, "Refresh", true, aBansTab.Tab, "listbans") addEventHandler("onClientGUIChanged", aBansTab.BansListSearch, aBansTab.onBansListSearch) addEventHandler("onClientGUIClick", aBansTab.Tab, aBansTab.onClientClick) addEventHandler(EVENT_SYNC, root, aBansTab.onClientSync) guiGridListClear(aBansTab.BansList) sync(SYNC_BANS) end function aBansTab.onClientClick(button) if (button == "left") then if (source == aBansTab.Details) then if (guiGridListGetSelectedItem(aBansTab.BansList) == -1) then messageBox("No ban row selected!", MB_ERROR, MB_OK) else local ip = guiGridListGetItemText(aBansTab.BansList, guiGridListGetSelectedItem(aBansTab.BansList), 2) aBanDetails(ip) end elseif (source == aBansTab.Unban) then if (guiGridListGetSelectedItem(aBansTab.BansList) == -1) then messageBox("No ban row selected!", MB_ERROR, MB_OK) else local selected = guiGridListGetItemText(aBansTab.BansList, guiGridListGetSelectedItem(aBansTab.BansList), 2) if (aBans["Serial"][selected]) then if (messageBox("Unban Serial " .. selected .. "?", MB_QUESTION, MB_YESNO ) == true) then triggerServerEvent ( "aBans", localPlayer, "unbanserial", selected ) end else if (messageBox("Unban IP " .. selected .. "?", MB_QUESTION, MB_YESNO) == true) then triggerServerEvent ( "aBans", localPlayer, "unbanip", selected ) end end end elseif (source == aBansTab.BansRefresh) then guiGridListClear(aBansTab.BansList) sync(SYNC_BANS) end end end function aBansTab.onBansListSearch() guiGridListClear(aBansTab.BansList) local text = string.upper(guiGetText(source)) if (text == "") then aBansTab.Refresh() else for id, ban in pairs(aBansTab.List) do if ((ban.nick and string.find(string.upper(ban.nick), text)) or (ban.ip and string.find(string.upper(ban.ip), text)) or (ban.serial and string.find(string.upper(ban.serial), text)) or (ban.username and string.find(string.upper(ban.username), text)) or (ban.banner and string.find(string.upper(ban.banner), text))) then aBansTab.AddRow(id, ban) end end end end function aBansTab.onClientSync(type, data) if (type == SYNC_BANS) then aBansTab.List = data aBansTab.Refresh() elseif (type == SYNC_BAN) then if (data.type == "a") then aBansTab.List[data.id] = data.ban aBansTab.AddRow(data.id, data.ban) elseif (data.type == "d") then aBansTab.List[data.id] = nil aBansTab.DeleteRow(data.id) end end end function aBansTab.Refresh() guiGridListClear(aBansTab.BansList) for id, ban in pairs(aBansTab.List) do aBansTab.AddRow(id, ban) end end function aBansTab.AddRow(id, data) local list = aBansTab.BansList local row = guiGridListAddRow(list) guiGridListSetItemText(list, row, 1, data.nick or "Unknown", false, false) guiGridListSetItemText(list, row, 2, data.ip or "", false, false) guiGridListSetItemText(list, row, 3, data.serial or "", false, false) guiGridListSetItemText(list, row, 4, data.username or "", false, false) if (data.time) then local time = getRealTime(data.time) guiGridListSetItemText( list, row, 5, time.monthday .. " " .. getMonthName(time.month) .. " " .. (1900 + time.year), false, false ) else guiGridListSetItemText(list, row, 5, "", false, false) end guiGridListSetItemText(list, row, 6, data.banner or "", false, false) guiGridListSetItemText(list, row, 7, iif(data.unban, "Yes", "No"), false, false) guiGridListSetItemData(list, row, 1, id) end function aBansTab.DeleteRow(id) local list = aBansTab.BansList for i = 1, guiGridListGetRowCount(list) do local data = guiGridListGetItemData(list, i, 1) if (data == id) then guiGridListRemoveRow(list, i) end end end
EffectEvent = SimpleClass(SkillEvent) function EffectEvent:initialize() end --子类重写 function EffectEvent:doEvent() --print("<color=red>EffectEvent: </color>",self.tickFrame,SkillEventTypeLang[self.type]) end
function VarDump(data) -- cache of tables already printed, to avoid infinite recursive loops local tablecache = {} local buffer = "" local padder = " " local function _dumpvar(d, depth) local t = type(d) local str = tostring(d) if (t == "table") then if (tablecache[str]) then -- table already dumped before, so we dont -- dump it again, just mention it buffer = buffer.."<"..str..">\n" else tablecache[str] = (tablecache[str] or 0) + 1 buffer = buffer.."("..str..") {\n" for k, v in pairs(d) do buffer = buffer..string.rep(padder, depth+1).."["..k.."] => " _dumpvar(v, depth+1) end buffer = buffer..string.rep(padder, depth).."}\n" end elseif (t == "number") then buffer = buffer.."("..t..") "..str.."\n" else buffer = buffer.."("..t..") \""..str.."\"\n" end end _dumpvar(data, 0) return buffer end
local drawableSprite = require("structs.drawable_sprite") local utils = require("utils") local lockBlock = {} local textures = { wood = "objects/door/lockdoor00", temple_a = "objects/door/lockdoorTempleA00", temple_b = "objects/door/lockdoorTempleB00", moon = "objects/door/moonDoor11" } local textureOptions = {} for name, _ in pairs(textures) do textureOptions[utils.humanizeVariableName(name)] = name end lockBlock.name = "lockBlock" lockBlock.depth = 0 lockBlock.justification = {0.25, 0.25} lockBlock.fieldInformation = { sprite = { options = textureOptions, editable = false } } lockBlock.placements = {} for name, texture in pairs(textures) do table.insert(lockBlock.placements, { name = name, data = { sprite = name, unlock_sfx = "", stepMusicProgress = false } }) end function lockBlock.sprite(room, entity) local spriteName = entity.sprite or "wood" local texture = textures[spriteName] or textures["wood"] local sprite = drawableSprite.fromTexture(texture, entity) sprite:addPosition(16, 16) return sprite end return lockBlock
--- For working with inventories. -- @module Inventory -- @usage local Inventory = require('stdlib/entity/inventory') local fail_if_missing = require 'stdlib/game'['fail_if_missing'] Inventory = {} --luacheck: allow defined top --- Copies the contents of source inventory to destination inventory by using @{Concepts.SimpleItemStack}. -- @tparam LuaInventory src the source inventory -- @tparam LuaInventory dest the destination inventory -- @tparam[opt=false] boolean clear clear the contents of the source inventory -- @treturn {Concepts.SimpleItemStack,...} an array of left over items that could not be inserted into the destination function Inventory.copy_as_simple_stacks(src, dest, clear) fail_if_missing(src, "missing source inventory") fail_if_missing(dest, "missing destination inventory") local left_over = {} for i = 1, #src do local stack = src[i] if stack and stack.valid and stack.valid_for_read then local simple_stack = { name = stack.name, count = stack.count, health = stack.health or 1, durability = stack.durability } -- ammo is a special case field, accessing it on non-ammo itemstacks causes an exception simple_stack.ammo = stack.prototype.magazine_size and stack.ammo --Insert simple stack into inventory, add to left_over if not all were inserted. simple_stack.count = simple_stack.count - dest.insert(simple_stack) if simple_stack.count > 0 then table.insert(left_over, simple_stack) end end end if clear then src.clear() end return left_over end -- Remove all items inside an entity and return an array of SimpleItemStacks removed -- @param entity: The entity object to remove items from -- @return table: a table of SimpleItemStacks or nil if empty -- local function get_all_items_inside(entity, existing_stacks) -- local item_stacks = existing_stacks or {} -- --Inserters need to check held_stack -- if entity.type == "inserter" then -- local stack = entity.held_stack -- if stack.valid_for_read then -- item_stacks[#item_stacks+1] = {name=stack.name, count=stack.count, health=stack.health} -- stack.clear() -- end -- --Entities with transport lines only need to check each line individually -- elseif transport_types[entity.type] then -- for i=1, transport_types[entity.type] do -- local lane = entity.get_transport_line(i) -- for name, count in pairs(lane.get_contents()) do -- local cur_stack = {name=name, count=count, health=1} -- item_stacks[#item_stacks+1] = cur_stack -- lane.remove_item(cur_stack) -- end -- end -- else -- --Loop through regular inventories -- for _, inv in pairs(defines.inventory) do -- local inventory = entity.get_inventory(inv) -- if inventory and inventory.valid then -- if inventory.get_item_count() > 0 then -- for i=1, #inventory do -- if inventory[i].valid_for_read then -- local stack = inventory[i] -- item_stacks[#item_stacks+1] = {name=stack.name, count=stack.count, health=stack.health or 1} -- stack.clear() -- end -- end -- end -- end -- end -- end -- return (item_stacks[1] and item_stacks) or {} -- end --- Given a function, apply it to each slot in the given inventory. -- Passes the index of a slot as the second argument to the given function. -- <p>Iteration is aborted if the applied function returns true for any element during iteration. -- @tparam LuaInventory inventory the inventory to iterate -- @tparam function func the function to apply to values -- @param[opt] ... additional arguments passed to the function -- @treturn ?|nil|LuaItemStack the slot where the iteration was aborted **OR** nil if not aborted function Inventory.each(inventory, func, ...) local index for i=1, #inventory do if func(inventory[i], i, ...) then index = i break end end return index and inventory[index] end --- Given a function, apply it to each slot in the given inventory. -- Passes the index of a slot as the second argument to the given function. -- <p>Iteration is aborted if the applied function returns true for any element during iteration. -- <p>Iteration is performed from last to first in order to support dynamically sized inventories. -- @tparam LuaInventory inventory the inventory to iterate -- @tparam function func the function to apply to values -- @param[opt] ... additional arguments passed to the function -- @treturn ?|nil|LuaItemStack the slot where the iteration was aborted **OR** nil if not aborted function Inventory.each_reverse(inventory, func, ...) local index for i=#inventory, 1, -1 do if func(inventory[i], i, ...) then index = i break end end return index and inventory[index] end return Inventory
object_tangible_content_wod_second_sister_fire_3 = object_tangible_content_shared_wod_second_sister_fire_3:new { } ObjectTemplates:addTemplate(object_tangible_content_wod_second_sister_fire_3, "object/tangible/content/wod_second_sister_fire_3.iff")
--女人唱歌男人趴 local m=14010024 local cm=_G["c"..m] function cm.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetOperation(cm.activate) c:RegisterEffect(e1) --Freesia local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(m,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCode(EVENT_PHASE+PHASE_BATTLE) e2:SetTarget(cm.sptg) e2:SetOperation(cm.spop) c:RegisterEffect(e2) --indes local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_SZONE) e3:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e3:SetCountLimit(1) e3:SetValue(cm.valcon) c:RegisterEffect(e3) end function cm.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_MUSIC,0,aux.Stringid(m,1)) end function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local p=Duel.GetTurnPlayer() Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,p,0) end function cm.spfilter(c,e,tp,tid) return c:IsReason(REASON_DESTROY) and c:IsType(TYPE_MONSTER) and c:GetTurnID()==tid and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function cm.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local p=Duel.GetTurnPlayer() local ft=Duel.GetLocationCount(p,LOCATION_MZONE) if ft<1 then return end local g=Duel.GetMatchingGroup(cm.spfilter,p,LOCATION_GRAVE+LOCATION_REMOVED+LOCATION_EXTRA,LOCATION_GRAVE+LOCATION_REMOVED+LOCATION_EXTRA,nil,e,p,Duel.GetTurnCount()) if g:GetCount()>0 then Duel.Hint(HINT_SELECTMSG,p,HINTMSG_SPSUMMON) local cg=g:Select(p,1,1,nil) Duel.HintSelection(cg) Duel.SpecialSummon(cg,0,p,p,false,false,POS_FACEUP) local tc=cg:GetFirst() if tc then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e1,true) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT+RESETS_STANDARD) tc:RegisterEffect(e2,true) end end end function cm.valcon(e,re,r,rp) return bit.band(r,REASON_EFFECT)~=0 end
local PluginRoot = script.Parent.Parent.Parent.Parent local Store = require(PluginRoot.Data.Store) local ResourceImage = require(PluginRoot.Data.Images) local Roact: Roact = require(PluginRoot.Packages.Roact) local ThemeProvider = require(script.Parent.Parent.ThemeProvider) local TabButton = require(script.Parent.TabButton) local TabBar = Roact.Component:extend("TabBar") function TabBar:render() local location = self.state.Location return ThemeProvider.withTheme(function(theme: StudioTheme) return Roact.createElement("Frame", { BackgroundTransparency = 1, BorderSizePixel = 0, Size = UDim2.new(1, 0, 0, 36), ClipsDescendants = true, }, { GridLayout = Roact.createElement("UIGridLayout", { CellPadding = UDim2.new(), CellSize = UDim2.fromScale(.5, 1), FillDirection = Enum.FillDirection.Horizontal, HorizontalAlignment = Enum.HorizontalAlignment.Left, SortOrder = Enum.SortOrder.LayoutOrder, StartCorner = Enum.StartCorner.TopLeft, VerticalAlignment = Enum.VerticalAlignment.Top, }), Recent = Roact.createElement(TabButton, { Label = "Recent", Icon = ResourceImage.TabButtonIcon.Recents, Selected = location == "/recents", LayoutOrder = 100, Clicked = function() Store:GoTo("/recents") end, }), Creations = Roact.createElement(TabButton, { Label = "Creations", Icon = ResourceImage.TabButtonIcon.Creations, Selected = location == "/creations", LayoutOrder = 200, Clicked = function() Store:GoTo("/creations") end, }) }) end) end return Store:Roact(TabBar, { "Location" })
local M = {} local null_ls = require "null-ls" local Log = require "internal.log" local services = require "as.plugins.code.null_ls.services" function M.list_registered_providers(filetype) local null_ls_methods = require "null-ls.methods" local formatter_method = null_ls_methods.internal.FORMATTING local registered_providers = services.list_registered_providers_names( filetype, formatter_method ) if registered_providers ~= nil then return registered_providers else return {} end end function M.list_available(filetype) local formatters = {} local tbl = require "lvim.utils.table" for _, provider in pairs(null_ls.builtins.formatting) do if tbl.contains(provider.filetypes or {}, function(ft) return ft == "*" or ft == filetype end) then table.insert(formatters, provider.name) end end return formatters end M.list_configured = function(formatter_configs) local formatters, errors = {}, {} for _, fmt_config in ipairs(formatter_configs) do local formatter_name = fmt_config.exe:gsub("-", "_") local formatter = null_ls.builtins.formatting[formatter_name] if not formatter then Log:error("Not a valid formatter: " .. fmt_config.exe) errors[fmt_config.exe] = {} -- Add data here when necessary else local formatter_cmd = services.find_command(formatter._opts.command) if not formatter_cmd then Log:warn("Not found: " .. formatter._opts.command) errors[fmt_config.exe] = {} -- Add data here when necessary else Log:debug("Using formatter: " .. formatter_cmd) formatters[fmt_config.exe] = formatter.with { command = formatter_cmd, extra_args = fmt_config.args, filetypes = fmt_config.filetypes, } end end end return { supported = formatters, unsupported = errors } end function M.setup(formatter_configs) if vim.tbl_isempty(formatter_configs) then return end local formatters_by_ft = M.list_configured(formatter_configs) null_ls.register { sources = formatters_by_ft.supported } end return M
-- -- Licensed to the Apache Software Foundation (ASF) under one or more -- contributor license agreements. See the NOTICE file distributed with -- this work for additional information regarding copyright ownership. -- The ASF licenses this file to You under the Apache License, Version 2.0 -- (the "License"); you may not use this file except in compliance with -- the License. You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- local core = require("apisix.core") local plugin = require("apisix.plugin") local error = error local ipairs = ipairs local pairs = pairs local consumers local _M = { version = 0.3, } local function plugin_consumer() local plugins = {} if consumers.values == nil then return plugins end for _, consumer in ipairs(consumers.values) do for name, config in pairs(consumer.value.plugins or {}) do local plugin_obj = plugin.get(name) if plugin_obj and plugin_obj.type == "auth" then if not plugins[name] then plugins[name] = { nodes = {}, conf_version = consumers.conf_version } end local new_consumer = core.table.clone(consumer.value) new_consumer.consumer_id = new_consumer.id new_consumer.auth_conf = config core.log.info("consumer:", core.json.delay_encode(new_consumer)) core.table.insert(plugins[name].nodes, new_consumer) break end end end return plugins end function _M.plugin(plugin_name) local plugin_conf = core.lrucache.global("/consumers", consumers.conf_version, plugin_consumer) return plugin_conf[plugin_name] end function _M.init_worker() local err consumers, err = core.config.new("/consumers", { automatic = true, item_schema = core.schema.consumer }) if not consumers then error("failed to create etcd instance for fetching consumers: " .. err) return end end return _M
pcall(require, "luarocks.loader") local gears = require("gears") local awful = require("awful") require("awful.autofocus") local wibox = require("wibox") local beautiful = require("beautiful") local naughty = require("naughty") local menubar = require("menubar") local hotkeys_popup = require("awful.hotkeys_popup") require("awful.hotkeys_popup.keys") require("shortcuts") require("layouts") require("workspaces") require("autolaunch") require("rules") require("wiboxs") -- {{{ Error handling -- Check if awesome encountered an error during startup and fell back to -- another config (This code will only ever execute for the fallback config) if awesome.startup_errors then naughty.notify({ preset = naughty.config.presets.critical, title = "Oops, there were errors during startup!", text = awesome.startup_errors }) end -- Handle runtime errors after startup do local in_error = false awesome.connect_signal("debug::error", function (err) -- Make sure we don't go into an endless error loop if in_error then return end in_error = true naughty.notify({ preset = naughty.config.presets.critical, title = "Oops, an error happened!", text = tostring(err) }) in_error = false end) end -- }}} -- {{{ Variable definitions -- Themes define colours, icons, font and wallpapers. beautiful.init(gears.filesystem.get_configuration_dir() .. "theme.lua") -- This is used later as the default terminal and editor to run. terminal = "st" editor = os.getenv("EDITOR") or "nvim" editor_cmd = terminal .. " -e " .. editor -- {{{ Menu -- Create a launcher widget and a main menu -- {{{ Menu -- Create a laucher widget and a main menu myawesomemenu = { { "manual", terminal .. " -e man awesome" }, { "edit config", editor_cmd .. "termite -e 'nvim '" .. awesome.conffile }, { "restart", awesome.restart }, { "quit", awesome.quit } } termmenu = { {"simple terminal" ,"st"}, { "termite", "termite" }, { "terminator", "terminator" }, { "term (grey)", "urxvt -fg grey -depth 32 -bg rgba:0008/001B/00E5/aaaa -e zsh " }, { "term (red)", "urxvt -fg red -depth 32 -bg rgba:0008/001B/00E5/aaaa -e zsh " }, { "term (green)", "urxvt -fg green -depth 32 -bg rgba:0008/001B/00E5/aaaa -e zsh " }, { "term (yellow)", "urxvt -fg yellow -depth 32 -bg rgba:0008/001B/00E5/aaaa -e zsh " }, { "term (white)", "urxvt -fg white -depth 32 -bg rgba:0008/001B/00E5/aaaa -e zshh " } } browsermenu = { { "firefox", "firefox" }, { "chromium", "chromium" }, {"brave", "brave"}, { "torbrowser", "torbrowser-launcher" }, } shells = { { "zsh", "terminator -e 'zsh'" }, { "bash", "terminator -e 'bash'" }, { "python 2", "terminator -e 'python2'" }, { "python 3", "terminator -e 'python3'" }, } mymainmenu = awful.menu({ items = { { "terminals", termmenu }, {"shells", shells}, { "awesome", myawesomemenu }, } })
main_quest = true collectibles = { {"we_firesword", 1} } markers = { { map = "res/map/highland/highland.tmx", position = {500, 1600}, step = 0 }, { map = "res/map/highland/highland.tmx", position = {375, 1200}, npc = "npc_jason", step = 0 }, { map = "res/map/highland/highland.tmx", position = {1900, 500}, step = 1 }, { map = "res/map/highland/highland.tmx", position = {1900, 500}, step = -1 } }
print(type(a)) tab1 = { key1 = "val1", key2 = "val2", "val3" } for k, v in pairs(tab1) do print(k .. " - " .. v) end tab1.key1 = nil for k, v in pairs(tab1) do print(k .. " - " .. v) end
--[[ File: gameobject.lua Author: Daniel "lytedev" Flanagan Website: http://dmf.me The base gameobject class. ]]-- local Gameobject = Class{} function Gameobject:init(x, y, width, height, objectType, shape) local objectType = objectType or "static" local width = width or 8 local height = height or 8 gameobjects[table.address(self)] = self local x = x or 0 local y = y or 0 self.body = love.physics.newBody(world, x, y, objectType) self.shapeType = shape or "circle" if self.shapeType == "circle" then self.shape = love.physics.newCircleShape(width) else self.shape = love.physics.newRectangleShape(width, height) end self.fixture = love.physics.newFixture(self.body, self.shape) self.body:setLinearDamping(20) self.body:setFixedRotation(true) end function Gameobject:update(dt) end function Gameobject:draw() if self.shapeType == "circle" then love.graphics.circle("fill", self.body:getX(), self.body:getY(), self.shape:getRadius()) else love.graphics.polygon("fill", self.body:getWorldPoints(self.shape:getPoints())) end end function Gameobject:applyForce(x, y) self.body:applyForce(x, y) end function Gameobject:getPosition() return self.body:getPosition() end function Gameobject:destroy() self.destroyed = true self.body:destroy() gameobjects[table.address(self)] = nil end return Gameobject
-- NormanYang -- 2019年4月7日 -- message消息分发机制 local type = type Message = {NumberMsg = {}, NormalMsg = {}} local this = Message; this.__index = this; --添加Msg监听 function Message.AddMessage(msgName, func, listener) if not msgName or type(func) ~= 'function' then error('Add message Error!') end if type(msgName) == 'number' then this.NumberMsg[msgName] = func; elseif type(msgName) == 'string' then this.NormalMsg[msgName] = func; if listener then this.NormalMsg[msgName .. '_listener'] = listener; end end end --移除Msg监听 function Message.RemoveMessage(msgName) local msg = type(msgName) == 'number' and this.NumberMsg or this.NormalMsg; msg[msgName] = nil; this.NormalMsg[msgName .. '_listener'] = nil; end --广播Msg监听 function Message.DispatchMessage(msgName, ...) if type(msgName) == 'number' then local msg = this.NumberMsg; if msg[msgName] then local func = msg[msgName]; spawn(func, ...); end elseif type(msgName) == 'string' then local msg = this.NormalMsg; local func = msg[msgName]; if func then local listener = msg[msgName .. '_listener']; if listener then spawn(func, listener, ...); else spawn(func, ...); end end end end
ITEM.name = "Cardazepine Tablets" ITEM.description = "A small blister packet." ITEM.longdesc = "Cardazepine is the prime choice for recovering after a bad run-in with a psychic mutant. Unlike the alternative Modafine, the side effects of Cardazepine are nowhere near as bad, and it is also more effective.\nThe only problem is that they're in short supply, as only the ecologists seem to get regular shipments of them, but even so their stock is tiny. Some packs of this drug are also smuggled in by other means, but that's a rare occurence." ITEM.model = "models/lostsignalproject/items/medical/antiemetic.mdl" ITEM.sound = "stalkersound/inv_eat_pills.mp3" ITEM.width = 1 ITEM.height = 1 ITEM.price = 1520 ITEM.quantity = 2 ITEM.psyheal = 75 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, {}) 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.player:GetCharacter():GetInventory():GetID() end }
--[[ Name: task-scheduler_1.0.lua Desc: This script demonstrates a simple task scheduler used to execute multiple tasks at regular intervals to 1ms resolution Note: Requires Firmware 1.0199 or higher (for T7) Increase scheduler resolution to reduce CPU load on the T7 processor --]] ------------------------------------------------------------------------------- -- Desc: Task function definitions -- Note: Define tasks to run as individual functions. Task functions must be -- defined in the task table and executed by the task scheduler. ------------------------------------------------------------------------------- func1 = function (args) print("Function1 Executed --") -- Add functional code here. Parameters may be passed thorugh the args -- variable as an array. return 0 end func2 = function (args) print("Function2 Executed --") -- Add functional code here. Parameters may be passed thorugh the args -- variable as an array. return 0 end print("LabJack Lua Task Scheduler Example. Version 1.0") -- Directions: -- 1. Define user functions as required. -- 2. Build scheduler table for each function that is executed at regular -- intervals. Each row int the scheduler table corresponds to one function -- 3. Define function parameters in the scheduler table as required -- [n][0] - Function name (string) -- [n][1] - Initial execution delay time. Set to nonzero value to -- delay initial function execution. Function will execute at -- regular internals after the initial delay has elapsed -- [n][2] - Function period in milliseconds -- [n][3] - Optional parameters to pass to the function if necessary. -- Pass array if multiple parameters are required -- Number of functions being executed in the scheduler -- Must equal the number of a function defined in the scheduler table local numfuncs = 2 -- Allowable number of scheduler tics beyond function period before posting -- a warning local msgthreshold = 1 local intervalcount = 0 local schedule = {} -- New row (1 row per function) schedule[0] = {} -- New row (1 row per function) schedule[1] = {} -- Function1 name schedule[0][0] = "func1" -- Function1 counter. The function will execute when this value equals zero. -- Set to a positive nonzero number to set the delay before first execution schedule[0][1] = 10 -- Function1 period schedule[0][2] = 50 -- Function1 parameters (if required) schedule[0][3] = {} -- Function2 name schedule[1][0] = "func2" -- Function2 counter. The function will execute when this value equals zero. -- Set to a positive nonzero number to set the delay before first execution schedule[1][1] = 10 -- Function2 period schedule[1][2] = 500 -- Function2 parameters (if required) schedule[1][3] = {} -- Define the scheduler resolution (1 ms). Increase if necessary LJ.IntervalConfig(0, 1) local test = 0 ------------------------------------------------------------------------------- -- Desc: Task Scheduler -- Note: No need to modify the scheduler main loop. The scheduler will execute -- any number of tasks defined in the task table. ------------------------------------------------------------------------------- while true do -- Save the count to catch missed interval servicing intervalcount = LJ.CheckInterval(0) if (intervalcount) then -- Decrement function counters and determine if a function needs to run. for i=0,numfuncs-1,1 do -- Decrement function counter variable. LJ.CheckInterval returns the -- number of elapsed intervals since last check. In most cases interval -- count will normally equal 1, unless some delay causes -- script to go multiple intervals between checks. Adjust function -- counter accordingly to maintain function timing local delay = intervalcount - schedule[i][1] schedule[i][1] = schedule[i][1] - intervalcount -- Call a function when counter reaches zero. if(schedule[i][1] <= 0) then -- Post a message if we see the function execution time was delayed too long if (schedule[i][1] < 0) then print("Warning: Function", i, "delayed by", delay, "ms") end -- Execute Task --_G["func1"](params{}) -- Call the function from the global namespace _G[schedule[i][0]](schedule[1][3]) -- Reset the function counter schedule[i][1] = schedule[i][2] end end end end
-- assume that eid is some existing entity id function example_factory_add() fill = scene.components.fill.add(eid) end function example_factory_get() fill, found = scene.components.fill.get(eid) end function example_factory_remove() scene.components.fill.remove(eid) end function example_component_usage() fill, found = scene.components.fill.get(eid) if ~found then return end fill.rgba(255, 255, 255, 255) r, g, b, a = fill.rgba() end
local has_plenary_log, _ = pcall(require, "plenary.log") if not has_plenary_log then return { trace = print, warn = print, debug = print, info = print, error = print, fatal = print, } else return require("plenary.log").new { plugin = "octo", level = (vim.loop.os_getenv "USER" == "pwntester" and "debug") or "warn", } end
function nonils (...) local arg = table.pack(...) for i = 1, arg.n do if arg[i] == nil then return false end end return true end print(nonils(2,3,nil)) --> false print(nonils(2,3)) --> true print(nonils()) --> true print(nonils(nil)) --> false
local Const = require("api.Const") local Event = require("api.Event") local DateTime = require("api.DateTime") local UidTracker = require("api.UidTracker") local Rand = require("api.Rand") local save = require("internal.global.save") local parties = require("internal.parties") local StayingCharas = require("api.StayingCharas") local function init_save() local s = save.base s.date = DateTime:new(Const.INITIAL_YEAR, Const.INITIAL_MONTH, Const.INITIAL_DAY, 1, 10) s.initial_date = s.date:clone() s.play_time = 0 s.play_turns = 0 s.play_days = 0 s.player = nil s.parties = parties:new() s.uids = UidTracker:new() s.map_uids = UidTracker:new() s.area_uids = UidTracker:new() s.random_seed = Rand.rnd(800) + 2 s.shadow = 70 s.has_light_source = false s.deepest_level = 0 s.containers = {} s.tracked_skill_ids = {} s.bones = {} s.total_killed = 0 s.total_deaths = 0 s.areas = {} s.unique_areas = {} s.travel_distance = 0 s.travel_date = 0 s.travel_date = 0 s.travel_last_town_name = "" s.is_first_turn = false s.inventories = {} s.staying_charas = StayingCharas:new(nil) end Event.register("base.on_init_save", "Init save (base)", init_save, {priority = 0})
-- NetHack 3.7 Sovereign.des -- Copyright (c) 1989 by Jean-Christophe Collet -- Copyright (c) 1991-92 by M. Stephenson, P. Winner -- NetHack may be freely redistributed. See license for details. -- des.level_init({ style = "solidfill", fg = " " }); des.level_flags("mazelevel", "noteleport"); des.map([[ TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TTTTTTTTTT..TTTTTTTTTTT......T....TTTTTTTTTTTTTTTTTTTTTTTTTT....TTTTTTTTTTTT TTTTTTTTT....TTT}}}TTTT.TTT..T....TTTTT........TTTTT...TTT................TT TTT..TTTT.TT.TTT...TTT...TT..TTT..TTTTT................TTT................TT TTT.......TT.............TT.......TTTTTTTT...TTT}}TTT..TTT..TTTT....TTT...TT TTT..T.T...TT...TTT...T}}TT}}......TTTTTT...TTT....TT..TTT....TTT..TTTTT..TT TTTTTT.TTT..TTTTTTT}}}T}}TT}}TTT....TTTT...TTTT...............TTT..TTTTT..TT TTTTTT}TT..}}TTTT.....T}}TT..........TT...TT}}TTTT........TTTTTTT..TTTT...TT TTT.......TT}}....................T......TT}..}TTTT}}}}}}TTTTTTTT}}TTT...TTT TTT.<.....TTTT...TTTTT.....TTTTT..TT....TT}.............................TTTT TTT.......TT}}....................T......TT}..}TTTT}}}}}}TTTTTTTT}}TTT...TTT TTTTTT}TT..}}TTTT.....T}}TT..........TT...TT}}TTTT........TTTTTTT..TTTT...TT TTTTTT.TTT..TTTTTTT}}}T}}TT}}TTT....TTTT...TTTT...............TTT..TTTTT..TT TTT..T.TT..TT...TTT...T}}TT}}......TTTTTT...TTT....TT..TTT....TTT..TTTTT..TT TTT.......TT.............TT.......TTTTTTTT...TTT}}TTT..TTT..TTTT....TTT...TT TTT..TTT..TT.TTT...TTT...TT..TTT..TTTTT................TTT................TT TTTTTTTTT....TTT}}}TTTT.TTT..T....TTTTT........TTTTT...TTT................TT TTTTTTTTTT..TTTTTTTTTTT......T....TTTTTTTTTTTTTTTTTTTTTTTTTT....TTTTTTTTTTTT TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT ]]); -- Dungeon Description des.region(selection.area(00,00,79,20), "lit") -- Stairs des.stair("up", 4, 9) -- Robin Hood, in his hidey-hole des.object({ id = "short sword", x=44, y=8, buc="blessed", spe=-1, name="The Sword of Justice and Mercy" }) des.monster("Robin Hood", 44, 8) -- Stolen riches des.object("chest", 44, 8) des.object("chest", 45, 8) des.object("chest", 44, 9) des.object("chest", 45, 9) des.object("chest", 44, 10) des.object("chest", 45, 10) -- The merry men des.monster("merry man", 6, 6) des.monster("merry man", 6, 12) des.monster("merry man", 9, 8) des.monster("merry man", 9, 10) des.monster("merry man", 14, 9) des.monster("merry man", 15, 9) des.monster("merry man", 23, 4) des.monster("merry man", 23, 14) des.monster("merry man", 23, 8) des.monster("merry man", 23, 10) des.monster({ id = "storm giant", x=37, y=9, peaceful=0, asleep=0, name="Little John" }) des.monster("merry man", 39, 2) des.monster("merry man", 39, 16) des.monster("merry man", 47, 5) des.monster("merry man", 47, 6) des.monster("merry man", 47, 12) des.monster("merry man", 47, 13) des.monster("merry man", 65, 7) des.monster("merry man", 65, 11) des.monster("merry man", 66, 7) des.monster("merry man", 66, 11) des.monster("merry man") des.monster("merry man") des.monster("merry man") des.monster("merry man") des.monster("merry man") des.monster("merry man") des.monster("merry man") des.monster("merry man") des.monster("leprechaun") des.monster("leprechaun") -- Random objects des.object() des.object() des.object() des.object() des.object() des.object() des.object() des.object() des.object() des.object() des.object() des.object() des.object() des.object() -- des.replace_terrain({ region = {0,0,80,20}, fromterrain=".", toterrain=",", chance=85 })
--[[ -- the List type is a plain Lua table with additional methods that come from: -- 1. all the methods in Lua's 'table' global -- 2. a list of higher-order functions based on sml's (fairly minimal) list type. -- For each function that is an argument of a high-order List function can be either: -- 1. a real Lua function -- 2. a string of an operator "+" (see op table) -- 3. a string that specifies a field or method to call on the object -- local mylist = List { a,b,c } -- mylist:map("foo") -- selects the fields: a.foo, b.foo, c.foo, etc. -- -- if a.foo is a function it will be treated as a method a:foo() -- extra arguments to the higher-order function are passed through to these function. -- rationale: Lua inline function syntax is verbose, this functionality avoids -- inline functions in many cases list:sub(i,j) -- Lua's string.sub, but for lists list:rev() : List[A] -- reverse list list:app(fn : A -> B) : {} -- app fn to every element list:map(fn : A -> B) : List[B] -- apply map to every element resulting in new list list:filter(fn : A -> boolean) : List[A] -- new list with elements were fn(e) is true list:flatmap(fn : A -> List[B]) : List[B] -- apply map to every element, resulting in lists which are all concatenated together list:find(fn : A -> boolean) : A? -- find the first element in list satisfying condition list:partition(fn : A -> {K,V}) : Map[ K,List[V] ] -- apply k,v = fn(e) to each element and group the values 'v' into bin of the same 'k' list:fold(init : B,fn : {B,A} -> B) -> B -- recurrence fn(a[2],fn(a[1],init)) ... list:reduce(fn : {B,A} -> B) -> B -- recurrence fn(a[3],fn(a[2],a[1])) list:reduceor(init : B,fn : {B,A} -> B) -> B -- recurrence fn(a[3],fn(a[2],a[1])) or init if the list is empty list:exists(fn : A -> boolean) : boolean -- is any fn(e) true in list list:all(fn : A -> boolean) : boolean -- are all fn(e) true in list Every function that takes a higher-order function also has a 'i' variant that Also provides the list index to the function: list:mapi(fn : {int,A} -> B) -> List[B] ]] local List = {} List.__index = List for k,v in pairs(table) do List[k] = v end setmetatable(List, { __call = function(self, lst) if lst == nil then lst = {} end return setmetatable(lst,self) end}) function List:isclassof(exp) return getmetatable(exp) == self end function List:insertall(elems) for i,e in ipairs(elems) do self:insert(e) end end function List:rev() local l,N = List(),#self for i = 1,N do l[i] = self[N-i+1] end return l end function List:sub(i,j) local N = #self if not j then j = N end if i < 0 then i = N+i+1 end if j < 0 then j = N+j+1 end local l = List() for c = i,j do l:insert(self[c]) end return l end function List:__tostring() return ("{%s}"):format(self:map(tostring):concat(",")) end local OpTable = { ["+"] = function(x,y) return x + y end; ["*"] = function(x,y) return x * y end; ["/"] = function(x,y) return x / y end; ["%"] = function(x,y) return x % y end; ["^"] = function(x,y) return x ^ y end; [".."] = function(x,y) return x .. y end; ["<"] = function(x,y) return x < y end; [">"] = function(x,y) return x > y end; ["<="] = function(x,y) return x <= y end; [">="] = function(x,y) return x >= y end; ["~="] = function(x,y) return x ~= y end; ["~="] = function(x,y) return x == y end; ["and"] = function(x,y) return x and y end; ["or"] = function(x,y) return x or y end; ["not"] = function(x) return not x end; ["-"] = function(x,y) if not y then return -x else return x - y end end } local function selector(key) local fn = OpTable[key] if fn then return fn end return function(v,...) local sel = v[key] if type(sel) == "function" then return sel(v,...) else return sel end end end local function selectori(key) local fn = OpTable[key] if fn then return fn end return function(i,v,...) local sel = v[key] if type(sel) == "function" then return sel(i,v,...) else return sel end end end function List:mapi(fn,...) if type(fn) ~= "function" then fn = selectori(fn) end local l = List() for i,v in ipairs(self) do l[i] = fn(i,v,...) end return l end function List:map(fn,...) if type(fn) ~= "function" then fn = selector(fn) end local l = List() for i,v in ipairs(self) do l[i] = fn(v,...) end return l end function List:appi(fn,...) if type(fn) ~= "function" then fn = selectori(fn) end for i,v in ipairs(self) do fn(i,v,...) end end function List:app(fn,...) if type(fn) ~= "function" then fn = selector(fn) end for i,v in ipairs(self) do fn(v,...) end end function List:filteri(fn,...) if type(fn) ~= "function" then fn = selectori(fn) end local l = List() for i,v in ipairs(self) do if fn(i,v,...) then l:insert(v) end end return l end function List:filter(fn,...) if type(fn) ~= "function" then fn = selector(fn) end local l = List() for i,v in ipairs(self) do if fn(v,...) then l:insert(v) end end return l end function List:flatmapi(fn,...) if type(fn) ~= "function" then fn = selectori(fn) end local l = List() for i,v in ipairs(self) do local r = fn(i,v,...) for j,v2 in ipairs(r) do l:insert(v2) end end return l end function List:flatmap(fn,...) if type(fn) ~= "function" then fn = selector(fn) end local l = List() for i,v in ipairs(self) do local r = fn(v,...) for j,v2 in ipairs(r) do l:insert(v2) end end return l end function List:findi(fn,...) if type(fn) ~= "function" then fn = selectori(fn) end local l = List() for i,v in ipairs(self) do if fn(i,v,...) then return v end end return nil end function List:find(fn,...) if type(fn) ~= "function" then fn = selector(fn) end local l = List() for i,v in ipairs(self) do if fn(v,...) then return v end end return nil end function List:partitioni(fn,...) if type(fn) ~= "function" then fn = selectori(fn) end local m = {} for i,v in ipairs(self) do local k,v2 = fn(i,v,...) local l = m[k] if not l then l = List() m[k] = l end l:insert(v2) end return m end function List:partition(fn,...) if type(fn) ~= "function" then fn = selector(fn) end local m = {} for i,v in ipairs(self) do local k,v2 = fn(v,...) local l = m[k] if not l then l = List() m[k] = l end l:insert(v2) end return m end function List:foldi(init,fn,...) if type(fn) ~= "function" then fn = selectori(fn) end local s = init for i,v in ipairs(self) do s = fn(i,s,v,...) end return s end function List:fold(init,fn,...) if type(fn) ~= "function" then fn = selector(fn) end local s = init for i,v in ipairs(self) do s = fn(s,v,...) end return s end function List:reducei(fn,...) if type(fn) ~= "function" then fn = selectori(fn) end local N = #self assert(N > 0, "reduce requires non-empty list") local s = self[1] for i = 2,N do s = fn(i,s,self[i],...) end return s end function List:reduce(fn,...) if type(fn) ~= "function" then fn = selector(fn) end local N = #self assert(N > 0, "reduce requires non-empty list") local s = self[1] for i = 2,N do s = fn(s,self[i],...) end return s end function List:reduceori(init,fn,...) if type(fn) ~= "function" then fn = selectori(fn) end local N = #self if N == 0 then return init end local s = self[1] for i = 2,N do s = fn(i,s,self[i],...) end return s end function List:reduceor(init,fn,...) if type(fn) ~= "function" then fn = selector(fn) end local N = #self if N == 0 then return init end local s = self[1] for i = 2,N do s = fn(s,self[i],...) end return s end function List:existsi(fn,...) if type(fn) ~= "function" then fn = selectori(fn) end for i,v in ipairs(self) do if fn(i,v,...) then return true end end return false end function List:exists(fn,...) if type(fn) ~= "function" then fn = selector(fn) end for i,v in ipairs(self) do if fn(v,...) then return true end end return false end function List:alli(fn,...) if type(fn) ~= "function" then fn = selectori(fn) end for i,v in ipairs(self) do if not fn(i,v,...) then return false end end return true end function List:all(fn,...) if type(fn) ~= "function" then fn = selector(fn) end for i,v in ipairs(self) do if not fn(v,...) then return false end end return true end package.loaded["terralist"] = List return List
return { corsh = { acceleration = 0.12, brakerate = 0.336, buildcostenergy = 1535, buildcostmetal = 76, builder = false, buildpic = "corsh.dds", buildtime = 4079, canattack = true, canguard = true, canhover = true, canmove = true, canpatrol = true, canstop = 1, category = "ALL MOBILE SMALL SURFACE UNDERWATER", collisionvolumeoffsets = "0 1 0", collisionvolumescales = "24 16 32", collisionvolumetype = "CylY", corpse = "dead", defaultmissiontype = "Standby", description = "Fast Attack Hovercraft", explodeas = "SMALL_UNITEX", firestandorders = 1, footprintx = 3, footprintz = 3, idleautoheal = 5, idletime = 1800, losemitheight = 22, maneuverleashlength = 640, mass = 76, maxdamage = 230, maxslope = 16, maxvelocity = 4.26, maxwaterdepth = 0, mobilestandorders = 1, movementclass = "HOVER3", name = "Scrubber", noautofire = false, objectname = "CORSH", radaremitheight = 25, seismicsignature = 0, selfdestructas = "SMALL_UNIT", sightdistance = 509, standingfireorder = 2, standingmoveorder = 1, steeringmode = 1, turninplace = 0, turninplaceanglelimit = 140, turninplacespeedlimit = 2.8116, turnrate = 615, unitname = "corsh", customparams = { buildpic = "corsh.dds", faction = "CORE", }, featuredefs = { dead = { blocking = false, collisionvolumeoffsets = "1.82556915283 -0.57393942627 -0.410171508789", collisionvolumescales = "20.8764801025 14.7368011475 29.8970336914", collisionvolumetype = "Box", damage = 397, description = "Scrubber Wreckage", energy = 0, featuredead = "heap", footprintx = 3, footprintz = 3, metal = 57, object = "CORSH_DEAD", reclaimable = true, customparams = { fromunit = 1, }, }, heap = { blocking = false, damage = 496, description = "Scrubber Debris", energy = 0, footprintx = 3, footprintz = 3, metal = 30, object = "3X3A", reclaimable = true, customparams = { fromunit = 1, }, }, }, sfxtypes = { pieceexplosiongenerators = { [1] = "piecetrail0", [2] = "piecetrail1", [3] = "piecetrail2", [4] = "piecetrail3", [5] = "piecetrail4", [6] = "piecetrail6", }, }, sounds = { canceldestruct = "cancel2", underattack = "warning1", cant = { [1] = "cantdo4", }, count = { [1] = "count6", [2] = "count5", [3] = "count4", [4] = "count3", [5] = "count2", [6] = "count1", }, ok = { [1] = "hovsmok2", }, select = { [1] = "hovsmsl2", }, }, weapondefs = { armsh_weapon = { areaofeffect = 8, beamtime = 0.1, burstrate = 0.2, craterareaofeffect = 0, craterboost = 0, cratermult = 0, duration = 0.02, energypershot = 3, explosiongenerator = "custom:FLASH1nd", firestarter = 50, impactonly = 1, impulseboost = 0, impulsefactor = 0, name = "Laser", noselfdamage = true, range = 230, reloadtime = 0.6, rgbcolor = "1.000 0.059 0.000", soundhitdry = "", soundhitwet = "sizzle", soundhitwetvolume = 0.5, soundstart = "lasrfast", soundtrigger = 1, sweepfire = false, targetmoveerror = 0.3, thickness = 1.25, turret = true, weapontype = "BeamLaser", weaponvelocity = 450, customparams = { light_mult = 1.8, light_radius_mult = 1.2, }, damage = { default = 48, subs = 5, }, }, }, weapons = { [1] = { def = "ARMSH_WEAPON", onlytargetcategory = "SURFACE", }, }, }, }
require 'user.api' local data = { address = "1/1/1", value = true, } API:construct("https://LINK-TO-API-BASEURL.com") local res, code, response_header = API:post('update.php', data) if(code == 200) then log("API request successful") else log("API request not successful") end
#!/usr/bin/lua --[[-------------------------------------------------------------------------- -- Licensed to Qualys, Inc. (QUALYS) under one or more -- contributor license agreements. See the NOTICE file distributed with -- this work for additional information regarding copyright ownership. -- QUALYS licenses this file to You under the Apache License, Version 2.0 -- (the "License"); you may not use this file except in compliance with -- the License. You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. --]]-------------------------------------------------------------------------- -- -- IronBee Waggle --- Generator -- -- Generates rules. -- -- @author Sam Baskinger <sbaskinger@qualys.com> local Util = require('ironbee/waggle/util') local Action = require('ironbee/waggle/actionrule') local RuleExt = require('ironbee/waggle/ruleext') local StreamInspect = require('ironbee/waggle/streaminspect') -- ########################################################################### -- Generator - generate a rules.conf or similar -- ########################################################################### local Generator = {} Generator.__index = Generator Generator.type = 'generator' Generator.new = function(self) local g = {} return setmetatable(g, self) end Generator.gen_op = function(self, rule) if rule.is_a(RuleExt) then return rule.data.op else if string.sub(rule.data.op, 1, 1) == '!' then return string.format("!@%s", string.sub(rule.data.op, 2)) else return string.format("@%s", rule.data.op) end end end Generator.gen_fields = function(self, rule) local field_list = {} for _, field in ipairs(rule.data.fields) do local f = field.collection if field.selector then f = f .. ':' .. field.selector end if field.transformation then f = f .. '.' .. field.transformation end table.insert(field_list, f) end return '"' .. table.concat(field_list, '" "') .. '"' end -- Generate actions, including tags, etc. -- -- This ignores the 'chain' action. That is inserted as-needed. Generator.gen_actions = function(self, rule) local t = {} -- Add the tags. for val,_ in pairs(rule.data.tags) do table.insert(t, "tag:"..val) end -- Add the actions that are not id, rev, or phase. -- They may only appear once. for _, act in pairs(rule.data.actions) do if act.name ~= 'id' and act.name ~= 'rev' and act.name ~= 'phase' then if act.argument then table.insert(t, act.name .. ":"..act.argument) else table.insert(t, act.name) end end end -- Add the message if it exists. if rule.data.message then table.insert(t, "msg:"..rule.data.message) end if #t > 0 then return '"' .. table.concat(t, '" "') .. '"' else return '' end end -- Generate a string that represents an IronBee rules configuration. -- -- @param[in] self The generator. -- @param[in] plan The plan generated by Planner:new():plan(db) or equivalent. -- @param[in] db The SignatureDatabase used to plan. Generator.generate = function(self, plan, db) -- String we are going to return representing the final configuration. local s = '' for _, chain in ipairs(plan) do for i, link in ipairs(chain) do local rule_id = link.rule local result = link.result local rule = db.db[rule_id] if rule:is_a(Rule) then if rule.data.comment then s = s .. "# ".. string.gsub(rule.data.comment, "\n", "\n# ") .."\n" end s = s .. string.format( "%s %s %s \"%s\" %s", rule.data.rule_type, self:gen_fields(rule), self:gen_op(rule), rule.data.op_arg, self:gen_actions(rule)) -- The first rule in a chain gets the ID, message, phase, etc. if i == 1 then local last_rule = db.db[chain[#chain].rule] s = s .. ' "id:' .. last_rule.data.id .. '"' s = s .. ' "rev:' .. last_rule.data.version .. '"' if last_rule.data.phase then s = s .. ' "phase:' .. last_rule.data.phase .. '"' end end if i ~= #chain then s = s .. ' chain' end elseif rule:is_a(RuleExt) then if rule.data.comment then s = s .. "# ".. string.gsub(rule.data.comment, "\n", "\n# ") .."\n" end s = s .. string.format( "%s %s %s \"%s\" %s \"id:%s\" \"rev:%s\"", rule.data.rule_type, self:gen_fields(rule), self:gen_op(rule), rule.data.op_arg, self:gen_actions(rule), rule.data.id, rule.data.version) elseif rule:is_a(Action) then if rule.data.comment then s = s .. "# ".. string.gsub(rule.data.comment, "\n", "\n# ") .."\n" end s = s .. string.format( "%s %s \"id:%s\" \"rev:%s\"", rule.data.rule_type, self:gen_actions(rule), rule.data.id, rule.data.version) elseif rule.is_a(StreamInspect) then if rule.data.comment then s = s .. "# ".. string.gsub(rule.data.comment, "\n", "\n# ") .."\n" end s = s .. string.format( "%s %s %s \"%s\" %s \"id:%s\" \"rev:%s\"", rule.data.rule_type, self:gen_fields(rule), self:gen_op(rule), rule.data.op_arg, self:gen_actions(rule), rule.data.id, rule.data.version) end s = s .. "\n" end end return s end return Generator
return { init_effect = "", name = "2020德系活动D3 构建者护盾", time = 15, last_effect = "ATdun_full", picture = "", desc = "AT·FIELD", stack = 1, id = 8792, icon = 8792, last_effect_cld_scale = true, effect_list = { { type = "BattleBuffBarrier", trigger = { "onUpdate", "onRemove", "onAttach", "onTakeDamage" }, arg_list = { durability = 12000, cld_data = { box = { range = 28 }, offset = { 0, 4, 0 } } } }, { type = "BattleBuffAddBuff", trigger = { "onRemove" }, arg_list = { buff_id = 8791, target = "TargetSelf" } }, { type = "BattleBuffCastSkill", trigger = { "onAttach" }, arg_list = { skill_id = 8790, target = "TargetSelf" } } } }
print ([[ The program shows sensitivity and specificity values for certain feature types (e.g., gene, mRNA, and exon). For some feature types the number of missing and wrong features of that type is also shown. Thereby, ``missing'' means the number of features of that type from the ``reality'' without overlap to a feature of that type from the ``prediction''. Vice versa, ``wrong'' denotes the number of features of that type from the ``prediction'' without overlap to a feature of that type from the ``reality''.]])