content
stringlengths 5
1.05M
|
|---|
local manners = require 'manners'
local doc, link, deflink = manners.doc, manners.link, manners.deflink
local M = doc({},[[
A small utility library to create typed documentation objects.
Not very useful on its own but `manners.docgen.*` uses it to determine formatting and such.
The formats have a few conventions, however:
- __tostring should be defined and return something readable on a terminal, so as not to break interactive help
- :render(iofile) TODO
- :render_links_to(iofile) TODO
- :render_links_from(iofile) TODO]], 'manners.doctypes')
return M
|
--- Kong helper methods to send HTTP responses to clients.
-- Can be used in the proxy, plugins or admin API.
-- Most used status codes and responses are implemented as helper methods.
--
-- @author thibaultcha
-- Define the most used HTTP status codes through Kong
local _M = {
status_codes = {
HTTP_OK = 200,
HTTP_CREATED = 201,
HTTP_NO_CONTENT = 204,
HTTP_BAD_REQUEST = 400,
HTTP_UNAUTHORIZED = 401,
HTTP_FORBIDDEN = 403,
HTTP_NOT_FOUND = 404,
HTTP_METHOD_NOT_ALLOWED = 405,
HTTP_CONFLICT = 409,
HTTP_UNSUPPORTED_MEDIA_TYPE = 415,
HTTP_INTERNAL_SERVER_ERROR = 500
}
}
-- Define some rules that will ALWAYS be applied to some status codes.
-- Ex: 204 must not have content, but if 404 has no content then "Not found" will be set.
local response_default_content = {
[_M.status_codes.HTTP_UNAUTHORIZED] = function(content)
return content or "Unauthorized"
end,
[_M.status_codes.HTTP_NO_CONTENT] = function(content)
return nil
end,
[_M.status_codes.HTTP_NOT_FOUND] = function(content)
return content or "Not found"
end,
[_M.status_codes.HTTP_INTERNAL_SERVER_ERROR] = function(content)
return "An unexpected error occurred"
end,
[_M.status_codes.HTTP_METHOD_NOT_ALLOWED] = function(content)
return "Method not allowed"
end
}
-- Return a closure which will be usable to respond with a certain status code.
-- @param `status_code` The status for which to define a function
--
-- Send a JSON response for the closure's status code with the given content.
-- If the content happens to be an error (>500), it will be logged by ngx.log as an ERR.
-- @see http://wiki.nginx.org/HttpLuaModule
-- @param `content` (Optional) The content to send as a response.
-- @param `raw` (Optional) A boolean defining if the `content` should not be serialized to JSON
-- This useed to send text as JSON in some edge-cases of cjson.
-- @return `ngx.exit()`
local function send_response(status_code)
local constants = require "kong.constants"
local cjson = require "cjson"
return function(content, raw, headers)
if status_code >= _M.status_codes.HTTP_INTERNAL_SERVER_ERROR then
if content then
ngx.log(ngx.ERR, tostring(content))
end
ngx.ctx.stop_phases = true -- interrupt other phases of this request
end
ngx.status = status_code
ngx.header["Content-Type"] = "application/json; charset=utf-8"
ngx.header["Server"] = constants.NAME.."/"..constants.VERSION
if headers then
for k, v in pairs(headers) do
ngx.header[k] = v
end
end
if type(response_default_content[status_code]) == "function" then
content = response_default_content[status_code](content)
end
if raw then
-- When we want to send an empty array, such as "{\"data\":[]}"
-- cjson has a flaw and encodes a Lua `{}` as a JSON `{}`.
-- This allows to send plain string JSON as "[]".
ngx.say(content)
elseif (type(content) == "table") then
ngx.say(cjson.encode(content))
elseif content then
ngx.say(cjson.encode({ message = content }))
end
return ngx.exit(status_code)
end
end
-- Generate sugar methods (closures) for the most used HTTP status codes.
for status_code_name, status_code in pairs(_M.status_codes) do
_M["send_"..status_code_name] = send_response(status_code)
end
local closure_cache = {}
-- Sends any status code as a response. This is useful for plugins which want to
-- send a response when the status code is not defined in `_M.status_codes` and thus
-- has no sugar method on `_M`.
function _M.send(status_code, content, raw, headers)
local res = closure_cache[status_code]
if not res then
res = send_response(status_code)
closure_cache[status_code] = res
end
return res(content, raw, headers)
end
return _M
|
local raw = require "raw"
local fs = require "filesystem"
local type = require "class"
local json = {}
------------------------------------------------------------------ utils
local controls = {["\n"]="\\n", ["\r"]="\\r", ["\t"]="\\t", ["\b"]="\\b", ["\f"]="\\f", ["\""]="\\\"", ["\\"]="\\\\"}
local function isArray(t)
local max = 0
for k,v in raw.pairs(t) do
if type(k) ~= "number" then
return false
elseif k > max then
max = k
end
end
return max == #t
end
local whites = {['\n']=true; ['\r']=true; ['\t']=true; [' ']=true; [',']=true; [':']=true}
local function removeWhite(str)
while whites[str:sub(1, 1)] do
str = str:sub(2)
end
return str
end
------------------------------------------------------------------ encoding
json.encoders = {}
json.commonEncoders = {}
local encoders, commenEncoders = json.encoders, json.commonEncoders
local encodeCommon
local function tab(str, tabLevel, s)
return str .. ("\t"):rep(tabLevel) .. s
end
json.tab = tab
local function arrEncoding(val, pretty, tabLevel, tTracking, isarray, ignoreKeys)
local str = isarray and "[" or "{"
if pretty then
str = str .. "\n"
tabLevel = tabLevel + 1
end
local iterator = isarray and raw.ipairs or raw.pairs
for k, v in iterator(val) do -- TODO
if not ignoreKeys or not ignoreKeys[k] then
assert(type(k) == "string", "JSON object keys must be strings")
str = tab(str, tabLevel, (isarray and encodeCommon(v, pretty, tabLevel, tTracking) or encodeCommon(k, pretty, tabLevel, tTracking)..(pretty and ": " or ":")..encodeCommon(v, pretty, tabLevel, tTracking))..(pretty and ",\n" or ","))
end
end
if pretty then
tabLevel = tabLevel - 1
end
if str:sub(-2) == ",\n" then
str = str:sub(1, -3) .. "\n"
elseif str:sub(-1) == "," then
str = str:sub(1, -2)
end
return tab(str, tabLevel, isarray and "]" or "}")
end
json.arrEncoding = arrEncoding
function encoders.table(val, pretty, tabLevel, tTracking, isarray, ignoreKey)
assert(not tTracking[val], "Cannot encode a table holding itself recursively")
tTracking[val] = true
local array
if isarray ~= nil then
array = isarray
else
array = isArray(val)
end
return arrEncoding(val, pretty, tabLevel, tTracking, array, ignoreKey)
end
function encoders.string(val)
return '"'..val:gsub("[%c\"\\]", controls)..'"'
end
function encoders.number(val)
return tostring(val)
end
encoders.boolean = encoders.number
function encodeCommon(val, pretty, tabLevel, tTracking)
local str = ""
local valType = type(val)
local encoder = encoders[valType]
if encoder then
return str..encoder(val, pretty, tabLevel, tTracking)
end
for i, cEncoder in raw.ipairs(commenEncoders) do
local encoded = cEncoder(valType, val, pretty, tabLevel, tTracking)
if encoded then
return str..encoded
end
end
error("No JSON support for type '"..tostring(valType).."'")
end
json.encodeCommon = encodeCommon
function json.encode(val)
return encodeCommon(val, false, 0, {})
end
function json.encodePretty(val)
return encodeCommon(val, true, 0, {})
end
------------------------------------------------------------------ decoding
local decodeControls = {}
for k,v in raw.pairs(controls) do
decodeControls[v] = k
end
local parseValue, parseMember
json.commonDecoders = {}
local commonDecoders = json.commonDecoders
local function parseBoolean(str)
if str:sub(1, 4) == "true" then
return true, removeWhite(str:sub(5))
else
return false, removeWhite(str:sub(6))
end
end
local function parseNull(str)
return nil, removeWhite(str:sub(5))
end
local numChars = {['e']=true; ['E']=true; ['+']=true; ['-']=true; ['.']=true}
local function parseNumber(str)
local i = 1
while numChars[str:sub(i, i)] or tonumber(str:sub(i, i)) do
i = i + 1
end
local val = tonumber(str:sub(1, i - 1))
str = removeWhite(str:sub(i))
return val, str
end
local function parseString(str)
str = str:sub(2)
local s = ""
while str:sub(1,1) ~= "\"" do
local next = str:sub(1,1)
str = str:sub(2)
assert(next ~= "\n", "Unclosed string")
if next == "\\" then
local escape = str:sub(1,1)
str = str:sub(2)
next = assert(decodeControls[next..escape], "Invalid escape character")
end
s = s .. next
end
return s, removeWhite(str:sub(2))
end
local function parseArray(str)
str = removeWhite(str:sub(2))
local val = {}
local i = 1
while str:sub(1, 1) ~= "]" do
local v = nil
v, str = parseValue(str)
val[i] = v
i = i + 1
str = removeWhite(str)
end
return val, removeWhite(str:sub(2))
end
local function parseObject(str)
str = removeWhite(str:sub(2))
local val = {}
while str:sub(1, 1) ~= "}" do
local k, v = nil, nil
k, v, str = parseMember(str)
val[k] = v
str = removeWhite(str)
end
str = removeWhite(str:sub(2))
for _, commonDecoder in ipairs(commonDecoders) do
local alt = commonDecoder(val)
if alt then
return alt, str
end
end
return val, str
end
function parseMember(str)
local k = nil
k, str = parseValue(str)
local val = nil
val, str = parseValue(str)
return k, val, str
end
function parseValue(str)
local fchar = str:sub(1, 1)
if fchar == "{" then
return parseObject(str)
elseif fchar == "[" then
return parseArray(str)
elseif tonumber(fchar) ~= nil or numChars[fchar] then
return parseNumber(str)
elseif str:sub(1, 4) == "true" or str:sub(1, 5) == "false" then
return parseBoolean(str)
elseif fchar == "\"" then
return parseString(str)
elseif str:sub(1, 4) == "null" then
return parseNull(str)
end
return nil
end
function json.decode(str)
str = removeWhite(str)
t = parseValue(str)
return t
end
function json.decodeFromFile(path)
local file = assert(fs.open(path, "r"))
local decoded = json.decode(file.readAll())
file.close()
return decoded
end
return json
|
Dntg_TroopDuration = {
FishPath = {
Path = {
{
Id = 1,
Duration = 2242
},
{
Id = 2,
Duration = 2242
},
{
Id = 3,
Duration = 2802
},
{
Id = 4,
Duration = 1552
},
{
Id = 5,
Duration = 5833
},
[8] = {
Id = 8,
Duration = 5509
},
[9] = {
Id = 9,
Duration = 5510
},
[10] = {
Id = 10,
Duration = 5704
},
[11] = {
Id = 11,
Duration = 5704
},
[12] = {
Id = 12,
Duration = 5906
},
[13] = {
Id = 13,
Duration = 5907
},
[20] = {
Id = 20,
Duration = 7273
},
[21] = {
Id = 21,
Duration = 1002
},
[22] = {
Id = 22,
Duration = 1002
},
[23] = {
Id = 23,
Duration = 1002
},
[24] = {
Id = 24,
Duration = 1002
},
[25] = {
Id = 25,
Duration = 1002
},
[26] = {
Id = 26,
Duration = 1002
},
[27] = {
Id = 27,
Duration = 1002
},
[28] = {
Id = 28,
Duration = 1002
},
[29] = {
Id = 29,
Duration = 1002
},
[30] = {
Id = 30,
Duration = 1002
},
[31] = {
Id = 31,
Duration = 1058
},
[32] = {
Id = 32,
Duration = 1058
},
[33] = {
Id = 33,
Duration = 1058
},
[34] = {
Id = 34,
Duration = 1058
},
[35] = {
Id = 35,
Duration = 1101
},
[36] = {
Id = 36,
Duration = 1101
},
[37] = {
Id = 37,
Duration = 1652
},
[38] = {
Id = 38,
Duration = 1652
},
[39] = {
Id = 39,
Duration = 1762
},
[40] = {
Id = 40,
Duration = 1762
},
[41] = {
Id = 41,
Duration = 1762
},
[42] = {
Id = 42,
Duration = 1762
},
[43] = {
Id = 43,
Duration = 1762
},
[44] = {
Id = 44,
Duration = 1762
},
[45] = {
Id = 45,
Duration = 1599
},
[46] = {
Id = 46,
Duration = 1599
},
[47] = {
Id = 47,
Duration = 1599
},
[48] = {
Id = 48,
Duration = 1599
},
[49] = {
Id = 49,
Duration = 1599
},
[50] = {
Id = 50,
Duration = 1599
},
[51] = {
Id = 51,
Duration = 1599
},
[52] = {
Id = 52,
Duration = 1599
},
[53] = {
Id = 53,
Duration = 1599
},
[54] = {
Id = 54,
Duration = 1599
},
[55] = {
Id = 55,
Duration = 1599
},
[56] = {
Id = 56,
Duration = 1599
},
[57] = {
Id = 57,
Duration = 1599
},
[58] = {
Id = 58,
Duration = 1599
},
[59] = {
Id = 59,
Duration = 1599
},
[60] = {
Id = 60,
Duration = 1599
},
[61] = {
Id = 61,
Duration = 1599
},
[62] = {
Id = 62,
Duration = 1599
},
[63] = {
Id = 63,
Duration = 1599
},
[64] = {
Id = 64,
Duration = 1599
}
}
}
}
return
|
object_intangible_beast_bm_nexu = object_intangible_beast_shared_bm_nexu:new {
}
ObjectTemplates:addTemplate(object_intangible_beast_bm_nexu, "object/intangible/beast/bm_nexu.iff")
|
-- Do not edit! This file was generated by blocks/signal/frequencytranslator_spec.py
local radio = require('radio')
local jigs = require('tests.jigs')
jigs.TestBlock(radio.FrequencyTranslatorBlock, {
{
desc = "0.2 offset, 256 ComplexFloat32 input, 256 ComplexFloat32 output",
args = {0.2},
inputs = {radio.types.ComplexFloat32.vector_from_array({{-0.73127151, 0.69486749}, {0.52754927, -0.48986191}, {-0.00912983, -0.10101787}, {0.30318594, 0.57744670}, {-0.81228077, -0.94330502}, {0.67153019, -0.13446586}, {0.52456015, -0.99578792}, {-0.10922561, 0.44308007}, {-0.54247558, 0.89054137}, {0.80285490, -0.93882000}, {-0.94910830, 0.08282494}, {0.87829834, -0.23759152}, {-0.56680119, -0.15576684}, {-0.94191837, -0.55661666}, {-0.12422481, -0.00837552}, {-0.53383112, -0.53826690}, {-0.56243795, -0.08079307}, {-0.42043677, -0.95702058}, {0.67515594, 0.11290865}, {0.28458872, -0.62818748}, {0.98508680, 0.71989304}, {-0.75822008, -0.33460963}, {0.44296879, 0.42238355}, {0.87288117, -0.15578599}, {0.66007137, 0.34061113}, {-0.39326301, 0.17516121}, {0.76495802, 0.69239485}, {0.01056764, 0.17800452}, {-0.93094832, -0.51452005}, {0.59480852, -0.17137200}, {-0.65398520, 0.09759752}, {0.40608153, 0.34897169}, {-0.25059396, -0.12207674}, {0.01685298, 0.55688524}, {0.04187684, -0.21348982}, {-0.02061296, -0.94085008}, {-0.91302544, 0.40676415}, {0.96637541, 0.18636747}, {-0.21280062, -0.65930158}, {0.00447712, 0.96415329}, {0.54104626, 0.07923490}, {0.72057962, -0.53564775}, {0.02754333, 0.90493482}, {0.15558961, -0.08173654}, {-0.46144104, 0.09599262}, {0.91423255, -0.98858166}, {0.56731045, 0.64097184}, {0.77235913, 0.48100683}, {0.61827981, 0.03735657}, {0.12271573, -0.14781864}, {-0.88775343, 0.74002033}, {0.13999867, -0.60032117}, {0.00944094, -0.03014978}, {-0.28642008, -0.30784416}, {0.07695759, 0.24697889}, {0.22490492, -0.08370640}, {-0.94405001, -0.54078996}, {-0.64557749, 0.16892174}, {0.72201771, 0.59687787}, {0.59419513, 0.63287473}, {-0.48941192, 0.68348968}, {0.34622705, -0.83353174}, {-0.96661872, -0.97087997}, {0.51117355, -0.50088155}, {-0.78102273, 0.24960417}, {-0.31115428, -0.86096931}, {-0.68074894, 0.05476080}, {-0.66371012, -0.45417112}, {0.42317989, -0.09059674}, {-0.35599643, -0.05245798}, {-0.95273077, -0.22688580}, {-0.15816264, -0.62392139}, {-0.78247666, 0.79963702}, {0.02023196, -0.58181804}, {0.21129727, 0.63407934}, {-0.95836377, -0.96427095}, {-0.70707649, 0.43767095}, {-0.67954481, 0.40921125}, {0.35635161, 0.08940433}, {-0.55880052, 0.95118904}, {0.59562171, 0.03319904}, {-0.55360842, 0.29701284}, {-0.21020398, 0.15169193}, {-0.35750839, 0.26189572}, {-0.88242978, -0.40278813}, {0.93580663, 0.75106847}, {-0.38722676, 0.71702880}, {-0.37927276, 0.87857687}, {0.48768425, -0.16765547}, {-0.49528381, -0.98303950}, {0.75743574, -0.92416686}, {0.63882822, 0.92440224}, {0.14056113, -0.65696579}, {0.73556215, 0.94755048}, {0.40804628, 0.01774749}, {-0.24406233, -0.30613822}, {-0.58847648, 0.34830603}, {-0.13409975, -0.61176270}, {-0.79115158, 0.33191505}, {-0.40785465, -0.00040016}, {-0.34930867, 0.74324304}, {0.79935658, -0.96381402}, {-0.59829396, -0.34451860}, {0.97409946, 0.56540078}, {-0.32180870, -0.57394040}, {0.34891015, 0.67540216}, {0.86437494, -0.31230038}, {0.76478642, 0.37422037}, {-0.03100256, 0.97101647}, {-0.53071910, 0.45093039}, {-0.83063954, -0.66061169}, {0.82197559, -0.57406360}, {0.51823235, 0.20041765}, {0.68226439, -0.26378399}, {-0.31942952, -0.41756943}, {0.73483962, 0.20796506}, {0.90861493, 0.77453023}, {-0.72930807, 0.10234095}, {-0.79145002, -0.92172438}, {-0.85361314, 0.73233670}, {0.57623291, 0.65701193}, {-0.31820506, 0.23037209}, {0.56380719, -0.24392074}, {0.14156306, -0.55257183}, {-0.83651346, -0.46655273}, {0.78153634, 0.12889367}, {0.85013437, -0.08446148}, {-0.44563445, 0.57402933}, {0.65553629, -0.97523654}, {0.34082329, -0.81663376}, {-0.76979506, 0.77012014}, {-0.91995299, -0.52073330}, {0.97631699, -0.15797283}, {-0.76888371, -0.66523314}, {-0.51715940, 0.48801285}, {-0.79433179, 0.82152885}, {-0.24344546, 0.94052809}, {0.81844544, -0.41195285}, {-0.49317971, -0.04597981}, {-0.79974169, 0.30410039}, {-0.92075950, -0.97898769}, {0.96516722, -0.40890029}, {0.19314128, -0.10031093}, {-0.37343827, -0.87407041}, {0.82678401, 0.93962657}, {0.93959302, -0.77727538}, {-0.56961346, 0.23561376}, {0.95990574, 0.08582640}, {0.37637961, 0.32366887}, {-0.48182800, 0.08320452}, {-0.38535777, -0.50723761}, {-0.83726245, -0.43842655}, {0.96675342, -0.10419552}, {0.30402106, 0.28693217}, {0.88146901, -0.21904290}, {-0.38643140, -0.34551716}, {-0.36652973, 0.69426954}, {0.78700048, -0.39438137}, {-0.33133319, 0.08845083}, {0.15797088, 0.19192508}, {-0.50980401, -0.95925194}, {-0.51248139, -0.85534495}, {0.10240951, -0.85816729}, {-0.84974039, 0.27076420}, {-0.41835687, 0.58436954}, {-0.01347791, 0.72529793}, {-0.69164079, 0.00285917}, {0.58996701, -0.84578598}, {0.89845592, -0.65351576}, {0.55241799, 0.96979177}, {0.64310026, -0.36043200}, {-0.78624445, 0.02871650}, {0.83871394, -0.41302100}, {0.78751761, -0.71663874}, {0.82096338, -0.93648010}, {-0.36786264, 0.80617654}, {0.60771257, 0.81430751}, {0.68143702, 0.49236977}, {0.37919036, -0.64369029}, {-0.13472399, -0.68420619}, {0.42964891, 0.33555749}, {-0.49482721, -0.87117159}, {0.92677176, 0.61650527}, {0.09853987, 0.08275530}, {0.70258534, -0.09338064}, {-0.20857909, -0.32266170}, {-0.48406181, -0.95118302}, {0.29287767, -0.16663224}, {0.14120726, -0.87535673}, {-0.29011312, -0.72343177}, {-0.74974197, -0.48177409}, {0.65786874, -0.20440537}, {-0.19783570, 0.22488984}, {-0.53294069, -0.98504567}, {0.05740348, 0.00179924}, {0.29767919, -0.12336609}, {0.37302625, 0.46284387}, {-0.52325064, -0.00985550}, {-0.04234622, -0.54987586}, {-0.17550774, 0.12081487}, {0.81387901, 0.83541310}, {-0.44954929, 0.29283035}, {-0.90360534, -0.85689718}, {0.02338342, 0.75484818}, {-0.68106455, 0.53205574}, {0.76601923, -0.37639597}, {0.38511392, 0.69798225}, {-0.25677133, 0.40256533}, {0.47283623, 0.18915559}, {0.71255422, 0.79320872}, {0.92015761, 0.14246538}, {-0.64744818, -0.49880919}, {-0.56476265, 0.13903470}, {0.51550025, -0.89573354}, {0.36327291, 0.43430653}, {-0.30403697, 0.03011161}, {-0.67040372, 0.45979229}, {-0.91858262, 0.96244210}, {0.61588746, 0.25689700}, {-0.46494752, 0.82572573}, {0.91887766, -0.72174770}, {0.55151451, 0.68386173}, {0.31943470, 0.40081555}, {-0.10988253, 0.84861559}, {0.94241506, -0.23529337}, {0.60542303, -0.13415682}, {-0.67049158, -0.34906545}, {-0.74733984, 0.81776953}, {0.91884816, -0.76162654}, {0.20135815, -0.18355180}, {-0.76381993, -0.40904897}, {-0.50356728, 0.49915361}, {-0.99198210, -0.62032259}, {-0.12245386, -0.95793062}, {0.25505316, 0.21125507}, {0.67066473, -0.58678836}, {-0.43043676, 0.08467886}, {-0.45354861, 0.17147619}, {-0.49823555, 0.36705431}, {0.58218145, 0.61730921}, {0.94723225, 0.09075401}, {-0.01838144, 0.71139538}, {0.53813475, 0.14108926}, {-0.23348723, -0.43190512}, {-0.78372163, 0.61509818}, {-0.76385695, 0.49453047}, {0.09057418, 0.92989063}, {0.52213132, 0.94703954}, {-0.72681195, 0.00074295}, {0.14515658, -0.37749708}, {0.00606498, -0.28636247}, {0.05678794, -0.99831057}, {-0.11537134, -0.10089571}, {-0.39040163, -0.20119449}, {0.56617463, 0.36682576}, {-0.01540173, 0.29533648}})},
outputs = {radio.types.ComplexFloat32.vector_from_array({{-0.73127151, 0.69486749}, {0.71472991, -0.08622092}, {0.09325244, -0.03989922}, {-0.64287406, 0.10990612}, {1.21160972, 0.28570315}, {-0.67153019, 0.13446586}, {-1.00968754, 0.49728063}, {0.45514676, -0.03303955}, {0.67932099, 0.79111737}, {0.09769869, -1.23142767}, {-0.94910830, 0.08282494}, {0.85021108, 0.32403523}, {-0.02700812, -0.58719462}, {0.82044274, -0.72381365}, {0.10542300, -0.06624157}, {0.53383112, 0.53826690}, {0.40753287, 0.39595568}, {-0.78025860, 0.69559479}, {0.31601715, -0.60722077}, {-0.13900222, -0.67549139}, {0.98508680, 0.71989304}, {-0.41673431, -0.71637547}, {-0.26482576, 0.55181205}, {-0.12157384, 0.87829989}, {-0.73421514, 0.11242002}, {0.39326301, -0.17516121}, {-0.21188459, -1.00979018}, {0.16602679, -0.06505685}, {-0.77701652, 0.72638905}, {0.38048029, -0.48826253}, {-0.65398520, 0.09759752}, {0.12340644, 0.52101278}, {0.03866409, -0.27605280}, {-0.53483719, -0.15605888}, {0.09160709, 0.19733147}, {0.02061296, 0.94085008}, {0.97774309, 0.20758376}, {-0.12138042, -0.97666836}, {-0.69279206, -0.00134997}, {0.57033712, 0.77738482}, {0.54104626, 0.07923490}, {0.89780700, -0.00980207}, {-0.85213280, 0.30583552}, {0.02965624, 0.17323250}, {0.31689060, -0.34888789}, {-0.91423255, 0.98858166}, {-0.08221003, -0.85201383}, {0.21879259, -0.88319647}, {0.22658719, -0.57647526}, {0.01239349, -0.19171828}, {-0.88775343, 0.74002033}, {0.46612123, -0.40338087}, {0.03159156, -0.00033793}, {0.38128588, -0.17727262}, {-0.20743056, -0.15457559}, {-0.22490492, 0.08370640}, {0.44588417, 0.99240696}, {0.36014855, 0.56178105}, {0.79078037, -0.50223422}, {0.85270840, 0.16274726}, {-0.48941192, 0.68348968}, {0.77004123, -0.47083417}, {0.62466013, -1.21932745}, {0.31840533, 0.64093584}, {0.48514703, -0.66100764}, {0.31115428, 0.86096931}, {0.58292502, 0.35583174}, {-0.22684470, 0.77157241}, {0.04460716, -0.43046394}, {-0.31884119, 0.16681005}, {-0.95273077, -0.22688580}, {0.23877552, -0.59772867}, {-1.00229859, -0.49707812}, {0.54708987, 0.19903341}, {-0.54364556, -0.38878351}, {0.95836377, 0.96427095}, {0.82929349, 0.06152588}, {0.59917396, 0.51983231}, {0.19514728, -0.31128305}, {0.10701579, 1.09798276}, {0.59562171, 0.03319904}, {-0.62245840, -0.08511442}, {-0.20922421, -0.15304048}, {-0.13860145, -0.42094094}, {0.95065361, -0.19281676}, {-0.93580663, -0.75106847}, {0.73473203, -0.35248232}, {0.95277804, 0.08921465}, {-0.00874710, -0.51562369}, {-0.97850919, -0.50417513}, {0.75743574, -0.92416686}, {-0.02652711, 1.12335098}, {0.66824734, -0.06933202}, {-1.12847531, 0.40675196}, {-0.34054807, 0.22548556}, {0.24406233, 0.30613822}, {0.68081665, 0.06411231}, {-0.54038179, 0.31658152}, {0.07119070, 0.85499728}, {-0.33019653, 0.23940720}, {-0.34930867, 0.74324304}, {1.21320868, -0.30989194}, {0.14277364, -0.67547351}, {-0.83874142, 0.75170523}, {0.59770238, 0.27517313}, {-0.34891015, -0.67540216}, {-0.88285959, -0.25541052}, {0.11957271, -0.84299558}, {0.91391122, 0.32954580}, {-0.16431054, 0.67675924}, {-0.83063954, -0.66061169}, {1.00241828, 0.01871791}, {-0.03046592, 0.55480075}, {0.04004218, 0.73038578}, {0.50386506, 0.15006481}, {-0.73483962, -0.20796506}, {-0.27982751, -1.16067863}, {0.32270062, 0.66198814}, {-1.12118351, 0.46788523}, {-0.26013082, 1.09421408}, {0.57623291, 0.65701193}, {-0.39284259, -0.00066130}, {0.40620843, 0.46083686}, {0.48178166, 0.30538857}, {0.95098644, -0.11424118}, {-0.78153634, -0.12889367}, {-0.73741835, -0.43136567}, {0.68364292, 0.24643874}, {-0.72493321, -0.92481673}, {-0.20427343, -0.86100149}, {-0.76979506, 0.77012014}, {-0.43817827, -0.96201682}, {0.45193964, 0.87971640}, {0.87027246, -0.52568352}, {0.13154399, -0.69878936}, {0.79433179, -0.82152885}, {0.74978006, -0.61780959}, {-0.64470398, -0.65108746}, {-0.19613031, 0.45483324}, {-0.46825886, 0.71609873}, {-0.92075950, -0.97898769}, {1.02118230, 0.23650375}, {0.15508530, 0.15269050}, {0.94668913, -0.08505830}, {-1.22118092, -0.27420241}, {-0.93959302, 0.77727538}, {0.59931725, 0.14419484}, {-0.21500143, -0.93944645}, {0.42413509, -0.25793910}, {-0.34090066, 0.35052526}, {-0.38535777, -0.50723761}, {-0.41965893, -0.84682506}, {0.39783907, 0.88723898}, {-0.36683640, 0.20047429}, {-0.58437324, 0.69532394}, {0.38643140, 0.34551716}, {0.70461017, -0.34623510}, {-0.61827552, -0.62661135}, {-0.01826586, 0.34244940}, {0.24061185, 0.06241770}, {-0.50980401, -0.95925194}, {0.08815300, -0.99321759}, {0.84781194, -0.16779104}, {0.00507218, -0.89182186}, {-0.00502598, -0.71866888}, {0.01347791, -0.72529793}, {0.56122971, 0.40422314}, {-0.98670018, -0.29972970}, {-0.34389225, -1.05642986}, {1.01694489, 0.45987487}, {0.64310026, -0.36043200}, {-0.65296429, -0.43891075}, {0.65198320, 0.67003387}, {0.43820763, 0.97042733}, {-0.11372417, 1.24017847}, {0.36786264, -0.80617654}, {-0.01301187, -1.01599312}, {0.25769585, -0.80023575}, {-0.49500957, -0.55954272}, {-0.51116031, -0.47434568}, {0.42964891, 0.33555749}, {0.11173820, -0.99564475}, {-0.29994315, 1.07192290}, {-0.10915546, 0.06814419}, {-0.51351571, 0.48851582}, {0.20857909, 0.32266170}, {-0.16747710, 1.05404758}, {-0.24898086, -0.22705103}, {-0.78887832, -0.40479621}, {-0.65992898, -0.41474441}, {-0.74974197, -0.48177409}, {0.65237343, 0.22131813}, {-0.27501756, -0.11865816}, {1.10152185, -0.20246089}, {-0.04749795, 0.03228530}, {-0.29767919, 0.12336609}, {-0.02973178, -0.59370792}, {0.15232021, 0.50068647}, {-0.53604877, -0.12964734}, {-0.07097554, 0.20090213}, {0.81387901, 0.83541310}, {-0.53581440, -0.02733372}, {0.53572828, -1.12417555}, {-0.72512919, -0.21102197}, {0.23825827, -0.83076179}, {-0.76601923, 0.37639597}, {0.09869996, -0.79104376}, {0.46220911, 0.11980451}, {0.32601210, -0.39124167}, {1.04270482, 0.22289050}, {0.92015761, 0.14246538}, {-0.23060387, -0.78410560}, {-0.30675113, -0.49415714}, {0.69259489, 0.76706672}, {-0.54917294, -0.13783491}, {0.30403697, -0.03011161}, {0.81262708, 0.02207363}, {1.19919443, 0.57621306}, {0.43464327, -0.50635827}, {0.10919896, 0.94131541}, {0.91887766, -0.72174770}, {0.04422078, 0.87742788}, {-0.28248751, 0.42765927}, {-0.77312583, -0.36674115}, {-0.62412786, 0.74429405}, {-0.60542303, 0.13415682}, {0.33726358, 0.67650497}, {1.00868583, 0.45805776}, {-0.44041023, -1.10923219}, {0.05501314, -0.26685187}, {-0.76381993, -0.40904897}, {-0.70078963, 0.10783434}, {0.28342250, -1.13512135}, {0.94888651, 0.17955630}, {-0.33051497, -0.02099246}, {-0.67066473, 0.58678836}, {0.39800364, 0.18449774}, {0.30323780, 0.37836131}, {0.19512616, 0.58727622}, {0.83383989, 0.15721598}, {0.94723225, 0.09075401}, {-0.43301862, 0.56472659}, {0.03210892, 0.55539560}, {0.48291773, -0.08859354}, {0.27249849, -0.95828485}, {0.76385695, -0.49453047}, {0.47329992, -0.80553550}, {0.73934072, -0.78922772}, {-0.22389066, 0.69146883}, {-0.10445308, -0.39072245}, {0.00606498, -0.28636247}, {0.63273466, -0.77427107}, {0.06030582, -0.14090315}, {0.31198809, -0.30912149}, {-0.67365968, 0.03602082}, {0.01540173, -0.29533648}})}
},
{
desc = "0.5 offset, 256 ComplexFloat32 input, 256 ComplexFloat32 output",
args = {0.5},
inputs = {radio.types.ComplexFloat32.vector_from_array({{-0.73127151, 0.69486749}, {0.52754927, -0.48986191}, {-0.00912983, -0.10101787}, {0.30318594, 0.57744670}, {-0.81228077, -0.94330502}, {0.67153019, -0.13446586}, {0.52456015, -0.99578792}, {-0.10922561, 0.44308007}, {-0.54247558, 0.89054137}, {0.80285490, -0.93882000}, {-0.94910830, 0.08282494}, {0.87829834, -0.23759152}, {-0.56680119, -0.15576684}, {-0.94191837, -0.55661666}, {-0.12422481, -0.00837552}, {-0.53383112, -0.53826690}, {-0.56243795, -0.08079307}, {-0.42043677, -0.95702058}, {0.67515594, 0.11290865}, {0.28458872, -0.62818748}, {0.98508680, 0.71989304}, {-0.75822008, -0.33460963}, {0.44296879, 0.42238355}, {0.87288117, -0.15578599}, {0.66007137, 0.34061113}, {-0.39326301, 0.17516121}, {0.76495802, 0.69239485}, {0.01056764, 0.17800452}, {-0.93094832, -0.51452005}, {0.59480852, -0.17137200}, {-0.65398520, 0.09759752}, {0.40608153, 0.34897169}, {-0.25059396, -0.12207674}, {0.01685298, 0.55688524}, {0.04187684, -0.21348982}, {-0.02061296, -0.94085008}, {-0.91302544, 0.40676415}, {0.96637541, 0.18636747}, {-0.21280062, -0.65930158}, {0.00447712, 0.96415329}, {0.54104626, 0.07923490}, {0.72057962, -0.53564775}, {0.02754333, 0.90493482}, {0.15558961, -0.08173654}, {-0.46144104, 0.09599262}, {0.91423255, -0.98858166}, {0.56731045, 0.64097184}, {0.77235913, 0.48100683}, {0.61827981, 0.03735657}, {0.12271573, -0.14781864}, {-0.88775343, 0.74002033}, {0.13999867, -0.60032117}, {0.00944094, -0.03014978}, {-0.28642008, -0.30784416}, {0.07695759, 0.24697889}, {0.22490492, -0.08370640}, {-0.94405001, -0.54078996}, {-0.64557749, 0.16892174}, {0.72201771, 0.59687787}, {0.59419513, 0.63287473}, {-0.48941192, 0.68348968}, {0.34622705, -0.83353174}, {-0.96661872, -0.97087997}, {0.51117355, -0.50088155}, {-0.78102273, 0.24960417}, {-0.31115428, -0.86096931}, {-0.68074894, 0.05476080}, {-0.66371012, -0.45417112}, {0.42317989, -0.09059674}, {-0.35599643, -0.05245798}, {-0.95273077, -0.22688580}, {-0.15816264, -0.62392139}, {-0.78247666, 0.79963702}, {0.02023196, -0.58181804}, {0.21129727, 0.63407934}, {-0.95836377, -0.96427095}, {-0.70707649, 0.43767095}, {-0.67954481, 0.40921125}, {0.35635161, 0.08940433}, {-0.55880052, 0.95118904}, {0.59562171, 0.03319904}, {-0.55360842, 0.29701284}, {-0.21020398, 0.15169193}, {-0.35750839, 0.26189572}, {-0.88242978, -0.40278813}, {0.93580663, 0.75106847}, {-0.38722676, 0.71702880}, {-0.37927276, 0.87857687}, {0.48768425, -0.16765547}, {-0.49528381, -0.98303950}, {0.75743574, -0.92416686}, {0.63882822, 0.92440224}, {0.14056113, -0.65696579}, {0.73556215, 0.94755048}, {0.40804628, 0.01774749}, {-0.24406233, -0.30613822}, {-0.58847648, 0.34830603}, {-0.13409975, -0.61176270}, {-0.79115158, 0.33191505}, {-0.40785465, -0.00040016}, {-0.34930867, 0.74324304}, {0.79935658, -0.96381402}, {-0.59829396, -0.34451860}, {0.97409946, 0.56540078}, {-0.32180870, -0.57394040}, {0.34891015, 0.67540216}, {0.86437494, -0.31230038}, {0.76478642, 0.37422037}, {-0.03100256, 0.97101647}, {-0.53071910, 0.45093039}, {-0.83063954, -0.66061169}, {0.82197559, -0.57406360}, {0.51823235, 0.20041765}, {0.68226439, -0.26378399}, {-0.31942952, -0.41756943}, {0.73483962, 0.20796506}, {0.90861493, 0.77453023}, {-0.72930807, 0.10234095}, {-0.79145002, -0.92172438}, {-0.85361314, 0.73233670}, {0.57623291, 0.65701193}, {-0.31820506, 0.23037209}, {0.56380719, -0.24392074}, {0.14156306, -0.55257183}, {-0.83651346, -0.46655273}, {0.78153634, 0.12889367}, {0.85013437, -0.08446148}, {-0.44563445, 0.57402933}, {0.65553629, -0.97523654}, {0.34082329, -0.81663376}, {-0.76979506, 0.77012014}, {-0.91995299, -0.52073330}, {0.97631699, -0.15797283}, {-0.76888371, -0.66523314}, {-0.51715940, 0.48801285}, {-0.79433179, 0.82152885}, {-0.24344546, 0.94052809}, {0.81844544, -0.41195285}, {-0.49317971, -0.04597981}, {-0.79974169, 0.30410039}, {-0.92075950, -0.97898769}, {0.96516722, -0.40890029}, {0.19314128, -0.10031093}, {-0.37343827, -0.87407041}, {0.82678401, 0.93962657}, {0.93959302, -0.77727538}, {-0.56961346, 0.23561376}, {0.95990574, 0.08582640}, {0.37637961, 0.32366887}, {-0.48182800, 0.08320452}, {-0.38535777, -0.50723761}, {-0.83726245, -0.43842655}, {0.96675342, -0.10419552}, {0.30402106, 0.28693217}, {0.88146901, -0.21904290}, {-0.38643140, -0.34551716}, {-0.36652973, 0.69426954}, {0.78700048, -0.39438137}, {-0.33133319, 0.08845083}, {0.15797088, 0.19192508}, {-0.50980401, -0.95925194}, {-0.51248139, -0.85534495}, {0.10240951, -0.85816729}, {-0.84974039, 0.27076420}, {-0.41835687, 0.58436954}, {-0.01347791, 0.72529793}, {-0.69164079, 0.00285917}, {0.58996701, -0.84578598}, {0.89845592, -0.65351576}, {0.55241799, 0.96979177}, {0.64310026, -0.36043200}, {-0.78624445, 0.02871650}, {0.83871394, -0.41302100}, {0.78751761, -0.71663874}, {0.82096338, -0.93648010}, {-0.36786264, 0.80617654}, {0.60771257, 0.81430751}, {0.68143702, 0.49236977}, {0.37919036, -0.64369029}, {-0.13472399, -0.68420619}, {0.42964891, 0.33555749}, {-0.49482721, -0.87117159}, {0.92677176, 0.61650527}, {0.09853987, 0.08275530}, {0.70258534, -0.09338064}, {-0.20857909, -0.32266170}, {-0.48406181, -0.95118302}, {0.29287767, -0.16663224}, {0.14120726, -0.87535673}, {-0.29011312, -0.72343177}, {-0.74974197, -0.48177409}, {0.65786874, -0.20440537}, {-0.19783570, 0.22488984}, {-0.53294069, -0.98504567}, {0.05740348, 0.00179924}, {0.29767919, -0.12336609}, {0.37302625, 0.46284387}, {-0.52325064, -0.00985550}, {-0.04234622, -0.54987586}, {-0.17550774, 0.12081487}, {0.81387901, 0.83541310}, {-0.44954929, 0.29283035}, {-0.90360534, -0.85689718}, {0.02338342, 0.75484818}, {-0.68106455, 0.53205574}, {0.76601923, -0.37639597}, {0.38511392, 0.69798225}, {-0.25677133, 0.40256533}, {0.47283623, 0.18915559}, {0.71255422, 0.79320872}, {0.92015761, 0.14246538}, {-0.64744818, -0.49880919}, {-0.56476265, 0.13903470}, {0.51550025, -0.89573354}, {0.36327291, 0.43430653}, {-0.30403697, 0.03011161}, {-0.67040372, 0.45979229}, {-0.91858262, 0.96244210}, {0.61588746, 0.25689700}, {-0.46494752, 0.82572573}, {0.91887766, -0.72174770}, {0.55151451, 0.68386173}, {0.31943470, 0.40081555}, {-0.10988253, 0.84861559}, {0.94241506, -0.23529337}, {0.60542303, -0.13415682}, {-0.67049158, -0.34906545}, {-0.74733984, 0.81776953}, {0.91884816, -0.76162654}, {0.20135815, -0.18355180}, {-0.76381993, -0.40904897}, {-0.50356728, 0.49915361}, {-0.99198210, -0.62032259}, {-0.12245386, -0.95793062}, {0.25505316, 0.21125507}, {0.67066473, -0.58678836}, {-0.43043676, 0.08467886}, {-0.45354861, 0.17147619}, {-0.49823555, 0.36705431}, {0.58218145, 0.61730921}, {0.94723225, 0.09075401}, {-0.01838144, 0.71139538}, {0.53813475, 0.14108926}, {-0.23348723, -0.43190512}, {-0.78372163, 0.61509818}, {-0.76385695, 0.49453047}, {0.09057418, 0.92989063}, {0.52213132, 0.94703954}, {-0.72681195, 0.00074295}, {0.14515658, -0.37749708}, {0.00606498, -0.28636247}, {0.05678794, -0.99831057}, {-0.11537134, -0.10089571}, {-0.39040163, -0.20119449}, {0.56617463, 0.36682576}, {-0.01540173, 0.29533648}})},
outputs = {radio.types.ComplexFloat32.vector_from_array({{-0.73127151, 0.69486749}, {0.48986191, 0.52754927}, {0.00912983, 0.10101787}, {0.57744670, -0.30318594}, {-0.81228077, -0.94330502}, {0.13446586, 0.67153019}, {-0.52456015, 0.99578792}, {0.44308007, 0.10922561}, {-0.54247558, 0.89054137}, {0.93882000, 0.80285490}, {0.94910830, -0.08282494}, {-0.23759152, -0.87829834}, {-0.56680119, -0.15576684}, {0.55661666, -0.94191837}, {0.12422481, 0.00837552}, {-0.53826690, 0.53383112}, {-0.56243795, -0.08079307}, {0.95702058, -0.42043677}, {-0.67515594, -0.11290865}, {-0.62818748, -0.28458872}, {0.98508680, 0.71989304}, {0.33460963, -0.75822008}, {-0.44296879, -0.42238355}, {-0.15578599, -0.87288117}, {0.66007137, 0.34061113}, {-0.17516121, -0.39326301}, {-0.76495802, -0.69239485}, {0.17800452, -0.01056764}, {-0.93094832, -0.51452005}, {0.17137200, 0.59480852}, {0.65398520, -0.09759752}, {0.34897169, -0.40608153}, {-0.25059396, -0.12207674}, {-0.55688524, 0.01685298}, {-0.04187684, 0.21348982}, {-0.94085008, 0.02061296}, {-0.91302544, 0.40676415}, {-0.18636747, 0.96637541}, {0.21280062, 0.65930158}, {0.96415329, -0.00447712}, {0.54104626, 0.07923490}, {0.53564775, 0.72057962}, {-0.02754333, -0.90493482}, {-0.08173654, -0.15558961}, {-0.46144104, 0.09599262}, {0.98858166, 0.91423255}, {-0.56731045, -0.64097184}, {0.48100683, -0.77235913}, {0.61827981, 0.03735657}, {0.14781864, 0.12271573}, {0.88775343, -0.74002033}, {-0.60032117, -0.13999867}, {0.00944094, -0.03014978}, {0.30784416, -0.28642008}, {-0.07695759, -0.24697889}, {-0.08370640, -0.22490492}, {-0.94405001, -0.54078996}, {-0.16892174, -0.64557749}, {-0.72201771, -0.59687787}, {0.63287473, -0.59419513}, {-0.48941192, 0.68348968}, {0.83353174, 0.34622705}, {0.96661872, 0.97087997}, {-0.50088155, -0.51117355}, {-0.78102273, 0.24960417}, {0.86096931, -0.31115428}, {0.68074894, -0.05476080}, {-0.45417112, 0.66371012}, {0.42317989, -0.09059674}, {0.05245798, -0.35599643}, {0.95273077, 0.22688580}, {-0.62392139, 0.15816264}, {-0.78247666, 0.79963702}, {0.58181804, 0.02023196}, {-0.21129727, -0.63407934}, {-0.96427095, 0.95836377}, {-0.70707649, 0.43767095}, {-0.40921125, -0.67954481}, {-0.35635161, -0.08940433}, {0.95118904, 0.55880052}, {0.59562171, 0.03319904}, {-0.29701284, -0.55360842}, {0.21020398, -0.15169193}, {0.26189572, 0.35750839}, {-0.88242978, -0.40278813}, {-0.75106847, 0.93580663}, {0.38722676, -0.71702880}, {0.87857687, 0.37927276}, {0.48768425, -0.16765547}, {0.98303950, -0.49528381}, {-0.75743574, 0.92416686}, {0.92440224, -0.63882822}, {0.14056113, -0.65696579}, {-0.94755048, 0.73556215}, {-0.40804628, -0.01774749}, {-0.30613822, 0.24406233}, {-0.58847648, 0.34830603}, {0.61176270, -0.13409975}, {0.79115158, -0.33191505}, {-0.00040016, 0.40785465}, {-0.34930867, 0.74324304}, {0.96381402, 0.79935658}, {0.59829396, 0.34451860}, {0.56540078, -0.97409946}, {-0.32180870, -0.57394040}, {-0.67540216, 0.34891015}, {-0.86437494, 0.31230038}, {0.37422037, -0.76478642}, {-0.03100256, 0.97101647}, {-0.45093039, -0.53071910}, {0.83063954, 0.66061169}, {-0.57406360, -0.82197559}, {0.51823235, 0.20041765}, {0.26378399, 0.68226439}, {0.31942952, 0.41756943}, {0.20796506, -0.73483962}, {0.90861493, 0.77453023}, {-0.10234095, -0.72930807}, {0.79145002, 0.92172438}, {0.73233670, 0.85361314}, {0.57623291, 0.65701193}, {-0.23037209, -0.31820506}, {-0.56380719, 0.24392074}, {-0.55257183, -0.14156306}, {-0.83651346, -0.46655273}, {-0.12889367, 0.78153634}, {-0.85013437, 0.08446148}, {0.57402933, 0.44563445}, {0.65553629, -0.97523654}, {0.81663376, 0.34082329}, {0.76979506, -0.77012014}, {-0.52073330, 0.91995299}, {0.97631699, -0.15797283}, {0.66523314, -0.76888371}, {0.51715940, -0.48801285}, {0.82152885, 0.79433179}, {-0.24344546, 0.94052809}, {0.41195285, 0.81844544}, {0.49317971, 0.04597981}, {0.30410039, 0.79974169}, {-0.92075950, -0.97898769}, {0.40890029, 0.96516722}, {-0.19314128, 0.10031093}, {-0.87407041, 0.37343827}, {0.82678401, 0.93962657}, {0.77727538, 0.93959302}, {0.56961346, -0.23561376}, {0.08582640, -0.95990574}, {0.37637961, 0.32366887}, {-0.08320452, -0.48182800}, {0.38535777, 0.50723761}, {-0.43842655, 0.83726245}, {0.96675342, -0.10419552}, {-0.28693217, 0.30402106}, {-0.88146901, 0.21904290}, {-0.34551716, 0.38643140}, {-0.36652973, 0.69426954}, {0.39438137, 0.78700048}, {0.33133319, -0.08845083}, {0.19192508, -0.15797088}, {-0.50980401, -0.95925194}, {0.85534495, -0.51248139}, {-0.10240951, 0.85816729}, {0.27076420, 0.84974039}, {-0.41835687, 0.58436954}, {-0.72529793, -0.01347791}, {0.69164079, -0.00285917}, {-0.84578598, -0.58996701}, {0.89845592, -0.65351576}, {-0.96979177, 0.55241799}, {-0.64310026, 0.36043200}, {0.02871650, 0.78624445}, {0.83871394, -0.41302100}, {0.71663874, 0.78751761}, {-0.82096338, 0.93648010}, {0.80617654, 0.36786264}, {0.60771257, 0.81430751}, {-0.49236977, 0.68143702}, {-0.37919036, 0.64369029}, {-0.68420619, 0.13472399}, {0.42964891, 0.33555749}, {0.87117159, -0.49482721}, {-0.92677176, -0.61650527}, {0.08275530, -0.09853987}, {0.70258534, -0.09338064}, {0.32266170, -0.20857909}, {0.48406181, 0.95118302}, {-0.16663224, -0.29287767}, {0.14120726, -0.87535673}, {0.72343177, -0.29011312}, {0.74974197, 0.48177409}, {-0.20440537, -0.65786874}, {-0.19783570, 0.22488984}, {0.98504567, -0.53294069}, {-0.05740348, -0.00179924}, {-0.12336609, -0.29767919}, {0.37302625, 0.46284387}, {0.00985550, -0.52325064}, {0.04234622, 0.54987586}, {0.12081487, 0.17550774}, {0.81387901, 0.83541310}, {-0.29283035, -0.44954929}, {0.90360534, 0.85689718}, {0.75484818, -0.02338342}, {-0.68106455, 0.53205574}, {0.37639597, 0.76601923}, {-0.38511392, -0.69798225}, {0.40256533, 0.25677133}, {0.47283623, 0.18915559}, {-0.79320872, 0.71255422}, {-0.92015761, -0.14246538}, {-0.49880919, 0.64744818}, {-0.56476265, 0.13903470}, {0.89573354, 0.51550025}, {-0.36327291, -0.43430653}, {0.03011161, 0.30403697}, {-0.67040372, 0.45979229}, {-0.96244210, -0.91858262}, {-0.61588746, -0.25689700}, {0.82572573, 0.46494752}, {0.91887766, -0.72174770}, {-0.68386173, 0.55151451}, {-0.31943470, -0.40081555}, {0.84861559, 0.10988253}, {0.94241506, -0.23529337}, {0.13415682, 0.60542303}, {0.67049158, 0.34906545}, {0.81776953, 0.74733984}, {0.91884816, -0.76162654}, {0.18355180, 0.20135815}, {0.76381993, 0.40904897}, {0.49915361, 0.50356728}, {-0.99198210, -0.62032259}, {0.95793062, -0.12245386}, {-0.25505316, -0.21125507}, {-0.58678836, -0.67066473}, {-0.43043676, 0.08467886}, {-0.17147619, -0.45354861}, {0.49823555, -0.36705431}, {0.61730921, -0.58218145}, {0.94723225, 0.09075401}, {-0.71139538, -0.01838144}, {-0.53813475, -0.14108926}, {-0.43190512, 0.23348723}, {-0.78372163, 0.61509818}, {-0.49453047, -0.76385695}, {-0.09057418, -0.92989063}, {0.94703954, -0.52213132}, {-0.72681195, 0.00074295}, {0.37749708, 0.14515658}, {-0.00606498, 0.28636247}, {-0.99831057, -0.05678794}, {-0.11537134, -0.10089571}, {0.20119449, -0.39040163}, {-0.56617463, -0.36682576}, {0.29533648, 0.01540173}})}
},
{
desc = "0.7 offset, 256 ComplexFloat32 input, 256 ComplexFloat32 output",
args = {0.7},
inputs = {radio.types.ComplexFloat32.vector_from_array({{-0.73127151, 0.69486749}, {0.52754927, -0.48986191}, {-0.00912983, -0.10101787}, {0.30318594, 0.57744670}, {-0.81228077, -0.94330502}, {0.67153019, -0.13446586}, {0.52456015, -0.99578792}, {-0.10922561, 0.44308007}, {-0.54247558, 0.89054137}, {0.80285490, -0.93882000}, {-0.94910830, 0.08282494}, {0.87829834, -0.23759152}, {-0.56680119, -0.15576684}, {-0.94191837, -0.55661666}, {-0.12422481, -0.00837552}, {-0.53383112, -0.53826690}, {-0.56243795, -0.08079307}, {-0.42043677, -0.95702058}, {0.67515594, 0.11290865}, {0.28458872, -0.62818748}, {0.98508680, 0.71989304}, {-0.75822008, -0.33460963}, {0.44296879, 0.42238355}, {0.87288117, -0.15578599}, {0.66007137, 0.34061113}, {-0.39326301, 0.17516121}, {0.76495802, 0.69239485}, {0.01056764, 0.17800452}, {-0.93094832, -0.51452005}, {0.59480852, -0.17137200}, {-0.65398520, 0.09759752}, {0.40608153, 0.34897169}, {-0.25059396, -0.12207674}, {0.01685298, 0.55688524}, {0.04187684, -0.21348982}, {-0.02061296, -0.94085008}, {-0.91302544, 0.40676415}, {0.96637541, 0.18636747}, {-0.21280062, -0.65930158}, {0.00447712, 0.96415329}, {0.54104626, 0.07923490}, {0.72057962, -0.53564775}, {0.02754333, 0.90493482}, {0.15558961, -0.08173654}, {-0.46144104, 0.09599262}, {0.91423255, -0.98858166}, {0.56731045, 0.64097184}, {0.77235913, 0.48100683}, {0.61827981, 0.03735657}, {0.12271573, -0.14781864}, {-0.88775343, 0.74002033}, {0.13999867, -0.60032117}, {0.00944094, -0.03014978}, {-0.28642008, -0.30784416}, {0.07695759, 0.24697889}, {0.22490492, -0.08370640}, {-0.94405001, -0.54078996}, {-0.64557749, 0.16892174}, {0.72201771, 0.59687787}, {0.59419513, 0.63287473}, {-0.48941192, 0.68348968}, {0.34622705, -0.83353174}, {-0.96661872, -0.97087997}, {0.51117355, -0.50088155}, {-0.78102273, 0.24960417}, {-0.31115428, -0.86096931}, {-0.68074894, 0.05476080}, {-0.66371012, -0.45417112}, {0.42317989, -0.09059674}, {-0.35599643, -0.05245798}, {-0.95273077, -0.22688580}, {-0.15816264, -0.62392139}, {-0.78247666, 0.79963702}, {0.02023196, -0.58181804}, {0.21129727, 0.63407934}, {-0.95836377, -0.96427095}, {-0.70707649, 0.43767095}, {-0.67954481, 0.40921125}, {0.35635161, 0.08940433}, {-0.55880052, 0.95118904}, {0.59562171, 0.03319904}, {-0.55360842, 0.29701284}, {-0.21020398, 0.15169193}, {-0.35750839, 0.26189572}, {-0.88242978, -0.40278813}, {0.93580663, 0.75106847}, {-0.38722676, 0.71702880}, {-0.37927276, 0.87857687}, {0.48768425, -0.16765547}, {-0.49528381, -0.98303950}, {0.75743574, -0.92416686}, {0.63882822, 0.92440224}, {0.14056113, -0.65696579}, {0.73556215, 0.94755048}, {0.40804628, 0.01774749}, {-0.24406233, -0.30613822}, {-0.58847648, 0.34830603}, {-0.13409975, -0.61176270}, {-0.79115158, 0.33191505}, {-0.40785465, -0.00040016}, {-0.34930867, 0.74324304}, {0.79935658, -0.96381402}, {-0.59829396, -0.34451860}, {0.97409946, 0.56540078}, {-0.32180870, -0.57394040}, {0.34891015, 0.67540216}, {0.86437494, -0.31230038}, {0.76478642, 0.37422037}, {-0.03100256, 0.97101647}, {-0.53071910, 0.45093039}, {-0.83063954, -0.66061169}, {0.82197559, -0.57406360}, {0.51823235, 0.20041765}, {0.68226439, -0.26378399}, {-0.31942952, -0.41756943}, {0.73483962, 0.20796506}, {0.90861493, 0.77453023}, {-0.72930807, 0.10234095}, {-0.79145002, -0.92172438}, {-0.85361314, 0.73233670}, {0.57623291, 0.65701193}, {-0.31820506, 0.23037209}, {0.56380719, -0.24392074}, {0.14156306, -0.55257183}, {-0.83651346, -0.46655273}, {0.78153634, 0.12889367}, {0.85013437, -0.08446148}, {-0.44563445, 0.57402933}, {0.65553629, -0.97523654}, {0.34082329, -0.81663376}, {-0.76979506, 0.77012014}, {-0.91995299, -0.52073330}, {0.97631699, -0.15797283}, {-0.76888371, -0.66523314}, {-0.51715940, 0.48801285}, {-0.79433179, 0.82152885}, {-0.24344546, 0.94052809}, {0.81844544, -0.41195285}, {-0.49317971, -0.04597981}, {-0.79974169, 0.30410039}, {-0.92075950, -0.97898769}, {0.96516722, -0.40890029}, {0.19314128, -0.10031093}, {-0.37343827, -0.87407041}, {0.82678401, 0.93962657}, {0.93959302, -0.77727538}, {-0.56961346, 0.23561376}, {0.95990574, 0.08582640}, {0.37637961, 0.32366887}, {-0.48182800, 0.08320452}, {-0.38535777, -0.50723761}, {-0.83726245, -0.43842655}, {0.96675342, -0.10419552}, {0.30402106, 0.28693217}, {0.88146901, -0.21904290}, {-0.38643140, -0.34551716}, {-0.36652973, 0.69426954}, {0.78700048, -0.39438137}, {-0.33133319, 0.08845083}, {0.15797088, 0.19192508}, {-0.50980401, -0.95925194}, {-0.51248139, -0.85534495}, {0.10240951, -0.85816729}, {-0.84974039, 0.27076420}, {-0.41835687, 0.58436954}, {-0.01347791, 0.72529793}, {-0.69164079, 0.00285917}, {0.58996701, -0.84578598}, {0.89845592, -0.65351576}, {0.55241799, 0.96979177}, {0.64310026, -0.36043200}, {-0.78624445, 0.02871650}, {0.83871394, -0.41302100}, {0.78751761, -0.71663874}, {0.82096338, -0.93648010}, {-0.36786264, 0.80617654}, {0.60771257, 0.81430751}, {0.68143702, 0.49236977}, {0.37919036, -0.64369029}, {-0.13472399, -0.68420619}, {0.42964891, 0.33555749}, {-0.49482721, -0.87117159}, {0.92677176, 0.61650527}, {0.09853987, 0.08275530}, {0.70258534, -0.09338064}, {-0.20857909, -0.32266170}, {-0.48406181, -0.95118302}, {0.29287767, -0.16663224}, {0.14120726, -0.87535673}, {-0.29011312, -0.72343177}, {-0.74974197, -0.48177409}, {0.65786874, -0.20440537}, {-0.19783570, 0.22488984}, {-0.53294069, -0.98504567}, {0.05740348, 0.00179924}, {0.29767919, -0.12336609}, {0.37302625, 0.46284387}, {-0.52325064, -0.00985550}, {-0.04234622, -0.54987586}, {-0.17550774, 0.12081487}, {0.81387901, 0.83541310}, {-0.44954929, 0.29283035}, {-0.90360534, -0.85689718}, {0.02338342, 0.75484818}, {-0.68106455, 0.53205574}, {0.76601923, -0.37639597}, {0.38511392, 0.69798225}, {-0.25677133, 0.40256533}, {0.47283623, 0.18915559}, {0.71255422, 0.79320872}, {0.92015761, 0.14246538}, {-0.64744818, -0.49880919}, {-0.56476265, 0.13903470}, {0.51550025, -0.89573354}, {0.36327291, 0.43430653}, {-0.30403697, 0.03011161}, {-0.67040372, 0.45979229}, {-0.91858262, 0.96244210}, {0.61588746, 0.25689700}, {-0.46494752, 0.82572573}, {0.91887766, -0.72174770}, {0.55151451, 0.68386173}, {0.31943470, 0.40081555}, {-0.10988253, 0.84861559}, {0.94241506, -0.23529337}, {0.60542303, -0.13415682}, {-0.67049158, -0.34906545}, {-0.74733984, 0.81776953}, {0.91884816, -0.76162654}, {0.20135815, -0.18355180}, {-0.76381993, -0.40904897}, {-0.50356728, 0.49915361}, {-0.99198210, -0.62032259}, {-0.12245386, -0.95793062}, {0.25505316, 0.21125507}, {0.67066473, -0.58678836}, {-0.43043676, 0.08467886}, {-0.45354861, 0.17147619}, {-0.49823555, 0.36705431}, {0.58218145, 0.61730921}, {0.94723225, 0.09075401}, {-0.01838144, 0.71139538}, {0.53813475, 0.14108926}, {-0.23348723, -0.43190512}, {-0.78372163, 0.61509818}, {-0.76385695, 0.49453047}, {0.09057418, 0.92989063}, {0.52213132, 0.94703954}, {-0.72681195, 0.00074295}, {0.14515658, -0.37749708}, {0.00606498, -0.28636247}, {0.05678794, -0.99831057}, {-0.11537134, -0.10089571}, {-0.39040163, -0.20119449}, {0.56617463, 0.36682576}, {-0.01540173, 0.29533648}})},
outputs = {radio.types.ComplexFloat32.vector_from_array({{-0.73127151, 0.69486749}, {0.08622092, 0.71472991}, {-0.09325244, 0.03989922}, {0.10990612, 0.64287406}, {1.21160972, 0.28570315}, {-0.13446586, -0.67153019}, {1.00968754, -0.49728063}, {-0.03303955, -0.45514676}, {0.67932099, 0.79111737}, {1.23142767, 0.09769869}, {0.94910830, -0.08282494}, {0.32403523, -0.85021108}, {-0.02700812, -0.58719462}, {0.72381365, 0.82044274}, {-0.10542300, 0.06624157}, {0.53826690, -0.53383112}, {0.40753287, 0.39595568}, {-0.69559479, -0.78025860}, {-0.31601715, 0.60722077}, {-0.67549139, 0.13900222}, {0.98508680, 0.71989304}, {0.71637547, -0.41673431}, {0.26482576, -0.55181205}, {0.87829989, 0.12157384}, {-0.73421514, 0.11242002}, {0.17516121, 0.39326301}, {0.21188459, 1.00979018}, {-0.06505685, -0.16602679}, {-0.77701652, 0.72638905}, {0.48826253, 0.38048029}, {0.65398520, -0.09759752}, {0.52101278, -0.12340644}, {0.03866409, -0.27605280}, {0.15605888, -0.53483719}, {-0.09160709, -0.19733147}, {0.94085008, -0.02061296}, {0.97774309, 0.20758376}, {0.97666836, -0.12138042}, {0.69279206, 0.00134997}, {0.77738482, -0.57033712}, {0.54104626, 0.07923490}, {0.00980207, 0.89780700}, {0.85213280, -0.30583552}, {0.17323250, -0.02965624}, {0.31689060, -0.34888789}, {-0.98858166, -0.91423255}, {0.08221003, 0.85201383}, {-0.88319647, -0.21879259}, {0.22658719, -0.57647526}, {0.19171828, 0.01239349}, {0.88775343, -0.74002033}, {-0.40338087, -0.46612123}, {0.03159156, -0.00033793}, {0.17727262, 0.38128588}, {0.20743056, 0.15457559}, {0.08370640, 0.22490492}, {0.44588417, 0.99240696}, {-0.56178105, 0.36014855}, {-0.79078037, 0.50223422}, {0.16274726, -0.85270840}, {-0.48941192, 0.68348968}, {0.47083417, 0.77004123}, {-0.62466013, 1.21932745}, {0.64093584, -0.31840533}, {0.48514703, -0.66100764}, {-0.86096931, 0.31115428}, {-0.58292502, -0.35583174}, {0.77157241, 0.22684470}, {0.04460716, -0.43046394}, {-0.16681005, -0.31884119}, {0.95273077, 0.22688580}, {-0.59772867, -0.23877552}, {-1.00229859, -0.49707812}, {-0.19903341, 0.54708987}, {0.54364556, 0.38878351}, {0.96427095, -0.95836377}, {0.82929349, 0.06152588}, {-0.51983231, 0.59917396}, {-0.19514728, 0.31128305}, {1.09798276, -0.10701579}, {0.59562171, 0.03319904}, {0.08511442, -0.62245840}, {0.20922421, 0.15304048}, {-0.42094094, 0.13860145}, {0.95065361, -0.19281676}, {0.75106847, -0.93580663}, {-0.73473203, 0.35248232}, {0.08921465, -0.95277804}, {-0.00874710, -0.51562369}, {0.50417513, -0.97850919}, {-0.75743574, 0.92416686}, {1.12335098, 0.02652711}, {0.66824734, -0.06933202}, {-0.40675196, -1.12847531}, {0.34054807, -0.22548556}, {0.30613822, -0.24406233}, {0.68081665, 0.06411231}, {-0.31658152, -0.54038179}, {-0.07119070, -0.85499728}, {0.23940720, 0.33019653}, {-0.34930867, 0.74324304}, {0.30989194, 1.21320868}, {-0.14277364, 0.67547351}, {0.75170523, 0.83874142}, {0.59770238, 0.27517313}, {0.67540216, -0.34891015}, {0.88285959, 0.25541052}, {-0.84299558, -0.11957271}, {0.91391122, 0.32954580}, {-0.67675924, -0.16431054}, {0.83063954, 0.66061169}, {0.01871791, -1.00241828}, {-0.03046592, 0.55480075}, {-0.73038578, 0.04004218}, {-0.50386506, -0.15006481}, {-0.20796506, 0.73483962}, {-0.27982751, -1.16067863}, {-0.66198814, 0.32270062}, {1.12118351, -0.46788523}, {1.09421408, 0.26013082}, {0.57623291, 0.65701193}, {0.00066130, -0.39284259}, {-0.40620843, -0.46083686}, {0.30538857, -0.48178166}, {0.95098644, -0.11424118}, {0.12889367, -0.78153634}, {0.73741835, 0.43136567}, {0.24643874, -0.68364292}, {-0.72493321, -0.92481673}, {0.86100149, -0.20427343}, {0.76979506, -0.77012014}, {-0.96201682, 0.43817827}, {0.45193964, 0.87971640}, {0.52568352, 0.87027246}, {-0.13154399, 0.69878936}, {-0.82152885, -0.79433179}, {0.74978006, -0.61780959}, {0.65108746, -0.64470398}, {0.19613031, -0.45483324}, {0.71609873, 0.46825886}, {-0.92075950, -0.97898769}, {-0.23650375, 1.02118230}, {-0.15508530, -0.15269050}, {-0.08505830, -0.94668913}, {-1.22118092, -0.27420241}, {-0.77727538, -0.93959302}, {-0.59931725, -0.14419484}, {-0.93944645, 0.21500143}, {0.42413509, -0.25793910}, {-0.35052526, -0.34090066}, {0.38535777, 0.50723761}, {-0.84682506, 0.41965893}, {0.39783907, 0.88723898}, {-0.20047429, -0.36683640}, {0.58437324, -0.69532394}, {0.34551716, -0.38643140}, {0.70461017, -0.34623510}, {0.62661135, -0.61827552}, {0.01826586, -0.34244940}, {0.06241770, -0.24061185}, {-0.50980401, -0.95925194}, {0.99321759, 0.08815300}, {-0.84781194, 0.16779104}, {-0.89182186, -0.00507218}, {-0.00502598, -0.71866888}, {0.72529793, 0.01347791}, {-0.56122971, -0.40422314}, {-0.29972970, 0.98670018}, {-0.34389225, -1.05642986}, {-0.45987487, 1.01694489}, {-0.64310026, 0.36043200}, {-0.43891075, 0.65296429}, {0.65198320, 0.67003387}, {-0.97042733, 0.43820763}, {0.11372417, -1.24017847}, {-0.80617654, -0.36786264}, {-0.01301187, -1.01599312}, {0.80023575, 0.25769585}, {0.49500957, 0.55954272}, {-0.47434568, 0.51116031}, {0.42964891, 0.33555749}, {0.99564475, 0.11173820}, {0.29994315, -1.07192290}, {0.06814419, 0.10915546}, {-0.51351571, 0.48851582}, {-0.32266170, 0.20857909}, {0.16747710, -1.05404758}, {-0.22705103, 0.24898086}, {-0.78887832, -0.40479621}, {0.41474441, -0.65992898}, {0.74974197, 0.48177409}, {0.22131813, -0.65237343}, {-0.27501756, -0.11865816}, {0.20246089, 1.10152185}, {0.04749795, -0.03228530}, {0.12336609, 0.29767919}, {-0.02973178, -0.59370792}, {-0.50068647, 0.15232021}, {0.53604877, 0.12964734}, {0.20090213, 0.07097554}, {0.81387901, 0.83541310}, {0.02733372, -0.53581440}, {-0.53572828, 1.12417555}, {-0.21102197, 0.72512919}, {0.23825827, -0.83076179}, {-0.37639597, -0.76601923}, {-0.09869996, 0.79104376}, {0.11980451, -0.46220911}, {0.32601210, -0.39124167}, {-0.22289050, 1.04270482}, {-0.92015761, -0.14246538}, {-0.78410560, 0.23060387}, {-0.30675113, -0.49415714}, {-0.76706672, 0.69259489}, {0.54917294, 0.13783491}, {-0.03011161, -0.30403697}, {0.81262708, 0.02207363}, {-0.57621306, 1.19919443}, {-0.43464327, 0.50635827}, {0.94131541, -0.10919896}, {0.91887766, -0.72174770}, {-0.87742788, 0.04422078}, {0.28248751, -0.42765927}, {-0.36674115, 0.77312583}, {-0.62412786, 0.74429405}, {-0.13415682, -0.60542303}, {-0.33726358, -0.67650497}, {0.45805776, -1.00868583}, {-0.44041023, -1.10923219}, {0.26685187, 0.05501314}, {0.76381993, 0.40904897}, {0.10783434, 0.70078963}, {0.28342250, -1.13512135}, {-0.17955630, 0.94888651}, {0.33051497, 0.02099246}, {0.58678836, 0.67066473}, {0.39800364, 0.18449774}, {-0.37836131, 0.30323780}, {-0.19512616, -0.58727622}, {0.15721598, -0.83383989}, {0.94723225, 0.09075401}, {-0.56472659, -0.43301862}, {-0.03210892, -0.55539560}, {-0.08859354, -0.48291773}, {0.27249849, -0.95828485}, {0.49453047, 0.76385695}, {-0.47329992, 0.80553550}, {-0.78922772, -0.73934072}, {-0.22389066, 0.69146883}, {0.39072245, -0.10445308}, {-0.00606498, 0.28636247}, {-0.77427107, -0.63273466}, {0.06030582, -0.14090315}, {0.30912149, 0.31198809}, {0.67365968, -0.03602082}, {-0.29533648, -0.01540173}})}
},
}, {epsilon = (radio.platform.features.liquid and not radio.platform.features.volk) and 5e-3 or 1e-5})
|
-- wrapper around BitOp module
if _VERSION == "Lua 5.1" or type(jit) == "table" then -- Lua 5.1 or LuaJIT (based on Lua 5.1)
return require("bit") -- custom module https://luarocks.org/modules/luarocks/luabitop
elseif _VERSION == "Lua 5.2" then
return require("bit32") -- standard Lua 5.2 module
else
return require("mqtt.bit53")
end
-- vim: ts=4 sts=4 sw=4 noet ft=lua
|
-- $Id: lups_wrapper.lua 3171 2008-11-06 09:06:29Z det $
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
--
-- file: lups.lua
-- brief: Lups (Lua Particle System) Gadget Wrapper
-- authors: jK
-- last updated: 07 Nov. 2007
--
-- Copyright (C) 2007.
-- Licensed under the terms of the GNU GPL, v2 or later.
--
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
if (not gadgetHandler:IsSyncedCode()) then
VFS.Include("lups/lups.lua",nil,VFS.ZIP_ONLY)
end
|
local rpc = require "rpc"
local shortport = require "shortport"
local stdnse = require "stdnse"
local string = require "string"
local ls = require "ls"
local table = require "table"
local nmap = require "nmap"
description = [[
Attempts to get useful information about files from NFS exports.
The output is intended to resemble the output of <code>ls</code>.
The script starts by enumerating and mounting the remote NFS exports. After
that it performs an NFS GETATTR procedure call for each mounted point
in order to get its ACLs.
For each mounted directory the script will try to list its file entries
with their attributes.
Since the file attributes shown in the results are the result of
GETATTR, READDIRPLUS, and similar procedures, the attributes
are the attributes of the local filesystem.
These access permissions are shown only with NFSv3:
* Read: Read data from file or read a directory.
* Lookup: Look up a name in a directory
(no meaning for non-directory objects).
* Modify: Rewrite existing file data or modify existing
directory entries.
* Extend: Write new data or add directory entries.
* Delete: Delete an existing directory entry.
* Execute: Execute file (no meaning for a directory).
Recursive listing is not implemented.
]]
---
-- @usage
-- nmap -p 111 --script=nfs-ls <target>
-- nmap -sV --script=nfs-ls <target>
--
-- @args nfs-ls.time Specifies which one of the last mac times to use in
-- the files attributes output. Possible values are:
-- * <code>m</code>: last modification time (mtime)
-- * <code>a</code>: last access time (atime)
-- * <code>c</code>: last change time (ctime)
-- The default value is <code>m</code> (mtime).
-- @args nfs.version The NFS protocol version to use
--
-- @output
-- PORT STATE SERVICE
-- 111/tcp open rpcbind
-- | nfs-ls:
-- | Volume /mnt/nfs/files
-- | access: Read Lookup NoModify NoExtend NoDelete NoExecute
-- | PERMISSION UID GID SIZE MODIFICATION TIME FILENAME
-- | drwxr-xr-x 1000 100 4096 2010-06-17 12:28 /mnt/nfs/files
-- | drwxr--r-- 1000 1002 4096 2010-05-14 12:58 sources
-- | -rw------- 1000 1002 23606 2010-06-17 12:28 notes
-- |
-- | Volume /home/storage/backup
-- | access: Read Lookup Modify Extend Delete NoExecute
-- | PERMISSION UID GID SIZE MODIFICATION TIME FILENAME
-- | drwxr-xr-x 1000 100 4096 2010-06-11 22:31 /home/storage/backup
-- | -rw-r--r-- 1000 1002 0 2010-06-10 08:34 filetest
-- | drwx------ 1000 100 16384 2010-02-05 17:05 lost+found
-- | -rw-r--r-- 0 0 5 2010-06-10 11:32 rootfile
-- | lrwxrwxrwx 1000 1002 8 2010-06-10 08:34 symlink
-- |_
--
-- @xmloutput
-- <table key="volumes">
-- <table>
-- <elem key="volume">/mnt/nfs/files</elem>
-- <table key="files">
-- <table>
-- <elem key="permission">drwxr-xr-x</elem>
-- <elem key="uid">1000</elem>
-- <elem key="gid">100</elem>
-- <elem key="size">4096</elem>
-- <elem key="time">2010-06-11 22:31</elem>
-- <elem key="filename">/mnt/nfs/files</elem>
-- </table>
-- <table>
-- <elem key="permission">-rw-r--r--</elem>
-- <elem key="uid">1000</elem>
-- <elem key="gid">1002</elem>
-- <elem key="size">0</elem>
-- <elem key="time">2010-06-10 08:34</elem>
-- <elem key="filename">filetest</elem>
-- </table>
-- <table>
-- <elem key="permission">drwx------</elem>
-- <elem key="uid">0</elem>
-- <elem key="gid">0</elem>
-- <elem key="size">16384</elem>
-- <elem key="time">2010-02-05 17:05</elem>
-- <elem key="filename">lost+found</elem>
-- </table>
-- <table>
-- <elem key="permission">-rw-r--r--</elem>
-- <elem key="uid">0</elem>
-- <elem key="gid">0</elem>
-- <elem key="size">5</elem>
-- <elem key="time">2010-06-10 11:32</elem>
-- <elem key="filename">rootfile</elem>
-- </table>
-- <table>
-- <elem key="permission">lrwxrwxrwx</elem>
-- <elem key="uid">1000</elem>
-- <elem key="gid">1002</elem>
-- <elem key="size">8</elem>
-- <elem key="time">2010-06-10 08:34</elem>
-- <elem key="filename">symlink</elem>
-- </table>
-- </table>
-- <table key="info">
-- <elem>access: Read Lookup NoModify NoExtend NoDelete NoExecute</elem>
-- </table>
-- </table>
-- </table>
-- <table key="total">
-- <elem key="files">5</elem>
-- <elem key="bytes">20493</elem>
-- </table>
-- Created 05/28/2010 - v0.1 - combined nfs-dirlist and nfs-acls scripts
-- Revised 06/04/2010 - v0.2 - make NFS exports listing with their acls
-- default action.
-- Revised 06/07/2010 - v0.3 - added mactimes output.
-- Revised 06/10/2010 - v0.4 - use the new library functions and list
-- entries with their attributes.
-- Revised 06/11/2010 - v0.5 - make the mtime the default time to show.
-- Revised 06/12/2010 - v0.6 - reworked the output to use the tab
-- library.
-- Revised 06/27/2010 - v0.7 - added NFSv3 ACCESS support.
-- Revised 06/28/2010 - v0.8 - added NFSv2 support.
--
author = {"Patrik Karlsson", "Djalal Harouni"}
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
categories = {"discovery", "safe"}
dependencies = {"rpc-grind"}
portrule = shortport.port_or_service(111, "rpcbind", {"tcp", "udp"} )
hostrule = function(host)
local mountport, nfsport
if host.registry.nfs then
mountport = host.registry.nfs.mountport
nfsport = host.registry.nfs.nfsport
else
host.registry.nfs = {}
end
for _,proto in ipairs({"tcp","udp"}) do
local port = nmap.get_ports(host, nil, proto, "open")
while port do
if port.version then
if port.service == "mountd" then
mountport = port
elseif port.service == "nfs" then
nfsport = port
end
end
if mountport and nfsport then break end
port = nmap.get_ports(host, port, proto, "open")
end
if mountport and nfsport then break end
end
-- Run when nfs and mount ports were scanned and their versions numbers known
if not (nfsport and (host.registry.nfs.nfsver or nfsport.version.version)) then
return false
end
if not (mountport and (host.registry.nfs.mountver or mountport.version.version)) then
return false
end
if host.registry.nfs.nfsver == nil then
local low, high = string.match(nfsport.version.version, "(%d)%-(%d)")
if high == nil then
high = tonumber(nfsport.version.version)
if high == 4 then
return false --Can't support version 4
else
host.registry.nfs.nfsver = high
end
else
if high == "4" then
host.registry.nfs.nfsver = 3
else
host.registry.nfs.nfsver = tonumber(low)
end
end
end
if host.registry.nfs.mountver == nil then
local low, high = string.match(mountport.version.version, "(%d)%-(%d)")
if high == nil then
host.registry.nfs.mountver = tonumber(mountport.version.version)
else
host.registry.nfs.mountver = tonumber(high)
end
end
host.registry.nfs.mountport = mountport
host.registry.nfs.nfsport = nfsport
return (mountport and nfsport)
end
local procedures = { }
local function table_attributes(nfs, mount, attr)
local file = {}
if attr.mode then
file.type = rpc.Util.FtypeToChar(attr.mode)
file.mode = rpc.Util.FpermToString(attr.mode)
file.uid = tostring(attr.uid)
file.gid = tostring(attr.gid)
if nfs.human then
file.size = rpc.Util.SizeToHuman(attr.size)
else
file.size = tostring(attr.size)
end
file.time = rpc.Util.TimeToString(attr[nfs.time].seconds)
else
file.type = '?'
file.mode = '?????????'
file.uid = '?'
file.gid = '?'
file.size = '?'
file.time = '?'
end
file.filename = mount
return file
end
local function table_dirlist(nfs, mount, dirlist)
local ret, files, attrs = {}, {}, {}
local idx = 1
for _, v in ipairs(dirlist) do
if ((0 < nfs.maxfiles) and (#files >= nfs.maxfiles)) then
break
end
if v.attributes then
table.insert(files, v.name)
attrs[files[idx]] = table_attributes(nfs, v.name, v.attributes)
idx = idx + 1
else
stdnse.debug1("ERROR attributes: %s", v.name)
end
end
table.sort(files)
for _, v in pairs(files) do
table.insert(ret, attrs[v])
end
return ret
end
-- Unmount the NFS file system and close the connections
local function unmount_nfs(mount, mnt_obj, nfs_obj)
rpc.Helper.NfsClose(nfs_obj)
rpc.Helper.UnmountPath(mnt_obj, mount)
end
local function nfs_ls(nfs, mount, output)
local dirs, attr, acs = {}, {}, {}
local nfsobj = rpc.NFS:new()
local mnt_comm, nfs_comm, fhandle
mnt_comm, fhandle = procedures.MountPath(nfs.host, mount)
if mnt_comm == nil then
ls.report_error(output, fhandle)
return false
end
local nfs_comm, status = procedures.NfsOpen(nfs.host)
if nfs_comm == nil then
rpc.Helper.UnmountPath(mnt_comm, mount)
ls.report_error(output, status)
return false
end
-- check if NFS and Mount versions are compatible
-- RPC library will check if the Mount and NFS versions are supported
if (nfs_comm.version == 1) then
unmount_nfs(mount, mnt_comm, nfs_comm)
ls.report_error(output,
string.format("NFS v%d not supported", nfs_comm.version))
return false
elseif ((nfs_comm.version == 2 and mnt_comm.version > 2) or
(nfs_comm.version == 3 and mnt_comm.version ~= 3)) then
unmount_nfs(mount, mnt_comm, nfs_comm)
ls.report_error(output,
string.format("versions mismatch, NFS v%d - Mount v%d",
nfs_comm.version, mnt_comm.version))
return false
end
status, attr = nfsobj:GetAttr(nfs_comm, fhandle)
if not status then
unmount_nfs(mount, mnt_comm, nfs_comm)
ls.report_error(output, attr)
return status
end
if nfs_comm.version == 3 then
status, acs = nfsobj:Access(nfs_comm, fhandle, 0x0000003F)
if status then
acs.str = rpc.Util.format_access(acs.mask, nfs_comm.version)
ls.report_info(output, string.format("access: %s", acs.str))
end
status, dirs = nfsobj:ReadDirPlus(nfs_comm, fhandle)
if status then
for _,v in ipairs(table_dirlist(nfs, mount, dirs.entries)) do
ls.add_file(output, {v.type .. v.mode, v.uid, v.gid, v.size,
v.time, v.filename})
end
end
elseif nfs_comm.version == 2 then
status, dirs = nfsobj:ReadDir(nfs_comm, fhandle)
if status then
local lookup = {}
for _, v in ipairs(dirs.entries) do
if ((0 < nfs.maxfiles) and (#lookup >= nfs.maxfiles)) then
break
end
local f = {}
status, f = nfsobj:LookUp(nfs_comm, fhandle, v.name)
f.name = v.name
table.insert(lookup, f)
end
for _, v in ipairs(table_dirlist(nfs, mount, lookup)) do
ls.add_file(output, {v.type .. v.mode, v.uid, v.gid, v.size,
v.time, v.filename})
end
end
end
unmount_nfs(mount, mnt_comm, nfs_comm)
return status
end
local mainaction = function(host)
local results, mounts, status = {}, {}
local nfs_info =
{
host = host,
--recurs = tonumber(nmap.registry.args['nfs-ls.recurs']) or 1,
}
local output = ls.new_listing()
nfs_info.version, nfs_info.time = stdnse.get_script_args('nfs.version',
'nfs-ls.time')
nfs_info.maxfiles = ls.config('maxfiles')
nfs_info.human = ls.config('human')
if nfs_info.time == "a" or nfs_info.time == "A" then
nfs_info.time = "atime"
elseif nfs_info.time == "c" or nfs_info.time == "C" then
nfs_info.time = "ctime"
else
nfs_info.time = "mtime"
end
status, mounts = procedures.ShowMounts(nfs_info.host)
if not status or mounts == nil then
if mounts then
return stdnse.format_output(false, mounts)
else
return stdnse.format_output(false, "Mount error")
end
end
for _, v in ipairs(mounts) do
local err
ls.new_vol(output, v.name, true)
status = nfs_ls(nfs_info, v.name, output)
ls.end_vol(output)
end
return ls.end_listing(output)
end
hostaction = function(host)
procedures = {
ShowMounts = function(ahost)
local mnt_comm, status, result, mounts
local mnt = rpc.Mount:new()
mnt_comm = rpc.Comm:new('mountd', host.registry.nfs.mountver)
status, result = mnt_comm:Connect(ahost, host.registry.nfs.mountport)
if ( not(status) ) then
stdnse.debug1("ShowMounts: %s", result)
return false, result
end
status, mounts = mnt:Export(mnt_comm)
mnt_comm:Disconnect()
if ( not(status) ) then
stdnse.debug1("ShowMounts: %s", mounts)
end
return status, mounts
end,
MountPath = function(ahost, path)
local fhandle, status, err
local mountd, mnt_comm
local mnt = rpc.Mount:new()
mnt_comm = rpc.Comm:new("mountd", host.registry.nfs.mountver)
status, err = mnt_comm:Connect(host, host.registry.nfs.mountport)
if not status then
stdnse.debug1("MountPath: %s", err)
return nil, err
end
status, fhandle = mnt:Mount(mnt_comm, path)
if not status then
mnt_comm:Disconnect()
stdnse.debug1("MountPath: %s", fhandle)
return nil, fhandle
end
return mnt_comm, fhandle
end,
NfsOpen = function(ahost)
local nfs_comm, status, err
nfs_comm = rpc.Comm:new('nfs', host.registry.nfs.nfsver)
status, err = nfs_comm:Connect(host, host.registry.nfs.nfsport)
if not status then
stdnse.debug1("NfsOpen: %s", err)
return nil, err
end
return nfs_comm, nil
end,
}
return mainaction(host)
end
portaction = function(host, port)
procedures = {
ShowMounts = function(ahost)
return rpc.Helper.ShowMounts(ahost, port)
end,
MountPath = function(ahost, path)
return rpc.Helper.MountPath(ahost, port, path)
end,
NfsOpen = function(ahost)
return rpc.Helper.NfsOpen(ahost, port)
end,
}
return mainaction(host)
end
local ActionsTable = {
-- portrule: use rpcbind service
portrule = portaction,
-- hostrule: Talk to services directly
hostrule = hostaction
}
action = function(...) return ActionsTable[SCRIPT_TYPE](...) end
|
player_manager.AddValidModel( "PMC5_13", "models/player/PMC_5/PMC__13.mdl" ) list.Set( "PlayerOptionsModel", "PMC5_13", "models/player/PMC_5/PMC__13.mdl" )
|
return {'vwo','vwoer','vwoers'}
|
local L = Grid2Options.L
local DISPLAY_VALUES = { [1] = L["Never"], [2] = L["Always"], [3] = L["In Combat"], [4] = L["Out of Combat"] }
local ANCHOR_VALUES = { ['@'] = L["Default"], ANCHOR_TOP = L["TOP"], ANCHOR_BOTTOM = L["BOTTOM"], ANCHOR_LEFT = L["LEFT"], ANCHOR_RIGHT = L["RIGHT"], ANCHOR_TOPLEFT = L["TOPLEFT"], ANCHOR_TOPRIGHT = L["TOPRIGHT"], ANCHOR_BOTTOMLEFT = L["BOTTOMLEFT"], ANCHOR_BOTTOMRIGHT = L["BOTTOMRIGHT"] }
local function AdvancedTooltipsEnabled(indicator)
return not indicator.dbx.showDefault or #indicator.statuses>0
end
Grid2Options:RegisterIndicatorOptions("tooltip", false, function(self, indicator)
if indicator.dbx.showTooltip~=1 and AdvancedTooltipsEnabled(indicator) then
local layout, statuses = {}, {}
self:MakeIndicatorStatusOptions(indicator, statuses)
self:MakeIndicatorTooltipOptions(indicator,layout)
self:AddIndicatorOptions(indicator, statuses, layout )
else
local layout = {}
self:MakeIndicatorTooltipOptions(indicator,layout)
self:AddIndicatorOptions(indicator, nil, layout )
end
end)
function Grid2Options:MakeIndicatorTooltipOptions(indicator, options)
options.tooltip = {
type = "select",
order = 10,
name = L["Show Tooltip"],
desc = L["Show tooltip when mouseover a unit."],
get = function ()
return indicator.dbx.showTooltip or 4
end,
set = function (_, v)
local refresh = (v==1 or indicator.dbx.showTooltip==1) and AdvancedTooltipsEnabled(indicator)
indicator.dbx.displayUnitOOC = nil
indicator.dbx.showTooltip = v
if not indicator.suspended then indicator:UpdateDB() end
if refresh then Grid2Options:MakeIndicatorOptions(indicator) end
end,
values= DISPLAY_VALUES,
}
options.anchor = {
type = "select",
name = L["Tooltip Anchor"],
desc = L["Sets where Tooltip is anchored relative to Grid2 window or select the game default anchor."],
order = 20,
get = function () return indicator.dbx.tooltipAnchor or "@" end,
set = function (_, v)
indicator.dbx.tooltipAnchor = v ~= '@' and v or nil
if not indicator.suspended then indicator:UpdateDB() end
end,
values = ANCHOR_VALUES,
hidden = function() return indicator.dbx.showTooltip==1 end,
}
options.advanced = {
type = "toggle",
width= "full",
name = "|cffffd200".. L["Enable Advanced Tooltips"] .."|r",
desc = L["Enable this option to be able to customize the tooltip. Once enabled you can go to the 'statuses' tab to select which information you want to display."],
order = 30,
get = function() return AdvancedTooltipsEnabled(indicator) end,
set = function(_,v)
indicator.dbx.showDefault = not v
if indicator.dbx.showDefault then -- Default unit tooltips
while #indicator.statuses>0 do -- unregister all statuses
Grid2:DbSetMap(indicator.name, indicator.statuses[1].name, nil)
indicator:UnregisterStatus(indicator.statuses[1])
end
indicator.dbx.displayUnitOOC = nil
else -- Advanced tooltips
Grid2:DbSetMap(indicator.name, "name", 50) -- register "name" status
indicator:RegisterStatus(Grid2:GetStatusByName("name"), 50)
end
if not indicator.suspended then indicator:UpdateDB() end
Grid2Options:MakeIndicatorOptions(indicator)
end,
confirm = function() return AdvancedTooltipsEnabled(indicator) and L["Are you sure you want to disable the advanced tooltips?"] end,
hidden = function() return indicator.dbx.showTooltip==1 end,
}
options.advancedOOC = {
type = "toggle",
width= "full",
name = L["Display default unit tooltip when Out of Combat"],
desc = L["Enable this option to display the default unit tooltip when Out of Combat."],
order = 35,
get = function() return indicator.dbx.displayUnitOOC end,
set = function(_,v)
indicator.dbx.displayUnitOOC = v or nil
if not indicator.suspended then indicator:UpdateDB() end
end,
hidden = function() return not AdvancedTooltipsEnabled(indicator) or indicator.dbx.showTooltip ~= 3 end,
}
end
|
function PLAYER:Notify ( Text, truefalse )
if !self or !self:IsValid() then return false; end
if SERVER then
umsg.Start('perp_notify', self);
umsg.String(Text);
umsg.End();
else
AddNotify(Text, NOTIFY_UNDO, 15, truefalse);
end
end
function PLAYER:GetRPName ( )
return self:GetUMsgString("rp_fname", "John") .. " " .. self:GetUMsgString("rp_lname", "Doe");
end
function PLAYER:GetFirstName ( )
return self:GetUMsgString("rp_fname", "John");
end
function PLAYER:GetLastName ( )
return self:GetUMsgString("rp_lname", "Doe");
end
function PLAYER:GetUMsgString ( ID, Default )
if (!self.StringRedun or !self.StringRedun[ID]) then return Default; end
return self.StringRedun[ID].value;
end
PLAYER.GetUMsgInt = PLAYER.GetUMsgString;
PLAYER.GetUMsgBool = PLAYER.GetUMsgString;
function PLAYER:GetPrivateString ( ID, Default )
if (!self.StringRedunP or !self.StringRedunP[ID]) then return Default; end
return self.StringRedunP[ID].value;
end
PLAYER.GetPrivateInt = PLAYER.GetPrivateString;
PLAYER.GetPrivateBool = PLAYER.GetPrivateString;
function PLAYER:SetPrivateString ( StringID, StringValue, stopSendToClient )
self.StringRedunP = self.StringRedunP or {};
if StringValue == nil then
self.StringRedun[StringID] = nil;
if SERVER && !stopSendToClient then
umsg.Start("perp_ps");
umsg.String(StringID);
umsg.Short(5);
umsg.End();
end
return;
end
self.StringRedunP[StringID] = {entity = self, value = StringValue};
if CLIENT || stopSendToClient then return; end
self:SendUMsgVar("perp_ps", self, nil, StringID, StringValue);
end
PLAYER.SetPrivateInt = PLAYER.SetPrivateString;
PLAYER.SetPrivateBool = PLAYER.SetPrivateString;
function GetVectorTraceUp ( vec )
local trace = {};
trace.start = vec;
trace.endpos = vec + Vector(0, 0, 999999999);
trace.mask = MASK_SOLID_BRUSHONLY;
return util.TraceLine(trace);
end
function PLAYER:GetUpTrace ( )
local ourEnt = self;
if (self:InVehicle()) then
ourEnt = self:GetVehicle();
end
return GetVectorTraceUp(ourEnt:GetPos());
end
function PLAYER:IsOutside ( ) return self:GetUpTrace().HitSky; end
function PLAYER:IsInside ( ) return !self:IsOutside(); end
function PLAYER:GetAccessLevel ( ) return self:GetLevel() end
function PLAYER:HasAccessLevel ( num ) return self:GetLevel() <= num; end
function PLAYER:GetCash ( ) return self:GetPrivateInt("cash", 0); end
function PLAYER:GetBank ( ) return self:GetPrivateInt("bank", 0); end
function PLAYER:GetFuel ( ) return self:GetPrivateInt("fuelleft", 0); end
function PLAYER:GetLastCar ( ) return self:GetPrivateString("lastcar") or "none"; end
function PLAYER:GetLastCarF ( ) return self:GetPrivateString("lastcarfuel"); end
function PLAYER:GetCarUsed ( ) return self:GetPrivateString("lastcarid"); end
function PLAYER:GetCUID ( ) return self:GetPrivateInt("cuid", 0); end
function PLAYER:SetCUID ( value, stopSendToClient) self:SetPrivateInt("cuid", value, stopSendToClient); end
function PLAYER:AddFuel ( value, stopSendToClient) self:SetPrivateInt("fuelleft", math.Clamp((self:GetFuel() + value) or 0, 0 , 10000),stopSendToClient); end
function PLAYER:TakeFuel ( value, stopSendToClient) self:SetPrivateInt("fuelleft", math.Clamp((self:GetFuel() - value) or 0,0,10000), stopSendToClient); end
function PLAYER:SetFuel ( value, stopSendToClient) self:SetPrivateInt("fuelleft", value, stopSendToClient); end
function PLAYER:SetLastCarF ( value, stopSendToClient) self:SetPrivateInt("lastcarfuel", value, stopSendToClient); end
if SERVER then
function PLAYER:SetCash ( value, stopSendToClient) self:SetPrivateInt("cash", value); end
function PLAYER:GiveCash ( value, stopSendToClient) self:SetPrivateInt("cash", self:GetCash() + value); end
function PLAYER:AddCash ( value, stopSendToClient) self:SetPrivateInt("cash", self:GetCash() + value); end
function PLAYER:TakeCash ( value, stopSendToClient) self:SetPrivateInt("cash", self:GetCash() - value); end
function PLAYER:RemoveCash ( value, stopSendToClient) self:SetPrivateInt("cash", self:GetCash() - value); end
function PLAYER:SetBank ( value, stopSendToClient) self:SetPrivateInt("bank", value); end
function PLAYER:GiveBank ( value, stopSendToClient) self:SetPrivateInt("bank", self:GetBank() + value); end
function PLAYER:AddBank ( value, stopSendToClient) self:SetPrivateInt("bank", self:GetBank() + value); end
function PLAYER:TakeBank ( value, stopSendToClient) self:SetPrivateInt("bank", self:GetBank() - value); end
function PLAYER:RemoveBank ( value, stopSendToClient) self:SetPrivateInt("bank", self:GetBank() - value); end
function PLAYER:SetLastCar ( value, stopSendToClient) self:SetPrivateInt("lastcar", value, stopSendToClient); end
function PLAYER:SetCarUsed ( value, stopSendToClient) self:SetPrivateInt("lastcarid", value, stopSendToClient); end
else
function PLAYER:SetCash ( value, stopSendToClient) end
function PLAYER:GiveCash ( value, stopSendToClient) end
function PLAYER:AddCash ( value, stopSendToClient) end
function PLAYER:TakeCash ( value, stopSendToClient) end
function PLAYER:RemoveCash ( value, stopSendToClient) end
function PLAYER:SetBank ( value, stopSendToClient) end
function PLAYER:GiveBank ( value, stopSendToClient) end
function PLAYER:AddBank ( value, stopSendToClient) end
function PLAYER:TakeBank ( value, stopSendToClient) end
function PLAYER:RemoveBank ( value, stopSendToClient) end
function PLAYER:SetLastCar ( value, stopSendToClient) end
function PLAYER:SetCarUsed ( value, stopSendToClient) end
end
function PLAYER:CalculateStaminaLoss ()
if (!self || !IsValid(self)) then return; end
if (!self.Stamina) then return; end
if string.find(self:GetModel(), "zomb") then return; end // Zombie (Infinite Stamina)
if (self:SteamID() == "STEAM_0:0:21513525") then return; end //<- Misha's Steam ID
local realSpeed = self:GetVelocity():Length();
if (self:GetUMsgInt("typing", nil) && realSpeed >= 20 && self.StartedTyping && self.StartedTyping + 2 < CurTime()) then
self.StartedTyping = nil;
self:SetUMsgInt("typing", nil)
end
if ((!self:InVehicle() && ((!self.Crippled && self:KeyDown(IN_SPEED) && realSpeed >= 50))) && self:GetMoveType() != MOVETYPE_NOCLIP) then
// Take
self.LastStaminaSteal = self.LastStaminaSteal or 0;
self.NextStaminaExperience = self.NextStaminaExperience or 5;
if (self.LastStaminaSteal + (GAMEMODE.SprintDecay * (1 + (self:GetPERPLevel(SKILL_STAMINA) - 1) * .2)) <= CurTime()) then
self.Stamina = math.Clamp(self.Stamina - 1, 0, 100);
if (SERVER && self.Stamina == 25) then
self:SetUMsgInt("tired", 1);
end
self.LastStaminaSteal = CurTime();
self.LastStaminaAdd = CurTime();
self.NextStaminaExperience = self.NextStaminaExperience - 1;
if (self.Stamina != 0 && self.NextStaminaExperience == 0) then
self.NextStaminaExperience = 5;
self:GiveExperience(SKILL_STAMINA, GAMEMODE.ExperienceForSprint, true);
end
end
elseif (self:OnGround() || self:InVehicle() || !self:OnGround()) then
// Restore
self.LastStaminaAdd = self.LastStaminaAdd or 0;
if (self.LastStaminaAdd + (GAMEMODE.SprintDecay * 6) <= CurTime()) then
self.Stamina = math.Clamp(self.Stamina + 1, 0, 100);
if (SERVER && self.Stamina >= 26 && self:GetUMsgInt("tired", 0) == 1) then
self:SetUMsgInt("tired", nil);
end
self.LastStaminaAdd = CurTime();
end
end
if SERVER then self:FindRunSpeed(); end
end
function PLAYER:CalculateRegeneration ( )
if (self:GetPERPLevel(GENE_REGENERATION) <= 0) then return; end
if (!self:Alive()) then return; end
if (self:Health() >= 100) then return; end
if (self:GetPERPLevel(GENE_REGENERATION) == 1) then
NewHealth = math.Approach(self:Health(), 100, 1);
elseif (self:GetPERPLevel(GENE_REGENERATION) == 2) then
NewHealth = math.Approach(self:Health(), 100, 2);
elseif (self:GetPERPLevel(GENE_REGENERATION) == 3) then
NewHealth = math.Approach(self:Health(), 100, 3);
elseif (self:GetPERPLevel(GENE_REGENERATION) == 4) then
NewHealth = math.Approach(self:Health(), 100, 4);
elseif (self:GetPERPLevel(GENE_REGENERATION) == 5) then
NewHealth = math.Approach(self:Health(), 100, 5);
end;
self:SetHealth(NewHealth);
end
function PLAYER:IsGovernmentOfficial ( )
return self:Team() != TEAM_CITIZEN;
end
function PLAYER:IsValidZombie ( )
return string.find(self:GetModel(), "zomb")
end
function PLAYER:HasBlacklist ( blacklistID, recompiling )
if (string.find(self:GetPrivateString("blacklists", ""), blacklistID)) then
local explodedString = string.Explode(";", self:GetPrivateString("blacklists", ""));
for _, chunk in pairs(explodedString) do
local explodedMore = string.Explode(",", chunk);
if (#explodedMore == 2) then
if (explodedMore[1] == blacklistID) then
local expires = tonumber(explodedMore[2]);
if (SERVER && expires != 0 && expires <= os.time()) then
if (!recompiling) then
self:RecompileBlacklists();
end
return false;
else
return expires;
end
end
end
end
end
return false;
end
function PLAYER:GetTimePlayed ( )
if CLIENT then
GAMEMODE.LoadTime = GAMEMODE.LoadTime or 0;
return self:GetPrivateInt("time_played", 0) + (CurTime() - GAMEMODE.LoadTime);
else
return self:GetPrivateInt("time_played", 0) + (CurTime() - self.joinTime);
end
end
|
local L = LibStub("AceLocale-3.0"):NewLocale("AbyssUI", "frFR")
if not L then return end
-- Traducteur : Besoin d'un Traducteur
-- Exemple
-- L ["Texte Anglais"] = "Votre traduction"
--------------------------------------------------------------
-- Config
L["Info Panel"] = "Informations"
L["Hide Elements"] = "Masquer les éléments"
L["Miscellaneous"] = "Plusieurs"
L["Art & Themes"] = "Art et Thèmes"
L["Colorization"] = "Colorisation"
L["Tweaks & Extra"] = "Ajustements et extras"
L["Scale & Frame Size"] = "Échelle et tailles"
L["Thanks & Translations"] = "Merci et traductions"
-- Daily Info
L["Thank you for choosing Abyss|cff0d75d4UI|r!"] = "Merci d’avoir choisi Abyss|cff0d75d4UI|r!"
L["The improved World of Warcraft user interface."] = "L’interface de World of Warcraft Amélioré."
L["|cfff2dc7fAbyssUI Daily Info|r"] = "|cfff2dc7fAbyssUI Informations quotidiennes|r"
L["Not available right now!"] = "Non disponible maintenant!"
L["|cfff2dc7fTime since last login: |r"] = "|cfff2dc7fTemps depuis la dernière connexion: |r"
L[" you were gone for |cffffcc00"] = " vous êtes sorti par |cffffcc00"
L["Type |cffffcc00/abyssui|r for a list of commands"] = "Type |cffffcc00/abyssui|r pour la liste de commandes"
L["Current Time"] = "Heure actuelle"
L["Honor Level"] = "Niveau d’honneur"
L["|cfff2dc7fWoW Version"] = "|cfff2dc7fVersion de WoW"
L["|cfff2dc7fAbyssUI Version"] = "|cfff2dc7fVersion de AbyssUI"
--
L["Thank you for using Abyss|cff0d75d4UI|r. If you enjoy this addon,"..
" consider sharing with your friends or even making a donation."..
"It helps a lot! This is a minimalist UI that makes changes directly to the WoW frames,"..
"using nearly the same amount of CPU/RAM as the Blizzard default UI.\n\n"..
"Options that have a different text color are based on your choice in the setup."..
" Those options are set by default if you choose recommended settings.\n"..
"Check the options by clicking in the (+) button on the left."] = "Merci d’utiliser Abyss|cff0d75d4UI|r. Si vous avez aimé cet addon,"..
" envisager de partager avec vos amis ou même faire un don."..
" Cela aide beaucoup! Interface minimaliste apportant des modifications directement dans les cadres wow,"..
" en utilisant peu de CPU/RAM ainsi que l’interface standard de la Blizzard.\n\n"..
"Les options avec différentes couleurs sont basées sur vos choix dans la configuration."..
" Ces options sont définies par défaut si vous avez choisi les options recommandées.\n"..
"Consultez les options en cliquant sur le (+) à gauche."
-- Config Options
L["- General"] = "- Généralités"
L["- Frames"] = "- Cadres"
L["Player Portrait"] = "Portrait du joueur"
L["- Portrait Art"] = "- Portrait Art"
L["Frame Colorization"] = "Colorisation du cadre"
L["- Preset Colors"] = "- Couleurs prédéfinies"
L["- Choose a Color"] = "- Choisir une couleur"
L["- UnitFrame Art"] = "- UnitFrame Art"
L["Setup"] = "Configuration"
L["Clear Bars"] = "Barres claires"
L["DailyInfo"] = "Informations quotidiennes"
L["Reload UI"] = "Rechargez IU"
L["Donate"] = "Dons"
-- Config Info Panel
L["In this page you can find links to some other AddOns/Packs that make AbyssUI even better." ..
"These addons are verify to especially work with AbyssUI without any conflict or problem."..
"Click on the image so you can get the respective link. Don't forget to check then out!"] = "Sur cette page, vous pouvez trouver des liens vers d’autres Addons /Packages qui rendent AbyssUI encore mieux."..
" Ces addons sont vérifiés pour travailler avec le AbyssUI pas de conflits ou d’erreurs."..
" Cliquez sur l’image pour obtenir le lien de celui-ci. N’oubliez pas de jeter un oeil!"
-- Config Hide Elements
L["The symbol (*) in some options means that there is important information/instructions to be read. "..
"Options with a different color are recommended settings (based on your choice in the setup)."] = "Le symbole (*) dans certaines options signifie que vous avez des informations importantes à lire. "..
"Les options avec une couleur différente sont des paramètres recommandés (en fonction de votre choix de setup)."
L["Hide MicroMenu"] = "Masquer le MicroMenu"
L["Hide the ActionBar MicroMenu (Bags Bar)"] = "Cache le MicroMenu (Barre de bourse)"
L["Hide Gryphons"] = "Cacher les Griffons"
L["Hide the ActionBar Gryphons"] = "Cache l’art des griffons de la barre de compétences"
L["Hide Minimap"] = "Masquer minimap"
L["Hide the Game Minimap"] = "Masque la minicarte de jeu"
L["Hide Objective Tracker"] = "Masquer la barre de quêtes"
L["Hide the Objective Tracker (Quest Frame)"] = "Cache les barres de mission (objectifs)"
L["Hide FPS/MS Frame"] = "Masquer le cadre FPS/MS"
L["Hide the fps/ms frame (bottomleft)"] = "Masque le cadre fps/ms (en bas à gauche)"
L["Hide YouDied/LevelUp Frame"] = "Hide Frame Est Mort/LevelUp"
L["Hide the 'You Died' and 'Level Up' frame when you"..
" die/level in the game"] = "Cache le cadre 'Died' et 'LevelUp' Quand"..
" vous mourez/level dans le jeu"
L["Hide Macro Labels"] = "Masquer les étiquettes de macros"
L["Hide Macro Labels from Action Bar"] = "Masque l’étiquette macros dans la barre d’action"
L["Hide Hotkeys Labels"] = "Masquer les clés d’étiquettes"
L["Hide Hotkeys Labels from Action Bar"] = "Masque les étiquettes des boutons dans la barre d’action"
L["Hide Stance Bar"] = "Barre d’instances de masquer"
L["Hide the Stance Bar (Druid forms, Rogue stealth, etc)"] = "Masque la barre d’instance (formes druide, furtivité voyous, etc.)"
L["Hide Chat Buttons"] = "Masquer les boutons de chat"
L["Hide the Chat buttons (voice, social, etc)"] = "Cache les boutons de chat (voix, social, etc.)"
L["Hide AFK Frame"] = "Masquer le cadre AFK"
L["Hide the AFKMode when you are AFK"] = "Masque l’écran en mode AFK"
L["Hide Faction/PvP/Prestige icon"] = "Icône Hide Faction/JvJ/Prestige"
L["Hide the player frame Faction/PvP/Prestige icon"] = "Masque l’icône Faction/JvJ/Prestige du cadre du joueur"
L["|cfff2dc7fHide UnitImproved Faction Icon|r"] = "|cfff2dc7fIcône Masquer la faction UnitImproved|r"
L["Hide the Faction Icon (Ally/Horde) on players frames"] = "Cache l’icône de faction (Ally/Horde) des cadres de joueur"
L["Hide CastBar Timer"] = "Masquer le minuterie CastBar"
L["Hide the timer below CastBar"] = "Barre de fonte de masques"
L["|cfff2dc7fHide GroupFrame|r"] = "|cfff2dc7fMasquer le cadre de groupe|r"
L["Hide the GroupFrame on the player portrait"] = "Masque le cadre de groupe du cadre du joueur"
L["Hide Covenant Frame"] = "Masquer le cadre de l’alliance"
L["Hide the Covenant/Garrison minimap icon"] = "Icône de minicarte de pacte/trim de peau"
L["Hide Minimap Zone Text"] = "Masquer la minicarte de texte"
L["Hide zone text above minimap"] = "Masque le texte de l’emplacement actuel au-dessus du minicarte"
L["Hide Castbar"] = "Cacher Castbar"
L["Completely hide the player's castbar"] = "Il cache complètement le castbar du joueur"
-- Config Miscellaneous
L["Smooth Camera (50% Slower)"] = "Appareil photo doux (50% Lent)"
L["Smooth Camera (70% Slower)"] = "Appareil photo doux (70% Lent)"
L["Smooth Camera (90% Slower)"] = "Appareil photo doux (90% Lent)"
L["Makes the Camera turns in a more smooth way"] = "Rend l’appareil photo plus doux"
L["|cfff2dc7fAuto Repair/Sell Gray Items|r"] = "|cfff2dc7fVendre gray et réparation automatique|r"
L["When you open a Merchant shop, auto sell gray"..
" and repair items"] = "Lorsque vous ouvrez le forgeron, vous vendez des articles gris et rouvrez automatiquement les articles"
L["Auto Gamma"] = "Gamma automatique"
L["Automatically change the gamma when is day to"..
" 1.2 (brighter) and to 1.0 (default) at night based on the local time"] = "Modifications gamma automatiquement lorsque"..
" est jour pour 1.2 (bien sûr) et pour 1.0 (par défaut) quand il est la nuit, basé sur l’heure locale"
L["USA Date Format"] = "Date/Heure Format Américain"
L["Change the date format of the whole UI to"..
" the USA format"] = "Modifie le format de la date de l’interface au format américain"
L["RPG chat fonts"] = "Chat Source RPG"
L["Change the chat fonts to a RPG look-alike style"] = "Modifie la police de chat en un style RPG"
L["Auto Screenshot"] = "Capture d’écran automatique"
L["Automatically takes a screenshot when you level up"] = "Prenez une photo chaque fois que vous gagnez du niveau"
L["Transparent Name BKGD"] = "Arrière-plan transparent (Nom)"
L["Remove any color in the target name background"] = "Supprime toute couleur d’arrière-plan dans le nom de la cible"
L["Default Class Background"] = "Arrière-plan de la classe standard"
L["Remove the class color background behind"..
" the player names to default values (Transparent Name needs to be unchecked)"] = "Supprime la couleur de la classe d’arrière-plan"..
" du nom du joueur (l’arrière-plan transparent doit être effacé)"
L["Disable Nameplate Changes"] = "Désactive les modifications Nameplates"
L["This option will remove any change that was made to the nameplates (the bar above mobs and players)"] = "Il supprimera toute"..
" changement effectué sur les plaques d’immatriculation (bar jusqu’à foules et les joueurs)"
L["Disable ChatBubble Changes"] = "Désactive les modifications de bulles Chat"
L["This option will remove any change that was made to the chatbubbles (the frame text above players)"] = "Il supprimera toute"..
" changement apporté dans les bulles de chat (le cadre de texte au-dessus des joueurs)"
L["Disable Damage Font (*)"] = "Désactiver les dégâts de source (*)"
L["This option will remove any change to the damage font text."..
"\n*You need to restart the game so the font can be reloaded. You can change it to any font, "..
"go to Textures->font and replace the file keeping the same name"] = "Supprimera tout changement dans la source des dommages"..
"\n *Vous devez recommencer le jeu pour que la source soit rechargée. Vous pouvez également le modifier, "..
"Atteindre Textures->font et modifier le fichier en gardant le même nom"
L["|cfff2dc7fDisable Portrait Text Spam|r"] = "|cfff2dc7fDésactiver le texte Spam image|r"
L["Disable healing/damage spam over player"..
" and pet portraits"] = "Désactive le spam guérison/dommages dans le portrait d’animal familier et de joueur"
L["Disable New Minimap"] = "Désactive la nouvelle minicarte"
L["This option will get you back to the"..
" Blizzard default minimap style (round)."] = "La minicarte reviendra à la Blizzard (Rond)"
L["Disable Smoke Texture"] = "Désactive la texture de la fumée"
L["It will disable the 'smoke' texture around the portrait in "..
"the UnitFrameImproved version of it"] = "Il désactivera la texture de 'Fumée' autour des photos dans la version "..
" UnitFrameImproved"
L["Disable Button Color Text"] = "Désactiver les boutons de texte couleur"
L["Change the button colors back to default yellow"] = "Modifie la couleur des boutons au motif jaune"
L["Disable New CastBar"] = "Désactiver CastBar Nouveau"
L["Will disable the new castbar and return to Blizzard default texture"] = "Il désactivera le nouveau castbar"..
" et revenir à la texture par défaut de la Blizzard"
-- Config Tweaks & Extra
L["Disable Kill Announcer"] = "Désactiver Kill Announcer"
L["Disable the Kill Announcer frame that show up when you kill someone"] = "Désactive le cadre de la mort lorsque vous tuez quelqu’un"
L["Silence Kill Announcer"] = "Silence Kill Announcer"
L["Remove boss/kill sounds from the Kill Announcer frame"] = "Supprime les sons de boss/death de la Kill Announcer"
L["|cfff2dc7fTooltip on Cursor|r"] = "|cfff2dc7fTooltip dans le pointeur|r"
L["Tooltips will appear close to the mouse cursor position"] = "Toolips apparaîtra près du pointeur de la souris"
L["|cfff2dc7fInspect Target (Shift + ')|r"] = "|cfff2dc7fInspecter la cible (Shift + ')|r"
L["When you have a target or your mouse is over someone character,"..
" to inspect this player press the keys Shift + '"] = "Lorsque vous avez une cible ou que la souris est au-dessus d’un caractère,"..
" pour inspecter ce joueur appuyez sur les touches Shift+'"
L["|cfff2dc7fConfirm Pop-Ups (Ctrl + ')|r"] = "|cfff2dc7fConfirmer Pop-Ups (Ctrl + ')|r"
L["When this is active you can confirm almost"..
" any pop-ups (release, quests, stacks, etc) pressing the keys Ctrl + '"] = "Lorsqu’il est actif, vous pouvez confirmer presque"..
" Tous pop-ups (libération, missions, piles, etc.) appuyer sur les touches Ctrl + '"
L["First Person View"] = "Vue de la première personne"
L["Change the camera view to a 'First Person' experience"] = "Modification de la vue de la caméra à la première personne"
L["ActionButton on KeyUp"] = "Actions Clé libérée"
L["With this option spells can be cast just when the"..
" keybind are released"] = "Avec cette option, les sorts ne peuvent être castrés que lorsque la clé est libérée"
L["Combat Cursor Mode"] = "Combat Mode"
L["Makes the camera turns with your mouse when in"..
" combat (right-click to show cursor)"] = "Fait tourner la caméra avec la souris au combat (le bouton droit montre le pointeur)"
L["Square Minimap"] = "Minimem carré"
L["A modern minimap (neon class borders)"] = "Une minicarte moderne (bords néon avec couleur de classe)"
L["Keep UnitFrame Dark"] = "Garder UnitFrame Sombre"
L["Even if you change theme, this will keep UnitFrame Dark"..
" (player frame, boss, etc)."] = "Même si vous modifiez le thème, cette option UnitFrame Sombre"..
" (cadre de joueur, patrons, etc.)"
L["You can only select one style of UnitFrame color"] = "Vous pouvez simplement sélectionner un style Couleur pour le UnitFrame"
L["Keep UnitFrame Blizzard Like"] = "Garder UniFrame Blizzard"
L["Even if you change theme, this will keep UnitFrame"..
" Blizzard like (player frame, boss, etc)."] = "Même si vous modifiez le thème, cette option gardera le thème classique de Blizzard"..
" (cadre de joueur, patrons, etc.)"
L["|cfff2dc7fInstance Leave Frame|r"] = "|cfff2dc7fInstances de sortie (Cadre)|r"
L["A dynamic frame that pop-up when you"..
" complete a LFG (dungeon, raid, etc)"] = "Un cadre qui s’affiche lorsque vous terminez un LFG (donjon, raid, etc.)"
L["Minimalist UI"] = "Interface minimaliste"
L["Hide some parts of the UI when you are out of combat ('ATL-CTRL-P' to show frames)"] = "Cache une partie de l’interface"..
" quando vous êtes hors du combat ('ATL-CTRL-P' pour montrer les cadres)"
L["Disable 'Dynamic Quest Tracker' at Miscellaneous tab first"] = "Première éteindre 'Missions dynamiques' dans l’onglet Divers"
L["Minimal ActionBar"] = "Bar minimaliste"
L["Minimalist actionbar, hide all the textures"] = "Barre d’action minimaliste, cache toutes les textures"
L["Dynamic Quest Tracker"] = "Missions dynamiques"
L["Hide the quest track when you"..
" are in combat or in a PVP instance"] = "Masque la barre de quêtes lorsque vous êtes au combat ou dans une instance PxP"
-- Config Scale & Frame Size
L["|cffb62a25This is a work in progress,"..
" I'm still learning how it works, please report any bugs in our discord|r"] = "|cffb62a25En développement,"..
" Je suis encore en train d’apprendre comment il fonctionne, signaler toute erreur dans notre discord|r"
-- Config Themes
L["Some of this options needs the AbyssUI_TexturePack."..
" You can find a download link in the addon page. You also can find the link in te 'Info Panel' section."] = "Certaines de ces options doivent AbyssUI_TexturePack."..
" Vous pouvez trouver le lien de téléchargement sur la page addon. Vous pouvez également trouver le lien dans le 'Informations'."
L["|cfff2dc7fUnitFrame Improved|r"] = "|cfff2dc7fUnitFrame Amélioré|r"
L["This is a improved version of unitframes,"..
" it changes those frames to a more beautiful and complete version"] = "Une version améliorée de la unitframe,"..
" change ces cadres à quelque chose de plus beau et complet"
L["|cfff2dc7fElite Portrait|r"] = "|cfff2dc7fimage Élite|r"
L["Add a elite texture to the player portrait"] = "Ajoute la texture d’élite dans le portrait de joueur (dragon)"
L["You can only select one UnitFrame portrait art"] = "Vous ne pouvez sélectionner qu’un seul art portrait à la fois"
L["DeathKnight Alliance Portrait"] = "Chevalier de la mort Portrait (Ally)"
L["DeathKnight Horde Portrait"] = "Portrait de chevalier de la mort (Horde)"
L["Add a sword texture to the player portrait"] = "Ajoute une texture d’arme à dk dans le portrait du joueur"
L["Demon Hunter Portrait"] = "Portrait de chasseur de démons"
L["Add a DH inspired texture to the player portrait"] = "Ajoute une texture de dh dans le portrait du joueur"
L["Artistic"] = "Artistique"
L["A artistic version of UnitPlayerFrame"] = "Une version artistique de UnitFrame du joueur"
L["You need to uncheck any other portrait art to apply a new one"] = "Vous devez décocher tout autre art portrait pour utiliser un nouvel art"
L["Bright"]= "Lumineux"
L["A bright version of UnitPlayerFrame"] = "Une version brillante de UnitFrame du joueur"
L["Classic"] = "Classique"
L["A classic version of UnitPlayerFrame"] = "Une version classique de UnitFrame du joueur"
L["Artistic(V2)"] = "Artistique(V2)"
L["Version two of artistic UnitPlayerFrame"] = "Une autre version artistique de UnitFrame du joueur"
L["Dark"] = "Sombre"
L["Dark version of UnitPlayerFrame"] = "Une version sombre de la UnitFrame du joueur"
L["DarkGray"] = "Gris foncé"
L["A dark gray version of UnitPlayerFrame"] = "Une version gris foncé de UnitFrame du joueur"
L["Dark(V2)"] = "Sombre(V2)"
L["Version 2 of the dark UnitPlayerFrame"] = "Une autre version sombre de UnitFrame du joueur"
L["GrayScale"] = "Gris"
L["A grayscale version of UnitPlayerFrame"] = "Une version grisâtre de la UnitFrame du joueur"
L["LightGray"] = "Gris clair"
L["A light gray version of UnitPlayerFrame"] = "Une version gris clair de la UnitFrame du joueur"
L["MediumGray"] = "Gris moyen"
L["A medium gray version of UnitPlayerFrame"] = "Une version grise moyenne de la UnitFrame du joueur"
L["MinimalBlue"] = "Bleu minimaliste"
L["A blue version of UnitPlayerFrame"] = "Une version bleue minimaliste de UnitFrame du joueur"
L["MinimalRed"] = "Rouge minimaliste"
L["A red version of UnitPlayerFrame"] = "Une version rouge minimaliste de UnitFrame du joueur"
L["Muted"] = "Taire"
L["A muted version of UnitPlayerFrame"] = "Une version en sourdine de la UnitFrame du joueur"
L["Psychedelic"] = "Psychédélique"
L["A psychedelic version of UnitPlayerFrame"] = "Une version psychédélique de UnitFrame du joueur"
L["Retro"] = "Rétro"
L["A retrowave version of UnitPlayerFrame"] = "Une version rétro de la UnitFrame du joueur"
L["Vibrant"] = "Dynamique"
L["A vibrant version of UnitPlayerFrame"] = "Une version vibrante de UnitFrame du joueur"
L["|cffc0c0c0Blizzard (Default)|r"] = "|cffc0c0c0Blizzard (Par défaut)|r"
L["Blizzard Silver Colorization for Frames"] = "Colorisation argentée de la Blizzard pour les cadres"
L["You can only select one preset color, uncheck others"] = "Vous ne pouvez sélectionner qu’une couleur prédéfinie, décocher"
L["|cff636363Blackout|r"] = "|cff636363Obscure|r"
L["A completely dark colorization"] = "Une colorisation complètement sombre"
L["|cffb62a25Blood|r"] = "|cffb62a25Sang|r"
L["A dark red colorization"] = "Une colorisation rouge foncé"
L["|cffecc13cGold|r"] = "|cffecc13cGolden|r"
L["A golden colorization"] = "Une colorisation dorée"
L["|cffc41F3BDeath Knight|r"] = "|cffc41F3BChevalier de la mort|r"
L["|cffA330C9Demon Hunter|r"] = "|cffA330C9Chasseur de démons|r"
L["|cffFF7D0ADruid|r"] = "|cffFF7D0ADruide|r"
L["|cffABD473Hunter|r"] = "|cffABD473Chasseur|r"
L["|cff69CCF0Mage|r"] = "|cff69CCF0Assistant|r"
L["|cff00FF96Monk|r"] = "|cff00FF96Moine|r"
L["|cffF58CBAPaladin|r"] = "|cffF58CBAPaladin|r"
L["Priest (Shadow)"] = "Prêtre (Ombres)"
L["|cffFFF569Rogue|r"] = "|cffFFF569Rogue|r"
L["|cff0070DEShaman|r"] = "|cff0070DEChaman|r"
L["|cff9482C9Warlock|r"] = "|cff9482C9Sorcière|r"
L["|cffC79C6EWarrior|r"] = "|cffC79C6EGuerrier|r"
L["Apply the color you choose from the ColorPicker"] = "Appliquer la couleur que vous avez choisie dans le sélecteur de couleurs"
L["You need to uncheck any preset color, to apply a color"] = "Vous devez décocher n’importe quelle couleur prédéfinie, pour appliquer cette couleur"
--------------------------------------------------------------
-- Frames
L["Move"] = "Mova-se"
L["Level: "] = "Nível: "
L["Honor: "] = "Honra: "
L["Item Level: "] = "Niveau l’élément: "
L["Confirm"] = "Confirmer"
L["Recommended"] = "Recommandé"
L["Modern"] = "Moderne"
L["Classic"] = "Classique"
L["|cff8b0000YOU DIED|r"] = "|cff8b0000TU ES MORT|r"
L["Let's save the variables and prepare the interface for the first use.\n"
.."To do this, choose the option that best suits your taste.\n\n"
.."|cfff2dc7fClassic|r: interface model close to the original, with few modifications.\n\n"
.."|cfff2dc7fRecommended|r: a mix between the other options, with the best of the two.\n\n"
.."|cfff2dc7fModern|r: a modern interface model, with striking changes to the interface.\n\n"
.."You always can change options on the configuration panel.\nType '|cfff2dc7f/abyssui|r' on chat for more info."] = "Allons-y"
.." enregistrer les variables et préparer l’interface pour la première utilisation.\n"
.."Pour ce faire, choisissez l’une des options qui correspond le mieux à votre goût.\n\n"
.."|cfff2dc7fClassique|r: modèle d’interface proche de l’original, avec peu de modifications.\n\n"
.."|cfff2dc7fRecommandé|r: un mélange des autres options, avec le meilleur des deux.\n\n"
.."|cfff2dc7fModerne|r: un modèle d’interface moderne, avec des changements considérables dans l’interface.\n\n"
.."Vous pouvez modifier les options à tout moment dans le panneau paramètres.\nType '|cfff2dc7f/abyssui|r' dans le chat pour plus d’informations."
L["A reload is necessary so this configuration can be save!\n"..
"Click the |cffffcc00'confirm'|r button to Reload.\nYou still can make changes (do before you confirm)."] = "Un"
.." le rechargement est nécessaire pour que ce paramètre soit enregistré!\n"..
"Cliquez sur le bouton |cffffcc00'Confirmer'|r pour recharger.\n Vous pouvez toujours apporter des modifications (effectuer avant de confirmer)."
L["It will only hide Blizzard frames, addons have their"..
" own frames,\n a good addon probably has an option to hide while out of combat.\n"..
" I could have added the entire interface to be hidden,\n but that would prevent"..
" interaction with some frames (auction, loot, quest, etc)."] = "Vous ne cacherez que les cadres de la Blizzard, addons Ont"..
" les cadres eux-mêmes,\n un bon addon ont probablement une option pour se cacher pendant le combat.\n"..
" Aurait pu ajouter toute l’interface pour cacher,\n mais cela empêcherait"..
" interaction avec certains cadres (maison de vente aux enchères, butin, missions, etc.)."
L["Wait!\nThis will clean all your skills/spells from Actions Bars."] = "Attendre!\n Cela effacera tous les sorts/capacités de la barre d’action."
--------------------------------------------------------------
-- Extras
L["|cfff07100Repair cost paid by Guild: %.1fg|r"] = "|cfff07100Réparation payée par la Guilde: %.1fg|r"
L["|cffead000Repair cost: %.1fg|r"] = "|cffead000Valeur de réparation: %.1fg|r"
L["Not enough gold for repair."] = "Pas d’or à réparer."
L["This instance is completed! Want to leave?"..
" You can also teleport out/in or just close this frame"] = "L’instance est terminée! Voulez-vous partir ?"..
" Vous pouvez également téléporter ou simplement fermer ce cadre"
L["Teleport"] = "Teleport"
L["|cfff2dc7fAbyssUI Command List|r"] = "|cfff2dc7fAbyssUI Liste des commandes|r"
L["|cfff2dc7fType /abyssui |r|cffffcc00'command name'|r"] = "|cfff2dc7fType /abyssui |r|cffffcc00'nom de commande'|r"
L["/abyssui |cffffcc00config|r ~configuration panel"] = "/abyssui |cffffcc00config|r ~panneau de configuration"
L["/abyssui |cffffcc00setup|r ~show the setup frame"] = "/abyssui |cffffcc00setup|r ~afficher l’écran setup"
L["/abyssui |cffffcc00reset|r ~reset UI frames to default positions"] = "/abyssui |cffffcc00reset|r ~réinitialiser la position des cadres"
L["/abyssui |cffffcc00daily|r ~daily info"] = "/abyssui |cffffcc00daily|r ~informations quotidiennes"
L["/abyssui |cffffcc00reload|r ~reload the interface"] = "/abyssui |cffffcc00reload|r ~interface de rechargement"
L["/abyssui |cffffcc00more|r ~for more commands"] = "/abyssui |cffffcc00more|r ~pour plus de commandes"
L["|cfff2dc7fToken Price: |r"] = "|cfff2dc7fPrix de Token: |r"
L["|cfff2dc7fToken Price:|r Not available right now!"] = "|cfff2dc7fPrix de Token:|r Non disponible!"
L["|cfff2dc7fDate:|r "] = "|cfff2dc7fDate:|r "
L["|cfff2dc7fHonor Level: |r|cffffcc00"] = "|cfff2dc7fNiveau d’honneur: |r|cffffcc00"
L["|cfff2dc7fWoW Version: |r|cffffcc00"] = "|cfff2dc7fVersion de WoW: |r|cffffcc00"
L["|cfff2dc7fAbyssUI Version: |r|cffffcc00"] = "|cfff2dc7fVersion de AbyssUI: |r|cffffcc00"
L["/abyssui |cffffcc00clc|r ~clear CombatLog entries"] = "/abyssui |cffffcc00clc|r ~nettoyer le log combat"
L["/abyssui |cffffcc00gm|r ~custumer support"] = "/abyssui |cffffcc00gm|r ~soutien aux consommateurs"
L["/abyssui |cffffcc00rc|r ~ready check"] = "/abyssui |cffffcc00rc|r ~Confirmer 'Prêt'"
L["/abyssui |cffffcc00cr|r ~check role poll"] = "/abyssui |cffffcc00cr|r ~confirmer la fonction"
L["/abyssui |cffffcc00unlock|r ~unlock some frames"] = "/abyssui |cffffcc00unlock|r ~déverrouiller certains cadres"
L["/abyssui |cffffcc00lock|r ~lock unlocked frames"] = "/abyssui |cffffcc00lock|r ~verrouiller les cadres déverrouillés"
L["|cfff2dc7fConsider reload the UI to make sure frames are locked|r '|cffffcc00/reload|r'"] = "|cfff2dc7fEnvisagez de recharger l’interface pour vous assurer que les images sont verrouillées|r '|cffffcc00/reload|r'"
L["|cff0d75d4Special Thanks|r"] = "|cff0d75d4Merci|r"
L["|cff0d75d4Translators|r"] = "|cff0d75d4Traducteurs|r"
L["Default"] = "Par défaut"
L["Need Translator"] = "Besoin d'un Traducteur"
L["|cfff2dc7fFizzlemizz|r for helping me with programming questions."] = "|cfff2dc7fFizzlemizz|r pour m’aider avec les questions de programmation."
L["|cfff2dc7fKawF|r for UnitFrame Improved, so I could create a really nice"..
" UnitFrame for AbyssUI."] = "|cfff2dc7fKawF|r Par UnitFrame amélioré, où j’ai pu m’inspirer"..
" et de créer quelque chose de très bon pour le AbyssUI."
L["|cfff2dc7fEnglish (United States): |r"] = "|cfff2dc7fAnglais (États-Unis): |r"
L["|cfff2dc7fSpanish (Mexico): |r"] = "|cfff2dc7fEspagnol (Mexique): |r"
L["|cfff2dc7fPortuguese: |r"] = "|cfff2dc7fPortugais: |r"
L["|cfff2dc7fGerman: |r"] = "|cfff2dc7fAllemand: |r"
L["|cfff2dc7fEnglish (Great Britain): |r"] = "|cfff2dc7fAnglais (Grande-Bretagne): |r"
L["|cfff2dc7fSpanish (Spain): |r"] = "|cfff2dc7fEspagnol (Espagne): |r"
L["|cfff2dc7fFrench: |r"] = "|cfff2dc7fFrançais: |r"
L["|cfff2dc7fItalian: |r"] = "|cfff2dc7fItalien: |r"
L["|cfff2dc7fRussian: |r"] = "|cfff2dc7fRusse: |r"
L["|cfff2dc7fKorean: |r"] = "|cfff2dc7fCoréen: |r"
L["|cfff2dc7fChinese (Traditional): |r"] = "|cfff2dc7fChinois (traditionnel): |r"
L["|cfff2dc7fChinese (Simplified): |r"] = "|cfff2dc7fChinois (simplifié): |r"
L["Feel free to help translate AbyssUI to your own language, if you want to help, go to AbyssUI Github page, "..
"there's a folder named 'localization', find the language you know better and help to improve it. Thank you soo much for this."] = "N’hésitez pas à aider à traduire AbyssUI dans votre langue, si vous voulez aider, allez à la page AbyssUI sur Github, "..
"rechercher un dossier appelé 'localization', trouver la langue que vous connaissez le mieux et aider à l’améliorer. Merci beaucoup pour ça."
L["Chat Commands"] = "Commandes de Chat"
L["Always Show Titles"] = "Toujours Afficher les Titres"
L["Always show people titles on their names"] = "Toujours afficher les titres des personnes sur leurs noms"
L["Green Health Bars"] = "Barres de Santé Vertes"
L["All unitframe health bars will be green (default)"] = "Toutes les barres de santé du cadre de l'unité seront vertes (par défaut)"
|
-- const BluebirdPromise = require('bluebird');
-- const { consts, utils } = require('../lora-lib');
-- const RESTIND_PARAM = consts.RESETIND;
-- const MacCommandIssuers = require('../macCmdIssuers');
return function(devAddr, status)
-- let _this = this;
-- return new BluebirdPromise((resolve, reject) => {
p(
{
label = "MAC Command Ans",
message = {
ResetInd = {
Status = status
}
}
}
)
for key, _ in pairs(status) do
local version = status[key]
local Status = Buffer.from(version)
local Minor = utils.bitwiseFilter(Status, RESTIND_PARAM.MINOR_START, RESTIND_PARAM.MINOR_LEN)
if Minor == 1 then
p(
{
label = "MAC Command Ans",
message = {
ResetInd = {
Minor = "Minor=1 set Success"
}
}
}
)
end
local MacCommandIssuer = MacCommandIssuers[consts.RESET_CID].bind(_this, devAddr, Minor)
return MacCommandIssuer()
end
end
|
return {'eucalyptus','eucharistie','eucharistieviering','eucharistisch','euclidisch','eucalyptusolie','eucalyptusboom','euclides','eucalyptussen','eucharistievieringen','eucharistische','euclidische','eucalyptusbomen'}
|
-- ORE CLEANER BEAMS --
-- Collect Beam --
ocB = {}
ocB.name = "OCBeam"
ocB.type = "beam"
ocB.flags = {"not-on-map"}
ocB.damage_interval = 20
ocB.random_target_offset = false
ocB.action_triggered_automatically = false
ocB.width = 2
ocB.direction_count = 1
ocB.head =
{
filename = "__Mobile_Factory_Graphics__/graphics/Alpha.png",
width = 1,
height = 1,
line_length = 10,
frame_count = 10,
animation_speed = 1/15,
scale = 2
}
ocB.tail =
{
filename = "__Mobile_Factory_Graphics__/graphics/Alpha.png",
width = 1,
height = 1,
line_length = 10,
frame_count = 10,
animation_speed = 1/15,
scale = 2
}
ocB.body =
{
{
filename = "__Mobile_Factory_Graphics__/graphics/beams/OCbeam.png",
width = 10,
height = 10,
line_length = 10,
frame_count = 10,
animation_speed = 1/15,
scale = 2
}
}
data:extend{ocB}
-- Send big Beam --
ocBB = {}
ocBB.name = "OCBigBeam"
ocBB.type = "beam"
ocBB.flags = {"not-on-map"}
ocBB.damage_interval = 20
ocBB.random_target_offset = false
ocBB.action_triggered_automatically = false
ocBB.width = 5
ocBB.direction_count = 1
ocBB.head =
{
filename = "__Mobile_Factory_Graphics__/graphics/Alpha.png",
width = 1,
height = 1,
line_length = 16,
frame_count = 16,
animation_speed = 1,
scale = 2
}
ocBB.tail =
{
filename = "__Mobile_Factory_Graphics__/graphics/Alpha.png",
width = 1,
height = 1,
line_length = 16,
frame_count = 16,
animation_speed = 1,
scale = 2
}
ocBB.body =
{
{
filename = "__Mobile_Factory_Graphics__/graphics/beams/OCBigBeam.png",
width = 8,
height = 12,
line_length = 16,
frame_count = 16,
animation_speed = 1,
scale = 5
}
}
data:extend{ocBB}
|
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
PlayerData = xPlayer
end)
-----
RegisterNetEvent('esx_borrmaskin:startDrill')
AddEventHandler('esx_borrmaskin:startDrill', function(source)
DrillAnimation()
end)
function DrillAnimation()
local playerPed = GetPlayerPed(-1)
Citizen.CreateThread(function()
TaskStartScenarioInPlace(playerPed, "WORLD_HUMAN_CONST_DRILL", 0, true)
end)
end
|
addEvent ( "NGDrugs:Module->LSD:givePlayerCash", true )
addEventHandler ( "NGDrugs:Module->LSD:givePlayerCash", root, function ( )
givePlayerMoney ( source, math.random ( 50, 100 ) )
end )
|
----------------------------------------
--
-- Copyright (c) 2015, 128 Technology, Inc.
--
-- author: Hadriel Kaplan <hadriel@128technology.com>
--
-- This code is licensed under the MIT license.
--
-- Version: 1.0
--
------------------------------------------
-- prevent wireshark loading this file as a plugin
if not _G['protbuf_dissector'] then return end
local Settings = require "settings"
local dprint = Settings.dprint
local dprint2 = Settings.dprint2
local dassert = Settings.dassert
local derror = Settings.derror
local Identifier = require "ast.identifier"
local Syntax = require "syntax"
----------------------------------------
-- The ScopedIdentifier class, may be scoped
-- this is used for things like fullIdent, messageType, enumType
-- grammar: ["."] {ident "."} ident
local ScopedIdentifier = {}
local ScopedIdentifier_mt = { __index = ScopedIdentifier }
setmetatable( ScopedIdentifier, { __index = Identifier } ) -- inherit from Identifier
-- go through finding [.] ident ([.] ident)*
-- save their actual tokens into a table as our value
function ScopedIdentifier.parse(st, idx)
dassert(#st >= idx, "Identifier subtable too short")
local t = {}
-- could have leading period for global scope
if st[idx].ttype == "PERIOD" then
-- save the token and keep going
t[#t+1] = st[idx]
idx = idx + 1
dassert(st[idx], "Globally scoped identifier value missing identifier")
end
while idx <= #st do
dassert(st[idx]:canBeIdentifier(), st[idx], "ScopedIdentifier value is not an identifier:", st[idx].value)
-- make it an IDENTIFIER and save it
st[idx].ttype = "IDENTIFIER"
t[#t+1] = st[idx]
idx = idx + 1
-- see if next one is a period
if idx < #st and st[idx].ttype == "PERIOD" then
-- save it and go around again
t[#t+1] = st[idx]
idx = idx + 1
else
-- we're done
return t, idx
end
end
-- we're done
return t, idx
end
function ScopedIdentifier.new(st, idx)
local value, new_idx = ScopedIdentifier.parse(st, idx)
local new_class = Identifier.protected_new(value)
setmetatable( new_class, ScopedIdentifier_mt )
return new_class, new_idx
end
function ScopedIdentifier:isGlobalScope()
return self.value[1].ttype == "PERIOD"
end
function ScopedIdentifier:isScoped()
for _, token in self.value do
if token.ttype == "PERIOD" then
return true
end
end
dassert(#self.value == 1, "Programming error: ScopedIdentifier has multiple values without a '.' PERIOD")
return false
end
function ScopedIdentifier:getValue(portion_idx)
local values = self.value
if not portion_idx then
-- behave like Identifier
dassert(not self:isScoped(), "Programming error: getValue() called without index on ScopedIdentifier")
return values[#values].value
end
-- give back requested portion
local idx = (portion_idx * 2) - 1
if self:isGlobalScope() then
-- offset for the global scope's period
idx = idx +1
end
return idx <= #values and values[idx].value or nil
end
function ScopedIdentifier:size()
local size = #self.value
if self:isGlobalScope() then
size = size - 1
end
return (size + 1) / 2
end
function ScopedIdentifier:resolve(namespace)
if self:isGlobalScope() then
return namespace:findAbsoluteDeclaration(self)
else
return namespace:findRelativeDeclaration(self)
end
end
function ScopedIdentifier:display()
return Syntax:concatTokenValues(self.value)
end
return ScopedIdentifier
|
---------------------------------------------------------------------------
-- @author Julien Danjou <julien@danjou.info>
-- @copyright 2008 Julien Danjou
-- @release v3.4.13
---------------------------------------------------------------------------
-- Grab environment we need
local capi =
{
mouse = mouse,
screen = screen,
client = client
}
local util = require("awful.util")
local client = require("awful.client")
--- Screen module for awful
module("awful.screen")
local data = {}
data.padding = {}
--- Give the focus to a screen, and move pointer.
-- @param screen Screen number.
function focus(screen)
if screen > capi.screen.count() then screen = capi.mouse.screen end
local c = client.focus.history.get(screen, 0)
if c then capi.client.focus = c end
-- Move the mouse on the screen
capi.mouse.screen = screen
end
function focus_center(screen)
if screen > capi.screen.count() then screen = capi.mouse.screen end
local c = client.focus.history.get(screen, 0)
if c then capi.client.focus = c end
-- Move the mouse on center of the screen
capi.mouse.screen = screen
local geo = capi.screen[screen].geometry
capi.mouse.coords({x = geo.x + geo.width/2, y = geo.y + geo.height/2})
end
function focus_relative_center(i)
return focus_center(util.cycle(capi.screen.count(), capi.mouse.screen + i))
end
--- Give the focus to a screen, and move pointer, but relative to the current
-- focused screen.
-- @param i Value to add to the current focused screen index. 1 will focus next
-- screen, -1 would focus the previous one.
function focus_relative(i)
return focus(util.cycle(capi.screen.count(), capi.mouse.screen + i))
end
--- Get or set the screen padding.
-- @param screen The screen object to change the padding on
-- @param padding The padding, an table with 'top', 'left', 'right' and/or
-- 'bottom'. Can be nil if you only want to retrieve padding
function padding(screen, padding)
if padding then
data.padding[screen] = padding
screen:emit_signal("padding")
end
return data.padding[screen]
end
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
local assets = {
pack = {
Asset("ANIM", "anim/nightpack.zip"),
Asset("ANIM", "anim/ui_backpack_2x4.zip"),
},
green = {
Asset("ANIM", "anim/nightpack.zip"),
Asset("ANIM", "anim/ui_krampusbag_2x5.zip"),
}
}
local prefabs = {
pack = {
"nightback",
"lanternlight",
"shadow_puff",
"pandorachest_reset"
},
green = {
"nightpack",
"lanternlight",
"pandorachest_reset"
}
}
-- function RED --
local function IsValidVictim(victim)
return not (victim:HasTag("veggie") or
victim:HasTag("structure") or
victim:HasTag("wall") or
victim:HasTag("balloon") or
victim:HasTag("soulless") or
victim:HasTag("groundspike") or
victim:HasTag("smashable"))
and ( (victim.components.combat ~= nil and victim.components.health ~= nil)
or victim.components.murderable ~= nil )
end
local function OnHealing(inst, data)
local victim = data.inst
if victim ~= nil and
victim:IsValid() and
( victim == inst or
( not inst.components.health:IsDead() and
IsValidVictim(victim) and victim.components.health:IsDead() and
inst:IsNear(victim, 15)
)
) then
local epicmult = victim:HasTag("dualsoul") and 2
or (victim:HasTag("epic") and math.random(7, 8))
or 1
if inst.components.health then inst.components.health:DoDelta(5 * epicmult) end
end
end
local function OnEntityDeath(inst, data)
if data.inst ~= nil and data.inst.components.lootdropper == nil then
OnHealing(inst, data)
end
end
local function OnStarvedTrapSouls(inst, data)
local trap = data.trap
if trap ~= nil and
(data.numsouls or 0) > 0 and
trap:IsValid() and
inst:IsNear(trap, 15) then
if inst.components.health then inst.components.health:DoDelta(5 * data.numsouls) end
end
end
local function OnMurdered(inst, data)
local victim = data.victim
if victim ~= nil and
victim:IsValid() and
( not inst.components.health:IsDead() and
IsValidVictim(victim)
) then
if inst.components.health then inst.components.health:DoDelta(5 * (data.stackmult or 1)) end
end
end
local function RemoveListen(inst, owner)
if inst._onentitydroplootfn ~= nil then
inst:RemoveEventCallback("entity_droploot", inst._onentitydroplootfn, TheWorld)
inst._onentitydroplootfn = nil
end
if inst._onentitydeathfn ~= nil then
inst:RemoveEventCallback("entity_death", inst._onentitydeathfn, TheWorld)
inst._onentitydeathfn = nil
end
if inst._onstarvedtrapsoulsfn ~= nil then
inst:RemoveEventCallback("starvedtrapsouls", inst._onstarvedtrapsoulsfn, TheWorld)
inst._onstarvedtrapsoulsfn = nil
end
if inst._onmurderedfn ~= nil then
inst:RemoveEventCallback("murdered", inst._onmurderedfn, owner)
inst._onmurderedfn = nil
end
end
local function ActivateListen(inst, owner)
if inst._onentitydroplootfn == nil then
inst._onentitydroplootfn = function(src, data) OnHealing(owner, data) end
inst:ListenForEvent("entity_droploot", inst._onentitydroplootfn, TheWorld)
end
if inst._onentitydeathfn == nil then
inst._onentitydeathfn = function(src, data) OnEntityDeath(owner, data) end
inst:ListenForEvent("entity_death", inst._onentitydeathfn, TheWorld)
end
if inst._onstarvedtrapsoulsfn == nil then
inst._onstarvedtrapsoulsfn = function(src, data) OnStarvedTrapSouls(inst, data) end
inst:ListenForEvent("starvedtrapsouls", inst._onstarvedtrapsoulsfn, TheWorld)
end
if inst._onmurderedfn == nil then
inst._onmurderedfn = function(src, data) OnMurdered(owner, data) end
inst:ListenForEvent("murdered", inst._onmurderedfn, owner)
end
end
-- function ORANGE --
local ORANGE_PICKUP_MUST_TAGS = { "_inventoryitem" }
local ORANGE_PICKUP_CANT_TAGS = { "INLIMBO", "NOCLICK", "knockbackdelayinteraction", "catchable", "fire", "minesprung", "mineactive" }
local function pickup(inst, owner)
if owner == nil or owner.components.inventory == nil then
return
end
local x, y, z = owner.Transform:GetWorldPosition()
local ents = TheSim:FindEntities(x, y, z, TUNING.ORANGEAMULET_RANGE, ORANGE_PICKUP_MUST_TAGS, ORANGE_PICKUP_CANT_TAGS)
local ba = owner:GetBufferedAction()
for i, v in ipairs(ents) do
if v.components.inventoryitem ~= nil and
v.components.inventoryitem.canbepickedup and
v.components.inventoryitem.cangoincontainer and
not v.components.inventoryitem:IsHeld() and
owner.components.inventory:CanAcceptCount(v, 1) > 0 and
(ba == nil or ba.action ~= ACTIONS.PICKUP or ba.target ~= v) then
if owner.components.minigame_participator ~= nil then
local minigame = owner.components.minigame_participator:GetMinigame()
if minigame ~= nil then
minigame:PushEvent("pickupcheat", { cheater = owner, item = v })
end
end
--Amulet will only ever pick up items one at a time. Even from stacks.
SpawnPrefab("shadow_puff").Transform:SetPosition(v.Transform:GetWorldPosition())
local v_pos = v:GetPosition()
if v.components.stackable ~= nil then
v = v.components.stackable:Get()
end
if v.components.trap ~= nil and v.components.trap:IsSprung() then
v.components.trap:Harvest(owner)
else
owner.components.inventory:GiveItem(v, nil, v_pos)
end
return
end
end
end
local function onfuelupdate(inst)
local owner = inst.components.inventoryitem.owner
if inst._light == nil or not inst._light:IsValid() then
inst._light = SpawnPrefab("lanternlight")
end
if inst._light ~= nil and inst._light:IsValid() then
local fuelpercent = inst.components.fueled:GetPercent()
inst._light.Light:SetIntensity(Lerp(0.3, 0.5, fuelpercent))
inst._light.Light:SetRadius(Lerp(1.75, 2.25, fuelpercent))
inst._light.Light:SetFalloff(.7)
inst._light.entity:SetParent((owner or inst).entity)
end
end
local function nofuel(inst)
inst.components.fueled:SetUpdateFn(nil)
inst:RemoveComponent("fueled")
if inst:HasTag("nofuelsocket") then
inst:RemoveTag("nofuelsocket")
end
inst:RenewState()
end
local function ApplyState(inst, state)
local owner = inst.components.inventoryitem.owner
local StateFns = {
red = function()
if owner then
ActivateListen(inst, owner)
end
end,
blue = function()
if not inst:HasTag("fridge") then
inst:AddTag("fridge")
end
if not inst:HasTag("nocool") then
inst:AddTag("nocool")
end
end,
purple = function()
inst.components.equippable.dapperness = -TUNING.CRAZINESS_SMALL
end,
yellow = function()
inst.components.equippable.walkspeedmult = 1.2
end,
orange = function()
if inst.pickup_task ~= nil then
inst.pickup_task:Cancel()
inst.pickup_task = nil
end
if owner then
inst.pickup_task = inst:DoPeriodicTask(TUNING.ORANGEAMULET_ICD, pickup, nil, owner)
end
end,
green = function()
if inst.prefab == "nightpack" then
local slots = inst.components.container and inst.components.container.slots
local isopen = inst.components.container and inst.components.container:IsOpen()
local eslot = inst.components.equippable and inst.components.equippable.equipslot
local newpack = SpawnPrefab("nightback")
newpack:OnChangeState("green", inst.components.timer:GetTimeLeft("state_change"))
if owner and owner.components.inventory then
owner.components.inventory:Unequip(eslot)
owner.components.inventory:Equip(newpack)
if not isopen then
newpack.replica.container:Close()
end
else
newpack.Transform:SetPosition(inst.Transform:GetWorldPosition())
end
for k, v in pairs(slots) do
if newpack.components.container then
newpack.components.container:GiveItem(v, k)
end
end
inst:Remove()
end
end,
opal = function()
if not inst:HasTag("fridge") then
inst:AddTag("fridge")
end
if inst:HasTag("nocool") then
inst:RemoveTag("nocool")
end
end,
dark = function()
if owner and owner.components.combat then
owner.components.combat.externaldamagemultipliers:SetModifier(inst, 1.2, "nightpack")
end
end,
light = function()
if inst._light == nil or not inst._light:IsValid() then
inst._light = SpawnPrefab("lanternlight")
end
if inst._light ~= nil or inst._light:IsValid() then
inst._light.Light:SetIntensity(0.5)
inst._light.Light:SetRadius(3)
inst._light.Light:SetFalloff(0.7)
inst._light.entity:SetParent((owner or inst).entity)
end
end,
fuel = function()
if not inst:HasTag("nofuelsocket") then
inst:AddTag("nofuelsocket")
end
if inst.components.fueled == nil then
inst:AddComponent("fueled")
inst.components.fueled.fueltype = FUELTYPE.NIGHTMARE
inst.components.fueled:InitializeFuelLevel(300)
inst.components.fueled:SetPercent(0.6)
inst.components.fueled:SetDepletedFn(nofuel)
inst.components.fueled:SetUpdateFn(onfuelupdate)
inst.components.fueled:SetFirstPeriod(TUNING.TURNON_FUELED_CONSUMPTION, TUNING.TURNON_FULL_FUELED_CONSUMPTION)
inst.components.fueled.accepting = true
inst.components.fueled:StartConsuming()
end
end
}
if state and inst.components.inventoryitem then
inst.components.inventoryitem:ChangeImageName("nightpack_"..state)
inst.MiniMapEntity:SetIcon("nightpack_"..state..".tex")
inst.AnimState:PlayAnimation(state)
end
StateFns[state]()
end
local function RenewState(inst, gemtype, isdummy)
local owner = inst.components.inventoryitem and inst.components.inventoryitem.owner
-- healing --
RemoveListen(inst, owner)
-- dark --
if owner and owner.components.combat then
owner.components.combat.externaldamagemultipliers:RemoveModifier(inst, "nightpack")
end
-- light
if inst._light ~= nil then
if inst._light:IsValid() then
inst._light:Remove()
end
inst._light = nil
end
-- <renew pack> --
local slots = inst.components.container and inst.components.container.slots or nil
local isopen = inst.components.container and inst.components.container:IsOpen()
local newpack = SpawnPrefab("nightpack")
if owner ~= nil then
if owner.components.inventory ~= nil then
owner.components.inventory:Unequip(EQUIPSLOTS.BODY)
owner.components.inventory:Equip(newpack)
if isopen==false then
newpack.replica.container:Close()
end
end
else
newpack.Transform:SetPosition(inst.Transform:GetWorldPosition())
end
for k, v in pairs(slots) do
if k <= 8 and newpack.components.container then
newpack.components.container:GiveItem(v, k)
elseif k >= 9 then
if owner ~= nil then
owner.components.inventory:GiveItem(v, nil, owner:GetPosition())
else
newpack.components.container:GiveItem(v, k)
end
end
end
inst:Remove()
if gemtype then
newpack:OnGemTrade(gemtype, isdummy)
end
end
local function OnChangeState(inst, state, duration)
inst._state = state
inst.components.timer:StopTimer("state_change")
if duration then
inst.components.timer:StartTimer("state_change", duration)
end
ApplyState(inst, inst._state)
end
local days = 480
local gemtype_time_table = {
red = 1.2 * days,
dark = 1.2 * days,
purple = 2.4 * days,
light = 2.4 * days,
blue = 4.8 * days,
yellow = 2.4 * days,
orange = 1.2 * days,
green = 12 * days,
opal = 12 * days,
}
local function OnGemTrade(inst, gemtype, isdummy)
if inst._state ~= nil and inst._state ~= gemtype then
inst:RenewState(gemtype, isdummy)
return
end
if inst._state ~= gemtype then
local target = (inst.components.inventoryitem and inst.components.inventoryitem.owner ) or inst
SpawnPrefab("pandorachest_reset").entity:SetParent(target.entity)
if gemtype == "fuel" then
inst.SoundEmitter:PlaySound("dontstarve/common/nightmareAddFuel")
else
inst.SoundEmitter:PlaySound("dontstarve/common/telebase_gemplace")
end
end
OnChangeState(inst, gemtype, gemtype_time_table[gemtype] and gemtype_time_table[gemtype] * ( isdummy and 1.5 or 1 ) )
end
local function onequip(inst, owner)
if inst.components.container ~= nil then
inst.components.container:Open(owner)
end
if inst._state then
ApplyState(inst, inst._state)
end
end
local function onunequip(inst, owner)
if inst.components.container then
inst.components.container:Close(owner)
end
-- healing --
RemoveListen(inst, owner)
-- dark --
if owner and owner.components.combat then
owner.components.combat.externaldamagemultipliers:RemoveModifier(inst, "nightpack")
end
if inst.pickup_task ~= nil then
inst.pickup_task:Cancel()
inst.pickup_task = nil
end
-- light
if inst._light ~= nil and inst._light:IsValid() then
inst._light.entity:SetParent(inst.entity)
end
end
local function OnPreLoad(inst, data)
if data and data._state then
inst._state = data._state
ApplyState(inst, data._state)
end
end
local function OnSave(inst, data)
data._state = inst._state
end
local function OnRemove(inst)
if inst._light ~= nil then
inst._light:Remove()
end
end
local function toberemoved(inst)
if inst.components.container then inst.components.container:DropEverything() end
OnRemove(inst)
inst:Remove()
end
local function common_fn(is_green)
local inst = CreateEntity()
inst.entity:AddTransform()
inst.entity:AddAnimState()
inst.entity:AddSoundEmitter()
inst.entity:AddMiniMapEntity()
inst.entity:AddNetwork()
MakeInventoryPhysics(inst)
inst.AnimState:SetBank("nightpack")
inst.AnimState:SetBuild("nightpack")
inst.AnimState:PlayAnimation(is_green and "green" or "anim")
inst:AddTag("backpack")
inst:AddTag("waterproofer")
inst.MiniMapEntity:SetIcon(is_green and "nightpack_green.tex" or "nightpack.tex")
inst.foleysound = "dontstarve/movement/foley/backpack"
MakeInventoryFloatable(inst, "small", 0.3, 0.7)
inst.entity:SetPristine()
if is_green then
inst:SetPrefabNameOverride("nightpack")
end
if not TheWorld.ismastersim then
inst.OnEntityReplicated = function(inst)
inst.replica.container:WidgetSetup(is_green and "krampus_sack" or "backpack")
end
return inst
end
inst:AddComponent("inspectable")
inst:AddComponent("inventoryitem")
inst.components.inventoryitem.cangoincontainer = false
inst:AddComponent("waterproofer")
inst.components.waterproofer:SetEffectiveness(0)
inst:AddComponent("equippable")
inst.components.equippable.equipslot = EQUIPSLOTS.BODY
inst.components.equippable:SetOnEquip(onequip)
inst.components.equippable:SetOnUnequip(onunequip)
inst:AddComponent("container")
inst.components.container:WidgetSetup(is_green and "krampus_sack" or "backpack")
inst:AddComponent("timer")
inst:ListenForEvent("timerdone", function(inst) inst:RenewState() end)
MakeHauntableLaunchAndDropFirstItem(inst)
inst.OnGemTrade = OnGemTrade
inst.RenewState = RenewState
inst.OnChangeState = OnChangeState
inst.OnSave = OnSave
inst.OnPreLoad = OnPreLoad
inst.OnRemoveEntity = OnRemove
if is_green then
inst:DoTaskInTime(0, function(inst)
if inst._state ~= "green" then
inst:RenewState()
end
end)
end
-- if TUNING.GEARPLAN ~= 1 then inst:DoTaskInTime(0, toberemoved) end
return inst
end
local function fn()
return common_fn()
end
local function fn_green()
return common_fn(true)
end
return Prefab("nightpack", fn, assets.pack, prefabs.pack),
Prefab("nightback", fn_green, assets.green, prefabs.green)
|
require "stdlib/event/event"
require "util/surface"
local resources = {
{name = "dry-hairy-tree", amount = 1},
{name = "clay-patch", min = 18, max = 26},
}
local spawn_area = {x = {-40, 40}, y = {-40, 40}}
local spawn_radius = 8
local function create_random_position(center, area)
return {
math.random(center.x + area.x[1], center.x + area.x[2]),
math.random(center.y + area.y[1], center.y + area.y[2]),
}
end
local function find_spawn_area_center(surface, center)
for i = 1, 500, 1 do
local position = create_random_position(center, spawn_area)
local has_entities = has_entities_in_radius(surface, position, spawn_radius)
local has_water = has_water_in_radius(surface, position, spawn_radius)
if (not has_entities or i > 450) and not has_water then
return {x = position[1], y = position[2]}
end
end
-- No suitable position found in spawn area, spawn anyway
local position = create_random_position(center, spawn_area)
return {x = position[1], y = position[2]}
end
local function spawn_resources(player)
local area = {x = {-spawn_radius, spawn_radius}, y = {-spawn_radius, spawn_radius}}
for _, resource in ipairs(resources) do
local amount = resource.amount
if amount == nil then
amount = math.random(resource.min, resource.max)
end
local area_center = find_spawn_area_center(player.surface, player.position)
for i = 1, amount, 1 do
local position = create_random_position(area_center, area)
player.surface.create_entity {name = resource.name, position = position}
end
end
end
Event.register(defines.events.on_player_created, function(e)
spawn_resources(game.players[e.player_index])
end)
|
--- Boilerplate for winding rule scenes with boundary contours.
--
-- 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.
--
-- [ MIT license: http://www.opensource.org/licenses/mit-license.php ]
--
-- Standard library imports --
local random = math.random
local remove = table.remove
local unpack = unpack
-- Plugins --
local libtess2 = require("plugin.libtess2")
-- Modules --
local shapes = require("shapes")
local utils = require("utils")
local winding = require("winding")
-- Corona globals --
local transition = transition
-- Exports --
local M = {}
--
--
--
M.Hide = winding.Hide
local FadeInParams = { alpha = 1 }
local UNDEF = libtess2.Undef()
function M.Show (scene, rule)
local group = display.newGroup()
scene.view:insert(group)
scene.m_group = group
winding.SetContourFuncs(group)
function group:on_done (tess)
if not self.m_back then
self.m_back = display.newGroup()
self:insert(self.m_back)
self.m_back:toBack()
self.m_back.alpha = 0
end
local tess = utils.GetTess()
tess:Tesselate(rule, "CONNECTED_POLYGONS")
local elems = tess:GetElements()
local verts = tess:GetVertices()
local stack, visited, poly_index = {}, {}, 1
local add_vert, close_poly = utils.Polygon()
for i = 1, tess:GetElementCount() do -- multiply by 2 * poly_size (poly_size = 3 in this case) for #elems
if not visited[i] then -- start a new flood fill if not already absorbed
stack[#stack + 1], visited[i] = i, true
local r, g, b = random(), random(), random()
repeat
local index = remove(stack)
if index then
local base = (index - 1) * 6
local nbase, offset = base + 3, 0
for j = 1, 3 do
local vi, ni = elems[base + j], elems[nbase + j]
-- in case of poly_size > 3: if vi == UNDEF then break end
add_vert(verts[vi * 2 + 1], verts[vi * 2 + 2], offset)
if ni ~= UNDEF and not visited[ni + 1] then
stack[#stack + 1], visited[ni + 1] = ni + 1, true
end
offset = offset + 2
end
close_poly(self.m_back)
local poly = self.m_back[self.m_back.numChildren]
poly:setFillColor(r, g, b)
end
until not index
end
end
end
function group:on_all_done ()
transition.to(self.m_back, FadeInParams)
end
utils.DrawAll(group, shapes.BoxCCW, shapes.BoxMixed, shapes.Overlap, shapes.SelfIntersectingSpiral)
end
return M
|
#!/usr/bin/lua
-------------------------------------------------------------------------------
--
-- @script: apns-sim.lua
--
-- @author: Rohit Joshi
--
-- @copyright Joshi Ventures LLC ? 2012
--
-- @license Apache License, Version 2.0
--
-- VERSION HISTORY:
-- 0.1 10/115/2014 - Initial release
--
-------------------------------------------------------------------------------
-- Purpose: Apple Push Notification Service simulator
local copas = require("copas")
require "logging.console"
local socket = require("socket")
require("ssl")
local logger = logging.console()
--logger:setLevel (logging.DEBUG)
local server_socket
local ssl_enabled = false
local params = { }
------------------------------------------------------------------------------
--- convert bytes to hex string
-- @param string bytes
------------------------------------------------------------------------------
function bytes_to_hex_str(str)
local s = {}
local len = string.len(str)
for i = 1,len do
local b = string.byte(str, i)
--print(string.format("%02x%s",b, ""))
table.insert(s, string.format("%02x%s",b, ""))
end
-- print(table.concat(s))
return table.concat(s)
end
------------------------------------------------------------------------------
--- convert bytes to string
-- @param string bytes
------------------------------------------------------------------------------
function bytes_to_str(str)
local s = {}
local len = string.len(str)
for i = 1,len do
local b = string.byte(str, i)
--print(string.format("%02c%s",b, ""))
table.insert(s, string.format("%c%s",b, ""))
end
-- print(table.concat(s))
return table.concat(s)
end
------------------------------------------------------------------------------
--- convert string bytes to number
-- @param string bytes
------------------------------------------------------------------------------
local function strbytes_to_num(str)
local num = 0
local len = #str
for i = 1,len do
num = num + string.byte(str,i) * 256^(len-i)
end
return num
end
------------------------------------------------------------------------------
--- Run client handler
-- @param socket clinet
-- @param number of messages to send
------------------------------------------------------------------------------
local function client_handler(skt, host, port)
local peername = host .. ":" .. port
logger:info ("Received client connection from '%s':" , peername)
skt:setoption('tcp-nodelay', true)
--skt:settimeout(1)
if ssl_enabled == true then
skt = ssl.wrap(skt, params)
local ok,message = skt:dohandshake()
if not ok then
logger.error (' ssl handshake failed with:' .. message)
return
end
end
local client = copas.wrap(skt)
while true do
local command = read_command(client)
if not command then
return;
end
local id, expiry, status
if command == 1 then
id = read_id(client)
if not id then
return;
end
expiry, status = read_expiry(client)
if(status == "closed") then
return;
end
elseif command ~= 0 then
logger:error("Unknown command: " .. command)
return
end
-- token
local token = read_length_val(client, 2, true)
if not token then
logger:error("Failed to receive token")
return
end
local payload = read_length_val(client, 2, false)
if not token then
logger:error("Failed to receive payload")
return
end
logger:info (string.format("Received notification: command=%d; id=%d; expiry=%d; token=%s; payload=%s",
command, id, expiry, token,payload ))
reply(client, id)
end
skt:close()
return;
end
------------------------------------------------------------------------------
--- read_command
-- @param socket
------------------------------------------------------------------------------
function read_command (client)
local size_to_read = 1
local command, status = client:receive(size_to_read)
if (status ~= nil and status == "closed") then
logger:warn ("Connection closed by foreign host. Failed to read command.")
return;
end
if command == nil then
logger:error ("command is nil" )
return nil;
end
return string.byte(command)
end
------------------------------------------------------------------------------
--- read_id
-- @param socket
------------------------------------------------------------------------------
function read_id (client)
local size_to_read = 4
local id, status = client:receive(size_to_read)
if(status == "closed") then
logger:error("Connection closed by foreign host. Failed to read id")
return nil;
end
return strbytes_to_num(id)
end
------------------------------------------------------------------------------
--- read_expiry
-- @param socket
------------------------------------------------------------------------------
function read_expiry (client)
local size_to_read = 4
local expiry, status = client:receive(size_to_read)
if(status == "closed") then
logger:error("Connection closed by foreign host. Failed to read expiry ")
return nil;
end
return strbytes_to_num(expiry)
end
------------------------------------------------------------------------------
--- read_length_val
-- @param socket
------------------------------------------------------------------------------
function read_length_val (client, size_to_read, hex_str)
local data_len, status = client:receive(size_to_read)
if(status == "closed") then
logger:error("Connection closed by foreign host. Failed to read data_len")
return;
end
data_len = strbytes_to_num(data_len)
local data, status = client:receive(data_len)
if(status == "closed") then
logger:error("Connection closed by foreign host. Failed to read data")
return;
end
if hex_str == true then
return bytes_to_hex_str(data)
else
return bytes_to_str(data)
end
end
------------------------------------------------------------------------------
--- reply
-- @param socket
------------------------------------------------------------------------------
function reply (client, id)
--[=====[
local bytes_sent, status = client:send(8)
if(status == "closed") then
logger:error("Connection closed by foreign host. Failed to send response")
return;
end
local bytes_sent, status = client:send(0)
if(status == "closed") then
logger:error("Connection closed by foreign host. Failed to send response")
return;
end
local bytes_sent, status = client:send(id)
if(status == "closed") then
logger:error("Connection closed by foreign host. Failed to send response")
return;
end
--]=====]
end
------------------------------------------------------------------------------
--- Get command line optipo
-- @param args
-- @param options
------------------------------------------------------------------------------
function getopt( arg, options )
local tab = {}
for k, v in ipairs(arg) do
if string.sub( v, 1, 2) == "--" then
local x = string.find( v, "=", 1, true )
if x then tab[ string.sub( v, 3, x-1 ) ] = string.sub( v, x+1 )
else tab[ string.sub( v, 3 ) ] = true
end
elseif string.sub( v, 1, 1 ) == "-" then
local y = 2
local l = string.len(v)
local jopt
while ( y <= l ) do
jopt = string.sub( v, y, y )
if string.find( options, jopt, 1, true ) then
if y < l then
tab[ jopt ] = string.sub( v, y+1 )
y = l
else
tab[ jopt ] = arg[ k + 1 ]
end
else
tab[ jopt ] = true
end
y = y + 1
end
end
end
return tab
end
------------------------------------------------------------------------------
--- Validate arguments
-- @return host, port and task_file
------------------------------------------------------------------------------
local function validate_args(arg)
local usage = "Usage apns-sim.lua -t ssl_enabled [ -k ssl_key -c ssl_cert] [ -s server -p port -l loglevel ]"
local opts = getopt( arg, "tkchspl" )
if(opts["h"] ~= nil) then
print(usage)
return;
end
local loglevel = opts["l"]
if(loglevel == nil) then
loglevel = "info"
elseif(loglevel ~= "debug" and loglevel ~= "info" and loglevel ~= "warn" and loglevel ~= "error") then
print("Error: Invalid loglevel: " .. loglevel .. ". Valid options are debug, info, warn or error")
return;
end
if not opts["t"] or opts["t"] == false then
ssl_enabled = false
logger:info("SSL is disabled")
else
logger:info("SSL is enabled")
end
local ssl_key = opts["k"]
if not ssl_key and ssl_enabled then
logger:error("ssl_key is mandatory")
print(usage)
return;
end
local ssl_cert = opts["c"]
if not ssl_cert and ssl_enabled then
logger:error("ssl_key is mandatory")("ssl_cert is mandatory")
print(usage)
return;
end
local host = opts["s"]
if(host == nil) then host = "127.0.0.1" end
local port = opts["p"]
if(port == nil ) then port = "8080" end
params = {
mode = "server",
protocol = "tlsv1",
key = ssl_key,
certificate = ssl_cert,
-- cafile = "/etc/certs/CA.pem",
-- verify = {"peer", "fail_if_no_peer_cert"},
options = {"all", "no_sslv2"},
ciphers = "ALL:!ADH:@STRENGTH",
}
return host, port, loglevel
end
------------------------------------------------------------------------------
--- set the log level
------------------------------------------------------------------------------
local function set_loglevel(logger, level)
if("debug" == level) then logger:setLevel (logging.DEBUG)
elseif("info" == level) then logger:setLevel (logging.INFO)
elseif("warn" == level) then logger:setLevel (logging.WARN)
elseif("error" == level) then logger:setLevel (logging.ERROR)
else logger:setLevel (logging.ERROR)
end
end
------------------------------------------------------------------------------
--- main function (entry point)
-- @return content of the task file
------------------------------------------------------------------------------
local function main()
-- parse command line args and validate
local host, port, loglevel = validate_args(arg)
if(host == nil or port == nil or loglevel == nil) then return end
set_loglevel(logger, loglevel)
logger:debug("Binding to " .. host .. ":" .. port)
server_socket = socket.bind(host, port)
copas.addserver(server_socket,
function(c) return client_handler(c, c:getpeername()) end
)
copas.loop(0.1)
end
---- start main
main()
|
-- create unit at pointer or given location
-- wraps modtools/create-unit.lua
--[[=begin
spawnunit
=========
``spawnunit RACE CASTE`` creates a unit of the given race and caste at the cursor, by
wrapping `modtools/create-unit`. Run ``spawnunit help`` for more options.
=end]]
usage = [[Usage:
- spawnunit RACE CASTE
- spawnunit RACE CASTE NAME
- spawnunit RACE CASTE NAME x y z
- spawnunit RACE CASTE [NAME] [additional arguments]
Create a unit
- spawnunit -help
Display this help message
- spawnunit -command ARGUMENTS
Display the command used to invoke modtools/create-unit
additional arguments are passed to modtools/create-unit -
see "modtools/create-unit -help" for more information.
]]
function extend(tbl, tbl2)
for _, v in pairs(tbl2) do
table.insert(tbl, v)
end
end
local show_command = false
local args = {...}
local first_arg = (args[1] or ''):gsub('^-*', '')
if first_arg == 'help' or #args < 2 then
print(usage)
return
elseif first_arg == 'command' then
show_command = true
table.remove(args, 1)
end
local new_args = {'-race', args[1], '-caste', args[2]}
if #args == 3 then
extend(new_args, {'-nick', args[3]})
elseif #args == 6 then
if tonumber(args[4]) and tonumber(args[5]) and tonumber(args[6]) then
extend(new_args, {'-nick', args[3], '-location', '[', args[4], args[5], args[6], ']'})
end
else
local start = 3
if #args >= 3 and args[3]:sub(1, 1) ~= '-' then
extend(new_args, {'-nick', args[3]})
start = 4
end
for i = start, #args do
table.insert(new_args, args[i])
end
end
if show_command then
print('modtools/create-unit ' .. table.concat(new_args, ' '))
return
end
dfhack.run_script('modtools/create-unit', table.unpack(new_args))
|
local testEnv = require "./test-env"
local tCommandFile = fs.open(".command.json", "r")
local sCommandRaw = tCommandFile.readAll()
tCommandFile.close()
local tCommand = textutils.unserializeJSON(sCommandRaw)
-- Initializing the tests
for _1, sFile in ipairs(tCommand.files) do
print("Running tests in " .. sFile .. " ...")
os.run({
describe = describe,
expect = expect,
}, sFile)
end
-- Grep tests
local tSuiteNames = testEnv.grep(tCommand.suitsGrep, tCommand.testsGrep)
-- Run all matched tests
pcall(testEnv.run, tSuiteNames)
-- Write output to file
print("Finalizing...")
local tOutputFile = fs.open(".output.json", "w")
tOutputFile.write(testEnv.globalContext.toJSON())
tOutputFile.close()
print("Done")
-- Close the emulator
cctools.finish();
|
-- file : APP.lua
local module = {}
local mqtt_id = 6666
local mqtt_topic_adc = "/your_mqtt_topic/moisture_adc"
local adc_val = 0
local sleep_timer
local function cb_adc(val)
adc_val = val
end
local function sleep()
node.dsleep(60000000) -- 60 seconds
end
-- callback when MQTT is connected
local function callback_mqtt()
mod_mqtt.send(mqtt_topic_adc, adc_val)
sleep_timer = tmr.create()
sleep_timer:alarm(2000, tmr.ALARM_SINGLE, sleep)
end
-- callback on INITIAL wifi connect: start all required functionality
local function callback_connect()
mod_mqtt.init(mqtt_id, callback_mqtt)
end
function module.start()
_G.APP_Version = "2.2"
_G.APP_Name = "PLANT"
mod_wifi.init(callback_connect)
mod_adc.init(1000, 5, cb_adc)
end
return module
|
local xlsx = require 'xlsx'
-- Load a workbook with one sheet, display its contents and
-- save into another file.
--if Tilde then Tilde('disable') end
local workbook = xlsx.Workbook(arg[1])
if Tilde then Tilde('enable') end
for sheetIndex = 1, workbook:GetTotalWorksheets() do
local sheet1 = workbook[sheetIndex]
local maxRows = sheet1:GetTotalRows()
local maxCols = sheet1:GetTotalCols()
print(sheetIndex, "Dimension of " .. sheet1:GetSheetName() .. " (" .. maxRows .. ", " .. maxCols .. ")")
print()
for c = 0, maxCols - 1 do io.write(("%10d|"):format(c + 1)) end
io.write('\n')
for r = 0, maxRows - 1 do
io.write(("%10d|"):format(r + 1))
for c = 0, maxCols - 1 do
local cell = sheet1:Cell(r, c)
if cell then
local cellType = cell:Type()
if cellType == cell.UNDEFINED then
io.write(' |')
elseif cellType == cell.BOOLEAN then
io.write(("%10s|"):format(cell:GetBoolean() and 'TRUE' or 'FALSE'))
elseif cellType == cell.INT then
io.write(("%10d|"):format(cell:GetInteger()))
elseif cellType == cell.DOUBLE then
io.write(("%10.6g|"):format(cell:GetDouble()))
elseif cellType == cell.STRING then
io.write(("%10s|"):format(cell:GetString()))
elseif cellType == cell.WSTRING then
io.write(("%10s|"):format(tostring(cell:GetWString())))
end
else
io.write(' |')
end
end
io.write('\n')
end
io.write('\n')
end
|
local config = {
id = 'modTopButton',
name = 'Teleport',
img = 'button',
options = {
['Saffron [FREE]'] = '!teleport Saffron',
['Battle City [VIP]'] = '!teleport Battle City',
['Hunter Village [VIP]'] = '!teleport Hunter Village',
['Cerulean [FREE]'] = '!teleport Cerulean',
['Lavender [FREE]'] = '!teleport Lavender',
['Fuchsia [FREE]'] = '!teleport Fuchsia',
['Celadon [FREE]'] = '!teleport Celadon',
['Viridian [FREE]'] = '!teleport Viridian',
['Vermilion [FREE]'] = '!teleport Vermilion',
['Pewter [FREE]'] = '!teleport Pewter',
['Pallet [FREE]'] = '!teleport Pallet',
['Cinnabar [FREE]'] = '!teleport Cinnabar',
['Goldenrod [FREE]'] = '!teleport Goldenrod',
['Cherrygrove [FREE]'] = '!teleport Cherrygrove',
['Ecruteak [FREE]'] = '!teleport Ecruteak',
['Olivine [FREE]'] = '!teleport Olivine',
['Violet [FREE]'] = '!teleport Violet',
['Azalea [FREE]'] = '!teleport Azalea',
['New Bark [FREE]'] = '!teleport New Bark',
['Mahogany [FREE]'] = '!teleport Mahogany',
['Larosse [FREE]'] = '!teleport Larosse',
['Orre [FREE]'] = '!teleport Orre',
['Canavale [FREE]'] = '!teleport Canavale',
}
}
function init()
connect(g_game, { onGameStart = reload, onGameEnd = reload})
TopButton = modules.client_topmenu.addRightGameToggleButton(config.id, tr(config.name), config.img, toggle, true)
TopButton:setOn(true)
reload()
end
function toggle()
local menu = g_ui.createWidget('PopupMenu')
for _name, _command in pairs(config.options) do
menu:addOption(_name, function() g_game.talk(_command) end)
end
menu:display()
end
function reload()
TopButton:setVisible(g_game.isOnline())
end
|
-- Copyright 2022 Blake Covarrubias
--
-- 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.
-- Import utility functions
-- Ensure that this plugin's utilities are loaded first.
package.prepend_path("plugins/consul")
local util = require("util")
-- Debug log levels
local debug = util.debug.levels
local default_settings = {
debug_level = debug.DISABLED,
}
-- Set up debugging functions
function dprint(...)
end
function dprint2(...)
end
local reset_debug = function()
if default_settings.debug_level > debug.DISABLED then
dprint = function(...)
print(table.concat({"Lua (RPCGossip):", ...}, " "))
end
if default_settings.debug_level > debug.LEVEL_1 then
dprint2 = dprint
end
end
end
reset_debug()
-- RPC type
local rpc_type = "0x06"
-- Various dissectors
local msgpack_dissector = require("MessagePack")
local serf_dissector
-- Track the expected number of msgpack elements
local expected_msgpack_elements = {}
-- Header bytes for stream
local header_for_stream = {}
-- Track the packets that have already been processed
local seen_packets = {}
-- A map Raft Gossip packet type to readable name
local TRAFFIC_TYPE_MAP = {
[0x00] = "Packet",
[0x01] = "Stream",
}
local proto_rpc_gossip = Proto("RPCGossip", "Gossip")
local rpcgossip_fields = {
tag = ProtoField.string("rpcgossip.tag", "Tag", base.ASCII),
type = ProtoField.uint8("rpcgossip.type", "Type", base.DEC, TRAFFIC_TYPE_MAP),
addr_ip = ProtoField.ipv4("rpcgossip.addr.ip", "IP Addr", "IPv4 address that the packet was received on"),
addr_port = ProtoField.uint16("rpcgossip.addr.port", "IP Port", base.DEC),
addr_zone = ProtoField.string("rpcgossip.addr.zone", "Zone", base.ASCII),
}
proto_rpc_gossip.fields = rpcgossip_fields
proto_rpc_gossip.prefs.debug = Pref.enum("Debug level", default_settings.debug_level, "The debug level verbosity",
util.debug.pref_enum)
local pos = 0
--- Get the specified number of bytes from the Tvb and advance the cursor position
-- @function get_bytes
--
-- @tparam Tvb tvb A Testy Virtual(-izable) Buffer
-- @tparam number length The number of bytes to get from the buffer
-- @treturn TvbRange The TvbRange of the specified number of bytes
local function get_bytes(tvb, length)
local tvb_range = tvb:range(pos, length)
pos = pos + length
return tvb_range
end
--- Handle changes to Wireshark preferences for this protocol
-- @function proto_rpc_gossip.prefs_changed
function proto_rpc_gossip:prefs_changed()
-- Change debug level
default_settings.debug_level = proto_rpc_gossip.prefs.debug
reset_debug()
end
--- Set the protocol for future conversations to be RPC Gossip
-- @tparam Pinfo pinfo An object containing packet information
local function set_protocol(pinfo)
-- Associate the protocol with the stream for future packets if it
-- has not already been done
if pinfo.private.existing_dissector == nil then
dprint2("Associating packet", pinfo.number, "with the RPC Gossip protocol.")
pinfo.conversation = proto_rpc_gossip
end
-- Set the protocol name in the column output to Yamux
pinfo.columns.protocol:set(proto_rpc_gossip.name)
pinfo.columns.protocol:fence()
end
--- Take the given tvb and return a modified format that is suitable for adding
--- to the protocol tree.
-- @function transform_header
--
-- @tparam ByteArray byte_arr A ByteArray containing the header bytes
-- @treturn string A hex string of the re-encoded header bytes
local function transform_header(byte_arr)
-- Stop processing the packet if the MessagePack library is not
-- loaded
if msgpack_dissector == nil then
return 0
end
-- Decode the MessagePack data into a Lua table
local decoded_result = msgpack_dissector.unpack(byte_arr:raw())
-- Generate a new byte string with the following format:
-- 1 byte: Length of tag
-- n bytes: Tag
-- 1 byte: Header type
-- 2 bytes: Port where the packet was received
-- 16 bytes: IP where the packet was received
-- 1 byte: Length of zone
-- n bytes: Zone
local byte_str = Struct.pack(">i1c0>i1i2c0>ic0",
#decoded_result.Tag,
decoded_result.Tag,
decoded_result.Type,
decoded_result.Addr.Port,
decoded_result.Addr.IP,
#decoded_result.Addr.Zone,
decoded_result.Addr.Zone
)
return Struct.tohex(byte_str)
end
--- Initialization function for this protocol
-- Adds this protocol to the 'consul.protocol' dissector table
-- @function proto_rpc_gossip.init
function proto_rpc_gossip.init()
-- This shouldn't be necessary, but return if the RPC type isn't set
if not rpc_type then
return
end
-- Register this protocol pattern with our parent dissector
util.register_protocol_pattern(rpc_type)
-- Register this protocol pattern with the consul.protocol table in Wireshark
local consul_proto_dissector_table = DissectorTable.get("consul.protocol")
if consul_proto_dissector_table then
consul_proto_dissector_table:add(rpc_type, proto_rpc_gossip)
end
if gui_enabled() then
-- Set the color of the packets from this protocol
-- Color: Yellow 1
set_color_filter_slot(8, string.lower(proto_rpc_gossip.name))
end
-- Get Serf dissector
serf_dissector = Dissector.get("serf")
end
--- Dissector for the RPC Gossip protocol
-- Parses a Tvb to determine if it is a Yamux frame
-- @function proto_rpc_gossip.dissector
--
-- @tparam Tvb tvb A Testy Virtual(-izable) Buffer
-- @tparam Pinfo pinfo An object containing packet information
-- @tparam TreeItem tree An object representing the root of the packet tree
-- @treturn number The number of bytes processed by this dissector
function proto_rpc_gossip.dissector(tvb, pinfo, tree)
-- Get length of Tvb
local buffer_length = tvb:captured_len()
-- Skip processing of packets that are empty
if buffer_length == 0 then
return 0
end
-- Get the stream ID for this packet. This should have been set by the Yamux
-- dissector. The format should be "<TCP stream ID>-<Yamux stream ID>"
local stream_id = pinfo.private.yamux_stream_id
-- Create cache for header packet
if header_for_stream[stream_id] == nil then
header_for_stream[stream_id] = {
complete = false,
packet = nil,
bytes = ByteArray.new(),
-- Holds the state for processing this stream
state = {
expected_msgpack_elements = {}
}
}
end
if buffer_length == 1 and util.number_to_hex(tvb:range(0, 1):uint()) == rpc_type then
-- Stop processing if the packet if it is just an RPC type byte
set_protocol(pinfo)
return buffer_length
end
-- If the header has been constructed, then we can process the packet
local header = header_for_stream[stream_id]
local state = header.state
local expected_msgpack_elements = state.expected_msgpack_elements
-- Reset cursor position to zero
pos = 0
-- If a stream is marked as complete, process the parsed header
if header.complete then
-- Do not process packets that have already been processed
if pinfo.number < header.packet and seen_packets[pinfo.number] then
return buffer_length
-- If the packet is the one with the decoded header
elseif pinfo.number == header.packet then
-- Append the header to this packet as a separate tvb
local ba
if type(header.bytes) == "userdata" then
if util.is_msgpack_map(header.bytes:tvb()) then
-- For some reason the header was not properly converted to
-- the new format, so we need to convert it here
local converted_header = transform_header(header.bytes)
header.bytes = converted_header
else
dprint2("Tried to decode header as msgpack, but it was already decoded.")
end
else
ba = ByteArray.new(header.bytes)
end
pinfo.columns.info = "Header for stream " .. stream_id
pinfo.columns.info:fence()
set_protocol(pinfo)
local assembled_tvb = ba:tvb("Constructed header")
local subtree = tree:add(proto_rpc_gossip, assembled_tvb(), "RPC Gossip Header")
local tag_len = get_bytes(assembled_tvb, 1):uint()
subtree:add(rpcgossip_fields.tag, get_bytes(assembled_tvb, tag_len)):set_generated()
subtree:add(rpcgossip_fields.type, get_bytes(assembled_tvb, 1)):set_generated()
subtree:add(rpcgossip_fields.addr_port, get_bytes(assembled_tvb, 2)):set_generated()
-- Advance the position by 12 bytes to skip the subnet mask in the
-- encoded IPv4 address
pos = pos + 12
subtree:add(rpcgossip_fields.addr_ip, get_bytes(assembled_tvb, 4)):set_generated()
local zone_len = get_bytes(assembled_tvb, 1):uint()
subtree:add(rpcgossip_fields.addr_zone, get_bytes(assembled_tvb, zone_len)):set_generated()
-- Return the length of the packet so that Wireshark correctly knows
-- that this packet was processed, even though it contains additional
-- generated data
return buffer_length
-- If the packet comes after the decoded header, it must be a Serf packet
elseif pinfo.number > header.packet then
if serf_dissector == nil then
return 0
end
-- Decode the remaining packets with the Serf dissector
pinfo.private.existing_dissector = "true"
local dissected_bytes = serf_dissector:call(tvb, pinfo, tree)
if dissected_bytes == 0 then
dprint2("The Serf dissector returned 0 bytes when attempting to dissect packet", pinfo.number)
end
return dissected_bytes
end
else
-- Skip packets that have already been processed. This is to prevent
-- duplicate entries in the packet list.
--
-- We can't rely on pinfo.visited because that is set to true when any
-- dissector processes the packet, and this dissector is only called as
-- a sub-dissector of a parent dissector.
if seen_packets[pinfo.number] then
return buffer_length
end
end
-- Mark the packet as already processed so that it is not processed again
seen_packets[pinfo.number] = true
-- This protocol will stream MessagePack data in chunks.
-- We need to parse the chunks, track the number of expected frames,
-- and build the complete packet.
-- TODO (blake): Correctly handle 'stream' session types where large chunks
-- of data are sent in some packets.
if buffer_length == 1 then
local peek_byte = tvb():uint()
-- This might be a stream message that we will need to dissect later
if util.is_msgpack_map(tvb) then
-- Need to multiply the map length by four because the length of keys
-- and their values are provided in separate packets.
-- If a map length is three, then the data will received as
-- described below.
-- 'P' is the packet number, 'K' is the key, and 'V' is the value
--
-- P1: Length of K
-- P2: Value for K
-- P3: Length of V
-- P4: V
--
-- This is repeated for each element in the map, so the map length
-- must be multiplied by four to account for the total number of
-- packets required to complete the map.
local map_len = (tvb:range(0, 1):bitfield(4, 4)) * 4
-- Append the current byte to the header bytes buffer
header.bytes:append(tvb:bytes())
local msgpack_elems_len = #expected_msgpack_elements
if msgpack_elems_len == 0 then
-- This is the first map in the stream.
-- Set the number of expected elements and return
table.insert(expected_msgpack_elements, map_len)
return buffer_length
else
-- Decrement the current map's expected number of elements
expected_msgpack_elements[msgpack_elems_len] =
expected_msgpack_elements[msgpack_elems_len] - 1
if expected_msgpack_elements[msgpack_elems_len] == 0 then
-- Still only processing one map.
-- Set the expected elements to the next map's length
expected_msgpack_elements[msgpack_elems_len] = map_len
else
-- We are processing another map inside the existing map.
-- Add the map length to the current list of expected elements
table.insert(expected_msgpack_elements, map_len)
end
return buffer_length
end
elseif util.is_msgpack_fixstr(tvb) then
state.next_element_length = tvb:range(0, 1):bitfield(3, 5)
header.bytes:append(tvb:bytes())
dprint2("Processed a fixed string. The next element length is:", state.next_element_length)
-- This signifies that the next item is a 16-bit integer, so there
-- are two bytes to read from the next packet
elseif tostring(tvb(0, 1)) == "cd" then
state.next_element_length = 2
header.bytes:append(tvb:bytes())
elseif util.is_msgpack_pos_fixint(tvb) then
header.bytes:append(tvb:bytes())
-- Set the next expected element length to zero, because we don't
-- know the expected length
state.next_element_length = 0
end
elseif state.next_element_length == tvb:len() then
header.bytes:append(tvb:bytes())
dprint2("Packet", pinfo.number, "with bytes", tostring(tvb:bytes()),
"matches the expected length for the next packet, which was", state.next_element_length)
else
dprint2("Packet", pinfo.number, "The length of this TVB", tvb:len(), "doesn't match the expected length",
state.next_element_length)
return 0
end
local msgpack_elems_len = #expected_msgpack_elements
if #expected_msgpack_elements > 0 then
local remaining_items = expected_msgpack_elements[#expected_msgpack_elements]
if remaining_items > 0 then
-- Decrement the number of msgpack elements by one
remaining_items = remaining_items - 1
end
-- If there are no more items in the map, or the last item is an empty
-- string, then remove the last element from the list
if remaining_items == 0 or (remaining_items == 1 and state.next_element_length == 0) then
dprint2("There are no more remaining elements")
table.remove(expected_msgpack_elements)
-- This means one map element has been processed, so decrease the map length
-- for the parent map
if #expected_msgpack_elements > 0 then
expected_msgpack_elements[#expected_msgpack_elements] =
expected_msgpack_elements[#expected_msgpack_elements] - 1
return buffer_length
end
dprint2("Ending (early) with the expected number of msgpack elements",
table.concat(expected_msgpack_elements, ", "))
else
expected_msgpack_elements[#expected_msgpack_elements] = remaining_items
end
end
if #expected_msgpack_elements == 0 then
-- Mark the packet as fully processed
header.complete = true
header.packet = pinfo.number
-- Byte Arrays don't survive across dissection calls, so the header
-- bytes must be saved as a string value in the global scope so that it
-- will persist. The packet contents are encoded in a format defined in
-- transform_header() that is used later to reconstruct the header.
local transformed_bytes = transform_header(header.bytes)
header.bytes = transformed_bytes
end
return buffer_length
end
|
local AddonName, AddonTable = ...
AddonTable.draktharon = {
-- Trollgore
35618, -- Troll Butcherer
35620, -- Berserker's Horns
37715, -- Cowl of the Dire Troll
37714, -- Batrider's Cord
35619, -- Infection Resistant Legguards
37717, -- Legs of Physical Regeneration
37712, -- Terrace Defence Boots
-- Novos the Summoner
37721, -- Cursed Lich Blade
35630, -- Summoner's Stone Gavel
37718, -- Temple Crystal Fragment
35631, -- Crystal Pendant of Warding
157558, -- Shoddily Stitched Shoulderguards
37722, -- Breastplate of Undeath
35632, -- Robes of Novos
40490, -- Necromantic Wristguards
-- King Dred
35633, -- Staff of the Great Reptile
37726, -- King Dred's Helm
35634, -- Scabrous-Hide Helm
37724, -- Handler's Arm Strap
37725, -- Savage Wound Wrap
157561, -- Dino-Toothed Waistguard
35635, -- Stable Master's Breeches
37723, -- Incisor Fragment
-- The Prophet Tharon'ja
37733, -- Mojo Masked Crusher
35636, -- Tharon'ja's Aegis
35638, -- Helmet of Living Flesh
37735, -- Ziggurat Imprinted Chestguard
37788, -- Limb Regeneration Bracers
37798, -- Overlook Handguards
37791, -- Leggings of the Winged Serpent
35637, -- Muradin's Lost Greaves
37784, -- Keystone Great-Ring
37732, -- Spectral Seal of the Prophet
37734, -- Talisman of Troll Divinity
-- Quests
--- Head Games (13129)
44369, -- Disavowed Bracers
44367, -- Scorned Bands
44366, -- Shameful Cuffs
44368, -- Accused Wristguards
--- Cleansing Drak'Tharon (30120 / 12238)
40758, -- shroud-of-temptation
40755, -- enticing-sabatons
40757, -- shackles-of-dark-whispers
40756, -- shoulders-of-the-seducer
}
|
local _, Addon = ...
if not Addon.IS_RETAIL then return end
local DB = Addon.DB
local DTL = Addon.Libs.DTL
local L = Addon.Libs.L
local REASON = Addon.Filters:SellReason(
L.IGNORE_TEXT,
L.BY_TYPE_TEXT,
L.IGNORE_EQUIPMENT_SETS_TEXT
)
local EQUIPMENT_SETS_CAPTURE = _G.EQUIPMENT_SETS:gsub("%%s", "(.*)")
local function run(item, ignore, reason)
if ignore.equipmentSets then
if not DTL:ScanBagSlot(item.Bag, item.Slot) then
return Addon.Filters:IncompleteTooltipError()
end
if (not not DTL:Match(false, EQUIPMENT_SETS_CAPTURE)) then
return "NOT_JUNK", reason
end
end
return "PASS"
end
-- Dejunker
Addon.Filters:Add(Addon.Dejunker, {
Run = function(_, item)
return run(item, DB.Profile.sell.ignore, REASON)
end
})
|
local activitynet_utils = {}
function activitynet_utils.load_annotation_data(data_file_path)
return json.load(data_file_path)
end
function activitynet_utils.get_class_labels(data)
local leaf_names = {}
for k, v in pairs(data.taxonomy) do
local is_leaf = true
for k2, v2 in pairs(data.taxonomy) do
if v2.parentId == v.nodeId then
is_leaf = false
break
end
end
if is_leaf then
table.insert(leaf_names, v.nodeName)
end
end
local class_labels = {}
for k, v in pairs(leaf_names) do
class_labels[v] = k
end
return class_labels
end
function activitynet_utils.get_data_names_and_annotations(data, video_directory_path)
local training_video_names = {}
local training_annotations = {}
local validation_video_names = {}
local validation_annotations = {}
local test_video_names = {}
local test_annotations = {}
for k, v in pairs(data.database) do
subset = v.subset
if subset == 'testing' then
table.insert(test_video_names, string.format('v_%s', k))
table.insert(test_annotations, v.annotations)
else
if subset == 'training' then
table.insert(training_video_names, string.format('v_%s', k))
table.insert(training_annotations, v.annotations)
else
table.insert(validation_video_names, string.format('v_%s', k))
table.insert(validation_annotations, v.annotations)
end
end
end
return training_video_names, training_annotations,
validation_video_names, validation_annotations,
test_video_names, test_annotations
end
function activitynet_utils.calculate_fps_stats(data_file_path, video_directory_path)
require('paths')
require('utils')
local fps_lists = {}
local data = load_annotation_data(data_file_path)
local n_videos = 0
for _, _ in pairs(data.database) do
n_videos = n_videos + 1
end
local i = 1
for k, v in pairs(data.database) do
xlua.progress(i, n_videos)
local video_name = string.format('v_%s.mp4', k)
local video_file_path = paths.concat(video_directory_path, video_name)
if paths.filep(video_file_path) then
table.insert(fps_lists, utils.get_fps(video_file_path))
end
i = i + 1
end
fps_lists = torch.Tensor(fps_lists)
print(torch.mean(fps_lists), torch.std(fps_lists))
end
return activitynet_utils
|
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_HEALING)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
combat:setParameter(COMBAT_PARAM_DISPEL, CONDITION_BLEEDING)
combat:setParameter(COMBAT_PARAM_AGGRESSIVE, false)
function onGetFormulaValues(player, level, magicLevel)
local min = 90000
local max = 110000
return min, max
end
combat:setCallback(CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")
function onCastSpell(creature, variant)
return combat:execute(creature, variant)
end
|
AddCSLuaFile()
PANEL.Base = "Panel"
function PANEL:Init()
self.CurrentSearch = ""
self.OldResults = -1
self.RebuildResults = false
self:Dock( TOP )
self:SetHeight( 20 )
self:DockMargin( 0, 0, 0, 3 )
self.Search = self:Add( "DTextEntry" )
self.Search:Dock( FILL )
self.Search:SetPlaceholderText( "#spawnmenu.search" )
self.Search.OnEnter = function() self:RefreshResults() end
self.Search.OnFocusChanged = function( _, b ) if ( b ) then self.ContentPanel:SwitchPanel( self.PropPanel ) end end
self.Search:SetTooltip( "#spawnmenu.enter_search" )
local btn = self.Search:Add( "DImageButton" )
btn:SetImage( "icon16/magnifier.png" )
btn:SetText( "" )
btn:Dock( RIGHT )
btn:DockMargin( 4, 2, 4, 2 )
btn:SetSize( 16, 16 )
btn:SetTooltip( "#spawnmenu.press_search" )
btn.DoClick = function()
self:RefreshResults()
end
self.Search.OnKeyCode = function( p, code )
if ( code == KEY_F1 ) then hook.Run( "OnSpawnMenuClose" ) end
if ( code == KEY_ESCAPE ) then hook.Run( "OnSpawnMenuClose" ) end
end
self.PropPanel = vgui.Create( "ContentContainer", self )
self.PropPanel:SetVisible( false )
self.PropPanel:SetTriggerSpawnlistChange( false )
-- Some sort of placeholder
local Header = self:Add( "ContentHeader" )
Header:SetText( "#spawnmenu.enter_search" )
self.PropPanel:Add( Header )
end
function PANEL:Paint()
-- This is a bit of a hack, if there was a request to rebuild the results from the search indexer
-- Do it when the player next sees the search panel, in case they got the spawnmenu closed
-- Think hook causes unexpected 1 frame duplication of all the elements
if ( self.RebuildResults ) then
self.RebuildResults = false
self:RefreshResults( self.CurrentSearch )
end
end
function PANEL:SetSearchType( stype, hookname )
self.m_strSearchType = stype
hook.Add( hookname, "AddSearchContent_" .. hookname, function( pnlContent, tree, node )
self.ContentPanel = pnlContent
end )
hook.Add( "SearchUpdate", "SearchUpdate_" .. hookname, function()
if ( !g_SpawnMenu:IsVisible() ) then self.RebuildResults = true return end
self:RefreshResults( self.CurrentSearch )
end )
-- This stuff is only for the primary search
if ( hookname != "PopulateContent" ) then return end
g_SpawnMenu.SearchPropPanel = self.PropPanel
hook.Add( "StartSearch", "StartSearch", function()
if ( g_SpawnMenu:IsVisible() ) then return hook.Run( "OnSpawnMenuClose" ) end
hook.Run( "OnSpawnMenuOpen" )
hook.Run( "OnTextEntryGetFocus", self.Search )
self.Search:RequestFocus()
self.Search:SetText( "" )
--
-- If we don't call this we'd have to press F1 twice to close it!
-- It's in a timer because of some good reason that!
--
timer.Simple( 0.1, function() g_SpawnMenu:HangOpen( false ) end )
self.ContentPanel:SwitchPanel( self.PropPanel )
end )
end
function PANEL:RefreshResults( str )
if ( !str ) then -- User tried to search for something
self.CurrentSearch = self.Search:GetText()
str = self.CurrentSearch
self.OldResults = -1
else
-- Don't force open the search when you click away from search while this function is called from cl_search_models.lua
if ( self.ContentPanel.SelectedPanel != self.PropPanel ) then
return
end
end
if ( !str or str == "" ) then return end
local results = search.GetResults( str, self.m_strSearchType, GetConVarNumber( "sbox_search_maxresults" ) )
for id, result in pairs( results ) do
if ( !IsValid( result.icon ) ) then ErrorNoHalt( "Failed to create icon for " .. ( result.words && isstring( result.words[ 1 ] ) && result.words[ 1 ] || result.text ).. "\n" ) continue end
result.icon:SetParent( vgui.GetWorldPanel() ) -- Don't parent the icons to search panel prematurely
end
-- I know this is not perfect, but this is the best I am willing to do with how the search library was set up
if ( self.OldResults == #results ) then -- No updates, don't rebuild
for id, result in pairs( results ) do
if ( IsValid( result.icon ) ) then result.icon:Remove() end -- Kill all icons
end
return
end
self.OldResults = #results
self.PropPanel:Clear()
local Header = self:Add( "ContentHeader" )
Header:SetText( #results .. " Results for \"" .. str .. "\"" )
self.PropPanel:Add( Header )
for k, v in pairs( results ) do
self:AddSearchResult( v.text, v.func, v.icon )
end
self.PropPanel:SetParent( self.ContentPanel )
self.ContentPanel:SwitchPanel( self.PropPanel )
end
function PANEL:AddSearchResult( text, func, icon )
if ( !IsValid( icon ) ) then return end
icon:SetParent( self.PropPanel )
self.PropPanel:Add( icon )
end
|
local awful = require("awful")
--- Start applications automatically when Awesome initializes.
--- Apps started with autorun will only run once. They will not be run if
--- awesome restarts.
-- @param autorun_apps Table of GUI applications to run on startup.
-- Each element of the table is itself a table with the following structure:
-- name - String; the client application's name.
-- opts - String; any additional cli args for the command.
-- tag - String; the name of the tag in which to open the client.
local function autorun(autorun_apps)
-- Iterator for-loop construct in Lua
for i, app in ipairs(autorun_apps) do
local app_string = app["name"]
local opts = app["opts"]
-- Sometimes a unique ID is necessary to spawn multiple instances of the
-- same app.
local id = app["id"]
local rules = {}
rules["tag"] = app["tag"]
if opts ~= nil and opts ~= "" then
app_string = app_string .. " " .. opts
end
if id ~= nil and id ~= "" then
awful.spawn.once(
app_string,
rules,
function(c)
return c.startup_id == id
end,
id
)
else
awful.spawn.once(app_string, rules)
end
end
end
return autorun
|
--[[
/////// //////////////////
/////// PROJECT: MTA iLife - German Fun Reallife Gamemode
/////// VERSION: 1.7.2
/////// DEVELOPERS: See DEVELOPERS.md in the top folder
/////// LICENSE: See LICENSE.md in the top folder
/////// /////////////////
]]
CQuestLog = {}
function CQuestLog:constructor()
self.enabled = false;
self.Window = new(CDxWindow, "Quest Log", 755, 600, true, true, "Center|Middle")
self.Window:setHideFunction(
function()
self.Window:hide()
self.enabled = false;
end
)
self.dxList = new(CDxList, 10, 20, 320, 530, tocolor(125,125,125,200), self.Window, false)
self.dxList:addColumn("Quest")
self.dxList:addClickFunction(
function()
self:refresh()
end
)
self.IDS = {}
self.NameLabel = new(CDxLabel, "Name:",350, 20, 400, 25, tocolor(255,255,255,255), 1.0, "default-bold", "left", "top", self.Window)
self.Name = new(CDxLabel, "",350, 50, 400, 25, tocolor(255,255,255,255), 1.0, "default", "left", "top", self.Window)
self.DescLabel = new(CDxLabel, "Beschreibung:",350, 90, 400, 25, tocolor(255,255,255,255), 1.0, "default-bold", "left", "top", self.Window)
self.Desc = new(CDxLabel, "",350, 120, 400, 150, tocolor(255,255,255,255), 1.0, "default", "left", "top", self.Window)
self.TargetLabel = new(CDxLabel, "Aktuelles Ziel:",350, 290, 400, 25, tocolor(255,255,255,255), 1.0, "default-bold", "left", "top", self.Window)
self.Target = new(CDxLabel, "",350, 320, 400, 25, tocolor(255,255,255,255), 1.0, "default", "left", "top", self.Window)
self.RewardLabel = new(CDxLabel, "Belohnung:",350, 360, 400, 25, tocolor(255,255,255,255), 1.0, "default-bold", "left", "top", self.Window)
self.Reward = new(CDxLabel, "",350, 390, 400, 110, tocolor(255,255,255,255), 1.0, "default", "left", "top", self.Window)
self.AbortButton = new(CDxButton, "Abbrechen", 340, 500, 200, 42, tocolor(255,255,255,255), self.Window)
self.FollowButton = new(CDxButton, "Verfolgen", 545, 500, 200, 42, tocolor(255,255,255,255), self.Window)
self.AbortButton:addClickFunction(
function()
confirmDialog:showConfirmDialog("Bist du sicher, dass du diese Quest abbrechen möchtest?",
function()
triggerServerEvent("onPlayerAbortQuest", getRootElement(), self.ID)
self.enabled = false;
self.Window:hide()
end, false, false)
end
)
self.AbortButton:setVisible(false)
self.FollowButton:setVisible(false)
self.AbortButton:setDisabled(true)
self.FollowButton:setDisabled(true)
self.Window:add(self.dxList)
self.Window:add(self.NameLabel)
self.Window:add(self.Name)
self.Window:add(self.DescLabel)
self.Window:add(self.Desc)
self.Window:add(self.TargetLabel)
self.Window:add(self.Target)
self.Window:add(self.RewardLabel)
self.Window:add(self.Reward)
self.Window:add(self.AbortButton)
self.Window:add(self.FollowButton)
bindKey("j", "down",
function()
if (LoggedIn) then
QuestLog:toggle()
end
end
)
end
function CQuestLog:destructor()
end
function CQuestLog:toggle()
if not (clientBusy) or (self.enabled) then
if not(self.enabled) then
self:refreshQuests()
self:refresh()
self.Window:show()
self.enabled = true;
playSound("res/sounds/wow/questlog_open.ogg")
else
self.Window:hide()
self.enabled = false;
playSound("res/sounds/wow/questlog_close.ogg")
end
end
end
function CQuestLog:refreshQuests()
self.dxList:clearRows()
self.IDS = {}
for k,v in pairs(PlayerActiveQuests) do
if(tonumber(k)) then
table.insert(self.IDS, tonumber(k))
self.dxList:addRow(Quests[tonumber(k)].Name)
end
end
end
function CQuestLog:refresh()
if (self.dxList.SelectedRow > 0) then
self.ID = self.IDS[self.dxList.SelectedRow]
self.NameLabel:setText("Name:")
self.Name:setText(Quests[self.ID].Name)
self.DescLabel:setText("Beschreibung:")
self.Desc:setText(Quests[self.ID].Text)
self.TargetLabel:setText("Aktuelles Ziel:")
self.Target:setText(parseString(Quests[self.ID].Texts[PlayerActiveQuests[tostring(self.ID)]]))
self.RewardLabel:setText("Belohnung:")
self.Reward:setText(formQuestRewardString(self.ID))
self.AbortButton:setVisible(true)
self.FollowButton:setVisible(true)
self.AbortButton:setDisabled(false)
self.FollowButton:setDisabled(true)
else
self.NameLabel:setText("Bitte wähle eine Quest aus!")
self.Name:setText("")
self.DescLabel:setText("")
self.Desc:setText("")
self.TargetLabel:setText("")
self.Target:setText("")
self.RewardLabel:setText("")
self.Reward:setText("")
self.AbortButton:setVisible(false)
self.FollowButton:setVisible(false)
self.AbortButton:setDisabled(true)
self.FollowButton:setDisabled(true)
end
end
QuestLog = new(CQuestLog)
|
--[[
StateMachine is a module that provides an implementation of the finite-state machine model.
For more information on finite-state machines and their uses: https://en.wikipedia.org/wiki/Finite-state_machine
StateMachine.create(infoByState: {string: {...}}, initialState: string) => machine: Machine
Create and return a new state machine based on the arguments passed.
infoByState should be a dictionary including the following key-value pairs:
entryAction?=(): (oldState: string, newState: string, ...args: any)
exitAction?=(): (oldState: string, newState: string, ...args: any)
stateByInput: {string: string}
Machine.input(input: string, ...args: any) => didChange: boolean
Transition to the next state if the current state supports a transition with input, and pass args to the transition actions.
Machine.disable()
Disconnect all transition event connections, preparing the machine for clean up and disabling its ability to change states.
Machine.currentState: string
Machine.isEnabled: boolean
Machine.isChangingState: boolean
Machine.stateChanged: RBXScriptSignal<oldState: string, newState: string, ...args: any>
--]]
local t = require(script.t)
local Reliable = require(script.Reliable)
local f = function() end
local StateMachine = {}
function StateMachine.create(infoByState, initialState)
local machine = {}
local connections = {}
local newInfoByState = {}
local stateChangedBindable = Instance.new("BindableEvent")
local currentState = initialState
-- register states
for state, info in pairs(infoByState) do
local newInfo = {}
newInfo.entryAction = info.entryAction or f
newInfo.exitAction = info.exitAction or f
newInfo.stateByInput = info.stateByInput
newInfoByState[state] = newInfo
end
-- construct methods
function machine.disable()
machine.isEnabled = false
for _, connection in ipairs(connections) do
connection:Disconnect()
end
end
function machine.input(input, ...)
if machine.isChangingState then
return false
end
local state = currentState
local currentStateInfo = newInfoByState[state]
local nextState = currentStateInfo.stateByInput[input]
if nextState == nil then
return false
end
machine.isChangingState = true
Reliable.spawn(currentStateInfo.exitAction, state, nextState, ...)
machine.currentState = nextState
machine.isChangingState = false
stateChangedBindable:Fire(state, nextState, ...)
Reliable.spawn(newInfoByState[nextState].entryAction, state, nextState, ...)
return true
end
machine.input = t.wrap(machine.input, t.tuple(t.string))
-- assign members
machine.currentState = currentState
machine.stateChanged = stateChangedBindable.Event
machine.isEnabled = true
machine.isChangingState = false
return machine
end
StateMachine.create = t.wrap(StateMachine.create, t.tuple(t.map(t.string, t.table), t.string))
return StateMachine
|
-- Generated By protoc-gen-lua Do not Edit
local protobuf = require "protobuf"
module('BseTreasureHuntQuery_pb', package.seeall)
local TREASUREHUNT = protobuf.Descriptor();
local TREASUREHUNT_MODE_FIELD = protobuf.FieldDescriptor();
local TREASUREHUNT_PRICE_FIELD = protobuf.FieldDescriptor();
local TREASUREHUNT_GIFTS_FIELD = protobuf.FieldDescriptor();
local TREASUREHUNT_RATIOS_FIELD = protobuf.FieldDescriptor();
local TREASUREHUNT_REFRESHSEC_FIELD = protobuf.FieldDescriptor();
local BSETREASUREHUNTQUERY = protobuf.Descriptor();
local BSETREASUREHUNTQUERY_COUNT_FIELD = protobuf.FieldDescriptor();
local BSETREASUREHUNTQUERY_TREASURES_FIELD = protobuf.FieldDescriptor();
TREASUREHUNT_MODE_FIELD.name = "mode"
TREASUREHUNT_MODE_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.TreasureHunt.mode"
TREASUREHUNT_MODE_FIELD.number = 1
TREASUREHUNT_MODE_FIELD.index = 0
TREASUREHUNT_MODE_FIELD.label = 1
TREASUREHUNT_MODE_FIELD.has_default_value = false
TREASUREHUNT_MODE_FIELD.default_value = 0
TREASUREHUNT_MODE_FIELD.type = 13
TREASUREHUNT_MODE_FIELD.cpp_type = 3
TREASUREHUNT_PRICE_FIELD.name = "price"
TREASUREHUNT_PRICE_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.TreasureHunt.price"
TREASUREHUNT_PRICE_FIELD.number = 2
TREASUREHUNT_PRICE_FIELD.index = 1
TREASUREHUNT_PRICE_FIELD.label = 1
TREASUREHUNT_PRICE_FIELD.has_default_value = false
TREASUREHUNT_PRICE_FIELD.default_value = 0
TREASUREHUNT_PRICE_FIELD.type = 13
TREASUREHUNT_PRICE_FIELD.cpp_type = 3
TREASUREHUNT_GIFTS_FIELD.name = "gifts"
TREASUREHUNT_GIFTS_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.TreasureHunt.gifts"
TREASUREHUNT_GIFTS_FIELD.number = 3
TREASUREHUNT_GIFTS_FIELD.index = 2
TREASUREHUNT_GIFTS_FIELD.label = 3
TREASUREHUNT_GIFTS_FIELD.has_default_value = false
TREASUREHUNT_GIFTS_FIELD.default_value = {}
TREASUREHUNT_GIFTS_FIELD.message_type = GIFT_PB_GIFT
TREASUREHUNT_GIFTS_FIELD.type = 11
TREASUREHUNT_GIFTS_FIELD.cpp_type = 10
TREASUREHUNT_RATIOS_FIELD.name = "ratios"
TREASUREHUNT_RATIOS_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.TreasureHunt.ratios"
TREASUREHUNT_RATIOS_FIELD.number = 4
TREASUREHUNT_RATIOS_FIELD.index = 3
TREASUREHUNT_RATIOS_FIELD.label = 3
TREASUREHUNT_RATIOS_FIELD.has_default_value = false
TREASUREHUNT_RATIOS_FIELD.default_value = {}
TREASUREHUNT_RATIOS_FIELD.type = 13
TREASUREHUNT_RATIOS_FIELD.cpp_type = 3
TREASUREHUNT_REFRESHSEC_FIELD.name = "refreshsec"
TREASUREHUNT_REFRESHSEC_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.TreasureHunt.refreshsec"
TREASUREHUNT_REFRESHSEC_FIELD.number = 5
TREASUREHUNT_REFRESHSEC_FIELD.index = 4
TREASUREHUNT_REFRESHSEC_FIELD.label = 1
TREASUREHUNT_REFRESHSEC_FIELD.has_default_value = false
TREASUREHUNT_REFRESHSEC_FIELD.default_value = 0
TREASUREHUNT_REFRESHSEC_FIELD.type = 13
TREASUREHUNT_REFRESHSEC_FIELD.cpp_type = 3
TREASUREHUNT.name = "TreasureHunt"
TREASUREHUNT.full_name = ".com.xinqihd.sns.gameserver.proto.TreasureHunt"
TREASUREHUNT.nested_types = {}
TREASUREHUNT.enum_types = {}
TREASUREHUNT.fields = {TREASUREHUNT_MODE_FIELD, TREASUREHUNT_PRICE_FIELD, TREASUREHUNT_GIFTS_FIELD, TREASUREHUNT_RATIOS_FIELD, TREASUREHUNT_REFRESHSEC_FIELD}
TREASUREHUNT.is_extendable = false
TREASUREHUNT.extensions = {}
BSETREASUREHUNTQUERY_COUNT_FIELD.name = "count"
BSETREASUREHUNTQUERY_COUNT_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.BseTreasureHuntQuery.count"
BSETREASUREHUNTQUERY_COUNT_FIELD.number = 1
BSETREASUREHUNTQUERY_COUNT_FIELD.index = 0
BSETREASUREHUNTQUERY_COUNT_FIELD.label = 1
BSETREASUREHUNTQUERY_COUNT_FIELD.has_default_value = false
BSETREASUREHUNTQUERY_COUNT_FIELD.default_value = 0
BSETREASUREHUNTQUERY_COUNT_FIELD.type = 13
BSETREASUREHUNTQUERY_COUNT_FIELD.cpp_type = 3
BSETREASUREHUNTQUERY_TREASURES_FIELD.name = "treasures"
BSETREASUREHUNTQUERY_TREASURES_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.BseTreasureHuntQuery.treasures"
BSETREASUREHUNTQUERY_TREASURES_FIELD.number = 2
BSETREASUREHUNTQUERY_TREASURES_FIELD.index = 1
BSETREASUREHUNTQUERY_TREASURES_FIELD.label = 3
BSETREASUREHUNTQUERY_TREASURES_FIELD.has_default_value = false
BSETREASUREHUNTQUERY_TREASURES_FIELD.default_value = {}
BSETREASUREHUNTQUERY_TREASURES_FIELD.message_type = TREASUREHUNT
BSETREASUREHUNTQUERY_TREASURES_FIELD.type = 11
BSETREASUREHUNTQUERY_TREASURES_FIELD.cpp_type = 10
BSETREASUREHUNTQUERY.name = "BseTreasureHuntQuery"
BSETREASUREHUNTQUERY.full_name = ".com.xinqihd.sns.gameserver.proto.BseTreasureHuntQuery"
BSETREASUREHUNTQUERY.nested_types = {}
BSETREASUREHUNTQUERY.enum_types = {}
BSETREASUREHUNTQUERY.fields = {BSETREASUREHUNTQUERY_COUNT_FIELD, BSETREASUREHUNTQUERY_TREASURES_FIELD}
BSETREASUREHUNTQUERY.is_extendable = false
BSETREASUREHUNTQUERY.extensions = {}
BseTreasureHuntQuery = protobuf.Message(BSETREASUREHUNTQUERY)
TreasureHunt = protobuf.Message(TREASUREHUNT)
_G.BSETREASUREHUNTQUERY_PB_BSETREASUREHUNTQUERY = BSETREASUREHUNTQUERY
_G.TREASUREHUNT_PB_TREASUREHUNT = TREASUREHUNT
|
local cfg = {}
-- mission display css
cfg.display_css = [[
.div_mission{
position: absolute;
top: 200px;
right: 5px;
color: white;
background-color: rgba(0,0,0,0.75);
padding: 8px;
max-width: 300px;
}
.div_mission .name{
color: rgb(255,226,0);
font-weight: bold;
}
.div_mission .step{
color: rgb(0,255,0);
font-weight: bold;
}
]]
return cfg
|
redis.call('DEL', get_lock_key(key))
redis.call('DEL', key)
|
#!/usr/local/bin/lua
-- test srlua
print("This is",_VERSION,"running a script inside",arg[0])
print("These are the arguments from varargs")
print(...)
print("These are the arguments from arg")
for i=0,#arg do
print(i,arg[i])
end
print("These are the libraries")
for k,v in pairs(_G) do
if type(v)=="table" then io.write(k,',') end
end
io.write('\n')
print("This is",_VERSION,"running a script inside",arg[0])
|
local S = unified_inventory.gettext
local F = unified_inventory.fgettext
minetest.register_privilege("creative", {
description = S("Can use the creative inventory"),
give_to_singleplayer = false,
})
minetest.register_privilege("ui_full", {
description = S("Forces Unified Inventory to be displayed in Full mode if Lite mode is configured globally"),
give_to_singleplayer = false,
})
local trash = minetest.create_detached_inventory("trash", {
--allow_put = function(inv, listname, index, stack, player)
-- if unified_inventory.is_creative(player:get_player_name()) then
-- return stack:get_count()
-- else
-- return 0
-- end
--end,
on_put = function(inv, listname, index, stack, player)
inv:set_stack(listname, index, nil)
local player_name = player:get_player_name()
minetest.sound_play("trash", {to_player=player_name, gain = 1.0})
end,
})
trash:set_size("main", 1)
unified_inventory.register_button("craft", {
type = "image",
image = "ui_craft_icon.png",
tooltip = S("Crafting Grid"),
show_with = false, --Modif MFF (Crabman 30/06/2015)
})
unified_inventory.register_button("craftguide", {
type = "image",
image = "ui_craftguide_icon.png",
tooltip = S("Crafting Guide"),
show_with = false, --Modif MFF (Crabman 30/06/2015)
})
--[[
unified_inventory.register_button("home_gui_set", {
type = "image",
image = "ui_sethome_icon.png",
tooltip = S("Set home position"),
hide_lite=true,
show_with = "interact", --Modif MFF (Crabman 30/06/2015)
action = function(player)
if home.sethome(player:get_player_name()) == true then --modif MFF
minetest.sound_play("dingdong",
{to_player=player:get_player_name(), gain = 1.0})
end
end,
})
unified_inventory.register_button("home_gui_go", {
type = "image",
image = "ui_gohome_icon.png",
tooltip = S("Go home"),
hide_lite=true,
show_with = "interact", --Modif MFF (Crabman 30/06/2015)
action = function(player)
if home.tohome(player:get_player_name()) == true then --modif MFF
minetest.sound_play("teleport",
{to_player=player:get_player_name(), gain = 1.0})
end
end,
})
--]]
if minetest.get_modpath("news") then
unified_inventory.register_button("news", {
type = "image",
image = "ui_news_icon.png",
tooltip = S("News"),
hide_lite = true,
show_with = "interact",
action = function(player)
core.chatcommands["news"].func(player:get_player_name())
end,
})
end
unified_inventory.register_button("home_gui_set", { --new h2omes
type = "image",
image = "ui_gohome_icon.png",
tooltip = S("My Homes"),
hide_lite=true,
show_with = "home", --Modif MFF (Crabman 30/06/2015)
action = function(player)
h2omes.show_formspec_home(player:get_player_name())
end,
})
unified_inventory.register_button("misc_set_day", {
type = "image",
image = "ui_sun_icon.png",
tooltip = S("Set time to day"),
hide_lite=true,
show_with = "settime", --Modif MFF (Crabman 30/06/2015)
action = function(player)
local player_name = player:get_player_name()
if minetest.check_player_privs(player_name, {settime=true}) then
minetest.sound_play("birds",
{to_player=player_name, gain = 1.0})
minetest.set_timeofday((6000 % 24000) / 24000)
minetest.chat_send_player(player_name,
S("Time of day set to 6am"))
else
minetest.chat_send_player(player_name,
S("You don't have the settime privilege!"))
end
end,
})
unified_inventory.register_button("misc_set_night", {
type = "image",
image = "ui_moon_icon.png",
tooltip = S("Set time to night"),
hide_lite=true,
show_with = "settime", --Modif MFF (Crabman 30/06/2015)
action = function(player)
local player_name = player:get_player_name()
if minetest.check_player_privs(player_name, {settime=true}) then
minetest.sound_play("owl",
{to_player=player_name, gain = 1.0})
minetest.set_timeofday((21000 % 24000) / 24000)
minetest.chat_send_player(player_name,
S("Time of day set to 9pm"))
else
minetest.chat_send_player(player_name,
S("You don't have the settime privilege!"))
end
end,
})
unified_inventory.register_button("clear_inv", {
type = "image",
image = "ui_trash_icon.png",
tooltip = S("Clear inventory"),
show_with = "creative", --Modif MFF (Crabman 30/06/2015)
action = function(player)
local player_name = player:get_player_name()
if not unified_inventory.is_creative(player_name) then
minetest.chat_send_player(player_name,
S("This button has been disabled outside"
.." of creative mode to prevent"
.." accidental inventory trashing."
.."\nUse the trash slot instead."))
return
end
player:get_inventory():set_list("main", {})
minetest.chat_send_player(player_name, S('Inventory cleared!'))
minetest.sound_play("trash_all",
{to_player=player_name, gain = 1.0})
end,
})
unified_inventory.register_page("craft", {
get_formspec = function(player, perplayer_formspec)
local formspecy = perplayer_formspec.formspec_y
local formheadery = perplayer_formspec.form_header_y
local player_name = player:get_player_name()
local formspec = "background[2,"..formspecy..";6,3;ui_crafting_form.png]"
formspec = formspec.."background[0,"..(formspecy + 3.5)..";8,4;ui_main_inventory.png]"
formspec = formspec.."label[0,"..formheadery..";" ..F("Crafting").."]"
formspec = formspec.."listcolors[#00000000;#00000000]"
formspec = formspec.."list[current_player;craftpreview;6,"..formspecy..";1,1;]"
formspec = formspec.."list[current_player;craft;2,"..formspecy..";3,3;]"
formspec = formspec.."label[7,"..(formspecy + 1.5)..";" .. F("Trash:") .. "]"
formspec = formspec.."list[detached:trash;main;7,"..(formspecy + 2)..";1,1;]"
formspec = formspec.."listring[current_name;craft]"
formspec = formspec.."listring[current_player;main]"
if unified_inventory.is_creative(player_name) then
formspec = formspec.."label[0,"..(formspecy + 1.5)..";" .. F("Refill:") .. "]"
formspec = formspec.."list[detached:"..minetest.formspec_escape(player_name).."refill;main;0,"..(formspecy +2)..";1,1;]"
end
return {formspec=formspec}
end,
})
-- stack_image_button(): generate a form button displaying a stack of items
--
-- The specified item may be a group. In that case, the group will be
-- represented by some item in the group, along with a flag indicating
-- that it's a group. If the group contains only one item, it will be
-- treated as if that item had been specified directly.
local function stack_image_button(x, y, w, h, buttonname_prefix, item)
local name = item:get_name()
local count = item:get_count()
local show_is_group = false
local displayitem = name.." "..count
local selectitem = name
if name:sub(1, 6) == "group:" then
local group_name = name:sub(7)
local group_item = unified_inventory.get_group_item(group_name)
show_is_group = not group_item.sole
displayitem = group_item.item or "unknown"
selectitem = group_item.sole and displayitem or name
end
local label = show_is_group and "G" or ""
local buttonname = minetest.formspec_escape(buttonname_prefix..unified_inventory.mangle_for_formspec(selectitem))
local button = string.format("item_image_button[%f,%f;%f,%f;%s;%s;%s]",
x, y, w, h,
minetest.formspec_escape(displayitem), buttonname, label)
if show_is_group then
local groupstring, andcount = unified_inventory.extract_groupnames(name)
local grouptip
if andcount == 1 then
grouptip = string.format(S("Any item belonging to the %s group"), groupstring)
elseif andcount > 1 then
grouptip = string.format(S("Any item belonging to the groups %s"), groupstring)
end
grouptip = minetest.formspec_escape(grouptip)
if andcount >= 1 then
button = button .. string.format("tooltip[%s;%s]", buttonname, grouptip)
end
end
return button
end
local recipe_text = {
recipe = "Recipe %d of %d",
usage = "Usage %d of %d",
}
local no_recipe_text = {
recipe = "No recipes",
usage = "No usages",
}
local role_text = {
recipe = "Result",
usage = "Ingredient",
}
local next_alt_text = {
recipe = "Show next recipe",
usage = "Show next usage",
}
local prev_alt_text = {
recipe = "Show previous recipe",
usage = "Show previous usage",
}
local other_dir = {
recipe = "usage",
usage = "recipe",
}
unified_inventory.register_page("craftguide", {
get_formspec = function(player, perplayer_formspec)
local formspecy = perplayer_formspec.formspec_y
local formheadery = perplayer_formspec.form_header_y
local craftresultx = perplayer_formspec.craft_result_x
local craftresulty = perplayer_formspec.craft_result_y
local player_name = player:get_player_name()
local player_privs = minetest.get_player_privs(player_name)
local formspec = ""
formspec = formspec.."background[0,"..(formspecy + 3.5)..";8,4;ui_main_inventory.png]"
formspec = formspec.."label[0,"..formheadery..";" .. F("Crafting Guide") .. "]"
formspec = formspec.."listcolors[#00000000;#00000000]"
local item_name = unified_inventory.current_item[player_name]
if not item_name then return {formspec=formspec} end
local dir = unified_inventory.current_craft_direction[player_name]
local rdir
if dir == "recipe" then rdir = "usage" end
if dir == "usage" then rdir = "recipe" end
local crafts = unified_inventory.crafts_for[dir][item_name]
local alternate = unified_inventory.alternate[player_name]
local alternates, craft
if crafts ~= nil and #crafts > 0 then
alternates = #crafts
craft = crafts[alternate]
end
formspec = formspec.."background[0.5,"..(formspecy + 0.2)..";8,3;ui_craftguide_form.png]"
formspec = formspec.."textarea["..craftresultx..","..craftresulty
..";10,1;;"..minetest.formspec_escape(F(role_text[dir])..": "..item_name)..";]"
formspec = formspec..stack_image_button(0, formspecy, 1.1, 1.1, "item_button_"
.. rdir .. "_", ItemStack(item_name))
if not craft then
formspec = formspec.."label[5.5,"..(formspecy + 2.35)..";"
..minetest.formspec_escape(F(no_recipe_text[dir])).."]"
local no_pos = dir == "recipe" and 4.5 or 6.5
local item_pos = dir == "recipe" and 6.5 or 4.5
formspec = formspec.."image["..no_pos..","..formspecy..";1.1,1.1;ui_no.png]"
formspec = formspec..stack_image_button(item_pos, formspecy, 1.1, 1.1, "item_button_"
..other_dir[dir].."_", ItemStack(item_name))
if player_privs.give == true then
formspec = formspec.."label[0,"..(formspecy + 2.10)..";" .. F("Give me:") .. "]"
.."button[0, "..(formspecy + 2.7)..";0.6,0.5;craftguide_giveme_1;1]"
.."button[0.6,"..(formspecy + 2.7)..";0.7,0.5;craftguide_giveme_10;10]"
.."button[1.3,"..(formspecy + 2.7)..";0.8,0.5;craftguide_giveme_99;99]"
end
return {formspec = formspec}
end
local craft_type = unified_inventory.registered_craft_types[craft.type] or
unified_inventory.craft_type_defaults(craft.type, {})
if craft_type.icon then
formspec = formspec..string.format(" image[%f,%f;%f,%f;%s]",5.7,(formspecy + 0.05),0.5,0.5,craft_type.icon)
end
formspec = formspec.."label[5.5,"..(formspecy + 1)..";" .. minetest.formspec_escape(craft_type.description).."]"
formspec = formspec..stack_image_button(6.5, formspecy, 1.1, 1.1, "item_button_usage_", ItemStack(craft.output))
local display_size = craft_type.dynamic_display_size and craft_type.dynamic_display_size(craft) or { width = craft_type.width, height = craft_type.height }
local craft_width = craft_type.get_shaped_craft_width and craft_type.get_shaped_craft_width(craft) or display_size.width
-- This keeps recipes aligned to the right,
-- so that they're close to the arrow.
local xoffset = 5.5
-- Offset factor for crafting grids with side length > 4
local of = (3/math.max(3, math.max(display_size.width, display_size.height)))
local od = 0
-- Minimum grid size at which size optimazation measures kick in
local mini_craft_size = 6
if display_size.width >= mini_craft_size then
od = math.max(1, display_size.width - 2)
xoffset = xoffset - 0.1
end
-- Size modifier factor
local sf = math.min(1, of * (1.05 + 0.05*od))
-- Button size
local bsize_h = 1.1 * sf
local bsize_w = bsize_h
if display_size.width >= mini_craft_size then
bsize_w = 1.175 * sf
end
if (bsize_h > 0.35 and display_size.width) then
for y = 1, display_size.height do
for x = 1, display_size.width do
local item
if craft and x <= craft_width then
item = craft.items[(y-1) * craft_width + x]
end
-- Flipped x, used to build formspec buttons from right to left
local fx = display_size.width - (x-1)
-- x offset, y offset
local xof = (fx-1) * of + of
local yof = (y-1) * of + 1
if item then
formspec = formspec..stack_image_button(
xoffset - xof, formspecy - 1 + yof, bsize_w, bsize_h,
"item_button_recipe_",
ItemStack(item))
else
-- Fake buttons just to make grid
formspec = formspec.."image_button["
..tostring(xoffset - xof)..","..tostring(formspecy - 1 + yof)
..";"..bsize_w..","..bsize_h..";ui_blank_image.png;;]"
end
end
end
else
-- Error
formspec = formspec.."label["
..tostring(2)..","..tostring(formspecy)
..";"..minetest.formspec_escape(S("This recipe is too\nlarge to be displayed.")).."]"
end
if craft_type.uses_crafting_grid and display_size.width <= 3 then
formspec = formspec.."label[0,"..(formspecy + 0.9)..";" .. F("To craft grid:") .. "]"
.."button[0, "..(formspecy + 1.5)..";0.6,0.5;craftguide_craft_1;1]"
.."button[0.6,"..(formspecy + 1.5)..";0.7,0.5;craftguide_craft_10;10]"
.."button[1.3,"..(formspecy + 1.5)..";0.8,0.5;craftguide_craft_max;" .. F("All") .. "]"
end
if player_privs.give then
formspec = formspec.."label[0,"..(formspecy + 2.1)..";" .. F("Give me:") .. "]"
.."button[0, "..(formspecy + 2.7)..";0.6,0.5;craftguide_giveme_1;1]"
.."button[0.6,"..(formspecy + 2.7)..";0.7,0.5;craftguide_giveme_10;10]"
.."button[1.3,"..(formspecy + 2.7)..";0.8,0.5;craftguide_giveme_99;99]"
end
if alternates and alternates > 1 then
formspec = formspec.."label[5.5,"..(formspecy + 1.6)..";"
..string.format(F(recipe_text[dir]), alternate, alternates).."]"
.."image_button[5.5,"..(formspecy + 2)..";1,1;ui_left_icon.png;alternate_prev;]"
.."image_button[6.5,"..(formspecy + 2)..";1,1;ui_right_icon.png;alternate;]"
.."tooltip[alternate_prev;"..F(prev_alt_text[dir]).."]"
.."tooltip[alternate;"..F(next_alt_text[dir]).."]"
end
return {formspec = formspec}
end,
})
local function craftguide_giveme(player, formname, fields)
local amount
for k, v in pairs(fields) do
amount = k:match("craftguide_giveme_(.*)")
if amount then break end
end
if not amount then return end
amount = tonumber(amount)
if amount == 0 then return end
local player_name = player:get_player_name()
local output = unified_inventory.current_item[player_name]
if (not output) or (output == "") then return end
local player_inv = player:get_inventory()
player_inv:add_item("main", {name = output, count = amount})
end
-- tells if an item can be moved and returns an index if so
local function item_fits(player_inv, craft_item, needed_item)
local need_group = string.sub(needed_item, 1, 6) == "group:"
if need_group then
need_group = string.sub(needed_item, 7)
end
if craft_item
and not craft_item:is_empty() then
local ciname = craft_item:get_name()
-- abort if the item there isn't usable
if ciname ~= needed_item
and not need_group then
return
end
-- abort if no item fits onto it
if craft_item:get_count() >= craft_item:get_definition().stack_max then
return
end
-- use the item there if it's in the right group and a group item is needed
if need_group then
if minetest.get_item_group(ciname, need_group) == 0 then
return
end
needed_item = ciname
need_group = false
end
end
if need_group then
-- search an item of the specific group
for i,item in pairs(player_inv:get_list("main")) do
if not item:is_empty()
and minetest.get_item_group(item:get_name(), need_group) > 0 then
return i
end
end
-- no index found
return
end
-- search an item with a the name needed_item
for i,item in pairs(player_inv:get_list("main")) do
if not item:is_empty()
and item:get_name() == needed_item then
return i
end
end
-- no index found
end
-- modifies the player inventory and returns the changed craft_item if possible
local function move_item(player_inv, craft_item, needed_item)
local stackid = item_fits(player_inv, craft_item, needed_item)
if not stackid then
return
end
local wanted_stack = player_inv:get_stack("main", stackid)
local taken_item = wanted_stack:take_item()
player_inv:set_stack("main", stackid, wanted_stack)
if not craft_item
or craft_item:is_empty() then
return taken_item
end
craft_item:add_item(taken_item)
return craft_item
end
local function craftguide_craft(player, formname, fields)
local amount
for k, v in pairs(fields) do
amount = k:match("craftguide_craft_(.*)")
if amount then break end
end
if not amount then return end
local player_name = player:get_player_name()
local output = unified_inventory.current_item[player_name]
if (not output) or (output == "") then return end
local player_inv = player:get_inventory()
local crafts = unified_inventory.crafts_for[unified_inventory.current_craft_direction[player_name]][output]
if (not crafts) or (#crafts == 0) then return end
local alternate = unified_inventory.alternate[player_name]
local craft = crafts[alternate]
if craft.width > 3 then return end
local needed = craft.items
local craft_list = player_inv:get_list("craft")
local width = craft.width
if width == 0 then
-- Shapeless recipe
width = 3
end
amount = tonumber(amount) or 99
--[[
if amount == "max" then
amount = 99 -- Arbitrary; need better way to do this.
else
amount = tonumber(amount)
end--]]
for iter = 1, amount do
local index = 1
for y = 1, 3 do
for x = 1, width do
local needed_item = needed[index]
if needed_item then
local craft_index = ((y - 1) * 3) + x
local craft_item = craft_list[craft_index]
local newitem = move_item(player_inv, craft_item, needed_item)
if newitem then
craft_list[craft_index] = newitem
end
end
index = index + 1
end
end
end
player_inv:set_list("craft", craft_list)
unified_inventory.set_inventory_formspec(player, "craft")
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
for k, v in pairs(fields) do
if k:match("craftguide_craft_") then
craftguide_craft(player, formname, fields)
return
end
if k:match("craftguide_giveme_") then
craftguide_giveme(player, formname, fields)
return
end
end
end)
|
-- This script extends wrk2 to handle multiple server addresses
-- as well as multiple paths (endpoints) per server
-----------------
-- main() context
-- main() globals
local threads = {}
local counter = 1
function setup(thread)
-- Fill global threads table with thread handles so done()
-- can process per-thread data
table.insert(threads, thread)
thread:set("id",counter)
counter = counter +1
math.randomseed(os.time())
end
-----------------
-- Thread context
function xtract(str, match, default, err_msg)
local ret, count = string.gsub(str, match, "%1", 1)
if count == 0 then
if not default then
print(string.format("Error parsing URL '%s': %s",str,err_msg))
os.exit(1)
end
ret = default
end
return ret
end
function init(args)
-- Thread globals used by done()
called_idxs = ""
urls = ""
-- Thread globals used by request(), response()
addrs = {}
idx = 0
-- table of lists; per entry:
-- proto, host, hostaddr, port, path + params
endpoints={}
-- tablre of prepared HTTP requests for endpoints above
reqs={}
-- parse command line URLs and prepare requests
for i=0, #args, 1 do
-- note that URL parsing does not support user/pass as
-- wrk2 does not support auth
local proto = xtract(args[i],
"^(http[s]?)://.*", nil, "missing or unsupported protocol")
local host = xtract(
args[i], "^http[s]?://([^/:]+)[:/]?.*", nil, "missing host")
if proto == "http" then
def_port=80
else if proto == "https" then
def_port=443
else
print(string.format("Unsupported protocol '%s'",proto))
os.exit(1)
end
end
local port = xtract(args[i], "^http[s]?://[^/:]+:(%d+).*", def_port)
local path = xtract(args[i], "^http[s]?://[^/]+(/.*)","/")
-- get IP addr(s) from hostname, validate by connecting
local addr = nil
for k, v in ipairs(wrk.lookup(host, port)) do
if wrk.connect(v) then
addr = v
break
end
end
if not addr then
print(string.format(
"Error: Unable to connect to %s port %s.", host, port))
os.exit(2)
end
-- store the endpoint
endpoints[i] = {}
endpoints[i][0] = proto
endpoints[i][1] = host
endpoints[i][2] = addr
endpoints[i][3] = port
endpoints[i][4] = path
endpoints[i][5] = string.format(
"GET %s HTTP/1.1\r\nHost:%s:%s\r\n\r\n", path, host, port)
if urls == "" then
urls = args[i]
else
urls = string.format("%s,%s",urls,args[i])
end
end
urls = urls .. ","
-- initialize idx, assign req and addr
idx = math.random(0, #endpoints)
wrk.thread.addr = endpoints[idx][2]
end
function request()
local ret = endpoints[idx][5]
return ret
end
function response(status, headers, body)
-- add current index to string of endpointsi calle
local c = ","
if called_idxs == "" then c="" end
called_idxs = string.format("%s%s%s",called_idxs,c,idx)
-- Pick a new random endpoint for the next request
-- Also, update the thread's remote server addr if endpoint
-- is on a different server.
local prev_srv = endpoints[idx][2]
idx = math.random(0, #endpoints)
if prev_srv ~= endpoints[idx][2] then
-- Re-setting the thread's server address forces a reconnect
wrk.thread.addr = endpoints[idx][2]
end
end
-----------------
-- main() context
function done(summary, latency, requests)
print(string.format("Total Requests: %d", summary.requests))
print(string.format("HTTP errors: %d", summary.errors.status))
print(string.format("Requests timed out: %d", summary.errors.timeout))
print(string.format("Bytes received: %d", summary.bytes))
print(string.format("Socket connect errors: %d", summary.errors.connect))
print(string.format("Socket read errors: %d", summary.errors.read))
print(string.format("Socket write errors: %d", summary.errors.write))
-- generate table of URL strings from first thread's endpoints table
-- (all threads generate the same table in init())
local urls = {}
local counts = {}
local i = 0
t = unpack(threads,1,2)
t:get("urls"):gsub("([^,]+),",
function(u)
urls[i]=u
counts[i] = 0
i = i+1
end)
-- fetch url call counts of individual threads
local c = t:get("called_idxs")
c = c .. ","
for i, t in ipairs(threads) do
c:gsub("([0-9]+),", function(s)
i = tonumber(s)
counts[i] = counts[i] + 1
end)
end
print("\nURL call count")
for i=0, #urls, 1 do
print(string.format("%s : %d", urls[i], counts[i]))
end
end
|
object_tangible_tcg_series7_garage_display_vehicles_pod_racer_light_bending = object_tangible_tcg_series7_garage_display_vehicles_shared_pod_racer_light_bending:new {
}
ObjectTemplates:addTemplate(object_tangible_tcg_series7_garage_display_vehicles_pod_racer_light_bending, "object/tangible/tcg/series7/garage_display_vehicles/pod_racer_light_bending.iff")
|
#!/usr/bin/env lua
local exec = require "tek.lib.exec"
local c = exec.run({
func = function()
for i = 1, 10000000 do end
error "error in child"
end
})
for i = 1, 20000000 do end
print "parent done"
--[[
luatask: bin/task/test41.lua:6: error in child
stack traceback:
[C]: in function 'error'
bin/task/test41.lua:6: in function <bin/task/test41.lua:4>
[C]: ?
lua: received abort signal
stack traceback:
bin/task/test41.lua:9: in main chunk
[C]: ?
]]--
|
local discoScienceInit = function()
if remote.interfaces["DiscoScience"] and remote.interfaces["DiscoScience"]["setIngredientColor"] then
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-1", {r = 214, g = 87, b = 39})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-2", {r = 217, g = 149, b = 8})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-3", {r = 205, g = 174, b = 20})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-4", {r = 193, g = 190, b = 9})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-5", {r = 136, g = 194, b = 44})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-6", {r = 154, g = 116, b = 137})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-7", {r = 131, g = 91, b = 160})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-8", {r = 255, g = 89, b = 160})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-9", {r = 255, g = 209, b = 2})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-10", {r = 68, g = 26, b = 255})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-11", {r = 121, g = 167, b = 255})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-12", {r = 113, g = 82, b = 240})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-13", {r = 134, g = 133, b = 255})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-14", {r = 142, g = 140, b = 139})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-15", {r = 59, g = 59, b = 59})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-16", {r = 169, g = 13, b = 184})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-17", {r = 245, g = 47, b = 182})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-18", {r = 109, g = 129, b = 166})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-19", {r = 72, g = 171, b = 147})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-20", {r = 72, g = 116, b = 193})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-21", {r = 0, g = 8, b = 81})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-22", {r = 168, g = 144, b = 111})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-23", {r = 41, g = 211, b = 255})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-24", {r = 77, g = 47, b = 5})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-25", {r = 178, g = 178, b = 178})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-26", {r = 243, g = 8, b = 8})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-27", {r = 248, g = 215, b = 61})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-28", {r = 158, g = 248, b = 34})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-29", {r = 30, g = 195, b = 248})
remote.call("DiscoScience", "setIngredientColor", "more-science-pack-30", {r = 0, g = 0, b = 0})
end
end
script.on_init(
function ()
discoScienceInit()
end
)
script.on_configuration_changed(
function ()
discoScienceInit()
end
)
|
--[[
This file contains the necessary classes for generating the SDK
DO NOT MODIFY
]]
local ffi = require("ffi")
ffi.cdef[[
struct UObject_Data {
const struct FPointer VfTableObject;
const struct UObject* HashNext;
struct FQWord ObjectFlags;
const struct UObject* HashOuterNext;
const struct FPointer StateFrame;
const struct UObject* Linker;
const struct FPointer LinkerIndex;
const int Index;
const int NetIndex;
const struct UObject* Outer;
const struct FName Name;
const struct UClass* Class;
const struct UObject* ObjectArchetype;
};
struct UObject {
struct UObject_Data UObject;
};
struct UField_Data {
struct UField* Next;
};
struct UField {
struct UObject_Data UObject;
struct UField_Data UField;
};
struct TArray_FName {
struct FName* Data;
int Count;
int Max;
};
struct UEnum_Data {
struct TArray_FName Names;
};
struct UEnum {
struct UObject_Data UObject;
struct UField_Data UField;
struct UEnum_Data UEnum;
};
struct UConst_Data {
struct FString Value;
};
struct UConst {
struct UObject_Data UObject;
struct UField_Data UField;
struct UConst_Data UConst;
};
struct TArray_char {
char* Data;
int Count;
int Max;
};
struct UStruct_Data {
unsigned char Unknown1[0x8];
struct UField* SuperField;
struct UField* Children;
unsigned short PropertySize;
unsigned char Unknown2;
unsigned char MinAlignment;
struct TArray_char Script;
unsigned char Unknown3[0x2C];
};
struct UStruct {
struct UObject_Data UObject;
struct UField_Data UField;
struct UStruct_Data UStruct;
};
struct UScriptStruct_Data {
unsigned char Unknown[0x1C];
};
struct UScriptStruct {
struct UObject_Data UObject;
struct UField_Data UField;
struct UStruct_Data UStruct;
struct UScriptStruct_Data UScriptStruct;
};
struct UFunction_Data {
unsigned long FunctionFlags;
unsigned short iNative;
unsigned short RepOffset;
struct FName FriendlyName;
unsigned short NumParms;
unsigned short ParmsSize;
unsigned long ReturnValueOffset;
unsigned char Unknown[0x4];
void* Func;
};
struct UFunction {
struct UObject_Data UObject;
struct UField_Data UField;
struct UStruct_Data UStruct;
struct UFunction_Data UFunction;
};
struct UState_Data {
unsigned char Unknown[0x44];
};
struct UState {
struct UObject_Data UObject;
struct UField_Data UField;
struct UStruct_Data UStruct;
struct UState_Data UState;
};
struct UClass_Data {
unsigned char Unknown[0x100];
};
struct UClass {
struct UObject_Data UObject;
struct UField_Data UField;
struct UStruct_Data UStruct;
struct UState_Data UState;
struct UClass_Data UClass;
};
struct UProperty_Data {
unsigned long ArrayDim;
unsigned long ElementSize;
struct FQWord PropertyFlags;
unsigned short PropertySize;
unsigned short Unknown1;
unsigned char Unknown2[0xC];
unsigned long Offset;
unsigned char Unknown3[0x1C];
};
struct UProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
};
struct UByteProperty_Data {
struct UEnum* Enum;
};
struct UByteProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UByteProperty_Data UByteProperty;
};
struct UIntProperty_Data {
};
struct UIntProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UIntProperty_Data UIntProperty;
};
struct UFloatProperty_Data {
};
struct UFloatProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UFloatProperty_Data UFloatProperty;
};
struct UBoolProperty_Data {
unsigned long BitMask;
};
struct UBoolProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UBoolProperty_Data UBoolProperty;
};
struct UStrProperty_Data {
};
struct UStrProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UStrProperty_Data UStrProperty;
};
struct UNameProperty_Data {
};
struct UNameProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UNameProperty_Data UNameProperty;
};
struct UDelegateProperty_Data {
unsigned char Unknown[0x8];
};
struct UDelegateProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UDelegateProperty_Data UDelegateProperty;
};
struct UObjectProperty_Data {
struct UClass* PropertyClass;
};
struct UObjectProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UObjectProperty_Data UObjectProperty;
};
struct UComponentProperty_Data {
};
struct UComponentProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UObjectProperty_Data UObjectProperty;
struct UComponentProperty_Data UComponentProperty;
};
struct UClassProperty_Data {
struct UClass* MetaClass;
};
struct UClassProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UObjectProperty_Data UObjectProperty;
struct UClassProperty_Data UClassProperty;
};
struct UInterfaceProperty_Data {
struct UClass* InterfaceClass;
};
struct UInterfaceProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UInterfaceProperty_Data UInterfaceProperty;
};
struct UStructProperty_Data {
struct UStruct* Struct;
};
struct UStructProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UStructProperty_Data UStructProperty;
};
struct UArrayProperty_Data {
struct UProperty* Inner;
};
struct UArrayProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UArrayProperty_Data UArrayProperty;
};
struct UMapProperty_Data {
struct UProperty* Key;
struct UProperty* Value;
};
struct UMapProperty {
struct UObject_Data UObject;
struct UField_Data UField;
struct UProperty_Data UProperty;
struct UMapProperty_Data UMapProperty;
};
]]
-- Class Name - Engine Name - Base Class
table.insert(g_loadedClasses, { "UObject", "Class Core.Object", nil })
table.insert(g_loadedClasses, { "UField", "Class Core.Field", "UObject" })
table.insert(g_loadedClasses, { "UEnum", "Class Core.Enum", "UField" })
table.insert(g_loadedClasses, { "UConst", "Class Core.Const", "UField" })
table.insert(g_loadedClasses, { "UStruct", "Class Core.Struct", "UField" })
table.insert(g_loadedClasses, { "UScriptStruct", "Class Core.ScriptStruct", "UStruct" })
table.insert(g_loadedClasses, { "UFunction", "Class Core.Function", "UStruct" })
table.insert(g_loadedClasses, { "UState", "Class Core.State", "UStruct" })
table.insert(g_loadedClasses, { "UClass", "Class Core.Class", "UState" })
table.insert(g_loadedClasses, { "UProperty", "Class Core.Property", "UField" })
table.insert(g_loadedClasses, { "UByteProperty", "Class Core.ByteProperty", "UProperty" })
table.insert(g_loadedClasses, { "UIntProperty", "Class Core.IntProperty", "UProperty" })
table.insert(g_loadedClasses, { "UFloatProperty", "Class Core.FloatProperty", "UProperty" })
table.insert(g_loadedClasses, { "UBoolProperty", "Class Core.BoolProperty", "UProperty" })
table.insert(g_loadedClasses, { "UStrProperty", "Class Core.StrProperty", "UProperty" })
table.insert(g_loadedClasses, { "UNameProperty", "Class Core.NameProperty", "UProperty" })
table.insert(g_loadedClasses, { "UDelegateProperty", "Class Core.DelegateProperty", "UProperty" })
table.insert(g_loadedClasses, { "UObjectProperty", "Class Core.ObjectProperty", "UProperty" })
table.insert(g_loadedClasses, { "UComponentProperty", "Class Core.ComponentProperty", "UObjectProperty" })
table.insert(g_loadedClasses, { "UClassProperty", "Class Core.ClassProperty", "UObjectProperty" })
table.insert(g_loadedClasses, { "UInterfaceProperty", "Class Core.InterfaceProperty", "UProperty" })
table.insert(g_loadedClasses, { "UStructProperty", "Class Core.StructProperty", "UProperty" })
table.insert(g_loadedClasses, { "UArrayProperty", "Class Core.ArrayProperty", "UProperty" })
table.insert(g_loadedClasses, { "UMapProperty", "Class Core.MapProperty", "UProperty" })
|
---
--- Generated by MLN Team (http://www.immomo.com)
--- Created by MLN Team.
--- DateTime: 2019-09-05 12:05
---
local _class = {
_classname = 'HTTPHandler',
_version = '1.0',
http = Http()
}
---@public
function _class:GET(url, param, complete)
param = param or {}
param["cachePolicy"] = CachePolicy.CACHE_THEN_API
param["encType"] = EncType.NORMAL
self.http:get(url, param, function(success, response, error)
complete(success, response, error)
end)
end
---@public
function _class:POST(url, param, complete)
param = param or {}
param["cachePolicy"] = CachePolicy.CACHE_THEN_API
param["encType"] = EncType.NORMAL
self.http:post(url, param, function(success, response, error)
complete(success, response, error)
end)
end
return _class
|
--- author:fritz_98 current maintainer:fritz_98 v1.0
-- gibt einen iterator zurück, der über ein table der form {anzahl, id1, id2...} iteriert.
-- nutzt upvalues intern, iterator func nicht speichern
EntityList = function (_Table)
local Index = 1
local Count = _Table[1] + 1
return function()
Index = Index + 1
if Index <= Count then
return _Table[Index]
end
end
end
|
ENT.Type = 'anim'
ENT.Base = 'bw_machine_base'
ENT.PrintName = 'Diesel Generator'
ENT.Author = 'n00bmobile'
ENT.Category = 'n00bmobile'
ENT.Spawnable = true
ENT.AdminSpawnable = true
--[Customizable Values]--
ENT.MaxPower = 700
ENT.MaxFuel = 300
-------------------------
ENT.UsesPower = false
function ENT:SetupDataTables()
self:NetworkVar('Bool', 0, 'TurnedOn')
self:NetworkVar('Int', 0, 'PowerStored')
self:NetworkVar('Int', 1, 'FuelStored')
if SERVER then
self:SetFuelStored(self.MaxFuel)
end
end
if CLIENT then
ENT.StatusBars = {
[1] = {
name = 'HEALTH',
color = Color(255, 0, 0),
getWidth = function(ent)
return 186 *(ent:Health() /ent:GetMaxHealth())
end
},
[2] = {
name = 'DIESEL',
color = Color(230, 180, 32),
getWidth = function(ent)
return 186 *(ent:GetFuelStored() /ent.MaxFuel)
end
}
}
end
|
local std = require "atf.stdlib.std"
local table = require "atf.stdlib.std.table"
local exit_codes = require('exit_codes')
local validOptList = { }
local errors = {}
local usage = [[
ATF 2.2
Usage: ./start.sh [OPTIONS] script.lua
]]
local help = {}
local fotter = [[
-v,--version display version information, then exit
-h,--help display this help, then exit
]]
local version = "ATF 2.2"
local optparser = std.optparse [[
ATF 2.2
Additional lines of text to show when the --version
option is passed.
Several lines or paragraphs are permitted.
Usage: atf cmd_test.lua [OPTIONS] script.lua
]]
local module = {
mt = { __index = { } } ,
RequiredArgument = 1,
OptionalArgument = 2,
NoArgument = 3
}
local function errmsg (msg)
local prog = "ATF 2.2"
-- Ensure final period.
if msg:match ("%.$") == nil then msg = msg .. "." end
print (prog .. ": error: " .. msg .. "\n")
print (prog .. ": Try '" .. prog .. " --help' for help.")
quit(exit_codes.wrong_arg)
end
local function checkReqOpt(self, arg, val)
if val:sub (1, 1) == "-" then
errmsg ("Option '" .. arg .. "' requires an argument.")
quit(exit_codes.wrong_arg)
else
validOptList[self[arg].key] = val
end
end
function module.getopt(argv, opts)
local res = {}
if (argv[1] == nil) then module.PrintUsage() end
optparser:on ({"--"}, optparser.finished)
optparser:on ({"-?"}, optparser.optional,module.PrintUsage)
optparser:on ({"-h","--help"}, optparser.optional,module.PrintUsage)
optparser:on ({"-v","--version"}, optparser.optional,module.PrintVersion)
local function parse(argv)
return optparser:parse (argv)
end
local unrecognized_options,options = parse(argv)
res = table.merge(validOptList, options)
for i = 1 , #unrecognized_options do
if (unrecognized_options[i]:sub(1,1)~= "-") then
table.insert(res,unrecognized_options[i])
else
errmsg("undefined option: '" .. unrecognized_options[i] .. "'")
return nil
end
end
setmetatable(res, module.mt)
return res
end
function module.declare_opt (shortname, longname, argument, description)
local arg = ''
if (argument == module.RequiredArgument) then
optparser:on (table.pack(shortname, longname), optparser.required,checkReqOpt)
elseif (argument == module.OptionalArgument) then
optparser:on (table.pack(shortname, longname), optparser.optional)
else
optparser:on (table.pack(shortname, longname), optparser.flag)
end
arg = string.format(" %s", description or 'value')
if (shortname:len() > 0 and longname:len() > 0) then
table.insert(help, shortname .. ',' .. longname .. arg )
else
table.insert(help, shortname .. longname .. arg )
end
end
function module.declare_short_opt(shortname, argument, description)
module.declare_opt (shortname, '' , argument, description)
end
function module.declare_long_opt(longname, argument, description)
module.declare_opt('' ,longname , argument, description)
end
function module.PrintUsage()
local _usage = usage
for _, opt in ipairs(help) do
_usage = _usage .. opt .. '\n' .. ' '
end
_usage = _usage .. '\n' ..' ' .. fotter
print(_usage)
quit()
end
function module.PrintVersion()
print(version)
quit()
end
return module
|
hook.Add("InitPostEntityMap", "profile", function()
for _, ent in pairs(ents.FindByClass("trigger_teleport")) do
ent:Remove()
end
for _, ent in pairs(ents.FindByClass("trigger_push")) do
ent:Remove()
end
end)
|
-- test script for Pinfo and Address functions
-- use with dhcp.pcap in test/captures directory
local major, minor, micro = get_version():match("(%d+)%.(%d+)%.(%d+)")
if major then
major = tonumber(major)
minor = tonumber(minor)
micro = tonumber(micro)
else
major = 99
minor = 99
micro = 99
end
------------- general test helper funcs ------------
local FRAME = "frame"
local OTHER = "other"
local packet_counts = {}
local function incPktCount(name)
if not packet_counts[name] then
packet_counts[name] = 1
else
packet_counts[name] = packet_counts[name] + 1
end
end
local function getPktCount(name)
return packet_counts[name] or 0
end
local passed = {}
local function setPassed(name)
if not passed[name] then
passed[name] = 1
else
passed[name] = passed[name] + 1
end
end
-- expected number of runs per type
-- note ip only runs 3 times because it gets removed
-- and dhcp only runs twice because the filter makes it run
-- once and then it gets replaced with a different one for the second time
local taptests = { [FRAME]=4, [OTHER]=0 }
local function getResults()
print("\n-----------------------------\n")
for k,v in pairs(taptests) do
if v ~= 0 and passed[k] ~= v then
print("Something didn't run or ran too much... tests failed!")
print("Listener type "..k.." expected: "..v..", but got: "..tostring(passed[k]))
return false
end
end
print("All tests passed!\n\n")
return true
end
local function testing(type,...)
print("---- Testing "..type.." ---- "..tostring(...).." for packet # "..getPktCount(type).." ----")
end
local function test(type,name, ...)
io.stdout:write("test "..type.."-->"..name.."-"..getPktCount(type).."...")
if (...) == true then
io.stdout:write("passed\n")
return true
else
io.stdout:write("failed!\n")
error(name.." test failed!")
end
end
---------
-- the following are so we can use pcall (which needs a function to call)
local function setPinfo(pinfo,name,value)
pinfo[name] = value
end
local function getPinfo(pinfo,name)
local foo = pinfo[name]
end
------------- test script ------------
----------------------------------
-- modify original test function, kinda sorta
local orig_test = test
test = function (...)
return orig_test(FRAME,...)
end
local tap = Listener.new()
function tap.packet(pinfo,tvb)
incPktCount(FRAME)
testing(FRAME,"Pinfo in Frame")
test("typeof-1", typeof(pinfo) == "Pinfo")
test("tostring-1", tostring(pinfo) == "a Pinfo")
testing(FRAME,"negative tests")
-- try to set read-only attributes
--[[
these tests *should* ALL pass, but currently pinfo read-only members
silently accept being set (though nothing happens) Blech!!
test("Pinfo.number-set-1",not pcall(setPinfo,pinfo,"number",0))
test("Pinfo.len-set-1",not pcall(setPinfo,pinfo,"len",0))
test("Pinfo.caplen-set-1",not pcall(setPinfo,pinfo,"caplen",0))
test("Pinfo.rel_ts-set-1",not pcall(setPinfo,pinfo,"rel_ts",0))
test("Pinfo.delta_ts-set-1",not pcall(setPinfo,pinfo,"delta_ts",0))
test("Pinfo.delta_dis_ts-set-1",not pcall(setPinfo,pinfo,"delta_dis_ts",0))
test("Pinfo.visited-set-1",not pcall(setPinfo,pinfo,"visited",0))
test("Pinfo.lo-set-1",not pcall(setPinfo,pinfo,"lo",0))
test("Pinfo.hi-set-1",not pcall(setPinfo,pinfo,"hi",0))
test("Pinfo.port_type-set-1",not pcall(setPinfo,pinfo,"port_type",0))
test("Pinfo.match-set-1",not pcall(setPinfo,pinfo,"match",0))
test("Pinfo.curr_proto-set-1",not pcall(setPinfo,pinfo,"curr_proto",0))
test("Pinfo.columns-set-1",not pcall(setPinfo,pinfo,"columns",0))
test("Pinfo.cols-set-1",not pcall(setPinfo,pinfo,"cols",0))
test("Pinfo.private-set-1",not pcall(setPinfo,pinfo,"private",0))
test("Pinfo.fragmented-set-1",not pcall(setPinfo,pinfo,"fragmented",0))
test("Pinfo.in_error_pkt-set-1",not pcall(setPinfo,pinfo,"in_error_pkt",0))
test("Pinfo.match_uint-set-1",not pcall(setPinfo,pinfo,"match_uint",0))
test("Pinfo.match_string-set-1",not pcall(setPinfo,pinfo,"match_string",0))
]]
-- wrong type being set
test("Pinfo.src-set-1",not pcall(setPinfo,pinfo,"src","foobar"))
test("Pinfo.dst-set-1",not pcall(setPinfo,pinfo,"dst","foobar"))
test("Pinfo.dl_src-set-1",not pcall(setPinfo,pinfo,"dl_src","foobar"))
test("Pinfo.dl_dst-set-1",not pcall(setPinfo,pinfo,"dl_dst","foobar"))
test("Pinfo.net_src-set-1",not pcall(setPinfo,pinfo,"net_src","foobar"))
test("Pinfo.net_dst-set-1",not pcall(setPinfo,pinfo,"net_dst","foobar"))
test("Pinfo.src_port-set-1",not pcall(setPinfo,pinfo,"src_port","foobar"))
test("Pinfo.dst_port-set-1",not pcall(setPinfo,pinfo,"dst_port","foobar"))
if major > 1 or minor > 10 then
test("Pinfo.can_desegment-set-1",not pcall(setPinfo,pinfo,"can_desegment","foobar"))
end
test("Pinfo.desegment_len-set-1",not pcall(setPinfo,pinfo,"desegment_len","foobar"))
test("Pinfo.desegment_offset-set-1",not pcall(setPinfo,pinfo,"desegment_offset","foobar"))
-- invalid attribute names
--[[
again, these *should* pass, but Pinfo silently allows it!
test("Pinfo.set-1",not pcall(setPinfo,pinfo,"foobar","foobar"))
test("Pinfo.get-12",not pcall(getPinfo,pinfo,"foobar"))
]]
testing(FRAME,"basic getter tests")
local pktlen, srcip, dstip, srcport, dstport
if pinfo.number == 1 or pinfo.number == 3 then
pktlen = 314
srcip = "0.0.0.0"
dstip = "255.255.255.255"
srcport = 68
dstport = 67
else
pktlen = 342
srcip = "192.168.0.1"
dstip = "192.168.0.10"
srcport = 67
dstport = 68
end
test("Pinfo.number-get-1",pinfo.number == getPktCount(FRAME))
test("Pinfo.len-get-1",pinfo.len == pktlen)
test("Pinfo.caplen-get-1",pinfo.caplen == pktlen)
test("Pinfo.visited-get-1",pinfo.visited == true)
test("Pinfo.lo-get-1",tostring(pinfo.lo) == srcip)
test("Pinfo.lo-get-2",typeof(pinfo.lo) == "Address")
test("Pinfo.hi-get-1",tostring(pinfo.hi) == dstip)
test("Pinfo.hi-get-2",typeof(pinfo.hi) == "Address")
test("Pinfo.port_type-get-1",pinfo.port_type == 3)
test("Pinfo.match-get-1",pinfo.match == 0)
test("Pinfo.curr_proto-get-1",tostring(pinfo.curr_proto) == "<Missing Protocol Name>")
test("Pinfo.columns-get-1",tostring(pinfo.columns) == "Columns")
test("Pinfo.columns-get-2",typeof(pinfo.columns) == "Columns")
test("Pinfo.cols-get-1",tostring(pinfo.cols) == "Columns")
test("Pinfo.cols-get-2",typeof(pinfo.cols) == "Columns")
test("Pinfo.private-get-1",type(pinfo.private) == "userdata")
test("Pinfo.fragmented-get-1",pinfo.fragmented == false)
test("Pinfo.in_error_pkt-get-1",pinfo.in_error_pkt == false)
test("Pinfo.match_uint-get-1",pinfo.match_uint == 0)
test("Pinfo.match_string-get-1",pinfo.match_string == nil)
test("Pinfo.src-get-1",tostring(pinfo.src) == srcip)
test("Pinfo.src-get-2",typeof(pinfo.src) == "Address")
test("Pinfo.dst-get-1",tostring(pinfo.dst) == dstip)
test("Pinfo.dst-get-2",typeof(pinfo.dst) == "Address")
test("Pinfo.dl_src-get-1",typeof(pinfo.dl_src) == "Address")
test("Pinfo.dl_dst-get-1",typeof(pinfo.dl_dst) == "Address")
test("Pinfo.net_src-get-1",tostring(pinfo.net_src) == srcip)
test("Pinfo.net_src-get-2",typeof(pinfo.net_src) == "Address")
test("Pinfo.net_dst-get-1",tostring(pinfo.net_dst) == dstip)
test("Pinfo.net_dst-get-2",typeof(pinfo.net_dst) == "Address")
test("Pinfo.src_port-get-1",pinfo.src_port == srcport)
test("Pinfo.dst_port-get-1",pinfo.dst_port == dstport)
if major > 1 or minor > 10 then
test("Pinfo.can_desegment-get-1",pinfo.can_desegment == 0)
end
test("Pinfo.desegment_len-get-1",pinfo.desegment_len == 0)
test("Pinfo.desegment_offset-get-1",pinfo.desegment_offset == 0)
if pinfo.number == 1 then
test("Pinfo.rel_ts-get-1",pinfo.rel_ts == 0)
test("Pinfo.delta_ts-get-1",pinfo.delta_ts == 0)
test("Pinfo.delta_dis_ts-get-1",pinfo.delta_dis_ts == 0)
elseif pinfo.number == 2 then
test("Pinfo.rel_ts-get-1",pinfo.rel_ts == 0.000295)
test("Pinfo.delta_ts-get-1",pinfo.delta_ts == 0.000295)
test("Pinfo.delta_dis_ts-get-1",pinfo.delta_dis_ts == 0.000295)
elseif pinfo.number == 3 then
test("Pinfo.rel_ts-get-1",pinfo.rel_ts == 0.070031)
test("Pinfo.delta_ts-get-1",pinfo.delta_ts == 0.069736)
test("Pinfo.delta_dis_ts-get-1",pinfo.delta_dis_ts == 0.069736)
elseif pinfo.number == 4 then
test("Pinfo.rel_ts-get-1",pinfo.rel_ts == 0.070345)
test("Pinfo.delta_ts-get-1",pinfo.delta_ts == 0.000314)
test("Pinfo.delta_dis_ts-get-1",pinfo.delta_dis_ts == 0.000314)
end
testing(FRAME,"basic setter tests")
local tmp = pinfo.src
pinfo.src = pinfo.dst
pinfo.dst = tmp
test("Pinfo.src-set-1",tostring(pinfo.src) == dstip)
test("Pinfo.src-set-1",typeof(pinfo.src) == "Address")
test("Pinfo.dst-set-1",tostring(pinfo.dst) == srcip)
test("Pinfo.dst-set-1",typeof(pinfo.dst) == "Address")
local dl_dst_val = tostring(pinfo.dl_dst)
local dl_src_val = tostring(pinfo.dl_src)
tmp = pinfo.dl_src
pinfo.dl_src = pinfo.dl_dst
pinfo.dl_dst = tmp
test("Pinfo.dl_src-set-1",tostring(pinfo.dl_src) == dl_dst_val)
test("Pinfo.dl_dst-set-1",tostring(pinfo.dl_dst) == dl_src_val)
tmp = pinfo.net_src
pinfo.net_src = pinfo.net_dst
pinfo.net_dst = tmp
test("Pinfo.net_src-set-1",tostring(pinfo.net_src) == dstip)
test("Pinfo.net_src-set-1",typeof(pinfo.net_src) == "Address")
test("Pinfo.net_dst-set-1",tostring(pinfo.net_dst) == srcip)
test("Pinfo.net_dst-set-1",typeof(pinfo.net_dst) == "Address")
--[[
--there's a bug 9792 causing the pinfo.dst_port setter to actually set src_port
tmp = pinfo.src_port
pinfo.src_port = pinfo.dst_port
pinfo.dst_port = tmp
test("Pinfo.src_port-set-1",pinfo.src_port == dstport)
test("Pinfo.dst_port-set-1",pinfo.dst_port == srcport)
--]]
pinfo.src_port = pinfo.dst_port
test("Pinfo.src_port-set-1",pinfo.src_port == dstport)
if major > 1 or minor > 10 then
pinfo.can_desegment = 12
test("Pinfo.can_desegment-set-1",pinfo.can_desegment == 12)
end
pinfo.desegment_len = 34
test("Pinfo.desegment_len-set-1",pinfo.desegment_len == 34)
pinfo.desegment_offset = 45
test("Pinfo.desegment_offset-set-1",pinfo.desegment_offset == 45)
testing(FRAME,"Address functions")
test("Address-eq-1", pinfo.lo == pinfo.dst)
test("Address-eq-2", pinfo.lo ~= pinfo.hi)
test("Address-lt-1", pinfo.lo < pinfo.hi)
test("Address-lt-2", pinfo.hi > pinfo.lo)
test("Address-le-1", pinfo.lo <= pinfo.hi)
test("Address-le-2", pinfo.lo <= pinfo.dst)
setPassed(FRAME)
end
function tap.draw()
getResults()
end
|
--[[
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
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
$Id$
]]--
module "luci.controller.custom_splash"
function index()
entry({"admin", "freifunk", "custom_splash"}, cbi("custom_splash"), "Custom Splash", 80)
end
|
local DB = require("dashboard.model.db")
return function(config)
local node_model = {}
local mysql_config = config.store_mysql
local db = DB:new(mysql_config)
function node_model:get_api_stats_data(period,api,domain)
local now = ngx.now()
now = now-period*60
local date_now = os.date('*t', now)
local min = date_now.min
local start_time = string.format('%d-%d-%d %d:%d:00',date_now.year, date_now.month, date_now.day, date_now.hour, min)
local sql="SELECT stat_time,domain,api,SUM(request_2xx) AS 2xx,SUM(request_3xx) AS 3xx,SUM(request_4xx) AS 4xx,SUM(request_5xx) AS 5xx,SUM(total_request_count) AS total,AVG(avg_traffic_read) AS avg_read,AVG(avg_traffic_write) AS avg_write,AVG(avg_request_time) AS avg_time FROM api_persist_log WHERE stat_time >= ? AND api=? AND domain=? GROUP BY stat_time,api,domain"
return db:query(sql, {start_time,api,domain})
end
function node_model:get_stats_data_by_ip(period,api,domain,ip)
local now = ngx.now()
now = now-period*60
local date_now = os.date('*t', now)
local min = date_now.min
local start_time = string.format('%d-%d-%d %d:%d:00',date_now.year, date_now.month, date_now.day, date_now.hour, min)
local sql="SELECT stat_time,domain,api,SUM(request_2xx) AS 2xx,SUM(request_3xx) AS 3xx,SUM(request_4xx) AS 4xx,SUM(request_5xx) AS 5xx,SUM(total_request_count) AS total,AVG(avg_traffic_read) AS avg_read,AVG(avg_traffic_write) AS avg_write,AVG(avg_request_time) AS avg_time FROM api_persist_log WHERE stat_time >= ? AND api=? AND domain=? and ip=?d GROUP BY stat_time,api,domain"
return db:query(sql, {start_time,api,domain,ip})
end
function node_model:get_api_stats(period)
local now = ngx.now()
now = now-period*60
local date_now = os.date('*t', now)
local min = date_now.min
local start_time = string.format('%d-%d-%d %d:%d:00',date_now.year, date_now.month, date_now.day, date_now.hour, min)
local sql="SELECT domain,api,SUM(request_2xx) AS 2xx,SUM(request_3xx) AS 3xx,SUM(request_4xx) AS 4xx,SUM(request_5xx) AS 5xx,SUM(total_request_count) AS total,AVG(avg_traffic_read) AS avg_read,AVG(avg_traffic_write) AS avg_write,AVG(avg_request_time) AS avg_time FROM api_persist_log WHERE stat_time>= ? GROUP BY api,domain order by total desc"
return db:query(sql, {start_time})
end
function node_model:get_api_stats_by_ip(period,ip)
local now = ngx.now()
now = now-period*60
local date_now = os.date('*t', now)
local min = date_now.min
local start_time = string.format('%d-%d-%d %d:%d:00',date_now.year, date_now.month, date_now.day, date_now.hour, min)
local sql="SELECT domain,api,SUM(request_2xx) AS 2xx,SUM(request_3xx) AS 3xx,SUM(request_4xx) AS 4xx,SUM(request_5xx) AS 5xx,SUM(total_request_count) AS total,AVG(avg_traffic_read) AS avg_read,AVG(avg_traffic_write) AS avg_write,AVG(avg_request_time) AS avg_time FROM api_persist_log WHERE stat_time>= ? and ip = ? GROUP BY api,domain order by total desc"
return db:query(sql, {start_time,ip})
end
return node_model
end
|
local obj_bking = {}
function obj_bking.init()
obj_bking.data = {}
obj_bking.name = "obj_bking"
editor.importObject("FACES", obj_bking.name, "obj_bking.new", mdl_bking)
end
function obj_bking.new(x, y)
local tbl = {}
tbl.x = x
tbl.y = y
table.insert(obj_bking.data, tbl)
end
function obj_bking.draw()
local i = 1
while i <= #obj_bking.data do
local this_ent = obj_bking.data[i]
lg.push()
lg.translate(this_ent.x, this_ent.y)
polygon.draw(mdl_bking)
lg.pop()
i = i + 1
end
end
return obj_bking
|
--[[
This comparator attempts to choose edge sectors
to move around a system
Note: this is comparable to the rookMove file, except
it's trying to find paths based on locus definitions and
not by expert determinative systems.
Note to self: this algorithm could be sped up if all open ranks/files were located at start and cached.
]]
local function Check2Jump (n1, n2, s2)
-- Check for row/col jump point for 2 jump scenario
local sysId
local w1 = {x=0, y=0, c1={s=0, d=0}, c2={s=0, d=0}, ok1=true, ok2=true}
local w2 = {x=0, y=0, c1={s=0, d=0}, c2={s=0, d=0}, ok1=true, ok2=true}
local w3 = {x=0, y=0, c1={s=0, d=0}, c2={s=0, d=0}, ok1=true, ok2=true}
local w4 = {x=0, y=0, c1={s=0, d=0}, c2={s=0, d=0}, ok1=true, ok2=true}
local s = {x=0, y=0}
-- Get coordinates of the considered waypoint and the target
navcomp:Yield ()
sysId, w1.y, w1.x = SplitSectorID (n1.s)
sysId, w2.y, w2.x = SplitSectorID (n2.s)
sysId, s.y, s.x = SplitSectorID (s2)
-- 2 Jump Scenarios
-- Find the common point c1.
-- Check if the path is clear from n1 to c1 and c1 to s2
w1.c1.s = navcomp:BuildSectorId (sysId, w1.x, s.y)
w1.c1.d = (w1.x - s.x)*(w1.x - s.x)
w1.c2.s = navcomp:BuildSectorId (sysId, s.x, w1.y)
w1.c2.d = (w1.y - s.y)*(w1.y - s.y)
w2.c1.s = navcomp:BuildSectorId (sysId, w2.x, s.y)
w2.c1.d = (w2.x - s.x)*(w2.x - s.x)
w2.c2.s = navcomp:BuildSectorId (sysId, s.x, w2.y)
w2.c2.d = (w2.y - s.y)*(w2.y - s.y)
navcomp:Yield ()
w1.ok1 = not (navcomp:IsPathProhibited (n1.s, w1.c1.s, true) or navcomp:IsPathProhibited (w1.c1.s, s2, true))
w1.ok2 = not (navcomp:IsPathProhibited (n1.s, w1.c2.s, true) or navcomp:IsPathProhibited (w1.c2.s, s2, true))
local ok1 = w1.ok1 or w1.ok2
w2.ok1 = not (navcomp:IsPathProhibited (n1.s, w2.c1.s, true) or navcomp:IsPathProhibited (w2.c1.s, s2, true))
w2.ok2 = not (navcomp:IsPathProhibited (n1.s, w2.c2.s, true) or navcomp:IsPathProhibited (w2.c2.s, s2, true))
local ok2 = w2.ok1 or w2.ok2
--print (string.format ("W1: C1 s= %s, d=%d\tC2 s=%s, d=%d\t%s", AbbrLocationStr (w1.c1.s), w1.c1.d, AbbrLocationStr (w1.c2.s), w1.c2.d, tostring (ok1)))
--print (string.format ("W2: C1 s= %s, d=%d\tC2 s=%s, d=%d\t%s", AbbrLocationStr (w2.c1.s), w2.c1.d, AbbrLocationStr (w2.c2.s), w2.c2.d, tostring (ok2)))
-- If valid, return n1
if ok1 and (not ok2 or
w1.c1.d < w2.c1.d or
w1.c1.d < w2.c2.d or
w1.c2.d < w2.c1.d or
w1.c2.d < w2.c2.d) then
return n1
end
end
local function GetNearsFars (n1)
local sysId, x, y, nx, ny, fx, fy
sysId, y, x = SplitSectorID (n1.s)
nx = 1
fx = 16
if x > 8 then
nx = 16
fx = 1
end
ny = 1
fy = 16
if y > 8 then
ny = 16
fy = 1
end
return x, y, nx, ny, fx, fy
end
local function CheckCorridor (n)
--[[
Edges are defined as x=1 or 16 or y=1 or 16
if x=1 or 16, look for a sector with the same x but with y set to 1 or 16
that sector's edge should be free of prohibitions
]]
local sysId, y, x = SplitSectorID (n.s)
local t1, t2, result
-- Check for X Corridor
t1 = navcomp:BuildSectorId (sysId, x, 1)
t2 = navcomp:BuildSectorId (sysId, x, 16)
result = not navcomp:IsPathProhibited (t1, t2, true)
-- Check for Y Corridor
t1 = navcomp:BuildSectorId (sysId, 1, y)
t2 = navcomp:BuildSectorId (sysId, 16, y)
return result or (not navcomp:IsPathProhibited (t1, t2, true))
end
function navcomp.plotter:Edge (n1, n2, s2, stats, area)
local result = Check2Jump (n1, n2, s2)
if result then return result end
-- 2 Jump did not produce a choice. See if we're on an edge
-- then jump to it provided the edge is clear and has the lowest stress
-- along that edge. If 2 edges are clear with the same stress, pick
-- the one which would provide a jump closest to the target
-- Check for not edge
-- Pick n1 if an edge, not blocked, and n2 is either: A) an edge and blocked, B) has an intersection
-- not closer than the intersection for n1 and s2, or C) n2 is not an edge
-- if n1 is not an edge or is an edge and blocked, reject
if CheckCorridor (n1) then
if not CheckCorridor (n2) then
return n1
end
-- 2 possible intersection points
local c1, c2
local nx1, nx2, ny1, ny2, sx, sy, sysId
sysId, sy, sx = SplitSectorID (s2)
sysId, ny1, nx1 = SplitSectorID (n1.s)
sysId, ny2, nx2 = SplitSectorID (n2.s)
if (nx1-sx) < (ny1-sy) then
c1 = nx1-sx
else
c1 = ny1-sy
end
if (nx2-sx) < (ny2-sy) then
c2 = nx2-sx
else
c2 = ny2-sy
end
if c1 < c2 then
return n1
end
end
end
|
-- This script takes temprature and humidity from an AM2302
-- and sends it out on MQTT every 5 seconds.
-- mqtt details
client = "<username>"
password = "<password>"
url = "iot.rabbiteer.io"
--these are the data and clock pin numbers
sda, scl = 1, 2
-- this will be called after mqtt connect
function on_mqtt_connected(m)
--setup i2c and connect to the am2320
i2c.setup(0, sda, scl, i2c.SLOW)
am2320.setup()
-- take a reading every 5 seconds and send via mqtt
tmr.create():alarm(5000, tmr.ALARM_AUTO, function()
-- take reading
rh, t = am2320.read()
-- publish temprature
m:publish(
"metric/temprature/" .. client,
string.format("%s", t/10),
0, 0)
-- publish humidity
m:publish(
"metric/humidity/" .. client,
string.format("%s", rh/10),
0, 0)
end)
end
-- this will be called on mqtt error
function on_mqtt_error(client, reason)
print("error: " .. reason);
node.restart();
end
-- connect to the MQTT broker
m = mqtt.Client(client, 60, client, password)
m:connect(url, 8883, 1, 0, on_mqtt_connected, on_mqtt_error)
|
--[[ Helpers ]]
function table.contains(table, element)
for _, value in pairs(table) do
if value == element then
return true
end
end
return false
end
function table.removeByValue(table, value)
found = false
for tableKey, tableValue in pairs(table) do
if tableValue == value then
table[tableKey] = nil
found = true
end
end
return found
end
function table.getKey(table, value)
for tableKey, tableValue in pairs(table) do
if (tableValue == value) then
return tableKey
end
end
return nil
end
function table.toString(table, separator)
result = ""
for _, value in pairs(table) do
if (string.len(result) == 0) then
result = result .. value
else
result = result .. separator .. value
end
end
return result
end
--[[ Globals for this script ]]
objectGUIDsInTheZone = {}
playerCount = 0
deckTypes = {}
playerCountTokenGUIDs = { "f8d86b", "b51ba9", "feb2ff", "d5b306", "3eb5e5" }
startGameTokenGUID = "201379"
kDeckTokenGUID = "e1662e"
eDeckTokenGUID = "9752bc"
iDeckTokenGUID = "ae31c5"
--[[ Private functions ]]
function updateGameSettings()
playerCount = 0
startGame = false
deckTypes = {}
for _, objectGUID in pairs(objectGUIDsInTheZone) do
if (table.contains(playerCountTokenGUIDs, objectGUID)) then
updatePlayerCount(objectGUID)
elseif (objectGUID == kDeckTokenGUID) then
table.insert(deckTypes, "K")
elseif (objectGUID == eDeckTokenGUID) then
table.insert(deckTypes, "E")
elseif (objectGUID == iDeckTokenGUID) then
table.insert(deckTypes, "I")
elseif (objectGUID == startGameTokenGUID) then
startGame = true
end
end
print("Adjusting player count to " .. playerCount)
setGlobalScriptVar("playerCount", playerCount)
print("Adjusting deck types to '" .. table.toString(deckTypes, ",") .. "'")
-- This is broken so we need to use other function at the moment
-- setGlobalScriptTable(deckTypes, "deckTypes")
callLuaFunctionInOtherScriptWithParams(nil, "setDeckTypes", deckTypes)
if (startGame and not getGlobalScriptVar("gameStarted")) then
print("Starting game")
callLuaFunctionInOtherScript(nil, "initializeBoard")
end
end
function updatePlayerCount(objectGUID)
count = table.getKey(playerCountTokenGUIDs, objectGUID)
if (count ~= nil and count > playerCount) then
playerCount = count
end
end
--[[ Event hooks ]]
function onObjectEnterScriptingZone(zone, object)
objectGUID = object.getGUID()
if (zone.getGUID() ~= self.getGUID() or
table.contains(objectGUIDsInTheZone, objectGUID)) then
return
end
print("Object " .. object.getName() .. " type " .. object.name .. " GUID " .. objectGUID .. " entered Game Settings scripting zone")
table.insert(objectGUIDsInTheZone, objectGUID)
updateGameSettings()
end
function onObjectLeaveScriptingZone(zone, object)
objectGUID = object.getGUID()
if (zone.getGUID() ~= self.getGUID() or
not table.contains(objectGUIDsInTheZone, objectGUID)) then
return
end
print("Object " .. object.getName() .. " type " .. object.name .. " GUID " .. objectGUID .. " left Game Settings scripting zone")
if (not table.removeByValue(objectGUIDsInTheZone, objectGUID)) then
print("Object " .. object.getName() .. " GUID " .. objectGUID .. " was not in object GUIDs for this zone")
return
end
updateGameSettings()
end
function onload()
local playerCountButtonParameters = {}
playerCountButtonParameters.click_function = "dummy"
playerCountButtonParameters.label = ""
playerCountButtonParameters.function_owner = nil
playerCountButtonParameters.position = {0, -0.5, 0}
playerCountButtonParameters.rotation = {180.0, 180.0, 0}
playerCountButtonParameters.width = 0
playerCountButtonParameters.height = 0
playerCountButtonParameters.font_size = 180
for i=1, 5, 1 do
playerCountButtonParameters.label = (i .. ' Players')
getObjectFromGUID(playerCountTokenGUIDs[i]).createButton(playerCountButtonParameters)
end
playerCountButtonParameters.label = "Start\nGame"
getObjectFromGUID(startGameTokenGUID).createButton(playerCountButtonParameters)
playerCountButtonParameters.label = "K\nDeck"
getObjectFromGUID(kDeckTokenGUID).createButton(playerCountButtonParameters)
playerCountButtonParameters.label = "E\nDeck"
getObjectFromGUID(eDeckTokenGUID).createButton(playerCountButtonParameters)
playerCountButtonParameters.label = "I\nDeck"
getObjectFromGUID(iDeckTokenGUID).createButton(playerCountButtonParameters)
end
|
local types = require('cmp.types')
local cache = require('cmp.utils.cache')
local misc = require('cmp.utils.misc')
local compare = {}
-- offset
compare.offset = function(entry1, entry2)
local diff = entry1:get_offset() - entry2:get_offset()
if diff < 0 then
return true
elseif diff > 0 then
return false
end
end
-- exact
compare.exact = function(entry1, entry2)
if entry1.exact ~= entry2.exact then
return entry1.exact
end
end
-- score
compare.score = function(entry1, entry2)
local diff = entry2.score - entry1.score
if diff < 0 then
return true
elseif diff > 0 then
return false
end
end
-- recently_used
compare.recently_used = setmetatable({
records = {},
add_entry = function(self, e)
self.records[e.completion_item.label] = vim.loop.now()
end,
}, {
__call = function(self, entry1, entry2)
local t1 = self.records[entry1.completion_item.label] or -1
local t2 = self.records[entry2.completion_item.label] or -1
if t1 ~= t2 then
return t1 > t2
end
end,
})
-- kind
compare.kind = function(entry1, entry2)
local kind1 = entry1:get_kind()
kind1 = kind1 == types.lsp.CompletionItemKind.Text and 100 or kind1
local kind2 = entry2:get_kind()
kind2 = kind2 == types.lsp.CompletionItemKind.Text and 100 or kind2
if kind1 ~= kind2 then
if kind1 == types.lsp.CompletionItemKind.Snippet then
return true
end
if kind2 == types.lsp.CompletionItemKind.Snippet then
return false
end
local diff = kind1 - kind2
if diff < 0 then
return true
elseif diff > 0 then
return false
end
end
end
-- sortText
compare.sort_text = function(entry1, entry2)
if misc.safe(entry1.completion_item.sortText) and misc.safe(entry2.completion_item.sortText) then
local diff = vim.stricmp(entry1.completion_item.sortText, entry2.completion_item.sortText)
if diff < 0 then
return true
elseif diff > 0 then
return false
end
end
end
-- length
compare.length = function(entry1, entry2)
local diff = #entry1.completion_item.label - #entry2.completion_item.label
if diff < 0 then
return true
elseif diff > 0 then
return false
end
end
-- order
compare.order = function(entry1, entry2)
local diff = entry1.id - entry2.id
if diff < 0 then
return true
elseif diff > 0 then
return false
end
end
-- locality
compare.locality = setmetatable({
lines_count = 10,
lines_cache = cache.new(),
locality_map = {},
update = function(self)
local config = require('cmp').get_config()
if not vim.tbl_contains(config.sorting.comparators, compare.scopes) then
return
end
local win, buf = vim.api.nvim_get_current_win(), vim.api.nvim_get_current_buf()
local cursor_row = vim.api.nvim_win_get_cursor(win)[1] - 1
local max = vim.api.nvim_buf_line_count(buf)
if self.lines_cache:get('buf') ~= buf then
self.lines_cache:clear()
self.lines_cache:set('buf', buf)
end
self.locality_map = {}
for i = math.max(0, cursor_row - self.lines_count), math.min(max, cursor_row + self.lines_count) do
local is_above = i < cursor_row
local buffer = vim.api.nvim_buf_get_lines(buf, i, i + 1, false)[1] or ''
local locality_map = self.lines_cache:ensure({ 'line', buffer }, function()
local locality_map = {}
local regexp = vim.regex(config.completion.keyword_pattern)
while buffer ~= '' do
local s, e = regexp:match_str(buffer)
if s and e then
local w = string.sub(buffer, s + 1, e)
local d = math.abs(i - cursor_row) - (is_above and 0.1 or 0)
locality_map[w] = math.min(locality_map[w] or math.huge, d)
buffer = string.sub(buffer, e + 1)
else
break
end
end
return locality_map
end)
for w, d in pairs(locality_map) do
self.locality_map[w] = math.min(self.locality_map[w] or d, math.abs(i - cursor_row))
end
end
end,
}, {
__call = function(self, entry1, entry2)
local local1 = self.locality_map[entry1:get_word()]
local local2 = self.locality_map[entry2:get_word()]
if local1 ~= local2 then
if local1 == nil then
return false
end
if local2 == nil then
return true
end
return local1 < local2
end
end,
})
-- scopes
compare.scopes = setmetatable({
scopes_map = {},
update = function(self)
local config = require('cmp').get_config()
if not vim.tbl_contains(config.sorting.comparators, compare.scopes) then
return
end
local ok, locals = pcall(require, 'nvim-treesitter.locals')
if ok then
local win, buf = vim.api.nvim_get_current_win(), vim.api.nvim_get_current_buf()
local cursor_row = vim.api.nvim_win_get_cursor(win)[1] - 1
local ts_utils = require('nvim-treesitter.ts_utils')
-- Cursor scope.
local cursor_scope = nil
for _, scope in ipairs(locals.get_scopes(buf)) do
if scope:start() <= cursor_row and cursor_row <= scope:end_() then
if not cursor_scope then
cursor_scope = scope
else
if cursor_scope:start() <= scope:start() and scope:end_() <= cursor_scope:end_() then
cursor_scope = scope
end
end
elseif cursor_scope and cursor_scope:end_() <= scope:start() then
break
end
end
-- Definitions.
local definitions = locals.get_definitions_lookup_table(buf)
-- Narrow definitions.
local depth = 0
for scope in locals.iter_scope_tree(cursor_scope, buf) do
local s, e = scope:start(), scope:end_()
-- Check scope's direct child.
for _, definition in pairs(definitions) do
if s <= definition.node:start() and definition.node:end_() <= e then
if scope:id() == locals.containing_scope(definition.node, buf):id() then
local text = ts_utils.get_node_text(definition.node)[1]
if not self.scopes_map[text] then
self.scopes_map[text] = depth
end
end
end
end
depth = depth + 1
end
end
end,
}, {
__call = function(self, entry1, entry2)
local local1 = self.scopes_map[entry1:get_word()]
local local2 = self.scopes_map[entry2:get_word()]
if local1 ~= local2 then
if local1 == nil then
return false
end
if local2 == nil then
return true
end
return local1 < local2
end
end,
})
return compare
|
-- Edit anything you want just leave credits lol
local uicfg = {
["HeaderWidth"] = 250,
["AccentColor"] = Color3.new(0.6,0,0)
}
local gui = loadstring(game:HttpGet("https://gitlab.com/0x45.xyz/droplib/-/raw/master/drop-minified.lua"))():Init(uicfg,game.CoreGui)
getgenv().Autofarm = false
getgenv().setPos = nil
-- Code
local x
x = hookmetamethod(game, "__namecall", function(self, ...)
local Args = {...}
if not checkcaller() and self.Name == "Event" then
Args[2] = getgenv().setPos or Args[2]
end
return x(self, unpack(Args))
end)
local lCube = workspace.CubesFolder[game.Players.LocalPlayer.Name]
local function getClosestFood()
local closest, cf
for _,food in pairs(workspace.FoodsFolder:GetChildren()) do
local distance = (lCube.Position - food.Position).Magnitude
if not closest or distance < closest then closest=distance cf=food end
end
return cf
end
local function pathfindMove(part)
local showpath = false
local destination = part.Position
local pathfindingService = game:GetService("PathfindingService")
local path = pathfindingService:CreatePath()
path:ComputeAsync(lCube.Position, destination)
local waypoints = path:GetWaypoints()
repeat wait(1) getgenv().setPos = part.Position path:ComputeAsync(lCube.Position, destination) until path.Status == Enum.PathStatus.Success
local waypoints = path:GetWaypoints()
for k, waypoint in pairs(waypoints) do
if path.Status == Enum.PathStatus.Success then
getgenv().setPos = waypoint.Position
else
repeat path:ComputeAsync(body.Position,destination) until path.Status == Enum.PathStatus.Success
end
end
end
coroutine.wrap(function()
pcall(function()
while true do
if getgenv().Autofarm then
local closest = getClosestFood()
local rayOrigin = lCube.Position
local rayDirection = closest.Position
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {closest.Parent, lCube.Parent}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
if raycastResult then
pathfindMove(closest)
else
getgenv().setPos = closest.Position
repeat
wait(.1)
until (lCube.Position-closest.Position).Magnitude < 1
end
else
getgenv().setPos = nil
end
wait(.1)
end
end)
end)()
-- UI
local main = gui:CreateCategory("Main")
-- Main
main:CreateSwitch("Autofarm", function(x)
getgenv().setPos = nil
getgenv().Autofarm = x
end)
main:CreateButton("[Destroy Gui]", function()
gui:CleanUp()
end)
-- Credits
local credits = main:CreateSection("Credits")
credits:CreateTextLabel("Made by Nameless#6118")
credits:CreateButton("[Copy V3rm Link]", function()
setclipboard("https://v3rmillion.net/member.php?action=profile&uid=901556")
end)
credits:Collapse()
|
require 'curses'
require 'signal'
-- globals {{{
local map, rows, cols
local colors = {
"black", "green",
"red", "cyan",
"white", "magenta",
"blue", "yellow"
}
-- }}}
-- helpful functions {{{
local function pline(str)
curses.addstr({y = 0, x = 0}, str)
curses.clrtoeol()
end
local function botl(str)
curses.addstr({y = rows - 1, x = 0}, str)
curses.clrtoeol()
end
local function cleanup(sig)
curses.clear()
curses.endwin()
if sig then
signal.signal(sig, "default")
signal.raise(sig)
end
end
-- }}}
-- curses initialization {{{
curses.initscr();
curses.start_color();
curses.use_default_colors();
curses.setup_term{nl = false, cbreak = true, echo = false, keypad = true}
for _, color in ipairs(colors) do
curses.init_pair(color, color)
end
-- }}}
-- cleanup on signals {{{
signal.signal("TERM", cleanup)
signal.signal("INT", cleanup)
-- }}}
-- get the term size and the size of the map we want to draw {{{
rows, cols = curses.getmaxyx()
map = {ul = {x = 0, y = 1}, lr = {x = cols - 1, y = rows - 3}}
map.w = map.lr.x - map.ul.x + 1
map.h = map.lr.y - map.ul.y + 1
-- }}}
-- draw the screen {{{
curses.clear()
for i = map.ul.y, map.lr.y do
curses.addstr({y = i, x = map.ul.x}, ("."):rep(map.w))
end
-- }}}
-- initialize the character {{{
local char = {
x = math.random(map.ul.x, map.lr.x),
y = math.random(map.ul.y, map.lr.y),
move = function(self, offset)
if self.x + offset.x < map.ul.x or
self.x + offset.x > map.lr.x or
self.y + offset.y < map.ul.y or
self.y + offset.y > map.lr.y then
return 0
else
self.x = self.x + offset.x
self.y = self.y + offset.y
return 1
end
end,
draw = function(self)
curses.addch(self, "@", {bold = true})
curses.move(self)
end,
erase = function(self)
curses.addch(self, ".")
curses.move(self)
end
}
-- }}}
-- movement commands {{{
local directions = {
y = {x = -1, y = -1},
h = {x = -1, y = 0}, left = {x = -1, y = 0},
b = {x = -1, y = 1},
k = {x = 0, y = -1}, up = {x = 0, y = -1},
["."] = {x = 0, y = 0}, s = {x = 0, y = 0},
j = {x = 0, y = 1}, down = {x = 0, y = 1},
u = {x = 1, y = -1},
l = {x = 1, y = 0}, right = {x = 1, y = 0},
n = {x = 1, y = 1},
}
-- }}}
-- main loop {{{
local turns = 0
while true do
botl("T:" .. turns)
char:draw()
local c = curses.getch()
char:erase()
pline("")
if directions[c] then
turns = turns + char:move(directions[c])
elseif (c == "Q") then
break
else
if c == "\n" then c = "^J" end
if c == "\r" then c = "^M" end
pline("Unknown command '" .. c .. "'")
end
end
-- }}}
-- cleanup {{{
cleanup()
-- }}}
|
--=========== Copyright © 2020, Planimeter, All rights reserved. ===========--
--
-- Purpose:
--
--==========================================================================--
function framework.draw()
local width, height = framework.graphics.getSize()
framework.graphics.polygon( "fill", {
0.25 * width, 0.75 * height,
0.75 * width, 0.75 * height,
0.50 * width, 0.25 * height
} )
end
|
local _, Private = ...
if Private.initialized then
local localization = LibStub:GetLibrary("ovale/ui/Localization")
local L = localization and localization.l or nil
do
-- backwards compatibiility for Ovale<=9.0.43
L = L or (localization and localization.L or nil)
end
L = L or {}
local locale = GetLocale()
--[[
-- Insert additional localization strings into the Ovale localization
-- table. These symbol-to-string translations are used in the scripts
-- with the L() conditions, e.g., L(dispel), etc., for displaying the
-- correct string for text parameters.
--]]
-- Default locale (enUS)
L.active_mitigation = [[Active mitigation]]
L.dispel = [[Dispels]]
--L.interrupt = [[Interrupts]]
L.mage_arcane_ap_burn = [[Arcane Power Burn phase]]
L.mage_arcane_mini_burn = [[Mini Burn phase]]
L.mage_arcane_conserve = [[Conserve phase]]
--L.not_in_melee_range = [[Not in melee range]]
L.opt_nerien_shield_block = [[Always suggest Shield Block]]
L.trinkets = [[Trinkets]]
end
|
--window title
love.window.setTitle("Monkey Example")
--load the 3D lib
local dream = require("3DreamEngine")
--initialize engine
dream:init()
--load our object
local monkey = dream:loadObject("examples/monkey/object")
monkey.meshes.Suzanne.material.color = {0.4, 0.15, 0.05, 1}
--make a sun
local sun = dream:newLight("sun")
function love.draw()
dream:prepare()
dream:addLight(sun)
--add (draw) objects, apply transformations
monkey:reset()
monkey:rotateY(love.timer.getTime())
dream:draw(monkey, 0, 0, -2.25)
--render
dream:present()
end
|
------------
-- Aliases --
-------------
local g = vim.g
local map = vim.api.nvim_set_keymap
--------------
-- Mappings --
--------------
g.mapleader = ';'
-- Splits --
map('n','<Leader>v',':vsplit<CR>',{noremap = true, silent=true})
map('n','<Leader>s',':split<CR>',{noremap = true, silent=true})
-- Buffers --
map('n', '<A-1>', ':BufferLineGoToBuffer 1<CR>',{noremap = true, silent=true})
map('n', '<A-2>', ':BufferLineGoToBuffer 2<CR>',{noremap = true, silent=true})
map('n', '<A-3>', ':BufferLineGoToBuffer 3<CR>',{noremap = true, silent=true})
map('n', '<A-4>', ':BufferLineGoToBuffer 4<CR>',{noremap = true, silent=true})
map('n', '<A-5>', ':BufferLineGoToBuffer 5<CR>',{noremap = true, silent=true})
map('n', 'H', ':BufferLineCyclePrev<CR>',{noremap = true, silent=true})
map('n', 'L', ':BufferLineCycleNext<CR>',{noremap = true, silent=true})
map('n', 'gb', ':BufferLinePick<CR>',{noremap = true, silent=true})
map('n', '<Leader>ld', ':BufferLineCloseLeft<CR>',{noremap = true, silent=true})
map('n', '<Leader>rd', ':BufferLineCloseRight<CR>',{noremap = true, silent=true})
map('n', '<Leader>d', ':BufferLinePickClose<CR>',{noremap = true, silent=true})
-- Splits --
map('n', '<Leader>v', ':vsplit<CR>', {noremap = true, silent=true})
map('n', '<Leader>s', ':split<CR>', {noremap = true, silent=true})
map('n', 'fh', '<C-W><C-h>', {noremap = true, silent=true})
map('n', 'fj', '<C-W><C-j>', {noremap = true, silent=true})
map('n', 'fk', '<C-W><C-k>', {noremap = true, silent=true})
map('n', 'fl', '<C-W><C-l>', {noremap = true, silent=true})
-- Misc. --
map('n', ' ', ':update<CR>', {noremap = true, silent=true})
-- Registers
map('v', '<Leader>y', '"+y', {noremap = true, silent=true})
map('n', '<Leader>p', '"+p', {noremap = true, silent=true})
-- delete words
map('n', 'gd', 'daw', {noremap = true, silent=true})
map('n', 'gc', 'caw', {noremap = true, silent=true})
-- Move selected block of text
map('x', 'K', ":move '<-2<CR>gv=gv", {noremap = true, silent=true})
map('x', 'J', ":move '>+1<CR>gv=gv", {noremap = true, silent=true})
-- Better indenting
map('v', '>', '>gv', {noremap = true, silent=true})
map('v', '<', '<gv', {noremap = true, silent=true})
-- make joining lines keep cursor position
map('n', 'J', 'mzJ`z', {noremap = true})
-- go to previous or next buffer with arrow keys
map('n', 'H', ':BufferLineCyclePrev<CR>', {noremap = true, silent = true})
map('n', 'L', ':BufferLineCycleNext<CR>', {noremap = true, silent = true})
-- Stop the highlight easily
map('n','<Leader>h',':nohlsearch<CR>',{noremap = true, silent=true})
|
slot0 = class("StageProxy", import(".NetProxy"))
slot0.STAGE_ADDED = "stage added"
slot0.STAGE_UPDATED = "stage updated"
slot0.RANDOM_STAGE_DELETE = "random stage deleted"
slot0.RANDOM_STAGE_ADDED = "stage added"
slot0.register = function (slot0)
slot0:on(13001, function (slot0)
slot0.data.satges = {}
for slot4, slot5 in ipairs(slot0.expedition_list) do
slot6 = Stage.New(slot5)
slot6:display("loaded")
slot0.data.satges[slot6.id] = slot6
end
end)
slot0.on(slot0, 13100, function (slot0)
slot0.data.randomexpeditions = {}
for slot4, slot5 in ipairs(slot0.random_expedition_list) do
slot6 = Stage.New(slot5)
slot6:display("loaded")
if not slot0.data.randomexpeditions[slot6.id] then
print("随机关卡添加" .. slot6.id)
slot0:addRandomStage(slot6)
else
slot0.data.randomexpeditions[slot6.id] = slot6
end
end
end)
slot0.listenerRandomStage(slot0)
end
slot0.remove = function (slot0)
pg.TimeMgr.GetInstance():RemoveTimer(slot0.timerId)
slot0.timerId = nil
end
slot0.addStage = function (slot0, slot1)
slot0.data.satges[slot1.id] = slot1:clone()
slot0.data.satges[slot1.id]:display("added")
slot0.facade:sendNotification(slot0.STAGE_ADDED, slot1:clone())
end
slot0.getStageById = function (slot0, slot1)
if slot0.data.satges[slot1] ~= nil then
return slot0.data.satges[slot1]:clone()
end
end
slot0.updateStage = function (slot0, slot1)
slot0.data.satges[slot1.id] = slot1:clone()
slot0.data.satges[slot1.id]:display("updated")
slot0.facade:sendNotification(slot0.STAGE_UPDATED, slot1:clone())
end
slot0.getRandomStages = function (slot0)
return Clone(slot0.data.randomexpeditions) or {}
end
slot0.addRandomStage = function (slot0, slot1)
slot0.data.randomexpeditions[slot1.id] = slot1
slot0.facade:sendNotification(slot0.RANDOM_STAGE_ADDED, slot1:clone())
end
slot0.listenerRandomStage = function (slot0)
slot0.timerId = pg.TimeMgr.GetInstance():AddTimer("listenerRandomStage", 0, 1, function ()
if slot0.data.randomexpeditions and table.getCount(slot0.data.randomexpeditions) > 0 then
for slot4, slot5 in pairs(slot0.data.randomexpeditions) do
if slot5.out_time == slot0 then
slot0:removeRandomStageById(slot5.id)
end
end
end
end)
end
slot0.removeRandomStageById = function (slot0, slot1)
slot0.data.randomexpeditions[slot1] = nil
slot0.facade:sendNotification(slot0.RANDOM_STAGE_DELETE, slot1)
end
return slot0
|
storm_mobility = class({})
storm_ex_mobility = class({})
LinkLuaModifier("modifier_storm_mobility_thinker", "abilities/heroes/storm/storm_mobility/modifier_storm_mobility_thinker", LUA_MODIFIER_MOTION_BOTH)
LinkLuaModifier("modifier_storm_ex_mobility_thinker", "abilities/heroes/storm/storm_mobility/modifier_storm_ex_mobility_thinker", LUA_MODIFIER_MOTION_BOTH)
LinkLuaModifier("modifier_storm_mobility_charges", "abilities/heroes/storm/storm_mobility/modifier_storm_mobility_charges", LUA_MODIFIER_MOTION_BOTH)
function storm_mobility:GetIntrinsicModifierName()
return "modifier_storm_mobility_charges"
end
function storm_mobility:GetCastAnimationCustom() return ACT_DOTA_SPAWN end
function storm_mobility:GetPlaybackRateOverride() return 1.5 end
function storm_mobility:GetCastPointSpeed() return 50 end
function storm_mobility:GetCastRange(vLocation, hTarget)
if self:GetCaster():HasModifier('modifier_storm_extra_displacement') then
return 0
end
if self:GetCaster():HasModifier("modifier_upgrade_storm_ranged_remnant") then
return 650
end
return self.BaseClass.GetCastRange(self, vLocation, hTarget)
end
function storm_mobility:GetCastPoint()
if self:GetCaster():HasModifier('modifier_storm_extra_displacement') then
return 0.0
end
return self.BaseClass.GetCastPoint(self)
end
function storm_mobility:OnSpellStart()
local caster = self:GetCaster()
local duration = self:GetSpecialValueFor("duration")
local point = ClampPosition(caster:GetAbsOrigin(), CustomAbilitiesLegacy:GetCursorPosition(self), self:GetCastRange(Vector(0,0,0), nil), nil)
local groundPosition = GetGroundPosition(point, caster)
if self:GetCaster():HasModifier("modifier_upgrade_storm_ranged_remnant") then
EFX('particles/spectre/spectre_illusion_warp.vpcf', PATTACH_CUSTOMORIGIN, caster, {
cp0 = {
ent = caster,
point = 'attach_hitloc'
},
cp1 = groundPosition,
cp2 = {
ent = caster,
point = 'attach_hitloc'
},
release = true,
})
end
local thinker = CreateModifierThinker(
caster, --hCaster
self, --hAbility
"modifier_storm_mobility_thinker", --modifierName
{ duration = duration },
groundPosition,
caster:GetTeamNumber(), --nTeamNumber
true --bPhantomBlocker
)
EmitSoundOn("Hero_StormSpirit.StaticRemnantPlant", caster)
LinkAbilityCooldowns(caster, 'storm_ex_mobility')
end
function storm_ex_mobility:GetCastAnimationCustom() return ACT_DOTA_CAST_ABILITY_1 end
function storm_ex_mobility:GetPlaybackRateOverride() return 1.0 end
function storm_ex_mobility:GetCastPointSpeed() return 10 end
function storm_ex_mobility:OnSpellStart()
local caster = self:GetCaster()
local origin = caster:GetAbsOrigin()
local duration = self:GetSpecialValueFor("duration")
local point = ClampPosition(caster:GetAbsOrigin(), CustomAbilitiesLegacy:GetCursorPosition(self), self:GetCastRange(Vector(0,0,0), nil), nil)
local groundPosition = GetGroundPosition(point, caster)
local thinker = CreateModifierThinker(
caster, --hCaster
self, --hAbility
"modifier_storm_ex_mobility_thinker", --modifierName
{ duration = duration },
groundPosition, --vOrigin
caster:GetTeamNumber(), --nTeamNumber
true --bPhantomBlocker
)
local efx = EFX("particles/storm/storm_ex_mobility_launch.vpcf", PATTACH_ABSORIGIN_FOLLOW, caster, {
cp1 = point + Vector(0, 0, 2000)
})
ParticleManager:SetParticleControlEnt(
efx,
0,
caster,
PATTACH_POINT_FOLLOW,
"attach_attack1",
origin, -- unknown
false -- unknown, true
)
EmitSoundOn("Hero_StormSpirit.StaticRemnantPlant", caster)
LinkAbilityCooldowns(caster, 'storm_mobility')
end
if IsClient() then require("wrappers/abilities") end
Abilities.Castpoint(storm_mobility)
Abilities.Castpoint(storm_ex_mobility)
|
local tests = torch.TestSuite()
function tests.TransferFunctionFactory_factorySoftSign()
local name = "SoftSign"
local factory = nnst.TransferFunctionFactory:getByName(name)
tester:eq(factory:getName(), name)
end
function tests.TransferFunctionFactory_factoryReLU()
local name = "ReLU"
local factory = nnst.TransferFunctionFactory:getByName(name)
tester:eq(factory:getName(), name)
end
function tests.TransferFunctionFactory_factoryELU()
local name = "ELU"
local factory = nnst.TransferFunctionFactory:getByName(name)
tester:eq(factory:getName(), name)
end
function tests.TransferFunctionFactory_factoryALU()
local name = "TransferFunctionALU"
local factory = nnst.TransferFunctionFactory:getByName(name)
tester:eq(factory:getName(), name)
end
return tests
|
local t = Def.ActorFrame{
OnCommand=function(self)
SCREENMAN:ReloadOverlayScreens()
end
};
return t;
|
local KUI, E, L, V, P, G = unpack(select(2, ...))
local EFL = KUI:GetModule("EnhancedFriendsList")
local COMP = KUI:GetModule("KuiCompatibility")
--Cache global variables
--WoW API / Variables
--Global variables that we don't cache, list them here for the mikk's Find Globals script
-- GLOBALS: AceGUIWidgetLSMlists, FONT_SIZE, FACTION_ALLIANCE, FACTION_HORDE, FACTION_STANDING_LABEL4
-- GLOBALS: FRIENDS_LIST_ONLINE, FRIENDS_LIST_OFFLINE, DEFAULT_DND_MESSAGE, DEFAULT_AFK_MESSAGE
-- GLOBALS: FriendsFrame_UpdateFriends
local function EnhancedFriendsListTable()
E.Options.args.KlixUI.args.modules.args.efl = {
type = "group",
name = EFL.modName..E.NewSign,
order = 12,
disabled = function() return COMP.PA and _G.ProjectAzilroka.db["EnhancedFriendsList"] end,
hidden = function() return COMP.PA and _G.ProjectAzilroka.db["EnhancedFriendsList"] end,
get = function(info) return E.db.KlixUI.efl[ info[#info] ] end,
set = function(info, value) E.db.KlixUI.efl[ info[#info] ] = value; end,
args = {
header1 = {
type = "header",
name = KUI:cOption(EFL.modName),
order = 1
},
credits = {
order = 2,
type = "group",
name = L["Credits"],
guiInline = true,
args = {
tukui = {
order = 1,
type = "description",
fontSize = "medium",
name = "|cFF16C3F2Enhanced|r |cFFFFFFFFFriends List|r - |cFF16C3F2Project|r|cFFFFFFFFAzilroka|r",
},
},
},
general = {
order = 3,
type = "group",
name = L["General"],
guiInline = true,
get = function(info) return E.db.KlixUI.efl[info[#info]] end,
set = function(info, value) E.db.KlixUI.efl[info[#info]] = value; FriendsFrame_UpdateFriends() end, -- causes an error if the FriendsFrame isnt open
args = {
enable = {
order = 1,
type = "toggle",
name = L["Enable"],
get = function(info) return E.db.KlixUI.efl.enable end,
set = function(info, value) E.db.KlixUI.efl.enable = value; E:StaticPopup_Show("PRIVATE_RL"); end,
},
NameFont = {
type = "select", dialogControl = 'LSM30_Font',
order = 2,
name = L["Name Font"],
values = AceGUIWidgetLSMlists.font,
hidden = function() return not E.db.KlixUI.efl.enable end,
},
NameFontSize = {
order = 3,
name = FONT_SIZE,
type = "range",
min = 6, max = 22, step = 1,
hidden = function() return not E.db.KlixUI.efl.enable end,
},
NameFontFlag = {
name = L["Font Outline"],
order = 4,
type = "select",
values = {
['NONE'] = 'None',
['OUTLINE'] = 'OUTLINE',
['MONOCHROME'] = 'MONOCHROME',
['MONOCHROMEOUTLINE'] = 'MONOCROMEOUTLINE',
['THICKOUTLINE'] = 'THICKOUTLINE',
},
hidden = function() return not E.db.KlixUI.efl.enable end,
},
InfoFont = {
type = "select", dialogControl = 'LSM30_Font',
order = 5,
name = L["Info Font"],
values = AceGUIWidgetLSMlists.font,
hidden = function() return not E.db.KlixUI.efl.enable end,
},
InfoFontSize = {
order = 6,
name = FONT_SIZE,
type = "range",
min = 6, max = 22, step = 1,
hidden = function() return not E.db.KlixUI.efl.enable end,
},
InfoFontFlag = {
order = 7,
name = L["Font Outline"],
type = "select",
values = {
['NONE'] = 'None',
['OUTLINE'] = 'OUTLINE',
['MONOCHROME'] = 'MONOCHROME',
['MONOCHROMEOUTLINE'] = 'MONOCROMEOUTLINE',
['THICKOUTLINE'] = 'THICKOUTLINE',
},
hidden = function() return not E.db.KlixUI.efl.enable end,
},
GameIconPack = {
name = L["Game Icon Pack"],
order = 8,
type = "select",
values = {
['Default'] = 'Default',
['BlizzardChat'] = 'Blizzard Chat',
['Flat'] = 'Flat Style',
['Gloss'] = 'Glossy',
['Launcher'] = 'Launcher'
},
hidden = function() return not E.db.KlixUI.efl.enable end,
},
StatusIconPack = {
name = L["Status Icon Pack"],
order = 9,
type = "select",
values = {
['Default'] = 'Default',
['Square'] = 'Square',
['D3'] = 'Diablo 3',
},
hidden = function() return not E.db.KlixUI.efl.enable end,
},
},
},
GameIcons = {
order = 4,
type = "group",
name = L["Game Icon Preview"],
guiInline = true,
get = function(info) return E.db.KlixUI.efl[info[#info]] end,
set = function(info, value) E.db.KlixUI.efl[info[#info]] = value; FriendsFrame_UpdateFriends() end,
args = {
Alliance = {
order = 1,
type = "execute",
name = FACTION_ALLIANCE,
func = function() return end,
image = function(info) return EFL.GameIcons[E.db.KlixUI.efl["GameIconPack"]][info[#info]], 32, 32 end,
},
Horde = {
order = 2,
type = "execute",
name = FACTION_HORDE,
func = function() return end,
image = function(info) return EFL.GameIcons[E.db.KlixUI.efl["GameIconPack"]][info[#info]], 32, 32 end,
},
Neutral = {
order = 3,
type = "execute",
name = FACTION_STANDING_LABEL4, --Neutral
func = function() return end,
image = function(info) return EFL.GameIcons[E.db.KlixUI.efl["GameIconPack"]][info[#info]], 32, 32 end,
},
D3 = {
order = 4,
type = "execute",
name = L["Diablo 3"],
func = function() return end,
image = function(info) return EFL.GameIcons[E.db.KlixUI.efl["GameIconPack"]][info[#info]], 32, 32 end,
},
WTCG = {
order = 5,
type = "execute",
name = L["Hearthstone"],
func = function() return end,
image = function(info) return EFL.GameIcons[E.db.KlixUI.efl["GameIconPack"]][info[#info]], 32, 32 end,
},
S1 = {
order = 6,
type = "execute",
name = L["Starcraft"],
func = function() return end,
image = function(info) return EFL.GameIcons[E.db.KlixUI.efl["GameIconPack"]][info[#info]], 32, 32 end,
},
S2 = {
order = 6,
type = "execute",
name = L["Starcraft 2"],
func = function() return end,
image = function(info) return EFL.GameIcons[E.db.KlixUI.efl["GameIconPack"]][info[#info]], 32, 32 end,
},
App = {
order = 7,
type = "execute",
name = L["App"],
func = function() return end,
image = function(info) return EFL.GameIcons[E.db.KlixUI.efl["GameIconPack"]][info[#info]], 32, 32 end,
},
BSAp = {
order = 8,
type = "execute",
name = L["Mobile"],
func = function() return end,
image = function(info) return EFL.GameIcons[E.db.KlixUI.efl["GameIconPack"]][info[#info]], 32, 32 end,
},
Hero = {
order = 9,
type = "execute",
name = L["Hero of the Storm"],
func = function() return end,
image = function(info) return EFL.GameIcons[E.db.KlixUI.efl["GameIconPack"]][info[#info]], 32, 32 end,
},
Pro = {
order = 10,
type = "execute",
name = L["Overwatch"],
func = function() return end,
image = function(info) return EFL.GameIcons[E.db.KlixUI.efl["GameIconPack"]][info[#info]], 32, 32 end,
},
DST2 = {
order = 11,
type = "execute",
name = L["Destiny 2"],
func = function() return end,
image = function(info) return EFL.GameIcons[E.db.KlixUI.efl["GameIconPack"]][info[#info]], 32, 32 end,
},
VIPR = {
order = 11,
type = "execute",
name = L["Call of Duty 4"],
func = function() return end,
image = function(info) return EFL.GameIcons[E.db.KlixUI.efl["GameIconPack"]][info[#info]], 32, 32 end,
},
},
},
StatusIcons = {
order = 5,
type = "group",
name = L["Status Icon Preview"],
guiInline = true,
get = function(info) return E.db.KlixUI.efl[info[#info]] end,
set = function(info, value) E.db.KlixUI.efl[info[#info]] = value; FriendsFrame_UpdateFriends() end,
args = {
Online = {
order = 1,
type = "execute",
name = FRIENDS_LIST_ONLINE,
func = function() return end,
image = function(info) return EFL.StatusIcons[E.db.KlixUI.efl["StatusIconPack"]][info[#info]], 16, 16 end,
},
Offline = {
order = 2,
type = "execute",
name = FRIENDS_LIST_OFFLINE,
func = function() return end,
image = function(info) return EFL.StatusIcons[E.db.KlixUI.efl["StatusIconPack"]][info[#info]], 16, 16 end,
},
DND = {
order = 3,
type = "execute",
name = DEFAULT_DND_MESSAGE,
func = function() return end,
image = function(info) return EFL.StatusIcons[E.db.KlixUI.efl["StatusIconPack"]][info[#info]], 16, 16 end,
},
AFK = {
order = 4,
type = "execute",
name = DEFAULT_AFK_MESSAGE,
func = function() return end,
image = function(info) return EFL.StatusIcons[E.db.KlixUI.efl["StatusIconPack"]][info[#info]], 16, 16 end,
},
},
},
},
}
end
tinsert(KUI.Config, EnhancedFriendsListTable)
|
--[[lit-meta
name = "creationix/coro-http"
version = "3.2.0"
dependencies = {
"creationix/coro-net@3.0.0",
"luvit/http-codec@3.0.0"
}
homepage = "https://github.com/luvit/lit/blob/master/deps/coro-http.lua"
description = "An coro style http(s) client and server helper."
tags = {"coro", "http"}
license = "MIT"
author = { name = "Tim Caswell" }
]]
local httpCodec = require('http-codec')
local net = require('coro-net')
local function createServer(host, port, onConnect)
net.createServer({
host = host,
port = port,
encode = httpCodec.encoder(),
decode = httpCodec.decoder(),
}, function (read, write, socket)
for head in read do
local parts = {}
for part in read do
if #part > 0 then
parts[#parts + 1] = part
else
break
end
end
local body = table.concat(parts)
head, body = onConnect(head, body, socket)
write(head)
if body then write(body) end
write("")
if not head.keepAlive then break end
end
end)
end
local function parseUrl(url)
local protocol, host, hostname, port, path = url:match("^(https?:)//(([^/:]+):?([0-9]*))(/?.*)$")
if not protocol then error("Not a valid http url: " .. url) end
local tls = protocol == "https:"
port = port and tonumber(port) or (tls and 443 or 80)
if path == "" then path = "/" end
return {
tls = tls,
host = host,
hostname = hostname,
port = port,
path = path
}
end
local connections = {}
local function getConnection(host, port, tls, timeout)
for i = #connections, 1, -1 do
local connection = connections[i]
if connection.host == host and connection.port == port and connection.tls == tls then
table.remove(connections, i)
-- Make sure the connection is still alive before reusing it.
if not connection.socket:is_closing() then
connection.reused = true
connection.socket:ref()
return connection
end
end
end
local read, write, socket, updateDecoder, updateEncoder = assert(net.connect {
host = host,
port = port,
tls = tls,
timeout = timeout,
encode = httpCodec.encoder(),
decode = httpCodec.decoder()
})
return {
socket = socket,
host = host,
port = port,
tls = tls,
read = read,
write = write,
updateEncoder = updateEncoder,
updateDecoder = updateDecoder,
reset = function ()
-- This is called after parsing the response head from a HEAD request.
-- If you forget, the codec might hang waiting for a body that doesn't exist.
updateDecoder(httpCodec.decoder())
end
}
end
local function saveConnection(connection)
if connection.socket:is_closing() then return end
connections[#connections + 1] = connection
connection.socket:unref()
end
local function request(method, url, headers, body, customOptions)
-- customOptions = { timeout = number, followRedirects = boolean }
local options = {}
if type(customOptions) == "number" then
-- Ensure backwards compatibility, where customOptions used to just be timeout
options.timeout = customOptions
else
options = customOptions or {}
end
options.followRedirects = options.followRedirects == nil and true or options.followRedirects -- Follow any redirects, Default: true
local uri = parseUrl(url)
local connection = getConnection(uri.hostname, uri.port, uri.tls, options.timeout)
local read = connection.read
local write = connection.write
local req = {
method = method,
path = uri.path,
{"Host", uri.host}
}
local contentLength
local chunked
if headers then
for i = 1, #headers do
local key, value = unpack(headers[i])
key = key:lower()
if key == "content-length" then
contentLength = value
elseif key == "content-encoding" and value:lower() == "chunked" then
chunked = true
end
req[#req + 1] = headers[i]
end
end
if type(body) == "string" then
if not chunked and not contentLength then
req[#req + 1] = {"Content-Length", #body}
end
end
write(req)
if body then write(body) end
local res = read()
if not res then
if not connection.socket:is_closing() then
connection.socket:close()
end
-- If we get an immediate close on a reused socket, try again with a new socket.
-- TODO: think about if this could resend requests with side effects and cause
-- them to double execute in the remote server.
if connection.reused then
return request(method, url, headers, body)
end
error("Connection closed")
end
body = {}
if req.method == "HEAD" then
connection.reset()
else
while true do
local item = read()
if not item then
res.keepAlive = false
break
end
if #item == 0 then
break
end
body[#body + 1] = item
end
end
if res.keepAlive then
saveConnection(connection)
else
write()
end
-- Follow redirects
if method == "GET" and (res.code == 302 or res.code == 307) and options.followRedirects then
for i = 1, #res do
local key, location = unpack(res[i])
if key:lower() == "location" then
return request(method, location, headers)
end
end
end
return res, table.concat(body)
end
return {
createServer = createServer,
parseUrl = parseUrl,
getConnection = getConnection,
saveConnection = saveConnection,
request = request,
}
|
local configuration = require("hs.network.configuration")
local reachability = require("hs.network.reachability")
local watchable = require"hs.watchable"
local http = require("hs.http")
local output = {
external = "unknown",
primary = {
interface = "unknown",
address = "0.0.0.0",
name = nil,
},
secondary = {
interface = "unknown",
address = "0.0.0.0",
name = nil,
},
}
local module = {}
local cstore = configuration.open()
local updateExternalAddress = function(w, p, i, oldValue, value)
if value then
module._getExternalAddress = http.asyncGet("http://eth0.me", nil, function(s, b, h)
output.external = b
end)
else
output.external = "NO INTERNET CONNECTION"
end
end
module.watchInternetStatus = watchable.watch("generalStatus.internet", updateExternalAddress)
module.cstore = cstore
module.output = output
updateExternalAddress(nil, nil, nil, nil, module.watchInternetStatus:value())
return module
|
--[[
MTA Role Play (mta-rp.pl)
Autorzy poniższego kodu:
- Patryk Adamowicz <patrykadam.dev@gmail.com>
Discord: PatrykAdam#1293
Link do githuba: https://github.com/PatrykAdam/mtarp
--]]
function getZoneID(id)
for i, v in ipairs(getElementsByType( "colshape" )) do
if getElementData(v, "isZone") and getElementData(v, "zoneID") == id then
return v
end
end
return false
end
function createZone(pX, pY, pZ, dimension, interior, pW, pD, pH)
local id = 1
local colshape = getElementsByType( "colshape" )
while colshape[id] and getZoneID(id) do
id = id + 1
end
local element = createColCuboid( pX, pY, pZ, pW, pD, pH )
setElementData(element, "isZone", true)
setElementData(element, "zoneID", id)
setElementData(element, "zoneOwnerType", 0)
setElementData(element, "zoneOwner", 0)
setElementData(element, "zonePermission", 0)
exports.sarp_mysql:mysql_change("INSERT INTO `sarp_zones` SET `id` = ?, `posX` = ?, `posY` = ?, `posZ` = ?, `dimension` = ?, `interior` = ?, `width` = ?, `height` = ?, `depth` = ?", id, pX, pY, pZ, dimension, interior, pW, pH, pD)
return id
end
function deleteZone(id)
exports.sarp_mysql:mysql_change("DELETE FROM `sarp_zones` WHERE `id` = ?", getElementData(id, "zoneID"))
destroyElement( id )
end
function isZoneOwner(playerid, zoneElement)
if getElementData(zoneElement, "zoneOwnerType") == 1 and getElementData(zoneElement, "zoneOwner") == getElementData(playerid, "player:id")
or getElementData(zoneElement, "zoneOwnerType") == 2 and exports.sarp_groups:isPlayerInGroup(playerid, getElementData(zoneElement, "zoneOwner")) then
return true
end
return false
end
function haveZonePermission(playerid, permission, zoneOwner)
local zoneList = detectPlayerZone(playerid)
if #zoneList == 0 then return false end
local isOwner = false
if zoneOwner then
for i, v in ipairs(zoneList) do
if isZoneOwner(playerid, v) then
isOwner = true
break
end
end
if not isOwner then
return false
end
end
for i, v in ipairs(zoneList) do
if exports.sarp_main:bitAND(getElementData(v, "zonePermission"), permission) ~= 0 then
return true, v, getElementData(v, "zoneOwner")
end
end
return false
end
|
--
-- User: argyle
-- Date: 2019_03/12
-- Time: 10:15 PM
local modname, S = ...
local bs = borders.settings
local top_node_sheet = bs.bottom_node + bs.bottom_layer_thickness - 1
local top_node_alt = bs.bottom_node + bs.mantle_thickness - 1
local top_node_deepstone = bs.bottom_node + bs.deepstone_thickness - 1
local mantlestone_cid = minetest.get_content_id(bs.mstone)
-- Place a solid layer of mantlestone at the bottom of the world, just in case our ore generation doesn't cover it.
-- Since alternate generation guarantees this, we'll skip it in the default case.
if bs.master_mantle_enable and bs.bottom_layer_enable and not (bs.mantle_alt_gen and bs.bottom_layer_thickness == 1) then
local result = minetest.register_on_generated(function(minp, maxp)
if top_node_sheet >= minp.y and bs.bottom_node <= maxp.y then
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local data = vm:get_data()
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax })
for x = minp.x, maxp.x do
for z = minp.z, maxp.z do
for y = math.max(minp.y, bs.bottom_node), math.min(maxp.y, top_node_sheet) do
data[area:index(x, y, z)] = mantlestone_cid
end
end
end
vm:set_data(data)
vm:calc_lighting()
vm:update_liquids()
vm:write_to_map()
end
end)
end
if bs.master_mantle_enable and not bs.mantle_alt_gen then
-- I thought ore registrations were executed in order, but it appears reversed.
-- Generate mantlestone in a stratum using the engine's mapgen.
local result = minetest.register_ore({
ore_type = "stratum",
-- ore_type = "yermom",
ore = bs.mstone,
wherein = { "default:stone", "air" }, -- Yes, air, otherwise caves can prevent full coverage.
clust_scarcity = 1,
stratum_thickness = bs.mantle_thickness,
noise_params = {
offset = bs.bottom_node + (bs.mantle_thickness / 2),
scale = bs.mantle_scale,
spread = { x = bs.mantle_roughness, y = bs.mantle_roughness, z = bs.mantle_roughness },
seed = 14512,
octaves = 2,
persist = 0.9,
},
y_min = bs.bottom_node,
y_max = bs.bottom_node + bs.mantle_thickness + (bs.mantle_scale * 1.9), -- 1.9 = 1 octave + .9 ocatave
})
elseif bs.master_mantle_enable then
-- Alternative generation.. Resembles that other block game.
minetest.register_on_generated(function(minp, maxp, blockseed)
if top_node_alt >= minp.y and bs.bottom_node <= maxp.y then
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local data = vm:get_data()
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax })
local rng = PcgRandom(blockseed)
for x = minp.x, maxp.x do
for z = minp.z, maxp.z do
for y = math.max(minp.y, bs.bottom_node), math.min(maxp.y, top_node_alt) do
if rng:next(0, y - bs.bottom_node) == 0 then
data[area:index(x, y, z)] = mantlestone_cid
end
end
end
end
vm:set_data(data)
vm:calc_lighting()
vm:update_liquids()
vm:write_to_map()
end
end)
end
-- Deepstone generation
if bs.deepstone_thickness ~= 0 then
print("DO 4");
minetest.register_ore({
ore_type = "scatter",
ore = bs.dstone,
wherein = "default:stone",
clust_scarcity = 1,
clust_num_ores = 5,
clust_size = 2,
y_min = bs.bottom_node,
y_max = top_node_deepstone,
})
end
|
-- This config configures spoons based on approach in
-- https://github.com/zzamboni/dot-hammerspoon/blob/master/init.lua
-- Initialize and configure installer spoon
hs.loadSpoon("SpoonInstall")
spoon.SpoonInstall.use_syncinstall = true
-- Installed Spoons
-- ================
-- Spoons don't have versions so I put dates next to them for some identification
-- Installed 8/11/19
spoon.SpoonInstall:andUse('MicMute', {hotkeys = {toggle = {{"cmd", "alt"}, "m"}}})
spoon.SpoonInstall:andUse("WindowHalfsAndThirds", {
config = {
use_frame_correctness = true
},
hotkeys = 'default'
})
-- menuHammer spoon, installed 7/31/21
menuHammer = hs.loadSpoon("MenuHammer")
menuHammer:enter()
-- Additional hs scripts not packaged as spoons
-- From http://www.hammerspoon.org/go/#pasteblock
hs.hotkey.bind({"cmd", "alt"}, "V", function() hs.eventtap.keyStrokes(hs.pasteboard.getContents()) end)
-- See if I do much Chrome text linking
hs.hotkey.bind({"cmd", "alt"}, "T", function() hs.eventtap.keyStrokes("#:~:text=") end)
hs.hotkey.bind({"cmd", "alt"}, "L", function() hs.execute("bb-logseq-convert --clear-anybar", true) end)
-- Hammerspoon bits from https://github.com/jasonrudolph/keyboard
require('keyboard')
|
--GPU: Colors palettes.
--luacheck: push ignore 211
local Config, GPU, yGPU, GPUKit, DevKit = ...
--luacheck: pop
local PaletteKit = GPUKit.Palette
local SharedKit = GPUKit.Shared
local RenderKit = GPUKit.Render
local GifKit = GPUKit.Gif
--==Kits Constants==--
local Verify = SharedKit.Verify
--==Localized Lua Library==--
local mathFloor = math.floor
--==Local Variables==--
--The colorset (PICO-8 Palette by default)
local _ColorSet = Config._ColorSet or {
{0,0,0,255}, --Black 1
{28,43,83,255}, --Dark Blue 2
{127,36,84,255}, --Dark Red 3
{0,135,81,255}, --Dark Green 4
{171,82,54,255}, --Brown 5
{96,88,79,255}, --Dark Gray 6
{195,195,198,255}, --Gray 7
{255,241,233,255}, --White 8
{237,27,81,255}, --Red 9
{250,162,27,255}, --Orange 10
{247,236,47,255}, --Yellow 11
{93,187,77,255}, --Green 12
{81,166,220,255}, --Blue 13
{131,118,156,255}, --Purple 14
{241,118,166,255}, --Pink 15
{252,204,171,255} --Human Skin 16
} --The colorset of the gpu
local _DefaultColorSet = {} --The default palette for the operating system.
for k,v in ipairs(_ColorSet) do
_ColorSet[k-1] = v
_DefaultColorSet[k-1] = v
end
_ColorSet[16] = nil
--==Helper Functions==--
local function _GetColor(c) return _ColorSet[c or 0] or _ColorSet[0] end --Get the (rgba) table of a color id.
local _ColorSetLookup = {}
for k,v in ipairs(_ColorSet) do _ColorSetLookup[table.concat(v)] = k end
local function _GetColorID(...) --Get the color id by the (rgba) table.
local col = {...}
if col[4] == 0 then return 0 end
return _ColorSetLookup[table.concat(col)] or 0
end
--==Shaders Palettes==--
local _DrawPalette = {} --The palette mapping for all drawing opereations except image:draw (p = 1).
local _ImagePalette = {} --The palette mapping for image:draw opereations (p = 2).
local _ImageTransparent = {} --The transparent colors palette, 1 for solid, 0 for transparent.
local _DisplayPalette = {} --The final display shader palette, converts the red pixel values to a palette color.
--Build the default palettes.
for i=1,16 do
_ImageTransparent[i] = (i==1 and 0 or 1) --Black is transparent by default.
_DrawPalette[i] = i-1
_ImagePalette[i] = i-1
_DisplayPalette[i] = _ColorSet[i-1]
end
_DisplayPalette[17] = {0,0,0,0} --A bug in unpack ???
_DrawPalette[17] = 0
_ImagePalette[17] = 0
_ImageTransparent[17] = 0
--==Palettes API==--
function GPU.colorPalette(id,r,g,b)
if not (id or r or g or b) then --Reset
for i=0,15 do
r,g,b = unpack(_DefaultColorSet[i])
_ColorSet[i] = {r,g,b,255}
_DisplayPalette[i+1] = _ColorSet[i]
end
RenderKit.DisplayShader:send('palette', unpack(_DisplayPalette)) --Upload the new colorset.
RenderKit.ShouldDraw = true
GifKit.PChanged = true
return
end
id = Verify(id,"Color ID","number")
if not _ColorSet[id] then return error("Color ID out of range ("..id..") Must be [0,15]") end
if r or g or b then
r,g,b = r or _ColorSet[id][1], g or _ColorSet[id][2], b or _ColorSet[id][3]
r = Verify(r,"Red value","number")
g = Verify(g,"Green value","number")
b = Verify(b,"Blue value","number")
if r < 0 or r > 255 then return error("Red value out of range ("..r..") Must be [0,255]") end
if g < 0 or g > 255 then return error("Green value out of range ("..g..") Must be [0,255]") end
if b < 0 or b > 255 then return error("Blue value out of range ("..b..") Must be [0,255]") end
_ColorSet[id] = {r,g,b,255}
_DisplayPalette[id+1] = _ColorSet[id]
RenderKit.DisplayShader:send('palette', unpack(_DisplayPalette)) --Upload the new colorset.
RenderKit.ShouldDraw = true
GifKit.PChanged = true
else
return unpack(_ColorSet[id])
end
end
--Call with color id to set the active color.
--Call with no args to get the current acive color id.
function GPU.color(id)
if id then
id = Verify(id,"The color id","number")
if id > 15 or id < 0 then return error("The color id is out of range ("..id..") Must be [0,15]") end --Error
love.graphics.setColor(id/255,0,0,1) --Set the active color.
else
return mathFloor(love.graphics.getColor()*255) --Return the current color.
end
end
--Map pallete colors
function GPU.pal(c0,c1,p)
local drawchange = false --Has any changes been made to the draw palette (p=1).
local imagechange = false --Has any changes been made to the image:draw palette (p=2).
--Error check all the arguments.
if c0 then c0 = Verify(c0, "C0","number",true) end
if c1 then c1 = Verify(c1, "C1","number",true) end
if p then p = Verify(p, "P","number",true) end
if c0 and (c0 < 0 or c0 > 15) then return error("C0 is out of range ("..c0..") expected [0,15]") end
if c1 and (c1 < 0 or c1 > 15) then return error("C1 is out of range ("..c1..") expected [0,15]") end
if p and (p < 0 or p > 1) then return error("P is out of range ("..p..") expected [0,1]") end
--Reset the palettes.
if (not c0) and (not c1) then
for i=1, 16 do
if _DrawPalette[i] ~= i-1 and ((not p) or p == 0) then
drawchange = true
_DrawPalette[i] = i-1
end
if _ImagePalette[i] ~= i-1 and ((not p) or p > 0) then
imagechange = true
_ImagePalette[i] = i-1
end
end
--Reset a specific color
elseif not(c1) then
if ((not p) or p == 0) and _DrawPalette[c0+1] ~= c0 then
drawchange = true
_DrawPalette[c0+1] = c0
end
if ((not p) or p > 0) and _ImagePalette[c0+1] ~= c0 then
imagechange = true
_ImagePalette[c0+1] = c0
end
--Modify the palette
elseif c0 and c1 then
if ((not p) or p == 0) and _DrawPalette[c0+1] ~= c1 then
drawchange = true
_DrawPalette[c0+1] = c1
end
if ((not p) or p > 0) and _ImagePalette[c0+1] ~= c1 then
imagechange = true
_ImagePalette[c0+1] = c1
end
end
--If changes has been made then upload the data to the shaders.
if drawchange then RenderKit.DrawShader:send('palette',unpack(_DrawPalette)) end
if imagechange then RenderKit.ImageShader:send('palette',unpack(_ImagePalette)) end
end
function GPU.palt(c,t)
local changed = false
if c then
c = Verify(c,"Color","number")
if (c < 0 or c > 15) then return error("Color out of range ("..c..") expected [0,15]") end
if _ImageTransparent[c+1] == (t and 1 or 0) then
_ImageTransparent[c+1] = (t and 0 or 1)
changed = true
end
else
for i=2,16 do
if _ImageTransparent[i] == 0 then
changed = true
_ImageTransparent[i] = 1
end
end
if _ImageTransparent[1] == 1 then
changed = true
_ImageTransparent[1] = 0
end
end
if changed then RenderKit.ImageShader:send('transparent', unpack(_ImageTransparent)) end
end
--==Palettes Stacks==--
local ColorStack = {} --The colors stack (pushColor,popColor)
local PaletteStack = {} --The palette stack (pushPalette,popPalette)
--Push the current active color to the ColorStack.
function GPU.pushColor()
table.insert(ColorStack,GPU.color()) --Add the active color id to the stack.
end
--Pop the last color from the ColorStack and set it to the active color.
function GPU.popColor()
if #ColorStack == 0 then return error("No more colors to pop.") end --Error
GPU.color(ColorStack[#ColorStack]) --Set the last color in the stack to be the active color.
table.remove(ColorStack,#ColorStack) --Remove the last color in the stack.
end
function GPU.pushPalette()
local pal = {}
pal.draw = {}
pal.img = {}
pal.trans = {}
for i=1, 16 do
table.insert(pal.draw,_DrawPalette[i])
table.insert(pal.img,_ImagePalette[i])
table.insert(pal.trans,_ImageTransparent[i])
end
table.insert(PaletteStack,pal)
end
function GPU.popPalette()
if #PaletteStack == 0 then return error("No more palettes to pop.") end --Error
local pal = PaletteStack[#PaletteStack]
local drawchange, imgchange, transchange = false,false,false
for i=1,16 do
if _DrawPalette[i] ~= pal.draw[i] then
drawchange = true
_DrawPalette[i] = pal.draw[i]
end
if _ImagePalette[i] ~= pal.img[i] then
imgchange = true
_ImagePalette[i] = pal.img[i]
end
if _ImageTransparent[i] ~= pal.trans[i] then
transchange = true
_ImageTransparent[i] = pal.trans[i]
end
end
if drawchange then RenderKit.DrawShader:send('palette',unpack(_DrawPalette)) end
if imgchange then RenderKit.ImageShader:send('palette',unpack(_ImagePalette)) end
if transchange then RenderKit.ImageShader:send('transparent', unpack(_ImageTransparent)) end
table.remove(PaletteStack,#PaletteStack)
end
--==GPUKit Exports==--
PaletteKit.ColorSet = _ColorSet
PaletteKit.DrawPalette = _DrawPalette
PaletteKit.ImagePalette = _ImagePalette
PaletteKit.ImageTransparent = _ImageTransparent
PaletteKit.DisplayPalette = _DisplayPalette
PaletteKit.GetColor = _GetColor
PaletteKit.GetColorID= _GetColorID
|
local handler = {}
local mt = { __index = handler }
function handler.new ()
return setmetatable ({}, mt)
end
function handler:init ()
end
return handler
|
local shipAction = require( "src.objects.ship" )
local composer = require( "composer" )
local record = require( "src.model.record" )
local particleDesigner = require( "src.util.particleDesigner" )
local Event = {}
function playExplosion( application, obj )
local explosionEmitter = particleDesigner.newEmitter( "assets/emitters/explosion.pex", "assets/emitters/texture.png" )
explosionEmitter.x = obj.x
explosionEmitter.y = obj.y
timer.performWithDelay( 500, function() explosionEmitter:stop() end )
if ( not audio.isChannelPlaying( 3 ) ) then
audio.play( application.soundTable.enemyExplosion, { channel=3 } )
elseif ( not audio.isChannelPlaying( 4 ) ) then
audio.play( application.soundTable.enemyExplosion, { channel=4 } )
elseif ( not audio.isChannelPlaying( 5 ) ) then
audio.play( application.soundTable.enemyExplosion, { channel=5 } )
end
end
function Event.onCollision( application )
return function( event )
if ( event.phase == "began" ) then
local obj1 = event.object1
local obj2 = event.object2
if ( ( obj1.myName == "laser" and obj2.myName == "easyEnemie" ) or
( obj1.myName == "easyEnemie" and obj2.myName == "laser") )
then
if ( obj1.myName == "easyEnemie" ) then
playExplosion( application, obj1 )
else
playExplosion( application, obj2 )
end
display.remove( obj1 )
display.remove( obj2 )
for i = #application.enemiesTable, 1, -1 do
if ( application.enemiesTable[i] == obj1 or application.enemiesTable[i] == obj2 ) then
table.remove( application.enemiesTable, i )
break
end
end
for i = #application.lasersTable, 1, -1 do
if ( application.lasersTable[i] == obj1 or application.lasersTable[i] == obj2 ) then
table.remove( application.lasersTable, i )
break
end
end
application.score = application.score + 100
application.scoreText.text = "Score: " .. application.score
elseif ( ( obj1.myName == "ship" and obj2.myName == "easyEnemie" ) or
( obj1.myName == "easyEnemie" and obj2.myName == "ship" ) )
then
if ( application.died == false ) then
application.died = true
if ( obj1.myName == "ship" ) then
playExplosion( application, obj1 )
else
playExplosion( application, obj2 )
end
application.lives = application.lives - 1
application.livesText.text = "Lives: " .. application.lives
application.firstTurbineEmitter:stop()
application.secondTurbineEmitter:stop()
if ( application.lives <= 0 ) then
record.insert( application.score )
record.save()
composer.gotoScene( "src.scenes.welcome" )
application.died = false
else
for i = #application.enemiesTable, 1, -1 do
if ( application.enemiesTable[i] == obj1 or application.enemiesTable[i] == obj2 ) then
playExplosion( application, application.enemiesTable[i] )
display.remove( application.enemiesTable[i] )
table.remove( application.enemiesTable, i )
break
end
end
application.ship.alpha = 0
timer.pause( application.laserLoopTimer )
timer.performWithDelay( 1000, shipAction.restore( application ) )
end
end
end
end
end
end
return Event
|
-- centralized input dohikey
-- berezaa
-- TO ADD AN ACTION TO KEYBIND:
-- network:invoke("addInputAction", UNIQUE_ACTION_NAME, FUNCTION_TO_CALL, DEFAULT_KEYBIND)
-- Note: for DEFAULT_KEYBIND, use a shortcut from module.shortcuts, not the Enum.KeyCode.Name
local USI = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local module = {}
local keybinds = {}
local inputObjects = {}
local actions = {}
module.actions = actions
local gameUi = script.Parent.gameUI
local mode = script.Parent.mode
module.mode = mode
-- track all gui objects that belong to a specific (or multiple) platforms
local platformSpecificGuiObjects = {}
module.shortcuts = {
Unknown = "???";
-- Numbers
One = "1"; KeypadOne = "1"; Two = "2"; KeypadTwo = "2";
Three = "3"; KeypadThree = "3"; Four = "4"; KeypadFour = "4";
Five = "5"; KeypadFive = "5"; Six = "6"; KeypadSix = "6";
Seven = "7"; KeypadSeven = "7"; Eight = "8"; KeypadEight = "8";
Nine = "9"; KeypadNine = "9"; Zero = "0"; KeypadZero = "0";
-- Everything else
Backspace = "BkS"; Clear = "Clr"; Return = "Rtn"; Hash = "#"; Dollar = "$"; Percent = "%";
Ampersand = "&"; Quote = "\""; LeftParenthesis = "("; RightParenthesis = ")"; Asterisk = "*"; Plus = "+";
Comma = ","; Minus = "-"; Period = "."; Slash = "/"; Colon = ":"; Semicolon = ";";
LessThan = "<"; GreaterThan = ">"; Question = "?"; At = "@"; LeftBracket = "["; RightBracket = "]";
Caret = "^"; Underscore = "_"; Backquote = "`"; LeftCurly = "{"; RightCurly = "}"; Pipe = "|";
Tilde = "~"; Delete = "Del"; Insert = "Ins"; Home = "Hm"; PageUp = "PgUp"; PageDown = "PgDn";
NumLock = "NmLk"; CapsLock = "CpLk"; ScrollLock = "ScLk"; RightShift = "Rshft"; LeftShift = "Lshft"; RightControl = "Rctrl";
LeftControl = "Lctrl"; RightAlt = "Ralt"; LeftAlt = "Lalt"; RightMeta = "Rmta"; LeftMeta = "Lmta"; RightSuper = "Rspr";
LeftSuper = "Lspr"; Break = "Brk"; Power = "Pwr";
}
local shortcuts = module.shortcuts
local setupComplete
local settings
local function preferencesUpdated()
if setupComplete then
for _, inputObject in pairs(inputObjects) do
local actionName = inputObject.Name
local action = actions[actionName]
if inputObject and inputObject:IsA("GuiObject") and inputObject:FindFirstChild("keyCode") then
if action and action.bindedTo then
inputObject.keyCode.Text = action.bindedTo
else
inputObject.keyCode.Text = " "
end
end
end
if settings then
settings.refreshKeybinds()
end
end
end
function module.addAction(name, target, default, priority)
priority = priority or 5
local action = {["target"] = target; ["default"] = default; ["priority"] = priority;}
-- check for an existing binding
for input,actionName in pairs(keybinds) do
if name == actionName then
action["bindedTo"] = input
action["priority"] = priority
-- check for an inputObject
preferencesUpdated()
break
end
end
actions[name] = action
end
local add = module.addAction
local function addInputObject(object)
if object:IsA("GuiObject") and object:IsDescendantOf(game.Players.LocalPlayer) then
local actionName = object.Parent.Name
object.Name = actionName
if object:IsA("ImageLabel") or object:IsA("ImageButton") then
local colorValue = Instance.new("Color3Value")
colorValue.Name = "originalColor"
colorValue.Value = object.ImageColor3
colorValue.Parent = object
end
table.insert(inputObjects,object)
--inputObjects[actionName] = object
-- check for an existing action
local action = actions[actionName]
if object:FindFirstChild("keyCode") then
if action and action.bindedTo then
object.keyCode.Text = action.bindedTo
else
object.keyCode.Text = " "
end
end
end
end
for _, object in pairs(game.CollectionService:GetTagged("inputObject")) do
addInputObject(object)
end
game.CollectionService:GetInstanceAddedSignal("inputObject"):connect(addInputObject)
local network
spawn(function()
local modules = require(game.ReplicatedStorage:WaitForChild("modules"))
network = modules.load("network")
network:create("addInputAction","BindableFunction","OnInvoke",add)
end)
module.menuButtons = {}
for _, button in pairs(gameUi.right.buttons:GetChildren()) do
if button:IsA("GuiButton") then
module.menuButtons[button.Name] = button
end
end
-- make all buttons play a cute click sound
local function buttonSetup(button)
if button:IsA("GuiButton") then
button.MouseButton1Click:connect(function()
local clickSound = Instance.new("Sound")
clickSound.Name = "clickSound"
clickSound.SoundId = "rbxassetid://997701190"
clickSound.Parent = button
clickSound.Volume = 0.1
clickSound:Play()
game.Debris:AddItem(clickSound,3)
end)
end
end
for _, guiButton in pairs(gameUi:GetDescendants()) do
buttonSetup(guiButton)
end
gameUi.DescendantAdded:connect(function(guiButton)
buttonSetup(guiButton)
end)
local currentFocusFrame
-- do something cool
function module.setCurrentFocusFrame(focusFrame)
if currentFocusFrame and currentFocusFrame ~= focusFrame then
currentFocusFrame.Visible = false
end
currentFocusFrame = focusFrame
end
local function updateModeDisplay()
end
module.menuScale = 1
local buttonsFrame = gameUi.right.buttons
function module.init(Modules)
local tween = Modules.tween
local control = Modules.control
local network = Modules.network
local currentlySelectedButtonTooltip
local function processGuiObject(guiObject)
if guiObject:IsA("GuiObject") then
if (guiObject:FindFirstChild("xbox") or guiObject:FindFirstChild("pc") or guiObject:FindFirstChild("mobile")) then
table.insert(platformSpecificGuiObjects, guiObject)
end
if guiObject:FindFirstChild("bindable") then
guiObject.SelectionGained:connect(function()
Modules.hotbarHandler.showSelectionPrompt(guiObject)
end)
guiObject.SelectionLost:connect(function()
Modules.hotbarHandler.hideSelectionPrompt(guiObject)
end)
end
-- "populateItemHoverFrameWithTextData"
if guiObject:FindFirstChild("tooltip") then
guiObject.MouseEnter:connect(function()
currentlySelectedButtonTooltip = guiObject
-- if guiObject.Active then
network:invoke("populateItemHoverFrameWithTextData", {text = guiObject.tooltip.Value; source = guiObject})
-- end
end)
guiObject.MouseLeave:connect(function()
if currentlySelectedButtonTooltip == guiObject then
currentlySelectedButtonTooltip = nil
end
network:invoke("populateItemHoverFrameWithTextData", {source = guiObject})
end)
guiObject.tooltip.Changed:connect(function()
if currentlySelectedButtonTooltip == guiObject then
network:invoke("populateItemHoverFrameWithTextData", {text = guiObject.tooltip.Value; source = guiObject})
end
end)
end
if guiObject:IsA("ImageButton") and (guiObject.Parent == buttonsFrame or guiObject.Image == "rbxassetid://29202694692" or guiObject.Image == "rbxassetid://2920343923" or guiObject.Image == "rbxassetid://3437374574shadow" or guiObject.Image == "rbxassetid://3437374574" or guiObject.Image == "rbxassetid://3437766345" ) then
local function selectionGained()
if guiObject.Active then
if guiObject.Parent == buttonsFrame then
-- tween(guiObject.icon.UIScale, {"Scale"}, 1.2, 0.3)
-- tween(guiObject.icon, {"ImageTransparency"}, 0, 0.3)
else
--[[
local selection = guiObject:FindFirstChild("selectionGlow")
if selection == nil then
if guiObject.Image == "rbxassetid://3437374574shadow" or guiObject.Image == "rbxassetid://3437766345" then
selection = script.selectionGlow_new:Clone()
selection.Name = "selectionGlow"
else
selection = script.selectionGlow:Clone()
end
selection.Parent = guiObject
if guiObject.Parent == buttonsFrame then
selection.ImageColor3 = guiObject.icon.ImageColor3
end
end
tween(selection, {"ImageTransparency"}, 0.45, 0.3)
]]
end
end
end
local function selectionLost()
if guiObject.Parent == buttonsFrame then
-- tween(guiObject.icon.UIScale, {"Scale"}, 1, 0.3)
-- tween(guiObject.icon, {"ImageTransparency"}, 1, 0.3)
else
local selection = guiObject:FindFirstChild("selectionGlow")
if selection then
if guiObject.Image == "rbxassetid://3437766345" or "rbxassetid://3445513431" then
tween(selection, {"ImageTransparency"}, 1, 0)
else
tween(selection, {"ImageTransparency"}, 1, 0.2)
end
end
end
end
local function activated(inputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 or inputObject.UserInputType == Enum.UserInputType.Gamepad1 or inputObject.UserInputType == Enum.UserInputType.Touch then
if guiObject.Active then
selectionLost()
if guiObject.Image == "rbxassetid://3437766345" then
guiObject.Image = "rbxassetid://3445513431"
local padding
local existingPadding = guiObject:FindFirstChild("UIPadding")
if existingPadding == nil then
padding = script.Parent.effects.clickPadding:Clone()
padding.Parent = guiObject
else
existingPadding.PaddingTop = UDim.new(existingPadding.PaddingTop.Scale, existingPadding.PaddingTop.Offset + 4)
end
repeat wait() until inputObject.UserInputState == Enum.UserInputState.Cancel or inputObject.UserInputState == Enum.UserInputState.End
wait(0.1)
guiObject.Image = "rbxassetid://3437766345"
if padding then
padding:Destroy()
elseif existingPadding then
existingPadding.PaddingTop = UDim.new(existingPadding.PaddingTop.Scale, existingPadding.PaddingTop.Offset - 4)
end
elseif guiObject.Image ~= "rbxassetid://3445513431" then
-- old buttons
local dark = guiObject:FindFirstChild("activationDark")
if dark == nil then
dark = script.Parent.effects.activationDark:Clone()
dark.Parent = guiObject
end
tween(dark, {"ImageTransparency"}, 0.5, 0.15)
spawn(function()
wait(0.2)
tween(dark, {"ImageTransparency"}, 1, 0.3)
end)
end
end
end
end
guiObject.MouseEnter:connect(selectionGained)
guiObject.SelectionGained:connect(selectionGained)
guiObject.MouseLeave:connect(selectionLost)
guiObject.SelectionLost:connect(selectionLost)
guiObject.InputBegan:connect(activated)
end
end
end
for _, guiObject in pairs(gameUi.Parent:GetDescendants()) do
processGuiObject(guiObject)
end
script.Parent.DescendantAdded:connect(processGuiObject)
local function setInputObjectsVisible(visible)
for _, inputObject in pairs(inputObjects) do
if inputObject then
inputObject.Visible = visible
end
end
end
-- display relevant information for that input mode
function updateModeDisplay()
setInputObjectsVisible(mode.Value == "pc")
for i,guiObject in pairs(platformSpecificGuiObjects) do
guiObject.Visible = guiObject:FindFirstChild(mode.Value) ~= nil
end
if mode.Value == "mobile" then
module.menuScale = 0.7
gameUi.leftBar.UIScale.Scale = 0.65
-- gameUi.leftBar.Position = UDim2.new(0, 5,1, -50)
gameUi.bottomRight.UIScale.Scale = 0.65
gameUi.bottomRight.Size = UDim2.new(1, 0,1.625, 0)
if gameUi.bottomRight.hotbarFrame.content:FindFirstChild("hotbarButton10") then
gameUi.bottomRight.hotbarFrame.content:FindFirstChild("hotbarButton10").Visible = false
end
if gameUi.bottomRight.hotbarFrame.decor:FindFirstChild("10") then
gameUi.bottomRight.hotbarFrame.decor:FindFirstChild("10").Visible = false
end
gameUi.bottomRight.AnchorPoint = Vector2.new(1,1)
gameUi.bottomRight.Position = UDim2.new(1,0,1,0)
else
module.menuScale = 1
gameUi.leftBar.UIScale.Scale = 1
gameUi.leftBar.Size = UDim2.new(0, 100,1, -250)
--- gameUi.leftBar.Position = UDim2.new(0, 5,1, -110)
-- gameUi.leftBar.Position = UDim2.new(0, 5,1, -200)
gameUi.bottomRight.UIScale.Scale = 1
gameUi.bottomRight.Size = UDim2.new(1, 0, 1, 0)
gameUi.bottomRight.AnchorPoint = Vector2.new(0.5,1)
gameUi.bottomRight.Position = UDim2.new(0.5,0,1,0)
gameUi.bottomRight.Size = UDim2.new(1, 0, 1, 0)
if gameUi.bottomRight.hotbarFrame.content:FindFirstChild("hotbarButton10") then
gameUi.bottomRight.hotbarFrame.content:FindFirstChild("hotbarButton10").Visible = true
end
if gameUi.bottomRight.hotbarFrame.decor:FindFirstChild("10") then
gameUi.bottomRight.hotbarFrame.decor:FindFirstChild("10").Visible = true
end
if mode.Value == "xbox" or game.GuiService:IsTenFootInterface() then
module.menuScale = 1.2
gameUi.bottomRight.UIScale.Scale = 1.2
end
end
network:fireServer("signal_inputChanged", mode.Value)
end
if USI.TouchEnabled and not USI.MouseEnabled then
mode.Value = "mobile"
end
mode.Changed:connect(updateModeDisplay)
updateModeDisplay()
-- old postInit
spawn(function()
local remapping = false
game.GuiService.AutoSelectGuiEnabled = false
game.GuiService.CoreGuiNavigationEnabled = false
local function changeKeybindAction(keybind, actionName)
-- Make sure the action is valid
local action = actions[actionName]
if action == nil then
return warn("Action",actionName,"not found")
end
if not setupComplete then
return warn("Input module not set up yet")
end
if remapping then
return false
end
remapping = true
-- Ask before overriding an existing action
local existingBindActionName = keybinds[keybind]
local existingAction
if existingBindActionName then
existingAction = actions[existingBindActionName]
if existingAction then
if not Modules.prompting_Fullscreen.prompt("This will override an existing action ("..existingBindActionName.."). Are you sure?") then
remapping = false
return false
end
end
end
-- Execute order 66
local success = network:invokeServer("playerRequestSetKeyAction",keybind,actionName)
if success then
local oldkeybind = action.bindedTo
if oldkeybind then
keybinds[oldkeybind] = nil
end
keybinds[keybind] = actionName
action.bindedTo = keybind
if existingAction then
existingAction.bindedTo = nil
end
preferencesUpdated()
remapping = false
return true
else
remapping = false
warn("Server rejected keybind change")
end
end
local function setup()
local userSettings = network:invoke("getCacheValueByNameTag", "userSettings")
keybinds = {}
if userSettings and userSettings.keybinds then
keybinds = userSettings.keybinds
end
for key,actionName in pairs(keybinds) do
local action = actions[actionName]
if action then
action.bindedTo = key
end
end
-- apply default keys (but don't override!)
for actionName,action in pairs(actions) do
local default = action.default
if default and action["bindedTo"] == nil and keybinds[default] == nil then
-- apply keybind (no need to ping the server)
keybinds[default] = actionName
action["bindedTo"] = default
end
end
setupComplete = true
preferencesUpdated()
updateModeDisplay()
end
--local hotbarBinds = {"1", "2", "Q", "E", "R", "G", "V", "3", "4", "5"}
-- add hard-coded actions
add("openEquipment",Modules.equipment.show,"Q",3)
add("openInventory",Modules.inventory.show,"E",3)
add("openAbilities",Modules.abilities.show,"R",3)
add("openSettings",Modules.settings.show,"G",3)
-- add("openQuestLog",Modules.questLog.open,"L",3)
-- add("openMonsterBook",Modules.monsterBook.open,"B",3)
-- add("openGuild",Modules.guild.open,"P",3)
add("interact",Modules.interaction.interact,"C",4)
-- add("cameraLock",function() network:invoke("toggleCameraLock") end, "Tab", 4)
add("emote1",function() network:invoke("playerRequest_performEmote", "dance") end, "N", 7)
add("emote2",function() network:invoke("playerRequest_performEmote", "sit") end, "M", 7)
add("swapWeapons", function()
if not network:invoke("getIsPlayerCastingAbility") then
network:fireServer("playerRequest_swapWeapons")
end
end, "`", 8)
--add("defaultPoint",function() network:invoke("playerRequest_performEmote", "point") end, "P", 7)
USI.InputChanged:connect(function(input, absorbed)
if input.UserInputType == Enum.UserInputType.Keyboard or input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.MouseButton2 then
mode.Value = "pc"
elseif input.UserInputType == Enum.UserInputType.Gamepad1 then
mode.Value = "xbox"
elseif input.UserInputType == Enum.UserInputType.Touch then
mode.Value = "mobile"
end
if mode.Value ~= "mobile" then
-- network:invoke("setMobileMovementDirection", nil)
network:fire("mobileMovementDirectionChanged", nil)
network:fire("mobileCameraRotationChanged", nil)
end
end)
--mobile stuff
local touchJoystick = gameUi:WaitForChild("touchJoystick")
touchJoystick.Visible = false
local touchJoystickActive = false
local touchJoystickDirection
local cameraMovementActive = false
USI.TouchStarted:connect(function(touch, processed)
if not processed then
local startPos = touch.Position
if startPos.x < 300 and startPos.y > workspace.CurrentCamera.ViewportSize.y * 0.6 then
if not touchJoystickActive then
touchJoystick.Position = UDim2.new(0, startPos.x, 0, startPos.y)
touchJoystickActive = true
touchJoystick.Visible = true
-- while the same finger is still down
while touch.UserInputState ~= Enum.UserInputState.End and touch.UserInputState ~= Enum.UserInputState.Cancel do
local pos = touch.Position
local difference = pos - startPos
control.doSprint(difference.magnitude > 80)
if difference.magnitude > 35 then
difference = difference.unit * 35
end
touchJoystick.stick.Position = UDim2.new(0.5, difference.X, 0.5, difference.Y)
-- network:invoke("setMobileMovementDirection", difference.unit)
network:fire("mobileMovementDirectionChanged", difference.unit)
RunService.RenderStepped:wait()
end
-- network:invoke("setMobileMovementDirection", Vector2.new())
network:fire("mobileMovementDirectionChanged", nil)
control.doSprint(false)
touchJoystickActive = false
touchJoystick.Visible = false
end
else
if not cameraMovementActive then
cameraMovementActive = true
while touch.UserInputState ~= Enum.UserInputState.End and touch.UserInputState ~= Enum.UserInputState.Cancel do
local pos = touch.Position
local difference = pos - startPos
network:fire("mobileCameraRotationChanged", difference * 0.3)
startPos = pos
RunService.RenderStepped:wait()
end
cameraMovementActive = false
network:fire("mobileCameraRotationChanged", Vector2.new())
end
end
end
end)
USI.InputEnded:connect(function(input, absorbed)
if input.KeyCode == Enum.KeyCode.ButtonL2 and Modules.hotbarHandler.focused then
Modules.hotbarHandler.releaseFocus(input)
end
end)
USI.InputBegan:connect(function(input, absorbed)
if input.UserInputType == Enum.UserInputType.Keyboard or input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.MouseButton2 then
mode.Value = "pc"
elseif input.UserInputType == Enum.UserInputType.Gamepad1 then
mode.Value = "xbox"
elseif input.UserInputType == Enum.UserInputType.Touch then
mode.Value = "mobile"
end
if not absorbed then
if mode.Value == "xbox" then
if Modules.hotbarHandler.focused then
Modules.hotbarHandler.releaseFocus(input)
else
if input.KeyCode == Enum.KeyCode.ButtonB then
if Modules.interaction.currentInteraction then
Modules.interaction.stopInteract()
else
Modules.focus.close()
end
game.GuiService.SelectedObject = nil
print("$ nil a")
elseif input.KeyCode == Enum.KeyCode.ButtonX then
if Modules.itemAcquistion.closestItem then
Modules.itemAcquistion.pickupInputGained(input)
else
Modules.interaction.interact()
end
elseif input.KeyCode == Enum.KeyCode.ButtonY then
if game.GuiService.SelectedObject and game.GuiService.SelectedObject:FindFirstChild("bindable") then
else
-- Modules.playerMenu.open()
end
elseif input.KeyCode == Enum.KeyCode.ButtonSelect then
Modules.settings.open()
-- elseif input.KeyCode == Enum.KeyCode.DPadRight then
-- Modules.skillBooks.open()
elseif input.KeyCode == Enum.KeyCode.ButtonL2 then
Modules.hotbarHandler.captureFocus()
end
end
elseif mode.Value == "pc" then
local key = shortcuts[input.KeyCode.Name] or input.KeyCode.Name
-- remapping active
local remapTarget = Modules.settings.remapTarget
if remapTarget then
local actionName = Modules.settings.remapTarget.Name
local action = actions[actionName]
if action then
local success = changeKeybindAction(key, actionName)
if success then
end
return false
end
end
local actionName = keybinds[key]
if actionName then
local action = actions[actionName]
if action and (not action.active) and type(action.target) == "function" then
action.active = true
-- cool visual effect
for i,inputObject in pairs(inputObjects) do
if inputObject.Name == actionName then
if inputObject and inputObject:IsA("ImageLabel") then
local color = Color3.fromRGB(0, 255, 255)
inputObject.ImageColor3 = color
if inputObject:FindFirstChild("keyCode") then
inputObject.keyCode.TextColor3 = color
end
end
end
end
action.target(input) -- pass the input object
wait()
action.active = false
wait(0.15)
-- reset visual effect
if not action.active then
for i,inputObject in pairs(inputObjects) do
if inputObject.Name == actionName then
if inputObject and inputObject:IsA("ImageLabel") then
local color = inputObject:FindFirstChild("originalColor") and inputObject.originalColor.Value or Color3.fromRGB(40, 40, 40)
inputObject.ImageColor3 = color
if inputObject:FindFirstChild("keyCode") then
inputObject.keyCode.TextColor3 = Color3.new(1,1,1)
end
end
end
end
end
end
end
end
end
end)
for i,button in pairs(buttonsFrame:GetChildren()) do
if button:IsA("GuiButton") then
button.MouseButton1Click:connect(function()
local action = actions[button.Name]
if action and action.target then
action.target()
end
end)
end
end
end)
end
return module
|
-- increments the score of players that touch CoinTrigger instances, destroys those instances when touched.
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Workspace = game:GetService("Workspace")
local lib = ReplicatedStorage:WaitForChild("lib")
local common = ReplicatedStorage:WaitForChild("common")
local client = script.Parent.Parent
local util = common:WaitForChild("util")
local RECS = require(lib:WaitForChild("RECS"))
local Components = require(common:WaitForChild("RecsComponents"))
local hitIsYou = require(util:WaitForChild("hitIsYou"))
local CoinSystem = RECS.System:extend("CoinSystem")
local COIN_SOUND_ID = 1453122289
function CoinSystem:coinTouched(coin, instance, hit)
if hitIsYou(hit) then
self.api:requestCoinCollect(coin.spawnPart)
instance:Destroy()
local Sound = self:getClientModule("Sound")
if Sound then
local pitch = 1 + (math.random()*0.2 - 0.1)
Sound:playSound(COIN_SOUND_ID,0.5,pitch,coin.spawnPart)
end
end
end
function CoinSystem:addCoin(instance,coin)
instance.Touched:Connect(function(hit)
self:coinTouched(coin, instance, hit)
end)
end
function CoinSystem:init()
self.maid.componentAdded =
self.core:getComponentAddedSignal(Components.Coin):Connect(
function(instance, coin)
self:addCoin(instance,coin)
end)
for instance, coin in self.core:components(Components.Coin) do
self:addCoin(instance,coin)
end
end
return CoinSystem
|
--------------------------------
-- @module EaseBounceInOut
-- @extend ActionEase
-- @parent_module cc
---@class cc.EaseBounceInOut:cc.ActionEase
local EaseBounceInOut = {}
cc.EaseBounceInOut = EaseBounceInOut
--------------------------------
---
---@param action cc.ActionInterval
---@return cc.EaseBounceInOut
function EaseBounceInOut:create(action)
end
--------------------------------
---
---@return cc.EaseBounceInOut
function EaseBounceInOut:clone()
end
--------------------------------
---
---@param time number
---@return cc.EaseBounceInOut
function EaseBounceInOut:update(time)
end
--------------------------------
---
---@return cc.ActionEase
function EaseBounceInOut:reverse()
end
--------------------------------
---
---@return cc.EaseBounceInOut
function EaseBounceInOut:EaseBounceInOut()
end
return nil
|
c.position = {x = 0, y = 0}
c.killable = {spawn_x = 0, spawn_y = 0, killed = false}
c.direction = {1}
c.size = {w = 0, h = 0}
c.color = {0, 0, 0}
c.sprite = {image = ""}
c.input = {
up = false,
left = false,
right = false,
respawn = false
}
c.physics = {
dx = 0,
dy = 0,
frc_x = 0.5,
frc_y = 0.3,
speed = 8,
grounded = false,
gravity = 10,
wall_x = 0 -- 0 is none, -1 is left, 1 is right
}
c.player = {}
c.checkpoint = {}
c.murderous = {}
c.light = {}
c.gold = {}
|
#!/usr/bin/env luajit
require 'ext'
local env = setmetatable({}, {__index=_G})
if setfenv then setfenv(1, env) else _ENV = env end
require 'symmath'.setup{env=env}
local MathJax = symmath.export.MathJax
symmath.tostring = MathJax
local printbr = MathJax.print
MathJax.header.title = 'hyperbolic gamma driver in ADM terms'
print(MathJax.header)
-- setup timer.
-- os.time() is second-resolution.
-- os.clock() has higher resolution, but counts time x # cores afaik
-- nope. looks like os.clock() matches gettimeofday() pretty closely
local timer = os.clock
local result, ffi = pcall(require, 'ffi')
if result and ffi then
require 'ffi.c.sys.time'
local tv = ffi.new'struct timeval[1]'
timer = function()
ffi.C.gettimeofday(tv, nil)
return tonumber(tv[0].tv_sec) + 1e-6 * tonumber(tv[0].tv_usec)
end
end
local startTime = timer()
local lastTime = startTime
local function printHeader(str)
local thisTime = timer()
io.stderr:write(' ... '..(thisTime-lastTime)..'s\n')
lastTime = thisTime
if str then
io.stderr:write(str)
printbr(str)
end
io.stderr:flush()
end
local spatialDim = 3
local B = var'B'
local K = var'K'
local W = var'W'
local alpha = var[[\alpha]]
local beta = var[[\beta]]
local gamma = var[[\gamma]]
local zeta = var[[\zeta]]
local eta = var[[\eta]]
local GammaBar = var[[\bar{\Gamma}]]
local gammaBar = var[[\bar{\gamma}]]
Tensor.metricVariable = gamma
local delta = Tensor:deltaSymbol()
printHeader'Jacobi identity:'
local Jacobi_identity = gamma'_,t':eq( gamma * gamma'^ij' * gamma'_ij,t')
printbr(Jacobi_identity)
printbr()
printHeader'useful identity:'
local dt_gamma_uu_from_gamma_uu_partial_gamma_lll = (gamma'_li' * gamma'^ij')'_,t':eq(0)
printbr(dt_gamma_uu_from_gamma_uu_partial_gamma_lll)
dt_gamma_uu_from_gamma_uu_partial_gamma_lll = dt_gamma_uu_from_gamma_uu_partial_gamma_lll()
printbr(dt_gamma_uu_from_gamma_uu_partial_gamma_lll)
dt_gamma_uu_from_gamma_uu_partial_gamma_lll = (dt_gamma_uu_from_gamma_uu_partial_gamma_lll * gamma'^lm')():factorDivision()
printbr(dt_gamma_uu_from_gamma_uu_partial_gamma_lll)
dt_gamma_uu_from_gamma_uu_partial_gamma_lll = dt_gamma_uu_from_gamma_uu_partial_gamma_lll:simplifyMetrics()
:reindex{im='mi'}
:solve(gamma'^ij_,t')
printbr(dt_gamma_uu_from_gamma_uu_partial_gamma_lll)
-- not the prettiest way to show that ...
printbr()
local dt_gammaBar_uu_from_gammaBar_uu_partial_gammaBar_lll = dt_gamma_uu_from_gamma_uu_partial_gamma_lll:replace(gamma, gammaBar)
printHeader'spatial metric evolution:'
local dt_gamma_ll_def = gamma'_ij,t':eq(
-2 * alpha * K'_ij'
+ gamma'_ij,k' * beta'^k'
+ gamma'_kj' * beta'^k_,i'
+ gamma'_ik' * beta'^k_,j'
)
printbr(dt_gamma_ll_def)
printbr()
printHeader'conformal factor:'
local W_def = W:eq( ( gammaBar / gamma ) ^ frac(1,6))
printbr(W_def)
printbr()
printHeader'conformal factor derivative:'
local partial_W_l_def = W_def'_,i'()
partial_W_l_def[2] = (
partial_W_l_def[2] / W_def[2] * W_def[1]
):simplifyAddMulDiv()
printbr(partial_W_l_def)
printbr()
printHeader'conformal factor evolution:'
local dt_W_def = partial_W_l_def:reindex{i='t'}
:replace(gammaBar'_,t', 0)
:substIndex(Jacobi_identity)
dt_W_def = dt_W_def:simplifyAddMulDiv()
printbr(dt_W_def)
dt_W_def = dt_W_def
:substIndex(dt_gamma_ll_def)
:simplifyMetrics()
:tidyIndexes()
printbr(dt_W_def)
printbr()
printHeader'conformal metric:'
local gammaBar_ll_def = gammaBar'_ij':eq( W^2 * gamma'_ij' )
printbr(gammaBar_ll_def)
printbr()
printHeader'conformal metric derivative:'
local dgammaBar_lll_def = (gammaBar_ll_def'_,k')()
printbr(dgammaBar_lll_def)
printbr()
printHeader'conformal metric inverse:'
local gammaBar_uu_def = gammaBar'^ij':eq( W^(-2) * gamma'^ij' )
printbr(gammaBar_uu_def)
printbr()
printHeader'conformal connection:'
local GammaBar_ull_def = GammaBar'^i_jk':eq( frac(1,2) * gammaBar'^im' * (gammaBar'_mj,k' + gammaBar'_mk,j' - gammaBar'_jk,m') )
printbr(GammaBar_ull_def)
GammaBar_ull_def = GammaBar_ull_def
:substIndex(dgammaBar_lll_def)
:substIndex(gammaBar_uu_def)
:simplifyMetrics()
:simplifyAddMulDiv()
printbr(GammaBar_ull_def)
printbr()
printHeader'conformal connection trace:'
local GammaBar_u_def = GammaBar'^i':eq(GammaBar'^i_jk' * gammaBar'^jk')
printbr(GammaBar_u_def)
GammaBar_u_def = GammaBar_u_def
:substIndex(GammaBar_ull_def)
:substIndex(gammaBar_uu_def)
:simplifyMetrics()
:replace(delta'^k_k', spatialDim)
:tidyIndexes()
:symmetrizeIndexes(gamma, {1,2})
GammaBar_u_def = GammaBar_u_def:simplifyAddMulDiv()
printbr(GammaBar_u_def)
printbr()
printHeader'conformal connection trace evolution:'
local dt_GammaBar_u_def = GammaBar_u_def'_,t':simplifyAddMulDiv()
printbr(dt_GammaBar_u_def)
dt_GammaBar_u_def = dt_GammaBar_u_def
:substIndex(dt_gamma_uu_from_gamma_uu_partial_gamma_lll)
printbr(dt_GammaBar_u_def)
dt_GammaBar_u_def = dt_GammaBar_u_def
:replace(W'_,at', W'_,t''_,a')
--:subst(dt_W_def) -- has two 'a' indexes
--:substIndex(dt_W_def) -- has two trace(K) terms
:subst(dt_W_def:reindex{abc='fde'})
printbr(dt_GammaBar_u_def)
dt_GammaBar_u_def = dt_GammaBar_u_def:simplifyAddMulDiv()
printbr(dt_GammaBar_u_def)
dt_GammaBar_u_def = dt_GammaBar_u_def
:tidyIndexes()
printbr(dt_GammaBar_u_def)
dt_GammaBar_u_def = dt_GammaBar_u_def
:symmetrizeIndexes(gamma, {1,2})
dt_GammaBar_u_def = dt_GammaBar_u_def:simplifyAddMulDiv()
printbr(dt_GammaBar_u_def)
dt_GammaBar_u_def = dt_GammaBar_u_def
:replace(gamma'_ab,ct', gamma'_ab,t''_,c')
:subst(dt_gamma_ll_def:reindex{ij='ab'})
:replace(gamma'_bc,at', gamma'_bc,t''_,a')
:subst(dt_gamma_ll_def:reindex{ij='bc'})
--:subst(dt_gamma_ll_def:reindex{ij='bc'})
:subst(dt_gamma_ll_def:reindex{ij='cd'})
:subst(dt_gamma_ll_def:reindex{ij='bd'})
dt_GammaBar_u_def = dt_GammaBar_u_def:simplifyAddMulDiv()
:subst(
dt_gammaBar_uu_from_gammaBar_uu_partial_gammaBar_lll:reindex{ijt='cdb'}
)
dt_GammaBar_u_def = dt_GammaBar_u_def:simplifyAddMulDiv()
printbr(dt_GammaBar_u_def)
dt_GammaBar_u_def = dt_GammaBar_u_def
:simplifyMetrics()
:tidyIndexes()
:symmetrizeIndexes(beta, {2,3})
:symmetrizeIndexes(gamma, {3,4})
dt_GammaBar_u_def = dt_GammaBar_u_def:simplifyAddMulDiv()
printbr(dt_GammaBar_u_def)
dt_GammaBar_u_def = dt_GammaBar_u_def
:splitOffDerivIndexes()
:replace( K'^a_a', gamma'^mn' * K'_mn')
:replace( K'^b_b', gamma'^mn' * K'_mn')
dt_GammaBar_u_def = dt_GammaBar_u_def:simplifyAddMulDiv()
:simplifyMetrics()
:tidyIndexes()
:symmetrizeIndexes(gamma, {1,2})
dt_GammaBar_u_def = dt_GammaBar_u_def:simplifyAddMulDiv()
printbr(dt_GammaBar_u_def)
printbr()
printHeader'B evolution:'
local dt_B_u_def = (B'^i_,t'):eq(
-- zeta == 3/4 / alpha^2 ... so get rid of the alpha^2 ...
alpha^2 * zeta * (
GammaBar'^i_,t'
- beta'^j' * GammaBar'^i_,j'
)
-- eta = 1?
- eta * B'^i'
- beta'^j' * B'^i_,j'
)
printbr(dt_B_u_def)
dt_B_u_def = dt_B_u_def
:subst(dt_GammaBar_u_def)
:splitOffDerivIndexes()
:substIndex(GammaBar_u_def)
printbr(dt_B_u_def)
dt_B_u_def = dt_B_u_def:simplifyAddMulDiv()
printbr(dt_B_u_def)
printbr()
-- DONE
printHeader()
io.stderr:write('TOTAL: '..(timer() - startTime)..'\n')
io.stderr:flush()
print(MathJax.footer)
|
checkLocation_isInHouse = function(player)
if not players[player] then return false end
local id = tonumber(players[player].houseData.houseid)
local house = tonumber(players[player].place:sub(7))
if id == house then
return true
end
return false
end
|
-- Citizen.CreateThread(function()
-- Citizen.Wait(20000)
-- local resnamne = GetCurrentResourceName()
-- local current_version = GetResourceMetadata(resnamne, 'version', 0)
-- PerformHttpRequest('https://raw.githubusercontent.com/Luminous-Roleplay/versionsScripts/master/'..resnamne..'.txt',function(error, result, headers)
-- local new_version = result:sub(1, -2)
-- if tostring(new_version) ~= tostring(current_version) then
-- print('^2['..resnamne..'] - New Update Available.^0\nCurrent Version: ^5'..current_version..'^0.\nNew Version: ^5'..new_version..'^0.')
-- end
-- end,'GET')
-- end)
|
require 'plug-config.gitsigns.settings'
|
--[[
ComponentLookup
===============
The backbone of the ComponentDiscovery Script, which handles the actual
discovery of Components.
Usage
-----
local lookup = ComponentLookup.new()
lookup:Propagate(workspace)
local warps = lookup:GetComponents("Warp")
for _, warpModel in ipairs(warps) do
print(warpModel:GetFullName())
end
Constructors
------------
ComponentLookup.new()
This doesn't do much on its own. You need to call the Propagate() method to
gather the Components.
Properties
----------
Components (table)
This is a flat list of every Component in the game.
Generally you won't need to access this, instead use the GroupedComponents
list.
This is used when you don't need to worry about the ComponentType of a
Component and you just need to look through the list of all of them.
GroupedComponents (table)
A grouped list of Components.
Instead of referencing this directly, use GetComponents().
Each type of Component is grouped in a sub-table, so if you want to access
all the Warp Components you would use:
local lookup = ComponentLookup.new()
lookup:Propagate()
local warps = lookup.GroupedComponents["Warp"]
Methods
-------
Propagate(Instance parent)
This method collects all of the Components in the game.
After calling this, use GetComponents() to get the Components you want to
work with.
This method handles the initial discovery of Components by propagating the
Components and GroupedComponents properties.
GetComponents(string componentType)
Gets all of the Components that have a ComponentType matching
`componentType`.
--]]
local replicatedStorage = game:GetService("ReplicatedStorage")
local find = require(replicatedStorage.Helpers.Find)
-- Used when grouping Components together to create the ComponentType sub-tables.
local function getSubTable(t, name)
if not t[name] then
t[name] = {}
end
return t[name]
end
-- Gets the ComponentType of an object (if it exists).
--
-- This gets used to simply get the ComponentType, along with being used with
-- `find()` to locate all of the Components in the game.
--
-- It also makes sure any ComponentType it comes across has been set properly.
local function getComponentType(object)
local componentType = object:FindFirstChild("ComponentType")
if componentType and componentType:IsA("StringValue") then
assert(componentType.Value ~= "", string.format("Value for '%s' not set",
componentType:GetFullName()))
return componentType.Value
end
end
-- Allows Components to be disabled.
--
-- If there's a BoolValue named "Disabled" set to true inside of a Component,
-- the Component will be excluded from the final list.
--
-- This allows us to develop new Components without them being picked up
-- immediately so we don't go and break everything.
local function isDisabled(object)
local disabled = object:FindFirstChild("Disabled")
if disabled and disabled:IsA("BoolValue") then
return disabled.Value
end
end
-- Sorts all of the components into lists based off their ComponentType.
--
-- This keeps everything nice and organized, as if you have a ton of
-- "TriggerWarp" and "ActionWarp" Components, they'll each get their own table.
local function sortComponents(components)
local sortedComponents = {}
for _, component in ipairs(components) do
local group = getSubTable(sortedComponents, getComponentType(component))
table.insert(group, component)
end
return sortedComponents
end
--------------------------------------------------------------------------------
local ComponentLookup = {}
ComponentLookup.__index = ComponentLookup
function ComponentLookup.new()
local self = {}
setmetatable(self, ComponentLookup)
self.Components = {}
self.GroupedComponentss = {}
return self
end
function ComponentLookup:Propagate(parent)
local components = find(parent, function(child)
return getComponentType(child) and not isDisabled(child)
end)
self.Components = components
self.GroupedComponents = sortComponents(self.Components)
end
function ComponentLookup:GetComponents(componentType)
return self.GroupedComponents[componentType]
end
return ComponentLookup
|
--[[
Copyright 2012 The lev Authors. All Rights Reserved.
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.
--]]
local exports = {}
exports['lev.fs:\tfs_readdir'] = function(test)
local table = require('table')
local fs = lev.fs
local work_dir = '_test_work'
local file1 = work_dir .. '/' .. 'file1.txt'
local dir1 = work_dir .. '/' .. 'dir1'
assert(not fs.exists(work_dir))
fs.mkdir(work_dir)
local err, fd = fs.open(file1, 'w')
fs.close(fd)
fs.mkdir(dir1)
local entries
err, entries = fs.readdir(work_dir)
test.is_nil(err)
test.is_array(entries)
test.equal(#entries, 2)
table.sort(entries)
test.equal(entries, {'dir1', 'file1.txt'})
fs.unlink(file1)
fs.rmdir(dir1)
fs.rmdir(work_dir)
test.done()
end
return exports
|
local Notebook = require("sebaestschjin-tts.Notebook")
local StringUtil = require("sebaestschjin-tts.StringUtil")
local Task = require("gloomhaven-campaign-manager.Task")
local Options = {}
local OptionsNotebook = "Options"
---@type boolean
Options.keepDiscardedItems = true
---@type boolean
Options.loadExtendedBattleGoals = false
---@type gh_Game_Difficulty
Options.difficulty = "Normal"
local function setupHandler()
Task.registerLoad(Options.loadAll, Task.Event.Loaded.Start)
Task.registerSave(Options.saveAll, Task.Event.Saved.Party)
end
---@param savefile gh_Savefile
function Options.loadAll(savefile)
if StringUtil.isNotEmpty(savefile.options.fantasySetup) then
Notebook.setContent("Previous " .. OptionsNotebook, --[[---@not nil]] savefile.options.fantasySetup)
end
if savefile.options.keepDiscardedCards ~= nil then
Options.keepDiscardedItems = --[[---@not nil]] savefile.options.keepDiscardedCards
else
Options.keepDiscardedItems = true
end
if savefile.options.loadExtendedBattleGoals ~= nil then
Options.loadExtendedBattleGoals = --[[---@not nil]] savefile.options.loadExtendedBattleGoals
else
Options.loadExtendedBattleGoals = false
end
Options.difficulty = savefile.options.difficulty or "Normal"
Task.completeLoad(Task.Event.Loaded.Options, savefile)
end
---@param savefile gh_Savefile
function Options.saveAll(savefile)
for _, notes in ipairs(Notes.getNotebookTabs()) do
if notes.title == OptionsNotebook then
savefile.options.fantasySetup = notes.body
end
end
savefile.options.difficulty = Options.difficulty
savefile.options.keepDiscardedCards = Options.keepDiscardedItems
savefile.options.requirePerkFix = false
savefile.options.loadExtendedBattleGoals = Options.loadExtendedBattleGoals
Task.completeSave(Task.Event.Saved.Options, savefile)
end
setupHandler()
return Options
|
local fx = require("ingame/fx")
local emerald_fx = derived_class(fx)
local emerald_common = require("render/emerald_common")
local visual = require("resources/visual_common")
-- extra attributes:
-- number int number of the represented emerald to color the fx
-- note that you can still customize the animated sprite data,
-- as some will use the pick FX, others (start cinematic) will use the single star
function emerald_fx:init(number, position, anim_spr_data)
fx.init(self, position, anim_spr_data)
self.number = number
end
-- override
-- render the fx with color swap matching emerald number
function emerald_fx:render()
-- recolor emerald based on number (see emerald.draw)
emerald_common.set_color_palette(self.number)
self.anim_spr:render(self.position)
pal()
end
return emerald_fx
|
local math_utils = {}
--
-- Rotate a point around (0,0)
-- @param {number} x Point to rotate x
-- @param {number} y Point to rotate y
-- @param {number} angle
-- @returns {number, number} Rotated point
--
function math_utils.rotateO(x, y, angle)
local x3 = x * math.cos(angle) - y * math.sin(angle)
local y3 = x * math.sin(angle) + y * math.cos(angle)
return x3, y3
end
--
-- Rotate a point around another
-- @param {number} x Point to rotate x
-- @param {number} y Point to rotate y
-- @param {number} ox Origin point x
-- @param {number} oy Origin point y
-- @param {number} angle
-- @returns {number, number} Rotated point
--
function math_utils.rotate(x, y, ox, oy, angle)
local x1 = x - ox
local y1 = y - oy
local x2 = x1 * math.cos(angle) - y1 * math.sin(angle)
local y2 = x1 * math.sin(angle) + y1 * math.cos(angle)
return x2 + ox, y2 + oy
end
--
-- Return distance between two points
-- @param {number} x
-- @param {number} y
-- @param {number} x2
-- @param {number} y2
-- @returns {number} Distance between (x,y) and (x2,y2)
--
function math_utils.distance(x, y, x2, y2)
return math.sqrt(math.pow(x2 - x, 2) + math.pow(y2 - y, 2))
end
return math_utils
|
local state = require'completion.state'
local util = {}
function util.checkTriggerCharacter(line_to_cursor)
for _, ch in ipairs(state.triggerCharacters) do
local current_char = string.sub(line_to_cursor, #line_to_cursor - #ch + 1, #line_to_cursor)
if current_char == ch then return true end
end
return false
end
return util
|
local GMSettingView = BaseClass(UINode)
local ConfigGame = CS.UnityMMO.ConfigGame
function GMSettingView:Constructor( )
self.viewCfg = {
prefabPath = "Assets/AssetBundleRes/ui/gm/GMSettingView.prefab",
canvasName = "Normal",
isShowBackground = true,
}
self.model = GMModel:GetInstance()
end
function GMSettingView:OnLoad( )
local names = {
"item_scroll/Viewport/item_con","item_scroll","ok_btn:obj","bg_con","value:inp","key:txt",
}
UI.GetChildren(self, self.transform, names)
self.window = UI.Window.Create()
local winData = {
style = "WindowStyle.NoTab",
bg = "default",
onClose = function()
self:Unload()
end,
}
self.window:Load(winData)
self.window:SetParent(self.bg_con)
self:AutoDestroy(self.window)
self:AddEvents()
self:OnUpdate()
end
function GMSettingView:AddEvents( )
local on_click = function ( click_obj )
if click_obj == self.ok_btn_obj then
if not self.curSelectKey or self.curSelectKey=="" then
Message:Show("未选中需要修改的值")
return
end
local newValue = self.value_inp.text
if Trim(newValue) ~= "" then
ConfigGame.GetInstance().Data[self.curSelectKey] = newValue
ConfigGame.GetInstance():Save();
Message:Show("修改成功!")
else
Message:Show("值不能为空")
end
end
end
UI.BindClickEvent(self.ok_btn_obj, on_click)
end
function GMSettingView:GetSettingList()
if not self.settingList then
self.settingList = {
{name="文件服务器地址", key="FileServerURL"},
}
end
return self.settingList
end
function GMSettingView:OnUpdate( )
print('Cat:GMSettingView.lua[31] self.isLoaded', self.isLoaded)
if not self.isLoaded then return end
local settingList = self:GetSettingList()
self.item_list_com = self.item_list_com or self:AddUIComponent(UI.ItemListCreator)
local info = {
data_list = settingList,
item_con = self.item_con,
scroll_view = self.item_scroll,
prefab_pool_name = "Button2",
item_width = 200,
item_height = 56,
space_x = 5,
space_y = 3,
start_x = 106,
start_y = -28,
child_names = {"label:txt"},
on_update_item = function(item, i, v)
UI.SetSizeDeltaX(item.transform, 200)
item.gameObject.name = v.name
item.label_txt.text = v.name
local on_click = function ( click_obj )
self.curSelectKey = v.key
self.key_txt.text = v.key
self.value_inp.text = ConfigGame.GetInstance().Data[v.key]
end
UI.BindClickEvent(item.gameObject, on_click)
end,
}
self.item_list_com:UpdateItems(info)
end
return GMSettingView
|
object_tangible_loot_creature_loot_collections_space_reactor_mark_03_cygnus = object_tangible_loot_creature_loot_collections_space_shared_reactor_mark_03_cygnus:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_creature_loot_collections_space_reactor_mark_03_cygnus, "object/tangible/loot/creature/loot/collections/space/reactor_mark_03_cygnus.iff")
|
local Packages = script.Parent.Parent.Parent.Parent.Parent
local Roact = require(Packages.Roact)
local App = Packages.UIBlox.App
local Images = require(App.ImageSet.Images)
local Core = Packages.UIBlox.Core
local GenericButton = require(Core.Button.GenericButton)
local withStyle = require(Core.Style.withStyle)
local ControlState = require(Core.Control.Enum.ControlState)
local Story = Roact.PureComponent:extend("GenericButtonOverviewComponent")
function Story:render()
local isDisabled = self.props.controls.isDisabled
local isLoading = self.props.controls.isLoading
local userInteractionEnabled = self.props.controls.userInteractionEnabled
local buttonImage = Images["component_assets/circle_17"]
return withStyle(function(style)
return Roact.createElement(GenericButton, {
Size = UDim2.new(0, 144, 0, 48),
buttonImage = buttonImage,
buttonStateColorMap = {
[ControlState.Default] = "UIDefault",
[ControlState.Hover] = "UIEmphasis",
},
contentStateColorMap = {
[ControlState.Default] = "UIDefault",
},
isDisabled = isDisabled,
isLoading = isLoading,
userInteractionEnabled = userInteractionEnabled,
onActivated = function()
print("Generic Button Clicked!")
end,
onStateChanged = function(oldState, newState)
if oldState ~= ControlState.Initialize then
print("state changed \n oldState:", oldState, " newState:", newState)
end
end
})
end)
end
return {
controls = {
isDisabled = false,
isLoading = false,
userInteractionEnabled = true,
},
story = Story
}
|
Isotropic = {}
function Isotropic.new(obj)
assert(obj.albedo ~= nil)
setmetatable(obj, Isotropic)
return obj
end
function Isotropic:__tostring()
return string.format('Isotropic ( albedo: %s )', self.albedo)
end
|
local mod = mod_loader.mods[modApi.currentMod]
local path = mod.scriptPath .."multishot/"
local imagepath = "combat/icons/".. mod.id .."_multishot/"
local armorDetection = require(path .."libs/armorDetection")
local highestMark = require(path .."init").highestMark
local this = {}
local function getPrefix(loc)
local ret = "damage_"
local pawn = Board:GetPawn(loc)
if pawn then
if pawn:IsAcid() then
ret = "acid_"
elseif armorDetection.IsArmor(pawn) then
ret = ""
end
end
return ret
end
function this.GetMarkColor(loc)
assert(type(loc) == 'userdata')
assert(type(loc.x) == 'number')
assert(type(loc.y) == 'number')
local mark = getPrefix(loc)
local color = GL_Color(255, 255, 255)
if mark == "damage_" then
color = GL_Color(255, 255, 50)
elseif mark =="acid_" then
color = GL_Color(0, 255, 0)
end
return color
end
function this.GetMark(attacks, loc, isOffset)
assert(type(attacks) == 'number')
if attacks < 2 or attacks > highestMark then return "" end
if not loc then return imagepath .."x".. attacks ..".png" end
assert(type(loc) == 'userdata')
assert(type(loc.x) == 'number')
assert(type(loc.y) == 'number')
local mark = getPrefix(loc)
if isOffset then
mark = "offset_".. mark
end
return imagepath .. mark .."x".. attacks ..".png"
end
return this
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.