content
stringlengths 5
1.05M
|
|---|
PongGame = class(Observer)
function PongGame:init(maxScore)
self:initializePlayersWithNill()
self.maxScore = maxScore
self:resetScore()
self.paddles = {}
self.paddlesCollision = {}
self.winner = false
end
function PongGame:initializePlayersWithNill()
self.players = {[1] = nil, [2] = nil}
end
function PongGame:signal(message)
if message.type == MessageTypes.ball.move then
self:updateBallPos(message.value)
self:verifyBallMoviment()
self:updateScore()
self:sendNotifications()
elseif message.type == MessageTypes.paddle.paddlePosition then
self:updatePaddlePos(message.value)
elseif message.type == MessageTypes.selectArrow.selected then
self:selectNumberOfPlayers(message.value)
self:notifyScoreBoard()
elseif message.type == MessageTypes.scoreTable.resetScore then
print('reseting')
self:resetGame()
end
end
function PongGame:updateBallPos(ballPos) self.ball = ballPos end
function PongGame:verifyBallMoviment()
self:preventBallToVerticalCamOut()
self:preventBallToHorizontalCamOut()
self.paddlesCollision[1] = self:verifyColisionBetweenPadddleAndBall(
self.paddles[1])
self.paddlesCollision[2] = self:verifyColisionBetweenPadddleAndBall(
self.paddles[2])
end
function PongGame:preventBallToVerticalCamOut()
local heightLimit = VIRTUAL_HEIGHT - self.ball.size
self.verticalCamout = false
if self.ball.y <= 0 then
self.ball.y = 0
self.verticalCamout = true
elseif self.ball.y >= heightLimit then
self.ball.y = heightLimit
self.verticalCamout = true
end
end
function PongGame:preventBallToHorizontalCamOut()
local widthLimit = VIRTUAL_WIDTH - self.ball.size
self.horizontalCamout = false
if self.ball.x >= widthLimit then
self.horizontalCamout = 1
self.ball.x = widthLimit
elseif self.ball.x <= 0 then
self.horizontalCamout = 2
self.ball.x = 0
end
end
function PongGame:verifyColisionBetweenPadddleAndBall(paddle)
if paddle == nil then return false end
if self.ball.x > paddle.x + paddle.width or self.ball.x + self.ball.size <
paddle.x then return false end
if self.ball.y > paddle.y + paddle.height or self.ball.y + self.ball.size <
paddle.y then return false end
return true
end
function PongGame:updatePaddlePos(paddle) self.paddles[paddle.id] = paddle end
function PongGame:selectNumberOfPlayers(singleplayerMode)
if singleplayerMode then
self:singlePlayerGame()
else
self:multiplayerGame()
end
end
function PongGame:multiplayerGame()
print('Multiplayer Mode')
self:initializePlayersWithNill()
self:inserPlayer(Player('w', 's'))
self:inserPlayer(Player('up', 'down'))
end
function PongGame:singlePlayerGame()
print('singleplayer Mode')
self:initializePlayersWithNill()
self:inserPlayer(Player('w', 's'))
self:inserPlayer(Robot())
end
function PongGame:inserPlayer(player)
if self:isPossibleToBePlayer(1) then
self:addPlayer(1, player)
elseif self:isPossibleToBePlayer(2) then
self:addPlayer(2, player)
end
end
function PongGame:isPossibleToBePlayer(number) return
self.players[number] == nil end
function PongGame:addPlayer(number, player)
self.players[number] = player
self.paddles[number] = nil
end
function PongGame:sendNotifications()
self:notifyPongSound()
self:notifyBall()
self:notifyStateMachine()
if self:anyPlayerHasScored() then self:notifyScoreBoard() end
end
function PongGame:notifyPongSound()
self:notify(Message(MessageTypes.sound.playerScored,
self:anyPlayerHasScored()))
self:notify(Message(MessageTypes.sound.paddleCollision,
self:anyPaddleHasCollide()))
self:notify(Message(MessageTypes.sound.wallCollision, self.verticalCamout))
end
function PongGame:notifyBall()
self:notify(Message(MessageTypes.ball.resetPos, self:anyPlayerHasScored()))
self:notify(Message(MessageTypes.ball.invertSpeedX, self:invertBallSpeedX()))
self:notify(Message(MessageTypes.ball.invertSpeedY, self.verticalCamout))
end
function PongGame:invertBallSpeedX()
if self.paddlesCollision[1] or self.paddlesCollision[2] then return true end
return false
end
function PongGame:notifyStateMachine()
self:notify(Message(MessageTypes.stateMachine.playerScored,
self:anyPlayerHasScored()))
if self.winner then
self:notify(Message(MessageTypes.stateMachine.victory, self.winner))
end
end
function PongGame:notifyScoreBoard()
self:notify(Message(MessageTypes.scoreTable.setScore, self.score))
end
function PongGame:anyPlayerHasScored()
if self.horizontalCamout ~= false and self:anyPaddleHasCollide() == false then
return self.horizontalCamout
end
end
function PongGame:anyPaddleHasCollide()
if self.paddlesCollision[1] == nil or self.paddlesCollision[2] == nil then
return false
end
return self.paddlesCollision[1] == true or self.paddlesCollision[2] == true
end
function PongGame:updateScore()
if self.horizontalCamout == false or self:anyPaddleHasCollide() then return end
self.score[self.horizontalCamout] = self.score[self.horizontalCamout] + 1
print('update score', self.score[1], self.score[2])
if self.score[self.horizontalCamout] == self.maxScore then
self.winner = self.horizontalCamout
end
end
function PongGame:resetGame()
self:resetFlags()
self:resetScore()
self.winner = false
end
function PongGame:resetScore() self.score = {[1] = 0, [2] = 0} end
function PongGame:resetFlags()
self.horizontalCamout = false
self.verticalCamout = false
end
|
-- Copyright (C) Anton heryanto.
local cjson = require "cjson"
local upload = require "resty.upload"
local table_new_ok, new_tab = pcall(require, "table.new")
local open = io.open
local sub = string.sub
local find = string.find
local type = type
local setmetatable = setmetatable
local random = math.random
local read_body = ngx.req.read_body
local get_post_args = ngx.req.get_post_args
local var = ngx.var
local log = ngx.log
local WARN = ngx.WARN
local prefix = ngx.config.prefix()..'logs/'
local now = ngx.now
if not table_new_ok then
new_tab = function(narr, nrec) return {} end
end
local _M = new_tab(0,3)
_M.VERSION = '0.1.0'
local mt = { __index = _M }
function _M.new(self, path)
path = path or prefix
return setmetatable({path = path}, mt)
end
local function decode_disposition(self, data)
local needle = 'filename="'
local needle_len = 10 -- #needle
local name_pos = 18 -- #'form-data; name="'
local last_quote_pos = #data - 1
local filename_pos = find(data, needle)
if not filename_pos then
return sub(data,name_pos,last_quote_pos)
end
local field = sub(data,name_pos,filename_pos - 4)
local name = sub(data,filename_pos + needle_len, last_quote_pos)
if not name or name == '' then
return
end
local path = self.path
local tmp_name = now() + random()
local filename = path .. tmp_name
local handler = open(filename, 'wb+')
if not handler then
log(WARN, 'failed to open file ', filename)
end
return field, name, handler, tmp_name
end
local function multipart(self)
local chunk_size = 8192
local form,err = upload:new(chunk_size)
if not form then
log(WARN, 'failed to new upload: ', err)
return
end
local m = { files = {} }
local files = {}
local handler, key, value
while true do
local ctype, res, err = form:read()
if not ctype then
log(WARN, 'failed to read: ', err)
return
end
if ctype == 'header' then
local header, data = res[1], res[2]
if header == 'Content-Disposition' then
local tmp_name
key, value, handler, tmp_name = decode_disposition(self, data)
if handler then
files[key] = { name = value, tmp_name = tmp_name }
end
end
if handler and header == 'Content-Type' then
files[key].type = data
end
end
if ctype == 'body' then
if handler then
handler:write(res)
elseif res ~= '' then
value = value and value .. res or res
end
end
if ctype == 'part_end' then
if handler then
files[key].size = handler:seek('end')
handler:close()
if m.files[key] then
local nf = #m.files[key]
if nf > 0 then
m.files[key][nf + 1] = files[key]
else
m.files[key] = { m.files[key], files[key] }
end
else
m.files[key] = files[key]
end
elseif key then
-- handle array input, checkboxes
if m[key] then
local mk = m[key]
if type(mk) == 'table' then
m[key][#mk + 1] = value
else
m[key] = { mk, value }
end
else
m[key] = value
end
key = nil
value = nil
end
end
if ctype == 'eof' then break end
end
return m
end
-- proses post based on content type
function _M.read(self)
local ctype = var.content_type
if ctype and find(ctype, 'multipart') then
return multipart(self)
end
read_body()
if ctype and find(ctype, 'json') then
local body = var.request_body
return body and cjson.decode(body) or {}
end
return get_post_args()
end
return _M
|
local module = {
Name = "Teleport",
Description = "Teleports a player to another player",
Location = "Player",
}
module.Execute = function(Client, Type, Attachment)
if Type == "command" then
local char = module.API.getCharacter(module.API.getPlayerWithName(Attachment))
if char then
local Input = module.API.sendModalToPlayer(Client).Event:Wait()
if not Input then return false end
local char1 = module.API.getCharacter(module.API.getPlayerWithName(Input))
local primaryPart, primaryPart1 = char.PrimaryPart, char1 and char1.PrimaryPart
if primaryPart and primaryPart1 then
char:SetPrimaryPartCFrame(primaryPart1.CFrame:ToWorldSpace(CFrame.new(Vector3.new(0, 0, 5), primaryPart1.Position)))
return true
end
return false
end
end
end
return module
|
local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false)
local IceFocusThreat = IceCore_CreateClass(IceThreat)
-- constructor
function IceFocusThreat.prototype:init()
IceFocusThreat.super.prototype.init(self, "FocusThreat", "focus")
end
function IceFocusThreat.prototype:GetDefaultSettings()
local settings = IceFocusThreat.super.prototype.GetDefaultSettings(self)
settings["side"] = IceCore.Side.Right
settings["offset"] = 4
return settings
end
-- Load us up
if FocusUnit then
IceHUD.IceFocusThreat = IceFocusThreat:new()
end
|
local tt = require "tabletrack"
local dump = function(t)
-- uncomment next line for verbose output
--print(require("pl.pretty").write(t))
end
describe("tabletrack", function()
local filename = "./tracker_output"
local snapshot
before_each(function()
os.remove(filename)
snapshot = assert:snapshot()
assert:set_parameter("TableFormatLevel", -1)
end)
after_each(function()
os.remove(filename)
snapshot:revert()
end)
it("tracks access of a new key, set+get", function()
local t = tt.track_access({}, {
name = "test_table",
filename = filename,
})
t.hello = "world"
local x = t.world -- luacheck: ignore
local results = tt.parse_file(filename)
dump(results)
assert(results.test_table.hello.set)
local trace, count = next(results.test_table.hello.set)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_table.world.get)
local trace, count = next(results.test_table.world.get)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
end)
it("tracks access of an existing key", function()
tt.track_access({
hello = "world",
}, {
name = "test_table",
filename = filename,
})
local results = tt.parse_file(filename)
dump(results)
assert(results.test_table.hello.exists)
local trace, count = next(results.test_table.hello.exists)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
end)
it("gets the first stacktrace line", function()
local t = tt.track_access({}, {
name = "test_table",
filename = filename,
full_trace = false,
})
t.hello = "world"
local x = t.world -- luacheck: ignore
local results = tt.parse_file(filename)
dump(results)
assert(results.test_table.hello.set)
local trace, count = next(results.test_table.hello.set)
assert.equal(count, 1)
assert.not_matches("\\", trace)
assert.not_matches("\n", trace)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_table.world.get)
local trace, count = next(results.test_table.world.get)
assert.equal(count, 1)
assert.not_matches("\\", trace)
assert.not_matches("\n", trace)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
end)
it("gets the full stacktrace", function()
local t = tt.track_access({}, {
name = "test_table",
filename = filename,
full_trace = true,
})
t.hello = "world"
local x = t.world -- luacheck: ignore
local results = tt.parse_file(filename)
dump(results)
assert(results.test_table.hello.set)
local trace, count = next(results.test_table.hello.set)
assert.equal(count, 1)
assert.matches("\\", trace)
assert.not_matches("\n", trace)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_table.world.get)
local trace, count = next(results.test_table.world.get)
assert.equal(count, 1)
assert.matches("\\", trace)
assert.not_matches("\n", trace)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
end)
it("tracks access of a new key, with meta table, set+get", function()
local t = setmetatable({},{})
tt.track_access(t, {
name = "test_table",
filename = filename,
})
t.hello = "world"
local x = t.world -- luacheck: ignore
local results = tt.parse_file(filename)
dump(results)
assert(results.test_table.hello.set)
local trace, count = next(results.test_table.hello.set)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_table.world.get)
local trace, count = next(results.test_table.world.get)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
end)
it("tracks access of an existing key, with meta table", function()
local t = setmetatable({},{})
t.hello = "world"
tt.track_access(t, {
name = "test_table",
filename = filename,
})
local results = tt.parse_file(filename)
dump(results)
assert(results.test_table.hello.exists)
local trace, count = next(results.test_table.hello.exists)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
end)
it("tracks access with meta table, where __index is a table", function()
local t = setmetatable({},{
__index = {
world = "from the mt-index"
}
})
tt.track_access(t, {
name = "test_table",
filename = filename,
})
t.hello = "world"
local x = t.world
assert.equal("from the mt-index", x)
local results = tt.parse_file(filename)
dump(results)
assert(results.test_table.hello.set)
local trace, count = next(results.test_table.hello.set)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_table.world.get)
local trace, count = next(results.test_table.world.get)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
end)
it("doesn't track the same table twice", function()
local t = setmetatable({},{})
t.hello = "world"
tt.track_access(t, {
name = "test_table",
filename = filename,
})
assert.has.error(function() tt.track_access(t) end,
"cannot track an already tracked table")
end)
it("tracks access of a new key, with meta table having index/newindex, set+get", function()
local t = setmetatable({},{
__index = function(self, key) return "xxx" end,
__newindex = function(self, key, value)
rawset(self, "called", key)
end,
})
tt.track_access(t, {
name = "test_table",
filename = filename,
})
t.hello = "world"
assert.equal("hello", rawget(t, "called")) -- __newindex was invoked
local xxx = t.world
assert.equal("xxx", xxx) -- __index should be invoked
local results = tt.parse_file(filename)
dump(results)
assert(results.test_table.hello.set)
local trace, count = next(results.test_table.hello.set)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_table.world.get)
local trace, count = next(results.test_table.world.get)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
end)
it("tracks only the tracked table when reusing a metatable", function()
local t = setmetatable({},{
__index = function(self, key) return "xxx" end,
__newindex = function(self, key, value)
rawset(self, "called", key)
end,
})
tt.track_access(t, {
name = "test_table",
filename = filename,
})
local s = setmetatable({}, getmetatable(t))
t.hello = "world"
assert.equal("hello", rawget(t, "called")) -- __newindex was invoked
local xxx = t.world
assert.equal("xxx", xxx) -- __index should be invoked
s.world = "hello"
assert.equal("world", rawget(s, "called")) -- __newindex was invoked
local xxx = s.hello
assert.equal("xxx", xxx) -- __index should be invoked
local results = tt.parse_file(filename)
dump(results)
assert(results.test_table.hello.set)
local trace, count = next(results.test_table.hello.set)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_table.world.get)
local trace, count = next(results.test_table.world.get)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
results.test_table.hello = nil
results.test_table.world = nil
assert.same({test_table = {}}, results)
end)
it("tracks the proper table when reusing a metatable", function()
local t = setmetatable({},{
__index = function(self, key) return "xxx" end,
__newindex = function(self, key, value)
rawset(self, "called", key)
end,
})
tt.track_access(t, {
name = "test_table",
filename = filename,
})
local s = setmetatable({}, getmetatable(t))
tt.track_access(s, {
name = "test_table_s",
filename = filename,
})
t.hello = "world"
assert.equal("hello", rawget(t, "called")) -- __newindex was invoked
local xxx = t.world
assert.equal("xxx", xxx) -- __index should be invoked
s.world = "hello"
assert.equal("world", rawget(s, "called")) -- __newindex was invoked
local xxx = s.hello
assert.equal("xxx", xxx) -- __index should be invoked
local results = tt.parse_file(filename)
dump(results)
assert(results.test_table.hello.set)
local trace, count = next(results.test_table.hello.set)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_table.world.get)
local trace, count = next(results.test_table.world.get)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_table_s.world.set)
local trace, count = next(results.test_table_s.world.set)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_table_s.hello.get)
local trace, count = next(results.test_table_s.hello.get)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
results.test_table.hello = nil
results.test_table.world = nil
results.test_table_s.hello = nil
results.test_table_s.world = nil
assert.same({test_table = {}, test_table_s = {}}, results)
end)
it("tracks all instances of a metatable", function()
local mt = tt.track_type({
__index = function(self, key) return "xxx" end,
__newindex = function(self, key, value)
rawset(self, "called", key)
end,
}, {
name = "test_mt_table",
filename = filename,
full_trace = true,
})
local t = setmetatable({ hello_exists = "world"}, mt)
local s = setmetatable({ world_exists = "hello"}, mt)
t.hello = "world"
assert.equal("hello", rawget(t, "called")) -- __newindex was invoked
local xxx = t.world
assert.equal("xxx", xxx) -- __index should be invoked
local xxx = s.hello
assert.equal("xxx", xxx) -- __index should be invoked
s.world = "hello"
assert.equal("world", rawget(s, "called")) -- __newindex was invoked
local results = tt.parse_file(filename)
dump(results)
assert(results.test_mt_table.hello_exists.exists)
local trace, count = next(results.test_mt_table.hello_exists.exists)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_mt_table.world_exists.exists)
local trace, count = next(results.test_mt_table.world_exists.exists)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_mt_table.hello.set)
local trace, count = next(results.test_mt_table.hello.set)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_mt_table.world.get)
local trace, count = next(results.test_mt_table.world.get)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_mt_table.world.set)
local trace, count = next(results.test_mt_table.world.set)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_mt_table.hello.get)
local trace, count = next(results.test_mt_table.hello.get)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
results.test_mt_table.hello = nil
results.test_mt_table.world = nil
results.test_mt_table.hello = nil
results.test_mt_table.world = nil
results.test_mt_table.world_exists = nil
results.test_mt_table.hello_exists = nil
assert.same({test_mt_table = {}}, results)
end)
it("tracks multiple calls when using a proxy", function()
local t = tt.track_access({}, {
name = "test_table",
filename = filename,
proxy = true,
})
t.hello = "world"
t.hello = "world"
local x = t.world -- luacheck: ignore
local x = t.world -- luacheck: ignore
local x = t.world -- luacheck: ignore
local results = tt.parse_file(filename)
dump(results)
assert(results.test_table.hello.set)
local trace, count = next(results.test_table.hello.set)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_table.world.get)
local trace, count = next(results.test_table.world.get)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
end)
it("tracks all instances of a metatable with proxy", function()
local last_call
local mt = tt.track_type({
__index = function(self, key)
last_call = "__index"
return "xxx"
end,
__newindex = function(self, key, value)
last_call = "__newindex"
rawset(self, "called", key)
end,
}, {
name = "test_mt_table",
filename = filename,
full_trace = true,
proxy = true,
})
local t = setmetatable({ hello_exists = "world"}, mt)
local s = setmetatable({ world_exists = "hello"}, mt)
last_call = nil
t.hello = "world"
assert.equal("__newindex", last_call) -- __newindex was invoked
last_call = nil
local xxx = t.world
assert.equal("__index", last_call) -- __index should be invoked
assert.equal("xxx", xxx)
last_call = nil
local xxx = s.hello -- luacheck: ignore
assert.equal("__index", last_call) -- __index should be invoked
last_call = nil
s.world = "hello"
assert.equal("__newindex", last_call) -- __newindex was invoked
local results = tt.parse_file(filename)
dump(results)
assert(results.test_mt_table.hello_exists.exists)
local trace, count = next(results.test_mt_table.hello_exists.exists)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_mt_table.world_exists.exists)
local trace, count = next(results.test_mt_table.world_exists.exists)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_mt_table.hello.set)
local trace, count = next(results.test_mt_table.hello.set)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_mt_table.world.get)
local trace, count = next(results.test_mt_table.world.get)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_mt_table.world.set)
local trace, count = next(results.test_mt_table.world.set)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
assert(results.test_mt_table.hello.get)
local trace, count = next(results.test_mt_table.hello.get)
assert.equal(count, 1)
assert.matches("^[^\\]+tabletrack_spec%.lua", trace)
results.test_mt_table.hello = nil
results.test_mt_table.world = nil
results.test_mt_table.hello = nil
results.test_mt_table.world = nil
results.test_mt_table.world_exists = nil
results.test_mt_table.hello_exists = nil
assert.same({test_mt_table = {}}, results)
end)
end)
|
local _ = function(k,...) return ImportPackage("i18n").t(GetPackageName(),k,...) end
local HungerFoodHud
local ThirstHud
local HealthHud
local VehicleSpeedHud
local VehicleFuelHud
local VehicleHealthHud
local SpeakingHud
local minimap
function OnPackageStart()
HungerFoodHud = CreateWebUI(0, 0, 0, 0, 0, 28)
SetWebAlignment(HungerFoodHud, 1.0, 0.0)
SetWebAnchors(HungerFoodHud, 0.0, 0.0, 1.0, 1.0)
LoadWebFile(HungerFoodHud, "http://asset/onsetrp/hud/hunger/hunger.html")
SetWebVisibility(HungerFoodHud, WEB_HITINVISIBLE)
ThirstHud = CreateWebUI(0, 0, 0, 0, 0, 28)
SetWebAlignment(ThirstHud, 1.0, 0.0)
SetWebAnchors(ThirstHud, 0.0, 0.0, 1.0, 1.0)
LoadWebFile(ThirstHud, "http://asset/onsetrp/hud/thirst/thirst.html")
SetWebVisibility(ThirstHud, WEB_HITINVISIBLE)
HealthHud = CreateWebUI(0, 0, 0, 0, 0, 28)
SetWebAlignment(HealthHud, 1.0, 0.0)
SetWebAnchors(HealthHud, 0.0, 0.0, 1.0, 1.0)
LoadWebFile(HealthHud, "http://asset/onsetrp/hud/health/health.html")
SetWebVisibility(HealthHud, WEB_HITINVISIBLE)
VehicleSpeedHud = CreateTextBox(-15, 260, "Speed", "right" )
SetTextBoxAnchors(VehicleSpeedHud, 1.0, 0.0, 1.0, 0.0)
SetTextBoxAlignment(VehicleSpeedHud, 1.0, 0.0)
VehicleHealthHud = CreateTextBox(-15, 280, "Health", "right" )
SetTextBoxAnchors(VehicleHealthHud, 1.0, 0.0, 1.0, 0.0)
SetTextBoxAlignment(VehicleHealthHud, 1.0, 0.0)
VehicleFuelHud = CreateTextBox(-15, 300, "Fuel", "right" )
SetTextBoxAnchors(VehicleFuelHud, 1.0, 0.0, 1.0, 0.0)
SetTextBoxAlignment(VehicleFuelHud, 1.0, 0.0)
SpeakingHud = CreateWebUI( 0, 0, 0, 0, 0, 48 )
LoadWebFile( SpeakingHud, "http://asset/onsetrp/hud/speaking/hud.html" )
SetWebAlignment( SpeakingHud, 0, 0 )
SetWebAnchors( SpeakingHud, 0, 0, 1, 1 )
SetWebVisibility( SpeakingHud, WEB_HITINVISIBLE )
minimap = CreateWebUI(0, 0, 0, 0, 0, 32)
SetWebVisibility(minimap, WEB_HITINVISIBLE)
SetWebAnchors(minimap, 0, 0, 1, 1)
SetWebAlignment(minimap, 0, 0)
SetWebURL(minimap, "http://asset/onsetrp/hud/minimap/minimap.html")
ShowHealthHUD(false)
ShowWeaponHUD(true)
end
AddEvent("OnPackageStart", OnPackageStart)
function updateHud(hunger, thirst, cash, bank, healthlife, vehiclefuel)
ExecuteWebJS(HealthHud, "SetHealth("..healthlife..");")
ExecuteWebJS(ThirstHud, "SetThirst("..thirst..");")
ExecuteWebJS(HungerFoodHud, "SetHunger("..hunger..");")
if GetPlayerVehicle() ~= 0 then
vehiclespeed = math.floor(GetVehicleForwardSpeed(GetPlayerVehicle()))
vehiclehealth = math.floor(GetVehicleHealth(GetPlayerVehicle()))
SetTextBoxText(VehicleSpeedHud, _("speed")..vehiclespeed.."KM/H")
SetTextBoxText(VehicleHealthHud, _("vehicle_health")..vehiclehealth)
SetTextBoxText(VehicleFuelHud, _("fuel")..vehiclefuel)
else
SetTextBoxText(VehicleSpeedHud, "")
SetTextBoxText(VehicleFuelHud, "")
SetTextBoxText(VehicleHealthHud, "")
end
end
AddRemoteEvent("updateHud", updateHud)
AddEvent( "OnGameTick", function()
--Speaking icon check
local player = GetPlayerId()
if IsPlayerTalking(player) then
SetWebVisibility(SpeakingHud, WEB_HITINVISIBLE)
else
SetWebVisibility(SpeakingHud, WEB_HIDDEN)
end
--Minimap refresh
local x, y, z = GetCameraRotation()
local px,py,pz = GetPlayerLocation()
ExecuteWebJS(minimap, "SetHUDHeading("..(360-y)..");")
ExecuteWebJS(minimap, "SetMap("..px..","..py..","..y..");")
-- Hud refresh
CallRemoteEvent("getHudData")
end )
AddEvent("OnKeyPress", function(key)
if key == "Z" then
if GetWebVisibility(minimap) == WEB_HITINVISIBLE then
SetWebVisibility(minimap, WEB_HIDDEN)
else
SetWebVisibility(minimap, WEB_HITINVISIBLE)
end
end
end)
function SetHUDMarker(name, h, r, g, b)
if h == nil then
ExecuteWebJS(minimap, "SetHUDMarker(\""..name.."\");");
else
ExecuteWebJS(minimap, "SetHUDMarker(\""..name.."\", "..h..", "..r..", "..g..", "..b..");");
end
end
AddRemoteEvent("SetHUDMarker", SetHUDMarker)
|
Locale = require("delayedLoad.dlua").new("localeCore.dlua");
function LANG(idTxt)
return Locale.lang(idTxt);
end
function lang(idTxt)
return Locale.lang(idTxt);
end
function tryLang(idTxt)
return Locale.tryLang(idTxt);
end
function tryLANG(idTxt)
return Locale.tryLang(idTxt);
end
return Locale;
|
if love.filesystem then
-- loverocks
require 'rocks' ()
-- src
love.filesystem.setRequirePath("src/?.lua;" .. love.filesystem.getRequirePath())
-- lib
love.filesystem.setRequirePath("lib/?;lib/?.lua;lib/?/init.lua;" .. love.filesystem.getRequirePath())
end
function love.conf(t)
t.identity = "wizlove"
t.version = "11.2"
t.window.title = "Witchcraft"
t.window.icon = nil
t.window.width = 320
t.window.height = 200
t.window.resizable = true
-- loverocks
t.dependencies = {
"middleclass",
}
end
|
object_tangible_storyteller_prop_pr_lifeday_mystic_tree = object_tangible_storyteller_prop_shared_pr_lifeday_mystic_tree:new {
}
ObjectTemplates:addTemplate(object_tangible_storyteller_prop_pr_lifeday_mystic_tree, "object/tangible/storyteller/prop/pr_lifeday_mystic_tree.iff")
|
local name, id = ...
local log = require "log"
log.set_name(name..id)
require "gateway.gate"
|
local Fmt = require(script.Parent.Fmt)
local Level = {
Error = 0,
Warning = 1,
Info = 2,
Debug = 3,
Trace = 4,
}
local function getLogLevel()
return Level.Info
end
local function addTags(tag, message)
return tag .. message:gsub('\n', '\n' .. tag)
end
local TRACE_TAG = (' '):rep(15) .. '[MazeGenerator-Trace] '
local INFO_TAG = (' '):rep(15) .. '[MazeGenerator-Info] '
local DEBUG_TAG = (' '):rep(15) .. '[MazeGenerator-Debug] '
local WARN_TAG = '[MazeGenerator-Warn] '
local Log = {}
Log.Level = Level
function Log.setLogLevelThunk(thunk)
getLogLevel = thunk
end
function Log.trace(template, ...)
if getLogLevel() >= Level.Trace then
print(addTags(TRACE_TAG, Fmt.fmt(template, ...)))
end
end
function Log.info(template, ...)
if getLogLevel() >= Level.Info then
print(addTags(INFO_TAG, Fmt.fmt(template, ...)))
end
end
function Log.debug(template, ...)
if getLogLevel() >= Level.Debug then
print(addTags(DEBUG_TAG, Fmt.fmt(template, ...)))
end
end
function Log.warn(template, ...)
if getLogLevel() >= Level.Warning then
warn(addTags(WARN_TAG, Fmt.fmt(template, ...)))
end
end
return Log
|
return require((...)..".ecs")
|
-- Copyright (c) 2021 Trevor Redfern
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
local tables = require "moonpie.tables"
local Thunk = require "moonpie.redux.thunk"
local Aliens = require "game.rules.aliens"
local FieldOfView = require "game.rules.field_of_view"
local Items = require "game.rules.items"
local Map = require "game.rules.map"
local MessageLog = require "game.rules.message_log"
local Player = require "game.rules.player"
local Position = require "game.rules.world.position"
local Selectors = require "game.rules.game_state.selectors"
local Actions = {}
Actions.types = {
CHECK_GAME_OVER = "GAME_STATE_CHECK_GAME_OVER",
GAME_OVER = "GAME_STATE_GAME_OVER",
LOAD_CORE_DATA = "GAME_STATE_LOAD_CORE_DATA",
SETUP = "GAME_STATE_SETUP",
UPDATE_FRAME = "GAME_STATE_UPDATE_FRAME"
}
function Actions.checkGameOver()
return Thunk(
Actions.types.CHECK_GAME_OVER,
function(dispatch, getState)
local state = getState()
if Selectors.isGameLost(state) then
dispatch(Actions.gameOver())
end
if Selectors.isGameWon(state) then
dispatch(Actions.gameOver())
end
end
)
end
function Actions.gameOver()
return Thunk(
Actions.types.GAME_OVER,
function()
local app = require "game.app"
app.gameOver()
end
)
end
function Actions.loadCoreData()
return Thunk(
Actions.types.LOAD_CORE_DATA,
function()
require "assets.characters.names"
end
)
end
function Actions.setup()
return Thunk(
Actions.types.SETUP,
function(dispatch, getState)
dispatch(Map.actions.create(40, 40, Map.generators.dungeon))
local rooms = Map.selectors.getRooms(getState())
local playerStartRoom = tables.pickRandom(rooms)
local x = playerStartRoom.x + math.floor(playerStartRoom.width / 2)
local y = playerStartRoom.y + math.floor(playerStartRoom.height / 2)
dispatch(Player.actions.add(Position(x, y, playerStartRoom.level)))
dispatch(Player.actions.equipItem(Items.Weapons.sword()))
dispatch(Player.actions.equipItem(Items.Weapons.laserRifle()))
for _ = 1,20 do
local r = tables.pickRandom(rooms)
dispatch(Aliens.actions.addSpawner(
Position(
r.x + love.math.random(r.width) - 1,
r.y + love.math.random(r.height) - 1,
r.level
)))
end
dispatch(FieldOfView.actions.calculateAll())
dispatch(MessageLog.actions.add(
MessageLog.messages.tutorial.welcome
))
end
)
end
function Actions.updateFrame(deltaTime)
local Graphics = require "game.rules.graphics"
return Thunk(Actions.types.UPDATE_FRAME, function(dispatch)
dispatch(Graphics.actions.updateFrame(deltaTime))
end)
end
return Actions
|
-- [1. Simple Table]
mytable = {}
print("type of mytable: ", type(mytable))
mytable[1] = "Lua"
mytable["wow"] = "Before Altering"
print("the element of index 1 in mytable is: ", mytable[1])
print("the element of index wow in mytable is: ", mytable["wow"])
-- [alternatetable and mytable point at the same table]
alternatetable = mytable
print("alternatetable[1]: ", alternatetable[1])
print("alternatetable[\"wow\"]", alternatetable["wow"])
alternatetable["wow"] = "After Altering"
print("alternatetable[\"wow\"]: ", alternatetable["wow"])
-- release variable
alternatetable = nil
print("alternatetable: ", alternatetable)
-- mytable is still able to be visited
print("mytable[\"wow\"]", mytable["wow"])
mytable = nil
print("mytable: ", mytable)
-- [1. Table concat]
fruits = {"banana", "orange", "apple"}
-- return the string after concatting tables
print("Concatted string: ", table.concat(fruits))
-- assign concat character
print("Concatted string: ", table.concat(fruits, ", "))
-- assign index to concat table
print("Concatted string: ", table.concat(fruits, ", ", 2, 3))
-- [2. Table insert]
table.insert(fruits, "mango")
print("the element of index 4 is: ", fruits[4])
-- insert at index 2
table.insert(fruits, 2, "grapes")
print("the element of index 2 is: ", fruits[2])
print("the last element is: ", fruits[5])
-- remove th last element
table.remove(fruits)
print("the last element after removing: ", fruits[5])
-- [3. Table sort]
fruits = {"banana", "orange", "apple", "grapes"}
print("Before sorting")
for k,v in ipairs(fruits) do
print(k, v)
end
table.sort(fruits)
print("After sorting")
for k,v in ipairs(fruits) do
print(k, v)
end
-- [4. Table maxn]
function table_maxn(t)
local mn = nil
for k,v in ipairs(t) do
if(mn == nil) then
mn = v
end
if mn < v then
mn = v
end
end
return mn
end
tb1 = {[1] = 2, [2] = 6, [3] = 34, [26] = 5}
print("max in tb1: ", table_maxn(tb1))
print("length of tb1: ", #tb1)
-- [5. Table length]
function table_length(t)
local length = 0
for k, v in pairs(s) do
length = length + 1
end
return length
end
|
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- F I N A L C U T P R O A P I --
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--- === cp.ui.CheckBox ===
---
--- Check Box UI Module.
--------------------------------------------------------------------------------
--
-- EXTENSIONS:
--
--------------------------------------------------------------------------------
local axutils = require("cp.ui.axutils")
--------------------------------------------------------------------------------
--
-- THE MODULE:
--
--------------------------------------------------------------------------------
local CheckBox = {}
-- TODO: Add documentation
function CheckBox.matches(element)
return element:attributeValue("AXRole") == "AXCheckBox"
end
--- cp.ui.CheckBox:new(axuielement, function) -> CheckBox
--- Function
--- Creates a new CheckBox
function CheckBox:new(parent, finderFn)
local o = {_parent = parent, _finder = finderFn}
setmetatable(o, self)
self.__index = self
return o
end
-- TODO: Add documentation
function CheckBox:parent()
return self._parent
end
function CheckBox:isShowing()
return self:UI() ~= nil and self:parent():isShowing()
end
-- TODO: Add documentation
function CheckBox:UI()
return axutils.cache(self, "_ui", function()
return self._finder()
end,
CheckBox.matches)
end
-- TODO: Add documentation
function CheckBox:isChecked()
local ui = self:UI()
return ui and ui:value() == 1
end
-- TODO: Add documentation
function CheckBox:check()
local ui = self:UI()
if ui and ui:value() == 0 then
ui:doPress()
end
return self
end
-- TODO: Add documentation
function CheckBox:uncheck()
local ui = self:UI()
if ui and ui:value() == 1 then
ui:doPress()
end
return self
end
-- TODO: Add documentation
function CheckBox:toggle()
local ui = self:UI()
if ui then
ui:doPress()
end
return self
end
-- TODO: Add documentation
function CheckBox:isEnabled()
local ui = self:UI()
return ui and ui:enabled()
end
-- TODO: Add documentation
function CheckBox:press()
local ui = self:UI()
if ui then
ui:doPress()
end
return self
end
-- TODO: Add documentation
function CheckBox:saveLayout()
return {
checked = self:isChecked()
}
end
-- TODO: Add documentation
function CheckBox:loadLayout(layout)
if layout then
if layout.checked then
self:check()
else
self:uncheck()
end
end
end
return CheckBox
|
if mods["Clowns-Processing"] and mods["Clowns-Extended-Minerals"] then
recipe_1 =
{
{"processing-unit", 100},
{"steel-plate", 100},
{"cobalt-plate", 100},
{"pipe", 100},
{"stone-brick", 100}
}
recipe_2 =
{
{"particle-accelerator-mk1", 1},
{"advanced-processing-unit", 100},
{"clowns-plate-osmium", 100},
{"titanium-bearing", 100},
{"titanium-pipe", 100},
{"stone-brick", 100}
}
else
recipe_1 =
{
{"processing-unit", 100},
{"steel-plate", 100},
{"iron-gear-wheel", 100},
{"pipe", 100},
{"stone-brick", 100}
}
recipe_2 =
{
{"particle-accelerator-mk1", 1},
{"advanced-processing-unit", 100},
{"cobalt-plate", 100},
{"tungsten-gear-wheel", 100},
{"tungsten-pipe", 100},
{"stone-brick", 100}
}
end
data:extend(
{
{
type = "recipe",
name = "particle-accelerator-mk1",
enabled = false,
energy_required = 10,
ingredients = recipe_1,
result = "particle-accelerator-mk1"
},
{
type = "recipe",
name = "particle-accelerator-mk2",
enabled = false,
energy_required = 10,
ingredients = recipe_2,
result = "particle-accelerator-mk2"
},
{
type = "item",
name = "particle-accelerator-mk1",
fast_replaceable_group = "particle-accelerator",
icons =
{
{
icon = "__Clowns-Science__/graphics/icons/particle-accelerator.png"
},
{
icon = "__angelsrefining__/graphics/icons/num_1.png",
icon_size=32,
tint = {r = 0.8, g = 0.8, b = 0.8, a = 0.5},
scale = 0.32,
shift = {-12, -12}
}
},
icon_size = 32,
-- flags = {"goes-to-quickbar"},
subgroup = "advanced-science",
order = "b-a",
place_result = "particle-accelerator-mk1",
stack_size = 10,
},
{
type = "item",
name = "particle-accelerator-mk2",
icons =
{
{
icon = "__Clowns-Science__/graphics/icons/particle-accelerator.png"
},
{
icon = "__angelsrefining__/graphics/icons/num_2.png",
icon_size=32,
tint = {r = 0.8, g = 0.8, b = 0.8, a = 0.5},
scale = 0.32,
shift = {-12, -12}
}
},
icon_size = 32,
-- flags = {"goes-to-quickbar"},
subgroup = "advanced-science",
order = "b-b",
place_result = "particle-accelerator-mk2",
stack_size = 10,
},
{
type = "assembling-machine",
name = "particle-accelerator-mk1",
fast_replaceable_group = "particle-accelerator",
icons =
{
{
icon = "__Clowns-Science__/graphics/icons/particle-accelerator.png"
},
{
icon = "__angelsrefining__/graphics/icons/num_1.png",
icon_size=32,
tint = {r = 0.8, g = 0.8, b = 0.8, a = 0.5},
scale = 0.32,
shift = {-12, -12}
}
},
icon_size = 32,
flags = {"placeable-neutral", "placeable-player", "player-creation"},
minable = {hardness = 0.8, mining_time = 1.2, result = "particle-accelerator-mk1"},
max_health = 500,
corpse = "big-remnants",
dying_explosion = "big-explosion",
light = {intensity = 1, size = 100},--int = 0.75, s = 8
resistances =
{
{
type = "fire",
percent = 70
}
},
collision_box = {{-2.9, -2.9}, {2.9, 2.9}},
selection_box = {{-3, -3}, {3, 3}},
animation =
{
filename = "__Clowns-Science__/graphics/entity/particle-accelerator.png",
priority = "high",
width = 256,
height = 256,
frame_count = 30,
line_length = 6,
animation_speed = 1,
shift = {0,0}
},
crafting_categories = {"particle-accelerator"},
crafting_speed = 1,
module_specification =
{
module_slots = 2
},
allowed_effects = {"consumption", "speed", "pollution"},--no efficiency
energy_source =
{
type = "electric",
usage_priority = "secondary-input",
emissions = 0
},
energy_usage = "500MW",
ingredient_count = 2,
open_sound = { filename = "__base__/sound/machine-open.ogg", volume = 0.85 },
close_sound = { filename = "__base__/sound/machine-close.ogg", volume = 0.75 },
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
working_sound =
{
sound =
{
{
filename = "__base__/sound/assembling-machine-t1-1.ogg",
volume = 0.8
},
{
filename = "__base__/sound/assembling-machine-t1-2.ogg",
volume = 0.8
},
},
idle_sound = {filename = "__base__/sound/idle1.ogg", volume = 0.6},
apparent_volume = 1.5,
}
},
{
type = "assembling-machine",
name = "particle-accelerator-mk2",
fast_replaceable_group = "particle-accelerator",
icons =
{
{
icon = "__Clowns-Science__/graphics/icons/particle-accelerator.png"
},
{
icon = "__angelsrefining__/graphics/icons/num_1.png",
icon_size=32,
tint = {r = 0.8, g = 0.8, b = 0.8, a = 0.5},
scale = 0.32,
shift = {-12, -12}
}
},
icon_size = 32,
flags = {"placeable-neutral", "placeable-player", "player-creation"},
minable = {hardness = 0.8, mining_time = 1.2, result = "particle-accelerator-mk2"},
max_health = 500,
corpse = "big-remnants",
dying_explosion = "big-explosion",
light = {intensity = 1, size = 100},--int = 0.75, s = 8
resistances =
{
{
type = "fire",
percent = 70
}
},
collision_box = {{-2.9, -2.9}, {2.9, 2.9}},
selection_box = {{-3, -3}, {3, 3}},
animation =
{
filename = "__Clowns-Science__/graphics/entity/particle-accelerator.png",
priority = "high",
width = 256,
height = 256,
frame_count = 30,
line_length = 6,
animation_speed = 1,
shift = {0,0}
},
crafting_categories = {"particle-accelerator"},
crafting_speed = 2,
module_specification =
{
module_slots = 4
},
allowed_effects = {"consumption", "speed", "pollution"},
energy_source =
{
type = "electric",
usage_priority = "secondary-input",
emissions = 0
},
energy_usage = "750MW",
ingredient_count = 2,
open_sound = { filename = "__base__/sound/machine-open.ogg", volume = 0.85 },
close_sound = { filename = "__base__/sound/machine-close.ogg", volume = 0.75 },
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
working_sound =
{
sound =
{
{
filename = "__base__/sound/assembling-machine-t1-1.ogg",
volume = 0.8
},
{
filename = "__base__/sound/assembling-machine-t1-2.ogg",
volume = 0.8
},
},
idle_sound = {filename = "__base__/sound/idle1.ogg", volume = 0.6},
apparent_volume = 1.5,
}
}
}
)
|
GM.Challenges = {}
GM.Challenges["5_Pots"] = {
Name = "No Challenges",
Other = "5_Pots",
Desc = "No Challenges",
Pro = "Pro_Crafting",
Item = "item_pot",
Unlocks = "10_Pots",
Amount = 1000,
Diff = 3,
}
GM.Challenges["10_Pots"] = {
Name = "No Challenges",
Other = "10_Pots",
Desc = "No Challenges",
Pro = "GENERAL",
Item = "item_pot",
Unlocks = "10_Pots",
Amount = 1000,
Diff = 3,
}
|
AddCSLuaFile( "shared.lua" )
include( 'shared.lua' )
function ENT:OnRemove()
for k, v in pairs(self.m_Entities) do
if (IsValid(v)) then
self:EndTouch(v)
end
end
end
function ENT:Think()
for k, v in pairs(self.m_Players) do
if (!IsValid(v)) then
self.m_Players[k] = nil
end
end
for k, v in pairs(self.m_Entities) do
if (!IsValid(v)) then
self.m_Entities[k] = nil
end
end
self:NextThink(CurTime() + 0.1)
return true
end
function ENT:Touch(ent)
if (!IsValid(ent) or ent.IsZone) then
return end
if (!self:PassesZoneFilter(ent)) then
if (self.m_Entities[tostring(ent)]) then
self:EndTouch(ent)
end
return
end
if (self.m_Entities[tostring(ent)]) then
return end
if (ent:IsPlayer() and ent:Alive()) then
if (hook.Run("CanPlayerEnterSafeZone", self, ent) == false) then
return
end
self.m_Players[ent:SteamID()] = ent
end
self.m_Entities[tostring(ent)] = ent
self:OnZoneEntered(ent)
end
function ENT:EndTouch(ent)
local call = false
if (ent:IsPlayer()) then
call = self.m_Players[ent:SteamID()] ~= nil
self.m_Players[ent:SteamID()] = nil
end
if (self.m_Entities[tostring(ent)]) then
call = true
self.m_Entities[tostring(ent)] = nil
end
if (call) then
self:OnZoneExited(ent)
end
end
function ENT:OnZoneEntered(ent)
if (ent:IsPlayer()) then
SH_SZ:EnterSafeZone(ent, self)
end
if (ent:IsNPC() and self.m_Options.nonpc) then
SafeRemoveEntity(ent)
elseif (ent:IsVehicle()) then
local driver = ent:GetDriver()
if (!IsValid(driver) or !CAMI.PlayerHasAccess(driver, "Safezone - edit", nil)) then
if (IsValid(driver)) then
driver:ExitVehicle()
end
SafeRemoveEntity(ent)
end
elseif (ent.SH_SpawnedBy) then
local owner = ent.SH_SpawnedBy
if (self.m_Options.noprop and not (IsValid(owner) and CAMI.PlayerHasAccess(owner, "Safezone - edit", nil))) then
SafeRemoveEntity(ent)
end
end
end
function ENT:OnZoneExited(ent)
if (ent:IsPlayer()) then
SH_SZ:ExitSafeZone(ent, self)
end
end
function ENT:PassesZoneFilter(ent)
if (self.m_Shape == "sphere") then
local pos = ent:GetPos():Distance(self:GetPos())
return pos <= self.m_fSize
end
return true
end
function ENT:UpdateTransmitState()
return TRANSMIT_NEVER
end
|
#!/usr/bin/lua
require "nixio"
require "luci.util"
require "luci.sys"
local uci = require("luci.model.uci").cursor()
local fs = require "luci.openclash"
local json = require "luci.jsonc"
local function dler_checkin()
local info, path, checkin
local token = uci:get("openclash", "config", "dler_token")
local email = uci:get("openclash", "config", "dler_email")
local passwd = uci:get("openclash", "config", "dler_passwd")
local enable = uci:get("openclash", "config", "dler_checkin") or 0
local interval = uci:get("openclash", "config", "dler_checkin_interval") or 1
local multiple = uci:get("openclash", "config", "dler_checkin_multiple") or 1
path = "/tmp/dler_checkin"
if token and email and passwd and enable == "1" then
checkin = string.format("curl -sL -H 'Content-Type: application/json' -d '{\"email\":\"%s\", \"passwd\":\"%s\", \"multiple\":\"%s\"}' -X POST https://dler.cloud/api/v1/checkin -o %s", email, passwd, multiple, path)
if not nixio.fs.access(path) then
luci.sys.exec(checkin)
else
if fs.readfile(path) == "" or not fs.readfile(path) then
luci.sys.exec(checkin)
else
if (os.time() - fs.mtime(path) > interval*3600+1) then
luci.sys.exec(checkin)
else
os.exit(0)
end
end
end
info = fs.readfile(path)
if info then
info = json.parse(info)
end
if info and info.ret == 200 then
luci.sys.exec(string.format('echo "%s Dler Cloud Checkin Successful, Result:【%s】" >> /tmp/openclash.log', os.date("%Y-%m-%d %H:%M:%S"), info.data.checkin))
else
if info and info.msg then
luci.sys.exec(string.format('echo "%s Dler Cloud Checkin Failed, Result:【%s】" >> /tmp/openclash.log', os.date("%Y-%m-%d %H:%M:%S"), info.msg))
else
luci.sys.exec(string.format('echo "%s Dler Cloud Checkin Failed! Please Check And Try Again..." >> /tmp/openclash.log', os.date("%Y-%m-%d %H:%M:%S")))
end
end
end
os.exit(0)
end
dler_checkin()
|
-- STD is a small lua rendition of the C++ standard template library.
-- algorithm.lua aims to provide similar functonality to that of <algorithm>
if not std then std = {} end;
std.algorithm = {};
-- Returns the (i, v) pair max of the given table
function std.algorithm.max_of(t)
local result = -math.huge;
local index = 1;
for i, v in ipairs(t) do
if v and v > result then
result = v;
index = i;
end
end
return index, result;
end
-- Given a table of values, and a function, return a table of the transformed table
function std.algorithm.transform(values, fn)
local t = {}
for _, v in ipairs(values) do
local result = fn(v);
table.insert(t, result)
end
return t;
end
-- Count the number of values that match the given predicate "pred".
-- t is a table of values to count
function std.algorithm.count_if(t, pred)
local count = 0;
for _, v in ipairs(t) do
if pred(v) then
count = count + 1;
end
end
return count;
end
-- Count the number of values in a table "t" that match the given value "value".
-- t is a table, value is possible value contained in the table "t".
function std.algorithm.count(t, value)
return std.algorithm.count_if(t, function(v)
return v == value
end);
end
function std.algorithm.find_if(t, pred)
for i, v in ipairs(t) do
if pred(v) then
return i;
end
end
return nil
end
function std.algorithm.find(t, value)
return std.algorithm.find_if(t, function(v)
return v == value;
end);
end
-- Create a copy of the given table "source"
-- Note: This is the functional equivalent of a function that would take source and target tables as arguments.
-- Returns a copy of the given table.
function std.algorithm.copy(source)
local target = {};
for k, v in pairs(source) do
target[k] = v;
end
return target;
end
function std.algorithm.equal(first, second)
if #first ~= #second then
return false;
end
for i, v in ipairs(first) do
if v ~= second[i] then
return false;
end
end
return true;
end
function std.algorithm.copy_back(target, source)
for _, v in ipairs(source) do
table.insert(target, v);
end
return target;
end
|
object_draft_schematic_droid_component_cybernetic_heat_resist_module_two_core = object_draft_schematic_droid_component_shared_cybernetic_heat_resist_module_two_core:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_droid_component_cybernetic_heat_resist_module_two_core, "object/draft_schematic/droid/component/cybernetic_heat_resist_module_two_core.iff")
|
-- snap amount is the amount of different angles car can drive on,
-- (360 / vehiclesnap_amount) is the difference between 2 axis
-- car will slowly turn towards such angle axis
-- Default 16, recommended other tries 4, 8 or 32.
-- You can change snapping amount and keybinds ingame in menus.
local function OnOffText(value)
if value then return {"description.VehicleSnap_enable"}
else return {"description.VehicleSnap_disable"} end
end
local function PlayerToggle(event)
local player = game.players[event.player_index]
global.players[event.player_index].snap = not global.players[event.player_index].snap
CheckDrivingState(player)
-- Create floating text at car position (auto-disappears after a couple of seconds)
player.surface.create_entity{ name = "flying-text", position = player.position,
text = OnOffText(global.players[event.player_index].snap) }
player.set_shortcut_toggled("VehicleSnap-shortcut", global.players[event.player_index].snap)
end
script.on_event("VehicleSnap-toggle", PlayerToggle)
-- This is ran everytime the game is changed (adding mods upgrading etc) and installed.
local function run_install()
global.players = global.players or {}
for i, player in (pairs(game.players)) do
--game.players[i].print("VehicleSnap installed") -- Debug
global.players[i] = global.players[i] or {
snap = true,
player_ticks = 0,
last_orientation = 0,
-- driving is only true if snapping is true and player is in a valid vehicle
driving = false,
moves = 0,
eff_moves = 0, -- Effective tile moves from last time period
snap_amount = 16
}
local snap = settings.get_player_settings(player)["VehicleSnap_amount"].value
if snap ~= nil then
global.players[i].snap_amount = snap
end
CheckDrivingState(player)
player.set_shortcut_toggled("VehicleSnap-shortcut", global.players[i].snap)
end
ToggleEvents(true)
end
-- Any time a new player is created run this.
script.on_event(defines.events.on_player_created, function(event)
global.players[event.player_index] = {
snap = true,
player_ticks = 0,
last_orientation = 0,
driving = false,
moves = 0,
eff_moves = 0,
snap_amount = 16
}
local snap = settings.get_player_settings(game.players[event.player_index])["VehicleSnap_amount"].value
if snap ~= nil then
global.players[event.player_index].snap_amount = snap
end
end)
script.on_event(defines.events.on_runtime_mod_setting_changed, function(event)
if event.setting == "VehicleSnap_amount" then
local snap = settings.get_player_settings(game.players[event.player_index])["VehicleSnap_amount"].value
if snap ~= nil then
global.players[event.player_index].snap_amount = snap
end
end
end)
function CheckDrivingState(player)
local pdata = global.players[player.index]
local driving = false
if player.vehicle and pdata.snap then -- and player.connected
driving = (player.vehicle.type == "car")
pdata.moves = 0
pdata.eff_moves = 0
pdata.snap_amount = pdata.snap_amount or 16
end
pdata.driving = driving
ToggleEvents(true)
end
script.on_event(defines.events.on_player_driving_changed_state, function(event)
CheckDrivingState(game.players[event.player_index])
end)
script.on_event(defines.events.on_player_died, function(event)
CheckDrivingState(game.players[event.player_index])
end)
local function onPlayerChangedPosition(event)
local pdata = global.players[event.player_index]
if pdata and pdata.driving then
pdata.moves = pdata.moves + 1
-- Debug player speed values
--local player = game.players[event.player_index]
--if player.vehicle then
-- player.surface.create_entity{ name = "flying-text", position = player.position, text = player.vehicle.speed }
--end
end
end
local function onTick()
if game.tick % 2 == 0 then
local drivers = false
moveReset = (game.tick % 40 == 0)
for _, player in pairs(game.connected_players) do
local pdata = global.players[player.index]
if pdata.driving and pdata.snap then
if not player.vehicle then
-- Unexpected error happened, CAR NOT FOUND!
pdata.driving = false
else
drivers = true
if (pdata.eff_moves > 1) and (math.abs(player.vehicle.speed) > 0.03) then
local o = player.vehicle.orientation -- float value, the direction vehicle is facing
-- Has player turned vehicle? Don't push against,
-- so delay snapping a little with player_ticks
if math.abs(o - pdata.last_orientation) < 0.001 then
if pdata.player_ticks > 1 then
local snap_o = math.floor(o * pdata.snap_amount + 0.5) / pdata.snap_amount
-- Interpolate with 80% current and 20% target orientation
o = (o * 4.0 + snap_o) * 0.2
player.vehicle.orientation = o
else
pdata.player_ticks = pdata.player_ticks + 1
end
else
pdata.player_ticks = 0
end
pdata.last_orientation = o
end
if moveReset then -- Counting tile changes, reset every 40 ticks
pdata.eff_moves = pdata.moves
pdata.moves = 0
end
end
end
end
if not drivers then
ToggleEvents(false)
end
end
end
function ToggleEvents(enable)
global.RegisterEvents = enable
if enable then
script.on_event(defines.events.on_tick, onTick)
script.on_event(defines.events.on_player_changed_position, onPlayerChangedPosition)
else
script.on_event(defines.events.on_tick, nil)
script.on_event(defines.events.on_player_changed_position, nil)
end
end
script.on_init(run_install)
script.on_configuration_changed(run_install)
script.on_load(function()
if global.RegisterEvents then
ToggleEvents(true)
end
end)
script.on_event(defines.events.on_lua_shortcut, function(event)
if event.prototype_name == "VehicleSnap-shortcut" then
PlayerToggle(event)
end
end)
|
os.loadAPI("/system/drivers/global/json")
_G.reg = {}
function os.loadReg(f)
fh = fs.open(f,"r")
_G.reg[fs.getName(f)] = textutils.unserialise(fh.readAll())
fh.close()
end
os.loadReg("/system/config/users")
os.loadReg("/system/config/software")
os.loadReg("/system/config/system")
if reg.software.Goldcore.COSC.ui.AllowTermination == 0 then
os.pullEvent = os.pullEventRaw
end
--_G.reg.users = regtemp
_G.udb = reg.users
if fs.exists("/updater/updqueue") then
upd = fs.list("/updater/updqueue")
for k,v in pairs(upd) do
shell.run("/updater/update /updater/updqueue/"..v)
end
term.setBackgroundColor(colors.black)
end
if mounter then
--print("Running on CraftOS-PC. Loading CraftOS-PC drivers...")
drvpc = fs.list("/system/drivers/cspc")
--shell.setDir("/system/drivers/cspc")
for k,v in pairs(drvpc) do
--print("/system/drivers/cspc/"..v)
os.loadAPI("/system/drivers/cspc/"..v)
end
end
drv = fs.list("/system/drivers/global")
for k,v in pairs(drv) do
--print("/system/drivers/global/"..v)
os.loadAPI("/system/drivers/global/"..v)
end
shell.run("/system/startup.lua")
os.ov = os.version
function os.version()
return os.ov().." (COSC)"
end
shell.run("clear")
|
--[[
Desc: Dash state (run)
Author: SerDing
Since: 2017-07-28 21:54:14
Alter: 2017-07-30 12:40:40
]]
local _TIME = require('engine.time')
local _Vector2 = require("utils.vector2")
local _MATH = require("engine.math")
local _SETTING = require("setting")
local _Base = require "entity.states.base"
---@class State.Move : Entity.State.Base
local _Move = require("core.class")(_Base)
function _Move:Ctor(data, ...)
_Base.Ctor(self, data, ...)
self.name = "move"
self._timeUp = 0
self._timeDown = 0
self._timeLeft = 0
self._timeRight = 0
self._speed = _Vector2.New()
end
function _Move:Init(entity)
_Base.Init(self, entity)
self._input:BindAction("move-left", EInput.STATE.PRESSED, nil, function()
self._movement.moveInput.left = true
self._movement.moveSignalTime.left = _TIME.GetTime(true)
end)
self._input:BindAction("move-right", EInput.STATE.PRESSED, nil, function()
self._movement.moveInput.right = true
self._movement.moveSignalTime.right = _TIME.GetTime(true)
end)
self._input:BindAction("move-up", EInput.STATE.PRESSED, nil, function()
self._movement.moveInput.up = true
self._movement.moveSignalTime.down = _TIME.GetTime(true)
end)
self._input:BindAction("move-down", EInput.STATE.PRESSED, nil, function()
self._movement.moveInput.down = true
self._movement.moveSignalTime.up = _TIME.GetTime(true)
end)
self._input:BindAction("move-left", EInput.STATE.RELEASED, nil, function()
self._movement.moveInput.left = false
end)
self._input:BindAction("move-right", EInput.STATE.RELEASED, nil, function()
self._movement.moveInput.right = false
end)
self._input:BindAction("move-up", EInput.STATE.RELEASED, nil, function()
self._movement.moveInput.up = false
end)
self._input:BindAction("move-down", EInput.STATE.RELEASED, nil, function()
self._movement.moveInput.down = false
end)
end
function _Move:Enter()
_Base.Enter(self)
if self._movement.moveInput.left then
self._entity.transform.direction = -1
elseif self._movement.moveInput.right then
self._entity.transform.direction = 1
end
end
function _Move:Update(dt, timeScale)
timeScale = timeScale or 1.0
local up = self._movement.moveInput.up
local down = self._movement.moveInput.down
local left = self._movement.moveInput.left
local right = self._movement.moveInput.right
self._render.timeScale = self._entity.stats.moveRate * timeScale
local moveSpeed = self._entity.stats.moveSpeed * timeScale
self._speed:Set(moveSpeed, moveSpeed * _SETTING.scene.AXIS_RATIO_Y)
local axisX, axisY = 0, 0
self._timeLeft = self._movement.moveSignalTime.left
self._timeRight = self._movement.moveSignalTime.right
self._timeUp = self._movement.moveSignalTime.up
self._timeDown = self._movement.moveSignalTime.down
if up or down then
if up and down then
if self._timeUp > self._timeDown then
axisY = -1
else
axisY = 1
end
elseif up then
axisY = -1
else
axisY = 1
end
end
if left or right then
if left and right then
if self._timeLeft > self._timeRight then
axisX = -1
else
axisX = 1
end
elseif left then
axisX = -1
else
axisX = 1
end
end
if axisX ~= 0 and self._entity.transform.direction ~= axisX then
self._entity.transform.direction = axisX
end
self._movement:Move('x', axisX * self._speed.x)
self._movement:Move('y', axisY * self._speed.y)
if not up and not down and not left and not right then
self._STATE:SetState(self._nextState)
end
end
function _Move:Exit()
self._render.timeScale = 1.0
end
return _Move
|
--[[
Adds ligature fonts
]]
Description="Adds ligature fonts in HTML output"
Categories = {"format", "html", "usability" }
function themeUpdate()
if (HL_OUTPUT == HL_FORMAT_HTML or HL_OUTPUT == HL_FORMAT_XHTML) then
Injections[#Injections+1]="pre.hl, ol.hl { font-family: Monoid,\"Fira Code\",\"DejaVu Sans Code\",monospace;}"
end
end
Plugins={
{ Type="theme", Chunk=themeUpdate }
}
|
local addOn, ab = ...
local db = ConsolePort:GetData()
local L = db.ACTIONBAR
local Bar = ab.bar
---------------------------------------------------------------
-- Set up buttons on the bar.
---------------------------------------------------------------
local Eye = CreateFrame('Button', '$parentShowHideButtons', Bar, 'SecureActionButtonTemplate')
local Menu = CreateFrame('Button', '$parentShowHideMenu', Bar, 'SecureActionButtonTemplate')
local Bag = CreateFrame('Button', '$parentShowHideBags', Bar, 'SecureActionButtonTemplate')
Bar.Eye = Eye
Bar.Menu = Menu
Bar.Bag = Bag
for _, btn in pairs({Eye, Menu, Bag}) do
btn:SetSize(40, 40)
btn:SetHighlightTexture('Interface\\AddOns\\ConsolePortBar\\Textures\\Button\\BigHilite')
btn.Shadow = btn:CreateTexture('$parentShadow', 'OVERLAY', nil, 7)
btn.Shadow:SetPoint('CENTER', 0, -5)
btn.Shadow:SetSize((82/64) * 40, (82/64) * 40)
btn.Shadow:SetTexture('Interface\\AddOns\\ConsolePortBar\\Textures\\Button\\BigShadow')
btn.Shadow:SetAlpha(0.5)
end
---------------------------------------------------------------
---------------------------------------------------------------
Bar.BG = Bar:CreateTexture(nil, 'BACKGROUND')
Bar.BG:SetPoint('TOPLEFT', Bar, 'TOPLEFT', 16, -16)
Bar.BG:SetPoint('BOTTOMRIGHT', Bar, 'BOTTOMRIGHT', -16, 16)
Bar.BG:SetTexture('Interface\\QuestFrame\\UI-QuestLogTitleHighlight')
Bar.BG:SetBlendMode('ADD')
Bar.BottomLine = Bar:CreateTexture(nil, 'BORDER')
Bar.BottomLine:SetTexture('Interface\\LevelUp\\LevelUpTex')
Bar.BottomLine:SetTexCoord(0.00195313, 0.81835938, 0.013671875, 0.017578125)
Bar.BottomLine:SetHeight(1)
Bar.BottomLine:SetPoint('BOTTOMLEFT', 0, 16)
Bar.BottomLine:SetPoint('BOTTOMRIGHT', 0, 16)
Bar.CoverArt = Bar:CreateTexture(nil, 'BACKGROUND')
Bar.CoverArt:SetPoint('CENTER', 0, 50)
Bar.CoverArt:SetSize(768, 192)
Bar.CoverArt.Flash = function(self)
if self.flashOnProc and not self:IsShown() then
self:Show()
db.UIFrameFadeIn(self, 0.2, 0, 1, {
finishedFunc = function()
db.UIFrameFadeOut(self, 1.5, 1, 0, {
finishedFunc = function()
self:SetAlpha(1)
self:Hide()
end
})
end
})
end
end
---------------------------------------------------------------
---------------------------------------------------------------
---------------------------------------------------------------
-- Toggler for buttons and art
---------------------------------------------------------------
Eye:RegisterForClicks('AnyUp')
Eye:SetAttribute('showbuttons', false)
Eye:SetPoint('RIGHT', Menu, 'LEFT', -4, 0)
Eye.Texture = Eye:CreateTexture(nil, 'OVERLAY')
Eye.Texture:SetPoint('CENTER', 0, 0)
Eye.Texture:SetSize((46 * 0.9), (24 * 0.9))
Eye.Texture:SetTexture('Interface\\AddOns\\'..addOn..'\\Textures\\Hide')
Eye:SetNormalTexture('Interface\\AddOns\\ConsolePortBar\\Textures\\Blank64')
function Eye:OnAttributeChanged(attribute, value)
if attribute == 'showbuttons' then
ab.cfg.showbuttons = value
if value == true then
self.Texture:SetTexture('Interface\\AddOns\\'..addOn..'\\Textures\\Show')
else
self.Texture:SetTexture('Interface\\AddOns\\'..addOn..'\\Textures\\Hide')
end
end
end
function Eye:OnClick(button)
if button == 'RightButton' then
ab.cfg.showart = not ab.cfg.showart
if ab.cfg.showart then
local art, coords = ab:GetCover()
if art and coords then
Bar.CoverArt:SetTexture(art)
Bar.CoverArt:SetTexCoord(unpack(coords))
end
end
Bar.CoverArt:SetShown(ab.cfg.showart)
elseif button == 'LeftButton' then
if IsShiftKeyDown() then
ab.cfg.lock = not ab.cfg.lock
if ab.cfg.lock then
Bar:SetMovable(false)
Bar:SetScript('OnMouseDown', nil)
Bar:SetScript('OnMouseUp', nil)
else
Bar:SetMovable(true)
Bar:SetScript('OnMouseDown', Bar.StartMoving)
Bar:SetScript('OnMouseUp', Bar.StopMovingOrSizing)
end
self:OnEnter()
elseif IsControlKeyDown() and not InCombatLockdown() then
Bar:ClearAllPoints()
Bar:SetPoint('BOTTOM', UIParent, 0, 0)
end
end
end
function Eye:OnEnter()
local texture_esc = '|T%s:24:24:0:0|t'
self.tooltipText = L.EYE_HEADER:format(ab.cfg.lock and L.EYE_LOCKED or L.EYE_UNLOCKED) .. '\n' ..
L.EYE_LEFTCLICK:format(texture_esc:format(db.ICONS.CP_T_L3)) .. '\n' ..
L.EYE_RIGHTCLICK:format(texture_esc:format(db.ICONS.CP_T_R3)) .. '\n' ..
L.EYE_LEFTCLICK_SHIFT:format(texture_esc:format(db.ICONS.CP_M1), texture_esc:format(db.ICONS.CP_T_L3)) .. '\n' ..
L.EYE_LEFTCLICK_CTRL:format(texture_esc:format(db.ICONS.CP_M2), texture_esc:format(db.ICONS.CP_T_L3)) .. '\n' ..
L.EYE_SCROLL .. '\n' ..
L.EYE_SCROLL_SHIFT
GameTooltip:Hide()
GameTooltip:SetOwner(self, 'ANCHOR_TOP')
GameTooltip:SetText(self.tooltipText)
GameTooltip:Show()
end
function Eye:OnLeave()
GameTooltip:Hide()
end
Eye:SetScript('OnClick', Eye.OnClick)
Eye:SetScript('OnEnter', Eye.OnEnter)
Eye:SetScript('OnLeave', Eye.OnLeave)
Eye:SetScript('OnAttributeChanged', Eye.OnAttributeChanged)
Bar:WrapScript(Eye, 'OnClick', [[
if button == 'LeftButton' and bar:GetAttribute('state') == '' then
local showhide = not self:GetAttribute('showbuttons')
self:SetAttribute('showbuttons', showhide)
control:ChildUpdate('hover', showhide)
end
]])
---------------------------------------------------------------
-- Menu button
---------------------------------------------------------------
function Menu:OnClick(button)
if not InCombatLockdown() then
if button == 'LeftButton' then
ToggleFrame(GameMenuFrame)
else
self:ClearAllPoints()
self:SetPoint('CENTER', 0, -20)
end
end
end
function Menu:OnShow() Eye:Show() Bag:Show() end
function Menu:OnHide() Eye:Hide() Bag:Hide() end
Menu:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
Menu:HookScript('OnClick', Menu.OnClick)
Menu:HookScript('OnShow', Menu.OnShow)
Menu:HookScript('OnHide', Menu.OnHide)
Menu:SetPoint('CENTER', 0, -20)
Menu:SetMovable(true)
Menu:SetClampedToScreen(true)
Menu:RegisterForDrag('LeftButton')
Menu:SetScript('OnDragStart', function(self)
if not InCombatLockdown() and not ab.cfg.lock then
self:StartMoving()
end
end)
Menu:SetScript('OnDragStop', Menu.StopMovingOrSizing)
Menu:SetNormalTexture(ab.data.TEXTURE.CP_X_CENTER)
Menu.timer = 0
Menu.updateInterval = 1
Menu.tooltipText = MicroButtonTooltipText(MAINMENU_BUTTON, 'TOGGLEGAMEMENU')
Menu.newbieText = NEWBIE_TOOLTIP_MAINMENU
function Menu:ShowPerformance(elapsed)
self.timer = self.timer + elapsed
if self.timer > self.updateInterval then
MainMenuBarPerformanceBarFrame_OnEnter(self)
self.timer = 0
end
end
Menu:SetScript('OnEnter', function(self)
local key, mod = ConsolePort:GetCurrentBindingOwner('TOGGLEGAMEMENU')
if key and mod then
local mods = {
[''] = '',
['SHIFT-'] = BINDING_NAME_CP_M1,
['CTRL-'] = BINDING_NAME_CP_M2,
['CTRL-SHIFT-'] = BINDING_NAME_CP_M1..BINDING_NAME_CP_M2,
}
self.tooltipText =
mods[mod] .. _G['BINDING_NAME_' .. key]
.. ' |c' .. RAID_CLASS_COLORS[select(2, UnitClass('player'))].colorStr
.. MAINMENU_BUTTON
else
self.tooltipText = MicroButtonTooltipText(MAINMENU_BUTTON, 'TOGGLEGAMEMENU')
end
MainMenuBarPerformanceBarFrame_OnEnter(self)
self.timer = 0
self:SetScript('OnUpdate', self.ShowPerformance)
end)
Menu:SetScript('OnLeave', function(self)
self:SetScript('OnUpdate', nil)
GameTooltip:Hide()
end)
-------------------------------------------
--- Bags
-------------------------------------------
Bar.Elements.Bags = {
MainMenuBarBackpackButton,
CharacterBag0Slot,
CharacterBag1Slot,
CharacterBag2Slot,
CharacterBag3Slot,
}
for i, bag in pairs(Bar.Elements.Bags) do
bag:SetParent(Bag)
bag:Hide()
bag:SetSize(32,32)
bag:ClearAllPoints()
bag:SetPoint('RIGHT', 4 + ( 32 * (i)), 0)
end
Bag:SetScript('OnClick', function(self)
if IsModifiedClick('OPENALLBAGS') then
ToggleAllBags()
else
for _, bag in pairs(Bar.Elements.Bags) do
bag:SetShown(not bag:IsShown())
end
end
end)
MainMenuBarBackpackButtonCount:SetParent(Bag)
MainMenuBarBackpackButtonCount:ClearAllPoints()
MainMenuBarBackpackButtonCount:SetPoint('BOTTOMRIGHT')
Bag:SetPoint('LEFT', Menu, 'RIGHT', 4, 0)
Bag:SetSize(40, 40)
Bag:SetNormalTexture('Interface\\AddOns\\ConsolePortBar\\Textures\\Bag64')
|
-- gitsigns highlights
local lush = require("lush")
local base = require("apprentice.base")
local M = {}
M = lush(function()
return {
-- gitsigns.nvim
GitSignsAdd {base.ApprenticeGreenSign},
GitSignsChange {base.ApprenticeBlueSign},
GitSignsDelete {base.ApprenticeRedSign},
-- GitSignsCurrentLineBlame {base.NonText},
}
end)
return M
|
function pillage(keys)
local caster = keys.caster
local damage = caster:GetAverageTrueAttackDamage()
local armor = keys.target:GetPhysicalArmorValue()
local damageReduction = ((0.02 * armor) / (1 + 0.02 * armor))
local goldGain = damage * (1 - damageReduction)
caster:ModifyGold(goldGain, false, 1)
end
|
-- Generate a solution-level androidfile.
--
-- originally from:
-- Copyright (c) 2012 Richard Swift and the Premake project
local jni = premake.extensions.jni
local project = premake.project
function jni.makefile(sln)
_p('LOCAL_PATH := $(call my-dir)')
for _,prj in ipairs(sln.projects) do
_p('include %s/Android.mk', path.getrelative(sln.location, prj.location))
end
_p('')
end
function jni.default_makefile(sln)
_p('include Application.mk')
_p('include Android.mk')
_p('all:')
_p('\t${NDK_HOME}/ndk-build NDK_APPLICATION_MK=`pwd`/Application.mk NDK_TOOLCHAIN_VERSION=clang NDK_LOG=1 V=1')
_p('')
_p('clean:')
_p('\t${NDK_HOME}/ndk-build clean NDK_APPLICATION_MK=`pwd`/Application.mk NDK_LOG=1 V=1')
_p('')
end
|
--
-- Created by IntelliJ IDEA.
-- User: hanks
-- Date: 2017/5/13
-- Time: 00:01
-- To change this template use File | Settings | File Templates.
--
require "import"
import "android.widget.*"
import "android.content.*"
import "androlua.LuaAdapter"
import "androlua.LuaImageLoader"
import "androlua.LuaFragment"
import "androlua.LuaHttp"
import "androlua.widget.webview.WebViewActivity"
import "android.support.v4.widget.SwipeRefreshLayout"
import "android.view.View"
import "androlua.LuaAdapter"
import "androlua.widget.video.VideoPlayerActivity"
import "androlua.LuaImageLoader"
import "androlua.LuaFragment"
import "android.support.v7.widget.RecyclerView"
import "android.support.v4.widget.SwipeRefreshLayout"
import "androlua.adapter.LuaRecyclerAdapter"
import "androlua.adapter.LuaRecyclerHolder"
import "android.support.v7.widget.GridLayoutManager"
import "android.view.View"
import "android.support.v4.widget.Space"
import "androlua.widget.ninegride.LuaNineGridView"
import "androlua.widget.ninegride.LuaNineGridViewAdapter"
import "androlua.widget.picture.PicturePreviewActivity"
import "androlua.widget.webview.WebViewActivity"
local uihelper = require "uihelper"
local JSON = require "cjson"
local log = require("log")
local screenWidth = uihelper.getScreenWidth()
local function getData(rid, data, adapter, fragment, swipe_layout)
if rid == nil then rid = '/news/getnews' end
local url = string.format('http://www.buka.cn%s', rid)
local options = {
url = url,
method = 'POST',
headers = { 'X-Requested-With:XMLHttpRequest' },
formData = {
'start=' .. data.page
}
}
LuaHttp.request(options, function(error, code, body)
if error or code ~= 200 then
print('fetch buka data error')
return
end
local arr = JSON.decode(body).items
uihelper.runOnUiThread(activity, function()
for i = 1, #arr do
data.items[#data.items + 1] = arr[i]
end
data.page = data.page + 1
adapter.notifyDataSetChanged()
swipe_layout.setRefreshing(false)
swipe_layout.setEnabled(false)
end)
end)
end
local function launchDetail(fragment, item)
local activity = fragment.getActivity()
if item and item.mid then
local intent = Intent(activity, LuaActivity)
intent.putExtra("luaPath", 'buka/detail.lua')
intent.putExtra("mid", item.mid)
activity.startActivity(intent)
end
end
function newInstance(rid)
-- create view table
local layout = {
SwipeRefreshLayout,
layout_width = "fill",
layout_height = "fill",
id = "swipe_layout",
{
RecyclerView,
id = "recyclerView",
layout_width = "fill",
layout_height = "fill",
paddingTop = "8dp",
paddingLeft = "4dp",
paddingRight = "4dp",
clipToPadding = false,
},
}
local item_category = {
LinearLayout,
layout_width = (screenWidth - uihelper.dp2px(8)) / 3,
layout_height = "210dp",
paddingLeft = "4dp",
paddingRight = "4dp",
paddingTop = "8dp",
orientation = "vertical",
gravity = "center",
{
ImageView,
id = "iv_cover",
layout_width = "fill",
layout_height = "160dp",
scaleType = "centerCrop",
},
{
TextView,
id = "tv_title",
layout_height = "26dp",
layout_width = "match",
padding = "4dp",
textSize = "14sp",
textColor = "#444444",
singleLine = true,
ellipsize = "end",
gravity = "center",
},
{
TextView,
id = "tv_info",
layout_height = "15dp",
layout_width = "match",
textSize = "12sp",
textColor = "#888888",
singleLine = true,
ellipsize = "end",
gravity = "center",
},
}
local data = { page = 0, items = {} }
local hadLoadData
local isVisible
local ids = {}
local adapter
local fragment = LuaFragment.newInstance()
local function lazyLoad()
if not isVisible then return end
if hadLoadData then return end
if adapter == nil then return end
hadLoadData = true
getData(rid, data, adapter, fragment, ids.swipe_layout)
end
fragment.setCreator(luajava.createProxy('androlua.LuaFragment$FragmentCreator', {
onCreateView = function(inflater, container, savedInstanceState)
return loadlayout(layout, ids)
end,
onViewCreated = function(view, savedInstanceState)
adapter = LuaRecyclerAdapter(luajava.createProxy('androlua.adapter.LuaRecyclerAdapter$AdapterCreator', {
getItemCount = function()
return #data.items
end,
getItemViewType = function(position)
return 0
end,
onCreateViewHolder = function(parent, viewType)
local views = {}
local holder = LuaRecyclerHolder(loadlayout(item_category, views, RecyclerView))
holder.itemView.setTag(views)
holder.itemView.getLayoutParams().width = screenWidth / 3
holder.itemView.onClick = function(v)
local position = holder.getAdapterPosition() + 1
launchDetail(fragment, data.items[position])
end
return holder
end,
onBindViewHolder = function(holder, position)
position = position + 1
local views = holder.itemView.getTag()
local item = data.items[position]
LuaImageLoader.load(views.iv_cover, item.logo)
views.tv_title.setText(item.name)
views.tv_info.setText(item.lastup)
if position == #data.items then getData(rid, data, adapter, fragment, ids.swipe_layout) end
end,
}))
ids.recyclerView.setLayoutManager(GridLayoutManager(activity, 3))
ids.recyclerView.setAdapter(adapter)
ids.swipe_layout.setRefreshing(true)
lazyLoad()
end,
onUserVisible = function(visible)
isVisible = visible
lazyLoad()
end,
}))
return fragment
end
return {
newInstance = newInstance
}
|
surface.CreateFont( "ConvictSansChat", {
font = "Comic Sans MS", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 24,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
local chatH = 200
local chatW = 400
chatBoxThing = {}
function QuickMenuButtons()
--[[ Because I dont want to try and remake this in the hud file. ]]
local client = LocalPlayer()
local buttonFrame = vgui.Create("DFrame")
buttonFrame:SetPos(0,0)
buttonFrame:SetSize(650, 30)
buttonFrame:SetDraggable(false)
buttonFrame:ShowCloseButton(false)
buttonFrame:SetTitle("")
buttonFrame.Paint = function( self, w, h )
--draw.RoundedBox( 0, 0, 0, w, h, Color(255, 0, 255,100) )
end
local buttonButton1 = vgui.Create( "DButton", buttonFrame )
buttonButton1:SetText( "" )
buttonButton1:SetPos( 380, 0 )
buttonButton1:SetSize( 90, 30 )
buttonButton1.DoClick = function()
gui.OpenURL( "http://freetexthost.com/yasuhm4yog" )
end
buttonButton1.Paint = function(self, w, h)
--draw.RoundedBox( 0, 0, 0, w, h, Color(255, 0, 0,100) )
end
local insertButton = vgui.Create( "DButton", buttonFrame )
insertButton:SetText( "" )
insertButton:SetPos( 90, 0 )
insertButton:SetSize( 120, 30 )
insertButton.DoClick = function()
--gui.OpenURL( "" )
end
insertButton.Paint = function(self, w, h)
--draw.RoundedBox( 0, 0, 0, w, h, Color(0, 255, 0,100) )
end
--[[
local = vgui.Create( "DButton", buttonFrame )
:SetText( "" )
:SetPos( 90, 0 )
:SetSize( 120, 30 )
.DoClick = function()
gui.OpenURL( "" )
end
.Paint = function(self, w, h)
draw.RoundedBox( 0, 0, 0, w, h, Color(0, 255, 0,100) )
end
]]
local toolsButton = vgui.Create( "DButton", buttonFrame )
toolsButton:SetText( "" )
toolsButton:SetPos( 0, 0 )
toolsButton:SetSize( 90, 30 )
toolsButton.DoClick = function()
LocalPlayer():ConCommand("join_buildmode")
end
toolsButton.Paint = function(self, w, h)
end
local exitButton = vgui.Create( "DButton", buttonFrame )
exitButton:SetText( "" )
exitButton:SetPos( 500, 0 )
exitButton:SetSize( 100, 30 )
exitButton.DoClick = function()
LocalPlayer():ConCommand("disconnect")
end
exitButton.Paint = function(self, w, h)
end
end
function ChatBoxSetup()
local client = LocalPlayer()
--GAMEMODE:CloseDermaMenus()
chatBoxThing.dFrame = vgui.Create("DFrame")
chatBoxThing.dTextEntry = vgui.Create("DTextEntry", chatBoxThing.dFrame)
chatBoxThing.dRichText = vgui.Create("RichText", chatBoxThing.dFrame)
chatBoxThing.dTextEntry:SetFont("ConvictSansChat")
chatBoxThing.dRichText:SetFontInternal("ConvictSansChat")
chatBoxThing.dFrame:SetPos(20, 50)
chatBoxThing.dFrame:SetSize(chatW,chatH)
chatBoxThing.dFrame:SetDraggable(false)
chatBoxThing.dFrame:ShowCloseButton(false)
chatBoxThing.dFrame:SetTitle("")
chatBoxThing.dFrame.Paint = function( self, w, h )
end
--chatBoxThing.dFrame:MakePopup()
chatBoxThing.dRichText:SetPos(5, 10)
chatBoxThing.dRichText:SetSize(chatW - 10, chatH - 10)
chatBoxThing.dRichText:AppendText("Welcome to Familiar Block Game\n")
function chatBoxThing.dRichText:PerformLayout()
self:SetFontInternal("ConvictSansChat")
self:SetFGColor( Color(255,255,255))
end
chatBoxThing.dTextEntry:SetPos(5,175)
chatBoxThing.dTextEntry:SetSize(chatW - 10,20)
chatBoxThing.dTextEntry:SetCursor("beam")
chatBoxThing.dTextEntry.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color(214, 209, 209,50) )
draw.SimpleText("> " .. self:GetValue(), "ConvictSans", 0, -5, Color(255,255,255,255), 0,0)
end
--chatBoxThing.dTextEntry:SetText("")
end
hook.Add("Initialize", "RobloxChatBox2", function()
ChatBoxSetup()
QuickMenuButtons()
end)
concommand.Add("reload_chat", function( ply, cmd, args)
QuickMenuButtons()
ChatBoxSetup()
end)
hook.Add( "OnPlayerChat", "myChat", function( player, strText, bTeamOnly, bPlayerIsDead )
--local col = GAMEMODE:GetTeamColor( player ) -- Get the player's team color
--chatBoxThing.dRichText:InsertColorChange(col)
local col = team.GetColor(player:Team())
local r, g, b, a = col.r, col.g, col.b, col.a
chatBoxThing.dRichText:InsertColorChange(r,g,b,a)
chatBoxThing.dRichText:AppendText(player:GetName())
chatBoxThing.dRichText:InsertColorChange(255,255,255,255)
chatBoxThing.dRichText:AppendText(": " .. strText .. "\n")
end )
hook.Add( "ChatTextChanged", "myChat_Update", function( text )
chatBoxThing.dTextEntry:SetText( text )
end)
--[[ hook.Remove("PlayerBindPress", "fbg_bindhack")
hook.Add("PlayerBindPress")
]]
hook.Add("StartChat", "WowThisIsFuckinDumb", function( team )
return true end
)
|
data:extend{
{
type = "recipe",
name = "coking",
category = "oil-processing",
--enabled = false,
energy_required = 30,
ingredients = {
{ type = "item", name = "coal", amount = 10 }
},
results = {
{ type = "item", name = "coke", amount = 5 },
{ type = "fluid", name = "crude-tar", amount = 1 }
},
icon = "__base__/graphics/icons/fluid/basic-oil-processing.png",
icon_size = 64, icon_mipmaps = 4,
subgroup = "fluid-recipes",
order = "a[oil-processing]-a[coking]"
},
{
type = "recipe",
name = "basic-tar-processing",
category = "chemistry",
--enabled = false,
energy_required = 15,
ingredients = {
{ type = "fluid", name = "crude-tar", amount = 20 },
},
results = {
{ type = "fluid", name = "tar", amount = 5 }
},
main_product = "",
icon = "__base__/graphics/icons/fluid/basic-oil-processing.png",
icon_size = 64, icon_mipmaps = 4,
subgroup = "fluid-recipes",
order = "b[fluid-chemistry]-a[basic-tar-processing]"
},
{
type = "recipe",
name = "advanced-tar-processing",
category = "chemistry",
--enabled = false,
energy_required = 10,
ingredients = {
{ type = "fluid", name = "crude-tar", amount = 20 },
},
results = {
{ type = "fluid", name = "tar", amount = 10 },
{ type = "item", name = "pitch", amount = 1 }
},
main_product = "",
icon = "__base__/graphics/icons/fluid/basic-oil-processing.png",
icon_size = 64, icon_mipmaps = 4,
subgroup = "fluid-recipes",
order = "b[fluid-chemistry]-b[advanced-tar-processing]"
},
{
type = "recipe",
name = "latex-extraction",
category = "chemistry",
energy_required = 60,
ingredients = {
{ type = "item", name = "wood", amount = 20 }
},
results = {
{ type = "fluid", name = "latex", amount = 5 }
},
icon = "__base__/graphics/icons/fluid/basic-oil-processing.png",
icon_size = 64, icon_mipmaps = 4,
subgroup = "fluid-recipes",
order = "b[fluid-chemistry]-a[latex-extraction]"
},
{
type = "recipe",
name = "latex-vulcanization",
category = "chemistry",
energy_required = 30,
ingredients = {
{ type = "fluid", name = "latex", amount = 25 },
{ type = "item", name = "sulfur", amount = 5 }
},
results = {
{ type = "item", name = "latex-ball", amount = 1 }
},
icon = "__base__/graphics/icons/fluid/basic-oil-processing.png",
icon_size = 64, icon_mipmaps = 4,
subgroup = "fluid-recipes",
order = "b[fluid-chemistry]-b[latex-vulcanization]"
}
}
|
--------------------------------
-- @module SpritePolygon
-- @extend Node
-- @parent_module ccexp
--------------------------------
-- @overload self, cc.Texture2D
-- @overload self, string
-- @function [parent=#SpritePolygon] setTexture
-- @param self
-- @param #string filename
-- @return experimental::SpritePolygon#experimental::SpritePolygon self (return value: cc.experimental::SpritePolygon)
--------------------------------
--
-- @function [parent=#SpritePolygon] initWithTexture
-- @param self
-- @param #cc.Texture2D texture
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#SpritePolygon] showDebug
-- @param self
-- @param #bool val
-- @return experimental::SpritePolygon#experimental::SpritePolygon self (return value: cc.experimental::SpritePolygon)
--------------------------------
-- returns the Texture2D object used by the sprite
-- @function [parent=#SpritePolygon] getTexture
-- @param self
-- @return Texture2D#Texture2D ret (return value: cc.Texture2D)
--------------------------------
--
-- @function [parent=#SpritePolygon] getArea
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
--
-- @function [parent=#SpritePolygon] initWithCache
-- @param self
-- @param #string file
-- @param #cc._SpritePolygonInfo info
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#SpritePolygon] getVertCount
-- @param self
-- @return long#long ret (return value: long)
--------------------------------
--
-- @function [parent=#SpritePolygon] getTrianglesCount
-- @param self
-- @return long#long ret (return value: long)
return nil
|
require "Client.Scripts.Modulus.Entity.SkillEvent.Event.SkillEvent"
require "Client.Scripts.Modulus.Entity.SkillEvent.Event.AttackEvent"
require "Client.Scripts.Modulus.Entity.SkillEvent.Event.AudioEvent"
require "Client.Scripts.Modulus.Entity.SkillEvent.Event.EffectEvent"
require "Client.Scripts.Modulus.Entity.SkillEvent.Event.MoveEvent"
require "Client.Scripts.Modulus.Entity.SkillEvent.Event.AnimEvent"
require "Client.Scripts.Modulus.Entity.SkillEvent.Event.LockEvent"
require "Client.Scripts.Modulus.Entity.SkillEvent.Event.HitMoveEvent"
require "Client.Scripts.Modulus.Entity.SkillEvent.SkillEventFactory"
|
--测 试 用
IsHasEffect
Duel.IsEnvironment
TYPE_SPSUMMON
function cxxxxxxxx.condition(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,0,LOCATION_MZONE)
return g:GetCount()>=2 and g:IsExists(function(c)
return c:IsType(TYPE_TUNER)
end,1,nil)
end
local g=Duel.GetFieldGroup(tp,0,LOCATION_MZONE)
if g:GetCount()>=2 and g:IsExists(function(c)
return c:IsType(TYPE_TUNER)
end,1,nil) then
--effect
end
function cxxxxxxxx.attfilter(c,att1,att2)
return c:GetAttribute() ~= att1 and c:GetAttribute() ~= att2 and c:IsType(TYPE_MONSTER)
end
local att1=e:GetLabel()
local type=TYPE_NORMAL+TYPE_RITUAL+TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ+TYPE_LINK
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g1=Duel.SelectMatchingCard(tp,function(c,type) return c:IsType(type) and c:IsAbleToGrave() end,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_EXTRA,0,1,1,nil)
if bit.band(type,g1:GetFirst():GetType)~=0 then
type=type-bit.band(type,g1:GetFirst():GetType)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g2=Duel.SelectMatchingCard(tp,function(c,type) return c:IsType(type) and c:IsAbleToGrave() end,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_EXTRA,0,1,1,g1)
if bit.band(type,g2:GetFirst():GetType)~=0 then
type=type-bit.band(type,g2:GetFirst():GetType)
end
g1:Merge(g2)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g3=Duel.SelectMatchingCard(tp,function(c,type) return c:IsType(type) and c:IsAbleToGrave() end,tp,LOCATION_HAND+LOCATION_ONFIELD+LOCATION_EXTRA,0,1,1,g1)
g1:Merge(g3)
Duel.SendtoGrave(g1,REASON_EFFECT)
|
-- local dbg = require("debugger")
-- dbg.auto_where = 2
local _context = require'context'
context = 'null'
api = 'null'
get_selection = _context.get_selection
local function run()
context = _context.context()
api = require'nvimapi'
end
return {
run = run
}
|
--[[
小记事 project by Ayaka_Ago
]]
import "android.app.*"
import "android.os.*"
import "android.widget.HorizontalScrollView"
import "com.androlua.LuaUtil"
import "android.support.v4.widget.SwipeRefreshLayout"
import "android.content.res.ColorStateList"
import "android.support.v7.widget.CardView"
import "android.animation.AnimatorSet"
import "android.view.View"
import "android.widget.ArrayAdapter"
import "android.graphics.Color"
import "android.widget.LinearLayout"
import "android.animation.ObjectAnimator"
import "android.widget.PageView"
import "com.androlua.Http"
import "android.widget.RelativeLayout"
import "android.view.animation.AlphaAnimation"
import "android.widget.Switch"
import "android.widget.Spinner"
import "android.graphics.PorterDuffColorFilter"
import "android.graphics.PorterDuff"
import "android.graphics.Bitmap"
import "java.io.FileOutputStream"
import "java.io.File"
import "android.graphics.drawable.ColorDrawable"
import "android.content.Context"
import "android.content.Intent"
import "android.view.WindowManager"
import "android.widget.ScrollView"
import "android.widget.CircleImageView"
import "android.net.Uri"
import "android.graphics.drawable.GradientDrawable"
import "android.view.ViewAnimationUtils"
import "android.widget.TextView"
import "android.graphics.Bitmap"
import "android.view.inputmethod.InputMethodManager"
import "android.animation.ArgbEvaluator"
import "android.os.Build"
import "android.app.AlertDialog"
import "android.view.animation.DecelerateInterpolator"
import "android.animation.ArgbEvaluator"
import "android.widget.ImageView"
import "android.widget.EditText"
import "android.webkit.MimeTypeMap"
import "android.content.ClipData"
import "android.provider.MediaStore"
import "android.content.ContentValues"
import "android.graphics.BitmapFactory"
import "android.view.Gravity"
import "android.widget.Toast"
import "android.text.format.Formatter"
import "java.lang.Math"
import "android.view.ViewAnimationUtils"
w=this.width
h=this.height
window=activity.getWindow()
DecorView=window.getDecorView()
pack_name=this.getPackageName()
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
DecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN|View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
window.setStatusBarColor(Color.TRANSPARENT)
本地版本=this.getPackageManager().getPackageInfo(pack_name,64).versionName
内部版本=this.getPackageManager().getPackageInfo(pack_name,64).versionCode
window.setNavigationBarColor(0xFFB8B8B8)
local resid=activity.getResources().getIdentifier("status_bar_height","dimen","android")
if resid>0 then
状态栏高度 = activity.getResources().getDimensionPixelSize(resid)
else
状态栏高度 = w*0.07
end
imm = activity.getSystemService(Context.INPUT_METHOD_SERVICE)
piclist={
"http://image.coolapk.com/picture/2019/0128/18/1414254_1548672692_5472@1440x2560.jpg.m.jpg", --两个粉红色圆形
"http://image.coolapk.com/picture/2019/0125/11/1914123_1548388091_471@1080x2160.jpg.m.jpg", --灰蓝灰白渐变
"http://image.coolapk.com/picture/2019/0124/17/1062337_1548321577_1253@1080x2160.png.m.jpg", --顶部橙色波浪
"http://image.coolapk.com/picture/2019/0120/10/1118425_1547952433_2893@1080x1919.jpg.m.jpg", --吊饰
"http://image.coolapk.com/picture/2019/0121/08/1147616_1548029107_1659@1080x1920.jpg.m.jpg"; --荷叶与猫咪
"http://image.coolapk.com/picture/2019/0201/09/1866552_1548983857_1882@1080x1919.jpg.m.jpg"; --云与海
"http://image.coolapk.com/picture/2019/0201/09/1866552_1548983859_8499@1080x1919.jpg.m.jpg"; --礁石上的海鸥
"http://image.coolapk.com/picture/2019/0130/11/1058369_1548818235_8891@1080x1920.jpg.m.jpg"; --饮料机旁猫和人
"http://image.coolapk.com/picture/2019/0126/21/1166111_1548510997_9613@1080x1920.jpg.m.jpg"; --质感白色
"http://image.coolapk.com/picture/2019/0122/10/2080075_1548123255_6404@720x1280.jpg.m.jpg"; --天空下竹竿吊饰
"http://image.coolapk.com/picture/2019/0119/00/2129136_1547830299_2528@1080x2160.jpg.m.jpg"; --未上色的建筑建模
"http://image.coolapk.com/picture/2019/0103/18/1625219_1546509870_1319@1080x1920.jpg.m.jpg"; --粉紫的山峦
"http://image.coolapk.com/picture/2019/0103/18/1625219_1546509873_0732@1080x1920.jpg.m.jpg"; --蓝山峦
"http://image.coolapk.com/picture/2018/1230/19/1118425_1546167826_5698@1080x1920.jpg.m.jpg";--天与海中一艘船
"http://image.coolapk.com/picture/2018/1230/19/1118425_1546167841_0472@1080x1920.jpg.m.jpg"; --海滩
"http://image.coolapk.com/picture/2018/1223/16/1865879_1545552135_2609@1080x2280.png.m.jpg";--一只猫躺着
"http://image.coolapk.com/picture/2019/0130/08/615966_1548807965_0339@1080x1920.jpg.m.jpg";--秋天树林
"http://image.coolapk.com/picture/2019/0129/19/750329_1548762294_5761@1080x2160.jpg.m.jpg";--柴柴顶面包
"http://image.coolapk.com/picture/2019/0129/19/750329_1548762297_3927@1080x2160.jpg.m.jpg";--柴柴睡了
"http://image.coolapk.com/picture/2019/0129/19/750329_1548762305_8528@1080x2160.jpg.m.jpg";--柴柴顶树叶
"http://image.coolapk.com/picture/2019/0126/12/898597_1548477241_721@720x1280.jpg.m.jpg";--屋里花与猫
"http://image.coolapk.com/picture/2018/1229/14/1190381_1546064967_6429@1080x1920.jpg.m.jpg";--面包上躺一只猫
"http://image.coolapk.com/picture/2018/1104/08/945857_1541291868_7698@1200x2133.png.m.jpg";--树枝下果子和猫
"http://image.coolapk.com/picture/2018/1027/17/1310491_1540632977_8286@960x1920.jpg.m.jpg";--歇息的猫
}
主题色=0xFF2EC4B6
顶栏文字色=0xffffffff
顶栏图标色=0xffffffff
按钮文字色=主题色
card_color_list={-1,tonumber(0xFFACACAC),tonumber(0xFFFF8074),tonumber(0xFFFFff00),tonumber(0xFFD1F5FF),tonumber(主题色)}
app_path="/sdcard/小记事/"
记事文件=app_path.."记事/"
配图目录=app_path.."配图备份/"
File(app_path).mkdirs()
File(记事文件).mkdirs()
File(配图目录).mkdirs()
function GetFileSize(path)
return File(tostring(path)).length()
end
function shareText(t)
local f,e=pcall(function ()
activity.startActivity(Intent.createChooser(Intent(Intent.ACTION_SEND)
.setType("text/plain")
.putExtra(Intent.EXTRA_SUBJECT, "分享")
.putExtra(Intent.EXTRA_TEXT, t)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK),"分享到:"))
end)
if e then
print ("无法进行分享")
end
end
function 透明动画(id,时间,开始透明度,结束透明度)
id.startAnimation(AlphaAnimation(开始透明度,结束透明度).setDuration(时间))
end
function getFileSize(path)
return Formatter.formatFileSize(activity, File(tostring(path)).length())
end
function 波纹(颜色)
return activity.Resources.getDrawable(activity.obtainStyledAttributes({android.R.attr.selectableItemBackgroundBorderless}).getResourceId(0,0)).setColor(ColorStateList(int[0].class{int{}},int{颜色}))
end
function getFileCount(path)
if File(path).listFiles()~=nil then
local list=luajava.astable(File(path).listFiles())
return #list
else
return 0
end
end
function getFileList(path)
if File(path).listFiles()~=nil then
return luajava.astable(File(path).listFiles())
else
return {"no file"}
end
end
function StrToTable(str)
if str == nil or type(str) ~= "string" then
return
end
return loadstring("return " .. str)()
end
function getFileName(path)
return File(path).getName()
end
function 圆角(控件,背景色,角度)
local gd=GradientDrawable()
.setShape(GradientDrawable.RECTANGLE)
.setColor(背景色)
.setCornerRadii(角度)
if 控件 then
控件.setBackgroundDrawable(gd)
end
return gd
end
function 上下渐变(color)
return GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM,color)
end
function newNote()
local log=记事文件..os.time()..".txt"
File(log).createNewFile()
io.open(log,"w+"):write([[{
["date"] ={
["create"] ="]]..os.date("%y.%m.%d %H:%M:%S")..[[";
["update"] ="]]..os.date("%y.%m.%d %H:%M:%S")..[[";
};
["content"] ={
["color"]="0xffffffff",
["category"]="记事",
["title"] ="";
["star"]=false,
["messages"] =]].."[[]]"..[[;
};
}]]):close()
this.newActivity("edit",{log})
refreshList()
end
function transColor(view,type,color,time)
ObjectAnimator.ofInt(view,type,color)
.setDuration(time)
.setEvaluator(ArgbEvaluator())
.start()
end
function setSystemUi(isBlack)
if isBlack then
DecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN|View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR)
else
DecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN)
end
end
function print(内容)
local toast=Toast.makeText(activity,"", Toast.LENGTH_SHORT)
toast.setView(loadlayout({
LinearLayout,
layout_width="100%w",
gravity="center",
orientation="horizontal",
{
TextView,
text=tostring(内容),
background=圆角(nil,主题色,{17,17,17,17,17,17,17,17}),
layout_height="fill",
textColor=顶栏文字色,
layout_margin="2%w",
padding="3%w",
elevation="1%w",
layout_width="95%w",
layout_gravity="center",
id="toast_main",
gravity="center",
},
}))
toast.setGravity(Gravity.TOP,0,w*0.15);
toast.show()
end
function setDialogButtonColor(id,button,color)
local win=id.getWindow()
if Build.VERSION.SDK_INT >= 22 then
local b1=id.getButton(id.BUTTON_NEUTRAL)
local b2=id.getButton(id.BUTTON_NEGATIVE)
local b3=id.getButton(id.BUTTON_POSITIVE)
if button==1 then
b3.setTextColor(color)
elseif button==2 then
b2.setTextColor(color)
elseif button==3 then
b1.setTextColor(color)
elseif button==0 then
b1.setTextColor(color)
b2.setTextColor(color)
b3.setTextColor(color)
end
else
return false
end
pcall(function () id.findViewById(android.R.id.message).setTextIsSelectable(true) end)
end
function 圆形扩散(v,sx,ex,sy,ey,time)
ViewAnimationUtils.createCircularReveal(v,sx,ex,sy,ey)
.setDuration(time)
.start()
end
function getActuallyTitle(ori)
if #ori<1 then
return "无标题"
else
return ori
end
print (ori)
end
function getActuallyContent(ori)
if #ori<1 then
return "无内容"
else
return ori
end
print (ori)
end
|
local renderer = require("easymark.renderer")
local config = require("easymark.config")
---Find Easymark buffer
---
---@return string|nil
local function find_easymark_buffer()
for _, v in ipairs(vim.api.nvim_list_bufs()) do
if vim.fn.bufname(v) == config.plug_name then return v end
end
return nil
end
---Find pre-existing Easymark buffer, delete and wipe it
local function wipe_easymark_buffer()
local buf = find_easymark_buffer()
if buf then
local win_ids = vim.fn.win_findbuf(buf)
for _, id in ipairs(win_ids) do
if vim.fn.win_gettype(id) ~= "autocmd" and vim.api.nvim_win_is_valid(id) then
vim.api.nvim_win_close(id, true)
end
end
vim.api.nvim_buf_set_name(buf, "")
vim.schedule(function() pcall(vim.api.nvim_buf_delete, buf, {}) end)
end
end
---@class Pane
---@field buf number
---@field win number
---@field group boolean
---@field items Item[]
---@field parent number
---@field float number
local Pane = {}
Pane.__index = Pane
Pane.create = function(opts)
opts = opts or {}
if opts.win then
Pane.switch_to(opts.win)
vim.cmd("enew")
else
vim.cmd("below new")
local pos = {bottom = "J", top = "K", left = "H", right = "L"}
vim.cmd("wincmd " .. (pos[config.options.position] or "K"))
end
local buffer = Pane:new(opts)
buffer:setup(opts)
if opts and opts.auto then buffer:switch_to_parent() end
return buffer
end
---@param opts table
---@return table
function Pane:new(opts)
opts = opts or {}
local group
if opts.group ~= nil then
group = opts.group
else
group = config.options.group
end
local this = {
buf = vim.api.nvim_get_current_buf(),
win = opts.win or vim.api.nvim_get_current_win(),
parent = opts.parent,
items = opts.items or {},
group = group
}
setmetatable(this, self)
return this
end
---@param name string
---@param value string
---@param win string|nil
function Pane:set_option(name, value, win)
if win then
return vim.api.nvim_win_set_option(self.win, name, value)
else
return vim.api.nvim_buf_set_option(self.buf, name, value)
end
end
function Pane:clear() return vim.api.nvim_buf_set_lines(self.buf, 0, -1, false, {}) end
Pane.switch_to = function(win, buf)
if win then
vim.api.nvim_set_current_win(win)
if buf then vim.api.nvim_win_set_buf(win, buf) end
end
end
Pane.jump_to_item = function(win, precmd, item)
Pane.switch_to(win)
if precmd then vim.cmd(precmd) end
if not vim.api.nvim_buf_get_option(item.bufnr, "buflisted") then
vim.cmd("e #" .. item.bufnr)
else
vim.cmd("buffer " .. item.bufnr)
end
vim.api.nvim_win_set_cursor(win, {item.line_nr, item.col_nr - 1})
end
function Pane:lock()
self:set_option("readonly", true)
self:set_option("modifiable", false)
end
function Pane:unlock()
self:set_option("modifiable", true)
self:set_option("readonly", false)
end
---@param lines table
function Pane:render(lines)
self:unlock()
self:set_lines(lines)
self:lock()
end
---@param lines table
---@param first integer
---@param last integer
---@param strict boolean
function Pane:set_lines(lines, first, last, strict)
first = first or 0
last = last or -1
strict = strict or false
return vim.api.nvim_buf_set_lines(self.buf, first, last, strict, lines)
end
function Pane:is_valid()
return vim.api.nvim_buf_is_valid(self.buf) and vim.api.nvim_buf_is_loaded(self.buf)
end
function Pane:is_float(win)
local opts = vim.api.nvim_win_get_config(win)
return opts and opts.relative and opts.relative ~= ""
end
function Pane:is_valid_parent(win)
if not vim.api.nvim_win_is_valid(win) then return false end
if self:is_float(win) then return false end
local buf = vim.api.nvim_win_get_buf(win)
if vim.api.nvim_buf_get_option(buf, "buftype") ~= "" then return false end
return true
end
---@param opts table
function Pane:update(opts) renderer.render(self, opts) end
function Pane:close()
if vim.api.nvim_win_is_valid(self.win) then vim.api.nvim_win_close(self.win, {}) end
if vim.api.nvim_buf_is_valid(self.buf) then vim.api.nvim_buf_delete(self.buf, {}) end
end
function Pane:close_preview()
-- reset parent state
local is_valid_win = vim.api.nvim_win_is_valid(self.parent)
-- LuaFormatter off
local is_valid_buf = self.parent_state and vim.api.nvim_buf_is_valid(self.parent_state.buf)
-- LuaFormatter on
if self.parent_state and is_valid_win and is_valid_buf then
vim.api.nvim_win_set_buf(self.parent, self.parent_state.buf)
vim.api.nvim_win_set_cursor(self.parent, self.parent_state.cursor)
end
self.parent_state = nil
end
function Pane:on_enter()
self.parent = self.parent or vim.fn.win_getid(vim.fn.winnr("#"))
if (not self:is_valid_parent(self.parent)) or self.parent == self.win then
for _, win in pairs(vim.api.nvim_list_wins) do
if self:is_valid_parent(win) and win ~= self.win then
self.parent = win
break
end
end
end
if not vim.api.nvim_win_is_valid(self.parent) then return self:close() end
self.parent_state = {
buf = vim.api.nvim_win_get_buf(self.parent),
cursor = vim.api.nvim_win_get_cursor(self.parent)
}
end
function Pane:on_leave() self:close_preview() end
function Pane:switch_to_parent() Pane.switch_to(self.parent) end
function Pane:on_win_enter()
local parent = self.parent
local current_win = vim.api.nvim_get_current_win()
if vim.fn.winnr("$") == 1 and current_win == self.win then
vim.cmd("q")
return
end
if not self:is_valid_parent(current_win) then return end
if current_win ~= parent and current_win ~= self.win then
parent = current_win
if self:is_valid() then vim.defer_fn(function() self:update() end, 100) end
end
local current_buf = vim.api.nvim_get_current_buf()
if current_win == self.win and current_buf ~= self.buf then
vim.api.nvim_win_set_buf(parent, current_buf)
vim.api.nvim_win_set_option(parent, "winhl", "")
vim.api.nvim_win_close(self.win, false)
require("easymark").open()
Pane.switch_to(parent, current_buf)
end
end
function Pane:get_cusor() return vim.api.nvim_win_get_cursor(self.win) end
function Pane:get_line() return self:get_cusor()[1] end
function Pane:get_col() return self:get_cusor()[2] end
function Pane:current_item()
local line = self:get_line()
local item = self.items[line - 1]
return item
end
function Pane:jump()
local item = self:current_item()
if not item then return end
Pane.jump_to_item(item.win or self.parent, nil, item)
end
function Pane:next_item()
local line = self:get_line()
local line_count = vim.api.nvim_buf_line_count(self.buf)
-- skip if only title
if line_count == 1 then return end
for i = line + 1, line_count do
if self.items[i - 1] then
vim.api.nvim_win_set_cursor(self.win, {i, 0})
return
end
end
end
function Pane:prev_item()
local line = self:get_line()
local line_count = vim.api.nvim_buf_line_count(self.buf)
-- skip if only title
if line_count == 1 then return end
-- print("line: ", line, " line_count: ", line_count)
for i = line - 1, 1, -1 do
if self.items[i - 1] then
vim.api.nvim_win_set_cursor(self.win, {i, 0})
return
end
end
end
function Pane:focus()
Pane.switch_to(self.win, self.buf)
local line = self:get_line()
if line == 1 then self:next_item() end
end
---@param opts table
function Pane:setup(opts)
opts = opts or {}
vim.cmd("setlocal nonu")
vim.cmd("setlocal nornu")
vim.cmd('setlocal colorcolumn=""')
if not pcall(vim.api.nvim_buf_set_name, self.buf, config.plug_name) then
wipe_easymark_buffer()
vim.api.nvim_buf_set_name(self.buf, config.plug_name)
end
self:set_option("filetype", config.plug_name)
self:set_option("bufhidden", "wipe")
self:set_option("buftype", "nofile")
self:set_option("swapfile", false)
self:set_option("buflisted", false)
self:set_option("winfixwidth", true, true)
self:set_option("wrap", false, true)
self:set_option("spell", false, true)
self:set_option("list", false, true)
self:set_option("winfixheight", true, true)
self:set_option("signcolumn", "no", true)
self:set_option("fcs", "eob: ", true)
local options = config.options
for action, keys in pairs(options.pane_action_keys) do
if type(keys) == "string" then keys = {keys} end
for _, key in pairs(keys) do
-- LuaFormatter off
vim.api.nvim_buf_set_keymap(self.buf, "n", key,
[[<cmd>lua require("easymark").do_action("]] .. action .. [[")<cr>]],
{silent = true, noremap = true, nowait = true})
-- LuaFormatter on
end
end
if options.position == "top" or options.position == "bottom" then
vim.api.nvim_win_set_height(self.win, options.height)
else
vim.api.nvim_win_set_width(self.win, options.width)
end
vim.api.nvim_exec([[
augroup EasymarkActions
autocmd! * <buffer>
autocmd BufEnter <buffer> lua require("easymark").do_action("on_enter")
autocmd CursorMoved <buffer> lua require("easymark").do_action("auto_preview")
autocmd BufLeave <buffer> lua require("easymark").do_action("on_leave")
augroup END
]], false)
if not opts.parent then self:on_enter() end
self:lock()
self:update(opts)
end
function Pane:preview()
if not vim.api.nvim_win_is_valid(self.parent) then return end
local item = self:current_item()
if not item then return end
vim.api.nvim_win_set_cursor(self.parent, {item.line_nr, 0})
end
return Pane
|
function GM.Select_Clothes ( )
local Models = {};
local sexID = LocalPlayer():GetSex();
if (sexID == "m") then sexID = SEX_MALE; end
if (sexID == "f") then sexID = SEX_FEMALE; end
local realID = "m";
if (sexID == SEX_FEMALE) then realID = "f" end;
local face = LocalPlayer():GetFace();
for k, v in pairs(MODEL_AVAILABLE[realID][face]) do
if (v < 10) then
table.insert(Models, {LocalPlayer():GetModelPath(realID, face, v), realID .. "_" .. face .. "_0" .. v});
else
table.insert(Models, {LocalPlayer():GetModelPath(realID, face, v), realID .. "_" .. face .. "_" .. v});
end
end
local curModelReference = 1;
local W, H = 200, 270;
AccountCreationScreen = vgui.Create("DFrame")
AccountCreationScreen:SetPos(ScrW() * .5 - W * .5, ScrH() * .5 - H * .5)
AccountCreationScreen:SetSize(W, H)
AccountCreationScreen:SetTitle("Character Clothes")
AccountCreationScreen:SetVisible(true)
AccountCreationScreen:SetDraggable(false)
AccountCreationScreen:ShowCloseButton(false)
AccountCreationScreen:MakePopup()
AccountCreationScreen:SetAlpha(GAMEMODE.GetGUIAlpha());
AccountCreationScreen:SetSkin("ugperp")
local PanelSize = W - 10;
local UsCash = vgui.Create("DPanelList", AccountCreationScreen);
UsCash:EnableHorizontal(false)
UsCash:EnableVerticalScrollbar(true)
UsCash:StretchToParent(5, 30, 5, 5);
UsCash:SetPadding(5);
local ModelPanel = vgui.Create('DModelPanel', AccountCreationScreen);
ModelPanel:SetPos(5, 30);
ModelPanel:SetSize(W - 20, W - 20);
ModelPanel:SetFOV(70);
ModelPanel:SetModel(Models[curModelReference][1]);
local iSeq = ModelPanel.Entity:LookupSequence('walk_all');
ModelPanel.Entity:ResetSequence(iSeq);
function ModelPanel:LayoutEntity( Entity ) self:RunAnimation(); Entity:SetAngles( Angle( 0, RealTime()*20, 0) ); end
local ourModel = Models[curModelReference][2]
local r110 = (W - 25) * .5
local LeftButton = vgui.Create("DButton", AccountCreationScreen);
LeftButton:SetPos(10, H - 55);
LeftButton:SetSize(r110, 20);
LeftButton:SetText("<");
function LeftButton:DoClick ( )
curModelReference = curModelReference - 1;
if (curModelReference < 1) then
curModelReference = #Models;
end
ModelPanel:SetModel(Models[curModelReference][1]);
ourModel = Models[curModelReference][2];
end
local RightButton = vgui.Create("DButton", AccountCreationScreen);
RightButton:SetPos(15 + r110, H - 55);
RightButton:SetSize(r110, 20);
RightButton:SetText(">");
function RightButton:DoClick ( )
curModelReference = curModelReference + 1;
if (curModelReference > #Models) then
curModelReference = 1;
end
ModelPanel:SetModel(Models[curModelReference][1]);
ourModel = Models[curModelReference][2];
end
local SubmitButton = vgui.Create("DButton", AccountCreationScreen);
SubmitButton:SetPos(10, H - 30);
SubmitButton:SetSize(W - 20, 20);
SubmitButton:SetText("Confirm");
function SubmitButton:DoClick ( )
AccountCreationScreen:Remove();
RunConsoleCommand("perp_cc", ourModel);
end
end
|
slot2 = "BaseRankUserCcsPane"
BaseRankUserCcsPane = class(slot1)
BaseRankUserCcsPane.onCreationComplete = function (slot0)
slot0._userInfos = {}
slot0._btns = {}
slot5 = slot0
for slot4, slot5 in pairs(slot0.getChildren(slot4)) do
slot9 = slot5
table.insert(slot7, slot0._userInfos)
end
slot0._maxIndex = #slot0._userInfos
slot0._canUpdate = true
slot3 = slot0
slot7 = slot0.onDisplayListStateChanged
slot0.registerScriptHandler(slot2, handler(slot5, slot0))
slot5 = slot0
gameMgr.sortedUsersChangedSignal.add(slot2, gameMgr.sortedUsersChangedSignal, slot0.onSortedUserChange)
slot3 = slot0
slot0.onSortedUserChange(slot2)
end
BaseRankUserCcsPane.onDisplayListStateChanged = function (slot0, slot1)
if slot1 == "enter" then
slot0._canUpdate = true
slot4 = slot0
slot0.onSortedUserChange(slot3)
elseif slot1 == "exit" then
slot0._canUpdate = false
end
end
BaseRankUserCcsPane.onSortedUserChange = function (slot0)
if not slot0._canUpdate then
return
end
slot4 = {}
slot7 = Hero
table.insert(slot3, Hero.getDwUserID(slot6))
if slot0.model.getWCurrentBanker then
slot6 = slot0.model.getWCurrentBanker(slot3)
slot3 = gameMgr.getUserDataByChairId(slot0.model, gameMgr)
if slot0.model.getWCurrentBanker(slot3) ~= 65535 and slot3 ~= nil then
slot7 = slot3.dwUserID
table.insert(slot5, slot1)
end
end
slot6 = #slot0._userInfos
slot0.list = gameMgr.getSortedUsers(slot3, gameMgr, slot1)
slot4 = slot0._userInfos
for slot5, slot6 in ipairs(slot3) do
if slot0.list[slot5] ~= nil then
slot10 = true
slot6.head.setVisible(slot8, slot6.head)
slot13 = slot0.list[slot5].wGender
slot0.controller.setHeadBg(slot6.head, slot0.controller, slot6.head, GAME_STATE.BATTLE)
slot11 = slot0.list[slot5]
slot6.head.setUserData(slot6.head, slot6.head)
if slot6.txt_tf then
slot11 = true
slot6.txt_tf.setVisible(slot9, slot6.txt_tf)
slot10 = slot6.txt_tf
slot16 = 1.5
slot6.txt_tf.setHtmlText(slot9, StringUtil.truncate(slot12, slot7.szNickName, 6, ".."))
end
else
slot10 = false
slot6.head.setVisible(slot8, slot6.head)
if slot6.txt_tf then
slot10 = false
slot6.txt_tf.setVisible(slot8, slot6.txt_tf)
end
end
end
end
BaseRankUserCcsPane.onBtnClick = function (slot0, slot1, slot2)
slot5 = slot0._userInfos
for slot6, slot7 in ipairs(slot4) do
if slot7.btnClick == slot1 then
if slot0.list[slot6] and slot0.list[slot6].dwUserID then
slot12 = slot0._userInfos[slot6]
popupMgr.showUserInfoPopup(slot9, popupMgr, slot0.list[slot6].dwUserID)
end
break
end
end
end
BaseRankUserCcsPane.checkBetUser = function (slot0, slot1)
if slot0.list then
for slot5 = 1, slot0._maxIndex, 1 do
if slot0.list[slot5] and slot0.list[slot5].wChairID == slot1 then
return slot5
end
end
end
return 0
end
BaseRankUserCcsPane.getRankItemNode = function (slot0, slot1)
return slot0._userInfos[slot1]
end
BaseRankUserCcsPane.destroy = function (slot0)
slot3 = slot0._userInfos
for slot4, slot5 in ipairs(slot2) do
if slot5 and slot5.btnClick then
slot8 = slot5.btnClick
slot5.btnClick.destroy(slot7)
end
end
slot5 = slot0
gameMgr.sortedUsersChangedSignal.remove(slot2, gameMgr.sortedUsersChangedSignal, slot0.onSortedUserChange)
end
return
|
local table = require 'table'
--[[
This is compiled list of known IKE vendor IDs.
Most of the VIDs have been copied from ike-scan with permission from
the original author, Roy Hills, so a big 'thank you' is in order.
-- http://www.nta-monitor.com/wiki/index.php/Ike-scan_Documentation
Unknown ids:
ab926d9ee113a0219557fcc54e52865c (Citrix NetScaler ?)
5062b335bc20db32c0d54465a2f70100 (fortigate ?)
4f4540454371496d7a684644 (linksys ?)
9436e8d67174ef9aed068d5ad5213f187a3f8ba6000000160000061e (Netscreen 5XP running ScreenOS 4.0.r3)
]]
author = {"Jesper Kueckelhahn", "Roy Hills"}
license = "Simplified (2-clause) BSD license--See https://nmap.org/svn/docs/licenses/BSD-simplified"
fingerprints = {};
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Vendor ID Fingerprints
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Avaya
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Avaya',
version = nil,
ostype = nil,
devicetype = 'security-misc',
cpe = nil,
fingerprint = '^4485152d18b6bbcc0be8a8469579ddcc'
});
--------------------------------------------------------------------------------
-- Checkpoint
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Checkpoint VPN-1 / Firewall-1',
version = '4.1 Base',
ostype = nil,
devicetype = 'security-misc',
cpe = nil,
fingerprint = '^f4ed19e0c114eb516faaac0ee37daf2807b4381f00000001000000020000000000000000........'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Checkpoint VPN-1 / Firewall-1',
version = '4.1 SP1',
ostype = nil,
devicetype = 'security-misc',
cpe = nil,
fingerprint = '^f4ed19e0c114eb516faaac0ee37daf2807b4381f00000001000000030000000000000000........'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Checkpoint VPN-1 / Firewall-1',
version = '4.1 SP2-SP6',
ostype = nil,
devicetype = 'security-misc',
cpe = nil,
fingerprint = '^f4ed19e0c114eb516faaac0ee37daf2807b4381f0000000100000fa20000000000000000........'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Checkpoint VPN-1 / Firewall-1',
version = 'NG Base',
ostype = nil,
devicetype = 'security-misc',
cpe = nil,
fingerprint = '^f4ed19e0c114eb516faaac0ee37daf2807b4381f00000001000013880000000000000000........'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Checkpoint VPN-1 / Firewall-1',
version = 'NG FP1',
ostype = nil,
devicetype = 'security-misc',
cpe = nil,
fingerprint = '^f4ed19e0c114eb516faaac0ee37daf2807b4381f00000001000013890000000000000000........'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Checkpoint VPN-1 / Firewall-1',
version = 'NG FP2',
ostype = nil,
devicetype = 'security-misc',
cpe = nil,
fingerprint = '^f4ed19e0c114eb516faaac0ee37daf2807b4381f000000010000138a0000000000000000........'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Checkpoint VPN-1 / Firewall-1',
version = 'NG FP3',
ostype = nil,
devicetype = 'security-misc',
cpe = nil,
fingerprint = '^f4ed19e0c114eb516faaac0ee37daf2807b4381f000000010000138b0000000000000000........'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Checkpoint VPN-1 / Firewall-1',
version = 'NG AI R54',
ostype = nil,
devicetype = 'security-misc',
cpe = nil,
fingerprint = '^f4ed19e0c114eb516faaac0ee37daf2807b4381f000000010000138c0000000000000000........'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Checkpoint VPN-1 / Firewall-1',
version = 'NG AI R55',
ostype = nil,
devicetype = 'security-misc',
cpe = nil,
fingerprint = '^f4ed19e0c114eb516faaac0ee37daf2807b4381f000000010000138d0000000000000000........'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Checkpoint VPN-1 / Firewall-1',
version = 'NGX',
ostype = nil,
devicetype = 'security-misc',
cpe = nil,
fingerprint = '^f4ed19e0c114eb516faaac0ee37daf2807b4381f000000010000138d........00000000........'
});
-- Catch all Checkpoint
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Checkpoint VPN-1 / Firewall-1',
version = nil,
ostype = nil,
devicetype = 'security-misc',
cpe = nil,
fingerprint = '^f4ed19e0c114eb516faaac0ee37daf2807b4381f'
});
--------------------------------------------------------------------------------
-- Cisco
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Cisco VPN Concentrator 3000',
version = '3.0.0',
ostype = 'pSOS+',
devicetype = 'security-misc',
cpe = 'cpe:/h:cisco:concentrator',
fingerprint = '^1f07f70eaa6514d3b0fa96542a500300'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Cisco VPN Concentrator 3000',
version = '3.0.1',
ostype = 'pSOS+',
devicetype = 'security-misc',
cpe = 'cpe:/h:cisco:concentrator',
fingerprint = '^1f07f70eaa6514d3b0fa96542a500301'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Cisco VPN Concentrator 3000',
version = '3.0.5',
ostype = 'pSOS+',
devicetype = 'security-misc',
cpe = 'cpe:/h:cisco:concentrator',
fingerprint = '^1f07f70eaa6514d3b0fa96542a500305'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Cisco VPN Concentrator 3000',
version = '4.0.7',
ostype = 'pSOS+',
devicetype = 'security-misc',
cpe = 'cpe:/h:cisco:concentrator',
fingerprint = '^1f07f70eaa6514d3b0fa96542a500407'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Cisco VPN Concentrator 3000',
version = nil,
ostype = 'pSOS+',
devicetype = 'security-misc',
cpe = 'cpe:/h:cisco:concentrator',
fingerprint = '^1f07f70eaa6514d3b0fa96542a......'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Cisco',
version = nil,
ostype = 'IOS',
devicetype = 'security-misc',
cpe = 'cpe:/h:cisco',
fingerprint = '^3e984048'
});
--------------------------------------------------------------------------------
-- Fortinet
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Fortinet FortiGate',
version = nil,
ostype = nil,
devicetype = 'Network Security Appliance',
cpe = 'cpe:/h:fortinet:fortigate',
fingerprint = '^1d6e178f6c2c0be284985465450fe9d4'
});
--------------------------------------------------------------------------------
-- FreeS/WAN
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Linux FreeS/WAN',
version = '2.00',
ostype = 'Linux',
devicetype = nil,
cpe = 'cpe:/a::freeswan:2.00',
fingerprint = '^4f45486b7d44784d42676b5d'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Linux FreeS/WAN',
version = '2.01',
ostype = 'Linux',
devicetype = nil,
cpe = 'cpe:/a::freeswan:2.01',
fingerprint = '^4f457c4f547e6e615b426e56'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Linux FreeS/WAN',
version = '2.02',
ostype = 'Linux',
devicetype = nil,
cpe = 'cpe:/a::freeswan:2.02',
fingerprint = '^4f456c6b44696d7f6b4c4e60'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Linux FreeS/WAN',
version = '2.03',
ostype = 'Linux',
devicetype = nil,
cpe = 'cpe:/a::freeswan:2.03',
fingerprint = '^4f45566671474962734e6264'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Linux FreeS/WAN',
version = '2.04',
ostype = 'Linux',
devicetype = nil,
cpe = 'cpe:/a::freeswan:2.04',
fingerprint = '^4f45704f736579505c6e5f6d'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Linux FreeS/WAN',
version = '2.05',
ostype = 'Linux',
devicetype = nil,
cpe = 'cpe:/a::freeswan:2.05',
fingerprint = '^4f457271785f4c7e496f4d54'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Linux FreeS/WAN',
version = '2.06',
ostype = 'Linux',
devicetype = nil,
cpe = 'cpe:/a::freeswan:2.06',
fingerprint = '^4f457e4c466e5d427c5c6b52'
});
--------------------------------------------------------------------------------
-- Juniper
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = 'SSG-550M',
ostype = 'NetScreen OS 6.20',
devicetype = 'Firewall/VPN',
cpe = 'cpe:/h:juniper:ssg-550m:6.20',
fingerprint = '^2c9d7e81995b9967d23f571ac641f9348122f1cc1200000014060000'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper NetScreen',
version = 'NS-5GT',
ostype = 'NetScreen OS',
devicetype = 'Firewall/VPN',
cpe = 'cpe:/h:juniper:ns-5gt',
fingerprint = '^166f932d55eb64d8e4df4fd37e2313f0d0fd8451'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = 'NS-5GT',
ostype = 'NetScreen OS',
devicetype = 'Firewall/VPN',
cpe = 'cpe:/h:juniper:ns-5gt',
fingerprint = '^4a4340b543e02b84c88a8b96a8af9ebe77d9accc'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = 'NS-5XP',
ostype = 'NetScreen OS',
devicetype = 'Firewall/VPN',
cpe = 'cpe:/h:juniper:ns-5xp',
fingerprint = '^299ee8289f40a8973bc78687e2e7226b532c3b76'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = 'NS-5XP',
ostype = 'NetScreen OS',
devicetype = 'Firewall/VPN',
cpe = 'cpe:/h:juniper:ns-5xp',
fingerprint = '^64405f46f03b7660a23be116a1975058e69e8387'
});
-- 9436e8d67174ef9aed068d5ad5213f187a3f8ba6000000160000061e (Netscreen 5XP running ScreenOS 4.0.r3) ?
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = 'NS-5XP',
ostype = 'NetScreen OS',
devicetype = 'Firewall/VPN',
cpe = 'cpe:/h:juniper:ns-5xp',
fingerprint = '^9436e8d67174ef9aed068d5ad5213f187a3f8ba6'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = nil,
ostype = 'NetScreen OS',
devicetype = nil,
cpe = nil,
fingerprint = '^3a15e1f3cf2a63582e3ac82d1c64cbe3b6d779e7'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = nil,
ostype = 'NetScreen OS',
devicetype = nil,
cpe = nil,
fingerprint = '^47d2b126bfcd83489760e2cf8c5d4d5a03497c15'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = nil,
ostype = 'NetScreen OS',
devicetype = nil,
cpe = nil,
fingerprint = '^699369228741c6d4ca094c93e242c9de19e7b7c6'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = nil,
ostype = 'NetScreen OS',
devicetype = nil,
cpe = nil,
fingerprint = '^8c0dc6cf62a0ef1b5c6eabd1b67ba69866adf16a'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = nil,
ostype = 'NetScreen OS',
devicetype = nil,
cpe = nil,
fingerprint = '^92d27a9ecb31d99246986d3453d0c3d57a222a61'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = nil,
ostype = 'NetScreen OS',
devicetype = nil,
cpe = nil,
fingerprint = '^9b096d9ac3275a7d6fe8b91c583111b09efed1a0'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = nil,
ostype = 'NetScreen OS',
devicetype = nil,
cpe = nil,
fingerprint = '^bf03746108d746c904f1f3547de24f78479fed12'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = nil,
ostype = 'NetScreen OS',
devicetype = nil,
cpe = nil,
fingerprint = '^c2e80500f4cc5fbf5daaeed3bb59abaeee56c652'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = nil,
ostype = 'NetScreen OS',
devicetype = nil,
cpe = nil,
fingerprint = '^c8660a62b03b1b6130bf781608d32a6a8d0fb89f'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = nil,
ostype = 'NetScreen OS',
devicetype = nil,
cpe = nil,
fingerprint = '^f885da40b1e7a9abd17655ec5bbec0f21f0ed52e'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = nil,
ostype = 'NetScreen OS',
devicetype = nil,
cpe = nil,
fingerprint = '^2a2bcac19b8e91b426107807e02e7249569d6fd3'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = nil,
ostype = 'NetScreen OS',
devicetype = nil,
cpe = nil,
fingerprint = '^a35bfd05ca1ac0b3d2f24e9e82bfcbff9c9e52b5'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Juniper',
version = nil,
ostype = 'NetScreen OS',
devicetype = nil,
cpe = nil,
fingerprint = '^4865617274426561745f4e6f74696679386b0100' -- (HeartBeat_Notify + 386b0100)
});
--------------------------------------------------------------------------------
-- KAME/racoon/IPSec Tools (for linux/BSD)
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'KAME/racoon/IPsec Tools',
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^7003cbc1097dbe9c2600ba6983bc8b35'
});
--------------------------------------------------------------------------------
-- Mac OS X
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Apple ',
version = nil,
ostype = 'Mac OS X',
devicetype = nil,
cpe = 'cpe:/a:apple:macosx',
fingerprint = '^4d6163204f53582031302e78'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Apple ',
version = nil,
ostype = 'Mac OS X',
devicetype = nil,
cpe = 'cpe:/a:apple:macosx',
fingerprint = '^4df37928e9fc4fd1b3262170d515c662'
});
--------------------------------------------------------------------------------
-- Microsoft
-- http://msdn.microsoft.com/en-us/library/cc233476.aspx
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Microsoft',
version = 'Windows 2000',
ostype = 'Windows 2000',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows:2000',
fingerprint = '^1e2b516905991c7d7c96fcbfb587e46100000002'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Microsoft',
version = 'Windows XP',
ostype = 'Windows XP',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows:XP',
fingerprint = '^1e2b516905991c7d7c96fcbfb587e46100000003'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Microsoft',
version = 'Windows Server 2003',
ostype = 'Windows Server 2003',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows:server2003',
fingerprint = '^1e2b516905991c7d7c96fcbfb587e46100000004'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Microsoft',
version = 'Windows Vista',
ostype = 'Windows Vista',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows:vista',
fingerprint = '^1e2b516905991c7d7c96fcbfb587e46100000005'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Microsoft',
version = 'Windows Server 2008',
ostype = 'Windows Server 2008',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows:server2008',
fingerprint = '^1e2b516905991c7d7c96fcbfb587e46100000006'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Microsoft',
version = 'Windows 7',
ostype = 'Windows 7',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows:7',
fingerprint = '^1e2b516905991c7d7c96fcbfb587e46100000007'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Microsoft',
version = 'Windows Server 2008 R2',
ostype = 'Windows Server 2008 R2',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows:server2008r2',
fingerprint = '^1e2b516905991c7d7c96fcbfb587e46100000008'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Microsoft',
version = 'Windows 8',
ostype = 'Windows 8',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows:8',
fingerprint = '^1e2b516905991c7d7c96fcbfb587e46100000009'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Microsoft',
version = 'Windows Server 2012',
ostype = 'Windows Server 2012',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows:server2012',
fingerprint = '^1e2b516905991c7d7c96fcbfb587e46100000010'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Microsoft',
version = 'Windows',
ostype = 'Windows',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows',
fingerprint = '^1e2b516905991c7d7c96fcbfb587e46.........'
});
--------------------------------------------------------------------------------
-- Nortel Contivity / Nortel VPN router
-- The last byte might be a version ?
-- From ike-scan:
--- 00000004, 00000005, 00000007, 00000009, 0000000a
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Nortel',
version = 'Contivity / VPN router',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^424e4553000000..'
});
--------------------------------------------------------------------------------
-- OpenPGP
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'OpenPGP',
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^4f70656e504750'
});
--------------------------------------------------------------------------------
-- Openswan
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Openswan',
version = '2.2.0',
ostype = 'Linux 2.x',
devicetype = nil,
cpe = 'cpe:/o:linux:kernel:2.x',
fingerprint = '^4f4548724b6e5e68557c604f'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Openswan',
version = '2.3.0',
ostype = 'Linux 2.x',
devicetype = nil,
cpe = 'cpe:/o:linux:kernel:2.x',
fingerprint = '^4f4572696f5c77557f746249'
});
--------------------------------------------------------------------------------
-- SafeNet
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SafeNet',
version = '8.0.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^47bbe7c993f1fc13b4e6d0db565c68e5010201010201010310382e302e3020284275696c6420313029000000'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SafeNet Remote',
version = '9.0.1',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^47bbe7c993f1fc13b4e6d0db565c68e5010201010201010310392e302e3120284275696c6420313229000000'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SafeNet Remote',
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^47bbe7c993f1fc13b4e6d0db565c68e5'
});
--------------------------------------------------------------------------------
-- SonicWall
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SonicWall',
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^5b362bc820f60001' -- SonicWall 3060 ?
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SonicWall',
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^5b362bc820f60003'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SonicWall',
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^5b362bc820f60006'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SonicWall',
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^5b362bc820f60007' -- (Maybe NSA?, SonicOS Enhanced 4.2?)
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SonicWall',
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^404bf439522ca3f6'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SonicWall',
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^da8e937880010000' -- (Maybe TZ 170)
});
--------------------------------------------------------------------------------
-- SSH IPSec Express
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 1.1.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^fbf47614984031fa8e3bb6198089b223'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 1.1.1',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^1952dc91ac20f646fb01cf42a33aee30'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 1.1.2',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^e8bffa643e5c8f2cd10fda7370b6ebe5'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 1.2.1',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^c1111b2dee8cbc3d620573ec57aab9cb'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 2.0.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^7f21a596e4e318f0b2f4944c2384cb84'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 2.1.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^2836d1fd2807bc9e5ae30786320451ec'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 2.1.1',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^a68de756a9c5229bae66498040951ad5'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 2.1.2',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^3f2372867e237c1cd8250a75559cae20'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 3.0.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^0e58d5774df602007d0b02443660f7eb'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 3.0.1',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^f5ce31ebc210f44350cf71265b57380f'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 4.0.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^f64260af2e2742daddd56987068a99a0'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 4.0.1',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^7a54d3bdb3b1e6d923892064be2d981c'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 4.1.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^9aa1f3b43472a45d5f506aeb260cf214'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 4.1.1',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^89f7b760d86b012acf263382394d962f'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 4.2.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^6880c7d026099114e486c55430e7abee'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 5.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^b037a21aceccb5570f602546f97bde8c'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 5.0.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^2b2dad97c4d140930053287f996850b0'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 5.1.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^45e17f3abe93944cb202910c59ef806b'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'IPSec Express 5.1.1',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^5925859f7377ed7816d2fb81c01fa551'
});
--------------------------------------------------------------------------------
-- SSH QuickSec
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'QuickSec 0.9.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^37eba0c4136184e7daf8562a77060b4a'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'QuickSec 1.1.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^5d72925e55948a9661a7fc48fdec7ff9'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'QuickSec 1.1.1',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^777fbf4c5af6d1cdd4b895a05bf82594'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'QuickSec 1.1.2',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^2cdf08e712ede8a5978761267cd19b91'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'QuickSec 1.1.3',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^59e454a8c2cf02a34959121f1890bc87'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'QuickSec 2.1.0',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^8f9cc94e01248ecdf147594c284b213b'
});
--------------------------------------------------------------------------------
-- SSH Sentinel
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'Sentinel',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^054182a07c7ae206f9d2cf9d2432c482'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'Sentinel 1.1',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^b91623e693ca18a54c6a2778552305e8'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'Sentinel 1.2',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^5430888de01a31a6fa8f60224e449958'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'Sentinel 1.3',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^7ee5cb85f71ce259c94a5c731ee4e752'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'Sentinel 1.4',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^63d9a1a7009491b5a0a6fdeb2a8284f0'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'SSH Communications Security',
version = 'Sentinel 1.4.1',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^eb4b0d96276b4e220ad16221a7b2a5e6'
});
--------------------------------------------------------------------------------
-- Stonegate
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'StoneSoft',
version = 'StoneGate',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^c573b056d7faca36c2fba28374127cbf'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'StoneSoft',
version = 'StoneGate',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^baeb239037e17787d730eed9d95d48aa'
});
--------------------------------------------------------------------------------
-- strongSwan
-- http://www.strongswan.org/
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.3.6',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^882fe56d6fd20dbc2251613b2ebe5beb'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.2.3',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^2d1f406118fbd5d28474791ffa00488a'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.2.2',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^2a517d0d23c37d08bce7c292a0217b39'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.2.1',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^bab253f4cb10a8108a7c927c56c87886'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.2.0',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^9f68901325a972894335302a9531ab9f'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.1.11',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^b7bd9f2f978e3259a7aa9f7a1396ad6c'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.1.10',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^bf3a89ae5bef8e72d44dac8bb88d7d5f'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.1.9',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^78fdd287def01a3f074b5369eab4fd1c'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.1.8',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^66a2045507c119da78a4666259cdea48'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.1.7',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^ea840aa4dfc9712d6c32b5a16eb329a3'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.1.6',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^d19683368af4b0edc21ccde982b1d1b0'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.1.5',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^bf0fbf7306ebb7827042d893539886e2'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.1.4',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^312f9cb1a6b90e19de7528c904ac3087'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.1.3',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^5849ab6d8beabd6e4d09e5a3b88c089a'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.1.2',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^15a1ace7ee52fddfef04f928db2dd134'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.1.1',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^d3f1c488c368175d5f40a8f5ca5f5e12'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.1.0',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^4794cef6843422980d1a3d06af41c5cd'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.0.7',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^ab0746221cc8fd0d5238f73a9b3da557'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.0.6',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^4c90136946577b51919d8d9a6b8e4a9f'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.0.5',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^dd180d21e5ce655a768ba32211dd8ad9'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.0.4',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^1ef283f83549b5ff9608b6d634f84d75'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.0.3',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^b181b18e114fc209b3c6e26c3a80718e'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.0.2',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^77e8eea6f556a499de3ffe7f7f95661c'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.0.1',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^9dbbafcf1db0dd595ae065294003ad3e'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '4.0.0',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^2ce9c946a4c879bf11b50b76cc5692cb'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.8.8',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^8c4a3bcb729b11f703d22a5b39640ca8'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.8.7',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^3a0d4e7ca4e492ed4dfe476d1ac6018b'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.8.6',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^fe3f49706e26a9fb36a87bfce9ea36ce'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.8.5',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^4c7efa31b39e510432a317570d97bbb9'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.8.4',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^76c72bfd398424dd001b86d0012fe061'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.8.3',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^fb4641ad0eeb2a34491d15f4eff51063'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.8.2',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^299932277b7dfe382ce23465333a7d23'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.8.1',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^e37f2d5ba89a62cd202ee27dac06c8a8'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.8.0',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^32f0e9b9c06dfe8c9ad5599a636971a1'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.7.3',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^7f50cc4ebf04c2d9da73abfd69b77aa2'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.7.2',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^a194e2aaddd0bafb95253dd96dc733eb'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.7.1',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^8134878582121785ba65ea345d6ba724'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.7.0',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^07fa128e4754f9447b1dd46374eef360'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.6.4',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^b927f95219a0fe3600dba3c1182ae55f'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.6.3',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^b2860e7837f711bef3d0eeb106872ded'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.6.2',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^5b1cd6fe7d050eda6c93871c107db3d2'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.6.1',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^66afbc12bbfe6ce108b1f69f4bc917b7'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.6.0',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^3f3266499ffdbd85950e702298062844'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.5.7',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^1f4442296b83d7e33a8b45209ba0e590'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.5.6',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^3c5eba3d8564928e32ae43c3d9924dee'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.5.5',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^3f267ed621ada7ee6c7d8893ccb0b14b'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.5.4',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^7a6bf5b7df89642a75a78ef7d657c1c0'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.5.3',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^df5b1f0f1d5679d9f8512b16c55a6065'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.5.2',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^861ce5eb72164b190e9e629a31cf4901'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.5.1',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^9a4a4648f60f8eda7cfcbfe271ee5b7d'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.5.0',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^9eb3d907ed7ada4e3cbcacb917abc8e4'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.4.4',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^485a70361b4433b31dea1c6be0df243e'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.4.3',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^982b7a063a33c143a8eadc88249f6bcc'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.4.2',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^e7a3fd0c6d771a8f1b8a86a4169c9ea4'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.4.1',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^75b0653cb281eb26d31ede38c8e1e228'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.4.0',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^e829c88149bab3c0cee85da60e18ae9b'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.3.2',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^42a4834c92ab9a7777063afa254bcb69'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.3.1',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^f697c1afcc2ec8ddcdf99dc7af03a67f'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.3.0',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^b8f92b2fa2d3fe5fe158344bda1cc6ae'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.2.2',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^99dc7cc823376b3b33d04357896ae07b'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.2.1',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^d9118b1e9de5efced9cc9d883f2168ff'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'strongSwan',
version = '2.2.0',
ostype = nil, -- Linux, Android, FreeBSD, Mac OS X
devicetype = nil,
cpe = nil,
fingerprint = '^85b6cbec480d5c8cd9882c825ac2c244'
});
--------------------------------------------------------------------------------
-- Symantec
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Symantec',
version = 'Raptor 8.1',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^526170746f7220506f77657256706e20536572766572205b56382e315d'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Symantec',
version = 'Raptor',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^526170746f7220506f77657256706e20536572766572'
});
--------------------------------------------------------------------------------
-- Timestep
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Timestep',
version = 'SGW 1520 315 2.01E013',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^54494d455354455020312053475720313532302033313520322e303145303133'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'Timestep',
version = 'VPN Gateway',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^54494d4553544550'
});
--------------------------------------------------------------------------------
-- ZyXEL
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'vendor',
vendor = 'ZyXEL',
version = 'ZyWALL router',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^b858d1addd08c1e8adafea150608aa4497aa6cc8'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'ZyXEL',
version = 'Zywall', -- Zyxel Zywall 2 / Zywall 30w / Zywall 70
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^625027749d5ab97f5616c1602765cf480a3b7d0b'
});
table.insert(fingerprints, {
category = 'vendor',
vendor = 'ZyXEL',
version = 'ZyWALL USG',
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^f758f22668750f03b08df6ebe1d0'
});
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Attribute: Misc fingerprints
-- not directly usable for fingerprinting
-- but can be used for guessing
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Microsoft
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'attribute',
vendor = 'Microsoft',
version = nil,
ostype = 'windows',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows',
fingerprint = '^621b04bb09882ac1e15935fefa24aeee',
text = 'GSSAPI'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = 'Microsoft',
version = nil,
ostype = 'windows',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows',
fingerprint = '^1e2b516905991c7d7c96fcbfb587e461',
text = 'MS NT5 ISAKMPOAKLEY'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = 'Microsoft',
version = nil,
ostype = 'windows',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows',
fingerprint = '^ad2c0dd0b9c32083ccba25b8861ec455',
text = 'A GSS-API Authentication Method for IKE'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = 'Microsoft',
version = nil,
ostype = 'windows',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows',
fingerprint = '^b46d8914f3aaa3f2fedeb7c7db2943ca',
text = 'A GSS-API Authentication Method for IKE\\n'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = 'Microsoft',
version = nil,
ostype = 'windows',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows',
fingerprint = '^26244d38eddb61b3172a36e3d0cfb819',
text = 'Microsoft Initial-Contact'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = 'Microsoft',
version = nil,
ostype = 'windows',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows',
fingerprint = '^fb1de3cdf341b7ea16b7e5be0855f120',
text = 'MS-Negotiation Discovery Capable'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = 'Microsoft',
version = nil,
ostype = 'windows',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows',
fingerprint = '^e3a5966a76379fe707228231e5ce8652',
text = 'IKE CGA version 1'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = 'Microsoft',
version = nil,
ostype = 'windows',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows',
fingerprint = '^214ca4faffa7f32d6748e5303395ae83',
text = 'MS-MamieExists'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = 'Microsoft',
version = nil,
ostype = 'windows',
devicetype = nil,
cpe = 'cpe:/o:microsoft:windows',
fingerprint = '^72872B95FCDA2EB708EFE322119B4971',
text = 'NLBS_PRESENT'
});
--------------------------------------------------------------------------------
-- Other stuff
--------------------------------------------------------------------------------
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^12f5f28c457168a9702d9fe274cc0100',
text = 'Cisco Unity'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^4048b7d56ebce88525e7de7f00d6c2d3',
text = 'IKE FRAGMENTATION'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^afcad71368a1f1c96b8696fc77570100',
text = 'Dead Peer Detection v1.0'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^afcad71368a1f1c96b8696fc7757....',
text = 'Dead Peer Detection'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^09002689dfd6b712',
text = 'XAUTH'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^325df29a2319f2dd',
text = 'draft-krywaniuk-ipsec-antireplay-00'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^325df29a2319f2dd',
text = 'draft-krywaniuk-ipsec-antireplay-00'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^8db7a41811221660',
text = 'draft-ietf-ipsec-heartbeats-00'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^50760f624c63e5c53eea386c685ca083',
text = 'ESPThruNAT'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^c40fee00d5d39ddb1fc762e09b7cfea7',
text = 'Testing NAT-T RFC'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^4a131c81070358455c5728f20e95452f',
text = 'RFC 3947 NAT-T'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^810fa565f8ab14369105d706fbd57279',
text = 'RFC XXXX'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^4865617274426561745f4e6f74696679',
text = 'Heartbeat Notify'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^4df37928e9fc4fd1b3262170d515c662',
text = 'draft-ietf-ipsec-nat-t-ike'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^4485152d18b6bbcd0be8a8469579ddcc',
text = 'draft-ietf-ipsec-nat-t-ike-00'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^16f6ca16e4a4066d83821a0f0aeaa862',
text = 'draft-ietf-ipsec-nat-t-ike-01'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^90cb80913ebb696e086381b5ec427b1f',
text = 'draft-ietf-ipsec-nat-t-ike-02\\n'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^cd60464335df21f87cfdb2fc68b6a448',
text = 'draft-ietf-ipsec-nat-t-ike-02'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^7d9419a65310ca6f2c179d9215529d56',
text = 'draft-ietf-ipsec-nat-t-ike-03'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^9909b64eed937c6573de52ace952fa6b',
text = 'draft-ietf-ipsec-nat-t-ike-04'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^80d0bb3def54565ee84645d4c85ce3ee',
text = 'draft-ietf-ipsec-nat-t-ike-05'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^4d1e0e136deafa34c4f3ea9f02ec7285',
text = 'draft-ietf-ipsec-nat-t-ike-06'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^439b59f8ba676c4c7737ae22eab8f582',
text = 'draft-ietf-ipsec-nat-t-ike-07'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^8f8d83826d246b6fc7a8a6a428c11de8',
text = 'draft-ietf-ipsec-nat-t-ike-08'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^42ea5b6f898d9773a575df26e7dd19e1',
text = 'draft-ietf-ipsec-nat-t-ike-09'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^ba290499c24e84e53a1d83a05e5f00c9',
text = 'IKE Challenge-Response'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^0d33611a5d521b5e3c9c03d2fc107e12',
text = 'IKE Challenge-Response-2'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^ad3251042cdc4652c9e0734ce5de4c7d',
text = 'IKE Challenge-Response Revised'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^13f11823f966fa91900f024ba66a86ba',
text = 'IKE Challenge-Response Revised-2'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^27bab5dc01ea0760ea4e3190ac27c0d0',
text = 'draft-stenberg-ipsec-nat-traversal-01'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^6105c422e76847e43f9684801292aecd',
text = 'draft-stenberg-ipsec-nat-traversal-02'
});
table.insert(fingerprints, {
category = 'attribute',
vendor = nil,
version = nil,
ostype = nil,
devicetype = nil,
cpe = nil,
fingerprint = '^6a7434c19d7e36348090a02334c9c805',
text = 'draft-huttunen-ipsec-esp-in-udp-00.txt'
});
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- vid_order:
-- By examining the ordering of the VIDs, some assumptions can be made
-- Currently only has support for Cisco
table.insert(fingerprints, {
category = 'vid_ordering',
vendor = 'Cisco',
version = nil,
ostype = 'IOS 12.3/12.4',
devicetype = nil,
cpe = 'cpe:/o:cisco:ios:12.3-12.4',
fingerprint = '^12f5f28c457168a9702d9fe274cc0100afcad71368a1f1c96b8696fc77570100................................09002689dfd6b712'
-- Cisco Unity, Dead Peer Detection v1.0, junk, XAUTH
});
table.insert(fingerprints, {
category = 'vid_ordering',
vendor = 'Cisco',
version = nil,
ostype = 'PIX OS 6.0/6.1',
devicetype = nil,
cpe = 'cpe:/o:cisco:pix:6.0-6.1',
fingerprint = '^112f5f28c457168a9702d9fe274cc0100afcad71368a1f1c96b8696fc77570100................................'
-- Cisco Unity, Dead Peer Detection, junk
});
table.insert(fingerprints, {
category = 'vid_ordering',
vendor = 'Cisco',
version = nil,
ostype = 'PIX OS 6.2.x',
devicetype = nil,
cpe = 'cpe:/o:cisco:pix:6.2.x',
fingerprint = '^09002689dfd6b71212f5f28c457168a9702d9fe274cc0100afcad71368a1f1c96b8696fc77570100................................'
-- XAUTH, Cisco Unity, Dead Peer Detection, junk
});
table.insert(fingerprints, {
category = 'vid_ordering',
vendor = 'Cisco',
version = nil,
ostype = 'PIX OS 6.3.x',
devicetype = nil,
cpe = 'cpe:/o:cisco:pix:6.3.x',
fingerprint = '^09002689dfd6b712afcad71368a1f1c96b8696fc7757010012f5f28c457168a9702d9fe274cc0100................................'
-- XAUTH, Dead Peer Detection v1.0, Cisco Unity, junk
});
table.insert(fingerprints, {
category = 'vid_ordering',
vendor = 'Cisco',
version = nil,
ostype = 'PIX OS 7.0.x',
devicetype = nil,
cpe = 'cpe:/o:cisco:pix:7.0.x',
fingerprint = '^12f5f28c457168a9702d9fe274cc010009002689dfd6b712afcad71368a1f1c96b8696fc775701004048b7d56ebce88525e7de7f00d6c2d3c00000001f07f70eaa6514d3b0fa96542a......'
--Cisco Unity, XAUTH, Dead Peer Detection v1.0, IKE Fragmentation, Cisco VPN Concentrator
});
table.insert(fingerprints, {
category = 'vid_ordering',
vendor = 'Cisco',
version = nil,
ostype = 'PIX OS 7.1 or later',
devicetype = nil,
cpe = 'cpe:/o:cisco:pix:7.1_or_later',
fingerprint = '^12f5f28c457168a9702d9fe274cc010009002689dfd6b7124048b7d56ebce88525e7de7f00d6c2d3c00000001f07f70eaa6514d3b0fa96542a......'
-- Cisco Unity, XAUTH, IKE Fragmentation, Cisco VPN Concentrator
});
--[[ Probably too
table.insert(fingerprints, {
category = 'vid_ordering',
vendor = 'Cisco',
version = 'PIX OS 5.x OR IOS 12.0-12.2',
ostype = 'PIX OS / IOS',
devicetype = nil,
cpe = 'cpe:/o:cisco',
fingerprint = '^................................',
-- 'random' VID, but fixed length
});
]]
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- header_ordering:
-- For possible future use
--- Cisco
-- 1: SA, VID, VID, VID, VID, KeyExchange, ID, Nonce, Hash
-- 2: SA, KeyExchange, Nonce, ID, Hash, VID, VID, VID, VID, VID, VID
-- 3: SA, KeyExchange, Nonce, ID, Hash, VID, VID, VID, VID, VID
--- Checkpoint
-- 1: SA, VID (Main)
-- 2: SA, KeyExchange, Nonce, ID, VID, Hash (Aggressive)
--- SonicWall
-- 1: SA, VID (Main)
-- 2: SA, KeyExchange, Nonce, ID, VID, Hash (Aggressive)
--- Juniper
-- 1: SA, VID, VID, VID
-- 2: SA, VID, VID, VID, VID, VID
--- Zyxel
-- 1: SA, VID, VID, VID, VID, VID, VID, VID, VID (Zyxel USG 100)
-- 2: SA, VID, VID, VID, VID, VID, VID, VID, VID, VID (Zyxel USG 100)
-- 3: SA, VID, VID (Zyxel USG 200, ZyWall)
-- 4: SA, KeyExchenge, Nonce, ID, Hash, VID, VID, Notification (Zyxel USG 300)
-- 5: SA, VID (???)
|
local Node = require('gui.node')
local input, max = input, math.max
--- Displays a tip for the the specified slot.
local SlotTip = {}
SlotTip.__index = SlotTip
setmetatable(SlotTip, {__index = Node})
--- Returns a new `SlotTip`. `slot` should be set in the parent's `tick`.
function SlotTip.new()
local self = setmetatable(Node.new(), SlotTip)
self.w = 20
self.h = 20
self.filter_cursor = false
self.slot = nil
return self
end
function SlotTip:tick(dt, game)
Node.tick(self, dt, game)
if self.slot and self.slot.item then
local font = game.assets.fonts.tic_80_wide
self.w = max(font:getWidth(self.slot.item.name) + 1,
font:getWidth(self.slot.item.desc) + 1)
end
end
function SlotTip:draw(game)
if self.slot and self.slot.item then
local pre_color = {love.graphics.getColor()}
love.graphics.setColor(0, 0, 0, 1)
love.graphics.print(self.slot.item.name, self.x + 1, self.y + 1)
love.graphics.print(self.slot.item.desc, self.x + 1, self.y + 1 + 8)
love.graphics.setColor(unpack(pre_color))
love.graphics.print(self.slot.item.name, self.x, self.y)
love.graphics.print(self.slot.item.desc, self.x, self.y + 8)
end
for i, child in pairs(self.children) do child:draw(game) end
end
return SlotTip
|
-- local file = io.open( "test.txt", "r" ) -- 198
local file = io.open( "input.txt", "r" ) -- 3912944
local gamma = ""
local epsilon = ""
local bits = nil
local line_length = nil
-- use the bits table to keep track of the number of 0 and 1 at each bit
for line in file:lines() do
if not bits then
line_length = #line
bits = {}
for i = 1, #line do
bits[i] = {["0"] = 0, ["1"] = 0}
end
end
for i = 1, #line do
local bit = line:sub(i, i)
bits[i][bit] = bits[i][bit] + 1
end
end
-- make the gamma and epsilon
for i = 1, line_length do
if bits[i]["0"] > bits[i]["1"] then
gamma = gamma .. "0"
epsilon = epsilon .. "1"
else
gamma = gamma .. "1"
epsilon = epsilon .. "0"
end
end
-- print("gamma: " .. gamma)
-- print("epsilon: " .. epsilon)
local function value(string)
local out = 0
local multiplier = 1
for i = 1, #string do
local pointer = #string + 1 - i
local bit = string:sub(pointer, pointer)
out = out + (tonumber(bit) * multiplier)
multiplier = multiplier * 2
end
return out
end
print(value(gamma) * value(epsilon))
file:close()
|
local MissileHit = class("MissileHit")
function MissileHit:initialize(playerHit, damageGivenByPlayer)
self.playerHit = playerHit
self.damageGivenByPlayer = damageGivenByPlayer
end
return MissileHit
|
-- tz -- A simple timezone module for interpreting zone files
local M = {}
local tstart = 0
local tend = 0
local toffset = 0
local thezone = "eastern"
function M.setzone(zone)
thezone = zone
return M.exists(thezone)
end
function M.exists(zone)
return file.exists(zone .. ".zone")
end
function M.getzones()
local result = {}
for fn, _ in pairs(file.list()) do
local _, _, prefix = string.find(fn, "(.*).zone")
if prefix then
table.insert(result, prefix)
end
end
return result
end
local function load(t)
local z = file.open(thezone .. ".zone", "r")
local hdr = z:read(20)
local magic = struct.unpack("c4 B", hdr)
if magic == "TZif" then
local lens = z:read(24)
local ttisgmt_count, ttisdstcnt, leapcnt, timecnt, typecnt, charcnt -- luacheck: no unused
= struct.unpack("> LLLLLL", lens)
local times = z:read(4 * timecnt)
local typeindex = z:read(timecnt)
local ttinfos = z:read(6 * typecnt)
z:close()
local offset = 1
local tt
for i = 1, timecnt do
tt = struct.unpack(">l", times, (i - 1) * 4 + 1)
if t < tt then
offset = (i - 2)
tend = tt
break
end
tstart = tt
end
local tindex = struct.unpack("B", typeindex, offset + 1)
toffset = struct.unpack(">l", ttinfos, tindex * 6 + 1)
else
tend = 0x7fffffff
tstart = 0
end
end
function M.getoffset(t)
if t < tstart or t >= tend then
-- Ignore errors
local ok, msg = pcall(function ()
load(t)
end)
if not ok then
print (msg)
end
end
return toffset, tstart, tend
end
return M
|
object_draft_schematic_armor_component_armor_core_recon_basic = object_draft_schematic_armor_component_shared_armor_core_recon_basic:new {
}
ObjectTemplates:addTemplate(object_draft_schematic_armor_component_armor_core_recon_basic, "object/draft_schematic/armor/component/armor_core_recon_basic.iff")
|
return
{
HOOK_PLAYER_OPENING_WINDOW =
{
CalledWhen = "Called when a player is about to open a window",
DefaultFnName = "OnPlayerOpeningWindow", -- also used as pagename
Desc = [[
This hook is called when a player is about to open a window, e.g. when they click on a chest or a furnace.
]],
Params =
{
{ Name = "Player", Type = "{{cPlayer}}", Notes = "The player who is opening the window" },
{ Name = "Window", Type = "{{cWindow}}", Notes = "The window that is being opened" },
},
Returns = [[
If the function returns false or no value, the next plugin's callback is called, and finally
Cuberite will process the opening window. If the function returns true, no other callback is called for this event.
]],
}, -- HOOK_PLAYER_OPENING_WINDOW
}
|
--[[
This module impements a pretty printer to the AST
]]
local pp = {}
local block2str, stm2str, exp2str, var2str
local explist2str, varlist2str, parlist2str, fieldlist2str
local function iscntrl (x)
if (x >= 0 and x <= 31) or (x == 127) then return true end
return false
end
local function isprint (x)
return not iscntrl(x)
end
local function fixed_string (str)
local new_str = ""
for i=1,string.len(str) do
char = string.byte(str, i)
if char == 34 then new_str = new_str .. string.format("\\\"")
elseif char == 92 then new_str = new_str .. string.format("\\\\")
elseif char == 7 then new_str = new_str .. string.format("\\a")
elseif char == 8 then new_str = new_str .. string.format("\\b")
elseif char == 12 then new_str = new_str .. string.format("\\f")
elseif char == 10 then new_str = new_str .. string.format("\\n")
elseif char == 13 then new_str = new_str .. string.format("\\r")
elseif char == 9 then new_str = new_str .. string.format("\\t")
elseif char == 11 then new_str = new_str .. string.format("\\v")
else
if isprint(char) then
new_str = new_str .. string.format("%c", char)
else
new_str = new_str .. string.format("\\%03d", char)
end
end
end
return new_str
end
local function name2str (name)
return string.format('"%s"', name)
end
local function boolean2str (b)
return string.format('"%s"', tostring(b))
end
local function number2str (n)
return string.format('"%s"', tostring(n))
end
local function string2str (s)
return string.format('"%s"', fixed_string(s))
end
function var2str (var)
local tag = var.tag
local str = "`" .. tag
if tag == "Id" then -- `Id{ <string> }
str = str .. " " .. name2str(var[1])
elseif tag == "Index" then -- `Index{ expr expr }
str = str .. "{ "
str = str .. exp2str(var[1]) .. ", "
str = str .. exp2str(var[2])
str = str .. " }"
else
error("expecting a variable, but got a " .. tag)
end
return str
end
function varlist2str (varlist)
local l = {}
for k, v in ipairs(varlist) do
l[k] = var2str(v)
end
return "{ " .. table.concat(l, ", ") .. " }"
end
function parlist2str (parlist)
local l = {}
local len = #parlist
local is_vararg = false
if len > 0 and parlist[len].tag == "Dots" then
is_vararg = true
len = len - 1
end
local i = 1
while i <= len do
l[i] = var2str(parlist[i])
i = i + 1
end
if is_vararg then
l[i] = "`" .. parlist[i].tag
end
return "{ " .. table.concat(l, ", ") .. " }"
end
function fieldlist2str (fieldlist)
local l = {}
for k, v in ipairs(fieldlist) do
local tag = v.tag
if tag == "Pair" then -- `Pair{ expr expr }
l[k] = "`" .. tag .. "{ "
l[k] = l[k] .. exp2str(v[1]) .. ", " .. exp2str(v[2])
l[k] = l[k] .. " }"
else -- expr
l[k] = exp2str(v)
end
end
if #l > 0 then
return "{ " .. table.concat(l, ", ") .. " }"
else
return ""
end
end
function exp2str (exp)
local tag = exp.tag
local str = "`" .. tag
if tag == "Nil" or
tag == "Dots" then
elseif tag == "Boolean" then -- `Boolean{ <boolean> }
str = str .. " " .. boolean2str(exp[1])
elseif tag == "Number" then -- `Number{ <number> }
str = str .. " " .. number2str(exp[1])
elseif tag == "String" then -- `String{ <string> }
str = str .. " " .. string2str(exp[1])
elseif tag == "Function" then -- `Function{ { `Id{ <string> }* `Dots? } block }
str = str .. "{ "
str = str .. parlist2str(exp[1]) .. ", "
str = str .. block2str(exp[2])
str = str .. " }"
elseif tag == "Table" then -- `Table{ ( `Pair{ expr expr } | expr )* }
str = str .. fieldlist2str(exp)
elseif tag == "Op" then -- `Op{ opid expr expr? }
str = str .. "{ "
str = str .. name2str(exp[1]) .. ", "
str = str .. exp2str(exp[2])
if exp[3] then
str = str .. ", " .. exp2str(exp[3])
end
str = str .. " }"
elseif tag == "Paren" then -- `Paren{ expr }
str = str .. "{ " .. exp2str(exp[1]) .. " }"
elseif tag == "Call" then -- `Call{ expr expr* }
str = str .. "{ "
str = str .. exp2str(exp[1])
if exp[2] then
for i=2, #exp do
str = str .. ", " .. exp2str(exp[i])
end
end
str = str .. " }"
elseif tag == "Invoke" then -- `Invoke{ expr `String{ <string> expr* }
str = str .. "{ "
str = str .. exp2str(exp[1]) .. ", "
str = str .. exp2str(exp[2])
if exp[3] then
for i=3, #exp do
str = str .. ", " .. exp2str(exp[i])
end
end
str = str .. " }"
elseif tag == "Id" or -- `Id{ <string> }
tag == "Index" then -- `Index{ expr expr }
str = var2str(exp)
else
error("expecting an expression, but got a " .. tag)
end
return str
end
function explist2str (explist)
local l = {}
for k, v in ipairs(explist) do
l[k] = exp2str(v)
end
if #l > 0 then
return "{ " .. table.concat(l, ", ") .. " }"
else
return ""
end
end
function stm2str (stm)
local tag = stm.tag
local str = "`" .. tag
if tag == "Do" then -- `Do{ stat* }
local l = {}
for k, v in ipairs(stm) do
l[k] = stm2str(v)
end
str = str .. "{ " .. table.concat(l, ", ") .. " }"
elseif tag == "Set" then -- `Set{ {lhs+} {expr+} }
str = str .. "{ "
str = str .. varlist2str(stm[1]) .. ", "
str = str .. explist2str(stm[2])
str = str .. " }"
elseif tag == "While" then -- `While{ expr block }
str = str .. "{ "
str = str .. exp2str(stm[1]) .. ", "
str = str .. block2str(stm[2])
str = str .. " }"
elseif tag == "Repeat" then -- `Repeat{ block expr }
str = str .. "{ "
str = str .. block2str(stm[1]) .. ", "
str = str .. exp2str(stm[2])
str = str .. " }"
elseif tag == "If" then -- `If{ (expr block)+ block? }
str = str .. "{ "
local len = #stm
if len % 2 == 0 then
local l = {}
for i=1,len-2,2 do
str = str .. exp2str(stm[i]) .. ", " .. block2str(stm[i+1]) .. ", "
end
str = str .. exp2str(stm[len-1]) .. ", " .. block2str(stm[len])
else
local l = {}
for i=1,len-3,2 do
str = str .. exp2str(stm[i]) .. ", " .. block2str(stm[i+1]) .. ", "
end
str = str .. exp2str(stm[len-2]) .. ", " .. block2str(stm[len-1]) .. ", "
str = str .. block2str(stm[len])
end
str = str .. " }"
elseif tag == "Fornum" then -- `Fornum{ ident expr expr expr? block }
str = str .. "{ "
str = str .. var2str(stm[1]) .. ", "
str = str .. exp2str(stm[2]) .. ", "
str = str .. exp2str(stm[3]) .. ", "
if stm[5] then
str = str .. exp2str(stm[4]) .. ", "
str = str .. block2str(stm[5])
else
str = str .. block2str(stm[4])
end
str = str .. " }"
elseif tag == "Forin" then -- `Forin{ {ident+} {expr+} block }
str = str .. "{ "
str = str .. varlist2str(stm[1]) .. ", "
str = str .. explist2str(stm[2]) .. ", "
str = str .. block2str(stm[3])
str = str .. " }"
elseif tag == "Local" then -- `Local{ {ident+} {expr+}? }
str = str .. "{ "
str = str .. varlist2str(stm[1])
if #stm[2] > 0 then
str = str .. ", " .. explist2str(stm[2])
else
str = str .. ", " .. "{ }"
end
str = str .. " }"
elseif tag == "Localrec" then -- `Localrec{ ident expr }
str = str .. "{ "
str = str .. "{ " .. var2str(stm[1][1]) .. " }, "
str = str .. "{ " .. exp2str(stm[2][1]) .. " }"
str = str .. " }"
elseif tag == "Goto" or -- `Goto{ <string> }
tag == "Label" then -- `Label{ <string> }
str = str .. "{ " .. name2str(stm[1]) .. " }"
elseif tag == "Return" then -- `Return{ <expr>* }
str = str .. explist2str(stm)
elseif tag == "Break" then
elseif tag == "Call" then -- `Call{ expr expr* }
str = str .. "{ "
str = str .. exp2str(stm[1])
if stm[2] then
for i=2, #stm do
str = str .. ", " .. exp2str(stm[i])
end
end
str = str .. " }"
elseif tag == "Invoke" then -- `Invoke{ expr `String{ <string> } expr* }
str = str .. "{ "
str = str .. exp2str(stm[1]) .. ", "
str = str .. exp2str(stm[2])
if stm[3] then
for i=3, #stm do
str = str .. ", " .. exp2str(stm[i])
end
end
str = str .. " }"
else
error("expecting a statement, but got a " .. tag)
end
return str
end
function block2str (block)
local l = {}
for k, v in ipairs(block) do
l[k] = stm2str(v)
end
return "{ " .. table.concat(l, ", ") .. " }"
end
function pp.tostring (t)
assert(type(t) == "table")
return block2str(t)
end
function pp.print (t)
assert(type(t) == "table")
print(pp.tostring(t))
end
function pp.dump (t, i)
if i == nil then i = 0 end
io.write(string.format("{\n"))
if type(t.tag) ~= "nil" then
io.write(string.format("%s[tag] = %s\n", string.rep(" ", i+2), t.tag))
end
if type(t.pos) ~= "nil" then
io.write(string.format("%s[pos] = %s\n", string.rep(" ", i+2), t.pos))
end
for k,v in ipairs(t) do
io.write(string.format("%s[%s] = ", string.rep(" ", i+2), tostring(k)))
if type(v) == "table" then
pp.dump(v,i+2)
else
io.write(string.format("%s\n", tostring(v)))
end
end
io.write(string.format("%s}\n", string.rep(" ", i)))
end
return pp
|
require("firecast.lua");
local __o_rrpgObjs = require("rrpgObjs.lua");
require("rrpgGUI.lua");
require("rrpgDialogs.lua");
require("rrpgLFM.lua");
require("ndb.lua");
require("locale.lua");
local __o_Utils = require("utils.lua");
local function constructNew_frmFichaOdisseia2_07_svg()
local obj = GUI.fromHandle(_obj_newObject("form"));
local self = obj;
local sheet = nil;
rawset(obj, "_oldSetNodeObjectFunction", rawget(obj, "setNodeObject"));
function obj:setNodeObject(nodeObject)
sheet = nodeObject;
self.sheet = nodeObject;
self:_oldSetNodeObjectFunction(nodeObject);
end;
function obj:setNodeDatabase(nodeObject)
self:setNodeObject(nodeObject);
end;
_gui_assignInitialParentForForm(obj.handle);
obj:beginUpdate();
obj:setName("frmFichaOdisseia2_07_svg");
obj:setAlign("client");
obj:setTheme("light");
obj:setMargins({top=1});
obj.scrollBox1 = GUI.fromHandle(_obj_newObject("scrollBox"));
obj.scrollBox1:setParent(obj);
obj.scrollBox1:setAlign("client");
obj.scrollBox1:setName("scrollBox1");
obj.rectangle1 = GUI.fromHandle(_obj_newObject("rectangle"));
obj.rectangle1:setParent(obj.scrollBox1);
obj.rectangle1:setWidth(952);
obj.rectangle1:setHeight(1347);
obj.rectangle1:setColor("white");
obj.rectangle1:setName("rectangle1");
obj.image1 = GUI.fromHandle(_obj_newObject("image"));
obj.image1:setParent(obj.rectangle1);
obj.image1:setLeft(0);
obj.image1:setTop(0);
obj.image1:setWidth(952);
obj.image1:setHeight(1347);
obj.image1:setSRC("/FichaOdisseia2.0/images/7.png");
obj.image1:setStyle("stretch");
obj.image1:setOptimize(true);
obj.image1:setName("image1");
obj.scrollBox2 = GUI.fromHandle(_obj_newObject("scrollBox"));
obj.scrollBox2:setParent(obj.rectangle1);
obj.scrollBox2:setLeft(5);
obj.scrollBox2:setTop(115);
obj.scrollBox2:setWidth(952);
obj.scrollBox2:setHeight(505);
obj.scrollBox2:setName("scrollBox2");
obj.layout1 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout1:setParent(obj.scrollBox2);
obj.layout1:setAlign("top");
obj.layout1:setHeight(30);
obj.layout1:setMargins({bottom=4});
obj.layout1:setName("layout1");
obj.button1 = GUI.fromHandle(_obj_newObject("button"));
obj.button1:setParent(obj.layout1);
obj.button1:setText("Rolagem Habilidade");
obj.button1:setWidth(190);
obj.button1:setAlign("left");
obj.button1:setName("button1");
obj.rclListaDosItens = GUI.fromHandle(_obj_newObject("recordList"));
obj.rclListaDosItens:setParent(obj.scrollBox2);
obj.rclListaDosItens:setName("rclListaDosItens");
obj.rclListaDosItens:setField("campoDosItens");
obj.rclListaDosItens:setTemplateForm("frmLR");
obj.rclListaDosItens:setLeft(1);
obj.rclListaDosItens:setTop(40);
obj.rclListaDosItens:setHeight(40);
obj.rclListaDosItens:setWidth(950);
obj.rclListaDosItens:setAutoHeight(true);
obj.scrollBox3 = GUI.fromHandle(_obj_newObject("scrollBox"));
obj.scrollBox3:setParent(obj.rectangle1);
obj.scrollBox3:setLeft(5);
obj.scrollBox3:setTop(625);
obj.scrollBox3:setWidth(952);
obj.scrollBox3:setHeight(600);
obj.scrollBox3:setName("scrollBox3");
obj.layout2 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout2:setParent(obj.scrollBox3);
obj.layout2:setAlign("top");
obj.layout2:setHeight(30);
obj.layout2:setMargins({bottom=4});
obj.layout2:setName("layout2");
obj.button2 = GUI.fromHandle(_obj_newObject("button"));
obj.button2:setParent(obj.layout2);
obj.button2:setText("Rolagem Dano");
obj.button2:setWidth(150);
obj.button2:setAlign("left");
obj.button2:setName("button2");
obj.rclDano = GUI.fromHandle(_obj_newObject("recordList"));
obj.rclDano:setParent(obj.scrollBox3);
obj.rclDano:setName("rclDano");
obj.rclDano:setField("campoDano");
obj.rclDano:setTemplateForm("frmLD");
obj.rclDano:setLeft(1);
obj.rclDano:setTop(40);
obj.rclDano:setHeight(40);
obj.rclDano:setWidth(950);
obj.rclDano:setAutoHeight(true);
obj.boxDano = GUI.fromHandle(_obj_newObject("dataScopeBox"));
obj.boxDano:setParent(obj.scrollBox3);
obj.boxDano:setName("boxDano");
obj.boxDano:setVisible(false);
obj.boxDano:setAlign("right");
obj.boxDano:setWidth(400);
obj.boxDano:setMargins({left=4, right=4});
obj.rectangle2 = GUI.fromHandle(_obj_newObject("rectangle"));
obj.rectangle2:setParent(obj.boxDano);
obj.rectangle2:setAlign("top");
obj.rectangle2:setColor("black");
obj.rectangle2:setXradius(10);
obj.rectangle2:setYradius(10);
obj.rectangle2:setHeight(80);
obj.rectangle2:setPadding({top=3, left=3, right=3, bottom=3});
obj.rectangle2:setName("rectangle2");
obj.layout3 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout3:setParent(obj.rectangle2);
obj.layout3:setAlign("top");
obj.layout3:setHeight(30);
obj.layout3:setMargins({bottom=4});
obj.layout3:setName("layout3");
obj.label1 = GUI.fromHandle(_obj_newObject("label"));
obj.label1:setParent(obj.layout3);
obj.label1:setAlign("left");
obj.label1:setText("Nome do Dano:");
obj.label1:setFontColor("white");
obj.label1:setAutoSize(true);
obj.label1:setName("label1");
obj.label1:setTextTrimming("none");
obj.label1:setWordWrap(false);
obj.rectangle3 = GUI.fromHandle(_obj_newObject("rectangle"));
obj.rectangle3:setParent(obj.layout3);
obj.rectangle3:setAlign("client");
obj.rectangle3:setMargins({left=5, right=5});
obj.rectangle3:setName("rectangle3");
obj.edit1 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit1:setParent(obj.rectangle3);
obj.edit1:setFontSize(18);
obj.edit1:setHorzTextAlign("center");
lfm_setPropAsString(obj.edit1, "fontStyle", "bold");
obj.edit1:setFontColor("Black");
obj.edit1:setAlign("client");
obj.edit1:setField("campoDano");
obj.edit1:setHitTest(true);
obj.edit1:setHint("Título da Rolagem");
obj.edit1:setName("edit1");
obj.layout4 = GUI.fromHandle(_obj_newObject("layout"));
obj.layout4:setParent(obj.rectangle2);
obj.layout4:setAlign("top");
obj.layout4:setHeight(100);
obj.layout4:setName("layout4");
obj.rectangle4 = GUI.fromHandle(_obj_newObject("rectangle"));
obj.rectangle4:setParent(obj.layout4);
obj.rectangle4:setLeft(60);
obj.rectangle4:setHeight(30);
obj.rectangle4:setWidth(180);
obj.rectangle4:setTop(3);
obj.rectangle4:setMargins({left=2});
obj.rectangle4:setName("rectangle4");
obj.edit2 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit2:setParent(obj.rectangle4);
obj.edit2:setFontSize(16);
lfm_setPropAsString(obj.edit2, "fontStyle", "bold");
obj.edit2:setFontColor("Black");
obj.edit2:setAlign("client");
obj.edit2:setField("RolD");
obj.edit2:setHitTest(true);
obj.edit2:setHint("Dados de Dano");
obj.edit2:setName("edit2");
obj.rectangle5 = GUI.fromHandle(_obj_newObject("rectangle"));
obj.rectangle5:setParent(obj.layout4);
obj.rectangle5:setLeft(250);
obj.rectangle5:setTop(3);
obj.rectangle5:setHeight(30);
obj.rectangle5:setWidth(100);
obj.rectangle5:setMargins({left=2});
obj.rectangle5:setName("rectangle5");
obj.edit3 = GUI.fromHandle(_obj_newObject("edit"));
obj.edit3:setParent(obj.rectangle5);
obj.edit3:setFontSize(16);
lfm_setPropAsString(obj.edit3, "fontStyle", "bold");
obj.edit3:setFontColor("Black");
obj.edit3:setAlign("client");
obj.edit3:setField("Mult");
obj.edit3:setHorzTextAlign("center");
obj.edit3:setHitTest(true);
obj.edit3:setHint("Multiplicador (Apenas em rolagens de Dano)");
obj.edit3:setName("edit3");
obj._e_event0 = obj.button1:addEventListener("onClick",
function (_)
-- Usuário clicou no botão de criar novo item.
-- Vamos inserir um novo item no nosso recordList
self.rclListaDosItens:append();
end, obj);
obj._e_event1 = obj.button2:addEventListener("onClick",
function (_)
-- Usuário clicou no botão de criar novo item.
-- Vamos inserir um novo item no nosso recordList
self.rclDano:append();
end, obj);
function obj:_releaseEvents()
__o_rrpgObjs.removeEventListenerById(self._e_event1);
__o_rrpgObjs.removeEventListenerById(self._e_event0);
end;
obj._oldLFMDestroy = obj.destroy;
function obj:destroy()
self:_releaseEvents();
if (self.handle ~= 0) and (self.setNodeDatabase ~= nil) then
self:setNodeDatabase(nil);
end;
if self.rectangle5 ~= nil then self.rectangle5:destroy(); self.rectangle5 = nil; end;
if self.edit3 ~= nil then self.edit3:destroy(); self.edit3 = nil; end;
if self.button1 ~= nil then self.button1:destroy(); self.button1 = nil; end;
if self.label1 ~= nil then self.label1:destroy(); self.label1 = nil; end;
if self.rclDano ~= nil then self.rclDano:destroy(); self.rclDano = nil; end;
if self.layout4 ~= nil then self.layout4:destroy(); self.layout4 = nil; end;
if self.scrollBox3 ~= nil then self.scrollBox3:destroy(); self.scrollBox3 = nil; end;
if self.rectangle2 ~= nil then self.rectangle2:destroy(); self.rectangle2 = nil; end;
if self.rectangle3 ~= nil then self.rectangle3:destroy(); self.rectangle3 = nil; end;
if self.rectangle4 ~= nil then self.rectangle4:destroy(); self.rectangle4 = nil; end;
if self.button2 ~= nil then self.button2:destroy(); self.button2 = nil; end;
if self.image1 ~= nil then self.image1:destroy(); self.image1 = nil; end;
if self.boxDano ~= nil then self.boxDano:destroy(); self.boxDano = nil; end;
if self.layout3 ~= nil then self.layout3:destroy(); self.layout3 = nil; end;
if self.edit2 ~= nil then self.edit2:destroy(); self.edit2 = nil; end;
if self.layout1 ~= nil then self.layout1:destroy(); self.layout1 = nil; end;
if self.scrollBox1 ~= nil then self.scrollBox1:destroy(); self.scrollBox1 = nil; end;
if self.rectangle1 ~= nil then self.rectangle1:destroy(); self.rectangle1 = nil; end;
if self.layout2 ~= nil then self.layout2:destroy(); self.layout2 = nil; end;
if self.edit1 ~= nil then self.edit1:destroy(); self.edit1 = nil; end;
if self.rclListaDosItens ~= nil then self.rclListaDosItens:destroy(); self.rclListaDosItens = nil; end;
if self.scrollBox2 ~= nil then self.scrollBox2:destroy(); self.scrollBox2 = nil; end;
self:_oldLFMDestroy();
end;
obj:endUpdate();
return obj;
end;
function newfrmFichaOdisseia2_07_svg()
local retObj = nil;
__o_rrpgObjs.beginObjectsLoading();
__o_Utils.tryFinally(
function()
retObj = constructNew_frmFichaOdisseia2_07_svg();
end,
function()
__o_rrpgObjs.endObjectsLoading();
end);
assert(retObj ~= nil);
return retObj;
end;
local _frmFichaOdisseia2_07_svg = {
newEditor = newfrmFichaOdisseia2_07_svg,
new = newfrmFichaOdisseia2_07_svg,
name = "frmFichaOdisseia2_07_svg",
dataType = "",
formType = "undefined",
formComponentName = "form",
title = "",
description=""};
frmFichaOdisseia2_07_svg = _frmFichaOdisseia2_07_svg;
Firecast.registrarForm(_frmFichaOdisseia2_07_svg);
return _frmFichaOdisseia2_07_svg;
|
local function map_2digit_year(y2)
local current_year = atom.date:get_current().year
local guess2 = math.floor(current_year / 100) * 100 + tonumber(y2)
local guess1 = guess2 - 100
local guess3 = guess2 + 100
if guess1 >= current_year - 80 and guess1 <= current_year + 10 then
return guess1
elseif guess2 >= current_year - 80 and guess2 <= current_year + 10 then
return guess2
elseif guess3 >= current_year - 80 and guess3 <= current_year + 10 then
return guess3
end
end
function parse.date(str, dest_type, options)
if dest_type ~= atom.date then
error("parse.date(...) can only return dates, but a different destination type than atom.date was given.")
end
local date_format = locale.get("date_format")
if date_format and string.find(date_format, "Y+%-D+%-M+") then
error("Date format collision with ISO standard.")
end
if string.match(str, "^%s*$") then
return nil
end
-- first try ISO format
local year, month, day = string.match(
str, "^%s*([0-9][0-9][0-9][0-9])%-([0-9][0-9])%-([0-9][0-9])%s*$"
)
if year then
return atom.date{
year = tonumber(year),
month = tonumber(month),
day = tonumber(day)
}
end
if not date_format then
return atom.date.invalid
end
local format_parts = {}
local numeric_parts = {}
for part in string.gmatch(date_format, "[YMD]+") do
format_parts[#format_parts+1] = part
end
for part in string.gmatch(str, "[0-9]+") do
numeric_parts[#numeric_parts+1] = part
end
if #format_parts ~= #numeric_parts then
return atom.date.invalid
end
local year, month, day
local function process_part(format_part, numeric_part)
if string.find(format_part, "^Y+$") then
if #numeric_part == 4 then
year = tonumber(numeric_part)
elseif #numeric_part == 2 then
year = map_2digit_year(numeric_part)
else
return atom.date.invalid
end
elseif string.find(format_part, "^M+$") then
month = tonumber(numeric_part)
elseif string.find(format_part, "^D+$") then
day = tonumber(numeric_part)
else
if not #format_part == #numeric_part then
return atom.date.invalid
end
local year_str = ""
local month_str = ""
local day_str = ""
for i = 1, #format_part do
local format_char = string.sub(format_part, i, i)
local number_char = string.sub(numeric_part, i, i)
if format_char == "Y" then
year_str = year_str .. number_char
elseif format_char == "M" then
month_str = month_str .. number_char
elseif format_char == "D" then
day_str = day_str .. number_char
else
error("Assertion failed.")
end
end
if #year_str == 2 then
year = map_2digit_year(year_str)
else
year = tonumber(year_str)
end
month = tonumber(month_str)
day = tonumber(day_str)
end
end
for i = 1, #format_parts do
process_part(format_parts[i], numeric_parts[i])
end
if not year or not month or not day then
error("Date parser did not determine year, month and day. Maybe the 'date_format' locale is erroneous?")
end
return atom.date{ year = year, month = month, day = day }
end
|
--
-- tests/actions/vstudio/vc2010/test_project_configs.lua
-- Test the Visual Studio 2010 project configurations item group.
-- Copyright (c) 2009-2014 Jason Perkins and the Premake project
--
local suite = test.declare("vstudio_vc2010_project_configs")
local vc2010 = premake.vstudio.vc2010
--
-- Setup
--
local wks, prj
function suite.setup()
_ACTION = "vs2010"
wks = test.createWorkspace()
end
local function prepare()
prj = test.getproject(wks, 1)
vc2010.projectConfigurations(prj)
end
--
-- If no architectures are specified, Win32 should be the default.
--
function suite.win32Listed_onNoPlatforms()
prepare()
test.capture [[
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
]]
end
--
-- Visual Studio requires that all combinations of configurations and
-- architectures be listed (even if some pairings would make no sense
-- for our build, i.e. Win32 DLL DCRT|PS3).
--
function suite.allArchitecturesListed_onMultipleArchitectures()
platforms { "32b", "64b" }
filter "platforms:32b"
architecture "x86"
filter "platforms:64b"
architecture "x86_64"
prepare()
test.capture [[
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug 32b|Win32">
<Configuration>Debug 32b</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug 32b|x64">
<Configuration>Debug 32b</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug 64b|Win32">
<Configuration>Debug 64b</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug 64b|x64">
<Configuration>Debug 64b</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release 32b|Win32">
]]
end
--
-- Sometimes unrolling the configuration-architecture combinations
-- can cause duplicates. Make sure those get removed.
--
function suite.allArchitecturesListed_onImplicitArchitectures()
platforms { "x86", "x86_64" }
prepare()
test.capture [[
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
]]
end
|
local fallbackQueue = pl.class({
_init = function (self, text, fallbacks)
self.q = {}
self.fallbacks = fallbacks
self.text = text
self.q[1] = { start =1, stop = #text }
self.q[#(self.q)+1] = { popFallbacks = true }
end,
pop = function (self)
table.remove(self.fallbacks, 1)
table.remove(self.q, 1)
self.q[#(self.q)+1] = { popFallbacks = true }
end,
shift = function (self)
return table.remove(self.q, 1)
end,
continuing = function (self)
return #self.q > 0 and #self.fallbacks > 0
end,
currentFont = function (self)
return self.fallbacks[1]
end,
currentJob = function (self)
return self.q[1]
end,
lastJob = function (self)
return self.q[#(self.q)]
end,
currentText = function (self)
return self.text:sub(self.q[1].start, self.q[1].stop)
end,
addJob = function (self, start, stop)
self.q[#(self.q)+1] = { start = start, stop = stop }
end
})
local fontlist = {}
SILE.registerCommand("font:clear-fallbacks", function ()
fontlist = {}
end)
SILE.registerCommand("font:add-fallback", function (options, _)
fontlist[#fontlist+1] = options
end)
SILE.registerCommand("font:remove-fallback", function ()
fontlist[#fontlist] = nil
end, "Pop last added fallback from fallback stack")
SILE.shapers.harfbuzzWithFallback = pl.class({
_base = SILE.shapers.harfbuzz,
shapeToken = function (self, text, options)
local items = {}
local optionSet = { options }
for i = 1, #fontlist do
local moreOptions = pl.tablex.deepcopy(options)
for k, v in pairs(fontlist[i]) do moreOptions[k] = v end
optionSet[#optionSet+1] = moreOptions
end
local shapeQueue = fallbackQueue(text, optionSet)
while shapeQueue:continuing() do
SU.debug("fonts", "Queue: ".. shapeQueue.q)
options = shapeQueue:currentFont()
if not (options.family or options.filename) then return end
SU.debug("fonts", shapeQueue:currentJob())
if shapeQueue:currentJob().popFallbacks then shapeQueue:pop()
else
local chunk = shapeQueue:currentText()
SU.debug("fonts", "Trying font '"..options.family.."' for '"..chunk.."'")
local newItems = self._base.shapeToken(self, chunk, options)
local startOfNotdefRun = -1
for i = 1, #newItems do
if newItems[i].gid > 0 then
SU.debug("fonts", "Found glyph '"..newItems[i].text.."'")
local start = shapeQueue:currentJob().start
if startOfNotdefRun > -1 then
shapeQueue:addJob(start + newItems[startOfNotdefRun].index,
start + newItems[i].index - 1)
SU.debug("fonts", "adding run "..shapeQueue:lastJob())
startOfNotdefRun = -1
end
newItems[i].fontOptions = options
-- There might be multiple glyphs for the same index
if not items[start + newItems[i].index] then
items[start + newItems[i].index] = newItems[i]
else
local lastInPlace = items[start + newItems[i].index]
while lastInPlace.next do lastInPlace = lastInPlace.next end
lastInPlace.next = newItems[i]
end
else
if startOfNotdefRun == -1 then startOfNotdefRun = i end
SU.debug("font-fallback", "Glyph " .. newItems[i].text .. " not found in " .. options.family)
end
end
if startOfNotdefRun > -1 then
shapeQueue:addJob(
shapeQueue:currentJob().start + newItems[startOfNotdefRun].index,
shapeQueue:currentJob().stop
)
SU.warn("Some glyph(s) not available in any fallback font, run with '-d font-fallback' for more detail")
end
shapeQueue:shift()
end
end
local nItems = {} -- Remove holes
for i = 1, math.max(0, table.unpack(pl.tablex.keys(items))) do
if items[i] then
nItems[#nItems+1] = items[i]
while items[i].next do
local nextG = items[i].next
items[i].next = nil
nItems[#nItems+1] = nextG
items[i] = nextG
end
end
end
SU.debug("fonts", nItems)
return nItems
end,
createNnodes = function (self, token, options)
local items, _ = self:shapeToken(token, options)
if #items < 1 then return {} end
local lang = options.language
SILE.languageSupport.loadLanguage(lang)
local nodeMaker = SILE.nodeMakers[lang] or SILE.nodeMakers.unicode
local run = { [1] = { slice = {}, fontOptions = items[1].fontOptions, chunk = "" } }
for i = 1, #items do
if items[i].fontOptions ~= run[#run].fontOptions then
run[#run+1] = { slice = {}, chunk = "", fontOptions = items[i].fontOptions }
if i <#items then
run[#run].fontOptions = items[i].fontOptions
end
end
run[#run].chunk = run[#run].chunk .. items[i].text
run[#run].slice[#(run[#run].slice)+1] = items[i]
end
local nodes = {}
for i=1, #run do
options = run[i].fontOptions
SU.debug("fonts", "Shaping ".. run[i].chunk.. " in ".. options.family)
for node in nodeMaker(options):iterator(run[i].slice, run[i].chunk) do
nodes[#nodes+1] = node
end
end
SU.debug("fonts", nodes)
return nodes
end
})
SILE.shaper = SILE.shapers.harfbuzzWithFallback()
return { documentation = [[\begin{document}
What happens when SILE is asked to typeset a character which is not in the
current font? For instance, we are currently using the “Gentium” font, which
covers a wide range of European scripts; however, it doesn’t contain any
Japanese character. So what if I ask SILE to typeset \code{abc
\font[family=Noto Sans CJK JP]{あ}}?
Many applications will find another font on the system containing the
appropriate character and use that font instead. But which font should
be chosen? SILE is designed for typesetting situations where the document
or class author wants complete control over the typographic appearance
of the output, so it’s not appropriate for it to make a guess—besides,
you asked for Gentium. So where the glyph is not defined, SILE will give
you the current font’s “glyph not defined” symbol (a glyph called \code{.notdef})
instead.
But there are times when this is just too strict. If you’re typesetting
a document in English and Japanese, you should be able to choose your
English font and choose your Japanese font, and if the glyph isn’t available
in one, SILE should try the other. The \code{font-fallback} package gives you
a way to specify a list of font specifications, and it will try each one in
turn if glyphs cannot be found.
It provides two commands, \command{\\font:add-fallback} and
\command{\\font:clear-fallbacks}. The parameters to \command{\\font:add-fallback}
are the same as the parameters to \command{\\font}. So this code:
\begin{verbatim}
\line
\\font:add-fallback[family=Symbola]
\\font:add-fallback[family=Noto Sans CJK JP]
\line
\end{verbatim}
will add two fonts to try if characters are not found in the current font.
Now we can say:
\font:add-fallback[family=Symbola]
\font:add-fallback[family=Noto Sans CJK JP]
\begin{verbatim}
あば x 😼 Hello world. あ
\end{verbatim}
and SILE will produce:
\examplefont{あば x 😼 Hello world. あ}
\font:remove-fallback
\font:remove-fallback
\command{\\font:clear-fallbacks} removes all font fallbacks from the list
of fonts to try.
\command{\\font:remove-fallback} removes the last added fallback from the
list of fonts to try.
\end{document} ]]}
|
return {
title = 'Asterix e Obelix',
waves = {
{{'druid', 5}, {'priest', 8}},
{{'druid', 10}, {'priest', 12}},
{{'druid', 15}, {'priest', 20}},
},
landscape ={
{{type = 'rock', num = 5}, {type = 'tree', num = 5}},
},
gold = 10000
}
|
#!/usr/bin/lua
--[[--------------------------------------------------------------------------
-- Licensed to Qualys, Inc. (QUALYS) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- QUALYS licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--]]--------------------------------------------------------------------------
--
-- IronBee Waggle --- Signature Database
--
-- Organizes Lua representations of rules.
--
-- @author Sam Baskinger <sbaskinger@qualys.com>
local Util = require('ironbee/waggle/util')
local Rule = require('ironbee/waggle/rule')
local ActionRule = require('ironbee/waggle/actionrule')
local StreamInspect = require('ironbee/waggle/streaminspect')
local Predicate = require('ironbee/waggle/predicaterule')
local RuleExt = require('ironbee/waggle/ruleext')
-- ###########################################################################
-- SignatureDatabase
-- ###########################################################################
--
SignatureDatabase = {}
SignatureDatabase.__index = SignatureDatabase
SignatureDatabase.type = "signaturedatabase"
SignatureDatabase.clear = function(self)
self.db = {}
self.tag_db = {}
end
SignatureDatabase.Rule = function(self, rule_id, rule_version)
if self.db[rule_id] ~= nil then
error(
{
sig_id = rule_id,
sig_rev = rule_version,
msg = string.format("Cannot redefine signature/rule %s:%s.", rule_id, rule_version)
}, 1)
end
local sig = Rule:new(rule_id, rule_version, self)
self.db[rule_id] = sig
return sig
end
SignatureDatabase.StrRule = function(self, rule_id, rule_version)
if self.db[rule_id] ~= nil then
error(
{
sig_id = rule_id,
sig_rev = rule_version,
msg = string.format("Cannot redefine streaming signature/rule %s:%s.", rule_id, rule_version)
}, 1)
end
local sig = StreamInspect:new(rule_id, rule_version, self)
self.db[rule_id] = sig
return sig
end
SignatureDatabase.RuleExt = function(self, rule_id, rule_version)
if self.db[rule_id] ~= nil then
error(
{
sig_id = rule_id,
sig_rev = rule_version,
msg = string.format("Cannot redefine ext signature/rule %s:%s.", rule_id, rule_version)
}, 1)
end
local sig = RuleExt:new(rule_id, rule_version, self)
self.db[rule_id] = sig
return sig
end
SignatureDatabase.Action = function(self, rule_id, rule_version)
if self.db[rule_id] ~= nil then
error(
{
sig_id = rule_id,
sig_rev = rule_version,
msg = string.format("Cannot redefine ext signature/rule %s:%s.", rule_id, rule_version)
}, 1)
end
local sig = ActionRule:new(rule_id, rule_version, self)
self.db[rule_id] = sig
return sig
end
SignatureDatabase.Predicate = function(self, rule_id, rule_version)
if self.db[rule_id] ~= nil then
error(
{
sig_id = rule_id,
sig_rev = rule_version,
msg = string.format("Cannot redefine predicate signature/rule %s:%s.", rule_id, rule_version)
}, 1)
end
local sig = Predicate:new(rule_id, rule_version, self)
self.db[rule_id] = sig
return sig
end
SignatureDatabase.new = function(self)
return setmetatable({
-- Table of rules indexed by ID.
db = {},
-- Table of rules indexed by the tags they have.
tag_db = {}
}, self)
end
SignatureDatabase.sigs_by_tag = function(self, tag)
local sigs = self.tag_db[tag]
if sigs == nil then
sigs = {}
end
return sigs
end
SignatureDatabase.tag = function(self, rule, tag)
if self.tag_db[tag] == nil then
self.tag_db[tag] = {}
end
self.tag_db[tag][rule.data.id] = rule
end
SignatureDatabase.untag = function(self, rule, tag)
self.tag_db[tag][rule.data.id] = nil
end
-- Returns an iterator function to iterate over each tag.
SignatureDatabase.all_tags = function(self)
return pairs(self.tag_db)
end
-- Returns an iterator function to iterate over each id.
SignatureDatabase.all_ids = function(self)
return pairs(self.db)
end
return SignatureDatabase
|
--[[
TheNexusAvenger
Implementation of a command.
--]]
local BaseCommand = require(script.Parent.Parent:WaitForChild("BaseCommand"))
local Command = BaseCommand:Extend()
--[[
Creates the command.
--]]
function Command:__new()
self:InitializeSuper("cmdbar","Administrative","Brings up the command line. Alternative to pressing \\.")
self.Prefix = {"!",self.API.Configuration.CommandPrefix}
end
return Command
|
local AnimationConfig = require(script.Parent.AnimationConfig)
local function expo(t: number)
return t ^ 2
end
return function()
describe("AnimationConfig", function()
it("can merge configs", function()
local config = AnimationConfig:mergeConfig({
tension = 0,
friction = 0,
})
expect(config.tension).to.equal(0)
expect(config.friction).to.equal(0)
config = AnimationConfig:mergeConfig({
frequency = 2,
damping = 0,
})
expect(config.frequency).to.equal(2)
expect(config.damping).to.equal(0)
config = AnimationConfig:mergeConfig({
duration = 2000,
easing = expo,
})
expect(config.duration).to.equal(2000)
expect(config.easing).to.equal(expo)
end)
describe("frequency/damping props", function()
it("should property convert to tension/friction", function()
local config = AnimationConfig:mergeConfig({ frequency = 0.5, damping = 1 })
expect(config.tension).to.equal(157.91367041742973)
expect(config.friction).to.equal(25.132741228718345)
end)
it("should work with extreme but valid values", function()
local config = AnimationConfig:mergeConfig({ frequency = 2.6, damping = 0.1 })
expect(config.tension).to.equal(5.840002604194885)
expect(config.friction).to.equal(0.483321946706122)
end)
it("should prevent a damping ratio less than 0", function()
local validConfig = AnimationConfig:mergeConfig({ frequency = 0.5, damping = 0 })
local invalidConfig = AnimationConfig:mergeConfig({ frequency = 0.5, damping = -1 })
expect(invalidConfig.frequency).to.equal(validConfig.frequency)
expect(invalidConfig.damping).to.equal(validConfig.damping)
end)
it("should prevent a frequency response less than 0.01", function()
local validConfig = AnimationConfig:mergeConfig({ frequency = 0.01, damping = 1 })
local invalidConfig = AnimationConfig:mergeConfig({ frequency = 0, damping = 1 })
expect(invalidConfig.frequency).to.equal(validConfig.frequency)
expect(invalidConfig.damping).to.equal(validConfig.damping)
end)
end)
end)
end
|
local LSM = LibStub('LibSharedMedia-3.0')
LSM:Register('statusbar', 'Asphyxia', [[Interface\AddOns\EuiScript\textures\StatusBars\Asphyxia]])
LSM:Register('statusbar', 'Bezo', [[Interface\AddOns\EuiScript\textures\StatusBars\Bezo]])
LSM:Register('statusbar', 'Dajova', [[Interface\AddOns\EuiScript\textures\StatusBars\Dajova]])
LSM:Register('statusbar', 'Duffed', [[Interface\AddOns\EuiScript\textures\StatusBars\Duffed]])
LSM:Register('statusbar', 'Flatt', [[Interface\AddOns\EuiScript\textures\StatusBars\Flatt]])
LSM:Register('statusbar', 'Sinaris', [[Interface\AddOns\EuiScript\textures\StatusBars\Sinaris]])
LSM:Register('statusbar', 'Slate', [[Interface\AddOns\EuiScript\textures\StatusBars\Slate]])
LSM:Register('statusbar', 'Smooth', [[Interface\AddOns\EuiScript\textures\StatusBars\Smooth]])
LSM:Register('statusbar', 'Tukui', [[Interface\AddOns\EuiScript\textures\StatusBars\Tukui]])
LSM:Register('statusbar', 'XPerl_1', [[Interface\AddOns\EuiScript\textures\StatusBars\XPerl_StatusBar]])
LSM:Register('statusbar', 'XPerl_2', [[Interface\AddOns\EuiScript\textures\StatusBars\XPerl_StatusBar2]])
LSM:Register('statusbar', 'XPerl_3', [[Interface\AddOns\EuiScript\textures\StatusBars\XPerl_StatusBar3]])
LSM:Register('statusbar', 'XPerl_4', [[Interface\AddOns\EuiScript\textures\StatusBars\XPerl_StatusBar4]])
LSM:Register('statusbar', 'XPerl_5', [[Interface\AddOns\EuiScript\textures\StatusBars\XPerl_StatusBar5]])
LSM:Register('statusbar', 'XPerl_6', [[Interface\AddOns\EuiScript\textures\StatusBars\XPerl_StatusBar6]])
LSM:Register('statusbar', 'XPerl_7', [[Interface\AddOns\EuiScript\textures\StatusBars\XPerl_StatusBar7]])
LSM:Register('statusbar', 'XPerl_8', [[Interface\AddOns\EuiScript\textures\StatusBars\XPerl_StatusBar8]])
LSM:Register('statusbar', 'XPerl_9', [[Interface\AddOns\EuiScript\textures\StatusBars\XPerl_StatusBar9]])
LSM:Register('statusbar', 'XPerl_10', [[Interface\AddOns\EuiScript\textures\StatusBars\XPerl_StatusBar10]])
LSM:Register('statusbar', 'Aluminium Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Aluminium]])
LSM:Register('statusbar', 'Asphyxia Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Asphyxia]])
LSM:Register('statusbar', 'BantoBar Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\BantoBar]])
LSM:Register('statusbar', 'Button Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Button]])
LSM:Register('statusbar', 'Cloud Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Cloud]])
LSM:Register('statusbar', 'Comet Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Comet]])
LSM:Register('statusbar', 'Dabs Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Dabs]])
LSM:Register('statusbar', 'ElvUI Gloss Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\ElvUI]])
LSM:Register('statusbar', 'Falumn Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Falumn]])
LSM:Register('statusbar', 'Flat Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Flat]])
LSM:Register('statusbar', 'Frost Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Frost]])
LSM:Register('statusbar', 'Glamour Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Glamour]])
LSM:Register('statusbar', 'Glamour2 Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Glamour2]])
LSM:Register('statusbar', 'Glamour3 Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Glamour3]])
LSM:Register('statusbar', 'Glamour4 Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Glamour4]])
LSM:Register('statusbar', 'Glamour5 Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Glamour5]])
LSM:Register('statusbar', 'Glamour6 Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Glamour6]])
LSM:Register('statusbar', 'Glamour7 Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Glamour7]])
LSM:Register('statusbar', 'Glaze Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Glaze]])
LSM:Register('statusbar', 'Glaze2 Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Glaze2]])
LSM:Register('statusbar', 'Gloss Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Gloss]])
LSM:Register('statusbar', 'Healbot Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Healbot]])
LSM:Register('statusbar', 'LiteStep Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\LiteStep]])
LSM:Register('statusbar', 'Lyfe Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Lyfe]])
LSM:Register('statusbar', 'Minimalist Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Minimalist]])
LSM:Register('statusbar', 'Otravi Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Otravi]])
LSM:Register('statusbar', 'Outline Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Outline]])
LSM:Register('statusbar', 'Perl Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Perl]])
LSM:Register('statusbar', 'Rocks Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Rocks]])
LSM:Register('statusbar', 'Round Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Round]])
LSM:Register('statusbar', 'Ruben Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Ruben]])
LSM:Register('statusbar', 'Runes Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Runes]])
LSM:Register('statusbar', 'Sinaris Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Sinaris]])
LSM:Register('statusbar', 'Slate Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Slate]])
LSM:Register('statusbar', 'Smooth Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Smooth]])
LSM:Register('statusbar', 'Tukui Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Tukui]])
LSM:Register('statusbar', 'Water Vertical', [[Interface\AddOns\EuiScript\textures\StatusBars\Vertical\Water]])
|
object_tangible_furniture_all_frn_all_fan_faire_11_painting_01 = object_tangible_furniture_all_shared_frn_all_fan_faire_11_painting_01:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_all_frn_all_fan_faire_11_painting_01, "object/tangible/furniture/all/frn_all_fan_faire_11_painting_01.iff")
|
function SWEP:ThrowBaby( mdl )
if CLIENT then return end -- If we are the client this is as much as we want to do
for i = 1, 3 do
local ent = ents.Create( "prop_physics" ) -- Create a prop_physics entity
if not IsValid( ent ) then return end -- Always make sure that created entities are actually created
ent:SetModel( mdl ) -- Set the entity's model to the passed model
ent:SetPos( self.Owner:EyePos() + ( self.Owner:GetAimVector() * 32 ) + ( i * 4 ) ) -- Set pos to player's eye position + i * 4 units forward
ent:SetAngles( self.Owner:EyeAngles() ) -- Set angles to player's eye angles
ent:Spawn() -- Then spawn it
local phys = ent:GetPhysicsObject()
phys:ApplyForceCenter( self.Owner:GetAimVector() * 100000 ) -- Now we apply the force
cleanup.Add( self.Owner, "props", ent ) -- Assuming it is sandbox, adding this to cleanup and undo lists
undo.Create( "Thrown_Baby" )
undo.AddEntity( ent )
undo.SetPlayer( self.Owner )
undo.Finish()
end
end
|
gMyTicks = 0
gFPS_NextCalc = 0
gFPS_Counter = 0
gFPS = 0
-- called from main.lua
function UpdateFPS ()
-- calc fps
gFPS_Counter = gFPS_Counter + 1
if (gFPS_NextCalc < gMyTicks) then
DisplayFPS(gFPS_Counter)
gFPS_NextCalc = gMyTicks + 1000
gFPS_Counter = 0
gFPS = gFPS_Counter
-- also update memory usage
--DisplayMemoryUsage(OgreMemoryUsage("all"))
end
end
function UpdateStatsFormatHelper(x)
x = x or 0
if x > 1024*1024 then
return math.floor(x/1024/1024).."mb"
elseif x > 1024 then
return math.floor(x/1024).."kb"
else
return x.."b"
end
end
gStats_NextUpdate = 0
-- called from main.lua
function UpdateStats ()
if (gHideFPS) then return end
if (gNoOgre) then return end
if (gMyTicks > gStats_NextUpdate) then
gStats_NextUpdate = gMyTicks + 1000
--local text = sprintf("%5.1f fps",OgreLastFPS())
local text = sprintf("%5.1f fps %5d b %10d t %s ogre %s lua",OgreAvgFPS(),OgreBatchCount(),OgreTriangleCount(),UpdateStatsFormatHelper(OgreMemoryUsage("all")), UpdateStatsFormatHelper((collectgarbage("count") or 0) * 1024))
if (gTestNoBatchListWidget) then
print(text)
else
if (not gStatsField) then
local vw,vh = GetViewportSize()
local w,h = 0,12
local x,y = vw-w,0
local col_back = {0,0,0,0}
local col_text = {1,0,0,1}
gStatsField = guimaker.MyCreateDialog()
gStatsField.panel = guimaker.MakeBorderPanel(gStatsField,x,y,w,h,col_back)
gStatsField.text = guimaker.MakeText(gStatsField.panel,0,0,text,16,col_text)
else
gStatsField.text.gfx:SetText(text)
end
local tw,th = gStatsField.text.gfx:GetTextBounds()
local vw,vh = GetViewportSize()
gStatsField.text.gfx:SetPos(-tw-20,vh-48)
end
end
end
-- stepper is destroyed if it returns something that evaluetes to true
-- can savely be called registered during iteration
function RegisterStepper (fun,param) RegisterListener("LugreStep",function () return fun(param) end) end
-- interval : in milliseconds, e.g. 1000 means fun will be called once every second
function RegisterIntervalStepper (interval,fun,param)
assert(fun)
local nextt = Client_GetTicks() + interval
RegisterListener("LugreStep",function ()
local t = Client_GetTicks()
if (t < nextt) then return end
nextt = t + interval
return fun(param)
end)
end
-- calls the function fun after timout ms
function InvokeLater (timeout, fun)
RegisterStepper(function(calltime) if (gMyTicks >= calltime) then fun() return true end end,gMyTicks + timeout)
end
|
-- Copyright (c) Facebook, Inc. and its affiliates.
PLUGIN = nil
function Initialize(Plugin)
Plugin:SetName("chatlog")
Plugin:SetVersion(1)
PLUGIN = Plugin
cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat)
LOG("Loaded plugin: chatlog")
return true
end
function OnChat(player, chat)
LOG("[chatlog] " .. player:GetName() .. ": " .. chat)
end
|
local Brain = require('game.bt.Brain')
local AttackTarget = require('game.actions.AttackTarget')
local PatrolTo = require('game.actions.PatrolTo')
local strClassName = 'game.brains.monster_undeath_2'
local monster_undeath_2 = lua_declare(strClassName, lua_class(strClassName, Brain))
function monster_undeath_2:ctor(owner)
Brain.ctor(self, owner, 'monster_undeath_2')
end
function monster_undeath_2:OnStart()
self.bt = BehaviourTree(self,
SelectorNode(
{
IfElseNode(
function()
return math.random()<0.4
end,
SequenceNode(
{
AttackTarget("Attack2"),
WaitNode(2),
}),
IfElseNode(
function()
return math.random()<0.7
end,
PatrolTo(1.6),
WaitNode(2)
)
),
})
)
end
return monster_undeath_2
|
-- MIT License
--
-- Copyright (c) 2020 moo-sama
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
local ucoroutine = { }
local PATH = (...):gsub("%.", "/")
local err_msg
local err_traceback
local debug_traceback = debug.traceback
function debug.traceback(msg, level)
if err_traceback then
local tcb = debug_traceback(msg or "", (level or 0) + 3)
local full_msg = tcb:sub(1, tcb:find("stack traceback") - 1)
local _, i = tcb:find(PATH .. "[^\n]*'do_ucoroutine_error'")
if i then
tcb = tcb:sub(i + 2)
tcb = tcb:sub(tcb:find("\n") + 1)
tcb = "stack traceback:\n" .. err_traceback .. "\n" .. tcb
return full_msg .. tcb
else
err_msg, err_traceback = nil, nil
end
end
return debug_traceback(msg or "", level)
end
local function do_ucoroutine_error(...)
error(..., 3)
end
local function coalesce(success, ...)
if not success then
do_ucoroutine_error(err_msg)
end
return ...
end
function ucoroutine.resume(cr, ...)
return coalesce(coroutine.resume(cr, ...))
end
function ucoroutine.traceback(level)
level = (level or 1) + 2
if err_traceback then level = level + 3 end
local tcb = debug_traceback("", level)
tcb = tcb:sub(select(2, tcb:find("stack traceback[^\n]\n")) + 1)
tcb = tcb:sub(1, tcb:find("[^\n]*\n[^\n]*$") - 2)
local i = tcb:find("function[^\n]*$")
tcb = tcb:sub(1, i - 1) .. "coroutine" .. tcb:sub(i + 8)
return tcb
end
function ucoroutine.errorevent(msg)
end
local function errhand(msg)
if not err_msg then
err_msg = msg:sub(select(2, msg:find(":")) + 4)
end
local tcb = ucoroutine.traceback()
if err_traceback then err_traceback = err_traceback .. "\n" .. tcb
else
err_traceback = tcb
ucoroutine.errorevent(msg)
end
end
local function safe_wrap(f)
return function(...)
return coalesce(xpcall(f, errhand, ...))
end
end
function ucoroutine.create(f)
return coroutine.create(safe_wrap(f))
end
function ucoroutine.wrap(f)
local cr = ucoroutine.create(f)
return function(...)
return ucoroutine.resume(cr, ...)
end
end
return ucoroutine
|
local Class = require("class")
local Conv = require("conv")
local Native = require("saori_universal.native")
local Module = require("ukagaka_module.saori")
local Process = require("process")
local Protocol = Module.Protocol
local Response = Module.Response
local M = Class()
M.__index = M
function M:_init(path, sender)
self._path = path
self._sender = sender
end
function M:load()
return true
end
function M:request(...)
local process = Process({
command = self.path,
chdir = true,
})
local tbl = {...}
for i, v in ipairs(tbl) do
tbl[i] = Conv.conv(v, "cp932", "UTF-8") or v
end
process:spawn(table.unpack(tbl))
local ret = process:readline(true)
process:despawn()
if ret and #ret > 0 then
local res = Response(200, "OK", Protocol.v10, {
Charset = "UTF-8",
})
res:header("Result", Conv.conv(ret, "UTF-8", "cp932") or ret)
return res
else
return Response(204, "No Content", Protocol.v10, {
})
end
end
function M:unload()
return true
end
return M
|
--[[
Title: UMaul
Author: noriah <code@noriah.dev>
UMaul Library Functions
]]
--[[
Function: UMaul.playerAuthed
Called when a player is authenticated by GMod
This will be called after ULib runs its stuff, so we wont run into any errors (hopefully)
Unless the player disconnects between then and now
Parameters:
ply - [Player] The player that we are authenticating
uId - [String] The unique ID of the player. We dont grab this from the ply object because it is expensive
]]
function UMaul.playerAuth(ply, uId)
if ply and ply:IsValid() then
-- If the player is valid, ask sql to get the data
-- Once sql has the data, it will queue a functon that will
-- take care of the rest of the process
-- We queue this so it wont hold up the main thread
ULib.queueFunctionCall(UMaul.sql.queryUserData, ply, uId)
end
-- If the player does not exist or is not valid, do noting
end
--[[
Function: UMaul.disable
Should only be called when a Fatal error has occured in UMAUL
Like if the config file is not filled in, or it is corrupt.
Or if MySQL comes back with an error.
Parameters:
reason - [String] The reason for disabling
]]
function UMaul.disable(reason)
Msg("[UMAUL] Disabling UMAUL -> [" .. reason .. "]\n")
hook.Remove(UMaul.HOOKGMAUTH)
hook.Remove(UMaul.HOOKGMDISCONNECT)
hook.Remove(UMaul.HOOKUMLSAC)
end
--[[
Section: Player Management
UMaul Functions for managing players.
]]
--Create the UMaul.pm table
UMaul.pm = {}
-- Create a local pm for easy definitons
local pm = UMaul.pm
--[[
Function: pm.setUserGroup
Starts the registration process. Gets the required info that sql didn't have.
Parameters:
ply - [Player] The player we are adding to a group
uId - [String] The unique ID of the player. We dont grab this from the ply object because it is expensive
group_name - [String] The group we are adding the player to.
]]
function pm.setUserGroup(ply, uId, group_name)
-- Incase we already have a player in the users file, registered by ip
local ip = ULib.splitPort( ply:IPAddress() )
local id = nil
-- Search for the player that has already been registered by ULib
-- We are going to re-register them
for _, index in ipairs({uId, ip, ply:SteamID()}) do
if ULib.ucl.authed[ index ] then
id = index
break
end
end
if not id then id = ply:SteamID() end
local userInfo = ULib.ucl.authed[id] or {allow = {}, deny = {}}
-- Add the user to the group
pm.registerUser(id, group_name, userInfo.allow, userInfo.deny)
end
--[[
Function: pm.registerUser
Sets a user to their correct group.
Parameters:
id - [Player] The id of the player related to the Ulib.pm.authed table
group - [String] The name of the group to add the player to
allows - [Table] *(Optional)* A list of allowed commands. Follow ulx and ulib access tags and commands
denies - [Table] *(Optional)* A list of denied commands. Follow ulx and ulib access tags and commands
]]
function pm.registerUser(id, group, allows, denies)
id = id:upper() -- In case of steamid, needs to be upper case
-- Handle nil values
allows = allows or {}
denies = denies or {}
-- If the user has no speical permissions, copy the default permissions
if allows == ULib.DEFAULT_GRANT_ACCESS.allow then allows = table.Copy(allows) end -- Otherwise we'd be changing all guest access
if denies == ULib.DEFAULT_GRANT_ACCESS.deny then denies = table.Copy(denies) end -- Otherwise we'd be changing all guest access
-- Make sure we have a group to add the user to
if group and not ULib.ucl.groups[group] then return error("Group does not exist for adding user to (" .. group .. ")", 2) end
-- Lower case'ify
for k, v in ipairs(allows) do allows[k] = v:lower() end
for k, v in ipairs(denies) do denies[k] = v:lower() end
-- If we already have a name set, use it
local name
if ULib.ucl.users[id] and ULib.ucl.users[id].name then name = ULib.ucl.users[id].name end
-- Get the player
local ply = ULib.getPlyByID(id)
-- If we don't already have the user in the save file, don't add them.
if ULib.ucl.users[id] and not ULib.ucl.users[id].group == group then
-- Set the user data in the users table, so it will be saved.
-- This is only if the user has extra permissions in addition to their group
-- Or if the user was already in the users file
ULib.ucl.users[id] = {allow=allows, deny=denies, group=group, name=name}
-- Probe ULib ucl to update the authed data correctly
ULib.ucl.probe(ply)
else
-- Set the users authenticated data
ULib.ucl.authed[id] = {allow=allows, deny=denies, group=group, name=name}
-- Set the users group for ulx and other purposes
ply:SetUserGroup(group, true)
-- Set the players name so addons get it right
ULib.ucl.authed[id].name = ply:Nick()
-- Tell the rest of the world we have updated a player
-- This tells ulx to update as well as any plugins using the UCLChanged and UCLAuthed hooks
hook.Call(ULib.HOOK_UCLCHANGED)
hook.Call(ULib.HOOK_UCLAUTH, _, ply)
end
hook.Call(UMaul.HOOK_AUTHED, _, ply)
end
--[[
Section: User List
This section defines the user list. A seperate list from ULib/ULX that holds
a players SteamID, Forum Name(If they are regiserted), and Rank(if they have one)
]]
UMaul.users = {}
local users = UMaul.users
users.list = {}
--[[
Function: users.insertPlayer
Add a player to the UMaul Users list.
Parameters:
ply - [Player] The player we are adding to the list
forumname - [String]*(Optional)* The forum name of the player. Can be nil
ply_rank - [String] *(Optional)* The rank of the player. Can be nil
]]
function users.insertPlayer(ply, forumname, ply_rank)
local fname = forumname or ""
local prank = ply_rank or "None"
users.list[ply:UserID()] = {steamid=ply:SteamID(), forum_name=fname, rank=prank}
hook.Call(UMaul.HOOK_USERS_CHANGED)
end
--[[
Function: users.removePlayer
Removes a player from the UMaul Users list.
Parameters:
ply - [Player] The player we are removing from the list
]]
function users.removePlayer(ply)
users.list[ply:UserID()] = nil
hook.Call(UMaul.HOOK_USERS_CHANGED)
end
--[[
Function: users.getAllPlayers
Returns the UMaul Users list
DO NOT JUST REFERENCE UMaul.users.list UNLESS YOU PLAN TO MODIFY IT!
Parameters:
ply - [Player] The player we are removing from the list
Returns:
The UMaul users list
]]
function users.getAllPlayers()
--table.sort(users.list)
return table.Copy(users.list)
end
--[[
Function: users.getForumName
Returns the forum name of the player
DO NOT JUST REFERENCE UMaul.users.list UNLESS YOU PLAN TO MODIFY IT!
Parameters:
ply - [Player] The player we are removing from the list
Returns:
The UMaul users list
]]
function users.getForumName(ply)
local id = ply:UserID()
if users.list[id] and users.list[id].forum_name then return users.list[id] else return "" end
end
--[[
Section: Hook Handlers
These are ids for the ULib umsg functions, so the client knows what they're getting.
]]
-- Callend when a player is Authorized by GMod
-- Runs after ULib, so there should be no errors
local function gmPlayerAuthed(ply, steamId, uId)
UMaul.playerAuth(ply, uId)
end
hook.Add("PlayerAuthed", UMaul.HOOKGMAUTH, gmPlayerAuthed, 20) -- Run last
-- Called when a player Disconnects from the Server
local function gmPlayerDisconnected(ply)
users.removePlayer(ply)
end
hook.Add("PlayerDisconnected", UMaul.HOOKGMDISCONNECT, gmPlayerDisconnected, 20) -- Run last
-- Called when a player is authorized by UMaul.
local function sendUMaulAuthed(ply, rank)
ULib.clientRPC(ply, "hook.Call", UMaul.HOOK_AUTHED, _, rank ) -- Call hook on client. Tell them their rank
end
hook.Add(UMaul.HOOK_AUTHED, UMaul.HOOKUMLSAC, sendUMaulAuthed, -20)
|
common_io_validation.validate_instance_numbers("iot_flash")
|
--[[
TheNexusAvenger
Class representing 2 UDim points for a side
of a rectangle. 4 are used by the RectPoint8
class for the CutFrame.
The first point is the distance from the start
and the second point is the distance from the
end.
This class is immutable.
--]]
local RootModule = script.Parent.Parent
local NexusInstance = require(RootModule:WaitForChild("NexusInstance"):WaitForChild("NexusInstance"))
local RectSide = NexusInstance:Extend()
RectSide:SetClassName("RectSide")
--[[
Checks if a type matches and throws and error if
it doesn't match.
--]]
local function ValidateParameter(Name,Parameter,Type)
local ParameterType = typeof(Parameter)
local HasIsA = false
--Replace the type if it is a table and has a ClassName.
if ParameterType == "table" and Parameter.IsA then
HasIsA = true
ParameterType = Parameter.ClassName
end
--Throw the error.
if (ParameterType ~= Type) or (HasIsA and not Parameter:IsA(Type)) then
error(tostring(Name).." must be a "..tostring(Type)..", got \""..tostring(Parameter).."\" (a "..tostring(ParameterType).." value)")
end
end
--[[
Constructor of the RectSide class.
--]]
function RectSide:__new(Point1,Point2)
--Throw an error if the points are invalid.
ValidateParameter("Point1",Point1,"UDim")
ValidateParameter("Point2",Point2,"UDim")
--Initialize the super class.
self:InitializeSuper()
--Store and lock the points.
self.Point1 = Point1
self.Point2 = Point2
self:LockProperty("Point1")
self:LockProperty("Point2")
end
--[[
Returns a new RectSide with 1 point replaced.
--]]
function RectSide:ReplacePoint(PointName,Point)
if PointName == "Point1" then
return RectSide.new(Point,self.Point2)
else
return RectSide.new(self.Point1,Point)
end
end
--[[
Returns the points in order of how they appear.
--]]
function RectSide:GetOrderedPoints(SideLength)
--Throw an error if the side length is invalid.
ValidateParameter("SideLength",SideLength,"number")
--Get the points and positions along the line.
local Point1,Point2 = self.Point1,self.Point2
local Pos1 = (SideLength * Point1.Scale) + Point1.Offset
local Pos2 = SideLength - ((SideLength * Point2.Scale) + Point2.Offset)
--Return the ordered points.
if Pos1 < Pos2 then
return Point1,Point2
else
return Point2,Point1
end
end
return RectSide
|
function onCreatePost()
setProperty('dad.alpha', 0.7)
setBlendMode('dad','add');
end
|
function onAddItem(moveitem, tileitem, position)
-- has to be a candle
if moveitem.itemid ~= 2048 then
return true
end
moveitem:remove()
tileitem:transform(6280)
position:sendMagicEffect(CONST_ME_MAGIC_RED)
return true
end
|
local playsession = {
{"Gerkiz", {60578}},
{"BluJester", {28669}},
{"Muckknuckle", {129821}},
{"rileythelol", {44414}},
{"moonlight1986", {7738}},
{"EPO666", {46801}},
{"PogomanD", {2653}},
{"JailsonBR", {5404}},
{"MaFiX", {6934}},
{"Discotek", {5853}},
{"nakedzeldas", {1845}},
{"DeadKid", {36514}},
{"redlabel", {30800}},
{"Sharuh", {2130}}
}
return playsession
|
local API_SE = require(script:GetCustomProperty("APIStatusEffects"))
local ICON = script:GetCustomProperty("EffectIcon")
local EFFECT_TEMPLATE = script:GetCustomProperty("EffectTemplate")
local data = {}
data.name = "Blind"
data.duration = 5.0
data.icon = ICON
data.color = Color.BLACK
data.effectTemplate = EFFECT_TEMPLATE
data.type = API_SE.STATUS_EFFECT_TYPE_BLIND
data.tickFunction = nil
data.multiplier = 1.5
API_SE.DefineStatusEffect(data)
|
// pMuch edit this is a 1 line remover but you can also do other shit with it
--function gui.IsGameUIVisible() return false end // 1 line remove
// Another version of removing this shit.
function removecustomescapes()
gui.IsGameUIVisible() return false end
end
concommand.Add("escaperemove", function()
removecustomescapes()
end)
|
local module = {}
------------------------------------
-- 기본함수, 필요 모듈 가져오기
------------------------------------
local type = typeof or type
local clock = os.clock
local tonumber = tonumber
local script = script
local EasingFunctions = require(script and script.EasingFunctions or "EasingFunctions")
local Stepped = require(script and script.Stepped or "Stepped")
local BindedFunctions = {} -- 애니메이션을 위해 프레임에 연결된 함수들
module.PlayIndex = setmetatable({},{__mode = "k"}) -- 애니메이션 실행 스택 저장하기
-- PlayIndex[Item][Property] = 0 or nil <= 트윈중이지 않은 속성
-- PlayIndex[Item][Property] = 1... <= 트윈중인 속성
------------------------------------
-- Easing 스타일
------------------------------------
module.EasingFunctions = {
--// for Autocomplete
Linear = EasingFunctions.Linear; --// 직선
Circle = EasingFunctions.Circle; --// 사분원
Exp2 = EasingFunctions.Exp2; --// 덜 가파른 지수 그래프
Exp4 = EasingFunctions.Exp4; --// 더 가파른 지수 그래프
Exp2Max4 = EasingFunctions.Exp2Max4; --// 적당히 가파른 지수 그래프
}
for i,v in pairs(EasingFunctions) do
module.EasingFunctions[i] = v
end
module.EasingDirection = {
Out = "Out"; -- 반전된 방향
In = "In" ; -- 기본방향
}
------------------------------------
-- Lerp 함수
------------------------------------
-- 이중 선형, Alpha 를 받아서 값을 구해옴
function Lerp(start,goal,alpha)
return start + ((goal - start) * alpha)
end
-- 기본적으로 로블록스에 있는 클래스중, + - * / 과 같은 연산자 처리 메타 인덱스가 있는것들
local DefaultItems = {
["Vector2"] = true;
["Vector3"] = true;
["CFrame" ] = true;
["number" ] = true;
}
-- 예전 값,목표 값,알파를 주고 각각 해당하는 속성에 입력해줌
-- 기본적으로 모든 속성값 적용은 여기에서 이루워짐
function LerpProperties(Item,Old,New,Alpha)
for Property,OldValue in pairs(Old) do
local NewValue = New[Property]
if NewValue ~= nil then
local Type = type(OldValue)
if DefaultItems[Type] then
Item[Property] = Lerp(OldValue,NewValue,Alpha)
elseif Type == "UDim2" then
Item[Property] = UDim2.new(
Lerp(OldValue.X.Scale ,NewValue.X.Scale ,Alpha),
Lerp(OldValue.X.Offset,NewValue.X.Offset,Alpha),
Lerp(OldValue.Y.Scale ,NewValue.Y.Scale ,Alpha),
Lerp(OldValue.Y.Offset,NewValue.Y.Offset,Alpha)
)
elseif Type == "UDim" then
Item[Property] = UDim.new(
Lerp(OldValue.Scale ,NewValue.Scale ),
Lerp(OldValue.Offset,NewValue.Offset)
)
elseif Type == "Color3" then
Item[Property] = Color3.fromRGB(
Lerp(OldValue.r*255,NewValue.r*255),
Lerp(OldValue.g*255,NewValue.g*255),
Lerp(OldValue.b*255,NewValue.b*255)
)
end
end
end
end
------------------------------------
-- 모듈 함수 지정
------------------------------------
-- 트윈 메서드 지정, 트윈을 만들게 됨
-- Item : 트윈할 인스턴트
-- Data : 트윈 정보들 (태이블)
--Data.Time (in seconds, you can use 0.5 .. etc)
--Data.Easing (function)
--Data.Direction ("Out" , "In")
--Data.CallBack 콜백 함수들(태이블), 예시 :
--Data.CallBack[0.5] = function() end 다음과 같이 쓰면 인덱스가 정확히 0.5 가 되는 순간(시간이 아니라 이징 함수에 의해 나온 값이 같아지는 순간)
--해당 함수가 실행됨
--Properties : 트윈할 속성과 목표값 예시 :
--Data.Properties.Position = UDim2.new(1,0,1,0) 처럼 하면 Position 속성의 목표를 1,0,1,0 으로 지정
function module:RunTween(Item,Data,Properties,Ended)
-- 시간 저장
local Time = Data.Time or 1
local EndTime = clock() + Time
-- 플레이 인덱스 저장
local ThisPlayIndex = module.PlayIndex[Item] or {}
module.PlayIndex[Item] = ThisPlayIndex
-- 예전의 트윈을 덮어쓰고 현재 값을 저장함
local NowAnimationIndex = {}
local LastProperties = {}
for Property,_ in pairs(Properties) do
LastProperties[Property] = Item[Property]
ThisPlayIndex[Property] = ThisPlayIndex[Property] ~= nil and ThisPlayIndex[Property] + 1 or 1
NowAnimationIndex[Property] = ThisPlayIndex[Property]
end
-- 이징 효과 가져오기
local Direction = Data.Direction or "Out"
local Easing do
local Data_Easing = Data.Easing or EasingFunctions.Exp2
local Data_EasingType = type(Data_Easing)
Easing = (Data_EasingType == "function" and Data_Easing) or (Data_EasingType == "table" and Data_Easing.Run)
if Data_EasingType == "table" and Data_Easing.Reverse then
Direction = Direction == "Out" and "In" or "Out"
end
end
-- 중간중간 실행되는 함수 확인
local CallBack = Data.CallBack
if CallBack then
for FncIndex,Fnc in pairs(CallBack) do
if type(Fnc) ~= "function" or type(tonumber(FncIndex)) ~= "number" then
CallBack[FncIndex] = nil
end
end
end
-- 스탭핑
local Step
Step = function()
-- 아에 멈추게 되는 경우
if module.PlayIndex[Item] == nil then
table.remove(BindedFunctions,table.find(BindedFunctions,Step))
return
end
local Now = clock()
local Index = 1 - (EndTime - Now) / Time
-- 속성 Lerp 수행
if Direction == "Out" then
LerpProperties(
Item,
LastProperties,
Properties,
Easing(Index)
)
else
LerpProperties(
Item,
LastProperties,
Properties,
1 - Easing(1 - Index)
)
end
-- 다른 트윈이 속성을 바꾸고 있다면(이후 트윈이) 그 속성을 건들지 않도록 없엠
local StopByOther = true
for Property,Index in pairs(NowAnimationIndex) do
if Index ~= ThisPlayIndex[Property] then
LastProperties[Property] = nil
Properties[Property] = nil
NowAnimationIndex[Property] = nil
else
StopByOther = false
end
end
-- 만약 다른 트윈이 지금 트윈하고 있는 속성을 모두 먹은경우 현재 트윈을 삭제함
if StopByOther then
table.remove(BindedFunctions,table.find(BindedFunctions,Step))
return
end
-- 끝남
if Now >= EndTime then
for Property,_ in pairs(Properties) do
ThisPlayIndex[Property] = 0
end
local PlayIndexLen = 0
for _,_ in pairs(ThisPlayIndex) do
PlayIndexLen = PlayIndexLen + 1
end
if PlayIndexLen == 0 then
ThisPlayIndex = nil
end
table.remove(BindedFunctions,table.find(BindedFunctions,Step))
Index = 1
if Ended then
Ended()
end
end
-- 중간 중간 함수 배정된것 실행
if CallBack then
for FncIndex,Fnc in pairs(CallBack) do
if tonumber(FncIndex) <= Index then
Fnc()
CallBack[FncIndex] = nil
end
end
end
end
-- 스캐줄에 등록
table.insert(BindedFunctions,Step)
end
-- 여러개의 개체를 트윈시킴
function module:RunTweens(Items,Data,Properties,Ended)
local First = true
for _,Item in pairs(Items) do
module:RunTween(Item,Data,Properties,First and Ended)
First = false
end
end
-- 트윈 멈추기
function module:StopTween(Item)
module.PlayIndex[Item] = nil
end
-- 해당 개체가 트윈중인지 반환
function module:IsTweening(Item)
if module.PlayIndex[Item] == nil then
return false
end
for Property,Index in pairs(module.PlayIndex[Item]) do
if Index ~= 0 then
return true
end
end
return false
end
-- 해당 개체의 해당 프로퍼티가 트윈중인지 반환
function module:IsPropertyTweening(Item,PropertyName)
if module.PlayIndex[Item] == nil then
return false
end
if module.PlayIndex[Item][PropertyName] == nil then
return false
end
return module.PlayIndex[Item][PropertyName] ~= 0
end
------------------------------------
-- 프레임 연결
------------------------------------
-- 1 프레임마다 실행되도록 해야되는 함수
-- ./Stepped.lua 에서 연결점 편집 가능
-- roblox 는 이미 연결되어 있음
function module:Stepped()
for _,Function in pairs(BindedFunctions) do
Function()
end
end
Stepped:BindStep(module.Stepped)
return module
|
local _, C = unpack(select(2, ...))
local ACTIONBAR_FADER = {
fadeInAlpha = 1, -- Transparency when displayed
fadeInDuration = 0.3, -- Display time-consuming
fadeOutAlpha = 0, -- Transparency after fade
fadeOutDelay = 0.1, -- Delay fade
fadeOutDuration = 0.8, -- Fading time-consuming
}
C.ActionBars = {
margin = 2, -- Key spacing
padding = 2, -- Edge spacing
actionBar1 = { -- Main action bar (below)
size = 34,
fader = nil
},
actionBar2 = { -- Main action bar (top)
size = 34,
fader = nil
},
actionBar3 = { -- Both sides of the main action bar
size = 32,
fader = ACTIONBAR_FADER
},
actionBar4 = { -- Right action bar 1
size = 32,
fader = ACTIONBAR_FADER
},
actionBar5 = { -- Right action bar 2
size = 32,
fader = ACTIONBAR_FADER
},
actionBarCustom = { -- Custom action bar
size = 34,
fader = ACTIONBAR_FADER
},
extraBar = { -- Extra action bar
size = 52,
fader = nil
},
leaveVehicle = {
size = 32,
fader = nil
},
petBar = {
size = 26,
fader = ACTIONBAR_FADER
},
stanceBar = {
size = 30,
fader = ACTIONBAR_FADER
},
}
|
class("GetWBOtherBossCommand", pm.SimpleCommand).execute = function (slot0, slot1)
slot4 = {}
if slot1:getBody().type == WorldBoss.OTHER_BOSS_TYPE_FRIEND then
for slot10, slot11 in pairs(slot6) do
table.insert(slot4, slot11.id)
end
elseif slot3 == WorldBoss.OTHER_BOSS_TYPE_GUILD then
for slot10, slot11 in pairs(getProxy(GuildProxy).getRawData(slot5).member) do
table.insert(slot4, slot11.id)
end
end
if #slot4 == 0 then
return
end
pg.ConnectionMgr.GetInstance():Send(33503, {
user_id_list = slot4
}, 33504, function (slot0)
slot1 = {}
for slot5, slot6 in ipairs(slot0.boss_list) do
slot7 = WorldBoss.New()
slot7:Setup(slot6)
table.insert(slot1, slot7)
end
getProxy(WorldProxy):GetWorld().GetBossProxy(slot2).UpdateOtheroBosses(slot3, slot1)
slot0:sendNotification(GAME.WORLD_BOSS_GET_OTHER_BOSS_DONE)
end)
end
return class("GetWBOtherBossCommand", pm.SimpleCommand)
|
local function foo(a)
local b = a -- trace: a
end
local function bar(a)
foo(a)
end
local function baz(a)
bar(a)
end
baz(2)
bar(4)
|
return {
new = function(requires)
assert(type(requires) == "table", "Not a table!")
local system = {
requires = requires
}
function system:match(entity)
for i=1, #self.requires do
if not entity:get(self.requires[i]) then
return false
else
return true
end
end
end
function system:load(entity) end
function system:update(dt, entity) end
function system:draw(entity) end
function system:destroy(entity) end
return system
end
}
|
-----------------------------------------------------
--name : lib/crunch/22_space_wrapper.lua
--description: wraps the outputstream to automaticly add space characters when needed (assumes that single tokens are NOT split in multiple :write calls)
--author : mpmxyz
--github page: https://github.com/mpmxyz/ocprograms
--forum page : none
-----------------------------------------------------
--takes a stream and returns a wrapper function
--This function takes a string argument to be written and writes it to the stream.
--Appends a newline in front of the string if necessary for separation. (But only then!)
local function newWriter(stream)
local lastWritten
return function(text)
if text ~= "" then
--detect if space is necessary
if lastWritten ~= nil and text:find("^[%w_]") and lastWritten:find("[%w_]$") then
stream:write("\n"..text)
else
stream:write(text)
end
lastWritten = text
end
end
end
return {
run = function(context, options)
local originalStream = context.outputStream
local writer = newWriter(originalStream)
context.outputStream = {
parent = originalStream,
write = function(self, text)
writer(text)
end,
close = function(self)
return originalStream:close()
end,
}
end,
cleanup = function(context, options)
context.outputStream = context.outputStream.parent
end,
}
|
foundation_binary:require("tests/bit_test.lua")
foundation_binary:require("tests/bin_buf_test.lua")
foundation_binary:require("tests/byte_buf_test.lua")
foundation_binary:require("tests/byte_encoder_test.lua")
|
-- Some basic VRF Utilities defined in a common module.
require "vrfutil"
-- Global Variables
--
-- Global variables get saved when a scenario gets checkpointed in one of the folowing way:
-- 1) If the checkpoint mode is AllGlobals all global variables defined will be saved as part of the save stat
-- 2) In setting CheckpointStateOnly, this means that the script will *only* save variables that are part of the checkpointState table. If you remove this value, it will then
-- default to the behavior of sabing all globals
--
-- If you wish to change the mode, call setCheckpointMode(AllGlobals) to save all globals or setCheckpointMode(CheckpointStateOnly)
-- to save only those variables in the checkpointState table
-- They get re-initialized when a checkpointed scenario is loaded.
vrf:setCheckpointMode(CheckpointStateOnly)
checkpointState.subordinateTasks = {}
checkpointState.destinations = {}
-- Task Parameters Available in Script
-- taskParameters.Location Type: Location3D - Location around which the unit should circle
-- taskParameters.FacingDirection Type: Integer (0 - choice limit) - Direction in which to face once in position
-- taskParameters.Radius Type: Real Unit: meters - Distance at which entities should stand from the location
local FaceIn = 0
local FaceOut = 1
-- Called when the task first starts. Never called again.
function init()
local subordinates = this:getSubordinates(true)
-- Initialize list of current subordinate task ids to -1
for i, obj in pairs(subordinates) do
if (obj:isValid() and vrf:entityTypeMatches(obj:getEntityType(), EntityType.Lifeform())) then
table.insert(checkpointState.subordinateTasks,
{ entity=obj, taskId = -1 })
end
end
local numSubordinates = #checkpointState.subordinateTasks
if numSubordinates > 0 then
-- Determine the points at which the entities will stand
local TwoPi = 2 * math.pi
local headingDiff = TwoPi / numSubordinates
local nextHeading = math.random() * headingDiff
while #checkpointState.destinations < numSubordinates do
local vec = Vector3D(0,0,0)
vec:setBearingInclRange(nextHeading, 0, taskParameters.Radius)
table.insert(checkpointState.destinations, taskParameters.Location:addVector3D(vec))
nextHeading = nextHeading + headingDiff
if nextHeading > TwoPi then
nextHeading = nextHeading - TwoPi
end
end
end
-- Set the tick period for this script.
vrf:setTickPeriod(1.0)
end
-- Called each tick while this task is active.
function tick()
vrf:updateTaskVisualization("Center", "point",
{color={0,0,255,150},
location=taskParameters.Location,
size=1})
local numComplete = 0
local removedSubs = {}
for i, subordinateTask in pairs(checkpointState.subordinateTasks) do
if (not subordinateTask.entity:isValid()) then
-- Entity is gone
table.insert(removedSubs, i)
elseif (subordinateTask.entity:isDestroyed()) then
-- No more moving for this one
numComplete = numComplete + 1
elseif subordinateTask.taskId < 0 then
if #checkpointState.destinations == 0 then
printWarn(vrf:trUtf8("Error: No destinations remaining."))
vrf:endTask(false)
return
end
-- Move entity into location
local loc = table.remove(checkpointState.destinations)
subordinateTask.taskId = vrf:sendTask(subordinateTask.entity, "move-to-location",
{aiming_point = loc})
vrf:updateTaskVisualization("Destination" .. i, "point",
{color={0,255,0,150},
location=loc,
size=1})
elseif vrf:isTaskComplete(subordinateTask.taskId) then
-- Done moving. Face the right way.
local vecToFace = subordinateTask.entity:getLocation3D():vectorToLoc3D(taskParameters.Location)
if taskParameters.FacingDirection == FaceOut then
vecToFace = vecToFace:getScaled(-1)
end
vrf:sendTask(subordinateTask.entity, "turn-to-heading", {heading=vecToFace:getBearing()}, false)
numComplete = numComplete + 1
end
end
-- Get rid of any subordinates which have been removed
local remIdx = #removedSubs
while (remIdx > 0) do
table.remove(checkpointState.subordinateTasks, removedSubs[remIdx])
remIdx = remIdx - 1
end
-- If everyone's in place, end the task.
if numComplete >= #checkpointState.subordinateTasks then
if #checkpointState.subordinateTasks == 0 then
printWarn(vrf:trUtf8("No human subordinates to perform task."))
end
vrf:endTask(true)
end
end
-- Called when this task is being suspended, likely by a reaction activating.
function suspend()
-- By default, halt all subtasks and other entity tasks started by this task when suspending.
vrf:stopAllSubtasks()
vrf:stopAllTasks()
end
-- Called when this task is being resumed after being suspended.
function resume()
-- By default, simply call init() to start the task over.
init()
end
-- Called immediately before a scenario checkpoint is saved when
-- this task is active.
-- It is typically not necessary to add code to this function.
function saveState()
end
-- Called immediately after a scenario checkpoint is loaded in which
-- this task is active.
-- It is typically not necessary to add code to this function.
function loadState()
end
-- Called when this task is ending, for any reason.
-- It is typically not necessary to add code to this function.
function shutdown()
end
-- Called whenever the entity receives a text report message while
-- this task is active.
-- message is the message text string.
-- sender is the SimObject which sent the message.
function receiveTextMessage(message, sender)
end
|
local lighting = game:GetService("Lighting")
local players = game:GetService("Players")
local replicatedStorage = game:GetService("ReplicatedStorage")
local components = require(replicatedStorage.Services.ComponentService)
local transmit = require(replicatedStorage.Events.Transmit)
local Cell = require(replicatedStorage.Level.Cell)
local World = require(replicatedStorage.Level.World)
local client = players.LocalPlayer
local function getNewCell(cellModel)
local cell = Cell.new(cellModel.Name)
-- HACK This isn't a very clean way of setting the TimeOfDay of the Cell. For
-- right now we really just need a TimeOfDay changing implementation, but this
-- should be cleaned up as soon as possible.
--
-- See CellEntered connection in setupWorld() for related code.
local timeOfDay = cellModel:FindFirstChild("TimeOfDay")
if timeOfDay then
cell.TimeOfDay = timeOfDay.Value
end
return cell
end
local function getCellsFromModels(cellModels)
local cells = {}
for _, cellModel in ipairs(cellModels) do
table.insert(cells, getNewCell(cellModel))
end
return cells
end
local function setupWorld()
local cellModels = components:GetByType("Cell")
local cells = getCellsFromModels(cellModels)
local world = World.new(cells)
-- Fired by StarterCharacterScripts.WarpListening. This lets us know when the
-- client has been Warped to one of the Cell Models. From here we can perform
-- the action to actually move them into the Cell.
local warpedToCell = transmit.getLocalEvent("WarpedToCell")
world.CellEntered:connect(function(player, cell)
if client == player and cell.TimeOfDay then
lighting.TimeOfDay = cell.TimeOfDay
end
end)
-- Start off in Geo's Room.
world:EnterCell("GeosRoom", client)
warpedToCell.Event:connect(function(cellModel)
world:EnterCell(cellModel.Name, client)
end)
end
setupWorld()
|
id = 'V-38577'
severity = 'medium'
weight = 10.0
title = 'The system must use a FIPS 140-2 approved cryptographic hashing algorithm for generating account password hashes (libuser.conf).'
description = 'Using a stronger hashing algorithm makes password cracking attacks more difficult.'
fixtext = [==[In "/etc/libuser.conf", add or correct the following line in its "[defaults]" section to ensure the system will use the SHA-512 algorithm for password hashing:
crypt_style = sha512]==]
checktext = [==[Inspect "/etc/libuser.conf" and ensure the following line appears in the "[default]" section:
crypt_style = sha512
If it does not, this is a finding.]==]
function test()
end
function fix()
end
|
local attackRequests = {
hyperionGM = 5; --Requests sent to server from client
};
for i, v in pairs(attackRequests) do
v = v - 3;
end;
table.foreach(attackRequests, print);
local currentTime = 0;
local margin = 5;
local maxRequests = 50;
local decrementRequests = function(deltaTime)
local rate = 1;
currentTime = currentTime + deltaTime;
if (attackRequests ~= nil) then
for i, v in pairs(attackRequests) do
if (currentTime >= 1) then
currentTime = currentTime - rate;
v = v - margin;
if (v <= 0) then
v = 0;
end;
if (v > maxRequests) then
print('Too many requests');
else
print('Works');
end;
end;
end;
end;
end;
|
---@tag telescope.layout
---@brief [[
---
--- Layout strategies are different functions to position telescope.
---
--- All layout strategies are functions with the following signature:
---
--- <code>
--- function(picker, columns, lines, layout_config)
--- -- Do some calculations here...
--- return {
--- preview = preview_configuration
--- results = results_configuration,
--- prompt = prompt_configuration,
--- }
--- end
--- </code>
---
--- <pre>
--- Parameters: ~
--- - picker : A Picker object. (docs coming soon)
--- - columns : (number) Columns in the vim window
--- - lines : (number) Lines in the vim window
--- - layout_config : (table) The configuration values specific to the picker.
---
--- </pre>
---
--- This means you can create your own layout strategy if you want! Just be aware
--- for now that we may change some APIs or interfaces, so they may break if you create
--- your own.
---
--- A good method for creating your own would be to copy one of the strategies that most
--- resembles what you want from "./lua/telescope/pickers/layout_strategies.lua" in the
--- telescope repo.
---
---@brief ]]
local resolve = require "telescope.config.resolve"
local p_window = require "telescope.pickers.window"
local if_nil = vim.F.if_nil
local get_border_size = function(opts)
if opts.window.border == false then
return 0
end
return 1
end
local calc_tabline = function(max_lines)
local tbln = (vim.o.showtabline == 2) or (vim.o.showtabline == 1 and #vim.api.nvim_list_tabpages() > 1)
if tbln then
max_lines = max_lines - 1
end
return max_lines, tbln
end
-- Helper function for capping over/undersized width/height, and calculating spacing
--@param cur_size number: size to be capped
--@param max_size any: the maximum size, e.g. max_lines or max_columns
--@param bs number: the size of the border
--@param w_num number: the maximum number of windows of the picker in the given direction
--@param b_num number: the number of border rows/column in the given direction (when border enabled)
--@param s_num number: the number of gaps in the given direction (when border disabled)
local calc_size_and_spacing = function(cur_size, max_size, bs, w_num, b_num, s_num)
local spacing = s_num * (1 - bs) + b_num * bs
cur_size = math.min(cur_size, max_size)
cur_size = math.max(cur_size, w_num + spacing)
return cur_size, spacing
end
local layout_strategies = {}
layout_strategies._configurations = {}
--@param strategy_config table: table with keys for each option for a strategy
--@return table: table with keys for each option (for this strategy) and with keys for each layout_strategy
local get_valid_configuration_keys = function(strategy_config)
local valid_configuration_keys = {
-- TEMP: There are a few keys we should say are valid to start with.
preview_cutoff = true,
prompt_position = true,
}
for key in pairs(strategy_config) do
valid_configuration_keys[key] = true
end
for name in pairs(layout_strategies) do
valid_configuration_keys[name] = true
end
return valid_configuration_keys
end
--@param strategy_name string: the name of the layout_strategy we are validating for
--@param configuration table: table with keys for each option available
--@param values table: table containing all of the non-default options we want to set
--@param default_layout_config table: table with the default values to configure layouts
--@return table: table containing the combined options (defaults and non-defaults)
local function validate_layout_config(strategy_name, configuration, values, default_layout_config)
assert(strategy_name, "It is required to have a strategy name for validation.")
local valid_configuration_keys = get_valid_configuration_keys(configuration)
-- If no default_layout_config provided, check Telescope's config values
default_layout_config = if_nil(default_layout_config, require("telescope.config").values.layout_config)
local result = {}
local get_value = function(k)
-- skip "private" items
if string.sub(k, 1, 1) == "_" then
return
end
local val
-- Prioritise options that are specific to this strategy
if values[strategy_name] ~= nil and values[strategy_name][k] ~= nil then
val = values[strategy_name][k]
end
-- Handle nested layout config values
if layout_strategies[k] and strategy_name ~= k and type(val) == "table" then
val = vim.tbl_deep_extend("force", default_layout_config[k], val)
end
if val == nil and values[k] ~= nil then
val = values[k]
end
if val == nil then
if default_layout_config[strategy_name] ~= nil and default_layout_config[strategy_name][k] ~= nil then
val = default_layout_config[strategy_name][k]
else
val = default_layout_config[k]
end
end
return val
end
-- Always set the values passed first.
for k in pairs(values) do
if not valid_configuration_keys[k] then
-- TODO: At some point we'll move to error here,
-- but it's a bit annoying to just straight up crash everyone's stuff.
vim.api.nvim_err_writeln(
string.format(
"Unsupported layout_config key for the %s strategy: %s\n%s",
strategy_name,
k,
vim.inspect(values)
)
)
end
result[k] = get_value(k)
end
-- And then set other valid keys via "inheritance" style extension
for k in pairs(valid_configuration_keys) do
if result[k] == nil then
result[k] = get_value(k)
end
end
return result
end
-- List of options that are shared by more than one layout.
local shared_options = {
width = { "How wide to make Telescope's entire layout", "See |resolver.resolve_width()|" },
height = { "How tall to make Telescope's entire layout", "See |resolver.resolve_height()|" },
mirror = "Flip the location of the results/prompt and preview windows",
scroll_speed = "The number of lines to scroll through the previewer",
}
-- Used for generating vim help documentation.
layout_strategies._format = function(name)
local strategy_config = layout_strategies._configurations[name]
if vim.tbl_isempty(strategy_config) then
return {}
end
local results = { "<pre>", "`picker.layout_config` shared options:" }
local strategy_keys = vim.tbl_keys(strategy_config)
table.sort(strategy_keys, function(a, b)
return a < b
end)
local add_value = function(k, val)
if type(val) == "string" then
table.insert(results, string.format(" - %s: %s", k, val))
elseif type(val) == "table" then
table.insert(results, string.format(" - %s:", k))
for _, line in ipairs(val) do
table.insert(results, string.format(" - %s", line))
end
else
error("Unknown type:" .. type(val))
end
end
for _, k in ipairs(strategy_keys) do
if shared_options[k] then
add_value(k, strategy_config[k])
end
end
table.insert(results, "")
table.insert(results, "`picker.layout_config` unique options:")
for _, k in ipairs(strategy_keys) do
if not shared_options[k] then
add_value(k, strategy_config[k])
end
end
table.insert(results, "</pre>")
return results
end
--@param name string: the name to be assigned to the layout
--@param layout_config table: table where keys are the available options for the layout
--@param layout function: function with signature
-- function(self, max_columns, max_lines, layout_config): table
-- the returned table is the sizing and location information for the parts of the picker
--@retun function: wrapped function that inputs a validated layout_config into the `layout` function
local function make_documented_layout(name, layout_config, layout)
-- Save configuration data to be used by documentation
layout_strategies._configurations[name] = layout_config
-- Return new function that always validates configuration
return function(self, max_columns, max_lines, override_layout)
return layout(
self,
max_columns,
max_lines,
validate_layout_config(
name,
layout_config,
vim.tbl_deep_extend("keep", if_nil(override_layout, {}), if_nil(self.layout_config, {}))
)
)
end
end
--- Horizontal layout has two columns, one for the preview
--- and one for the prompt and results.
---
--- <pre>
--- ┌──────────────────────────────────────────────────┐
--- │ │
--- │ ┌───────────────────┐┌───────────────────┐ │
--- │ │ ││ │ │
--- │ │ ││ │ │
--- │ │ ││ │ │
--- │ │ Results ││ │ │
--- │ │ ││ Preview │ │
--- │ │ ││ │ │
--- │ │ ││ │ │
--- │ └───────────────────┘│ │ │
--- │ ┌───────────────────┐│ │ │
--- │ │ Prompt ││ │ │
--- │ └───────────────────┘└───────────────────┘ │
--- │ │
--- └──────────────────────────────────────────────────┘
--- </pre>
---@eval { ["description"] = require('telescope.pickers.layout_strategies')._format("horizontal") }
---
layout_strategies.horizontal = make_documented_layout(
"horizontal",
vim.tbl_extend("error", shared_options, {
preview_width = { "Change the width of Telescope's preview window", "See |resolver.resolve_width()|" },
preview_cutoff = "When columns are less than this value, the preview will be disabled",
prompt_position = { "Where to place prompt window.", "Available Values: 'bottom', 'top'" },
}),
function(self, max_columns, max_lines, layout_config)
local initial_options = p_window.get_initial_window_options(self)
local preview = initial_options.preview
local results = initial_options.results
local prompt = initial_options.prompt
local tbln
max_lines, tbln = calc_tabline(max_lines)
local width_opt = layout_config.width
local width = resolve.resolve_width(width_opt)(self, max_columns, max_lines)
local height_opt = layout_config.height
local height = resolve.resolve_height(height_opt)(self, max_columns, max_lines)
local bs = get_border_size(self)
local w_space
if self.previewer and max_columns >= layout_config.preview_cutoff then
-- Cap over/undersized width (with previewer)
width, w_space = calc_size_and_spacing(width, max_columns, bs, 2, 4, 1)
preview.width = resolve.resolve_width(if_nil(layout_config.preview_width, function(_, cols)
if cols < 150 then
return math.floor(cols * 0.4)
elseif cols < 200 then
return 80
else
return 120
end
end))(self, width, max_lines)
results.width = width - preview.width - w_space
prompt.width = results.width
else
-- Cap over/undersized width (without previewer)
width, w_space = calc_size_and_spacing(width, max_columns, bs, 1, 2, 0)
preview.width = 0
results.width = width - preview.width - w_space
prompt.width = results.width
end
local h_space
-- Cap over/undersized height
height, h_space = calc_size_and_spacing(height, max_lines, bs, 2, 4, 1)
prompt.height = 1
results.height = height - prompt.height - h_space
if self.previewer then
preview.height = height - 2 * bs
else
preview.height = 0
end
local width_padding = math.floor((max_columns - width) / 2)
-- Default value is false, to use the normal horizontal layout
if not layout_config.mirror then
results.col = width_padding + bs + 1
prompt.col = results.col
preview.col = results.col + results.width + 1 + bs
else
preview.col = width_padding + bs + 1
prompt.col = preview.col + preview.width + 1 + bs
results.col = preview.col + preview.width + 1 + bs
end
preview.line = math.floor((max_lines - height) / 2) + bs + 1
if layout_config.prompt_position == "top" then
prompt.line = preview.line
results.line = prompt.line + prompt.height + 1 + bs
elseif layout_config.prompt_position == "bottom" then
results.line = preview.line
prompt.line = results.line + results.height + 1 + bs
else
error(string.format("Unknown prompt_position: %s\n%s", self.window.prompt_position, vim.inspect(layout_config)))
end
if tbln then
prompt.line = prompt.line + 1
results.line = results.line + 1
preview.line = preview.line + 1
end
return {
preview = self.previewer and preview.width > 0 and preview,
results = results,
prompt = prompt,
}
end
)
--- Centered layout with a combined block of the prompt
--- and results aligned to the middle of the screen.
--- The preview window is then placed in the remaining space above.
--- Particularly useful for creating dropdown menus
--- (see |telescope.themes| and |themes.get_dropdown()|`).
---
--- <pre>
--- ┌──────────────────────────────────────────────────┐
--- │ ┌────────────────────────────────────────┐ │
--- │ | Preview | │
--- │ | Preview | │
--- │ └────────────────────────────────────────┘ │
--- │ ┌────────────────────────────────────────┐ │
--- │ | Prompt | │
--- │ ├────────────────────────────────────────┤ │
--- │ | Result | │
--- │ | Result | │
--- │ └────────────────────────────────────────┘ │
--- │ │
--- │ │
--- │ │
--- │ │
--- └──────────────────────────────────────────────────┘
--- </pre>
---@eval { ["description"] = require("telescope.pickers.layout_strategies")._format("center") }
---
layout_strategies.center = make_documented_layout(
"center",
vim.tbl_extend("error", shared_options, {
preview_cutoff = "When lines are less than this value, the preview will be disabled",
prompt_position = { "Where to place prompt window.", "Available Values: 'bottom', 'top'" },
}),
function(self, max_columns, max_lines, layout_config)
local initial_options = p_window.get_initial_window_options(self)
local preview = initial_options.preview
local results = initial_options.results
local prompt = initial_options.prompt
local tbln
max_lines, tbln = calc_tabline(max_lines)
-- This sets the width for the whole layout
local width_opt = layout_config.width
local width = resolve.resolve_width(width_opt)(self, max_columns, max_lines)
-- This sets the height for the whole layout
local height_opt = layout_config.height
local height = resolve.resolve_height(height_opt)(self, max_columns, max_lines)
local bs = get_border_size(self)
local w_space
-- Cap over/undersized width
width, w_space = calc_size_and_spacing(width, max_columns, bs, 1, 2, 0)
prompt.width = width - w_space
results.width = width - w_space
preview.width = width - w_space
local h_space
-- Cap over/undersized height
height, h_space = calc_size_and_spacing(height, max_lines, bs, 2, 3, 0)
prompt.height = 1
results.height = height - prompt.height - h_space
local topline = (max_lines / 2) - ((results.height + (2 * bs)) / 2) + 1
-- Align the prompt and results so halfway up the screen is
-- in the middle of this combined block
if layout_config.prompt_position == "top" then
prompt.line = topline
results.line = prompt.line + 1 + bs
elseif layout_config.prompt_position == "bottom" then
results.line = topline
prompt.line = results.line + results.height + bs
if type(prompt.title) == "string" then
prompt.title = { { pos = "S", text = prompt.title } }
end
else
error(string.format("Unknown prompt_position: %s\n%s", self.window.prompt_position, vim.inspect(layout_config)))
end
preview.line = 2
if self.previewer and max_lines >= layout_config.preview_cutoff then
preview.height = math.floor(topline - (3 + bs))
else
preview.height = 0
end
results.col, preview.col, prompt.col = 0, 0, 0 -- all centered
if tbln then
prompt.line = prompt.line + 1
results.line = results.line + 1
preview.line = preview.line + 1
end
return {
preview = self.previewer and preview.height > 0 and preview,
results = results,
prompt = prompt,
}
end
)
--- Cursor layout dynamically positioned below the cursor if possible.
--- If there is no place below the cursor it will be placed above.
---
--- <pre>
--- ┌──────────────────────────────────────────────────┐
--- │ │
--- │ █ │
--- │ ┌──────────────┐┌─────────────────────┐ │
--- │ │ Prompt ││ Preview │ │
--- │ ├──────────────┤│ Preview │ │
--- │ │ Result ││ Preview │ │
--- │ │ Result ││ Preview │ │
--- │ └──────────────┘└─────────────────────┘ │
--- │ █ │
--- │ │
--- │ │
--- │ │
--- │ │
--- │ │
--- └──────────────────────────────────────────────────┘
--- </pre>
layout_strategies.cursor = make_documented_layout(
"cursor",
vim.tbl_extend("error", shared_options, {
preview_width = { "Change the width of Telescope's preview window", "See |resolver.resolve_width()|" },
preview_cutoff = "When columns are less than this value, the preview will be disabled",
}),
function(self, max_columns, max_lines, layout_config)
local initial_options = p_window.get_initial_window_options(self)
local preview = initial_options.preview
local results = initial_options.results
local prompt = initial_options.prompt
local height_opt = layout_config.height
local height = resolve.resolve_height(height_opt)(self, max_columns, max_lines)
local width_opt = layout_config.width
local width = resolve.resolve_width(width_opt)(self, max_columns, max_lines)
local bs = get_border_size(self)
local h_space
-- Cap over/undersized height
height, h_space = calc_size_and_spacing(height, max_lines, bs, 2, 3, 0)
prompt.height = 1
results.height = height - prompt.height - h_space
preview.height = height - 2 * bs
local w_space
if self.previewer and max_columns >= layout_config.preview_cutoff then
-- Cap over/undersized width (with preview)
width, w_space = calc_size_and_spacing(width, max_columns, bs, 2, 4, 0)
preview.width = resolve.resolve_width(if_nil(layout_config.preview_width, 2 / 3))(self, width, max_lines)
prompt.width = width - preview.width - w_space
results.width = prompt.width
else
-- Cap over/undersized width (without preview)
width, w_space = calc_size_and_spacing(width, max_columns, bs, 1, 2, 0)
preview.width = 0
prompt.width = width - w_space
results.width = prompt.width
end
local position = vim.api.nvim_win_get_position(0)
local top_left = {
line = vim.fn.winline() + position[1] + bs,
col = vim.fn.wincol() + position[2],
}
local bot_right = {
line = top_left.line + height - 1,
col = top_left.col + width - 1,
}
if bot_right.line > max_lines then
-- position above current line
top_left.line = top_left.line - height - 1
end
if bot_right.col >= max_columns then
-- cap to the right of the screen
top_left.col = max_columns - width
end
prompt.line = top_left.line + 1
results.line = prompt.line + bs + 1
preview.line = prompt.line
prompt.col = top_left.col + 1
results.col = prompt.col
preview.col = results.col + (bs * 2) + results.width
return {
preview = self.previewer and preview.width > 0 and preview,
results = results,
prompt = prompt,
}
end
)
--- Vertical layout stacks the items on top of each other.
--- Particularly useful with thinner windows.
---
--- <pre>
--- ┌──────────────────────────────────────────────────┐
--- │ │
--- │ ┌────────────────────────────────────────┐ │
--- │ | Preview | │
--- │ | Preview | │
--- │ | Preview | │
--- │ └────────────────────────────────────────┘ │
--- │ ┌────────────────────────────────────────┐ │
--- │ | Result | │
--- │ | Result | │
--- │ └────────────────────────────────────────┘ │
--- │ ┌────────────────────────────────────────┐ │
--- │ | Prompt | │
--- │ └────────────────────────────────────────┘ │
--- │ │
--- └──────────────────────────────────────────────────┘
--- </pre>
---@eval { ["description"] = require("telescope.pickers.layout_strategies")._format("vertical") }
---
layout_strategies.vertical = make_documented_layout(
"vertical",
vim.tbl_extend("error", shared_options, {
preview_cutoff = "When lines are less than this value, the preview will be disabled",
preview_height = { "Change the height of Telescope's preview window", "See |resolver.resolve_height()|" },
prompt_position = { "Where to place prompt window.", "Available Values: 'bottom', 'top'" },
}),
function(self, max_columns, max_lines, layout_config)
local initial_options = p_window.get_initial_window_options(self)
local preview = initial_options.preview
local results = initial_options.results
local prompt = initial_options.prompt
local tbln
max_lines, tbln = calc_tabline(max_lines)
local width_opt = layout_config.width
local width = resolve.resolve_width(width_opt)(self, max_columns, max_lines)
local height_opt = layout_config.height
local height = resolve.resolve_height(height_opt)(self, max_columns, max_lines)
local bs = get_border_size(self)
local w_space
-- Cap over/undersized width
width, w_space = calc_size_and_spacing(width, max_columns, bs, 1, 2, 0)
prompt.width = width - w_space
results.width = prompt.width
preview.width = prompt.width
local h_space
if self.previewer and max_lines >= layout_config.preview_cutoff then
-- Cap over/undersized height (with previewer)
height, h_space = calc_size_and_spacing(height, max_lines, bs, 3, 6, 2)
preview.height = resolve.resolve_height(if_nil(layout_config.preview_height, 0.5))(self, max_columns, height)
else
-- Cap over/undersized height (without previewer)
height, h_space = calc_size_and_spacing(height, max_lines, bs, 2, 4, 1)
preview.height = 0
end
prompt.height = 1
results.height = height - preview.height - prompt.height - h_space
results.col, preview.col, prompt.col = 0, 0, 0 -- all centered
local height_padding = math.floor((max_lines - height) / 2)
if not layout_config.mirror then
preview.line = height_padding + (1 + bs)
if layout_config.prompt_position == "top" then
prompt.line = (preview.height == 0) and preview.line or preview.line + preview.height + (1 + bs)
results.line = prompt.line + prompt.height + (1 + bs)
elseif layout_config.prompt_position == "bottom" then
results.line = (preview.height == 0) and preview.line or preview.line + preview.height + (1 + bs)
prompt.line = results.line + results.height + (1 + bs)
else
error(string.format("Unknown prompt_position: %s\n%s", self.window.prompt_position, vim.inspect(layout_config)))
end
else
if layout_config.prompt_position == "top" then
prompt.line = height_padding + (1 + bs)
results.line = prompt.line + prompt.height + (1 + bs)
preview.line = results.line + results.height + (1 + bs)
elseif layout_config.prompt_position == "bottom" then
results.line = height_padding + (1 + bs)
prompt.line = results.line + results.height + (1 + bs)
preview.line = prompt.line + prompt.height + (1 + bs)
else
error(string.format("Unknown prompt_position: %s\n%s", self.window.prompt_position, vim.inspect(layout_config)))
end
end
if tbln then
prompt.line = prompt.line + 1
results.line = results.line + 1
preview.line = preview.line + 1
end
return {
preview = self.previewer and preview.height > 0 and preview,
results = results,
prompt = prompt,
}
end
)
--- Flex layout swaps between `horizontal` and `vertical` strategies based on the window width
--- - Supports |layout_strategies.vertical| or |layout_strategies.horizontal| features
---
---@eval { ["description"] = require("telescope.pickers.layout_strategies")._format("flex") }
---
layout_strategies.flex = make_documented_layout(
"flex",
vim.tbl_extend("error", shared_options, {
flip_columns = "The number of columns required to move to horizontal mode",
flip_lines = "The number of lines required to move to horizontal mode",
vertical = "Options to pass when switching to vertical layout",
horizontal = "Options to pass when switching to horizontal layout",
}),
function(self, max_columns, max_lines, layout_config)
local flip_columns = if_nil(layout_config.flip_columns, 100)
local flip_lines = if_nil(layout_config.flip_lines, 20)
if max_columns < flip_columns and max_lines > flip_lines then
self.__flex_strategy = "vertical"
return layout_strategies.vertical(self, max_columns, max_lines, layout_config.vertical)
else
self.__flex_strategy = "horizontal"
return layout_strategies.horizontal(self, max_columns, max_lines, layout_config.horizontal)
end
end
)
layout_strategies.current_buffer = make_documented_layout("current_buffer", {
-- No custom options.
-- height, width ignored
}, function(self, _, _, _)
local initial_options = p_window.get_initial_window_options(self)
local window_width = vim.api.nvim_win_get_width(0)
local window_height = vim.api.nvim_win_get_height(0)
local preview = initial_options.preview
local results = initial_options.results
local prompt = initial_options.prompt
local bs = get_border_size(self)
-- Width
local width_padding = (1 + bs) -- TODO(l-kershaw): make this configurable
prompt.width = window_width - 2 * width_padding
results.width = prompt.width
preview.width = prompt.width
-- Height
local height_padding = (1 + bs) -- TODO(l-kershaw): make this configurable
prompt.height = 1
if self.previewer then
results.height = 10 -- TODO(l-kershaw): make this configurable
preview.height = window_height - results.height - prompt.height - 2 * (1 + bs) - 2 * height_padding
else
results.height = window_height - prompt.height - (1 + bs) - 2 * height_padding
preview.height = 0
end
local win_position = vim.api.nvim_win_get_position(0)
local line = win_position[1]
if self.previewer then
preview.line = height_padding + line + 1
results.line = preview.line + preview.height + (1 + bs)
prompt.line = results.line + results.height + (1 + bs)
else
results.line = height_padding + line + 1
prompt.line = results.line + results.height + (1 + bs)
end
local col = win_position[2] + width_padding + 1
preview.col, results.col, prompt.col = col, col, col
return {
preview = preview.height > 0 and preview,
results = results,
prompt = prompt,
}
end)
--- Bottom pane can be used to create layouts similar to "ivy".
---
--- For an easy ivy configuration, see |themes.get_ivy()|
layout_strategies.bottom_pane = make_documented_layout(
"bottom_pane",
vim.tbl_extend("error", shared_options, {
preview_width = { "Change the width of Telescope's preview window", "See |resolver.resolve_width()|" },
preview_cutoff = "When columns are less than this value, the preview will be disabled",
prompt_position = { "Where to place prompt window.", "Available Values: 'bottom', 'top'" },
}),
function(self, max_columns, max_lines, layout_config)
local initial_options = p_window.get_initial_window_options(self)
local results = initial_options.results
local prompt = initial_options.prompt
local preview = initial_options.preview
local tbln
max_lines, tbln = calc_tabline(max_lines)
local height = if_nil(resolve.resolve_height(layout_config.height)(self, max_columns, max_lines), 25)
if type(layout_config.height) == "table" and type(layout_config.height.padding) == "number" then
-- Since bottom_pane only has padding at the top, we only need half as much padding in total
-- This doesn't match the vim help for `resolve.resolve_height`, but it matches expectations
height = math.floor((max_lines + height) / 2)
end
local bs = get_border_size(self)
-- Cap over/undersized height
height, _ = calc_size_and_spacing(height, max_lines, bs, 2, 3, 0)
-- Height
prompt.height = 1
results.height = height - prompt.height - (2 * bs)
preview.height = results.height - bs
-- Width
prompt.width = max_columns - 2 * bs
if self.previewer and max_columns >= layout_config.preview_cutoff then
-- Cap over/undersized width (with preview)
local width, w_space = calc_size_and_spacing(max_columns, max_columns, bs, 2, 4, 0)
preview.width = resolve.resolve_width(if_nil(layout_config.preview_width, 0.5))(self, width, max_lines)
results.width = width - preview.width - w_space
else
results.width = prompt.width
preview.width = 0
end
-- Line
if layout_config.prompt_position == "top" then
prompt.line = max_lines - results.height - (1 + bs) + 1
results.line = prompt.line + 1
preview.line = results.line + bs
elseif layout_config.prompt_position == "bottom" then
results.line = max_lines - results.height - (1 + bs) + 1
preview.line = results.line
prompt.line = max_lines - bs
if type(prompt.title) == "string" then
prompt.title = { { pos = "S", text = prompt.title } }
end
else
error("Unknown prompt_position: " .. tostring(self.window.prompt_position) .. "\n" .. vim.inspect(layout_config))
end
-- Col
prompt.col = 0 -- centered
if layout_config.mirror and preview.width > 0 then
results.col = preview.width + (3 * bs) + 1
preview.col = bs + 1
else
results.col = bs + 1
preview.col = results.width + (3 * bs) + 1
end
if tbln then
prompt.line = prompt.line + 1
results.line = results.line + 1
preview.line = preview.line + 1
end
return {
preview = self.previewer and preview.width > 0 and preview,
prompt = prompt,
results = results,
}
end
)
layout_strategies._validate_layout_config = validate_layout_config
return layout_strategies
|
--------------------------------------------------------------------------------------------------------
--- @class PostProcessAsset
--------------------------------------------------------------------------------------------------------
local PostProcessAsset = {}
return PostProcessAsset
|
-- box.uuid
uuid = require('uuid')
--
-- RFC4122 compliance
--
uu = uuid.new()
-- new()always generates RFC4122 variant
bit.band(uu.clock_seq_hi_and_reserved, 0xc0) == 0x80
vsn = bit.rshift(uu.time_hi_and_version, 12)
-- new() generates time-based or random-based version
vsn == 1 or vsn == 4
--
-- to/from string
--
uu = uuid()
#uu:str()
string.match(uu:str(), '^[a-f0-9%-]+$') ~= nil
uu == uuid.fromstr(uu:str())
uu = uuid.fromstr('ba90d815-14e0-431d-80c0-ce587885bb78')
uu:str()
tostring(uu)
tostring(uu) == uu:str()
uu.time_low;
uu.time_mid;
uu.time_hi_and_version;
uu.clock_seq_hi_and_reserved;
uu.clock_seq_low;
uu.node[0]
uu.node[1]
uu.node[2]
uu.node[3]
uu.node[4]
uu.node[5]
-- aliases
#uuid.str()
-- invalid values
uuid.fromstr(nil)
uuid.fromstr('')
uuid.fromstr('blablabla')
uuid.fromstr(string.rep(' ', 36))
uuid.fromstr('ba90d81514e0431d80c0ce587885bb78')
uuid.fromstr('ba90d815-14e0-431d-80c0')
uuid.fromstr('ba90d815-14e0-431d-80c0-tt587885bb7')
--
-- to/from binary
--
uu = uuid()
#uu:bin()
#uu:bin('h')
#uu:bin('l')
#uu:bin('n')
#uu:bin('b')
uu:bin() == uu:bin('h')
uu:bin('n') ~= uu:bin('h')
uu:bin('b') ~= uu:bin('l')
uu == uuid.frombin(uu:bin())
uu == uuid.frombin(uu:bin('b'), 'b')
uu == uuid.frombin(uu:bin('l'), 'l')
uu = uuid.fromstr('adf9d02e-0756-11e4-b5cf-525400123456')
uu:bin('l')
uu:bin('b')
-- aliases
#uuid.bin()
#uuid.bin('l')
--
-- eq and nil
--
uu = uuid.new()
uuid.NULL
uuid.NULL:isnil()
uuid.NULL ~= uu
uu:isnil()
uu == uu
uu == uu
uu == nil
uu == 12345
uu == "blablabla"
--
-- invalid usage
--
uu = uuid.new()
uu.isnil()
uu.bin()
uu.str()
uu = nil
uuid = nil
|
Class = require 'hump/class'
require 'settings'
require 'entities/entity'
NullPlayer = Class{
init = function(self, id, name)
self.id = id
self.name = name
self.score = 0
print('Null player ready for non-action!')
end;
-- TODO: move to common base
setPlane = function(self, plane)
self.plane = Entity(0, 0, plane.level)
self.plane.health = 0
self.plane.motorPower = 0
plane:delete()
end;
-- TODO: move to common base
getPlane = function(self)
return self.plane
end;
-- TODO: move to common base
addScore = function(self, score)
end;
update = function(self, dt)
end;
press = function(self, key)
end;
release = function(self, key)
end;
joystick = function(self, ...)
end;
}
|
--[[Info]]--
require "resources/essentialmode/lib/MySQL"
MySQL:open("127.0.0.1", "gta5_gamemode_essential", "root", "space031")
--[[Register]]--
RegisterServerEvent('garages:CheckForSpawnVeh')
RegisterServerEvent('garages:CheckForVeh')
RegisterServerEvent('garages:SetVehOut')
RegisterServerEvent('garages:SetVehIn')
RegisterServerEvent('garages:PutVehInGarages')
RegisterServerEvent('garages:CheckGarageForVeh')
RegisterServerEvent('garages:CheckForSelVeh')
RegisterServerEvent('garages:SelVeh')
--[[Local/Global]]--
local vehicles = {}
--[[Events]]--
AddEventHandler('es:playerDropped', function (player)
local executed_query = MySQL:executeQuery("UPDATE user_vehicle SET vehicle_state='Rentré' WHERE identifier = '@username'",{['@username'] = player.identifier})
end)
AddEventHandler('garages:CheckForSpawnVeh', function(veh_id)
TriggerEvent('es:getPlayerFromId', source, function(user)
local veh_id = veh_id
local player = user.identifier
local executed_query = MySQL:executeQuery("SELECT * FROM user_vehicle WHERE identifier = '@username' AND ID = '@ID'",{['@username'] = player, ['@ID'] = veh_id})
local result = MySQL:getResults(executed_query, {'vehicle_model', 'vehicle_plate', 'vehicle_state', 'vehicle_colorprimary', 'vehicle_colorsecondary', 'vehicle_pearlescentcolor', 'vehicle_wheelcolor' }, "identifier")
if(result)then
for k,v in ipairs(result)do
vehicle = v.vehicle_model
plate = v.vehicle_plate
state = v.vehicle_state
primarycolor = v.vehicle_colorprimary
secondarycolor = v.vehicle_colorsecondary
pearlescentcolor = v.vehicle_pearlescentcolor
wheelcolor = v.vehicle_wheelcolor
local vehicle = vehicle
local plate = plate
local state = state
local primarycolor = primarycolor
local secondarycolor = secondarycolor
local pearlescentcolor = pearlescentcolor
local wheelcolor = wheelcolor
end
end
TriggerClientEvent('garages:SpawnVehicle', source, vehicle, plate, state, primarycolor, secondarycolor, pearlescentcolor, wheelcolor)
end)
end)
AddEventHandler('garages:CheckForVeh', function()
TriggerEvent('es:getPlayerFromId', source, function(user)
local state = "Sortit"
local player = user.identifier
local executed_query = MySQL:executeQuery("SELECT * FROM user_vehicle WHERE identifier = '@username' AND vehicle_state ='@state'",{['@username'] = player, ['@vehicle'] = vehicle, ['@state'] = state})
local result = MySQL:getResults(executed_query, {'vehicle_model', 'vehicle_plate'}, "identifier")
if(result)then
for k,v in ipairs(result)do
vehicle = v.vehicle_model
plate = v.vehicle_plate
local vehicle = vehicle
local plate = plate
end
end
TriggerClientEvent('garages:StoreVehicle', source, vehicle, plate)
end)
end)
AddEventHandler('garages:SetVehOut', function(vehicle, plate)
TriggerEvent('es:getPlayerFromId', source, function(user)
local player = user.identifier
local vehicle = vehicle
local state = "Sortit"
local plate = plate
local executed_query = MySQL:executeQuery("UPDATE user_vehicle SET vehicle_state='@state' WHERE identifier = '@username' AND vehicle_plate = '@plate' AND vehicle_model = '@vehicle'",
{['@username'] = player, ['@vehicle'] = vehicle, ['@state'] = state, ['@plate'] = plate})
end)
end)
AddEventHandler('garages:SetVehIn', function(plate)
TriggerEvent('es:getPlayerFromId', source, function(user)
local player = user.identifier
local plate = plate
local state = "Rentré"
local executed_query = MySQL:executeQuery("UPDATE user_vehicle SET vehicle_state='@state' WHERE identifier = '@username' AND vehicle_plate = '@plate'",
{['@username'] = player, ['@plate'] = plate, ['@state'] = state})
end)
end)
AddEventHandler('garages:PutVehInGarages', function(vehicle)
TriggerEvent('es:getPlayerFromId', source, function(user)
local player = user.identifier
local state ="Rentré"
local executed_query = MySQL:executeQuery("SELECT * FROM user_vehicle WHERE identifier = '@username'",{['@username'] = player})
local result = MySQL:getResults(executed_query, {'identifier'})
if(result)then
for k,v in ipairs(result)do
joueur = v.identifier
local joueur = joueur
end
end
if joueur ~= nil then
local executed_query = MySQL:executeQuery("UPDATE user_vehicle SET `vehicle_state`='@state' WHERE identifier = '@username'",
{['@username'] = player, ['@state'] = state})
end
end)
end)
AddEventHandler('garages:CheckGarageForVeh', function()
vehicles = {}
TriggerEvent('es:getPlayerFromId', source, function(user)
local player = user.identifier
local executed_query = MySQL:executeQuery("SELECT * FROM user_vehicle WHERE identifier = '@username'",{['@username'] = player})
local result = MySQL:getResults(executed_query, {'id','vehicle_model', 'vehicle_name', 'vehicle_state'}, "id")
if (result) then
for _, v in ipairs(result) do
--print(v.vehicle_model)
--print(v.vehicle_plate)
--print(v.vehicle_state)
--print(v.id)
t = { ["id"] = v.id, ["vehicle_model"] = v.vehicle_model, ["vehicle_name"] = v.vehicle_name, ["vehicle_state"] = v.vehicle_state}
table.insert(vehicles, tonumber(v.id), t)
end
end
end)
--print(vehicles[1].id)
--print(vehicles[2].vehicle_model)
TriggerClientEvent('garages:getVehicles', source, vehicles)
end)
AddEventHandler('garages:CheckForSelVeh', function()
TriggerEvent('es:getPlayerFromId', source, function(user)
local state = "Sortit"
local player = user.identifier
local executed_query = MySQL:executeQuery("SELECT * FROM user_vehicle WHERE identifier = '@username' AND vehicle_state ='@state'",{['@username'] = player, ['@vehicle'] = vehicle, ['@state'] = state})
local result = MySQL:getResults(executed_query, {'vehicle_model', 'vehicle_plate'}, "identifier")
if(result)then
for k,v in ipairs(result)do
vehicle = v.vehicle_model
plate = v.vehicle_plate
local vehicle = vehicle
local plate = plate
end
end
TriggerClientEvent('garages:SelVehicle', source, vehicle, plate)
end)
end)
AddEventHandler('garages:SelVeh', function(plate)
TriggerEvent('es:getPlayerFromId', source, function(user)
local player = user.identifier
local plate = plate
local executed_query = MySQL:executeQuery("SELECT * FROM user_vehicle WHERE identifier = '@username' AND vehicle_plate ='@plate'",{['@username'] = player, ['@vehicle'] = vehicle, ['@plate'] = plate})
local result = MySQL:getResults(executed_query, {'vehicle_price'}, "identifier")
if(result)then
for k,v in ipairs(result)do
price = v.vehicle_price
local price = price / 2
user:addMoney((price))
end
end
local executed_query = MySQL:executeQuery("DELETE from user_vehicle WHERE identifier = '@username' AND vehicle_plate = '@plate'",
{['@username'] = player, ['@plate'] = plate})
TriggerClientEvent("es_freeroam:notify", source, "CHAR_SIMEON", 1, "Simeon", false, "Véhicule vendu!\n")
end)
end)
|
local netConnected = IsNetConnected();
local loggedOnSMO = IsNetSMOnline();
local t = Def.ActorFrame{
LoadFont("ScreenSystemLayer Credits") .. {
InitCommand=cmd(uppercase,true;zoom,1;shadowlength,1;queuecommand,"Begin");
UpdateTextCommand=cmd(queuecommand,"Begin");
BeginCommand=function(self)
-- check network status
if netConnected then
self:strokecolor(color("#000000"));
self:settext(THEME:GetString("ScreenSystemLayer","Network OK") );
else
self:strokecolor(color("#000000"));
self:settext(THEME:GetString("ScreenSystemLayer","Offline") );
end;
end;
};
};
return t;
|
-- Returns sign of the argument.
-- By default, returns 0 for 0, unlike Mathf.Sign which returns 1
function Sign(n, ZeroSign, Eps)
Eps = Eps or 0
if n > Eps then
return 1
elseif n < -Eps then
return -1
else
return ZeroSign or 0
end
end
|
function onInit()
if User.isHost() then
-- subscribe to user login events
User.onLogin = onLogin;
-- subscribe to module changes
Module.onModuleAdded = onModuleAdded;
Module.onModuleUpdated = onModuleUpdated;
end
end
function onLogin(username, activated)
if User.isHost() then
if activated then
-- add the user as a holder of the campaign locations
DB.createNode("locations").addHolder(username, true);
-- add the user as a holder of any module locations
local modules = Module.getModules();
for k, v in ipairs(modules) do
local modulenode = DB.findNode("locations@" .. v)
if modulenode then
modulenode.addHolder(username, true);
end
end
end
end
end
function onModuleAdded(name)
if User.isHost() then
local modulenode = DB.findNode("locations@" .. name);
if modulenode then
for k, v in ipairs(UserManager.getCurrentUsers()) do
modulenode.addHolder(v);
end
end
end
end
function onModuleUpdated(name)
onModuleAdded(name);
end
function openLocation(locationnode)
local locationwindowreference = Interface.findWindow("location", locationnode.getNodeName());
if not locationwindowreference then
Interface.openWindow("location", locationnode);
else
locationwindowreference.close();
end
end
|
local deleteTable = {}
local deleteTable2 = {}
function loaDragap(map,dim,player)
local temp = {}
local theMapFile = xmlLoadFile("maps/"..map..".map")
local nodes = xmlNodeGetChildren(theMapFile)
for i,v in ipairs(nodes) do
local attributes = xmlNodeGetAttributes(v)
local type = xmlNodeGetName(v)
if type == "object" then
temp[#temp+1] = {attributes.model, attributes.posX, attributes.posY, attributes.posZ, attributes.rotX, attributes.rotY, attributes.rotZ}
end
end
xmlUnloadFile(theMapFile)
loadVehicles(map,player)
triggerClientEvent(player,"loadDragMap",player,temp,map)
end
function loadVehicles(map,player)
local temp3 = {}
local theMapFile = xmlLoadFile("maps/"..map..".map")
local nodes = xmlNodeGetChildren(theMapFile)
for i,v in ipairs(nodes) do
local attributes = xmlNodeGetAttributes(v)
local type = xmlNodeGetName(v)
if type == "vehicle" then
temp3[#temp3+1] = {attributes.model, attributes.posX, attributes.posY, attributes.posZ, attributes.rotX, attributes.rotY, attributes.rotZ} ---rotX="0" rotY="0" rotZ
end
end
xmlUnloadFile(theMapFile)
triggerClientEvent(player,"loadDragMapVehicles",player,temp3,map)
end
|
return {
id = "solarsheriff",
price = 99999,
onSale = true,
}
|
require("games/common2/match/module/matchLayerBase");
local MatchToolbarLayer = class(MatchLayerBase);
MatchToolbarLayer.init = function(self)
local localseat = PlayerSeat.getInstance():getMyLocalSeat();
if self.m_viewConfig[localseat] then
self:addView(localseat,self.m_viewConfig[localseat]);
end
end
MatchToolbarLayer.parseViewConfig = function(self)
local viewConfig = {
["onlooker"] = {};
};
return viewConfig;
end
-- 初始化layer的配置
MatchToolbarLayer.initViewConfig = function(self)
self.m_viewConfig = GameMatchConfig.matchToolbar;
if not self.m_viewConfig then
self.m_viewConfig = {
[1] = {
path = "games/common2/match/module/matchToolbar/matchToolbarView";
pos = {};
viewLayer = "view/kScreen_1280_800/games/common2/match/match_toolbar_2";
viewConfig = "match_toolbar_2";
config = {
menu_view = {
["x"] = 10;
["y"] = 0;
["align"] = kAlignTopRight;
};
time_view = {
["x"] = -10;
["y"] = 0;
["align"] = kAlignTopLeft;
["isShow"] = true;
};
menu_btn_config = {
["x"] = 0;
["y"] = 0;
["align"] = kAlignTopRight;
};
};
};
};
end
end
MatchToolbarLayer.initTimeView = function(self)
local localseat = PlayerSeat.getInstance():getMyLocalSeat();
if self.m_viewConfig[localseat] then
local config = self.m_viewConfig[localseat].config;
MechineManage.getInstance():receiveAction(GameMechineConfig.ACTION_NS_INITTIMEVIEW,config.time_view);
end
end
MatchToolbarLayer.s_stateFuncMap = {
[MatchMechineConfig.STATUS_PLAYING] = "initTimeView";
};
return MatchToolbarLayer;
--[[
比赛工具栏
配置:
config = {
menu_view = { --菜单显示位置
["x"] = 10;
["y"] = 0;
["align"] = kAlignTopRight;
};
time_view = { --时间显示配置
["x"] = -10;
["y"] = 0;
["align"] = kAlignTopLeft;
["isShow"] = true; --是否显示时间
};
}
]]
|
--[[--------------------------------------------------------------------
Grid
Compact party and raid unit frames.
Copyright (c) 2006-2009 Kyle Smith (Pastamancer)
Copyright (c) 2009-2016 Phanx <addons@phanx.net>
All rights reserved. See the accompanying LICENSE file for details.
https://github.com/Phanx/Grid
https://mods.curse.com/addons/wow/grid
http://www.wowinterface.com/downloads/info5747-Grid.html
------------------------------------------------------------------------
Range.lua
Grid status module for unit range.
Created by neXter, modified by Pastamancer, modified by Phanx.
----------------------------------------------------------------------]]
local _, Grid = ...
local L = Grid.L
local GridRoster = Grid:GetModule("GridRoster")
local GridStatusRange = Grid:NewStatusModule("GridStatusRange", "AceTimer-3.0")
GridStatusRange.menuName = L["Out of Range"]
GridStatusRange.defaultDB = {
alert_range = {
enable = true,
text = L["Range"],
color = { r = 0.8, g = 0.2, b = 0.2, a = 0.5 },
priority = 80,
range = false,
frequency = 0.2,
}
}
local extraOptions = {
frequency = {
name = L["Range check frequency"],
desc = L["Seconds between range checks"],
order = -1,
width = "double",
type = "range", min = 0.1, max = 5, step = 0.1,
get = function()
return GridStatusRange.db.profile.alert_range.frequency
end,
set = function(_, v)
GridStatusRange.db.profile.alert_range.frequency = v
GridStatusRange:OnStatusDisable("alert_range")
GridStatusRange:OnStatusEnable("alert_range")
end,
},
text = {
name = L["Text"],
desc = L["Text to display on text indicators"],
order = 113,
type = "input",
get = function()
return GridStatusRange.db.profile.alert_range.text
end,
set = function(_, v)
GridStatusRange.db.profile.alert_range.text = v
end,
},
range = false,
}
function GridStatusRange:PostInitialize()
self:RegisterStatus("alert_range", L["Out of Range"], extraOptions, true)
end
function GridStatusRange:OnStatusEnable(status)
self:RegisterMessage("Grid_PartyTransition", "PartyTransition")
self:PartyTransition("OnStatusEnable", GridRoster:GetPartyState())
end
function GridStatusRange:OnStatusDisable(status)
self:StopTimer("CheckRange")
self.core:SendStatusLostAllUnits("alert_range")
end
local resSpell
do
local _, class = UnitClass("player")
if class == "DEATHKNIGHT" then
resSpell = GetSpellInfo(61999) -- Raise Ally
elseif class == "DRUID" then
resSpell = GetSpellInfo(50769) -- Revive
elseif class == "MONK" then
resSpell = GetSpellInfo(115178) -- Resuscitate
elseif class == "PALADIN" then
resSpell = GetSpellInfo(7328) -- Redemption
elseif class == "PRIEST" then
resSpell = GetSpellInfo(2006) -- Resurrection
elseif class == "SHAMAN" then
resSpell = GetSpellInfo(2008) -- Ancestral Spirit
elseif class == "WARLOCK" then
resSpell = GetSpellInfo(20707) -- Soulstone
end
end
local IsSpellInRange, UnitInRange, UnitIsDead, UnitIsVisible, UnitIsUnit
= IsSpellInRange, UnitInRange, UnitIsDead, UnitIsVisible, UnitIsUnit
local function GroupRangeCheck(self, unit)
if UnitIsUnit(unit, "player") then
return true
elseif resSpell and UnitIsDead(unit) and not UnitIsDead("player") then
return IsSpellInRange(resSpell, unit) == 1
else
local inRange, checkedRange = UnitInRange(unit)
if checkedRange then
return inRange
else
return true
end
end
end
local function SoloRangeCheck(self, unit)
-- This is a workaround for the bug in WoW 5.0.4 in which UnitInRange
-- returns *false* for player/pet while solo.
return true
end
GridStatusRange.UnitInRange = GroupRangeCheck
function GridStatusRange:CheckRange()
local settings = self.db.profile.alert_range
for guid, unit in GridRoster:IterateRoster() do
if self:UnitInRange(unit) then
self.core:SendStatusLost(guid, "alert_range")
else
self.core:SendStatusGained(guid, "alert_range",
settings.priority,
false,
settings.color,
settings.text)
end
end
end
function GridStatusRange:PartyTransition(message, state, oldstate)
self:Debug("PartyTransition", message, state, oldstate)
if state == "solo" then
self:StopTimer("CheckRange")
self.UnitInRange = SoloRangeCheck
self.core:SendStatusLostAllUnits("alert_range")
else
self:StartTimer("CheckRange", self.db.profile.alert_range.frequency, true)
self.UnitInRange = GroupRangeCheck
end
end
|
--[[
Data Format: T/F if affected by {EXPERTORMIGHTY, MASTEROFARMS, THAUMATURGE, WEAPONEXPERT, CRITS, PENETRATION}
--]]
local double = "double"
local AbilityData = {
[40267] = {true, false, true, false, true, true}, --Anti-Cavalry Caltrops
[38561] = {true, false, true, false, true, true}, --Caltrops
[61493] = {true, true, false, false, true, true}, --Inevitable Detonation
[61488] = {true, true, false, false, true, true}, --Magicka Detonation
[61502] = {true, true, false, false, true, true}, --Proximity Detonation
[40252] = {true, false, true, false, true, true}, --Razor Caltrops
[40254] = {true, true, false, false, true, true}, --Razor Caltrops
[38703] = {true, false, true, false, true, true}, --Acid Spray
[38724] = {true, true, false, false, true, true}, --Acid Spray
[38696] = {true, false, true, false, true, true}, --Arrow Barrage
[38722] = {true, true, false, false, true, true}, --Arrow Spray
[85462] = {true, true, false, false, true, true}, --Ballista
[38723] = {true, true, false, false, true, true}, --Bombard
[38669] = {true, true, false, false, true, true}, --Draining Shot
[38690] = {true, false, true, false, true, true}, --Endless Hail
[38687] = {true, true, false, false, true, true}, --Focused Aim
[17173] = {true, true, false, true, true, true}, --Heavy Attack
[17174] = {true, true, false, true, true, true}, --Heavy Attack
[38685] = {true, true, false, false, true, true}, --Lethal Arrow
[16688] = {true, true, false, true, true, true}, --Light Attack
[38672] = {true, true, false, false, true, true}, --Magnum Shot
[28869] = {true, true, false, false, true, true}, --Poison Arrow
[44540] = {true, false, true, false, true, true}, --Poison Arrow
[38660] = {true, true, false, false, true, true}, --Poison Injection
[44549] = {true, false, true, false, true, true}, --Poison Injection
[86563] = {true, false, true, false, true, true}, --Rapid Fire
[28879] = {true, true, false, false, true, true}, --Scatter Shot
[28882] = {true, true, false, false, true, true}, --Snipe
[85260] = {true, false, true, false, true, true}, --Toxic Barrage
[85261] = {true, false, true, false, true, true}, --Toxic Barrage
[38645] = {true, true, false, false, true, true}, --Venom Arrow
[44545] = {true, false, true, false, true, true}, --Venom Arrow
[28877] = {true, false, true, false, true, true}, --Volley
[46348] = {true, true, false, false, true, true}, --Crushing Shock
[46350] = {true, true, false, false, true, true}, --Crushing Shock
[46351] = {true, true, false, false, true, true}, --Crushing Shock
[46356] = {true, true, false, false, true, true}, --Force Pulse
[46357] = {true, true, false, false, true, true}, --Force Pulse
[46358] = {true, true, false, false, true, true}, --Force Pulse
[48016] = {true, true, false, false, true, true}, --Force Pulse
[46340] = {true, true, false, false, true, true}, --Force Shock
[46341] = {true, true, false, false, true, true}, --Force Shock
[46343] = {true, true, false, false, true, true}, --Force Shock
[20660] = {true, true, false, false, true, true}, --Burning Embers
[44373] = {true, false, true, false, true, true}, --Burning Embers
[20252] = {true, true, false, false, true, true}, --Burning Talons
[31898] = {true, false, true, false, true, true}, --Burning Talons
[20251] = {true, true, false, false, true, true}, --Choking Talons
[17879] = {true, false, true, false, true, false}, --Corrosive Armor
[20245] = {true, true, false, false, true, true}, --Dark Talons
[32792] = {true, true, false, false, true, true}, --Deep Breath
[32794] = {true, true, false, false, true, true}, --Deep Breath
[32753] = {true, true, false, false, true, true}, --Dragon Fire Scale
[29014] = {true, true, false, false, true, true}, --Dragon Leap
[28995] = {true, false, true, false, true, true}, --Dragonknight Standard
[32785] = {true, true, false, false, true, true}, --Draw Essence
[32787] = {true, true, false, false, true, true}, --Draw Essence
[20499] = {true, true, false, false, true, true}, --Empowering Chains
[20930] = {true, true, false, false, true, true}, --Engulfing Flames
[31104] = {true, false, true, false, true, true}, --Engulfing Flames
[32711] = {true, false, true, false, true, true}, --Eruption
[32714] = {true, true, false, false, true, true}, --Eruption
[32716] = {true, true, false, false, true, true}, --Ferocious Leap
[20917] = {true, true, false, false, true, true}, --Fiery Breath
[31102] = {true, false, true, false, true, true}, --Fiery Breath
[20492] = {true, true, false, false, true, true}, --Fiery Grip
[20816] = {true, true, false, false, true, true}, --Flame Lash
[61945] = {true, true, false, false, true, true}, --Flames of Oblivion
[54931] = {true, true, false, false, true, true}, --Fossilize
[20329] = {true, true, false, false, false, true}, --Hardened Armor
[28969] = {true, true, false, false, true, true}, --Inferno
[31837] = {true, true, false, false, true, true}, --Inhale
[31842] = {true, true, false, false, true, true}, --Inhale
[23806] = {true, true, false, false, true, true}, --Lava Whip
[15959] = {true, false, true, false, true, true}, --Magma Armor
[17875] = {true, false, true, false, true, true}, --Magma Shell
[20805] = {true, true, false, false, true, true}, --Molten Whip
[20944] = {true, true, false, false, true, true}, --Noxious Breath
[31103] = {true, false, true, false, true, true}, --Noxious Breath
[31820] = {true, true, false, false, true, true}, --Obsidian Shard
[54918] = {true, true, false, false, true, true}, --Petrify
[20824] = {true, true, false, false, true, true}, --Power Lash
[20657] = {true, true, false, false, true, true}, --Searing Strike
[44363] = {true, false, true, false, true, true}, --Searing Strike
[32684] = {true, true, false, false, true, true}, --Shattering Rocks
[32960] = {true, false, true, false, true, true}, --Shifting Standard
[32964] = {true, false, true, false, true, true}, --Shifting Standard
[20320] = {true, true, false, false, false, true}, --Spiked Armor
[32948] = {true, false, true, false, true, true}, --Standard of Might
[133027] = {true, true, false, false, true, true}, --Stone Giant
[134340] = {true, true, false, false, true, true}, --Stone Giant
[29032] = {true, true, false, false, true, true}, --Stonefist
[32720] = {true, true, false, false, true, true}, --Take Flight
[20496] = {true, true, false, false, true, true}, --Unrelenting Grip
[20668] = {true, true, false, false, true, true}, --Venomous Claw
[44369] = {true, false, true, false, true, true}, --Venomous Claw
[20324] = {true, true, false, false, false, true}, --Volatile Armor
[20326] = {true, false, true, false, true, true}, --Volatile Armor
[62522] = {true, false, true, false, true, true}, --Blade Cloak
[38845] = {true, true, false, false, true, true}, --Blood Craze
[38847] = {true, true, false, false, true, true}, --Blood Craze
[38848] = {true, false, true, false, true, true}, --Blood Craze Bleed
[38846] = {true, false, true, false, true, true}, --Bloodthirst
[62547] = {true, false, true, false, true, true}, --Deadly Cloak
[28607] = {true, false, true, false, true, true}, --Flurry
[38910] = {true, true, false, false, true, true}, --Flying Blade
[126666] = {true, true, false, false, true, true}, --Flying Blade
[17169] = {true, true, false, true, true, true}, --Heavy Attack
[17170] = {true, true, false, true, true, true}, --Heavy Attack
[18622] = {true, true, false, true, true, true}, --Heavy Attack (Dual Wield)
[21157] = {true, true, false, false, true, true}, --Hidden Blade
[85156] = {true, false, true, false, true, true}, --Lacerate
[16499] = {true, true, false, true, true, true}, --Light Attack
[62529] = {true, false, true, false, true, true}, --Quick Cloak
[38857] = {true, true, false, false, true, true}, --Rapid Strikes
[85192] = {true, false, true, false, true, true}, --Rend
[38839] = {true, true, false, false, true, true}, --Rending Slashes
[38840] = {true, true, false, false, true, true}, --Rending Slashes
[38841] = {true, false, true, false, true, true}, --Rending Slashes Bleed
[38914] = {true, true, false, false, true, true}, --Shrouded Daggers
[68862] = {true, true, false, false, true, true}, --Shrouded Daggers
[68864] = {true, true, false, false, true, true}, --Shrouded Daggers
[38861] = {true, true, false, false, true, true}, --Steel Tornado
[85182] = {true, true, false, false, true, true}, --Thrive in Chaos
[45483] = {true, false, true, false, true, true}, --Twin Blade and Blunt Bleed
[30894] = {true, true, false, false, true, true}, --Twin Blade and Blunt Bleed
[28379] = {true, true, false, false, true, true}, --Twin Slashes
[35312] = {true, true, false, false, true, true}, --Twin Slashes
[29293] = {true, false, true, false, true, true}, --Twin Slashes Bleed
[38891] = {true, true, false, false, true, true}, --Whirling Blades
[28591] = {true, true, false, false, true, true}, --Whirlwind
[35713] = {true, true, false, false, true, true}, --Dawnbreaker
[62305] = {true, false, true, false, true, true}, --Dawnbreaker
[40158] = {true, true, false, false, true, true}, --Dawnbreaker of Smiting
[62314] = {true, false, true, false, true, true}, --Dawnbreaker of Smiting
[40161] = {true, true, false, false, true, true}, --Flawless Dawnbreaker
[62310] = {true, false, true, false, true, true}, --Flawless Dawnbreaker
[40375] = {true, false, true, false, true, true}, --Lightweight Beast Trap
[40376] = {true, false, true, false, true, true}, --Lightweight Beast Trap
[40385] = {true, false, true, false, true, true}, --Rearming Trap
[40389] = {true, false, true, false, true, true}, --Rearming Trap
[40392] = {true, false, true, false, true, true}, --Rearming Trap
[35721] = {true, true, false, false, true, true}, --Silver Bolts
[40336] = {true, true, false, false, true, true}, --Silver Leash
[40300] = {true, true, false, false, true, true}, --Silver Shards
[40452] = {true, false, true, false, true, true}, --Structured Entropy
[35754] = {true, false, true, false, true, true}, --Trap Beast
[35756] = {true, false, true, false, true, true}, --Trap Beast
[62951] = {true, false, true, false, true, true}, --Blockade of Frost
[83685] = {true, false, true, false, true, true}, --Eye of Frost
[38989] = {true, true, false, false, true, true}, --Frost Clench
[62702] = {true, false, true, false, true, true}, --Frost Clench
[28798] = {true, true, false, false, true, true}, --Frost Impulse
[39163] = {true, true, false, false, true, true}, --Frost Pulsar
[38970] = {true, true, false, false, true, true}, --Frost Reach
[62712] = {true, false, true, false, true, true}, --Frost Reach
[39151] = {true, true, false, false, true, true}, --Frost Ring
[29078] = {true, true, false, false, true, true}, --Frost Touch
[62692] = {true, false, true, false, true, true}, --Frost Touch
[18405] = {true, true, false, true, true, true}, --Heavy Attack
[18406] = {true, true, false, true, true, true}, --Heavy Attack
[83629] = {true, false, true, false, true, true}, --Ice Storm
[85129] = {true, false, true, false, true, true}, --Icy Rage
[16277] = {true, true, false, true, true, true}, --Light Attack
[39071] = {true, false, true, false, true, true}, --Unstable Wall of Frost
[39072] = {true, true, false, false, true, true}, --Unstable Wall of Frost
[62931] = {true, false, true, false, true, true}, --Wall of Frost
[46743] = {true, true, false, false, true, true}, --Absorb Magicka
[62912] = {true, false, true, false, true, true}, --Blockade of Fire
[83683] = {true, false, true, false, true, true}, --Eye of Flame
[85127] = {true, false, true, false, true, true}, --Fiery Rage
[62668] = {true, false, true, false, true, true}, --Fire Clench
[28794] = {true, true, false, false, true, true}, --Fire Impulse
[39149] = {true, true, false, false, true, true}, --Fire Ring
[83626] = {true, false, true, false, true, true}, --Fire Storm
[62648] = {true, false, true, false, true, true}, --Fire Touch
[38985] = {true, true, false, false, true, true}, --Flame Clench
[39162] = {true, true, false, false, true, true}, --Flame Pulsar
[38944] = {true, true, false, false, true, true}, --Flame Reach
[62682] = {true, false, true, false, true, true}, --Flame Reach
[29073] = {true, true, false, false, true, true}, --Flame Touch
[15385] = {true, true, false, true, true, true}, --Heavy Attack
[16321] = {true, true, false, true, true, true}, --Heavy Attack
[16165] = {true, true, false, true, true, true}, --Light Attack
[39054] = {true, false, true, false, true, true}, --Unstable Wall of Fire
[39056] = {true, true, false, false, true, true}, --Unstable Wall of Fire
[62896] = {true, false, true, false, true, true}, --Wall of Fire
[46746] = {true, true, false, false, true, true}, --Absorb Stamina
[133494] = {true, false, true, false, false, true}, --Aegis Caller
[107203] = {true, false, true, false, false, true}, --Arms of Relequen
[34502] = {true, true, false, false, true, true}, --Ashen Grip
[17904] = {true, true, false, false, true, true}, --Befouled Weapon
[102027] = {true, true, false, false, true, true}, --Caluurion's Legacy
[102032] = {true, true, false, false, true, true}, --Caluurion's Legacy
[102033] = {true, true, false, false, true, true}, --Caluurion's Legacy
[102034] = {true, true, false, false, true, true}, --Caluurion's Legacy
[17899] = {true, true, false, false, true, true}, --Charged Weapon
[46749] = {true, true, false, false, true, true}, --Damage Health
[93307] = {true, true, false, false, false, true}, --Defiler
[97883] = {true, false, true, false, false, true}, --Domihaus (fire)
[60972] = {true, false, true, false, false, true}, --Fiery Breath
[60973] = {true, true, false, false, false, true}, --Fiery Jaws
[17895] = {true, true, false, false, true, true}, --Fiery Weapon
[147703] = {true, true, false, false, true, true}, --Frenzied Momentum
[17897] = {true, true, false, false, true, true}, --Frozen Weapon
[84502] = {true, false, true, false, false, true}, --Grothdarr
[80561] = {true, false, true, false, false, true}, --Iceheart
[109086] = {true, false, true, false, false, true}, --Ideal Arms of Relequen
[80525] = {true, false, true, false, false, true}, --Illambris (fire)
[80526] = {true, false, true, false, false, true}, --Illambris (lightning)
[83409] = {true, true, false, false, false, true}, --Infernal Guardian
[60974] = {true, true, false, false, false, true}, --Jagged Claw
[133538] = {true, true, false, false, false, true}, --Kjalnar's Nightmare
[80565] = {true, false, true, false, false, true}, --Kra'gh
[28919] = {true, true, false, false, true, true}, --Life Drain
[126941] = {true, false, true, false, false, true}, --Maarselok
[107094] = {true, false, true, false, false, true}, --Mantle of Siroria
[59498] = {true, false, true, false, false, true}, --Mephala's Web
[99789] = {true, false, true, false, true, true}, --Merciless Charge
[59593] = {true, true, false, false, false, true}, --Nerien'eth
[17902] = {true, true, false, false, true, true}, --Poisoned Weapon
[40337] = {true, true, false, false, true, true}, --Prismatic Weapon
[111216] = {true, false, true, false, true, true}, --Savage Werewolf
[80606] = {true, true, false, false, false, true}, --Selene
[80544] = {true, true, false, false, false, true}, --Sellistrix
[80980] = {true, true, false, false, false, true}, --Shadowrend (base attack)
[80989] = {true, true, false, false, false, true}, --Shadowrend (tail sweep)
[80522] = {true, false, true, false, false, true}, --Stormfist (lightning)
[80521] = {true, true, false, false, false, true}, --Stormfist (physical)
[80865] = {true, true, false, false, false, true}, --Tremorscale
[61273] = {true, true, false, false, false, true}, --Valkyn Skoria (splash)
[59596] = {true, true, false, false, false, true}, --Valkyn Skoria (target hit)
[80490] = {true, true, false, false, false, true}, --Velidreth
[113627] = {true, true, false, false, true, true}, --Virulent Shot
[102136] = {true, false, true, false, false, true}, --Zaan
[62990] = {true, false, true, false, true, true}, --Blockade of Storms
[83687] = {true, false, true, false, true, true}, --Eye of Lightning
[18396] = {true, false, true, true, true, true}, --Heavy Attack (Shock)
[18350] = {true, true, false, true, true, true}, --Light Attack
[38993] = {true, true, false, false, true, true}, --Shock Clench
[62733] = {true, false, true, false, true, true}, --Shock Clench
[62734] = {true, true, false, false, true, true}, --Shock Clench Explosion
[28799] = {true, true, false, false, true, true}, --Shock Impulse
[19277] = {true, true, false, true, true, true}, --Shock Pulse
[38978] = {true, true, false, false, true, true}, --Shock Reach
[62745] = {true, false, true, false, true, true}, --Shock Reach
[39153] = {true, true, false, false, true, true}, --Shock Ring
[29089] = {true, true, false, false, true, true}, --Shock Touch
[62722] = {true, false, true, false, true, true}, --Shock Touch
[39167] = {true, true, false, false, true, true}, --Storm Pulsar
[83631] = {true, false, true, false, true, true}, --Thunder Storm
[85131] = {true, false, true, false, true, true}, --Thunderous Rage
[45505] = {true, false, true, true, true, double}, --Tri Focus
[39079] = {true, false, true, false, true, true}, --Unstable Wall of Storms
[39080] = {true, true, false, false, true, true}, --Unstable Wall of Storms
[62971] = {true, false, true, false, true, true}, --Wall of Storms
[126374] = {true, false, true, false, true, true}, --Degeneration
[126370] = {true, false, true, false, true, true}, --Entropy
[31635] = {true, true, false, false, true, true}, --Fire Rune
[63454] = {true, false, true, false, true, true}, --Ice Comet
[63457] = {true, true, false, false, true, true}, --Ice Comet
[17912] = {true, true, false, false, true, true}, --Meteor
[63429] = {true, false, true, false, true, true}, --Meteor
[40468] = {true, false, true, false, true, true}, --Scalding Rune
[40469] = {true, true, false, false, true, true}, --Scalding Rune
[63471] = {true, false, true, false, true, true}, --Shooting Star
[63474] = {true, true, false, false, true, true}, --Shooting Star
[126371] = {true, false, true, false, true, true}, --Structured Entropy
[40473] = {true, true, false, false, true, true}, --Volcanic Rune
[117854] = {true, false, true, false, true, true}, --Avid Boneyard
[115608] = {true, true, false, false, true, true}, --Blastbones
[117715] = {true, true, false, false, true, true}, --Blighted Blastbones
[115254] = {true, false, true, false, true, true}, --Boneyard
[115115] = {true, true, false, false, true, true}, --Death Scythe
[114461] = {true, true, false, false, true, true}, --Deathbolt
[118746] = {true, true, false, false, true, true}, --Deathbolt
[122774] = {true, true, false, false, true, true}, --Deathbolt
[124468] = {true, true, false, false, true, true}, --Deathbolt
[118766] = {true, false, true, false, true, true}, --Detonating Siphon
[123082] = {true, true, false, false, true, true}, --Detonating Siphon
[114108] = {true, true, false, false, true, true}, --Flame Skull
[123683] = {true, true, false, false, true, true}, --Flame Skull
[123685] = {true, true, false, false, true, true}, --Flame Skull
[122178] = {true, false, true, false, true, true}, --Frozen Colossus
[122392] = {true, false, true, false, true, true}, --Glacial Colossus
[118223] = {true, false, true, false, true, true}, --Hungry Scythe
[118011] = {true, false, true, false, true, true}, --Mystic Siphon
[122399] = {true, false, true, false, true, true}, --Pestilent Colossus
[122400] = {true, false, true, false, true, true}, --Pestilent Colossus
[122401] = {true, false, true, false, true, true}, --Pestilent Colossus
[118289] = {true, false, true, false, true, true}, --Ravenous Goliath
[117637] = {true, true, false, false, true, true}, --Ricochet Skull
[123718] = {true, true, false, false, true, true}, --Ricochet Skull
[123719] = {true, true, false, false, true, true}, --Ricochet Skull
[123722] = {true, true, false, false, true, true}, --Ricochet Skull
[123729] = {true, true, false, false, true, true}, --Ricochet Skull
[118226] = {true, true, false, false, true, true}, --Ruinous Scythe
[116410] = {true, false, true, false, true, true}, --Shocking Siphon
[117757] = {true, true, false, false, true, true}, --Stalking Blastbones
[117809] = {true, false, true, false, true, true}, --Unnerving Boneyard
[117624] = {true, true, false, false, true, true}, --Venom Skull
[123699] = {true, true, false, false, true, true}, --Venom Skull
[123704] = {true, true, false, false, true, true}, --Venom Skull
[25485] = {true, true, false, false, true, true}, --Ambush
[33386] = {true, true, false, false, true, true}, --Assassin's Blade
[61932] = {true, true, false, false, true, true}, --Assassin's Scourge
[61907] = {true, true, false, false, true, true}, --Assassin's Will
[61930] = {true, true, false, false, true, true}, --Assassin's Will
[25267] = {true, true, false, false, true, true}, --Concealed Weapon
[51556] = {true, true, false, false, true, true}, --Corrosive Arrow
[123945] = {true, true, false, false, true, true}, --Corrosive Flurry
[108936] = {true, true, false, false, true, true}, --Corrosive Slash
[33219] = {true, true, false, false, true, true}, --Corrosive Strike
[33333] = {true, false, true, false, true, true}, --Cripple
[36960] = {true, false, true, false, true, true}, --Crippling Grasp
[36963] = {true, true, false, false, true, true}, --Crippling Grasp
[33398] = {true, true, false, false, true, true}, --Death Stroke
[36947] = {true, false, true, false, true, true}, --Debilitate
[33316] = {true, true, false, false, true, true}, --Drain Power
[34838] = {true, true, false, false, true, true}, --Funnel Health
[34851] = {true, true, false, false, true, true}, --Impale
[36508] = {true, true, false, false, true, true}, --Incapacitating Strike
[113105] = {true, true, false, false, true, true}, --Incapacitating Strike
[34843] = {true, true, false, false, true, true}, --Killer's Blade
[25494] = {true, true, false, false, true, true}, --Lotus Fan
[35336] = {true, false, true, false, true, true}, --Lotus Fan
[64001] = {true, false, true, false, true, true}, --Path of Darkness (Refreshing Path)
[36901] = {true, true, false, false, true, true}, --Power Extraction
[36891] = {true, true, false, false, true, true}, --Sap Essence
[36514] = {true, true, false, false, true, true}, --Soul Harvest
[25863] = {true, true, false, false, true, true}, --Soul Shred
[35460] = {true, true, false, false, true, true}, --Soul Tether
[35462] = {true, false, true, false, true, true}, --Soul Tether
[35465] = {true, true, false, false, true, true}, --Soul Tether
[33291] = {true, true, false, false, true, true}, --Strife
[25260] = {true, true, false, false, true, true}, --Surprise Attack
[34835] = {true, true, false, false, true, true}, --Swallow Soul
[18346] = {true, true, false, false, true, true}, --Teleport Strike
[36052] = {true, false, true, false, true, true}, --Twisting Path
[36490] = {true, false, true, false, true, true}, --Veil of Blades
[25255] = {true, true, false, false, true, true}, --Veiled Strike
[38268] = {true, true, false, false, true, true}, --Deep Slash
[60921] = {true, true, false, false, true, true}, --Deep Slash
[15282] = {true, true, false, true, true, true}, --Heavy Attack
[15829] = {true, true, false, true, true, true}, --Heavy Attack
[38264] = {true, true, false, false, true, true}, --Heroic Slash
[38406] = {true, true, false, false, true, true}, --Invasion
[15435] = {true, true, false, true, true, true}, --Light Attack
[28304] = {true, true, false, false, true, true}, --Low Slash
[38250] = {true, true, false, false, true, true}, --Pierce Armor
[28365] = {true, true, false, false, true, true}, --Power Bash
[38365] = {true, true, false, false, true, true}, --Power Bash
[38452] = {true, true, false, false, true, true}, --Power Slam
[28306] = {true, true, false, false, true, true}, --Puncture
[38256] = {true, true, false, false, true, true}, --Ransack
[38455] = {true, true, false, false, true, true}, --Reverberating Bash
[28721] = {true, true, false, false, true, true}, --Shield Charge
[38402] = {true, true, false, false, true, true}, --Shielded Assault
[21970] = {true, true, false, false, true, true}, --Bash
[21925] = {true, false, true, false, true, true}, --Diseased
[60230] = {true, true, false, false, true, true}, --Riposte
[79025] = {true, false, true, false, true, true}, --Creeping Ravage Health
[81551] = {true, false, true, false, true, true}, --Creeping Ravage Health
[81275] = {true, false, true, false, true, true}, --Creeping Ravage Health (Crown Store)
[79707] = {true, false, true, false, true, true}, --Ravage Health
[81274] = {true, false, true, false, true, true}, --Ravage Health (Crown Store)
[103880] = {true, true, false, false, true, true}, --Spell Orb (magic)
[103881] = {true, true, false, false, true, true}, --Spell Orb (physical)
[103626] = {true, true, false, false, true, true}, --Crushing Weapon
[103572] = {true, true, false, false, true, true}, --Elemental Weapon
[103485] = {true, true, false, false, true, true}, --Imbue Weapon
[16212] = {true, false, true, true, true, true}, --Heavy Attack
[16145] = {true, true, false, true, true, true}, --Light Attack
[23428] = {true, false, true, false, true, true}, --Atronach Zap
[130318] = {true, true, false, false, true, true}, --Bound Armaments
[23214] = {true, false, true, false, true, true}, --Boundless Storm
[23667] = {true, true, false, false, true, true}, --Charged Atronach Impact
[46331] = {true, true, false, false, true, true}, --Crystal Blast
[46333] = {true, true, false, false, true, true}, --Crystal Blast
[46324] = {true, true, false, false, true, true}, --Crystal Fragments
[114716] = {true, true, false, false, true, true}, --Crystal Fragments
[43714] = {true, true, false, false, true, true}, --Crystal Shard
[143804] = {true, true, false, false, true, true}, --Crystal Weapon
[24327] = {true, true, false, false, true, true}, --Daedric Curse
[44507] = {true, true, false, false, true, true}, --Daedric Curse
[25161] = {true, false, true, false, true, true}, --Daedric Minefield
[24829] = {true, false, true, false, true, true}, --Daedric Mines
[24329] = {true, true, false, false, true, true}, --Daedric Prey
[44511] = {true, true, false, false, true, true}, --Daedric Prey
[24843] = {true, false, true, false, true, true}, --Daedric Tomb
[19109] = {true, true, false, false, true, true}, --Endless Fury
[114798] = {true, false, true, true, true, true}, --Energy Overload Heavy Attack
[114773] = {true, true, false, true, true, true}, --Energy Overload Light Attack
[77186] = {true, false, true, false, true, true}, --Familiar Damage Pulse
[108844] = {true, false, true, false, true, true}, --Familiar Damage Pulse
[27850] = {true, true, false, false, true, true}, --Familiar Melee
[23664] = {true, true, false, false, true, true}, --Greater Storm Atronach Impact
[24331] = {true, true, false, false, true, true}, --Haunting Curse
[44515] = {true, true, false, false, true, true}, --Haunting Curse
[29528] = {true, true, false, false, true, true}, --Headbutt
[23232] = {true, false, true, false, true, true}, --Hurricane
[45194] = {true, true, false, false, true, true}, --Implosion (Lightning)
[82806] = {true, true, false, false, true, true}, --Implosion (Physical)
[23208] = {true, false, true, false, true, true}, --Lightning Flood
[23211] = {true, false, true, false, true, true}, --Lightning Form
[23189] = {true, false, true, false, true, true}, --Lightning Splash
[29809] = {true, true, false, false, true, true}, --Lightning Strike
[23202] = {true, false, true, false, true, true}, --Liquid Lightning
[18718] = {true, true, false, false, true, true}, --Mages' Fury
[19123] = {true, true, false, false, true, true}, --Mages' Wrath
[19128] = {true, true, false, false, true, true}, --Mages' Wrath
[24798] = {true, false, true, true, true, true}, --Overload Heavy Attack
[24792] = {true, true, false, true, true, true}, --Overload Light Attack
[24811] = {true, false, true, true, true, true}, --Power Overload Heavy Attack
[114769] = {true, true, false, true, true, true}, --Power Overload Light Attack
[100118] = {true, true, false, false, true, true}, --Rune Cage
[28309] = {true, true, false, false, true, true}, --Shattering Prison
[23659] = {true, true, false, false, true, true}, --Storm Atronach Impact
[23239] = {true, true, false, false, true, true}, --Streak
[28027] = {true, true, false, false, true, true}, --Summon Twilight Kick
[24617] = {true, true, false, false, true, true}, --Summon Twilight Zap
[80435] = {true, false, true, false, true, true}, --Suppression Field
[29529] = {true, true, false, false, true, true}, --Tail Spike
[117320] = {true, true, false, false, true, true}, --Twilight Matriarch Kick
[117321] = {true, true, false, false, true, true}, --Twilight Matriarch Zap
[117273] = {true, true, false, false, true, true}, --Twilight Tormentor Kick
[117274] = {true, true, false, false, true, true}, --Twilight Tormentor Zap
[117255] = {true, true, false, false, true, true}, --Volatile Familiar Melee
[40414] = {true, false, true, false, true, true}, --Shatter Soul
[40420] = {true, false, true, false, true, true}, --Soul Assault
[126894] = {true, false, true, false, true, true}, --Soul Splitting Trap
[126895] = {true, false, true, false, true, true}, --Soul Splitting Trap
[126897] = {true, false, true, false, true, true}, --Soul Splitting Trap
[126898] = {true, false, true, false, true, true}, --Soul Splitting Trap
[39270] = {true, false, true, false, true, true}, --Soul Strike
[126890] = {true, false, true, false, true, true}, --Soul Trap
[126891] = {true, false, true, false, true, true}, --Soul Trap
[18084] = {true, false, true, false, true, true}, --Burning
[21481] = {true, true, false, false, true, true}, --Chill
[21487] = {true, false, true, false, true, true}, --Concussion
[21929] = {true, false, true, false, true, true}, --Poisoned
[77245] = {true, true, false, false, true, true}, --Bite
[41994] = {true, true, false, false, true, true}, --Black Widow
[42007] = {true, false, true, false, true, true}, --Black Widow Poison
[85432] = {true, true, false, false, true, true}, --Combustion
[115572] = {true, true, false, false, true, true}, --Grave Robber
[41839] = {true, true, false, false, true, true}, --Radiate
[41838] = {true, false, true, false, true, true}, --Radiate
[98438] = {true, true, false, false, true, true}, --Shackle Damage
[26800] = {true, true, false, false, true, false}, --Aurora Javelin
[89821] = {true, true, false, false, true, true}, --Backlash
[26804] = {true, true, false, false, true, false}, --Binding Javelin
[26794] = {true, true, false, false, true, true}, --Biting Jabs
[44432] = {true, true, false, false, true, true}, --Biting Jabs
[26871] = {true, false, true, false, true, true}, --Blazing Spear
[26879] = {true, false, true, false, true, true}, --Blazing Spear
[44731] = {true, true, false, false, true, true}, --Burning Light
[80170] = {true, true, false, false, true, true}, --Burning Light
[22139] = {true, true, false, false, true, true}, --Crescent Sweep
[62606] = {true, false, true, false, true, true}, --Crescent Sweep
[22110] = {true, true, false, false, true, true}, --Dark Flare
[22144] = {true, true, false, false, true, true}, --Empowering Sweep
[62598] = {true, false, true, false, true, true}, --Empowering Sweep
[22165] = {true, true, false, false, true, true}, --Explosive Charge
[22155] = {true, true, false, false, true, true}, --Focused Charge
[26859] = {true, false, true, false, true, true}, --Luminous Shards
[95955] = {true, false, true, false, true, true}, --Luminous Shards
[21753] = {true, false, true, false, true, true}, --Nova
[26158] = {true, true, false, false, true, false}, --Piercing Javelin
[27567] = {false, false, false, false, true, false}, --Power of the Light
[89828] = {true, true, false, false, true, true}, --Power of the Light
[26116] = {true, true, false, false, true, true}, --Puncturing Strikes
[44426] = {true, true, false, false, true, true}, --Puncturing Strikes
[44436] = {true, true, false, false, true, true}, --Puncturing Sweep
[26799] = {true, true, false, false, true, true}, --Puncturing Sweep
[27544] = {false, false, false, false, true, false}, --Purifying Light
[89825] = {true, true, false, false, true, true}, --Purifying Light
[22138] = {true, true, false, false, true, true}, --Radial Sweep
[62550] = {true, false, true, false, true, true}, --Radial Sweep
[63952] = {true, false, true, false, true, true}, --Radiant Destruction
[63956] = {true, false, true, false, true, true}, --Radiant Glory
[63961] = {true, false, true, false, true, true}, --Radiant Oppression
[22182] = {true, true, false, false, true, true}, --Radiant Ward
[21732] = {true, true, false, false, true, true}, --Reflective Light
[21734] = {true, false, true, false, true, true}, --Reflective Light
[80172] = {true, false, true, false, true, true}, --Ritual of Retribution
[100218] = {true, false, true, false, true, true}, --Solar Barrage
[21759] = {true, false, true, false, true, true}, --Solar Disturbance
[22057] = {true, true, false, false, true, true}, --Solar Flare
[21756] = {true, false, true, false, true, true}, --Solar Prison
[26192] = {true, false, true, false, true, true}, --Spear Shards
[95931] = {true, false, true, false, true, true}, --Spear Shards
[21726] = {true, true, false, false, true, true}, --Sun Fire
[21728] = {true, false, true, false, true, true}, --Sun Fire
[22178] = {true, true, false, false, true, true}, --Sun Shield
[15544] = {true, true, false, false, true, true}, --Toppling Charge
[127791] = {true, true, false, false, true, true}, --Unstable Core
[127792] = {true, true, false, false, true, true}, --Unstable Core
[127793] = {true, true, false, false, true, true}, --Unstable Core
[21729] = {true, true, false, false, true, true}, --Vampire's Bane
[21731] = {true, false, true, false, true, true}, --Vampire's Bane
[83238] = {true, true, false, false, true, false}, --Berserker Rage
[83216] = {true, true, false, false, true, false}, --Berserker Strike
[38754] = {true, true, false, false, true, true}, --Brawler
[38745] = {true, true, false, false, true, true}, --Carve
[38747] = {true, false, true, false, true, true}, --Carve Bleed
[20919] = {true, true, false, false, true, true}, --Cleave
[28449] = {true, true, false, false, true, true}, --Critical Charge
[38782] = {true, true, false, false, true, true}, --Critical Rush
[38814] = {true, true, false, false, true, true}, --Dizzying Swing
[38819] = {true, true, false, false, true, true}, --Executioner
[45445] = {true, true, false, true, true, double}, --Forceful
[17162] = {true, true, false, true, true, true}, --Heavy Attack
[17163] = {true, true, false, true, true, true}, --Heavy Attack
[45431] = {true, false, true, false, true, true}, --Heavy Weapons Bleed
[16037] = {true, true, false, true, true, true}, --Light Attack
[83229] = {true, true, false, false, true, false}, --Onslaught
[28302] = {true, true, false, false, true, true}, --Reverse Slash
[38823] = {true, true, false, false, true, true}, --Reverse Slice
[38827] = {true, true, false, false, true, double}, --Reverse Slice
[38792] = {true, true, false, false, true, true}, --Stampede
[126474] = {true, false, true, false, true, true}, --Stampede
[28279] = {true, true, false, false, true, true}, --Uppercut
[38807] = {true, true, false, false, true, true}, --Wrecking Blow
[42060] = {true, true, false, false, true, true}, --Inner Beast
[39475] = {true, true, false, false, true, true}, --Inner Fire
[42056] = {true, true, false, false, true, true}, --Inner Rage
[42029] = {true, false, true, false, true, true}, --Mystic Orb
[39299] = {true, false, true, false, true, true}, --Necrotic Orb
[80107] = {true, false, true, false, true, true}, --Shadow Silk
[42141] = {true, true, false, false, true, true}, --Spiked Bone Shield
[80129] = {true, false, true, false, true, true}, --Tangling Webs
[80083] = {true, false, true, false, true, true}, --Trapping Webs
[38956] = {true, true, false, false, true, true}, --Arterial Burst
[38949] = {true, true, false, false, true, true}, --Blood for Blood
[38968] = {true, false, true, false, true, true}, --Blood Mist
[135905] = {true, false, true, false, true, true}, --Drain Vigor
[32893] = {true, true, false, false, true, true}, --Eviscerate
[137259] = {true, false, true, false, true, true}, --Exhilarating Drain
[38935] = {true, false, true, false, true, true}, --Swarming Scion
[134583] = {true, false, true, false, true, true}, --Vampiric Drain
[87256] = {true, false, true, false, true, true}, --Arctic Blast
[130406] = {true, false, true, false, true, true}, --Arctic Blast
[89128] = {true, true, false, false, true, true}, --Crushing Swipe
[89220] = {true, true, false, false, true, true}, --Crushing Swipe
[105907] = {true, true, false, false, true, true}, --Crushing Swipe
[93175] = {true, true, false, false, true, true}, --Crystallized Slab
[85999] = {true, true, false, false, true, true}, --Cutting Dive
[94424] = {true, true, false, false, true, true}, --Deep Fissure
[85995] = {true, true, false, false, true, true}, --Dive
[101904] = {true, false, true, false, true, true}, --Fetcher Infection
[108949] = {true, false, true, false, true, true}, --Frozen Device
[108948] = {true, false, true, false, true, true}, --Frozen Gate
[108950] = {true, false, true, false, true, true}, --Frozen Retreat
[88791] = {true, false, true, false, true, true}, --Gripping Shards
[101948] = {true, false, true, false, true, true}, --Growing Swarm
[101944] = {true, false, true, false, true, true}, --Growing Swarm
[92160] = {true, true, false, false, true, true}, --Guardian's Savagery
[91974] = {true, true, false, false, true, true}, --Guardian's Wrath
[105921] = {true, true, false, false, true, true}, --Guardian's Wrath
[88783] = {true, false, true, false, true, true}, --Impaling Shards
[88860] = {true, false, true, false, true, true}, --Northern Storm
[88863] = {true, true, false, false, true, true}, --Permafrost
[94411] = {true, true, false, false, true, true}, --Scorch
[86003] = {true, true, false, false, true, true}, --Screaming Cliff Racer
[86247] = {true, false, true, false, true, true}, --Sleet Storm
[94445] = {true, true, false, false, true, true}, --Subterranean Assault
[101703] = {true, false, true, false, true, true}, --Swarm
[89135] = {true, true, false, false, true, true}, --Swipe
[89219] = {true, true, false, false, true, true}, --Swipe
[105906] = {true, true, false, false, true, true}, --Swipe
[88802] = {true, false, true, false, true, true}, --Winters Revenge
[137184] = {true, false, true, false, true, true}, --Brutal Carnage
[39109] = {true, true, false, false, true, true}, --Brutal Pounce
[137156] = {true, false, true, false, true, true}, --Carnage
[58864] = {true, true, false, false, true, true}, --Claws of Anguish
[58865] = {true, false, true, false, true, true}, --Claws of Anguish
[58879] = {true, true, false, false, true, true}, --Claws of Life
[58880] = {true, false, true, false, true, true}, --Claws of Life
[137164] = {true, false, true, false, true, true}, --Feral Carnage
[39107] = {true, true, false, false, true, true}, --Feral Pounce
[80189] = {true, true, false, false, true, true}, --Gnash
[80190] = {true, true, false, false, true, true}, --Gnash
[32480] = {true, true, false, true, true, true}, --Heavy Attack Werewolf
[32494] = {true, true, false, true, true, true}, --Heavy Attack Werewolf Splash
[58798] = {true, true, false, false, true, true}, --Howl of Agony
[58742] = {true, true, false, false, true, true}, --Howl of Despair
[58855] = {true, true, false, false, true, true}, --Infectious Claws
[58856] = {true, false, true, false, true, true}, --Infectious Claws
[32464] = {true, true, false, true, true, true}, --Light Attack Werewolf
[80184] = {true, true, false, false, true, true}, --Lunge
[32479] = {true, true, false, true, true, true}, --Medium Attack Werewolf
[58405] = {true, true, false, false, true, true}, --Piercing Howl
[32645] = {true, true, false, false, true, true}, --Pounce
[89147] = {true, false, true, false, true, true}, --Werewolf Berserker Bleed
}
function GetConstellationAbilityData()
return AbilityData
end
|
buffer = Procedural.TextureBuffer(128)
Procedural.Cloud(buffer):process()
Procedural.Lerp(buffer):setImageA(bufferGradient):setImageB(bufferCellNormal):process()
tests:addTextureBuffer(buffer)
dotfile = tests:getDotFile("texture_18", "Lerp_Demo")
dotfile:set("Cloud", "texture_cloud", "Gradient", "texture_gradient", "Lerp", "texture_lerp")
dotfile:add("Cell", "texture_cell_smooth")
dotfile:bind(4, 3)
|
--[=[
Tracks a parent bound to a specific binder
@class BoundParentTracker
]=]
local require = require(script.Parent.loader).load(script)
local BaseObject = require("BaseObject")
local ValueObject = require("ValueObject")
local BoundParentTracker = setmetatable({}, BaseObject)
BoundParentTracker.ClassName = "BoundParentTracker"
BoundParentTracker.__index = BoundParentTracker
function BoundParentTracker.new(binder, child)
local self = setmetatable(BaseObject.new(), BoundParentTracker)
self._child = child or error("No child")
self._binder = binder or error("No binder")
-- Bound value
self.Class = ValueObject.new()
self._maid:GiveTask(self.Class)
-- Handle instance removing
self._maid:GiveTask(self._binder:GetClassRemovingSignal():Connect(function(class)
if class == self.Class.Value then
self.Class.Value = nil
end
end))
-- Perform update
self._maid:GiveTask(self._child:GetPropertyChangedSignal("Parent"):Connect(function()
self:_update()
end))
self:_update()
return self
end
function BoundParentTracker:_update()
local parent = self._child.Parent
if not parent then
self.Class.Value = nil
return
end
self.Class.Value = self._binder:Get(parent)
end
return BoundParentTracker
|
local fs = require "nixio.fs"
local conffile = "/etc/dnsfilter/black.list"
f = SimpleForm("custom")
t = f:field(TextValue, "conf")
t.rmempty = true
t.rows=13
t.description = translate("Will Always block these Domain")
function t.cfgvalue()
return fs.readfile(conffile) or ""
end
function f.handle(self,state,data)
if state == FORM_VALID then
if data.conf then
fs.writefile(conffile,data.conf:gsub("\r\n","\n"))
else
luci.sys.call("> /etc/dnsfilter/black.list")
end
luci.sys.exec("[ \"$(uci -q get dnsfilter.@dnsfilter[0].enable)\" = 1 ] && /etc/init.d/dnsfilter restart")
end
return true
end
return f
|
local Players = GAMESTATE:GetHumanPlayers()
local IsUltraWide = (GetScreenAspectRatio() > 21/9)
local ShouldDisplayStatsForPlayer = function(player)
local pn = ToEnumShortString(player)
return SL[pn].ActiveModifiers.DataVisualizations == "Step Statistics"
end
local ShouldDisplayStats = function()
-- Ultrawide versus is already supported natively.
if IsUltraWide then return false end
-- Only use this in Versus + Widescreen.
if GAMESTATE:GetCurrentStyle():GetName() ~= "versus" or not IsUsingWideScreen() then
return false
end
local shouldDisplay = false
for player in ivalues(Players) do
if ShouldDisplayStatsForPlayer(player) then
shouldDisplay = true
end
end
return shouldDisplay
end
if not ShouldDisplayStats() then
return
end
local af = Def.ActorFrame{
InitCommand=function(self)
self:Center()
end
}
for player in ivalues(Players) do
if ShouldDisplayStatsForPlayer(player) and #Players > 1 then
local pn = tonumber(player:sub(-1))
af[#af+1] = Def.Quad{
InitCommand=function(self)
self:diffuse(Color.Black)
self:zoomto(150, SCREEN_HEIGHT)
end,
}
end
end
for player in ivalues(Players) do
if ShouldDisplayStatsForPlayer(player) and #Players > 1 then
-- No need to reimplement the wheel here. Just use the existing actor and modify it for our use case.
local judgments = LoadActor("../PerPlayer/StepStatistics/TapNoteJudgments.lua", {player, false})
judgments.InitCommand = function(self)
local StepsOrTrail = (GAMESTATE:IsCourseMode() and GAMESTATE:GetCurrentTrail(player)) or GAMESTATE:GetCurrentSteps(player)
local total_tapnotes = StepsOrTrail:GetRadarValues(player):GetValue( "RadarCategory_Notes" )
-- determine how many digits are needed to express the number of notes in base-10
local digits = (math.floor(math.log10(total_tapnotes)) + 1)
-- display a minimum 4 digits for aesthetic reasons
digits = math.max(4, digits)
self:zoom(0.8)
self:y(100)
self:x(65 * (player==PLAYER_1 and -1 or 1) + 1)
if digits > 4 then
-- This works okay enough for 5 and 6 digits.
self:zoomx(self:GetZoomX() - 0.12 * (digits-4))
end
end
af[#af+1] = judgments
-- Add a score to Step Stats if it's hidden by the NPS graph.
if SL[ToEnumShortString(player)].ActiveModifiers.NPSGraphAtTop then
local pn = ToEnumShortString(player)
local IsEX = SL[pn].ActiveModifiers.ShowEXScore
af[#af+1] = LoadFont("Wendy/_wendy monospace numbers")..{
Text="0.00",
InitCommand=function(self)
self:valign(1):horizalign(right)
self:zoom(0.25)
if player == PLAYER_1 then
self:xy(-7, -150)
else
self:xy(65, -150)
end
if IsEX then
-- If EX Score, let's diffuse it to be the same as the FA+ top window.
-- This will make it consistent with the EX Score Pane.
self:diffuse(SL.JudgmentColors["FA+"][1])
end
end,
JudgmentMessageCommand=function(self, params)
if params.Player ~= player then return end
if not IsEX then
local pss = STATSMAN:GetCurStageStats():GetPlayerStageStats(player)
local dance_points = pss:GetPercentDancePoints()
local percent = FormatPercentScore( dance_points ):sub(1,-2)
self:settext(percent)
end
end,
ExCountsChangedMessageCommand=function(self, params)
if params.Player ~= player then return end
if IsEX then
self:settext(("%.02f"):format(params.ExScore))
end
end,
}
end
end
end
af[#af+1] = Def.Banner{
CurrentSongChangedMessageCommand=function(self)
self:LoadFromSong( GAMESTATE:GetCurrentSong() )
self:setsize(418,164):zoom(0.3):addy(70)
end
}
return af
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.