content
stringlengths
5
1.05M
local mime_map = module:shared("/*/http_files/mime").types or { css = "text/css", js = "application/javascript", }; local libjs_path = module:get_option_string("libjs_path", "/usr/share/javascript"); module:provides("http", { default_path = "/share"; route = { ["GET /*"] = require "net.http.files".serve({ path = libjs_path, mime_map = mime_map }); } });
measure = {"cm", "dm", "m"}
C_VignetteInfo = {} ---@param vignetteGUIDs string[] ---@return number? bestUniqueVignetteIndex ---[Documentation](https://wow.gamepedia.com/API_C_VignetteInfo.FindBestUniqueVignette) function C_VignetteInfo.FindBestUniqueVignette(vignetteGUIDs) end ---@param vignetteGUID string ---@return VignetteInfo? vignetteInfo ---[Documentation](https://wow.gamepedia.com/API_C_VignetteInfo.GetVignetteInfo) function C_VignetteInfo.GetVignetteInfo(vignetteGUID) end ---@param vignetteGUID string ---@param uiMapID number ---@return Vector2DMixin? vignettePosition ---[Documentation](https://wow.gamepedia.com/API_C_VignetteInfo.GetVignettePosition) function C_VignetteInfo.GetVignettePosition(vignetteGUID, uiMapID) end ---@return string[] vignetteGUIDs ---[Documentation](https://wow.gamepedia.com/API_C_VignetteInfo.GetVignettes) function C_VignetteInfo.GetVignettes() end ---@class VignetteType local VignetteType = { Normal = 0, PvPBounty = 1, Torghast = 2, Treasure = 3, } ---@class VignetteInfo ---@field vignetteGUID string ---@field objectGUID string ---@field name string ---@field isDead boolean ---@field onWorldMap boolean ---@field zoneInfiniteAOI boolean ---@field onMinimap boolean ---@field isUnique boolean ---@field inFogOfWar boolean ---@field atlasName string ---@field hasTooltip boolean ---@field vignetteID number ---@field type VignetteType ---@field rewardQuestID number ---@field widgetSetID number|nil local VignetteInfo = {}
local ffi = require('ffi') ffi.cdef [[ typedef int sig_atomic_t; typedef void (* _crt_signal_t)(int); _crt_signal_t signal(int _Signal, _crt_signal_t _Function); int raise(int sig); ]] -- local M = {} return M
require 'paths' paths.dofile('layers/inception_new.lua') paths.dofile('world_coord_to_normal.lua') function get_model() require 'cudnn' require 'cunn' local model = nn.Sequential() model:add(cudnn.SpatialConvolution(3,128,7,7,1,1,3,3)) model:add(nn.SpatialBatchNormalization(128)) model:add(cudnn.ReLU(true)) --model:add(nn.SpatialFractionalMaxPooling(2,2,128,128)) --model:add(nn.SpatialFractionalMaxPooling(2,2,64,64)) -- input to _1channels is 256 local _1channels = nn.ConcatTable() _1channels:add( nn.Sequential():add( inception(256, {{64}, {3,32,64}, {5,32,64}, {7,32,64}}) ):add( inception(256, {{64}, {3,32,64}, {5,32,64}, {7,32,64}})) ) _1channels:add( nn.Sequential():add( nn.SpatialAveragePooling(2,2,2,2) ):add( inception(256, {{64}, {3,32,64}, {5,32,64}, {7,32,64}}) ):add( inception(256, {{64}, {3,32,64}, {5,32,64}, {7,32,64}}) ):add( inception(256, {{64}, {3,32,64}, {5,32,64}, {7,32,64}}) ):add( nn.SpatialUpSamplingNearest(2) -- up to 8x, 256 channel ) ) _1channels = nn.Sequential():add(_1channels):add(nn.CAddTable()) -- input to _2channels is 256 local _2channels = nn.ConcatTable() _2channels:add( nn.Sequential():add( inception(256, {{64}, {3,32,64}, {5,32,64}, {7,32,64}}) ):add( inception(256, {{64}, {3,64,64}, {7,64,64}, {11,64,64}}) ) ) _2channels:add( nn.Sequential():add( nn.SpatialAveragePooling(2,2,2,2) -- 8x ):add( inception(256, {{64}, {3,32,64}, {5,32,64}, {7,32,64}}) ):add( inception(256, {{64}, {3,32,64}, {5,32,64}, {7,32,64}}) ):add( _1channels -- down 16x then up to 8x ):add( inception(256, {{64}, {3,32,64}, {5,32,64}, {7,32,64}}) ):add( inception(256, {{64}, {3,64,64}, {7,64,64}, {11,64,64}}) ):add( nn.SpatialUpSamplingNearest(2) -- up to 4x. 256 channel ) ) _2channels = nn.Sequential():add(_2channels):add(nn.CAddTable()) -- input to _3channels is 128 local _3channels = nn.ConcatTable() _3channels:add( nn.Sequential():add( cudnn.SpatialMaxPooling(2, 2, 2, 2) -- 4 x ):add( inception(128, {{32}, {3,32,32}, {5,32,32}, {7,32,32}}) ):add( inception(128, {{64}, {3,32,64}, {5,32,64}, {7,32,64}}) --256 ):add( _2channels ):add( inception(256, {{64}, {3,32,64}, {5,32,64}, {7,32,64}}) ):add( inception(256, {{32}, {3,32,32}, {5,32,32}, {7,32,32}}) ):add( nn.SpatialUpSamplingNearest(2)) -- up to 2x , output is 128 channel ) _3channels:add( nn.Sequential():add( inception(128, {{32}, {3,32,32}, {5,32,32}, {7,32,32}}) --128 ):add( inception(128, {{32}, {3,64,32}, {7,64,32}, {11,64,32}}) ) ) _3channels = nn.Sequential():add(_3channels):add(nn.CAddTable()) -- input to _4channels is 128 local _4channels = nn.ConcatTable() _4channels:add( nn.Sequential():add( cudnn.SpatialMaxPooling(2, 2, 2, 2) -- 2 x ):add( inception(128, {{32}, {3,32,32}, {5,32,32}, {7,32,32}}) ):add( inception(128, {{32}, {3,32,32}, {5,32,32}, {7,32,32}}) -- 128 ):add( _3channels ):add( inception(128, {{32}, {3,64,32}, {5,64,32}, {7,64,32}}) ):add( inception(128, {{16}, {3,32,16}, {7,32,16}, {11,32,16}}) ):add( nn.SpatialUpSamplingNearest(2) -- up to original, 64 channel ) ) _4channels:add( nn.Sequential():add( inception(128, {{16}, {3,64,16}, {7,64,16}, {11,64,16}}) --nn.Identity() ) ) _4channels = nn.Sequential():add(_4channels):add(nn.CAddTable()) model:add(_4channels) --Final Output - The 3 channel surface normal model:add(cudnn.SpatialConvolution(64,3,3,3,1,1,1,1)); --Enforce the output normal to be unit vectors model:add(nn.spatial_normalization()) return model end require('../criterion/normal_l2') function get_criterion() return nn.normal_l2() end function f_depth_from_model_output() print(">>>>>>>>>>>>>>>>>>>>>>>>> normal = model_output") return ____get_normal_from_model_output end function ____get_normal_from_model_output(model_output) return model_output end function feval(current_params) -- timer = torch.Timer() local batch_input, batch_target = g_train_loader:load_next_batch(g_args.bs) -- print('Load Data: ' .. timer:time().real .. ' seconds') -- reset grad_params g_grad_params:zero() --forward & backward -- timer = torch.Timer() local batch_output = g_model:forward(batch_input) local batch_loss = g_criterion:forward(batch_output, batch_target[2]) local dloss_dx = g_criterion:backward(batch_output, batch_target[2]) g_model:backward(batch_input, dloss_dx) -- print('F/B Prop: ' .. timer:time().real .. ' seconds') collectgarbage() return batch_loss, g_grad_params end
prince_codes = { { Page = 1, Line = 2, Word = 2, Code = "W" }, { Page = 1, Line = 5, Word = 4, Code = "O" }, { Page = 1, Line = 8, Word = 6, Code = "E" }, { Page = 1, Line = 10, Word = 6, Code = "S" }, { Page = 2, Line = 2, Word = 5, Code = "P" }, { Page = 2, Line = 3, Word = 8, Code = "B" }, { Page = 2, Line = 6, Word = 6, Code = "Y" }, { Page = 2, Line = 1, Word = 2, Code = "S" }, { Page = 3, Line = 4, Word = 9, Code = "K" }, { Page = 3, Line = 5, Word = 1, Code = "J" }, { Page = 3, Line = 6, Word = 3, Code = "T" }, { Page = 3, Line = 1, Word = 7, Code = "B" }, { Page = 4, Line = 2, Word = 5, Code = "C" }, { Page = 4, Line = 3, Word = 3, Code = "F" }, { Page = 4, Line = 6, Word = 1, Code = "E" }, { Page = 4, Line = 11, Word = 9, Code = "S" }, { Page = 5, Line = 1, Word = 5, Code = "K" }, { Page = 5, Line = 2, Word = 1, Code = "M" }, { Page = 5, Line = 3, Word = 2, Code = "M" }, { Page = 3, Line = 1, Word = 1, Code = "T" }, { Page = 6, Line = 1, Word = 1, Code = "P" }, { Page = 6, Line = 1, Word = 4, Code = "Y" }, { Page = 6, Line = 2, Word = 2, Code = "K" }, { Page = 6, Line = 2, Word = 8, Code = "C" }, { Page = 7, Line = 3, Word = 4, Code = "G" }, { Page = 7, Line = 3, Word = 8, Code = "S" }, { Page = 7, Line = 4, Word = 2, Code = "U" }, { Page = 7, Line = 7, Word = 5, Code = "L" }, { Page = 10, Line = 1, Word = 2, Code = "J" }, { Page = 10, Line = 1, Word = 4, Code = "C" }, { Page = 10, Line = 5, Word = 4, Code = "D" }, { Page = 10, Line = 3, Word = 3, Code = "T" }, { Page = 11, Line = 2, Word = 5, Code = "L" }, { Page = 11, Line = 3, Word = 3, Code = "T" }, { Page = 11, Line = 4, Word = 1, Code = "T" }, { Page = 11, Line = 5, Word = 5, Code = "A" }, { Page = 13, Line = 3, Word = 3, Code = "M" }, { Page = 13, Line = 4, Word = 5, Code = "C" }, { Page = 13, Line = 4, Word = 8, Code = "S" }, { Page = 13, Line = 6, Word = 2, Code = "G" } } -- Read the page from the user print("What is the Page you are looking for?") local page_input = io.read("*n") -- Read the line from the user print("What is the Line you are looking for?") local line_input = io.read("*n") -- Read the word from the user print("What is the Word you are looking for?") local word_input = io.read("*n") ----------------------------------------------------------------------- -- TODO: -- Find and display the code for the page-line-word read from the user -----------------------------------------------------------------------
--- @ignore if CLIENT then EVENT.icon = Material("vgui/ttt/vskin/events/game") EVENT.title = "title_event_game" function EVENT:GetText() return { { string = "desc_event_game", } } end end if SERVER then function EVENT:Trigger(roundstate) return self:Add({ newstate = roundstate }) end end function EVENT:Serialize() return "A new round has started." end function EVENT:GetDeprecatedFormat() local event = self.event if event.roundState ~= ROUND_ACTIVE then return end return { id = self.type, t = event.time / 1000, state = event.newstate } end
----------------------------------------- -- ID: 4106 -- Wind Cluster -- Turn into a stack of wind crystals ----------------------------------------- require("scripts/globals/msg") ----------------------------------------- function onItemCheck(target) local result = 0 if target:getFreeSlotsCount() == 0 then result = tpz.msg.basic.ITEM_NO_USE_INVENTORY end return result end function onItemUse(target) target:addItem(4098,12) end
id = 'V-38674' severity = 'medium' weight = 10.0 title = 'X Windows must not be enabled unless required.' description = 'Unnecessary services should be disabled to decrease the attack surface of the system.' fixtext = [=[Setting the system's runlevel to 3 will prevent automatic startup of the X server. To do so, ensure the following line in "/etc/inittab" features a "3" as shown: id:3:initdefault:]=] checktext = [=[To verify the default runlevel is 3, run the following command: # grep initdefault /etc/inittab The output should show the following: id:3:initdefault: If it does not, this is a finding.]=] function test() end function fix() end
function onCreate() -- charastage makeLuaSprite('stageback', 'charabg', -420, -130); setLuaSpriteScrollFactor('stageback', 1.0, 1.0); makeLuaSprite('stagefront', '', -300, 670); setLuaSpriteScrollFactor('stagefront', 1.0, 1.0); addLuaSprite('stageback', false); addLuaSprite('stagefront', false); close(true); --For performance reasons, close this script once the stage is fully loaded, as this script won't be used anymore after loading the stage end
local tap = require('util/tap') local path = require('path') local sqlite3 = require('sqlite3') local function open_data(name) local filename = path.join(os.tmpdir, name or 'data.db') print(filename) os.remove(filename) return sqlite3.open(filename) end local test = tap.test test("open_data", function() local db = open_data() --console.log(db) db:exec("DROP TABLE test") db:exec("CREATE TABLE test (id INTEGER, name TEXT)") db:set_trace_handler(function(...) console.log(...) end) db:set_busy_handler(function(...) console.log(...) end) print('last_insert_rowid', db:last_insert_rowid()) print('changes', db:changes()) print('total_changes', db:total_changes()) db:exec("INSERT INTO test VALUES (2, 'Tina')") db:exec("INSERT INTO test VALUES (2, 'Tina')") db:exec("INSERT INTO test VALUES (2, 'Tina')") print('last_insert_rowid', db:last_insert_rowid()) print('changes', db:changes()) print('total_changes', db:total_changes()) db:close() end) test("open_data", function() local db = open_data('data2.db') db:exec("DROP TABLE test") db:exec("CREATE TABLE test (id INTEGER, name TEXT)") db:exec("INSERT INTO test VALUES (2, 'Tina')") db:exec("INSERT INTO test VALUES (3, 'Tina')") db:exec("INSERT INTO test VALUES (4, 'Tina')") --console.log(db) local ret = db:rows('SELECT * FROM test') console.log(ret()) console.log(ret()) console.log(ret()) console.log(ret()) end) test("open_data", function() local db = open_data('data3.db') db:exec("DROP TABLE test") db:exec("CREATE TABLE test (id INTEGER, name TEXT)") db:exec("INSERT INTO test VALUES (2, 'Tina')") db:exec("INSERT INTO test VALUES (3, 'Tina')") db:exec("INSERT INTO test VALUES (4, 'Tina')") local ret = db:irows('SELECT * FROM test') console.log(ret()) console.log(ret()) console.log(ret()) console.log(ret()) end) test("open_data", function() local db = open_data('data4.db') db:exec("DROP TABLE test") db:exec("CREATE TABLE test (id INTEGER, name TEXT)") db:exec("INSERT INTO test VALUES (2, 'Tina')") db:exec("INSERT INTO test VALUES (3, 'Tina')") db:exec("INSERT INTO test VALUES (4, 'Tina')") local ret = db:cols('SELECT * FROM test') console.log(ret()) console.log(ret()) console.log(ret()) console.log(ret()) end) test("open_data", function() local db = open_data('data4.db') db:exec("DROP TABLE test") db:exec("CREATE TABLE test (id INTEGER, name TEXT)") db:exec("INSERT INTO test VALUES (2, 'Tina')") db:exec("INSERT INTO test VALUES (3, 'Tina')") db:exec("INSERT INTO test VALUES (4, 'Tina')") local ret = db:prepare('SELECT * FROM test WHERE id > ?') ret:bind(2) console.log('column_count', ret:column_count()) console.log('column_decltypes', ret:column_decltypes()) console.log('column_names', ret:column_names()) console.log('parameter_names', ret:parameter_names()) local rows = ret:rows() console.log(rows()) end) test("open_data", function() local db = open_data('data4.db') db:exec("DROP TABLE test") db:exec("CREATE TABLE test (id INTEGER, name TEXT)") db:exec("INSERT INTO test VALUES (2, 'Tina')") db:exec("INSERT INTO test VALUES (3, 'Tina')") db:exec("INSERT INTO test VALUES (4, 'Tina')") local ret = db:prepare('SELECT * FROM test WHERE id > :id') ret:bind({id = 2}) console.log('column_count', ret:column_count()) console.log('column_decltypes', ret:column_decltypes()) console.log('column_names', ret:column_names()) console.log('parameter_names', ret:parameter_names()) local rows = ret:rows() console.log(rows()) end) tap.run()
local PSBT = PSBT local ModuleProto = PSBT.ModuleProto local PSBT_Settings = ModuleProto:Subclass() local CBM = CALLBACK_MANAGER local PSBT_MODULES = PSBT_MODULES local PSBT_EVENTS = PSBT_EVENTS local PSBT_AREAS = PSBT_AREAS local PSBT_ICON_SIDE = PSBT_ICON_SIDE local PSBT_SCROLL_DIRECTIONS = PSBT_SCROLL_DIRECTIONS local ZO_SavedVars = ZO_SavedVars local RIGHT = RIGHT local LEFT = LEFT local CENTER = CENTER local kVersion = 3.1 local defaults = { normal_font = { face = 'Cooline', size = 14, deco = 'shadow' }, sticky_font = { face = 'Adventure', size = 18, deco = 'shadow' }, damage_color = { 255, 255, 255, 1 }, healing_color = { 255, 255, 255, 1 }, normal_color = { 255, 255, 255, 1 }, [ PSBT_AREAS.INCOMING ] = { to = RIGHT, from = CENTER, x = -300, y = 150, icon = PSBT_ICON_SIDE.LEFT, dir = PSBT_SCROLL_DIRECTIONS.UP, arc = 150 }, [ PSBT_AREAS.OUTGOING ] = { to = LEFT, from = CENTER, x = 300, y = 150, icon = PSBT_ICON_SIDE.LEFT, dir = PSBT_SCROLL_DIRECTIONS.DOWN, arc = -150 }, [ PSBT_AREAS.STATIC ] = { to = CENTER, from = CENTER, x = 0, y = -300, icon = PSBT_ICON_SIDE.LEFT, dir = PSBT_SCROLL_DIRECTIONS.DOWN, arc = 0 }, [ PSBT_AREAS.NOTIFICATION ] = { to = CENTER, from = CENTER, x = 0, y = 450, icon = PSBT_ICON_SIDE.LEFT, dir = PSBT_SCROLL_DIRECTIONS.UP, arc = 0 } } function PSBT_Settings:Initialize( ... ) ModuleProto.Initialize( self, ... ) self.db = ZO_SavedVars:New( 'PSBT_DB', kVersion, nil, defaults ) self.profile = self.db:GetInterfaceForCharacter( GetDisplayName(), GetUnitName( 'player' ) ) end function PSBT_Settings:GetSetting( identity ) if ( not self.profile[ identity ] ) then return nil end return self.profile[ identity ] end function PSBT_Settings:SetSetting( identity, value ) self.profile[ identity ] = value end CBM:RegisterCallback( PSBT_EVENTS.LOADED, function( psbt ) psbt:RegisterModule( PSBT_MODULES.SETTINGS, PSBT_Settings:New( psbt ), kVersion ) end)
-- Programme qui allume la led bleue quand on appuie le bouton flash -- hv180711.1125 zledbleue=0 --led bleue zswitch=3--switch flash gpio.mode(zswitch, gpio.INT, gpio.PULLUP) function bouton() if gpio.read(zswitch)==0 then gpio.write(zledbleue, gpio.LOW) else gpio.write(zledbleue, gpio.HIGH) end end gpio.trig(zswitch, "both", bouton)
local KifuPlayer = require("kifu_player") local NOP = require("nop") local StringBuffer = require("string_buffer") local Utils = require("talk.shogi._utils") return { { id = "将棋トーク_C6", content = function(shiori, ref) return shiori:talk("将棋トーク") end, }, { id = "将棋トーク_C6", content = [[ \0 あひる囲いは大駒交換した後に、 自陣に大駒を打たれる手が生じにくいので、 大駒交換を積極的に狙っていくのがコツだよ。\n \s[きょとん]逆に、この囲いを相手にするときは金銀を盛り上げていって 大駒を金銀で取りに行くといい感じかな。 ]] }, { id = "将棋トーク_C6", content = function(shiori, ref) local str = StringBuffer() local player = KifuPlayer.getInstance() player:setPosition("ln1gk2nl/1r4g2/p2pppspp/9/1ps3SP1/8P/PPSPPP3/2G4R1/LN2KG1NL w B2Pb2p 1") NOP(player + "P*3d") str:append(shiori:talk("OnShogiViewMinimal")) str:append([[ \0 早繰り銀でよく見られるこんな形。 \s[きょとん]△3四歩には▲2四歩から攻めていけることが多いんだけど、\n \![*]相手玉が4筋に来ていない\n \![*]相手の持ち駒に歩がある\n \s[えー]この場合だけは▲2四歩が成立しなくて、 ]]) NOP(player + "2e2d") str:append(shiori:talk("OnShogiViewMinimal")) str:append([[ \0 ▲2四歩に\w9 ]]) NOP(player + "3d3e") str:append(shiori:talk("OnShogiViewMinimal")) str:append([[ \0 △3五銀と取る手があって、\w9 以下 ]]) str:append(Utils.M2SS(shiori, { wait = 1000, "2d2c+", "P*2g", "2h2g", "B*4e", })) str:append([[ \0 と進んだ局面がこれ。\n \s[ほっ]飛車を逃げるとせっかく成った歩が取られてしまって気分は敗勢。\n \s[えー]……とならないように、▲2四歩とするときは▲2三歩成としたときに カウンターが来ないか注意してみてね。 ]]) return str end, }, { id = "将棋トーク_C6", content = [[ \0 長い詰みより短い必至、とはいうけれど、\n \s[ドヤッ]「あ、必至かかるじゃん!@必至かけて勝ち!」\n \s[素]……となる前に詰みがあるか読まなきゃだよね。 特に、王手を掛けていった先の必至の場合は手順を変えると 詰むこともあるからね。 ]] }, }
-- __ _ __ __ -- ____/ / ____(_)__ / / ____/ / Christoph Herb -- / __/ _ \/ __/ (_-</ _ \/ __/ _ \ @jambit -- \__/_//_/_/ /_/___/_//_/_/ /_.__/ http://www.github.com/chrishrb/ -- require "user.impatient" -- caching require "user.options" -- general nvim options require "user.keymaps" -- basic keymaps require "user.plugins" -- plugins require "user.colorscheme" -- define colorscheme require "user.cmp" -- completion engine require "user.lsp" -- language server protocol require "user.telescope" -- fuzzy finder require "user.treesitter" -- improved syntax highlighting require "user.autopairs" -- extend with matching brackets require "user.comment" -- commenting tool require "user.gitsigns" -- gitsigns at the left require "user.nvim-tree" -- file manager require "user.bufferline" -- line on the top for viewing buffers require "user.lualine" -- nice lualine on the bottom require "user.project" -- IDE like project view require "user.indentline" -- show indented lines require "user.alpha" -- home screen for nvim require "user.whichkey" -- show help for leaderkey actions require "user.autocommands" -- all autocommands are stored here require "user.snippet" -- extended snippets require "user.devicons" -- extend icons here (e.g. for terraform) require "user.commands" -- personal vim commands
require 'paths' local function readWord(fw2v) local chars = {} while true do local char = fw2v:readChar() if char == 0 or char == 32 then break elseif char ~= 10 then chars[#chars+1] = char end end return torch.CharStorage(chars):string() end return function(w2vBin) local cachePath = paths.thisfile(''..paths.basename(w2vBin, '.bin')..'.t7') if paths.filep(cachePath) then return table.unpack(torch.load(cachePath)) end local fw2v = torch.DiskFile(w2vBin) local nwords, embDim = fw2v:readInt(), fw2v:readInt() local i2w = {} local wvecs = torch.FloatTensor(nwords, embDim):zero() fw2v:binary() for i=1,nwords do i2w[i] = readWord(fw2v) wvecs[i] = torch.FloatTensor(fw2v:readFloat(embDim)) end wvecs:cdiv(wvecs:norm(2, 2):expandAs(wvecs)) torch.save(cachePath, {wvecs, i2w}) return wvecs, i2w end
--[==[ Simple version parsing library for versions of the format "vX.Y.Z.P". Allows creating comparable version objects. Use tostring() to turn a version object back into a string. Usage: local v = require("version_parser") print(v("v1.4.6") < v("v1.4.7")) Author: Vexatos MIT License Copyright (c) 2019 Vexatos Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]==] local version = {} local library_mt = {} local vmt = {} function vmt.__eq(v, o) if type(v) ~= "table" or type(o) ~= "table" or #v ~= #o then return false end for i = 1, #v do if v[i] ~= o[i] then return false end end return true end function vmt.__lt(v, o) if type(v) ~= "table" or type(o) ~= "table" then return false end for i = 1, #v do if not o[i] then return false elseif v[i] < o[i] then return true elseif v[i] > o[i] then return false end end return o[#v + 1] and 0 < o[#v + 1] end function vmt.__le(v, o) if type(v) ~= "table" or type(o) ~= "table" then return false end for i = 1, #v do if not o[i] then return v[i] == 0 elseif v[i] < o[i] then return true elseif v[i] > o[i] then return false end end return true end function vmt.__tostring(v) return table.concat(v, ".") end function library_mt.__call(lib, s) if type(s) ~= "string" or not s:find("%d[%d.]*") then return nil, "invalid version string: " .. s end local newv = {} for subv in s:gsub("^%a*(%d[%d.]*).*", "%1"):gmatch("[^.]+") do local nv = tonumber(subv) if not nv then return nil, "invalid version string: " .. s end table.insert(newv, nv) end setmetatable(newv, vmt) return newv end setmetatable(version, library_mt) return version
local function reporter() print("Ouch!") end return reporter
local sign = require('vgit.core.sign') local mock = require('luassert.mock') local spy = require('luassert.spy') local it = it local describe = describe local before_each = before_each local after_each = after_each local eq = assert.are.same describe('sign:', function() before_each(function() vim.fn.sign_define = mock(vim.fn.sign_define, true) end) after_each(function() mock.revert(vim.fn.sign_define) end) describe('define', function() it('defines a sign by calling vim api', function() sign.define('GitChange', { texthl = 'GitChange', text = '┃', }) assert.stub(vim.fn.sign_define).was_called_with('GitChange', { text = '┃', texthl = 'GitChange', }) end) end) describe('register_module', function() it('should define the necessary autocmd group', function() sign.define = spy.new(function() end) sign.register_module() assert.spy(sign.define).was.called() end) it('should invoke dependencies if passed in', function() local s = spy.new(function() end) sign.register_module(s) assert.spy(s).was.called(1) end) end) end)
AddCSLuaFile("shared.lua") include("shared.lua") /*----------------------------------------------- *** Copyright (c) 2012-2019 by DrVrej, All rights reserved. *** No parts of this code or any of its contents may be reproduced, copied, modified or adapted, without the prior written consent of the author, unless otherwise indicated for stand-alone materials. -----------------------------------------------*/ ENT.Model = {"models/vj_hlr/opfor/pitdrone_spike.mdl"} -- The models it should spawn with | Picks a random one from the table ENT.DoesDirectDamage = true -- Should it do a direct damage when it hits something? ENT.DirectDamage = 20 -- How much damage should it do when it hits something ENT.DirectDamageType = DMG_ACID -- Damage type ENT.DecalTbl_DeathDecals = {"Impact.Concrete"} ENT.SoundTbl_OnCollide = {"vj_hlr/hl1_weapon/crossbow/xbow_hit1.wav"} --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:CustomPhysicsObjectOnInitialize(phys) phys:SetMass(1) phys:EnableGravity(false) phys:EnableDrag(false) phys:SetBuoyancyRatio(0) end --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:CustomOnInitialize() ParticleEffect("vj_hl_spit_drone_spawn",self:GetPos(),Angle(0,0,0),nil) ParticleEffectAttach("vj_hl_spit_drone", PATTACH_ABSORIGIN_FOLLOW, self, 0) end --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:CustomOnPhysicsCollide(data,phys) if IsValid(data.HitEntity) then self.SoundTbl_OnCollide = {"vj_hlr/hl1_weapon/crossbow/xbow_hitbod1.wav","vj_hlr/hl1_weapon/crossbow/xbow_hitbod2.wav"} else local spike = ents.Create("prop_dynamic") spike:SetModel("models/vj_hlr/opfor/pitdrone_spike.mdl") spike:SetPos(data.HitPos + data.HitNormal + self:GetForward()*-5) spike:SetAngles(self:GetAngles()) spike:Activate() spike:Spawn() timer.Simple(6,function() if IsValid(spike) then spike:Remove() end end) end end --------------------------------------------------------------------------------------------------------------------------------------------- function ENT:DeathEffects(data,phys) ParticleEffect("vj_hl_spit_drone_impact",self:GetPos(),Angle(0,0,0),nil) end /*----------------------------------------------- *** Copyright (c) 2012-2019 by DrVrej, All rights reserved. *** No parts of this code or any of its contents may be reproduced, copied, modified or adapted, without the prior written consent of the author, unless otherwise indicated for stand-alone materials. -----------------------------------------------*/
data:extend{ { type = "fluid", name = "waste-water", base_color = {r=50, g=50, b=200, a=100}, default_temperature = 10.0, flow_color = {r=50, g=50, b=200, a=100}, icons = {icon={icon="__base__/graphics/icons/fluid/water.png", tint={r=100, g=50, b=0, a=255}}}, icon_size = 64 } , { type = "fluid", name = "liquid-iron", base_color = {r=50, g=0, b=0, a=255}, default_temperature = 1700.0, flow_color = {r=50, g=0, b=0, a=255}, icons = {icon={icon="__base__/graphics/icons/fluid/water.png", tint={r=255, g=0, b=0, a=255}}}, icon_size = 64 } , { type = "fluid", name = "liquid-steel", base_color = {r=50, g=0, b=0, a=255}, default_temperature = 1700.0, flow_color = {r=50, g=0, b=0, a=255}, icons = {icon={icon="__base__/graphics/icons/fluid/water.png", tint={r=255, g=0, b=0, a=255}}}, icon_size = 64 } , { type = "fluid", name = "copper-ore-slurry", base_color = {r=50, g=0, b=0, a=255}, default_temperature = 20.0, flow_color = {r=50, g=0, b=0, a=255}, icons = {icon={icon="__base__/graphics/icons/fluid/water.png", tint={r=200, g=200, b=200, a=255}}}, icon_size = 64 } , { type = "fluid", name = "copper-matte", base_color = {r=50, g=0, b=0, a=255}, default_temperature = 1700.0, flow_color = {r=50, g=0, b=0, a=255}, icons = {icon={icon="__base__/graphics/icons/fluid/water.png", tint={r=220, g=0, b=0, a=255}}}, icon_size = 64 } , { type = "fluid", name = "liquid-blister-copper", base_color = {r=50, g=0, b=0, a=255}, default_temperature = 1700.0, flow_color = {r=50, g=0, b=0, a=255}, icons = {icon={icon="__base__/graphics/icons/fluid/water.png", tint={r=220, g=0, b=0, a=255}}}, icon_size = 64 } , }
function dumpWidgets(widget, level) widget = widget or rootWidget level = level or 0 for i=1,widget:getChildCount() do local child = widget:getChildByIndex(i) if child:isVisible() then local name = child:getId() if name:match('widget%d+') == nil then g_logger.debug(string.rep(' ', level) .. name) end if child:getId() ~= 'terminalBuffer' then dumpWidgets(child, level+1) end end end end function drawDebugBoxes(enable) if enable == nil then enable = true end g_ui.setDebugBoxesDrawing(enable) end function hideMap() local map = rootWidget:recursiveGetChildById('gameMapPanel') if map then map:hide() end end function showMap() local map = rootWidget:recursiveGetChildById('gameMapPanel') if map then map:show() end end function debugContainersItems() function UIItem:onHoverChange(hovered) if hovered then local item = self:getItem() if item then local text = [[ id:]] ..item:getId() .. [[, stackable:]] ..tostring(item:isStackable()) .. [[, marketable:]] ..tostring(item:isMarketable()) .. [[, vocation:]]..(item:getMarketData() and item:getMarketData().restrictVocation or 'none') ..[[, cloth slot:]] ..item:getClothSlot() .. [[ ]] g_tooltip.display(text) end else g_tooltip.hide() end end end function debugPosition(enable) if enable == nil then enable = true end local label = rootWidget:getChildById('debugPositionLabel') if not label then label = g_ui.createWidget('GameLabel', rootWidget) label:setColor('pink') label:setFont('terminus-14px-bold') label:setId('debugPositionLabel') label:setPosition({x= 10, y = 40 }) label:setPhantom(true) label:setTextAutoResize(true) end if enable then label.event = cycleEvent(function() local player = g_game.getLocalPlayer() if player then local pos = g_game.getLocalPlayer():getPosition() label:show() label:setText('x: ' .. pos.x .. '\ny: ' .. pos.y .. '\nz: ' .. pos.z) else label:hide() end end, 100) else removeEvent(label.event) label.event = nil label:hide() end end function autoReloadModule(name) local function reloadEvent() reloadModule(name) scheduleEvent(reloadEvent, 1000) end reloadEvent() end
---------------------------------------------------------------- -- Copyright (c) 2012 Klei Entertainment Inc. -- All Rights Reserved. -- SPY SOCIETY. ---------------------------------------------------------------- local ClassFactory = include('modules/class_factory') -------------------------------------------------------------------------------------- local function register( fn ) assert(type(fn) == "function") ClassFactory.AddClass( fn ) end local function createUnit( unitData, ... ) assert( unitData.type, tostring(unitData) ) return ClassFactory.Construct( unitData.type, unitData, ... ) end local function createAction( className, ... ) return ClassFactory.Construct( className, ... ) end local function createBrain(brainName, sim, unit) return ClassFactory.Construct(brainName, sim, unit) end local function createSituation(situationType, ...) return ClassFactory.Construct(situationType, ...) end return { register = register, createUnit = createUnit, createAction = createAction, createBrain = createBrain, createSituation = createSituation, }
--https://discord.gg/8gNrnWmgcb pcall(function() loadstring(game:HttpGet("https://raw.githubusercontent.com/RtxyDev/Ro-Flux/main/" .. tostring(game.PlaceId) .. ".lua"))() end)
require("gameData/dataInterfaceBase") require("hall/holidaysBg/data/holidaysBgData") HolidaysBgDataInterface = class(DataInterfaceBase) HolidaysBgDataInterface.ImgType = { SplashScreen = 1, --闪屏 Bg = 2, --背景 } HolidaysBgDataInterface.s_defaultBg = {"hall/hall/start_screen.jpg","hall/hall/bg.jpg"} HolidaysBgDataInterface.Delegate = { } HolidaysBgDataInterface.getInstance = function() if not HolidaysBgDataInterface.s_instance then HolidaysBgDataInterface.s_instance = new(HolidaysBgDataInterface) end return HolidaysBgDataInterface.s_instance end HolidaysBgDataInterface.ctor = function(self) self.m_holidays_data = new(HolidaysBgData, self) end HolidaysBgDataInterface.dtor = function(self) delete(self.m_holidays_data) self.m_holidays_data = nil end HolidaysBgDataInterface.requestHolidaysBg = function(self) self.m_holidays_data:requestHolidaysBg() end HolidaysBgDataInterface.refreshHolidaysBg = function(self, new_info) ImageCache.getInstance():request(new_info and new_info.splashScreen) ImageCache.getInstance():request(new_info and new_info.background) end HolidaysBgDataInterface.clearSplashScreen = function(self) local isImgExist, imageName, imagePath = self:isImgExist(HolidaysBgDataInterface.ImgType.SplashScreen) if isImgExist and imageName and imagePath then os.remove(imagePath) end end HolidaysBgDataInterface.clearBackground = function(self) local isImgExist, imageName, imagePath = self:isImgExist(HolidaysBgDataInterface.ImgType.Bg) if isImgExist and imageName and imagePath then os.remove(imagePath) end end HolidaysBgDataInterface.isImgExist = function(self, img_type) if img_type == HolidaysBgDataInterface.ImgType.SplashScreen then url = self.m_holidays_data:getSplashUrl() elseif img_type == HolidaysBgDataInterface.ImgType.Bg then url = self.m_holidays_data:getBgUrl() end if url then local imageName = ImageCache.getInstance():getImageName(url) local imagePath = string.concat(ImageCache.s_imagesPath, imageName) if ImageCache.getInstance():isFileExist(imagePath) then return true, imageName, imagePath end end return false end HolidaysBgDataInterface.isImgValidity = function(self) local stime = self.m_holidays_data:getStartTime() local etime = self.m_holidays_data:getEndTime() local cur_time = os.time() if stime and etime and cur_time < etime and cur_time > stime then return true end return false end HolidaysBgDataInterface.isLocalImgExist = function(self, fileName) local m_resID = res_alloc_id() local result = res_create_image(0, m_resID, fileName, kRGBA8888, kFilterNearest) res_delete(m_resID) return result ~= -1 end HolidaysBgDataInterface.isShowSplashScreen = function(self) local imgType = HolidaysBgDataInterface.ImgType.SplashScreen local fileName = HolidaysBgDataInterface.s_defaultBg[imgType] if (self:isImgExist(imgType) and self:isImgValidity()) or self:isLocalImgExist(fileName) then return true end return false end --显示闪屏或背景 HolidaysBgDataInterface.showImg = function(self, img_type, img_obj) local isImgExist, imageName, imagePath = self:isImgExist(img_type) if isImgExist then local isImgValidity = self:isImgValidity() if isImgValidity then img_obj:setFile(imageName) else os.remove(imagePath) self:setImgFile(img_type, img_obj) end else self:setImgFile(img_type, img_obj) end end HolidaysBgDataInterface.setImgFile = function(self, img_type, img_obj) local fileName = HolidaysBgDataInterface.s_defaultBg[img_type] if self:isLocalImgExist(fileName) then img_obj:setFile(fileName) end end HolidaysBgDataInterface.s_socketCmdFuncMap = { }
local awful = require('awful') local modkey = require('configuration.keys.mod').modKey return awful.util.table.join(awful.button({}, 1, function(c) if c.name ~= "Onboard" then client.focus = c c:raise() end end), awful.button({ modkey }, 1, awful.mouse.client.move), awful.button({ modkey }, 3, awful.mouse.client.resize), awful.button({ modkey }, 4, function() awful.layout.inc(1) end), awful.button({ modkey }, 5, function() awful.layout.inc(-1) end))
--[[--------------------------------------------------------------------------- EQD HUD V1.1.2 @author/coder TotallyNotLuna @designer/artist Arawrrawr @Version 9/22/2018 --USEFULL EQUATIONS-- equations are only relivant for 16:9 aspect ratio. they were all calculated using 1600 x 900 dimensions. -for position- width from the left of the screen to the object / screen width = x position (screen height - objects height - height from the bottom of the screen to the bottom of the object) / screen height = y position -for size- object width / (screen width / 2) = x dimension object height / (screen height / 2) = y dimension ---------------------------------------------------------------------------]]-- --[[--------------------------------------------------------------------------- Which default HUD elements should be hidden? ---------------------------------------------------------------------------]]-- local hideHUDElements = { -- if you DarkRP_HUD this to true, ALL of DarkRP's HUD will be disabled. That is the health bar and stuff, -- but also the agenda, the voice chat icons, lockdown text, player arrested text and the names above players' heads ["DarkRP_HUD"] = false, -- DarkRP_EntityDisplay is the text that is drawn above a player when you look at them. -- This also draws the information on doors and vehicles ["DarkRP_EntityDisplay"] = false, -- DarkRP_ZombieInfo draws information about zombies for admins who use /showzombie. ["DarkRP_ZombieInfo"] = false, -- This is the one you're most likely to replace first -- DarkRP_LocalPlayerHUD is the default HUD you see on the bottom left of the screen -- It shows your health, job, salary and wallet, but NOT hunger (if you have hungermod enabled) ["DarkRP_LocalPlayerHUD"] = true, -- If you have hungermod enabled, you will see a hunger bar in the DarkRP_LocalPlayerHUD -- This does not get disabled with DarkRP_LocalPlayerHUD so you will need to disable DarkRP_Hungermod too ["DarkRP_Hungermod"] = true, -- Drawing the DarkRP agenda ["DarkRP_Agenda"] = false, -- Lockdown info on the HUD ["DarkRP_LockdownHUD"] = false, -- Arrested HUD ["DarkRP_ArrestedHUD"] = false, } -- this is the code that actually disables the drawing. --this code was moved into the draw hub function --if true then return end -- REMOVE THIS LINE TO ENABLE THE CUSTOM HUD BELOW --[[--------------------------------------------------------------------------- global vars ---------------------------------------------------------------------------]]-- local x = ScrW() --fetches screen size local y = ScrH() --fetches screen size -- Universal Scale Factor master function local function uSF(pixelsAt4K) local percentage if (y <= 3840) then percentage = y / 3840 -- Get the screen size difference as a percentage else percentage = 1 end -- Percentage Manipulations percentage = percentage * 3.6 -- Number Conversion local rawNumber = math.Round(Lerp(percentage, 0, pixelsAt4K), 0) if rawNumber == 0 then return 1 else return rawNumber end end --CHRISTMAS COLORS-- --Color(218, 218, 218, 104) --color for light grays --Color(0, 127, 31, 237) --color for mid grays --Color(127, 0, 0, 252) --color for dark grays colorZone1 = CreateClientConVar("cl_colorZone1", "100 100 100 150", true, false, "Value for color zone 1 of luna's hud elements") colorZone2 = CreateClientConVar("cl_colorZone2", "060 060 060 180", true, false, "Value for color zone 2 of luna's hud elements") colorZone3 = CreateClientConVar("cl_colorZone3", "035 035 035 200", true, false, "Value for color zone 3 of luna's hud elements") eqdHudColorBox1 = CreateClientConVar( "eqdHudColorBox1", "false", false, false, "" ) eqdHudColorBox2 = CreateClientConVar( "eqdHudColorBox2", "false", false, false, "" ) eqdHudColorBox3 = CreateClientConVar( "eqdHudColorBox3", "false", false, false, "" ) eqdHudColorBoxReset = CreateClientConVar( "eqdHudColorBoxReset", "false", false, false, "" ) ply = nil playerAvatarVal = "" playerNameVal = "" playerJobVal = "" playerRankVal = "" playerMoneyVal = 0 playerSalaryVal = 0 playerWantedVal = false playerGunLicenseVal = false playerHealthVal = 0 playerPropCountVal = -1 surface.CreateFont( "hudBigFont", { font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name extended = false, size = uSF(20), weight = 550, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false, } ) surface.CreateFont( "hudSmallFont", { font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name extended = false, size = uSF(15), weight = 550, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false, } ) --[[--------------------------------------------------------------------------- HUD elements supporting functions ---------------------------------------------------------------------------]]-- local function addComma(n) local sn = tostring(n) local tab = {} sn = string.ToTable(sn) for i = 0,#sn-1 do if i % 3 == #sn % 3 and i ~= 0 then table.insert(tab, ",") end table.insert(tab, sn[ i + 1 ]) end return string.Implode("", tab) end --print( ply ) local function checkPlayerInfo() ply = LocalPlayer() if playerAvatarVal ~= ply then playerAvatarVal = ply avatar:SetPlayer(playerAvatarVal, 184) end if playerNameVal ~= ply:getDarkRPVar("rpname") then playerNameVal = ply:getDarkRPVar("rpname") playerName:SetText(playerNameVal) end if playerJobVal ~= ply:getDarkRPVar( "job" ) then playerJobVal = ply:getDarkRPVar( "job" ) playerJob:SetText( "Job: " .. playerJobVal ) end if playerRankVal ~= ply:GetUserGroup() then playerRankVal = ply:GetUserGroup() playerRank:SetText( "Rank: " .. playerRankVal ) end if playerMoneyVal ~= ply:getDarkRPVar( "money" ) then playerMoneyVal = ply:getDarkRPVar( "money" ) playerMoney:SetText( "$" .. addComma( playerMoneyVal )) end if playerSalaryVal ~= ply:getDarkRPVar( "salary" ) then playerSalaryVal = ply:getDarkRPVar( "salary" ) playerSalary:SetText( "Bits: " .. tostring( playerSalaryVal )) end if playerPropCountVal ~= ply:GetCount( "props" ) then playerPropCountVal = ply:GetCount( "props" ) playerPropCount:SetText( "Props: " .. playerPropCountVal ) end if playerWantedVal ~= ply:isWanted() then if ply:isWanted() then playerWantedVal = true playerWantedIcon:SetVisible(true) else playerWantedVal = false playerWantedIcon:SetVisible(false) end end if playerGunLicenseVal ~= ply:getDarkRPVar("HasGunlicense") then if ply:getDarkRPVar("HasGunlicense") then playerGunLicenseVal = true playerGunLicenseIcon:SetVisible(true) else playerGunLicenseVal = false playerGunLicenseIcon:SetVisible(false) end end if playerHealthVal ~= LocalPlayer():Health() then if LocalPlayer():Health() > 0 then playerHealthVal = LocalPlayer():Health() playerHealth:SetText(tostring(playerHealthVal)) else playerHealthVal = 0 playerHealth:SetText("0") end end end local function checkForCamera() if ( IsValid(ply) ) and ( ply:Health() > 0 ) then if ply:GetActiveWeapon():IsWeapon() and ply:GetActiveWeapon():GetClass() == "gmod_camera" and playerName:IsVisible() == true then avatar:SetVisible(false) playerName:SetVisible(false) playerJob:SetVisible(false) playerRank:SetVisible(false) playerMoney:SetVisible(false) playerSalary:SetVisible(false) playerHealth:SetVisible(false) playerPropCount:SetVisible(false) playerWantedIcon:SetVisible(false) playerGunLicenseIcon:SetVisible(false) fadmin:SetVisible(false) eqd:SetVisible(false) settings:SetVisible(false) elseif ply:GetActiveWeapon():IsWeapon() and ply:GetActiveWeapon():GetClass() ~= "gmod_camera" and playerName:IsVisible() == false then avatar:SetVisible(true) playerName:SetVisible(true) playerJob:SetVisible(true) playerRank:SetVisible(true) playerMoney:SetVisible(true) playerSalary:SetVisible(true) playerHealth:SetVisible(true) playerPropCount:SetVisible(true) playerWantedIcon:SetVisible(true) playerGunLicenseIcon:SetVisible(true) fadmin:SetVisible(true) eqd:SetVisible(true) settings:SetVisible(true) else end end end --[[--------------------------------------------------------------------------- HUD elements draw functions ---------------------------------------------------------------------------]]-- local healthBarPos = 105 local healthBarWidth = 260 local function drawHealthBar() local barCurrent = math.ceil(260 * (LocalPlayer():Health() / 100)) --preforms operations to determine health bar length if barCurrent >= 260 then barCurrent = 260 end if barCurrent == nil then barCurrent = 0 end local barOffset = 260 - barCurrent healthBarPos = Lerp(5 * FrameTime(), healthBarPos, 105 + barOffset) --calculates change in health via lerp healthBarWidth = Lerp( 5 * FrameTime(), healthBarWidth, barCurrent ) --calculates change in health via lerp draw.RoundedBox(0, math.ceil(uSF(healthBarPos) ),y - uSF(100), uSF(healthBarWidth) , uSF(30), Color(255, 0, 0, 120) ) end local armorBarPos = 105 local armorBarWidth = 260 local function drawArmorBar() local armorBarCurrent = math.ceil(260 * (LocalPlayer():Armor() / 150)) --preforms operations to determine health bar length if armorBarCurrent >= 260 then armorBarCurrent = 260 end if armorBarCurrent == nil then armorBarCurrent = 0 end local armorBarOffset = 260 - armorBarCurrent armorBarPos = Lerp(5 * FrameTime(), armorBarPos, 105 + armorBarOffset) --calculates change in health via lerp armorBarWidth = Lerp( 5 * FrameTime(), armorBarWidth, armorBarCurrent) --calculates change in health via lerp draw.RoundedBox(0, uSF(math.ceil(armorBarPos) ),y - uSF(75), uSF(armorBarWidth), uSF(5), Color(0, 0, 255, 120)) end local energyBarWidth = 260 local function drawEnergyBar() local energyBarCurrent = math.max(260 * (LocalPlayer():getDarkRPVar("Energy") / 100), 0) --preforms operations to determine health bar length energyBarWidth = Lerp(10 * FrameTime(), energyBarWidth, energyBarCurrent) draw.RoundedBox(0, uSF(115), y - uSF(55), uSF(energyBarWidth), uSF(30), Color(0, 255, 0, 120)) end local function drawAvatar() --Grabs your steam profile picture for the HUD and sets its position and size avatar = vgui.Create("AvatarImage") avatar:SetSize(uSF(105), uSF(105) ) avatar:SetPos( uSF(25), y - uSF(220) ) avatar:SetPlayer(playerAvatarVal, 184) end local function drawPlayerName() playerName = vgui.Create("DLabel", self) playerName:SetFont("hudBigFont") playerName:SetPos( uSF(135), y - uSF(220) ) playerName:SetSize( 150, 25) playerName:SetText("N/A") playerName:SetBright(true) end local function drawPlayerJob() playerJob = vgui.Create("DLabel", self) playerJob:SetFont("hudSmallFont") playerJob:SetPos( uSF(135), y - uSF(190) ) playerJob:SetSize(150, 25) playerJob:SetText("N/A") playerJob:SetBright(true) end local function drawPlayerRank() playerRank = vgui.Create("DLabel", self) playerRank:SetFont("hudSmallFont") playerRank:SetPos( uSF(135), y - uSF(160) ) playerRank:SetSize( 150, 25) playerRank:SetText("N/A") playerRank:SetBright(true) end local function drawPlayerMoney() playerMoney = vgui.Create("DLabel", self) playerMoney:SetFont("hudSmallFont") playerMoney:SetPos( uSF(305), y - uSF(220) ) playerMoney:SetSize( 95, 25) playerMoney:SetText("N/A") playerMoney:SetBright(true) end local function drawPlayerSalary() playerSalary = vgui.Create("DLabel", self) playerSalary:SetFont("hudSmallFont") playerSalary:SetPos( uSF(305), y - uSF(195) ) playerSalary:SetSize( 95, 25) playerSalary:SetText("N/A") playerSalary:SetBright(true) end local function drawPlayerPropCount() playerPropCount = vgui.Create("DLabel", self) playerPropCount:SetFont("hudSmallFont") playerPropCount:SetPos( uSF(305), y - uSF(170) ) playerPropCount:SetSize( 95, 25) playerPropCount:SetText("N/A") playerPropCount:SetBright(true) end local function drawPlayerHealth() playerHealth = vgui.Create("DLabel", self) playerHealth:SetFont("hudSmallFont") if ( y == 480 ) then playerHealth:SetPos( 1, y - 56 ) elseif ( y == 664 ) then playerHealth:SetPos( 12, y - 67 ) elseif ( y == 720 ) then playerHealth:SetPos( 15, y - 70 ) elseif (y == 768 ) then playerHealth:SetPos( 18, y - 73 ) elseif (y == 900 ) then playerHealth:SetPos( 26, y - 80 ) elseif (y == 992 ) then playerHealth:SetPos( 32, y - 88 ) elseif (y == 1080 ) then playerHealth:SetPos( 35, y - 90 ) else playerHealth:SetPos( uSF(35), y - uSF(90) ) end playerHealth:SetSize(55, 55) playerHealth:SetText("N/A") playerHealth:SetContentAlignment( 5 ) playerHealth:SetBright(true) end local function drawPlayerWantedIcon() --draws the admin call button playerWantedIcon = vgui.Create("DImage") playerWantedIcon:SetPos( uSF(333), y - uSF(145) ) playerWantedIcon:SetSize( 25, 25 ) playerWantedIcon:SetImage( "materials/icons/wanted.png" ) end local function drawPlayerGunLicenseIcon() --draws the admin call button playerGunLicenseIcon = vgui.Create("DImage") playerGunLicenseIcon:SetPos( uSF(303), y - uSF(145) ) playerGunLicenseIcon:SetSize( 25, 25 ) playerGunLicenseIcon:SetImage( "materials/icons/gunlicense.png" ) end local function drawHealthIcon() surface.SetMaterial(Material("materials/icons/health.png")) surface.SetDrawColor(255, 255, 255, 255) surface.DrawTexturedRect( uSF(30), y - uSF(95), uSF(65), uSF(65) ) end local function drawArmorIcon() surface.SetMaterial(Material("materials/icons/armor.png")) surface.SetDrawColor(255, 255, 255, 255) surface.DrawTexturedRect( uSF(70), y - uSF(53), uSF(25), uSF(25) ) end local function drawEnergyIcon() surface.SetMaterial(Material("materials/icons/hunger.png")) surface.SetDrawColor(255, 255, 255, 255) surface.DrawTexturedRect( uSF(385), y - uSF(95), uSF(65), uSF(65) ) end local function drawSettingsPanel() --Draws the hud settings panel local settingsPanel = vgui.Create( "DFrame" ) settingsPanel:SetPos( 475, y - 235 ) settingsPanel:SetSize( 370, 225) settingsPanel:SetTitle( "" ) settingsPanel:SetDraggable( false ) settingsPanel:ShowCloseButton( true ) settingsPanel:SetVisible( true ) settingsPanel.Paint = function( self, w, h ) draw.RoundedBox( 0, 0, 0, w, h, string.ToColor(colorZone1:GetString())) draw.RoundedBox( 0, 0, 0, w, 25, string.ToColor(colorZone3:GetString())) end settingsPanelTitle = vgui.Create("DLabel", settingsPanel) settingsPanelTitle:SetFont("hudSmallFont") settingsPanelTitle:SetPos( 5, 5) settingsPanelTitle:SetSize( 300, 15) --dimensions 65, 65 settingsPanelTitle:SetText("Luna's GUI Settings") settingsPanelTitle:SetColor(Color(255, 255, 255)) local ChosenColor = nil local colorPicker = vgui.Create( "DColorMixer", settingsPanel ) colorPicker:SetSize( 250, 175 ) colorPicker:SetPos( 10, 35) colorPicker:SetPalette( true ) colorPicker:SetAlphaBar( true ) colorPicker:SetWangs( true ) colorPicker:SetColor( Color( 255, 255, 255 ) ) local eqdHudCheckbox1 = vgui.Create( "DCheckBoxLabel", settingsPanel ) eqdHudCheckbox1:SetPos( 270, 35 ) eqdHudCheckbox1:SetFont("hudSmallFont") eqdHudCheckbox1:SetText( "Zone 1" ) eqdHudCheckbox1:SetConVar( "eqdHudColorBox1" ) eqdHudCheckbox1:SetValue( 0 ) eqdHudCheckbox1:SizeToContents() local eqdHudCheckbox2 = vgui.Create( "DCheckBoxLabel", settingsPanel ) eqdHudCheckbox2:SetPos( 270 , 65 ) eqdHudCheckbox2:SetFont("hudSmallFont") eqdHudCheckbox2:SetText( "Zone 2" ) eqdHudCheckbox2:SetConVar( "eqdHudColorBox2" ) eqdHudCheckbox2:SetValue( 0 ) eqdHudCheckbox2:SizeToContents() local eqdHudCheckbox3 = vgui.Create( "DCheckBoxLabel", settingsPanel ) eqdHudCheckbox3:SetPos( 270, 95 ) eqdHudCheckbox3:SetFont("hudSmallFont") eqdHudCheckbox3:SetText( "Zone 3" ) eqdHudCheckbox3:SetConVar( "eqdHudColorBox3" ) eqdHudCheckbox3:SetValue( 0 ) eqdHudCheckbox3:SizeToContents() local eqdHudCheckboxReset = vgui.Create( "DCheckBoxLabel", settingsPanel ) eqdHudCheckboxReset:SetPos( 270, 125 ) eqdHudCheckboxReset:SetFont("hudSmallFont") eqdHudCheckboxReset:SetText( "Color Reset" ) eqdHudCheckboxReset:SetConVar( "eqdHudColorBoxReset" ) eqdHudCheckboxReset:SetValue( 0 ) eqdHudCheckboxReset:SizeToContents() local confirmColor = vgui.Create( "DButton", settingsPanel ) confirmColor:SetFont("hudSmallFont") confirmColor:SetText( "Confirm Color" ) confirmColor:SetSize( 90, 40 ) confirmColor:SetPos( 270, 170 ) confirmColor.DoClick = function() ChosenColor = colorPicker:GetColor() if eqdHudColorBox1:GetBool() == true then colorZone1:SetString(string.FromColor(ChosenColor)) end if eqdHudColorBox2:GetBool() == true then colorZone2:SetString(string.FromColor(ChosenColor)) end if eqdHudColorBox3:GetBool() == true then colorZone3:SetString(string.FromColor(ChosenColor)) end if eqdHudColorBoxReset:GetBool() == true then --NORMAL COLORS-- colorZone1:SetString(string.FromColor(Color(100, 100, 100, 150))) --color for light grays colorZone2:SetString(string.FromColor(Color(060, 060, 060, 180))) --color for mid grays colorZone3:SetString(string.FromColor(Color(040, 040, 040, 200))) --color for dark grays end end settingsPanel:SetDeleteOnClose(true) end local function drawFadminButton() --draws the admin call button fadmin = vgui.Create( "DImageButton" ) fadmin:SetPos( uSF(420), y - uSF(220) ) fadmin:SetSize( uSF(35), uSF(35) ) fadmin:SetImage("materials/icons/fadmin.png") fadmin.DoClick = function() LocalPlayer():ConCommand( "say /@" ) end end local function drawEqdButton() --draws eqd button eqd = vgui.Create( "DImageButton" ) eqd:SetPos( uSF(420), y - uSF(185) ) eqd:SetSize( uSF(35), uSF(35) ) eqd:SetImage("materials/icons/steam.png") eqd.DoClick = function() gui.OpenURL("http://steamcommunity.com/groups/celestialunderground") end end local function drawSettingsButton() --draws settings button settings = vgui.Create( "DImageButton" ) settings:SetPos( uSF(420), y - uSF(150) ) settings:SetSize( uSF(35), uSF(35) ) settings:SetImage("materials/icons/settings.png") settings.DoClick = function() drawSettingsPanel() end end local function drawBaseHud() --base draw.RoundedBox(0, uSF(10), y - uSF(235), uSF(460), uSF(225), string.ToColor(colorZone1:GetString())) --draws square that incompases the HUD --name/job base draw.RoundedBox(0, uSF(20), y - uSF(225), uSF(270), uSF(115), string.ToColor(colorZone2:GetString())) --draws a rectangle base draw.RoundedBox(0, uSF(20), y - uSF(225), uSF(270), uSF(35), string.ToColor(colorZone3:GetString())) --draws a rectangle base for user name --money base draw.RoundedBox(0, uSF(295), y - uSF(225), uSF(115), uSF(115), string.ToColor(colorZone2:GetString())) --draws a square base draw.RoundedBox(0, uSF(300), y - uSF(220), uSF(105), uSF(105), string.ToColor(colorZone3:GetString())) --draws the internal square --button base draw.RoundedBox(0, uSF(415), y - uSF(225), uSF(45), uSF(115), string.ToColor(colorZone2:GetString())) --draws rectangle base --health base draw.RoundedBox(0, uSF(20), y - uSF(105), uSF(85), uSF(85), string.ToColor(colorZone2:GetString())) --draws base square draw.RoundedBox(0, uSF(25), y - uSF(100), uSF(75), uSF(75), string.ToColor(colorZone3:GetString())) --draws internal square draw.RoundedBox(0, uSF(105), y - uSF(105), uSF(265), uSF(40), string.ToColor(colorZone2:GetString())) --draws base runner draw.RoundedBox(0, uSF(105), y - uSF(100), uSF(260), uSF(30), string.ToColor(colorZone3:GetString())) --draws internal runner --armour base draw.RoundedBox(0, uSF(375), y - uSF(105), uSF(85), uSF(85), string.ToColor(colorZone2:GetString())) --draws base square draw.RoundedBox(0, uSF(380), y - uSF(100), uSF(75), uSF(75), string.ToColor(colorZone3:GetString())) --draws internal square draw.RoundedBox(0, uSF(110), y - uSF(60), uSF(265), uSF(40), string.ToColor(colorZone2:GetString())) --draws base runner draw.RoundedBox(0, uSF(115), y - uSF(55), uSF(260), uSF(30), string.ToColor(colorZone3:GetString())) --draws internal runner end --[[--------------------------------------------------------------------------- paint HUD main function ---------------------------------------------------------------------------]]-- local function hudPaint() hook.Add("HUDShouldDraw", "HideDefaultDarkRPHud", function(name) --removes the default darkrp hud items, had to be moved here due to some bullshit timing discrepancies if hideHUDElements[name] then return false end end) drawBaseHud() drawHealthIcon() drawArmorIcon() drawEnergyIcon() drawHealthBar() drawArmorBar() drawEnergyBar() checkPlayerInfo() checkForCamera() end hook.Add( "HUDShouldDraw", "hide hud", function( name ) --hides default gmod hud if visible if ( name == "CHudHealth" or name == "CHudBattery" ) then return false end -- Never return anything default here, it will break other addons using this hook. end ) hook.Add("HUDPaint", "Draw_HUDPaint", hudPaint) hook.Add("Initialize","Draw_drawAvatar", drawAvatar) hook.Add("Initialize","Draw_drawFadminButton", drawFadminButton) hook.Add("Initialize","Draw_drawEqdButton", drawEqdButton) hook.Add("Initialize","Draw_drawSettingsButton", drawSettingsButton) hook.Add("Initialize", "Draw_PlayerName", drawPlayerName) hook.Add("Initialize", "Draw_PlayerJob", drawPlayerJob) hook.Add("Initialize", "Draw_PlayerRank", drawPlayerRank) hook.Add("Initialize", "Draw_PlayerMoney", drawPlayerMoney) hook.Add("Initialize", "Draw_PlayerSalary", drawPlayerSalary) hook.Add("Initialize", "Draw_PlayerPropCount", drawPlayerPropCount) hook.Add("Initialize", "Draw_PlayerHealth", drawPlayerHealth) hook.Add("Initialize", "Draw_PlayerGunLicenseIcon", drawPlayerGunLicenseIcon) hook.Add("Initialize", "Draw_PlayerWantedIcon", drawPlayerWantedIcon)
gt_transition=Class{} gt_transition:include(gt_frame) function gt_transition:init(transition, x, y, w, h, col, outline, editor) self.transition=transition self.original={x=x, y=y, w=w, h=h} self.camera_width=editor.sys.map.camera.width self.camera_height=editor.sys.map.camera.height self.opened=false self.closed=false self.opening=false self.closing=false gt_frame.init(self, x, y, w, h, col, outline) self.hidden=true self:get_starting(editor) end function gt_transition:open(editor) self.closed=false self.opening=true self.hidden=false self:get_starting(editor) end function gt_transition:close(editor) self.opened=false self.closing=true self.hidden=false self:get_ending(editor) end function gt_transition:get_starting(editor) self.targetx=self.original.x self.targety=self.original.y self.targeth=self.original.h if(self.transition=="slideup") then self.y=self.camera_height+self.height elseif(self.transition=="slidedown") then self.y=0-self.height elseif(self.transition=="slideleft") then self.x=0-self.width elseif(self.transition=="slideright") then self.x=(love.graphics.getWidth()/editor.sys.scale.x)+self.width elseif(self.transition=="open") then self.height=0 end end function gt_transition:get_ending(editor) if(self.transition=="slideup") then self.targety=self.camera_height+self.height elseif(self.transition=="slidedown") then self.targety=0-self.height elseif(self.transition=="slideleft") then self.targetx=0-self.width elseif(self.transition=="slideright") then self.targetx=(love.graphics.getWidth()/editor.sys.scale.x)+self.width elseif(self.transition=="open") then self.height=0 end end function gt_transition:check_open() if(self.transition=="slideup") then if(self.y<=self.targety) then self.y=self.targety self.opening=false self.opened=true end elseif(self.transition=="slidedown") then if(self.y>=self.targety) then self.y=self.targety self.opening=false self.opened=true end elseif(self.transition=="slideleft") then if(self.x>=self.targetx) then self.x=self.targetx self.opening=false self.opened=true end elseif(self.transition=="slideright") then if(self.x<=self.targetx) then self.x=self.targetx self.opening=false self.opened=true end elseif(self.transition=="open") then if(self.height>=self.targeth) then self.height=self.targeth self.opening=false self.opened=true end end end function gt_transition:check_closed() if(self.transition=="slideup") then if(self.y>=self.targety) then self.y=self.targety self.closing=false self.closed=true end elseif(self.transition=="slidedown") then if(self.y<=self.targety) then self.y=self.targety self.closing=false self.closed=true end elseif(self.transition=="slideleft") then if(self.x<=self.targetx) then self.x=self.targetx self.closing=false self.closed=true end elseif(self.transition=="slideright") then if(self.x>=self.targetx) then self.x=self.targetx self.closing=false self.closed=true end elseif(self.transition=="open") then if(self.height<0) then self.height=0 self.closing=false self.closed=true self.hidden=true end end end function gt_transition:update(dt) if(self.opening) then if(self.transition=="slideup") then self.y=self.y-8 elseif(self.transition=="slidedown") then self.y=self.y+8 elseif(self.transition=="slideleft") then self.x=self.x+8 elseif(self.transition=="slideright") then self.x=self.x-8 elseif(self.transition=="open") then self.height=self.height+16 end self:check_open() elseif(self.closing) then if(self.transition=="slideup") then self.y=self.y+8 elseif(self.transition=="slidedown") then self.y=self.y-8 elseif(self.transition=="slideleft") then self.x=self.x-8 elseif(self.transition=="slideright") then self.x=self.x+8 elseif(self.transition=="open") then self.height=self.height-16 end self:check_closed() end end
Text=function(string,x,y,pfont,scale) if(pfont==nil and scale ==nil)then love.graphics.print(string,x,y,0) elseif(type(pfont)=="number" and scale==nil)then love.graphics.print(string,asset.font[tostring(pfont)],x,y,0) elseif(type(pfont)=="string" and type(scale)=="number" and not asset.font[pfont..tostring(scale)]==nil)then love.graphics.print(string,asset.font[pfont..tostring(scale)],x,y) else print("error to Text()") end love.graphics.setColor(1,1,1,1) end
function getRequiredComponents() return {players = {"debug", "position", "size", "acceleration"}, squares = {"debug", "position", "size"}, texts = {"position", "size", "text"}, textures = {"texture", "position", "size"}} end function renderStart() game.camera:applyTransforms(g:getContext()) end function renderTextures(e) g:drawImage(e.texture.name, e.position, e.size) end function renderTexts(e) g:drawString(e.text.string, e.position.x, e.position.y + 10) end function renderSquares(entity) if entity.acceleration ~= nil then return end g:setColor(game.color:fromRGBA(entity.debug.r, entity.debug.g, entity.debug.b, entity.debug.a)) g:fillRect(entity.position, entity.size) end function renderPlayers(e) g:setColor(game.color:fromRGBA(e.debug.r, e.debug.g, e.debug.b, e.debug.a)) g:fillRect(e.position, e.size) g:setColor(255, 0, 0) if e.acceleration.touchWallDown then g:fillRect(e.position.x, e.position.y + 0.9 * e.size.height, e.size.width, e.size.height * 0.1) end if e.acceleration.touchWallUp then g:fillRect(e.position.x, e.position.y, e.size.width, e.size.height * 0.1) end if e.acceleration.touchWallLeft then g:fillRect(e.position.x, e.position.y, e.size.width * 0.1, e.size.height) end if e.acceleration.touchWallRight then g:fillRect(e.position.x + 0.9 * e.size.width, e.position.y, e.size.width * 0.1, e.size.height) end end function renderEnd() game.camera:resetTransforms(g:getContext()) g:setColor(game.color:fromRGB(0, 0, 0)) g:drawString("Editing mode", 20, 20) g:drawString("FPS:" .. game.core:getFPS(), 20, 40) end
-- Change these: local jid, password = "user@example.com", "secret"; -- This line squishes verse each time you run, -- handy if you're hacking on Verse itself --os.execute("squish --minify-level=none verse"); require "verse".init("client"); c = verse.new(); c:add_plugin("version"); -- Add some hooks for debugging c:hook("opened", function () print("Stream opened!") end); c:hook("closed", function () print("Stream closed!") end); c:hook("stanza", function (stanza) print("Stanza:", stanza) end); -- This one prints all received data c:hook("incoming-raw", print, 1000); -- Print a message after authentication c:hook("authentication-success", function () print("Logged in!"); end); c:hook("authentication-failure", function (err) print("Failed to log in! Error: "..tostring(err.condition)); end); -- Print a message and exit when disconnected c:hook("disconnected", function () print("Disconnected!"); os.exit(); end); -- Now, actually start the connection: c:connect_client(jid, password); -- Catch the "ready" event to know when the stream is ready to use c:hook("ready", function () print("Stream ready!"); c.version:set{ name = "verse example client" }; c:query_version(c.jid, function (v) print("I am using "..(v.name or "<unknown>")); end); end); print("Starting loop...") verse.loop()
if ( SERVER ) then AddCSLuaFile( "shared.lua" ) end if ( CLIENT ) then SWEP.PrintName = "MP5" SWEP.Author = "Black Tea" SWEP.Slot = 2 SWEP.SlotPos = 3 end SWEP.HoldType = "smg" SWEP.Base = "weapon_nmrih_base" SWEP.Category = "No More Room In Hell" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/fa_mp5/v_fa_mp5.mdl" SWEP.WorldModel = "models/weapons/w_smg_mp5.mdl" SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.Primary.Sound = Sound( "Weapon_MP5.Single" ) SWEP.Primary.Recoil = 1.1 SWEP.Primary.Damage = 20 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.02 SWEP.Primary.ClipSize = 30 SWEP.Primary.Delay = 0.08 SWEP.Primary.DefaultClip = 0 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "9MMPARA" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.ShellType = SHELL_9MM SWEP.EmptyReloadTime = 4.8 SWEP.ReloadTime = 3.3 SWEP.animTable = { [ANIM_IDLE] = { [ATTACK_NORMAL] = { [STATUS_NORMAL] = { "idle01" }, [STATUS_EMPTY] = { "idle01dry" }, }, [ATTACK_IRON] = { [STATUS_NORMAL] = { "Idle_Iron" }, [STATUS_EMPTY] = { "Idle_Irondry" }, } }, [ANIM_HOLSTER] = { [STATUS_NORMAL] = { "holster" }, [STATUS_EMPTY] = { "holsterdry" }, }, [ANIM_DEPLOY] = { [STATUS_NORMAL] = { "draw" }, [STATUS_EMPTY] = { "drawdry" }, }, [ANIM_FIRE] = { [ATTACK_NORMAL] = { [STATUS_NORMAL] = { "fire1", "fire2", "fire3", }, [STATUS_DRY] = { "Fire_Last", }, [STATUS_EMPTY] = { "dryfire", } }, [ATTACK_IRON] = { [STATUS_NORMAL] = { "Fire_Iron_1", "Fire_Iron_2", "Fire_Iron_3", }, [STATUS_DRY] = { "Fire_Iron_Last", }, [STATUS_EMPTY] = { "Fire_Iron_Dry", } }, }, [ANIM_RELOAD] = { [STATUS_NORMAL] = { "reload_full", }, [STATUS_DRY] = { "reload_empty", }, }, [ANIM_IRON] = { [STATUS_NORMAL] = { [0] = "Idle_to_Iron", [1] = "Iron_to_Idle" }, [STATUS_EMPTY] = { [0] = "Idle_to_Irondry", [1] = "Iron_to_Idledry" }, }, [ANIM_SPRINT] = { [STATUS_NORMAL] = { [0] = "Idle_to_Sprint", [1] = "Sprint_to_Idle", [2] = "Sprint_Loop" }, [STATUS_EMPTY] = { [0] = "Idle_to_Sprint_empty", [1] = "Sprint_to_Idle_Empty", [2] = "Sprint_Empty_Loop" }, }, [ANIM_MELEE] = { [STATUS_NORMAL] = { "Shove", }, [STATUS_EMPTY] = { "Shove_dry", }, }, [ANIM_CHECK] = { [STATUS_NORMAL] = { "AmmoCheck", }, [STATUS_EMPTY] = { "AmmoCheck_Empty", }, }, } btSoundRegister("Weapon_MP5.Single", { "weapons/firearms/mil_mp5a4/mp5_fire_01.wav", }, 5) btSoundRegister("Weapon_MP5.Burst", { "weapons/firearms/mil_mp5a4/MP5_FireBurst.wav", }, 5, CHAN_ITEM) btSoundRegister("Weapon_MP5.dry", { "weapons/firearms/mil_mp5a4/MP5_DryFire.wav", }, 5, CHAN_ITEM) btSoundRegister("Weapon_MP5.ClipOut", { "weapons/firearms/mil_mp5a4/MP5_ClipOut.wav", }, 5, CHAN_ITEM) btSoundRegister("Weapon_MP5.ClipIn", { "weapons/firearms/mil_mp5a4/MP5_ClipIn.wav", }, 5, CHAN_ITEM) btSoundRegister("Weapon_MP5.SlideLock", { "weapons/firearms/mil_mp5a4/MP5_SlideLock.wav", }, 5, CHAN_ITEM) btSoundRegister("Weapon_MP5.SlideForward", { "weapons/firearms/mil_mp5a4/MP5_SlideForward.wav", }, 5, CHAN_ITEM) btSoundRegister("Weapon_MP5.Slide", { "weapons/firearms/mil_mp5a4/MP5_Slide.wav", }, 5, CHAN_ITEM)
local PANEL = {} function PANEL:Init() local width, height = self:GetWide(), self:GetTall() self.scroll_panel = vgui.Create('DScrollPanel', self) self.list_layout = vgui.Create('DListLayout', self.scroll_panel) for k, v in pairs(Config.get_menu_keys()) do local collapsible_category = vgui.Create('DCollapsibleCategory', self.list_layout) collapsible_category:SetLabel(t(v.category.name)) collapsible_category:SetSize(width, 21) collapsible_category.Header:SetTooltip(t(v.category.description)) local list = vgui.Create('DListLayout', self.list_layout) collapsible_category:SetContents(list) local dark = false for k1, v1 in pairs(v.configs) do local config_line = vgui.create('fl_config_line') config_line:set_config(k1, v1) config_line:SetWide(width) config_line.dark = dark list:Add(config_line) dark = !dark end end end function PANEL:on_opened() local width, height = self:GetWide(), self:GetTall() self.scroll_panel:SetSize(width, height) self.list_layout:SetSize(width - 16, height) end vgui.Register('fl_config_editor', PANEL, 'fl_base_panel') local PANEL = {} function PANEL:Init() self.text = vgui.create('DLabel', self) self.text:SetFont(Theme.get_font('main_menu_normal')) self.text:SetTextColor(color_white) self.text:SetContentAlignment(5) end function PANEL:Paint(w, h) Theme.hook('PaintConfigLine', self, w, h) end function PANEL:PerformLayout(w, h) local config_table = self.config self.text:SetPos(2, h / 2 - self.text:GetTall() / 2) self.text:SizeToContents() local data_type = config_table.type if data_type == 'number' then self.slider:SetPos(w / 2, 2) self.slider:SetSize(w / 2 - 2, h - 4) elseif data_type == 'boolean' then local size = h * 0.8 self.check:SetSize(size, size) self.check:SetPos(w * 0.75 - size / 2, h / 2 - size / 2) self.check:set_icon_size(size) elseif data_type == 'string' then self.text_entry:SetPos(w / 2, 2) self.text_entry:SetSize(w / 2 - 2, h - 4) elseif data_type == 'table' then self.combo_box:SetPos(w / 2, 2) self.combo_box:SetSize(w / 2 - 2, h - 4) end end function PANEL:set_config(key, config_table) self.config = config_table self:SetTooltip(t(config_table.description)) self.text:SetText(t(config_table.name)) self.text:SizeToContents() self:SetTall(self.text:GetTall() * 1.5) local data_type = config_table.type if data_type == 'number' then self.slider = vgui.create('DNumSlider', self) self.slider:SetMin(config_table.data.min_value or 0) self.slider:SetMax(config_table.data.max_value or 100) self.slider:SetDecimals(config_table.data.decimals or 0) self.slider:SetValue(Config.get(key) or config_table.data.default_value or 0) self.slider.TextArea:SetPaintBackground(true) self.slider.PerformLayout = function() end self.slider.OnValueChanged = function(pnl, value) Cable.send('fl_config_change', key, self.slider:GetValue()) end elseif data_type == 'boolean' then self.check = vgui.create('fl_button', self) self.check.value = Config.get(key) or config_table.data.default_value or false self.check:SetDrawBackground(false) self.check:set_icon(self.check.value and 'fa-check' or 'fa-ban') self.check:set_centered(true) self.check.DoClick = function(btn) btn.value = !btn.value Cable.send('fl_config_change', key, btn.value) self.check:set_icon(btn.value and 'fa-check' or 'fa-ban') end elseif data_type == 'string' then self.text_entry = vgui.create('DTextEntry', self) self.text_entry:SetFont(Theme.get_font('main_menu_small')) self.text_entry.OnEnter = function(pnl, value) Cable.send('fl_config_change', key, self.text_entry:GetValue()) end elseif data_type == 'table' then self.combo_box = vgui.create('DComboBox', self) local data_table = Config.get(key) self.combo_box.rebuild = function() self.combo_box:Clear() self.combo_box:SetValue(t(config_table.name)) if istable(data_table) then for k, v in pairs(data_table) do self.combo_box:AddChoice(t(v), v) end end self.combo_box:AddChoice(t'ui.admin.new_config', '') end self.combo_box:rebuild() self.combo_box.OnSelect = function(pnl, index, text, data) if data == '' then Derma_StringRequest(t'ui.admin.new_config', t'ui.admin.new_config_text', '', function(text) if text != '' then table.insert(data_table, text) Cable.send('fl_config_change', key, data_table) self.combo_box.rebuild() end end) else Derma_Query(t'ui.admin.delete_config_text', t'ui.admin.delete_config', t'ui.yes', function() table.remove(data_table, index) Cable.send('fl_config_change', key, data_table) self.combo_box.rebuild() end, t'ui.no') end end elseif data_type == 'dropdown' then self.combo_box = vgui.create('DComboBox', self) self.combo_box:SetValue(Config.get(key) or t'ui.admin.select_config') local data_table = config_table.data if data_table then for k, v in pairs(data_table) do self.combo_box:AddChoice(t(v), v) end end self.combo_box.OnSelect = function(pnl, index, text, data) Cable.send('fl_config_change', key, data) end end end vgui.Register('fl_config_line', PANEL, 'fl_base_panel')
local function CW20_Grenade_InitPostEntity() local ply = LocalPlayer() ply.cwFlashbangDuration = 0 ply.cwFlashbangIntensity = 0 ply.cwFlashbangDisplayIntensity = 0 ply.cwFlashDuration = 0 ply.cwFlashIntensity = 0 end hook.Add("InitPostEntity", "CW20_Grenade_InitPostEntity", CW20_Grenade_InitPostEntity) local function CW20_RenderScreenspaceEffects() local ply = LocalPlayer() local curTime = CurTime() local frameTime = FrameTime() if curTime > ply.cwFlashbangDuration then ply.cwFlashbangIntensity = math.Approach(ply.cwFlashbangIntensity, 0, frameTime) end ply.cwFlashbangDisplayIntensity = math.Approach(ply.cwFlashbangDisplayIntensity, ply.cwFlashbangIntensity, frameTime * 15) if curTime > ply.cwFlashDuration then ply.cwFlashIntensity = math.Approach(ply.cwFlashIntensity, 0, frameTime) end if ply.cwFlashbangDisplayIntensity > 0 then DrawMotionBlur(0.01 * (1 - ply.cwFlashbangDisplayIntensity), ply.cwFlashbangDisplayIntensity, 0) surface.SetDrawColor(255, 255, 255, 255 * ply.cwFlashIntensity * ply.cwFlashbangDisplayIntensity) surface.DrawRect(-1, -1, ScrW() + 2, ScrH() + 2) end end hook.Add("RenderScreenspaceEffects", "CW20_RenderScreenspaceEffects", CW20_RenderScreenspaceEffects)
-- Luawa -- File: request.lua -- Desc: holds/prepares request data (gets & posts) local setmetatable = setmetatable local ngx = ngx local luawa = require('luawa.core') local request = {} -- Init function request:_init() self.session = luawa.session self.utils = luawa.utils end -- Start function request:_start() --read post data/args ngx.req.read_body() --prepare new cookies table ngx.ctx.new_cookies = {} --get/parse cookies ngx.ctx.cookies = {} local cookie_header = ngx.req.get_headers()['cookie'] if cookie_header then for k, v in cookie_header:gmatch('([^;]+)') do local a, b, key, value = k:find('([^=]+)=([^=]+)') if key and value then ngx.ctx.cookies[self.utils.trim(key)] = value end end end end -- Request end, send cookie headers, forget them function request:_end() self:setHeader('Set-Cookie', ngx.ctx.new_cookies) ngx.header['Set-Cookie'] = ngx.ctx.new_cookies end -- Set a response header function request:setHeader(key, value) ngx.header[key] = self.new_cookies ngx.req.set_header(key, value) end -- Set a response cookie function request:setCookie(key, value, expire, path, domain, secure, httponly) if not path then path = '/' end if not expire then expire = 3600 end if not domain then domain = luawa.request.hostname end --basic cookie string local string = key .. '=' .. value .. '; Path=' .. path .. '; Expires=' .. ngx.cookie_time(os.time() + expire) --extras if domain then string = string .. '; Domain=' .. domain end if secure then string = string .. '; Secure' end if httponly then string = string .. '; HttpOnly' end --insert into cookies, to be dumped at end table.insert(ngx.ctx.new_cookies, string) --and set internal cookie for any further requests ngx.ctx.cookies[key] = value end -- Delete a cookie (set it to expire 60m ago) function request:deleteCookie(key) self:setCookie(key, '', -3600, '/') end -- Redirect function request:redirect(url, message_type, message_text) if message_type and message_text then self.session:addMessage(message_type, message_text) end --redirect return luawa:redirect(url) end --immutable request data local meta_functions = { --tables get = function() return ngx.req.get_uri_args() end, post = function() return ngx.req.get_post_args(luawa.limit_post) end, cookie = function() return ngx.ctx.cookies end, header = function() return ngx.req.get_headers() end, --single values method = function() return ngx.req.get_method() end, remote_addr = function() return ngx.var.remote_addr end, hostname = function() local header = ngx.req.get_headers().host local a, b, host, port = header:find('^([^:]+):?([0-9]*)$') return host end, hostport = function() local header = ngx.req.get_headers().host local a, b, host, port = header:find('^([^:]+):?([0-9]*)$') return port end } --bind metatable => metafuncs local mt = { __index = function(table, key) if meta_functions[key] then return meta_functions[key]() end end } setmetatable(request, mt) return request
m = mqtt.Client("i_node", 120, nil, nil) m:on("connect", function(con) print ("connected") end) m:on("offline", function(con) print ("offline") end) m:on("message", function(conn, topic, data) print("topic: "..topic) if data ~= nil then print("data: "..data) end end) m:connect("IP_ADDR", 1883, 0, function(conn) print("connected") -- gpio[2] low, indicates connected gpio.write(4, gpio.LOW) gpio.mode(4, gpio.OUTPUT) dofile("mqtt_pub_forever.lua") end)
local Knit = require(game:GetService("ReplicatedStorage").Knit) Knit.AddControllers(script.Parent.Controllers) Knit.OnStart():Then(function() print("OnStart before") end):Catch(warn) Knit.Start():Then(function() print("Knit started on the server") Knit.OnStart():Then(function() print("OnStart after") end):Catch(warn) end):Catch(warn)
local present, null_ls = pcall(require, 'null-ls') if not present then return end local on_attach = require('lsp.on_attach') local styluaConfig = { extra_args = { '--config-path', vim.fn.expand('~/dotfiles/stylua.toml') }, } local luaCheckConfig = { extra_args = { '--config', vim.fn.expand('~/dotfiles/.luacheckrc'), }, } null_ls.setup({ capabilities = vim.lsp.protocol.make_client_capabilities(), on_attach = function(client) client.resolved_capabilities.document_formatting = true on_attach(client) end, sources = { null_ls.builtins.formatting.prettierd, null_ls.builtins.formatting.rustfmt, null_ls.builtins.formatting.terraform_fmt, null_ls.builtins.formatting.trim_whitespace, null_ls.builtins.formatting.shfmt, null_ls.builtins.formatting.stylua.with(styluaConfig), null_ls.builtins.diagnostics.luacheck.with(luaCheckConfig), null_ls.builtins.diagnostics.shellcheck, null_ls.builtins.diagnostics.hadolint, -- null_ls.builtins.diagnostics.stylelint.with(styleLintDiagnosticsConfig), null_ls.builtins.code_actions.gitsigns, }, })
function stepHit(step) if curStep == 1 then changeDadCharacter("monster-christmas") end end
--[[ GD50 Match-3 Remake -- Tile Class -- Author: Manav Sinha manavsinha111@gmail.com The individual tiles that make up our game board. Each Tile can have a color and a variety, with the varietes adding extra points to the matches. ]] Tile = Class{} function Tile:init(x, y, color, variety,isShiny) -- board positions self.gridX = x self.gridY = y -- coordinate positions self.x = (self.gridX - 1) * 32 self.y = (self.gridY - 1) * 32 -- tile appearance/points self.color = color self.variety = variety self.opacity = 255 --flag to check if current tile is shiny or not self.shiny = isShiny if self.shiny then Timer.every(1,function() Timer.tween(0.5,{ [self] = {opacity = 150} }):finish(function() Timer.tween(0.5,{ [self] = {opacity = 255} }) end) end) end end function Tile:render(x, y) -- draw shadow love.graphics.setColor(34, 32, 52, 255) love.graphics.draw(gTextures['main'], gFrames['tiles'][self.color][self.variety], self.x + x + 2, self.y + y + 2) -- draw tile itself love.graphics.setColor(255, 255, 255, self.opacity) love.graphics.draw(gTextures['main'], gFrames['tiles'][self.color][self.variety], self.x + x, self.y + y) -- if self.shiny then -- end end
Talk(78, "不知阁下前来昆仑山有何贵事,需要我通报掌门吗?", "talkname78", 0); Talk(0, "不用,不用,我随便逛逛.", "talkname0", 1); do return end;
local u = require('tableutil').ipairs() local adder = u:map(function(v) return v+1 end) local largerthan3 = adder:filter(function(v) return v > 3 end) for k,v in adder({1,2,3}) do print(k,v) end for k,v in largerthan3({2,3,4}) do print(k,v) end
-- Copyright (C) Anjia (anjia0532) local json = require('cjson') local json_encode = json.encode local json_decode = json.decode local ngx_log = ngx.log local ngx_ERR = ngx.ERR local ngx_CRIT = ngx.CRIT local ngx_INFO = ngx.INFO local ffi = require ('ffi') local ffi_new = ffi.new local ffi_str = ffi.string local ffi_cast = ffi.cast local _M ={} _M._VERSION = '1.0.1' local mt = { __index = _M } ffi.cdef[[ typedef unsigned int mmdb_uint128_t __attribute__ ((__mode__(TI))); typedef struct MMDB_entry_s { struct MMDB_s *mmdb; uint32_t offset; } MMDB_entry_s; typedef struct MMDB_lookup_result_s { bool found_entry; MMDB_entry_s entry; uint16_t netmask; } MMDB_lookup_result_s; typedef struct MMDB_entry_data_s { bool has_data; union { uint32_t pointer; const char *utf8_string; double double_value; const uint8_t *bytes; uint16_t uint16; uint32_t uint32; int32_t int32; uint64_t uint64; mmdb_uint128_t uint128; bool boolean; float float_value; }; uint32_t offset; uint32_t offset_to_next; uint32_t data_size; uint32_t type; } MMDB_entry_data_s; typedef struct MMDB_entry_data_list_s { MMDB_entry_data_s entry_data; struct MMDB_entry_data_list_s *next; } MMDB_entry_data_list_s; typedef struct MMDB_description_s { const char *language; const char *description; } MMDB_description_s; typedef struct MMDB_metadata_s { uint32_t node_count; uint16_t record_size; uint16_t ip_version; const char *database_type; struct { size_t count; const char **names; } languages; uint16_t binary_format_major_version; uint16_t binary_format_minor_version; uint64_t build_epoch; struct { size_t count; MMDB_description_s **descriptions; } description; } MMDB_metadata_s; typedef struct MMDB_ipv4_start_node_s { uint16_t netmask; uint32_t node_value; } MMDB_ipv4_start_node_s; typedef struct MMDB_s { uint32_t flags; const char *filename; ssize_t file_size; const uint8_t *file_content; const uint8_t *data_section; uint32_t data_section_size; const uint8_t *metadata_section; uint32_t metadata_section_size; uint16_t full_record_byte_size; uint16_t depth; MMDB_ipv4_start_node_s ipv4_start_node; MMDB_metadata_s metadata; } MMDB_s; typedef char * pchar; MMDB_lookup_result_s MMDB_lookup_string(MMDB_s *const mmdb, const char *const ipstr, int *const gai_error,int *const mmdb_error); int MMDB_open(const char *const filename, uint32_t flags, MMDB_s *const mmdb); int MMDB_aget_value(MMDB_entry_s *const start, MMDB_entry_data_s *const entry_data, const char *const *const path); char *MMDB_strerror(int error_code); int MMDB_get_entry_data_list(MMDB_entry_s *start, MMDB_entry_data_list_s **const entry_data_list); void MMDB_free_entry_data_list(MMDB_entry_data_list_s *const entry_data_list); ]] -- error codes -- https://github.com/maxmind/libmaxminddb/blob/master/include/maxminddb.h#L66 local MMDB_SUCCESS = 0 local MMDB_FILE_OPEN_ERROR = 1 local MMDB_CORRUPT_SEARCH_TREE_ERROR = 2 local MMDB_INVALID_METADATA_ERROR = 3 local MMDB_IO_ERROR = 4 local MMDB_OUT_OF_MEMORY_ERROR = 5 local MMDB_UNKNOWN_DATABASE_FORMAT_ERROR = 6 local MMDB_INVALID_DATA_ERROR = 7 local MMDB_INVALID_LOOKUP_PATH_ERROR = 8 local MMDB_LOOKUP_PATH_DOES_NOT_MATCH_DATA_ERROR = 9 local MMDB_INVALID_NODE_NUMBER_ERROR = 10 local MMDB_IPV6_LOOKUP_IN_IPV4_DATABASE_ERROR = 11 -- data type -- https://github.com/maxmind/libmaxminddb/blob/master/include/maxminddb.h#L40 local MMDB_DATA_TYPE_EXTENDED = 0 local MMDB_DATA_TYPE_POINTER = 1 local MMDB_DATA_TYPE_UTF8_STRING = 2 local MMDB_DATA_TYPE_DOUBLE = 3 local MMDB_DATA_TYPE_BYTES = 4 local MMDB_DATA_TYPE_UINT16 = 5 local MMDB_DATA_TYPE_UINT32 = 6 local MMDB_DATA_TYPE_MAP = 7 local MMDB_DATA_TYPE_INT32 = 8 local MMDB_DATA_TYPE_UINT64 = 9 local MMDB_DATA_TYPE_UINT128 = 10 local MMDB_DATA_TYPE_ARRAY = 11 local MMDB_DATA_TYPE_CONTAINER = 12 local MMDB_DATA_TYPE_END_MARKER = 13 local MMDB_DATA_TYPE_BOOLEAN = 14 local MMDB_DATA_TYPE_FLOAT = 15 -- you should install the libmaxminddb to your system local maxm = ffi.load('libmaxminddb') local mmdb = ffi_new('MMDB_s') local initted = false --https://github.com/maxmind/libmaxminddb function _M.init(dbfile) if not initted then initted = true local file_name_ip2 = ffi_new('char[?]',#dbfile,dbfile) local maxmind_ready = maxm.MMDB_open(file_name_ip2,0,mmdb) end return initted end function _M.initted() return initted end -- https://github.com/maxmind/libmaxminddb/blob/master/src/maxminddb.c#L1938 -- LOCAL MMDB_entry_data_list_s *dump_entry_data_list( FILE *stream, MMDB_entry_data_list_s *entry_data_list, int indent, int *status) local function _dump_entry_data_list(entry_data_list,status,resultTab) if not entry_data_list then return nil,nil,resultTab end if not resultTab then resultTab = {} end local entry_data_item = entry_data_list[0].entry_data local data_type = entry_data_item.type local data_size = entry_data_item.data_size if data_type == MMDB_DATA_TYPE_MAP then table.insert(resultTab,"{") local flag = false local size = entry_data_item.data_size entry_data_list = entry_data_list[0].next while(size > 0 and entry_data_list) do entry_data_item = entry_data_list[0].entry_data data_type = entry_data_item.type data_size = entry_data_item.data_size if MMDB_DATA_TYPE_UTF8_STRING ~= data_type then return nil,MMDB_INVALID_DATA_ERROR,resultTab end local val = ffi_str(entry_data_item.utf8_string,data_size) if not val then return nil,MMDB_OUT_OF_MEMORY_ERROR,resultTab end -- if latest str is { ,dont append `,` table.insert(resultTab,(flag and ',"%s":' or '"%s":'):format(val)) flag = true entry_data_list = entry_data_list[0].next entry_data_list,status,resultTab = _dump_entry_data_list(entry_data_list,status,resultTab) if status ~= MMDB_SUCCESS then return nil,nil,resultTab end size = size -1 end table.insert(resultTab,"}") elseif entry_data_list[0].entry_data.type == MMDB_DATA_TYPE_ARRAY then local size = entry_data_list[0].entry_data.data_size table.insert(resultTab,"[") entry_data_list = entry_data_list[0].next while(size >0 and entry_data_list) do entry_data_list,status,resultTab = _dump_entry_data_list(entry_data_list,status,resultTab) if status ~= MMDB_SUCCESS then return nil,nil,resultTab end size = size -1 -- thanks for https://github.com/anjia0532/lua-resty-maxminddb/issues/7 if size > 0 then table.insert(resultTab,",") end end table.insert(resultTab,"]") else entry_data_item = entry_data_list[0].entry_data data_type = entry_data_item.type data_size = entry_data_item.data_size local val -- string type "key":"val" -- other type "key":val -- default other type local fmt="%s" if data_type == MMDB_DATA_TYPE_UTF8_STRING then val = ffi_str(entry_data_item.utf8_string,data_size) fmt='"%s"' if not val then status = MMDB_OUT_OF_MEMORY_ERROR return nil,status,resultTab end elseif data_type == MMDB_DATA_TYPE_BYTES then val = ffi_str(ffi_cast('char * ',entry_data_item.bytes),data_size) fmt='"%s"' if not val then status = MMDB_OUT_OF_MEMORY_ERROR return nil,status,resultTab end elseif data_type == MMDB_DATA_TYPE_DOUBLE then val = entry_data_item.double_value elseif data_type == MMDB_DATA_TYPE_FLOAT then val = entry_data_item.float_value elseif data_type == MMDB_DATA_TYPE_UINT16 then val = entry_data_item.uint16 elseif data_type == MMDB_DATA_TYPE_UINT32 then val = entry_data_item.uint32 elseif data_type == MMDB_DATA_TYPE_BOOLEAN then val = entry_data_item.boolean == 1 elseif data_type == MMDB_DATA_TYPE_UINT64 then val = entry_data_item.uint64 elseif data_type == MMDB_DATA_TYPE_INT32 then val = entry_data_item.int32 else return nil,MMDB_INVALID_DATA_ERROR,resultTab end table.insert(resultTab,(fmt):format(val)) entry_data_list = entry_data_list[0].next end status = MMDB_SUCCESS return entry_data_list,status,resultTab end function _M.lookup(ip) if not initted then return nil, "not initialized" end local ip_str = ffi_cast('const char *',ffi_new('char[?]',#ip+1,ip)) local gai_error = ffi_new('int[1]') local mmdb_error = ffi_new('int[1]') local result = maxm.MMDB_lookup_string(mmdb,ip_str,gai_error,mmdb_error) if mmdb_error[0] ~= MMDB_SUCCESS then return nil,'fail when lookup' end if gai_error[0] ~= MMDB_SUCCESS then return nil,'ga error' end if true ~= result.found_entry then ngx_log(ngx_ERR, "stream lua mmdb lookup: entry not found") return nil,'not found' end local entry_data_list = ffi_cast('MMDB_entry_data_list_s **const',ffi_new("MMDB_entry_data_list_s")) local status = maxm.MMDB_get_entry_data_list(result.entry,entry_data_list) if status ~= MMDB_SUCCESS then return nil,'MMDB_get_entry_data_list failed while populating description.' end local _,status,resultTap = _dump_entry_data_list(entry_data_list) maxm.MMDB_free_entry_data_list(entry_data_list[0]) if status ~= MMDB_SUCCESS then return nil,'no data' end return json_decode(table.concat(resultTap or {'{','}'})),nil -- fix https://github.com/anjia0532/lua-resty-maxminddb/issues/5#issuecomment-390845118 end -- https://www.maxmind.com/en/geoip2-databases you should download the mmdb file from maxmind return _M;
local test = {} local utf8 = require 'utf8' local string = require 'string' function test.char() assert(utf8.char() == '') assert(utf8.char(72, 101, 108, 108, 111, 65292, 19990, 30028) == 'Hello,世界') end function test.charpattern() local xs = {string.byte(utf8.charpattern, 1, -1)} assert(#xs == 14) assert(xs[1] == 91) assert(xs[2] == 0) assert(xs[3] == 45) assert(xs[4] == 127) assert(xs[5] == 194) assert(xs[6] == 45) assert(xs[7] == 244) assert(xs[8] == 93) assert(xs[9] == 91) assert(xs[10] == 128) assert(xs[11] == 45) assert(xs[12] == 191) assert(xs[13] == 93) assert(xs[14] == 42) end function test.codes() local s = 'Hello,世界' local next, x, p = utf8.codes(s) local p, c = next(x, p) assert(p == 1 and c == 72) local p, c = next(x, p) assert(p == 2 and c == 101) local p, c = next(x, p) assert(p == 3 and c == 108) local p, c = next(x, p) assert(p == 4 and c == 108) local p, c = next(x, p) assert(p == 5 and c == 111) local p, c = next(x, p) assert(p == 6 and c == 65292) local p, c = next(x, p) assert(p == 9 and c == 19990) local p, c = next(x, p) assert(p == 12 and c == 30028) end function test.codepoint() local s = 'Hello,世界' local xs = {utf8.codepoint(s)} assert(#xs == 1) assert(xs[1] == 72) local xs = {utf8.codepoint(s, 3)} assert(#xs == 1) assert(xs[1] == 108) local xs = {utf8.codepoint(s, 4, -2)} assert(#xs == 5) assert(xs[1] == 108) assert(xs[2] == 111) assert(xs[3] == 65292) assert(xs[4] == 19990) assert(xs[5] == 30028) end function test.len() local s = 'Hello,世界' assert(utf8.len(s) == 8) assert(utf8.len(s, 3) == 6) assert(utf8.len(s, 4, -2) == 5) local n, i = utf8.len(s, 8) assert(n == nil and i == 8) end function test.offset() local s = 'Hello,世界' assert(utf8.offset(s, 2) == 2) assert(utf8.offset(s, -2) == 9) assert(utf8.offset(s, 2, 2) == 3) assert(utf8.offset(s, -2, 2) == nil) assert(utf8.offset(s, -2, -3) == 6) assert(utf8.offset(s, 2, -6) == 12) assert(utf8.offset(s, 0, 2) == 2) assert(utf8.offset(s, 0, -2) == 12) end return test
return { ["buttons"] = { ["a"] = "a", ["b"] = "s", ["x"] = "z", ["y"] = "x", ["start"] = "m", ["select"] = "n", ["dpleft"] = "f", ["dpup"] = "t", ["dpright"] = "h", ["dpdown"] = "g", ["leftshoulder"] = "q", ["rightshoulder"] = "w" }, ["axes"] = { ["leftx:neg"] = "left", ["leftx:pos"] = "right", ["lefty:neg"] = "up", ["lefty:pos"] = "down", ["rightx:neg"] = "j", ["rightx:pos"] = "l", ["righty:neg"] = "i", ["righty:pos"] = "k", ["triggerleft:pos"] = "1", ["triggerright:pos"] = "2" } }
function ResetCamera() local pos = GetEntityCoords(GetPlayerPed(-1)) SetTimecycleModifier("default") SetEntityCoords(GetPlayerPed(-1), pos.x, pos.y, pos.z) DoScreenFadeIn(500) Citizen.Wait(500) local cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -1355.93, -1487.78, 520.75, 300.00, 0.00, 0.00, 100.00, false, 0) PointCamAtCoord(cam2, pos.x, pos.y, pos.z + 200) SetCamActiveWithInterp(cam2, cam, 900, true, true) Citizen.Wait(900) cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", pos.x, pos.y, pos.z + 200, 300.00, 0.00, 0.00, 100.00, false, 0) PointCamAtCoord(cam, pos.x, pos.y, pos.z + 2) SetCamActiveWithInterp(cam, cam2, 3700, true, true) Citizen.Wait(3700) PlaySoundFrontend(-1, "Zoom_Out", "DLC_HEIST_PLANNING_BOARD_SOUNDS", 1) RenderScriptCams(false, true, 500, true, true) PlaySoundFrontend(-1, "CAR_BIKE_WHOOSH", "MP_LOBBY_SOUNDS", 1) FreezeEntityPosition(GetPlayerPed(-1), false) Citizen.Wait(500) SetCamActive(cam, false) DestroyCam(cam, true) DisplayHud(true) DisplayRadar(true) end function DoSelectionCamera() DoScreenFadeOut(10) DisplayHud(false) DisplayRadar(false) while not IsScreenFadedOut() do Citizen.Wait(10) end SetTimecycleModifier("hud_def_blur") FreezeEntityPosition(GetPlayerPed(-1), true) local cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", -1355.93, -1487.78, 520.75, 300.00, 0.00, 0.00, 100.00, false, 0) SetCamActive(cam, true) RenderScriptCams(true, false, 1, true, true) Citizen.Wait(5000) DoScreenFadeIn(500) Citizen.Wait(500) end
--------------------------------------------------------------- -- Utility.lua: Main radial action bar --------------------------------------------------------------- -- Creates an action bar that can be populated with -- items, spells, mounts, macros, etc. The user may manually -- assign items from container buttons inside bag frames. -- Action buttons can grab info from cursor. --------------------------------------------------------------- local addOn, db = ... --------------------------------------------------------------- local ConsolePort = ConsolePort --------------------------------------------------------------- local FadeIn, FadeOut = db.GetFaders() local GetItemCooldown = GetItemCooldown local InCombatLockdown = InCombatLockdown --------------------------------------------------------------- local Utility, Tooltip, Animation, AniCircle = ConsolePortUtilityToggle, ConsolePortUtilityToggle.Tooltip, CreateFrame('Frame', 'ConsolePortUtilityAnimation', UIParent), CreateFrame('Frame', 'ConsolePortUtilityAnimationCircle', UIParent) --------------------------------------------------------------- local red, green, blue = db.Atlas.GetCC() local colMul = 1 + ( 1 - (( red + green + blue ) / 3) ) --------------------------------------------------------------- function Animation:ShowNewAction(actionButton, autoassigned) -- if an item was auto-assigned, postpone its animation until the current animation has finished if autoassigned and self.Group:IsPlaying() then local progress = self.Group:GetDuration() * self.Group:GetProgress() local delay = self.Group:GetDuration() - progress C_Timer.After(delay, function() self:ShowNewAction(actionButton, true) end) return end if actionButton.isQuest then self.Quest:Show() else self.Quest:Hide() end local scale = Utility.frameScale or 1 self.Icon:SetTexture(actionButton.Icon.texture) --self.Spell:SetSize(175, 175) self:ClearAllPoints() self:SetPoint('CENTER', actionButton) self:SetScale(scale) self:Show() self.Group:Stop() self.Group:Play() --FadeOut(self.Spell, 3, 0.15, 0) if ConsolePortUtility[actionButton:GetID()] then local value = ConsolePortUtility[actionButton:GetID()].value local binding = ConsolePort:GetFormattedBindingOwner('CLICK ConsolePortUtilityToggle:LeftButton', nil, nil, true) if value then local string = binding and ' '..binding or '.' if value and not tonumber(value) then db.Hint:DisplayMessage(format(db.TUTORIAL.HINTS.UTILITY_RING_NEWBIND, value, string), 3, -190) elseif binding then db.Hint:DisplayMessage(format(db.TUTORIAL.HINTS.UTILITY_RING_BIND, binding), 3, -190) end end end local angle = actionButton:GetAttribute('rotation') AniCircle:Show() AniCircle:SetScale(scale) AniCircle.Ring:SetRotation(angle) AniCircle.Arrow:SetRotation(angle) AniCircle.Runes:SetRotation(angle) FadeOut(AniCircle, 3, 1, 0) end local function AnimateOnFinished(self) AniCircle:Hide() self:GetParent():Hide() end -- called from secure scope (e.g. extra action button 1 appears) function Utility:AnimateNew(button) Animation:ShowNewAction(_G[button], true) end --------------------------------------------------------------- -- Add action to free actionbutton --------------------------------------------------------------- local function AddAction(actionType, ID, autoassigned) ID = tonumber(ID) or ID local alreadyBound for id, ActionButton in pairs(Utility.Buttons) do alreadyBound = ( ActionButton:GetAttribute('type') == actionType and ( ActionButton:GetAttribute('cursorID') == ID or ActionButton:GetAttribute(actionType) == ID) ) and id if alreadyBound then break end end if alreadyBound and not autoassigned then Animation:ShowNewAction(Utility.Buttons[alreadyBound]) elseif not alreadyBound then for _, ActionButton in ipairs(Utility.Buttons) do if not ActionButton:GetAttribute('type') then if actionType == 'item' then ActionButton:SetAttribute('cursorID', ID) end ActionButton:SetAttribute('autoassigned', autoassigned) ActionButton:SetAttribute('type', actionType) ActionButton:SetAttribute(actionType, ID) Animation:ShowNewAction(ActionButton, autoassigned) break end end end end --------------------------------------------------------------- -- Manage auto-assigned items (quest items) --------------------------------------------------------------- local function AddItemForQuestLogIndex(itemTbl, questLogIndex) if questLogIndex then local link = CPAPI:GetQuestLogSpecialItemInfo(questLogIndex) local name = link and GetItemInfo(link) if name then local _, itemID = strsplit(':', strmatch(link, 'item[%-?%d:]+')) if itemID then itemTbl[name] = itemID end end end end local function GetQuestWatchItems() local items = {} for i=1, CPAPI:GetNumQuestWatches() do AddItemForQuestLogIndex(items, GetQuestIndexForWatch(i)) end for i=1, CPAPI:GetNumWorldQuestWatches() do AddItemForQuestLogIndex(items, GetQuestLogIndexByID(GetWorldQuestWatchInfo(i))) end return items end local function GetAutoAssignedItems() local items = {} for _, button in ipairs(Utility.Buttons) do local itemID = button:GetAutoAssigned() if itemID then items[itemID] = button end end return items end local function UpdateQuestItems(self) if not InCombatLockdown() then local oldItems = GetAutoAssignedItems() local newItems = GetQuestWatchItems() -- prune items that are not in the new set. for currItem, button in pairs(oldItems) do if not newItems[currItem] then button:SetAttribute('type', nil) button:SetAttribute('item', nil) end end -- add new items that are not already autoassigned. for newItemName, newItemID in pairs(newItems) do if not oldItems[newItemName] then AddAction('item', newItemID, true) end end self:RemoveUpdateSnippet(UpdateQuestItems) end end --------------------------------------------------------------- -- Tooltip --------------------------------------------------------------- function Tooltip:Refresh() if self.castButton then self:AddLine(self.castInfo:format(db.TEXTURE[self.castButton])) end self:AddLine(self.removeInfo:format(db.TEXTURE.CP_T_L3)) end function Tooltip:OnShow() self.castButton = ConsolePort:GetCurrentBindingOwner('CLICK ConsolePortUtilityToggle:LeftButton') -- set CC backdrop self:SetBackdropColor(red*0.15, green*0.15, blue*0.15, 0.75) self:Refresh() FadeIn(self, 0.2, 0, 1) end --------------------------------------------------------------- -- Ring maangement --------------------------------------------------------------- function Utility:OnEvent(event, ...) if (event == 'QUEST_ACCEPTED' or event == 'QUEST_POI_UPDATE' or event == 'QUEST_WATCH_LIST_CHANGED') and self.autoExtra then ConsolePort:RunOOC(UpdateQuestItems) end for _, ActionButton in ipairs(self.Buttons) do ActionButton:UpdateState() end end function Utility:OnButtonFocused(index) local button = self:GetAttribute(index) local focused = self.oldID and self:GetAttribute(self.oldID) if focused then focused:OnLeave() end if button and button:IsVisible() then button:OnEnter() if self:SetNewRotationValue(button:GetAttribute('rotation')) then FadeOut(self.Spell, 1, self.Spell:GetAlpha(), 0) else FadeIn(self.Spell, 0.2, self.Spell:GetAlpha(), 0.15) end if button:GetAttribute('type') then FadeIn(self.Runes, 3, self.Runes:GetAlpha(), 1) FadeIn(self.Ring, 0.2, self.Ring:GetAlpha(), 1) else FadeOut(self.Ring, 0.5, self.Ring:GetAlpha(), 0) FadeOut(self.Runes, 0.5, self.Runes:GetAlpha(), 0) end self.Gradient:Show() self.Gradient:ClearAllPoints() self.Gradient:SetPoint('CENTER', button, 'CENTER', 0, 0) FadeIn(self.Gradient, 0.2, self.Gradient:GetAlpha(), 1) FadeIn(self.Arrow, 0.2, self.Arrow:GetAlpha(), 1) self.Spell:Show() self.Spell:ClearAllPoints() self.Spell:SetPoint('CENTER', button, 0, 0) else FadeOut(self.Runes, 0.2, self.Runes:GetAlpha(), 0) FadeOut(self.Arrow, 0.2, self.Arrow:GetAlpha(), 0) FadeOut(self.Ring, 0.1, self.Ring:GetAlpha(), 0) self.anglenew = nil self.anglecur = nil self.Gradient:SetAlpha(0) self.Gradient:ClearAllPoints() self.Gradient:Hide() self.Spell:ClearAllPoints() self.Spell:Hide() end self.oldID = index end function Utility:DisplayHints(elapsed) self.hintTimer = self.hintTimer + elapsed if self.hintTimer > 5 then local binding = ConsolePort:GetFormattedBindingOwner('CLICK ConsolePortUtilityToggle:LeftButton', nil, nil, true) if binding then if self:GetAttribute('toggled') then db.Hint:DisplayMessage(format(db.TUTORIAL.HINTS.UTILITY_RING_DOUBLE, binding), 4, -190) else db.Hint:DisplayMessage(format(db.TUTORIAL.HINTS.UTILITY_RING_BIND, binding), 4, -190) end else db.Hint:DisplayMessage(db.CUSTOMBINDS.CP_UTILITYBELT) end self.hasHints = nil end end function Utility:OnUpdateDisplay(elapsed) if self.hasHints then self:DisplayHints(elapsed) end end function Utility:OnShow() Animation:Hide() AniCircle:Hide() --self.Spell:SetSize(175, 175) FadeOut(self.Ring, 0, 0, 0) FadeOut(self.Arrow, 0, 0, 0) FadeOut(self.Runes, 0, 0, 0) self.hintTimer = 0 self.hasHints = true end function Utility:OnHide() self.Gradient:SetAlpha(0) self.Gradient:ClearAllPoints() self.Gradient:Hide() -- self.Spell:Hide() end Utility:SetAttribute('_onextrabar', [[ local extraID = 169 local size = self:RunAttribute('_getsize') if newstate then for i=1, size do local button = self:GetFrameRef(tostring(i)) if button:GetAttribute('type') == 'action' and button:GetAttribute('action') == extraID then self:CallMethod('AnimateNew', button:GetName()) return end end for i=1, size do local button = self:GetFrameRef(tostring(i)) if not button:GetAttribute('type') then button:SetAlpha(1) button:SetAttribute('type', 'action') button:SetAttribute('action', extraID) self:CallMethod('AnimateNew', button:GetName()) return end end else for i=1, size do local button = self:GetFrameRef(tostring(i)) if button:GetAttribute('type') == 'action' and button:GetAttribute('action') == extraID then button:SetAlpha(0.5) button:SetAttribute('type', nil) button:SetAttribute('action', nil) end end end ]]) --------------------------------------------------------------- -- Callbacks --------------------------------------------------------------- local function OnButtonContentChanged(self, actionType) ConsolePortUtility[self:GetID()] = { action = actionType; value = self:GetAttribute(actionType); cursorID = self:GetAttribute('cursorID'); autoassigned = self:GetAttribute('autoassigned'); } end local function OnButtonContentRemoved(self) ConsolePortUtility[self:GetID()] = nil end function Utility:OnNewButton(button, index, angle, rotation) button.Cooldown:SetSwipeColor(db.Atlas.GetNormalizedCC()) button.Pushed:SetVertexColor(red, green, blue, 1) button.OnContentChanged = OnButtonContentChanged button.OnContentRemoved = OnButtonContentRemoved self:SetAttribute(tostring(angle), button) end function Utility:OnNewRotation(value) self.Ring:SetRotation(value) self.Arrow:SetRotation(value) self.Runes:SetRotation(value) end function Utility:OnRefresh(size) for index, info in pairs(ConsolePortUtility) do local actionButton = self.Buttons[index] if actionButton and info.action then actionButton:SetAttribute('autoassigned', info.autoassigned) actionButton:SetAttribute('type', info.action) actionButton:SetAttribute('cursorID', info.cursorID) actionButton:SetAttribute(info.action, info.value) actionButton:Show() end end self.autoExtra = db.Settings.autoExtra self.frameScale = db.Settings.utilityRingScale or 1 self:SetScale(self.frameScale) self.Runes:SetSize(448 + (8 * size), 448 + (8 * size)) self.Full:SetTexture([[Interface\AddOns\ConsolePort\Textures\Utility\UtilityGlow]]..size) if self.autoExtra then ConsolePort:RunOOC(UpdateQuestItems) end self:SetCursorDrop(true) self:SetExtraButtonDrop(self.autoExtra) for _, event in pairs({ 'ACTIONBAR_UPDATE_COOLDOWN', 'ACTIONBAR_UPDATE_STATE', 'ACTIONBAR_UPDATE_USABLE', 'BAG_UPDATE', 'BAG_UPDATE_COOLDOWN', 'QUEST_ACCEPTED', 'QUEST_POI_UPDATE', 'QUEST_WATCH_LIST_CHANGED', 'SPELL_UPDATE_COOLDOWN', 'SPELL_UPDATE_CHARGES', 'SPELL_UPDATE_USABLE', }) do pcall(self.RegisterEvent, self, event) end end --------------------------------------------------------------- function ConsolePort:AddUtilityAction(actionType, value) if actionType and value then AddAction(actionType, value) end end function ConsolePort:SetupUtilityRing() if not InCombatLockdown() then Utility:UnregisterAllEvents() Utility:Initialize() self:RemoveUpdateSnippet(self.SetupUtilityRing) end end --------------------------------------------------------------- Utility.Gradient:SetVertexColor(red * colMul, green * colMul, blue * colMul) Utility.Full:SetVertexColor(red * 1.5, green * 1.5, blue * 1.5) Utility.Ring:SetVertexColor(red * colMul, green * colMul, blue * colMul) Utility.Arrow:SetVertexColor(red * 1.25, green * 1.25, blue * 1.25) --------------------------------------------------------------- Utility:HookScript('OnHide', Utility.OnHide) Utility:HookScript('OnShow', Utility.OnShow) Utility:HookScript('OnEvent', Utility.OnEvent) Utility:HookScript('OnUpdate', Utility.OnUpdateDisplay) --------------------------------------------------------------- --------------------------------------------------------------- Animation:SetSize(64, 64) Animation:SetFrameStrata('TOOLTIP') Animation.Group = Animation:CreateAnimationGroup() --------------------------------------------------------------- Animation.Icon = Animation:CreateTexture(nil, 'ARTWORK') Animation.Quest = Animation:CreateTexture(nil, 'OVERLAY') Animation.Border = Animation:CreateTexture(nil, 'OVERLAY') Animation.Scale = Animation.Group:CreateAnimation('Scale') Animation.Fade = Animation.Group:CreateAnimation('Alpha') --------------------------------------------------------------- Animation.Scale:SetToScale(1, 1) Animation.Scale:SetFromScale(2, 2) Animation.Scale:SetDuration(0.5) Animation.Scale:SetSmoothing('IN') Animation.Fade:SetFromAlpha(1) Animation.Fade:SetToAlpha(0) Animation.Fade:SetSmoothing('OUT') Animation.Fade:SetStartDelay(3) Animation.Fade:SetDuration(0.2) --------------------------------------------------------------- Animation.Border:SetTexture('Interface\\AddOns\\ConsolePort\\Textures\\Button\\Normal') Animation.Border:SetAlpha(1) Animation.Border:SetAllPoints(Animation) --------------------------------------------------------------- Animation.Icon:SetSize(64, 64) Animation.Icon:SetPoint('CENTER', 0, 0) Animation.Icon:SetMask('Interface\\AddOns\\ConsolePort\\Textures\\Button\\Mask') --------------------------------------------------------------- Animation.Quest:SetTexture('Interface\\AddOns\\ConsolePort\\Textures\\QuestButton') Animation.Quest:SetPoint('CENTER', 0, 0) Animation.Quest:SetSize(64, 64) --------------------------------------------------------------- Animation.Gradient = Animation:CreateTexture(nil, 'BACKGROUND') Animation.Gradient:SetTexture('Interface\\AddOns\\ConsolePort\\Textures\\Window\\Circle') Animation.Gradient:SetBlendMode('ADD') Animation.Gradient:SetVertexColor(red, green, blue, 1) Animation.Gradient:SetPoint('CENTER', 0, 0) Animation.Gradient:SetSize(512, 512) --------------------------------------------------------------- Animation.Shadow = Animation:CreateTexture(nil, 'BACKGROUND') Animation.Shadow:SetTexture('Interface\\AddOns\\ConsolePort\\Textures\\Button\\NormalShadow') Animation.Shadow:SetSize(82, 82) Animation.Shadow:SetPoint('CENTER', 0, -6) Animation.Shadow:SetAlpha(0.75) --------------------------------------------------------------- Animation.Spell = CreateFrame('PlayerModel', nil, Animation) Animation.Spell:SetFrameStrata('TOOLTIP') Animation.Spell:SetPoint('CENTER', Animation.Icon, 'CENTER', -4, 0) Animation.Spell:SetSize(176, 176) Animation.Spell:SetAlpha(0) Animation.Spell:SetDisplayInfo(66673) --(42486) Animation.Spell:SetCamDistanceScale(2) Animation.Spell:SetFrameLevel(1) --------------------------------------------------------------- Animation.Group:SetScript('OnFinished', AnimateOnFinished) --------------------------------------------------------------- AniCircle:SetPoint('CENTER', 0, 0) AniCircle:SetSize(512, 512) AniCircle:Hide() --------------------------------------------------------------- --------------------------------------------------------------- AniCircle.Ring = AniCircle:CreateTexture(nil, 'OVERLAY', nil, 2) AniCircle.Ring:SetTexture('Interface\\AddOns\\ConsolePort\\Textures\\Utility\\UtilityCircle') AniCircle.Ring:SetVertexColor(red * colMul, green * colMul, blue * colMul) AniCircle.Ring:SetPoint('CENTER', 0, 0) AniCircle.Ring:SetSize(512, 512) --AniCircle.Ring:SetAlpha(0) AniCircle.Ring:SetRotation(0) AniCircle.Ring:SetBlendMode('ADD') --------------------------------------------------------------- AniCircle.Arrow = AniCircle:CreateTexture(nil, 'OVERLAY') AniCircle.Arrow:SetTexture('Interface\\AddOns\\ConsolePort\\Textures\\Utility\\UtilityArrow') AniCircle.Arrow:SetVertexColor(red * 1.25, green * 1.25, blue * 1.25) AniCircle.Arrow:SetPoint('CENTER', 0, 0) AniCircle.Arrow:SetSize(512, 512) --AniCircle.Arrow:SetAlpha(0) AniCircle.Arrow:SetRotation(0) --------------------------------------------------------------- AniCircle.Runes = AniCircle:CreateTexture(nil, 'OVERLAY') AniCircle.Runes:SetTexture('Interface\\AddOns\\ConsolePort\\Textures\\Utility\\UtilityRunes') AniCircle.Runes:SetPoint('CENTER', 0, 0) AniCircle.Runes:SetSize(512, 512) --AniCircle.Runes:SetAlpha(0) AniCircle.Runes:SetRotation(0) --------------------------------------------------------------- --------------------------------------------------------------- Tooltip:SetScript('OnShow', Tooltip.OnShow) Tooltip.castInfo = db.TOOLTIP.UTILITY_RELEASE Tooltip.removeInfo = db.TOOLTIP.UTILITY_REMOVE ---------------------------------------------------------------
-- -- set a write lock on a resource group -- -- KEYS[1] - resource key -- ARGV[1] - transaction id -- ARGV[2] - ttl local resource = KEYS[1] local transactionId = ARGV[1] local ttl = ARGV[2] local readLock = resource .. ':lock:read' local writeLock = resource .. ':lock:write' local isReadLocked = redis.call('exists', readLock) if isReadLocked == 1 then return { err = 'There exists a read lock on this resource' } end local writeLockId = redis.call('get', writeLock) if writeLockId then if writeLockId == transactionId then return 0 end return { err = 'There already exists a write lock on this resource' } end redis.call('hmset', transactionId, 'type', 'write', 'key', writeLock) local result = redis.call('set', writeLock, transactionId, 'NX') if ttl ~= 'null' then redis.call('pexpire', transactionId, ttl * 2) redis.call('pexpire', writeLock, ttl) end return result
--Child Folders includeFile("custom_content/tangible/collection/reward/serverobjects.lua") -- Server Objects includeFile("custom_content/tangible/collection/beetle_borer.lua") includeFile("custom_content/tangible/collection/beetle_flame.lua") includeFile("custom_content/tangible/collection/beetle_ground.lua") includeFile("custom_content/tangible/collection/beetle_junk.lua") includeFile("custom_content/tangible/collection/beetle_piranha.lua") includeFile("custom_content/tangible/collection/beetle_young_cave.lua") includeFile("custom_content/tangible/collection/col_dust_durni_01.lua") includeFile("custom_content/tangible/collection/col_dust_durni_02.lua") includeFile("custom_content/tangible/collection/col_dust_durni_03.lua") includeFile("custom_content/tangible/collection/col_dust_durni_04.lua") includeFile("custom_content/tangible/collection/col_dust_durni_05.lua") includeFile("custom_content/tangible/collection/col_dust_durni_06.lua") includeFile("custom_content/tangible/collection/col_dust_durni_07.lua") includeFile("custom_content/tangible/collection/col_dust_durni_08.lua") includeFile("custom_content/tangible/collection/col_dust_durni_09.lua") includeFile("custom_content/tangible/collection/col_dust_durni_10.lua") includeFile("custom_content/tangible/collection/col_ent_fan_01.lua") includeFile("custom_content/tangible/collection/col_ent_fan_02.lua") includeFile("custom_content/tangible/collection/col_ent_fan_03.lua") includeFile("custom_content/tangible/collection/col_ent_fan_04.lua") includeFile("custom_content/tangible/collection/col_ent_fan_05.lua") includeFile("custom_content/tangible/collection/col_ent_fan_06.lua") includeFile("custom_content/tangible/collection/col_ent_instrument_01.lua") includeFile("custom_content/tangible/collection/col_ent_instrument_02.lua") includeFile("custom_content/tangible/collection/col_ent_instrument_03.lua") includeFile("custom_content/tangible/collection/col_ent_instrument_04.lua") includeFile("custom_content/tangible/collection/col_ent_instrument_05.lua") includeFile("custom_content/tangible/collection/col_ent_instrument_06.lua") includeFile("custom_content/tangible/collection/col_family_story_flower_01.lua") includeFile("custom_content/tangible/collection/col_family_story_flower_02.lua") includeFile("custom_content/tangible/collection/col_family_story_flower_03.lua") includeFile("custom_content/tangible/collection/col_family_story_flower_04.lua") includeFile("custom_content/tangible/collection/col_family_story_flower_05.lua") includeFile("custom_content/tangible/collection/col_family_story_grave_01.lua") includeFile("custom_content/tangible/collection/col_family_story_grave_02.lua") includeFile("custom_content/tangible/collection/col_family_story_grave_03.lua") includeFile("custom_content/tangible/collection/col_family_story_grave_04.lua") includeFile("custom_content/tangible/collection/col_family_story_grave_05.lua") includeFile("custom_content/tangible/collection/col_force_shui_painting_01.lua") includeFile("custom_content/tangible/collection/col_force_shui_painting_02.lua") includeFile("custom_content/tangible/collection/col_force_shui_painting_03.lua") includeFile("custom_content/tangible/collection/col_force_shui_painting_04.lua") includeFile("custom_content/tangible/collection/col_force_shui_painting_05.lua") includeFile("custom_content/tangible/collection/col_force_shui_table_01.lua") includeFile("custom_content/tangible/collection/col_force_shui_table_02.lua") includeFile("custom_content/tangible/collection/col_force_shui_table_03.lua") includeFile("custom_content/tangible/collection/col_force_shui_table_04.lua") includeFile("custom_content/tangible/collection/col_force_shui_table_05.lua") includeFile("custom_content/tangible/collection/col_gcw_city_imp_1.lua") includeFile("custom_content/tangible/collection/col_gcw_city_imp_2.lua") includeFile("custom_content/tangible/collection/col_gcw_city_imp_3.lua") includeFile("custom_content/tangible/collection/col_gcw_city_imp_4.lua") includeFile("custom_content/tangible/collection/col_gcw_city_reb_1.lua") includeFile("custom_content/tangible/collection/col_gcw_city_reb_2.lua") includeFile("custom_content/tangible/collection/col_gcw_city_reb_3.lua") includeFile("custom_content/tangible/collection/col_gcw_city_reb_4.lua") includeFile("custom_content/tangible/collection/col_gcw_static_base_corellia.lua") includeFile("custom_content/tangible/collection/col_gcw_static_base_naboo.lua") includeFile("custom_content/tangible/collection/col_gcw_static_base_talus.lua") includeFile("custom_content/tangible/collection/col_hoth_frozen_tauntaun.lua") includeFile("custom_content/tangible/collection/col_hoth_meteorite_01.lua") includeFile("custom_content/tangible/collection/col_jalopy_crate_01.lua") includeFile("custom_content/tangible/collection/col_jalopy_crate_02.lua") includeFile("custom_content/tangible/collection/col_jalopy_crate_03.lua") includeFile("custom_content/tangible/collection/col_jalopy_crate_04.lua") includeFile("custom_content/tangible/collection/col_jalopy_crate_05.lua") includeFile("custom_content/tangible/collection/col_jalopy_crate_06.lua") includeFile("custom_content/tangible/collection/col_jalopy_crate_07.lua") includeFile("custom_content/tangible/collection/col_jalopy_crate_08.lua") includeFile("custom_content/tangible/collection/col_jalopy_crate_09.lua") includeFile("custom_content/tangible/collection/col_jalopy_crate_10.lua") includeFile("custom_content/tangible/collection/col_jalopy_crate_11.lua") includeFile("custom_content/tangible/collection/col_jalopy_crate_12.lua") includeFile("custom_content/tangible/collection/col_nym_weed_01.lua") includeFile("custom_content/tangible/collection/col_nym_weed_02.lua") includeFile("custom_content/tangible/collection/col_nym_weed_03.lua") includeFile("custom_content/tangible/collection/col_nym_weed_04.lua") includeFile("custom_content/tangible/collection/col_nym_weed_05.lua") includeFile("custom_content/tangible/collection/col_nym_weed_06.lua") includeFile("custom_content/tangible/collection/col_nym_weed_07.lua") includeFile("custom_content/tangible/collection/col_nym_weed_08.lua") includeFile("custom_content/tangible/collection/col_nym_weed_09.lua") includeFile("custom_content/tangible/collection/col_nym_weed_10.lua") includeFile("custom_content/tangible/collection/col_stage_controller_01.lua") includeFile("custom_content/tangible/collection/col_stage_controller_02.lua") includeFile("custom_content/tangible/collection/col_stage_controller_03.lua") includeFile("custom_content/tangible/collection/col_tatooine_vistas_marker_01.lua") includeFile("custom_content/tangible/collection/col_tatooine_vistas_marker_02.lua") includeFile("custom_content/tangible/collection/col_tatooine_vistas_marker_03.lua") includeFile("custom_content/tangible/collection/col_tatooine_vistas_marker_04.lua") includeFile("custom_content/tangible/collection/col_tatooine_vistas_marker_05.lua") includeFile("custom_content/tangible/collection/col_tatooine_vistas_marker_06.lua") includeFile("custom_content/tangible/collection/col_tatooine_vistas_marker_07.lua") includeFile("custom_content/tangible/collection/col_tatooine_vistas_marker_08.lua") includeFile("custom_content/tangible/collection/col_tatooine_vistas_marker_09.lua") includeFile("custom_content/tangible/collection/col_tatooine_vistas_marker_10.lua") includeFile("custom_content/tangible/collection/col_wod_herb_01.lua") includeFile("custom_content/tangible/collection/col_wod_herb_02.lua") includeFile("custom_content/tangible/collection/col_wod_herb_03.lua") includeFile("custom_content/tangible/collection/col_wod_herb_04.lua") includeFile("custom_content/tangible/collection/col_wod_herb_05.lua") includeFile("custom_content/tangible/collection/col_wod_herb_06.lua") includeFile("custom_content/tangible/collection/col_wod_herb_07.lua") includeFile("custom_content/tangible/collection/com_link_01.lua") includeFile("custom_content/tangible/collection/com_link_02.lua") includeFile("custom_content/tangible/collection/com_link_03.lua") includeFile("custom_content/tangible/collection/com_link_04.lua") includeFile("custom_content/tangible/collection/com_link_05.lua") includeFile("custom_content/tangible/collection/com_link_06.lua") includeFile("custom_content/tangible/collection/com_link_07.lua") includeFile("custom_content/tangible/collection/com_link_08.lua") includeFile("custom_content/tangible/collection/com_link_09.lua") includeFile("custom_content/tangible/collection/com_link_10.lua") includeFile("custom_content/tangible/collection/dancing_droid_01.lua") includeFile("custom_content/tangible/collection/dancing_droid_02.lua") includeFile("custom_content/tangible/collection/dancing_droid_03.lua") includeFile("custom_content/tangible/collection/dancing_droid_04.lua") includeFile("custom_content/tangible/collection/dancing_droid_05.lua") includeFile("custom_content/tangible/collection/dancing_droid_06.lua") includeFile("custom_content/tangible/collection/dancing_droid_07.lua") includeFile("custom_content/tangible/collection/dancing_droid_08.lua") includeFile("custom_content/tangible/collection/dancing_droid_09.lua") includeFile("custom_content/tangible/collection/dancing_droid_10.lua") includeFile("custom_content/tangible/collection/datapad_01.lua") includeFile("custom_content/tangible/collection/datapad_02.lua") includeFile("custom_content/tangible/collection/datapad_03.lua") includeFile("custom_content/tangible/collection/datapad_04.lua") includeFile("custom_content/tangible/collection/datapad_05.lua") includeFile("custom_content/tangible/collection/datapad_06.lua") includeFile("custom_content/tangible/collection/datapad_07.lua") includeFile("custom_content/tangible/collection/datapad_08.lua") includeFile("custom_content/tangible/collection/datapad_09.lua") includeFile("custom_content/tangible/collection/datapad_10.lua") includeFile("custom_content/tangible/collection/deathtrooper_alpha_bloody_knife_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_alpha_broken_rifle_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_alpha_camera_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_alpha_cracked_helmet_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_alpha_datadisk_letter_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_alpha_movement_sensor_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_alpha_radio_antenna_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_alpha_signal_flare_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_alpha_stuffed_bantha_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_alpha_torn_shirt_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_beta_batteries_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_beta_bracelet_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_beta_broken_radio_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_beta_cracked_s_armor_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_beta_damaged_pistol_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_beta_emergency_rations_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_beta_flash_light_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_beta_id_card_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_beta_medical_kit_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_beta_survival_kit_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_delta_ammo_canister_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_delta_basket_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_delta_camping_cot_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_delta_medical_scanner_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_delta_pet_cage_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_delta_power_converter_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_delta_scout_pistol_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_delta_signal_scanner_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_delta_skeleton_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_delta_vibro_sword_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_epsilon_antidote_kit_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_epsilon_backpack_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_epsilon_camp_fire_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_epsilon_carbine_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_epsilon_computer_toolkit_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_epsilon_holodisk_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_epsilon_locator_beacon_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_epsilon_medical_console_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_epsilon_medical_tool_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_epsilon_radio_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_gamma_ambush_detector_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_gamma_bloody_jacket_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_gamma_cargo_pockets_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_gamma_cookling_utensils_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_gamma_datadisk_diary_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_gamma_energy_cartridge_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_gamma_radar_beacon_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_gamma_recording_rod_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_gamma_shuttle_ticket01.lua") includeFile("custom_content/tangible/collection/deathtrooper_gamma_used_med_kit_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_research_auto_syringe_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_research_broken_laser_rifle_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_research_cracked_datapad_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_research_emergency_generator_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_research_frequency_scanner_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_research_medical_canister_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_research_patient_records_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_research_personal_locator_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_research_stuffed_stardestroyer_01.lua") includeFile("custom_content/tangible/collection/deathtrooper_research_supply_crate_01.lua") includeFile("custom_content/tangible/collection/dwartii_statue_braata.lua") includeFile("custom_content/tangible/collection/dwartii_statue_faya.lua") includeFile("custom_content/tangible/collection/dwartii_statue_sistros.lua") includeFile("custom_content/tangible/collection/dwartii_statue_yanjon.lua") includeFile("custom_content/tangible/collection/esb_week_1.lua") includeFile("custom_content/tangible/collection/esb_week_2.lua") includeFile("custom_content/tangible/collection/esb_week_3.lua") includeFile("custom_content/tangible/collection/esb_week_4.lua") includeFile("custom_content/tangible/collection/flower_01.lua") includeFile("custom_content/tangible/collection/flower_02.lua") includeFile("custom_content/tangible/collection/flower_03.lua") includeFile("custom_content/tangible/collection/flower_04.lua") includeFile("custom_content/tangible/collection/flower_05.lua") includeFile("custom_content/tangible/collection/flower_06.lua") includeFile("custom_content/tangible/collection/flower_07.lua") includeFile("custom_content/tangible/collection/flower_08.lua") includeFile("custom_content/tangible/collection/flower_09.lua") includeFile("custom_content/tangible/collection/flower_10.lua") includeFile("custom_content/tangible/collection/flower_11.lua") includeFile("custom_content/tangible/collection/flower_12.lua") includeFile("custom_content/tangible/collection/flower_13.lua") includeFile("custom_content/tangible/collection/flower_14.lua") includeFile("custom_content/tangible/collection/flower_15.lua") includeFile("custom_content/tangible/collection/flower_16.lua") includeFile("custom_content/tangible/collection/flower_17.lua") includeFile("custom_content/tangible/collection/flower_18.lua") includeFile("custom_content/tangible/collection/flower_19.lua") includeFile("custom_content/tangible/collection/flower_20.lua") includeFile("custom_content/tangible/collection/gem_cushion_hueable_01.lua") includeFile("custom_content/tangible/collection/gem_cylinder_hueable_01.lua") includeFile("custom_content/tangible/collection/gem_emerald_hueable_01.lua") includeFile("custom_content/tangible/collection/gem_heart_hueable_01.lua") includeFile("custom_content/tangible/collection/gem_marquis_hueable_01.lua") includeFile("custom_content/tangible/collection/gem_oval_hueable_01.lua") includeFile("custom_content/tangible/collection/gem_pear_hueable_01.lua") includeFile("custom_content/tangible/collection/gem_round_hueable_01.lua") includeFile("custom_content/tangible/collection/gem_square_hueable_01.lua") includeFile("custom_content/tangible/collection/gem_triliant_hueable_01.lua") includeFile("custom_content/tangible/collection/hanging_light_01.lua") includeFile("custom_content/tangible/collection/hanging_light_02.lua") includeFile("custom_content/tangible/collection/hanging_light_02_01.lua") includeFile("custom_content/tangible/collection/hanging_light_02_02.lua") includeFile("custom_content/tangible/collection/hanging_light_02_03.lua") includeFile("custom_content/tangible/collection/hanging_light_02_04.lua") includeFile("custom_content/tangible/collection/hanging_light_02_05.lua") includeFile("custom_content/tangible/collection/hanging_light_02_06.lua") includeFile("custom_content/tangible/collection/hanging_light_02_07.lua") includeFile("custom_content/tangible/collection/hanging_light_02_08.lua") includeFile("custom_content/tangible/collection/hanging_light_02_09.lua") includeFile("custom_content/tangible/collection/hanging_light_02_10.lua") includeFile("custom_content/tangible/collection/hanging_light_03.lua") includeFile("custom_content/tangible/collection/hanging_light_04.lua") includeFile("custom_content/tangible/collection/hanging_light_05.lua") includeFile("custom_content/tangible/collection/hanging_light_06.lua") includeFile("custom_content/tangible/collection/hanging_light_07.lua") includeFile("custom_content/tangible/collection/hanging_light_08.lua") includeFile("custom_content/tangible/collection/hanging_light_09.lua") includeFile("custom_content/tangible/collection/hanging_light_10.lua") includeFile("custom_content/tangible/collection/meatlump_listening_device.lua") includeFile("custom_content/tangible/collection/meatlump_listening_location_object_01.lua") includeFile("custom_content/tangible/collection/meatlump_listening_location_object_02.lua") includeFile("custom_content/tangible/collection/meatlump_listening_location_object_03.lua") includeFile("custom_content/tangible/collection/meatlump_listening_location_object_04.lua") includeFile("custom_content/tangible/collection/meatlump_listening_location_object_05.lua") includeFile("custom_content/tangible/collection/meatlump_listening_location_object_06.lua") includeFile("custom_content/tangible/collection/ore_collectible.lua") includeFile("custom_content/tangible/collection/plant_01.lua") includeFile("custom_content/tangible/collection/plant_02.lua") includeFile("custom_content/tangible/collection/plant_03.lua") includeFile("custom_content/tangible/collection/plant_04.lua") includeFile("custom_content/tangible/collection/plant_05.lua") includeFile("custom_content/tangible/collection/plant_06.lua") includeFile("custom_content/tangible/collection/plant_07.lua") includeFile("custom_content/tangible/collection/plant_08.lua") includeFile("custom_content/tangible/collection/plant_09.lua") includeFile("custom_content/tangible/collection/plant_10.lua") includeFile("custom_content/tangible/collection/plant_11.lua") includeFile("custom_content/tangible/collection/plant_12.lua") includeFile("custom_content/tangible/collection/plant_13.lua") includeFile("custom_content/tangible/collection/plant_14.lua") includeFile("custom_content/tangible/collection/plant_15.lua") includeFile("custom_content/tangible/collection/plant_16.lua") includeFile("custom_content/tangible/collection/plant_17.lua") includeFile("custom_content/tangible/collection/plant_18.lua") includeFile("custom_content/tangible/collection/plant_19.lua") includeFile("custom_content/tangible/collection/plant_20.lua") includeFile("custom_content/tangible/collection/publish_gift_comlink_component_01.lua") includeFile("custom_content/tangible/collection/publish_gift_comlink_component_02.lua") includeFile("custom_content/tangible/collection/publish_gift_comlink_component_03.lua") includeFile("custom_content/tangible/collection/publish_gift_comlink_component_04.lua") includeFile("custom_content/tangible/collection/publish_gift_comlink_component_05.lua") includeFile("custom_content/tangible/collection/publish_gift_comlink_component_06.lua") includeFile("custom_content/tangible/collection/publish_gift_comlink_component_07.lua") includeFile("custom_content/tangible/collection/publish_gift_comlink_component_08.lua") includeFile("custom_content/tangible/collection/publish_gift_comlink_component_09.lua") includeFile("custom_content/tangible/collection/publish_gift_comlink_component_10.lua") includeFile("custom_content/tangible/collection/publish_gift_comlink_desk.lua") includeFile("custom_content/tangible/collection/rare_carbine_blackscale_hall_sweeper.lua") includeFile("custom_content/tangible/collection/rare_carbine_corestrike_rancor.lua") includeFile("custom_content/tangible/collection/rare_carbine_coynite_sfor_republic.lua") includeFile("custom_content/tangible/collection/rare_carbine_crusader_m_x3.lua") includeFile("custom_content/tangible/collection/rare_carbine_cy_m.lua") includeFile("custom_content/tangible/collection/rare_carbine_darklighter_e11.lua") includeFile("custom_content/tangible/collection/rare_carbine_exemplar_mark_01.lua") includeFile("custom_content/tangible/collection/rare_carbine_firestar_10_k.lua") includeFile("custom_content/tangible/collection/rare_carbine_forward_commander.lua") includeFile("custom_content/tangible/collection/rare_carbine_grievance_striker.lua") includeFile("custom_content/tangible/collection/rare_carbine_hair_trigger.lua") includeFile("custom_content/tangible/collection/rare_carbine_hk_47.lua") includeFile("custom_content/tangible/collection/rare_carbine_kalranoos.lua") includeFile("custom_content/tangible/collection/rare_carbine_kubaza.lua") includeFile("custom_content/tangible/collection/rare_carbine_malevolent_bowcaster.lua") includeFile("custom_content/tangible/collection/rare_carbine_modified_x1.lua") includeFile("custom_content/tangible/collection/rare_carbine_mustafarian_modified_sfor_republic.lua") includeFile("custom_content/tangible/collection/rare_carbine_nym_slugthrower.lua") includeFile("custom_content/tangible/collection/rare_carbine_or_5_e5.lua") includeFile("custom_content/tangible/collection/rare_carbine_proton.lua") includeFile("custom_content/tangible/collection/rare_carbine_sfor.lua") includeFile("custom_content/tangible/collection/rare_carbine_specops_bola.lua") includeFile("custom_content/tangible/collection/rare_carbine_white_thranta_e11.lua") includeFile("custom_content/tangible/collection/rare_heavy_ak_prime_rocket.lua") includeFile("custom_content/tangible/collection/rare_heavy_corellian_destroyer.lua") includeFile("custom_content/tangible/collection/rare_heavy_crusader_m_xx.lua") includeFile("custom_content/tangible/collection/rare_heavy_devastator_acid_launcher.lua") includeFile("custom_content/tangible/collection/rare_heavy_devastator_lava_cannon.lua") includeFile("custom_content/tangible/collection/rare_heavy_lava_cannon.lua") includeFile("custom_content/tangible/collection/rare_heavy_malevolent_flamethrower.lua") includeFile("custom_content/tangible/collection/rare_heavy_oppressor_flame_thrower.lua") includeFile("custom_content/tangible/collection/rare_heavy_republic_flame_thrower.lua") includeFile("custom_content/tangible/collection/rare_heavy_void.lua") includeFile("custom_content/tangible/collection/rare_melee_2h_kashyyyk_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_2h_tulrus_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_blacksun_executioners_hack.lua") includeFile("custom_content/tangible/collection/rare_melee_blade_betrayer.lua") includeFile("custom_content/tangible/collection/rare_melee_blk_mtl_gaderiffi.lua") includeFile("custom_content/tangible/collection/rare_melee_blksn_razor.lua") includeFile("custom_content/tangible/collection/rare_melee_blksn_stun_stick.lua") includeFile("custom_content/tangible/collection/rare_melee_bloodshot_ripper.lua") includeFile("custom_content/tangible/collection/rare_melee_caller_storms.lua") includeFile("custom_content/tangible/collection/rare_melee_champion_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_corsec_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_cy_m_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_darstaiis_sickle.lua") includeFile("custom_content/tangible/collection/rare_melee_doom_bringer.lua") includeFile("custom_content/tangible/collection/rare_melee_engineer_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_eventide_smasher.lua") includeFile("custom_content/tangible/collection/rare_melee_forward_commander_knuckler.lua") includeFile("custom_content/tangible/collection/rare_melee_gamorrean_axe.lua") includeFile("custom_content/tangible/collection/rare_melee_grooved_2h_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_hammer_miner.lua") includeFile("custom_content/tangible/collection/rare_melee_hk_47_knuckler.lua") includeFile("custom_content/tangible/collection/rare_melee_hk_47_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_hk_lance.lua") includeFile("custom_content/tangible/collection/rare_melee_kaminoan_staff.lua") includeFile("custom_content/tangible/collection/rare_melee_kashyyyk_blade_stick.lua") includeFile("custom_content/tangible/collection/rare_melee_katana_runaway.lua") includeFile("custom_content/tangible/collection/rare_melee_knuckles_katarn.lua") includeFile("custom_content/tangible/collection/rare_melee_lance_runaway.lua") includeFile("custom_content/tangible/collection/rare_melee_lifeblood_cleaver.lua") includeFile("custom_content/tangible/collection/rare_melee_malevolent_heavy_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_malevolent_lance.lua") includeFile("custom_content/tangible/collection/rare_melee_malevolent_obsidian_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_mustafarian_modified_2h_obsidian_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_necrosis_nightblade.lua") includeFile("custom_content/tangible/collection/rare_melee_nightsister_energy_lance.lua") includeFile("custom_content/tangible/collection/rare_melee_nk_executer.lua") includeFile("custom_content/tangible/collection/rare_melee_nyenthioris.lua") includeFile("custom_content/tangible/collection/rare_melee_obsidian_lance.lua") includeFile("custom_content/tangible/collection/rare_melee_oppressor_polearm.lua") includeFile("custom_content/tangible/collection/rare_melee_or5_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_pestilence.lua") includeFile("custom_content/tangible/collection/rare_melee_poisonspike.lua") includeFile("custom_content/tangible/collection/rare_melee_rydels_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_sayormi_heartstriker.lua") includeFile("custom_content/tangible/collection/rare_melee_sinew_wrapped_knife.lua") includeFile("custom_content/tangible/collection/rare_melee_strike_assault_lance.lua") includeFile("custom_content/tangible/collection/rare_melee_task_master_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_trando_hunters_lance.lua") includeFile("custom_content/tangible/collection/rare_melee_tulrus_sword.lua") includeFile("custom_content/tangible/collection/rare_melee_underworld_blade.lua") includeFile("custom_content/tangible/collection/rare_melee_urnsoris_soulleecher.lua") includeFile("custom_content/tangible/collection/rare_melee_valarian_knuckler.lua") includeFile("custom_content/tangible/collection/rare_melee_white_thranta_katana.lua") includeFile("custom_content/tangible/collection/rare_melee_white_thranta_knuckler.lua") includeFile("custom_content/tangible/collection/rare_melee_white_thranta_lance.lua") includeFile("custom_content/tangible/collection/rare_melee_wke_heartlance.lua") includeFile("custom_content/tangible/collection/rare_melee_wke_toothpick.lua") includeFile("custom_content/tangible/collection/rare_melee_xandank_lance.lua") includeFile("custom_content/tangible/collection/rare_melee_xris_acid_sword.lua") includeFile("custom_content/tangible/collection/rare_pistol_blackfalcon.lua") includeFile("custom_content/tangible/collection/rare_pistol_blackhand.lua") includeFile("custom_content/tangible/collection/rare_pistol_coynite.lua") includeFile("custom_content/tangible/collection/rare_pistol_d18_liquidator.lua") includeFile("custom_content/tangible/collection/rare_pistol_deathrain.lua") includeFile("custom_content/tangible/collection/rare_pistol_dl44_dosh_special.lua") includeFile("custom_content/tangible/collection/rare_pistol_dragoneye.lua") includeFile("custom_content/tangible/collection/rare_pistol_geonosian_sonic_blaster.lua") includeFile("custom_content/tangible/collection/rare_pistol_grooved_dl44.lua") includeFile("custom_content/tangible/collection/rare_pistol_ion_relic.lua") includeFile("custom_content/tangible/collection/rare_pistol_ion_stunner.lua") includeFile("custom_content/tangible/collection/rare_pistol_jawa_ion.lua") includeFile("custom_content/tangible/collection/rare_pistol_kashyyyk_stalker.lua") includeFile("custom_content/tangible/collection/rare_pistol_kyd21.lua") includeFile("custom_content/tangible/collection/rare_pistol_liquidsilver_l7.lua") includeFile("custom_content/tangible/collection/rare_pistol_modified_de10.lua") includeFile("custom_content/tangible/collection/rare_pistol_modified_republic_blaster.lua") includeFile("custom_content/tangible/collection/rare_pistol_mustafarian_modified_disruptor.lua") includeFile("custom_content/tangible/collection/rare_pistol_oppressor.lua") includeFile("custom_content/tangible/collection/rare_pistol_or5_de10.lua") includeFile("custom_content/tangible/collection/rare_pistol_perfectly_calibrated.lua") includeFile("custom_content/tangible/collection/rare_pistol_precise_dl44.lua") includeFile("custom_content/tangible/collection/rare_pistol_quicktrigger_countermand.lua") includeFile("custom_content/tangible/collection/rare_pistol_red_hydra.lua") includeFile("custom_content/tangible/collection/rare_pistol_rhiss_mark20.lua") includeFile("custom_content/tangible/collection/rare_pistol_silencer.lua") includeFile("custom_content/tangible/collection/rare_pistol_sr_combat.lua") includeFile("custom_content/tangible/collection/rare_pistol_taskmaster_flechette.lua") includeFile("custom_content/tangible/collection/rare_pistol_tchotchee.lua") includeFile("custom_content/tangible/collection/rare_pistol_trando_suppressor.lua") includeFile("custom_content/tangible/collection/rare_pistol_ur_g8.lua") includeFile("custom_content/tangible/collection/rare_pistol_vexa_flechette.lua") includeFile("custom_content/tangible/collection/rare_pistol_white_thranta.lua") includeFile("custom_content/tangible/collection/rare_rifle_ak_prime.lua") includeFile("custom_content/tangible/collection/rare_rifle_commander_ld1.lua") includeFile("custom_content/tangible/collection/rare_rifle_corsec_e11.lua") includeFile("custom_content/tangible/collection/rare_rifle_covert_retaliation.lua") includeFile("custom_content/tangible/collection/rare_rifle_coynite_disruptor.lua") includeFile("custom_content/tangible/collection/rare_rifle_cy_m_ink.lua") includeFile("custom_content/tangible/collection/rare_rifle_darklighter_sg_82.lua") includeFile("custom_content/tangible/collection/rare_rifle_darksting_assassin.lua") includeFile("custom_content/tangible/collection/rare_rifle_dawnsorrow.lua") includeFile("custom_content/tangible/collection/rare_rifle_dc_15.lua") includeFile("custom_content/tangible/collection/rare_rifle_disruptor.lua") includeFile("custom_content/tangible/collection/rare_rifle_doom_bringer_dp_23.lua") includeFile("custom_content/tangible/collection/rare_rifle_ewok_crossbow.lua") includeFile("custom_content/tangible/collection/rare_rifle_fallann_hyper_rifle.lua") includeFile("custom_content/tangible/collection/rare_rifle_hk_47_disruptor.lua") includeFile("custom_content/tangible/collection/rare_rifle_ld1.lua") includeFile("custom_content/tangible/collection/rare_rifle_lithitanium_rifle.lua") includeFile("custom_content/tangible/collection/rare_rifle_naktra_crystal.lua") includeFile("custom_content/tangible/collection/rare_rifle_nullifier.lua") includeFile("custom_content/tangible/collection/rare_rifle_proton.lua") includeFile("custom_content/tangible/collection/rare_rifle_taskmaster_gauss.lua") includeFile("custom_content/tangible/collection/rare_rifle_trando_laser.lua") includeFile("custom_content/tangible/collection/rare_rifle_tusken_king.lua") includeFile("custom_content/tangible/collection/rare_rifle_vershyi_sharpshooter.lua") includeFile("custom_content/tangible/collection/rebel_assault_boots.lua") includeFile("custom_content/tangible/collection/rebel_assault_chest.lua") includeFile("custom_content/tangible/collection/rebel_assault_gloves.lua") includeFile("custom_content/tangible/collection/rebel_assault_helmet.lua") includeFile("custom_content/tangible/collection/rebel_assault_left_bicep.lua") includeFile("custom_content/tangible/collection/rebel_assault_left_bracer.lua") includeFile("custom_content/tangible/collection/rebel_assault_leggings.lua") includeFile("custom_content/tangible/collection/rebel_assault_right_bicep.lua") includeFile("custom_content/tangible/collection/rebel_assault_right_bracer.lua") includeFile("custom_content/tangible/collection/rebel_battle_boots.lua") includeFile("custom_content/tangible/collection/rebel_battle_chest.lua") includeFile("custom_content/tangible/collection/rebel_battle_gloves.lua") includeFile("custom_content/tangible/collection/rebel_battle_helmet.lua") includeFile("custom_content/tangible/collection/rebel_battle_left_bicep.lua") includeFile("custom_content/tangible/collection/rebel_battle_left_bracer.lua") includeFile("custom_content/tangible/collection/rebel_battle_leggings.lua") includeFile("custom_content/tangible/collection/rebel_battle_right_bicep.lua") includeFile("custom_content/tangible/collection/rebel_battle_right_bracer.lua") includeFile("custom_content/tangible/collection/rebel_marine_boots.lua") includeFile("custom_content/tangible/collection/rebel_marine_chest.lua") includeFile("custom_content/tangible/collection/rebel_marine_gloves.lua") includeFile("custom_content/tangible/collection/rebel_marine_helmet.lua") includeFile("custom_content/tangible/collection/rebel_marine_left_bicep.lua") includeFile("custom_content/tangible/collection/rebel_marine_left_bracer.lua") includeFile("custom_content/tangible/collection/rebel_marine_leggings.lua") includeFile("custom_content/tangible/collection/rebel_marine_right_bicep.lua") includeFile("custom_content/tangible/collection/rebel_marine_right_bracer.lua") includeFile("custom_content/tangible/collection/rock_bubbling_01.lua") includeFile("custom_content/tangible/collection/rock_bubbling_02.lua") includeFile("custom_content/tangible/collection/rock_bubbling_03.lua") includeFile("custom_content/tangible/collection/rock_bubbling_04.lua") includeFile("custom_content/tangible/collection/rock_bubbling_05.lua") includeFile("custom_content/tangible/collection/rock_bubbling_06.lua") includeFile("custom_content/tangible/collection/rock_bubbling_07.lua") includeFile("custom_content/tangible/collection/rock_bubbling_08.lua") includeFile("custom_content/tangible/collection/rock_bubbling_09.lua") includeFile("custom_content/tangible/collection/rock_bubbling_10.lua") includeFile("custom_content/tangible/collection/rock_burning_01.lua") includeFile("custom_content/tangible/collection/rock_burning_02.lua") includeFile("custom_content/tangible/collection/rock_burning_03.lua") includeFile("custom_content/tangible/collection/rock_burning_04.lua") includeFile("custom_content/tangible/collection/rock_burning_05.lua") includeFile("custom_content/tangible/collection/rock_burning_06.lua") includeFile("custom_content/tangible/collection/rock_burning_07.lua") includeFile("custom_content/tangible/collection/rock_burning_08.lua") includeFile("custom_content/tangible/collection/rock_burning_09.lua") includeFile("custom_content/tangible/collection/rock_burning_10.lua") includeFile("custom_content/tangible/collection/rock_glowing_01.lua") includeFile("custom_content/tangible/collection/rock_glowing_02.lua") includeFile("custom_content/tangible/collection/rock_glowing_03.lua") includeFile("custom_content/tangible/collection/rock_glowing_04.lua") includeFile("custom_content/tangible/collection/rock_glowing_05.lua") includeFile("custom_content/tangible/collection/rock_glowing_06.lua") includeFile("custom_content/tangible/collection/rock_glowing_07.lua") includeFile("custom_content/tangible/collection/rock_glowing_08.lua") includeFile("custom_content/tangible/collection/rock_glowing_09.lua") includeFile("custom_content/tangible/collection/rock_glowing_10.lua") includeFile("custom_content/tangible/collection/rock_steaming_01.lua") includeFile("custom_content/tangible/collection/rock_steaming_02.lua") includeFile("custom_content/tangible/collection/rock_steaming_03.lua") includeFile("custom_content/tangible/collection/rock_steaming_04.lua") includeFile("custom_content/tangible/collection/rock_steaming_05.lua") includeFile("custom_content/tangible/collection/rock_steaming_06.lua") includeFile("custom_content/tangible/collection/rock_steaming_07.lua") includeFile("custom_content/tangible/collection/rock_steaming_08.lua") includeFile("custom_content/tangible/collection/rock_steaming_09.lua") includeFile("custom_content/tangible/collection/rock_steaming_10.lua") includeFile("custom_content/tangible/collection/scavenger_part_bag.lua") includeFile("custom_content/tangible/collection/scout_trooper_belt.lua") includeFile("custom_content/tangible/collection/scout_trooper_boots.lua") includeFile("custom_content/tangible/collection/scout_trooper_chest.lua") includeFile("custom_content/tangible/collection/scout_trooper_gloves.lua") includeFile("custom_content/tangible/collection/scout_trooper_helmet.lua") includeFile("custom_content/tangible/collection/scout_trooper_left_bicep.lua") includeFile("custom_content/tangible/collection/scout_trooper_left_bracer.lua") includeFile("custom_content/tangible/collection/scout_trooper_leggings.lua") includeFile("custom_content/tangible/collection/scout_trooper_right_bicep.lua") includeFile("custom_content/tangible/collection/scout_trooper_right_bracer.lua") includeFile("custom_content/tangible/collection/seven_years_01.lua") includeFile("custom_content/tangible/collection/seven_years_02.lua") includeFile("custom_content/tangible/collection/seven_years_03.lua") includeFile("custom_content/tangible/collection/seven_years_04.lua") includeFile("custom_content/tangible/collection/seven_years_05.lua") includeFile("custom_content/tangible/collection/seven_years_06.lua") includeFile("custom_content/tangible/collection/seven_years_07.lua") includeFile("custom_content/tangible/collection/shock_trooper_belt.lua") includeFile("custom_content/tangible/collection/shock_trooper_boots.lua") includeFile("custom_content/tangible/collection/shock_trooper_chest.lua") includeFile("custom_content/tangible/collection/shock_trooper_gloves.lua") includeFile("custom_content/tangible/collection/shock_trooper_helmet.lua") includeFile("custom_content/tangible/collection/shock_trooper_left_bicep.lua") includeFile("custom_content/tangible/collection/shock_trooper_left_bracer.lua") includeFile("custom_content/tangible/collection/shock_trooper_leggings.lua") includeFile("custom_content/tangible/collection/shock_trooper_right_bicep.lua") includeFile("custom_content/tangible/collection/shock_trooper_right_bracer.lua") includeFile("custom_content/tangible/collection/storm_trooper_belt.lua") includeFile("custom_content/tangible/collection/storm_trooper_boots.lua") includeFile("custom_content/tangible/collection/storm_trooper_chest.lua") includeFile("custom_content/tangible/collection/storm_trooper_gloves.lua") includeFile("custom_content/tangible/collection/storm_trooper_helmet.lua") includeFile("custom_content/tangible/collection/storm_trooper_left_bicep.lua") includeFile("custom_content/tangible/collection/storm_trooper_left_bracer.lua") includeFile("custom_content/tangible/collection/storm_trooper_leggings.lua") includeFile("custom_content/tangible/collection/storm_trooper_right_bicep.lua") includeFile("custom_content/tangible/collection/storm_trooper_right_bracer.lua")
registerNpc(8, { walk_speed = 110, run_speed = 150, scale = 130, r_weapon = 0, l_weapon = 0, level = 1, hp = 54, attack = 1, hit = 55, def = 23, res = 10, avoid = 3, attack_spd = 20, is_magic_damage = 0, ai_type = 91, give_exp = 7, drop_type = 100, drop_money = 1, drop_item = 40, union_number = 40, need_summon_count = 0, sell_tab0 = 0, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 150, npc_type = 1, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(9, { walk_speed = 120, run_speed = 160, scale = 135, r_weapon = 0, l_weapon = 0, level = 1, hp = 54, attack = 1, hit = 55, def = 23, res = 10, avoid = 4, attack_spd = 20, is_magic_damage = 0, ai_type = 91, give_exp = 7, drop_type = 100, drop_money = 1, drop_item = 42, union_number = 42, need_summon_count = 0, sell_tab0 = 0, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 155, npc_type = 1, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(10, { walk_speed = 130, run_speed = 160, scale = 140, r_weapon = 0, l_weapon = 0, level = 2, hp = 33, attack = 1, hit = 56, def = 25, res = 11, avoid = 5, attack_spd = 20, is_magic_damage = 0, ai_type = 91, give_exp = 7, drop_type = 100, drop_money = 1, drop_item = 45, union_number = 45, need_summon_count = 0, sell_tab0 = 0, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 160, npc_type = 1, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(316, { walk_speed = 130, run_speed = 280, scale = 80, r_weapon = 0, l_weapon = 0, level = 1, hp = 94, attack = 20, hit = 70, def = 500, res = 500, avoid = 500, attack_spd = 15, is_magic_damage = 0, ai_type = 91, give_exp = 4, drop_type = 8, drop_money = 1, drop_item = 1, union_number = 1, need_summon_count = 0, sell_tab0 = 0, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 1, attack_range = 100, npc_type = 1, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(317, { walk_speed = 140, run_speed = 300, scale = 95, r_weapon = 0, l_weapon = 0, level = 1, hp = 94, attack = 20, hit = 70, def = 500, res = 500, avoid = 500, attack_spd = 15, is_magic_damage = 0, ai_type = 91, give_exp = 4, drop_type = 8, drop_money = 1, drop_item = 1, union_number = 1, need_summon_count = 0, sell_tab0 = 0, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 1, attack_range = 100, npc_type = 1, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(318, { walk_speed = 150, run_speed = 310, scale = 100, r_weapon = 0, l_weapon = 0, level = 1, hp = 94, attack = 20, hit = 70, def = 500, res = 500, avoid = 500, attack_spd = 15, is_magic_damage = 0, ai_type = 91, give_exp = 4, drop_type = 8, drop_money = 1, drop_item = 1, union_number = 1, need_summon_count = 0, sell_tab0 = 0, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 1, attack_range = 100, npc_type = 1, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(811, { walk_speed = 200, run_speed = 450, scale = 90, r_weapon = 334, l_weapon = 0, level = 46, hp = 1154, attack = 131, hit = 142, def = 112, res = 59, avoid = 95, attack_spd = 100, is_magic_damage = 0, ai_type = 155, give_exp = 34, drop_type = 3, drop_money = 0, drop_item = 100, union_number = 100, need_summon_count = 30, sell_tab0 = 30, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 350, npc_type = 0, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(812, { walk_speed = 210, run_speed = 470, scale = 96, r_weapon = 334, l_weapon = 0, level = 47, hp = 1177, attack = 134, hit = 144, def = 115, res = 60, avoid = 97, attack_spd = 102, is_magic_damage = 0, ai_type = 155, give_exp = 38, drop_type = 3, drop_money = 0, drop_item = 100, union_number = 100, need_summon_count = 30, sell_tab0 = 30, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 350, npc_type = 0, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(813, { walk_speed = 220, run_speed = 490, scale = 102, r_weapon = 334, l_weapon = 0, level = 48, hp = 1200, attack = 137, hit = 146, def = 117, res = 61, avoid = 98, attack_spd = 104, is_magic_damage = 0, ai_type = 155, give_exp = 41, drop_type = 3, drop_money = 0, drop_item = 100, union_number = 100, need_summon_count = 31, sell_tab0 = 31, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 350, npc_type = 0, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(814, { walk_speed = 230, run_speed = 510, scale = 108, r_weapon = 334, l_weapon = 0, level = 49, hp = 1224, attack = 140, hit = 148, def = 120, res = 62, avoid = 100, attack_spd = 106, is_magic_damage = 0, ai_type = 155, give_exp = 45, drop_type = 3, drop_money = 0, drop_item = 100, union_number = 100, need_summon_count = 31, sell_tab0 = 31, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 350, npc_type = 0, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(815, { walk_speed = 240, run_speed = 530, scale = 114, r_weapon = 334, l_weapon = 0, level = 50, hp = 1248, attack = 143, hit = 150, def = 123, res = 64, avoid = 102, attack_spd = 108, is_magic_damage = 0, ai_type = 155, give_exp = 49, drop_type = 3, drop_money = 0, drop_item = 100, union_number = 100, need_summon_count = 32, sell_tab0 = 32, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 350, npc_type = 0, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(816, { walk_speed = 250, run_speed = 550, scale = 120, r_weapon = 334, l_weapon = 0, level = 51, hp = 1272, attack = 146, hit = 152, def = 125, res = 65, avoid = 103, attack_spd = 110, is_magic_damage = 0, ai_type = 155, give_exp = 53, drop_type = 3, drop_money = 0, drop_item = 100, union_number = 100, need_summon_count = 32, sell_tab0 = 32, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 350, npc_type = 0, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(817, { walk_speed = 260, run_speed = 570, scale = 126, r_weapon = 334, l_weapon = 0, level = 52, hp = 1296, attack = 149, hit = 154, def = 128, res = 66, avoid = 105, attack_spd = 112, is_magic_damage = 0, ai_type = 155, give_exp = 57, drop_type = 3, drop_money = 0, drop_item = 100, union_number = 100, need_summon_count = 33, sell_tab0 = 33, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 350, npc_type = 0, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(818, { walk_speed = 270, run_speed = 590, scale = 132, r_weapon = 334, l_weapon = 0, level = 53, hp = 1320, attack = 152, hit = 156, def = 131, res = 67, avoid = 107, attack_spd = 114, is_magic_damage = 0, ai_type = 155, give_exp = 61, drop_type = 3, drop_money = 0, drop_item = 100, union_number = 100, need_summon_count = 33, sell_tab0 = 33, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 350, npc_type = 0, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(819, { walk_speed = 280, run_speed = 610, scale = 138, r_weapon = 334, l_weapon = 0, level = 54, hp = 1344, attack = 156, hit = 158, def = 133, res = 69, avoid = 109, attack_spd = 116, is_magic_damage = 0, ai_type = 155, give_exp = 65, drop_type = 3, drop_money = 0, drop_item = 100, union_number = 100, need_summon_count = 34, sell_tab0 = 34, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 350, npc_type = 0, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(820, { walk_speed = 290, run_speed = 630, scale = 144, r_weapon = 334, l_weapon = 0, level = 55, hp = 1368, attack = 159, hit = 161, def = 136, res = 70, avoid = 110, attack_spd = 118, is_magic_damage = 0, ai_type = 155, give_exp = 69, drop_type = 3, drop_money = 0, drop_item = 100, union_number = 100, need_summon_count = 34, sell_tab0 = 34, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 350, npc_type = 0, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); function OnInit(entity) return true end function OnCreate(entity) return true end function OnDelete(entity) return true end function OnDead(entity) end function OnDamaged(entity) end
-------------------------------- -- @module FadeIn -- @extend FadeTo -------------------------------- -- @function [parent=#FadeIn] setReverseAction -- @param self -- @param #cc.FadeTo fadeto -------------------------------- -- @function [parent=#FadeIn] create -- @param self -- @param #float float -- @return FadeIn#FadeIn ret (return value: cc.FadeIn) -------------------------------- -- @function [parent=#FadeIn] startWithTarget -- @param self -- @param #cc.Node node -------------------------------- -- @function [parent=#FadeIn] clone -- @param self -- @return FadeIn#FadeIn ret (return value: cc.FadeIn) -------------------------------- -- @function [parent=#FadeIn] reverse -- @param self -- @return FadeTo#FadeTo ret (return value: cc.FadeTo) return nil
dofile('../Resource/scripts/ogreConfig.lua') if RE.ogreSceneManager().setFog then RE.ogreSceneManager():setFog( 0.77,0.92,1, 0.0,1200, 1800 ) end
---------------------------------------------------------------------------------- -- -- scene1.lua -- ---------------------------------------------------------------------------------- local timer = require("timer") local director = require("director") local scene = director.newScene() local system = require("system") local redRectangle --------------------------------------------------------------------------------- -- Scene event handlers --------------------------------------------------------------------------------- -- Called when the scene is first created function scene:createScene(event) ----------------------------------------------------------------------------- -- CREATE display objects here (layers, groups, sprites, etc.) ----------------------------------------------------------------------------- local layer1 = display.newLayer(1) self:addLayer(layer1) redRectangle = display.newRect(100, 100, 50, 50) redRectangle.name = "redRectangle" redRectangle:setFillColor(1, 0, 0, 1) redRectangle:setStrokeColor(1, 1, 1, 1) redRectangle:setStrokeWidth(2.0) layer1:insert(redRectangle) end -- Called immediately after scene has moved onscreen function scene:enterScene(event) ----------------------------------------------------------------------------- -- Start timers, set up event listeners, etc. ----------------------------------------------------------------------------- function screenshot() system.screenshot() end timer.performWithDelay(3000, screenshot) end -- Called when scene is about to move offscreen function scene:exitScene(event) ----------------------------------------------------------------------------- -- Stop timers, remove event listeners, etc. ----------------------------------------------------------------------------- end -- Called when the scene is about to be deallocated function scene:destroyScene(event) ----------------------------------------------------------------------------- -- Cleanup scene elements here ----------------------------------------------------------------------------- end --------------------------------------------------------------------------------- -- End of event handers --------------------------------------------------------------------------------- scene:addEventListener("createScene", scene) scene:addEventListener("enterScene", scene) scene:addEventListener("exitScene", scene) scene:addEventListener("destroyScene", scene) return scene
local test_poller = true dofile'../../include.lua' local p local util = require'util' local simple_ipc = require 'simple_ipc' --local test_channel = simple_ipc.new_subscriber('test') local test_channel = simple_ipc.new_subscriber(43210,'192.168.123.222') test_channel.callback = function(s) local c = p.lut[s] local data, has_more = c:receive() print(s, 1, data, has_more) end print('-- test_channel') util.ptable(test_channel) print('--') if test_poller then local test_channel2 = simple_ipc.new_subscriber('test2') test_channel2.callback = function(s) local c = p.lut[s] local data, has_more = c:receive() print(s,2, data, has_more) end p = simple_ipc.wait_on_channels{test_channel,test_channel2} print('Poller',p,p.lut) p:start() return end while true do local x = test_channel:receive() print('Got',#x, x) end
pfQuest = CreateFrame("Frame") pfQuest.queue = {} pfQuest.abandon = "" pfQuest.questlog = {} pfQuest.questlog_tmp = {} pfQuest:RegisterEvent("QUEST_WATCH_UPDATE") pfQuest:RegisterEvent("QUEST_LOG_UPDATE") pfQuest:RegisterEvent("QUEST_FINISHED") pfQuest:RegisterEvent("PLAYER_LEVEL_UP") pfQuest:RegisterEvent("PLAYER_ENTERING_WORLD") pfQuest:RegisterEvent("SKILL_LINES_CHANGED") pfQuest:RegisterEvent("ADDON_LOADED") pfQuest:SetScript("OnEvent", function() if event == "ADDON_LOADED" then if arg1 == "pfQuest" then if tostring(GetAddOnMetadata("pfQuest", "Version")) == "NORELEASE" then DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccWARNING:|r You're using a development snapshot of pfQuest which leads to a higher RAM-Usage and increased loading times. Please choose an official release instead: https://shagu.org/pfQuest") end pfQuest:AddQuestLogIntegration() pfQuest:AddWorldMapIntegration() else return end elseif event == "PLAYER_LEVEL_UP" or event == "PLAYER_ENTERING_WORLD" or event == "SKILL_LINES_CHANGED" then pfQuest.updateQuestGivers = true else pfQuest.updateQuestLog = true end end) pfQuest:SetScript("OnUpdate", function() if ( this.tick or .2) > GetTime() then return else this.tick = GetTime() + .2 end if this.updateQuestLog == true then pfQuest:UpdateQuestlog() this.updateQuestLog = false end if this.updateQuestGivers == true then if pfQuest_config["trackingmethod"] == 4 then return end if pfQuest_config["allquestgivers"] == "1" then local meta = { ["addon"] = "PFQUEST" } pfDatabase:SearchQuests(meta) pfMap:UpdateNodes() this.updateQuestGivers = false end end if pfQuest_config["trackingmethod"] == 4 then return end if table.getn(this.queue) == 0 then return end -- process queue local match = false for id, entry in pairs(this.queue) do match = true if pfQuest_config["trackingmethod"] ~= 3 and (pfQuest_config["trackingmethod"] ~= 2 or IsQuestWatched(entry[3])) then pfMap:DeleteNode("PFQUEST", entry[1]) local meta = { ["addon"] = "PFQUEST", ["qlogid"] = entry[3] } for _, id in entry[2] do pfDatabase:SearchQuestID(id, meta) end end pfQuest.queue[id] = nil return end -- trigger questgiver update if match == false then this.updateQuestGivers = true this.queue = {} end end) function pfQuest:UpdateQuestlog() pfQuest.questlog_tmp = {} local _, numQuests = GetNumQuestLogEntries() local found = 0 -- iterate over all quests for qlogid=1,40 do local title, _, _, header, _, complete = GetQuestLogTitle(qlogid) local objectives = GetNumQuestLeaderBoards(qlogid) local watched = IsQuestWatched(qlogid) if title and not header then -- add new quest to the questlog if not pfQuest.questlog[title] then local questID = pfDatabase:GetQuestIDs(qlogid) pfQuest.questlog_tmp[title] = { ids = questID, qlogid = qlogid, state = "init" } elseif pfQuest.questlog[title].qlogid ~= qlogid then pfQuest.questlog_tmp[title] = { ids = pfQuest.questlog[title].ids, qlogid = qlogid, state = pfQuest.questlog[title].state } else pfQuest.questlog_tmp[title] = { ids = pfQuest.questlog[title].ids, qlogid = pfQuest.questlog[title].qlogid, state = pfQuest.questlog[title].state } end -- update progress state if objectives then local state = watched and "trck" or "" for i=1, objectives, 1 do local text, _, done = GetQuestLogLeaderBoard(i, qlogid) local _, _, obj, objNum, objNeeded = strfind(text, "(.*):%s*([%d]+)%s*/%s*([%d]+)") if obj then state = state .. i .. (((objNum + 0 >= objNeeded + 0) or done ) and "done" or "todo") end end pfQuest.questlog_tmp[title].state = state end found = found + 1 if found >= numQuests then break end end end -- quest add events for title, data in pairs(pfQuest.questlog_tmp) do if not pfQuest.questlog[title] then table.insert(pfQuest.queue, { title, data.ids, data.qlogid }) elseif pfQuest.questlog_tmp[title].state ~= pfQuest.questlog[title].state then table.insert(pfQuest.queue, { title, data.ids, data.qlogid }) end end -- quest removal events for title, data in pairs(pfQuest.questlog) do if not pfQuest.questlog_tmp[title] then pfMap:DeleteNode("PFQUEST", title) pfMap:UpdateNodes() for _, qid in pairs(pfQuest.questlog[title].ids) do -- write pfQuest.questlog history if title == pfQuest.abandon then pfQuest_history[qid] = nil else pfQuest_history[qid] = true end end pfQuest.abandon = "" pfQuest.updateQuestGivers = true end end -- set new questlog pfQuest.questlog = pfQuest.questlog_tmp end function pfQuest:ResetAll() -- force reload all quests pfMap:DeleteNode("PFQUEST") pfQuest.questlog = {} pfQuest.updateQuestLog = true pfQuest.updateQuestGivers = true pfMap:UpdateNodes() end function pfQuest:AddQuestLogIntegration() if pfQuest_config["questlogbuttons"] == "0" then return end local dockFrame = EQL3_QuestLogDetailScrollChildFrame or ShaguQuest_QuestLogDetailScrollChildFrame or QuestLogDetailScrollChildFrame local dockTitle = EQL3_QuestLogDescriptionTitle or ShaguQuest_QuestLogDescriptionTitle or QuestLogDescriptionTitle dockTitle:SetHeight(dockTitle:GetHeight() + 30) dockTitle:SetJustifyV("BOTTOM") pfQuest.buttonOnline = pfQuest.buttonOnline or CreateFrame("Button", "pfQuestOnline", dockFrame) pfQuest.buttonOnline:SetWidth(50) pfQuest.buttonOnline:SetHeight(15) pfQuest.buttonOnline:SetPoint("TOPRIGHT", dockFrame, "TOPRIGHT", -12, -10) pfQuest.buttonOnline:SetScript("OnClick", function() local questurl = "http://classicdb.ch/?quest=" if pfUI and pfUI.chat then pfUI.chat.urlcopy.text:SetText(questurl .. (this:GetID() or 0)) pfUI.chat.urlcopy:Show() else DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpf|cffffffffQuest Online Search:|cffcccccc " .. questurl .. (this:GetID() or 0)) end end) pfQuest.buttonOnline.txt = pfQuest.buttonOnline:CreateFontString("pfQuestIDButton", "HIGH", "GameFontWhite") pfQuest.buttonOnline.txt:SetAllPoints(pfQuest.buttonOnline) pfQuest.buttonOnline.txt:SetJustifyH("RIGHT") pfQuest.buttonOnline.txt:SetText("|cff000000[|cffaa2222?|cff000000]") pfQuest.buttonShow = pfQuest.buttonShow or CreateFrame("Button", "pfQuestShow", dockFrame, "UIPanelButtonTemplate") pfQuest.buttonShow:SetWidth(70) pfQuest.buttonShow:SetHeight(20) pfQuest.buttonShow:SetText("Show") pfQuest.buttonShow:SetPoint("TOP", dockTitle, "TOP", -110, 0) pfQuest.buttonShow:SetScript("OnClick", function() local questIndex = GetQuestLogSelection() local title, _a, _b, header, _c, complete = GetQuestLogTitle(questIndex) if header then return end local ids = pfQuest.questlog[title].ids local maps, meta = {}, { ["addon"] = "PFQUEST", ["qlogid"] = questIndex } for _, id in ids do maps = pfDatabase:SearchQuestID(id, meta, maps) end pfMap:ShowMapID(pfDatabase:GetBestMap(maps)) end) pfQuest.buttonHide = pfQuest.buttonHide or CreateFrame("Button", "pfQuestHide", dockFrame, "UIPanelButtonTemplate") pfQuest.buttonHide:SetWidth(70) pfQuest.buttonHide:SetHeight(20) pfQuest.buttonHide:SetText("Hide") pfQuest.buttonHide:SetPoint("TOP", dockTitle, "TOP", -37, 0) pfQuest.buttonHide:SetScript("OnClick", function() local questIndex = GetQuestLogSelection() local title, _, _, header, _, complete = GetQuestLogTitle(questIndex) if header then return end pfMap:DeleteNode("PFQUEST", title) pfMap:UpdateNodes() end) pfQuest.buttonClean = pfQuest.buttonClean or CreateFrame("Button", "pfQuestClean", dockFrame, "UIPanelButtonTemplate") pfQuest.buttonClean:SetWidth(70) pfQuest.buttonClean:SetHeight(20) pfQuest.buttonClean:SetText("Clean") pfQuest.buttonClean:SetPoint("TOP", dockTitle, "TOP", 37, 0) pfQuest.buttonClean:SetScript("OnClick", function() pfMap:DeleteNode("PFQUEST") pfMap:UpdateNodes() end) pfQuest.buttonReset = pfQuest.buttonReset or CreateFrame("Button", "pfQuestHide", dockFrame, "UIPanelButtonTemplate") pfQuest.buttonReset:SetWidth(70) pfQuest.buttonReset:SetHeight(20) pfQuest.buttonReset:SetText("Reset") pfQuest.buttonReset:SetPoint("TOP", dockTitle, "TOP", 110, 0) pfQuest.buttonReset:SetScript("OnClick", function() pfQuest:ResetAll() end) end function pfQuest:AddWorldMapIntegration() if pfQuest_config["worldmapmenu"] == "0" then return end -- Quest Display Selection pfQuest.mapButton = CreateFrame("Frame", "pfQuestMapDropdown", WorldMapButton, "UIDropDownMenuTemplate") pfQuest.mapButton:ClearAllPoints() pfQuest.mapButton:SetPoint("TOPRIGHT" , 0, -10) pfQuest.mapButton:SetScript("OnShow", function() pfQuest.mapButton.current = tonumber(pfQuest_config["trackingmethod"]) pfQuest.mapButton:UpdateMenu() end) pfQuest.mapButton.point = "TOPLEFT" pfQuest.mapButton.relativePoint = "BOTTOMLEFT" function pfQuest.mapButton:UpdateMenu() local function CreateEntries() local info = {} info.text = "All Quests" info.checked = false info.func = function() UIDropDownMenu_SetSelectedID(pfQuest.mapButton, this:GetID(), 0) pfQuest_config["trackingmethod"] = this:GetID() pfQuest:ResetAll() end UIDropDownMenu_AddButton(info) local info = {} info.text = "Tracked Quests" info.checked = false info.func = function() UIDropDownMenu_SetSelectedID(pfQuest.mapButton, this:GetID(), 0) pfQuest_config["trackingmethod"] = this:GetID() pfQuest:ResetAll() end UIDropDownMenu_AddButton(info) local info = {} info.text = "Manual Selection" info.checked = false info.func = function() UIDropDownMenu_SetSelectedID(pfQuest.mapButton, this:GetID(), 0) pfQuest_config["trackingmethod"] = this:GetID() pfQuest:ResetAll() end UIDropDownMenu_AddButton(info) local info = {} info.text = "Hide Quests" info.checked = false info.func = function() UIDropDownMenu_SetSelectedID(pfQuest.mapButton, this:GetID(), 0) pfQuest_config["trackingmethod"] = this:GetID() pfQuest:ResetAll() end UIDropDownMenu_AddButton(info) end UIDropDownMenu_Initialize(pfQuest.mapButton, CreateEntries) UIDropDownMenu_SetWidth(120, pfQuest.mapButton) UIDropDownMenu_SetButtonWidth(125, pfQuest.mapButton) UIDropDownMenu_JustifyText("RIGHT", pfQuest.mapButton) UIDropDownMenu_SetSelectedID(pfQuest.mapButton, pfQuest.mapButton.current) end end -- [[ Hook UI Functions ]] -- -- Set certain events on quest watch local pfHookRemoveQuestWatch = RemoveQuestWatch RemoveQuestWatch = function(questIndex) local ret = pfHookRemoveQuestWatch(questIndex) local title, _, _, header, _, complete = GetQuestLogTitle(questIndex) pfMap:DeleteNode("PFQUEST", title) pfQuest.updateQuestLog = true pfQuest.updateQuestGivers = true return ret end -- Set certain events on quest unwatch local pfHookAddQuestWatch = AddQuestWatch AddQuestWatch = function(questIndex) local ret = pfHookAddQuestWatch(questIndex) pfQuest.updateQuestLog = true pfQuest.updateQuestGivers = true return ret end -- Save the abandoned questname to remove from history local HookAbandonQuest = AbandonQuest AbandonQuest = function() pfQuest.abandon = GetAbandonQuestName() HookAbandonQuest() end -- Update quest id button local pfHookQuestLog_Update = QuestLog_Update QuestLog_Update = function() pfHookQuestLog_Update() if pfQuest_config["questlogbuttons"] == "1" then local questName = GetQuestLogTitle(GetQuestLogSelection()) if pfQuest.questlog[questName] and pfQuest.questlog[questName].ids[1] then local id = pfQuest.questlog[questName].ids[1] pfQuest.buttonOnline:SetID(id) pfQuest.buttonOnline:Show() if pfQuest_config.showids == "1" then pfQuest.buttonOnline.txt:SetText("|cff000000[|cffaa2222id: " .. id .. "|cff000000]") end else pfQuest.buttonOnline:Hide() end end end -- Allow to send questlinks from questlog local pfHookQuestLogTitleButton_OnClick = QuestLogTitleButton_OnClick QuestLogTitleButton_OnClick = function(button) local scrollFrame = EQL3_QuestLogListScrollFrame or ShaguQuest_QuestLogListScrollFrame or QuestLogListScrollFrame local questIndex = this:GetID() + FauxScrollFrame_GetOffset(scrollFrame) local questName, questLevel = GetQuestLogTitle(questIndex) if IsShiftKeyDown() and not this.isHeader then if ChatFrameEditBox:IsVisible() then if pfQuest_config["questlinks"] == "1" then local id = 0 if pfQuest.questlog[questName] and pfQuest.questlog[questName].ids[1] then id = pfQuest.questlog[questName].ids[1] end ChatFrameEditBox:Insert("|cffffff00|Hquest:" .. id .. ":" .. questLevel .. ":0:0|h[" .. questName .. "]|h|r") else ChatFrameEditBox:Insert("[" .. questName .. "]") end QuestLog_SetSelection(questIndex) QuestLog_Update() return end end pfHookQuestLogTitleButton_OnClick(button) end -- Patch ItemRef to display Questlinks local pfQuestHookSetItemRef = SetItemRef SetItemRef = function(link, text, button) local isQuest, _, id = string.find(link, "quest:(%d+):.*") local isQuest2, _, _ = string.find(link, "quest2:.*") if isQuest or isQuest2 then ShowUIPanel(ItemRefTooltip) ItemRefTooltip:SetOwner(UIParent, "ANCHOR_PRESERVE") local hasTitle, _, questTitle = string.find(text, ".*|h%[(.*)%]|h.*") if hasTitle then ItemRefTooltip:AddLine(questTitle, 1,1,0) end id = tonumber(id) if not id or id == 0 then for scanID, data in pairs(pfDB["quests"]["loc"]) do if data.T == questTitle then id = scanID break end end end -- scan for active quests local queststate = pfQuest_history[id] and 2 or 0 for title, data in pairs(pfQuest.questlog) do for _, qid in pairs(pfQuest.questlog[title].ids) do if qid == id then queststate = 1 end end end if queststate == 0 then ItemRefTooltip:AddLine("You don't have this quest.\n\n", 1, .5, .5) elseif queststate == 1 then ItemRefTooltip:AddLine("You are on this quest.\n\n", 1, 1, .5) elseif queststate == 2 then ItemRefTooltip:AddLine("You already did this quest.\n\n", .5, 1, .5) end -- add database entries if existing if pfDB["quests"]["loc"][id] then if pfDB["quests"]["loc"][id]["O"] then ItemRefTooltip:AddLine(pfDatabase:FormatQuestText(pfDB["quests"]["loc"][id]["O"]), 1,1,1,true) end if pfDB["quests"]["loc"][id]["O"] and pfDB["quests"]["loc"][id]["D"] then ItemRefTooltip:AddLine(" ", 0,0,0) end if pfDB["quests"]["loc"][id]["D"] then ItemRefTooltip:AddLine(pfDatabase:FormatQuestText(pfDB["quests"]["loc"][id]["D"]), .8,.8,.8,true) end if pfDB["quests"]["data"][id]["lvl"] or pfDB["quests"]["data"][id]["min"] then ItemRefTooltip:AddLine(" ", 0,0,0) end if pfDB["quests"]["data"][id]["min"] then local questlevel = tonumber(pfDB["quests"]["data"][id]["min"]) local color = GetDifficultyColor(questlevel) ItemRefTooltip:AddLine("|cffffffffRequired Level: |r" .. questlevel, color.r, color.g, color.b) end if pfDB["quests"]["data"][id]["lvl"] then local questlevel = tonumber(pfDB["quests"]["data"][id]["lvl"]) local color = GetDifficultyColor(questlevel) ItemRefTooltip:AddLine("|cffffffffQuest Level: |r" .. questlevel, color.r, color.g, color.b) end end ItemRefTooltip:Show() else pfQuestHookSetItemRef(link, text, button) end end
--collectgarbage("stop") local i = 0 while i<1000000 do local temp = {{}} i = i + 1 end --collectgarbage("restart") collectgarbage("collect")
--!A cross-platform build utility based on Lua -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- Copyright (C) 2015-present, TBOOX Open Source Group. -- -- @author ruki -- @file find_package.lua -- -- imports import("core.base.option") import("core.project.target") import("lib.detect.find_tool") import("package.manager.pkgconfig.find_package", {alias = "find_package_from_pkgconfig"}) -- get result from list of file inside pacman package function _find_package_from_list(list, name, pacman, opt) -- mingw + pacman = cygpath available local cygpath = nil if is_subhost("msys") and opt.plat == "mingw" then cygpath = find_tool("cygpath") if not cygpath then return end end -- iterate over each file path inside the pacman package local result = {includedirs = {}, linkdirs = {}, links = {}} for _, line in ipairs(list:split('\n', {plain = true})) do -- on msys cygpath should be used to convert local path to windows path line = line:trim():split('%s+')[2] if line:find("/include/", 1, true) and (line:endswith(".h") or line:endswith(".hpp")) then local hpath = line if is_subhost("msys") and opt.plat == "mingw" then hpath = os.iorunv(cygpath.program, {"--windows", line}) if opt.arch == "x86_64" then local basehpath = os.iorunv(cygpath.program, {"--windows", "/mingw64/include"}) table.insert(result.includedirs, basehpath) else local basehpath = os.iorunv(cygpath.program, {"--windows", "/mingw32/include"}) table.insert(result.includedirs, basehpath) end end table.insert(result.includedirs, path.directory(hpath)) -- remove lib and .a, .dll.a and .so to have the links elseif line:endswith(".dll.a") then -- only for mingw local apath = os.iorunv(cygpath.program, {"--windows", line}) apath = apath:trim() table.insert(result.linkdirs, path.directory(apath)) table.insert(result.links, target.linkname(path.filename(apath), {plat = opt.plat})) elseif line:endswith(".so") then table.insert(result.linkdirs, path.directory(line)) table.insert(result.links, target.linkname(path.filename(line), {plat = opt.plat})) elseif line:endswith(".a") then local apath = line if is_subhost("msys") and opt.plat == "mingw" then apath = os.iorunv(cygpath.program, {"--windows", line}) apath = apath:trim() end table.insert(result.linkdirs, path.directory(apath)) table.insert(result.links, target.linkname(path.filename(apath), {plat = opt.plat})) end end result.includedirs = table.unique(result.includedirs) result.linkdirs = table.unique(result.linkdirs) result.links = table.reverse_unique(result.links) -- use pacman package version as version local version = try { function() return os.iorunv(pacman.program, {"-Q", name}) end } if version then version = version:trim():split('%s+')[2] result.version = version:split('-')[1] else result = nil end return result end -- find package from the system directories -- -- @param name the package name -- @param opt the options, e.g. {verbose = true, version = "1.12.x") -- function main(name, opt) -- find pacman opt = opt or {} local pacman = find_tool("pacman") if not pacman then return end -- for msys2/mingw? mingw-w64-[i686|x86_64]-xxx if is_subhost("msys") and opt.plat == "mingw" then name = (opt.arch == "x86_64" and "mingw-w64-x86_64-" or "mingw-w64-i686-") .. name end -- get package files list local list = try { function() return os.iorunv(pacman.program, {"-Q", "-l", name}) end } if not list then return end -- parse package files list local linkdirs = {} local pkgconfig_files = {} for _, line in ipairs(list:split('\n', {plain = true})) do line = line:trim():split('%s+')[2] if line:find("/pkgconfig/", 1, true) and line:endswith(".pc") then table.insert(pkgconfig_files, line) end if line:endswith(".so") or line:endswith(".a") or line:endswith(".lib") then table.insert(linkdirs, path.directory(line)) end end linkdirs = table.unique(linkdirs) -- we iterate over each pkgconfig file to extract the required data local foundpc = false local result = {includedirs = {}, linkdirs = {}, links = {}} for _, pkgconfig_file in ipairs(pkgconfig_files) do local pkgconfig_dir = path.directory(pkgconfig_file) local pkgconfig_name = path.basename(pkgconfig_file) local pcresult = find_package_from_pkgconfig(pkgconfig_name, {configdirs = pkgconfig_dir, linkdirs = linkdirs}) -- the pkgconfig file has been parse successfully if pcresult then for _, includedir in ipairs(pcresult.includedirs) do table.insert(result.includedirs, includedir) end for _, linkdir in ipairs(pcresult.linkdirs) do table.insert(result.linkdirs, linkdir) end for _, link in ipairs(pcresult.links) do table.insert(result.links, link) end -- version should be the same if a pacman package contains multiples .pc result.version = pcresult.version foundpc = true end end if foundpc == true then result.includedirs = table.unique(result.includedirs) result.linkdirs = table.unique(result.linkdirs) result.links = table.reverse_unique(result.links) else -- if there is no .pc, we parse the package content to obtain the data we want result = _find_package_from_list(list, name, pacman, opt) end return result end
local left = 0 local right = 0 local slow = 0 local speed_input_idx = -1 local jump_input_idx = -1 local dead_input_idx = -1 local dir = 1 local jump = 0 is_collision_down = false local checkpoint = {} local invincible = 0 local interact_obj = nil local num_lives = 3 local vspeed = 0 dead = false fall_trigger = {} start_pos = {} respawn_msg = {} coin_counter = {} life_icon_0 = {} life_icon_1 = {} life_icon_2 = {} game_over_msg = {} coins = 0 coin_sound = -1 life_sound = -1 death_sound = -1 jump_sound = -1 Editor.setPropertyType(this, "start_pos", Editor.ENTITY_PROPERTY) Editor.setPropertyType(this, "fall_trigger", Editor.ENTITY_PROPERTY) Editor.setPropertyType(this, "respawn_msg", Editor.ENTITY_PROPERTY) Editor.setPropertyType(this, "life_icon_0", Editor.ENTITY_PROPERTY) Editor.setPropertyType(this, "life_icon_1", Editor.ENTITY_PROPERTY) Editor.setPropertyType(this, "life_icon_2", Editor.ENTITY_PROPERTY) Editor.setPropertyType(this, "game_over_msg", Editor.ENTITY_PROPERTY) Editor.setPropertyType(this, "coin_counter", Editor.ENTITY_PROPERTY) Editor.setPropertyType(this, "coin_sound", Editor.RESOURCE_PROPERTY, "clip") Editor.setPropertyType(this, "life_sound", Editor.RESOURCE_PROPERTY, "clip") Editor.setPropertyType(this, "death_sound", Editor.RESOURCE_PROPERTY, "clip") Editor.setPropertyType(this, "jump_sound", Editor.RESOURCE_PROPERTY, "clip") function playSound(audio_scene, entity, sound) local path = LumixAPI.getResourcePath(LumixAPI.engine, sound) audio_scene:play(entity, path, false) end function onInputEvent(event) if event.type == LumixAPI.INPUT_EVENT_BUTTON then if event.device.type == LumixAPI.INPUT_DEVICE_KEYBOARD then if event.key_id == LumixAPI.INPUT_KEYCODE_SPACE or event.key_id == string.byte("W") then if event.down and is_collision_down then LumixAPI.logError("jump") local audio_scene = this.universe:getScene("audio") playSound(audio_scene, this, jump_sound) jump = 1 end end if event.key_id == LumixAPI.INPUT_KEYCODE_SHIFT then if event.down then slow = 1 else slow = 0 end end if dead and num_lives > 0 and event.key_id == string.byte("R") and event.down then this.parent.position = checkpoint.position respawn_msg.gui_rect.enabled = false dead = false invincible = 0.5 end if event.key_id == string.byte("D") then if event.down then right = 1 else right = 0 end end if event.key_id == string.byte("E") then if event.down and interact_obj ~= nil then interact_obj.lua_script[0].interact() end end if event.key_id == string.byte("A") then if event.down then left = 1 else left = 0 end end end end end function upadte_lives_icons() life_icon_0.gui_rect.enabled = num_lives > 0 life_icon_1.gui_rect.enabled = num_lives > 1 life_icon_2.gui_rect.enabled = num_lives > 2 end function kill() dead = true local audio_scene = this.universe:getScene("audio") playSound(audio_scene, this, death_sound) num_lives = num_lives - 1 upadte_lives_icons() if num_lives > 0 then respawn_msg.gui_rect.enabled = true else game_over_msg.gui_rect.enabled = true end end function start() checkpoint = start_pos; this.parent.lua_script[0].onTrigger = function(e, touch_lost) if e.lua_script then if e.lua_script[0].life and num_lives < 3 then if not e.lua_script[0].picked then local audio_scene = this.universe:getScene("audio") playSound(audio_scene, this, life_sound) num_lives = num_lives + 1 upadte_lives_icons() e.model_instance.enabled = false e.lua_script[0].picked = true end end if e.lua_script[0].coin then if not e.lua_script[0].picked then local audio_scene = this.universe:getScene("audio") playSound(audio_scene, this, coin_sound) coins = coins + 1 coin_counter.gui_text.text = tostring(coins) e.model_instance.enabled = false e.lua_script[0].picked = true end end if e.lua_script[0].checkpoint then checkpoint = e end if e.lua_script[0].lever then if touch_lost then if interact_obj then interact_obj.lua_script[0].exited() end interact_obj = nil else interact_obj = e e.lua_script[0].entered() end end end if invincible > 0 or dead then return end if e._entity == fall_trigger._entity then kill() elseif e.lua_script[0].trap and e.lua_script[0].active then e.lua_script[0].triggerTrap() kill() elseif e.lua_script[0].spikes == true then kill() end end end function clamp(x, a, b) if x < a then return a end if x > b then return b end return x end function restart() this.parent.position = start_pos.position end function update(td) local p = this.parent.position this.parent.position = {p[1], p[2], -4} if speed_input_idx == -1 then speed_input_idx = this.animator:getInputIndex("speed") jump_input_idx = this.animator:getInputIndex("jump") dead_input_idx = this.animator:getInputIndex("dead") end local speed = math.max(right, left) * 10 if slow > 0 then speed = speed * 0.25 end this.animator:setFloatInput(speed_input_idx, speed) this.animator:setBoolInput(jump_input_idx, jump > 0) this.animator:setBoolInput(dead_input_idx, dead) jump = jump - td / 0.508 invincible = invincible - td if not dead then is_collision_down = this.parent.physical_controller:isCollisionDown() if is_collision_down then vspeed = 0 end vspeed = vspeed - 9.8 * td vspeed = math.max(vspeed, -5.0) if jump > 0 then this.parent.physical_controller:move({0, 30 * (jump * 2 - 1) * td, 0}) else this.parent.physical_controller:move({0, 0.6 * td * vspeed * 9.8, 0}) end if right > 0 then this.parent.physical_controller:move({-1 * td * speed, 0, 0}) end if left > 0 then this.parent.physical_controller:move({1 * td * speed, 0, 0}) end dir = 0 if right > 0 then dir = 1 this.rotation = {0, -0.707, 0, 0.707} end if left > 0 then dir = -1 this.rotation = {0, 0.707, 0, 0.707} end else speed = 0 end this.animator:setFloatInput(speed_input_idx, speed) end
local request = require('lib.request') local response = require('lib.response') local User = require('models.user') local UserLog = require('models.user_log') local validator = require('lib.validator') local config = require('config.app') local auth = require('lib.auth_service_provider') local cjson = require('cjson') local user_service = require('services.user_service') local random = require('lib.random') local env = require('env') local random = require('lib.random') local redis = require('lib.redis') local sms_service = require('services.sms_service') local _M = {} function _M:login() local args = request:all() local ok, msg = validator:check( args, { 'phone', } ) if not ok then return response:json(0x000001, msg) end local user = User:where('phone', '=', args.phone):first() if not user then return response:json(0x010003) end if args.sms_code then local ok = sms_service:verify_sms_code(args.phone, args.sms_code) if not ok then return response:json(0x000001, 'invalid sms code') end elseif args.password then local ok, err = user_service:verify_password(args.password, user.password) if not ok then -- login fail return response:json(0x010002) end else return response:json(0x000001, 'need sms or password') end -- login success auth:authorize(user) UserLog:create({ user_id = user.id, ip = request:header('x-forwarded-for') or ngx.var.remote_addr, city = '', country = '', type = 'login' }) return response:json(0, 'ok', table_remove(user, {'password'})) end function _M:register() local args = request:all() local ok, msg = validator:check( args, { 'phone', 'password', } ) if not ok then return response:json(0x000001, msg) end -- check if repeat local user = User:where('phone', '=', args.phone):first() if user then return response:json(0x010001) end local name = args.name if name == nil or name == '' then -- if dont have nickname, make up with a part of phone local phone_len = string.len(args.phone) local hidden_phone_len = math.floor(phone_len * 0.4) name = string.sub(args.phone, 1, hidden_phone_len - 1) .. string.rep('*', hidden_phone_len) .. string.sub(args.phone, phone_len - hidden_phone_len + 1, phone_len) end local user_obj = { name = name, password = hash(args.password), phone = args.phone } local ok = User:create(user_obj) if not ok then return response:json(0x000005) end local user = User:where('phone', '=', args.phone):first() if not user then log('not found user') return response:json(0x010001) end auth:authorize(user) return response:json(0, 'ok', table_remove(user, {'password'})) end function _M:logout() local ok, err = auth:clear_token() if not ok then ngx.log(ngx.ERR, err) return response:json(0x00000A) end return response:json(0) end function _M:reset_password() local args = request:all() local ok, msg = validator:check(args, { 'old_password', 'new_password' }) if not ok then return response:json(0x000001, msg) end if args.old_password == args.new_password then return response:json(0x010007) end local user = auth:user() local password = args.old_password ok = user_service:verify_password(args.old_password, user.password) if not ok then -- password error return response:json(0x010005) end local ok, err = User:where('id', '=', user.id):update({ password=hash(args.new_password) }) if not ok then return response:json(0x000005) end ok, err = auth:clear_token() if not ok then return response:json(0x010006) end return response:json(0) end -- @middleware: verify_guest_sms_code function _M:forget_password() local args = request:all() local ok, msg = validator:check(args, { 'phone', 'new_password' }) if not ok then return response:json(0x000001, msg) end local affected_rows, err = User:where('phone', '=', args.phone):update({ password=hash(args.new_password) }) if not affected_rows then return response:json(0x010006) end if affected_rows ~= 1 then return response:json(0x010009) end return response:json(0) end return _M
-- Build script for "notes2bib" files -- Identify the module module = "notes2bib" -- .dtx is self-contained unpackfiles = {"*.dtx"} -- Release a TDS-style zip packtdszip = true -- No implementation as standard typesetcmds = "\\AtBeginDocument{\\DisableImplementation}"
local kata = {} function kata.count_chars(s) local count = {} for i = 1,s:len() do c = s:sub(i,i) count[c] = 1 + (count[c] or 0) end return count end return kata
--[[ Sprite Font API created by ShoesForClues This API allows you to import custom fonts into roblox using a tool called Sprite Font Builder You can download the software here: https://www.johnwordsworth.com/projects/sprite-font-builder/ --]] return function(thread) local API={ _version={0,1,0}; _dependencies={ "stdlib"; "gel"; "parser"; }; } function API:parse_line(line) --Parse .fnt data local tokens={} line=line.." " local text_len=thread.libraries["stdlib"].root_functions.string.len(line) local key,a="",1 while a<text_len do local char=thread.libraries["stdlib"].root_functions.string.sub(line,a,a) if char~="=" then key=key..char else local value="" if thread.libraries["stdlib"].root_functions.string.sub(line,a+1,a+1)~='"' then local b=a+1 while b<text_len do local sub_char=thread.libraries["stdlib"].root_functions.string.sub(line,b,b) if sub_char~=" " then value=value..sub_char else a=b break end b=b+1 end tokens[key]=tonumber(value) else local b=a+2 while b<text_len do local sub_char=thread.libraries["stdlib"].root_functions.string.sub(line,b,b) if sub_char~='"' then value=value..sub_char else a=b+1 break end b=b+1 end tokens[key]=value end key="" end a=a+1 end return tokens end function API:load_font(data) local font={ texture_id=""; size=0; resolution=Vector2.new(0,0); line_height=0; base=0; characters={}; } local parsed_data=thread.libraries["parser"]:get_lines(data) for i,v in pairs(parsed_data) do parsed_data[i]=API:parse_line(v) end font.texture_id=parsed_data[3]["file"] font.resolution=Vector2.new(parsed_data[2]["scaleW"],parsed_data[2]["scaleH"]) font.size=parsed_data[1]["size"]/font.resolution.Y font.line_height=parsed_data[2]["common lineHeight"]/font.resolution.Y font.base=parsed_data[2]["base"]/font.resolution.Y for i=5,#parsed_data-1 do font.characters[parsed_data[i]["letter"]]={ position=Vector2.new(parsed_data[i]["x"]/font.resolution.X,parsed_data[i]["y"]/font.resolution.Y); size=Vector2.new(parsed_data[i]["width"]/font.resolution.X,parsed_data[i]["height"]/font.resolution.Y); offset=Vector2.new(parsed_data[i]["xoffset"]/font.resolution.X,parsed_data[i]["yoffset"]/font.resolution.Y); x_advance=parsed_data[i]["xadvance"]/font.resolution.X } end return font end function API:create_sfont_image(properties) local sfont_image={ properties=thread.libraries["stdlib"]:create_properties_table({ font=thread.libraries["stdlib"]:create_property(properties.font,true); parent=thread.libraries["stdlib"]:create_property(properties.parent,true); name=thread.libraries["stdlib"]:create_property(properties.name or "sfont_image",true); visible=thread.libraries["stdlib"]:create_property(properties.visible or false,true); background_color_3=thread.libraries["stdlib"]:create_property(properties.background_color_3 or Color3.new(0,0,0),true); background_transparency=thread.libraries["stdlib"]:create_property(properties.background_transparency or 0,true); border_color_3=thread.libraries["stdlib"]:create_property(properties.border_color_3 or Color3.new(0,0,0),true); border_size_pixel=thread.libraries["stdlib"]:create_property(properties.border_size_pixel or 0,true); rotation=thread.libraries["stdlib"]:create_property(properties.rotation or 0,true); z_index=thread.libraries["stdlib"]:create_property(properties.z_index or 1,true); clips_descendants=thread.libraries["stdlib"]:create_property(properties.clips_descendants or false,true); text=thread.libraries["stdlib"]:create_property(properties.text or "",true); text_color_3=thread.libraries["stdlib"]:create_property(properties.text_color_3 or Color3.new(1,1,1),true); text_scaled=thread.libraries["stdlib"]:create_property(properties.text_scaled or false,true); text_size=thread.libraries["stdlib"]:create_property(properties.text_size or 14,true); text_stroke_color_3=thread.libraries["stdlib"]:create_property(properties.text_stroke_color_3 or Color3.new(0,0,0),true); text_stroke_transparency=thread.libraries["stdlib"]:create_property(properties.text_stroke_transparency or 1,true); text_transparency=thread.libraries["stdlib"]:create_property(properties.text_transparency or 0,true); text_wrapped=thread.libraries["stdlib"]:create_property(properties.text_wrapped or false,true); text_x_alignment=thread.libraries["stdlib"]:create_property(properties.text_x_alignment or Enum.TextXAlignment.Center,true); text_y_alignment=thread.libraries["stdlib"]:create_property(properties.text_y_alignment or Enum.TextYAlignment.Center,true); font_size=thread.libraries["stdlib"]:create_property(properties.font_size or Enum.FontSize.Size14,true); size=thread.libraries["stdlib"]:create_property(properties.size or UDim2.new(0,0,0,0),true); position=thread.libraries["stdlib"]:create_property(properties.position or UDim2.new(0,0,0,0),true); }); render_size=Vector2.new(0,0); frame=nil; characters={}; } sfont_image.frame=thread.libraries["bgui"]:create_frame(sfont_image.properties:extract()) function sfont_image:update() if sfont_image.properties.font.value==nil then return end local text_len=thread.libraries["stdlib"].root_functions.string.len(sfont_image.properties.text.value) local current_position=Vector2.new(0,0) local current_char=1 sfont_image.render_size=Vector2.new(0,0) for i=1,text_len do --Calculate the render size local c=sfont_image.properties.font.value.characters[thread.libraries["stdlib"].root_functions.string.sub(sfont_image.properties.text.value,i,i)] sfont_image.render_size=Vector2.new(sfont_image.render_size.X+c.x_advance,sfont_image.render_size.Y) if i==text_len then sfont_image.render_size=Vector2.new(sfont_image.render_size.X+c.size.X-c.x_advance+c.offset.X,sfont_image.render_size.Y) end if c.offset.Y+c.size.Y>sfont_image.render_size.Y then sfont_image.render_size=Vector2.new(sfont_image.render_size.X,c.offset.Y+c.size.Y) end end for i=1,text_len do local character=thread.libraries["stdlib"].root_functions.string.sub(sfont_image.properties.text.value,i,i) local c=sfont_image.properties.font.value.characters[character] or sfont_image.properties.font.value.characters[""] if character~=" " and c~=nil then local size=Vector2.new(1/c.size.X,1/c.size.Y) local position=Vector2.new(-size.X*c.position.X,-size.Y*c.position.Y) local scale=1/sfont_image.properties.font.value.size*sfont_image.properties.text_size.value if sfont_image.properties.text_scaled.value==true then scale=1/sfont_image.properties.font.value.size*sfont_image.frame.AbsoluteSize.Y end local char=sfont_image.characters[current_char] if char~=nil then char.Visible=true char.BackgroundTransparency=1 char.ImageTransparency=sfont_image.properties.text_transparency.value char.ImageColor3=sfont_image.properties.text_color_3.value char.Image=sfont_image.properties.font.value.texture_id char.ImageRectOffset=c.position*sfont_image.properties.font.value.resolution char.ImageRectSize=c.size*sfont_image.properties.font.value.resolution char.Size=UDim2.new(0,scale*c.size.X,0,scale*c.size.Y) char.Position=UDim2.new(0,scale*(current_position.X+c.offset.X),0,scale*c.offset.Y) char.Parent=sfont_image.frame if sfont_image.properties.text_x_alignment.value==Enum.TextXAlignment.Center then char.Position=char.Position+UDim2.new(0.5,-(sfont_image.render_size.X*scale)/2,0,0) elseif sfont_image.properties.text_x_alignment.value==Enum.TextXAlignment.Right then char.Position=char.Position+UDim2.new(1,-sfont_image.render_size.X*scale,0,0) end if sfont_image.properties.text_y_alignment.value==Enum.TextYAlignment.Center then char.Position=char.Position+UDim2.new(0,0,0.5,-(sfont_image.properties.font.value.base*scale)/2) elseif sfont_image.properties.text_y_alignment.value==Enum.TextYAlignment.Bottom then char.Position=char.Position+UDim2.new(0,0,1,-sfont_image.properties.font.value.base*scale) end end current_position=Vector2.new(current_position.X+c.x_advance,0) current_char=current_char+1 else current_position=Vector2.new(current_position.X+sfont_image.properties.font.value.characters[" "].x_advance,0) end end end function sfont_image:render() if sfont_image.properties.font.value==nil then for _,char in pairs(sfont_image.characters) do char:Destroy() end sfont_image.characters={} sfont_image.render_size=Vector2.new(0,0) return end local text_len=thread.libraries["stdlib"].root_functions.string.len(sfont_image.properties.text.value) local total_rendering=text_len-select(2,thread.libraries["stdlib"].root_functions.string.gsub(sfont_image.properties.text.value," ","")) for i=1,#sfont_image.characters-total_rendering do --Remove any excess rendered characters sfont_image.characters[i]:Destroy() thread.libraries["stdlib"].root_functions.table.remove(sfont_image.characters,i) end for i=1,total_rendering-#sfont_image.characters do --Create any additional rendered characters local character=thread.libraries["stdlib"].root_functions.string.sub(sfont_image.properties.text.value,i,i) local c=sfont_image.properties.font.value.characters[character] if character~=" " then sfont_image.characters[#sfont_image.characters+1]=thread.libraries["bgui"]:create_image_label({ parent=sfont_image.frame; }) end end sfont_image:update() end function sfont_image:delete() if sfont_image.frame~=nil then sfont_image.frame:Destroy() end sfont_image.characters={} end sfont_image:render() --Bind events so that rendering updates automatically sfont_image.properties.font:attach_bind(function(new,pre) sfont_image:update() end) sfont_image.properties.text_color_3:attach_bind(function(new,pre) sfont_image:update() end) sfont_image.properties.text_scaled:attach_bind(function(new,pre) sfont_image:update() end) sfont_image.properties.text_size:attach_bind(function(new,pre) sfont_image:update() end) sfont_image.properties.text_transparency:attach_bind(function(new,pre) sfont_image:update() end) sfont_image.properties.text_x_alignment:attach_bind(function(new,pre) sfont_image:update() end) sfont_image.properties.text_y_alignment:attach_bind(function(new,pre) sfont_image:update() end) sfont_image.properties.text:attach_bind(function(new,pre) sfont_image:render() end) sfont_image.frame.Changed:Connect(function() sfont_image:update() end) return sfont_image end return API end
module(..., package.seeall) local engine = require("core.app") local config = require("core.config") local timer = require("core.timer") local csv_stats = require("program.lwaftr.csv_stats") local pci = require("lib.hardware.pci") local Intel82599 = require("apps.intel.intel_app").Intel82599 local basic_apps = require("apps.basic.basic_apps") local loadgen = require("apps.lwaftr.loadgen") local main = require("core.main") local PcapReader = require("apps.pcap.pcap").PcapReader local lib = require("core.lib") function show_usage(code) print(require("program.lwaftr.transient.README_inc")) main.exit(code) end local function find_devices(pattern) if #pci.devices == 0 then pci.scan_devices() end pattern = pci.qualified(pattern) local ret = {} for _,device in ipairs(pci.devices) do if (device.usable and device.driver == 'apps.intel.intel_app' and pattern:match(device.pciaddress)) then table.insert(ret, device.pciaddress) end end return ret end local function find_device(pattern) local devices = find_devices(pattern) if #devices == 0 then error('no devices matched pattern "'..pattern..'"') elseif #devices == 1 then return devices[1] else local devices_str = table.concat(devices, ' ') error('multiple devices matched pattern "'..pattern..'":'..devices_str) end end function parse_args(args) local handlers = {} local opts = { bitrate = 10e9, duration = 5, period = 1 } function handlers.b(arg) opts.bitrate = assert(tonumber(arg), 'bitrate must be a number') end function handlers.s(arg) opts.step = assert(tonumber(arg), 'step must be a number') end function handlers.D(arg) opts.duration = assert(tonumber(arg), 'duration must be a number') end function handlers.p(arg) opts.period = assert(tonumber(arg), 'period must be a number') end handlers["bench-file"] = function(bench_file) opts.bench_file = bench_file end function handlers.h() show_usage(0) end args = lib.dogetopt(args, handlers, "hb:s:D:p:", { bitrate="b", step="s", duration="D", period="p", ["bench-file"]=1, help="h" }) if not opts.step then opts.step = opts.bitrate / 10 end assert(opts.bitrate > 0, 'bitrate must be positive') assert(opts.step > 0, 'step must be positive') assert(opts.duration > 0, 'duration must be positive') assert(opts.period > 0, 'period must be positive') if #args == 0 or #args % 3 ~= 0 then show_usage(1) end local streams = {} for i=1,#args,3 do local capture_file, name, pattern = args[i], args[i+1], args[i+2] local nic = { capture_file = capture_file, name = name, id = name:gsub('[^%w]', '_'), pci_addr = find_device(pattern) } table.insert(streams, nic) end return opts, streams end -- This ramps the repeater up from 0 Gbps to the max bitrate, lingering -- at the top only for one period, then comes back down in the same way. -- We can add more of these for different workloads. local function adjust_rate(opts, streams) local count = math.ceil(opts.bitrate / opts.step) return function() local bitrate = opts.bitrate - math.abs(count) * opts.step for _,stream in ipairs(streams) do local app = engine.app_table[stream.repeater_id] app:set_rate(bitrate) end count = count - 1 end end function run(args) local opts, streams = parse_args(args) local c = config.new() for _,stream in ipairs(streams) do stream.pcap_id = 'pcap_'..stream.id stream.repeater_id = 'repeater_'..stream.id stream.nic_id = 'nic_'..stream.id stream.rx_sink_id = 'rx_sink_'..stream.id config.app(c, stream.pcap_id, PcapReader, stream.capture_file) config.app(c, stream.repeater_id, loadgen.RateLimitedRepeater, {}) config.app(c, stream.nic_id, Intel82599, { pciaddr = stream.pci_addr }) config.app(c, stream.rx_sink_id, basic_apps.Sink) config.link(c, stream.pcap_id..".output -> "..stream.repeater_id..".input") config.link(c, stream.repeater_id..".output -> "..stream.nic_id..".rx") config.link(c, stream.nic_id..".tx -> "..stream.rx_sink_id..".input") end engine.configure(c) local rate_adjuster = adjust_rate(opts, streams) -- Initialize rates before anything happens. rate_adjuster() timer.activate(timer.new("adjust_rate", rate_adjuster, opts.duration * 1e9, 'repeating')) local csv = csv_stats.CSVStatsTimer:new(opts.bench_file) for _,stream in ipairs(streams) do csv:add_app(stream.nic_id, { 'rx', 'tx' }, { rx=stream.name..' TX', tx=stream.name..' RX' }) end csv:activate() engine.busywait = true engine.main({duration=opts.duration*((opts.bitrate/opts.step)*2+1)}) end
ESX = nil Citizen.CreateThread(function() while ESX == nil do TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) Citizen.Wait(250) end end) Citizen.CreateThread(function() while true do local sleep = 9000 local player = PlayerPedId() local playercoords = GetEntityCoords(player) local dst = GetDistanceBetweenCoords(playercoords, Config.hurda1.x, Config.hurda1.y, Config.hurda1.z, true) local dst2 = GetDistanceBetweenCoords(playercoords, Config.hurda1.x, Config.hurda1.y, Config.hurda1.z, true) if dst2 < 40 then sleep = 10 DrawMarker(2, Config.hurda1.x, Config.hurda1.y, Config.hurda1.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7, 0.7, 0.7, 255, 0, 0, 255, 0, 0, 0, 1, 0, 0, 0) if dst2 < 5 then DrawText3Ds(Config.hurda1.x, Config.hurda1.y, Config.hurda1.z + 0.5, '[E] Makina`yı Kontrol Et') if IsControlJustReleased(0, 38) then TriggerEvent("mythic_progbar:client:progress", { name = "makinakontrol", duration = 25000, label = "Makina Kontrol Ediliyor", useWhileDead = false, canCancel = true, controlDisables = { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, animation = { animDict = "amb@prop_human_bum_bin@idle_a", anim = "idle_a", flags = 49, }, prop = { model = "prop_ld_scrap", bone = -0, coords = { x = -0, y = -0, z = -0 }, rotation = { x = 100.0, y = 150.00, z = 140.0 }, }, }, function(status) if not status then TriggerServerEvent("art-hurda") exports['mythic_notify']:SendAlert('inform', 'Makina`yı Kontrol Ederek 250$ Bahşiş Aldın!!', 5000) end end) end end end Citizen.Wait(sleep) end end) Citizen.CreateThread(function() while true do local sleep = 9000 local player = PlayerPedId() local playercoords = GetEntityCoords(player) local dst = GetDistanceBetweenCoords(playercoords, Config.hurda2.x, Config.hurda2.y, Config.hurda2.z, true) local dst2 = GetDistanceBetweenCoords(playercoords, Config.hurda2.x, Config.hurda2.y, Config.hurda2.z, true) if dst2 < 40 then sleep = 10 DrawMarker(2, Config.hurda2.x, Config.hurda2.y, Config.hurda2.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7, 0.7, 0.7, 255, 0, 0, 255, 0, 0, 0, 1, 0, 0, 0) if dst2 < 5 then DrawText3Ds(Config.hurda2.x, Config.hurda2.y, Config.hurda2.z + 0.5, '[E] Tuğlaları Paketle') if IsControlJustReleased(0, 38) then TriggerEvent("mythic_progbar:client:progress", { name = "tuglapaket", duration = 25000, label = "Tuğlalar Paketleniyor", useWhileDead = false, canCancel = false, controlDisables = { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, animation = { animDict = "amb@prop_human_bum_bin@idle_a", anim = "idle_a", flags = 49, }, prop = { model = "prop_ld_scrap", bone = -0, coords = { x = -0.00, y = -0.00, z = -0.00 }, rotation = { x = 100.0, y = 150.00, z = 140.0 }, }, }, function(status) if not status then TriggerServerEvent("art-tuglapaket") exports['mythic_notify']:SendAlert('inform', "Tuğlayı Paketleyerek 350$ Bahşiş Aldın!", 5000) end end) end end end Citizen.Wait(sleep) end end) Citizen.CreateThread(function() while true do local sleep = 9000 local player = PlayerPedId() local playercoords = GetEntityCoords(player) local dst = GetDistanceBetweenCoords(playercoords, Config.hurda3.x, Config.hurda3.y, Config.hurda3.z, true) local dst2 = GetDistanceBetweenCoords(playercoords, Config.hurda3.x, Config.hurda3.y, Config.hurda3.z, true) if dst2 < 40 then sleep = 10 DrawMarker(2, Config.hurda3.x, Config.hurda3.y, Config.hurda3.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.7, 0.7, 0.7, 255, 0, 0, 255, 0, 0, 0, 1, 0, 0, 0) if dst2 < 5 then DrawText3Ds(Config.hurda3.x, Config.hurda3.y, Config.hurda3.z + 0.5, '[E] Tahtaları Boya') if IsControlJustReleased(0, 38) then TriggerEvent("mythic_progbar:client:progress", { name = "tahtaboya", duration = 28000, label = "Tahtalar Boyanıyor", useWhileDead = false, canCancel = false, controlDisables = { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, animation = { animDict = "mini@repair", anim = "fixing_a_ped", flags = 49, }, prop = { model = "prop_paint_spray01a", bone = 57005, coords = { x = -0.00, y = -0.00, z = -0.00 }, rotation = { x = 100.0, y = 150.00, z = 140.0 }, }, }, function(status) if not status then TriggerServerEvent("art-tahtaboya") exports['mythic_notify']:SendAlert('inform', "Tahtaları Boyadığın İçin 450$ Bahşiş Aldın!", 5000) end end) end end end Citizen.Wait(sleep) end end) function DrawText3Ds(x,y,z, text) local onScreen,_x,_y=World3dToScreen2d(x,y,z) local px,py,pz=table.unpack(GetGameplayCamCoords()) SetTextScale(0.30, 0.30) SetTextFont(0) SetTextProportional(1) SetTextColour(255, 255, 255, 215) SetTextEntry("STRING") SetTextCentre(1) AddTextComponentString(text) DrawText(_x,_y) local factor = (string.len(text)) / 250 DrawRect(_x,_y+0.0125, 0.015+ factor, 0.03, 0, 0, 0, 75) end -- Blip local blip = AddBlipForCoord( -190.54, 6290.19, 31.4205, - 1) SetBlipSprite(blip, 488) SetBlipColour(blip, 1) SetBlipScale (blip, 0.50) SetBlipAsShortRange(blip, true) BeginTextCommandSetBlipName('STRING') AddTextComponentString('Red`s Machine Supplies') EndTextCommandSetBlipName(blip) -- GİRİŞ`DEKİ GÜVENLİK GÖREVLİSİ Citizen.CreateThread(function() if Config.NPCEnable == true then RequestModel(-681004504) while not HasModelLoaded(-681004504) do Wait(1) end art = CreatePed(1, -681004504, -198.92, 6315.28, 30.5307, 40.07, false, true) SetBlockingOfNonTemporaryEvents(art, true) SetPedDiesWhenInjured(art, false) SetPedCanPlayAmbientAnims(art, true) SetPedCanRagdollFromPlayerImpact(art, false) SetEntityInvincible(art, true) FreezeEntityPosition(art, true) TaskStartScenarioInPlace(art, "WORLD_HUMAN_DRUG_DEALER", 0, true); end end) --HURDA KARIŞTIRAN NPC Citizen.CreateThread(function() if Config.NPCEnable == true then RequestModel(349680864) while not HasModelLoaded(349680864) do Wait(1) end art2 = CreatePed(1, 349680864, -206.10, 6299.39, 30.49, 102.07, false, true) SetBlockingOfNonTemporaryEvents(art2, true) SetPedDiesWhenInjured(art2, false) SetPedCanPlayAmbientAnims(art2, true) SetPedCanRagdollFromPlayerImpact(art2, false) SetEntityInvincible(art2, true) FreezeEntityPosition(art2, true) TaskStartScenarioInPlace(art2, "WORLD_HUMAN_BUM_WASH", 0, true); end end) --DURAN NPC Citizen.CreateThread(function() if Config.NPCEnable == true then RequestModel(-673538407) while not HasModelLoaded(-673538407) do Wait(1) end art3 = CreatePed(1, -673538407, -184.23, 6274.87, 30.4893, 39.14, false, true) SetBlockingOfNonTemporaryEvents(art3, true) SetPedDiesWhenInjured(art3, false) SetPedCanPlayAmbientAnims(art3, true) SetPedCanRagdollFromPlayerImpact(art3, false) SetEntityInvincible(art3, true) FreezeEntityPosition(art3, true) TaskStartScenarioInPlace(art3, "WORLD_HUMAN_CLIPBOARD", 0, true); end end)
object_draft_schematic_space_cargo_hold_shared_crg_mining_large = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/cargo_hold/shared_crg_mining_large.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_cargo_hold_shared_crg_mining_large, "object/draft_schematic/space/cargo_hold/shared_crg_mining_large.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_cargo_hold_shared_crg_mining_medium = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/cargo_hold/shared_crg_mining_medium.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_cargo_hold_shared_crg_mining_medium, "object/draft_schematic/space/cargo_hold/shared_crg_mining_medium.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_cargo_hold_shared_crg_mining_small = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/cargo_hold/shared_crg_mining_small.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_cargo_hold_shared_crg_mining_small, "object/draft_schematic/space/cargo_hold/shared_crg_mining_small.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_cargo_hold_shared_crg_pob_gunship_huge = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/cargo_hold/shared_crg_pob_gunship_huge.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_cargo_hold_shared_crg_pob_gunship_huge, "object/draft_schematic/space/cargo_hold/shared_crg_pob_gunship_huge.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_cargo_hold_shared_crg_pob_huge = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/cargo_hold/shared_crg_pob_huge.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_cargo_hold_shared_crg_pob_huge, "object/draft_schematic/space/cargo_hold/shared_crg_pob_huge.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_cargo_hold_shared_crg_pob_large = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/cargo_hold/shared_crg_pob_large.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_cargo_hold_shared_crg_pob_large, "object/draft_schematic/space/cargo_hold/shared_crg_pob_large.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_cargo_hold_shared_crg_pob_medium = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/cargo_hold/shared_crg_pob_medium.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_cargo_hold_shared_crg_pob_medium, "object/draft_schematic/space/cargo_hold/shared_crg_pob_medium.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_cargo_hold_shared_crg_pob_small = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/cargo_hold/shared_crg_pob_small.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_cargo_hold_shared_crg_pob_small, "object/draft_schematic/space/cargo_hold/shared_crg_pob_small.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_cargo_hold_shared_crg_starfighter_huge = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/cargo_hold/shared_crg_starfighter_huge.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_cargo_hold_shared_crg_starfighter_huge, "object/draft_schematic/space/cargo_hold/shared_crg_starfighter_huge.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_cargo_hold_shared_crg_starfighter_large = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/cargo_hold/shared_crg_starfighter_large.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_cargo_hold_shared_crg_starfighter_large, "object/draft_schematic/space/cargo_hold/shared_crg_starfighter_large.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_cargo_hold_shared_crg_starfighter_medium = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/cargo_hold/shared_crg_starfighter_medium.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_cargo_hold_shared_crg_starfighter_medium, "object/draft_schematic/space/cargo_hold/shared_crg_starfighter_medium.iff") ------------------------------------------------------------------------------------------------------------------------------------ object_draft_schematic_space_cargo_hold_shared_crg_starfighter_small = SharedDraftSchematicObjectTemplate:new { clientTemplateFileName = "object/draft_schematic/space/cargo_hold/shared_crg_starfighter_small.iff" } ObjectTemplates:addClientTemplate(object_draft_schematic_space_cargo_hold_shared_crg_starfighter_small, "object/draft_schematic/space/cargo_hold/shared_crg_starfighter_small.iff") ------------------------------------------------------------------------------------------------------------------------------------
package("crashpad") set_homepage("https://chromium.googlesource.com/crashpad/crashpad/+/refs/heads/main/README.md") set_description("Crashpad is a crash-reporting system.") if is_host("windows") then local map = { ["2021.8.1"] = "stable", ["2022.4.16"] = "latest" } function map_version(version) return map[tostring(version)] end if is_arch("x64", "x86_64") then set_urls("http://get.backtrace.io/crashpad/builds/crashpad-release-x86-64-$(version).zip", {version = map_version}) add_versions("2021.8.1", "b3facf8a802dfd12daf4d9fba416f4d4b5df0ae544afa14080662fa978aa18cb") add_versions("2022.4.16", "7705073dfff89c376303cacea3a6f8c63322f77566ad5cdbe37060cf3cef9f8b") else set_urls("http://get.backtrace.io/crashpad/builds/crashpad-release-x86-$(version).zip", {version = map_version}) add_versions("2021.8.1", "699fdf741f39da1c68069820ce891b6eb8b48ef29ab399fc1bcf210b67ff8547") add_versions("2022.4.16", "c3bffb64d1087198946739dfb30d24b2355e49ddfe90d8e2a75ed373ed6e3377") end end add_includedirs("include", "include/mini_chromium") on_install("windows", function (package) os.cp("include/*", package:installdir("include")) os.cp("bin/crashpad_handler.exe", package:installdir("bin")) if package:config("shared") then os.cp("lib_md/*", package:installdir("lib")) else os.cp("lib_mt/*", package:installdir("lib")) end end)
local app = app local libcore = require "core.libcore" local Class = require "Base.Class" local Unit = require "Unit" local GainBias = require "Unit.ViewControl.GainBias" local OptionControl = require "Unit.ViewControl.OptionControl" local Encoder = require "Encoder" local SlewLimiter = Class {} SlewLimiter:include(Unit) function SlewLimiter:init(args) args.title = "Slew Limiter" args.mnemonic = "SL" Unit.init(self, args) end function SlewLimiter:onLoadGraph(channelCount) if channelCount == 2 then self:loadStereoGraph() else self:loadMonoGraph() end end function SlewLimiter:loadMonoGraph() local slew = self:addObject("slew1", libcore.SlewLimiter()) local time = self:addObject("time", app.ParameterAdapter()) connect(self, "In1", slew, "In") connect(slew, "Out", self, "Out1") tie(slew, "Time", time, "Out") self:addMonoBranch("time", time, "In", time, "Out") end function SlewLimiter:loadStereoGraph() local slew1 = self:addObject("slew1", libcore.SlewLimiter()) local slew2 = self:addObject("slew2", libcore.SlewLimiter()) local time = self:addObject("time", app.ParameterAdapter()) connect(self, "In1", slew1, "In") connect(self, "In2", slew2, "In") connect(slew1, "Out", self, "Out1") connect(slew2, "Out", self, "Out2") tie(slew1, "Time", time, "Out") tie(slew2, "Time", time, "Out") tie(slew2, "Direction", slew1, "Direction") self:addMonoBranch("time", time, "In", time, "Out") end local views = { expanded = { "time", "dir" }, collapsed = {} } function SlewLimiter:onLoadViews(objects, branches) local controls = {} controls.time = GainBias { button = "time", branch = branches.time, description = "Slew Time", gainbias = objects.time, range = objects.time, biasMap = Encoder.getMap("slewTimes"), biasUnits = app.unitSecs, initialBias = 1.0, scaling = app.octaveScaling, gainMap = Encoder.getMap("gain") } controls.dir = OptionControl { button = "o", description = "Mode", option = objects.slew1:getOption("Direction"), choices = { "up", "both", "down" } } return controls, views end return SlewLimiter
-- Copyright 2008 Steven Barth <steven@midlink.org> -- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> -- Licensed to the public under the Apache License 2.0. local nixio = require "nixio" local util = require "luci.util" local table = require "table" local string = require "string" local coroutine = require "coroutine" local assert = assert local tonumber = tonumber local tostring = tostring local error = error local type = type local pairs = pairs local ipairs = ipairs local next = next local pcall = pcall local band = nixio.bit.band local bor = nixio.bit.bor local rshift = nixio.bit.rshift local char = string.char local getmetatable = getmetatable module "luci.json" function decode(json, ...) local a = ActiveDecoder(function() return nil end, ...) a.chunk = json local s, obj = pcall(a.get, a) return s and obj or nil end function encode(obj, ...) local out = {} local e = Encoder(obj, 1, ...):source() local chnk, err repeat chnk, err = e() out[#out+1] = chnk until not chnk return not err and table.concat(out) or nil end function null() return null end Encoder = util.class() function Encoder.__init__(self, data, buffersize, fastescape) self.data = data self.buffersize = buffersize or 512 self.buffer = "" self.fastescape = fastescape getmetatable(self).__call = Encoder.source end function Encoder.source(self) local source = coroutine.create(self.dispatch) return function() local res, data = coroutine.resume(source, self, self.data, true) if res then return data else return nil, data end end end function Encoder.dispatch(self, data, start) local parser = self.parsers[type(data)] parser(self, data) if start then if #self.buffer > 0 then coroutine.yield(self.buffer) end coroutine.yield() end end function Encoder.put(self, chunk) if self.buffersize < 2 then coroutine.yield(chunk) else if #self.buffer + #chunk > self.buffersize then local written = 0 local fbuffer = self.buffersize - #self.buffer coroutine.yield(self.buffer .. chunk:sub(written + 1, fbuffer)) written = fbuffer while #chunk - written > self.buffersize do fbuffer = written + self.buffersize coroutine.yield(chunk:sub(written + 1, fbuffer)) written = fbuffer end self.buffer = chunk:sub(written + 1) else self.buffer = self.buffer .. chunk end end end function Encoder.parse_nil(self) self:put("null") end function Encoder.parse_bool(self, obj) self:put(obj and "true" or "false") end function Encoder.parse_number(self, obj) self:put(tostring(obj)) end function Encoder.parse_string(self, obj) if self.fastescape then self:put('"' .. obj:gsub('\\', '\\\\'):gsub('"', '\\"') .. '"') else self:put('"' .. obj:gsub('[%c\\"]', function(char) return '\\u00%02x' % char:byte() end ) .. '"') end end function Encoder.parse_iter(self, obj) if obj == null then return self:put("null") end if type(obj) == "table" and (#obj == 0 and next(obj)) then self:put("{") local first = true for key, entry in pairs(obj) do if key ~= null then first = first or self:put(",") first = first and false self:parse_string(tostring(key)) self:put(":") self:dispatch(entry) end end self:put("}") else self:put("[") local first = true if type(obj) == "table" then for i=1, #obj do first = first or self:put(",") first = first and nil self:dispatch(obj[i]) end else for entry in obj do first = first or self:put(",") first = first and nil self:dispatch(entry) end end self:put("]") end end function Encoder.parse_udata(self, obj) return self:parse_string(tostring(obj)) end Encoder.parsers = { ['nil'] = Encoder.parse_nil, ['table'] = Encoder.parse_iter, ['number'] = Encoder.parse_number, ['string'] = Encoder.parse_string, ['boolean'] = Encoder.parse_bool, ['function'] = Encoder.parse_iter, ['userdata'] = Encoder.parse_udata, } Decoder = util.class() function Decoder.__init__(self, customnull) self.cnull = customnull getmetatable(self).__call = Decoder.sink end function Decoder.sink(self) local sink = coroutine.create(self.dispatch) return function(...) return coroutine.resume(sink, self, ...) end end function Decoder.get(self) return self.data end function Decoder.dispatch(self, chunk, src_err, strict) local robject, object local oset = false while chunk do while chunk and #chunk < 1 do chunk = self:fetch() end assert(not strict or chunk, "Unexpected EOS") if not chunk then break end local char = chunk:sub(1, 1) local parser = self.parsers[char] or (char:match("%s") and self.parse_space) or (char:match("[0-9-]") and self.parse_number) or error("Unexpected char '%s'" % char) chunk, robject = parser(self, chunk) if parser ~= self.parse_space then assert(not oset, "Scope violation: Too many objects") object = robject oset = true if strict then return chunk, object end end end assert(not src_err, src_err) assert(oset, "Unexpected EOS") self.data = object end function Decoder.fetch(self) local tself, chunk, src_err = coroutine.yield() assert(chunk or not src_err, src_err) return chunk end function Decoder.fetch_atleast(self, chunk, bytes) while #chunk < bytes do local nchunk = self:fetch() assert(nchunk, "Unexpected EOS") chunk = chunk .. nchunk end return chunk end function Decoder.fetch_until(self, chunk, pattern) local start = chunk:find(pattern) while not start do local nchunk = self:fetch() assert(nchunk, "Unexpected EOS") chunk = chunk .. nchunk start = chunk:find(pattern) end return chunk, start end function Decoder.parse_space(self, chunk) local start = chunk:find("[^%s]") while not start do chunk = self:fetch() if not chunk then return nil end start = chunk:find("[^%s]") end return chunk:sub(start) end function Decoder.parse_literal(self, chunk, literal, value) chunk = self:fetch_atleast(chunk, #literal) assert(chunk:sub(1, #literal) == literal, "Invalid character sequence") return chunk:sub(#literal + 1), value end function Decoder.parse_null(self, chunk) return self:parse_literal(chunk, "null", self.cnull and null) end function Decoder.parse_true(self, chunk) return self:parse_literal(chunk, "true", true) end function Decoder.parse_false(self, chunk) return self:parse_literal(chunk, "false", false) end function Decoder.parse_number(self, chunk) local chunk, start = self:fetch_until(chunk, "[^0-9eE.+-]") local number = tonumber(chunk:sub(1, start - 1)) assert(number, "Invalid number specification") return chunk:sub(start), number end function Decoder.parse_string(self, chunk) local str = "" local object = nil assert(chunk:sub(1, 1) == '"', 'Expected "') chunk = chunk:sub(2) while true do local spos = chunk:find('[\\"]') if spos then str = str .. chunk:sub(1, spos - 1) local char = chunk:sub(spos, spos) if char == '"' then -- String end chunk = chunk:sub(spos + 1) break elseif char == "\\" then -- Escape sequence chunk, object = self:parse_escape(chunk:sub(spos)) str = str .. object end else str = str .. chunk chunk = self:fetch() assert(chunk, "Unexpected EOS while parsing a string") end end return chunk, str end function Decoder.utf8_encode(self, s1, s2) local n = s1 * 256 + s2 if n >= 0 and n <= 0x7F then return char(n) elseif n >= 0 and n <= 0x7FF then return char( bor(band(rshift(n, 6), 0x1F), 0xC0), bor(band(n, 0x3F), 0x80) ) elseif n >= 0 and n <= 0xFFFF then return char( bor(band(rshift(n, 12), 0x0F), 0xE0), bor(band(rshift(n, 6), 0x3F), 0x80), bor(band(n, 0x3F), 0x80) ) elseif n >= 0 and n <= 0x10FFFF then return char( bor(band(rshift(n, 18), 0x07), 0xF0), bor(band(rshift(n, 12), 0x3F), 0x80), bor(band(rshift(n, 6), 0x3F), 0x80), bor(band(n, 0x3F), 0x80) ) else return "?" end end function Decoder.parse_escape(self, chunk) local str = "" chunk = self:fetch_atleast(chunk:sub(2), 1) local char = chunk:sub(1, 1) chunk = chunk:sub(2) if char == '"' then return chunk, '"' elseif char == "\\" then return chunk, "\\" elseif char == "u" then chunk = self:fetch_atleast(chunk, 4) local s1, s2 = chunk:sub(1, 2), chunk:sub(3, 4) s1, s2 = tonumber(s1, 16), tonumber(s2, 16) assert(s1 and s2, "Invalid Unicode character") return chunk:sub(5), self:utf8_encode(s1, s2) elseif char == "/" then return chunk, "/" elseif char == "b" then return chunk, "\b" elseif char == "f" then return chunk, "\f" elseif char == "n" then return chunk, "\n" elseif char == "r" then return chunk, "\r" elseif char == "t" then return chunk, "\t" else error("Unexpected escaping sequence '\\%s'" % char) end end function Decoder.parse_array(self, chunk) chunk = chunk:sub(2) local array = {} local nextp = 1 local chunk, object = self:parse_delimiter(chunk, "%]") if object then return chunk, array end repeat chunk, object = self:dispatch(chunk, nil, true) table.insert(array, nextp, object) nextp = nextp + 1 chunk, object = self:parse_delimiter(chunk, ",%]") assert(object, "Delimiter expected") until object == "]" return chunk, array end function Decoder.parse_object(self, chunk) chunk = chunk:sub(2) local array = {} local name local chunk, object = self:parse_delimiter(chunk, "}") if object then return chunk, array end repeat chunk = self:parse_space(chunk) assert(chunk, "Unexpected EOS") chunk, name = self:parse_string(chunk) chunk, object = self:parse_delimiter(chunk, ":") assert(object, "Separator expected") chunk, object = self:dispatch(chunk, nil, true) array[name] = object chunk, object = self:parse_delimiter(chunk, ",}") assert(object, "Delimiter expected") until object == "}" return chunk, array end function Decoder.parse_delimiter(self, chunk, delimiter) while true do chunk = self:fetch_atleast(chunk, 1) local char = chunk:sub(1, 1) if char:match("%s") then chunk = self:parse_space(chunk) assert(chunk, "Unexpected EOS") elseif char:match("[%s]" % delimiter) then return chunk:sub(2), char else return chunk, nil end end end Decoder.parsers = { ['"'] = Decoder.parse_string, ['t'] = Decoder.parse_true, ['f'] = Decoder.parse_false, ['n'] = Decoder.parse_null, ['['] = Decoder.parse_array, ['{'] = Decoder.parse_object } ActiveDecoder = util.class(Decoder) function ActiveDecoder.__init__(self, source, customnull) Decoder.__init__(self, customnull) self.source = source self.chunk = nil getmetatable(self).__call = self.get end function ActiveDecoder.get(self) local chunk, src_err, object if not self.chunk then chunk, src_err = self.source() else chunk = self.chunk end self.chunk, object = self:dispatch(chunk, src_err, true) return object end function ActiveDecoder.fetch(self) local chunk, src_err = self.source() assert(chunk or not src_err, src_err) return chunk end
local M = {} local io = io local string = string local pairs = pairs local ngx = ngx function M.tohex(str) return (string.gsub(str, '.', function (c) return string.format('%02x', string.byte(c)) end)) end function M.exit(http_status_code, body, ctx) ngx.status = http_status_code if ctx then if ctx.file_size and ctx.real_size and ctx.real_size > 0 then ngx.header["Content-Range"] = string.format("bytes 0-%d/%d", ctx.real_size - 1, ctx.file_size) end if ctx.checksum then for _, checksum in pairs(ctx.checksum) do if checksum.server then ngx.header[checksum.header] = checksum.server end end end end if body then ngx.say(body) end return ngx.exit(ngx.OK) end function M.truncate_file(path) local f = io.open(path, "wb") if f then f:close() end end -- return exists[true|false], size[number] function M.file_exists_and_size(path) local f = io.open(path, "rb") if f then local size = f:seek("end") f:close() return true, size end return false, 0 end return M
function rectangle(x, y, width, height) local originalX, originalY = x, y local function insideDraw() local mouseX, mouseY = love.mouse.getPosition() return (mouseX > x) and (mouseX < x + width) and (mouseY > y) and (mouseY < y + height) end local function draw() love.graphics.rectangle("line", x, y, width, height) end local function keypressed(key) if not insideDraw() then return end if key == 'b' then x = originalX y = originalY end if key == "down" then y = y + 10 end if key == "up" then y = y - 10 end if key == "right" then x = x + 10 end if key == "left" then x = x - 10 end end return { draw = draw, keypressed = keypressed } end function love.keypressed(key) for i=1, #rect do rect[i].keypressed(key) end end function love.load() rect = {} rect[1] = rectangle(100, 50, 200, 200) rect[2] = rectangle(300, 50, 150, 150) end function love.update() end function love.draw() for i=1, #rect do rect[i].draw() end end
function round (number, figure) local significantFigure = figure local numberToRound = number local roundedNumber, decimal = 0 local stepper = 0 if numberToRound*significantFigure < 0 then stepper = -0.5 else stepper = 0.5 end roundedNumber, decimal = math.modf(numberToRound * significantFigure + stepper) return roundedNumber / significantFigure end
object_mobile_outbreak_undead_deathtrooper_17_m = object_mobile_shared_outbreak_undead_deathtrooper_17_m:new { } ObjectTemplates:addTemplate(object_mobile_outbreak_undead_deathtrooper_17_m, "object/mobile/outbreak_undead_deathtrooper_17_m.iff")
-- "dummy" lauxlib, implements only things required by liolib.lua setfenv(1, setmetatable({}, {__index=getfenv()})) local modules = require("tweaks").modules local ffi = modules.ffi local C = ffi.C --[[ LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) { int en = errno; /* calls to Lua API may change this value */ if (stat) { lua_pushboolean(L, 1); return 1; } else { lua_pushnil(L); if (fname) lua_pushfstring(L, "%s: %s", fname, strerror(en)); else lua_pushstring(L, strerror(en)); lua_pushinteger(L, en); return 3; } } ]] ffi.cdef[[ char *strerror(int errnum); ]] local function fileresult(stat, fname) if stat then return true end local en = ffi.errno() io.write("Calling C.strerror(en)") return nil, fname and (fname .. ": " .. ffi.string(C.strerror(en))) or ffi.string(C.strerror(en)), en end return { fileresult = fileresult, buffersize = 8192, }
-- @brief Provides all the Spine modules. local modules = {} -- @brief Gets all the Spine modules. -- @return The Spine modules as table. function modules.get() return { 'ui.spine.SpineComponent', 'ui.spine.layout.builder.spine' } end return modules
-- -- switch for debugging -- settlements.debug = false -- -- switch for lvm settlements.lvm = false -- -- timer between creation of two settlements -- settlements.last_settlement = os.time() settlements.min_timer = 20 -- -- -- material to replace cobblestone with -- wallmaterial = { "default:junglewood", "default:pine_wood", "default:wood", "default:aspen_wood", "default:acacia_wood", "default:stonebrick", "default:cobble", "default:desert_stonebrick", "default:desert_cobble", "default:sandstone" } settlements.surface_mat = {} ------------------------------------------------------------------------------- -- Set array to list -- https://stackoverflow.com/questions/656199/search-for-an-item-in-a-lua-list ------------------------------------------------------------------------------- function settlements.grundstellungen () settlements.surface_mat = settlements.Set { "default:dirt_with_grass", "default:dry_dirt_with_grass", "default:dirt_with_snow", "default:dirt_with_dry_grass", "default:dirt_with_coniferous_litter", "default:sand", "default:silver_sand", "default:desert_sand", "default:snow_block" } end -- -- possible surfaces where buildings can be built -- -- -- path to schematics -- schem_path = settlements.modpath.."/schematics/" -- -- list of schematics -- schematic_table = { {name = "townhall", mts = schem_path.."townhall.mts", hwidth = 10, hdepth = 11, hheight = 12, hsize = 15, max_num = 0, rplc = "n"}, {name = "well", mts = schem_path.."well.mts", hwidth = 5, hdepth = 5, hheight = 13, hsize = 11, max_num = 0.045, rplc = "n"}, {name = "hut", mts = schem_path.."hut.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 11, max_num = 0.9, rplc = "y"}, {name = "garden", mts = schem_path.."garden.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 11, max_num = 0.1, rplc = "n"}, {name = "lamp", mts = schem_path.."lamp.mts", hwidth = 3, hdepth = 3, hheight = 13, hsize = 10, max_num = 0.1, rplc = "n"}, {name = "tower", mts = schem_path.."tower.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 11, max_num = 0.055, rplc = "n"}, {name = "church", mts = schem_path.."church.mts", hwidth = 7, hdepth = 10, hheight = 13, hsize = 17, max_num = 0.050, rplc = "n"}, {name = "blacksmith", mts = schem_path.."blacksmith.mts", hwidth = 7, hdepth = 7, hheight = 13, hsize = 11, max_num = 0.050, rplc = "n"}, } -- -- temporary info for currentliy built settlement (position of each building) -- settlement_info = {} -- -- list of settlements, load on server start up -- settlements_in_world = {} -- -- min_distance between settlements -- settlements.min_dist_settlements = 500 if settlements.debug == true then min_dist_settlements = 200 end -- -- maximum allowed difference in height for building a sttlement -- max_height_difference = 10 -- -- -- half_map_chunk_size = 40 quarter_map_chunk_size = 20
local openKey = "F1" local killerTable = {} hl = "e8e7e7" --[Fare Buton üstüne getirdiğinizde oluşan renk ]-(http://html-color-codes.info/) hl2 = "FFFFFF" --[Bu ayarla oynamanıza gerek yoktur.] panel, icon, closeBTN, logo_image, tabs = nil opened = false openedZKillers = false openedATime = false function createGUI(allKillers) local sw, sh = guiGetScreenSize() local screenW, screenH = guiGetScreenSize() panel = guiCreateStaticImage((screenW - 673) / 2, (screenH - 464) / 2, 673, 464, "panel.png", false) icon = guiCreateStaticImage(288, 20, 100, 100, "leaderboard.png", false, panel) closeBTN = guiCreateStaticImage(628, 0, 45, 22, "btn-close.png", false, panel) addEventHandler("onClientGUIClick", closeBTN, closeGUI, false ) logo_image = guiCreateStaticImage(10, 139, 650, 315, "memo_arka.png", false, panel) tabs = guiCreateTabPanel (4, 4, 643, 307, false, logo_image) tabKillers = guiCreateTab( "Top 50 killers", tabs ) killersScreenGridList = guiCreateGridList ( 0, 0.1, 1, 0.9, true, tabKillers ) guiGridListAddColumn ( killersScreenGridList, "#", 0.1 ) guiGridListAddColumn ( killersScreenGridList, "Nick", 0.5 ) guiGridListAddColumn ( killersScreenGridList, "Kills", 0.1 ) guiGridListAddColumn ( killersScreenGridList, "Deaths", 0.1 ) guiGridListAddColumn ( killersScreenGridList, "K/D Ratio", 0.1 ) tabZombies = guiCreateTab( "Top 50 zombie killers", tabs ) zombiesScreenGridList = guiCreateGridList ( 0, 0.1, 1, 0.9, true, tabZombies ) guiGridListAddColumn ( zombiesScreenGridList, "#", 0.2 ) guiGridListAddColumn ( zombiesScreenGridList, "Nick", 0.5 ) guiGridListAddColumn ( zombiesScreenGridList, "Zombies killed", 0.2 ) tabAlive = guiCreateTab( "Top 50 alive time", tabs ) aliveScreenGridList = guiCreateGridList ( 0, 0.1, 1, 0.9, true, tabAlive ) guiGridListAddColumn ( aliveScreenGridList, "#", 0.2 ) guiGridListAddColumn ( aliveScreenGridList, "Nick", 0.5 ) guiGridListAddColumn ( aliveScreenGridList, "Alive time", 0.2 ) killerTable = allKillers killerCounter = 1 for id, killer in pairs(killerTable) do local row = guiGridListAddRow ( killersScreenGridList) guiGridListSetItemText ( killersScreenGridList, row, 1, killerCounter, false, true ) guiGridListSetItemText ( killersScreenGridList, row, 2, killer.nick, false, false ) guiGridListSetItemText ( killersScreenGridList, row, 3, killer.kills, false, false ) guiGridListSetItemText ( killersScreenGridList, row, 4, killer.deaths, false, false ) guiGridListSetItemText ( killersScreenGridList, row, 5, toDecimals(killer.kd), false, true ) killerCounter = killerCounter +1 end end addEvent("Leaderboard:createGui", true) addEventHandler("Leaderboard:createGui", root, createGUI) function toDecimals(x) local digits = 2 local shift = 10 ^ digits local result = math.floor( x*shift + 0.5 ) / shift return result end function OnChange(selectedTab) if selectedTab == tabZombies then if openedZKillers == false then triggerServerEvent ( "ShowTopZKillers", localPlayer) openedZKillers = true end elseif selectedTab == tabAlive then if openedATime == false then triggerServerEvent ( "ShowTopATime", localPlayer) openedATime = true end end end addEventHandler("onClientGUITabSwitched", root, OnChange) function showZkillersC(data) killerTable = data killerCounter = 1 for id, killer in pairs(killerTable) do local row = guiGridListAddRow ( zombiesScreenGridList) guiGridListSetItemText ( zombiesScreenGridList, row, 1, killerCounter, false, true ) guiGridListSetItemText ( zombiesScreenGridList, row, 2, killer.nick, false, false ) guiGridListSetItemText ( zombiesScreenGridList, row, 3, killer.kills, false, true ) killerCounter = killerCounter +1 end end addEvent("Leaderboard:showZkillersC", true) addEventHandler("Leaderboard:showZkillersC", root, showZkillersC) function math.round(number, decimals, method) decimals = decimals or 0 local factor = 10 ^ decimals if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor else return tonumber(("%."..decimals.."f"):format(number)) end end function formatTimeFromMinutes(value) if value then local hours = math.floor(value/60) local minutes = math.round(((value/60) - math.floor(value/60))*100/(100/60)) if minutes < 10 then minutes = "0"..minutes end value = hours..":"..minutes return value end return false end function ShowTopATimeC(data) killerTable = data killerCounter = 1 for id, killer in pairs(killerTable) do local row = guiGridListAddRow ( aliveScreenGridList) guiGridListSetItemText ( aliveScreenGridList, row, 1, killerCounter, false, true ) guiGridListSetItemText ( aliveScreenGridList, row, 2, killer.nick, false, false ) guiGridListSetItemText ( aliveScreenGridList, row, 3, formatTimeFromMinutes(killer.alive), false, true ) killerCounter = killerCounter +1 end end addEvent("Leaderboard:ShowTopATimeC", true) addEventHandler("Leaderboard:ShowTopATimeC", root, ShowTopATimeC) addEventHandler("onClientMouseEnter",root,function() if source == closeBTN then playSFX("feet", 5, 2, false) guiSetProperty(closeBTN, "ImageColours", "tl:FF"..hl.."tr:FF"..hl.."bl:FF"..hl.."br:FF"..hl) end end) addEventHandler("onClientMouseLeave",root,function() if source == closeBTN then guiSetProperty(closeBTN, "ImageColours", "tl:FF"..hl2.."tr:FF"..hl2.."bl:FF"..hl2.."br:FF"..hl2) end end) function closeGUI() destroyElement(panel) showCursor(false) opened = false openedZKillers = false openedATime = false end function bind() if opened == false then showCursor(true) triggerServerEvent ( "ShowTopKillers", localPlayer) opened = true else closeGUI() end end bindKey (openKey, "down", bind)
return function(type, lexeme, literal, line) return setmetatable({ type = type, lexeme = lexeme, literal = literal, line = line }, { __tostring = function() return type .. ' ' .. lexeme .. ' ' .. (literal or '') end }) end
local present, lsp_signature = pcall(require, "lsp_signature") if not present then return end lsp_signature.setup { hint_enable = false, }
require 'Q/UTILS/lua/strict' local Q = require 'Q' local qmem = require 'Q/UTILS/lua/qmem' local chunk_size = qmem.chunk_size local tests = {} local function in_t1 (n) local x = Q.seq( {start = 0, by = 1, qtype = "I4", len = n} ) local y = Q.seq( {start = 1, by = 1, qtype = "I4", len = n} ) local z = Q.concat(x, y) local X = Q.split(z) assert(type(X) == "table") assert(#X == 2 ) local x1 = X[1] local y1 = X[2] assert(type(x1) == "lVector") assert(type(y1) == "lVector") x1:eval() assert(x:is_eov()) assert(y:is_eov()) assert(x1:fldtype() == x:fldtype()) assert(y1:fldtype() == y:fldtype()) assert(x1:length() == x:length()) assert(y1:length() == y:length()) local n1, n2 = Q.sum(Q.vveq(x, x1)):eval() assert(n1 == n2) assert(n1:to_num() == n) local n1, n2 = Q.sum(Q.vveq(y, y1)):eval() assert(n1 == n2) assert(n1:to_num() == n) print("Successfully completed t1") return true end tests.t1 = function() assert(in_t1(chunk_size - 1)) assert(in_t1(chunk_size + 1)) assert(in_t1(chunk_size + 1)) print("Successfully completed t1") end tests.t1() os.exit()
Locales['en'] = { ["ticket_expired"] = "Your ticket has expired.", ["time_left_count"] = "Time left %.2d:%.2d", ["player_left_arcade"] = "You left the gaming house, your ticket will not be accepted anymore.", ["need_to_buy_ticket"] = "I have to first buy a ticket !", ["open_ticket_menu"] = "press ~INPUT_CONTEXT~ to speak with the cool guy.", ["open_computer"] = "press ~INPUT_CONTEXT~ to open computer", ["not_enough_money"] = "Sadly, you dont have enough money.", ["bought_ticket"] = "You bought ticket %s, enjoy your time in arcade house. Dont forget that you got only: %s minutes left", ["bronz"] = "bronz", ["silver"] = "silver", ["gold"] = "gold", ["ticket_label"] = "ticket %s", ["ticket_menu"] = "Buy a ticket", ["computer_menu"] = "Computer menu", ["give_back_ticket"] = "Do you wish to return your ticket ?", ["yes"] = "yes", ["no"] = "no", }
local pi pi = math.pi do local _class_0 local _parent_0 = Item local _base_0 = { update = function(self, dt) self.psystem:update(dt) if input:pressed("attack") and not player.disableAttacking and self.canShoot then return self:shoot() end end, shoot = function(self) self.canShoot = true if input:down("attack") and not player.disableAttacking then self.canShoot = false local pos = player.pos + player.offset local ax, ay = input:get("attack") local attackDir = Vector(ax, ay) if attackDir * player.movementDir == 0 then attackDir = attackDir + (player.movementDir * 0.2) end attackDir = attackDir.normalized local arrowPos = pos + attackDir * 10 local arrow = Arrow(arrowPos, attackDir) dungeon.currentRoom.entities[arrow] = arrow return tick.delay(self.shoot, self, self.attackDelay) end end, draw = function(self) love.graphics.setColor(1, 1, 1) return love.graphics.draw(self.psystem, 0, 0) end } _base_0.__index = _base_0 setmetatable(_base_0, _parent_0.__base) _class_0 = setmetatable({ __init = function(self) _class_0.__parent.__init(self, sprites.bow) self.psystem = love.graphics.newParticleSystem(sprites.pixel.img, 32) self.fireRate = 10 self.attackDelay = 5 / self.fireRate self.canShoot = true do local _with_0 = self.psystem _with_0:setParticleLifetime(0.1, 0.1) _with_0:setSpeed(100) _with_0:setSpread(pi * 0.5) _with_0:setColors(1, 1, 1, 1) return _with_0 end end, __base = _base_0, __name = "Bow", __parent = _parent_0 }, { __index = function(cls, name) local val = rawget(_base_0, name) if val == nil then local parent = rawget(cls, "__parent") if parent then return parent[name] end else return val end end, __call = function(cls, ...) local _self_0 = setmetatable({}, _base_0) cls.__init(_self_0, ...) return _self_0 end }) _base_0.__class = _class_0 if _parent_0.__inherited then _parent_0.__inherited(_parent_0, _class_0) end Bow = _class_0 end
TRAILS = {} local function MAX (v1, v2) return (v1 > v2) and v1 or v2 end local function MAX_all (me, t) t = t or me for _, sub in ipairs(t) do if AST.is_node(sub) then me.trails_n = MAX(me.trails_n, sub.trails_n) end end end TRAILS.F = { Node__PRE = function (me) me.trails_n = 1 end, Node__POS = function (me) if not TRAILS.F[me.tag] then MAX_all(me) end if me.tag=='Code' and me[2].await then me.trails_n = me.trails_n + 1 -- TODO-NOW end end, Loop_Pool = function (me) local _, _, _, body = unpack(me) if me.yields then me.trails_n = body.trails_n + 1 end end, Pause_If = function (me) local _, body = unpack(me) me.trails_n = 1 + body.trails_n end, Async_Thread = function (me) local body = unpack(me) me.trails_n = 1 + body.trails_n end, If = function (me) local c, t, f = unpack(me) MAX_all(me, {t,f}) end, Par_And = 'Par', Par_Or = 'Par', Par = function (me) me.trails_n = 0 for _, sub in ipairs(me) do me.trails_n = me.trails_n + sub.trails_n end end, } AST.visit(TRAILS.F) ------------------------------------------------------------------------------- G = { ROOT__PRE = function (me) me.trails = { 0, me.trails_n-1 } -- [0, N] end, Code__PRE = 'ROOT__PRE', Node__PRE = function (me) if (not me.trails) and me.__par then me.trails = { unpack(me.__par.trails) } end -- TODO-NOW if me.tag == 'Block' then local Code = AST.get(AST.par(me,'Code'),'') if Code and Code[2].await and AST.get(Code,'',4,'Block')==me then me.trails[2] = me.trails[2] - 1 end end end, Loop_Pool__PRE = function (me) local _, _, _, body = unpack(me) body.trails = { unpack(me.trails) } if me.yields then body.trails[1] = body.trails[1] + 1 end end, Pause_If__PRE = function (me) local _,body = unpack(me) body.trails = { unpack(me.trails) } body.trails[1] = body.trails[1] + 1 end, Par_Or__PRE = 'Par__PRE', Par_And__PRE = 'Par__PRE', Par__PRE = function (me) for i, sub in ipairs(me) do sub.trails = {} if i == 1 then sub.trails[1] = me.trails[1] else local pre = me[i-1] sub.trails[1] = pre.trails[1] + pre.trails_n end sub.trails[2] = sub.trails[1] + sub.trails_n-1 end end, -- invert pool/finalize b/c finalize frees pool before last iteration __ok = false, Pool = function (me) local is_alias,_,_,dim = unpack(me) if (not dim.is_const) and (not is_alias) then TRAILS.F.__ok = true me.trails[1] = me.trails[1] + 1 me.trails[2] = me.trails[2] + 1 end end, Pool_Finalize = function (me) if TRAILS.F.__ok then TRAILS.F.__ok = false local fin = AST.par(me, 'Finalize_Case') fin.trails[1] = fin.trails[1] - 1 fin.trails[2] = fin.trails[2] - 1 end end, } AST.visit(G)
-- see \Factorio\data\base\prototypes\entity\entities.lua line 10459 local flangChipEntity = table.deepcopy(data.raw["constant-combinator"]["constant-combinator"]) flangChipEntity.name = "flang-chip" flangChipEntity.minable = {hardness = 0.2, mining_time = 0.5, result = "flang-chip"} flangChipEntity.max_health = 271 flangChipEntity.icon = "__Flang__/graphics/flangchip.png" flangChipEntity.item_slot_count = 100 local invisChipEntity = table.deepcopy(data.raw["programmable-speaker"]["programmable-speaker"]) invisChipEntity.name = "invis-flang-chip" invisChipEntity.minable = {hardness = 0, mining_time = 0, result = "invis-flang-chip"} invisChipEntity.max_health = 3 invisChipEntity.icon = "__Flang__/graphics/flangchip.png" invisChipEntity.item_slot_count = 100 invisChipEntity.selectable_in_game = false invisChipEntity.collision_mask = {"not-colliding-with-itself"} invisChipEntity.flags = {"player-creation", "not-repairable"} invisChipEntity.sprite = { layers = { { filename = "__Flang__/graphics/empty.png", priority = "extra-high", width = 30, height = 89, shift = util.by_pixel(-2, -39.5), hr_version = { filename = "__Flang__/graphics/empty.png", priority = "extra-high", width = 59, height = 178, shift = util.by_pixel(-2.25, -39.5), scale = 0.5 } }, { filename = "__Flang__/graphics/empty.png", priority = "extra-high", width = 119, height = 25, shift = util.by_pixel(52.5, -2.5), draw_as_shadow = true, hr_version = { filename = "__Flang__/graphics/empty.png", priority = "extra-high", width = 237, height = 50, shift = util.by_pixel(52.75, -3), draw_as_shadow = true, scale = 0.5 } } } } -- https://wiki.factorio.com/Types/Energy invisChipEntity.energy_usage = "150kW" -- https://wiki.factorio.com/Types/ElectricUsagePriority invisChipEntity.energy_source = { type = "electric", usage_priority = "primary-input", emissions = 0 } data:extend({flangChipEntity, invisChipEntity})
local Blues = {} Blues.blues_id = 1 function Blues.new(self, lib) local app = {} app.app_id = 1 app.bjson = lib.bjson app.request = lib.request app.router = lib.router app.router.req = lib.nginx:build_request("") app.get = function(self, url, callback) app:router(url, callback, "GET") end app.post = function(self, url, callback) app:router(url, callback, "POST") end app.run = function(self) fun = app.router:finder() if fun then --local content = fun(app) local content = fun(app.router) app:render(content) end end app.render= function(self, content) local rtype = type(content) if rtype == "table" then json = require "cjson" ngx.header['Content-Type'] = 'application/json; charset=utf-8' ngx.say(json.encode(content)) end if rtype == "string" then ngx.header['Content-Type'] = 'text/plain; charset=UTF-8' ngx.say(content) end end app.json = function(self) local jsondata= self.request.params.body local t = self.bjson.decode(jsondata) return t end return app end return Blues:new { nginx = require("nginx"), bjson = require("utils.bjson"), request = require("request"):getInstance(), router = require("route"):getInstance() }
require('areas') local far_shore = Area:new(90, 0) far_shore:set_custom_map_id("far_shore") far_shore:set_extra_description_sid("TILE_EXTRA_DESCRIPTION_FAR_SHORE") far_shore:insert()
local simplehttp = require'simplehttp' local util = require'util' local html2unicode = require'html' customHosts['snl.no'] = function(queue, info) local path = info.path if(path and path:match('/.*/.*')) then return false end if(path and path:match('/(.*)$')) then local artikkel = path:match('/(.*)$') local domain = info.host simplehttp( string.format('http://%s/%s.json', domain, artikkel), function(js, url, response) local data = util.json.decode(js) -- extract first paragraph local match = data.xhtml_body:match[[<p>(.-)</p>]] -- extract text from links local text = match:gsub('<a href=.->(.-)</a>', function(m) return m end) -- strip all html tags and convert html entities text = html2unicode(text:gsub('<.->', '')):gsub('%s+', ' ') queue:done(string.format('[%s] %s', util.bold(data.title), text)) end ) return true end end
function new(new) local c = new(5); local function expect_kv(key, value, actual_key, actual_value) assert_equal(key, actual_key, "key incorrect"); assert_equal(value, actual_value, "value incorrect"); end expect_kv(nil, nil, c:head()); expect_kv(nil, nil, c:tail()); assert_equal(c:count(), 0); c:set("one", 1) assert_equal(c:count(), 1); expect_kv("one", 1, c:head()); expect_kv("one", 1, c:tail()); c:set("two", 2) expect_kv("two", 2, c:head()); expect_kv("one", 1, c:tail()); c:set("three", 3) expect_kv("three", 3, c:head()); expect_kv("one", 1, c:tail()); c:set("four", 4) c:set("five", 5); assert_equal(c:count(), 5); expect_kv("five", 5, c:head()); expect_kv("one", 1, c:tail()); c:set("foo", nil); assert_equal(c:count(), 5); expect_kv("five", 5, c:head()); expect_kv("one", 1, c:tail()); assert_equal(c:get("one"), 1); expect_kv("five", 5, c:head()); expect_kv("one", 1, c:tail()); assert_equal(c:get("two"), 2); assert_equal(c:get("three"), 3); assert_equal(c:get("four"), 4); assert_equal(c:get("five"), 5); assert_equal(c:get("foo"), nil); assert_equal(c:get("bar"), nil); c:set("six", 6); assert_equal(c:count(), 5); expect_kv("six", 6, c:head()); expect_kv("two", 2, c:tail()); assert_equal(c:get("one"), nil); assert_equal(c:get("two"), 2); assert_equal(c:get("three"), 3); assert_equal(c:get("four"), 4); assert_equal(c:get("five"), 5); assert_equal(c:get("six"), 6); c:set("three", nil); assert_equal(c:count(), 4); assert_equal(c:get("one"), nil); assert_equal(c:get("two"), 2); assert_equal(c:get("three"), nil); assert_equal(c:get("four"), 4); assert_equal(c:get("five"), 5); assert_equal(c:get("six"), 6); c:set("seven", 7); assert_equal(c:count(), 5); assert_equal(c:get("one"), nil); assert_equal(c:get("two"), 2); assert_equal(c:get("three"), nil); assert_equal(c:get("four"), 4); assert_equal(c:get("five"), 5); assert_equal(c:get("six"), 6); assert_equal(c:get("seven"), 7); c:set("eight", 8); assert_equal(c:count(), 5); assert_equal(c:get("one"), nil); assert_equal(c:get("two"), nil); assert_equal(c:get("three"), nil); assert_equal(c:get("four"), 4); assert_equal(c:get("five"), 5); assert_equal(c:get("six"), 6); assert_equal(c:get("seven"), 7); assert_equal(c:get("eight"), 8); c:set("four", 4); assert_equal(c:count(), 5); assert_equal(c:get("one"), nil); assert_equal(c:get("two"), nil); assert_equal(c:get("three"), nil); assert_equal(c:get("four"), 4); assert_equal(c:get("five"), 5); assert_equal(c:get("six"), 6); assert_equal(c:get("seven"), 7); assert_equal(c:get("eight"), 8); c:set("nine", 9); assert_equal(c:count(), 5); assert_equal(c:get("one"), nil); assert_equal(c:get("two"), nil); assert_equal(c:get("three"), nil); assert_equal(c:get("four"), 4); assert_equal(c:get("five"), nil); assert_equal(c:get("six"), 6); assert_equal(c:get("seven"), 7); assert_equal(c:get("eight"), 8); assert_equal(c:get("nine"), 9); do local keys = { "nine", "four", "eight", "seven", "six" }; local values = { 9, 4, 8, 7, 6 }; local i = 0; for k, v in c:items() do i = i + 1; assert_equal(k, keys[i]); assert_equal(v, values[i]); end assert_equal(i, 5); c:set("four", "2+2"); assert_equal(c:count(), 5); assert_equal(c:get("one"), nil); assert_equal(c:get("two"), nil); assert_equal(c:get("three"), nil); assert_equal(c:get("four"), "2+2"); assert_equal(c:get("five"), nil); assert_equal(c:get("six"), 6); assert_equal(c:get("seven"), 7); assert_equal(c:get("eight"), 8); assert_equal(c:get("nine"), 9); end do local keys = { "four", "nine", "eight", "seven", "six" }; local values = { "2+2", 9, 8, 7, 6 }; local i = 0; for k, v in c:items() do i = i + 1; assert_equal(k, keys[i]); assert_equal(v, values[i]); end assert_equal(i, 5); c:set("foo", nil); assert_equal(c:count(), 5); assert_equal(c:get("one"), nil); assert_equal(c:get("two"), nil); assert_equal(c:get("three"), nil); assert_equal(c:get("four"), "2+2"); assert_equal(c:get("five"), nil); assert_equal(c:get("six"), 6); assert_equal(c:get("seven"), 7); assert_equal(c:get("eight"), 8); assert_equal(c:get("nine"), 9); end do local keys = { "four", "nine", "eight", "seven", "six" }; local values = { "2+2", 9, 8, 7, 6 }; local i = 0; for k, v in c:items() do i = i + 1; assert_equal(k, keys[i]); assert_equal(v, values[i]); end assert_equal(i, 5); c:set("four", nil); assert_equal(c:get("one"), nil); assert_equal(c:get("two"), nil); assert_equal(c:get("three"), nil); assert_equal(c:get("four"), nil); assert_equal(c:get("five"), nil); assert_equal(c:get("six"), 6); assert_equal(c:get("seven"), 7); assert_equal(c:get("eight"), 8); assert_equal(c:get("nine"), 9); end do local keys = { "nine", "eight", "seven", "six" }; local values = { 9, 8, 7, 6 }; local i = 0; for k, v in c:items() do i = i + 1; assert_equal(k, keys[i]); assert_equal(v, values[i]); end assert_equal(i, 4); end do local evicted_key, evicted_value; local c2 = new(3, function (_key, _value) evicted_key, evicted_value = _key, _value; end); local function set(k, v, should_evict_key, should_evict_value) evicted_key, evicted_value = nil, nil; c2:set(k, v); assert_equal(evicted_key, should_evict_key); assert_equal(evicted_value, should_evict_value); end set("a", 1) set("a", 1) set("a", 1) set("a", 1) set("a", 1) set("b", 2) set("c", 3) set("b", 2) set("d", 4, "a", 1) set("e", 5, "c", 3) end do local evicted_key, evicted_value; local c3 = new(1, function (_key, _value) evicted_key, evicted_value = _key, _value; if _key == "a" then -- Sanity check for what we're evicting assert_equal(_key, "a"); assert_equal(_value, 1); -- We're going to block eviction of this key/value, so set to nil... evicted_key, evicted_value = nil, nil; -- Returning false to block eviction return false end end); local function set(k, v, should_evict_key, should_evict_value) evicted_key, evicted_value = nil, nil; local ret = c3:set(k, v); assert_equal(evicted_key, should_evict_key); assert_equal(evicted_value, should_evict_value); return ret; end set("a", 1) set("a", 1) set("a", 1) set("a", 1) set("a", 1) -- Our on_evict prevents "a" from being evicted, causing this to fail... assert_equal(set("b", 2), false, "Failed to prevent eviction, or signal result"); expect_kv("a", 1, c3:head()); expect_kv("a", 1, c3:tail()); -- Check the final state is what we expect assert_equal(c3:get("a"), 1); assert_equal(c3:get("b"), nil); assert_equal(c3:count(), 1); end local c4 = new(3, false); assert_equal(c4:set("a", 1), true); assert_equal(c4:set("a", 1), true); assert_equal(c4:set("a", 1), true); assert_equal(c4:set("a", 1), true); assert_equal(c4:set("b", 2), true); assert_equal(c4:set("c", 3), true); assert_equal(c4:set("d", 4), false); assert_equal(c4:set("d", 4), false); assert_equal(c4:set("d", 4), false); expect_kv("c", 3, c4:head()); expect_kv("a", 1, c4:tail()); local c5 = new(3, function (k, v) if k == "a" then return nil; elseif k == "b" then return true; end return false; end); assert_equal(c5:set("a", 1), true); assert_equal(c5:set("a", 1), true); assert_equal(c5:set("a", 1), true); assert_equal(c5:set("a", 1), true); assert_equal(c5:set("b", 2), true); assert_equal(c5:set("c", 3), true); assert_equal(c5:set("d", 4), true); -- "a" evicted (cb returned nil) assert_equal(c5:set("d", 4), true); -- nop assert_equal(c5:set("d", 4), true); -- nop assert_equal(c5:set("e", 5), true); -- "b" evicted (cb returned true) assert_equal(c5:set("f", 6), false); -- "c" won't evict (cb returned false) expect_kv("e", 5, c5:head()); expect_kv("c", 3, c5:tail()); end
-- A 5v5 team battle stage. -- -- Sample ships that support team play: Chaser, RandomBot, and WallHugger. require "battlestage" function configure(stageBuilder) stageBuilder:setSize(2400, 1600) stageBuilder:setBattleMode(true) stageBuilder:addWall(250, 200, 100, 100) stageBuilder:addWall(2150, 200, 100, 100) stageBuilder:addWall(250, 1300, 100, 100) stageBuilder:addWall(2150, 1300, 100, 100) stageBuilder:addWall(1150, 750, 100, 100) stageBuilder:setTeamSize(5) end ships = nil world = nil admin = nil function init(shipsArg, worldArg, adminArg) ships = shipsArg world = worldArg admin = adminArg end function run(stageSensors) battlestage.basicScoring(ships, world, admin) end
module 'mock_edit' -- CLASS: ProtoManager () -- function ProtoManager:__init() -- connectGlobalSignalFunc( 'scene.post_deserialize', self, 'postSceneDeserialize' ) -- connectGlobalSignalFunc( 'scene.post_serialize', self, 'postSceneSerialize' ) -- end -- function ProtoManager:extractProtoData( info, scnData ) -- end -- function ProtoManager:postSceneDeserialize( scn, scnData, objMap ) -- local instanceOverrideTable = {} -- scn.__instanceOverrided = instanceOverrideTable -- end -- function ProtoManager:preSceneSerialize( scn, scnData ) -- --extract proto scnData and -- self:extractAllProtoData( scnData ) -- end -- local _protoManager = ProtoManager() -- function ProtoManager.get() -- return _protoManager -- end
object_draft_schematic_armor_pvp_spec_ops_imperial_armor_dye_kit = object_draft_schematic_armor_shared_pvp_spec_ops_imperial_armor_dye_kit:new { } ObjectTemplates:addTemplate(object_draft_schematic_armor_pvp_spec_ops_imperial_armor_dye_kit, "object/draft_schematic/armor/pvp_spec_ops_imperial_armor_dye_kit.iff")
sptbl["fmpair"] = { files = { module = "fmpair.c", header = "fmpair.h", example = "ex_fmpair.c", }, func = { create = "sp_fmpair_create", destroy = "sp_fmpair_destroy", init = "sp_fmpair_init", compute = "sp_fmpair_compute", }, params = { mandatory = { { name = "tbl", type = "sp_ftbl *", description = "Wavetable to read from. Note: the size of this table must be a power of 2.", default = "N/A" }, }, optional = { { name = "freq", type = "SPFLOAT", description = "Frequency (in Hz)", default = 440 }, { name = "amp", type = "SPFLOAT", description ="Amplitude (typically a value between 0 and 1).", default = 0.4 }, { name = "car", type = "SPFLOAT", description ="Carrier frequency, expressed as a ratio number in C:M ratio. Typically an integer.", default = 1 }, { name = "mod", type = "SPFLOAT", description ="Modulator frequency, expressed as a ratio number in C:M ratio. Typically an integer.", default = 1 }, { name = "indx", type = "SPFLOAT", description ="Modulation index. Most commercial synthesizers have a range from 0-8, but there's nothing stopping you from going beyond that.", default = 8 }, } }, modtype = "module", description = [[FM oscilator pair with linear interpolation]], ninputs = 0, noutputs = 1, inputs = { { name = "dummy", description = "This does nothing." }, }, outputs = { { name = "out", description = "Signal out." }, } }
--logfile=io.open(getWorkingFolder().."\\LuaIndicators\\priceProfile_log.txt", "w") require("StaticVar") Settings ={ Name = "*priceProfile", shift = 150, ChartId = "Sheet11" } lines = 150 min_price_step = 1 scale = 2 function Init() Settings.line = {} for i = 1, lines do Settings.line[i] = {} Settings.line[i] = {Color = RGB(185, 185, 185), Type = TYPE_LINE, Width = 2} end algoF = getResults() return lines end function OnCalculate(index) if index == 1 then DSInfo = getDataSourceInfo() min_price_step = getParamEx(DSInfo.class_code, DSInfo.sec_code, "SEC_PRICE_STEP").param_value scale = getSecurityInfo(DSInfo.class_code, DSInfo.sec_code).scale end return algoF(index, Settings) end function getResults() local outlines = {} local priceProfile = {} local calculated_buffer={} return function(index, Fsettings) local shift = Fsettings.shift or 150 local bars = 50 if index == 1 then calculated_buffer = {} outlines = {} return nil end if index == Size() then stv.UseNameSpace(Fsettings.ChartId) algoResults = stv.GetVar('priceProfile') priceProfile = {} if algoResults ~= nil and type(algoResults) == "table" and calculated_buffer[index] == nil then -- --WriteLog("ChartId "..tostring(Settings.ChartId).." algoResults "..tostring(algoResults).." "..tostring(type(algoResults))) --WriteLog('----------------------') --WriteLog('index '..tostring(index)) for i=1,#outlines do --WriteLog('line '..tostring(i).." price "..tostring(GetValue(index-shift-1, i)).." - "..tostring(GetValue(outlines[i].index, i)).." vol "..tostring(outlines[i].index-index+151)) SetValue(index-shift-1, i, nil) SetValue(index-shift, i, nil) SetValue(outlines[i].index, i, nil) outlines[i].index = index-shift outlines[i].val = nil end local MAXV = 0 local maxPrice = 0 --local maxPrice = 0 --local minPrice = H(index) local maxCount = 0 for i, profileItem in pairs(algoResults) do MAXV=math.max(MAXV,profileItem.vol) if MAXV == profileItem.vol then maxPrice=profileItem.price end --maxPrice=math.max(maxPrice,profileItem.price) --minPrice=math.max(minPrice,profileItem.price) maxCount = maxCount + 1 priceProfile[maxCount] = {price = profileItem.price, vol = profileItem.vol} end if maxPrice == 0 then maxPrice = O(index) end table.sort(priceProfile, function(a,b) return (a['vol'] or 0) > (b['vol'] or 0) end) --WriteLog('maxV '..tostring(MAXV)..' tblMax '..tostring(priceProfile[1].vol)) --WriteLog('new set') --local clasterStep = math.floor((maxPrice - minPrice)*lines) --local profileLines = #priceProfile for i=1,lines do outlines[i] = {index = index-shift+bars, val = maxPrice} if priceProfile[i]~=nil then --if profileLines>lines then -- priceProfile[i].price = math.floor(priceProfile[i].price/clasterStep)*clasterStep --end priceProfile[i].vol=math.floor(priceProfile[i].vol/MAXV*bars) if priceProfile[i].vol>0 then outlines[i].index = index-shift+priceProfile[i].vol outlines[i].val = priceProfile[i].price end end SetValue(index-shift, i, outlines[i].val) SetValue(outlines[i].index, i, outlines[i].val) --WriteLog('line '..tostring(i).." price "..tostring(GetValue(index-shift, i)).." - "..tostring(GetValue(outlines[i].index, i)).." vol "..tostring(outlines[i].index-index+shift)) end calculated_buffer[index] = true --stv.SetVar('priceProfile', nil) end end return nil end end function WriteLog(text) logfile:write(tostring(os.date("%c",os.time())).." "..text.."\n"); logfile:flush(); LASTLOGSTRING = text; end
--- Clip characters locally on the client of other clients so they don't interfer with physics. -- @classmod ClipCharacters local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore")) local PhysicsService = game:GetService("PhysicsService") local Players = game:GetService("Players") local Maid = require("Maid") local ClipCharacters = {} ClipCharacters.ClassName = "ClipCharacters" ClipCharacters.__index = ClipCharacters ClipCharacters.CollisionGroupName = "ClipCharacters" --- Initialize on server -- @constructor -- @treturn nil function ClipCharacters.initServer() local GroupId = PhysicsService:CreateCollisionGroup(ClipCharacters.CollisionGroupName) PhysicsService:CollisionGroupSetCollidable(ClipCharacters.CollisionGroupName, "Default", false) local RemoteFunction = require.GetRemoteFunction("GetClipCharactersId") function RemoteFunction.OnServerInvoke(Player) return GroupId end end --- Initialize clipping on the client. Returns a new inst -- @constructor -- @treturn ClipCharacters function ClipCharacters.new() local self = setmetatable({}, ClipCharacters) self.RemoteFunction = require.GetRemoteFunction("GetClipCharactersId") self.Maid = Maid.new() self:BindUpdatesYielding() return self end function ClipCharacters:_onDescendantAdded(OriginalTable, Descendant) if not OriginalTable[Descendant] and Descendant:IsA("BasePart") then OriginalTable[Descendant] = Descendant.CollisionGroupId Descendant.CollisionGroupId = self.CollisionGroupId end end function ClipCharacters:_onDescendantRemoving(OriginalTable, Descendant) if OriginalTable[Descendant] then Descendant.CollisionGroupId = OriginalTable[Descendant] OriginalTable[Descendant] = nil end end function ClipCharacters:_onCharacterAdd(PlayerMaid, Character) local maid = Maid.new() local OriginalTable = {} maid:GiveTask(Character.DescendantAdded:Connect(function(Descendant) self:_onDescendantAdded(OriginalTable, Descendant) end)) maid:GiveTask(Character.DescendantRemoving:Connect(function(Descendant) self:_onDescendantRemoving(OriginalTable, Descendant) end)) -- Cleanup maid:GiveTask(function() for Descendant, _ in pairs(OriginalTable) do self:_onDescendantRemoving(OriginalTable, Descendant) end end) -- Initialize for _, Descendant in pairs(Character:GetDescendants()) do self:_onDescendantAdded(OriginalTable, Descendant) end PlayerMaid.CharacterMaid = maid end function ClipCharacters:_onPlayerAdded(Player) if Player == Players.LocalPlayer then return end local maid = Maid.new() maid:GiveTask(Player.CharacterAdded:Connect(function(Character) self:_onCharacterAdd(maid, Character) end)) if Player.Character then self:_onCharacterAdd(maid, Player.Character) end self.Maid[Player] = maid end function ClipCharacters:BindUpdatesYielding() self.CollisionGroupId = self.RemoteFunction:InvokeServer() if not self.CollisionGroupId then warn("[ClipCharacters] - No self.CollisionGroupId") end for _, Player in pairs(Players:GetPlayers()) do self:_onPlayerAdded(Player) end self.Maid:GiveTask(Players.PlayerAdded:Connect(function(Player) self:_onPlayerAdded(Player) end)) self.Maid:GiveTask(Players.PlayerRemoving:Connect(function(Player) self.Maid[Player] = nil end)) end --- Stop clipping on client -- @treturn nil function ClipCharacters:Destroy() self.Maid:DoCleaning() self.Maid = nil setmetatable({}, nil) end return ClipCharacters
local Keyboard = { pressed = {}, released = {}, down = {}, downTime = {}, } Keyboard.__index = Keyboard function Keyboard.new() local self = setmetatable({}, Keyboard) self.last = nil self.lastChar = nil return self end function Keyboard:lastKeyPressed() return self.last end function Keyboard:keyPressed(key) self.pressed[key] = true self.down[key] = true self.downTime[key] = os.time() self.last = key end function Keyboard:keyReleased(key) self.released[key] = true self.down[key] = false self.downTime[key] = nil if self.last == key then self.last = nil end end function Keyboard:isPressed(key) return self.pressed[key] or false end function Keyboard:isDown(key) return self.down[key] or false end function Keyboard:isDownMoreThan(key,sec) if self.downTime[key] == nil then return false end return (os.time() - self.downTime[key]) >= sec end function Keyboard:isReleased(key) return self.released[key] or false end function Keyboard:reset() for key, value in pairs(self.pressed) do self.pressed[key] = false end for key, value in pairs(self.released) do self.released[key] = false end self.last = nil end return Keyboard:new()
function switch(array) local s = {} s.integer = array[1]; s.cases = array.case; if array.case[s.integer] then array.case[s.integer](); else array.default(); end collectgarbage("collect"); return s end return switch
-- -- Created by IntelliJ IDEA. -- User: cenk -- Date: 11.01.2017 -- Time: 19:41 -- To change this template use File | Settings | File Templates. -- require 'nn' require 'torch' require 'dpnn' require 'optim' require 'image' require 'torchx' require 'optim' require 'xlua' require 'cunn' paths.dofile('../../training/torch-TripletEmbedding/TripletEmbedding.lua') torch.setdefaulttensortype("torch.FloatTensor") a = torch.rand(10, 1, 48, 48) local SpatialConvolution = nn.SpatialConvolutionMM --lib[1] local SpatialMaxPooling = nn.SpatialMaxPooling --lib[2] local net = nn.Sequential() print(a:size()) net:add(SpatialConvolution(1, 64, 11, 11, 4, 4, 2, 2)) -- 224 -> 55 print(net:forward(a):size()) net:add(nn.ReLU(true)) net:add(nn.SpatialBatchNormalization(64)) print(net:forward(a):size()) net:add(SpatialMaxPooling(3, 3, 2, 2)) -- 55 -> 27 print(net:forward(a):size()) net:add(SpatialConvolution(64, 192, 5, 5, 1, 1, 2, 2)) -- 27 -> 27 print(net:forward(a):size()) net:add(nn.ReLU(true)) net:add(nn.SpatialBatchNormalization(192)) print(net:forward(a):size()) net:add(SpatialMaxPooling(3, 3, 2, 2)) -- 27 -> 13 print(net:forward(a):size()) net:add(SpatialConvolution(192, 384, 3, 3, 1, 1, 1, 1)) -- 13 -> 13 print(net:forward(a):size()) net:add(nn.ReLU(true)) net:add(nn.SpatialBatchNormalization(384)) print(net:forward(a):size()) net:add(SpatialConvolution(384, 256, 3, 3, 1, 1, 1, 1)) -- 13 -> 13 print(net:forward(a):size()) net:add(nn.ReLU(true)) net:add(nn.SpatialBatchNormalization(256)) print(net:forward(a):size()) net:add(SpatialConvolution(256, 256, 3, 3, 1, 1, 1, 1)) -- 13 -> 13 print(net:forward(a):size()) net:add(nn.ReLU(true)) net:add(nn.SpatialBatchNormalization(256)) print(net:forward(a):size(),"Here") net:add(SpatialMaxPooling(2, 2, 1,1)) -- 13 -> 6 print(net:forward(a):size(),"Here") net:add(nn.View(256 * 1 * 1)) --Changed print(net:forward(a):size()) net:add(nn.Dropout(0.5)) print(net:forward(a):size()) net:add(nn.Linear(256 * 1 * 1, 4096)) --Changed net:add(nn.ReLU(true)) net:add(nn.BatchNormalization(4096)) print(net:forward(a):size()) net:add(nn.Threshold(0, 1e-6)) print(net:forward(a):size()) net:add(nn.Dropout(0.5)) print(net:forward(a):size()) net:add(nn.Linear(4096, 4096), "net:add(nn.Dropout(0.5))") net:add(nn.ReLU(true)) net:add(nn.BatchNormalization(4096)) print(net:forward(a):size()) net:add(nn.Threshold(0, 1e-6)) print(net:forward(a):size()) net:add(nn.Linear(4096, 128)) print(net:forward(a):size()) net:add(nn.Normalize(2)) print(net:forward(a):size())
-- -- lua-Spore : <https://fperrad.frama.io/lua-Spore> -- local pairs = pairs local tonumber = tonumber local upper = require'string'.upper local checktype = require 'Spore'.checktype local new_from_lua = require 'Spore'.new_from_lua local slurp = require 'Spore.Protocols'.slurp local decode = require 'json'.decode local yaml_eval = require 'yaml'.eval local m = {} m.spore = '1.0' local ops = { get = true, put = true, post = true, delete = true, options = true, head = true, patch = true, } local function convert (doc, tag) local spore = { name = doc.info.title, version = doc.info.version, methods = {}, authentication = doc.security and true or nil, } local description if tag and doc.tags then for i = 1, #doc.tags do local item = doc.tags[i] if item.name == tag then description = item.description break end end end spore.description = description or doc.info.description if doc.host and doc.basePath and doc.schemes and doc.schemes[1] then spore.base_url = doc.schemes[1] .. '://' .. doc.host .. doc.basePath end local function populate (paths) for path, methods in pairs(paths) do for op, meth in pairs(methods) do if ops[op] then local found if tag and meth.tags then for i = 1, #meth.tags do if tag == meth.tags[i] then found = true break end end end if found or not tag then local required_payload, optional_payload local required_params, optional_params local headers, form_data local function aggregate_param (param) if param['in'] == 'body' then if param.required then required_payload = true else optional_payload = true end else local name = param.name if param.required then if not required_params then required_params = {} end required_params[#required_params+1] = name else if not optional_params then optional_params = {} end optional_params[#optional_params+1] = name end if param['in'] == 'header' then if not headers then headers = {} end headers[name] = ':' .. name elseif param['in'] == 'formData' then if not form_data then form_data = {} end form_data[name] = ':' .. name end end end -- aggregate_param if methods.parameters then for i = 1, #methods.parameters do aggregate_param(methods.parameters[i]) end end if meth.parameters then for i = 1, #meth.parameters do aggregate_param(meth.parameters[i]) end end if meth.requestBody then required_payload = true end local expected_status if not meth.responses.default then expected_status = {} for status in pairs(meth.responses) do expected_status[#expected_status+1] = tonumber(status) end end spore.methods[path .. ':' .. op] = { method = upper(op), path = path, headers = headers, ['form-data'] = form_data, required_params = required_params, optional_params = optional_params, required_payload = required_payload, optional_payload = optional_payload, expected_status = expected_status, deprecated = meth.deprecated, authentication = meth.security and true or nil, summary = meth.summary, description = meth.description, responses = meth.responses, request_body = meth.requestBody, } end end end end end -- populate populate(doc.paths) return spore end m.convert = convert function m.new_from_open_api (api, opts, tag) opts = opts or {} checktype('new_from_open_api', 1, api, 'string') checktype('new_from_open_api', 2, opts, 'table') checktype('new_from_open_api', 3, tag or '', 'string') local content = slurp(api) if api:sub(-5) == '.yaml' then content = content:gsub('\r\n', '\n') while content:find('\n\n') do content = content:gsub('\n\n', '\n') end content = yaml_eval(content) else content = decode(content) end local converted_content = convert(content, tag) return new_from_lua(converted_content, opts), converted_content, content end return m -- -- Copyright (c) 2016-2018 Francois Perrad -- -- This library is licensed under the terms of the MIT/X11 license, -- like Lua itself. --
--[[ Copyright 2020 Matthew Hesketh <matthew@matthewhesketh.com> This code is licensed under the MIT. See LICENSE for details. ]] local addrule = {} local mattata = require('mattata') function addrule:init() addrule.commands = mattata.commands(self.info.username):command('addrule').table addrule.help = '/addrule <text> - Allows you to add another group rule!' end function addrule.on_message(_, message, _, language) if message.chat.type == 'private' then return false end if not mattata.is_group_admin(message.chat.id, message.from.id) then return mattata.send_reply(message, language.errors.admin) end local input = mattata.input(message.text) if not input then return mattata.send_reply(message, language['addrule']['1']) end local rules = mattata.get_value(message.chat.id, 'rules') if not rules then return mattata.send_reply(message, language['addrule']['2']) end local new_rules = rules .. '\n' .. input local success = mattata.send_message(message.chat.id, new_rules, 'markdown') if not success and utf8.len(new_rules) > 4096 then return mattata.send_reply(message, language['addrule']['3']) elseif not success then return mattata.send_reply(message, language['addrule']['4']) end mattata.set_value(message.chat.id, 'rules', new_rules) return mattata.edit_message_text(message.chat.id, success.result.message_id, language['addrule']['5']) end return addrule
application = { content = { width = 800, height = 1280, scale = "letterbox", -- scale = "none", -- scale = "letterbox", -- scale = "zoomStretch", }, }
Array = nil Set = nil do local arr_metamethods = { __index = function(t, k) if type(k) == "number" then return t.table[k] end if k == 'length' then return #t.table end return rawget(t,k) end, __newindex = function(t, k, v) if type(k) == "number" then t.table[k] = v end end, __tostring = function(t) local str = '' for i,v in ipairs(t.table) do str = str .. tostring(v) if i ~= #t.table then str = str .. "," end end return str end } local arr_methods = { table = {}, shift = function(self, ...) for i,v in ipairs({...}) do table.insert(self.table, 1, v) end end, push = function(self, ...) for i,v in ipairs({...}) do table.insert(self.table, v) end end, pop = function(self) local last = self.table[#self.table] self.table[#self.table] = nil return last end, remove = function(self, start, amt) amt = amt or 1 local off = 0 local new_arr = {} for i = 1,self.length do if i >= start and i < start + amt then off = off + 1 else new_arr[i-off] = self.table[i] end end self.table = new_arr end, copy = function(self) local ret = Array.from(copy(self.table)) return ret end, includes = function(self, v) for i = 1,self.length do if self.table[i] == v then return true end end return false end, fill = function(self, v, s, e) s = s or 1 e = e or self.length for i = s, e do self.table[i] = v end end, indexOf = function(self, v) for i = 1, self.length do if self.table[i] == v then return i end end return 0 end, forEach = function(self, fn) for i = 1, self.length do if fn(self.table[i], i) == true then break end end end, map = function(self, fn) for i = 1, self.length do self.table[i] = fn(self.table[i], i) end return self end, filter = function(self, fn) local new_arr = {} for i = 1, self.length do if fn(self.table[i], i) then table.insert(new_arr, self.table[i]) end end self.table = new_arr return self end, reverse = function(self) local new_arr = {} for i = self.length, 1, -1 do table.insert(new_arr, self.table[i]) end self.table = new_arr return self end, join = function(self, sep) local str = '' for i = 1, self.length do str = str .. tostring(self.table[i]) if i ~= self.length then str = str .. tostring(sep) end end return str end, concat = function(self, ...) for i,v in ipairs({...}) do if type(v) == 'table' then for i,v2 in ipairs(v) do self:push(v2) end else self:push(v) end end end, some = function(self, fn) for i = 1, self.length do if fn(self.table[i], i) == true then return true end end return false end, every = function(self, fn) for i = 1, self.length do if fn(self.table[i], i) == false then return false end end return true end, sort = function(self, ...) table.sort(self.table, ...) end, shuffle = function(self) local tbl = {} local t = self.table for i = 1, #t do tbl[i] = t[i] end for i = #tbl, 2, -1 do local j = math.random(i) tbl[i], tbl[j] = tbl[j], tbl[i] end self.table = tbl end, sort = function(self, fn) table.sort(self.table, fn) end, random = function(self) return table.random(self.table) end --reduce } Array = setmetatable({ from = function(t) return Array(unpack(t)) end },{ __call = function(t, ...) local arr = setmetatable(copy(arr_methods), copy(arr_metamethods)) for i,v in ipairs({...}) do arr:push(v) end return arr end }) local set_methods = copy(arr_methods) set_methods.push = function(self, ...) for i,v in ipairs({...}) do if not self:includes(v) then table.insert(self.table, v) end end end set_methods.copy = function(self) local ret = Set.from(copy(self.table)) return ret end local set_metamethods = copy(arr_metamethods) set_metamethods.__index = function(t,k) if k == 'push' or k == 'copy' then return rawget(t,k) else return arr_metamethods.__index(t,k) end end Set = setmetatable({ from = function(t) return Set(unpack(t)) end },{ __call = function(t, ...) local set = setmetatable(copy(set_methods), copy(set_metamethods)) for i,v in ipairs({...}) do set:push(v) end return set end }) end