content stringlengths 5 1.05M |
|---|
local name = "car_orange"
local definition = ...
definition.description = "Orange car"
definition.inventory_image = "inv_car_orange.png"
definition.wield_image = "inv_car_orange.png"
definition.textures = {"car_orange.png"}
vehicle_mash.register_vehicle("vehicle_mash:"..name, definition)
|
return function(a, b, c0)
local w = Instance.new("Weld")
w.Part0 = a
w.Part1 = b
w.C0 = c0 or CFrame.new()
w.C1 = CFrame.new()
w.Parent = a
return w
end
|
local i18n = require("core.i18n")
i18n.add {
element = {
name = {
starving = "starving",
rotten = "rotten",
fearful = "fearful",
silky = "silky",
_50 = "burning",
_51 = "icy",
_52 = "electric",
_54 = "psychic",
_58 = "numb",
_57 = "shivering",
_55 = "poisonous",
_56 = "infernal",
_59 = "chaotic",
_53 = "gloomy",
_61 = "cut",
_62 = "ether",
},
damage = {
default = "{name($1)} {is($1)} wounded.",
_50 = "{name($1)} {is($1)} burnt.",
_51 = "{name($1)} {is($1)} frozen.",
_52 = "{name($1)} {is($1)} shocked.",
_53 = "{name($1)} {is($1)} struck by dark force.",
_54 = "{name($1)} suffer{s($1)} a splitting headache.",
_55 = "{name($1)} suffer{s($1)} from venom.",
_56 = "{name($1)} {is($1)} chilled by infernal squall.",
_57 = "{name($1)} {is($1)} shocked by a shrill sound.",
_58 = "{name($1)}{his_owned($1)} nerves are hurt.",
_59 = "{name($1)} {is($1)} hurt by chaotic force.",
-- _60
_61 = "{name($1)} get{s($1)} a cut.",
-- _62
_63 = "{name($1)} {is($1)} burnt by acid.",
},
resist = {
gain = {
_50 = "Suddenly, {name($1)} feel{s($1)} very hot.",
_51 = "Suddenly, {name($1)} feel{s($1)} very cool.",
_52 = "{name($1)}{is($1)} struck by an electric shock.",
_54 = "Suddenly, {name($1)}{his_owned($1)} mind becomes very clear.",
_58 = "{name($1)}{his_owned($1)} nerve is sharpened.",
_53 = "{name($1)} no longer fear{s($1)} darkness.",
_57 = "{name($1)}{his_owned($1)} eardrums get thick.",
_59 = "Suddenly, {name($1)} understand{s($1)} chaos.",
_55 = "{name($1)} now {have($1)} antibodies to poisons.",
_56 = "{name($1)} {is($1)} no longer afraid of hell.",
_60 = "{name($1)}{his_owned($1)} body is covered by a magical aura.",
},
lose = {
_50 = "{name($1)} sweat{s($1)}.",
_51 = "{name($1)} shiver{s($1)}.",
_52 = "{name($1)} {is($1)} shocked.",
_54 = "{name($1)}{his_owned($1)} mind becomes slippery.",
_58 = "{name($1)} become{s($1)} dull.",
_53 = "Suddenly, {name($1)} fear{s($1)} darkness.",
_57 = "{name($1)} become{s($1)} very sensitive to noises.",
_59 = "{name($1)} no longer understand{s($1)} chaos.",
_55 = "{name($1)} lose{s($1)} antibodies to poisons.",
_56 = "{name($1)} {is($1)} afraid of hell.",
_60 = "The magical aura disappears from {name($1)}{his_owned($1)} body.",
},
},
},
}
|
target("dakku.filters")
set_kind("shared")
add_defines("DAKKU_BUILD_MODULE=DAKKU_FILTERS_MODULE")
add_includedirs(os.projectdir() .. "/src", {public = true})
add_files("*.cpp")
add_deps("dakku.core") |
if myHero.charName ~= "TwistedFate" then return end
function OnLoad()
CardPick()
end
function Print(msg)
print("<font color=\"#5E9C19\">Card Picker ></font><font color=\"#5E9C41\"> "..msg.."</font>")
end
class 'CardPick'
function CardPick:__init()
ToSelectCard = nil
RN = 0
Menu = scriptConfig("Card Picker", "HiranNCardPick")
Menu:addParam("Yellow", "Yellow Card Key", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("W"))
Menu:addParam("Red", "Red Card Key", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("E"))
Menu:addParam("Blue", "Blue Card Key", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("T"))
Menu:addParam("R", "Select Gold Card in Ultimate", SCRIPT_PARAM_ONOFF, true)
Menu:addParam("On", "Only Select Card: When W is READY", SCRIPT_PARAM_ONOFF, true)
AddTickCallback(function() self:Tick() end)
AddTickCallback(function() self:Tick() end)
AddCastSpellCallback(function(iSpell, startPos, endPos, targetUnit) self:OnCastSpell(iSpell, startPos, endPos, targetUnit) end)
Print("Loaded !")
end
function CardPick:Tick()
if myHero.dead then
return
end
if myHero:CanUseSpell(_W) == READY then
if ToSelectCard ~= nil and myHero:GetSpellData(_W).name == "PickACard" then
CastSpell(_W)
end
if ToSelectCard ~= nil and myHero:GetSpellData(_W).name:find(ToSelectCard) then
CastSpell(_W)
end
end
end
function CardPick:OnCastSpell(iSpell, startPos, endPos, targetUnit)
if iSpell == 1 and ToSelectCard ~= nil and myHero:GetSpellData(_W).name:find(ToSelectCard) then
ToSelectCard = nil
end
if iSpell == 3 then
RN = RN + 1
if Menu.R and RN >= 2 and myHero:CanUseSpell(_W) == READY then
ToSelectCard = "Gold"
RN = 0
end
end
end
function OnWndMsg(msg, key)
if Menu.On and myHero:CanUseSpell(_W) ~= READY then
return
end
if key == Menu._param[1].key then
ToSelectCard = "Gold"
elseif key == Menu._param[2].key then
ToSelectCard = "Red"
elseif key == Menu._param[3].key then
ToSelectCard = "Blue"
end
end
function CardPick:Update()
Version = 0.10
if Version ~= TCPGetRequest("s1mplescripts.de", "/HiranN/BoL/Versions/Card%20Picker.version", {}, 80) then
Print("Downloading new version, don't press 2x F9.")
GetWebFile("s1mplescripts.de","/HiranN/BoL/Scripts/Card%20Picker.lua",{},SCRIPT_PATH..GetCurrentEnv().FILE_NAME)
else
Print("You are using the latest version. ("..Version..")")
end
end
function TCPGetRequest(server, path, data, port)
local start_t = os.clock()
local port = port or 80
local data = data or {}
local lua_socket = require("socket")
local connection_tcp = lua_socket.connect(server,port)
local requeststring = "GET "..path
local first = true
for i,v in pairs(data)do
requeststring = requeststring..(first and "?" or "&")..i.."="..v
first = false
end
requeststring = requeststring.. " HTTP/1.0\r\nHost: "..server.."\r\n\r\n"
connection_tcp:send(requeststring)
local response = ""
local status
while true do
s,status, partial = connection_tcp:receive('*a')
response = response..(s or partial)
if(status == "closed" or status == "timeout")then
break
end
end
local end_t = os.clock()
local start_content = response:find("\r\n\r\n")+4
response = response:sub(start_content)
return response, status, end_t-start_t
end
function GetWebFile(server, path, data, localfilename, port, b64)
local r,s,t = TCPGetRequest(server, path, data, port)
local a,b
if b64 then
a,b = Base64Decode(r)
else
a = r
end
if (a ~= "No_new_version" and a ~= "Invalid Request" and a ~= "MYSQL Error" and a ~= "") then
file = io.open(localfilename,"w+b")
file:write(a)
file:close()
Print("New version downloaded, press 2x F9.")
return true
else
if a ~= "No_new_version" then
print(a, 4)
end
return false
end
end |
local shortCutRecharge=
{
name="shortCutRecharge",type=0,typeName="View",time=0,report=0,x=0,y=0,width=0,height=0,visible=1,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignTopLeft
}
return shortCutRecharge; |
need_boolean(in_site({'config_mode', 'geo_location', 'show_altitude'}), false)
|
local class = require 'external.middleclass.middleclass'
local Player = class('Player')
function Player:initialize(input)
--Init player variables.
self.x = 400
self.y = 300
self.speed = 3
self.size = 20
self.origin_x = self.x + (self.size / 2)
self.origin_y = self.y + (self.size / 2)
self.mouse_x = 0
self.mouse_y = 0
self.item = love.graphics.newImage("/res/sprites/magnet.png")
self.theta_magnet = 0
--Bind player inputs.
input:bind('w', 'up')
input:bind('up', 'up')
input:bind('s', 'down')
input:bind('down', 'down')
input:bind('a', 'left')
input:bind('left', 'left')
input:bind('d', 'right')
input:bind('right', 'right')
input:bind('lshift', 'sprint')
input:bind('mouse1', 'shoot')
end
function Player:update(dt)
-- Update player speed first.
if input:down('up') then
self.y = self.y - self.speed
end
if input:down('down') then
self.y = self.y + self.speed
end
if input:down('left') then
self.x = self.x - self.speed
end
if input:down('right') then
self.x = self.x + self.speed
end
if input:pressed('sprint') then
self.speed = self.speed * 3
end
if input:released('sprint') then
self.speed = 3
end
-- Update values for the center of the player.
self.origin_x = self.x + (self.size / 2)
self.origin_y = self.y + (self.size / 2)
-- Update the magnet sprite angle based on
-- the mouse position.
self.mouse_x = love.mouse.getX()
self.mouse_y = love.mouse.getY()
local angle_x = self.mouse_x - self.x
local angle_y = self.mouse_y - self.y
self.theta_magnet = math.atan2(-angle_y, angle_x)
end
function Player:draw()
love.graphics.setColor(201/255, 81/255, 120/255, 1)
if input:down('shoot') then
love.graphics.line(self.origin_x, self.origin_y, self.mouse_x, self.mouse_y)
end
love.graphics.draw(self.item,
self.origin_x,
self.origin_y,
-self.theta_magnet,
3,
3,
0,
self.item:getHeight()/2)
end
function Player:getPosition()
return self.x, self.y
end
function Player:getOriginPosition()
return self.origin_x, self.origin_y
end
return Player
|
local function EventHook(listener_id, namespace, group, event, callback)
local lua_listener = obe.Event.LuaEventListener(callback);
Engine.Events:getNamespace(namespace)
:getGroup(group)
:get(event)
:addExternalListener(listener_id, lua_listener);
local hook_mt = {
__call = function(object, ...)
object.callback(...);
end,
clean = function(object)
Engine.Events:getNamespace(namespace)
:getGroup(group)
:get(event)
:removeExternalListener(listener_id);
end,
listener_id = listener_id,
event_id = ("%s.%s.%s"):format(namespace, group, event)
};
return setmetatable({callback = callback}, hook_mt);
end
local function EventGroupHook(listener_id, namespace, group)
local hook_mt = {
__newindex = function(object, event, callback)
if type(callback) == "function" then
local mt = getmetatable(object);
Engine.Events:getNamespace(namespace):getGroup(group):get(event)
:addExternalListener(
listener_id, obe.Event.LuaEventListener(callback)
);
mt.__storage[event] = setmetatable(
{}, {
__call = callback,
listener_id = listener_id,
event_id = ("%s.%s.%s"):format(namespace, group, event)
}
);
elseif type(callback) == "nil" then
local mt = getmetatable(object);
mt.__storage[event] = nil;
Engine.Events:getNamespace(namespace):getGroup(group):get(event)
:removeExternalListener(
listener_id
);
else
error(
("unsupported callback for event %s.%s.%s (expects <function> or <nil>)"):format(
namespace, group, event
)
);
end
end,
__index = function(object, event)
local mt = getmetatable(object);
if mt.__storage[event] then
return mt.__storage[event];
else
if Engine.Events:getNamespace(namespace):getGroup(group):contains(event) then
return setmetatable(
{}, {
__call = function()
error(
("Callback for event %s.%s.%s is not implemented"):format(
namespace, group, event
)
);
end,
listener_id = listener_id,
event_id = ("%s.%s.%s"):format(namespace, group, event)
}
);
else
error(("Event %s.%s.%s does not exists"):format(namespace, group, event));
end
end
end,
clean = function(object)
local mt = getmetatable(object);
local group_exists = Engine.Events:getNamespace(namespace):doesGroupExists(group);
for event_name, _ in pairs(mt.__storage) do
mt.__storage[event_name] = nil;
if group_exists then
Engine.Events:getNamespace(namespace):getGroup(group):get(event_name)
:removeExternalListener(
listener_id
);
end
end
end,
__call = function(object)
return Engine.Events:getNamespace(namespace):joinGroup(group);
end,
__storage = {},
listener_id = listener_id
};
return setmetatable({}, hook_mt);
end
local function EventNamespaceHook(listener_id, namespace)
local hook_mt = {
__index = function(object, key)
local mt = getmetatable(object);
local groups = Engine.Events:getNamespace(namespace):getAllGroupsNames();
for _, v in pairs(groups) do
if v == key then
if mt.__storage[key] == nil then
mt.__storage[key] = EventGroupHook(listener_id, namespace, key);
end
return mt.__storage[key];
end
end
error("EventGroup " .. key .. " doesn't exists in namespace " .. namespace);
end,
clean = function(object)
local mt = getmetatable(object);
for event_group_name, group_hook in pairs(mt.__storage) do
getmetatable(group_hook).clean(group_hook);
end
end,
__call = function(object)
return Engine.Events:joinNamespace(namespace);
end,
__storage = {},
listener_id = listener_id
};
return setmetatable({}, hook_mt);
end
local function listen(listen_target, callback, listener_id)
local _, dots_in_listen_target = string.gsub(listen_target, "%.", "")
if dots_in_listen_target == 0 then
return EventNamespaceHook(listener_id, listen_target);
elseif dots_in_listen_target == 1 then
local match = string.gmatch(listen_target, "([^.]+).([^.]+)");
local event_namespace, event_group = match();
return EventGroupHook(listener_id, event_namespace, event_group);
elseif dots_in_listen_target == 2 then
if type(callback) ~= "function" then
error("must specify second argument 'callback' to listen of type <function>");
end
local match = string.gmatch(listen_target, "([^.]+).([^.]+).([^.]+)");
local event_namespace, event_group, event_name = match();
return EventHook(listener_id, event_namespace, event_group, event_name, callback);
end
end
return {
EventHook = EventHook,
EventGroupHook = EventGroupHook,
EventNamespaceHook = EventNamespaceHook,
listen = listen
}
|
local CATEGORY_NAME = "MapVote"
------------------------------ VoteMap ------------------------------
function AMB_mapvote( calling_ply, votetime, should_cancel )
if not should_cancel then
MapVote.Start(votetime, nil, nil, nil)
ulx.fancyLogAdmin( calling_ply, "#A called a votemap!" )
else
MapVote.Cancel()
ulx.fancyLogAdmin( calling_ply, "#A canceled the votemap" )
end
end
local mapvotecmd = ulx.command( CATEGORY_NAME, "mapvote", AMB_mapvote, "!mapvote" )
mapvotecmd:addParam{ type=ULib.cmds.NumArg, min=15, default=25, hint="time", ULib.cmds.optional, ULib.cmds.round }
mapvotecmd:addParam{ type=ULib.cmds.BoolArg, invisible=true }
mapvotecmd:defaultAccess( ULib.ACCESS_ADMIN )
mapvotecmd:help( "Invokes the map vote logic" )
mapvotecmd:setOpposite( "unmapvote", {_, _, true}, "!unmapvote" ) |
RGWDebugLog("Post req number of metadata entries is: " .. #Request.HTTP.Metadata)
for k, v in pairs(Request.HTTP.Metadata) do
RGWDebugLog("key=" .. k .. ", " .. "value=" .. v)
--RGWDebugLog("Storage Class Header avail on: " .. Request.Object.Name .. " and storage class: " .. Request.HTTP.Metadata["x-amz-storage-class"])
end
|
local M = {}
M.controller = require('findr.controller')
function M.init(source, directory)
M.controller.init(source, directory)
end
function M.reset()
M.controller.reset()
end
function M.quit()
M.controller.quit()
end
return M
|
local npcConfig = require "config.npcConfig"
local IconFrameHelper = require "utils.IconFrameHelper"
local ItemModule = require "module.ItemModule"
local View = {};
function View:Start(data)
self.view = CS.SGK.UIReference.Setup(self.gameObject)
self.Data = data
local npc_List = npcConfig.GetnpcList()
local npc_Friend_cfg = npcConfig.GetNpcFriendList()[data.id]
self.view.mask[CS.UGUIClickEventListener].onClick = function ( ... )
UnityEngine.GameObject.Destroy(self.gameObject)
end
self.view.Root.exitBtn[CS.UGUIClickEventListener].onClick = function ( ... )
UnityEngine.GameObject.Destroy(self.gameObject)
end
self.view.Root.desc[UI.Text].text = "喜欢:美元、软妹币、欧元\n厌恶:不值钱的东西"
self.view.Root.name[UI.Text].text = npc_List[data.id].name
local relation = StringSplit(npc_Friend_cfg.qinmi_max,"|")
local relation_desc = StringSplit(npc_Friend_cfg.qinmi_name,"|")
local relation_value = ItemModule.GetItemCount(npc_Friend_cfg.arguments_item_id)
local relation_index = 0
for i = 1,#relation do
if relation_value >= tonumber(relation[i]) then
relation_index = i
end
end
self.view.Root.value[UI.Text].text = relation_value
self.view.Root.relation[UI.Text].text = relation_desc[relation_index]
self.view.Root.statusbg[CS.UGUISpriteSelector].index = relation_index-1
local item_id = {90002,90006}
local item_count = {999999999,999999999}
for i = 1,#item_id do
IconFrameHelper.Item({id = item_id[i],count = item_count[i]},self.view.Root.Group,{showDetail = true})
end
self.view.Root.yBtn[CS.UGUIClickEventListener].onClick = function ( ... )
-- local shop = module.ShopModule.GetManager((data.id*100)+1)
-- module.ShopModule.GetManager((data.id*100)+98)
-- module.ShopModule.GetManager((data.id*100)+99)
DialogStack.PushPref("npcBribeTaking",{id = self.Data.id,item_id = self.Data.item_id},self.view.gameObject)
-- if shop and shop.shoplist then
-- DialogStack.PushPref("npcBribeTaking",{id = self.Data.id},self.view.gameObject)
-- else
-- showDlgError(nil,"才这么一点?你是打发要饭的吗?")
-- end
end
end
function View:onEvent(event,data)
if event == "SHOP_INFO_CHANGE" then
--DialogStack.PushPref("npcBribeTaking",{id = self.Data.id},self.view.gameObject)
end
end
function View:listEvent()
return {
"SHOP_INFO_CHANGE",
}
end
return View
|
--[[
This is a basic on/off switch. we could generalize to a multi-state
switch, where this would just be a specialization, but this will
do for now.
The switch will change state based on doing a mouseUp within
its frame. mousedown and drag have no effect.
It will signal with:
self, "changedstate", self.isOn
That's enough information for a handler to know which switch
is doing the signaling, the fact that it's a change state
and what is the new current state. That's good, but, the handler
may not run before the state changes again, so it can call
getOnState() and get the current state directly.
You can construct a switch by simply calling the new() method with
a frame. If you don't specify a frame (default constructor), you'll get
a simple switch with a default size, and location 0,0
]]
local GraphicGroup = require("GraphicGroup")
local BOnOffSwitch = {
thickness = 32;
}
setmetatable(BOnOffSwitch, {
__index = GraphicGroup
})
local BOnOffSwitch_mt = {
__index = BOnOffSwitch;
}
function BOnOffSwitch.new(self, obj)
obj = obj or {
frame = {x=0,y=0,width=self.thickness*2,height=self.thickness};
}
obj = GraphicGroup:new(obj)
obj.frame = obj.frame or {x=0,y=0,width=self.thickness*2,height=self.thickness}
obj.thumbRadius = (obj.frame.height/2)-2
setmetatable(obj, BOnOffSwitch_mt)
return obj;
end
-- For anyone who's curious, they can call
-- this function to determine whether the switch
-- is currently 'on'==true or not.
function BOnOffSwitch.getOnState(self)
return self.isOn
end
-- change state and trigger a signal based
-- on mouseUp activity
function BOnOffSwitch.mouseUp(self, event)
self.isOn = not self.isOn;
signalAll(self, self, "changedstate", self.isOn)
return true;
end
-- In order to get different appearance, simply implement a
-- different version of draw. Doing it as drawBackground might
-- be better so GraphicGroup drawing behavior is maintained.
function BOnOffSwitch.drawBackground(self, ctx)
--print("BOnOffSwitch.draw")
-- create a roundRect for our frame
local rrect = BLRoundRect(0,0,self.frame.width,self.frame.height,self.frame.height/2,self.frame.height/2)
-- fill in the background depending on our current state
if self.isOn then
ctx:stroke(0)
ctx:fill(63,0x7f,0xff) -- turquoise
ctx:fillRoundRect(rrect)
ctx:strokeRoundRect(rrect)
-- draw thumb
ctx:noStroke()
ctx:fill(255)
ctx:circle(self.frame.width-self.thumbRadius-2, self.frame.height/2, self.thumbRadius)
else
ctx:stroke(0)
ctx:fill(0x7f) -- mid-gray
ctx:fillRoundRect(rrect)
ctx:strokeRoundRect(rrect)
ctx:noStroke();
ctx:fill(0)
ctx:circle(self.thumbRadius+2, self.frame.height/2, self.thumbRadius)
end
end
return BOnOffSwitch;
|
-- HttpServer.lua
local SocketServer = require("SocketServer")
local NativeSocket = require("NativeSocket")
local NetStream = require("NetStream");
local WebRequest = require("WebRequest");
local WebResponse = require("WebResponse");
local URL = require("url");
local Functor = require("Functor")
local HttpServer = {}
setmetatable(HttpServer, {
__call = function(self, ...)
return self:create(...);
end,
});
local HttpServer_mt = {
__index = HttpServer;
}
HttpServer.init = function(self, port, onRequest)
local obj = {
OnRequest = onRequest;
};
setmetatable(obj, HttpServer_mt);
obj.Listener = SocketServer(port, Functor(obj.OnAccept, obj));
return obj;
end
HttpServer.create = function(self, port, onRequest)
return self:init(port, onRequest);
end
--[[
Instance Methods
--]]
HttpServer.HandleRequestFinished = function(self, request)
-- Once we're done with this single request
-- send it back aroud again in case there is
-- more to be processed.
local sock = request.DataStream.Socket:getNativeSocket();
self:OnAccept(sock);
end
HttpServer.HandlePreamblePending = function(self, sock)
local socket = NativeSocket:init(sock);
local stream, err = NetStream:init(socket);
if self.OnRequest then
local request, err = WebRequest:Parse(stream);
if request then
request.Url = URL.parse(request.Resource);
local response = WebResponse:OpenResponse(request.DataStream)
self.OnRequest(request, response);
else
print("HandleSingleRequest, Dump stream: ", err)
socket:closeDown();
end
else
socket:closeDown();
end
end
HttpServer.OnAccept = function(self, sock)
--print("HttpServer.OnAccept(): ", self, sock, self.OnRequest);
spawn(self.HandlePreamblePending, self, sock);
end
HttpServer.run = function(self)
return self.Listener:run();
end
return HttpServer;
|
--- The main module, which exports the Wonderful class.
-- @module wonderful
local component = require("component")
local event = require("event")
local class = require("lua-objects")
local document = require("wonderful.element.document")
local display = require("wonderful.display")
local geometry = require("wonderful.geometry")
local signal = require("wonderful.signal")
local tableUtil = require("wonderful.util.table")
local Wonderful = class(nil, {name = "wonderful.Wonderful"})
function Wonderful:__new__()
self.displayManager = display.DisplayManager()
self.documents = {}
self.signals = {}
self.running = false
self:updateKeyboards()
self:addSignal("touch", signal.Touch)
self:addSignal("drag", signal.Drag)
self:addSignal("drop", signal.Drop)
self:addSignal("scroll", signal.Scroll)
self:addSignal("key_down", signal.KeyDown)
self:addSignal("key_up", signal.KeyUp)
self:addSignal("clipboard", signal.Clipboard)
end
function Wonderful:updateKeyboards()
self.keyboards = {}
for screen in component.list("screen", true) do
for _, keyboard in ipairs(component.invoke(screen, "getKeyboards")) do
self.keyboards[keyboard] = screen
end
end
end
function Wonderful:addDocument(args)
local args = args or {}
if args.x and args.y and args.w and args.h then
args.box = geometry.Box(args.x, args.y, args.w, args.h)
end
local display = self.displayManager:newDisplay {
box = args.box,
screen = args.screen
}
local document = document.Document {
style = args.style,
display = display
}
table.insert(self.documents, document)
return document
end
do
local function rStackingContext(root)
local buf = root.display.fb
for _, el in root.stackingContext.iter do
if el.isLeaf or el.stackingContext == root.stackingContext then
if el.calculatedBox then
local coordBox = el.calculatedBox
local viewport = el.viewport
local view = buf:view(coordBox.x,
coordBox.y,
coordBox.w,
coordBox.h,
viewport.x,
viewport.y,
viewport.w,
viewport.h)
if view then
el:render(view)
end
end
else
rStackingContext(el)
end
end
end
function Wonderful:render()
for _, document in ipairs(self.documents) do
rStackingContext(document)
end
for _, display in ipairs(self.displayManager.displays) do
display:flush()
end
end
end
do
local function hStackingContext(root)
for _, el in root.stackingContext.iterRev do
if el.isLeaf or el.stackingContext == root.stackingContext then
if el.calculatedBox:has(x, y) then
return el
end
else
local hit = hStackingContext(el)
if hit then
return hit
end
end
end
end
function Wonderful:hit(screen, x, y)
for _, document in ipairs(self.documents) do
if document.display.screen == screen and
document.display.box:has(x, y) then
local hit = hStackingContext(document, x, y)
if hit then
return hit
end
end
end
end
end
function Wonderful:addSignal(name, cls)
self.signals[name] = cls
end
function Wonderful:run()
self.running = true
while self.running do
local pulled = {event.pull()}
local name = table.remove(pulled, 1)
if name and self.signals[name] then
local inst = self.signals[name](table.unpack(pulled))
if signal.SCREEN_SIGNALS[name] then
local hit = self:hit(inst.screen, inst.x, inst.y)
if hit then
hit:dispatchEvent(inst)
end
elseif signal.KEYBOARD_SIGNALS[name] then
local screen = self.keyboards[screen]
if screen then
for _, document in ipairs(self.documents) do
if document.display.screen == screen then
document:dispatchEvent(inst)
end
end
end
else
for _, document in ipairs(self.documents) do
document:dispatchEvent(inst)
end
end
self:render()
end
end
end
function Wonderful:stop()
self.running = false
end
function Wonderful:__destroy__()
self.running = false
self.displayManager:restore()
self.displayManager.displays = {}
self.documents = {}
end
return tableUtil.autoimport({
Wonderful = Wonderful,
Document = document.Document,
DisplayManager = display.DisplayManager,
Display = display.Display,
}, "wonderful")
|
-- Make such a thing
minetest.register_tool("durapick:steel_pick", {
description = "Durable Steel Pickaxe",
inventory_image = "durapick_steel.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=1,
groupcaps={
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=(durapick_durability_steel * durapick_durability_factor), maxlevel=2},
},
damage_groups = {fleshy=4},
},
sound = {breaks = "default_tool_breaks"},
groups = {pickaxe = 1}
})
if durapick_previous_pick then
minetest.register_craft({
type = "shaped",
output = "durapick:steel_pick 1",
recipe = { -- Use globals to allow customized recipes
{durapick_resource_steel, "durapick:bronze_pick", durapick_resource_steel},
{"", durapick_stick, ""},
{"", durapick_stick, ""}
},
})
else
minetest.register_craft({
type = "shaped",
output = "durapick:steel_pick 1",
recipe = { -- Use globals to allow customized recipes
{durapick_resource_steel, durapick_resource_steel, durapick_resource_steel},
{"", durapick_stick, ""},
{"", durapick_stick, ""}
},
})
end |
BaseVerletModel = class("BaseVerletModel")
BaseVerletModel.ctor = function (slot0)
slot0.m_fXPosVerlet = 0
slot0.m_fYPosVerlet = 0
slot0.m_fTempXVerlet = 0
slot0.m_fTempYVerlet = 0
slot0.m_fPreXVerlet = 0
slot0.m_fPreYVerlet = 0
end
BaseVerletModel.updateVerlet = function (slot0)
slot0.m_fTempXVerlet = slot0.m_fXPosVerlet
slot0.m_fTempYVerlet = slot0.m_fYPosVerlet
slot0.m_fXPosVerlet = slot0.m_fXPosVerlet + slot0:getVx()
slot0.m_fYPosVerlet = slot0.m_fYPosVerlet + slot0:getVy()
slot0.m_fPreXVerlet = slot0.m_fTempXVerlet
slot0.m_fPreYVerlet = slot0.m_fTempYVerlet
end
BaseVerletModel.setX = function (slot0, slot1)
slot0.m_fPreXVerlet = slot1
slot0.m_fXPosVerlet = slot1
end
BaseVerletModel.setY = function (slot0, slot1)
slot0.m_fPreYVerlet = slot1
slot0.m_fYPosVerlet = slot1
end
BaseVerletModel.setVx = function (slot0, slot1)
slot0.m_fPreXVerlet = slot0.m_fXPosVerlet - slot1
end
BaseVerletModel.setVy = function (slot0, slot1)
slot0.m_fPreYVerlet = slot0.m_fYPosVerlet - slot1
end
BaseVerletModel.getVx = function (slot0)
return slot0.m_fXPosVerlet - slot0.m_fPreXVerlet
end
BaseVerletModel.getVy = function (slot0)
return slot0.m_fYPosVerlet - slot0.m_fPreYVerlet
end
BaseVerletModel.getX = function (slot0)
return slot0.m_fXPosVerlet
end
BaseVerletModel.getY = function (slot0)
return slot0.m_fYPosVerlet
end
BaseVerletModel.setXY = function (slot0, slot1, slot2)
slot0:setX(slot1)
slot0:setY(slot2)
end
BaseVerletModel.getXY = function (slot0)
return slot0:getX(), slot0:getY()
end
BaseVerletModel.setPosition = function (slot0, slot1)
slot0:setXY(slot1.x, slot1.y)
end
BaseVerletModel.getPosition = function (slot0)
return cc.p(slot0:getX(), slot0:getY())
end
BaseVerletModel.getPositionXY = function (slot0)
return slot0:getX(), slot0:getY()
end
BaseVerletModel.isStill = function (slot0)
return slot0:getVx() == 0 and slot0:getVy() == 0
end
BaseVerletModel.makeStill = function (slot0)
slot0:setVx(0)
slot0:setVy(0)
end
BaseVerletModel.destroy = function (slot0)
slot0.m_fXPosVerlet = nil
slot0.m_fYPosVerlet = nil
slot0.m_fTempXVerlet = nil
slot0.m_fTempYVerlet = nil
slot0.m_fPreXVerlet = nil
slot0.m_fPreYVerlet = nil
end
return BaseVerletModel
|
local System = require('eccles.System')
local band = (require('bit')).band
local pluralize
pluralize = function(word)
local _exp_0 = string.sub(word, -1, -1)
if 'y' == _exp_0 then
return string.sub(word, 1, -2) .. 'ies'
elseif 's' == _exp_0 or 'c' == _exp_0 or 'ch' == _exp_0 or 'sh' == _exp_0 then
return word .. 'es'
else
return word .. 's'
end
end
local remove_value
remove_value = function(array, value)
for i, v in ipairs(array) do
if v == value then
table.remove(array, i)
return v
end
end
return nil
end
local EntitySystem
do
local _class_0
local _parent_0 = System
local _base_0 = {
initialize = function(self)
_class_0.__parent.__base.initialize(self)
self:import_names(self.aspect._all)
return self:import_names(self.aspect._one)
end,
import_names = function(self, set)
local plural, v
local components = self.world.components
for n, id in pairs(self.world.component_ids) do
if (band(set, n)) == set then
plural = pluralize(n)
if components[n] == nil then
components[n] = { }
end
self[plural] = components[v]
end
end
end,
matches = function(self, id)
return self.aspect:matches(id)
end,
entity_added = function(self, id)
if self:matches(id) then
return table.insert(self.cache, id)
end
end,
entity_removed = function(self, id)
return remove_value(self.cache, id)
end,
update_entity = function(self, dt, id)
return error("Entity updater not implemented for " .. tostring(self.__class.__name))
end,
update = function(self, dt)
local cache = self.cache
for i = 1, #cache do
self:update_entity(dt, cache[i])
end
end
}
_base_0.__index = _base_0
setmetatable(_base_0, _parent_0.__base)
_class_0 = setmetatable({
__init = function(self, world, aspect, passive, depends)
_class_0.__parent.__init(self, world, passive, depends)
if aspect == nil or aspect.__class.__name ~= 'Aspect' then
error("An aspect is required to construct " .. tostring(self.__class.__name))
end
self.aspect = aspect
self.cache = { }
end,
__base = _base_0,
__name = "EntitySystem",
__parent = _parent_0
}, {
__index = function(cls, name)
local val = rawget(_base_0, name)
if val == nil then
local parent = rawget(cls, "__parent")
if parent then
return parent[name]
end
else
return val
end
end,
__call = function(cls, ...)
local _self_0 = setmetatable({}, _base_0)
cls.__init(_self_0, ...)
return _self_0
end
})
_base_0.__class = _class_0
if _parent_0.__inherited then
_parent_0.__inherited(_parent_0, _class_0)
end
EntitySystem = _class_0
return _class_0
end
|
local API_NPC = require(script:GetCustomProperty("API_NPC"))
local API_DS = require(script:GetCustomProperty("APIDifficultySystem"))
local API_P = require(script:GetCustomProperty("APIProjectile"))
local API_D = require(script:GetCustomProperty("APIDamage"))
local API_RE = require(script:GetCustomProperty("APIReliableEvents"))
local RANGE = 1000.0
local COOLDOWN = 22.0
local MAX_OFFSET_RADIUS = 1100.0
local VOLCANO_RADIUS = 150.0
local FIREBALL_RADIUS = 150.0
local FIREBALL_RANGE = 900.0
local FIREBALL_DAMAGE = 55.0
local FIREBALL_SPEED = 400.0
local VOLCANO_DAMAGE_RATE = 50.0
local DURATION = 6.0
local INITIAL_FIREBALL_DELAY = 1.0
local N_FIREBALLS = 25
function GetPriority(npc, taskHistory)
if API_DS.GetDifficultyLevel() > 3 then
return 1.0
else
return 0.0
end
end
function OnTaskStart(npc, threatTable)
return 1.5
end
function OnTaskEnd(npc, interrupted)
if not interrupted then
local stream = RandomStream.New()
local targetPosition = API_NPC.GetTarget(npc):GetWorldPosition()
API_RE.BroadcastToAllPlayers("GV", targetPosition, stream:GetInitialSeed())
function GetRandomPointInCircle(center, radius)
local t = 2 * math.pi * stream:GetNumber()
local u = stream:GetNumber() + stream:GetNumber()
local r = radius * (1.0 - math.abs(u - 1.0))
return center + r * Vector3.New(math.cos(t), math.sin(t), 0.0)
end
local rayStart = GetRandomPointInCircle(targetPosition, MAX_OFFSET_RADIUS)
local rayEnd = rayStart - Vector3.UP * 300.0
local hitResult = World.Raycast(rayStart, rayEnd, {ignorePlayers = true})
local volcanoPosition = rayEnd
if hitResult then
volcanoPosition = hitResult:GetImpactPosition()
end
Task.Spawn(function()
for i = 1, DURATION do
Task.Wait(1.0)
for _, player in pairs(Game.FindPlayersInSphere(volcanoPosition, VOLCANO_RADIUS, {ignoreDead = true})) do
API_D.ApplyDamage(npc, player, VOLCANO_DAMAGE_RATE, API_D.TAG_PERIODIC | API_D.TAG_AOE)
end
for _, otherNpc in pairs(API_NPC.GetAwakeNPCsInSphere(volcanoPosition, VOLCANO_RADIUS)) do
API_D.ApplyDamage(npc, otherNpc, VOLCANO_DAMAGE_RATE, API_D.TAG_PERIODIC | API_D.TAG_AOE)
end
end
end)
for i = 1, N_FIREBALLS do
local fireballTarget = GetRandomPointInCircle(volcanoPosition, FIREBALL_RANGE)
hitResult = World.Raycast(fireballTarget + Vector3.UP * 300.0, volcanoPosition - Vector3.UP * 300.0, {ignorePlayers = true})
if hitResult then
fireballTarget = hitResult:GetImpactPosition()
end
local travelTime = API_P.GetTravelTime(volcanoPosition, fireballTarget, FIREBALL_SPEED)
local incrementalDelay = (DURATION - INITIAL_FIREBALL_DELAY) / N_FIREBALLS
Task.Spawn(function()
Task.Wait(INITIAL_FIREBALL_DELAY + travelTime + (i - 1) * incrementalDelay)
for _, player in pairs(Game.FindPlayersInSphere(fireballTarget, FIREBALL_RADIUS, {ignoreDead = true})) do
API_D.ApplyDamage(npc, player, FIREBALL_DAMAGE, API_D.TAG_AOE)
end
for _, otherNpc in pairs(API_NPC.GetAwakeNPCsInSphere(fireballTarget, FIREBALL_RADIUS)) do
API_D.ApplyDamage(npc, otherNpc, FIREBALL_DAMAGE, API_D.TAG_AOE)
end
end)
end
end
end
API_NPC.RegisterTaskServer("goblin_wizard_volcano", RANGE, COOLDOWN, GetPriority, OnTaskStart, OnTaskEnd)
|
---
-- SpecialDialogues.lua - Chat sound handler
--
local module = {}
local DEBRIS = game:GetService("Debris")
local PhysicsService = game:GetService("PhysicsService")
local alphabet = {
a = "rbxassetid://6467913316",
b = "rbxassetid://6467913731",
c = "rbxassetid://6467913902",
d = "rbxassetid://6467914139",
e = "rbxassetid://6467914458",
v = "rbxassetid://6467914458",
g = "rbxassetid://6467914139",
z = "rbxassetid://6467913902",
f = "rbxassetid://6467914636",
h = "rbxassetid://6467914848",
i = "rbxassetid://6467915181",
j = "rbxassetid://6467915383",
k = "rbxassetid://6467915567",
l = "rbxassetid://6467916088",
m = "rbxassetid://6467916506",
n = "rbxassetid://6467916506",
o = "rbxassetid://6467916807",
p = "rbxassetid://6467916994",
q = "rbxassetid://6467917172",
r = "rbxassetid://6467917432",
s = "rbxassetid://6467920697",
x = "rbxassetid://6467920697",
t = "rbxassetid://6467920914",
u = "rbxassetid://6467921079",
w = "rbxassetid://6467921260",
y = "rbxassetid://6467921438",
}
local symbols = {
alphabet.m,
alphabet.n,
alphabet.o,
alphabet.p,
alphabet.q,
alphabet.r,
alphabet.s,
alphabet.x,
alphabet.t,
alphabet.u,
alphabet.w,
alphabet.y,
}
local pitches = {
Low = 1.1,
Base = 1.25,
High = 1.4,
Amogus = 0.55,
Serball = 1.9,
}
local nipah = {
"rbxassetid://6597172405",
"rbxassetid://6597095839",
"rbxassetid://6597095898",
}
local spoonful = {
"rbxassetid://7829037435",
"rbxassetid://7829037326",
"rbxassetid://7829037178",
}
local function playSound(character, id, vol, speed, min, max)
speed = speed or (1 + Random.new():NextNumber(-0.05, 0.05))
min = min or 10
max = max or 300
local sfx = Instance.new("Sound")
sfx.SoundId = id
sfx.Volume = vol
sfx.RollOffMinDistance = min
sfx.RollOffMaxDistance = max
sfx.PlaybackSpeed = speed
sfx.Parent = character.Head.Head
sfx:Play()
DEBRIS:AddItem(sfx, 2)
end
local dialogues = {}
local function setDecalsTransparency(inst, transparency)
for _, desc in pairs(inst:GetDescendants()) do
if desc:IsA("Decal") then
desc.Transparency = transparency
end
end
end
function dialogues.Rika(character, chatText, exclaim)
if chatText:lower():match("nipah") or chatText:match("\227\129\171\227\129\177") then
coroutine.wrap(function()
local headNipah = character.CreateFolder:FindFirstChild("HeadNipah")
if not headNipah then
return
end
headNipah = headNipah.HeadNipah
local headHead = character.Head.Head
headHead.Transparency = 1
setDecalsTransparency(headHead, 1)
headNipah.Transparency = 0
setDecalsTransparency(headNipah, 0)
wait(3)
headHead.Transparency = 0
setDecalsTransparency(headHead, 0)
headNipah.Transparency = 1
setDecalsTransparency(headNipah, 1)
end)()
playSound(character, nipah[math.random(1, #nipah)], 0.7, 1, 10, 550)
return true
end
return false
end
function dialogues.Dog(character, chatText, exclaim)
local result = false
if chatText:lower():match("awoo") or chatText:match("\227\130\162\227\130\166") then
local speed = pitches[character.VoicePitch.Value] - 0.25 + Random.new():NextNumber(-0.05, 0.05)
playSound(character, "rbxassetid://6659426377", 0.2, speed)
result = true
end
if chatText:lower():match("wan") or chatText:match("\227\131\175\227\131\179") then
local speed = pitches[character.VoicePitch.Value] - 0.3 + Random.new():NextNumber(-0.05, 0.05)
playSound(character, "rbxassetid://6659426307", 0.4, speed, 10, 550)
result = true
end
return result
end
function dialogues.Mukyu(character, chatText, exclaim)
if chatText:lower():match("mukyu") or chatText:match("\227\131\160\227\130\175\227\131\165") then
playSound(character, "rbxassetid://6689920558", 0.2)
return true
end
return false
end
function dialogues.Serval(character, chatText, exclaim)
if chatText:lower():match("sugoi") or chatText:match("\227\129\153\227\129\148\227\129\132") then
playSound(character, "rbxassetid://7118237673", 0.13)
return true
end
return false
end
function dialogues.MAGES(character, chatText, exclaim)
if
chatText:lower():match("wake up")
or chatText:match("\231\155\174\227\130\146\232\166\154\227\129\190\227\129\153")
then
playSound(character, "rbxassetid://7118257163", 0.5)
return true
end
return false
end
function dialogues.Tanya(character, chatText, exclaim)
if chatText:lower():match("kami") or chatText:match("\231\165\158") then
playSound(character, "rbxassetid://7119290973", 0.15)
return true
end
return false
end
function dialogues.Rat(character, chatText, exclaim)
if
chatText:lower():match("naides")
or chatText:match("\227\129\170\227\129\132\227\129\167\227\129\153")
or chatText:lower():match("naidesu")
then
playSound(character, "rbxassetid://7122812805", 0.25)
return true
end
return false
end
local bankiHead = {}
local function createEffectHead(character)
local head = character.Head.Head:Clone()
local createFolder = character.CreateFolder
local models = { character.Head }
for _, v in pairs(createFolder:GetDescendants()) do
if v:GetAttribute("WeldTarget") == "Head" then
local model = v:Clone()
model.RootWeld.Part0 = head
model.RootWeld.Part1 = model.PrimaryPart
model.Parent = head
models[#models + 1] = v
end
end
local tag = head:FindFirstChild("NameTag")
if tag then
tag:Destroy()
end
local bubble = head:FindFirstChild("ChatBubble")
if bubble then
bubble:Destroy()
end
PhysicsService:SetPartCollisionGroup(head, "CollDisabled")
head.CanCollide = true
return head, models
end
function dialogues.Sekibanki(character, chatText, exclaim)
if bankiHead[character] then
return false
end
if chatText:lower():match("head") or chatText:match("\233\160\173") then
coroutine.wrap(function()
bankiHead[character] = true
local effectHead, models = createEffectHead(character)
local touchedParts = {}
for _, model in pairs(models) do
for _, descendant in pairs(model:GetDescendants()) do
if descendant:IsA("BasePart") then
descendant:SetAttribute("lastSize", descendant.Size)
descendant:SetAttribute("lastTransparency", descendant.Transparency)
descendant.Size = Vector3.new(0, 0, 0)
descendant.Transparency = 1
touchedParts[#touchedParts + 1] = descendant
end
end
end
effectHead.CFrame = character.Head.Head.CFrame
effectHead.Parent = game.Workspace
DEBRIS:AddItem(effectHead, 5)
wait(5)
if not character then
bankiHead[character] = nil
return
end
for k, descendant in pairs(touchedParts) do
descendant.Size = descendant:GetAttribute("lastSize")
descendant.Transparency = descendant:GetAttribute("lastTransparency")
end
local headFX = character.CreateFolder:FindFirstChild("headFX")
if headFX then
headFX = headFX.headFX
headFX.s1:Play()
headFX.p1:Emit(10)
end
wait(0.5)
bankiHead[character] = nil
end)()
end
return false
end
function dialogues.Cirno(character, chatText, exclaim)
if chatText:lower():match("baka") or chatText:match("\233\166\172\233\185\191") then
playSound(character, "rbxassetid://7133976089", 0.3)
return true
end
return false
end
function dialogues.Rumia(character, chatText, exclaim)
if
chatText:lower():match("so nanoka")
or chatText:match("\227\129\157\227\131\188\227\129\170\227\129\174\227\129\139\227\131\188")
then
playSound(character, "rbxassetid://7133986095", 0.2)
return true
end
return false
end
function dialogues.Cat(character, chatText, exclaim)
if
chatText:lower():match("nya")
or chatText:lower():match("meow")
or chatText:match("\227\131\139\227\131\163")
then
playSound(character, "rbxassetid://7133989059", 0.12)
return true
end
return false
end
function dialogues.Madotsuki(character, chatText, exclaim)
if
chatText:lower():match("no good")
or chatText:match("\227\129\160\227\130\129")
or chatText:match("\227\131\128\227\131\161")
then
playSound(character, "rbxassetid://7139231500", 0.12)
return true
elseif chatText:lower():match("impossible") or chatText:match("\231\132\161\231\144\134") then
playSound(character, "rbxassetid://7139231572", 0.12)
return true
end
return false
end
function dialogues.Ari(character, chatText, exclaim)
if chatText:lower():match("burger") then
playSound(character, "rbxassetid://7142972264", 0.4)
return true
elseif chatText:lower():match("buh") then
playSound(character, "rbxassetid://7142972323", 1.6)
return true
end
return false
end
function dialogues.Doremy(character, chatText, exclaim)
if chatText:lower():match("buh") then
playSound(character, "rbxassetid://7142972323", 1.6)
return true
end
return false
end
function dialogues.LittleNazrin(character, chatText, exclaim)
if
chatText:lower():match("naides")
or chatText:match("\227\129\170\227\129\132\227\129\167\227\129\153")
or chatText:lower():match("naidesu")
then
playSound(character, "rbxassetid://7122812805", 0.25)
return true
elseif
chatText:lower():match("welcome home") or chatText:match("\227\129\138\227\129\139\227\129\136\227\130\138")
then
playSound(character, "rbxassetid://7162911891", 0.2)
return true
end
return false
end
function dialogues.Sachiko(character, chatText, exclaim)
if chatText:lower():match("okay") then
playSound(character, "rbxassetid://7162928158", 0.3)
return true
end
return false
end
function dialogues.Amogus(character, chatText, exclaim)
if chatText:lower():match("amogus") or chatText:lower():match("among us") then
playSound(character, "rbxassetid://7163204696", 0.15)
return true
end
return false
end
function dialogues.Serball(character, chatText, exclaim)
if chatText:lower():match("sugoi") or chatText:match("\227\129\153\227\129\148\227\129\132") then
local speed = 1.9 + Random.new():NextNumber(-0.05, 0.05)
playSound(character, "rbxassetid://7118237673", 0.13, speed)
return true
end
return false
end
function dialogues.Yoshika(character, chatText, exclaim)
if
chatText:lower():match("gwa gwa")
or chatText:lower():match("\227\130\176\227\130\161 \227\130\176\227\130\161")
then
playSound(character, "rbxassetid://7179802622", 0.12)
return true
end
return false
end
function dialogues.Yacchie(character, chatText, exclaim)
if
chatText:lower():match("gao gao")
or chatText:match("\227\130\172\227\130\170 \227\130\172\227\130\170\227\131\188")
then
playSound(character, "rbxassetid://7183016670", 0.12)
return true
end
return false
end
function dialogues.Rei(character, chatText, exclaim)
if chatText:lower():match("rei chiquita") then
playSound(character, "rbxassetid://7519954053", 0.3)
return true
end
return false
end
function dialogues.Soku(character, chatText, exclaim)
local volume = 0.3
if exclaim then
volume = 1
end
if chatText:lower():match("soku") then
playSound(character, "rbxassetid://7791781630", volume)
return true
elseif chatText:lower():match("ay yo catgirl") then
playSound(character, "rbxassetid://7791939510", volume)
return true
end
return false
end
function dialogues.Yuuma(character, chatText, exclaim)
if chatText:lower():match("only a spoonful") then
playSound(character, spoonful[math.random(1, #spoonful)], 0.5, nil, 10, 230)
return true
elseif chatText:lower():match("*scream*") then
playSound(character, "rbxassetid://7829191336", 0.3, nil, 10, 170)
return true
end
return false
end
function module:doSound(character, letter, exclaim)
if not character then
return
end
local addPitch = 0
if exclaim then
addPitch = 0.04
end
local soundId = alphabet[letter:lower()]
local sfx = Instance.new("Sound")
if soundId then
sfx.SoundId = soundId
else
sfx.SoundId = symbols[math.random(1, #symbols)]
end
sfx.Volume = 1.8
sfx.RollOffMinDistance = 1
sfx.Parent = character.Head.Head
local pitchValue = character:FindFirstChild("VoicePitch")
if pitchValue and pitches[pitchValue.Value] then
sfx.PlaybackSpeed = pitches[pitchValue.Value] + Random.new():NextNumber(-0.05, 0.05) + addPitch
else
sfx.PlaybackSpeed = Random.new():NextNumber(0.97, 1.07) + addPitch
end
sfx:Play()
DEBRIS:AddItem(sfx, 0.5)
end
function module:CheckDialogue(dialogueName)
return dialogues[dialogueName] ~= nil
end
function module:SpecialDialogue(character, chatText, exclaim, dialogueName)
if not character then
return false
end
return dialogues[dialogueName](character, chatText, exclaim)
end
return module
|
local skynet = require "skynet"
local mysql = require "mysql"
local socket = require "skynet.socket"
Fight = {}
function Fight.start(cID, account, name, job)
socket.write(cID, "ok")
math.randomseed(os.time())
local o_cID, o_name, o_job
local str
local db = mysql.connect()
local res = db:query("select cID from account where team = 1 and teamer is NULL")
if res[1] == nil then
res = db:query(string.format("update account set team = 1 where id = %d", account))
mysql.dump(res)
local simble = 0
while true do
res = db:query(string.format("select teamer from account where id = %d", account))
mysql.dump(res)
if res[1]["teamer"] == nil then
simble = simble + 1
skynet.sleep(100);
else
local temp = math.random(1, 2)
_, _, o_name, o_job = string.find(res[1]["teamer"], "(%a+)%((%a+)%)")
socket.write(cID, o_name)
str = socket.read(cID)
while str ~= "ok" do
end
socket.write(cID, o_job)
str = socket.read(cID)
while str ~= "ok" do
end
res = db:query(string.format("select * from %s where name = \'%s\'", o_job, o_name))
mysql.dump(res)
if res[1]["arm"] == nil then
socket.write(cID, "NULL")
else
socket.write(cID, res[1]["arm"])
end
str = socket.read(cID)
while str ~= "ok" do
end
if res[1]["armor"] == nil then
socket.write(cID, "NULL")
else
socket.write(cID, res[1]["armor"])
end
o_cID = res[1]["cID"]
str = socket.read(cID)
while str ~= "start" do
end
if temp == 1 then
res = db:query(string.format("update account set offensive = \'first\' where id = %d", account))
mysql.dump(res)
res = db:query(string.format("update account set offensive = \'second\' where cID = %d", o_cID))
mysql.dump(res)
else
res = db:query(string.format("update account set offensive = \'second\' where id = %d", account))
mysql.dump(res)
res = db:query(string.format("update account set offensive = \'first\' where cID = %d", o_cID))
mysql.dump(res)
end
if temp == 1 then
socket.write(cID, "first")
else
socket.write(cID, "second")
end
break
end
if simble == 10 then
socket.write(cID, "default")
res = db:query(string.format("update account set team = 0 where id = %d", tonumber(account)))
mysql.dump(res)
db:disconnect()
return
end
end
else
o_cID = res[1]["cID"]
res = db:query(string.format("update account set teamer = \'%s(%s)\' where cID = %d", name, job, o_cID))
mysql.dump(res)
res = db:query(string.format("select login_cha from account where cID = %d", o_cID))
mysql.dump(res)
_, _, o_name, o_job = string.find(res[1]["login_cha"], "(%a+)%((%a+)%)")
socket.write(cID, o_name)
str = socket.read(cID)
while str ~= "ok" do
end
socket.write(cID, o_job)
str = socket.read(cID)
while str ~= "ok" do
end
res = db:query(string.format("select * from %s where name = \'%s\'", o_job, o_name))
mysql.dump(res)
if res[1]["arm"] == nil then
socket.write(cID, "NULL")
else
socket.write(cID, res[1]["arm"])
end
str = socket.read(cID)
while str ~= "ok" do
end
if res[1]["armor"] == nil then
socket.write(cID, "NULL")
else
socket.write(cID, res[1]["armor"])
end
str = socket.read(cID)
while str ~= "start" do
end
while res[1]["offensive"] == nil do
res = db:query(string.format("select offensive from account where cID = %d", cID))
mysql.dump(res)
skynet.sleep(10)
end
socket.write(cID, res[1]["offensive"])
end
while true do
skynet.error("reading...")
str = socket.read(cID)
if str == false then
res = db:query(string.format("update account set team = 0, teamer = NULL, offensive = NULL where id = %d", account))
mysql.dump(res)
db:disconnect()
return
end
skynet.error(str)
if str == "surrender" then
socket.write(o_cID, "surrender")
res = db:query(string.format("update account set team = 0, teamer = NULL, offensive = NULL where id = %d", account))
mysql.dump(res)
db:disconnect()
return
elseif str == "o_surrender" then
res = db:query(string.format("update account set team = 0, teamer = NULL, offensive = NULL where id = %d", account))
mysql.dump(res)
db:disconnect()
return
elseif str == "over" then
socket.write(o_cID, "over")
res = db:query(string.format("update account set team = 0, teamer = NULL, offensive = NULL where id = %d", account))
mysql.dump(res)
db:disconnect()
return
elseif str == "ace" then
socket.write(o_cID, "ace")
socket.write(cID, "ok")
str = socket.read(cID)
if str == "bleed" then
socket.write(o_cID, "bleed")
else
socket.write(o_cID, "unbleed")
end
end
end
end
return Fight
|
local EasyDelete = WUI:NewModule("EasyDelete")
function EasyDelete:OnInitialize()
end
function EasyDelete:OnEnable()
if WUI.db.profile.easydelete then
StaticPopupDialogs.DELETE_GOOD_ITEM=StaticPopupDialogs.DELETE_ITEM
end
end
function EasyDelete:OnDisable()
end |
-- MV extractor
local S = technic.getter
minetest.register_craft({
output = 'technic:mv_extractor',
recipe = {
{'technic:stainless_steel_ingot', 'technic:lv_extractor', 'technic:stainless_steel_ingot'},
{'pipeworks:tube_1', 'technic:mv_transformer', 'pipeworks:tube_1'},
{'technic:stainless_steel_ingot', 'technic:mv_cable', 'technic:stainless_steel_ingot'},
}
})
technic.register_base_machine("technic:mv_extractor", {
typename = "extracting",
description = S("%s Extractor"),
tier = "MV",
demand = {800, 600, 400},
speed = 2,
upgrade = 1,
tube = 1
})
|
local function setRoomStartTime(roomId, startTime, playersStarting)
return {
type = script.Name,
roomId = roomId,
startTime = startTime,
playersStarting = playersStarting
}
end
return setRoomStartTime
|
local log = require 'log'
local utils = require 'st.utils'
local capabilities = require 'st.capabilities'
local HEATING = capabilities.thermostatOperatingState.thermostatOperatingState.heating()
---@class SwitchState
---@field public is_on boolean?
local SwitchState = {}
function SwitchState.all()
return {
is_on = false,
}
end
---@class TempState
---@field public target number?
---@field public actual number?
---@field public is_heating boolean?
local TempState = {}
function TempState.all()
return {
actual = 0,
target = 0,
is_heating = false
}
end
---@class DeviceState
---@field public switch SwitchState?
---@field public bed TempState?
---@field public tool TempState?
local DeviceState = {}
DeviceState.__index = DeviceState
---Helper for probing a deeply nested object that might be null at any point
--- ```lua
--- assert(get_with_early_return({a = { b = { c = { d = 1}}}}, 'a', 'b', 'c', 'd') == 1)
--- assert(get_with_early_return({a = { b = { }}}}, 'a', 'b', 'c', 'd') == nil)
--- ```
---@param t table The table to probe
---@vararg string The list of keys as strings
---@return any|nil
local function get_with_early_return(t, ...)
if type(t) ~= 'table' then
return nil
end
local v = t
for _, key in ipairs({...}) do
local v2 = v[key]
if v2 == nil then
return nil
end
v = v2
end
return v
end
--- Check if the printer is actively working on a job
--- which drives the switch state for this device
---@param octopi Octopi The octopi instance for this device
---@param device Device the Device model for this device
local function check_switch_state(octopi, device)
log.trace('check_switch_state', octopi.id)
local ret = {}
local remote_state_str, err = octopi:check_state()
if not remote_state_str then
log.error('Failed to check switch state', err)
return SwitchState.all()
end
local current_state = get_with_early_return(
device,
'state_cache',
'main',
'switch',
'switch',
'value'
)
if current_state == nil then
ret.is_on = remote_state_str == 'Printing'
end
if remote_state_str ~= 'Printing' and current_state == 'on' then
ret.is_on = false
end
if remote_state_str == 'Printing' and current_state == 'off' then
ret.is_on = true
end
return ret
end
---Compare the provided temperature `info` to the state_cache, returning
---the elements that have changed
---@param device Device The device to check against
---@param component string The string name of the component (bed or main)
---@param info TemperatureInfo The info to check against
---@return TempState
local function compare_temp_states(device, component, info)
local ret = {}
log.debug(utils.stringify_table((((device or {}).state_cache or {}))[component] or {}), component, true)
local actual = get_with_early_return(
device,
'state_cache',
component,
'temperatureMeasurement',
'temperature',
'value'
)
local target = get_with_early_return(
device,
'state_cache',
component,
'thermostatHeatingSetpoint',
'heatingSetpoint',
'value'
)
local op_state = get_with_early_return(
device,
'state_cache',
component,
'thermostatOperatingState',
'thermostatOperatingState',
'value'
)
log.debug(string.format(
'actual: %s, target: %s, op_state: %s',
actual,
target,
op_state
))
if actual ~= info.actual then
log.debug(string.format('%s actual: %s ~= %s', component, actual, info.actual))
ret.actual = info.actual
end
if target ~= info.target then
log.debug(string.format('%s target: %s ~= %s', component, target, info.target))
ret.target = info.target
end
local is_heating = op_state == HEATING
if is_heating and info.target <= 0 then
ret.is_heating = false
elseif (not is_heating) and info.target > 0 then
ret.is_heating = true
elseif op_state == nil then
ret.is_heating = info.target > 0
end
return ret
end
---Check the temperature of the bed and adjusts the state of the `bed` component
---@param device Device
---@param octopi Octopi
local function check_bed_state(octopi, device)
log.trace('check_bed_state')
local info, err = octopi:get_current_bed_temp()
if not info then
log.error('Failed to get bed temp', err)
return TempState.all()
end
return compare_temp_states(device, 'bed', info)
end
---Check the state of the extruder temperature and adjust the main component state
--- * If the target temperature is > 0 this will emit a `heating` mode event
--- * If the target temperature is 0 this will emit an `idle` mode event
--- * If the target temp has changed it will emit a `heatingSetpoint` event
--- * If the actual temp has changed it will emit a `temperatureMeasurement` event
---@param device Device
---@param octopi Octopi
local function check_tool_state(octopi, device)
log.trace('check_tool_state')
local info, err = octopi:get_current_tool_temp()
if not info then
log.error('Faild to get tool temp', err)
return TempState.all()
end
return compare_temp_states(device, 'tool', info)
end
--- Fetch the remote state from the octopi server and compare them to the
--- state_cache, populating any values that need to be updated
---@param octopi Octopi
---@param device Device
---@return DeviceState
function DeviceState.fetch(octopi, device)
local switch_state, switch_err = check_switch_state(octopi, device)
local bed_state, bed_err = check_bed_state(octopi, device)
local tool_state, tool_err = check_tool_state(octopi, device)
if not switch_state then
log.error('Failed to fetch switch state', switch_err)
end
if not bed_state then
log.error('Failed to fetch bed state', bed_err)
end
if not tool_state then
log.error('Failed to fetch tool state', tool_err)
end
return setmetatable({
switch = switch_state or {},
bed = bed_state or {},
tool = tool_state or {},
}, DeviceState)
end
return DeviceState
|
local M = {}
function __TRACEBACK__(message)
print(debug.traceback(message))
end
M.DUMMY_STR = '<dummy str>'
M.FUNC = function () return M.PROXY end
M.FUNC_STR = function () return "<proxy table>" end
M.FUNC_NUM = function () return 1, 1, 1, 1 end
M.PROXY = setmetatable({}, {
__index = M.FUNC,
__tostring = M.FUNC_STR,
__call = M.FUNC,
})
local function REG(classname, impl)
package.preload[classname] = impl or M.FUNC
end
REG 'base64'
REG 'openssl'
REG('cclua.runtime', function ()
return setmetatable({
on = false,
off = false,
}, {__index = M.FUNC})
end)
REG('cclua.timer', function ()
return setmetatable({
new = false,
}, {__index = M.FUNC})
end)
REG('cclua.filesystem', function ()
return setmetatable({
dir = false,
localPath = false,
exist = function () end,
sdCardDirectory = M.DUMMY_STR,
documentDirectory = M.DUMMY_STR,
cacheDirectory = M.DUMMY_STR,
tmpDirectory = M.DUMMY_STR,
writablePath = M.DUMMY_STR,
}, {__index = M.FUNC})
end)
local _require = require
function require(path)
if not package.preload[path] and (
string.find(path, 'cc.', 1, true) == 1 or
string.find(path, 'ccb.', 1, true) == 1 or
string.find(path, 'ccui.', 1, true) == 1 or
string.find(path, 'fgui.', 1, true) == 1 or
string.find(path, 'swf.', 1, true) == 1 or
string.find(path, 'cclua.', 1, true) == 1) then
return setmetatable({}, getmetatable(M.PROXY))
else
return _require(path)
end
end
return M |
function OnWorldPostUpdate()
if _rogue_vision_main then _rogue_vision_main() end
end
function OnPlayerSpawned( player_entity )
dofile("data/roguevision/roguevision.lua")
end |
logger = import 'LrLogger'('AspectRatioFilter')
|
local sailor = require "sailor"
local conf = require "conf.conf"
describe("Testing Sailor core functions", function()
local base_path
local parms = {id = 5, name = 'a_test'}
it("should create URLs accordingly without friendly urls", function()
conf.sailor.friendly_urls = false
local url = sailor.make_url('test')
assert.is_equal('?r=test',url)
url = sailor.make_url('test/etc')
assert.is_equal('?r=test/etc',url)
url = sailor.make_url('test', parms)
local exp = '?r=test'
for k,v in pairs(parms) do exp = exp .. '&' .. k .. '=' .. v end
assert.is_equal(exp,url)
url = sailor.make_url('test/etc', parms)
exp = '?r=test/etc'
for k,v in pairs(parms) do exp = exp .. '&' .. k .. '=' .. v end
assert.is_equal(exp,url)
base_path, sailor.base_path = sailor.base_path, '/sailor/test/dev-app'
url = sailor.make_url('test/etc')
assert.is_equal('/sailor/test/dev-app/?r=test/etc',url)
url = sailor.make_url('test', parms)
exp = '/sailor/test/dev-app/?r=test'
for k,v in pairs(parms) do exp = exp .. '&' .. k .. '=' .. v end
assert.is_equal(exp,url)
url = sailor.make_url('test/etc')
assert.is_equal('/sailor/test/dev-app/?r=test/etc',url)
url = sailor.make_url('test/etc', parms)
exp = '/sailor/test/dev-app/?r=test/etc'
for k,v in pairs(parms) do exp = exp .. '&' .. k .. '=' .. v end
assert.is_equal(exp,url)
base_path, sailor.base_path = sailor.base_path, base_path
end)
it("should create URLs accordingly with friendly urls", function()
conf.sailor.friendly_urls = true
sailor.base_path = ''
local url = sailor.make_url('test')
assert.is_equal('/test',url)
url = sailor.make_url('test/etc')
assert.is_equal('/test/etc',url)
url = sailor.make_url('test',parms)
local exp = '/test'
for k,v in pairs(parms) do exp = exp .. '/' .. k .. '/' .. v end
assert.is_equal(exp,url)
url = sailor.make_url('test/etc',parms)
local exp = '/test/etc'
for k,v in pairs(parms) do exp = exp .. '/' .. k .. '/' .. v end
assert.is_equal(exp,url)
base_path, sailor.base_path = sailor.base_path, '/sailor/test/dev-app'
url = sailor.make_url('test/etc')
assert.is_equal('/sailor/test/dev-app/test/etc',url)
url = sailor.make_url('test')
assert.is_equal('/sailor/test/dev-app/test',url)
url = sailor.make_url('test',parms)
exp = '/sailor/test/dev-app/test'
for k,v in pairs(parms) do exp = exp .. '/' .. k .. '/' .. v end
assert.is_equal(exp,url)
url = sailor.make_url('test/etc',parms)
exp = '/sailor/test/dev-app/test/etc'
for k,v in pairs(parms) do exp = exp .. '/' .. k .. '/' .. v end
assert.is_equal(exp,url)
base_path, sailor.base_path = sailor.base_path, base_path
end)
end) |
-- This is a part of uJIT's testing suite.
-- Copyright (C) 2015-2019 IPONWEB Ltd. See Copyright Notice in COPYRIGHT
jit.off()
local N = 100
local src = setmetatable({}, {__index = function(_, k) return "src" .. k end})
local dst = {}
for i = 1, N do
if i < N / 2 then
src[i] = "src" .. i
else
src[i] = nil
end
dst[i] = false
end
jit.opt.start(4, "hotloop=1", "hotexit=2")
jit.on()
for i = 1, N do
dst[i] = src[i]
end
jit.off()
for i = 1, N do
if i < N / 2 then
assert(src[i] == dst[i])
else
assert(rawget(src, i) == nil)
end
assert(dst[i] == "src" .. i)
end
|
require("rrpg.lua");
local __o_rrpgObjs = require("rrpgObjs.lua");
require("rrpgGUI.lua");
require("rrpgDialogs.lua");
require("rrpgLFM.lua");
require("ndb.lua");
function newfrmL5A3_svg()
__o_rrpgObjs.beginObjectsLoading();
local obj = gui.fromHandle(_obj_newObject("form"));
local self = obj;
local sheet = nil;
rawset(obj, "_oldSetNodeObjectFunction", rawget(obj, "setNodeObject"));
function obj:setNodeObject(nodeObject)
sheet = nodeObject;
self.sheet = nodeObject;
self:_oldSetNodeObjectFunction(nodeObject);
end;
function obj:setNodeDatabase(nodeObject)
self:setNodeObject(nodeObject);
end;
_gui_assignInitialParentForForm(obj.handle);
obj:beginUpdate();
obj:setName("frmL5A3_svg");
obj:setAlign("client");
obj:setTheme("light");
obj:setMargins({top=1});
obj.scrollBox1 = gui.fromHandle(_obj_newObject("scrollBox"));
obj.scrollBox1:setParent(obj);
obj.scrollBox1:setAlign("client");
obj.scrollBox1:setName("scrollBox1");
obj.rectangle1 = gui.fromHandle(_obj_newObject("rectangle"));
obj.rectangle1:setParent(obj.scrollBox1);
obj.rectangle1:setWidth(918);
obj.rectangle1:setHeight(1188);
obj.rectangle1:setColor("white");
obj.rectangle1:setName("rectangle1");
obj.image1 = gui.fromHandle(_obj_newObject("image"));
obj.image1:setParent(obj.rectangle1);
obj.image1:setLeft(0);
obj.image1:setTop(0);
obj.image1:setWidth(918);
obj.image1:setHeight(1188);
obj.image1:setSRC("/L5A/images/3.png");
obj.image1:setStyle("stretch");
obj.image1:setOptimize(true);
obj.image1:setName("image1");
obj.layout1 = gui.fromHandle(_obj_newObject("layout"));
obj.layout1:setParent(obj.rectangle1);
obj.layout1:setLeft(105);
obj.layout1:setTop(108);
obj.layout1:setWidth(148);
obj.layout1:setHeight(20);
obj.layout1:setName("layout1");
obj.edit1 = gui.fromHandle(_obj_newObject("edit"));
obj.edit1:setParent(obj.layout1);
obj.edit1:setTransparent(true);
obj.edit1:setFontSize(12.8);
obj.edit1:setFontColor("#000000");
obj.edit1:setHorzTextAlign("leading");
obj.edit1:setVertTextAlign("center");
obj.edit1:setLeft(0);
obj.edit1:setTop(0);
obj.edit1:setWidth(148);
obj.edit1:setHeight(21);
obj.edit1:setField("ESCOLA_3");
obj.edit1:setName("edit1");
obj.layout2 = gui.fromHandle(_obj_newObject("layout"));
obj.layout2:setParent(obj.rectangle1);
obj.layout2:setLeft(381);
obj.layout2:setTop(108);
obj.layout2:setWidth(148);
obj.layout2:setHeight(20);
obj.layout2:setName("layout2");
obj.edit2 = gui.fromHandle(_obj_newObject("edit"));
obj.edit2:setParent(obj.layout2);
obj.edit2:setTransparent(true);
obj.edit2:setFontSize(12.8);
obj.edit2:setFontColor("#000000");
obj.edit2:setHorzTextAlign("leading");
obj.edit2:setVertTextAlign("center");
obj.edit2:setLeft(0);
obj.edit2:setTop(0);
obj.edit2:setWidth(148);
obj.edit2:setHeight(21);
obj.edit2:setField("ESCOLA_4");
obj.edit2:setName("edit2");
obj.layout3 = gui.fromHandle(_obj_newObject("layout"));
obj.layout3:setParent(obj.rectangle1);
obj.layout3:setLeft(661);
obj.layout3:setTop(108);
obj.layout3:setWidth(148);
obj.layout3:setHeight(20);
obj.layout3:setName("layout3");
obj.edit3 = gui.fromHandle(_obj_newObject("edit"));
obj.edit3:setParent(obj.layout3);
obj.edit3:setTransparent(true);
obj.edit3:setFontSize(12.8);
obj.edit3:setFontColor("#000000");
obj.edit3:setHorzTextAlign("leading");
obj.edit3:setVertTextAlign("center");
obj.edit3:setLeft(0);
obj.edit3:setTop(0);
obj.edit3:setWidth(148);
obj.edit3:setHeight(21);
obj.edit3:setField("ESCOLA_5");
obj.edit3:setName("edit3");
obj.layout4 = gui.fromHandle(_obj_newObject("layout"));
obj.layout4:setParent(obj.rectangle1);
obj.layout4:setLeft(105);
obj.layout4:setTop(133);
obj.layout4:setWidth(169);
obj.layout4:setHeight(32);
obj.layout4:setName("layout4");
obj.edit4 = gui.fromHandle(_obj_newObject("edit"));
obj.edit4:setParent(obj.layout4);
obj.edit4:setTransparent(true);
obj.edit4:setFontSize(14.2);
obj.edit4:setFontColor("#000000");
obj.edit4:setHorzTextAlign("center");
obj.edit4:setVertTextAlign("center");
obj.edit4:setLeft(0);
obj.edit4:setTop(0);
obj.edit4:setWidth(169);
obj.edit4:setHeight(33);
obj.edit4:setField("APRENDIDONÍVEL_1_2");
obj.edit4:setName("edit4");
obj.layout5 = gui.fromHandle(_obj_newObject("layout"));
obj.layout5:setParent(obj.rectangle1);
obj.layout5:setLeft(280);
obj.layout5:setTop(135);
obj.layout5:setWidth(26);
obj.layout5:setHeight(27);
obj.layout5:setName("layout5");
obj.checkBox1 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox1:setParent(obj.layout5);
obj.checkBox1:setLeft(0);
obj.checkBox1:setTop(0);
obj.checkBox1:setWidth(26);
obj.checkBox1:setHeight(28);
obj.checkBox1:setField("Check_Box108");
obj.checkBox1:setName("checkBox1");
obj.layout6 = gui.fromHandle(_obj_newObject("layout"));
obj.layout6:setParent(obj.rectangle1);
obj.layout6:setLeft(383);
obj.layout6:setTop(133);
obj.layout6:setWidth(169);
obj.layout6:setHeight(32);
obj.layout6:setName("layout6");
obj.edit5 = gui.fromHandle(_obj_newObject("edit"));
obj.edit5:setParent(obj.layout6);
obj.edit5:setTransparent(true);
obj.edit5:setFontSize(14.2);
obj.edit5:setFontColor("#000000");
obj.edit5:setHorzTextAlign("center");
obj.edit5:setVertTextAlign("center");
obj.edit5:setLeft(0);
obj.edit5:setTop(0);
obj.edit5:setWidth(169);
obj.edit5:setHeight(33);
obj.edit5:setField("APRENDIDONÍVEL_1_4");
obj.edit5:setName("edit5");
obj.layout7 = gui.fromHandle(_obj_newObject("layout"));
obj.layout7:setParent(obj.rectangle1);
obj.layout7:setLeft(558);
obj.layout7:setTop(135);
obj.layout7:setWidth(26);
obj.layout7:setHeight(27);
obj.layout7:setName("layout7");
obj.checkBox2 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox2:setParent(obj.layout7);
obj.checkBox2:setLeft(0);
obj.checkBox2:setTop(0);
obj.checkBox2:setWidth(26);
obj.checkBox2:setHeight(28);
obj.checkBox2:setField("Check_Box113");
obj.checkBox2:setName("checkBox2");
obj.layout8 = gui.fromHandle(_obj_newObject("layout"));
obj.layout8:setParent(obj.rectangle1);
obj.layout8:setLeft(661);
obj.layout8:setTop(133);
obj.layout8:setWidth(169);
obj.layout8:setHeight(32);
obj.layout8:setName("layout8");
obj.edit6 = gui.fromHandle(_obj_newObject("edit"));
obj.edit6:setParent(obj.layout8);
obj.edit6:setTransparent(true);
obj.edit6:setFontSize(14.2);
obj.edit6:setFontColor("#000000");
obj.edit6:setHorzTextAlign("center");
obj.edit6:setVertTextAlign("center");
obj.edit6:setLeft(0);
obj.edit6:setTop(0);
obj.edit6:setWidth(169);
obj.edit6:setHeight(33);
obj.edit6:setField("APRENDIDONÍVEL_1_6");
obj.edit6:setName("edit6");
obj.layout9 = gui.fromHandle(_obj_newObject("layout"));
obj.layout9:setParent(obj.rectangle1);
obj.layout9:setLeft(836);
obj.layout9:setTop(136);
obj.layout9:setWidth(26);
obj.layout9:setHeight(27);
obj.layout9:setName("layout9");
obj.checkBox3 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox3:setParent(obj.layout9);
obj.checkBox3:setLeft(0);
obj.checkBox3:setTop(0);
obj.checkBox3:setWidth(26);
obj.checkBox3:setHeight(28);
obj.checkBox3:setField("Check_Box118");
obj.checkBox3:setName("checkBox3");
obj.layout10 = gui.fromHandle(_obj_newObject("layout"));
obj.layout10:setParent(obj.rectangle1);
obj.layout10:setLeft(105);
obj.layout10:setTop(178);
obj.layout10:setWidth(206);
obj.layout10:setHeight(89);
obj.layout10:setName("layout10");
obj.textEditor1 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor1:setParent(obj.layout10);
obj.textEditor1:setLeft(0);
obj.textEditor1:setTop(0);
obj.textEditor1:setWidth(206);
obj.textEditor1:setHeight(89);
obj.textEditor1:setFontSize(14.2);
obj.textEditor1:setFontColor("#000000");
obj.textEditor1:setField("EFEITO_4");
obj.textEditor1:setTransparent(true);
obj.textEditor1:setName("textEditor1");
obj.layout11 = gui.fromHandle(_obj_newObject("layout"));
obj.layout11:setParent(obj.rectangle1);
obj.layout11:setLeft(382);
obj.layout11:setTop(178);
obj.layout11:setWidth(206);
obj.layout11:setHeight(89);
obj.layout11:setName("layout11");
obj.textEditor2 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor2:setParent(obj.layout11);
obj.textEditor2:setLeft(0);
obj.textEditor2:setTop(0);
obj.textEditor2:setWidth(206);
obj.textEditor2:setHeight(89);
obj.textEditor2:setFontSize(14.2);
obj.textEditor2:setFontColor("#000000");
obj.textEditor2:setField("EFEITO_5");
obj.textEditor2:setTransparent(true);
obj.textEditor2:setName("textEditor2");
obj.layout12 = gui.fromHandle(_obj_newObject("layout"));
obj.layout12:setParent(obj.rectangle1);
obj.layout12:setLeft(660);
obj.layout12:setTop(178);
obj.layout12:setWidth(206);
obj.layout12:setHeight(89);
obj.layout12:setName("layout12");
obj.textEditor3 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor3:setParent(obj.layout12);
obj.textEditor3:setLeft(0);
obj.textEditor3:setTop(0);
obj.textEditor3:setWidth(206);
obj.textEditor3:setHeight(89);
obj.textEditor3:setFontSize(14.2);
obj.textEditor3:setFontColor("#000000");
obj.textEditor3:setField("EFEITO_6");
obj.textEditor3:setTransparent(true);
obj.textEditor3:setName("textEditor3");
obj.layout13 = gui.fromHandle(_obj_newObject("layout"));
obj.layout13:setParent(obj.rectangle1);
obj.layout13:setLeft(105);
obj.layout13:setTop(272);
obj.layout13:setWidth(169);
obj.layout13:setHeight(32);
obj.layout13:setName("layout13");
obj.edit7 = gui.fromHandle(_obj_newObject("edit"));
obj.edit7:setParent(obj.layout13);
obj.edit7:setTransparent(true);
obj.edit7:setFontSize(14.2);
obj.edit7:setFontColor("#000000");
obj.edit7:setHorzTextAlign("leading");
obj.edit7:setVertTextAlign("center");
obj.edit7:setLeft(0);
obj.edit7:setTop(0);
obj.edit7:setWidth(169);
obj.edit7:setHeight(33);
obj.edit7:setField("NÍVEL_2_2");
obj.edit7:setName("edit7");
obj.layout14 = gui.fromHandle(_obj_newObject("layout"));
obj.layout14:setParent(obj.rectangle1);
obj.layout14:setLeft(280);
obj.layout14:setTop(275);
obj.layout14:setWidth(26);
obj.layout14:setHeight(27);
obj.layout14:setName("layout14");
obj.checkBox4 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox4:setParent(obj.layout14);
obj.checkBox4:setLeft(0);
obj.checkBox4:setTop(0);
obj.checkBox4:setWidth(26);
obj.checkBox4:setHeight(28);
obj.checkBox4:setField("Check_Box109");
obj.checkBox4:setName("checkBox4");
obj.layout15 = gui.fromHandle(_obj_newObject("layout"));
obj.layout15:setParent(obj.rectangle1);
obj.layout15:setLeft(383);
obj.layout15:setTop(272);
obj.layout15:setWidth(169);
obj.layout15:setHeight(32);
obj.layout15:setName("layout15");
obj.edit8 = gui.fromHandle(_obj_newObject("edit"));
obj.edit8:setParent(obj.layout15);
obj.edit8:setTransparent(true);
obj.edit8:setFontSize(14.2);
obj.edit8:setFontColor("#000000");
obj.edit8:setHorzTextAlign("leading");
obj.edit8:setVertTextAlign("center");
obj.edit8:setLeft(0);
obj.edit8:setTop(0);
obj.edit8:setWidth(169);
obj.edit8:setHeight(33);
obj.edit8:setField("NÍVEL_2_3");
obj.edit8:setName("edit8");
obj.layout16 = gui.fromHandle(_obj_newObject("layout"));
obj.layout16:setParent(obj.rectangle1);
obj.layout16:setLeft(558);
obj.layout16:setTop(274);
obj.layout16:setWidth(26);
obj.layout16:setHeight(27);
obj.layout16:setName("layout16");
obj.checkBox5 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox5:setParent(obj.layout16);
obj.checkBox5:setLeft(0);
obj.checkBox5:setTop(0);
obj.checkBox5:setWidth(26);
obj.checkBox5:setHeight(28);
obj.checkBox5:setField("Check_Box114");
obj.checkBox5:setName("checkBox5");
obj.layout17 = gui.fromHandle(_obj_newObject("layout"));
obj.layout17:setParent(obj.rectangle1);
obj.layout17:setLeft(661);
obj.layout17:setTop(272);
obj.layout17:setWidth(169);
obj.layout17:setHeight(32);
obj.layout17:setName("layout17");
obj.edit9 = gui.fromHandle(_obj_newObject("edit"));
obj.edit9:setParent(obj.layout17);
obj.edit9:setTransparent(true);
obj.edit9:setFontSize(14.2);
obj.edit9:setFontColor("#000000");
obj.edit9:setHorzTextAlign("leading");
obj.edit9:setVertTextAlign("center");
obj.edit9:setLeft(0);
obj.edit9:setTop(0);
obj.edit9:setWidth(169);
obj.edit9:setHeight(33);
obj.edit9:setField("NÍVEL_2_4");
obj.edit9:setName("edit9");
obj.layout18 = gui.fromHandle(_obj_newObject("layout"));
obj.layout18:setParent(obj.rectangle1);
obj.layout18:setLeft(837);
obj.layout18:setTop(275);
obj.layout18:setWidth(26);
obj.layout18:setHeight(27);
obj.layout18:setName("layout18");
obj.checkBox6 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox6:setParent(obj.layout18);
obj.checkBox6:setLeft(0);
obj.checkBox6:setTop(0);
obj.checkBox6:setWidth(26);
obj.checkBox6:setHeight(28);
obj.checkBox6:setField("Check_Box119");
obj.checkBox6:setName("checkBox6");
obj.layout19 = gui.fromHandle(_obj_newObject("layout"));
obj.layout19:setParent(obj.rectangle1);
obj.layout19:setLeft(104);
obj.layout19:setTop(317);
obj.layout19:setWidth(206);
obj.layout19:setHeight(90);
obj.layout19:setName("layout19");
obj.textEditor4 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor4:setParent(obj.layout19);
obj.textEditor4:setLeft(0);
obj.textEditor4:setTop(0);
obj.textEditor4:setWidth(206);
obj.textEditor4:setHeight(90);
obj.textEditor4:setFontSize(14.2);
obj.textEditor4:setFontColor("#000000");
obj.textEditor4:setField("EFEITO_7");
obj.textEditor4:setTransparent(true);
obj.textEditor4:setName("textEditor4");
obj.layout20 = gui.fromHandle(_obj_newObject("layout"));
obj.layout20:setParent(obj.rectangle1);
obj.layout20:setLeft(383);
obj.layout20:setTop(317);
obj.layout20:setWidth(206);
obj.layout20:setHeight(90);
obj.layout20:setName("layout20");
obj.textEditor5 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor5:setParent(obj.layout20);
obj.textEditor5:setLeft(0);
obj.textEditor5:setTop(0);
obj.textEditor5:setWidth(206);
obj.textEditor5:setHeight(90);
obj.textEditor5:setFontSize(14.2);
obj.textEditor5:setFontColor("#000000");
obj.textEditor5:setField("EFEITO_8");
obj.textEditor5:setTransparent(true);
obj.textEditor5:setName("textEditor5");
obj.layout21 = gui.fromHandle(_obj_newObject("layout"));
obj.layout21:setParent(obj.rectangle1);
obj.layout21:setLeft(660);
obj.layout21:setTop(317);
obj.layout21:setWidth(206);
obj.layout21:setHeight(89);
obj.layout21:setName("layout21");
obj.textEditor6 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor6:setParent(obj.layout21);
obj.textEditor6:setLeft(0);
obj.textEditor6:setTop(0);
obj.textEditor6:setWidth(206);
obj.textEditor6:setHeight(89);
obj.textEditor6:setFontSize(14.2);
obj.textEditor6:setFontColor("#000000");
obj.textEditor6:setField("EFEITO_9");
obj.textEditor6:setTransparent(true);
obj.textEditor6:setName("textEditor6");
obj.layout22 = gui.fromHandle(_obj_newObject("layout"));
obj.layout22:setParent(obj.rectangle1);
obj.layout22:setLeft(105);
obj.layout22:setTop(411);
obj.layout22:setWidth(169);
obj.layout22:setHeight(32);
obj.layout22:setName("layout22");
obj.edit10 = gui.fromHandle(_obj_newObject("edit"));
obj.edit10:setParent(obj.layout22);
obj.edit10:setTransparent(true);
obj.edit10:setFontSize(14.2);
obj.edit10:setFontColor("#000000");
obj.edit10:setHorzTextAlign("leading");
obj.edit10:setVertTextAlign("center");
obj.edit10:setLeft(0);
obj.edit10:setTop(0);
obj.edit10:setWidth(169);
obj.edit10:setHeight(33);
obj.edit10:setField("NÍVEL_3_2");
obj.edit10:setName("edit10");
obj.layout23 = gui.fromHandle(_obj_newObject("layout"));
obj.layout23:setParent(obj.rectangle1);
obj.layout23:setLeft(279);
obj.layout23:setTop(413);
obj.layout23:setWidth(26);
obj.layout23:setHeight(27);
obj.layout23:setName("layout23");
obj.checkBox7 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox7:setParent(obj.layout23);
obj.checkBox7:setLeft(0);
obj.checkBox7:setTop(0);
obj.checkBox7:setWidth(26);
obj.checkBox7:setHeight(28);
obj.checkBox7:setField("Check_Box110");
obj.checkBox7:setName("checkBox7");
obj.layout24 = gui.fromHandle(_obj_newObject("layout"));
obj.layout24:setParent(obj.rectangle1);
obj.layout24:setLeft(383);
obj.layout24:setTop(411);
obj.layout24:setWidth(169);
obj.layout24:setHeight(32);
obj.layout24:setName("layout24");
obj.edit11 = gui.fromHandle(_obj_newObject("edit"));
obj.edit11:setParent(obj.layout24);
obj.edit11:setTransparent(true);
obj.edit11:setFontSize(14.2);
obj.edit11:setFontColor("#000000");
obj.edit11:setHorzTextAlign("leading");
obj.edit11:setVertTextAlign("center");
obj.edit11:setLeft(0);
obj.edit11:setTop(0);
obj.edit11:setWidth(169);
obj.edit11:setHeight(33);
obj.edit11:setField("NÍVEL_3_3");
obj.edit11:setName("edit11");
obj.layout25 = gui.fromHandle(_obj_newObject("layout"));
obj.layout25:setParent(obj.rectangle1);
obj.layout25:setLeft(559);
obj.layout25:setTop(412);
obj.layout25:setWidth(26);
obj.layout25:setHeight(27);
obj.layout25:setName("layout25");
obj.checkBox8 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox8:setParent(obj.layout25);
obj.checkBox8:setLeft(0);
obj.checkBox8:setTop(0);
obj.checkBox8:setWidth(26);
obj.checkBox8:setHeight(28);
obj.checkBox8:setField("Check_Box115");
obj.checkBox8:setName("checkBox8");
obj.layout26 = gui.fromHandle(_obj_newObject("layout"));
obj.layout26:setParent(obj.rectangle1);
obj.layout26:setLeft(661);
obj.layout26:setTop(411);
obj.layout26:setWidth(169);
obj.layout26:setHeight(32);
obj.layout26:setName("layout26");
obj.edit12 = gui.fromHandle(_obj_newObject("edit"));
obj.edit12:setParent(obj.layout26);
obj.edit12:setTransparent(true);
obj.edit12:setFontSize(14.2);
obj.edit12:setFontColor("#000000");
obj.edit12:setHorzTextAlign("leading");
obj.edit12:setVertTextAlign("center");
obj.edit12:setLeft(0);
obj.edit12:setTop(0);
obj.edit12:setWidth(169);
obj.edit12:setHeight(33);
obj.edit12:setField("NÍVEL_3_4");
obj.edit12:setName("edit12");
obj.layout27 = gui.fromHandle(_obj_newObject("layout"));
obj.layout27:setParent(obj.rectangle1);
obj.layout27:setLeft(837);
obj.layout27:setTop(413);
obj.layout27:setWidth(26);
obj.layout27:setHeight(27);
obj.layout27:setName("layout27");
obj.checkBox9 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox9:setParent(obj.layout27);
obj.checkBox9:setLeft(0);
obj.checkBox9:setTop(0);
obj.checkBox9:setWidth(26);
obj.checkBox9:setHeight(28);
obj.checkBox9:setField("Check_Box120");
obj.checkBox9:setName("checkBox9");
obj.layout28 = gui.fromHandle(_obj_newObject("layout"));
obj.layout28:setParent(obj.rectangle1);
obj.layout28:setLeft(104);
obj.layout28:setTop(456);
obj.layout28:setWidth(206);
obj.layout28:setHeight(89);
obj.layout28:setName("layout28");
obj.textEditor7 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor7:setParent(obj.layout28);
obj.textEditor7:setLeft(0);
obj.textEditor7:setTop(0);
obj.textEditor7:setWidth(206);
obj.textEditor7:setHeight(89);
obj.textEditor7:setFontSize(14.2);
obj.textEditor7:setFontColor("#000000");
obj.textEditor7:setField("EFEITO_10");
obj.textEditor7:setTransparent(true);
obj.textEditor7:setName("textEditor7");
obj.layout29 = gui.fromHandle(_obj_newObject("layout"));
obj.layout29:setParent(obj.rectangle1);
obj.layout29:setLeft(383);
obj.layout29:setTop(456);
obj.layout29:setWidth(206);
obj.layout29:setHeight(89);
obj.layout29:setName("layout29");
obj.textEditor8 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor8:setParent(obj.layout29);
obj.textEditor8:setLeft(0);
obj.textEditor8:setTop(0);
obj.textEditor8:setWidth(206);
obj.textEditor8:setHeight(89);
obj.textEditor8:setFontSize(14.2);
obj.textEditor8:setFontColor("#000000");
obj.textEditor8:setField("EFEITO_11");
obj.textEditor8:setTransparent(true);
obj.textEditor8:setName("textEditor8");
obj.layout30 = gui.fromHandle(_obj_newObject("layout"));
obj.layout30:setParent(obj.rectangle1);
obj.layout30:setLeft(661);
obj.layout30:setTop(456);
obj.layout30:setWidth(206);
obj.layout30:setHeight(89);
obj.layout30:setName("layout30");
obj.textEditor9 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor9:setParent(obj.layout30);
obj.textEditor9:setLeft(0);
obj.textEditor9:setTop(0);
obj.textEditor9:setWidth(206);
obj.textEditor9:setHeight(89);
obj.textEditor9:setFontSize(14.2);
obj.textEditor9:setFontColor("#000000");
obj.textEditor9:setField("EFEITO_12");
obj.textEditor9:setTransparent(true);
obj.textEditor9:setName("textEditor9");
obj.layout31 = gui.fromHandle(_obj_newObject("layout"));
obj.layout31:setParent(obj.rectangle1);
obj.layout31:setLeft(105);
obj.layout31:setTop(550);
obj.layout31:setWidth(169);
obj.layout31:setHeight(32);
obj.layout31:setName("layout31");
obj.edit13 = gui.fromHandle(_obj_newObject("edit"));
obj.edit13:setParent(obj.layout31);
obj.edit13:setTransparent(true);
obj.edit13:setFontSize(14.2);
obj.edit13:setFontColor("#000000");
obj.edit13:setHorzTextAlign("leading");
obj.edit13:setVertTextAlign("center");
obj.edit13:setLeft(0);
obj.edit13:setTop(0);
obj.edit13:setWidth(169);
obj.edit13:setHeight(33);
obj.edit13:setField("NÍVEL_4_2");
obj.edit13:setName("edit13");
obj.layout32 = gui.fromHandle(_obj_newObject("layout"));
obj.layout32:setParent(obj.rectangle1);
obj.layout32:setLeft(280);
obj.layout32:setTop(552);
obj.layout32:setWidth(26);
obj.layout32:setHeight(27);
obj.layout32:setName("layout32");
obj.checkBox10 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox10:setParent(obj.layout32);
obj.checkBox10:setLeft(0);
obj.checkBox10:setTop(0);
obj.checkBox10:setWidth(26);
obj.checkBox10:setHeight(28);
obj.checkBox10:setField("Check_Box111");
obj.checkBox10:setName("checkBox10");
obj.layout33 = gui.fromHandle(_obj_newObject("layout"));
obj.layout33:setParent(obj.rectangle1);
obj.layout33:setLeft(383);
obj.layout33:setTop(550);
obj.layout33:setWidth(169);
obj.layout33:setHeight(32);
obj.layout33:setName("layout33");
obj.edit14 = gui.fromHandle(_obj_newObject("edit"));
obj.edit14:setParent(obj.layout33);
obj.edit14:setTransparent(true);
obj.edit14:setFontSize(14.2);
obj.edit14:setFontColor("#000000");
obj.edit14:setHorzTextAlign("leading");
obj.edit14:setVertTextAlign("center");
obj.edit14:setLeft(0);
obj.edit14:setTop(0);
obj.edit14:setWidth(169);
obj.edit14:setHeight(33);
obj.edit14:setField("NÍVEL_4_3");
obj.edit14:setName("edit14");
obj.layout34 = gui.fromHandle(_obj_newObject("layout"));
obj.layout34:setParent(obj.rectangle1);
obj.layout34:setLeft(559);
obj.layout34:setTop(552);
obj.layout34:setWidth(26);
obj.layout34:setHeight(27);
obj.layout34:setName("layout34");
obj.checkBox11 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox11:setParent(obj.layout34);
obj.checkBox11:setLeft(0);
obj.checkBox11:setTop(0);
obj.checkBox11:setWidth(26);
obj.checkBox11:setHeight(28);
obj.checkBox11:setField("Check_Box116");
obj.checkBox11:setName("checkBox11");
obj.layout35 = gui.fromHandle(_obj_newObject("layout"));
obj.layout35:setParent(obj.rectangle1);
obj.layout35:setLeft(661);
obj.layout35:setTop(550);
obj.layout35:setWidth(169);
obj.layout35:setHeight(32);
obj.layout35:setName("layout35");
obj.edit15 = gui.fromHandle(_obj_newObject("edit"));
obj.edit15:setParent(obj.layout35);
obj.edit15:setTransparent(true);
obj.edit15:setFontSize(14.2);
obj.edit15:setFontColor("#000000");
obj.edit15:setHorzTextAlign("leading");
obj.edit15:setVertTextAlign("center");
obj.edit15:setLeft(0);
obj.edit15:setTop(0);
obj.edit15:setWidth(169);
obj.edit15:setHeight(33);
obj.edit15:setField("NÍVEL_4_4");
obj.edit15:setName("edit15");
obj.layout36 = gui.fromHandle(_obj_newObject("layout"));
obj.layout36:setParent(obj.rectangle1);
obj.layout36:setLeft(837);
obj.layout36:setTop(552);
obj.layout36:setWidth(26);
obj.layout36:setHeight(27);
obj.layout36:setName("layout36");
obj.checkBox12 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox12:setParent(obj.layout36);
obj.checkBox12:setLeft(0);
obj.checkBox12:setTop(0);
obj.checkBox12:setWidth(26);
obj.checkBox12:setHeight(28);
obj.checkBox12:setField("Check_Box121");
obj.checkBox12:setName("checkBox12");
obj.layout37 = gui.fromHandle(_obj_newObject("layout"));
obj.layout37:setParent(obj.rectangle1);
obj.layout37:setLeft(104);
obj.layout37:setTop(595);
obj.layout37:setWidth(207);
obj.layout37:setHeight(89);
obj.layout37:setName("layout37");
obj.textEditor10 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor10:setParent(obj.layout37);
obj.textEditor10:setLeft(0);
obj.textEditor10:setTop(0);
obj.textEditor10:setWidth(207);
obj.textEditor10:setHeight(89);
obj.textEditor10:setFontSize(14.2);
obj.textEditor10:setFontColor("#000000");
obj.textEditor10:setField("EFEITO_13");
obj.textEditor10:setTransparent(true);
obj.textEditor10:setName("textEditor10");
obj.layout38 = gui.fromHandle(_obj_newObject("layout"));
obj.layout38:setParent(obj.rectangle1);
obj.layout38:setLeft(383);
obj.layout38:setTop(595);
obj.layout38:setWidth(206);
obj.layout38:setHeight(90);
obj.layout38:setName("layout38");
obj.textEditor11 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor11:setParent(obj.layout38);
obj.textEditor11:setLeft(0);
obj.textEditor11:setTop(0);
obj.textEditor11:setWidth(206);
obj.textEditor11:setHeight(90);
obj.textEditor11:setFontSize(14.2);
obj.textEditor11:setFontColor("#000000");
obj.textEditor11:setField("EFEITO_14");
obj.textEditor11:setTransparent(true);
obj.textEditor11:setName("textEditor11");
obj.layout39 = gui.fromHandle(_obj_newObject("layout"));
obj.layout39:setParent(obj.rectangle1);
obj.layout39:setLeft(660);
obj.layout39:setTop(595);
obj.layout39:setWidth(206);
obj.layout39:setHeight(90);
obj.layout39:setName("layout39");
obj.textEditor12 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor12:setParent(obj.layout39);
obj.textEditor12:setLeft(0);
obj.textEditor12:setTop(0);
obj.textEditor12:setWidth(206);
obj.textEditor12:setHeight(90);
obj.textEditor12:setFontSize(14.2);
obj.textEditor12:setFontColor("#000000");
obj.textEditor12:setField("EFEITO_15");
obj.textEditor12:setTransparent(true);
obj.textEditor12:setName("textEditor12");
obj.layout40 = gui.fromHandle(_obj_newObject("layout"));
obj.layout40:setParent(obj.rectangle1);
obj.layout40:setLeft(105);
obj.layout40:setTop(689);
obj.layout40:setWidth(169);
obj.layout40:setHeight(32);
obj.layout40:setName("layout40");
obj.edit16 = gui.fromHandle(_obj_newObject("edit"));
obj.edit16:setParent(obj.layout40);
obj.edit16:setTransparent(true);
obj.edit16:setFontSize(14.2);
obj.edit16:setFontColor("#000000");
obj.edit16:setHorzTextAlign("leading");
obj.edit16:setVertTextAlign("center");
obj.edit16:setLeft(0);
obj.edit16:setTop(0);
obj.edit16:setWidth(169);
obj.edit16:setHeight(33);
obj.edit16:setField("NÍVEL_5_2");
obj.edit16:setName("edit16");
obj.layout41 = gui.fromHandle(_obj_newObject("layout"));
obj.layout41:setParent(obj.rectangle1);
obj.layout41:setLeft(280);
obj.layout41:setTop(691);
obj.layout41:setWidth(26);
obj.layout41:setHeight(27);
obj.layout41:setName("layout41");
obj.checkBox13 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox13:setParent(obj.layout41);
obj.checkBox13:setLeft(0);
obj.checkBox13:setTop(0);
obj.checkBox13:setWidth(26);
obj.checkBox13:setHeight(28);
obj.checkBox13:setField("Check_Box112");
obj.checkBox13:setName("checkBox13");
obj.layout42 = gui.fromHandle(_obj_newObject("layout"));
obj.layout42:setParent(obj.rectangle1);
obj.layout42:setLeft(383);
obj.layout42:setTop(689);
obj.layout42:setWidth(169);
obj.layout42:setHeight(32);
obj.layout42:setName("layout42");
obj.edit17 = gui.fromHandle(_obj_newObject("edit"));
obj.edit17:setParent(obj.layout42);
obj.edit17:setTransparent(true);
obj.edit17:setFontSize(14.2);
obj.edit17:setFontColor("#000000");
obj.edit17:setHorzTextAlign("leading");
obj.edit17:setVertTextAlign("center");
obj.edit17:setLeft(0);
obj.edit17:setTop(0);
obj.edit17:setWidth(169);
obj.edit17:setHeight(33);
obj.edit17:setField("NÍVEL_5_3");
obj.edit17:setName("edit17");
obj.layout43 = gui.fromHandle(_obj_newObject("layout"));
obj.layout43:setParent(obj.rectangle1);
obj.layout43:setLeft(559);
obj.layout43:setTop(692);
obj.layout43:setWidth(26);
obj.layout43:setHeight(27);
obj.layout43:setName("layout43");
obj.checkBox14 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox14:setParent(obj.layout43);
obj.checkBox14:setLeft(0);
obj.checkBox14:setTop(0);
obj.checkBox14:setWidth(26);
obj.checkBox14:setHeight(28);
obj.checkBox14:setField("Check_Box117");
obj.checkBox14:setName("checkBox14");
obj.layout44 = gui.fromHandle(_obj_newObject("layout"));
obj.layout44:setParent(obj.rectangle1);
obj.layout44:setLeft(661);
obj.layout44:setTop(689);
obj.layout44:setWidth(169);
obj.layout44:setHeight(32);
obj.layout44:setName("layout44");
obj.edit18 = gui.fromHandle(_obj_newObject("edit"));
obj.edit18:setParent(obj.layout44);
obj.edit18:setTransparent(true);
obj.edit18:setFontSize(14.2);
obj.edit18:setFontColor("#000000");
obj.edit18:setHorzTextAlign("leading");
obj.edit18:setVertTextAlign("center");
obj.edit18:setLeft(0);
obj.edit18:setTop(0);
obj.edit18:setWidth(169);
obj.edit18:setHeight(33);
obj.edit18:setField("NÍVEL_5_4");
obj.edit18:setName("edit18");
obj.layout45 = gui.fromHandle(_obj_newObject("layout"));
obj.layout45:setParent(obj.rectangle1);
obj.layout45:setLeft(837);
obj.layout45:setTop(692);
obj.layout45:setWidth(26);
obj.layout45:setHeight(27);
obj.layout45:setName("layout45");
obj.checkBox15 = gui.fromHandle(_obj_newObject("checkBox"));
obj.checkBox15:setParent(obj.layout45);
obj.checkBox15:setLeft(0);
obj.checkBox15:setTop(0);
obj.checkBox15:setWidth(26);
obj.checkBox15:setHeight(28);
obj.checkBox15:setField("Check_Box122");
obj.checkBox15:setName("checkBox15");
obj.layout46 = gui.fromHandle(_obj_newObject("layout"));
obj.layout46:setParent(obj.rectangle1);
obj.layout46:setLeft(105);
obj.layout46:setTop(733);
obj.layout46:setWidth(206);
obj.layout46:setHeight(92);
obj.layout46:setName("layout46");
obj.textEditor13 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor13:setParent(obj.layout46);
obj.textEditor13:setLeft(0);
obj.textEditor13:setTop(0);
obj.textEditor13:setWidth(206);
obj.textEditor13:setHeight(92);
obj.textEditor13:setFontSize(14.2);
obj.textEditor13:setFontColor("#000000");
obj.textEditor13:setField("EFEITO_16");
obj.textEditor13:setTransparent(true);
obj.textEditor13:setName("textEditor13");
obj.layout47 = gui.fromHandle(_obj_newObject("layout"));
obj.layout47:setParent(obj.rectangle1);
obj.layout47:setLeft(382);
obj.layout47:setTop(734);
obj.layout47:setWidth(206);
obj.layout47:setHeight(91);
obj.layout47:setName("layout47");
obj.textEditor14 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor14:setParent(obj.layout47);
obj.textEditor14:setLeft(0);
obj.textEditor14:setTop(0);
obj.textEditor14:setWidth(206);
obj.textEditor14:setHeight(91);
obj.textEditor14:setFontSize(14.2);
obj.textEditor14:setFontColor("#000000");
obj.textEditor14:setField("EFEITO_17");
obj.textEditor14:setTransparent(true);
obj.textEditor14:setName("textEditor14");
obj.layout48 = gui.fromHandle(_obj_newObject("layout"));
obj.layout48:setParent(obj.rectangle1);
obj.layout48:setLeft(660);
obj.layout48:setTop(734);
obj.layout48:setWidth(206);
obj.layout48:setHeight(91);
obj.layout48:setName("layout48");
obj.textEditor15 = gui.fromHandle(_obj_newObject("textEditor"));
obj.textEditor15:setParent(obj.layout48);
obj.textEditor15:setLeft(0);
obj.textEditor15:setTop(0);
obj.textEditor15:setWidth(206);
obj.textEditor15:setHeight(91);
obj.textEditor15:setFontSize(14.2);
obj.textEditor15:setFontColor("#000000");
obj.textEditor15:setField("EFEITO_18");
obj.textEditor15:setTransparent(true);
obj.textEditor15:setName("textEditor15");
obj.layout49 = gui.fromHandle(_obj_newObject("layout"));
obj.layout49:setParent(obj.rectangle1);
obj.layout49:setLeft(105);
obj.layout49:setTop(861);
obj.layout49:setWidth(205);
obj.layout49:setHeight(21);
obj.layout49:setName("layout49");
obj.edit19 = gui.fromHandle(_obj_newObject("edit"));
obj.edit19:setParent(obj.layout49);
obj.edit19:setTransparent(true);
obj.edit19:setFontSize(13.5);
obj.edit19:setFontColor("#000000");
obj.edit19:setHorzTextAlign("leading");
obj.edit19:setVertTextAlign("center");
obj.edit19:setLeft(0);
obj.edit19:setTop(0);
obj.edit19:setWidth(205);
obj.edit19:setHeight(22);
obj.edit19:setField("NOME_5");
obj.edit19:setName("edit19");
obj.layout50 = gui.fromHandle(_obj_newObject("layout"));
obj.layout50:setParent(obj.rectangle1);
obj.layout50:setLeft(382);
obj.layout50:setTop(861);
obj.layout50:setWidth(206);
obj.layout50:setHeight(21);
obj.layout50:setName("layout50");
obj.edit20 = gui.fromHandle(_obj_newObject("edit"));
obj.edit20:setParent(obj.layout50);
obj.edit20:setTransparent(true);
obj.edit20:setFontSize(13.5);
obj.edit20:setFontColor("#000000");
obj.edit20:setHorzTextAlign("leading");
obj.edit20:setVertTextAlign("center");
obj.edit20:setLeft(0);
obj.edit20:setTop(0);
obj.edit20:setWidth(206);
obj.edit20:setHeight(22);
obj.edit20:setField("NOME_6");
obj.edit20:setName("edit20");
obj.layout51 = gui.fromHandle(_obj_newObject("layout"));
obj.layout51:setParent(obj.rectangle1);
obj.layout51:setLeft(661);
obj.layout51:setTop(861);
obj.layout51:setWidth(205);
obj.layout51:setHeight(21);
obj.layout51:setName("layout51");
obj.edit21 = gui.fromHandle(_obj_newObject("edit"));
obj.edit21:setParent(obj.layout51);
obj.edit21:setTransparent(true);
obj.edit21:setFontSize(13.5);
obj.edit21:setFontColor("#000000");
obj.edit21:setHorzTextAlign("leading");
obj.edit21:setVertTextAlign("center");
obj.edit21:setLeft(0);
obj.edit21:setTop(0);
obj.edit21:setWidth(205);
obj.edit21:setHeight(22);
obj.edit21:setField("NOME_7");
obj.edit21:setName("edit21");
obj.layout52 = gui.fromHandle(_obj_newObject("layout"));
obj.layout52:setParent(obj.rectangle1);
obj.layout52:setLeft(104);
obj.layout52:setTop(883);
obj.layout52:setWidth(76);
obj.layout52:setHeight(41);
obj.layout52:setName("layout52");
obj.edit22 = gui.fromHandle(_obj_newObject("edit"));
obj.edit22:setParent(obj.layout52);
obj.edit22:setTransparent(true);
obj.edit22:setFontSize(14.2);
obj.edit22:setFontColor("#000000");
obj.edit22:setHorzTextAlign("leading");
obj.edit22:setVertTextAlign("center");
obj.edit22:setLeft(0);
obj.edit22:setTop(0);
obj.edit22:setWidth(76);
obj.edit22:setHeight(42);
obj.edit22:setField("ANEL_MAESTRIA");
obj.edit22:setName("edit22");
obj.layout53 = gui.fromHandle(_obj_newObject("layout"));
obj.layout53:setParent(obj.rectangle1);
obj.layout53:setLeft(234);
obj.layout53:setTop(883);
obj.layout53:setWidth(76);
obj.layout53:setHeight(41);
obj.layout53:setName("layout53");
obj.edit23 = gui.fromHandle(_obj_newObject("edit"));
obj.edit23:setParent(obj.layout53);
obj.edit23:setTransparent(true);
obj.edit23:setFontSize(14.2);
obj.edit23:setFontColor("#000000");
obj.edit23:setHorzTextAlign("leading");
obj.edit23:setVertTextAlign("center");
obj.edit23:setLeft(0);
obj.edit23:setTop(0);
obj.edit23:setWidth(76);
obj.edit23:setHeight(42);
obj.edit23:setField("DURAÇÃO_4");
obj.edit23:setName("edit23");
obj.layout54 = gui.fromHandle(_obj_newObject("layout"));
obj.layout54:setParent(obj.rectangle1);
obj.layout54:setLeft(383);
obj.layout54:setTop(883);
obj.layout54:setWidth(76);
obj.layout54:setHeight(41);
obj.layout54:setName("layout54");
obj.edit24 = gui.fromHandle(_obj_newObject("edit"));
obj.edit24:setParent(obj.layout54);
obj.edit24:setTransparent(true);
obj.edit24:setFontSize(14.2);
obj.edit24:setFontColor("#000000");
obj.edit24:setHorzTextAlign("leading");
obj.edit24:setVertTextAlign("center");
obj.edit24:setLeft(0);
obj.edit24:setTop(0);
obj.edit24:setWidth(76);
obj.edit24:setHeight(42);
obj.edit24:setField("ANEL_MAESTRIA_2");
obj.edit24:setName("edit24");
obj.layout55 = gui.fromHandle(_obj_newObject("layout"));
obj.layout55:setParent(obj.rectangle1);
obj.layout55:setLeft(512);
obj.layout55:setTop(882);
obj.layout55:setWidth(76);
obj.layout55:setHeight(42);
obj.layout55:setName("layout55");
obj.edit25 = gui.fromHandle(_obj_newObject("edit"));
obj.edit25:setParent(obj.layout55);
obj.edit25:setTransparent(true);
obj.edit25:setFontSize(14.2);
obj.edit25:setFontColor("#000000");
obj.edit25:setHorzTextAlign("leading");
obj.edit25:setVertTextAlign("center");
obj.edit25:setLeft(0);
obj.edit25:setTop(0);
obj.edit25:setWidth(76);
obj.edit25:setHeight(43);
obj.edit25:setField("DURAÇÃO_5");
obj.edit25:setName("edit25");
obj.layout56 = gui.fromHandle(_obj_newObject("layout"));
obj.layout56:setParent(obj.rectangle1);
obj.layout56:setLeft(660);
obj.layout56:setTop(883);
obj.layout56:setWidth(76);
obj.layout56:setHeight(41);
obj.layout56:setName("layout56");
obj.edit26 = gui.fromHandle(_obj_newObject("edit"));
obj.edit26:setParent(obj.layout56);
obj.edit26:setTransparent(true);
obj.edit26:setFontSize(14.2);
obj.edit26:setFontColor("#000000");
obj.edit26:setHorzTextAlign("leading");
obj.edit26:setVertTextAlign("center");
obj.edit26:setLeft(0);
obj.edit26:setTop(0);
obj.edit26:setWidth(76);
obj.edit26:setHeight(42);
obj.edit26:setField("ANEL_MAESTRIA_3");
obj.edit26:setName("edit26");
obj.layout57 = gui.fromHandle(_obj_newObject("layout"));
obj.layout57:setParent(obj.rectangle1);
obj.layout57:setLeft(790);
obj.layout57:setTop(882);
obj.layout57:setWidth(76);
obj.layout57:setHeight(42);
obj.layout57:setName("layout57");
obj.edit27 = gui.fromHandle(_obj_newObject("edit"));
obj.edit27:setParent(obj.layout57);
obj.edit27:setTransparent(true);
obj.edit27:setFontSize(14.2);
obj.edit27:setFontColor("#000000");
obj.edit27:setHorzTextAlign("leading");
obj.edit27:setVertTextAlign("center");
obj.edit27:setLeft(0);
obj.edit27:setTop(0);
obj.edit27:setWidth(76);
obj.edit27:setHeight(43);
obj.edit27:setField("DURAÇÃO_6");
obj.edit27:setName("edit27");
obj.layout58 = gui.fromHandle(_obj_newObject("layout"));
obj.layout58:setParent(obj.rectangle1);
obj.layout58:setLeft(104);
obj.layout58:setTop(925);
obj.layout58:setWidth(206);
obj.layout58:setHeight(28);
obj.layout58:setName("layout58");
obj.edit28 = gui.fromHandle(_obj_newObject("edit"));
obj.edit28:setParent(obj.layout58);
obj.edit28:setTransparent(true);
obj.edit28:setFontSize(14.2);
obj.edit28:setFontColor("#000000");
obj.edit28:setHorzTextAlign("leading");
obj.edit28:setVertTextAlign("center");
obj.edit28:setLeft(0);
obj.edit28:setTop(0);
obj.edit28:setWidth(206);
obj.edit28:setHeight(29);
obj.edit28:setField("EFEITO_19");
obj.edit28:setName("edit28");
obj.layout59 = gui.fromHandle(_obj_newObject("layout"));
obj.layout59:setParent(obj.rectangle1);
obj.layout59:setLeft(382);
obj.layout59:setTop(925);
obj.layout59:setWidth(206);
obj.layout59:setHeight(28);
obj.layout59:setName("layout59");
obj.edit29 = gui.fromHandle(_obj_newObject("edit"));
obj.edit29:setParent(obj.layout59);
obj.edit29:setTransparent(true);
obj.edit29:setFontSize(14.2);
obj.edit29:setFontColor("#000000");
obj.edit29:setHorzTextAlign("leading");
obj.edit29:setVertTextAlign("center");
obj.edit29:setLeft(0);
obj.edit29:setTop(0);
obj.edit29:setWidth(206);
obj.edit29:setHeight(29);
obj.edit29:setField("EFEITO_20");
obj.edit29:setName("edit29");
obj.layout60 = gui.fromHandle(_obj_newObject("layout"));
obj.layout60:setParent(obj.rectangle1);
obj.layout60:setLeft(661);
obj.layout60:setTop(925);
obj.layout60:setWidth(206);
obj.layout60:setHeight(28);
obj.layout60:setName("layout60");
obj.edit30 = gui.fromHandle(_obj_newObject("edit"));
obj.edit30:setParent(obj.layout60);
obj.edit30:setTransparent(true);
obj.edit30:setFontSize(14.2);
obj.edit30:setFontColor("#000000");
obj.edit30:setHorzTextAlign("leading");
obj.edit30:setVertTextAlign("center");
obj.edit30:setLeft(0);
obj.edit30:setTop(0);
obj.edit30:setWidth(206);
obj.edit30:setHeight(29);
obj.edit30:setField("EFEITO_21");
obj.edit30:setName("edit30");
obj.layout61 = gui.fromHandle(_obj_newObject("layout"));
obj.layout61:setParent(obj.rectangle1);
obj.layout61:setLeft(104);
obj.layout61:setTop(957);
obj.layout61:setWidth(206);
obj.layout61:setHeight(20);
obj.layout61:setName("layout61");
obj.edit31 = gui.fromHandle(_obj_newObject("edit"));
obj.edit31:setParent(obj.layout61);
obj.edit31:setTransparent(true);
obj.edit31:setFontSize(12.8);
obj.edit31:setFontColor("#000000");
obj.edit31:setHorzTextAlign("leading");
obj.edit31:setVertTextAlign("center");
obj.edit31:setLeft(0);
obj.edit31:setTop(0);
obj.edit31:setWidth(206);
obj.edit31:setHeight(21);
obj.edit31:setField("NOME_8");
obj.edit31:setName("edit31");
obj.layout62 = gui.fromHandle(_obj_newObject("layout"));
obj.layout62:setParent(obj.rectangle1);
obj.layout62:setLeft(383);
obj.layout62:setTop(957);
obj.layout62:setWidth(206);
obj.layout62:setHeight(20);
obj.layout62:setName("layout62");
obj.edit32 = gui.fromHandle(_obj_newObject("edit"));
obj.edit32:setParent(obj.layout62);
obj.edit32:setTransparent(true);
obj.edit32:setFontSize(12.8);
obj.edit32:setFontColor("#000000");
obj.edit32:setHorzTextAlign("leading");
obj.edit32:setVertTextAlign("center");
obj.edit32:setLeft(0);
obj.edit32:setTop(0);
obj.edit32:setWidth(206);
obj.edit32:setHeight(21);
obj.edit32:setField("NOME_9");
obj.edit32:setName("edit32");
obj.layout63 = gui.fromHandle(_obj_newObject("layout"));
obj.layout63:setParent(obj.rectangle1);
obj.layout63:setLeft(661);
obj.layout63:setTop(957);
obj.layout63:setWidth(205);
obj.layout63:setHeight(20);
obj.layout63:setName("layout63");
obj.edit33 = gui.fromHandle(_obj_newObject("edit"));
obj.edit33:setParent(obj.layout63);
obj.edit33:setTransparent(true);
obj.edit33:setFontSize(12.8);
obj.edit33:setFontColor("#000000");
obj.edit33:setHorzTextAlign("leading");
obj.edit33:setVertTextAlign("center");
obj.edit33:setLeft(0);
obj.edit33:setTop(0);
obj.edit33:setWidth(205);
obj.edit33:setHeight(21);
obj.edit33:setField("NOME_10");
obj.edit33:setName("edit33");
obj.layout64 = gui.fromHandle(_obj_newObject("layout"));
obj.layout64:setParent(obj.rectangle1);
obj.layout64:setLeft(105);
obj.layout64:setTop(979);
obj.layout64:setWidth(76);
obj.layout64:setHeight(41);
obj.layout64:setName("layout64");
obj.edit34 = gui.fromHandle(_obj_newObject("edit"));
obj.edit34:setParent(obj.layout64);
obj.edit34:setTransparent(true);
obj.edit34:setFontSize(14.2);
obj.edit34:setFontColor("#000000");
obj.edit34:setHorzTextAlign("leading");
obj.edit34:setVertTextAlign("center");
obj.edit34:setLeft(0);
obj.edit34:setTop(0);
obj.edit34:setWidth(76);
obj.edit34:setHeight(42);
obj.edit34:setField("ANEL_MAESTRIA_4");
obj.edit34:setName("edit34");
obj.layout65 = gui.fromHandle(_obj_newObject("layout"));
obj.layout65:setParent(obj.rectangle1);
obj.layout65:setLeft(234);
obj.layout65:setTop(978);
obj.layout65:setWidth(76);
obj.layout65:setHeight(42);
obj.layout65:setName("layout65");
obj.edit35 = gui.fromHandle(_obj_newObject("edit"));
obj.edit35:setParent(obj.layout65);
obj.edit35:setTransparent(true);
obj.edit35:setFontSize(14.2);
obj.edit35:setFontColor("#000000");
obj.edit35:setHorzTextAlign("leading");
obj.edit35:setVertTextAlign("center");
obj.edit35:setLeft(0);
obj.edit35:setTop(0);
obj.edit35:setWidth(76);
obj.edit35:setHeight(43);
obj.edit35:setField("DURAÇÃO_7");
obj.edit35:setName("edit35");
obj.layout66 = gui.fromHandle(_obj_newObject("layout"));
obj.layout66:setParent(obj.rectangle1);
obj.layout66:setLeft(382);
obj.layout66:setTop(979);
obj.layout66:setWidth(76);
obj.layout66:setHeight(41);
obj.layout66:setName("layout66");
obj.edit36 = gui.fromHandle(_obj_newObject("edit"));
obj.edit36:setParent(obj.layout66);
obj.edit36:setTransparent(true);
obj.edit36:setFontSize(14.2);
obj.edit36:setFontColor("#000000");
obj.edit36:setHorzTextAlign("leading");
obj.edit36:setVertTextAlign("center");
obj.edit36:setLeft(0);
obj.edit36:setTop(0);
obj.edit36:setWidth(76);
obj.edit36:setHeight(42);
obj.edit36:setField("ANEL_MAESTRIA_5");
obj.edit36:setName("edit36");
obj.layout67 = gui.fromHandle(_obj_newObject("layout"));
obj.layout67:setParent(obj.rectangle1);
obj.layout67:setLeft(512);
obj.layout67:setTop(979);
obj.layout67:setWidth(76);
obj.layout67:setHeight(41);
obj.layout67:setName("layout67");
obj.edit37 = gui.fromHandle(_obj_newObject("edit"));
obj.edit37:setParent(obj.layout67);
obj.edit37:setTransparent(true);
obj.edit37:setFontSize(14.2);
obj.edit37:setFontColor("#000000");
obj.edit37:setHorzTextAlign("leading");
obj.edit37:setVertTextAlign("center");
obj.edit37:setLeft(0);
obj.edit37:setTop(0);
obj.edit37:setWidth(76);
obj.edit37:setHeight(42);
obj.edit37:setField("DURAÇÃO_8");
obj.edit37:setName("edit37");
obj.layout68 = gui.fromHandle(_obj_newObject("layout"));
obj.layout68:setParent(obj.rectangle1);
obj.layout68:setLeft(661);
obj.layout68:setTop(979);
obj.layout68:setWidth(76);
obj.layout68:setHeight(41);
obj.layout68:setName("layout68");
obj.edit38 = gui.fromHandle(_obj_newObject("edit"));
obj.edit38:setParent(obj.layout68);
obj.edit38:setTransparent(true);
obj.edit38:setFontSize(14.2);
obj.edit38:setFontColor("#000000");
obj.edit38:setHorzTextAlign("leading");
obj.edit38:setVertTextAlign("center");
obj.edit38:setLeft(0);
obj.edit38:setTop(0);
obj.edit38:setWidth(76);
obj.edit38:setHeight(42);
obj.edit38:setField("ANEL_MAESTRIA_6");
obj.edit38:setName("edit38");
obj.layout69 = gui.fromHandle(_obj_newObject("layout"));
obj.layout69:setParent(obj.rectangle1);
obj.layout69:setLeft(790);
obj.layout69:setTop(979);
obj.layout69:setWidth(76);
obj.layout69:setHeight(41);
obj.layout69:setName("layout69");
obj.edit39 = gui.fromHandle(_obj_newObject("edit"));
obj.edit39:setParent(obj.layout69);
obj.edit39:setTransparent(true);
obj.edit39:setFontSize(14.2);
obj.edit39:setFontColor("#000000");
obj.edit39:setHorzTextAlign("leading");
obj.edit39:setVertTextAlign("center");
obj.edit39:setLeft(0);
obj.edit39:setTop(0);
obj.edit39:setWidth(76);
obj.edit39:setHeight(42);
obj.edit39:setField("DURAÇÃO_9");
obj.edit39:setName("edit39");
obj.layout70 = gui.fromHandle(_obj_newObject("layout"));
obj.layout70:setParent(obj.rectangle1);
obj.layout70:setLeft(104);
obj.layout70:setTop(1021);
obj.layout70:setWidth(206);
obj.layout70:setHeight(28);
obj.layout70:setName("layout70");
obj.edit40 = gui.fromHandle(_obj_newObject("edit"));
obj.edit40:setParent(obj.layout70);
obj.edit40:setTransparent(true);
obj.edit40:setFontSize(14.2);
obj.edit40:setFontColor("#000000");
obj.edit40:setHorzTextAlign("leading");
obj.edit40:setVertTextAlign("center");
obj.edit40:setLeft(0);
obj.edit40:setTop(0);
obj.edit40:setWidth(206);
obj.edit40:setHeight(29);
obj.edit40:setField("EFEITO_22");
obj.edit40:setName("edit40");
obj.layout71 = gui.fromHandle(_obj_newObject("layout"));
obj.layout71:setParent(obj.rectangle1);
obj.layout71:setLeft(383);
obj.layout71:setTop(1021);
obj.layout71:setWidth(206);
obj.layout71:setHeight(28);
obj.layout71:setName("layout71");
obj.edit41 = gui.fromHandle(_obj_newObject("edit"));
obj.edit41:setParent(obj.layout71);
obj.edit41:setTransparent(true);
obj.edit41:setFontSize(14.2);
obj.edit41:setFontColor("#000000");
obj.edit41:setHorzTextAlign("leading");
obj.edit41:setVertTextAlign("center");
obj.edit41:setLeft(0);
obj.edit41:setTop(0);
obj.edit41:setWidth(206);
obj.edit41:setHeight(29);
obj.edit41:setField("EFEITO_23");
obj.edit41:setName("edit41");
obj.layout72 = gui.fromHandle(_obj_newObject("layout"));
obj.layout72:setParent(obj.rectangle1);
obj.layout72:setLeft(661);
obj.layout72:setTop(1021);
obj.layout72:setWidth(206);
obj.layout72:setHeight(28);
obj.layout72:setName("layout72");
obj.edit42 = gui.fromHandle(_obj_newObject("edit"));
obj.edit42:setParent(obj.layout72);
obj.edit42:setTransparent(true);
obj.edit42:setFontSize(14.2);
obj.edit42:setFontColor("#000000");
obj.edit42:setHorzTextAlign("leading");
obj.edit42:setVertTextAlign("center");
obj.edit42:setLeft(0);
obj.edit42:setTop(0);
obj.edit42:setWidth(206);
obj.edit42:setHeight(29);
obj.edit42:setField("EFEITO_24");
obj.edit42:setName("edit42");
obj.layout73 = gui.fromHandle(_obj_newObject("layout"));
obj.layout73:setParent(obj.rectangle1);
obj.layout73:setLeft(105);
obj.layout73:setTop(1054);
obj.layout73:setWidth(205);
obj.layout73:setHeight(20);
obj.layout73:setName("layout73");
obj.edit43 = gui.fromHandle(_obj_newObject("edit"));
obj.edit43:setParent(obj.layout73);
obj.edit43:setTransparent(true);
obj.edit43:setFontSize(12.8);
obj.edit43:setFontColor("#000000");
obj.edit43:setHorzTextAlign("leading");
obj.edit43:setVertTextAlign("center");
obj.edit43:setLeft(0);
obj.edit43:setTop(0);
obj.edit43:setWidth(205);
obj.edit43:setHeight(21);
obj.edit43:setField("NOME_11");
obj.edit43:setName("edit43");
obj.layout74 = gui.fromHandle(_obj_newObject("layout"));
obj.layout74:setParent(obj.rectangle1);
obj.layout74:setLeft(383);
obj.layout74:setTop(1054);
obj.layout74:setWidth(205);
obj.layout74:setHeight(20);
obj.layout74:setName("layout74");
obj.edit44 = gui.fromHandle(_obj_newObject("edit"));
obj.edit44:setParent(obj.layout74);
obj.edit44:setTransparent(true);
obj.edit44:setFontSize(12.8);
obj.edit44:setFontColor("#000000");
obj.edit44:setHorzTextAlign("leading");
obj.edit44:setVertTextAlign("center");
obj.edit44:setLeft(0);
obj.edit44:setTop(0);
obj.edit44:setWidth(205);
obj.edit44:setHeight(21);
obj.edit44:setField("NOME_12");
obj.edit44:setName("edit44");
obj.layout75 = gui.fromHandle(_obj_newObject("layout"));
obj.layout75:setParent(obj.rectangle1);
obj.layout75:setLeft(661);
obj.layout75:setTop(1054);
obj.layout75:setWidth(206);
obj.layout75:setHeight(20);
obj.layout75:setName("layout75");
obj.edit45 = gui.fromHandle(_obj_newObject("edit"));
obj.edit45:setParent(obj.layout75);
obj.edit45:setTransparent(true);
obj.edit45:setFontSize(12.8);
obj.edit45:setFontColor("#000000");
obj.edit45:setHorzTextAlign("leading");
obj.edit45:setVertTextAlign("center");
obj.edit45:setLeft(0);
obj.edit45:setTop(0);
obj.edit45:setWidth(206);
obj.edit45:setHeight(21);
obj.edit45:setField("NOME_13");
obj.edit45:setName("edit45");
obj.layout76 = gui.fromHandle(_obj_newObject("layout"));
obj.layout76:setParent(obj.rectangle1);
obj.layout76:setLeft(104);
obj.layout76:setTop(1075);
obj.layout76:setWidth(76);
obj.layout76:setHeight(41);
obj.layout76:setName("layout76");
obj.edit46 = gui.fromHandle(_obj_newObject("edit"));
obj.edit46:setParent(obj.layout76);
obj.edit46:setTransparent(true);
obj.edit46:setFontSize(14.2);
obj.edit46:setFontColor("#000000");
obj.edit46:setHorzTextAlign("leading");
obj.edit46:setVertTextAlign("center");
obj.edit46:setLeft(0);
obj.edit46:setTop(0);
obj.edit46:setWidth(76);
obj.edit46:setHeight(42);
obj.edit46:setField("ANEL_MAESTRIA_7");
obj.edit46:setName("edit46");
obj.layout77 = gui.fromHandle(_obj_newObject("layout"));
obj.layout77:setParent(obj.rectangle1);
obj.layout77:setLeft(234);
obj.layout77:setTop(1075);
obj.layout77:setWidth(76);
obj.layout77:setHeight(41);
obj.layout77:setName("layout77");
obj.edit47 = gui.fromHandle(_obj_newObject("edit"));
obj.edit47:setParent(obj.layout77);
obj.edit47:setTransparent(true);
obj.edit47:setFontSize(14.2);
obj.edit47:setFontColor("#000000");
obj.edit47:setHorzTextAlign("leading");
obj.edit47:setVertTextAlign("center");
obj.edit47:setLeft(0);
obj.edit47:setTop(0);
obj.edit47:setWidth(76);
obj.edit47:setHeight(42);
obj.edit47:setField("DURAÇÃO_10");
obj.edit47:setName("edit47");
obj.layout78 = gui.fromHandle(_obj_newObject("layout"));
obj.layout78:setParent(obj.rectangle1);
obj.layout78:setLeft(382);
obj.layout78:setTop(1075);
obj.layout78:setWidth(76);
obj.layout78:setHeight(41);
obj.layout78:setName("layout78");
obj.edit48 = gui.fromHandle(_obj_newObject("edit"));
obj.edit48:setParent(obj.layout78);
obj.edit48:setTransparent(true);
obj.edit48:setFontSize(14.2);
obj.edit48:setFontColor("#000000");
obj.edit48:setHorzTextAlign("leading");
obj.edit48:setVertTextAlign("center");
obj.edit48:setLeft(0);
obj.edit48:setTop(0);
obj.edit48:setWidth(76);
obj.edit48:setHeight(42);
obj.edit48:setField("ANEL_MAESTRIA_8");
obj.edit48:setName("edit48");
obj.layout79 = gui.fromHandle(_obj_newObject("layout"));
obj.layout79:setParent(obj.rectangle1);
obj.layout79:setLeft(512);
obj.layout79:setTop(1075);
obj.layout79:setWidth(76);
obj.layout79:setHeight(41);
obj.layout79:setName("layout79");
obj.edit49 = gui.fromHandle(_obj_newObject("edit"));
obj.edit49:setParent(obj.layout79);
obj.edit49:setTransparent(true);
obj.edit49:setFontSize(14.2);
obj.edit49:setFontColor("#000000");
obj.edit49:setHorzTextAlign("leading");
obj.edit49:setVertTextAlign("center");
obj.edit49:setLeft(0);
obj.edit49:setTop(0);
obj.edit49:setWidth(76);
obj.edit49:setHeight(42);
obj.edit49:setField("DURAÇÃO_11");
obj.edit49:setName("edit49");
obj.layout80 = gui.fromHandle(_obj_newObject("layout"));
obj.layout80:setParent(obj.rectangle1);
obj.layout80:setLeft(660);
obj.layout80:setTop(1075);
obj.layout80:setWidth(76);
obj.layout80:setHeight(41);
obj.layout80:setName("layout80");
obj.edit50 = gui.fromHandle(_obj_newObject("edit"));
obj.edit50:setParent(obj.layout80);
obj.edit50:setTransparent(true);
obj.edit50:setFontSize(14.2);
obj.edit50:setFontColor("#000000");
obj.edit50:setHorzTextAlign("leading");
obj.edit50:setVertTextAlign("center");
obj.edit50:setLeft(0);
obj.edit50:setTop(0);
obj.edit50:setWidth(76);
obj.edit50:setHeight(42);
obj.edit50:setField("ANEL_MAESTRIA_9");
obj.edit50:setName("edit50");
obj.layout81 = gui.fromHandle(_obj_newObject("layout"));
obj.layout81:setParent(obj.rectangle1);
obj.layout81:setLeft(790);
obj.layout81:setTop(1075);
obj.layout81:setWidth(76);
obj.layout81:setHeight(41);
obj.layout81:setName("layout81");
obj.edit51 = gui.fromHandle(_obj_newObject("edit"));
obj.edit51:setParent(obj.layout81);
obj.edit51:setTransparent(true);
obj.edit51:setFontSize(14.2);
obj.edit51:setFontColor("#000000");
obj.edit51:setHorzTextAlign("leading");
obj.edit51:setVertTextAlign("center");
obj.edit51:setLeft(0);
obj.edit51:setTop(0);
obj.edit51:setWidth(76);
obj.edit51:setHeight(42);
obj.edit51:setField("DURAÇÃO_12");
obj.edit51:setName("edit51");
obj.layout82 = gui.fromHandle(_obj_newObject("layout"));
obj.layout82:setParent(obj.rectangle1);
obj.layout82:setLeft(105);
obj.layout82:setTop(1117);
obj.layout82:setWidth(206);
obj.layout82:setHeight(31);
obj.layout82:setName("layout82");
obj.edit52 = gui.fromHandle(_obj_newObject("edit"));
obj.edit52:setParent(obj.layout82);
obj.edit52:setTransparent(true);
obj.edit52:setFontSize(14.2);
obj.edit52:setFontColor("#000000");
obj.edit52:setHorzTextAlign("leading");
obj.edit52:setVertTextAlign("center");
obj.edit52:setLeft(0);
obj.edit52:setTop(0);
obj.edit52:setWidth(206);
obj.edit52:setHeight(32);
obj.edit52:setField("EFEITO_25");
obj.edit52:setName("edit52");
obj.layout83 = gui.fromHandle(_obj_newObject("layout"));
obj.layout83:setParent(obj.rectangle1);
obj.layout83:setLeft(382);
obj.layout83:setTop(1117);
obj.layout83:setWidth(206);
obj.layout83:setHeight(31);
obj.layout83:setName("layout83");
obj.edit53 = gui.fromHandle(_obj_newObject("edit"));
obj.edit53:setParent(obj.layout83);
obj.edit53:setTransparent(true);
obj.edit53:setFontSize(14.2);
obj.edit53:setFontColor("#000000");
obj.edit53:setHorzTextAlign("leading");
obj.edit53:setVertTextAlign("center");
obj.edit53:setLeft(0);
obj.edit53:setTop(0);
obj.edit53:setWidth(206);
obj.edit53:setHeight(32);
obj.edit53:setField("EFEITO_26");
obj.edit53:setName("edit53");
obj.layout84 = gui.fromHandle(_obj_newObject("layout"));
obj.layout84:setParent(obj.rectangle1);
obj.layout84:setLeft(661);
obj.layout84:setTop(1117);
obj.layout84:setWidth(205);
obj.layout84:setHeight(31);
obj.layout84:setName("layout84");
obj.edit54 = gui.fromHandle(_obj_newObject("edit"));
obj.edit54:setParent(obj.layout84);
obj.edit54:setTransparent(true);
obj.edit54:setFontSize(14.2);
obj.edit54:setFontColor("#000000");
obj.edit54:setHorzTextAlign("leading");
obj.edit54:setVertTextAlign("center");
obj.edit54:setLeft(0);
obj.edit54:setTop(0);
obj.edit54:setWidth(205);
obj.edit54:setHeight(32);
obj.edit54:setField("EFEITO_27");
obj.edit54:setName("edit54");
function obj:_releaseEvents()
end;
obj._oldLFMDestroy = obj.destroy;
function obj:destroy()
self:_releaseEvents();
if (self.handle ~= 0) and (self.setNodeDatabase ~= nil) then
self:setNodeDatabase(nil);
end;
if self.layout39 ~= nil then self.layout39:destroy(); self.layout39 = nil; end;
if self.layout83 ~= nil then self.layout83:destroy(); self.layout83 = nil; end;
if self.layout43 ~= nil then self.layout43:destroy(); self.layout43 = nil; end;
if self.edit46 ~= nil then self.edit46:destroy(); self.edit46 = nil; end;
if self.checkBox15 ~= nil then self.checkBox15:destroy(); self.checkBox15 = nil; end;
if self.layout15 ~= nil then self.layout15:destroy(); self.layout15 = nil; end;
if self.layout58 ~= nil then self.layout58:destroy(); self.layout58 = nil; end;
if self.layout10 ~= nil then self.layout10:destroy(); self.layout10 = nil; end;
if self.textEditor13 ~= nil then self.textEditor13:destroy(); self.textEditor13 = nil; end;
if self.layout69 ~= nil then self.layout69:destroy(); self.layout69 = nil; end;
if self.edit41 ~= nil then self.edit41:destroy(); self.edit41 = nil; end;
if self.textEditor9 ~= nil then self.textEditor9:destroy(); self.textEditor9 = nil; end;
if self.edit9 ~= nil then self.edit9:destroy(); self.edit9 = nil; end;
if self.layout64 ~= nil then self.layout64:destroy(); self.layout64 = nil; end;
if self.edit33 ~= nil then self.edit33:destroy(); self.edit33 = nil; end;
if self.edit36 ~= nil then self.edit36:destroy(); self.edit36 = nil; end;
if self.edit29 ~= nil then self.edit29:destroy(); self.edit29 = nil; end;
if self.layout63 ~= nil then self.layout63:destroy(); self.layout63 = nil; end;
if self.layout30 ~= nil then self.layout30:destroy(); self.layout30 = nil; end;
if self.layout80 ~= nil then self.layout80:destroy(); self.layout80 = nil; end;
if self.layout17 ~= nil then self.layout17:destroy(); self.layout17 = nil; end;
if self.edit7 ~= nil then self.edit7:destroy(); self.edit7 = nil; end;
if self.layout57 ~= nil then self.layout57:destroy(); self.layout57 = nil; end;
if self.edit28 ~= nil then self.edit28:destroy(); self.edit28 = nil; end;
if self.textEditor3 ~= nil then self.textEditor3:destroy(); self.textEditor3 = nil; end;
if self.layout60 ~= nil then self.layout60:destroy(); self.layout60 = nil; end;
if self.edit12 ~= nil then self.edit12:destroy(); self.edit12 = nil; end;
if self.layout47 ~= nil then self.layout47:destroy(); self.layout47 = nil; end;
if self.layout59 ~= nil then self.layout59:destroy(); self.layout59 = nil; end;
if self.layout82 ~= nil then self.layout82:destroy(); self.layout82 = nil; end;
if self.layout65 ~= nil then self.layout65:destroy(); self.layout65 = nil; end;
if self.layout41 ~= nil then self.layout41:destroy(); self.layout41 = nil; end;
if self.edit35 ~= nil then self.edit35:destroy(); self.edit35 = nil; end;
if self.layout72 ~= nil then self.layout72:destroy(); self.layout72 = nil; end;
if self.checkBox11 ~= nil then self.checkBox11:destroy(); self.checkBox11 = nil; end;
if self.checkBox6 ~= nil then self.checkBox6:destroy(); self.checkBox6 = nil; end;
if self.layout38 ~= nil then self.layout38:destroy(); self.layout38 = nil; end;
if self.layout24 ~= nil then self.layout24:destroy(); self.layout24 = nil; end;
if self.layout13 ~= nil then self.layout13:destroy(); self.layout13 = nil; end;
if self.layout3 ~= nil then self.layout3:destroy(); self.layout3 = nil; end;
if self.edit54 ~= nil then self.edit54:destroy(); self.edit54 = nil; end;
if self.layout8 ~= nil then self.layout8:destroy(); self.layout8 = nil; end;
if self.checkBox8 ~= nil then self.checkBox8:destroy(); self.checkBox8 = nil; end;
if self.layout1 ~= nil then self.layout1:destroy(); self.layout1 = nil; end;
if self.checkBox7 ~= nil then self.checkBox7:destroy(); self.checkBox7 = nil; end;
if self.layout23 ~= nil then self.layout23:destroy(); self.layout23 = nil; end;
if self.rectangle1 ~= nil then self.rectangle1:destroy(); self.rectangle1 = nil; end;
if self.layout45 ~= nil then self.layout45:destroy(); self.layout45 = nil; end;
if self.edit47 ~= nil then self.edit47:destroy(); self.edit47 = nil; end;
if self.edit50 ~= nil then self.edit50:destroy(); self.edit50 = nil; end;
if self.edit24 ~= nil then self.edit24:destroy(); self.edit24 = nil; end;
if self.layout62 ~= nil then self.layout62:destroy(); self.layout62 = nil; end;
if self.layout68 ~= nil then self.layout68:destroy(); self.layout68 = nil; end;
if self.layout12 ~= nil then self.layout12:destroy(); self.layout12 = nil; end;
if self.edit14 ~= nil then self.edit14:destroy(); self.edit14 = nil; end;
if self.layout77 ~= nil then self.layout77:destroy(); self.layout77 = nil; end;
if self.layout46 ~= nil then self.layout46:destroy(); self.layout46 = nil; end;
if self.layout56 ~= nil then self.layout56:destroy(); self.layout56 = nil; end;
if self.edit4 ~= nil then self.edit4:destroy(); self.edit4 = nil; end;
if self.layout25 ~= nil then self.layout25:destroy(); self.layout25 = nil; end;
if self.edit26 ~= nil then self.edit26:destroy(); self.edit26 = nil; end;
if self.edit44 ~= nil then self.edit44:destroy(); self.edit44 = nil; end;
if self.layout81 ~= nil then self.layout81:destroy(); self.layout81 = nil; end;
if self.edit34 ~= nil then self.edit34:destroy(); self.edit34 = nil; end;
if self.layout9 ~= nil then self.layout9:destroy(); self.layout9 = nil; end;
if self.edit11 ~= nil then self.edit11:destroy(); self.edit11 = nil; end;
if self.image1 ~= nil then self.image1:destroy(); self.image1 = nil; end;
if self.textEditor11 ~= nil then self.textEditor11:destroy(); self.textEditor11 = nil; end;
if self.edit19 ~= nil then self.edit19:destroy(); self.edit19 = nil; end;
if self.layout66 ~= nil then self.layout66:destroy(); self.layout66 = nil; end;
if self.layout71 ~= nil then self.layout71:destroy(); self.layout71 = nil; end;
if self.edit5 ~= nil then self.edit5:destroy(); self.edit5 = nil; end;
if self.textEditor2 ~= nil then self.textEditor2:destroy(); self.textEditor2 = nil; end;
if self.layout54 ~= nil then self.layout54:destroy(); self.layout54 = nil; end;
if self.layout50 ~= nil then self.layout50:destroy(); self.layout50 = nil; end;
if self.layout32 ~= nil then self.layout32:destroy(); self.layout32 = nil; end;
if self.layout37 ~= nil then self.layout37:destroy(); self.layout37 = nil; end;
if self.textEditor15 ~= nil then self.textEditor15:destroy(); self.textEditor15 = nil; end;
if self.layout26 ~= nil then self.layout26:destroy(); self.layout26 = nil; end;
if self.checkBox9 ~= nil then self.checkBox9:destroy(); self.checkBox9 = nil; end;
if self.edit8 ~= nil then self.edit8:destroy(); self.edit8 = nil; end;
if self.layout27 ~= nil then self.layout27:destroy(); self.layout27 = nil; end;
if self.layout36 ~= nil then self.layout36:destroy(); self.layout36 = nil; end;
if self.edit45 ~= nil then self.edit45:destroy(); self.edit45 = nil; end;
if self.textEditor5 ~= nil then self.textEditor5:destroy(); self.textEditor5 = nil; end;
if self.edit53 ~= nil then self.edit53:destroy(); self.edit53 = nil; end;
if self.layout28 ~= nil then self.layout28:destroy(); self.layout28 = nil; end;
if self.layout44 ~= nil then self.layout44:destroy(); self.layout44 = nil; end;
if self.textEditor7 ~= nil then self.textEditor7:destroy(); self.textEditor7 = nil; end;
if self.layout19 ~= nil then self.layout19:destroy(); self.layout19 = nil; end;
if self.edit2 ~= nil then self.edit2:destroy(); self.edit2 = nil; end;
if self.edit10 ~= nil then self.edit10:destroy(); self.edit10 = nil; end;
if self.edit16 ~= nil then self.edit16:destroy(); self.edit16 = nil; end;
if self.layout52 ~= nil then self.layout52:destroy(); self.layout52 = nil; end;
if self.edit31 ~= nil then self.edit31:destroy(); self.edit31 = nil; end;
if self.edit1 ~= nil then self.edit1:destroy(); self.edit1 = nil; end;
if self.layout74 ~= nil then self.layout74:destroy(); self.layout74 = nil; end;
if self.edit30 ~= nil then self.edit30:destroy(); self.edit30 = nil; end;
if self.checkBox5 ~= nil then self.checkBox5:destroy(); self.checkBox5 = nil; end;
if self.textEditor4 ~= nil then self.textEditor4:destroy(); self.textEditor4 = nil; end;
if self.layout34 ~= nil then self.layout34:destroy(); self.layout34 = nil; end;
if self.edit21 ~= nil then self.edit21:destroy(); self.edit21 = nil; end;
if self.edit52 ~= nil then self.edit52:destroy(); self.edit52 = nil; end;
if self.layout4 ~= nil then self.layout4:destroy(); self.layout4 = nil; end;
if self.layout76 ~= nil then self.layout76:destroy(); self.layout76 = nil; end;
if self.checkBox14 ~= nil then self.checkBox14:destroy(); self.checkBox14 = nil; end;
if self.edit43 ~= nil then self.edit43:destroy(); self.edit43 = nil; end;
if self.checkBox3 ~= nil then self.checkBox3:destroy(); self.checkBox3 = nil; end;
if self.layout42 ~= nil then self.layout42:destroy(); self.layout42 = nil; end;
if self.layout61 ~= nil then self.layout61:destroy(); self.layout61 = nil; end;
if self.layout53 ~= nil then self.layout53:destroy(); self.layout53 = nil; end;
if self.edit13 ~= nil then self.edit13:destroy(); self.edit13 = nil; end;
if self.edit39 ~= nil then self.edit39:destroy(); self.edit39 = nil; end;
if self.layout5 ~= nil then self.layout5:destroy(); self.layout5 = nil; end;
if self.layout20 ~= nil then self.layout20:destroy(); self.layout20 = nil; end;
if self.edit23 ~= nil then self.edit23:destroy(); self.edit23 = nil; end;
if self.layout55 ~= nil then self.layout55:destroy(); self.layout55 = nil; end;
if self.layout18 ~= nil then self.layout18:destroy(); self.layout18 = nil; end;
if self.layout78 ~= nil then self.layout78:destroy(); self.layout78 = nil; end;
if self.edit37 ~= nil then self.edit37:destroy(); self.edit37 = nil; end;
if self.checkBox12 ~= nil then self.checkBox12:destroy(); self.checkBox12 = nil; end;
if self.edit40 ~= nil then self.edit40:destroy(); self.edit40 = nil; end;
if self.textEditor6 ~= nil then self.textEditor6:destroy(); self.textEditor6 = nil; end;
if self.textEditor10 ~= nil then self.textEditor10:destroy(); self.textEditor10 = nil; end;
if self.layout31 ~= nil then self.layout31:destroy(); self.layout31 = nil; end;
if self.textEditor12 ~= nil then self.textEditor12:destroy(); self.textEditor12 = nil; end;
if self.layout70 ~= nil then self.layout70:destroy(); self.layout70 = nil; end;
if self.edit17 ~= nil then self.edit17:destroy(); self.edit17 = nil; end;
if self.edit51 ~= nil then self.edit51:destroy(); self.edit51 = nil; end;
if self.layout2 ~= nil then self.layout2:destroy(); self.layout2 = nil; end;
if self.edit38 ~= nil then self.edit38:destroy(); self.edit38 = nil; end;
if self.edit48 ~= nil then self.edit48:destroy(); self.edit48 = nil; end;
if self.layout49 ~= nil then self.layout49:destroy(); self.layout49 = nil; end;
if self.layout67 ~= nil then self.layout67:destroy(); self.layout67 = nil; end;
if self.checkBox2 ~= nil then self.checkBox2:destroy(); self.checkBox2 = nil; end;
if self.layout29 ~= nil then self.layout29:destroy(); self.layout29 = nil; end;
if self.layout35 ~= nil then self.layout35:destroy(); self.layout35 = nil; end;
if self.textEditor14 ~= nil then self.textEditor14:destroy(); self.textEditor14 = nil; end;
if self.layout11 ~= nil then self.layout11:destroy(); self.layout11 = nil; end;
if self.edit15 ~= nil then self.edit15:destroy(); self.edit15 = nil; end;
if self.textEditor1 ~= nil then self.textEditor1:destroy(); self.textEditor1 = nil; end;
if self.layout40 ~= nil then self.layout40:destroy(); self.layout40 = nil; end;
if self.layout84 ~= nil then self.layout84:destroy(); self.layout84 = nil; end;
if self.checkBox13 ~= nil then self.checkBox13:destroy(); self.checkBox13 = nil; end;
if self.edit6 ~= nil then self.edit6:destroy(); self.edit6 = nil; end;
if self.textEditor8 ~= nil then self.textEditor8:destroy(); self.textEditor8 = nil; end;
if self.edit42 ~= nil then self.edit42:destroy(); self.edit42 = nil; end;
if self.edit22 ~= nil then self.edit22:destroy(); self.edit22 = nil; end;
if self.edit3 ~= nil then self.edit3:destroy(); self.edit3 = nil; end;
if self.checkBox10 ~= nil then self.checkBox10:destroy(); self.checkBox10 = nil; end;
if self.layout33 ~= nil then self.layout33:destroy(); self.layout33 = nil; end;
if self.layout6 ~= nil then self.layout6:destroy(); self.layout6 = nil; end;
if self.edit49 ~= nil then self.edit49:destroy(); self.edit49 = nil; end;
if self.layout22 ~= nil then self.layout22:destroy(); self.layout22 = nil; end;
if self.layout48 ~= nil then self.layout48:destroy(); self.layout48 = nil; end;
if self.layout73 ~= nil then self.layout73:destroy(); self.layout73 = nil; end;
if self.layout14 ~= nil then self.layout14:destroy(); self.layout14 = nil; end;
if self.edit27 ~= nil then self.edit27:destroy(); self.edit27 = nil; end;
if self.layout16 ~= nil then self.layout16:destroy(); self.layout16 = nil; end;
if self.layout21 ~= nil then self.layout21:destroy(); self.layout21 = nil; end;
if self.edit32 ~= nil then self.edit32:destroy(); self.edit32 = nil; end;
if self.checkBox4 ~= nil then self.checkBox4:destroy(); self.checkBox4 = nil; end;
if self.layout51 ~= nil then self.layout51:destroy(); self.layout51 = nil; end;
if self.edit18 ~= nil then self.edit18:destroy(); self.edit18 = nil; end;
if self.checkBox1 ~= nil then self.checkBox1:destroy(); self.checkBox1 = nil; end;
if self.edit25 ~= nil then self.edit25:destroy(); self.edit25 = nil; end;
if self.scrollBox1 ~= nil then self.scrollBox1:destroy(); self.scrollBox1 = nil; end;
if self.layout75 ~= nil then self.layout75:destroy(); self.layout75 = nil; end;
if self.layout7 ~= nil then self.layout7:destroy(); self.layout7 = nil; end;
if self.layout79 ~= nil then self.layout79:destroy(); self.layout79 = nil; end;
if self.edit20 ~= nil then self.edit20:destroy(); self.edit20 = nil; end;
self:_oldLFMDestroy();
end;
obj:endUpdate();
__o_rrpgObjs.endObjectsLoading();
return obj;
end;
local _frmL5A3_svg = {
newEditor = newfrmL5A3_svg,
new = newfrmL5A3_svg,
name = "frmL5A3_svg",
dataType = "",
formType = "undefined",
formComponentName = "form",
title = "",
description=""};
frmL5A3_svg = _frmL5A3_svg;
rrpg.registrarForm(_frmL5A3_svg);
return _frmL5A3_svg;
|
local insert = table.insert
local remove = table.remove
local max = math.max
local min = math.min
local Cursor = required("Cursor")
local Window = required("Window")
local LayoutManager = {}
local instances = {}
local stack = {}
local active = nil
local function get_window_bounds()
local win_x, win_y, win_w, win_h = Window.get_bounds(true)
local border = Window.get_border()
win_x = win_x + border
win_y = win_y + border
win_w = win_w - border * 2
win_h = win_h - border * 2
return win_x, win_y, win_w, win_h
end
local function get_row_size(instance)
if instance ~= nil then
local column = instance.columns[instance.column_no]
if column.rows ~= nil then
local row = column.rows[column.row_no]
if row ~= nil then
return row.w, row.h
end
end
end
return 0, 0
end
local function get_row_cursor_pos(instance)
if instance ~= nil then
local column = instance.columns[instance.column_no]
if column.rows ~= nil then
local row = column.rows[column.row_no]
if row ~= nil then
return row.cursor_x, row.cursor_y
end
end
end
return nil, nil
end
local function get_layout_h(instance, include_pad)
include_pad = include_pad == nil and true or include_pad
if instance ~= nil then
local column = instance.columns[instance.column_no]
if column.rows ~= nil then
local h = 0
for i, v in ipairs(column.rows) do
h = h + v.h
if include_pad then
h = h + Cursor.pad_y()
end
end
return h
end
end
return 0
end
local function get_previous_row_bottom(instance)
if instance ~= nil then
local column = instance.columns[instance.column_no]
if column.rows ~= nil and column.row_no > 1 and column.row_no <= #column.rows then
local y = column.rows[column.row_no - 1].cursor_y
local h = column.rows[column.row_no - 1].h
return y + h
end
end
return nil
end
local function get_column_position(instance)
if instance ~= nil then
local win_x, win_y, win_w, win_h = get_window_bounds()
local win_l, win_t = Window.get_position()
local count = #instance.columns
local column_w = win_w / count
local total_w = 0
for i = 1, instance.column_no - 1, 1 do
local column = instance.columns[i]
total_w = total_w + column.w
end
local anchor_x, anchor_y = instance.x, instance.y
if not instance.anchor_x then
anchor_x = win_x - win_l - Window.get_border()
end
if not instance.anchor_y then
anchor_y = win_y - win_t - Window.get_border()
end
return anchor_x + total_w, anchor_y
end
return 0, 0
end
local function get_column_size(instance)
if instance ~= nil then
local column = instance.columns[instance.column_no]
local win_x, win_y, win_w, win_h = get_window_bounds()
local count = #instance.columns
local column_w = win_w / count
local w, h = 0, get_layout_h(instance)
if not Window.is_auto_size() then
w = column_w
h = win_h
column.w = w
else
w = max(column.w, column_w)
end
return w, h
end
return 0, 0
end
local function add_control(instance, w, h, t)
if instance ~= nil then
local row_w, row_h = get_row_size(instance)
local win_x, win_y, win_w, win_h = get_window_bounds()
local cursor_x, cursor_y = Cursor.get_position()
local x, y = get_row_cursor_pos(instance)
local layout_h = get_layout_h(instance)
local prev_row_bottom = get_previous_row_bottom(instance)
local anchor_x, anchor_y = get_column_position(instance)
win_w, win_h = get_column_size(instance)
local column = instance.columns[instance.column_no]
if row_w == 0 then
row_w = w
end
if row_h == 0 then
row_h = h
end
if x == nil then
if instance.align_x == "center" then
x = max(win_w * 0.5 - row_w * 0.5 + anchor_x, anchor_x)
elseif instance.align_x == "right" then
local right = win_w - row_w
if not Window.is_auto_size() then
right = right + Window.get_border()
end
x = max(right, anchor_x)
else
x = anchor_x
end
end
if y == nil then
if prev_row_bottom ~= nil then
y = prev_row_bottom + Cursor.pad_y()
else
local region_h = win_y + win_h - cursor_y
if instance.align_y == "center" then
y = max(region_h * 0.5 - layout_h * 0.5 + anchor_y, anchor_y)
elseif instance.align_y == "Bottom" then
y = max(win_h - layout_h, anchor_y)
else
y = anchor_y
end
end
end
Cursor.set_x(win_x + x)
Cursor.set_y(win_y + y)
if h < row_h then
if instance.align_row_y == "center" then
Cursor.set_y(win_y + y + row_h * 0.5 - h * 0.5)
elseif instance.align_row_y == "Bottom" then
Cursor.set_y(win_y + y + row_h - h)
end
end
local row_no = column.row_no
if column.rows ~= nil then
local row = column.rows[row_no]
if row ~= nil then
row.cursor_x = x + w + Cursor.pad_x()
row.cursor_y = y
end
end
if column.pending_rows[row_no] == nil then
local row = {
cursor_x = nil,
cursor_y = nil,
w = 0,
h = 0,
request_h = 0,
max_h = 0,
controls = {}
}
insert(column.pending_rows, row)
end
local row = column.pending_rows[row_no]
insert(
row.controls,
{
x = Cursor.get_x(),
y = Cursor.get_y(),
w = w,
h = h,
altered_size = column.altered_size,
t = t
}
)
row.w = row.w + w + Cursor.pad_x()
row.h = max(row.h, h)
column.row_no = row_no + 1
column.altered_size = false
column.w = max(row.w, column.w)
end
end
local function get_instance(id)
local key = Window.get_id() .. "." .. id
if instances[key] == nil then
local instance = {}
instance.id = id
instance.window_id = Window.get_id()
instance.align_x = "left"
instance.align_y = "top"
instance.align_row_y = "top"
instance.ignore = false
instance.expand_w = false
instance.x = 0
instance.y = 0
instance.columns = {}
instance.column_no = 1
instances[key] = instance
end
return instances[key]
end
function LayoutManager.add_control(w, h, t)
if active ~= nil and not active.ignore then
add_control(active, w, h)
end
end
function LayoutManager.compute_size(w, h)
if active ~= nil then
local x, y = get_column_position(active)
local win_w, win_h = get_column_size(active)
local real_w = win_w - x
local real_h = win_h - y
local column = active.columns[active.column_no]
if not active.anchor_x then
real_w = win_w
end
if not active.anchor_y then
real_h = win_h
end
if Window.is_auto_size() then
local layout_h = get_layout_h(active, false)
if layout_h > 0 then
real_h = layout_h
end
end
if active.expand_w then
if column.rows ~= nil then
local count = 0
local reduce_w = 0
local pad = 0
local row = column.rows[column.row_no]
if row ~= nil then
for i, v in ipairs(row.controls) do
if v.altered_size then
count = count + 1
else
reduce_w = reduce_w + v.w
end
end
if #row.controls > 1 then
pad = Cursor.pad_x() * (#row.controls - 1)
end
end
count = max(count, 1)
w = (real_w - reduce_w - pad) / count
end
end
if active.expand_h then
if column.rows ~= nil then
local count = 0
local reduce_h = 0
local pad = 0
local max_row_h = 0
for i, row in ipairs(column.rows) do
local is_size_altered = false
if i == column.row_no then
max_row_h = row.max_h
row.request_h = max(row.request_h, h)
end
for j, control in ipairs(row.controls) do
if control.altered_size then
if not is_size_altered then
count = count + 1
is_size_altered = true
end
end
end
if not is_size_altered then
reduce_h = reduce_h + row.h
end
end
if #column.rows > 1 then
pad = Cursor.pad_y() * (#column.rows - 1)
end
count = max(count, 1)
real_h = max(real_h - reduce_h - pad, 0)
h = max(real_h / count, h)
h = max(h, max_row_h)
end
end
column.altered_size = active.expand_w or active.expand_h
end
return w, h
end
function LayoutManager.begin(id, options)
assert(id ~= nil or type(id) ~= string, "a valid string id must be given to begin_layout!")
options = options == nil and {} or options
options.align_x = options.align_x == nil and "left" or options.align_x
options.align_y = options.align_y == nil and "top" or options.align_y
options.align_row_y = options.align_row_y == nil and "top" or options.align_row_y
options.ignore = options.ignore == nil and false or options.ignore
options.expand_w = options.expand_w == nil and false or options.expand_w
options.expand_h = options.expand_h == nil and false or options.expand_h
options.anchor_x = options.anchor_x == nil and false or options.anchor_x
options.anchor_y = options.anchor_y == nil and true or options.anchor_y
options.columns = options.columns == nil and 1 or options.columns
options.columns = max(options.columns, 1)
local instance = get_instance(id)
instance.align_x = options.align_x
instance.align_y = options.align_y
instance.align_row_y = options.align_row_y
instance.ignore = options.ignore
instance.expand_w = options.expand_w
instance.expand_h = options.expand_h
instance.x, instance.y = Cursor.get_relative_position()
instance.anchor_x = options.anchor_x
instance.anchor_y = options.anchor_y
if options.columns ~= #instance.columns then
instance.columns = {}
for i = 1, options.columns, 1 do
local column = {
rows = nil,
pending_rows = {},
row_no = 1,
w = 0
}
insert(instance.columns, column)
end
end
for i, column in ipairs(instance.columns) do
column.pending_rows = {}
column.row_no = 1
end
insert(stack, 1, instance)
active = instance
end
function LayoutManager.finish()
assert(active ~= nil, "LayoutManager.finish was called without a call to LayoutManager.begin!")
for i, column in ipairs(active.columns) do
local rows = column.rows
column.rows = column.pending_rows
column.pending_rows = nil
if rows ~= nil and column.rows ~= nil and #rows == #column.rows then
for i, v in ipairs(rows) do
column.rows[i].max_h = rows[i].request_h
end
end
end
remove(stack, 1)
active = nil
if #stack > 0 then
active = stack[1]
end
end
function LayoutManager.same_line(cursor_options)
Cursor.same_line(cursor_options)
if active ~= nil then
local column = active.columns[active.column_no]
column.row_no = max(column.row_no - 1, 1)
end
end
function LayoutManager.new_line()
if active ~= nil then
add_control(active, 0, Cursor.get_new_line_size(), "new_line")
end
Cursor.new_line()
end
function LayoutManager.set_column(index)
if active ~= nil then
index = max(index, 1)
index = min(index, #active.columns)
active.column_no = index
end
end
function LayoutManager.get_active_size()
if active ~= nil then
return get_column_size(active)
end
return 0, 0
end
function LayoutManager.validate()
local message = nil
for i, v in ipairs(stack) do
if message == nil then
message = "The following layouts have not had end_layout called:\n"
end
message = message .. "'" .. v.id .. "' in window '" .. v.window_id .. "'\n"
end
assert(message == nil, message)
end
return LayoutManager
|
slot0 = class_C("MotionPath", ClassLoader:aquireClass("MotionController"))
slot0.onCreate = function (slot0, slot1, slot2, slot3)
slot0.super.onCreate(slot0, slot3)
slot0.gameConfig = ClassLoader:aquireSingleton("GameConfig")
if slot0.gameConfig.PLATFORM_ANDROID then
slot0._pathFunc, slot0._pathData = slot0:getPathTrackerByConfig(slot1)
slot0._offset = slot2
if device.platform == "android" then
slot0._timeStep = 0.03
else
slot0._timeStep = 0.016
end
slot0._deltaTime = 0
if slot1.specialAction.size > 0 then
slot0.hasSpecialAction = true
slot0.specialActionConfig = slot1.specialAction
slot0.currentActionIndex = 1
end
else
slot0:addProperty("pathSegments")
slot0:addProperty("pathEnded")
slot0:addProperty("offset")
slot0:setValue("pathSegments", slot1)
slot0:setValue("offset", slot2)
slot0.pathTracker = nil
end
slot0._enabled = true
end
slot0.onEnter = function (slot0, slot1)
slot0.super.onEnter(slot0, slot1)
if not slot0.gameConfig.PLATFORM_ANDROID then
slot0.pathTracker = slot0:getPathTrackerByConfig(slot0.pathSegments._value, slot0.offset._value)
slot0.pathTracker:update(0, 0)
slot0.pathTracker:updateProperty(slot0.position, slot0.direction)
end
slot0:onUpdate(0)
end
slot0.onUpdate = function (slot0, slot1)
if slot0.gameConfig.PLATFORM_ANDROID then
if not slot0._enabled then
slot0._updateDelta = 0
return false
else
slot0._updateDelta = slot1
end
slot6 = 0
slot4, slot5, slot6 = slot0._pathFunc(slot0._pathData, slot4, slot0._timeStep, slot0._deltaTime + slot1, slot0.speed._value, slot0.position._value, slot0.direction._value)
if slot9 > 0 then
slot0.isRemoved:set(not slot0.isDead._value)
else
slot0._distance = slot4
slot0._deltaTime = slot5
slot2.x = slot2.x + slot0._offset.x
slot2.y = slot2.y + slot0._offset.y
slot2.z = slot2.z + slot0._offset.z
end
if slot0.hasSpecialAction and slot0.currentActionIndex <= slot0.specialActionConfig.size and math.abs(slot0.specialActionConfig[slot0.currentActionIndex].distance - slot4) < 10 then
slot0.specialAction:trigger(slot7.actionIndex)
slot0.currentActionIndex = slot0.currentActionIndex + 1
end
else
if not slot0.super.onUpdate(slot0, slot1) then
return
end
if not slot0.pathEnded._value then
if slot0.pathTracker.update(slot2, slot0._updateDelta, slot0.speed._value) > 0 then
slot0.pathEnded:set(true)
end
slot0.position:trigger(slot2._currentPosition)
slot0.direction:trigger(slot2._currentDirection)
else
slot0.isRemoved:set(true)
end
end
end
slot0.getPathTrackerByConfig = function (slot0, slot1, slot2)
if slot0.gameConfig.PLATFORM_ANDROID then
if slot1.type == slot0.gameConfig.PathType.BEZIER then
return PathMath.getBezierRoutePosition, slot1.bezierRoute
elseif slot1.type == slot0.gameConfig.PathType.SPIRAL then
return PathMath.getSpiralRoutePosition, slot1.bezierRoute
end
else
return ClassLoader:aquireSingleton("PathTrackerFactory"):getPathTrackerByConfig(slot1, slot2)
end
end
slot0.on_isDead_changed = function (slot0)
if slot0.isDead._value then
if slot0.deadCause._value ~= "EFFECT_KILL" then
slot0._enabled = false
else
slot0._enabled = true
end
else
slot0._enabled = true
end
end
slot0.on_isRemoved_changed = function (slot0)
slot0._enabled = not slot0.isRemoved._value
end
return slot0
|
-- MODERNGADGETS SETTINGS BACKUP SCRIPT
--
-- This script makes backups of the settings files every two hours, which
-- prevents them from being lost when updating the suite.
debug = false
function Initialize()
dofile(SKIN:GetVariable('scriptPath') .. 'Utilities.lua')
fileNames = { 'GlobalSettings.inc',
'CpuSettings.inc',
'NetworkSettings.inc',
'GpuSettings.inc',
'DisksSettings.inc',
'GPU Variants\\GpuSettings1.inc',
'GPU Variants\\GpuSettings2.inc',
'GPU Variants\\GpuSettings3.inc' }
backupsPath = SKIN:GetVariable('SETTINGSPATH') .. 'ModernGadgetsSettings\\'
filesPath = SKIN:GetVariable('@') .. 'Settings\\'
cpuMeterPath = SKIN:GetVariable('cpuMeterPath')
networkMeterPath = SKIN:GetVariable('networkMeterPath')
gpuMeterPath = SKIN:GetVariable('gpuMeterPathBase')
disksMeterPath = SKIN:GetVariable('disksMeterPath')
end
function Update() end
function ImportBackup()
for i=1, 8 do
local bTable = ReadIni(backupsPath .. fileNames[i])
local sTable = ReadIni(filesPath .. fileNames[i])
CrossCheck(bTable, sTable, filesPath .. fileNames[i])
end
SKIN:Bang('!RefreshGroup', 'MgImportRefresh')
LogHelper('Imported settings backup', 'Notice')
end
function CrossCheck(bTable, sTable, filePath)
for i,v in pairs(bTable) do
if type(v) == 'table' then
for a,b in pairs(v) do
if sTable[i][a] then
SKIN:Bang('!WriteKeyValue', i, a, b, filePath)
else
LogHelper('Key \'' .. a .. '\' does not exist in local', 'Debug')
end
end
end
end
end
function CheckForBackup()
local file = io.open(backupsPath .. fileNames[1])
if file == nil then
SKIN:Bang('!ActivateConfig', 'ModernGadgets\\Config\\GadgetManager', 'Config.ini')
SKIN:Bang('!CommandMeasure', 'MeasureCreateBackup', 'Run')
else
SKIN:Bang('!Hide')
SKIN:Bang('!ShowMeterGroup', 'Essentials')
SKIN:Bang('!ShowMeterGroup', 'ImportBackupPrompt')
SKIN:Bang('!SetOption', 'BackgroundHeightAdjuster', 'Y', 'R')
SKIN:Bang('!UpdateMeter', 'BackgroundHeightAdjuster')
SKIN:Bang('!UpdateMeterGroup', 'Essentials')
SKIN:Bang('!Redraw')
SKIN:Bang('!ShowFade')
file:close()
end
end
-- parses a INI formatted text file into a 'Table[Section][Key] = Value' table
function ReadIni(inputfile)
local file = assert(io.open(inputfile, 'r'), 'Unable to open ' .. inputfile)
local tbl, num, section = {}, 0
for line in file:lines() do
num = num + 1
if not line:match('^%s-;') then
local key, command = line:match('^([^=]+)=(.+)')
if line:match('^%s-%[.+') then
section = line:match('^%s-%[([^%]]+)')
if section == '' or not section then
section = nil
LogHelper('Empty section name found in ' .. inputfile, 'Debug')
end
if not tbl[section] then tbl[section] = {} end
elseif key and command and section then
tbl[section][key:match('^%s*(%S*)%s*$')] = command:match('^%s*(.-)%s*$'):gsub('#(.-)#', '#\*%1\*#')
elseif #line > 0 and section and not key or command then
LogHelper(num .. ': Invalid property or value.', 'Debug')
end
end
end
file:close()
if not section then LogHelper('No sections found in ' .. inputfile, 'Debug') end
return tbl
end |
local INVOICES_DATA_PROVIDER_LAYOUT ={
{
headerTemplate = "AuctionatorStringColumnHeaderTemplate",
headerText = AUCTIONATOR_L_NAME,
headerParameters = { "itemName" },
cellTemplate = "AuctionatorStringCellTemplate",
cellParameters = { "itemNamePretty" },
width = 300,
},
{
headerTemplate = "AuctionatorStringColumnHeaderTemplate",
headerText = JOURNALATOR_L_IN_INCLUDING_AH_CUT,
headerParameters = { "moneyIn" },
cellTemplate = "JournalatorPriceCellTemplate",
cellParameters = { "moneyIn" },
width = 150,
},
{
headerTemplate = "AuctionatorStringColumnHeaderTemplate",
headerText = JOURNALATOR_L_OUT,
headerParameters = { "moneyOut" },
cellTemplate = "JournalatorPriceCellTemplate",
cellParameters = { "moneyOut" },
width = 150,
},
{
headerTemplate = "AuctionatorStringColumnHeaderTemplate",
headerText = AUCTIONATOR_L_UNIT_PRICE,
headerParameters = { "unitPrice" },
cellTemplate = "AuctionatorPriceCellTemplate",
cellParameters = { "unitPrice" },
width = 150,
},
{
headerTemplate = "AuctionatorStringColumnHeaderTemplate",
headerText = JOURNALATOR_L_PLAYER,
headerParameters = { "otherPlayer" },
cellTemplate = "AuctionatorStringCellTemplate",
cellParameters = { "otherPlayer" }
},
{
headerTemplate = "AuctionatorStringColumnHeaderTemplate",
headerText = JOURNALATOR_L_SOURCE,
headerParameters = { "sourceCharacter" },
cellTemplate = "AuctionatorStringCellTemplate",
cellParameters = { "sourceCharacter" },
defaultHide = true,
},
{
headerTemplate = "AuctionatorStringColumnHeaderTemplate",
headerText = AUCTIONATOR_L_QUANTITY,
headerParameters = { "count" },
cellTemplate = "AuctionatorStringCellTemplate",
cellParameters = { "count" },
width = 100
},
{
headerTemplate = "AuctionatorStringColumnHeaderTemplate",
headerText = JOURNALATOR_L_TIME_ELAPSED,
headerParameters = { "rawDay" },
cellTemplate = "AuctionatorStringCellTemplate",
cellParameters = { "date" }
},
}
JournalatorInvoicesDataProviderMixin = CreateFromMixins(JournalatorDisplayDataProviderMixin)
function JournalatorInvoicesDataProviderMixin:Refresh()
self:Reset()
local results = {}
for _, item in ipairs(Journalator.Archiving.GetRange(self:GetTimeForRange(), "Invoices")) do
if self:Filter(item) then
local moneyIn = 0
local moneyOut = 0
if item.invoiceType == "seller" then
moneyIn = item.value + item.deposit - item.consignment
else
moneyOut = -item.value
end
local timeSinceEntry = time() - item.time
local itemNamePretty = item.itemName
local itemLink = item.itemLink or Journalator.GetItemInfo(item.itemName, item.deposit, item.count)
if itemLink then
itemNamePretty = Journalator.ApplyQualityColor(item.itemName, itemLink)
end
local otherPlayer = Journalator.Utilities.AddRealmToPlayerName(item.playerName, item.source)
if otherPlayer == nil then
if item.invoiceType == "seller" then
otherPlayer = GRAY_FONT_COLOR:WrapTextInColorCode(JOURNALATOR_L_MULTIPLE_BUYERS)
else
otherPlayer = GRAY_FONT_COLOR:WrapTextInColorCode(JOURNALATOR_L_MULTIPLE_SELLERS)
end
end
local sourceCharacter = Journalator.Utilities.AddRealmToPlayerName(item.source.character, item.source)
table.insert(results, {
itemName = item.itemName,
itemNamePretty = itemNamePretty,
moneyIn = moneyIn,
moneyOut = moneyOut,
count = item.count,
unitPrice = math.floor(item.value/item.count),
rawDay = item.time,
date = SecondsToTime(timeSinceEntry),
otherPlayer = otherPlayer,
sourceCharacter = sourceCharacter,
itemLink = itemLink,
})
end
end
self:AppendEntries(results, true)
end
function JournalatorInvoicesDataProviderMixin:GetTableLayout()
return INVOICES_DATA_PROVIDER_LAYOUT
end
local COMPARATORS = {
itemName = Auctionator.Utilities.StringComparator,
invoiceType = Auctionator.Utilities.StringComparator,
moneyIn = Auctionator.Utilities.NumberComparator,
moneyOut = Auctionator.Utilities.NumberComparator,
unitPrice = Auctionator.Utilities.NumberComparator,
count = Auctionator.Utilities.NumberComparator,
rawDay = Auctionator.Utilities.NumberComparator,
otherPlayer = Auctionator.Utilities.StringComparator,
}
function JournalatorInvoicesDataProviderMixin:Sort(fieldName, sortDirection)
local comparator = COMPARATORS[fieldName](sortDirection, fieldName)
table.sort(self.results, function(left, right)
return comparator(left, right)
end)
self:SetDirty()
end
Auctionator.Config.Create("JOURNALATOR_COLUMNS_INVOICES", "journalator_columns_invoices", {})
function JournalatorInvoicesDataProviderMixin:GetColumnHideStates()
return Auctionator.Config.Get(Auctionator.Config.Options.JOURNALATOR_COLUMNS_INVOICES)
end
|
vt = voxtrees
vr = voxrnd
vs = voxsdl
function init (ctx)
--[[
Build tree from a raw file 'skull.dat' in voxvision's system-wide data directory.
read_raw_data_ranged() is like faster read_raw_data() with test function checking
min <= sample < max (in current example sample >= 40)
]]--
print (ctx:get_geometry())
local tree = vt.read_raw_data_ranged (vt.find_data_file "skull.dat", {256,256,256}, 1, 40)
print (#tree)
local camera = vr.camera "simple-camera"
camera.position = {100,60,-100}
camera.rotation = {1.4, 0, 0}
-- Also create a collision detector
local cd = vr.cd()
-- Attach the context and your camera. 4 is the camera's body radius
cd:attach_camera (camera, 4)
cd:attach_context (ctx)
-- Do not forget to add collision detector to the context to prevent GC'ing.
ctx.tree = tree
ctx.camera = camera
ctx.cd = cd
-- This example creates FPS controller which limits frames per second amount by 60.
ctx.fps_controller = vr.fps_controller (60)
ctx.fps_restricted = true
end
function tick (world, time)
local event, quit
for event in vs.pollEvent() do
if event.type == vs.event.KeyDown and event.keysym.sym == vs.key.Escape then
quit = true
elseif event.type == vs.event.Quit then
quit = true
elseif event.type == vs.event.KeyDown and event.keysym.sym == vs.key.f then
-- Toggle FPS control
if world.fps_restricted == true then
world.fps_controller = vr.fps_controller (0)
world.fps_restricted = nil
else
world.fps_controller = vr.fps_controller (60)
world.fps_restricted = true
end
end
end
if quit then return nil end
-- Get keyboard state
local keystate = vs.getKeyboardState()
previous_time = previous_time or time
local framedelta = time - previous_time
--[[
This is keyboard events processing code. 'voxutils' module has a function
`process_keyboard_movement` to process basic keyboard movement in one line
of code. It can be called so:
process_keyboard_movement (context, keystate, mdelta, controls).
mdelta is delta for move_camera method. Control keys can be redefined in
'controls' table (see source code). Also it calls world.cd:collide() after
the camera was moved.
]]--
-- Also 'framedelta' contains time in milliseconds taken to render previous frame
voxutils.process_keyboard_movement (world, keystate, 0.25*framedelta)
-- This is how mouse movement is handeled
local mask, x, y = vs.getRelativeMouseState()
local rot = {-y*0.0005*framedelta, 0, -x*0.0005*framedelta}
world.camera:rotate_camera (rot)
previous_time = time
--[[
Delay method of FPS controller must be called once somewhere in tick() function.
It returns actual FPS value which is updated once per second. When it is updated,
update flag (true) is returned as the second value.
]]--
local fps, upd = world.fps_controller:delay ()
if upd then
print (fps)
end
return true
end
|
--- Snackbars provide lightweight feedback on an operation
-- at the base of the screen. They automatically disappear
-- after a timeout or user interaction. There can only be
-- one on the screen at a time.
-- @classmod Snackbar
local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore"))
local qGUI = require("qGUI")
local Maid = require("Maid")
local qMath = require("qMath")
-- Base clase, not functional
local Snackbar = {}
Snackbar.ClassName = "Snackbar"
Snackbar.__index = Snackbar
Snackbar.Height = 48
Snackbar.MinimumWidth = 288 -- Taken from google material design
Snackbar.MaximumWidth = 700
Snackbar.TextWidthOffset = 24
Snackbar.Position = UDim2.new(1, -10, 1, -10 - Snackbar.Height)
Snackbar.FadeTime = 0.16
Snackbar.CornerRadius = 2--24
function Snackbar.new(Parent, Text, Options)
local self = setmetatable({}, Snackbar)
local Gui = Instance.new("ImageButton")
Gui.ZIndex = 7
Gui.Name = "Snackbar"
Gui.Size = UDim2.new(0, 100, 0, self.Height)
Gui.BorderSizePixel = 0
Gui.BackgroundColor3 = Color3.new(0.196, 0.196, 0.196) -- Google design specifications
Gui.Archivable = false
Gui.ClipsDescendants = false
Gui.Position = self.Position
Gui.AutoButtonColor = false
Gui.BackgroundTransparency = 1
self.Gui = Gui
self.BackgroundImages = {qGUI.BackWithRoundedRectangle(Gui, self.CornerRadius, Gui.BackgroundColor3)}
local ShadowRadius = 1
local ShadowContainer = Instance.new("Frame")
ShadowContainer.AnchorPoint = Vector2.new(0.5, 0.5)
ShadowContainer.Parent = Gui
ShadowContainer.Name = "ShadowContainer"
ShadowContainer.BackgroundTransparency = 1
ShadowContainer.Size = UDim2.new(1, ShadowRadius*2, 1, ShadowRadius*2)
ShadowContainer.Archivable = false
ShadowContainer.Position = UDim2.new(0.5, 0, 0.5, 0)
--- Image is blurred at
self.ShadowImages = {
qGUI.AddNinePatch(ShadowContainer, "rbxassetid://191838004",
Vector2.new(150, 150),
self.CornerRadius + ShadowRadius,
"ImageLabel"
)
}
for _, Item in pairs(self.ShadowImages) do
Item.ImageTransparency = 0.74
Item.ZIndex = Gui.ZIndex - 2
end
for _, Item in pairs(self.BackgroundImages) do
Item.ZIndex = Gui.ZIndex - 1
end
local TextLabel = Instance.new("TextLabel")
TextLabel.Size = UDim2.new(1, -self.TextWidthOffset*2, 0, 16)
TextLabel.Position = UDim2.new(0, self.TextWidthOffset, 0, 16)
TextLabel.TextXAlignment = Enum.TextXAlignment.Left
TextLabel.TextYAlignment = Enum.TextYAlignment.Center
TextLabel.Name = "SnackbarLabel"
TextLabel.TextTransparency = 0.87
TextLabel.TextColor3 = Color3.new(1, 1, 1)
TextLabel.BackgroundTransparency = 1
TextLabel.BorderSizePixel = 0
TextLabel.Font = Enum.Font.SourceSans
TextLabel.Text = Text
TextLabel.FontSize = Enum.FontSize.Size18
TextLabel.ZIndex = Gui.ZIndex-1
TextLabel.Parent = Gui
self._textLabel = TextLabel
self._whileActiveMaid = Maid.new()
self.Gui.Parent = Parent
local CallToActionText
if Options and Options.CallToAction then
if type(Options.CallToAction) == "string" then
CallToActionText = Options.CallToAction
else
CallToActionText = tostring(Options.CallToAction.Text)
end
CallToActionText = CallToActionText:upper()
local DefaultTextColor3 = Color3.fromRGB(78, 205, 196)
local button = Instance.new("TextButton")
button.Name = "CallToActionButton"
button.AnchorPoint = Vector2.new(1, 0.5)
button.BackgroundTransparency = 1
button.Position = UDim2.new(1, -self.TextWidthOffset, 0.5, 0)
button.Size = UDim2.new(0.5, 0, 0.8, 0)
button.Text = CallToActionText
button.Font = Enum.Font.SourceSans
button.FontSize = TextLabel.FontSize
button.TextXAlignment = Enum.TextXAlignment.Right
button.TextColor3 = DefaultTextColor3
button.ZIndex = Gui.ZIndex
button.Parent = Gui
-- Resize
button.Size = UDim2.new(UDim.new(0, button.TextBounds.X), button.Size.Y)
self._whileActiveMaid:GiveTask(button.MouseButton1Click:Connect(function()
if Options.CallToAction.OnClick then
self:Dismiss()
Options.CallToAction.OnClick()
end
end))
self._whileActiveMaid:GiveTask(button.MouseEnter:Connect(function()
button.TextColor3 = DefaultTextColor3:lerp(Color3.new(0, 0, 0), 0.2)
end))
self._whileActiveMaid:GiveTask(button.MouseLeave:Connect(function()
button.TextColor3 = DefaultTextColor3
end))
self._callToActionButton = button
end
local Width = self._textLabel.TextBounds.X + self.TextWidthOffset*2
if self._callToActionButton then
Width = Width + self._callToActionButton.Size.X.Offset + self.TextWidthOffset*2
end
if Width < self.MinimumWidth then
Width = self.MinimumWidth
elseif Width > self.MaximumWidth then
Width = self.MaximumWidth
end
if CallToActionText then
self._textLabel.Text = Text
end
self.Gui.Size = UDim2.new(0, Width, 0, self.Height)
self.Position = self.Position + UDim2.new(0, -Width, 0, 0)
self.Gui.Position = self.Position
self.AbsolutePosition = self.Gui.AbsolutePosition
return self
end
function Snackbar:Dismiss()
error("Not implemented")
end
function Snackbar:SetBackgroundTransparency(Transparency)
for _, Item in pairs(self.BackgroundImages) do
Item.ImageTransparency = Transparency
end
for _, Item in pairs(self.ShadowImages) do
Item.ImageTransparency = qMath.MapNumber(Transparency, 0, 1, 0.74, 1)
end
end
function Snackbar:FadeOutTransparency(PercentFaded)
if PercentFaded then
self:SetBackgroundTransparency(qMath.MapNumber(PercentFaded, 0, 1, 0, 1))
self._textLabel.TextTransparency = qMath.MapNumber(PercentFaded, 0, 1, 0.13, 1)
if self._callToActionButton then
self._callToActionButton.TextTransparency = PercentFaded
end
else
local NewProperties = {
ImageTransparency = 1;
}
for _, Item in pairs(self.BackgroundImages) do
qGUI.TweenTransparency(Item, NewProperties, self.FadeTime, true)
end
for _, Item in pairs(self.ShadowImages) do
qGUI.TweenTransparency(Item, NewProperties, self.FadeTime, true)
end
qGUI.TweenTransparency(self._textLabel, {
TextTransparency = 1;
}, self.FadeTime, true)
if self._callToActionButton then
qGUI.TweenTransparency(self._callToActionButton, {
TextTransparency = 1;
}, self.FadeTime, true)
end
end
end
--- Will animate unless given PercentFaded
function Snackbar:FadeInTransparency(PercentFaded)
if PercentFaded then
-- self.Gui.BackgroundTransparency = qMath.MapNumber(PercentFaded, 0, 1, 1, 0)
self:SetBackgroundTransparency(qMath.MapNumber(PercentFaded, 0, 1, 1, 0))
self._textLabel.TextTransparency = qMath.MapNumber(PercentFaded, 0, 1, 1, 0.13)
if self._callToActionButton then
self._callToActionButton.TextTransparency = PercentFaded
end
else
-- Should be an ease-in-out transparency fade.
do
local NewProperties = {
ImageTransparency = 0;
}
for _, Item in pairs(self.BackgroundImages) do
qGUI.TweenTransparency(Item, NewProperties, self.FadeTime, true)
end
end
do
local NewProperties = {
ImageTransparency = 0.74;
}
for _, Item in pairs(self.ShadowImages) do
qGUI.TweenTransparency(Item, NewProperties, self.FadeTime, true)
end
end
qGUI.TweenTransparency(self._textLabel, {
TextTransparency = 0.13;
}, self.FadeTime, true)
if self._callToActionButton then
qGUI.TweenTransparency(self._callToActionButton, {
TextTransparency = 0;
}, self.FadeTime, true)
end
end
end
-- Utility function
function Snackbar:FadeHandler(NewPosition, DoNotAnimate, IsFadingOut)
assert(NewPosition, "[Snackbar] - Internal function should not have been called. Missing NewPosition")
if IsFadingOut then
self:FadeOutTransparency(DoNotAnimate and 1 or nil)
else
self:FadeInTransparency(DoNotAnimate and 1 or nil)
end
if DoNotAnimate then
self.Gui.Position = NewPosition
else
self.Gui:TweenPosition(NewPosition, "InOut", "Quad", self.FadeTime, true)
end
end
function Snackbar:FadeOutUp(DoNotAnimate)
local NewPosition = self.Position + UDim2.new(0, 0, 0, -self.Gui.AbsoluteSize.Y)
self:FadeHandler(NewPosition, DoNotAnimate, true)
end
function Snackbar:FadeOutDown(DoNotAnimate)
local NewPosition = self.Position + UDim2.new(0, 0, 0, self.Gui.AbsoluteSize.Y)
self:FadeHandler(NewPosition, DoNotAnimate, true)
end
function Snackbar:FadeOutRight(DoNotAnimate)
local NewPosition = self.Position + UDim2.new(0, self.Gui.AbsoluteSize.X, 0, 0)
self:FadeHandler(NewPosition, DoNotAnimate, true)
end
function Snackbar:FadeOutLeft(DoNotAnimate)
local NewPosition = self.Position + UDim2.new(0, -self.Gui.AbsoluteSize.X, 0, 0)
self:FadeHandler(NewPosition, DoNotAnimate, true)
end
function Snackbar:FadeIn(DoNotAnimate)
self:FadeHandler(self.Position, DoNotAnimate, false)
end
return Snackbar |
-- Neuron is a World of Warcraft® user interface addon.
-- Copyright (c) 2017-2021 Britt W. Yazel
-- Copyright (c) 2006-2014 Connor H. Chenoweth
-- This code is licensed under the MIT license (see LICENSE for details)
local DB
local L = LibStub("AceLocale-3.0"):GetLocale("Neuron")
function Neuron:Startup()
DB = Neuron.db.profile
Neuron:RegisterBars()
Neuron:RegisterGUI()
Neuron:CreateBarsAndButtons()
end
function Neuron:RegisterBars()
--Neuron Action Bar
Neuron:RegisterBarClass("ActionBar", "ActionBar", L["Action Bar"], "Action Button", DB.ActionBar, Neuron.ACTIONBUTTON, 250, true)
--Neuron Bag Bar
Neuron:RegisterBarClass("BagBar", "BagBar", L["Bag Bar"], "Bag Button", DB.BagBar, Neuron.BAGBTN, Neuron.NUM_BAG_BUTTONS, false) --Neuron.NUM_BAG_BUTTONS == 5 for retail and 6 for classic due to the keyring
--Neuron Status Bar
Neuron:RegisterBarClass("StatusBar", "StatusBar", L["Status Bar"], "Status Bar", DB.StatusBar, Neuron.STATUSBTN, 20, false)
--Neuron Menu Bar
Neuron:RegisterBarClass("MenuBar", "MenuBar", L["Menu Bar"], "Menu Button", DB.MenuBar, Neuron.MENUBTN, 11, false)
--Neuron Pet Bar
Neuron:RegisterBarClass("PetBar", "PetBar", L["Pet Bar"], "Pet Button", DB.PetBar, Neuron.PETBTN, 10, true)
if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then
--Neuron Zone Ability Bar
Neuron:RegisterBarClass("ZoneAbilityBar", "ZoneAbilityBar", L["Zone Action Bar"], "Zone Action Button", DB.ZoneAbilityBar, Neuron.ZONEABILITYBTN, 5, true)
--Neuron Extra Bar
Neuron:RegisterBarClass("ExtraBar", "ExtraBar", L["Extra Action Bar"], "Extra Action Button", DB.ExtraBar, Neuron.EXTRABTN,1, true)
--Neuron Exit Bar
Neuron:RegisterBarClass("ExitBar", "ExitBar", L["Vehicle Exit Bar"], "Vehicle Exit Button", DB.ExitBar, Neuron.EXITBTN,1, false)
end
end
function Neuron:RegisterGUI()
--Neuron Action Bar
Neuron:RegisterGUIOptions("ActionBar", {
AUTOHIDE = true,
SHOWGRID = true,
SPELLGLOW = true,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
MULTISPEC = true,
HIDDEN = true,
LOCKBAR = true,
TOOLTIPS = true,
BINDTEXT = true,
MACROTEXT = true,
COUNTTEXT = true,
RANGEIND = true,
CDTEXT = true,
CDALPHA = true, },
true, 115)
--Neuron Bag Bar
Neuron:RegisterGUIOptions("BagBar", {
AUTOHIDE = true,
SHOWGRID = false,
SPELLGLOW = false,
SNAPTO = true,
MULTISPEC = false,
HIDDEN = true,
LOCKBAR = false,
TOOLTIPS = true, },
false, false)
--Neuron Status Bar
Neuron:RegisterGUIOptions("StatusBar", {
AUTOHIDE = true,
SNAPTO = true,
HIDDEN = true,
TOOLTIPS = true },
false, false)
--Neuron Menu Bar
Neuron:RegisterGUIOptions("MenuBar", {
AUTOHIDE = true,
SHOWGRID = false,
SPELLGLOW = false,
SNAPTO = true,
MULTISPEC = false,
HIDDEN = true,
LOCKBAR = false,
TOOLTIPS = true },
false, false)
--Neuron Pet Bar
Neuron:RegisterGUIOptions("PetBar", {
AUTOHIDE = true,
SHOWGRID = false,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
HIDDEN = true,
LOCKBAR = true,
TOOLTIPS = true,
BINDTEXT = true,
RANGEIND = true,
CDTEXT = true,
CDALPHA = true },
false, 65)
if not Neuron.isWoWClassic and not Neuron.isWoWClassic_TBC then
--Neuron Zone Ability Bar
Neuron:RegisterGUIOptions("ZoneAbilityBar", {
AUTOHIDE = true,
SHOWGRID = false,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
HIDDEN = true,
LOCKBAR = false,
TOOLTIPS = true,
BINDTEXT = true,
COUNTTEXT = true,
CDTEXT = true,
CDALPHA = true,
BORDERSTYLE = true,},
false, 65)
--Neuron Extra Bar
Neuron:RegisterGUIOptions("ExtraBar", {
AUTOHIDE = true,
SHOWGRID = false,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
HIDDEN = true,
LOCKBAR = false,
TOOLTIPS = true,
BINDTEXT = true,
COUNTTEXT = true,
CDTEXT = true,
CDALPHA = true,
BORDERSTYLE = true,},
false, 65)
--Neuron Exit Bar
Neuron:RegisterGUIOptions("ExitBar", {
AUTOHIDE = true,
SHOWGRID = false,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
HIDDEN = true,
LOCKBAR = false, },
false, 65)
end
end
function Neuron:CreateBarsAndButtons()
if DB.firstRun then
for barClass, barDefaults in pairs(Neuron.DefaultBarOptions) do
if Neuron.registeredBarData[barClass] then --only build default bars for registered bars types (Classic doesn't use all the bar types that Retail does)
for i, defaults in ipairs(barDefaults) do --create the bar objects
local newBar = Neuron.BAR.new(barClass, i) --this calls the bar constructor
--create the default button objects for a given bar with the default values
newBar:SetDefaults(defaults)
for buttonID=1,#defaults.buttons do
newBar.objTemplate.new(newBar, buttonID, defaults.buttons[buttonID]) --newBar.objTemplate is something like ACTIONBUTTON or EXTRABTN, we just need to code it agnostic
end
end
end
end
DB.firstRun = false
else
for barClass, barClassData in pairs (Neuron.registeredBarData) do
for id,data in pairs(barClassData.barDB) do
if data ~= nil then
local newBar = Neuron.BAR.new(barClass, id) --this calls the bar constructor
--create all the saved button objects for a given bar
for buttonID=1,#newBar.DB.buttons do
newBar.objTemplate.new(newBar, buttonID) --newBar.objTemplate is something like ACTIONBUTTON or EXTRABTN, we just need to code it agnostic
end
end
end
end
end
end |
local lang = {
police = "Salário Policia Militar: R${1}",
--zero = "",
emergency = "Salário Samu: R${1}",
taxi = "Salário adicional: R${1}",
repair = "Salário adicional: R${1}",
delivery = "Salário adicional R${1}",
bankdriver = "Salário adicional R${1}",
player = "Benefícios de desempregado: R${1}"
}
return lang
|
local present, twilight = pcall(require, "twilight")
if not present then
return
end
local config = {
dimming = {
alpha = 0.2,
color = { "Normal", "#ffffff" },
inactive = true,
},
context = 1,
treesitter = true,
expand = {
"function",
"method",
"table",
"if_statement",
},
exclude = {},
}
twilight.setup(config)
|
local KefuView = {}
function KefuView:initialize()
end
function KefuView:layout()
self.MainPanel = self.ui:getChildByName('MainPanel')
self.MainPanel:setPosition(display.cx,display.cy)
local black = self.ui:getChildByName('black')
black:setContentSize(cc.size(display.width,display.height))
local sc = cc.ScaleTo:create(0.1,1.0)
self.MainPanel:setScale(0.1)
self.MainPanel:runAction(sc)
end
function KefuView:fresh(msg)
local content = self.MainPanel:getChildByName('content')
content:setString(msg.content)
end
return KefuView
|
--[[
This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:28' using the latest game version.
NOTE: This file should only be used as IDE support; it should NOT be distributed with addons!
****************************************************************************
CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC.
****************************************************************************
]]
--Particle System
ZO_ParticleSystem = ZO_Object:Subclass()
ZO_ParticleSystem.particleClassToPool = {}
function ZO_ParticleSystem:New(...)
local obj = ZO_Object.New(self)
obj:Initialize(...)
return obj
end
function ZO_ParticleSystem:Initialize(particleClass)
if not ZO_ParticleSystem.particleClassToPool[particleClass] then
local Factory = function()
return particleClass:New()
end
local Reset = function(particle)
particle:Stop()
end
local pool = ZO_ObjectPool:New(Factory, Reset)
ZO_ParticleSystem.particleClassToPool[particleClass] = pool
end
self.particlePool = ZO_MetaPool:New(ZO_ParticleSystem.particleClassToPool[particleClass])
self.parameters = {}
self:SetParticlesPerSecond(0)
self.startPrimeS = 0
end
function ZO_ParticleSystem:SetDuration(durationS)
self.durationS = durationS
end
function ZO_ParticleSystem:SetStartPrimeS(primeS)
self.startPrimeS = primeS
end
function ZO_ParticleSystem:SetParticlesPerSecond(particlesPerSecond)
self.particlesPerSecond = particlesPerSecond
if particlesPerSecond > 0 then
self.secondsBetweenParticles = 1 / particlesPerSecond
else
self.secondsBetweenParticles = nil
end
end
function ZO_ParticleSystem:SetBurst(numParticles, durationS, phaseS, cycleDurationS)
self.burstNumParticles = numParticles
self.burstDurationS = durationS
self.burstPhaseS = phaseS
self.burstCycleDurationS = cycleDurationS
end
function ZO_ParticleSystem:IsBurstMode()
return self.burstNumParticles ~= nil
end
function ZO_ParticleSystem:SetBurstEasing(easingFunction)
self.burstEasingFunction = easingFunction
end
function ZO_ParticleSystem:SetParentControl(parentControl)
self.parentControl = parentControl
end
--This is the sound that will play on start, or on each burst if it's a burst system
function ZO_ParticleSystem:SetSound(sound)
self.sound = sound
end
function ZO_ParticleSystem:SetOnParticleStartCallback(callback)
self.onParticleStartCallback = callback
end
function ZO_ParticleSystem:SetOnParticleStopCallback(callback)
self.onParticleStopCallback = callback
end
--This function takes N parameter names and one value generator. The result of the value generator will be applied to the
--named parameters when the particle is created. A simple example is, SetParticleParameter("alpha", ZO_UniformRangeGenerator:New(0, 1)).
--This would set the parameter "alpha" to a random value between 0 and 1 on creation. For a more complex example,
--SetParticleParameter("x", "y", "z", ZO_RandomSpherePoint:New(10)). This would generate a random point on a sphere of size 10 and then
--set each of "x", "y", and "z" on the particle. This allows for one generator to produce multiple linked values. You can also use a direct
--value instead of using a generator class if you just want to use the value always. For example, SetParticle("scale", 1.5).
function ZO_ParticleSystem:SetParticleParameter(...)
local numArguments = select("#", ...)
if numArguments >= 2 then
--See if we already have a generator for these parameter names. We assume that they won't do something like setting generators for
--both "x" and "x" , "y".
local existingKey
for parameterNames, _ in pairs(self.parameters) do
local match = true
for i = 1, numArguments - 1 do
local name = select(i, ...)
if parameterNames[i] ~= name then
match = false
break
end
end
if match then
existingKey = parameterNames
break
end
end
local parameterNames
if existingKey then
parameterNames = existingKey
else
parameterNames = {}
for i = 1, numArguments - 1 do
local name = select(i, ...)
table.insert(parameterNames, name)
end
end
local valueGenerator = select(numArguments, ...)
self.parameters[parameterNames] = valueGenerator
end
end
function ZO_ParticleSystem:Start()
if not self.running then
PARTICLE_SYSTEM_MANAGER:AddParticleSystem(self)
-- With priming, we pretend like the system had started some time ago and let the system play catch up
-- This allows for situations like an emitter seeming like it had already been emitting before we ever showed the scene,
-- so that the player doesn't see it filling out in the beginning
self.startTimeS = GetGameTimeSeconds() - self.startPrimeS
self.lastUpdateS = self.startTimeS
self.unusedDeltaS = self.startPrimeS
self.running = true
self.finishing = false
if not self:IsBurstMode() then
PlaySound(self.sound)
end
else
self.finishing = false
end
end
function ZO_ParticleSystem:SpawnParticles(numParticlesToSpawn, startTimeS, endTimeS, intervalS)
if numParticlesToSpawn == 0 then
return
end
local MAX_PARTICLES_TO_SPAWN_PER_FRAME = 300
numParticlesToSpawn = zo_min(numParticlesToSpawn, MAX_PARTICLES_TO_SPAWN_PER_FRAME)
if not intervalS then
intervalS = (endTimeS - startTimeS) / numParticlesToSpawn
end
local nowS = GetGameTimeSeconds()
local particleSpawnTimeS = startTimeS + intervalS
for particleSpawnIndex = 1, numParticlesToSpawn do
local particle, key = self.particlePool:AcquireObject()
particle:ResetParameters()
particle:SetKey(key)
local isParticleAlreadyDead = false
-- This is the prime for the individual particle, not for the system
local spawnTimePrimeS = 0
for parameterNames, valueGenerator in pairs(self.parameters) do
local valueGeneratorIsObject = type(valueGenerator) == "table" and valueGenerator.GetValue ~= nil
if valueGeneratorIsObject then
valueGenerator:Generate()
end
for i, parameterName in ipairs(parameterNames) do
if parameterName == "DurationS" then
local durationS = valueGeneratorIsObject and valueGenerator:GetValue(i) or valueGenerator
if particleSpawnTimeS + durationS < nowS then
-- Don't bother starting up a particle that's effectively already dead
isParticleAlreadyDead = true
break
end
elseif parameterName == "PrimeS" then
spawnTimePrimeS = valueGeneratorIsObject and valueGenerator:GetValue(i) or valueGenerator
end
if valueGeneratorIsObject then
particle:SetParameter(parameterName, valueGenerator:GetValue(i))
else
particle:SetParameter(parameterName, valueGenerator)
end
end
end
if isParticleAlreadyDead then
self.particlePool:ReleaseObject(key)
else
self:StartParticle(particle, particleSpawnTimeS - spawnTimePrimeS, nowS)
end
particleSpawnTimeS = particleSpawnTimeS + intervalS
end
end
function ZO_ParticleSystem:StartParticle(particle, startTimeS, nowS)
particle:Start(self.parentControl, startTimeS, nowS)
if self.onParticleStartCallback then
self.onParticleStartCallback(particle)
end
end
function ZO_ParticleSystem:StopParticle(particle)
if self.onParticleStopCallback then
self.onParticleStopCallback(particle)
end
self.particlePool:ReleaseObject(particle:GetKey())
end
do
local g_removeParticles = {}
function ZO_ParticleSystem:OnUpdate(timeS)
local deltaS = timeS - self.lastUpdateS
local durationS = self.durationS
if durationS then
if timeS - self.startTimeS > durationS then
self:Finish()
end
end
if self.finishing then
if not next(self.particlePool:GetActiveObjects()) then
self:Stop()
end
else
--Spawn New Particles
if self:IsBurstMode() then
local elapsedTimeS = timeS - self.startTimeS
if elapsedTimeS > 0 then
local lastElapsedUpdateTimeS = self.lastUpdateS - self.startTimeS
-- How far into the current cycle are we?
local timeInCycleS = elapsedTimeS % self.burstCycleDurationS
-- When did the current cycle begin?
local timeCycleStartedS = timeS - timeInCycleS
-- New burst
if self.lastUpdateS <= timeCycleStartedS then
self.burstNumSpawned = 0
self.burstStartTimeS = timeCycleStartedS + self.burstPhaseS
self.burstStopTimeS = self.burstStartTimeS + self.burstDurationS
end
--We're after when we would have started emitting, and we haven't emitted enough particles
if self.burstNumSpawned < self.burstNumParticles and timeInCycleS > self.burstPhaseS then
local progress = 1
if timeS < self.burstStopTimeS then
progress = (timeS - self.burstStartTimeS) / self.burstDurationS
end
if self.burstEasingFunction then
progress = self.burstEasingFunction(progress)
end
local numParticlesThatShouldBeSpawned = zo_round(progress * self.burstNumParticles)
local numParticlesToSpawn = numParticlesThatShouldBeSpawned - self.burstNumSpawned
--Play the sound the first time particles start bursting
if self.burstNumSpawned == 0 and numParticlesToSpawn > 0 then
PlaySound(self.sound)
end
self.burstNumSpawned = numParticlesThatShouldBeSpawned
local startTimeS = zo_max(self.lastUpdateS, self.burstStartTimeS)
local endTimeS = zo_min(timeS, self.burstStopTimeS)
self:SpawnParticles(numParticlesToSpawn, startTimeS, endTimeS)
end
end
elseif self.particlesPerSecond > 0 then
local secondsSinceLastParticle = deltaS + self.unusedDeltaS
local numParticlesToSpawn = zo_floor(secondsSinceLastParticle / self.secondsBetweenParticles)
--Any "partial" particles that are left over we store off as unused delta time and then add that into the next update.
local processedDeltaS = numParticlesToSpawn * self.secondsBetweenParticles
self.unusedDeltaS = secondsSinceLastParticle - processedDeltaS
self:SpawnParticles(numParticlesToSpawn, timeS - secondsSinceLastParticle, timeS, self.secondsBetweenParticles)
end
end
--Update Particles
for _, particle in pairs(self.particlePool:GetActiveObjects()) do
if particle:IsDone(timeS) then
table.insert(g_removeParticles, particle)
else
particle:OnUpdate(timeS)
end
end
--Remove Dead Particles
if #g_removeParticles then
for _, particle in ipairs(g_removeParticles) do
self:StopParticle(particle)
end
ZO_ClearNumericallyIndexedTable(g_removeParticles)
end
self.lastUpdateS = timeS
end
end
--Stop and kill all particles
function ZO_ParticleSystem:Stop()
if self.running then
PARTICLE_SYSTEM_MANAGER:RemoveParticleSystem(self)
self.particlePool:ReleaseAllObjects()
self.running = false
self.finishing = false
end
end
--Stop making new particles but let existing particles finish
function ZO_ParticleSystem:Finish()
if self.running then
self.finishing = true
end
end
--Scene Graph Particle System
ZO_SceneGraphParticleSystem = ZO_ParticleSystem:Subclass()
function ZO_SceneGraphParticleSystem:New(...)
return ZO_ParticleSystem.New(self, ...)
end
function ZO_SceneGraphParticleSystem:Initialize(particleClass, parentNode)
ZO_ParticleSystem.Initialize(self, particleClass)
self.parentNode = parentNode
end
function ZO_SceneGraphParticleSystem:StartParticle(particle, startTimeS, nowS)
particle:SetParentNode(self.parentNode)
ZO_ParticleSystem.StartParticle(self, particle, startTimeS, nowS)
end
--Control Particle System
ZO_ControlParticleSystem = ZO_ParticleSystem
--Particle System Manager
ZO_ParticleSystemManager = ZO_Object:Subclass()
function ZO_ParticleSystemManager:New(...)
local obj = ZO_Object.New(self)
obj:Initialize(...)
return obj
end
function ZO_ParticleSystemManager:Initialize()
self.texturePool = ZO_ControlPool:New("ZO_ParticleTexture", nil, "ZO_ParticleTexture")
self.animationTimelinePool = ZO_AnimationPool:New("ZO_ParticleAnimationTimeline")
self.buildingAnimationTimelinePlaybackTypes = {}
self.buildingAnimationTimelineLoopCounts = {}
self.activeParticleSystems = {}
EVENT_MANAGER:RegisterForUpdate("ZO_ParticleSystemManager", 0, function(timeMS) self:OnUpdate(timeMS / 1000) end)
end
function ZO_ParticleSystemManager:OnUpdate(timeS)
for _, particleSystem in ipairs(self.activeParticleSystems) do
particleSystem:OnUpdate(timeS)
end
end
function ZO_ParticleSystemManager:AddParticleSystem(particleSystem)
table.insert(self.activeParticleSystems, particleSystem)
end
function ZO_ParticleSystemManager:RemoveParticleSystem(particleSystem)
for i, searchParticleSystem in ipairs(self.activeParticleSystems) do
if searchParticleSystem == particleSystem then
table.remove(self.activeParticleSystems, i)
break
end
end
end
function ZO_ParticleSystemManager:AcquireTexture()
local textureControl, key = self.texturePool:AcquireObject()
textureControl.key = key
return textureControl
end
function ZO_ParticleSystemManager:ReleaseTexture(textureControl)
self.texturePool:ReleaseObject(textureControl.key)
end
function ZO_ParticleSystemManager:GetAnimation(control, playbackInfo, animationType, easingFunction, durationS, offsetS)
--Collect all of the timelines until FinishBuildingAnimationTimelines is called
if not self.buildingAnimationTimelines then
self.buildingAnimationTimelines = {}
end
local playbackType = ANIMATION_PLAYBACK_ONE_SHOT
local loopCount = 1
if playbackInfo then
playbackType = playbackInfo.playbackType or ANIMATION_PLAYBACK_ONE_SHOT
loopCount = playbackInfo.loopCount or 1
end
offsetS = offsetS or 0
local timeline
--One shot animations all belong to the same timeline. LOOP and PING_PONG animations use separate timelines so they can LOOP and PING_PONG at their own durations.
if playbackType == ANIMATION_PLAYBACK_ONE_SHOT then
for i = 1, #self.buildingAnimationTimelines do
if self.buildingAnimationTimelinePlaybackTypes[i] == playbackType and self.buildingAnimationTimelineLoopCounts[i] == loopCount then
timeline = self.buildingAnimationTimelines[i]
break
end
end
end
if not timeline then
local key
timeline, key = self.animationTimelinePool:AcquireObject()
timeline.key = key
timeline:SetPlaybackType(playbackType, loopCount)
table.insert(self.buildingAnimationTimelines, timeline)
table.insert(self.buildingAnimationTimelinePlaybackTypes, playbackType)
table.insert(self.buildingAnimationTimelineLoopCounts, loopCount)
end
local animation = timeline:GetFirstAnimationOfType(animationType)
if not animation then
animation = timeline:InsertAnimation(animationType, control, offsetS)
else
animation:SetAnimatedControl(control)
animation:SetEnabled(true)
timeline:SetAnimationOffset(animation, offsetS)
end
animation:SetDuration(durationS * 1000)
animation:SetEasingFunction(easingFunction)
return animation
end
function ZO_ParticleSystemManager:FinishBuildingAnimationTimelines()
if self.buildingAnimationTimelines then
ZO_ClearNumericallyIndexedTable(self.buildingAnimationTimelinePlaybackTypes)
ZO_ClearNumericallyIndexedTable(self.buildingAnimationTimelineLoopCounts)
local timelines = self.buildingAnimationTimelines
self.buildingAnimationTimelines = nil
return timelines
else
return nil
end
end
function ZO_ParticleSystemManager:ReleaseAnimationTimelines(animationTimelines)
for _, animationTimeline in ipairs(animationTimelines) do
for i = 1, animationTimeline:GetNumAnimations() do
local animation = animationTimeline:GetAnimation(i)
animation:SetEnabled(false)
end
self.animationTimelinePool:ReleaseObject(animationTimeline.key)
end
end
PARTICLE_SYSTEM_MANAGER = ZO_ParticleSystemManager:New() |
--[[---------------------------------------------------------------------------
JungleTrain Radio created by Foul Play with the help of Scardigne and Harmelodic.
http://steamcommunity.com/id/LordZombie/
http://steamcommunity.com/id/scardigne/
http://steamcommunity.com/id/Harmelodic/
Please do not modify with out programming knowledge (Lua).
-----------------------------------------------------------------------------]]
AddCSLuaFile()
MsgC(Color(0, 255, 0), "[FJTR]: Loaded Sound Manager and Sound Creator file.\n")
local debugging_on = 0
local URL = "http://stream1.jungletrain.net:8000/"
local Channels = {}
--[[---------------------------------------------------------------------------
Sound Channel Creator
This function creates the channel for IGModAudioChannel to stream the radio station.
TODO: Fix the function name and description.
-----------------------------------------------------------------------------]]
local function fSoundCreator()
for k, v in pairs(ents.FindByClass("ent_jtr")) do
if (Channels[v:EntIndex()] == nil and v:GetPos():Distance(LocalPlayer():GetPos()) < 750) then
Channels[v:EntIndex()] = {radio = v, failsafe = 0}
sound.PlayURL(URL, "3d", function(channel)
if (IsValid(channel)) then
channel:SetVolume(1)
channel:Set3DFadeDistance(250, 700)
if (IsValid(v)) then
channel:Play()
else
channel:Stop()
end
if (Channels[v:EntIndex()] ~= nil) then
Channels[v:EntIndex()].channel = channel
print(v:EntIndex() .. " | " .. v:GetClass() .. " | Created Channel | " .. tostring(Channels[v:EntIndex()].channel))
end
end
end)
end
end
end
timer.Create("fjtr_fSoundCreator", 3, 0, fSoundCreator)
--[[---------------------------------------------------------------------------
Sound Channel Update Position
This function updates the channel sound position for IGModAudioChannel to make sure it's at the radio's position.
TODO: Fix the function name and description.
-----------------------------------------------------------------------------]]
local function fUpdateSoundPosition()
for k, v in pairs(Channels) do
if (not IsValid(v.radio)) then
continue
end
if (v.channel == nil) then
continue
end
v.channel:SetPos(v.radio:GetPos())
end
end
timer.Create("fjtr_fUpdateSoundPosition", .1, 0, fUpdateSoundPosition)
--[[---------------------------------------------------------------------------
Sound Channel Manager
This function managers the channel sound for IGModAudioChannel to make sure it's still available.
TODO: Fix the function name and description.
-----------------------------------------------------------------------------]]
local function fSoundManager()
for k, v in pairs(Channels) do
if (not IsValid(v.radio) and IsValid(v.channel)) then
v.channel:Stop()
Channels[k] = nil
end
if (IsValid(v.radio) and IsValid(v.channel)) then
if (v.radio:GetPos():Distance(LocalPlayer():GetPos()) > 750) then
v.channel:Pause()
else
v.channel:Play()
end
end
end
end
timer.Create("fjtr_fSoundManager", .1, 0, fSoundManager)
--[[---------------------------------------------------------------------------
Sound Channel FailSafe
This function is a fail safe for the channel to make sure that if it's not available, it delete the channel and table.
TODO: Fix the function name and description.
-----------------------------------------------------------------------------]]
local function fSoundFailSafe()
for k, v in pairs(Channels) do
if (v.channel == nil) then
v.failsafe = v.failsafe + 1
if (v.failsafe > 5) then
v.failsafe = 0
Channels[k] = nil
end
continue
end
end
end
timer.Create("fjtr_fSoundFailSafe", 1, 0, fSoundFailSafe)
--[[---------------------------------------------------------------------------
This function prints the table 'Channels' out in console for debugging.
-----------------------------------------------------------------------------]]
concommand.Add("FJTR_Channels_Print", function(ply, cmd, args)
if (ply:IsAdmin() and debugging_on == 1) then
if (Channels ~= nil) then
PrintTable(Channels)
end
end
end)
--[[---------------------------------------------------------------------------
This function allows Admins to use the 'FJTR_Channels_Print' command in console.
-----------------------------------------------------------------------------]]
concommand.Add("FJTR_debugging", function(ply, cmd, args)
if (ply:IsAdmin()) then
if (args[1] == "0") then
print("[FJTR]: Debugging is now off.")
debugging_on = 0
elseif (args[1] == "1") then
print("[FJTR]: Debugging allowed, please use 'FJTR_Channels_Print' console command" ..
" in console to print 'Channels' table.")
debugging_on = 1
elseif (args[1] ~= "1" and args[1] ~= "0") then
print("[FJTR]: Arguments is not '0' or '1'. Please use '1' or '0' in this command.")
end
elseif (not ply:IsAdmin()) then
print("[FJTR]: Sorry, you cannot use this function because you are not Admin.")
end
end)
|
--[[
getset.lua
A library for adding getters and setters to Lua tables.
Copyright (c) 2011 Josh Tynjala
Licensed under the MIT license.
]]--
local function throwReadOnlyError(table, key)
error("Cannot assign to read-only property '" .. key .. "' of " .. tostring(table) .. ".");
end
local function throwNotExtensibleError(table, key)
error("Cannot add property '" .. key .. "' because " .. tostring(table) .. " is not extensible.")
end
local function throwSealedError(table, key)
error("Cannot redefine property '" .. key .. "' because " .. tostring(table) .. " is sealed.")
end
local function getset__index(table, key)
local gs = table.__getset
-- try to find a descriptor first
local descriptor = gs.descriptors[key]
if descriptor and descriptor.get then
return descriptor.get()
end
-- if an old metatable exists, use that
local old__index = gs.old__index
if old__index then
return old__index(table, key)
end
return nil
end
local function getset__newindex(table, key, value)
local gs = table.__getset
-- check for a property first
local descriptor = gs.descriptors[key]
if descriptor then
if not descriptor.set then
throwReadOnlyError(table, key)
end
descriptor.set(value)
return
end
-- use the __newindex from the previous metatable next
-- if it exists, then isExtensible will be ignored
local old__newindex = gs.old__newindex
if old__newindex then
old__newindex(table, key, value)
return
end
-- finally, fall back to rawset()
if gs.isExtensible then
rawset(table, key, value)
else
throwNotExtensibleError(table, key)
end
end
-- initializes the table with __getset field
local function initgetset(table)
if table.__getset then
return
end
local mt = getmetatable(table)
local old__index
local old__newindex
if mt then
old__index = mt.__index
old__newindex = mt.__newindex
else
mt = {}
setmetatable(table, mt)
end
mt.__index = getset__index
mt.__newindex = getset__newindex
rawset(table, "__getset",
{
old__index = old__index,
old__newindex = old__newindex,
descriptors = {},
isExtensible = true,
isOldMetatableExtensible = true,
isSealed = false
})
return table
end
local getset = {}
--- Defines a new property or modifies an existing property on a table. A getter
-- and a setter may be defined in the descriptor, but both are optional.
-- If a metatable already existed, and it had something similar to getters and
-- setters defined using __index and __newindex, then those functions can be
-- accessed directly through table.__getset.old__index() and
-- table.__getset.old__newindex(). This is useful if you want to override with
-- defineProperty(), but still manipulate the original functions.
-- @param table The table on which to define or modify the property
-- @param key The name of the property to be defined or modified
-- @param descriptor The descriptor containing the getter and setter functions for the property being defined or modified
-- @return The table and the old raw value of the field
function getset.defineProperty(table, key, descriptor)
initgetset(table)
local gs = table.__getset
local oldDescriptor = gs.descriptors[key]
local oldValue = table[key]
if gs.isSealed and (oldDescriptor or oldValue) then
throwSealedError(table, key)
elseif not gs.isExtensible and not oldDescriptor and not oldValue then
throwNotExtensibleError(table, key)
end
gs.descriptors[key] = descriptor
-- we need to set the raw value to nil so that the metatable works
rawset(table, key, nil)
-- but we'll return the old raw value, just in case it is needed
return table, oldValue
end
--- Prevents new properties from being added to a table. Existing properties may
-- be modified and configured.
-- @param table The table that should be made non-extensible
-- @return The table
function getset.preventExtensions(table)
initgetset(table)
local gs = table.__getset
gs.isExtensible = false
return table
end
--- Determines if a table is extensible. If a table isn't initialized with
-- getset, this function returns true, since regular tables are always
-- extensible. If a previous __newindex metatable method was defined before
-- this table was initialized with getset, then isExtensible will be ignored
-- completely.
-- @param table The table to be checked
-- @return true if extensible, false if non-extensible
function getset.isExtensible(table)
local gs = table.__getset
if not gs then
return true
end
return gs.isExtensible
end
--- Prevents new properties from being added to a table, and existing properties
-- may be modified, but not configured.
-- @param table The table that should be sealed
-- @return The table
function getset.seal(table)
initgetset(table)
local gs = table.__getset
gs.isExtensible = false
gs.isSealed = true
return table
end
--= Determines if a table is sealed. If a table isn't initialized with getset,
-- this function returns false, since regular tables are never sealed.
-- completely.
-- @param table The table to be checked
-- @return true if sealed, false if not sealed
function getset.isSealed(table)
local gs = table.__getset
if not gs then
return false
end
return gs.isSealed
end
return getset |
-- For use with Lua Macros
--- assign logical name to macro keyboard
lmc_assign_keyboard('MACROS');
-- Application/Script variables --
local browser = "C:\\Users\\Admin\\AppData\\Local\\Mozilla Firefox\\firefox.exe"
local win_run = "C:\\\\Scripts\\macro_keyboard_companion.py"
-- define callback for whole device
lmc_set_handler('MACROS',function(button, direction)
if (direction == 1) then return end -- ignore down
if (button == string.byte('X')) then lmc_spawn(browser, "https://mail.google.com/")
elseif (button == string.byte('C')) then lmc_spawn(browser, "http://mydesk.morganstanley.com/")
elseif (button == string.byte('M')) then lmc_spawn(browser, "https://calendar.google.com/")
elseif (button == 188) then lmc_spawn(browser, "http://torrent.home/")
elseif (button == string.byte('P')) then lmc_spawn(browser, "http://portainer.home/")
elseif (button == 190) then lmc_spawn(browser, "https://nextcloud.home/apps/passwords")
elseif (button == string.byte('Q')) then lmc_spawn("explorer.exe", "C:\\Users\\Admin\\Downloads")
elseif (button == string.byte('W')) then lmc_spawn("explorer.exe", "C:\\Users\\Admin\\Documents")
elseif (button == string.byte('N')) then lmc_spawn("python", win_run, "keebs", "snip")
elseif (button == string.byte('T')) then lmc_spawn("python", win_run, "run", "taskmgr.exe")
elseif (button == string.byte('A')) then lmc_spawn("python", win_run, "keebs", "vss_cmd_palette")
elseif (button == 27) then lmc_spawn("python", win_run, "off_tv")
elseif (button == string.byte('V')) then lmc_spawn("C:\\Program Files (x86)\\Zoom\\bin\\Zoom.exe")
elseif (button == string.byte('B')) then lmc_spawn("C:\\Users\\Admin\\AppData\\Local\\WhatsApp\\WhatsApp.exe")
elseif (button == string.byte('Z')) then lmc_spawn("notepad")
else print('Not yet assigned: ' .. button)
end
end)
|
ITEM.name = "Accuracy International AWM"
ITEM.description = "A Large and bulky Bolt action Sniper rifle."
ITEM.model = "models/weapons/w_ins2_warface_awm.mdl"
ITEM.class = "tfa_ins2_warface_awm"
ITEM.weaponCategory = "primary"
ITEM.classes = {CLASS_EMP, CLASS_EOW}
ITEM.flag = "v"
ITEM.width = 5
ITEM.height = 2
ITEM.bDropOnDeath = true
ITEM.iconCam = {
ang = Angle(-0.020070368424058, 270.40155029297, 0),
fov = 7.2253324508038,
pos = Vector(0, 200, -1)
} |
---------------------------------------------------------------------------------------------------
-- func: promote
-- desc: Promotes the player to a new GM level.
---------------------------------------------------------------------------------------------------
cmdprops =
{
permission = 1,
parameters = "si"
}
function error(player, msg)
player:PrintToPlayer(msg)
player:PrintToPlayer("!promote <player> <level>")
end
function onTrigger(player, target, level)
-- determine maximum level player can promote to
local maxLevel = player:getGMLevel() - 1
if (maxLevel < 1) then
maxLevel = 0
end
-- validate target
local targ
if (target == nil) then
error(player, "You must provide a player name.")
return
else
targ = GetPlayerByName(target)
if (targ == nil) then
error(player, string.format( "Player named '%s' not found!", target ) )
return
end
end
-- catch players trying to change level of equal or higher tiered GMs.
if (targ:getGMLevel() >= player:getGMLevel()) then
printf( "%s attempting to adjust same or higher tier GM %s.", player:getName(), targ:getName() )
targ:PrintToPlayer(string.format( "%s attempted to adjust your GM rank.", player:getName() ))
error(player, "You can not use this command on same or higher tiered GMs.")
return
end
-- validate level
if (level == nil or level < 0 or level > maxLevel) then
error(player, string.format("Invalid level. Must be 0 to %i.", maxLevel ))
return
end
-- change target gm level
targ:setGMLevel(level)
-- if target is being set to non-GM, remove active GM priveleges, which they will no longer be able to remove themselves
if level == 0 then
-- remove god mode
if targ:getCharVar("GodMode") == 1 then
targ:setCharVar("GodMode", 0)
targ:delStatusEffect(tpz.effect.MAX_HP_BOOST)
targ:delStatusEffect(tpz.effect.MAX_MP_BOOST)
targ:delStatusEffect(tpz.effect.MIGHTY_STRIKES)
targ:delStatusEffect(tpz.effect.HUNDRED_FISTS)
targ:delStatusEffect(tpz.effect.CHAINSPELL)
targ:delStatusEffect(tpz.effect.PERFECT_DODGE)
targ:delStatusEffect(tpz.effect.INVINCIBLE)
targ:delStatusEffect(tpz.effect.ELEMENTAL_SFORZO)
targ:delStatusEffect(tpz.effect.MANAFONT)
targ:delStatusEffect(tpz.effect.REGAIN)
targ:delStatusEffect(tpz.effect.REFRESH)
targ:delStatusEffect(tpz.effect.REGEN)
targ:delMod(tpz.mod.RACC,2500)
targ:delMod(tpz.mod.RATT,2500)
targ:delMod(tpz.mod.ACC,2500)
targ:delMod(tpz.mod.ATT,2500)
targ:delMod(tpz.mod.MATT,2500)
targ:delMod(tpz.mod.MACC,2500)
targ:delMod(tpz.mod.RDEF,2500)
targ:delMod(tpz.mod.DEF,2500)
targ:delMod(tpz.mod.MDEF,2500)
end
-- remove GM flags
local FLAG_GM = 0x04000000
local FLAG_SENIOR = 0x01000000 -- Do NOT set these flags. These are here to
local FLAG_LEAD = 0x02000000 -- ensure all GM status is removed.
if targ:checkNameFlags(FLAG_GM) then
targ:setFlag(FLAG_GM)
end
if targ:checkNameFlags(FLAG_SENIOR) then
targ:setFlag(FLAG_SENIOR)
end
if targ:checkNameFlags(FLAG_LEAD) then
targ:setFlag(FLAG_LEAD)
end
-- remove hidden
if targ:getCharVar("GMHidden") == 1 then
targ:setCharVar("GMHidden", 0)
targ:setGMHidden(false)
end
-- remove costume
targ:costume(0)
-- remove wallhack
if targ:checkNameFlags(0x00000200) then
targ:setFlag(0x00000200)
end
end
player:PrintToPlayer(string.format( "%s set to tier %i.", targ:getName(), level ))
targ:PrintToPlayer(string.format( "You have been set to tier %i.", level ))
end
|
local util = require("polarmutex.colorschemes.utils")
local M = {}
--base00 - Default Background
--base01 - Lighter Background (Used for status bars, line number and folding marks)
--base02 - Selection Background
--base03 - Comments, Invisibles, Line Highlighting
--base04 - Dark Foreground (Used for status bars)
--base05 - Default Foreground, Caret, Delimiters, Operators
--base06 - Light Foreground (Not often used)
--base07 - Light Background (Not often used)
--base08 - Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted
--base09 - Integers, Boolean, Constants, XML Attributes, Markup Link Url
--base0A - Classes, Markup Bold, Search Text Background
--base0B - Strings, Inherited Class, Markup Code, Diff Inserted
--base0C - Support, Regular Expressions, Escape Characters, Markup Quotes
--base0D - Functions, Methods, Attribute IDs, Headings
--base0E - Keywords, Storage, Selector, Markup Italic, Diff Changed
--base0F - Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?>
---@param config Config
---@return Theme
function M.setup(config)
config = config or require("polarmutex.colorschemes.tokyonight.config")
local colors = require("polarmutex.colorschemes." .. config.theme .. ".colors")
---@class Theme
local theme = {}
theme.config = config
theme.colors = colors.setup(config)
local c = theme.colors
theme.base = {
-- Vim editor colors
Normal = { fg = c.fg, bg = config.transparent and c.none or c.bg }, -- normal text
Bold = { bold = true },
Debug = { fg = c.base08 }, -- debugging statements
Directory = { fg = c.fn or c.base0D }, -- directory names (and other special names in listings)
Error = { fg = c.base00, bg = c.base08 }, -- (preferred) any erroneous construct
ErrorMsg = { fg = c.diag.error }, -- error messages on the command line
Exception = { fg = c.sp2 or c.base08 }, -- try, catch, throw
FoldColumn = { fg = c.bg_light2 }, -- 'foldcolumn'
Folded = { fg = c.bg_light3, bg = c.bg_light0 }, -- line used for closed folds
IncSearch = { fg = c.bg_visual, bg = c.diag.warning }, -- 'incsearch' highlighting; also used for the text replaced with ":s///c"
Italic = { italic = true },
Macro = { fg = c.base08 }, -- same as Define
MatchParen = { bg = c.diag.warning, bold = true }, -- The character under the cursor or just before it, if it is a paired bracket, and its match. |pi_paren.txt|
ModeMsg = { fg = c.diag.warning, bold = true }, -- 'showmode' message (e.g., "-- INSERT -- ")
MoreMsg = { fg = c.diag.info, bg = c.bg }, -- |more-prompt|
MsgArea = { fg = c.fg_dark }, -- Area for messages and cmdline
Question = { link = "MoreMsg" }, -- |hit-enter| prompt and yes/no questions
Search = { fg = c.fg, bg = c.bg_search }, -- Last search pattern highlighting (see 'hlsearch'). Also used for similar items that need to stand out.
Substitute = { fg = c.fg, bg = c.git.removed }, -- |:substitute| replacement text highlighting
SpecialKey = { link = "NonText" }, -- Unprintable characters: text displayed differently from what it really is. But not 'listchars' whitespace. |hl-Whitespace|
TooLong = { fg = c.base08 }, -- TODO desc
Underlined = { underline = true }, -- (preferred) text that stands out, HTML links
Visual = { bg = c.bg_visual }, -- Visual mode selection
VisualNOS = { link = "Visual" }, -- Visual mode selection when vim is "Not Owning the Selection".
WarningMsg = { fg = c.diag.warning }, -- warning messages
WildMenu = { link = "Pmenu" }, -- current match in 'wildmenu' completion
Title = { fg = c.fn, bold = true }, -- titles for output from ":set all", ":autocmd" etc.
Conceal = { fg = c.bg_light3 or c.base0D, bg = c.base00 }, -- placeholder characters substituted for concealed text (see 'conceallevel')
Cursor = { fg = c.bg or c.base00, bg = c.fg or c.base05 }, -- character under the cursor
lCursor = { link = "Cursor" },
CursorIM = { link = "Cursor" },
NonText = { fg = c.bg_light2 }, -- '@' at the end of the window, characters from 'showbreak' and other characters that do not really exist in the text (e.g., ">" displayed when a double-wide character doesn't fit at the end of the line). See also |hl-EndOfBuffer|.
LineNr = { fg = c.bg_light2 }, -- Line number for ":number" and ":#" commands, and when 'number' or 'relativenumber' option is set.
SignColumn = { fg = c.bg_light2, bg = config.transparent and c.none or c.base00 }, -- column where |signs| are displayed
StatusLine = { fg = c.fg_dark, bg = c.bg_status }, -- status line of current window
StatusLineNC = { fg = c.fg_comment, bg = c.bg_status }, -- status lines of not-current windows Note: if this is equal to "StatusLine" Vim will use "^^^" in the status line of the current window.
VertSplit = { fg = c.bg_status, bg = c.bg_status }, -- the column separating vertically split windows
ColorColumn = { bg = c.bg_light0 or c.base01 }, -- used for the columns set with 'colorcolumn'
CursorColumn = { bg = c.bg_light1 or c.base01 }, -- Screen-column at the cursor, when 'cursorcolumn' is set.
CursorLine = { bg = c.bg_light1 or c.base01 }, -- Screen-line at the cursor, when 'cursorline' is set. Low-priority if foreground (ctermfg OR guifg) is not set.
CursorLineNr = { fg = c.diag.warning, bold = true }, -- Like LineNr when 'cursorline' or 'relativenumber' is set for the cursor line.
QuickFixLine = { link = "CursorLine" }, -- Current |quickfix| item in the quickfix window. Combined with |hl-CursorLine| when the cursor is there.
Pmenu = { fg = c.fg, bg = c.bg_menu }, -- Popup menu: normal item.
PmenuSel = { bg = c.bg_menu_sel }, -- Popup menu: selected item.
TabLine = { fg = c.bg_light3, bg = c.bg_dark }, -- tab pages line, not active tab page label
TabLineFill = { bg = c.bg }, -- tab pages line, where there are no labels
TabLineSel = { fg = c.fg_dark, bg = c.bg_light1 }, -- tab pages line, active tab page label
Whitespace = { fg = c.bg_light2 }, -- "nbsp", "space", "tab" and "trail" in 'listchars'
-- Standard syntax highlighting
Boolean = { fg = c.co }, -- a boolean constant: TRUE, false
Character = { link = "String" }, -- a character constant: 'c', '\n'
Comment = { fg = c.fg_comment }, -- any comment
Conditional = { fg = c.base0E }, -- if, then, else, endif, switch, etc.
Constant = { fg = c.co }, -- (preferred) any constant
Define = { fg = c.base0E }, -- preprocessor #define
Delimiter = { fg = c.base0F }, -- character that needs attention
Float = { link = "Number" }, -- a floating point constant: 2.3e10
Function = { fg = c.fn }, -- function name (also: methods for classes)
Identifier = { fg = c.id }, -- (preferred) any variable name
Include = { fg = c.base0D }, -- preprocessor #include
Keyword = { fg = c.kw }, -- any other keyword
Label = { fg = c.base0A }, -- case, default, etc.
Number = { fg = c.nu }, -- a number constant: 234, 0xff
Operator = { fg = c.op }, -- "sizeof", "+", "*", etc.
PreProc = { fg = c.pp }, -- (preferred) generic Preprocessor
Repeat = { fg = c.base0A }, -- for, do, while, etc.
Special = { fg = c.sp }, -- (preferred) any special symbol
SpecialChar = { fg = c.base0F }, -- special character in a constant
Statement = { fg = c.sm }, -- (preferred) any statement
StorageClass = { fg = c.base0A }, -- static, register, volatile, etc.
String = { fg = c.st }, -- a string constant: "this is a string"
Structure = { fg = c.base0E }, -- struct, union, enum, etc.
Tag = { fg = c.base0A }, -- you can use CTRL-] on this
Todo = { fg = c.fg_reverse, bg = c.diag.info, bold = true }, -- (preferred) anything that needs extra attention; mostly the keywords TODO FIXME and XXX
Type = { fg = c.ty }, -- (preferred) int, long, char, etc.
Typedef = { fg = c.base0A }, -- A typedef
-- Diff highlighting
DiffAdd = { bg = c.diff.add }, -- diff mode: Added line |diff.txt|
DiffChange = { bg = c.diff.change }, -- diff mode: Changed line |diff.txt|
DiffDelete = { fg = c.git.removed, bg = c.diff.delete }, -- diff mode: Deleted line |diff.txt|
DiffText = { bg = c.diff.text }, -- diff mode: Changed text within a changed line |diff.txt|
DiffAdded = { fg = c.base0B, bg = c.base00 }, -- TODO
DiffFile = { fg = c.base08, bg = c.base00 }, -- TODO
DiffNewFile = { fg = c.base0B, bg = c.base00 }, -- TODO
DiffLine = { fg = c.base0D, bg = c.base00 }, -- TODO
DiffRemoved = { fg = c.base08, bg = c.base00 }, -- TODO
-- Spelling highlighting
SpellBad = { undercurl = true, sp = c.diag.error }, -- Word that is not recognized by the spellchecker. |spell| Combined with the highlighting used otherwise.
SpellCap = { undercurl = true, sp = c.diag.warning }, -- Word that should start with a capital. |spell| Combined with the highlighting used otherwise.
SpellLocal = { undercurl = true, sp = c.diag.warning }, -- Word that is recognized by the spellchecker as one that is used in another region. |spell| Combined with the highlighting used otherwise.
SpellRare = { undercurl = true, sp = c.diag.warning }, -- Word that is recognized by the spellchecker as one that is hardly ever used. |spell| Combined with the highlighting used otherwise.
DiagnosticError = { fg = c.diag.error }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default
DiagnosticWarn = { fg = c.diag.warning }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default
DiagnosticInfo = { fg = c.diag.info }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default
DiagnosticHint = { fg = c.diag.hint }, -- Used as the base highlight group. Other Diagnostic highlights link to this by default
DiagnosticVirtualTextError = { fg = c.diag.error }, -- Used for "Error" diagnostic virtual text
DiagnosticVirtualTextWarn = { fg = c.diag.warning }, -- Used for "Warning" diagnostic virtual text
DiagnosticVirtualTextInfo = { fg = c.diag.info }, -- Used for "Information" diagnostic virtual text
DiagnosticVirtualTextHint = { fg = c.diag.hint }, -- Used for "Hint" diagnostic virtual text
DiagnosticUnderlineError = { undercurl = true, sp = c.diag.error }, -- Used to underline "Error" diagnostics
DiagnosticUnderlineWarn = { undercurl = true, sp = c.diag.warning }, -- Used to underline "Warning" diagnostics
DiagnosticUnderlineInfo = { undercurl = true, sp = c.diag.info }, -- Used to underline "Information" diagnostics
DiagnosticUnderlineHint = { undercurl = true, sp = c.diag.hint }, -- Used to underline "Hint" diagnostics
-- These groups are for the native LSP client. Some other LSP clients may
-- use these groups, or use their own. Consult your LSP client's
-- documentation.
LspReferenceText = { underline = true, sp = c.base04 }, -- used for highlighting "text" references
LspReferenceRead = { underline = true, sp = c.base04 }, -- used for highlighting "read" references
LspReferenceWrite = { underline = true, sp = c.base04 }, -- used for highlighting "write" references
LspDiagnosticsDefaultError = { link = "DiagnosticError" },
LspDiagnosticsDefaultWarning = { link = "DiagnosticWarn" },
LspDiagnosticsDefaultInformation = { link = "DiagnosticInfo" },
LspDiagnosticsDefaultHint = { link = "DiagnosticHint" },
LspDiagnosticsUnderlineError = { link = "DiagnosticUnderlineError" },
LspDiagnosticsUnderlineWarning = { link = "DiagnosticUnderlineWarning" },
LspDiagnosticsUnderlineInformation = { link = "DiagnosticUnderlineInformation" },
LspDiagnosticsUnderlineHint = { link = "DiagnosticUnderlineHint" },
--lCursor = { fg = c.bg, bg = c.fg }, -- the character under the cursor when |language-mapping| is used (see 'guicursor')
--CursorIM = { fg = c.bg, bg = c.fg }, -- like Cursor, but used when in IME mode |CursorIM|
--EndOfBuffer = { fg = c.bg }, -- filler lines (~) after the end of the buffer. By default, this is highlighted like |hl-NonText|.
-- TermCursor = { }, -- cursor in a focused terminal
-- TermCursorNC= { }, -- cursor in an unfocused terminal
--SignColumnSB = { bg = c.bg_sidebar, fg = c.fg_gutter }, -- column where |signs| are displayed
-- MsgSeparator= { }, -- Separator for scrolled messages, `msgsep` flag of 'display'
--NormalNC = { fg = c.fg, bg = config.transparent and c.none or c.bg }, -- normal text in non-current windows
--NormalSB = { fg = c.fg_sidebar, bg = c.bg_sidebar }, -- normal text in non-current windows
--NormalFloat = { fg = c.fg, bg = c.bg_float }, -- Normal text in floating windows.
--FloatBorder = { fg = c.border_highlight, bg = c.bg_float },
--PmenuSbar = { bg = util.lighten(c.bg_popup, 0.95) }, -- Popup menu: scrollbar.
--PmenuThumb = { bg = c.fg_gutter }, -- Popup menu: Thumb of the scrollbar.
}
if not vim.diagnostic then
local severity_map = {
Error = "Error",
Warn = "Warning",
Info = "Information",
Hint = "Hint",
}
local types = { "Default", "VirtualText", "Underline" }
for _, type in ipairs(types) do
for snew, sold in pairs(severity_map) do
theme.base["LspDiagnostics" .. type .. sold] = {
link = "Diagnostic" .. (type == "Default" and "" or type) .. snew,
}
end
end
end
theme.plugins = {
-- These groups are for the neovim tree-sitter highlights.
-- As of writing, tree-sitter support is a WIP, group names may change.
-- By default, most of these groups link to an appropriate Vim group,
-- TSError -> Error for example, so you do not have to define these unless
-- you explicitly want to support Treesitter's improved syntax awareness.
--TSAnnotation = { fg = c.base0F }, -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information.
--TSAttribute = { fg = c.base0A }, -- (unstable) TODO: docs
--TSBoolean = { fg = c.base09 }, -- For booleans.
--TSCharacter = { fg = c.base08, italic = true }, -- For characters.
--TSComment = { fg = c.fg_comment or c.base03 }, -- For comment blocks.
--TSConstructor = { fg = c.base0D }, -- For constructor calls and definitions: `= { }` in Lua, and Java constructors.
--TSConditional = { fg = c.base0E }, -- For keywords related to conditionnals.
--TSConstant = { fg = c.base09 }, -- For constants
--TSConstBuiltin = { fg = c.base09, italic = true }, -- For constant that are built in the language: `nil` in Lua.
--TSConstMacro = { fg = c.base08 }, -- For constants that are defined by macros: `NULL` in C.
--TSError = { fg = c.error }, -- For syntax/parser errors.
--TSException = { fg = c.base08 }, -- For exception related keywords.
--TSField = { fg = c.base05 }, -- For fields.
--TSFloat = { fg = c.base09 }, -- For floats.
--TSFunction = { fg = c.base0D }, -- For function (calls and definitions).
--TSFuncBuiltin = { fg = c.base0D, italic = true }, -- For builtin functions: `table.insert` in Lua.
--TSFuncMacro = { fg = c.base08 }, -- For macro defined fuctions (calls and definitions): each `macro_rules` in Rust.
--TSInclude = { fg = c.base0D }, -- For includes: `#include` in C, `use` or `extern crate` in Rust, or `require` in Lua.
--TSKeyword = { fg = c.base0E }, -- For keywords that don't fall in previous categories.
--TSKeywordFunction = { fg = c.base0E }, -- For keywords used to define a fuction.
--TSKeywordOperator = { fg = c.base0E }, -- TODO
--TSLabel = { fg = c.base0A }, -- For labels: `label:` in C and `:label:` in Lua.
--TSMethod = { fg = c.base0D }, -- For method calls and definitions.
--TSNamespace = { fg = c.base08 }, -- For identifiers referring to modules and namespaces.
--TSNone = { fg = c.base05 }, -- TODO: docs
--TSNumber = { fg = c.base09 }, -- For all numbers
--TSOperator = { fg = c.base05 }, -- For any operator: `+`, but also `->` and `*` in C.
--TSParameter = { fg = c.base05 }, -- For parameters of a function.
--TSParameterReference = { fg = c.base05 }, -- For references to parameters of a function.
--TSProperty = { fg = c.base05 }, -- Same as `TSField`.
--TSPunctDelimiter = { fg = c.base0F }, -- For delimiters ie: `.`
--TSPunctBracket = { fg = c.base05 }, -- For brackets and parens.
--TSPunctSpecial = { fg = c.base05 }, -- For special punctutation that does not fall in the catagories before.
--TSRepeat = { fg = c.base0A }, -- For keywords related to loops.
--TSString = { fg = c.base0B }, -- For strings.
--TSStringRegex = { fg = c.base0C }, -- For regexes.
--TSStringEscape = { fg = c.base0C }, -- For escape characters within a string.
--TSSymbol = { fg = c.base0B }, -- For identifiers referring to symbols or atoms.
--TSTag = { fg = c.base0A }, -- Tags like html tag names.
--TSTagDelimiter = { fg = c.base0F }, -- Tag delimiter like `<` `>` `/`
--TSText = { fg = c.base05 }, -- For strings considered text in a markup language.
--TSStrong = { bold = true },
--TSEmphasis = { fg = c.base09, italic = true }, -- For text to be represented with emphasis.
--TSUnderline = { underline = true }, -- For text to be represented with an underline.
--TSStrike = { strikethrough = true }, -- For strikethrough text.
--TSTitle = { fg = c.base0D }, -- Text that is part of a title.
--TSLiteral = { fg = c.base09 }, -- Literal text.
--TSURI = { fg = c.base09, underline = true }, -- Any URI like a link or email.
--TSType = { fg = c.base0A }, -- For types.
--TSTypeBuiltin = { fg = c.base0A, italic = true }, -- For builtin types.
--TSVariable = { fg = c.base08 }, -- Any variable name that does not have another highlight.
--TSVariableBuiltin = { fg = c.base08, italic = true }, -- Variable names that are defined by the languages, like `this` or `self`.
--TSDefinition = { underline = true, sp = c.base04 },
--TSDefinitionUsage = { underline = true, sp = c.base04 },
--TSCurrentScope = { bold = true },
--TSNote = { fg = c.bg, bg = c.info },
--TSWarning = { fg = c.bg, bg = c.warning },
--TSDanger = { fg = c.bg, bg = c.error },
--TSTextReference = { fg = c.teal },
-- LspTrouble
--LspTroubleText = { fg = c.fg_dark },
--LspTroubleCount = { fg = c.magenta, bg = c.fg_gutter },
--LspTroubleNormal = { fg = c.fg_sidebar, bg = c.bg_sidebar },
-- diff
diffAdded = { fg = c.git.added },
diffRemoved = { fg = c.git.removed },
diffDeleted = { fg = c.git.removed },
diffChanged = { fg = c.git.changed },
diffOldFile = { fg = c.git.removed },
diffNewFile = { fg = c.git.added },
--diffFile = { fg = c.blue },
--diffLine = { fg = c.comment },
--diffIndexLine = { fg = c.magenta },
-- Neogit
--NeogitBranch = { fg = c.magenta },
--NeogitRemote = { fg = c.purple },
--NeogitHunkHeader = { bg = c.bg_highlight, fg = c.fg },
--NeogitHunkHeaderHighlight = { bg = c.fg_gutter, fg = c.blue },
--NeogitDiffContextHighlight = { bg = util.darken(c.fg_gutter, 0.5), fg = c.fg_dark },
--NeogitDiffDeleteHighlight = { fg = c.git.delete, bg = c.diff.delete },
--NeogitDiffAddHighlight = { fg = c.git.add, bg = c.diff.add },
-- GitSigns
GitSignsAdd = { link = "diffAdded" }, -- diff mode: Added line |diff.txt|
GitSignsChange = { link = "diffChanged" }, -- diff mode: Changed line |diff.txt|
GitSignsDelete = { link = "diffDeleted" }, -- diff mode: Deleted line |diff.txt|
GitSignsDeleteLn = { bg = c.diff.delete },
-- Telescope
TelescopeBorder = { link = "FloatBorder" },
--TelescopeNormal = { fg = c.fg, bg = c.bg_float },
-- NeoVim
healthError = { fg = c.diag.error },
healthSuccess = { fg = c.diag.good },
healthWarning = { fg = c.diag.warning },
-- Cmp
CmpDocumentation = { fg = c.fg, bg = c.bg_popup },
--CmpDocumentationBorder = { fg = c.fg_border, bg = "NONE" },
--CmpItemAbbr = { fg = c.fg, bg = "NONE" },
--CmpItemAbbrDeprecated = { fg = c.fg_comment, bg = "NONE" }, --TODO strikethrough ?
--CmpItemAbbrMatch = { fg = c.fn, bg = "NONE" },
CmpItemAbbrMatchFuzzy = { link = "CmpItemAbbrMatch" },
--CmpItemKindDefault = { fg = c.dep, bg = "NONE" },
--CmpItemMenu = { fg = c.fg_comment, bg = "NONE" },
--CmpItemKindVariable = { fg = c.fg_dark, bg = "NONE" },
CmpItemKindFunction = { link = "Function" },
CmpItemKindMethod = { link = "Function" },
CmpItemKindConstructor = { link = "TSConstructor" },
CmpItemKindClass = { link = "Type" },
CmpItemKindInterface = { link = "Type" },
CmpItemKindStruct = { link = "Type" },
CmpItemKindProperty = { link = "TSProperty" },
CmpItemKindField = { link = "TSField" },
CmpItemKindEnum = { link = "Identifier" },
--CmpItemKindSnippet = { fg = c.sp, bg = "NONE" },
CmpItemKindText = { link = "TSText" },
CmpItemKindModule = { link = "TSInclude" },
CmpItemKindFile = { link = "Directory" },
CmpItemKindFolder = { link = "Directory" },
CmpItemKindKeyword = { link = "TSKeyword" },
CmpItemKindTypeParameter = { link = "Identifier" },
CmpItemKindConstant = { link = "Constant" },
CmpItemKindOperator = { link = "Operator" },
CmpItemKindReference = { link = "TSParameterReference" },
CmpItemKindEnumMember = { link = "TSField" },
CmpItemKindValue = { link = "String" },
--CmpItemKindUnit = {},
--CmpItemKindEvent = {},
--CmpItemKindColor = {},
}
theme.defer = {}
if config.hideInactiveStatusline then
local inactive = { style = "underline", bg = c.bg, fg = c.bg, sp = c.border }
-- StatusLineNC
theme.base.StatusLineNC = inactive
-- LuaLine
for _, section in ipairs({ "a", "b", "c" }) do
theme.defer["lualine_" .. section .. "_inactive"] = inactive
end
end
return theme
end
return M
|
local Root = script.Parent.Parent
local CorePackages = game:GetService("CorePackages")
local PurchasePromptDeps = require(CorePackages.PurchasePromptDeps)
local Rodux = PurchasePromptDeps.Rodux
local RequestAssetPurchase = require(Root.Actions.RequestAssetPurchase)
local RequestBundlePurchase = require(Root.Actions.RequestBundlePurchase)
local RequestGamepassPurchase = require(Root.Actions.RequestGamepassPurchase)
local RequestProductPurchase = require(Root.Actions.RequestProductPurchase)
local RequestPremiumPurchase = require(Root.Actions.RequestPremiumPurchase)
local RequestSubscriptionPurchase = require(Root.Actions.RequestSubscriptionPurchase)
local CompleteRequest = require(Root.Actions.CompleteRequest)
local RequestType = require(Root.Enums.RequestType)
local EMPTY_STATE = { requestType = RequestType.None }
local RequestReducer = Rodux.createReducer(EMPTY_STATE, {
[RequestAssetPurchase.name] = function(state, action)
return {
id = action.id,
infoType = Enum.InfoType.Asset,
requestType = RequestType.Asset,
equipIfPurchased = action.equipIfPurchased,
isRobloxPurchase = action.isRobloxPurchase,
}
end,
[RequestGamepassPurchase.name] = function(state, action)
return {
id = action.id,
infoType = Enum.InfoType.GamePass,
requestType = RequestType.GamePass,
isRobloxPurchase = false,
}
end,
[RequestProductPurchase.name] = function(state, action)
return {
id = action.id,
infoType = Enum.InfoType.Product,
requestType = RequestType.Product,
isRobloxPurchase = false,
}
end,
[RequestBundlePurchase.name] = function(state, action)
return {
id = action.id,
infoType = Enum.InfoType.Bundle,
requestType = RequestType.Bundle,
isRobloxPurchase = true,
}
end,
[RequestPremiumPurchase.name] = function(state, action)
return {
requestType = RequestType.Premium,
}
end,
[RequestSubscriptionPurchase.name] = function(state, action)
return {
id = action.id,
infoType = Enum.InfoType.Subscription,
requestType = RequestType.Subscription,
}
end,
[CompleteRequest.name] = function(state, action)
-- Clear product info when we hide the prompt
return EMPTY_STATE
end,
})
return RequestReducer
|
pg = pg or {}
pg.effect_offset = {
bossguangxiao = {
mirror = false,
y_scale = false,
container_index = 3,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
bossguangxiaobig = {
mirror = false,
y_scale = false,
container_index = 3,
top_cover_offset = false,
offset = {
-1.14,
0,
-0.22
}
},
bossguangxiaobig2 = {
mirror = false,
y_scale = false,
container_index = 3,
top_cover_offset = false,
offset = {
0,
0,
0.75
}
},
danchuanlanghuaxiao = {
mirror = false,
y_scale = false,
container_index = 3,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
danchuanlanghuazhong1 = {
mirror = false,
y_scale = false,
container_index = 3,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
danchuanlanghuazhong2 = {
mirror = false,
y_scale = false,
container_index = 3,
top_cover_offset = false,
offset = {
-0.76,
-0.83,
0.5
}
},
danchuanlanghuazhong3 = {
mirror = false,
y_scale = false,
container_index = 3,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
danchuanlanghuada = {
mirror = false,
y_scale = false,
container_index = 3,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
movewave = {
mirror = false,
y_scale = false,
container_index = 3,
top_cover_offset = false,
offset = {
0,
-2,
3.25
}
},
gongjiBUFF = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
5,
0
}
},
feijiyingzi = {
mirror = false,
y_scale = false,
container_index = 3,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
fangyuBUFF = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
5,
0
}
},
jiasuBUFF = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
5,
0
}
},
Darkness = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
3,
0
}
},
ATK = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
5,
0
}
},
lansebuff = {
mirror = false,
y_scale = false,
container_index = 3,
top_cover_offset = false,
offset = {
0,
-0.69,
1.67
}
},
Shield = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
-1.25,
0
}
},
DEF = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
5,
0
}
},
SPD = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
3,
0
}
},
SPDdowm = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
3,
0
}
},
Heart = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
5,
0
}
},
zhuoshao = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
-0.225,
0.8,
0.2
}
},
hongsebuff = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
caisedian = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
5,
0
}
},
lingxing = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
5,
0
}
},
Star = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
5,
0
}
},
fensebuff = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
5,
0
}
},
kulou = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
5,
0
}
},
bigbang = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
-1.25,
0
}
},
gantanhao = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
3,
0
}
},
jinengchufablue = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
1.8,
0
}
},
jinengchufared = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
1.8,
0
}
},
jingyingguaibuffbaise = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
jingyingguaibuffzise = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
jingyingguaibuffhongse = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
jingyingguaibuffjinse = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
Bossbomb = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
-1.25,
0
}
},
fangkongpaohuoshe2 = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
pofang = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
shield02 = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
shield05 = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
shield06 = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
appearbig = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
appearQ = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
appearsmall = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
jineng = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
-1.5,
-0.48
}
},
jinengenemy = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
1.5,
-0.48
}
},
Health = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
jiguang_shouji = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0.49,
0.56,
-0.33
}
},
bubble = {
mirror = false,
y_scale = false,
container_index = -1,
top_cover_offset = false,
offset = {
0,
0.1,
-0.85
}
},
hit_bubble = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
1.8,
0
}
},
EVDdowm = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
-0.75,
2.31,
-1.82
}
},
baiquan = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
kinbuli_skill = {
mirror = true,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
-0.12,
-2.41,
0.5
}
},
ginbuli_skill = {
mirror = true,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
-0.28,
-2.02,
-0.98
}
},
shock = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
-1.5,
2,
0
}
},
Pojia01 = {
mirror = false,
y_scale = false,
container_index = -1,
top_cover_offset = false,
offset = {
0,
1,
0
}
},
zhihuiRing02 = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
0,
-0.5,
0
}
},
zhihuiRing02_buff = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
fangkongRing02 = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
0,
-0.5,
0
}
},
shield03 = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
shield03_1 = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
bisimai_buff = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
1,
0
}
},
shengdiyage_chuchang = {
mirror = true,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
-2.8,
0
}
},
music_AlertArea = {
mirror = false,
y_scale = true,
container_index = -1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
juguangdeng_STG = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
-5,
8,
0
}
},
juguangdeng_BOSS = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
-3,
2,
0
}
},
music_huanraoyinfu_changliangdanchuan = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
0,
0.2,
0
}
},
music_huanraoyinfu_fusangdanchuan = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
0,
0.2,
0
}
},
music_huanraoyinfu_gaoxiongdanchuan = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
0,
0.2,
0
}
},
music_huanraoyinfu_yishidanchuan = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
0,
0.2,
0
}
},
jiejie_dunpai = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
4.5,
0
}
},
hanbingquyu_beiji = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
-1
}
},
hanbingquyu_jiansu = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
0,
4.5,
0
}
},
dianliu_BB = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
-0.5,
0.8,
0
}
},
dianliu_CA = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
-0.5,
0.8,
0
}
},
dianliu_CL = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
-0.5,
0.8,
0
}
},
dianliu_CV = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
-0.5,
1.2,
0
}
},
dianliu_DD = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
-0.5,
0.8,
0
}
},
dianliu_unknown1 = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
0,
2,
0
}
},
bullet_elf = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
-1.5,
3.5,
0
}
},
AL_Laser01 = {
mirror = false,
y_scale = false,
container_index = -1,
top_cover_offset = true,
offset = {
0,
0,
0
}
},
AL_Laser02 = {
mirror = false,
y_scale = false,
container_index = -1,
top_cover_offset = true,
offset = {
0,
0,
0
}
},
hololive_laser01 = {
mirror = false,
y_scale = false,
container_index = -1,
top_cover_offset = true,
offset = {
0,
0,
0
}
},
hololive_laser02 = {
mirror = false,
y_scale = false,
container_index = -1,
top_cover_offset = true,
offset = {
0,
0,
0
}
},
music_laser01 = {
mirror = false,
y_scale = false,
container_index = -1,
top_cover_offset = true,
offset = {
0,
0,
0
}
},
music_laser02 = {
mirror = false,
y_scale = false,
container_index = -1,
top_cover_offset = true,
offset = {
0,
0,
0
}
},
ganraozhe_120 = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
-1.1,
0.6,
0
}
},
ganraozhe_140 = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
-0.5,
0.4,
0
}
},
weixi_qianghua = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
-0.5,
-0.6
}
},
weixi_heihuaSTG = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0.3,
2.4,
-1.2
}
},
qianghuamo_kuangfeng = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
-6.86,
1.8,
-2.75
}
},
qianghuamo_aimierbeierding = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
12.75,
3.04,
-2.75
}
},
qianghuamo_aerjiliya = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0.1,
3.37,
-2.75
}
},
qianghuamo_beiyaen = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0,
3.88,
-2.75
}
},
qianghuamo_bulietani = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
6.82,
2.5,
-2.75
}
},
fengzhijiejie = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
0,
2.36,
0.68
}
},
fengzhijiejie_ceshizhe = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
0,
1.7,
0.68
}
},
Hedandaji_warning = {
mirror = false,
y_scale = true,
container_index = 1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
Shield_enemy = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0.08,
1.24,
0
}
},
hudie_heise = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0.5,
0,
0
}
},
hudie_hongse = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0.5,
0,
0
}
},
juguangdeng_xingguang_STG = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
-5,
8,
0
}
},
juguangdeng_xingguang_BOSS = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
2,
7.5,
0
}
},
bullet_ta02 = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
-1.5,
3.5,
0
}
},
plane_shadow = {
mirror = false,
y_scale = false,
container_index = 4,
top_cover_offset = false,
offset = {
0,
-4,
0
}
},
plane_yinzhang_single = {
mirror = false,
y_scale = false,
container_index = -1,
top_cover_offset = false,
offset = {
-0.2,
0,
0
}
},
plane_yinzhang_double = {
mirror = false,
y_scale = false,
container_index = -1,
top_cover_offset = false,
offset = {
0,
0,
0
}
},
plane_yinzhang_single_xiaolong = {
mirror = false,
y_scale = false,
container_index = -1,
top_cover_offset = false,
offset = {
-0.32,
0.05,
0
}
},
plane_miaozhun = {
mirror = false,
y_scale = false,
container_index = -1,
top_cover_offset = false,
offset = {
0,
0.3,
0
}
},
heihailunna_shadow = {
mirror = false,
y_scale = false,
container_index = 1,
top_cover_offset = false,
offset = {
0.3,
2.4,
-1.2
}
},
robot_yglh = {
mirror = false,
y_scale = false,
container_index = 2,
top_cover_offset = false,
offset = {
-2,
1.5,
0
}
}
}
return
|
local moonScale,sunScale = GetConVarNumber("sf_moonscale",6),30
local clamp,abs,max,min = math.Clamp,math.abs,math.max,math.min
timer.Create("SF_MoonWatcher",1,0,function()
moonScale = GetConVarNumber("sf_moonscale",6)
sunScale = StormFox.GetData("SunSize", 30) or 30
end)
-- render.OverrideBlendFunc is to be replaced by render.OverrideBlend .. we need to be sure both versions work (Chrome and current).
local function render_OverrideBlend(enabled, srcBlend, destBlend, blendFunc, srcBlendAlpha, destBlendAlpha, blendFuncAlpha)
if render.OverrideBlendFunc then
render.OverrideBlendFunc( enabled, srcBlend, destBlend, srcBlendAlpha, destBlendAlpha )
end
end
if render.OverrideBlend then
render_OverrideBlend = render.OverrideBlend
end
-- Moon smoothness
local catch_p,catch_r = 0,0
hook.Add("StormFox - NetDataChange","StormFox - MoonSmooth",function(var,day)
if var ~= "Moon-offset_p" then return end
catch_p = 0
catch_r = 0
end)
-- Sun and Moon data
-- Calc angle and visibility
local moonAng,sunAng = Angle(0,0,0),Angle(0,0,0)
local moonVisible,sunVisible,sunRayVis = 0,0,0
local BG_Color = Vector(0,0,0) -- This is the "moon color" for the unlit moon area
local moon_lock = GetConVar("sf_moonphase")
hook.Add("Think","StormFox_CalcSunMon",function()
local t = StormFox.GetTime()
local pitch = ((t / 360) - 1) * 90
if pitch < 0 then pitch = pitch + 360 end
local ang = Angle(pitch,StormFox.GetSunMoonAngle(), 0)
-- Moon angle
if moon_lock:GetInt() ~= 1 then
moonAng = Angle(ang.p,ang.y,ang.r)
else
local p_offset,r_offset = StormFox.GetNetworkData("Moon-offset_p",0),StormFox.GetNetworkData("Moon-offset_r",0)
-- Smooth clientside move
local p = t / 1440
local c_offset_p = max(12.2 * p,catch_p)
local c_offset_r = max(0.98 * p,catch_r)
catch_p = max(catch_p,c_offset_p)
catch_r = max(catch_r,c_offset_r)
moonAng = Angle((ang.p + p_offset + c_offset_p) % 360,ang.y,ang.r)
moonAng:RotateAroundAxis(moonAng:Up(),math.cos((r_offset + c_offset_r) % 360) * 28.5)
moonAng = moonAng:Forward():Angle()
moonAng = moonAngG or moonAng
end
-- SunAngle
sunAng = Angle(ang.p + 180,ang.y,ang.r)
-- Calc moon_bgcolor
local tc,bc = (StormFox.GetData("SkyTopColor") or Color(51,127.5,255)),(StormFox.GetData("SkyBottomColor") or Color(204,255,255))
local hdr = 0
BG_Color = Vector(tc.r / 255 + hdr ,tc.g / 255+ hdr ,tc.b / 255 + hdr )
-- Calc visible
if not LocalPlayer() then return end
if not _STORMFOX_SUNPIX then -- Create pixel
_STORMFOX_SUNPIX = util.GetPixelVisibleHandle()
else
sunVisible = util.PixelVisible( LocalPlayer():GetPos() + sunAng:Forward() * 4096, 256, _STORMFOX_SUNPIX ) * clamp(sunScale / 30,0,1)
end
if not _STORMFOX_SUNRAYPIX then -- Create pixel
_STORMFOX_SUNRAYPIX = util.GetPixelVisibleHandle()
else
sunRayVis = util.PixelVisible( LocalPlayer():GetPos() + sunAng:Forward() * 4096, 256 * 4, _STORMFOX_SUNRAYPIX ) * clamp(sunScale / 30,0,1)
end
if not _STORMFOX_MOONPIX then -- Create pixel
_STORMFOX_MOONPIX = util.GetPixelVisibleHandle()
else
moonVisible = util.PixelVisible( LocalPlayer():GetPos() + moonAng:Forward() * 4096, moonScale * 28, _STORMFOX_MOONPIX )
end
end)
function StormFox.GetMoonAngle(time)
if not time then return moonAng end
local pitch = ((time / 360) - 1) * 90
if pitch < 0 then pitch = pitch + 360 end
return Angle(pitch,StormFox.GetSunMoonAngle(), 0)
end
function StormFox.GetSunAngle(time)
if not time then return sunAng end
local pitch = ((time / 360) - 1) * 90 + 180
if pitch < 0 then pitch = pitch + 360 end
return Angle(pitch,StormFox.GetSunMoonAngle(), 0)
end
function StormFox.GetMoonVisibility()
return moonVisible
end
local sum_a = 1
function StormFox.GetSunVisibility()
return sunVisible * sum_a
end
function StormFox.GetSunRayVisibility()
return clamp(sunRayVis * 20,0,1) * sum_a
end
function StormFox.GetMoonScale()
return moonScale or 6
end
-- Suninfo support
_old_util_GetSunInfo = _old_util_GetSunInfo or util.GetSunInfo() -- Just in case
function util.GetSunInfo()
if not sunAng or not sunVisible or not StormFox then -- In case you mess with stuff
return _old_util_GetSunInfo()
end
local tab = {}
tab.direction = sunAng:Forward()
tab.obstruction = sunVisible * sum_a
return tab
end
-- MoonPhases
-- Setup params and vars
local params = {}
params[ "$basetexture" ] = ""
params[ "$translucent" ] = 1
params[ "$vertexalpha" ] = 1
params[ "$vertexcolor" ] = 1
params[ "$nofog" ] = 1
params[ "$nolod" ] = 1
params[ "$nomip" ] = 1
params["$additive"] = 1
local CurrentMoonTexture = CreateMaterial("SF_RENDER_MOONTEX","UnlitGeneric",params)
local params = {}
params[ "$basetexture" ] = ""
params[ "$translucent" ] = 1
params[ "$vertexalpha" ] = 1
params[ "$vertexcolor" ] = 1
params[ "$nofog" ] = 1
params[ "$nolod" ] = 1
params[ "$nomip" ] = 1
params[ "$additive" ] = 0
params[ "$color" ] = "[0 0 0]"
local DarkMoonTexture = CreateMaterial("SF_RENDER_MOONTEX_DARK","UnlitGeneric",params)
local lastMat = ""
local Mask_25,Mask_0,Mask_50,Mask_75 = Material("stormfox/moon_phases/25.png"),Material("stormfox/moon_phases/0.png"),Material("stormfox/moon_phases/50.png"),Material("stormfox/moon_phases/75.png")
local texscale = 512
local RTMoonTexture = GetRenderTargetEx( "StormfoxMoon", texscale, texscale, 1, MATERIAL_RT_DEPTH_NONE, 2, CREATERENDERTARGETFLAGS_UNFILTERABLE_OK, IMAGE_FORMAT_RGBA8888)
local lastRotation,lastCurrentPhase = -1,-1
local lastMoonMat = ""
local function RenderMoonPhase(rotation,currentPhase)
-- Check if there is a need to re-render
local moonMat = Material(StormFox.GetData("MoonTexture") or "stormfox/effects/moon.png")
rotation = rotation or 0
currentPhase = currentPhase or 1.3
if lastRotation == rotation and lastCurrentPhase == currentPhase and lastMoonMat == moonMat then
-- Already rendered
return true
end
lastRotation = rotation
lastCurrentPhase = currentPhase
lastMoonMat = moonMat
-- Set dark texture
DarkMoonTexture:SetTexture("$basetexture",moonMat:GetTexture("$basetexture"))
render.PushRenderTarget( RTMoonTexture )
render.OverrideAlphaWriteEnable( true, true )
render.ClearDepth()
render.Clear( 0, 0, 0, 0 )
cam.Start2D()
-- Render moon
surface.SetDrawColor(255,255,255)
surface.SetMaterial(moonMat)
surface.DrawTexturedRectUV(0,0,texscale,texscale,0,0,1,1)
-- Mask Start
-- render.OverrideBlendFunc( true, BLEND_ZERO, BLEND_SRC_ALPHA, BLEND_DST_ALPHA, BLEND_ZERO )
render_OverrideBlend(true, BLEND_ZERO, BLEND_SRC_ALPHA,0,BLEND_DST_ALPHA, BLEND_ZERO,0)
-- Render mask
surface.SetDrawColor(Color(255,255,255,255))
-- 0 to 50%
if currentPhase < 2.9 then
local s = 7 - 2.3 * currentPhase
surface.SetMaterial(Mask_25)
surface.DrawTexturedRectRotated(texscale / 2,texscale / 2,texscale * s,texscale,rotation)
if currentPhase >= 2.6 then
-- Ex step
local x,y = math.cos(math.rad(-rotation)),math.sin(math.rad(-rotation))
surface.SetMaterial(Mask_0)
surface.DrawTexturedRectRotated(texscale / 2 + x * (-texscale * 0.5),texscale / 2 + y * (-texscale * 0.5),texscale * 0.9,texscale,rotation)
end
elseif currentPhase < 3.1 then -- 50%
local s = 1
surface.SetMaterial(Mask_50)
surface.DrawTexturedRectRotated(texscale / 2,texscale / 2,texscale * s,texscale,rotation)
elseif currentPhase < 4.9 then -- 50% to 100%
-- 5.8 to 0.4
local s = (3.176 * currentPhase) - 9.76
surface.SetMaterial(Mask_75)
surface.DrawTexturedRectRotated(texscale / 2,texscale / 2,texscale * s,texscale,rotation + 180)
if s < 1 then
local x,y = math.cos(math.rad(-rotation)),math.sin(math.rad(-rotation))
surface.SetMaterial(Mask_0)
surface.DrawTexturedRectRotated(texscale / 2 + x * (-texscale * 0.5),texscale / 2 + y * (-texscale * 0.5),texscale * 0.9,texscale,rotation + 180)
end
else
-- FULL MOON
end
-- Mask End
render_OverrideBlend(false)
render.OverrideAlphaWriteEnable( false )
cam.End2D()
render.OverrideAlphaWriteEnable( false )
render.PopRenderTarget()
CurrentMoonTexture:SetTexture("$basetexture",RTMoonTexture)
end
function StormFox.GetMoonPhaseRaw()
return lastCurrentPhase
end
function StormFox.GetMoonMaterial()
return CurrentMoonTexture,DarkMoonTexture,lastRotation
end
-- SkyGuard (Render stuff in the right order)
hook.Add("PostDraw2DSkyBox", "StormFox - SkyBoxRender", function()
if not StormFox.MapOBBCenter then return end
local c_pos = StormFox.GetEyePos() or EyePos()
local map_center = StormFox.MapOBBCenter() or Vector(0,0,0)
hook.Run("StormFox - StarRender", c_pos, map_center)
hook.Run("StormFox - TopSkyRender", c_pos, map_center) -- For moon and sun
hook.Run("StormFox - RenderAboveSkies", c_pos, map_center) -- Above skies
hook.Run("StormFox - RenderClouds", c_pos, map_center) -- Skies
hook.Run("StormFox - RenderUnderClouds",c_pos, map_center) -- Under skies
end)
local atan2 = math.atan2
-- Render Sun and moon
local MoonGlow = Material("stormfox/moon_glow")
local MoonMat = Material( "stormfox/moon_fix" );
local sunMat = Material("stormfox/moon_glow")
local sunC = Color(255,255,255)
hook.Add("StormFox - TopSkyRender","StormFox - SunAndMoon",function()
-- moonScale,sunScale
local eyeang = EyeAngles()
-- Angle
local SunN = -sunAng:Forward()
local N = moonAng:Forward()
local NN = -N
local sa = moonAng.y
cam.Start3D( Vector( 0, 0, 0 ), eyeang ) -- 2d maps fix
render.OverrideDepthEnable( true, false )
render.SuppressEngineLighting(true)
render.SetLightingMode( 2 )
-- Render sun first
local c_c = StormFox.GetData("SunColor", Color(255,255,255))
local c = Color(c_c.r,c_c.g,c_c.b,c_c.a)
local a = clamp(sunScale / 20,0,1) * 255 * StormFox.CalculateMapLight(StormFox.GetTime()) / 255
c.a = a
sum_a = a / 255
render.SetMaterial(sunMat)
render.DrawQuadEasy( SunN * -200, SunN, 30, 30, c, 0 )
if IsValid(g_SkyPaint) then
g_SkyPaint:SetSunNormal( -SunN)
end
-- Render moon
-- Render texture
-- Calc moonphase from pos
local A = sunAng:Forward() * 14975
local B = moonAng:Forward() * 39
local moonTowardSun = (A - B):Angle()
local C = moonAng
C.r = 0
local dot = C:Forward():Dot(moonTowardSun:Forward())
-- currentYaw
-- PITCH, YAW sunoffset
local p,y = math.AngleDifference(moonTowardSun.p,C.p),math.AngleDifference(moonTowardSun.y,C.y)
local v,ang = WorldToLocal(moonTowardSun:Forward(),Angle(0,0,0),Vector(0,0,0),C)
ang = v:AngleEx(C:Forward()):Forward()
local roll = math.deg(math.atan2(ang.z,ang.y))
local currentPhase = 2.5 - (5.5 * dot) / 2
StormFox.SetNetworkData("MoonPhase",clamp( currentPhase * 1.00,0,5) * 20) -- Override server data
RenderMoonPhase( -sa - roll + 0 ,clamp( currentPhase * 1.00,0,5))
local c = StormFox.GetData("MoonColor",Color(205,205,205))
local a = StormFox.GetData("MoonVisibility",100)
local gda = 0 -- Calc invisibility at colors (180 = 18:00, 0 = 6:00)
if moonAng.p > 190 then
gda = clamp((moonAng.p - 190) / 10,0,1)
elseif moonAng.p < 350 then
gda = 1 - clamp((moonAng.p - 350) / 10,0,1)
end
-- Dark moonarea
BG_Color = BG_Color * (a / 100)
DarkMoonTexture:SetVector("$color",BG_Color)
local moonAlpha = clamp((StormFox.GetData("StarFade",0) - 0.5) * 2,0.01,1) * 255
render.SetMaterial( DarkMoonTexture )
-- local lum = 0.2126 * BG_Color.r + 0.7152 * BG_Color.g + 0.0722 * BG_Color.b
-- print(lum) -- 120 = 5
--
render.DrawQuadEasy( N * 200, NN, moonScale * 5, moonScale * 5, Color(0,0,0, 0 ), sa )
render.SetMaterial( CurrentMoonTexture )
local aa = max(0,(3.125 * a) - 57.5)
render.DrawQuadEasy( N * 200, NN, moonScale * 5, moonScale * 5, Color(c.r,c.g,c.b, aa ), sa )
render.SuppressEngineLighting(false)
render.SetLightingMode( 0 )
render.OverrideDepthEnable( false, false )
render.SetColorMaterial()
cam.End3D()
end)
-- Sunbeam
--sf_allow_sunbeams
local matSunbeams = Material( "pp/sunbeams" )
matSunbeams:SetTexture( "$fbtexture", render.GetScreenEffectTexture() )
hook.Add( "RenderScreenspaceEffects", "StormFox - Sunbeams", function()
if ( not render.SupportsPixelShaders_2_0() ) then return end
local con = GetConVar("sf_allow_sunbeams")
if not con or not con:GetBool() then return end
local lam = StormFox.CalculateMapLight() / 100 - 0.5
local direciton = sunAng:Forward()
local beampos = StormFox.GetEyePos() + direciton * 4096
local scrpos = beampos:ToScreen()
if ( sunRayVis == 0 ) then return end
local dot = ( direciton:Dot( EyeVector() ) - 0.8 ) * 5
if ( dot <= 0 ) then return end
local suna = 255
local slam = max((suna - 155) / 100,0)
if slam >= 0 then
render.UpdateScreenEffectTexture()
matSunbeams:SetFloat( "$darken", .95 )
matSunbeams:SetFloat( "$multiply", abs(lam) * dot * sunRayVis * slam * 1.2)
matSunbeams:SetFloat( "$sunx", scrpos.x / ScrW() )
matSunbeams:SetFloat( "$suny", scrpos.y / ScrH() )
matSunbeams:SetFloat( "$sunsize", .20 )
render.SetMaterial( matSunbeams )
render.DrawScreenQuad()
end
end )
|
local miniGameName = "virus";
local miniGamePath = "miniGames/virus/";
--utils:log(miniGameName, "Loaded");
local miniGameBase = require("miniGames.miniGameBase");
local scene = miniGameBase:newMiniGameScene(miniGameName);
-- Game instructions.
scene.instructions =
"Virus? Why Virus? Well, so that it wasn't gems or candy!" ..
"||Tap symbols to remove adjacent similar symbols, making as large a groups as possible at once.";
-- Amount to shift all elements right and down to center on screen.
scene.xAdj = 50;
scene.yAdj = 360;
-- Game data.
scene.symbols = { };
--- ====================================================================================================================
-- ====================================================================================================================
-- Scene lifecycle Event Handlers
-- ====================================================================================================================
-- ====================================================================================================================
---
-- Handler for the create event.
--
-- @param inEvent The event object.
--
function scene:create(inEvent)
self.parent.create(self, inEvent);
--utils:log(self.miniGameName, "create()");
-- Load graphics.
local imageSheet, sheetInfo = self.resMan:newImageSheet(
"imageSheet", "miniGames." .. miniGameName .. ".imageSheet", miniGamePath .. "imageSheet.png"
);
for i = 1, #self.symbols, 1 do
self.symbols[i]:removeSelf();
self.symbols[i] = nil;
end
self.symbols = { { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { }, { } };
-- Now do the creations and fill up the field.
for y = 1, 14, 1 do
for x = 1, 11, 1 do
local s = display.newSprite(self.resMan:getDisplayGroup("gameGroup"), imageSheet, {
{ name = "empty", start = sheetInfo:getFrameIndex("symbol_empty"), count = 1, time = 9999 },
{ name = "symbol_1", start = sheetInfo:getFrameIndex("symbol_1"), count = 1, time = 9999 },
{ name = "symbol_2", start = sheetInfo:getFrameIndex("symbol_2"), count = 1, time = 9999 },
{ name = "symbol_3", start = sheetInfo:getFrameIndex("symbol_3"), count = 1, time = 9999 }
});
s.gridX = x;
s.gridY = y;
s.gridX = x;
s.gridY = y;
s.x = ((x - 1) * s.width) + self.xAdj;
s.y = ((y - 1) * s.width) + self.yAdj;
table.insert(self.symbols[y], s);
end
end
self:randomizeSymbols();
-- Load sounds.
self.resMan:loadSound("clear", self.sharedResourcePath .. "pop2.wav");
self.resMan:loadSound("win", self.sharedResourcePath .. "harp.wav");
self.resMan:loadSound("resetSound", self.sharedResourcePath .. "buzzer.wav");
end -- End create().
---
-- Handler for the show event.
--
-- @param inEvent The event object.
--
function scene:show(inEvent)
self.parent.show(self, inEvent);
if inEvent.phase == "did" then
--utils:log(self.miniGameName, "show(): did");
for y = 1, 14, 1 do
for x = 1, 11, 1 do
self.symbols[y][x]:addEventListener("touch", function(inEvent) self:symbolTouchHandler(inEvent); end );
end
end
end
end -- End show().
---
-- Handler for the hide event.
--
-- @param inEvent The event object.
--
function scene:hide(inEvent)
self.parent.hide(self, inEvent);
if inEvent.phase == "did" then
--utils:log(self.miniGameName, "hide(): did");
end
end -- End hide().
---
-- Handler for the destroy event.
--
-- @param inEvent The event object.
--
function scene:destroy(inEvent)
self.parent.destroy(self, inEvent);
--utils:log(self.miniGameName, "destroy()");
for y = 1, 14, 1 do
for x = 1, 11, 1 do
self.symbols[y][x]:removeSelf();
self.symbols[y][x] = nil;
end
self.symbols[y] = nil;
end
self.symbols = nil;
end -- End destroy().
---
-- Called when the menu is triggered (either from it being shown or hidden).
--
function scene:menuTriggered()
end -- End menuTriggered().
---
-- Called when the starting countdown begins.
--
function scene:countdownStartEvent()
end -- End countdownStartEvent().
---
-- Called right after "GO!" is displayed to start a game.
--
function scene:startEvent()
end -- End startEvent().
---
-- Called right before "GAME OVER" is shown to end a game.
--
function scene:endEvent()
end -- End endEvent().
--- ====================================================================================================================
-- ====================================================================================================================
-- EnterFrame
-- ====================================================================================================================
-- ====================================================================================================================
---
-- Handler for the enterFrame event.
--
-- @param inEvent The event object.
--
function scene:enterFrame(inEvent)
self.parent.enterFrame(self, inEvent);
end -- End enterFrame().
--- ====================================================================================================================
-- ====================================================================================================================
-- Touch Handler(s)
-- ====================================================================================================================
-- ====================================================================================================================
---
-- Function that handles touch events on the screen generally.
--
-- @param inEvent The event object.
--
function scene:touch(inEvent)
end -- End touch().
---
-- Handles touches on a symbol.
--
-- @param inEvent The event object.
--
function scene:symbolTouchHandler(inEvent)
if inEvent.phase == "ended" then
-- Get a reference to the selected symbol.
local symbol = inEvent.target;
-- Count of how many mathches there are.
local numMatches = 1;
-- Record the sequence of the tapped symbol and empty it. This is necessary or the check logic below won't work.
local origSeq = symbol.sequence;
symbol:setSequence("empty");
-- Now check the rest of the symbols.
local keepGoing = true;
local symbolGrid = self.symbols;
local s1;
while keepGoing do
-- Assume no more matches.
keepGoing = false;
-- Check every symbol in the grid.
for y = 1, 14, 1 do
for x = 1, 11, 1 do
-- Get a reference to the next symbol to check.
local s = symbolGrid[y][x];
-- If it's of the appropriate type and IS NOT empty...
if s.symbolType == symbol.symbolType and s.sequence ~= "empty" then
-- See if the symbol to the left, if any, is the same type and IS empty.
if x > 1 then
s1 = symbolGrid[y][x - 1];
if s1.symbolType == symbol.symbolType and s1.sequence == "empty" then
keepGoing = true;
s:setSequence("empty");
numMatches = numMatches + 1;
end
end
-- See if the symbol to the right, if any, is the same type and IS empty.
if x < 11 then
s1 = symbolGrid[y][x + 1];
if s1.symbolType == symbol.symbolType and s1.sequence == "empty" then
keepGoing = true;
s:setSequence("empty");
numMatches = numMatches + 1;
end
end
-- See if the symbol above, if any, is the same type and IS empty.
if y > 1 then
s1 = symbolGrid[y - 1][x];
if s1.symbolType == symbol.symbolType and s1.sequence == "empty" then
keepGoing = true;
s:setSequence("empty");
numMatches = numMatches + 1;
end
end
-- See if the symbol below, if any, is the same type and IS empty.
if y < 14 then
s1 = symbolGrid[y + 1][x];
if s1.symbolType == symbol.symbolType and s1.sequence == "empty" then
keepGoing = true;
s:setSequence("empty");
numMatches = numMatches + 1;
end
end
end -- End check s.
end -- End x loop.
end -- End y loop.
end -- End do loop.
-- If there's only one match then it wasn't actually a valid move, so abort. Otherwise, hide the tapped symbol
-- and continue on.
if numMatches == 1 then
-- Restore the tapped symbol to it's original sequence (remember that it had to be empty or the above check
-- logic wouldn't work, but we of course don't want it empty now).
symbol:setSequence(origSeq);
return;
end
symbol:setSequence("empty");
self.updateScore(self, numMatches * 2);
audio.play(self.resMan:getSound("clear"));
-- Shift columns downward to fill in blanks. We do this by creating two arrays, an empty array and a visible
-- array. After creating them, we'll empty the symbols on the top of the column according to the contents of
-- the blank array, then fill the bottom from the visible array.
local emptyArray;
local visibleArray;
for x = 1, 11, 1 do
emptyArray = { };
visibleArray = { };
for y = 1, 14, 1 do
local s = symbolGrid[y][x];
if s.sequence == "empty" then
table.insert(emptyArray, s.symbolType);
else
table.insert(visibleArray, s.symbolType);
end
end
local emptyCount = #emptyArray;
for y1 = 1, emptyCount, 1 do
symbolGrid[y1][x].symbolType = "#";
symbolGrid[y1][x]:setSequence("empty");
end
for y2 = 1, #visibleArray, 1 do
symbolGrid[emptyCount + y2][x].symbolType = visibleArray[y2];
symbolGrid[emptyCount + y2][x]:setSequence("symbol_" .. visibleArray[y2]);
end
end
-- Now shift columns left to fill in empty columns. Do this by first going through each column and copying any
-- non-empty columns to a temp array, then setting symbolType and sequence on all elements in symbolGrid according
-- to what's in the temp array. tempGrid is an array of arrays where each sub-array is a column
local tempGrid = {
{ "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#" },
{ "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#" },
{ "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#" },
{ "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#" },
{ "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#" },
{ "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#" },
{ "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#" },
{ "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#" },
{ "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#" },
{ "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#" },
{ "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#" }
};
local tempGridColCount = 0;
for col = 1, 11, 1 do
local emptyCount = 0;
local thisCol = { "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#", "#" };
for row = 1, 14, 1 do
thisCol[row] = symbolGrid[row][col].symbolType;
if symbolGrid[row][col].sequence == "empty" then
emptyCount = emptyCount + 1;
end
end
if emptyCount ~= 14 then
tempGridColCount = tempGridColCount + 1;
tempGrid[tempGridColCount] = thisCol;
end
end
-- Now, set types according to tempGrid.
for col = 1, 11, 1 do
local thisCol = tempGrid[col];
for row = 1, 14, 1 do
local symbolType = thisCol[row];
symbolGrid[row][col].symbolType = symbolType;
if symbolType == "#" then
symbolGrid[row][col]:setSequence("empty");
else
symbolGrid[row][col]:setSequence("symbol_" .. symbolType);
end
end
end
-- Now, see if there's any moves left and reset the board if not. This just means going through each non-empty
-- symbol and see if there's a match in any of the four possible directions.
local noMatch = true;
local numEmpty = 0;
for x = 1, 11, 1 do
for y = 1, 14, 1 do
local symbolType = symbolGrid[y][x].symbolType;
if symbolType ~= "#" then
if x > 1 then
if symbolGrid[y][x - 1].symbolType == symbolType then
noMatch = false;
end
end
if x < 11 then
if symbolGrid[y][x + 1].symbolType == symbolType then
noMatch = false;
end
end
if y > 1 then
if symbolGrid[y - 1][x].symbolType == symbolType then
noMatch = false;
end
end
if y < 14 then
if symbolGrid[y + 1][x].symbolType == symbolType then
noMatch = false;
end
end
else
numEmpty = numEmpty + 1;
end
end
end
if noMatch == true then
if numEmpty == (11 * 14) then
self.updateScore(self, 20);
audio.play(self.resMan:getSound("win"));
else
self.updateScore(self, -500);
end
audio.play(self.resMan:getSound("resetSound"));
self:randomizeSymbols();
end
end -- End ended event.
end -- End symbolTouchHandler().
--- ====================================================================================================================
-- ====================================================================================================================
-- Collision Handler
-- ====================================================================================================================
-- ====================================================================================================================
---
-- Function that handles collision events.
--
-- @param inEvent The event object.
--
function scene:collision(inEvent)
end -- End collision().
--- ====================================================================================================================
-- ====================================================================================================================
-- Game Utility Functions
-- ====================================================================================================================
-- ====================================================================================================================
---
-- Randomize the field of symbols when the game starts or restarts.
--
function scene:randomizeSymbols()
for y = 1, 14, 1 do
for x = 1, 11, 1 do
local s = self.symbols[y][x];
s.symbolType = math.random(1, 3);
s:setSequence("symbol_" .. s.symbolType);
end
end
end -- End randomizeSymbols().
--- ====================================================================================================================
-- ====================================================================================================================
-- ====================================================================================================================
-- ====================================================================================================================
--utils:log(miniGameName, "Attaching lifecycle handlers");
scene:addEventListener("create", scene);
scene:addEventListener("show", scene);
scene:addEventListener("hide", scene);
scene:addEventListener("destroy", scene);
return scene;
|
local conveyor_belt = "conveyor_belts:conveyor_belt_off"
local conveyor_belt_on = "conveyor_belts:conveyor_belt_on"
local belt = "conveyor_belt_top.png"
local belt_on = "conveyor_belt_top_on.png"
local panel = "conveyor_belt_side.png"
local panel_on = "conveyor_belt_side_on.png"
local movement_rules = {}
for facedir = 0,23 do
movement_rules[facedir] = movement_rules[facedir] or {}
local back = minetest.facedir_to_dir(facedir)
local front = vector.multiply(back, -1)
local up = ({[0]={x=0, y=1, z=0},
{x=0, y=0, z=1},
{x=0, y=0, z=-1},
{x=1, y=0, z=0},
{x=-1, y=0, z=0},
{x=0, y=-1, z=0}})[math.floor(facedir/4)]
local right = {x=up.y*back.z - back.y*up.z,
y=up.z*back.x - back.z*up.x,
z=up.x*back.y - back.x*up.y}
local down = vector.multiply(up, -1)
local left = vector.multiply(right, -1)
local cw = {
{up, right},
{right, down},
{down, left},
{left, up}
}
local ccw = {
{up, left},
{right, up},
{down, right},
{left, down}
}
local front_above = vector.add(front, up)
local front_below = vector.add(front, down)
local front_above2 = vector.add(front_above, up)
local front_below2 = vector.add(front_below, down)
local back_above = vector.add(back, up)
local back_below = vector.add(back, down)
local back_above2 = vector.add(back_above, up)
local back_below2 = vector.add(back_below, down)
movement_rules[facedir][front] = cw
movement_rules[facedir][front_above] = cw
movement_rules[facedir][front_below] = cw
movement_rules[facedir][back] = ccw
movement_rules[facedir][back_above] = ccw
movement_rules[facedir][back_below] = ccw
end
local unconveyable = {
"mesecons_pistons:piston_normal_off",
"mesecons_pistons:piston_normal_on",
"mesecons_pistons:piston_pusher_normal",
"mesecons_pistons:piston_sticky_off",
"mesecons_pistons:piston_sticky_on",
"mesecons_pistons:piston_pusher_sticky"
}
local function is_conveyable(nodename)
if unconveyable[nodename] == nil then
return minetest.get_item_group(nodename, "not_conveyable") <= 0
end
return not unconveyable[nodename]
end
local maxpush = mesecon.setting("conveyor_max_push", 1)
local function conveyor_step(pos, node)
for wire_pos, rules in pairs(movement_rules[node.param2]) do
if mesecon.is_power_on(vector.add(pos, wire_pos)) then
for i, move_vector in pairs(rules) do
local origin = vector.add(pos, move_vector[1])
local origin_node = minetest.get_node(origin)
if is_conveyable(origin_node.name) then
local direction = move_vector[2]
local success, stack, oldstack = mesecon.mvps_push(origin, direction, maxpush)
if success then
mesecon.mvps_process_stack(stack)
mesecon.mvps_move_objects(origin, direction, oldstack)
-- Make an additional check for players whose upper body is in range.
local p_below = vector.add(origin, {x=0, y=-1, z=0})
local objects = minetest.get_objects_inside_radius(p_below, 1)
for _, obj in ipairs(objects) do
local entity = obj:get_luaentity()
if not entity or not mesecon.is_mvps_unmov(entity.name) then
local cp = vector.add(origin, direction)
local np = vector.add(obj:getpos(), direction)
--move only if destination is not solid
local nn = minetest.get_node(cp)
if not ((not minetest.registered_nodes[nn.name])
or minetest.registered_nodes[nn.name].walkable) then
obj:setpos(np)
end
end
end
end
end
end
--return
end
end
end
local function conveyor_on(pos, node)
node.name = conveyor_belt_on
minetest.set_node(pos, node)
conveyor_step(pos, node)
end
local function conveyor_off(pos, node)
node.name = conveyor_belt
minetest.set_node(pos, node)
end
local conveyor_mesecons = {effector = {
action_on = conveyor_on,
action_off = conveyor_off
}}
local function belt_textures(belt, panel)
return {
belt.."^[transformR180",
belt,
belt.."^[transformR90",
belt.."^[transformR270",
panel,
panel
}
end
minetest.register_node(conveyor_belt, {
description = "Conveyor Belt",
tiles = belt_textures(belt, panel),
paramtype2 = "facedir",
groups = {conveyor_belt=1, snappy=2, choppy=2, oddly_breakable_by_hand=2, not_conveyable=1},
sounds = default.node_sound_wood_defaults(),
drawtype = "normal",
paramtype = "light",
mesecons = conveyor_mesecons
})
minetest.register_node(conveyor_belt_on, {
description = "Conveyor Belt (Active)",
tiles = belt_textures(belt_on, panel_on),
paramtype2 = "facedir",
drop = conveyor_belt,
groups = {conveyor_belt=1, snappy=2, choppy=2, oddly_breakable_by_hand=2, not_conveyable=1, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(),
drawtype = "normal",
paramtype = "light",
mesecons = conveyor_mesecons
})
local iron = "default:steel_ingot"
if minetest.get_modpath("technic") then
local rubber = "technic:rubber"
local motor = "technic:motor"
minetest.register_craft({
output = conveyor_belt.." 10",
recipe = {
{rubber,rubber,rubber},
{iron, motor, iron},
{rubber,rubber,rubber},
}
})
end
local fiber = 'mesecons_materials:fiber'
local movestone = 'mesecons_movestones:movestone'
minetest.register_craft({
output = conveyor_belt.." 3",
recipe = {
{fiber,fiber,fiber},
{iron, movestone, iron},
{fiber,fiber,fiber},
}
})
|
return "3.4.0-master"
|
--爱莎-虚无之力
function c60150801.initial_effect(c)
--cannot remove
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_HAND)
e3:SetCountLimit(1,60150801)
e3:SetCondition(c60150801.rmcon)
e3:SetCost(c60150801.rmcost)
e3:SetOperation(c60150801.rmop)
c:RegisterEffect(e3)
--
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(60150801,3))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_REMOVE)
e2:SetRange(LOCATION_GRAVE)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetCountLimit(1,60150801)
e2:SetCondition(c60150801.rmcon2)
e2:SetTarget(c60150801.sptg2)
e2:SetOperation(c60150801.rmop2)
c:RegisterEffect(e2)
end
function c60150801.cfilter2(c,tp)
return c:IsControler(1-tp) and c:GetPreviousControler()~=tp
end
function c60150801.rmcon2(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c60150801.cfilter2,1,nil,tp)
end
function c60150801.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c60150801.rmop2(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0xfe0000)
e1:SetValue(LOCATION_REMOVED)
c:RegisterEffect(e1)
--xyz limit
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(60150822,0))
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CLIENT_HINT)
e4:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
e4:SetReset(RESET_EVENT+0xfe0000)
e4:SetValue(c60150801.xyzlimit)
c:RegisterEffect(e4)
end
end
function c60150801.xyzlimit(e,c)
if not c then return false end
return not (c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_SPELLCASTER))
end
function c60150801.sumlimit(e,c,sump,sumtype,sumpos,targetp,se)
return not (c:IsSetCard(0x3b23) and c:IsAttribute(ATTRIBUTE_DARK))
end
function c60150801.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x3b23)
end
function c60150801.rmcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c60150801.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c60150801.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleasable() end
Duel.Release(e:GetHandler(),REASON_COST)
local opt=Duel.SelectOption(tp,aux.Stringid(60150801,1),aux.Stringid(60150801,2))
e:SetLabel(opt)
end
function c60150801.rmop(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()==0 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_RANGE)
e1:SetCode(EFFECT_TO_GRAVE_REDIRECT)
e1:SetTarget(c60150801.rmtarget)
e1:SetTargetRange(0,0xff)
e1:SetValue(LOCATION_REMOVED)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
if e:GetLabel()==1 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_REMOVE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(0,1)
e1:SetValue(1)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
--30459350 chk
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(30459350)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(0,1)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
end
function c60150801.rmtarget(e,c)
return c:GetOwner()~=e:GetHandlerPlayer()
end |
local current_working_directory = require 'current_working_directory'
local requester_path = require 'requester_path'
local file_exists = require 'file_exists'
local function get_directories(path)
local directories = {}
while path and path ~= '' do
table.insert(directories, path)
path = path:match('^(.*/)[^%/]+')
end
return directories
end
local function is_relative(path)
return path:match('^%.')
end
local function normalize(path)
return path:gsub('/%./', '/'):gsub('/[^/]+/../', '/')
end
local function find_module(module_name)
local requester_path = requester_path(3)
local current_path = is_relative(requester_path) and
current_working_directory() .. requester_path or
requester_path
current_path = normalize(current_path)
if is_relative(module_name) then
local file = normalize(current_path .. module_name .. '.lua')
if file_exists(file) then return file end
else
for _, directory in ipairs(get_directories(current_path)) do
local file = directory .. 'node_modules/' .. module_name .. '/index.lua'
if file_exists(file) then return file end
end
end
end
local m = {
cache = {}
}
return setmetatable(m, {
__call = function(_, module_name)
local module = find_module(module_name)
assert(module, "Could not find module '" .. module_name .. "'")
if not m.cache[module] then
local loaded = loadfile(module)()
m.cache[module] = loaded == nil or loaded
end
return m.cache[module]
end
})
|
--
-- Please see the readme.txt file included with this distribution for
-- attribution and copyright information.
--
stackcolumns = 2;
stackiconsize = { 47, 27 };
stackspacing = { 0, 0 };
stackoffset = { 5, 2 };
dockiconsize = { 91, 86 };
dockspacing = 4;
dockoffset = { 10, 9 };
stackcontrols = {};
dockcontrols = {};
subdockcontrols = {};
delayedCreate = {};
-- Chat window registration for general purpose message dispatching
function registerContainerWindow(w)
window = w;
-- Create controls that were requested while the window wasn't ready
for k, v in pairs(delayedCreate) do
v();
end
-- Add event handler for the window resize event
window.onSizeChanged = updateControls;
end
-- Recalculate control locations
function updateControls()
local maxy = 0;
-- Stack (the small icons)
for k, v in pairs(stackcontrols) do
local n = k-1;
local row = math.floor(n / stackcolumns);
local column = n % stackcolumns;
v.setStaticBounds((stackspacing[1] + stackiconsize[1]) * column + stackoffset[1], (stackspacing[2] + stackiconsize[2]) * row + stackoffset[2], stackiconsize[1], stackiconsize[2]);
maxy = (stackspacing[2] + stackiconsize[2]) * (row+1) + stackoffset[2]
end
-- Calculate remaining available area
local winw, winh = window.getSize();
local availableheight = winh - maxy;
local controlcount = #dockcontrols + #subdockcontrols;
local neededheight = (dockspacing + dockiconsize[2]) * controlcount;
local scaling = 1;
if availableheight < neededheight then
scaling = (availableheight - dockspacing * controlcount) / (dockiconsize[2] * controlcount);
end
-- Dock (the resource books)
for k, v in pairs(dockcontrols) do
local n = k-1;
v.setStaticBounds(dockoffset[1] + (1-scaling)*dockiconsize[1]/2, maxy + (dockspacing + math.floor(dockiconsize[2]*scaling)) * n + dockoffset[2], math.floor(dockiconsize[1]*scaling), math.floor(dockiconsize[2]*scaling));
end
-- Subdock (the token icon)
for k, v in pairs(subdockcontrols) do
v.setStaticBounds(dockoffset[1] + (1-scaling)*dockiconsize[1]/2, winh - dockspacing*(k-1) - math.floor(dockiconsize[2]*scaling) * k, math.floor(dockiconsize[1]*scaling), math.floor(dockiconsize[2]*scaling));
end
end
function registerStackShortcut(iconNormal, iconPressed, tooltipText, className, recordName)
function createFunc()
createStackShortcut(iconNormal, iconPressed, tooltipText, className, recordName);
end
if window == nil then
table.insert(delayedCreate, createFunc);
else
createFunc();
end
end
function createStackShortcut(iconNormal, iconPressed, tooltipText, className, recordName)
local control = window.createControl("desktop_stackitem", tooltipText);
table.insert(stackcontrols, control);
control.setIcons(iconNormal, iconPressed);
control.setValue(className, recordName or "");
control.setTooltipText(tooltipText);
updateControls();
end
function registerDockShortcut(iconNormal, iconPressed, tooltipText, className, recordName, useSubdock)
function createFunc()
createDockShortcut(iconNormal, iconPressed, tooltipText, className, recordName, useSubdock);
end
if window == nil then
table.insert(delayedCreate, createFunc);
else
createFunc();
end
end
function createDockShortcut(iconNormal, iconPressed, tooltipText, className, recordName, useSubdock)
local control = window.createControl("desktop_dockitem", tooltipText);
if useSubdock then
table.insert(subdockcontrols, control);
else
table.insert(dockcontrols, control);
end
control.setIcons(iconNormal, iconPressed);
control.setValue(className, recordName or "");
control.setTooltipText(tooltipText);
updateControls();
end
|
--------------------------------
-- Constrint Satisfiction Problem (CSP)
-- Author: Shuo Li
-- Date: 2012/11/26
--------------------------------
require "Object"
require "Ulti"
--------------------------------
--[[ Constraint class ]]
--------------------------------
Constraint = Object
Constraint.ClassName = "Constraint"
------------------------
-- Attribute field
------------------------
Constraint.V = {} -- Variable set
Constraint.f = {} -- Satisfiction function
Constraint.arg = nil -- Arguments for the satisfiction function
------------------------
-- Method field
------------------------
-- Check if an assignment is valid for the constraint
function Constraint:IsValidOn(S)
if self.f ~= nil then
if type(self.f) == "function" then
if #self.V ~= #S then return false, "Invalid values" end
return self.f(S, self.arg)
end
end
return false, "Constraint function is not set"
end
--
------------------------
-- Constructor
------------------------
function Constraint:new(V, f, arg)
self.V = V
self.f = f
self.arg = arg
return deepcopy(self)
end
--
--------------------------------
--[[ Constraint Store Class ]]
--------------------------------
Store = Object:new()
Store.ClassName = "Store"
------------------------
-- Attribute field
------------------------
Store.U = {} -- Attached values
-- Example: U = {a = {0, 1}, b = {2, 1}}
------------------------
-- Method field
------------------------
-- Check if the current store is strictly stronger than another store
function Store:IsStrictlyStrongerThan(anotherStore)
if #self.U ~= #anotherStore.U then return false, "Different number of variables" end
for k, v in pairs(self.U) do
-- v is values of key: k in the current store
-- a is values of key: k in anotherStore
local a = anotherStore.U[k]
if #a < #v then
return false, "Current store has more assignments for [ " .. k .. " ]."
end
for _, val in pairs(v) do
if not table.contains(a, val) then return false, "Current store has more assignment: [ " .. k .. "-> " .. val .. " ]." end
end
end
return true
end
--
-- Branch
function Store:Branch(v)
local result = self:Child(v, 1)
-- remove the first child from store
table.remove(self.U[v], 1)
return result
end
--
-- Child
function Store:Child(v, n)
if self.U[v] == nil then return nil, "No variable: [ " .. v .. " ]." end
if #self.U[v] < n then return nil, "Index exceeds child count on variable: [ " .. v .. " ]." end
local result = deepcopy(self)
local temp = deepcopy(result.U[v][n])
result.U[v] = {temp}
return result
end
--
-- Override operator <
Store:Override("__lt", function (Store, anotherStore)
return Store:IsStrictlyStrongerThan(anotherStore)
end)
--
------------------------
-- Constructor
------------------------
function Store:new(V, U)
--self.V = V
self.U = U
return deepcopy(self)
end
--
--------------------------------
--[[ Store Stack ]]
--------------------------------
StoreStack = Object:new()
StoreStack.ClassName = "StoreStack"
------------------------
-- Attribute field
------------------------
StoreStack.List = {} -- Stack content
------------------------
-- Method field
------------------------
-- GetCount
function StoreStack:GetCount()
return #self.List
end
--
-- Pop
function StoreStack:Pop()
local result = deepcopy(self.List[#self.List])
self.List[#self.List] = nil
return result
end
--
-- Push
function StoreStack:Push(s)
self.List[#self.List + 1] = s
end
--
------------------------
-- Constructor
------------------------
function StoreStack:new(V, U)
self.List = {{V = V, U = U}}
return deepcopy(self)
end
--
--------------------------------
--[[ Search Function ]]
--------------------------------
-- Branch
function Branch(U, v)
local result = Child(U, v, 1)
-- remove the first child from store
table.remove(U[v], 1)
return result
end
--
-- Child
function Child(U, v, n)
if U[v] == nil then return nil, "No variable: [ " .. v .. " ]." end
if #U[v] < n then return nil, "Index exceeds child count on variable: [ " .. v .. " ]." end
local result = deepcopy(U)
local temp = deepcopy(result[v][n])
result[v] = {temp}
return result
end
--
--------------------------------
--[[ Constraint functions ]]
--------------------------------
-- Distinct variable values
function DistinctSingle(inputU)
local U = Flatten(inputU)
if #U <= 1 then return true end
for i, ival in ipairs(U) do
for j, jval in ipairs(U) do
if i ~= j then
if ival == jval then return false end
end
end
end
return true
end
--
-- Distinct over value ranges
-- Need at least one variable to be set
--[[ Example:
tf, arg = DistinctRange({a = {0, 1}, b = {3, 2}, c = {2, 3, 1, 0, 4}})
print(tf)
if tf then PrintTable(arg, " ")
else print(arg) end
]]
function DistinctRange(inputU)
local hasSingleAssignment = false
local variableHasSingleValue = nil
local avoidValue = nil
for k, v in pairs(inputU) do
if #v == 1 then
hasSingleAssignment = true
variableHasSingleValue = deepcopy(k)
avoidValue = v[1]
break
end
end
if not hasSingleAssignment then
for k, v in pairs(inputU) do
for key, val in pairs(inputU) do
if k ~= key then
for _, v in pairs(inputU[key]) do
if table.contains(inputU[k], v) then
return true, inputU
end
end
end
end
end
return true, inputU
end
local outputU = deepcopy(inputU)
for k, v in pairs(outputU) do
if k ~= variableHasSingleValue then
local i = 1
while i <= #outputU[k] do
if outputU[k][i] == avoidValue then
table.remove(outputU[k], i)
if #outputU[k] == 0 then
return false, "Non-valid solution"
end
else i = i + 1 end
end
end
end
return true, outputU
end
--
-- Sum of variable values
function Sum(inputU, sum)
local sumResult = 0
for k, v in pairs(inputU) do
if #v ~= 1 then
return false, "All variables should be set."
else
sumResult = sumResult + v[1]
end
end
if sumResult == sum[1] then return true, inputU end
return false, "Wrong sum"
end
--
function MergeSolutions(S)
local result = {}
for _, v in pairs(S) do
for var, val in pairs(v) do
if result[var] == nil then result[var] = {} end
for _, v in pairs(val) do
if not table.contains(result[var], v) then table.insert(result[var], deepcopy(v)) end
end
end
end
return result
end
--
--------------------------------
--[[ CSP Class ]]
--------------------------------
CSP = Object:new()
CSP.ClassName = "CSP"
------------------------
-- Attribute field
------------------------
CSP.V = {} -- Variables
CSP.U = {} -- Variable value universe
CSP.f = {{}} -- {{Propagation function, arguments}}
------------------------
-- Method field
------------------------
-- DFS Solve
function CSP:DFSSolve()
local s = Store:new(self.V, self.U)
if #self.f < 1 then
return u
end
local sol = {U}
local i = 1
while i <= #self.f do
local t = self.f[i]
local func = t.f
local arg = t.arg
local nextStore = {}
for _, v in pairs(sol) do
local result = DFS(Store:new(self.V, v), StoreStack:new(), func, arg)
TAddRange(nextStore, result)
end
sol = MergeSolutions(nextStore)
i = i + 1
end
return sol
end
--
------------------------
-- Constructor
------------------------
function CSP:new(V, U, f)
self.V = V
self.U = U
self.f = f
return deepcopy(self)
end
--
|
local shopName={
{name="新手村.杂货店",pic="场景.商店",music="音乐.城市3",},
{name="洛阳.商店.新手",pic="场景.商店",music="音乐.城市3",},
{name="洛阳.商店",pic="场景.商店",music="音乐.城市3",},
{name="洛阳.商店.神秘",pic="场景.商店",music="音乐.城市3",},
{name="长安.商店",pic="场景.商店2",music="音乐.武侠进行",},
{name="武道大会.VIP1",pic="地图.比武场",music="音乐.武侠进行",},
{name="武道大会.VIP2",pic="地图.比武场",music="音乐.武侠进行",},
{name="武道大会.VIP3",pic="地图.比武场",music="音乐.武侠进行",},
{name="武道大会.VIP4",pic="地图.比武场",music="音乐.武侠进行",},
{name="武道大会.VIP5",pic="地图.比武场",music="音乐.武侠进行",},
}
return shopName |
-- Put functions in this file to use them in several other scripts.
-- To get access to the functions, you need to put:
-- require "AlgoLua.Api.Indexer"
-- in any script using the functions.
-- Indexer API reference: https://developer.algorand.org/docs/rest-apis/indexer/
local http_client = require("AlgoLua.Api.HttpClient")
local http_utils = require("AlgoLua.Api.HttpUtils")
local Indexer = {
address = nil,
token = nil
}
local function headers()
return {
["x-api-key"] = Indexer.token,
["X-Indexer-API-Token"] = Indexer.token
}
end
-- @Method:
-- Indexer.health
-- Returns 200 if healthy.
-- @Input:
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.health(on_success, on_error)
http_client.get(Indexer.address .. "/health", headers(), on_success, on_error)
end
-- @Method:
-- Indexer.accounts
-- Search for accounts.
-- @Input:
-- - address: string
-- - params: table {
-- application-id: integer,
-- asset-id: integer,
-- auth-addr: string,
-- currency-greater-than: integer,
-- currency-less-than: integer,
-- include-all: boolean,
-- limit: integer,
-- next: string,
-- round: integer
-- } | nil
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.accounts(params, on_success, on_error)
http_client.get(Indexer.address .. "/v2/accounts?" .. http_utils.query_string(params), headers(), on_success, on_error)
end
-- @Method:
-- Indexer.accounts
-- Lookup account information.
-- @Input:
-- - account_id: string
-- - params: table {
-- include-all: boolean,
-- round: integer
-- } | nil
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.account(account_id, params, on_success, on_error)
http_client.get(Indexer.address .. "/v2/accounts/" .. account_id .. "?" .. http_utils.query_string(params), headers(), on_success, on_error)
end
-- @Method:
-- Indexer.account_transactions
-- Lookup account transactions.
-- @Input:
-- - account_id: string
-- - params: table {
-- after-time: string (date-time),
-- asset-id: boolean,
-- before-time: string (date-time),
-- currency-greater-than: integer,
-- currency-less-than: integer,
-- limit: integer,
-- max-round: integer,
-- min-round: integer,
-- next: string,
-- note-prefix: string,
-- rekey-to: boolean,
-- round: integer,
-- sig-type: enum (sig, msig, lsig),
-- tx-type: enum (pay, keyreg, acfg, axfer, afrz, appl),
-- txid: string
-- } | nil
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.account_transactions(account_id, params, on_success, on_error)
http_client.get(Indexer.address .. "/v2/accounts/" .. account_id .. "/transactions?" .. http_utils.query_string(params), headers(), on_success, on_error)
end
-- @Method:
-- Indexer.applications
-- Search for applications.
-- @Input:
-- - params: table {
-- application-id: integer,
-- include-all: boolean,
-- limit: integer,
-- next: string,
-- } | nil
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.applications(params, on_success, on_error)
http_client.get(Indexer.address .. "/v2/applications?" .. http_utils.query_string(params), headers(), on_success, on_error)
end
-- @Method:
-- Indexer.application
-- Lookup application.
-- @Input:
-- - application_id: integer
-- - params: table {
-- include-all: boolean
-- } | nil
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.application(application_id, params, on_success, on_error)
http_client.get(Indexer.address .. "/v2/applications/" .. application_id .. "?" .. http_utils.query_string(params), headers(), on_success, on_error)
end
-- @Method:
-- Indexer.application
-- Lookup application logs.
-- @Input:
-- - application_id: integer
-- - params: table {
-- limit: integer,
-- max-round: integer,
-- min-round: integer,
-- next: string,
-- sender-address: string,
-- txid: string
-- } | nil
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.application_logs(application_id, params, on_success, on_error)
http_client.get(Indexer.address .. "/v2/applications/" .. application_id .. "/logs?" .. http_utils.query_string(params), headers(), on_success, on_error)
end
-- @Method:
-- Indexer.assets
-- Search for assets.
-- @Input:
-- - params: table {
-- asset-id: integer,
-- creator: string,
-- include-all: boolean,
-- limit: integer,
-- next: string,
-- unit: string,
-- } | nil
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.assets(params, on_success, on_error)
http_client.get(Indexer.address .. "/v2/assets?" .. http_utils.query_string(params), headers(), on_success, on_error)
end
-- @Method:
-- Indexer.asset
-- Lookup asset information.
-- @Input:
-- - asset_id: integer
-- - params: table {
-- include-all: boolean,
-- } | nil
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.asset(asset_id, on_success, on_error)
http_client.get(Indexer.address .. "/v2/assets/" .. asset_id .. "?" .. http_utils.query_string(params), headers(), on_success, on_error)
end
-- @Method:
-- Indexer.asset_balances
-- Lookup the list of accounts who hold this asset.
-- @Input:
-- - asset_id: integer
-- - params: table {
-- currency-greater-than: integer,
-- currency-less-than: integer,
-- include-all: boolean,
-- limit: integer,
-- next: string,
-- round: integer,
-- } | nil
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.asset_balances(asset_id, params, on_success, on_error)
http_client.get(Indexer.address .. "/v2/assets/" .. asset_id .. "/balances?" .. http_utils.query_string(params), headers(), on_success, on_error)
end
-- @Method:
-- Indexer.asset_transactions
-- Lookup transactions for an asset.
-- @Input:
-- - asset_id: integer
-- - params: table {
-- address: string,
-- address-role: enum (sender, receiver, freeze-target),
-- after-time: string (date-time),
-- before-time: string (date-time),
-- currency-greater-than: integer,
-- currency-less-than: integer,
-- exclude-close-to: boolean,
-- limit: integer,
-- max-round: integer,
-- min-round: integer,
-- next: string,
-- note-prefix: string,
-- rekey-to: boolean,
-- round: integer,
-- rekey-to: boolean,
-- sig-type: enum (sig, msig, lsig),
-- tx-type: enum (pay, keyreg, acfg, axfer, afrz, appl),
-- txid: string,
-- } | nil
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.asset_transactions(asset_id, params, on_success, on_error)
http_client.get(Indexer.address .. "/v2/assets/" .. asset_id .. "/transactions?" .. http_utils.query_string(params), headers(), on_success, on_error)
end
-- @Method:
-- Indexer.block
-- Lookup block.
-- @Input:
-- - round_number: integer
-- - params: table {
-- address: integer,
-- address-role: enum (sender, receiver, freeze-target),
-- after-time: string (date-time),
-- application-id: integer,
-- asset-id: integer,
-- before-time: string (date-time),
-- currency-greater-than: integer,
-- currency-less-than: integer,
-- exclude-close-to: boolean,
-- limit: integer,
-- max-round: integer,
-- min-round: integer,
-- next: string,
-- note-prefix: string,
-- rekey-to: boolean,
-- round: integer,
-- sig-type: enum (sig, msig, lsig),
-- tx-type: enum (pay, keyreg, acfg, axfer, afrz, appl),
-- txid: string,
-- } | nil
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.block(round_number, params, on_success, on_error)
http_client.get(Indexer.address .. "/v2/blocks/" .. round_number .. "?" .. http_utils.query_string(params), headers(), on_success, on_error)
end
-- @Method:
-- Indexer.transactions
-- Search for transactions.
-- @Input:
-- - params: table {
-- address: integer,
-- address-role: enum (sender, receiver, freeze-target),
-- after-time: string (date-time),
-- application-id: integer,
-- asset-id: integer,
-- before-time: string (date-time),
-- currency-greater-than: integer,
-- currency-less-than: integer,
-- exclude-close-to: boolean,
-- limit: integer,
-- max-round: integer,
-- min-round: integer,
-- next: string,
-- note-prefix: string,
-- rekey-to: boolean,
-- round: integer,
-- sig-type: enum (sig, msig, lsig),
-- tx-type: enum (pay, keyreg, acfg, axfer, afrz, appl),
-- txid: string,
-- } | nil
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.transactions(params, on_success, on_error)
http_client.get(Indexer.address .. "/v2/transactions?" .. http_utils.query_string(params), headers(), on_success, on_error)
end
-- @Method:
-- Indexer.transaction
-- Lookup a single transaction.
-- @Input:
-- - txid: string
-- - on_success: function (data) | nil
-- - on_error: function (data) | nil
function Indexer.transaction(txid, on_success, on_error)
http_client.get(Indexer.address .. "/v2/transactions/" .. txid, headers(), on_success, on_error)
end
return Indexer
|
local _class = {
_name = 'CustomerService',
_version = '1.0'
}
---@public
function _class:new()
local o = {}
setmetatable(o, { __index = self })
self.dataList = Array()
self.pageIndex = 1
self.type = 1
return o
end
---优先加载其他辅助文件
---@private
function _class:loadExtensions()
require("MMLuaKitGallery.Constant")
end
---@public
function _class:rootView()
if self.containerView then
return self.containerView
end
self:loadExtensions()
self:createSubviews()
return self.containerView
end
---@private
function _class:createSubviews()
self:setupContainerView()
self:setupTitleView()
self:contentView()
end
---容器视图
---@public
function _class:setupContainerView()
self.containerView = LinearLayout(LinearType.VERTICAL)
self.containerView:width(MeasurementType.MATCH_PARENT):height(MeasurementType.MATCH_PARENT):bgColor(_Color.White)
if System:iOS() then
self.containerView:marginTop(window:statusBarHeight())
end
end
---导航栏视图
---@public
function _class:setupTitleView()
--导航栏
self.navigation = require("MMLuaKitGallery.NavigationBar"):new()
self.navibar = self.navigation:bar("私聊", nil)
self.containerView:addView(self.navibar)
--返回
self.backBtn = ImageView():width(22):height(22):marginLeft(20):setGravity(MBit:bor(Gravity.LEFT, Gravity.CENTER_VERTICAL))
self.backBtn:image("https://s.momocdn.com/w/u/others/custom/20191107/wutianlong/x9.png")
self.navibar:addView(self.backBtn)
self.backBtn:onClick(function()
Navigator:closeSelf(AnimType.Default)
end)
--客服
self.customer = ImageView():width(22):height(22):marginRight(20):setGravity(MBit:bor(Gravity.RIGHT, Gravity.CENTER_VERTICAL))
self.customer:image("https://s.momocdn.com/w/u/others/2019/09/01/1567316383469-minshare.png")
--self.navibar:addView(self.customer)
end
-- 没有内容 视图
function _class:contentView()
self.noContentView = require("MMLuaKitGallery.NoContentView"):new()
self.containerView:addView(self.noContentView:contentView())
end
_class:new()
window:addView(_class:rootView())
return _class
|
local tests = torch.TestSuite()
local precision = 1e-3
function tests.ErrorCriterionRelative_testDefaults()
local criterion = nnst.ErrorCriterionRelative()
tester:eq(1, criterion.alpha)
tester:eq(0.2, criterion.beta)
end
function tests.ErrorCriterionRelative_testDefaultsBeta()
local criterion = nnst.ErrorCriterionRelative(0.8)
tester:eq(0.8, criterion.alpha)
tester:eq(0.16, criterion.beta)
end
function tests.ErrorCriterionRelative_testError_expected_10()
local criterion = nnst.ErrorCriterionRelative(0.8, 0.16)
local expected = torch.Tensor{10}
tester:eq(0.800, criterion:forward(torch.Tensor{2}, expected), precision)
tester:eq(0.497, criterion:forward(torch.Tensor{5.2}, expected), precision)
tester:eq(0.302, criterion:forward(torch.Tensor{8.4}, expected), precision)
tester:eq(0.275, criterion:forward(torch.Tensor{10}, expected), precision)
tester:eq(0.302, criterion:forward(torch.Tensor{11.6}, expected), precision)
tester:eq(0.497, criterion:forward(torch.Tensor{14.8}, expected), precision)
tester:eq(0.800, criterion:forward(torch.Tensor{18}, expected), precision)
end
function tests.ErrorCriterionRelative_testGradient_expected_10()
local criterion = nnst.ErrorCriterionRelative(0.8, 0.16)
local expected = torch.Tensor{10}
tester:eq(torch.Tensor{-0.1}, criterion:backward(torch.Tensor{2}, expected), precision)
tester:eq(torch.Tensor{-0.083}, criterion:backward(torch.Tensor{5.2}, expected), precision)
tester:eq(torch.Tensor{-0.033}, criterion:backward(torch.Tensor{8.4}, expected), precision)
tester:eq(torch.Tensor{0}, criterion:backward(torch.Tensor{10}, expected), precision)
tester:eq(torch.Tensor{0.033}, criterion:backward(torch.Tensor{11.6}, expected), precision)
tester:eq(torch.Tensor{0.083}, criterion:backward(torch.Tensor{14.8}, expected), precision)
tester:eq(torch.Tensor{0.1}, criterion:backward(torch.Tensor{18}, expected), precision)
end
function tests.ErrorCriterionRelative_testGradient2_expected_10()
local criterion = nnst.ErrorCriterionRelative(0.8, 0.16)
local expected = torch.Tensor{10}
df, ddf = criterion:backward2(torch.Tensor{2}, expected)
tester:eq(torch.Tensor{-0.1}, df, precision)
tester:eq(torch.Tensor{0}, ddf, precision)
df, ddf = criterion:backward2(torch.Tensor{5.2}, expected)
tester:eq(torch.Tensor{-0.083}, df, precision)
tester:eq(torch.Tensor{0.010}, ddf, precision)
df, ddf = criterion:backward2(torch.Tensor{8.4}, expected)
tester:eq(torch.Tensor{-0.033}, df, precision)
tester:eq(torch.Tensor{0.020}, ddf, precision)
df, ddf = criterion:backward2(torch.Tensor{10}, expected)
tester:eq(torch.Tensor{0}, df, precision)
tester:eq(torch.Tensor{0.020}, ddf, precision)
df, ddf = criterion:backward2(torch.Tensor{11.6}, expected)
tester:eq(torch.Tensor{0.033}, df, precision)
tester:eq(torch.Tensor{0.020}, ddf, precision)
df, ddf = criterion:backward2(torch.Tensor{14.8}, expected)
tester:eq(torch.Tensor{0.083}, df, precision)
tester:eq(torch.Tensor{0.010}, ddf, precision)
df, ddf = criterion:backward2(torch.Tensor{18}, expected)
tester:eq(torch.Tensor{0.1}, df, precision)
tester:eq(torch.Tensor{0}, ddf, precision)
end
function tests.ErrorCriterionRelative_testError_expected_minus_10()
local criterion = nnst.ErrorCriterionRelative(0.8, 0.16)
local expected = torch.Tensor{-10}
tester:eq(0.800, criterion:forward(torch.Tensor{-2}, expected), precision)
tester:eq(0.497, criterion:forward(torch.Tensor{-5.2}, expected), precision)
tester:eq(0.302, criterion:forward(torch.Tensor{-8.4}, expected), precision)
tester:eq(0.275, criterion:forward(torch.Tensor{-10}, expected), precision)
tester:eq(0.302, criterion:forward(torch.Tensor{-11.6}, expected), precision)
tester:eq(0.497, criterion:forward(torch.Tensor{-14.8}, expected), precision)
tester:eq(0.800, criterion:forward(torch.Tensor{-18}, expected), precision)
end
function tests.ErrorCriterionRelative_testGradient_expected_minus_10()
local criterion = nnst.ErrorCriterionRelative(0.8, 0.16)
local expected = torch.Tensor{-10}
tester:eq(torch.Tensor{0.1}, criterion:backward(torch.Tensor{-2}, expected), precision)
tester:eq(torch.Tensor{0.083}, criterion:backward(torch.Tensor{-5.2}, expected), precision)
tester:eq(torch.Tensor{0.033}, criterion:backward(torch.Tensor{-8.4}, expected), precision)
tester:eq(torch.Tensor{0}, criterion:backward(torch.Tensor{-10}, expected), precision)
tester:eq(torch.Tensor{-0.033}, criterion:backward(torch.Tensor{-11.6}, expected), precision)
tester:eq(torch.Tensor{-0.083}, criterion:backward(torch.Tensor{-14.8}, expected), precision)
tester:eq(torch.Tensor{-0.1}, criterion:backward(torch.Tensor{-18}, expected), precision)
end
function tests.ErrorCriterionRelative_testGradient2_expected_minus_10()
local criterion = nnst.ErrorCriterionRelative(0.8, 0.16)
local expected = torch.Tensor{-10}
df, ddf = criterion:backward2(torch.Tensor{-2}, expected)
tester:eq(torch.Tensor{0.1}, df, precision)
tester:eq(torch.Tensor{0}, ddf, precision)
df, ddf = criterion:backward2(torch.Tensor{-5.2}, expected)
tester:eq(torch.Tensor{0.083}, df, precision)
tester:eq(torch.Tensor{0.010}, ddf, precision)
df, ddf = criterion:backward2(torch.Tensor{-8.4}, expected)
tester:eq(torch.Tensor{0.033}, df, precision)
tester:eq(torch.Tensor{0.020}, ddf, precision)
df, ddf = criterion:backward2(torch.Tensor{-10}, expected)
tester:eq(torch.Tensor{0}, df, precision)
tester:eq(torch.Tensor{0.020}, ddf, precision)
df, ddf = criterion:backward2(torch.Tensor{-11.6}, expected)
tester:eq(torch.Tensor{-0.033}, df, precision)
tester:eq(torch.Tensor{0.020}, ddf, precision)
df, ddf = criterion:backward2(torch.Tensor{-14.8}, expected)
tester:eq(torch.Tensor{-0.083}, df, precision)
tester:eq(torch.Tensor{0.010}, ddf, precision)
df, ddf = criterion:backward2(torch.Tensor{-18}, expected)
tester:eq(torch.Tensor{-0.1}, df, precision)
tester:eq(torch.Tensor{0}, ddf, precision)
end
function tests.ErrorCriterionRelative_testInputNotScalar()
local function test()
local criterion = nnst.ErrorCriterionRelative()
criterion:forward(torch.Tensor{1, 2}, torch.Tensor{1})
end
tester:assertError(test)
end
function tests.ErrorCriterionRelative_testTargetNotScalar()
local function test()
local criterion = nnst.ErrorCriterionRelative()
criterion:forward(torch.Tensor{1}, torch.Tensor{1, 2})
end
tester:assertError(test)
end
function tests.ErrorCriterionRelative_testExpectedZero()
local function test()
local criterion = nnst.ErrorCriterionRelative()
criterion:forward(torch.Tensor{1}, torch.Tensor{0})
end
tester:assertError(test)
end
return tests |
yavin4_kliknik_herd_neutral_none = Lair:new {
mobiles = {{"kliknik_warrior",1},{"kliknik_scout",1},{"kliknik_worker",1},{"kliknik_defender",1},{"kliknik_hatchling",1}},
spawnLimit = 15,
buildingsVeryEasy = {},
buildingsEasy = {},
buildingsMedium = {},
buildingsHard = {},
buildingsVeryHard = {},
buildingType = "none",
}
addLairTemplate("yavin4_kliknik_herd_neutral_none", yavin4_kliknik_herd_neutral_none)
|
package.path = "../?.lua;"..package.path
local ffi = require("ffi")
local enum = require("wordplay.enum")
local cctype = require("wordplay.cctype")
local isdigit = cctype.isdigit
local isalpha = cctype.isalpha
local isalnum = cctype.isalnum
local isspace = cctype.isspace
local octetstream = require("wordplay.octetstream")
local B = string.byte
local gcode = require("gcode")
local Token = gcode.Token;
local TokenType = gcode.TokenType;
--[[
lexemeMap
Provides easy connection between first character of a lexeme
and possible code to scan it.
]]
local lexemeMap = {}
lexemeMap[B'-'] = function(bs)
return (Token{Kind = TokenType.MINUS, lexeme='-', literal='', line=bs:tell()});
end
-- processing a comment, consume til end of line or EOF
lexemeMap[B';'] = function(bs)
local starting = bs:tell();
local startPtr = bs:getPositionPointer();
while bs:peekOctet() ~= B'\n' and not bs:isEOF() do
bs:skip(1)
end
local ending = bs:tell();
local len = ending - starting;
local value = ffi.string(startPtr, len)
return (Token{Kind = TokenType.COMMENT, lexeme=value, literal='', line=starting});
end
-- largely ignoring whitespace
lexemeMap[B' '] = function(bs) end
lexemeMap[B'\r'] = function(bs) end
lexemeMap[B'\t'] = function(bs) end
lexemeMap[B'\n'] = function(bs)
--bs:incrementLineCount();
end
-- nuber signs
lexemeMap[B'-'] = function(bs)
return (Token{Kind = TokenType.MINUS, lexeme='-', literal='', line=bs:tell()});
end
lexemeMap[B'+'] = function(bs)
return (Token{Kind = TokenType.PLUS, lexeme='+', literal='', line=bs:tell()});
end
-- scan a number
local function lex_number(bs)
-- start back at first digit
bs:skip(-1)
local starting = bs:tell();
local startPtr = bs:getPositionPointer();
-- get through all digits
while(isdigit(bs:peekOctet())) do
bs:skip(1);
end
-- look for fraction part
--print("lex_number: ", string.char(bs:peekOctet()), string.char(bs:peekOctet(1)))
if (bs:peekOctet() == B'.') then
if isdigit(bs:peekOctet(1)) then
bs:skip(1);
while isdigit(bs:peekOctet()) do
bs:skip(1);
end
elseif isspace(bs:peekOctet(1)) then
bs:skip(1)
end
end
local ending = bs:tell();
local len = ending - starting;
local value = tonumber(ffi.string(startPtr, len))
-- return the number literal
--return (Token{Kind = TokenType.NUMBER, lexeme='', literal=value, line=bs:getLine()})
return (Token{Kind = TokenType.NUMBER, lexeme='', literal=value, line=starting})
end
-- scan identifiers
-- this is usually going to be a single character
-- but we'll deal with multiples just for fun
local function lex_identifier(bs)
--print("lex_identifier")
-- start back at first digit
bs:skip(-1)
local starting = bs:tell();
local startPtr = bs:getPositionPointer();
while isalpha(bs:peekOctet()) do
--while isalnum(bs:peekOctet()) do
bs:skip();
end
local ending = bs:tell();
local len = ending - starting;
local value = ffi.string(startPtr, len)
--print("value: ", value)
-- See if the identifier is a reserved word
local kind = TokenType[value]
if not kind then
kind = TokenType.IDENTIFIER
end
-- return the identifier
local tok = Token{Kind = kind, lexeme=value, literal='', position=bs:tell()}
return tok
end
-- iterator, returning individually scanned lexemes
-- BUGBUG - make this a non-coroutine iterator
local function scanner(bs)
local function token_gen(bs, state)
while not bs:isEOF() do
local c = bs:readOctet()
if lexemeMap[c] then
local tok, err = lexemeMap[c](bs)
if tok then
-- BUGBUG
-- when routines only return a token
-- uncomment the following
--coroutine.yield(result)
return state + 1, tok;
else
-- deal with error if there was one
end
else
if isdigit(c) then
local tok = lex_number(bs)
return state + 1, tok
--coroutine.yield(lex_number(bs))
elseif isalpha(c) then
local tok = lex_identifier(bs)
--print(tok)
--coroutine.yield(tok)
return state + 1, tok
else
print("UNKNOWN: ", string.char(c))
end
end
end
end
--return coroutine.wrap(iter)
return token_gen, bs, 0
end
return scanner
|
include("/scripts/behaviors/shared.lua")
function init(root)
local prio = node("Priority")
prio:AddNode(stayAlive())
prio:AddNode(rezzAlly())
prio:AddNode(avoidSelfDamage())
prio:AddNode(damageSkill())
prio:AddNode(checkEnergy())
prio:AddNode(defend())
prio:AddNode(wander())
root:AddNode(prio)
end
|
pathfinder = {}
--[[
minetest.get_content_id(name)
minetest.registered_nodes
minetest.get_name_from_content_id(id)
local ivm = a:index(pos.x, pos.y, pos.z)
local ivm = a:indexp(pos)
minetest.hash_node_position({x=,y=,z=})
minetest.get_position_from_hash(hash)
start_index, target_index, current_index
^ Hash of position
current_value
^ {int:hCost, int:gCost, int:fCost, hash:parent, vect:pos}
]]--
local function walkable(pos, liquids_walkable)
local node = minetest.get_node(pos)
if liquids_walkable then
return minetest.registered_nodes[node.name].walkable or minetest.registered_nodes[node.name].liquidtype ~= "none"
else
return minetest.registered_nodes[node.name].walkable
end
end
local function is_fence(pos)
local node = minetest.get_node(pos)
if string.find(node.name,"fence") == nil then
return false
else
return true
end
end
local function get_ground_neighbors(pos, fall, jump, height, liquids_walkable)
local neighbors = {}
fall = fall or 4
jump = jump or 1
--Must subtract 1 or the check will be too high
height = height-1 or 1
liquids_walkable = (liquids_walkable ~= false)
for x = -1,1 do
for z = -1,1 do
if z ~= 0 or x ~= 0 then
local gl
local fits = false
for y = -fall,jump do
if not walkable({x = pos.x+x, y = pos.y+y, z = pos.z+z}, liquids_walkable) then
if walkable({x = pos.x+x, y = pos.y+y-1, z = pos.z+z}, liquids_walkable) and (not is_fence({x = pos.x+x, y = pos.y+y-1, z = pos.z+z})) then
gl = pos.y+y
fits = true
for y1 = 0,height do
if walkable({x = pos.x+x, y = gl+y1, z = pos.z+z}, liquids_walkable) then
fits = false
break
end
end
if fits then
if z ~= 0 and x ~= 0 then
if gl < pos.y then
for y2 = 0,height do
if walkable({x = pos.x, y = pos.y+y2, z = pos.z+z}, liquids_walkable) or walkable({x = pos.x+x, y = pos.y+y2, z = pos.z}, liquids_walkable) then
fits = false
break
end
end
else
for y2 = 0,height do
if walkable({x = pos.x, y = gl+y2, z = pos.z+z}, liquids_walkable) or walkable({x = pos.x+x, y = gl+y2, z = pos.z}, liquids_walkable) then
fits = false
break
end
end
end
end
if gl > pos.y then
for y3 = 0,height+gl-pos.y do
if walkable({x = pos.x, y = pos.y+y3, z = pos.z}, liquids_walkable) then
fits = false
break
end
end
end
end
end
end
if gl and fits then
local hash = minetest.hash_node_position({x = pos.x+x, y = gl, z = pos.z+z})
local g_cost = 10
if z ~= 0 and x ~= 0 then
g_cost = g_cost + 4
end
if gl > pos.y then
g_cost = g_cost + 6
end
neighbors[hash] = {pos = {x = pos.x+x, y = gl, z = pos.z+z}, g_cost = g_cost}
end
end
end
end
end
return neighbors
end
--returns the h_cost value of pos when target_pos is the goal
local function get_h_cost(pos, target_pos)
local distance = math.sqrt((pos.x-target_pos.x)^2 + (pos.y-target_pos.y)^2 + (pos.z-target_pos.z)^2)
return math.floor(distance*10)
end
--returns the next node to be expanded
local function get_cheapest_node(list)
local cheapest = "blank"
for hash, node in pairs(list) do
if cheapest ~= "blank" then
if node.f_cost < list[cheapest].f_cost then
cheapest = hash
elseif node.f_cost == list[cheapest].f_cost then
if node.h_cost < list[cheapest].h_cost then
cheapest = hash
end
end
else
cheapest = hash
end
end
return cheapest
end
--returns a returnable path built out of position hashes
local function get_path(list, current)
local path = {}
while true do
table.insert(path,current)
current = list[current].parent
if current == "Start" then
--We have reached the start of the path so stop looking for next point
break
end
end
--Reverse the order of path to go from start to end not end to start
local reordered_path = {}
for i = #path, 1, -1 do
table.insert(reordered_path,path[i])
end
return reordered_path
end
--[[path_types (
0 = ground only, will swim on top of liquids but will not dive.
1 = ground only, will sink in liquids
2 = amphibious, can swim freely in liquids
3 = flying, cannot move straight up and down
4 = flying, can move straight up and down
)]]--
--[[
OPEN the set of nodes to be evaluated
CLOSED the set of nodes already evaluated
add the start node to OPEN
loop
current = node in OPEN with the lowest f_cost
remove current from OPEN
add current to CLOSED
if current is the target node
return path
foreach neighbor of the current node
if neighbor is not transversable or neighbor is in CLOSED
skip to the next neighbor
if new path to neighbor is shorter OR neighbor is not in OPEN
set f_cost of neighbor
set parent of neighbor to current
if neighbor is not in OPEN
add neighbor to OPEN
]]--
function pathfinder.find_path(current_pos, target_pos, path_type, height, fall, jump)
local time = minetest.get_us_time()
--Initialize variables
local open = {}
local closed = {}
local path = {}
local liquids_walkable = true --Will set based on path_type later
local height = height or 2
local fall = fall or 4
local jump = jump or 1
local path_type = path_type or 0
local get_neighbors = get_ground_neighbors
--Initialize open to current pos
--if statement forces construction variables to be purged
if true then
local h_cost = get_h_cost(current_pos,target_pos)
local hash = minetest.hash_node_position(current_pos)
open[hash] = {
pos = current_pos,
g_cost = 0,
h_cost = h_cost,
f_cost = h_cost,--h_cost+g_cost and since g_cost = 0 f_cost = h_cost
parent = "Start",
}
end
--Loop until I find a path or tun out of time
local counter = 0
while counter < 400 do
--Increment counter to prevent an infinite loop
counter = counter + 1
local opensize = 0
for key,value in pairs(open) do
opensize = opensize+1
end
if opensize == 0 then
break
end
--Get node to expand
local current = get_cheapest_node(open)
--Put node in closed and remove from open
closed[current] = {
pos = open[current].pos,
g_cost = open[current].g_cost,
h_cost = open[current].h_cost,
f_cost = open[current].f_cost,
parent = open[current].parent,
}
open[current] = nil
--Am I at the end
if closed[current].h_cost == 0 then
--Yes, Hooray grab the path and run.
path = get_path(closed,current)
break
end
--Get neighbors
local neighbors = get_neighbors(closed[current].pos, fall, jump, height, liquids_walkable)
--Check all my neighbors especially the Petersons
for hash, neighbor in pairs(neighbors) do
--Has this node already been checked?
if closed[hash] == nil then
--No, Okay. Has it been expanded into yet?
if open[hash] == nil then
--No, Okay. Add node to open set
local g_cost = closed[current].g_cost + neighbor.g_cost
local h_cost = get_h_cost(neighbor.pos, target_pos)
open[hash] = {
pos = neighbor.pos,
g_cost = g_cost,
h_cost = h_cost,
f_cost = g_cost + h_cost,
parent = current,
}
else
--Yes, Okay. Is this path a better option to get to this node?
if open[hash].g_cost > closed[current].g_cost + neighbor.g_cost then
--Yes. Well then, by all means update it.
open[hash].g_cost = closed[current].g_cost + neighbor.g_cost
open[hash].f_cost = open[hash].g_cost + open[hash].h_cost
open[hash].parent = current
end
end
end
end--End For loop
end--End While loop
--print(minetest.get_us_time()-time)
-- Did I get a good path back?
if #path > 0 then
--Yes. Excellent then I will tell the user
return path
else
--No? Why not? I am a perfect machine. Oh, well I guess I have to tell the user that I couldn't find a path. :'(
return false
end
end
minetest.register_chatcommand("neighbors",{
description = "get players neighbors",
func = function(name,param)
local player = minetest.get_player_by_name(name)
local pos = player:get_pos()
pos = {
x = math.floor(pos.x+0.5),
y = math.floor(pos.y+0.5),
z = math.floor(pos.z+0.5)
}
local neighbors = get_ground_neighbors(pos, 4, 1, 2, false)
for _,neighbor in pairs(neighbors) do
minetest.set_node(neighbor.pos,{name = "default:stone"})
local meta = minetest.get_meta(neighbor.pos)
meta:set_string("infotext", tostring(neighbor.g_cost))
end
end
})
local target = {x = 0, y = 0, z = 0}
minetest.register_chatcommand("set_target",{
description = "set target point",
func = function(name,param)
local player = minetest.get_player_by_name(name)
local pos = player:get_pos()
pos = {
x = math.floor(pos.x+0.5),
y = math.floor(pos.y+0.5),
z = math.floor(pos.z+0.5)
}
target = pos
end
})
minetest.register_chatcommand("get_path",{
description = "get path to target",
func = function(name,param)
local player = minetest.get_player_by_name(name)
local pos = player:get_pos()
pos = {
x = math.floor(pos.x+0.5),
y = math.floor(pos.y+0.5),
z = math.floor(pos.z+0.5)
}
local path = pathfinder.find_path(pos, target, 0, 2, 4, 1)
for _,hash in pairs(path) do
minetest.set_node(minetest.get_position_from_hash(hash),{name = "default:glass"})
end
end
})
|
local Directions = assert(foundation.com.Directions)
local mesecon_hub_node_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, -0.375, 0.375, -0.3125, 0.375}, -- NodeBox1
{-0.25, -0.5, -0.5, 0.25, -0.375, 0.5}, -- NodeBox2
{-0.5, -0.5, -0.25, 0.5, -0.375, 0.25}, -- NodeBox3
}
}
local function hub_after_place_node(pos, placer, item_stack, pointed_thing)
Directions.facedir_wallmount_after_place_node(pos, placer, item_stack, pointed_thing)
end
minetest.register_node("yatm_mesecon_hubs:mesecon_hub_bus_off", {
basename = "yatm_mesecon_hubs:mesecon_hub_bus",
description = "Mesecon Bus Hub",
groups = {cracky = 1},
drop = "yatm_mesecon_hubs:mesecon_hub_bus_off",
tiles = {
"yatm_mesecon_hub_top.bus.off.png",
"yatm_mesecon_hub_bottom.png",
"yatm_mesecon_hub_side.off.png",
"yatm_mesecon_hub_side.off.png",
"yatm_mesecon_hub_side.off.png",
"yatm_mesecon_hub_side.off.png",
},
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = mesecon_hub_node_box,
after_place_node = hub_after_place_node,
mesecons = {
effector = {
rules = mesecon.rules.default,
action_on = function (pos, node)
node.name = "yatm_mesecon_hubs:mesecon_hub_bus_on"
minetest.swap_node(pos, node)
end
}
}
})
minetest.register_node("yatm_mesecon_hubs:mesecon_hub_bus_on", {
basename = "yatm_mesecon_hubs:mesecon_hub_bus",
description = "Mesecon Bus Hub",
groups = {cracky = 1, not_in_creative_inventory = 1},
drop = "yatm_mesecon_hubs:mesecon_hub_bus_off",
tiles = {
"yatm_mesecon_hub_top.bus.on.png",
"yatm_mesecon_hub_bottom.png",
"yatm_mesecon_hub_side.on.png",
"yatm_mesecon_hub_side.on.png",
"yatm_mesecon_hub_side.on.png",
"yatm_mesecon_hub_side.on.png",
},
paramtype = "light",
paramtype2 = "facedir",
drawtype = "nodebox",
node_box = mesecon_hub_node_box,
after_place_node = hub_after_place_node,
mesecons = {
effector = {
rules = mesecon.rules.default,
action_off = function (pos, node)
node.name = "yatm_mesecon_hubs:mesecon_hub_bus_off"
minetest.swap_node(pos, node)
end
}
}
})
|
local equipment = script:FindAncestorByType("Equipment")
local propSocket = script:GetCustomProperty("Socket") or "right_prop"
local propSecondaryEquipment = script:GetCustomProperty("SecondaryEquipment")
local newEquipRef = nil
local function OnEquipped(whichEquipment, player)
if propSecondaryEquipment and not Object.IsValid(newEquipRef) then
newEquipRef = World.SpawnAsset(propSecondaryEquipment, {position = script:GetWorldPosition()})
end
if Object.IsValid(newEquipRef) then
newEquipRef.socket = propSocket
newEquipRef:Equip(player)
newEquipRef.isVisible = true
end
end
local function OnUnequipped()
if Object.IsValid(newEquipRef) then
newEquipRef:Unequip()
newEquipRef:Destroy()
end
end
equipment.equippedEvent:Connect(OnEquipped)
equipment.unequippedEvent:Connect(OnUnequipped) |
return {
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmNearest",
targetAniEffect = "",
arg_list = {
weapon_id = 69441
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmNearest",
targetAniEffect = "",
arg_list = {
weapon_id = 69442
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmNearest",
targetAniEffect = "",
arg_list = {
weapon_id = 69443
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmNearest",
targetAniEffect = "",
arg_list = {
weapon_id = 69444
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmNearest",
targetAniEffect = "",
arg_list = {
weapon_id = 69445
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmNearest",
targetAniEffect = "",
arg_list = {
weapon_id = 69446
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmNearest",
targetAniEffect = "",
arg_list = {
weapon_id = 69447
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmNearest",
targetAniEffect = "",
arg_list = {
weapon_id = 69448
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmNearest",
targetAniEffect = "",
arg_list = {
weapon_id = 69449
}
}
}
},
{
effect_list = {
{
type = "BattleSkillFire",
casterAniEffect = "",
target_choise = "TargetHarmNearest",
targetAniEffect = "",
arg_list = {
weapon_id = 69450
}
}
}
},
uiEffect = "",
name = "特殊弹幕开火",
cd = 0,
painting = 1,
id = 13320,
picture = "1",
castCV = "skill",
desc = "",
effect_list = {}
}
|
function onSay(cid, words, param, channel)
if(param ~= '') then
doWaypointAddTemporial(param, getCreaturePosition(cid))
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Temporial waypoint saved.")
return true
end
local str = ""
for i, waypoint in ipairs(getWaypointList()) do
str = str .. waypoint.name .. "\n"
end
doShowTextDialog(cid, 2160, str)
return true
end
|
class("WorldItemUseCommand", pm.SimpleCommand).execute = function (slot0, slot1)
slot2 = slot1:getBody()
pg.ConnectionMgr.GetInstance():Send(33301, {
id = slot2.itemID,
count = slot2.count,
arg = slot2.args
}, 33302, function (slot0)
if slot0.result == 0 then
nowWorld.GetInventoryProxy(slot2).RemoveItem(slot3, slot0, {})
if WorldItem.New({
id = slot0,
count = slot1
}).getWorldItemType(slot4) == WorldItem.UsageBuff then
slot6 = slot4:getItemBuffID()
for slot10, slot11 in ipairs(slot2) do
slot2:GetShip(slot11):AddBuff(slot6, slot4.count)
end
elseif slot5 == WorldItem.UsageHPRegenerate then
slot6 = slot4:getItemRegenerate() * slot4.count
for slot10, slot11 in ipairs(slot2) do
slot2:GetShip(slot11):Regenerate(slot6)
end
elseif slot5 == WorldItem.UsageHPRegenerateValue then
slot6 = slot4:getItemRegenerate() * slot4.count
for slot10, slot11 in ipairs(slot2) do
slot2:GetShip(slot11):RegenerateValue(slot6)
end
elseif slot5 == WorldItem.UsageRecoverAp then
slot2.staminaMgr:ExchangeStamina(slot6)
slot3:sendNotification(GAME.WORLD_STAMINA_EXCHANGE_DONE)
elseif slot5 == WorldItem.UsageDrop or slot5 == WorldItem.UsageWorldItem or slot5 == WorldItem.UsageLoot or slot5 == WorldItem.UsageWorldClean or slot5 == WorldItem.UsageWorldBuff or slot5 == WorldItem.UsageDropAppointed then
slot1 = PlayerConst.addTranDrop(slot0.drop_list)
end
slot3:sendNotification(GAME.WORLD_ITEM_USE_DONE, {
drops = slot1,
item = slot4
})
else
pg.TipsMgr.GetInstance():ShowTips(i18n1("大世界物品使用失败:" .. slot0.result))
end
end)
end
return class("WorldItemUseCommand", pm.SimpleCommand)
|
-- Natural Selection League Plugin
-- Source located at - https://github.com/xToken/NSL
-- lua/NSL/captains/shared.lua
-- - Dragon
|
ITEM.name = "Utenos Porteris, 500ml"
ITEM.description = "A can of beer"
ITEM.longdesc = "Heineken is a full-bodied premium lager with deep golden color, light fruity aroma, a mild bitter taste and a balanced hop aroma leaving a crisp, clean finish for ultimate refreshing taste.\nThe only beer enjoyed in 192 countries. From Argentina to Zambia Heineken is enjoyed in more countries than any other premium beer. Which means it is requested in more languages than any beer on earth. No surprise, really. After all, Heineken's distinctive flavor and unrivaled quality make it lager that stands out everywhere. So whether you find yourself at a fine establishment in New York, New Delhi or Nachingwea, you can enjoy the great taste of an ice cold Heineken."
ITEM.model = "models/weapons4/w_pivo3.mdl"
ITEM.price = 55
ITEM.width = 1
ITEM.height = 1
ITEM.weight = 0.330
ITEM.flatweight = 0.040
ITEM.thirst = 11
ITEM.quantity = 1
ITEM.alcohol = 10
ITEM.addictionLightAlcohol = true
ITEM.sound = "stalkersound/inv_drink_can.mp3"
ITEM.img = ix.util.GetMaterial("vgui/hud/items/drink/canbeer_6.png")
function ITEM:PopulateTooltipIndividual(tooltip)
ix.util.PropertyDesc(tooltip, "Light Alcohol", Color(64, 224, 208))
end
ITEM:Hook("use", function(item)
item.player:EmitSound(item.sound or "items/battery_pickup.wav")
item.player:AddBuff("buff_radiationremoval", 10, { amount = 0.2 })
item.player:GetCharacter():SatisfyAddictions("CheapAlcohol")
ix.chat.Send(item.player, "iteminternal", "takes a swig of their "..item.name..".", false)
end)
ITEM:DecideFunction()
|
pcall(require, 'luasql.sqlite3')
-- handle luacurl and Lua-cURL
pcall(require, 'curl')
pcall(require, 'luacurl')
assert(curl, "curl library not found (luacurl or Lua-cURL)")
-- optional iconv
pcall(require, 'iconv')
-- optional compression
pcall(require, 'bz2')
-- optional html tidy
pcall(require, 'tidy')
-- Charset conversion
if iconv then
local ic = iconv.new('utf8', 'windows-1250')
function toUtf8(s)
return ic:iconv(s)
end
function encoding(e)
ic = iconv.new('utf8', e)
end
end
function log(...)
if verbose then
print(...)
end
end
-- HTML Parsing
do
local function decode(s)
return (s:gsub('&(.-);', { amp = '&', lt = '<', gt = '>', nbsp = ' ' }))
end
-- modified Roberto's XML parser http://lua-users.org/wiki/LuaXml to behave like the
-- one from Yutaka Ueno - creates more shallow trees, produces less tables
-- 'tag' is not used as an attribute in (X)HTML 3, 4, 5, so I can use it as the label
function parseargs(tag, s, parent)
local arg = setmetatable({tag=tag}, {__index = {parent = parent}})
string.gsub(s, "([%w:]+)=([\"'])(.-)%2", function (w, _, a)
arg[w] = decode(a)
end)
return arg
end
function toXml(s)
local stack = {}
local top = {}
table.insert(stack, top)
local ni,c,label,xarg, empty
local i, j = 1, 1
while true do
ni,j,dt,c,label,xarg, empty = string.find(s, "<(!?)(%/?)([%?%w]+)(.-)(%/?)>", i)
if not ni then break end
if dt=="" then
local text = string.sub(s, i, ni-1)
if not string.find(text, "^%s*$") then
table.insert(top, decode(text))
end
if empty == "/" then -- empty element tag
table.insert(top, parseargs(label, xarg, top))
elseif c == "" then -- start tag
top = parseargs(label, xarg, top)
table.insert(stack, top) -- new level
else -- end tag
local toclose = table.remove(stack) -- remove top
top = stack[#stack]
if #stack < 1 then
error("nothing to close with "..label)
end
if toclose.tag ~= label then
error("trying to close "..toclose.tag.." with "..label)
end
table.insert(top, toclose)
end
end
i = j+1
end
local text = string.sub(s, i)
if not string.find(text, "^%s*$") then
table.insert(stack[#stack], text)
end
if #stack > 1 then
error("unclosed "..stack[#stack].tag)
end
return stack[1]
end
if tidy then
local tidy = tidy.new()
tidy:setCharEncoding("utf8")
function toTidy(s)
tidy:parse(s)
return tidy:toTable()
end
end
-- flatten text from a table
function text(x)
if type(x) == "string" then return x end
local res = {}
local function r(z)
for _,v in ipairs(z) do
if type(v) == "string" then table.insert(res, v)
elseif type(v) == "table" then r(v)
end
end
end
r(x)
return table.concat(res)
end
-- simple dumping
function repr(x)
local function r(x, i)
local s = ("+"):rep(i)
for k,v in pairs(x) do
print(s .. tostring(k) .. ' = ' .. tostring(v))
if type(v) == "table" then r(v, i+1) end
end
end
r(x, 0)
end
function trim(s)
assert(type(s) == "string", "cannot trim "..type(s))
return (s:gsub("^%s*(.-)%s*$", "%1"))
end
-- quasi-XPath: accepts a table and a string/function condition
-- returns an array of elements, for which the function returns true
-- during iteration, the environment for the condition is set to each element
local code_cache = setmetatable({}, {__mode="v"})
function getElements(doc, cond)
local res = {}
if type(cond) == "string" then
if code_cache[cond] then cond = code_cache[cond] else
cond = assert(loadstring('return function() return '..cond..' end'))()
code_cache[cond] = cond
end
else
cond = cond or function() return true end
end
local default = {}
setmetatable(default, {__index = function() return default end})
local current
local env = setmetatable({}, {__index = function(t,k)
if k=="self" then return t end
if current[k] then return current[k] else return default end
end})
setfenv(cond, env)
local function findElements(x)
for _,e in ipairs(x or {}) do
if type(e) == 'table' then
current = e
if cond(e) then
table.insert(res, e)
end
findElements(e)
end
end
end
findElements(doc)
return res
end
end
-- Database
do
if luasql then
local sqlite3 = assert(luasql.sqlite3())
local db = assert(sqlite3:connect('database.db'))
-- simplified access to SQL - returns an iterator function in case of SELECT
function sql(s)
log('[sql]', s)
local cur, err = db:execute(s)
assert(cur, (err or '')..' in '..s)
if type(cur) == 'number' then
return cur
else
return function()
return cur:fetch()
end
end
end
function lastid()
return db:getlastautoid()
end
end
end
-- HTTP Downloading
do
local c=curl.new and curl.new() or curl.easy_init()
local filters = {}
function addFilter(f) table.insert(filters, f) end
function clearFilters() filters = {} end
do
local f = io.open('cache/TEST.txt', 'w')
if not f then
os.execute('mkdir cache')
else
f:close()
os.remove('cache/TEST.txt')
end
end
local function open(fn, mode)
return bz2 and bz2.open(fn, mode, 9) or io.open(fn, mode)
end
local function getlocal(url)
local path = url:gsub('[^%a%d]', '_')
local f, e = open('cache/'..path)
if f then
local ret = f:read('*a')
f:close()
return ret
end
end
local function writelocal(url, s)
local path = url:gsub('[^%a%d]', '_')
local f = assert(open('cache/'..path, 'wb'))
f:write(s)
f:close()
end
function get(url)
log('[http]', 'get', url)
local cache = getlocal(url)
if cache then return cache end
c:setopt(curl.OPT_URL,url)
local t = {}
c:setopt(curl.OPT_WRITEFUNCTION, function (a, b)
local s
-- luacurl and Lua-cURL friendly
if type(a) == "string" then s = a else s = b end
table.insert(t, s)
return #s
end)
assert(c:perform())
local ret = table.concat(t)
for _,f in ipairs(filters) do
ret = f(ret)
end
writelocal(url, ret)
return ret
end
end
|
--[[ Copyright (c) 2009 Peter "Corsix" Cawley
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 object = {}
object.id = "bed"
object.thob = 8
object.research_category = "diagnosis"
object.name = _S.object.bed
object.tooltip = _S.tooltip.objects.bed
object.ticks = false
object.build_preview_animation = 910
object.show_in_town_map = true
object.idle_animations = {
north = 2644,
east = 2646,
}
object.usage_animations = {
north = {
begin_use = { -- Patient lies down
["Standard Male Patient"] = 4686,
["Standard Female Patient"] = 4710,
},
in_use = { -- Use "animation"
["Standard Male Patient"] = 4694,
["Standard Female Patient"] = 4718,
},
finish_use = { -- Patient stands up again
["Standard Male Patient"] = 4702,
["Standard Female Patient"] = 4726,
},
},
east = {
begin_use = { -- Patient lies down
["Standard Male Patient"] = 4688,
["Standard Female Patient"] = 4712,
},
in_use = { -- Use "animation"
["Standard Male Patient"] = 4696,
["Standard Female Patient"] = 4720,
},
finish_use = { -- Patient stands up again
["Standard Male Patient"] = 4704,
["Standard Female Patient"] = 4728,
},
},
}
local anim_mgr = TheApp.animation_manager
local kf1, kf2, kf3 = {1, -1}, {0.4, -1}, {-0.3, -1}
anim_mgr:setMarker(object.usage_animations.north.begin_use, 0, kf1, 4, kf2, 12, kf2, 18, kf3)
anim_mgr:setMarker(object.usage_animations.north.in_use, kf3)
anim_mgr:setMarker(object.usage_animations.north.finish_use, 0, kf3, 6, kf3, 12, kf2, 14, kf1)
-- TODO: The other direction
object.orientations = {
north = {
footprint = { {1, -1, only_passable = true}, {-1, -1, complete_cell = true},
{0, -1, complete_cell = true}, {-1, 0, complete_cell = true},
{0, 0, complete_cell = true} },
use_position = {1, -1},
early_list = true,
},
east = {
footprint = { {0, 1, only_passable = true}, {-1, -1, complete_cell = true},
{0, -1, complete_cell = true}, {-1, 0, complete_cell = true},
{0, 0, complete_cell = true} },
use_position = {0, 1},
early_list = true,
},
south = {
footprint = { {1, 0, only_passable = true}, {-1, -1, complete_cell = true},
{0, -1, complete_cell = true}, {-1, 0, complete_cell = true},
{0, 0, complete_cell = true} },
use_position = {1, 0},
render_attach_position = {{-2,0},{-1,0},{0,0},{0,-1,}},
},
west = {
footprint = { {-1, 1, only_passable = true}, {-1, -1, complete_cell = true},
{0, -1, complete_cell = true}, {-1, 0, complete_cell = true},
{0, 0, complete_cell = true} },
use_position = {-1, 1},
},
}
return object
|
data:extend(
{
{
type = "technology",
name = "bulldozer",
icon = "__bulldozer__/graphics/icons/bulldozer.png",
effects =
{
{
type = "unlock-recipe",
recipe = "bulldozer"
},
},
prerequisites = {"automobilism"},
unit =
{
count = 150,
ingredients =
{
{"science-pack-1", 2},
{"science-pack-2", 1}
},
time = 20
},
order = "e-c-c"
},
}
) |
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by warfacez.
--- DateTime: 25.10.20 6:01
--- |
function vRP.save_idle_custom(player,custom)
local r_idle = {}
local user_id = vRP.getUserId(player)
if not user_id then return r_idle end
local data = vRP.getUserDataTable(user_id)
if not data then return end
if data.cloakroom_idle == nil then
data.cloakroom_idle = custom
end
for k,v in pairs(data.cloakroom_idle) do
r_idle[k] = v
end
end
function vRP.removeCloak(player)
local user_id = vRP.getUserId(player)
if not user_id then return end
local data = vRP.getUserDataTable(user_id)
if not data then return end
if not data.cloakroom_idle then return end
vRPclient._setCustomization(player,data.cloakroom_idle)
data.cloakroom_idle = nil
end |
return (function(self, button, down)
local ud = u(self)
if ud.enabled and not ud.beingClicked then
ud.beingClicked = true
local b = button or 'LeftButton'
api.RunScript(self, 'PreClick', b, down)
api.RunScript(self, 'OnClick', b, down)
api.RunScript(self, 'PostClick', b, down)
ud.beingClicked = false
end
end)(...)
|
return {
['Accuracy Bonus'] = {
name = "Accuracy Bonus",
spells = {
{ name = "Dimensional Death", points = 4, cost = 5, id = 589 },
{ name = "Frenetic Rip", points = 4, cost = 3, id = 560 },
{ name = "Disseverment", points = 4, cost = 5, id = 611 },
{ name = "Vanity Dive", points = 4, cost = 2, id = 667 },
{ name = "Nat. Meditation", points = 8, cost = 6, id = 700 },
{ name = "Anvil Lightning", points = 8, cost = 8, id = 721 },
},
--tiers = { 8, 16, 24, 32 },
tiers = { [8] = 10, [16] = 22, [24] = 35, [32] = 48, [40] = 60, [48] = 72 },
subs = { ['DNC'] = 8, ['DRG'] = 8, ['RNG'] = 16 },
},
['Attack Bonus'] = {
name = "Attack Bonus",
spells = {
{ name = "Battle Dance", points = 4, cost = 3, id = 620 },
{ name = "Uppercut", points = 4, cost = 3, id = 594 },
{ name = "Death Scissors", points = 4, cost = 5, id = 554 },
{ name = "Spinal Cleave", points = 4, cost = 4, id = 540 },
{ name = "Temporal Shift", points = 4, cost = 5, id = 616 },
{ name = "Thermal Pulse", points = 4, cost = 3, id = 675 },
{ name = "Embalming Earth", points = 8, cost = 6, id = 703 },
{ name = "Searing Tempest", points = 8, cost = 8, id = 719 },
},
tiers = { [8] = 10, [16] = 22, [24] = 35, [32] = 48, [40] = 60, [48] = 72 },
subs = { ['WAR'] = 8, ['DRG'] = 8, ['DRK'] = 16 },
},
['Auto Refresh'] = {
name = "Auto Refresh",
spells = {
{ name = "Stinking Gas", points = 1, cost = 2, id = 537 },
{ name = "Frightful Roar", points = 2, cost = 3, id = 561 },
{ name = "Self-Destruct", points = 2, cost = 3, id = 533 },
{ name = "Cold Wave", points = 1, cost = 1, id = 535 },
{ name = "Light of Penance", points = 2, cost = 5, id = 634 },
{ name = "Voracious Trunk", points = 3, cost = 4, id = 576 },
{ name = "Actinic Burst", points = 4, cost = 4, id = 612 },
{ name = "Plasma Charge", points = 4, cost = 5, id = 615 },
{ name = "Winds of Promy.", points = 4, cost = 5, id = 681 },
},
tiers = { [8] = 1 },
subs = { ['PLD'] = 8, ['SMN'] = 8 },
},
['Auto Regen'] = {
name = "Auto Regen",
spells = {
{ name = "Sheep Song", points = 4, cost = 2, id = 584 },
{ name = "Healing Breeze", points = 4, cost = 4, id = 581 },
{ name = "White Wind", points = 4, cost = 5, id = 690 },
},
tiers = { [8] = 1, [16] = 2, [24] = 3 },
tiers = { [8] = 1, [16] = 2, [24] = 3 },
subs = { ['WHM'] = 8, ['RUN'] = 8 },
},
['Beast Killer'] = {
name = "Beast Killer",
spells = {
{ name = "Wild Oats", points = 4, cost = 3, id = 603 },
{ name = "Sprout Smack", points = 4, cost = 2, id = 597 },
{ name = "Seedspray", points = 4, cost = 4, id = 650 },
{ name = "1000 Needles", points = 4, cost = 5, id = 595 },
{ name = "Nectarous Deluge", points = 8, cost = 6, id = 716 },
},
tiers = { [8] = "I" },
subs = { },
},
['Clear Mind'] = {
name = "Clear Mind",
spells = {
{ name = "Poison Breath", points = 4, cost = 1, id = 536 },
{ name = "Sopoforic", points = 4, cost = 4, id = 598 },
{ name = "Venom Shell", points = 4, cost = 3, id = 513 },
{ name = "Awful Eye", points = 4, cost = 2, id = 606 },
{ name = "Filamented Hold", points = 4, cost = 3, id = 548 },
{ name = "Maelstrom", points = 4, cost = 5, id = 515 },
{ name = "Feather Tickle", points = 4, cost = 3, id = 573 },
{ name = "Corrosive Ooze", points = 4, cost = 4, id = 651 },
{ name = "Sandspray", points = 4, cost = 2, id = 621 },
{ name = "Warm-Up", points = 4, cost = 4, id = 636 },
{ name = "Lowing", points = 4, cost = 2, id = 588 },
{ name = "Mind Blast", points = 4, cost = 4, id = 644 },
},
tiers = { [8] = 3, [16] = 6, [24] = 9, [32] = 12, [40] = 15 },
subs = { ['SMN'] = 24, ['BLM'] = 24, ['SCH'] = 16, ['GEO'] = 16, ['RDM'] = 8, },
},
['Conserve MP'] = {
name = "Conserve MP",
spells = {
{ name = "Chaotic Eye", points = 4, cost = 2, id = 582 },
{ name = "Zephyr Mantle", points = 4, cost = 2, id = 647 },
{ name = "Frost Breath", points = 4, cost = 3, id = 608 },
{ name = "Firespit", points = 4, cost = 5, id = 637 },
{ name = "Water Bomb", points = 4, cost = 2, id = 687 },
{ name = "Retinal Glare", points = 8, cost = 6, id = 707 },
},
tiers = { [8] = 25, [16] = 28, [24] = 31, [32] = 34, [40] = 37 },
subs = { ['SCH'] = 8, ['BLM'] = 16, ['GEO'] = 24, },
},
['Counter'] = {
name = "Counter",
spells = {
{ name = "Enervation", points = 4, cost = 5, id = 633 },
{ name = "Asuran Claws", points = 4, cost = 2, id = 653 },
{ name = "Dark Orb", points = 4, cost = 3, id = 689 },
{ name = "O. Counterstance", points = 4, cost = 5, id = 696 },
},
tiers = { [8] = 10, [16] = 12 },
subs = { ['MNK'] = 8 },
},
['Defense Bonus'] = {
name = "Defense Bonus",
spells = {
{ name = "Grand Slam", points = 4, cost = 2, id = 622 },
{ name = "Terror Touch", points = 4, cost = 3, id = 539 },
{ name = "Saline Coat", points = 4, cost = 3, id = 614 },
{ name = "Vertical Cleave", points = 4, cost = 3, id = 617 },
{ name = "Atra. Libations", points = 8, cost = 6, id = 718 },
{ name = "Entomb", points = 8, cost = 8, id = 722 },
},
tiers = { [8] = 10, [16] = 22, [24] = 35, [32] = 48, [40] = 60, [48] = 72 },
subs = { ['WAR'] = 8, ['PLD'] = 16 },
},
['Double/Triple Attack'] = {
name = "Double/Triple Attack",
spells = {
{ name = "Acrid Stream", points = 4, cost = 3, id = 656 },
{ name = "Demoralizing Roar", points = 4, cost = 4, id = 659 },
{ name = "Empty Thrash", points = 4, cost = 3, id = 677 },
{ name = "Heavy Strike", points = 4, cost = 2, id = 688 },
{ name = "Thrashing Assault", points = 8, cost = 7, id = 709 },
},
tiers = { [8] = "DA", [16] = "TA" },
subs = { ['WAR'] = 8, ['THF'] = 16 },
},
['Dual Wield'] = {
name = "Dual Wield",
spells = {
{ name = "Animating Wail", points = 4, cost = 5, id = 661 },
{ name = "Blazing Bound", points = 4, cost = 3, id = 657 },
{ name = "Quad. Continuum", points = 4, cost = 4, id = 673 },
{ name = "Delta Thrust", points = 4, cost = 2, id = 682 },
{ name = "Mortal Ray", points = 4, cost = 4, id = 686 },
{ name = "Barbed Crescent", points = 4, cost = 2, id = 699 },
{ name = "Molting Plumage", points = 8, cost = 6, id = 715 },
},
tiers = { [8] = 10, [16] = 15, [24] = 25, [32] = 30, [40] = 35 },
subs = { ['NIN'] = 24, ['DNC'] = 16 },
},
['Evasion Bonus'] = {
name = "Evasion Bonus",
spells = {
{ name = "Screwdriver", points = 4, cost = 3, id = 519 },
{ name = "Hysteric Barrage", points = 4, cost = 5, id = 641 },
{ name = "Occultation", points = 4, cost = 3, id = 679 },
{ name = "Tem. Upheaval", points = 8, cost = 6, id = 701 },
{ name = "Silent Storm", points = 8, cost = 8, id = 727 },
},
tiers = { [8] = 10, [16] = 22, [24] = 35, [32] = 48, [40] = 60 },
subs = { ['THF'] = 16, ['DNC'] = 16, ['PUP'] = 8 },
},
['Fast Cast'] = {
name = "Fast Cast",
spells = {
{ name = "Bad Breath", points = 4, cost = 5, id = 604 },
{ name = "Sub-Zero Smash", points = 4, cost = 4, id = 654 },
{ name = "Auroral Drape", points = 4, cost = 4, id = 671 },
{ name = "Wind Breath", points = 4, cost = 2, id = 698 },
{ name = "Erratic Flutter", points = 8, cost = 6, id = 710 },
},
tiers = { [8] = 5, [16] = 10, [24] = 15, [32] = 20, [40] = 25 },
subs = { ['RDM'] = 24 },
},
['Gilfinder/TH'] = {
name = "Gilfinder/TH",
spells = {
{ name = "Charged Whisker", points = 6, cost = 5, id = 680 },
{ name = "Evryone. Grudge", points = 6, cost = 4, id = 683 },
{ name = "Amorphic Spikes", points = 6, cost = 4, id = 697 },
},
tiers = { [8] = "GF", [16] = "TH" },
subs = { ['THF'] = 16 },
},
['Lizard Killer'] = {
name = "Lizard Killer",
spells = {
{ name = "Foot Kick", points = 4, cost = 2, id = 577 },
{ name = "Claw Cyclone", points = 4, cost = 2, id = 587 },
{ name = "Ram Charge", points = 4, cost = 4, id = 585 },
{ name = "Sweeping Gouge", points = 8, cost = 6, id = 717 },
},
tiers = { [8] = "I" },
subs = { ['BST'] = 8 },
},
['Magic Attack Bonus'] = {
name = "Magic Attack Bonus",
spells = {
{ name = "Cursed Sphere", points = 4, cost = 2, id = 544 },
{ name = "Sound Blast", points = 4, cost = 1, id = 572 },
{ name = "Eyes On Me", points = 4, cost = 4, id = 557 },
{ name = "Memento Mori", points = 4, cost = 4, id = 538 },
{ name = "Heat Breath", points = 4, cost = 4, id = 591 },
{ name = "Reactor Cool", points = 4, cost = 5, id = 613 },
{ name = "Magic Hammer", points = 4, cost = 4, id = 646 },
{ name = "Dream Flower", points = 4, cost = 3, id = 678 },
{ name = "Subduction", points = 8, cost = 6, id = 708 },
{ name = "Spectral Floe", points = 8, cost = 8, id = 720 },
},
tiers = { [8] = 20, [16] = 24, [24] = 28, [32] = 32, [40] = 36, [48] = 40 },
subs = { ['BLM'] = 16, ['RDM'] = 16 },
},
['Magic Burst Bonus'] = {
name = "Magic Burst Bonus",
spells = {
{ name = "Leafstorm", points = 6, cost = 4, id = 663 },
{ name = "Cimicine Discharge", points = 6, cost = 3, id = 660 },
{ name = "Reaving Wind", points = 6, cost = 4, id = 684 },
{ name = "Rail Cannon", points = 8, cost = 6, id = 712 },
},
tiers = { [8] = 5, [16] = 7, [24] = 9, [32] = 11, [40] = 13 },
subs = { ['BLM'] = 8 },
},
['Magic Defense Bonus'] = {
name = "Magic Defense Bonus",
spells = {
{ name = "Magnetite Cloud", points = 4, cost = 3, id = 555 },
{ name = "Ice Break", points = 4, cost = 3, id = 531 },
{ name = "Osmosis", points = 4, cost = 5, id = 672 },
{ name = "Rending Deluge", points = 8, cost = 6, id = 702 },
{ name = "Scouring Spate", points = 8, cost = 8, id = 726 },
},
tiers = { [8] = 10, [16] = 12, [24] = 14, [32] = 16, [40] = 18 },
subs = { ['RUN'] = 16, ['WHM'] = 16, ['RDM'] = 16 },
},
['Max HP Boost'] = {
name = "Max HP Boost",
spells = {
{ name = "Flying Hip Press", points = 4, cost = 3, id = 629 },
{ name = "Body Slam", points = 4, cost = 4, id = 564 },
{ name = "Frypan", points = 4, cost = 3, id = 628 },
{ name = "Barrier Tusk", points = 4, cost = 3, id = 685 },
{ name = "Thunder Breath", points = 4, cost = 4, id = 695 },
{ name = "Glutinous Dart", points = 4, cost = 2, id = 706 },
{ name = "Restoral", points = 8, cost = 7, id = 711 },
},
tiers = { [8] = 30, [16] = 60, [24] = 120, [32] = 180, [40] = 240, [48] = 280 },
subs = { ['RUN'] = 16, ['MNK'] = 16, ['NIN'] = 16, ['WAR'] = 8, ['PLD'] = 8 },
},
['Max MP Boost'] = {
name = "Max MP Boost",
spells = {
{ name = "Metallic Body", points = 4, cost = 1, id = 517 },
{ name = "Mysterious Light", points = 4, cost = 4, id = 534 },
{ name = "Hecatomb Wave", points = 4, cost = 3, id = 563 },
{ name = "Magic Barrier", points = 4, cost = 3, id = 668 },
{ name = "Vapor Spray", points = 4, cost = 3, id = 694 },
},
tiers = { [8] = 10, [16] = 20, [24] = 40, [32] = 60 },
subs = { ['SMN'] = 16, ['GEO'] = 8, ['SCH'] = 8 },
},
['Plantoid Killer'] = {
name = "Plantoid Killer",
spells = {
{ name = "Power Attack", points = 4, cost = 1, id = 551 },
{ name = "Mandibular Bite", points = 4, cost = 2, id = 543 },
{ name = "Spiral Spin", points = 4, cost = 3, id = 652 },
},
tiers = { [8] = "I" },
subs = { },
},
['Rapid Shot'] = {
name = "Rapid Shot",
spells = {
{ name = "Feather Storm", points = 4, cost = 3, id = 638 },
{ name = "Jet Stream", points = 4, cost = 4, id = 569 },
{ name = "Hydro Shot", points = 4, cost = 3, id = 631 },
},
tiers = { [8] = "I" },
subs = { ['RNG'] = 8, ['COR'] = 8 },
},
['Resist Silence'] = {
name = "Resist Silence",
spells = {
{ name = "Foul Waters", points = 8, cost = 3, id = 705 },
},
tiers = { [8] = "I" },
subs = { ['BRD'] = 8, ['SCH'] = 8 },
},
['Resist Gravity'] = {
name = "Resist Gravity",
spells = {
{ name = "Feather Barrier", points = 4, cost = 2, id = 574 },
{ name = "Regurgitation", points = 4, cost = 1, id = 648 },
},
tiers = { [8] = "I", [16] = "II", [24] = "III" },
subs = { ['THF'] = 16 },
},
['Resist Sleep'] = {
name = "Resist Sleep",
spells = {
{ name = "Pollen", points = 4, cost = 1, id = 549 },
{ name = "Wild Carrot", points = 4, cost = 3, id = 578 },
{ name = "Magic Fruit", points = 4, cost = 3, id = 593 },
{ name = "Yawn", points = 4, cost = 3, id = 576 },
{ name = "Exuviation", points = 4, cost = 4, id = 645 },
},
tiers = { [8] = "I", [16] = "II", [24] = "III", [32] = "IV" },
subs = { ['PLD'] = 16 },
},
['Skillchain Bonus'] = {
name = "Skillchain Bonus",
spells = {
{ name = "Goblin Rush", points = 6, cost = 3, id = 666 },
{ name = "Benthic Typhoon", points = 6, cost = 4, id = 670 },
{ name = "Quadrastrike", points = 6, cost = 5, id = 693 },
{ name = "Paralyzing Triad", points = 8, cost = 6, id = 704 },
},
tiers = { [8] = 8, [16] = 12, [24] = 16, [32] = 20, [40] = 23 },
subs = { ['DNC'] = 8 },
},
['Store TP'] = {
name = "Store TP",
spells = {
{ name = "Sickle Slash", points = 4, cost = 4, id = 545 },
{ name = "Tail Slap", points = 4, cost = 4, id = 640 },
{ name = "Fantod", points = 4, cost = 1, id = 674 },
{ name = "Sudden Lunge", points = 4, cost = 4, id = 692 },
{ name = "Diffusion Ray", points = 8, cost = 6, id = 713 },
},
tiers = { [8] = 10, [16] = 15, [24] = 20, [32] = 25, [40] = 30 },
subs = { ['SAM'] = 16 },
},
['Undead Killer'] = {
name = "Undead Killer",
spells = {
{ name = "Bludgeon", points = 4, cost = 2, id = 529 },
{ name = "Smite of Rage", points = 4, cost = 3, id = 527 },
},
tiers = { [8] = "I" },
subs = { ['PLD'] = 8 },
},
['Zanshin'] = {
name = "Zanshin",
spells = {
{ name = "Final Sting", points = 4, cost = 1, id = 665 },
{ name = "Whirl of Rage", points = 4, cost = 2, id = 669 },
},
tiers = { [8] = 15, [16] = 25, [24] = 35, },
subs = { ['SAM'] = 16 },
},
['Critical Attack Bonus'] = {
name = "Critical Attack Bonus",
spells = {
{ name = "Sinker Drill", points = 8, cost = 6, id = 714 },
},
tiers = { [8] = 5, [16] = 8, [24] = 11 },
subs = { },
},
['Inquartata'] = {
name = "Inquartata",
spells = {
{ name = "Saurian Slide", points = 8, cost = 7, id = 723 },
},
tiers = { [8] = 5, [16] = 7, [24] = 9 },
subs = { ['RUN'] = 24 },
},
['Tenacity'] = {
name = "Tenacity",
spells = {
{ name = "Palling Salvo", points = 8, cost = 7, id = 724 },
},
tiers = { [8] = 5, [16] = 7, [24] = 9 },
subs = { ['RUN'] = 24 },
},
['Magic Accuracy Bonus'] = {
name = "Magic Accuracy Bonus",
spells = {
{ name = "Tenebral Crush", points = 8, cost = 8, id = 728 },
},
tiers = { [8] = "I", [16] = "II", [24] = "III" },
subs = { },
},
['Magic Evasion Bonus'] = {
name = "Magic Evasion Bonus",
spells = {
{ name = "Blinding Fulgor", points = 8, cost = 8, id = 725 },
},
tiers = { [8] = "I", [16] = "II", [24] = "III" },
subs = { },
},
['Resist Slow'] = {
name = "Resist Slow",
spells = {
{ name = "Refueling", points = 4, cost = 4, id = 530 },
},
tiers = { [8] = "I" },
subs = { ['PUP'] = 16, ['BST'] = 16, ['SMN'] = 16, ['DNC'] = 8, },
},
}
--Copyright © 2015, Anissa
--All rights reserved.
--Redistribution and use in source and binary forms, with or without
--modification, are permitted provided that the following conditions are met:
-- * Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- * Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- * Neither the name of bluGuide nor the
-- names of its contributors may be used to endorse or promote products
-- derived from this software without specific prior written permission.
--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
--ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
--WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
--DISCLAIMED. IN NO EVENT SHALL ANISSA BE LIABLE FOR ANY
--DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
--(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
--LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
--ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
--(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
--SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
-- add target
target("core")
-- add the dependent target
add_deps("gbox")
-- make as a binary
set_kind("binary")
-- add defines
add_defines("__tb_prefix__=\"demo\"")
-- set the object files directory
set_objectdir("$(buildir)/.objs")
-- add links directory
add_linkdirs("$(buildir)")
-- add includes directory
add_includedirs("$(buildir)")
add_includedirs("$(buildir)/gbox")
-- add links
add_links("gbox")
-- add packages for window
if is_os("ios", "android") then
elseif is_option("x11") then add_options("x11")
elseif is_option("glut") then add_options("glut")
elseif is_option("sdl") then add_options("sdl")
end
-- add packages
add_options("tbox", "opengl", "skia", "png", "jpeg", "freetype", "zlib", "base")
-- add the source files
add_files("*.c")
|
local F, C, L = unpack(select(2, ...))
local INFOBAR = F:GetModule('Infobar')
local format, min = string.format, math.min
local sort, wipe = table.sort, table.wipe
local FreeUIStatsButton = INFOBAR.FreeUIStatsButton
local memory
local _, _, home, world = GetNetStats()
local addons = {}
local n, total = 0, 0
local last = 0
local lastLag = 0
local function formatMemory(value)
if value > 1024 then
return format('%.1f MB', value / 1024)
else
return format('%.0f KB', value)
end
end
local function order(a, b)
return a.memory > b.memory
end
local function memoryColor(value, times)
if not times then times = 1 end
if value <= 1024 * times then
return 0, 1, 0
elseif value <= 2048 * times then
return .75, 1, 0
elseif value <= 4096 * times then
return 1, 1, 0
elseif value <= 8192 * times then
return 1, .75, 0
elseif value <= 16384 * times then
return 1, .5, 0
else
return 1, .1, 0
end
end
function INFOBAR:Stats()
if not C.infobar.enable then return end
if not C.infobar.stats then return end
local holder = CreateFrame('Frame', nil, FreeUIMenubar)
holder:SetFrameLevel(3)
holder:SetPoint('TOP')
holder:SetPoint('BOTTOM')
holder:SetWidth(200)
holder:SetPoint('CENTER')
local text = F.CreateFS(holder, 'pixel', '', nil, true, 'CENTER', 0, 0)
text:SetTextColor(C.r, C.g, C.b)
text:SetDrawLayer('OVERLAY')
FreeUIStatsButton = INFOBAR:addButton('', INFOBAR.POSITION_MIDDLE, 200, function(self, button)
if InCombatLockdown() then UIErrorsFrame:AddMessage(C.InfoColor..ERR_NOT_IN_COMBAT) return end
if button == 'LeftButton' then
local openaddonlist
if AddonList:IsVisible() then
openaddonlist = true
end
if not openaddonlist then
ShowUIPanel(AddonList)
else
HideUIPanel(AddonList)
end
elseif button == 'RightButton' then
TimeManagerClockButton_OnClick(TimeManagerClockButton)
end
end)
FreeUIStatsButton:SetWidth(250)
FreeUIStatsButton:SetScript('OnUpdate', function(self, elapsed)
last = last + elapsed
lastLag = lastLag + elapsed
if lastLag >= 30 then
_, _, home, world = GetNetStats()
lastLag = 0
end
if last >= 1 then
text:SetText('|cffffffff'..floor(GetFramerate() + .5)..'|r fps |cffffffff'..(home)..'|r/|cffffffff'..(world)..'|r ms |cffffffff'..GameTime_GetTime(false))
last = 0
end
end)
FreeUIStatsButton:HookScript('OnEnter', function(self)
if InCombatLockdown() then return end
collectgarbage()
UpdateAddOnMemoryUsage()
for i = 1, GetNumAddOns() do
if IsAddOnLoaded(i) then
memory = GetAddOnMemoryUsage(i)
n = n + 1
addons[n] = {name = GetAddOnInfo(i), memory = memory}
total = total + memory
end
end
sort(addons, order)
GameTooltip:SetOwner(self, 'ANCHOR_BOTTOM', 0, -15)
GameTooltip:ClearLines()
GameTooltip:AddLine(L['INFOBAR_INFO'], .9, .82, .62)
GameTooltip:AddLine(' ')
GameTooltip:AddDoubleLine(L['INFOBAR_LOCAL_TIME'], GameTime_GetLocalTime(true), .6,.8,1 ,1,1,1)
GameTooltip:AddDoubleLine(L['INFOBAR_REALM_TIME'], GameTime_GetGameTime(true), .6,.8,1 ,1,1,1)
GameTooltip:AddLine(' ')
GameTooltip:AddDoubleLine(ADDONS, formatMemory(total), .9, .82, .62, memoryColor(total))
--GameTooltip:AddLine(' ')
for _, entry in next, addons do
GameTooltip:AddDoubleLine(entry.name, formatMemory(entry.memory), 1, 1, 1, memoryColor(entry.memory))
end
GameTooltip:AddLine(' ')
GameTooltip:AddDoubleLine(' ', C.LineString)
GameTooltip:AddDoubleLine(' ', C.LeftButton..L['INFOBAR_OPEN_ADDON_PANEL']..' ', 1,1,1, .9, .82, .62)
GameTooltip:AddDoubleLine(' ', C.RightButton..L['INFOBAR_OPEN_TIMER_TRACKER']..' ', 1,1,1, .9, .82, .62)
GameTooltip:Show()
end)
FreeUIStatsButton:HookScript('OnLeave', function(self)
GameTooltip:Hide()
n, total = 0, 0
wipe(addons)
end)
end
|
-- Author: Lupus590
-- License: Unlicense
function confirmLoop(...)
local prompt = {...}
if #prompt > 1 then error("Too many args",2) end
prompt = prompt[1] or ""
if type(prompt) ~= "string" then error("Bad arg, expected string",2) end
print(prompt.." (Y/N)")
local input
repeat
local _, i = os.pullEvent("char")
input = i:lower()
until input == "y" or input == "n"
print(input:upper())
return (input == "y")
end
|
-- Copyright (c) 2015 Adobe Systems Incorporated. All rights reserved.
--
-- Permission is hereby granted, free of charge, to any person obtaining a
-- copy of this software and associated documentation files (the "Software"),
-- to deal in the Software without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-- DEALINGS IN THE SOFTWARE.
-- Generic HMAC Validator implementation
-- This should replace the hmacSha1SignatureValidator
-- Dependencies:
-- 1. ngx.var.hmac_source_string - source string to encode using ngx.var.hmac_secret
-- 2. ngx.var.hmac_target_string - hmac to compare against
-- 3. ngx.var.hmac_secret - secret used to compile the ngx.var.hmac_source_string
-- Created by IntelliJ IDEA.
-- User: ddascal
-- Date: 01/04/14
-- Time: 00:19
-- To change this template use File | Settings | File Templates.
--
local BaseValidator = require "api-gateway.validation.validator"
local RestyHMAC = require "api-gateway.resty.hmac"
local cjson = require "cjson"
local _M = BaseValidator:new()
local RESPONSES = {
MISSING_SIGNATURE = { error_code = "403030", message = "Signature is missing" },
INVALID_SIGNATURE = { error_code = "403033", message = "Signature is invalid" },
MISSING_SOURCE = { error_code = "400001", message = "Missing digest source" },
MISSING_SECRET = { error_code = "400002", message = "Missing digest secret" },
-- unknown error is not used at the moment
UNKNOWN_ERROR = { error_code = "503030", message = "Could not validate Signature"}
}
function _M:validateSignature()
local source = ngx.var.hmac_source_string
local secret = ngx.var.hmac_secret or ngx.ctx.key_secret -- ngx.ctx.key_secret is set by api key validator
local target = ngx.var.hmac_target_string
local algorithm = ngx.var.hmac_method
if ( source == nil or secret == nil or target == nil) then
ngx.log(ngx.WARN, "Invalid request. source=" .. tostring(source) .. ",secret=" .. tostring(secret) .. ",target=" .. tostring(target))
return self:exitFn(RESPONSES.MISSING_SIGNATURE.error_code, cjson.encode(RESPONSES.MISSING_SIGNATURE))
end
local hmac = RestyHMAC:new()
local digest = ngx.encode_base64(hmac:digest(algorithm, secret, self:getHmacSource(source), true))
self:debug(ngx.WARN, "Testing HMAC DIGEST WITH secret=" .. secret)
if ( digest == target ) then
return self:exitFn(ngx.HTTP_OK)
end
ngx.log(ngx.WARN, "HMAC signature missmatch. Expected:" .. tostring(target) .. ", but got:" .. tostring(digest), ", HMAC Algorithm=", algorithm )
return self:exitFn(RESPONSES.INVALID_SIGNATURE.error_code, cjson.encode(RESPONSES.INVALID_SIGNATURE))
end
function _M:generateSignature()
local source = ngx.var.hmac_sign_source_string
local secret = ngx.var.hmac_sign_secret or ngx.ctx.key_secret -- ngx.ctx.key_secret is set by api key validator
local algorithm = ngx.var.hmac_sign_method
if source == nil or source == '' then
ngx.log(ngx.WARN, "Invalid sign request. Missing source.")
return self:exitFn(RESPONSES.MISSING_SOURCE.error_code, cjson.encode(RESPONSES.MISSING_SOURCE))
end
if secret == nil or secret == '' then
ngx.log(ngx.WARN, "Invalid sign request. Missing secret.")
return self:exitFn(RESPONSES.MISSING_SECRET.error_code, cjson.encode(RESPONSES.MISSING_SECRET))
end
local hmac = RestyHMAC:new()
local digest = ngx.encode_base64(hmac:digest(algorithm, secret, self:getHmacSource(source), true))
self:debug(ngx.DEBUG, "Generate HMAC DIGEST WITH secret=" .. secret .. " Got digest " .. digest .. " for source " .. source)
ngx.var.generated_digest = digest
return self:exitFn(ngx.HTTP_OK)
end
-- method to be overriden in the super classes to return another source
-- some implementations may choose to apply a lowercase or other transformations
-- NOTE: the same can be achieved by using
-- "set_by_lua $hmac_source_string 'return string.lower(ngx.var.request_method .. ngx.var.uri .. ngx.var.api_key)';"
function _M:getHmacSource( source )
return source
end
return _M |
return function (filename)
if file.open(filename) then
file.close()
return true
end
return false
end
|
return function(config, on_attach)
config.json.setup {
on_attach = on_attach,
}
end
|
NDefines.NMilitary.BASE_DIVISION_BRIGADE_GROUP_COST = 1;
NDefines.NMilitary.BASE_DIVISION_BRIGADE_CHANGE_COST = 1;
NDefines.NMilitary.BASE_DIVISION_SUPPORT_SLOT_COST = 1;
|
-----------------------------------
-- Area: Ifrit's Cauldron
-- NM: Foreseer Oramix
-----------------------------------
mixins = {require("scripts/mixins/job_special")}
-----------------------------------
function onMobDeath(mob, player, isKiller)
end
|
local uv = require "lluv"
local chunk_size = 10
local file_name = "test.txt"
local function on_close()
print("Close:", file_name)
os.remove(file_name)
print("Remove:", file_name)
end
local offset = 0
local function on_read_data(file, err, buf, size)
print("Read:", err or (size==0) and "EOF" or size)
-- error
if err or size == 0 then
file:close(on_close)
if buf then buf:free() end
return
end
assert(buf:size() == chunk_size)
assert(buf:size() >= size )
offset = offset + size
print(buf:to_s(size))
file:read(buf, offset, on_read_data)
end
local function on_open(file, err, path)
print("Open:", path, err or file)
if err then return end
file:read(chunk_size, on_read_data)
end
uv.fs_open(file_name, "w+", function(file, err, path)
print("Create:", path, err or file)
if err then return end
file:write(("0123456789"):rep(3) .. "012345")
print("Write test data")
file:close(function()
print("Close:", path)
uv.fs_open(path, "r+", on_open)
end)
end)
uv.run(debug.traceback)
|
-- Variables
local lastSpectateCoord = nil
local isSpectating = false
-- Events
RegisterNetEvent('qb-admin:client:inventory')
AddEventHandler('qb-admin:client:inventory', function(targetPed)
TriggerServerEvent("inventory:server:OpenInventory", "otherplayer", targetPed)
end)
RegisterNetEvent('qb-admin:client:spectate')
AddEventHandler('qb-admin:client:spectate', function(targetPed, coords)
local myPed = PlayerPedId()
local targetplayer = GetPlayerFromServerId(targetPed)
local target = GetPlayerPed(targetplayer)
if not isSpectating then
isSpectating = true
SetEntityVisible(myPed, false) -- Set invisible
SetEntityInvincible(myPed, true) -- set godmode
lastSpectateCoord = GetEntityCoords(myPed) -- save my last coords
SetEntityCoords(myPed, coords) -- Teleport To Player
NetworkSetInSpectatorMode(true, target) -- Enter Spectate Mode
else
isSpectating = false
NetworkSetInSpectatorMode(false, target) -- Remove From Spectate Mode
SetEntityCoords(myPed, lastSpectateCoord) -- Return Me To My Coords
SetEntityVisible(myPed, true) -- Remove invisible
SetEntityInvincible(myPed, false) -- Remove godmode
lastSpectateCoord = nil -- Reset Last Saved Coords
end
end)
RegisterNetEvent('qb-admin:client:SendReport')
AddEventHandler('qb-admin:client:SendReport', function(name, src, msg)
TriggerServerEvent('qb-admin:server:SendReport', name, src, msg)
end)
RegisterNetEvent('qb-admin:client:SendStaffChat')
AddEventHandler('qb-admin:client:SendStaffChat', function(name, msg)
TriggerServerEvent('qb-admin:server:StaffChatMessage', name, msg)
end)
RegisterNetEvent('qb-admin:client:SaveCar')
AddEventHandler('qb-admin:client:SaveCar', function()
local ped = PlayerPedId()
local veh = GetVehiclePedIsIn(ped)
if veh ~= nil and veh ~= 0 then
local plate = GetVehicleNumberPlateText(veh)
local props = QBCore.Functions.GetVehicleProperties(veh)
local hash = props.model
local vehname = GetDisplayNameFromVehicleModel(hash):lower()
if QBCore.Shared.Vehicles[vehname] ~= nil and next(QBCore.Shared.Vehicles[vehname]) ~= nil then
TriggerServerEvent('qb-admin:server:SaveCar', props, QBCore.Shared.Vehicles[vehname], `veh`, plate)
else
QBCore.Functions.Notify('You cant store this vehicle in your garage..', 'error')
end
else
QBCore.Functions.Notify('You are not in a vehicle..', 'error')
end
end)
RegisterNetEvent('qb-admin:client:SetModel')
AddEventHandler('qb-admin:client:SetModel', function(skin)
local ped = PlayerPedId()
local model = GetHashKey(skin)
SetEntityInvincible(ped, true)
if IsModelInCdimage(model) and IsModelValid(model) then
LoadPlayerModel(model)
SetPlayerModel(PlayerId(), model)
if isPedAllowedRandom(skin) then
SetPedRandomComponentVariation(ped, true)
end
SetModelAsNoLongerNeeded(model)
end
SetEntityInvincible(ped, false)
end)
RegisterNetEvent('qb-admin:client:SetSpeed')
AddEventHandler('qb-admin:client:SetSpeed', function(speed)
local ped = PlayerId()
if speed == "fast" then
SetRunSprintMultiplierForPlayer(ped, 1.49)
SetSwimMultiplierForPlayer(ped, 1.49)
else
SetRunSprintMultiplierForPlayer(ped, 1.0)
SetSwimMultiplierForPlayer(ped, 1.0)
end
end)
RegisterNetEvent('qb-weapons:client:SetWeaponAmmoManual')
AddEventHandler('qb-weapons:client:SetWeaponAmmoManual', function(weapon, ammo)
local ped = PlayerPedId()
if weapon ~= "current" then
local weapon = weapon:upper()
SetPedAmmo(ped, GetHashKey(weapon), ammo)
QBCore.Functions.Notify('+'..ammo..' Ammo for the '..QBCore.Shared.Weapons[GetHashKey(weapon)]["label"], 'success')
else
local weapon = GetSelectedPedWeapon(ped)
if weapon ~= nil then
SetPedAmmo(ped, weapon, ammo)
QBCore.Functions.Notify('+'..ammo..' Ammo for the '..QBCore.Shared.Weapons[weapon]["label"], 'success')
else
QBCore.Functions.Notify('You dont have a weapon in your hands..', 'error')
end
end
end)
RegisterNetEvent('qb-admin:client:GiveNuiFocus')
AddEventHandler('qb-admin:client:GiveNuiFocus', function(focus, mouse)
SetNuiFocus(focus, mouse)
end) |
local atlases = require("atlases")
local utils = require("utils")
local drawing = require("utils.drawing")
local drawableSpriteStruct = {}
local drawableSpriteMt = {}
drawableSpriteMt.__index = {}
function drawableSpriteMt.__index:setJustification(justificationX, justificationY)
self.justificationX = justificationX
self.justificationY = justificationY
return self
end
function drawableSpriteMt.__index:setPosition(x, y)
self.x = x
self.y = y
return self
end
function drawableSpriteMt.__index:addPosition(x, y)
self.x += x
self.y += y
return self
end
function drawableSpriteMt.__index:setScale(scaleX, scaleY)
self.scaleX = scaleX
self.scaleY = scaleY
return self
end
function drawableSpriteMt.__index:setOffset(offsetX, offsetY)
self.offsetX = offsetX
self.offsetY = offsetY
return self
end
local function setColor(target, color)
local tableColor = utils.getColor(color)
if tableColor then
target.color = tableColor
end
return tableColor ~= nil
end
function drawableSpriteMt.__index:setColor(color)
return setColor(self, color)
end
-- TODO - Verify that scales are correct
function drawableSpriteMt.__index:getRectangleRaw()
local x = self.x
local y = self.y
local width = self.meta.width
local height = self.meta.height
local realWidth = self.meta.realWidth
local realHeight = self.meta.realHeight
local offsetX = self.offsetX or self.meta.offsetX
local offsetY = self.offsetY or self.meta.offsetY
local justificationX = self.justificationX
local justificationY = self.justificationY
local rotation = self.rotation
local scaleX = self.scaleX
local scaleY = self.scaleY
local drawX = math.floor(x - (realWidth * justificationX + offsetX) * scaleX)
local drawY = math.floor(y - (realHeight * justificationY + offsetY) * scaleY)
drawX += (scaleX < 0 and width * scaleX or 0)
drawY += (scaleY < 0 and height * scaleY or 0)
local drawWidth = width * math.abs(scaleX)
local drawHeight = height * math.abs(scaleY)
if rotation and rotation ~= 0 then
-- Shorthand for each corner
-- Remove x and y before rotation, otherwise we rotate around the wrong origin
local tlx, tly = drawX - x, drawY - y
local trx, try = drawX - x + drawWidth, drawY - y
local blx, bly = drawX - x, drawY - y + drawHeight
local brx, bry = drawX - x + drawWidth, drawY - y + drawHeight
-- Apply rotation
tlx, tly = utils.rotate(tlx, tly, rotation)
trx, try = utils.rotate(trx, try, rotation)
blx, bly = utils.rotate(blx, bly, rotation)
brx, bry = utils.rotate(brx, bry, rotation)
-- Find the best point for top left and bottom right
local bestTlx, bestTly = math.min(tlx, trx, blx, brx), math.min(tly, try, bly, bry)
local bestBrx, bestBry = math.max(tlx, trx, blx, brx), math.max(tly, try, bly, bry)
drawX, drawY = utils.round(x + bestTlx), utils.round(y + bestTly)
drawWidth, drawHeight = utils.round(bestBrx - bestTlx), utils.round(bestBry - bestTly)
end
return drawX, drawY, drawWidth, drawHeight
end
function drawableSpriteMt.__index:getRectangle()
return utils.rectangle(self:getRectangleRaw())
end
function drawableSpriteMt.__index:drawRectangle(mode, color)
mode = mode or "fill"
if color then
drawing.callKeepOriginalColor(function()
love.graphics.setColor(color)
love.graphics.rectangle(mode, self:getRectangleRaw())
end)
else
love.graphics.rectangle(mode, self:getRectangleRaw())
end
end
function drawableSpriteMt.__index:draw()
local offsetX = self.offsetX or math.floor((self.justificationX or 0.0) * self.meta.realWidth + self.meta.offsetX)
local offsetY = self.offsetY or math.floor((self.justificationY or 0.0) * self.meta.realHeight + self.meta.offsetY)
local layer = self.meta.layer
if self.color and type(self.color) == "table" then
drawing.callKeepOriginalColor(function()
love.graphics.setColor(self.color)
if layer then
love.graphics.drawLayer(self.meta.image, layer, self.quad, self.x, self.y, self.rotation, self.scaleX, self.scaleY, offsetX, offsetY)
else
love.graphics.draw(self.meta.image, self.quad, self.x, self.y, self.rotation, self.scaleX, self.scaleY, offsetX, offsetY)
end
end)
else
if layer then
love.graphics.drawLayer(self.meta.image, layer, self.quad, self.x, self.y, self.rotation, self.scaleX, self.scaleY, offsetX, offsetY)
else
love.graphics.draw(self.meta.image, self.quad, self.x, self.y, self.rotation, self.scaleX, self.scaleY, offsetX, offsetY)
end
end
end
function drawableSpriteMt.__index:getRelativeQuad(x, y, width, height, hideOverflow, realSize)
local imageMeta = self.meta
if imageMeta then
local quadTable
if type(x) == "table" then
quadTable = x
x, y, width, height = x[1], x[2], x[3], x[4]
hideOverflow = y
realSize = width
else
quadTable = {x, y, width, height}
end
if not imageMeta.quadCache then
imageMeta.quadCache = {}
end
-- Get value with false as default, then change it to the quad
-- Otherwise we are just creating the quad every single request
local quadCache = imageMeta.quadCache
local value = utils.getPath(quadCache, quadTable, false, true)
if value then
return unpack(value)
else
local quad, offsetX, offsetY = drawing.getRelativeQuad(imageMeta, x, y, width, height, hideOverflow, realSize)
quadCache[x][y][width][height] = {quad, offsetX, offsetY}
return quad, offsetX, offsetY
end
end
end
function drawableSpriteMt.__index:useRelativeQuad(x, y, width, height, hideOverflow, realSize)
local quad, offsetX, offsetY = self:getRelativeQuad(x, y, width, height, hideOverflow, realSize)
self.quad = quad
self.offsetX = (self.offsetX or 0) + offsetX
self.offsetY = (self.offsetY or 0) + offsetY
end
function drawableSpriteStruct.fromMeta(meta, data)
data = data or {}
local drawableSprite = {
_type = "drawableSprite"
}
drawableSprite.x = data.x or 0
drawableSprite.y = data.y or 0
drawableSprite.justificationX = data.jx or data.justificationX or 0.5
drawableSprite.justificationY = data.jy or data.justificationY or 0.5
drawableSprite.scaleX = data.sx or data.scaleX or 1
drawableSprite.scaleY = data.sy or data.scaleY or 1
drawableSprite.rotation = data.r or data.rotation or 0
drawableSprite.depth = data.depth
drawableSprite.meta = meta
drawableSprite.quad = data.quad or meta and meta.quad
if data.color then
setColor(drawableSprite, data.color)
end
return setmetatable(drawableSprite, drawableSpriteMt)
end
function drawableSpriteStruct.fromTexture(texture, data)
local atlas = data and data.atlas or "Gameplay"
local spriteMeta = atlases.getResource(texture, atlas)
if spriteMeta then
return drawableSpriteStruct.fromMeta(spriteMeta, data)
end
end
function drawableSpriteStruct.fromInternalTexture(texture, data)
return drawableSpriteStruct.fromTexture(atlases.addInternalPrefix(texture), data)
end
return drawableSpriteStruct |
--------------------------------------------------------------------------------
-- Telemetry writer
--------------------------------------------------------------------------------
Metrostroi.DefineSystem("Telemetry")
function TRAIN_SYSTEM:Initialize()
self.SubIterations = 16 -- Use many sub-iterations to record all transients
end
function TRAIN_SYSTEM:Inputs()
return { }
end
function TRAIN_SYSTEM:Outputs()
return { }
end
function TRAIN_SYSTEM:Think(dT)
-- Generate file name
if not self.DataName then
self.DataName = "garrysmod\\data\\metrostroi_telemetry\\telemetry_"..os.date("%Y%m%d_%H%M%S").."_"..string.format("%04d",1000*math.random())..".txt"
self.Time = 0
self.SystemsList = {}
for k,v in pairs(self.Train.Systems) do
table.insert(self.SystemsList,k)
end
table.sort(self.SystemsList)
end
-- Write header for the telemetry file
if (not self.WroteHeader) and (self.DataName) then
local header = "Time\tSpeed\tAcceleration\t"
for i=1,32 do
header = header.."TW"..i.."\t"
end
for _,d in ipairs(self.SystemsList) do
local k = d
local v = self.Train.Systems[d]
if v.OutputsList then
for i=1,#v.OutputsList do
header = header..k.."."..v.OutputsList[i].."\t"
end
end
end
header = header.."\n"
local f = io.open(self.DataName,"w+")
if not f then return end
f:write(header)
f:close()
self.WroteHeader = true
end
-- Write actual telemetry
if self.WroteHeader then
local f = io.open(self.DataName,"a+")
if not f then return end
f:write((self.Time or 0).."\t")
f:write((self.Train.Engines.Speed or 0).."\t")
f:write((0 or 0).."\t")
for i=1,32 do
f:write((self.Train:ReadTrainWire(i) or 0).."\t")
end
for _,d in ipairs(self.SystemsList) do
local k = d
local v = self.Train.Systems[d]
if v.OutputsList then
for i=1,#v.OutputsList do
f:write(tostring(v[ v.OutputsList[i] ] or 0).."\t")
end
end
end
f:write("\n")
f:close()
self.Time = self.Time + dT
end
end
|
return PlaceObj("ModDef", {
"title", "Christmas Mars",
"version", 2,
"version_major", 0,
"version_minor", 2,
"image", "Preview.jpg",
"id", "ChoGGi_ChristmasMars",
"steam_id", "1497717990",
"pops_any_uuid", "e34e2c88-94ba-45c1-94f9-4426238315c1",
"author", "ChoGGi",
"lua_revision", 1001569,
"code", {
"Code/Script.lua",
"Code/Colours.lua",
},
"description", [[During December all new games will have a Christmassy theme (white, red, green).
Also has a logo that's good for all year round (it'll be the default during December).]],
}) |
local modes = {}
modes['Sprint'] = true
local checkpoints
function onMapStart(mapInfo, mapOptions, gameOptions)
for i, player in ipairs(getElementsByType("player")) do
triggerClientEvent(player, "deleteSigns" ,root)
end
if not modes[exports.race:getRaceMode()] then return false end
checkpoints = exports.race:getCheckPoints()
for i, checkpoint in ipairs(checkpoints) do
-- This checkpoint has a vehicle change
if checkpoint.vehicle then
for j, player in ipairs(getElementsByType("player")) do
triggerClientEvent(player, "setSign",root, i , checkpoint.position, getVehicleType(checkpoint.vehicle), getVehicleNameFromModel(checkpoint.vehicle), checkpoint.type)
end
end
end
end
addEventHandler("onMapStarting", getRootElement(), onMapStart)
function onPlayerJoin()
if not modes[exports.race:getRaceMode()] then return false end
for i, checkpoint in ipairs(checkpoints) do
if checkpoint.vehicle then
triggerClientEvent(source, "setSign", root, i, checkpoint.position, getVehicleType(checkpoint.vehicle), getVehicleNameFromModel(checkpoint.vehicle), checkpoint.type)
end
end
end
addEventHandler("onPlayerJoin", root, onPlayerJoin)
function onPlayerReachCheckpoint(cp)
if not modes[exports.race:getRaceMode()] then return false end
triggerClientEvent(source, "hideSign", root, cp)
triggerClientEvent(source, "showSign", root, cp + 1)
for k, v in ipairs(getElementsByType("player")) do
if v ~= source then
local state = getElementData(v, "player state")
if state ~= "alive" then
local player = false
local target = getCameraTarget(v)
if target and getElementType(target) == "vehicle" then
player = getVehicleOccupant(target)
elseif target and getElementType(target) == "player" then
player = target
end
if player and player == source then
for i, checkpoint in ipairs(checkpoints) do
triggerClientEvent(v, "hideSign", root, i)
end
local x, y, z = getElementPosition(player)
triggerClientEvent(v, "updateIconsPosition", root, z)
triggerClientEvent(v, "showSign", root, cp + 1)
end
end
end
end
end
addEventHandler("onPlayerReachCheckpoint", root, onPlayerReachCheckpoint)
addEvent("onPlayerFinish", true)
function onPlayerFinish()
if not modes[exports.race:getRaceMode()] then return false end
for i, checkpoint in ipairs(checkpoints) do
triggerClientEvent(source, "hideSign", root, i)
end
setTimer(function(player)
triggerClientEvent(player, "showVehChangeIcon", root)
end, 5000, 1, source)
end
addEventHandler("onPlayerFinish", root, onPlayerFinish)
addEvent("removeIconsOnTimeUp", true)
function onTimeIsUp()
if not modes[exports.race:getRaceMode()] then return false end
for k, v in ipairs(getElementsByType("player")) do
for i, checkpoint in ipairs(checkpoints) do
triggerClientEvent(v, "hideSign", root, i)
end
end
end
addEventHandler("removeIconsOnTimeUp", root, onTimeIsUp)
function onPlayerSpawn()
if not modes[exports.race:getRaceMode()] then return false end
setTimer(function(player)
local cp = getElementData(player, "race.checkpoint")
if cp then
for i, checkpoint in ipairs(checkpoints) do
triggerClientEvent(player, "hideSign", root, i)
end
triggerClientEvent(player, "showSign", root, cp)
end
end, 100, 1, source)
end
addEventHandler("onPlayerSpawn", root, onPlayerSpawn)
|
------------------------------------------------------------
-- Copyright (c) 2016 tacigar. All rights reserved.
-- https://github.com/tacigar/maidroid
------------------------------------------------------------
maidroid = {}
maidroid.modname = "maidroid"
maidroid.modpath = minetest.get_modpath(maidroid.modname)
dofile(maidroid.modpath .. "/api.lua")
dofile(maidroid.modpath .. "/register.lua")
dofile(maidroid.modpath .. "/crafting.lua")
|
-----------------------------------------------------------------------
-- FILE: luaotfload-embolden.lua
-- DESCRIPTION: part of luaotfload / embolden
-----------------------------------------------------------------------
assert(luaotfload_module, "This is a part of luaotfload and should not be loaded independently") {
name = "luaotfload-embolden",
version = "3.18", --TAGVERSION
date = "2021-05-21", --TAGDATE
description = "luaotfload submodule / embolden",
license = "GPL v2.0",
author = "Marcel Krüger"
}
local otffeatures = fonts.constructors.newfeatures "otf"
local function enableembolden(tfmdata, _, embolden)
tfmdata.mode, tfmdata.width = 2, tfmdata.size*embolden/6578.176
end
otffeatures.register {
name = "embolden",
description = "embolden",
manipulators = {
base = enableembolden,
node = enableembolden,
plug = enableembolden,
}
}
--- vim:sw=2:ts=2:expandtab:tw=71
|
local name, CLM = ...;
local CM = LibStub("AceConfig-3.0")
local LOG = CLM.LOG
function CM:Initialize()
LOG:Info("Config Manager initialized")
self.options = { type = "group", args = {}}
end
function CM:Register(options, slashcmd)
LOG:Info("Registering new option")
if type(table) ~= "table" then
LOG:Fatal("Provided object is not a table")
return false
end
for option, definition in pairs(options) do
if self.options.args[option] == nil then
self.options.args[option] = definition
else
LOG:Warning("Option ".. tostring(option) .." already set. Ignoring.")
end
end
self:RegisterOptionsTable(name, self.options, "clm")
return true
end
CLM.Interconnect.ConfigManager.Initialize = function() CM:Initialize() end
CLM.Interconnect.ConfigManager.Register = function(o, s) CM:Register(o, s) end
--CLM.Interconnect.Update = CM:Update |
ITEM.name = "Стальная палица"
ITEM.desc = "Небольшая дубинка, отлитая из стали, что придает ей солидную массу."
ITEM.class = "nut_club_steel"
ITEM.weaponCategory = "secondary"
ITEM.price = 300
ITEM.category = "Оружие"
ITEM.model = "models/morrowind/steel/club/w_steel_club.mdl"
ITEM.width = 3
ITEM.height = 1
ITEM.iconCam = {
pos = Vector(-1.9879275560379, 45.912052154541, 0),
ang = Angle(0, 270, -98.252250671387),
fov = 45
}
ITEM.damage = {1, 8}
ITEM.permit = "melee"
ITEM.pacData = {[1] = {
["children"] = {
[1] = {
["children"] = {
[1] = {
["children"] = {
},
["self"] = {
["Event"] = "weapon_class",
["Arguments"] = "nut_club_steel",
["UniqueID"] = "4011003967",
["ClassName"] = "event",
},
},
},
["self"] = {
["Angles"] = Angle(-1.458613038063, -48.091259002686, -104.06153106689),
["UniqueID"] = "732790205",
["Position"] = Vector(0.24237060546875, 3.342041015625, -2.970947265625),
["EditorExpand"] = true,
["Bone"] = "right thigh",
["Model"] = "models/morrowind/steel/club/w_steel_club.mdl",
["ClassName"] = "model",
},
},
},
["self"] = {
["EditorExpand"] = true,
["UniqueID"] = "2083764954",
["ClassName"] = "group",
["Name"] = "my outfit",
["Description"] = "add parts to me!",
},
},
} |
local M = {}
local Runner = torch.class('Runner', M)
function Runner:__init()
end
function Runner:computeScore(output, target, nCrops)
if nCrops > 1 then
-- Sum over crops
output = output:view(output:size(1) / nCrops, nCrops, output:size(2))
--:exp()
:sum(2):squeeze(2)
end
-- Coputes the top1 and top5 error rate
local batchSize = output:size(1)
local _ , predictions = output:float():sort(2, true) -- descending
-- Find which predictions match the target
local correct = predictions:eq(
target:long():view(batchSize, 1):expandAs(output))
-- Top-1 score
local top1 = 1.0 - (correct:narrow(2, 1, 1):sum() / batchSize)
-- Top-5 score, if there are at least 5 classes
local len = math.min(5, correct:size(2))
local top5 = 1.0 - (correct:narrow(2, 1, len):sum() / batchSize)
return top1 * 100, top5 * 100
end
function Runner:copyInputs(sample)
-- Copies the input to a CUDA tensor, if using 1 GPU, or to pinned memory,
-- if using DataParallelTable. The target is always copied to a CUDA tensor
self.input = self.input or (self.opt.nGPU == 1
and torch.CudaTensor()
or cutorch.createCudaHostTensor())
self.target = self.target or torch.CudaTensor()
self.input:resize(sample.input:size()):copy(sample.input)
self.target:resize(sample.target:size()):copy(sample.target)
end
return M.Runner
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.