content
stringlengths 5
1.05M
|
|---|
RegisterItem({
category = "Cards",
name = "Waifu Booster Pack",
weight = 0.01,
stack = 32,
pack = "booster",
count = 5,
})
RegisterItem({
category = "Cards",
name = "Card: Hanaba Izuri",
weight = 0.00165,
stack = 1,
})
RegisterItem({
category = "Cards",
name = "Card: Miyabata Hirona",
weight = 0.00165,
stack = 1,
})
RegisterItem({
category = "Cards",
name = "Card: Akashi Tomiyoko",
weight = 0.00165,
stack = 1,
})
|
local t = require( "taptest" )
local addedge = require( "addedge" )
local buildgraph = require( "buildgraph" )
local isolatednodes = require( "isolatednodes" )
local like = require( "like" )
local g = buildgraph( { "a", "b", "c", "x" }, {} )
t( like( isolatednodes( g ), { "a", "b", "c", "x" } ), true )
addedge( g, "a", "x" )
-- a --> x
-- [ b ] [ c ]
t( like( isolatednodes( g ), { "b", "c" } ), true )
addedge( g, "b", "c" )
-- a --> x
-- b --> c
t( like( isolatednodes( g ), {} ), true )
t()
|
local class = require 'me.strangepan.libs.util.v1.class'
local assert_that = require 'me.strangepan.libs.truth.v1.assert_that'
--[[ A handy way to require a module lazily.
Usage:
local lazy = require 'me.strangepan.libs.util.v1.lazy'
local lazy_my_module = lazy 'my.custom.module'
function do_something()
lazy_my_module:get().do_some_other_thing()
end
You can even omit the ':get' altogether:
function do_something()
lazy_my_module().do_some_other_thing()
end
You can even replace the 'require' function used by this class:
lazy.require_function = function(requirement)
-- Spy on requirements loaded lazyily by printing the requirement to std out
print(requirement)
return require(requirement)
end
]]
local lazy = class.build()
lazy.require_function = require
function lazy:_init(requirement)
self.requirement = assert_that(requirement):is_a_string():and_return()
-- Make it so that users don't even have to reference the get() method explicitly
local new_metatable = {}
new_metatable.__index = lazy
new_metatable.__call = function()
return self:get()
end
setmetatable(new_metatable, lazy)
setmetatable(self, new_metatable)
end
function lazy:get()
return lazy.require_function(self.requirement)
end
return lazy
|
local TableUtils
local Output
local Mesh = {
ClassName = "Mesh",
Events = {}
}
-- These do not actually count the number of faces, lines, or vertices, they are used internally for Id assignment, use #TableUtils.getKeys() for counting
Mesh.Private = {
-- FacesCount = 0,
LinesCount = 0,
VerticesCount = 0,
}
Mesh.Readable = {
-- Faces = {},
Lines = {},
Vertices = {},
VerticesVec3 = {}
}
Mesh.Writable = {}
--[[
-- Creates a face from VertexId's
function Mesh:AddFace(...)
self.FacesCount += 1
local faceId = tostring(self.FacesCount)
self.Faces[faceId] = {}
self:AddVerticesToFace(faceId, ...)
end
-- Deletes a face given the FaceId
function Mesh:DeleteFace(faceId)
local face = self.Faces[faceId]
Output.assert(faceId, "FaceId %s is not a face", faceId)
for _,vertexId in pairs(face) do
TableUtils.remove(self.Vertices[vertexId].Faces, faceId)
end
self.Faces[faceId] = nil
end
-- Adds vertices to a face
function Mesh:AddVerticesToFace(faceId, ...)
local face = self.Faces[faceId]
Output.assert(faceId, "FaceId %s is not a face", faceId)
for _,vertexId in pairs(...) do
local vertex = self.Vertices[vertexId]
Output.assert(vertex, "VertexId %s is not a vertex", vertexId)
table.insert(face, vertexId)
table.insert(vertex.Faces, faceId)
end
end
]]
-- Creates a line from 2 VertexId's and returns the LineId
function Mesh:AddLine(vertexId1, vertexId2)
local vertex1
local vertex2
if type(vertexId1) == "number" then
vertexId1 = tostring(vertexId1)
vertex1 = self.Vertices[vertexId1]
elseif type(vertexId1) == "string" then
vertex1 = self.Vertices[vertexId1]
elseif typeof(vertex1) == "Vector3" then
vertex1 = self.VerticesVec3[vertexId1]
end
if type(vertexId2) == "number" then
vertexId2 = tostring(vertexId2)
vertex2 = self.Vertices[vertexId2]
elseif type(vertexId2) == "string" then
vertex2 = self.Vertices[vertexId2]
elseif typeof(vertexId2) == "Vector3" then
vertex2 = self.VerticesVec3[vertexId2]
end
Output.assert(vertex1, "VertexId %s is not a vertex", tostring(vertexId1), 1)
Output.assert(vertex2, "VertexId %s is not a vertex", tostring(vertexId2), 1)
if vertexId1 == vertexId2 then
-- Same vertices provided for both arguments
return
end
local lineId = vertex1.Lines[vertexId2] or vertex2.Lines[vertexId1]
if lineId then
-- The line already exists
return lineId
end
self.LinesCount += 1
lineId = tostring(self.LinesCount)
self.Lines[lineId] = {vertexId1, vertexId2}
vertex1.Lines[vertexId2] = lineId
vertex2.Lines[vertexId1] = lineId
return lineId
end
-- Deletes a line from LineId
function Mesh:DeleteLine(lineId)
lineId = tostring(lineId)
local line = self.Lines[lineId]
Output.assert(line, "LineId %s is not a line", lineId, 1)
local vertexId1 = line[1]
local vertexId2 = line[2]
local vertex1 = self.Vertices[vertexId1]
local vertex2 = self.Vertices[vertexId2]
vertex1.Lines[vertexId2] = nil
vertex2.Lines[vertexId1] = nil
self.Lines[lineId] = nil
end
-- Creates a new vertex and returns the VertexId
function Mesh:AddVertex(pos)
Output.assert(typeof(pos) == "Vector3", "%s is not a Vector3", pos, 1)
local vertexId = self.VerticesVec3[pos]
if vertexId then
return vertexId
end
self.VerticesCount += 1
local vertex = {
VertexId = tostring(self.VerticesCount),
Position = pos,
--Faces = {},
Lines = {}
}
self.Vertices[vertex.VertexId] = vertex
self.VerticesVec3[pos] = vertex.VertexId
return vertex.VertexId
end
-- Deletes a vertex from VertexId
function Mesh:DeleteVertex(vertexId)
vertexId = tostring(vertexId)
local vertex = self.Vertices[vertexId]
Output.assert(vertex, "VertexId %s is not a vertex", vertexId, 1)
for _,lineId in pairs(vertex.Lines) do
self:DeleteLine(lineId)
end
--[[
for _,faceId in pairs(vertex.Faces) do
self:DeleteFace(faceId)
end
]]
self.Vertices[vertexId] = nil
end
-- Always merges vertex 2 into vertex 1
function Mesh:MergeVertices(vertexId1, vertexId2)
vertexId1 = tostring(vertexId1)
vertexId2 = tostring(vertexId2)
local vertex1 = self.Vertices[vertexId1]
local vertex2 = self.Vertices[vertexId2]
Output.assert(vertex1, "VertexId %s is not a vertex", vertexId1, 1)
Output.assert(vertex2, "VertexId %s is not a vertex", vertexId2, 1)
for vertexId in pairs(vertex2.Lines) do
self:AddLine(vertexId, vertexId1)
end
self:DeleteVertex(vertexId2)
end
-- Sets the position of a vertex from the VertexId
function Mesh:SetVertexPosition(vertexId, pos)
vertexId = tostring(vertexId)
local vertex = self.Vertices[vertexId]
Output.assert(vertex, "VertexId %s is not a vertex", vertexId, 1)
Output.assert(typeof(pos) == "Vector3", "%s is not a Vector3", pos, 1)
vertex.Position = pos
end
-- Deletes the line between 2 vertices given 2 VertexId's
function Mesh:UnlinkVertices(vertexId1, vertexId2)
vertexId1 = tostring(vertexId1)
vertexId2 = tostring(vertexId2)
local vertex1 = self.Vertices[vertexId1]
Output.assert(vertex1, "VertexId %s is not a vertex", vertexId1, 1)
self:DeleteLine(vertex1.Lines[vertexId2])
end
function Mesh:GetLinkedVertices(vertexId)
vertexId = tostring(vertexId)
local vertex = self.Vertices[vertexId]
Output.assert(vertex, "VertexId %s is not a vertex", vertexId, 1)
return TableUtils.getKeys(vertex.Lines)
end
function Mesh:GetVertices()
return TableUtils.getValues(self.Vertices)
end
function Mesh:GetLines()
return TableUtils.getValues(self.Lines)
end
-- Returns vertices within the radius of the given position
function Mesh:GetVerticesInRadius(pos, radius)
Output.assert(typeof(pos) == "Vector3", "%s is not a Vector3", pos, 1)
Output.assert(type(radius) == "number", "%s is not a number", radius, 1)
local vertices = {}
for _,vertex in pairs(self.Vertices) do
if (vertex.Position - pos).Magnitude < radius then
table.insert(vertices, vertex)
end
end
return vertices
end
-- Returns vertices in order of distance of the given position
function Mesh:GetVerticesByDistance(pos)
Output.assert(typeof(pos) == "Vector3", "%s is not a Vector3", pos, 1)
local vertices = TableUtils.getValues(self.Vertices)
table.sort(vertices, function(a, b)
return (a.Position - pos).Magnitude < (b.Position - pos).Magnitude
end)
return vertices
end
-- Returns all vertices in an array of Vector3's
function Mesh:GetVerticesAsVector3()
local vertices = {}
for _,vertex in pairs(self.Vertices) do
table.insert(vertices, vertex.Position)
end
return vertices
end
-- Returns all lines in an array of arrays containing the start and end of the line as a Vector3
function Mesh:GetLinesAsVector3()
local lines = {}
for _,line in pairs(self.Lines) do
table.insert(lines, {
self.Vertices[line[1]].Position,
self.Vertices[line[2]].Position,
})
end
return lines
end
function Mesh:MergeVerticesByDistance(distance, mergeMode)
local merges = 0
for _,vertex1 in pairs(self.Vertices) do
local vertices = self:GetVerticesInRadius(vertex1.Position, distance)
for i = 2, #vertices do
local vertex2 = vertices[i]
if vertex1 ~= vertex2 then
merges += 1
self:MergeVertices(vertex1.VertexId, vertex2.VertexId)
end
end
end
return merges
end
function Mesh:Translate(vec3)
if type(vec3) == "number" then
vec3 = Vector3.new(vec3, vec3, vec3)
end
Output.assert(typeof(vec3) == "Vector3", "%s is not a Vector3", vec3, 1)
for _,vertex in pairs(self.Vertices) do
self:SetVertexPosition(vertex.VertexId, vertex.Position + vec3)
end
return self
end
function Mesh:Scale(vec3)
Output.assert(typeof(vec3) == "Vector3" or type(vec3) == "number", "%s is not a Vector3 or number", vec3, 1)
for _,vertex in pairs(self.Vertices) do
self:SetVertexPosition(vertex.VertexId, vertex.Position * vec3)
end
return self
end
function Mesh:start()
TableUtils = self:Load("Deus.TableUtils")
Output = self:Load("Deus.Output")
return self:Load("Deus.BaseObject").new(self)
end
return Mesh
|
--[[
MIT License
Copyright (c) 2020 Srijan Paul
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 Vector2 = {}
Vector2.__add =
function(v1, v2) return Vector2:new(v1.x + v2.x, v1.y + v2.y) end
Vector2.__mul = function(v1, v2)
if type(v1) == 'number' then return Vector2:new(v1 * v2.x, v1 * v2.y) end
if type(v2) == 'number' then return Vector2:new(v2 * v1.x, v2 * v1.y) end
return Vector2:new(v1.x * v2.x, v1.y * v2.y)
end
Vector2.__sub =
function(v1, v2) return Vector2:new(v1.x - v2.x, v1.y - v2.y) end
Vector2.__unm = function(v) return Vector2:new(-v.x, -v.y) end
Vector2.__eq = function(v1, v2) return v1.x == v2.x and v1.y == v2.y end
Vector2.__tostring =
function(v) return '{x = ' .. v.x .. ', y = ' .. v.y .. '}' end
Vector2.__lt = function(v1, v2) return v1:mag() < v2:mag() end
Vector2.__le = function(v1, v2) return v1:mag() <= v2:mag() end
Vector2.__gt = function(v1, v2) return v1:mag() < v2:mag() end
Vector2.__ge = function(v1, v2) return v1:mag() >= v2:mag() end
function Vector2:new(_x, _y)
local newVec = {}
assert(type(_x) == 'number' and type(_y) == 'number',
'Expected number as vector dimension')
newVec.x, newVec.y = _x, _y
self.__index = self
return setmetatable(newVec, self)
end
function Vector2.from_polar(r, theta)
return Vector2:new(r * math.cos(theta), r * math.sin(theta))
end
function Vector2:mag()
return math.sqrt(self.x * self.x + self.y * self.y)
end
function Vector2:scale(sx, sy)
self.x = self.x * sx
self.y = self.y * (sy or sx)
end
function Vector2:scaled(sx, sy)
return Vec2:new(self.x * sx, self.y * (sy or sx))
end
function Vector2:normalized()
local root = math.sqrt(self.x * self.x + self.y * self.y)
if root == 0 then return Vector2:new(0, 0) end
return Vector2:new(self.x / root, self.y / root)
end
function Vector2:rotated(angle, origin)
-- https://matthew-brett.github.io/teaching/rotation_2d.html for reference
local x, y = self.x, self.y
local cos_a = math.cos(angle)
local sin_a = math.sin(angle)
if origin then
x = x - origin.x
y = y - origin.y
end
local x2 = cos_a * x - sin_a * y
local y2 = sin_a * x + cos_a * y
return Vector2:new(x2, y2)
end
function Vector2:rotate(angle, origin)
local x, y = self.x, self.y
local cos_a = math.cos(angle)
local sin_a = math.sin(angle)
if origin then
x = x - origin.x
y = origin.y - y
end
self.x = cos_a * x - sin_a * y
self.y = sin_a * x + cos_a * y
end
function Vector2:set_mag(n)
local root = math.sqrt(self.x * self.x + self.y * self.y)
self.x = n * (self.x / root)
self.y = n * (self.y / root)
end
function Vector2:with_mag(n)
local root = math.sqrt(self.x * self.x + self.y * self.y)
local x = n * (self.x / root)
local y = n * (self.y / root)
return Vector2:new(x, y)
end
function Vector2.random_unit()
local x = math.random(-10, 10)
local y = math.random(-10, 10)
local vec = Vector2:new(x, y)
vec:set_mag(1)
return vec
end
function Vector2:angle(vec)
if vec then
return math.atan2(self.y, self.x) - math.atan2(vec.y, vec.x)
end
return math.atan2(self.y, self.x)
end
function Vector2:angle_to(vec)
return math.atan2(self.y, self.x) - math.atan2(vec.y, vec.x)
end
function Vector2:clone()
return Vector2:new(self.x, self.y)
end
function Vector2:unpack()
return self.x, self.y
end
-- test code
-- local v1 = Vector2:new(1, 1)
-- local v2 = Vector2:new(1, 2)
-- print(v2 * 2)
Vector2.LEFT = function() return Vector2:new(-1, 0) end
Vector2.RIGHT = function() return Vector2:new(1, 0) end
Vector2.UP = function() return Vector2:new(0, -1) end
Vector2.DOWN = function() return Vector2:new(0, 1) end
Vector2.ZERO = function() return Vector2:new(0, 0) end
return setmetatable(Vector2, {
__call = function(_, x, y)
return Vector2:new(x, y)
end
})
|
function createItem(owner, ownerType, name, type, val1, val2, flag)
local UID = 1
for i, v in ipairs(itemsData) do
UID = i + 1
if not itemsData[i] then
UID = i
break
end
end
itemsData[UID] = {}
itemsData[UID].id = UID
itemsData[UID].ownerType = ownerType
itemsData[UID].ownerID = owner
itemsData[UID].type = type
itemsData[UID].value1 = val1
itemsData[UID].value2 = val2
itemsData[UID].flag = flag
itemsData[UID].posX = 0
itemsData[UID].posY = 0
itemsData[UID].posZ = 0
itemsData[UID].interior = 0
itemsData[UID].dimension = 0
itemsData[UID].used = false
itemsData[UID].name = name
itemsData[UID].lastupdate = getRealTime().timestamp
exports.sarp_mysql:mysql_change("INSERT INTO `sarp_items` SET `id` = ?, `ownerType` = ?, `ownerID` = ?, `type` = ?, `value1` = ?, `value2` = ?, `flag` = ?, `name` = ?, `lastupdate` = ?",
itemsData[UID].id,
itemsData[UID].ownerType,
itemsData[UID].ownerID,
itemsData[UID].type,
itemsData[UID].value1,
itemsData[UID].value2,
itemsData[UID].flag,
itemsData[UID].name,
itemsData[UID].lastupdate)
outputServerLog( "Utworzono przedmiot o UID: ".. UID )
end
function deleteItem(id)
itemsData[id] = nil
exports.sarp_mysql:mysql_change("DELETE FROM `sarp_items` WHERE `id`= ?", id)
end
function saveItem(itemid, what)
if what == 'owner' then
exports.sarp_mysql:mysql_change("UPDATE `sarp_items` SET `ownerID` = ?, `ownerType` = ?, `lastupdate` = ? WHERE `id` = ?",
itemsData[itemid].ownerID,
itemsData[itemid].ownerType,
itemsData[itemid].lastupdate,
itemid)
elseif what == 'pos' then
exports.sarp_mysql:mysql_change("UPDATE `sarp_items` SET `posX` = ?, `posY` = ?, `posZ` = ?, `interior` = ?, `dimension` = ? WHERE `id` = ?",
itemsData[itemid].posX,
itemsData[itemid].posY,
itemsData[itemid].posZ,
itemsData[itemid].interior,
itemsData[itemid].dimension,
itemid)
elseif what == 'other' then
exports.sarp_mysql:mysql_change("UPDATE `sarp_items` SET `name` = ?, `type` = ?, `value1` = ?, `value2` = ? WHERE `id` = ?",
itemsData[itemid].name,
itemsData[itemid].type,
itemsData[itemid].value1,
itemsData[itemid].value2,
itemid)
end
end
function isItemOwner(playerid, itemid)
if itemsData[itemid] and itemsData[itemid].ownerType == 1 and itemsData[itemid].ownerID == getElementData(playerid, "player:id") then
return true
end
return false
end
function getItemsData(ownerType, ownerID)
local items = {}
for i, v in pairs(itemsData) do
if v.ownerID == ownerID and v. ownerType == ownerType then
table.insert(items, v)
end
end
return items
end
function getItemData(id, data)
if itemsData[id] then
if type(data) == 'table' then
local itemData = {}
for i, v in ipairs(data) do
itemData[v] = itemsData[id][v]
end
return itemData
else
return itemsData[id][data]
end
end
return false
end
function setItemData(itemid, data, value, save)
if itemsData[itemid] then
if type(data) ~= 'table' then
itemsData[itemid][data] = value
else
for i, v in pairs(data) do
itemsData[itemid][i] = v
end
end
saveItem(itemid, save)
return true
end
return false
end
function isPlayerUseItem(playerid, type)
for i, v in pairs(itemsData) do
if v.used and v.type == type then
return true
end
end
return false
end
local handgunList = {0, 1, 2, 4, 8, 9, 10, 11, 12}
function isItemHandgun(weaponID)
local slot = getSlotFromWeapon( weaponID )
local isHandgun = false
for i, v in ipairs(handgunList) do
if slot == v then
isHandgun = true
break
end
end
return isHandgun
end
function getPlayerItemWeapons(playerid)
local weaponData = {}
local id = getElementData(playerid, "player:id")
for i, v in pairs(itemsData) do
if v.ownerID == id and v.type == 1 and v.ownerType == 1 then
table.insert(weaponData, v)
end
end
if #weaponData == 0 then return false end
return weaponData
end
function getPlayerBoneObjects(playerid)
local objectList = {}
if objectData[playerid] then
for i, v in pairs(objectData[playerid]) do
if v.objectid then
table.insert(objectList, v.objectid)
end
end
return objectList
end
return false
end
function getPlayerDisc(playerid)
local discData = {}
local id = getElementData(playerid, "player:id")
for i, v in pairs(itemsData) do
if v.ownerID == id and v.type == 13 and v.value1 == 1 then
table.insert(discData, v)
end
end
if #discData == 0 then return false end
return discData
end
function noAmmo(weaponid)
for i, v in ipairs({0, 1, 10, 11, 12}) do
if getSlotFromWeapon( weaponid ) then
return true
end
end
return false
end
function getItemWorldPosition(type, value1, pX, pY, pZ, rX, rY, rZ)
if type == 1 then
if value1 == 1 then
model = 331
elseif value1 == 2 then
model = 333
elseif value1 == 3 then
model = 334
elseif value1 == 4 then
model = 335
elseif value1 == 5 then
model = 336
elseif value1 == 6 then
model = 337
elseif value1 == 7 then
model = 338
elseif value1 == 8 then
model = 339
elseif value1 == 9 then
model = 341
elseif value1 == 10 then
model = 321
elseif value1 == 11 then
model = 322
elseif value1 == 12 then
model = 323
elseif value1 == 14 then
model = 325
elseif value1 == 15 then
model = 326
elseif value1 == 16 then
model = 342
elseif value1 == 17 then
model = 343
elseif value1 == 18 then
model = 344
elseif value1 == 22 then
model = 346
elseif value1 == 23 then
model = 347
elseif value1 == 24 then
model = 348
elseif value1 == 25 then
model = 349
elseif value1 == 26 then
model = 350
elseif value1 == 27 then
model = 351
elseif value1 == 28 then
model = 352
elseif value1 == 29 then
model = 353
elseif value1 == 30 then
model = 355
elseif value1 == 31 then
model = 356
elseif value1 == 32 then
model = 372
elseif value1 == 33 then
model = 357
elseif value1 == 34 then
model = 358
elseif value1 == 35 then
model = 359
elseif value1 == 36 then
model = 360
elseif value1 == 37 then
model = 361
elseif value1 == 38 then
model = 362
elseif value1 == 39 then
model = 363
elseif value1 == 40 then
model = 364
elseif value1 == 41 then
model = 365
elseif value1 == 42 then
model = 366
elseif value1 == 43 then
model = 367
elseif value1 == 44 then
model = 368
elseif value1 == 45 then
model = 369
elseif value1 == 46 then
model = 371
end
return {model, pX + 0, pY + 0, pZ - 1, 98, 55, -21}
elseif type == 2 then
return {2672, pX + 0, pY + 0, pZ - 0.75, 0, 0, 90}
elseif type == 5 then
return {2710, pX + 0, pY + 0, pZ - 0.9, 0, 0, 0}
elseif type == 7 then
return {2843, pX + 0, pY + 0, pZ - 1.0, 0, 0, 0}
elseif type == 11 then
return {1486, pX + 0, pY + 0, pZ - 0.8, 0, 0, 0}
elseif type == 12 then
return {1650, pX + 0, pY + 0, pZ - 1.0, 90, 0, 0}
elseif type == 13 then
return {1960, pX + 0, pY + 0, pZ - 1.0, 90, 0, 0}
elseif type == 14 then
return {2226, pX + 0, pY + 0, pZ - 1.0, 0, 0, 0}
else
return {328, pX + 0, pY + 0, pZ - 1, 90, 0, 0}
end
end
|
local help_message = [[
This is a module file for the container quay.io/biocontainers/eoulsan:2.0_beta4--1, which exposes the
following programs:
- .java-jdk-post-link.sh
- .java-jdk-pre-unlink.sh
- appletviewer
- eoulsan.sh
- extcheck
- idlj
- jar
- jarsigner
- java-rmi.cgi
- javac
- javadoc
- javah
- javap
- jcmd
- jconsole
- jdb
- jdeps
- jhat
- jinfo
- jmap
- jps
- jrunscript
- jsadebugd
- jstack
- jstat
- jstatd
- native2ascii
- rmic
- schemagen
- serialver
- wsgen
- wsimport
- xjc
This container was pulled from:
https://quay.io/repository/biocontainers/eoulsan
If you encounter errors in eoulsan or need help running the
tools it contains, please contact the developer at
https://quay.io/repository/biocontainers/eoulsan
For errors in the container or module file, please
submit a ticket at
gzynda@tacc.utexas.edu
https://portal.tacc.utexas.edu/tacc-consulting
]]
help(help_message,"\n")
whatis("Name: eoulsan")
whatis("Version: ctr-2.0_beta4--1")
whatis("Category: ['Bioinformatics']")
whatis("Keywords: ['Biocontainer']")
whatis("Description: The eoulsan package")
whatis("URL: https://quay.io/repository/biocontainers/eoulsan")
set_shell_function(".java-jdk-post-link.sh",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg .java-jdk-post-link.sh $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg .java-jdk-post-link.sh $*')
set_shell_function(".java-jdk-pre-unlink.sh",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg .java-jdk-pre-unlink.sh $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg .java-jdk-pre-unlink.sh $*')
set_shell_function("appletviewer",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg appletviewer $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg appletviewer $*')
set_shell_function("eoulsan.sh",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg eoulsan.sh $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg eoulsan.sh $*')
set_shell_function("extcheck",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg extcheck $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg extcheck $*')
set_shell_function("idlj",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg idlj $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg idlj $*')
set_shell_function("jar",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jar $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jar $*')
set_shell_function("jarsigner",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jarsigner $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jarsigner $*')
set_shell_function("java-rmi.cgi",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg java-rmi.cgi $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg java-rmi.cgi $*')
set_shell_function("javac",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg javac $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg javac $*')
set_shell_function("javadoc",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg javadoc $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg javadoc $*')
set_shell_function("javah",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg javah $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg javah $*')
set_shell_function("javap",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg javap $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg javap $*')
set_shell_function("jcmd",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jcmd $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jcmd $*')
set_shell_function("jconsole",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jconsole $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jconsole $*')
set_shell_function("jdb",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jdb $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jdb $*')
set_shell_function("jdeps",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jdeps $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jdeps $*')
set_shell_function("jhat",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jhat $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jhat $*')
set_shell_function("jinfo",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jinfo $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jinfo $*')
set_shell_function("jmap",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jmap $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jmap $*')
set_shell_function("jps",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jps $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jps $*')
set_shell_function("jrunscript",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jrunscript $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jrunscript $*')
set_shell_function("jsadebugd",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jsadebugd $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jsadebugd $*')
set_shell_function("jstack",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jstack $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jstack $*')
set_shell_function("jstat",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jstat $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jstat $*')
set_shell_function("jstatd",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jstatd $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg jstatd $*')
set_shell_function("native2ascii",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg native2ascii $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg native2ascii $*')
set_shell_function("rmic",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg rmic $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg rmic $*')
set_shell_function("schemagen",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg schemagen $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg schemagen $*')
set_shell_function("serialver",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg serialver $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg serialver $*')
set_shell_function("wsgen",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg wsgen $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg wsgen $*')
set_shell_function("wsimport",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg wsimport $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg wsimport $*')
set_shell_function("xjc",'singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg xjc $@','singularity exec ${BIOCONTAINER_DIR}/biocontainers/eoulsan/eoulsan-2.0_beta4--1.simg xjc $*')
|
Script.Load("lua/FadeAcidRocket/AcidRocket.lua")
local kRocketVelocity = 25
local kAttackDuration = Shared.GetAnimationLength("models/alien/fade/fade_view.model", "stab")
local function CreateRocketProjectile( self, player )
if not Predict then
-- little bit of a hack to prevent exploitey behavior. Prevent gorges from bile bombing
-- through clogs they are trapped inside.
local startPoint = nil
local startVelocity = nil
if GetIsPointInsideClogs(player:GetEyePos()) then
startPoint = player:GetEyePos()
startVelocity = Vector(0,0,0)
else
local viewCoords = player:GetViewAngles():GetCoords()
startPoint = player:GetEyePos() + viewCoords.zAxis * 2.0
startVelocity = viewCoords.zAxis * kRocketVelocity
local startPointTrace = Shared.TraceRay(player:GetEyePos(), startPoint, CollisionRep.Damage, PhysicsMask.Bullets, EntityFilterOneAndIsa(player, "Babbler"))
startPoint = startPointTrace.endPoint
end
player:CreatePredictedProjectile( "AcidRocket", startPoint, startVelocity, 0, 0, 0 )
end
end
function StabBlink:DoAttack()
self:TriggerEffects("stab_hit")
self.stabbing = false
local player = self:GetParent()
if player then
if Server or (Client and Client.GetIsControllingPlayer()) then
CreateRocketProjectile(self, player)
end
self:DoAbilityFocusCooldown(player, kAttackDuration * StabBlink.cooldownInfluence)
end
end
function StabBlink:GetBlinkAllowed()
return true
end
|
-- ======================================================================
-- Toboggan Trajectory
-- Advent of Code 2020 Day 03 -- Eric Wastl -- https://adventofcode.com
--
-- lua implementation by Dr. Dean Earl Wright III
-- ======================================================================
-- ======================================================================
-- t e s t _ t r e e s . l u a
-- ======================================================================
-- "Test solver for Advent of Code 2020 day 03, Toboggan Trajectory"
-- ----------------------------------------------------------------------
-- require
-- ----------------------------------------------------------------------
luaunit = require('luaunit')
trees = require('trees')
-- ----------------------------------------------------------------------
-- from_text
-- ----------------------------------------------------------------------
function from_text(text)
-- "Break the text into trimed, non-comment lines"
-- 1. We start with no lines
local result = {}
-- 2. Loop for lines in the text
for line in text:gmatch('[^\r\n]+') do
-- 3. But ignore blank and comment lines
line = line:gsub("%s*$", "")
if #line > 0 and "!" ~= line:sub(1, 1) then
-- 4. Add the line
table.insert(result, line)
end
end
-- 5. Return a table of cleaned lines
return result
end
-- ----------------------------------------------------------------------
-- constants
-- ----------------------------------------------------------------------
EXAMPLE_TEXT = [[
..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
.#.#.#....#
.#........#
#.##...#...
#...##....#
.#..#...#.#
]]
PART_ONE_TEXT = EXAMPLE_TEXT
PART_TWO_TEXT = EXAMPLE_TEXT
PART_ONE_RESULT = 7
PART_TWO_RESULT = 336
-- ======================================================================
-- TestTrees
-- ======================================================================
function test_empty_init()
-- "Test the default Trees creation"
-- 1. Create default Trees object
local myobj = trees:Trees()
-- 2. Make sure it has the default values
luaunit.assertEquals(myobj.part2, false)
luaunit.assertEquals(#myobj.text, 0)
luaunit.assertEquals(myobj.rows, 0)
luaunit.assertEquals(myobj.cols, 0)
end
function test_text_init()
-- "Test the Trees object creation from text"
-- 1. Create Trees object from text
local myobj = trees:Trees({text=from_text(EXAMPLE_TEXT)})
-- 2. Make sure it has the expected values
luaunit.assertEquals(myobj.part2, false)
luaunit.assertEquals(#myobj.text, 11)
luaunit.assertEquals(myobj.rows, 11)
luaunit.assertEquals(myobj.cols, 11)
-- 3. Check methods
luaunit.assertEquals(myobj:is_below(1), false)
luaunit.assertEquals(myobj:is_below(6), false)
luaunit.assertEquals(myobj:is_below(10), false)
luaunit.assertEquals(myobj:is_below(11), false)
luaunit.assertEquals(myobj:is_below(12), true)
luaunit.assertEquals(myobj:is_below(13), true)
luaunit.assertEquals(myobj:is_tree(1, 1), false)
luaunit.assertEquals(myobj:is_tree(4, 2), false)
luaunit.assertEquals(myobj:is_tree(7, 3), true)
luaunit.assertEquals(myobj:is_tree(10, 4), false)
luaunit.assertEquals(myobj:is_tree(13, 5), true)
luaunit.assertEquals(myobj:is_tree(16, 6), true)
luaunit.assertEquals(myobj:is_tree(19, 7), false)
luaunit.assertEquals(myobj:is_tree(22, 8), true)
luaunit.assertEquals(myobj:is_tree(25, 9), true)
luaunit.assertEquals(myobj:is_tree(28, 10), true)
luaunit.assertEquals(myobj:is_tree(31, 11), true)
luaunit.assertEquals(myobj:is_tree(34, 12), false)
luaunit.assertEquals(myobj:is_tree(39, 13), false)
luaunit.assertEquals(myobj:count_trees(3, 1), 7)
luaunit.assertEquals(myobj:count_trees(1, 1), 2)
luaunit.assertEquals(myobj:count_trees(5, 1), 3)
luaunit.assertEquals(myobj:count_trees(7, 1), 4)
luaunit.assertEquals(myobj:count_trees(1, 2), 2)
end
function test_part_one()
-- "Test part one example of Trees object"
-- 1. Create Trees object from text
local myobj = trees:Trees({text=from_text(PART_ONE_TEXT)})
-- 2. Check the part one result
luaunit.assertEquals(myobj:part_one({verbose=false, limit=0}), PART_ONE_RESULT)
end
function test_part_two()
-- "Test part two example of Trees object"
-- 1. Create Trees object from text
local myobj = trees:Trees({part2=true, text=from_text(PART_TWO_TEXT)})
-- 2. Check the part two result
luaunit.assertEquals(myobj:part_two({verbose=false, limit=0}), PART_TWO_RESULT)
end
-- ----------------------------------------------------------------------
-- module initialization
-- ----------------------------------------------------------------------
os.exit( luaunit.LuaUnit.run() )
-- ======================================================================
-- end t e s t _ t r e e s . l u a end
-- ======================================================================
|
--E・HERO バブルマン
function c799796660.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c799796660.spcon)
c:RegisterEffect(e1)
--draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(799796660,1))
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetCondition(c799796660.condition)
e2:SetTarget(c799796660.target)
e2:SetOperation(c799796660.operation)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
local e4=e2:Clone()
e4:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
c:RegisterEffect(e4)
local e02=Effect.CreateEffect(c)
e02:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e02:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e02:SetCode(EVENT_BE_MATERIAL)
e02:SetCondition(c799796660.condition2)
--e02:SetTarget(c20721930.target)
e02:SetOperation(c799796660.operation2)
c:RegisterEffect(e02)
end
function c799796660.condition2(e,tp,eg,ep,ev,re,r,rp)
return ((r==REASON_FUSION) or (e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL))
end
function c799796660.operation2(e,tp,eg,ep,ev,re,r,rp)
local rc=eg:GetFirst()
while rc do
if rc:GetFlagEffect(799796660)==0 then
--draw card
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetDescription(aux.Stringid(799796660,1))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,799796660)
e1:SetTarget(c799796660.target3)
e1:SetOperation(c799796660.operation3)
rc:RegisterEffect(e1,true)
rc:RegisterFlagEffect(799796660,RESET_EVENT+0x1fe0000,0,1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetDescription(aux.Stringid(799796660,1))
e2:SetCountLimit(1,799796660)
rc:RegisterEffect(e2,true)
rc:RegisterFlagEffect(799796660,RESET_EVENT+0x1fe0000,0,1)
end
rc=eg:GetNext()
end
end
function c799796660.spcon(e,c)
if c==nil then return true end
return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_HAND,0)==1
and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function c799796660.filter(c)
return not c:IsStatus(STATUS_LEAVE_CONFIRMED)
end
function c799796660.condition(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(c799796660.filter,tp,LOCATION_HAND,0,1,e:GetHandler())
end
function c799796660.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(2)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
end
function c799796660.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsExistingMatchingCard(c799796660.filter,tp,LOCATION_HAND,0,1,e:GetHandler()) then return end
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
function c799796660.target3(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c799796660.operation3(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsExistingMatchingCard(c799796660.filter,tp,LOCATION_HAND,0,1,e:GetHandler()) then return end
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
|
data:extend({
{
type = "int-setting",
name = "update-interval",
setting_type = "runtime-global",
default_value = 60,
minimum_value = 1,
maximum_value = 300
},
{
type = "int-setting",
name = "day-length",
setting_type = "runtime-global",
default_value = 25000,
minimum_value = 60,
maximum_value = 150000
}
})
|
Script.Load("lua/Globals.lua")
Script.Load("lua/GUIUtility.lua")
Script.Load("lua/Hud/Alien/GUIAlienHUDStyle.lua")
Script.Load("lua/GUIAnimatedScript.lua")
class 'AlienStatusHUD' (GUIAnimatedScript)
AlienStatusHUD.kXpBarBkgTexture = PrecacheAsset("ui/combatui_alien_xpbar_bkg.dds")
AlienStatusHUD.kXpBarOverlayTexture = PrecacheAsset("ui/combatui_alien_xpbar_overlay.dds")
AlienStatusHUD.kXPBarSize = Vector(600, 20, 0)
AlienStatusHUD.kXPBarSizeScaled = Vector(600, 20, 0)
AlienStatusHUD.kXpBarColor = Color(1, 1, 1, 0.6)
AlienStatusHUD.kAnimSpeedDown = 0.2
AlienStatusHUD.kAnimSpeedUp = 0.5
AlienStatusHUD.kXPFontName = Fonts.kArial_13
AlienStatusHUD.kXPTextPosition = Vector(0, -120, 0)
AlienStatusHUD.kRankFontName = Fonts.kStamp_Medium
AlienStatusHUD.kRankTextPosition = Vector(0, -146, 0)
function AlienStatusHUD:Initialize()
GUIAnimatedScript.Initialize(self)
self.scale = 1
self.lastXP = 0
self.lastRank = 1
self.background = self:CreateAnimatedGraphicItem()
self.background:SetPosition( Vector(0, 0, 0) )
self.background:SetIsScaling(false)
self.background:SetSize(Vector(Client.GetScreenWidth(), Client.GetScreenHeight(),0))
self.background:SetIsVisible(true)
self.background:SetLayer(kGUILayerPlayerHUDForeground1)
self.background:SetColor( Color(1, 1, 1, 0) )
self.xpBarBackground = self:CreateAnimatedGraphicItem()
self.xpBarBackground:SetAnchor(GUIItem.Middle, GUIItem.Bottom)
self.xpBarBackground:SetTexture(AlienStatusHUD.kXpBarBkgTexture)
self.xpBarBackground:SetTexturePixelCoordinates(0, 0, 600, 32)
self.xpBarBackground:SetColor(AlienStatusHUD.kXpBarColor)
self.xpBarBackground:SetIsVisible(true)
self.background:AddChild(self.xpBarBackground)
self.xpBar = self:CreateAnimatedGraphicItem()
self.xpBar:SetAnchor(GUIItem.Middle, GUIItem.Bottom)
self.xpBar:SetTexture(AlienStatusHUD.kXpBarOverlayTexture)
self.xpBar:SetTexturePixelCoordinates(0, 0, 0, 32)
self.xpBar:SetColor(AlienStatusHUD.kXpBarColor)
self.xpBar:SetIsVisible(true)
self.background:AddChild(self.xpBar)
self.currentXPText = GetGUIManager():CreateTextItem()
self.currentXPText:SetFontName(AlienStatusHUD.kXPFontName)
self.currentXPText:SetAnchor(GUIItem.Middle, GUIItem.Bottom)
self.currentXPText:SetTextAlignmentX(GUIItem.Align_Center)
self.currentXPText:SetTextAlignmentY(GUIItem.Align_Center)
self.currentXPText:SetText("0 XP of 1000 (Rank 1)")
self.currentXPText:SetIsVisible(true)
self.currentXPText:SetColor( Color(0, 0, 0, 1) )
self.background:AddChild(self.currentXPText)
self.currentRankTextShadow = GetGUIManager():CreateTextItem()
self.currentRankTextShadow:SetFontName(AlienStatusHUD.kRankFontName)
self.currentRankTextShadow:SetAnchor(GUIItem.Middle, GUIItem.Bottom)
self.currentRankTextShadow:SetTextAlignmentX(GUIItem.Align_Center)
self.currentRankTextShadow:SetTextAlignmentY(GUIItem.Align_Center)
self.currentRankTextShadow:SetText("Rank 1")
self.currentRankTextShadow:SetIsVisible(true)
self.currentRankTextShadow:SetColor( Color(0,0,0,1) )
self.background:AddChild(self.currentRankTextShadow)
self.currentRankText = GetGUIManager():CreateTextItem()
self.currentRankText:SetFontName(AlienStatusHUD.kRankFontName)
self.currentRankText:SetAnchor(GUIItem.Left, GUIItem.Top)
self.currentRankText:SetTextAlignmentX(GUIItem.Align_Center)
self.currentRankText:SetTextAlignmentY(GUIItem.Align_Center)
self.currentRankText:SetText("Rank 1")
self.currentRankText:SetIsVisible(true)
self.currentRankText:SetColor( kAlienFontColor )
self.currentRankText:SetPosition(Vector(-2, -2, 0))
self.currentRankTextShadow:AddChild(self.currentRankText)
self.visible = true
self:UpdateVisibility()
self:Reset(1)
end
function AlienStatusHUD:Reset(scale)
self.scale = scale
GUIAnimatedScript.Reset(self)
self.background:SetSize(Vector(Client.GetScreenWidth(), Client.GetScreenHeight(),0))
local xpBarScaledVec = Vector(GUIScaleWidth(AlienStatusHUD.kXPBarSize.x), AlienStatusHUD.kXPBarSize.y, 0)
self.xpBarBackground:SetUniformScale(self.scale)
self.xpBarBackground:SetSize(xpBarScaledVec)
self.xpBarBackground:SetPosition( Vector(-xpBarScaledVec.x / 2, -132, 0) )
self.xpBar:SetUniformScale(self.scale)
self.xpBar:SetSize( xpBarScaledVec )
self.xpBar:SetPosition( Vector(-xpBarScaledVec.x / 2, -132, 0) )
self.currentXPText:SetScale(GetScaledVector())
self.currentXPText:SetPosition(AlienStatusHUD.kXPTextPosition)
self.currentXPText:SetFontName(AlienStatusHUD.kXPFontName)
GUIMakeFontScale(self.currentXPText)
self.currentRankTextShadow:SetScale(GetScaledVector())
self.currentRankTextShadow:SetPosition(AlienStatusHUD.kRankTextPosition)
self.currentRankTextShadow:SetFontName(AlienStatusHUD.kRankFontName)
GUIMakeFontScale(self.currentRankTextShadow)
self.currentRankText:SetScale(GetScaledVector())
self.currentRankText:SetFontName(AlienStatusHUD.kRankFontName)
GUIMakeFontScale(self.currentRankText)
end
function AlienStatusHUD:Uninitialize()
GUIAnimatedScript.Uninitialize(self)
GUI.DestroyItem(self.currentXPText)
self.currentXPText = nil
GUI.DestroyItem(self.currentRankTextShadow)
self.currentRankTextShadow = nil
GUI.DestroyItem(self.currentRankText)
self.currentRankText = nil
end
function AlienStatusHUD:UpdateVisibility()
self.xpBarBackground:SetIsVisible(self.visible)
self.xpBar:SetIsVisible(self.visible)
self.currentXPText:SetIsVisible(self.visible)
self.currentRankTextShadow:SetIsVisible(self.visible)
self.currentRankText:SetIsVisible(self.visible)
end
function AlienStatusHUD:SetIsVisible(isVisible)
self.visible = isVisible
self:UpdateVisibility()
end
function AlienStatusHUD:GetIsVisible()
return self.visible
end
function AlienStatusHUD:OnResolutionChanged(oldX, oldY, newX, newY)
self:Reset(newY / kBaseScreenHeight)
self:Uninitialize()
self:Initialize()
end
function AlienStatusHUD:Update(deltaTime)
GUIAnimatedScript.Update(self, deltaTime)
local player = Client.GetLocalPlayer()
if player and HasMixin(player, "CombatScore") then
local currentXP = player.combatXP
local currentRank = player.combatRank
local title = CombatPlusPlus_GetAlienTitleByRank(currentRank)
local oldXPThreshold = CombatPlusPlus_GetXPThresholdByRank(currentRank)
local newXPThreshold = 0
if currentRank < kMaxCombatRank then
newXPThreshold = CombatPlusPlus_GetXPThresholdByRank(currentRank + 1)
end
-- update rank text
local rankText = string.format("Rank %s : %s", currentRank, title)
self.currentRankTextShadow:SetText(rankText)
self.currentRankText:SetText(rankText)
-- update xp text
if newXPThreshold == 0 then
self.currentXPText:SetText(string.format("%s XP", currentXP))
else
self.currentXPText:SetText(string.format("%s XP : %s XP to Next Rank", currentXP, newXPThreshold - currentXP))
end
-- normalize the current xp scale
local currentXPNorm = currentXP - oldXPThreshold
local newXPThresholdNorm = newXPThreshold - oldXPThreshold
if currentRank ~= self.lastRank then
if currentRank > self.lastRank then
self.xpBar:DestroyAnimations()
self.xpBar:SetSize(Vector(0, AlienStatusHUD.kXPBarSizeScaled.y, 0))
self.xpBar:SetTexturePixelCoordinates(0, 0, 0, AlienStatusHUD.kXPBarSizeScaled.y)
end
self.lastRank = currentRank
end
if currentXP ~= self.lastXP then
local animSpeed = ConditionalValue(currentXP < self.lastXP, AlienStatusHUD.kAnimSpeedDown, AlienStatusHUD.kAnimSpeedUp)
local xpFraction = currentXPNorm / newXPThresholdNorm
local xpBarScaledVec = Vector(GUIScaleWidth(AlienStatusHUD.kXPBarSize.x), AlienStatusHUD.kXPBarSize.y, 0)
local xpBarSize = Vector(xpBarScaledVec.x * xpFraction, xpBarScaledVec.y, 0)
self.xpBar:DestroyAnimations()
self.xpBar:SetSize(xpBarSize, animSpeed)
self.xpBar:SetTexturePixelCoordinates(0, 0, xpBarSize.x, 32, animSpeed)
self.lastXP = currentXP
end
end
end
|
--------------------------------
-- @module ActionScaleFrame
-- @extend ActionFrame
-- @parent_module ccs
--------------------------------
-- @function [parent=#ActionScaleFrame] setScaleY
-- @param self
-- @param #float float
--------------------------------
-- @function [parent=#ActionScaleFrame] setScaleX
-- @param self
-- @param #float float
--------------------------------
-- @function [parent=#ActionScaleFrame] getScaleY
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- @function [parent=#ActionScaleFrame] getScaleX
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- @function [parent=#ActionScaleFrame] getAction
-- @param self
-- @param #float float
-- @return ActionInterval#ActionInterval ret (return value: cc.ActionInterval)
--------------------------------
-- @function [parent=#ActionScaleFrame] ActionScaleFrame
-- @param self
return nil
|
-- local ts_utils = require 'nvim-treesitter.ts_utils'
local util = require("go.util")
local iferr = "iferr"
local run = function(...)
require("go.install").install(iferr)
local fname = vim.fn.expand("%:p") -- %:p:h ? %:p
local byte_offset = vim.fn.wordcount().cursor_bytes
local setup = {iferr, "-pos", byte_offset, vim.fn.bufnr('%')}
vim.fn.jobstart(
setup,
{
on_stdout = function(jobid, data, event)
data = util.handle_job_data(data)
if not data then return end
local pos = vim.fn.getcurpos()[1]
vim.fn.append(pos, data)
vim.cmd('silent normal! j=2j')
vim.fn.setpos('.', pos)
vim.cmd('ssilent normal! 4j')
end
}
)
end
return {run = run}
|
return{
print(memory.writebyte(0x7ED829, 1))
}
|
local M = {}
function M.init()
print('contract demo init')
end
function M.start()
print('contract demo start')
end
return M
|
local Random = {}
function Random.get_random_int()
return math.random(os.time())
end
return Random
|
log(DEBUG, "---- CHARACTER TEST BEGIN ----")
Testing.replaceEnvironment()
assert(getEntityClass("Character") == Character)
assert(getEntitySauerType("Character") == "dynent")
assert(getEntityClass("Player") == Player)
assert(getEntitySauerType("Player") == "dynent")
if Global.SERVER then
local test = Character()
assert(test._sauerType == "fpsent")
test:init(1112)
assert(test.uniqueId == 1112)
assert(not test:canCallCFuncs())
local count = 0
for i = 1, #table.keys(test._queuedStateVariableChanges) do count = count + 1 end
assert(count > 0)
test:activate({ clientNumber = 67 })
assert(test:canCallCFuncs())
assert(test.clientNumber == 67)
test.facingSpeed = 80
assert(test.facingSpeed == 80)
test.movementSpeed = 81
assert(test.movementSpeed == 81)
test.yaw = 82
assert(test.yaw == 82)
test.pitch = 83
assert(test.pitch == 83)
assert(not CAPI.feedback["setMove"])
test.move = 84
assert(test.move == 84)
assert(CAPI.feedback["setMove"] == 1112)
test.strafe = 85
assert(test.strafe == 85)
test.position = { 8, 9, 11 }
assert(test.position:asArray()[1] == 8)
assert(test.position:asArray()[2] == 9)
assert(test.position:asArray()[3] == 11)
test.velocity = { 1, 7, 55 }
assert(test.velocity:asArray()[1] == 1)
assert(test.velocity:asArray()[2] == 7)
assert(test.velocity:asArray()[3] == 55)
test.radius = 87
assert(test.radius == 87)
test.aboveEye = 88
assert(test.aboveEye == 88)
test.eyeHeight = 89
assert(test.eyeHeight == 89)
test.blocked = true
assert(test.blocked)
assert(not CAPI.feedback["setJumping"])
test:jump()
assert(CAPI.feedback["setJumping"] == 1112)
removeEntity(1112)
else
-- TODO: do client tests
end
Testing.restoreEnvironment()
log(DEBUG, "---- CHARACTER TEST END ----")
|
-- local actions = require('telescope.actions')
-- local utils = require('telescope.utils')
require "telescope"
local finders = require "telescope.finders"
local make_entry = require "telescope.make_entry"
local previewers = require "telescope.previewers"
local pickers = require "telescope.pickers"
local sorters = require "telescope.sorters"
local log = require "telescope.log"
local real_opts = setmetatable({}, { __mode = "v" })
local opts = setmetatable({}, {
__index = function(t, k)
log.debug("accessing:", k)
return real_opts[k]
end,
__newindex = function(t, k, v)
log.debug("setting:", k, v)
real_opts[k] = v
end,
})
opts.entry_maker = opts.entry_maker or make_entry.gen_from_file()
if opts.cwd then
opts.cwd = vim.fn.expand(opts.cwd)
end
-- local get_finder_opts = function(opts)
-- local t = {}
-- t.entry_maker = table.pop(opts, 'entry_maker')
-- return t
-- end
-- local finder_opts = get_finder_opts(opts)
-- assert(not opts.entry_maker)
local picker_config = {
prompt = "Git File",
finder = finders.new_oneshot_job({ "git", "ls-files", "-o", "--exclude-standard", "-c" }, opts),
-- previewer = previewers.cat.new(opts),
-- sorter = sorters.get_fuzzy_file(opts),
-- sorter = sorters.get_fuzzy_file(),
}
log.debug "Done with config"
local x = pickers.new(picker_config)
x:find()
x = nil
|
object_tangible_deed_vehicle_deed_twin_pod_cloud_car = object_tangible_deed_vehicle_deed_shared_twin_pod_cloud_car:new {
}
ObjectTemplates:addTemplate(object_tangible_deed_vehicle_deed_twin_pod_cloud_car, "object/tangible/deed/vehicle_deed/twin_pod_cloud_car.iff")
|
local u = require("custom.utils")
local a = vim.api
local f = vim.fn
local M = {}
local function tab_winids()
return a.nvim_tabpage_list_wins(0)
end
local function is_preview(winid)
return a.nvim_win_get_option(winid, "previewwindow")
end
local function is_float(winid)
return a.nvim_win_get_config(winid).relative ~= ""
end
local function get_winid_of(is_wintype)
for _, winid in ipairs(tab_winids()) do
if is_wintype(winid) then
return winid
end
end
return nil
end
local function press_esc()
a.nvim_feedkeys(u.from_keycode("<Esc>"), "n", true)
end
function M.close_floatwin()
local winid = get_winid_of(is_float)
if winid then
a.nvim_win_close(winid, false)
else
press_esc()
end
end
local function scroll_window(winid, backward)
local step = 3
local key = backward and u.from_keycode("<C-y>")
or u.from_keycode("<C-e>")
local command = "normal! " .. step .. key
f.win_execute(winid, command)
end
local function jump_to_hunk(backward)
local bracket = backward and "[" or "]"
vim.cmd("normal " .. bracket .. "c")
end
function M.scroll_or_jump(backward)
local winid = get_winid_of(is_float) or get_winid_of(is_preview)
if winid then
scroll_window(winid, backward)
else
jump_to_hunk(backward)
end
end
return M
|
local skynet = require "skynet"
local socket = require "skynet.socket"
local sharedata = require "skynet.sharedata"
local json = require("cjson")
local GameUser = require("logic/gameUser")
local queue = require "skynet.queue"
local TAG = "GameTable"
local GameTable = require("logic/gameTable")
local tableStatusMap = {
TABLE_STATUS_NONE = 0, -- 无状态,初始完成,玩家可以进来
TABLE_STATUS_PLAYING = 1, -- 牌局进行中
TABLE_STATUS_ROUND_STOP = 2, -- 对战一局牌局完成
TABLE_STATUS_BATTLE_STOP = 3, -- 对战牌局完成
TABLE_STATUS_BATTLE_DEAD = 4, -- 死亡状态,等待回收
}
function GameTable:onInitFriendBattleConfig(data)
self.m_pCsQueue(function()
self:setTableStatus(tableStatusMap.TABLE_STATUS_NONE)
self.m_pCommonConfig.iPlaytype = data.iPlaytype or 0
self.m_pFriendBattleConfig = {}
self.m_pFriendBattleConfig.iPayType = data.iPayType or 0
self.m_pFriendBattleConfig.iRoomOwnerId = data.iUserId
self.m_pFriendBattleConfig.iPlayId = data.iPlayId or 0
self.m_pFriendBattleConfig.iBattleTotalRound = math.floor(data.iBattleTotalRound)
self.m_pFriendBattleConfig.iBattleCurRound = 0
self.m_pFriendBattleConfig.iCreateForOther = data.iCreateForOther or 0
-- 如果是代开房,则必须是房主支付
if 1 == self.m_pFriendBattleConfig.iCreateForOther then
self.m_pFriendBattleConfig.iPayType = DefineType.ROOMCARD_PAYTYPE_OWNER
end
self.m_pFriendBattleConfig.iStartGameUserId = 0
local pTimeStamp = os.time()
self.m_pFriendBattleConfig.iTimeStamp = pTimeStamp
self.m_pFriendBattleConfig.iBattleId = string.format("%s%s", self.m_pCommonConfig.iTableId, pTimeStamp)
local pIsOk, pExtendTable = pcall(json.decode, data.iExtendInfo or "{}")
self.m_pFriendBattleConfig.iExtendTable = pIsOk and pExtendTable or {}
-- json.decode(data.iExtendInfo or "{}")
-- 设置房主信息
local pIsOk, pUserInfo = pcall(json.decode, data.iUserInfoStr or "{}")
self.m_pFriendBattleConfig.iRoomUserInfo = pIsOk and pUserInfo or {}
-- 设置游戏中的type
local pLocalGameType = math.floor(tonumber(self.m_pFriendBattleConfig.iExtendTable.iLocalGameType) or 0x0101)
self.m_pCommonConfig.iLocalGameType = pLocalGameType
if self.m_pFriendBattleConfig.iExtendTable.iBasePoint and self.m_pFriendBattleConfig.iExtendTable.iBasePoint >= 1 then
self.m_pCommonConfig.iBasePoint = math.floor(self.m_pFriendBattleConfig.iExtendTable.iBasePoint)
end
-- 俱乐部
self.m_pFriendBattleConfig.iClubId = 0
if data.iClubId and data.iClubId > 0 then
self.m_pFriendBattleConfig.iClubId = data.iClubId
end
-- 设置高级选项
self.m_pFriendBattleConfig.iGaoJiXuanXiang = 0
if self.m_pFriendBattleConfig.iExtendTable.iGaoJiXuanXiang and self.m_pFriendBattleConfig.iExtendTable.iGaoJiXuanXiang >= 1 then
self.m_pFriendBattleConfig.iGaoJiXuanXiang = math.floor(self.m_pFriendBattleConfig.iExtendTable.iGaoJiXuanXiang)
end
local pRoundPath = nil
if self.m_pPlaytypeConfig.iGameRoundPath then
pRoundPath = self.m_pPlaytypeConfig.iGameRoundPath[self:onGetLocalGameType()]
end
if not pRoundPath then
self:onDismissFriendBattleRoom()
return
end
self.m_pGameRound = require(pRoundPath)
self.m_pGameRound:init(self, self.m_pScheduleMgr)
-- 设置牌局人数
if self.m_pFriendBattleConfig.iExtendTable then
local pUserCount = self.m_pFriendBattleConfig.iExtendTable.iUserCount
local pTableUserCount = self:onGetGameTableMaxUserCount()
if pUserCount and pUserCount >= 2 and pUserCount <= pTableUserCount then
self.m_pCommonConfig.pSetUpMaxUserCount = pUserCount
elseif self.m_pGameRound.isCanBuXianRenShu and self.m_pGameRound:isCanBuXianRenShu() then
self.m_pCommonConfig.pSetBuXianRenShu = pTableUserCount
end
end
local pUserCount = self:onGetGameTableMaxUserCount()
self.m_pFriendBattleConfig.iPlaytypeStr = self.m_pGameRound.m_pGameRule:onGetPlaytypeStr(self.m_pFriendBattleConfig, pUserCount)
self.m_pFriendBattleConfig.iDismissBattleTable = nil
self.m_pFriendBattleConfig.iBattleTurnMoneyTable = {}
self.m_pFriendBattleConfig.iDisConnetTimeTable = {}
self.m_pFriendBattleConfig.iPreRoundGameStopTable = {}
-- 房间内的钻石消耗
self.m_pFriendBattleConfig.iUpdateRoomCardTable = {}
-- 启动销毁房间定时器,如果30分钟没有开始牌局则解散
local pTime = 30 * 60 * 1000
if 1 == self.m_pFriendBattleConfig.iCreateForOther then
pTime = 1 * 60 * 60 * 1000
end
self:onStartDimissFriendBattleTimer(pTime)
Log.dump(TAG, data, "data")
Log.dump(TAG, self.m_pFriendBattleConfig, "self.m_pFriendBattleConfig")
Log.dump(TAG, self.m_pCommonConfig, "self.m_pCommonConfig")
end)
end
function GameTable:onCheckUserCanLoginTable(data, userId)
-- 判断房间的状态是否可进
if not self:onCheckTableStatusCanEnter(data) then
return DefineType.ERROR_LOGIN_TABLE_STATUS_ERROR
end
-- 判断桌子是否已满
if self:onGetTableUserCount() >= self:onGetGameTableMaxUserCount() then
return DefineType.ERROR_LOGIN_TABLE_FULL
end
-- 判断该玩家是否已经在这个桌子上
if self:onGetUserByUserId(userId) then
return DefineType.ERROR_LOGIN_TABLE_FULL
end
-- 获取玩家的基本信息
if not self:onGetUserInfo(data, userId) then
return DefineType.ERROR_LOGIN_WRONG_DATA
end
-- 判断玩家房卡是否满足
if not self:onCheckUserEnoughRoomCard(data) then
if data.iCreateForOther and 1 == data.iCreateForOther then
return DefineType.ERROR_LOGIN_CREATE_FOR_OTHER
else
return DefineType.ERROR_LOGIN_NOT_ENOUGH_ROOMCARD
end
end
-- 判断如果是俱乐部,玩家是否在这个俱乐部中
if not self:onCheckUserIsInClub(data) then
-- 如果自己是房主,则无法创建
if self:isRoomOwner(data.iUserId) then
return DefineType.ERROR_LOGIN_CREATE_NOT_IN_CLUB
else
return DefineType.ERROR_LOGIN_USER_NOT_IN_CLUB
end
end
return nil
end
-- 退钻石
function GameTable:onServerSendBackRoomCard()
Log.d(TAG, "onServerSendBackRoomCard")
-- 如果还不需要付房费,如果是代开房且已经付了房费,则退回房费
if not self.m_pFriendBattleConfig.iNeedPayRoomCard and 1 == self.m_pFriendBattleConfig.iCreateForOther
and self.m_pFriendBattleConfig.iIsRoomPaid then
local pUserId = self.m_pFriendBattleConfig.iRoomOwnerId
local info = {
iUserId = pUserId,
iRoomCardNum = self:onGetNeedRoomCardCount(),
}
local pRet = skynet.call(self.m_pGameServer, "lua", "onUpdateUserRoomCard", info)
if pRet then
-- 删掉该玩家的钻石消耗
for kIndex, kUpdateInfo in pairs(self.m_pFriendBattleConfig.iUpdateRoomCardTable) do
if kUpdateInfo.iUserId == pUserId then
table.remove(self.m_pFriendBattleConfig.iUpdateRoomCardTable, kIndex)
break
end
end
end
self.m_pFriendBattleConfig.iIsRoomPaid = false
end
end
function GameTable:onClientCmdLoginGame(data, userId)
return self.m_pCsQueue(function()
local pStatus = self:onCheckUserCanLoginTable(data, userId)
-- Log.dump(TAG, data, "data")
-- 登陆成功
if not pStatus then
-- 如果是代开房间,且该玩家必须是代理
if data.iCreateForOther and 1 == data.iCreateForOther then
if 1 ~= data.iIsAgent and 2 ~= data.iIsAgent and 3 ~= data.iIsAgent then
self:onDismissFriendBattleRoom()
return
end
if not data.iServerAuto then
local name = "ServerUserCreateForOther"
local info = {}
info.iUserId = userId
info.iTableId = self.m_pCommonConfig.iTableId
info.iRoomCardNum = self:onGetNeedRoomCardCount()
info.iPlaytypeStr = self.m_pFriendBattleConfig.iPlaytypeStr
local pGameInfoTable = {}
pGameInfoTable.iLocalGameType = self:onGetLocalGameType()
info.iGameInfo = json.encode(pGameInfoTable)
self:onSendPackage(userId, name, info)
end
self:onGameTableUpdateData()
self:onServerUpdateOneBattleBillInfo()
local pNeedRoomCard = self:onGetNeedRoomCardCount()
self:onUserPayRoomCard(self.m_pFriendBattleConfig.iRoomOwnerId, pNeedRoomCard)
self.m_pFriendBattleConfig.iIsRoomPaid = true
self.m_pIsClubAutoOpenGameTable = true
return true
end
self:onDealUserLoginSuccess(data, userId)
self.m_pIsClubAutoOpenGameTable = true
return true
else
if not data.iServerAuto then
local name = "ServerUserLoginGameFail"
local info = pStatus
self:onSendPackage(userId, name, info)
else
Log.e(TAG, "自动创建失败的原因 %s %s", pStatus.iErrorType, pStatus.iErrorMsg)
end
-- 如果是对战场,且房主登陆失败,则解散该房间
if self:isRoomOwner(userId) then
self:onDismissFriendBattleRoom()
end
end
return false
end)
end
function GameTable:onStartDimissFriendBattleTimer(time)
Log.d(TAG, "onStartDimissFriendBattleTimer time[%s]", time)
self.m_pScheduleMgr:unregister(self.m_pHalfwayStopTimer)
self.m_pScheduleMgr:unregister(self.m_pDisMissBattleTimer)
self.m_pScheduleMgr:unregister(self.m_pGameRoundDisconnetTimer)
if self:isTableStatusPlaying() then return end
if self:isTableStatusBattleDead() then return end
local pCallback = self.onDismissFriendBattleRoom
self.m_pDisMissBattleTimer = self.m_pScheduleMgr:registerOnceNow(pCallback, time, self)
end
function GameTable:onForcedDismissFriendBattleRoom(pUserId)
if self.m_pFriendBattleConfig.iClubId == nil or self.m_pFriendBattleConfig.iClubId <= 0 then
local pMsg = "非茶馆房间不能强制解散!"
self:onServerUserShowHints(pUserId, 1, pMsg)
return
end
if not self:isRoomOwner(pUserId) then
local pMsg = "非房主不能强制解散该房间!"
self:onServerUserShowHints(pUserId, 1, pMsg)
return
end
if self:isTableStatusPlaying() or self:isTableStatusRoundStop() then
local pMsg = "强制解散房间成功!"
self:onServerUserShowHints(self.m_pFriendBattleConfig.iRoomOwnerId, 0, pMsg)
pMsg = "本房间已被群主解散!"
for k, v in pairs(self.m_pGameUsers or {}) do
local kUserId = v:onGetUserId()
if pMsg and not self:isRoomOwner(kUserId) then
self:onServerUserShowHints(kUserId, 0, pMsg)
end
end
self.m_pGameRound:onGameRoundStop(2)
elseif not self:isTableStatusBattleStop() then
self:onDismissFriendBattleRoom(2)
end
end
function GameTable:onDismissFriendBattleRoom(pType)
self.m_pCsQueue(function()
if not self:isTableStatusBattleStop() and not self:isTableStatusNone() then
local pMsg = "该房间正在游戏中,无法解散!"
self:onServerUserShowHints(self.m_pFriendBattleConfig.iRoomOwnerId, 0, pMsg)
return
end
if pType == 2 then --强制解散
local pMsg = "强制解散房间成功!"
self:onServerUserShowHints(self.m_pFriendBattleConfig.iRoomOwnerId, 0, pMsg)
end
Log.d(TAG, "onDismissFriendBattleRoom pTableId[%s]", self.m_pCommonConfig.iTableId)
self.m_pScheduleMgr:unregister(self.m_pHalfwayStopTimer)
self.m_pScheduleMgr:unregister(self.m_pDisMissBattleTimer)
self.m_pScheduleMgr:unregister(self.m_pGameRoundDisconnetTimer)
Log.d(TAG, "onDismissFriendBattleRoom pTableId[%s] self.m_pTableStatus[%s]", self.m_pCommonConfig.iTableId, self.m_pTableStatus)
self:onServerSendBackRoomCard()
local pMsg
-- 房主代开房间解散
if 1 == pType then
pMsg = "房主主动解散房间!"
elseif 2 == pType then
pMsg = "本房间已被群主解散!"
end
for k, v in pairs(self.m_pGameUsers or {}) do
local pUserId = v:onGetUserId()
self:onDealUserLogoutTableSuccess(v:onGetUserId())
if pMsg and not self:isRoomOwner(pUserId) then
self:onServerUserShowHints(pUserId, 0, pMsg)
end
end
self:onGameTableDeleteData()
if self:isTableStatusNone() then
self:onServerUpdateOneBattleBillInfo(1)
end
self:setTableStatus(tableStatusMap.TABLE_STATUS_BATTLE_DEAD)
-- 将它从表中移除
local pTableId = self.m_pCommonConfig.iTableId
local pClubId = self.m_pFriendBattleConfig.iClubId
skynet.call(self.m_pGameServiceMgr, "lua", "onDeleteOneRoomId", pTableId, pClubId)
local pRoomUserId = self.m_pFriendBattleConfig.iRoomOwnerId
Log.d(TAG, "self.m_pIsClubAutoOpenGameTable[%s]", self.m_pIsClubAutoOpenGameTable)
if self.m_pIsClubAutoOpenGameTable then
pcall(skynet.call, self.m_pGameServiceMgr, "lua", "onSendPackageToHallServiceMgr", "onClubAutoCreateFriendRoomMore", pRoomUserId, pClubId, self.m_pCommonConfig.iGameCode)
end
-- 延时将自己销毁
self:onDelayedDtorGameTable()
end)
end
function GameTable:onGetUserInfo(data, userId)
local pKey = string.format("UserInfo_UserId_%s", userId)
local pUserInfo = self:onExecuteRedisCmd(DefineType.REDIS_USERINFO, "GET", pKey)
if pUserInfo and type(pUserInfo) == "string" then
pUserInfo = json.decode(pUserInfo)
-- data.iMoney = tonumber(pUserInfo.Money) or 0
-- 好友场金币设置为0
data.iMoney = 0
data.iRoomCardNum = tonumber(pUserInfo.RoomCardNum) or 0
data.iNickName = pUserInfo.NickName or ""
data.iWinTimes = tonumber(pUserInfo.WinTimes) or 0
data.iLoseTimes = tonumber(pUserInfo.LoseTimes) or 0
data.iDrawTimes = tonumber(pUserInfo.DrawTimes) or 0
data.iIsAgent = tonumber(pUserInfo.IsAgent) or 0
return true
end
return false
end
function GameTable:onCheckUserEnoughRoomCard(data)
if self.m_pFriendBattleConfig.iIsRoomPaid then
return true
end
local pNeedRoomCard = self:onGetNeedRoomCardCount()
Log.d(TAG, "onCheckUserEnoughRoomCard data.iRoomCardNum[%s] , pNeedRoomCard[%s]", data.iRoomCardNum, pNeedRoomCard)
if self:isOwnerPay() then
if self:isRoomOwner(data.iUserId) then
return data.iRoomCardNum >= pNeedRoomCard
end
elseif self:isWinnerPay() then
return data.iRoomCardNum >= pNeedRoomCard
elseif self:isSharePay() then
return data.iRoomCardNum >= math.floor(pNeedRoomCard)
end
return true
end
function GameTable:onCheckUserIsInClub(data)
if self.m_pFriendBattleConfig.iClubId > 0 then
return skynet.call(self.m_pGameServer, "lua", "onCheckUserIdInClub", data.iUserId, self.m_pFriendBattleConfig.iClubId)
end
return true
end
function GameTable:onCheckTableStatusCanEnter(data)
Log.d(TAG, "onCheckTableStatusCanEnter status[%s]", self.m_pTableStatus)
-- 只有当房间处于未开局的情况下才能进入
if self:isTableStatusNone() then
return true
end
end
function GameTable:onUserPayRoomCard(pUserId, pNeedRoomCard)
if self.m_pFriendBattleConfig.iIsRoomPaid then
return true
end
local info = {
iUserId = pUserId,
iRoomCardNum = -pNeedRoomCard,
}
table.insert(self.m_pFriendBattleConfig.iUpdateRoomCardTable, info)
local pRet = skynet.call(self.m_pGameServer, "lua", "onUpdateUserRoomCard", info)
end
function GameTable:onGetNeedRoomCardCount()
local pTotolRound = self.m_pFriendBattleConfig.iBattleTotalRound
local pMaxUserCount = self:onGetGameTableMaxUserCount()
local pPayType = self.m_pFriendBattleConfig.iPayType
return self.m_pGameRound:onGetGameRule():onGetNeedRoomCardCount(self.m_pPlaytypeConfig, pTotolRound, pMaxUserCount, pPayType)
end
function GameTable:isOwnerPay()
return DefineType.ROOMCARD_PAYTYPE_OWNER == self.m_pFriendBattleConfig.iPayType
end
function GameTable:isWinnerPay()
return DefineType.ROOMCARD_PAYTYPE_WINNER == self.m_pFriendBattleConfig.iPayType
end
function GameTable:isSharePay()
return DefineType.ROOMCARD_PAYTYPE_SHARE == self.m_pFriendBattleConfig.iPayType
end
function GameTable:isRoomOwner(pUserId)
return pUserId == self.m_pFriendBattleConfig.iRoomOwnerId
end
function GameTable:onDealUserLoginSuccess(data, userId)
-- 分配一个座位号
local seatId = self:onAllocSeatId()
if not seatId then return -1 end
-- 设置用户信息
local newUser = new(GameUser, data, userId, seatId)
if not newUser then return -1 end
self.m_pGameUserLoginCount = self.m_pGameUserLoginCount + 1
newUser:onSetLoginCount(self.m_pGameUserLoginCount)
self.m_pGameUsers[seatId] = newUser
newUser:onSetIsOnline(1)
-- 将当前玩牌桌子加入到redis中
self:onDealUserLoginTableRedis(newUser)
-- 返回玩家成功进入房间的包
self:onSendUserLoginSuccess(newUser)
-- 上报给GameServer
self:onGameTableUpdateData()
-- 写到账单redis
self:onServerUpdateOneBattleBillInfo()
-- 如果有相同IP则提示
-- self:onServerDealUserSameIp(newUser:onGetUserId())
-- 将自己的ID和GameServer绑定起来
local pRet = skynet.call(self.m_pGameServiceMgr, "lua", "onUpdateGameServerData", {
iGameServer = self.m_pGameServer,
iUserId = newUser:onGetUserId()
})
-- 如果是好友对战,且可以默认准备
if not self:isOneUserStartGame()
and self.m_pGameRound.m_pGameRule.isAutoReady and self.m_pGameRound.m_pGameRule:isAutoReady() then
newUser:onSetReady(1)
end
-- 广播房间内的玩家有玩家进入
self:onBroadcastUserEnterTable(newUser)
if 1 == newUser:onGetReady() then
self:onBroadcastUserReady(newUser)
self:onCheckGameTableStartGame()
end
if self:isOneUserStartGame() then
self:onServerUserStartGameUserId(userId)
end
end
function GameTable:onServerUserStartGameUserId(pUserId)
if not self:isOneUserStartGame() then return end
if self.m_pFriendBattleConfig.iStartGameUserId <= 0 then
self.m_pFriendBattleConfig.iStartGameUserId = pUserId
local name = "ServerUserStartGameUserId"
local info = {}
info.iUserId = self.m_pFriendBattleConfig.iStartGameUserId
info.iNeedCount = 2
self:onSendPackage(info.iUserId, name, info)
end
end
function GameTable:onServerUserShowHints(pUserId, pType, pMsg)
local name = "ServerUserShowHints"
local info = {}
info.iShowType = pType
info.iShowMsg = pMsg
self:onSendPackage(pUserId, name, info)
end
function GameTable:onServerDealUserSameIp(pUserId)
local pUser = self:onGetUserByUserId(pUserId)
if not pUser then return end
for k, v in pairs(self.m_pGameUsers) do
Log.d(TAG, "onServerDealUserSameIp pUserId[%s] IP[%s]", v:onGetUserId(), v:onGetClientIp())
end
-- 如果该玩家和别的玩家同IP,则提示所有人
local pSameIpTable = {}
for k, v in pairs(self.m_pGameUsers) do
if v ~= pUser and pUser:onGetClientIp() == v:onGetClientIp() and pUser:onGetClientIp() ~= "" then
pSameIpTable[#pSameIpTable + 1] = v
end
end
if #pSameIpTable > 0 then
pSameIpTable[#pSameIpTable + 1] = pUser
local pMsg = "玩家"
for k, v in pairs(pSameIpTable) do
pMsg = string.format("%s %s", pMsg, v:onGetNickName())
end
pMsg = string.format("%s %s", pMsg, " 处于同一IP!")
for k, v in pairs(self.m_pGameUsers) do
self:onServerUserShowHints(v:onGetUserId(), 1, pMsg)
end
return
end
-- 如果该玩家在进入之前,已经有玩家同IP,则提示该玩家
for k, v in pairs(self.m_pGameUsers) do
for p, q in pairs(self.m_pGameUsers) do
if v ~= q and v:onGetClientIp() == q:onGetClientIp() and v:onGetClientIp() ~= "" then
pSameIpTable[#pSameIpTable + 1] = q
end
end
if #pSameIpTable > 0 then
pSameIpTable[#pSameIpTable + 1] = v
local pMsg = "玩家"
for k, v in pairs(pSameIpTable) do
pMsg = string.format("%s %s", pMsg, v:onGetNickName())
end
pMsg = string.format("%s %s", pMsg, " 处于同一IP!")
self:onServerUserShowHints(pUser:onGetUserId(), 1, pMsg)
return
end
end
end
function GameTable:onServerUpdateOneBattleBillInfo(pIsDissBattle)
if self:isTableStatusBattleDead() then
return
end
local pHasGameRule = self.m_pGameRound and self.m_pGameRound.m_pGameRule
local info = {}
info.iGameCode = self.m_pCommonConfig.iGameCode
info.iPlayId = self.m_pFriendBattleConfig.iPlayId
info.iBattleId = self.m_pFriendBattleConfig.iBattleId
info.iTableId = self.m_pCommonConfig.iTableId
info.iGameLevel = self.m_pCommonConfig.iGameLevel
info.iRoomOwnerId = self.m_pFriendBattleConfig.iRoomOwnerId
info.iTimeStamp = self.m_pFriendBattleConfig.iTimeStamp
info.iPlaytypeStr = self.m_pFriendBattleConfig.iPlaytypeStr
info.iPaytypeStr = pHasGameRule and self.m_pGameRound.m_pGameRule:onGetPaytypeStr(self.m_pFriendBattleConfig)
info.iEndTimeStamp = os.time()
info.iBattleTotalRound = self.m_pFriendBattleConfig.iBattleTotalRound
info.iBattleCurRound = self.m_pFriendBattleConfig.iBattleCurRound
info.iBattleStatus = 1
info.iBattleStopUserTable = self.m_pGameRound and self.m_pGameRound:onGetFriendBattleGameOverUserTable() or {}
info.iCreateForOther = self.m_pFriendBattleConfig.iCreateForOther
info.iPlaytypeStr = self.m_pFriendBattleConfig.iPlaytypeStr
info.iRoomOwnerName = self.m_pFriendBattleConfig.iRoomUserInfo.name or ""
info.iLocalGameType = self:onGetLocalGameType()
info.iIsDissBattle = pIsDissBattle or 0
info.iClubId = self.m_pFriendBattleConfig.iClubId
info.iRoomCardNum = self:onGetNeedRoomCardCount()
info.iMaxUserCount = self:onGetMaxUserCount()
info.iGameName = (self.m_pGameRound and self.m_pGameRound.m_pGameRule) and self.m_pGameRound.m_pGameRule:onGetGameName()
info.iUpdateRoomCardTable = {}
if self:isTableStatusBattleStop() then
info.iBattleStatus = 0
info.iUpdateRoomCardTable = self.m_pFriendBattleConfig.iUpdateRoomCardTable
elseif not self:isTableStatusNone() then
info.iBattleStatus = 2
end
skynet.send(self.m_pGameServiceMgr, "lua", "onServerUpdateOneBattleBillInfo", info.iBattleId, json.encode(info))
end
function GameTable:onServerAddOneRoundDetail()
if self:isTableStatusBattleStop() or self:isTableStatusBattleDead() or self:isTableStatusRoundStop() then
return
end
local info = {}
info.iTimeStamp = os.time()
info.iLookbackId = skynet.call(self.m_pGameServiceMgr, "lua", "onGetANewLookbackId")
info.iTurnMoneyTable = {}
for k, v in pairs(self.m_pGameUsers) do
local pTemp = {}
pTemp.iUserId = v:onGetUserId()
pTemp.iTurnMoney = v:onGetTurnMoney()
table.insert(info.iTurnMoneyTable, pTemp)
end
table.insert(self.m_pFriendBattleConfig.iBattleTurnMoneyTable, info)
end
function GameTable:onServerUserSetBillDetail()
if self:isTableStatusBattleStop() or self:isTableStatusBattleDead() or self:isTableStatusRoundStop() then
return
end
local pBattleId = self.m_pFriendBattleConfig.iBattleId
local pTurnMoneyTable = self.m_pFriendBattleConfig.iBattleTurnMoneyTable
local pLookbackId = pTurnMoneyTable[#pTurnMoneyTable].iLookbackId
local pLookbackTable = self.m_pGameRound.m_pOneRoundLookbackTable or {}
skynet.send(self.m_pGameServiceMgr, "lua", "onServerUserSetBillLookback", pLookbackId, pLookbackTable)
skynet.send(self.m_pGameServiceMgr, "lua", "onServerUserSetBillDetail", pBattleId, json.encode(pTurnMoneyTable))
end
function GameTable:onCheckGameTableStartGame()
Log.d(TAG, "onCheckGameTableStartGame")
if self:isTableStatusPlaying() or self:isTableStatusBattleStop() or self:isTableStatusBattleDead() then
Log.e(TAG, "当前状态不对,iTableId[%s] iTableStatus[%s]", self.m_pCommonConfig.iTableId, self.m_pTableStatus)
return
end
Log.d(TAG, "onCheckGameTableStartGame ready[%s] max[%s]", self:onGetReadyUserCount(), self:onGetGameTableMaxUserCount())
-- 监测人数,是否可以开始游戏
if self:onGetReadyUserCount() == self:onGetGameTableMaxUserCount() then
self:setTableStatus(tableStatusMap.TABLE_STATUS_PLAYING)
self.m_pFriendBattleConfig.iBattleCurRound = self.m_pFriendBattleConfig.iBattleCurRound + 1
-- 清除定时器
self.m_pScheduleMgr:unregister(self.m_pDisMissBattleTimer)
self.m_pScheduleMgr:unregister(self.m_pGameRoundDisconnetTimer)
-- self.m_pScheduleMgr:unregister(self.m_pHalfwayStopTimer)
self:onServerUpdateOneBattleBillInfo()
self.m_pGameRound:onGameRoundStart()
self:onGameTableUpdateData()
-- 减少一个房间,并开始自动开房
if 1 == self.m_pFriendBattleConfig.iBattleCurRound then
local pTableId = self.m_pCommonConfig.iTableId
local pClubId = self.m_pFriendBattleConfig.iClubId
local pRet = skynet.call(self.m_pGameServiceMgr, "lua", "onGameTableStartGame", pTableId, pClubId)
local pRoomUserId = self.m_pFriendBattleConfig.iRoomOwnerId
Log.d(TAG, "self.m_pIsClubAutoOpenGameTable[%s]", self.m_pIsClubAutoOpenGameTable)
if self.m_pIsClubAutoOpenGameTable then
pcall(skynet.call, self.m_pGameServiceMgr, "lua", "onSendPackageToHallServiceMgr", "onClubAutoCreateFriendRoomMore", pRoomUserId, pClubId, self.m_pCommonConfig.iGameCode)
end
end
end
end
function GameTable:onBroadcastUserReady(pUser)
if not pUser then return end
local name = "ServerBCUserReady"
local info = {}
info.iUserId = pUser:onGetUserId()
info.iReady = pUser:onGetReady()
self:onBroadcastTableUsers(name, info)
end
function GameTable:onSendUserLoginSuccess(pUser, pIsLookback)
if not pUser then return end
local name = "ServerUserLoginGameSuccess"
local info = {}
info.iGameCode = self.m_pCommonConfig.iGameCode
info.iRoomType = self.m_pCommonConfig.iRoomType
info.iRoomOwnerId = self.m_pFriendBattleConfig.iRoomOwnerId
info.iBattleTotalRound = self.m_pFriendBattleConfig.iBattleTotalRound
info.iBattleCurRound = self.m_pFriendBattleConfig.iBattleCurRound
info.iGameLevel = self.m_pCommonConfig.iGameLevel
info.iTableName = self.m_pCommonConfig.iTableName
info.iTableId = self.m_pCommonConfig.iTableId
info.iBasePoint = self.m_pCommonConfig.iBasePoint
info.iServerFee = self.m_pCommonConfig.iServerFee
info.iPlaytype = self.m_pCommonConfig.iPlaytype
info.iPlaytypeStr = self.m_pFriendBattleConfig.iPlaytypeStr
info.iMaxCardCount = self:onGetMaxCardCount()
info.iMaxUserCount = self:onGetMaxUserCount()
info.iOutCardTime = self.m_pCommonConfig.iOutCardTime - 1
info.iOperationTime = self.m_pCommonConfig.iOperationTime - 1
info.iUserTable = {}
for _, kUser in pairs(self.m_pGameUsers) do
local pTemp = {}
pTemp.iUserId = kUser:onGetUserId()
pTemp.iSeatId = kUser:onGetSeatId()
-- 这里需要满足一下初始化时需要初始化为特定的值
if self.m_pGameRound and self.m_pGameRound.onGetUserInitMoney then
if self.m_pFriendBattleConfig.iBattleCurRound <= 0 then
local pUserInitMoney = self.m_pGameRound:onGetUserInitMoney()
kUser:onSetMoney(pUserInitMoney or kUser:onGetMoney())
end
end
pTemp.iMoney = kUser:onGetMoney()
pTemp.iReady = kUser:onGetReady()
pTemp.iIsOnline = kUser:onGetIsOnline()
pTemp.iUserInfoStr = kUser.m_pUserInfoStr
info.iUserTable[#info.iUserTable + 1] = pTemp
end
info.iLocalGameType = self:onGetLocalGameType()
info.iRoomOwnerName = self.m_pFriendBattleConfig.iRoomUserInfo.name
info.iGameRoundInfo = json.encode(self.m_pGameRound:onGetGameRoundInfo())
if not pIsLookback then
self:onSendPackage(pUser:onGetUserId(), name, info)
else
return name, info
end
end
function GameTable:onBroadcastUserEnterTable(pUser)
if not pUser then return end
local name = "ServerBCUserEnterTable"
local info = {}
info.iUserId = pUser:onGetUserId()
info.iSeatId = pUser:onGetSeatId()
info.iReady = pUser:onGetReady()
info.iMoney = pUser:onGetMoney()
info.iUserInfoStr = pUser.m_pUserInfoStr
self:onBroadcastTableUsers(name, info, pUser:onGetUserId())
end
function GameTable:onDealUserLogoutTableSuccess(pUserId)
local pUser = self:onGetUserByUserId(pUserId)
if not pUser then
return -1
end
-- 广播用户退出房间
self:onBroadcastUserLogoutTable(pUser)
-- 处理redis
self:onDealUserLogoutTableRedis(pUser)
-- 移除这个玩家
self:onRemoveUser(pUser)
-- 上报用户退出
self:onGameTableUpdateData()
if not self:isTableStatusBattleStop() then
self:onServerUpdateOneBattleBillInfo()
end
if self:isOneUserStartGame() then
-- 维护一下桌子上谁是最早进来的
if pUserId == self.m_pFriendBattleConfig.iStartGameUserId then
self.m_pFriendBattleConfig.iStartGameUserId = 0
local tUser = nil
for _, kUser in pairs(self.m_pGameUsers) do
if not tUser or tUser:onGetLoginCount() > kUser:onGetLoginCount() then
tUser = kUser
end
end
-- 需不需要提示该玩家可以准备开始
if tUser then
self:onServerUserStartGameUserId(tUser:onGetUserId())
end
end
end
if self:onGetTableUserCount() <= 0 and self:isTableStatusBattleStop() then
self:onDismissFriendBattleRoom()
end
end
-- 更新数据库用户金币
function GameTable:onUpdateDataBaseUserMoney(info)
local pRet = skynet.call(self.m_pGameServer, "lua", "onUpdateUserMoney", info)
end
-- 是否好友对战场全部结束
function GameTable:isFriendBattleGameOver(result)
return 2 == result or self.m_pFriendBattleConfig.iBattleTotalRound == self.m_pFriendBattleConfig.iBattleCurRound
end
function GameTable:onDealGameStopWinnerPay()
if self.m_pFriendBattleConfig.iIsRoomPaid then return end
if self.m_pFriendBattleConfig.iNeedPayRoomCard then
if self:isWinnerPay() then
local pWinnerUsers = {}
for _, kUser in pairs(self.m_pGameUsers) do
local pTurnMoney = kUser:onGetMoney()
if #pWinnerUsers <= 0 or (#pWinnerUsers > 0 and pWinnerUsers[1]:onGetMoney() < pTurnMoney) then
pWinnerUsers = {}
pWinnerUsers[#pWinnerUsers + 1] = kUser
elseif #pWinnerUsers > 0 and (pWinnerUsers[1]:onGetMoney() == pTurnMoney) then
pWinnerUsers[#pWinnerUsers + 1] = kUser
end
end
-- 如果有赢家,则均摊支付,如有无法均摊的则随机一个赢家支付无法均摊的房卡
local pNeedRoomCard = self:onGetNeedRoomCardCount()
if #pWinnerUsers > 0 then
local pShareRoomCard = math.floor(pNeedRoomCard / #pWinnerUsers)
for _, kUser in pairs(pWinnerUsers) do
self:onUserPayRoomCard(kUser:onGetUserId(), pShareRoomCard)
end
if pNeedRoomCard - pShareRoomCard * #pWinnerUsers > 0 then
math.randomseed(tostring(os.time()):reverse():sub(1, 6))
self:onUserPayRoomCard(pWinnerUsers[math.random(1, #pWinnerUsers)]:onGetUserId(), pNeedRoomCard - pShareRoomCard * #pWinnerUsers)
end
end
-- Log.dump(TAG, pWinnerUsers, "pWinnerUsers")
end
end
self.m_pFriendBattleConfig.iIsRoomPaid = true
end
-- 一局结束
function GameTable:onGameRoundStop(result)
if self:isTableStatusBattleDead() then return end
for k, v in pairs(self.m_pGameUsers) do
v:onSetReady(0)
end
self:onServerAddOneRoundDetail()
self:onServerUserSetBillDetail()
if self:isFriendBattleGameOver(result) then
-- 如果开了一局以上则要算大赢家
self:onDealGameStopWinnerPay()
self:setTableStatus(tableStatusMap.TABLE_STATUS_BATTLE_STOP)
self:onServerSendBackRoomCard()
self:onServerUpdateOneBattleBillInfo()
self:onStartDimissFriendBattleTimer(2 * 60 * 1000)
-- 上报牌局
local pReportServer = skynet.call(self.m_pGameServiceMgr, "lua", "onGetReportServer")
if pReportServer then
local pGameInfoTable = {}
pGameInfoTable.iBattleCurRound = self.m_pFriendBattleConfig.iBattleCurRound
pGameInfoTable.iBattleTotalRound = self.m_pFriendBattleConfig.iBattleTotalRound
pGameInfoTable.iLocalGameType = self:onGetLocalGameType()
pGameInfoTable.iUserIdTable = {}
for _, kUser in pairs(self.m_pGameUsers) do
table.insert(pGameInfoTable.iUserIdTable, kUser:onGetUserId())
end
skynet.send(pReportServer, "lua", "onDealGameRound", pGameInfoTable)
end
-- 如果玩家离线则清掉
for k, v in pairs(self.m_pGameUsers) do
if 1 ~= v:onGetIsOnline() then
self:onDealUserLogoutTableSuccess(v:onGetUserId())
end
end
else
if 1 == self.m_pFriendBattleConfig.iBattleCurRound then
-- 扣房卡
local pNeedRoomCard = self:onGetNeedRoomCardCount()
if self:isOwnerPay() then
self:onUserPayRoomCard(self.m_pFriendBattleConfig.iRoomOwnerId, pNeedRoomCard)
self.m_pFriendBattleConfig.iIsRoomPaid = true
elseif self:isSharePay() then
for _, kUser in pairs(self.m_pGameUsers) do
self:onUserPayRoomCard(kUser:onGetUserId(), math.floor(pNeedRoomCard))
end
self.m_pFriendBattleConfig.iIsRoomPaid = true
end
-- 标记这里必须要交房费
self.m_pFriendBattleConfig.iNeedPayRoomCard = true
end
self:setTableStatus(tableStatusMap.TABLE_STATUS_ROUND_STOP)
self:onServerUpdateOneBattleBillInfo()
end
end
--------------------------------------- redis -----------------------------------
function GameTable:onDealUserLoginTableRedis(pUser)
if not pUser then
return -1
end
local key = string.format("mtKey_%s_%s", self.m_pCommonConfig.iGameCode, pUser:onGetUserId())
self:onExecuteRedisCmd(DefineType.REDIS_MTKEY, "HMSET", key, "TableId", self.m_pCommonConfig.iTableId)
-- local key = "mt_"..pUser.m_userId
-- local pPort = self.m_pCommonConfig.iListenPort
-- local pMjCode = self.m_pCommonConfig.iMJCode
-- local pRedisRet = skynet.call(self.m_gameServer, "lua", "onExecuteRedisCmd", "HMSet", "mtkeyRedis", key, "uid", pUser.m_userId, "tid", self.m_tableId, "svid", self.m_serverId, "from", pUser.m_from, "port", pPort, "gamecode", pMjCode)
-- local pRedisRet = skynet.call(self.m_gameServer, "lua", "onExecuteRedisCmd", "Expire", "mtkeyRedis", key, 3600 * 3)
-- local key = "svidOnline_"..self.m_serverId
-- local pRedisRet = skynet.call(self.m_gameServer, "lua", "onExecuteRedisCmd", "SAdd", "mtkeyRedis", key, pUser.m_userId)
-- local pRedisRet = skynet.call(self.m_gameServer, "lua", "onExecuteRedisCmd", "Expire", "mtkeyRedis", key, 3600 * 3)
end
function GameTable:onDealUserLogoutTableRedis(pUser)
if not pUser then
return -1
end
local key = string.format("mtKey_%s_%s", self.m_pCommonConfig.iGameCode, pUser:onGetUserId())
self:onExecuteRedisCmd(DefineType.REDIS_MTKEY, "HMSET", key, "TableId", 0)
-- local key = "mt_"..pUser.m_userId
-- local pRedisRet = skynet.call(self.m_gameServer, "lua", "onExecuteRedisCmd", "HMSet", "mtkeyRedis", key, "uid", 0, "tid", 0, "svid", 0, "gamecode", 0)
-- local pRedisRet = skynet.call(self.m_gameServer, "lua", "onExecuteRedisCmd", "Expire", "mtkeyRedis", key, 3600 * 3)
-- local key = "svidOnline_"..self.m_serverId
-- local pRedisRet = skynet.call(self.m_gameServer, "lua", "onExecuteRedisCmd", "SREM", "mtkeyRedis", key, pUser.m_userId)
-- local pRedisRet = skynet.call(self.m_gameServer, "lua", "onExecuteRedisCmd", "Expire", "mtkeyRedis", key, 3600 * 3)
end
--------------------------------------- 网络包组装函数 -----------------------------
-- 如果userId有值,则不包括该userId
function GameTable:onBroadcastTableUsers(name, info, userId)
userId = userId or -1
for _, kUser in pairs(self.m_pGameUsers) do
if kUser:onGetUserId() ~= userId then
self:onSendPackage(kUser:onGetUserId(), name, info)
end
end
end
function GameTable:onBroadcastUserLogoutTable(pUser)
Log.d(TAG, "GameTable onBroadcastUserLogoutTable")
if not pUser then return end
local name = "ServerBCUserLogoutTable"
local info = {}
info.iUserId = pUser:onGetUserId()
self:onBroadcastTableUsers(name, info)
end
function GameTable:onRemoveUser(pUser)
Log.d(TAG, "GameTable onRemoveUser")
if not pUser then
return -1
end
local pRet = skynet.call(self.m_pGameServiceMgr, "lua", "onDeleteGameServerByUserId", pUser:onGetUserId())
-- 如果当前玩家确实存在,则移除该玩家
for kIndex, kUser in pairs(self.m_pGameUsers) do
if kUser == pUser then
self.m_pGameUsers[kIndex] = nil
break
end
end
delete(pUser)
return 0
end
function GameTable:onDisConnect(pUserId)
self.m_pCsQueue(function()
Log.d(TAG, "onDisConnect pUserId[%s]", pUserId)
if not pUserId then return end
local pUser = self:onGetUserByUserId(pUserId)
if not pUser then return end
pUser:onSetIsOnline(0)
-- 如果是对战场,则不清除玩家
if (self:isTableStatusPlaying() or self:isTableStatusNone() or self:isTableStatusRoundStop()) then
if self.m_pFriendBattleConfig.iDisConnetTimeTable and
not self.m_pFriendBattleConfig.iDisConnetTimeTable.iTotalDisConnetTime then
local pTime = 15 * 60
self.m_pFriendBattleConfig.iDisConnetTimeTable.iTotalDisConnetTime = pTime
self.m_pFriendBattleConfig.iDisConnetTimeTable.iStartDisConnectTime = os.time()
self:onStartGameRoundDisconnetTimer(pTime * 1000)
end
end
if self:isTableStatusBattleStop() or self:isTableStatusBattleDead() then
self:onDealUserLogoutTableSuccess(pUserId)
else
self:onServerBCUserIsOnline(pUserId)
end
end)
end
function GameTable:onServerBCUserIsOnline(pUserId)
local pUser = self:onGetUserByUserId(pUserId)
if not pUser then return end
local name = "ServerBCUserIsOnline"
local info = {}
info.iUserId = pUserId
info.iIsOnline = pUser:onGetIsOnline()
local pRemainTime = -1
local pTimeTable = self.m_pFriendBattleConfig.iDisConnetTimeTable
if pTimeTable.iTotalDisConnetTime then
local pCostTime = os.time() - pTimeTable.iStartDisConnectTime
pRemainTime = pTimeTable.iTotalDisConnetTime - pCostTime
end
info.iTime = pRemainTime
Log.dump(TAG, pTimeTable, "pTimeTable")
self:onBroadcastTableUsers(name, info)
end
function GameTable:onDealOldUserReconnect(pUserId)
local pUser = self:onGetUserByUserId(pUserId)
if not pUser then return end
-- 设置玩家在线
pUser:onSetIsOnline(1)
local name = "ServerUserReconnect"
local info = {}
info.iGameCode = self.m_pCommonConfig.iGameCode
info.iRoomType = self.m_pCommonConfig.iRoomType
info.iRoomOwnerId = self.m_pFriendBattleConfig.iRoomOwnerId
info.iBattleTotalRound = self.m_pFriendBattleConfig.iBattleTotalRound
info.iBattleCurRound = self.m_pFriendBattleConfig.iBattleCurRound
info.iGameLevel = self.m_pCommonConfig.iGameLevel
info.iTableId = self.m_pCommonConfig.iTableId
info.iTableName = self.m_pCommonConfig.iTableName
info.iBasePoint = self.m_pCommonConfig.iBasePoint
info.iServerFee = self.m_pCommonConfig.iServerFee
info.iPlaytype = self.m_pCommonConfig.iPlaytype
info.iPlaytypeStr = self.m_pFriendBattleConfig.iPlaytypeStr
info.iMaxCardCount = self:onGetMaxCardCount()
info.iMaxUserCount = self:onGetMaxUserCount()
info.iOutCardTime = self.m_pCommonConfig.iOutCardTime - 1
info.iOperationTime = self.m_pCommonConfig.iOperationTime - 1
info.iRemainCardCount = self.m_pGameRound.m_pMahjongPool:remainCard()
info.iIsInGame = self:isTableStatusPlaying() and 1 or 0
info.iBankerSeatId = self:isTableStatusPlaying() and self.m_pGameRound.m_pBankerSeatId or 0
info.iIsCanOutCard = self.m_pGameRound:isCanOutCard() and 1 or 0
info.iDrawCardUserId = self.m_pGameRound:onGetDrawCardUserId()
info.iOutCardUserId = self.m_pGameRound:onGetOutCardUserId()
info.iUserTable = {}
for k, v in pairs(self.m_pGameUsers) do
local pTemp = {}
pTemp.iUserId = v:onGetUserId()
pTemp.iSeatId = v:onGetSeatId()
pTemp.iMoney = v:onGetMoney()
pTemp.iReady = v:onGetReady()
pTemp.iIsOnline = v:onGetIsOnline()
pTemp.iUserInfoStr = v.m_pUserInfoStr
pTemp.iHandCards = v:onGetHandCardMap()
pTemp.iBlockCards = v:onGetBlockCardMap()
pTemp.iOutCards = v:onGetOutCardMap()
pTemp.iOpTable = {}
pTemp.iAllCardTingInfoTable = {}
pTemp.iExtendInfo = json.encode(self.m_pGameRound:onGetUserExtendInfo(v, pUser))
if pUserId ~= v:onGetUserId() then
pTemp.iHandCards = {}
for _, card in pairs(v:onGetHandCardMap()) do
pTemp.iHandCards[#pTemp.iHandCards + 1] = 0
end
else
pTemp.iOpTable = self.m_pGameRound:onGetUserOpTable(v:onGetUserId())
pTemp.iAllCardTingInfoTable = self.m_pGameRound:onGetUserAllCardTingInfoTable(v:onGetUserId())
end
info.iUserTable[#info.iUserTable + 1] = pTemp
end
info.iLocalGameType = self:onGetLocalGameType()
info.iRoomOwnerName = self.m_pFriendBattleConfig.iRoomUserInfo.name
self:onSendPackage(pUser:onGetUserId(), name, info)
self.m_pGameRound:onUserReconnect(pUser)
self:onServerBCUserDismissBattleRoom()
local pIsAllOnline = true
for k, v in pairs(self.m_pGameUsers) do
if 1 ~= v:onGetIsOnline() then
pIsAllOnline = false
end
end
if pIsAllOnline then
self.m_pFriendBattleConfig.iDisConnetTimeTable = {}
self.m_pScheduleMgr:unregister(self.m_pGameRoundDisconnetTimer)
end
self:onServerBCUserIsOnline(pUser:onGetUserId())
end
function GameTable:onDealNewUserReconnect(pUserId)
local pUser = self:onGetUserByUserId(pUserId)
if not pUser then return end
if self:isTableStatusBattleStop() then
self:onDealUserLogoutTableSuccess(pUserId)
return
end
-- 设置玩家在线
pUser:onSetIsOnline(1)
local name = "ServerNewUserReconnect"
local info = {}
info.iGameCode = self.m_pCommonConfig.iGameCode
info.iRoomType = self.m_pCommonConfig.iRoomType
info.iRoomOwnerId = self.m_pFriendBattleConfig.iRoomOwnerId
info.iBattleTotalRound = self.m_pFriendBattleConfig.iBattleTotalRound
info.iBattleCurRound = self.m_pFriendBattleConfig.iBattleCurRound
info.iGameLevel = self.m_pCommonConfig.iGameLevel
info.iTableId = self.m_pCommonConfig.iTableId
info.iTableName = self.m_pCommonConfig.iTableName
info.iBasePoint = self.m_pCommonConfig.iBasePoint
info.iServerFee = self.m_pCommonConfig.iServerFee
info.iPlaytype = self.m_pCommonConfig.iPlaytype
info.iPlaytypeStr = self.m_pFriendBattleConfig.iPlaytypeStr
info.iMaxCardCount = self:onGetMaxCardCount()
info.iMaxUserCount = self:onGetMaxUserCount()
info.iOutCardTime = self.m_pCommonConfig.iOutCardTime - 1
info.iOperationTime = self.m_pCommonConfig.iOperationTime - 1
info.iIsInGame = self:isTableStatusPlaying() and 1 or 0
info.iLocalGameType = self:onGetLocalGameType()
info.iRoomOwnerName = self.m_pFriendBattleConfig.iRoomUserInfo.name
info.iGameRoundInfo = json.encode(self.m_pGameRound:onGetGameRoundInfo())
info.iUserTable = {}
for k, v in pairs(self.m_pGameUsers) do
local pTemp = {}
pTemp.iUserId = v:onGetUserId()
pTemp.iSeatId = v:onGetSeatId()
pTemp.iMoney = v:onGetMoney()
pTemp.iReady = v:onGetReady()
pTemp.iIsOnline = v:onGetIsOnline()
pTemp.iUserInfoStr = v.m_pUserInfoStr
pTemp.iUserGameInfo = json.encode(self.m_pGameRound:onGetUserGameInfo(v, pUser))
pTemp.iExtendInfo = json.encode(self.m_pGameRound:onGetUserExtendInfo(v, pUser))
info.iUserTable[#info.iUserTable + 1] = pTemp
end
self:onSendPackage(pUser:onGetUserId(), name, info)
self.m_pGameRound:onUserReconnect(pUser)
self:onServerBCUserDismissBattleRoom()
local pIsAllOnline = true
for k, v in pairs(self.m_pGameUsers) do
if 1 ~= v:onGetIsOnline() then
pIsAllOnline = false
end
end
if pIsAllOnline then
self.m_pFriendBattleConfig.iDisConnetTimeTable = {}
self.m_pScheduleMgr:unregister(self.m_pGameRoundDisconnetTimer)
end
self:onServerBCUserIsOnline(pUser:onGetUserId())
end
function GameTable:onUserReconnect(pUserId)
self.m_pCsQueue(function()
if self.m_pGameRound.isOldUserReconnenct and self.m_pGameRound:isOldUserReconnenct() then
self:onDealOldUserReconnect(pUserId)
else
self:onDealNewUserReconnect(pUserId)
end
-- 如果是一个玩家开始的游戏
if self:isOneUserStartGame() then
if pUserId == self.m_pFriendBattleConfig.iStartGameUserId then
self.m_pFriendBattleConfig.iStartGameUserId = 0
self:onServerUserStartGameUserId(pUserId)
end
end
end)
end
function GameTable:onGetGaoJiXuanXiang()
return self.m_pFriendBattleConfig.iGaoJiXuanXiang
end
function GameTable:isTableStatusNone()
return self.m_pTableStatus == tableStatusMap.TABLE_STATUS_NONE
end
function GameTable:isTableStatusPlaying()
return self.m_pTableStatus == tableStatusMap.TABLE_STATUS_PLAYING
end
function GameTable:isTableStatusBattleStop()
return self.m_pTableStatus == tableStatusMap.TABLE_STATUS_BATTLE_STOP
end
function GameTable:isTableStatusBattleDead()
return self.m_pTableStatus == tableStatusMap.TABLE_STATUS_BATTLE_DEAD
end
function GameTable:isTableStatusRoundStop()
return self.m_pTableStatus == tableStatusMap.TABLE_STATUS_ROUND_STOP
end
-------------------------------------------- socket ------------------------------------------
function GameTable:ClientUserReady(data, pUserId)
local pUser = self:onGetUserByUserId(pUserId)
if not pUser then return end
if self:isTableStatusPlaying() or self:isTableStatusBattleStop() then
return
end
local pIsOneUserStartGame = self:isOneUserStartGame()
if pIsOneUserStartGame then
if pUserId ~= self.m_pFriendBattleConfig.iStartGameUserId then
return
end
if self.m_pGameRound.isOneUserCanStartGame and self.m_pGameRound:isOneUserCanStartGame() then
-- 所有都设置成已准备,然后将最大人数设置成当前人数
for _, kUser in pairs(self.m_pGameUsers) do
kUser:onSetReady(1)
end
-- 如果是由某个玩家开始的游戏,房间人数必须设置一下
self.m_pCommonConfig.pSetUpMaxUserCount = self:onGetReadyUserCount()
self:onBroadcastUserReady(pUser)
self:onCheckGameTableStartGame()
end
else
if 1 == pUser:onGetReady() then return end
pUser:onSetReady(data.iReady or 0)
self:onBroadcastUserReady(pUser)
self:onCheckGameTableStartGame()
end
end
function GameTable:ClientUserLogoutGame(data, pUserId)
Log.d(TAG, "ClientUserLogoutGame pUserId[%s] status[%s]", pUserId, self.m_pTableStatus)
local pUser = self:onGetUserByUserId(pUserId)
if not pUser then return end
if self:isTableStatusPlaying() then return end
if self:isTableStatusBattleDead() then
return
end
if self:isTableStatusRoundStop() then
return
end
Log.d(TAG, "pUserId[%s] self.m_pFriendBattleConfig.iRoomOwnerId[%s]", pUserId, self.m_pFriendBattleConfig.iRoomOwnerId)
-- 如果是房主离开房间且牌局没结束,直接解散
if self:isRoomOwner(pUserId) and not self:isTableStatusBattleStop() then
self:onDismissFriendBattleRoom(1)
else
self:onDealUserLogoutTableSuccess(pUserId)
end
end
function GameTable:ClientUserDismissBattleRoom(data, pUserId)
local pUser = self:onGetUserByUserId(pUserId)
if not pUser then return end
if not self:isTableStatusPlaying() and not self:isTableStatusRoundStop() then return end
-- 如果是代开房解散
local pCreateForOther = data.iCreateForOther or 0
if self:isRoomOwner(pUserId) and (1 == pUser:onGetIsAgent() or 2 == pUser:onGetIsAgent() or 3 == pUser:onGetIsAgent()) and 1 == pCreateForOther then
-- 如果玩家已经在玩了,则提示
if self:isTableStatusPlaying() or self:isTableStatusRoundStop() then
local pMsg = "该房间正在游戏中,无法解散!"
self:onServerUserShowHints(pUserId, 1, pMsg)
elseif not self:isTableStatusBattleStop() then
self:onDismissFriendBattleRoom()
end
return
end
if self.m_pFriendBattleConfig.iDismissBattleTable then
Log.d(TAG, "已经有人请求解散房间了")
return
end
self.m_pFriendBattleConfig.iDismissBattleTable = {}
local pTime = 2 * 60
if self.m_pFriendBattleConfig.iDisConnetTimeTable.iTotalDisConnetTime then
local pCostTime = os.time() - self.m_pFriendBattleConfig.iDisConnetTimeTable.iStartDisConnectTime
local pRemainTime = self.m_pFriendBattleConfig.iDisConnetTimeTable.iTotalDisConnetTime - pCostTime
pTime = math.min(pTime, pRemainTime >= 0 and pRemainTime or 0)
end
self.m_pFriendBattleConfig.iDismissBattleTable.iStartTime = os.time()
self.m_pFriendBattleConfig.iDismissBattleTable.iUserId = pUserId
self.m_pFriendBattleConfig.iDismissBattleTable.iTotolTime = pTime
self.m_pFriendBattleConfig.iDismissBattleTable.iRemainTime = pTime
self.m_pFriendBattleConfig.iDismissBattleTable.iDismissBattleUserTable = {}
for k, v in pairs(self.m_pGameUsers) do
local pTemp = {}
pTemp.iUserId = v:onGetUserId()
pTemp.iIsOnline = v:onGetIsOnline()
pTemp.iDismissStatus = v:onGetUserId() == pUserId and 1 or 0
table.insert(self.m_pFriendBattleConfig.iDismissBattleTable.iDismissBattleUserTable, pTemp)
end
self:onStartGameRoundHalfwayStop(pTime * 1000)
self:onServerBCUserDismissBattleRoom()
-- Log.dump(TAG, self.m_pFriendBattleConfig.iDismissBattleTable, "iDismissBattleTable")
end
function GameTable:ClientUserDismissBattleSelect(data, pUserId)
if self:isTableStatusBattleStop() or self:isTableStatusBattleDead() then return end
if not self.m_pFriendBattleConfig.iDismissBattleTable then
return
end
local pUser = self:onGetUserByUserId(pUserId)
if not pUser then return end
-- 如果是同意
if 1 == data.iSelect then
local pUserAllAgree = true
local pDismissBattleTable = self.m_pFriendBattleConfig.iDismissBattleTable
for k, v in pairs(pDismissBattleTable.iDismissBattleUserTable) do
if v.iUserId == pUserId then
v.iDismissStatus = 1
end
if 1 ~= v.iDismissStatus then
pUserAllAgree = false
end
end
-- 是不是所有玩家都同意了
if pUserAllAgree then
self.m_pGameRound:onGameRoundStop(2)
else
self:onServerBCUserDismissBattleRoom()
end
else
local name = "ServerBCUserRefuseDismissBattle"
local info = {}
info.iUserId = pUserId
info.iRefuseStr = string.format("玩家 %s 拒绝解散房间", pUser:onGetNickName())
self:onBroadcastTableUsers(name, info)
self.m_pFriendBattleConfig.iDismissBattleTable = nil
self.m_pScheduleMgr:unregister(self.m_pHalfwayStopTimer)
end
end
function GameTable:onStartGameRoundHalfwayStop(time)
Log.d(TAG, "onStartGameRoundHalfwayStop time[%s]", time)
self.m_pScheduleMgr:unregister(self.m_pHalfwayStopTimer)
local pCallback = self.onTimerGameRoundStop
self.m_pHalfwayStopTimer = self.m_pScheduleMgr:registerOnceNow(pCallback, time, self, 2)
end
function GameTable:onStartGameRoundDisconnetTimer(time)
Log.d(TAG, "onStartGameRoundDisconnetTimer time[%s]", time)
self.m_pScheduleMgr:unregister(self.m_pGameRoundDisconnetTimer)
local pCallback = self.onTimerGameRoundStop
self.m_pGameRoundDisconnetTimer = self.m_pScheduleMgr:registerOnceNow(pCallback, time, self, 2)
end
function GameTable:onTimerGameRoundStop(result)
self.m_pCsQueue(function()
-- 判断如果牌局没开始,则直接解散
if self.m_pFriendBattleConfig.iBattleCurRound <= 0 then
self:onDismissFriendBattleRoom()
elseif not self:isTableStatusBattleStop() and not self:isTableStatusBattleDead() then
self.m_pGameRound:onGameRoundStop(result)
end
end)
end
function GameTable:onServerBCUserDismissBattleRoom()
if not self.m_pFriendBattleConfig.iDismissBattleTable then
return
end
local pCostTime = os.time() - self.m_pFriendBattleConfig.iDismissBattleTable.iStartTime
self.m_pFriendBattleConfig.iDismissBattleTable.iRemainTime = self.m_pFriendBattleConfig.iDismissBattleTable.iTotolTime - pCostTime
-- 更新掉线信息
for _, kInfo in pairs(self.m_pFriendBattleConfig.iDismissBattleTable.iDismissBattleUserTable) do
local kUser = self:onGetUserByUserId(kInfo.iUserId)
if kUser then
kInfo.iIsOnline = kUser:onGetIsOnline()
end
end
local name = "ServerBCUserDismissBattleRoom"
local info = self.m_pFriendBattleConfig.iDismissBattleTable
self:onBroadcastTableUsers(name, info)
end
return GameTable
|
function love.conf(t)
t.title = "tileClick demo"
t.author = "nduckwiler"
end
|
asteroid = class:new()
function asteroid:init(x, y, size)
self.x = x or math.random(80)+10
self.y = y or -10
self.r = math.random(math.ceil(math.pi*20))/10
self.size = size or 1
self.rspeed = (math.random()*2-1)*10
self.speedx = math.random(5)+20
self.speedy = math.random(5)+10
self.i = math.random(2)
self.direction = math.random(2)
if self.direction == 2 then
self.direction = -1
end
if self.size == 1 then
self.hp = 12*realasteroiddelay
else
self.hp = 6*realasteroiddelay
end
end
function asteroid:update(dt)
self.x = self.x + self.speedx*dt*self.direction
self.y = self.y + self.speedy*dt
if self.x > 90 then
self.direction = -1
elseif self.x < 10 then
self.direction = 1
end
if self.y > 40 then
self.speedy = 100
self.direction = 0
end
self.r = self.r + self.rspeed*dt
if self.y > 120 then
self.dead = true
end
return self.dead
end
function asteroid:hit()
self.hp = self.hp - 1
if self.hp <= 0 then
if self.size == 1 then
table.insert(asteroids, asteroid:new(self.x, self.y, 2))
table.insert(asteroids, asteroid:new(self.x, self.y, 2))
pointsget(10)
else
pointsget(10)
end
lastexplosion = {self.x, self.y}
self.dead = true
table.insert(explosions, explosion:new(self.x-12, self.y-16))
backgroundwhite = 1
end
end
function asteroid:checkcol(x, y)
if self.size == 1 then --big
if math.abs(self.x-x) < 9 and math.abs(self.y-y) < 9 then
return true
end
else
if math.abs(self.x-x) < 6 and math.abs(self.y-y) < 6 then
return true
end
end
return false
end
function asteroid:draw()
if self.size == 1 then
draw(_G["asteroid-big" .. self.i .. "img"], self.x, self.y, self.r, 1, 1, 11, 9)
else
draw(_G["asteroid-small" .. self.i .. "img"], self.x, self.y, self.r, 1, 1, 11, 9)
end
end
|
require("config.lsp.diagnostics").setup()
require("config.lsp.kind").setup()
local function on_attach(client, bufnr)
require("config.lsp.formatting").setup(client, bufnr)
require("config.lsp.keys").setup(client, bufnr)
-- require("config.lsp.completion").setup(client, bufnr)
require("config.lsp.highlighting").setup(client)
-- TypeScript specific stuff
if client.name == "typescript" or client.name == "tsserver" then
require("config.lsp.ts-utils").setup(client)
end
end
local servers = {
ansiblels = {},
bashls = {},
clangd = {},
cssls = {},
dockerls = {},
eslint = {},
html = {},
jsonls = {},
pyright = {},
rust_analyzer = {
settings = {
["rust-analyzer"] = {
cargo = { allFeatures = true },
-- enable clippy on save
checkOnSave = {
command = "clippy",
extraArgs = { "--no-deps" },
},
},
},
},
sumneko_lua = {},
tsserver = {},
vimls = {},
-- tailwindcss = {},
}
local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities())
require("workspace").setup()
require("lua-dev").setup()
local options = {
on_attach = on_attach,
capabilities = capabilities,
flags = {
debounce_text_changes = 150,
},
}
require("config.lsp.null-ls").setup(options)
require("config.lsp.install").setup(servers, options)
|
local cjson = require "cjson.safe"
local output = ''
function table.pack(...)
return { n = select("#", ...), ... }
end
local function hooked_print(...)
local r = ""
local args = table.pack(...)
for i=1,args.n do
output = output .. tostring(args[i]) .. "\n"
end
end
__api.add_cbs({
data = function(src, data)
print('receive data: "' .. data .. '" from: ' .. src)
local resp = {}
local msg = cjson.decode(data)
if msg.type ~= nil and msg.type == 'exec' then
local f, err = loadstring(msg.code)
local response = {['type']='response', ['retaddr']=msg.retaddr}
if f ~= nil then
local env = {print=hooked_print}
setmetatable(env, {__index = _G})
setfenv(f, env)
response.status, response.ret, response.err = xpcall(f, debug.traceback)
response.output = output
else
response.err = 'Syntax error : ' .. tostring(err)
end
local encoded_response = cjson.encode(response)
__api.send_data_to(src, encoded_response)
output = ''
end
return true
end,
control = function(cmtype, data)
return true
end,
})
__api.await(-1)
return 'success'
|
--[===[DOC
= countiter
[source,lua]
----
local function countiter( ... ) --> countInt
----
Count the number of iteration generated by a iterator. The argument must be the
same varargs a `for in` loop. It will return the number of iteration.
E.g. `countiter(pairs(tab))` will count the number of key in the table `tab`.
== Example
[source,lua,example]
----
local countiter = require 'countiter'
assert( 3 == countiter( pairs{ 1, 2, c='2' }) )
----
]===]
local function countiter( ... ) --> countInt
local countInt = 0
if select('#', ...) ~= 0 then
for _ in ... do
countInt = countInt + 1
end
end
return countInt
end
return countiter
|
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by Administrator.
--- DateTime: 2021/2/25 11:12
---
require("lib.ksptooi.commons.PlayerLib")
require("lib.ksptooi.commons.PlayerCashLib")
require("lib.ksptooi.teleport.TpRequestStorage")
---发送传送请求
function teleportToPlayer(command)
if(command.parameter == nil)then
game.print("缺少参数")
return
end
local player = game.players[command.player_index]
local target = game.players[command.parameter]
if not validPlayer(target) then
player.print("玩家不存在")
return
end
if insertTpRequest(player,target)then
player.print("传送请求已经发送至:"..target.name.." 等待对方接受")
target.print(player.name.."请求传送至你的位置. 输入/tpaccept 接受这个请求")
return
end
player.print("你已经发送过传送请求了")
--player.teleport({target.position.x,target.position.y},GAME_SURFACE_NAME)
end
---接受请求
function teleportAccept(command)
local target = game.players[command.player_index]
local tpReq = getTpRequest(target)
if tpReq == nil then
target.print("当前没有待处理传送请求")
return
end
if not validPlayer(tpReq.from)then
target.print("接受请求失败,玩家不可用.")
return
end
local from = game.players[tpReq.from.name]
---不可传送
if (from.position.x < 20 and from.position.x > -20) or (from.position.y < 20 and from.position.x > -20) then
target.print("接受请求成功,但对方的位置不允许进行传送.")
removeTpRequest(target)
return
end
--[[ if (player.vehicle) then
player.print("先生,请先下车,然后再尝试购买...")
return
end]]
---扣费
if not (removeCash(from,200))then
target.print("接受请求成功,但对方没有足够的现金进行此次传送.")
removeTpRequest(target)
return
end
target.print("接受请求成功.")
from.print("对方已接受你的传送请求.")
tpReq.from.teleport({target.position.x,target.position.y})
removeTpRequest(target)
end
commands.add_command("tpa","tpa",teleportToPlayer)
commands.add_command("tpaccept","tpa",teleportAccept)
commands.add_command("tpdeny","tpa",teleportToPlayer)
|
--[[
-| cckiwi_polling |-
Copyright (c) 2021 KiwifruitDev
https://github.com/TeamPopplio/
https://steamcommunity.com/id/KiwifruitDev/
Licensed under the MIT License.
File description: Client polling loader cl_polling.lua
]]--
print("[cckiwi_polling] Loading autorun/client/cl_polling.lua")
-- convars
local pollname_cmd = CreateClientConVar("cckiwi_pollname", "", false, false, "Set the poll name to be sent with cckiwi_startpoll. Can be set to \"\" to remove.")
local option1_cmd = CreateClientConVar("cckiwi_polloption1", "", false, false, "Set the first option to be sent with cckiwi_startpoll. Can be set to \"\" to remove.")
local option2_cmd = CreateClientConVar("cckiwi_polloption2", "", false, false, "Set the second option to be sent with cckiwi_startpoll. Can be set to \"\" to remove.")
local option3_cmd = CreateClientConVar("cckiwi_polloption3", "", false, false, "Set the third option to be sent with cckiwi_startpoll. Can be set to \"\" to remove.")
local option4_cmd = CreateClientConVar("cckiwi_polloption4", "", false, false, "Set the fourth option to be sent with cckiwi_startpoll. Can be set to \"\" to remove.")
local option5_cmd = CreateClientConVar("cckiwi_polloption5", "", false, false, "Set the fifth option to be sent with cckiwi_startpoll. Can be set to \"\" to remove.")
local option6_cmd = CreateClientConVar("cckiwi_polloption6", "", false, false, "Set the sixth option to be sent with cckiwi_startpoll. Can be set to \"\" to remove.")
local timer_cmd = CreateClientConVar("cckiwi_polltimer", 10, false, false, "Set the time limit to be sent with cckiwi_startpoll.", 10, 600)
-- start poll
concommand.Add("cckiwi_startpoll", function(ply, cmd, args)
net.Start("pollstarted")
net.WriteString(pollname_cmd:GetString())
net.WriteString(option1_cmd:GetString())
net.WriteString(option2_cmd:GetString())
net.WriteString(option3_cmd:GetString())
net.WriteString(option4_cmd:GetString())
net.WriteString(option5_cmd:GetString())
net.WriteString(option6_cmd:GetString())
net.WriteInt(timer_cmd:GetInt(), 8)
net.SendToServer()
end)
hook.Add("InitPostEntity", "cckiwi_polling", function()
vgui.Create("PollingUI")
end)
-- CLIENTSIDE FUNCTIONALITY --
local PANEL = {}
local offset = 48
local w = 512
local h = 512
local border = 8
local round = 8
local optionwidth = 32
local spacer = 8
local options = {
0,
0,
0,
0,
0,
0,
}
local adminname
local pollname
local option1
local option2
local option3
local option4
local option5
local option6
local timera
local votes
local voted1
local voted2
local function GetTimer()
if GetGlobalInt("KiwiPollStartTime", 0) > 0 then
return GetGlobalInt("KiwiPollStartTime", 0)
else
return "Results"
end
end
net.Receive("pollnetwork", function()
adminname = net.ReadString()
pollname = net.ReadString()
option1 = net.ReadString()
option2 = net.ReadString()
option3 = net.ReadString()
option4 = net.ReadString()
option5 = net.ReadString()
option6 = net.ReadString()
timera = net.ReadInt(8)
votes = net.ReadInt(8)
voted1 = net.ReadVector()
voted2 = net.ReadVector()
end)
function PANEL:StartShow()
local x, y = self:GetPos()
self.transitioning = true
self.transitionuse = 0
self:SetPos(0-w, y)
end
function PANEL:StartHide()
local x, y = self:GetPos()
self.transitioning = false
self.transitionuse = 0
self:SetPos(offset, y)
end
function PANEL:IsShown()
local x, y = self:GetPos()
return x >= offset
end
function PANEL:IsHidden()
local x, y = self:GetPos()
return x <= 0-w
end
function PANEL:PerformLayout()
self:SizeToChildren(true, true)
self:Show()
self:SetPos(0-w, offset)
end
function PANEL:Init()
local DPanel = vgui.Create( "DPanel", self )
DPanel:SetSize( w, h )
local playercount = player.GetCount()
function DPanel:Paint( w, h )
local x, y = self:GetPos()
draw.DrawText((adminname or "Someone").." started a poll:", "TargetID", (x+w)/2, y+(border*2)-16, Color(255,255,255), TEXT_ALIGN_CENTER)
surface.SetDrawColor(251, 126, 20, 128)
-- status bar
surface.DrawRect( x+(border*2), y+(border*2), w-(border*4), optionwidth )
draw.DrawText(pollname or "Something went wrong when getting poll data!", "TargetID", x+(border*2)+4, y+(border*2)+8, Color(255,255,255), TEXT_ALIGN_LEFT)
draw.DrawText(GetTimer(), "TargetID", (x+(border*2)+4 + (w-(border*4))) - 8, y+(border*2)+8, Color(255,255,255), TEXT_ALIGN_RIGHT)
local optionspace = spacer+optionwidth
local amount = 0
--options
surface.SetDrawColor(127, 62, 10, 128)
if option1 ~= nil and option1 ~= "" then
surface.DrawRect( x+(border*2), y+(border*2) + optionspace, w-(border*4), optionwidth )
amount = amount+1
surface.SetDrawColor(251, 126, 20, 128)
local am = (options[amount]/playercount) * w-(border*4)
if am > w-(border*4) then
am = w-(border*4)
end
surface.DrawRect( x+(border*2), y+(border*2) + optionspace, am, optionwidth )
draw.DrawText("1: "..(option1 or "!!!"), "TargetID", x+(border*2)+4, y+(border*2)+8+optionspace, Color(255,255,255), TEXT_ALIGN_LEFT)
draw.DrawText(voted1[1] or "0", "TargetID", (x+(border*2)+4 + (w-(border*4))) - 8, y+(border*2)+8+optionspace, Color(255,255,255), TEXT_ALIGN_RIGHT)
optionspace = optionspace + spacer+optionwidth
end
surface.SetDrawColor(127, 62, 10, 128)
if option2 ~= nil and option2 ~= "" then
surface.DrawRect( x+(border*2), y+(border*2) + optionspace, w-(border*4), optionwidth )
amount = amount+1
surface.SetDrawColor(251, 126, 20, 128)
local am = (options[amount]/playercount) * w-(border*4)
if am > w-(border*4) then
am = w-(border*4)
end
surface.DrawRect( x+(border*2), y+(border*2) + optionspace, am, optionwidth )
draw.DrawText("2: "..(option2 or "!!!"), "TargetID", x+(border*2)+4, y+(border*2)+8+optionspace, Color(255,255,255), TEXT_ALIGN_LEFT)
draw.DrawText(voted1[2] or "0", "TargetID", (x+(border*2)+4 + (w-(border*4))) - 8, y+(border*2)+8+optionspace, Color(255,255,255), TEXT_ALIGN_RIGHT)
optionspace = optionspace + spacer+optionwidth
end
surface.SetDrawColor(127, 62, 10, 128)
if option3 ~= nil and option3 ~= "" then
surface.DrawRect( x+(border*2), y+(border*2) + optionspace, w-(border*4), optionwidth )
amount = amount+1
surface.SetDrawColor(251, 126, 20, 128)
local am = (options[amount]/playercount) * w-(border*4)
if am > w-(border*4) then
am = w-(border*4)
end
surface.DrawRect( x+(border*2), y+(border*2) + optionspace, am, optionwidth )
draw.DrawText("3: "..(option3 or "!!!") or "!!!", "TargetID", x+(border*2)+4, y+(border*2)+8+optionspace, Color(255,255,255), TEXT_ALIGN_LEFT)
draw.DrawText(voted1[3] or "0", "TargetID", (x+(border*2)+4 + (w-(border*4))) - 8, y+(border*2)+8+optionspace, Color(255,255,255), TEXT_ALIGN_RIGHT)
optionspace = optionspace + spacer+optionwidth
end
surface.SetDrawColor(127, 62, 10, 128)
if option4 ~= nil and option4 ~= "" then
surface.DrawRect( x+(border*2), y+(border*2) + optionspace, w-(border*4), optionwidth )
amount = amount+1
surface.SetDrawColor(251, 126, 20, 128)
local am = (options[amount]/playercount) * w-(border*4)
if am > w-(border*4) then
am = w-(border*4)
end
surface.DrawRect( x+(border*2), y+(border*2) + optionspace, am, optionwidth )
draw.DrawText("4: "..(option4 or "!!!"), "TargetID", x+(border*2)+4, y+(border*2)+8+optionspace, Color(255,255,255), TEXT_ALIGN_LEFT)
draw.DrawText(voted2[1] or "0", "TargetID", (x+(border*2)+4 + (w-(border*4))) - 8, y+(border*2)+8+optionspace, Color(255,255,255), TEXT_ALIGN_RIGHT)
optionspace = optionspace + spacer+optionwidth
end
surface.SetDrawColor(127, 62, 10, 128)
if option5 ~= nil and option5 ~= "" then
surface.DrawRect( x+(border*2), y+(border*2) + optionspace, w-(border*4), optionwidth )
amount = amount+1
surface.SetDrawColor(251, 126, 20, 128)
local am = (options[amount]/playercount) * w-(border*4)
if am > w-(border*4) then
am = w-(border*4)
end
surface.DrawRect( x+(border*2), y+(border*2) + optionspace, am, optionwidth )
draw.DrawText("5: "..(option5 or "!!!") or "!!!", "TargetID", x+(border*2)+4, y+(border*2)+8+optionspace, Color(255,255,255), TEXT_ALIGN_LEFT)
draw.DrawText(voted1[2] or "0", "TargetID", (x+(border*2)+4 + (w-(border*4))) - 8, y+(border*2)+8+optionspace, Color(255,255,255), TEXT_ALIGN_RIGHT)
optionspace = optionspace + spacer+optionwidth
end
surface.SetDrawColor(127, 62, 10, 128)
if option6 ~= nil and option6 ~= "" then
surface.DrawRect( x+(border*2), y+(border*2) + optionspace, w-(border*4), optionwidth )
amount = amount+1
surface.SetDrawColor(251, 126, 20, 128)
local am = (options[amount]/playercount) * w-(border*4)
if am > w-(border*4) then
am = w-(border*4)
end
surface.DrawRect( x+(border*2), y+(border*2) + optionspace, am, optionwidth )
draw.DrawText("6: "..(option6 or "!!!") or "!!!", "TargetID", x+(border*2)+4, y+(border*2)+8+optionspace, Color(255,255,255), TEXT_ALIGN_LEFT)
draw.DrawText(voted1[3] or "0", "TargetID", (x+(border*2)+4 + (w-(border*4))) - 8, y+(border*2)+8+optionspace, Color(255,255,255), TEXT_ALIGN_RIGHT)
optionspace = optionspace + spacer+optionwidth
end
draw.DrawText("Use '!vote 1-"..amount.."' to vote on this poll.", "TargetID", (x+w)/2, y+(border*2)+optionspace-8, Color(255,255,255), TEXT_ALIGN_CENTER)
end
local buffer = 1
local x, y = self:GetPos()
hook.Add("Think", self, function(self)
playercount = player.GetCount()
local x, y = self:GetPos()
if self.transitioning == nil then -- not transitioning
if GetGlobalBool("KiwiPollIsActive", false) == false then
if self:IsShown() then
self:StartHide()
options = {
0,
0,
0,
0,
0,
0,
}
end
elseif GetGlobalBool("KiwiPollIsActive", false) == true then
if self:IsHidden() then
self:StartShow()
options = {
0,
0,
0,
0,
0,
0,
}
end
end
elseif self.transitioning == true then -- transitioning up (showing)
if x < offset then
self.transitionuse = self.transitionuse + 1
self:SetPos(x + self.transitionuse, y)
else
self.transitioning = nil
self.transitionuse = 0
end
elseif self.transitioning == false then -- transitioning down (hiding)
if x > 0-w then
self.transitionuse = self.transitionuse + 1
self:SetPos(x - self.transitionuse, y)
else
self.transitioning = nil
self.transitionuse = 0
end
end
if voted1 ~= nil and voted2 ~= nil then
for k,v in ipairs(options) do
local var = voted1
local key = k
if k > 3 then
var = voted2
key = k - 3
end
if var[key] > v then
options[k] = options[k]+0.05
end
end
end
end)
end
function PANEL:HidePanel()
self:SetPos(0, offset)
end
vgui.Register("PollingUI", PANEL, "Panel")
|
local Class = require "lib.hump.class"
local InputGenerator = require "engine.controls.input_generator"
local AIList = {}
local RandomInputGenerator = Class {
__includes = InputGenerator,
init = function(self)
InputGenerator.init(self)
end
}
function RandomInputGenerator:getInputSnapshot()
local rndValue = love.math.random(4)
local inputs = {
up = rndValue == 1 and 1 or 0,
down = rndValue == 2 and 1 or 0,
left = rndValue == 3 and 1 or 0,
right = rndValue == 4 and 1 or 0,
}
inputs.move = Vector(inputs.right - inputs.left, inputs.up - inputs.down)
return inputs
end
function AIList.getFlyingEnemyAI(actor) --, player, targetSystem, andWhatNot )
return RandomInputGenerator()
end
return AIList
|
--- enemy that explodes when it is killed
My.EventHandler:register("onEnemySpawn", function(_, enemyInfo)
local repairConfig = enemyInfo:getConfig().repair
if repairConfig == nil then return end
local friends = {}
-- the cron to find all friends in range. T
-- this can run less often than the health replenishment to lower load.
Cron.regular(function(self)
if not enemyInfo:isSpawned() then
Cron.abort(self)
return
end
local ship = enemyInfo:getShipObject()
friends = {}
for _, thing in pairs(ship:getObjectsInRange(repairConfig.radius)) do
if isEeShipTemplateBased(thing) and ship:isFriendly(thing) then
table.insert(friends, thing)
end
end
end, 1.5, 0)
-- the cron to replenish hull on enemies
Cron.regular(function(self, delta)
if not enemyInfo:isSpawned() then
Cron.abort(self)
return
end
for _, friend in pairs(friends) do
if friend:isValid() and friend:getHull() < friend:getHullMax() then
friend:setHull(math.min(friend:getHull() + delta * repairConfig.rate, friend:getHullMax()))
end
end
end)
end)
|
local bundle = require('app/bundle')
local tap = require('util/tap')
local assert = require('assert')
local fs = require('fs')
local util = require('util')
local path = require('path')
describe('test bundle - openBundle', function()
local reader, err = bundle.openBundle()
assert(reader == nil)
reader = bundle.openBundle('')
assert(reader == nil)
reader = bundle.openBundle({})
assert(reader == nil)
-- openBundle
local dirname = path.join(util.dirname(), '../../../app/lpm/')
reader, err = bundle.openBundle(dirname)
if (err) then
console.log(dirname, reader, err)
end
assert(reader)
-- getFileCount
local fileCount = reader:getFileCount()
console.log('fileCount', fileCount)
assert(fileCount > 1)
-- getFilename
local filename = reader:getFilename()
assert(filename == nil)
filename = reader:getFilename(0)
assert(filename == nil)
filename = reader:getFilename(1)
assert.equal(filename, 'bin/lpm')
-- stat
local fileStat = reader:stat()
assert(fileStat == nil)
fileStat = reader:stat(0)
assert(fileStat == nil)
fileStat = reader:stat(1)
-- console.log('fileStat', fileStat)
assert.equal(fileStat.type, 'file')
-- isDirectory
local isDirectory = reader:isDirectory()
assert(not isDirectory)
isDirectory = reader:isDirectory(0)
assert(not isDirectory)
isDirectory = reader:isDirectory(1)
assert(not isDirectory)
isDirectory = reader:isDirectory(2)
assert(not isDirectory)
-- getIndex
local index = reader:getIndex()
assert(index == nil)
index = reader:getIndex('')
assert(index == nil)
index = reader:getIndex({})
assert(index == nil)
index = reader:getIndex(1)
assert(index == nil)
index = reader:getIndex('bin')
assert(index == nil)
index = reader:getIndex('bin/lpm')
assert.equal(index, 1)
index = reader:getIndex('lua/init.lua')
assert.equal(index, 4)
-- extract
local data = reader:extract(0)
assert.equal(data, '')
data = reader:extract(1)
assert.equal(#data, 59)
-- close
reader:close()
end)
describe('test bundle - openBundle (zip)', function()
local reader, err = bundle.openBundle()
assert(reader == nil)
reader = bundle.openBundle('')
assert(reader == nil)
reader = bundle.openBundle({})
assert(reader == nil)
-- openBundle
local dirname = path.join(util.dirname(), '../../../build/sdk/x64-linux/app/lpm.zip')
reader, err = bundle.openBundle(dirname)
if (err) then
console.log(dirname, reader, err)
end
assert(reader)
-- getFileCount
local fileCount = reader:getFileCount()
console.log('fileCount', fileCount)
assert(fileCount > 1)
for i = 1, fileCount do
console.log(reader:getFilename(i))
end
-- getFilename
local filename = reader:getFilename(-1)
assert(filename == nil)
filename = reader:getFilename(0)
assert(filename == nil)
filename = reader:getFilename(1)
assert.equal(filename, 'bin/lpm')
-- stat
local fileStat = reader:stat(-1)
assert(fileStat == nil)
fileStat = reader:stat(0)
assert(fileStat == nil)
fileStat = reader:stat(1)
console.log('fileStat', fileStat)
assert.equal(fileStat.filename, 'bin/lpm')
-- isDirectory
local isDirectory = reader:isDirectory(-1)
assert(not isDirectory)
isDirectory = reader:isDirectory(0)
assert(not isDirectory)
isDirectory = reader:isDirectory(1)
assert(not isDirectory)
isDirectory = reader:isDirectory(2)
assert(not isDirectory)
-- getIndex
local index = reader:getIndex(-1)
assert(index == nil)
index = reader:getIndex('')
assert(index == nil)
index = reader:getIndex(1)
assert(index == nil)
index = reader:getIndex('bin')
assert(index == nil)
index = reader:getIndex('bin/lpm')
assert.equal(index, 1)
index = reader:getIndex('lua/init.lua')
assert.equal(index, 4)
-- extract
local data = reader:extract(0)
console.log('data', data)
assert.equal(data, '')
data = reader:extract(1)
assert.equal(#data, 59)
-- close
reader:close()
end)
|
TOOL.Category = "Render"
TOOL.Name = "#tool.material.name"
TOOL.ClientConVar[ "override" ] = "debug/env_cubemap_model"
--
-- Duplicator function
--
local function SetMaterial( Player, Entity, Data )
if ( SERVER ) then
--
-- Make sure this is in the 'allowed' list in multiplayer - to stop people using exploits
--
if ( !game.SinglePlayer() && !list.Contains( "OverrideMaterials", Data.MaterialOverride ) && Data.MaterialOverride != "" ) then return end
Entity:SetMaterial( Data.MaterialOverride )
duplicator.StoreEntityModifier( Entity, "material", Data )
end
return true
end
duplicator.RegisterEntityModifier( "material", SetMaterial )
--
-- Left click applies the current material
--
function TOOL:LeftClick( trace )
if ( !IsValid( trace.Entity ) ) then return end
if ( CLIENT ) then return true end
local ent = trace.Entity
if ( IsValid( ent.AttachedEntity ) ) then ent = ent.AttachedEntity end
local mat = self:GetClientInfo( "override" )
SetMaterial( self:GetOwner(), ent, { MaterialOverride = mat } )
return true
end
--
-- Right click reverts the material
--
function TOOL:RightClick( trace )
if ( !IsValid( trace.Entity ) ) then return end
if ( CLIENT ) then return true end
local ent = trace.Entity
if ( IsValid( ent.AttachedEntity ) ) then ent = ent.AttachedEntity end
SetMaterial( self:GetOwner(), ent, { MaterialOverride = "" } )
return true
end
if ( IsMounted( "tf" ) ) then
list.Add( "OverrideMaterials", "models/player/shared/gold_player" )
list.Add( "OverrideMaterials", "models/player/shared/ice_player" )
end
list.Add( "OverrideMaterials", "models/wireframe" )
list.Add( "OverrideMaterials", "debug/env_cubemap_model" )
list.Add( "OverrideMaterials", "models/shadertest/shader3" )
list.Add( "OverrideMaterials", "models/shadertest/shader4" )
list.Add( "OverrideMaterials", "models/shadertest/shader5" )
list.Add( "OverrideMaterials", "models/shiny" )
list.Add( "OverrideMaterials", "models/debug/debugwhite" )
list.Add( "OverrideMaterials", "Models/effects/comball_sphere" )
list.Add( "OverrideMaterials", "Models/effects/comball_tape" )
list.Add( "OverrideMaterials", "Models/effects/splodearc_sheet" )
list.Add( "OverrideMaterials", "Models/effects/vol_light001" )
list.Add( "OverrideMaterials", "models/props_combine/stasisshield_sheet" )
list.Add( "OverrideMaterials", "models/props_combine/portalball001_sheet" )
list.Add( "OverrideMaterials", "models/props_combine/com_shield001a" )
list.Add( "OverrideMaterials", "models/props_c17/frostedglass_01a" )
list.Add( "OverrideMaterials", "models/props_lab/Tank_Glass001" )
list.Add( "OverrideMaterials", "models/props_combine/tprings_globe" )
list.Add( "OverrideMaterials", "models/rendertarget" )
list.Add( "OverrideMaterials", "models/screenspace" )
list.Add( "OverrideMaterials", "brick/brick_model" )
list.Add( "OverrideMaterials", "models/props_pipes/GutterMetal01a" )
list.Add( "OverrideMaterials", "models/props_pipes/Pipesystem01a_skin3" )
list.Add( "OverrideMaterials", "models/props_wasteland/wood_fence01a" )
list.Add( "OverrideMaterials", "models/props_foliage/tree_deciduous_01a_trunk" )
list.Add( "OverrideMaterials", "models/props_c17/FurnitureFabric003a" )
list.Add( "OverrideMaterials", "models/props_c17/FurnitureMetal001a" )
list.Add( "OverrideMaterials", "models/props_c17/paper01" )
list.Add( "OverrideMaterials", "models/flesh" )
-- phx
list.Add( "OverrideMaterials", "phoenix_storms/metalset_1-2" )
list.Add( "OverrideMaterials", "phoenix_storms/metalfloor_2-3" )
list.Add( "OverrideMaterials", "phoenix_storms/plastic" )
list.Add( "OverrideMaterials", "phoenix_storms/wood" )
list.Add( "OverrideMaterials", "phoenix_storms/bluemetal" )
list.Add( "OverrideMaterials", "phoenix_storms/cube" )
list.Add( "OverrideMaterials", "phoenix_storms/dome" )
list.Add( "OverrideMaterials", "phoenix_storms/gear" )
list.Add( "OverrideMaterials", "phoenix_storms/stripes" )
list.Add( "OverrideMaterials", "phoenix_storms/wire/pcb_green" )
list.Add( "OverrideMaterials", "phoenix_storms/wire/pcb_red" )
list.Add( "OverrideMaterials", "phoenix_storms/wire/pcb_blue" )
list.Add( "OverrideMaterials", "hunter/myplastic" )
list.Add( "OverrideMaterials", "models/XQM/LightLinesRed_tool" )
function TOOL.BuildCPanel( CPanel )
CPanel:AddControl( "Header", { Description = "#tool.material.help" } )
CPanel:MatSelect( "material_override", list.Get( "OverrideMaterials" ), true, 64, 64 )
end
|
local super = Class("FocusEvent", ComponentEvent).getSuperclass()
FocusEvent.FOCUS_FIRST = 1004
FocusEvent.FOCUS_LAST = 1005
FocusEvent.FOCUS_GAINED = FocusEvent.FOCUS_FIRST --Event.GOT_FOCUS
FocusEvent.FOCUS_LOST = 1 + FocusEvent.FOCUS_FIRST --Event.LOST_FOCUS
function FocusEvent:init(source, id, temporary, opposite)
super.init(self, source, id)
self.temporary = temporary or false
self.opposite = opposite or nil
return self
end
function FocusEvent:isTemporary()
return self.temporary
end
function FocusEvent:getOppositeComponent()
if (self.opposite == nil) then
return nil
end
return self.opposite
end
function FocusEvent:paramString()
local typeStr = "unknown type"
if(id == FocusEvent.FOCUS_GAINED) then
typeStr = "FOCUS_GAINED"
elseif(id == FocusEvent.FOCUS_LOST) then
typeStr = "FOCUS_LOST"
end
if(self.temporary) then typeStr = typeStr .. ",temporary" else typeStr = typeStr .. ",permanent" end
--IIF(temporary,",temporary",",permanent")
return typeStr .. ",opposite=" .. tostring(self:getOppositeComponent())
end
|
-------------------------------------------------
-- APT Widget for Awesome Window Manager
-- Lists containers and allows to manage them
-- More details could be found here:
-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/apt-widget
-- @author Pavel Makhov
-- @copyright 2021 Pavel Makhov
-------------------------------------------------
local awful = require("awful")
local wibox = require("wibox")
local spawn = require("awful.spawn")
local naughty = require("naughty")
local gears = require("gears")
local beautiful = require("beautiful")
local HOME_DIR = os.getenv("HOME")
local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/apt-widget'
local ICONS_DIR = WIDGET_DIR .. '/icons/'
local LIST_PACKAGES = [[sh -c "apt list --upgradable 2>/dev/null"]]
--- Utility function to show warning messages
local function show_warning(message)
naughty.notify{
preset = naughty.config.presets.critical,
title = 'Docker Widget',
text = message}
end
local wibox_popup = wibox {
ontop = true,
visible = false,
shape = function(cr, width, height)
gears.shape.rounded_rect(cr, width, height, 4)
end,
border_width = 1,
border_color = beautiful.bg_focus,
max_widget_size = 500,
height = 500,
width = 300,
}
local apt_widget = wibox.widget {
{
{
id = 'icon',
widget = wibox.widget.imagebox
},
margins = 4,
layout = wibox.container.margin
},
layout = wibox.layout.fixed.horizontal,
set_icon = function(self, new_icon)
self:get_children_by_id("icon")[1].image = new_icon
end
}
--- Parses the line and creates the package table out of it
--- yaru-theme-sound/focal-updates,focal-updates 20.04.10.1 all [upgradable from: 20.04.8]
local parse_package = function(line)
local name,_,nv,type,ov = line:match('(.*)%/(.*)%s(.*)%s(.*)%s%[upgradable from: (.*)]')
if name == nil then return nil end
local package = {
name = name,
new_version = nv,
type = type,
old_version = ov
}
return package
end
local function worker(user_args)
local args = user_args or {}
local icon = args.icon or ICONS_DIR .. 'white-black.svg'
apt_widget:set_icon(icon)
local pointer = 0
local min_widgets = 5
local carousel = false
local function rebuild_widget(containers, errors, _, _)
local to_update = {}
if errors ~= '' then
show_warning(errors)
return
end
local rows = wibox.layout.fixed.vertical()
rows:connect_signal("button::press", function(_,_,_,button)
if carousel then
if button == 4 then -- up scrolling
local cnt = #rows.children
local first_widget = rows.children[1]
rows:insert(cnt+1, first_widget)
rows:remove(1)
elseif button == 5 then -- down scrolling
local cnt = #rows.children
local last_widget = rows.children[cnt]
rows:insert(1, last_widget)
rows:remove(cnt+1)
end
else
if button == 5 then -- up scrolling
if pointer < #rows.children and ((#rows.children - pointer) >= min_widgets) then
pointer = pointer + 1
rows.children[pointer].visible = false
end
elseif button == 4 then -- down scrolling
if pointer > 0 then
rows.children[pointer].visible = true
pointer = pointer - 1
end
end
end
end)
for line in containers:gmatch("[^\r\n]+") do
local package = parse_package(line)
if package ~= nil then
local refresh_button = wibox.widget {
{
{
id = 'icon',
image = ICONS_DIR .. 'refresh-cw.svg',
resize = false,
widget = wibox.widget.imagebox
},
margins = 4,
widget = wibox.container.margin
},
shape = gears.shape.circle,
opacity = 0.5,
widget = wibox.container.background
}
local old_cursor, old_wibox
refresh_button:connect_signal("mouse::enter", function(c)
c:set_opacity(1)
c:emit_signal('widget::redraw_needed')
local wb = mouse.current_wibox
old_cursor, old_wibox = wb.cursor, wb
wb.cursor = "hand1"
end)
refresh_button:connect_signal("mouse::leave", function(c)
c:set_opacity(0.5)
c:emit_signal('widget::redraw_needed')
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
end
end)
local row = wibox.widget {
{
{
{
{
id = 'checkbox',
checked = false,
color = beautiful.bg_normal,
paddings = 2,
shape = gears.shape.circle,
forced_width = 20,
forced_height = 20,
check_color = beautiful.fg_urgent,
border_color = beautiful.bg_urgent,
border_width = 1,
widget = wibox.widget.checkbox
},
valign = 'center',
layout = wibox.container.place,
},
{
{
id = 'name',
markup = '<b>' .. package['name'] .. '</b>',
widget = wibox.widget.textbox
},
halign = 'left',
layout = wibox.container.place
},
{
refresh_button,
halign = 'right',
valign = 'center',
fill_horizontal = true,
layout = wibox.container.place,
},
spacing = 8,
layout = wibox.layout.fixed.horizontal
},
margins = 8,
layout = wibox.container.margin
},
id = 'row',
bg = beautiful.bg_normal,
widget = wibox.container.background,
click = function(self, checked)
local a = self:get_children_by_id('checkbox')[1]
if checked == nil then
a:set_checked(not a.checked)
else
a:set_checked(checked)
end
if a.checked then
to_update[package['name']] = self
else
to_update[package['name']] = false
end
end,
update = function(self)
refresh_button:get_children_by_id('icon')[1]:set_image(ICONS_DIR .. 'watch.svg')
self:get_children_by_id('name')[1]:set_opacity(0.4)
self:get_children_by_id('name')[1]:emit_signal('widget::redraw_needed')
spawn.easy_async(
string.format([[sh -c 'yes | aptdcon --hide-terminal -u %s']], package['name']),
function(stdout, stderr) -- luacheck:ignore 212
rows:remove_widgets(self)
end)
end
}
row:connect_signal("mouse::enter", function(c)
c:set_bg(beautiful.bg_focus)
end)
row:connect_signal("mouse::leave", function(c)
c:set_bg(beautiful.bg_normal)
end)
row:connect_signal("button::press", function(c, _, _, button)
if button == 1 then c:click() end
end)
refresh_button:buttons(awful.util.table.join(awful.button({}, 1, function()
row:update()
end)))
rows:add(row)
end
end
local header_checkbox = wibox.widget {
checked = false,
color = beautiful.bg_normal,
paddings = 2,
shape = gears.shape.circle,
forced_width = 20,
forced_height = 20,
check_color = beautiful.fg_urgent,
border_color = beautiful.bg_urgent,
border_width = 1,
widget = wibox.widget.checkbox
}
header_checkbox:connect_signal("button::press", function(c)
c:set_checked(not c.checked)
local cbs = rows.children
for _,v in ipairs(cbs) do
v:click(c.checked)
end
end)
local header_refresh_icon = wibox.widget {
image = ICONS_DIR .. 'refresh-cw.svg',
resize = false,
widget = wibox.widget.imagebox
}
header_refresh_icon:buttons(awful.util.table.join(awful.button({}, 1, function()
print(#to_update)
for _,v in pairs(to_update) do
if v ~= nil then
v:update()
end
end
end)))
local header_row = wibox.widget {
{
{
{
header_checkbox,
valign = 'center',
layout = wibox.container.place,
},
{
{
id = 'name',
markup = '<b>' .. #rows.children .. '</b> packages to update',
widget = wibox.widget.textbox
},
halign = 'center',
layout = wibox.container.place
},
{
header_refresh_icon,
halign = 'right',
valign = 'center',
layout = wibox.container.place,
},
layout = wibox.layout.align.horizontal
},
margins = 8,
layout = wibox.container.margin
},
bg = beautiful.bg_normal,
widget = wibox.container.background
}
wibox_popup:setup {
header_row,
rows,
layout = wibox.layout.fixed.vertical
}
end
apt_widget:buttons(
awful.util.table.join(
awful.button({}, 1, function()
if wibox_popup.visible then
wibox_popup.visible = not wibox_popup.visible
else
spawn.easy_async(LIST_PACKAGES,
function(stdout, stderr)
rebuild_widget(stdout, stderr)
wibox_popup.visible = true
awful.placement.top(wibox_popup, { margins = { top = 20 }, parent = mouse})
end)
end
end)
)
)
return apt_widget
end
return setmetatable(apt_widget, { __call = function(_, ...) return worker(...) end })
|
object_tangible_loot_creature_loot_collections_fish_naboo_gumfish = object_tangible_loot_creature_loot_collections_shared_fish_naboo_gumfish:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_creature_loot_collections_fish_naboo_gumfish, "object/tangible/loot/creature/loot/collections/fish_naboo_gumfish.iff")
|
object_tangible_tcg_series4_shared_consumable_ball_of_peace = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_consumable_ball_of_peace.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_consumable_ball_of_peace, "object/tangible/tcg/series4/shared_consumable_ball_of_peace.iff")
--*****************************************
object_tangible_tcg_series4_shared_consumable_falleens_fist = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_consumable_falleens_fist.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_consumable_falleens_fist, "object/tangible/tcg/series4/shared_consumable_falleens_fist.iff")
--*****************************************
object_tangible_tcg_series4_shared_consumable_t16_toy = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_consumable_t16_toy.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_consumable_t16_toy, "object/tangible/tcg/series4/shared_consumable_t16_toy.iff")
--*****************************************
object_tangible_tcg_series4_shared_creature_pet_deed_nuna = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_creature_pet_deed_nuna.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_creature_pet_deed_nuna, "object/tangible/tcg/series4/shared_creature_pet_deed_nuna.iff")
--*****************************************
object_tangible_tcg_series4_shared_decorative_chewbacca_statuette = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_decorative_chewbacca_statuette.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_decorative_chewbacca_statuette, "object/tangible/tcg/series4/shared_decorative_chewbacca_statuette.iff")
--*****************************************
object_tangible_tcg_series4_shared_decorative_child_bed_01 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_decorative_child_bed_01.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_decorative_child_bed_01, "object/tangible/tcg/series4/shared_decorative_child_bed_01.iff")
--*****************************************
object_tangible_tcg_series4_shared_decorative_droid_oil_bath = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_decorative_droid_oil_bath.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_decorative_droid_oil_bath, "object/tangible/tcg/series4/shared_decorative_droid_oil_bath.iff")
--*****************************************
object_tangible_tcg_series4_shared_decorative_han_solo_statuette = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_decorative_han_solo_statuette.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_decorative_han_solo_statuette, "object/tangible/tcg/series4/shared_decorative_han_solo_statuette.iff")
--*****************************************
object_tangible_tcg_series4_shared_decorative_han_solo_statuette = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_decorative_han_solo_statuette.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_decorative_han_solo_statuette, "object/tangible/tcg/series4/shared_decorative_han_solo_statuette.iff")
--*****************************************
object_tangible_tcg_series4_shared_decorative_kashyyyk_travel_advertisement = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_decorative_kashyyyk_travel_advertisement.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_decorative_kashyyyk_travel_advertisement, "object/tangible/tcg/series4/shared_decorative_kashyyyk_travel_advertisement.iff")
--*****************************************
object_tangible_tcg_series4_shared_decorative_leia_r2_diorama = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_decorative_leia_r2_diorama.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_decorative_leia_r2_diorama, "object/tangible/tcg/series4/shared_decorative_leia_r2_diorama.iff")
--*****************************************
object_tangible_tcg_series4_shared_decorative_medical_table_01 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_decorative_medical_table_01.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_decorative_medical_table_01, "object/tangible/tcg/series4/shared_decorative_medical_table_01.iff")
--*****************************************
object_tangible_tcg_series4_shared_decorative_stuffed_tauntaun = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_decorative_stuffed_tauntaun.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_decorative_stuffed_tauntaun, "object/tangible/tcg/series4/shared_decorative_stuffed_tauntaun.iff")
--*****************************************
object_tangible_tcg_series4_shared_decorative_stuffed_wampa = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_decorative_stuffed_wampa.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_decorative_stuffed_wampa, "object/tangible/tcg/series4/shared_decorative_stuffed_wampa.iff")
--*****************************************
object_tangible_tcg_series4_shared_decorative_tatooine_travel_advertisement = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_decorative_tatooine_travel_advertisement.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_decorative_tatooine_travel_advertisement, "object/tangible/tcg/series4/shared_decorative_tatooine_travel_advertisement.iff")
--*****************************************
object_tangible_tcg_series4_shared_decorative_tauntaun_ride = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_decorative_tauntaun_ride.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_decorative_tauntaun_ride, "object/tangible/tcg/series4/shared_decorative_tauntaun_ride.iff")
--*****************************************
object_tangible_tcg_series4_shared_decorative_tcg_rug_01 = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_decorative_tcg_rug_01.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_decorative_tcg_rug_01, "object/tangible/tcg/series4/shared_decorative_tcg_rug_01.iff")
--*****************************************
object_tangible_tcg_series4_shared_greeter_deed_nightsister = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_greeter_deed_nightsister.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_greeter_deed_nightsister, "object/tangible/tcg/series4/shared_greeter_deed_nightsister.iff")
--*****************************************
object_tangible_tcg_series4_shared_greeter_deed_pa_lowick = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_greeter_deed_pa_lowick.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_greeter_deed_pa_lowick, "object/tangible/tcg/series4/shared_greeter_deed_pa_lowick.iff")
--*****************************************
object_tangible_tcg_series4_shared_house_pet_rotten_egg = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_house_pet_rotten_egg.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_house_pet_rotten_egg, "object/tangible/tcg/series4/shared_house_pet_rotten_egg.iff")
--*****************************************
object_tangible_tcg_series4_shared_instant_travel_terminal_home = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_instant_travel_terminal_home.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_instant_travel_terminal_home, "object/tangible/tcg/series4/shared_instant_travel_terminal_home.iff")
--*****************************************
object_tangible_tcg_series4_shared_instant_travel_terminal_location = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_instant_travel_terminal_location.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_instant_travel_terminal_location, "object/tangible/tcg/series4/shared_instant_travel_terminal_location.iff")
--*****************************************
object_tangible_tcg_series4_shared_mount_deed_peko_peko = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_mount_deed_peko_peko.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_mount_deed_peko_peko, "object/tangible/tcg/series4/shared_mount_deed_peko_peko.iff")
--*****************************************
object_tangible_tcg_series4_shared_structure_deed_relaxation_pool = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_structure_deed_relaxation_pool.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_structure_deed_relaxation_pool, "object/tangible/tcg/series4/shared_structure_deed_relaxation_pool.iff")
--*****************************************
object_tangible_tcg_series4_shared_vehicle_deed_balta_podracer = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_vehicle_deed_balta_podracer.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_vehicle_deed_balta_podracer, "object/tangible/tcg/series4/shared_vehicle_deed_balta_podracer.iff")
--*****************************************
object_tangible_tcg_series4_shared_vehicle_deed_geonosian_speeder = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_vehicle_deed_geonosian_speeder.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_vehicle_deed_geonosian_speeder, "object/tangible/tcg/series4/shared_vehicle_deed_geonosian_speeder.iff")
--*****************************************
object_tangible_tcg_series4_shared_vehicle_deed_senate_pod = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_vehicle_deed_senate_pod.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_vehicle_deed_senate_pod, "object/tangible/tcg/series4/shared_vehicle_deed_senate_pod.iff")
--*****************************************
object_tangible_tcg_series4_shared_vendor_deed_kitonak = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_vendor_deed_kitonak.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_vendor_deed_kitonak, "object/tangible/tcg/series4/shared_vendor_deed_kitonak.iff")
--*****************************************
object_tangible_tcg_series4_shared_vendor_deed_toydarian = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_vendor_deed_toydarian.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_vendor_deed_toydarian, "object/tangible/tcg/series4/shared_vendor_deed_toydarian.iff")
--*****************************************
object_tangible_tcg_series4_shared_video_game_table = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_video_game_table.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_video_game_table, "object/tangible/tcg/series4/shared_video_game_table.iff")
--*****************************************
object_tangible_tcg_series4_shared_wearable_chandrilan_dress = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_wearable_chandrilan_dress.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_wearable_chandrilan_dress, "object/tangible/tcg/series4/shared_wearable_chandrilan_dress.iff")
--*****************************************
object_tangible_tcg_series4_shared_wearable_guise_of_vapaad = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/tcg/series4/shared_wearable_guise_of_vapaad.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_tcg_series4_shared_wearable_guise_of_vapaad, "object/tangible/tcg/series4/shared_wearable_guise_of_vapaad.iff")
|
test = require 'u-test'
common = require 'common'
function TestXblContextCreate_Handler()
XblAddServiceCallRoutedHandler()
XblRemoveServiceCallRoutedHandler()
XblContextSettingsGetLongHttpTimeout()
XblContextSettingsSetLongHttpTimeout()
XblContextSettingsGetHttpRetryDelay()
XblContextSettingsSetHttpRetryDelay()
XblContextSettingsGetHttpTimeoutWindow()
XblContextSettingsSetHttpTimeoutWindow()
XblContextSettingsGetWebsocketTimeoutWindow()
XblContextSettingsSetWebsocketTimeoutWindow()
XblContextSettingsGetUseCrossPlatformQosServers()
XblContextSettingsSetUseCrossPlatformQosServers()
test.stopTest();
end
test.TestXblContextCreate = function()
common.init(TestXblContextCreate_Handler)
end
|
-- Useful copy functions
-- Deep Copy
-- This is good for instantiating tables/objects without too much effort :)
function deepcopy(t)
if type(t) ~= 'table' then return t end
local mt = getmetatable(t)
local res = {}
for k,v in pairs(t) do
if type(v) == 'table' then
v = deepcopy(v)
end
res[k] = v
end
setmetatable(res,mt)
return res
end
|
if minetest.get_modpath("default") then
minetest.register_craft({
output = "currency:safe",
recipe = {
{"default:steel_ingot", "default:steel_ingot",
"default:steel_ingot"},
{"default:steel_ingot", "default:mese_crystal",
"default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot",
"default:steel_ingot"},
}
})
minetest.register_craft({
output = "currency:shop",
recipe = {
{"default:sign_wall"},
{"default:chest_locked"},
}
})
minetest.register_craft({
output = "currency:barter",
recipe = {
{"default:sign_wall"},
{"default:chest"},
}
})
end
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld_cent_10",
recipe = {
"currency:minegeld_cent_5",
"currency:minegeld_cent_5"
},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld_cent_5 2",
recipe = {"currency:minegeld_cent_10"},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld_cent_25",
recipe = {
"currency:minegeld_cent_5",
"currency:minegeld_cent_5",
"currency:minegeld_cent_5",
"currency:minegeld_cent_5",
"currency:minegeld_cent_5"
},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld_cent_5 5",
recipe = {"currency:minegeld_cent_25"},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld",
recipe = {
"currency:minegeld_cent_25",
"currency:minegeld_cent_25",
"currency:minegeld_cent_25",
"currency:minegeld_cent_25"
},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld_cent_25 4",
recipe = {"currency:minegeld"},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld_5",
recipe = {
"currency:minegeld",
"currency:minegeld",
"currency:minegeld",
"currency:minegeld",
"currency:minegeld"
},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld 5",
recipe = {"currency:minegeld_5"},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld_10",
recipe = {
"currency:minegeld_5",
"currency:minegeld_5"
},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld_5 2",
recipe = {"currency:minegeld_10"},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld 5",
recipe = {"currency:minegeld_5"},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld_10 5",
recipe = {"currency:minegeld_50"},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld_50",
recipe = {
"currency:minegeld_10",
"currency:minegeld_10",
"currency:minegeld_10",
"currency:minegeld_10",
"currency:minegeld_10"
},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld_100",
recipe = {
"currency:minegeld_50",
"currency:minegeld_50"
},
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld_50 2",
recipe = {"currency:minegeld_100" },
})
minetest.register_craft({
type = "shapeless",
output = "currency:minegeld_bundle",
recipe = {
"group:minegeld_note",
"group:minegeld_note",
"group:minegeld_note",
"group:minegeld_note",
"group:minegeld_note",
"group:minegeld_note",
"group:minegeld_note",
"group:minegeld_note",
"group:minegeld_note"
},
})
minetest.register_craft({
type = "fuel",
recipe = "currency:minegeld_bundle",
burntime = 1,
})
|
local path = select(1,...):sub(1,-(string.len("container")+1))
local class = require("Libraries.middleclass")
--Container object class
local container = class("DiskOS.GUI.container")
--Default internal values:
container.static.lightcol = 9 --The light color
container.static.darkcol = 4 --The dark color
container.static.bgcol = 0 --Background color
container.static.tcol = 7 --Text color
--Create a new objects container:
--<gui>: The GUI instance of this container.
--[x],[y]: The position of the top-left corner of the object.
--[w],[h]: The size of the object.
function container:initialize(gui,parentContainer,x,y,w,h,bgcol,tcol,lightcol,darkcol,sheet)
self.gui = gui or error("GUI State has to be passed",2)
self.container = parentContainer or error("Container has to be passed",2)
self.objects = {} --Registered objects
self.x = x or 0
self.y = y or 0
self.w = w or screenWidth()
self.h = h or screenHeight()
self.visible = true
if self.container == self then
self.sheet = sheet
self.lightcol = lightcol or container.static.lightcol
self.darkcol = darkcol or container.static.darkcol
self.bgcol = bgcol or container.static.bgcol
self.tcol = tcol or container.static.tcol
else
self:setLightColor(lightcol or self.container:getLightColor(),true)
self:setDarkColor(darkcol or self.container:getDarkColor(),true)
self:setBGColor(bgcol or self.container:getBGColor(),true)
self:setTColor(tcol or self.container:getTColor(),true)
self:setSheet(sheet or self.container:getSheet(),true)
end
end
--Get object GUI instance.
function container:getGUI()
return self.gui
end
--Get object parent container.
function container:getContainer()
return self.container
end
--Set object visiblilty
function container:setVisible(visible,nodraw)
self.visible = visible or false
if not self.visible then
self.down, self.touchid, self.mousepressed = false, false, false
if not nodraw then self:clear() end
end
end
function container:isVisible()
return self.visible
end
--Set object position.
function container:setX(x,nodraw)
if not nodraw then self:clear() end
self.x = x or self.x
if not nodraw then self:draw() end
return self
end
function container:setY(y,nodraw)
if not nodraw then self:clear() end
self.y = y or self.y
if not nodraw then self:draw() end
return self
end
function container:setPosition(x,y,nodraw)
if not nodraw then self:clear() end
self:setX(x,true)
self:setY(y,true)
if not nodraw then self:draw() end
return self
end
--Get object position
function container:getX() return self.x end
function container:getY() return self.y end
function container:getPosition() return self:getX(), self:getY() end
--Set object size
function container:setWidth(w,nodraw)
if not nodraw then self:clear() end
self.w = w or self.w
if not nodraw then self:draw() end
return self
end
function container:setHeight(h,nodraw)
if not nodraw then self:clear() end
self.h = h or self.h
if not nodraw then self:draw() end
return self
end
function container:setSize(w,h,nodraw)
if not nodraw then self:clear() end
self:setWidth(w,true)
self:setHeight(h,true)
if not nodraw then self:draw() end
return self
end
--Get object size
function container:getWidth() return self.w end
function container:getHeight() return self.h end
function container:getSize() return self:getWidth(), self:getHeight() end
function container:setRect(x,y,w,h,nodraw)
if not nodraw then self:clear() end
self:setPosition(x,y,true)
self:setSize(x,y,true)
if not nodraw then self:draw() end
return self
end
function container:getRect()
local x,y = self:getPosition()
local w,h = self:getSize()
return x,y,w,h
end
--Set object colors
function container:setLightColor(lightcol,nodraw)
if not nodraw then self:clear() end
self.lightcol = lightcol or self.lightcol
if not nodraw then self:draw() end
return self
end
function container:setDarkColor(darkcol,nodraw)
if not nodraw then self:clear() end
self.darkcol = darkcol or self.darkcol
if not nodraw then self:draw() end
return self
end
function container:setBGColor(bgcol,nodraw)
if not nodraw then self:clear() end
self.bgcol = bgcol or self.bgcol
if not nodraw then self:draw() end
return self
end
function container:setTColor(tcol,nodraw)
if not nodraw then self:clear() end
self.tcol = tcol or self.tcol
if not nodraw then self:draw() end
return self
end
function container:setColors(lightcol,darkcol,bgcol,tcol,nodraw)
if not nodraw then self:clear() end
self:setLightColor(lightcol,true)
self:setDarkColor(darkcol,true)
self:setBGColor(bgcol,true)
self:setTColor(tcol,true)
if not nodraw then self:draw() end
return self
end
--Get object colors
function container:getLightColor() return self.lightcol end
function container:getDarkColor() return self.darkcol end
function container:getBGColor() return self.bgcol end
function container:getTColor() return self.tcol end
function container:getColors() return self:getLightColor(), self:getDarkColor(), self:getBGColor(), self:getTColor() end
--Set the object sheet
function container:setSheet(sheet,nodraw)
if not nodraw then self:clear() end
self.sheet = sheet or self.sheet
if not nodraw then self:draw() end
return self
end
--Get the object sheet
function container:getSheet() return self.sheet end
--Register a new object
function container:register(obj)
table.insert(self.objects,obj)
end
--Return registered objects list
function container:getObjects() return self.objects end
--Create a new object
function container:newObject(name,...)
local objclass = self.gui:getObjectClass(name) --Get the object class from the loaded objects list
if not objclass then return error("Object '"..name.."' doesn't exist !") end
local obj = objclass(self.gui,self,...) --Create a new object
self:register(obj) --Register the object in this GUI instance so it's events get called.
return obj --Return the created object
end
--Clear previous draw area.
function container:clear()
local x,y = self:getPosition()
local w,h = self:getSize()
local bgColor = self.container:getBGColor()
rect(x,y,w,h,false,bgColor)
end
--Draw the container
function container:_draw(dt)
if self:isVisible() then
local x,y = self:getPosition()
local w,h = self:getSize()
local bgColor = self:getBGColor()
rect(x,y,w,h,false,bgColor)
self:event("draw")
end
end
--Hooks
function container:event(event,a,b,c,d,e,f)
event = "_"..event
if self[event] and event ~= "_draw" then
if self[event](self,a,b,c,d,e,f) then
return true --Event consumed
end
end
local x,y = self:getPosition()
pushMatrix()
cam("translate",x,y)
if event:sub(2,6) == "mouse" then
a,b = a-x, b-y
elseif event:sub(2,6) == "touch" then
b,c = b-x, c-y
end
local consumed = false --Did the even get consumed ?
for k, obj in ipairs(self:getObjects()) do
if obj.event and event ~= "_draw" then
if obj:event(event:sub(2,-1),a,b,c,d,e,f) then
consumed = true
break --Event consumed
end
elseif obj[event] then
if obj[event](obj,a,b,c,d,e,f) then
consumed = true
break --Event consumed
end
end
end
popMatrix()
if event == "_mousepressed" or event == "_mousereleased" then
self:_mousemoved(a,b,0,0,d)
end
return consumed
end
function container:draw()
self:_draw()
self:event("draw")
end
function container:_mousemoved(x,y,dx,dy,istouch)
if istouch then return end
local cx,cy = self:getPosition()
for k, obj in ipairs(self:getObjects()) do
if obj.cursor then
local c = obj:cursor(x-cx,y-cy)
if c then
return c
end
end
end
end
function container:cursor(x,y)
return self:_mousemoved(x,y,0,0,false)
end
return container
|
local _={}
_.name="Cauldron"
_.new=function(options)
local result=BaseEntity.new(options)
result.x=0
result.y=0
Entity.setSprite(result,"cauldron")
result.isDrawable=true
result.worldId=nil
--result.aiEnabled=true
result.canPickup=true
result.originX=8
result.originY=10
Entity.afterCreated(result,_,options)
return result
end
_.draw=function(entity)
--todo: remove from drawables on removing from world
if entity.worldId==nil then return end
local sprite=Img[entity.spriteName]
LG.draw(sprite,entity.x,entity.y)
end
-- place self in world
_.use=function(cauldron,x,y)
dbgCtxIn("cauldron use")
log(
"cauldron use. isRegistered:"..tostring(Entity.isRegistered(cauldron)).." "..Entity.toString(cauldron)
)
Entity.usePlaceable(cauldron,x,y)
dbgCtxOut()
end
return _
|
local FWDist = require 'FWDistribution'
require "socket"
function sleep(sec)
socket.select(nil, nil, sec)
end
print (FWDist.version())
firmwares = FWDist.available()
for key,value in pairs(firmwares)
do
for key,value in pairs(value)
do
print(key,value)
end
end
--FWDist.download{DeviceID=0x12345678, ChipType=0x0001, Revision=0x0002, Address="::1", Flags={"Reset"}}
print "Requesting reset"
FWDist.reset{DeviceID=0x12345678, Address="::1", Timeout=10, DepthInfluence=100, RepeatCount=3, RepeatTime=100}
print "Done"
while true do
for key, value in ipairs(FWDist.status())
do
print (type(key))
for key,value in pairs(value)
do
print(key,value)
end
end
print "Done"
sleep(1)
end
|
function SpawnPoints()
return {
unemployed = {
{ worldX = 29, worldY = 25, posX = 238, posY = 127, posZ = 0 },
{ worldX = 44, worldY = 19, posX = 90, posY = 148, posZ = 0 },
{ worldX = 4, worldY = 0, posX = 184, posY = 216, posZ = 0 },
{ worldX = 6, worldY = 11, posX = 56, posY = 63, posZ = 0 },
{ worldX = 41 + 0, worldY = 31 + 0, posX = 90, posY = 208, posZ = 0 },
{ worldX = 41 + 0, worldY = 31 + 1, posX = 29, posY = 51, posZ = 0 },
{ worldX = 46, worldY = 34, posX = 40, posY = 152, posZ = 0 },
{ worldX = 43, worldY = 36, posX = 269, posY = 102, posZ = 0 },
{ worldX = 45, worldY = 36, posX = 29, posY = 80, posZ = 0 },
{ worldX = 11, worldY = 22, posX = 158, posY = 150, posZ = 0 },
{ worldX = 28, worldY = 56, posX = 60, posY = 173, posZ = 0 } ,
{ worldX = 30, worldY = 21, posX = 297, posY = 177, posZ = 0 },
{ worldX = 30, worldY = 21, posX = 297, posY = 123, posZ = 0 },
{ worldX = 43, worldY = 23, posX = 240, posY = 2, posZ = 0 },
{ worldX = 24, worldY = 50, posX = 285, posY = 69, posZ = 0 },
{worldX=44, worldY=13, posX=223, posY=217}, -- Small house 1
{worldX=44, worldY=13, posX=133, posY=238}, -- Medium house 1
{ worldX = 5, worldY = 42, posX = 69, posY = 122, posZ = 0 },
{ worldX = 17, worldY = 28, posX = 47, posY = 91, posZ = 0 },
{ worldX = 17, worldY = 28, posX = 43, posY = 66, posZ = 0 },
{ worldX = 17, worldY = 28, posX = 70, posY = 231, posZ = 0 },
{ worldX = 42, worldY = 23, posX = 132, posY = 77, posZ = 0 },
{ worldX = 10 + 25, worldY = 4 + 56, posX = 229, posY = 263, posZ = 0 },
{ worldX = 10 + 28, worldY = 4 + 58, posX = 182, posY = 55, posZ = 1 },
{ worldX = 10 + 37, worldY = 4 + 60, posX = 243, posY = 130, posZ = 0 },
{ worldX = -18 + 32, worldY = 9 + 25, posX = 112, posY = 185, posZ = 0 },
{ worldX = -18 + 32, worldY = 9 + 25, posX = 95, posY = 190, posZ = 0 },
{ worldX = 31, worldY = 24, posX = 211, posY = 232, posZ = 0 },
{ worldX = 15 + 34, worldY = (-7) + 46, posX = 278, posY = 40, posZ = 0 },
{ worldX = 15 + 38, worldY = (-7) + 52, posX = 47, posY = 127, posZ = 0 },
{ worldX = 50, worldY = 16, posX = 114, posY = 188, posZ = 1 },
{ worldX = 50, worldY = 16, posX = 64, posY = 291, posZ = 0 },
{ worldX = 1, worldY = 36, posX = 132, posY = 157, posZ = 0 },
{ worldX = 44, worldY = 22, posX = 54, posY = 44, posZ = 0 },
{ worldX = 40, worldY = 42, posX = 279, posY = 266, posZ = 3 },
{ worldX = 41, worldY = 44, posX = 66, posY = 152, posZ = 0 },
{ worldX = 42, worldY = 45, posX = 242, posY = 280, posZ = 0 },
{worldX=28, worldY=33, posX=116, posY=232}, -- little house2
{ worldX = 37, worldY = 35, posX = 168, posY = 188, posZ = 0 },
{ worldX = -23 + 29, worldY = 2 + 33, posX = 155, posY = 160, posZ = 0 },
{ worldX = 20, worldY = 35, posX = 292, posY = 96, posZ = 0 },
{worldX= -4 + 26, worldY= 2 + 31, posX=219, posY=268, posZ=0},
{worldX= -4 + 27, worldY= 2 + 31, posX=145, posY=268, posZ=0},
{worldX= -4 + 28, worldY= 2 + 31, posX=90, posY=87, posZ=0},
{ worldX = 26, worldY = 42, posX = 249, posY = 2, posZ = 0 },
--lobii old:
{ worldX = (-16) + 47, worldY = (34) + 24, posX = 167, posY = 125, posZ = 0 },
{ worldX = (-16) + 47, worldY = (34) + 24, posX = 45, posY = 227, posZ = 0 },
{ worldX = (-16) + 48, worldY = (34) + 24, posX = 18, posY = 163, posZ = 0 },
{ worldX = (-9) + 46, worldY = (29) + 23, posX = 252, posY = 79, posZ = 1 },
{ worldX = (-9) + 48, worldY = (29) + 25, posX = 109, posY = 294, posZ = 1 },
{ worldX = (-9) + 50, worldY = (29) + 27, posX = 76, posY = 20, posZ = 0 },
{ worldX = 33, worldY = 26, posX = 138, posY = 253, posZ = 0 },
{ worldX = 33, worldY = 26, posX = -121, posY = 151, posZ = 0 },
{ worldX = 52, worldY = 24, posX = 294, posY = 291, posZ = 0 },
{ worldX = 8, worldY = 60, posX = 278, posY = 132, posZ = 0 },
{ worldX = 18, worldY = (6) + 30, posX = 166, posY = 117, posZ = 0 },
{ worldX = 39, worldY = 18, posX = 216, posY = 193, posZ = 0 },
{ worldX = 39, worldY = 18, posX = 255, posY = 129, posZ = 0 },
{ worldX = 39, worldY = 18, posX = 250, posY = 40, posZ = 0 },
{ worldX = 30, worldY = 50, posX = 244, posY = 192, posZ = 0 },
{ worldX = 29, worldY = 46, posX = 117, posY = 127, posZ = 0 },
{ worldX = 30, worldY = 45, posX = 71, posY = 183, posZ = 0 },
{ worldX = 48, worldY = 32, posX = 69, posY = 43, posZ = 0 },
{ worldX = 45, worldY = 31, posX = 200, posY = 220, posZ = 0 },
{ worldX = 32 + 0, worldY = 38 + 0, posX = 167, posY = 73, posZ = 0 },
{ worldX = 32 + 0, worldY = 38 + 0, posX = 149, posY = 22, posZ = 0 },
{ worldX = 32 + 1, worldY = 38 + 1, posX = 111, posY = 145, posZ = 0 },
{ worldX = 8, worldY = 42, posX = 238, posY = 204, posZ = 0 },
{ worldX = 10, worldY = 42, posX = 97, posY = 100, posZ = 0 },
{ worldX = 8, worldY = 46, posX = 100, posY = 63, posZ = 0 },
{ worldX = 40, worldY = 18, posX = 64, posY = 241, posZ = 0 },
{ worldX = 41, worldY = 13, posX = 228, posY = 340, posZ = 0 },
{ worldX = 37, worldY = 20, posX = 109, posY = 270, posZ = 0 },
{ worldX = 37, worldY = 21, posX = 122, posY = 299, posZ = 0 },
{ worldX = 37, worldY = 37, posX = 201, posY = 100, posZ = 0 },
{ worldX = 37, worldY = 37, posX = 181, posY = 100, posZ = 0 },
{ worldX = 38, worldY = 37, posX = 213, posY = 214, posZ = 0 },
{ worldX = 31, worldY = 25, posX = 205, posY = 277, posZ = 0 },
{ worldX = 15, worldY = 34, posX = 210, posY = 181, posZ = 0},
--rosebury
{ worldX = -2 + 3, worldY = -14 + 44, posX = 49, posY = 191, posZ = 0 },
{ worldX = -2 + 3, worldY = -14 + 44, posX = 80, posY = 293, posZ = 0 },
{ worldX = -2 + 4, worldY = -14 + 45, posX = 45, posY = 226, posZ = 0 },
{ worldX = 47, worldY = 53, posX = 266, posY = 103, posZ = 0},
{ worldX = 36, worldY = 46, posX = -76, posY = 380, posZ = 0 },
{ worldX = 36, worldY = 46, posX = -107, posY = 273, posZ = 0 },
{ worldX = 31, worldY = 23, posX = 216, posY = 69, posZ = 0 },
{ worldX = 49, worldY = 18, posX = 244, posY = 332, posZ = 0 },
{ worldX = 49, worldY = 18, posX = 308, posY = 231, posZ = 0 },
{ worldX = 49, worldY = 18, posX = 274, posY = 146, posZ = 0 },
{ worldX = 39, worldY = 26, posX = 1, posY = 141, posZ = 0 },
{ worldX = (-49) + 53, worldY = (18) + 23, posX = 94, posY = 70, posZ = 0 },
{ worldX = 32, worldY = 34, posX = 73, posY = 169, posZ = 0 },
{ worldX = 32, worldY = 31, posX = 260 , posY = 216, posZ = 0 },
{ worldX = 30, worldY = 26, posX = 64, posY = 79, posZ = 2 },
{ worldX = 31, worldY = 22, posX = 274, posY = 186, posZ = 0 },
{ worldX = 41, worldY = 12, posX = 212, posY = 292, posZ = 0 },
{ worldX = 47 + 1, worldY = 20 -2 + 4, posX = 275, posY = 12, posZ = 0 },
{ worldX = 47 + 2, worldY = 20 -2 + 4, posX = 80, posY = 287, posZ = 0 },
{ worldX = 47 + 2, worldY = 20 -2 + 5, posX = 11, posY = 176, posZ = 0 },
{ worldX = 40, worldY = 23, posX = 140, posY = 62, posZ = 0 },
{ worldX = 41, worldY = 23, posX = 38, posY = 30, posZ = 0 },
{ worldX = 37, worldY = 28, posX = 215, posY = 82, posZ = 3 },
{ worldX = 37, worldY = 28, posX = 206, posY = 60, posZ = 1 },
{ worldX = 37, worldY = 28, posX = 185, posY = 352, posZ = 0 },
{worldX=11+25, worldY=8+25, posX=116, posY=232}, -- little house2
{worldX=11+25, worldY=8+25, posX=84, posY=259},
{worldX=11+25, worldY=8+25, posX=123, posY=196},
{worldX=17, worldY=20, posX=295, posY=56}, -- trailer park 1
{worldX=21, worldY=18, posX=51, posY=20}, -- small house 5
{worldX=19, worldY=18, posX=260, posY=23}, -- bar
{worldX=27, worldY=38, posX=151, posY=208}, -- Small house 1
{worldX=27, worldY=38, posX=108, posY=200}, -- Medium house 1
{worldX=28, worldY=38, posX=18, posY=286}, -- Small house 5
{worldX=39, worldY=22, posX=204, posY=125}, -- Medium house1
{worldX=39, worldY=22, posX=59, posY=84}, -- Small house 1
{worldX=40, worldY=23, posX=21, posY=14}, -- Motel
},
}
end
|
lanes = require "lanes".configure{with_timers=false}
-- make sure we can copy functions with interdependant upvalues
local b
local a = function( n)
print( "a", n)
return n <= 0 and n or b( n-1)
end
local c
b = function( n)
print( "b", n)
return n <= 0 and n or c( n-1)
end
c = function( n)
print( "c", n)
return n <= 0 and n or a( n-1)
end
local g = lanes.gen( "*", a)
local l = g(10)
l:join()
|
function onDrop(abilitynode, x, y, draginfo)
-- Chits
if draginfo.isType("chit") then
if draginfo.getCustomData() == "recharge" then
return addRecharge(abilitynode);
end
end
end
function addRecharge(abilitynode)
if abilitynode.isOwner() then
local socketednode = abilitynode.getChild("socketed");
if socketednode and socketednode.getValue() ~= 0 then
-- attempt to get the parent character slots node
local characterslotsnode = abilitynode.getParent().getParent().getChild("slots");
if characterslotsnode then
for k, v in pairs(characterslotsnode.getChildren()) do
local recordnamenode = v.getChild("recordname");
if recordnamenode then
local recordname = recordnamenode.getValue();
if recordname == abilitynode.getNodeName() then
local rechargenode = v.createChild("currentrecharge", "number");
if rechargenode and rechargenode.isOwner() then
rechargenode.setValue(rechargenode.getValue() + 1);
return true;
end
end
end
end
end
-- if we got this far, then the ability must be socketed to the party sheet
local partyslotsnode = DB.findNode("partysheet.slots");
if partyslotsnode then
for k, v in pairs(partyslotsnode.getChildren()) do
local recordnamenode = v.getChild("recordname");
if recordnamenode then
local recordname = recordnamenode.getValue();
if recordname == abilitynode.getNodeName() then
local rechargenode = v.createChild("currentrecharge", "number");
if rechargenode and rechargenode.isOwner() then
rechargenode.setValue(rechargenode.getValue() + 1);
return true;
end
end
end
end
end
end
end
end
|
--[[md:
## aurora.table - utils for handling tables
]]
local M = ondemand('aurora.table')
--[[md:
### table.toSet (list)
* list : a list table
* returns a table indexed with values of list, easily searchable
]]
function M.toSet (list)
local set = {}
for _,v in ipairs(list) do set[v]=true end
return set
end
return M
|
local Object = require "classic"
local Mediator = require "mediator"
local Events = Object:extend()
Events.TYPES = {
CLUSTER_PROPAGATE = "CLUSTER_PROPAGATE",
ENTITY_CREATED = "ENTITY_CREATED",
ENTITY_UPDATED = "ENTITY_UPDATED",
ENTITY_DELETED = "ENTITY_DELETED",
["MEMBER-JOIN"] = "MEMBER-JOIN",
["MEMBER-LEAVE"] = "MEMBER-LEAVE",
["MEMBER-FAILED"] = "MEMBER-FAILED",
["MEMBER-UPDATE"] = "MEMBER-UPDATE",
["MEMBER-REAP"] = "MEMBER-REAP"
}
function Events:new(plugins)
self._mediator = Mediator()
end
function Events:subscribe(event_name, fn)
if fn then
self._mediator:subscribe({event_name}, function(message_t)
fn(message_t)
return nil, true -- Required to tell mediator to continue processing other events
end)
end
end
function Events:publish(event_name, message_t)
if event_name then
self._mediator:publish({string.upper(event_name)}, message_t)
end
end
return Events
|
local Current = "none"
local ply, wep, vm, Mode, alpha, num, amt, nw_wep, nw_num
local function ReceiveAlpha(um)
wep = um:ReadEntity()
alpha = um:ReadShort()
if IsValid(wep) then
wep.VElements["silencer"].color.a = alpha
if wep.WElements["silencer"] then
wep.WElements["silencer"].color.a = alpha
end
if wep.VElements["silencer2"] then
wep.VElements["silencer2"].color.a = alpha
wep.WElements["silencer2"].color.a = alpha
end
end
end
usermessage.Hook("NWAlpha", ReceiveAlpha)
local function DoVMStuff(um)
ply = LocalPlayer()
if not IsValid(ply) or not ply:Alive() then
return
end
wep = ply:GetActiveWeapon()
vm = ply:GetViewModel()
if not wep.BoneMod then
wep.BoneMod = {}
end
if wep.BoneMod then
wep.BoneMod.cur = {}
for i = 1, vm:GetBoneCount() - 1 do
wep.BoneMod.cur[vm:GetBoneName(i)] = {curoffset = Vector(0, 0, 0), currotation = Angle(0, 0, 0)}
end
end
end
usermessage.Hook("DOVMSTUFF", DoVMStuff)
local GrenadeTypes = {
[1] = {t = "40MM HE", am = "40MM_HE"},
[2] = {t = "40MM CE", am = "40MM_CE"},
[3] = {t = "40MM SMOKE", am = "40MM_Smoke"}}
local function Receive40MMType(um)
num = um:ReadShort()
ply = LocalPlayer()
if not IsValid(ply) or not ply:Alive() then
return
end
wep = ply:GetActiveWeapon()
wep.GrenadeName = GrenadeTypes[num].t
wep.Secondary.Ammo = GrenadeTypes[num].am
end
usermessage.Hook("40MMTYPE", Receive40MMType)
local nw_num, nw_wep
local function DoStuffWithModels(num, ent)
Current = CWAttachments[CWAttachmentsMeta[num]]
if not Current then
return
end
if not ent.VElements or not ent.WElements then
return
end
if Current.modelattfunc then
Current.modelattfunc(ent)
end
if Current.scope then
ent.ScopeRenderFunc = Current.scope.renderfunc
ent.FovMod = Current.scope.fovmod
end
if Current.clattfunc then
Current.clattfunc(ent)
end
if Current.incompability then
for k, v in pairs(ent.VElements) do
for k2, v2 in pairs(Current.incompability) do
if k == v2 then
v.color.a = 0
end
end
end
ent.VElements[Current.key].color.a = 255
if ent.WElements then
for k, v in pairs(ent.WElements) do
for k2, v2 in pairs(Current.incompability) do
if k == v2 then
v.color.a = 0
end
end
end
if ent.WElements[Current.key] then
ent.WElements[Current.key].color.a = 255
end
end
else
ent.VElements[Current.key].color.a = 255
if ent.WElements[Current.key] then
ent.WElements[Current.key].color.a = 255
end
end
ply = LocalPlayer()
wep = ply:GetActiveWeapon()
ent.ScaleBonesWhenAttached = true
if ent == wep then
surface.PlaySound("weapons/cstm/attach.wav")
for k, v in ipairs(wep.Attachments) do
for k2, v2 in ipairs(v) do
if v2 == Current.key then
table.insert(wep.Attachments[k].last, Current.key)
end
end
end
end
end
local function ReceiveAttachmentNumber2(um)
nw_wep = um:ReadEntity()
nw_num = um:ReadShort()
DoStuffWithModels(nw_num, nw_wep)
end
usermessage.Hook("NWATT2", ReceiveAttachmentNumber2)
local function ReceiveInternalPart(um)
nw_num = um:ReadShort()
Current = CWInternalParts[CWInternalPartsMeta[nw_num]]
if not Current then
return
end
ply = LocalPlayer()
wep = ply:GetActiveWeapon()
surface.PlaySound("weapons/cstm/ammo_select.wav")
for k, v in ipairs(wep.InternalParts) do
for k2, v2 in ipairs(v) do
if v2.key == Current.key then
for k3, v3 in pairs(wep.InternalParts[k]) do
v3.active = false
end
v2.active = true
table.insert(wep.InternalParts[k].last, Current.key)
end
end
end
end
usermessage.Hook("INTERNALPART", ReceiveInternalPart)
local function RemoveInternalPart(um)
nw_num = um:ReadShort()
Current = CWInternalParts[CWInternalPartsMeta[nw_num]]
if not Current then
return
end
ply = LocalPlayer()
wep = ply:GetActiveWeapon()
surface.PlaySound("weapons/cstm/ammo_deselect.wav")
for k, v in ipairs(wep.InternalParts) do
for k2, v2 in ipairs(v) do
if v2.key == Current.key then
v2.active = false
wep.InternalParts[k].last = {}
end
end
end
end
usermessage.Hook("INTERNALPARTREM", RemoveInternalPart)
local function ReceiveAmmoType(um)
num = um:ReadString()
ply = LocalPlayer()
wep = ply:GetActiveWeapon()
wep.LastAmmo = AmmoTypes[num].name
wep.PenMod = AmmoTypes[num].penmod
table.insert(wep.AmmoCycle, num)
surface.PlaySound("weapons/cstm/ammo_select.wav")
end
usermessage.Hook("NWAMMO", ReceiveAmmoType)
local function DeselectAmmoType(um)
num = um:ReadString()
ply = LocalPlayer()
wep = ply:GetActiveWeapon()
wep.LastAmmo = "Normal"
wep.PenMod = 1
wep.AmmoCycle = {}
surface.PlaySound("weapons/cstm/ammo_deselect.wav")
end
usermessage.Hook("DESELECTAMMO", DeselectAmmoType)
local function RemoveAttachment(um)
nw_wep = um:ReadEntity()
nw_num = um:ReadShort()
if IsValid(nw_wep) and nw_wep.VElements then
Current = CWAttachments[CWAttachmentsMeta[nw_num]]
if Current.cldeattfunc then
Current.cldeattfunc(nw_wep)
end
if Current.scope then
nw_wep.ScopeRenderFunc = nil
end
nw_wep.VElements[Current.key].color.a = 0
if nw_wep.WElements then
if nw_wep.WElements[Current.key] then
nw_wep.WElements[Current.key].color.a = 0
end
end
nw_wep.ScaleBonesWhenAttached = false
ply = LocalPlayer()
wep = ply:GetActiveWeapon()
if nw_wep == wep then
surface.PlaySound("weapons/cstm/detach.wav")
for k, v in ipairs(wep.Attachments) do
for k2, v2 in ipairs(v) do
if v2 == Current.key then
wep.Attachments[k].last = {}
end
end
end
end
end
end
usermessage.Hook("NWRATT", RemoveAttachment)
local function ReceiveReloadSpeed(um)
wep = um:ReadEntity()
amt = um:ReadFloat()
if IsValid(wep) then
wep.ReloadSpeed = amt
end
end
usermessage.Hook("NWSPD", ReceiveReloadSpeed)
local function ReceiveHT(um)
wep = um:ReadEntity()
if IsValid(wep) and wep.SetWeaponHoldType then
wep:SetWeaponHoldType(um:ReadString())
end
end
usermessage.Hook("NWHT", ReceiveHT)
local function ReceiveNumBul(um)
ply = LocalPlayer()
wep = ply:GetActiveWeapon()
if IsValid(ply) and IsValid(wep) then
wep.Primary.NumShots = um:ReadShort()
end
end
usermessage.Hook("NBUL", ReceiveNumBul)
local function ReceiveFireMode(um)
ply = um:ReadEntity()
Mode = um:ReadString()
wep = ply:GetActiveWeapon()
wep.FireMode = Mode
if IsValid(ply) and IsValid(wep) then
if wep.FireModeNames then
t = wep.FireModeNames[Mode]
wep.Primary.Automatic = t.auto
wep.Bullets = t.bul
wep.Safe = t.safe
if wep.Safe then
if wep.HoldType == "pistol" then
wep:SetWeaponHoldType("normal")
else
wep:SetWeaponHoldType("passive")
end
else
wep:SetWeaponHoldType(wep.HoldType)
end
if ply == LocalPlayer() then
surface.PlaySound("weapons/cstm/firemode" .. math.random(1, 2) .. ".wav")
end
end
end
end
usermessage.Hook("FRMD", ReceiveFireMode)
local function CSTM_Recoil()
ply = LocalPlayer()
wep = ply:GetActiveWeapon()
vm = ply:GetViewModel()
wep.RecoilAmt = wep.DefRecoil * wep:GetDTFloat(1)
wep.RecoilTime = CurTime() + 0.5
wep:MuzzleFlosh()
end
usermessage.Hook("RECOIL", CSTM_Recoil)
local function M203_On()
ply = LocalPlayer()
wep = ply:GetActiveWeapon()
wep.Grenade = true
end
usermessage.Hook("M203_ON", M203_On)
local function M203_Off()
ply = LocalPlayer()
wep = ply:GetActiveWeapon()
wep.Grenade = false
end
usermessage.Hook("M203_OFF", M203_Off)
|
RULE = {
mini = {
name = "HOUSE_MINI",
desc = "HOUSE_MINI_DESC",
mission = "UNLOCK_RULE",
img = "161aba690c6.png",
imgDesc = "15c4c117200.png",
conflict = {"maxi"},
public = true,
type = "PASSIVE",
},
maxi = {
name = "HOUSE_MAXI",
desc = "HOUSE_MAXI_DESC",
mission = "UNLOCK_RULE",
img = "161a5c5ab66.png",
imgDesc = "15c4c1147fa.png",
conflict = {"mini", "noaction"},
public = true,
type = "PASSIVE",
},
flash = {
name = "HOUSE_FLASH",
desc = "HOUSE_FLASH_DESC",
mission = "UNLOCK_RULE",
img = "161a5c4ee17.png",
imgDesc = "15c4c10b14a.png",
conflict = {},
public = true,
rulecard = true,
type = "PASSIVE",
},
revelation = {
name = "HOUSE_REVELATION",
desc = "HOUSE_REVELATION_DESC",
mission = "UNLOCK_RULE",
img = "161a5c67cd7.png",
imgDesc = "15c4c122df3.png",
conflict = {"tracking","luck"},
public = true,
rulecard = true,
type = "PASSIVE",
},
clean = {
name = "HOUSE_CLEAN_FINISH",
desc = "HOUSE_CLEAN_FINISH_DESC",
mission = "UNLOCK_RULE",
img = "161a5c4bee3.png",
imgDesc = "15c4c106f11.png",
conflict = {"mess"},
public = true,
rulecard = true,
type = "PASSIVE",
},
insatisfaction = {
name = "HOUSE_INSATISFACTION",
desc = "HOUSE_INSATISFACTION_DESC",
mission = "UNLOCK_RULE",
img = "161a5c54da8.png",
imgDesc = "15c4c11067f.png",
conflict = {"satisfaction","fastdraw"},
public = true,
rulecard = true,
type = "PASSIVE",
},
perfection = {
name = "HOUSE_PERFECTION",
desc = "HOUSE_PERFECTION_DESC",
mission = "UNLOCK_RULE",
img = "161a5d807dc.png",
imgDesc = "15c4c11e306.png",
conflict = {"sequence","stack","mess"},
public = true,
rulecard = true,
type = "PASSIVE",
},
black = {
name = "HOUSE_BLACK",
desc = "HOUSE_BLACK_DESC",
mission = "UNLOCK_RULE",
img = "161a5c46d70.png",
imgDesc = "15c4c100109.png",
conflict = {},
public = true,
rulecard = true,
type = "PASSIVE",
},
stack = {
name = "HOUSE_STACK",
desc = "HOUSE_STACK_DESC",
mission = "UNLOCK_RULE",
img = "161a5c6d857.png",
imgDesc = "15c4c125f22.png",
conflict = {"perfection","sequence","mess","neighbor"},
public = true,
rulecard = true,
type = "PASSIVE",
},
tracking = {
name = "HOUSE_TRACKING",
desc = "HOUSE_TRACKING_DESC",
mission = "UNLOCK_RULE",
img = "161a5c72d66.png",
imgDesc = "15c4c128bdc.png",
conflict = {"revelation","luck"},
public = true,
rulecard = true,
type = "PASSIVE",
},
overload = {
name = "HOUSE_OVERLOAD",
desc = "HOUSE_OVERLOAD_DESC",
mission = "UNLOCK_RULE",
img = "161a5c6501f.png",
imgDesc = "15c4c11b32b.png",
conflict = {"limbo"},
public = true,
rulecard = true,
type = "PASSIVE",
},
jumpin = {
name = "HOUSE_JUMP_IN",
desc = "HOUSE_JUMP_IN_DESC",
mission = "UNLOCK_RULE",
img = "161a5c5649d.png",
imgDesc = "15c4c111e36.png",
conflict = {},
public = true,
rulecard = true,
type = "PASSIVE",
},
satisfaction = {
name = "HOUSE_SATISFACTION",
desc = "HOUSE_SATISFACTION_DESC",
mission = "UNLOCK_RULE",
img = "161a5c69300.png",
imgDesc = "15c4c12471e.png",
conflict = {"insatisfaction","fastdraw"},
public = true,
rulecard = true,
type = "PASSIVE",
},
nocombo = {
name = "HOUSE_NO_COMBO",
desc = "HOUSE_NO_COMBO_DESC",
mission = "UNLOCK_RULE",
img = "161a5c637ab.png",
imgDesc = "15c4c119de5.png",
conflict = {"supercombo","hell","noaction","nou"},
public = true,
rulecard = true,
type = "PASSIVE",
},
supercombo = {
name = "HOUSE_SUPER_COMBO",
desc = "HOUSE_SUPER_COMBO_DESC",
mission = "UNLOCK_RULE",
img = "161a5c6f2c2.png",
imgDesc = "15c4c1274b9.png",
conflict = {"nocombo","hell","noaction"},
public = true,
rulecard = true,
type = "PASSIVE",
},
hell = {
name = "HOUSE_HELL",
desc = "HOUSE_HELL_DESC",
mission = "UNLOCK_RULE",
img = "161a5c536f3.png",
imgDesc = "15c4c10da85.png",
conflict = {"nocombo","supercombo","noaction","mess"},
public = true,
rulecard = true,
type = "PASSIVE",
},
mulligan = {
name = "HOUSE_MULLIGAN",
desc = "HOUSE_MULLIGAN_DESC",
mission = "UNLOCK_RULE",
img = "161a5c5da7b.png",
imgDesc = "15c4c11871d.png",
conflict = {},
public = true,
type = "PASSIVE",
},
death = {
name = "HOUSE_DEATH",
desc = "HOUSE_DEATH_DESC",
mission = "UNLOCK_RULE",
img = "15c326229de.png",
imgDesc = "15c4c1085a8.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
carousel = {
name = "HOUSE_CAROUSEL",
desc = "HOUSE_CAROUSEL_DESC",
mission = "UNLOCK_RULE",
img = "15c3261f5eb.png",
imgDesc = "15c4c102dad.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
trade = {
name = "HOUSE_TRADE",
desc = "HOUSE_TRADE_DESC",
mission = "UNLOCK_RULE",
img = "15c3260caa5.png",
imgDesc = "15c4c12a68e.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
gift = {
name = "HOUSE_GIFT",
desc = "HOUSE_GIFT_DESC",
mission = "UNLOCK_RULE",
img = "15c32617c3c.png",
imgDesc = "15c4c10c563.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
spy = {
name = "HOUSE_VIEW",
desc = "HOUSE_VIEW_DESC",
mission = "UNLOCK_RULE",
img = "15c3261b803.png",
imgDesc = "15c4c12bd97.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
rain = {
name = "HOUSE_RAIN",
desc = "HOUSE_RAIN_DESC",
mission = "UNLOCK_RULE",
img = "15c326277fd.png",
imgDesc = "15c4c11fc59.png",
conflict = {"noaction","mess"},
card = {color={"red","blue"}},
public = true,
rulecard = true,
type = "CARD",
},
equality = {
name = "HOUSE_EQUALITY",
desc = "HOUSE_EQUALITY_DESC",
mission = "UNLOCK_RULE",
img = "15c326118f3.png",
imgDesc = "15c4c109ba8.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
chair = {
name = "HOUSE_CHAIRS",
desc = "HOUSE_CHAIRS_DESC",
mission = "UNLOCK_RULE",
img = "15c32619855.png",
imgDesc = "15c4c1042aa.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
meep = {
name = "HOUSE_MEEP",
desc = "HOUSE_MEEP_DESC",
mission = "UNLOCK_RULE",
img = "15c3261d7ec.png",
imgDesc = "15c4c115cdc.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
bomb = {
name = "HOUSE_BOMB",
desc = "HOUSE_BOMB_DESC",
mission = "UNLOCK_RULE",
img = "15c3260e9cd.png",
imgDesc = "15c4c101787.png",
conflict = {"noaction","mess"},
card = {color={"black"}},
public = true,
rulecard = true,
type = "CARD",
},
random = {
name = "HOUSE_RANDOM",
desc = "HOUSE_RANDOM_DESC",
mission = "UNLOCK_RULE",
img = "15c3261560c.png",
imgDesc = "15c4c121517.png",
conflict = {"noaction","mess"},
card = {color={"black"}},
public = true,
rulecard = true,
type = "CARD",
},
peace = {
name = "HOUSE_PEACE",
desc = "HOUSE_PEACE_DESC",
mission = "UNLOCK_RULE",
img = "15c3261341c.png",
imgDesc = "15c4c11cd14.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
notMess = true,
rulecard = true,
type = "CARD",
},
chess = {
name = "HOUSE_CHESS",
desc = "HOUSE_CHESS_DESC",
mission = "UNLOCK_RULE",
img = "15c50042c2f.png",
imgDesc = "15c4c10580a.png",
conflict = {"noaction","mess"},
card = {color={"black"},name="king"},
public = true,
rulecard = true,
type = "CARD",
},
imitate = {
name = "HOUSE_IMITATE",
desc = "HOUSE_IMITATE_DESC",
mission = "UNLOCK_RULE",
img = "15c32624cf7.png",
imgDesc = "15c4c10ef60.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
limit = {
name = "HOUSE_TIME",
desc = "HOUSE_TIME_DESC",
mission = "UNLOCK_RULE",
img = "161a5c5947a.png",
imgDesc = "1610b6b50ae.png",
conflict = {"limbo"},
public = true,
type = "PASSIVE",
},
nochallenge = {
name = "HOUSE_CHALLENGE",
desc = "HOUSE_CHALLENGE_DESC",
mission = "UNLOCK_RULE",
img = "161a5c61fce.png",
imgDesc = "15c6eb2b741.png",
conflict = {"noaction"},
public = true,
rulecard = true,
type = "PASSIVE",
},
noaction = {
name = "HOUSE_NO_ACTION",
desc = "HOUSE_NO_ACTION_DESC",
mission = "UNLOCK_RULE",
img = "161a5c60865.png",
imgDesc = "15c904433ae.png",
conflict = {"maxi","mess","peace","death","gift","trade","carousel","chair","spy","rain","equality","imitate","meeep","random","bomb","chess","rule","steal","web","thunder","clone","nochallenge","hell","nocombo","supercombo","luck","box","wish","ink","confuse","portal","batata","compass","draw99","curse","magnet","tornado","theft","simon","ban","dice","paradox","half","oddeven","mimic","mix","justice","share","key","nou"},
public = true,
type = "PASSIVE",
},
camouflage = {
name = "HOUSE_CAMOUFLAGE",
desc = "HOUSE_CAMOUFLAGE_DESC",
mission = "UNLOCK_RULE",
img = "161a5c4a7a5.png",
imgDesc = "15c9043ecd9.png",
conflict = {"dos"},
public = true,
rulecard = true,
type = "PASSIVE",
},
rule = {
name = "HOUSE_ADD_RULE",
desc = "HOUSE_ADD_RULE_DESC",
mission = "UNLOCK_RULE",
img = "15c8fc525b7.png",
imgDesc = "15c9044135a.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
type = "CARD",
},
hard = {
name = "HOUSE_HARD",
desc = "HOUSE_HARD_DESC",
mission = "UNLOCK_RULE",
img = "161a5c51f3b.png",
imgDesc = "15e67ba2aed.png",
conflict = {},
public = true,
rulecard = true,
type = "PASSIVE",
},
fastdraw = {
name = "HOUSE_FAST_DRAW",
desc = "HOUSE_FAST_DRAW_DESC",
mission = "UNLOCK_RULE",
img = "161a5c4d794.png",
imgDesc = "15e67b9f422.png",
conflict = {"satisfaction","insatisfaction"},
public = true,
rulecard = true,
type = "PASSIVE",
},
steal = {
name = "HOUSE_STEAL",
desc = "HOUSE_STEAL_DESC",
mission = "UNLOCK_RULE",
img = "15e54b0f5b4.png",
imgDesc = "15e67b9b97b.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
notMess = true,
rulecard = true,
type = "CARD",
},
thunder = {
name = "HOUSE_THUNDER",
desc = "HOUSE_THUNDER_DESC",
mission = "UNLOCK_RULE",
img = "15ebbcc57b0.png",
imgDesc = "15ed536ed22.png",
conflict = {"noaction","mess"},
card = {color={"yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
clone = {
name = "HOUSE_CLONE",
desc = "HOUSE_CLONE_DESC",
mission = "UNLOCK_RULE",
img = "15ec03fec02.png",
imgDesc = "15ed5373b93.png",
conflict = {"noaction","mess"},
card = {color={"black"}},
public = true,
rulecard = true,
type = "CARD",
},
luck = {
name = "HOUSE_LUCK",
desc = "HOUSE_LUCK_DESC",
mission = "UNLOCK_RULE",
img = "15ec0b282ef.png",
imgDesc = "15fb322b1d6.png",
conflict = {"noaction","mess","tracking"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
web = {
name = "HOUSE_WEB",
desc = "HOUSE_WEB_DESC",
mission = "UNLOCK_RULE",
img = "15ec6049e05.png",
imgDesc = "15ed5371210.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
shiny = {
name = "HOUSE_SHINY",
desc = "HOUSE_SHINY_DESC",
mission = "UNLOCK_RULE",
img = "161a5c6c079.png",
imgDesc = "1610b737bb0.png",
public = true,
rulecard = true,
type = "PASSIVE",
},
drekkemaus = {
name = "HOUSE_DREKKEMAUS",
desc = "HOUSE_DREKKEMAUS_DESC",
mission = "UNLOCK_RULE",
img = "161a5c48dcf.png",
imgDesc = "15ed52b7848.png",
notCount = true,
type = "BOSS",
},
jingle = {
name = "HOUSE_JINGLE",
desc = "HOUSE_JINGLE_DESC",
mission = "UNLOCK_RULE",
img = "161a5c48dcf.png",
imgDesc = "16007c17c97.png",
notCount = true,
type = "BOSS",
},
papaille = {
name = "HOUSE_PAPAILLE",
desc = "HOUSE_PAPAILLE_DESC",
mission = "UNLOCK_RULE",
img = "161a5c48dcf.png",
imgDesc = "16007c19ab5.png",
notCount = true,
type = "BOSS",
},
icemice = {
name = "HOUSE_ICEMICE",
desc = "HOUSE_ICEMICE_DESC",
mission = "UNLOCK_RULE",
img = "161a5c48dcf.png",
imgDesc = "167d646330d.png",
notCount = true,
type = "BOSS",
},
snowy = {
name = "HOUSE_SNOWY",
desc = "HOUSE_SNOWY_DESC",
mission = "UNLOCK_RULE",
img = "161a5c48dcf.png",
imgDesc = "167d646118f.png",
notCount = true,
type = "BOSS",
},
ninguem_v2 = {
name = "HOUSE_NINGUEM",
desc = "HOUSE_NINGUEM_DESC",
mission = "UNLOCK_RULE",
img = "161a5c48dcf.png",
imgDesc = "1712da6f330.png",
notCount = true,
lock = "LOCKED",
type = "BOSS",
},
box = {
name = "HOUSE_BOX",
desc = "HOUSE_BOX_DESC",
mission = "UNLOCK_RULE",
img = "178954da279.png",
imgDesc = "1610b6b1641.png",
conflict = {"noaction","mess"},
card = {color={"red","blue"}},
public = true,
rulecard = true,
type = "CARD",
},
wish = {
name = "HOUSE_WISH",
desc = "HOUSE_WISH_DESC",
mission = "UNLOCK_RULE",
img = "15f16742984.png",
imgDesc = "16007c1b88e.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
portal = {
name = "HOUSE_PORTAL",
desc = "HOUSE_PORTAL_DESC",
mission = "UNLOCK_RULE",
img = "15f82ca13ff.png",
imgDesc = "1610b6af6b1.png",
conflict = {"noaction","mess","bluegreen"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
sequence = {
name = "HOUSE_SEQUENCE",
desc = "HOUSE_SEQUENCE_DESC",
mission = "UNLOCK_RULE",
img = "161a5c6a8bd.png",
imgDesc = "15fb32291a9.png",
conflict = {"mess","stack","perfection"},
public = true,
rulecard = true,
type = "PASSIVE",
},
team = {
name = "HOUSE_TEAM",
desc = "HOUSE_TEAM_DESC",
mission = "TEAM_RULE",
img = "161a5d35a72.png",
imgDesc = "160f639df86.png",
public = true,
type = "PASSIVE",
},
custom = {
name = "HOUSE_CUSTOM",
desc = "HOUSE_CUSTOM_DESC",
mission = "BUY_RULE",
img = "15f8cc7e48c.png",
imgDesc = "1610b6ab2b5.png",
conflict = {"noaction"},
lock = "ALL",
notMess = true,
notCount = true,
type = "CARD",
},
ink = {
name = "HOUSE_INK",
desc = "HOUSE_INK_DESC",
mission = "UNLOCK_RULE",
img = "1606599bbf3.png",
imgDesc = "1610b6b6f11.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
confuse = {
name = "HOUSE_CONFUSE",
desc = "HOUSE_CONFUSE_DESC",
mission = "UNLOCK_RULE",
img = "1606c2a1c33.png",
imgDesc = "1610b6a8995.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
compass = {
name = "HOUSE_TREASURE",
desc = "HOUSE_TREASURE_DESC",
mission = "UNLOCK_RULE",
img = "1610641ad80.png",
imgDesc = "1610b6a33a1.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
public = true,
rulecard = true,
type = "CARD",
},
red = {
name = "HOUSE_RED",
desc = "HOUSE_RED_DESC",
mission = "UNLOCK_RULE",
img = "161a5c66678.png",
imgDesc = "1610b6b323e.png",
lock = "LOCKED",
type = "EXTRA",
},
blue = {
name = "HOUSE_BLUE",
desc = "HOUSE_BLUE_DESC",
mission = "UNLOCK_RULE",
img = "161a5c75edc.png",
imgDesc = "1610b695776.png",
lock = "LOCKED",
type = "EXTRA",
},
yellow = {
name = "HOUSE_YELLOW",
desc = "HOUSE_YELLOW_DESC",
mission = "UNLOCK_RULE",
img = "161a5c7471b.png",
imgDesc = "1610b6b9278.png",
lock = "LOCKED",
type = "EXTRA",
},
green = {
name = "HOUSE_GREEN",
desc = "HOUSE_GREEN_DESC",
mission = "UNLOCK_RULE",
img = "161a5c50321.png",
imgDesc = "1610b6ad562.png",
lock = "LOCKED",
type = "EXTRA",
},
charlotte = {
name = "HOUSE_CHARLOTTE",
desc = "HOUSE_CHARLOTTE_DESC",
mission = "UNLOCK_RULE",
img = "161a5c48dcf.png",
imgDesc = "1611561f846.png",
notCount = true,
type = "BOSS",
},
buffy = {
name = "HOUSE_BUFFY",
desc = "HOUSE_BUFFY_DESC",
mission = "UNLOCK_RULE",
img = "161a5c48dcf.png",
imgDesc = "165e99472af.png",
notCount = true,
type = "BOSS",
},
elise = {
name = "HOUSE_ELISE",
desc = "HOUSE_ELISE_DESC",
mission = "UNLOCK_RULE",
img = "161a5c48dcf.png",
imgDesc = "167d75ae1f6.png",
notCount = true,
type = "BOSS",
},
neighbor = {
name = "HOUSE_NEIGHBOR",
desc = "HOUSE_NEIGHBOR_DESC",
mission = "UNLOCK_RULE",
img = "161a5c5f1e4.png",
imgDesc = "161a5f624a7.png",
conflict = {"mess","stack"},
public = true,
rulecard = true,
type = "PASSIVE",
},
mess = {
name = "HOUSE_MESS",
desc = "HOUSE_MESS_DESC",
mission = "UNLOCK_RULE",
img = "161a5d1b7fa.png",
imgDesc = "1627e2bbbf0.png",
-- tracking
conflict = {"noaction","stack","sequence","perfection","neighbor","clean","peace","death","gift","trade","carousel","chair","spy","rain","equality","imitate","meep","random","bomb","chess","rule","steal","web","thunder","clone","luck","box","wish","ink","confuse","portal","compass","batata","draw99","curse","magnet","tornado","theft","simon","ban","dice","paradox","half","oddeven","mimic","mix","justice","share","key","hell","bluegreen"},
type = "PASSIVE",
},
limbo = {
name = "HOUSE_LIMBO",
desc = "HOUSE_LIMBO_DESC",
mission = "UNLOCK_RULE",
img = "161a5c57cab.png",
imgDesc = "1627e2b98f1.png",
conflict = {"overload"},
rulecard = true,
public = true,
type = "PASSIVE",
},
batata = {
name = "HOUSE_BATATA",
desc = "HOUSE_BATATA_DESC",
mission = "UNLOCK_RULE",
img = "16168f66e7b.png",
imgDesc = " 161ed70240c.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
rulecard = true,
public = true,
type = "CARD",
},
draw99 = {
name = "HOUSE_PLUS99",
desc = "HOUSE_PLUS99_DESC",
mission = "BUY_RULE",
img = "1627e34cb06.png",
imgDesc = "1627e2b24a9.png",
conflict = {"noaction","mess"},
card = {color={"black"}},
lock = "SHOP",
notMess = true,
type = "CARD",
},
curse = {
name = "HOUSE_CURSE",
desc = "HOUSE_CURSE_DESC",
mission = "UNLOCK_RULE",
img = "178954d61b7.png",
imgDesc = "1627e2b7736.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
rulecard = true,
public = true,
type = "CARD",
},
elisah = {
name = "HOUSE_ELISAH",
desc = "HOUSE_ELISAH_DESC",
mission = "UNLOCK_RULE",
img = "161a5c48dcf.png",
imgDesc = "16313dbd30d.png",
notCount = true,
type = "BOSS",
},
magnet = {
name = "HOUSE_MAGNET",
desc = "HOUSE_MAGNET_DESC",
mission = "UNLOCK_RULE",
img = "1637fb76f93.png",
imgDesc = "1637fc1e79e.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
rulecard = true,
public = true,
type = "CARD",
},
tornado = {
name = "HOUSE_TORNADO",
desc = "HOUSE_TORNADO_DESC",
mission = "UNLOCK_RULE",
img = "165c6a5676b.png",
imgDesc = "165e994a99f.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
rulecard = true,
public = true,
type = "CARD",
},
theft = {
name = "HOUSE_THEFT",
desc = "HOUSE_THEFT_DESC",
mission = "UNLOCK_RULE",
img = "165ce55301e.png",
imgDesc = "165e9948cc0.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
rulecard = true,
public = true,
type = "CARD",
},
simon = {
name = "HOUSE_SIMON",
desc = "HOUSE_SIMON_DESC",
mission = "UNLOCK_RULE",
img = "16627b2d4cf.png",
imgDesc = "1662b8e5605.png",
conflict = {"noaction","mess"},
card = {color={"black"}},
rulecard = true,
public = true,
type = "CARD",
},
ban = {
name = "HOUSE_BAN",
desc = "HOUSE_BAN_DESC",
mission = "UNLOCK_RULE",
img = "166657eae03.png",
imgDesc = "166d0212faa.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
rulecard = true,
public = true,
type = "CARD",
},
dice = {
name = "HOUSE_DICE",
desc = "HOUSE_DICE_DESC",
mission = "UNLOCK_RULE",
img = "1678b6894e3.png",
imgDesc = "1678b78e8cd.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
--rulecard = true,
--public = true,
lock = true,
notMess = true,
type = "CARD",
},
paradox = {
name = "HOUSE_PARADOX",
desc = "HOUSE_PARADOX_DESC",
mission = "UNLOCK_RULE",
img = "1678b683a06.png",
imgDesc = "1678b790783.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
rulecard = true,
public = true,
type = "CARD",
},
half = {
name = "HOUSE_HALF",
desc = "HOUSE_HALF_DESC",
mission = "UNLOCK_RULE",
img = "1678b685756.png",
imgDesc = "1678b7925a3.png",
conflict = {"noaction","mess"},
card = {color={"black"}},
rulecard = true,
public = true,
type = "CARD",
},
oddeven = {
name = "HOUSE_ODD_EVEN",
desc = "HOUSE_ODD_EVEN_DESC",
mission = "UNLOCK_RULE",
img = "1678b68cd54.png",
imgDesc = "1678b79416e.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
rulecard = true,
public = true,
notMess = true,
type = "CARD",
},
mimic = {
name = "HOUSE_MIMIC",
desc = "HOUSE_MIMIC_DESC",
mission = "UNLOCK_RULE",
img = "1678b690414.png",
imgDesc = "1678b795c3a.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
rulecard = true,
public = true,
type = "CARD",
},
justice = {
name = "HOUSE_JUSTICE",
desc = "HOUSE_JUSTICE_DESC",
mission = "UNLOCK_RULE",
img = "16793a1d160.png",
imgDesc = "16793a1f409.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
rulecard = true,
public = true,
type = "CARD",
},
mix = {
name = "HOUSE_MIX",
desc = "HOUSE_MIX_DESC",
mission = "UNLOCK_RULE",
img = "1678b68e953.png",
imgDesc = "1678b797f89.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"},name="mix1"},
rulecard = true,
public = true,
type = "CARD",
},
bluegreen = {
name = "HOUSE_BG",
desc = "HOUSE_BG_DESC",
mission = "UNLOCK_RULE",
img = "1678b68b115.png",
imgDesc = "1678b7df6d3.png",
conflict = {"portal","mess"},
rulecard = true,
public = true,
type = "PASSIVE",
},
dos = {
name = "HOUSE_DOS",
desc = "HOUSE_DOS_DESC",
mission = "UNLOCK_RULE",
img = "1678b6872bd.png",
imgDesc = "1678b7e15be.png",
conflict = {"camouflage"},
--rulecard = true,
--public = true,
lock = true,
type = "PASSIVE",
},
share = {
name = "HOUSE_SHARE",
desc = "HOUSE_SHARE_DESC",
mission = "UNLOCK_RULE",
img = "171653c5945.png",
imgDesc = "171653cb1cc.png",
conflict = {"noaction","mess"},
card = {color={"yellow","green"}},
rulecard = true,
public = true,
type = "CARD",
},
key = {
name = "HOUSE_LOCK",
desc = "HOUSE_LOCK_DESC",
mission = "UNLOCK_RULE",
img = "171653c35c5.png",
imgDesc = "171653c7e04.png",
conflict = {"noaction","mess"},
card = {color={"red","blue","yellow","green"}},
rulecard = true,
public = true,
type = "CARD",
},
nou = {
name = "HOUSE_NO_U",
desc = "HOUSE_NO_U_DESC",
mission = "UNLOCK_RULE",
img = "178952d00cb.png",
imgDesc = "178952da56c.png",
conflict = {"noaction","nocombo"},
rulecard = true,
public = true,
type = "PASSIVE",
},
}
|
-- Created By Bapes#1111 --
-- Please do not distrubute without consent --
---@diagnostic disable: undefined-global, lowercase-global
local Tinkr, UI = ...
local name = "Bapes Bear Rotation"
local version = "v1.0-beta"
local Routine = Tinkr.Routine
local player = "player"
local target = "target"
-- Print name and version
print("|cFFFFD700[Bapes Scripts]|cFF8A2BE2 " .. name .. " " .. version)
Routine:RegisterRoutine(function()
if gcd() > latency() then
return
end
if not latencyCheck() then
return
end
if mounted() then
return
end
-- COMBAT --
local function do_combat()
local rage = power(PowerType.Rage)
-- SPELLS --
local bearForm = highestrank(5487)
-- Dire Bear
if not bearForm then
bearForm = highestrank(9634)
end
local frenziedRegeneration = highestrank(22842)
local faerieFire = highestrank(16857)
local feralCharge = highestrank(16979)
local lacerate = highestrank(33745)
local maul = highestrank(6807)
local mangle = highestrank(33878)
-- END SPELLS --
-- Auto Attack
if UnitExists(target) and not UnitIsDeadOrGhost(target) and enemy(target) then
Eval("StartAttack()", "t")
end
-- BUFFS --
-- Bear Form
if not buff(bearForm, player) and castable(bearForm, player) then
return cast(bearForm, player)
end
-- END BUFFS --
-- HEALING --
-- Frenzied Regeneration
if health() <= 35 and castable(frenziedRegeneration, player) then
return cast(frenziedRegeneration, player)
end
-- Frenzied Regeneration is still going so don't use abilities
if buff(frenziedRegeneration, player) then
return
end
-- END HEALING --
-- DEBUFFS --
if not debuff(faerieFire, target) then
return cast(faerieFire, target)
end
-- END DEBUFFS --
-- ROTATION --
-- Feral Charge
if UnitExists(target) and spellInRange(feralCharge) and castable(feralCharge, target) then
return cast(feralCharge, target)
end
if rage < 75 then
-- Lacerate
if castable(lacerate, target) then
return cast(lacerate, target)
end
else
-- Maul
if castable(maul, target) then
return cast(maul, target)
end
end
-- Mangle Spam
if castable(mangle, target) then
return cast(mangle, target)
end
-- END ROTATION --
end
-- RESTING --
local function do_resting()
if UnitIsDeadOrGhost(player) or UnitIsDeadOrGhost(target) or IsEatingOrDrinking() then
return
end
-- SPELLS --
local bearForm = highestrank(5487)
-- Dire Bear
if not bearForm then
bearForm = highestrank(9634)
end
local omenOfClarity = highestrank(16864)
local feralCharge = highestrank(16979)
-- MOTW Ranks
local motwRanks = {
21849,
21850,
26991,
1126,
5232,
8907,
9884,
9885,
26990
}
-- Thorns Ranks
local thornsRanks = {
467,
782,
1075,
8914,
9756,
9910,
26992
}
-- END SPELLS --
-- BUFFS --
-- MOTW (Check for GOTW & all ranks)
if castable(MarkOfTheWild, player) and not buff(MarkOfTheWild, player) and not buff(GiftOfTheWild, player) then
for _, motwRank in pairs(motwRanks) do
if buff(motwRank, player) then
break
end
end
return cast(MarkOfTheWild, player)
end
-- Thorns (Check for all ranks)
if castable(Thorns, player) and not buff(Thorns, player) then
for _, thornRank in pairs(thornsRanks) do
if buff(thornRank, player) then
break
end
end
return cast(Thorns, player)
end
-- Omen of Clarity
if castable(omenOfClarity, player) and not buff(omenOfClarity, player) then
return cast(omenOfClarity, player)
end
-- END BUFFS --
-- Bear Form
if UnitExists(target) and alive(target) and not buff(bearForm, player) and castable(bearForm, player) and distance(player, target) <= math.random(25, 40) then
return cast(bearForm, player)
end
-- Feral Charge
if UnitExists(target) and spellInRange(feralCharge) and castable(feralCharge, target) then
return cast(feralCharge, target)
end
end
if combat(player) then
do_combat()
return
else
do_resting()
return
end
end, Routine.Classes.Druid, "bapes-bear")
|
local cfg = {}
-- define static item transformers
-- see https://github.com/ImagicTheCat/vRP to understand the item transformer concept/definition
cfg.item_transformers = {
-- example of harvest item transformer
{
name="Fishing", -- menu name
permissions = {"mission.delivery.fish"}, -- you can add permissions
r=0,g=125,b=255, -- color
max_units=100000,
units_per_minute=100000,
x=743.19586181641,y=3895.3967285156,z=30.5,
radius=3, height=1.5, -- area
recipes = {
["Catch some Catfish"] = { -- action name
description="Trying to catch some Catfish", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["catfish"] = 1
}
},
["Catch some Bass"] = { -- action name
description="Trying to catch some Bass", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["bass"] = 1
}
}
}
},
{
name="Trash Collector", -- menu name
permissions = {"mission.collect.trash"}, -- you can add permissions
r=0,g=125,b=255, -- color
max_units=100000,
units_per_minute=100000,
x=805.77130126953,y=-1078.0639648438,z=28.55744934082,
radius=3, height=1.5, -- area
recipes = {
["Gather Trash"] = { -- action name
description="Gathering Trash...", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["trash"] = 1
}
}
}
},
{
name="Weapons Smuggler", -- menu name
permissions = {"mission.weapons.smuggler"}, -- you can add permissions
r=0,g=125,b=255, -- color
max_units=100000,
units_per_minute=100000,
x=-343.28500366211,y=6098.6586914063,z=31.327739715576,
radius=3, height=1.5, -- area
recipes = {
["Gather AK's"] = { -- action name
description="Grabbing AK's", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["AK47"] = 1
}
},
["Gather M4A1"] = { -- action name
description="Grabbing M4's", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["M4A1"] = 1
}
}
}
},
{
name="Medical Transport", -- menu name
permissions = {"mission.delivery.medical"}, -- you can add permissions
r=0,g=125,b=255, -- color
max_units=100000,
units_per_minute=100000,
x=2213.0520019531,y=5577.5981445313,z=53.795757293701,
radius=3, height=1.5, -- area
recipes = {
["Gather Medical Weed"] = { -- action name
description="Gathering Medical Weed", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["Medical Weed"] = 1
}
}
}
},
{
name="UPS", -- menu name
permissions = {"harvest.parcels"}, -- you can add permissions
r=0,g=125,b=255, -- color
max_units=100000,
units_per_minute=100000,
x=76.495727539063,y=-27.030916213989,z=68.562599182129,
radius=3, height=1.5, -- area
recipes = {
["Gather Parcels"] = { -- action name
description="Gathering Parcels", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["parcels"] = 1
}
}
}
},
{
name="Coca Leaves Farm", -- menu name
permissions = {"harvest.cocaleaves"}, -- you can add permissions
r=0,g=125,b=255, -- color
max_units=1000,
units_per_minute=1000,
x=2408.5302734375,y=3031.4604492188,z=48.152572631836, -- UPDATE THIS 2408.5302734375,3031.4604492188,48.152572631836
radius=2, height=1.5, -- area
recipes = {
["Gather Coca Leaves"] = { -- action name
description="Gathering Coca Leaves", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["cocaleaves"] = 1
}
}
}
},
{
name="Benzoil Farm", -- menu name
permissions = {"harvest.benzoilmetilecgonina"}, -- you can add permissions
r=0,g=125,b=255, -- color
max_units=1000,
units_per_minute=1000,
x=1668.8928222656,y=4969.03125,z=42.262279510498, -- UPDATE THIS -- 1668.8928222656,4969.03125,42.262279510498
radius=2, height=1.5, -- area
recipes = {
["Gather Benzo"] = { -- action name
description="Gathering Benzo", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["benzoilmetilecgonina"] = 1
}
}
}
},
--{
--name="Water bottles/tacos tree", -- menu name
-- permissions = {"harvest.water_bottle_tacos"}, -- you can add permissions
--r=0,g=125,b=255, -- color
--max_units=100000,
--units_per_minute=100000,
--x=-1692.6646728516,y=-1086.3079833984,z=13.152559280396, -- pos
--radius=5, height=1.5, -- area
--recipes = {
--["Harvest water"] = { -- action name
--description="Harvest some water bottles.", -- action description
--in_money=0, -- money taken per unit
--out_money=0, -- money earned per unit
--reagents={}, -- items taken per unit
--products={ -- items given per unit
--["water"] = 1
--}
--},
--["Harvest tacos"] = { -- action name
--description="Harvest some tacos.", -- action description
--in_money=0, -- money taken per unit
--out_money=0, -- money earned per unit
--reagents={}, -- items taken per unit
--products={ -- items given per unit
--["tacos"] = 1
--}
--}
--}
--, onstart = function(player,recipe) end, -- optional start callback
-- onstep = function(player,recipe) end, -- optional step callback
-- onstop = function(player,recipe) end -- optional stop callback
--},
{
name="Body training", -- menu name
r=255,g=125,b=0, -- color
max_units=35,
units_per_minute=35,
x=-1202.96252441406,y=-1566.14086914063,z=4.61040639877319,
radius=7.5, height=1.5, -- area
recipes = {
["Тренираш"] = { -- action name
description="Increase your strength.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={}, -- items given per unit
aptitudes={ -- optional
["physical.strength"] = 0.1 -- "group.aptitude", give 1 exp per unit
}
}
}
},
{
name="Hacker", -- menu name
permissions = {"hacker.credit_cards"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=800,
units_per_minute=800,
x=707.357238769531,y=-966.98876953125,z=30.4128551483154,
radius=2, height=1.0, -- area
recipes = {
["Хакваш внимавай"] = { -- action name
description="Hacking credit cards.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["credit"] = 1,
["dirty_money"] = 2
}, -- items given per unit
aptitudes={ -- optional
["hacker.hacking"] = 0.1 -- "group.aptitude", give 1 exp per unit
}
}
}
},
{
name="Forger", -- menu name
permissions = {"fraud.credit_cards"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=800,
units_per_minute=800,
x=1272.7305908203,y=-1711.9899902344,z=54.771453857422,
radius=2, height=1.0, -- area
recipes = {
["Правиш фалшиви карти"] = { -- action name
description="Forging fake ID's", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={
["credit"] = 1
}, -- items taken per unit
products={
["fake_id"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
{
name="Driver License", -- menu name
r=255,g=125,b=0, -- color
max_units=10,
units_per_minute=1,
x=437.0460510254,y=-979.29113769532,z=30.68967628479, -- 437.0460510254,-979.29113769532,30.68967628479
radius=2, height=1.0, -- area
recipes = {
["Driver"] = { -- action name
description="Buy a Driver License.", -- action description`
in_money=150, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["driver"] = 1
}, -- items given per unit
aptitudes={} -- optional
}
}
},
{
name="Bank Driver Mission", -- menu name
permissions = {"bankdriver.money"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=1,
units_per_minute=1,
x=236.87298583984,y=217.09535217285,z=106.28678894043,
radius=2, height=1.0, -- area
recipes = {
["Bank Money"] = { -- action name
description="Get a money bank for mission.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["bank_money"] = 500000
}, -- items given per unit
aptitudes={} -- optional
}
}
},
{
name="Collect Cargo", -- menu name
permissions = {"mission.pilot.cargo"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=100000,
units_per_minute=100000,
x=1618.9204101563,y=3227.7058105469,z=40.411529541016,
radius=2, height=1.0, -- area
recipes = {
["Cargo"] = { -- action name
description="Collecting Cargo...", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["cargo"] = 1
}, -- items given per unit
aptitudes={} -- optional
}
}
},
{
name="Coca Mixer", -- menu name
permissions = {"harvest.cleancoca"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=100000,
units_per_minute=100000,
x=171.97718811036,y=-2220.6970214844,z=90.789329528808, -- 171.97718811036,2220.6970214844,90.789329528808
radius=2, height=1.0, -- area
recipes = {
["Clean Coca"] = { -- action name
description="Mixing coca", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={
["cocaleaves"] = 1,
["benzoilmetilecgonina"] = 1
}, -- items taken per unit
products={
["cleancoca"] = 1
}, -- items given per unit
aptitudes={} -- optional
}
}
},
{
name="Black Cocaine", -- menu name
permissions = {"black.cocaine"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=1000,
units_per_minute=1000,
x=2433.2937011718,y=4968.6201171875,z=42.347602844238,
radius=2, height=1.0, -- area
recipes = {
["Правиш черна кока"] = { -- action name
description="Смесване на съставките", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={
["cleancocaine"] = 1,
["blackleaves"] = 1
}, -- items taken per unit
products={
["blackcocaine"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
{
name="ASMG Незаконно", -- menu name
permissions = {"black.asmg"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=15,
units_per_minute=15,
x=57.573810577392,y=3689.7468261718,z=39.902755737304,
radius=2, height=1.0, -- area
recipes = {
["Правиш Оръжие"] = { -- action name
description="Сглобяване на частите", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={
["bodyasmg"] = 50,
["spusukasmg"] = 50,
["duloasmg"] = 50
}, -- items taken per unit
products={
["wbody|WEAPON_ASSAULTSMG"] = 1,
["wammo|WEAPON_ASSAULTSMG"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
{
name="АК47 Незаконно", -- menu name
permissions = {"black.ak47"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=15,
units_per_minute=15,
x=3236.849609375,y=-172.72645568848,z=16.927841186524,
radius=2, height=1.0, -- area
recipes = {
["Правиш Оръжие"] = { -- action name
description="Сглобяване на частите", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={
["bodyak47"] = 85,
["duloak47"] = 85,
["spusukak47"] = 85,
["projinaak47"] = 85
}, -- items taken per unit
products={
["wbody|WEAPON_ASSAULTRIFLE"] = 1,
["wammo|WEAPON_ASSAULTRIFLE"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
{
name="Special Paper", -- menu name
permissions = {"carpenter.job"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=55,
units_per_minute=30,
x=-582.984375,y=5359.9150390625,z=70.242919921875,
radius=2, height=1.0, -- area
recipes = {
["Правиш специялна хартия"] = { -- action name
description="Правиш хартията", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={
["wsawdust"] = 1
}, -- items taken per unit
products={
["spaper"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
{
name="Нарязване на дъски", -- menu name
permissions = {"carpenter.job"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=640,
units_per_minute=640,
x=-580.0170288086,y=5276.4233398438,z=70.264877319336,
radius=2, height=1.0, -- area
recipes = {
["Правиш ги на стърготини"] = { -- action name
description="Правене на стърготини", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={
["cboards"] = 1
}, -- items taken per unit
products={
["wsawdust"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
{
name="Make Documents for Gun", -- menu name
permissions = {"documents.job"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=35,
units_per_minute=20,
x=459.74005126954,y=-989.19348144532,z=24.914869308472,
radius=2, height=1.0, -- area
recipes = {
["Правиш документи за оръжие"] = { -- action name
description="Пишеш документ", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={
["spaper"] = 2
}, -- items taken per unit
products={
["razreshitelno1"] = 1,
["razreshitelno2"] = 1,
}, -- items given per unit
aptitudes={}
}
}
},
{
name="Правиш патрон", -- menu name
permissions = {"ammo.ak47"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=20,
units_per_minute=20,
x=3233.1506347656,y=-173.42526245118,z=16.478744506836,
radius=2, height=1.0, -- area
recipes = {
["Правиш патрон за AK"] = { -- action name
description="Патрон за АК47", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={
["gunpowder"] = 1,
["ecartridge"] = 1
}, -- items taken per unit
products={
["wammo|WEAPON_ASSAULTRIFLE"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
{
name="Правиш патрон", -- menu name
permissions = {"ammo.asmg"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=20,
units_per_minute=20,
x=57.407848358154,y=3693.1459960938,z=39.921314239502,
radius=2, height=1.0, -- area
recipes = {
["Правиш патрон за ASMG"] = { -- action name
description="Патрон за ASMG", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={
["gunpowder"] = 1,
["ecartridge"] = 1
}, -- items taken per unit
products={
["wammo|WEAPON_ASSAULTSMG"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
{
name="Винетка за Автомобил", -- menu name
r=255,g=125,b=0, -- color
max_units=1,
units_per_minute=1,
x=-537.97863769532,y=-208.98712158204,z=37.649837493896,
radius=2, height=1.0, -- area
recipes = {
["Винетка"] = { -- action name
description="Купи Винетка.", -- action description`
in_money=1000, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["vignette"] = 2
}, -- items given per unit
aptitudes={} -- optional
}
}
},
-- {
-- name="Robbery Bank", -- menu name
-- r=255,g=125,b=0, -- color
-- max_units=600,
-- units_per_minute=1,
-- x=265.94982910156,y=213.54983520508,z=101.68338775635,
-- radius=2, height=1.0, -- area
-- recipes = {
-- ["Bank Money"] = { -- action name
-- description="get the money.", -- action description
-- in_money=0, -- money taken per unit
-- out_money=0, -- money earned per unit
-- reagents={}, -- items taken per unit
-- products={
-- ["dirty_money"] = 0
-- }, -- items given per unit
-- aptitudes={} -- optional
-- }
-- }
-- },
{
name="Drug Lab", -- menu name
permissions = {"harvest.weed"}, -- job drug dealer required to use
r=0,g=255,b=0, -- color
max_units=100000,
units_per_minute=100000,
x=-77.722381591797,y=6223.626953125,z=31.089864730835, -- pos (needed for public use lab tools)
radius=1.1, height=1.5, -- area
recipes = {
["cocaine"] = { -- action name
description="make cocaine", -- action description
in_money=500, -- money taken per unit
out_money=0, -- money earned per unit
reagents={ -- items taken per unit
["benzoilmetilecgonina"] = 1
},
products={ -- items given per unit
["cocaine"] = 3
},
aptitudes={ -- optional
["laboratory.cocaine"] = 3, -- "group.aptitude", give 1 exp per unit
["science.chemicals"] = 6
}
},
["weed"] = { -- action name
description="make weed", -- action description
in_money=500, -- money taken per unit
out_money=0, -- money earned per unit
reagents={ -- items taken per unit
["seeds"] = 1
},
products={ -- items given per unit
["weed"] = 3
},
aptitudes={ -- optional
["laboratory.weed"] = 3, -- "group.aptitude", give 1 exp per unit
["science.chemicals"] = 6
}
},
["lsd"] = { -- action name
description="make lsd", -- action description
in_money=500, -- money taken per unit
out_money=0, -- money earned per unit
reagents={ -- items taken per unit
["harness"] = 1
},
products={ -- items given per unit
["lsd"] = 3
},
aptitudes={ -- optional
["laboratory.lsd"] = 3, -- "group.aptitude", give 1 exp per unit
["science.chemicals"] = 6
}
}
}
}
}
-- define transformers randomly placed on the map
cfg.hidden_transformers = {
["weed field"] = {
def = {
name="Weed field", -- menu name
permissions = {"harvest.weed"}, -- you can add permissions
r=0,g=200,b=0, -- color
max_units=100000,
units_per_minute=100000,
x=0,y=0,z=0, -- pos
radius=5, height=1.5, -- area
recipes = {
["Harvest"] = { -- action name
description="Harvest some drugs.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["seeds"] = 1
}
}
}
},
positions = {
{2208.0104980469,5577.6987304688,53.739212036133}
}
},
["cocaine dealer"] = {
def = {
name="Cocaine Dealer", -- menu name
permissions = {"harvest.weed"}, -- you can add permissions
r=0,g=200,b=0, -- color
max_units=100000,
units_per_minute=100000,
x=0,y=0,z=0, -- pos
radius=5, height=1.5, -- area
recipes = {
["Harvest"] = { -- action name
description="Harvest some drugs.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["benzoilmetilecgonina"] = 1
}
}
}
},
positions = {
{-631.00543212891,-229.42568969727,38.057052612305}
}
},
["lsd bar"] = {
def = {
name="LSD Bar", -- menu name
permissions = {"harvest.weed"}, -- you can add permissions
r=0,g=200,b=0, -- color
max_units=100000,
units_per_minute=100000,
x=0,y=0,z=0, -- pos
radius=5, height=1.5, -- area
recipes = {
["Harvest"] = { -- action name
description="Harvest some drugs.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["harness"] = 1
}
}
}
},
positions = {
{1992.5993652344,3044.1806640625,47.215068817139}
}
},
["blackleaves"] = {
def = {
name="Black leaves", -- menu name
permissions = {"black.cocaine"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=650,
units_per_minute=650,
x=-1644.985961914,y=4531.0395507812,z=39.85499572754,
radius=2, height=1.0, -- area
recipes = {
["Береш"] = { -- action name
description="Набавяне на съставки.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["blackleaves"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
positions = {
{-1644.985961914,4531.0395507812,39.85499572754}
}
},
["bodyasmg"] = {
def = {
name="Тяло на АСМГ", -- menu name
permissions = {"black.asmg"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=25,
units_per_minute=25,
x=318.2846069336,y=2885.8955078125,z=46.382835388184,
radius=2, height=1.0, -- area
recipes = {
["Набавяш части"] = { -- action name
description="Набавяне на част.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["bodyasmg"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
positions = {
{318.2846069336,2885.8955078125,46.382835388184}
}
},
["duloasmg"] = {
def = {
name="Дуло на АСМГ", -- menu name
permissions = {"black.asmg"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=25,
units_per_minute=25,
x=-301.16748046875,y=2539.5434570312,z=74.577697753906,
radius=2, height=1.0, -- area
recipes = {
["Набавяш части"] = { -- action name
description="Набавяне на част.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["duloasmg"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
positions = {
{-301.16748046875,2539.5434570312,74.577697753906}
}
},
["spusukasmg"] = {
def = {
name="Скусък на АСМГ", -- menu name
permissions = {"black.asmg"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=25,
units_per_minute=25,
x=-262.90914916992,y=2233.4643554688,z=117.9080657959,
radius=2, height=1.0, -- area
recipes = {
["Набавяш части"] = { -- action name
description="Набавяне на част.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["spusukasmg"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
positions = {
{-262.90914916992,2233.4643554688,117.9080657959}
}
},
["bodyak47"] = {
def = {
name="Тяло на калашника", -- menu name
permissions = {"black.ak47"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=25,
units_per_minute=25,
x=-1603.4786376954,y=4592.5625,z=41.072982788086,
radius=2, height=1.0, -- area
recipes = {
["Набавяш части"] = { -- action name
description="Набавяне на част.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["bodyak47"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
positions = {
{-1603.4786376954,4592.5625,41.072982788086}
}
},
["duloak47"] = {
def = {
name="Дуло на калашника", -- menu name
permissions = {"black.ak47"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=25,
units_per_minute=25,
x=1346.3233642578,y=4389.6611328125,z=44.34375,
radius=2, height=1.0, -- area
recipes = {
["Набавяш части"] = { -- action name
description="Набавяне на част.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["duloak47"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
positions = {
{1346.3233642578,4389.6611328125,44.34375}
}
},
["spusukak47"] = {
def = {
name="Спусък на калашника", -- menu name
permissions = {"black.ak47"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=25,
units_per_minute=25,
x=57.189086914062,y=3690.3840332032,z=39.921287536622,
radius=2, height=1.0, -- area
recipes = {
["Набавяш части"] = { -- action name
description="Набавяне на част.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["spusukak47"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
positions = {
{57.189086914062,3690.3840332032,39.921287536622}
}
},
["projinaak47"] = {
def = {
name="Прожина за калашника", -- menu name
permissions = {"black.ak47"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=25,
units_per_minute=25,
x=135.6383972168,y=-1183.6245117188,z=29.501337051392,
radius=2, height=1.0, -- area
recipes = {
["Набавяш части"] = { -- action name
description="Набавяне на част.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["projinaak47"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
positions = {
{135.6383972168,-1183.6245117188,29.501337051392}
}
},
["cboards"] = {
def = {
name="Цепене на дъски", -- menu name
permissions = {"carpenter.job"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=250,
units_per_minute=250,
x=-497.21310424804,y=5299.390625,z=80.610038757324,
radius=2, height=1.0, -- area
recipes = {
["Цепене на дъски"] = { -- action name
description="Цепиш дъски.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["cboards"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
positions = {
{-497.21310424804,5299.390625,80.610038757324}
}
},
["gunpowder"] = {
def = {
name="Набавяне на барут", -- menu name
permissions = {"ammo.tank"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=25,
units_per_minute=25,
x=93.02727508545,y=3755.2888183594,z=40.773155212402,
radius=2, height=1.0, -- area
recipes = {
["Набавяш барут"] = { -- action name
description="Набавяш барут.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["gunpowder"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
positions = {
{93.02727508545,3755.2888183594,40.773155212402}
}
},
["ecartridge"] = {
def = {
name="Набавяш гилзи", -- menu name
permissions = {"ammo.tank"}, -- you can add permissions
r=255,g=125,b=0, -- color
max_units=25,
units_per_minute=25,
x=2428.3776855468,y=3083.2534179688,z=48.709663391114,
radius=2, height=1.0, -- area
recipes = {
["Набавяш празни гилзи"] = { -- action name
description="Набавяш барут.", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={
["ecartridge"] = 1
}, -- items given per unit
aptitudes={}
}
}
},
positions = {
{2428.3776855468,3083.2534179688,48.709663391114}
}
},
["police1"] = {
def = {
name="Police Report", -- menu name
permissions = {"police.mission"}, -- you can add permissions
r=0,g=200,b=0, -- color
max_units=100000,
units_per_minute=100000,
x=0,y=0,z=0, -- pos
radius=5, height=1.5, -- area
recipes = {
["Write Report"] = { -- action name
description="Writing Report...", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["police_report"] = 1
}
}
}
},
positions = {
{439.57083129883,-995.072265625,30.689596176147} -- Mission Row
}
},
["police2"] = {
def = {
name="Police Report", -- menu name
permissions = {"police.mission"}, -- you can add permissions
r=0,g=200,b=0, -- color
max_units=100000,
units_per_minute=100000,
x=0,y=0,z=0, -- pos
radius=5, height=1.5, -- area
recipes = {
["Write Report"] = { -- action name
description="Writing Report...", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["police_report"] = 1
}
}
}
},
positions = {
{1851.6605224609,3690.6713867188,34.267044067383} -- Sandy Shores
}
},
["police3"] = {
def = {
name="Police Report", -- menu name
permissions = {"police.mission"}, -- you can add permissions
r=0,g=200,b=0, -- color
max_units=100000,
units_per_minute=100000,
x=0,y=0,z=0, -- pos
radius=5, height=1.5, -- area
recipes = {
["Write Report"] = { -- action name
description="Writing Report...", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["police_report"] = 1
}
}
}
},
positions = {
{-449.43395996094,6010.796875,31.716377258301} -- Paleto
}
},
["ems"] = {
def = {
name="Medical Report", -- menu name
permissions = {"ems.mission"}, -- you can add permissions
r=0,g=200,b=0, -- color
max_units=100000,
units_per_minute=100000,
x=0,y=0,z=0, -- pos
radius=5, height=1.5, -- area
recipes = {
["Write Report"] = { -- action name
description="Writing Report...", -- action description
in_money=0, -- money taken per unit
out_money=0, -- money earned per unit
reagents={}, -- items taken per unit
products={ -- items given per unit
["ems_report"] = 1
}
}
}
},
positions = {
{-272.08700561523,27.639623641968,54.752536773682},
{465.04064941406,3569.1174316406,33.238555908203},
{-1145.8566894531,4939.5083007813,222.2686920166}
}
}
}
-- time in minutes before hidden transformers are relocated (min is 5 minutes)
cfg.hidden_transformer_duration = 5*24*60 -- 5 days
-- configure the information reseller (can sell hidden transformers positions)
cfg.informer = {
infos = {
["weed field"] = 18000,
["lsd bar"] = 35000
},
positions = {
{2208.0104980469,5577.6987304688,53.739212036133},
{-631.00543212891,-229.42568969727,38.057052612305},
{1992.5993652344,3044.1806640625,47.215068817139}
},
interval = 60, -- interval in minutes for the reseller respawn
duration = 10, -- duration in minutes of the spawned reseller
blipid = 133,
blipcolor = 2
}
return cfg
|
class "shCash"
function shCash:__init()
Events:Subscribe( "EntitySpawn", self, self.EntitySpawn )
end
function shCash:EntitySpawn( args )
if args.entity:GetValue( "Cash" ) then
print("spawn")
end
end
|
---@type string
local Name = ...
---@type Addon
local Addon = select(2, ...)
---@type L
local L = LibStub("AceLocale-3.0"):GetLocale(Name)
local EPGP = LibStub("AceAddon-3.0"):GetAddon("EPGP", true)
local LGP = LibStub("LibGearPoints-1.2", true)
local GS = LibStub("LibGuildStorage-1.2", true)
local GUI, Options, Roll, Session, Unit, Util = Addon.GUI, Addon.Options, Addon.Roll, Addon.Session, Addon.Unit, Addon.Util
---@class EPGP : Module
local Self = Addon.EPGP
Self.NAME = "EPGP"
-- How often GP credit operations should be retried by default
Self.CREDIT_MAX_TRYS = 5
-- Config
Options.DEFAULTS.profile.plugins.EPGP = {
enabled = false,
onlyGuildRaid = true,
awardBefore = Roll.AWARD_BIDS,
bidWeights = {
[Roll.BID_NEED] = 1,
[Roll.BID_GREED] = 1,
[Roll.BID_DISENCHANT] = 0
}
}
-- Remember GPs we credited, so we can undo them if necessary
Self.credited = {}
-------------------------------------------------------
-- Get info --
-------------------------------------------------------
-- Get a unit's EP
---@param unit string
---@return number
function Self.UnitEP(unit)
return (EPGP:GetEPGP(Unit.FullName(unit)))
end
-- Get a unit's GP
---@param unit string
---@return number
function Self.UnitGP(unit)
return (select(2, EPGP:GetEPGP(Unit.FullName(unit))))
end
-- Get a unit's PR
---@param unit string
---@return number
function Self.UnitPR(unit)
local ep, gp = EPGP:GetEPGP(Unit.FullName(unit))
return ep and gp and gp ~= 0 and Util.Num.Round(ep/gp, 2) or nil
end
-- Check if a unit has enough EP
function Self.UnitHasMinEP(unit)
local ep, minEp = Self.UnitEP(unit), EPGP.db.profile.min_ep
return not minEp or ep and ep >= minEp or false
end
-- Get the GP value for a roll
---@param roll Roll
---@return number
function Self.RollGP(roll)
if not roll.winner or not roll.bids[roll.winner] then
return 0
else
local bid, weights = roll.bids[roll.winner], Self.db.profile.bidWeights
return Util.Num.Round((LGP:GetValue(roll.item.link) or 0) * (weights[bid] or weights[floor(bid)] or 0))
end
end
-------------------------------------------------------
-- Award --
-------------------------------------------------------
-- Pick the player with the highest PR value
---@param candidates table
function Self.DetermineWinner(_, candidates)
Util(candidates)
:Map(function (unit) return Self.UnitHasMinEP(unit) and 1 or 0 end, true, true)
:Only(Util.Tbl.Max(candidates))
:Map(function (unit) return Self.UnitPR(unit) or 0 end, true, true)
:Only(Util.Tbl.Max(candidates))
end
-- Add EP to the unit's account
---@param undo boolean
---@param trys integer
function Self.CreditGP(roll, unit, amount, undo, trys)
local link, gp = roll.item.link, undo and -amount or amount
if trys == 0 then
Addon:Error(L["EPGP_ERROR_CREDIT_GP_FAILED"], gp, unit, link)
elseif not GS:IsCurrentState() then
Self:ScheduleTimer(Self.UnitCreditEP, 0.5, roll, unit, amount, undo, (trys or Self.CREDIT_MAX_TRYS) - 1)
elseif not EPGP:CanIncGPBy(link, gp) then
Addon:Error(L["EPGP_ERROR_CREDIT_GP_FAILED"], gp, unit, link)
else
Addon:Verbose(L["EPGP_CREDIT_GP"], gp, unit, link)
EPGP:IncGPBy(Unit.FullName(unit), link, gp, false, undo)
Self.credited[roll.id] = not undo and unit .. ":" .. amount or nil
end
end
-- Try undoing a previous GP credit for the given roll
function Self.UndoGPCredit(roll)
if Self.credited[roll.id] then
local prevWinner, gp = (":"):split(Self.credited[roll.id])
Self.CreditGP(roll, prevWinner, gp, true)
end
end
-------------------------------------------------------
-- Options --
-------------------------------------------------------
function Self.GetBidWeightOptions(bid, it)
local rules = Addon.db.profile.masterloot.rules
local answer = Util.Select(bid, Roll.BID_NEED, Roll.ANSWER_NEED, Roll.BID_GREED, Roll.ANSWER_GREED)
local answers = Util.Select(bid, Roll.BID_NEED, rules.needAnswers, Roll.BID_GREED, rules.greedAnswers)
local options = {
name = L["ROLL_BID_" .. bid],
type = "group",
order = it(),
inline = true,
args = {}
}
local name = function (info)
if answers and answers[info.arg] and answers[info.arg] ~= answer then
return answers[info.arg]
else
return Util.Str.Join(" ", not (info.arg == 0 and answers and Util.Tbl.Find(answers, answer)) and L["ROLL_BID_" .. bid], info.arg == 0 and "(" .. DEFAULT .. ")")
end
end
local get = function (info)
return "" .. (Self.db.profile.bidWeights[bid + info.arg/10] or Self.db.profile.bidWeights[bid] or "")
end
local set = function (info, val)
local i = bid + info.arg/10
Self.db.profile.bidWeights[i] = tonumber(val) or Self.db.defaults.bidWeights[i] or nil
end
local hidden = function (info)
return not answers or not answers[info.arg]
end
for i=0, answers and 9 or 0 do
options.args["weight" .. i] = {
name = name,
type = "input",
order = it(),
arg = i,
get = get,
set = set,
hidden = i ~= 0 and hidden,
width = Options.WIDTH_FIFTH_SCROLL
}
end
return options
end
-- Register module options
function Self.RegisterOptions()
Options.CustomOptions:Add("epgp", Options.CAT_MASTERLOOT, "epgp", function ()
local it = Util.Iter()
return {
name = L["EPGP"],
type = "group",
args = {
desc = {type = "description", fontSize = "medium", order = it(), name = L["EPGP_OPT_DESC"] .. "\n"},
warningNoAddon = {type = "description", fontSize = "medium", order = it(), name = L["EPGP_OPT_WARNING_NO_ADDON"] .. "\n", hidden = function () return IsAddOnLoaded("EPGP") end},
warningNoOfficer = {type = "description", fontSize = "medium", order = it(), name = L["EPGP_OPT_WARNING_NO_OFFICER"] .. "\n", hidden = CanEditOfficerNote},
enable = {
name = L["OPT_ENABLE"],
desc = L["OPT_ENABLE_MODULE_DESC"],
type = "toggle",
order = it(),
set = function (_, val)
Self.db.profile.enabled = val
Self:CheckState()
end,
get = function (_) return Self.db.profile.enabled end,
width = Options.WIDTH_THIRD_SCROLL
},
onlyGuildRaid = {
name = L["EPGP_OPT_ONLY_GUILD_RAID"],
desc = L["EPGP_OPT_ONLY_GUILD_RAID_DESC"]:format(Util.GROUP_THRESHOLD*100),
type = "toggle",
order = it(),
set = function (_, val)
Self.db.profile.onlyGuildRaid = val
Self:CheckState()
end,
get = function (_, key) return Self.db.profile.onlyGuildRaid end,
width = Options.WIDTH_THIRD_SCROLL
},
awardBefore = {
name = L["EPGP_OPT_AWARD_BEFORE"],
desc = L["EPGP_OPT_AWARD_BEFORE_DESC"],
type = "select",
order = it(),
values = Util.Tbl.Copy(Roll.AWARD_METHODS, function (v) return L["ROLL_AWARD_" .. v] end),
get = function () return Util.Tbl.Find(Roll.AWARD_METHODS, Self.db.profile.awardBefore) end,
set = function (_, val)
val = Roll.AWARD_METHODS[val] or Roll.AWARD_BIDS
Self.db.profile.awardBefore = val
Roll.AwardMethods:Add("epgp", Self.DetermineWinner, val)
GUI.PlayerColumns:Update("epgp", "sortBefore", Util.Select(val, Roll.AWARD_VOTES, "votes", Roll.AWARD_BIDS, "bid", Roll.AWARD_ROLLS, "roll", "ilvl"))
end,
width = Options.WIDTH_THIRD_SCROLL
},
["space" .. it()] = {type = "description", fontSize = "medium", order = it(0), name = " ", cmdHidden = true, dropdownHidden = true},
bidWeights = {type = "header", order = it(), name = L["EPGP_OPT_BID_WEIGHTS"]},
bidWeightsDesc = {type = "description", fontSize = "medium", order = it(), name = L["EPGP_OPT_BID_WEIGHTS_DESC"] .. "\n"},
bidWeightsNeed = Self.GetBidWeightOptions(Roll.BID_NEED, it),
bidWeightsGreed = Self.GetBidWeightOptions(Roll.BID_GREED, it),
bidWeightsDisenchant = Self.GetBidWeightOptions(Roll.BID_DISENCHANT, it)
}
}
end, function (data, isImport)
if isImport then
-- Import
Self.db.profile.awardBefore = Util.Default(data.epgpAwardBefore, Self.db.defaults.awardBefore)
Self.db.profile.bidWeights = Util.Tbl.Copy(Self.db.defaults.bidWeights)
if data.epgpBidWeights then
for i,v in data.epgpBidWeights:gmatch("(-?%d*%.?%d*) ?= ?(-?%d*%.?%d*)") do
i, v = tonumber(i), tonumber(v)
if i and v then Self.db.profile.bidWeights[i] = v end
end
end
else
-- Export
if Self.db.profile.awardBefore ~= Self.db.defaults.awardBefore then
data.epgpAwardBefore = Self.db.profile.awardBefore
end
if not Util.Tbl.Equals(Self.db.profile.bidWeights, Self.db.defaults.bidWeights) then
data.epgpBidWeights = Util(Self.db.profile.bidWeights)
:Copy(function (v, i) return v ~= Self.db.defaults.bidWeights[i] and ("%s=%s"):format(i, v) or nil end, true)
:Concat(", ")()
end
end
end)
end
-------------------------------------------------------
-- Events/Hooks --
-------------------------------------------------------
function Self:ShouldBeEnabled()
return IsAddOnLoaded(Self.NAME)
and Self.db.profile.enabled
and IsInRaid()
and Addon:IsTracking()
and (not Self.db.profile.onlyGuildRaid or IsInGuild() and Util.IsGuildGroup((GetGuildInfo("player"))))
end
function Self:OnInitialize()
-- DB and options
Self.db = {profile = Addon.db.profile.plugins.EPGP, defaults = Addon.db.defaults.profile.plugins.EPGP}
Self.RegisterOptions()
-- State
Self:CheckState()
Self:RegisterEvent("RAID_ROSTER_UPDATE", Self.CheckState)
Self:RegisterMessage(Addon.EVENT_TRACKING_CHANGE, Self.CheckState)
end
function Self:OnEnable()
-- Add custom player columns
GUI.PlayerColumns:Add("epgpEP", Self.UnitEP, L["EPGP_EP"])
GUI.PlayerColumns:Add("epgpGP", Self.UnitGP, L["EPGP_GP"])
GUI.PlayerColumns:Add("epgpPR", Self.UnitPR, L["EPGP_PR"], nil, nil, "bid", 0, true)
GUI.PlayerColumns:Add("epgpMinEP", Self.UnitHasMinEP, nil, nil, nil, "epgpPR", nil, true)
-- Add custom award method
Roll.AwardMethods:Add("epgp", Self.DetermineWinner, Self.db.profile.awardBefore)
-- Register events
Self:RegisterMessage(Roll.EVENT_AWARD, "ROLL_AWARD")
Self:RegisterMessage(Roll.EVENT_RESTART, "ROLL_RESTART")
Self:RegisterMessage(Roll.EVENT_CLEAR, "ROLL_CLEAR")
EPGP.RegisterCallback(Self, "StandingsChanged", "EPGP_STANDINGS_CHANGED")
end
function Self:OnDisable()
-- Remove custom player colums
GUI.PlayerColumns:Remove("epgpEP", "epgpGP", "epgpPR", "epgpMinEP")
-- Remove custom award method
Roll.AwardMethods:Remove("epgp")
-- Unregister events
Self:UnregisterMessage(Roll.EVENT_AWARD)
Self:UnregisterMessage(Roll.EVENT_RESTART)
Self:UnregisterMessage(Roll.EVENT_CLEAR)
EPGP.UnregisterCallback(Self, "StandingsChanged")
end
---@param roll Roll
---@param winner string
function Self:ROLL_AWARD(_, roll, winner)
if Session.IsMasterlooter() and roll.isOwner and not roll.isTest then
Self.UndoGPCredit(roll)
-- Credit the winner
local gp = Self.RollGP(roll)
if gp > 0 and winner and IsGuildMember(winner) then
Self.CreditGP(roll, winner, gp)
end
end
end
---@param roll Roll
function Self:ROLL_RESTART(_, roll)
Self.UndoGPCredit(roll)
end
---@param roll Roll
function Self:ROLL_CLEAR(_, roll)
Self.credited[roll.id] = nil
end
function Self:EPGP_STANDINGS_CHANGED()
GUI.Rolls.Update()
end
|
--[[ LICENSE HEADER
The MIT License (MIT)
Copyright © 2017-2021 Jordan Irwin (AntumDeluge)
See: LICENSE.txt
--]]
local modoverrides = {
"walking_light",
}
for _, mo in ipairs(modoverrides) do
if core.get_modpath(mo) then
antum.loadScript("misc/" .. mo)
end
end
|
return {'eiwit','eiwitarm','eiwitgehalte','eiwithormoon','eiwithoudend','eiwitmolecule','eiwitrijk','eiwitstof','eiwitsynthese','eiwitten','eiwitwaarde','eiwitschuim','eiwitbehoefte','eiwitbron','eiwitinname','eiwitmantel','eiwitmolecuul','eiwitopname','eiwitpoeder','eiwitproductie','eiwitverlies','eiwitbinding','eiwitstofwisseling','eiwitconsumptie','eiwitbronnen','eiwitmoleculen','eiwitrijke','eiwitrijker','eiwitrijkere','eiwitrijkste','eiwitstoffen','eiwitarme','eiwitgehalten','eiwitgehaltes','eiwithoudende','eiwitsynthesen','eiwitsyntheses','eiwitpoeders'}
|
require 'lib.stringaddons'
local emailaddress = {}
function emailaddress:new(addr)
if type(addr) ~= 'string' then
error('Passed in item must be a string')
end
local obj = {
__type = 'emailaddress',
localpart = '',
domain = '',
full = ''
}
if addr:find('RCPT TO:') then
addr = addr:sub(9):strip()
end
if addr:find('<') then
addr = addr:gsub('^.-<(.-)>$', '%1')
end
local parts = addr:split('@')
obj.localpart = parts[1]:strip()
if obj.localpart:find('"') then
obj.localpart = obj.localpart:gsub('%"', '')
end
if obj.localpart:find("'") then
obj.localpart = obj.localpart:gsub("'", '')
end
obj.domain = parts[2]:strip()
if obj.localpart:len() > 0 then
obj.full = obj.full .. obj.localpart
if obj.full:find(' ') then
obj.full = '"' .. obj.full .. '"'
end
end
if obj.domain:len() > 0 then
if obj.full:len() > 0 then
obj.full = obj.full .. '@'
end
obj.full = obj.full .. obj.domain
end
setmetatable(obj, self)
self._index = self
return obj
end
function emailaddress:__tostring()
return string.format('%s: %s', self.__type, self.full)
end
return emailaddress
|
--
local M = {}
local FU = cc.FileUtils:getInstance()
function M.changeLogPath(path)
local lp = lstg.LogSystem:getInstance():getPath()
if lp ~= path then
if lstg.LogSystem:getInstance():changePath(path) then
os.remove(lp)
SystemLog(('change log path to %q'):format(path))
else
SystemLog(('failed to change log path to %q'):format(path))
return false
end
end
return true
end
function M.changeWritablePath()
local ret
local osname = lstg.GetPlatform()
if osname == 'android' then
local native = require('platform.android.native')
local p = native.getSDCardPath()
if p and p ~= '' then
local path = p .. '/lstg/'
if FU:isDirectoryExist(path) then
FU:setWritablePath(path)
FU:addSearchPath(path)
ret = path
end
M.changeLogPath(path .. '/lstg_log.txt')
end
elseif osname == 'mac' then
local home = os.getenv('HOME')
if #home > 1 then
-- use Documents
local path = home .. '/Documents/lstg'
if FU:isDirectoryExist(path) then
FU:setWritablePath(path)
FU:addSearchPath(path)
local ok = M.changeLogPath(path .. '/lstg_log.txt')
if ok then
ret = path
end
end
end
if not ret then
-- use Resources
local native = require('platform.apple.native')
local p = native.getBundleResourcesDirectory()
if #p > 1 and FU:isDirectoryExist(p) then
local path = p
FU:setWritablePath(path)
FU:addSearchPath(path)
ret = path
M.changeLogPath(path .. '/lstg_log.txt')
end
end
elseif osname == 'ios' then
elseif osname == 'windows' then
FU:setWritablePath('./')
elseif osname == 'linux' then
FU:setWritablePath('./')
end
if ret then
if ret:sub(-1) ~= '/' then
ret = ret .. '/'
end
SystemLog(('set local writable path to %q'):format(ret))
end
return ret
end
function M.enumMods(path, root_name)
local ret = {}
root_name = root_name or 'root.lua'
local files = plus.EnumFiles(path)
for i, v in ipairs(files) do
if v.isDirectory then
if plus.FileExists(path .. v.name .. '/' .. root_name) then
table.insert(ret, v)
end
else
if string.lower(v.name:match(".+%.(%w+)$") or '') == 'zip' then
v.name = v.name:sub(1, -5)
assert(v.name ~= '')
table.insert(ret, v)
end
end
end
table.sort(ret, function(a, b)
if a.isDirectory ~= b.isDirectory then
return a.isDirectory
end
return a.name < b.name
end)
return ret
end
return M
|
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local voices = {
{ text = 'I wish someone could spare a minute and help me...' },
{ text = 'This is too hard for an old woman like me.' },
{ text = 'Hello, young adventurer, you look strong enough to help me!' }
}
npcHandler:addModule(VoiceModule:new(voices))
local storeTalkCid = {}
local function greetCallback(cid)
local player = Player(cid)
if player:getStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage) < 1 then
npcHandler:setMessage(MESSAGE_GREET, "Oh, heaven must have sent you! Could you please help me with a {quest}?")
storeTalkCid[cid] = 0
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage) == 1 then
npcHandler:setMessage(MESSAGE_GREET, "Welcome back, darling... so about that firewood, could you please {help} me?")
storeTalkCid[cid] = 2
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage) == 2 then
npcHandler:setMessage(MESSAGE_GREET, "Welcome back, darling... so about the {dead trees}, let me explain that a little more, {yes}?")
storeTalkCid[cid] = 3
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage) == 3 then
npcHandler:setMessage(MESSAGE_GREET, "Welcome back, darling... so about the {branches}, let me explain that a little more, {yes}?")
storeTalkCid[cid] = 4
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage) == 4 then
npcHandler:setMessage(MESSAGE_GREET, "Welcome back, darling... so about the {pushing}, let me explain that a little more, {yes}?")
storeTalkCid[cid] = 5
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage) == 5 then
npcHandler:setMessage(MESSAGE_GREET, "Welcome back, darling... so about the {cart}, let me explain that a little more, {yes}?")
storeTalkCid[cid] = 6
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage) == 6 then
npcHandler:setMessage(MESSAGE_GREET, "Oh, sweetheart, is there a problem with the quest? Should I {explain} it again?")
storeTalkCid[cid] = 7
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage) == 7 then
npcHandler:setMessage(MESSAGE_GREET, "Right, thank you sweetheart! This will be enough to heat my oven. Oh, and you are probably waiting for your reward, {yes}?")
storeTalkCid[cid] = 8
elseif player:getStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage) == 8 then
npcHandler:setMessage(MESSAGE_GREET, "Oh, welcome back, dear Isleth Eagonst! Are you here for a little chat? Just use the highlighted {keywords} again to choose a {topic}.")
end
return true
end
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
if isInArray({"yes", "quest", "ok"}, msg) then
if storeTalkCid[cid] == 0 then
npcHandler:say("By the way, 'quest' is a keyword that many NPCs react to, especially those which have tasks for you. So darling, about that {quest}... are you listening?", cid)
storeTalkCid[cid] = 1
elseif storeTalkCid[cid] == 1 then
npcHandler:say("Thank you so much for your kindness. I'm an old woman and I desperately need firewood for my oven. Could you please help me?", cid)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaQuestLog, 1)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage, 1)
storeTalkCid[cid] = 2
elseif storeTalkCid[cid] == 2 then
npcHandler:say("You're such a treasure. In the forest south of here, there are {dead trees} without any leaves. The first thing you have to do is search for one, {okay}?", cid)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaQuestLog, 2)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage, 2)
storeTalkCid[cid] = 3
elseif storeTalkCid[cid] == 3 then
npcHandler:say("Splendid, once you've found one, 'Use' it to break a branch from it. Did you understand that so far?", cid)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaQuestLog, 3)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage, 3)
storeTalkCid[cid] = 4
elseif storeTalkCid[cid] == 4 then
npcHandler:say("Good... so after you broke a branch, please push it here and select 'use with'. That will turn your mouse cursor into crosshairs. Then left-click on my cart. {Alright}?", cid)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaQuestLog, 4)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage, 4)
storeTalkCid[cid] = 5
elseif storeTalkCid[cid] == 5 then
npcHandler:say("To push the branch, drag and drop it on the grass by holding the left mousebutton and moving the cursor to where you want to throw the branch. Just push it near my cart before you 'Use' it, {alright}?", cid)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaQuestLog, 5)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage, 5)
storeTalkCid[cid] = 6
elseif storeTalkCid[cid] == 6 then
npcHandler:say({
"Thank you darling! My cart is right beside me. It's a little complicated: I need some firewood, but it's very difficult for my slightly advanced age. ...",
"Please go into the the forest southeast of here. You will find fine old rotten brown trees. Please RIGHT-CLICK in the lower right corner of that tree and choose 'USE'. That way, a branch should appear on the map. ...",
"Don't put it in your inventory like before, but instead DRAG it over the map by LEFT-CLICKING the loose branch, HOLDING the LEFT MOUSE BUTTON and moving it over the map. ...",
"When you are close to my cart, USE the branch WITH the cart: RIGHT-CLICK the branch on the floor and select 'USE WITH', Then LEFT-CLICK on the cart. Don't worry, you will see what I mean on the way. Thanks and {bye} for now!"
}, cid)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaQuestLog, 6)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage, 6)
Position(32064, 32273, 7):sendMagicEffect(CONST_ME_TUTORIALARROW)
npcHandler:releaseFocus(cid)
npcHandler:resetNpc(cid)
elseif storeTalkCid[cid] == 7 then
npcHandler:say({
"Well, you know that old women like me like to talk a lot. If you see three dots at the end of a sentence, I have still something to say and you should not interrupt, like now ...",
"Patience is a virtue, young adventurer! So, the quest was to go into the forest south of here and to find a dead tree. Wait, let me continue! ...",
"'Use' a tree to break a dry branch from it. Afterwards, drag and drop the branch back to my cart and select 'Use with', then left-click on my cart. Thanks again for offering your help!"
}, cid)
storeTalkCid[cid] = nil
elseif storeTalkCid[cid] == 8 then
npcHandler:say("Oh, you deserve it. You really have earned some experience! Also, you may enter my little house now and take what's in that chest beside my bed. Good {bye} for now!", cid)
player:addExperience(50, true)
Position(32058, 32266, 6):sendMagicEffect(CONST_ME_TUTORIALARROW)
player:getPosition():sendMagicEffect(CONST_ME_GIFT_WRAPS)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaQuestLog, 8)
player:setStorageValue(Storage.RookgaardTutorialIsland.ZirellaNpcGreetStorage, 8)
npcHandler:releaseFocus(cid)
npcHandler:resetNpc(cid)
end
elseif msgcontains(msg, "no") then
if storeTalkCid[cid] == 7 then
npcHandler:say("Well then, I hope you find nice and dry branches for me! Good {bye}!", cid)
npcHandler:releaseFocus(cid)
npcHandler:resetNpc(cid)
end
end
return true
end
local function onReleaseFocus(cid)
storeTalkCid[cid] = nil
end
npcHandler:setCallback(CALLBACK_ONRELEASEFOCUS, onReleaseFocus)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setMessage(MESSAGE_FAREWELL, "Good bye |PLAYERNAME|, may Uman bless you!.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Good bye traveller, take care.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
|
local lester = require 'tests.lester'
require 'tests.lpegrex-test'
require 'tests.c11-test'
require 'tests.json-test'
lester.report()
|
local PLUGIN = PLUGIN;
local COMMAND = Clockwork.command:New("RespawnStay");
COMMAND.tip = "Respawn a player, but keep them at their current position.";
COMMAND.text = "<string Name>";
COMMAND.access = "a";
COMMAND.arguments = 1;
-- Called when the command has been run.
function COMMAND:OnRun(player, arguments)
local target = Clockwork.player:FindByID(arguments[1])
if (target) then
local echo = Clockwork.config:Get("admin_echoes"):Get()
local pos = target:GetPos()
local angs = target:GetAngles()
local eyeAngs = target:EyeAngles()
target:Spawn()
target:SetPos(pos)
target:SetAngles(angs)
target:SetEyeAngles(eyeAngs)
if(echo) then
Clockwork.player:NotifyAll(player:Name().." has respawned "..target:Name()..".")
end;
else
Clockwork.player:Notify(player, arguments[1].." is not a valid player!")
end;
end;
COMMAND:Register();
|
local dt = require "decisiontree._env"
-- Decision forest that ensembles a bag of decision trees.
local DecisionForest = torch.class("dt.DecisionForest", "dt.DecisionTree", dt)
function DecisionForest:__init(trees, weight, bias)
assert(torch.type(trees) == 'table')
self.trees = trees
if #trees == 0 then
self.weight = weight or torch.Tensor()
assert(torch.isTensor(self.weight))
assert(self.weight:nElement() == 0)
else
assert(torch.isTypeOf(trees[1], 'dt.DecisionTree'))
self.weight = weight or torch.Tensor(#trees):fill(1)
assert(torch.isTensor(self.weight))
assert(self.weight:dim() == 1)
assert(self.weight:min() >= 0, "Expecting positive weights")
assert(#trees == self.weight:size(1))
end
self.bias = bias or 0
assert(torch.type(self.bias) == 'number')
end
function DecisionForest:score(input, incrementalId)
assert(torch.isTensor(input))
local buffer = {}
if incrementalId then
self.buffers = self.buffers or {}
self.buffers[incrementalId] = self.buffers[incrementalId] or {}
buffer = self.buffers[incrementalId]
end
buffer.initialCounter = buffer.initialCounter or 0
-- TODO: score in parallel
local output
if torch.isTensor(input) and input.isContiguous and input:isContiguous() and input:nDimension() == 2 then
buffer.output = buffer.output or input.new()
output = buffer.output
assert(output:nElement() == 0 or output:size(1) == input:size(1))
if output:nElement() == 0 then
output:resize(input:size(1)):fill(self.bias)
end
for i,tree in ipairs(self.trees) do
if i > buffer.initialCounter then
local score = tree:score(input, nil, true)
output:add(self.weight[i], score)
end
end
else
output = buffer.output or self.bias
for i,tree in ipairs(self.trees) do
if i > buffer.initialCounter then
output = output + tree:score(input) * self.weight[i]
end
end
buffer.output = output
end
buffer.initialCounter = #self.trees
return output
end
function DecisionForest:add(tree, weight)
assert(torch.type(weight) == 'number')
assert(weight > 0)
table.insert(self.trees, tree)
self.weight:resize(#self.trees)
self.weight[#self.trees] = weight
return self
end
function DecisionForest:clone()
local trees = {}
for i, tree in ipairs(self.trees) do
trees[i] = tree:clone()
end
return DecisionForest(trees, self.weight:clone(), self.bias)
end
|
local Speed = Component.create("Speed")
function Speed:initialize(speed)
self.speed = speed
end
|
local helpers = require('test.functional.helpers')(after_each)
local clear = helpers.clear
local command = helpers.command
local eval = helpers.eval
describe('autocmds:', function()
before_each(clear)
it(':tabnew triggers events in the correct order', function()
local expected = {
'WinLeave',
'TabLeave',
'TabNew',
'WinEnter',
'TabEnter',
'BufLeave',
'BufEnter'
}
command('let g:foo = []')
command('autocmd BufEnter * :call add(g:foo, "BufEnter")')
command('autocmd BufLeave * :call add(g:foo, "BufLeave")')
command('autocmd TabEnter * :call add(g:foo, "TabEnter")')
command('autocmd TabLeave * :call add(g:foo, "TabLeave")')
command('autocmd TabNew * :call add(g:foo, "TabNew")')
command('autocmd WinEnter * :call add(g:foo, "WinEnter")')
command('autocmd WinLeave * :call add(g:foo, "WinLeave")')
command('tabnew')
assert.same(expected, eval('g:foo'))
end)
end)
|
MainMenuBarArtFrame.RightEndCap:Hide()
MainMenuBarArtFrame.LeftEndCap:Hide()
|
--[==[
webb | xapp language/country/currency setting UI
Written by Cosmin Apreutesei. Public Domain.
API
update_S_schema_texts()
ROWSETS
S translation UI: labeled strings from source code
S_schema_attrs translation UI: list translatable field attributes
S_schema_fields translation UI: translate schema & rowset fields
lang used for setting supported languages
pick_lang used for choosing the current language
]==]
require'webb_lang'
require'webb_spa'
require'xrowset_sql'
Sfile'xlang.lua'
local text_in_english = Sf('text_in_english', 'Text in English')
local text_in_current_language = Sf('text_in_current_language', 'Text in Current Language')
--S translation rowset -------------------------------------------------------
rowset.S = virtual_rowset(function(self, ...)
self.allow = 'admin'
self.fields = {
{name = 'ext' , readonly = true , },
{name = 'id' , readonly = true , },
{name = 'en_text' , readonly = true , text = text_in_english},
{name = 'text' , readonly = false, text = text_in_current_language},
{name = 'files' , readonly = true , },
{name = 'occurences', readonly = true , type = 'number', max_w = 30},
}
self.pk = 'ext id'
self.cols = 'id en_text text'
function self:load_rows(rs, params)
rs.rows = {}
local lang = lang()
for ext_id, t in pairs(Sfile_ids()) do
local ext, id = ext_id:match'^(.-):(.*)$'
local s = S_texts(lang, ext)[id]
add(rs.rows, {ext, id, t.en_s, s, t.files, t.n})
end
end
local function update_key(vals)
local ext = checkarg(json_str_arg(vals['ext:old']))
local id = checkarg(json_str_arg(vals['id:old']))
local lang = checkarg(json_str_arg(vals['param:lang']))
return ext, id, lang
end
function self:update_row(vals)
local ext, id, lang = update_key(vals)
local text = json_str_arg(vals.text)
update_S_texts(lang, ext, {[id] = text or false})
end
function self:load_row(vals)
local ext, id, lang = update_key(vals)
local t = Sfile_ids()[ext..':'..id]
if not t then return end
local s = S_texts(lang, ext)[id]
return {ext, id, t.en_s, s, t.files, t.n}
end
end)
--S_schema_fields translation rowset -----------------------------------------
local function S_schema_file(lang, attr)
return varpath(string.format('%s-s-%s-col-%s.lua', config'app_name', lang, attr))
end
--TODO: invalidate this cache based on file's mtime but don't check too often.
local function S_schema_texts(lang, attr)
local f = loadfile(S_schema_file(lang, attr))
return f and f() or {}
end
local function save_S_schema_texts(lang, attr, t)
save(S_schema_file(lang, attr), 'return '..pp.format(t, '\t'))
end
local valid_attrs
rowset.S_schema_attrs = virtual_rowset(function(self, ...)
self.allow = 'admin'
self.fields = {
{name = 'attr', },
{name = 'info', hidden = true},
}
self.pk = 'attr'
local rows = {
{'text', Sf('field_attr_info_text', 'The name of field as it appears in grid headers')},
{'info', Sf('field_attr_info_info', 'The long description of the field')},
}
function self:load_rows(rs)
rs.rows = {}
for i,row in ipairs(rows) do
rs.rows[i] = {row[1], row[2]()}
end
end
valid_attrs = glue.imap(rows, 1)
update(valid_attrs, glue.index(valid_attrs))
end)
local function db_schema()
return config('db_schema')
end
rowset.S_schema_fields = virtual_rowset(function(self, ...)
self.allow = 'admin'
self.fields = {
{name = 'type' , readonly = true , },
{name = 'table' , readonly = true , },
{name = 'col' , readonly = true , text = 'Column'},
{name = 'attr' , readonly = true , },
{name = 'en_text', readonly = true , text = text_in_english},
{name = 'text' , readonly = false, text = text_in_current_language},
}
self.pk = 'table col attr'
self.cols = 'table col en_text text'
function self:load_rows(rs, params)
local attrs = params['param:filter']
rs.rows = {}
local function add_row(texts, tbl_type, tbl_name, fld, col, attr)
local en_text = fld['en_'..attr]
if type(en_text) == 'function' then --getter/generator
en_text = en_text()
end
local text = texts[tbl_type..'.'..tbl_name..'.'..col]
table.insert(rs.rows, {tbl_type, tbl_name, col, attr, en_text, text})
end
for i,attr in ipairs(attrs) do
local texts = S_schema_texts(lang(), attr)
for tbl_name, tbl in glue.sortedpairs(db_schema().tables) do
for i, fld in ipairs(tbl.fields) do
add_row(texts, 'table', tbl_name, fld, fld.col, attr)
end
end
for rs_name, rs in glue.sortedpairs(rowset) do
if rs.client_fields then
for i, fld in ipairs(rs.client_fields) do
add_row(texts, 'rowset', rs_name, fld, fld.name, attr)
end
end
end
end
end
local function checkargs(vals)
local tbl = checkarg(str_arg(vals['table:old']))
local col = checkarg(str_arg(vals['col:old']))
local attr = checkarg(str_arg(vals['attr:old']))
local text = str_arg(vals['text'])
assert(valid_attrs[attr])
local en_text = db_schema().tables[tbl].fields[col][attr]
return tbl, col, attr, text, en_text
end
function self:update_row(vals)
local tbl, col, attr, text = checkargs(vals)
local texts = S_schema_texts(lang(), attr)
texts[tbl..'.'..col] = text
save_S_schema_texts(lang(), attr, texts)
end
function self:load_row(vals)
local tbl, col, attr, text, en_text = checkargs(vals)
local texts = S_schema_texts(lang(), attr)
return {tbl, col, attr, en_text, text}
end
end)
local function S_col(tbl_col, attr)
local texts = S_schema_texts(lang(), attr)
return texts[tbl_col]
end
local function update_S_texts(tbl, fld, col, attr)
local en_text = fld[attr]
fld['en_'..attr] = en_text
local tbl_col = tbl..'.'..col
fld[attr] = function()
local s = S_col(tbl_col, attr)
if s then
return s
end
s = en_text
if type(s) == 'function' then
s = s()
end
return s
end
end
function update_S_schema_texts()
local sc = db_schema()
for _,attr in ipairs(valid_attrs) do
for tbl_name, tbl in pairs(db_schema().tables) do
for _,fld in ipairs(tbl.fields) do
update_S_texts('table.'..tbl_name, fld, fld.col, attr)
end
end
for rs_name, rs in pairs(rowset) do
break
pr(rs_name, rs)
if rs.client_fields then
for _,fld in ipairs(rs.client_fields) do --virtual rowset
update_S_texts('rowset.'..rs_name, fld, fld.name, attr)
end
end
end
end
end
--lang picker rowset ---------------------------------------------------------
rowset.lang = sql_rowset{
select = [[
select
lang,
en_name,
name,
supported
from lang
]],
pk = 'lang',
field_attrs = {
lang = {w = 40, readonly = true},
en_name = {readonly = true},
name = {readonly = true},
},
update_row = function(self, row)
update_row('lang', row, 'supported')
end,
}
rowset.pick_lang = sql_rowset{
select = [[
select
lang,
concat(name, ' (', en_name, ')') as name
from lang
]],
where_all = 'supported = 1',
pk = 'lang',
}
|
require 'dp'
require 'nn'
require 'optim'
ds = dp.Mnist()
trainInput = ds:get('train','input','bchw')
trainTarget = ds:get('train', 'target', 'b')
validInput = ds:get('valid','input','bchw')
validTarget = ds:get('valid','target','b')
trainInput = trainInput:type('torch.DoubleTensor')
validInput = validInput:type('torch.DoubleTensor')
net = nn.Sequential()
--net:add(nn.Convert('bhwc','bchw'))
net:add(nn.SpatialConvolution(1,6,3,3))
net:add(nn.ReLU())
net:add(nn.SpatialConvolution(6,16,3,3))
net:add(nn.ReLU())
net:add(nn.SpatialMaxPooling(2,2))
net:add(nn.ReLU())
net:add(nn.SpatialConvolution(16,24,5,5))
net:add(nn.SpatialMaxPooling(2,2))
net:add(nn.View(24*4*4))
net:add(nn.Linear(24*4*4,480))
net:add(nn.Linear(480,120))
net:add(nn.Tanh())
net:add(nn.Linear(120,64))
net:add(nn.Tanh())
net:add(nn.Linear(64,10))
net:add(nn.LogSoftMax())
--criterion
criterion = nn.ClassNLLCriterion()
-- validator
cm = optim.ConfusionMatrix(10)
function evalValidset(net, inputs, targets)
cm:zero()
for i=1,inputs:size(1) do
local input,target = inputs[i], targets:narrow(1,i,1)
local output = net:forward(input)
cm:add(output,target)
end
cm:updateValids()
return cm.totalValid
end
--trainer
function runEpoch(net, inputs, targets, criterion)
for id=1,inputs:size(1) do
local i=math.random(1,inputs:size(1))
if ((id%1000) == 0) then print(id) end
if((id%20000) == 0) then break end
local input,target = inputs[i], targets:narrow(1,i,1)
local output = net:forward(input)
net:zeroGradParameters()
local loss = criterion:forward(output,target)
local gradOutput = criterion:backward(output,target)
local gradInput = net:backward(input,gradOutput)
net:updateGradParameters(0.9)
net:updateParameters(0.1)
end
end
-- trainer run
function learnMNIST()
bestAcc, bestEp = 0,0
wait = 0
for i=1,300 do
runEpoch(net, trainInput, trainTarget, criterion)
local validAcc = evalValidset(net,validInput, validTarget)
if validAcc > bestAcc then
bestAcc, bestEp = validAcc,i
print(bestAcc,bestEp,": New Maxima reached")
wait = 0
else
print(validAcc,": Not realliy doing better")
wait = wait + 1
if wait > 30 then print("Too much, exiting") end
end
end
end
learnMNIST()
--cnn = nn.Sequential()
--cnn:add(nn.Convert('bhwc','bchw'))
--cnn:add(nn.SpatialConvolution(1,16,5,5,1,1,2,2))
--cnn:add(nn.ReLU())
--cnn:add(nn.SpatialMaxPooling(2,2,2,2))
--cnn:add(nn.SpatialConvolution(16,32,5,5,1,1,2,2))
--cnn:add(nn.ReLU())
--cnn:add(nn.SpatialMaxPooling(2,2,2,2))
--outsize = cnn:outside{1,28,28,1}
--print("here")
--cnn:add(nn.Collapse(3))
--cnn:add(nn.Linear(outsize[2]*outsize[3]*outsize[4],200))
--cnn:add(nn.ReLU())
--cnn:add(nn.Linear(200,10))
--cnn:add(nn.LogSoftMax())
--print("here")
--train = dp.Optimizer{
-- loss = nn.ModuleCriterion(nn.ClassNLLCriterion,nil,nn.Convert()),
-- callback = function(model,report)
-- model:updateGradParameters(0.9)
-- model:updateParameters(0.1)
-- model:maxParamNorm(2)
-- model:zeroGradParameters()
-- end,
-- feedback = dp.Confusion(),
-- sampler = dp.ShuffleSampler{batch_size = 32},
-- progress = true
--}
--valid = dp.Evaluator{
--- feedback = dp.Confusion(), sampler = dp.Sampler{batch_size=32}
--}
--test = dp.Evaluator{
-- feedback = dp.Confusion(), sampler = dp.Sampler{batch_size = 32}
--}
--xp = dp.Experiment{
-- model = cnn,
-- optimizer = train, validator = valid, tester = test,
-- observer = dp.EarlyStopper{
-- error_report = {'validator','feedback','confusion','accuracy'},
-- maximize = true, max_epochs = 50
-- },
-- random_seed = os.time(), max_epoch=2000
--}
--require 'cutorch'
--require 'cunn'
--print(cnn)
--xp:cuda()
--xp:run(ds)
|
function IsAlpha(c)
return (c >= 'a' and c <= 'z') or (c >= 'A' and c <= 'Z')
end
function IsDigit(c)
return c >= '0' and c <= '9'
end
function IsSpace(c)
return c == ' ' or c == '\t' or c == '\n' or c == '\v' or c == '\f' or c == '\r'
end
function IsAlNum(c)
return IsAlpha(c) or IsDigit(c)
end
function IsCidstart(c)
return IsAlpha(c) or c == '_' or c == '#'
end
function IsCident(c)
return IsAlNum(c) or c == '_'
end
function IS_HEX_ALPHA_DIGIT(c)
return (c >= 'a' and c <= 'f') or (c >= 'A' and c <= 'F')
end
function IS_BASE_DIGIT(c, b)
local digit_end, dec
if b < 10 then
digit_end = b - 1
else
digit_end = 9
end
dec = tostring(digit_end)
local is_base_digit, is_hex_digit
is_base_digit = (c >= '0' and c <= dec)
if b > 10 then
is_hex_digit = IS_HEX_ALPHA_DIGIT(c)
else
is_hex_digit = false
end
return is_base_digit or is_hex_digit
end
function GET_BASE_DIGIT(c)
if c <= '9' then
return string.byte(c) - string.byte('0')
else
if c <= 'F' then
return string.byte(c) - string.byte('A') + 10
else
return string.byte(c) - string.byte('a') + 10
end
end
end
function NEXTIS(c, x, y, NextChar, Lexer)
if NextChar == c then
LEXER_INC(Lexer)
return x
else
return y
end
end
function NEXTIS3(c, x, d, y, z, NextChar, Lexer)
if NextChar == c then
LEXER_INC(Lexer)
return x
else
return NEXTIS(d, y, z, NextChar, Lexer)
end
end
function NEXTIS4(c, x, d, y, e, z, a, NextChar, Lexer)
if NextChar == c then
LEXER_INC(Lexer)
return x
else
return NEXTIS3(d, y, e, z, a, NextChar, Lexer)
end
end
function NEXTIS3PLUS(c, x, d, y, e, z, a, NextChar, Lexer)
if NextChar == c then
LEXER_INC(Lexer)
return x
else
if NextChar == d then
if GET_LEXER_CHAR_AT(Lexer, Lexer.Pos + 1) == e then
LEXER_INCN(Lexer, 2)
return z
else
LEXER_INC(Lexer)
return y
end
else
return a
end
end
end
function NEXTISEXACTLY3(c, d, y, z, NextChar, Lexer)
if NextChar == c and GET_LEXER_CHAR_AT(Lexer, Lexer.Pos + 1) == d then
LEXER_INCN(Lexer, 2)
return y
else
return z
end
end
function LEXER_INC(l)
l.Pos = l.Pos + 1
l.CharacterPos = l.CharacterPos + 1
end
function LEXER_INCN(l, n)
l.Pos = l.Pos + n
l.CharacterPos = l.CharacterPos + n
end
TOKEN_DATA_OFFSET = 2
MAX_CHAR_VALUE = 255
function GET_LEXER_CHAR(l)
return string.sub(l.SourceText, l.Pos, l.Pos)
end
function GET_LEXER_CHAR_AT(l, p)
return string.sub(l.SourceText, p, p)
end
function GET_LEXER_STR_FROM(l, f)
return string.sub(l.SourceText, f)
end
function CHAR_AT(s, p)
return string.sub(s, p, p)
end
function GET_PARSING(ps)
return ps.ParsingTokens[ps.Pos]
end
function GET_PARSING_AT(ps, p)
return ps.ParsingTokens[p]
end
ReservedWords = {
{
Word = "#define",
Token = LexToken.TokenHashDefine
},
{
Word = "#else",
Token = LexToken.TokenHashElse
},
{
Word = "#endif",
Token = LexToken.TokenHashEndif
},
{
Word = "#if",
Token = LexToken.TokenHashIf
},
{
Word = "#ifdef",
Token = LexToken.TokenHashIfdef
},
{
Word = "#ifndef",
Token = LexToken.TokenHashIfndef
},
{
Word = "#include",
Token = LexToken.TokenHashInclude
},
{
Word = "auto",
Token = LexToken.TokenAutoType
},
{
Word = "break",
Token = LexToken.TokenBreak
},
{
Word = "case",
Token = LexToken.TokenCase
},
{
Word = "char",
Token = LexToken.TokenCharType
},
{
Word = "continue",
Token = LexToken.TokenContinue
},
{
Word = "default",
Token = LexToken.TokenDefault
},
{
Word = "delete",
Token = LexToken.TokenDelete
},
{
Word = "do",
Token = LexToken.TokenDo
},
{
Word = "double",
Token = LexToken.TokenDoubleType
},
{
Word = "else",
Token = LexToken.TokenElse
},
{
Word = "enum",
Token = LexToken.TokenEnumType
},
{
Word = "extern",
Token = LexToken.TokenExternType
},
{
Word = "float",
Token = LexToken.TokenFloatType
},
{
Word = "for",
Token = LexToken.TokenFor
},
{
Word = "goto",
Token = LexToken.TokenGoto
},
{
Word = "if",
Token = LexToken.TokenIf
},
{
Word = "int",
Token = LexToken.TokenIntType
},
{
Word = "long",
Token = LexToken.TokenLongType
},
{
Word = "new",
Token = LexToken.TokenNew
},
{
Word = "register",
Token = LexToken.TokenRegisterType
},
{
Word = "return",
Token = LexToken.TokenReturn
},
{
Word = "short",
Token = LexToken.TokenShortType
},
{
Word = "signed",
Token = LexToken.TokenSignedType
},
{
Word = "sizeof",
Token = LexToken.TokenSizeof
},
{
Word = "static",
Token = LexToken.TokenStaticType
},
{
Word = "struct",
Token = LexToken.TokenStructType
},
{
Word = "switch",
Token = LexToken.TokenSwitch
},
{
Word = "typedef",
Token = LexToken.TokenTypedef
},
{
Word = "union",
Token = LexToken.TokenUnionType
},
{
Word = "unsigned",
Token = LexToken.TokenUnsignedType
},
{
Word = "void",
Token = LexToken.TokenVoidType
},
{
Word = "while",
Token = LexToken.TokenWhile
}
}
function LexInit(pc)
local Size = #ReservedWords
TableInitTable(pc.ReservedWordTable, pc.ReservedWordHashTable,
Size, true)
for Count = 1, Size do
TableSet(pc, pc.ReservedWordTable,
TableStrRegister(pc, ReservedWords[Count].Word),
ReservedWords[Count], nil, 0, 0)
end
LexResetLexValue(pc)
end
function LexResetLexValue(pc)
pc.LexValue = {}
pc.LexValue.Typ = nil
pc.LexValue.Val = {
RawValue = {
Val = "\000\000\000\000\000\000\000\000"
},
Offset = 0,
RefOffsets = {},
Pointer = {},
}
--setmetatable(pc.LexValue.Val.Pointer, { __mode = "v" })
pc.LexValue.LValueFrom = false
pc.LexValue.ValOnHeap = false
pc.LexValue.ValOnStack = false
pc.LexValue.AnyValOnHeap = false
pc.LexValue.IsLValue = false
end
function LexCleanup(pc)
LexInteractiveClear(pc, nil)
local Size = #ReservedWords
for Count = 1, Size do
TableDelete(pc, pc.ReservedWordTable,
TableStrRegister(pc, ReservedWords[Count].Word))
end
end
function LexCheckReservedWord(pc, Word)
local val, Success
Success, val, _, _, _ = TableGet(pc.ReservedWordTable, Word)
if Success then
return val.Token
else
return LexToken.TokenNone
end
end
function LexGetNumber(pc, Lexer, Value)
local Result = 0
local Base = 10
local ResultToken, FPResult, FPDiv
if GET_LEXER_CHAR(Lexer) == '0' then
LEXER_INC(Lexer)
if Lexer.Pos ~= Lexer.End then
if GET_LEXER_CHAR(Lexer) == 'x' or GET_LEXER_CHAR(Lexer) == 'X' then
Base = 16
LEXER_INC(Lexer)
elseif GET_LEXER_CHAR(Lexer) == 'b' or GET_LEXER_CHAR(Lexer) == 'B' then
Base = 2
LEXER_INC(Lexer)
elseif GET_LEXER_CHAR(Lexer) ~= '.' then
Base = 8
end
end
end
--print(GET_LEXER_CHAR(Lexer))
--print(IS_BASE_DIGIT(GET_LEXER_CHAR(Lexer), Base))
while (Lexer.Pos ~= Lexer.End and
IS_BASE_DIGIT(GET_LEXER_CHAR(Lexer), Base)) do
Result = Result * Base + GET_BASE_DIGIT(GET_LEXER_CHAR(Lexer))
LEXER_INC(Lexer)
end
if GET_LEXER_CHAR(Lexer) == 'u' or GET_LEXER_CHAR(Lexer) == 'U' then
LEXER_INC(Lexer)
end
if GET_LEXER_CHAR(Lexer) == 'l' or GET_LEXER_CHAR(Lexer) == 'L' then
LEXER_INC(Lexer)
end
Value.Typ = pc.LongType
PointerSetSignedOrUnsignedInt(Value.Val, Result)
ResultToken = LexToken.TokenIntegerConstant
if Lexer.Pos == Lexer.End then
return ResultToken
end
if (GET_LEXER_CHAR(Lexer) ~= '.' and GET_LEXER_CHAR(Lexer) ~= 'e' and
GET_LEXER_CHAR(Lexer) ~= 'E') then
return ResultToken
end
Value.Typ = pc.FPType
FPResult = Result
if GET_LEXER_CHAR(Lexer) == '.' then
LEXER_INC(Lexer)
FPDiv = 1 / Base
while Lexer.Pos ~= Lexer.End and IS_BASE_DIGIT(GET_LEXER_CHAR(Lexer), Base) do
FPResult = FPResult + GET_BASE_DIGIT(GET_LEXER_CHAR(Lexer)) * FPDiv
LEXER_INC(Lexer)
FPDiv = FPDiv / Base
end
end
if (Lexer.Pos ~= Lexer.End and (GET_LEXER_CHAR(Lexer) == 'e' or
GET_LEXER_CHAR(Lexer) == 'E')) then
local ExponentSign = 1
LEXER_INC(Lexer)
if Lexer.Pos ~= Lexer.End and GET_LEXER_CHAR(Lexer) == '-' then
ExponentSign = -1
LEXER_INC(Lexer)
end
Result = 0
while Lexer.Pos ~= Lexer.End and IS_BASE_DIGIT(GET_LEXER_CHAR(Lexer), Base) do
Result = Result * Base + GET_BASE_DIGIT(GET_LEXER_CHAR(Lexer))
LEXER_INC(Lexer)
end
FPResult = FPResult * (Base ^ (Result * ExponentSign))
end
PointerSetFP(Value.Val, FPResult)
if GET_LEXER_CHAR(Lexer) == 'f' or GET_LEXER_CHAR(Lexer) == 'F' then
LEXER_INC(Lexer)
end
return LexToken.TokenFPConstant
end
function LexGetWord(pc, Lexer, Value)
local StartPos = Lexer.Pos
local Token
repeat
LEXER_INC(Lexer)
until Lexer.Pos == Lexer.End or not IsCident(GET_LEXER_CHAR(Lexer))
Value.Typ = nil
Value.Val = TableStrRegister2(pc, GET_LEXER_STR_FROM(Lexer, StartPos),
Lexer.Pos - StartPos)
--print("LGW: ", Value.Val.RawValue.Val, Lexer.Pos, StartPos, Value.Val)
Token = LexCheckReservedWord(pc, Value.Val)
if Token == LexToken.TokenHashInclude then
Lexer.Mode = LexMode.LexModeHashInclude
elseif Token == LexToken.TokenHashDefine then
Lexer.Mode = LexMode.LexModeHashDefine
end
if Token ~= LexToken.TokenNone then
return Token
end
if Lexer.Mode == LexMode.LexModeHashDefineSpace then
Lexer.Mode = LexMode.LexModeHashDefineSpaceIdent
end
return LexToken.TokenIdentifier
end
function LexUnEscapeCharacterConstant(From, FromPos, FirstChar, Base)
local Total = GET_BASE_DIGIT(FirstChar)
local CCount = 0
while IS_BASE_DIGIT(CHAR_AT(From, FromPos), Base) and CCount < 2 do
Total = Total * Base + GET_BASE_DIGIT(CHAR_AT(From, FromPos))
CCount = CCount + 1
FromPos = FromPos + 1
end
return string.char(Total), FromPos
end
function LexUnEscapeCharacter(From, FromPos, EndPos)
local ThisChar
local Return
while (FromPos ~= EndPos and CHAR_AT(From, FromPos) == '\\' and
FromPos + 1 ~= EndPos and CHAR_AT(From, FromPos + 1) == '\n') do
FromPos = FromPos + 2
end
while (FromPos ~= EndPos and CHAR_AT(From, FromPos) == '\\' and
FromPos + 1 ~= EndPos and CHAR_AT(From, FromPos + 1) == '\r' and
FromPos + 2 ~= EndPos and CHAR_AT(From, FromPos + 2) == '\n') do
FromPos = FromPos + 3
end
if FromPos == EndPos then
return '\\', FromPos
end
if CHAR_AT(From, FromPos) == '\\' then
FromPos = FromPos + 1
if FromPos == EndPos then
return '\\', FromPos
end
ThisChar = CHAR_AT(From, FromPos)
FromPos = FromPos + 1
if ThisChar == '\\' then
return '\\', FromPos
elseif ThisChar == "'" then
return "'", FromPos
elseif ThisChar == '"' then
return '"', FromPos
elseif ThisChar == 'a' then
return '\a', FromPos
elseif ThisChar == 'b' then
return '\b', FromPos
elseif ThisChar == 'f' then
return '\f', FromPos
elseif ThisChar == 'n' then
return '\n', FromPos
elseif ThisChar == 'r' then
return '\r', FromPos
elseif ThisChar == 't' then
return '\t', FromPos
elseif ThisChar == 'v' then
return '\v', FromPos
elseif ThisChar >= '0' and ThisChar <= '3' then
return LexUnEscapeCharacterConstant(From, FromPos, ThisChar, 8)
elseif ThisChar == 'x' then
return LexUnEscapeCharacterConstant(From, FromPos, '0', 16)
else
return ThisChar, FromPos
end
else
Return = CHAR_AT(From, FromPos)
FromPos = FromPos + 1
return Return, FromPos
end
end
function LexGetStringConstant(pc, Lexer, Value, EndChar)
local Escape = false
local StartPos = Lexer.Pos
local EndPos
local EscBuf, EscBufPos, RegString
local ArrayValue
while (Lexer.Pos ~= Lexer.End and
(GET_LEXER_CHAR(Lexer) ~= EndChar or Escape)) do
if Escape then
if GET_LEXER_CHAR(Lexer) == '\r' and Lexer.Pos + 1 ~= Lexer.End then
Lexer.Pos = Lexer.Pos + 1
end
if GET_LEXER_CHAR(Lexer) == '\n' and Lexer.Pos + 1 ~= Lexer.End then
Lexer.Line = Lexer.Line + 1
Lexer.Pos = Lexer.Pos + 1
Lexer.CharacterPos = 0
Lexer.EmitExtraNewlines = Lexer.EmitExtraNewlines + 1
end
Escape = false
elseif GET_LEXER_CHAR(Lexer) == '\\' then
Escape = true
end
LEXER_INC(Lexer)
end
EndPos = Lexer.Pos
EscBuf = HeapAllocStack(pc)
if EscBuf == nil then
LexFail(pc, Lexer, "(LexGetStringConstant) out of memory")
end
EscBuf.Str = ""
EscBufPos = 1
Lexer.Pos = StartPos
while Lexer.Pos ~= EndPos do
local CurChar
CurChar, Lexer.Pos = LexUnEscapeCharacter(Lexer.SourceText,
Lexer.Pos, EndPos)
--print("Byte:", string.byte(CurChar), CurChar)
EscBuf.Str = EscBuf.Str .. CurChar
EscBufPos = EscBufPos + 1
end
RegString = TableStrRegister2(pc, EscBuf.Str, EscBufPos - 1)
HeapPopStack(pc, 1, EscBuf.StackId - 1)
ArrayValue = VariableStringLiteralGet(pc, RegString)
if ArrayValue == nil then
ArrayValue = VariableAllocValueAndData(pc, nil, 0, false, nil, true)
ArrayValue.Typ = pc.CharArrayType
ArrayValue.Val = RegString
VariableStringLiteralDefine(pc, RegString, ArrayValue)
end
Value.Typ = pc.CharPtrType
--print(Value.Val.Ident, " ", RegString.RawValue.Val)
PointerReference(Value.Val, RegString)
if GET_LEXER_CHAR(Lexer) == EndChar then
LEXER_INC(Lexer)
end
return LexToken.TokenStringConstant
end
function LexGetCharacterConstant(pc, Lexer, Value)
Value.Typ = pc.CharType
Value.Val.RawValue.Val, Lexer.Pos = LexUnEscapeCharacter(Lexer.SourceText,
Lexer.Pos, Lexer.End)
if Lexer.Pos ~= Lexer.End and GET_LEXER_CHAR(Lexer) ~= "'" then
LexFail(pc, Lexer, "expected \"'\"")
end
LEXER_INC(Lexer)
return LexToken.TokenCharacterConstant
end
function LexSkipComment(Lexer, NextChar)
if NextChar == '*' then
while (Lexer.Pos ~= Lexer.End and
(GET_LEXER_CHAR_AT(Lexer, Lexer.Pos - 1) ~= '*' or
GET_LEXER_CHAR(Lexer) ~= '/')) do
if GET_LEXER_CHAR(Lexer) == '\n' then
Lexer.EmitExtraNewlines = Lexer.EmitExtraNewlines + 1
end
LEXER_INC(Lexer)
end
if Lexer.Pos ~= Lexer.End then
LEXER_INC(Lexer)
end
Lexer.Mode = LexMode.LexModeNormal
else
while Lexer.Pos ~= Lexer.End and GET_LEXER_CHAR(Lexer) ~= '\n' do
LEXER_INC(Lexer)
end
end
end
function LexSkipLineCont(Lexer, NextChar)
while Lexer.Pos ~= Lexer.End and GET_LEXER_CHAR(Lexer) ~= '\n' do
LEXER_INC(Lexer)
end
end
function LexScanGetToken(pc, Lexer, InitValue)
local ThisChar, NextChar
local GotToken = LexToken.TokenNone
local Value = InitValue
if Lexer.EmitExtraNewlines > 0 then
Lexer.EmitExtraNewlines = Lexer.EmitExtraNewlines - 1
return LexToken.TokenEndOfLine, Value
end
repeat
LexResetLexValue(pc)
Value = pc.LexValue
while Lexer.Pos ~= Lexer.End and IsSpace(GET_LEXER_CHAR(Lexer)) do
if GET_LEXER_CHAR(Lexer) == '\n' then
Lexer.Line = Lexer.Line + 1
Lexer.Pos = Lexer.Pos + 1
Lexer.Mode = LexMode.LexModeNormal
Lexer.CharacterPos = 0
return LexToken.TokenEndOfLine, Value
elseif (Lexer.Mode == LexMode.LexModeHashDefine or
Lexer.Mode == LexMode.LexModeHashDefineSpace) then
Lexer.Mode = LexMode.LexModeHashDefineSpace
elseif Lexer.Mode == LexMode.LexModeHashDefineSpaceIdent then
Lexer.Mode = LexMode.LexModeNormal
end
LEXER_INC(Lexer)
end
--print(Lexer.Pos)
if Lexer.Pos == Lexer.End or GET_LEXER_CHAR(Lexer) == "" then
return LexToken.TokenEOF, Value
end
ThisChar = GET_LEXER_CHAR(Lexer)
if IsCidstart(ThisChar) then
local Result = LexGetWord(pc, Lexer, Value)
return Result, Value
end
if IsDigit(ThisChar) then
local Result = LexGetNumber(pc, Lexer, Value)
return Result, Value
end
if Lexer.Pos + 1 ~= Lexer.End then
NextChar = GET_LEXER_CHAR_AT(Lexer, Lexer.Pos + 1)
else
NextChar = '\0'
end
LEXER_INC(Lexer)
if ThisChar == '"' then
GotToken = LexGetStringConstant(pc, Lexer, Value, '"')
elseif ThisChar == "'" then
GotToken = LexGetCharacterConstant(pc, Lexer, Value)
elseif ThisChar == '(' then
if Lexer.Mode == LexMode.LexModeHashDefineSpaceIdent then
GotToken = LexToken.TokenOpenMacroBracket
else
GotToken = LexToken.TokenOpenBracket
end
Lexer.Mode = LexMode.LexModeNormal
elseif ThisChar == ')' then
GotToken = LexToken.TokenCloseBracket
elseif ThisChar == '=' then
GotToken = NEXTIS('=', LexToken.TokenEqual, LexToken.TokenAssign, NextChar, Lexer)
elseif ThisChar == '+' then
GotToken = NEXTIS3('=', LexToken.TokenAddAssign, '+',
LexToken.TokenIncrement, LexToken.TokenPlus, NextChar, Lexer)
elseif ThisChar == '-' then
GotToken = NEXTIS4('=', LexToken.TokenSubtractAssign, '>',
LexToken.TokenArrow, '-', LexToken.TokenDecrement, LexToken.TokenMinus, NextChar, Lexer)
elseif ThisChar == '*' then
GotToken = NEXTIS('=', LexToken.TokenMultiplyAssign, LexToken.TokenAsterisk, NextChar, Lexer)
elseif ThisChar == '/' then
if NextChar == '/' or NextChar == '*' then
LEXER_INC(Lexer)
LexSkipComment(Lexer, NextChar)
else
GotToken = NEXTIS('=', LexToken.TokenDivideAssign, LexToken.TokenSlash, NextChar, Lexer)
end
elseif ThisChar == '%' then
GotToken = NEXTIS('=', LexToken.TokenModulusAssign, LexToken.TokenModulus, NextChar, Lexer)
elseif ThisChar == '<' then
if Lexer.Mode == LexMode.LexModeHashInclude then
GotToken = LexGetStringConstant(pc, Lexer, Value, '>')
else
GotToken = NEXTIS3PLUS('=', LexToken.TokenLessEqual, '<', LexToken.TokenShiftLeft, '=',
LexToken.TokenShiftLeftAssign, LexToken.TokenLessThan, NextChar, Lexer)
end
elseif ThisChar == '>' then
GotToken = NEXTIS3PLUS('=', LexToken.TokenGreaterEqual, '>', LexToken.TokenShiftRight, '=',
LexToken.TokenShiftRightAssign, LexToken.TokenGreaterThan, NextChar, Lexer)
elseif ThisChar == ';' then
GotToken = LexToken.TokenSemicolon
elseif ThisChar == '&' then
GotToken = NEXTIS3('=', LexToken.TokenArithmeticAndAssign, '&', LexToken.TokenLogicalAnd,
LexToken.TokenAmpersand, NextChar, Lexer)
elseif ThisChar == '|' then
GotToken = NEXTIS3('=', LexToken.TokenArithmeticOrAssign, '|', LexToken.TokenLogicalOr,
LexToken.TokenArithmeticOr, NextChar, Lexer)
elseif ThisChar == '{' then
GotToken = LexToken.TokenLeftBrace
elseif ThisChar == '}' then
GotToken = LexToken.TokenRightBrace
elseif ThisChar == '[' then
GotToken = LexToken.TokenLeftSquareBracket
elseif ThisChar == ']' then
GotToken = LexToken.TokenRightSquareBracket
elseif ThisChar == '!' then
GotToken = NEXTIS('=', LexToken.TokenNotEqual, LexToken.TokenUnaryNot, NextChar, Lexer)
elseif ThisChar == '^' then
GotToken = NEXTIS('=', LexToken.TokenArithmeticExorAssign, LexToken.TokenArithmeticExor,
NextChar, Lexer)
elseif ThisChar == '~' then
GotToken = LexToken.TokenUnaryExor
elseif ThisChar == ',' then
GotToken = LexToken.TokenComma
elseif ThisChar == '.' then
GotToken = NEXTISEXACTLY3('.', '.', LexToken.TokenEllipsis,
LexToken.TokenDot, NextChar, Lexer)
elseif ThisChar == '?' then
GotToken = LexToken.TokenQuestionMark
elseif ThisChar == ':' then
GotToken = LexToken.TokenColon
elseif ThisChar == '\\' then
if NextChar == ' ' or NextChar == '\n' then
LEXER_INC(Lexer)
LexSkipLineCont(Lexer, NextChar)
else
LexFail(pc, Lexer, "illegal character '%c'", ThisChar)
end
else
LexFail(pc, Lexer, "illegal character '%c'", ThisChar)
end
until GotToken ~= LexToken.TokenNone
return GotToken, Value
end
-- Return value of this function is disregarded:
-- just indicates a token has value if it does not return 0
function LexTokenSize(Token)
if Token == LexToken.TokenIdentifier or Token == LexToken.TokenStringConstant then
return 4
elseif Token == LexToken.TokenIntegerConstant then
return 4
elseif Token == LexToken.TokenCharacterConstant then
return 1
elseif Token == LexToken.TokenFPConstant then
return 8
else
return 0
end
end
function LexTokenize(pc, Lexer)
local MemUsed = 0
local ValueSize
local LastCharacterPos = 0
local HeapMem
--local TokenSpace = HeapAllocStack(pc)
local TokenSpace = {}
local Token
local GotValue
local TokenPos = 1
local TokenLen
if TokenSpace == nil then
LexFail(pc, Lexer, "(LexTokenize TokenSpace == NULL) out of memory")
end
repeat
Token, GotValue = LexScanGetToken(pc, Lexer, GotValue)
--if Debug then
-- io.write("" .. Token .. " ")
--end
TokenSpace[TokenPos] = Token
TokenPos = TokenPos + 1
MemUsed = MemUsed + 1
-- Confine to 0xFF
TokenSpace[TokenPos] = LastCharacterPos % 0x100
TokenPos = TokenPos + 1
MemUsed = MemUsed + 1
ValueSize = LexTokenSize(Token)
if ValueSize > 0 then
if Token == LexToken.TokenIdentifier then
TokenSpace[TokenPos] = GotValue.Val
else
TokenSpace[TokenPos] = PointerCopyAllValues(GotValue.Val, true)
TokenSpace[TokenPos].RawValue.Val =
string.sub(TokenSpace[TokenPos].RawValue.Val, 1, ValueSize)
end
TokenPos = TokenPos + 1
MemUsed = MemUsed + 1
end
LastCharacterPos = Lexer.CharacterPos
until Token == LexToken.TokenEOF
--[[
HeapMem = {}
if HeapMem == nil then
LexFail(pc, Lexer, "(LexTokenize HeapMem == NULL) out of memory")
end
for k in pairs(TokenSpace) do
HeapMem[k] = TokenSpace[k]
end
HeapPopStack(pc, 1, TokenSpace.StackId - 1)
--]]
TokenLen = MemUsed
--return HeapMem, TokenLen
return TokenSpace, TokenLen
end
function LexAnalyse(pc, FileName, Source, SourceLen)
local Lexer = {}
Lexer.Pos = 1
Lexer.End = 1 + SourceLen
Lexer.Line = 1
Lexer.FileName = FileName
Lexer.Mode = LexMode.LexModeNormal
Lexer.EmitExtraNewlines = 0
Lexer.CharacterPos = 1
Lexer.SourceText = Source
return LexTokenize(pc, Lexer)
end
function LexInitParser(Parser, pc, SourceText, TokenSource, FileName, RunIt, EnableDebugger)
Parser.pc = pc
Parser.ParsingTokens = TokenSource
Parser.Pos = 1
Parser.Line = 1
Parser.FileName = FileName
if RunIt then
Parser.Mode = RunMode.RunModeRun
else
Parser.Mode = RunMode.RunModeSkip
end
Parser.SearchLabel = 0
Parser.HashIfLevel = 0
Parser.HashIfEvaluateToLevel = 0
Parser.CharacterPos = 0
Parser.SourceText = SourceText
Parser.DebugMode = EnableDebugger
end
function LexGetRawToken(Parser, InitValue, IncPos)
local ValueSize
local Prompt
local Token = LexToken.TokenNone
local pc = Parser.pc
local Value = InitValue
repeat
if Parser.ParsingTokens == nil and pc.InteractiveHead ~= nil then
Parser.ParsingTokens = pc.InteractiveHead.Tokens
Parser.Pos = 1
end
if Parser.FileName ~= pc.StrEmpty or pc.InteractiveHead ~= nil then
Token = GET_PARSING(Parser)
while Token == LexToken.TokenEndOfLine do
Parser.Line = Parser.Line + 1
Parser.Pos = Parser.Pos + TOKEN_DATA_OFFSET
Token = GET_PARSING(Parser)
end
end
-- If block will not be executed if interactive is off
if (Parser.FileName == pc.StrEmpty and
(pc.InteractiveHead == nil or Token == LexToken.TokenEOF)) then
local LineBuffer
local LineTokens
local LineBytes
local LineNode
if (pc.InteractiveHead == nil or (
Parser.ParsingTokens == pc.InteractiveTail.Tokens and
Parser.Pos == pc.InteractiveTail.NumBytes - TOKEN_DATA_OFFSET + 1)) then
if pc.LexUseStatementPrompt then
Prompt = INTERACTIVE_PROMPT_STATEMENT
pc.LexUseStatementPrompt = false
else
Prompt = INTERACTIVE_PROMPT_LINE
end
LineBuffer = PlatformGetLine(LINEBUFFER_MAX, Prompt)
if LineBuffer == nil then
return LexToken.TokenEOF, Value
end
LineTokens, LineBytes = LexAnalyse(pc, pc.StrEmpty, LineBuffer,
string.len(LineBuffer))
LineNode = VariableAlloc(pc, Parser, true)
LineNode.Tokens = LineTokens
LineNode.NumBytes = LineBytes
if pc.InteractiveHead == nil then
pc.InteractiveHead = LineNode
Parser.Line = 1
Parser.CharacterPos = 0
else
pc.InteractiveTail.Next = LineNode
end
pc.InteractiveTail = LineNode
pc.InteractiveCurrentLine = LineNode
Parser.ParsingTokens = LineTokens
Parser.Pos = 1
else
if (Parser.ParsingTokens ~= pc.InteractiveCurrentLine.Tokens or
Parser.Pos ~= pc.InteractiveCurrentLine.NumBytes - TOKEN_DATA_OFFSET + 1) then
pc.InteractiveCurrentLine = pc.InteractiveHead
while (Parser.ParsingTokens ~= pc.InteractiveCurrentLine.Tokens or
Parser.Pos ~= pc.InteractiveCurrentLine.NumBytes - TOKEN_DATA_OFFSET + 1) do
assert(pc.InteractiveCurrentLine.Next ~= nil, "LexGetRawToken: Next of InteractiveCurrentLine is nil")
pc.InteractiveCurrentLine = pc.InteractiveCurrentLine.Next
end
end
assert(pc.InteractiveCurrentLine ~= nil, "LexGetRawToken: InteractiveCurrentLine is nil")
pc.InteractiveCurrentLine = pc.InteractiveCurrentLine.Next
assert(pc.InteractiveCurrentLine ~= nil, "LexGetRawToken: InteractiveCurrentLine is nil")
Parser.ParsingTokens = pc.InteractiveCurrentLine.Tokens
Parser.Pos = 1
end
Token = GET_PARSING(Parser)
end
until not ((Parser.FileName == pc.StrEmpty and Token == LexToken.TokenEOF) or
Token == LexToken.TokenEndOfLine)
Parser.CharacterPos = GET_PARSING_AT(Parser, Parser.Pos + 1)
ValueSize = LexTokenSize(Token)
if ValueSize > 0 then
--if Value ~= nil then
if true then
if Token == LexToken.TokenStringConstant then
pc.LexValue.Typ = pc.CharPtrType
elseif Token == LexToken.TokenIdentifier then
pc.LexValue.Typ = nil
elseif Token == LexToken.TokenIntegerConstant then
pc.LexValue.Typ = pc.LongType
elseif Token == LexToken.TokenCharacterConstant then
pc.LexValue.Typ = pc.CharType
elseif Token == LexToken.TokenFPConstant then
pc.LexValue.Typ = pc.FPType
end
local LexValueVal = GET_PARSING_AT(Parser, Parser.Pos + TOKEN_DATA_OFFSET)
if Token == LexToken.TokenIdentifier then
pc.LexValue.Val = LexValueVal
else
pc.LexValue.Val = PointerCopyAllValues(LexValueVal, true)
end
pc.LexValue.ValOnHeap = false
pc.LexValue.ValOnStack = false
pc.LexValue.IsLValue = false
pc.LexValue.LValueFrom = nil
Value = pc.LexValue
end
if IncPos then
Parser.Pos = Parser.Pos + 1 + TOKEN_DATA_OFFSET
end
else
if IncPos and Token ~= LexToken.TokenEOF then
Parser.Pos = Parser.Pos + TOKEN_DATA_OFFSET
end
end
assert(Token >= LexToken.TokenNone and Token <= LexToken.TokenEndOfFunction, "LexGetRawToken: Function ends with illegal token")
return Token, Value
end
function LexHashIncPos(Parser, IncPos)
if not IncPos then
LexGetRawToken(Parser, nil, true)
end
end
function LexHashIfdef(Parser, IfNot)
local IsDefined
local IdentValue
local SavedValue
local Token
Token, IdentValue = LexGetRawToken(Parser, IdentValue, true)
if Token ~= LexToken.TokenIdentifier then
ProgramFail(Parser, "identifier expected")
end
IsDefined, SavedValue, _, _, _ = TableGet(Parser.pc.GlobalTable, IdentValue.Val) -- Changed from IdentValue.Val.Identifier
if (Parser.HashIfEvaluateToLevel == Parser.HashIfLevel and
((IsDefined and not IfNot) or (not IsDefined and IfNot))) then
Parser.HashIfEvaluateToLevel = Parser.HashIfEvaluateToLevel + 1
end
Parser.HashIfLevel = Parser.HashIfLevel + 1
end
function LexHashIf(Parser)
local IdentValue
local SavedValue
local MacroParser = {}
local Token
Token, IdentValue = LexGetRawToken(Parser, IdentValue, true)
if Token == LexToken.TokenIdentifier then
local Success
Success, SavedValue, _, _, _ = TableGet(Parser.pc.GlobalTable, IdentValue.Val) -- Changed from IdentValue.Val.Identifier
if not Success then
ProgramFail(Parser, "'%s' is undefined", IdentValue.Val.RawValue.Val) -- Changed from IdentValue.Val.Identifier
end
if SavedValue.Typ.Base ~= BaseType.TypeMacro then
ProgramFail(Parser, "value expected")
end
ParserCopy(MacroParser, SavedValue.Val.MacroDef.Body)
Token, IdentValue = LexGetRawToken(MacroParser, IdentValue, true)
end
if Token ~= LexToken.TokenCharacterConstant and Token ~= LexToken.TokenIntegerConstant then
ProgramFail(Parser, "value expected")
end
local Cond = C_INT_TO_LUA_BOOLEAN(PointerGetSignedChar(IdentValue.Val))
if Parser.HashIfEvaluateToLevel == Parser.HashIfLevel and Cond then
Parser.HashIfEvaluateToLevel = Parser.HashIfEvaluateToLevel + 1
end
Parser.HashIfLevel = Parser.HashIfLevel + 1
end
function LexHashElse(Parser)
if Parser.HashIfEvaluateToLevel == Parser.HashIfLevel - 1 then
Parser.HashIfEvaluateToLevel = Parser.HashIfEvaluateToLevel + 1
elseif Parser.HashIfEvaluateToLevel == Parser.HashIfLevel then
if Parser.HashIfLevel == 0 then
ProgramFail(Parser, "#else without #if")
end
Parser.HashIfEvaluateToLevel = Parser.HashIfEvaluateToLevel - 1
end
end
function LexHashEndif(Parser)
if Parser.HashIfLevel == 0 then
ProgramFail(Parser, "#endif without #if")
end
Parser.HashIfLevel = Parser.HashIfLevel - 1
if Parser.HashIfEvaluateToLevel > Parser.HashIfLevel then
Parser.HashIfEvaluateToLevel = Parser.HashIfLevel
end
end
function LexGetToken(Parser, InitValue, IncPos)
local TryNextToken
local Token
local Value = InitValue
repeat
local WasPreProcToken = true
Token, Value = LexGetRawToken(Parser, Value, IncPos)
if Token == LexToken.TokenHashIfdef then
LexHashIncPos(Parser, IncPos)
LexHashIfdef(Parser, false)
elseif Token == LexToken.TokenHashIfndef then
LexHashIncPos(Parser, IncPos)
LexHashIfdef(Parser, true)
elseif Token == LexToken.TokenHashIf then
LexHashIncPos(Parser, IncPos)
LexHashIf(Parser)
elseif Token == LexToken.TokenHashElse then
LexHashIncPos(Parser, IncPos)
LexHashElse(Parser)
elseif Token == LexToken.TokenHashEndif then
LexHashIncPos(Parser, IncPos)
LexHashEndif(Parser)
else
WasPreProcToken = false
end
TryNextToken = ((Parser.HashIfEvaluateToLevel < Parser.HashIfLevel and
Token ~= LexToken.TokenEOF) or WasPreProcToken)
if not IncPos and TryNextToken then
LexGetRawToken(Parser, nil, true)
end
until not TryNextToken
return Token, Value
end
function LexRawPeekToken(Parser)
return GET_PARSING(Parser)
end
function LexToEndOfMacro(Parser)
local isContinued = false
while true do
local Token = GET_PARSING(Parser)
if Token == LexToken.TokenEOF then
return
elseif Token == LexToken.TokenEndOfLine then
if not isContinued then
return
end
isContinued = false
end
if Token == LexToken.TokenBackSlash then
isContinued = true
end
LexGetRawToken(Parser, nil, true)
end
end
function LexCopyTokens(StartParser, EndParser)
local EndPos
local ParsingTokens = StartParser.ParsingTokens
local EndParsingTokens = EndParser.ParsingTokens
local NewTokens
local ILine
local pc = StartParser.pc
if pc.InteractiveHead == nil then
NewTokens = {}
for i = StartParser.Pos, EndParser.Pos - 1 do
table.insert(NewTokens, ParsingTokens[i])
end
else
pc.InteractiveCurrentLine = pc.InteractiveHead
while (pc.InteractiveCurrentLine ~= nil and
ParsingTokens ~= pc.InteractiveCurrentLine.Tokens) do
pc.InteractiveCurrentLine = pc.InteractiveCurrentLine.Next
end
if EndParsingTokens == ParsingTokens then
NewTokens = {}
for i = StartParser.Pos, EndParser.Pos - 1 do
table.insert(NewTokens, ParsingTokens[i])
end
else
EndPos = pc.InteractiveCurrentLine.NumBytes - TOKEN_DATA_OFFSET + 1
NewTokens = {}
for i = StartParser.Pos, EndPos - 1 do
table.insert(NewTokens, ParsingTokens[i])
end
ILine = pc.InteractiveCurrentLine.Next
while ILine ~= nil and EndParsingTokens ~= ILine.Tokens do
for i = 1, ILine.NumBytes - TOKEN_DATA_OFFSET do
table.insert(NewTokens, ILine.Tokens[i])
end
ILine = ILine.Next
end
assert(ILine ~= nil, "LexCopyTokens: ILine is null")
for i = 1, EndParser.Pos - 1 do
table.insert(NewTokens, ILine.Tokens[i])
end
end
end
table.insert(NewTokens, LexToken.TokenEndOfFunction)
table.insert(NewTokens, 0)
return NewTokens
end
function LexInteractiveClear(pc, Parser)
while pc.InteractiveHead ~= nil do
pc.InteractiveHead = pc.InteractiveHead.Next
end
if Parser ~= nil then
Parser.ParsingTokens = nil
end
pc.InteractiveTail = nil
collectgarbage()
end
function LexInteractiveCompleted(pc, Parser)
while (pc.InteractiveHead ~= nil and
Parser.ParsingTokens ~= pc.InteractiveHead.Tokens) do
pc.InteractiveHead = pc.InteractiveHead.Next
if pc.InteractiveHead == nil then
Parser.ParsingTokens = nil
pc.InteractiveTail = nil
end
end
collectgarbage()
end
function LexInteractiveStatementPrompt(pc)
pc.LexUseStatementPrompt = true
end
|
-- WIP flowfield example (use build v304 or later)
b = BinooAPI
b:ClearObjects()
b:DebugMode(true)
b:PhotoSphere_HideSpheres()
id = "flowfield"
-- params: id, arraySize (x*x*x), worldSize (in meters, not used yet)
size = 5
b:CreateFlowField(id,size,0)
targetid = "sphere"
sx = 2.5
sy = 0
sz = 0
b:CreateSphere(targetid,0.4,sx,sy,sz)
b:SetColor(targetid,255,0,0)
b:AddGazeTarget(targetid)
b:AddEvent(targetid,"CLICK","ClickRed")
function ClickRed()
b:ShowMessage("Clicked red")
b:SetPlayerPosition(sx,sy,sz)
end
targetid2 = "sphere2"
sx2 = -2.5
sy2 = 0
sz2 = 0
b:CreateSphere(targetid2,0.4,sx2,sy2,sz2)
b:SetColor(targetid2,0,0,255)
b:AddGazeTarget(targetid2)
b:AddEvent(targetid2,"CLICK","ClickBlue")
function ClickBlue()
b:ShowMessage("Clicked blue")
b:SetPlayerPosition(sx2,sy2,sz2)
end
--b:Log("here")
-- params: id, indexX, indexY, indexZ, length
for z=0, size-1 do
for y=0, size-1 do
for x=0, size-1 do
-- get distance to sphere for this cell
dist = b:GetDistance(x-size/2,y-size/2,z-size/2,sx,sy,sz)
dist2 = b:GetDistance(x-size/2,y-size/2,z-size/2,sx2,sy2,sz2)
-- get closest object
targetpoint = targetid2
targetdist = dist2
if (dist<dist2) then
targetpoint = targetid
targetdist = dist
end
-- get angle towards sphere from this cell
b:SetFlowFieldCellRotationTowards(id,targetpoint,x,y,z,true)
b:SetFlowFieldCellLength(id,x,y,z,targetdist*0.2)
-- color by distance to target
nearcolor={255,0,0,255}
farcolor={0,255,0,255}
b:SetCellColorFromDistanceToObject(id,targetpoint,x,y,z,nearcolor,farcolor)
end
end
end
-- scale flowfield
--b:ScaleObject(id,2,2,2)
--make sphere follow the field movement (by parenting it) if need to move
--b:SetParent(targetid,id)
-- init mainloop
return function()
-- wait x secs
coroutine.yield(5)
-- main loop
while true do
coroutine.yield(0.16)
end
end
|
local cube = dofile("include/pageCube.lua")
return function (page, offset, screen_width, screen_height)
local percent = math.abs(offset/page.width)
local x, z, angle = cube(page, offset, false)
local threshold = math.abs(math.atan((PERSPECTIVE_DISTANCE - z)/x))
angle = math.abs(angle)
if angle > threshold then
page.alpha = 1 - (angle - threshold)/(math.pi/2 - threshold)
else
page.alpha = 1
end
end
|
local oreburgh_0 = DoorSlot("oreburgh","0")
local oreburgh_0_hub = DoorSlotHub("oreburgh","0",oreburgh_0)
oreburgh_0:setHubIcon(oreburgh_0_hub)
local oreburgh_1 = DoorSlot("oreburgh","1")
local oreburgh_1_hub = DoorSlotHub("oreburgh","1",oreburgh_1)
oreburgh_1:setHubIcon(oreburgh_1_hub)
local oreburgh_2 = DoorSlot("oreburgh","2")
local oreburgh_2_hub = DoorSlotHub("oreburgh","2",oreburgh_2)
oreburgh_2:setHubIcon(oreburgh_2_hub)
local oreburgh_3 = DoorSlot("oreburgh","3")
local oreburgh_3_hub = DoorSlotHub("oreburgh","3",oreburgh_3)
oreburgh_3:setHubIcon(oreburgh_3_hub)
local oreburgh_4 = DoorSlot("oreburgh","4")
local oreburgh_4_hub = DoorSlotHub("oreburgh","4",oreburgh_4)
oreburgh_4:setHubIcon(oreburgh_4_hub)
local oreburgh_5 = DoorSlot("oreburgh","5")
local oreburgh_5_hub = DoorSlotHub("oreburgh","5",oreburgh_5)
oreburgh_5:setHubIcon(oreburgh_5_hub)
local oreburgh_6 = DoorSlot("oreburgh","6")
local oreburgh_6_hub = DoorSlotHub("oreburgh","6",oreburgh_6)
oreburgh_6:setHubIcon(oreburgh_6_hub)
local oreburgh_7 = DoorSlot("oreburgh","7")
local oreburgh_7_hub = DoorSlotHub("oreburgh","7",oreburgh_7)
oreburgh_7:setHubIcon(oreburgh_7_hub)
local oreburgh_8 = DoorSlot("oreburgh","8")
local oreburgh_8_hub = DoorSlotHub("oreburgh","8",oreburgh_8)
oreburgh_8:setHubIcon(oreburgh_8_hub)
local oreburgh_9 = DoorSlot("oreburgh","9")
local oreburgh_9_hub = DoorSlotHub("oreburgh","9",oreburgh_9)
oreburgh_9:setHubIcon(oreburgh_9_hub)
local oreburgh_10 = DoorSlot("oreburgh","10")
local oreburgh_10_hub = DoorSlotHub("oreburgh","10",oreburgh_10)
oreburgh_10:setHubIcon(oreburgh_10_hub)
local oreburgh_11 = DoorSlot("oreburgh","11")
local oreburgh_11_hub = DoorSlotHub("oreburgh","11",oreburgh_11)
oreburgh_11:setHubIcon(oreburgh_11_hub)
local oreburgh_12 = DoorSlot("oreburgh","12")
local oreburgh_12_hub = DoorSlotHub("oreburgh","12",oreburgh_12)
oreburgh_12:setHubIcon(oreburgh_12_hub)
local oreburgh_13 = DoorSlot("oreburgh","13")
local oreburgh_13_hub = DoorSlotHub("oreburgh","13",oreburgh_13)
oreburgh_13:setHubIcon(oreburgh_13_hub)
local oreburgh_14 = DoorSlot("oreburgh","14")
local oreburgh_14_hub = DoorSlotHub("oreburgh","14",oreburgh_14)
oreburgh_14:setHubIcon(oreburgh_14_hub)
|
CameraMode = {}
---@type number
CameraMode.FPSOnly = 1
---@type number
CameraMode.TPSOnly = 2
---@type number
CameraMode.FPSTPS = 0
|
local printit = {}
function printit.setup_scr_printit(ui)
--Write codes printit
ui.printit = lvgl.obj_create(nil, nil);
--Write codes printit_cont0
ui.printit_cont0 = lvgl.cont_create(ui.printit, nil);
--Write style lvgl.CONT_PART_MAIN for printit_cont0
-- local style_printit_cont0_main;
-- lvgl.style_init(style_printit_cont0_main);
local style_printit_cont0_main = lvgl.style_create()
--Write style state: lvgl.STATE_DEFAULT for style_printit_cont0_main
lvgl.style_set_radius(style_printit_cont0_main, lvgl.STATE_DEFAULT, 0);
lvgl.style_set_bg_color(style_printit_cont0_main, lvgl.STATE_DEFAULT, lvgl.color_make(0xd2, 0x00, 0x00));
lvgl.style_set_bg_grad_color(style_printit_cont0_main, lvgl.STATE_DEFAULT, lvgl.color_make(0xd2, 0x00, 0x00));
lvgl.style_set_bg_grad_dir(style_printit_cont0_main, lvgl.STATE_DEFAULT, lvgl.GRAD_DIR_VER);
lvgl.style_set_bg_opa(style_printit_cont0_main, lvgl.STATE_DEFAULT, 255);
lvgl.style_set_border_color(style_printit_cont0_main, lvgl.STATE_DEFAULT, lvgl.color_make(0x99, 0x99, 0x99));
lvgl.style_set_border_width(style_printit_cont0_main, lvgl.STATE_DEFAULT, 1);
lvgl.style_set_border_opa(style_printit_cont0_main, lvgl.STATE_DEFAULT, 255);
lvgl.style_set_pad_left(style_printit_cont0_main, lvgl.STATE_DEFAULT, 0);
lvgl.style_set_pad_right(style_printit_cont0_main, lvgl.STATE_DEFAULT, 0);
lvgl.style_set_pad_top(style_printit_cont0_main, lvgl.STATE_DEFAULT, 0);
lvgl.style_set_pad_bottom(style_printit_cont0_main, lvgl.STATE_DEFAULT, 0);
lvgl.obj_add_style(ui.printit_cont0, lvgl.CONT_PART_MAIN, style_printit_cont0_main);
lvgl.obj_set_pos(ui.printit_cont0, 0, 0);
lvgl.obj_set_size(ui.printit_cont0, 480, 272);
lvgl.obj_set_click(ui.printit_cont0, false);
lvgl.cont_set_layout(ui.printit_cont0, lvgl.LAYOUT_OFF);
lvgl.cont_set_fit(ui.printit_cont0, lvgl.FIT_NONE);
--Write codes printit_btnprtitback
ui.printit_btnprtitback = lvgl.btn_create(ui.printit, nil);
--Write style lvgl.BTN_PART_MAIN for printit_btnprtitback
-- local style_printit_btnprtitback_main;
-- lvgl.style_init(style_printit_btnprtitback_main);
local style_printit_btnprtitback_main = lvgl.style_create()
--Write style state: lvgl.STATE_DEFAULT for style_printit_btnprtitback_main
lvgl.style_set_radius(style_printit_btnprtitback_main, lvgl.STATE_DEFAULT, 50);
lvgl.style_set_bg_color(style_printit_btnprtitback_main, lvgl.STATE_DEFAULT, lvgl.color_make(0xd2, 0x00, 0x00));
lvgl.style_set_bg_grad_color(style_printit_btnprtitback_main, lvgl.STATE_DEFAULT, lvgl.color_make(0xd2, 0x00, 0x00));
lvgl.style_set_bg_grad_dir(style_printit_btnprtitback_main, lvgl.STATE_DEFAULT, lvgl.GRAD_DIR_VER);
lvgl.style_set_bg_opa(style_printit_btnprtitback_main, lvgl.STATE_DEFAULT, 255);
lvgl.style_set_border_color(style_printit_btnprtitback_main, lvgl.STATE_DEFAULT, lvgl.color_make(0xff, 0xff, 0xff));
lvgl.style_set_border_width(style_printit_btnprtitback_main, lvgl.STATE_DEFAULT, 0);
lvgl.style_set_border_opa(style_printit_btnprtitback_main, lvgl.STATE_DEFAULT, 255);
lvgl.style_set_outline_color(style_printit_btnprtitback_main, lvgl.STATE_DEFAULT, lvgl.color_make(0xff, 0xff, 0xff));
lvgl.style_set_outline_opa(style_printit_btnprtitback_main, lvgl.STATE_DEFAULT, 255);
--Write style state: lvgl.STATE_FOCUSED for style_printit_btnprtitback_main
lvgl.style_set_radius(style_printit_btnprtitback_main, lvgl.STATE_FOCUSED, 50);
lvgl.style_set_bg_color(style_printit_btnprtitback_main, lvgl.STATE_FOCUSED, lvgl.color_make(0xff, 0xff, 0xff));
lvgl.style_set_bg_grad_color(style_printit_btnprtitback_main, lvgl.STATE_FOCUSED, lvgl.color_make(0xff, 0xff, 0xff));
lvgl.style_set_bg_grad_dir(style_printit_btnprtitback_main, lvgl.STATE_FOCUSED, lvgl.GRAD_DIR_VER);
lvgl.style_set_bg_opa(style_printit_btnprtitback_main, lvgl.STATE_FOCUSED, 255);
lvgl.style_set_border_color(style_printit_btnprtitback_main, lvgl.STATE_FOCUSED, lvgl.color_make(0x01, 0xa2, 0xb1));
lvgl.style_set_border_width(style_printit_btnprtitback_main, lvgl.STATE_FOCUSED, 2);
lvgl.style_set_border_opa(style_printit_btnprtitback_main, lvgl.STATE_FOCUSED, 255);
lvgl.style_set_outline_color(style_printit_btnprtitback_main, lvgl.STATE_FOCUSED, lvgl.color_make(0xd4, 0xd7, 0xd9));
lvgl.style_set_outline_opa(style_printit_btnprtitback_main, lvgl.STATE_FOCUSED, 255);
--Write style state: lvgl.STATE_PRESSED for style_printit_btnprtitback_main
lvgl.style_set_radius(style_printit_btnprtitback_main, lvgl.STATE_PRESSED, 50);
lvgl.style_set_bg_color(style_printit_btnprtitback_main, lvgl.STATE_PRESSED, lvgl.color_make(0xd2, 0x00, 0x00));
lvgl.style_set_bg_grad_color(style_printit_btnprtitback_main, lvgl.STATE_PRESSED, lvgl.color_make(0xd2, 0x00, 0x00));
lvgl.style_set_bg_grad_dir(style_printit_btnprtitback_main, lvgl.STATE_PRESSED, lvgl.GRAD_DIR_VER);
lvgl.style_set_bg_opa(style_printit_btnprtitback_main, lvgl.STATE_PRESSED, 255);
lvgl.style_set_border_color(style_printit_btnprtitback_main, lvgl.STATE_PRESSED, lvgl.color_make(0xff, 0xff, 0xff));
lvgl.style_set_border_width(style_printit_btnprtitback_main, lvgl.STATE_PRESSED, 2);
lvgl.style_set_border_opa(style_printit_btnprtitback_main, lvgl.STATE_PRESSED, 255);
lvgl.style_set_outline_color(style_printit_btnprtitback_main, lvgl.STATE_PRESSED, lvgl.color_make(0xd4, 0xd7, 0xd9));
lvgl.style_set_outline_opa(style_printit_btnprtitback_main, lvgl.STATE_PRESSED, 100);
--Write style state: lvgl.STATE_CHECKED for style_printit_btnprtitback_main
lvgl.style_set_radius(style_printit_btnprtitback_main, lvgl.STATE_CHECKED, 50);
lvgl.style_set_bg_color(style_printit_btnprtitback_main, lvgl.STATE_CHECKED, lvgl.color_make(0xff, 0xff, 0xff));
lvgl.style_set_bg_grad_color(style_printit_btnprtitback_main, lvgl.STATE_CHECKED, lvgl.color_make(0xff, 0xff, 0xff));
lvgl.style_set_bg_grad_dir(style_printit_btnprtitback_main, lvgl.STATE_CHECKED, lvgl.GRAD_DIR_VER);
lvgl.style_set_bg_opa(style_printit_btnprtitback_main, lvgl.STATE_CHECKED, 255);
lvgl.style_set_border_color(style_printit_btnprtitback_main, lvgl.STATE_CHECKED, lvgl.color_make(0x01, 0xa2, 0xb1));
lvgl.style_set_border_width(style_printit_btnprtitback_main, lvgl.STATE_CHECKED, 2);
lvgl.style_set_border_opa(style_printit_btnprtitback_main, lvgl.STATE_CHECKED, 255);
lvgl.style_set_outline_color(style_printit_btnprtitback_main, lvgl.STATE_CHECKED, lvgl.color_make(0xd4, 0xd7, 0xd9));
lvgl.style_set_outline_opa(style_printit_btnprtitback_main, lvgl.STATE_CHECKED, 255);
lvgl.obj_add_style(ui.printit_btnprtitback, lvgl.BTN_PART_MAIN, style_printit_btnprtitback_main);
lvgl.obj_set_pos(ui.printit_btnprtitback, 179, 205);
lvgl.obj_set_size(ui.printit_btnprtitback, 134, 39);
ui.printit_btnprtitback_label = lvgl.label_create(ui.printit_btnprtitback, nil);
lvgl.label_set_text(ui.printit_btnprtitback_label, "返回");
lvgl.obj_set_style_local_text_color(ui.printit_btnprtitback_label, lvgl.LABEL_PART_MAIN, lvgl.STATE_DEFAULT, lvgl.color_make(0xff, 0xff, 0xff));
lvgl.obj_set_style_local_text_font(ui.printit_btnprtitback_label, lvgl.LABEL_PART_MAIN, lvgl.STATE_DEFAULT, lvgl.font_get("opposans_m_14"));
--Write codes printit_label2
ui.printit_label2 = lvgl.label_create(ui.printit, nil);
lvgl.label_set_text(ui.printit_label2, "无互联网连接");
lvgl.label_set_long_mode(ui.printit_label2, lvgl.LABEL_LONG_BREAK);
lvgl.label_set_align(ui.printit_label2, lvgl.LABEL_ALIGN_CENTER);
--Write style lvgl.LABEL_PART_MAIN for printit_label2
-- local style_printit_label2_main;
-- lvgl.style_init(style_printit_label2_main);
local style_printit_label2_main = lvgl.style_create()
--Write style state: lvgl.STATE_DEFAULT for style_printit_label2_main
lvgl.style_set_radius(style_printit_label2_main, lvgl.STATE_DEFAULT, 0);
lvgl.style_set_bg_color(style_printit_label2_main, lvgl.STATE_DEFAULT, lvgl.color_make(0xd2, 0x00, 0x00));
lvgl.style_set_bg_grad_color(style_printit_label2_main, lvgl.STATE_DEFAULT, lvgl.color_make(0xd2, 0x00, 0x00));
lvgl.style_set_bg_grad_dir(style_printit_label2_main, lvgl.STATE_DEFAULT, lvgl.GRAD_DIR_VER);
lvgl.style_set_bg_opa(style_printit_label2_main, lvgl.STATE_DEFAULT, 255);
lvgl.style_set_text_color(style_printit_label2_main, lvgl.STATE_DEFAULT, lvgl.color_make(0xff, 0xff, 0xff));
lvgl.style_set_text_font(style_printit_label2_main, lvgl.STATE_DEFAULT, lvgl.font_get("opposans_m_18"));
lvgl.style_set_text_letter_space(style_printit_label2_main, lvgl.STATE_DEFAULT, 2);
lvgl.style_set_pad_left(style_printit_label2_main, lvgl.STATE_DEFAULT, 0);
lvgl.style_set_pad_right(style_printit_label2_main, lvgl.STATE_DEFAULT, 0);
lvgl.style_set_pad_top(style_printit_label2_main, lvgl.STATE_DEFAULT, 0);
lvgl.style_set_pad_bottom(style_printit_label2_main, lvgl.STATE_DEFAULT, 0);
lvgl.obj_add_style(ui.printit_label2, lvgl.LABEL_PART_MAIN, style_printit_label2_main);
lvgl.obj_set_pos(ui.printit_label2, 10, 146);
lvgl.obj_set_size(ui.printit_label2, 460, 0);
--Write codes printit_printer
ui.printit_printer = lvgl.img_create(ui.printit, nil);
--Write style lvgl.IMG_PART_MAIN for printit_printer
-- local style_printit_printer_main;
-- lvgl.style_init(style_printit_printer_main);
local style_printit_printer_main = lvgl.style_create()
--Write style state: lvgl.STATE_DEFAULT for style_printit_printer_main
lvgl.style_set_image_recolor(style_printit_printer_main, lvgl.STATE_DEFAULT, lvgl.color_make(0xff, 0xff, 0xff));
lvgl.style_set_image_recolor_opa(style_printit_printer_main, lvgl.STATE_DEFAULT, 0);
lvgl.style_set_image_opa(style_printit_printer_main, lvgl.STATE_DEFAULT, 255);
lvgl.obj_add_style(ui.printit_printer, lvgl.IMG_PART_MAIN, style_printit_printer_main);
lvgl.obj_set_pos(ui.printit_printer, 154, 70);
lvgl.obj_set_size(ui.printit_printer, 60, 55);
lvgl.obj_set_click(ui.printit_printer, true);
lvgl.img_set_src(ui.printit_printer,"/images/printer2_alpha_60x55.png");
lvgl.img_set_pivot(ui.printit_printer, 0,0);
lvgl.img_set_angle(ui.printit_printer, 0);
--Write codes printit_imgnotit
ui.printit_imgnotit = lvgl.img_create(ui.printit, nil);
--Write style lvgl.IMG_PART_MAIN for printit_imgnotit
-- local style_printit_imgnotit_main;
-- lvgl.style_init(style_printit_imgnotit_main);
local style_printit_imgnotit_main = lvgl.style_create()
--Write style state: lvgl.STATE_DEFAULT for style_printit_imgnotit_main
lvgl.style_set_image_recolor(style_printit_imgnotit_main, lvgl.STATE_DEFAULT, lvgl.color_make(0xff, 0xff, 0xff));
lvgl.style_set_image_recolor_opa(style_printit_imgnotit_main, lvgl.STATE_DEFAULT, 0);
lvgl.style_set_image_opa(style_printit_imgnotit_main, lvgl.STATE_DEFAULT, 255);
lvgl.obj_add_style(ui.printit_imgnotit, lvgl.IMG_PART_MAIN, style_printit_imgnotit_main);
lvgl.obj_set_pos(ui.printit_imgnotit, 217, 62);
lvgl.obj_set_size(ui.printit_imgnotit, 25, 25);
lvgl.obj_set_click(ui.printit_imgnotit, true);
lvgl.img_set_src(ui.printit_imgnotit,"/images/no_internet_alpha_25x25.png");
lvgl.img_set_pivot(ui.printit_imgnotit, 0,0);
lvgl.img_set_angle(ui.printit_imgnotit, 0);
--Write codes printit_cloud
ui.printit_cloud = lvgl.img_create(ui.printit, nil);
--Write style lvgl.IMG_PART_MAIN for printit_cloud
-- local style_printit_cloud_main;
-- lvgl.style_init(style_printit_cloud_main);
local style_printit_cloud_main = lvgl.style_create()
--Write style state: lvgl.STATE_DEFAULT for style_printit_cloud_main
lvgl.style_set_image_recolor(style_printit_cloud_main, lvgl.STATE_DEFAULT, lvgl.color_make(0xff, 0xff, 0xff));
lvgl.style_set_image_recolor_opa(style_printit_cloud_main, lvgl.STATE_DEFAULT, 0);
lvgl.style_set_image_opa(style_printit_cloud_main, lvgl.STATE_DEFAULT, 255);
lvgl.obj_add_style(ui.printit_cloud, lvgl.IMG_PART_MAIN, style_printit_cloud_main);
lvgl.obj_set_pos(ui.printit_cloud, 258, 30);
lvgl.obj_set_size(ui.printit_cloud, 55, 40);
lvgl.obj_set_click(ui.printit_cloud, true);
lvgl.img_set_src(ui.printit_cloud,"/images/cloud_alpha_55x40.png");
lvgl.img_set_pivot(ui.printit_cloud, 0,0);
lvgl.img_set_angle(ui.printit_cloud, 0);
end
return printit
|
Ghost = Entity:extend()
local haunting = false
|
local lfs = require './init.lua'
local fs = require 'fs'
require('tap')(function(test)
test('lfs.mkdir should make directory', function()
lfs.mkdir('mkdir_test.d')
local stat = assert(fs.statSync 'mkdir_test.d')
assert(stat.type == 'directory', '`mkdir_test.d` is not a directory')
assert(stat.mode == 17157, 'mode is not 755')
fs.rmdirSync 'mkdir_test.d'
end)
test('lfs.rmdir should remove directory', function()
fs.mkdirSync 'rmdir_test.d'
assert(lfs.rmdir('rmdir_test.d'))
assert(not fs.existsSync 'rmdir_test.d', 'directory not removed')
end)
test('lfs.rmdir should fail on invalid path', function()
assert(not lfs.rmdir('/im_an_invalid_path'))
end)
test('lfs.chdir should change cwd', function()
local old = lfs.currentdir()
fs.mkdirSync 'test_chdir'
assert(lfs.chdir('./test_chdir'))
assert(lfs.currentdir() ~= old)
assert(lfs.chdir(old))
fs.rmdirSync './test_chdir'
end)
test('lfs.chdir same dir should do nothing', function()
local success = lfs.chdir(lfs.currentdir())
assert(success == 0)
end)
test('lfs.chdir invalid dir should return nil', function()
local success, _, err = lfs.chdir('/im_an_invalid_path')
assert(success == nil)
assert(err == 'ENOENT')
end)
test('lfs.setmode should error', function()
local success, err = pcall(lfs.setmode)
assert(not success)
assert(err:find('not implemented'))
end)
test('lfs.lock should error', function()
local success, err = pcall(lfs.lock)
assert(not success)
assert(err:find('not implemented'))
end)
test('lfs.lock_dir should error', function()
local success, err = pcall(lfs.lock_dir)
assert(not success)
assert(err:find('not implemented'))
end)
test('lfs.unlock should error', function()
local success, err = pcall(lfs.unlock)
assert(not success)
assert(err:find('not implemented'))
end)
end)
|
#!/usr/bin/lua5.1
-- Copyright (c) 2012,14,17 Breno Ramalho Lemes <breno@br-lemes.net>
-- http://www.br-lemes.net/
-- Verifica o status da conexão de internet, o IP e o tempo conectado do meu
-- roteador wireless Smart Lan APRIO150. Mostra a informação em um ícone na
-- área de notificação.
--
-- Histórico:
--
-- 27-04-2012 * Versão inicial (shell script lynx)
-- 28-10-2012 * Versão IUP Lua (wget)
-- 04-11-2012 * Versão Lua Socket
-- 11-04-2013 * Bug fix + signal
-- 10-07-2014 * IP do roteador na variável de ambiente SMARTLAN
-- 04-08-2014 * IP do roteador também como argumento
-- 06-10-2017 * Licença MIT
--
require( "iuplua" )
require("socket.http")
statusurl="http://"..(arg[1] or os.getenv("SMARTLAN") or "192.168.1.254").."/cgi-bin/status/"
socket.http.TIMEOUT = 1
local yesimg = iup.imagergba {
width = 24,
height = 24,
pixels = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 170, 3, 33, 73, 136, 77, 33, 75, 137, 132, 38, 79, 139, 196, 35, 77, 137, 242, 35, 77, 137, 242, 38, 79, 139, 196, 33, 75, 137, 132, 33, 73, 136, 77, 0, 85, 170, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 75, 137, 41, 35, 77, 138, 213, 73, 109, 155, 244, 133, 159, 157, 253, 157, 178, 178, 255, 188, 205, 184, 255, 185, 204, 197, 255, 144, 170, 205, 255, 113, 143, 186, 253, 70, 107, 159, 244, 36, 78, 138, 213, 31, 75, 137, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 2, 34, 76, 137, 121, 46, 87, 139, 244, 145, 169, 169, 254, 180, 198, 172, 255, 157, 181, 170, 255, 167, 185, 87, 255, 176, 194, 62, 255, 168, 194, 127, 255, 140, 171, 212, 255, 149, 178, 215, 255, 173, 195, 210, 255, 134, 162, 190, 254, 43, 83, 142, 244, 34, 76, 137, 121, 0, 128, 128, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 76, 137, 121, 71, 108, 151, 245, 182, 199, 158, 255, 153, 180, 174, 255, 126, 160, 159, 255, 118, 155, 189, 255, 148, 172, 82, 255, 138, 171, 172, 255, 134, 167, 181, 255, 127, 164, 210, 255, 148, 179, 151, 255, 168, 191, 98, 255, 190, 207, 117, 255, 180, 198, 171, 255, 67, 105, 157, 244, 34, 76, 137, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 75, 137, 41, 42, 82, 138, 244, 181, 197, 144, 255, 151, 176, 123, 255, 141, 170, 116, 255, 175, 195, 68, 255, 126, 161, 188, 255, 127, 162, 206, 255, 133, 168, 214, 255, 139, 172, 198, 255, 139, 171, 165, 255, 153, 182, 151, 255, 156, 183, 125, 255, 178, 198, 57, 255, 183, 199, 76, 255, 173, 192, 166, 255, 40, 82, 141, 244, 31, 75, 137, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 170, 3, 34, 77, 136, 213, 144, 167, 139, 254, 182, 197, 90, 255, 168, 187, 49, 255, 173, 192, 56, 255, 147, 175, 126, 255, 123, 159, 188, 255, 126, 163, 209, 255, 134, 169, 214, 255, 140, 174, 216, 255, 152, 180, 160, 255, 191, 210, 70, 255, 186, 205, 61, 255, 180, 199, 57, 255, 173, 192, 52, 255, 186, 201, 93, 255, 134, 160, 157, 254, 35, 77, 138, 213, 0, 85, 170, 3, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 33, 75, 134, 78, 65, 102, 147, 245, 184, 198, 112, 255, 163, 182, 46, 255, 166, 186, 52, 255, 129, 161, 140, 255, 109, 148, 197, 255, 116, 154, 203, 255, 123, 160, 208, 255, 129, 165, 211, 255, 138, 171, 202, 255, 185, 207, 99, 255, 148, 179, 158, 255, 166, 191, 102, 255, 173, 194, 71, 255, 173, 192, 52, 255, 168, 187, 50, 255, 177, 194, 130, 255, 59, 98, 152, 244, 33, 75, 134, 78, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 33, 75, 136, 133, 117, 145, 135, 253, 173, 189, 76, 255, 161, 180, 44, 255, 126, 158, 122, 255, 98, 139, 192, 255, 105, 145, 196, 255, 112, 151, 201, 255, 118, 156, 204, 255, 122, 159, 207, 255, 125, 162, 205, 255, 170, 196, 116, 255, 169, 194, 106, 255, 130, 164, 166, 255, 124, 158, 159, 255, 153, 178, 89, 255, 166, 185, 47, 255, 175, 191, 79, 255, 97, 130, 159, 252, 33, 75, 136, 133, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 34, 76, 137, 197, 146, 169, 123, 255, 125, 154, 128, 255, 94, 134, 157, 255, 89, 132, 180, 255, 94, 136, 190, 255, 100, 141, 194, 255, 106, 146, 197, 255, 111, 150, 200, 255, 114, 153, 202, 255, 158, 186, 129, 255, 192, 211, 65, 255, 188, 207, 63, 255, 183, 202, 59, 255, 178, 197, 55, 255, 157, 180, 77, 255, 165, 184, 47, 255, 140, 166, 111, 255, 131, 158, 143, 255, 34, 76, 137, 197, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 33, 75, 136, 242, 158, 179, 125, 255, 118, 150, 112, 255, 83, 126, 166, 255, 82, 126, 183, 255, 89, 132, 186, 255, 95, 137, 190, 255, 100, 141, 193, 255, 104, 144, 196, 255, 107, 146, 196, 255, 185, 205, 71, 255, 188, 207, 63, 255, 185, 204, 60, 255, 181, 200, 57, 255, 175, 194, 54, 255, 156, 179, 73, 255, 149, 173, 71, 255, 156, 175, 59, 255, 113, 147, 189, 255, 33, 75, 136, 242, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 33, 75, 136, 242, 103, 139, 181, 255, 106, 140, 124, 255, 109, 144, 115, 255, 103, 140, 139, 255, 103, 141, 151, 255, 90, 133, 183, 255, 93, 135, 189, 255, 96, 138, 191, 255, 103, 144, 184, 255, 182, 202, 64, 255, 184, 203, 60, 255, 182, 201, 58, 255, 178, 197, 55, 255, 173, 192, 52, 255, 168, 187, 48, 255, 138, 164, 82, 255, 98, 136, 145, 255, 104, 140, 186, 255, 33, 75, 136, 242, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 34, 75, 138, 196, 79, 118, 171, 255, 74, 117, 175, 255, 76, 120, 158, 255, 154, 175, 52, 255, 165, 184, 46, 255, 132, 162, 107, 255, 86, 129, 184, 255, 89, 131, 186, 255, 90, 133, 187, 255, 123, 158, 140, 255, 156, 181, 92, 255, 152, 178, 94, 255, 174, 193, 53, 255, 170, 189, 50, 255, 165, 184, 47, 255, 159, 178, 44, 255, 90, 130, 161, 255, 83, 121, 173, 255, 34, 77, 138, 196, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 33, 75, 135, 132, 62, 103, 159, 252, 74, 118, 174, 255, 82, 123, 140, 255, 157, 176, 41, 255, 162, 181, 44, 255, 166, 185, 47, 255, 139, 166, 94, 255, 95, 135, 162, 255, 82, 126, 183, 255, 83, 127, 183, 255, 82, 126, 183, 255, 88, 130, 172, 255, 168, 188, 54, 255, 167, 186, 48, 255, 162, 181, 45, 255, 115, 146, 102, 255, 79, 122, 177, 255, 64, 104, 159, 252, 33, 75, 135, 132, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 33, 73, 136, 77, 45, 86, 145, 243, 81, 123, 177, 255, 74, 117, 143, 255, 156, 175, 42, 255, 159, 178, 42, 255, 163, 182, 45, 255, 166, 185, 47, 255, 137, 165, 91, 255, 74, 120, 178, 255, 75, 120, 178, 255, 74, 120, 178, 255, 73, 118, 177, 255, 148, 173, 73, 255, 163, 182, 45, 255, 159, 178, 42, 255, 84, 125, 136, 255, 83, 125, 178, 255, 45, 86, 145, 243, 33, 73, 136, 77, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 85, 170, 3, 34, 75, 136, 213, 63, 106, 162, 253, 69, 114, 171, 255, 104, 137, 104, 255, 157, 176, 41, 255, 159, 178, 42, 255, 162, 181, 45, 255, 100, 137, 128, 255, 66, 113, 173, 255, 67, 113, 173, 255, 66, 113, 173, 255, 65, 112, 172, 255, 142, 167, 72, 255, 160, 179, 43, 255, 156, 175, 43, 255, 91, 130, 145, 255, 63, 106, 162, 253, 34, 75, 136, 213, 0, 85, 170, 3, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 75, 137, 41, 35, 76, 138, 244, 71, 114, 171, 255, 59, 106, 167, 255, 147, 169, 53, 255, 157, 176, 41, 255, 138, 162, 67, 255, 70, 114, 152, 255, 58, 106, 168, 255, 59, 106, 168, 255, 58, 106, 168, 255, 57, 105, 167, 255, 131, 158, 75, 255, 157, 176, 41, 255, 118, 150, 98, 255, 71, 114, 171, 255, 35, 76, 138, 244, 31, 75, 137, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 29, 70, 127, 130, 40, 83, 142, 244, 66, 110, 168, 255, 141, 165, 76, 255, 157, 176, 42, 255, 87, 126, 123, 255, 52, 101, 164, 255, 52, 101, 164, 255, 52, 101, 164, 255, 52, 101, 164, 255, 52, 101, 164, 255, 99, 133, 112, 255, 159, 178, 56, 255, 85, 124, 148, 255, 39, 83, 142, 245, 28, 68, 123, 135, 0, 0, 0, 18, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 19, 0, 8, 8, 32, 27, 65, 117, 142, 34, 76, 136, 246, 118, 147, 92, 254, 122, 151, 101, 255, 59, 107, 165, 255, 56, 104, 166, 255, 54, 102, 165, 255, 54, 102, 165, 255, 56, 104, 166, 255, 58, 106, 167, 255, 73, 116, 159, 255, 59, 103, 150, 254, 34, 75, 135, 247, 26, 62, 113, 147, 0, 6, 6, 42, 0, 0, 0, 30, 0, 0, 0, 19, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 19, 0, 0, 0, 30, 0, 0, 0, 40, 15, 37, 68, 83, 32, 72, 130, 223, 38, 80, 138, 246, 45, 89, 149, 253, 50, 96, 156, 255, 55, 102, 163, 255, 55, 102, 163, 255, 50, 96, 156, 255, 45, 89, 149, 253, 37, 79, 138, 247, 32, 72, 129, 225, 14, 33, 61, 91, 0, 0, 0, 50, 0, 0, 0, 40, 0, 0, 0, 30, 0, 0, 0, 19, 0, 0, 0, 3, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 17, 0, 0, 0, 27, 0, 0, 0, 35, 0, 6, 11, 45, 23, 50, 93, 112, 27, 63, 112, 159, 32, 70, 129, 210, 32, 74, 134, 245, 32, 74, 134, 245, 31, 70, 128, 211, 27, 62, 111, 161, 22, 48, 90, 116, 0, 5, 10, 52, 0, 0, 0, 43, 0, 0, 0, 35, 0, 0, 0, 26, 0, 0, 0, 11, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 12, 0, 0, 0, 18, 0, 0, 0, 23, 0, 0, 0, 27, 0, 0, 0, 31, 0, 0, 0, 32, 0, 0, 0, 29, 0, 0, 0, 25, 0, 0, 0, 21, 0, 0, 0, 15, 0, 0, 0, 8, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
},
}
local noimg = iup.imagergba {
width = 24,
height = 24,
pixels = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73, 73, 73, 3, 69, 69, 69, 77, 71, 71, 71, 132, 75, 75, 75, 196, 72, 72, 72, 242, 72, 72, 72, 242, 75, 75, 75, 196, 71, 71, 71, 132, 69, 69, 69, 77, 73, 73, 73, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 70, 70, 41, 72, 72, 72, 213, 105, 105, 105, 244, 153, 153, 153, 253, 174, 174, 174, 255, 200, 200, 200, 255, 199, 199, 199, 255, 167, 167, 167, 255, 140, 140, 140, 253, 103, 103, 103, 244, 73, 73, 73, 213, 70, 70, 70, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 101, 101, 101, 2, 71, 71, 71, 121, 82, 82, 82, 244, 164, 164, 164, 254, 192, 192, 192, 255, 175, 175, 175, 255, 174, 174, 174, 255, 181, 181, 181, 255, 184, 184, 184, 255, 167, 167, 167, 255, 175, 175, 175, 255, 191, 191, 191, 255, 158, 158, 158, 254, 79, 79, 79, 244, 71, 71, 71, 121, 101, 101, 101, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 71, 71, 71, 121, 103, 103, 103, 245, 192, 192, 192, 255, 174, 174, 174, 255, 153, 153, 153, 255, 150, 150, 150, 255, 160, 160, 160, 255, 164, 164, 164, 255, 161, 161, 161, 255, 159, 159, 159, 255, 170, 170, 170, 255, 179, 179, 179, 255, 197, 197, 197, 255, 192, 192, 192, 255, 101, 101, 101, 244, 71, 71, 71, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 70, 70, 41, 78, 78, 78, 244, 190, 190, 190, 255, 167, 167, 167, 255, 160, 160, 160, 255, 182, 182, 182, 255, 156, 156, 156, 255, 158, 158, 158, 255, 164, 164, 164, 255, 167, 167, 167, 255, 164, 164, 164, 255, 174, 174, 174, 255, 173, 173, 173, 255, 184, 184, 184, 255, 187, 187, 187, 255, 186, 186, 186, 255, 77, 77, 77, 244, 70, 70, 70, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 73, 73, 73, 3, 72, 72, 72, 213, 160, 160, 160, 254, 186, 186, 186, 255, 173, 173, 173, 255, 178, 178, 178, 255, 166, 166, 166, 255, 153, 153, 153, 255, 158, 158, 158, 255, 165, 165, 165, 255, 170, 170, 170, 255, 173, 173, 173, 255, 196, 196, 196, 255, 191, 191, 191, 255, 185, 185, 185, 255, 178, 178, 178, 255, 190, 190, 190, 255, 154, 154, 154, 254, 72, 72, 72, 213, 73, 73, 73, 3, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 70, 70, 70, 78, 97, 97, 97, 245, 189, 189, 189, 255, 168, 168, 168, 255, 172, 172, 172, 255, 153, 153, 153, 255, 143, 143, 143, 255, 149, 149, 149, 255, 156, 156, 156, 255, 161, 161, 161, 255, 166, 166, 166, 255, 195, 195, 195, 255, 171, 171, 171, 255, 179, 179, 179, 255, 181, 181, 181, 255, 178, 178, 178, 255, 173, 173, 173, 255, 186, 186, 186, 255, 94, 94, 94, 244, 70, 70, 70, 78, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 70, 70, 70, 133, 138, 138, 138, 253, 177, 177, 177, 255, 166, 166, 166, 255, 149, 149, 149, 255, 134, 134, 134, 255, 140, 140, 140, 255, 146, 146, 146, 255, 151, 151, 151, 255, 155, 155, 155, 255, 157, 157, 157, 255, 185, 185, 185, 255, 182, 182, 182, 255, 157, 157, 157, 255, 151, 151, 151, 255, 166, 166, 166, 255, 171, 171, 171, 255, 180, 180, 180, 255, 125, 125, 125, 252, 70, 70, 70, 133, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 71, 71, 71, 197, 161, 161, 161, 255, 146, 146, 146, 255, 127, 127, 127, 255, 126, 126, 126, 255, 131, 131, 131, 255, 136, 136, 136, 255, 141, 141, 141, 255, 145, 145, 145, 255, 148, 148, 148, 255, 176, 176, 176, 255, 196, 196, 196, 255, 193, 193, 193, 255, 188, 188, 188, 255, 183, 183, 183, 255, 168, 168, 168, 255, 170, 170, 170, 255, 157, 157, 157, 255, 151, 151, 151, 255, 71, 71, 71, 197, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 70, 70, 70, 242, 171, 171, 171, 255, 140, 140, 140, 255, 120, 120, 120, 255, 121, 121, 121, 255, 127, 127, 127, 255, 132, 132, 132, 255, 136, 136, 136, 255, 139, 139, 139, 255, 141, 141, 141, 255, 191, 191, 191, 255, 193, 193, 193, 255, 190, 190, 190, 255, 186, 186, 186, 255, 180, 180, 180, 255, 166, 166, 166, 255, 161, 161, 161, 255, 163, 163, 163, 255, 143, 143, 143, 255, 70, 70, 70, 242, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 70, 70, 70, 242, 134, 134, 134, 255, 132, 132, 132, 255, 134, 134, 134, 255, 132, 132, 132, 255, 134, 134, 134, 255, 127, 127, 127, 255, 130, 130, 130, 255, 133, 133, 133, 255, 138, 138, 138, 255, 188, 188, 188, 255, 189, 189, 189, 255, 187, 187, 187, 255, 183, 183, 183, 255, 178, 178, 178, 255, 173, 173, 173, 255, 153, 153, 153, 255, 129, 129, 129, 255, 136, 136, 136, 255, 70, 70, 70, 242, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 71, 71, 71, 196, 114, 114, 114, 255, 112, 112, 112, 255, 113, 113, 113, 255, 162, 162, 162, 255, 170, 170, 170, 255, 152, 152, 152, 255, 124, 124, 124, 255, 126, 126, 126, 255, 128, 128, 128, 255, 149, 149, 149, 255, 169, 169, 169, 255, 166, 166, 166, 255, 179, 179, 179, 255, 175, 175, 175, 255, 170, 170, 170, 255, 164, 164, 164, 255, 124, 124, 124, 255, 117, 117, 117, 255, 72, 72, 72, 196, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 70, 70, 70, 132, 98, 98, 98, 252, 113, 113, 113, 255, 116, 116, 116, 255, 162, 162, 162, 255, 167, 167, 167, 255, 171, 171, 171, 255, 155, 155, 155, 255, 128, 128, 128, 255, 121, 121, 121, 255, 122, 122, 122, 255, 121, 121, 121, 255, 124, 124, 124, 255, 174, 174, 174, 255, 172, 172, 172, 255, 167, 167, 167, 255, 136, 136, 136, 255, 117, 117, 117, 255, 99, 99, 99, 252, 70, 70, 70, 132, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 69, 69, 69, 77, 82, 82, 82, 243, 118, 118, 118, 255, 110, 110, 110, 255, 161, 161, 161, 255, 164, 164, 164, 255, 168, 168, 168, 255, 171, 171, 171, 255, 154, 154, 154, 255, 114, 114, 114, 255, 115, 115, 115, 255, 114, 114, 114, 255, 113, 113, 113, 255, 160, 160, 160, 255, 168, 168, 168, 255, 164, 164, 164, 255, 117, 117, 117, 255, 120, 120, 120, 255, 82, 82, 82, 243, 69, 69, 69, 77, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 73, 73, 73, 3, 71, 71, 71, 213, 101, 101, 101, 253, 109, 109, 109, 255, 128, 128, 128, 255, 162, 162, 162, 255, 164, 164, 164, 255, 167, 167, 167, 255, 128, 128, 128, 255, 107, 107, 107, 255, 108, 108, 108, 255, 107, 107, 107, 255, 106, 106, 106, 255, 155, 155, 155, 255, 165, 165, 165, 255, 161, 161, 161, 255, 123, 123, 123, 255, 101, 101, 101, 253, 71, 71, 71, 213, 73, 73, 73, 3, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 70, 70, 70, 41, 72, 72, 72, 244, 109, 109, 109, 255, 100, 100, 100, 255, 156, 156, 156, 255, 162, 162, 162, 255, 150, 150, 150, 255, 107, 107, 107, 255, 100, 100, 100, 255, 100, 100, 100, 255, 100, 100, 100, 255, 99, 99, 99, 255, 146, 146, 146, 255, 162, 162, 162, 255, 139, 139, 139, 255, 109, 109, 109, 255, 72, 72, 72, 244, 70, 70, 70, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 65, 65, 65, 130, 78, 78, 78, 244, 105, 105, 105, 255, 153, 153, 153, 255, 162, 162, 162, 255, 117, 117, 117, 255, 95, 95, 95, 255, 95, 95, 95, 255, 95, 95, 95, 255, 95, 95, 95, 255, 95, 95, 95, 255, 124, 124, 124, 255, 165, 165, 165, 255, 117, 117, 117, 255, 78, 78, 78, 245, 63, 63, 63, 135, 0, 0, 0, 18, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 19, 6, 6, 6, 32, 61, 61, 61, 142, 71, 71, 71, 246, 137, 137, 137, 254, 141, 141, 141, 255, 101, 101, 101, 255, 98, 98, 98, 255, 96, 96, 96, 255, 96, 96, 96, 255, 98, 98, 98, 255, 100, 100, 100, 255, 110, 110, 110, 255, 97, 97, 97, 254, 71, 71, 71, 247, 58, 58, 58, 147, 5, 5, 5, 42, 0, 0, 0, 30, 0, 0, 0, 19, 0, 0, 0, 8, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 19, 0, 0, 0, 30, 0, 0, 0, 40, 35, 35, 35, 83, 68, 68, 68, 223, 75, 75, 75, 246, 84, 84, 84, 253, 91, 91, 91, 255, 96, 96, 96, 255, 96, 96, 96, 255, 91, 91, 91, 255, 84, 84, 84, 253, 74, 74, 74, 247, 68, 68, 68, 225, 31, 31, 31, 91, 0, 0, 0, 50, 0, 0, 0, 40, 0, 0, 0, 30, 0, 0, 0, 19, 0, 0, 0, 3, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 17, 0, 0, 0, 27, 0, 0, 0, 35, 5, 5, 5, 45, 47, 47, 47, 112, 59, 59, 59, 159, 66, 66, 66, 210, 69, 69, 69, 245, 69, 69, 69, 245, 66, 66, 66, 211, 58, 58, 58, 161, 46, 46, 46, 116, 4, 4, 4, 52, 0, 0, 0, 43, 0, 0, 0, 35, 0, 0, 0, 26, 0, 0, 0, 11, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 5, 0, 0, 0, 12, 0, 0, 0, 18, 0, 0, 0, 23, 0, 0, 0, 27, 0, 0, 0, 31, 0, 0, 0, 32, 0, 0, 0, 29, 0, 0, 0, 25, 0, 0, 0, 21, 0, 0, 0, 15, 0, 0, 0, 8, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
},
}
label = iup.label{title = "Please wait..."}
dg = iup.dialog{title = "Smart Lan APRIO150", size = "QUARTERxQUARTER",
tray = "YES", traytip = "Please wait...", trayimage = noimg;
iup.vbox{margin="10x10"; label}}
timer = iup.timer{time=1000}
function timer:action_cb()
local source = socket.http.request(statusurl)
if not source or source == "" then
dg.traytip = "Please wait..."
else
local signal = tostring(source:match('name="WLAN0_RSSI" value="(.-)"'))
local status = tostring(source:match('name="WAN_LINK_STATUS" value="(.-)"'))
local ipaddr = tostring(source:match('name="WAN_IP_ADDR" value="(.-)"'))
local conn_time = source:match('name="INTERNET_CONN_TIME" value="(.-)"') or 0
conn_day = (conn_time - conn_time % 86400) / 86400
conn_time = conn_time - conn_day * 86400
conn_hr = (conn_time - conn_time % 3600) / 3600
conn_time = conn_time - conn_hr * 3600
conn_min = (conn_time - conn_time % 60) / 60
conn_sec = conn_time - conn_min * 60
dg.traytip = string.format(
'Status: %s\n' ..
'Sinal: %s\n' ..
'IP: %s\n' ..
'%d dia(s) %d hora(s) %d minuto(s) %d segundo(s)',
status, signal, ipaddr, conn_day, conn_hr, conn_min, conn_sec)
end
local connected = dg.traytip:find("Connected")
if connected and dg.trayimage ~= yesimg then
dg.trayimage = yesimg
elseif not connected and dg.trayimage ~= noimg then
dg.trayimage = noimg
end
label.title = dg.traytip
end
timer.run = "YES"
function dg:trayclick_cb(b, press, dclick)
if b == 1 and press then
if dg.visible == "YES" then
dg.hidetaskbar = "YES"
else
dg:show()
end
end
end
dg:show()
dg.hidetaskbar = "YES"
iup.MainLoop()
|
--[[
delay line 1
with dc filter and shitty linear interpolation
TODO bit band
]]
local function blend(a,b,p) return (a*p + b*(1-p)) end
function Line (bufSize)
local n,e = math.frexp(bufSize)
bufSize = 2^e --nextpoweroftwo
local buf = ffi.new("double[?]", bufSize)
local mask = bufSize - 1
local pos = 0 -- todo int
local dc1, dc2 = 0, 0
return {
goBack = function (dt)
-- todo assert dt<bufSize
local fpos = pos - dt
local ipos1 = math.floor(fpos)
local frac = fpos - ipos1
return blend(buf[bit.band(ipos1 + 1, mask)], buf[bit.band(ipos1, mask)], frac)
end;
goBack_int = function (dt)
-- todo assert dt<bufSize
local fpos = pos - dt + 1
local ipos1 = math.floor(fpos)
return buf[bit.band(ipos1, mask)]
end;
push = function (s)
pos = pos + 1
if pos >= bufSize then pos = 0 end
--[[dc1 = dc1 + (s - dc2) * 0.000002
dc2 = dc2 + dc1
dc1 = dc1 * 0.96
if (pos)>=bufSize or (pos)<0 then error("accessed buf "..(pos)) end -- DEBUG
buf[pos] = s - dc2]]
buf[pos] = s
end;
}
end
return Line
|
-----------------------------------------------------------------------------------------
--
-- main.lua
--
-----------------------------------------------------------------------------------------
display.setStatusBar( display.HiddenStatusBar )
_mui_debug = true
local composer = require "composer"
composer.gotoScene("views.login")
--composer.gotoScene("menu_old")
|
local policy = require 'apicast.policy'
local _M = require 'apicast.policy_chain'
describe('policy_chain', function()
it('defines a method for each of the nginx phases supported', function()
for _, phase in policy.phases() do
assert.equals('function', type(_M[phase]))
end
end)
it('when calling one of the nginx phases, calls that phase on each of its policies', function()
-- Define a policy an stub its phase methods
local custom_policy_1 = policy.new('policy_1')
custom_policy_1.init = function () end
custom_policy_1.rewrite = function() end
stub(custom_policy_1, 'init')
stub(custom_policy_1, 'rewrite')
-- Define another policy and stub its phase methods
local custom_policy_2 = policy.new('policy_2')
custom_policy_2.init = function () end
custom_policy_2.access = function() end
stub(custom_policy_2, 'init')
stub(custom_policy_2, 'access')
-- Build the policy chain
local chain = _M.build({ custom_policy_1, custom_policy_2 })
chain:init()
assert.stub(custom_policy_1.init).was_called()
assert.stub(custom_policy_2.init).was_called()
chain:rewrite()
assert.stub(custom_policy_1.rewrite).was_called()
chain:access()
assert.stub(custom_policy_2.access).was_called()
end)
it('uses APIcast as default when no policies are specified', function()
assert.equal(1, #_M)
assert.equal('APIcast', _M[1]._NAME)
end)
it('calls the policies in the order specified when building the chain', function()
-- Each policy inserts its name in a table so we know the order in which
-- they were run.
local execution_order = {}
local policies = { policy.new('1'), policy.new('2'), policy.new('3') }
for _, custom_policy in ipairs(policies) do
custom_policy['init'] = function()
table.insert(execution_order, custom_policy._NAME)
end
end
local sorted_policies = { policies[2], policies[3], policies[1] }
local chain = _M.build(sorted_policies)
chain:init()
assert.same({'2', '3', '1'}, execution_order)
end)
it('does not allow to modify phase methods after the chain has been built', function()
for _, phase in policy.phases() do
assert.has_error(function()
_M[phase] = function() end
end, 'readonly table')
end
end)
it('does not allow to add new methods to the chain after it has been built', function()
assert.has_error(function()
_M['new_phase'] = function() end
end, 'readonly table')
end)
describe('.insert', function()
it('adds policy to the end of the chain', function()
local chain = _M.new({ 'one', 'two' })
chain:insert(policy)
assert.equal(policy, chain[3])
assert.equal(3, #chain)
end)
it('adds a policy to specific position', function()
local chain = _M.new({ 'one', 'two'})
chain:insert(policy, 2)
assert.equal(policy, chain[2])
assert.equal('one', chain[1])
assert.equal('two', chain[3])
assert.equal(3, #chain)
end)
it('errors when inserting to frozen chain', function()
local chain = _M.new({}):freeze()
local ok, err = chain:insert(policy, 1)
assert.is_nil(ok)
assert.equal(err, 'frozen')
assert.equal(0, #chain)
end)
end)
describe('.export', function()
it('returns the data exposed by each of its policies', function()
local policy_1 = policy.new('1')
policy_1.export = function() return { shared_data_1 = '1' } end
local policy_2 = policy.new('2')
policy_2.export = function() return { shared_data_2 = '2' } end
local chain = _M.build({ policy_1, policy_2 })
local shared_data = chain:export()
assert.equal('1', shared_data['shared_data_1'])
assert.equal('2', shared_data['shared_data_2'])
end)
it('returns a read-only list', function()
local policy_1 = policy.new('1')
policy_1.export = function() return { shared_data = '1' } end
local chain = _M.build({ policy_1 })
local shared_data = chain:export()
assert.has_error(function()
shared_data.new_shared_data = 'some_data'
end, 'readonly list')
assert.is_nil(shared_data.new_shared_data)
end)
describe('when several policies expose the same data', function()
it('returns the data exposed by the policy that comes first in the chain', function()
local policy_1 = policy.new('custom_reporter')
policy_1.export = function() return { shared_data_1 = '1' } end
local policy_2 = policy.new('custom_authorizer')
policy_2.export = function() return { shared_data_1 = '2' } end
local chain = _M.build({ policy_1, policy_2 })
local shared_data = chain:export()
assert.equal('1', shared_data['shared_data_1'])
end)
end)
end)
describe('.default', function()
it('returns a default policy chain', function()
local default = _M.default()
assert(#default > 1, 'has <= 1 policy')
end)
it('returns not frozen chain', function()
assert.falsy(_M.default().frozen)
end)
end)
describe('.load_policy', function()
it('loads defined policy', function()
assert.same(require('apicast.policy.echo').new({ status = 200 }),
_M.load_policy('echo', 'builtin', { status = 200 }))
end)
it('returns error on missing policy', function()
local _, err = _M.load_policy('unknown')
assert.match([[module 'init' not found]], err)
assert.match([[no file]], err)
assert.match([[apicast/policy/unknown]], err)
end)
describe('when there is an error instantiating the policy', function()
before_each(function()
local PolicyLoader = require('apicast.policy_loader')
-- Make any policy crash when initialized
stub(PolicyLoader, 'pcall').returns(
{ new = function() error('Policy crashed in .new()') end }
)
end)
it('returns nil an an error instead of crashing', function()
local res, err = _M.load_policy('echo', 'builtin')
assert.is_nil(res)
assert(err)
end)
end)
describe('when the policy returns nil, err in .new()', function()
local policy_error = 'Some error'
before_each(function()
local PolicyLoader = require('apicast.policy_loader')
stub(PolicyLoader, 'pcall').returns(
{ new = function() return nil, policy_error end }
)
end)
it('returns nil an the policy error instead of crashing', function()
local res, err = _M.load_policy('echo', 'builtin')
assert.is_nil(res)
assert.equals(policy_error, err)
end)
end)
end)
end)
|
---@diagnostic disable: unused-local
local utils = require "nvim-test.utils"
local ts_utils = require "nvim-treesitter.ts_utils"
local ts_parsers = require("nvim-treesitter.parsers")
local ts = vim.treesitter
---@class Runner
local Runner = {
config = {
args = {},
filename_modifier = nil,
working_directory = nil,
},
}
Runner.__index = Runner
function Runner:init(config, queries)
self = setmetatable({}, Runner)
self.queries = queries or {}
for ft, query in pairs(self.queries) do
ts.set_query(ft, "nvim-test", query)
end
self:setup(config)
return self
end
function Runner:setup(config)
if config then
self.config = vim.tbl_deep_extend("force", self.config, config)
end
if type(self.config.command) == "table" then
self.config.command = utils.check_executable(self.config.command)
end
return self
end
function Runner:find_nearest_test(filetype)
local query = ts.get_query(ts_parsers.ft_to_lang(filetype), "nvim-test")
local result = {}
if query then
local curnode = ts_utils.get_node_at_cursor()
while curnode do
local iter = query:iter_captures(curnode, 0)
local capture_id, capture_node = iter()
if capture_node == curnode and query.captures[capture_id] == "scope-root" then
while query.captures[capture_id] ~= "test-name" do
capture_id, capture_node = iter()
if not capture_id then
return result
end
end
local name = self:parse_testname(ts.query.get_node_text(capture_node, 0))
table.insert(result, 1, name)
end
curnode = curnode:parent()
end
end
return result
end
---Check is the given filename is a test file
--
---@param filename string
---@return boolean
function Runner:is_testfile(filename)
local file_pattern = self.config.file_pattern
if file_pattern and #file_pattern > 0 then
return vim.fn.match(filename, self.config.file_pattern) >= 0
end
return true
end
---Find a test file for the given filename
--
---@param filename string
---@return string
function Runner:find_file(filename, force)
local finder = self.config.find_files
if not finder then
return filename
end
if type(finder) == "function" then
return finder(filename)
end
if type(finder) == "string" then
finder = { finder }
end
return utils.find_file_by_patterns(filename, finder, force)
end
---@param name string
---@return string
function Runner:parse_testname(name)
return name
end
-- Build command list
---
---@return table cmd command list
function Runner:build_cmd(filename, opts)
local args = utils.concat({}, self.config.args)
self:build_args(args, filename, opts or {})
table.insert(args, 1, self.config.command)
return args
end
-- Build arguments
---
---@return table args arguments list
function Runner:build_args(args, filename, opts)
if filename then
table.insert(args, filename)
end
if opts.tests and #opts.tests > 0 then
self:build_test_args(args, opts.tests)
end
end
---@return table test_args test arguments list
function Runner:build_test_args(args, tests) end
return Runner
|
POWER_ON = false
local InteractType = nil
local InteractThing = nil
local RepairBarricadeInterval
local RevivingPlayerData
VZ_EVENT_SUBSCRIBE("Character", "Highlight", function(char, Highlight, ent)
if IsSelfCharacter(char) then
if ent then -- error when highlight ground weapons :thinking:
local m_weap_id = ent:GetValue("MapWeaponID")
if m_weap_id then
if Highlight then
BuyText(MAP_WEAPONS[m_weap_id].weapon_name .. " / Ammo", tostring(MAP_WEAPONS[m_weap_id].price) .. "$ / " .. tostring(math.floor(MAP_WEAPONS[m_weap_id].price * Weapons_Ammo_Price_Percentage / 100)) .. " $ / " .. tostring(Pack_a_punch_price))
InteractType = "MapWeapon"
InteractThing = m_weap_id
elseif (InteractType == "MapWeapon" and InteractThing == m_weap_id) then
InteractType = nil
InteractThing = nil
One_Time_Update_Data.InteractText = nil
One_Time_Updates_Canvas:Repaint()
end
end
end
end
end)
function InteractCheck(interact_type, loop_params, Interact_Check_Interval_ms, CheckFunc)
Timer.SetInterval(function()
if (InteractType == nil or InteractType == interact_type) then
local local_player = Client.GetLocalPlayer()
local local_char = local_player:GetControlledCharacter()
local found
if local_char then
local local_char_location = local_char:GetLocation()
if loop_params then
for k, v in pairs(loop_params.LoopFunc()) do
if (not loop_params.check_is_valid or v:IsValid()) then
found = CheckFunc(local_player, local_char, local_char_location, v)
if found then
break
end
end
end
else
found = CheckFunc(local_player, local_char, local_char_location)
end
end
if not found then
if InteractType == interact_type then
InteractType = nil
InteractThing = nil
One_Time_Update_Data.InteractText = nil
One_Time_Updates_Canvas:Repaint()
end
end
end
end, Interact_Check_Interval_ms)
end
function InteractAction(CheckNoPower, event_name, check_valid)
if (not CheckNoPower or InteractThing ~= "NoPower") then
if (not check_valid or InteractThing:IsValid()) then
Events.CallRemote(event_name, InteractThing)
end
end
end
InteractCheck("MapDoor", nil, Doors_Interact_Check_Interval_ms, function(local_player, local_char, local_char_location)
local found
local Fwd = local_char:GetRotation():GetForwardVector()
local trace = Client.Trace(local_char_location, local_char_location + Fwd * Doors_Interact_Check_Trace_Distance_Max, CollisionChannel.WorldStatic, true, true, false, {}, ZDEV_IsModeEnabled("ZDEV_DEBUG_TRACES"))
if trace.Success then
local v = trace.Entity
if v then
local door_id = v:GetValue("DoorID")
if door_id then
InteractType = "MapDoor"
found = true
local power_needed = false
if not POWER_ON then
for i3, v3 in ipairs(MAP_DOORS[door_id].required_rooms) do
if v3 == -1 then
power_needed = true
break
end
end
end
if not power_needed then
BuyText("Door", tostring(MAP_DOORS[door_id].price))
InteractThing = door_id
else
InteractText("Missing Power")
InteractThing = "NoPower"
end
end
end
end
return found
end)
InteractCheck("MapBarricade", {LoopFunc = StaticMesh.GetPairs, check_is_valid = true}, Barricades_Interact_Check_Interval_ms, function(local_player, local_char, local_char_location, v)
local zspawn_id = v:GetValue("BarricadeSpawnID")
if zspawn_id then
if v:GetValue("BarricadeLife") < 5 then
local distance_sq = local_char_location:DistanceSquared(v:GetLocation())
if distance_sq <= Barricades_Interact_Check_Distance_Squared_Max then
if InteractThing ~= v then
if RepairBarricadeInterval then
Timer.ClearInterval(RepairBarricadeInterval)
RepairBarricadeInterval = nil
end
InteractText("Hold to Repair Barricade")
InteractType = "MapBarricade"
InteractThing = v
end
return true
end
end
end
end)
function RepairBarricadeIFunc()
if (InteractThing and NanosUtils.IsA(InteractThing, StaticMesh) and InteractThing:IsValid() and InteractThing:GetValue("BarricadeLife") and InteractThing:GetValue("BarricadeLife") < 5) then
local repair_sound = Sound(
Vector(0, 0, 0),
Barricade_Repair_Sound.asset,
true,
true,
SoundType.SFX,
Barricade_Repair_Sound.volume
)
Events.CallRemote("RepairBarricade", InteractThing:GetValue("BarricadeSpawnID"))
elseif RepairBarricadeInterval then
Timer.ClearInterval(RepairBarricadeInterval)
RepairBarricadeInterval = nil
end
end
InteractCheck("RevivePlayer", {LoopFunc = Character.GetPairs, check_is_valid = true}, DownPlayer_Interact_Check_Interval_ms, function(local_player, local_char, local_char_location, v)
if not IsSelfCharacter(v) then
local RevivingPlayer = v:GetValue("RevivingPlayer")
if (v:GetValue("PlayerDown") and (not RevivingPlayer or RevivingPlayer == local_char:GetID())) then
local distance_sq = local_char_location:DistanceSquared(v:GetLocation())
if distance_sq <= DownPlayer_Interact_Check_Distance_Squared_Max then
if not RevivingPlayerData then
InteractText("Hold to Revive Player")
InteractType = "RevivePlayer"
InteractThing = v
end
return true
end
end
end
end)
InteractCheck("MapMBOX", {LoopFunc = StaticMesh.GetPairs, check_is_valid = true}, MBOX_Interact_Check_Interval_ms, function(local_player, local_char, local_char_location, v)
local can_buy_mbox = v:GetValue("CanBuyMysteryBox")
if can_buy_mbox then
local distance_sq = local_char_location:DistanceSquared(v:GetLocation())
if distance_sq <= MBOX_Interact_Check_Distance_Squared_Max then
InteractType = "MapMBOX"
BuyText("Mystery Box", tostring(Mystery_box_price))
InteractThing = v
return true
end
end
end)
InteractCheck("MapPower", {LoopFunc = StaticMesh.GetPairs, check_is_valid = true}, POWER_Interact_Check_Interval_ms, function(local_player, local_char, local_char_location, v)
if not POWER_ON then
local is_Map_Power = v:GetValue("MapPower")
if is_Map_Power then
local distance_sq = local_char_location:DistanceSquared(v:GetLocation())
if distance_sq <= POWER_Interact_Check_Distance_Squared_Max then
InteractType = "MapPower"
InteractText("Turn Power ON")
InteractThing = v
return true
end
end
end
end)
InteractCheck("MapPerk", {LoopFunc = StaticMesh.GetPairs, check_is_valid = true}, Perk_Interact_Check_Interval_ms, function(local_player, local_char, local_char_location, v)
local perk = v:GetValue("MapPerk")
if (perk and not CurPerks[perk]) then
local distance_sq = local_char_location:DistanceSquared(v:GetLocation())
if distance_sq <= Perk_Interact_Check_Distance_Squared_Max then
InteractType = "MapPerk"
if POWER_ON then
InteractThing = v
BuyText(perk .. " Perk", tostring(PERKS_CONFIG[perk].price))
else
InteractThing = "NoPower"
InteractText("Missing Power")
end
return true
end
end
end)
InteractCheck("MapPAP", {LoopFunc = StaticMesh.GetPairs, check_is_valid = true}, PAP_Interact_Check_Interval_ms, function(local_player, local_char, local_char_location, v)
local can_buy_pap = v:GetValue("CanBuyPackAPunch")
if can_buy_pap then
local distance_sq = local_char_location:DistanceSquared(v:GetLocation())
if distance_sq <= PAP_Interact_Check_Distance_Squared_Max then
InteractType = "MapPAP"
if POWER_ON then
InteractThing = v
BuyText("Weapon Upgrade", tostring(Pack_a_punch_price))
else
InteractThing = "NoPower"
InteractText("Missing Power")
end
return true
end
end
end)
InteractCheck("MapWunder", {LoopFunc = StaticMesh.GetPairs, check_is_valid = true}, Wunderfizz_Interact_Check_Interval_ms, function(local_player, local_char, local_char_location, v)
if table_count(CurPerks) < table_count(PERKS_CONFIG) then
local can_buy_wunder = v:GetValue("CanBuyWunder")
if can_buy_wunder then
local distance_sq = local_char_location:DistanceSquared(v:GetLocation())
if distance_sq <= Wunderfizz_Interact_Check_Distance_Squared_Max then
InteractType = "MapWunder"
if POWER_ON then
BuyText("Wunderfizz", tostring(Wonderfizz_Price))
InteractThing = v
else
InteractText("Missing Power")
InteractThing = "NoPower"
end
return true
end
end
end
end)
InteractCheck("WunderBottle", {LoopFunc = Prop.GetPairs, check_is_valid = true}, Wunderfizz_Bottle_Interact_Check_Interval_ms, function(local_player, local_char, local_char_location, v)
if table_count(CurPerks) < table_count(PERKS_CONFIG) then
local wunder_bottle = v:GetValue("RealBottleData")
if wunder_bottle then
if wunder_bottle[1] == local_char:GetID() then
if (not CurPerks or not CurPerks[wunder_bottle[2]]) then
local distance_sq = local_char_location:DistanceSquared(v:GetLocation())
if distance_sq <= Wunderfizz_Bottle_Interact_Check_Distance_Squared_Max then
InteractType = "WunderBottle"
InteractText("Take " .. wunder_bottle[2] .. " Perk")
InteractThing = v
return true
end
end
end
end
end
end)
if MAP_INTERACT_TRIGGERS then
InteractCheck("MapCustom", nil, Custom_Interact_Check_Interval_ms, function(local_player, local_char, local_char_location)
local found
for k, v in pairs(MAP_INTERACT_TRIGGERS) do
local distance_sq = local_char_location:DistanceSquared(v.location)
if distance_sq <= v.distance_sq then
InteractType = "MapCustom"
InteractThing = v
InteractText(v.interact_text)
found = true
end
end
return found
end)
end
if MAP_TELEPORTERS then
InteractCheck("MapTeleporter", {LoopFunc = StaticMesh.GetPairs, check_is_valid = true}, Teleporters_Interact_Check_Interval_ms, function(local_player, local_char, local_char_location, v)
local can_teleport = v:GetValue("CanTeleport")
if (can_teleport or can_teleport == false) then
local teleporter_ID = v:GetValue("TeleporterID")
if teleporter_ID then
local distance_sq = local_char_location:DistanceSquared(v:GetLocation())
if distance_sq <= MAP_TELEPORTERS[teleporter_ID].distance_sq then
InteractType = "MapTeleporter"
if POWER_ON then
if can_teleport == false then
InteractThing = "NoPower"
InteractText("Teleporter in cooldown")
else
InteractThing = v
InteractText("Teleport (" .. tostring(MAP_TELEPORTERS[teleporter_ID].price) .. "$)")
end
else
InteractThing = "NoPower"
InteractText("Missing Power")
end
found = true
end
end
end
end)
end
VZ_EVENT_SUBSCRIBE("Character", "ValueChange", function(char, key, value)
if key == "RevivingPlayer" then
if value then
local ply = Client.GetLocalPlayer()
local local_char = ply:GetControlledCharacter()
if local_char then
if value == local_char:GetID() then
if (InteractThing and InteractType == "RevivePlayer") then
local rev_time = ReviveTime_ms
local perks = local_char:GetValue("OwnedPerks")
if (perks and perks["quick_revive"]) then
rev_time = PERKS_CONFIG.quick_revive.ReviveTime_ms
end
GUIStartRevive(rev_time)
RevivingPlayerData = {}
RevivingPlayerData.timeout = Timer.SetTimeout(function()
RevivingPlayerData = nil
Events.CallRemote("RevivePlayerFinished", char)
end, rev_time)
RevivingPlayerData.char = char
else
Events.CallRemote("RevivePlayerStopped", char)
end
end
end
end
end
end)
VZ_EVENT_SUBSCRIBE("Character", "Destroy", function(char)
if RevivingPlayerData then
if RevivingPlayerData.char == char then
Timer.ClearTimeout(RevivingPlayerData.timeout)
GUIStopRevive()
RevivingPlayerData = nil
end
end
end)
VZ_BIND("Interact", InputEvent.Pressed, function()
local ply = Client.GetLocalPlayer()
local char = ply:GetControlledCharacter()
if char then
if not char:GetValue("PlayerDown") then
local tbl_value = switch(InteractType, {
MapDoor = {true, "BuyDoor"},
MapBarricade = function()
if RepairBarricadeInterval then
Timer.ClearInterval(RepairBarricadeInterval)
RepairBarricadeInterval = nil
end
PlayStartRepairBarricade()
RepairBarricadeInterval = Timer.SetInterval(RepairBarricadeIFunc, Repair_Barricade_Interval_ms)
end,
RevivePlayer = {false, "RevivePlayer"},
MapMBOX = {false, "BuyMBOX"},
MapPower = {false, "TurnPowerON"},
MapPerk = {true, "BuyPerk"},
MapPAP = {true, "UpgradeWeap"},
MapWunder = {true, "BuyWunderfizz"},
WunderBottle = {false, "TakeWunderfizzPerk", true},
MapCustom = function()
Events.Call(InteractThing.event_name, InteractThing)
Events.CallRemote("CustomMapInteract", InteractThing)
end,
MapTeleporter = function()
if InteractThing ~= "NoPower" then
if InteractThing:IsValid() then
if InteractThing:GetValue("CanTeleport") then
Events.CallRemote("BuyTeleport", InteractThing)
end
end
end
end,
})
if tbl_value then
if type(tbl_value) == "function" then
tbl_value()
else
InteractAction(table.unpack(tbl_value))
end
end
end
end
end)
VZ_BIND("Interact", InputEvent.Released, function()
if InteractType == "MapBarricade" then
if RepairBarricadeInterval then
Timer.ClearInterval(RepairBarricadeInterval)
RepairBarricadeInterval = nil
end
elseif (InteractType == "RevivePlayer" and RevivingPlayerData) then
Timer.ClearTimeout(RevivingPlayerData.timeout)
GUIStopRevive()
Events.CallRemote("RevivePlayerStopped", RevivingPlayerData.char)
RevivingPlayerData = nil
end
end)
VZ_EVENT_SUBSCRIBE("Events", "SetClientPowerON", function(is_on)
POWER_ON = is_on
if not is_on then
for k, v in pairs(PerksAmbSounds) do
if v:IsValid() then
v:Destroy()
end
end
PerksAmbSounds = {}
if (PapAmbSound and PapAmbSound:IsValid()) then
PapAmbSound:Destroy()
end
PapAmbSound = nil
end
end)
|
return {
{
effect_list = {
{
type = "BattleBuffShield",
trigger = {
"onStack",
"onTakeDamage"
},
arg_list = {
casterMaxHPRatio = 150
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13302,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "lessequal"
}
}
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13303,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "great"
}
}
}
}
}
},
{
effect_list = {
{
type = "BattleBuffShield",
trigger = {
"onStack",
"onTakeDamage"
},
arg_list = {
casterMaxHPRatio = 200
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13302,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "lessequal"
}
}
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13303,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "great"
}
}
}
}
}
},
{
effect_list = {
{
type = "BattleBuffShield",
trigger = {
"onStack",
"onTakeDamage"
},
arg_list = {
casterMaxHPRatio = 250
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13302,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "lessequal"
}
}
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13303,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "great"
}
}
}
}
}
},
{
effect_list = {
{
type = "BattleBuffShield",
trigger = {
"onStack",
"onTakeDamage"
},
arg_list = {
casterMaxHPRatio = 300
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13302,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "lessequal"
}
}
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13303,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "great"
}
}
}
}
}
},
{
effect_list = {
{
type = "BattleBuffShield",
trigger = {
"onStack",
"onTakeDamage"
},
arg_list = {
casterMaxHPRatio = 350
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13302,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "lessequal"
}
}
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13303,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "great"
}
}
}
}
}
},
{
effect_list = {
{
type = "BattleBuffShield",
trigger = {
"onStack",
"onTakeDamage"
},
arg_list = {
casterMaxHPRatio = 400
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13302,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "lessequal"
}
}
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13303,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "great"
}
}
}
}
}
},
{
effect_list = {
{
type = "BattleBuffShield",
trigger = {
"onStack",
"onTakeDamage"
},
arg_list = {
casterMaxHPRatio = 450
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13302,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "lessequal"
}
}
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13303,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "great"
}
}
}
}
}
},
{
effect_list = {
{
type = "BattleBuffShield",
trigger = {
"onStack",
"onTakeDamage"
},
arg_list = {
casterMaxHPRatio = 500
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13302,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "lessequal"
}
}
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13303,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "great"
}
}
}
}
}
},
{
effect_list = {
{
type = "BattleBuffShield",
trigger = {
"onStack",
"onTakeDamage"
},
arg_list = {
casterMaxHPRatio = 550
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13302,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "lessequal"
}
}
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13303,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "great"
}
}
}
}
}
},
{
effect_list = {
{
type = "BattleBuffShield",
trigger = {
"onStack",
"onTakeDamage"
},
arg_list = {
casterMaxHPRatio = 600
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13302,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "lessequal"
}
}
}
},
{
type = "BattleBuffCastSkill",
trigger = {
"onRemove"
},
arg_list = {
skill_id = 13303,
target = "TargetSelf",
effectAttachData = {
{
value = 0,
type = "BattleBuffShield",
op = "great"
}
}
}
}
}
},
init_effect = "",
name = "",
time = 8,
picture = "",
desc = "护盾",
stack = 1,
id = 13302,
icon = 13301,
last_effect = "Shield",
effect_list = {}
}
|
project "GameFramework"
kind "StaticLib"
language "C++"
targetdir ("%{wks.location}/dist/" .. outputdir .. "/%{prj.name}")
objdir ("%{wks.location}/imt/" .. outputdir .. "/%{prj.name}")
files
{
"src/**.h",
"src/**.hpp",
"src/**.cpp",
"%{wks.location}/depd/stb/stb_image/stb_image.cpp",
"%{wks.location}/depd/stb/stb_image/stb_image.h"
}
includedirs
{
"src",
"%{includes.stb_image}",
"%{includes.entt}",
"%{includes.spdlog}",
"%{includes.SDL2}",
"%{includes.SDL2_image}",
"%{includes.SDL2_mixer}",
"%{includes.Glad}",
"%{includes.glm}"
}
libdirs
{
"%{wks.location}/depd/SDL2-2.0.12/lib/x64",
"%{wks.location}/depd/SDL2_image-2.0.5/lib/x64",
"%{wks.location}/depd/SDL2_mixer-2.0.4/lib/x64"
}
links { "SDL2.lib", "SDL2main.lib", "SDL2_image.lib", "SDL2_mixer.lib", "Glad", "opengl32.lib", "glm" }
filter "system:windows"
cppdialect "C++17"
staticruntime "On"
systemversion "latest"
|
local RossDoc
do
local _base_0 = {
StyleObject = function(self, romlObject)
local objectName = romlObject:ObjectName()
self:_styleWithTable(romlObject, self._objects[objectName])
local _list_0 = romlObject:GetClasses()
for _index_0 = 1, #_list_0 do
local c = _list_0[_index_0]
self:_styleWithTable(romlObject, self._classes["." .. tostring(c)])
self:_styleWithTable(romlObject, self._classes[tostring(objectName) .. "." .. tostring(c)])
end
local objectId = romlObject:GetObjectId()
if not (objectId == nil) then
self:_styleWithTable(romlObject, self._ids["#" .. tostring(objectId)])
self:_styleWithTable(romlObject, self._ids[tostring(objectName) .. "#" .. tostring(objectId)])
end
return romlObject:Refresh()
end,
_styleWithTable = function(self, romlObject, t)
if t == nil then
t = { }
end
for _index_0 = 1, #t do
local el = t[_index_0]
if romlObject:MatchesSelector(el.selector:Clone()) then
romlObject:StyleObject(el.properties)
end
end
end,
_setupObjects = function(self)
return { }
end,
_setupClasses = function(self)
return { }
end,
_setupIds = function(self)
return { }
end
}
_base_0.__index = _base_0
local _class_0 = setmetatable({
__init = function(self)
self._objects = self:_setupObjects()
self._classes = self:_setupClasses()
self._ids = self:_setupIds()
end,
__base = _base_0,
__name = "RossDoc"
}, {
__index = _base_0,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
RossDoc = _class_0
return _class_0
end
|
local lfs = require 'lfs'
local IndexUtils = require 'dataset.IndexUtils'
local function IndexDirectory(url, partition, partitions, opt)
partition = partition or 1
assert(partition >= 1)
partitions = partitions or 1
assert(partitions >= 1)
assert(partition <= partitions)
opt = opt or { }
local indexUtils = IndexUtils(opt)
local function orderedDirWalk(dir, f)
local fns = { }
for fn in lfs.dir(dir) do
table.insert(fns, fn)
end
table.sort(fns)
for _,fn in ipairs(fns) do
f(fn)
end
end
local function loadDirectory(root)
local classes = { }
local function rcsvLoad(dn, label)
orderedDirWalk(root..'/'..dn, function(fn)
if string.sub(fn, 1, 1) ~= '.' then
local dfn = dn..'/'..fn
local mode = lfs.attributes(root..'/'..dfn).mode
if mode == 'file' then
indexUtils.addItem(classes, { filename = dfn }, label)
elseif mode == 'directory' then
rcsvLoad(dfn, label)
end
end
end)
end
orderedDirWalk(root, function(fn)
if string.sub(fn, 1, 1) ~= '.' then
local mode = lfs.attributes(root..'/'..fn).mode
if mode == 'file' then
indexUtils.addItem(classes, { filename = fn }, '*')
elseif mode == 'directory' then
rcsvLoad(fn, fn)
end
end
end)
return classes
end
local loaded
local urlPrefix = url
loaded = loadDirectory(urlPrefix)
local classes, totalItems, labels, labelIndex = indexUtils.downsampleAndGetLabels(loaded, partition, partitions)
return {
labels = labels,
labelIndex = labelIndex,
itemCount = indexUtils.itemCount(classes, totalItems),
itemAt = indexUtils.itemAt(classes, totalItems, labels, urlPrefix),
urlPrefix = urlPrefix,
reset = nil,
indexType = 'Directory'
}
end
return IndexDirectory
|
function power(A,B)
local m=math.max(A:size(1),B:size(1))
local n=math.max(A:size(2),B:size(2))
local C=torch.zeros(m,n)
if (A:size(1)==B:size(1) and A:size(2)==B:size(2)) then
for i=1,m do
for j=1,n do
C[{i,j}]=A[{i,j}]^B[{i,j}]
end
end
elseif (A:size(1)==1 and A:size(2)==1) then
for i=1,m do
for j=1,n do
C[{i,j}]=A[{1,1}]^B[{i,j}]
end
end
elseif (B:size(1)==1 and B:size(2)==1) then
for i=1,m do
for j=1,n do
C[{i,j}]=A[{i,j}]^B[{1,1}]
end
end
else
error('Matrix dimensions must agree.')
end
return C
end
|
local st = {}
function st:update()
gui.group{grow="down", pos = {WIDTH/2-150, HEIGHT/2-60}, size={300,25}, spacing=5, function()
love.graphics.setFont(Font[30])
gui.Label{text = "A game by VRLD", align="center"}
gui.Label{text = "Made in 48-ish Hours", align="center"}
gui.Label{text = "for the 34th Ludum Dare compo", align="center"}
love.graphics.setFont(Font[25])
gui.Label{text = "", size={nil,15}}
gui.Label{text = "Made with LÖVE", align="center"}
gui.Label{text = "Font: Turtles by jaynz", align="center"}
love.graphics.setFont(Font[20])
gui.Label{text = "", size={nil,15}}
gui.Label{text = "Season's Greetings:", align="center"}
gui.Label{text = "cappel:nord, fysx, headchant, steven colling", align="center"}
gui.Label{text = "bartbes, boolsheet, rude, slime, and the inner party members", align="center"}
gui.Label{text = "", size={nil,20}}
love.graphics.setFont(Font[30])
if gui.Button{text = "back", size={nil,40}} then
GS.transition(State.menu, .5)
end
end}
hot, hot_last = gui.mouse.getHot(), hot
if hot and hot ~= hot_last then
selectSound:play()
end
end
function st:draw()
State.menu:draw()
end
return st
|
function binary_search(list, item)
first = 1
last = #list
found = false
while first <= last and found == false do
middle = math.ceil((first + last) / 2)
if list[middle] == item then
found = true
elseif list[middle] > item then
last = middle - 1
else
first = middle + 1
end
end
return found
end
print(binary_search({1,2,3,4,5,6},5));
|
local num = io.read("*n")
print("Entered number: " .. num)
|
include("/scripts/includes/consts.lua")
include("/scripts/includes/skill_consts.lua")
include("/scripts/includes/damage.lua")
-- https://wiki.guildwars.com/wiki/Spike_Trap
itemIndex = 6000
creatureState = CREATURESTATE_IDLE
effect = SkillEffectDamage
effectTarget = SkillTargetAoe
-- 90 seconds
local lifeTime = 90 * 1000
local damage = 0;
local crippledTime = 0;
function onInit()
local source = self:GetSource()
if (source == nil) then
return false
end
self:SetRange(RANGE_ADJECENT)
self:SetLifetime(lifeTime)
self:SetTrigger(true)
local attribVal = source:GetAttributeRank(ATTRIB_WILDERNESS_SURVIVAL)
damage = 10 + (attribVal * 2)
crippledTime = 3 + math.floor(attribVal * 1.5)
return true
end
function onTrigger(other)
if (self:GetState() == CREATURESTATE_IDLE) then
-- Not triggered yet, so let's trigger now
self:SetState(CREATURESTATE_TRIGGERED)
local actors = self:GetActorsInRange(self:GetRange())
for i, actor in ipairs(actors) do
actor:Damage(self:GetSource(), self:Index(), DAMAGETYPE_PIERCING, damage)
actor:KnockDown(self:GetSource(), 0)
actor:AddEffect(self:GetSource(), 10001, crippledTime)
end
self:RemoveIn(2000)
end
end
|
only_included_scenario_names = {}
local last_display_name
function action_new_file()
last_display_name = nil
end
--- define a node
function label(name, display_name)
if display_name == nil then
if last_display_name == nil then
display_name = name
else
display_name = last_display_name
end
else
last_display_name = display_name
end
if __Nova.scriptLoader.stateLocale == Nova.I18n.DefaultLocale then
__Nova.scriptLoader:RegisterNewNode(name)
else
__Nova.scriptLoader:BeginAddLocaleForNode(name)
end
Nova.I18nHelper.NodeNames:Set(name, __Nova.scriptLoader.stateLocale, display_name)
end
--- jump to the given destination
--- should be called at the end of the node
function jump_to(dest)
__Nova.scriptLoader:RegisterJump(dest)
end
--- add branches to the current node
--- should be called at the end of the node
--- should be called only once for each node, i.e., all branches of the node should be added at once
--- branches should be a list of 'branch'. A 'branch' is a table with the following structure:
--- {
--- dest = 'name of the destination node'
--- text = 'text on the button', should not use if mode is jump
--- image = {'image_name', {x, y, scale}}, should not use if mode is jump
--- mode = 'normal|jump|show|enable', optional, default is normal
--- cond = a function that returns a bool, should not use if mode is show, optional if mode is jump
--- }
--- if cond is a string, it will be converted to a function returning that expression
function branch(branches)
for i, branch in ipairs(branches) do
local name = tostring(i)
local image_info = nil
if branch.image then
local image_name, image_coord = unpack(branch.image)
local pos_x, pos_y, scale = unpack(image_coord)
image_info = Nova.BranchImageInformation(image_name, pos_x, pos_y, scale)
end
local mode = Nova.BranchMode.Normal
if branch.mode == nil or branch.mode == 'normal' then
-- pass
elseif branch.mode == 'jump' then
mode = Nova.BranchMode.Jump
elseif branch.mode == 'show' then
mode = Nova.BranchMode.Show
elseif branch.mode == 'enable' then
mode = Nova.BranchMode.Enable
else
warn('Unknown branch mode: ' .. branch.mode .. ', text: ' .. branch.text)
return
end
local cond = branch.cond
if type(cond) == 'string' then
cond = loadstring('return ' .. cond)
end
if __Nova.scriptLoader.stateLocale == Nova.I18n.DefaultLocale then
__Nova.scriptLoader:RegisterBranch(name, branch.dest, branch.text, image_info, mode, cond)
else
__Nova.scriptLoader:AddLocaleForBranch(name, branch.dest, branch.text)
end
end
__Nova.scriptLoader:EndRegisterBranch()
end
--- set the current node as a start node
--- should be called at the end of the node
--- a game can have multiple start points, which means this function can be called several times under
--- different nodes
--- a name can be assigned to a start point, which can differ from the node name
--- the name should be unique among all start point names
--- if no name is given, the name of the current node will be used
function is_start(name)
__Nova.scriptLoader:SetCurrentAsStart(name)
end
--- set the current node as a start point which is unlocked when running the game for the first time
--- should be called at the end of the node
--- indicates is_start()
function is_unlocked_start(name)
__Nova.scriptLoader:SetCurrentAsUnlockedStart(name)
end
--- set the current node as the default start point
--- should be called at the end of the node
--- a game can have only one default start node, so this function cannot be called under different nodes
--- indicates is_unlocked_start()
function is_default_start(name)
__Nova.scriptLoader:SetCurrentAsDefaultStart(name)
end
--- set the current node as an end node
--- should be called at the end of the node
--- a name can be assigned to an end point, which can differ from the node name
--- the name should be unique among all end point names
--- if no name is given, the name of the current node will be used
--- all nodes without child nodes should be marked as end nodes
--- if is_end() is not called under those nodes, they will be marked as end nodes automatically
function is_end(name)
__Nova.scriptLoader:SetCurrentAsEnd(name)
end
|
local BaseInstance = import("./BaseInstance")
local HttpRbxApiService = BaseInstance:extend("HttpRbxApiService")
return HttpRbxApiService
|
local L=(function(n,e)return(n^e);end)local R=(function(e,n)return(e*n);end)local o=(function(e,...)return e(...);end)local e=(function(n,e)return(n<e);end)local w=(function(e,n)return(e-n);end)local e=(function(e,n)return(e/n);end)local Y=(function(n,e)return(n+e);end)local ne=(function(n,e)return(n~=e);end)local S=(function(n,e)return(n%e);end)local e=(function(e,n)return(e>=n);end)local e=(function(e,n)return(e<=n);end)local E=(function(e,n)return(e==n);end)local ie=(function(e,n)return(e>n);end)local e=(function(n,e)return(n..e);end)for n,e in pairs({(function(a,...)_26a18a4ee4675ef1="This file was obfuscated using PSU Obfuscator 4.5.A | https://www.psu.dev/ & discord.gg/psu";local _=_26a18a4ee4675ef1 local M=a[(198493001)];local l=a["DAReGMgzEV"];local n=a[(76853149)];local x=a[(400982159)];local de=a[((644429421-#("toni base")))];local v=a[((773173606-#("Jack off to furry porn")))];local f=a.TYOdYZP9Xx;local B=a[((30739679-#("buy strawberry hub")))];local D=a[(506729481)];local G=a["UQtzG"];local I=a['B9iq4j9p'];local te=a[(876156976)];local fe=a[((363041534-#("Lunar best ww?")))];local ce=a[(441532275)];local re=a["kjTBZxg"];local ae=a[(451085082)];local b=a[(227986664)];local O=a.vvvCY;local q=a["Bc62t8m3M"];local s=a["UiALUlI"];local m=a[((#{692;745;343;994;}+315458145))];local y=a[((#{(function(...)return 331,4,16,141;end)()}+733151001))];local ee=a[(816976232)];local H=a[((447502312-#("nigmode")))];local r=a[((#{}+68964929))];local X=a[(272326106)];local i=a["OdbbtN"];local F=a[(650694760)];local W=a[((962794210-#("skillfuel")))];local K=a[(346261014)];local Z=a["qGcRw"];local j=a[((547656704-#("Jayy was here")))];local P=a[(128336898)];local Q=((getfenv)or(function(...)return(_ENV);end));local c,u,e=({}),(""),(Q(n));local t=((e["\98\105"..a[l].."\51\50"])or(e["\98\105\116"])or({}));local d=(((t)and(t[""..a[i]..a['r4FUfGr']..a[B].."\114"]))or(function(e,l)local n,o=n,f;while((e>f)and(l>f))do local d,a=e%x,l%x;if d~=a then o=o+n;end;e,l,n=(e-d)/x,(l-a)/x,n*x;end;if e<l then e=l;end;while e>f do local l=e%x;if l>f then o=o+n;end;e,n=(e-l)/x,n*x;end;return(o);end));local h=(x^I);local g=(h-n);local U,N,T;local h=(u["\115\117"..a[i]]);local p=(u["\98"..a["HcURw2u"].."\116\101"]);local xe=(u["\99"..a[P].."\97\114"]);local u=(u[""..a.tiPQmXJ11r..a[s].."\117\98"]);local u=(e[""..a[l]..a['HcURw2u']..a[F].."\101"]);local J=(e["\112\99\97"..a[D]..a[D]]);local k=(e["\109\97"..a[l].."\104"]["\102\108\111"..a[B].."\114"]);local oe=function(l,n,e)return e+n or l*e end;local V=(e["\115"..a[l]..a[y]..a['Q0P5g73']..a[b]..a.tiPQmXJ11r][""..a[m]..a["LTGApG6DR"].."\116"..a[G]..a[P]]);local u=((e["\117\110\112"..a.LTGApG6DR.."\99"..a["r2D9Exo"]])or(e[""..a[l]..a["LTGApG6DR"].."\98\108\101"]["\117\110"..a[F].."\97"..a[G].."\107"]));local C=(e[""..a[l].."\111"..a[b]..a.AU7P1pR..a[m].."\98\101\114"]);local z=(e[""..a[s]..a[r].."\108\101\99"..a[l]]);local le=(e["\114\97\119\115"..a[r].."\116"]);local le=((e[""..a[m]..a['LTGApG6DR'].."\116"..a[P]]["\108"..a[O]..a[r].."\120"..a[F]])or(function(e,n,...)return((e*x)^n);end));local m=(e["\115\101"..a[l]..a[m]..a[r].."\116\97"..a[l]..a["LTGApG6DR"]..a[i].."\108\101"]);local se=(e[""..a[F].."\97"..a["Q0P5g73"]..a[y]..a[s]]);local m=(t["\98"..a[b]..a[B].."\116"])or(function(e,...)return(g-e);end);local F=(t[""..a[i].."\111\114"])or(function(e,n,...)return(g-T(g-e,g-n));end);N=((t[""..a[y].."\115\104\105"..a[v]..a[l]])or(function(n,e,...)if(e<f)then return(U(n,-(e)));end;return(k(n%x^I/x^e));end));U=((t[""..a[D]..a[s].."\104"..a["Q0P5g73"]..a[v]..a[l]])or(function(n,e,...)if(e<f)then return(N(n,-(e)));end;return((n*x^e)%x^I);end));T=(t["\98"..a.LTGApG6DR..a[b].."\100"])or(function(e,n,...)return(((e+n)-d(e,n))/x);end);if((not(e["\98\105\116\51"..a[M]]))and(not(e["\98\105"..a[l]])))then t[""..a[i].."\110"..a[B].."\116"]=m;t[""..a[i]..a[B].."\114"]=F;t["\98"..a['r4FUfGr'].."\111"..a[y]]=d;t["\108"..a[s].."\104"..a['Q0P5g73'].."\102"..a[l]]=U;t[""..a[y]..a[s].."\104\105\102\116"]=N;t["\98"..a['LTGApG6DR']..a[b]..a[O]]=T;end;local F=(((e["\116\97"..a[i]..a[D].."\101"]["\99\114"..a[r].."\97"..a[l]..a[r]]))or((function(e,...)return({u({},f,e);});end)));local x=(e[""..a[l]..a["LTGApG6DR"].."\98"..a[D]..a[r]][""..a["Q0P5g73"]..a[b]..a[s]..a[r]..a[y].."\116"]);local s=""..a[te]..a.TxIMY03h.."\37\100\43\41\58";local x=(e[""..a[l].."\97"..a[i]..a[D].."\101"]["\114"..a[r].."\109\111\118\101"]);local b=(e[""..a[l].."\97\98"..a[D]..a[r]][""..a[G]..a[B]..a[b].."\99\97\116"]);e[""..a[i].."\105\116\51"..a[M]]=t;local e=((-W+(function()local x,e=f,n;(function(n,e)e(e(n,e)and e(e,n),n(n,e))end)(function(o,l)if x>ae then return o end x=x+n e=(e+K)%de if(e%Z)>=X then return o(l(o,l),l(l,l))else return l end return o end,function(o,l)if x>q then return l end x=x+n e=(e-ce)%j if(e%ee)<=fe then e=(e-H)%re return o(o(o,l),l(o,o))else return l end return l end)return e;end)()));local l,x=J(function(l)local x,e=l()local o,l=x(l(C),e)local x,e=x(oe,f,nil,e)return C(V(e,s))-C(V(l,s))+n end,function(e)if e then return function(e)return e()end else return J,''end end) local t=(#_+(165));local r,D=({}),({});for e=f,t-n do local n=xe(e);r[e]=n;D[e]=n;D[n]=e;end;local b,x=(function(l)local x,o,a=p(l,x,((#{995;(function(...)return 684,955,331;end)()}-1)));if((x+o+a)~=(248))then e=e+(151);t=t+(33);end;l=h(l,((47-#("why did you pop up i came all over my desk"))));local x,o,a=(""),(""),({});local e=n;local function d()local x=C(h(l,e,e),((50-#("I love farting"))));e=e+n;local n=C(h(l,e,e+x-n),((124-#("Ara ara, this looks kinda big for someone of your calibre... Also Pratham#6969 was here!"))));e=e+x;return(n);end;x=D[d()];a[n]=x;while(e<#l)do local e=d();if r[e]then o=r[e];else o=x..h(x,n,n);end;r[t]=x..h(o,n,n);a[#a+n],x,t=o,o,t+n;end;return(b(a));end)("PSU|1p25r101022G22919276225218181721721F1j1b1q22i1Z1D2762311c1A1e21m214151r1T1L131e192232171527621t21E101M1h24f26l16276220219141d1o1S1522x1427622D1H28g25D24j1F27622V121h161j1m1q181H1l29527z1926f23o28D1022P18141F1d1R24F26K1727622i21h121F1b1c1m24y25G2841023827Y28021p22b1B276234121t1r28y1n21721K1I1s2341q1327622121m21E23K25q28U1023B27V1t1h21m21O1F151p1I1D1e29025k24P29W22B21N29l1R2602B42a41J1227n21b2202A31021u21c1N141A1x21116171q1722L1Y1C27622R1b1D161829P171d151V1J24k25L18276239161m1N1M1529523c1H2Cc1028W1H1n1H1T1s1026p23S1a2by2C02c229p11161o21M21Z28N1022u1F1r1N1828m27621V217191L22I2192aH102371A1n22y1d27A2Ap1i171H1s1c181e1h21j2232Cn2CE2Cg162Dt1l21P2282cN21U2191B1T21q21q2EH24u25K2dU21t1y1n1t1v1n1L1h1122O102D822621b2E022P29q27622a21J2c32A81w27h27J28B29B21Z2122E021821923h1K27N102222bQ2Bs171w21I2bM1v1A1623y26n2d823b1m181T21j2272bx1022W29L28H1J1R1D2Er16112Ds2Du22S2D31C2A61P152982421G28O2122cg21n2131U15112132fu142FW162232112bI22r1H1j1i1r1r2Cg141j1N24929k27622E21f161N27W21t1T28327622c1z1i101B25E24r29l102hn2HP27W21s26C25z112761a24d24B2g82hW2HY1B21P2H32H52232102CY2d92Db2Ch1Q28029g22W1v1R27621w1x13171K1P1O21J2DI1l2132161A2dx1821a2J821d2fc2BT24l2672dU2eF2eh21R2152aS1621p22a2Ip2241z1821G2il2FX21221W2i321v2181t1n1Y21e1s25B25t2k42dI1F19121126r2402I32cp2HP1b1O25325h2D822q27N1325C24K2EE2hX1M21h21D1j1626B2442Dn2341S1U26624N2bi2Jw2gN1d21r21c1H1R1P142602kY27622U2Gd2gf1t2GH24v25I2I322b213294101L2kj2491e2F621j1B1a111n1X21I1h101T17191K21c2242Ao22C21D192dj1v2lU2H22FV2fx22321429B21V1521g1j2e023G1V29b2202151F1a181924Z25V29w22c2121J181526m23z2Fn2262171H131o1t1p2122181J1p1e1N26D24C2BI2371M2cf171N2au2bE1026z2432d822821d1l28k2391o27622b21M141O1P1D1L2LU1121O21F151D1s1621R1Z2lG192fj23z26A2dU22821o28I1S1n21H2ka2722l727621y191P21n22W29w22T1N2Mg1t24k2kD28v28X2bD2kP2622bB2i421j1D1P1g23g29327B1y1Q2cf21321J2iB1R1122N23621B152nb26H23q2d82382bR1g21222A2mf102f72Oi2qL122Ev1121J21327w2l41222P2J22762PA2PC1N1123B1B2AO2QX28k1a2R02eW1y21b2qG1722i2HU102b6111r1624I2602M61021y21B171a2rN2rP2J711151822o2Dt2oM2lJ2pR1b2152KA21D22l29W2OG1f2bT21c21Y29w2A51r2bS26b2If2Q91B1H1P1921I2LJ2lL142342E02PJ2Qk192142141M1R1522U2BI2271X1b2141Y2K721D21p14182mX29B2361J2na1B1221V2122Cn2O52mF2MH2mj21727927623b2NT2j5131h122js22j2DN22t1M1321422e2s0236171R21d2182o61m2O821M21f1p1k2272IO27621z1y1h2mu2H42fX26f23r29w22U2C51V1M21P22k2d822f21E191821322c2Pr2s11z112Mb1j1D21N21I1I21n2191N1N21021H10161r1b2rd1h22P172dn22A21F1O24v25u2d822C21n101321b2222Du22X1Q21821o12122c01123h1U2i32WS21821P2dx1L1y2wq2851y2w61m101S1T1b24226y2Qv2u31s1127n111B1u2A61v1L1N2E92542Lx2762O52mv1622p2H027621322S21X2mz21813131T21t2602682BI22e21R2rw112fm21l2Gv1N1v22y2ke2dj102Ew23H2N62iz1x171g1R1q1u22S2du22a21N1e1f1s21F21H2lL21f2Y82XZ172w72Mi21R2222hY2rt21k1a2ev2C52b11m21G2pb1L1I192ES26y24e2du22E14112K01625l2lP102212131Q1y2Q32q526F2411j2xz2892172171S1Q2Bm152VX1d2xp1q1T1T1d2422G02U91m1J1S26X2OE2762381t2nB25925s29B22r1c2xN2R024i2jl28E2131V2m21n21C2172Wd2Z527622p1K2rV1s2Su101r24I2632fN21U311r1A152972FB27i1Q23128k2Yy162be21G22C2G82fg2E021I2Me2MG2MI1K1u2331227622N1o22m312E2s12n22e026q2M527622621N1o1F2O82MD1k141G2d021221S2Dn2372hP1x22b2Gt1022021P1O1c1f2d31D21i21P31202102l3162182u8102DH191J2bD2cR1n21d2sr2Xz2uD1m1P2542652bI2lz2Zj1921d310G1G1822v2IP2s22Dc312n2bM2Hi2yQ2I32361n313c311y1n25l2i22F62Ho131b2ah23r2YG2762lf2bE21O2pB28J2Hj2692IP21z2ka21M310724Z2662cN2381r1S2ZI2sU192102x9102IH2hz2132132NC21j2eD2hv2Mp2mr2LU238276316F1026O25R2432q12Mo141C1u26c2Kl316A2pr2Nj17219314C2RT21n2sd25c2ld316a1T1c2V72h523Y2XJ276235313D1g1g21m21C1121d2nQ2mq1l2mS1624f26E2Fn2f42141421k1L21M21b1322H310X1723V3172310b2Gy2h02W0181f2hp26024q29B2O5161h2Uq2I12i32MO317421i2w126Y23P2I321Z21H314x310y25425s2QV2dA2Dc162AW2nb313T1h2a927w2162vI27o1C2oi21y2152i322321a1s21m2181b1121p2uh27622x2BS1p2Yr319o1727E2bx1223o311129X2EA24Z2642iP2cp1Q1b2hh2CH1726U318P27621X2171F2972kj23R313N22r2Ww2c0315p171O1N2c62C62eV21p22M29B319p1t2e824f2712xD102ha2bm2Ev319I2Uu2Uw21l2Ls2gg1126X316R2cO181B2kh319k2N5311e1H31bj141R2552622G82371i1N2n3172mh1L29g1629929b2og2HI27j2512xy103150313C1G2uv24F315L27o2wx1D1f1v1U2hD1T24826f2G8310c2OQ141e314v31a82Lc2o42892hP1415319k2r02oD2QV22B21e1o21g2tD101i312G21J21j31cD2UV2342F510313631382O82Fb2Kg1221p223310k31CB2uQ2uS31b92o931bb2gE31bd132322Dn22V31bi24l29v2pW2hB1424I2ks2oM21i141l21J2252S02bk1r318821p2gV181o21121f310Y25k259316g21S26726726k2Q122U1A2Ah2es22Z31Bn31B61H2232162D822V162e023Y28c31EC2hp1226D2vb2q92QB1M26Q24229w28P28G22N26r25R2s02f72F91H1z21f31E32Ou26K23u2cn310c31C031C231C42762321r31DP314A313m2t9151o2cq315Y1y31af31Ah2X02I32F4310W1829E2Dh29W2fp1d21721923Z26B2cn2v42rK293161B23h2s92bY31bo19142e42Kz12182a831hn27024F2Cn2cP2yU316N1u24826M29w2gL2O81i23i1J2IP22a2r42IK2y122p2T8313O313Q313s313u26e2nN2Dg21I29L1n27j21J2bw1831bx1C23G2Qv2cP2xM2Xo2xQ2XS2xU2e922O2CM315e2112Z92xf2mi2211w2S02v41H21C1x1m1G31hd31272sO17248317P2Ra21r2br2BT2FT2y125L24L2dU22f21i1d1721K1z1l102ex2EZ31AD21731gj2382FM2BY31Am1d21m2W12OI1D2UF26f23L2DN2321B1i1Q2Sc2cD1r2XR2a72a92aB2ad25b2RZ31Ec1n311G2hz2Hp2oU2ht31AW2rA315I2pd26o29A2dG31ip31bx2272h8315E21l1K21E312O2u51k22y1L2g822B21o1Q1R1A21J310722321p31DW2Cp310N310P310r310T310V310X1D22o1i2BI31jC2S82sA2Cg1b21I316931B431BJ1L2Wd1H2bX22r2S02bz1931dS1g152hp2q431ce23k26R2762ib2iB316G122LL316g31de1H24r24O31n32vT1J21R2192762Ww1I1H2162152762YB31NL23s23v276141431NL22n22k276151531nl21k2wm2w61631nl25C25f276171731NL25k25n27631gZ31nL24e24d2762Mq31nL1A2Du1a1A31nl22f22c2761b31Ko1h2452462761C1c31nl23v23s2761d1D31nL22G22J2761E1e31Nl22X22Y2761f1F31Nl31BI276317D31NL24g24j276319431nL24924A2761I31q029431b3314731nL25I25h2761k1K31nl24b24827629531Nl2512522761m1m31Nl1M31k3102w231OJ31oL101O1O31Nl24i24H2761P2AY1H23C23f2761q1Q31nl24c24f2762hE31nL2332302761s1s31NL1e2Fn310X31nl23E23d2761u31cn1H2272242761v1v31Nl22w22Z2761w1w31nl24o24R2761x1X31Nl22e22d2761Y1y31nl24M24l2761z2hx1H24V24s27621021031nL21921a27621121131nL21U21t27621221231nL2562552Y521331Nl23J23g2762TC31NL22622527621521531nL21d2871021621631nl25r25o276310N31NL25825B27621821831nL21C21F27621921931NL22A22927621A21A31NL23523627621B21B31nl21i2w51021C21C31nl22t22u27621D21D31Nl23923a27621E21e31nL22k22n27621f21f31Nl192IP21G21G111t21431vC1131nK28A24c31NP1331nL1P1q31Nu31nW1h25525631O031o22E321G2761631o72Cs1U31oB31oD1h21a31ni1031oI1H22222131OM1931Nl23Q23P2ic31os1h25925a31Ow31oy24624531p231P41h25h25i31P831pa1H21721431PE31Pg1H22922a31PK31pm1h21z21W31pp1G31nl22D22E31pU1h31Nl23n23k31pz31q11b2cN31Q41h23W23z31q831Qa1h22b22831qe2Zx1H24q24p31qj31Ql1h25425727631qQ1H23f23C27631QU31nL22j22G31qZ31r123h23i31R531r71h21E21D31Rb1r31nL21x21y31rg31ri1H25g25j27631rm1h25E25d31rq31rs25D25e31rw31Ry1H24324031s231S41H23423731S831SA1h2b031Se31sG2mF2DN31sL31NL22O22R31sq31ss1H1O2iY1031sX31nL24S24v31t231T428y29W316531nL2kI31TD21431NL24J24g31tI31tk1H25f25c27631tP31Nl1u1t31tu21731Nl22z22W31tZ31U11h23i23H31u531U71h21Q313X1031uC31nl25a31Ez1031ui31NL22l22M27631Uo31QM31qO31uU31nl142i331v031nl1V2Cu1031V631nl25325027631VB31VD31vf2Ww31vi22H22i31Vl31nl22m22L31vQ31nL22u22T31vv31Nl22c22F31Vz31W123823B31w431Nl23g23j31oH1831nL21b21831we31nL23723431Wj31NL1G31dW31oX31nl21521631ws31nL315131wX31nl21p21q31x231nl21L21M31x731nL25225131xc31nL23o23R31XH31nL21421731XM31Nl21v21s27631xQ25m25L31XU31nl1y1X31Xz31nL23X23y31Y431Nl21M21L31Y91n31nl25n25K31yE31QV1H25B25831yJ31Nl21o21r31YN31nl21R21O31ys31Nl23T23U31YX31nl23b316E2PS31nL23z23w31Z731nl22122231zB31nl1S311N1031s331Nl22v22s31zL31nl21y21X31Zp31Nl21W21z31Sk31SM1z1w31Zx31nL24824b31sw31sY1H210213320731nL25L25m31t831Nl23r23O320E31nL213210320J31NL21f21c320O31tq1H24l24M320T31nL236235320y31Nl24z24W321331Nl25J25g31uB31UD1H22I22H31UH31uj1H23m23L321I31Up1h22q22P31ut31uV1h21g21j31uz31V11h1W1Z31V531v71H212211321Z31Vc31ve21G2YB31vI172D831NQ1h24T24u322b1H24H24I322F1h23A239322J31NL21n21K322n1H23y23X322R31nL231232322w31Fd22032301H22022331Wo31nL24u24t32381H22Y22X323b1h23D23E323f1H21T21U323j2Wb22Q323N1H21s21v323R1h1q1p323V1H225226323z2hc1H21h21I32431h23l23m32472hb313N31Qk31Uq31Us31qP324g1H242241324K31nL24Y24X324P1h21821B324t2Lk2Ol312031YT1H25025332511h22s22V31z21T31Nl24X24Y32591H1f2g831Rx31NL23p23q31zG31NL31vh325m31pv325Q1h24P24q325u31nL24N24k325Y1H24K24N326231nL313s32671H257254326B1h247244326F31XI2qV31tJ31nl230233326N31NL25Q25P326s1H25P25q326W1H24D24e32701H241242327431nL24A249327931nl31MX327E31Nl22822B327j31NL1X2xB10321Q1H24w24Z327T31nl1K2vq3220328031nV31Vi24024331vl31vd1V1331O12WW2D32I32Wn31vM1H23k23N31VQ1131QK31N531O131Nl32Dx322J23n23q26b26E31VQ25Z25z31Pz29S2Cn31gZ31s931Gz24724731Gz32e01K2dN31On1h23U23t32301c24E31xl2hZ31Ko1C24131xT1031P331S931P322822831P332e432dy1031p91132B7312u1031Pf1127E2S031p311313s1231p332fm31Lv316f32341h22r2Ey32F3311G2Ma1a31p331or112KH2ip31gz23N24325j32ed2Ez1426F26f32ee2g331vQ31s931nV23123131NV32En2DN32e31H211212322J32G41E29B31Nv1I1c25131s732gC32gJ1421X21x31nv32H432gI21n1u1423f23F32gy1H22422732Gu1932gW32Dz1k31qo316f21H21h2VT31N932GC31N331k431n9111I31dW31k42Vt1u325g32i22YL32hp31nJ32FG316G"),(#_-((117-#("lIlIlIIlIlIlIlIlIlIlIlIlIlI"))));local function r(e,n,...)if(e==265667999)then return(((d(n,475643))-882899)-341523);elseif(e==462079251)then return(d(d(d(d(n,99948),666106),285057),467490));elseif(e==18870851)then return((d(d(n,733532),101556))-409290);elseif(e==450246525)then return(d(d(d(d((n)-286005,519771),427595),903969),681505));elseif(e==328188766)then return(d((d((n)-168660,628154))-724495,105224));elseif(e==143097007)then return(((((n)-677873)-619421)-439916)-5528);elseif(e==348904614)then return((d((n)-808321,91718))-985021);elseif(e==323485595)then return(((((d(n,875645))-974230)-828040)-233775)-793611);elseif(e==184075630)then return((d(d((n)-864427,387051),683313))-538650);elseif(e==621988093)then return((d((d(n,527283))-473423,778113))-874417);end;end;local function n(n,e,...)if(n==485142576)then return((((((e)-483253)-774362)-216399)-917789)-934930);elseif(n==393803222)then return(d(d((e)-331364,926657),756037));elseif(n==126171675)then return((d((d(e,678721))-782426,840100))-924541);elseif(n==888316926)then return((d(d(e,369697),688812))-429651);elseif(n==369751645)then return((d((d((e)-501943,483398))-423945,145989))-171408);elseif(n==596410590)then return((((((e)-599208)-434131)-162091)-386944)-482923);else end;end;if _ENV then _ENV._ENV=_ENV end;local m=a[(507794141)];local s=a[(852430190)];local B=a[(986588717)];local A=a[(400982159)];local l=a[(76853149)];local y=a.Wx1hNy;local n=a[((168688357-#("sus")))];local C=a.TYOdYZP9Xx;local function i()local o,l=p(b,x,x+A);o=d(o,e);e=o%n;l=d(l,e);e=l%n;x=x+A;return((l*n)+o);end;local function f()local o=d(p(b,x,x),e);e=o%n;x=(x+l);return(o);end;local function t()local t,a,l,o=p(b,x,x+s);t=d(t,e);e=t%n;a=d(a,e);e=a%n;l=d(l,e);e=l%n;o=d(o,e);e=o%n;x=x+y;return((o*m)+(l*B)+(a*n)+t);end;local function s(x,e,n)if(n)then local e=(x/A^(e-l))%A^((n-l)-(e-l)+l);return(e-(e%l));else local e=A^(e-l);return(((x%(e+e)>=e)and(l))or(C));end;end;local g="\35";local function n(...)return({...}),z(g,...);end;local function q(...)local H=a[(993295353)];local J=a.nyx3YMYt;local P=a[((#{789;662;453;(function(...)return 220,124,153,...;end)(704,787)}+921296838))];local A=a['B9iq4j9p'];local X=a.zMnkLGdL;local Z=a[((#{}+238274987))];local z=a.N6ecBnyyJw;local T=a[(637149635)];local B=a[(434427804)];local C=a['Wx1hNy'];local j=a[((358176695-#("apt install sl -y")))];local G=a[((#{149;255;(function(...)return 602,616,889,...;end)(487,492,830,65)}+168688345))];local V=a[(908967466)];local M=a[((#{635;(function(...)return;end)()}+416419852))];local y=a[(400982159)];local N=a[((#{560;243;550;(function(...)return 1;end)()}+879264072))];local U=a[(779795515)];local v=a[(632155518)];local _=a[(873845360)];local I=a[((852430206-#("Elysium over all")))];local r=a[(714721162)];local m=a[((510004538-#("i want to give fed a c0ck and ball t0rture")))];local O=a['NYWVnE4'];local n=a[(76853149)];local l=a['TYOdYZP9Xx'];local Q=a[(884867231)];local function F(...)local a=({});local g=({});local u=({});for c=l,t(e)-n,n do local i=f(e);if(E(S(i,r),B))then local e=o(f,e);a[c]=(ne(e,l));elseif(E(i%r,C))then while(true)do local t=o(t,e);if(E(t,l))then a[c]=('');break;end;if(ie(t,_))then local l,f=(''),(h(b,x,x+t-n));x=x+t;for n=n,#f,n do local n=o(d,p(h(f,n,n)),e);e=n%G;l=l..D[n];end;a[c]=l;else local n,l=(''),({p(b,x,w(x+t,n))});x=Y(x,t);for x,l in se(l)do local l=o(d,l,e);e=l%G;n=n..D[l];end;a[c]=n;end;break;end;elseif(S(i,r)==l)then while(true)do local d=t(e);local x=t(e);local t=n;local d=Y((R(s(x,n,z),(L(y,A)))),d);local e=o(s,x,r,M);local x=(L((-n),o(s,x,A)));if(E(e,l))then if(E(d,l))then a[c]=k(R(x,l));break;else e=n;t=l;end;elseif(e==N)then a[c]=(d==l)and(x*(n/l))or(x*(l/l));break;end;local e=R(le(x,w(e,v)),(Y(t,(d/(y^H)))));a[c]=e%n==l and k(e)or e break;end;elseif(i%r==y)then while(true)do local e=t(e);a[c]=h(b,x,x+e-n);x=x+e;break;end;else a[c]=nil end;end;local x=t(e);for e=l,x-n,n do u[e]=({});end;for p=l,w(x,n),n do local x=f(e);if(x~=l)then x=x-n;local D,r,A,c,d,b=l,l,l,l,l,l;local h=o(s,x,n,I);if(h==B)then elseif(h==I)then b=(f(e));d=u[(t(e))];r=(i(e));c=(o(i,e));elseif(h==l)then b=(f(e));d=(i(e));r=(i(e));c=(i(e));elseif(h==y)then b=(o(f,e));d=u[(t(e))];c=(i(e));elseif(E(h,m))then b=(f(e));d=(o(t,e));r=(i(e));c=(i(e));A=({});for x=n,r,n do A[x]=({[l]=f(e),[n]=i(e)});end;elseif(h==n)then b=(f(e));d=(t(e));c=(o(i,e));end;if(o(s,x,m,m)==n)then d=a[d];end;if(E(s(x,B,B),n))then r=a[r];end;if(o(s,x,C,C)==n)then c=a[c];end;if(s(x,T,T)==n)then D=u[t(e)];else D=u[p+n];end;if(s(x,P,P)==n)then A=({});for e=n,f(),n do A[e]=t();end;end;local e=u[p];e[Z]=c;e['a9OzMnF']=A;e[U]=b;e[-V]=D;e[X]=r;e[J]=d;end;end;local x=o(i,e);for e=l,w(o(t,e),n),n do g[e]=o(F);end;local e=f(e);return({['ydH1UnBTAE']=g;[-Q]=a;["IGAfu"]=l;[-823056.7990662534]=x;[-O]=e;[-j]=u;});end;return(F(...));end;local function p(e,n,h,...)local C=e[-496694];local s=e[-823056.7990662534];local y=e["ydH1UnBTAE"];local t=e[-740045];local i=0;local e=e[-162421];return(function(...)local E={};local D={...};local l=570592;local o=-516693;local f=644725;local A=(z(g,...)-1);local B=370851;local n={};local e=({});local b=-(1);local e=(true);local x=471591;local i=C[i];local e="a9OzMnF";local e=(188425302);local e=1;for e=0,A,e do if(e>=t)then E[e-t]=D[e+1];else n[e]=D[e+1];end;end;local A=A-t+1;repeat local e=i;local t=e[B];i=e[o];if(t<=r(d(178329102,a[193352076]),379427))then if(t<=r(d(521581879,367947865),1368998))then if(t<=r(d(39864209,300909775),511860))then if(t<=((c[142684551])or(a[287202669](d(247930900,249028694),d,c,142684551))))then if(t==((c[656746192])or((function(e)c[656746192]=d((d(e,333388))-200255,522279);return(c[656746192]);end)(d(800968409,a[193352076])))))then n[e[l]]=n[e[x]][e[f]];elseif(t<=r(d(637017160,a[819509025]),820003))then end;elseif(t==((c[829121319])or((function(e)c[829121319]=(d(d(d(d(e,575676),553586),795393),753679))-863016;return(c[829121319]);end)(d(924371992,a['RG2g0lInaF'])))))then local r;local t;local c;local d=0;local function a(n,e,l)e=(d+e)%3 d=((e~=0)and d+((1==e)and n or-n)or d*n)%l return d end for o=1,25 do if a(9289,2778+o,702)<351 then if a(1199,7658+o,508)>=254 then if a(8927,2470+o,1282)<641 then r=l;else n[e[l]]=h[e[x]];end else if a(1414,3706+o,936)>468 then n[c]=t;else n[e[l]]=n[e[x]]+e[f];end end t=e[x];else if a(9150,2655+o,1536)<768 then if a(4636,4560+o,3616)<1808 then n[e[l]]=e[x]-e[f];else c=e[r];end else if a(3151,1322+o,676)<=338 then else if(e[l]~=e[f])then i=i+1;else i=e[x];end;end end end end local t;local f;local c;local d=0;local function a(e,n,l)e=(d+e)%3 d=((e~=0)and d+((e<2)and n or-n)or d*n)%l return d end for o=0,33 do if a(2256,6015+o,3802)>=1901 then if a(9597,2716+o,2776)>1388 then if a(6803,8631+o,244)<122 then c=e[t];else end else if a(6659,9358+o,2812)<1406 then else end end n[c]=f;else t=l;if a(7534,6356+o,612)>=306 then if a(5962,1307+o,3220)>1610 then else end else if a(3206,2129+o,2358)>=1179 then else f=e[x];end end end end n[e[l]]=e[x];e=e[o];local f;local c;local t;local d=0;local function a(e,n,l)e=(d+e)%3 d=((e~=0)and d+((1==e)and n or-n)or d*n)%l return d end for o=2,26 do if a(1805,7782+o,2806)>=1403 then if a(9075,4396+o,3464)>1732 then if a(4212,7049+o,3936)>=1968 then else end else if a(9006,5609+o,3138)<=1569 then else n[t]=c;end end else if a(6023,6863+o,2370)>1185 then if a(4477,3713+o,328)<=164 then else end else f=l;if a(4238,9471+o,3294)>=1647 then c=e[x];else end end t=e[f];end end n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];e=e[o];elseif(t<=r(d(564011733,a[709209496]),511860))then local t;local c;local d;local a=0;local function o(e,n,l)e=(a+e)%3 a=((e~=0)and a+((1==e)and-n or n)or a*n)%l return a end for a=1,28 do if o(7902,6941+a,786)<393 then if o(5285,2636+a,3148)>1574 then if o(7792,6272+a,1234)>=617 then else t=l;end else if o(1086,9937+a,3452)>1726 then else n[d]=c;end end else if o(4365,1582+a,2880)>1440 then if o(9952,5126+a,2064)>=1032 then else c=e[x];end else if o(1412,3839+a,784)<=392 then else d=e[t];end end end end end;elseif(t<=d(13940377,13940380))then if(t>r(621988093,379440))then local l=e[l];n[l]=0+(n[l]);n[l+1]=0+(n[l+1]);n[l+2]=0+(n[l+2]);local o=n[l];local a=n[l+2];if(a>0)then if(o>n[l+1])then i=e[x];else n[l+3]=o;end;elseif(o<n[l+1])then i=e[x];else n[l+3]=o;end;elseif(t<d(547903261,547903256))then n[e[l]]=F(e[x]);e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];local c;local t;local r;local d=0;local function a(n,e,l)e=(d+e)%3 d=((e~=0)and d+((1==e)and-n or n)or d*n)%l return d end for o=0,30 do if a(9664,7322+o,3912)<=1956 then if a(8990,7580+o,3076)<=1538 then if a(3766,3400+o,1588)>=794 then else end else if a(9149,9550+o,1276)>638 then c=l;else end t=e[x];end else if a(5157,3095+o,996)<=498 then if a(5130,6626+o,1054)>527 then else r=e[c];end n[r]=t;else if a(4933,1572+o,1914)<957 then else end end end end n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];local r;local t;local c;local d=0;local function a(e,n,l)e=(d+e)%3 d=((e~=0)and d+((e<2)and-n or n)or d*n)%l return d end for o=0,27 do if a(5512,7231+o,3892)<1946 then if a(2288,5615+o,1022)<511 then if a(8534,9192+o,1224)<612 then r=l;else t=e[x];end else c=e[r];if a(6030,8156+o,3966)<=1983 then n[c]=t;else end end else if a(9238,7374+o,2576)<1288 then if a(2859,7276+o,3694)>1847 then n[e[l]]=n[e[x]]+e[f];else end else if a(1344,3463+o,3084)>1542 then else end end end end n[e[l]]=e[x];e=e[o];local c;local t;local f;local d=0;local function a(e,n,l)e=(d+e)%3 d=((e~=0)and d+((1==e)and-n or n)or d*n)%l return d end for o=1,27 do if a(7282,4927+o,1746)>=873 then if a(4658,1538+o,3570)<=1785 then if a(4050,1498+o,334)<=167 then else end else if a(4859,8050+o,3038)<=1519 then f=e[c];else end n[f]=t;end else c=l;if a(6749,1190+o,1444)>722 then if a(9511,3958+o,2146)>1073 then t=e[x];else end else if a(3383,4593+o,1426)>=713 then else end end end end n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];e=e[o];end;elseif(t>d(531465608,a[657456965]))then n[e[l]]=F(256);elseif(t<d(627598738,627598741))then n[e[l]]=n[e[x]];e=e[o];n[e[l]]=e[x];e=e[o];local a=e[l];n[a](u(n,a+1,e[x]));for e=a+1,s do n[e]=nil;end;e=e[o];n[e[l]]=h[e[x]];e=e[o];n[e[l]]=n[e[x]][e[f]];e=e[o];n[e[l]]=n[e[x]][e[f]];e=e[o];local a=e[l];local d=n[e[x]];n[a+1]=d;n[a]=d[e[f]];e=e[o];n[e[l]]=e[x];e=e[o];local l=e[l];n[l](u(n,l+1,e[x]));for e=l+1,s do n[e]=nil;end;e=e[o];e=e[o];end;elseif(t<=11)then if(t<=d(227332190,a["wLz5d0diM"]))then if(t>r(d(253282984,476001587),2519325))then local l=e[l];n[l]=n[l](u(n,l+1,e[x]));for e=l+1,s do n[e]=nil;end;elseif(t<9)then local l=e[l];n[l](u(n,l+1,e[x]));for e=l+1,s do n[e]=nil;end;end;elseif(t==10)then n[e[l]]=n[e[x]];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=h[e[x]];e=e[o];n[e[l]]=h[e[x]];e=e[o];n[e[l]]=n[e[x]][e[f]];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=#n[e[x]];e=e[o];local a=e[l];n[a]=n[a](u(n,a+1,e[x]));for e=a+1,s do n[e]=nil;end;e=e[o];n[e[l]]=n[e[x]][n[e[f]]];e=e[o];local a=e[l];n[a]=n[a](n[a+1]);for e=a+1,s do n[e]=nil;end;e=e[o];n[e[l]]=e[x];e=e[o];local d=e[x];local a=n[d];for e=d+1,e[f]do a=a..n[e];end;n[e[l]]=a;e=e[o];local l=e[l];n[l](u(n,l+1,e[x]));for e=l+1,s do n[e]=nil;end;e=e[o];e=e[o];elseif(t<=r(d(929394129,766728876),729680))then local o=e[x];local x=n[o];for e=o+1,e[f]do x=x..n[e];end;n[e[l]]=x;end;elseif(t<=13)then if(t==((c[583165635])or((function(e)c[583165635]=(d((d(e,425007))-55832,837623))-842644;return(c[583165635]);end)(d(130200495,a[181642124])))))then n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];local f;local c;local t;local d=0;local function a(e,n,l)e=(d+e)%3 d=((e~=0)and d+((1==e)and-n or n)or d*n)%l return d end for o=2,30 do if a(1839,2799+o,3124)<1562 then if a(3647,4077+o,3462)>1731 then t=e[f];if a(3228,9086+o,3494)<1747 then else n[t]=c;end else if a(2672,2603+o,3400)>=1700 then else f=l;end c=e[x];end else if a(4579,7055+o,2550)>=1275 then if a(4889,4500+o,2970)>=1485 then else end else if a(8372,2473+o,666)<=333 then else end end end end e=e[o];elseif(t<=r(265667999,1437448))then n[e[l]]=n[e[x]][n[e[f]]];end;elseif(t>r(d(773794661,a[819509025]),d(923147631,a['RG2g0lInaF'])))then local r;local c;local t;local d=0;local function a(n,e,l)e=(d+e)%3 d=((e~=0)and d+((1==e)and-n or n)or d*n)%l return d end for o=1,31 do if a(2323,5097+o,202)>=101 then if a(2632,4310+o,486)<243 then if a(9334,8513+o,3926)>1963 then local o=e[x];local x=n[o];for e=o+1,e[f]do x=x..n[e];end;n[e[l]]=x;else n[e[l]]=n[e[x]]+e[f];end else if a(8211,8802+o,1170)>585 then n[e[l]]=e[x]-e[f];else r=l;end end else c=e[x];if a(1214,6150+o,842)<421 then if a(7846,6714+o,844)>=422 then n[t]=c;else if(n[e[l]]==e[f])then i=i+1;else i=e[x];end;end else if a(9926,3933+o,2734)>=1367 then t=e[r];else n[e[l]]=n[e[x]];end end end end n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];local t;local f;local c;local d=0;local function a(n,e,l)e=(d+e)%3 d=((e~=0)and d+((1==e)and n or-n)or d*n)%l return d end for o=1,29 do if a(8488,6583+o,3078)<=1539 then if a(7893,4695+o,2630)>1315 then if a(6449,9264+o,956)<=478 then t=l;else f=e[x];end else if a(5433,7636+o,1392)>696 then else end end else c=e[t];if a(6677,4581+o,2444)>=1222 then if a(4102,7141+o,2750)<=1375 then else n[e[l]]=n[e[x]];end else n[c]=f;if a(4005,5608+o,378)>=189 then else end end end end n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];e=e[o];elseif(t<15)then n[e[l]]=#n[e[x]];end;elseif(t<=23)then if(t<=d(965467093,965467078))then if(t<=r(462079251,578596))then if(t>r(184075630,1368987))then e=e[o];local x=e[l];b=x+A-1;for e=0,A do n[x+e]=E[e];end;for e=b+1,s do n[e]=nil;end;e=e[o];local l=e[l];do return u(n,l,b);end;e=e[o];e=e[o];elseif(t<((c[949409910])or(a.uYLpe(d(662423149,662280601),d,c,949409910))))then local l=e[l];local a=n[l+2];local o=n[l]+a;n[l]=o;if(a>0)then if(o<=n[l+1])then i=e[x];n[l+3]=o;end;elseif(o>=n[l+1])then i=e[x];n[l+3]=o;end;end;elseif(t==r(d(601432660,a['RG2g0lInaF']),1750794))then n[e[l]]=F(e[x]);elseif(t<=((c[804720373])or(a[232447556](d(435092404,434606355),d,c,804720373))))then local e=e[l];b=e+A-1;for l=0,A do n[e+l]=E[l];end;for e=b+1,s do n[e]=nil;end;end;elseif(t<=r(d(842807334,686427995),729658))then if(t==((c[155849050])or(a[470185843](d(311191027,312197450),d,c,155849050))))then n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];local c;local t;local r;local d=0;local function a(n,e,l)e=(d+e)%3 d=((e~=0)and d+((e<2)and n or-n)or d*n)%l return d end for o=2,26 do if a(8653,5908+o,2756)>1378 then if a(8817,6066+o,2920)<1460 then if a(1383,8505+o,2688)<1344 then else end else if a(8414,4364+o,1890)<945 then else local o=e[x];local x=n[o];for e=o+1,e[f]do x=x..n[e];end;n[e[l]]=x;end end else if a(4935,8461+o,1144)<572 then if a(3182,3003+o,3650)>1825 then else c=l;end else if a(3402,3961+o,2104)>1052 then r=e[c];else n[r]=t;end end t=e[x];end end n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];local f;local c;local t;local d=0;local function a(e,n,l)e=(d+e)%3 d=((e~=0)and d+((1==e)and n or-n)or d*n)%l return d end for o=1,31 do if a(1659,8570+o,1472)>=736 then if a(9793,9181+o,1666)<=833 then if a(2370,6400+o,2518)>=1259 then else end else if a(8839,8909+o,1154)>577 then n[t]=c;else end end else f=l;if a(9085,3726+o,1948)<=974 then if a(6265,6279+o,1594)>=797 then else end else if a(5038,6248+o,2708)<1354 then else c=e[x];end t=e[f];end end end n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];e=e[o];elseif(t<=d(751196755,a[545501104]))then do return;end;end;elseif(t==r(d(608602333,a[619238463]),379430))then n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];local c;local t;local r;local d=0;local function a(n,e,l)e=(d+e)%3 d=((e~=0)and d+((1==e)and-n or n)or d*n)%l return d end for o=1,29 do if a(1395,5172+o,890)<445 then if a(6637,8806+o,3298)>1649 then if a(6373,4955+o,2826)<1413 then i=e[x];else c=l;end else if a(3740,4250+o,3630)>=1815 then n[e[l]]=n[e[x]]+e[f];else end end else t=e[x];if a(9728,9360+o,210)<105 then if a(2609,8396+o,2934)<=1467 then r=e[c];else end else if a(1818,7623+o,946)>=473 then local o=e[x];local x=n[o];for e=o+1,e[f]do x=x..n[e];end;n[e[l]]=x;else n[r]=t;end end end end n[e[l]]=e[x];e=e[o];local c;local t;local f;local d=0;local function a(n,e,l)e=(d+e)%3 d=((e~=0)and d+((e<2)and n or-n)or d*n)%l return d end for o=1,30 do if a(2920,6497+o,1356)<678 then if a(8675,2111+o,1736)<868 then if a(3015,3906+o,274)>137 then else c=l;end else if a(5980,5229+o,570)<285 then n[f]=t;else i=e[x];end end t=e[x];else if a(7593,2370+o,1300)<=650 then if a(7080,4255+o,1654)>=827 then f=e[c];else end else if a(7622,8727+o,2424)>1212 then else end end end end n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];e=e[o];elseif(t<=((c[784763722])or((function(e)c[784763722]=d(((e)-59292)-983047,808780);return(c[784763722]);end)(d(273339349,274132267)))))then n[e[l]]=n[e[x]];end;elseif(t<=d(663829739,a[988803113]))then if(t<=d(619179538,a[819509025]))then if(t>r(462079251,578605))then n[e[l]]=p(y[e[x]],(nil),h);elseif(t<25)then n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];local r;local c;local t;local d=0;local function a(e,n,l)e=(d+e)%3 d=((e~=0)and d+((e<2)and-n or n)or d*n)%l return d end for o=2,29 do if a(4595,1597+o,3370)>1685 then if a(4178,8299+o,2910)>1455 then n[t]=c;if a(2396,4777+o,1086)<=543 then else end else if a(2860,4885+o,3642)>1821 then else end end else if a(5633,6395+o,2096)<1048 then if a(3433,5094+o,2556)<1278 then else n[e[l]]=h[e[x]];end else if a(7034,7426+o,2172)<=1086 then r=l;else n[e[l]]=n[e[x]];end c=e[x];end t=e[r];end end n[e[l]]=e[x];e=e[o];local c;local t;local r;local d=0;local function a(e,n,l)e=(d+e)%3 d=((e~=0)and d+((1==e)and n or-n)or d*n)%l return d end for o=0,29 do if a(2262,8129+o,2664)<=1332 then if a(1184,2400+o,1792)<896 then if a(9287,9244+o,3478)>1739 then else if(n[e[l]]==e[f])then i=i+1;else i=e[x];end;end else if a(6160,7720+o,868)<=434 then t=e[x];else c=l;end end else if a(5774,2817+o,1222)<611 then if a(7940,7794+o,2378)<1189 then else r=e[c];end else if a(1938,1759+o,2962)>=1481 then n[r]=t;else end end end end n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];local f;local c;local t;local d=0;local function a(n,e,l)e=(d+e)%3 d=((e~=0)and d+((1==e)and-n or n)or d*n)%l return d end for o=0,28 do if a(4206,4837+o,3758)<1879 then t=e[f];if a(4002,2060+o,586)>=293 then n[t]=c;if a(4019,5974+o,2010)<1005 then else end else if a(4231,1739+o,1368)<684 then else end end else f=l;if a(4682,7527+o,750)<375 then if a(5032,6655+o,2204)>1102 then else c=e[x];end else if a(8261,9866+o,1342)>671 then else end end end end n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];e=e[o];end;elseif(t>((c[853610302])or(a.OxqSe2I(d(617329488,618436844),d,c,853610302))))then local e=e[l];n[e]=n[e](n[e+1]);for e=e+1,s do n[e]=nil;end;elseif(t<((c[72897840])or(a[906868735](d(272897634,273299298),d,c,72897840))))then local l=e[l];local x=n[e[x]];n[l+1]=x;n[l]=x[e[f]];end;elseif(t<=r(18870851,819983))then if(t>((c[526471083])or(a[907711640](d(331156490,330864939),d,c,526471083))))then n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];n[e[l]]=e[x];e=e[o];e=e[o];elseif(t<29)then local l=e[l];local a=e[x];local x=50*(e[f]-1);local o=n[l];local e=0;for a=l+1,a do o[x+e+1]=n[l+(a-l)];e=e+1;end;end;elseif(t==30)then n[e[l]]=h[e[x]];elseif(t<=r(265667999,1437438))then local e=e[l];do return u(n,e,b);end;end;until false end);end;return p(q(),{},Q())(...);end)(({['wLz5d0diM']=(((227332204-#("please crush my balls"))));nyx3YMYt=(((471606-#(".cctor : void()"))));[((228982977-#("blacks suck")))]=((151));[(664693909)]=("\100");['LTGApG6DR']=("\97");[(607441919)]=((33));[(14566482)]=("\101");[(346261014)]=(((374-#("Perth"))));[(164981854)]=("\109");[(270459257)]=("\116");[(637149635)]=((8));[(657456965)]=((531465614));['Bc62t8m3M']=((387));[((908967496-#("Minuscule amount of tomfoolery")))]=((516693));[((#{24;(function(...)return;end)()}+897262706))]=("\99");[(887711453)]=("\98");[((#{352;857;(function(...)return 558,59,168,752;end)()}+709209490))]=((840032651));kjTBZxg=((16948));[((315458187-#("im gonna cum all over my fucking setup")))]=(((164981886-#("I own some people in my basement"))));["zMnkLGdL"]=(((644771-#("Big time nuts sticky sniff enjoyer111!11!!1111"))));[(447502305)]=(((1006-#("skorp"))));[((#{929;500;(function(...)return 83,509,...;end)(393)}+238274982))]=(((570644-#("Holy motherfucking hell perth logs scripts!!!11!!11!"))));[((733151022-#("apt install sl -y")))]=(((874512732-#("Jason Jackson Tanson"))));[(873845360)]=((5000));[((#{590;}+773173583))]=((759876983));['UiALUlI']=((226974827));[((852430199-#("big balls")))]=(((77-#("Overdrive is a skill based fighting game! Better than UCD or Soulshatters."))));[((232447593-#("TECHNOBLADE NEVER DIES #TECHNOSUPPORT")))]=((function(x,e,l,n)l[n]=e(e(e(x,(930273)),(736538)),(812623));return(l[n]);end));[(400982159)]=(((#{(function(...)return 700,249,391;end)()}-1)));["Cxo0j"]=((248));[((#{996;835;947;715;(function(...)return 78,671,664,991;end)()}+819509017))]=(((619179549-#("buy strawberry hub"))));[((#{(function(...)return 387,...;end)(49,234,784)}+879264072))]=((2047));[(287202669)]=((function(x,l,e,n)e[n]=((((l(x,(362955)))-((238958-#("p-pwease erp with me"))))-((19461-#("Buy shitsploit v4"))))-(870822))-((265924-#("perth is a n-n-n-n-n-n-n-n-n-n-n-n--n-n-nice guy")));return(e[n]);end));[((363041535-#("#pussythrobbing")))]=(((#{578;}+611)));[((30739677-#("DM me !obfuscate")))]=(((#{233;437;459;}+941104775)));[((#{350;844;887;349;}+921296842))]=(((#{378;215;(function(...)return 533,380,695,298,...;end)(953,669,458)}-2)));[(128336898)]=(((496268651-#("pept is a jew"))));["qGcRw"]=(((699-#("Perth"))));[((#{377;143;}+272326104))]=(((389-#("how do I compile lua into rust please help"))));[((#{706;}+76853148))]=((1));["AU7P1pR"]=("\117");[((#{}+650694760))]=((698674511));[(226974827)]=("\115");[((#{656;320;(function(...)return 197,975,118,94,...;end)(630,836,482,832)}+993295343))]=((52));['TYOdYZP9Xx']=(((42-#("why did you pop up i came all over my desk"))));Wx1hNy=((4));[((#{868;854;}+358176676))]=((496694));[(714721162)]=(((#{536;730;630;949;(function(...)return 642,429,75,419;end)()}+13)));[(986588717)]=(((65551-#("sussy imposter?"))));N6ecBnyyJw=((20));uYLpe=((function(x,e,l,n)l[n]=e(e((e(x,(486755)))-(27110),((#{(function(...)return 130,250,946;end)()}+230791))),(478506));return(l[n]);end));[(227986664)]=(((780436135-#("nigmode"))));[(884867231)]=((162421));[(907711640)]=((function(l,x,e,n)e[n]=(x((l)-((262112-#("Thanks Zephyrus, from 11792."))),((894044-#("get rickrolled nerd")))))-(798968);return(e[n]);end));[((906868739-#("Skid")))]=((function(l,x,e,n)e[n]=((x((l)-((665901-#("Psu is scammed luraph for leak!!!"))),((#{473;881;}+844107))))-(850558))-(138272);return(e[n]);end));[(551491894)]=(((176-#("jewish fart"))));[((46852243-#("nigmode")))]=(((#{(function(...)return 392;end)()}+89)));[(988803113)]=(((663829766-#("sponsored by maga 2024"))));["vvvCY"]=((664693909));[(876156976)]=(((#{}+440611435)));[(168688354)]=(((#{697;530;657;368;(function(...)return 671,...;end)(82)}+250)));[(510004496)]=(((#{737;779;}+3)));[((451085101-#("Man make it 6 hours")))]=((373));[((470185856-#("pussy popping")))]=((function(x,l,n,e)n[e]=((l((x)-((946042-#("apply for snoops scpf"))),((449760-#("Perth please shut the fuck up and dont spam here i forgor to mute here")))))-((875555-#("857"))))-((#{(function(...)return 143,373,...;end)(423,415,756,428)}+167316));return(n[e]);end));[((#{136;183;873;218;}+496268634))]=("\104");[(506729481)]=((412154339));[((#{122;554;54;}+441532272))]=(((60-#("south side locos"))));[(412154339)]=("\108");['HcURw2u']=("\121");RG2g0lInaF=((923991794));["B9iq4j9p"]=((32));[(941104778)]=("\111");['r2D9Exo']=("\107");[((#{}+816976232))]=(((1256-#("Get real and fake simultaneously"))));[(545501104)]=((751196742));[((#{55;269;154;25;(function(...)return;end)()}+644429408))]=(((#{873;954;199;(function(...)return;end)()}+47273)));[(874512712)]=("\114");[((#{55;(function(...)return;end)()}+780436127))]=("\110");[(181642124)]=((130300399));[((#{667;(function(...)return 622,1,...;end)()}+698674508))]=("\112");[(779795515)]=(((370864-#("waht the fuck"))));[((416419895-#("how do I compile lua into rust please help")))]=(((#{826;962;637;618;}+27)));[(962794201)]=((5603));['OxqSe2I']=((function(x,e,l,n)l[n]=e((e(x,(208016)))-((906795-#("Pratham#6969 Was Here!"))),(405773));return(l[n]);end));[((#{329;(function(...)return 267,292,91,486;end)()}+759876978))]=("\102");[(632155518)]=(((#{258;93;740;}+1020)));[(198493001)]=(((#{932;54;927;}+287363525)));["OdbbtN"]=((887711453));[(547656691)]=(((#{669;545;131;}+35815)));[((68964932-#("lol")))]=(((#{691;(function(...)return;end)()}+14566481)));["tiPQmXJ11r"]=("\103");[(507794141)]=((16777216));['TxIMY03h']=("\40");NYWVnE4=(((740067-#("Noel is the best coder"))));r4FUfGr=("\120");[(619238463)]=(((#{635;889;(function(...)return 574,652,907,...;end)()}+22298651)));["DAReGMgzEV"]=(((270459293-#("Server boosters can add meme strings"))));[(47743483)]=((36));UQtzG=(((897262722-#("im a spice head"))));[((434427820-#("The Cat was here")))]=((6));[(193352076)]=((800317171));[((287363592-#("I see you are bored enough to read through an obfuscated script.")))]=("\50");['Q0P5g73']=("\105");[(440611435)]=("\58");}),...)})do return e end;
|
local inputCode = {
3,225,1,225,6,6,1100,1,238,225,104,0,1102,89,49,225,1102,35,88,224,101,-3080,224,224,4,224,102,8,223,223,1001,224,3,224,1,223,224,223,1101,25,33,224,1001,224,-58,224,4,224,102,8,223,223,101,5,224,224,1,223,224,223,1102,78,23,225,1,165,169,224,101,-80,224,224,4,224,102,8,223,223,101,7,224,224,1,224,223,223,101,55,173,224,1001,224,-65,224,4,224,1002,223,8,223,1001,224,1,224,1,223,224,223,2,161,14,224,101,-3528,224,224,4,224,1002,223,8,223,1001,224,7,224,1,224,223,223,1002,61,54,224,1001,224,-4212,224,4,224,102,8,223,223,1001,224,1,224,1,223,224,223,1101,14,71,225,1101,85,17,225,1102,72,50,225,1102,9,69,225,1102,71,53,225,1101,10,27,225,1001,158,34,224,101,-51,224,224,4,224,102,8,223,223,101,6,224,224,1,223,224,223,102,9,154,224,101,-639,224,224,4,224,102,8,223,223,101,2,224,224,1,224,223,223,4,223,99,0,0,0,677,0,0,0,0,0,0,0,0,0,0,0,1105,0,99999,1105,227,247,1105,1,99999,1005,227,99999,1005,0,256,1105,1,99999,1106,227,99999,1106,0,265,1105,1,99999,1006,0,99999,1006,227,274,1105,1,99999,1105,1,280,1105,1,99999,1,225,225,225,1101,294,0,0,105,1,0,1105,1,99999,1106,0,300,1105,1,99999,1,225,225,225,1101,314,0,0,106,0,0,1105,1,99999,108,226,226,224,102,2,223,223,1006,224,329,101,1,223,223,1007,677,677,224,1002,223,2,223,1005,224,344,1001,223,1,223,8,226,677,224,1002,223,2,223,1006,224,359,1001,223,1,223,108,226,677,224,1002,223,2,223,1005,224,374,1001,223,1,223,107,226,677,224,102,2,223,223,1006,224,389,101,1,223,223,1107,226,226,224,1002,223,2,223,1005,224,404,1001,223,1,223,1107,677,226,224,102,2,223,223,1005,224,419,101,1,223,223,1007,226,226,224,102,2,223,223,1006,224,434,1001,223,1,223,1108,677,226,224,1002,223,2,223,1005,224,449,101,1,223,223,1008,226,226,224,102,2,223,223,1005,224,464,101,1,223,223,7,226,677,224,102,2,223,223,1006,224,479,101,1,223,223,1008,226,677,224,1002,223,2,223,1006,224,494,101,1,223,223,1107,226,677,224,1002,223,2,223,1005,224,509,1001,223,1,223,1108,226,226,224,1002,223,2,223,1006,224,524,101,1,223,223,7,226,226,224,102,2,223,223,1006,224,539,1001,223,1,223,107,226,226,224,102,2,223,223,1006,224,554,101,1,223,223,107,677,677,224,102,2,223,223,1006,224,569,101,1,223,223,1008,677,677,224,1002,223,2,223,1006,224,584,1001,223,1,223,8,677,226,224,1002,223,2,223,1005,224,599,101,1,223,223,1108,226,677,224,1002,223,2,223,1005,224,614,101,1,223,223,108,677,677,224,102,2,223,223,1005,224,629,1001,223,1,223,8,677,677,224,1002,223,2,223,1005,224,644,1001,223,1,223,7,677,226,224,102,2,223,223,1006,224,659,1001,223,1,223,1007,226,677,224,102,2,223,223,1005,224,674,101,1,223,223,4,223,99,226
}
local output = 0
local function copyTable(t)
local n = {}
for i, v in pairs(t) do
n[i] = v
end
return n
end
local function intCode(i, iv)
local input = copyTable(i)
local pointer = 1 --Tablas en lua comienzan con 1, no 0
local opCode
while true do
local code = tostring(input[pointer])
--if code:sub(1, 1) ~= 0 then code = code:sub(1, 1) .. "0" .. code:sub(2, code:len()) end
for _=1, 5-(code:len()) do
code = "0" .. code
end
opCode = tonumber(code:sub(code:len()-1, code:len()))
if opCode == 99 then return output end
local param1, param2--, param3 parametro 3 tecnicamente no requiere modo inmediato
if tonumber(code:sub(3,3)) == 1 then param1 = pointer+1 else param1 = input[pointer+1]+1 end
if opCode ~= 4 and opCode ~= 3 then
if tonumber(code:sub(2,2)) == 1 then param2 = pointer+2 else param2 = input[pointer+2]+1 end
end
-- if opCode ~= 4 and opCode ~= 3 and opCode ~= 5 and opCode ~= 6 then
-- if tonumber(code:sub(1,1)) == 0 then param3 = input[pointer+3]+1 else param3 = pointer+3 end
-- end
if opCode == 1 then
input[input[pointer+3]+1] = input[param1] + input[param2]
pointer = pointer + 4
elseif opCode == 2 then
input[input[pointer+3]+1] = input[param1] * input[param2]
pointer = pointer + 4
-- nuevas instrucciones PARTE 1
elseif opCode == 3 then
input[input[pointer+1]+1] = iv--inputValue
pointer = pointer + 2
elseif opCode == 4 then
output = input[input[pointer+1]+1]
pointer = pointer + 2
-- Nuevas instrucciones PARTE 2
elseif opCode == 5 then
if not (input[param1] == 0) then pointer = input[param2]+1 else pointer = pointer + 3 end
elseif opCode == 6 then
if input[param1] == 0 then pointer = input[param2]+1 else pointer = pointer + 3 end
elseif opCode == 7 then
if input[param1] < input[param2] then input[input[pointer+3]+1] = 1 else input[input[pointer+3]+1] = 0 end
pointer = pointer + 4
elseif opCode == 8 then
if input[param1] == input[param2] then input[input[pointer+3]+1] = 1 else input[input[pointer+3]+1] = 0 end
pointer = pointer + 4
else
return "error, pointer: " .. pointer .. ", opcode: " .. opCode .. ", output " .. output .. ", code " .. code .. ", value " .. input[pointer]
end
end
end
print("the answer 1 is: " .. intCode(inputCode, 1))
print("the answer 1 is: " .. intCode(inputCode, 5))
|
--[[
MIT License
Copyright (c) 2019 Mitchell Davis <coding.jackalope@gmail.com>
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 FileSystem = {}
function FileSystem.Separator()
-- Lua/Love2D returns all paths with back slashes.
return "/"
end
function FileSystem.GetDirectoryItems(Directory, Options)
Options = Options == nil and {} or Options
Options.Files = Options.Files == nil and true or Options.Files
Options.Directories = Options.Directories == nil and true or Options.Directories
Options.Filter = Options.Filter == nil and "*.*" or Options.Filter
local Cmd = ""
local OS = love.system.getOS()
if string.sub(Directory, #Directory, #Directory) ~= FileSystem.Separator() then
Directory = Directory .. FileSystem.Separator()
end
if OS == "Windows" then
Directory = string.gsub(Directory, "/", "\\")
if Options.Files and not Options.Directories then
Cmd = 'DIR "' .. Directory .. Options.Filter .. '" /B /A:-D-H'
elseif Options.Directories and not Options.Files then
Cmd = 'DIR "' .. Directory .. '" /B /A:D-H'
else
Cmd = 'DIR "' .. Directory .. '" /B /A-H'
end
else
if Options.Files and not Options.Directories then
Cmd = 'find "' .. Directory .. '" \\( ! -regex ".*/\\..*" \\) -maxdepth 1 -type f \\( -iname \\' .. Options.Filter .. ' \\)'
elseif Options.Directories and not Options.Files then
Cmd = 'find "' .. Directory .. '" ! -path ' .. Directory .. ' \\( ! -regex ".*/\\..*" \\) -maxdepth 1 -type d'
else
Cmd = 'ls -1 ' .. Directory
end
end
local Result = {}
local Handle, Error = io.popen(Cmd)
if Handle ~= nil then
local I = 1
for Item in Handle:lines() do
if Item ~= "nil" then
Result[I] = Item
I = I + 1
end
end
io.close(Handle)
end
return Result
end
function FileSystem.Exists(Path)
local Handle = io.open(Path)
if Handle ~= nil then
io.close(Handle)
return true
else
local OS = love.system.getOS()
if OS == "Windows" then
local OK, Error, Code = os.rename(Path, Path)
if OK then
return true
else
if Code == 13 then
return true
end
end
end
end
return false
end
function FileSystem.IsDirectory(Path)
return FileSystem.Exists(Path .. FileSystem.Separator())
end
function FileSystem.Parent(Path)
local Result = Path
local Index = 1
local I = Index
repeat
Index = I
I = string.find(Path, FileSystem.Separator(), Index + 1, true)
until I == nil
if Index > 1 then
Result = string.sub(Path, 1, Index - 1)
end
return Result
end
function FileSystem.GetBaseName(Path, RemoveExtension)
local Result = string.match(Path, "^.+/(.+)$")
if Result == nil then
Result = Path
end
if RemoveExtension then
Result = FileSystem.RemoveExtension(Result)
end
return Result
end
function FileSystem.GetDirectory(Path)
local Result = string.match(Path, "(.+)/")
if Result == nil then
Result = Path
end
return Result
end
function FileSystem.GetRootDirectory(Path)
local Result = Path
local Index = string.find(Path, FileSystem.Separator(), 1, true)
if Index ~= nil then
Result = string.sub(Path, 1, Index - 1)
end
return Result
end
function FileSystem.GetSlabPath()
local Path = love.filesystem.getSource()
if not FileSystem.IsDirectory(Path) then
Path = love.filesystem.getSourceBaseDirectory()
end
return Path .. "/Slab"
end
function FileSystem.RemoveExtension(Path)
local Result = string.match(Path, "(.+)%.")
if Result == nil then
Result = Path
end
return Result
end
function FileSystem.ReadContents(Path, IsBinary)
local Result = nil
local Mode = IsBinary and "rb" or "r"
local Handle, Error = io.open(Path, Mode)
if Handle ~= nil then
Result = Handle:read("*a")
Handle:close()
end
return Result, Error
end
function FileSystem.SaveContents(Path, Contents)
local Result = false
local Handle, Error = io.open(Path, "w")
if Handle ~= nil then
Handle:write(Contents)
Handle:close()
Result = true
end
return Result, Error
end
return FileSystem
|
local status, nvim_tree = pcall(require, "nvim-tree")
if not status then
vim.notify("没有找到 nvim-tree")
return
end
-- 列表操作快捷键
local list_keys = require('keybindings').nvimTreeList
nvim_tree.setup({
-- 不显示 git 状态图标
git = {
enable = false,
},
-- project plugin 需要这样设置
update_cwd = true,
update_focused_file = {
enable = true,
update_cwd = true,
},
-- 隐藏 .文件 和 node_modules 文件夹
filters = {
dotfiles = true,
custom = { 'node_modules','*.meta' },
},
view = {
-- 宽度
width = 40,
-- 也可以 'right'
side = 'left',
-- 隐藏根目录
hide_root_folder = false,
-- 自定义列表中快捷键
mappings = {
custom_only = false,
list = lit_keys,
},
-- 不显示行数
number = false,
relativenumber = false,
-- 显示图标
signcolumn = 'yes',
},
actions = {
open_file = {
-- 首次打开大小适配
resize_window = true,
-- 打开文件时关闭
quit_on_open = true,
},
},
-- wsl install -g wsl-open
-- https://github.com/4U6U57/wsl-open/
system_open = {
cmd = 'wsl-open', -- mac 直接设置为 open
},
})
-- 自动关闭
vim.cmd([[
autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif
]])
|
local ERROR_CHECKED_SPECIFIC_GAME_WRAPPER = require "error_checked_specific_game_wrapper"
-- NOTE: This is already generic, so we use the same file for different games.
-- If different functionality is necessary, change the following import.
-- TODO_REFACTOR: implement tests here that test all buff functions (similar to the chip drop method tests).
return ERROR_CHECKED_SPECIFIC_GAME_WRAPPER.get_module("buff_effects", "mmbn3_blue_us", "buff_groups_data")
|
-- D:\projects\amiga-experiments\lua_intro\project
SCR_WIDTH = 400
SCR_HEIGHT = 300
ZOOM_RATIO = SCR_HEIGHT / 1365
gsplus = nil
require 'common'
require 'resolution_selector'
require 'demo_audio'
require 'demo'
require 'common_fx'
require 'timings'
require 'fx_hello_outline'
require 'fx_red_sector_title'
require 'fx_brings_you'
require 'fx_hand'
DEMO_STATE = resolution_selector
gs.LoadPlugins()
gs.MountFileDriver(gs.StdFileDriver())
demo_open_screen()
resolution_selector_init()
function do_nothing()
end
-- play_music()
function print_time(demo_clock)
clock_sec = math.floor(demo_clock)
if clock_sec ~= prev_clock_sec then
print(clock_sec)
end
prev_clock_sec = clock_sec
end
while demo_is_starting or (gsplus ~= nil and not gsplus:IsAppEnded()) do
if gsplus ~= nil then
dt = gsplus:UpdateClock()
gsplus:Clear()
end
if DEMO_STATE ~= nil then
dt_sec = dt:to_sec()
DEMO_STATE(dt_sec, demo_clock)
end
if gsplus ~= nil then
gsplus:Flip()
if demo_start_clock ~= nil then
demo_clock = (gsplus:GetClock() - demo_start_clock):to_sec()
else
demo_clock = 0
end
print_time(demo_clock)
end
end
|
object_tangible_collection_reward_lightsaber_hilt_shrine = object_tangible_collection_reward_shared_lightsaber_hilt_shrine:new {
}
ObjectTemplates:addTemplate(object_tangible_collection_reward_lightsaber_hilt_shrine, "object/tangible/collection/reward/lightsaber_hilt_shrine.iff")
|
--[[
##############################################################################
S V U I By: Munglunch
############################################################################## ]]--
--[[ GLOBALS ]]--
local _G = _G;
local unpack = _G.unpack;
local select = _G.select;
local assert = _G.assert;
local type = _G.type;
local error = _G.error;
local pcall = _G.pcall;
local print = _G.print;
local ipairs = _G.ipairs;
local pairs = _G.pairs;
local tostring = _G.tostring;
local tonumber = _G.tonumber;
--STRING
local string = _G.string;
local upper = string.upper;
local format = string.format;
local find = string.find;
local match = string.match;
local gsub = string.gsub;
--TABLE
local table = _G.table;
local tinsert = _G.tinsert;
local tremove = _G.tremove;
local wipe = _G.wipe;
--MATH
local math = _G.math;
local random = math.random;
local min = math.min;
local floor = math.floor
local ceil = math.ceil
--BLIZZARD API
local GameTooltip = _G.GameTooltip;
local InCombatLockdown = _G.InCombatLockdown;
local CreateFrame = _G.CreateFrame;
local GetTime = _G.GetTime;
local GetItemCooldown = _G.GetItemCooldown;
local GetItemCount = _G.GetItemCount;
local GetItemInfo = _G.GetItemInfo;
local GetSpellInfo = _G.GetSpellInfo;
local IsSpellKnown = _G.IsSpellKnown;
local GetProfessions = _G.GetProfessions;
local GetProfessionInfo = _G.GetProfessionInfo;
local hooksecurefunc = _G.hooksecurefunc;
local ReloadUI = _G.ReloadUI;
local IsAltKeyDown = _G.IsAltKeyDown;
local IsShiftKeyDown = _G.IsShiftKeyDown;
local IsControlKeyDown = _G.IsControlKeyDown;
local IsModifiedClick = _G.IsModifiedClick;
local PlaySound = _G.PlaySound;
local PlaySoundFile = _G.PlaySoundFile;
local UnitName = _G.UnitName;
local ToggleFrame = _G.ToggleFrame;
local ERR_NOT_IN_COMBAT = _G.ERR_NOT_IN_COMBAT;
--[[
##########################################################
ADDON
##########################################################
]]--
local SV = select(2, ...);
local L = SV.L;
local MOD = SV:NewPackage("Dock", L["Docks"]);
MOD.Border = {};
--[[
##########################################################
LOCALS
##########################################################
]]--
local DOCK_CHECK,DRAGGING_TARGET;
local ORDER_TEMP, ORDER_TEST, DOCK_REGISTRY, DOCK_DROPDOWN_OPTIONS = {}, {}, {}, {};
local DOCK_LOCATIONS = {
["BottomLeft"] = {1, "LEFT", true, "ANCHOR_TOPLEFT"},
["BottomRight"] = {-1, "RIGHT", true, "ANCHOR_TOPLEFT"},
["TopLeft"] = {1, "LEFT", false, "ANCHOR_BOTTOMLEFT"},
["TopRight"] = {-1, "RIGHT", false, "ANCHOR_BOTTOMLEFT"},
};
--DOCK_DROPDOWN_OPTIONS["BottomLeft"] = { text = "To BottomLeft", func = function(button) button:MoveTo("BottomLeft"); end };
--DOCK_DROPDOWN_OPTIONS["BottomRight"] = { text = "To BottomRight", func = function(button) button:MoveTo("BottomRight"); end };
--DOCK_DROPDOWN_OPTIONS["TopLeft"] = { text = "To TopLeft", func = function(button) button:MoveTo("TopLeft"); end };
--DOCK_DROPDOWN_OPTIONS["TopRight"] = { text = "To TopRight", func = function(button) MOD.TopRight.Bar:Add(button) end };
--[[
##########################################################
THEMEABLE ITEMS
##########################################################
]]--
MOD.ButtonSound = SV.Sounds:Blend("DockButton", "Buttons", "Levers");
MOD.ErrorSound = SV.Sounds:Blend("Malfunction", "Sparks", "Wired");
local function GetDockDimensions(location)
local width, height;
local isTop = location:find("Top")
local isLeft = location:find("Left")
if(isTop) then
if(isLeft) then
width = SV.db.Dock.dockTopLeftWidth;
height = SV.db.Dock.dockTopLeftHeight;
else
width = SV.db.Dock.dockTopRightWidth;
height = SV.db.Dock.dockTopRightHeight;
end
else
if(isLeft) then
width = SV.db.Dock.dockLeftWidth;
height = SV.db.Dock.dockLeftHeight;
if(MOD.private.LeftExpanded) then
height = height + 300
end
else
width = SV.db.Dock.dockRightWidth;
height = SV.db.Dock.dockRightHeight;
if(MOD.private.RightExpanded) then
height = height + 300
end
end
end
return width, height;
end
local function SetDockDimensions(location, width, height, buttonSize)
local isTop = location:find("Top")
local isLeft = location:find("Left")
if(isTop) then
if(isLeft) then
SV.db.Dock.dockTopLeftWidth = width;
if(not buttonSize) then
SV.db.Dock.dockTopLeftHeight = height;
end
else
SV.db.Dock.dockTopRightWidth = width;
if(not buttonSize) then
SV.db.Dock.dockTopRightHeight = height;
end
end
else
if(isLeft) then
SV.db.Dock.dockLeftWidth = width;
if(not buttonSize) then
SV.db.Dock.dockLeftHeight = height;
end
else
SV.db.Dock.dockRightWidth = width;
if(not buttonSize) then
SV.db.Dock.dockRightHeight = height;
end
end
end
if(buttonSize) then
SV.db.Dock.buttonSize = height;
end
end
local dockPostSizeFunc = function(self, width, height)
local name = self:GetName()
SetDockDimensions(name, width, height)
end
local dockBarPostSizeFunc = function(self, width, height)
local name = self:GetName()
SetDockDimensions(name, width, height, true)
end
local function ScreenBorderVisibility()
if SV.db.Dock.bottomPanel then
SVUIDock_BottomBorder:Show()
else
SVUIDock_BottomBorder:Hide()
end
if SV.db.Dock.topPanel then
SVUIDock_TopBorder:Show()
else
SVUIDock_TopBorder:Hide()
end
end
function MOD.SetThemeDockStyle(frame, isBottom)
local backdrop = CreateFrame("Frame", nil, frame)
backdrop:SetAllPoints(frame)
backdrop:SetFrameStrata("BACKGROUND")
local bg = backdrop:CreateTexture(nil, "BORDER")
bg:InsetPoints(backdrop)
bg:SetTexture(1, 1, 1, 1)
if(isBottom) then
bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 0.8, 0, 0, 0, 0)
else
bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 0.8)
end
local left = backdrop:CreateTexture(nil, "OVERLAY")
left:SetTexture(1, 1, 1, 1)
left:SetPoint("TOPLEFT", 1, -1)
left:SetPoint("BOTTOMLEFT", -1, -1)
left:SetWidth(2)
if(isBottom) then
left:SetGradientAlpha("VERTICAL", 0, 0, 0, 1, 0, 0, 0, 0)
else
left:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 1)
end
local right = backdrop:CreateTexture(nil, "OVERLAY")
right:SetTexture(1, 1, 1, 1)
right:SetPoint("TOPRIGHT", -1, -1)
right:SetPoint("BOTTOMRIGHT", -1, -1)
right:SetWidth(2)
if(isBottom) then
right:SetGradientAlpha("VERTICAL", 0, 0, 0, 1, 0, 0, 0, 0)
else
right:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 1)
end
local bottom = backdrop:CreateTexture(nil, "OVERLAY")
bottom:SetPoint("BOTTOMLEFT", 1, -1)
bottom:SetPoint("BOTTOMRIGHT", -1, -1)
if(isBottom) then
bottom:SetTexture(0, 0, 0, 1)
bottom:SetHeight(2)
else
bottom:SetTexture(0, 0, 0, 0)
bottom:SetAlpha(0)
bottom:SetHeight(1)
end
local top = backdrop:CreateTexture(nil, "OVERLAY")
top:SetPoint("TOPLEFT", 1, -1)
top:SetPoint("TOPRIGHT", -1, 1)
if(isBottom) then
top:SetTexture(0, 0, 0, 0)
top:SetAlpha(0)
top:SetHeight(1)
else
top:SetTexture(0, 0, 0, 1)
top:SetHeight(2)
end
return backdrop
end
function MOD:SetBorderTheme()
self.Border.Top:SetPoint("TOPLEFT", SV.Screen, "TOPLEFT", -1, 1)
self.Border.Top:SetPoint("TOPRIGHT", SV.Screen, "TOPRIGHT", 1, 1)
self.Border.Top:SetHeight(10)
self.Border.Top:SetBackdrop({
bgFile = SV.media.background.button,
edgeFile = [[Interface\BUTTONS\WHITE8X8]],
tile = false,
tileSize = 0,
edgeSize = 1,
insets = {left = 0, right = 0, top = 0, bottom = 0}
})
self.Border.Top:SetBackdropColor(unpack(SV.media.color.dark))
self.Border.Top:SetBackdropBorderColor(0,0,0,1)
self.Border.Top:SetFrameLevel(0)
self.Border.Top:SetFrameStrata('BACKGROUND')
self.Border.Top:SetScript("OnShow", function(self)
self:SetFrameLevel(0)
self:SetFrameStrata('BACKGROUND')
end)
self.Border.Bottom:SetPoint("BOTTOMLEFT", SV.Screen, "BOTTOMLEFT", -1, -1)
self.Border.Bottom:SetPoint("BOTTOMRIGHT", SV.Screen, "BOTTOMRIGHT", 1, -1)
self.Border.Bottom:SetHeight(10)
self.Border.Bottom:SetBackdrop({
bgFile = SV.media.background.button,
edgeFile = [[Interface\BUTTONS\WHITE8X8]],
tile = false,
tileSize = 0,
edgeSize = 1,
insets = {left = 0, right = 0, top = 0, bottom = 0}
})
self.Border.Bottom:SetBackdropColor(unpack(SV.media.color.dark))
self.Border.Bottom:SetBackdropBorderColor(0,0,0,1)
self.Border.Bottom:SetFrameLevel(0)
self.Border.Bottom:SetFrameStrata('BACKGROUND')
self.Border.Bottom:SetScript("OnShow", function(self)
self:SetFrameLevel(0)
self:SetFrameStrata('BACKGROUND')
end)
end
function MOD:SetButtonTheme(button, size)
local sparkSize = size * 5;
local sparkOffset = size * 0.5;
button:SetStyle("DockButton")
local sparks = button:CreateTexture(nil, "OVERLAY", nil, 2)
sparks:SetSize(sparkSize, sparkSize)
sparks:SetPoint("CENTER", button, "BOTTOMRIGHT", -sparkOffset, 4)
sparks:SetTexture(SV.media.dock.sparks[1])
sparks:SetVertexColor(0.7, 0.6, 0.5)
sparks:SetBlendMode("ADD")
sparks:SetAlpha(0)
SV.Animate:Sprite8(sparks, 0.08, 2, false, true)
button.Sparks = sparks;
button.ClickTheme = function(self)
self.Sparks:SetTexture(SV.media.dock.sparks[random(1,3)])
self.Sparks.anim:Play()
end
end
--[[
##########################################################
CORE FUNCTIONS
##########################################################
]]--
_G.ToggleSuperDockLeft = function(self, button)
GameTooltip:Hide()
if(button and IsAltKeyDown()) then
SV:StaticPopup_Show('RESETDOCKS_CHECK')
elseif(button and button == 'RightButton') then
if(InCombatLockdown()) then
MOD.ErrorSound()
SV:AddonMessage(ERR_NOT_IN_COMBAT)
return
end
MOD.ButtonSound()
local userSize = SV.db.Dock.dockLeftHeight
if(not MOD.private.LeftExpanded) then
MOD.private.LeftExpanded = true
MOD.BottomLeft.Window:SetHeight(userSize + 300)
else
MOD.private.LeftExpanded = nil
MOD.BottomLeft.Window:SetHeight(userSize)
end
MOD.BottomLeft.Bar:Update()
MOD:UpdateDockBackdrops()
SV.Events:Trigger("DOCK_LEFT_EXPANDED");
else
if MOD.private.LeftFaded then
MOD.private.LeftFaded = nil;
MOD.BottomLeft:FadeIn(0.2, MOD.BottomLeft:GetAlpha(), 1)
MOD.BottomLeft.Bar:FadeIn(0.2, MOD.BottomLeft.Bar:GetAlpha(), 1)
SV.Events:Trigger("DOCK_LEFT_FADE_IN");
PlaySoundFile([[sound\doodad\be_scryingorb_explode.ogg]])
else
MOD.private.LeftFaded = true;
MOD.BottomLeft:FadeOut(0.2, MOD.BottomLeft:GetAlpha(), 0)
MOD.BottomLeft.Bar:FadeOut(0.2, MOD.BottomLeft.Bar:GetAlpha(), 0)
SV.Events:Trigger("DOCK_LEFT_FADE_OUT");
PlaySoundFile([[sound\doodad\be_scryingorb_explode.ogg]])
end
end
end
_G.ToggleSuperDockRight = function(self, button)
GameTooltip:Hide()
if(button and IsAltKeyDown()) then
SV:StaticPopup_Show('RESETDOCKS_CHECK')
elseif(button and button == 'RightButton') then
if(InCombatLockdown()) then
MOD.ErrorSound()
SV:AddonMessage(ERR_NOT_IN_COMBAT)
return
end
MOD.ButtonSound()
local userSize = SV.db.Dock.dockRightHeight
if(not MOD.private.RightExpanded) then
MOD.private.RightExpanded = true
MOD.BottomRight.Window:SetHeight(userSize + 300)
else
MOD.private.RightExpanded = nil
MOD.BottomRight.Window:SetHeight(userSize)
end
MOD.BottomRight.Bar:Update()
MOD:UpdateDockBackdrops()
SV.Events:Trigger("DOCK_RIGHT_EXPANDED");
else
if MOD.private.RightFaded then
MOD.private.RightFaded = nil;
MOD.BottomRight:FadeIn(0.2, MOD.BottomRight:GetAlpha(), 1)
MOD.BottomRight.Bar:FadeIn(0.2, MOD.BottomRight.Bar:GetAlpha(), 1)
SV.Events:Trigger("DOCK_RIGHT_FADE_IN");
PlaySoundFile([[sound\doodad\be_scryingorb_explode.ogg]])
else
MOD.private.RightFaded = true;
MOD.BottomRight:FadeOut(0.2, MOD.BottomRight:GetAlpha(), 0)
MOD.BottomRight.Bar:FadeOut(0.2, MOD.BottomRight.Bar:GetAlpha(), 0)
SV.Events:Trigger("DOCK_RIGHT_FADE_OUT");
PlaySoundFile([[sound\doodad\be_scryingorb_explode.ogg]])
end
end
end
_G.ToggleSuperDocks = function()
if(MOD.private.AllFaded) then
MOD.private.AllFaded = nil;
MOD.private.LeftFaded = nil;
MOD.private.RightFaded = nil;
MOD.BottomLeft:FadeIn(0.2, MOD.BottomLeft:GetAlpha(), 1)
MOD.BottomLeft.Bar:FadeIn(0.2, MOD.BottomLeft.Bar:GetAlpha(), 1)
SV.Events:Trigger("DOCK_LEFT_FADE_IN");
MOD.BottomRight:FadeIn(0.2, MOD.BottomRight:GetAlpha(), 1)
MOD.BottomRight.Bar:FadeIn(0.2, MOD.BottomRight.Bar:GetAlpha(), 1)
SV.Events:Trigger("DOCK_RIGHT_FADE_IN");
PlaySoundFile([[sound\doodad\be_scryingorb_explode.ogg]])
else
MOD.private.AllFaded = true;
MOD.private.LeftFaded = true;
MOD.private.RightFaded = true;
MOD.BottomLeft:FadeOut(0.2, MOD.BottomLeft:GetAlpha(), 0)
MOD.BottomLeft.Bar:FadeOut(0.2, MOD.BottomLeft.Bar:GetAlpha(), 0)
SV.Events:Trigger("DOCK_LEFT_FADE_OUT");
MOD.BottomRight:FadeOut(0.2, MOD.BottomRight:GetAlpha(), 0)
MOD.BottomRight.Bar:FadeOut(0.2, MOD.BottomRight.Bar:GetAlpha(), 0)
SV.Events:Trigger("DOCK_RIGHT_FADE_OUT");
PlaySoundFile([[sound\doodad\be_scryingorb_explode.ogg]])
end
end
function MOD:EnterFade()
if MOD.private.LeftFaded then
self.BottomLeft:FadeIn(0.2, self.BottomLeft:GetAlpha(), 1)
self.BottomLeft.Bar:FadeIn(0.2, self.BottomLeft.Bar:GetAlpha(), 1)
SV.Events:Trigger("DOCK_LEFT_FADE_IN");
end
if MOD.private.RightFaded then
self.BottomRight:FadeIn(0.2, self.BottomRight:GetAlpha(), 1)
self.BottomRight.Bar:FadeIn(0.2, self.BottomRight.Bar:GetAlpha(), 1)
SV.Events:Trigger("DOCK_RIGHT_FADE_IN");
end
end
function MOD:ExitFade()
if MOD.private.LeftFaded then
self.BottomLeft:FadeOut(2, self.BottomLeft:GetAlpha(), 0)
self.BottomLeft.Bar:FadeOut(2, self.BottomLeft.Bar:GetAlpha(), 0)
SV.Events:Trigger("DOCK_LEFT_FADE_OUT");
end
if MOD.private.RightFaded then
self.BottomRight:FadeOut(2, self.BottomRight:GetAlpha(), 0)
self.BottomRight.Bar:FadeOut(2, self.BottomRight.Bar:GetAlpha(), 0)
SV.Events:Trigger("DOCK_RIGHT_FADE_OUT");
end
end
--[[
##########################################################
DRAGGING HIGHLIGHT FUNCTIONS
##########################################################
]]--
local HighLight_OnUpdate = function(self)
local highlight = self.Highlight;
if(not highlight) then
self:SetScript("OnUpdate", nil)
return
end
if(highlight:IsMouseOver(50, -50, -50, 50)) then
DRAGGING_TARGET = self.Data.Location;
highlight:SetAlpha(1)
else
highlight:SetAlpha(0.2)
end
end
local function AnchorInsertHighlight(dockbar)
local location = dockbar.Data.Location;
local lastTab = dockbar.Data.Order[#dockbar.Data.Order];
local isLeft = (location:find('Left'));
local anchor1 = isLeft and 'LEFT' or 'RIGHT';
local anchor2 = isLeft and 'RIGHT' or 'LEFT';
local xOff = isLeft and 2 or -2;
dockbar.Highlight:ClearAllPoints();
if(not lastTab) then
dockbar.Highlight:SetPoint(anchor1, dockbar, anchor1, xOff, 0);
else
dockbar.Highlight:SetPoint(anchor1, _G[lastTab], anchor2, xOff, 0);
end
end
local function ToggleBarHighlights(isShown)
for location, settings in pairs(DOCK_LOCATIONS) do
local dock = MOD[location];
local dockbar = dock.Bar;
if(dockbar) then
--AnchorInsertHighlight(dockbar)
if(isShown) then
dockbar.Highlight:Show()
dockbar.Highlight:SetAlpha(0.2)
dockbar:SetScript("OnUpdate", HighLight_OnUpdate)
else
DRAGGING_TARGET = nil;
dockbar.Highlight:Hide()
dockbar:SetScript("OnUpdate", nil)
end
end
end
end
--[[
##########################################################
DOCKBAR FUNCTIONS
##########################################################
]]--
local function DeactivateDockletButton(button)
button:SetAttribute("isActive", false)
button:SetPanelColor("default")
if(button.Icon) then
button.Icon:SetGradient(unpack(SV.media.gradient.icon));
end
end
local function DeactivateAllDockletButtons(dockbar)
local location = dockbar.Data.Location;
local buttonList = dockbar.Data.Buttons;
for nextName,nextButton in pairs(buttonList) do
DeactivateDockletButton(nextButton)
end
end
local function ActivateDockletButton(button)
DeactivateAllDockletButtons(button.Parent);
button:SetAttribute("isActive", true);
button:SetPanelColor("default");
if(button.Icon) then
button.Icon:SetGradient(unpack(SV.media.gradient.checked));
end
end
local function ShowDockletWindow(button, location)
if((not button) or (not button.FrameLink)) then return end
local window = button.FrameLink
if((not window) or (not window.SetFrameLevel)) then return end
if(not window:IsShown()) then
if(not InCombatLockdown()) then
window:SetFrameLevel(10)
window:Show()
end
end
window:FadeIn()
SV.Events:Trigger("DOCKLET_SHOWN", location, button.LinkKey);
return true;
end
local function HideDockletWindow(button, location)
if((not button) or (not button.FrameLink)) then return end
local window = button.FrameLink
if((not window) or (not window.SetFrameLevel)) then return end
if(not InCombatLockdown()) then
window:SetFrameLevel(0)
window:Hide()
end
window:FadeOut(0.1, 1, 0, true)
SV.Events:Trigger("DOCKLET_HIDDEN", location, button.LinkKey);
return true;
end
local function ResetAllDockletWindows(dockbar, button)
local location = dockbar.Data.Location;
local buttonList = dockbar.Data.Buttons;
local currentButton = "";
if(button and button.GetName) then
currentButton = button:GetName()
else
dockbar.Parent.backdrop:Hide();
end
for nextName,nextButton in pairs(buttonList) do
if(nextName ~= currentButton) then
if(nextButton.FrameLink) then
HideDockletWindow(nextButton, location)
end
end
end
SV.Events:Trigger("DOCKLET_RESET", location);
end
local DockBar_ResetAll = function(self)
ResetAllDockletWindows(self);
DeactivateAllDockletButtons(self);
end
local DockBar_SetDefault = function(self, button, isAdvanced)
local location = self.Data.Location;
if(button) then
if(isAdvanced and button.ShowAdvancedDock) then
DockBar_ResetAll(self)
MOD.private.DefaultDocklets[location] = button:GetName();
elseif(button.FrameLink) then
MOD.private.DefaultDocklets[location] = button:GetName();
end
end
if((not button) or (not button.FrameLink)) then
local defaultButton = MOD.private.DefaultDocklets[location];
button = _G[defaultButton];
end
if(button) then
if(isAdvanced and button.ShowAdvancedDock) then
button:ShowAdvancedDock()
return true;
elseif(button.FrameLink) then
ResetAllDockletWindows(self, button);
self.Parent.Window.FrameLink = button.FrameLink;
self.Parent.Window:Show();
self.Parent.Window:FadeIn();
if(ShowDockletWindow(button, location)) then
self.Parent.backdrop:Show();
ActivateDockletButton(button);
return true;
end
end
end
return false
end
local DockBar_NextDefault = function(self)
local location = self.Data.Location;
local buttonList = self.Data.Buttons;
for name,button in pairs(buttonList) do
if(button.FrameLink) then
MOD.private.DefaultDocklets[location] = name;
ResetAllDockletWindows(self, button);
self.Parent.Window.FrameLink = button.FrameLink;
self.Parent.Window:Show();
self.Parent.Window:FadeIn();
if(ShowDockletWindow(button, location)) then
self.Parent.backdrop:Show();
ActivateDockletButton(button);
return;
end
end
end
SV.Events:Trigger("DOCKLET_LIST_EMPTY", location);
end
local DockBar_ChangeOrder = function(self, button, targetIndex)
local targetName = button:GetName();
local currentIndex = button.OrderIndex;
wipe(ORDER_TEST);
wipe(ORDER_TEMP);
for i = 1, #self.Data.Order do
local nextName = self.Data.Order[i];
if(i == targetIndex) then
if(currentIndex > targetIndex) then
tinsert(ORDER_TEMP, targetName)
tinsert(ORDER_TEMP, nextName)
else
tinsert(ORDER_TEMP, nextName)
tinsert(ORDER_TEMP, targetName)
end
elseif(targetName ~= nextName) then
tinsert(ORDER_TEMP, nextName)
end
end
wipe(self.Data.Order);
local safeIndex = 1;
for i = 1, #ORDER_TEMP do
local nextName = ORDER_TEMP[i];
local nextButton = self.Data.Buttons[nextName];
if(nextButton and (not ORDER_TEST[nextName])) then
ORDER_TEST[nextName] = true
tinsert(self.Data.Order, nextName);
nextButton.OrderIndex = safeIndex;
safeIndex = safeIndex + 1;
end
end
self:Update()
end
local DockBar_UpdateOrder = function(self)
wipe(ORDER_TEST);
wipe(ORDER_TEMP);
for i = 1, #self.Data.Order do
local nextName = self.Data.Order[i];
tinsert(ORDER_TEMP, nextName)
end
wipe(self.Data.Order);
local safeIndex = 1;
for i = 1, #ORDER_TEMP do
local nextName = ORDER_TEMP[i];
local nextButton = self.Data.Buttons[nextName];
if(nextButton and (not ORDER_TEST[nextName])) then
ORDER_TEST[nextName] = true
tinsert(self.Data.Order, nextName);
nextButton.OrderIndex = safeIndex;
safeIndex = safeIndex + 1;
end
end
end
local DockBar_CheckOrder = function(self, targetName)
local found = false;
for i = 1, #self.Data.Order do
if(self.Data.Order[i] == targetName) then
found = true;
end
end
if(not found) then
tinsert(self.Data.Order, targetName);
DockBar_UpdateOrder(self);
end
end
local DockBar_UpdateLayout = function(self)
local anchor = upper(self.Data.Location)
local mod = self.Data.Modifier
local size = self.ToolBar:GetHeight();
local count = #self.Data.Order;
local offset = 1;
local safeIndex = 1;
if(count > 0) then
for i = 1, count do
local nextName = self.Data.Order[i];
local nextButton = self.Data.Buttons[nextName];
if(nextButton) then
offset = (safeIndex - 1) * (size + 6) + 6
nextButton:ClearAllPoints();
nextButton:SetSize(size, size);
nextButton:SetPoint(anchor, self.ToolBar, anchor, (offset * mod), 0);
if(not nextButton:IsShown()) then
nextButton:Show();
end
nextButton.OrderIndex = safeIndex;
safeIndex = safeIndex + 1;
end
end
end
self.ToolBar:SetWidth(offset + size);
end
local DockBar_AddButton = function(self, button, forced)
if not button then return end
local name = button:GetName();
local currentLocation = self.Data.Location
if(self.Data.Buttons[name] and (not forced)) then return end
local registeredLocation = MOD.private.Locations[name]
if(registeredLocation) then
if(registeredLocation ~= currentLocation) then
if(MOD[registeredLocation].Bar.Data.Buttons[name]) then
MOD[registeredLocation].Bar:Remove(button, true);
else
MOD[registeredLocation].Bar:Add(button);
return
end
end
end
self.Data.Buttons[name] = button;
DockBar_CheckOrder(self, name);
MOD.private.Locations[name] = currentLocation;
button.Parent = self;
button:SetParent(self.ToolBar);
if(button.FrameLink) then
local frame = button.FrameLink
local frameName = frame:GetName()
self.Data.Windows[frameName] = frame;
MOD.private.Locations[frameName] = currentLocation;
frame:Show()
frame:ClearAllPoints()
frame:SetParent(self.Parent.Window)
frame:InsetPoints(self.Parent.Window)
frame.Parent = self.Parent
frame:FadeIn()
if(not MOD.private.DefaultDocklets[currentLocation]) then
DockBar_SetDefault(self, button)
end
end
self:SetDefault()
self:Update()
end
local DockBar_RemoveButton = function(self, button, isMoving)
if not button then return end
local name = button:GetName();
local registeredLocation = MOD.private.Locations[name];
local currentLocation = self.Data.Location
if(registeredLocation and (registeredLocation == currentLocation)) then
MOD.private.Locations[name] = nil;
end
for i = 1, #self.Data.Order do
local nextName = self.Data.Order[i];
if(nextName == name) then
tremove(self.Data.Order, i);
break;
end
end
if(not self.Data.Buttons[name]) then return end
button:Hide()
button.OrderIndex = 0;
if(button.FrameLink) then
local frameName = button.FrameLink:GetName()
MOD.private.Locations[frameName] = nil;
if(not isMoving) then
button.FrameLink:FadeOut(0.2, 1, 0, true)
end
self.Data.Windows[frameName] = nil;
end
if(#self.Data.Order == 0) then
MOD.private.DefaultDocklets[currentLocation] = nil;
self.Parent.backdrop:Hide()
end
self.Data.Buttons[name] = nil;
DockBar_UpdateOrder(self);
if(MOD.private.DefaultDocklets[currentLocation] == name or (not MOD.private.DefaultDocklets[currentLocation]) or (MOD.private.DefaultDocklets[currentLocation] == "")) then
self:NextDefault()
else
self:SetDefault()
end
self:Update()
end
--[[
##########################################################
DOCKBUTTON FUNCTIONS
##########################################################
]]--
local DockButton_OnDragStart = function(self)
if(IsShiftKeyDown() and (not InCombatLockdown())) then
self:SetMovable(true);
self:StartMoving();
ToggleBarHighlights(true);
end
end
local DockButton_OnDragStop = function(self)
self:StopMovingOrSizing();
self:SetMovable(false);
if(DRAGGING_TARGET) then
self:MoveTo(DRAGGING_TARGET);
else
self:MoveTo(MOD.private.Locations[self:GetName()]);
end
DRAGGING_TARGET = nil;
ToggleBarHighlights(false)
end
local DockButton_OnEnter = function(self, ...)
MOD:EnterFade()
self:SetPanelColor("highlight")
self.Icon:SetGradient(unpack(SV.media.gradient.highlight))
local tipAnchor = self:GetAttribute("tipAnchor")
GameTooltip:SetOwner(self, tipAnchor, 0, 4)
GameTooltip:ClearLines()
if(self.CustomTooltip) then
self:CustomTooltip()
else
local tipText = self:GetAttribute("tipText")
GameTooltip:AddDoubleLine("[Left-Click]", tipText, 0, 1, 0, 1, 1, 1)
GameTooltip:AddDoubleLine("[Right-Click]", "Hide", 0, 1, 0, 1, 1, 1)
GameTooltip:AddDoubleLine("[Shift+Click+Drag]", "Move To Another Dock", 0, 1, 0, 1, 1, 1)
end
if(self:GetAttribute("hasDropDown") and self.GetMenuList) then
GameTooltip:AddLine(" ")
GameTooltip:AddDoubleLine("[Alt+Click]", "Docking Options", 0, 0.5, 1, 0.5, 1, 0.5)
end
GameTooltip:Show()
end
local DockButton_OnLeave = function(self, ...)
MOD:ExitFade()
self:SetPanelColor("default")
if(self:GetAttribute("isActive")) then
self.Icon:SetGradient(unpack(SV.media.gradient.checked))
else
self.Icon:SetGradient(unpack(SV.media.gradient.icon))
end
GameTooltip:Hide()
end
local DockButton_OnClick = function(self, button)
if(self.ClickTheme) then
self:ClickTheme()
end
MOD.ButtonSound()
if(button and (button == "RightButton") and (not IsShiftKeyDown())) then
self.Parent.Parent.backdrop:Hide()
self:SetAttribute("isActive", false)
self:SetPanelColor("default")
if(self.Icon) then
self.Icon:SetGradient(unpack(SV.media.gradient.icon));
end
if(self.FrameLink) then
local registeredLocation = MOD.private.Locations[self.LocationKey];
HideDockletWindow(self, registeredLocation)
end
else
if(IsAltKeyDown() and (not InCombatLockdown()) and self:GetAttribute("hasDropDown") and self.GetMenuList) then
local list = self:GetMenuList();
SV.Dropdown:Open(self, list, "Dock Options");
else
local clickAllowed = false;
if(self.FrameLink) then
clickAllowed = DockBar_SetDefault(self.Parent, self)
else
clickAllowed = true;
end
if(self.PostClickFunction and clickAllowed) then
self:PostClickFunction(button)
end
end
end
end
local DockButton_OnPostClick = function(self, ...)
if InCombatLockdown() then
MOD.ErrorSound()
return
end
if(self.ClickTheme) then
self:ClickTheme()
end
MOD.ButtonSound()
if(IsAltKeyDown() and self:GetAttribute("hasDropDown") and self.GetMenuList) then
local list = self:GetMenuList();
SV.Dropdown:Open(self, list, "Dock Options");
end
end
local DockButton_GetMenuList = function(self)
local button = self;
local name = button:GetName();
local currentLocation = MOD.private.Locations[name];
local t;
if(self.ExternalMenuList) then
t = self:ExternalMenuList();
else
t = {}
end
tinsert(t, { title = "Re-Order", divider = true });
for i=1, #button.Parent.Data.Order do
if(i ~= button.OrderIndex) then
local positionText = ("Position #%d"):format(i);
tinsert(t, { text = positionText, func = function() DockBar_ChangeOrder(button.Parent, button, i) end });
end
end
return t;
end
local DockButton_SetDocked = function(self, attach)
if(not self.Parent) then return end
if(attach) then
if(not self.Parent.Add) then return end
self.Parent:Add(self)
else
if(not self.Parent.Remove) then return end
self.Parent:Remove(self)
end
end
local DockButton_MoveTo = function(self, location)
if(not MOD[location]) then return end
local previousLocation = MOD.private.Locations[self.LocationKey];
MOD[location].Bar:Add(self, true);
SV.Events:Trigger("DOCKLET_LIST_DECREASED", previousLocation);
SV.Events:Trigger("DOCKLET_LIST_INCREASED", location);
SV.Events:Trigger("DOCKLET_MOVED", self.LocationKey);
end
--[[
##########################################################
REMAINING DOCKBAR FUNCTIONS
##########################################################
]]--
local DockBar_CreateButton = function(self, displayName, globalName, texture, clickFunction, tipFunction, primaryTemplate, frameLink)
local dockIcon = texture or [[Interface\AddOns\SVUI_!Core\assets\textures\Dock\DOCK-ICON-ADDON]];
local size = self.ToolBar:GetHeight();
local template = "SVUI_DockletButtonTemplate"
local isAction = false;
if(primaryTemplate) then
template = primaryTemplate .. ", SVUI_DockletButtonTemplate";
isAction = true;
end
local button = _G[globalName .. "DockletButton"] or CreateFrame("Button", globalName, self.ToolBar, template)
button:ClearAllPoints()
button:SetSize(size, size)
MOD:SetButtonTheme(button, size)
button:SetPanelColor("default")
button.Icon:SetTexture(dockIcon)
button.Icon:SetGradient(unpack(SV.media.gradient.icon))
button:SetAttribute("tipText", displayName)
button:SetAttribute("tipAnchor", self.Data.TipAnchor)
button:SetScript("OnEnter", DockButton_OnEnter)
button:SetScript("OnLeave", DockButton_OnLeave)
button:RegisterForDrag("LeftButton");
button:SetScript("OnDragStart", DockButton_OnDragStart);
button:SetScript("OnDragStop", DockButton_OnDragStop);
if(not isAction) then
button:SetScript("OnClick", DockButton_OnClick)
else
button:SetScript("PostClick", DockButton_OnPostClick)
end
button.Parent = self;
button.OrderIndex = 0;
button.LocationKey = globalName;
button.MoveTo = DockButton_MoveTo
button.GetMenuList = DockButton_GetMenuList
button.SetDocked = DockButton_SetDocked
if(clickFunction and type(clickFunction) == "function") then
button.PostClickFunction = clickFunction
end
if(tipFunction and type(tipFunction) == "function") then
button.CustomTooltip = tipFunction
end
if(frameLink) then
button.FrameLink = frameLink
button.LinkKey = frameLink:GetName();
end
self:Add(button)
return button
end
function MOD:SetDockButton(location, displayName, globalName, texture, clickFunction, tipFunction, primaryTemplate)
if(not self.private) then return end
if(self.private.Locations[globalName]) then
location = self.private.Locations[globalName];
else
self.private.Locations[globalName] = location;
end
local parent = self[location]
return DockBar_CreateButton(parent.Bar, displayName, globalName, texture, clickFunction, tipFunction, primaryTemplate)
end
--[[
##########################################################
DOCKS
##########################################################
]]--
MOD.TopCenter = _G["SVUI_DockTopCenter"];
MOD.BottomCenter = _G["SVUI_DockBottomCenter"];
local DockBar_OnEvent = function(self, event)
if(event == 'PLAYER_REGEN_ENABLED') then
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
DockBar_SetDefault(self)
end
end
local DockAlert_Activate = function(self, child)
local size = SV.db.Dock.buttonSize or 22;
self:SetHeight(size)
self.backdrop:Show()
child:ClearAllPoints()
child:SetAllPoints(self)
end
local DockAlert_Deactivate = function(self)
self.backdrop:Hide()
self:SetHeight(1)
end
for location, settings in pairs(DOCK_LOCATIONS) do
MOD[location] = _G["SVUI_Dock" .. location];
MOD[location].Bar = _G["SVUI_DockBar" .. location];
MOD[location].Alert.Activate = DockAlert_Activate;
MOD[location].Alert.Deactivate = DockAlert_Deactivate;
MOD[location].Bar.Parent = MOD[location];
MOD[location].Bar.SetDefault = DockBar_SetDefault;
MOD[location].Bar.NextDefault = DockBar_NextDefault;
MOD[location].Bar.Reset = DockBar_ResetAll;
MOD[location].Bar.Update = DockBar_UpdateLayout;
MOD[location].Bar.Add = DockBar_AddButton;
MOD[location].Bar.Remove = DockBar_RemoveButton;
MOD[location].Bar.Create = DockBar_CreateButton;
MOD[location].Bar.Data = {
Location = location,
Anchor = settings[2],
Modifier = settings[1],
TipAnchor = settings[4],
Buttons = {},
Windows = {},
Order = {},
};
--MOD[location].Bar:SetScript("OnEvent", DockBar_OnEvent)
end
--[[
##########################################################
DOCKLETS (DOCK BUTTONS WITH ASSOCIATED WINDOWS)
##########################################################
]]--
local Docklet_Enable = function(self)
local dock = self.Parent;
if(self.Button) then dock.Bar:Add(self.Button) end
end
local Docklet_Disable = function(self)
local dock = self.Parent;
if(self.Button) then dock.Bar:Remove(self.Button) end
end
local Docklet_ButtonSize = function(self)
local size = self.Bar.ToolBar:GetHeight() or 30;
return size;
end
local Docklet_Relocate = function(self, location)
local newParent = MOD[location];
if(not newParent) then return end
if(self.Button) then
newParent.Bar:Add(self.Button)
end
if(self.Bar) then
local height = newParent.Bar.ToolBar:GetHeight();
local mod = newParent.Bar.Data[1];
local barAnchor = newParent.Bar.Data[2];
local barReverse = SV:GetReversePoint(barAnchor);
local spacing = SV.db.Dock.buttonSpacing;
self.Bar:ClearAllPoints();
self.Bar:SetPoint(barAnchor, newParent.Bar.ToolBar, barReverse, (spacing * mod), 0)
end
end
function MOD:NewDocklet(location, globalName, readableName, texture, onclick)
if(DOCK_REGISTRY[globalName]) then return end;
if(self.private.Locations[globalName]) then
location = self.private.Locations[globalName];
else
self.private.Locations[globalName] = location;
end
local newParent = self[location];
if(not newParent) then return end
newParent.backdrop:Show()
local frame = _G[globalName] or CreateFrame("Frame", globalName, UIParent, "SVUI_DockletWindowTemplate");
frame:SetParent(newParent.Window);
frame:SetSize(newParent.Window:GetSize());
frame:SetAllPoints(newParent.Window);
frame:SetFrameStrata("BACKGROUND");
frame.Parent = newParent
frame.Disable = Docklet_Disable;
frame.Enable = Docklet_Enable;
frame.Relocate = Docklet_Relocate;
frame.GetButtonSize = Docklet_ButtonSize;
newParent.Bar.Data.Windows[globalName] = frame;
local buttonName = ("%sButton"):format(globalName)
frame.Button = newParent.Bar:Create(readableName, buttonName, texture, onclick, false, false, frame);
DOCK_REGISTRY[globalName] = frame;
frame:SetAlpha(0)
DOCK_CHECK = true
return frame
end
function MOD:NewAdvancedDocklet(location, globalName)
if(DOCK_REGISTRY[globalName]) then return end;
if(self.private.Locations[globalName]) then
location = self.private.Locations[globalName];
else
self.private.Locations[globalName] = location;
end
local newParent = self[location];
if(not newParent) then return end
newParent.backdrop:Show()
local frame = CreateFrame("Frame", globalName, UIParent, "SVUI_DockletWindowTemplate");
frame:SetParent(newParent.Window);
frame:SetSize(newParent.Window:GetSize());
frame:SetAllPoints(newParent.Window);
frame:SetFrameStrata("BACKGROUND");
frame.Parent = newParent;
frame.Disable = Docklet_Disable;
frame.Enable = Docklet_Enable;
frame.Relocate = Docklet_Relocate;
frame.GetButtonSize = Docklet_ButtonSize;
newParent.Bar.Data.Windows[globalName] = frame;
local height = newParent.Bar.ToolBar:GetHeight();
local mod = newParent.Bar.Data.Modifier;
local barAnchor = newParent.Bar.Data.Anchor;
local barReverse = SV:GetReversePoint(barAnchor);
local spacing = SV.db.Dock.buttonSpacing;
frame.Bar = CreateFrame("Frame", globalName.."Bar", newParent);
frame.Bar:SetSize(1, height);
frame.Bar:SetPoint(barAnchor, newParent.Bar.ToolBar, barReverse, (spacing * mod), 0)
SV:NewAnchor(frame.Bar, globalName .. " Dock Bar");
DOCK_REGISTRY[globalName] = frame;
DOCK_CHECK = true
return frame
end
--[[
##########################################################
BUILD/UPDATE
##########################################################
]]--
local CornerButton_OnEnter = function(self, ...)
MOD:EnterFade()
self:SetPanelColor("highlight")
self.Icon:SetGradient(unpack(SV.media.gradient.highlight))
GameTooltip:SetOwner(self, "ANCHOR_TOPLEFT", 0, 4)
GameTooltip:ClearLines()
local tipText = self:GetAttribute("tipText")
GameTooltip:AddDoubleLine("[Left-Click]", tipText, 0, 1, 0, 1, 1, 1)
local tipExtraText = self:GetAttribute("tipExtraText")
GameTooltip:AddDoubleLine("[Right-Click]", tipExtraText, 0, 1, 0, 1, 1, 1)
GameTooltip:AddLine(" ")
GameTooltip:AddDoubleLine("[Alt + Click]", "Reset Dock Buttons", 0, 0.5, 1, 0.5, 1, 0.5)
GameTooltip:Show()
end
local CornerButton_OnLeave = function(self, ...)
MOD:ExitFade()
self:SetPanelColor("default")
if(self:GetAttribute("isActive")) then
self.Icon:SetGradient(unpack(SV.media.gradient.checked))
else
self.Icon:SetGradient(unpack(SV.media.gradient.icon))
end
GameTooltip:Hide()
end
function MOD:UpdateDockBackdrops()
if(DOCK_CHECK and SV.db.Dock.rightDockBackdrop) then
MOD.BottomRight.backdrop:Show()
MOD.BottomRight.backdrop:ClearAllPoints()
MOD.BottomRight.backdrop:WrapPoints(MOD.BottomRight.Window, 4, 4)
MOD.BottomRight.Alert.backdrop:ClearAllPoints()
MOD.BottomRight.Alert.backdrop:WrapPoints(MOD.BottomRight.Alert, 4, 4)
else
MOD.BottomRight.backdrop:Hide()
end
if(DOCK_CHECK and SV.db.Dock.leftDockBackdrop) then
MOD.BottomLeft.backdrop:Show()
MOD.BottomLeft.backdrop:ClearAllPoints()
MOD.BottomLeft.backdrop:WrapPoints(MOD.BottomLeft.Window, 4, 4)
MOD.BottomLeft.Alert.backdrop:ClearAllPoints()
MOD.BottomLeft.Alert.backdrop:WrapPoints(MOD.BottomLeft.Alert, 4, 4)
else
MOD.BottomLeft.backdrop:Hide()
end
end
function MOD:ResetAllButtons()
wipe(MOD.private.Order)
wipe(MOD.private.Locations)
ReloadUI()
end
function MOD:Refresh()
local buttonsize = SV.db.Dock.buttonSize;
local spacing = SV.db.Dock.buttonSpacing;
for location, settings in pairs(DOCK_LOCATIONS) do
local width, height = GetDockDimensions(location);
local dock = self[location];
dock.Bar:SetSize(width, buttonsize)
dock.Bar.ToolBar:SetHeight(buttonsize)
dock:SetSize(width, height)
dock.Alert:SetSize(width, 1)
dock.Window:SetSize(width, height)
if(dock.Bar.Button) then
dock.Bar.Button:SetSize(buttonsize, buttonsize)
end
dock.Bar:Update()
end
local centerWidth = SV.db.Dock.dockCenterWidth;
local dockWidth = centerWidth * 0.5;
local dockHeight = SV.db.Dock.dockCenterHeight;
self.BottomCenter:SetSize(centerWidth, dockHeight);
self.TopCenter:SetSize(centerWidth, dockHeight);
ScreenBorderVisibility();
self:UpdateDockBackdrops();
self:UpdateProfessionTools();
self:UpdateMiscTools();
self:UpdateGarrisonTool();
self:UpdateRaidLeader();
SV.Events:Trigger("DOCKS_UPDATED");
end
function MOD:PLAYER_REGEN_ENABLED()
self:UnregisterEvent('PLAYER_REGEN_ENABLED')
if(self.ProfessionNeedsUpdate) then
self.ProfessionNeedsUpdate = nil;
self:UpdateProfessionTools()
end
if(self.MiscNeedsUpdate) then
self.MiscNeedsUpdate = nil;
self:UpdateMiscTools()
end
if(self.GarrisonNeedsUpdate) then
self.GarrisonNeedsUpdate = nil;
self:UpdateGarrisonTool()
end
if(self.RaidLeaderNeedsUpdate) then
self.RaidLeaderNeedsUpdate = nil;
self:UpdateRaidLeader()
end
end
function MOD:Load()
if(not SV.private.Docks) then
SV.private.Docks = {}
end
self.private = SV.private.Docks;
if(not self.private.AllFaded) then
self.private.AllFaded = false
end
if(not self.private.LeftFaded) then
self.private.LeftFaded = false
end
if(not self.private.RightFaded) then
self.private.RightFaded = false
end
if(not self.private.LeftExpanded) then
self.private.LeftExpanded = false
end
if(not self.private.RightExpanded) then
self.private.RightExpanded = false
end
if(not self.private.Order) then
self.private.Order = {}
end
if(not self.private.DefaultDocklets) then
self.private.DefaultDocklets = {}
end
if(not self.private.Locations) then
self.private.Locations = {}
end
local buttonsize = SV.db.Dock.buttonSize;
local spacing = SV.db.Dock.buttonSpacing;
-- [[ TOP AND BOTTOM BORDERS ]] --
self.Border.Top = CreateFrame("Frame", "SVUIDock_TopBorder", SV.Screen);
self.Border.Bottom = CreateFrame("Frame", "SVUIDock_BottomBorder", SV.Screen);
self:SetBorderTheme();
ScreenBorderVisibility();
for location, settings in pairs(DOCK_LOCATIONS) do
local width, height = GetDockDimensions(location);
local dock = self[location];
local mod = settings[1];
local anchor = upper(location);
local reverse = SV:GetReversePoint(anchor);
local barAnchor = settings[2];
local barReverse = SV:GetReversePoint(barAnchor);
local isBottom = settings[3];
local vertMod = isBottom and 1 or -1
dock.Bar:SetParent(SV.Screen)
dock.Bar:ClearAllPoints()
dock.Bar:SetSize(width, buttonsize)
dock.Bar:SetPoint(anchor, SV.Screen, anchor, (2 * mod), (2 * vertMod))
local highlight = CreateFrame("Frame", nil, dock.Bar)
if(location:find('Top')) then
highlight:SetPoint("TOPLEFT", dock.Bar, "TOPLEFT", 0, 0)
highlight:SetPoint("TOPRIGHT", dock.Bar, "TOPRIGHT", 0, 0)
highlight:SetHeight(buttonsize * 2)
highlight.texture = highlight:CreateTexture(nil, "OVERLAY")
highlight.texture:SetAllPoints()
highlight.texture:SetTexture(SV.media.statusbar.default);
highlight.texture:SetGradientAlpha("VERTICAL",0,0.3,0.3,0,0,1,1,0.8)
else
highlight:SetPoint("BOTTOMLEFT", dock.Bar, "BOTTOMLEFT", 0, 0)
highlight:SetPoint("BOTTOMRIGHT", dock.Bar, "BOTTOMRIGHT", 0, 0)
highlight:SetHeight(buttonsize * 2)
highlight.texture = highlight:CreateTexture(nil, "OVERLAY")
highlight.texture:SetAllPoints()
highlight.texture:SetTexture(SV.media.statusbar.default);
highlight.texture:SetGradientAlpha("VERTICAL",0,1,1,0.8,0,0.3,0.3,0)
end
highlight:Hide()
dock.Bar.Highlight = highlight
if(not MOD.private.Order[location]) then
MOD.private.Order[location] = {}
end
dock.Bar.Data.Order = MOD.private.Order[location];
dock.Bar.ToolBar:ClearAllPoints()
if(dock.Bar.Button) then
dock.Bar.Button:SetSize(buttonsize, buttonsize)
self:SetButtonTheme(dock.Bar.Button, buttonsize)
dock.Bar.Button.Icon:SetTexture(SV.media.icon.default)
dock.Bar.ToolBar:SetSize(1, buttonsize)
dock.Bar.ToolBar:SetPoint(barAnchor, dock.Bar.Button, barReverse, (spacing * mod), 0)
dock.Bar.Button:SetPanelColor("default")
dock.Bar.Button.Icon:SetGradient(unpack(SV.media.gradient.icon))
dock.Bar.Button:SetScript("OnEnter", CornerButton_OnEnter)
dock.Bar.Button:SetScript("OnLeave", CornerButton_OnLeave)
if(location == "BottomLeft") then
dock.Bar.Button:SetScript("OnClick", ToggleSuperDockLeft)
else
dock.Bar.Button:SetScript("OnClick", ToggleSuperDockRight)
end
else
dock.Bar.ToolBar:SetSize(1, buttonsize)
dock.Bar.ToolBar:SetPoint(barAnchor, dock.Bar, barAnchor, 0, 0)
end
dock:SetParent(SV.Screen)
dock:ClearAllPoints()
dock:SetPoint(anchor, dock.Bar, reverse, 0, (12 * vertMod))
dock:SetSize(width, height)
dock:SetAttribute("buttonSize", buttonsize)
dock:SetAttribute("spacingSize", spacing)
dock.Alert:ClearAllPoints()
dock.Alert:SetSize(width, 1)
dock.Alert:SetPoint(anchor, dock, anchor, 0, 0)
dock.Window:ClearAllPoints()
dock.Window:SetSize(width, height)
dock.Window:SetPoint(anchor, dock.Alert, reverse, 0, 4)
dock.backdrop = self.SetThemeDockStyle(dock.Window, isBottom)
dock.backdrop:Hide()
dock.Alert.backdrop = self.SetThemeDockStyle(dock.Alert, isBottom)
dock.Alert.backdrop:Hide()
SV:NewAnchor(dock.Bar, location .. " Dock ToolBar");
SV:SetAnchorResizing(dock.Bar, dockBarPostSizeFunc, 10, 500, 10, 80);
SV:NewAnchor(dock, location .. " Dock Window");
SV:SetAnchorResizing(dock, dockPostSizeFunc, 10, 500);
end
if MOD.private.LeftFaded then MOD.BottomLeft:Hide() end
if MOD.private.RightFaded then MOD.BottomRight:Hide() end
SV:ManageVisibility(self.BottomRight.Window)
SV:ManageVisibility(self.TopLeft)
SV:ManageVisibility(self.TopRight)
--SV:ManageVisibility(self.BottomCenter)
SV:ManageVisibility(self.TopCenter)
local centerWidth = SV.db.Dock.dockCenterWidth;
local dockHeight = SV.db.Dock.dockCenterHeight;
self.TopCenter:SetParent(SV.Screen)
self.TopCenter:ClearAllPoints()
self.TopCenter:SetSize(centerWidth, dockHeight)
self.TopCenter:SetPoint("TOP", SV.Screen, "TOP", 0, 0)
self.BottomCenter:SetParent(SV.Screen)
self.BottomCenter:ClearAllPoints()
self.BottomCenter:SetSize(centerWidth, dockHeight)
self.BottomCenter:SetPoint("BOTTOM", SV.Screen, "BOTTOM", 0, 0)
DockBar_SetDefault(self.BottomLeft.Bar)
DockBar_SetDefault(self.BottomRight.Bar)
DockBar_SetDefault(self.TopLeft.Bar)
DockBar_SetDefault(self.TopRight.Bar)
self:LoadProfessionTools();
self:LoadAllMiscTools();
self:LoadGarrisonTool();
self:LoadRaidLeaderTools();
self:LoadBreakStuff();
end
local function UpdateAllDocks()
for location, settings in pairs(DOCK_LOCATIONS) do
local dock = MOD[location];
DockBar_SetDefault(dock.Bar)
end
MOD:UpdateDockBackdrops()
end
SV:NewScript(UpdateAllDocks)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.