content stringlengths 5 1.05M |
|---|
----
-- Test cases for xlsxwriter.lua.
--
-- Test the creation of a simple xlsxwriter.lua file with hyperlinks.
-- This example doesn't have any link formatting and tests the relationship
-- linkage code.
--
-- Copyright 2014-2015, John McNamara, jmcnamara@cpan.org
--
local Workbook = require "xlsxwriter.workbook"
local workbook = Workbook:new("test_hyperlink15.xlsx")
local worksheet = workbook:add_worksheet()
worksheet:write_url("B2", "external:subdir/blank.xlsx")
workbook:close()
|
--- This file is generated by ava-x2l.exe,
--- Don't change it manaully.
--- @copyright Lilith Games, Project Da Vinci(Avatar Team)
--- @see Official Website: https://www.projectdavinci.com/
--- @see Dev Framework: https://github.com/lilith-avatar/avatar-ava
--- @see X2L Tool: https://github.com/lilith-avatar/avatar-ava-xls2lua
--- source file: .//GuitarPitch.xlsx
local ChordFretXls = {
CMaj = {
Chord = 'CMaj',
StringFret = {0, 1, 0, 2, 3, 0},
IsActive = true
},
Dm = {
Chord = 'Dm',
StringFret = {1, 3, 2, 0, 0, 0},
IsActive = true
},
Em = {
Chord = 'Em',
StringFret = {0, 0, 0, 2, 2, 0},
IsActive = true
},
FMaj = {
Chord = 'FMaj',
StringFret = {1, 1, 2, 3, 3, 1},
IsActive = true
},
GMaj = {
Chord = 'GMaj',
StringFret = {3, 0, 0, 0, 2, 3},
IsActive = true
},
Am = {
Chord = 'Am',
StringFret = {0, 1, 2, 2, 0, 0},
IsActive = true
}
}
return ChordFretXls
|
local ffi = require("ffi")
local A = require("android")
ffi.cdef[[
struct FILE *fopen(const char *, const char *);
size_t fread(void *, size_t, size_t, struct FILE *);
size_t fwrite(const void *, size_t, size_t, struct FILE *);
int fclose(struct FILE *);
int remove(const char *);
int __cdecl lzma_main(int numargs, char *args[]);
]]
local function install()
local function check_installed_rev()
local git_rev = io.open(A.dir .. "/git-rev")
local rev = git_rev and git_rev:read() or ""
return rev:match(".*%-(.*)")
end
-- 7z compressed package are stored in module directory in asset
local module = "module"
local package_name = "koreader%-(.*)%.7z"
local mgr = A.app.activity.assetManager
local asset_dir = ffi.C.AAssetManager_openDir(mgr, module)
assert(asset_dir ~= nil, "could not open module directory in assets")
local filename = ffi.C.AAssetDir_getNextFileName(asset_dir)
while filename ~= nil do
filename = ffi.string(filename)
A.LOGI(string.format("Check file in asset %s: %s", module, filename))
local rev = filename:match(package_name)
if rev then
if rev == check_installed_rev() then
A.LOGI("Skip installation for revision "..rev)
break
end
A.LOGI("Found new package revision "..rev)
-- copy package from asset
local package = A.dir.."/"..filename
local buffer_size = 4096
local buf = ffi.new("char[?]", buffer_size)
local asset = ffi.C.AAssetManager_open(mgr,
ffi.cast("char*", module.."/"..filename),
ffi.C.AASSET_MODE_STREAMING);
if asset ~= nil then
local output = ffi.C.fopen(ffi.cast("char*", package),
ffi.cast("char*", "wb"))
local nb_read = ffi.C.AAsset_read(asset, buf,
ffi.new("int", buffer_size))
while nb_read > 0 do
ffi.C.fwrite(buf, ffi.new("int", nb_read),
ffi.new("int", 1), output)
nb_read = ffi.C.AAsset_read(asset, buf,
ffi.new("int", buffer_size))
end
ffi.C.fclose(output)
ffi.C.AAsset_close(asset)
-- unpack to data directory
local args = {"7z", "x", package, A.dir}
local argv = ffi.new("char*[?]", #args+1)
for i, arg in ipairs(args) do
argv[i-1] = ffi.cast("char*", args[i])
end
A.LOGI("Installing new koreader package to "..args[4])
local lzma = ffi.load("liblzma.so")
lzma.lzma_main(ffi.new("int", #args), argv)
ffi.C.remove(ffi.cast("char*", package))
break
end
end
filename = ffi.string(ffi.C.AAssetDir_getNextFileName(asset_dir))
end
ffi.C.AAssetDir_close(asset_dir)
end
install()
|
--[[ ============================================================================================================
Author: Rook
Date: February 3, 2015
Called when the unit lands an attack on a target and the chance to Greater Maim is successful. Applies the
modifier so long as the target is not a structure.
================================================================================================================= ]]
function modifier_item_sange_and_yasha_datadriven_on_attack_landed_random_on_success(keys)
if keys.target.GetInvulnCount == nil then --If the target is not a structure.
keys.target:EmitSound("DOTA_Item.Maim")
keys.ability:ApplyDataDrivenModifier(keys.attacker, keys.target, "modifier_item_sange_and_yasha_datadriven_greater_maim", nil)
end
end |
/*
(c) Copyright October 2017, AntoineJT. All rights reserved.
The only things you can modify are the local vars below.
Don't modify anything else !
v. 1.1.0
*/
/*
FRENCH Customization
local isCustomizationEnabled = false
local dropMoneyPercentage = 50
local deathMessage = "Vous avez perdu " .. dropMoneyPercentage .. "% de l'argent que vous aviez sur vous !"
local deathWithoutMoneyMessage = "Vous n'avez pas perdu d'argent car vous n'en aviez pas sur vous !"
local resetNegativeMoneyMessage = "Le bug de votre portefeuille a été réparé ! Veuillez nous excuser pour le dérangement !"
*/
local isCustomizationEnabled = false
local dropMoneyPercentage = 50
local deathMessage = "You've lost " .. dropMoneyPercentage .. "% of your wallet money !"
local deathWithoutMoneyMessage = "You've lost nothing because you've nothing to lose !"
local resetNegativeMoneyMessage = "You're wallet glitch has been removed ! Sorry for the inconvenience !"
-- DON'T MODIFY ANYTHING BELOW THIS LINE !!
local module_prefix = "[DMOD] "
local module_version = "1.1.0"
function defaultValues()
dropMoneyPercentage = 50
deathMessage = "You've lost " .. dropMoneyPercentage .. "% of your wallet money !"
deathWithoutMoneyMessage = "You've lost nothing because you've nothing to lose !"
resetNegativeMoneyMessage = "You're wallet glitch has been removed ! Sorry for the inconvenience !"
end
function logConsole(text)
Msg(module_prefix .. tostring(text) .. "\n")
end
function initialization()
logConsole("Starting Drop Money On Death (DMOD) Module...")
logConsole("(c) October 2017, AntoineJT")
logConsole("DMOD module version: " .. module_version)
logConsole("Loading config...")
-- Content of the archaic loadVars function
if (!isCustomizationEnabled) then
logConsole("Customization is not enabled !")
logConsole("Loading default values...")
defaultValues()
logConsole("Loading complete !")
else
logConsole("Customization is enabled !")
logConsole("DMOD will use your custom values")
end
end
function dropMoneyOnDeath( victim, weapon, killer )
if (IsValid(victim)) then
local victimMoney = victim:getDarkRPVar("money")
if (victimMoney > 0) then
local moneyToDrop = victimMoney*(dropMoneyPercentage/100)
victim:addMoney(-moneyToDrop)
local trace = {}
trace.start = victim:EyePos()
trace.endpos = trace.start + victim:GetAimVector() * 85
trace.filter = victim
local tr = util.TraceLine(trace)
local moneybag = DarkRP.createMoneyBag(tr.HitPos, moneyToDrop)
hook.Call("playerDroppedMoney", nil, victim, moneyToDrop, moneybag)
victim:PrintMessage(HUD_PRINTCENTER, deathMessage)
elseif (victimMoney == 0) then
victim:PrintMessage(HUD_PRINTCENTER, deathWithoutMoneyMessage)
elseif (victimMoney < 0) then
victim:addMoney(-victimMoney)
victim:PrintMessage(HUD_PRINTTALK, module_prefix .. resetNegativeMoneyMessage)
end
end
end
hook.Add("PlayerDeath", "Drop some money when you die", dropMoneyOnDeath)
hook.Add("loadCustomDarkRPItems", "Use to log into server console", initialization)
|
local _M={}
_M.mysql_master = {
host = "139.196.180.249",
port = 3306,
database = "poker",
user = "root",
password = "zhengsu@2014",
max_packet_size = 1024 * 1024
}
_M.redis_master_main={
host = "127.0.0.1",
port = 6379,
--database = "ZengsuTestDB",
user = "root",
password = "Zhengsu@2014",
max_packet_size = 1024 * 1024
}
return _M |
-- Usage:
-- local rubygen = require "bindings-ruby"
-- rubygen.write(rubygen.gen(), "../bindings/ruby/bgfx.rb")
local codegen = require "codegen"
local idl = codegen.idl "bgfx.idl"
local ruby_template = [[
# [NOTE] Generated automatically with Ruby-bgfx ( https://github.com/vaiorabbit/ruby-bgfx ). Do NOT edit.
require 'ffi'
#
# Typedefs
#
FFI.typedef :uint16, :Bgfx_view_id_t # [HACK] Hard-coded. Seems we can't get information about this from current 'bgfx.idl'.
$typedefs
#
# Enums / Bitflags
#
module Bgfx
extend FFI::Library
@@bgfx_import_done = false
def self.load_lib(libpath = './libbgfx-shared-libRelease.dylib')
ffi_lib_flags :now, :global
ffi_lib libpath
import_symbols() unless @@bgfx_import_done
end
$types
end # module Bgfx
#
# Callbacks
#
class Bgfx_callback_vtbl_t < FFI::Struct
layout(
:fatal, callback([:pointer, :string, :uint16, :uint32, :string], :void), # uint32 == Bgfx::Fatal
:trace_vargs, callback([:pointer, :string, :uint16, :string, :varargs], :void),
:profiler_begin, callback([:pointer, :string, :uint32, :string, :uint16], :void),
:profiler_begin_literal,callback([:pointer, :string, :uint32, :string, :uint16], :void),
:profiler_end, callback([:pointer], :void),
:cache_read_size, callback([:pointer, :uint64], :uint32),
:cache_read, callback([:pointer, :uint64, :pointer, :uint32], :bool),
:cache_write, callback([:pointer, :uint64, :pointer, :uint32], :void),
:screen_shot, callback([:pointer, :string, :uint32, :uint32, :uint32, :pointer, :uint32, :bool], :void),
:capture_begin, callback([:pointer, :uint32, :uint32, :uint32, :bool], :void),
:capture_end, callback([:pointer], :void),
:capture_frame, callback([:pointer, :pointer, :uint32], :void)
)
end
class Bgfx_callback_interface_t < FFI::Struct
layout(:vtbl, Bgfx_callback_vtbl_t.by_ref)
end
class Bgfx_allocator_interface_t < FFI::Struct
layout(:vtbl, :pointer) # bgfx_allocator_vtbl_s*
end
class Bgfx_allocator_vtbl_t < FFI::Struct
layout(
:realloc, callback([Bgfx_allocator_interface_t.ptr, :pointer, :size_t, :size_t, :string, :uint32], :pointer)
)
end
#
# Structs
#
class Bgfx_invalid_handle_t < FFI::Struct
layout(:idx, :ushort)
def self.create
handle = new
handle[:idx] = Bgfx::InvalidHandleIdx
return handle
end
end
$handles
$structs
#
# Functions
#
module Bgfx
InvalidHandleIdx = 0xffff
def self.is_valid(handle)
return handle[:idx] != InvalidHandleIdx
end
InvalidHandle = Bgfx_invalid_handle_t.create
def self.import_symbols()
symbols = [
$attachfuncsymbols
]
args = {
$attachfuncargs
}
retvals = {
$attachfuncretvals
}
symbols.each do |sym|
begin
attach_function sym, args[sym], retvals[sym]
rescue FFI::NotFoundError => error
$stderr.puts("[Warning] Failed to import #{sym} (#{error}).")
end
end
end # self.import_symbols()
$modulefuncs
end # module Bgfx
]]
local converter = {}
local yield = coroutine.yield
local indent = ""
local typedefs_list = {}
local methods_list = {}
local attach_func_symbols = {}
local attach_func_args = {}
local attach_func_retvals = {}
----------------------------------------------------------------------------------------------------
local function hasPrefix(str, prefix)
return prefix == "" or str:sub(1, #prefix) == prefix
end
local function hasSuffix(str, suffix)
return suffix == "" or str:sub(-#suffix) == suffix
end
local function to_underscorecase(name)
local tmp = {}
for v in name:gmatch "[_%u][%l%d]*" do
if v:byte() == 95 then -- '_'
v = v:sub(2) -- remove _
end
tmp[#tmp+1] = v
end
return table.concat(tmp, "_")
end
----------------------------------------------------------------------------------------------------
local gen = {}
function generate(tmp, idl_info, conv)
for _, object in ipairs(idl_info) do
local co = coroutine.create(conv)
local any
while true do
local ok, v = coroutine.resume(co, object)
assert(ok, debug.traceback(co, v))
if not v then
break
end
table.insert(tmp, v)
any = true
end
if any and tmp[#tmp] ~= "" then
table.insert(tmp, "")
end
end
end
function gen.gen()
-- 1st pass : Collect typedef/method information
for _, object in ipairs(idl["types"]) do
local co = coroutine.create(collect_typedefs_list)
local any
while true do
local ok, v = coroutine.resume(co, object)
assert(ok, debug.traceback(co, v))
if not v then
break
end
end
end
for _, object in ipairs(idl["funcs"]) do
local co = coroutine.create(collect_methods_list)
local any
while true do
local ok, v = coroutine.resume(co, object)
assert(ok, debug.traceback(co, v))
if not v then
break
end
end
end
for _, object in ipairs(idl["funcs"]) do
local co = coroutine.create(collect_attach_funcs)
local any
while true do
local ok, v = coroutine.resume(co, object)
assert(ok, debug.traceback(co, v))
if not v then
break
end
end
end
-- 2nd pass
local r = ruby_template:gsub("$(%l+)", function(what)
local tmp = {}
if what == "handles" then
-- Structs used as handles
generate(tmp, idl["types"], converter["handles"])
return table.concat(tmp, "\n")
elseif what == "structs" then
-- General structs / Instance methods
generate(tmp, idl["types"], converter["structs"])
return table.concat(tmp, "\n")
elseif what == "typedefs" then
-- Typedefs
generate(tmp, idl["types"], converter["typedefs"])
return table.concat(tmp)
elseif what == "types" then
-- Enums / Bitflags
generate(tmp, idl["types"], converter["types"])
return table.concat(tmp, "\n")
elseif what == "attachfuncsymbols" then
-- Raw function symbols(entry points)
generate(tmp, idl["funcs"], converter["attachfunc_symbols"])
return table.concat(tmp)
elseif what == "attachfuncargs" then
-- Arguments of raw functions
generate(tmp, idl["funcs"], converter["attachfunc_args"])
return table.concat(tmp)
elseif what == "attachfuncretvals" then
-- Return values of raw functions
generate(tmp, idl["funcs"], converter["attachfunc_retvals"])
return table.concat(tmp)
elseif what == "modulefuncs" then
-- Wrapper functions
generate(tmp, idl["funcs"], converter["module_funcs"])
return table.concat(tmp)
end
end)
return r
end
----------------------------------------------------------------------------------------------------
local function convert_array(member)
count = string.gsub(member.array, "%[(.+)%]", "%1")
return member.array
end
local function convert_type(arg, array_as_pointer)
local ctype = arg.ctype:gsub("%s%*", "*")
if arg.fulltype == "bx::AllocatorI*" or arg.fulltype == "ReleaseFn" then
ctype = ":pointer"
elseif arg.fulltype == "CallbackI*" then
ctype = "Bgfx_callback_interface_t.ptr"
elseif hasPrefix(ctype, "const char") and hasSuffix(ctype, "*") then
ctype = ":string"
elseif string.match(ctype, "*") then
ctype = ":pointer"
end
-- Omit 'const'
ctype = string.gsub(ctype, "const ", "")
if hasPrefix(ctype, "bgfx") then
name = ctype:gsub("^%l", string.upper)
local is_typedef = false
if name == "Bgfx_view_id_t" then
-- [HACK] Hard-coded. Seems we can't get information about this from current 'bgfx.idl'.
is_typedef = true
else
for _, t in ipairs(typedefs_list) do
if t == name then
is_typedef = true
break
end
end
end
if is_typedef then
ctype = ":" .. name
else
ctype = name .. ".by_value"
end
elseif hasPrefix(ctype, "uint64_t") then
ctype = ctype:gsub("uint64_t", ":uint64")
elseif hasPrefix(ctype, "int64_t") then
ctype = ctype:gsub("int64_t", ":int64")
elseif hasPrefix(ctype, "uint32_t") then
ctype = ctype:gsub("uint32_t", ":uint32")
elseif hasPrefix(ctype, "int32_t") then
ctype = ctype:gsub("int32_t", ":int32")
elseif hasPrefix(ctype, "uint16_t") then
ctype = ctype:gsub("uint16_t", ":uint16")
elseif hasPrefix(ctype, "uint8_t") then
ctype = ctype:gsub("uint8_t", ":uint8")
elseif hasPrefix(ctype, "uintptr_t") then
ctype = ctype:gsub("uintptr_t", ":ulong")
elseif hasPrefix(ctype, "bool") then
ctype = ctype:gsub("bool", ":bool")
elseif hasPrefix(ctype, "char") then
ctype = ctype:gsub("char", ":char")
elseif hasPrefix(ctype, "float") then
ctype = ":float"
elseif hasPrefix(ctype, "double") then
ctype = ":double"
elseif hasPrefix(ctype, "...") then
ctype = ":varargs"
elseif hasPrefix(ctype, "va_list") then
ctype = ":pointer"
elseif hasPrefix(ctype, "void") then
ctype = ":void"
end
if arg.array ~= nil then
if array_as_pointer then
ctype = ":pointer"
else
count = string.gsub(arg.array, "%[(.+)%]", "%1")
if string.find(count, "::") then
count = "Bgfx::" .. count -- e.g.) Topology::Count -> Bgfx::Topology::Count
end
ctype = "[" .. ctype .. ", " .. count .. "]"
end
end
return ctype
end
local function convert_name(arg)
if arg == "debug" then
return arg .. "_"
end
return arg
end
local function convert_struct_member(member)
return ":" .. convert_name(member.name) .. ", " .. convert_type(member)
end
-- C to Ruby literal conversion
local function sanitize_default_argument(arg_str)
retval = ""
if arg_str == "NULL" then
retval = "nil"
elseif arg_str == "BGFX_INVALID_HANDLE" then
retval = "Bgfx::InvalidHandle"
elseif arg_str == "BGFX_TEXTURE_NONE|BGFX_SAMPLER_NONE" then
retval = "Bgfx::Texture_None|Bgfx::Sampler_None"
elseif arg_str == "BGFX_SAMPLER_U_CLAMP|BGFX_SAMPLER_V_CLAMP" then
retval = "Bgfx::Sampler_U_Clamp|Bgfx::Sampler_V_Clamp"
elseif arg_str == "TextureFormat::Count" then
retval = "Bgfx::TextureFormat::Count"
elseif arg_str == "BGFX_BUFFER_NONE" then
retval = "Bgfx::Buffer_None"
elseif arg_str == "BGFX_DISCARD_ALL" then
retval = "Bgfx::Discard_All"
elseif arg_str == "BGFX_RESET_NONE" then
retval = "Bgfx::Reset_None"
elseif arg_str == "BGFX_STENCIL_NONE" then
retval = "Bgfx::Stencil_None"
elseif arg_str == "RendererType::Noop" then
retval = "Bgfx::RendererType::Noop"
elseif arg_str == "INT32_MAX" then
retval = "0x7fffffff"
elseif arg_str == "UINT32_MAX" then
retval = "0xffffffff"
elseif arg_str == "UINT16_MAX" then
retval = "0xffff"
elseif arg_str == "UINT8_MAX" then
retval = "0xff"
elseif string.find(tostring(arg_str), "^[+-]?%d*%.?%d*f$") then
_, _, num = string.find(tostring(arg_str), "^([+-]?%d*%.?%d*)f$")
retval = num
else
retval = arg_str
end
return retval
end
----------------------------------------------------------------------------------------------------
function collect_typedefs_list(typ)
-- Collect list of typedefs
if typ.enum then
local typedef_name = typ.cname:gsub("^%l", string.upper)
table.insert(typedefs_list, typedef_name)
end
end
function converter.typedefs(typ)
-- Write typedefs
if typ.enum then
local typedef_name = typ.cname:gsub("^%l", string.upper)
yield("FFI.typedef :int, :" .. typedef_name .. "\n")
end
end
----------------------------------------------------------------------------------------------------
function converter.handles(typ)
-- Build handle definitions
if typ.handle then
-- Extract handle
ruby_class_name = typ.cname:gsub("bgfx_(%l)", function(a) return "Bgfx_" .. a end)
yield("class " .. ruby_class_name .. " < FFI::Struct; layout(:idx, :ushort); end")
end
end
----------------------------------------------------------------------------------------------------
function collect_methods_list(func)
if func.this ~= nil then
table.insert(methods_list, func)
end
end
function converter.structs(typ)
if typ.struct == nil then
return
end
indent = " "
class_name = typ.cname:gsub("^%l", string.upper)
yield("class " .. class_name .. " < FFI::Struct")
-- Member variables
yield(indent .. "layout(")
if class_name == "Bgfx_encoder_t" then
yield(indent .. indent .. ":opaque, :pointer # dummy")
else
for idx, member in ipairs(typ.struct) do
local comments = ""
if member.comment ~= nil then
if #member.comment == 1 then
comments = " # " .. member.comment[1]
else
yield("\n" .. indent .. indent .. "#")
for _, comment in ipairs(member.comment) do
yield(indent .. indent .. "# " .. comment)
end
yield(indent .. indent .. "#")
end
end
ret = indent .. indent .. convert_struct_member(member)
if idx < #typ.struct then
ret = ret .. "," .. comments
else
ret = ret .. comments
end
yield(ret)
end
end
yield(indent .. ")")
-- Instance methods
struct_name_key = typ.cname:gsub("^bgfx_", ""):gsub("_t$", "") .. "_"
for _, func in ipairs(methods_list) do
if string.match(func.cname, "^" .. struct_name_key) ~= nil then
method_name = func.cname:gsub("^" .. struct_name_key, "")
local args = {}
local args_with_defaults = {}
for _, arg in ipairs(func.args) do
table.insert(args, arg.name)
if arg.default ~= nil then
table.insert(args_with_defaults, arg.name .. " = " .. tostring(sanitize_default_argument(arg.default)) )
else
table.insert(args_with_defaults, arg.name)
end
end
yield("\n" .. indent .. "def " .. method_name .. "(" .. table.concat(args_with_defaults, ", ") .. ")")
if #args < 1 then
yield(indent .. indent .. "Bgfx::bgfx_" .. func.cname .. "(self)")
else
yield(indent .. indent .. "Bgfx::bgfx_" .. func.cname .. "(self, " .. table.concat(args, ", ") .. ")")
end
yield(indent .. "end")
end
end
yield("end")
end
----------------------------------------------------------------------------------------------------
function converter.types(typ)
indent = " "
if hasSuffix(typ.name, "::Enum") then
-- Extract enum
yield(indent .. "module " .. typ.typename)
for idx, enum in ipairs(typ.enum) do
if enum.comment ~= nil then
for _, comment in ipairs(enum.comment) do
yield(indent .. indent .. "# " .. comment)
end
end
yield(indent .. indent .. enum.name .. " = " .. idx - 1)
end
yield("\n" .. indent .. indent .. "Count = " .. #typ.enum)
yield(indent .. "end # module " .. typ.typename)
elseif typ.bits ~= nil then
-- Extract bitflag / Build bitflag helper function
local prefix = typ.name
local enumType = "uint"
format = "%u"
if typ.bits == 64 then
format = "0x%016x"
enumType = "ulong"
elseif typ.bits == 32 then
format = "0x%08x"
enumType = "uint"
elseif typ.bits == 16 then
format = "0x%04x"
enumType = "ushort"
elseif typ.bits == 8 then
format = "0x%02x"
enumType = "ubyte"
end
for idx, flag in ipairs(typ.flag) do
local value = flag.value
if value ~= nil then
value = string.format(flag.format or format, value)
else
for _, name in ipairs(flag) do
local fixedname = prefix .. "_" .. to_underscorecase(name)
if value ~= nil then
value = value .. " | " .. fixedname
else
value = fixedname
end
end
end
local comments = ""
if flag.comment ~= nil then
if #flag.comment == 1 then
comments = " # " .. flag.comment[1]
else
yield(indent .. "#")
for _, comment in ipairs(flag.comment) do
yield(indent .. "# " .. comment)
end
yield(indent .. "#")
end
end
yield(indent .. to_underscorecase(prefix) .. "_" .. flag.name .. " = " .. value .. comments)
end
if typ.shift then
local name = to_underscorecase(prefix) .. "_Shift"
local value = typ.shift
local comments = ""
if typ.desc then
comments = string.format(" # %s bit shift", typ.desc)
end
yield(indent .. name .. " = " .. value .. comments)
end
if typ.range then
local name = to_underscorecase(prefix) .. "_Mask"
local value = string.format(format, typ.mask)
local comments = ""
if typ.desc then
comments = string.format(" # %s bit mask", typ.desc)
end
yield(indent .. name .. " = " .. value .. comments)
end
if typ.helper then
yield(indent .. string.format(
"def self.%s(v); return (v << %s) & %s; end",
to_underscorecase(prefix),
(to_underscorecase(prefix) .. "_Shift"),
(to_underscorecase(prefix) .. "_Mask")))
end
end
end
----------------------------------------------------------------------------------------------------
function collect_attach_funcs(func)
if func.cpponly then
return
end
-- codes
local args = {}
if func.this ~= nil then
local ctype = string.gsub(func.this_type.ctype, "const ", "") -- remove const
ctype = ctype:gsub("%*$", "") -- remove *
ctype = ctype:gsub("^%l", string.upper) -- upcase
args[1] = ctype .. ".by_ref"
end
for _, arg in ipairs(func.args) do
-- table.insert(args, convert_type(arg) .. " " .. convert_name(arg.name))
local array_as_pointer = true
table.insert(args, convert_type(arg, array_as_pointer))
end
entry_point = ":bgfx_" .. func.cname
func_sym = entry_point
func_arg = "[" .. table.concat(args, ", ") .. "]"
func_ret = convert_type(func.ret)
attach_func_symbols[func.cname] = func_sym
attach_func_args[func_sym] = func_arg
attach_func_retvals[func_sym] = func_ret
end
function converter.attachfunc_symbols(func)
if func.cpponly then
return
end
indent = " "
yield(indent .. attach_func_symbols[func.cname] .. ",\n")
end
function converter.attachfunc_args(func)
if func.cpponly then
return
end
indent = " "
entry_point = attach_func_symbols[func.cname]
yield(indent .. entry_point .. " => " .. attach_func_args[entry_point] .. ",\n")
end
function converter.attachfunc_retvals(func)
if func.cpponly then
return
end
indent = " "
entry_point = attach_func_symbols[func.cname]
yield(indent .. entry_point .. " => " .. attach_func_retvals[entry_point] .. ",\n")
end
----------------------------------------------------------------------------------------------------
function converter.module_funcs(func)
if func.cpponly then
return
end
if func.this ~= nil then
return
end
indent = " "
if func.comments ~= nil then
-- comments
yield("\n" .. indent .. "#\n")
for _, line in ipairs(func.comments) do
local line = line:gsub("@remarks", "Remarks:")
line = line:gsub("@remark", "Remarks:")
line = line:gsub("@(%l)(%l+)", function(a, b) return a:upper()..b..":" end)
yield(indent .. "# " .. line)
end
local hasParamsComments = false
for _, arg in ipairs(func.args) do
if arg.comment ~= nil then
hasParamsComments = true
break
end
end
if hasParamsComments then
yield(indent .. "# Params:\n")
end
for _, arg in ipairs(func.args) do
if arg.comment ~= nil then
yield(indent .. "# " .. convert_name(arg.name) .. " = " .. arg.comment[1] .. "\n")
for i, comment in ipairs(arg.comment) do
if (i > 1) then
yield(indent .. "# " .. comment .. "\n")
end
end
end
end
yield(indent .. "#\n")
end
-- codes
local args = {}
local args_with_defaults = {}
for _, arg in ipairs(func.args) do
table.insert(args, arg.name)
if arg.default ~= nil then
table.insert(args_with_defaults, arg.name .. " = " .. tostring(sanitize_default_argument(arg.default)) )
else
table.insert(args_with_defaults, arg.name)
end
end
-- for func.dbgTextPrintf { vararg = "dbgTextPrintfVargs" }. Explicitly replace last element with *varargs, or we got empty last argument
if func.vararg ~= nil then
args[#args] = "*vargargs"
args_with_defaults[#args_with_defaults] = "*vargargs"
end
entry_point = "bgfx_" .. func.cname
yield(indent .. "def self." .. func.cname .. "(" .. table.concat(args_with_defaults, ", ") .. ")\n")
yield(indent .. indent .. entry_point .. "(" .. table.concat(args, ", ") .. ")\n")
yield(indent .. "end\n")
end
----------------------------------------------------------------------------------------------------
function gen.write(codes, outputfile)
local out = assert(io.open(outputfile, "wb"))
out:write(codes)
out:close()
print("Generating: " .. outputfile)
end
if (...) == nil then
-- run `lua bindings-ruby.lua` in command line
print(gen.gen())
end
return gen
|
local lpeg = require 'lpeg'
local P, C, V, Cp = lpeg.P, lpeg.C, lpeg.V, lpeg.Cp
G = {
[1] = (V'h1' + V'h2' + V'h3' + V'h4' + V'h5' + V'h6' + 1)^0
,
h1 = P'\n' * Cp() * C((P(1)-'\n')^1) * '\n' * '==='
,
h2 = P'\n' * Cp() * C((P(1)-'\n')^1) * '\n' * '---'
,
h3 = P(false)
,
h4 = P(false)
,
h5 = P(false)
,
h6 = P(false)
}
local SECTIONS = {}
for lvl=1, 6 do
local hi = 'h'..lvl
local str = P(string.rep('#',lvl))
G[hi] = G[hi] + P'\n' * Cp() * str * P' '^1 *
C((P(1) - (P' '^-1 * (str+'\n')))^0)
G[hi] = G[hi] / function(pos, v)
if SECTIONS[v] then
io.stderr:write('ERROR: '..lvl..' '..v..'\n')
end
SECTIONS[v] = true
return {lvl,pos,v}
end
end
local MANUAL = assert(io.open('manual-'..(...)..'.md')):read'*a'
local T = { P(G):match(MANUAL) }
local toc = { 0 }
local TOC = ''
for _, t in ipairs(T) do
local lvl, pos, v = table.unpack(t)
if lvl < #toc then
for j=lvl+1, #toc do
toc[j] = nil
end
end
if lvl == #toc then
toc[lvl] = toc[lvl] + 1
else
assert(lvl > #toc)
toc[#toc+1] = 1
end
local spc = string.rep(' ',lvl*4-4)
local idx = table.concat(toc,'.')
t[4] = idx
local lnk = v
--io.stderr:write('antes '..lnk..'\n')
lnk = string.gsub(lnk,'[%/%*% %´%`%[%]%:]','-')
--io.stderr:write('depois '..lnk..'\n')
lnk = string.lower(lnk)
v = spc..'* '..idx..' ['..v..'](#'..lnk..')'
--print(v)
TOC = TOC .. v .. '\n'
end
for i=#T, 1, -1 do
local t = T[i]
local lvl, pos, v, idx = table.unpack(t)
MANUAL = string.sub(MANUAL,1,pos-1)..string.rep('#',lvl+1)..' '..idx..'\n'..
string.sub(MANUAL,pos)
end
local f = assert(io.open('manual-toc-'..(...)..'.md','w'))
f:write(TOC..'\n\n'..MANUAL)
f:close()
|
kProwlerFov = 100
kBiteHowlVampirismScalar = 0.002 |
local StoreProvider = require(script.StoreProvider)
local connect = require(script.connect)
local getStore = require(script.getStore)
return {
StoreProvider = StoreProvider,
connect = connect,
UNSTABLE_getStore = getStore,
UNSTABLE_connect2 = connect,
} |
modifier_generic_stunned = class({})
function modifier_generic_stunned:OnCreated(params)
if IsServer() then
self:GetParent():Stop()
end
end
function modifier_generic_stunned:IsDebuff() return true end
function modifier_generic_stunned:IsStunDebuff() return true end
function modifier_generic_stunned:CheckState()
return {
[MODIFIER_STATE_COMMAND_RESTRICTED] = true,
[MODIFIER_STATE_STUNNED] = true,
}
end
function modifier_generic_stunned:DeclareFunctions()
return {
MODIFIER_PROPERTY_OVERRIDE_ANIMATION,
}
end
function modifier_generic_stunned:GetOverrideAnimation(params)
return ACT_DOTA_DISABLED
end
function modifier_generic_stunned:GetEffectName()
return "particles/generic_gameplay/generic_stunned.vpcf"
end
function modifier_generic_stunned:GetEffectAttachType()
return PATTACH_OVERHEAD_FOLLOW
end
function modifier_generic_stunned:GetStatusLabel() return "Stun" end
function modifier_generic_stunned:GetStatusPriority() return 4 end
function modifier_generic_stunned:GetStatusStyle() return "Stun" end
if IsClient() then require("wrappers/modifiers") end
Modifiers.Status(modifier_generic_stunned)
Modifiers.Animation(modifier_generic_stunned) |
return (function(Q8,o8,P8,p8,i8,d8,e8,b8,S8,m8,fz,R8,j8,V8,r8,D8,W8,J8,h8,T8,v8,k8,B8,Lz,wz,E8,I8,C8,U8,Z8,t8,F8,az,O8,u8,M8,H8,vz,N8,s8,dz,K8,c8,Y8,x8,Gz,A8,n8,y8,g8,l8,f8,X8,qz,z8,...)local U,g=d8,v8;local a=f8;local R,c=R8[c8],(E8);local t,I=A8,(t8);local H,N=I8,(U8 or g8);local G,w,L=H8,N8,(T8);local E=(s8);local q,d,v,f,X=n8,l8,z8,R8[W8],O8;local q8=(2);local T=(r8);local l,z=F8,(F8);repeat if(q8<=0)then do q8=1;end;else if(q8~=1)then l=(B8 and B8()or J8);q8=0;else do z={};end;q8=3;end;end;until(q8>=3);local W=1;q8=0;local O,B=F8,F8;while(q8~=2)do if(q8==0)then q8=1;else do q8=2;end;end;end;q8=0;local r,F=F8,(F8);while(q8<3)do if(q8<=0)then r=h8;do q8=2;end;else do if(q8~=1)then q8=1;else r=E(f(r,5),m8,function(Es)do if(X(Es,2)==72)then local AC=0;while(u8)do if(AC~=0)then return x8;else F=w(f(Es,1,1));do AC=1;end;end;end;else local fd=R(w(Es,16));if(not(F))then return fd;else local x5=c(fd,F);local c5=(1);do while(u8)do do if(c5~=0)then do F=F8;end;c5=0;else do return x5;end;end;end;end;end;end;end;end;end);do q8=3;end;end;end;end;end;do q8=0;end;local J,h,m,u,x=F8,F8,F8,F8,F8;while(q8<=4)do if(not(q8<=1))then do if(not(q8<=2))then if(q8~=3)then u=4294967296;q8=3;else do x=2^52;end;do q8=5;end;end;else m=2147483648;q8=4;end;end;else do if(q8~=0)then h=function()local D7,x7,N7,u7=F8,F8,F8,(F8);for dW=0,2 do do if(dW<=0)then D7,x7,N7,u7=X(r,W,W+3);else do if(dW~=1)then do return u7*16777216+N7*65536+x7*256+D7;end;else W=W+4;end;end;end;end;end;end;q8=2;else do J=function()local P5=X(r,W,W);W=W+1;return P5;end;end;q8=1;end;end;end;end;q8=0;local P,j,S,K,Q=F8,F8,F8,F8,F8;repeat if(not(q8<=2))then if(q8<=3)then do K=function()local cY,NY,DY,zY,PY,dY,uY=4,F8,F8,F8,F8,F8,F8;while(u8)do if(not(cY<=3))then if(not(cY<=5))then if(not(cY<=6))then if(cY~=7)then dY=j(DY,0,20)*u+NY;do cY=2;end;else if(not(NY==0 and DY==0))then else do return 0;end;end;do cY=3;end;end;else if(PY==0)then do if(dY~=0)then local kR=(0);while(kR~=2)do if(kR~=0)then uY=0;do kR=2;end;else PY=1;kR=1;end;end;else do return zY*0;end;end;end;elseif(PY~=P8)then else if(dY~=0)then do return zY*(1/0);end;else return zY*(0/0);end;end;do cY=0;end;end;else if(cY~=4)then DY=h();cY=7;else NY=h();cY=5;end;end;else do if(not(cY<=1))then if(cY==2)then do uY=1;end;do cY=6;end;else do zY=(-1)^j(DY,31,1);end;do cY=1;end;end;else if(cY~=0)then PY=j(DY,20,11);cY=8;else return zY*(2^(PY-1023))*(dY/x+uY);end;end;end;end;end;end;end;q8=1;else if(q8~=4)then do local Ah=0;local zh=F8;while(Ah<=1)do if(Ah~=0)then for UP=1,31 do for N7=0,1 do if(N7==0)then (P)[UP]=zh;else do zh=zh*2;end;end;end;end;Ah=2;else zh=2;Ah=1;end;end;end;q8=4;else j=function(u6,H6,g6)local R6=(1);local p6=(F8);while(u8)do do if(R6~=0)then p6=(u6/P[H6])%P[g6];do R6=0;end;else p6=p6-p6%1;do break;end;end;end;end;return p6;end;do q8=2;end;end;end;else if(not(q8<=0))then if(q8~=1)then S=function()local Zo,Co=h(),(h());do if(not(Co>=m))then else Co=Co-u;end;end;do return Co*u+Zo;end;end;q8=3;else Q={[0]={[0]=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15},{[0]=1,0,3,2,5,4,7,6,9,8,11,10,13,12,15,14},{[0]=2,3,0,1,6,7,4,5,10,11,8,9,14,15,12,13},{[0]=3,2,1,0,7,6,5,4,11,10,9,8,15,14,13,12},{[0]=4,5,6,7,0,1,2,3,12,13,14,15,8,9,10,11},{[0]=5,4,7,6,1,0,3,2,13,12,15,14,9,8,11,10},{[0]=6,7,4,5,2,3,0,1,14,15,12,13,10,11,8,9},{[0]=7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8},{[0]=8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7},{[0]=9,8,11,10,13,12,15,14,1,0,3,2,5,4,7,6},{[0]=10,11,8,9,14,15,12,13,2,3,0,1,6,7,4,5},{[0]=11,10,9,8,15,14,13,12,3,2,1,0,7,6,5,4},{[0]=12,13,14,15,8,9,10,11,4,5,6,7,0,1,2,3},{[0]=13,12,15,14,9,8,11,10,5,4,7,6,1,0,3,2},{[0]=14,15,12,13,10,11,8,9,6,7,4,5,2,3,0,1},{[0]=15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0}};do q8=6;end;end;else P={[0]=1};do q8=5;end;end;end;until(q8>5);local V=(j8 or S8);local M=V and V[K8]or function(B6,J6)local g6=0;local P6,h6=F8,F8;do while(u8)do do if(g6<=1)then if(g6~=0)then J6=J6%u;do g6=2;end;else do B6=B6%u;end;g6=1;end;else if(g6==2)then P6=1;g6=3;else h6=0;break;end;end;end;end;end;while(B6>0 and J6>0)do local vx=(B6%16);local ix,jx=J6%16,(2);while(u8)do if(jx<=1)then if(jx~=0)then B6=(B6-vx)/16;jx=3;else P6=P6*16;break;end;else if(jx==2)then h6=h6+Q[vx][ix]*P6;jx=1;else J6=(J6-ix)/16;jx=0;end;end;end;end;return h6+B6*P6+J6*P6;end;local D=V and V[Q8]or function(WR,pR)WR=WR%u;pR=pR%u;do return ((WR+pR)-M(WR,pR))/2;end;end;local b=(V and V[V8]or function(my,Fy)my=my%u;Fy=Fy%u;do return u-D(u-my,u-Fy);end;end);local i,k=V and V[M8]or function(FX)return u-(FX%u);end,(V and V[D8]);local Z=(V and V[b8]);k=k or function(Qg,sg)if(not(sg>=32))then else return 0;end;if(sg<0)then return Z(Qg,-sg);end;return (Qg*P[sg])%u;end;do Z=Z or function(P5,d5)if(not(d5>=32))then else return 0;end;do if(not(d5<0))then else do return k(P5,-d5);end;end;end;local A5,v5=0,(F8);while(u8)do if(A5~=0)then do return v5-v5%1;end;else v5=(P5%u/P[d5]);A5=1;end;end;end;end;q8=2;local Y,C=F8,F8;do while(q8<=3)do if(not(q8<=1))then if(q8~=2)then B=J();q8=4;else do Y=function(fh)local Gh,Mh,Lh,oh,Kh,Ih=1,F8,F8,F8,F8,(F8);do while(Gh~=7)do do if(not(Gh<=2))then do if(not(Gh<=4))then if(Gh~=5)then Kh=M(Mh[3],B);Gh=4;else W=W+4;Gh=2;end;else if(Gh~=3)then Ih=M(Mh[4],B);Gh=0;else do oh=M(Mh[2],B);end;Gh=6;end;end;end;else if(not(Gh<=0))then if(Gh~=1)then Lh=M(Mh[1],B);Gh=3;else do Mh={X(r,W,W+3)};end;Gh=5;end;else B=(161*B+fh)%256;Gh=7;end;end;end;end;end;do return Ih*16777216+Kh*65536+oh*256+Lh;end;end;end;q8=0;end;else if(q8==0)then do C=function(CR)local mR,qR=F8,(F8);for Mx=0,4 do do if(not(Mx<=1))then do if(not(Mx<=2))then if(Mx~=3)then return qR;else W=W+mR;end;else for NL=1,mR,7997 do local IL,lL,UL=2,F8,(F8);repeat if(not(IL<=1))then do if(not(IL<=2))then do if(IL~=3)then qR=qR..R(N(UL));IL=5;else do UL={X(r,W+NL-1,W+lL-1)};end;do IL=0;end;end;end;else lL=NL+7997-1;IL=1;end;end;else if(IL~=0)then if(not(lL>mR))then else lL=mR;end;IL=3;else for WK=1,#UL do local HK=0;repeat do if(HK==0)then (UL)[WK]=M(UL[WK],O);HK=1;else O=(CR*O+i8)%k8;HK=2;end;end;until(HK==2);end;IL=4;end;end;until(IL>=5);end;end;end;else if(Mx~=0)then qR=x8;else do mR=h();end;end;end;end;end;end;end;q8=1;else O=J();q8=3;end;end;end;end;local y=({});for hn=1,J() do local zn={};(y)[hn-1]=zn;for sq=1,J() do local Iq=(J());local uq=(F8);local Mq=(2);while(Mq<=2)do if(not(Mq<=0))then if(Mq~=1)then do uq=(sq-1)*2;end;Mq=1;else zn[uq]=j(Iq,0,4);Mq=0;end;else zn[uq+1]=j(Iq,4,4);Mq=3;end;end;end;end;do q8=0;end;local e,o,p,a8=F8,F8,F8,(F8);while(q8<=4)do do if(q8<=1)then do if(q8~=0)then p=1;do q8=3;end;else e=function(...)return G(Z8,...),{...};end;q8=2;end;end;else if(q8<=2)then do o={};end;q8=1;else if(q8==3)then a8={};q8=4;else q8=5;end;end;end;end;end;local function G8(ag,Gg,Yg)local Og,jg=Yg[1],(Yg[3]);local tg=Yg[6];local Bg,zg,rg=Yg[2],Yg[5],(Yg[9]);local pg=Yg[7];local Lg=Yg[8];local Rg=I({},{__mode=Y8});local Ag=F8;Ag=function(...)local sZ={};local YZ,TZ=0,(1);local OZ=(B8 and B8()or J8);local LZ=((OZ==l and ag or OZ));local RZ,oZ=e(...);RZ=RZ-1;for Ry=0,RZ do if(pg>Ry)then (sZ)[Ry]=oZ[Ry+1];else break;end;end;a8[2]=Yg;a8[3]=sZ;do if(not rg)then oZ=F8;elseif(not(Lg))then else sZ[pg]={n=RZ>=pg and RZ-pg+1 or 0,N(oZ,pg+1,RZ+1)};end;end;if(LZ==OZ)then else if(not(T))then J8=LZ;else T(Ag,LZ);end;end;local AZ,pZ,JZ,EZ=L(function()do while(true)do local Hj=Og[TZ];local Wj=(Hj[1]);do TZ=TZ+1;end;if(not(Wj<62))then if(Wj<93)then if(Wj>=77)then if(not(Wj<85))then if(Wj<89)then if(not(Wj<87))then if(Wj~=88)then (sZ)[Hj[3]]=sZ[Hj[10]]%Hj[9];else do (sZ)[Hj[3]]=b(Hj[7],sZ[Hj[5]]);end;end;else do if(Wj==86)then (sZ)[Hj[3]]=Hj[7]>=Hj[9];else if(Hj[5]==78)then TZ=TZ-1;(Og)[TZ]={[3]=(Hj[3]-219)%256,[1]=30,[10]=(Hj[10]-219)%256};elseif(Hj[5]~=222)then local Dr=Hj[3];for Ze=Dr,Dr+(Hj[10]-1) do sZ[Ze]=oZ[pg+(Ze-Dr)+1];end;else do TZ=TZ-1;end;Og[TZ]={[1]=111,[3]=(Hj[3]-80)%256,[10]=(Hj[10]-80)%256};end;end;end;end;else if(not(Wj>=91))then if(Wj~=90)then local fq=(RZ-pg);local Sq=(Hj[3]);if(not(fq<0))then else do fq=-1;end;end;for z2=Sq,Sq+fq do do (sZ)[z2]=oZ[pg+(z2-Sq)+1];end;end;do YZ=Sq+fq;end;else do if(Hj[5]==163)then do TZ=TZ-1;end;do Og[TZ]={[3]=(Hj[3]-66)%256,[5]=(Hj[10]-66)%256,[1]=114};end;else sZ[Hj[3]]=F8;end;end;end;else if(Wj==92)then repeat local NC,bC=Rg,(sZ);if(not(#NC>0))then else local a9=({});for Ac,Pc in H,NC do for Zo,zo in H,Pc do if(not(zo[1]==bC and zo[2]>=0))then else local YO=zo[2];if(not(not a9[YO]))then else do (a9)[YO]={bC[YO]};end;end;do (zo)[1]=a9[YO];end;zo[2]=1;end;end;end;end;until(u8);return u8,Hj[3],0;else do sZ[Hj[3]]=sZ[Hj[10]]-sZ[Hj[5]];end;end;end;end;else if(not(Wj<81))then do if(not(Wj<83))then if(Wj~=84)then do if(not(not(Hj[7]<=Hj[9])))then else TZ=TZ+1;end;end;else if(Hj[5]~=143)then repeat local wu,Su,Uu=Rg,sZ,Hj[3];do if(#wu>0)then local D4=({});for Oe,Ze in H,wu do do for DC,lC in H,Ze do if(not(lC[1]==Su and lC[2]>=Uu))then else local ES=lC[2];do if(not(not D4[ES]))then else D4[ES]={Su[ES]};end;end;(lC)[1]=D4[ES];do (lC)[2]=1;end;end;end;end;end;end;end;until(u8);else TZ=TZ-1;(Og)[TZ]={[1]=82,[3]=(Hj[3]-14)%256,[10]=(Hj[10]-14)%256};end;end;else do if(Wj==82)then repeat local px,Qx=Rg,sZ;do if(not(#px>0))then else local WX={};for Xo,Wo in H,px do for oY,mY in H,Wo do if(mY[1]==Qx and mY[2]>=0)then local OI=mY[2];if(not(not WX[OI]))then else WX[OI]={Qx[OI]};end;(mY)[1]=WX[OI];do mY[2]=1;end;end;end;end;end;end;until(u8);do return;end;else (sZ)[Hj[3]]=sZ[Hj[10]][sZ[Hj[5]]];end;end;end;end;else if(not(Wj>=79))then if(Wj~=78)then (sZ)[Hj[3]]=b(sZ[Hj[10]],Hj[9]);else sZ[Hj[3]]=sZ[Hj[10]]/Hj[9];end;else if(Wj==80)then local jP=(sZ[Hj[10]]/Hj[9]);sZ[Hj[3]]=jP-jP%1;else do if(sZ[Hj[10]]~=sZ[Hj[5]])then else TZ=TZ+1;end;end;end;end;end;end;else if(not(Wj<69))then if(not(Wj<73))then do if(not(Wj>=75))then if(Wj~=74)then sZ[Hj[3]]=sZ[Hj[10]]*sZ[Hj[5]];else TZ=Hj[4];end;else if(Wj==76)then sZ[Hj[3]]=sZ[Hj[10]]+sZ[Hj[5]];else do sZ[Hj[3]]=Hj[7]/Hj[9];end;end;end;end;else if(not(Wj>=71))then if(Wj~=70)then sZ[Hj[3]]=D(Hj[7],sZ[Hj[5]]);else do (sZ)[Hj[3]]=D(sZ[Hj[10]],Hj[9]);end;end;else do if(Wj~=72)then sZ[Hj[3]]=sZ[Hj[10]]^sZ[Hj[5]];else if(Hj[10]==213)then TZ=TZ-1;Og[TZ]={[10]=(Hj[5]-149)%256,[3]=(Hj[3]-149)%256,[1]=84};else do if(sZ[Hj[3]])then do TZ=TZ+1;end;end;end;end;end;end;end;end;else if(Wj>=65)then if(not(Wj>=67))then if(Wj~=66)then sZ[Hj[3]]=Hj[7]*Hj[9];else local jn,Ln=Hj[3],(sZ[Hj[10]]);sZ[jn+1]=Ln;sZ[jn]=Ln[Hj[9]];end;else if(Wj==68)then (sZ)[Hj[3]]=Hj[6];else sZ[Hj[3]][Hj[7]]=Hj[9];end;end;else do if(not(Wj<63))then if(Wj==64)then sZ[Hj[3]]=u8;else do (sZ)[Hj[3]]=Hj[7]/sZ[Hj[5]];end;end;else sZ[Hj[3]]=sZ[Hj[10]]==Hj[9];end;end;end;end;end;else if(not(Wj>=109))then if(not(Wj>=101))then do if(not(Wj>=97))then if(not(Wj<95))then if(Wj~=96)then sZ[Hj[3]]=sZ[Hj[10]][Hj[9]];else local SC=(Hj[3]);local kC=(Hj[5]-1)*50;for xf=1,Hj[10] do sZ[SC][kC+xf]=sZ[SC+xf];end;end;else if(Wj~=94)then sZ[Hj[3]]=Hj[7]==sZ[Hj[5]];else local XE=sZ[Hj[10]];if(not(not XE))then (sZ)[Hj[3]]=XE;else TZ=TZ+1;end;end;end;else if(not(Wj<99))then if(Wj~=100)then sZ[Hj[3]]=Hj[7]>Hj[9];else sZ[Hj[3]]=Hj[7]%Hj[9];end;else if(Wj~=98)then if(Hj[5]~=154)then sZ[Hj[3]]=not sZ[Hj[10]];else TZ=TZ-1;Og[TZ]={[1]=122,[5]=(Hj[10]-77)%256,[3]=(Hj[3]-77)%k8};end;else (sZ)[Hj[3]]=k(Hj[7],sZ[Hj[5]]);end;end;end;end;else if(not(Wj<105))then if(not(Wj<107))then do if(Wj==108)then YZ=Hj[3];(sZ[YZ])();YZ=YZ-1;else if(sZ[Hj[10]]~=Hj[9])then else TZ=TZ+1;end;end;end;else if(Wj==106)then sZ[Hj[3]]=M(Hj[7],sZ[Hj[5]]);else sZ[Hj[3]]=sZ[Hj[10]]~=Hj[9];end;end;else if(not(Wj<103))then if(Wj~=104)then local Sv=(Hj[3]);sZ[Sv](sZ[Sv+1],sZ[Sv+2]);YZ=Sv-1;else (sZ[Hj[3]])[Hj[7]]=sZ[Hj[5]];end;else if(Wj==Lz)then (sZ[Hj[3]])[sZ[Hj[10]]]=Hj[9];else local BR,OR=Hj[3],((Hj[5]-1)*50);for BY=1,YZ-BR do sZ[BR][OR+BY]=sZ[BR+BY];end;end;end;end;end;else if(not(Wj>=117))then if(not(Wj<Gz))then if(not(Wj>=115))then do if(Wj==114)then if(not sZ[Hj[3]])then do TZ=TZ+1;end;end;else local pr,Ar=Hj[3],Hj[10];YZ=pr+Ar-1;repeat local n5,l5=Rg,(sZ);do if(not(#n5>0))then else local Ea=({});for T4,k4 in H,n5 do do for As,Ss in H,k4 do if(not(Ss[1]==l5 and Ss[2]>=0))then else local ws=Ss[2];if(not(not Ea[ws]))then else Ea[ws]={l5[ws]};end;(Ss)[1]=Ea[ws];do Ss[2]=1;end;end;end;end;end;end;end;until(u8);return u8,pr,Ar;end;end;else if(Wj~=116)then (sZ)[Hj[3]]=Z(sZ[Hj[10]],sZ[Hj[5]]);else sZ[Hj[3]]=sZ[Hj[10]]/sZ[Hj[5]];end;end;else if(not(Wj>=wz))then do if(Wj~=110)then if(Hj[7]~=Hj[9])then TZ=TZ+1;end;else local dc=(Hj[5]);local Dc=(Hj[10]);local Rc=(Hj[3]);do if(Dc==0)then else do YZ=Rc+Dc-1;end;end;end;local Ic,Cc=F8,F8;if(Dc==1)then Ic,Cc=e(sZ[Rc]());else Ic,Cc=e(sZ[Rc](N(sZ,Rc+1,YZ)));end;if(dc==1)then YZ=Rc-1;else do if(dc~=0)then Ic=Rc+dc-2;YZ=Ic+1;else Ic=Ic+Rc-1;YZ=Ic;end;end;local Yb=(0);for Xl=Rc,Ic do do Yb=Yb+1;end;do sZ[Xl]=Cc[Yb];end;end;end;end;end;else if(Wj==112)then (sZ)[Hj[3]]=Z(sZ[Hj[10]],Hj[9]);else do (sZ)[Hj[3]]=oZ[pg+1];end;end;end;end;else if(not(Wj<121))then do if(not(Wj<az))then if(Wj~=124)then sZ[Hj[3]]=Hj[7]>sZ[Hj[5]];else (sZ)[Hj[3]]=Z(Hj[7],sZ[Hj[5]]);end;else if(Wj~=122)then do sZ[Hj[3]]=Hj[7]-Hj[9];end;else local bS=(Hj[3]);local ZS=bS+2;local rS=(bS+3);local US=({sZ[bS](sZ[bS+1],sZ[ZS])});for kb=1,Hj[5] do (sZ)[ZS+kb]=US[kb];end;local XS=(sZ[rS]);do if(XS==F8)then TZ=TZ+1;else sZ[ZS]=XS;end;end;end;end;end;else if(not(Wj<119))then if(Wj==120)then sZ[Hj[3]]=Hj[7]-sZ[Hj[5]];else repeat local c9,R9=Rg,(sZ);if(not(#c9>0))then else local Hc={};for Ev,Iv in H,c9 do do for QL,WL in H,Iv do do if(not(WL[1]==R9 and WL[2]>=0))then else local nZ=WL[2];if(not(not Hc[nZ]))then else (Hc)[nZ]={R9[nZ]};end;WL[1]=Hc[nZ];do WL[2]=1;end;end;end;end;end;end;end;until(u8);local F7=Hj[3];YZ=F7+1;return u8,F7,2;end;else if(Wj==118)then sZ[Hj[3]]=sZ[Hj[10]]<=sZ[Hj[5]];else if(Hj[5]==73)then TZ=TZ-1;do Og[TZ]={[3]=(Hj[3]-203)%256,[1]=90,[10]=(Hj[10]-203)%256};end;else repeat local BF,mF=Rg,(sZ);if(not(#BF>0))then else local fL={};do for o3,j3 in H,BF do for Fz,Wz in H,j3 do if(not(Wz[1]==mF and Wz[2]>=0))then else local cW=Wz[2];do if(not fL[cW])then fL[cW]={mF[cW]};end;end;do (Wz)[1]=fL[cW];end;Wz[2]=1;end;end;end;end;end;until(u8);local gC=Hj[3];return C8,gC,gC;end;end;end;end;end;end;end;else if(not(Wj<31))then if(not(Wj>=46))then if(not(Wj<38))then do if(not(Wj<42))then if(not(Wj>=44))then do if(Wj==43)then sZ[Hj[3]]=sZ[Hj[10]]*Hj[9];else sZ[Hj[3]]=D(Hj[7],Hj[9]);end;end;else if(Wj~=45)then (sZ)[Hj[3]]=Z(Hj[7],Hj[9]);else do sZ[Hj[3]]=sZ[Hj[10]]>Hj[9];end;end;end;else if(not(Wj>=40))then if(Wj~=39)then do if(Hj[5]==144)then TZ=TZ-1;do Og[TZ]={[5]=(Hj[10]-194)%256,[1]=72,[3]=(Hj[3]-p8)%k8};end;elseif(Hj[5]~=247)then do repeat local wt,Tt=Rg,(sZ);if(not(#wt>0))then else local km=({});for r0,R0 in H,wt do do for fL,TL in H,R0 do do if(not(TL[1]==Tt and TL[2]>=0))then else local p0=(TL[2]);if(not(not km[p0]))then else do km[p0]={Tt[p0]};end;end;TL[1]=km[p0];TL[2]=1;end;end;end;end;end;end;until(u8);end;local xx=(Hj[3]);return C8,xx,xx+Hj[10]-2;else TZ=TZ-1;Og[TZ]={[3]=(Hj[3]-206)%256,[10]=(Hj[10]-206)%256,[1]=89};end;end;else sZ[Hj[3]]=i(sZ[Hj[10]]);end;else if(Wj==41)then LZ[Hj[6]]=sZ[Hj[3]];else sZ[Hj[3]]=Hj[7]+Hj[9];end;end;end;end;else if(not(Wj<34))then if(not(Wj<36))then if(Wj~=37)then sZ[Hj[3]]=M(sZ[Hj[10]],Hj[9]);else local BO=(Hj[3]);local hO=sZ[BO+2];local QO=(sZ[BO]+hO);sZ[BO]=QO;do if(not(hO>0))then if(QO>=sZ[BO+1])then TZ=Hj[4];(sZ)[BO+3]=QO;end;else if(not(QO<=sZ[BO+1]))then else do TZ=Hj[4];end;(sZ)[BO+3]=QO;end;end;end;end;else if(Wj~=35)then do YZ=Hj[3];end;(sZ)[YZ]=sZ[YZ]();else do if(not(not(sZ[Hj[10]]<Hj[9])))then else TZ=TZ+1;end;end;end;end;else do if(not(Wj>=32))then local XE=Hj[3];sZ[XE](N(sZ,XE+1,YZ));YZ=XE-1;else if(Wj==33)then sZ[Hj[3]]=k(sZ[Hj[10]],sZ[Hj[5]]);else (sZ)[Hj[3]]=LZ[Hj[6]];end;end;end;end;end;else do if(not(Wj<54))then if(Wj>=58)then do if(not(Wj<60))then do if(Wj==61)then local wp=(Hj[10]);do (sZ)[Hj[3]]=sZ[wp]..sZ[wp+1];end;else (sZ)[Hj[3]]=D(sZ[Hj[10]],sZ[Hj[5]]);end;end;else if(Wj~=59)then do sZ[Hj[3]]=Hj[7]~=Hj[9];end;else do sZ[Hj[3]]=sZ[Hj[10]]>sZ[Hj[5]];end;end;end;end;else if(not(Wj<56))then do if(Wj==57)then local UG=(Gg[Hj[10]]);(sZ)[Hj[3]]=UG[1][UG[2]];else sZ[Hj[3]]={};end;end;else if(Wj==55)then local sI=Hj[3];YZ=sI+Hj[10]-1;sZ[sI](N(sZ,sI+1,YZ));YZ=sI-1;else sZ[Hj[3]]=sZ[Hj[10]]%sZ[Hj[5]];end;end;end;else if(not(Wj<50))then if(not(Wj<52))then if(Wj~=53)then do for ko=Hj[3],Hj[10] do do sZ[ko]=F8;end;end;end;else sZ[Hj[3]]=Hj[7]^Hj[9];end;else if(Wj~=51)then (sZ)[Hj[3]]=-sZ[Hj[10]];else do (sZ)[Hj[3]]=Hj[7]>=sZ[Hj[5]];end;end;end;else if(not(Wj<48))then if(Wj==49)then local Bl=(Hj[3]);local Fl,hl=sZ[Hj[10]],(sZ[Hj[5]]);sZ[Bl+1]=Fl;do (sZ)[Bl]=Fl[hl];end;else sZ[Hj[3]]={N({},1,Hj[10])};end;else if(Wj==47)then if(sZ[Hj[10]]~=Hj[9])then TZ=TZ+1;end;else local CT=(Hj[10]);local DT=sZ[CT];for Yu=CT+1,Hj[5] do DT=DT..sZ[Yu];end;sZ[Hj[3]]=DT;end;end;end;end;end;end;else do if(not(Wj>=15))then if(not(Wj>=7))then if(not(Wj<3))then if(not(Wj>=5))then if(Wj==4)then do sZ[Hj[3]]=Hj[6];end;else local MY=(jg[Hj[4]]);local lY=(F8);local BY=(MY[4]);do if(not(BY>0))then else lY={};for FK=0,BY-1 do local nK=(Og[TZ]);local eK=nK[1];if(eK~=17)then lY[FK]=Gg[nK[10]];else lY[FK]={sZ,nK[10]};end;TZ=TZ+1;end;t(Rg,lY);end;end;do (sZ)[Hj[3]]=G8(LZ,lY,MY);end;end;else if(Wj~=6)then sZ[Hj[3]]=b(Hj[7],Hj[9]);else sZ[Hj[3]]=sZ[Hj[10]]<sZ[Hj[5]];end;end;else if(not(Wj>=1))then sZ[Hj[3]]=C8;else if(Wj==2)then local Fb=Hj[7]/Hj[9];sZ[Hj[3]]=Fb-Fb%1;else local vc=(Hj[3]);do sZ[vc]=sZ[vc](sZ[vc+1]);end;YZ=vc;end;end;end;else if(Wj<11)then if(not(Wj<9))then if(Wj~=10)then local KD=sZ[Hj[10]]/sZ[Hj[5]];sZ[Hj[3]]=KD-KD%1;else do if(not(not(Hj[7]<=sZ[Hj[5]])))then else TZ=TZ+1;end;end;end;else if(Wj==8)then local YQ=(Hj[3]);sZ[YQ](sZ[YQ+1]);YZ=YQ-1;else sZ[Hj[3]]=a8[Hj[10]];end;end;else if(not(Wj>=13))then do if(Wj~=12)then local yH=(Hj[3]);do (sZ)[yH]=sZ[yH](sZ[yH+1],sZ[yH+2]);end;do YZ=yH;end;else (sZ[Hj[3]])[sZ[Hj[10]]]=sZ[Hj[5]];end;end;else do if(Wj==14)then local lC=(Hj[3]);do sZ[lC]=sZ[lC](N(sZ,lC+1,YZ));end;YZ=lC;else (sZ)[Hj[3]]=sZ[Hj[10]]==sZ[Hj[5]];end;end;end;end;end;else if(not(Wj<23))then if(not(Wj>=27))then if(not(Wj<25))then if(Wj==26)then do (sZ)[Hj[3]]=sZ[Hj[10]]>=Hj[9];end;else (sZ)[Hj[3]]=u8;TZ=TZ+1;end;else do if(Wj~=24)then local kQ=Hj[3];local UQ=(kQ+2);local yQ=kQ+1;do (sZ)[kQ]=a(w(sZ[kQ]),y8);end;do sZ[yQ]=a(w(sZ[yQ]),e8);end;(sZ)[UQ]=a(w(sZ[UQ]),o8);(sZ)[kQ]=sZ[kQ]-sZ[UQ];do TZ=Hj[4];end;else sZ[Hj[3]]=sZ[Hj[10]]>=sZ[Hj[5]];end;end;end;else do if(not(Wj<29))then do if(Wj==30)then if(Hj[5]==8)then TZ=TZ-1;(Og)[TZ]={[3]=(Hj[3]-28)%256,[10]=(Hj[10]-28)%256,[1]=90};elseif(Hj[5]~=24)then sZ[Hj[3]]=#sZ[Hj[10]];else do TZ=TZ-1;end;do Og[TZ]={[1]=85,[3]=(Hj[3]-147)%256,[10]=(Hj[10]-147)%256};end;end;else repeat local v5,e5=Rg,sZ;if(not(#v5>0))then else local Mc={};for LI,mI in H,v5 do for ez,Kz in H,mI do if(not(Kz[1]==e5 and Kz[2]>=0))then else local UN=Kz[2];do if(not(not Mc[UN]))then else (Mc)[UN]={e5[UN]};end;end;(Kz)[1]=Mc[UN];Kz[2]=1;end;end;end;end;until(u8);return C8,Hj[3],YZ;end;end;else if(Wj==28)then sZ[Hj[3]]=sZ[Hj[10]]~=sZ[Hj[5]];else local Rz=Gg[Hj[10]];Rz[1][Rz[2]]=sZ[Hj[3]];end;end;end;end;else if(not(Wj>=19))then if(not(Wj<17))then if(Wj==18)then a8[Hj[10]]=sZ[Hj[3]];else if(Hj[5]==44)then TZ=TZ-1;do Og[TZ]={[1]=29,[3]=(Hj[3]-37)%k8,[10]=(Hj[10]-37)%256};end;elseif(Hj[5]==241)then TZ=TZ-1;do (Og)[TZ]={[10]=(Hj[10]-209)%256,[1]=117,[3]=(Hj[3]-209)%k8};end;else do (sZ)[Hj[3]]=sZ[Hj[10]];end;end;end;else if(Wj==16)then sZ[Hj[3]]=M(sZ[Hj[10]],sZ[Hj[5]]);else do if(sZ[Hj[10]]~=sZ[Hj[5]])then TZ=TZ+1;end;end;end;end;else do if(not(Wj<21))then if(Wj==22)then repeat local et,jt=Rg,sZ;if(not(#et>0))then else local CY=({});do for AU,uU in H,et do for qR,QR in H,uU do do if(not(QR[1]==jt and QR[2]>=0))then else local Db=QR[2];if(not(not CY[Db]))then else do CY[Db]={jt[Db]};end;end;QR[1]=CY[Db];QR[2]=1;end;end;end;end;end;end;until(u8);return u8,Hj[3],1;else (sZ)[Hj[3]]=M(Hj[7],Hj[9]);end;else if(Wj~=20)then (sZ)[Hj[3]]=sZ[Hj[10]]^Hj[9];else do sZ[Hj[3]]=Hj[7]~=sZ[Hj[5]];end;end;end;end;end;end;end;end;end;end;end;end;end);if(not(AZ))then if(q(pZ)~=qz)then v(pZ,0);else if(not(X8(pZ,dz)))then else do return vz();end;end;do if(not(X8(pZ,fz)))then v(pZ,0);else (v)("Luraph Script:"..(zg[TZ-1]or"(internal)")..": "..d(pZ),0);end;end;end;else if(pZ)then if(EZ==1)then return sZ[JZ]();else do return sZ[JZ](N(sZ,JZ+1,YZ));end;end;elseif(JZ)then return N(sZ,JZ,EZ);end;end;end;do if(not(T))then else T(Ag,ag);end;end;do return Ag;end;end;q8=0;local w8,L8=F8,F8;repeat if(q8~=0)then L8=w8();q8=2;else function w8()local ir,Ir={{},F8,{},F8,{},F8,F8,F8,F8},2;local Ar,Ur,ar=F8,F8,F8;do repeat if(not(Ir<=0))then if(Ir~=1)then Ar={};do Ir=0;end;else do ar=1;end;Ir=3;end;else Ur={};Ir=1;end;until(Ir>=3);end;local gr,Sr,qr=F8,F8,F8;for Jv=0,7 do if(Jv<=3)then if(not(Jv<=1))then if(Jv==2)then Sr=J();else do ir[9]=j(Sr,1,1)~=0;end;end;else if(Jv==0)then gr=h();else for fP=1,gr do do (ir[3])[fP-1]=w8();end;end;end;end;else if(Jv<=5)then if(Jv~=4)then qr=h();else do (ir)[8]=j(Sr,2,1)~=0;end;end;else if(Jv~=6)then do ir[16]=J();end;else for kv=1,qr do local Qv,vv,Nv,ev=3,F8,F8,(F8);while(Qv<=3)do do if(not(Qv<=1))then if(Qv~=2)then do vv=h();end;do Qv=1;end;else ev=h();Qv=0;end;else if(Qv~=0)then Nv=h();Qv=2;else for CR=vv,Nv do (ir[5])[CR]=ev;end;Qv=4;end;end;end;end;end;end;end;end;end;(ir)[18]=h();do ir[17]=J();end;local wr=(h()-133746);local er=(J());do Ir=2;end;local Kr,Tr=F8,F8;repeat if(not(Ir<=3))then if(not(Ir<=5))then if(Ir~=6)then (ir)[2]=J();Ir=5;else (ir)[18]=h();Ir=0;end;else if(Ir~=4)then do (ir)[17]=h();end;Ir=3;else do Tr=J();end;break;end;end;else if(not(Ir<=1))then if(Ir==2)then for WE=1,wr do local EE,DE,QE=0,F8,F8;while(EE<2)do if(EE~=0)then QE=Y(er);EE=2;else DE={F8,F8,F8,F8,F8,F8,F8,F8,F8,F8};do EE=1;end;end;end;EE=2;while(EE~=9)do do if(not(EE<=3))then if(not(EE<=5))then if(not(EE<=6))then if(EE~=7)then DE[11]=j(QE,1,7);EE=9;else DE[17]=j(QE,13,12);EE=8;end;else (DE)[17]=j(QE,15,17);EE=1;end;else if(EE~=4)then do DE[5]=j(QE,23,9);end;EE=6;else DE[5]=j(QE,23,9);do EE=2;end;end;end;else if(not(EE<=1))then if(EE==2)then (DE)[4]=j(QE,14,18);EE=5;else (DE)[10]=j(QE,14,9);EE=7;end;else if(EE~=0)then (DE)[1]=J();EE=0;else DE[3]=j(QE,6,8);do EE=3;end;end;end;end;end;end;ir[1][WE]=DE;end;do Ir=7;end;else ir[4]=J();do Ir=6;end;end;else if(Ir~=0)then do Kr=h()-133785;end;Ir=4;else ir[14]=J();Ir=1;end;end;end;until(C8);local ur=(J()~=0);for cr=1,Kr do local br,mr,Rr=1,F8,F8;while(br<2)do do if(br~=0)then br=0;else do Rr=J();end;br=2;end;end;end;do br=1;end;do while(br<2)do if(br~=0)then do if(Rr==150)then mr=f(C(Tr),J());elseif(Rr==122)then mr=S();elseif(Rr==237)then do mr=S();end;elseif(Rr==245)then mr=h();elseif(Rr==8)then mr=K();elseif(Rr==230)then mr=u8;elseif(Rr==49)then mr=K();elseif(Rr==146)then do mr=S();end;elseif(Rr==199)then do mr=f(C(Tr),2);end;elseif(Rr~=13)then else mr=C8;end;end;do br=2;end;else do if(Rr==150)then mr=f(C(Tr),J());elseif(Rr==122)then mr=S();elseif(Rr==237)then mr=S();elseif(Rr==245)then mr=h();elseif(Rr==8)then mr=K();elseif(Rr==230)then mr=u8;elseif(Rr==49)then mr=K();elseif(Rr==146)then mr=S();elseif(Rr==199)then mr=f(C(Tr),2);elseif(Rr~=13)then else do mr=C8;end;end;end;br=0;end;end;end;do (Ar)[cr-1]=ar;end;local Or={mr,{}};do (Ur)[ar]=Or;end;ar=ar+1;do if(ur)then local tN=1;do repeat if(tN~=0)then (o)[p]=Or;tN=0;else p=p+1;tN=2;end;until(tN==2);end;end;end;end;(ir)[17]=J();(ir)[6]=J();local Wr=(y[ir[6]]);for iT=1,wr do local tT=0;local hT,vT,VT=F8,F8,F8;do while(tT~=4)do if(tT<=1)then if(tT~=0)then if((vT==9 or VT)and hT[5]>255)then local TI=(2);local LI,vI=F8,(F8);repeat if(not(TI<=1))then do if(TI~=2)then do LI=Ar[hT[5]-256];end;TI=0;else hT[2]=u8;TI=3;end;end;else do if(TI~=0)then if(not(vI))then else local EW=F8;for Ym=0,2 do if(not(Ym<=0))then if(Ym==1)then do EW=vI[2];end;else do EW[#EW+1]={hT,9};end;end;else (hT)[9]=vI[1];end;end;end;TI=4;else vI=Ur[LI];TI=1;end;end;end;until(TI==4);end;do tT=4;end;else hT=ir[1][iT];tT=2;end;else do if(tT~=2)then VT=vT==4;do tT=1;end;else vT=Wr[hT[1]];tT=3;end;end;end;end;end;tT=2;repeat do if(not(tT<=0))then if(tT~=1)then do if(not((vT==2 or VT)and hT[10]>255))then else hT[8]=u8;local IJ=(Ar[hT[10]-256]);local pJ=(Ur[IJ]);if(not(pJ))then else hT[7]=pJ[1];local I3=0;local L3=F8;while(I3<=1)do if(I3~=0)then do (L3)[#L3+1]={hT,7};end;I3=2;else L3=pJ[2];I3=1;end;end;end;end;end;tT=1;else if(vT~=6)then else (hT)[4]=iT+(hT[4]-131071)+1;end;tT=0;end;else do if(vT~=3)then else local IM=(Ar[hT[4]]);local ZM=(Ur[IM]);if(not(ZM))then else do (hT)[6]=ZM[1];end;local wV=(ZM[2]);wV[#wV+1]={hT,6};end;end;end;do tT=3;end;end;end;until(tT>2);end;Ir=0;do while(u8)do if(not(Ir<=2))then do if(not(Ir<=3))then if(Ir==4)then do ir[12]=J();end;Ir=2;else (ir)[12]=h();do Ir=3;end;end;else do return ir;end;end;end;else do if(not(Ir<=0))then if(Ir==1)then (ir)[7]=J();do Ir=5;end;else (ir)[12]=J();do Ir=1;end;end;else (ir)[13]=J();Ir=4;end;end;end;end;end;end;q8=1;end;until(q8>1);a8[1]=o;o=F8;return G8(l,F8,L8)(...);end)("\98\97\110\100","\96\102\111\114\96\32\115\116\101\112\32\118\97\108\117\101\32\109\117\115\116\32\98\101\32\97\32\110\117\109\98\101\114",2047,194,127,rawget,"\96\102\111\114\96\32\108\105\109\105\116\32\118\97\108\117\101\32\109\117\115\116\32\98\101\32\97\32\110\117\109\98\101\114","\114\115\104\105\102\116",bit32,"\46\46","\94\46\45\58\37\100\43\58\32",string,bit,"\98\111\114",setfenv,"\108\115\104\105\102\116","\115\117\98",_ENV,"LPH-1FFC013FFFF443F44FF4444FF44F446F3HF4FF434F644F342H444F9F2H4FF4FF44F4444F4943444F462H44944FFF44F42H4F9FFF442HF42H444FFFF44F2HF4444F04023H00067H0003353H00013H00083H00013H00093H00093H00FCC2957B0A3H000A3H004D1824130B3H000B3H00BC5F29670C3H000C3H0025C3D72E0D3H000D3H005ACFE2530E3H000E3H006B1947330F3H000F3H00DF4BE918103H00103H00FA9B9122113H00113H00F7A66862123H00123H004DB7BA18133H00183H00013H00193H00193H00363H001A3H001B3H00013H001C3H001D3H00363H001E3H001F3H00013H00203H00213H00363H00223H00263H00013H00273H00283H00383H00293H002A3H00013H002B3H002D3H003A3H002E3H002F3H00013H00303H00313H003A3H00323H00333H00013H00343H00343H003A3H00353H00363H00013H00373H00393H003A3H003A3H003A3H003B3H003B3H003F3H00013H00403H00413H003A3H00423H00423H003B3H00433H00493H00013H004A3H004B3H00323H004C3H004C3H00333H004D3H004E3H00013H004F3H00503H00333H00513H00513H00343H00523H00533H00013H00543H00563H00353H00573H00573H00333H00583H00593H00343H005A3H005A3H00323H005B3H005C3H00013H005D3H005E3H00323H005F3H005F3H00333H00603H00613H00013H00623H00623H00333H00633H00643H00013H00653H00663H00333H00673H00683H00013H00693H006A3H00333H006B3H006B3H00353H006C3H006C3H00013H003686D3851E0FDE0A0200B52HFCEC7C4A31F13EB14A860689064AFB3B2HFB0390509390202H454145041A9A236B300F4FB47B30E4D483EB50D94FB48A606E53CE550223D8E2550AF8D54CB3336D23193311C2DD9D8072F7120F491C8C1C7FFC03C1EF88A647D656DD564A4BCA494B203HE0604A95549695202A2B6B6A043H5FDF4A74F477F44A29682HA911FEBEFE7E4A3332F2702E084808884A7DFC2HBD0492526CED4A87060787089C1C61E34AD150D3D1203H26A64A9B5A989B2070F12H300465A42HE504FAFBBBB93DAF2E2FAF08C445C6C420F939FA794A8E8F4F4E044342C3C20198595B5804CD0C2H0D4862485E9C27979656D42EEC6D6CEC083H21A14A76373F7634EB6A2HEB203H80004A35F43635204A0B2H0A117FBE2HFF1154A1A76F2649482H495CDE2H9F9E0453122H1348E8A9394371DDDC5C5D2032F2CD4D4AA72HA6A25F2H3CC6434A313B78671146A3E3CA1E3BBA393B203HD0504A85448685201A1B595A040F4E2H4F48E4C13152309918199908EEAEED6E4A2362616304B8F92HF8486DB675557102C32H8211773776F74A8C0D0C8C083HC1414A16975F16344B3H8B4820E0D25F4AD515D1554A6AEB2HAA04DFDE1E9C2EB43449CB4AE968EBE9203H3EBE4AB372B0B32008492H48047DBCFFFD205293D2D3223HC7474A5C1DD9DC34D1502H1104A6672H66485BFF945C6D3031F1732E25A4A525083HFA7A4AEF6EFFEF3404850604202H39C1464A8E4E67F14A83C0804454080E702E0C0097A35D70DAA70A0200850EC7103H001FE0AAA0CDBD173053452E08F974C0B0C7023H006F21C7093H0051F64C4E80761789E4C7163H009C399591E694F071B43BB224806CD3A5A683353F74B5C70E3H004AB6D4829F13F1E2F83FF987DE2EC7133H0060236747286E322FE2318052FEE6110BF0B9A7C7033H0091CDD7C7093H002EA0F0070CA0E93029C70D3H004D68B608793593D837EA7A4202C7123H00EC9886C701B65EF604EEAF7FD21247FBA8BBC70D3H00163BB1BE01671A15327AA7DE46C7053H00695900595CC7043H00B0E09944C7163H00149758806C9EBBAF3A0BC5426A1E0ACCBF1B6A47B0D177001DCBA0029209ED545H001D3H00013H00083H00013H00093H00093H0048E1CC590A3H000A3H00B09D83090B3H000B3H00246047450C3H000C3H00AF123F550D3H000D3H000747B15B0E3H000E3H00CCC1AD130F3H000F3H00C72DA512103H00103H002DF78B1D113H00113H00013H00123H00123H000A3H00133H00133H00013H00143H00153H000A3H00163H00183H00013H00193H001B3H000B3H001C3H001E3H00013H001F3H00213H00093H00223H00223H00013H00233H00253H00073H00263H00283H00013H00293H002B3H000B3H002C3H002D3H00013H002E3H002E3H00083H002F3H00303H00013H00313H00313H00083H00323H00333H00013H00343H00343H000C3H00353H00383H00013H00393H00393H000C3H00EAEC27FD7E04AB0A0200C398589F184A5BDB5CDB4AFEBEF97E4A81412H8103E4A4E5E42027A72627044A8A7238304DCDF7392H30B6B41020F3585F6570561C94772D99666BA6117C6323020A7FBFE836446206B9AE456570717325C808CB484A2H8B8D0B4AAE3H2E11F12H31B10814D4EA6B4A17972H57207AFA84054A3DBD2H7D20A0D05028262H2327A34A2HC6C0464A09892H49203HAC2C4A2HAFEEEF20523H12482H1514954AF83804874AFB3B2HBB209EEE6E1626E1611C9E4A448446C44AC7072H87203HAA2A4A2HEDACAD205020A0D826531351D34AF6360C894AF9BAFA3E545C3HDC115F2H9F1F083H42C24A2H054145342868D6574AAB6B2HEB202H8E70F14A91581807112H342H7420373HB7045A3HDA489DFAB2147980402HC07703E6A42D7C006A48A371D29D0A0200956BC7283H008207BFEE73E2B3C057D4029862ACAA87EECD9A1116D914679B24FA2324682F905E9122ECFAE3B380C7063H002A45F374BFA9C70E3H00884C5305CE658FA655BEA233AE82C70D3H001EC8585158543352EB295E812F26000A64AB2H019B94374H0003333H00013H00083H00013H00093H00093H00E3110F130A3H000A3H005DA8FD5B0B3H000B3H0001629C760C3H000C3H00939BDA4A0D3H000D3H00A197D32H0E3H000E3H00C6AD357C0F3H000F3H00E421285D103H00103H0067A3DC52113H00113H0086749970123H001A3H00013H001B3H001F3H001E3H00203H00203H00013H00213H00213H00213H00223H00223H00203H00233H00243H00013H00253H00253H00203H00263H00273H00013H00283H00293H00203H002A3H00323H00013H00333H00333H00203H00343H00353H00013H00363H00383H00203H00393H003A3H00013H003B3H003F3H00203H00403H00403H00213H00413H00483H00013H00493H004A3H001C3H004B3H004C3H00013H004D3H004D3H001C3H004E3H00513H00013H00523H00523H00183H00533H00543H00013H00553H00583H00183H00593H005A3H00013H005B3H005B3H00193H005C3H005D3H00013H005E3H005E3H00193H005F3H00603H00013H00613H00633H00193H00643H00653H00013H00663H00683H001A3H00693H006A3H00013H006B3H006D3H001B3H006E3H006F3H00013H00703H00703H00193H00713H00723H00013H00733H00743H00193H00753H00763H00013H00773H00783H00193H00793H00793H001B3H006497ED9C4704EB0A020049834399034AAC2CB62C4A75356FF54ADE9EDFDE03E727E4E7202H909490042HD9E1A8302HC2F8B6300B932741603466DA7971BDC44A6C61E66A776135AF8E7A5C1ED854227E6EE12HEE01198A3FD6BD7C5344E1AD6D3CBC2ABC4A05040605206EAE91114A373675770460212H2048E9C9B2557AD2D32H52045BDA2HDB484450AD1E0F8D8CCCCE3D36F6C9494A3FBEBF3F08E82817974A317133B14A9AD9995D54E3E9AAB511CC4D4CCC083H95154AFE7F9FFE3407C60607203HB0304AF938FAF920A2E32HE2116BEB6FEB4A94959794203H5DDD4AC607C5C6208FCE2HCF0438792H784881D02046032AEB2HAA203H33B34ADC9D5F5C20A5A424A05F3H8E0E4A175694972080414240040908898801B22H7372043BFA2HFB48A49D445762ADAC6CEE2E2H56AF294ADF1E2H5F1108C8F7774A11E4E22A263A3B2H3A5CC3C2C0C3203HEC6C4AB574B6B5205E5F1D1E04A7E62H271110512HD004D9182H194882CFC31007CBCA0A882EB43534B4083H7DFD4AE6E793E634EF2F19904A98999B9820A120E3E1048ACB2HCA4813329B536A7CFDFC7C083H45C54AAEAFE1AE34B7B6B4B72060A09F1F4AE928A8A90412532H92203H1B9B4AC4854744208D4C0D0C223H76F64AFFFE747F34E8A92H2804B1702H71485AB9582E29A3A262E02E2H0C0F8C4A15542HD504FE3F2H3E48875FFCB42BB0B171F32E39F9C6464A22A3A222083HAB2B4AD415F2D434DD2CADD5260646EF794A0F8F0D8F4A78382HB86F0141F67E4AEA6B6AEA083H73F34A9C5DBC9C3465646665208E8FCFCE0497D62HD748801882AD3C49882HC911B2F248CD4A3BBBCA444A08426C604700B445D41B06A70A0200CDF5C70E3H009106206AEB93ED7A348F0DBFAA8EC7033H00576252C7023H00EC10C7123H00FE083E9F4976B60E8CBE8717CAB23F33104BC7043H0030EE9BF6C70D3H00647D09255A98248D74FF159FA1C7103H00FFB872402DB57F80E36DA608390CB880C7083H000F9B17DB67B4D6B3C7093H0097175174CDFF48D308C7163H005249D5290634E0B974ABD28CC08C83FDE693752754D5C7053H00181665AA51C7163H00DB8B2854747A5BD362279596A2BAAAC057E73A73C8F5C70D3H00D961CBC8FFED502BB4B06D88A8C7133H0060DD218542381C0DA89F26F064106FE9CA27A102007F6B34024942CD6F4H0003173H00013H00083H00013H00093H00093H00C2DA615E0A3H000A3H0032FD1F2B0B3H000B3H001CA52D510C3H000C3H003D1601510D3H000D3H008B91D26D0E3H000E3H00750285210F3H000F3H0027147F5B103H00103H00C5AE1941113H00113H00013H00123H00123H00403H00133H00143H00013H00153H00173H00403H00183H00193H00013H001A3H001C3H00403H001D3H00213H00013H00223H00223H00433H00233H00253H00013H00263H00283H00403H00293H002A3H00013H002B3H002D3H00403H002E3H002F3H00013H00303H00303H00433H0084A96DF96CD5A20A02003964E467E44A1D5D1E9D4A2H7675F64A6FAF2H6F03088809082041814041042H1A236A302H93A8E730AC6B064546E5198AB9023EC42B632477A1320D66104717C31249B0D10C20A2631F9063DB0E3BB13034B42HF4202H6DAD2C5F3H06864A3F7FFEFF202H5818194291D02HD1042H6AAAAB0B3H23A34AFCBC253C34B52465A45A4E0E4ACE4A470746C74A203HE03919182H1911F2320D8D4A2B2A2H6B11843137FF26FD3H3D5C56D62H96203H8F0F4AE8A82928202HA161E05F2HFABABB42F32HB2B3048CCD2HCC48C5136A49192H1EDEDF0B9766E79F2670F08B0F4A69E92HA952024101C5543B3HFB1D07CEB9A041011672D15F539E0A02008572C7193H00F9247F63D9BFBC44C403999D85518E69D5F7535232DFA14B99C7093H00F4657E6AA39E19E71AC7043H006B7FE24AC7053H009FEB98BB8DC71C3H00DE9A6591EF39A626251ECC0C9F59B9ED45AEA54D3BD3D62AEBC17751DF00CA3CF20236D375444H0003253H00013H00083H00013H00093H00093H008B51D5180A3H000A3H00FC1E916A0B3H000B3H0024EBA6760C3H000C3H0021D9BA390D3H000D3H001DA3696D0E3H00143H00013H00153H00153H00253H00163H00173H00013H00183H00193H00253H001A3H001B3H00013H001C3H001C3H00263H001D3H001E3H00013H001F3H00223H00263H00233H00243H00273H00253H00263H00013H00273H00293H00283H002A3H002C3H00013H002D3H002E3H00293H002F3H00303H00013H00313H00313H00293H00323H00393H00013H003A3H003A3H002E3H003B3H00403H00013H00413H00423H002B3H00433H00453H00013H00463H00473H002D3H00483H00493H00013H004A3H004B3H002D3H004C3H004D3H00013H004E3H004F3H002D3H00503H00513H00013H00523H00523H002D3H00533H00543H00013H00553H00573H002D3H00583H00583H002E3H00593H00593H00013H00F897570F0C39CB0A02001B14D416944AAF2FAD2F4A2A6A28AA4A2H85848503C040C3C020DB1BD8DB04D616EEA7302HB10AC530EC4EEBD15E07FAD2573F42534D084BDD918E604AD8B8E10E2EF3A7275C552EEF2F2E203H09894AC445C7C4201FDE5E5F049ADB2HDA4835F76BA66D70F1F070083H8B0B4A86C7F9863461A06061205CDD1E1C04F7B62HB748F230E95D7A8D0C0D8D083HC8484AE3E28EE334DE1FDFDE20F9F8B8B904F4352H7411CFCE2H0F04CACB0B892EE56465E5083H20A04A3B3A403B347687067E26115115914ACC0CCD4C4AA7A62H670422E32HE2483D07F59B603839F97B2E93121393083H8E0E4A69E85F69342H2420A44ABF7EBEBF203H3ABA4A951496952090912HD004ABEA2HEB48A66DB3592H41002HC1117CBC87034A575D1E01119253939220ADEC2HED0468292H2848435E9BED1EBEFF2H3E0419D9E6664A9495D5D73D6FEEEF6F08EA2BEBEA2005C42H450400818280201B1A9A1E5F562H979604B1702H7148ECAFBA6F764746C7C60182434142045D9C2H9D48D8E331EB71B3B272F02EEE6F6EEE083HC9494A8485B884341F5E1D1F203H9A1A4AF574F6F52070312H3011CB0A2H4B1106F3F53D2621202H212H5C1F5F9B5408DAB12B56008EE4100081A60A02001971C7163H003A2F974F4C427A6F16BD609ACA6A59FBF4959721BE23C7133H009C8076C48DC5FB74E7E281414BED98B085BA36C70E3H00A1FDF9C1AEB0FC79A1F474343FBDC7023H001BA2C7093H00D1765A41C6D67B566BC70D3H0040FC1A4891115F90970EB6F2EAC7163H00E3F9CE4E4A00EDD12C65E32CDC80CC12F915FCA9F68FC70D3H0095D3395A05E78AC176B20F0AB2C7033H0050783CC70B3H00C599ED1A931CEA2B1FAAFBC7053H00BAB914358CC71B3H00F564E2803929D738F7B12698FD9050B83D81560F604ECF7B4EE798C7043H001A6986C1640038254102E021614B4H0003253H00013H00083H00013H00093H00093H00A1AFFF250A3H000A3H00463BD55E0B3H000B3H00C08CF3380C3H000C3H002H5D47740D3H000D3H001C5CA4190E3H000E3H00F071F71A0F3H000F3H00FD4D654F103H00103H00D9399671113H00113H00013H00123H00123H00563H00133H00143H00013H00153H00173H00513H00183H00193H00013H001A3H001A3H00513H001B3H00293H00013H002A3H002C3H00533H002D3H002F3H00013H00303H00323H004D3H00333H00343H00013H00353H00353H004E3H00363H00373H00013H00383H00383H004E3H00393H003A3H00013H003B3H003B3H004E3H003C3H003D3H00013H003E3H003F3H004F3H00403H00413H00013H00423H00433H004F3H00443H00463H00503H00473H004D3H00013H004E3H00533H00553H00543H00553H00013H00563H005B3H00553H005C3H005D3H00013H005E3H005F3H00553H00603H00603H00563H008BD0148D7E8AD20A02000177F77DF74AD898D2584A2HD9D3594A7A3A7B7A03BB3BB8BB209C5C9F9C041D5DA46F303EBE054B30BF0621253A2025A0136A612E27F464C2E6A4153443AD88F2116427018846A52149C072864350E62E870781074AE8A2E1FE11692HE8E9048A4A75F54ACB2HCAC82EAC6C53D34AED2HAD2D083H4ECE4ACF0F3B0F3470B07AF04AB1317371203H12924A93D350532034B5353404B5754ACA4A96572HD6112H976BE84AF8B82HF852F938FBF9049A9B2H9A489B866ADE12FC2HBDBC043D7D3DBD4A9E1E5C5E202H1FE1604A808101823D412H018108226224A24A2HE32H636F8404464420C5C42HC504262H66E60867E7A5A72008892H080409082H0948AA4F265E4D2B2H6BEB083HCC4C4A8D0D154D34AE2E6C6E203H2FAF4A501093902091D02H910432332H3248B372BDE05F145554D15F552HD4D50476F72HF648774AEAF778182H191B2ED92H9919083A3HBA48FBBB03844ADC1C28A34A9D1D5F5D207EBF7F7E043F3E2H3F48609FBAA23BE1602HA1203H42C24AC3028083202425E5E65F65E4E6E50406C6F9794A8746C7C60128E829A84AE92HA929083HCA2H4ACB4B560B342C3HEC396DAD92124A8E8F2H8E118FFBFC34262HB0B1304A31B0B3B104D2532H524813E7660C44742H75772EF575098A4AD63H165C07A311031501ECFC2903EDA60A02007DB2C7163H0046F4495F95DD3AB8F328546D233D2BBB06F85BF86952C70D3H005CE90DA9E6D4C849F0EB91430DC71C3H00B7849E64A951EBBCEF017A2C1D886CCC311DF0EAA07927C947173ACEC7033H00D36834C7023H003806C7053H007A21F87124C7133H0075881610C1A543702B8AD1C567DD6064C992F6C70E3H0072EB77DFB07662176F127AAA810BC7043H00403A177AC70D3H0054523AAFC6CE31B43DA33C0F21C7043H004FC9E430C7163H00137F8F2BE02HFAAB7A5D388E269269AF98C54FE5B2DBC7093H00613F7534F14724F3FC2E0093D66D01BFC4851A02433H00013H00083H00013H00093H00093H009BD8DE4D0A3H000A3H00DF1C84040B3H000B3H0016552D0B0C3H000C3H00A1447B470D3H000D3H00612HE4620E3H000E3H00FCD0834A0F3H000F3H0018412850103H00113H00013H00123H00133H00113H00143H00183H00013H00193H001B3H00103H001C3H001C3H00013H001D3H001E3H00493H001F3H00203H00013H00213H00223H00493H00233H00243H00013H00253H00253H004A3H00263H00303H00013H00313H00313H00583H00323H00333H00013H00343H00353H00583H00363H00373H00013H00383H00383H00033H00393H003A3H00013H003B3H003B3H00033H003C3H003E3H00013H003F3H00423H00113H00433H00453H00013H00463H00463H003F3H00473H00483H00013H00493H004E3H003F3H004F3H00583H00013H00593H005B3H00483H005C3H005C3H00463H005D3H00643H00013H00653H00673H00123H00683H00683H00133H00693H006A3H00013H006B3H006B3H00133H006C3H006D3H00013H006E3H006E3H00133H006F3H00703H00013H00713H00713H00143H00723H00763H00013H00773H00773H00163H00783H007A3H00013H007B3H007D3H00233H007E3H00813H00013H00823H00823H00303H00833H00863H00013H00873H00873H003D3H00883H00893H00013H008A3H008A3H003D3H008B3H008C3H00013H008D3H008F3H003D3H00903H00923H00013H00933H00933H00103H00943H00953H00013H00963H00983H00103H00993H009A3H00013H009B3H009B3H00103H009C3H00A53H00013H00A63H00A93H00483H00AA3H00AC3H00023H00AD3H00B53H00013H00B63H00B63H00023H000DBC5B000A64280B0200452HD7FC574A7CBC56FC4A41C16BC14A26662426032BAB2D2B2050905650042H95ADE730FA3AC08D30FF737CD9192404E9E055E90656C3514E7D1EE6601348DC5270F8625367667DA1429C19A2E285224AA7272627202H4CCC4C5F2H9182114A2H767276203H7BFB4AA020A6A020E525F8654A0A4A4B4A202H8FCF4B5F74B48B0B4A39F93EB94ADE5E1C1E202HE3A3A55F48894B48203H8D0D4AF273F4F22037367577209C1D2H1C0061E061E172C6A0A14334CB0A4BCB67F0B1F2F02075743435039A5A2H9A111F5EDC1D68C405C7C420C9C88B89203H6EEE4A33F275732018D92H98405DDC2HDD48422E384358C70647C7673H6CEC4A31701331341670A35C481BDB019B4A408041402085457AFA4AEAAA6AEA6C3H6FEF4A2H14661434D919CE594A3EBEBFBE203HC3434A2H68EEE8202HAD2DAC5F924302C35A179710974ABCFC4FC34AC1C08381203H66E64A2BEA6D6B20D0D111165F3HD5554A7ABB3C3A203FFEBEBF20A4A52H640329E92H29118E8F2H0E6E131213120E387838B84A7D7C2H7D11E2A21E9D4AA7676667110C6AB94648D151C2514A362H0592752HBB45C44AE0A1E2E0203H25A54A8A0B8C8A208FBE3F4726B434A5344A79B996064A9E1E5E5F223HA3E643884898084A0D4DC8CD2032B2CC4D4A77F7B2B7205C5D595C0421202H2148863829E42FCB2H8B0B08F07035302075B47175041A2H5ADA083H5FDF4AC4441104340989CCC9203HAE2E4A7333B5B320D859D9D8041D1C2H1D488244F70164C72H8707083HAC2C4A2HB1457134963H56115B1A2H5B11C0012H80032H05C5C40BEAAA282A296F3HAF11542H555420191898925FBE2HFFFE032HC303020B2HE82D2829AD3H6D11D2532HD21117562H57032H3CFCFD0B3HC1414A6626AFA6346B2B2HAB291050D5D020D5551514223H7AFA4A3F7F86FF342H6424255F3H69E94A8ECE484E20539353DA6B78B88B074ABD7D4DC24A2H622H22032HE7A2A7294C0C4DCC4A2H5111945F3HF6764ABB7BFDFB20E0F0B0715A65A58D1A4ACA8ACA2H4A0F4F4E4F20F434098B4AB97967C64A9EDE2H9E203HA3234AC848CEC8202H0D8D0D2H72F2890D4AF7B72B884A9CDC2H9C52A1216561203H46C64A8BCB4D4B20B030707122B575B5336B2H1AE4654A9F5F75E04A4H444809C9F2764A2HEEEC6E4AF333F2F3201898E6674A5DDD5E5D203HC2424A47C7414720ACECEAEC04B1714ECE4A962H1696089B1B66E44AC0401FBF4A083D232454009F78C12993B20A0200FDCCC70E3H00C455EDA15145A6CED5AC5A2C8F16C70D3H00822ACF99A3747520BB16093956C7093H00656F2B17233F387057C70F3H00B80AAEA7ED431D8F73BAEA7771D371C7053H00FD3A18C8CCC70C3H001C6C09F12F3118510757AEC3C70F3H0058937F131AA47FA3CCF4DDAEEA0397C70F3H001D909F715AF12BDA09C11E2BB57641C70D3H00C6757D7981522CA1F03E0033F2C7043H00592BB70EC7083H003D87B33F7B801A5FE3C70A3H00C5BD391461E683FF5086C7083H00B77FA4CCB4004211C70D3H007FDEE5E39467A1C8AFD247110FC70C3H00DE9C8ECF9592CADF6071B732C7093H00FA24458315A20F7A45C7113H0099D849AC2B254C1FB4D4655C4684F1468F0DC7533H0084F2D003BE35A84B3F3368E4DF1C18E7034F76C5502D6D60556821B6A94E90E684B6D871A027A6D298121C5250FD886B108E7911105C6DF71EA629B7A4C1B59324CFDB833CB2F112B1A5BCEBC68F4CF7940812C7083H00DDD79F41662B0713C70D3H0065A5C7BC1B8184D7A834F1FCECC7083H004C0EA81D1A1C3BBFC70B3H003415E982C3006E5BC7864FC7123H00851026AD7AADBA535E23EB9BFBD3133477BAEF00DAE79800B7DEB149067H00034H00FD6169AA5142870A020059054501854A2H7E7AFE4A975794174A5010515003A9E92HA920A2222HA2043BFB834A302H74CF01304D8BD14973467E848A58DF2700440718FA39FC0971CA4BD3726A3013F71443DD1D8131BC148C6C11956CCB5F563H0E8E4AA7E4A46054A03HE059B970302F1103BD75157D00FDA32345EB990A0200D9005B008655A9007F6C28739H000H00A78C3A8F4027800A02004532F230B24AB737B5374A5C1C5EDC4A21E12H210306462H06200B8B2H0B0430F00842307535CE0330DA895B2642DF389CF905848FB7E16EC98FCE1503AE34A9C674337030F454028ACAB53100162CB73622990A020019009B00FDEE44009EF0F4134H00034H00E5E30EB73178AD0A0200F1D858DF584AC989CE494A2H5A5DDA4A2H8B8A8B035C1C2H5C20CD8DCCCD04DE1EE6AD308F0FB5FA30E035F0AC1791973AF55D62684E144C138374F932A48C5F070C15D79CD7172HE6E2664A5716979451E82817974A2HD959DA4F6A2A63EA4A9BDB9D1B4A6C26657A11DD9F2HDD40EEEC2HEE481FAA8F233EB006448811213HE139B2322H7216236020E45434352H7404A5E42HE548F641284B3067A7A12717783HF838E92916964A3ACEC901262BAB2BAB657C3C7CFC4AEDECEDEC0E2HFE03814A6FEF2HAF04C03H0048F10C21455E82032H8220F3B22HB32H04852H8459F575088A4A06C42H06203HB7374A084A2H0820B93BF8F9110A882H8A11BB79BBBA0B3H8C0C4AFD7FC6FD340E0C2H0E483HBF3F4A10D0E66F4AC101F47E2592D265ED4A0B1E91F67901141C7670239D0A0200A100C7023H003F3D7A017H00C7073H005D8F9E367C5BC3C7093H0096A71504B7E0C54E62F60079C7E801A4C77D299H000H00E02E90B423D3B50A0200F3C303C9434A96169C164A490943C94ADC1C2HDC034FCF2H4F202HA2A0A204D5956DA430E828D29F309BE64F284D6E143A6B12E15C421A3C74C5170630E72C6F3461BA05647A30ADCCB0B8722H0007804AF3730C8C4A2H86C646252H797EF94A2H0CF3734A3F3E2H7F393HD2524A45842H052098192H18203H0B8B4A5E5F2HDE2051902H9111642HA5270C97D76AE84A6AAA2HEA11DD3H1D113HB030083H23A34A2H76FFF634A969AF294A7CFC2H3C042FAFAEAF0402C2FD7D4AF575343504884H48FB2CDF84114E8EF771172H41C0C104549454550BC7873AB84A4H1A392H0D2H4D0460209E1F4A13932H5304A6E62H2604593HD948EC3DC1B0322H1F2HDF04F23H324825F3E8324478B92H78046B6A2H6B483E70717433F1B0F0F11B448485841B77372HF71B0ACA2H4A1B3DFD2H7D205020A0D826830370FC4A56D6A0294A09492H095209FD01875F066A9E8075B4A00A0200ED00C7063H004DA1C97EF4C4C7023H008B29C7063H001580DDEBB7107A8H007AFF7H007A017H00083H00205FA00242A000B8386C0063B8197D4H00034H0023A2AC850356880A0200A79CDC9F1C4A2HC3C0432H4A8A48CA4A317130310378382H78201F9F2H1F0426669F54302H8DB7FB30549612323F3BA37DE51342B661690329C613435F70E4B1DB25577E974A601E50328D7BC53H4539CC3H0C11F3C08017757A0E09C126213HA15C28A1E1FE118FCF2H8F52067BC237520195818359C6990A0200B9007200576D9F01BEAC3A674H00034H00908D7CEB1C31840A02009B96D695164A2HF1F2714A2CEC2EAC4A47872H470342022H42201D9D2H1D042HD8E0AB302H73C80730EE98DE9D0CC9D3983334C4260F9D215FCC2097201A56425A02B575A89E35F0350BCB570B2H78B026C60F4F5011216222E65403593ADE09007E70C761CE990A020091000200321B860004BF2B78024H004EBF86CB3D9FE30C0200232HDC975C4A7FBF35FF4A028248824A65A5676503A828ACA820CB8BCDCB04CE8EF7BF30B1318AC530B4D6DDE51A979B84927A5A3E472E15FDF75FB754805855CA5FE349B8782566E621E64A498908C94A0C8C85836BAF2F9C2F4A2H3206B24AD5DF9F955AD892D2D811FBBB917B4AFEB42HFE40E1EB2HE14824C2B51B23C74F4D4711CA80C2CA11EDAA24390C70B019F04A134E80DE6196D6BD164A79B91DF94ABC342H3C385FD72HDF48E2A1165D1E052HCDC511084809884A2B23EC24682EA6EF2168112HD91E682HD4D2544A377F7677112HFA07854A1D955D5C0B3HA0204A830BDDC334468ECEC611A9E9A1294A2C252H6C6E8F070F2H0E52DA939203F535F5754A38F0FE37682H5B5ADB4A5E569251684181BF3E4A044D0C0411E7EEAFA7112AAA28AA4A8D454F8268D01814DF68F3730A8C4A36F12HF603D91926A64A9C941C9B383F7F3CBF4AC24A0BCD68252DE02A2H6860AE67688BCB880B4A4E468E8F0B3H71F14AF47C572H3417DF2HD7485ADA00DA4A2HBDBE3D4A00C8C90F68232BE02C6826EE66B2432H09FF764ACC4406C1686FAF97104A32BAFAF211551555D54A98D0529768BBFB46C44ABEF7B6BE11E1E8A9A11164E4911B4A07C76F874ACA80838A11ED2DE06D4AF078B82018539315D34AD65157560339793E39113C7BFFFC119FDF9A1F4A62A52H220385458385112HC836B74A6BEE6AEB60EE6EE86E4A91D42HD138D4912H9448B757BB7D443ABFBBBA309D182H1D48A0BAE39B1E43868B830446832H8648E9BF95D02H2C6A2H2C40CFC92HCF48522BA3D02AF573B0B504B8FE2HF8481B6583D14E9E582H1E032H01FA7E4A847CF48C2667E700E74AEA6AEF6A4A4D8A0DD9432H9069EF4AB3B4B3B238B6B12HB648998F37A1555CDB9651682HFF01804A42872H823825E02HE548686388A14E4B4D2H4B380E482H4E38B1F730310474F22HF44817ACEBB53FDADC2H1A037DFD2H7D11C000C4C011E3A3E7E311E666E2E6112HC9CDC9112H8C898C112FAFD5504A2HB2E4324A2H151F954A58125258117B3B31FB4ABE367B6F513H61E14AE4AC202420070FCF505F3H4ACA4A6D25A9AD20F039F1F01153DA1B1311969F15160479F02HF948FCF594307A9F165A4E51222BEB6D5F4585BA3A4A88810988373HAB2B4AAEE798AE34911893911154D455D44A373EFFF7117A73FB7A373HDD5D4A20295D2034430310C34AC6CF4E46112H29D7564AAC2HE5EC208F4F71F04A52129A020F7535970A4AB8F8E0384A1B93D3DB11DE9ECE5E4A8190C8D711C48E2H8400672DA72772EA8AEB7D020D47070D1150D010D04AF32HC95775B671F67672194AD12773DC5B1C78123F7C3CF85482C5494204A5655ADA4AE860EEE8114B83000B044E062H0E48B12C200C287433F83417975043D7252HDAC95A4A7DF803BD2580C066FF4A23E8A8345F3HA6264A09028D89208C0747C35F3HEF6F4AB2F9767220D5D9DFD5113H18984A3BBBEA444ABEF535260C2H21DE5E4AA42ED7642587C7BE074ACA42821A062DD45D2526B0F0D2304AD393D3534A561EDED611B9F947C64A7C3C79FC4A1F9F16926B2HA295224A058521854A0842C1C3692B612H6B482H6E27EE4A2H5164D14A54DE1D141137BDB0B7113AFAC5454A9D571D9D673HE0604A03892F033406464E864AE9E3E8E911AC2C51D34A0F074E4F11521AD5D21175BD3534012H382HF02F9B5BD61B4A9EDED61E4A41C909913B44041FC44A672FEFE711AA22E27A4CCD0DCD4D4AD0D818025BB3FB3B3311F67EBE260D199918994ADC9554CC497F76F66F7402C2FD7D4A252CED7547A86857D74ACBC242D9362HCE33B14A71B92HB1482H74810B4A2H174E974A9A539A9B0B3HFD7D4A4089694034232A6571513H66E64A09C04D4920CCB53C4426AFEFE82F4A32F232B24A951C9495119811D0D8117B72F8FB04FE7E02814AE121D8614AE41094EC2647C770C74ACA4AFF2H4AED652H2D20703071F04A531B9392013H96164AB9F1747934FC342H3C48DF5F36A04A622262E24AC54CCDC51108C8F5774A2H2BD0544A2E6A262E0411152H1148D40516335437732H7704BAFE2HFA489D073F1A6020242HA004C383C8434AC646C0C6203HA9294A6CEC686C203H0F845F3H92124AF575F1F52078B83E38203H5BDB4A1EDE5A5E202H01C1D75F3H04844AE727A3A7202HAA2C2A203H0D0B5F3HD0504A2H73F7F3203676F0F6202H19D9505F3H9C1C4AFFBF3B3F20C2C3C6C2206564222520E8296E68203H8B0B4A0E0F8A8E20B17073712034F4CB4B4AD755D4D7203H5ADA4ABD3FB9BD2040820800203H23A34A66A4222620894B0B09203HCC4C4AEFED6B6F203230F9F2203H55D54A581A9C9820BBF8BEBB20FE7DBDBE202162A155073H64E44A87840307204AC98A9707EDAD1F924AF0342H303893572H5348D6E1B6EC54397C313904FCF92HFC489F1B173B5462E7272204C5802H854808266C913B6BAEE2EB046EEB2HEE48516FC8E16E54119F9404F7322H3748BA869BDD765D98CA6217202A2H604083C98983112H8692064A69A960794F2CEC38AC4ACF0F67B04A12D859520435BFBCB51EF83807874ADB91101B045E14C66117410B090104C48ECEC41167A79A184A6A22E2EA118D05454D1190D9989011F3FABBB31136FFBEB61159D0919911DCD55C5D013FB6F7FF1142CB2H826E3HE5654AE8614228348B43CB4B1F3H4ECE4AF1F973312H34BCFCF41197DE9F97115A53121A117D74F46F3D8089C8C01163EAEBE30466EF2HE648C9C1560A2BCCC5859F3DAF26272F0472FBBAB211952H9C063D9850D958373H7BFB4ABEB6307E34A129696111646CAC350C078F4FD7513H4ACA4A6D25A9AD20B0B878E10C2H5310852F2H160F964AF97962864AFCF7B73E575F1B545F112HE22F9D4A050E414D49884889084A2BE02HAB116EA5A7AE11919D9A9111541455D44AB7FCFDF7117A3A84054ADD97D6CA3D2060DD5F4A0308484A4C2H46BA394AA9E229280BEC2C13934A0F0484871092D916055175F5880A4A783FB03825DB5BCB5B4A9E074E8F5A2HC111BE4A84443AFB4A27752E3111AA139AE2260D8D1B8D4A2H50ED2F4A33797A73322H7665F64A2H59CE264A5CD61E1C11BF7F40C04AC2084B4211656FAFA55AE8A816974A0BD71846610ECEE7714AF1B10D8E4AF4B22HB411D751525711DA9ADA5A4A7D7B3937492H8081004AE325A3A2013HA6264AC94F8889348C48C9400C2HEF11904A3234747B4C3HD5554A1858A5674A7B7D3DB9573E7B383E1121E1DF5E4A242CE7F551874E8F105F3H0A8A4A6DE4696D20F079B83F5F53DAD0D311162HDFD6113930B9B801BC3575EB5F3H1F9F4A622BA6A22045BF354D26488842C84A2H6BA9144A6EE66E6F013H51D14A14DC6814342HB7BF326B3A7A31BA4A9D5D9D1D4AE0E8E3E01103C3FC7C4A46CE010611E9A914964AAC6C13D34A8F08BF30171255D9D204F5322H354878032E82535B25A1BC559E5E61E14AC1098A81044484B93B4A2HA7E4712F6AEADB154ACD4D68B24AD0971E902533B39C4C4AF67E3E36111959F4664A9C95DACE513H7FFF4A428B06022065A56FE54A682FA3A8040BCC2HCB480E71FBCD34B139B7B11134FC7F7404571F2H17489ACF7881203DFA528217809AD0115A6323C21C4A66E6F4194A092H4049110C4C068C4A6F53138B753238B23272D54C853F7AD858514D6B2HFBFA7B4A2HFE56814A2129E7E11164EC2HA416478F414711CA822HCA162DADA4AF6B70F00C0F4A93D380134A96AA2AB2752H7990064A7C342H3C385FD72HDF00E26AE2627245C52B8620C8C00A08112BE22C2B112EAED3514A51D9162H11D4142BAB4AF7F878731EFA3A05854A5D95DD5D67A0A82HA038C3833FBC4AC6CEC7C611A92954D64AACB5FC3D5A2H0F0D8F4A925264ED4AF57CFDF511F8B03839011BE26B13262H5EAF214A410141C14AC44C2H04202HA759D84A2AAABC554A8DC4848D1190592HD030B3FA2HF348F64D02DE5D5910D1D9115C2H959C117FB6BF3F6082474AD00C256527A54A28E16A68110B2H828B203H8E0E4AF1F8757120F4BD3C3411D7DDD6D7115A1A59DA4A3D74B5BD11C089030004236323A34A66EF2726110989F7764ACC06CACC116FEF6CEF4AF2382HF26E3H55D54A9892959834FBB23BBB1F3HBE3E4AE1A8DFA13464A4FF1B4A470D2H0738CA802H8A48AD7DA2D658B03AB03138D3999A5E68D6DC9C5B68B933FA34682HFC00834ADF961E9F37226222A24AC54303970CC8483FB74AAB2HE2EB11EE2E10914A5119D9D11154DC1C8476778E077F26BA3A79C54A1DDD66624AE0D950282683C33CFC4A8646EEF94AA921E1791C2H2CB7534A3227DB0261002E61C611E8CA0A020049007AC97H00C7083H00138D5CB459134B2H7A617H00C70C3H00EBDDCEB5727A1C50A27885957A00016H00C7083H00EFC4BA53F7D72066C7063H00C76172391C2E7A047H00C7073H009952FEA1F6093FC7063H00E2815B1602B1C7063H0084571B2B3C2AC7063H00066AC38867C3C70B3H006878C1E3D1A4C397E49A4EC7043H00E5BECE32C7093H0051ECB8BD4996EAB4CEC7093H00B0F030D0AE083B4E86C70D3H00878D88605E6F2D812BF727406EE3C7063H00A2DC99434DF5C7063H0044BC65646563C7053H00C6AA03D7A6C7053H00615C9E2E28C7053H0074F002D8327A8H00C7053H00BFA9FAE00EC7073H00026339E0E998D0C7073H0043E91D02064832C7063H00BC446DA0EC23C7063H00BEF28B97A36FC70D3H00A078337181AE1610CC968C31617A027H00C7073H00A394BCBDADE32HC74H007A5A7H00C7093H001C0FFD4F9DCA7C6846C7063H005375267010C1C7083H00653F4EB6B77D39387AFF7H00C7053H00BD3B5C3F58C7083H003070B97C12BF97F90DC7093H004858210EFBDDE9B814C70B3H00DF499AD8E451450ADEC07AC7043H00C40DD3E5C7083H0090C33314FC0E7CD0C7053H00A805A7B9917A017H00C7053H0013845CB84BC7073H00767A5388E3FDB485008E2ED000E1EAE647024H0043B96523064D900A020005CF0FCC4F4A34B437B44AB9F9BA394A5EDE5F5E034H232008482H08040D8D357D3032B2084430B769E37A5BDC0A1C2C32E164D22025C6A940656ACBCCC9732D705EABF827B5077A381E1A9AFA292B5F0EAAEA1384C42H8403094989096C3HAE2E4A2H736573344H58034H5D294H82203HC7474A4H2C20F13HB129163H56594H1B6E404909161102DB87C257008C2EA401D99A0A020079E87A5580FE5HFF5A0089C72000CB50F008",pcall,rawset,256,getfenv,102,111,string.rep,next,false,unpack,"\35",setmetatable,nil,123,string.byte,true,"\98\110\111\116",select,coroutine.yield,tonumber,string.gsub,"\97\116\116\101\109\112\116\32\116\111\32\121\105\101\108\100\32\97\99\114\111\115\115\32\109\101\116\97\109\101\116\104\111\100\47\67\37\45\99\97\108\108\32\98\111\117\110\100\97\114\121","\98\120\111\114","\99\104\97\114","\118","",113,table.insert,type,"\96\102\111\114\96\32\105\110\105\116\105\97\108\32\118\97\108\117\101\32\109\117\115\116\32\98\101\32\97\32\110\117\109\98\101\114",table.unpack,tostring,assert,string.match,"\115\116\114\105\110\103",error,...); |
GPIO1 = 1
GPIO2 = 2
local debounceDelay = 150
local debounceAlarmId1 = 2
local debounceAlarmId2 = 3
function inputDown1()
-- don't react to any interupts from now on and wait 50ms until the interrupt for the up event is enabled
-- within that 50ms the switch may bounce to its heart's content
gpio.trig(GPIO1, "none")
tmr.alarm(debounceAlarmId1, debounceDelay, tmr.ALARM_SINGLE, function()
gpio.trig(GPIO1, "up", inputUp1)
end)
-- finally react to the down event
sendData(1,0)
end
function inputUp1()
-- don't react to any interupts from now on and wait 50ms until the interrupt for the down event is enabled
-- within that 50ms the switch may bounce to its heart's content
gpio.trig(GPIO1 "none")
tmr.alarm(debounceAlarmId1, debounceDelay, tmr.ALARM_SINGLE, function()
gpio.trig(GPIO1, "down", inputDown1)
end)
-- finally react to the up event
sendData(1,1)
end
function inputDown2()
-- don't react to any interupts from now on and wait 50ms until the interrupt for the up event is enabled
-- within that 50ms the switch may bounce to its heart's content
gpio.trig(GPIO2, "none")
tmr.alarm(debounceAlarmId2, debounceDelay, tmr.ALARM_SINGLE, function()
gpio.trig(GPIO2, "up", inputUp2)
end)
-- finally react to the down event
sendData(2,0)
end
function inputUp2()
-- don't react to any interupts from now on and wait 50ms until the interrupt for the down event is enabled
-- within that 50ms the switch may bounce to its heart's content
gpio.trig(GPIO2 "none")
tmr.alarm(debounceAlarmId2, debounceDelay, tmr.ALARM_SINGLE, function()
gpio.trig(GPIO2, "down", inputDown2)
end)
-- finally react to the up event
sendData(2,1)
end
function registerIOEvent()
print("Registering IO Events.")
gpio.mode(GPIO1, gpio.INT, gpio.PULLUP)
gpio.trig(GPIO1, "down", inputDow1)
gpio.mode(GPIO2, gpio.INT, gpio.PULLUP)
gpio.trig(GPIO2, "down", inputDow2)
end
function setupMQTTClient()
borkerIp = "192.168.1.220";
brokerPort = 1883;
print("-------------------")
print("Connecting to MQTT Broker " .. borkerIp .. ":" .. brokerPort)
print("-------------------")
m = mqtt.Client("RemoteKeyfobBoard", 120);
m:lwt("myHome/RemoteKeyfob/status", "offline", 0, 1);
m:on("connect", function(client) m:publish("myHome/RemoteKeyfob/status","online",0,1, function(client) print("Updated will to online") end) end);
m:on("offline", function(client) print ("Disconnected from Broker") end);
-- for TLS: m:connect("192.168.11.118", secure-port, 1)
m:connect(borkerIp, brokerPort, 0, 0, function(client) print("Connected to Broker") end,
function(client, reason) print("failed reason: " .. reason) end)
end
function sendData(channel, level)
local tm = rtctime.epoch2cal(rtctime.get())
local bodyRequest = "{\"Level\":" .. "\"" .. level .. "\"" ..
",\"Timestamp\":\"" .. tm .. "\"}"
m:publish("myHome/RemoteKeyfob/" .. channel, bodyRequest, 0, 1, function(client) print("Data Sent for Channel " .. channel .. " - " .. level) end)
end
setupMQTTClient();
registerIOEvent();
|
pfUI:RegisterModule("infight", "vanilla:tbc", function ()
local function OnUpdate()
if not this.infight and not this.aggro and not this.health then return end
if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + .1 end
if not this.fadeValue then this.fadeValue = 1 end
if this.fadeValue >= 0.3 then
this.fadeModifier = -0.1
end
if this.fadeValue <= 0 then
this.fadeModifier = 0.1
end
this.fadeValue = this.fadeValue + this.fadeModifier
local visible = nil
if this.infight and UnitAffectingCombat("player") then visible = true end
if this.aggro and UnitHasAggro("player") > 0 then visible = true end
if this.health and UnitHealth("player")/UnitHealthMax("player")*100 <= 25 then visible = true end
if UnitIsDeadOrGhost("player") then visible = nil end
if visible then
this.screen:Show()
this.screen:SetBackdropBorderColor(1,0.2+this.fadeValue, this.fadeValue, 1-this.fadeValue)
else
this.screen:Hide()
end
end
pfUI.infight = CreateFrame("Frame", "pfUICombat", UIParent)
pfUI.infight:SetScript("OnUpdate", OnUpdate)
pfUI.infight.screen = CreateFrame("Frame", "pfUICombatScreen", WorldFrame)
pfUI.infight.screen:SetAllPoints(WorldFrame)
pfUI.infight.screen:Hide()
pfUI.infight.UpdateConfig = function(self)
pfUI.infight.infight = C.appearance.infight.screen == "1" and true or nil
pfUI.infight.aggro = C.appearance.infight.aggro == "1" and true or nil
pfUI.infight.health = C.appearance.infight.health == "1" and true or nil
pfUI.infight.screen:SetBackdrop({
edgeFile = pfUI.media["img:glow"], edgeSize = tonumber(C.appearance.infight.intensity),
insets = {left = 0, right = 0, top = 0, bottom = 0},
})
pfUI.infight.screen:Hide()
end
pfUI.infight.UpdateConfig()
end)
|
--[[
Maintenance by Cpone (Cpone#8463 on Discord).
Don't spam Luffy or whatever about this shite, this is all mine.
]]
GlovesModule = GlovesModule or BeardLib:ModuleClass("Gloves", ItemModuleBase)
function GlovesModule:RegisterHook()
if not self._config.id then
self:Err("Cannot add Gloves, no ID specified.")
return
end
self._config.name_id = self._config.name_id or ("bm_gloves_" .. self._config.id)
self._config.desc_id = self._config.desc_id or self._config.name_id .. "_desc"
-- Super simple, just takes XML and shoves it into the gloves. Piggyback off of the player style hook because I'm lazy.
Hooks:Add("BeardLibCreateCustomPlayerStyles", self._config.id .. "AddGlovesTweakData", function(bm_self)
local gl_self = bm_self.gloves
local config = self._config
if gl_self[config.id] then
self:Err("Gloves with id '%s' already exists!", config.id)
return
end
gl_self[config.id] = table.merge({
texture_bundle_folder = "mods",
global_value = self.defaults.global_value,
unlocked = true,
custom = true
}, config)
end)
end |
local recall_shortcut = {
type = "shortcut",
name = "spidertron-enhancements-recall-shortcut",
action = "lua",
associated_control_input = "spidertron-enhancements-recall-shortcut",
toggleable = true,
order = "a",
icon =
{
filename = "__SpidertronEnhancements__/graphics/follow-shortcut.png",
size = 32,
flags = {"gui-icon"}
},
small_icon = {
filename = "__SpidertronEnhancements__/graphics/follow-shortcut-24.png",
size = 24,
flags = {"gui-icon"}
},
disabled_icon = {
filename = "__SpidertronEnhancements__/graphics/follow-shortcut-white.png",
size = 32,
flags = {"gui-icon"}
},
disabled_small_icon =
{
filename = "__SpidertronEnhancements__/graphics/follow-shortcut-white-24.png",
size = 24,
flags = {"gui-icon"}
}
}
local recall_input = {
type = "custom-input",
name = "spidertron-enhancements-recall-shortcut",
key_sequence = "ALT + C",
consuming = "none",
order = "a"
}
data:extend{recall_shortcut, recall_input} |
ys = ys or {}
slot1 = ys.Battle.BattleConst.UnitType
ys.Battle.BattleAAMissileFactory = singletonClass("BattleAAMissileFactory", ys.Battle.BattleBulletFactory)
ys.Battle.BattleAAMissileFactory.__name = "BattleAAMissileFactory"
ys.Battle.BattleAAMissileFactory.MakeBullet = function (slot0)
return slot0.Battle.BattleTorpedoBullet.New()
end
ys.Battle.BattleAAMissileFactory.onBulletHitFunc = function (slot0, slot1, slot2)
slot4 = slot0:GetBulletData().GetTemplate(slot3)
slot5 = slot0.GetDataProxy()
slot6 = nil
if slot2 == slot1.AIRCRAFT_UNIT or slot2 == slot1.AIRFIGHTER_UNIT then
slot6 = slot0.GetSceneMediator():GetAircraft(slot1):GetUnitData()
elseif slot2 == slot1.PLAYER_UNIT then
slot6 = slot0.GetSceneMediator():GetCharacter(slot1):GetUnitData()
elseif slot2 == slot1.ENEMY_UNIT then
slot6 = slot0.GetSceneMediator():GetCharacter(slot1):GetUnitData()
end
slot7 = slot3:getTrackingTarget()
if not slot6 or not slot7 or slot7 == -1 or slot6:GetUniqueID() ~= slot7:GetUniqueID() then
return
end
slot2.Battle.PlayBattleSFX(slot4.hit_sfx)
slot8, slot9 = slot5:HandleDamage(slot3, slot6)
slot15, slot17 = slot0.GetFXPool():GetFX(slot0:GetFXID())
pg.EffectMgr.GetInstance():PlayBattleEffect(slot10, slot11:Add(slot0:GetTf().localPosition), true)
if slot3:GetPierceCount() <= 0 then
slot3:CleanAimMark()
slot5:RemoveBulletUnit(slot3:GetUniqueID())
end
end
ys.Battle.BattleAAMissileFactory.onBulletMissFunc = function (slot0)
slot0:onBulletHitFunc()
end
ys.Battle.BattleAAMissileFactory.MakeModel = function (slot0, slot1, slot2)
slot4 = slot1:GetBulletData().GetTemplate(slot3)
slot5 = slot0:GetDataProxy()
if not slot0:GetBulletPool():InstBullet(slot1:GetModleID(), function (slot0)
slot0:AddModel(slot0)
end) then
slot1.AddTempModel(slot1, slot0:GetTempGOPool():GetObject())
end
slot1:SetSpawn(slot2)
slot1:SetFXFunc(slot0.onBulletHitFunc, slot0.onBulletMissFunc)
slot0:GetSceneMediator():AddBullet(slot1)
if slot3:GetIFF() ~= slot5:GetFriendlyCode() and slot4.alert_fx ~= "" then
slot1:MakeAlert(slot0:GetFXPool():GetFX(slot4.alert_fx))
end
end
return
|
tb = Procedural.BoxGenerator():setSize(Procedural.Vector3(10,10,10)):buildTriangleBuffer()
Procedural.BoxUVModifier():setInputTriangleBuffer(tb):setBoxSize(Procedural.Vector3(10,10,10)):setMappingType(Procedural.BoxUVModifier_MT_PACKED):modify()
tests:addTriangleBufferTexture(tb,"test.png") |
local methods = require("null-ls.methods")
local code_actions = require("null-ls.code-actions")
local formatting = require("null-ls.formatting")
local diagnostics = require("null-ls.diagnostics")
local handlers = require("null-ls.handlers")
local rpc = require("vim.lsp.rpc")
local M = {}
local capabilities = {
codeActionProvider = true,
executeCommandProvider = true,
documentFormattingProvider = true,
documentRangeFormattingProvider = true,
textDocumentSync = {
change = 1, -- prompt LSP client to send full document text on didOpen and didChange
openClose = true,
},
}
local lastpid = 5000
function M.setup()
local rpc_start = rpc.start
rpc.start = function(cmd, cmd_args, dispatchers, ...)
if cmd == "nvim" then
return M.start(dispatchers)
end
return rpc_start(cmd, cmd_args, dispatchers, ...)
end
end
local function get_client(pid)
for _, client in pairs(vim.lsp.get_active_clients()) do
if client.rpc.pid == pid then
return client
end
end
end
function M.start(dispatchers)
lastpid = lastpid + 1
local message_id = 1
local pid = lastpid
local stopped = false
local client
local function handle(method, params, callback, is_notify)
params = params or {}
callback = callback and vim.schedule_wrap(callback)
message_id = message_id + 1
client = client or get_client(pid)
params.method = method
if client then
params.client_id = client.id
handlers.setup_client(client)
end
local send = function(result)
if callback then
callback(nil, result)
end
end
if method == methods.lsp.INITIALIZE then
send({ capabilities = capabilities })
elseif method == methods.lsp.SHUTDOWN then
stopped = true
send()
elseif method == methods.lsp.EXIT then
if dispatchers.on_exit then
dispatchers.on_exit(0, 0)
end
else
if is_notify then
diagnostics.handler(params)
end
code_actions.handler(method, params, send)
formatting.handler(method, params, send)
if not params._null_ls_handled then
send()
end
end
return true, message_id
end
local function request(method, params, callback)
return handle(method, params, callback)
end
local function notify(method, params)
return handle(method, params, nil, true)
end
return {
request = request,
notify = notify,
pid = pid,
handle = {
is_closing = function()
return stopped
end,
kill = function()
stopped = true
end,
},
}
end
return M
|
local createhelp = function( width, height, msgs, M )
local pos = {
up = { 80, 72 },
down = { 80, 118 },
left = { 58, 95, 'right' },
right = { 102, 95, 'left' },
a = { 368, 96, 'left' },
b = { 334, 132 },
x = { 328, 59 },
y = { 294, 92, 'right' },
l1 = { 76, 6 },
r1 = { 338, 6 },
l2 = { 12, 36 },
r2 = { 402, 36 },
select = { 167, 152, 'right' },
start = { 232, 152 },
cred1 = { 207, 208 },
cred2 = { 207, 232 }
}
local snes_x = ( width - M.snes.width ) // 2
local snes_y = ( height - M.snes.height ) // 2
local snes_spt = M.newimage()
snes_spt.left = snes_x
snes_spt.top = snes_y
snes_spt.picture = M.snes.picture
snes_spt.visible = false
snes_spt.layer = 30000
local text = {} for k,v in pairs(M) do print(k,v) end
for button, pos in pairs( pos ) do
text[ button ] = M.render( snes_x + pos[ 1 ], snes_y + pos[ 2 ], msgs[ button ] or '', pos[ 3 ] )
end
local help = { active = false }
help.isactive = function( self )
return self.active
end
help.setvisible = function( self, visible )
snes_spt.visible = visible
for _, render in pairs( text ) do
render:setvisible( visible )
end
self.active = visible
end
return help
end
local createmenu = function( keydown, keyup, zoom, width, options, help, M )
local entries = {}
local menu = {}
for _, entry in ipairs( options ) do
local btn_x, btn_y = entry[ 1 ].left, entry[ 1 ].top
local btn_w, btn_h = entry[ 1 ].width, entry[ 1 ].height
local center_x = btn_x + btn_w // 2
local center_y = btn_y + btn_h // 2
local hand_x = center_x - 8
local hand_y = center_y
local cursor = M.newimage()
cursor.left, cursor.top = hand_x, hand_y
cursor.picture = M.hand.picture
cursor.visible = false
cursor.layer = 30000
local text = M.render( hand_x + 14, hand_y + cursor.height + 10, entry[ 2 ] )
entries[ #entries + 1 ] = {
setvisible = function( self, visible )
cursor.visible = visible
text:setvisible( visible )
end,
activate = function( self )
keydown( entry[ 3 ] )
end,
deactivate = function( self )
keyup( entry[ 3 ] )
end
}
end
if zoom then
local center_x = zoom[ 1 ] + zoom[ 3 ] // 2
local center_y = zoom[ 2 ] + zoom[ 4 ] // 2
if width < 480 then
center_x = center_x - ( 480 - width ) // 2
end
local hand_x, hand_y = center_x - 8, center_y
local cursor = M.newimage()
cursor.left, cursor.top = hand_x, hand_y
cursor.picture = M.hand.picture
cursor.visible = false
cursor.layer = 30000
local text1 = M.render( hand_x + 14, hand_y + cursor.height + 10, "Zoom" )
local text2 = M.render( hand_x + 14, hand_y + cursor.height + 10, "Cancel Zoom" )
entries[ #entries + 1 ] = {
setvisible = function( self, visible )
cursor.visible = visible
if menu.zoom then
text2:setvisible( visible )
else
text1:setvisible( visible )
end
end,
activate = function( self )
menu.zoom = not menu.zoom
end,
deactivate = function( self )
end
}
end
menu.state = 'inactive'
menu.entries = entries
menu.curr = 1
menu.help = help
menu.zoom = false
menu.isactive = function( self )
return self.state == 'active' or self.state == 'help'
end
menu.menuon = function( self )
system.setzoom( nil )
self.state = 'active'
self.curr = 1
self.entries[ self.curr ]:setvisible( true )
end
menu.menuoff = function( self )
self.state = 'inactive'
system.setzoom( menu.zoom and zoom or nil)
end
menu.helpon = function( self )
system.setzoom( nil )
self.state = 'help'
self.help:setvisible( true )
end
menu.helpoff = function( self )
self.state = 'inactive'
self.help:setvisible( false )
system.setzoom( menu.zoom and zoom or nil)
end
menu.next = function( self )
self.entries[ self.curr ]:setvisible( false )
self.curr = self.curr + 1
if self.curr > #self.entries then
self:menuoff()
else
self.entries[ self.curr ]:setvisible( true )
end
end
menu.choose = function( self )
self.entries[ self.curr ]:setvisible( false )
self.entries[ self.curr ]:activate()
self.state = 'pressing'
end
menu.onkeydown = function( self, button )
if self.state == 'active' then
if button == 'select' then
self:next()
elseif button == 'start' then
self:choose()
end
elseif self.state == 'inactive' then
if button == 'select' then
self:menuon()
elseif button == 'start' then
self:helpon()
end
elseif self.state == 'help' then
if button == 'start' then
self:helpoff()
elseif button == 'select' then
self:helpoff()
self:menuon()
end
end
end
menu.onkeyup = function( self, button )
if button == 'start' then
if self.state == 'pressing' then
self.entries[ self.curr ]:deactivate()
self:menuoff()
end
end
end
return menu
end
return function( background, keymap, keydown, keyup, timers, zoom, options, M )
system.setbackground( background.picture )
local bgwidth, bgheight = background.width, background.height
background.picture = nil
local state, newstate = {}, {}
local zoomed = false
if options then
local del = {}
for _, option in ipairs( options ) do
for button, keys in pairs( keymap ) do
if keys[ 1 ] == option[ 3 ] then
del[ button ] = true
end
end
end
for button in pairs( del ) do
keymap[ button ] = nil
end
end
local msgs = {}
for button, keys in pairs( keymap ) do
msgs[ button ] = keys[ #keys ]
keys[ #keys ] = nil
end
if options then
msgs.select = 'Menu'
msgs.start = 'Select'
else
msgs.select = zoom and 'Zoom' or ''
msgs.start = 'Help'
end
msgs.cred1 = 'MADrigal\'s Simulators'
msgs.cred2 = 'libretro port by @leiradel'
local help = createhelp( bgwidth, bgheight, msgs, M )
local menu
if options then
menu = createmenu( keydown, keyup, zoom, bgwidth, options, help, M )
end
return function()
local gameactive = true
if help:isactive() then
gameactive = false
end
if menu and menu:isactive() then
gameactive = false
end
system.inputstate( newstate )
for button, pressed in pairs( newstate ) do
if state[ button ] ~= pressed then
local keys = keymap[ button ]
if keys then
if gameactive then
if pressed then
for _, key in ipairs( keys ) do
keydown( key )
end
else
for _, key in ipairs( keys ) do
keyup( key )
end
end
end
end
state[ button ] = pressed
if menu then
if pressed then
menu:onkeydown( button )
else
menu:onkeyup( button )
end
else
if button == 'start' then
if pressed then
system.setzoom( nil )
end
help:setvisible( pressed )
if not pressed then
system.setzoom( zoomed and zoom or nil )
end
elseif button == 'select' and pressed then
zoomed = not zoomed
system.setzoom( zoomed and zoom or nil )
end
end
end
end
if gameactive then
if not system.issoundactive() then
system.resumesounds()
end
for _, timer in ipairs( timers ) do
timer:tick()
end
else
if system.issoundactive() then
system.pausesounds()
end
end
return gameactive
end
end |
unban = {}
local unban_tbl = {}
local unban_types = { IP = true, USGN = true, Steam = true, Name = true }
function unban.retrieve_bans()
local u_menu = {
title = "Unban User",
items = {},
fixedItems = {
[7] = {"<< Return", "", function(id) unimenu.historyBack(id) end}
},
}
parse("bans")
-- this function basically turns whatever inside .stringlist to .tablelist (ready for menu-making)
for index, str in pairs(unban_tbl) do
local ban_type = string.match(str, "[A-z]+")
local ban_isnotname, ban_mask, ban_dura, ban_reason
if ban_type == "IP" then
ban_mask = string.match(str, "((%d+)%.(%d+)%.(%d+)%.(%d+))")
ban_isnotname = true
elseif ban_type == "USGN" then
ban_mask = tonumber(string.match(str, "#(%d+)"))
ban_isnotname = true
elseif ban_type == "Steam" then
ban_mask = string.match(str, "(%d+)")
ban_isnotname = true
elseif ban_type == "Name" then -- who bans name anyway
if string.find(str, "%(temp, (%d+) sec%)") then
ban_dura = string.match(str, "%(temp, (%d+) sec%)")
else
ban_dura = "permanent"
end
ban_mask = string.sub(str, 8):gsub("%(temp, "..ban_dura.." sec%)","")
ban_reason = "-"
ban_isnotname = false
end
if ban_isnotname then
if string.find(str, "%(temp, (%d+) sec%)") then
ban_dura = string.match(str, "%(temp, (%d+) sec%)")
else
ban_dura = "permanent"
end
if string.find(str, "%[(.+)%]") then
ban_reason = string.match(str, "%[(.+)%]")
else
ban_reason = "-"
end
end
if tonumber(ban_dura) then ban_dura = math.floor(ban_dura/3600) .. "h " .. (math.floor(ban_dura/60)%60).. "m "..(ban_dura%60).."s" end
local action_menu = {
title = "Lift player ban? - "..ban_mask,
modifiers = "s",
items = {
{"Lift Ban", "", function(id) parse("unban " ..ban_mask) msg2(id,cloud.tags.server.."Ban - "..ban_mask.." has been lifted.") end}
},
}
table.insert(u_menu.items, {ban_mask, ban_type, function(id) unimenu.open(id, action_menu) end})
end
return u_menu
end
function log_hook(text)
-- this function hooked to "log" hook, to get strings!
if string.find(text, "bans total: ") then
local total = 0
total = string.match(text, "(%d+)")
unban_tbl = {} -- bcs it's new "bans" execution, the list is going to be cleared
end
if string.find(text, "%*") then -- probably it is
if unban_types[string.match(text, "[A-z]+")] then -- I'm sure it is
table.insert(unban_tbl, text)
end
end
end
addhook("log","log_hook")
|
--[[
█▀▀█ █░░█ █▀▀█ █▀▀ █▀▀▄ ░▀░ █░█ █▀▀ ▀▀█▀▀ █░░█ █▀▀▄ ░▀░ █▀▀█
█░░█ █▀▀█ █░░█ █▀▀ █░░█ ▀█▀ ▄▀▄ ▀▀█ ░░█░░ █░░█ █░░█ ▀█▀ █░░█
█▀▀▀ ▀░░▀ ▀▀▀▀ ▀▀▀ ▀░░▀ ▀▀▀ ▀░▀ ▀▀▀ ░░▀░░ ░▀▀▀ ▀▀▀░ ▀▀▀ ▀▀▀▀
PROGRAMADOR: BYBLACKDEATH
]]--
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
description '<Phoenix Studio> Yacimiento de petroleo -- Oilfarm'
author 'ByBlackDeath -- https://github.com/IOxeOfficial'
version '2.0.0'
server_scripts {
'@mysql-async/lib/MySQL.lua',
'@es_extended/locale.lua',
'locales/es.lua',
'locales/en.lua',
'config.lua',
'server/main.lua'
}
client_scripts {
'@es_extended/locale.lua',
'locales/es.lua',
'locales/en.lua',
'config.lua',
'client/main.lua',
'client/crude.lua'
}
dependencies {
'es_extended'
}
|
--This is to be used for static spawns that are NOT part of caves, cities, dungeons, poi's, or other large screenplays.
TaanabStaticSpawnsScreenPlay = ScreenPlay:new
{
numberOfActs = 1,
screenplayName = "TaanabStaticSpawnsScreenPlay",
}
registerScreenPlay("TaanabStaticSpawnsScreenPlay", true)
function TaanabStaticSpawnsScreenPlay:start()
if (isZoneEnabled("taanab")) then
self:spawnMobiles()
end
end
function TaanabStaticSpawnsScreenPlay:spawnMobiles()
--Need to add the rest of static spawns (Incomplete).
--Test Area
end
|
print('math.sqrt(9)='..math.sqrt(9))
print('math.sqrt(2)='..math.sqrt(2))
print('math.sqrt(-1)='..math.sqrt(-1))
print('math.sin(math.pi/2)='..math.sin(math.pi/2))
print('math.deg(math.pi)='..math.deg(math.pi))
print('math.max(1,2,3)='..math.max(1,2,3))
print('math.random(1,100)='..math.random(1,100))
print('math.type(3)='..math.type(3))
print('math.type(0.5)='..math.type(0.5))
|
ChatSuey = {}; |
AddCSLuaFile()
SWEP.Author = "Soviet Doggo"
SWEP.Base = "weapon_base"
SWEP.PrintName = "BASIC PISTOL"
SWEP.Instructions = [[shoot and people go up.]]
SWEP.ViewModel = "models/weapons/c_pistol.mdl"
SWEP.ViewModelFlip = false
SWEP.UseHands = true
SWEP.WorldModel = "models/weapons/w_pistol.mdl"
SWEP.SetHoldType = "pistol"
SWEP.Weight = 5
SWEP.AutoSwitchTo = true
SWEP.AutoSwitchFrom = false
SWEP.Slot = 1
SWEP.SlotPos = 0
SWEP.DrawAmmo = true
SWEP.DrawCrosshair = true
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.Primary.ClipSize = 1
SWEP.Primary.DefaultClip = 1
SWEP.Primary.Ammo = "Pistol"
SWEP.Primary.Automatic = false
SWEP.Primary.Recoil = 0
SWEP.Primary.Damage = 1
SWEP.Primary.NumShots = 1
SWEP.Primary.Spread = 0
SWEP.Primary.Cone = 0
SWEP.Primary.Delay = 2
SWEP.ShouldDropOnDie = false
local ShootSound = Sound("Weapon_pistol.Single")
function SWEP:Initialize()
self:SetHoldType( "pistol" )
end
function SWEP:PrimaryAttack(ent, ply)
if ( !self:CanPrimaryAttack() ) then return end
local bullet = {}
bullet.Num = self.Primary.NumberofShots
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0)
bullet.Tracer = 1
bullet.Force = self.Primary.Force
bullet.Damage = self.Primary.Damage
bullet.AmmoType = self.Primary.Ammo
local rnda = self.Primary.Recoil * -1
local rndb = self.Primary.Recoil * math.random(-1, 1)
self:ShootEffects()
self.Owner:FireBullets( bullet )
self:EmitSound(ShootSound)
self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) )
self:TakePrimaryAmmo(1)
self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
end
function SWEP:CanSecondaryAttack()
return false
end |
-- id int 关卡ID
-- attackNum tableString[k:#1(int)|v:#2(int)] 怪物种类区分
return {
[1] = {
id = 1,
attackNum = {
[0] = 2,
[1] = 2,
[2] = 5,
},
},
[2] = {
id = 2,
attackNum = {
[1] = 2,
[2] = 1,
},
},
}
|
local metadata =
{
plugin =
{
format = 'staticLibrary',
staticLibs = { 'plugin_admob', },
frameworks = { 'GoogleAppMeasurement', 'GoogleMobileAds', 'FBLPromises', 'GoogleUtilities', 'nanopb', },
frameworksOptional = { 'AppTrackingTransparency', 'JavascriptCore', },
},
}
return metadata
|
require "lmkbuild"
require "common_c" -- set up cc env vars
local add_files = lmkbuild.add_files
local clean_obj = common_c.clean_obj
local create_file_lists = common_c.create_file_lists
local exec = lmkbuild.exec
module (...)
function main (files)
local execList, objList = create_file_lists (files, "$(lmk.ccExec)")
exec (execList)
add_files (objList, "obj")
end
function test (files)
main (files)
end
function clean (files)
clean_obj (files)
end
function clobber (files)
clean_obj (files)
end
|
import("core.base.pipe")
import("core.base.bytes")
import("core.base.scheduler")
function _session(id)
local pipefile = pipe.open("test" .. id, 'r')
if pipefile:connect() > 0 then
print("%s/%d: connected", pipefile, id)
local count = 0
local result = nil
local buff = bytes(8192)
while count < 10000 do
local read, data = pipefile:read(buff, 13, {block = true})
if read > 0 then
result = data
count = count + 1
else
break
end
end
print("%s/%d: read: %d, count: %d", pipefile, id, result and result:size() or 0, count)
result:dump()
end
pipefile:close()
end
function main(count)
count = count and tonumber(count) or 1
for i = 1, count do
scheduler.co_start(_session, i)
end
end
|
--[[
tess
File:/src/Output_PlainText.lua
Date:2021.06.25
By MIT License.
Copyright(C) 2021 tess developers.All rights reserved.
]]
local lineWidth <const> = 80;
local tabSize <const> = 8;
local string = require("string");
local io = require("io");
local utf8 = require("utf8");
local table = require("table");
local outputMethod = {};
local outputMetaTable = {
__index = outputMethod,
};
local Output = function(name)
local output = {
status = {
pos = 0,
mode = false,
},
file = assert(io.open(name,"w"));
};
return setmetatable(output,outputMetaTable);
end
local is_newline = function(char)
return char == '\n';
end
local auto_nl = function(self,text)
local result = {};
local temp = "";
for char in string.gmatch(text,utf8.charpattern)
do
local width = 1;
if #char > 1
then
width = 2;
elseif is_newline(char)
then
width = 0;
self.status.pos = 0;
end
if self.status.pos + width > lineWidth and
not self.status.native
then
table.insert(result,temp);
temp = char;
self.status.pos = width;
elseif char == '\t'
then
local fillWidth = tabSize - self.status.pos % tabSize;
if self.status.pos + fillWidth > lineWidth and
not self.status.mode
then
self.status.pos = 0;
table.insert(result,temp);
else
temp = temp .. string.rep(" ",fillWidth);
self.status.pos = self.status.pos + fillWidth;
end
else
temp = temp .. char;
self.status.pos = self.status.pos + width;
end
end
table.insert(result,temp);
return table.concat(result,"\n");
end
local file_write = function(self,text)
self.file:write(self.status.native and text or auto_nl(self,text));
end
outputMethod.text = function(self,text)
file_write(self,text);
return;
end
outputMethod.nl = function(self,n)
n = n or 1;
file_write(self,string.rep("\n",n));
return;
end
outputMethod.space = function(self,n)
n = n or 1;
file_write(self,string.rep(" ",n));
return;
end
outputMethod.strong = function(self,mode)
file_write(self,"_");
return;
end
outputMethod.em = function(self,mode)
file_write(self,"*");
return;
end
outputMethod.native = function(self,mode)
self.status.mode = mode;
end
outputMethod.close = function(self)
self.file:close();
return;
end
outputMethod.tab = function(self,n)
n = n or 1;
file_write(self,string.rep("\t",n));
return;
end
return {
Output = Output,
};
|
return function()
local ModelUtils = require(script.Parent)
it("should throw an error on attempt to modify the export table", function()
expect(function()
ModelUtils.NEW_FIELD = {}
end).to.throw()
expect(function()
setmetatable(ModelUtils, {})
end).to.throw()
end)
end
|
-- キーコンフィグ
-- DxLua: KeyConfig.cpp/h のAPI類をモジュールとして取得
local KeyConfig = require 'KeyConfig'
local KEYCONFIG_FILE_NAME = "KeyConfig.txt" -- キーコンフィグデータのファイル名
local INFO_X = (10) -- 描画開始座標
local INFO_Y = (10)
local INFO_SPACE = (24) -- 1行あたりに空けるスペース
local INFO_NAME_X = (140) -- 入力名を描画するX座標
local INFO_INPUT_X = (320) -- 入力状態を描画するX座標
-- キーコンフィグ対象の項目
local TargetIndex = 1
-- キーコンフィグ各項目の名前
local g_KeyConfigMenuTable =
{
"左",
"右",
"上",
"下",
"カメラ左旋回",
"カメラ右旋回",
"カメラ上旋回",
"カメラ下旋回",
"攻撃",
"ジャンプ",
}
local DrawY = 0
local InputWait = 0
-- DxLua: 状態が複雑なのでステートマシンで管理する
local StateMachine = {
State = 'Select',
}
-- 画面モードのセット
dx.SetGraphMode(640, 480, 16)
-- DXライブラリ初期化処理
function dx.Init()
-- 描画先を裏画面にする
dx.SetDrawScreen(dx.DX_SCREEN_BACK)
end
-- ループ
function dx.Update(...)
StateMachine:Update(...)
end
-- 現在の状態に合わせてメソッドを呼び分ける
function StateMachine:Update(...)
if self[self.State] then
self[self.State](self, ...)
end
end
-- 選択画面
function StateMachine:Select()
-- 画面のクリア
dx.ClearDrawScreen()
-- メニュー
dx.DrawString(0, 0, 'キーコンフィグ選択', dx.GetColor(0xFF, 0xFF, 0))
dx.DrawString(0, 0, '\n1で設定開始\n2でキーテスト')
dx.ScreenFlip()
-- キーボードで選択
if dx.CheckHitKey(dx.KEY_INPUT_1) ~= 0 or dx.CheckHitKey(dx.KEY_INPUT_NUMPAD1) ~= 0 then
self.State = 'PreScreen'
elseif dx.CheckHitKey(dx.KEY_INPUT_2) ~= 0 or dx.CheckHitKey(dx.KEY_INPUT_NUMPAD2) ~= 0 then
self.State = 'PreTest'
end
end
-- 共通の前処理
function StateMachine:PreCommon()
-- キーコンフィグ処理を初期化
KeyConfig_Initialize()
-- キーコンフィグファイルを読み込む
if KeyConfig_Load(KEYCONFIG_FILE_NAME) == false then
-- コンフィグファイルが読み込めなかったらデフォルト設定にする
KeyConfig_SetDefault()
end
-- 「何か入力があったら何もしない」フラグを倒す
InputWait = false
end
-- キーコンフィグ画面(前処理)
function StateMachine:PreScreen()
self:PreCommon()
TargetIndex = 1
InputWait = true
self.State = 'Screen'
end
-- キーコンフィグ画面
function StateMachine:Screen()
-- 画面のクリア
dx.ClearDrawScreen()
-- キーコンフィグの入力処理を行う
KeyConfig_InputProcess()
-- 「何か入力があったら何もしない」フラグが立っている場合は処理を分岐
if InputWait == true then
-- 何も入力が無かったら「何か入力があったら何もしない」フラグを倒す
if KeyConfig_CheckInput() == false then
InputWait = false
end
else
-- キーやパッドの押下状態をチェックして、押下されていたらキーコンフィグ設定に反映させる
if KeyConfig_UpdateInputTypeInfo(TargetIndex) then
-- 何かボタンが押されたら次の項目に移動する
TargetIndex = TargetIndex + 1
-- 「何か入力があったら何もしない」フラグを立てる
InputWait = true
end
end
-- 項目の数だけ繰り返し
DrawY = INFO_Y
for i = 1, KeyConfig.KEYCONFIG_INPUT_NUM do
local DrawColor
local InputString = ''
-- 変更対象の項目かどうかで描画色を変える
DrawColor = TargetIndex == i and dx.GetColor(255, 0, 0) or dx.GetColor(255, 255, 255)
-- 項目名の描画
dx.DrawString(INFO_X, DrawY, g_KeyConfigMenuTable[i], DrawColor)
-- 入力に割り当てられている入力名を取得する
InputString = KeyConfig_GetInputTypeString(i)
-- 割り当てられている入力名を描画する
dx.DrawString(INFO_NAME_X, DrawY, InputString, DrawColor)
-- 項目の描画Y座標を1項目分下に移動する
DrawY = DrawY + INFO_SPACE
end
-- 裏画面の内容を表画面に反映
dx.ScreenFlip()
-- 全ての入力の設定が終わったらループを抜ける
if TargetIndex > KeyConfig.KEYCONFIG_INPUT_NUM then
-- キーコンフィグ設定を保存する
KeyConfig_Save(KEYCONFIG_FILE_NAME)
self.State = 'Select'
elseif dx.CheckHitKey(dx.KEY_INPUT_ESCAPE) ~= 0 then
-- DxLua: 戻る
self.State = 'Select'
end
end
-- キーコンフィグのテスト(前処理)
function StateMachine:PreTest()
self:PreCommon()
self.State = 'Test'
end
-- キーコンフィグのテスト
function StateMachine:Test()
-- 画面のクリア
dx.ClearDrawScreen()
-- キーコンフィグの入力処理を行う
KeyConfig_InputProcess()
-- 入力状態を取得する
Input = KeyConfig_GetInput()
-- 項目の数だけ繰り返し
DrawY = INFO_Y
for i = 1, KeyConfig.KEYCONFIG_INPUT_NUM do
local InputString = ''
-- 項目名の描画
dx.DrawString(INFO_X, DrawY, g_KeyConfigMenuTable[i], dx.GetColor(255, 255, 255))
-- 入力に割り当てられている入力名を取得する
InputString = KeyConfig_GetInputTypeString(i)
-- 割り当てられている入力名を描画する
dx.DrawString(INFO_NAME_X, DrawY, InputString, dx.GetColor(255, 255, 255))
-- 入力状態を描画する
dx.DrawString(INFO_INPUT_X, DrawY, bit.band(Input, bit.lshift(1, i)) ~= 0 and "○" or "_", dx.GetColor(255, 255, 255))
-- 項目の描画Y座標を1項目分下に移動する
DrawY = DrawY + INFO_SPACE
end
-- カメラ用方向入力の状態を描画する
CameraInput = KeyConfig_GetCameraInput()
dx.DrawFormatString(INFO_X, DrawY, dx.GetColor(255, 255, 255), "カメラ入力 X:%.3f Y:%.3f", CameraInput.x, CameraInput.y)
-- 裏画面の内容を表画面に反映
dx.ScreenFlip()
if dx.CheckHitKey(dx.KEY_INPUT_ESCAPE) ~= 0 then
-- DxLua: 戻る
self.State = 'Select'
end
end
|
igbattleforeman = Creature:new {
customName = "Battle Foreman",
socialGroup = "mercenary",
faction = "",
level = 300,
chanceHit = 25.00,
damageMin = 500,
damageMax = 1000,
baseXp = 300000,
baseHAM = 175000,
baseHAMmax = 200000,
armor = 0,
resists = {130,140,140,140,140,140,140,140,120},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0,
ferocity = 0,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = PACK + STALKER,
optionsBitmask = AIENABLED,
diet = HERBIVORE,
templates = {"object/mobile/som/som_kenobi_reunite_dark_trooper.iff"},
lootGroups = {
{
groups = {
{group = "trash_common", chance = 10000000},
},
lootChance = 800000
},
{
groups = {
{group = "trash_rare", chance = 10000000},
},
lootChance = 600000
},
{
groups = {
{group = "tierone", chance = 1500000},
{group = "tiertwo", chance = 3500000},
{group = "tierthree", chance = 2500000},
{group = "tierdiamond", chance = 2500000},
},
lootChance = 500000
}
},
weapons = {"tusken_weapons"},
reactionStf = "@npc_reaction/slang",
attacks = merge(commandomaster,marksmanmaster,tkamaster,brawlermaster,fencermaster,swordsmanmaster,pikemanmaster,riflemanmaster,pistoleermaster)
}
CreatureTemplates:addCreatureTemplate(igbattleforeman, "igbattleforeman")
|
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by 干冲.
--- DateTime: 2018/4/17 15:12
--- Lua端SDK帮助器
require(ModulePath.YMList)
local Affiche = require(ModulePath.Affiche)
local SDKHelper = SDKHelper
LuaSDKHelper = {}
LuaSDKHelper.__Index = LuaSDKHelper
--获取所有公告
function LuaSDKHelper.getAffiches()
local json = SDKHelper.platformHelper(HandlerConst.AFFICHE, nil)
if json == nil or json == "" then
return nil
end
local node = LuaSDKHelper.toJsonNode(json)
local list = YMList:New('table')
local nowTime = Time.GetTimestamp()
local affiche
for k, v in pairs(node) do
affiche = Affiche.New()
affiche:jsonRead(v)
if affiche.getStartTime() <= nowTime and affiche.getEndTime() > nowTime then
list:Add(affiche)
end
end
list:Sort(
function(a1, a2)
if a1:getOrder() > a2:getOrder() then
return -1
end
if a1:getOrder() < a2:getOrder() then
return 1
end
if a1:getOrder() == a2:getOrder() then
if a1:getStartTime()>a2:getStartTime() then
return 1
end
if a1:getStartTime()<a2:getStartTime() then
return -1
end
end
return 0
end)
return list
end
--需要与后台对应
function LuaSDKHelper.toJsonNode(json)
--TODO 转换成对应json列表
end
|
local BatchNormalization, parent = torch.class('cudnn.BatchNormalization', 'nn.Module')
local ffi = require 'ffi'
local errcheck = cudnn.errcheck
BatchNormalization.mode = 'CUDNN_BATCHNORM_PER_ACTIVATION'
BatchNormalization.nDim = 2
BatchNormalization.__version = 2
function BatchNormalization:__init(nFeature, eps, momentum, affine)
parent.__init(self)
assert(nFeature and type(nFeature) == 'number',
'Missing argument #1: Number of feature planes. ')
assert(nFeature ~= 0, 'To set affine=false call BatchNormalization'
.. '(nFeature, eps, momentum, false) ')
assert(affine == true or affine == nil, 'only affine supported')
self.affine = true
self.eps = eps or 1e-5
self.train = true
self.momentum = momentum or 0.1
self.running_mean = torch.zeros(nFeature)
self.running_var = torch.ones(nFeature)
if self.affine then
self.weight = torch.Tensor(nFeature)
self.bias = torch.Tensor(nFeature)
self.gradWeight = torch.Tensor(nFeature)
self.gradBias = torch.Tensor(nFeature)
self:reset()
end
end
function BatchNormalization:reset()
if self.weight then
self.weight:uniform()
end
if self.bias then
self.bias:zero()
end
self.running_mean:zero()
self.running_var:fill(1)
end
function BatchNormalization:createIODescriptors(input)
assert(input:dim() == self.nDim)
assert(torch.typename(self.weight) == 'torch.CudaTensor' and torch.typename(self.bias) == 'torch.CudaTensor',
'Only CUDA tensors are supported for cudnn.BatchNormalization!')
if not self.iDesc or not self.oDesc or not input:isSize(self.iSize) then
local nFeature = self.running_mean:numel()
self.iSize = input:size()
self.output:resizeAs(input)
self.iDesc = cudnn.toDescriptor(input)
self.oDesc = cudnn.toDescriptor(self.output)
local biasSize = torch.ones(self.nDim):totable()
biasSize[2] = nFeature
self.sDesc = cudnn.toDescriptor(self.bias:view(table.unpack(biasSize)))
end
end
local one = torch.FloatTensor({1});
local zero = torch.FloatTensor({0});
local scaleTens = torch.FloatTensor(1);
function BatchNormalization:updateOutput(input)
self:createIODescriptors(input)
self.save_mean = self.save_mean or input.new()
self.save_mean:resizeAs(self.running_mean)
self.save_std = self.save_std or input.new()
self.save_std:resizeAs(self.running_var)
if self.train then
errcheck('cudnnBatchNormalizationForwardTraining',
cudnn.getHandle(), self.mode, one:data(), zero:data(),
self.iDesc[0], input:data(), self.oDesc[0], self.output:data(),
self.sDesc[0], self.weight:data(), self.bias:data(),
self.momentum, self.running_mean:data(), self.running_var:data(), self.eps, self.save_mean:data(), self.save_std:data());
else
errcheck('cudnnBatchNormalizationForwardInference',
cudnn.getHandle(), self.mode, one:data(), zero:data(),
self.iDesc[0], input:data(), self.oDesc[0], self.output:data(),
self.sDesc[0], self.weight:data(), self.bias:data(),
self.running_mean:data(), self.running_var:data(), self.eps);
end
return self.output
end
local function backward(self,input,gradOutput, scale)
assert(gradOutput:isContiguous())
self:createIODescriptors(input)
self.gradInput:resizeAs(input)
scale = scale or 1
scaleTens:fill(scale)
errcheck('cudnnBatchNormalizationBackward',
cudnn.getHandle(), self.mode, one:data(), zero:data(), scaleTens:data(), one:data(),
self.iDesc[0], input:data(), self.iDesc[0], gradOutput:data(), self.iDesc[0], self.gradInput:data(),
-- input is bottom, gradOutput is topDiff, self.gradInput is resultBottomDiff
self.sDesc[0], self.weight:data(), self.gradWeight:data(), self.gradBias:data(),
self.eps, self.save_mean:data(), self.save_std:data());
return self.gradInput
end
function BatchNormalization:updateGradInput(input, gradOutput, scale)
-- will in fact update gradWeight and gradBias too, accGradParameters call is empty
return backward(self, input, gradOutput, scale)
end
function BatchNormalization:backward(input, gradOutput, scale)
return backward(self, input, gradOutput, scale)
end
function BatchNormalization:accGradParameters(input, gradOutput, scale)
end
function BatchNormalization:clearDesc()
self.iDesc = nil
self.oDesc = nil
self.sDesc = nil
end
function BatchNormalization:read(file, version)
parent.read(self, file)
if version < 2 then
if self.running_std then
self.running_var = self.running_std:pow(-2):add(-self.eps)
self.running_std = nil
end
end
end
function BatchNormalization:write(f)
self:clearDesc()
local var = {}
for k,v in pairs(self) do
var[k] = v
end
f:writeObject(var)
end
function BatchNormalization:clearState()
self:clearDesc()
nn.utils.clear(self, 'save_mean', 'save_std')
return parent.clearState(self)
end
|
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, meths = helpers.clear, helpers.meths
local eq = helpers.eq
local command = helpers.command
describe('ui/cursor', function()
local screen
before_each(function()
clear()
screen = Screen.new(25, 5)
screen:attach()
end)
after_each(function()
screen:detach()
end)
it("'guicursor' is published as a UI event", function()
local expected_mode_info = {
[1] = {
blinkoff = 0,
blinkon = 0,
blinkwait = 0,
cell_percentage = 0,
cursor_shape = 'block',
name = 'normal',
hl_id = 0,
id_lm = 0,
attr = {},
attr_lm = {},
mouse_shape = 0,
short_name = 'n' },
[2] = {
blinkoff = 0,
blinkon = 0,
blinkwait = 0,
cell_percentage = 0,
cursor_shape = 'block',
name = 'visual',
hl_id = 0,
id_lm = 0,
attr = {},
attr_lm = {},
mouse_shape = 0,
short_name = 'v' },
[3] = {
blinkoff = 0,
blinkon = 0,
blinkwait = 0,
cell_percentage = 25,
cursor_shape = 'vertical',
name = 'insert',
hl_id = 0,
id_lm = 0,
attr = {},
attr_lm = {},
mouse_shape = 0,
short_name = 'i' },
[4] = {
blinkoff = 0,
blinkon = 0,
blinkwait = 0,
cell_percentage = 20,
cursor_shape = 'horizontal',
name = 'replace',
hl_id = 0,
id_lm = 0,
attr = {},
attr_lm = {},
mouse_shape = 0,
short_name = 'r' },
[5] = {
blinkoff = 0,
blinkon = 0,
blinkwait = 0,
cell_percentage = 0,
cursor_shape = 'block',
name = 'cmdline_normal',
hl_id = 0,
id_lm = 0,
attr = {},
attr_lm = {},
mouse_shape = 0,
short_name = 'c' },
[6] = {
blinkoff = 0,
blinkon = 0,
blinkwait = 0,
cell_percentage = 25,
cursor_shape = 'vertical',
name = 'cmdline_insert',
hl_id = 0,
id_lm = 0,
attr = {},
attr_lm = {},
mouse_shape = 0,
short_name = 'ci' },
[7] = {
blinkoff = 0,
blinkon = 0,
blinkwait = 0,
cell_percentage = 20,
cursor_shape = 'horizontal',
name = 'cmdline_replace',
hl_id = 0,
id_lm = 0,
attr = {},
attr_lm = {},
mouse_shape = 0,
short_name = 'cr' },
[8] = {
blinkoff = 0,
blinkon = 0,
blinkwait = 0,
cell_percentage = 20,
cursor_shape = 'horizontal',
name = 'operator',
hl_id = 0,
id_lm = 0,
attr = {},
attr_lm = {},
mouse_shape = 0,
short_name = 'o' },
[9] = {
blinkoff = 0,
blinkon = 0,
blinkwait = 0,
cell_percentage = 25,
cursor_shape = 'vertical',
name = 'visual_select',
hl_id = 0,
id_lm = 0,
attr = {},
attr_lm = {},
mouse_shape = 0,
short_name = 've' },
[10] = {
name = 'cmdline_hover',
mouse_shape = 0,
short_name = 'e' },
[11] = {
name = 'statusline_hover',
mouse_shape = 0,
short_name = 's' },
[12] = {
name = 'statusline_drag',
mouse_shape = 0,
short_name = 'sd' },
[13] = {
name = 'vsep_hover',
mouse_shape = 0,
short_name = 'vs' },
[14] = {
name = 'vsep_drag',
mouse_shape = 0,
short_name = 'vd' },
[15] = {
name = 'more',
mouse_shape = 0,
short_name = 'm' },
[16] = {
name = 'more_lastline',
mouse_shape = 0,
short_name = 'ml' },
[17] = {
blinkoff = 0,
blinkon = 0,
blinkwait = 0,
cell_percentage = 0,
cursor_shape = 'block',
name = 'showmatch',
hl_id = 0,
id_lm = 0,
attr = {},
attr_lm = {},
short_name = 'sm' },
}
screen:expect(function()
-- Default 'guicursor', published on startup.
eq(expected_mode_info, screen._mode_info)
eq(true, screen._cursor_style_enabled)
eq('normal', screen.mode)
end)
-- Event is published ONLY if the cursor style changed.
screen._mode_info = nil
command("echo 'test'")
screen:expect{grid=[[
^ |
~ |
~ |
~ |
test |
]], condition=function()
eq(nil, screen._mode_info)
end}
-- Change the cursor style.
helpers.command('hi Cursor guibg=DarkGray')
helpers.command('set guicursor=n-v-c:block,i-ci-ve:ver25,r-cr-o:hor20'
..',a:blinkwait700-blinkoff400-blinkon250-Cursor/lCursor'
..',sm:block-blinkwait175-blinkoff150-blinkon175')
-- Update the expected values.
for _, m in ipairs(expected_mode_info) do
if m.name == 'showmatch' then
if m.blinkon then m.blinkon = 175 end
if m.blinkoff then m.blinkoff = 150 end
if m.blinkwait then m.blinkwait = 175 end
else
if m.blinkon then m.blinkon = 250 end
if m.blinkoff then m.blinkoff = 400 end
if m.blinkwait then m.blinkwait = 700 end
end
if m.hl_id then
m.hl_id = 49
m.attr = {background = Screen.colors.DarkGray}
end
if m.id_lm then m.id_lm = 50 end
end
-- Assert the new expectation.
screen:expect(function()
eq(expected_mode_info, screen._mode_info)
eq(true, screen._cursor_style_enabled)
eq('normal', screen.mode)
end)
-- Change hl groups only, should update the styles
helpers.command('hi Cursor guibg=Red')
helpers.command('hi lCursor guibg=Green')
-- Update the expected values.
for _, m in ipairs(expected_mode_info) do
if m.hl_id then
m.attr = {background = Screen.colors.Red}
end
if m.id_lm then
m.attr_lm = {background = Screen.colors.Green}
end
end
-- Assert the new expectation.
screen:expect(function()
eq(expected_mode_info, screen._mode_info)
eq(true, screen._cursor_style_enabled)
eq('normal', screen.mode)
end)
-- Another cursor style.
meths.set_option('guicursor', 'n-v-c:ver35-blinkwait171-blinkoff172-blinkon173'
..',ve:hor35,o:ver50,i-ci:block,r-cr:hor90,sm:ver42')
screen:expect(function()
local named = {}
for _, m in ipairs(screen._mode_info) do
named[m.name] = m
end
eq('vertical', named.normal.cursor_shape)
eq(35, named.normal.cell_percentage)
eq('horizontal', named.visual_select.cursor_shape)
eq(35, named.visual_select.cell_percentage)
eq('vertical', named.operator.cursor_shape)
eq(50, named.operator.cell_percentage)
eq('block', named.insert.cursor_shape)
eq('vertical', named.showmatch.cursor_shape)
eq(90, named.cmdline_replace.cell_percentage)
eq(171, named.normal.blinkwait)
eq(172, named.normal.blinkoff)
eq(173, named.normal.blinkon)
eq(42, named.showmatch.cell_percentage)
end)
end)
it("empty 'guicursor' sets cursor_shape=block in all modes", function()
meths.set_option('guicursor', '')
screen:expect(function()
-- Empty 'guicursor' sets enabled=false.
eq(false, screen._cursor_style_enabled)
for _, m in ipairs(screen._mode_info) do
if m['cursor_shape'] ~= nil then
eq('block', m.cursor_shape)
eq(0, m.blinkon)
end
end
end)
end)
end)
|
--
-- Jhonathan Paulo Banczek. 2020 - jpbanczek@gmail.com - github.com/jhoonb
--
--[[
functions:
utils.jointables(t[, ...]) --> in-place
utils.slicetable(t[, ibegin[, iend[, step] ] ]) --> table
utils.minmax(vet) --> number, number
utils.newarray(size[, value]) --> table
utils.newarrayrandom(size[, m[, n] ]) --> table
utils.cmp(veti, vetj) --> boolean
utils.copy(vet) --> table
--]]
local utils = {}
local _ipairs = ipairs
local _random = math.random
local _randomseed = math.randomseed
local _time = os.time
--
-- jointables(t[, ...]) concate várias tabelas ao final de t (in-place)
-- Ex.:
-- t = {1, 2}
-- jointables(t) --> t = {1, 2}
-- jointables(t, {3, 4}) --> t = {1, 2, 3, 4}
-- jointables(t, {3, 4}, {5}) --> t = {1, 2, 3, 4, 5}
-- jointables(t, {3, 4}, {5}, {6, 7}) --> t = {1, 2, 3, 4, 5, 6, 7}
---------------------------------------------------------------------
-- param t: table
-- param ...: tables
-- return
---------------------------------------------------------------------
utils.jointables = function(t, ...)
for _, v in _ipairs({...}) do
for j = 1, #v do
t[#t+1] = v[j]
end
end
end
--
-- slicetable(t[, ibegin[, iend[, step]]]) retorna uma fatia
-- (slice) do array t.
-- Ex.:
-- slicetable({1, 2, 3, 4, 5}, 2, 4) --> {2, 3, 4}
-- slicetable({1, 2, 3, 4, 5}, 2, 4, 2) --> {2, 4}
-- slicetable({1, 2, 3, 4, 5}, 2, 4, 3) --> {2}
-- slicetable({1, 2, 3, 4, 5}) --> {1, 2, 3, 4, 5}
---------------------------------------------------------------------
-- param t: table
-- param ibegin: number
-- param iend: number
-- param step: number
-- return: table, novo array ordenado
---------------------------------------------------------------------
utils.slicetable = function(t, ibegin, iend, step)
local ibegin = ibegin or 1
local iend = iend or #t
local step = step or 1
local nt = {}
for i = ibegin, iend, step do nt[#nt+1] = t[i] end
return nt
end
--
-- minmax(vet) encontra o menor e o maior valor em vet
-- Ex.:
-- minmax({1,2,3,4,5}) --> 1, 5
-- minmax({10,2,2,4,5}) --> 2, 10
---------------------------------------------------------------------
-- param vet: table
-- return: number, number
---------------------------------------------------------------------
utils.minmax = function(vet)
local minvalue, maxvalue = vet[1], vet[1]
for i = 2, #vet do
if maxvalue <= vet[i] then maxvalue = vet[i] end
if minvalue >= vet[i] then minvalue = vet[i] end
end
return minvalue, maxvalue
end
--
-- newarray(size[, value]) retorna um novo array de tamanho size
-- com value de valor padrão
-- Ex.:
-- newarray(5, 0) --> {0, 0, 0, 0, 0}
-- newarray(4, "Lua") --> {"Lua", "Lua", "Lua", "Lua"}
---------------------------------------------------------------------
-- param size: number, tamanho do novo array
-- param value: valor padrão dos elementos de array
-- return arr: table
---------------------------------------------------------------------
utils.newarray = function(size, value)
local value = value or 0
local arr = {}
for i = 1, size do arr[i] = value end
return arr
end
--
-- newarrayrandom(size[, m[, n]]) retorna um novo array de tamanho size
-- com valores aleatorios entre m e n
-- Ex.:
-- newarrayrandom(5) == newarrayrandom(5, 1, 1000)
-- newarrayrandom(5, 1) == newarrayrandom(5, 1, 1000)
-- newarrayrandom(5, 1, 10) --> {10, 5, 6, 3, 5}
---------------------------------------------------------------------
-- param size: number, tamanho do novo array
-- param m: number
-- param n: number
-- return arr: table
---------------------------------------------------------------------
utils.newarrayrandom = function(size, m, n)
_randomseed(_time())
local m = m or 1
local n = n or 1000
local arr = {}
for i = 1, size do arr[i] = _random(m, n) end
return arr
end
--
-- cmp(veti, vetj) compara dois vetores e retorna true
-- se todos os elementos forem iguais, do contrário retorna false
-- Ex.:
-- cmp({10, 20, 30}, {10, 20, 30}) --> true
-- cmp({1}, {1}) --> true
---------------------------------------------------------------------
-- param veti: table
-- param verj: table
-- return boolean
---------------------------------------------------------------------
utils.cmp = function(veti, vetj)
if #veti ~= #vetj then print('#veti ~= #vetj') ; return false end
local function pprint(i, j, k) print(
'i: ' .. i .. '|value veti: ' .. j .. '|value vetj: ' .. k)
end
if #veti ~= #vetj then return false end
for i=1, #veti do
-- pprint(i, veti[i], vetj[i])
if veti[i] ~= vetj[i] then pprint(i, veti[i], vetj[i]); return false end
end
return true
end
--
-- copy(vet) retorna uma copia valor por valor do array vet
---------------------------------------------------------------------
-- param vet: table
-- return table
---------------------------------------------------------------------
utils.copy = function(vet)
local newvet = {}
for i=1, #vet do newvet[#newvet+1] = vet[i] end
return newvet
end
-- return module
return utils |
function Initialize()
Location = SKIN:GetVariable("@").."app"
end
function Update()
if SKIN:GetVariable("AppRun") == "on" then
SKIN:Bang("!SetVariable", "AppRun", "off")
local command = table.concat({
[[start %ComSpec% /D /E:ON /F:OFF /K]],
string.format([["call cd %s &]], Location),
[[bundle install & bundle exec ruby app.rb"]]
})
os.execute(command)
end
end |
-----------------------------------
-- Area: Selbina
-- NPC: Explorer Moogle
-----------------------------------
require("scripts/globals/teleports")
-----------------------------------
local eventId = 1135
function onTrade(player,npc,trade)
end
function onTrigger(player,npc)
tpz.teleport.explorerMoogleOnTrigger(player, eventId)
end
function onEventUpdate(player,csid,option)
end
function onEventFinish(player,csid,option)
tpz.teleport.explorerMoogleOnEventFinish(player, csid, option, eventId)
end
|
-- NoIndex: true
--[[
Lokasenna_GUI example
- General demonstration
- Tabs and layer sets
- Subwindows
- Accessing elements' parameters
]]--
-- The Core library must be loaded prior to anything else
local lib_path = reaper.GetExtState("Lokasenna_GUI", "lib_path_v2")
if not lib_path or lib_path == "" then
reaper.MB("Couldn't load the Lokasenna_GUI library. Please run 'Script: Set Lokasenna_GUI v2 library path.lua' in your Action List.", "Whoops!", 0)
return
end
loadfile(lib_path .. "Core.lua")()
GUI.req("Classes/Class - Label.lua")()
GUI.req("Classes/Class - Knob.lua")()
GUI.req("Classes/Class - Tabs.lua")()
GUI.req("Classes/Class - Slider.lua")()
GUI.req("Classes/Class - Button.lua")()
GUI.req("Classes/Class - Menubox.lua")()
GUI.req("Classes/Class - Textbox.lua")()
GUI.req("Classes/Class - Frame.lua")()
GUI.req("Classes/Class - Options.lua")()
GUI.req("Classes/Class - Window.lua")()
-- If any of the requested libraries weren't found, abort the script.
if missing_lib then return 0 end
------------------------------------
-------- Functions -----------------
------------------------------------
local function fade_lbl()
-- Fade out the label
if GUI.elms.my_lbl.z == 3 then
GUI.elms.my_lbl:fade(1, 3, 6)
-- Bring it back
else
GUI.elms.my_lbl:fade(1, 3, 6, -3)
end
end
local function btn_click()
-- Open the Window element
GUI.elms.wnd_test:open()
end
local function wnd_OK()
-- Close the Window element
GUI.elms.wnd_test:close()
end
-- Returns a list of every element on the specified z-layer and
-- a second list of each element's values
local function get_values_for_tab(tab_num)
-- The '+ 2' here is just to translate from a tab number to its'
-- associated z layer. More complicated scripts would have to
-- actually access GUI.elms.tabs.z_sets[tab_num] and iterate over
-- the table's contents (see the call to GUI.elms.tabs:update_sets
-- below)
local strs_v, strs_val = {}, {}
for k, v in pairs(GUI.elms_list[tab_num + 2]) do
strs_v[#strs_v + 1] = v
local val = GUI.Val(v)
if type(val) == "table" then
local strs = {}
for k, v in pairs(val) do
local str = tostring(v)
-- For conciseness, reduce boolean values to T/F
if str == "true" then
str = "T"
elseif str == "false" then
str = "F"
end
strs[#strs + 1] = str
end
val = table.concat(strs, ", ")
end
-- Limit the length of the returned string so it doesn't
-- spill out past the edge of the window
strs_val[#strs_val + 1] = string.len(tostring(val)) <= 35
and tostring(val)
or string.sub(val, 1, 32) .. "..."
end
return strs_v, strs_val
end
------------------------------------
-------- Window settings -----------
------------------------------------
GUI.name = "New Window"
GUI.x, GUI.y, GUI.w, GUI.h = 0, 0, 432, 500
GUI.anchor, GUI.corner = "mouse", "C"
--[[
Button z, x, y, w, h, caption, func[, ...]
Checklist z, x, y, w, h, caption, opts[, dir, pad]
Frame z, x, y, w, h[, shadow, fill, color, round]
Knob z, x, y, w, caption, min, max, default[, inc, vals]
Label z, x, y, caption[, shadow, font, color, bg]
Menubox z, x, y, w, h, caption, opts
Radio z, x, y, w, h, caption, opts[, dir, pad]
Slider z, x, y, w, caption, min, max, defaults[, inc, dir]
Tabs z, x, y, tab_w, tab_h, opts[, pad]
Textbox z, x, y, w, h[, caption, pad]
Window z, x, y, w, h, caption, z_set[, center]
]]--
-- Elements can be created in any order you want. I find it easiest to organize them
-- by tab, or by what part of the script they're involved in.
------------------------------------
-------- General elements ----------
------------------------------------
GUI.New("tabs", "Tabs", 1, 0, 0, 64, 20, "Stuff,Sliders,Options", 16)
GUI.New("tab_bg", "Frame", 2, 0, 0, 448, 20, false, true, "elm_bg", 0)
GUI.New("my_btn", "Button", 1, 168, 28, 96, 20, "Go!", btn_click)
GUI.New("btn_frm", "Frame", 1, 0, 56, GUI.w, 4, true, true)
-- Telling the tabs which z layers to display
-- See Classes/Tabs.lua for more detail
GUI.elms.tabs:update_sets(
-- Tab
-- Layers
{ [1] = {3},
[2] = {4},
[3] = {5},
}
)
-- Notice that layers 1 and 2 aren't assigned to a tab; this leaves them visible
-- all the time.
------------------------------------
-------- Tab 1 Elements ------------
------------------------------------
GUI.New("my_lbl", "Label", 3, 256, 96, "Label!", true, 1)
GUI.New("my_knob", "Knob", 3, 64, 112, 48, "Volume", 0, 11, 44, 0.25)
GUI.New("my_mnu", "Menubox", 3, 256, 176, 64, 20, "Options:", "1,2,3,4,5,6.12435213613")
GUI.New("my_btn2", "Button", 3, 256, 256, 64, 20, "Click me!", fade_lbl)
GUI.New("my_txt", "Textbox", 3, 96, 224, 96, 20, "Text:", 4)
GUI.New("my_frm", "Frame", 3, 16, 288, 192, 128, true, false, "elm_frame", 4)
-- We have too many values to be legible if we draw them all; we'll disable them, and
-- have the knob's caption update itself to show the value instead.
GUI.elms.my_knob.vals = false
function GUI.elms.my_knob:redraw()
GUI.Knob.redraw(self)
self.caption = self.retval .. "dB"
end
-- Make sure it shows the value right away
GUI.elms.my_knob:redraw()
GUI.Val("my_frm", "this is a really long string of text with no carriage returns so hopefully "..
"it will be wrapped correctly to fit inside this frame")
GUI.elms.my_frm.bg = "elm_bg"
------------------------------------
-------- Tab 2 Elements ------------
------------------------------------
GUI.New("my_rng", "Slider", 4, 32, 128, 256, "Sliders", 0, 30, {5, 10, 15, 20, 25})
GUI.New("my_pan", "Slider", 4, 32, 192, 256, "Pan", -100, 100, 100)
GUI.New("my_sldr", "Slider", 4, 128, 256, 128, "Slider", 0, 10, 20, 0.25, "v")
GUI.New("my_rng2", "Slider", 4, 352, 96, 256, "Vertical?", 0, 30, {5, 10, 15, 20, 25}, nil, "v")
-- Using a function to change the value label depending on the value
GUI.elms.my_pan.output = function(val)
val = tonumber(val)
return (val == 0 and "0"
or (math.abs(val)..
(val < 0 and "L" or "R")
)
)
end
------------------------------------
-------- Tab 3 Elements ------------
------------------------------------
GUI.New("my_chk", "Checklist", 5, 32, 96, 160, 160, "Checklist:", "Alice,Bob,Charlie,Denise,Edward,Francine", "v", 4)
GUI.New("my_opt", "Radio", 5, 200, 96, 160, 160, "Options:", "Apples,Bananas,_,Donuts,Eggplant", "v", 4)
GUI.New("my_chk2", "Checklist", 5, 32, 280, 384, 64, "Whoa, another Checklist", "A,B,C,_,D,E,F,_,G,H,I", "h", 4)
GUI.New("my_opt2", "Radio", 5, 32, 364, 384, 64, "Horizontal options", "A,A#,B,C,C#,D,D#,E,F,F#,G,G#", "h", 4)
GUI.elms.my_opt.swap = true
GUI.elms.my_chk2.swap = true
------------------------------------
-------- Subwindow and -------------
-------- its elements -------------
------------------------------------
GUI.New("wnd_test", "Window", 10, 0, 0, 312, 244, "Dialog Box", {9, 10})
GUI.New("lbl_elms", "Label", 9, 16, 16, "", false, 4)
GUI.New("lbl_vals", "Label", 9, 96, 16, "", false, 4, nil, elm_bg)
GUI.New("btn_close", "Button", 9, 0, 184, 48, 24, "OK", wnd_OK)
-- We want these elements out of the way until the window is opened
GUI.elms_hide[9] = true
GUI.elms_hide[10] = true
-- :onopen is a hook provided by the Window class. This function will be run
-- every time the window opens.
function GUI.elms.wnd_test:onopen()
-- :adjustelm places the element's specified x,y coordinates relative to
-- the Window. i.e. creating an element at 0,0 and adjusting it will put
-- the element in the Window's top-left corner.
self:adjustelm(GUI.elms.btn_close)
-- Buttons look nice when they're centered.
GUI.elms.btn_close.x, _ = GUI.center(GUI.elms.btn_close, self)
self:adjustelm(GUI.elms.lbl_elms)
self:adjustelm(GUI.elms.lbl_vals)
-- Set the Window's title
local tab_num = GUI.Val("tabs")
self.caption = "Element values for Tab " .. tab_num
-- This Window provides a readout of the values for every element
-- on the current tab.
local strs_v, strs_val = get_values_for_tab(tab_num)
GUI.Val("lbl_elms", table.concat(strs_v, "\n"))
GUI.Val("lbl_vals", table.concat(strs_val, "\n"))
end
------------------------------------
-------- Main functions ------------
------------------------------------
-- This will be run on every update loop of the GUI script; anything you would put
-- inside a reaper.defer() loop should go here. (The function name doesn't matter)
local function Main()
-- Prevent the user from resizing the window
if GUI.resized then
-- If the window's size has been changed, reopen it
-- at the current position with the size we specified
local __,x,y,w,h = gfx.dock(-1,0,0,0,0)
gfx.quit()
gfx.init(GUI.name, GUI.w, GUI.h, 0, x, y)
GUI.redraw_z[0] = true
end
end
-- Open the script window and initialize a few things
GUI.Init()
-- Tell the GUI library to run Main on each update loop
-- Individual elements are updated first, then GUI.func is run, then the GUI is redrawn
GUI.func = Main
-- How often (in seconds) to run GUI.func. 0 = every loop.
GUI.freq = 0
-- Start the main loop
GUI.Main()
|
----------------------------------------------------------------------------------------------------
--
-- All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
-- its licensors.
--
-- For complete copyright and license terms please see the LICENSE at the root of this
-- distribution (the "License"). All use of this software is governed by the License,
-- or, if provided, by the license below or the license accompanying this file. Do not
-- remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--
--
----------------------------------------------------------------------------------------------------
local ImageFillTypes =
{
Properties =
{
FilledImages = { default = { EntityId(), EntityId(), EntityId(), EntityId() } },
Dropdowns = { default = { EntityId(), EntityId(), EntityId(), EntityId() } },
RadialStartAngleSlider = { default = EntityId() },
SpriteRadioButtonGroup = { default = EntityId() },
},
}
function ImageFillTypes:OnActivate()
self.tickBusHandler = TickBus.Connect(self)
self.totalTime = 0
self.dropdownHandlers = {}
for i = 0, #self.Properties.Dropdowns do
self.dropdownHandlers[i] = UiDropdownNotificationBus.Connect(self, self.Properties.Dropdowns[i])
end
self.radialStartAngleSliderHandler = UiSliderNotificationBus.Connect(self, self.Properties.RadialStartAngleSlider)
self.spriteRadioButtonGroupHandler = UiRadioButtonGroupNotificationBus.Connect(self, self.Properties.SpriteRadioButtonGroup)
end
function ImageFillTypes:OnTick(deltaTime, timePoint)
self.totalTime = self.totalTime + deltaTime
for i = 0, #self.Properties.FilledImages do
fillAmount = 1.0-((math.cos(self.totalTime)*0.5)+0.5) -- Scale cos output to the range [0,1]
UiImageBus.Event.SetFillAmount(self.Properties.FilledImages[i], fillAmount)
end
end
function ImageFillTypes:OnDeactivate()
self.tickBusHandler:Disconnect()
for i = 0, #self.Properties.Dropdowns do
self.dropdownHandlers[i]:Disconnect()
end
self.radialStartAngleSliderHandler:Disconnect()
self.spriteRadioButtonGroupHandler:Disconnect()
end
function ImageFillTypes:OnDropdownValueChanged(entityId)
local dropdown = UiDropdownNotificationBus.GetCurrentBusId()
local parent = UiElementBus.Event.GetParent(entityId)
local selectedIndex = UiElementBus.Event.GetIndexOfChildByEntityId(parent, entityId)
if dropdown == self.Properties.Dropdowns[0] then
-- Linear
UiImageBus.Event.SetEdgeFillOrigin(self.Properties.FilledImages[0], selectedIndex)
elseif dropdown == self.Properties.Dropdowns[2] then
-- Radial corner
UiImageBus.Event.SetCornerFillOrigin(self.Properties.FilledImages[2], selectedIndex)
elseif dropdown == self.Properties.Dropdowns[3] then
-- Radial edge
UiImageBus.Event.SetEdgeFillOrigin(self.Properties.FilledImages[3], selectedIndex)
end
self.totalTime = 0
self:OnTick(0, 0)
end
function ImageFillTypes:OnSliderValueChanged(value)
-- Radial
local slider = UiSliderNotificationBus.GetCurrentBusId()
if slider == self.Properties.RadialStartAngleSlider then
UiImageBus.Event.SetRadialFillStartAngle(self.Properties.FilledImages[1], value)
end
self.totalTime = 0
self:OnTick(0, 0)
end
function ImageFillTypes:OnRadioButtonGroupStateChange(entityId)
local selectedIndex = UiElementBus.Event.GetIndexOfChildByEntityId(self.Properties.SpriteRadioButtonGroup, entityId)
if selectedIndex == 0 then
-- No sprite
for i = 0, #self.Properties.FilledImages do
UiImageBus.Event.SetSpritePathname(self.Properties.FilledImages[i], "")
end
elseif selectedIndex == 1 then
-- Sprite
for i = 0, #self.Properties.FilledImages do
UiImageBus.Event.SetImageType(self.Properties.FilledImages[i], eUiImageType_StretchedToFit)
UiImageBus.Event.SetSpritePathname(self.Properties.FilledImages[i], "ui/textures/lyshineexamples/scroll_box_icon_5.tif")
end
elseif selectedIndex == 2 then
-- Sliced sprite
for i = 0, #self.Properties.FilledImages do
UiImageBus.Event.SetImageType(self.Properties.FilledImages[i], eUiImageType_Sliced)
UiImageBus.Event.SetSpritePathname(self.Properties.FilledImages[i], "ui/textures/lyshineexamples/button.tif")
UiImageBus.Event.SetFillCenter(self.Properties.FilledImages[i], true)
end
elseif selectedIndex == 3 then
-- Sliced sprite, no center
for i = 0, #self.Properties.FilledImages do
UiImageBus.Event.SetImageType(self.Properties.FilledImages[i], eUiImageType_Sliced)
UiImageBus.Event.SetSpritePathname(self.Properties.FilledImages[i], "ui/textures/lyshineexamples/button.tif")
UiImageBus.Event.SetFillCenter(self.Properties.FilledImages[i], false)
end
end
end
return ImageFillTypes |
require("pman")
|
-- mod-version:2 -- lite-xl 2.0
local style = require "core.style"
local DocView = require "core.docview"
local common = require "core.common"
local draw_line_text = DocView.draw_line_text
function DocView:draw_line_text(idx, x, y)
local font = (self:get_font() or style.syntax_fonts["comment"])
local color = style.syntax.comment
local ty, tx = y + self:get_line_text_y_offset()
local text, offset, s, e = self.doc.lines[idx], 1
while true do
s, e = text:find(" +", offset)
if not s then break end
tx = self:get_col_x_offset(idx, s) + x
renderer.draw_text(font, string.rep("·", e - s + 1), tx, ty, color)
offset = e + 1
end
offset = 1
while true do
s, e = text:find("\t", offset)
if not s then break end
tx = self:get_col_x_offset(idx, s) + x
renderer.draw_text(font, "»", tx, ty, color)
offset = e + 1
end
draw_line_text(self, idx, x, y)
end
|
--------------------------
-- @file user.lua
-- @brief
-- @author yingx
-- @date 2021-06-10
--------------------------
local cjson = require "cjson"
local xxtea = require "xxtea"
local str = require "utils.str"
local db = require "utils.mysql"
local conf = require "openvue.conf"
local lang = require "openvue.lang"
local function checkUser(context)
local user = nil
if context.req and context.req.args and context.req.args.token then
local token = xxtea.decrypt(context.req.args.token, 'Adp201609203059Z')
local infos = str.split(token, ':')
if #infos >= 3 then
-- 先不校验过期时间
local sql = string.format("SELECT b.id, a.open_code, b.name, b.head_img_url, b.mobile, c.code FROM account a, user b, user_group c, user_group_user d WHERE a.user_id = b.id AND b.id = d.user_id AND c.id = d.user_group_id AND a.deleted = 0 AND b.deleted = 0 AND c.deleted = 0 AND d.deleted = 0 AND a.open_code = '%s' and b.password = '%s'", infos[2], infos[3])
local users = db.query(conf.db_option, sql, 10)
if users then
local user_map = {}
for i, v in ipairs(users) do
if user_map[infos[2]] then
table.insert(user_map[infos[2]].roles, v.code)
else
user_map[infos[2]] = {}
user_map[infos[2]].name = v.name
user_map[infos[2]].introduction = ''
user_map[infos[2]].avatar = v.head_img_url
user_map[infos[2]].roles = {}
table.insert(user_map[infos[2]].roles, v.code)
end
end
user = user_map[infos[2]]
end
end
end
return user
end
local function handleLogin(context)
local data = {}
local sql = string.format("SELECT b.password FROM account a, user b WHERE a.user_id = b.id AND a.deleted = 0 AND b.deleted = 0 AND a.open_code = '%s'", context.params.username)
local passwords = db.query(conf.db_option, sql, 10)
if passwords and passwords[1] and passwords[1].password == context.params.password then
local val = string.format("%d:%s:%s", ngx.now(), context.params.username, context.params.password)
local token = xxtea.encrypt(val, 'Adp201609203059Z')
data.code = 20000
data.data = {}
data.data.token = token
else
data.code = 60204
data.message = 'Account and password are incorrect'
end
return data
end
local function handleInfo(context)
local data = {}
local user = checkUser(context)
if user then
data.code = 20000
data.data = user
else
data.code = 60204
data.message = 'Account and password are incorrect'
end
return data
end
local function handleLogout(context)
local data = {}
data.code = 20000
data.data = {}
return data
end
local actions = {
login = handleLogin,
info = handleInfo,
logout = handleLogout,
}
local function handle(context)
local data = {}
local found = false
if actions[context.req.action] then
found = true
data = actions[context.req.action](context)
end
if not found then
data.status = 50007
data.message = lang.L("wrong parameter")
end
return data
end
local _M = {
handle = handle,
}
return _M
|
data:extend({
{
type = "selection-tool",
name = "ScreenshotCamera",
icon = "__SC_camera__/graphics/icon_camera.png",
icon_size = 64,
subgroup = "tool",
stack_size= 1,
selection_mode = {"nothing"},
selection_cursor_box_type = "pair",
selection_color = {r = 0.7, g = 0, b = 0.7},
alt_selection_mode = {"nothing"},
alt_selection_color = {r = 0.7, g = 7, b = 0},
alt_selection_cursor_box_type = "pair"
}
}) |
local function paste_handler(overridden)
return function(lines, phase)
if phase == -1 then
-- non-streaming: all text is in a single call
vim.call("hltermpaste#start_paste")
overridden(lines, phase)
vim.call("hltermpaste#finish_paste")
elseif phase == 1 then
-- starts the paste
vim.call("hltermpaste#start_paste")
overridden(lines, phase)
elseif phase == 3 then
-- ends the paste
overridden(lines, phase)
vim.call("hltermpaste#finish_paste")
else
overridden(lines, phase)
end
end
end
local function setup()
vim.paste = paste_handler(vim.paste)
end
return {
setup = setup,
}
|
-- Copyright 2013 Jon S Akhtar (Sylvanaar)
--
-- 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.
--- Reading and Writing Files.
-- @module io
local io = {}
--- File object
-- @class file
local file = {}
---
-- Closes `file`. Note that files are automatically closed when their
-- handles are garbage collected, but that takes an unpredictable amount of
-- time to happen.
function file:close() end
---
-- Saves any written data to `file`.
function file:flush() end
---
-- Returns an iterator function that, each time it is called, returns a
-- new line from the file. Therefore, the construction
-- for line in file:lines() do *body* end
-- will iterate over all lines of the file. (Unlike `io.lines`, this function
-- does not close the file when the loop ends.)
function file:lines() end
---
-- Reads the file `file`, according to the given formats, which specify
-- what to read. For each format, the function returns a string (or a number)
-- with the characters read, or nil if it cannot read data with the specified
-- format. When called without formats, it uses a default format that reads
-- the entire next line (see below).
-- The available formats are
-- "*n": reads a number; this is the only format that returns a number
-- instead of a string.
-- "*a": reads the whole file, starting at the current position. On end of
-- file, it returns the empty string.
-- "*l": reads the next line (skipping the end of line), returning nil on
-- end of file. This is the default format.
-- *number*: reads a string with up to this number of characters, returning
-- nil on end of file. If number is zero, it reads nothing and returns an
-- empty string, or nil on end of file.
function file:read(...) end
---
-- Sets and gets the file position, measured from the beginning of the
-- file, to the position given by `offset` plus a base specified by the string
-- `whence`, as follows:
-- "set": base is position 0 (beginning of the file);
-- "cur": base is current position;
-- "end": base is end of file;
-- In case of success, function `seek` returns the final file position,
-- measured in bytes from the beginning of the file. If this function fails,
-- it returns nil, plus a string describing the error.
-- The default value for `whence` is `"cur"`, and for `offset` is 0. Therefore,
-- the call `file:seek()` returns the current file position, without changing
-- it; the call `file:seek("set")` sets the position to the beginning of the
-- file (and returns 0); and the call `file:seek("end")` sets the position
-- to the end of the file, and returns its size.
function file:seek(whence, offset) end
---
-- Sets the buffering mode for an output file. There are three available
-- modes:
--
-- * "no": no buffering; the result of any output operation appears immediately.
-- * "full": full buffering; output operation is performed only when the
-- buffer is full (or when you explicitly `flush` the file (see `io.flush`)).
-- * "line": line buffering; output is buffered until a newline is output or
-- there is any input from some special files (such as a terminal device).
-- For the last two cases, `size` specifies the size of the buffer, in
-- bytes. The default is an appropriate size.
function file:setvbuf(mode, size) end
---
-- Writes the value of each of its arguments to the `file`. The arguments
-- must be strings or numbers. To write other values, use `tostring` or
-- `string.format` before `write`.
function file:write(...) end
---
-- Equivalent to `file:close()`. Without a `file`, closes the default
-- output file.
function io.close(file) end
---
-- Equivalent to `file:flush` over the default output file.
function io.flush() end
---
-- When called with a file name, it opens the named file (in text mode),
-- and sets its handle as the default input file. When called with a file
-- handle, it simply sets this file handle as the default input file. When
-- called without parameters, it returns the current default input file.
-- In case of errors this function raises the error, instead of returning an
-- error code.
function io.input(file) end
---
-- Opens the given file name in read mode and returns an iterator function
-- that, each time it is called, returns a new line from the file. Therefore,
-- the construction
-- for line in io.lines(filename) do *body* end
-- will iterate over all lines of the file. When the iterator function detects
-- the end of file, it returns nil (to finish the loop) and automatically
-- closes the file.
-- The call `io.lines()` (with no file name) is equivalent to
-- `io.input():lines()`; that is, it iterates over the lines of the default
-- input file. In this case it does not close the file when the loop ends.
function io.lines(filename) end
---
-- This function opens a file, in the mode specified in the string `mode`. It
-- returns a new file handle, or, in case of errors, nil plus an error message.
-- The `mode` string can be any of the following:
-- "r": read mode (the default);
-- "w": write mode;
-- "a": append mode;
-- "r+": update mode, all previous data is preserved;
-- "w+": update mode, all previous data is erased;
-- "a+": append update mode, previous data is preserved, writing is only
-- allowed at the end of file.
-- The `mode` string can also have a '`b`' at the end, which is needed in
-- some systems to open the file in binary mode. This string is exactly what
-- is used in the standard C function `fopen`.
function io.open(filename, mode) return file end
---
-- Similar to `io.input`, but operates over the default output file.
function io.output(file) end
---
-- Starts program `prog` in a separated process and returns a file handle
-- that you can use to read data from this program (if `mode` is `"r"`,
-- the default) or to write data to this program (if `mode` is `"w"`).
-- This function is system dependent and is not available on all platforms.
function io.popen(prog, mode) end
---
-- Equivalent to `io.input():read`.
function io.read(...) end
-- * `io.stderr`: Standard error.
io.stderr = file
-- * `io.stdin`: Standard in.
io.stdin = file
-- * `io.stdout`: Standard out.
io.stdout = file
---
-- Returns a handle for a temporary file. This file is opened in update
-- mode and it is automatically removed when the program ends.
function io.tmpfile() end
---
-- Checks whether `obj` is a valid file handle. Returns the string `"file"`
-- if `obj` is an open file handle, `"closed file"` if `obj` is a closed file
-- handle, or nil if `obj` is not a file handle.
function io.type(obj) end
---
-- Equivalent to `io.output():write`.
function io.write(...) end
return io
|
pg = pg or {}
pg.enemy_data_statistics_237 = {
[12900411] = {
cannon = 0,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 20001,
air = 0,
rarity = 1,
dodge = 0,
torpedo = 0,
durability_growth = 6800,
antiaircraft = 0,
reload_growth = 0,
dodge_growth = 0,
speed = 30,
star = 1,
hit = 8,
antisub_growth = 0,
air_growth = 0,
hit_growth = 120,
base = 90,
durability = 700,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
antiaircraft_growth = 0,
luck = 0,
battle_unit_type = 20,
id = 12900411,
antisub = 0,
armor = 0,
appear_fx = {
"appearsmall"
}
},
[12900412] = {
cannon = 0,
battle_unit_type = 35,
rarity = 1,
speed_growth = 0,
pilot_ai_template_id = 20001,
air = 0,
luck = 0,
dodge = 0,
wave_fx = "danchuanlanghuaxiao2",
cannon_growth = 0,
speed = 15,
reload_growth = 0,
dodge_growth = 0,
id = 12900412,
star = 1,
hit = 8,
antisub_growth = 0,
air_growth = 0,
reload = 150,
base = 70,
durability = 265,
armor_growth = 0,
torpedo_growth = 864,
luck_growth = 0,
hit_growth = 120,
armor = 0,
torpedo = 30,
durability_growth = 2550,
antisub = 0,
antiaircraft = 0,
antiaircraft_growth = 0,
appear_fx = {
"appearsmall"
},
equipment_list = {
1000861
}
},
[12900413] = {
cannon = 50,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 80000,
air = 0,
rarity = 1,
dodge = 0,
torpedo = 100,
durability_growth = 2550,
antiaircraft = 0,
reload_growth = 0,
dodge_growth = 0,
hit_growth = 1200,
star = 1,
hit = 81,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 15,
base = 80,
durability = 70,
armor_growth = 0,
torpedo_growth = 1080,
luck_growth = 0,
speed = 30,
luck = 0,
id = 12900413,
antiaircraft_growth = 0,
antisub = 0,
armor = 0,
appear_fx = {
"appearsmall"
},
equipment_list = {
1000866
}
},
[12900421] = {
cannon = 18,
reload = 150,
speed_growth = 0,
cannon_growth = 1200,
rarity = 4,
air = 0,
torpedo = 78,
dodge = 22,
durability_growth = 111000,
antiaircraft = 65,
luck = 0,
reload_growth = 0,
dodge_growth = 306,
hit_growth = 210,
star = 4,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 90,
base = 273,
durability = 1280,
armor_growth = 0,
torpedo_growth = 3000,
luck_growth = 0,
speed = 20,
armor = 0,
id = 12900421,
antiaircraft_growth = 2800,
antisub = 0,
equipment_list = {
1000711,
1000716,
1000721,
1000726,
1000731,
1000736
}
},
[12900422] = {
cannon = 55,
reload = 150,
speed_growth = 0,
cannon_growth = 1600,
rarity = 3,
air = 0,
torpedo = 80,
dodge = 11,
durability_growth = 123200,
antiaircraft = 145,
luck = 0,
reload_growth = 0,
dodge_growth = 156,
hit_growth = 210,
star = 4,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 90,
base = 274,
durability = 1420,
armor_growth = 0,
torpedo_growth = 2000,
luck_growth = 0,
speed = 20,
armor = 0,
id = 12900422,
antiaircraft_growth = 3600,
antisub = 0,
equipment_list = {
1000681,
1000686,
1000691,
1000696,
1000701,
1000706
}
},
[12900423] = {
cannon = 18,
reload = 150,
speed_growth = 0,
cannon_growth = 1200,
rarity = 4,
air = 0,
torpedo = 78,
dodge = 22,
durability_growth = 118000,
antiaircraft = 65,
luck = 0,
reload_growth = 0,
dodge_growth = 306,
hit_growth = 210,
star = 4,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 90,
base = 273,
durability = 1410,
armor_growth = 0,
torpedo_growth = 3000,
luck_growth = 0,
speed = 20,
armor = 0,
id = 12900423,
antiaircraft_growth = 2800,
antisub = 0,
equipment_list = {
1000711,
1000716,
1000721,
1000726,
1000731,
1000736
}
},
[12900424] = {
cannon = 55,
reload = 150,
speed_growth = 0,
cannon_growth = 1600,
rarity = 3,
air = 0,
torpedo = 80,
dodge = 11,
durability_growth = 134400,
antiaircraft = 145,
luck = 0,
reload_growth = 0,
dodge_growth = 156,
hit_growth = 210,
star = 4,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 90,
base = 274,
durability = 1550,
armor_growth = 0,
torpedo_growth = 2000,
luck_growth = 0,
speed = 20,
armor = 0,
id = 12900424,
antiaircraft_growth = 3600,
antisub = 0,
equipment_list = {
1000681,
1000686,
1000691,
1000696,
1000701,
1000706
}
},
[12900425] = {
cannon = 18,
reload = 150,
speed_growth = 0,
cannon_growth = 1200,
rarity = 4,
air = 0,
torpedo = 78,
dodge = 22,
durability_growth = 126000,
antiaircraft = 65,
luck = 0,
reload_growth = 0,
dodge_growth = 306,
hit_growth = 210,
star = 4,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 90,
base = 273,
durability = 1540,
armor_growth = 0,
torpedo_growth = 3000,
luck_growth = 0,
speed = 20,
armor = 0,
id = 12900425,
antiaircraft_growth = 2800,
antisub = 0,
equipment_list = {
1000711,
1000716,
1000721,
1000726,
1000731,
1000736
}
},
[12900426] = {
cannon = 55,
reload = 150,
speed_growth = 0,
cannon_growth = 1600,
rarity = 3,
air = 0,
torpedo = 80,
dodge = 11,
durability_growth = 145600,
antiaircraft = 145,
luck = 0,
reload_growth = 0,
dodge_growth = 156,
hit_growth = 210,
star = 4,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 90,
base = 274,
durability = 1680,
armor_growth = 0,
torpedo_growth = 2000,
luck_growth = 0,
speed = 20,
armor = 0,
id = 12900426,
antiaircraft_growth = 3600,
antisub = 0,
equipment_list = {
1000681,
1000686,
1000691,
1000696,
1000701,
1000706
}
},
[12900427] = {
cannon = 80,
reload = 150,
speed_growth = 0,
cannon_growth = 2000,
rarity = 3,
air = 0,
torpedo = 55,
dodge = 11,
durability_growth = 166400,
antiaircraft = 120,
luck = 0,
reload_growth = 0,
dodge_growth = 156,
hit_growth = 210,
star = 4,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 90,
base = 275,
durability = 2610,
armor_growth = 0,
torpedo_growth = 1500,
luck_growth = 0,
speed = 20,
armor = 0,
id = 12900427,
antiaircraft_growth = 3200,
antisub = 0,
equipment_list = {
1000741,
1000746,
1000751,
1000756,
1000761,
1000766,
1000771
}
},
[12900441] = {
cannon = 89,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 10001,
air = 0,
rarity = 4,
dodge = 14,
torpedo = 175,
durability_growth = 0,
antiaircraft = 210,
reload_growth = 0,
dodge_growth = 256,
hit_growth = 210,
star = 4,
hit = 18,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 95,
base = 413,
durability = 18960,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
speed = 18,
luck = 0,
id = 12900441,
antiaircraft_growth = 0,
antisub = 0,
armor = 0,
equipment_list = {
617041,
617042,
617043,
617044,
617045
}
},
[12900442] = {
cannon = 64,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 10001,
air = 0,
rarity = 3,
dodge = 16,
torpedo = 235,
durability_growth = 0,
antiaircraft = 95,
reload_growth = 0,
dodge_growth = 264,
hit_growth = 210,
star = 4,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 95,
base = 414,
durability = 12450,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
speed = 20,
luck = 0,
id = 12900442,
antiaircraft_growth = 0,
antisub = 0,
armor = 0,
appear_fx = {
"bossguangxiao",
"appearQ"
},
equipment_list = {
617051,
617052,
617053,
617054
}
},
[12900443] = {
cannon = 75,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
pilot_ai_template_id = 10001,
air = 0,
rarity = 3,
dodge = 18,
torpedo = 260,
durability_growth = 0,
antiaircraft = 145,
reload_growth = 0,
dodge_growth = 264,
hit_growth = 210,
star = 4,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 95,
base = 162,
durability = 19800,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
speed = 20,
luck = 0,
id = 12900443,
antiaircraft_growth = 0,
antisub = 0,
armor = 0,
appear_fx = {
"bossguangxiao",
"appearQ"
},
equipment_list = {
617061,
617062,
617063,
617064,
617065,
617066
}
},
[12900444] = {
cannon = 180,
reload = 150,
speed_growth = 0,
cannon_growth = 0,
rarity = 5,
air = 0,
torpedo = 150,
dodge = 14,
durability_growth = 0,
antiaircraft = 360,
luck = 0,
reload_growth = 0,
dodge_growth = 210,
hit_growth = 210,
star = 6,
hit = 14,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 95,
base = 364,
durability = 31500,
armor_growth = 0,
torpedo_growth = 0,
luck_growth = 0,
speed = 18,
armor = 0,
id = 12900444,
antiaircraft_growth = 0,
antisub = 0,
appear_fx = {
"bossguangxiao",
"appearQ"
},
equipment_list = {
617071,
617072,
617073,
617074,
617075,
617076,
617077,
617078
}
},
[12900501] = {
cannon = 7,
reload = 150,
speed_growth = 0,
cannon_growth = 560,
pilot_ai_template_id = 20005,
air = 0,
rarity = 1,
dodge = 0,
torpedo = 33,
durability_growth = 10000,
antiaircraft = 60,
reload_growth = 0,
dodge_growth = 0,
hit_growth = 144,
star = 2,
hit = 10,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 25,
base = 105,
durability = 300,
armor_growth = 0,
torpedo_growth = 3250,
luck_growth = 0,
speed = 15,
luck = 0,
id = 12900501,
antiaircraft_growth = 1000,
antisub = 0,
armor = 0,
appear_fx = {
"appearsmall"
},
equipment_list = {
1100102,
1100497
}
},
[12900502] = {
cannon = 16,
reload = 150,
speed_growth = 0,
cannon_growth = 880,
pilot_ai_template_id = 20005,
air = 0,
rarity = 1,
dodge = 0,
torpedo = 26,
durability_growth = 19200,
antiaircraft = 120,
reload_growth = 0,
dodge_growth = 0,
hit_growth = 144,
star = 2,
hit = 10,
antisub_growth = 0,
air_growth = 0,
battle_unit_type = 30,
base = 107,
durability = 510,
armor_growth = 0,
torpedo_growth = 2250,
luck_growth = 0,
speed = 15,
luck = 0,
id = 12900502,
antiaircraft_growth = 2250,
antisub = 0,
armor = 0,
appear_fx = {
"appearsmall"
},
equipment_list = {
1100427,
1100232
}
}
}
return
|
---------------------------------------------------------------------------
-- Reflect a widget along one or both axis.
--
--
--
--
--
-- @author dodo
-- @copyright 2012 dodo
-- @containermod wibox.container.mirror
-- @supermodule wibox.widget.base
---------------------------------------------------------------------------
local type = type
local error = error
local ipairs = ipairs
local setmetatable = setmetatable
local base = require("wibox.widget.base")
local matrix = require("gears.matrix")
local gtable = require("gears.table")
local mirror = { mt = {} }
-- Layout this layout
function mirror:layout(_, width, height)
if not self._private.widget then return end
local m = matrix.identity
local t = { x = 0, y = 0 } -- translation
local s = { x = 1, y = 1 } -- scale
if self._private.horizontal then
t.x = width
s.x = -1
end
if self._private.vertical then
t.y = height
s.y = -1
end
m = m:translate(t.x, t.y)
m = m:scale(s.x, s.y)
return { base.place_widget_via_matrix(self._private.widget, m, width, height) }
end
-- Fit this layout into the given area.
function mirror:fit(context, ...)
if not self._private.widget then
return 0, 0
end
return base.fit_widget(self, context, self._private.widget, ...)
end
--- The widget to be reflected.
--
-- @property widget
-- @tparam widget widget The widget.
-- @interface container
mirror.set_widget = base.set_widget_common
function mirror:get_widget()
return self._private.widget
end
function mirror:get_children()
return {self._private.widget}
end
function mirror:set_children(children)
self:set_widget(children[1])
end
--- Reset this layout. The widget will be removed and the axes reset.
--
-- @method reset
-- @interface container
function mirror:reset()
self._private.horizontal = false
self._private.vertical = false
self:set_widget(nil)
end
function mirror:set_reflection(reflection)
if type(reflection) ~= 'table' then
error("Invalid type of reflection for mirror layout: " ..
type(reflection) .. " (should be a table)")
end
for _, ref in ipairs({"horizontal", "vertical"}) do
if reflection[ref] ~= nil then
self._private[ref] = reflection[ref]
end
end
self:emit_signal("widget::layout_changed")
self:emit_signal("property::reflection", reflection)
end
--- Get the reflection of this mirror layout.
--
-- @property reflection
-- @tparam table reflection A table of booleans with the keys "horizontal", "vertical".
-- @tparam boolean reflection.horizontal
-- @tparam boolean reflection.vertical
-- @propemits true false
function mirror:get_reflection()
return { horizontal = self._private.horizontal, vertical = self._private.vertical }
end
--- Returns a new mirror container.
--
-- A mirror container mirrors a given widget. Use the `widget` property to set
-- the widget and `reflection` property to set the direction.
-- horizontal and vertical are by default false which doesn't change anything.
--
-- @tparam[opt] widget widget The widget to display.
-- @tparam[opt] table reflection A table describing the reflection to apply.
-- @treturn table A new mirror container
-- @constructorfct wibox.container.mirror
local function new(widget, reflection)
local ret = base.make_widget(nil, nil, {enable_properties = true})
ret._private.horizontal = false
ret._private.vertical = false
gtable.crush(ret, mirror, true)
ret:set_widget(widget)
ret:set_reflection(reflection or {})
return ret
end
function mirror.mt:__call(...)
return new(...)
end
return setmetatable(mirror, mirror.mt)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
function PlayerNameFunction(playerName)
gui = gui or GuiCreate()
GuiStartFrame(gui)
local screenWidth, screenHeight = GuiGetScreenDimensions(gui)
screenWidth, screenHeight = screenWidth/2, screenHeight/2
local entityId = GetUpdatedEntityID()
local x, y = EntityGetTransform(entityId)
function getEntityPositionOnScreen(entityId)
local camX, camY = GameGetCameraPos()
return screenWidth+((x-camX)*1.5),screenHeight+((y-camY)*1.5)
end
local entityX, entityY = getEntityPositionOnScreen(EntityGetWithTag("player_unit")[1])
local playerNameLength = string.len(playerName)
local playerNameMid = entityX -(playerNameLength*2)
GuiText(gui,playerNameMid,entityY,playerName)
end
PlayerNameFunction("testname") |
minetest.register_on_joinplayer(function(player)
local meta = player:get_meta()
if meta:get_int("handgun_skill") == 0
then
meta:set_int("handgun_skill",100)
end
if meta:get_int("mp_skill") == 0
then
meta:set_int("mp_skill",100)
end
if meta:get_int("smg_skill") == 0
then
meta:set_int("smg_skill",100)
end
if meta:get_int("shotgun_skill") == 0
then
meta:set_int("shotgun_skill",100)
end
if meta:get_int("heavy_skill") == 0
then
meta:set_int("heavy_skill",100)
end
if meta:get_int("arifle_skill") == 0
then
meta:set_int("arifle_skill",100)
end
if meta:get_int("revolver_skill") == 0
then
meta:set_int("revolver_skill",100)
end
if meta:get_int("rifle_skill") == 0
then
meta:set_int("rifle_skill",100)
end
if meta:get_int("throw_skill") == 0
then
meta:set_int("throw_skill",100)
end
end)
minetest.register_chatcommand("gunskills", {
func = function(name, param)
for _, player in pairs(minetest.get_connected_players()) do
local meta = player:get_meta()
local handguns = meta:get_int("handgun_skill")
local mps = meta:get_int("mp_skill")
local smgs = meta:get_int("smg_skill")
local shotguns = meta:get_int("shotgun_skill")
local heavy = meta:get_int("heavy_skill")
local arifle = meta:get_int("arifle_skill")
local revolver = meta:get_int("revolver_skill")
local rifle = meta:get_int("rifle_skill")
local throw = meta:get_int("throw_skill")
minetest.show_formspec(name, "rangedweapons:gunskills_form",
"size[11,7]"..
"label[0,0;Gun efficiency: increases damage, accuracy and crit chance.]"..
"image[0,1;1,1;rangedweapons_handgun_img.png]"..
"label[1,1.2;Handgun efficiency: " .. handguns .. "%]"..
"image[0,2;1,1;rangedweapons_machinepistol_img.png]"..
"label[1,2.2;M.Pistol efficiency: " .. mps .. "%]"..
"image[0,3;1,1;rangedweapons_smg_img.png]"..
"label[1,3.2;S.M.G efficiency: " .. smgs .. "%]"..
"image[0,4;1,1;rangedweapons_shotgun_img.png]"..
"label[1,4.2;Shotgun efficiency: " .. shotguns .. "%]"..
"image[0,5;1,1;rangedweapons_heavy_img.png]"..
"label[1,5.2;Heavy.MG efficiency: " .. heavy .. "%]"..
"image[0,6;1,1;rangedweapons_arifle_img.png]"..
"label[1,6.2;A.rifle efficiency: " .. arifle .. "%]"..
"image[5,1;1,1;rangedweapons_revolver_img.png]"..
"label[6,1.2;Revl./mgn. efficiency: " .. revolver .. "%]"..
"image[5,2;1,1;rangedweapons_rifle_img.png]"..
"label[6,2.2;Rifle efficiency: " .. rifle .. "%]"..
"image[5,3;1,1;rangedweapons_yeetable_img.png]"..
"label[6,3.2;Throwing efficiency: " .. throw .. "%]"..
"button_exit[9,0;2,1;exit;Done]")
end
end
})
local timer = 0
minetest.register_globalstep(function(dtime, player)
timer = timer + dtime;
if timer >= 60.0 then
for _, player in pairs(minetest.get_connected_players()) do
local meta = player:get_meta()
local handguns = meta:get_int("handgun_skill")
local mps = meta:get_int("mp_skill")
local smgs = meta:get_int("smg_skill")
local shotguns = meta:get_int("shotgun_skill")
local heavy = meta:get_int("heavy_skill")
local arifle = meta:get_int("arifle_skill")
local revolver = meta:get_int("revolver_skill")
local rifle = meta:get_int("rifle_skill")
local throw = meta:get_int("throw_skill")
if math.random(1, 40) == 1 then
if handguns > rweapons_min_gun_efficiency then
meta:set_int("handgun_skill", handguns - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Handgun skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if mps > rweapons_min_gun_efficiency then
meta:set_int("mp_skill", mps - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Machine Pistol skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if smgs > rweapons_min_gun_efficiency then
meta:set_int("smg_skill", smgs - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","S.M.G skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if shotguns > rweapons_min_gun_efficiency then
meta:set_int("shotgun_skill", shotguns - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Shotgun skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if heavy > rweapons_min_gun_efficiency then
meta:set_int("heavy_skill", heavy - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Heavy.MG skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if arifle > rweapons_min_gun_efficiency then
meta:set_int("arifle_skill", arifle - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","A.Rifle skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if revolver > rweapons_min_gun_efficiency then
meta:set_int("revolver_skill", revolver - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Revolver/magnum skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if rifle > rweapons_min_gun_efficiency then
meta:set_int("rifle_skill", rifle - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Rifle skill degraded! "))
end
end
if math.random(1, 40) == 1 then
if throw > rweapons_min_gun_efficiency then
meta:set_int("throw_skill", throw - 1)
minetest.chat_send_player(player:get_player_name(), "" ..core.colorize("#ff0000","Throwing skill degraded! "))
end
end
timer = 0
end
end
end)
|
local spec = false
local specply = nil
local checktimer = nil
function checkuntilvalid()
for i,ply in pairs(GetStreamedPlayers()) do
if ply==specply then
spec=true
DestroyTimer(checktimer)
end
end
end
AddRemoteEvent("SpecRemoteEvent",function(bool,plyid,x,y,z)
if bool == false then
spec=false
specply=nil
else
specply=plyid
actor = GetPlayerActor(GetPlayerId())
actor:SetActorLocation(FVector( x,y,0))
checktimer = CreateTimer(checkuntilvalid,10)
end
end)
function stopspec()
spec=false
specply=nil
SetCameraLocation(0,0,0,false)
SetCameraRotation(0,0,0,false)
CallRemoteEvent("NoLongerSpectating")
end
AddEvent("OnGameTick",function(ds)
if spec then
if IsValidPlayer(specply) then
local x, y, z = GetPlayerLocation(specply)
local x2, y2, z2 = GetPlayerLocation(GetPlayerId())
local heading = GetPlayerHeading(specply)
if z > 0 then -- if the player is under 0 or == 0 it looks like he is spectating
if GetDistance2D(x, y, x2, y2)>3000 then
actor = GetPlayerActor(GetPlayerId())
actor:SetActorLocation(FVector( x,y,0))
end
if GetPlayerVehicle(specply) == 0 then
local fx,fy,fz = GetPlayerForwardVector(specply)
local hittype, hitid, impactX, impactY, impactZ = LineTrace(x-fx*40,y-fy*40,z,x-fx*300, y-fy*300, z+150)
if (hittype~=2 and impactX==0 and impactY==0 and impactZ==0) then
SetCameraLocation(x-fx*300, y-fy*300, z+150 , true)
SetCameraRotation(-25,heading,0)
else
SetCameraLocation(impactX, impactY, impactZ , true)
SetCameraRotation(-25,heading,0)
end
else
local veh = GetPlayerVehicle(specply)
local x, y, z = GetVehicleLocation(veh)
local rx, ry, rz = GetVehicleRotation(veh)
local fx,fy,fz = GetVehicleForwardVector(veh)
SetCameraLocation(x-fx*600, y-fy*600, z+275 , true)
SetCameraRotation(-15,ry,rz)
end
else
stopspec()
end
else
stopspec()
end
end
end)
AddEvent("OnKeyPress",function(key)
if (spec and key=="S") then
stopspec()
end
end)
AddEvent("OnRenderHUD", function()
if spec then
DrawText(5, 400, "Press S to stop spectating")
end
end) |
local fetch_local_conf = require("apisix.core.config_local").local_conf
-- local log = require("apisix.core.log")
-- local json = require("apisix.core.json")
local http = require("resty.http")
local _M = {
version = 0.1,
}
function _M.request_self(uri, opts)
local local_conf = fetch_local_conf()
if not local_conf or not local_conf.apisix
or not local_conf.apisix.node_listen then
return nil, nil -- invalid local yaml config
end
local httpc = http.new()
local full_uri = "http://127.0.0.1:" .. local_conf.apisix.node_listen
.. uri
return httpc:request_uri(full_uri, opts)
end
return _M
|
PLUGIN.name = "Business Permits"
PLUGIN.desc = "Adds business permits which are needed to purchase certain goods."
PLUGIN.author = "Chessnut"
function PLUGIN:CanPlayerUseBusiness(client, uniqueID)
local itemTable = nut.item.list[uniqueID]
if (itemTable and itemTable.permit) then
if (client:getChar():getInv():hasItem("permit_"..itemTable.permit)) then
return true
end
end
end |
print("client test") |
--[[
UI Container
Holds UI objects and passes calls to them
]]
local lib
local container
local ui_base
local ui_container
ui_container = {
clip_children = false,
auto_hook = {
["draw"] = true, ["tick"] = true,
["mousedown"] = true, ["mousedown_in"] = true, ["mousedown_out"] = true,
["mouseup"] = true, ["mouseup_in"] = true, ["mouseup_out"] = true
},
draw = function(self, event)
local ox = event.ox + self.x
local oy = event.oy + self.y
local handlers = self.events["draw"]
local event_data = handlers.data
event_data:update(event)
event_data:add(self)
local flags = event_data.flags
local ox = event.ox + self.x
local oy = event.oy + self.y
event_data.ox = ox
event_data.oy = oy
love.graphics.push()
love.graphics.translate(ox, oy)
if (self.clip_children) then
love.graphics.setScissor(ox, oy, self.width, self.height)
end
for key = 1, #handlers do
local handler = handlers[key]
handler[2](handler[1], event_data)
if (flags.event_unhook) then
handlers[key] = nil
flags.event_unhook = false
end
if (flags.event_cancel) then
break
end
end
love.graphics.setScissor()
love.graphics.pop()
return event_data
end,
positional_event = function(self, event_name, event)
self:event_fire(event_name, event)
local ox = event.ox + self.x
local oy = event.oy + self.y
local x = event.abs_x - ox
local y = event.abs_y - oy
local handlers = self.events[event_name .. "_out"]
local event_data = handlers.data
event_data:update(event)
event_data:add(self)
event_data.x, event_data.y = x, y
event_data.ox, event_data.oy = ox, oy
local flags = event_data.flags
for key = 1, #handlers do
local handler = handlers[key]
local object = handler[1]
if (x < object.x or y < object.y or
x > (object.x + object.width) or y > (object.y + object.height)) then
handler[2](handler[1], event_data)
end
if (flags.event_unhook) then
handlers[key] = nil
flags.event_unhook = false
end
if (flags.event_cancel) then
break
end
end
if (not self.clip_children) then
local handlers = self.events[event_name .. "_in"]
local event_data = handlers.data
event_data:update(event)
event_data:add(self)
event_data.x, event_data.y = x, y
event_data.ox, event_data.oy = ox, oy
local flags = event_data.flags
for key = 1, #handlers do
local handler = handlers[key]
local object = handler[1]
if (x > object.x and y > object.y and
x < (object.x + object.width) and y < (object.y + object.height)) then
handler[2](handler[1], event_data)
end
if (flags.event_unhook) then
handlers[key] = nil
flags.event_unhook = false
end
if (flags.event_cancel) then
break
end
end
end
end,
positional_event_in = function(self, event_name, event)
if (self.clip_children) then
local handlers = self.events[event_name .. "_in"]
local event_data = handlers.data
event_data:update(event)
event_data:add(self)
local ox = event.ox + self.x
local oy = event.oy + self.y
local x = event.abs_x - ox
local y = event.abs_y - oy
event_data.x, event_data.y = x, y
event_data.ox, event_data.oy = ox, oy
local flags = event_data.flags
for key = 1, #handlers do
local handler = handlers[key]
local object = handler[1]
if (x > object.x and y > object.y and
x < (object.x + object.width) and y < (object.y + object.height)) then
handler[2](handler[1], event_data)
end
if (flags.event_unhook) then
handlers[key] = nil
flags.event_unhook = false
end
if (flags.event_cancel) then
break
end
end
return event_data
end
end,
mousedown = function(self, event)
self:positional_event("mousedown", event)
end,
mousedown_in = function(self, event)
self:positional_event_in("mousedown", event)
end,
mouseup = function(self, event)
self:positional_event("mouseup", event)
end,
mouseup_in = function(self, event)
self:positional_event_in("mouseup", event)
end,
_new = function(base, new, x, y, w, h)
container._new(base, new)
ui_base._new(base, new, x, y, w, h)
return new
end,
init = function(self, engine)
lib = engine.lib
lib.oop:objectify(self)
container = self:inherit(engine:lib_get(":event.container"))
ui_base = self:inherit(engine:lib_get(":ui.base"))
end
}
ui_container.event = {
draw = ui_container.draw,
mousedown = ui_container.mousedown,
mousedown_in = ui_container.mousedown_in,
mouseup = ui_container.mouseup,
mouseup_in = ui_container.mouseup_in
}
return ui_container |
-- id int 特效id
-- effects dict[3] 特效表现
-- execute string 执行特效
-- continue string 持续特效
-- disappear string 消失特效
-- start_lv int 需求等级
-- instead_lv tableString[k:#seq|v:#1(int)] 替换等级
-- check_points tableString[k:#seq|v:#1(int)] 检查点
-- chance fixedint 检查概率
-- conditions dict[3] 检查条件
-- condition1 tableString[k:#seq|v:#1(fixedfloat)] 条件一
-- condition2 tableString[k:#seq|v:#1(fixedfloat)] 条件二
-- condition3 tableString[k:#seq|v:#1(fixedfloat)] 条件三
-- range tableString[k:#seq|v:#1(fixedfloat)] 目标选择
-- delay int 延迟施放
-- type int 特效类型
-- type_sub int 类型子类
-- type_content tableString[k:#seq|v:#1(fixedint)] 类型具体内容
-- parameter1 tableString[k:#seq|v:#1(fixedfloat)] 特殊参数1
-- parameter2 tableString[k:#seq|v:#1(fixedfloat)] 特殊参数2
-- parameter3 tableString[k:#seq|v:#1(fixedfloat)] 特殊参数3
-- buff_icon string buff图标
-- turn tableString[k:#seq|v:#1(fixedfloat)] 持续时间
-- number tableString[k:#seq|v:#1(fixedfloat)] 次数持续
-- tags tableString[k:#seq|v:#1(int)] 标签
return {
[404011] = {
effects = {
execute = "",
continue = "",
disappear = "",
},
start_lv = 1,
instead_lv = nil,
check_points = {
[1] = 5,
},
chance = 104857600 --[[100]],
conditions = {
condition1 = {
[1] = 0 --[[0]],
[2] = 3145728 --[[3]],
[3] = 0 --[[0]],
[4] = 42991616 --[[41]],
},
condition2 = nil,
condition3 = nil,
},
range = {
[1] = 0 --[[0]],
[2] = 0 --[[0]],
[3] = 0 --[[0]],
},
delay = nil,
type = 40,
type_sub = 2,
type_content = {
[1] = 31457280000 --[[30000]],
[2] = 0 --[[0]],
},
parameter1 = nil,
parameter2 = nil,
parameter3 = nil,
buff_icon = "",
turn = nil,
number = nil,
tags = nil,
},
[404012] = {
effects = {
execute = "",
continue = "Effect/Buffs/Yoshino_PassiveSS",
disappear = "Effect/Buffs/Yoshino_PassiveSS_01",
},
start_lv = 1,
instead_lv = nil,
check_points = {
[1] = 5,
},
chance = 104857600 --[[100]],
conditions = {
condition1 = {
[1] = 0 --[[0]],
[2] = 3145728 --[[3]],
[3] = 0 --[[0]],
[4] = 4194304 --[[4]],
},
condition2 = nil,
condition3 = nil,
},
range = {
[1] = 0 --[[0]],
[2] = 0 --[[0]],
[3] = 0 --[[0]],
},
delay = nil,
type = 552,
type_sub = nil,
type_content = {
[1] = 41943040 --[[40]],
[2] = 0 --[[0]],
},
parameter1 = {
[1] = 0 --[[0]],
[2] = 0 --[[0]],
},
parameter2 = {
[1] = 0 --[[0]],
[2] = 0 --[[0]],
},
parameter3 = nil,
buff_icon = "attr_icon",
turn = {
[1] = -1048576 --[[-1]],
[2] = 0 --[[0]],
[3] = 0 --[[0]],
[4] = 0 --[[0]],
},
number = {
[1] = 2097152 --[[2]],
[2] = 104857600 --[[100]],
[3] = 0 --[[0]],
[4] = 0 --[[0]],
},
tags = {
[1] = 1,
[2] = 1,
},
},
[404021] = {
effects = {
execute = "",
continue = "",
disappear = "",
},
start_lv = 1,
instead_lv = nil,
check_points = {
[1] = 5,
},
chance = 104857600 --[[100]],
conditions = {
condition1 = {
[1] = 0 --[[0]],
[2] = 3145728 --[[3]],
[3] = 0 --[[0]],
[4] = 4194304 --[[4]],
},
condition2 = nil,
condition3 = nil,
},
range = {
[1] = 0 --[[0]],
[2] = 10485760000 --[[10000]],
[3] = 1048576 --[[1]],
},
delay = nil,
type = 10,
type_sub = nil,
type_content = {
[1] = 10485760 --[[10]],
[2] = 0 --[[0]],
},
parameter1 = nil,
parameter2 = nil,
parameter3 = nil,
buff_icon = "",
turn = nil,
number = nil,
tags = nil,
},
[404022] = {
effects = {
execute = "",
continue = "",
disappear = "",
},
start_lv = 1,
instead_lv = nil,
check_points = {
[1] = 0,
},
chance = 104857600 --[[100]],
conditions = {
condition1 = nil,
condition2 = nil,
condition3 = nil,
},
range = {
[1] = 0 --[[0]],
[2] = 0 --[[0]],
[3] = 0 --[[0]],
},
delay = nil,
type = 1001,
type_sub = nil,
type_content = {
[1] = -41943040 --[[-40]],
[2] = 0 --[[0]],
[3] = 0 --[[0]],
[4] = 0 --[[0]],
},
parameter1 = {
[1] = 0 --[[0]],
[2] = 0 --[[0]],
},
parameter2 = {
[1] = 3145728 --[[3]],
[2] = 0 --[[0]],
},
parameter3 = nil,
buff_icon = "attr_icon",
turn = {
[1] = 209715200 --[[200]],
[2] = 0 --[[0]],
[3] = 209715200 --[[200]],
[4] = 0 --[[0]],
},
number = {
[1] = 0 --[[0]],
[2] = 0 --[[0]],
[3] = 0 --[[0]],
},
tags = {
[1] = 5,
[2] = 1,
},
},
[404031] = {
effects = {
execute = "",
continue = "",
disappear = "",
},
start_lv = 1,
instead_lv = nil,
check_points = {
[1] = 0,
},
chance = 104857600 --[[100]],
conditions = {
condition1 = nil,
condition2 = nil,
condition3 = nil,
},
range = {
[1] = 0 --[[0]],
[2] = 0 --[[0]],
[3] = 0 --[[0]],
},
delay = nil,
type = 40,
type_sub = 0,
type_content = {
[1] = 31457280000 --[[30000]],
[2] = 0 --[[0]],
},
parameter1 = nil,
parameter2 = nil,
parameter3 = nil,
buff_icon = "",
turn = nil,
number = nil,
tags = nil,
},
[404032] = {
effects = {
execute = "",
continue = "",
disappear = "",
},
start_lv = 1,
instead_lv = nil,
check_points = {
[1] = 0,
},
chance = 104857600 --[[100]],
conditions = {
condition1 = nil,
condition2 = nil,
condition3 = nil,
},
range = {
[1] = 0 --[[0]],
[2] = 0 --[[0]],
[3] = 0 --[[0]],
},
delay = nil,
type = 551,
type_sub = nil,
type_content = {
[1] = 10485760 --[[10]],
[2] = 0 --[[0]],
},
parameter1 = {
[1] = 0 --[[0]],
[2] = 0 --[[0]],
},
parameter2 = {
[1] = 0 --[[0]],
[2] = 0 --[[0]],
},
parameter3 = nil,
buff_icon = "attr_icon",
turn = {
[1] = -1048576 --[[-1]],
[2] = 0 --[[0]],
[3] = 0 --[[0]],
[4] = 0 --[[0]],
},
number = {
[1] = 0 --[[0]],
[2] = 0 --[[0]],
[3] = 0 --[[0]],
},
tags = {
[1] = 1,
[2] = 1,
},
},
}
|
lang.br = {
police = 'Policial',
sale = 'À venda',
close = 'Fechar',
soon = 'Em breve!',
house = 'Casa',
yes = 'Sim',
no = 'Não',
thief = 'Ladrão',
House1 = 'Casa clássica',
House2 = 'Casa de Família',
House3 = 'Casa Mal Assombrada',
goTo = 'Entrar\n',
fisher = 'Pescador',
furniture = 'Móveis',
hospital = 'Hospital',
open = 'Abrir',
use = 'Usar',
using = 'Usando',
error = 'Erro',
submit = 'Validar',
cancel = 'Cancelar',
fishWarning = 'Você não pode pescar aqui.',
fishingError = 'Você não está mais pescando.',
closed_market = 'O mercado está fechado. Volte depois!',
closed_police = 'A delegacia está fechada. Volte depois!',
timeOut = 'Local indisponível.',
password = 'Senha',
passwordError = 'Mínimo de 1 letra',
incorrect = 'Incorreto',
buy = 'Comprar',
alreadyLand = 'Algum jogador já adquiriu este terreno.',
moneyError = 'Você não tem dinheiro suficiente.',
copAlerted = 'Os policiais foram alertados.',
looseMgs = 'Você será solto em %s segundos.',
runAway = 'Fuja por %s segundos.',
alert = 'Alerta!',
copError = 'Você deve esperar 10 segundos para prender novamente.',
closed_dealership = 'A concessionária está fechada. Volte depois!',
miner = 'Mineiro',
pickaxeError = 'Você deve comprar uma picareta.',
pickaxes = 'Picaretas',
closed_buildshop = 'A oficina do Jason está fechada. Volte depois!',
energy = 'Energia',
sleep = 'Sono',
leisure = 'Lazer',
hunger = 'Fome',
elevator = 'Elevador',
healing = 'Você será curado em %s segundos.',
pizzaMaker = 'Pizzaiolo',
noEnergy = 'Você precisa de mais energia para trabalhar novamente.',
use = 'Usar',
remove = 'Remover',
items = 'Itens:',
bagError = 'Espaço insuficiente na mochila.',
item_pickaxe = 'Picareta',
item_surfboard = 'Prancha de Surf',
item_clock = 'Relógio',
boats = 'Barcos',
vehicles = 'Veículos',
error_boatInIsland = 'Você não pode usar um barco longe do mar.',
item_milk = 'Garrafa de Leite',
mine5error = 'A mina desabou.',
vehicle_5 = 'Bote',
noMissions = 'Não há missões disponíveis.',
questsName = 'Missões',
completedQuest = 'Missão finalizada',
receiveQuestReward = 'Receber recompensa',
rewardNotFound = 'Recompensa não encontrada',
npc_mine6msg = 'Isso pode desabar a qualquer momento, mas ninguém me escuta...',
item_goldNugget = 'Ouro',
goldAdded = 'O ouro que você coletou foi colocado na sua mochila.',
sellGold = 'Vender %s ouro(s) por <vp>%s</vp>',
settings_gameHour = 'Horário',
settings_gamePlaces = 'Lugares',
settingsText_availablePlaces = 'Lugares disponíveis: <vp>%s</vp>',
settingsText_placeWithMorePlayers = 'Lugar com mais jogadores: <vp>%s</vp> <r>(%s)</r>',
settingsText_hour = 'Hora atual: <vp>%s</vp>',
item_dynamite = 'Dinamite',
placeDynamite = 'Plantar dinamite',
energyInfo = '<v>%s</v> de energia',
hungerInfo = '<v>%s</v> de comida',
itemDesc_clock = 'Um relógio simples que pode ser utilizado uma única vez.',
itemDesc_dynamite = 'Boom!',
itemDesc_pickaxe = 'Quebre pedras com maior facilidade!',
hey = 'Ei! Parado!',
robberyInProgress = 'Roubo em andamento',
closed_bank = 'O banco está fechado. Volte novamente mais tarde.',
bankRobAlert = 'O banco está sendo assaltado. Defenda-o!',
runAwayCoinInfo = 'Você receberá %s após completar o roubo.',
atmMachine = 'Caixa eletrônico',
codeInfo = 'Digite um código válido e clique em validar para resgatar sua recompensa.\nVocê pode obter novos códigos através do nosso servidor no Discord.\n<a href="event:getDiscordLink"><v>(Clique aqui para receber o link de convite)</v></a>',
item_shrinkPotion = 'Poção do Encolhimento',
itemDesc_shrinkPotion = 'Use essa poção para diminuir o seu tamanho por %s segundos!',
mouseSizeError = 'Você está muito pequeno para realizar essa ação.',
enterQuestPlace = 'Desbloqueie este lugar ao completar <vp>%s</vp>.',
closed_potionShop = 'A loja de poções está fechada. Volte novamente mais tarde.',
bag = 'Mochila',
ranking_coins = 'Moedas Acumuladas',
ranking_spentCoins = 'Moedas Gastas',
item_growthPotion = 'Poção do Crescimento',
itemDesc_growthPotion = 'Use essa poção para aumentar o seu tamanho por %s segundos!',
codeAlreadyReceived = 'Código já utilizado.',
codeReceived = 'Você resgatou: %s.',
codeNotAvailable = 'Código indisponível.',
quest = 'Missão',
job = 'Trabalho',
chooseOption = 'Escolha uma opção',
newUpdate = 'Nova atualização!',
itemDesc_goldNugget = 'Brilhante e valioso.',
shop = 'Loja',
item_coffee = 'Café',
item_hotChocolate = 'Chocolate Quente',
item_milkShake = 'Milkshake',
speed = 'Velocidade: %s',
price = 'Preço: %s',
owned = 'Adquirido',
updateWarning = '<font size="10"><rose><p align="center">Atenção!</p></rose>\nAtualização em %smin %ss.',
waitUntilUpdate = '<rose>Por favor aguarde.</rose>',
playerBannedFromRoom = '%s foi banido desta sala.',
playerUnbannedFromRoom = '%s foi desbanido.',
harvest = 'Colher',
item_bag = 'Mochila',
itemDesc_bag = '+ %s de armazenamento da mochila.',
item_seed = 'Semente',
itemDesc_seed = 'Uma semente aleatória.',
item_tomato = 'Tomate',
item_fertilizer = 'Fertilizante',
itemDesc_fertilizer = 'Faça as plantas crescerem mais rápido!',
error_maxStorage = 'Limite excedido.',
drop = 'Largar',
item_lemon = 'Limão',
item_lemonSeed = 'Semente de limão',
item_tomatoSeed = 'Semente de tomate',
item_oregano = 'Orégano',
item_oreganoSeed = 'Semente de orégano',
item_water = 'Balde d\'água',
itemDesc_water = 'Faça as plantas crescerem mais rápido!',
houses = 'Casas',
expansion = 'Expansões',
furnitures = 'Móveis',
settings = 'Configurações',
furniture_oven = 'Fogão',
expansion_pool = 'Piscina',
expansion_garden = 'Plantação',
expansion_grass = 'Grama',
chooseExpansion = 'Escolha uma expansão',
item_pepper = 'Pimenta',
item_luckyFlower = 'Flor-da-sorte',
item_pepperSeed = 'Semente de pimenta',
item_luckyFlowerSeed = 'Semente de Flor-da-sorte',
closed_seedStore = 'A loja de sementes está fechada. Volte novamente mais tarde.',
item_salt = 'Sal',
item_sauce = 'Molho de Tomate',
item_hotsauce = 'Molho Apimentado',
item_dough = 'Massa',
item_wheat = 'Trigo',
item_wheatSeed = 'Semente de trigo',
item_pizza = 'Pizza',
recipes = 'Receitas',
cook = 'Cozinhar',
closed_furnitureStore = 'A loja de móveis está fechada. Volte novamente mais tarde.',
maxFurnitureStorage = 'Você só pode colocar %s móveis em sua casa.',
furniture_kitchenCabinet = 'Armário de cozinha',
sell = 'Vender',
item_cornFlakes = 'Flocos de milho',
furniture_flowerVase = 'Vaso de flor',
createdBy = 'Criado por %s',
furniture_painting = 'Pintura',
furniture_sofa = 'Sofá',
furniture_chest = 'Baú',
furniture_tv = 'Tv',
transferedItem = 'O item %s foi transferido para sua mochila.',
passToBag = 'Pôr na mochila',
seeItems = 'Ver Itens',
furnitureRewarded = 'Móvel Desbloqueado: %s',
itemAddedToChest = 'O item %s foi inserido no baú.',
farmer = 'Fazendeiro',
seedSold = 'Você vendeu %s por %s.',
item_pumpkin = 'Abóbora',
item_pumpkinSeed = 'Semente de abóbora',
waitingForPlayers = 'Aguardando jogadores...',
_2ndquest = 'Missão secundária',
sideQuests = {
[1] = 'Plante %s sementes no jardim do Oliver.',
[2] = 'Fertilize %s plantas no jardim do Oliver.',
[3] = 'Consiga %s moedas.',
[4] = 'Prenda um ladrão %s vezes.',
[5] = 'Use %s itens.',
[6] = 'Gaste %s moedas.',
[7] = 'Pesque %s vezes.',
[8] = 'Minere %s pedras de ouro.',
[9] = 'Roube o banco.',
[10] = 'Roube %s vezes.',
[11] = 'Cozinhe %s itens.',
[12] = 'Ganhe %s xp.',
[13] = 'Pesque %s sapos.',
[14] = 'Pesque %s peixes-leão.',
[15] = 'Entregue %s pedidos.',
[16] = 'Entregue %s pedidos.',
[17] = 'Prepare uma pizza.',
[18] = 'Prepare uma brusqueta.',
[19] = 'Prepare uma limonada.',
[20] = 'Prepare um sanduíche de sapo.',
[31] = 'Venda %s cristais.',
[32] = 'Realize uma troca com Dave %s vezes.',
[33] = 'Colha %s plantações.',
[34] = 'Venda %s sementes.',
[35] = 'Venda %s frutos.',
[36] = 'Venda %s peixes.',
[37] = 'Roube %s %s vezes.', -- Rob [NPC] [Amount] times.
[38] = 'Compre %s itens de %s.', -- Buy [Amount] items from [NPC].
},
profile_coins = 'Moedas',
profile_spentCoins = 'Moedas gastas',
profile_completedQuests = 'Missões feitas',
profile_completedSideQuests = 'Missões secundárias feitas',
profile_purchasedHouses = 'Casas adquiridas',
profile_purchasedCars = 'Veículos adquiridos',
profile_basicStats = 'Dados Gerais',
profile_questCoins = 'Pontos de missão',
profile_jobs = 'Trabalhos',
profile_arrestedPlayers = 'Prendeu',
profile_robbery = 'Roubos',
profile_fishes = 'Pescou',
profile_gold = 'Ouro coletado',
profile_seedsPlanted = 'Colheitas',
profile_seedsSold = 'Sementes vendidas',
levelUp = '%s passou para o nível %s!',
sidequestCompleted = 'Você completou uma missão secundária!\nVocê recebeu:',
chestIsFull = 'O baú está cheio.',
code = 'digite um código',
level = 'Nível %s',
furniture_hay = 'Feno',
furniture_shelf = 'Prateleira',
item_superFertilizer = 'Super Fertilizante',
itemDesc_superFertilizer = 'Possui o dobro da eficácia de um fertilizante comum.',
profile_badges = 'Medalhas',
daysLeft = '%s dias restantes',-- d: abbreviation of days
daysLeft2 = '%sd', -- d: abbreviation of days
collectorItem = 'Item de colecionador.',
House4 = 'Celeiro',
House5 = 'Mansão Assombrada',
houseSetting_storeFurnitures = 'Guardar todos os móveis no inventário',
ghostbuster = 'Caça-Fantasmas',
furniture_rip = 'Lápide',
furniture_cross = 'Cruz',
furniture_pumpkin = 'Abóbora do Halloween',
furniture_spiderweb = 'Teia de aranha',
furniture_candle = 'Vela',
furniture_cauldron = 'Caldeirão',
event_halloween2019 = 'Halloween 2019',
ghost = 'Fantasma',
maxFurnitureDepot = 'Seu depósito de móveis está cheio.',
unlockedBadge = 'Você desbloqueou uma nova medalha!',
reward = 'Recompensa',
badgeDesc_0 = 'Halloween 2019',
badgeDesc_1 = 'Encontrou o criador do jogo',
badgeDesc_3 = 'Mineirou 1000 ouros',
badgeDesc_2 = 'Pescou 500 peixes',
badgeDesc_4 = 'Colheu 500 plantas',
item_sugar = 'Açúcar',
item_chocolate = 'Chocolate',
item_cookies = 'Cookies',
furniture_christmasWreath = 'Guirlanda',
furniture_christmasSocks = 'Meia de Natal',
House6 = 'Casa Natalina',
item_blueberries = 'Mirtilos',
item_blueberriesSeed = 'Semente de mirtilo',
furniture_christmasFireplace = 'Lareira',
furniture_christmasSnowman = 'Boneco de Neve',
furniture_christmasGift = 'Caixa de Presente',
vehicle_9 = 'Trenó',
badgeDesc_5 = 'Roubou 500 vezes',
badgeDesc_6 = 'Natal 2019',
badgeDesc_7 = 'Comprou o trenó',
frozenLake = 'O lago está congelado. Aguarde o fim do inverno para poder usar um barco.',
codeLevelError = 'Você precisa alcançar o nível %s para poder resgatar este código.',
furniture_christmasCarnivorousPlant = 'Planta Carnívora',
furniture_christmasCandyBowl = 'Pote de Doces',
settingsText_grounds = 'Pisos gerados: %s/509',
locked_quest = 'Missão %s',
furniture_apiary = 'Caixa de abelhas',
item_cheese = 'Queijo',
itemDesc_cheese = 'Use este item e receba +1 queijo na loja do Transformice!',
item_fish_Smolty = 'Salmão',
item_fish_Lionfish = 'Peixe-Leão',
item_fish_Dogfish = 'Peixe-Cão',
item_fish_Catfish = 'Peixe-Gato',
item_fish_Guppy = 'Barrigudinho',
item_fish_Lobster = 'Lagosta',
item_fish_Goldenmare = 'Goldenmare',
item_fish_Frog = 'Sapo',
emergencyMode_pause = '<cep><b>[Alerta!]</b> <r>O modo de emergência foi ativado. Para evitar que a sala caia, alguns dados demorarão mais tempo para serem processados.',
emergencyMode_resume = '<r>O modo de emergência foi desativado. O jogo voltará ao normal em alguns instantes.',
emergencyMode_able = "<r>A sala crashou :(. Por favor vá para outra sala #mycity.",
settingsText_currentRuntime = 'Runtime: <r>%s</r>/60ms',
settingsText_createdAt = 'Sala criada há <vp>%s</vp> minutos.',
limitedItemBlock = 'Você deve aguardar %s segundos para usar este item.',
eatItem = 'Comer',
ranking_Season = 'Temporada %s',
settings_help = 'Ajuda',
settings_settings = 'Configurações',
settings_credits = 'Créditos',
settings_donate = 'Doar',
settings_creditsText = '<j>#Mycity</j> foi criado por <v>%s</v>, com as artes de <v>%s</v> e com as traduções de:',
settings_creditsText2 = 'Agradecimentos especiais para <v>%s</v> por ajudarem com recursos importantes no minigame.',
settings_donateText = 'O <j>#Mycity</j> é um projeto iniciado em <b><cep>2014</cep></b>, mas com outra proposta: <v>construir uma cidade</v>! No entanto, esse projeto não deu certo e foi cancelado meses depois.\n Em <b><cep>2017</cep></b> eu decidi refazê-lo em uma nova proposta: <v>viver em uma cidade</v>!\n\n A maioria das funções disponíveis foram feitas apenas por mim em um trabalho <v>longo e cansativo</v>.\n\n Se você puder e tiver condições de me ajudar, faça uma doação. Isso me incentiva a trazer novas atualizações!',
wordSeparator = ' e ',
settings_config_lang = 'Idioma',
settings_config_mirror = 'Espelhar Texto',
settings_helpText = 'Bem vindo ao <j>#Mycity</j>!\n Se você tiver interesse em aprender sobre o jogo, clique no botão abaixo:',
settings_helpText2 = 'Comandos disponíveis:',
command_profile = '<g>!perfil</g> <v>[jogador]</v>\n Abre o perfil de outro jogador que esteja na sala.',
saveChanges = 'Salvar Alterações',
House7 = 'Casa na Árvore',
item_lemonade = 'Limonada',
item_lobsterBisque = 'Bisque de Lagosta',
item_bread = 'Pão de Forma',
item_bruschetta = 'Brusqueta',
item_waffles = 'Waffles',
item_egg = 'Ovo',
item_honey = 'Mel',
item_grilledLobster = 'Lagosta Grelhada',
item_frogSandwich = 'Sapoíche',
item_chocolateCake = 'Bolo de Chocolate',
item_wheatFlour = 'Farinha de Trigo',
item_salad = 'Salada',
item_lettuce = 'Alface',
item_pierogies = 'Pierogies',
item_potato = 'Batata',
item_frenchFries = 'Batatas Fritas',
item_pudding = 'Pudim',
item_garlicBread = 'Pão de Alho',
item_garlic = 'Alho',
vehicle_11 = 'Iate',
vehicle_6 = 'Barco de Pesca',
vehicle_8 = 'Barco de Patrulha',
npcDialog_Kapo = 'Eu venho sempre aqui para conferir as ofertas diárias do Dave.\nÀs vezes eu consigo itens raros e que apenas ele tem!',
npcDialog_Santih = 'Tem muita gente que ainda se atreve a pescar nesse laguinho.',
npcDialog_Louis = 'EuFalei para ela não colocar azeitonas...',
npcDialog_Heinrich = 'Hmmm... Então você quer ser um mineiro? Se sim, tenho que avisá-lo para ser cuidadoso. Quando eu era um ratinho pequeno, eu me perdia bastante naquele labirinto.',
npcDialog_Davi = 'Me desculpe, mas não posso deixar você passar por aqui.',
npcDialog_Alexa = 'Olá! Qual a nova?',
npcDialog_Sebastian = 'E aí.\n...\nEu não sou o Colt.',
captured = '<v>%s</v> <g>foi preso!',
arrestedPlayer = 'Você prendeu <v>%s</v>!',
confirmButton_Work = 'Trabalhar!',
chef = 'Cozinheiro',
rewardText = 'Você recebeu uma recompensa incrível!',
confirmButton_Great = 'Ótimo!',
questCompleted = 'Você completou a missão %s!\nVocê recebeu:',
newLevelMessage = 'Parabéns! Você subiu de nível!',
newLevel = 'Novo nível!',
experiencePoints = 'Pontos de experiência',
newQuestSoon = 'A missão %s ainda não está pronta :/\n<font size="11">Estágio de desenvolvimento: %s%%',
badgeDesc_9 = 'Completou 500 pedidos',
badgeDesc_10 = 'Prendeu 500 ladrões',
multiTextFormating = '{0}: {1}', -- EX: "{0}: {1}" will return "Coins: 10" while "{1} : {0}" will return "10 : Coins"
profile_fulfilledOrders = 'Pedidos entregues',
profile_cookedDishes = 'Pratos feitos',
profile_capturedGhosts = 'Fantasmas capturados',
npcDialog_Marie = 'Eu aaaaaaaaamo queijo *-*',
npcDialog_Rupe = 'Definitivamente uma picareta feita de pedra não é uma boa escolha para quebrar pedras.',
npcDialog_Paulo = 'Essa caixa está muito pesada...\nSeria tão bom se tivéssemos uma empilhadeira por aqui.',
npcDialog_Lauren = 'Ela adora queijo.',
npcDialog_Julie = 'Tenha cuidado, o mercado é muito perigoso.',
npcDialog_Cassy = 'BOMDIACPFNANOTA?',
npcDialog_Natasha = 'Olá!',
itemInfo_Seed = 'Tempo de crescimento: <vp>%smin</vp>\nPreço por semente: <vp>$%s</vp>',
confirmButton_Select = 'Selecionar',
confirmButton_Buy = 'Compre por %s',
confirmButton_Buy2 = 'Compre %s\npor %s',
newBadge = 'Nova medalha',
landVehicles = 'Terrestres',
waterVehicles = 'Aquáticos',
houseDescription_1 = 'Uma casinha pequena típica da arquitetura de mycity!',
houseDescription_2 = 'Uma casa grande para grandes famílias com grandes problemas.',
houseDescription_3 = 'Somente os mais corajosos podem viver nessa casa. Oooo!',
houseDescription_4 = 'Cansou da vida na cidade? Temos o que você precisa.',
houseDescription_5 = 'O verdadeiro lar dos fantasmas. Tome cuidado!',
houseDescription_6 = 'Essa casa aconchegante lhe trará conforto nos dias mais frios!',
houseDescription_7 = 'Uma casa para quem gosta de acordar ao lado da natureza!',
houseSettings = 'Configurar Casa',
houseSettings_permissions = 'Permissões',
houseSettings_buildMode = 'Modo de Construção',
houseSettings_finish = 'Terminar!',
error_houseUnderEdit = '%s está editando a casa.',
sellFurniture = 'Vender móvel',
sellFurnitureWarning = 'Você tem certeza que deseja vender esse móvel?\n<r>Essa ação não pode ser desfeita!</r>',
confirmButton_Sell = 'Vender por %s',
houseSettings_placeFurniture = 'Posicionar',
speed_knots = 'Nós',
npcDialog_Blank = 'Você tem algo aí?',
orderCompleted = 'Você realizou o pedido de %s e recebeu %s!',
houseSettings_changeExpansion = 'Alterar Expansão',
furniture_derp = 'Pombo',
furniture_testTubes = 'Tubos de Ensaio',
furniture_bed = 'Cama',
furniture_scarecrow = 'Espantalho',
furniture_fence = 'Cerca',
furniture_hayWagon = 'Carroça',
furniture_diningTable = 'Mesa de Restaurante',
furniture_bookcase = 'Estante',
syncingGame = '<r>Sincronizando dados com o servidor. O jogo pode ficar lento por alguns segundos.',
item_crystal_yellow = 'Cristal Amarelo',
item_crystal_blue = 'Cristal Azul',
item_crystal_purple = 'Cristal Roxo',
item_crystal_green = 'Cristal Verde',
item_crystal_red = 'Cristal Vermelho',
closed_fishShop = 'A loja de pesca está fechada. Volte depois!',
npcDialog_Jason = 'Opa... a minha loja ainda não está pronta.\nPor favor, volte em breve!',
houseSettings_lockHouse = 'Fechar casa',
houseSettings_unlockHouse = 'Abrir casa',
houseSettings_reset = 'Resetar',
error_blockedFromHouse = 'Você foi banido da casa de %s.',
permissions_blocked = 'Bloqueado',
permissions_guest = 'Convidado',
permissions_roommate = 'Colega de Quarto',
permissions_coowner = 'Co-dono',
permissions_owner = 'Dono',
setPermission = 'Tornar %s',
error_houseClosed = '%s fechou esta casa.',
itemAmount = 'Itens: %s',
vehicleError = 'Você não pode usar este veículo neste local.',
confirmButton_tip = 'Dica',
tip_vehicle = 'Clique na estrela próxima à imagem de um veículo para favoritá-lo. Você poderá ativar um veículo favoritado ao apertar a tecla F (para carros) ou G (para barcos)!',
npcDialog_Billy = 'Mal posso esperar para roubar o banco hoje à noite!',
npcDialog_Derek = 'Shhh.. Estamos planejando algo grande para esta noite: Vamos roubar o banco.\nSe você quiser participar é melhor falar com o meu chefe Pablo.',
npcDialog_Pablo = 'Então você deseja se tornar um ladrão? Eu tô achando que você é um policial disfarçado.\nAh, você não é? Eu acredito em você então.\nVocê agora é um ladrão e tem a habilidade de roubar qualquer personagem que tenham o nome rosa.\nLembre-se de usar a tecla ESPAÇO para assaltar. Também não se esqueça de fugir de policiais. Boa sorte!',
npcDialog_Goldie = 'Você deseja vender algum cristal?\nLargue ele próximo a mim para eu estimar um preço.',
npcDialog_Weth = 'Pudim *-*',
itemInfo_miningPower = 'Dano em pedras: %s',
quests = {
[1] = {
name = 'Missão 01: Construindo um barco',
[0] = {
dialog = 'Olá! Como você está? Recentemente, algumas pessoas descobriram uma pequena ilha depois do rio. Lá tem algumas árvores e construções também.\nComo você sabe, não temos um aeroporto na cidade. Por enquanto, o único modo de chegar lá é com um barco.\nEu posso construir um para você, mas vou precisar de ajuda primeiro.\nNa minha próxima aventura, quero descobrir o que tem do outro lado da mina.\nEu tenho algumas teorias e preciso confirmá-las.\nEu acho que vai ser uma expedição longa, então vou precisar de muita comida.\nVocê pode pescar 5 peixes para mim?',
_add = 'Fale com Kane',
},
[1] = {
_add = 'Pesque %s peixes',
},
[2] = {
dialog = 'Wow! Obrigado por esses peixes! Eu não posso esperar para comê-los na minha expedição.\nAgora, você terá que me trazer 3 Energymax (azul). Você pode comprá-los no mercado.',
_add = 'Fale com Kane',
},
[3] = {
_add = 'Compre %s Energymax (azul)',
},
[4] = {
dialog = 'Obrigado por me trazer os energéticos! Agora é minha vez de retribuir o favor.\nMas para fazer isso vou precisar de algumas tábuas, para que eu possa construir o bote.\nRecentemente, eu vi o Chrystian cortando árvores e coletando madeira. Pergunte a ele se ele pode lhe dar algumas.',
_add = 'Fale com Kane',
},
[5] = {
dialog = 'Então você quer tábuas? Eu posso te dar algumas, mas você terá de me trazer flocos de milho.\nVocê pode fazer isso?',
_add = 'Fale com Chrystian',
},
[6] = {
_add = 'Compre floco de milho.',
},
[7] = {
dialog = 'Obrigado por me ajudar! Aqui está as tábuas que você me pediu. Faça um bom uso delas!',
_add = 'Fale com Chrystian',
},
[8] = {
dialog = 'Você demorou muito... Achei que você tivesse esquecido de pegar as tábuas...\nDe qualquer forma, agora posso construir seu barco...\nAqui está o seu barco! Divirta-se na nova ilha e tenha cuidado!',
_add = 'Fale com Kane',
},
},
[2] = {
name = 'Missão 02: As chaves perdidas',
[0] = {
_add = 'Vá para a ilha.',
},
[1] = {
dialog = 'Olá! Quem é você? Nunca te vi antes...\nMeu nome é Indy! Eu vivo nessa ilha a muito tempo. Tem muitos lugares legais aqui.\nEu sou dono da loja de poções. Eu poderia te chamar para conhecer a loja, mas eu tenho um grande problema: Eu perdi as chaves da loja!\nEu devo ter deixado cair na mina. Você pode me ajudar?',
_add = 'Fale com Indy',
},
[2] = {
_add = 'Vá para a mina.',
},
[3] = {
_add = 'Encontre as chaves de Indy',
},
[4] = {
dialog = 'Obrigado! Agora eu posso voltar ao trabalho!\nEspere um segundo...\nEstá faltando uma: a chave da loja! Você procurou direito?',
_add = 'Leve as chaves para Indy.',
},
[5] = {
_add = 'Volte para a mina.',
},
[6] = {
_add = 'Encontre a ultima chave.',
},
[7] = {
dialog = 'Finalmente! Você deveria prestar mais atenção, eu poderia ter assistido um filme enquanto você as procurava.\nVocê ainda quer ver a loja? Estou indo para lá!',
_add = 'Leve a chave para Indy.',
},
},
[3] = {
name = 'Missão 03: O roubo',
[0] = {
_add = 'Vá para a delegacia.',
},
[1] = {
dialog = 'Oi. Estão faltando policias na cidade e eu preciso da sua ajuda, nada muito difícil.\nTivemos um misterioso roubo ao banco, tanto que nenhuma suspeita foi encontrada...\nSuponho que haja alguma pista no banco.\nColt deve saber o que pode ter acontecido.Fale com ele.',
_add = 'Fale com Sherlock',
},
[2] = {
_add = 'Vá para o banco.',
},
[3] = {
dialog = 'QUÊ? Sherlock pediu que viesse aqui? Eu disse a ele que estou cuidando desse caso.\nDiga a ele que eu não preciso de ajuda. Eu consigo sozinho.',
_add = 'Fale com Colt.',
},
[4] = {
_add = 'Vá para a delegacia.',
},
[5] = {
dialog = 'Eu sabia que ele não ajudaria...\nVamos ter que procurar pistas sem ele.\nIremos ao banco quando ele não estiver lá, você pode fazer isso, certo?',
_add = 'Fale com Sherlock.',
},
[6] = {
_add = 'Participe de um roubo ao banco.',
},
[7] = {
_add = 'Procure por pistas no banco.',
},
[8] = {
_add = 'Vá para a delegacia.',
},
[9] = {
dialog = 'Muito bem! Este tecido vai nos ajudar a encontrar um suspeito.\nFale com Indy. Ele vai nos ajudar.',
_add = 'Fale com Sherlock.',
},
[10] = {
dialog = 'Então... Você precisa de ajuda nessa investigação?\nHmm... Deixe me ver esse tecido...\nJá o vi em algum lugar. É usado no hospital! Dê uma olhada por lá!',
_add = 'Fale com Indy.',
},
[11] = {
_add = 'Vá para o hospital.',
},
[12] = {
_add = 'Procure por algo suspeito no hospital.',
},
[13] = {
_add = 'Vá para a mina.',
},
[14] = {
_add = 'Encontre o suspeito e prenda-o.',
},
[15] = {
_add = 'Volte para a delegacia.',
},
[16] = {
dialog = 'Muito bem! Você é realmente muito bom nisso.\nEu conheço um bom lugar para repôr as energias depois de uma longa investigação: a cafeteria!',
_add = 'Fale com Sherlock.',
},
},
[4] = {
name = 'Missão 04: O molho acabou!',
[0] = {
dialog = 'Olá! Você quer comer uma pizza?\nBom... trago más notícias.\nOntem mais cedo comecei a fazer algumas pizzas, mas notei que todo molho que eu tinha acabou.\nTentei comprar tomates no mercado, mas aparentemente eles não vendem.\nEu comecei a morar aqui algumas semanas atrás e eu não conheço ninguém que possa me ajudar.\nEntão você pode me ajudar? Só preciso de molho para abrir a pizzaria.',
_add = 'Fale com Kariina.',
},
[1] = {
_add = 'Vá para a ilha.',
},
[2] = {
_add = 'Vá para a loja de sementes.',
},
[3] = {
_add = 'Compre uma semente.',
},
[4] = {
_add = 'Vá para sua casa.',
},
[5] = {
_add = 'Plante a semente.',
},
[6] = {
_add = 'Recolha os tomates.',
},
[7] = {
_add = 'Vá para a loja de sementes.',
},
[8] = {
_add = 'Compre um balde de água.',
},
[9] = {
_add = 'Vá para o mercado.',
},
[10] = {
_add = 'Compre sal.',
},
[11] = {
_add = 'Cozinhe um molho.',
},
[12] = {
dialog = 'Wow! Obrigada! Agora eu preciso de molho picante. Você pode me fazer um?',
_add = 'Entregue o molho para Kariina.',
},
[13] = {
_add = 'Plante uma semente na sua casa.',
},
[14] = {
_add = 'Recolha as pimentas.',
},
[15] = {
_add = 'Cozinhe um molho picante.',
},
[16] = {
dialog = '!!! Você conseguiu! Obrigada!\nEnquanto você não estava, percebi que preciso de mais trigo para fazer a massa... Você pode me trazer trigo?',
_add = 'Entregue o molho picante para Kariina.',
},
[17] = {
_add = 'Plante uma semente.',
},
[18] = {
_add = 'Recolha o trigo.',
},
[19] = {
dialog = 'Wow! Obrigado! Você poderia trabalhar comigo quando eu precisar de funcionários.\nObrigada por me ajudar. Agora eu posso terminar essas pizzas!',
_add = 'Entregue o trigo para Kariina.',
},
},
[5] = {
name = 'Missão 05: Pesadelo na Cozinha!',
[0] = {
_add = 'Vá para a ilha.',
},
[1] = {
_add = 'Vá para o restaurante.',
},
[2] = {
dialog = 'Olá, eu preciso de sua ajuda para resolver um grande problema...\nNão param de chegar pedidos no restaurante e não estamos conseguindo dar conta da alta demanda.\nVocê pode me ajudar a realizar os pedidos corretamente?\nÓtimo! Como vendemos diversos pratos, preciso lhe ensinar as receitas de alguns pratos. Ok?',
_add = 'Fale com Remi.',
},
[3] = {
_add = 'Prepare um Pão de Forma.',
},
[4] = {
_add = 'Prepare uma Salada.',
},
[5] = {
_add = 'Prepare um Bolo de Chocolate.',
},
[6] = {
_add = 'Prepare um Sanduíche de Sapo.',
},
[7] = {
_add = 'Prepare Batatas Fritas.',
},
[8] = {
_add = 'Prepare um Pudim.',
},
[9] = {
_add = 'Prepare um Pão de Alho.',
},
[10] = {
_add = 'Prepare uma Moqueca.',
},
[11] = {
_add = 'Prepare um Queijo Quente.',
},
[12] = {
_add = 'Prepare um Hambúrguer de Peixe.',
},
[13] = {
_add = 'Prepare uma Brusqueta.',
},
[14] = {
_add = 'Prepare uma Limonada.',
},
[15] = {
_add = 'Prepare Pierogies.',
},
[16] = {
dialog = 'Que demora!\n...\nAgora que você aprendeu os ingredientes de cada receita, preciso que você entregue os pedidos que estão sendo solicitados no quadro de receitas.',
_add = 'Fale com Remi.',
},
[17] = {
_add = 'Entregue %s pedidos.',
},
[18] = {
dialog = 'Muito obrigado pela ajuda! Os clientes estão satisfeitos e eu mais ainda!\nComo agradecimento, deixei uma surpresinha na sua casa: Uma geladeira!\nVocê poderá armazenar ainda mais itens em sua casa!\nAté a próxima!',
_add = 'Fale com Remi.',
},
},
},
daveOffers = 'Ofertas de hoje',
placedFurnitures = 'Móveis colocados: %s',
npcDialog_Bill = 'Olá! Você gostaria que eu avaliasse a sua sorte na pesca?\nHmmm... Deixa eu conferir...\nVocê tem %s de chance de pescar um peixe comum, %s de pescar um peixe raro e %s de pescar um peixe mítico.\nVocê também tem %s de chance de pescar um peixe lendário!',
furniture_nightstand = 'Mesa de Cabeceira',
furniture_bush = 'Arbusto',
furniture_armchair = 'Poltrona',
furniture_books = 'Pilha de livros',
furniture_mirror = 'Espelho',
furniture_broom = 'Vassoura',
furniture_piggy = 'Porquinho',
furniture_sink = 'Pia',
badgeDesc_11 = 'Top 10 da temporada 1',
caught_goldenmare = '<v>%s</v> <j>pescou um Goldenmare!</j>',
newCar = 'Novo Carro',
unlockedCar = 'Parabéns! Você desbloqueou um novo carro!',
seasonReward = 'Prêmio de temporada',
furniture_inflatableDuck = 'Pato de Borracha',
furniture_lifesaverChair = 'Cadeira Salva-Vidas',
furniture_coolBox = 'Cooler',
furniture_bbqGrill = 'Churrasqueira',
furniture_shower = 'Ducha',
furniture_flamingo = 'Flamingo',
item_bananaSeed = 'Muda de Banana',
item_moqueca = 'Moqueca',
badgeDesc_12 = 'Top 10 da temporada 2',
item_grilledCheese = 'Queijo Quente',
item_fishBurger = 'Hambúrguer de Peixe',
furniture_freezer = 'Geladeira',
confirmButton_skipQuest = 'Pular Missão!',
skipQuest = 'Pular Missão',
skipQuestTxt = 'Você tem certeza de que deseja pular essa missão? <r>Você só pode pular 1 missão por dia.</r>',
item_bananaCake = 'Bolo de Banana',
item_croquettes = 'Croquete de Batata',
itemInfo_sellingPrice = 'Preço de venda: %s',
--- V3.1.1
House8 = 'Casa Moderna',
houseDescription_8 = 'Não é uma mansão, mas é tão grande quanto.',
--- V3.2.0
trade_title = 'Troca',
confirmButton_trade = 'Trocar',
confirmButton_cancel = 'Cancelar',
trade_cancelled = '%s cancelou a troca.',
trade_cancelled_title = 'Troca cancelada',
trade_invite = '%s gostaria de iniciar uma troca.',
trade_invite_title = 'Proposta de troca',
trade_invitePlayer = 'Propor troca',
trade_wishList = 'Lista de Desejos',
trade_playerAlreadyTrading = '%s está fazendo uma outra troca.',
trade_success = 'Troca realizada com sucesso!',
item_meat = 'Carne',
item_mushroom = 'Cogumelo',
item_lasagna = 'Lasanha',
item_meatballs = 'Almôndegas',
item_garlicMashedPotatoes = 'Purê de Batata com Alho',
item_mushroomBurger = 'Hambúrguer de Cogumelo',
item_creamOfMushroom = 'Creme de Cogumelos',
item_pumpkinPie = 'Torta de Abóbora',
item_steakFrites = 'Bife e Fritas',
item_breadedCutlet = 'Bife à Milanesa',
item_fishAndChips = 'Peixe e Fritas',
npcDialog_Lindsey = 'Você deseja vender algum fruto?\nLargue ele próximo a mim para eu estimar um preço.',
settings_config_disableTrades = 'Desativar propostas de troca',
trade_invite_error = '%s não está aceitando pedidos de troca.',
tradeSystem_title = 'Sistema de Trocas',
txt_openProfile = 'Ver perfil',
profile_fruitsSold = 'Frutos vendidos',
profile_crystalsSold = 'Cristais Vendidos:<li>',
profile_crystal_yellow = '<j>Amarelo',
profile_crystal_blue = '<bv>Azul',
profile_crystal_purple = '<vi>Roxo',
profile_crystal_green = '<pt>Verde',
profile_crystal_red = '<r>Vermelho',
--- V3.2.2
item_shovel = 'Pá',
itemDesc_shovel = 'Para remover plantas indesejadas.',
badgeDesc_14 = 'Cozinhou 500 pratos',
badgeDesc_15 = 'Vendeu 300 cristais amarelos',
badgeDesc_16 = 'Vendeu 150 cristais azuis',
badgeDesc_17 = 'Vendeu 75 cristais roxos',
badgeDesc_18 = 'Vendeu 30 cristais verdes',
badgeDesc_19 = 'Vendeu 10 cristais vermelhos',
--- V3.3.0
trade_error_quest = 'Trocas estão disponíveis após completar %s.',
trade_error_quest2 = '%s precisa completar %s para poder aceitar trocas.',
furniture_toilet = 'Vaso Sanitário',
profile_changeOrb = 'Alterar Orbe De Nível',
House10 = 'Casa de Abóbora',
houseDescription_10 = 'Fruto de uma dosagem exagerada de super fertilizantes, essa abóbora oferece o conforto perfeito para as noites mais assustadoras.',
furniture_dryTree = 'Árvore Seca',
confirmButton_Play = 'Jogar!',
newLevelOrb = 'Nova Orbe de Nível',
newLevelOrb_info = 'Você pode alterar sua orbe de nível acessando o seu perfil.',
item_strangePumpkin = 'Balde de Abóbora',
item_strangePumpkinSeed = 'Estranha Semente de Abóbora',
item_candyBucket = 'Balde de Doces',
airVehicles = 'Aéreos',
vehicle_16 = 'Balão',
vehicle_17 = 'Vassoura',
furniture_lamp = 'Lamparina',
furniture_amongUs_vent = 'Among Us: Ventilação',
furniture_amongUs_medBay = 'Among Us: Enfermaria',
tip_airVehicle = 'Aperte ESPAÇO para parar de usar um veículo aéreo.',
furniture_bloodstain = 'Mancha de Sangue',
--- V3.3.2
trade_playerLeftRoom = '%s saiu da sala.',
trade_playerUsingAnItem = '%s está usando um item.',
trade_unknownItems = 'Itens desconhecidos.',
warning = 'Aviso',
bagTemporaryLimit = 'Você está carregando uma quantidade de itens superior à capacidade da sua mochila. Lembre-se de que apenas %s itens serão salvos com garantia após você sair da sala.',
-- V3.4.0
item_fish_Mudfish = 'Peixe Barrento',
item_fish_Frozice = 'Frozice',
item_fish_Sinkfish = 'Sink Fish',
item_fish_Bittyfish = 'Peixe Ornamental',
item_raspberry = 'Framboesa',
item_raspberrySeed = 'Semente de Framboesa',
furniture_liveFence = 'Cerca Viva',
furniture_mailbox = 'Caixa Postal',
furniture_chimney = 'Chaminé',
furniture_lights = 'Luzes',
furniture_candies = 'Doces',
furniture_trunk = 'Tronco',
furniture_christmasTree = 'Árvore de Natal',
item_redPresent = 'Presente Vermelho',
itemDesc_redPresent = 'Uma simples caixa que contém um item misterioso.',
npcDialog_Elf = 'Bem vindo à Oficina da Torre do Relógio!\nAqui você pode conhecer Jingle, vender presentes e comprar móveis raros...\nSe você deseja vender presentes, largue-os perto de mim e eu cuidarei deles!\nPresentes podem ser encontrados em qualquer lugar do mapa. Assim que você abre um, ele te dá um item aleatório.\nMe traga 20 deles e eu te darei uma recompensa!\nBoa sorte!\nLembre-se de que esse evento termina em %s dias e que os presentes desaparecem assim que 3 pessoas os coletarem.',
npcDialog_Skipper = 'Olá!\n...\nVocê não se parece com um de nós, então você não pode entrar nesse vilarejo.\n...\nBem... Se você deseja entrar, você precisa me fazer um favor primeiro.\nPreciso que você me traga 5 Frozices. Eles são uma espécie rara de peixe que são atraídos por frutos específicos.\nAssim que você os coletar, traga-os para mim e eu lhe deixarei entrar no vilarejo.',
House11 = 'Iglu',
houseDescription_11 = 'Um autêntico iglu produzido no vilarejo dos pinguins.',
npcDialog_Perry = 'Desculpe, o ranking está passando por uma manutenção.\nEle deve ficar pronto em janeiro, com uma nova mecânica para torná-lo justo para novos jogadores.',
-- V3.5.0
item_speedPotion = 'Poção da Velocidade',
itemDesc_speedPotion = 'Use essa poção para andar mais rápido por %s segundos!',
-- V3.5.1
profile_timePlayed = 'Tempo de jogo (em horas)',
confirmButton_backpackIcon = 'Ícone da Mochila',
-- V3.5.2
badgeDesc_8 = 'Vendeu 500 sementes',
badgeDesc_25 = 'Vendeu 500 frutos',
item_raspberryCake = 'Bolo de Framboesa',
-- V3.5.3
npcDialog_Daniel = 'Olá! Você tem interesse em carregar mais itens na sua mochila?\nDeixa eu te ajudar!',
confirmButton_BuyBagUpgrade = 'Expandir mochila por %s',
error_insufficientCoins = 'Você não tem dinheiro suficiente para realizar a compra.',
error_maxBagStorage = 'Você já comprou todas as expansões de mochila disponíveis :(',
upgradeBag = 'Expandir Mochila',
upgradeBagText = 'Você deseja expandir o limite da sua mochila para <rose>%s</rose>?',
}
lang.pt = lang.br |
local t = require( "taptest" )
local same = require( "same" )
-- array
t( same( { "a", "b", "c" }, { "a", "b", "c" } ), true )
-- different sizes
t( same( { "a", "b" }, { "a", "b", "c" } ), false )
t( same( { "a", "b", "c" }, { "a", "c" } ), false )
-- different order
t( same( { "a", "c", "b" }, { "a", "b", "c" } ), false )
-- mixed values
t( same( { 13, false, "boom" }, { 13, false, "boom" } ), true )
-- dict
local tab = {
name = "Alexander",
hobbies = { "movies", "boardgames", "programming" },
nicknames = {
friends = "Sascha",
parents = "Schurik"
}
}
local other = {
hobbies = { "movies", "boardgames", "programming" },
nicknames = {
friends = "Sascha",
parents = "Schurik"
},
name = "Alexander"
}
t( same( tab, other ), true )
tab.hobbies = { "bowling", "dance" }
t( same( tab, other ), false )
tab.hobbies = { "movies", "boardgames", "programming" }
t( same( tab, other ), true )
other.name = "Sanja"
t( same( tab, other ), false )
other.name = "Alexander"
t( same( tab, other ), true )
t()
|
mainAssets.__houses = {
[1] = {
properties = {
price = 2000,
png = '1729fd5cfd0.png',
},
inside = {
image = '172566957cc.png',
},
outside = {
icon = '1729fd367cb.png',
axis = {8, 4},
},
},
[2] = {
properties = {
price = 7000,
png = '16c2524d88c.png',
},
inside = {
image = '172566a7a66.png',
grounds = function(terrainID)
local x = (terrainID-1)*1500 + 60
local id = terrainID*20
addGround(-6500+id, 290 + x, 1397 + 65, {type = 12, friction = 0.3, restitution = 0.2, width = 480, height = 30})
addGround(-6501+id, 225 + x, 1397 + 200, {type = 12, friction = 0.3, restitution = 0.2, width = 350, height = 15})
addGround(-6502+id, 055 + x, 1397 + 160, {type = 12, friction = 0.3, restitution = 0.2, height = 190})
addGround(-6503+id, 525 + x, 1397 + 160, {type = 12, friction = 0.3, restitution = 0.2, height = 190})
addGround(-6504+id, 480 + x, 1397 + 310, {type = 12, friction = 0.3, restitution = 0.9, width = 105, height = 20})
end
},
outside = {
icon = '15909c0372a.png',
axis = {0, 0},
},
},
[3] = {
properties = {
price = 10000,
png = '16c2525f7c5.png',
},
inside = {
image = '172566a4e82.png',
grounds = function(terrainID)
local x = (terrainID-1)*1500 + 60
local id = terrainID*20
addGround(-6500+id, 345 + x, 1397 + 307, {type = 13, friction = 0.3, restitution = 1, width = 20})
addGround(-6501+id, 118 + x, 1397 + 307, {type = 13, friction = 0.3, restitution = 1, width = 20})
addGround(-6502+id, 188 + x, 1397 + 182, {type = 12, color = 0x46474a, friction = 0.3, restitution = 0.2, width = 260})
addGround(-6503+id, 460 + x, 1397 + 170, {type = 12, color = 0x46474a, friction = 0.3, restitution = 0.2, width = 180})
end
},
outside = {
icon = '15ef7b94b7f.png',
axis = {0, -50},
},
},
[4] = {
properties = {
price = 13000,
png = '16c795c65e8.png',
limitedTime = os_time{day=1, year=2020, month=1},
},
inside = {
image = '172566a23a6.png',
},
outside = {
icon = '16c7957eefd.png',
axis = {0, -31},
},
},
[5] = { -- Halloween2019
properties = {
price = 20000,
png = '16dd75fa5a1.png',
limitedTime = os_time{day=11, year=2019, month=11},
},
inside = {
image = '1725669f804.png',
grounds = function(terrainID)
local x = (terrainID-1)*1500 + 60
local id = terrainID*20
addGround(-6500+id, 201 + x, 1397 + 138, {type = 12, friction = 0.3, restitution = 0.2, width = 280, height = 20})
addGround(-6501+id, 463 + x, 1397 + 138, {type = 12, friction = 0.3, restitution = 0.2, width = 130, height = 20})
addGround(-6502+id, 290 + x, 1397 + 038, {type = 12, friction = 0.3, restitution = 0.2, width = 180, height = 20})
addGround(-6503+id, 373 + x, 1397 + 307, {type = 13, friction = 0.3, restitution = 1, width = 20})
addGround(-6504+id, 505 + x, 1397 + 114, {type = 13, friction = 0.3, restitution = 1, width = 20})
end
},
outside = {
icon = '16dd74f0f44.png',
axis = {0, -32},
},
},
[6] = { -- Christmas2019
properties = {
price = 25000,
png = '16ee526d8a3.png',
limitedTime = os_time{day=15, year=2020, month=1},
},
inside = {
image = '1725669cbbb.png',
grounds = function(terrainID)
local x = (terrainID-1)*1500 + 60
local id = terrainID*20
addGround(-6500+id, 230 + x, 1397 + 140, {type = 12, friction = 0.3, restitution = 0.2, width = 346, height = 20})
addGround(-6501+id, 315 + x, 1397 + -52, {type = 12, friction = 0.3, restitution = 0.2, width = 170, height = 20})
addGround(-6502+id, 458 + x, 1397 + 310, {type = 12, friction = 0.3, restitution = 1, width = 107, height = 30})
addGround(-6503+id, 195 + x, 1397 + 127, {type = 12, friction = 0.3, restitution = 1, width = 43, height = 30})
addGround(-6504+id, 420 + x, 1397 + -50, {type = 12, friction = 0.3, restitution = 0.2, width = 480, height = 30, angle = 58})
addGround(-6505+id, 155 + x, 1397 + -50, {type = 12, friction = 0.3, restitution = 0.2, width = 480, height = 30, angle = -58})
end
},
outside = {
icon = '16ee521a785.png',
axis = {0, -49},
},
},
[7] = { -- Treehouse
properties = {
price = 50000,
png = '1714cb5c23b.png',
},
inside = {
image = '172572b0a32.png',
grounds = function(terrainID)
local x = (terrainID-1)*1500 + 60
local id = terrainID*20
addGround(-6500+id, 235 + x, 1397 + 001, {type = 12, friction = 0.3, restitution = 0.2, width = 460, height = 20})
addGround(-6501+id, 440 + x, 1397 + 151, {type = 12, friction = 0.3, restitution = 0.2, width = 220, height = 20})
addGround(-6502+id, 345 + x, 1397 + 210, {type = 12, friction = 20, restitution = 0.2, width = 30, height = 130})
addGround(-6503+id, 445 + x, 1397 + 050, {type = 12, friction = 20, restitution = 0.2, width = 30, height = 90})
addGround(-6504+id, 399 + x, 1397 + -182, {type = 12, friction = 0.3, restitution = 0.2, width = 300, height = 20})
addGround(-6505+id, 091 + x, 1397 + -182, {type = 12, friction = 0.3, restitution = 0.2, width = 145, height = 20})
addGround(-6506+id, 149 + x, 1397 + -110, {type = 12, friction = 20, restitution = 0.2, width = 30, height = 130})
end
},
outside = {
icon = '1714cb20371.png',
axis = {0, -30},
},
},
[8] = { -- Modern House
properties = {
price = 100000,
png = '174129c8f60.png',
},
inside = {
image = '17460703d0c.png',
grounds = function(terrainID)
local x = (terrainID-1)*1500 + 60
local id = terrainID*20
addGround(-6500+id, 76 + x, 1397 -550 + 706, {type = 12, color = 0xb8947c, height = 22, width = 150, friction = 0.3, restitution = 0.2})
addGround(-6501+id, 400 + x, 1397 -550 + 706, {type = 12, color = 0xb8947c, height = 22, width = 360, friction = 0.3, restitution = 0.2})
addGround(-6502+id, 202 + x, 1396, {type = 12, color = 0xb8947c, height = 24, width = 295, friction = 0.3})
addGround(-6503+id, 470 + x, 1396 , {type = 12, color = 0xb8947c, height = 24, width = 115, friction = 0.3})
addGround(-6504+id, 180 + x, 1397 -550 + 390, {type = 12, color = 0xb8947c, height = 24, width = 332, friction = 0.3})
addGround(-6505+id, 493 + x, 1397 -550 + 390, {type = 12, color = 0xb8947c, height = 24, width = 156, friction = 0.3})
addGround(-6506+id, 353 + x, 1397 -550 + 346-158, {type = 14, height = 15, width = 200, angle = 45})
addGround(-6507+id, 223 + x, 1397 -550 + 346-158, {type = 14, height = 15, width = 200, angle = -45})
addGround(-6508+id, 186 + x, 1397 -550 + 866, {type = 12, color = 0xb8947c, height = 10, width = 74, friction = 0.3, restitution = 1.2})
addGround(-6509+id, 381 + x, 1397 -550 + 692, {type = 12, color = 0xb8947c, height = 10, width = 72, friction = 0.3, restitution = 1.2})
addGround(-6510+id, 530 + x, 1396, {type = 14, color = 0xb8947c, height = 320, friction = 0.3, restitution = 0.2})
addGround(-6511+id, 52 + x, 1396, {type = 14, color = 0xb8947c, height = 320, friction = 0.3, restitution = 0.2})
addGround(-6512+id, 153 + x, 1397 -550 + 322, {type = 14, height = 148, width = 10, friction = 0.3})
addGround(-6513+id, 423 + x, 1397 -550 + 322, {type = 14, height = 148, width = 10, friction = 0.3})
end
},
outside = {
icon = '174129a5ee3.png',
axis = {0, -28},
},
},
[9] = { -- Restaurant
properties = {
price = 25,
png = '1727ba2f8dd.png',
limitedTime = os_time{day=25, year=2020, month=4},
},
inside = {
image = '174085c9366.png',
},
outside = {
icon = '1727ba0e8b2.png',
axis = {0, -50},
},
},
[10] = { -- Pumpkin House
properties = {
price = 100000000,
png = '1750410633b.png',
limitedTime = os_time{day=16, year=2019, month=11},
},
inside = {
image = '',
},
outside = {
icon = '17503e6b5ac.png',
axis = {0, -32},
},
},
[11] = { -- Igloo
properties = {
price = 150000,
png = '176711a986c.png',
limitedTime = os_time{day=16, year=2021, month=1},
requeriment = function(player)
return players[player].jobs[19] > 0
end
},
inside = {
image = '1767169ea6c.png',
grounds = function(terrainID)
local x = (terrainID-1)*1500 + 60
local y = 847
local id = terrainID*20
addGround(-6500+id, 196 + x, 761 + y, {type = 14, height = 16, width = 376, friction = 0.3, restitution = 0.2})
addGround(-6501+id, 216 + x, 650 + y, {type = 14, height = 16, width = 334, friction = 0.3, restitution = 0.2})
addGround(-6502+id, 419 + x, 862 + y, {type = 14, height = 15, width = 44, friction = 0.3, restitution = 1.0})
addGround(-6503+id, 32 + x, 695 + y, {type = 14, height = 122, width = 27, friction = 0.3, restitution = 0.2, angle = 10})
addGround(-6504+id, 83 + x, 599 + y, {type = 14, height = 122, width = 27, friction = 0.3, restitution = 0.2, angle = 45})
addGround(-6505+id, 411 + x, 581 + y, {type = 14, height = 122, width = 27, friction = 0.3, restitution = 0.2, angle = -45})
addGround(-6506+id, 471 + x, 676 + y, {type = 14, height = 122, width = 27, friction = 0.3, restitution = 0.2, angle = -20})
addGround(-6507+id, 178 + x, 538 + y, {type = 14, height = 122, width = 27, friction = 0.3, restitution = 0.2, angle = 70})
addGround(-6508+id, 300 + x, 530 + y, {type = 14, height = 148, width = 27, friction = 0.3, restitution = 0.2, angle = 100})
end
},
outside = {
icon = '17670c9781a.png',
axis = {0, -32},
},
},
} |
-- Do not edit! This file was generated by blocks/sources/zero_spec.py
local radio = require('radio')
local jigs = require('tests.jigs')
jigs.TestBlock(radio.ZeroSource, {
{
desc = "Data type ComplexFloat32, rate 1",
args = {radio.types.ComplexFloat32, 1},
inputs = {},
outputs = {radio.types.ComplexFloat32.vector_from_array({{0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}, {0.00000000, 0.00000000}})}
},
{
desc = "Data type Float32, rate 1",
args = {radio.types.Float32, 1},
inputs = {},
outputs = {radio.types.Float32.vector_from_array({0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000})}
},
}, {epsilon = 1.0e-06})
|
PsyProjectGameExe( solution().name )
files { "./**.h", "./**.hpp", "./**.cpp", "./**.h" }
debugdir "../Dist"
local allIncludes =
{
"../bubblewrap/include",
"../bubblewrap/External",
}
for k, v in pairs( additionalIncludes ) do
table.insert(allIncludes, v)
end
includedirs
{
allIncludes
}
-- External includes.
includedirs {
"../Psybrus/External/jsoncpp/include",
}
PsyAddEngineLinks {
"base",
}
PsyAddExternalLinks {
"physfs",
"json",
}
for k, v in pairs( additionalExternalLibraries ) do
PsyAddExternalLinks { v }
end
for k, v in pairs( additionalOtherLibraries ) do
PsyAddOtherLinks { v }
end
PsyAddEngineLinks ( additionalLibraries )
|
luaunit = require('luaunit')
table.foreach({'test.txt','..'},function(i,fn)
print(fn)
print(sjson.encode(file.stat(fn)))
end)
--assert(l1=="line 1\n")
os.exit(0)
|
function PlayUrl(source, name_, url_, volume_, loop_)
TriggerClientEvent("glxsound:stateSound", source, "play", {
soundId = name_,
url = url_,
volume = volume_,
loop = loop_
})
end
exports('PlayUrl', PlayUrl)
function PlayUrlPos(source, name_, url_, volume_, pos, loop_)
TriggerClientEvent("glxsound:stateSound", source, "playpos", {
soundId = name_,
position = pos,
url = url_,
volume = volume_,
loop = loop_
})
end
exports('PlayUrlPos', PlayUrlPos)
function TextToSpeech(source, name_, lang, text, volume_, loop_)
TriggerClientEvent("glxsound:stateSound", source, "texttospeech", {
soundId = name_,
url = text,
lang = lang,
volume = volume_,
loop = loop_
})
end
exports('TextToSpeech', TextToSpeech)
function TextToSpeechPos(source, name_, lang, text_, volume_, pos, loop_)
TriggerClientEvent("glxsound:stateSound", source, "texttospeechpos", {
soundId = name_,
lang = lang,
position = pos,
text = text,
volume = volume_,
loop = loop_
})
end
exports('TextToSpeechPos', TextToSpeechPos)
function TextToSpeechEntity(source, name_, lang, text_, volume_, nt, loop_)
TriggerClientEvent("glxsound:stateSound", source, "texttospeechentity", {
soundId = name_,
lang = lang,
nt = nt,
text = text_,
volume = volume_,
loop = loop_
})
end
exports('TextToSpeechEntity', TextToSpeechEntity)
function PlayUrlEntity(source, name_, url_, volume_, nt, loop_)
TriggerClientEvent("glxsound:stateSound", source, "playentity", {
soundId = name_,
nt = nt,
url = url_,
volume = volume_,
loop = loop_
})
end
exports('PlayUrlEntity', PlayUrlEntity)
|
local entity_id = GetUpdatedEntityID()
local x, y = EntityGetTransform( entity_id )
-- If passed through an enemy: Proc effect then stop script
local target_ids = EntityGetInRadiusWithTag( x, y, 16, "enemy" )
if #target_ids ~= 0 then
-- Proc the eye of belial effect
EntityLoadToEntity( "mods/Binding-of-Noita/files/actions/eye_of_belial_effect.xml", entity_id )
local proj_comps = EntityGetComponent( entity_id, "ProjectileComponent" )
if proj_comps then
for i, comp in ipairs(proj_comps) do
ComponentSetValue2( comp, "on_collision_die" , false )
end
end
-- Prevent this script from executing again
local comp = EntityGetFirstComponent( entity_id, "LuaComponent")
ComponentSetValue2( comp, "script_source_file" , "" )
end |
local LevelsManager = {}
-- gestion of folder and files of levels
local pFolder = "scenes/MahJong/levels"
local filesTable = love.filesystem.getDirectoryItems(pFolder)
function LevelsManager.autoload()
--
Levels = {}
--
local i = 0
for k,file in ipairs(filesTable) do
-- print("le dossier module contient l'element n°"..k.." : "..file)
if string.find(file,".lua") then
i = i + 1
--
local level = {}
level.name = string.gsub(file,".lua","")
level.file = pFolder.."/"..tostring(level.name)
--
Levels[i] = require(level.file)
Levels[i].name = level.name
Levels[i].file = level.file
Levels[i].level = i
Levels[i].load = false
--
end
end
if debug then print("Alls Levels is Loads ! find "..#Levels.." levels.".." i="..i) end
end
--
function LevelsManager.reset(pLevel)
if debug then print("pLevel ["..pLevel.."] à été trouvé et le level à été chargé ? "..tostring(Levels[pLevel].load)) end
--
local backup = {}
backup.name = Levels[pLevel].name
backup.file = Levels[pLevel].file
--
Levels[pLevel] = {}
local reload = love.filesystem.load(backup.file..".lua")
Levels[pLevel] = reload()
--
Levels[pLevel].name = backup.name
Levels[pLevel].file = backup.file
Levels[pLevel].level = pLevel
--
if debug then print(Levels[pLevel].file..", have been clear ? ") if Levels[pLevel].load == false then print("Yes, Level is Reset ! car le level est chargé ? "..tostring(Levels[pLevel].load)) else print(" erreur !") end end
--
--
end
--
return LevelsManager |
local cmd = {}
cmd.title = "Noclip"
cmd.description = "Toggle noclip of a player."
cmd.author = "Nub"
cmd.timeCreated = "Oct. 26 2019 @ 9:42 PM CST"
cmd.category = "Utility"
cmd.call = "noclip"
cmd.usage = "<player> [1|0]"
cmd.server = function(caller, args)
local myCol = nadmin:GetNameColor(caller) or nadmin.colors.blue
local targs = nadmin:FindPlayer(args[1], caller, nadmin.MODE_BELOW)
if #targs > 0 then
local granted = {}
local revoked = {}
for i, ply in ipairs(targs) do
if tonumber(args[2]) then
local en = nadmin:IntToBool(tonumber(args[2]))
if en then
table.insert(granted, ply)
ply:SetMoveType(MOVETYPE_NOCLIP)
else
table.insert(revoked, ply)
ply:SetMoveType(MOVETYPE_WALK)
end
else
if ply:GetMoveType() == MOVETYPE_NOCLIP then
table.insert(revoked, ply)
ply:SetMoveType(MOVETYPE_WALK)
else
table.insert(granted, ply)
ply:SetMoveType(MOVETYPE_NOCLIP)
end
end
end
-- if #granted > 0 then
-- local msg = {myCol, caller:Nick(), nadmin.colors.white, " has noclipped "}
-- table.Add(msg, nadmin:FormatPlayerList(targs, "and"))
-- table.Add(msg, {nadmin.colors.white, "."})
-- nadmin:Notify(unpack(msg))
-- end
-- if #revoked > 0 then
-- local msg = {myCol, caller:Nick(), nadmin.colors.white, " has removed noclip from "}
-- table.Add(msg, nadmin:FormatPlayerList(targs, "and"))
-- table.Add(msg, {nadmin.colors.white, "."})
-- nadmin:Notify(unpack(msg))
-- end
else
nadmin:Notify(caller, nadmin.colors.red, nadmin.errors.noTargLess)
end
end
cmd.advUsage = {
{
type = "player",
text = "Player",
targetMode = nadmin.MODE_BELOW
},
{
type = "checkbox",
text = "Noclipped"
}
}
local unnoclip = Material("icon16/status_online.png")
local noclip = Material("icon16/status_offline.png")
cmd.scoreboard = {}
cmd.scoreboard.targetMode = nadmin.MODE_BELOW
cmd.scoreboard.iconRender = function(panel, w, h, ply)
surface.SetDrawColor(255, 255, 255)
surface.SetMaterial(nadmin:Ternary(ply:GetMoveType() == MOVETYPE_WALK, noclip, unnoclip))
surface.DrawTexturedRect(w/2 - 10, 4, 20, 20)
panel:SetText(nadmin:Ternary(ply:GetMoveType() == MOVETYPE_WALK, "Noclip", "Un-Noclip"))
end
cmd.scoreboard.OnClick = function(ply, rmb)
LocalPlayer():ConCommand("nadmin" .. nadmin:Ternary(rmb, "s", "") .. " noclip " .. ply:SteamID())
end
nadmin:RegisterCommand(cmd)
|
-- Copyright © 2017, Cair
-- All rights reserved.
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of ROE nor the
-- names of its contributors may be used to endorse or promote products
-- derived from this software without specific prior written permission.
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL Cair BE LIABLE FOR ANY
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
_addon = {}
_addon.name = 'ROE'
_addon.version = '1.1'
_addon.author = "Cair"
_addon.commands = {'roe'}
packets = require('packets')
config = require('config')
require('logger')
local defaults = T{
profiles = T{
default = S{},
},
blacklist = S{},
clear = true,
clearprogress = false,
clearall = false,
}
settings = config.load(defaults)
_roe = T{
active = T{},
complete = T{},
max_count = 30,
}
local function cancel_roe(id)
id = tonumber(id)
if not id then return end
if settings.blacklist[id] or not _roe.active[id] then return end
local p = packets.new('outgoing', 0x10d, {['RoE Quest'] = id })
packets.inject(p)
end
local function accept_roe(id)
id = tonumber(id)
if not id or _roe.complete[id] or _roe.active[id] then return end
if id and id >= 4008 and id <= 4021 then return end
local p = packets.new('outgoing', 0x10c, {['RoE Quest'] = id })
packets.inject(p)
end
local function eval(...)
assert(loadstring(table.concat({...}, ' ')))()
end
local function save(name)
if not type(name) == "string" then
error('`save` : specify a profile name')
return
end
name = name:lower()
settings.profiles[name] = S(_roe.active:keyset())
settings:save('global')
notice('saved %d objectives to the profile %s':format(_roe.active:length(), name))
end
local function list()
notice('You have saved the following profiles: ')
notice(settings.profiles:keyset())
end
local function set(name)
if not type(name) == "string" then
error('`set` : specify a profile name')
return
end
name = name:lower()
if not settings.profiles[name] then
error('`set` : the profile \'%s\' does not exist':format(name))
return
end
local needed_quests = settings.profiles[name]:diff(_roe.active:keyset())
local available_slots = _roe.max_count - _roe.active:length()
local to_remove = S{}
if settings.clearall then
to_remove:update(_roe.active:keyset())
elseif settings.clear then
for id,progress in pairs(_roe.active) do
if (needed_quests:length() - to_remove:length()) <= available_slots then
break
end
if (progress == 0 or settings.clearprogress) and not settings.blacklist[id] then
to_remove:add(id)
end
end
end
if (needed_quests:length() - to_remove:length()) > available_slots then
error('you do not have enough available quest slots')
return
end
for id in to_remove:it() do
cancel_roe(id)
coroutine.sleep(.5)
end
for id in needed_quests:it() do
accept_roe(id)
coroutine.sleep(.5)
end
notice('loaded the profile \'%s\'':format(name))
end
local function unset(name)
name = name and name:lower()
if name and settings.profiles[name] then
for id in _roe.active:keyset():intersection(settings.profiles[name]):it() do
cancel_roe(id)
coroutine.sleep(.5)
end
notice('unset the profile \'%s\'':format(name))
elseif name then
error('`unset` : the profile \'%s\' does not exist':format(name))
elseif not name then
notice('clearing ROE objectives.')
for id,progress in pairs(_roe.active:copy()) do
if progress == 0 or settings.clearprogress then
cancel_roe(id)
coroutine.sleep(.5)
end
end
end
end
local true_strings = S{'true','t','y','yes','on'}
local false_strings = S{'false','f','n','no','off'}
local bool_strings = true_strings:union(false_strings)
local function handle_setting(setting,val)
setting = setting and setting:lower() or setting
val = val and val:lower() or val
if not setting or not settings:containskey(setting) then
error('specified setting (%s) does not exist':format(setting or ''))
elseif type(settings[setting]) == "boolean" then
if not val or not bool_strings:contains(val) then
settings[setting] = not settings[setting]
elseif true_strings:contains(val) then
settings[setting] = true
else
settings[setting] = false
end
notice('%s setting is now %s':format(setting, tostring(settings[setting])))
end
end
local function blacklist(add_remove,id)
add_remove = add_remove and add_remove:lower()
id = id and tonumber(id)
if add_remove and id then
if add_remove == 'add' then
settings.blacklist:add(id)
notice('roe quest %d added to the blacklist':format(id))
elseif add_remove == 'remove' then
if id >= 4008 and id <= 4021 then
return
else
settings.blacklist:remove(id)
notice('roe quest %d removed from the blacklist':format(id))
end
else
error('`blacklist` specify \'add\' or \'remove\'')
end
else
error('`blacklist` requires two args, [add|remove] <quest id>')
end
end
local function help()
notice([[ROE - Command List:
1. help - Displays this help menu.
2. save <profile name> : saves the currently set ROE to the named profile
3. set <profile name> : attempts to set the ROE objectives in the profile
- Objectives may be canceled automatically based on settings.
- The default setting is to only cancel ROE that have 0 progress if space is needed
4. unset : removes currently set objectives
- By default, this will only remove objectives without progress made
5. settings <settings name> : toggles the specified setting
* settings:
* clear : removes objectives if space is needed (default true)
* clearprogress : remove objectives even if they have non-zero progress (default false)
* clearall : clears every objective before setting new ones (default false)
6. blacklist [add|remove] <id> : blacklists a quest from ever being removed
- I do not currently have a mapping of quest IDs to names]])
end
local cmd_handlers = {
eval = eval,
save = save,
list = list,
set = set,
unset = unset,
settings = handle_setting,
blacklist = blacklist,
help = help,
}
local function inc_chunk_handler(id,data)
if id == 0x111 then
_roe.active:clear()
for i = 1, _roe.max_count do
local offset = 5 + ((i - 1) * 4)
local id,progress = data:unpack('b12b20', offset)
if id > 0 then
_roe.active[id] = progress
end
end
elseif id == 0x112 then
local complete = T{data:unpack('b1':rep(1024),4)}:key_map(
function(k)
return (k + 1024*data:unpack('H', 133) - 1)
end):map(
function(v)
return (v == 1)
end)
_roe.complete:update(complete)
end
end
local function addon_command_handler(command,...)
local cmd = command and command:lower() or "help"
if cmd_handlers[cmd] then
cmd_handlers[cmd](...)
else
error('unknown command `%s`':format(cmd or ''))
end
end
local function load_handler()
for k,v in pairs(settings.profiles) do
if type(v) == "string" then
settings.profiles[k] = S(v:split(','):map(tonumber))
end
end
local last_roe = windower.packets.last_incoming(0x111)
if last_roe then inc_chunk_handler(0x111,last_roe) end
end
windower.register_event('incoming chunk', inc_chunk_handler)
windower.register_event('addon command', addon_command_handler)
windower.register_event('load', load_handler)
|
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:Initialize()
self:SetUseType(SIMPLE_USE)
self:SetSolid(SOLID_VPHYSICS)
self:SetCustomCollisionCheck(true)
self:SetUseType( SIMPLE_USE )
local part = world_ships[self:GetAWTeam()].parts[self.part_id]
part.model = "models/aw_hook/aw_hook.mdl"
part.position = part.position + Vector(0, 0, 50)
self:Reload()
end
function ENT:Think()
local controller = self:GetController()
if IsValid(controller) then
world_ships[self:GetAWTeam()].parts[self.part_id].angle = (-controller:EyeAngles():Forward()):Angle()
end
end
function ENT:OnShoot()
self:SetHookState(1)
timer.Simple(self.Cooldown, function()
if !IsValid(self) then return end
if self.hit then return end
self:SetHookState(0)
end)
end
|
local ffi = require("ffi")
local C = ffi.C
local errors = require("blend2d.blerror")
local fsys = require("lj2ps.filesystem")
local FileSystem = fsys.FileSystem;
local FileSystemItem = fsys.FileSystemItem;
-- Some fontface enums
local fontStyle = {
[0] = "NORMAL",
[1] = "OBLIQUE",
[2] = "ITALIC",
}
local fontStretch = {
[1] = "ULTRA_CONDENSED";
[2] = "EXTRA_CONDENSED";
[3] = "CONDENSED";
[4] = "SEMI_CONDENSED";
[5] = "NORMAL";
[6] = "SEMI_EXPANDED";
[7] = "EXPANDED";
[8] = "EXTRA_EXPANDED";
[9] = "ULTRA_EXPANDED";
};
local fontWeight = {
[100] = "THIN",
[200] = "EXTRA_LIGHT",
[300] = "LIGHT",
[350] = "SEMI_LIGHT",
[400] = "NORMAL",
[500] = "MEDIUM",
[600] = "SEMI_BOLD",
[700] = "BOLD",
[800] = "EXTRA_BOLD",
[900] = "BLACK",
[950] = "EXTRA_BLACK"
};
-- simple predicate to determine whether a file is
-- truetype or not
local function passTTF(item)
local name = item.Name:lower()
return name:find(".ttf", 1, true);
end
local function getFaceInfo(face, fileName)
if not face then return nil end
local dmetrics = face:designMetrics()
local info = {
fileName = fileName;
family = face:familyName();
subFamilyName = face:subfamilyName();
fullName = face:fullName();
postscriptName = face:postScriptName();
style = fontStyle[face:style()];
stretch = fontStretch[face:stretch()];
weight = fontWeight[face:weight()];
}
return info
end
-- create a database of font face information
local function loadFontFaces(dir, predicate)
local facedb = {}
local startat = FileSystemItem({Name=dir})
for item in startat:itemsRecursive() do
if predicate then
if predicate(item) then
-- load the fontface
local fullPath = item:getFullPath()
local face, err = BLFontFace:createFromFile(fullPath)
local familyname = face:familyName():lower()
local familyslot = facedb[familyname]
if not familyslot then
familyslot = {}
facedb[familyname] = familyslot
end
local faceinfo = getFaceInfo(face, item.Name)
familyslot[face:subfamilyName():lower()] = {face = face, sizes = {}, info = faceinfo};
end
else
print(item.Name);
end
end
return facedb
end
local FontMonger = {
systemFontDirectory = "c:\\windows\\fonts\\"
}
local FontMonger_mt = {
__index = FontMonger
}
function FontMonger.new(self, obj)
obj = obj or {
typefacedb = loadFontFaces(FontMonger.systemFontDirectory, passTTF)
}
obj.typefacedb = obj.typefacedb or loadFontFaces(FontMonger.systemFontDirectory, passTTF)
obj.dpi = obj.dpi or 96 -- start with dpi == px measurement
--local stime = runningTime()
--local duration = runningTime() - stime
--print("FontMonger, loadFontFaces: ", duration)
setmetatable(obj, FontMonger_mt)
obj:setUnits("px")
return obj;
end
-- traverse all the fonts that are in the system
-- removing the ones that were created a long time ago
function FontMonger.cleansweep(self)
print("cleansweep")
end
function FontMonger.setDpi(self, dpi)
self.dpi = dpi;
end
local unitFactors = {
["in"] = 1;
["mm"] = 25.4;
["px"] = 96;
["pt"] = 72;
}
--[[
setUnits, specifies the natural units that will be
used when specifying a font size. It can be one of
the unitFactors.
]]
function FontMonger.setUnits(self, units)
local factor = unitFactors[units]
if not factor then
return false, 'unknown units specified'
end
self.units = units;
self.unitsPerInch = factor
end
-- Enumerate all the fontfaces that are currently
-- loaded
function FontMonger.families(self)
local function visitor()
for family, v in pairs(self.typefacedb) do
if type(family) == "string" and type(v) == "table" then
coroutine.yield(family, v)
end
end
end
return coroutine.wrap(visitor)
end
function FontMonger.faces(self)
local function visitor()
for family,v in pairs(self.typefacedb) do
--print("v:", v)
for subfamily, facedata in pairs(v) do
coroutine.yield(family, subfamily, facedata)
end
end
end
return coroutine.wrap(visitor)
end
-- get a particular font face. If 'nearest' is true, then
-- it will try to match the criteria, even if an exact match
-- is not available. At least the family must be the same though
function FontMonger.getFace(self, family, subfamily, nearest)
subfamily = subfamily or "regular"
local famslot = self.typefacedb[family:lower()]
if not famslot then
return nil, "unknown family: "..family
end
local subslot = famslot[subfamily:lower()]
if not subslot then
return nil, "unknown subfamily: "..subfamily
end
return subslot
end
-- Get a specific font object at a specific size
function FontMonger.getFont(self, family, subfamily, size)
print("FontMonger.getFont, size: ", family, subfamily, size)
subfamily = subfamily or "regular"
local fontSize = size / self.unitsPerInch * self.dpi
-- try to find the font face
local famslot = self.typefacedb[family]
if not famslot then
return nil, "font family not found: "..family
end
local subslot = famslot[subfamily]
if not subslot then
return nil, "subfamily not found: "..subfamily
end
-- if we have subslot, it's a fontdata entry
-- so look in the sizes to see if the font size
-- has already been created.
local sizeKey = string.format("%3.2f", fontSize)
local fontEntry = subslot.sizes[sizeKey]
if not fontEntry then
-- create the font of the size
font = subslot.face:createFont(fontSize)
-- add an entry to the sizes table
fontEntry = {font = font;}
subslot.sizes[sizeKey] = fontEntry
end
-- mark the last time this was accessed for later
-- garbage collection
--fontEntry.accessed = runningTime();
-- Finally, return the actual font object
return fontEntry.font;
end
return FontMonger
|
ogre_message = {
use = function(player)
local width = 10
local height = 15
local charset = {}
do
-- [0-9a-zA-Z]
for c = 1, 20 do
table.insert(charset, string.char(32))
end
-- space
for c = 48, 57 do
table.insert(charset, string.char(c))
end
for c = 65, 90 do
table.insert(charset, string.char(c))
end
for c = 97, 122 do
table.insert(charset, string.char(c))
end
end
local function randomString(length)
if not length or length <= 0 then
return ''
end
math.randomseed(os.clock() ^ 5)
return randomString(length - 1) .. charset[math.random(1, #charset)]
end
local note = randomString(12)
player:paperpopup(width, height, note)
end
}
|
-- n! = 1 * 2 * 3 * ... * n-1 * n
function factorial(n)
local result = 1
local i = 1
while i <= n do
result = result * i
i = i + 1
end
return result
end
-- if(n!) = n
function inverse_factorial(f)
local p = 1
local i = 1
if f == 1 then
return 0
end
while p < f do
p = p * i
i = i + 1
end
if p == f then
return i - 1
end
return -1
end
-- sf(n) = 1! * 2! * 3! * ... * (n-1)! * n!
function super_factorial(n)
local result = 1
local i = 1
while i <= n do
result = result * factorial(i)
i = i + 1
end
return result
end
-- H(n) = 1^1 * 2^2 * 3^3 * ... * (n-1)^(n-1) * n^n
function hyper_factorial(n)
local result = 1
for i=1, n do
result = result * i ^ i
end
return result
end
-- af(n) = -1^(n-1)*1! + -1^(n-1)*2! + ... + -1^(1)*(n-1)! + -1^(0)*n!
function alternating_factorial(n)
local result = 0
for i=1, n do
if (n - i) % 2 == 0 then
result = result + factorial(i)
else
result = result - factorial(i)
end
end
return result
end
-- n$ = n ^ (n-1) ^ ... ^ 2 ^ 1
function exponential_factorial(n)
local result = 0
for i=1, n do
result = i ^ result
end
return result
end
function test_factorial(count, f, name)
print("First " .. count .. " " .. name)
for i=1,count do
io.write(math.floor(f(i - 1)) .. " ")
end
print()
print()
end
function test_inverse(f)
local n = inverse_factorial(f)
if n < 0 then
print("rf(" .. f .. " = No Solution")
else
print("rf(" .. f .. " = " .. n)
end
end
test_factorial(9, super_factorial, "super factorials")
test_factorial(8, hyper_factorial, "hyper factorials")
test_factorial(10, alternating_factorial, "alternating factorials")
test_factorial(5, exponential_factorial, "exponential factorials")
test_inverse(1)
test_inverse(2)
test_inverse(6)
test_inverse(24)
test_inverse(120)
test_inverse(720)
test_inverse(5040)
test_inverse(40320)
test_inverse(362880)
test_inverse(3628800)
test_inverse(119)
|
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
function ENT:SpawnFunction( ply, tr )
if ( !tr.Hit ) then return end
local SpawnPos = tr.HitPos + Vector(0, 0, 16)
local SpawnAng = Angle(0, 0, 0)
local ent = ents.Create( "project_drone" )
ent:SetCreator( ply )
ent:SetPos( SpawnPos )
ent:SetAngles( SpawnAng )
ent:Spawn()
ent:Activate()
ent:DropToFloor()
return ent
end
function ENT:Initialize()
self.Entity:SetModel("models/project_drone/drone001.mdl")
self.Entity:PhysicsInit(SOLID_VPHYSICS)
self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
self.Entity:SetSolid(SOLID_VPHYSICS)
self.Entity:DrawShadow(true)
self.Entity:SetCollisionGroup(COLLISION_GROUP_WEAPON)
local phys = self.Entity:GetPhysicsObject()
if phys:IsValid() then
phys:Wake()
end
util.AddNetworkString( "pjt_drn" )
util.AddNetworkString( "pjt_drn_vc" )
self.Height = 96
self.StartTime = CurTime()
self.Engine = {}
self:DeployEngines()
self.Batterie = 10^5
self.Lengthwise = "Idle"
self.Transverse = "Idle"
self.UpDown = false
self.DownDown = false
self.LeftDown = false
self.RightDown = false
self.Scan = 0
self.NextAvoid = 0
self.ConfluencePosition = Vector(0, 0, 0)
self.TemporaryOffset = 0
self.CalculatePosition = false
self.ControledPos = self.Entity:GetPos()
self.Owner = self.Entity:GetCreator()
self.Entity:SetUseType(SIMPLE_USE)
game.ConsoleCommand( "voice_loopback 1\n" )
end
function ENT:DeployEngines()
local pos = self.Entity:GetPos()
local ang = self.Entity:GetAngles()
for i = 1, 4 do
self.Engine[i] = {}
self.Engine[i].Ent = ents.Create( "project_drone_engine" )
if ( IsValid( self.Engine[i].Ent ) ) then
local att = self.Entity:LookupAttachment( "engine"..i )
local pos = self.Entity:GetAttachment( att ).Pos
self.Engine[i].Ent:SetPos( pos )
self.Engine[i].Ent:SetAngles( self.Entity:GetAngles() )
self.Engine[i].Ent.RotateAngle = 0
self.Engine[i].Ent:Spawn()
self.Engine[i].Ent:Activate()
end
constraint.Weld( self.Engine[i].Ent, self.Entity, 0, 0, 0, true, true )
end
end
function ENT:ClampForce(delta, from, to)
result= from + math.Clamp(to - from, -delta, delta)
return result
end
local Height, dHeight = 0, 0
local pOffset, pPushAngZ, pAngZ, pPushAngX, pAngX, pAngVelX, pAngY, pPushAngY = 0, 0, 0, 0, 0, 0, 0, 0
local pushAngX, pushAngY, pushAngZ = 0, 0, 0
local selfPos, angZ, angX, angVelX, angVelZ, selfVelX, selfVelY = Vector(0, 0, 0), 0, 0, 0, 0, 0, 0
local rotAng = 0
function ENT:PhysicsUpdate(phys)
local mg = math.Clamp((CurTime() - self.StartTime)/2 * 250, 0, 250)
if self.Owner:InVehicle() then
selfPos = self.Owner:GetVehicle():WorldToLocal(self.Entity:GetPos())
selfPos = Vector(selfPos.y, -selfPos.x, 0) + self.ConfluencePosition
angY = self.Owner:GetVehicle():WorldToLocalAngles(self.Entity:GetAngles()).y - 90
else
self.CalculatePosition = false
selfPos = WorldToLocal(self.ControledPos, Angle(0, 0, 0), self.Entity:GetPos(), Angle(0, 0, 0))
selfPos = Vector(selfPos.y, -selfPos.x, 0)
if self.UpDown or self.DownDown or self.LeftDown or self.RightDown then
self.CalculatePosition = false
self.ControledPos = self.Entity:GetPos() + self.Entity:GetForward() * self:GetVelX() * 128 + self.Entity:GetRight() * self:GetVelY() * 128
end
angY = self.Entity:GetAngles().y
end
angZ = self.Entity:GetAngles().z
angX = self.Entity:GetAttachment(2).Ang.z
local vel = self.Entity:GetVelocity()
local selfAngY = self.Entity:GetAngles().y
selfVelX = vel.x * math.cos(math.rad(selfAngY)) + vel.y * math.sin(math.rad(selfAngY))
selfVelY = vel.x * math.sin(math.rad(selfAngY)) - vel.y * math.cos(math.rad(selfAngY))
if math.abs(angZ) > 180 then
angZ = -(360 - math.abs(angZ))
end
if math.abs(angY) > 180 then
angY = -(360 - math.abs(angY))
end
if math.abs(angX) > 180 then
angX = -(360 - math.abs(angX))
end
angVelX = (angX - pAngX)/engine.TickInterval()/7
if angVelX == 0 then
angVelX = pAngVelX
end
angVelZ = (angZ - pAngZ)/engine.TickInterval()
local ymul = math.Clamp(math.abs(angY)/3, 1, 5)
pushAngY = angY * 0.2
local angVelY = (angY - pAngY)/engine.TickInterval()
if angY < 0 and angVelY > 3 * ymul then
pushAngY = angVelY * 4 * ymul
end
if angY > 0 and angVelY < -3 * ymul then
pushAngY = -angVelY * -4 * ymul
end
pushAngY = self:ClampForce(0.5, pPushAngY, pushAngY)
pushAngY = math.Clamp(pushAngY, -10, 10)
pPushAngY = pushAngY
pAngY = angY
if self.Batterie > 0 then
if self.Owner:InVehicle() then
rotAng = math.Clamp(pushAngY, -1, 1)
else
if self.RLDown then
rotAng = -1
elseif self.RRDown then
rotAng = 1
else
rotAng = 0
end
end
else
rotAng = 0
end
for i = 1, 2 do
self.Engine[i].Ent.RotateAngle = rotAng
end
local bone_l = self.Entity:LookupBone("front_l")
self.Entity:ManipulateBoneAngles( bone_l, Angle(-rotAng, 0, 0) )
local bone_r = self.Entity:LookupBone("front_r")
self.Entity:ManipulateBoneAngles( bone_r, Angle(-rotAng, 0, 0) )
-- self:Auto()
self:Manual()
local td = {}
td.start = self.Entity:GetPos()
td.endpos = self.Entity:GetPos() - self.Entity:GetUp() * 33000
td.filter = self.Owner:InVehicle() and { self.Entity, self.Owner, self.Owner:GetVehicle() } or { self.Entity, self.Owner }
local tr = util.TraceLine(td)
if (CurTime() - self.StartTime) > 2 then
Height = self.Entity:GetPos().z - tr.HitPos.z
dHeight = Height - self.Height - self.TemporaryOffset
dHeight = dHeight * 1
local upVel = self.Entity:GetVelocity().z
local clampHeight = math.Clamp(math.abs(dHeight)/2, 1, 10)
if upVel > 4 * clampHeight then
dHeight = 50
elseif upVel < -4 * clampHeight then
dHeight = -50
elseif dHeight < 0 and dHeight > -32 and upVel > 2 then
dHeight = upVel * 3
elseif dHeight > 0 and dHeight < 32 and upVel < -2 then
dHeight = -upVel * 3
end
dHeight = math.Clamp(dHeight, -50, 50)
dHeight = self:ClampForce(2, pOffset, dHeight)
pOffset = dHeight
else
dHeight = 0
end
if self.Batterie > 0 then
self.Engine[1].Force = math.Clamp(mg - dHeight + pushAngX - pushAngZ, 0, 300)
self.Engine[2].Force = math.Clamp(mg - dHeight + pushAngX + pushAngZ, 0, 300)
self.Engine[3].Force = math.Clamp(mg - dHeight - pushAngX - pushAngZ, 0, 300)
self.Engine[4].Force = math.Clamp(mg - dHeight - pushAngX + pushAngZ, 0, 300)
else
self.Engine[1].Force = 0
self.Engine[2].Force = 0
self.Engine[3].Force = 0
self.Engine[4].Force = 0
end
for i = 1, 4 do
self.Engine[i].Ent:SetForce(self.Engine[i].Force)
end
if CurTime() - self.NextAvoid > 8 then
self.TemporaryOffset = 0
end
self:SetEngine1Value(self.Engine[1].Force)
self:SetEngine2Value(self.Engine[2].Force)
self:SetEngine3Value(self.Engine[3].Force)
self:SetEngine4Value(self.Engine[4].Force)
self:SetAngVelZ(angVelZ)
self:SetAngVelX(angVelX)
self:SetVelX(selfVelX)
self:SetVelY(selfVelY)
self:SetAltitude(Height)
self:SetHeightValue(self.Height + self.TemporaryOffset)
self:SetTemporaryOffset(self.TemporaryOffset)
self:SetLWStat(self.Lengthwise)
self:SetTVStat(self.Transverse)
self:SetFrontEngineAngle(rotAng)
self:SetEntOwner(self.Owner:EntIndex())
end
function ENT:Manual()
local speedLimit = self.Owner:InVehicle() and 80 or 10
local anitWall = self.Owner:InVehicle() and 1 or 0.5
local yAng = self.Owner:InVehicle() and angY or 0
-- // x
self.Lengthwise = "Idle"
local xmul = (self.Owner:InVehicle() or self.CalculatePosition)and math.Clamp(math.abs(selfPos.x)/512, 0, 1) or 15
local clampAngX = math.Clamp((math.abs(angX)^2)/3, 1, 90)
if angVelX > 3 * clampAngX and !(self.UpDown or self.DownDown) then
pushAngX = 2
self.Lengthwise = "Anti-AngVel"
elseif angVelX < -3 * clampAngX and !(self.UpDown or self.DownDown) then
pushAngX = -2
self.Lengthwise = "Anti-AngVel"
elseif self.DetectFront and self.DetectFront.Fraction < 1 and selfVelX > self.DetectFront.Fraction^1.2 * 80 and !(self.UpDown or self.DownDown) and math.abs(selfVelX) < speedLimit * xmul then
pushAngX = anitWall
self.Lengthwise = "Manual"
elseif self.DetectBack and self.DetectBack.Fraction < 1 and selfVelX < self.DetectBack.Fraction^1.2 * -80 and !(self.UpDown or self.DownDown) and math.abs(selfVelX) < speedLimit * xmul then
pushAngX = -anitWall
self.Lengthwise = "Manual"
elseif math.abs(selfVelX) > speedLimit * xmul and math.abs(angX) < 2 * xmul and math.abs(yAng) < 5 then
if self.Owner:InVehicle() or self.CalculatePosition then
pushAngX = 2 * xmul * selfVelX/math.abs(selfVelX)
else
pushAngX = 0.2 * selfVelX/math.abs(selfVelX) * math.abs(angX)
end
self.Lengthwise = "Anti-Vel"
elseif self.UpDown and angX < 5 then
local velX = selfVelX >= 0 and math.Clamp(selfVelX, 20, 200) or 20
pushAngX = -2 * 20/velX
self.Lengthwise = "Manual"
elseif self.DownDown and angX > -5 then
local velX = selfVelX <= 0 and math.Clamp(math.abs(selfVelX), 20, 200) or 20
pushAngX = 2 * 20/velX
self.Lengthwise = "Manual"
elseif math.abs(selfPos.x) > 128 and math.abs(angX) < 2 * xmul and math.abs(yAng) < 5 and (self.Owner:InVehicle() or self.CalculatePosition) and Height > self.Height then
pushAngX = 0.8 * xmul * selfPos.x/math.abs(selfPos.x)
self.Lengthwise = "Proceeding"
elseif math.abs(selfPos.x) > 8 and math.abs(angX) < 2 * xmul and math.abs(yAng) < 5 and (self.Owner:InVehicle() or self.CalculatePosition) and Height > self.Height then
pushAngX = 10 * xmul * selfPos.x/math.abs(selfPos.x)
self.Lengthwise = "Proceeding"
else
if angX < 0 and angVelX > 2 and math.abs(selfVelX) < 40 then
pushAngX = angVelX * 1
self.Lengthwise = "BalancingAngVel"
elseif angX > 0 and angVelX < -2 and math.abs(selfVelX) < 40 then
pushAngX = -angVelX * 1
self.Lengthwise = "BalancingAngVel"
else
pushAngX = angX * 0.5
self.Lengthwise = "BalancingAng"
end
pushAngX = math.Clamp(pushAngX, -3, 3)
end
pushAngX = self:ClampForce(1, pPushAngX, pushAngX)
pPushAngX = pushAngX
pAngVelX = angVelX
pAngX = self.Entity:GetAttachment(2).Ang.z
-- // z
local clampAngZ = math.Clamp((math.abs(angZ)^2)/3, 1, 90)
local zmul = (self.Owner:InVehicle() or self.CalculatePosition) and math.Clamp(math.abs(selfPos.y)/512, 0, 1) or 15
if angVelZ > 3 * clampAngZ and !(self.LeftDown or self.RightDown) then
pushAngZ = 2
self.Transverse = "Anti-AngVel"
elseif angVelZ < -3 * clampAngZ and !(self.LeftDown or self.RightDown) then
pushAngZ = -2
self.Transverse = "Anti-AngVel"
elseif self.DetectLeft and self.DetectLeft.Fraction < 1 and selfVelY < self.DetectLeft.Fraction^1.2 * -80 and !(self.LeftDown or self.RightDown) and math.abs(selfVelY) < speedLimit * zmul then
pushAngZ = -anitWall
self.Lengthwise = "Manual"
elseif self.DetectRight and self.DetectRight.Fraction < 1 and selfVelY > self.DetectRight.Fraction^1.2 * 80 and !(self.LeftDown or self.RightDown) and math.abs(selfVelY) < speedLimit * zmul then
pushAngZ = anitWall
self.Lengthwise = "Manual"
elseif math.abs(selfVelY) > speedLimit * zmul and math.abs(angZ) < 2 * zmul and math.abs(yAng) < 5 then
if self.Owner:InVehicle() or self.CalculatePosition then
pushAngZ = 2 * zmul * selfVelY/math.abs(selfVelY)
else
pushAngZ = 0.2 * selfVelY/math.abs(selfVelY) * math.abs(angZ)
end
self.Transverse = "Anti-Vel"
elseif self.LeftDown and angZ > -5 then
local velY = selfVelY <= 0 and math.Clamp(math.abs(selfVelY), 20, 200) or 20
pushAngZ = 1 * 20/velY
self.Transverse = "Manual"
elseif self.RightDown and angZ < 5 then
local velY = selfVelY >= 0 and math.Clamp(selfVelY, 20, 200) or 20
pushAngZ = -1 * 20/velY
self.Transverse = "Manual"
elseif math.abs(selfPos.y) > 128 and math.abs(angZ) < 2 * zmul and math.abs(yAng) < 5 and (self.Owner:InVehicle() or self.CalculatePosition) and Height > self.Height then
pushAngZ = -0.8 * zmul * selfPos.y/math.abs(selfPos.y)
self.Transverse = "Proceeding"
elseif math.abs(selfPos.y) > 8 and math.abs(angZ) < 2 * zmul and math.abs(yAng) < 5 and (self.Owner:InVehicle() or self.CalculatePosition) and Height > self.Height then
pushAngZ = -10 * zmul * selfPos.y/math.abs(selfPos.y)
self.Transverse = "Proceeding"
else
if angZ < 0 and angVelZ > 2 and math.abs(selfVelY) < 40 then
pushAngZ = angVelZ * 1
self.Transverse = "BalancingAngVel"
elseif angZ > 0 and angVelZ < -2 and math.abs(selfVelY) < 40 then
pushAngZ = -angVelZ * 1
self.Transverse = "BalancingAngVel"
else
pushAngZ = angZ * 0.5
self.Transverse = "BalancingAng"
end
pushAngZ = math.Clamp(pushAngZ, -3, 3)
end
pushAngZ = self:ClampForce(1, pPushAngZ, pushAngZ)
pPushAngZ = pushAngZ
pAngZ = self.Entity:GetAngles().z
end
local n = 0
function ENT:Think()
self:ReceiveManual()
self:ReceiveVC()
self:ReceiveVCString()
self:Simulate()
-- self:MeterProject()
self:DetectWall()
self:DetectRoof()
self.Entity:NextThink(CurTime())
return true
end
function ENT:Simulate()
if self.Batterie > 0 then
n = n + 10
end
for i = 1, 3, 2 do
local bone = self.Entity:LookupBone("engine"..i)
self.Entity:ManipulateBoneAngles( bone, Angle(0, n * 10^4, 0) )
end
for i = 2, 4, 2 do
local bone = self.Entity:LookupBone("engine"..i)
self.Entity:ManipulateBoneAngles( bone, Angle(0, -n * 10^4, 0) )
end
self.Batterie = self.Batterie - 1
self.Batterie = math.Clamp(self.Batterie, 0, 10^5)
self:SetBatterie(self.Batterie)
end
function ENT:ReceiveVCString()
if self.VCCommand == "forward" then
self.ConfluencePosition = self.ConfluencePosition + Vector(-64, 0, 0)
self:SetNewPosition(self.ConfluencePosition)
self.VCCommand = ""
elseif self.VCCommand == "back" then
self.ConfluencePosition = self.ConfluencePosition + Vector(64, 0, 0)
self:SetNewPosition(self.ConfluencePosition)
self.VCCommand = ""
elseif self.VCCommand == "left" then
self.ConfluencePosition = self.ConfluencePosition + Vector(0, -64, 0)
self:SetNewPosition(self.ConfluencePosition)
self.VCCommand = ""
elseif self.VCCommand == "right" then
self.ConfluencePosition = self.ConfluencePosition + Vector(0, 64, 0)
self:SetNewPosition(self.ConfluencePosition)
self.VCCommand = ""
elseif self.VCCommand == "up" then
self.Height = self.Height + 32
self:SetHeightValue(self.Height)
self.VCCommand = ""
elseif self.VCCommand == "down" then
self.Height = self.Height - 32
self:SetHeightValue(self.Height)
self.VCCommand = ""
end
end
function ENT:ReceiveVC()
net.Receive( "pjt_drn_vc", function()
self.VCCommand = net.ReadString()
end )
end
function ENT:ReceiveManual()
net.Receive( "pjt_drn", function()
self.UpDown = net.ReadBool()
self.DownDown = net.ReadBool()
self.LeftDown = net.ReadBool()
self.RightDown = net.ReadBool()
self.RLDown = net.ReadBool()
self.RRDown = net.ReadBool()
end )
end
local flip = 1
local avoid = {}
for i = 1, 129 do
avoid[i] = 1
end
pDetDir = 0
function ENT:DetectRoof()
self.Scan = self.Scan + flip
if self.Scan >= 64 then
flip = -1
elseif self.Scan <= -64 then
flip = 1
end
local pos = self.Entity:GetPos()
local ang = self.Entity:GetAngles()
local detDir = 0
if self.DetectLeft.Fraction < 0.08 then
detDir = 90
elseif self.DetectRight.Fraction < 0.08 then
detDir = -90
end
if pDetDir != detDir then
detDir = 90
for i = 1, 129 do
avoid[i] = 1
end
end
pDetDir = detDir
ang:RotateAroundAxis(self.Entity:GetUp(), detDir)
local dir = ang:Forward()
local td_scan = {}
td_scan.start = pos
td_scan.endpos = pos + dir * 64 + self.Entity:GetUp() * self.Scan
td_scan.filter = { self.Entity }
self.DetectScan = util.TraceLine(td_scan)
avoid[self.Scan + 65] = self.DetectScan.Fraction
local avoidToUpper = true
local avoidToLower = true
if self.DetectFront.Fraction < 0.1 and selfVelX > 0 then
self:ProcessAvoid(avoidToUpper, avoidToLower)
elseif self.DetectLeft.Fraction < 0.1 and selfVelY < 0 then
self:ProcessAvoid(avoidToUpper, avoidToLower)
elseif self.DetectRight.Fraction < 0.1 and selfVelY > 0 then
self:ProcessAvoid(avoidToUpper, avoidToLower)
end
self:SetScanDirection(detDir)
self:SetScanPosition(self.Scan)
end
function ENT:ProcessAvoid(avoidToUpper, avoidToLower)
for i = 97, 129 do
if avoid[i] < 1 then
avoidToUpper = false
end
end
for i = 1, 32 do
if avoid[i] < 1 then
avoidToLower = false
end
end
if CurTime() > self.NextAvoid then
if avoidToUpper then
self.TemporaryOffset = self.TemporaryOffset + 72
self.NextAvoid = CurTime() + 4
avoidToLower = false
end
if avoidToLower then
if self.Height >= 96 then
self.TemporaryOffset = self.TemporaryOffset - 72
self.NextAvoid = CurTime() + 4
end
end
end
end
function ENT:DetectWall()
local td_f = {}
td_f.start = self.Entity:GetPos()
td_f.endpos = self.Entity:GetPos() + self.Entity:GetForward() * 1024
td_f.filter = { self.Entity }
self.DetectFront = util.TraceLine(td_f)
self:SetFrontFraction(self.DetectFront.Fraction)
local td_b = {}
td_b.start = self.Entity:GetPos()
td_b.endpos = self.Entity:GetPos() - self.Entity:GetForward() * 1024
td_b.filter = { self.Entity }
self.DetectBack = util.TraceLine(td_b)
self:SetBackFraction(self.DetectBack.Fraction)
local td_l = {}
td_l.start = self.Entity:GetPos()
td_l.endpos = self.Entity:GetPos() - self.Entity:GetRight() * 1024
td_l.filter = { self.Entity }
self.DetectLeft = util.TraceLine(td_l)
self:SetLeftFraction(self.DetectLeft.Fraction)
local td_r = {}
td_r.start = self.Entity:GetPos()
td_r.endpos = self.Entity:GetPos() + self.Entity:GetRight() * 1024
td_r.filter = { self.Entity }
self.DetectRight = util.TraceLine(td_r)
self:SetRightFraction(self.DetectRight.Fraction)
end
function ENT:MeterProject()
local bone = self.Entity:LookupBone("meter")
self.Entity:ManipulateBonePosition( bone, Vector(0, 0, angX * 0.08) )
self.Entity:ManipulateBoneAngles( bone, Angle(angZ, 0, 0) )
end
function ENT:Use(activator)
end
function ENT:OnRemove()
end
|
local keys = require "lapis.db.model".Model:extend("keys")
local lib = {}
local keylen = 5
--[[
# Key format:
{
path:string
key:string
starts:date
ends:date
max_clicks:n
clicks:n
}
# Todo list:
2016-10-06
- Read Keys --done
- Write Keys --done
- `__tostring` metamethod for keys --done
- implement key object integrity check --done
2016-10-07
- Check for key validity --done
2016-10-08
- Check data integrity while reading --done
- ⤷ Remove integrity check when writing --done
- Change keys from index->data to key->data --done
- ⤷ Change `ipairs` to `pairs` where needed --done
- Use key --done
--]]
-- **Data Access / Back-end**
local function time(time)
if not time then return nil end
local _, _, year, month, day, hour, minute, second =
time:find "(%d+)-(%d?%d)-(%d?%d)%s+(%d?%d):(%d?%d):(%d?%d)"
return os.time { year=year, month=month, day=day, hour=hour, minute=minute, second=second }
end
local function is_sub_dir(sub_dir, dir)
return sub_dir:gsub("/&", ""):gsub("/?$", "/"):find(dir:gsub("/?$", "/"):gsub("^/?", "/")) and true or false
end
local function get_key(key)
key = keys:find(key)
if not key then return false, "Key cannot be nil", 0 end
-- Is the key too old?
if (time(key.ends) < os.time()) and (time(key.ends) > 0) then return false, "This key has expired", 1 end
-- Has it been used too many times?
if key.max_clicks > 0 then
if key.clicks >= key.max_clicks then return false, "Activation limit reached.", 2 end
end
return key
end
-- **Interface / Front-end**
lib.get = get_key
lib.is_sub_dir = is_sub_dir
function lib.is_usable(key, path)
-- Is the key invalid or has it expired?
if not key then return false, "invalid" end
-- Has the key lifetime started yet?
if time(key.starts) > os.time() then return false, "not valid yet" end
-- If dir is provided, does the key apply to it?
if type(path)=="string" then
return is_sub_dir(path, key.path)
end
return false
end
function lib.use(key, path)
if not lib.is_usable(key, path) then return nil end
key.clicks = key.clicks + 1
key:update("clicks")
print(("Used key %s to access %s"):format(key.id, path))
return true
end
function lib.new(key)
local new = setmetatable({}, _key_meta)
new.path = key.path or "/"
new.key = key.key or generate_key(keylen)
new.starts = key.starts or os.time()
new.ends = key.ends or 0
new.clicks = 0
new.max_clicks = key.max_clicks or 0
return new
end
return lib
|
local trim = require("lapis.util").trim_filter
local Model = require("lapis.db.model").Model
local Reports = Model:extend("reports")
--- Create a new report
-- @tparam table report Report data
-- @treturn boolean success
-- @treturn string error
function Reports:create_report(report)
-- Trim white space
trim(report, {
"board_id", "thread_id", "post_id",
"timestamp", "num_reports"
}, nil)
local r = self:create {
board_id = report.board_id,
thread_id = report.thread_id,
post_id = report.post_id,
timestamp = report.timestamp,
num_reports = report.num_reports
}
if r then
return r
end
return false, { "err_create_report" }
end
--- Modify a report
-- @tparam table report Report data
-- @treturn boolean success
-- @treturn string error
function Reports:modify_report(report)
local columns = {}
for col in pairs(report) do
table.insert(columns, col)
end
return report:update(unpack(columns))
end
--- Delete report
-- @tparam table report Report data
-- @treturn boolean success
-- @treturn string error
function Reports:delete_report(report)
return report:delete()
end
--- Get all reports
-- @treturn table reports List of reports
function Reports:get_reports()
return self:select("order by timestamp asc")
end
--- Get report
-- @tparam string board_id Board ID
-- @tparam string post_id Post ID
-- @treturn table report
function Reports:get_report(board_id, post_id)
return unpack(self:select(
"where board_id=? and post_id=? limit 1",
board_id, post_id
))
end
--- Get report
-- @tparam string id Report ID
-- @treturn table report
function Reports:get_report_by_id(id)
return unpack(self:select("where id=? limit 1", id))
end
return Reports
|
(function(args)
lst = { a=function(arg) print("hello") end,
b=(1+2)*3/4,
[3+5]={ ["hello"]=("hi") },
}
lst[
(function() return 0 end)()] = 1
end)("blah")
[[
Special lua string...
]]
|
-------------------------------
-- "Sky" awesome theme --
-- By Andrei "Garoth" Thorp --
-------------------------------
-- If you want SVGs and extras, get them from garoth.com/awesome/sky-theme
-- BASICS
theme = {}
theme.font = "sans 8"
theme.bg_focus = "#e2eeea"
theme.bg_normal = "#729fcf"
theme.bg_urgent = "#fce94f"
theme.bg_minimize = "#0067ce"
theme.bg_systray = theme.bg_normal
theme.fg_normal = "#2e3436"
theme.fg_focus = "#2e3436"
theme.fg_urgent = "#2e3436"
theme.fg_minimize = "#2e3436"
theme.border_width = 2
theme.border_normal = "#dae3e0"
theme.border_focus = "#729fcf"
theme.border_marked = "#eeeeec"
-- IMAGES
theme.layout_fairh = "/usr/share/awesome/themes/sky/layouts/fairh.png"
theme.layout_fairv = "/usr/share/awesome/themes/sky/layouts/fairv.png"
theme.layout_floating = "/usr/share/awesome/themes/sky/layouts/floating.png"
theme.layout_magnifier = "/usr/share/awesome/themes/sky/layouts/magnifier.png"
theme.layout_max = "/usr/share/awesome/themes/sky/layouts/max.png"
theme.layout_fullscreen = "/usr/share/awesome/themes/sky/layouts/fullscreen.png"
theme.layout_tilebottom = "/usr/share/awesome/themes/sky/layouts/tilebottom.png"
theme.layout_tileleft = "/usr/share/awesome/themes/sky/layouts/tileleft.png"
theme.layout_tile = "/usr/share/awesome/themes/sky/layouts/tile.png"
theme.layout_tiletop = "/usr/share/awesome/themes/sky/layouts/tiletop.png"
theme.layout_spiral = "/usr/share/awesome/themes/sky/layouts/spiral.png"
theme.layout_dwindle = "/usr/share/awesome/themes/sky/layouts/dwindle.png"
theme.awesome_icon = "/usr/share/awesome/themes/sky/awesome-icon.png"
-- from default for now...
theme.menu_submenu_icon = "/usr/share/awesome/themes/default/submenu.png"
theme.taglist_squares_sel = "/usr/share/awesome/themes/default/taglist/squarefw.png"
theme.taglist_squares_unsel = "/usr/share/awesome/themes/default/taglist/squarew.png"
-- MISC
theme.wallpaper = "/usr/share/awesome/themes/sky/sky-background.png"
theme.taglist_squares = "true"
theme.titlebar_close_button = "true"
theme.menu_height = 15
theme.menu_width = 100
-- Define the image to load
theme.titlebar_close_button_normal = "/usr/share/awesome/themes/default/titlebar/close_normal.png"
theme.titlebar_close_button_focus = "/usr/share/awesome/themes/default/titlebar/close_focus.png"
theme.titlebar_ontop_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/ontop_normal_inactive.png"
theme.titlebar_ontop_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/ontop_focus_inactive.png"
theme.titlebar_ontop_button_normal_active = "/usr/share/awesome/themes/default/titlebar/ontop_normal_active.png"
theme.titlebar_ontop_button_focus_active = "/usr/share/awesome/themes/default/titlebar/ontop_focus_active.png"
theme.titlebar_sticky_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/sticky_normal_inactive.png"
theme.titlebar_sticky_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/sticky_focus_inactive.png"
theme.titlebar_sticky_button_normal_active = "/usr/share/awesome/themes/default/titlebar/sticky_normal_active.png"
theme.titlebar_sticky_button_focus_active = "/usr/share/awesome/themes/default/titlebar/sticky_focus_active.png"
theme.titlebar_floating_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/floating_normal_inactive.png"
theme.titlebar_floating_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/floating_focus_inactive.png"
theme.titlebar_floating_button_normal_active = "/usr/share/awesome/themes/default/titlebar/floating_normal_active.png"
theme.titlebar_floating_button_focus_active = "/usr/share/awesome/themes/default/titlebar/floating_focus_active.png"
theme.titlebar_maximized_button_normal_inactive = "/usr/share/awesome/themes/default/titlebar/maximized_normal_inactive.png"
theme.titlebar_maximized_button_focus_inactive = "/usr/share/awesome/themes/default/titlebar/maximized_focus_inactive.png"
theme.titlebar_maximized_button_normal_active = "/usr/share/awesome/themes/default/titlebar/maximized_normal_active.png"
theme.titlebar_maximized_button_focus_active = "/usr/share/awesome/themes/default/titlebar/maximized_focus_active.png"
return theme
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
---@param target EsvCharacter
---@param handle number
---@param instigator EsvCharacter
function DamageControl(target, handle, instigator)
--[[
Main damage control : damages are teared down to the original formula and apply custom
bonuses from the overhaul
]]--
if ObjectIsCharacter(instigator) == 0 then return end
-- Get hit properties
local damages = {}
local types = DamageTypeEnum()
local isCrit = NRD_StatusGetInt(target, handle, "CriticalHit")
-- print("Crit: "..isCrit)
local isDodged = NRD_StatusGetInt(target, handle, "Dodged")
-- print("Dodged: "..isDodged)
local isBlocked = NRD_StatusGetInt(target, handle, "Blocked")
-- print("Blocked: "..isBlocked)
local isMissed = NRD_StatusGetInt(target, handle, "Missed")
-- print("Missed: "..isMissed)
local fromWeapon = NRD_StatusGetInt(target, handle, "HitWithWeapon")
-- print("Hit with weapon: "..fromWeapon)
local fromReflection = NRD_StatusGetInt(target, handle, "Reflection")
-- print("Hit from reflection: "..fromReflection)
local hitType = NRD_StatusGetInt(target, handle, "DoT")
--print("HitType: "..hitType)
local sourceType = NRD_StatusGetInt(target, handle, "DamageSourceType")
local skillID = NRD_StatusGetString(target, handle, "SkillId")
local backstab = NRD_StatusGetInt(target, handle, "Backstab")
local fixedValue = 0
-- print("SkillID: "..skillID)
if NRD_StatusGetInt(target, handle, "HitReason") == 0 then
fromWeapon = 1
elseif skillID ~= "" then
fromWeapon = NRD_StatGetInt(string.gsub(skillID, "%_%-1", ""), "UseWeaponDamage")
fixedValue = NRD_StatGetInt(string.gsub(skillID, "%_%-1", ""), "Damage")
end
local weaponTypes = GetWeaponsType(instigator)
-- Get hit damages
for i,dmgType in pairs(types) do
damages[dmgType] = NRD_HitStatusGetDamage(target, handle, dmgType)
if damages[dmgType] ~= 0 then print("Damage "..dmgType..": "..damages[dmgType]) end
end
if isBlocked == 1 then return end
if sourceType == 1 or sourceType == 2 or sourceType == 3 then InitiatePassingDamage(target, damages); return end
if skillID == "" and sourceType == 0 then InitiatePassingDamage(target, damages); return end
if fixedValue ~= 0 and fixedValue ~= 1 and fixedValue ~= 2 then InitiatePassingDamage(target, damages); return end
-- Dodge mechanic override
if isMissed == 1 or isDodged == 1 then
local weaponHandle = NRD_StatusGetString(target, handle, "WeaponHandle")
local mainWeapon = CharacterGetEquippedWeapon(instigator)
DodgeControl(target, instigator, weaponHandle)
if mainWeapon ~= weaponHandle then
SetVarInteger(instigator, "LX_Miss_Main", 0)
end
return
end
-- Get instigator bonuses
local strength = CharacterGetAttribute(instigator, "Strength") - 10
local finesse = CharacterGetAttribute(instigator, "Finesse") - 10
local intelligence = CharacterGetAttribute(instigator, "Intelligence") - 10
local damageBonus = strength*Ext.ExtraData.DGM_StrengthGlobalBonus+finesse*Ext.ExtraData.DGM_FinesseGlobalBonus+intelligence*Ext.ExtraData.DGM_IntelligenceGlobalBonus -- /!\ Remember that 1=1% in this variable
local globalMultiplier = 1.0
if backstab == 1 then
local criticalHit = NRD_CharacterGetComputedStat(instigator, "CriticalChance", 0)
damageBonus = damageBonus + criticalHit * Ext.ExtraData.DGM_BackstabCritChanceBonus
end
-- Get damage type bonus
if fromWeapon == 1 then
damageBonus = damageBonus + strength*Ext.ExtraData.DGM_StrengthWeaponBonus
-- print("Bonus: Weapon")
-- Check distance penalty if it's a distance weapon
if weaponTypes[1] == "Bow" or weaponTypes[1] == "Crossbow" or weaponTypes[1] == "Rifle" or weaponTypes[1] == "Wand" then
local distance = GetDistanceTo(target, instigator)
--Ext.Print("[LXDGM_DamageControl.DamageControl] Distance :",distance)
if distance <= Ext.ExtraData.DGM_RangedCQBPenaltyRange and CharacterHasTalent(instigator, "RangerLoreArrowRecover") == 0 then
globalMultiplier = globalMultiplier - (Ext.ExtraData.DGM_RangedCQBPenalty/100)
end
end
if sourceType == 7 then
local dualWielding = CharacterGetAbility(instigator, "DualWielding")
damageBonus = damageBonus + dualWielding*Ext.ExtraData.DGM_DualWieldingOffhandBonus
end
end
if hitType == 1 then
damageBonus = strength*Ext.ExtraData.DGM_StrengthDoTBonus
-- print("Bonus: DoT")
-- Demon bonus for burning/necrofire
local hasDemon = CharacterHasTalent(instigator, "Demon")
if hasDemon == 1 then
local statusID = NRD_StatusGetString(target, handle, "StatusId")
if statusID == "BURNING" or statusID == "NECROFIRE" then
-- print("Bonus: Demon")
damageBonus = damageBonus + Ext.ExtraData.DGM_DemonStatusesBonus
end
end
end
if skillID ~= "" then
damageBonus = damageBonus + intelligence*Ext.ExtraData.DGM_IntelligenceSkillBonus
-- print("Bonus: skill")
-- Apply bonus from wand and staves
if weaponTypes[1] == "Wand" then
if weaponTypes[2] == "Wand" then
globalMultiplier = globalMultiplier + Ext.ExtraData.DGM_WandSkillMultiplier/100
else
globalMultiplier = globalMultiplier + Ext.ExtraData.DGM_WandSkillMultiplier/100*2
end
elseif weaponTypes[1] == "Staff" then
globalMultiplier = globalMultiplier + Ext.ExtraData.DGM_StaffSkillMultiplier/100
end
-- Apply Slingshot bonus if it's a grenade
local isGrenade = string.find(skillID, "Grenade")
local hasSlingshot = CharacterHasTalent(instigator, "WarriorLoreGrenadeRange")
if isGrenade ~= nil and hasSlingshot == 1 then
damageBonus = damageBonus + Ext.ExtraData.DGM_SlingshotBonus
end
end
-- Apply damage changes and side effects
damages = ChangeDamage(damages, (damageBonus/100+1)*globalMultiplier, 0, instigator)
ReplaceDamages(damages, handle, target)
SetWalkItOff(target, handle)
-- Armor passing damages
InitiatePassingDamage(target, damages)
end
---@param target EsvCharacter
---@param damages table
function InitiatePassingDamage(target, damages)
for dmgType,amount in pairs(damages) do
if amount ~= 0 then
local piercing = CalculatePassingDamage(target, amount, dmgType)
ApplyPassingDamage(target, piercing)
end
end
end
---@param damages table
---@param multiplier number
---@param value number
---@param instigator EsvCharacter
function ChangeDamage(damages, multiplier, value, instigator)
for dmgType,amount in pairs(damages) do
-- Ice king water damage bonus
if dmgType == "Water" and CharacterHasTalent(instigator, "IceKing") == 1 then
multiplier = multiplier + Ext.ExtraData.DGM_IceKingDamageBonus/100
-- print("Bonus: IceKing")
end
local rangeFix = math.random()
if amount > 0 then amount = amount + rangeFix end
amount = amount * multiplier
amount = amount + value
if amount ~= 0 then print("Changed "..dmgType.." to "..amount.." (Multiplier = "..multiplier..")") end
damages[dmgType] = amount
end
return damages
end
---@param newDamages table
---@param handle number
---@param target EsvCharacter
function ReplaceDamages(newDamages, handle, target)
NRD_HitStatusClearAllDamage(target, handle)
for dmgType,amount in pairs(newDamages) do
NRD_HitStatusAddDamage(target, handle, dmgType, amount)
end
end
---@param character EsvCharacter
function HasHarmfulAccuracyStatus(character)
NRD_IterateCharacterStatuses(character, "LX_Iterate_Statuses_Accuracy")
local isHarmed = GetVarInteger(character, "LX_Accuracy_Harmed")
if isHarmed == 1 then return true end
return false
end
---@param target EsvCharacter
---@param instigator EsvCharacter
---@param weapon string
function DodgeControl(target, instigator, weapon)
if weapon == nil then weapon = "" end
local refunded = GetVarInteger(instigator, "LX_Miss_Refunded")
if CharacterGetEquippedWeapon(instigator) == weapon then
if refunded == 1 then
SetVarInteger(instigator, "LX_Miss_Refunded", 0)
else
CharacterAddActionPoints(instigator, 1)
SetVarInteger(instigator, "LX_Miss_Refunded", 1)
end
SetVarInteger(instigator, "LX_Miss_Main", 1)
TriggerDodgeFatigue(target, instigator)
else
local hasMissedMain = GetVarInteger(instigator, "LX_Miss_Main")
if hasMissedMain ~= 1 then
TriggerDodgeFatigue(target, instigator)
if refunded == 1 then
SetVarInteger(instigator, "LX_Miss_Refunded", 0)
else
CharacterAddActionPoints(instigator, 1)
SetVarInteger(instigator, "LX_Miss_Refunded", 1)
end
end
end
return
end
---@param target EsvCharacter
---@param instigator EsvCharacter
function TriggerDodgeFatigue(target, instigator)
if CharacterIsInCombat(target) == 0 then return end
local accuracy = NRD_CharacterGetComputedStat(instigator, "Accuracy", 0)
local baseAccuracy = NRD_CharacterGetComputedStat(instigator, "Accuracy", 1)
local dodgeCounter = GetVarInteger(target, "LX_Dodge_Counter")
local dodge = NRD_CharacterGetComputedStat(target, "Dodge", 0)
--local isHarmed = HasHarmfulAccuracyStatus(instigator)
if dodgeCounter == nil then dodgeCounter = 0 end
-- Ext.Print("[LXDGM_DamageControl.DodgeControl] "..accuracy.." "..baseAccuracy)
-- Ext.Print("[LXDGM_DamageControl.DodgeControl] Dodge counter : "..dodgeCounter)
if HasActiveStatus(target, "UNCANNY_EVASION") == 0 then
dodgeCounter = dodgeCounter + 1
end
if accuracy >= 90 and accuracy >= baseAccuracy then
SetVarInteger(target, "LX_Dodge_Counter", dodgeCounter)
if CharacterHasTalent(target, "DualWieldingDodging") == 1 then dodgeCounter = dodgeCounter - 1 end
if dodgeCounter == 1 then ApplyStatus(target, "LX_DODGE_FATIGUE1", 6.0, 1) end
if dodgeCounter == 2 then ApplyStatus(target, "LX_DODGE_FATIGUE2", 6.0, 1) end
if dodgeCounter == 3 then ApplyStatus(target, "LX_DODGE_FATIGUE3", 6.0, 1) end
if dodgeCounter == 4 then ApplyStatus(target, "LX_DODGE_FATIGUE4", 6.0, 1) end
end
end
---@param character EsvCharacter
---@param perseverance number
---@param type string
function ManagePerseverance(character, perseverance, type)
-- Ext.Print(perseverance)
local charHP = NRD_CharacterGetStatInt(character, "MaxVitality")
NRD_CharacterSetStatInt(character, "CurrentVitality", NRD_CharacterGetStatInt(character, "CurrentVitality")+(perseverance*Ext.ExtraData.DGM_PerseveranceVitalityRecovery*0.01*charHP))
if type == "Magic" then
local charMA = NRD_CharacterGetStatInt(character, "MaxMagicArmor")
NRD_CharacterSetStatInt(character, "CurrentMagicArmor", NRD_CharacterGetStatInt(character, "CurrentMagicArmor")+(perseverance*Ext.ExtraData.SkillAbilityArmorRestoredPerPoint*0.01*charMA))
elseif type == "Physical" then
local charPA = NRD_CharacterGetStatInt(character, "MaxArmor")
NRD_CharacterSetStatInt(character, "CurrentArmor", NRD_CharacterGetStatInt(character, "CurrentArmor")+(perseverance*Ext.ExtraData.SkillAbilityArmorRestoredPerPoint*0.01*charPA))
end
end
---@param attacker EsvCharacter
---@param target EsvCharacter
local function DGM_HitChanceFormula(attacker, target)
local hitChance = attacker.Accuracy - target.Dodge
-- Make sure that we return a value in the range (0% .. 100%)
hitChance = math.max(math.min(hitChance, 100), 0)
return hitChance
end
Ext.RegisterListener("GetHitChance", DGM_HitChanceFormula)
--- @param character StatCharacter
--- @param weapon StatItem
function CalculateWeaponDamageRange(character, weapon)
local damages, damageBoost = ComputeBaseWeaponDamage(weapon)
local abilityBoosts = character.DamageBoost
+ ComputeWeaponCombatAbilityBoost(character, weapon)
+ ComputeWeaponRequirementScaledDamage(character, weapon)
abilityBoosts = math.max(abilityBoosts + 100.0, 0.0) / 100.0
local boost = 1.0 + damageBoost * 0.01
if character.IsSneaking then
boost = boost + Ext.ExtraData['Sneak Damage Multiplier']
end
local ranges = {}
for damageType, damage in pairs(damages) do
local min = damage.Min * boost * abilityBoosts
local max = damage.Max * boost * abilityBoosts
if min > max then
max = min
end
ranges[damageType] = {min, max}
end
return ranges
end
local function GetDamageMultipliers(skill, stealthed, attackerPos, targetPos)
local stealthDamageMultiplier = 1.0
if stealthed then
stealthDamageMultiplier = Ext.ExtraData.Stealth
end
local targetDistance = math.sqrt((attackerPos[1] - targetPos[1])^2 + (attackerPos[3] - targetPos[3])^2)
local distanceDamageMultiplier = 1.0
if targetDistance > 1.0 then
distanceDamageMultiplier = Ext.Round(targetDistance) * skill['Distance Damage Multiplier'] * 0.01 + 1
end
local damageMultiplier = skill['Damage Multiplier'] * 0.01
return stealthDamageMultiplier * distanceDamageMultiplier * damageMultiplier
end
|
--[[
localization.koKR.lua
translated & modified by SayClub
]]
local L = LibStub('AceLocale-3.0'):NewLocale('Dominos-Progress', 'koKR')
if not L then return end
L.Texture = '무늬'
L.Width = '너비'
L.Height = '높이'
L.AlwaysShowText = '항상 문자 표시'
L.Segmented = '분할'
L.Font = '글꼴'
L.AutoSwitchModes = '자동 전환 모드'
L.Display_label = '제목 표시'
L.Display_value = '현재 값 표시'
L.Display_max = '최대 값 표시'
L.Display_bonus = '휴식/추가 표시'
L.Display_percent = '백분율 표시'
L.Display_remaining = '남은 시간 표시'
L.CompressValues = '수치 축약'
|
print("Basic UART example.")
print("Please connect a jumper wire between FIO0 and FIO1 (FIO4 and FIO5 on T4)")
print("")
--UART part of the T7 datasheet http://labjack.com/support/datasheets/t7/digital-io/asynchronous-serial
local mbRead=MB.R --local functions for faster processing
local mbWrite=MB.W
local RXPin = 1--FIO1. Changed if T4 instead of T7
local TXPin = 0--FIO0
devType = MB.R(60000, 3)
if devType == 4 then
RXPin = 5--FIO5 on T4
TXPin = 4--FIO4
end
mbWrite(5400, 0, 0) --disable ASYNCH during config
-- Baud Example Options: 4800,9600,14400,19200,38400,57600,115200
mbWrite(5420, 1, 9600) --baud, 9600 is default of FGPMMOPA6H
mbWrite(5405, 0, RXPin) --RX set to FIO1 (FIO5 on T4)
mbWrite(5410, 0, TXPin) --TX set to FIO0 (FIO4 on T4)
mbWrite(5460, 0, 0) --ASYNCH_PARITY set to 0=none
mbWrite(5430, 0, 600) --ASYNCH_RX_BUFFER_SIZE_BYTES set to 600
mbWrite(5400, 0, 1) --enable ASYNCH
-- Various variables
local UART_TEST_STRING = "Hello World!"
local strLen = 0
local strData = {}
-- Set the baud rate
local strLen = string.len(UART_TEST_STRING)
print("Sending String of length:", strLen)
-- Allocate space for the string
mbWrite(5440, 0, strLen) --ASYNCH_NUM_BYTES_TX, UINT16 (0)
--Convert and write string to the allocated UART TX buffer
for i=1, strLen do
-- COnvert ASCII character to number
local ASCIIcharAsByte = string.byte(UART_TEST_STRING, i)
-- Write data to TX buffer
mbWrite(5490, 0, ASCIIcharAsByte) --ASYNCH_DATA_TX, UINT16 (0)
end
-- Send data saved in TX buffer
mbWrite(5450, 0, 1) --ASYNCH_TX_GO, UINT16(0)
-- Configure the interval timer for once per second.
LJ.IntervalConfig(0, 1000)
local checkInterval=LJ.CheckInterval
-- Variables used to end the program
local maxNumIterations = 3
local currentIteration = 0
local runApp = true
-- Enter while loop.
while runApp do
-- Check to see if the interval is completed.
if checkInterval(0) then
-- Read the number of bytes in RX buffer
local numBytesRX = mbRead(5435, 0) --ASYNCH_NUM_BYTES_RX, UINT16(0)
-- If there are more than zero bytes...
if numBytesRX > 0 then
print ("numBytesRX ", numBytesRX)
-- Allocate a string to save data to
local dataStr = ""
-- Read data from the T7 and conver to a string
for i=1, numBytesRX do
local dataByte = mbRead(5495, 0) --ASYNCH_DATA_RX, UINT16(0)
local dataChar = string.char(dataByte)
dataStr = dataStr .. dataChar
end
print("Data:",dataStr)
end
-- Decide when to exit
if currentIteration < maxNumIterations then
currentIteration = currentIteration + 1
else
runApp = false
end
end
end
print("Script Finished")
mbWrite(6000, 1, 0)
|
route {
lru {},
whoami {},
file { path = 'zones/example.zone' },
dnssec { algorithm = 'ecdsa_p256_sha256' },
rrl { rate = 20 },
prometheus {},
}
route('skydns', {
lru {},
skydns { zone = 'skydns.local' },
})
route('edge', {
auth { source = 'zones' },
})
route('recursive', {
cookie {},
lru {},
proxy {
origins = {'8.8.8.8#53', '8.8.4.4'},
weights = {10, 20},
select = 'weighted',
proto = 'tcp',
poolsize = 4,
},
rrl { rate = 20 },
})
route('proxy', {
cookie {},
lru {},
proxy {
rate = 20,
origins = {'95.85.40.151', '2a03:b0c0:0:1010::c6:b001'},
proto = 'tcp',
},
rrl { rate = 20 },
})
listen('tls://127.0.0.1#53537', {
recursive = {'.'},
},{
certfile = 'test.crt',
keyfile = 'test.key'
})
listen('127.0.0.1#53535', {
-- default = {
-- 'example',
-- },
skydns = {
'skydns.local'
},
recursive = {
'vavrusa.com'
},
edge = {
'flags', 'nu', 'se', 'example'
},
proxy = {
'udp53.rocks'
}
})
listen('http://127.0.0.1#8080', {
['edge.api'] = '/edge',
['default.api'] = '/api',
})
|
local Serializable = {}
local libxml2 = require("xmlua.libxml2")
local ffi = require("ffi")
local function save(target, flags, failure_message, options)
local buffer = libxml2.xmlBufferCreate()
local encoding = "UTF-8"
if options and options.encoding then
encoding = options.encoding
end
local context = libxml2.xmlSaveToBuffer(buffer, encoding, flags)
if options and options.escape then
libxml2.xmlSaveSetEscape(context, options.escape)
end
local success
if target.node then
success = libxml2.xmlSaveTree(context, target.node)
else
success = libxml2.xmlSaveDoc(context, target.document)
end
libxml2.xmlSaveClose(context)
if not success then
error(failure_message)
end
return libxml2.xmlBufferGetContent(buffer)
end
function Serializable:to_html(options)
return save(self,
bit.bor(ffi.C.XML_SAVE_FORMAT,
ffi.C.XML_SAVE_NO_DECL,
ffi.C.XML_SAVE_NO_EMPTY,
ffi.C.XML_SAVE_AS_HTML),
"failed to generate HTML string",
options)
end
function Serializable:to_xml(options)
return save(self,
bit.bor(ffi.C.XML_SAVE_FORMAT,
ffi.C.XML_SAVE_AS_XML),
"failed to generate XML string",
options)
end
return Serializable
|
object_mobile_tcg_armored_tauntaun = object_mobile_shared_tcg_armored_tauntaun:new {
}
ObjectTemplates:addTemplate(object_mobile_tcg_armored_tauntaun, "object/mobile/tcg_armored_tauntaun.iff")
|
return {
postgres = {
up = [[
DO $$
BEGIN
ALTER TABLE IF EXISTS ONLY "wsse_keys" ADD "encrypted_secret" TEXT;
EXCEPTION WHEN DUPLICATE_COLUMN THEN
-- Do nothing, accept existing state
END;
$$;
]]
},
cassandra = {
up = [[
ALTER TABLE wsse_keys ADD encrypted_secret text;
]]
}
}
|
module("luci.controller.frp", package.seeall)
function index()
if not nixio.fs.access("/etc/config/frp") then
return
end
entry({"admin","services","frp"},cbi("frp/frp"), _("Frp Setting"),100).dependent=true
entry({"admin","services","frp","config"},cbi("frp/config")).leaf=true
entry({"admin","services","frp","status"},call("status")).leaf=true
end
function status()
local e={}
e.running=luci.sys.call("pidof frpc > /dev/null")==0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
|
#!/usr/local/bin/lua
--
-- This is part of the release script.
--
-- See release.sh for more explanation.
--
servicekit = dofile("./servicekit.lua")
print(servicekit.version)
|
local Cooldown = {}
Cooldown.__index = Cooldown
-- Create a new Cooldown object
function Cooldown.new(length: number)
return setmetatable({
Length = length or 1,
Data = {}
}, Cooldown)
end
-- Used to clean up any completed cooldowns
function Cooldown:Cleanup()
for index: any in pairs(self.Data) do
if not self:GetStatus(index) then
self.Data[index] = nil
end
end
end
-- Used to get information about a certain key
function Cooldown:GetStatus(key: any): (boolean, number)
local lastUsed: number = self.Data[key] or 0
local onCooldown: boolean = os.clock() - lastUsed <= self.Length
return onCooldown, lastUsed
end
-- Used to complete a task based off a cooldown
function Cooldown:DoTask(key: any, callback: (boolean?, number?) -> any)
local now: number = os.clock()
local onCooldown: boolean, lastUsed: number = self:GetStatus(key)
local timeLeft: number = lastUsed + self.Length - now
if not onCooldown then
self.Data[key] = now
end
callback(onCooldown, timeLeft)
self:Cleanup()
end
return Cooldown
|
local skynet = require "skynet"
function task(id)
for i = 1, 5 do
skynet.error("task"..id.." call")
skynet.error("task"..id.." return:", skynet.call(".echoluamsg", "lua", "task"..id))
end
end
skynet.start(function()
skynet.fork(task, 1)
skynet.fork(task, 2)
end)
|
----------------------------------------->>
-- GTI: Grand Theft International
-- Date: 24 Jan 2014
-- Resource: GTIhud/drawStat.lua
-- Type: Client Side
-- Author: JT Pennington (JTPenn)
----------------------------------------->>
local DXStats = {}
local DXStatsSorted = {}
local sX,sY = guiGetScreenSize()
local fontA = "default-bold"
local fontB = "default-bold"
local fontC = "default-bold"
local Z_OFFSET = 325 -- Space between stats
local PROG_WIDTH = 125 -- Progress Bar Width
local PROG_HEIGHT = 25 -- Progress Bar Height
local PROG_BORDER = 4 -- Progress Bar Border Thickness
local ALPHA = 255 -- Shadow Alpha
addEventHandler("onClientResourceStart", resourceRoot, function()
local font = dxCreateFont("fonts/cambria.ttf", 10)
if (font) then fontA = font end
local font = dxCreateFont("fonts/verdana.ttf", 16)
if (font) then fontB = font end
local font = dxCreateFont("roboto-bold.ttf", 10)
if (font) then fontC = font end
end)
-- Draw Stats
-------------->>
function drawStat(id, columnA, columnB, r, g, b, timer)
if (type(id) ~= "string") then return end
if (not columnA or columnA == "") then
DXStats[id] = nil
for i,v in ipairs(DXStatsSorted) do
if (v == id) then
table.remove(DXStatsSorted, i)
break
end
end
return true
end
if (type(columnA) ~= "string" or not tostring(columnB) or type(r) ~= "number" or type(g) ~= "number" or type(b) ~= "number") then return false end
if (timer and type(timer) ~= "number") then return false end
local iNotes = #DXStatsSorted
if (not DXStats[id]) then
table.insert(DXStatsSorted, id)
end
DXStats[id] = {columnA, columnB, r, g, b}
if (timer) then
local tick = getTickCount()+timer
DXStats[id][6] = tick
end
if (iNotes == 0) then
addEventHandler("onClientRender", root, renderDXStat)
end
return true
end
addEvent("GTIhud.drawStat", true)
addEventHandler("GTIhud.drawStat", root, drawStat)
-- Draw Progress Bar
--------------------->>
function drawProgressBar(id, text, r, g, b, timer)
if (type(id) ~= "string") then return end
if (not text or text == "") then
DXStats[id] = nil
for i,v in ipairs(DXStatsSorted) do
if (v == id) then
table.remove(DXStatsSorted, i)
break
end
end
return true
end
if (type(text) ~= "string" or type(r) ~= "number" or type(g) ~= "number" or type(b) ~= "number" or type(timer) ~= "number") then return false end
local iNotes = #DXStatsSorted
if (not DXStats[id]) then
table.insert(DXStatsSorted, id)
end
DXStats[id] = {text, timer, r, g, b, getTickCount()+timer, true}
if (iNotes == 0) then
addEventHandler("onClientRender", root, renderDXStat)
end
return true
end
addEvent("GTIhud.drawProgressBar", true)
addEventHandler("GTIhud.drawProgressBar", root, drawProgressBar)
-- Render Stats
---------------->>
function renderDXStat()
--if (not isPlayerHudComponentVisible("radar") or isPlayerMapVisible()) then return end
if (#DXStatsSorted == 0) then
removeEventHandler("onClientRender", root, renderDXStat)
end
local aX,aY = sX*0.53, sY*0.95
if (getPlayerWantedLevel() > 0) then
aY = sY*0.52
end
local xOffset = 0
for i,id in ipairs(DXStatsSorted) do
local v = DXStats[id]
local xOffsetTest = dxGetTextWidth(v[2], 1, fontB)+45
if (v[7]) then xOffsetTest = PROG_WIDTH - 115 end
if (xOffset < xOffsetTest) then
xOffset = xOffsetTest
end
end
for i,id in ipairs(DXStatsSorted) do
local v = DXStats[id]
if (not v[6] or v[6] > getTickCount()) then
if (not v[7]) then
-- Draw Stat
-- Column B Shadow
local x,y = aX, aY+( (i-1)*Z_OFFSET)+4
dxDrawText(v[2], x-1, y+1, x+1, y+1, tocolor(0, 0, 0, ALPHA), 1, fontB, "center", "center")
-- Column B Text
dxDrawText(v[2], x, y, x, y, tocolor(v[3], v[4], v[5], 255), 1, fontB, "center", "center")
else
-- Draw Progress Bar
local x1,y1,x2,y2 = aX - PROG_WIDTH, aY+( (i-1)*Z_OFFSET), PROG_WIDTH, -PROG_HEIGHT
dxDrawRectangle(x1,y1,x2,y2, tocolor(0, 0, 0, 200))
dxDrawRectangle(x1+PROG_BORDER,y1-PROG_BORDER,x2-(PROG_BORDER*2),y2+(PROG_BORDER*2), tocolor(v[3]/3, v[4]/3, v[5]/3, 200))
local progress = (v[2]-(v[6]-getTickCount()))/v[2]
dxDrawRectangle(x1+PROG_BORDER,y1-PROG_BORDER,(x2-(PROG_BORDER*2))*progress,y2+(PROG_BORDER*2), tocolor(v[3], v[4], v[5], 200))
-- Draw Percentage
local x2,y2 = x1 + PROG_WIDTH, y1 - PROG_HEIGHT
progress = math.floor(progress * 100).."%"
dxDrawText(progress, x1-1, y1+1, x2-1, y2-1, tocolor(0, 0, 0, 255), 1, "default-bold", "center", "center")
dxDrawText(progress, x1+1, y1+1, x2+1, y2-1, tocolor(0, 0, 0, 255), 1, "default-bold", "center", "center")
dxDrawText(progress, x1+1, y1+1, x2-1, y2+1, tocolor(0, 0, 0, 255), 1, "default-bold", "center", "center")
dxDrawText(progress, x1+1, y1+1, x2+1, y2+1, tocolor(0, 0, 0, 255), 1, "default-bold", "center", "center")
dxDrawText(progress, x1, y1, x2, y2, tocolor(255, 255, 255, 255), 1, "default-bold", "center", "center")
end
-- Column A Shadow
local x,y = aX-xOffset, aY+( (i-1)*Z_OFFSET)+2
if (string.gsub(v[1], "%s", "") == string.gsub(v[1], "%W", "")) then v[1] = string.upper(v[1]) end
--dxDrawText(v[1], x+1, y+1, x+1, y-25, tocolor(0, 0, 0, ALPHA), 1, fontA, "right", "bottom")
-- Column A Text
dxDrawText(v[1], x-78, y, x, y-75, tocolor(v[3], v[4], v[5], 255), 1, fontC, "center", "center")
else
DXStats[id] = nil
table.remove(DXStatsSorted, i)
end
end
end
|
-- Author: Divran
local Obj = EGP:NewObject( "Text" )
Obj.h = nil
Obj.w = nil
Obj.text = ""
Obj.font = "WireGPU_ConsoleFont"
Obj.size = 18
Obj.valign = 0
Obj.halign = 0
Obj.angle = 0
local surface_SetTextPos
local surface_DrawText
local surface_SetTextColor
local surface_CreateFont
local surface_SetFont
local surface_GetTextSize
local cam_PushModelMatrix
local cam_PopModelMatrix
local mat
local matAng
if CLIENT then
surface_SetTextPos = surface.SetTextPos
surface_DrawText = surface.DrawText
surface_SetTextColor = surface.SetTextColor
surface_CreateFont = surface.CreateFont
surface_SetFont = surface.SetFont
surface_GetTextSize = surface.GetTextSize
-- Thanks to Wizard for this rotateable text code
cam_PushModelMatrix = cam.PushModelMatrix
cam_PopModelMatrix = cam.PopModelMatrix
mat = Matrix()
matAng = Angle(0, 0, 0)
end
function Obj:Draw(ent, drawMat)
if (self.text and #self.text>0) then
surface_SetTextColor( self.r, self.g, self.b, self.a )
local font = "WireEGP_" .. self.size .. "_" .. self.font
if (!EGP.ValidFonts_Lookup[font]) then
local fontTable =
{
font=self.font,
size = self.size,
weight = 800,
antialias = true,
additive = false
}
surface_CreateFont( font, fontTable )
EGP.ValidFonts_Lookup[font] = true
end
surface_SetFont( font )
if self.angle == 0 then
local w,h
local x, y = self.x, self.y
if (self.halign != 0) then
w,h = surface_GetTextSize( self.text )
x = x - (w * ((self.halign%10)/2))
end
if (self.valign) then
if (!h) then _,h = surface_GetTextSize( self.text ) end
y = y - (h * ((self.valign%10)/2))
end
surface_SetTextPos( x, y )
surface_DrawText( self.text )
else
local w,h
local x, y = 0,0
if (self.halign != 0) then
w,h = surface_GetTextSize( self.text )
x = (w * ((self.halign%10)/2))
end
if (self.valign) then
if (!h) then _,h = surface_GetTextSize( self.text ) end
y = (h * ((self.valign%10)/2))
end
mat:Set(drawMat)
mat:Translate(Vector(self.x, self.y, 0))
matAng.y = -self.angle
mat:Rotate(matAng)
surface_SetTextPos(-x, -y)
cam_PushModelMatrix(mat, true)
surface_DrawText( self.text )
cam_PopModelMatrix()
end
end
end
Obj.Transmit = function( self, Ent, ply )
net.WriteInt( self.x, 16 )
net.WriteInt( self.y, 16 )
EGP:InsertQueue( Ent, ply, EGP._SetText, "SetText", self.index, self.text )
net.WriteString(self.font)
net.WriteUInt(math.Clamp(self.size,0,256), 8)
net.WriteUInt(math.Clamp(self.valign,0,2), 2)
net.WriteUInt(math.Clamp(self.halign,0,2), 2)
net.WriteInt( self.parent, 16 )
EGP:SendColor( self )
net.WriteInt((self.angle%360)*20, 16)
end
Obj.Receive = function( self )
local tbl = {}
tbl.x = net.ReadInt(16)
tbl.y = net.ReadInt(16)
tbl.font = net.ReadString()
tbl.size = net.ReadUInt(8)
tbl.valign = net.ReadUInt(2)
tbl.halign = net.ReadUInt(2)
tbl.parent = net.ReadInt(16)
EGP:ReceiveColor( tbl, self )
tbl.angle = net.ReadInt(16)/20
return tbl
end
Obj.DataStreamInfo = function( self )
return { x = self.x, y = self.y, valign = self.valign, halign = self.halign, size = self.size, r = self.r, g = self.g, b = self.b, a = self.a, text = self.text, font = self.font, parent = self.parent, angle = self.angle }
end
|
local ringing_schedule_common = {}
require("uci")
local datatypes = require "luci.cbi.datatypes"
function ringing_schedule_common.validate_time(time)
local pattern = "(%d%d):(%d%d) (%d%d):(%d%d)"
from_hour, from_minute, to_hour, to_minute = time:match(pattern)
if from_hour == nil or from_minute == nil or to_hour == nil or to_minute == nil then
return nil, "Invalid time, expected 'HH:MM HH:MM'"
end
if tonumber(from_hour) > 23 or
tonumber(from_minute) > 59 or
tonumber(to_hour) > 23 or
tonumber(to_minute) > 59
then
return nil, "Invalid time, expected 'HH:MM HH:MM'"
end
if from_hour > to_hour or from_hour <= to_hour and from_minute > to_minute then
return nil, "Start time is after end time"
end
return time
end
return ringing_schedule_common
|
local class = require "com/class"
local ParticleSpawner = class:derive("ParticleSpawner")
local Vec2 = require("src/Essentials/Vector2")
function ParticleSpawner:new(manager, packet, data)
self.manager = manager
self.packet = packet
self.packet.spawnerCount = self.packet.spawnerCount + 1
self.pos = parseVec2(data.pos)
self.speed = parseVec2(data.speed)
self.acceleration = parseVec2(data.acceleration)
self.lifespan = data.lifespan -- nil if it lives indefinitely
self.lifetime = self.lifespan
self.spawnMax = data.spawnMax
self.pieceCount = 0
self.spawnDelay = data.spawnDelay
self.particleData = data.particleData
self.spawnNext = self.spawnDelay
for i = 1, data.spawnCount do self:spawnPiece() end
self.delQueue = false
end
function ParticleSpawner:update(dt)
-- speed and position stuff
self.speed = self.speed + self.acceleration * dt
self.pos = self.pos + self.speed * dt
-- lifespan
if self.lifetime then
self.lifetime = self.lifetime - dt
if self.lifetime <= 0 then self:destroy() end
end
-- piece spawning
if self.spawnNext then
self.spawnNext = self.spawnNext - dt
while self.spawnNext <= 0 and self.pieceCount < self.spawnMax do
self:spawnPiece()
self.spawnNext = self.spawnNext + self.spawnDelay
end
end
-- destroy when packet is gone
if self.packet.delQueue then
self:destroy()
end
end
function ParticleSpawner:getPos()
return self.pos + self.packet.pos
end
function ParticleSpawner:draw()
local p = posOnScreen(self:getPos())
love.graphics.setColor(1, 0, 0)
love.graphics.setLineWidth(2)
love.graphics.rectangle("line", p.x - 10, p.y - 10, 20, 20)
end
function ParticleSpawner:spawnPiece()
if self.pieceCount == self.spawnMax then return end
self.manager:spawnParticlePiece(self, self.particleData)
end
function ParticleSpawner:destroy()
if self.delQueue then return end
self.delQueue = true
self.manager:destroyParticleSpawner(self)
self.packet.spawnerCount = self.packet.spawnerCount - 1
end
return ParticleSpawner
|
local Info = UDRefl.RegisterType({
type = "Info",
fields = {
{ type = "std::string", name = "value" }
},
methods = {
{
name = "__ctor",
params = { "std::string" },
body = function (this, value)
this.value:__ctor(value)
end
}
}
})
local C = UDRefl.RegisterType({
type = "C",
attrs = {
{
type = "Info",
init_args = { "hello world" }
}
},
fields = {
{
type = "float32",
name = "data",
attrs = {
{
type = "Info",
init_args = { "I am a field attr" }
}
}
}
},
unowned_fields = {
{
type = "float32",
name = "unowned_data",
attrs = {
{
type = "Info",
init_args = { "I am a unowned field attr" }
}
}
}
},
methods = {
{
name = "func",
body = function () end,
attrs = {
{
type = "Info",
init_args = { "I am a method attr" }
}
}
}
}
})
print(ObjectView.ReflMngr:GetTypeAttr(C, Info).value) -- hello world
print(ObjectView.ReflMngr:GetFieldAttr(C, "data", Info).value) -- I am a field attr
print(ObjectView.ReflMngr:GetFieldAttr(C, "unowned_data", Info).value) -- I am a unowned field attr
print(ObjectView.ReflMngr:GetMethodAttr(C, "func", Info).value) -- I am a field attr
-- clear
collectgarbage()
ObjectView.ReflMngr.typeinfos:erase(C)
ObjectView.ReflMngr.typeinfos:erase(Info)
|
-----------------
require 'Engine.utilities.utl_main'
local pr = require 'pl.pretty'
local xsize,ysize = 15,15
local function print_current_config()
print('\n========= tick: '.. Simulation.time ..' =========')
for i=ysize-1,0,-1 do
local line = ""
for j = 0,xsize-1 do
local target = Cells:cell_of({j,i})
local label = target.my_agents.count > 0 and target.my_agents.count or '_'
if Choosen:is_in(target.my_agents) then
label = 0
end
line = line .. label .. ','
end
print(line)
end
print('=============================\n')
end
SETUP(function()
print('\n\n\n\n\n')
Cells = create_grid(xsize, ysize)
Agents = FamilyMobil()
Agents:create_n( 2, function()
return {
['pos'] ={xsize-1,ysize-1},
['heading'] = 0,
['age'] = 0
}
end)
Agents:add_method('update_position', function(agent, min_x, max_x, minim_y, maxim_y)
local x,y = agent:xcor(),agent:ycor()
local min_y, max_y = minim_y or min_x, maxim_y or max_x
local size_x, size_y = max_x-min_x, max_y-min_y
if x > max_x then
agent.pos[1] = agent.pos[1] - size_x
elseif x < min_x then
agent.pos[1] = agent.pos[1] + size_x
end
if y > max_y then
agent.pos[2] = agent.pos[2] - size_y
elseif y < min_y then
agent.pos[2] = agent.pos[2] + size_y
end
return agent
end)
Choosen = one_of(Agents)
Other = one_of(Agents:others(Choosen))
Choosen
:move_to({xsize/2,ysize/2})
:update_cell()
:face(Other)
end)
STEP(function()
if Simulation.time % 5 == 0 then
Other
:set_param('heading',math.random(2*math.pi))
:fd(7)
:update_position(0,xsize)
:update_cell()
end
Choosen
:face(Other)
:fd(2)
:update_position(0,xsize)
:update_cell()
print_current_config()
if Choosen.current_cells[1] == Other.current_cells[1] then
print(Other.current_cells[1]:xcor(),Other.current_cells[1]:ycor())
Simulation.is_running = false
end
end)
|
---@class Data
local Data = ECSLoader:CreateModule("Data")
---@type DataUtils
local DataUtils = ECSLoader:ImportModule("DataUtils")
local _GetGeneralTalentModifier
local dataFunctionRefs
local _, _, classId = UnitClass("player")
---@param school number
---@return number
function Data:GetSpellDmg(school)
local spellDmg = GetSpellBonusDamage(school)
local modifier = _GetGeneralTalentModifier()
spellDmg = spellDmg * (1 + (modifier / 100))
return DataUtils:Round(spellDmg, 0)
end
---@return number
_GetGeneralTalentModifier = function()
local mod = 0
if classId == Data.MAGE then
local _, _, _, _, points, _, _, _ = GetTalentInfo(1, 15)
mod = points * 1 -- 0-3% Arcane Instability
end
return mod
end
---@return number
function Data:SpellPenetration()
return DataUtils:Round(GetSpellPenetration(), 2) .. "%"
end
---@return number
function Data:GetHealingPower()
return GetSpellBonusHealing()
end
---@param refName string
---@return number | string
function Data:GetStatInfo(refName)
local dataFunction = dataFunctionRefs[refName];
if dataFunction then
return dataFunction()
else
ECS:Print("Invalid data refName: " .. refName)
end
end
dataFunctionRefs = {
["MovementSpeed"] = function() return Data:GetMovementSpeed() end,
-- Melee
["MeleeAttackPower"] = function() return Data:GetMeleeAttackPower() end,
["MeleeCritChance"] = function() return Data:MeleeCrit() end,
["Expertise"] = function()
if ECS.IsTBC then
return Data:GetExpertise()
else
return ""
end
end,
["MeleeHitBonus"] = function() return Data:MeleeHitBonus() end,
["MeleeHitSameLevel"] = function() return Data:MeleeHitMissChanceSameLevel() end,
["MeleeHitBossLevel"] = function() return Data:MeleeHitMissChanceBossLevel() end,
["MeleeAttackSpeedMainHand"] = function() return Data:GetMeleeAttackSpeedMainHand() end,
["MeleeAttackSpeedOffHand"] = function() return Data:GetMeleeAttackSpeedOffHand() end,
-- Ranged
["RangeAttackpower"] = function() return Data:GetRangeAttackPower() end,
["RangedCritChance"] = function() return Data:RangedCrit() end,
["RangedHitBonus"] = function() return Data:RangeHitBonus() end,
["RangedHitSameLevel"] = function() return Data:RangeMissChanceSameLevel() end,
["RangedHitBossLevel"] = function() return Data:RangeMissChanceBossLevel() end,
["RangedAttackSpeed"] = function() return Data:GetRangedAttackSpeed() end,
-- Defense
["Armor"] = function() return Data:GetArmorValue() end,
["DefenseValue"] = function() return Data:GetDefenseValue() end,
["DodgeChance"] = function() return Data:GetDodgeChance() end,
["ParryChance"] = function() return Data:GetParryChance() end,
["BlockChance"] = function() return Data:GetBlockChance() end,
["BlockValue"] = function() return Data:GetBlockValue() end,
["ResilienceValue"] = function()
if ECS.IsTBC then
return Data:GetResilienceValue()
else
return ""
end
end,
-- Spell
["SpellHitBonus"] = function() return Data:SpellHitBonus() end,
["SpellHitSameLevel"] = function() return Data:SpellMissChanceSameLevel() end,
["SpellHitBossLevel"] = function() return Data:SpellMissChanceBossLevel() end,
["SpellCritChance"] = function() return Data:GetSpellCrit(0) end,
["SpellPenetration"] = function() return Data:GetSpellPenetration() end,
-- MP5
["MP5Items"] = function() return Data:GetMP5FromItems() end,
["MP5Spirit"] = function() return Data:GetMP5FromSpirit() end,
["MP5Buffs"] = function()
local _, mp5Buffs = Data:GetMP5FromBuffs()
return mp5Buffs
end,
["MP5Casting"] = function() return Data:GetMP5WhileCasting() end,
-- Spell Power by school
["PhysicalDmg"] = function() return Data:GetSpellDmg(Data.PHYSICAL_SCHOOL) end,
["HolyDmg"] = function() return Data:GetSpellDmg(Data.HOLY_SCHOOL) end,
["FireDmg"] = function() return Data:GetSpellDmg(Data.FIRE_SCHOOL) end,
["NatureDmg"] = function() return Data:GetSpellDmg(Data.NATURE_SCHOOL) end,
["FrostDmg"] = function() return Data:GetSpellDmg(Data.FROST_SCHOOL) end,
["ShadowDmg"] = function() return Data:GetSpellDmg(Data.SHADOW_SCHOOL) end,
["ArcaneDmg"] = function() return Data:GetSpellDmg(Data.ARCANE_SCHOOL) end,
["BonusHealing"] = Data.GetHealingPower,
-- Spell Crit by school
["PhysicalCritChance"] = function() return Data:GetSpellCrit(Data.PHYSICAL_SCHOOL) end,
["HolyCritChance"] = function() return Data:GetSpellCrit(Data.HOLY_SCHOOL) end,
["FireCritChance"] = function() return Data:GetSpellCrit(Data.FIRE_SCHOOL) end,
["NatureCritChance"] = function() return Data:GetSpellCrit(Data.NATURE_SCHOOL) end,
["FrostCritChance"] = function() return Data:GetSpellCrit(Data.FROST_SCHOOL) end,
["ShadowCritChance"] = function() return Data:GetSpellCrit(Data.SHADOW_SCHOOL) end,
["ArcaneCritChance"] = function() return Data:GetSpellCrit(Data.ARCANE_SCHOOL) end,
}
|
local S = homedecor.gettext
local bookcolors = {
{ "red", "#c00000:150" },
{ "green", "#008000:150" },
{ "blue", "#4040c0:150" },
{ "violet", "#600070:150" },
{ "grey", "#202020:150" },
{ "brown", "#603010:175" }
}
local BOOK_FORMNAME = "homedecor:book_form"
local player_current_book = { }
for c in ipairs(bookcolors) do
local color = bookcolors[c][1]
local color_d = S(bookcolors[c][1])
local hue = bookcolors[c][2]
local function book_dig(pos, node, digger)
if minetest.is_protected(pos, digger:get_player_name()) then return end
local meta = minetest.get_meta(pos)
local data = minetest.serialize({
title = meta:get_string("title") or "",
text = meta:get_string("text") or "",
owner = meta:get_string("owner") or "",
_recover = meta:get_string("_recover") or "",
})
local stack = ItemStack({
name = "homedecor:book_"..color,
metadata = data,
})
stack = digger:get_inventory():add_item("main", stack)
if not stack:is_empty() then
minetest.item_drop(stack, digger, pos)
end
minetest.remove_node(pos)
end
local inv_img = "homedecor_book_inv.png^[colorize:"..hue.."^homedecor_book_trim_inv.png"
homedecor.register("book_"..color, {
description = S("Writable Book (%s)"):format(color_d),
mesh = "homedecor_book.obj",
tiles = {
"(homedecor_book_cover.png^[colorize:"..hue..")^homedecor_book_cover_trim.png",
"homedecor_book_edges.png"
},
inventory_image = inv_img,
wield_image = inv_img,
groups = { snappy=3, oddly_breakable_by_hand=3, book=1 },
walkable = false,
stack_max = 1,
on_punch = function(pos, node, puncher, pointed_thing)
local fdir = node.param2
minetest.swap_node(pos, { name = "homedecor:book_open_"..color, param2 = fdir })
end,
on_place = function(itemstack, placer, pointed_thing)
local plname = placer:get_player_name()
local pos = pointed_thing.under
local node = minetest.get_node_or_nil(pos)
local def = node and minetest.registered_nodes[node.name]
if not def or not def.buildable_to then
pos = pointed_thing.above
node = minetest.get_node_or_nil(pos)
def = node and minetest.registered_nodes[node.name]
if not def or not def.buildable_to then return itemstack end
end
if minetest.is_protected(pos, plname) then return itemstack end
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
minetest.set_node(pos, {
name = "homedecor:book_"..color,
param2 = fdir,
})
local text = itemstack:get_metadata() or ""
local meta = minetest.get_meta(pos)
local data = minetest.deserialize(text) or {}
if type(data) ~= "table" then
data = {}
-- Store raw metadata in case some data is lost by the
-- transition to the new meta format, so it is not lost
-- and can be recovered if needed.
meta:set_string("_recover", text)
end
meta:set_string("title", data.title or "")
meta:set_string("text", data.text or "")
meta:set_string("owner", data.owner or "")
if data.title and data.title ~= "" then
meta:set_string("infotext", data.title)
end
if not homedecor.expect_infinite_stacks then
itemstack:take_item()
end
return itemstack
end,
on_dig = book_dig,
selection_box = {
type = "fixed",
fixed = {-0.2, -0.5, -0.25, 0.2, -0.35, 0.25}
}
})
homedecor.register("book_open_"..color, {
mesh = "homedecor_book_open.obj",
tiles = {
"(homedecor_book_cover.png^[colorize:"..hue..")^homedecor_book_cover_trim.png",
"homedecor_book_edges.png",
"homedecor_book_pages.png"
},
groups = { snappy=3, oddly_breakable_by_hand=3, not_in_creative_inventory=1 },
drop = "homedecor:book_"..color,
walkable = false,
on_dig = book_dig,
on_rightclick = function(pos, node, clicker)
local meta = minetest.get_meta(pos)
local player_name = clicker:get_player_name()
local title = meta:get_string("title") or ""
local text = meta:get_string("text") or ""
local owner = meta:get_string("owner") or ""
local formspec
if owner == "" or owner == player_name then
formspec = "size[8,8]"..default.gui_bg..default.gui_bg_img..
"field[0.5,1;7.5,0;title;Book title :;"..
minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;text;Book content :;"..
minetest.formspec_escape(text).."]"..
"button_exit[2.5,7.5;3,1;save;Save]"
else
formspec = "size[8,8]"..default.gui_bg..
"button_exit[7,0.25;1,0.5;close;X]"..
default.gui_bg_img..
"label[0.5,0.5;by "..owner.."]"..
"label[0.5,0;"..minetest.formspec_escape(title).."]"..
"textarea[0.5,1.5;7.5,7;;"..minetest.formspec_escape(text)..";]"
end
player_current_book[player_name] = pos
minetest.show_formspec(player_name, BOOK_FORMNAME, formspec)
end,
on_punch = function(pos, node, puncher, pointed_thing)
local fdir = node.param2
minetest.swap_node(pos, { name = "homedecor:book_"..color, param2 = fdir })
minetest.sound_play("homedecor_book_close", {
pos=pos,
max_hear_distance = 3,
gain = 2,
})
end,
selection_box = {
type = "fixed",
fixed = {-0.35, -0.5, -0.25, 0.35, -0.4, 0.25}
}
})
end
minetest.register_on_player_receive_fields(function(player, form_name, fields)
if form_name ~= BOOK_FORMNAME or not fields.save then
return
end
local player_name = player:get_player_name()
local pos = player_current_book[player_name]
if not pos then return end
local meta = minetest.get_meta(pos)
meta:set_string("title", fields.title or "")
meta:set_string("text", fields.text or "")
meta:set_string("owner", player_name)
if (fields.title or "") ~= "" then
meta:set_string("infotext", fields.title)
end
minetest.log("action", player:get_player_name().." has written in a book (title: \""..fields.title.."\"): \""..fields.text..
"\" at location: "..minetest.pos_to_string(player:getpos()))
end)
|
if not console then
console = {}
-- Change these values as you wish
console.command_char = '>'
console.option = '-'
console.prompt_color = {r = 0.8, g = 1.0, b = 0.8 }
console.command_color = {r = 0.8, g = 0.6, b = 0.8 }
console.output_color = {r = 0.88, g = 0.88, b = 0.88}
console.invalid_color = {r = 1.0, g = 0.2, b = 0.2 }
console.header_bb = '[EECCAA]'
console.error_bb = '[FF9999]'
console.inbuilt_help_bb = '[E0E0E0]'
console.client_help_bb = '[C0C0FF]'
-- Exposed methods:
function console.add_validation_function(validation_function)
-- Adds a validation function all chat will be checked against:
-- function(string message) which returns (boolean valid, string response)
-- If all validation functions return <valid> as true the message will be displayed.
-- If one returns <valid> as false then its <response> will be displayed to that player instead.
table.insert(console.validation_functions, validation_function)
end
function console.add_player_command(command, parameter_text, help_text, command_function, default_parameters)
-- Adds a command anyone can use, see below for details
console.add_command(command, false, parameter_text, help_text, command_function, default_parameters)
end
function console.add_admin_command(command, parameter_text, help_text, command_function, default_parameters)
-- Adds a command only admins can use, see below for details
console.add_command(command, true, parameter_text, help_text, command_function, default_parameters)
end
function console.add_command(command, requires_admin, parameter_text, help_text, command_function, default_parameters)
-- Adds a command to the console.
-- command_function must take <player> as its first argument, and then any
-- subsequent arguments you wish which will be provided by the player.
-- You may alias an already-present command by calling this with command_function set to
-- the command string instead of a function. default_parameters can be set for the alias.
-- See basic built-in commands at the bottom of this file for examples.
local commands = console.commands
local command_function = command_function
local help_text = help_text
local parameter_text = parameter_text
if type(command_function) == 'string' then --alias
if help_text == nil then
help_text = commands[command_function].help_text
end
if parameter_text == nil then
parameter_text = commands[command_function].parameter_text
end
command_function = commands[command_function].command_function
end
console.commands[command] = {
command_function = command_function,
requires_admin = requires_admin,
parameter_text = parameter_text,
help_text = help_text,
help_bb = console.command_help_bb,
default_parameters = default_parameters,
}
end
function console.set_command_listing_bb(bb)
-- Tags commands added after with a bb color for when they are displayed (i.e. with 'help')
console.command_help_bb = bb
end
function console.disable()
-- Disables console for command purposes, but leaves validation functions running
console.active = false
end
function console.enable()
-- Enables console commands (console commands are on by default)
console.active = true
end
-- End of exposed methods. You shouldn't need to interact with anything below (under normal circumstances)
console.active = true
console.in_command_mode = {}
console.commands = {}
console.validation_functions = {}
console.set_command_listing_bb(console.inbuilt_help_bb)
function onChat(message, player)
if message ~= '' then
local command = ''
local command_function = nil
local parameters = {player}
local requires_admin = false
local command_mode = console.in_command_mode[player.steam_id]
if command_mode and console.active then
command, command_function, parameters, requires_admin = console.get_command(message, player)
elseif message:sub(1, 1) == console.command_char and console.active then
if message:len() > 1 then
command, command_function, parameters, requires_admin = console.get_command(message:sub(2), player)
else
command, command_function, parameters, requires_admin = console.get_command(console.command_char, player)
end
else
for i, f in ipairs(console.validation_functions) do
local valid, response = f(message)
if response == nil then response = '' end
if not valid then
printToColor(response, player.color, console.invalid_color)
return false
end
end
return true
end
if console.active then
if command_function and (player.admin or not requires_admin) then
if command_mode then
message = console.command_char .. console.command_char .. message
end
local response, mute = command_function(unpack(parameters))
if response ~= nil or mute ~= nil then
if not mute then
printToColor('\n'..message, player.color, console.command_color)
end
if response then
printToColor(response, player.color, console.output_color)
end
end
if console.in_command_mode[player.steam_id] then console.display_prompt(player) end
return false
else
printToColor('\n'..message, player.color, console.command_color)
printToColor(console.error_bb .. "<command '" .. command .. "' not found>[-]", player.color, console.output_color)
return false
end
end
end
end
function console.get_command(message, player)
local command_name = ''
local command_function = nil
local requires_admin = false
local parameters = {player}
for i, part in ipairs(console.split(message)) do
if i == 1 then
command_name = part
local command = console.commands[command_name]
if command then
command_function = command.command_function
requires_admin = command.requires_admin
if command.default_parameters then
for _, parameter in ipairs(command.default_parameters) do
table.insert(parameters, parameter)
end
end
end
else
table.insert(parameters, part)
end
end
return command_name, command_function, parameters, requires_admin
end
function console.display_prompt(player)
printToColor(console.command_char..console.command_char, player.color, console.prompt_color)
end
function console.split(text, split_on)
local split_on = split_on or ' '
if type(split_on) == 'string' then
local s = {}
for c = 1, split_on:len() do
s[split_on:sub(c,c)] = true
end
split_on = s
end
local parts = {}
if text ~= '' then
local make_table = function(s)
local entries = console.split(s, ' ,')
local t = {}
for _, entry in ipairs(entries) do
if type(entry) == 'string' and entry:find('=') then
e = console.split(entry, '=')
t[e[1]] = e[2]
else
table.insert(t, entry)
end
end
return t
end
local current_split_on = split_on
local adding = false
local part = ""
local totype = tonumber
for c = 1, text:len() do
local char = text:sub(c, c)
if adding then
if current_split_on[char] then -- ended current part
if totype(part) ~= nil then
table.insert(parts, totype(part))
else
table.insert(parts, part)
end
adding = false
current_split_on = split_on
totype = tonumber
else
part = part .. char
end
else
if not current_split_on[char] then -- found start of part
if char == "'" then
current_split_on = {["'"] = true}
totype = tostring
part = ''
elseif char == '"' then
current_split_on = {['"'] = true}
totype = tostring
part = ''
elseif char == '{' then
current_split_on = {['}'] = true}
totype = make_table
part = ''
else
part = char
end
adding = true
end
end
end
if adding then
if totype(part) ~= nil then
table.insert(parts, totype(part))
else
table.insert(parts, part)
end
end
end
return parts
end
-- Add basic built-in console commands
console.add_player_command('help', '[' .. console.option .. 'all|<command>]',
'Display available commands or help on all commands or help on a specific command.',
function (player, command)
if command ~= nil then
command = tostring(command)
end
local make_help = function (command)
return console.header_bb .. command .. ' ' .. console.commands[command].parameter_text ..
'[-]\n' .. console.commands[command].help_text
end
local info_mode = false
if command == console.option..'all' then
info_mode = true
end
if command and console.commands[command] then
return make_help(command)
elseif command and not info_mode then
return console.error_bb .. "<command '" .. command .. "' not found>[-]"
else
local msg = console.header_bb .. 'Available commands:[-]'
local command_list = {}
for c, _ in pairs(console.commands) do
if player.admin or not console.commands[c].requires_admin then
if info_mode then
table.insert(command_list, make_help(c))
else
table.insert(command_list, c)
end
end
end
table.sort(command_list)
local sep
if info_mode then
sep = '\n\n'
else
sep = '\n'
end
for _, c in ipairs(command_list) do
local cmd = console.commands[c]
if cmd then
msg = msg .. sep .. cmd.help_bb .. c .. '[-]'
else
msg = msg .. sep .. c
end
if not info_mode then sep = ', ' end
end
return msg
end
end
)
console.add_player_command('?', nil, nil, 'help')
console.add_player_command('info', '', 'Display help on all available commands.', 'help', {console.option..'all'})
console.add_player_command('exit', '',
"Leave <command mode> ('" .. console.command_char .. "' does the same).",
function (player)
console.in_command_mode[player.steam_id] = nil
return console.header_bb .. '<command mode: off>[-]'
end
)
console.add_player_command('cmd', '',
"Enter <command mode> ('" .. console.command_char .. "' does the same).",
function (player)
console.in_command_mode[player.steam_id] = true
return console.header_bb .. '<command mode: on>[-]'
end
)
console.add_player_command(console.command_char, '',
'Toggle <command mode>',
function (player)
console.in_command_mode[player.steam_id] = not console.in_command_mode[player.steam_id]
if console.in_command_mode[player.steam_id] then
return console.header_bb .. '<command mode: on>[-]', true
else
return console.header_bb .. '<command mode: off>[-]', true
end
end
)
console.add_player_command('=', '<expression>',
'Evaluate an expression',
function (player, ...)
local expression = ''
for _, arg in ipairs({...}) do
expression = expression .. ' ' .. tostring(arg)
end
if not player.admin then
expression = expression:gasub('[a-zA-Z~]', '')
end
console.returned_value = dynamic.eval(expression)
return console.returned_value
end
)
console.add_player_command('echo', '<text>',
'Display text on screen',
function (player, ...)
local text = ''
for _, arg in ipairs({...}) do
text = text .. ' ' .. tostring(arg)
end
printToColor(text, player.color, console.output_color)
return false
end
)
console.add_player_command('cls', '',
'Clear console text',
function (player)
return '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n' ..
'\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'
end
)
console.add_player_command('alias', '<alias> <command> [<parameter>...]',
'Create a command alias.',
function (player, ...)
local alias
local command
local parameters = {}
for i, arg in ipairs({...}) do
if i == 1 then
alias = tostring(arg)
elseif i == 2 then
command = tostring(arg)
else
table.insert(parameters, arg)
end
end
if not alias then
return console.error_bb .. '<must provide an alias>[-]'
--elseif console.commands[alias] ~= nil then
-- return console.error_bb .. "<command '" .. alias .. "' already exists!>[-]"
elseif command == nil then
return console.error_bb .. "<must provide a command>[-]"
elseif console.commands[command] == nil then
return console.error_bb .. "<command '" .. command .. "' does not exist>[-]"
else
local text = console.header_bb .. alias .. '[-] = ' .. command
local help_text = console.commands[command].help_text
if not help_text:find('\nAliased to: ') then
help_text = help_text .. '\nAliased to: ' .. command
end
local combined_parameters = {}
if console.commands[command].default_parameters then
for _, parameter in ipairs(console.commands[command].default_parameters) do
table.insert(combined_parameters, parameter)
end
end
for _, parameter in ipairs(parameters) do
table.insert(combined_parameters, parameter)
text = text .. ' ' .. parameter
help_text = help_text .. ' ' .. parameter
end
console.add_command(alias, console.commands[command].requires_admin, console.commands[command].parameter_text, help_text, command, combined_parameters)
return text
end
end
)
-- change the command help color so client added commands appear different to in-built
console.set_command_listing_bb(console.client_help_bb)
end
|
return {'ceulemans'} |
local nn = require 'nn'
require 'cunn'
local Convolution = cudnn.SpatialConvolution
local Avg = cudnn.SpatialAveragePooling
local ReLU = cudnn.ReLU
local Max = nn.SpatialMaxPooling
local SBatchNorm = nn.SpatialBatchNormalization
-- Note: 1. Every inception is followed by a 1*1 conv layer for filter-expansion, which is not followed by activation
-- according to the paper
-- 2. There are not bn layer on top of the addition in residue modules because of the large GPU memory consumption
-- it is also mentioned in the paper
local function createModel(opt)
if opt.nGPU == 0 then
Convolution = nn.SpatialConvolution
Avg = nn.SpatialAveragePooling
ReLU = nn.ReLU
Max = nn.SpatialMaxPooling
SBatchNorm = nn.SpatialBatchNormalization
end
-- A wrapper of conv + bn + relu layer
local function ConvBN(ich, och, kW, kH, strideW, strideH, paddingW, paddingH, activation)
activation = activation or 1
--print(string.format("conv %d -> %d, kernel (%dx%d), strides (%d, %d), padding (%d, %d)",
--ich, och, kW, kH, strides[1], strides[2], padding[1], padding[2]))
local unit = nn.Sequential()
unit:add(Convolution(ich, och, kW, kH, strideW, strideH, paddingW, paddingH))
unit:add(SBatchNorm(och))
if activation == 1 then
unit:add(ReLU(true))
end
return unit
end
-- stem of inception-resnet-v2 and inception-v4
local function stem_inception_resnet()
stem = nn.Sequential()
stem:add(ConvBN(3,32,3,3,2,2,0,0))
stem:add(ConvBN(32,32,3,3,1,1,0,0))
stem:add(ConvBN(32,64,3,3,1,1,1,1))
local stem_branch1 = ConvBN(64,96,3,3,2,2,0,0)
local stem_branch2 = nn.Sequential()
stem_branch2:add(Max(3,3,2,2,0,0))
local stem_concat1 = nn.Concat(2)
stem_concat1:add(stem_branch1)
stem_concat1:add(stem_branch2)
stem:add(stem_concat1)
local stem_branch3 = nn.Sequential()
stem_branch3:add(ConvBN(160,64,1,1,1,1,0,0))
stem_branch3:add(ConvBN(64,64,1,7,1,1,0,3))
stem_branch3:add(ConvBN(64,64,7,1,1,1,3,0))
stem_branch3:add(ConvBN(64,96,3,3,1,1,0,0))
local stem_branch4 = nn.Sequential()
stem_branch4:add(ConvBN(160,64,1,1,1,1,0,0))
stem_branch4:add(ConvBN(64,96,3,3,1,1,0,0))
local stem_concat2 = nn.Concat(2)
stem_concat2:add(stem_branch3)
stem_concat2:add(stem_branch4)
stem:add(stem_concat2)
local stem_concat3 = nn.Concat(2)
stem_concat3:add(Max(3,3,2,2,0,0))
stem_concat3:add(ConvBN(192,192,3,3,2,2,0,0))
stem:add(stem_concat3)
stem:add(ReLU(true))
return stem
end
-- inception module for 35*35 grid of inception-resnet-v2
local function inception_resnet_A()
local block = nn.Sequential()
local inception_branch = nn.Sequential()
-- add inception
local inception = nn.Concat(2)
local conv1 = ConvBN(384,32,1,1,1,1,0,0)
local conv3 = nn.Sequential()
conv3:add(ConvBN(384,32,1,1,1,1,0,0))
conv3:add(ConvBN(32,32,3,3,1,1,1,1))
local conv5 = nn.Sequential()
conv5:add(ConvBN(384,32,1,1,1,1,0,0))
conv5:add(ConvBN(32,48,3,3,1,1,1,1))
conv5:add(ConvBN(48,64,3,3,1,1,1,1))
inception:add(conv1)
inception:add(conv3)
inception:add(conv5)
inception_branch:add(inception)
inception_branch:add(Convolution(128,384,1,1,1,1,0,0))
inception_branch:add(nn.MulConstant(0.1))
-- add shortcut and addition
block:add(nn.ConcatTable()
:add(nn.Identity())
:add(inception_branch))
block:add(nn.CAddTable(true))
block:add(ReLU(true))
return block
end
-- reduction module from 35*35 to 17*17
local function reduction_A()
local block = nn.Concat(2)
local max = nn.Sequential()
max:add(Max(3,3,2,2,0,0))
local conv3 = ConvBN(384,384,3,3,2,2,0,0)
local conv5 = nn.Sequential()
conv5:add(ConvBN(384,256,1,1,1,1,0,0))
conv5:add(ConvBN(256,256,3,3,1,1,1,1))
conv5:add(ConvBN(256,384,3,3,2,2,0,0))
block:add(max)
block:add(conv3)
block:add(conv5)
return nn.Sequential()
:add(block)
end
-- inception module for 17*17 grid of inception-resnet-v2
local function inception_resnet_B()
local block = nn.Sequential()
local inception_branch = nn.Sequential()
-- add inception
local inception = nn.Concat(2)
local conv1 = ConvBN(1152,192,1,1,1,1,0,0)
local conv7 = nn.Sequential()
conv7:add(ConvBN(1152,128,1,1,1,1,0,0))
conv7:add(ConvBN(128,160,7,1,1,1,3,0))
conv7:add(ConvBN(160,192,1,7,1,1,0,3))
inception:add(conv1)
inception:add(conv7)
inception_branch:add(inception)
inception_branch:add(Convolution(384,1152,1,1,1,1,0,0))
inception_branch:add(nn.MulConstant(0.1))
block:add(nn.ConcatTable()
:add(nn.Identity())
:add(inception_branch))
block:add(nn.CAddTable(true))
block:add(ReLU(true))
return block
end
-- reduction module from 17*17 to 8*8
local function reduction_B()
local block = nn.Concat(2)
local max = nn.Sequential()
max:add(Max(3,3,2,2,0,0))
local conv3_1 = nn.Sequential()
conv3_1:add(ConvBN(1152,256,1,1,1,1,0,0))
conv3_1:add(ConvBN(256,384,3,3,2,2,0,0))
local conv3_2 = nn.Sequential()
conv3_2:add(ConvBN(1152,256,1,1,1,1,0,0))
conv3_2:add(ConvBN(256,288,3,3,2,2,0,0))
local conv5 = nn.Sequential()
conv5:add(ConvBN(1152,256,1,1,1,1,0,0))
conv5:add(ConvBN(256,288,3,3,1,1,1,1))
conv5:add(ConvBN(288,320,3,3,2,2,0,0))
block:add(max)
block:add(conv3_1)
block:add(conv3_2)
block:add(conv5)
return nn.Sequential()
:add(block)
end
-- inception module for 8*8 grid of inception-resnet-v2
local function inception_resnet_C()
local block = nn.Sequential()
local inception_branch = nn.Sequential()
-- inception branch
local inception = nn.Concat(2)
local conv1 = ConvBN(2144,192,1,1,1,1,0,0)
local conv3 = nn.Sequential()
conv3:add(ConvBN(2144,192,1,1,1,1,0,0))
conv3:add(ConvBN(192,224,3,1,1,1,1,0))
conv3:add(ConvBN(224,256,1,3,1,1,0,1))
inception:add(conv1)
inception:add(conv3)
inception_branch:add(inception)
inception_branch:add(Convolution(448,2144,1,1,1,1,0,0))
inception_branch:add(nn.MulConstant(0.1))
block:add(nn.ConcatTable()
:add(nn.Identity())
:add(inception_branch))
block:add(nn.CAddTable(true))
block:add(ReLU(true))
return block
end
-- build model
local model = nn.Sequential()
model:add(stem_inception_resnet())
for i =1,5 do
model:add(inception_resnet_A())
end
model:add(reduction_A())
for i=1,10 do
model:add(inception_resnet_B())
end
model:add(reduction_B())
for i=1,5 do
model:add(inception_resnet_C())
end
model:add(Avg(8,8,1,1))
model:add(nn.View(2144):setNumInputDims(3))
model:add(nn.Dropout(0.2))
model:add(nn.Linear(2144,1000))
--torch.save('inception-resnet-v2.t7',model)
local function ConvInit(name)
for k,v in pairs(model:findModules(name)) do
local n = v.kW*v.kH*v.nOutputPlane
v.weight:normal(0,math.sqrt(2/n))
if opt.nGPU > 0 then
if cudnn.version >= 4000 then
v.bias = nil
v.gradBias = nil
else
v.bias:zero()
end
end
end
end
local function BNInit(name)
for k,v in pairs(model:findModules(name)) do
v.weight:fill(1)
if opt.nGPU > 0 then
v.bias:zero()
end
end
end
ConvInit('cudnn.SpatialConvolution')
ConvInit('nn.SpatialConvolution')
BNInit('fbnn.SpatialBatchNormalization')
BNInit('cudnn.SpatialBatchNormalization')
BNInit('nn.SpatialBatchNormalization')
for k,v in pairs(model:findModules('nn.Linear')) do
v.bias:zero()
end
torch.save('inception-resnet.t7', model)
model:cuda()
if opt.cudnn == 'deterministic' then
model:apply(function(m)
if m.setMode then m:setMode(1,1,1) end
end)
end
model:get(1).gradInput = nil
return model
end
return createModel
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.