content
stringlengths 5
1.05M
|
|---|
local mod = DBM:NewMod("GRDTrash", "DBM-Party-WoD", 3)
local L = mod:GetLocalizedStrings()
mod:SetRevision(("$Revision: 13843 $"):sub(12, -3))
--mod:SetModelID(47785)
mod:SetZone()
mod.isTrashMod = true
mod:RegisterEvents(
"SPELL_AURA_APPLIED 176025 166340",
"SPELL_AURA_APPLIED_DOSE 166340",
"SPELL_CAST_START 166675 176032",
"SPELL_CAST_SUCCESS 163966",
"SPELL_PERIODIC_DAMAGE 176033",
"SPELL_ABSORBED 176033"
)
local warnLavaWreath = mod:NewTargetAnnounce(176025, 4)
--local warnFlametongue = mod:NewTargetAnnounce(176032, 4)--target scanning unverified
local specWarnActivating = mod:NewSpecialWarningInterrupt(163966, "-Healer")
local specWarnLavaWreath = mod:NewSpecialWarningMoveAway(176025)
--local specWarnFlametongue = mod:NewSpecialWarningYou(176032)
--local yellFlametongue = mod:NewYell(176032)
local specWarnFlametongueGround = mod:NewSpecialWarningMove(176033)--Ground aoe, may add an earlier personal warning if target scanning works.
local specWarnShrapnelblast = mod:NewSpecialWarningMove(166675, "Tank", nil, nil, 3)--160943 boss version, 166675 trash version.
local specWarnThunderzone = mod:NewSpecialWarningMove(166340)
mod:RemoveOption("HealthFrame")
function mod:FlametongueTarget(targetname, uId)
if not targetname then return end
-- warnFlametongue:Show(targetname)
DBM:Debug("Flametongue possibly on "..targetname)
if targetname == UnitName("player") then
-- specWarnFlametongue:Show()
-- yellFlametongue:Yell()
end
end
function mod:SPELL_AURA_APPLIED(args)
if not self.Options.Enabled or self:IsDifficulty("normal5") then return end
local spellId = args.spellId
if spellId == 176025 then
warnLavaWreath:Show(args.destName)
if args:IsPlayer() then
specWarnLavaWreath:Show()
end
elseif spellId == 166340 and args:IsPlayer() and self:AntiSpam(2, 3) then
specWarnThunderzone:Show()
end
end
mod.SPELL_AURA_APPLIED_DOSE = mod.SPELL_AURA_APPLIED
function mod:SPELL_CAST_START(args)
if not self.Options.Enabled or self:IsDifficulty("normal5") then return end
local spellId = args.spellId
if spellId == 166675 and self:AntiSpam(2, 1) then
specWarnShrapnelblast:Show()
elseif spellId == 176032 then
self:BossTargetScanner(args.sourceGUID, "FlametongueTarget", 0.05, 16)
if self:IsTank() then
specWarnFlametongueGround:Show()--Pre warn here for tanks, because this attack also massively buffs trash damage if they are standing in the fire too. Will improve if target scanning works
end
end
end
function mod:SPELL_CAST_SUCCESS(args)
if not self.Options.Enabled or self:IsDifficulty("normal5") then return end
local spellId = args.spellId
if spellId == 163966 and self:AntiSpam(2, 3) then
specWarnActivating:Show(args.sourceName)
end
end
function mod:SPELL_PERIODIC_DAMAGE(_, _, _, _, destGUID, _, _, _, spellId)
if spellId == 176033 and destGUID == UnitGUID("player") and self:AntiSpam(2, 2) then
specWarnFlametongueGround:Show()
end
end
mod.SPELL_ABSORBED = mod.SPELL_PERIODIC_DAMAGE
|
BigWigs:AddColors("T'zane", {
[261552] = "red",
[261600] = "yellow",
[261605] = {"blue","orange"},
[262004] = {"blue","purple"},
})
BigWigs:AddColors("Ji'arak", {
[260908] = "yellow",
[261088] = "red",
[261467] = "orange",
})
BigWigs:AddColors("Hailstone Construct", {
[274891] = "yellow",
[274895] = "red",
})
BigWigs:AddColors("Azurethos, The Winged Typhoon", {
[274829] = "red",
[274832] = "purple",
[274839] = "yellow",
})
BigWigs:AddColors("Doom's Howl", {
[271120] = "blue",
[271163] = "purple",
[271164] = "orange",
[271223] = "cyan",
[271800] = "red",
})
BigWigs:AddColors("The Lion's Roar", {
[271120] = "blue",
[271163] = "purple",
[271164] = "orange",
[271223] = "cyan",
[271800] = "red",
})
BigWigs:AddColors("Warbringer Yenajz", {
[274842] = "yellow",
[274904] = "blue",
[274932] = "red",
})
BigWigs:AddColors("Dunegorger Kraulok", {
[275200] = "orange",
[276046] = "red",
})
|
local K = require 'cliargs.constants'
-------------------------------------------------------------------------------
-- UTILS
-------------------------------------------------------------------------------
local shallow_copy = require 'cliargs.utils.shallow_copy'
local filter = require 'cliargs.utils.filter'
local disect_argument = require 'cliargs.utils.disect_argument'
local lookup = require 'cliargs.utils.lookup'
local function clone_table_shift(t)
local clone = shallow_copy(t)
table.remove(clone, 1)
return clone
end
local function clone_table_remove(t, index)
local clone = shallow_copy(t)
table.remove(clone, index)
return clone
end
-------------------------------------------------------------------------------
-- PARSE ROUTINES
-------------------------------------------------------------------------------
local p = {}
function p.invoke_command(args, options, done)
local commands = filter(options, 'type', K.TYPE_COMMAND)
for index, opt in ipairs(args) do
local command = filter(commands, '__key__', opt)[1]
if command then
local command_args = clone_table_remove(args, index)
if command.__action__ then
local parsed_command_args, err = command:parse(command_args)
if err then
return nil, err
end
return command.__action__(parsed_command_args)
elseif command.__file__ then
local filename = command.__file__
if type(filename) == 'function' then
filename = filename()
end
local run_command_file = function()
_G.arg = command_args
local res, err = assert(loadfile(filename))()
_G.arg = args
return res, err
end
return run_command_file()
end
end
end
return done()
end
function p.print_help(args, printer, done)
-- has --help or -h ? display the help listing and abort!
for _, v in pairs(args) do
if v == "--help" or v == "-h" then
return nil, printer.generate_help_and_usage()
end
end
return done()
end
function p.track_dump_request(args, done)
-- starts with --__DUMP__; set dump to true to dump the parsed arguments
if args[1] == "--__DUMP__" then
return done(true, clone_table_shift(args))
else
return done(false, args)
end
end
function p.process_arguments(args, options, done)
local values = {}
local cursor = 0
local argument_cursor = 1
local argument_delimiter_found = false
local function consume()
cursor = cursor + 1
return args[cursor]
end
local required = filter(options, 'type', K.TYPE_ARGUMENT)
while cursor < #args do
local curr_opt = consume()
local symbol, key, value, flag_negated = disect_argument(curr_opt)
-- end-of-options indicator:
if curr_opt == "--" then
argument_delimiter_found = true
-- an option:
elseif not argument_delimiter_found and symbol then
local entry = lookup(key, key, options)
if not key or not entry then
local option_type = value and "option" or "flag"
return nil, "unknown/bad " .. option_type .. ": " .. curr_opt
end
if flag_negated and not entry.negatable then
return nil, "flag '" .. curr_opt .. "' may not be negated using --no-"
end
-- a flag and a value specified? that's an error
if entry.flag and value then
return nil, "flag " .. curr_opt .. " does not take a value"
elseif entry.flag then
value = not flag_negated
-- an option:
else
-- the value might be in the next argument, e.g:
--
-- --compress lzma
if not value then
-- if the option contained a = and there's no value, it means they
-- want to nullify an option's default value. eg:
--
-- --compress=
if curr_opt:find('=') then
value = '__CLIARGS_NULL__'
else
-- NOTE: this has the potential to be buggy and swallow the next
-- entry as this entry's value even though that entry may be an
-- actual argument/option
--
-- this would be a user error and there is no determinate way to
-- figure it out because if there's no leading symbol (- or --)
-- in that entry it can be an actual argument. :shrug:
value = consume()
if not value then
return nil, "option " .. curr_opt .. " requires a value to be set"
end
end
end
end
table.insert(values, { entry = entry, value = value })
if entry.callback then
local altkey = entry.key
local status, err
if key == entry.key then
altkey = entry.expanded_key
else
key = entry.expanded_key
end
status, err = entry.callback(key, value, altkey, curr_opt)
if status == nil and err then
return nil, err
end
end
-- a regular argument:
elseif argument_cursor <= #required then
local entry = required[argument_cursor]
table.insert(values, { entry = entry, value = curr_opt })
if entry.callback then
local status, err = entry.callback(entry.key, curr_opt)
if status == nil and err then
return nil, err
end
end
argument_cursor = argument_cursor + 1
-- a splat argument:
else
local entry = filter(options, 'type', K.TYPE_SPLAT)[1]
if entry then
table.insert(values, { entry = entry, value = curr_opt })
if entry.callback then
local status, err = entry.callback(entry.key, curr_opt)
if status == nil and err then
return nil, err
end
end
end
argument_cursor = argument_cursor + 1
end
end
return done(values, argument_cursor - 1)
end
function p.validate(options, arg_count, done)
local required = filter(options, 'type', K.TYPE_ARGUMENT)
local splatarg = filter(options, 'type', K.TYPE_SPLAT)[1] or { maxcount = 0 }
local min_arg_count = #required
local max_arg_count = #required + splatarg.maxcount
-- missing any required arguments, or too many?
if arg_count < min_arg_count or arg_count > max_arg_count then
if splatarg.maxcount > 0 then
return nil, (
"bad number of arguments: " ..
min_arg_count .. "-" .. max_arg_count ..
" argument(s) must be specified, not " .. arg_count
)
else
return nil, (
"bad number of arguments: " ..
min_arg_count .. " argument(s) must be specified, not " .. arg_count
)
end
end
return done()
end
function p.collect_results(cli_values, options)
local results = {}
local function collect_with_default(entry)
local entry_values = {}
local _
for _, item in ipairs(cli_values) do
if item.entry == entry then
table.insert(entry_values, item.value)
end
end
if #entry_values == 0 then
return type(entry.default) == 'table' and entry.default or { entry.default }
else
return entry_values
end
end
local function write(entry, value)
if entry.key then results[entry.key] = value end
if entry.expanded_key then results[entry.expanded_key] = value end
end
for _, entry in pairs(options) do
local entry_cli_values = collect_with_default(entry)
local maxcount = entry.maxcount
if maxcount == nil then
maxcount = type(entry.default) == 'table' and 999 or 1
end
local entry_value = entry_cli_values
if maxcount == 1 and type(entry_cli_values) == 'table' then
-- take the last value
entry_value = entry_cli_values[#entry_cli_values]
if entry_value == '__CLIARGS_NULL__' then
entry_value = nil
end
end
write(entry, entry_value)
end
return results
end
return function(arguments, options, printer)
assert(arguments == nil or type(arguments) == "table",
"expected an argument table to be passed in, " ..
"got something of type " .. type(arguments)
)
local args = arguments or _G.arg or {}
-- the spiral of DOOM:
return p.invoke_command(args, options, function()
return p.track_dump_request(args, function(dump, args_without_dump)
return p.print_help(args_without_dump, printer, function()
return p.process_arguments(args_without_dump, options, function(values, arg_count)
return p.validate(options, arg_count, function()
if dump then
return nil, printer.dump_internal_state(values)
else
return p.collect_results(values, options)
end
end)
end)
end)
end)
end)
end
|
local code = {INTERNAL_SERVER_ERROR = 0, MISSING_AUTHENTICATION = 1, BAD_REQUEST = 2, INVALID_TOKEN = 3, INSUFFICIENT_SCOPE = 4}
local code_max = code.INSUFFICIENT_SCOPE -- for validation, update this accordingly
local function code_to_www_authenticate_error(c)
if c == code.BAD_REQUEST then
return 'bad_request'
end
if c == code.INVALID_TOKEN then
return 'invalid_token'
end
if c == code.INSUFFICIENT_SCOPE then
return 'insufficient_scope'
end
return ''
end
local internal_server_error_body = {message = 'An unexpected error occurred'}
local Error = {code = code.INTERNAL_SERVER_ERROR, description = "internal server error"}
function Error:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
if type(o.code) ~= 'number' or o.code < 0 or o.code > code_max then
o.code = code.INTERNAL_SERVER_ERROR
end
return o
end
function Error:to_status_code()
if self.code == code.BAD_REQUEST then
return 400
end
if self.code == code.INVALID_TOKEN then
return 401
end
if self.code == code.MISSING_AUTHENTICATION then
return 401
end
if self.code == code.INSUFFICIENT_SCOPE then
return 403
end
return 500
end
function Error:to_www_authenticate(realm)
if self.code == code.INTERNAL_SERVER_ERROR or self.code == code.MISSING_AUTHENTICATION then
return string.format('Bearer realm="%s"', realm:gsub('"', '\\"'))
end
local desc = self.description
if not desc or type(desc) ~= 'string' then
return string.format('Bearer realm="%s", error="%s"', realm:gsub('"', '\\"'), code_to_www_authenticate_error(self.code))
end
return string.format('Bearer realm="%s", error="%s", error_description="%s"', realm:gsub('"', '\\"'),
code_to_www_authenticate_error(self.code), desc:gsub('"', '\\"'))
end
function Error:to_body()
if self.code == code.INTERNAL_SERVER_ERROR then
return internal_server_error_body
end
if self.code == code.MISSING_AUTHENTICATION then
return
end
return {error = code_to_www_authenticate_error(self.code), error_description = self.description}
end
local _M_ = {
new = function(code, description)
return Error:new({code = code, description = description})
end,
code = code
}
return _M_
|
ENUMS = {
PLATFORM_IDS = {
SHORTCUTS = 1,
STEAM = 2,
BATTLENET = 3,
GOG_GALAXY = 4,
MAX = 5
},
FILTER_TYPES = {
NONE = 1,
TITLE = 2,
PLATFORM = 3,
TAG = 4,
HIDDEN = 5,
UNINSTALLED = 6,
NO_TAGS = 7,
RANDOM_GAME = 8,
NEVER_PLAYED = 9,
HAS_NOTES = 10
},
SORTING_TYPES = {
ALPHABETICALLY = 1,
LAST_PLAYED = 2,
HOURS_PLAYED = 3,
MAX = 4
},
SLOT_HOVER_ANIMATIONS = {
NONE = 1,
ZOOM_IN = 2,
JIGGLE = 3,
SHAKE_LEFT_RIGHT = 4,
SHAKE_UP_DOWN = 5,
MAX = 6
},
SLOT_CLICK_ANIMATIONS = {
NONE = 1,
SLIDE_UP = 2,
SLIDE_RIGHT = 3,
SLIDE_DOWN = 4,
SLIDE_LEFT = 5,
SHRINK = 6,
MAX = 7
},
SKIN_ANIMATIONS = {
NONE = 1,
SLIDE_UP = 2,
SLIDE_RIGHT = 3,
SLIDE_DOWN = 4,
SLIDE_LEFT = 5,
MAX = 6
}
}
|
local global = require( "global" )
function trigger(objectToChange)
if(global.triggeredSunStart) then
if(not level) then
print("No level found in Lua!")
return
end
local maxTimeDiff = 30
local timeDiff = os.clock()- global.sunStartTime
if(timeDiff > maxTimeDiff)then
timeDiff = maxTimeDiff
end
timeDiff = timeDiff/maxTimeDiff
local x = 10
local y = -18 + math.sqrt(timeDiff) * 29
local z = -8 + timeDiff * 15
level:setSunDirection(x,y,z)
end
end
--local x = 0.7 + 0.3 * timeDiff
--local y = math.sqrt(timeDiff) * 2.2 - 1.5
--local z = -0.7 - 0.7 * timeDiff
--start 1,-6,-2
--ziel 10,10,10
|
RenderSystem = class("RenderSystem", System)
function RenderSystem:draw()
-- Draw scoreboards
love.graphics.setColor(0, 1, 0, 0.8)
love.graphics.setFont(Font["scoreboard"])
-- Why doesn't this work?
-- for _, v in pairs(self.targets.scoreboard) do
for _, v in pairs(Game.engine:getEntitiesWithComponent("Scoreboard")) do
local basex = v:get("Scoreboard").x
local player = v:get("IsPlayer")
local text = player.name .. "\n"
text = text .. "Score: " .. player.score .. "\n"
text = text .. "Lives: " .. player.lives .. "\n"
text = text .. "Shields: "
for s = 1, player.shields, 1 do
text = text .. "*"
end
text = text .. "\n"
love.graphics.printf(text, basex, 10, 150)
end
-- Draw rocks
if Game.state.current().name() == "AttractState" then
love.graphics.setColor(0, 1, 0, 0.3)
else
love.graphics.setColor(0, 1, 0)
end
for _, v in pairs(self.targets.rocks) do
local vbody = v:get("Body").body
vbody:draw("line")
end
-- Draw bullets
love.graphics.setColor(0, 1, 0)
for _, v in pairs(self.targets.bullets) do
if not (Game.friendly_mode) then
love.graphics.setColor(v:getParent():get("IsPlayer").color)
end
local vbody = v:get("Body").body
vbody:draw("line")
end
-- Draw player
for _, v in pairs(self.targets.players) do
local vbody = v:get("Body").body
love.graphics.setColor(v:get("IsPlayer").color)
vbody:draw("line")
-- Draw shield
if v:get("IsPlayer").shield_until > love.timer.getTime() then
local alpha = math.max(0.3, math.min(1, v:get("IsPlayer").shield_until - love.timer.getTime()))
love.graphics.setColor(0, 1, 0, alpha)
local vbody = v:get("Body").body
local x, y = vbody:center()
local sides = math.random(6, 13)
love.graphics.circle("line", x, y, 20, sides)
end
end
-- Draw watcher
love.graphics.setColor(0, 1, 0)
love.graphics.setFont(Font["watcher"])
Watcher:draw()
end
function RenderSystem:requires()
return {
rocks = { "IsRock", "Body" },
players = { "IsPlayer", "Body" },
bullets = { "IsBullet", "Body" },
scoreboard = { "ScoreBoard" },
}
end
|
local Recipe = {}
Recipe.Name = "recipe_methanolrefinement"
Recipe.PrintName = "Methanol Refinement"
Recipe.GainExp = 5
Recipe.Ingredients = {}
Recipe.Ingredients["item_trade_methanol"] = 3
Recipe.Products = {}
Recipe.Products["item_trade_fuel"] = 1
Recipe.RequiredMasters = {}
Recipe.RequiredMasters["master_chemical"] = 2
Register.Recipe(Recipe)
local Recipe = {}
Recipe.Name = "recipe_napalm"
Recipe.PrintName = "Napalm Creation"
Recipe.GainExp = 5
Recipe.Ingredients = {}
Recipe.Ingredients["item_trade_methanol"] = 3
Recipe.Products = {}
Recipe.Products["item_trade_fuel"] = 1
Recipe.RequiredMasters = {}
Recipe.RequiredMasters["master_chemical"] = 2
Register.Recipe(Recipe)
local Recipe = {}
Recipe.Name = "recipe_homemadegrenade"
Recipe.PrintName = "Homemade Grenade"
Recipe.GainExp = 8
Recipe.Ingredients = {}
Recipe.Ingredients["item_trade_tincan"] = 1
Recipe.Ingredients["item_trade_blackpowder"] = 2
Recipe.Ingredients["item_trade_explosivespin"] = 1
Recipe.Products = {}
Recipe.Products["item_grenade"] = 1
Recipe.RequiredMasters = {}
Recipe.RequiredMasters["master_mechanical"] = 2
Recipe.RequiredMasters["master_chemical"] = 2
Register.Recipe(Recipe)
local Recipe = {}
Recipe.Name = "recipe_cook_noodles"
Recipe.PrintName = "Cooking Chinese Noodles"
Recipe.NearFire = true
Recipe.MakeTime = 20
Recipe.GainExp = 10
Recipe.Chance = 30
Recipe.Ingredients = {}
Recipe.Ingredients["item_chineese_box"] = 1
Recipe.Ingredients["item_bagofnoodles"] = 1
Recipe.Products = {}
Recipe.Products["item_cookednoodles"] = 1
Recipe.BadProducts = {}
Recipe.BadProducts["item_spoilednoodles"] = 1
Recipe.RequiredMasters = {}
Recipe.RequiredMasters["master_culinary"] = 2
Register.Recipe(Recipe)
|
require("moonsc").import_tags()
-- we test that the processor supports the scxml event i/o processor
return _scxml{ initial="s0",
_state{ id="s0",
_onentry{
--@@ _send{ type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor", event="event1" },
_send{ type="scxml", event="event1" },
_send{ event="timeout" },
},
_transition{ event="event1", target="pass" },
_transition{ event="*", target="fail" },
},
_final{id='pass'},
_final{id='fail'},
}
|
local t = Def.ActorFrame{};
for pn in ivalues(PlayerNumber) do
t[#t+1] = Def.ActorFrame{
Name="Danger"..ToEnumShortString(pn),
Def.ActorFrame{
Name="Single",
BeginCommand=function(self)
local style = GAMESTATE:GetCurrentStyle()
local styleType = style:GetStyleType()
local bDoubles = (styleType == 'StyleType_OnePlayerTwoSides' or styleType == 'StyleType_TwoPlayersSharedSides')
self:visible(not bDoubles)
end;
HealthStateChangedMessageCommand=function(self, param)
if param.PlayerNumber == pn then
if param.HealthState == "HealthState_Danger" then
self:RunCommandsOnChildren(cmd(playcommand,"Show"))
else
self:RunCommandsOnChildren(cmd(playcommand,"Hide"))
end
end
end;
LoadActor("_danger")..{
InitCommand=function(s) s:visible(false):xy(SCREEN_CENTER_X,SCREEN_CENTER_Y):zoomto(640,480) end,
ShowCommand=function(s) s:visible(true):diffuseblink():effectcolor1(color("1,1,1,1")):effectcolor2(color("0,0,0,0")):effectclock("music") end,
HideCommand=function(s) s:visible(false) end
};
};
};
end
--It's either CS or AC that displays bars on the side of the bg videos. I have to check. -Inori
t[#t+1] = LoadActor("frame")..{
InitCommand=function(s) s:xy(SCREEN_CENTER_X,SCREEN_CENTER_Y) end
};
t[#t+1] = Def.Quad{
-- Extra lifemeter under, shit breaks because lol reverse.
InitCommand=function(s) s:x(SCREEN_CENTER_X):diffuse( color("0,0,0,1") ) end,
OnCommand=function(self)
if GAMESTATE:IsAnExtraStage() == true then
self:setsize(SCREEN_WIDTH,70)
:y(SCREEN_BOTTOM-30):
addy(78):linear(0.6):addy(-78);
else
self:setsize(SCREEN_WIDTH,58)
:y(SCREEN_TOP+20):
addy(-50):linear(0.6):addy(50);
end
end;
OffCommand=function(self)
if GAMESTATE:IsAnExtraStage() == true then
self:linear(0.8):addy(78);
else
self:linear(0.8):addy(-58);
end;
end;
};
return t;
|
return{
name = 'stone',
description = 'Stone',
type = 'material',
info = 'a slightly bigger rock',
MAX_ITEMS = 1,
}
|
local _M = { }
local util = require('resty.woothee.util')
local dataset = require('resty.woothee.dataset')
function _M.challenge_playstation(ua, result)
local data, os_version, match, err = nil
if string.find(ua, 'PSP (PlayStation Portable);', 1, true) then
data = dataset.get('PSP')
match, err = ngx.re.match(ua, [[PSP \(PlayStation Portable\); ([.0-9]+)\)]], "o")
if match then
os_version = match[1]
end
elseif string.find(ua, 'PlayStation Vita', 1, true) then
data = dataset.get('PSVita')
match, err = ngx.re.match(ua, [[PlayStation Vita ([.0-9]+)\)]], "o")
if match then
os_version = match[1]
end
elseif string.find(ua, 'PLAYSTATION 3 ', 1, true) or string.find(ua, 'PLAYSTATION 3;', 1, true) then
data = dataset.get('PS3')
match, err = ngx.re.match(ua, [[PLAYSTATION 3;? ([.0-9]+)\)]], "o")
if match then
os_version = match[1]
end
elseif string.find(ua, 'PlayStation 4 ', 1, true) then
data = dataset.get('PS4')
match, err = ngx.re.match(ua, [[PlayStation 4 ([.0-9]+)\)]], "o")
if match then
os_version = match[1]
end
end
if not data then
return false
end
util.update_map(result, data)
if os_version then
util.update_os_version(result, os_version);
end
return true
end
function _M.challenge_nintendo(ua, result)
local data = nil
if string.find(ua, 'Nintendo 3DS;', 1, true) then
data = dataset.get('Nintendo3DS')
elseif string.find(ua, 'Nintendo DSi;', 1, true) then
data = dataset.get('NintendoDSi')
elseif string.find(ua, 'Nintendo Wii;', 1, true) then
data = dataset.get('NintendoWii')
elseif string.find(ua, '(Nintendo WiiU)', 1, true) then
data = dataset.get('NintendoWiiU')
end
if not data then
return false
end
util.update_map(result, data)
return true
end
function _M.challenge_digitalTV(ua, result)
local data = nil
if string.find(ua, 'InettvBrowser/', 1, true) then
data = dataset.get('DigitalTV')
end
if not data then
return false
end
util.update_map(result, data)
return true
end
return _M
|
Talk(86, "听说六大派正要铲平光明顶消灭明教时,出现了一位少年英雄,打败了六大派,救了明教,此人真是了得.", "talkname86", 0);
Talk(0, "不好意思,那个少年英雄就是我.", "talkname0", 1);
Talk(86, "你?也不照照镜子看看.听说那位英雄身长十尺,虎背熊腰,力大无穷.你看看你,配吗?", "talkname86", 0);
do return end;
|
return {'coeliakie','coefficient','coen','coevorden','coevordenaar','coevorder','coevords','coenen','coenraad','coert','coenders','coehoorn','coene','coehorst','coenraadts','coelen','coers','coenraats','coenradie','coevert','coerver','coenradi','coelacanthen','coefficienten','coens','coenraads','coerts','coevordense'}
|
flower = class:new()
function flower:init(x, y)
--PHYSICS STUFF
self.starty = y
self.x = x-6/16
self.y = y-11/16
self.speedy = 0
self.speedx = 0
self.width = 12/16
self.height = 12/16
self.static = true
self.active = true
self.category = 6
self.mask = {true}
self.destroy = false
self.autodelete = true
self.gravity = 0
--IMAGE STUFF
self.drawable = false
self.graphic = flowerimg
self.quad = flowerquad[1]
self.offsetX = 7
self.offsetY = 3
self.quadcenterX = 9
self.quadcenterY = 8
self.rotation = 0 --for portals
self.uptimer = 0
self.timer = 0
self.quadi = 1
self.falling = false
end
function flower:update(dt)
if self.uptimer < mushroomtime then
self.uptimer = self.uptimer + dt
self.y = self.y - dt*(1/mushroomtime)
end
if self.uptimer > mushroomtime then
self.y = self.starty-27/16
self.active = true
self.drawable = true
end
--animate
self.timer = self.timer + dt
while self.timer > staranimationdelay do
self.quadi = self.quadi + 1
if self.quadi == 5 then
self.quadi = 1
end
self.quad = flowerquad[self.quadi]
self.timer = self.timer - staranimationdelay
end
if self.destroy then
return true
else
return false
end
end
function flower:draw()
if self.uptimer < mushroomtime and not self.destroy then
--Draw it coming out of the block.
love.graphics.draw(self.graphic, self.quad, math.floor(((self.x-xscroll)*16+self.offsetX)*scale), math.floor((self.y*16-self.offsetY)*scale), 0, scale, scale, self.quadcenterX, self.quadcenterY)
end
end
function flower:leftcollide(a, b)
if a == "player" then
b:grow()
self.active = false
self.destroy = true
self.drawable = false
end
return false
end
function flower:rightcollide(a, b)
if a == "player" then
b:grow()
self.active = false
self.destroy = true
self.drawable = false
end
return false
end
function flower:floorcollide(a, b)
if self.active and a == "player" then
b:grow()
self.active = false
self.destroy = true
self.drawable = false
end
end
function flower:ceilcollide(a, b)
if self.active and a == "player" then
b:grow()
self.active = false
self.destroy = true
self.drawable = false
end
end
function flower:jump(x)
end
|
-- scaffold geniefile for hiptext
hiptext_script = path.getabsolute(path.getdirectory(_SCRIPT))
hiptext_root = path.join(hiptext_script, "hiptext")
hiptext_includedirs = {
path.join(hiptext_script, "config"),
hiptext_root,
}
hiptext_libdirs = {}
hiptext_links = {}
hiptext_defines = {}
----
return {
_add_includedirs = function()
includedirs { hiptext_includedirs }
end,
_add_defines = function()
defines { hiptext_defines }
end,
_add_libdirs = function()
libdirs { hiptext_libdirs }
end,
_add_external_links = function()
links { hiptext_links }
end,
_add_self_links = function()
links { "hiptext" }
end,
_create_projects = function()
project "hiptext"
kind "StaticLib"
language "C++"
flags {}
includedirs {
hiptext_includedirs,
}
defines {}
files {
path.join(hiptext_script, "config", "**.h"),
path.join(hiptext_root, "**.h"),
path.join(hiptext_root, "**.cpp"),
}
end, -- _create_projects()
}
---
|
deathWatchForemanConvoTemplate = ConvoTemplate:new {
initialScreen = "",
templateType = "Lua",
luaClassHandler = "deathWatchForemanConvoHandler",
screens = {}
}
init = ConvoScreen:new {
id = "init",
leftDialog = "@conversation/death_watch_foreman:s_8dc6968d", -- Hey, what are you doing down here? You shouldn't be walking around down here unless you are working or the Mandalorians authorized you to be here and you certainly don't have the look of a miner.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_637e6c80", "whatever_you_say"}, -- I have received authorization from the Mandalorians.
{"@conversation/death_watch_foreman:s_1c4d0bbb", "loosest_sense"}, -- You work for the Mandalorians?
}
}
deathWatchForemanConvoTemplate:addScreen(init);
busy_hasnt_done_quest = ConvoScreen:new {
id = "busy_hasnt_done_quest",
leftDialog = "@conversation/death_watch_foreman:s_9e37f61f", -- Another stranger? The Mandalorians must be really slacking on their defenses lately. Oh well, none of my business. I am sorry but I really have to get back to work right now, maybe I will have time to talk to you later.
stopConversation = "true",
options = {
}
}
deathWatchForemanConvoTemplate:addScreen(busy_hasnt_done_quest);
loosest_sense = ConvoScreen:new {
id = "loosest_sense",
leftDialog = "@conversation/death_watch_foreman:s_7a654750", -- Work in the loosest sense of the word. Although we are not really getting a whole lot of work done at this moment.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_2de77a24", "blasted_laser"}, -- Why aren't you getting any work done?
{"@conversation/death_watch_foreman:s_7d65b570", "we_mine_alum"}, -- What sort of work are you doing?
}
}
deathWatchForemanConvoTemplate:addScreen(loosest_sense);
not_that_bad = ConvoScreen:new {
id = "not_that_bad",
leftDialog = "@conversation/death_watch_foreman:s_e83ca277", -- I guess it isn't that bad. The Mandalorians don't pay us a whole lot but they generally don't directly mistreat any of us unless we do something to make them mad...which doesn't seem that hard to do. Hmmmm...now that I think about it this isn't the best life but it is better then telling them we quit.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_2de77a24", "blasted_laser"}, -- Why aren't you getting any work done?
}
}
deathWatchForemanConvoTemplate:addScreen(not_that_bad);
we_mine_alum = ConvoScreen:new {
id = "we_mine_alum",
leftDialog = "@conversation/death_watch_foreman:s_dd6f26cc", -- We mine for the alum that the Mandalores use to make their armor. Basically, we get to work down in these nasty caves all day long so the Mandalorians can look nice.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_dc1d4717", "not_that_bad"}, -- Sounds to me like you should be happy your not working.
}
}
deathWatchForemanConvoTemplate:addScreen(we_mine_alum);
blasted_laser = ConvoScreen:new {
id = "blasted_laser",
leftDialog = "@conversation/death_watch_foreman:s_1fe41c46", -- It's this blasted laser they have us working with. Dumb thing never works right and then when we finally did get it working again, Haldo went off his rocker, ripped its battery out, and took off with it.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_687ef712", "one_of_my_men"}, -- Haldo? Who is Haldo and why would he take the battery?
}
}
deathWatchForemanConvoTemplate:addScreen(blasted_laser);
whatever_you_say = ConvoScreen:new {
id = "whatever_you_say",
leftDialog = "@conversation/death_watch_foreman:s_81b8b95b", -- Yeah, yeah...whatever you say there pally. I wouldn't want to be in your shoes if the Mandalorians catch you down here bothering their miners.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_57097d43", "braver_than_me"}, -- Don't worry about me and the Mandalorians. I can handle them.
}
}
deathWatchForemanConvoTemplate:addScreen(whatever_you_say);
braver_than_me = ConvoScreen:new {
id = "braver_than_me",
leftDialog = "@conversation/death_watch_foreman:s_6d069da0", -- You're braver then I will ever be. But if you really are that tough, maybe you would like to help recover our drill battery that Haldo ran off with?
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_687ef712", "one_of_my_men"}, -- Haldo? Who is Haldo and why would he take the battery?
{"@conversation/death_watch_foreman:s_baac9005", "what_i_expected"}, -- I don't really have time to rescue your battery.
}
}
deathWatchForemanConvoTemplate:addScreen(braver_than_me);
what_i_expected = ConvoScreen:new {
id = "what_i_expected",
leftDialog = "@conversation/death_watch_foreman:s_f79fa021", -- That is pretty much what I expected. I would have been shocked if a complete stranger such as yourself offered to help us out.
stopConversation = "true",
options = {
}
}
deathWatchForemanConvoTemplate:addScreen(what_i_expected);
one_of_my_men = ConvoScreen:new {
id = "one_of_my_men",
leftDialog = "@conversation/death_watch_foreman:s_c2d12633", -- Haldo was one of the men on my crew. My guess is that his rebreather wasn't working properly and he breathed too much of the alum fumes. Blasted air vents haven't been working right either, so we have been using our masks a lot.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_8bbe4b84", "be_a_lifesaver"}, -- Maybe I can help you track down Haldo.
{"@conversation/death_watch_foreman:s_19ecd0cd", "asked_for_volunteers"}, -- Have you sent anyone out to try to find Haldo?
{"@conversation/death_watch_foreman:s_baac9005", "what_i_expected"}, -- I don't really have time to rescue your battery.
}
}
deathWatchForemanConvoTemplate:addScreen(one_of_my_men);
be_a_lifesaver = ConvoScreen:new {
id = "be_a_lifesaver",
leftDialog = "@conversation/death_watch_foreman:s_471cd71d", -- That would be a lifesaver. No one else is willing to go out and try to find him. Guys who get hit with alum sickness generally are unstable and sometimes can be quite dangerous.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_2236f9d7", "there_is_a_cure"}, -- If he is sick is there anyway to help him?
{"@conversation/death_watch_foreman:s_1265571c", "didnt_say_by_force"}, -- So I will have to take the battery from him by force?
{"@conversation/death_watch_foreman:s_71ad5afa", "what_i_expected"}, -- I am sorry but I don't really have time to help your sick co-worker.
}
}
deathWatchForemanConvoTemplate:addScreen(be_a_lifesaver);
asked_for_volunteers = ConvoScreen:new {
id = "asked_for_volunteers",
leftDialog = "@conversation/death_watch_foreman:s_645da2b5", -- I asked for volunteers but no one was willing to go search. Not that I blame them, I don't even want to go out and try to find him. People with alum sickness become real messed up in the head. You never know what they are going to do. A lot of times they get really violent.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_2236f9d7", "there_is_a_cure"}, -- If he is sick is there anyway to help him?
{"@conversation/death_watch_foreman:s_1265571c", "didnt_say_by_force"}, -- So I will have to take the battery from him by force?
{"@conversation/death_watch_foreman:s_71ad5afa", "what_i_expected"}, -- I am sorry but I don't really have time to help your sick co-worker.
}
}
deathWatchForemanConvoTemplate:addScreen(asked_for_volunteers);
there_is_a_cure = ConvoScreen:new {
id = "there_is_a_cure",
leftDialog = "@conversation/death_watch_foreman:s_45d9624a", -- Yeah, well there is a cure. We would have gone and got it, but the Mandalorians don't much care for us wandering around when we are supposed to be working, so none of us have gone up to get it.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_ce027a15", "great_remember_medicine"}, -- Ok I will go see what I can do for your co-worker.
{"@conversation/death_watch_foreman:s_f73c5ae7", "cure_is_upstairs"}, -- Where can I find this cure if I decide to help out?
{"@conversation/death_watch_foreman:s_71ad5afa", "what_i_expected"}, -- I am sorry but I don't really have time to help your sick co-worker.
}
}
deathWatchForemanConvoTemplate:addScreen(there_is_a_cure);
didnt_say_by_force = ConvoScreen:new {
id = "didnt_say_by_force",
leftDialog = "@conversation/death_watch_foreman:s_c7f1e2ee", -- Hey now! I didn't say anything about using force on him. He is sick and there is a cure up in the medical lab. Granted there have been a few cases where alum sickness will make a person so demented that they can't come back, but Haldo has only been ill for a little while.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_ce027a15", "great_remember_medicine"}, -- Ok I will go see what I can do for your co-worker.
{"@conversation/death_watch_foreman:s_f73c5ae7", "cure_is_upstairs"}, -- Where can I find this cure if I decide to help out?
{"@conversation/death_watch_foreman:s_71ad5afa", "what_i_expected"}, -- I am sorry but I don't really have time to help your sick co-worker.
}
}
deathWatchForemanConvoTemplate:addScreen(didnt_say_by_force);
cure_is_upstairs = ConvoScreen:new {
id = "cure_is_upstairs",
leftDialog = "@conversation/death_watch_foreman:s_44557f4a", -- It is located upstairs in the medical lab. One of the medical droids should be able to give it to you. They don't require any special code or anything to help you out. At least they didn't last time I used them but the Mandalorians don't really consult us when they make changes to things around here.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_ce027a15", "great_remember_medicine"}, -- Ok I will go see what I can do for your co-worker.
{"@conversation/death_watch_foreman:s_71ad5afa", "what_i_expected"}, -- I am sorry but I don't really have time to help your sick co-worker.
}
}
deathWatchForemanConvoTemplate:addScreen(cure_is_upstairs);
great_remember_medicine = ConvoScreen:new {
id = "great_remember_medicine",
leftDialog = "@conversation/death_watch_foreman:s_de774e37", -- Great. Now remember there is some medicine in the medical lab that should be able to help him out. And once you get that battery bring it on back to me so we can get this drill working again.
stopConversation = "true",
options = {}
}
deathWatchForemanConvoTemplate:addScreen(great_remember_medicine);
offer_quest_again = ConvoScreen:new {
id = "offer_quest_again",
leftDialog = "@conversation/death_watch_foreman:s_1511575f", -- Hey you are back again. You know Haldo is still running around down here with our battery. Are you sure you don't want to give us a hand and try to get it back for us?
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_26fa42a7", "return_great_remember_medicine"}, -- Yes I will see if I can find him for you.
{"@conversation/death_watch_foreman:s_58a87fe", "return_one_of_my_men"}, -- So who is this Haldo guy who ran off with your battery?
{"@conversation/death_watch_foreman:s_71ad5afa", "what_i_expected"}, -- I am sorry but I don't really have time to help your sick co-worker.
}
}
deathWatchForemanConvoTemplate:addScreen(offer_quest_again);
return_great_remember_medicine = ConvoScreen:new {
id = "return_great_remember_medicine",
leftDialog = "@conversation/death_watch_foreman:s_de774e37", -- Great. Now remember there is some medicine in the medical lab that should be able to help him out. And once you get that battery bring it on back to me so we can get this drill working again.
stopConversation = "true",
options = {
}
}
deathWatchForemanConvoTemplate:addScreen(return_great_remember_medicine);
return_one_of_my_men = ConvoScreen:new {
id = "return_one_of_my_men",
leftDialog = "@conversation/death_watch_foreman:s_c2d12633", -- Haldo was one of the men on my crew. My guess is that his rebreather wasn't working properly and he breathed too much of the alum fumes. Blasted air vents haven't been working right either, so we have been using our masks a lot.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_26fa42a7", "return_great_remember_medicine"}, -- Yes I will see if I can find him for you.
{"@conversation/death_watch_foreman:s_71ad5afa", "what_i_expected"}, -- I am sorry but I don't really have time to help your sick co-worker.
}
}
deathWatchForemanConvoTemplate:addScreen(return_one_of_my_men);
found_him_yet = ConvoScreen:new {
id = "found_him_yet",
leftDialog = "@conversation/death_watch_foreman:s_4f17ac67", -- Have you managed to find Haldo yet? We really need that battery back before the Mandalorians come down here to check up on our progress.
stopConversation = "false",
options = {
-- Handled by convo handler
--{"@conversation/death_watch_foreman:s_829888a9", "thank_you_didnt_kill"}, -- Here you go.
--{"@conversation/death_watch_foreman:s_829888a9", "thank_you_killed"}, -- Here you go.
--{"@conversation/death_watch_foreman:s_c825f420", "please_hurry"}, -- Not yet, but I am still looking for him.
--{"@conversation/death_watch_foreman:s_baac9005", "what_i_expected"}, -- I don't really have time to rescue your battery.
}
}
deathWatchForemanConvoTemplate:addScreen(found_him_yet);
please_hurry = ConvoScreen:new {
id = "please_hurry",
leftDialog = "@conversation/death_watch_foreman:s_fb5cf4cd", -- Ok, please hurry. I am sure that we don't have a whole lot of time left. Once you get the battery come back to me as quick as you can.
stopConversation = "true",
options = {
}
}
deathWatchForemanConvoTemplate:addScreen(please_hurry);
thank_you_didnt_kill = ConvoScreen:new {
id = "thank_you_didnt_kill",
leftDialog = "@conversation/death_watch_foreman:s_27b9acbc", -- Thank you for helping Haldo and getting the battery back for us. Now we can get back to....oh no! The battery's connections are all covered with dirt and grime. Haldo must have got them dirty after he took it.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_bdb717fb", "bad_connection"}, -- What happens if the battery connections are dirty?
}
}
deathWatchForemanConvoTemplate:addScreen(thank_you_didnt_kill);
thank_you_killed = ConvoScreen:new {
id = "thank_you_killed",
leftDialog = "@conversation/death_watch_foreman:s_3310d1b6", -- I guess I should thank you for getting us the battery back but you didn't have to kill Haldo. He was sick in the head from the fumes and the medicine from the medical droid could have cured him.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_d62e85a9", "suppose_you_did"}, -- You wanted the battery back and I got it back for you.
}
}
deathWatchForemanConvoTemplate:addScreen(thank_you_killed);
suppose_you_did = ConvoScreen:new {
id = "suppose_you_did",
leftDialog = "@conversation/death_watch_foreman:s_9b4dd6c7", -- Yeah, I suppose you did. Let me take a look at it. Oh no, this battery isn't going to do us any good. Look here all the connections on it are covered with dirt and grime. Now it is going to have to be cleaned off.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_bdb717fb", "bad_connection"}, -- What happens if the battery connections are dirty?
}
}
deathWatchForemanConvoTemplate:addScreen(suppose_you_did);
bad_connection = ConvoScreen:new {
id = "bad_connection",
leftDialog = "@conversation/death_watch_foreman:s_9cf7119e", -- We won't get a good solid connection and the drill won't fire is what will happen. I hate to ask but could you perhaps take this battery over to the workshop and have one of treadwell clean it up?
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_dd657c44", "speak_to_treadwell"}, -- Sure, I will come back to you as soon as I get it cleaned.
{"@conversation/death_watch_foreman:s_728cbacc", "would_love_to"}, -- Why don't one of you go take it to the workshop?
{"@conversation/death_watch_foreman:s_54ee97f2", "clean_when_can"}, -- I don't really have time to deal with this right now.
}
}
deathWatchForemanConvoTemplate:addScreen(bad_connection);
return_need_battery_clean = ConvoScreen:new {
id = "return_need_battery_clean",
leftDialog = "@conversation/death_watch_foreman:s_d1eff807", -- Could you do us one more favor and take this battery over to the workshop. The treadwell in there can clean it off without any problems.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_dd657c44", "speak_to_treadwell"}, -- Sure, I will come back to you as soon as I get it cleaned.
{"@conversation/death_watch_foreman:s_728cbacc", "would_love_to"}, -- Why don't one of you go take it to the workshop?
{"@conversation/death_watch_foreman:s_54ee97f2", "clean_when_can"}, -- I don't really have time to deal with this right now.
}
}
deathWatchForemanConvoTemplate:addScreen(return_need_battery_clean);
clean_when_can = ConvoScreen:new {
id = "clean_when_can",
leftDialog = "@conversation/death_watch_foreman:s_579c9bc5", -- Well that battery doesn't really do us alot of good in its current state. Why don't you hold onto it and if you do get a chance run it over to the workshop and get it cleaned. We would really appreciate it.
stopConversation = "true",
options = {}
}
deathWatchForemanConvoTemplate:addScreen(clean_when_can);
speak_to_treadwell = ConvoScreen:new {
id = "speak_to_treadwell",
leftDialog = "@conversation/death_watch_foreman:s_bc5213a", -- Just speak to the treadwell when you are in there and he will take care of the dirty battery. Oh and try not to kill him while you are there. We sort of need him for repairs around this place.
stopConversation = "true",
options = {}
}
deathWatchForemanConvoTemplate:addScreen(speak_to_treadwell);
would_love_to = ConvoScreen:new {
id = "would_love_to",
leftDialog = "@conversation/death_watch_foreman:s_23237572", -- I would love to but the Mandalorians keep track of who comes and goes from the workshop. If one of us goes in they will ask why and I would rather they didn't know about the whole Haldo incident. Since you are a stranger they will just correctly assume you are an intruder and try to kill you...which they probably have been doing anyways.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_4d8102d5", "up_for_danger"}, -- In an odd sort of way, that makes sense. Ok, I will do it.
{"@conversation/death_watch_foreman:s_a618b93a", "clean_when_can"}, -- No thanks, I think I will avoid the workshop if it is monitored.
}
}
deathWatchForemanConvoTemplate:addScreen(would_love_to);
up_for_danger = ConvoScreen:new {
id = "up_for_danger",
leftDialog = "@conversation/death_watch_foreman:s_787e689e", -- I figured you would be up for that whole danger thing. Once the treadwell has cleaned the battery, come on back to me so we can get that battery installed back into the drill.
stopConversation = "true",
options = {}
}
deathWatchForemanConvoTemplate:addScreen(up_for_danger);
return_battery_not_clean = ConvoScreen:new {
id = "return_battery_not_clean",
leftDialog = "@conversation/death_watch_foreman:s_7b9dc7c7", -- Have you managed to get that battery cleaned yet?
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_145fd34", "speak_to_treadwell"}, -- Not yet, but I will get this battery cleaned soon.
{"@conversation/death_watch_foreman:s_54ee97f2", "clean_when_can"}, -- I don't really have time to deal with this right now.
}
}
deathWatchForemanConvoTemplate:addScreen(return_battery_not_clean);
return_battery_cleaned_killed_haldo = ConvoScreen:new {
id = "return_battery_cleaned_killed_haldo",
leftDialog = "@conversation/death_watch_foreman:s_f46d76f6", -- Hey you are back. I was sort of half expecting you not to return. Oh yeah, this is excellent. The battery is clean and ready to be installed in the drill. And you didn't destroy the treadwell...thats a plus. Unfortunately there is one other issue that we are having.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_44bb7cbc", "uses_liquid_coolant"}, -- What is the other problem with the drill?
}
}
deathWatchForemanConvoTemplate:addScreen(return_battery_cleaned_killed_haldo);
return_battery_cleaned_no_haldo_kill = ConvoScreen:new {
id = "return_battery_cleaned_no_haldo_kill",
leftDialog = "@conversation/death_watch_foreman:s_dd7c0dd3", -- Hey, you're back. I was sort of half expecting you not to return. Oh yeah, this is excellent. The battery is clean and ready to be installed in the drill. Unfortunately there is one other issue that we are having.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_44bb7cbc", "uses_liquid_coolant"}, -- What is the other problem with the drill?
}
}
deathWatchForemanConvoTemplate:addScreen(return_battery_cleaned_no_haldo_kill);
uses_liquid_coolant = ConvoScreen:new {
id = "uses_liquid_coolant",
leftDialog = "@conversation/death_watch_foreman:s_286d283f", -- The drill uses a liquid coolant system in order to keep it from overheating and exploding. Well the problem is that we are not getting any pressure down here so if we turn on the drill...BOOM!
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_83d1549d", "pump_room_upstairs"}, -- What do you need in order to get water pressure down here?
{"@conversation/death_watch_foreman:s_b491aba5", "old_technology"}, -- You are still using liquid coolant for you laser drill?
}
}
deathWatchForemanConvoTemplate:addScreen(uses_liquid_coolant);
old_technology = ConvoScreen:new {
id = "old_technology",
leftDialog = "@conversation/death_watch_foreman:s_8deeb761", -- It's old technology. The Mandalorians don't exactly splurge on mining equipment. In fact if you havn't noticed already nothing around here is exactly in tip top shape.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_83d1549d", "pump_room_upstairs"}, -- What do you need in order to get water pressure down here?
}
}
deathWatchForemanConvoTemplate:addScreen(old_technology);
pump_room_upstairs = ConvoScreen:new {
id = "pump_room_upstairs",
leftDialog = "@conversation/death_watch_foreman:s_e5e9e886", -- Upstairs there is a pump room. There are four pumps that all need to be on in order to get the water down to us. Unfortunately the circuit breakers on those things are all ancient and trip at the slightest surge. If you could maybe go up there and turn them all on for us I know we could get underway.
stopConversation = "false",
options = {
-- Handled by convo handler
--{"@conversation/death_watch_foreman:s_d4b1da9f", "tricky_pumps_haldo_kill"}, -- Ok fine I will do this for you but you are going to owe me.
--{"@conversation/death_watch_foreman:s_d4b1da9f", "tricky_pumps_no_haldo_kill"}, -- Ok fine I will do this for you but you are going to owe me.
--{"@conversation/death_watch_foreman:s_3055077f", "choice_is_yours"}, -- I don't really have time for this right now, sorry.
}
}
deathWatchForemanConvoTemplate:addScreen(pump_room_upstairs);
choice_is_yours = ConvoScreen:new {
id = "choice_is_yours",
leftDialog = "@conversation/death_watch_foreman:s_23cbff5d", -- Choice is yours. We will figure out some other way to get them online I suppose.
stopConversation = "true",
options = {}
}
deathWatchForemanConvoTemplate:addScreen(choice_is_yours);
tricky_pumps_haldo_kill = ConvoScreen:new {
id = "tricky_pumps_haldo_kill",
leftDialog = "@conversation/death_watch_foreman:s_8405256c", -- Deal. Now listen those pumps can be tricky. Generally when you trip one of the valves it causes the one or ones next to it on the circuit to flip as well. You will have to play with it for a while in order to get them all online. There isn't much time...oh yeah, and try not to destroy the pumps while you are at it.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_9bea7011", "come_back_after_pumps"}, -- Ok, cool your jets. I am on it.
}
}
deathWatchForemanConvoTemplate:addScreen(tricky_pumps_haldo_kill);
tricky_pumps_no_haldo_kill = ConvoScreen:new {
id = "tricky_pumps_no_haldo_kill",
leftDialog = "@conversation/death_watch_foreman:s_262e7b86", -- Deal. Now listen those pumps can be tricky. Generally when you trip one of the valves it causes the one or ones next to it on the circuit to flip as well. You will have to play with it for a while in order to get them all online. Also we really don't have a lot of time so if you are not back soon I am going to have to see if there is anything else I can do to get it on.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_9bea7011", "come_back_after_pumps"}, -- Ok, cool your jets. I am on it.
}
}
deathWatchForemanConvoTemplate:addScreen(tricky_pumps_no_haldo_kill);
come_back_after_pumps = ConvoScreen:new {
id = "come_back_after_pumps",
leftDialog = "@conversation/death_watch_foreman:s_6864fcd4", -- Good. Once you get those pumps back online come on back and we will discuss what I owe you.
stopConversation = "true",
options = {}
}
deathWatchForemanConvoTemplate:addScreen(come_back_after_pumps);
try_pump_again = ConvoScreen:new {
id = "try_pump_again",
leftDialog = "@conversation/death_watch_foreman:s_4af1601a", -- So you are back? We still don't have any water pressure down here maybe you would like to head back up and try again?
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_e55f453d", "remember_tricky_pumps"}, -- Yes, I will give it another shot.
{"@conversation/death_watch_foreman:s_b99aaac2", "choice_is_yours"}, -- No thanks, I can't figure out how to get those pumps to work.
}
}
deathWatchForemanConvoTemplate:addScreen(try_pump_again);
remember_tricky_pumps = ConvoScreen:new {
id = "remember_tricky_pumps",
leftDialog = "@conversation/death_watch_foreman:s_6b8a415c", -- Remember those pumps can be tricky. Generally when you trip one of the valves it causes the one or ones next to it on the circuit to flip as well. You will have to play with it for a while in order to get them all online.
stopConversation = "true",
options = {}
}
deathWatchForemanConvoTemplate:addScreen(remember_tricky_pumps);
pump_timer_running = ConvoScreen:new {
id = "pump_timer_running",
leftDialog = "@conversation/death_watch_foreman:s_de4a182e", -- What are you doing back here. We still don't have any water pressure down here. I am telling you that we don't have very much time left.
stopConversation = "true",
options = {}
}
deathWatchForemanConvoTemplate:addScreen(pump_timer_running);
pump_success_haldo_kill = ConvoScreen:new {
id = "pump_success_haldo_kill",
leftDialog = "@conversation/death_watch_foreman:s_1b208070", -- Hey you managed to get all of the pumps online and to my knowledge didn't destroy all of them in the process. That is surprising considering your track record for violence. Well a deal is a deal so tell you what I will get you some of this ore that we are mining.
stopConversation = "false",
options = {
-- Handled by convo handler
--{"@conversation/death_watch_foreman:s_c04f0d0d", "ore_inv_full"}, -- I risked my life for some ore?
--{"@conversation/death_watch_foreman:s_c04f0d0d", "used_in_armor"}, -- I risked my life for some ore?
}
}
deathWatchForemanConvoTemplate:addScreen(pump_success_haldo_kill);
pump_success_no_haldo_kill = ConvoScreen:new {
id = "pump_success_no_haldo_kill",
leftDialog = "@conversation/death_watch_foreman:s_c1dc6296", -- I don't know how you managed to get those pumps working without the Mandalorians taking you out. You must be a lot tougher then you look. I can't thank you enough for all your help.
stopConversation = "false",
options = {
-- Handled by convo handler
--{"@conversation/death_watch_foreman:s_5597accd", "ore_inv_full"}, -- How about a reward?
--{"@conversation/death_watch_foreman:s_5597accd", "sneak_some_ore"}, -- How about a reward?
}
}
deathWatchForemanConvoTemplate:addScreen(pump_success_no_haldo_kill);
ore_inv_full = ConvoScreen:new {
id = "ore_inv_full",
leftDialog = "@conversation/death_watch_foreman:s_52f3e83e", -- This is the same ore that the Mandalores use to make their armor. I am willing to sneak you some but you are going to need to make some room in your inventory so I can.
stopConversation = "true",
options = {}
}
deathWatchForemanConvoTemplate:addScreen(ore_inv_full);
used_in_armor = ConvoScreen:new {
id = "used_in_armor",
leftDialog = "@conversation/death_watch_foreman:s_95879f15", -- Hey it is not just any ore. This is the stuff that the Mandalorians use in their armor. They keep a pretty careful track of what we mine but I know that I can sneak you some of this stuff without them noticing it.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_ed0d4e5a", "ore_reward"}, -- You make Mandalorian armor out of this ore?
}
}
deathWatchForemanConvoTemplate:addScreen(used_in_armor);
sneak_some_ore = ConvoScreen:new {
id = "sneak_some_ore",
leftDialog = "@conversation/death_watch_foreman:s_b4feb773", -- We don't really have a whole lot to give but I will tell you what. I can sneak you some of this ore that we are mining. Now before you get all mad about just getting ore let me tell you that this is the stuff that the Mandalores use in their armor.
stopConversation = "false",
options = {
{"@conversation/death_watch_foreman:s_ed0d4e5a", "ore_reward"}, -- You make Mandalorian armor out of this ore?
}
}
deathWatchForemanConvoTemplate:addScreen(sneak_some_ore);
ore_reward = ConvoScreen:new {
id = "ore_reward",
leftDialog = "@conversation/death_watch_foreman:s_18426338", -- Hey all I know is that this stuff is used in the making of the armor. They keep a pretty tight watch on how much of this stuff we mine, but I know I can sneak you some every now and again. Here you go. If you check back with me occasionally, I should be able to sneak you out some more. Not too often mind you, but I will do my best.
stopConversation = "true",
options = {}
}
deathWatchForemanConvoTemplate:addScreen(ore_reward);
more_ore = ConvoScreen:new {
id = "more_ore",
leftDialog = "@conversation/death_watch_foreman:s_e1dd8e6e", -- Good to see you again my friend. I was able to secure some more of this ore for you. If you need some more check back with me later and maybe I can sneak some more out under the noses of the Mandalorians.
stopConversation = "true",
options = {}
}
deathWatchForemanConvoTemplate:addScreen(more_ore);
no_ore_yet = ConvoScreen:new {
id = "no_ore_yet",
leftDialog = "@conversation/death_watch_foreman:s_1d1d45a9", -- Hey it is you again. Glad to still you are still breathing. If you have come looking for ore I am sorry but I can't sneak you out any right now. The Mandalorians are running inventory right now and will notice anything that is missing. Check back with me later.
stopConversation = "true",
options = {}
}
deathWatchForemanConvoTemplate:addScreen(no_ore_yet);
more_ore_inv_full = ConvoScreen:new {
id = "more_ore_inv_full",
leftDialog = "@conversation/death_watch_foreman:s_5af847c7", -- You are going to have to clear out some inventory space in order for me to give you any more of this ore.
stopConversation = "true",
options = {}
}
deathWatchForemanConvoTemplate:addScreen(more_ore_inv_full);
addConversationTemplate("deathWatchForemanConvoTemplate", deathWatchForemanConvoTemplate);
|
-- /*
-- /*
-- Copyright (c) 2022, The Pallene Developers
-- Pallene is licensed under the MIT license.
-- Please refer to the LICENSE and AUTHORS files for details
-- SPDX-License-Identifier: MIT
-- */
-- /*
-- PALLENE RUNTIME LIBRARY
-- =======================
-- This is the Pallene C library, inside a Lua string. If you are wondering why, it is
-- to make it easier to install with Luarocks. I didn't want to add a dependency to
-- https://github.com/hishamhm/datafile just for this.
--
-- We copy paste this library at the start of every Pallene module, effectively statically linking
-- it. This is necessary for some of the functions and macros, which are designed to be inlined
-- and therefore must be defined in the same translation unit. It is a bit wasteful for the
-- non-inline functions though. We considered putting them in a separate library but it's less than
-- 10 KB so we decided that it wasn't worth the extra complexity.
--
-- 1. One option we tried in the past was to bundle the Pallene library into the custom Lua
-- interpreter. We moved away from that because of the inconvenience of having to recompile and
-- reinstall Lua every time the Pallene lib changed.
--
-- 2. Another option we considered was packaging it as a regular shared library. The main problem is
-- that Luarocks doesn't have a clean way to install shared libraries into /usr/lib. That means that
-- we would need to install it to a non-standard place and pass appropriate -L flags when compiling
-- a pallene module.
--
-- 3. A third option would be to package it as a Lua extension module, putting the functions inside
-- an userdata struct and telling Pallene to fetch them using "require". This would play nice with
-- Luarocks but would introduce additional complexity to implement that userdata workaround.
-- */
return [==[
#define LUA_CORE
#include <lua.h>
#include <lauxlib.h>
#include <luacore.h>
#include <string.h>
#include <stdarg.h>
#include <locale.h>
#include <math.h>
#define PALLENE_UNREACHABLE __builtin_unreachable()
/* Type tags */
static const char *pallene_tag_name(int raw_tag);
static int pallene_is_truthy(const TValue *v);
static int pallene_is_record(const TValue *v, const TValue *meta_table);
static int pallene_bvalue(TValue *obj);
static void pallene_setbvalue(TValue *obj, int b);
/* Garbage Collection */
static void pallene_barrierback_unboxed(lua_State *L, GCObject *p, GCObject *v);
/* Runtime errors */
static l_noret pallene_runtime_tag_check_error(lua_State *L, const char* file, int line, int expected_tag, int received_tag,const char *description_fmt, ...);
static l_noret pallene_runtime_arity_error(lua_State *L, const char *name, int expected, int received);
static l_noret pallene_runtime_divide_by_zero_error(lua_State *L, const char* file, int line);
static l_noret pallene_runtime_mod_by_zero_error(lua_State *L, const char* file, int line);
static l_noret pallene_runtime_number_to_integer_error(lua_State *L, const char* file, int line);
static l_noret pallene_runtime_array_metatable_error(lua_State *L, const char* file, int line);
/* Arithmetic operators */
static lua_Integer pallene_int_divi(lua_State *L, lua_Integer m, lua_Integer n, const char* file, int line);
static lua_Integer pallene_int_modi(lua_State *L, lua_Integer m, lua_Integer n, const char* file, int line);
static lua_Integer pallene_shiftL(lua_Integer x, lua_Integer y);
static lua_Integer pallene_shiftR(lua_Integer x, lua_Integer y);
/* String operators */
static TString *pallene_string_concatN(lua_State *L, size_t n, TString **ss);
/* Table operators */
static Table *pallene_createtable(lua_State *L, lua_Integer narray, lua_Integer nrec);
static void pallene_grow_array(lua_State *L, const char* file, int line, Table *arr, unsigned int ui);
static void pallene_renormalize_array(lua_State *L,Table *arr, lua_Integer i, const char* file, int line);
static TValue *pallene_getshortstr(Table *t, TString *key, int *restrict cache);
static TValue *pallene_getstr(size_t len, Table *t, TString *key, int *cache);
/* Math builtins */
static lua_Integer pallene_checked_float_to_int(lua_State *L, const char* file, int line, lua_Number d);
static lua_Integer pallene_math_ceil(lua_State *L, const char* file, int line, lua_Number n);
static lua_Integer pallene_math_floor(lua_State *L, const char* file, int line, lua_Number n);
static lua_Number pallene_math_log(lua_Integer x, lua_Integer base);
static lua_Integer pallene_math_modf(lua_State *L, const char* file, int line, lua_Number n, lua_Number* out);
/* Other builtins */
static TString* pallene_string_char(lua_State *L, const char* file, int line, lua_Integer c);
static TString* pallene_string_sub(lua_State *L, TString *str, lua_Integer start, lua_Integer end);
static TString *pallene_type_builtin(lua_State *L, TValue v);
static TString *pallene_tostring(lua_State *L, const char* file, int line, TValue v);
static void pallene_io_write(lua_State *L, TString *str);
static const char *pallene_tag_name(int raw_tag)
{
if (raw_tag == LUA_VNUMINT) {
return "integer";
} else if (raw_tag == LUA_VNUMFLT) {
return "float";
} else {
return ttypename(novariant(raw_tag));
}
}
static int pallene_is_truthy(const TValue *v)
{
return !l_isfalse(v);
}
static int pallene_is_record(const TValue *v, const TValue *meta_table)
{
return ttisfulluserdata(v) && uvalue(v)->metatable == hvalue(meta_table);
}
/* Starting with Lua 5.4-rc1, Lua the boolean type now has two variants, LUA_VTRUE and LUA_VFALSE.
* The value of the boolean is encoded in the type tag instead of in the `Value` union. */
static int pallene_bvalue(TValue *obj)
{
return ttistrue(obj);
}
static void pallene_setbvalue(TValue *obj, int b)
{
if (b) {
setbtvalue(obj);
} else {
setbfvalue(obj);
}
}
/* We must call a GC write barrier whenever we set "v" as an element of "p", in order to preserve
* the color invariants of the incremental GC. This function is a specialization of luaC_barrierback
* for when we already know the type of the child object and have an untagged pointer to it. */
static void pallene_barrierback_unboxed(lua_State *L, GCObject *p, GCObject *v)
{
if (isblack(p) && iswhite(v)) {
luaC_barrierback_(L, p);
}
}
static void pallene_runtime_tag_check_error(
lua_State *L,
const char* file,
int line,
int expected_tag,
int received_tag,
const char *description_fmt,
...
){
const char *expected_type = pallene_tag_name(expected_tag);
const char *received_type = pallene_tag_name(received_tag);
/* This code is inspired by luaL_error */
luaL_where(L, 1);
if (line > 0) {
lua_pushfstring(L, "file %s: line %d: ", file, line);
} else {
lua_pushfstring(L, "");
}
lua_pushfstring(L, "wrong type for ");
{
va_list argp;
va_start(argp, description_fmt);
lua_pushvfstring(L, description_fmt, argp);
va_end(argp);
}
lua_pushfstring(L, ", expected %s but found %s",
expected_type, received_type);
lua_concat(L, 5);
lua_error(L);
PALLENE_UNREACHABLE;
}
static void pallene_runtime_arity_error(lua_State *L, const char *name, int expected, int received)
{
luaL_error(L,
"wrong number of arguments to function '%s', expected %d but received %d",
name, expected, received
);
PALLENE_UNREACHABLE;
}
static void pallene_runtime_divide_by_zero_error(lua_State *L, const char* file, int line)
{
luaL_error(L, "file %s: line %d: attempt to divide by zero", file, line);
PALLENE_UNREACHABLE;
}
static void pallene_runtime_mod_by_zero_error(lua_State *L, const char* file, int line)
{
luaL_error(L, "file %s: line %d: attempt to perform 'n%%0'", file, line);
PALLENE_UNREACHABLE;
}
static void pallene_runtime_number_to_integer_error(lua_State *L, const char* file, int line)
{
luaL_error(L, "file %s: line %d: conversion from float does not fit into integer", file, line);
PALLENE_UNREACHABLE;
}
static void pallene_runtime_array_metatable_error(lua_State *L, const char* file, int line)
{
luaL_error(L, "file %s: line %d: arrays in Pallene must not have a metatable", file, line);
PALLENE_UNREACHABLE;
}
/* Lua and Pallene round integer division towards negative infinity, while C rounds towards zero.
* Here we inline luaV_div, to allow the C compiler to constant-propagate. For an explanation of the
* algorithm, see the comments for luaV_div. */
static lua_Integer pallene_int_divi(
lua_State *L,
lua_Integer m, lua_Integer n,
const char* file, int line)
{
if (l_castS2U(n) + 1u <= 1u) {
if (n == 0){
pallene_runtime_divide_by_zero_error(L, file, line);
} else {
return intop(-, 0, m);
}
} else {
lua_Integer q = m / n;
if ((m ^ n) < 0 && (m % n) != 0) {
q -= 1;
}
return q;
}
}
/* Lua and Pallene guarantee that (m == n*(m//n) + (m%n))
* For details, see gen_int_div, luaV_div, and luaV_mod. */
static lua_Integer pallene_int_modi(
lua_State *L,
lua_Integer m, lua_Integer n,
const char* file, int line)
{
if (l_castS2U(n) + 1u <= 1u) {
if (n == 0){
pallene_runtime_mod_by_zero_error(L, file, line);
} else {
return 0;
}
} else {
lua_Integer r = m % n;
if (r != 0 && (m ^ n) < 0) {
r += n;
}
return r;
}
}
/* In C, there is undefined behavior if the shift amount is negative or is larger than the integer
* width. On the other hand, Lua and Pallene specify the behavior in these cases (negative means
* shift in the opposite direction, and large shifts saturate at zero).
*
* Most of the time, the shift amount is a compile-time constant, in which case the C compiler
* should be able to simplify this down to a single shift instruction. In the dynamic case with
* unknown "y" this implementation is a little bit faster Lua because we put the most common case
* under a single level of branching. (~20% speedup) */
#define PALLENE_NBITS (sizeof(lua_Integer) * CHAR_BIT)
static lua_Integer pallene_shiftL(lua_Integer x, lua_Integer y)
{
if (l_likely(l_castS2U(y) < PALLENE_NBITS)) {
return intop(<<, x, y);
} else {
if (l_castS2U(-y) < PALLENE_NBITS) {
return intop(>>, x, -y);
} else {
return 0;
}
}
}
static lua_Integer pallene_shiftR(lua_Integer x, lua_Integer y)
{
if (l_likely(l_castS2U(y) < PALLENE_NBITS)) {
return intop(>>, x, y);
} else {
if (l_castS2U(-y) < PALLENE_NBITS) {
return intop(<<, x, -y);
} else {
return 0;
}
}
}
static void copy_strings_to_buffer(char *out_buf, size_t n, TString **ss)
{
char *b = out_buf;
for (size_t i = 0; i < n; i ++) {
size_t l = tsslen(ss[i]);
memcpy(b, getstr(ss[i]), l);
b += l;
}
}
static TString *pallene_string_concatN(lua_State *L, size_t n, TString **ss)
{
size_t out_len = 0;
for (size_t i = 0; i < n; i++) {
size_t l = tsslen(ss[i]);
if (l_unlikely(l >= (MAX_SIZE/sizeof(char)) - out_len)) {
luaL_error(L, "string length overflow");
}
out_len += l;
}
if (out_len <= LUAI_MAXSHORTLEN) {
char buff[LUAI_MAXSHORTLEN];
copy_strings_to_buffer(buff, n, ss);
return luaS_newlstr(L, buff, out_len);
} else {
TString *out_str = luaS_createlngstrobj(L, out_len);
char *buff = getstr(out_str);
copy_strings_to_buffer(buff, n, ss);
return out_str;
}
}
/* These definitions are from ltable.c */
#define MAXABITS cast_int(sizeof(int) * CHAR_BIT - 1)
#define MAXASIZE luaM_limitN(1u << MAXABITS, TValue)
/* This version of lua_createtable bypasses the Lua stack, and can be inlined and optimized when the
* allocation size is known at compilation time. */
static Table *pallene_createtable(lua_State *L, lua_Integer narray, lua_Integer nrec)
{
Table *t = luaH_new(L);
if (narray > 0 || nrec > 0) {
luaH_resize(L, t, narray, nrec);
}
return t;
}
/* Grows the table so that it can fit index "i"
* Our strategy is to grow to the next available power of 2. */
static void pallene_grow_array(lua_State *L, const char* file, int line, Table *arr, unsigned ui)
{
if (ui >= MAXASIZE) {
luaL_error(L, "file %s: line %d: invalid index for Pallene array", file, line);
}
/* This loop doesn't overflow because i < MAXASIZE and MAXASIZE is a power of two */
size_t new_size = 1;
while (ui >= new_size) {
new_size *= 2;
}
luaH_resizearray(L, arr, new_size);
}
/* When reading and writing to a Pallene array, we force everything to fit inside the array part of
* the table. The optimizer and branch predictor prefer when it is this way. */
static void pallene_renormalize_array(
lua_State *L,
Table *arr, lua_Integer i,
const char* file,int line
){
lua_Unsigned ui = (lua_Unsigned) i - 1;
if (l_unlikely(ui >= arr->alimit)) {
pallene_grow_array(L, file, line, arr, ui);
}
}
/* These specializations of luaH_getstr and luaH_getshortstr introduce two optimizations:
* - After inlining, the length of the string is a compile-time constant
* - getshortstr's table lookup uses an inline cache. */
static const TValue PALLENE_ABSENTKEY = {ABSTKEYCONSTANT};
static TValue *pallene_getshortstr(Table *t, TString *key, int *restrict cache)
{
if (0 <= *cache && *cache < sizenode(t)) {
Node *n = gnode(t, *cache);
if (keyisshrstr(n) && eqshrstr(keystrval(n), key))
return gval(n);
}
Node *n = gnode(t, lmod(key->hash, sizenode(t)));
for (;;) {
if (keyisshrstr(n) && eqshrstr(keystrval(n), key)) {
*cache = n - gnode(t, 0);
return gval(n);
}
else {
int nx = gnext(n);
if (nx == 0) {
/* It is slightly better to have an invalid cache when we don't expect the cache to
* hit. The code will be faster because getstr will jump straight to the key search
* instead of trying to access a cache that we expect to be a miss. */
*cache = UINT_MAX;
return (TValue *)&PALLENE_ABSENTKEY; /* not found */
}
n += nx;
}
}
}
static TValue *pallene_getstr(size_t len, Table *t, TString *key, int *cache)
{
if (len <= LUAI_MAXSHORTLEN) {
return pallene_getshortstr(t, key, cache);
} else {
return cast(TValue *, luaH_getstr(t, key));
}
}
/* Some Lua math functions return integer if the result fits in integer, or float if it doesn't.
* In Pallene, we can't return different types, so we instead raise an error if it doesn't fit
* See also: pushnumint in lmathlib */
static lua_Integer pallene_checked_float_to_int(
lua_State *L, const char* file, int line, lua_Number d)
{
lua_Integer n;
if (lua_numbertointeger(d, &n)) {
return n;
} else {
pallene_runtime_number_to_integer_error(L, file, line);
}
}
static lua_Integer pallene_math_ceil(lua_State *L, const char* file, int line, lua_Number n)
{
lua_Number d = l_mathop(ceil)(n);
return pallene_checked_float_to_int(L, file, line, d);
}
static lua_Integer pallene_math_floor(lua_State *L, const char* file, int line, lua_Number n)
{
lua_Number d = l_mathop(floor)(n);
return pallene_checked_float_to_int(L, file, line, d);
}
/* Based on math_log from lmathlib.c
* The C compiler should be able to get rid of the if statement if this function is inlined
* and the base parameter is a compile-time constant */
static lua_Number pallene_math_log(lua_Integer x, lua_Integer base)
{
if (base == l_mathop(10.0)) {
return l_mathop(log10)(x);
#if !defined(LUA_USE_C89)
} else if (base == l_mathop(2.0)) {
return l_mathop(log2)(x);
#endif
} else {
return l_mathop(log)(x)/l_mathop(log)(base);
}
}
static lua_Integer pallene_math_modf(
lua_State *L, const char* file, int line, lua_Number n, lua_Number* out)
{
/* integer part (rounds toward zero) */
lua_Number ip = (n < 0) ? l_mathop(ceil)(n) : l_mathop(floor)(n);
/* fractional part (test needed for inf/-inf) */
*out = (n == ip) ? l_mathop(0.0) : (n - ip);
return pallene_checked_float_to_int(L, file, line, ip);
}
static TString* pallene_string_char(lua_State *L, const char* file, int line, lua_Integer c)
{
if (l_castS2U(c) > UCHAR_MAX) {
luaL_error(L, "file %s: line %d: char value out of range", file, line);
}
char buff[2];
buff[0] = c;
buff[1] = '\0';
return luaS_newlstr(L, buff, 1);
}
/* Translate a relative initial string position. (Negative means back from end)
* Clip result to [1, inf). See posrelatI() in lstrlib.c
*/
static size_t get_start_pos(lua_Integer pos, size_t len)
{
if (pos > 0) {
return (size_t)pos;
} else if (pos == 0) {
return 1;
} else if (pos < -(lua_Integer)len) {
return 1;
} else {
return len + (size_t)pos + 1;
}
}
/* Clip i between [0, len]. Negative means back from end.
* See getendpos() in lstrlib.c */
static size_t get_end_pos(lua_Integer pos, size_t len)
{
if (pos > (lua_Integer)len) {
return len;
} else if (pos >= 0) {
return (size_t)pos;
} else if (pos < -(lua_Integer)len) {
return 0;
} else {
return len + (size_t)pos + 1;
}
}
static TString* pallene_string_sub(
lua_State *L, TString *str, lua_Integer istart, lua_Integer iend)
{
const char *s = getstr(str);
size_t len = tsslen(str);
size_t start = get_start_pos(istart, len);
size_t end = get_end_pos(iend, len);
if (start <= end) {
return luaS_newlstr(L, s + start - 1, (end - start) + 1);
} else {
return luaS_new(L, "");
}
}
static TString *pallene_type_builtin(lua_State *L, TValue v) {
return luaS_new(L, lua_typename(L, ttype(&v)));
}
/* Based on function luaL_tolstring */
static TString *pallene_tostring(lua_State *L, const char* file, int line, TValue v) {
#define MAXNUMBER2STR 50
int len;
char buff[MAXNUMBER2STR];
switch (ttype(&v)) {
case LUA_TNUMBER: {
if (ttisinteger(&v)) {
len = lua_integer2str(buff, MAXNUMBER2STR, ivalue(&v));
} else {
len = lua_number2str(buff, MAXNUMBER2STR, fltvalue(&v));
if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */
buff[len++] = lua_getlocaledecpoint();
buff[len++] = '0'; /* adds '.0' to result */
}
}
return luaS_newlstr(L, buff, len);
}
case LUA_TSTRING:
return luaS_new(L, svalue(&v));
case LUA_TBOOLEAN:
return luaS_new(L, ((pallene_is_truthy(&v)) ? "true" : "false"));
default: {
luaL_error(L, "file %s: line %d: tostring called with unsuported type '%s'", file, line,
lua_typename(L, ttype(&v)));
PALLENE_UNREACHABLE;
}
}
}
/* A version of io.write specialized to a single string argument */
static void pallene_io_write(lua_State *L, TString *str)
{
(void) L; /* unused parameter */
const char *s = getstr(str);
size_t len = tsslen(str);
fwrite(s, 1, len, stdout);
}
/* To avoid looping infinitely due to integer overflow, lua 5.4 carefully computes the number of
* iterations before starting the loop (see op_forprep). the code that implements this behavior does
* not look like a regular c for loop, so to help improve the readability of the generated c code we
* hide it behind the following set of macros. note that some of the open braces in the begin macro
* are only closed in the end macro, so they must always be used together. we assume that the c
* compiler will be able to optimize the common case where the step parameter is a compile-time
* constant. */
#define PALLENE_INT_FOR_LOOP_BEGIN(i, A, B, C) \
{ \
lua_Integer _init = A; \
lua_Integer _limit = B; \
lua_Integer _step = C; \
if (_step == 0 ) { \
luaL_error(L, "'for' step is zero"); \
} \
if (_step > 0 ? (_init <= _limit) : (_init >= _limit)) { \
lua_Unsigned _uinit = l_castS2U(_init); \
lua_Unsigned _ulimit = l_castS2U(_limit); \
lua_Unsigned _count = ( _step > 0 \
? (_ulimit - _uinit) / _step \
: (_uinit - _ulimit) / (l_castS2U(-(_step + 1)) + 1u)); \
lua_Integer _loopvar = _init; \
while (1) { \
i = _loopvar; \
{
/* Loop body goes here*/
#define PALLENE_INT_FOR_LOOP_END \
} \
if (_count == 0) break; \
_loopvar += _step; \
_count -= 1; \
} \
} \
}
#define PALLENE_FLT_FOR_LOOP_BEGIN(i, A, B, C) \
{ \
lua_Number _init = A; \
lua_Number _limit = B; \
lua_Number _step = C; \
if (_step == 0.0) { \
luaL_error(L, "'for' step is zero"); \
} \
for ( \
lua_Number _loopvar = _init; \
(_step > 0.0 ? (_loopvar <= _limit) : (_loopvar >= _limit)); \
_loopvar += _step \
){ \
i = _loopvar;
/* Loop body goes here*/
#define PALLENE_FLT_FOR_LOOP_END \
} \
}
]==]
|
local liveyear = string.match(resolvers.prefixes.selfautoparent(),"(20%d%d)") or "2013"
return {
type = "configuration",
version = "1.1.2",
date = "2013-06-02",
time = "16:15:00",
comment = "TeX Live differences",
parent = "contextcnf.lua",
content = {
-- Keep in mind that MkIV is is relatively new and there is zero change that
-- (configuration) files will be found on older obsolete locations.
variables = {
-- This needs testing and if it works, then we can remove the texmflocal setting later on
--
-- TEXMFCNF = "{selfautodir:{/share,}/texmf-local/web2c,selfautoparent:{/share,}/texmf{-local,}/web2c}",
TEXMFCACHE = string.format("selfautoparent:texmf-var;~/.texlive%s/texmf-cache",liveyear),
TEXMFSYSTEM = "selfautoparent:$SELFAUTOSYSTEM",
TEXMFCONTEXT = "selfautoparent:texmf-dist",
-- TEXMFLOCAL = "selfautoparent:../texmf-local"), -- should also work
TEXMFLOCAL = string.gsub(resolvers.prefixes.selfautoparent(),"20%d%d$","texmf-local"),
TEXMFSYSCONFIG = "selfautoparent:texmf-config",
TEXMFSYSVAR = "selfautoparent:texmf-var",
TEXMFCONFIG = string.format("home:.texlive%s/texmf-config",liveyear),
TEXMFVAR = string.format("home:.texlive%s/texmf-var",liveyear),
-- We have only one cache path but there can be more. The first writable one
-- will be chosen but there can be more readable paths.
TEXMFCACHE = "$TEXMFSYSVAR;$TEXMFVAR",
TEXMF = "{$TEXMFCONFIG,$TEXMFHOME,!!$TEXMFSYSCONFIG,!!$TEXMFPROJECT,!!$TEXMFFONTS,!!$TEXMFLOCAL,!!$TEXMFCONTEXT,!!$TEXMFSYSTEM,!!$TEXMFDIST,!!$TEXMFMAIN}",
FONTCONFIG_PATH = "$TEXMFSYSVAR/fonts/conf",
},
},
}
|
wifi.setmode(wifi.STATION)
station_cfg={}
station_cfg.ssid="Summercamp_24"
station_cfg.pwd="iotsummercamp"
wifi.sta.config(station_cfg)
wifi.sta.autoconnect(1)
net.dns.setdnsserver('8.8.8.8', 0)
|
while true do
for i = 240, 320 do
gui.text(i, (i - 240) * 2, i);
end;
pcsx.frameadvance();
end;
|
-- Copyright � 2016 g0ld <g0ld@tuta.io>
-- This work is free. You can redistribute it and/or modify it under the
-- terms of the Do What The Fuck You Want To Public License, Version 2,
-- as published by Sam Hocevar. See the COPYING file for more details.
-- Quest: @Rympex
local sys = require "Libs/syslib"
local game = require "Libs/gamelib"
local Quest = require "Quests/Quest"
local name = 'Plain Badge Quest'
local description = 'Plain Badge'
local PlainBadgeQuest = Quest:new()
function PlainBadgeQuest:new()
return Quest.new(PlainBadgeQuest, name, description, level)
end
function PlainBadgeQuest:isDoable()
if self:hasMap() and not hasItem("Plain Badge") then
return true
end
return false
end
function PlainBadgeQuest:isDone()
if hasItem("Plain Badge") then
return true
else
return false
end
end
function PlainBadgeQuest:PokecenterGoldenrod()
self:pokecenter("Goldenrod City")
end
function PlainBadgeQuest:GoldenrodCity()
if self:needPokecenter() or not game.isTeamFullyHealed() or self.registeredPokecenter ~= "Pokecenter Goldenrod" then
sys.debug("quest", "Going to heal Pokemon.")
return moveToCell(64, 47)
elseif not hasItem("Plain Badge") then
sys.debug("quest", "Going to get 3rd badge.")
return moveToCell(75, 20)
else
sys.debug("quest", "Going to Route 35 Stop House")
return moveToCell(69, 11)
end
end
function PlainBadgeQuest:GoldenrodCityGym()
sys.debug("quest", "Going to fight Whitney for 2nd badge.")
return talkToNpcOnCell(10, 3)
end
return PlainBadgeQuest
|
includeFile("tangible/furniture/ep3_rewards/ep3_kash_reward_trophy_minstyngar.lua")
includeFile("tangible/furniture/ep3_rewards/sayormi_mobile.lua")
includeFile("tangible/furniture/ep3_rewards/hologram_stardestroyer_01.lua")
includeFile("tangible/furniture/ep3_rewards/ep3_kash_reward_trophy_mouf.lua")
includeFile("tangible/furniture/ep3_rewards/ep3_kash_reward_trophy_katarn.lua")
includeFile("tangible/furniture/ep3_rewards/wke_prayer_mobile.lua")
includeFile("tangible/furniture/ep3_rewards/ep3_kash_reward_trophy_bantha_kash.lua")
includeFile("tangible/furniture/ep3_rewards/hologram_insignia_rebel_01.lua")
includeFile("tangible/furniture/ep3_rewards/ep3_kash_reward_trophy_walluga.lua")
includeFile("tangible/furniture/ep3_rewards/wookiee_totem_crafter.lua")
includeFile("tangible/furniture/ep3_rewards/ep3_kash_reward_trophy_uller.lua")
includeFile("tangible/furniture/ep3_rewards/hologram_tiefighter_01.lua")
includeFile("tangible/furniture/ep3_rewards/wke_ceremonial_table.lua")
includeFile("tangible/furniture/ep3_rewards/wke_center_piece.lua")
includeFile("tangible/furniture/ep3_rewards/ep3_kash_reward_trophy_kkorrwrot.lua")
includeFile("tangible/furniture/ep3_rewards/ep3_kash_reward_trophy_bolotaur.lua")
includeFile("tangible/furniture/ep3_rewards/hologram_insignia_imperial_01.lua")
includeFile("tangible/furniture/ep3_rewards/ritual_fire_pit.lua")
includeFile("tangible/furniture/ep3_rewards/wke_windchime.lua")
includeFile("tangible/furniture/ep3_rewards/hologram_yt1300_01.lua")
includeFile("tangible/furniture/ep3_rewards/avatar_hologram_squid.lua")
includeFile("tangible/furniture/ep3_rewards/webweaver_blanket.lua")
includeFile("tangible/furniture/ep3_rewards/wookiee_totem_runner.lua")
includeFile("tangible/furniture/ep3_rewards/ep3_kash_reward_sordaan_hunting_trophy.lua")
includeFile("tangible/furniture/ep3_rewards/wke_ceremonial_chair.lua")
includeFile("tangible/furniture/ep3_rewards/ep3_kash_reward_trophy_webweaver.lua")
|
local AdBar = {}
function AdBar.new()
local sprite = display.newSprite("#AdBar.png")
sprite:align(display.BOTTOM_CENTER, display.cx, display.bottom)
return sprite
end
return AdBar
|
--[[
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
***************************************************************************
Copyright (c) 2018 @gt_tech
All rights reserved.
For further information please contact: https://bitbucket.org/gt_tech/
DISCLAIMER OF WARRANTIES:
THE SOFTWARE PROVIDED HEREUNDER IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
ANY WARRANTIES OR REPRESENTATIONS EXPRESS, IMPLIED OR STATUTORY; INCLUDING,
WITHOUT LIMITATION, WARRANTIES OF QUALITY, PERFORMANCE, NONINFRINGEMENT,
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. NOR ARE THERE ANY
WARRANTIES CREATED BY A COURSE OR DEALING, COURSE OF PERFORMANCE OR TRADE
USAGE. FURTHERMORE, THERE ARE NO WARRANTIES THAT THE SOFTWARE WILL MEET
YOUR NEEDS OR BE FREE FROM ERRORS, OR THAT THE OPERATION OF THE SOFTWARE
WILL BE UNINTERRUPTED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES 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.
@Author: https://bitbucket.org/gt_tech/
--]]
local BasePlugin = require "kong.plugins.base_plugin"
local JwksAwareJwtAccessTokenHandler = BasePlugin:extend()
local openidc = require("kong.plugins.jwt-oidc.resty-lib.openidc")
local az = require("kong.plugins.jwt-oidc.authorization")
local utils = require("kong.plugins.oidc.utils")
local filter = require("kong.plugins.oidc.filter")
local singletons = require "kong.singletons"
local cjson = require("cjson")
local get_method = ngx.req.get_method
local req_set_header = ngx.req.set_header
local req_clear_header = ngx.req.clear_header
local next = next
JwksAwareJwtAccessTokenHandler.PRIORITY = 1000
local function extract(config)
local jwt
local err
local header = ngx.req.get_headers()[config.token_header_name]
if header == nil then
err = "No token found using header: " .. config.token_header_name
ngx.log(ngx.ERR, err)
return nil, err
end
if header:find(" ") then
local divider = header:find(' ')
if string.lower(header:sub(0, divider-1)) == string.lower("Bearer") then
jwt = header:sub(divider+1)
if jwt == nil then
err = "No Bearer token value found from header: " .. config.token_header_name
ngx.log(ngx.ERR, err)
return nil, err
end
end
end
if jwt == nil then
jwt = header
end
ngx.log(ngx.DEBUG, "JWT token located using header: " .. config.token_header_name .. ", token length: " .. string.len(jwt))
return jwt, err
end
local function updateHeaders(config, token)
req_clear_header(config.token_header_name) -- Clear Original header from request
ngx.log(ngx.DEBUG, "Setting header: " .. config.upstream_jwt_header_name .. " with validated token")
req_set_header(config.upstream_jwt_header_name, token)
end
local function validateTokenContents(config, token, json)
-- if not config.auto_discover_issuer then
if config.expected_issuers and next(config.expected_issuers) ~= nil then
-- validate issuer
local validated_issuer = false
local issuer = json["iss"]
for i, e in ipairs(config.expected_issuers) do
if issuer ~= nil and issuer ~= '' and string.lower(e) == string.lower(issuer) then
validated_issuer = true
ngx.log(ngx.DEBUG, "Successfully validated issuer: " .. e)
break
end
end
if not validated_issuer then
-- issuer validation failed.
utils.exit(ngx.HTTP_UNAUTHORIZED, "Issuer not expected", ngx.HTTP_UNAUTHORIZED)
end
end
-- end
if config.accepted_audiences and next(config.accepted_audiences) ~= nil then
-- validate audience
local validated_audience = false
local audience = json["aud"]
for i, e in ipairs(config.accepted_audiences) do
if audience ~= nil and audience ~= '' and string.lower(e) == string.lower(audience) then
validated_audience = true
ngx.log(ngx.DEBUG, "Successfully validated audience: " .. e)
break
end
end
if not validated_audience then
-- audience validation failed.
utils.exit(ngx.HTTP_UNAUTHORIZED, "Audience not accepted", ngx.HTTP_UNAUTHORIZED)
end
end
end
local function load_consumer(consumer_id)
ngx.log(ngx.DEBUG, "JwksAwareJwtAccessTokenHandler Attempting to find consumer: " .. consumer_id)
local result, err = singletons.dao.consumers:find { id = consumer_id }
if not result then
err = "Consumer: " .. consumer_id .. " not found!"
ngx.log(ngx.ERR, err)
return nil, err
end
return result
end
function JwksAwareJwtAccessTokenHandler:new()
JwksAwareJwtAccessTokenHandler.super.new(self, "JwksAwareJwtAccessTokenHandler")
end
function JwksAwareJwtAccessTokenHandler:access(config)
JwksAwareJwtAccessTokenHandler.super.access(self)
if not config.run_on_preflight and get_method() == "OPTIONS" then
ngx.log(ngx.DEBUG, "JwksAwareJwtAccessTokenHandler pre-flight request ignored, path: " .. ngx.var.request_uri)
return
end
if ngx.ctx.authenticated_credential and config.anonymous ~= "" then
-- already authenticated likely by another auth plugin higher in priority.
return
end
if filter.shouldProcessRequest(config) then
handle(config)
else
ngx.log(ngx.DEBUG, "JwksAwareJwtAccessTokenHandler ignoring request, path: " .. ngx.var.request_uri)
end
ngx.log(ngx.DEBUG, "JwksAwareJwtAccessTokenHandler execution complete for request: " .. ngx.var.request_uri)
end
function handle(config)
local token, error = extract(config)
if token == null or error then
utils.exit(ngx.HTTP_UNAUTHORIZED, error, ngx.HTTP_UNAUTHORIZED)
else
local json, err = openidc.jwt_verify(token, config)
if token == null or err then
ngx.log(ngx.ERR, "JwksAwareJwtAccessTokenHandler - failed to validate access token")
utils.exit(ngx.HTTP_UNAUTHORIZED, err, ngx.HTTP_UNAUTHORIZED)
else
ngx.log(ngx.DEBUG, "JwksAwareJwtAccessTokenHandler - Successfully validated access token")
if config.ensure_consumer_present then
-- consumer presence is required
ngx.log(ngx.DEBUG, "Consumer presence is required")
local cid = json[config.consumer_claim_name]
if cid == nil or cid == '' then
-- consumer id claim not read
ngx.log(ngx.ERR, "Consumer ID could not be read using claim: " .. config.consumer_claim_name)
utils.exit(ngx.HTTP_UNAUTHORIZED, error, ngx.HTTP_UNAUTHORIZED)
else
ngx.log(ngx.DEBUG, "Consumer ID: " .. cid .. " read using claim: " .. config.consumer_claim_name)
local consumer, e = load_consumer(cid)
if consumer == null or e then
-- consumer can't be loaded from Kong
ngx.log(ngx.ERR, "Consumer ID could not be fetched for cid: " .. cid)
utils.exit(ngx.HTTP_UNAUTHORIZED, error, ngx.HTTP_UNAUTHORIZED)
else
-- consumer succesfully loaded from kong
ngx.ctx.authenticated_consumer = consumer
ngx.ctx.authenticated_credential = cid
req_set_header("X-Consumer-Username", cid)
updateHeaders(config, token)
validateTokenContents(config, token, json)
if config.enable_authorization_rules then
az.validate_authorization(config, json)
end
end
end
else
-- consumer presence is not required
updateHeaders(config, token)
validateTokenContents(config, token, json)
if config.enable_authorization_rules then
az.validate_authorization(config, json)
end
end
end
end
end
return JwksAwareJwtAccessTokenHandler
|
-- imported modules
local S = require 'settings'
local class = require 'engine.oop'
local map = require 'engine.map'
local Vec = require 'hump.vector'
-- class
local Camera = class('Camera')
Camera.Free_Offset = 1
function Camera:ctor()
self.pos = Vec(-1, -1)
self.rel = Vec(0, 0)
self.followedEnt = {}
end
function Camera:clone()
local copy = Camera:new()
copy.pos = self.pos:clone()
copy.rel = self.rel:clone()
copy.followedEnt = self.followedEnt
return copy
end
function Camera:lu()
return self.pos - self.rel
end
function Camera:follow(entity)
self.followedEnt = entity
local VIS_RADIUS = S.game.VIS_RADIUS
local e = entity
if e.pos.x <= (VIS_RADIUS - Camera.Free_Offset) then
self.rel.x = e.pos.x
elseif e.pos.x >= (map.width() - 1) - (VIS_RADIUS - Camera.Free_Offset) then
self.rel.x = e.pos.x + (2 * VIS_RADIUS + 1) - map.width()
else
self.rel.x = VIS_RADIUS
end
if e.pos.y <= (VIS_RADIUS - Camera.Free_Offset) then
self.rel.y = e.pos.y
elseif e.pos.y >= (map.height() - 1)-(VIS_RADIUS - Camera.Free_Offset) then
self.rel.y = e.pos.y + (2 * VIS_RADIUS + 1) - map.height()
else
self.rel.y = VIS_RADIUS
end
end
function Camera:isFollowing(ent)
return (ent == self.followedEnt)
end
function Camera:update()
local VIS_RADIUS = S.game.VIS_RADIUS
local e = self.followedEnt
if e.pos.x <= (VIS_RADIUS - Camera.Free_Offset) then
self.rel.x = e.pos.x
elseif e.pos.x >= (map.width()-1)-(VIS_RADIUS - Camera.Free_Offset) then
self.rel.x = e.pos.x + (2 * VIS_RADIUS + 1) - map.width()
else
if self.rel.x >= (VIS_RADIUS - Camera.Free_Offset) and self.rel.x <= (VIS_RADIUS+Camera.Free_Offset) then
if e.pos.x > self.pos.x then
if self.rel.x ~= (VIS_RADIUS + Camera.Free_Offset) then
self.rel.x = self.rel.x + 1
end
elseif e.pos.x < self.pos.x then
if self.rel.x ~= (VIS_RADIUS-Camera.Free_Offset) then
self.rel.x = self.rel.x - 1
end
end
end
end
if e.pos.y <= (VIS_RADIUS - Camera.Free_Offset) then
self.rel.y = e.pos.y
elseif e.pos.y >= (map.height() - 1)-(VIS_RADIUS - Camera.Free_Offset) then
self.rel.y = e.pos.y + (2 * VIS_RADIUS + 1) - map.height()
else
if self.rel.y >= (VIS_RADIUS - Camera.Free_Offset) and self.rel.y <= (VIS_RADIUS+Camera.Free_Offset) then
if e.pos.y > self.pos.y then
if self.rel.y ~= (VIS_RADIUS + Camera.Free_Offset) then
self.rel.y = self.rel.y + 1
end
elseif e.pos.y < self.pos.y then
if self.rel.y ~= (VIS_RADIUS-Camera.Free_Offset) then
self.rel.y = self.rel.y - 1
end
end
end
end
self.pos = e.pos:clone()
--print("> [lu, pos, rel] " .. tostring(self:lu()) .. tostring(self.pos) .. tostring(self.rel))
end
return Camera
|
--[[
This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:26' using the latest game version.
NOTE: This file should only be used as IDE support; it should NOT be distributed with addons!
****************************************************************************
CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC.
****************************************************************************
]]
ZO_GiftInventoryView_Gamepad = ZO_GiftInventoryView_Shared:Subclass()
function ZO_GiftInventoryView_Gamepad:New(...)
return ZO_GiftInventoryView_Shared.New(self, ...)
end
function ZO_GiftInventoryView_Gamepad:Initialize(control)
ZO_GiftInventoryView_Shared.Initialize(self, control, "giftInventoryViewGamepad")
ZO_GIFT_INVENTORY_VIEW_SCENE_GAMEPAD = self:GetScene()
SYSTEMS:RegisterGamepadObject("giftInventoryView", self)
local CLAIM_GIFT_KEYBIND = "UI_SHORTCUT_PRIMARY"
local PREVIEW_GIFT_KEYBIND = "UI_SHORTCUT_SECONDARY"
local DECLINE_GIFT_KEYBIND = "UI_SHORTCUT_RIGHT_STICK"
self:InitializeKeybinds(CLAIM_GIFT_KEYBIND, PREVIEW_GIFT_KEYBIND, DECLINE_GIFT_KEYBIND)
end
-- Begin ZO_GiftInventoryView_Shared Overrides --
function ZO_GiftInventoryView_Gamepad:InitializeControls()
ZO_GiftInventoryView_Shared.InitializeControls(self)
ZO_Scroll_Initialize_Gamepad(self.noteContainer)
local scrollIndicator = self.noteContainer:GetNamedChild("ScrollIndicator")
scrollIndicator:SetAnchor(CENTER, self.noteContainer, RIGHT, 0, 0, ANCHOR_CONSTRAINS_Y)
scrollIndicator:SetAnchor(CENTER, self.control, RIGHT, 0, 0, ANCHOR_CONSTRAINS_X)
scrollIndicator:SetDrawLayer(DL_OVERLAY)
self.overlayGlowControl:SetColor(ZO_OFF_WHITE:UnpackRGB())
end
function ZO_GiftInventoryView_Gamepad:InitializeParticleSystems()
ZO_GiftInventoryView_Shared.InitializeParticleSystems(self)
local blastParticleSystem = self.blastParticleSystem
blastParticleSystem:SetParticleParameter("PhysicsInitialVelocityMagnitude", ZO_UniformRangeGenerator:New(700, 1100))
blastParticleSystem:SetParticleParameter("Size", ZO_UniformRangeGenerator:New(6, 12))
blastParticleSystem:SetParticleParameter("PhysicsDragMultiplier", 1.5)
blastParticleSystem:SetParticleParameter("PrimeS", .5)
local headerSparksParticleSystem = self.headerSparksParticleSystem
headerSparksParticleSystem:SetParentControl(self.control:GetNamedChild("Header"))
headerSparksParticleSystem:SetParticleParameter("PhysicsInitialVelocityMagnitude", ZO_UniformRangeGenerator:New(15, 60))
headerSparksParticleSystem:SetParticleParameter("Size", ZO_UniformRangeGenerator:New(5, 10))
headerSparksParticleSystem:SetParticleParameter("DrawLayer", DL_OVERLAY)
headerSparksParticleSystem:SetParticleParameter("DrawLevel", 2)
local headerStarbustParticleSystem = self.headerStarbustParticleSystem
headerStarbustParticleSystem:SetParentControl(self.control:GetNamedChild("Header"))
headerStarbustParticleSystem:SetParticleParameter("Size", 256)
headerStarbustParticleSystem:SetParticleParameter("DrawLayer", DL_OVERLAY)
headerStarbustParticleSystem:SetParticleParameter("DrawLevel", 1)
end
function ZO_GiftInventoryView_Gamepad:InitializeKeybinds(...)
ZO_GiftInventoryView_Shared.InitializeKeybinds(self, ...)
table.insert(self.keybindStripDescriptor,
{
name = GetString(SI_GAMEPAD_GIFT_INVENTORY_VIEW_WINDOW_VIEW_TOOLTIP_KEYBIND),
keybind = "UI_SHORTCUT_LEFT_SHOULDER",
order = 1000,
handlesKeyUp = true,
callback = function(up)
if up then
GAMEPAD_TOOLTIPS:ClearTooltip(GAMEPAD_RIGHT_TOOLTIP)
else
GAMEPAD_TOOLTIPS:LayoutMarketProduct(GAMEPAD_RIGHT_TOOLTIP, self.gift:GetMarketProductId())
end
end,
})
ZO_Gamepad_AddBackNavigationKeybindDescriptors(self.keybindStripDescriptor, GAME_NAVIGATION_TYPE_BUTTON)
end
function ZO_GiftInventoryView_Gamepad:ShowClaimGiftDialog()
ZO_Dialogs_ShowGamepadDialog("CONFIRM_CLAIM_GIFT_GAMEPAD", { gift = self.gift })
end
function ZO_GiftInventoryView_Gamepad:ShowClaimGiftNoticeDialog(noticeText, helpCategoryIndex, helpIndex)
local dialogData =
{
gift = self.gift,
helpCategoryIndex = helpCategoryIndex,
helpIndex = helpIndex,
}
local textParams =
{
titleParams = { self.gift:GetName() },
mainTextParams = { noticeText },
}
ZO_Dialogs_ShowGamepadDialog("CLAIM_GIFT_NOTICE_GAMEPAD", dialogData, textParams)
end
function ZO_GiftInventoryView_Gamepad:DeclineGift()
if self:IsReceivedGift() then
ZO_Dialogs_ShowGamepadDialog("CONFIRM_RETURN_GIFT_GAMEPAD", { gift = self.gift })
else
ZO_Dialogs_ShowGamepadDialog("CONFIRM_DELETE_GIFT_GAMEPAD", { gift = self.gift })
end
end
function ZO_GiftInventoryView_Gamepad:GetItemPreviewListHelper()
return ITEM_PREVIEW_LIST_HELPER_GAMEPAD
end
-- End ZO_GiftInventoryView_Shared Overrides --
-- Begin Global XML Functions --
function ZO_GiftInventoryView_Gamepad_OnInitialized(control)
GIFT_INVENTORY_VIEW_GAMEPAD = ZO_GiftInventoryView_Gamepad:New(control)
end
-- End Global XML Functions --
|
function OpenPoliceArmory()
if not LocalPlayer():GetJob().AccessToArmory then
ClientsideNotify(Translate("pol_wep_arm_noaccess"))
return false
end
local window = CreateWindowFrame()
window:SetSize(300, 150)
window:SetTitle(Translate("pol_wep_arm_title"))
window:Center()
window:MakePopup()
local buttonSnip = CreateButtonAlt(window)
buttonSnip:SetSize(window:GetWide() - 10, 25)
buttonSnip:SetPos(5, 30)
buttonSnip:SetText(Translate("pol_wep_arm_get_snip"))
function buttonSnip:DoClick()
window:Close()
net.Start("VBNET::Jobs::Police::Armory::GetWeapon")
net.WriteInt(1, 8)
net.SendToServer()
end
local buttonRif = CreateButtonAlt(window)
buttonRif:SetSize(window:GetWide() - 10, 25)
buttonRif:SetPos(5, 60)
buttonRif:SetText(Translate("pol_wep_arm_get_rif"))
function buttonRif:DoClick()
window:Close()
net.Start("VBNET::Jobs::Police::Armory::GetWeapon")
net.WriteInt(2, 8)
net.SendToServer()
end
local buttonShot = CreateButtonAlt(window)
buttonShot:SetSize(window:GetWide() - 10, 25)
buttonShot:SetPos(5, 90)
buttonShot:SetText(Translate("pol_wep_arm_get_shot"))
function buttonShot:DoClick()
window:Close()
net.Start("VBNET::Jobs::Police::Armory::GetWeapon")
net.WriteInt(3, 8)
net.SendToServer()
end
local buttonRif2 = CreateButtonAlt(window)
buttonRif2:SetSize(window:GetWide() - 10, 25)
buttonRif2:SetPos(5, 120)
buttonRif2:SetText(Translate("pol_wep_arm_get_rif2"))
function buttonRif2:DoClick()
window:Close()
net.Start("VBNET::Jobs::Police::Armory::GetWeapon")
net.WriteInt(4, 8)
net.SendToServer()
end
end
|
Server.SetPetAI(
21, --the index of pet
function(pet,ai,event)
if(event == AI_INIT) then
ai.customData.timer = 1;
end
if(event == AI_UPDATE) then
--If you get 200 distance away, follow the master.
--If you get 400 distance away, teleport the master.
--ai.SetFollowMaster(true,200,400)
--If you do not have a target, follow the master.
if(ai.GetTargetUnit() == 1) then
ai.SetFollowMaster(true,200,400)
end
--basic 100,200
--ai.SetFollowMaster(true)
ai.SetNearTarget(2,200)
--Use skill if target of pet exists
--Skills are basically fired towards the target.
if(ai.GetTargetUnit() ~= 1) then
--Stop tracking when targets are set
ai.SetFollowMaster(false)
ai.StopMove()
ai.MoveToPosition(ai.GetTargetUnit().x,ai.GetTargetUnit().y)
ai.AddMasterBuff(15)
ai.UseSkill(23)
-- Firing from the pet's master position to the target
ai.UseSkill(
22
,1
,Point(ai.GetMasterUnit().x,ai.GetMasterUnit().y))
end
--Acquire dropped items around once every 2 seconds
ai.customData.timer = ai.customData.timer + 1;
if(ai.customData.timer == 3) then
-- Obtain a drop item within a radius of 100
ai.AcquireNearDropItem(100)
ai.customData.timer = 0;
end
end
end
)
|
WINDOWS_SDK_DIR = ""
WINDOWS_SDK_INCLUDE = ""
D3D11_SDK_DIR = WINDOWS_SDK_DIR
D3D11_SDK_INCLUDE = WINDOWS_SDK_INCLUDE
D3D12_SDK_DIR = WINDOWS_SDK_DIR
D3D12_SDK_INCLUDE = WINDOWS_SDK_INCLUDE
LUA_DIR = "Thirdparty/lua-5.1.5/"
LUA_INCLUDE = LUA_DIR.."src/"
TOLUA_EXE = "bin/tolua++.exe"
TOLUA_DIR = "Thirdparty/toluapp-master/"
TOLUA_INCLUDE = TOLUA_DIR.."include/"
SUSHI_COMMON_DIR = "Common/"
SUSHI_COMMON_INCLUDE = SUSHI_COMMON_DIR.."include/"
SUSHI_PS_DIR = "ParticleSystem/"
SUSHI_PS_INCLUDE = SUSHI_PS_DIR.."include/"
SUSHI_RM_DIR = "RenderManager/"
SUSHI_RM_INCLUDE = SUSHI_RM_DIR.."include/"
SUSHI_GRM_DIR = "GPUResourceManager/"
SUSHI_GRM_INCLUDE = SUSHI_GRM_DIR.."include/"
SUSHI_PM_DIR = "PluginManager/"
SUSHI_PM_INCLUDE = SUSHI_PM_DIR.."include/"
SUSHI_WM_DIR = "WindowManager/"
SUSHI_WM_INCLUDE = SUSHI_WM_DIR.."include/"
SUSHI_EM_DIR = "EffectManager/"
SUSHI_EM_INCLUDE = SUSHI_EM_DIR.."include/"
SUSHI_AM_DIR = "AudioManager/"
SUSHI_AM_INCLUDE = SUSHI_AM_DIR.."include/"
SUSHI_SM_DIR = "ScriptManager/"
SUSHI_SM_INCLUDE = SUSHI_SM_DIR.."include/"
SUSHI_OM_DIR = "ObjectManager/"
SUSHI_OM_INCLUDE = SUSHI_OM_DIR.."include/"
SUSHI_GUI_DIR = "GUI/"
SUSHI_GUI_INCLUDE = SUSHI_GUI_DIR.."include/"
SUSHI_FONTS_DIR = "SushiFonts/"
SUSHI_FONTS_INCLUDE = SUSHI_FONTS_DIR.."include/"
SUSHI_ENGINE_DIR = "Engine/"
SUSHI_CORE_DIR = "SushiCore/"
TOLUA_LIB = "tolualib"..API_SUFFIX
TOLUA_EXE_PROJ = "tolua"
LUA_LIB = "lua"..API_SUFFIX
SUSHI_COMMON_LIB = "SushiCommon"
SUSHI_WM_LIB = "WindowManager"
SUSHI_RM_LIB = "RenderManager"
SUSHI_GRM_LIB = "GPUResourceManager"
SUSHI_AM_LIB = "AudioManager"
SUSHI_SM_LIB = "ScriptManager"
SUSHI_PM_LIB = "PluginManager"
SUSHI_PS_LIB = "ParticleSystem"
SUSHI_OM_LIB = "ObjectManager"
SUSHI_GUI_LIB = "GUI"
SUSHI_EM_LIB = "EffectManager"
SUSHI_FONTS_LIB = "SushiFonts"
SUSHI_CORE_LIB = "SushiCore"..API_SUFFIX
INCLUDE_AM = true
INCLUDE_SM = true
INCLUDE_PM = true
INCLUDE_PS = true
INCLUDE_OM = true -- this one might depend on PS or visa-versa.
-- post-build commands for samples
function amdSushiSamplePostbuildCommands(sushipath, suffix)
local commands = {}
table.insert(commands, '{COPY} %{_AMD_SAMPLE_DLL_TARGETDIR}\\$(TargetName).dll '..WORKING_DIR )
table.insert(commands, '{COPY} '..sushipath..'SushiCore'..suffix..'.dll '..WORKING_DIR )
table.insert(commands, '{COPY} '..sushipath..'lua'..suffix..'.dll '..WORKING_DIR )
table.insert(commands, '{COPY} '..sushipath..'Sushi'..suffix..'.exe '..WORKING_DIR )
return commands
end
-- post-build commands for samples
function amdSushiSampleBuildConfig()
includedirs {
SUSHI_INCLUDE..SUSHI_COMMON_INCLUDE,
SUSHI_INCLUDE..SUSHI_PM_INCLUDE,
SUSHI_INCLUDE..SUSHI_OM_INCLUDE,
SUSHI_INCLUDE..SUSHI_OM_DIR,
SUSHI_INCLUDE..SUSHI_PS_DIR,
SUSHI_INCLUDE..SUSHI_PS_INCLUDE,
SUSHI_INCLUDE..SUSHI_WM_INCLUDE,
SUSHI_INCLUDE..SUSHI_EM_INCLUDE,
SUSHI_INCLUDE..SUSHI_SM_INCLUDE,
SUSHI_INCLUDE..SUSHI_RM_INCLUDE,
SUSHI_INCLUDE..SUSHI_GRM_INCLUDE,
SUSHI_INCLUDE..SUSHI_GUI_INCLUDE,
SUSHI_INCLUDE..TOLUA_INCLUDE,
SUSHI_INCLUDE..LUA_INCLUDE }
libdirs { SUSHI_BIN }
defines { "SUSHI_DLL_IMPORT" }
defines { "LUA_BUILD_AS_DLL" }
end
|
--====================================================================--
-- dmc_navigator.lua
--
-- Documentation:
--====================================================================--
--[[
The MIT License (MIT)
Copyright (C) 2013-2015 David McCuskey. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--]]
--====================================================================--
--== DMC Corona Library : DMC Navigator
--====================================================================--
-- Semantic Versioning Specification: http://semver.org/
local VERSION = "0.3.0"
--====================================================================--
--== DMC Corona Library Config
--====================================================================--
--====================================================================--
--== Support Functions
local Utils = {} -- make copying from dmc_utils easier
function Utils.extend( fromTable, toTable )
function _extend( fT, tT )
for k,v in pairs( fT ) do
if type( fT[ k ] ) == "table" and
type( tT[ k ] ) == "table" then
tT[ k ] = _extend( fT[ k ], tT[ k ] )
elseif type( fT[ k ] ) == "table" then
tT[ k ] = _extend( fT[ k ], {} )
else
tT[ k ] = v
end
end
return tT
end
return _extend( fromTable, toTable )
end
--====================================================================--
--== Configuration
local dmc_lib_data
-- boot dmc_corona with boot script or
-- setup basic defaults if it doesn't exist
--
if false == pcall( function() require( 'dmc_corona_boot' ) end ) then
_G.__dmc_corona = {
dmc_corona={},
}
end
dmc_lib_data = _G.__dmc_corona
--====================================================================--
--== DMC Navigator
--====================================================================--
--====================================================================--
--== Configuration
dmc_lib_data.dmc_navigator = dmc_lib_data.dmc_navigator or {}
local DMC_NAVIGATOR_DEFAULTS = {
debug_active=false
}
local dmc_navigator_data = Utils.extend( dmc_lib_data.dmc_navigator, DMC_NAVIGATOR_DEFAULTS )
local Config = dmc_navigator_data
--====================================================================--
--== Imports
local Objects = require 'dmc_objects'
-- local Utils = require 'dmc_utils'
--====================================================================--
--== Setup, Constants
-- setup some aliases to make code cleaner
local newClass = Objects.newClass
local ComponentBase = Objects.ComponentBase
local tinsert = table.insert
local tremove = table.remove
--====================================================================--
--== View Navigation Class
--====================================================================--
local Navigator = newClass( ComponentBase, {name="DMC Navigator"} )
--== Class Constants
Navigator.TRANSITION_TIME = 400
Navigator.FORWARD = 'forward-direction'
Navigator.REVERSE = 'reverse-direction'
--== Event Constants
Navigator.EVENT = 'dmc-navigator-event'
Navigator.REMOVED_VIEW = 'removed-view-event'
--======================================================--
-- Start: Setup DMC Objects
function Navigator:__init__( params )
-- print( "Navigator:__init__" )
params = params or {}
if params.transition_time==nil then params.transition_time=Navigator.TRANSITION_TIME end
self:superCall( '__init__', params )
--==--
--== Sanity Check ==--
if self.is_class then return end
assert( params.width and params.height, "ERROR DMC Navigator: requires dimensions")
--== Create Properties ==--
self._width = params.width
self._height = params.height
self._trans_time = params.transition_time
self._btn_back_f = nil
self._enterFrame_f = nil
self._views = {} -- slide list, in order
--== Object References ==--
self._root_view = nil
self._back_view = nil
self._top_view = nil
self._new_view = nil
self._visible_view = nil
self._nav_bar = nil
self._primer = nil
end
function Navigator:__undoInit__()
--print( "Navigator:__undoInit__" )
self._root_view = nil
self._back_view = nil
self._top_view = nil
self._new_view = nil
self._visible_view = nil
--==--
self:superCall( '__undoInit__' )
end
function Navigator:__createView__()
-- print( "Navigator:__createView__" )
self:superCall( '__createView__' )
--==--
local o, p, dg, tmp -- object, display group, tmp
--== Setup display primer
o = display.newRect( 0, 0, self._width, self._height )
o:setFillColor(0,0,0,0)
if false or Config.debug_active then
o:setFillColor(0.5,1,0.5)
end
o.anchorX, o.anchorY = 0.5, 0
o.x, o.y = 0,0
self:insert( o )
self._primer = o
end
function Navigator:__undoCreateView__()
-- print( "Navigator:__undoCreateView__" )
local o
o = self._primer
o:removeSelf()
self._primer = nil
--==--
self:superCall( '__undoCreateView__' )
end
-- __initComplete__()
--
function Navigator:__initComplete__()
-- print( "Navigator:__initComplete__" )
self:superCall( '__initComplete__' )
--==--
self._btn_back_f = self:createCallback( self._backButtonRelease_handler )
end
function Navigator:__undoInitComplete__()
-- print( "Navigator:__undoInitComplete__" )
local o
self._btn_back_f = nil
self:cleanUp()
--==--
self:superCall( '__undoInitComplete__' )
end
-- END: Setup DMC Objects
--======================================================--
--====================================================================--
--== Public Methods
function Navigator.__setters:nav_bar( value )
-- print( "Navigator.__setters:nav_bar", value )
-- TODO
assert( value )
self._nav_bar = value
end
function Navigator:cleanUp()
-- print( "Navigator:cleanUp" )
self:_stopEnterFrame()
for i=#self._views, 1, -1 do
local view = self:_popStackView()
self:_removeViewFromNav( view )
end
end
function Navigator:pushView( view, params )
-- print( "Navigator:pushView" )
params = params or {}
assert( view, "[ERROR] Navigator:pushView requires a view object" )
-- assert( type(item)=='table' and item.isa and item:isa( NavItem ), "pushNavItem: item must be a NavItem" )
if params.animate==nil then params.animate=true end
--==--
if self._root_view then
-- pass
else
self._root_view = view
self._top_view = nil
self._visible_view = nil
params.animate = false
end
self._new_view = view
self:_gotoNextView( params.animate )
end
function Navigator:popViewAnimated()
self:_gotoPrevView( true )
end
function Navigator:viewIsVisible( value )
-- print( "Navigator:viewIsVisible" )
local o = self._current_view
if o and o.viewIsVisible then o:viewIsVisible( value ) end
end
function Navigator:viewIsVisible( value )
-- print( "Navigator:viewIsVisible" )
local o = self._current_view
if o and o.viewIsVisible then o:viewIsVisible( value ) end
end
function Navigator:viewInMotion( value )
-- print( "Navigator:viewInMotion" )
local o = self._current_view
if o and o.viewInMotion then o:viewInMotion( value ) end
end
--====================================================================--
--== Private Methods
function Navigator:_getPushNavBarTransition( view, params )
-- print( "Navigator:_getPushNavBarTransition", view )
params = params or {}
local o, callback
if self._nav_bar then
o = view.nav_bar_item
assert( o, "view doesn't have nav bar item" )
o.back_button.onRelease = self._btn_back_f
callback = self._nav_bar:_pushNavItemGetTransition( o, {} )
end
return callback
end
function Navigator:_getPopNavBarTransition()
-- print( "Navigator:_getPopNavBarTransition" )
params = params or {}
return self._nav_bar:_popNavItemGetTransition( params )
end
function Navigator:_pushStackView( view )
tinsert( self._views, view )
end
function Navigator:_popStackView( notify )
return tremove( self._views )
end
function Navigator:_addViewToNav( view )
-- print( "Navigator:_addViewToNav", view )
local o = view
if o.view then
o = o.view
elseif o.display then
o = o.display
end
self:insert( o )
view.isVisible=false
end
function Navigator:_removeViewFromNav( view )
-- print( "Navigator:_removeViewFromNav", view )
view.isVisible=false
self:_dispatchRemovedView( view )
end
function Navigator:_startEnterFrame( func )
self._enterFrame_f = func
Runtime:addEventListener( 'enterFrame', func )
end
function Navigator:_stopEnterFrame()
if not self._enterFrame_f then return end
Runtime:removeEventListener( 'enterFrame', self._enterFrame_f )
end
function Navigator:_startReverse( func )
local start_time = system.getTimer()
local duration = self._trans_time
local rev_f -- forward
rev_f = function(e)
local delta_t = e.time-start_time
local perc = 100-(delta_t/duration*100)
if perc <= 0 then
perc = 0
self:_stopEnterFrame()
end
func( perc )
end
self:_startEnterFrame( rev_f )
end
function Navigator:_startForward( func )
local start_time = system.getTimer()
local duration = self._trans_time
local frw_f -- forward
frw_f = function(e)
local delta_t = e.time-start_time
local perc = delta_t/duration*100
if perc >= 100 then
perc = 100
self:_stopEnterFrame()
end
func( perc )
end
self:_startEnterFrame( frw_f )
end
-- can be retreived by another object (ie, NavBar)
function Navigator:_getNextTrans()
return self:_getTransition( self._top_view, self._new_view, self.FORWARD )
end
function Navigator:_gotoNextView( animate )
-- print( "Navigator:_gotoNextView", animate )
local func = self:_getNextTrans()
if not animate then
func( 100 )
else
self:_startForward( func )
end
end
-- can be retreived by another object (ie, NavBar)
function Navigator:_getPrevTrans()
-- print( "Navigator:_getPrevTrans" )
return self:_getTransition( self._back_view, self._top_view, self.REVERSE )
end
function Navigator:_gotoPrevView( animate )
-- print( "Navigator:_gotoPrevView" )
local func = self:_getPrevTrans()
if not animate then
func( 0 )
else
self:_startReverse( func )
end
end
function Navigator:_getTransition( from_view, to_view, direction )
-- print( "Navigator:_getTransition", from_view, to_view, direction )
local W, H = self._width, self._height
local H_CENTER, V_CENTER = W*0.5, H*0.5
local MARGINS = self.MARGINS
local callback, nav_callback
local stack, stack_size, stack_offset
-- calcs for showing left/back buttons
stack_offset = 0
if direction==self.FORWARD then
self:_addViewToNav( to_view )
nav_callback = self:_getPushNavBarTransition( to_view )
stack_offset = 0
else
nav_callback = self:_getPopNavBarTransition()
stack_offset = 1
end
stack, stack_size = self._views, #self._views
callback = function( percent )
-- print( ">>trans", percent )
local dec_p = percent/100
local FROM_X_OFF = H_CENTER/2*dec_p
local TO_X_OFF = W*dec_p
if nav_callback then nav_callback( percent ) end
if percent==0 then
--== edge of transition ==--
--== Finish up
if direction==self.REVERSE then
local view = self:_popStackView()
self:_removeViewFromNav( view )
self._top_view = from_view
self._new_view = nil
self._back_view = stack[ #stack-1 ] -- get previous
end
if from_view then
from_view.isVisible = true
from_view.x = 0
end
if to_view then
to_view.isVisible = false
end
elseif percent==100 then
--== edge of transition ==--
if to_view then
to_view.isVisible = true
to_view.x = 0
end
if from_view then
from_view.isVisible = false
from_view.x = 0-FROM_X_OFF
end
if direction==self.FORWARD then
self._back_view = from_view
self._new_view = nil
self._top_view = to_view
self:_pushStackView( to_view )
end
else
--== middle of transition ==--
if to_view then
to_view.isVisible = true
to_view.x = W-TO_X_OFF
end
if from_view then
from_view.isVisible = true
from_view.x = 0-FROM_X_OFF
end
end
end
return callback
end
-- TODO: add methods
--[[
local s2_a = function()
if prev_view.viewInMotion then prev_view:viewInMotion( true ) end
if prev_view.viewIsVisible then prev_view:viewIsVisible( true ) end
if next_view.viewInMotion then next_view:viewInMotion( true ) end
if next_view.viewIsVisible then next_view:viewIsVisible( false ) end
s2_b()
end
--]]
function Navigator:_dispatchRemovedView( view )
-- print( "Navigator:_dispatchRemovedView", view )
self:dispatchEvent( self.REMOVED_VIEW, {view=view}, {merge=true} )
end
--====================================================================--
--== Event Handlers
function Navigator:_backButtonRelease_handler( event )
-- print( "Navigator:_backButtonRelease_handler", event )
self:popViewAnimated()
end
return Navigator
|
dofile("hooks.lua")
Entity = require("entity")
Player = require("player")
|
local SpatialSparseCriterion, parent = torch.class('nn.SpatialSparseCriterion', 'nn.SparseCriterion')
function SpatialSparseCriterion:__init(...)
parent.__init(self)
xlua.unpack_class(self, {...},
'nn.SpatialSparseCriterion',
'A spatial extension of the SparseCriterion class.\n'
..' Provides a set of parameters to deal with spatial mini-batch training.',
{arg='nbGradients', type='number', help='number of gradients to backpropagate (-1:all, >=1:nb)', default=-1},
{arg='sizeAverage', type='number', help='if true, forward() returns an average instead of a sum of errors', default=true}
)
end
function SpatialSparseCriterion:updateOutput(input)
self.fullOutput = self.fullOutput or torch.Tensor()
self.fullOutput:resize(input:size(2), input:size(3))
input.nn.SpatialSparseCriterion_updateOutput(self, input)
if self.sizeAverage then
self.output = self.fullOutput:mean()
else
self.output = self.fullOutput:sum()
end
return self.output
end
function SpatialSparseCriterion:updateGradInput(input,target)
-- (1) retrieve adjusted target
target = self.target
-- (2) resize input gradient map
self.gradInput:resizeAs(input):zero()
-- (3) compute input gradients, based on the nbGradients param
if self.nbGradients == -1 then
-- dense gradients
input.nn.SpatialSparseCriterion_updateGradInput(self, input, self.gradInput)
elseif self.nbGradients == 1 then
-- only 1 gradient is computed, sampled in the center
self.fullGradInput = torch.Tensor() or self.fullGradInput
self.fullGradInput:resizeAs(input):zero()
input.nn.SpatialSparseCriterion_updateGradInput(self, input, self.fullGradInput)
local y = math.ceil(self.gradInput:size(2)/2)
local x = math.ceil(self.gradInput:size(3)/2)
self.gradInput:select(3,x):select(2,y):copy(self.fullGradInput:select(3,x):select(2,y))
else
-- only N gradients are computed, sampled in random locations
self.fullGradInput = torch.Tensor() or self.fullGradInput
self.fullGradInput:resizeAs(input):zero()
input.nn.SpatialSparseCriterion_updateGradInput(self, input, self.fullGradInput)
for i = 1,self.nbGradients do
local x = math.random(1,self.gradInput:size(1))
local y = math.random(1,self.gradInput:size(2))
self.gradInput:select(3,x):select(2,y):copy(self.fullGradInput:select(3,x):select(2,y))
end
end
return self.gradInput
end
|
BigWigs:AddSounds("Mechano-Lord Capacitus", {
[39096] = "Info",
})
BigWigs:AddSounds("Gatewatcher Iron-Hand", {
[35311] = "Alarm",
[39194] = {"Alert","Long"},
})
BigWigs:AddSounds("Gatewatcher Gyro-Kill", {
[35311] = "Alarm",
})
BigWigs:AddSounds("Nethermancer Sepethrea", {
[-5488] = {"Alert","Info"},
[35250] = "Alarm",
[35314] = "Warning",
[41951] = "Long",
})
|
local argcheck = require('argcheck')
local pdist = require('pdist.env')
require('pdist.Distribution')
require('pdist.Gaussian')
require('pdist.Categorical')
require('pdist.Hybrid')
require('pdist.MutualInformationCriterion')
return pdist
|
creatures = {}
-- Determines whether two players or mobs are allies
function creatures:alliance(creature1, creature2)
local creature1_teams = {}
if creature1:get_luaentity() then
creature1_teams = creature1:get_luaentity().teams
elseif creature1:is_player() then
local race = creatures:get_race(creature1)
creature1_teams = creatures.player_settings[race].teams
end
local creature2_teams = {}
if creature2:get_luaentity() then
creature2_teams = creature2:get_luaentity().teams
elseif creature2:is_player() then
local race = creatures:get_race(creature2)
creature2_teams = creatures.player_settings[race].teams
end
local common = 0
for i, element1 in pairs(creature1_teams) do
local element2 = creature2_teams[i]
if element2 then
common = common + (element1 * element2)
end
end
return common
end
-- Pipe the creature registration function into the player and mob api
function creatures:register_creature(name, def)
creatures:register_mob(name, def)
creatures:register_player(name, def)
end
-- Load files
dofile(minetest.get_modpath("creatures").."/api_mobs.lua")
dofile(minetest.get_modpath("creatures").."/api_players.lua")
dofile(minetest.get_modpath("creatures").."/races.lua")
|
-- Adapted from https://github.com/torch/sdl2-ffi/blob/master/dev/create-init.lua
print[[
-- Do not change this file manually
-- Generated with dev/create-ffi.lua
local ffi = require 'ffi'
local C = ffi.load('matio')
local mat = {C=C}
require 'matio.cdefs'
local defines = require 'matio.defines'
defines.register_hashdefs(mat, C)
local function register(luafuncname, funcname)
local symexists, msg = pcall(function()
local sym = C[funcname]
end)
if symexists then
mat[luafuncname] = C[funcname]
end
end
]]
local defined = {}
local txt = io.open('cdefs.lua'):read('*all')
for funcname in txt:gmatch('Mat_([^%=,%.%;<%s%(%)]+)%s*%(') do
if funcname and not defined[funcname] then
local luafuncname = funcname:gsub('^..',
function(str)
return string.lower(str:sub(1,1)) .. str:sub(2,2)
end
)
print(string.format("register('%s', 'Mat_%s')", luafuncname, funcname))
defined[funcname] = true
end
end
print()
for defname in txt:gmatch('Mat_([^%=,%.%;<%s%(%)|%[%]]+)') do
if not defined[defname] then
print(string.format("register('%s', 'Mat_%s')", defname, defname))
end
end
print[[
return mat
]]
|
--きまぐれ軍貫握り
--
--Script by XyleN5967
function c101105074.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c101105074.cost)
e1:SetTarget(c101105074.target)
e1:SetOperation(c101105074.activate)
c:RegisterEffect(e1)
--to deck & draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(101105074,1))
e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(aux.exccon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(c101105074.tdtg)
e2:SetOperation(c101105074.tdop)
c:RegisterEffect(e2)
end
function c101105074.cfilter(c)
return c:IsCode(101105011) and not c:IsPublic()
end
function c101105074.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(c101105074.cfilter,tp,LOCATION_HAND,0,nil)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(101105074,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sg=g:Select(tp,1,1,nil)
Duel.ConfirmCards(1-tp,sg)
Duel.ShuffleHand(tp)
e:SetLabel(1)
else
e:SetLabel(0)
end
end
function c101105074.thfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x267) and c:IsAbleToHand()
end
function c101105074.target(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c101105074.thfilter,tp,LOCATION_DECK,0,nil)
if chk==0 then return g:GetCount()>=3 end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK)
end
function c101105074.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c101105074.thfilter,tp,LOCATION_DECK,0,nil)
if g:GetCount()>=3 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sg=g:Select(tp,3,3,nil)
Duel.ConfirmCards(1-tp,sg)
local p=1-tp
if e:GetLabel()==1 then p=tp end
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_ATOHAND)
local tg=sg:Select(p,1,1,nil)
Duel.SendtoHand(tg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tg)
end
end
function c101105074.tdfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x267) and c:IsAbleToDeck()
end
function c101105074.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c101105074.tdfilter(chkc) end
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(c101105074.tdfilter,tp,LOCATION_GRAVE,0,3,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c101105074.tdfilter,tp,LOCATION_GRAVE,0,3,3,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c101105074.tdop(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if not tg or tg:FilterCount(Card.IsRelateToEffect,nil,e)==0 then return end
Duel.SendtoDeck(tg,nil,0,REASON_EFFECT)
local g=Duel.GetOperatedGroup()
if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end
local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA)
if ct>0 then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
|
config = {}
-- The path used by the server for its data folder
config.dataPath = tes3mp.GetDataPath()
-- The game mode displayed for this server in the server browser
config.gameMode = "Default"
-- Time to login, in seconds
config.loginTime = 60
-- How many clients are allowed to connect from the same IP address
config.maxClientsPerIP = 3
-- The difficulty level used by default
-- Note: In OpenMW, the difficulty slider goes between -100 and 100, with 0 as the default,
-- though you can use any integer value here
config.difficulty = 0
-- The world time used for a newly created world
config.defaultTimeTable = { year = 427, month = 7, day = 16, hour = 9,
daysPassed = 1, dayTimeScale = 30, nightTimeScale = 40 }
-- The chat window instructions that show up when players join the server
config.chatWindowInstructions = color.White .. "Use " .. color.Yellow .. "Y" .. color.White .. " by default to chat or change it" ..
" from your client config. Type in " .. color.Yellow .. "/help" .. color.White .. " to see the commands" ..
" available to you. Type in " .. color.Yellow .. "/invite <pid>" .. color.White .. " to invite a player to become " ..
"your ally. Use " .. color.Yellow .. "F2" .. color.White .. " by default to hide the chat window.\n"
-- The startup scripts instructions that show up when the startup scripts have not been run yet
config.startupScriptsInstructions = color.Red .. "Warning: " .. color.White .. " For some actors and objects to have their correct" ..
"initial states, an admin needs to run the " .. color.Yellow .. "/runstartup" .. color.White .. " command.\n"
-- Which startup scripts should be run via the /runstartup command
-- Note: These affect the world and must not be run for every player who joins.
config.worldStartupScripts = {"Startup", "BMStartUpScript"}
-- Which startup scripts should be run on every player who joins
-- Note: These pertain to game mechanics that wouldn't work otherwise, such as vampirism checks
config.playerStartupScripts = {"VampireCheck", "WereCheckScript"}
-- Whether the world time should continue passing when there are no players on the server
config.passTimeWhenEmpty = false
-- The hours at which night is regarded as starting and ending, used to pass time using a
-- different timescale when it's night
config.nightStartHour = 20
config.nightEndHour = 6
-- Whether players should be allowed to use the ingame tilde (~) console by default
config.allowConsole = false
-- Whether players should be allowed to rest in bed by default
config.allowBedRest = true
-- Whether players should be allowed to rest in the wilderness by default
config.allowWildernessRest = true
-- Whether players should be allowed to wait by default
config.allowWait = true
-- Whether journal entries should be shared across the players on the server or not
config.shareJournal = true
-- Whether faction ranks should be shared across the players on the server or not
config.shareFactionRanks = true
-- Whether faction expulsion should be shared across the players on the server or not
config.shareFactionExpulsion = false
-- Whether faction reputation should be shared across the players on the server or not
config.shareFactionReputation = true
-- Whether dialogue topics should be shared across the players on the server or not
config.shareTopics = true
-- Whether crime bounties should be shared across players on the server or not
config.shareBounty = false
-- Whether reputation should be shared across players on the server or not
config.shareReputation = true
-- Whether map exploration should be shared across players on the server or not
config.shareMapExploration = false
-- Whether ingame videos should be played for other players when triggered by one player
config.shareVideos = true
-- Which clientside script records should be blanked out so they are not run
-- Note: By default, the original character generation scripts are included
-- because they're not suitable for multiplayer
config.disabledClientScriptIds = { "CharGenRaceNPC", "CharGenClassNPC", "CharGenStatsSheet",
"CharGenDoorGuardTalker", "CharGenBed", "CharGenStuffRoom", "CharGenFatigueBarrel",
"CharGenDialogueMessage", "CharGenDoorExitCaptain", "CharGenJournalMessage" }
-- Which clientside scripts should have all of their variables synchronized across players
-- Warning: Make sure whatever scripts you add in here don't cause infinite packet spam
-- through variable changes that clients cannot agree on
config.synchronizedClientScriptIds = {
"GG_OpenGate1", "GG_OpenGate2", "Arkn_doors", "nchuleftingthWrong1", "nchuleftingthWrong2",
"nchulfetingthRight", "Akula_innerdoors", "Dagoth_doors", "SothaLever1", "SothaLever2",
"SothaLever3", "SothaLever4", "SothaLever5", "SothaLever6", "SothaLever7", "SothaLever8",
"SothaLever9", "SothaLever10", "SothaLever11", "SothaOilLever", "LocalState"
}
-- The cell that newly created players are teleported to
config.defaultSpawnCell = "-3, -2"
-- The X, Y and Z position that newly created players are teleported to
config.defaultSpawnPos = {-23894.0, -15079.0, 505}
-- The X and Z rotation that newly created players are assigned
config.defaultSpawnRot = {0, 1.2}
-- The cell that players respawn in, unless overridden below by other respawn options
config.defaultRespawnCell = "Balmora, Temple"
-- The X, Y and Z position that players respawn in
config.defaultRespawnPos = {4700.5673828125, 3874.7416992188, 14758.990234375}
-- The X and Z rotation that respawned players are assigned
config.defaultRespawnRot = {0.25314688682556, 1.570611000061}
-- Whether the default respawn location should be ignored in favor of respawning the
-- player at the nearest Imperial shrine
config.respawnAtImperialShrine = true
-- Whether the default respawn location should be ignored in favor of respawning the
-- player at the nearest Tribunal temple
-- Note: When both this and the Imperial shrine option are enabled, there is a 50%
-- chance of the player being respawned at either
config.respawnAtTribunalTemple = true
-- The cells that players are forbidden from entering, with any attempt to enter them
-- transporting them to the last location in their previous cell
config.forbiddenCells = { "ToddTest" }
-- The maximum value that any attribute except Speed is allowed to have
config.maxAttributeValue = 200
-- The maximum value that Speed is allowed to have
-- Note: Speed is given special treatment because of the Boots of Blinding Speed
config.maxSpeedValue = 365
-- The maximum value that any skill except Acrobatics is allowed to have
config.maxSkillValue = 200
-- The maximum value that Acrobatics is allowed to have
-- Note: Acrobatics is given special treatment because of the Scroll of Icarian Flight
config.maxAcrobaticsValue = 1200
-- Allow modifier values to bypass allowed skill values
config.ignoreModifierWithMaxSkill = false
-- The refIds of items that players are not allowed to equip for balancing reasons
config.bannedEquipmentItems = { "helseth's ring" }
-- Whether players should respawn when dying
config.playersRespawn = true
-- Time to stay dead before being respawned, in seconds
config.deathTime = 5
-- The number of days spent in jail as a penalty for dying, when respawning
config.deathPenaltyJailDays = 5
-- Whether players' bounties are reset to 0 after dying
config.bountyResetOnDeath = false
-- Whether players spend time in jail proportional to their bounty after dying
-- Note: If deathPenaltyJailDays is also enabled, that penalty will be added to
-- this one
config.bountyDeathPenalty = false
-- Whether players should be allowed to use the /suicide command
config.allowSuicideCommand = true
-- Whether players should be allowed to use the /fixme command
config.allowFixmeCommand = true
-- How many seconds need to pass between uses of the /fixme command by a player
config.fixmeInterval = 30
-- The colors used for different ranks on the server
config.rankColors = { serverOwner = color.Orange, admin = color.Red, moderator = color.Green }
-- Which numerical IDs should be used by custom menus implemented in the Lua scripts,
-- to prevent other menu inputs from being taken into account for them
config.customMenuIds = { menuHelper = 9001, confiscate = 9002, recordPrint = 9003 }
-- The menu files that should be loaded for menuHelper, from the scripts/menu subfolder
config.menuHelperFiles = { "help", "defaultCrafting", "advancedExample" }
-- What the difference in ping needs to be in favor of a new arrival to a cell or region
-- compared to that cell or region's current player authority for the new arrival to become
-- the authority there
-- Note: Setting this too low will lead to constant authority changes which cause more lag
config.pingDifferenceRequiredForAuthority = 40
-- The log level enforced on clients by default, determining how much debug information
-- is displayed in their debug window and logs
-- Note 1: Set this to -1 to allow clients to use whatever log level they have set in
-- their client settings
-- Note 2: If you set this to 0 or 1, clients will be able to read about the movements
-- and actions of other players that they would otherwise not know about,
-- while also incurring a framerate loss on highly populated servers
config.enforcedLogLevel = -1
-- The physics framerate used by default
-- Note: In OpenMW, the physics framerate is 60 by default, but TES3MP has slightly higher
-- system requirements that make a default of 30 more appropriate.
config.physicsFramerate = 30
-- Whether players are allowed to interact with containers located in unloaded cells.
config.allowOnContainerForUnloadedCells = false
-- Whether players should collide with other actors
config.enablePlayerCollision = true
-- Whether actors should collide with other actors
config.enableActorCollision = true
-- Whether placed objects should collide with actors
config.enablePlacedObjectCollision = false
-- Enforce collision for certain placed object refIds even when enablePlacedObjectCollision
-- is false
config.enforcedCollisionRefIds = { "misc_uni_pillow_01", "misc_uni_pillow_02" }
-- Whether placed object collision (when turned on) resembles actor collision, in that it
-- prevents players from standing on top of the placed objects without slipping
config.useActorCollisionForPlacedObjects = false
-- Prevent certain object refIds from being activated as a result of player-sent packets
config.disallowedActivateRefIds = {}
-- Prevent certain object refIds from being deleted as a result of player-sent packets
config.disallowedDeleteRefIds = { "m'aiq" }
-- Prevent certain object refIds from being placed or spawned as a result of player-sent packets
config.disallowedCreateRefIds = {}
-- Prevent certain object refIds from being locked or unlocked as a result of player-sent packets
config.disallowedLockRefIds = {}
-- Prevent certain object refIds from being trapped or untrapped as a result of player-sent packets
config.disallowedTrapRefIds = {}
-- Prevent certain object refIds from being enabled or disabled as a result of player-sent packets
config.disallowedStateRefIds = {}
-- Prevent certain door refIds from being opened or closed as a result of player-sent packets
config.disallowedDoorStateRefIds = {}
-- Prevent object scales from being set this high or higher
config.maximumObjectScale = 20
-- The prefix used for automatically generated record IDs
-- Note 1: Records with automatically generated IDs get erased when there are no more instances of
-- them in player inventories/spellbooks or in cells
-- Note 2: By default, records created through regular gameplay (i.e. player-created spells, potions,
-- enchantments and enchanted items) use automatically generated record IDs, as do records created
-- via the /createrecord command when no ID is specified there
config.generatedRecordIdPrefix = "$custom"
-- The types of record stores used on this server in the order in which they should be loaded for
-- players, with the correct order ensuring that enchantments are loaded before items that might be
-- using those enchantments or ensuring that NPCs are loaded after the items they might have in their
-- inventories
config.recordStoreLoadOrder = { "script", "spell", "potion", "enchantment", "bodypart", "armor",
"clothing", "book", "weapon", "ingredient", "apparatus", "lockpick", "probe", "repair", "light",
"miscellaneous", "creature", "npc", "container", "door", "activator", "static", "cell", "sound" }
-- The types of records that can be enchanted and therefore have links to enchantment records
config.enchantableRecordTypes = { "armor", "book", "clothing", "weapon" }
-- The types of records that can be stored by players and therefore have links to players,
-- listed in the order in which they should be loaded
config.carriableRecordTypes = { "spell", "potion", "armor", "book", "clothing", "weapon", "ingredient",
"apparatus", "lockpick", "probe", "repair", "light", "miscellaneous" }
-- The settings which are accepted as input for different record types when using /storerecord
config.validRecordSettings = {
activator = { "baseId", "id", "name", "model", "script" },
apparatus = { "baseId", "id", "name", "model", "icon", "script", "subtype", "weight", "value",
"quality" },
armor = { "baseId", "id", "name", "model", "icon", "script", "enchantmentId", "enchantmentCharge",
"subtype", "weight", "value", "health", "armorRating" },
bodypart = { "baseId", "id", "subtype", "part", "model", "race", "vampireState", "flags" },
book = { "baseId", "id", "name", "model", "icon", "script", "enchantmentId", "enchantmentCharge",
"text", "weight", "value", "scrollState", "skillId" },
cell = { "baseId", "id" },
clothing = { "baseId", "id", "name", "model", "icon", "script", "enchantmentId", "enchantmentCharge",
"subtype", "weight", "value" },
container = { "baseId", "id", "name", "model", "script", "weight", "flags" },
creature = { "baseId", "id", "name", "model", "script", "scale", "bloodType", "subtype", "level",
"health", "magicka", "fatigue", "aiFight", "aiFlee", "aiAlarm", "aiServices", "flags" },
door = { "baseId", "id", "name", "model", "openSound", "closeSound", "script" },
enchantment = { "baseId", "id", "subtype", "cost", "charge", "flags", "effects" },
ingredient = { "baseId", "id", "name", "model", "icon", "script", "weight", "value" },
light = { "baseId", "id", "name", "model", "icon", "sound", "script", "weight", "value", "time",
"radius", "color", "flags" },
lockpick = { "baseId", "id", "name", "model", "icon", "script", "weight", "value", "quality", "uses" },
miscellaneous = { "baseId", "id", "name", "model", "icon", "script", "weight", "value", "keyState" },
npc = { "baseId", "inventoryBaseId", "id", "name", "script", "flags", "gender", "race", "model", "hair",
"head", "class", "faction", "level", "health", "magicka", "fatigue", "aiFight", "aiFlee", "aiAlarm",
"aiServices", "autoCalc" },
potion = { "baseId", "id", "name", "model", "icon", "script", "weight", "value", "autoCalc" },
probe = { "baseId", "id", "name", "model", "icon", "script", "weight", "value", "quality", "uses" },
repair = { "baseId", "id", "name", "model", "icon", "script", "weight", "value", "quality", "uses" },
script = { "baseId", "id", "scriptText" },
spell = { "baseId", "id", "name", "subtype", "cost", "flags", "effects" },
static = { "baseId", "id", "model" },
weapon = { "baseId", "id", "name", "model", "icon", "script", "enchantmentId", "enchantmentCharge",
"subtype", "weight", "value", "health", "speed", "reach", "damageChop", "damageSlash", "damageThrust",
"flags" },
sound = { "baseId", "id", "sound", "volume", "pitch" }
}
-- The settings which need to be provided when creating a new record that isn't based at all
-- on an existing one, i.e. a new record that is missing a baseId
config.requiredRecordSettings = {
activator = { "name", "model" },
apparatus = { "name", "model" },
armor = { "name", "model" },
bodypart = { "subtype", "part", "model" },
book = { "name", "model" },
cell = { "id" },
clothing = { "name", "model" },
container = { "name", "model" },
creature = { "name", "model" },
door = { "name", "model" },
enchantment = {},
ingredient = { "name", "model" },
light = { "model" },
lockpick = { "name", "model" },
miscellaneous = { "name", "model" },
npc = { "name", "race", "class" },
potion = { "name", "model" },
probe = { "name", "model" },
repair = { "name", "model" },
script = { "id" },
spell = { "name" },
static = { "model" },
weapon = { "name", "model" },
sound = { "sound" }
}
-- The record type settings whose input should be converted to numerical values when using /storerecord
config.numericalRecordSettings = { "subtype", "charge", "cost", "value", "weight", "quality", "uses",
"time", "radius", "health", "armorRating", "speed", "reach", "scale", "part", "bloodType", "level",
"magicka", "fatigue", "aiFight", "aiFlee", "aiAlarm", "aiServices", "autoCalc", "gender", "flags",
"enchantmentCharge" }
-- The record type settings whose input should be converted to booleans when using /storerecord
config.booleanRecordSettings = { "scrollState", "keyState", "vampireState" }
-- The record type settings whose input should be converted to tables with a min and a max numerical value
config.minMaxRecordSettings = { "damageChop", "damageSlash", "damageThrust" }
-- The record type settings whose input should be converted to tables with 3 color values
config.rgbRecordSettings = { "color" }
-- The types of object and actor packets stored in cell data
config.cellPacketTypes = { "delete", "place", "spawn", "lock", "trap", "scale", "state", "miscellaneous",
"doorState", "clientScriptLocal", "container", "equipment", "ai", "death", "actorList", "position",
"statsDynamic", "cellChangeTo", "cellChangeFrom" }
-- Whether the server should enforce that all clients connect with a specific list of data files
-- defined in data/requiredDataFiles.json
-- Warning: Only set this to false if you trust the people connecting and are sure they know
-- what they're doing. Otherwise, you risk getting corrupt server data from
-- their usage of unshared plugins.
config.enforceDataFiles = true
-- Whether the server should avoid crashing when Lua script errors occur
-- Warning: Only set this to true if you want to have a highly experimental server where
-- important data can potentially stay unloaded or get overwritten
config.ignoreScriptErrors = false
-- The type of database or data format used by the server
-- Valid values: json, sqlite3
-- Note: The latter is only partially implemented as of now
config.databaseType = "json"
-- The location of the database file
-- Note: Not applicable when using json
config.databasePath = config.dataPath .. "/database.db" -- Path where database is stored
-- Disallow players from including the following in their own names or the names of their custom items
-- Note: Unfortunately, these are based on real names that trolls have been using on servers
config.disallowedNameStrings = { "bitch", "blowjob", "blow job", "cocksuck", "cunt", "ejaculat",
"faggot", "fellatio", "fuck", "gas the ", "Hitler", "jizz", "nigga", "nigger", "smegma", "vagina", "whore" }
-- The order in which table keys should be saved to JSON files
config.playerKeyOrder = { "login", "name", "passwordHash", "passwordSalt", "settings", "character",
"customClass", "location", "stats", "fame", "shapeshift", "attributes", "attributeSkillIncreases",
"skills", "skillProgress", "recordLinks", "equipment", "inventory", "spellbook", "books", "factionRanks",
"factionReputation", "factionExpulsion", "mapExplored", "ipAddresses", "customVariables", "admin",
"difficulty", "enforcedLogLevel", "physicsFramerate", "consoleAllowed", "bedRestAllowed",
"wildernessRestAllowed", "waitAllowed", "gender", "race", "head", "hair", "class", "birthsign",
"cell", "posX", "posY", "posZ", "rotX", "rotZ", "healthBase", "healthCurrent", "magickaBase",
"magickaCurrent", "fatigueBase", "fatigueCurrent" }
config.cellKeyOrder = { "packets", "entry", "lastVisit", "recordLinks", "objectData", "refId", "count",
"charge", "enchantmentCharge", "location", "actorList", "ai", "summon", "stats", "cellChangeFrom",
"cellChangeTo", "container", "death", "delete", "doorState", "equipment", "inventory", "lock",
"place", "position", "scale", "spawn", "state", "statsDynamic", "trap" }
config.recordstoreKeyOrder = { "general", "permanentRecords", "generatedRecords", "recordLinks",
"id", "baseId", "name", "subtype", "gender", "race", "hair", "head", "class", "faction", "cost",
"value", "charge", "weight", "autoCalc", "flags", "icon", "model", "script", "attribute", "skill",
"rangeType", "area", "duration", "magnitudeMax", "magnitudeMin", "effects", "players", "cells", "global" }
config.worldKeyOrder = { "general", "time", "topics", "kills", "journal", "customVariables", "type",
"index", "quest", "actorRefId", "year", "month", "day", "hour", "daysPassed", "timeScale" }
return config
|
local get_hex = require('cokeline/utils').get_hex
require('cokeline').setup({
cycle_prev_next_mappings = true,
default_hl = {
focused = {
fg = get_hex('Normal', 'fg'),
bg = get_hex('Constant', 'bg'),
},
unfocused = {
fg = get_hex('Comment', 'fg'),
bg = get_hex('Constant', 'bg'),
},
},
components = {
{
text = function(buffer) return ' ' .. buffer.devicon.icon end,
hl = {
fg = function(buffer) return buffer.devicon.color end,
},
},
{
text = '(',
hl = {
fg = function(buffer)
if buffer.lsp.errors ~= 0 then
return vim.g.terminal_color_1
end
if buffer.lsp.warnings ~= 0 then
return vim.g.terminal_color_3
end
end,
},
},
{
text = function(buffer) return buffer.filename end,
hl = {
fg = function(buffer)
if buffer.lsp.errors ~= 0 and buffer.is_focused then
return vim.g.terminal_color_1
end
if buffer.lsp.warnings ~= 0 and buffer.is_focused then
return vim.g.terminal_color_3
end
end,
style = function(buffer)
local style
if buffer.is_focused then
style = 'bold'
else
style = 'italic'
end
if buffer.lsp.errors ~= 0 then
if style then
style = style .. ',underline'
else
style = 'underline'
end
end
return style
end,
},
},
{
text = ')',
hl = {
fg = function(buffer)
if buffer.lsp.errors ~= 0 then
return vim.g.terminal_color_1
end
if buffer.lsp.warnings ~= 0 then
return vim.g.terminal_color_3
end
end,
},
},
{
text = ' ',
}
},
})
--
-- vim.g.bufferline = {
-- animation = true,
-- auto_hide = false,
-- tabpages = true,
-- closable = true,
-- clickable = true,
-- icons = true,
-- insert_at_end = false,
-- maximum_padding = 1,
-- maximum_length = 30,
-- semantic_letters = true,
-- letters = "asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP",
-- no_name_title = nil
-- }
-- call s:hi_all([
-- \ ['BufferCurrent', fg_current, bg_current],
-- \ ['BufferCurrentIndex', fg_special, bg_current],
-- \ ['BufferCurrentMod', fg_modified, bg_current],
-- \ ['BufferCurrentSign', fg_special, bg_current],
-- \ ['BufferCurrentTarget', fg_target, bg_current, 'bold'],
-- \ ['BufferVisible', fg_visible, bg_visible],
-- \ ['BufferVisibleIndex', fg_visible, bg_visible],
-- \ ['BufferVisibleMod', fg_modified, bg_visible],
-- \ ['BufferVisibleSign', fg_visible, bg_visible],
-- \ ['BufferVisibleTarget', fg_target, bg_visible, 'bold'],
-- \ ['BufferInactive', fg_inactive, bg_inactive],
-- \ ['BufferInactiveIndex', fg_subtle, bg_inactive],
-- \ ['BufferInactiveMod', fg_modified, bg_inactive],
-- \ ['BufferInactiveSign', fg_subtle, bg_inactive],
-- \ ['BufferInactiveTarget', fg_target, bg_inactive, 'bold'],
-- \ ['BufferTabpages', fg_special, bg_inactive, 'bold'],
-- \ ['BufferTabpageFill', fg_inactive, bg_inactive],
-- \ ])
--
-- call s:hi_link([
-- \ ['BufferCurrentIcon', 'BufferCurrent'],
-- \ ['BufferVisibleIcon', 'BufferVisible'],
-- \ ['BufferInactiveIcon', 'BufferInactive'],
-- \ ['BufferOffset', 'BufferTabpageFill'],
-- \ ])
|
local constant_uisystem = g_constant_conf['constant_uisystem']
local function _genActions(childList, node)
if childList == nil then
return
end
local decorConfs = {}
local seqActions = {}
for _, childConf in ipairs(childList) do
local tp = childConf['type_name']
local decoratParse = g_uisystem.get_decorate_action_info()[tp]
if decoratParse then
table.insert(decorConfs, {decoratParse, childConf})
else
local parser = g_uisystem.get_all_action_info()[tp]
if parser then
local action = parser(childConf, node)
if action then
table.insert(seqActions, action)
else
print('_genActions failed', str(childConf))
end
else
printf('_genActions no parser:%s', tp)
end
end
end
return decorConfs, seqActions
end
g_uisystem.reg_customize_action_type('Sequence', function(conf, node)
local decorConfs, seqActions = _genActions(conf['child_list'], node)
if decorConfs == nil or #seqActions == 0 then
return
end
local ret = cc.Sequence:create(seqActions)
for _, info in ipairs(decorConfs) do
ret = info[1](info[2], node, ret)
end
return ret
end)
g_uisystem.reg_customize_action_type('Spawn', function(conf, node)
local decorConfs, seqActions = _genActions(conf['child_list'], node)
if decorConfs == nil or #seqActions == 0 then
return
end
local ret = cc.Spawn:create(seqActions)
for _, info in ipairs(decorConfs) do
ret = info[1](info[2], node, ret)
end
return ret
end)
g_uisystem.reg_action_type('DelayTime', function(conf)
return cc.DelayTime:create(conf.t)
end)
g_uisystem.reg_action_type('MoveTo', function(conf, node)
return cc.MoveTo:create(conf.t, node:CalcPos(conf.p.x, conf.p.y))
end)
g_uisystem.reg_action_type('MoveBy', function(conf, node)
return cc.MoveBy:create(conf.t, node:CalcPos(conf.p.x, conf.p.y))
end)
g_uisystem.reg_action_type('BezierTo', function(conf, node)
local p, p1, p2 = conf.p, conf.p1, conf.p2
p1 = node:CalcPos(p1.x, p1.y)
p2 = node:CalcPos(p2.x, p2.y)
p = node:CalcPos(p.x, p.y)
return cc.BezierTo:create(conf.t, {p1, p2, p})
end)
g_uisystem.reg_action_type('BezierBy', function(conf, node)
local p, p1, p2 = conf.p, conf.p1, conf.p2
p1 = node:CalcPos(p1.x, p1.y)
p2 = node:CalcPos(p2.x, p2.y)
p = node:CalcPos(p.x, p.y)
return cc.BezierBy:create(conf.t, {p1, p2, p})
end)
g_uisystem.reg_action_type('CardinalSplineBy', function(conf, node)
local t = conf.t
local pos_list = {}
for _, pos_item in ipairs(conf.p_list or {}) do
table.insert(pos_list, node:CalcPos(pos_item.x, pos_item.y))
end
local tension = conf.tension
return cc.CardinalSplineBy:create(t, pos_list, tension)
end)
g_uisystem.reg_action_type('ScaleTo', function(conf, node)
return cc.ScaleTo:create(conf.t, ccext_get_scale(conf.s.x), ccext_get_scale(conf.s.y))
end)
g_uisystem.reg_action_type('ScaleBy', function(conf, node)
return cc.ScaleBy:create(conf.t, ccext_get_scale(conf.s.x), ccext_get_scale(conf.s.y))
end)
g_uisystem.reg_action_type('RotateTo', function(conf)
return cc.RotateTo:create(conf.t, conf.r)
end)
g_uisystem.reg_action_type('RotateBy', function(conf)
return cc.RotateBy:create(conf.t, conf.r)
end)
g_uisystem.reg_action_type('SkewTo', function(conf)
return cc.SkewTo:create(conf.t, conf.s.x, conf.s.y)
end)
g_uisystem.reg_action_type('SkewBy', function(conf)
return cc.SkewBy:create(conf.t, conf.s.x, conf.s.y)
end)
g_uisystem.reg_action_type('JumpTo', function(conf)
return cc.JumpTo:create(conf.t, conf.p, conf.h, conf.j)
end)
g_uisystem.reg_action_type('JumpBy', function(conf)
return cc.JumpBy:create(conf.t, conf.p, conf.h, conf.j)
end)
g_uisystem.reg_action_type('Blink', function(conf)
return cc.Blink:create(conf.t, conf.n)
end)
g_uisystem.reg_action_type('TintTo', function(conf, node)
local color = ccc3FromHex(conf.color)
return cc.TintTo:create(conf.t, color.r, color.g, color.b)
end)
-- 涉及到透明度、颜色的动画默认会将节点设置 cascade enable true
g_uisystem.reg_action_type('FadeTo', function(conf, node)
node:SetEnableCascadeOpacityRecursion(true)
return cc.FadeTo:create(conf.t, conf.o)
end)
g_uisystem.reg_action_type('FadeIn', function(conf, node)
node:SetEnableCascadeOpacityRecursion(true)
return cc.FadeIn:create(conf.t)
end)
g_uisystem.reg_action_type('FadeOut', function(conf, node)
node:SetEnableCascadeOpacityRecursion(true)
return cc.FadeOut:create(conf.t)
end)
g_uisystem.reg_action_type('Show')
g_uisystem.reg_action_type('Hide')
g_uisystem.reg_action_type('ToggleVisibility')
g_uisystem.reg_action_type('RemoveSelf')
g_uisystem.reg_action_type('Place', function(conf, node)
return cc.Place:create(node:CalcPos(conf.p.x, conf.p.y))
end)
g_uisystem.reg_action_type('CallFunc', function(conf, node)
return cc.CallFunc:create(function()
if node.eventHandler:IsEventReg(conf.n) then
node.eventHandler:Trigger(conf.n, conf.p)
else
printf('animation CallFunc name[%s] not reg:%s', conf.n, debug.traceback())
end
end)
end)
g_uisystem.reg_spec_action_type('CCProgressTimer', 'ProgressTo', function(conf, node)
return cc.ProgressTo:create(conf.t, conf.p)
end)
g_uisystem.reg_spec_action_type('CCAnimateSprite', 'FrameAnimation', function(conf, node)
return cc.CallFunc:create(function()
node:SetAniSptDisplayFrameByPath(conf.p, nil, true)
node:ReStart(conf.c, true)
end)
end)
g_uisystem.reg_customize_action_type('PlayAudio', function(conf, node)
return cc.CallFunc:create(function()
g_audio_mgr.playSound(conf.p)
end)
end)
g_uisystem.reg_customize_action_type('PlayMusic', function(conf, node)
return cc.CallFunc:create(function()
g_audio_mgr.playMusic(conf.p, false)
end)
end)
g_uisystem.reg_customize_action_type('TemplateAction', function(conf, node)
local template_path = conf.p
return cc.CallFunc:create(function()
g_uisystem.play_template_animation(template_path, conf.n, node)
end)
end)
g_uisystem.reg_customize_action_type('PlayParticleAnimation', function(conf, node)
return cc.CallFunc:create(function()
local particleFile = conf['particleFile']
if particleFile == '' then
return
end
local obj = cc.ParticleSystemQuad:Create(particleFile)
obj:setPositionType(conf['posType'])
node:addChild(obj)
end)
end)
g_uisystem.reg_customize_action_type('PlaySkeletonAnimation', function(conf, node)
return cc.CallFunc:create(function()
local animation_data = conf['animation_data']
local jsonPath = animation_data.jsonPath
local action = animation_data.action
local path, _ = string.match(jsonPath, '(.*).json')
local atlasPath = string.format('%s.atlas', path)
local skeletonNode = sp.SkeletonAnimation:create(jsonPath, atlasPath)
if is_valid_str(action) then
skeletonNode:setAnimation(0, action, conf['isLoop'])
end
node:addChild(skeletonNode)
end)
end)
g_uisystem.reg_decorate_action_type('Repeat', function(conf, node, action)
return cc.Repeat:create(action, conf.n)
end)
g_uisystem.reg_decorate_action_type('EaseIn', function(conf, node, action)
return cc.EaseIn:create(action, conf.p)
end)
g_uisystem.reg_decorate_action_type('EaseOut', function(conf, node, action)
return cc.EaseOut:create(action, conf.p)
end)
g_uisystem.reg_decorate_action_type('EaseInOut', function(conf, node, action)
return cc.EaseInOut:create(action, conf.p)
end)
g_uisystem.reg_decorate_action_type('EaseSineIn')
g_uisystem.reg_decorate_action_type('EaseSineOut')
g_uisystem.reg_decorate_action_type('EaseSineInOut')
g_uisystem.reg_decorate_action_type('EaseQuadraticActionIn')
g_uisystem.reg_decorate_action_type('EaseQuadraticActionOut')
g_uisystem.reg_decorate_action_type('EaseQuadraticActionInOut')
g_uisystem.reg_decorate_action_type('EaseCubicActionIn')
g_uisystem.reg_decorate_action_type('EaseCubicActionOut')
g_uisystem.reg_decorate_action_type('EaseCubicActionInOut')
g_uisystem.reg_decorate_action_type('EaseQuarticActionIn')
g_uisystem.reg_decorate_action_type('EaseQuarticActionOut')
g_uisystem.reg_decorate_action_type('EaseQuarticActionInOut')
g_uisystem.reg_decorate_action_type('EaseQuinticActionIn')
g_uisystem.reg_decorate_action_type('EaseQuinticActionOut')
g_uisystem.reg_decorate_action_type('EaseQuinticActionInOut')
g_uisystem.reg_decorate_action_type('EaseExponentialIn')
g_uisystem.reg_decorate_action_type('EaseExponentialOut')
g_uisystem.reg_decorate_action_type('EaseExponentialInOut')
g_uisystem.reg_decorate_action_type('EaseCircleActionIn')
g_uisystem.reg_decorate_action_type('EaseCircleActionOut')
g_uisystem.reg_decorate_action_type('EaseCircleActionInOut')
g_uisystem.reg_decorate_action_type('EaseElasticIn')
g_uisystem.reg_decorate_action_type('EaseElasticOut')
g_uisystem.reg_decorate_action_type('EaseElasticInOut')
g_uisystem.reg_decorate_action_type('EaseBackIn')
g_uisystem.reg_decorate_action_type('EaseBackOut')
g_uisystem.reg_decorate_action_type('EaseBackInOut')
g_uisystem.reg_decorate_action_type('EaseBounceIn')
g_uisystem.reg_decorate_action_type('EaseBounceOut')
g_uisystem.reg_decorate_action_type('EaseBounceInOut')
g_uisystem.reg_decorate_action_type('RepeatForever', function(conf, node, action)
return cc.RepeatForever:create(action)
end)
g_uisystem.reg_decorate_action_type('Speed', function(conf, node, action)
return cc.Speed:create(action, conf.speed)
end)
|
--- shortcuts
v3 = Vector3.new
cn = CFrame.new
ca2 = CFrame.Angles
mf = math.floor
mran = math.random
mrad = math.rad
mdeg = math.deg
ca = function(x,y,z) return ca2(mrad(x),mrad(y),mrad(z)) end
mran2 = function(a,b) return mran(a*1000,b*1000)/1000 end
ud=UDim2.new
bn = BrickColor.new
c3 = Color3.new
-----
Player = game:service'Players'.LocalPlayer
Char = Player.Character
Torso = Char.Torso
Head = Char.Head
Humanoid = Char.Humanoid
Root=Char.HumanoidRootPart.RootJoint
LA=Char['Left Arm']
RA=Char['Right Arm']
LL=Char['Left Leg']
RL=Char['Right Leg']
LAM=Torso['Left Shoulder']
RAM=Torso['Right Shoulder']
LLM=Torso['Left Hip']
RLM=Torso['Right Hip']
Neck=Torso.Neck
Neck.C0=cn(0,1.5,0)
Neck.C1=cn(0,0,0)
name='New'
pcall(function() Player.Backpack[name]:Remove() end)
pcall(function() Char[name]:Remove() end)
pcall(function() Char.Block:Remove() end)
as,so={},{'metal','Block','Slash','Slash2','Hit','Kick'}
as.corner='11294911'
as.cone='1033714'
as.ring="3270017"
as.Chakram='47260990'
as.ring2='18430887'
as.blast='20329976'
as.missile='10207677'
as.fire='2693346'
as.boom='3264793'
as.slash='10209645'
as.abscond='2767090'
as.firelaser='13775494'
as.diamond='9756362'
as.metal='rbxasset://sounds\\unsheath.wav'
as.Block = 'rbxasset://sounds\\metal.ogg'
as.Slash = '10209645'
as.Slash2 = '46760716'
as.Hit='10209583'
as.Kick='46153268'
as.cast='2101137'
for i,v in pairs(as) do
if type(tonumber(v:sub(1,3)))=="number" then
as[i]="http://www.roblox.com/asset/?id="..v
end
end
iNew=function(tab)
local v=Instance.new(tab[1])
for Ind,Val in pairs(tab) do
if Ind~=1 and Ind~=2 then
v[Ind] = Val
end
end
v.Parent=tab[2]==0 and LastMade or tab[2]
LastMade=v
return v
end
iPart=function(tab)
local v=Instance.new(tab.type or 'Part')
if tab.type~='CornerWedgePart' then v.formFactor='Custom' end
v.CanCollide=false
v.TopSurface=0 v.BottomSurface=0
v.Size=v3(tab[2],tab[3],tab[4])
if tab.co then v.BrickColor=bn(tab.co) end
if tab.tr then v.Transparency=tab.tr end
if tab.rf then v.Reflectance=tab.rf end
if tab.cf then v.CFrame=tab.cf end
if tab.an then v.Anchored=tab.an end
v.Parent=tab[1]
LastMade=v
return v
end
function getoutline(x,z,i)
return math.sqrt(x^2+z^2)+(i or 0.05),mdeg(math.atan2(x,z))
end
pcall(function() Torso.LAW:Remove() Torso.RAW:Remove() Torso.LLW:Remove() Torso.RLW:Remove() end)
LAW=iNew{'Weld',Torso,Name='LAW',Part0=Torso,C0=cn(-1.5,0.5,0),C1=cn(0,0.5,0)}
RAW=iNew{'Weld',Torso,Name='RAW',Part0=Torso,C0=cn( 1.5,0.5,0),C1=cn(0,0.5,0)}
LLW=iNew{'Weld',Torso,Name='LLW',Part0=Torso,C0=cn(-0.5, -1,0),C1=cn(0, 1,0)}
RLW=iNew{'Weld',Torso,Name='RLW',Part0=Torso,C0=cn( 0.5, -1,0),C1=cn(0, 1,0)}
function Arms(on)
LAM.Parent=Torso LAM.Part0=Torso
RAM.Parent=Torso RAM.Part0=Torso
LAM.Part1=on and nil or LA
RAM.Part1=on and nil or RA
LAW.Part1=on and LA or nil
RAW.Part1=on and RA or nil
end
function Legs(on)
LLM.Part1=on and nil or LL
RLM.Part1=on and nil or RL
LLW.Part1=on and LL or nil
RLW.Part1=on and RL or nil
end
function v32(cf)
local x,y,z=cf:toEulerAnglesXYZ()
return v3(mdeg(x),mdeg(y),mdeg(z))
end
function GetWeld(weld)
if not weld:findFirstChild("Angle") then
local a = Instance.new("Vector3Value", weld)
a.Name = "Angle"
local x,y,z=weld.C0:toEulerAnglesXYZ()
a.Value=v3(mdeg(x),mdeg(y),mdeg(z))
end
return weld.C0.p,weld.Angle.Value
end
function ClearWeld(weld)
if weld:findFirstChild'Angle' then weld.Angle:Remove() end
end
function SetWeld(weld,CC,i, loops, origpos,origangle, nextpos,nextangle,smooth)
local CO='C'..CC
smooth = smooth or 1
if not weld:findFirstChild("Angle") then
local a = Instance.new("Vector3Value", weld)
a.Name = "Angle"
local x,y,z=weld.C0:toEulerAnglesXYZ()
a.Value=v3(mdeg(x),mdeg(y),mdeg(z))
end
local perc
if smooth == 1 then
perc = math.sin((math.pi/2)/loops*i)
else
perc = i/loops
end
local tox,toy,toz = 0,0,0
if origangle.x > nextangle.x then
tox = -math.abs(origangle.x - nextangle.x) *perc
else
tox = math.abs(origangle.x - nextangle.x) *perc
end
if origangle.y > nextangle.y then
toy = -math.abs(origangle.y - nextangle.y) *perc
else
toy = math.abs(origangle.y - nextangle.y) *perc
end
if origangle.z > nextangle.z then
toz = -math.abs(origangle.z - nextangle.z) *perc
else
toz = math.abs(origangle.z - nextangle.z) *perc
end
local tox2,toy2,toz2 = 0,0,0
if origpos.x > nextpos.x then
tox2 = -math.abs(origpos.x - nextpos.x) *perc
else
tox2 = math.abs(origpos.x - nextpos.x) *perc
end
if origpos.y > nextpos.y then
toy2 = -math.abs(origpos.y - nextpos.y) *perc
else
toy2 = math.abs(origpos.y - nextpos.y) *perc
end
if origpos.z > nextpos.z then
toz2 = -math.abs(origpos.z - nextpos.z) *perc
else
toz2 = math.abs(origpos.z - nextpos.z) *perc
end
weld.Angle.Value = Vector3.new(origangle.x + tox,origangle.y + toy,origangle.z + toz)
weld[CO] = CFrame.new(origpos.x + tox2,origpos.y + toy2,origpos.z + toz2)*ca(origangle.x + tox,origangle.y + toy,origangle.z + toz)
end
LoopFunctions={}
function DoLoop(times,func)
LoopFunctions[#LoopFunctions+1]={times,0,func}
end
Dmg=false
Dmgv={8,16}
HitDebounce={}
Damage=function(Hum,Mult,Sound)
if not Hum.Parent:findFirstChild'Torso' then return end
local HName=Hum.Parent.Name
if HitDebounce[HName] and HitDebounce[HName]>tick() then return end
HitDebounce[HName]=tick()+0.5
local Mult=Mult or 1
local Dealt=mran(Dmgv[1],Dmgv[2])*Mult
local col=''
if Hum.Parent:findFirstChild'Block' and Hum.Parent.Block.Value>0 then
Hum.Parent.Block.Value=Hum.Parent.Block.Value-1
col='Bright blue'
else
Hum.Health=Hum.Health-Dealt
col='Bright red'
end
if Sound then so[col=='Bright blue' and 'Block' or 'Hit']:Play() end
local DoH=iNew{'Model',Pack,Name=col=='Bright blue' and 'Block' or Dealt}
iNew{'Humanoid',DoH,MaxHealth=1/0,Health=1/0,Name=''}
local Doh=iPart{DoH,0.6,0.2,0.6,co=col,an=true} Doh.Name='Head' iNew{'CylinderMesh',Doh}
local dofs=Hum.Parent.Torso.CFrame*cn(mran2(-1.5,1.5),2.5,mran2(-1,1)) Doh.CFrame=dofs
DoLoop(40,function(i) Doh.CFrame=dofs*cn(0,i*2,0) Doh.Transparency=i-0.5 if i==1 then DoH:Remove() end end)
end
Trails={}
TrailPack={}
Traili={}
function Trail(obj,ofs,col)
Trails[obj]=true
Traili[#Traili+1]={obj,ofs,col,obj.CFrame*ofs}
end
CC={'Dark stone grey','Light stone grey','Black'}
SHH=0.25
Handlelen=8.5
Tool=iNew{'HopperBin',Player.Backpack,Name=name}
Pack=iNew{'Model',Char,Name=name}
Shield=iPart{Pack,1.05,0.2,1.05,co=CC[1],tr=1}
wShield=iNew{'Weld',Pack,Part0=Torso,Part1=Shield,C0=cn(0,0.6,0)*ca(90,0,-90)}
shield=iPart{Pack,1.5,2,SHH,co=CC[2]}
wwhield=iNew{'Weld',Pack,Part0=Shield,Part1=shield,C0=cn(-0.5-(SHH/2),0,-0.4)*ca(0,90,-90)}
prop=iPart{Pack,3,1.5,SHH-0.01,co=CC[2]} -- wide
iNew{'Weld',Pack,Part0=shield,Part1=prop,C0=cn(0,0,0)}
prop=iPart{Pack,1,1,SHH,co=CC[2]} --top
iNew{'Weld',Pack,Part0=shield,Part1=prop,C0=cn(0,1.5,0)}
prop=iPart{Pack,1,2,SHH,co=CC[2]} --bottom
iNew{'Weld',Pack,Part0=shield,Part1=prop,C0=cn(0,-2,0)}
for x=-1,1,2 do
Prop=iPart{Pack,SHH,1,0.25,co=CC[2],type='WedgePart'}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(0.625*x,1.5,0)*ca(0,-90*x,0)}
Prop=iPart{Pack,SHH,0.25,0.5,co=CC[2],type='WedgePart'}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(0.25*x,2.125,0)*ca(0,-90*x,0)}
Prop=iPart{Pack,SHH,1,0.75,co=CC[2],type='WedgePart'}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(0.75/2*x,-3.5,0)*ca(180,-90*x,0)}
for y=-1,1,2 do
Prop=iPart{Pack,SHH,0.25,0.75,co=CC[2],type='WedgePart'}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(1.125*x,(1-0.125)*y,0)*ca(y==-1 and 180 or 0,-90*x,0)}
Prop=iPart{Pack,SHH,0.75,0.25,co=CC[2],type='WedgePart'}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(1.625*x,0.75/2*y,0)*ca(y==-1 and 180 or 0,-90*x,0)}
Prop=iPart{Pack,SHH,1,0.25,co=CC[2],type='WedgePart'}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(0.625*x,(0.5*-y)-2,0)*ca(y==-1 and 180 or 0,-90*x,0)}
end
end
-- outline
outth=0.1
SHH2=SHH+0.1
for x=-1,1,2 do
local len,rot=getoutline(1,0.25)
Prop=iPart{Pack,0.2,len,SHH2,co=CC[1]} iNew{'BlockMesh',Prop,Scale=v3(outth*5,1,1)}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(0.625*x,-2.5,0)*ca(0,0,-rot*x+90)}
Prop=iPart{Pack,0.2,len,SHH2,co=CC[1]} iNew{'BlockMesh',Prop,Scale=v3(outth*5,1,1)}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(0.625*x,-1.5,0)*ca(0,0,rot*x+90)}
local len,rot=getoutline(1,0.75)
Prop=iPart{Pack,0.2,len,SHH2,co=CC[1]} iNew{'BlockMesh',Prop,Scale=v3(outth*5,1,1)}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(0.75/2*x,-3.5,0)*ca(0,0,rot*x+90)}
local len,rot=getoutline(1,0.75)
Prop=iPart{Pack,0.2,len,SHH2,co=CC[1]} iNew{'BlockMesh',Prop,Scale=v3(outth*5,1,1)}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(0.75/2*x,-3.5,0)*ca(0,0,rot*x+90)}
local len,rot=getoutline(1,0.25)
Prop=iPart{Pack,0.2,len,SHH2,co=CC[1]} iNew{'BlockMesh',Prop,Scale=v3(outth*5,1,1)}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(0.625*x,1.5,0)*ca(0,0,-rot*x-90)}
local len,rot=getoutline(0.25,0.5)
Prop=iPart{Pack,0.2,len,SHH2,co=CC[1]} iNew{'BlockMesh',Prop,Scale=v3(outth*5,1,1)}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(0.25*x,2.125,0)*ca(0,0,-rot*x-90)}
for y=-1,1,2 do
local len,rot=getoutline(0.75,0.25)
Prop=iPart{Pack,0.2,len,SHH2,co=CC[1]} iNew{'BlockMesh',Prop,Scale=v3(outth*5,1,1)}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(1.625*x,0.75/2*y,0)*ca(0,0,rot*x*-y+90)}
local len,rot=getoutline(0.25,0.75)
Prop=iPart{Pack,0.2,len,SHH2,co=CC[1]} iNew{'BlockMesh',Prop,Scale=v3(outth*5,1,1)}
iNew{'Weld',Pack,Part0=shield,Part1=Prop,C0=cn(1.125*x,(1-0.125)*y,0)*ca(0,0,rot*x*-y+90)}
end
end
---Weapon
Handle=iPart{Pack,0.5,2,0.5,co=CC[3]} iNew{'CylinderMesh',0}
wHandle=iNew{'Weld',Pack,Part0=Torso,Part1=Handle,C0=cn(2,3,0.75+SHH)*ca(-90,-45,90)}
--C0=cn(0,-1.25,0.3)*ca(-90,0,0)
prop=iPart{Pack,0.5,2,0.5,co=CC[3]} iNew{'SpecialMesh',0,MeshId=as.cone,Scale=v3(0.25,2.3,0.25)}
iNew{'Weld',Pack,Part0=Handle,Part1=prop,C0=cn(0,-1,0)*ca(160,0,0)*cn(0,0.8,0)}
prop=iPart{Pack,0.7,0.7,0.7,co=CC[3]} iNew{'SpecialMesh',0,MeshType='Sphere'}
iNew{'Weld',Pack,Part0=Handle,Part1=prop,C0=cn(0,1,0)}
prop=iPart{Pack,0.7,0.2,0.7,co=CC[3]} iNew{'CylinderMesh',0}
iNew{'Weld',Pack,Part0=Handle,Part1=prop,C0=cn(0,1.3,0)}
--
for x=-1,1,2 do
prop=iPart{Pack,0.4,0.4,0.8,co=CC[3],type='WedgePart'}
iNew{'Weld',Pack,Part0=Handle,Part1=prop,C0=cn(0.4*x/2,1.4,0)*ca(25,180,90*x)*cn(0,0,-0.4)}
prop=iPart{Pack,0.4,0.4,0.8,co=CC[3],type='WedgePart'}
iNew{'Weld',Pack,Part0=Handle,Part1=prop,C0=cn(-0.4*x/2,1.4,0)*ca(25,0,90*x)*cn(0,0,-0.4)}
for i=-1,1,2 do
local le=i==-1 and 0.5 or 0.85
prop=iPart{Pack,le,0.4,0.8,co=CC[3],type='WedgePart'}
iNew{'Weld',Pack,Part0=Handle,Part1=prop,C0=cn(0.4*x/2*i,1.6+(0.25-(le/2-0.25)),0.4*i)*ca(0,i==1 and 180 or 0,90*x)}
end
end
local len=6
local a,b=getoutline(0.4,0.8,0)
local aa,bb=getoutline(0.4,len,0)
prop=iPart{Pack,1,1,a,co=CC[3],type='WedgePart'} iNew{'SpecialMesh',0,Scale=v3(0.02,aa,1),MeshType='Wedge'}
iNew{'Weld',Pack,Part0=Handle,Part1=prop,C0=cn(0,2.1+len/2,-0.4)*ca(0,0,bb)*ca(0,b,0)}
prop=iPart{Pack,1,1,a,co=CC[3],type='WedgePart'} iNew{'SpecialMesh',0,Scale=v3(0.02,aa,1),MeshType='Wedge'}
iNew{'Weld',Pack,Part0=Handle,Part1=prop,C0=cn(0,2.1+len/2,-0.4)*ca(0,0,-bb)*ca(0,-b,0)}
prop=iPart{Pack,1,1,a,co=CC[3],type='WedgePart'} iNew{'SpecialMesh',0,Scale=v3(0.02,aa,1),MeshType='Wedge'}
iNew{'Weld',Pack,Part0=Handle,Part1=prop,C0=cn(0,2.1+len/2,0.4)*ca(0,0,bb)*ca(0,-b,0)*ca(0,180,0)}
prop=iPart{Pack,1,1,a,co=CC[3],type='WedgePart'} iNew{'SpecialMesh',0,Scale=v3(0.02,aa,1),MeshType='Wedge'}
iNew{'Weld',Pack,Part0=Handle,Part1=prop,C0=cn(0,2.1+len/2,0.4)*ca(0,0,-bb)*ca(0,b,0)*ca(0,180,0)}
local sc=0.85
for x=-1,1,2 do
rune=iPart{Pack,sc,1,sc,co=''} iNew{'CylinderMesh',0,Scale=v3(1,0.08,1)}
iNew{'Weld',Pack,Part0=Handle,Part1=rune,C0=cn(0.2*x,2.1+0.5,-0.36)*ca(0,0,bb*x)*ca(0,b*x,90)*ca(0,-4,0)}
prop=iPart{Pack,sc/2.5,1,sc/2.5,co='Navy blue'} iNew{'CylinderMesh',0,Scale=v3(1,0.09,1)}
iNew{'Weld',Pack,Part0=rune,Part1=prop}
prop=iPart{Pack,0.5,0.2,0.5,co='Dark stone grey'} iNew{'SpecialMesh',0,Scale=v3(0.6,0.6,1.4)*sc,MeshId=as.ring2}
iNew{'Weld',Pack,Part0=rune,Part1=prop,C0=ca(90,0,0)}
prop=iPart{Pack,0.2,0.2,0.2,co='Black',rf=0.25} iNew{'SpecialMesh',0,Scale=v3(0.02,2.4,0.35),MeshId=as.cone}
iNew{'Weld',Pack,Part0=rune,Part1=prop,C0=cn(1.2,0,0)*ca(0,0,-90)}
for i=0,360,90 do
prop=iPart{Pack,0.2,0.2,0.2,co='Black'} iNew{'CylinderMesh',0,Scale=v3(0.9,0.09*5,0.9)}
iNew{'Weld',Pack,Part0=rune,Part1=prop,C0=ca(0,i+45,0)*cn(0,0,sc/3)}
end
end
prop=iPart{Pack,0.35,1,0.5,co='Black',type='WedgePart'}
iNew{'Weld',Pack,Part0=Handle,Part1=prop,C0=cn(0,0,-0.4)*ca(0,0,0)}
prop=iPart{Pack,0.35,0.5,0.5,co='Black',type='WedgePart'}
iNew{'Weld',Pack,Part0=Handle,Part1=prop,C0=cn(0,-0.75,-0.4)*ca(0,0,180)}
for x=0,100,100/5 do
prop=iPart{Pack,0.2,0.35,0.2,co='Black'} iNew{'CylinderMesh',0}
iNew{'Weld',Pack,Part0=Handle,Part1=prop,C0=cn(0,-1.1,0.275)*ca(105+x,0,0)*cn(0,0,0.75)}
end
HitBox=iPart{Pack,0.2,7,1.5,co='Black',tr=1}
HitBoxCF=cn(0,5,0)
--iNew{'Weld',Pack,Part0=Handle,Part1=HitBox,C0=cn(0,5,0)}
HitBox.Touched:connect(function(hit)
if not Dmg then return end
if hit.Parent==Char then return end
if hit.Parent:findFirstChild'Humanoid' then
local h=hit.Parent.Humanoid
Damage(h,1,true)
end
end)
for i,v in pairs(Torso:children()) do
if v:IsA'Sound' then v:Remove() end
end
for i,n in pairs(so) do
local v=iNew{'Sound',Torso,Volume=1,Pitch=1,Looped=false,Name=v,SoundId=as[n]}
so[n]=v
end
function RePose()
local a,b=GetWeld(LAW)
local c,d=GetWeld(RAW)
--local e,f=GetWeld(wShield)
local g,h=GetWeld(wHandle)
local i,j=GetWeld(Root)
local k,l=GetWeld(Neck)
oPoseLA=a oPoseLA2=b
oPoseRA=c oPoseRA2=d
--oPoseShield=e oPoseShield2=f
oPoseHandle=g oPoseHandle2=h
oPoseRT=i oPoseRT2=j
oPoseNE=k oPoseNE2=l
end
function ReturnPose()
local wLA,wLA2=GetWeld(LAW)
local wRA,wRA2=GetWeld(RAW)
local wRT,wRT2=GetWeld(Root)
local AA,AA2=GetWeld(wShield)
local BB,BB2=GetWeld(wHandle)
local wNE,wNE2=GetWeld(Neck)
for i=1,ASpeed do
SetWeld(LAW,0,i,ASpeed,wLA,wLA2,PoseLA,PoseLA2,1)
SetWeld(RAW,0,i,ASpeed,wRA,wRA2,PoseRA,PoseRA2,1)
SetWeld(wShield,0,i,ASpeed,AA,AA2,v3(0,0,0),v3(0,0,0),1)
SetWeld(wHandle,0,i,ASpeed,BB,BB2,PoseHandle,PoseHandle2,1)
SetWeld(Root,0,i,ASpeed,wRT,wRT2,PoseRT,PoseRT2,1)
SetWeld(Neck,0,i,ASpeed,wNE,wNE2,PoseNE,PoseNE2,1)
wait()
end
end
function TorsoROT(i,rot)
SetWeld(Root,0,i,ASpeed,oPoseRT,oPoseRT2,PoseRT,v3(0,rot,0),1)
SetWeld(Neck,0,i,ASpeed,oPoseNE,oPoseNE2,PoseNE,v3(0,-rot,0),1)
end
Block=iNew{'NumberValue',Char,Name='Block',Value=0}
key={}
Tool.Selected:connect(function(mouse)
print'Selected'
Mouse=mouse
if Anim=='None' then
Anim='Equipping'
Arms(0)
for i=1,ASpeed do
SetWeld(LAW,0,i,ASpeed,OrigLA,OrigLA2,OrigLA,v3(90,0,-90),1)
SetWeld(RAW,0,i,ASpeed,OrigRA,OrigRA2,OrigRA,v3(200,0,0),1)
wait()
end
local ofs = LA.CFrame:toObjectSpace(Shield.CFrame)
wShield.Part0=LA wShield.C0=ofs ClearWeld(wShield)
local AA,AA2=GetWeld(wShield)
local ofs = RA.CFrame:toObjectSpace(Handle.CFrame)
wHandle.Part0=RA wHandle.C0=ofs ClearWeld(wHandle)
local BB,BB2=GetWeld(wHandle)
for i=1,ASpeed do
SetWeld(wShield,0,i,ASpeed,AA,AA2,v3(0,0,0),v3(0,0,0),1)
SetWeld(wHandle,0,i,ASpeed,BB,BB2,PoseHandle,PoseHandle2,1)
wait()
end
ReturnPose()
Anim='Equipped'
end
Mouse.KeyDown:connect(function(k)
key[k]=true
if Anim=='Equipped' and k=='f' then
Anim='Block'
RePose()
for i=1,ASpeed do
SetWeld(LAW,0,i,ASpeed,oPoseLA,oPoseLA2,v3(-1.25,0.5,-0.5),v3(90,0,45),1)
SetWeld(RAW,0,i,ASpeed,oPoseRA,oPoseRA2,v3(1.5,0.5,0),v3(-45,0,-20),1)
SetWeld(wHandle,0,i,ASpeed,oPoseHandle,oPoseHandle2,PoseHandle+v3(0,-0.2,0),v3(-90,-20,-60),1)
TorsoROT(i,-45)
wait()
end
Block.Value=mran(1,3)
so.Block:Play()
Anim='Blocking'
repeat wait() until Anim=='Blocking' and (not key[k] or Block.Value<1)
Block.Value=0
Anim=''
ReturnPose()
Anim='Equipped'
elseif Anim=='Equipped' and k=='s' then
elseif Anim=='Equipped' and k=='s' then
elseif Anim=='Equipped' and k=='s' then
end
end)--keys
Mouse.KeyUp:connect(function(k)
key[k]=false
end)
Mouse.Button1Down:connect(function()
Button1=true
if Anim=='Blocking' then
Anim='BlockCounter'
RePose()
so.Slash:Play()
Dmg=true
Trail(Handle,cn(0,Handlelen,0),'White')
for i=1,ASpeed do
SetWeld(LAW,0,i,ASpeed,oPoseLA,oPoseLA2,v3(-1.5,0.5,0),v3(0,0,-45),1)
SetWeld(RAW,0,i,ASpeed,oPoseRA,oPoseRA2,v3(1.5,0.5,0),v3(-90,0,135),1)
SetWeld(wHandle,0,i,ASpeed,oPoseHandle,oPoseHandle2,PoseHandle+v3(0,-0.2,0),v3(-90,55,-80),1)
TorsoROT(i,60)
wait()
end
Trails[Handle]=false
Dmg=false
wait(0.1)
RePose()
for i=1,ASpeed do -- return
SetWeld(LAW,0,i,ASpeed,oPoseLA,oPoseLA2,v3(-1.25,0.5,-0.5),v3(90,0,45),1)
SetWeld(RAW,0,i,ASpeed,oPoseRA,oPoseRA2,v3(1.5,0.5,0),v3(-45,0,-20),1)
SetWeld(wHandle,0,i,ASpeed,oPoseHandle,oPoseHandle2,PoseHandle+v3(0,-0.2,0),v3(-90,-20,-90),1)
TorsoROT(i,-45)
wait()
end
so.Block:Play()
Anim='Blocking'
end
end)
end) -- select
Tool.Deselected:connect(function(mouse)
print'Deselected'
Mouse=nil
if Anim=='Equipped' then
Anim='Unequipping'
RePose()
for i=1,ASpeed do
SetWeld(LAW,0,i,ASpeed,oPoseLA,oPoseLA2,OrigLA,v3(90,0,-90),1)
SetWeld(RAW,0,i,ASpeed,oPoseRA,oPoseRA2,OrigRA,v3(200,0,0),1)
wait()
end
local ofs = Torso.CFrame:toObjectSpace(Shield.CFrame)
wShield.Part0=Torso wShield.C0=ofs ClearWeld(wShield)
local AA,AA2=GetWeld(wShield)
local ofs = Torso.CFrame:toObjectSpace(Handle.CFrame)
wHandle.Part0=Torso wHandle.C0=ofs ClearWeld(wHandle)
local BB,BB2=GetWeld(wHandle)
for i=1,ASpeed do
SetWeld(wShield,0,i,ASpeed,AA,AA2,v3(0,0.6,0),v3(90,0,-90),1)
SetWeld(wHandle,0,i,ASpeed,BB,v3(110,0,0),v3(2,3,0.75+SHH),v3(-90+180,-45-90,90-180),1)
wait()
end
local wLA,wLA2=GetWeld(LAW)
local wRA,wRA2=GetWeld(RAW)
for i=1,ASpeed do
SetWeld(LAW,0,i,ASpeed,wLA,wLA2,OrigLA,OrigLA2,1)
SetWeld(RAW,0,i,ASpeed,wRA,wRA2,OrigRA,OrigRA2,1)
wait()
end
Arms()
Anim='None'
end
end) --deselect
print(#Pack:children())
Root.C0=cn(0,0,0)*ca(0,0,0)
Root.C1=cn(0,0,0)*ca(0,0,0)
Arms()
Legs()
WalkAnim=0
Walking=false
Humanoid.Running:connect(function(Walk)
Walking=Walk>0 and true or false
end)
WalkSpeed={1,1,1,1,1,1,1,1}
Anim='None'
ASpeed=10
OrigLA=v3(-1.5,0.5,0) OrigLA2=v3(0,0,0)
OrigRA=v3( 1.5,0.5,0) OrigRA2=v3(0,0,0)
--Pose
PoseLA=v3(-1.5,0.5,0) PoseLA2=v3(20,0,0)
PoseRA=v3( 1.5,0.5,0) PoseRA2=v3(0,0,20)
PoseHandle=v3(0,-1,0) PoseHandle2=v3(-90,0,0)
PoseRT=v3(0,0,0) PoseRT2=v3(0,0,0)
PoseNE=v3(0,1.5,0) PoseNE2=v3(0,0,0)
-----
WPoseLA=v3(-1.25,0.5,0) WPoseLA2=v3(-35,0,-20)
WPoseRA=PoseRA WPoseRA2=v3(-45,5,0)
WPoseHandle=v3(0,-1,0) WPoseHandle2=v3(-90/1.5,0,0)
while Pack.Parent do
WalkAnim=WalkAnim+(Walking and (Anim=='Equipped' and 1 or -1) or -1)
if WalkAnim<0 then WalkAnim=0 elseif WalkAnim>14 then WalkAnim=14 end
if Anim=='Equipped' and LAW.Part1==LA then
SetWeld(LAW,0,WalkAnim,14,PoseLA,PoseLA2,WPoseLA,WPoseLA2,1)
SetWeld(RAW,0,WalkAnim,14,PoseRA,PoseRA2,WPoseRA,WPoseRA2,1)
SetWeld(wHandle,0,WalkAnim,14,PoseHandle,PoseHandle2,WPoseHandle,WPoseHandle2,1)
end
local ws=16 for i=1,#WalkSpeed do ws=ws*WalkSpeed[i] end Humanoid.WalkSpeed=ws
--Trailing Package
for i,v in pairs(Traili) do
if Trails[v[1]] then
local obj,ofs,col,lastofs=v[1],v[2],v[3],v[4]
local length=(obj.CFrame*ofs.p-lastofs.p).magnitude
local ob=iPart{Pack,0.5,length,0.5,co=col,tr=0.5,an=true,cf=CFrame.new(obj.CFrame*ofs.p,lastofs.p)}
iNew{'CylinderMesh',ob}
Traili[i][4]=ob.CFrame
ob.CFrame=ob.CFrame*cn(0,0,-length/2)*ca(90,0,0)
TrailPack[#TrailPack+1]={ob,1,-0.1}
else
Traili[i]=nil
end
end
for i,v in pairs(TrailPack) do
v[2]=v[2]+v[3]
if v[2]<=0 then
v[1]:Remove()
TrailPack[i]=nil
else
v[1].Transparency=0.5+(0.45-0.45*v[2])
v[1].Mesh.Scale=v3(v[2],1,v[2])
end
end
--DoLoop Package
for i,v in pairs(LoopFunctions) do
v[2]=v[2]+1
v[3](v[2]/v[1])
if v[1]<=v[2] then LoopFunctions[i]=nil end
end
HitBox.CFrame=Handle.CFrame*HitBoxCF
HitBox.Velocity=v3(0,0,0) HitBox.RotVelocity=v3(0,0,0)
wait()
end
|
print 'Hello, DxLua!'
|
require 'dp'
--[[command line arguments]]--
cmd = torch.CmdLine()
cmd:text()
cmd:text('Training ImageNet (large-scale image classification) using an Alex Krizhevsky Convolution Neural Network')
cmd:text('Ref.: A. http://www.cs.toronto.edu/~fritz/absps/imagenet.pdf')
cmd:text('B. https://github.com/facebook/fbcunn/blob/master/examples/imagenet/models/alexnet_cunn.lua')
cmd:text('Example:')
cmd:text('$> th alexnet.lua --batchSize 128 --momentum 0.5')
cmd:text('Options:')
cmd:option('--dataPath', paths.concat(dp.DATA_DIR, 'ImageNet'), 'path to ImageNet')
cmd:option('--trainPath', '', 'Path to train set. Defaults to --dataPath/ILSVRC2012_img_train')
cmd:option('--validPath', '', 'Path to valid set. Defaults to --dataPath/ILSVRC2012_img_val')
cmd:option('--metaPath', '', 'Path to metadata. Defaults to --dataPath/metadata')
cmd:option('--learningRate', 0.01, 'learning rate at t=0')
cmd:option('--maxOutNorm', -1, 'max norm each layers output neuron weights')
cmd:option('-weightDecay', 5e-4, 'weight decay')
cmd:option('--maxNormPeriod', 1, 'Applies MaxNorm Visitor every maxNormPeriod batches')
cmd:option('--momentum', 0.9, 'momentum')
cmd:option('--batchSize', 128, 'number of examples per batch')
cmd:option('--cuda', false, 'use CUDA')
cmd:option('--useDevice', 1, 'sets the device (GPU) to use')
cmd:option('--trainEpochSize', -1, 'number of train examples seen between each epoch')
cmd:option('--maxEpoch', 100, 'maximum number of epochs to run')
cmd:option('--maxTries', 30, 'maximum number of epochs to try to find a better local minima for early-stopping')
cmd:option('--accUpdate', false, 'accumulate gradients inplace')
cmd:option('--verbose', false, 'print verbose messages')
cmd:option('--progress', false, 'print progress bar')
cmd:option('--nThread', 2, 'allocate threads for loading images from disk. Requires threads-ffi.')
cmd:option('--LCN', false, 'use Local Constrast Normalization as in the original paper. Requires inn (imagine-nn)')
cmd:text()
opt = cmd:parse(arg or {})
opt.trainPath = (opt.trainPath == '') and paths.concat(opt.dataPath, 'ILSVRC2012_img_train') or opt.trainPath
opt.validPath = (opt.validPath == '') and paths.concat(opt.dataPath, 'ILSVRC2012_img_val') or opt.validPath
opt.metaPath = (opt.metaPath == '') and paths.concat(opt.dataPath, 'metadata') or opt.metaPath
table.print(opt)
if opt.LCN then
assert(opt.cuda, "LCN only works with CUDA")
require "inn"
end
--[[data]]--
datasource = dp.ImageNet{
train_path=opt.trainPath, valid_path=opt.validPath,
meta_path=opt.metaPath, verbose=opt.verbose
}
-- preprocessing function
ppf = datasource:normalizePPF()
--[[Model]]--
-- We create the model using pure nn
function createModel()
local features = nn.Concat(2)
local fb1 = nn.Sequential() -- branch 1
fb1:add(nn.SpatialConvolutionMM(3,48,11,11,4,4,2,2)) -- 224 -> 55
fb1:add(nn.ReLU())
if opt.LCN then
fb1:add(inn.SpatialCrossResponseNormalization(5, 0.0001, 0.75, 2))
end
fb1:add(nn.SpatialMaxPooling(3,3,2,2)) -- 55 -> 27
fb1:add(nn.SpatialConvolutionMM(48,128,5,5,1,1,2,2)) -- 27 -> 27
fb1:add(nn.ReLU())
if opt.LCN then
fb1:add(inn.SpatialCrossResponseNormalization(5, 0.0001, 0.75, 2))
end
fb1:add(nn.SpatialMaxPooling(3,3,2,2)) -- 27 -> 13
fb1:add(nn.SpatialConvolutionMM(128,192,3,3,1,1,1,1)) -- 13 -> 13
fb1:add(nn.ReLU())
fb1:add(nn.SpatialConvolutionMM(192,192,3,3,1,1,1,1)) -- 13 -> 13
fb1:add(nn.ReLU())
fb1:add(nn.SpatialConvolutionMM(192,128,3,3,1,1,1,1)) -- 13 -> 13
fb1:add(nn.ReLU())
fb1:add(nn.SpatialMaxPooling(3,3,2,2)) -- 13 -> 6
fb1:add(nn.Copy(nil, nil, true)) -- prevents a newContiguous in SpatialMaxPooling:backward()
local fb2 = fb1:clone() -- branch 2
for k,v in ipairs(fb2:findModules('nn.SpatialConvolutionMM')) do
v:reset() -- reset branch 2's weights
end
features:add(fb1)
features:add(fb2)
-- 1.3. Create Classifier (fully connected layers)
local classifier = nn.Sequential()
classifier:add(nn.View(256*6*6))
classifier:add(nn.Dropout(0.5))
classifier:add(nn.Linear(256*6*6, 4096))
classifier:add(nn.Threshold(0, 1e-6))
classifier:add(nn.Dropout(0.5))
classifier:add(nn.Linear(4096, 4096))
classifier:add(nn.Threshold(0, 1e-6))
classifier:add(nn.Linear(4096, 1000))
classifier:add(nn.LogSoftMax())
-- 1.4. Combine 1.1 and 1.3 to produce final model
local model = nn.Sequential():add(features):add(classifier)
return model
end
-- wrap the nn.Module in a dp.Module
model = dp.Module{
module = createModel(),
input_view = 'bchw',
output_view = 'bf',
output = dp.ClassView()
}
--[[Visitor]]--
local visitor = {}
-- the ordering here is important:
if opt.momentum > 0 then
if opt.accUpdate then
print"Warning : momentum is ignored with acc_update = true"
end
table.insert(visitor,
dp.Momentum{momentum_factor = opt.momentum}
)
end
if opt.weightDecay and opt.weightDecay > 0 then
if opt.accUpdate then
print"Warning : weightdecay is ignored with acc_update = true"
end
table.insert(visitor, dp.WeightDecay{wd_factor=opt.weightDecay})
end
table.insert(visitor,
dp.Learn{
learning_rate = opt.learningRate,
observer = dp.LearningRateSchedule{
schedule={[1]=1e-2,[19]=5e-3,[30]=1e-3,[44]=5e-4,[53]=1e-4}
}
}
)
if opt.maxOutNorm > 0 then
table.insert(visitor, dp.MaxNorm{
max_out_norm = opt.maxOutNorm, period=opt.maxNormPeriod
})
end
--[[Propagators]]--
train = dp.Optimizer{
loss = dp.NLL(),
visitor = visitor,
feedback = dp.Confusion(),
sampler = dp.RandomSampler{
batch_size=opt.batchSize, epoch_size=opt.trainEpochSize, ppf=ppf
},
progress = opt.progress
}
valid = dp.Evaluator{
loss = dp.NLL(),
feedback = dp.TopCrop{n_top={1,5,10},n_crop=10,center=2},
sampler = dp.Sampler{
batch_size=math.round(opt.batchSize/10),
ppf=ppf
}
}
--[[multithreading]]--
if opt.nThread > 0 then
datasource:multithread(opt.nThread)
train:sampler():async()
valid:sampler():async()
end
--[[Experiment]]--
xp = dp.Experiment{
model = model,
optimizer = train,
validator = valid,
observer = {
dp.FileLogger(),
dp.EarlyStopper{
error_report = {'validator','feedback','topcrop','all',5},
maximize = true,
max_epochs = opt.maxTries
}
},
random_seed = os.time(),
max_epoch = opt.maxEpoch
}
--[[GPU or CPU]]--
if opt.cuda then
require 'cutorch'
require 'cunn'
cutorch.setDevice(opt.useDevice)
xp:cuda()
end
print"nn.Modules :"
print(model:toModule(datasource:trainSet():sub(1,32)))
xp:run(datasource)
|
local Modules = game:GetService("Players").LocalPlayer.PlayerGui.AvatarEditorInGame.Modules
local Cryo = require(Modules.Packages.Cryo)
local Roact = require(Modules.Packages.Roact)
local withLocalization = require(Modules.Packages.Localization.withLocalization)
return function(props)
return withLocalization({
localizedText = props.Text,
})(function(localized)
return Roact.createElement("TextButton", Cryo.Dictionary.join(props, {
Text = localized.localizedText,
}))
end)
end
|
local scene = {}
scene[1]=[[I am thou, and thou art I...]]
scene[2]=[[Thou hast deepened the bond thou hast forged of the ]]..state.context.arcana..[[ arcana...]]
scene[3]=[[This is now truly a bond woven within your soul.]]
scene[4]=[[With the aid of the ]]..state.context.main_link_char..[[, you were able to unlock the full potential of the ]]..state.context.pseudoname..[[ Social Link.]]
scene[5]=[[You now have the ability to fuse ]]..state.context.finalpersona..[[, the ultimate form of the ]]..state.context.arcana..[[ arcana.]]
return scene
|
local function first()
return "first"
end
local function second(arg1)
outputChatBox(arg1)
return "second"
end
local function third(arg1)
outputChatBox(arg1)
return "third", "fourth"
end
local function finished(arg1, arg2)
outputChatBox(arg1)
outputChatBox(arg2)
outputChatBox("Pipey example finished")
end
local Pipey = loadstring(getPipey())()
Pipey
:pipe(first)
:pipe(second)
:pipe(third)
:pipe(finished)
Pipey:process()
|
--Function to get nuget
fs.makeDir("lib")
if fs.exists("lib/genlib") == false then
shell.run("wget","https://raw.githubusercontent.com/augustclear/ComputerCraft/main/Utilities/genlib.lua","lib/genlib")
end
local gl = require("lib.genlib")
--Calls to get file
gl.nuget("https://raw.githubusercontent.com/augustclear/ComputerCraft/main/Utilities/genlib.lua","lib/genlib")
gl.nuget("https://raw.githubusercontent.com/augustclear/ComputerCraft/main/Manager/managerlib.lua","lib/managerlib")
gl.nuget("https://raw.githubusercontent.com/augustclear/ComputerCraft/main/Manager/managerbg.lua","managerbg")
gl.nuget("https://raw.githubusercontent.com/augustclear/ComputerCraft/main/Manager/managerfg.lua","managerfg")
term.clear()
term.setCursorPos(1,1)
--Setup Commands
manlib = require("lib.managerlib")
manlib.init()
--Files to run
shell.openTab("managerbg")
shell.openTab("managerfg")
|
-- This is the entry-point to your game mode and should be used primarily to precache models/particles/sounds/etc
require('internal/util')
require('junglenational')
function Precache( context )
--[[
This function is used to precache resources/units/items/abilities that will be needed
for sure in your game and that will not be precached by hero selection. When a hero
is selected from the hero selection screen, the game will precache that hero's assets,
any equipped cosmetics, and perform the data-driven precaching defined in that hero's
precache{} block, as well as the precache{} block for any equipped abilities.
See JungleNational:PostLoadPrecache() in junglenational.lua for more information
]]
DebugPrint("[JUNGLENATIONAL] Performing pre-load precache")
-- Particles can be precached individually or by folder
-- It it likely that precaching a single particle system will precache all of its children, but this may not be guaranteed
-- Models can also be precached by folder or individually
-- PrecacheModel should generally used over PrecacheResource for individual models
-- Sounds can precached here like anything else
-- Entire items can be precached by name
-- Abilities can also be precached in this way despite the name
-- Entire heroes (sound effects/voice/models/particles) can be precached with PrecacheUnitByNameSync
-- Custom units from npc_units_custom.txt can also have all of their abilities and precache{} blocks precached in this way
PrecacheUnitByNameSync("npc_dota_hero_enigma", context)
end
-- Create the game mode when we activate
function Activate()
GameRules.JungleNational = JungleNational()
GameRules.JungleNational:_InitJungleNational()
end
|
routine={MUSPOS=0,ppqPos=0,playing=true}
function routine:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
Routines = {}
function Routine(body,t)
local res = routine:new(t)
res.body = body
Routines[#Routines +1] = res
return res
end
function routine:Reset()
self.thread = coroutine.create(self.body)
--if Debugger then
--[[
self.thread = coroutine.create(function(...)
print("coroutine.running() is",coroutine.running(),debugger_hook)
debug.sethook(coroutine.running(),debug_hook,"l")
return self.body(...) end)
--]]
--debug.sethook(self.thread ,Debugger.debug_hook,"l")
--print"sethook to routine"
--else
-- self.thread = coroutine.create(self.body)
--end
self.co = function()
local code,res = coroutine.resume(self.thread)
if code then
return res
else
error(res,1)
end
end
--self.co = coroutine.wrap(self.body)
self.ppqPos = self.MUSPOS
self.prevppqPos = -math.huge
self.playing = true
--self.used=false
theMetro.queueEvent(self.ppqPos, self)
end
function routine:Pull()
if self.prevppqPos > (theMetro.oldppqPos + theMetro.frame )then --and self.used then
print("reset ppqPos" .. self.ppqPos .. " hostppqPos " .. theMetro.ppqPos .. " ",self.name)
print(self.prevppqPos ,theMetro.oldppqPos)
self:Reset()
end
if theMetro.playing > 0 then
while self.playing and theMetro.oldppqPos > self.ppqPos do
--local good,dur=coroutine.resume(self.co)
-- if not good then print("error en co ",dur) end
local dur=self.co()
if not dur then --coroutine.status(self.co) == "dead" then
if self.playing then
if self.doneAction then
self:doneAction()
end
print("se acabo: ",self.name)
end
self.playing = false
break
else
self.prevppqPos = self.ppqPos
self.ppqPos = self.ppqPos + dur
end
end
end
end
function routine:Play()
self:Pull()
if theMetro.playing == 0 then
return
end
--while theMetro.oldppqPos <= self.ppqPos and self.ppqPos < theMetro.ppqPos and self.playing do
--local good,dur=coroutine.resume(self.co)
--if not good then print("error en co ",dur) end
local dur = self.co()
if not dur then --coroutine.status(self.co) == "dead" then
if self.playing then
if self.doneAction then
self:doneAction()
end
print("se acabo: ",self.name)
end
self.playing = false
--break
else
self.prevppqPos = self.ppqPos
self.ppqPos = self.ppqPos + dur
theMetro.queueEvent(self.ppqPos, self)
end
--end
end
function routine:findMyName()
for k,v in pairs(_G) do
if v==self then return k end
end
return "unnamedCO"
end
table.insert(initCbCallbacks,function()
for i,v in ipairs(Routines) do
v.name = v.name or v:findMyName()
v:Reset()
end
end)
--[[
table.insert(onFrameCallbacks,function()
for i,v in ipairs(Routines) do
--print("onframe player:",v.name)
--coroutine.resume(v)
v:Play()
end
end)
--]]
|
--
-- app_jobs specification example
--
local spec_example = {
-- spec name
spec_name = "app_job_example",
-- pre-defined app jobs
app_jobs = {
{
name = "job_1",
dir = "/working/dir/",
env = "VAL1=AAA;VAL2=BBB;",
app = "$PWD/busy_app.out 10000",
},
{
name = "job_2",
dir = "/working/dir",
env = "",
app = "./busy_app.out 1000000",
},
{
name = "job_3",
dir = "/working/dir",
env = nil,
app = "./busy_app.out 100000",
},
},
-- for launch and monitor app jobs
jobs_scheduler = {
--
-- Pre-defined variables and functions, will overide same name
--
-- variables
--
-- * sched.v_app_jobs: user defined jobs, you can add new job in runtime
-- * sched.v_running_jobs: running jobs, with pid > 0, key is pid
-- * sched.v_running_job_count: running jobs count, valid in jos_monitor
--
--
-- functions
--
-- * sched.f_start_job( job ): start a new job, can run new job at runtime
-- * sched.f_kill_job( job, signal_number ): kill job
--
-- * sched.f_sleep( number ): sleep seconds
-- * sched.f_exit( code ): exit this program
--
--
-- User-defined functions [ MUST ]
--
-- * sched.jobs_launch( sched ): run only once at the beginning
-- * sched.jobs_monitor( sched ): get job running status before running, loop forever
--
v_my_pre_defined_value = 123456,
v_my_pre_defined_timeout = 20,
f_my_print = function(fmt, ...)
print(string.format(fmt, ...))
end,
-- run only once, param 'sched' was jobs_scheduler
jobs_launch = function ( sched )
sched.f_my_print("my pre-defined value: %d", sched.v_my_pre_defined_value)
sched.v_my_pre_defined_value = os.time()
-- you can reset job.env or job.path before .f_start_job
for _, job in ipairs(sched.v_app_jobs) do
job.dir = os.getenv("PWD")
sched.f_start_job( job )
sched.f_my_print("[%s] pid: %d", job.name, job.pid)
if job.name == "job_1" then
job.count = 0 -- create new value
sched.f_sleep( 1.5 )
end
end
end,
-- loop forever, will refresh job process status before running
jobs_monitor = function ( sched )
local time_out = false
sched.f_my_print("## --- monitor uptime %d, in <%s> --- ",
os.time() - sched.v_my_pre_defined_value, os.date("%c"))
for pid, job in pairs(sched.v_running_jobs) do
sched.f_my_print("[%s] cpu:%s, mem:%s", job.name, job.ps.cpu, job.ps.mem)
if job.name == "job_1" then
if job.count < sched.v_my_pre_defined_timeout then
job.count = job.count + 1
else
time_out = true
end
end
end
if sched.v_running_job_count<#sched.v_app_jobs or time_out then
sched.f_my_print("exit with running jobs count %d", sched.v_running_job_count)
sched.f_exit( 1 )
else
sched.f_sleep( 1.2 )
end
end,
}
}
return spec_example
|
gr_kittle = Creature:new {
customName = "Kittle",
socialGroup = "kittle",
faction = "",
level = 100,
chanceHit = 6.32,
damageMin = 500,
damageMax = 600,
baseXp = 1800,
baseHAM = 19000,
baseHAMmax = 26000,
armor = 1,
resists = {30,30,135,130,10,30,30,-1,-1},
meatType = "meat_herbivore",
meatAmount = 700,
--hideType = "",
--hideAmount = 700,
boneType = "bone_mammal",
boneAmount = 700,
milkType = "milk_wild",
milk = 780,
--tamingChance = 0.0000000,
ferocity = 2,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = PACK + STALKER + KILLER,
optionsBitmask = AIENABLED,
diet = HERBIVORE,
templates = {"object/mobile/kittle.iff"},
scale = 1.4,
lootGroups = {},
weapons = {},
conversationTemplate = "",
attacks = {
{"intimidationattack",""},
{"blindattack",""},
{"stunattack",""}
}
}
CreatureTemplates:addCreatureTemplate(gr_kittle, "gr_kittle")
|
function LuaModUpdates:ShowMultiRequiredAvailableMessage( req_mods )
local mods = clone(req_mods)
for k, v in pairs(mods) do
if not LuaModManager:AreModUpdatesEnable( v.identifier ) then
mods[k] = nil
end
end
if not (table.size(mods) > 0) then
return
end
local mod_names = ""
for k, v in pairs( mods ) do
local name = v.display_name
mod_names = mod_names .. " " .. name .. "\n"
end
local loc_table = { ["mods"] = mod_names }
local menu_title = managers.localization:text("base_mod_updates_show_multiple_require_available", loc_table)
local menu_message = managers.localization:text("base_mod_updates_show_multiple_require_available_message", loc_table)
local menu_options = {
-- [1] = {
-- text = managers.localization:text("base_mod_updates_update_all_now"),
-- callback = LuaModUpdates.DoUpdateAllModsNow,
-- },
[1] = {
text = managers.localization:text("base_mod_updates_open_update_manager"),
callback = LuaModUpdates.OpenUpdateManagerNode,
},
[2] = {
text = managers.localization:text("base_mod_required_update_later"),
is_cancel_button = true,
},
}
QuickMenu:new( menu_title, menu_message, menu_options, true )
end
function LuaModUpdates:ShowMultiUpdateAvailableMessage( mods )
local mod_names = ""
for k, v in pairs( mods ) do
local mod_definition = LuaModManager:GetMod( v.mod ).definition
local name = v.display_name or mod_definition[ LuaModManager.Constants.mod_name_key ]
mod_names = mod_names .. " " .. name .. "\n"
end
local loc_table = { ["mods"] = mod_names }
local menu_title = managers.localization:text("base_mod_updates_show_multiple_update_available", loc_table)
local menu_message = managers.localization:text("base_mod_updates_show_multiple_update_available_message", loc_table)
local menu_options = {
-- [1] = {
-- text = managers.localization:text("base_mod_updates_update_all_now"),
-- callback = LuaModUpdates.DoUpdateAllModsNow,
-- },
[1] = {
text = managers.localization:text("base_mod_updates_open_update_manager"),
callback = LuaModUpdates.OpenUpdateManagerNode,
},
[2] = {
text = managers.localization:text("base_mod_updates_update_later"),
is_cancel_button = true,
},
}
QuickMenu:new( menu_title, menu_message, menu_options, true )
end
function LuaModUpdates:ShowUpdateAvailableMessage( mod_tbl )
local loc_table = { ["mod_name"] = self:GetModFriendlyName(mod_tbl.identifier) }
local menu_title = managers.localization:text("base_mod_updates_show_update_available", loc_table)
local menu_message = managers.localization:text("base_mod_updates_show_update_available_message", loc_table)
local menu_options = {
[1] = {
text = managers.localization:text("base_mod_updates_update_mod_now", loc_table),
callback = function()
LuaModUpdates:OpenUpdateManagerNode()
LuaModUpdates.ForceDownloadAndInstallMod(mod_tbl.identifier)
end,
},
[2] = {
text = managers.localization:text("base_mod_updates_open_update_manager"),
callback = LuaModUpdates.OpenUpdateManagerNode,
},
[3] = {
text = managers.localization:text("base_mod_updates_open_update_notes"),
callback = LuaModUpdates.ShowModPatchNotes,
data = mod_tbl.identifier
},
[4] = {
text = managers.localization:text("base_mod_updates_update_later"),
is_cancel_button = true,
},
}
QuickMenu:new( menu_title, menu_message, menu_options, true )
end
function LuaModUpdates:ShowModRequiredMessage( mod_tbl )
if LuaModManager:AreModUpdatesEnable( mod_tbl.identifier ) then
local required_by = clone(mod_tbl.required_by)
table.remove(required_by, #required_by)
local loc_table = { ["req_mod_name"] = table.concat(required_by, ", ") .. " & " .. mod_tbl.required_by[#mod_tbl.required_by], ["mod_name"] = mod_tbl.display_name }
local menu_title = managers.localization:text("base_mod_updates_show_required_available", loc_table)
local menu_message = managers.localization:text(mod_tbl.optional and "base_mod_updates_show_required_available_optional_message" or "base_mod_updates_show_required_available_message", loc_table)
local menu_options = {
[1] = {
text = managers.localization:text("base_mod_required_update_mod_now", loc_table),
callback = function()
LuaModUpdates:OpenUpdateManagerNode()
LuaModUpdates.ForceDownloadAndInstallMod(mod_tbl.identifier)
end,
},
[2] = {
text = managers.localization:text("base_mod_updates_open_update_manager"),
callback = LuaModUpdates.OpenUpdateManagerNode,
},
[3] = {
text = managers.localization:text("base_mod_required_update_later"),
is_cancel_button = true,
},
}
QuickMenu:new( menu_title, menu_message, menu_options, true )
end
end
-- Updates menu
local mod_updates_menu = "base_lua_mod_updates_menu"
Hooks:Add("MenuManagerSetupCustomMenus", "Base_ModUpdatesMenu_SetupCustomMenus", function( menu_manager, nodes )
MenuHelper:NewMenu( mod_updates_menu )
end)
Hooks:Add("MenuManagerPopulateCustomMenus", "Base_ModUpdatesMenu_PopulateCustomMenus", function( menu_manager, nodes )
MenuCallbackHandler.mod_updates_update_all = function(self, item)
log("Update all mods")
end
MenuCallbackHandler.mod_updates_toggle_mod = function(self, item)
if item and item._parameters then
local mod_path = item._parameters.text_id:gsub("toggle_lua_auto_updates_", "")
if mod_path then
LuaModManager:SetModUpdatesState( mod_path, item:value() == "on" and true or false )
end
end
end
MenuCallbackHandler.mod_updates_check_mod = function(self, item)
if item and item._parameters then
local mod_path = item._parameters.text_id:gsub("button_check_for_updates_", "")
if mod_path then
LuaModUpdates:CheckForUpdates( function(updater, mods, required)
if not required then
LuaModUpdates:CheckModForUpdateAndShowOptions( mod_path )
end
end )
end
end
end
MenuCallbackHandler.mod_updates_download_mod = function(self, item)
if item and item._parameters then
local mod_path = item._parameters.text_id:gsub("button_check_for_updates_", "")
if mod_path then
LuaModUpdates.ForceDownloadAndInstallMod(mod_path)
LuaModManager:SetModUpdatesState( mod_path, true ) --Reset Notification state for now installed mod
end
end
end
local priority = ((#LuaModManager:UpdateChecks() * 3) + (table.size(LuaModManager:Required()) * 3))
local toggle_updates_loc_str = "toggle_lua_auto_updates_{0}"
local check_for_updates_loc_str = "button_check_for_updates_{0}"
--[[
MenuHelper:AddButton({
id = "lua_mods_update_all",
title = "base_mod_updates_update_all",
desc = "base_mod_updates_update_all_desc",
callback = "mod_updates_update_all",
menu_id = mod_updates_menu,
priority = priority + 3,
})
MenuHelper:AddDivider({
id = "lua_mods_update_divider_1",
size = 16,
menu_id = mod_updates_menu,
priority = priority + 1,
})
]]
for k, v in ipairs( LuaModManager:UpdateChecks() ) do
local mod_definition = v.mod and LuaModManager:GetMod( v.mod ).definition or nil
local mod_name = v.display_name or mod_definition and mod_definition[ LuaModManager.Constants.mod_name_key ]
local mod_name_table = { ["mod_name"] = mod_name }
local loc_toggle = toggle_updates_loc_str:gsub("{0}", v.identifier)
local loc_button = check_for_updates_loc_str:gsub("{0}", v.identifier)
LocalizationManager:add_localized_strings({
[loc_toggle] = managers.localization:text("base_mod_automically_check_for_updates", mod_name_table),
[loc_toggle .. "_desc"] = managers.localization:text("base_mod_automically_check_for_updates_desc", mod_name_table),
[loc_button] = managers.localization:text("base_mod_check_for_updates_now", mod_name_table),
[loc_button .. "_desc"] = managers.localization:text("base_mod_check_for_updates_now_desc", mod_name_table),
})
local toggle = MenuHelper:AddToggle({
id = "toggle_updates_" .. v.identifier,
title = loc_toggle,
desc = loc_toggle .. "_desc",
callback = "mod_updates_toggle_mod",
value = LuaModManager:AreModUpdatesEnable( v.identifier ),
menu_id = mod_updates_menu,
priority = priority,
})
MenuHelper:AddButton({
id = "button_check_for_updates_" .. v.identifier,
title = loc_button,
desc = loc_button .. "_desc",
callback ="mod_updates_check_mod",
menu_id = mod_updates_menu,
priority = priority - 1,
})
MenuHelper:AddDivider({
id = "divider_updates_" .. v.identifier,
size = 8,
menu_id = mod_updates_menu,
priority = priority - 2,
})
priority = priority - 3
end
for k, v in pairs( LuaModManager:Required() ) do
local mod_definition = v.mod and LuaModManager:GetMod( v.mod ).definition or nil
local mod_name = v.display_name or mod_definition and mod_definition[ LuaModManager.Constants.mod_name_key ]
local mod_name_table = { ["mod_name"] = mod_name }
local loc_toggle = toggle_updates_loc_str:gsub("{0}", v.identifier)
local loc_button = check_for_updates_loc_str:gsub("{0}", v.identifier)
LocalizationManager:add_localized_strings({
[loc_toggle] = managers.localization:text("base_mod_notify_required", mod_name_table),
[loc_toggle .. "_desc"] = managers.localization:text("base_mod_notify_required_desc", mod_name_table),
[loc_button] = managers.localization:text("base_mod_download_required_now", mod_name_table),
[loc_button .. "_desc"] = managers.localization:text("base_mod_download_required_now_desc", mod_name_table),
})
local toggle = MenuHelper:AddToggle({
id = "toggle_notification_" .. v.identifier,
title = loc_toggle,
desc = loc_toggle .. "_desc",
callback = "mod_updates_toggle_mod",
value = LuaModManager:AreModUpdatesEnable( v.identifier ),
menu_id = mod_updates_menu,
priority = priority,
})
MenuHelper:AddButton({
id = "button_check_for_updates_" .. v.identifier,
title = loc_button,
desc = loc_button .. "_desc",
callback = "mod_updates_download_mod",
menu_id = mod_updates_menu,
priority = priority - 1,
})
MenuHelper:AddDivider({
id = "divider_updates_" .. v.identifier,
size = 8,
menu_id = mod_updates_menu,
priority = priority - 2,
})
priority = priority - 3
end
end)
Hooks:Add("MenuManagerBuildCustomMenus", "Base_ModUpdatesMenu_BuildCustomMenus", function( menu_manager, nodes )
nodes[mod_updates_menu] = MenuHelper:BuildMenu( mod_updates_menu )
end)
-- Info Boxes
function LuaModUpdates:CheckModForUpdateAndShowOptions( mod_id )
log("[Updates] Checking for updates for mod: " .. mod_id)
for k, v in pairs( LuaModManager:UpdateChecks() ) do
if v.identifier == mod_id then
if v.update_required then
self:ShowModRequiresUpdate( mod_id )
else
self:ShowModUpToDate( mod_id )
end
end
end
end
function LuaModUpdates:ShowModUpToDate( mod_id )
local message_id = self:VerifyModIsDownloadable( mod_id ) and "base_mod_update_no_update_available" or "base_mod_update_no_update_available_no_data"
local mod_name_tbl = { ["mod_name"] = self:GetModFriendlyName( mod_id ) }
local title = managers.localization:text("base_mod_update_no_update_available_title", mod_name_tbl)
local message = managers.localization:text(message_id, mod_name_tbl)
local options = {}
if self:VerifyModIsDownloadable( mod_id ) then
local download_btn = {
text = managers.localization:text("base_mod_update_no_update_available_force"),
callback = LuaModUpdates.ForceDownloadAndInstallMod,
data = mod_id
}
table.insert( options, download_btn )
end
local cancel_btn = {
text = managers.localization:text("dialog_ok"),
is_cancel_button = true
}
table.insert( options, cancel_btn )
QuickMenu:new( title, message, options, true )
end
function LuaModUpdates:ShowModRequiresUpdate( mod_id )
local mod_name_tbl = { ["mod_name"] = self:GetModFriendlyName( mod_id ) }
local title = managers.localization:text("base_mod_updates_update_mod_now", mod_name_tbl)
local message = managers.localization:text("base_mod_update_update_available", mod_name_tbl)
local options = {
[1] = {
text = managers.localization:text("base_mod_updates_update_now"),
callback = LuaModUpdates.ForceDownloadAndInstallMod,
data = mod_id
},
[2] = {
text = managers.localization:text("base_mod_updates_open_update_notes"),
callback = LuaModUpdates.ShowModPatchNotes,
data = mod_id
},
[3] = {
text = managers.localization:text("base_mod_updates_update_later"),
is_cancel_button = true
}
}
QuickMenu:new( title, message, options, true )
end
function LuaModUpdates.ForceDownloadAndInstallMod( data )
LuaModUpdates:DownloadAndStoreMod( data )
end
function LuaModUpdates.ShowModPatchNotes( data )
local url = LuaModUpdates._updates_notes_url:gsub("{1}", data)
Steam:overlay_activate("url", url)
LuaModUpdates:ShowModRequiresUpdate( data )
end
|
fx_version 'adamant'
game 'gta5'
client_script "client.lua"
|
Name = "QuitOnEscapePressedSystem"
Group = BlackFox.ComponentSystemGroup.EndOfFrame
function update(dt)
if BlackFox.Input.isKeyDown(BlackFox.Input.KeyCode.Escape) == true then
print("Escape pressed")
application:quit()
end
end
|
--[[ Copyright (c) 2018 Optera
* Part of Re-Stack
*
* See LICENSE.md in the project directory for license information.
--]]
-- Ore Stack Size
SelectItemByEntity("resource", settings.startup["ReStack-ores"].value, "ore")
for _,recipe in pairs(data.raw.recipe) do
-- Plate stack size
if recipe.category == "smelting" then
SelectItemsByRecipeResult(recipe, settings.startup["ReStack-plates"].value, "smelting")
end
--Rocket Parts
if recipe.category == "rocket-building" then
SelectItemsByRecipeInput(recipe, settings.startup["ReStack-rocket-parts"].value, "rocket-part")
end
end
-- Science Packs
for _, tech in pairs(data.raw.technology) do
if tech.unit and tech.unit.ingredients then
add_from_item_array(tech.unit.ingredients, settings.startup["ReStack-science-pack"].value, "science-pack")
end
end
-- nuclear fuel category & waste products
for _,item in pairs(data.raw.item) do
if item.fuel_category == "nuclear" then
ReStack_Items[item.name] = {stack_size = settings.startup["ReStack-fuel-category-nuclear"].value, type = "fuel-category-nuclear"}
if item.burnt_result then
ReStack_Items[item.burnt_result] = {stack_size = settings.startup["ReStack-fuel-category-nuclear"].value, type = "fuel-category-nuclear"}
end
end
end
-- refined Uranium
ReStack_Items["uranium-235"] = {stack_size = settings.startup["ReStack-uranium"].value, type = "uranium"}
ReStack_Items["uranium-238"] = {stack_size = settings.startup["ReStack-uranium"].value, type = "uranium"}
-- Fuels by item name (coal = ore, rocket-fuel = rocket-parts)
ReStack_Items["wood"] = {stack_size = settings.startup["ReStack-wood"].value, type = "wood"}
ReStack_Items["solid-fuel"] = {stack_size = settings.startup["ReStack-solid-fuel"].value, type = "solid-fuel"}
ReStack_Items["nuclear-fuel"] = {stack_size = settings.startup["ReStack-nuclear-fuel"].value, type = "nuclear-fuel"}
-- Tiles - applied last to overwrite when wood or ore is directly used as floor
for _,item in pairs(data.raw.item) do
if item.place_as_tile and (Tile_Whitelist[item.name] or (settings.startup["ReStack-tiles-priority"].value or not ReStack_Items[item.name])) then
ReStack_Items[item.name] = {stack_size = settings.startup["ReStack-tiles"].value, type = "tile"}
end
end
|
Window = {
Title = "New Game",
Width = 1280,
Height = 720,
IsVsync = false
}
Log = {
IsLogEnabled = true,
ShowFPS = true -- Will not work if log is disabled
}
|
ManagedClass._generate = function(class) class._instances = {} class._elements = {} class.class = class end
ManagedClass._cleanUp = function(class, instance) for _, element in pairs(class._elements[instance] or {}) do destroyElement(element) end class._elements[instance] = {} end
ManagedClass._addElement = function(class, instance, element) if not class._elements[instance] then class._elements[instance] = {} end table.insert(class._elements[instance], element) end
ManagedClass._removeElement = function(class, instance, element) table.removevalue(class._elements[instance], element) end
function ManagedClass:addElement(...)
return self:getClass():_addElement(self, ...)
end
function ManagedClass:removeElement(...)
return self:getClass():_removeElement(self, ...)
end
|
--
-- Created by IntelliJ IDEA.
-- User: Kunkka Huang
-- Date: 16/12/29
-- Time: 上午10:12
-- To change this template use File | Settings | File Templates.
local util = {}
----------------------------------------- switch function -------------------------------------------------
-- function to simulate a switch
local function switch(t)
t.case = function(self, x, ...)
local f = self[x] or self.default
if f then
if type(f) == "function" then
return f(...)
else
error("case " .. tostring(x) .. " not a function")
end
end
return nil
end
return t
end
gk.exports.switch = switch
function string.starts(String, Start)
return string.sub(String, 1, string.len(Start)) == Start
end
function string.ends(String, End)
return End == '' or string.sub(String, -string.len(End)) == End
end
function math.shrink(f, bit)
if bit >= 1 and bit <= 6 then
local e = 1 / math.pow(10, bit + 1)
local v = math.pow(10, bit)
return math.round((f + e) * v) / v
elseif bit == 0.5 then
return math.floor(f * 2) / 2
elseif bit == 0 then
return math.round(f)
else
return f
end
end
function math.equal(f1, f2, bit)
return math.shrink(f1, bit) == math.shrink(f2, bit)
end
function string.replaceChar(str, index, char)
if index >= 1 and index <= str:len() then
str = index == 1 and char .. str:sub(2, str:len()) or (str:sub(1, index - 1) .. char .. str:sub(index + 1, str:len()))
end
return str
end
-- insert before the index
function string.insertChar(str, index, char)
if index >= 1 and index <= str:len() + 1 then
str = index == 1 and char .. str or (str:sub(1, index - 1) .. char .. str:sub(index, str:len()))
end
return str
end
-- insert char at index
function string.deleteChar(str, index)
if index >= 1 and index <= str:len() then
str = index == 1 and str:sub(2, str:len()) or (str:sub(1, index - 1) .. str:sub(index + 1, str:len()))
end
return str
end
string.toHex = function(s)
return string.gsub(s, "(.)", function(x) return string.format("%02X", string.byte(x)) end)
end
----------------------------------------- restart game -------------------------------------------------
util.onRestartGameCallbacks = util.onRestartGameCallbacks or {}
function util:registerOnRestartGameCallback(callback)
table.insert(self.onRestartGameCallbacks, callback)
end
util.beforeRestartGameCallbacks = util.beforeRestartGameCallbacks or {}
function util:registerBeforeRestartGameCallback(callback)
table.insert(self.beforeRestartGameCallbacks, callback)
end
function util:registerRestartGameCallback(callback)
util.restartGameCallback = callback
local platform = cc.Application:getInstance():getTargetPlatform()
if platform == cc.PLATFORM_OS_MAC and not util.restartLayer then
gk.log("init:registerRestartGameCallback")
util.restartLayer = cc.Layer:create()
util.restartLayer:retain()
local function onKeyReleased(keyCode, event)
if gk.focusNode then
return
end
local key = cc.KeyCodeKey[keyCode + 1]
-- gk.log("RestartLayer: onKeypad %s", key)
if key == "KEY_F1" then
-- debug mode, restart with current editing node
util:restartGame(1)
elseif key == "KEY_F2" then
-- release mode, restart with cureent entry
util:restartGame(2)
elseif key == "KEY_F3" then
-- release mode, restart with default entry
util:restartGame(0)
end
end
local listener = cc.EventListenerKeyboard:create()
listener:registerScriptHandler(onKeyReleased, cc.Handler.EVENT_KEYBOARD_RELEASED)
cc.Director:getInstance():getEventDispatcher():addEventListenerWithSceneGraphPriority(listener, util.restartLayer)
util.restartLayer:resume()
end
end
function util:restartGame(mode)
gk.log("===================================================================")
gk.log("===================== restart game ==========================")
gk.log("===================================================================")
if self.restartLayer then
self.restartLayer:release()
self.restartLayer = nil
end
gk.event:post("syncNow")
gk.event:init()
gk:increaseRuntimeVersion()
gk.scheduler:unscheduleAll()
for _, callback in ipairs(self.beforeRestartGameCallbacks) do
callback()
end
self.beforeRestartGameCallbacks = {}
local scene = cc.Scene:create()
cc.Director:getInstance():popToRootScene()
cc.Director:getInstance():replaceScene(scene)
scene:runAction(cc.CallFunc:create(function()
gk.log("removeResBeforeRestartGame")
for _, callback in ipairs(self.onRestartGameCallbacks) do
callback()
end
self.onRestartGameCallbacks = {}
gk.log("collect: lua mem -> %.2fMB", collectgarbage("count") / 1024)
collectgarbage("collect")
gk.log("after collect: lua mem -> %.2fMB", collectgarbage("count") / 1024)
if self.restartGameCallback then
self.restartGameCallback(mode)
end
end))
end
function util:registerOnErrorCallback(callback)
self.onErrorCallback = callback
end
function util:reportError(msg)
if util.onErrorCallback then
util.onErrorCallback(msg)
end
end
util.tags = util.tags and util.tags or {
drawTag = 0xFFF0,
drawParentTag = 0xFFF1,
labelTag = 0xFFF2,
boundsTag = 0xFFF3,
coordinateTag = 0xFFF4,
versionTag = 0xFFF5,
buttonOverlayTag = 0xFFF6,
dialogTag = 0xFFF7,
}
function util:isDebugNode(node)
local tag = node and node:getTag() or -1
return tag >= 0xFFF0 --table.indexof(table.values(util.tags), tag)
end
function util:isDebugTag(tag)
return tag and tag >= 0xFFF0
-- return table.indexof(table.values(util.tags), tag)
end
function util:clearDrawNode(node, tag)
if node then
local tg = tag or util.tags.drawTag
local draw = node:getChildByTag(tg)
if self:instanceof(node, "cc.ScrollView") then
return
-- draw = node:getContainer():getChildByTag(tg)
end
if draw then
draw:clear()
draw:stopAllActions()
end
-- parent
if node:getParent() then
node = node:getParent()
local tg = tag or util.tags.drawParentTag
local draw = node:getChildByTag(tg)
if self:instanceof(node, "cc.ScrollView") then
draw = node:getContainer():getChildByTag(tg)
end
local draw = node:getChildByTag(tg)
if draw then
draw:clear()
draw:stopAllActions()
end
end
end
end
function util:clearDrawLabel(node, tag)
local tg = tag or util.tags.labelTag
local label = node:getChildByTag(tg)
if label then
label:setString("")
end
end
function util:drawNode(node, c4f, tag)
local tg = tag or util.tags.drawTag
local draw = node:getChildByTag(tg)
if self:instanceof(node, "cc.ScrollView") then
draw = node:getContainer():getChildByTag(tg)
end
if draw then
draw:clear()
else
draw = cc.DrawNode:create()
if self:instanceof(node, "cc.ScrollView") then
node:add(draw, -1, tg)
else
node:add(draw, 99999, tg)
end
draw:setPosition(cc.p(0, 0))
end
local sx, sy = util:getGlobalScale(node)
local size = node:getContentSize()
-- bounds
draw:drawRect(cc.p(0.5, 0.5),
cc.p(0.5, size.height - 0.5),
cc.p(size.width - 0.5, size.height - 0.5),
cc.p(size.width - 0.5, 0.5), c4f and c4f or cc.c4f(1, 0.5, 1, 1))
-- anchor point
local p = node:getAnchorPoint()
p.x = p.x * size.width
p.y = p.y * size.height
if node:isIgnoreAnchorPointForPosition() then
p.x, p.y = 0, 0
end
draw:drawDot(p, sx ~= 0 and 1 / sx or 1, cc.c4f(1, 0, 0, 1))
if self:instanceof(node, "cc.ScrollView") then
-- bg
local p1 = cc.p(0, 0)
local p2 = cc.p(size.width, size.height)
draw:drawSolidRect(p1, p2, cc.c4f(0.68, 0.68, 0.68, 0.1))
end
if self:instanceof(node, "cc.ClippingRectangleNode") then
-- clipping rect
local rect = node:getClippingRegion()
draw:drawRect(cc.p(rect.x + 0.5, rect.y + 0.5),
cc.p(rect.x + rect.width - 0.5, rect.y + 0.5),
cc.p(rect.x + rect.width - 0.5, rect.y + rect.height - 0.5),
cc.p(rect.x + 0.5, rect.y + rect.height - 0.5), c4f and c4f or cc.c4f(155 / 255, 0, 0, 1))
end
if self:instanceof(node, "ccui.Scale9Sprite") then
-- capInsets
local rect = node:getCapInsets()
local sprite = node:getSprite()
local originSize = sprite:getSpriteFrame():getOriginalSize()
local size = node:getContentSize()
rect.y = originSize.height - rect.y - rect.height
rect.width = size.width - (originSize.width - rect.width)
rect.height = size.height - (originSize.height - rect.height)
self:drawSegmentRectOnNode(node, rect, 5, cc.c4f(1, 0, 0.5, 0.5), tg)
end
if self:instanceof(node, "DrawNode") and type(node.getMovablePoints) == "function" then
local ps = node:getMovablePoints()
for _, p in ipairs(ps) do
draw:drawPoint(p, 5, cc.c4f(1, 1, 0, 1))
draw:drawCircle(p, 10, 360, 50, false, c4f or cc.c4f(1, 1, 0, 0.2))
end
end
-- refresh draw, only in test mode
if DEBUG and not tag then
draw:stopAllActions()
draw:runAction(cc.Sequence:create(cc.DelayTime:create(1), cc.CallFunc:create(function()
util:drawNode(node, c4f)
end)))
end
-- draw parent
local tg = tag or util.tags.drawParentTag
if node:getParent() then
self:drawNodeBounds(node:getParent(), cc.c4f(0, 0, 255 / 255, 0.1), util.tags.drawParentTag)
end
return draw
end
function util:drawNodeBounds(node, c4f, tg)
local tg = tg or util.tags.boundsTag
local draw
if tg then
draw = node:getChildByTag(tg)
end
if not draw then
draw = cc.DrawNode:create()
if self:instanceof(node, "cc.ScrollView") then
node:add(draw, -1, tg)
else
if tg == util.tags.drawParentTag then
node:add(draw, -1, tg)
else
node:add(draw, 9999, tg)
end
end
draw:setPosition(cc.p(0, 0))
end
draw:clear()
local size = node:getContentSize()
-- bounds
draw:drawRect(cc.p(0.5, 0.5),
cc.p(0.5, size.height - 0.5),
cc.p(size.width - 0.5, size.height - 0.5),
cc.p(size.width - 0.5, 0.5), c4f and c4f or cc.c4f(0, 155 / 255, 1, 1))
return draw
end
function util:drawLabelOnNode(node, content, fontSize, pos, c3b, tag)
local tg = tag or util.tags.labelTag
local label = node:getChildByTag(tg)
if self:instanceof(node, "cc.ScrollView") then
label = node:getContainer():getChildByTag(tg)
end
if not label then
label = gk.create_label(content, gk.theme.font_font, fontSize and fontSize or 12)
node:add(label, 999, tg)
else
label:setString(content)
end
local size = node:getContentSize()
label:setPosition(pos and pos or cc.p(size.width, size.height))
gk.set_label_color(label, c3b and c3b or cc.c3b(0, 255, 0))
local sx, sy = util:getGlobalScale(node)
label:setScale(1 / sx)
end
function util:drawLineOnNode(node, p1, p2, c4f, tg)
local draw
if tg then
draw = node:getChildByTag(tg)
end
if not draw then
draw = cc.DrawNode:create()
node:add(draw, 999, tg)
draw:setPosition(cc.p(0, 0))
end
c4f = c4f or cc.c4f(1, 0, 1, 1)
draw:drawLine(p1, p2, c4f)
return draw
end
function util:drawSegmentRectOnNode(node, rect, radius, c4f, tg)
self:drawSegmentOnNode(node, cc.p(rect.x, rect.y), cc.p(rect.x + rect.width, rect.y), radius, c4f, tg)
self:drawSegmentOnNode(node, cc.p(rect.x + rect.width, rect.y), cc.p(rect.x + rect.width, rect.y + rect.height), radius, c4f, tg)
self:drawSegmentOnNode(node, cc.p(rect.x + rect.width, rect.y + rect.height), cc.p(rect.x, rect.y + rect.height), radius, c4f, tg)
self:drawSegmentOnNode(node, cc.p(rect.x, rect.y + rect.height), cc.p(rect.x, rect.y), radius, c4f, tg)
end
function util:drawSegmentOnNode(node, p1, p2, radius, c4f, tg)
local draw
if tg then
draw = node:getChildByTag(tg)
end
if not draw then
draw = cc.DrawNode:create()
node:add(draw, 999, tg)
draw:setPosition(cc.p(0, 0))
end
local dis = cc.pGetDistance(p1, p2)
local count = math.round(dis / radius)
for i = 1, count, 2 do
local pa = cc.pAdd(p1, cc.pMul(cc.pSub(p2, p1), (i - 1) / count))
local pb = cc.pAdd(p1, cc.pMul(cc.pSub(p2, p1), i / count))
draw:drawLine(pa, pb, c4f)
end
return draw
end
function util:drawDotOnNode(node, p, c4f, tg)
local draw
if tg then
draw = node:getChildByTag(tg)
end
if not draw then
draw = cc.DrawNode:create()
node:add(draw, 999, tg)
draw:setPosition(cc.p(0, 0))
end
local sx, sy = util:getGlobalScale(node)
draw:drawDot(p, sx ~= 0 and 1.5 / sx or 1.5, c4f or cc.c4f(1, 0, 0, 1))
return draw
end
function util:drawRectOnNode(node, p1, p2, p3, p4, c4f, tg)
local draw
if tg then
draw = node:getChildByTag(tg)
end
if not draw then
draw = cc.DrawNode:create()
node:add(draw, 999, tg)
draw:setPosition(cc.p(0, 0))
end
draw:drawRect(p1, p2, p3, p4, c4f or cc.c4f(1, 0, 0, 0.2))
return draw
end
function util:drawSolidRectOnNode(node, p1, p2, c4f, tg)
local draw
if tg then
draw = node:getChildByTag(tg)
end
if not draw then
draw = cc.DrawNode:create()
node:add(draw, 999, tg)
draw:setPosition(cc.p(0, 0))
end
draw:drawSolidRect(p1, p2, c4f or cc.c4f(1, 0, 0, 0.2))
return draw
end
function util:drawCircleOnNode(node, p, radius, c4f, tg)
local tg = tg or self.tags.drawTag
local draw
if tg then
draw = node:getChildByTag(tg)
end
if not draw then
draw = cc.DrawNode:create()
node:add(draw, 999, tg)
draw:setPosition(cc.p(0, 0))
end
draw:drawCircle(p, radius, 360, 50, false, c4f or cc.c4f(1, 0, 0, 0.2))
return draw
end
function util:drawNodeBg(node, c4f, tg)
local draw
if tg then
draw = node:getChildByTag(tg)
end
if not draw then
draw = cc.DrawNode:create()
node:add(draw, -1, tg)
draw:setPosition(cc.p(0, 0))
end
draw:clear()
local size = node:getContentSize()
draw:drawSolidRect(cc.p(0, 0), cc.p(size.width, size.height), c4f or cc.c4f(1, 1, 1, 1))
return draw
end
function util:getGlobalScale(node)
local scaleX, scaleY = 1, 1
local c = node
while c ~= nil do
scaleX = scaleX * c:getScaleX()
scaleY = scaleY * c:getScaleY()
c = c:getParent()
end
return scaleX, scaleY
end
function util:hitTest(node, touch)
local s = node:getContentSize()
if gk.util:instanceof(node, "cc.ScrollView") then
s = node:getViewSize()
end
local rect = { x = 0, y = 0, width = s.width, height = s.height }
local touchP = node:convertTouchToNodeSpace(touch)
return cc.rectContainsPoint(rect, touchP)
end
function util:stopActionByTagSafe(node, tag)
if node then
local action = node:getActionByTag(tag)
if action then
node:stopAction(action)
end
end
end
function util:isAncestorsVisible(node)
local c = node
while c ~= nil do
if not c:isVisible() then
return false
end
c = c:getParent()
end
return true
end
function util:isAncestorsType(node, type)
local c = node
while c ~= nil do
if self:instanceof(c, type) then
return true
end
c = c:getParent()
end
return false
end
function util:isAncestorsIgnore(node)
local c = node
while c ~= nil do
if c.__ignore then
return true
end
c = c:getParent()
end
return false
end
function util:getRootNode(node)
local c = node:getParent()
local root
while c ~= nil do
root = c
c = c:getParent()
end
return root
end
function util:isAncestorOf(ancestor, child)
local c = child
while c ~= nil do
if c == ancestor then
return true
end
c = c:getParent()
end
return false
end
function util:touchInNode(node, globalPoint)
local s = node:getContentSize()
local rect = { x = 0, y = 0, width = s.width, height = s.height }
local p = node:convertToNodeSpace(globalPoint)
return cc.rectContainsPoint(rect, p)
end
function util:setRecursiveCascadeOpacityEnabled(node, enabled)
node:setCascadeOpacityEnabled(enabled)
local children = node:getChildren()
for _, c in pairs(children) do
util:setRecursiveCascadeOpacityEnabled(c, enabled)
end
end
function util:setRecursiveCascadeColorEnabled(node, enabled)
node:setCascadeColorEnabled(enabled)
local children = node:getChildren()
for _, c in pairs(children) do
util:setRecursiveCascadeColorEnabled(c, enabled)
end
end
function util:table_eq(table1, table2)
local avoid_loops = {}
local function recurse(t1, t2)
-- compare value types
if type(t1) ~= type(t2) then return false end
-- Base case: compare simple values
if type(t1) ~= "table" then return t1 == t2 end
-- Now, on to tables.
-- First, let's avoid looping forever.
if avoid_loops[t1] then return avoid_loops[t1] == t2 end
avoid_loops[t1] = t2
-- Copy keys from t2
local t2keys = {}
local t2tablekeys = {}
for k, _ in pairs(t2) do
if type(k) == "table" then table.insert(t2tablekeys, k) end
t2keys[k] = true
end
-- Let's iterate keys from t1
for k1, v1 in pairs(t1) do
local v2 = t2[k1]
if type(k1) == "table" then
-- if key is a table, we need to find an equivalent one.
local ok = false
for i, tk in ipairs(t2tablekeys) do
if table_eq(k1, tk) and recurse(v1, t2[tk]) then
table.remove(t2tablekeys, i)
t2keys[tk] = nil
ok = true
break
end
end
if not ok then return false end
else
-- t1 has a key which t2 doesn't have, fail.
if v2 == nil then return false end
t2keys[k1] = nil
if not recurse(v1, v2) then return false end
end
end
-- if t2 has a key which t1 doesn't have, fail.
if next(t2keys) then return false end
return true
end
return recurse(table1, table2)
end
----------------------------------------- table -------------------------------------------------
local function spairs(t, order)
-- collect the keys
local keys = {}
for k in pairs(t) do keys[#keys + 1] = k
end
-- if order function given, sort by it by passing the table and keys a, b,
-- otherwise just sort the keys
if order then
table.sort(keys, function(a, b) return order(t, a, b)
end)
else
table.sort(keys)
end
-- return the iterator function
local i = 0
return function()
i = i + 1
if keys[i] then
return keys[i], t[keys[i]]
end
end
end
local function formatString(str, len)
local s = string.format("%s", str)
while string.len(s) < len do
s = s .. " "
end
return s
end
function util:tbl2string(obj)
if obj and type(obj) == "table" then
local log = "{\n"
for k, v in spairs(obj) do
if type(v) == "table" and v ~= obj then
-- log = log .. k .. " : " .. tbl2string(v) .. ",\n"
if table.nums(v) < 10 then
log = log .. formatString(k, 18) .. " : \n" .. util:tbl2string(v) .. ",\n"
else
log = log .. k .. " : " .. "{?}" .. "\n"
end
end
if type(v) ~= "function" and type(v) ~= "table" and type(v) ~= "userdata" then
log = log .. formatString(k, 18) .. " : " .. tostring(v) .. "\n"
end
end
log = log .. "}"
return log
else
return tostring(obj)
end
end
local iskindof_
iskindof_ = function(cls, name)
local __index = rawget(cls, "__index")
if type(__index) == "table" and rawget(__index, "__cname") == name then return true end
if rawget(cls, "__cname") == name then return true end
-- fix crash
if not __index then return false end
if type(__index) == "function" then return false end
-- fix crash
local __supers = rawget(__index, "__supers")
if not __supers then return false end
for _, super in ipairs(__supers) do
if iskindof_(super, name) then return true end
end
return false
end
function util:iskindof(classObj, classname)
if type(classObj) == "table" then
if classObj.__cname == classname then
return true
else
local mt = getmetatable(classObj)
if mt then
return iskindof_(mt, classname)
end
end
else
return false
end
end
function util:instanceof(obj, classname)
local t = type(obj)
if t ~= "table" and t ~= "userdata" then return false end
if obj.class and self:iskindof(obj.class, classname) then
return true
end
local mt
if t == "userdata" then
if tolua.iskindof(obj, classname) then return true end
mt = tolua.getpeer(obj)
else
mt = getmetatable(obj)
end
if mt then
return iskindof_(mt, classname)
end
return false
end
local function dump_value_(v)
if type(v) == "string" then
v = "\"" .. v .. "\""
end
return tostring(v)
end
function util:dump(value, description, nesting)
if type(nesting) ~= "number" then nesting = 4 end
local lookupTable = {}
local result = {}
local traceback = string.split(debug.traceback("", 2), "\n")
gk.log("dump from: " .. string.trim(traceback[3]))
local function dump_(value, description, indent, nest, keylen)
description = description or "<var>"
local spc = ""
if type(keylen) == "number" then
spc = string.rep(" ", keylen - string.len(dump_value_(description)))
end
if type(value) ~= "table" then
result[#result + 1] = string.format("%s%s%s = %s", indent, dump_value_(description), spc, dump_value_(value))
elseif lookupTable[tostring(value)] then
result[#result + 1] = string.format("%s%s%s = *REF*", indent, dump_value_(description), spc)
else
lookupTable[tostring(value)] = true
if nest > nesting then
result[#result + 1] = string.format("%s%s = *MAX NESTING*", indent, dump_value_(description))
else
result[#result + 1] = string.format("%s%s = {", indent, dump_value_(description))
local indent2 = indent .. " "
local keys = {}
local keylen = 0
local values = {}
for k, v in pairs(value) do
keys[#keys + 1] = k
local vk = dump_value_(k)
local vkl = string.len(vk)
if vkl > keylen then keylen = vkl end
values[k] = v
end
table.sort(keys, function(a, b)
if type(a) == "number" and type(b) == "number" then
return a < b
else
return tostring(a) < tostring(b)
end
end)
for i, k in ipairs(keys) do
dump_(values[k], k, indent2, nest + 1, keylen)
end
result[#result + 1] = string.format("%s}", indent)
end
end
end
dump_(value, description, " ", 1)
for i, line in ipairs(result) do
gk.log(line)
end
end
function util:floatEql(f1, f2)
local EPSILON = 0.00001
return ((f1 - EPSILON) < f2) and (f2 < (f1 + EPSILON))
end
function util:pointEql(p1, p2)
return self:floatEql(p1.x, p2.x) and self:floatEql(p1.y, p2.y)
end
function util:getBoundingBoxToScreen(node)
local p = node:convertToWorldSpace(cc.p(0, 0))
local bb = node:getContentSize()
local sx, sy = util:getGlobalScale(node)
bb.width = bb.width * sx
bb.height = bb.height * sy
return cc.rect(p.x, p.y, bb.width, bb.height)
end
function util:c4b2c4f(c4b)
return cc.c4f(c4b.r / 255, c4b.g / 255, c4b.b / 255, c4b.a / 255)
end
function util:addMouseMoveEffect(node, c4f)
if cc.Application:getInstance():getTargetPlatform() == cc.PLATFORM_OS_MAC and gk.mode ~= gk.MODE_RELEASE then
local listener = cc.EventListenerMouse:create()
listener:registerScriptHandler(function(touch, event)
if not node.noneMouseMoveEffect then
local location = touch:getLocationInView()
if gk.util:touchInNode(node, location) then
if not node.isFocus then
gk.util:drawNodeBounds(node, c4f or cc.c4f(1, 0.5, 0.5, 0.7), self.tags.boundsTag)
end
else
gk.util:clearDrawNode(node, self.tags.boundsTag)
end
end
end, cc.Handler.EVENT_MOUSE_MOVE)
node:getEventDispatcher():addEventListenerWithSceneGraphPriority(listener, node)
end
end
-- set 1 at pos, (pos = 1~32)
function util:setBit1(int32, pos)
return bit.bor(int32, bit.lshift(1, pos - 1))
end
-- set 0 at pos
function util:setBit0(int32, pos)
return bit.band(int32, 0xFFFFFFFF - bit.lshift(1, pos - 1))
end
-- is 1 at pos
function util:isBit1(int32, pos)
int32 = int32 or 0
local var = bit.lshift(1, pos - 1)
return bit.band(int32, var) == var
end
function util:alignNodes(node1, node2, gapX, centerX)
centerX = centerX or 0
local w1 = node1:getContentSize().width * node1:getScaleX()
local w2 = node2:getContentSize().width * node2:getScaleX()
node1:setAnchorPoint(0.5, node1:getAnchorPoint().y)
node2:setAnchorPoint(0.5, node1:getAnchorPoint().y)
local w = w1 + w2 + gapX
node1:setPositionX(centerX + w1 / 2 - w / 2)
node2:setPositionX(centerX + w / 2 - w2 / 2)
end
return util
|
require('History');
function Client_GameRefresh(game)
if(game.Us == nil)then
return;
end
--It appears that gamerefresh gets called before startgame, so this filters out a crash
if(Mod.PlayerGameData.Peaceoffers == nil)then
return;
end
if(Mod.PublicGameData.War[game.Us.ID] ==nil)then
UI.Alert("I identified a problem with the data structure of this mod. This could be based on the device you are running(it is a normal bug for some devices that run the standalone client). Try using a different device. If the bug consists, please contact the author of this mod(go to mod info and click the github link).");
return;
end
if(lastnachricht == nil)then
lastnachricht = "";
end
local Nachricht = "";
if(tablelength(Mod.PlayerGameData.Peaceoffers)>0)then
Nachricht = Nachricht .. "\n" .. 'You have ' .. tablelength(Mod.PlayerGameData.Peaceoffers) .. ' open peace offer';
end
if(tablelength(Mod.PlayerGameData.AllyOffers)>0)then
Nachricht = Nachricht .. "\n" .. 'You have ' .. tablelength(Mod.PlayerGameData.AllyOffers) .. ' open ally offer';
end
if(Mod.PlayerGameData.HasNewWar == true)then
Nachricht = Nachricht .. "\n" .. 'You seem to be in war with a new player. Please check out the diplomacy overview in the mod menu or check the bottom of the history of the last turn to find out with who. This means you can already attack each other in this turn.';
end
ShowAllHistory(game,Nachricht);
end
function tablelength(T)
if(T==nil)then
return "error";
end
local count = 0;
for _,elem in pairs(T)do
count = count + 1;
end
return count;
end
|
-- programme pour faire un test depuis de le webide
node.restart()
|
getglobal game
getfield -1 ReplicatedStorage
getfield -1 Weapons
getfield -1 Primary
getfield -1 ShockRifle
getglobal game
getfield -1 ReplicatedStorage
getfield -1 Remotes
getfield -1 StoreEquip
getfield -1 InvokeServer
pushvalue -2
pushstring Primary
pushvalue -8
pcall 3 0 0
emptystack
getglobal game
getfield -1 ReplicatedStorage
getfield -1 Weapons
getfield -1 Secondary
getfield -1 BeaconStudioSword
getglobal game
getfield -1 ReplicatedStorage
getfield -1 Remotes
getfield -1 StoreEquip
getfield -1 InvokeServer
pushvalue -2
pushstring Secondary
pushvalue -8
pcall 3 0 0
emptystack
getglobal game
getfield -1 ReplicatedStorage
getfield -1 Weapons
getfield -1 Special
getfield -1 BanHammer
getglobal game
getfield -1 ReplicatedStorage
getfield -1 Remotes
getfield -1 StoreEquip
getfield -1 InvokeServer
pushvalue -2
pushstring Secondary
pushvalue -8
pcall 3 0 0
emptystack
|
local t = require( "taptest" )
local endswithany = require( "endswithany" )
filename = "note.adoc"
t( endswithany( filename, { ".adoc", ".lua" } ), true )
t( endswithany( filename, { ".txt", ".lua" } ), false )
t()
|
_G.TURBO_SSL = true
local turbo = require('turbo')
local escape = require('turbo.escape')
local util = require('turbo.util')
local log = require('turbo.log')
local redis = require('turbo.3rdparty.resty.redis')
local coctx = require('turbo.coctx')
local io_loop = turbo.ioloop.instance()
local redis_exec = nil
do
local queue = {}
local redis_conn
local scheduled = false
local function process_queue()
while #queue > 0 do
local q = queue
queue = {}
for _, req in ipairs(q) do
req.ctx:finalize_context(redis_conn[req.cmd](redis_conn, unpack(req.args)))
end
end
scheduled = false
end
redis_exec = function()
error('redis connection is not established yet')
end
io_loop:add_callback(function()
redis_conn = redis.new()
redis_conn:set_timeout(1000)
redis_conn:connect("127.0.0.1", 6379)
redis_exec = function(cmd, ...)
local ctx = coctx.CoroutineContext(io_loop)
table.insert(queue, {
ctx = ctx,
cmd = cmd,
args = {...},
})
if not scheduled then
scheduled = true
io_loop:add_callback(process_queue)
end
return coroutine.yield(ctx)
end
end)
end
local RedisHandler = class("RedisHandler", turbo.web.RequestHandler)
function RedisHandler:get()
local key = self:get_argument('key', nil, true)
if key then
local res, err = redis_exec('get', key)
self:write(string.format('result: %s\nerr: %s\n', res, err))
end
end
turbo.web.Application({{"^/redis$", RedisHandler}}):listen(8090)
io_loop:start()
|
ESX = nil
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(0)
end
end)
RegisterCommand('departure', function(source, args)
ESX.TriggerServerCallback('nyco:getGroup', function(group)
if group == "superadmin" or group == "admin" or group == "mod" or group == "support" then
table.unpack(args)
local players = GetActivePlayers()
for i = 1, #players do
local currentplayer = players[i]
local ped = GetPlayerPed(currentpslayer)
if GetPlayerServerId(currentplayer) == tonumber(table.unpack(args)) then
TriggerServerEvent('reise', GetPlayerServerId(currentplayer), GetEntityCoords(PlayerPedId()).x, GetEntityCoords(PlayerPedId()).y, GetEntityCoords(PlayerPedId()).z)
end
end
else
ESX.ShowNotification("Immigration office: You are not responsible for it", false, true, nil)
end
end)
end)
RegisterNetEvent('reisetp')
AddEventHandler('reisetp', function(x,y,z)
local x = -1044.67
local y = -2749.51
local z = 21.36
SetEntityCoords(PlayerPedId(), x, y, z, 0, 0, 0, false)
ESX.ShowNotification("Welcome to Los Santos", false, true, nil)
end)
|
-- local parser_config = require "nvim-treesitter.parsers".get_parser_configs()
local treesitter = require('nvim-treesitter.configs')
--[[ parser_config.haskell = {
install_info = {
url = "~/path/to/tree-sitter-haskell",
files = {"src/parser.c", "src/scanner.cc"}
}
} ]]
treesitter.setup {
ensure_installed = "all",
highlight = {
enable = true,
disable = { "haskell" }
}
}
|
---=====================================
---luastg screen
---=====================================
----------------------------------------
---screen
---@class screen
screen={}
function ResetScreen()
if setting.resx>setting.resy then
screen.width=640
screen.height=480
--[[
screen.scale=setting.resy/screen.height
screen.dx=(setting.resx-screen.scale*screen.width)*0.5
screen.dy=0
--]]
---[[
screen.hScale=setting.resx/screen.width
screen.vScale=setting.resy/screen.height
screen.resScale=setting.resx/setting.resy
screen.scale=math.min(screen.hScale,screen.vScale)
if screen.resScale>=(screen.width/screen.height) then
screen.dx=(setting.resx-screen.scale*screen.width)*0.5
screen.dy=0
else
screen.dx=0
screen.dy=(setting.resy-screen.scale*screen.height)*0.5
end
--]]
lstg.scale_3d=0.007*screen.scale
ResetWorld()
ResetWorldOffset()
else
--用于启动器
screen.width=396
screen.height=528
screen.scale=setting.resx/screen.width
screen.dx=0
screen.dy=(setting.resy-screen.scale*screen.height)*0.5
lstg.scale_3d=0.007*screen.scale
lstg.world={l=-192,r=192,b=-224,t=224,boundl=-224,boundr=224,boundb=-256,boundt=256,scrl=6,scrr=390,scrb=16,scrt=464,pl=-192,pr=192,pb=-224,pt=224}
SetBound(lstg.world.boundl,lstg.world.boundr,lstg.world.boundb,lstg.world.boundt)
ResetWorldOffset()
end
end
function ResetScreen2()
if setting.resx>setting.resy then
screen.width=640
screen.height=480
--[[
screen.scale=setting.resy/screen.height
screen.dx=(setting.resx-screen.scale*screen.width)*0.5
screen.dy=0
--]]
---[[
screen.hScale=setting.resx/screen.width
screen.vScale=setting.resy/screen.height
screen.resScale=setting.resx/setting.resy
screen.scale=math.min(screen.hScale,screen.vScale)
if screen.resScale>=(screen.width/screen.height) then
screen.dx=(setting.resx-screen.scale*screen.width)*0.5
screen.dy=0
else
screen.dx=0
screen.dy=(setting.resy-screen.scale*screen.height)*0.5
end
--]]
lstg.scale_3d=0.007*screen.scale
else
--用于启动器
screen.width=396
screen.height=528
screen.scale=setting.resx/screen.width
screen.dx=0
screen.dy=(setting.resy-screen.scale*screen.height)*0.5
lstg.scale_3d=0.007*screen.scale
end
end
local RAW_DEFAULT_WORLD={--默认的world参数,只读
l=-192,r=192,b=-224,t=224,
boundl=-224,boundr=224,boundb=-256,boundt=256,
scrl=32,scrr=416,scrb=16,scrt=464,
pl=-192,pr=192,pb=-224,pt=224,
world=15,
}
local DEFAULT_WORLD={--默认的world参数,可更改
l=-192,r=192,b=-224,t=224,
boundl=-224,boundr=224,boundb=-256,boundt=256,
scrl=32,scrr=416,scrb=16,scrt=464,
pl=-192,pr=192,pb=-224,pt=224,
world=15,
}
---用于设置默认world参数
function OriginalSetDefaultWorld(l,r,b,t,bl,br,bb,bt,sl,sr,sb,st,pl,pr,pb,pt,m)
local w={}
w.l=l
w.r=r
w.b=b
w.t=t
w.boundl=bl
w.boundr=br
w.boundb=bb
w.boundt=bt
w.scrl=sl
w.scrr=sr
w.scrb=sb
w.scrt=st
w.pl=pl
w.pr=pr
w.pb=pb
w.pt=pt
w.world=m
DEFAULT_WORLD=w
end
function SetDefaultWorld(l,b,w,h,bound,m)
OriginalSetDefaultWorld(
--l,r,b,t,
(-w/2),(w/2),(-h/2),(h/2),
--bl,br,bb,bt,
(-w/2)-bound,(w/2)+bound,(-h/2)-bound,(h/2)+bound,
--sl,sr,sb,st,
(l),(l+w),(b),(b+h),
--pl,pr,pb,pt
(-w/2),(w/2),(-h/2),(h/2),
--world mask
m
)
end
---用于重置world参数
function RawGetDefaultWorld()
local w={}
for k,v in pairs(RAW_DEFAULT_WORLD) do
w[k]=v
end
return w
end
function GetDefaultWorld()
local w={}
for k,v in pairs(DEFAULT_WORLD) do
w[k]=v
end
return w
end
function RawResetWorld()
local w={}
for k,v in pairs(RAW_DEFAULT_WORLD) do
w[k]=v
end
lstg.world=w
DEFAULT_WORLD=w
SetBound(lstg.world.boundl,lstg.world.boundr,lstg.world.boundb,lstg.world.boundt)
end
function ResetWorld()
local w={}
for k,v in pairs(DEFAULT_WORLD) do
w[k]=v
end
lstg.world=w
SetBound(lstg.world.boundl,lstg.world.boundr,lstg.world.boundb,lstg.world.boundt)
end
---用于设置world参数
function OriginalSetWorld(l,r,b,t,bl,br,bb,bt,sl,sr,sb,st,pl,pr,pb,pt,m)
local w=lstg.world
w.l=l
w.r=r
w.b=b
w.t=t
w.boundl=bl
w.boundr=br
w.boundb=bb
w.boundt=bt
w.scrl=sl
w.scrr=sr
w.scrb=sb
w.scrt=st
w.pl=pl
w.pr=pr
w.pb=pb
w.pt=pt
w.world=m
end
function SetWorld(l,b,w,h,bound,m)
bound=bound or 32
m = m or 15
OriginalSetWorld(
--l,r,b,t,
(-w/2),(w/2),(-h/2),(h/2),
--bl,br,bb,bt,
(-w/2)-bound,(w/2)+bound,(-h/2)-bound,(h/2)+bound,
--sl,sr,sb,st,
(l),(l+w),(b),(b+h),
--pl,pr,pb,pt
(-w/2),(w/2),(-h/2),(h/2),
--world mask
m
)
SetBound(lstg.world.boundl,lstg.world.boundr,lstg.world.boundb,lstg.world.boundt)
end
----------------------------------------
---3d
lstg.view3d={
eye={0,0,-1},
at={0,0,0},
up={0,1,0},
fovy=PI_2,
z={0,2},
fog={0,0,Color(0x00000000)},
}
function Reset3D()
lstg.view3d.eye={0,0,-1}
lstg.view3d.at={0,0,0}
lstg.view3d.up={0,1,0}
lstg.view3d.fovy=PI_2
lstg.view3d.z={1,2}
lstg.view3d.fog={0,0,Color(0x00000000)}
end
function Set3D(key,a,b,c)
if key=='fog' then
a=tonumber(a or 0)
b=tonumber(b or 0)
lstg.view3d.fog={a,b,c}
return
end
a=tonumber(a or 0)
b=tonumber(b or 0)
c=tonumber(c or 0)
if key=='eye' then lstg.view3d.eye={a,b,c}
elseif key=='at' then lstg.view3d.at={a,b,c}
elseif key=='up' then lstg.view3d.up={a,b,c}
elseif key=='fovy' then lstg.view3d.fovy=a
elseif key=='z' then lstg.view3d.z={a,b}
end
end
----------------------------------------
---视口、投影等的转换和坐标映射
function SetViewMode(mode)
lstg.viewmode=mode
--lstg.scale_3d=((((lstg.view3d.eye[1]-lstg.view3d.at[1])^2+(lstg.view3d.eye[2]-lstg.view3d.at[2])^2+(lstg.view3d.eye[3]-lstg.view3d.at[3])^2)^0.5)*2*math.tan(lstg.view3d.fovy*0.5))/(lstg.world.scrr-lstg.world.scrl)
if mode=='3d' then
SetViewport(lstg.world.scrl*screen.scale+screen.dx,lstg.world.scrr*screen.scale+screen.dx,lstg.world.scrb*screen.scale+screen.dy,lstg.world.scrt*screen.scale+screen.dy)
SetPerspective(
lstg.view3d.eye[1],lstg.view3d.eye[2],lstg.view3d.eye[3],
lstg.view3d.at[1],lstg.view3d.at[2],lstg.view3d.at[3],
lstg.view3d.up[1],lstg.view3d.up[2],lstg.view3d.up[3],
lstg.view3d.fovy,(lstg.world.r-lstg.world.l)/(lstg.world.t-lstg.world.b),
lstg.view3d.z[1],lstg.view3d.z[2]
)
SetFog(lstg.view3d.fog[1],lstg.view3d.fog[2],lstg.view3d.fog[3])
SetImageScale(((((lstg.view3d.eye[1]-lstg.view3d.at[1])^2+(lstg.view3d.eye[2]-lstg.view3d.at[2])^2+(lstg.view3d.eye[3]-lstg.view3d.at[3])^2)^0.5)*2*math.tan(lstg.view3d.fovy*0.5))/(lstg.world.scrr-lstg.world.scrl))
elseif mode=='world' then
--设置视口
SetViewport(
lstg.world.scrl*screen.scale+screen.dx,
lstg.world.scrr*screen.scale+screen.dx,
lstg.world.scrb*screen.scale+screen.dy,
lstg.world.scrt*screen.scale+screen.dy
)
--计算world宽高和偏移
local offset=lstg.worldoffset
local world={
height=(lstg.world.t-lstg.world.b),--world高度
width=(lstg.world.r-lstg.world.l),--world宽度
}
world.setheight=world.height*(1/offset.vscale)--缩放后的高度
world.setwidth=world.width*(1/offset.hscale)--缩放后的宽度
world.setdx=offset.dx*(1/offset.hscale)--水平整体偏移
world.setdy=offset.dy*(1/offset.vscale)--垂直整体偏移
--计算world最终参数
world.l=offset.centerx-(world.setwidth/2)+world.setdx
world.r=offset.centerx+(world.setwidth/2)+world.setdx
world.b=offset.centery-(world.setheight/2)+world.setdy
world.t=offset.centery+(world.setheight/2)+world.setdy
--应用参数
--SetOrtho(lstg.world.l,lstg.world.r,lstg.world.b,lstg.world.t)
SetOrtho(world.l,world.r,world.b,world.t)
SetFog()
--SetImageScale((lstg.world.r-lstg.world.l)/(lstg.world.scrr-lstg.world.scrl))
SetImageScale(1)
elseif mode=='ui' then
--SetOrtho(0.5,screen.width+0.5,-0.5,screen.height-0.5)--f2d底层已经有修正
SetOrtho(0,screen.width,0,screen.height)
SetViewport(screen.dx,screen.width*screen.scale+screen.dx,screen.dy,screen.height*screen.scale+screen.dy)
SetFog()
SetImageScale(1)
else error('Invalid arguement.') end
end
function WorldToUI(x,y)
local w=lstg.world
return w.scrl+(w.scrr-w.scrl)*(x-w.l)/(w.r-w.l),w.scrb+(w.scrt-w.scrb)*(y-w.b)/(w.t-w.b)
end
function WorldToScreen(x,y)
local w=lstg.world
if setting.resx>setting.resy then
return (setting.resx-setting.resy*screen.width/screen.height)/2/screen.scale+w.scrl+(w.scrr-w.scrl)*(x-w.l)/(w.r-w.l),w.scrb+(w.scrt-w.scrb)*(y-w.b)/(w.t-w.b)
else
return w.scrl+(w.scrr-w.scrl)*(x-w.l)/(w.r-w.l),(setting.resy-setting.resx*screen.height/screen.width)/2/screen.scale+w.scrb+(w.scrt-w.scrb)*(y-w.b)/(w.t-w.b)
end
end
function ScreenToWorld(x,y)--该功能并不完善
local dx,dy=WorldToScreen(0,0)
return x-dx,y-dy
end
----------------------------------------
---world offset
---by ETC
---用于独立world本身的数据、world坐标系中心偏移和横纵缩放、world坐标系整体偏移
local DEFAULT_WORLD_OFFSET={
centerx=0,centery=0,--world中心位置偏移
hscale=1,vscale=1,--world横向、纵向缩放
dx=0,dy=0,--整体偏移
}
lstg.worldoffset={
centerx=0,centery=0,--world中心位置偏移
hscale=1,vscale=1,--world横向、纵向缩放
dx=0,dy=0,--整体偏移
}
---重置world偏移
function ResetWorldOffset()
lstg.worldoffset=lstg.worldoffset or {}
for k,v in pairs(DEFAULT_WORLD_OFFSET) do
lstg.worldoffset[k]=v
end
end
---设置world偏移
function SetWorldOffset(centerx,centery,hscale,vscale)
lstg.worldoffset.centerx=centerx
lstg.worldoffset.centery=centery
lstg.worldoffset.hscale=hscale
lstg.worldoffset.vscale=vscale
end
----------------------------------------
---init
ResetScreen()--先初始化一次,!!!注意不能漏掉这一步
|
-- Copyright (c) 2008 Mikael Lind
--
-- Permission is hereby granted, free of charge, to any person
-- obtaining a copy of this software and associated documentation
-- files (the "Software"), to deal in the Software without
-- restriction, including without limitation the rights to use,
-- copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following
-- conditions:
--
-- The above copyright notice and this permission notice shall be
-- included in all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-- OTHER DEALINGS IN THE SOFTWARE.
-- Inefficient heap implementation. To be replaced with a more efficient
-- implementation later.
Heap = {}
function Heap:new(before)
local heap = {__before = before}
setmetatable(heap, self)
self.__index = self
return heap
end
function Heap:push(value)
table.insert(self, value)
end
function Heap:pop()
if #self == 0 then
return nil
end
self:norm()
local result = self[1]
self[1] = table.remove(self)
return result
end
function Heap:peek()
if #self == 0 then
return nil
end
self:norm()
return self[1]
end
function Heap:norm()
table.sort(self, self.__before)
end
|
local m = {}
local unpack = table.unpack or unpack
function m.passthroughbuilder(recvmethods, sendmethods)
return function(method, transform)
return function(self, ...)
repeat
local isock = self.inner_sock
local ret = {isock[method](isock, ...)}
local status = ret[1]
local err = ret[2]
if err and (err == recvmethods[method] or err == sendmethods[method]) then
local kind = (err == recvmethods[method]) and "recvr" or (err == sendmethods[method]) and "sendr"
assert(kind, "about to yield on method that is niether recv nor send")
local recvr, sendr, rterr = coroutine.yield(kind == "recvr" and {self} or {},
kind == "sendr" and {self} or {},
self.timeout)
-- woken, unset waker
self.wakers[kind] = nil
if rterr then return nil --[[ TODO: value? ]], rterr end
if kind == "recvr" then
assert(recvr and #recvr == 1, "thread resumed without awaited socket or error (or too many sockets)")
assert(sendr == nil or #sendr == 0, "thread resumed with unexpected socket")
else
assert(recvr == nil or #recvr == 0, "thread resumed with unexpected socket")
assert(sendr and #sendr == 1, "thread resumed without awaited socket or error (or too many sockets)")
end
elseif status then
self.class = self.inner_sock.class
if transform then
return transform(unpack(ret))
else
return unpack(ret)
end
else
return unpack(ret)
end
until nil
end
end
end
function m.setuprealsocketwaker(socket, kinds)
kinds = kinds or {"sendr", "recvr"}
local kindmap = {}
for _,kind in ipairs(kinds) do kindmap[kind] = true end
socket.setwaker = function(self, kind, waker)
assert(kindmap[kind], "unsupported wake kind: "..tostring(kind))
self.wakers = self.wakers or {}
assert((not waker) or (not self.wakers[kind]),
tostring(kind).." waker already set, sockets can only block one thread per waker kind")
self.wakers[kind] = waker
end
socket._wake = function(self, kind, ...)
local wakers = self.wakers or {}
if wakers[kind] then
wakers[kind](...)
wakers[kind] = nil
return true
else
print("warning attempt to wake, but no waker set")
return false
end
end
end
return m
|
local S = mobs.intllib
-- Kitten by Jordach / BFD
mobs:register_mob("mobs_animal:kitten", {
stepheight = 0.6,
type = "animal",
specific_attack = {"mobs_animal:rat"},
damage = 1,
attack_type = "dogfight",
attack_animals = true, -- so it can attack rat
attack_players = false,
reach = 1,
passive = false,
hp_min = 5,
hp_max = 10,
armor = 200,
collisionbox = {-0.3, -0.3, -0.3, 0.3, 0.1, 0.3},
visual = "mesh",
visual_size = {x = 0.5, y = 0.5},
mesh = "mobs_kitten.b3d",
textures = {
{"mobs_kitten_striped.png"},
{"mobs_kitten_splotchy.png"},
{"mobs_kitten_ginger.png"},
{"mobs_kitten_sandy.png"},
},
makes_footstep_sound = false,
sounds = {
random = "mobs_kitten",
},
walk_velocity = 0.6,
run_velocity = 2,
runaway = true,
jump = false,
drops = {
{name = "farming:string", chance = 1, min = 1, max = 1},
},
water_damage = 1,
lava_damage = 5,
fear_height = 3,
animation = {
speed_normal = 42,
stand_start = 97,
stand_end = 192,
walk_start = 0,
walk_end = 96,
},
follow = {"mobs_animal:rat", "ethereal:fish_raw", "mobs_fish:clownfish", "mobs_fish:tropical"},
view_range = 8,
on_rightclick = function(self, clicker)
if mobs:feed_tame(self, clicker, 4, true, true) then return end
if mobs:protect(self, clicker) then return end
if mobs:capture_mob(self, clicker, 50, 50, 90, false, nil) then return end
end
})
local spawn_on = "default:dirt_with_grass"
if minetest.get_modpath("ethereal") then
spawn_on = "ethereal:grove_dirt"
end
mobs:spawn({
name = "mobs_animal:kitten",
nodes = {spawn_on},
neighbors = {"group:grass"},
min_light = 14,
interval = 60,
chance = 10000, -- 22000
min_height = 5,
max_height = 200,
day_toggle = true,
})
mobs:register_egg("mobs_animal:kitten", S("Kitten"), "mobs_kitten_inv.png", 0)
mobs:alias_mob("mobs:kitten", "mobs_animal:kitten") -- compatibility
|
local playerData = exports['cfx.re/playerData.v1alpha1']
local validMoneyTypes = {
bank = true,
cash = true,
}
local function getMoneyForId(playerId, moneyType)
return GetResourceKvpInt(('money:%s:%s'):format(playerId, moneyType)) / 100.0
end
local function setMoneyForId(playerId, moneyType, money)
local s = playerData:getPlayerById(playerId)
TriggerEvent('money:updated', {
dbId = playerId,
source = s,
moneyType = moneyType,
money = money
})
return SetResourceKvpInt(('money:%s:%s'):format(playerId, moneyType), math.tointeger(money * 100.0))
end
local function addMoneyForId(playerId, moneyType, amount)
local curMoney = getMoneyForId(playerId, moneyType)
curMoney += amount
if curMoney >= 0 then
setMoneyForId(playerId, moneyType, curMoney)
return true, curMoney
end
return false, 0
end
exports('addMoney', function(playerIdx, moneyType, amount)
amount = tonumber(amount)
if amount <= 0 or amount > (1 << 30) then
return false
end
if not validMoneyTypes[moneyType] then
return false
end
local playerId = playerData:getPlayerId(playerIdx)
local success, money = addMoneyForId(playerId, moneyType, amount)
if success then
Player(playerIdx).state['money_' .. moneyType] = money
end
return true
end)
exports('removeMoney', function(playerIdx, moneyType, amount)
amount = tonumber(amount)
if amount <= 0 or amount > (1 << 30) then
return false
end
if not validMoneyTypes[moneyType] then
return false
end
local playerId = playerData:getPlayerId(playerIdx)
local success, money = addMoneyForId(playerId, moneyType, -amount)
if success then
Player(playerIdx).state['money_' .. moneyType] = money
end
return success
end)
exports('getMoney', function(playerIdx, moneyType)
local playerId = playerData:getPlayerId(playerIdx)
return getMoneyForId(playerId, moneyType)
end)
-- player display bits
AddEventHandler('money:updated', function(data)
if data.source then
TriggerClientEvent('money:displayUpdate', data.source, data.moneyType, data.money)
end
end)
RegisterNetEvent('money:requestDisplay')
AddEventHandler('money:requestDisplay', function()
local source = source
local playerId = playerData:getPlayerId(source)
for type, _ in pairs(validMoneyTypes) do
local amount = getMoneyForId(playerId, type)
TriggerClientEvent('money:displayUpdate', source, type, amount)
Player(source).state['money_' .. type] = amount
end
end)
RegisterCommand('earn', function(source, args)
local type = args[1]
local amount = tonumber(args[2])
exports['money']:addMoney(source, type, amount)
end, true)
RegisterCommand('spend', function(source, args)
local type = args[1]
local amount = tonumber(args[2])
if not exports['money']:removeMoney(source, type, amount) then
print('you are broke??')
end
end, true)
|
--- RailSegmentBuilder
--- Builder Pattern constructor for a RailSegment
local RailSegment = require(script.Parent.RailSegment)
local MeshData = require(script.Parent.MeshData)
local root = script.Parent.Parent
local Builder = require(root.Builder)
local util = root.Util
local t = require(util.t)
local RailSegmentBuilder = {
ClassName = "RailSegmentBuilder";
}
RailSegmentBuilder.__index = RailSegmentBuilder
setmetatable(RailSegmentBuilder, Builder)
function RailSegmentBuilder.new()
local self = setmetatable(Builder.new(), RailSegmentBuilder)
self.BasePart = nil
self.Offset = Vector3.new()
self.Size = nil
self.Rotation = Vector3.new()
self.Horizontal = false
self.MeshData = nil
return self
end
-- makes sure everything is setup properly
-- runs an "any" check on the following properties
local BuilderCheck = Builder.Check({
"BasePart"
})
function RailSegmentBuilder:Build()
assert(BuilderCheck(self))
local size = self.Size
if size == nil then
size = self.BasePart.Size
end
return RailSegment.fromData({
Name = self.Name,
BasePart = self.BasePart,
Offset = self.Offset,
Size = size,
Rotation = self.Rotation,
Horizontal = self.Horizontal,
MeshData = self.MeshData,
})
end
function RailSegmentBuilder:WithBasePart(basePart)
assert(t.instanceIsA("BasePart")(basePart))
self.BasePart = basePart
return self
end
function RailSegmentBuilder:WithOffset(offset)
assert(t.Vector3(offset))
self.Offset = offset
return self
end
function RailSegmentBuilder:WithSize(size)
assert(t.Vector3(size))
self.Size = size
return self
end
function RailSegmentBuilder:WithRotation(rotation)
assert(t.Vector3(rotation))
self.Rotation = rotation
return self
end
function RailSegmentBuilder:WithHorizontal(value)
assert(t.boolean(value))
self.Horizontal = value
return self
end
function RailSegmentBuilder:WithMeshData(value)
assert(MeshData.IsData(value))
self.MeshData = value
return self
end
return RailSegmentBuilder
|
local skynet = require "skynet"
local sd = require "skynet.sharedata"
local mc = require "skynet.multicast"
local log = require "chestnut.skynet.log"
-- local json = require "rapidjson"
local servicecode = require "enum.servicecode"
local service = require "service"
local savedata = require "savedata"
local traceback = debug.traceback
local assert = assert
local records = {}
local CMD = {}
local SUB = {}
local function save_data()
log.info('record_mgr save data.')
end
function SUB.save_data()
save_data()
end
function CMD.start()
-- body
savedata.init {
command = SUB
}
savedata.subscribe()
return true
end
function CMD.init_data()
-- body
-- local pack = redis:get("tb_record")
-- if pack then
-- local data = json.decode(pack)
-- for k,v in pairs(data.records) do
-- records[tonumber(k)] = v
-- end
-- end
return true
end
function CMD.sayhi()
-- body
return true
end
function CMD.close()
-- body
save_data()
return true
end
function CMD.kill()
-- body
skynet.exit()
end
function CMD.load()
-- body
local idx = db:get(string.format("tb_count:%d:uid", const.RECORD_ID))
idx = math.tointeger(idx)
if idx > 1 then
local keys = db:zrange('tb_record', 0, -1)
for k,v in pairs(keys) do
zs:add(k, v)
end
for _,id in pairs(keys) do
local vals = db:hgetall(string.format('tb_record:%s', id))
local t = {}
for i=1,#vals,2 do
local k = vals[i]
local v = vals[i + 1]
t[k] = v
end
sd.new(string.format('tb_record:%s', id), t)
-- t = sd.query(string.format('tg_sysmail:%s', id))
end
end
end
function CMD.register(content, ... )
-- body
local id = db:incr(string.format("tb_count:%d:uid", const.RECORD_ID))
dbmonitor.cache_update(string.format("tb_count:%d:uid", const.RECORD_ID))
-- sd.new
local r = mgr:create(internal_id)
mgr:add(r)
r:insert_db()
end
function CMD.save_record(players, start_time, close_time, content, ... )
-- body
end
service.init {
name = '.RECORD_MGR',
command = CMD
}
|
local lush = require("lush")
local hsl = lush.hsl
-- palette
local palette = {
black = hsl("#252525"),
blue = hsl("#99bbdd"),
brown = hsl("#be9873"),
cyan = hsl("#99ddee"),
darkgrey = hsl("#333333"),
gold = hsl("#ffe766"),
green = hsl("#99bb99"),
grey = hsl(30, 10, 50),
lime = hsl("#dedd99"),
orange = hsl("#ffaa77"),
pink = hsl("#ffbbbb"),
purple = hsl("#dda0dd"),
rosybrown = hsl("#bc8f8f"),
-- salmon = hsl("#fcaca3"),
salmon = hsl("#ffbb99"),
white = hsl("#d9d9d9"),
yellow = hsl("#ffdd99"),
-- deep
deep_black = hsl("#000000"),
deep_cyan = hsl("#00ccff"),
deep_blue = hsl("#5555FF"),
deep_green = hsl("#006600"),
deep_teal = hsl("#008080"),
deep_grey = hsl("#393939"),
deep_darkgrey = hsl("#1a1a1a"),
deep_orange = hsl("#ff5555"),
deep_pink = hsl(340, 90, 66),
deep_purple = hsl("#991177"),
deep_rosybrown = hsl("#9a7372"),
deep_red = hsl("#770000"),
deep_salmon = hsl("#fa8072"),
deep_white = hsl("#ffffff"),
deep_yellow = hsl("#ffdd00"),
}
return palette
|
function CreateSoul(keys)
local caster = keys.caster
local target = keys.unit
local ability = keys.ability
if not target:IsHero() and
not target:IsCourier() and
target:GetTeamNumber() ~= caster:GetTeamNumber() and
not target:IsBoss() and
not target:IsChampion() and
not target:IsBuilding() then
local soul = CreateUnitByName("npc_shinobu_soul", target:GetAbsOrigin(), true, nil, nil, DOTA_TEAM_NEUTRALS)
soul:SetModel(target:GetModelName())
soul:SetOriginalModel(target:GetModelName())
soul:SetModelScale(target:GetModelScale())
soul:FindAbilityByName("shinobu_soul_unit"):SetLevel(1)
soul:SetBaseMaxHealth(target:GetMaxHealth())
soul:SetMaxHealth(target:GetMaxHealth())
soul:SetHealth(target:GetMaxHealth())
soul:SetBaseDamageMin(target:GetBaseDamageMin())
soul:SetBaseDamageMax(target:GetBaseDamageMax())
soul:SetBaseAttackTime(target:GetBaseAttackTime())
soul:SetAttackCapability(target:GetAttackCapability())
if target:GetLevel() > 1 then
soul:CreatureLevelUp(target:GetLevel() - 1)
end
soul.SpawnTime = GameRules:GetGameTime()
soul.DeathTime = GameRules:GetGameTime() + ability:GetAbilitySpecial("soul_duration")
end
end
function ChanceToKill(keys)
local caster = keys.caster
local target = keys.target
local ability = keys.ability
if not target:IsConsideredHero() and not target:IsMagicImmune() and not target:IsInvulnerable() and RollPercentage(ability:GetAbilitySpecial("chance_to_kill")) then
target:Kill(ability, caster)
end
end
function UpdateHealthTimer(keys)
local caster = keys.caster
if caster:IsAlive() then
if GameRules:GetGameTime() > caster.DeathTime then
caster:ForceKill(false)
else
caster:SetHealth(math.max(caster:GetMaxHealth() * (caster.DeathTime - GameRules:GetGameTime())/(caster.DeathTime - caster.SpawnTime), 1))
end
end
end
|
local route_115_meteor = DoorSlot("route_115", "meteor")
local route_115_meteor_hub = DoorSlotHub("route_115", "meteor", route_115_meteor)
route_115_meteor:setHubIcon(route_115_meteor_hub)
|
local score = {}
function score.draw(score, timeLeft)
local base_x = 1175
local base_y = 20
local limit = 150
local formatedTime = string.format('%d', timeLeft)
local formatedScore = string.format('%d poeng', score.correct - score.wrong)
love.graphics.setFont(bigFont)
love.graphics.setColor(0, 0, 0)
love.graphics.printf(formatedScore, base_x, base_y, limit, "right")
love.graphics.printf(formatedTime, base_x, bigFont:getHeight() + base_y, limit, "right")
end
return score
|
table.insert(
data.raw["technology"]["automation-2"].effects,
{type = "unlock-recipe",recipe = "burner-inserter-upgrade"}
)
|
--- === hs._asm.iokit ===
---
--- This module provides tools for querying macOS and hardware with the IOKit library.
local USERDATA_TAG = "hs._asm.iokit"
local module = require(USERDATA_TAG..".internal")
local objectMT = hs.getObjectMetatable(USERDATA_TAG)
local basePath = package.searchpath(USERDATA_TAG, package.path)
if basePath then
basePath = basePath:match("^(.+)/init.lua$")
if require"hs.fs".attributes(basePath .. "/docs.json") then
require"hs.doc".registerJSONFile(basePath .. "/docs.json")
end
end
local fnutils = require("hs.fnutils")
-- local log = require("hs.logger").new(USERDATA_TAG, require"hs.settings".get(USERDATA_TAG .. ".logLevel") or "warning")
-- private variables and methods -----------------------------------------
--- hs._asm.iokit.planes[]
--- Constant
--- A table of strings naming the registry planes defined when the module is loaded.
local _planes = {}
for _, v in pairs(module.root():properties().IORegistryPlanes) do
table.insert(_planes, v)
end
module.planes = ls.makeConstantsTable(_planes)
-- Public interface ------------------------------------------------------
module.serviceForRegistryID = function(id)
local matchCriteria = module.dictionaryMatchingRegistryID(id)
return matchCriteria and module.serviceMatching(matchCriteria) or nil
end
module.serviceForBSDName = function(name)
local matchCriteria = module.dictionaryMatchingBSDName(name)
return matchCriteria and module.serviceMatching(matchCriteria) or nil
end
module.serviceForName = function(name)
local matchCriteria = module.dictionaryMatchingName(name)
return matchCriteria and module.serviceMatching(matchCriteria) or nil
end
module.servicesForClass = function(class)
local matchCriteria = module.dictionaryMatchingClass(class)
return matchCriteria and module.servicesMatching(matchCriteria) or nil
end
module.servicesMatchingCriteria = function(value, plane)
if type(value) ~= "table" then value = { name = tostring(value) } end
plane = plane or "IOService"
assert(fnutils.contains(module.planes, plane), string.format("plane must be one of %s", table.concat(module.planes, ", ")))
local results = {}
local svcs = { module.root() }
while (#svcs ~= 0) do
local svc = table.remove(svcs, 1)
for _,v in ipairs(svc:childrenInPlane(plane)) do table.insert(svcs, v) end
local matches = true
for k, v in pairs(value) do
if k == "name" then
matches = svc:name():match(v) and true or false
elseif k == "class" then
matches = svc:class():match(v) and true or false
elseif k == "bundleID" then
matches = svc:bundleID():match(v) and true or false
elseif k == "properties" then
local props = svc:properties() or {}
for k2, v2 in pairs(v) do
if type(v2) == "string" and type(props[k2]) == "string" then
matches = props[k2]:match(v2) and true or false
else
matches = (props[k2] == v2)
end
if not matches then break end
end
else
matches = false
end
if not matches then break end
end
if matches then
table.insert(results, svc)
end
end
return results
end
objectMT.bundleID = function(self, ...)
return module.bundleIDForClass(self:class(...))
end
objectMT.superclass = function(self, ...)
return module.superclassForClass(self:class(...))
end
-- Return Module Object --------------------------------------------------
return module
|
local module = {}
local menubar = require("hs.menubar")
local timer = require("hs.timer")
local canvas = require("hs._asm.canvas")
local stext = require("hs.styledtext")
local screen = require("hs.screen")
local mouse = require("hs.mouse")
local settings = require("hs.settings")
local eventtap = require("hs.eventtap")
local USERDATA_TAG = "calendarMenu"
local log = require"hs.logger".new(USERDATA_TAG, settings.get(USERDATA_TAG .. ".logLevel") or "warning")
module.log = log
local visible = false
local cal = function(month, day, year, style, todayStyle)
local highlightToday = day and true or false
day = day or 1
style = style or {
font = { name = "Menlo", size = 12 },
color = { white = 0 },
}
todayStyle = todayStyle or { color = { red = 1 } }
local dayLabels = { "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" }
local monthLabels = {
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December",
}
local date = os.date("*t", os.time({ year = year, month = month, day = day }))
local monthStartsOn = os.date("*t", os.time({
year = date.year,
month = date.month,
day = 1,
})).wday - 1
local daysInMonth = os.date("*t", os.time({
year = date.year + (date.month == 12 and 1 or 0),
month = date.month == 12 and 1 or date.month + 1,
day = 1,
hour = 0, -- for some reason, lua defaults this to 12 if not set
}) - 1).day
local offSet = math.floor(10 - (string.len(monthLabels[date.month]) + 1 + string.len(tostring(date.year))) / 2)
local result = string.rep(" ", offSet) .. monthLabels[date.month] .. " " .. tostring(date.year) .. "\n"
result = result .. table.concat(dayLabels, " ") .. "\n"
result = result .. string.rep(" ", monthStartsOn)
local whereIsToday
for day = 1, daysInMonth, 1 do
if day == date.day then whereIsToday = #result end
result = result .. string.format("%2d", day)
monthStartsOn = (monthStartsOn + 1) % 7
if day ~= daysInMonth then
if monthStartsOn > 0 then
result = result .. " "
else
result = result .. "\n"
end
end
end
result = stext.new(result, style)
if highlightToday then
result = result:setStyle(todayStyle, whereIsToday + 1, whereIsToday + 2)
end
return result
end
local setMenuTitle = function()
local x = tonumber(os.date("%d"))
-- U+2460-2473 = 1 - 20, U+3251-325F = 21 - 35
module.menuUserdata:setTitle(utf8.char((x < 21 and 0x245F or 0x323C) + x))
end
local calendar = canvas.new{}
calendar[1] = {
action = "fill",
type = "rectangle",
roundedRectRadii = { xRadius = 15, yRadius = 15 },
fillColor = { alpha = .8 },
}
calendar[2] = {
id = "calendar",
type = "text",
trackMouseUp = true,
}
calendar[3] = {
id = "previous",
type = "text",
text = utf8.char(0x2190),
textFont = "Menlo",
textSize = 14,
textAlignment = "center",
textColor = { white = 1 },
frame = { x = 10, y = 8, h = 15, w = 15 },
trackMouseUp = true,
}
calendar[4] = {
id = "next",
type = "text",
text = utf8.char(0x2192),
textFont = "Menlo",
textSize = 14,
textAlignment = "center",
textColor = { white = 1 },
frame = { x = 10, y = 8, h = 15, w = 15 },
trackMouseUp = true,
}
local visDay, visMonth, visYear
local drawAt = function(visMonth, visDay, visYear)
local text = cal(visMonth, visDay, visYear, { font = { name = "Menlo", size = 11 }, color = { white = 1 } },
{ backgroundColor = { red = 1, blue = 1, green = 0, alpha = .6 } })
local size = calendar:minimumTextSize(text)
calendar:size{ w = size.w + 30, h = size.h + 30 }
calendar[2].frame = { x = 15, y = 10, w = size.w, h = size.h }
calendar[2].text = text
calendar[4].frame.x = 5 + size.w
end
local loadCalendar = function()
if visible then module.hideCalendar() end
require"hs.application".launchOrFocusByBundleID("com.apple.iCal")
end
calendar:mouseCallback(function(c, m, id, x, y)
if id == "previous" then
visDay = nil
visMonth = visMonth - 1
if visMonth < 1 then
visMonth = 12
visYear = visYear - 1
end
elseif id == "next" then
visDay = nil
visMonth = visMonth + 1
if visMonth > 12 then
visMonth = 1
visYear = visYear + 1
end
elseif id == "calendar" then
-- module.hideCalendar()
if eventtap.checkKeyboardModifiers().alt then
loadCalendar()
end
end
local t = os.date("*t")
if t.month == visMonth and t.year == visYear then
visDay = t.day
end
drawAt(visMonth, visDay, visYear)
end)
module.showCalendarAt = function(x, y)
visible = true
local t = os.date("*t")
visMonth, visDay, visYear = t.month, t.day, t.year
calendar:topLeft{ x = x, y = y }
drawAt(visMonth, visDay, visYear)
local frame = calendar:frame()
local screenFrame = screen.mainScreen():frame()
local offset = math.max(0, (frame.x + frame.w) - (screenFrame.x + screenFrame.w))
calendar:topLeft{ x = frame.x - offset, y = frame.y }
calendar:show()
end
module.hideCalendar = function()
calendar:hide()
visible = false
end
module.startCalendarMenu = function()
if not module.menuUserdata then
module.menuUserdata = menubar.new()
setMenuTitle()
module.menuUserdata:setClickCallback(function(mods)
setMenuTitle() -- just in case timer is off for some reason
if mods.alt then
loadCalendar()
else
if visible then
module.hideCalendar()
else
local mousePoint = mouse.getAbsolutePosition()
local x, y = mousePoint.x - 10, mousePoint.y
if module.menuUserdata:isInMenubar() then
y = screen.mainScreen():frame().y + 2
else
y = mousePoint.y + 12
end
module.showCalendarAt(x, y)
end
end
end)
-- it's low impact and trying to calculate midnight and running only then seemed prone
-- to random timer stoppage... should figure out someday, but not right now
module._timer = timer.doEvery(300, function()
if module.menuUserdata then
setMenuTitle()
else
module._timer:stop()
module._timer = nil
log.ef("rogue timer detected; timer stopped")
end
end)
else
log.wf("menu already instantiated")
end
end
module.stopCalendarMenu = function()
if module.menuUserdata then
calendar:hide()
module._timer:stop()
module._timer = nil
module.menuUserdata:delete()
module.menuUserdata = nil
else
log.wf("menu has not been instantiated")
end
end
if settings.get(USERDATA_TAG .. ".autoMenu") then
module.startCalendarMenu()
end
return module
|
talus_rot_mite_lair_neutral_small = Lair:new {
mobiles = {{"rot_mite",1}},
spawnLimit = 12,
buildingsVeryEasy = {"object/tangible/lair/base/poi_all_lair_insecthill_small.iff"},
buildingsEasy = {"object/tangible/lair/base/poi_all_lair_insecthill_small.iff"},
buildingsMedium = {"object/tangible/lair/base/poi_all_lair_insecthill_small.iff"},
buildingsHard = {"object/tangible/lair/base/poi_all_lair_insecthill_small.iff"},
buildingsVeryHard = {"object/tangible/lair/base/poi_all_lair_insecthill_small.iff"},
}
addLairTemplate("talus_rot_mite_lair_neutral_small", talus_rot_mite_lair_neutral_small)
|
execute._wrap_stack = {}
execute._finalizers = {}
|
object_mobile_amyva_vanew_ice_cream = object_mobile_shared_amyva_vanew_ice_cream:new {
}
ObjectTemplates:addTemplate(object_mobile_amyva_vanew_ice_cream, "object/mobile/amyva_vanew_ice_cream.iff")
|
--
local M = {}
---@param data mbg.MBGData
function M.Open(data)
local Center = require('game.mbg.Center')
local Batch = require('game.mbg.Batch')
local Force = require('game.mbg.Force')
local GlobalEvent = require('game.mbg.GlobalEvent')
local Layer = require('game.mbg.Layer')
local Main = require('game.mbg.Main')
local Time = require('game.mbg.Time')
Main.Available = true
Layer.clear()
Center.clear()
--History.clear()
Time.clear()
if data.GlobalEvents then
for i, e in ipairs(data.GlobalEvents) do
local globalEvent = GlobalEvent()
local Frame = e.Frame
table.insert(Time.GEcount, Frame - 1)
--globalEvent.gotocondition = e['1']
--globalEvent.gotoopreator = e['2']
--globalEvent.gotocvalue = e['3']
globalEvent.isgoto = e.JumpEnabled
globalEvent.gototime = e.JumpTimes
globalEvent.gotowhere = e.JumpTarget
--globalEvent.quakecondition = e['7']
--globalEvent.quakeopreator = e['8']
--globalEvent.quakecvalue = e['9']
globalEvent.isquake = e.VibrateEnabled
globalEvent.quaketime = e.VibrateTime
globalEvent.quakelevel = e.VibrateForce
--globalEvent.stopcondition = e['13']
--globalEvent.stopopreator = e['14']
--globalEvent.stopcvalue = e['15']
globalEvent.isstop = e.SleepEnabled
globalEvent.stoptime = e.SleepTime
globalEvent.stoplevel = e.SleepType
if #Time.GE < Frame then
for k = 1, Frame do
local globalEvent2 = GlobalEvent()
globalEvent2.gotocondition = -1
globalEvent2.quakecondition = -1
globalEvent2.stopcondition = -1
globalEvent2.stoplevel = -1
table.insert(Time.GE, globalEvent2)
end
end
Time.GE[Frame] = globalEvent
end
end
if data.Sounds then
--
end
if data.Center then
Center.Available = true
Center.x = data.Center.Position.X
Center.y = data.Center.Position.Y
local Motion = data.Center.Motion
if Motion then
Center.speed = Motion.Speed
Center.speedd = Motion.SpeedDirection
Center.aspeed = Motion.Acceleration
Center.aspeedd = Motion.AccelerationDirection
end
if data.Center.Events then
for _, v in ipairs(data.Center.Events) do
table.insert(Center.events, v)
end
end
else
Center.Available = false
end
Time.total = data.TotalFrame
for i = 1, 4 do
---@type mbg.Layer
local layerData = data['Layer' .. i]
if layerData then
local layer = Layer(layerData.Name, layerData.Life.Begin, layerData.Life.LifeTime)
for _, batchData in ipairs(layerData.BulletEmitters) do
local batch = Batch(batchData)
--table.insert(Layer.LayerArray[i].BatchArray, batch)
table.insert(layer.BatchArray, batch)
end
for _, laserData in ipairs(layerData.LazerEmitters) do
--
end
for _, maskData in ipairs(layerData.Masks) do
--
end
for _, rbData in ipairs(layerData.ReflexBoards) do
--
end
for _, forceData in ipairs(layerData.ForceFields) do
local force = Force(forceData)
table.insert(layer.ForceArray, force)
end
end
end
end
return M
|
pfUI:RegisterModule("uf_tukui", function ()
-- do not go further on disabled UFs
if C.unitframes.disable == "1" then return end
local default_border = C.appearance.border.default
if C.appearance.border.unitframes ~= "-1" then
default_border = C.appearance.border.unitframes
end
local pspacing = C.unitframes.player.pspace
local tspacing = C.unitframes.target.pspace
if C.unitframes.layout == "tukui" then
-- Player
pfUI.uf.player:UpdateFrameSize()
pfUI.uf.player:SetFrameStrata("LOW")
pfUI.uf.player:SetHeight(pfUI.uf.player:GetHeight() + 2*default_border + C.global.font_size + 2*default_border + pspacing)
pfUI.uf.player.caption = CreateFrame("Frame", "pfPlayerCaption", pfUI.uf.player)
pfUI.uf.player.caption:SetHeight(C.global.font_size + 2*default_border)
pfUI.uf.player.caption:SetPoint("BOTTOMRIGHT",pfUI.uf.player, "BOTTOMRIGHT",0, 0)
pfUI.uf.player.caption:SetPoint("BOTTOMLEFT",pfUI.uf.player, "BOTTOMLEFT",0, 0)
pfUI.uf.player.hpLeftText:SetParent(pfUI.uf.player.caption)
pfUI.uf.player.hpLeftText:ClearAllPoints()
pfUI.uf.player.hpLeftText:SetPoint("TOPLEFT",pfUI.uf.player.caption, "TOPLEFT", default_border, 1)
pfUI.uf.player.hpLeftText:SetPoint("BOTTOMRIGHT",pfUI.uf.player.caption, "BOTTOMRIGHT", -default_border, 0)
pfUI.uf.player.hpCenterText:SetParent(pfUI.uf.player.caption)
pfUI.uf.player.hpCenterText:ClearAllPoints()
pfUI.uf.player.hpCenterText:SetPoint("TOPLEFT",pfUI.uf.player.caption, "TOPLEFT", default_border, 1)
pfUI.uf.player.hpCenterText:SetPoint("BOTTOMRIGHT",pfUI.uf.player.caption, "BOTTOMRIGHT", -default_border, 0)
pfUI.uf.player.hpRightText:SetParent(pfUI.uf.player.caption)
pfUI.uf.player.hpRightText:ClearAllPoints()
pfUI.uf.player.hpRightText:SetPoint("TOPLEFT",pfUI.uf.player.caption, "TOPLEFT", default_border, 1)
pfUI.uf.player.hpRightText:SetPoint("BOTTOMRIGHT",pfUI.uf.player.caption, "BOTTOMRIGHT", -default_border, 0)
pfUI.castbar.player:SetAllPoints(pfUI.uf.player.caption)
UpdateMovable(pfUI.castbar.player)
CreateBackdrop(pfUI.uf.player.caption, default_border)
-- Target
pfUI.uf.target:UpdateFrameSize()
pfUI.uf.target:SetFrameStrata("LOW")
pfUI.uf.target:SetHeight(pfUI.uf.target:GetHeight() + 2*default_border + C.global.font_size + 2*default_border + tspacing)
pfUI.uf.target.caption = CreateFrame("Frame", "pfTargetCaption", pfUI.uf.target)
pfUI.uf.target.caption:SetHeight(C.global.font_size + 2*default_border)
pfUI.uf.target.caption:SetPoint("BOTTOMRIGHT",pfUI.uf.target,"BOTTOMRIGHT", 0, 0)
pfUI.uf.target.caption:SetPoint("BOTTOMLEFT",pfUI.uf.target,"BOTTOMLEFT", 0, 0)
pfUI.uf.target.hpLeftText:SetParent(pfUI.uf.target.caption)
pfUI.uf.target.hpLeftText:ClearAllPoints()
pfUI.uf.target.hpLeftText:SetPoint("TOPLEFT",pfUI.uf.target.caption, "TOPLEFT", default_border, 1)
pfUI.uf.target.hpLeftText:SetPoint("BOTTOMRIGHT",pfUI.uf.target.caption, "BOTTOMRIGHT", -default_border, 0)
pfUI.uf.target.hpCenterText:SetParent(pfUI.uf.target.caption)
pfUI.uf.target.hpCenterText:ClearAllPoints()
pfUI.uf.target.hpCenterText:SetPoint("TOPLEFT",pfUI.uf.target.caption, "TOPLEFT", default_border, 1)
pfUI.uf.target.hpCenterText:SetPoint("BOTTOMRIGHT",pfUI.uf.target.caption, "BOTTOMRIGHT", -default_border, 0)
pfUI.uf.target.hpRightText:SetParent(pfUI.uf.target.caption)
pfUI.uf.target.hpRightText:ClearAllPoints()
pfUI.uf.target.hpRightText:SetPoint("TOPLEFT",pfUI.uf.target.caption, "TOPLEFT", default_border, 1)
pfUI.uf.target.hpRightText:SetPoint("BOTTOMRIGHT",pfUI.uf.target.caption, "BOTTOMRIGHT", -default_border, 0)
pfUI.castbar.target:SetAllPoints(pfUI.uf.target.caption)
UpdateMovable(pfUI.castbar.target)
CreateBackdrop(pfUI.uf.target.caption, default_border)
end
end)
|
-- =============================================================
-- Copyright Roaming Gamer, LLC. 2008-2017 (All Rights Reserved)
-- =============================================================
-- admob_helpers.lua
-- =============================================================
--[[
Includes these functions:
admob_helpers.setID( os, adType, id ) - Set an id manually (do before init if at all).
admob_helpers.init( [delay] ) - Initialize ads with optional delay.
admob_helpers.showBanner( [ position [, targetingOptions ] ] ) - Show banner ad.
admob_helpers.showInterstitial( [ targetingOptions ] ) - Show interstitial ad.
admob_helpers.hide( ) - Hide any showing adMob ad.
admob_helpers.loadInterstitial( ) - Load an interstitial ad in preparation to show it.
admob_helpers.isInterstitialLoaded( ) - Returns 'true' if interstitial is loaded.
admob_helpers.bannerHeight( ) - Get height of (shown) banner ad.
admob_helpers.testStatus( phase ) - Returns true if phase has been triggered in listener.
admob_helpers.clearStatus( phase ) - Clear the flag for the named 'phase'
admob_helpers.setPhaseCB( phase [, cb [, once ] ] ) - Provide a special callback to execute when the
listener event 'phase' occurs. If once is set to 'true', the callback is called once then cleared.
--]]
-- =============================================================
-- =============================================================
local ads = require( "ads" )
-- ** IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT **
--
-- You must change this to 'false' before submitting your app to the store, but
-- you must leave it as 'true' while testing or you may get your account cancelled.
--
-- ** IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT IMPORTANT **
local isTestMode = true
local showingBanner = false
local debugLevel = 0
local function dPrint( level, ... )
if( level <= debugLevel ) then
print( unpack( arg ) )
end
end
local admob_helpers = {}
function admob_helpers.setDebugLevel( newLevel )
debugLevel = newLevel or 0
end
-- Place to store phase callback records [see: admob_helpers.setPhaseCB()]
--
local phaseCallbacks = {}
-- Special statuses (based on phases and other actions)
--[[
]]
local status = {}
admob_helpers.status = status
function admob_helpers.testStatus( phase )
return fnn(status[phase], false)
end
function admob_helpers.clearStatus( phase )
status[phase] = false
end
-- ==
-- Table of ids, separated by OS and type (banner or interstitial)
-- ==
local ids =
{
android =
{
banner = ANDROID_BANNER_ID,
interstitial = ANDROID_INTERSTITIAL_ID
},
ios =
{
banner = IOS_BANNER_ID,
interstitial = IOS_INTERSTITIAL_ID
},
}
-- ==
-- adMob Listener
-- ==
local function listener( event )
-- Extract base set of useful event details:
local isError = (event.isError == nil) and false or event.isError
local name = (event.name == nil) and "unknown" or event.name
local phase = (event.phase == nil) and "unknown" or event.phase
local provider = (event.provider == nil) and "unknown" or event.provider
dprint( 3, "AdMob Listener Event @ ", system.getTimer )
dPrint( 3, 'isError: ' .. tostring( isError ) .. '; name == "' .. tostring(name) .. '"; phase == "' .. tostring(phase) .. '"' )
-- Do something with the above details...
--
if( isError ) then
dPrint( 1, "AdMob is getting errors.")
for k,v in pairs( event ) do
dPrint( 1, k,v)
end
else
if( name == "adsRequest" ) then
-- Tip: These are checked for in the typical order they happen:
--
if( phase == "loaded" ) then
dPrint( 3, "We got an ad! We should be ready to show it.")
elseif( phase == "shown" ) then
dPrint( 3, "Ad started showing!")
elseif( phase == "refreshed" ) then
dPrint( 3, "Ad refreshed!")
end
status[phase or "error"] = true
local cb = phaseCallbacks[phase]
if( cb ) then
cb.cb(event)
if(cb.once) then
phaseCallbacks[phase] = nil
end
end
else
dPrint( 1, "Admob is getting a weird event.name value?! ==> " .. tostring( event.response ) )
for k,v in pairs( event ) do
dPrint( 1, k,v)
end
end
end
end
-- =============================================================
-- setID( os, adType, id ) - Set an id for a specific OS and ad type
--
-- os - 'android' or 'ios'
-- adType - 'banner' or 'interstitial'
-- id - Must be a valid ID
--
-- =============================================================
function admob_helpers.setID( os, adType, id )
ids[os][adType] = id
end
-- =============================================================
-- setPhaseCB( phase [, cb [, once]] ) - Set up custom callback/listener
-- to call when the named 'phase' occurs.
--
-- phase - String containing name of phase this callback goes with.
-- cb ('nil') - Callback (listener) function (see below for example.)
-- once ('true') - If 'true', callback is called once, then cleared automatically.
--
-- Example callback definition:
--
--[[
local function onInit( event )
print("Init phase completed!")
table.dump(event)
end
admob_helpers.setPhaseCB( "init", onInit, true )
]]
--
-- =============================================================
function admob_helpers.setPhaseCB( phase, cb, once )
once = fnn( once, true )
phaseCallbacks[phase] = (cb) and { cb = cb, once = once } or nil
end
-- =============================================================
-- init( [ delay ] ) - Initilize adMob ad network.
-- If delay is specified, wait 'delay' ms then
-- initialize.
--
-- https://docs.coronalabs.com/daily/plugin/ads-admob-v2/index.html
-- =============================================================
function admob_helpers.init( delay )
-- Set default delay if not provided
delay = delay or 0
-- A function that we may call immediately or with a delay
-- to do the initialization work.
local function doInit()
-- If on Android,
if( onAndroid ) then
-- and a interstial ID was provided, then init with it
if( ids.android.interstitial ) then
ads.init( "admob", ids.android.interstitial, listener )
-- otherwise see if a banner id was supplied and init with it
elseif( ids.android.banner ) then
ads.init( "admob", ids.android.banner, listener )
end
-- else if on iOS,
elseif( oniOS ) then
-- and a interstial ID was provided, then init with it
if( ids.ios.interstitial ) then
ads.init( "admob", ids.ios.interstitial, listener )
-- otherwise see if a banner id was supplied and init with it
elseif( ids.ios.banner ) then
ads.init( "admob", ids.ios.banner, listener )
end
end
end
-- Initialize immediately or wait a little while?
--
if( delay < 1 ) then
doInit()
else
timer.performWithDelay( delay, doInit )
end
end
-- =============================================================
-- showBanner() -- Show a banner if we can.
--
-- https://docs.coronalabs.com/daily/plugin/ads-admob-v2/show.html
-- =============================================================
function admob_helpers.showBanner( position, targetingOptions )
if( showingBanner ) then return end
-- Set default position if not provided
position = position or "top"
-- Set targetingOptions to blank table if not provided
targetingOptions = targetingOptions or {}
-- Set provider to admob
ads:setCurrentProvider("admob")
-- Configure the banner ad parameters
local xPos, yPos = display.screenOriginX, display.contentCenterY - display.actualContentHeight/2
local params
if( type(position) == "string" ) then
if( position == "top" ) then
xPos, yPos = display.screenOriginX, display.contentCenterY - display.actualContentHeight/2
else
xPos, yPos = display.screenOriginX, display.contentCenterY + display.actualContentHeight/2
end
else
xPos = position.xPos
yPos = position.yPos
end
if( onAndroid ) then
params =
{
x = xPos,
y = yPos,
appId = ids.android.banner,
targetingOptions = targetingOptions,
testMode = isTestMode
}
elseif( oniOS ) then
params =
{
x = xPos,
y = yPos,
appId = ids.ios.banner,
targetingOptions = targetingOptions,
testMode = isTestMode
}
end
showingBanner = true
ads.show( "banner", params )
end
-- =============================================================
-- showInterstitial() -- Show an interstitial if we can.
--
-- https://docs.coronalabs.com/daily/plugin/ads-admob-v2/show.html
-- =============================================================
function admob_helpers.showInterstitial( targetingOptions )
-- Set targetingOptions to blank table if not provided
targetingOptions = targetingOptions or {}
-- Set provider to admob
ads:setCurrentProvider("admob")
-- Configure the interstitial ad parameters
local params
if( onAndroid ) then
params =
{
appId = ids.android.interstitial,
targetingOptions = targetingOptions,
testMode = isTestMode
}
elseif( oniOS ) then
params =
{
appId = ids.ios.interstitial,
targetingOptions = targetingOptions,
testMode = isTestMode
}
end
ads.show( "interstitial", params )
end
-- =============================================================
-- loadInterstitial() -- Show an interstitial if we can.
--
-- https://docs.coronalabs.com/daily/plugin/ads-admob-v2/load.html
-- =============================================================
function admob_helpers.loadInterstitial( )
-- Set provider to admob
ads:setCurrentProvider("admob")
-- Configure the interstitial ad parameters
local params
if( onAndroid ) then
params =
{
appId = ids.android.interstitial,
testMode = isTestMode
}
elseif( oniOS ) then
params =
{
appId = ids.ios.interstitial,
testMode = isTestMode
}
end
ads.load( "interstitial", params )
end
-- =============================================================
-- isInterstitialLoaded() -- Checks if an interstitial is loaded
--
-- https://docs.coronalabs.com/daily/plugin/ads-admob-v2/isLoaded.html
-- =============================================================
function admob_helpers.isInterstitialLoaded( )
-- Set provider to admob
ads:setCurrentProvider("admob")
return ads.isLoaded( "interstitial" )
end
-- =============================================================
-- bannerHeight() -- Returns height of (shown) banner ad.
--
-- https://docs.coronalabs.com/daily/plugin/ads-admob-v2/height.html
-- =============================================================
function admob_helpers.bannerHeight( )
-- Set provider to admob
ads:setCurrentProvider("admob")
return ads.height()
end
-- =============================================================
-- hide() -- Hide ads.
--
-- https://docs.coronalabs.com/daily/plugin/ads-admob-v2/index.html
-- =============================================================
function admob_helpers.hide( )
-- Set provider to admob
ads:setCurrentProvider("admob")
showingBanner = false
return ads.hide()
end
return admob_helpers
|
-- This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
--
-- This file is compatible with Lua 5.3
local class = require("class")
require("kaitaistruct")
local stringstream = require("string_stream")
NavParentSwitchCast = class.class(KaitaiStruct)
function NavParentSwitchCast:_init(io, parent, root)
KaitaiStruct._init(self, io)
self._parent = parent
self._root = root or self
self:_read()
end
function NavParentSwitchCast:_read()
self.main = NavParentSwitchCast.Foo(self._io, self, self._root)
end
NavParentSwitchCast.Foo = class.class(KaitaiStruct)
function NavParentSwitchCast.Foo:_init(io, parent, root)
KaitaiStruct._init(self, io)
self._parent = parent
self._root = root or self
self:_read()
end
function NavParentSwitchCast.Foo:_read()
self.buf_type = self._io:read_u1()
self.flag = self._io:read_u1()
local _on = self.buf_type
if _on == 0 then
self._raw_buf = self._io:read_bytes(4)
local _io = KaitaiStream(stringstream(self._raw_buf))
self.buf = NavParentSwitchCast.Foo.Zero(_io, self, self._root)
elseif _on == 1 then
self._raw_buf = self._io:read_bytes(4)
local _io = KaitaiStream(stringstream(self._raw_buf))
self.buf = NavParentSwitchCast.Foo.One(_io, self, self._root)
else
self.buf = self._io:read_bytes(4)
end
end
NavParentSwitchCast.Foo.Zero = class.class(KaitaiStruct)
function NavParentSwitchCast.Foo.Zero:_init(io, parent, root)
KaitaiStruct._init(self, io)
self._parent = parent
self._root = root or self
self:_read()
end
function NavParentSwitchCast.Foo.Zero:_read()
self.branch = NavParentSwitchCast.Foo.Common(self._io, self, self._root)
end
NavParentSwitchCast.Foo.One = class.class(KaitaiStruct)
function NavParentSwitchCast.Foo.One:_init(io, parent, root)
KaitaiStruct._init(self, io)
self._parent = parent
self._root = root or self
self:_read()
end
function NavParentSwitchCast.Foo.One:_read()
self.branch = NavParentSwitchCast.Foo.Common(self._io, self, self._root)
end
NavParentSwitchCast.Foo.Common = class.class(KaitaiStruct)
function NavParentSwitchCast.Foo.Common:_init(io, parent, root)
KaitaiStruct._init(self, io)
self._parent = parent
self._root = root or self
self:_read()
end
function NavParentSwitchCast.Foo.Common:_read()
end
NavParentSwitchCast.Foo.Common.property.flag = {}
function NavParentSwitchCast.Foo.Common.property.flag:get()
if self._m_flag ~= nil then
return self._m_flag
end
self._m_flag = self._parent._parent.flag
return self._m_flag
end
|
--- IMPORTS ---
local Tunnel = module("vrp","lib/Tunnel")
local Proxy = module("vrp","lib/Proxy")
vRP = Proxy.getInterface("vRP")
PR = Tunnel.getInterface("PR_Lingerie")
--------------------------------------
--- TECELAR TECIDO, ETAPA 1 ---
--------------------------------------
--- LOCAIS PARA TECELAR ---
local tecelar1X = 714.82
local tecelar1Y = -967.65
local tecelar1Z = 30.4
local tecelar2X = 714.83
local tecelar2Y = -969.88
local tecelar2Z = 30.4
local tecelar3X = 714.78
local tecelar3Y = -972.16
local tecelar3Z = 30.4
local tecelar4X = 716.13
local tecelar4Y = -962.49
local tecelar4Z = 30.4
local tecelar5X = 718.92
local tecelar5Y = -962.53
local tecelar5Z = 30.4
Citizen.CreateThread(function()
while true do
interval = 2000
--- DEFINE O PED E X,Y,Z ---
local ped = PlayerPedId()
local x,y,z = table.unpack(GetEntityCoords(ped))
--- DEFINE O PROCESSO COMO FALSE ---
local processo = false
--- DISTANCE TECELAR 1 ---
local bowz1,cdz1 = GetGroundZFor_3dCoord(tecelar1X,tecelar1Y,tecelar1Z)
local distance1 = Vdist(tecelar1X,tecelar1Y,cdz1,x,y,z)
--- DISTANCE TECELAR 2 ---
local bowz2,cdz2 = GetGroundZFor_3dCoord(tecelar2X,tecelar2Y,tecelar2Z)
local distance2 = Vdist(tecelar2X,tecelar2Y,cdz2,x,y,z)
--- DISTANCE TECELAR 3 ---
local bowz3,cdz3 = GetGroundZFor_3dCoord(tecelar3X,tecelar3Y,tecelar3Z)
local distance3 = Vdist(tecelar3X,tecelar3Y,cdz3,x,y,z)
--- DISTANCE TECELAR 4 ---
local bowz4,cdz4 = GetGroundZFor_3dCoord(tecelar4X,tecelar4Y,tecelar4Z)
local distance4 = Vdist(tecelar4X,tecelar4Y,cdz4,x,y,z)
--- DISTANCE TECELAR 5 ---
local bowz5,cdz5 = GetGroundZFor_3dCoord(tecelar5X,tecelar5Y,tecelar5Z)
local distance5 = Vdist(tecelar5X,tecelar5Y,cdz5,x,y,z)
--- TECELAR ---
if distance1 <= 2 or distance2 <= 2 or distance3 <= 2 or distance4 <= 2 or distance5 <= 2 then
interval = 1000
SetTextComponentFormat('STRING');
AddTextComponentString('Pressione ~r~E~w~ para iniciar o tecelamento do tecido');
DisplayHelpTextFromStringLabel(0, false, true, -1);
if not processo and IsControlJustPressed(0,38) then
local checarmochila = PR.checarmochila()
if checarmochila then
processo = true
local ped = PlayerPedId()
FreezeEntityPosition(ped, true)
vRP._playAnim(false,{{"amb@prop_human_parking_meter@female@idle_a","idle_a_female"}},true)
Citizen.Wait(Config.TempoEtapa1)
PR.checartecido()
FreezeEntityPosition(ped, false)
vRP._stopAnim(false)
processo = false
end
end
end
Wait(interval)
end
end)
--------------------------------------
--- TROCA DO TECIDO, SEGUNDA ETAPA ---
--------------------------------------
--- lOCAL TROCA DO TECIDO ---
local TrocaTecidoX = -82.76
local TrocaTecidoY = -1398.99
local TrocaTecidoZ = 29.49
Citizen.CreateThread(function()
while true do
interval2 = 2000
--- DEFINE O PED E X,Y,Z ---
local ped = PlayerPedId()
local x,y,z = table.unpack(GetEntityCoords(ped))
--- DEFINE O PROCESSO COMO FALSE ---
local processo2 = false
--- DISTANCE DO PLAYER ---
local bowz,cdz = GetGroundZFor_3dCoord(TrocaTecidoX,TrocaTecidoY,TrocaTecidoZ)
local distance = Vdist(TrocaTecidoX,TrocaTecidoY,cdz,x,y,z)
if distance <= 2 then
interval2 = 5
SetTextComponentFormat('STRING');
AddTextComponentString('Pressione ~r~E~w~ para trocar tecido por lingerie.');
DisplayHelpTextFromStringLabel(0, false, true, -1);
if not processo and IsControlJustPressed(0,38) then
local checaritem = PR.checaritem()
if checaritem then
local checarmochila2 = PR.checarmochila2()
if checarmochila2 then
processo2 = true
PR.PegarTecido()
local ped = PlayerPedId()
FreezeEntityPosition(ped, true)
vRP._playAnim(false,{{"amb@prop_human_parking_meter@female@idle_a","idle_a_female"}},true)
Citizen.Wait(Config.TempoEtapa2)
PR.trocartecido()
FreezeEntityPosition(ped, false)
vRP._stopAnim(false)
processo2 = false
end
end
end
end
Wait(interval2)
end
end)
--------------------------------------
-- VENDA DO TECIDO, TERCEIRA PARTE ---
--------------------------------------
--- lOCAL VENDA DO TECIDO ---
local VendaTecidoX = -1336.34
local VendaTecidoY = -1276.69
local VendaTecidoZ = 4.89
Citizen.CreateThread(function()
while true do
interval3 = 2000
--- DEFINE O PED E X,Y,Z ---
local ped = PlayerPedId()
local x,y,z = table.unpack(GetEntityCoords(ped))
--- DEFINE O PROCESSO COMO FALSE ---
local processo3 = false
--- DISTANCE DO PLAYER ---
local bowz,cdz = GetGroundZFor_3dCoord(VendaTecidoX,VendaTecidoY,VendaTecidoZ)
local distance = Vdist(VendaTecidoX,VendaTecidoY,cdz,x,y,z)
if distance <= 2 then
interval3 = 5
SetTextComponentFormat('STRING');
AddTextComponentString('Pressione ~r~E~w~ para vender lingerie.');
DisplayHelpTextFromStringLabel(0, false, true, -1);
if not processo and IsControlJustPressed(0,38) then
if PR.checaritem2() and PR.PegarLingerie() then
PR.venderlingerie()
end
end
end
Wait(interval3)
end
end)
--- BLIPS (SE ATIVO) ---
if Config.Blips then
local blips = {
{title="Venda de Lingeries", colour=48, id=279, x = -1336.64, y = -1277.03, z = 4.89},
{title="Tecelagem", colour=48, id=279, x = 718.23, y = -977.35, z = 24.31},
{title="Trocar Tecido", colour=48, id=279, x = -82.76, y = -1398.99, z = 29.49}
}
Citizen.CreateThread(function()
for _, info in pairs(blips) do
info.blip = AddBlipForCoord(info.x, info.y, info.z)
SetBlipSprite(info.blip, info.id)
SetBlipDisplay(info.blip, 4)
SetBlipScale(info.blip, 0.7)
SetBlipColour(info.blip, info.colour)
SetBlipAsShortRange(info.blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString(info.title)
EndTextCommandSetBlipName(info.blip)
end
end)
end
|
package.path = package.path .. '; ..\\..\\?.lua; ..\\..\\src\\?.lua'
local ut = require('utest')
ut:group('nothing', function()
ut:test('temporary', function()
print("temp test")
end)
end, {'temp'})
|
function MenuRenderer:special_btn_released(...)
if self:active_node_gui() and self:active_node_gui().special_btn_released and self:active_node_gui():special_btn_released(...) then
return true
end
return managers.menu_component:special_btn_released(...)
end
|
-- © Optum 2018
-- Changed © andrey-tech 2020
local access = require "kong.plugins.kong-upstream-jwt-extended.access"
-- Changed © andrey-tech 2020
local KongUpstreamJWTExtendedHandler = {}
-- Changed © andrey-tech 2020
function KongUpstreamJWTExtendedHandler:access(conf)
access.execute(conf)
end
-- Changed © andrey-tech 2020
KongUpstreamJWTExtendedHandler.PRIORITY = 999 -- This plugin needs to run after auth plugins for `kong.client.get_consumer(), kong.client.get_credential()`
KongUpstreamJWTExtendedHandler.VERSION = "2.1.2"
-- Changed © andrey-tech 2020
return KongUpstreamJWTExtendedHandler
|
local mt = {
data = {}
}
mt.__index = mt
-- https://github.com/openresty/lua-nginx-module#ngxshareddict
-- get
-- get_stale
-- set
-- safe_set
-- add
-- safe_add
-- replace
-- delete
-- incr
-- lpush
-- rpush
-- lpop
-- rpop
-- llen
-- ttl
-- expire
-- flush_all
-- flush_expired
-- get_keys
-- capacity
-- free_space
function mt:set(key, value)
self.data[key] = value
end
function mt:incr(key, num)
local v = self.data[key]
if v then
self.data[key] = v + num
else
self.data[key] = num
end
end
function mt:safe_set(...)
self:set(...)
end
function mt:add(key, value, exptime, flags)
local v = self.data[key]
if v then
self.data[key] = v + value
else
self.data[key] = value
end
end
function mt:safe_add(...)
self:add(...)
return true
end
function mt:get_keys(max_count)
local count = 0
local tbl = {}
for k, _ in pairs(self.data or {}) do
table.insert(tbl, k)
if max_count > 0 then
count = count + 1
if count >= max_count then
break
end
end
end
return tbl
end
function mt:get(key)
return self.data[key]
end
local M = {}
local objs = {}
function M.new(dict_name)
local obj = objs[dict_name]
if not obj then
obj = setmetatable({}, mt)
objs[dict_name] = obj
end
return obj
end
function M.get(dict_name)
return objs[dict_name]
end
return M
|
-- Player.lua
-- Player Manager for Love Extension Library
-- Copyright (c) 2011 Robert MacGregor
local Player = { }
Player.DataBase = { } -- Instanced Player Objects
Player.PlayerDataBase = require("scripts/DataBase/Players.lua")
require("scripts/Vector.lua")
function Player.clear()
Player.DataBase = { }
end
function Player.getPlayer(id)
if (id > Player.getCount()) then
return nil
else
return Player.DataBase[id]
end
end
function Player.update(dt)
for i = 1, table.getn(Player.DataBase) do
local playerObject = Player.DataBase[i]
if (playerObject.update ~= nil) then
playerObject.update(dt, playerObject)
else
-- Do something here if you wish.
end
end
end
function Player.draw()
for i = 1, table.getn(Player.DataBase) do
local playerObject = Player.DataBase[i]
if (playerObject.draw ~= nil) then
playerObject.draw(playerObject)
else
-- Do something here if you wish.
end
end
end
function Player.getCount()
return table.getn(Player.DataBase)
end
function Player.getPlayer(id)
return Player.DataBase[id]
end
function Player.addPlayer(Def)
-- Make sure we got a valid definition
if (Def == nil) then
return nil -- Nope. Return nil to indicate a failure
end
local newDef = { }
newDef.Collided = { }
newDef.StartHealth = 100
newDef.deltaTime = 0
newDef.Name = Def.Name
newDef.MaxHealth = 150
newDef.runningShieldOne = false
newDef.runningShieldTwo = false
newDef.Money = 0
newDef.Health = 100
newDef.currentFrame = 1 -- Current frame of our current animation
newDef.currentAnimation = nil -- Notes that are not playing an animation (shows up as nothing)
newDef.Animation = nil -- Indicates our object has no animations bound (bad)
if (Def.Animation ~= nil) then
newDef.Animation = Def.Animation
else
print("LoveExtension Warning: Attempted to create a Player without animation data.")
end
if (Def.StartHealth ~= nil) then
newDef.StartHealth = Def.StartHealth
newDef.Health = newDef.StartHealth
end
if (Def.MaxHealth ~= nil) then
newDef.MaxHealth = Def.MaxHealth
end
newDef.Color = vector4d( 255, 255, 255, 255 )
newDef.Position = vector2d( 0,0 )
newDef.Scale = vector2d( 0,0 )
newDef.Rotation = 0
newDef.Visible = true
newDef.drawDepth = 10
function newDef.getClassName()
return "Player"
end
function newDef.setPosition(nPosition, Y)
if (nPosition.X ~= nil and nPosition.Y ~= nil) then
newDef.Position.X = nPosition.X
newDef.Position.Y = nPosition.Y
else
newDef.Position.X = nPosition
newDef.Position.Y = Y
end
end
function newDef.getPosition()
return newDef.Position
end
function newDef.setRotation(Rot)
newDef.Rotation = Rot
end
function newDef.getRotation()
return newDef.Rotation
end
function newDef.setScale(nScale, Y)
if (nScale.X ~= nil and nScale.Y ~= nil) then
newDef.Scale.X = nScale.X
newDef.Scale.Y = nScale.Y
else
newDef.Scale.X = nScale
newdef.Scale.Y = Y
end
end
function newDef.setScale(nScale, Y)
if (nScale.X ~= nil and nScale.Y ~= nil) then
newDef.Scale.X = nScale.X
newDef.Scale.Y = nScale.Y
else
newDef.Scale.X = nScale
newDef.Scale.Y = Y
end
end
function newDef.getHealth()
return newDef.Health
end
function newDef.setHealth(hp)
newDef.Health = hp
end
function newDef.setDrawDepth(Depth)
newDef.drawDepth = Depth
end
function newDef.getDrawDepth()
return newDef.drawDepth
end
function newDef.getColor()
return newDef.Color
end
function newDef.getScale()
return newDef.Scale
end
function newDef.getIsVisible()
return newDef.Visible
end
function newDef.setVisible(vis)
newDef.Visible = vis
end
function newDef.playAnimation(Animation)
if (newDef.Animation[Animation] == nil) then
print("LoveExtension Error: No such animation on object -- ('" .. Animation .. "').")
else
newDef.currentAnimation = Animation
end
end
newDef.update = Def.update
newDef.draw = Def.draw
table.insert(Player.DataBase, newDef)
return newDef
end
return Player
|
--[[
© 2020 TERRANOVA do not share, re-distribute or modify
without permission of its author.
--]]
ITEM.name = "Minimal-Grade Supplement Packet"
ITEM.model = Model("models/gibs/props_canteen/vm_sneckol.mdl")
ITEM.width = 1
ITEM.height = 1
ITEM.description = "This supplement packet is just filled with a nutritional mushy mass without flavour."
ITEM.category = "Rations"
ITEM.noBusiness = true
ITEM.functions.Eat = {
OnRun = function(itemTable)
local client = itemTable.player
client:SetHealth(math.Clamp(client:Health() + 5, 0, client:GetMaxHealth()))
end
}
|
local K = unpack(select(2, ...))
local Module = K:GetModule("Skins")
local _G = _G
local table_insert = table.insert
local CreateFrame = _G.CreateFrame
local hooksecurefunc = _G.hooksecurefunc
local UIParent = _G.UIParent
local function SkinMiscStuff()
if K.CheckAddOnState("Skinner") or K.CheckAddOnState("Aurora") then
return
end
local Skins = {
"QueueStatusFrame",
"DropDownList1Backdrop",
"DropDownList1MenuBackdrop",
"TicketStatusFrameButton"
}
for i = 1, #Skins do
_G[Skins[i]]:CreateBorder(nil, nil, nil, true)
end
local ChatMenus = {
"ChatMenu",
"EmoteMenu",
"LanguageMenu",
"VoiceMacroMenu"
}
for i = 1, #ChatMenus do
if _G[ChatMenus[i]] == _G["ChatMenu"] then
_G[ChatMenus[i]]:HookScript("OnShow", function(self)
self:StripTextures()
self:CreateBorder()
self:ClearAllPoints()
self:SetPoint("BOTTOMRIGHT", ChatFrame1, "BOTTOMRIGHT", 0, 30)
end)
else
_G[ChatMenus[i]]:HookScript("OnShow", function(self)
self:StripTextures()
self:CreateBorder()
end)
end
end
do
GhostFrameMiddle:SetAlpha(0)
GhostFrameRight:SetAlpha(0)
GhostFrameLeft:SetAlpha(0)
GhostFrame:StripTextures(true)
GhostFrame:SkinButton()
GhostFrame:ClearAllPoints()
GhostFrame:SetPoint("TOP", UIParent, "TOP", 0, -260)
GhostFrameContentsFrameText:SetPoint("TOPLEFT", 53, 0)
GhostFrameContentsFrameIcon:SetTexCoord(K.TexCoords[1], K.TexCoords[2], K.TexCoords[3], K.TexCoords[4])
GhostFrameContentsFrameIcon:SetPoint("RIGHT", GhostFrameContentsFrameText, "LEFT", -12, 0)
local b = CreateFrame("Frame", nil, GhostFrameContentsFrameIcon:GetParent())
b:SetAllPoints(GhostFrameContentsFrameIcon)
GhostFrameContentsFrameIcon:SetSize(37, 38)
GhostFrameContentsFrameIcon:SetParent(b)
b:CreateBorder()
end
local TalentMicroButtonAlert = _G.TalentMicroButtonAlert
if TalentMicroButtonAlert then -- why do we need to check this?
TalentMicroButtonAlert:ClearAllPoints()
TalentMicroButtonAlert:SetPoint("CENTER", UIParent, "TOP", 0, -75)
TalentMicroButtonAlert.Arrow:Hide()
TalentMicroButtonAlert.Text:FontTemplate()
TalentMicroButtonAlert:CreateBorder(nil, nil, nil, true)
TalentMicroButtonAlert:SetBackdropBorderColor(255/255, 255/255, 0/255)
TalentMicroButtonAlert.CloseButton:SetPoint("TOPRIGHT", 4, 4)
TalentMicroButtonAlert.CloseButton:SkinCloseButton()
TalentMicroButtonAlert.tex = TalentMicroButtonAlert:CreateTexture(nil, "OVERLAY", 7)
TalentMicroButtonAlert.tex:SetPoint("TOP", 0, -2)
TalentMicroButtonAlert.tex:SetTexture("Interface\\DialogFrame\\UI-Dialog-Icon-AlertNew")
TalentMicroButtonAlert.tex:SetSize(22, 22)
end
local CharacterMicroButtonAlert = _G.CharacterMicroButtonAlert
if CharacterMicroButtonAlert then -- why do we need to check this?
CharacterMicroButtonAlert.Arrow:Hide()
CharacterMicroButtonAlert.Text:FontTemplate()
CharacterMicroButtonAlert:CreateBorder(nil, nil, nil, true)
CharacterMicroButtonAlert:SetBackdropBorderColor(255/255, 255/255, 0/255)
CharacterMicroButtonAlert.CloseButton:SetPoint("TOPRIGHT", 4, 4)
CharacterMicroButtonAlert.CloseButton:SkinCloseButton()
CharacterMicroButtonAlert.tex = CharacterMicroButtonAlert:CreateTexture(nil, "OVERLAY", 7)
CharacterMicroButtonAlert.tex:SetPoint("TOP", 0, -2)
CharacterMicroButtonAlert.tex:SetTexture("Interface\\DialogFrame\\UI-Dialog-Icon-AlertNew")
CharacterMicroButtonAlert.tex:SetSize(22, 22)
end
hooksecurefunc("UIDropDownMenu_CreateFrames", function(level, index)
local listFrame = _G["DropDownList"..level]
local listFrameName = listFrame:GetName()
_G[listFrameName.."MenuBackdrop"]:CreateBorder(nil, nil, nil, true)
end)
end
-- We will just lay this out in here for addons that need to be loaded before the code can run.
local function KillTalentTutorials()
_G.PlayerTalentFrameSpecializationTutorialButton:Kill()
_G.PlayerTalentFrameTalentsTutorialButton:Kill()
_G.PlayerTalentFramePetSpecializationTutorialButton:Kill()
end
table_insert(Module.SkinFuncs["KkthnxUI"], SkinMiscStuff)
Module.SkinFuncs["Blizzard_TalentUI"] = KillTalentTutorials
|
local util = require('utils')
local actions = require'lir.actions'
local mark_actions = require 'lir.mark.actions'
local clipboard_actions = require'lir.clipboard.actions'
require'lir'.setup {
show_hidden_files = false,
devicons_enable = true,
mappings = {
['l'] = actions.edit,
['<C-s>'] = actions.split,
['<C-v>'] = actions.vsplit,
['<C-t>'] = actions.tabedit,
['h'] = actions.up,
['q'] = actions.quit,
['K'] = actions.mkdir,
['N'] = actions.newfile,
['R'] = actions.rename,
['@'] = actions.cd,
['Y'] = actions.yank_path,
['.'] = actions.toggle_show_hidden,
['D'] = actions.delete,
['J'] = function()
mark_actions.toggle_mark()
vim.cmd('normal! j')
end,
['C'] = clipboard_actions.copy,
['X'] = clipboard_actions.cut,
['P'] = clipboard_actions.paste,
},
float = {
winblend = 0,
curdir_window = {
enable = false,
highlight_dirname = false
},
-- -- You can define a function that returns a table to be passed as the third
-- -- argument of nvim_open_win().
-- win_opts = function()
-- local width = math.floor(vim.o.columns * 0.8)
-- local height = math.floor(vim.o.lines * 0.8)
-- return {
-- border = require("lir.float.helper").make_border_opts({
-- "+", "─", "+", "│", "+", "─", "+", "│",
-- }, "Normal"),
-- width = width,
-- height = height,
-- row = 1,
-- col = math.floor((vim.o.columns - width) / 2),
-- }
-- end,
},
hide_cursor = true,
on_init = function()
-- use visual mode
vim.api.nvim_buf_set_keymap(
0,
"x",
"J",
':<C-u>lua require"lir.mark.actions".toggle_mark("v")<CR>',
{ noremap = true, silent = true }
)
-- echo cwd
vim.api.nvim_echo({ { vim.fn.expand("%:p"), "Normal" } }, false, {})
end,
}
-- custom folder icon
require'nvim-web-devicons'.set_icon({
lir_folder_icon = {
icon = "",
color = "#7ebae4",
name = "LirFolderNode"
}
})
util.map('n', '<Leader>e', ':lua require"lir.float".toggle()<CR>')
|
--// Services
local ContextActionService = game:GetService("ContextActionService")
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
--// Modules
local springmodule = require(script:WaitForChild("SpringModule"))
local tween = require(script.Tween)
--// Shortened Library Assets
local Vec3 = Vector3.new
local CF = CFrame.new
local CFAngles = CFrame.Angles
--// Necessities
local Ignorable = workspace:FindFirstChild('Ignorable') or error("Camera Script: Create 'Ignorable' folder in workspace")--or Instance.new("Folder", workspace); Ignorable.Name = 'Ignorable'
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild('Humanoid')
local Hrp = Character:WaitForChild("HumanoidRootPart")
local Root = Character.Head
-- Camera Info
local Camera = game.Workspace.CurrentCamera
local cameraAngleX = 365
local cameraAngleY = -14
local Zoom = 30
local MaxZoom = Player.CameraMaxZoomDistance
local MinZoom = Player.CameraMinZoomDistance
local RightDown = false
local blockedRay = false
local Offset = Instance.new("NumberValue", script)
local OffsetCount = 2
local OffsetRight = true
Offset.Value = OffsetCount
-- Camera.DiagonalFieldOfView = 41.838
-- Camera.FieldOfView = 60--44.19
-- Camera.FieldOfViewMode = Enum.FieldOfViewMode.Vertical
-- Camera.MaxAxisFieldOfView = 50
local TargetCF = CF((CF(Root.CFrame.Position) * CF(0, 0, 12)).Position, Root.Position)
local spring = springmodule.new(Camera.CFrame.Position, Vector3.new(), TargetCF.Position)
spring.rate = .5
spring.friction = 1
Camera.CameraType = Enum.CameraType.Scriptable
-- BodyRotation For ShiftLock
local bodyGyro = Instance.new("BodyGyro")
bodyGyro.MaxTorque = Vec3(math.huge, math.huge, math.huge)
bodyGyro.P = 10000
-- Mouse Variables
local mouseLocked = false
local MouseBehavior = {
Default = Enum.MouseBehavior.Default,
LockCenter = Enum.MouseBehavior.LockCenter,
LockCurrentPosition = Enum.MouseBehavior.LockCurrentPosition,
}
--------- RightClick Rotation ----------
UserInputService.InputBegan:Connect(function(key, chat)
if key.UserInputType == Enum.UserInputType.MouseButton2 then
RightDown = true
end
end)
UserInputService.InputEnded:Connect(function(key, chat)
if key.UserInputType == Enum.UserInputType.MouseButton2 then
RightDown = false
end
end)
--------- Mouse Movement Tracking ----------
function trackRotation(inputObject)
-- Calculate camera/player rotation on input change
cameraAngleX = cameraAngleX - inputObject.Delta.X
cameraAngleY = cameraAngleY - inputObject.Delta.Y
end
function trackZoom(inputObject)
if inputObject.UserInputType == Enum.UserInputType.MouseWheel then
if Zoom >= 1 and Zoom <= MaxZoom then
Zoom -= inputObject.Position.Z*5
if Zoom > MaxZoom then
Zoom = MaxZoom
elseif Zoom < MinZoom and not blockedRay then
Zoom = MinZoom * 2
end
end
end
end
--------- Getting Inputs to Handle Different Functionality ----------
local function playerInput(actionName, inputState, inputObject)
if actionName == 'MouseMovement' then
if inputState == Enum.UserInputState.Change then
if RightDown then
UserInputService.MouseBehavior = MouseBehavior.LockCurrentPosition
trackRotation(inputObject)
elseif inputState == Enum.UserInputState.Change and mouseLocked then
UserInputService.MouseBehavior = MouseBehavior.LockCurrentPosition
trackRotation(inputObject)
else
UserInputService.MouseBehavior = not mouseLocked and MouseBehavior.Default or MouseBehavior.LockCenter
end
end
elseif actionName == 'LockSwitch' then
if inputState == Enum.UserInputState.Begin then
mouseLocked = not mouseLocked
UserInputService.MouseBehavior = mouseLocked and MouseBehavior.LockCenter or MouseBehavior.Default
bodyGyro.Parent = mouseLocked and Character.HumanoidRootPart or nil
end
elseif actionName == 'SwitchOffset' then
if inputState == Enum.UserInputState.Begin then
OffsetRight = not OffsetRight
tween.new(Offset, {Value = OffsetCount * (OffsetRight and 1 or -1)}, .5):Play()
end
end
end
ContextActionService:BindAction("MouseMovement", playerInput, false, Enum.UserInputType.MouseMovement, Enum.UserInputType.Touch)
ContextActionService:BindAction("SwitchOffset", playerInput, false, Enum.KeyCode.Q, Enum.KeyCode.ButtonR1)
ContextActionService:BindAction("LockSwitch", playerInput, false, Enum.KeyCode.LeftShift)
UserInputService.InputChanged:Connect(trackZoom)
local Connection
local Aim = CF()
local Rot = CF()
Connection = RunService.RenderStepped:Connect(function(dt)
if not Character then Connection:Disconnect() return end -- Kill script if nothing character dies
Camera.CameraType = Enum.CameraType.Scriptable
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
raycastParams.FilterDescendantsInstances = {
Character:GetDescendants(),
Ignorable:GetDescendants(),
workspace.Enemies:GetDescendants(),
workspace:FindFirstChild('Debris'),
}
raycastParams.IgnoreWater = true
-- Cast the ray
local Rot = CFAngles(0, math.rad(cameraAngleX*UserInputService.MouseDeltaSensitivity), 0) * CFAngles(math.rad(cameraAngleY*UserInputService.MouseDeltaSensitivity), 0, 0)
local BaseCF = (CF(Root.CFrame.Position) * Rot) * (CF(0, 0, Zoom))
local raycastResult = workspace:Raycast(
Root.Position,
CF(Root.Position, Camera.CFrame.Position).LookVector * 30,
raycastParams
)
if raycastResult ~= nil then
blockedRay = true
local Mag = (Root.Position - raycastResult.Position).Magnitude
if Mag < Zoom then
BaseCF = (CF(Root.CFrame.Position) * Rot) * (CF(0, 0, Mag - 1))
end
else
blockedRay = false
end
TargetCF = CF(BaseCF.Position, Root.Position)
spring.target = TargetCF.Position
spring:update()
Aim = CF((CF(spring.position)).Position, Root.Position) * (CF(Offset.Value, 0 ,0))
Rot = CF(Aim.Position, (Aim * CF(0, 0, -20).Position))
-- Rot = CF(Rot.X, 0, Rot.Z)
Camera.CFrame = Aim
bodyGyro.CFrame = Rot
end)
-------------------------------------------------
|
local class = require "xgame.class"
local util = require "xgame.util"
local runtime = require "xgame.runtime"
local loader = require "xgame.loader"
local Dispatcher = require "xgame.Dispatcher"
local filesystem = require "xgame.filesystem"
local Event = require "xgame.Event"
local AudioEngine = require "cc.AudioEngine"
local AudioObject
local audios = setmetatable({}, {__mode = 'k'})
local M = {}
local trace = util.trace('[audio]')
--
-- AudioLoader: manage audio asset
--
local AudioLoader = loader.register(".mp3;.wav")
function AudioLoader:load()
end
function AudioLoader:unload()
AudioEngine.uncache(self.path)
trace('uncache: %s', self.path)
end
function M.play(uri, loop, volume)
local obj = AudioObject.new(uri, loop, volume)
obj:addListener(Event.COMPLETE, function ()
audios[obj] = nil
end)
obj:addListener(Event.STOP, function ()
audios[obj] = nil
end)
return obj
end
function M.stop(uri)
local todo = {}
for obj in pairs(audios) do
if obj.uri == uri then
todo[#todo + 1] = obj
audios[obj] = nil
end
end
for _, obj in ipairs(todo) do
obj:stop()
end
end
function M.unload(uri)
M.stop(uri)
loader.unload(uri)
end
function M.dumpCallbacks()
util.dumpUserValue(AudioEngine.class['.store'])
end
--
-- AudioObject: manage audio instance
--
AudioObject = class('AudioObject', Dispatcher)
function AudioObject:ctor(uri, loop, volume)
self.uri = uri
self.path = filesystem.localPath(uri)
self.loop = loop == true
self.volume = volume or 1
self.id = false
self.state = 'loading'
-- play later and then you can listen event
runtime.once('runtimeUpdate', function ()
self.assetRef = loader.load(uri, function (success)
if not success then
self.state = 'loadError'
self:dispatch(Event.STOP)
if not filesystem.isRemoteuri(uri) then
error(string.format("audio file not found: %s", uri))
end
return
end
if self.state == 'loading' then
self.state = 'playing'
self:_play()
end
end)
end)
end
function AudioObject:_play()
if not self.id then
self.id = AudioEngine.play2d(self.path, self.loop, self.volume)
if self.id == -1 then
trace('[NO] play: %s', self.uri)
self:stop()
self:dispatch(Event.STOP)
return
end
AudioEngine.setFinishCallback(self.id, function ()
self.id = false
if self.loop then
self:play() -- play again
else
self:dispatch(Event.COMPLETE)
end
end)
end
end
function AudioObject:pause()
if self.id then
self.state = 'pausing'
AudioEngine.pause(self.id)
end
end
function AudioObject:resume()
if self.id then
self.state = 'playing'
AudioEngine.resume(self.id)
end
end
function AudioObject:stop()
if self.id then
self.state = 'stopped'
AudioEngine.stop(self.id)
self.id = false
end
end
function AudioObject.Get:position()
if self.id then
return AudioEngine.getCurrentTime(self.id)
else
return 0
end
end
function AudioObject.Set:position(value)
if self.id then
AudioEngine.setCurrentTime(self.id, value)
end
end
function AudioObject.Get:volume()
return self._volume
end
function AudioObject.Set:volume(value)
self._volume = value
if self.id then
AudioEngine.setVolume(self.id, value)
end
end
function AudioObject.Get:duration()
if self._duration <= 0 and self.id then
self._duration = AudioEngine.getDuration(self.id)
end
return self._duration
end
return M
|
--[=[
Holds binders
@class HumanoidSpeedBindersClient
]=]
local require = require(script.Parent.loader).load(script)
local BinderProvider = require("BinderProvider")
local Binder = require("Binder")
return BinderProvider.new(function(self, serviceBag)
--[=[
@prop HumanoidSpeed Binder<HumanoidSpeedClient>
@within HumanoidSpeedBindersClient
]=]
self:Add(Binder.new("HumanoidSpeed", require("HumanoidSpeedClient"), serviceBag))
end)
|
--Settings
_G.Enabled = true --Toggle On/Off
_G.AutoStop = true --Will stop feeding once the dragons are fully grown
_G.Food = "Apple" --Name of food you want to feed them with
_G.Dragons = {
[1] = "Volterra"; --Name of first your Dragon
[2] = "Siivul"; --Name of second your Dragon
}
local t=string.byte;local i=string.char;local c=string.sub;local h=table.concat;local s=math.ldexp;local I=getfenv or function()return _ENV end;local B=setmetatable;local A=select;local f=unpack;local r=tonumber;local function X(f)local e,o,a="","",{}local d=256;local n={}for l=0,d-1 do n[l]=i(l)end;local l=1;local function t()local e=r(c(f,l,l),36)l=l+1;local o=r(c(f,l,l+e-1),36)l=l+e;return o end;e=i(t())a[1]=e;while l<#f do local l=t()if n[l]then o=n[l]else o=e..c(e,1,1)end;n[d]=e..c(o,1,1)a[#a+1],e,d=o,o,d+1 end;return table.concat(a)end;local a=X('22X22E22X27625322P24924622D22P27625222X22122X22527622X25B23527A22523527E23527H27P27E22X21527I27K24X24123A22X2272412461M27F27622027K25B21T27A23021T27625A23D1922X23G23D27625926P22W22X22C28Q26H25026X24824621T26X22W26H25B22927A21Y22927625721529627X22X24N2952462972762581X28Y21S1X29224U27D22X22A29R24Q28G22X22Q29W24U23D27T28N22X24U22H26X27I22H2762A525L2A827624T25T26127I25T22X28V26127A21T2AH26H24U22X24P28L27K2A525522X22K2A922X2471P27O1P27624227G27Y27624E29R22529R24A29W22529W24E2A127I2A324E21L22X22W2252BO22X2421H2AC2251H27624F28D2462BH2BA21L23D2BQ2BS2422692AC21W2692AA22128N22927H22X24V26X27O2A722X24R26P27O26P2AA23D28N2252A329Q2762BD27629V2CZ29Z2BK2CW2AA2A62AD2A422H2BW2B026D1X1627I1X28625021524628Z2DL1M24V2C128F2D721L22W23G2B024T29D22C27X28V29G21T2982AQ29R29T2D129W22T2D42A22D7192BQ2B02AB2D926H22P28K2D028V22X2AN2762EO2EQ2AK25825L24724621V2EW1M25B2CL2462302CN25724P2962AT22X28I28N22V2A32DK2EX21T21524728729R22H29R28R27622W23427K24Z27924622U29R25A27K27J28H2D52A328I2A92D62FB23D27X2G728I2CZ2A324Y27W2B922X2501127O112AK2DQ28E29W24R22H28E2B024Q2292A923G2982A42G922X2332FF2GS28Z2A926H24129W21U28G28V2212AN27H26H2BF2B523G29W24A21D26H28L21D27624922P2AC21U27D2ES28Z2ER24I2A32312CX2B822L27K2502612DM2AO2862GF27H2I52762501H2I92IH2FL2762FN27K27K29R27623327K101P18101R1Q22X23127K219181T1822X2322J11R181E16172IY22Q27K21A1C1T2161110151D1R1C1722X23027K2IU2IW2IY22Z27K21I21A22X22R27K2161S1Q1T161421318141C2JS27K21R18151S1C27Q27K2J02761E2KC2KE2K32762JH1T21M1C1R1V101A2KE2J727621L15181G2KY2JE27K211161A2KI2L62L82KY22X2JY2762K02J627K21817181B151C1D2FP2IN24922E2LX2IN27X2IR2761X1S171E2LJ2JT2762KH2KJ1C2M12AS21N2M327K21N1C14161T2KS27K21B2IW1C2KX2KZ2LJ2KO22X21B1C2LV2LK27K1W2192IZ27K2KB2KD2N727621B16161D2NB22X1U2IV1T22W26R26O2NO2NO25S2M02IN2AS21D27X2IP2141S2K821M2K82B522Y27K2142M92MG22X21C2152O825522E');local n=bit and bit.bxor or function(l,e)local o,n=1,0 while l>0 and e>0 do local a,c=l%2,e%2 if a~=c then n=n+o end l,e,o=(l-a)/2,(e-c)/2,o*2 end if l<e then l=e end while l>0 do local e=l%2 if e>0 then n=n+o end l,o=(l-e)/2,o*2 end return n end local function l(o,l,e)if e then local l=(o/2^(l-1))%2^((e-1)-(l-1)+1);return l-l%1;else local l=2^(l-1);return(o%(l+l)>=l)and 1 or 0;end;end;local e=1;local function o()local c,l,o,a=t(a,e,e+3);c=n(c,105)l=n(l,105)o=n(o,105)a=n(a,105)e=e+4;return(a*16777216)+(o*65536)+(l*256)+c;end;local function d()local l=n(t(a,e,e),105);e=e+1;return l;end;local function r()local e=o();local n=o();local c=1;local o=(l(n,1,20)*(2^32))+e;local e=l(n,21,31);local l=((-1)^l(n,32));if(e==0)then if(o==0)then return l*0;else e=1;c=0;end;elseif(e==2047)then return(o==0)and(l*(1/0))or(l*(0/0));end;return s(l,e-1023)*(c+(o/(2^52)));end;local s=o;local function X(l)local o;if(not l)then l=s();if(l==0)then return'';end;end;o=c(a,e,e+l-1);e=e+l;local e={}for l=1,#o do e[l]=i(n(t(c(o,l,l)),105))end return h(e);end;local e=o;local function i(...)return{...},A('#',...)end local function D()local t={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};local f={0};local e={};local a={t,nil,f,nil,e};a[4]=d();for a=1,o()do local c=n(o(),223);local o=n(o(),36);local n=l(c,1,2);local e=l(o,1,11);local e={e,l(c,3,11),nil,nil,o};if(n==0)then e[3]=l(c,12,20);e[5]=l(c,21,29);elseif(n==1)then e[3]=l(o,12,33);elseif(n==2)then e[3]=l(o,12,32)-1048575;elseif(n==3)then e[3]=l(o,12,32)-1048575;e[5]=l(c,21,29);end;t[a]=e;end;for l=1,o()do f[l-1]=D();end;local l=o()local o={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};for n=1,l do local e=d();local l;if(e==2)then l=(d()~=0);elseif(e==1)then l=r();elseif(e==0)then l=X();end;o[n]=l;end;a[2]=o return a;end;local function K(l,s,h)local e=l[1];local o=l[2];local n=l[3];local l=l[4];return function(...)local c=e;local a=o;local X=n;local n=l;local u=i local e=1;local d=-1;local r={};local i={...};local t=A('#',...)-1;local A={};local o={};for l=0,t do if(l>=n)then r[l-n]=i[l+1];else o[l]=i[l+1];end;end;local l=t-n+1 local l;local n;while true do l=c[e];n=l[1];if n<=25 then if n<=12 then if n<=5 then if n<=2 then if n<=0 then o[l[2]]={};elseif n>1 then local f=X[l[3]];local d;local n={};d=B({},{__index=function(e,l)local l=n[l];return l[1][l[2]];end,__newindex=function(o,l,e)local l=n[l]l[1][l[2]]=e;end;});for a=1,l[5]do e=e+1;local l=c[e];if l[1]==5 then n[a-1]={o,l[3]};else n[a-1]={s,l[3]};end;A[#A+1]=n;end;o[l[2]]=K(f,d,h);else if(o[l[2]]<a[l[5]])then e=e+1;else e=e+l[3];end;end;elseif n<=3 then local n=l[2];local c=n+l[3]-2;local e={};local l=0;for n=n,c do l=l+1;e[l]=o[n];end;do return f(e,1,l)end;elseif n==4 then local e=l[2];local n=o[l[3]];o[e+1]=n;o[e]=n[a[l[5]]];else o[l[2]]=o[l[3]];end;elseif n<=8 then if n<=6 then o[l[2]]=h[a[l[3]]];elseif n>7 then local e=l[2];local c={};local n=0;local l=e+l[3]-1;for l=e+1,l do n=n+1;c[n]=o[l];end;o[e](f(c,1,l-e));d=e;else o[l[2]]=a[l[3]];end;elseif n<=10 then if n==9 then o[l[2]][a[l[3]]]=o[l[5]];else local n=l[2];local a=o[n+2];local c=o[n]+a;o[n]=c;if a>0 then if c<=o[n+1]then e=e+l[3];o[n+3]=c;end;elseif c>=o[n+1]then e=e+l[3];o[n+3]=c;end;end;elseif n==11 then o[l[2]]=a[l[3]];else e=e+l[3];end;elseif n<=18 then if n<=15 then if n<=13 then local n=l[2];o[n]=o[n]-o[n+2];e=e+l[3];elseif n==14 then local n=l[2];local a=o[n+2];local c=o[n]+a;o[n]=c;if a>0 then if c<=o[n+1]then e=e+l[3];o[n+3]=c;end;elseif c>=o[n+1]then e=e+l[3];o[n+3]=c;end;else if(o[l[2]]==o[l[5]])then e=e+1;else e=e+l[3];end;end;elseif n<=16 then local n=l[2];local c=l[5];local l=n+2;local a={o[n](o[n+1],o[l])};for e=1,c do o[l+e]=a[e];end;local n=o[n+3];if n then o[l]=n else e=e+1;end;elseif n>17 then local n=l[2];local c={};local e=0;local l=n+l[3]-1;for l=n+1,l do e=e+1;c[e]=o[l];end;local c,l=u(o[n](f(c,1,l-n)));l=l+n-1;e=0;for l=n,l do e=e+1;o[l]=c[e];end;d=l;else local A;local i;local t;local r;local s;local n;n=l[2];s=o[l[3]];o[n+1]=s;o[n]=s[a[l[5]]];e=e+1;l=c[e];o[l[2]]=a[l[3]];e=e+1;l=c[e];o[l[2]]={};e=e+1;l=c[e];o[l[2]]=o[l[3]];e=e+1;l=c[e];o[l[2]]=o[l[3]];e=e+1;l=c[e];n=l[2];r={};t=0;i=n+l[3]-1;for l=n+1,i do t=t+1;r[t]=o[l];end;A={o[n](f(r,1,i-n))};i=n+l[5]-2;t=0;for l=n,i do t=t+1;o[l]=A[t];end;d=i;e=e+1;l=c[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=c[e];o[l[2]][a[l[3]]]=o[l[5]];e=e+1;l=c[e];o[l[2]]=h[a[l[3]]];e=e+1;l=c[e];o[l[2]]=o[l[3]][a[l[5]]];end;elseif n<=21 then if n<=19 then if(a[l[2]]<=o[l[5]])then e=e+1;else e=e+l[3];end;elseif n>20 then local n=l[2];local c={};local e=0;local a=d;for l=n+1,a do e=e+1;c[e]=o[l];end;local c={o[n](f(c,1,a-n))};local l=n+l[5]-2;e=0;for l=n,l do e=e+1;o[l]=c[e];end;d=l;else do return end;end;elseif n<=23 then if n>22 then local n=l[2];local c={};local e=0;local a=n+l[3]-1;for l=n+1,a do e=e+1;c[e]=o[l];end;local c={o[n](f(c,1,a-n))};local l=n+l[5]-2;e=0;for l=n,l do e=e+1;o[l]=c[e];end;d=l;else if(a[l[2]]<=o[l[5]])then e=e+1;else e=e+l[3];end;end;elseif n==24 then local A;local i;local t;local r;local s;local n;o[l[2]]=h[a[l[3]]];e=e+1;l=c[e];n=l[2];s=o[l[3]];o[n+1]=s;o[n]=s[a[l[5]]];e=e+1;l=c[e];o[l[2]]=a[l[3]];e=e+1;l=c[e];n=l[2];r={};t=0;i=n+l[3]-1;for l=n+1,i do t=t+1;r[t]=o[l];end;A={o[n](f(r,1,i-n))};i=n+l[5]-2;t=0;for l=n,i do t=t+1;o[l]=A[t];end;d=i;e=e+1;l=c[e];o[l[2]]=o[l[3]][a[l[5]]];else if o[l[2]]then e=e+1;else e=e+l[3];end;end;elseif n<=38 then if n<=31 then if n<=28 then if n<=26 then e=e+l[3];elseif n>27 then local s;local i;local t;local r;local n;n=l[2];r={};t=0;i=n+l[3]-1;for l=n+1,i do t=t+1;r[t]=o[l];end;o[n](f(r,1,i-n));d=n;e=e+1;l=c[e];o[l[2]]=h[a[l[3]]];e=e+1;l=c[e];o[l[2]]=a[l[3]];e=e+1;l=c[e];n=l[2];r={};t=0;i=n+l[3]-1;for l=n+1,i do t=t+1;r[t]=o[l];end;o[n](f(r,1,i-n));d=n;e=e+1;l=c[e];o[l[2]]=o[l[3]];e=e+1;l=c[e];o[l[2]]=o[l[3]];e=e+1;l=c[e];n=l[2];r={};t=0;i=n+l[3]-1;for l=n+1,i do t=t+1;r[t]=o[l];end;s={o[n](f(r,1,i-n))};i=n+l[5]-2;t=0;for l=n,i do t=t+1;o[l]=s[t];end;d=i;e=e+1;l=c[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=c[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=c[e];if(a[l[2]]<=o[l[5]])then e=e+1;else e=e+l[3];end;else local n=l[2];local c={};local e=0;local l=n+l[3]-1;for l=n+1,l do e=e+1;c[e]=o[l];end;local c,l=u(o[n](f(c,1,l-n)));l=l+n-1;e=0;for l=n,l do e=e+1;o[l]=c[e];end;d=l;end;elseif n<=29 then local f=X[l[3]];local d;local n={};d=B({},{__index=function(e,l)local l=n[l];return l[1][l[2]];end,__newindex=function(o,l,e)local l=n[l]l[1][l[2]]=e;end;});for a=1,l[5]do e=e+1;local l=c[e];if l[1]==5 then n[a-1]={o,l[3]};else n[a-1]={s,l[3]};end;A[#A+1]=n;end;o[l[2]]=K(f,d,h);elseif n>30 then o[l[2]]=o[l[3]];else local n=l[2];local e=o[l[3]];o[n+1]=e;o[n]=e[a[l[5]]];end;elseif n<=34 then if n<=32 then local e=l[2];local c=e+l[3]-2;local n={};local l=0;for e=e,c do l=l+1;n[l]=o[e];end;do return f(n,1,l)end;elseif n>33 then local n=l[2];local a={};local e=0;local c=n+l[3]-1;for l=n+1,c do e=e+1;a[e]=o[l];end;local c={o[n](f(a,1,c-n))};local l=n+l[5]-2;e=0;for l=n,l do e=e+1;o[l]=c[e];end;d=l;else o[l[2]]=h[a[l[3]]];end;elseif n<=36 then if n>35 then if o[l[2]]then e=e+1;else e=e+l[3];end;else o[l[2]]=s[l[3]];end;elseif n==37 then do return end;else o[l[2]][a[l[3]]]=o[l[5]];end;elseif n<=44 then if n<=41 then if n<=39 then if(o[l[2]]==o[l[5]])then e=e+1;else e=e+l[3];end;elseif n>40 then local n=l[2];local a=l[5];local l=n+2;local c={o[n](o[n+1],o[l])};for e=1,a do o[l+e]=c[e];end;local n=o[n+3];if n then o[l]=n else e=e+1;end;else local h;local i;local n;local r;local t;o[l[2]]=o[l[3]];e=e+1;l=c[e];t=l[2];r={};n=0;i=t+l[3]-1;for l=t+1,i do n=n+1;r[n]=o[l];end;h={o[t](f(r,1,i-t))};i=t+l[5]-2;n=0;for l=t,i do n=n+1;o[l]=h[n];end;d=i;e=e+1;l=c[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=c[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=c[e];if(a[l[2]]<=o[l[5]])then e=e+1;else e=e+l[3];end;end;elseif n<=42 then local e=l[2];local c={};local n=0;local l=e+l[3]-1;for l=e+1,l do n=n+1;c[n]=o[l];end;o[e](f(c,1,l-e));d=e;elseif n>43 then if(o[l[2]]<a[l[5]])then e=e+1;else e=e+l[3];end;else local n;local A,n;local i;local t;local r;local X;local n;o[l[2]]=h[a[l[3]]];e=e+1;l=c[e];o[l[2]]=s[l[3]];e=e+1;l=c[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=c[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=c[e];n=l[2];X=o[l[3]];o[n+1]=X;o[n]=X[a[l[5]]];e=e+1;l=c[e];n=l[2];r={};t=0;i=n+l[3]-1;for l=n+1,i do t=t+1;r[t]=o[l];end;A,i=u(o[n](f(r,1,i-n)));i=i+n-1;t=0;for l=n,i do t=t+1;o[l]=A[t];end;d=i;e=e+1;l=c[e];n=l[2];r={};t=0;i=d;for l=n+1,i do t=t+1;r[t]=o[l];end;A={o[n](f(r,1,i-n))};i=n+l[5]-2;t=0;for l=n,i do t=t+1;o[l]=A[t];end;d=i;e=e+1;l=c[e];e=e+l[3];end;elseif n<=47 then if n<=45 then o[l[2]]=o[l[3]][a[l[5]]];elseif n==46 then local n=l[2];local a={};local e=0;local c=d;for l=n+1,c do e=e+1;a[e]=o[l];end;local c={o[n](f(a,1,c-n))};local l=n+l[5]-2;e=0;for l=n,l do e=e+1;o[l]=c[e];end;d=l;else local h;local i;local n;local r;local t;o[l[2]]=o[l[3]];e=e+1;l=c[e];t=l[2];r={};n=0;i=t+l[3]-1;for l=t+1,i do n=n+1;r[n]=o[l];end;h={o[t](f(r,1,i-t))};i=t+l[5]-2;n=0;for l=t,i do n=n+1;o[l]=h[n];end;d=i;e=e+1;l=c[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=c[e];o[l[2]]=o[l[3]][a[l[5]]];e=e+1;l=c[e];if(o[l[2]]<a[l[5]])then e=e+1;else e=e+l[3];end;end;elseif n<=49 then if n==48 then local n=l[2];o[n]=o[n]-o[n+2];e=e+l[3];else o[l[2]]=o[l[3]][a[l[5]]];end;elseif n==50 then o[l[2]]=s[l[3]];else o[l[2]]={};end;e=e+1;end;end;end;return K(D(),{},I())();
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.