content
stringlengths 5
1.05M
|
---|
local groups = {}
for _, hotkey in ipairs(awful.key.hotkeys) do
if not groups[hotkey.group] then
groups[hotkey.group] = {}
end
table.insert(groups[hotkey.group], hotkey)
end
-- TODO: Refactor some bits to not use globals
-- Flatten table containing tables of strings
function tbl_flat(tbl)
local out = {}
for _, tables in ipairs(tbl) do
for _, _string in ipairs(tables) do
table.insert(out, _string)
end
end
return out
end
groups.User.color = beautiful.fg_blue
groups.awesome.color = beautiful.fg_suble
groups.client.color = beautiful.fg_yellow
-- groups.launcher.color = "#d7827e"
-- groups.screen.color = "#286983"
groups.tag.color = beautiful.fg_dark_red
groups.layout.color = beautiful.fg_inactive
local data = wibox.widget({
layout = wibox.layout.grid.horizontal,
fixed_num_cols = 2,
vertical_spacing = dpi(1),
})
-- local M ={}
local groups_sidebar = wibox.widget({
layout = wibox.layout.fixed.vertical,
})
local function sidebar_item(name, color)
return wibox.widget({
{
{
{
widget = wibox.widget.textbox,
markup = '<span foreground="#faf4ed">' .. name .. "</span>",
font = "UnifontMedium Nerd Font 12",
},
widget = wibox.container.rotate,
direction = "east",
},
widget = wibox.container.margin,
margins = dpi(8),
buttons = awful.button({}, mouse.LEFT, function()
update(key)
update_sidebar(key)
end),
},
widget = wibox.container.background,
bg = color,
})
end
local function key_widget(hotkeys, color)
return {
{
{
widget = wibox.widget.textbox,
markup = "<b>" .. table.concat(hotkeys.mod, "</b> + <b>") .. "</b> + " .. table.concat(
tbl_flat(hotkeys.keys),
" + "
),
},
widget = wibox.container.margin,
top = dpi(3),
bottom = dpi(3),
},
widget = wibox.container.margin,
bottom = dpi(1),
color = color,
}
end
local function description_widget(desc, color)
return {
{
{
widget = wibox.widget.textbox,
markup = desc,
},
widget = wibox.container.margin,
top = dpi(3),
bottom = dpi(3),
},
widget = wibox.container.margin,
bottom = dpi(1),
color = color,
}
end
function update_sidebar(selected)
groups_sidebar:reset()
for key, group in pairs(groups) do
local name = require("misc.libs.stdlib").title_case(key)
if selected == key then
name = "<b>" .. name .. "</b>"
end
-- Yeah, I dunno whats going on here with the ternary statement
groups_sidebar:add(
sidebar_item(name, group.color or (selected == key and beautiful.fg_inactive or beautiful.fg_subtle))
)
end
end
function update(selected)
data:reset()
for idx, hotkeys in ipairs(groups[selected]) do
data:insert_row()
if hotkeys.mod[1] == "Mod1" then
hotkeys.mod[1] = "Alt"
elseif hotkeys.mod[1] == "Mod4" then
hotkeys.mod[1] = "Super"
end
local c = idx ~= #groups[selected] and beautiful.fg_inactive or nil
data:add(key_widget(hotkeys, c))
data:add(description_widget(hotkeys.description, c))
end
end
-- Init
update_sidebar("User")
update("User")
local window = awful.popup({
placement = awful.placement.centered,
-- minimum_width= 400,
widget = {
{ groups_sidebar, widget = wibox.container.background, bg = beautiful.bg_surface },
{
data,
widget = wibox.container.margin,
margins = dpi(12),
draw_empty = true,
},
layout = wibox.layout.fixed.horizontal,
buttons = awful.button({}, mouse.RIGHT, function(c)
c.visible = false
end),
},
visible = false,
bg = beautiful.bg_overlay,
fg = beautiful.fg_inactive,
-- hide_on_right_click = true
})
return function()
window.visible = not window.visible
end
|
-- =============================================================
-- Copyright Roaming Gamer, LLC. 2008-2018 (All Rights Reserved)
-- =============================================================
local measure = {}
local function countGlobals()
local count = 0
for k,v in pairs(_G) do
count = count+1
end
return count
end
local function round(val, n)
if (n) then return math.floor( (val * 10^n) + 0.5) / (10^n); end
return math.floor(val+0.5)
end
function string:lpad (len, char)
local theStr = self
if char == nil then char = ' ' end
return string.rep(char, len - #theStr) .. theStr
end
function string:rpad(len, char)
local theStr = self
if char == nil then char = ' ' end
return theStr .. string.rep(char, len - #theStr)
end
collectgarbage("collect")
local preMem = collectgarbage( "count" )
function measure.measure_require( path )
local gCount1 = countGlobals()
local gCount2
collectgarbage("collect")
local before = collectgarbage( "count" )
local retVal = require( path )
collectgarbage("collect")
local after = collectgarbage( "count" )
gCount2 = countGlobals()
local extraG = gCount2 - gCount1
if( extraG == 0 ) then
print( string.rpad( path, 60 ) .. " : " .. string.lpad(round( after - before ) .. " KB", 10 ) )
else
print( string.rpad( path, 60 ) .. " : " .. string.lpad(round( after - before ) .. " KB", 10 ) .. " : " .. tostring(extraG) .. " globals added." )
end
return retVal
end
function measure.summary()
collectgarbage("collect")
local postMem = collectgarbage( "count" )
print(string.rep("-",74))
print( string.rpad( "SSK Total", 60 ) .. " : " .. string.lpad(round( (postMem - preMem), 2 ) .. " KB", 10) )
print(string.rep("-",74))
end
return measure |
-- =============================================
-- Troll action logic from the player modal is located here (callbacks, events)
-- =============================================
if (GetConvar('txAdmin-menuEnabled', 'false') ~= 'true') then
return
end
local EFFECT_TIME_MS = GetConvarInt('txAdmin-menuDrunkDuration', 30)*1000
local DRUNK_ANIM_SET = "move_m@drunk@verydrunk"
local DRUNK_DRIVING_EFFECTS = {
1, -- brake
7, --turn left + accelerate
8, -- turn right + accelerate
23, -- accelerate
4, -- turn left 90 + braking
5, -- turn right 90 + braking
}
local function getRandomDrunkCarTask()
math.randomseed(GetGameTimer())
return DRUNK_DRIVING_EFFECTS[math.random(#DRUNK_DRIVING_EFFECTS)]
end
-- NOTE: We might want to check if a player already has an effect
local function drunkThread()
local playerPed = PlayerPedId()
local isDrunk = true
debugPrint('Starting drunk effect')
RequestAnimSet(DRUNK_ANIM_SET)
while not HasAnimSetLoaded(DRUNK_ANIM_SET) do
Wait(5)
end
SetPedMovementClipset(playerPed, DRUNK_ANIM_SET)
ShakeGameplayCam("DRUNK_SHAKE", 3.0)
SetPedIsDrunk(playerPed, true)
SetTransitionTimecycleModifier("spectator5", 10.00)
CreateThread(function()
while isDrunk do
local vehPedIsIn = GetVehiclePedIsIn(playerPed)
local isPedInVehicleAndDriving = (vehPedIsIn ~= 0) and (GetPedInVehicleSeat(vehPedIsIn, -1) == playerPed)
if isPedInVehicleAndDriving then
local randomTask = getRandomDrunkCarTask()
debugPrint('Dispatching random car tasks: ' .. randomTask)
TaskVehicleTempAction(playerPed, vehPedIsIn, randomTask, 500)
end
Wait(5000)
end
end)
Wait(EFFECT_TIME_MS)
debugPrint('Cleaning up drunk effect')
isDrunk = false
SetTransitionTimecycleModifier("default", 10.00)
StopGameplayCamShaking(true)
ResetPedMovementClipset(playerPed)
RemoveAnimSet(DRUNK_ANIM_SET)
end
--[[ Wild Attack command ]]
local attackAnimalHashes = {
GetHashKey("a_c_chimp"),
GetHashKey("a_c_rottweiler"),
GetHashKey("a_c_coyote")
}
local animalGroupHash = GetHashKey("Animal")
local playerGroupHash = GetHashKey("PLAYER")
local function startWildAttack()
-- Consts
local playerPed = PlayerPedId()
local animalHash = attackAnimalHashes[math.random(#attackAnimalHashes)]
local coordsBehindPlayer = GetOffsetFromEntityInWorldCoords(playerPed, 100, -15.0, 0)
local playerHeading = GetEntityHeading(playerPed)
local belowGround, groundZ, vec3OnFloor = GetGroundZAndNormalFor_3dCoord(coordsBehindPlayer.x, coordsBehindPlayer.y, coordsBehindPlayer.z)
-- Requesting model
RequestModel(animalHash)
while not HasModelLoaded(animalHash) do
Wait(5)
end
SetModelAsNoLongerNeeded(animalHash)
-- Creating Animal & setting player as enemy
local animalPed = CreatePed(1, animalHash, coordsBehindPlayer.x, coordsBehindPlayer.y, groundZ, playerHeading, true, false)
SetPedFleeAttributes(animalPed, 0, 0)
SetPedRelationshipGroupHash(animalPed, animalGroupHash)
TaskSetBlockingOfNonTemporaryEvents(animalPed, true)
TaskCombatHatedTargetsAroundPed(animalPed, 30.0, 0)
ClearPedTasks(animalPed)
TaskPutPedDirectlyIntoMelee(animalPed, playerPed, 0.0, -1.0, 0.0, 0)
SetRelationshipBetweenGroups(5, animalGroupHash, playerGroupHash)
SetRelationshipBetweenGroups(5, playerGroupHash, animalGroupHash)
end
-- RegisterCommand('atk', startWildAttack)
--[[ Net Events ]]
RegisterNetEvent('txAdmin:menu:drunkEffect', drunkThread)
RegisterNetEvent('txAdmin:menu:setOnFire', function()
debugPrint('Setting player on fire')
local playerPed = PlayerPedId()
StartEntityFire(playerPed)
end)
RegisterNetEvent('txAdmin:menu:wildAttack', function()
startWildAttack()
end)
--[[ NUI Callbacks ]]
RegisterNUICallback('drunkEffectPlayer', function(data, cb)
TriggerServerEvent('txAdmin:menu:drunkEffectPlayer', tonumber(data.id))
cb({})
end)
RegisterNUICallback('setOnFire', function(data, cb)
TriggerServerEvent('txAdmin:menu:setOnFire', tonumber(data.id))
cb({})
end)
RegisterNUICallback('wildAttack', function(data, cb)
TriggerServerEvent('txAdmin:menu:wildAttack', tonumber(data.id))
cb({})
end)
|
-- // MODULES //
local Scheduler = require(script.Parent).Module
local TimedFunction = require(script.Parent.TimedFunction).TimedFunction
-- // MAIN FUNCTIONS //
local function insert(tail, node)
if tail then
local compare = tail
while compare do
-- // behind ( [0]=([1])=[2]=[3] )
if node.item.expectedResumeTime <= compare.item.expectedResumeTime then
if compare.previous then
node.previous = compare.previous
compare.previous.next = node
else
tail = node
end
node.next = compare
compare.previous = node
break
-- // end of the node list
elseif not compare.next then
compare.next = node
node.previous = compare
break
-- // front ( [0]=[1]=[2]=([3]))
else
compare = compare.next
end
end
else
tail = node
end
return tail
end
function Scheduler:ScheduleEvery(t, func)
local timed = TimedFunction.new(t, func, self)
local node = {
next = nil,
previous = nil,
item = timed
}
local function insertIntoNode()
local tail = self._timed
self._timed = insert(tail, node)
end
if self.DoneResuming then
table.insert(self.DoneResuming, insertIntoNode)
else
insertIntoNode()
end
return timed
end
function Scheduler:_stopTimedFunction(timed)
local tail = self._timed
local node = tail
while node do
if node.item == timed then
break
end
node = node.next
end
if node then
if node.next then
node.next.previous = node.previous
end
if node.previous then
node.previous.next = node.next
else
tail = node.next
if tail then
tail.previous = nil
end
self._timed = tail
end
else
warn(tostring(timed) .. " is not timed!\n" .. (debug.traceback(nil, 3) or ''))
end
end
function Scheduler:StopTimedFunction(timed)
if self.resuming then
table.insert(self.DoneResuming, function()
self:_stopTimedFunction(timed)
end)
else
self:_stopTimedFunction(timed)
end
end
function Scheduler:_timedUpdate(currentTime)
debug.profilebegin(string.format('TimedScheduler[%s]', self.name))
self.resuming = true
self.DoneResuming = {}
local tail = self._timed
local resumed = {}
local timed = tail
while timed do
if timed.item:PastOrEqualResumeTime(currentTime) then
if not timed.item.stopped then
timed.item:Resume(currentTime)
if not timed.item.stopped then
if timed.next then
timed.next.previous = timed.previous
end
if timed.previous then
timed.previous.next = timed.next
else
tail = timed.next
if tail then
tail.previous = nil
end
self._timed = tail
end
table.insert(resumed, timed)
end
end
else
break
end
timed = timed.next
end
for _, node in ipairs(resumed) do
node.next = nil
node.previous = nil
if not node.item.stopped then
self._timed = insert(self._timed, node)
end
end
debug.profileend()
for _, f in ipairs(self.DoneResuming) do
f()
end
self.DoneResuming = nil
self.resuming = false
end
return {Scheduler = Scheduler} |
local Spell = { }
Spell.LearnTime = 300
Spell.Base = "Welding Charm"
Spell.Description = [[
Swaps two objects.
Usage: cast on some object,
then cast on another object.
Also, works on players and
NPCs.
]]
Spell.ShouldSay = false
Spell.NodeOffset = Vector(1730, -1051, 0)
Spell.SpriteColor = Color(255, 255, 255)
Spell.FlyEffect = "hpw_sectumsemp_main"
Spell.ImpactEffect = "hpw_white_impact"
Spell.AccuracyDecreaseVal = 0.5
Spell.CheckFunction = function(self, ent)
-- ent.Base checks for sent
if ent:GetClass() != "prop_physics" and not ent.Base and not (ent:IsPlayer() or ent:IsNPC()) then return false end
return true
end
function Spell:ToolCallback()
local pos1 = self.Entity1:GetPos()
self.Entity1:SetPos(self.Entity2:GetPos())
self.Entity2:SetPos(pos1)
local a = self.Entity1:GetBoneCount()
if a then
for i = 1, a - 1 do
if i % 2 != 0 then continue end
local pos, ang = self.Entity1:GetBonePosition(i)
if pos and ang then HpwRewrite.MakeEffect("hpw_white_impact", pos, ang) end
end
end
a = self.Entity2:GetBoneCount()
if a then
for i = 1, self.Entity2:GetBoneCount() - 1 do
if i % 2 != 0 then continue end
local pos, ang = self.Entity2:GetBonePosition(i)
if pos and ang then HpwRewrite.MakeEffect("hpw_white_impact", pos, ang) end
end
end
end
HpwRewrite:AddSpell("Switching Spell", Spell) |
--[[
@package Geany plugins lua
@filename geany-nest-comment/geany-nest-comment.lua
@version 3.0
@autor Díaz Urbaneja Víctor Eduardo Diex <[email protected]>
@date 03.08.2020 14:00:48
]]--
local ds = geany.dirsep
local config_dir = geany.appinfo().scriptdir .. ds .. 'support' .. ds .. 'nest-comment' .. ds
package.path = config_dir .. '?.lua;' .. package.path
geany.wordchars = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:- "
template = {
author = geany.appinfo().template.developer,
mail = geany.appinfo().template.mail,
version = geany.appinfo().template.version,
datetime = os.date("%d.%m.%Y %H:%M:%S %Z")
}
file_ext = geany.fileinfo().ext
file_name = geany.basename(geany.filename())
local sample = [[return {
['.css'] = {
['cmt'] = ('/** %s **/'):format(value),
['cmt-long'] = ('/**\n * %s\n */'):format(value),
['cmt-section'] = ('/* ============================================== */\n/* = %s = */\n/* ============================================== */\n\n/* ================= End of %s ================== */'):format(value,value),
['cmt-section-header'] = ('/* =============================================== */\n/* = %s = */\n/* =============================================== */\n'):format(value),
['cmt-section-footer'] = ('/* ================ End of %s ================= */'):format(value),
['cmt-subsection'] = ('/*-------------------------------------------------------------*/\n/* %s */\n/*-------------------------------------------------------------*/\n\n/* End of %s -------------------------------------------------*/\n'):format(value,value),
['cmt-subsection-header'] = ('/*-------------------------------------------------------------*/\n/* %s */\n/*-------------------------------------------------------------*/'):format(value),
['cmt-subsection-header'] = ('/* End of %s -------------------------------------------------*/'):format(value),
['cmt-todo'] = ('/**\n * @TODO: %s\n */'):format(value),
['cmt-head'] = ('/**!\n * @package %s\n * @filename %s\n * @version %s\n * @author %s <%s>\n * @date %s\n */'):format(value,file_name,template.version,template.author,template.mail,template.datetime)
},
['.js'] = {
['cmt'] = ('/** %s **/'):format(value),
['cmt-long'] = ('/**\n * %s\n */'):format(value),
['cmt-section'] = ('/* =============================================== */\n/* = %s = */\n/* =============================================== */\n\n/* ================ End of %s ================= */'):format(value,value),
['cmt-section-header'] = ('/* =============================================== */\n/* = %s = */\n/* =============================================== */\n'):format(value),
['cmt-section-footer'] = ('/* ================ End of %s ================= */'):format(value),
['cmt-subsection'] = ('/*-------------------------------------------------------------*/\n/* %s */\n/*-------------------------------------------------------------*/\n\n/* End of %s -------------------------------------------------*/\n'):format(value,value),
['cmt-subsection-header'] = ('/*-------------------------------------------------------------*/\n/* %s */\n/*-------------------------------------------------------------*/'):format(value),
['cmt-subsection-header'] = ('/* End of %s -------------------------------------------------*/'):format(value),
['cmt-todo'] = ('/**\n * @TODO: %s\n */'):format(value),
['cmt-head'] = ('/**!\n * @package %s\n * @filename %s\n * @version %s\n * @author %s <%s>\n * @date %s\n */'):format(value,file_name,template.version,template.author,template.mail,template.datetime)
},
['.html'] = {
['cmt'] = ('<!-- %s -->'):format(value),
['cmt-long'] = ('<!--\n\n\t%s\n\n-->'):format(value),
['cmt-section'] = ('<!-- =============================================== -->\n<!-- = %s = -->\n<!-- =============================================== -->\n\n<!-- ================== End of %s ================== -->'):format(value,value),
['cmt-section-header'] = ('<!-- =============================================== -->\n<!-- = %s = -->\n<!-- =============================================== -->'):format(value),
['cmt-section-footer'] = ('<!-- ================== End of %s ================== -->'):format(value),
['cmt-subsection'] = ('<!-- ----------------------------------------------- -->\n<!-- - %s - -->\n<!-- ----------------------------------------------- -->\n\n<!-- ------------------ End of %s ------------------ -->'):format(value,value),
['cmt-subsection-header'] = ('<!-- ----------------------------------------------- -->\n<!-- - %s - -->\n<!-- ----------------------------------------------- -->'):format(value),
['cmt-subsection-footer'] = ('<!-- ------------------ End of %s ------------------ -->'):format(value),
['cmt-todo'] = ('<!-- @TODO: %s -->'):format(value),
['cmt-head'] = ('<!--\n @package %s\n @filename %s\n @version %s\n @author %s <%s>\n @date %s\n -->'):format(value,file_name,template.version,template.author,template.mail,template.datetime)
}
}
]]
local file_exist = function (file)
local file_found = io.open(file, "r")
if (file_found == nil) then
return false
end
return true
end
selection = geany.word()
param, value = string.match(selection,'(.+):(.+)')
if not value then
return
end
local comment = function (data)
local data = data or {}
for ext, actions in pairs(data) do
if (file_ext == ext) then
for action, result in pairs(actions) do
valid = ('%s:%s'):format(action, value)
if geany.word() == valid then
a, b = geany.find(valid, 0, geany.length(), {"wholeword","matchcase"})
if (a) then
geany.select(a, b)
geany.selection('')
end
geany.selection(result)
end
end
end
end
end
local fileconf = config_dir .. 'config.lua'
if geany.fullpath(fileconf) then
config = require 'config'
else
if file_exist(config_dir) == false then
os.execute('mkdir -p ' .. config_dir)
end
geany.newfile(fileconf)
geany.open(fileconf)
geany.text(sample)
geany.save(fileconf)
geany.close(fileconf)
config = require 'config'
end
comment(config)
|
require 'networks/mc-models/fast'
require('networks/modules/Normalize2')
local McCnnFast, parent = torch.class('McCnnFast','FastNetwork')
local function createModel(opt, dataset)
return McCnnFast:new(opt, dataset)
end
function McCnnFast:__init(self, opt, dataset)
parent.__init(parent, self, opt, dataset)
end
function McCnnFast:getDescriptionNetwork()
local description = nn.Sequential()
for i = 1,self.params.l1-1 do
description:add(Convolution(i == 1 and self.n_input_plane or self.params.fm,
self.params.fm, self.params.ks, self.params.ks))
description:add(Activation())
end
description:add(Convolution(self.params.fm, self.params.fm, self.params.ks, self.params.ks))
description:add(nn.Normalize2())
return description
end
return createModel
|
--IupCanvas Example in IupLua
require( "iuplua" )
require("cdlua")
require("iupluacd")
require("imlua")
require("iupluaim")
require("cdluaim")
cnv = iup.canvas {rastersize="600x400"}
bt = iup.button{
title = "Draw Line",
}
dg = iup.dialog{
iup.vbox{
cnv,
bt
};
title="IupCanvas"
}
boxc = {x=300,y=200} -- current box center coordinates
boxImg = require("imimg") -- The image to move
local iw,ih = boxImg:Width()*2, boxImg:Height()*2
local Render
-- To print the mouse positions
function cnv:motion_cb(x, y, r)
print(x, y, r)
if move then
-- move the box here
cdbCanvas:PutImageRect(img, boxc.x-iw/2, cdbCanvas:UpdateYAxis(boxc.y-ih/2),0,0,0,0)
cdbCanvas:GetImage(img, x-move[1], cdbCanvas:UpdateYAxis(y-move[2]))
boxc.x = x-move[1]+iw/2 -- move[1] and move[2] contain the offset of the mouse pointer from the lower left corner of the box
boxc.y = y-move[2]+ih/2 -- So set the new center coordinates on the boxc array which would be used by the rendering function to draw the box
Render()
end
end
-- TO show key detections
function cnv:k_any(c)
print("c = ", c)
print(" XkeyBase(c) = ", iup.XkeyBase(c))
print(" isCtrlXkey(c)= ", iup.isCtrlXkey(c))
print(" isAltXkey(c) = ", iup.isAltXkey(c))
end
-- Draw everything needed on the canvas here
-- Maybe the buffer need not be redrawn but just the changes and then it should work. That would be faster - UNTESTED YET
function Render()
cdbCanvas:Activate()
cdbCanvas:SetBackground(cd.EncodeColor(255, 255, 255))
cdbCanvas:Clear()
cdbCanvas:SetForeground(cd.EncodeColor(0, 255, 0))
cdbCanvas:Line(10,cdbCanvas:UpdateYAxis(10),200,cdbCanvas:UpdateYAxis(200))
print("IMG: ",img)
if not img then
-- Executing 1st time fill img with the image of area where the box will be drawn
img = cdbCanvas:CreateImage(iw,ih)
print("Create initial box")
cdbCanvas:GetImage(img, boxc.x-iw/2, cdbCanvas:UpdateYAxis(boxc.y-ih/2))
-- Put the image
cdbCanvas:PutImImage(boxImg, boxc.x-iw/2,cdbCanvas:UpdateYAxis(boxc.y+ih/2),iw,ih)
-- Draw the box
--cdbCanvas:SetForeground(cd.EncodeColor(0, 0, 255))
--cdbCanvas:Box(boxc.x-10,boxc.x+10,cdbCanvas:UpdateYAxis(boxc.y-10),cdbCanvas:UpdateYAxis(boxc.y+10))
cdbCanvas:SetForeground(cd.EncodeColor(255, 0, 0))
cdbCanvas:Sector(boxc.x-iw/2,cdbCanvas:UpdateYAxis(boxc.y-ih/2),10,10,0,360)
cdbCanvas:SetForeground(cd.EncodeColor(0, 255, 0))
cdbCanvas:Sector(boxc.x-iw/2,cdbCanvas:UpdateYAxis(boxc.y+ih/2),10,10,0,360)
else
print("PutImageRect")
--cdbCanvas:PutImageRect(boxImg, boxc.x-iw/2, cdbCanvas:UpdateYAxis(boxc.y+ih/2),0,0,0,0) -- Put the box image in the new coordinates
cdbCanvas:PutImImage(boxImg, boxc.x-iw/2,cdbCanvas:UpdateYAxis(boxc.y+ih/2),iw,ih)
end
if not boxImg then
-- Executing 1st time so get the image of the drawn box
boxImg = cdbCanvas:CreateImage(iw,ih)
cdbCanvas:GetImage(boxImg, boxc.x-iw/2, cdbCanvas:UpdateYAxis(boxc.y+ih/2)) -- y + 10 because that is the lower left corner of the box
end
if doline then
cdbCanvas:SetForeground(cd.EncodeColor(255, 0, 0))
cdbCanvas:Line(100,cdbCanvas:UpdateYAxis(10),200,cdbCanvas:UpdateYAxis(20))
end
cdbCanvas:Flush() -- To switch the canvas to the buffer changes
end
-- Create the canvas and the buffer layer where the rendering will happen
function cnv:map_cb()
cdCanvas = cd.CreateCanvas(cd.IUP, self)
cdbCanvas = cd.CreateCanvas(cd.DBUFFER,cdCanvas) -- Buffer to flush to visible canvas
end
function cnv:button_cb(button,pressed,x,y,status)
if button == iup.BUTTON1 then
if pressed == 1 then
print("PRESSED COORDINATE",x,y)
if x <= boxc.x + iw/2 and x >= boxc.x-iw/2 and y <= boxc.y+ih/2 and y >= boxc.y-ih/2 then
print("SET MOVE")
move = {x-boxc.x+iw/2,y-boxc.y+ih/2}
end
else
print("RESET MOVE",boxc.x,boxc.y)
move = false
end
end
end
function cnv:unmap_cb()
cdbCanvas:Kill()
cdCanvas:Kill()
end
function cnv:action(posx,posy)
cdbCanvas:Flush() -- Dump all changes in the buffer canvas to the visible canvas
end
function cnv:resize_cb()
Render()
end
function bt:action()
doline = true
Render()
end
dg:showxy(iup.CENTER, iup.CENTER)
if (iup.MainLoopLevel()==0) then
iup.MainLoop()
end
|
hp = 1000
attack = 350
defense = 300
speed = 67
mdefense = 300
luck = 50
float = 0
strength = ELEMENT_NONE
weakness = ELEMENT_NONE
stage = 0
STAGE_INIT = 0
STAGE_FORWARD = 1
STAGE_BACKWARD = 2
SPEED = 3 / 10
sucked = false
function initId(i)
id = i
end
function start()
preloadSFX("buzz.ogg")
preloadSFX("suck.ogg")
end
function get_attack_condition()
n = getRandomNumber(2);
if (n == 0) then
return CONDITION_POISONED
else
return CONDITION_NORMAL
end
end
function get_action(step)
if (stage == STAGE_INIT) then
if (getRandomNumber(2) == 0) then
return COMBAT_ATTACKING, 1, getRandomPlayer()
else
loadPlayDestroy("buzz.ogg")
stage = stage + 1
delay = 0
start_x = battleGetX(id)
start_y = battleGetY(id)
target = getRandomPlayer()
loc = battleGetLocation(id)
battleSetSubAnimation(id, "forward")
if (loc == LOCATION_LEFT) then
dest_x = battleGetX(target)-battleGetWidth(id)/2
else
dest_x = battleGetX(target)+battleGetWidth(id)/2
end
dest_y = battleGetY(target)+battleGetHeight(target)/2
end
elseif (stage == STAGE_FORWARD) then
cx = battleGetX(id)
cy = battleGetY(id)
if (cx < dest_x) then
cx = cx + (SPEED * step)
if (cx > dest_x) then
cx = dest_x
end
elseif (cx > dest_x) then
cx = cx - (SPEED * step)
if (cx < dest_x) then
cx = dest_x
end
end
if (cy < dest_y) then
cy = cy + (SPEED * step)
if (cy > dest_y) then
cy = dest_y
end
elseif (cy > dest_y) then
cy = cy - (SPEED * step)
if (cy < dest_y) then
cy = dest_y
end
end
battleSetX(id, cx)
battleSetY(id, cy)
battleResortEntity(id)
if (cx == dest_x and cy == dest_y) then
if (not sucked) then
sucked = true
loadPlayDestroy("suck.ogg")
if (loc == LOCATION_LEFT) then
battleAddMessage(MESSAGE_LEFT, "Brain Drain", 3000)
else
battleAddMessage(MESSAGE_RIGHT, "Brain Drain", 3000)
end
end
delay = delay + step
if (delay > 2000) then
battleKillCombatant(target)
stage = stage + 1
battleSetSubAnimation(id, "backward")
loadPlayDestroy("buzz.ogg")
sucked = false
end
end
elseif (stage == STAGE_BACKWARD) then
cx = battleGetX(id)
cy = battleGetY(id)
if (cx < start_x) then
cx = cx + (SPEED * step)
if (cx > start_x) then
cx = start_x
end
elseif (cx > start_x) then
cx = cx - (SPEED * step)
if (cx < start_x) then
cx = start_x
end
end
if (cy < start_y) then
cy = cy + (SPEED * step)
if (cy > start_y) then
cy = start_y
end
elseif (cy > start_y) then
cy = cy - (SPEED * step)
if (cy < start_y) then
cy = start_y
end
end
battleSetX(id, cx)
battleSetY(id, cy)
battleResortEntity(id)
if (cx == start_x and cy == start_y) then
battleSetSubAnimation(id, "stand")
stage = STAGE_INIT
return COMBAT_SKIP
end
end
return COMBAT_BUSY
end
function die()
end
|
local telescope = require("telescope")
telescope.setup({
pickers = {
file_browser = {
disable_devicons = true,
hidden = true,
},
find_files = {
find_command = {
"fd",
"--hidden",
"--type",
"f",
"--strip-cwd-prefix",
},
},
},
})
telescope.load_extension("fzf")
|
-- ansicolors.lua v1.0.2 (2012-08)
-- Copyright (c) 2009 Rob Hoelz <[email protected]>
-- Copyright (c) 2011 Enrique García Cota <[email protected]>
--
-- 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.
-- support detection
local function isWindows()
return type(package) == 'table' and type(package.config) == 'string' and package.config:sub(1,1) == '\\'
end
local supported = not isWindows()
if isWindows() then supported = os.getenv("ANSICON") end
local keys = {
-- reset
reset = 0,
-- misc
bright = 1,
dim = 2,
underline = 4,
blink = 5,
reverse = 7,
hidden = 8,
-- foreground colors
black = 30,
red = 31,
green = 32,
yellow = 33,
blue = 34,
magenta = 35,
cyan = 36,
white = 37,
-- background colors
blackbg = 40,
redbg = 41,
greenbg = 42,
yellowbg = 43,
bluebg = 44,
magentabg = 45,
cyanbg = 46,
whitebg = 47
}
local escapeString = string.char(27) .. '[%dm'
local function escapeNumber(number)
return escapeString:format(number)
end
local function escapeKeys(str)
if not supported then return "" end
local buffer = {}
local number
for word in str:gmatch("%w+") do
number = keys[word]
assert(number, "Unknown key: " .. word)
table.insert(buffer, escapeNumber(number) )
end
return table.concat(buffer)
end
local function replaceCodes(str)
str = string.gsub(str,"(%%{(.-)})", function(_, s) return escapeKeys(s) end )
return str
end
-- public
local function ansicolors( str )
str = tostring(str or '')
return replaceCodes('%{reset}' .. str .. '%{reset}')
end
return setmetatable({noReset = replaceCodes}, {__call = function (_, str) return ansicolors (str) end})
|
-- Modules
local Chunks = require('chunks')
-- Tests
describe('Chunks', function()
describe('#.first()', function()
it('should return the first item in the array', function()
local results = Chunks.first({1, 2, 3})
assert.equals(results, 1)
end)
end)
describe('#.last()', function()
it('should return the last item in the array', function()
local results = Chunks.last({1, 2, 3})
assert.equals(results, 3)
end)
end)
describe('#.flatten()', function()
it('should return a new array by flattening the nested arrays', function()
local results = Chunks.flatten({{1}, {{2}, {3}}})
assert.same(results, {1, 2, 3})
end)
it('should return a new array by merging another array with the flattened, nested arrays', function()
local results = Chunks.flatten({{2}, {{3}, {4}}}, {1})
assert.same(results, {1, 2, 3, 4})
end)
end)
end)
|
---
--- Generated by MLN Team (https://www.immomo.com)
--- Created by MLN Team.
--- DateTime: 15-01-2020 17:35
---
---
--- 编辑框
---
---@note 非容器视图,不可以添加子视图
---@class EditTextView @parent class
---@public field name string
---@type EditTextView
local _class = {
_priveta_class_name = "EditTextView"}
---
--- 构造方法
---
---@return EditTextView
function EditTextView()
return _class
end
---
--- 设置占位文字
---
---@param placeholder string 占位文字
---@return EditTextView
function _class:placeholder(placeholder)
return self
end
---
--- 获取占位文字
---
---@return string
function _class:placeholder()
return "string"
end
---
--- 设置占位文字颜色
---
---@param placeholderColor Color 占位文字颜色
---@return EditTextView
function _class:placeholderColor(placeholderColor)
return self
end
---
--- 获取占位文字颜色
---
---@return Color
function _class:placeholderColor()
return Color()
end
---
--- 设置文本颜色
---
---@param textColor Color 文本颜色
---@return EditTextView
function _class:textColor(textColor)
return self
end
---
--- 获取文本颜色
---
---@return Color
function _class:textColor()
return Color()
end
---
--- 设置文字大小
---
---@param fontSize number 文字大小
---@return EditTextView
function _class:fontSize(fontSize)
return self
end
---
--- 获取字体大小
---
---@return number
function _class:fontSize()
return 0
end
---
--- 设置输入模式
---
---@param inputMode EditTextViewInputMode 输入模式,见[EditTextViewInputMode](EditTextViewInputMode)
---@return EditTextView
function _class:inputMode(inputMode)
return self
end
---
--- 获取输入模式
---
---@return EditTextViewInputMode 输入模式,见[EditTextViewInputMode](EditTextViewInputMode)
function _class:inputMode()
return EditTextViewInputMode()
end
---
--- 设置密码模式
---
---@param passwordMode boolean 是否为密码模式
---@return EditTextView
---@note 输入字符以*号显示,可正常获取输入内容,如需限制输入内容,可自行制定规则。(PS: 两端只有单行模式支持密码输入,iOS输入文本的情况下,切换为密码模式后初次输入会将光标置于行尾 )
function _class:passwordMode(passwordMode)
return self
end
---
--- 获取是否为密码模式状态
---
---@return boolean
function _class:passwordMode()
return true
end
---
--- 设置键盘返回按钮模式,只在单行模式有效
---
---@param returnMode ReturnType 返回按钮模式,见[ReturnType](ReturnType)
---@return EditTextView
function _class:returnMode(returnMode)
return self
end
---
--- 获取键盘返回按钮模式,只在单行模式有效
---
---@return ReturnType 返回按钮模式,见[ReturnType](ReturnType)
function _class:returnMode()
return ReturnType()
end
---
--- 设置文本对其方式
---
---@param textAlign TextAlign 文本对其方式, 见[TextAlign](TextAlign)
---@return EditTextView
function _class:textAlign(textAlign)
return self
end
---
--- 获取文本对其方式
---
---@return TextAlign 文本对其方式, 见[TextAlign](TextAlign)
function _class:textAlign()
return TextAlign()
end
---
--- 设置最大字节数
---
---@param maxBytes number 最大字节数
---@return EditTextView
---@note 最大字节数,汉字两个字节,表情四个字节(组合表情占据4个以上字节),其他一个字节
function _class:maxBytes(maxBytes)
return self
end
---
--- 获取最大字节数
---
---@return number
function _class:maxBytes()
return 0
end
---
--- 设置最大字符数
---
---@param maxLength number 字符数
---@return EditTextView
function _class:maxLength(maxLength)
return self
end
---
--- 返回最大字符数
---
---@return number
function _class:maxLength()
return 0
end
---
--- 设置文本内容
---
---@param text string 文本内容
---@return EditTextView
function _class:text(text)
return self
end
---
--- 获取文本内容
---
---@return string
function _class:text()
return "string"
end
---
--- 设置字体及大小
---
---@param fontName string fontName:字体名字
---@param fontSize number fontSize:字体大小
---@return EditTextView
function _class:fontNameSize(fontName, fontSize)
return self
end
---
--- 单行模式
---
---@param single boolean 单行模式
---@return EditTextView
---@note 单行模式,需要先调用,再设置其他属性,否则可能导致展示异常
function _class:singleLine(single)
return self
end
---
--- 设置内容开始改变的回调
---
---@param beginChangeCallback fun():void
--- function()...end
--- 内容开始修改的回调
---@return EditTextView
function _class:setBeginChangingCallback(beginChangeCallback)
return self
end
---
--- 设置文字已经修改的回调
---
---@param didChangingCallback fun(now:string, start:number, count:number):void
--- function(string now, int start, int count)...end
--- callback:文字已经修改的回调
--- now:当前text
--- start:改变的起始位置
--- count:改变的数量
---@return EditTextView
function _class:setDidChangingCallback(didChangingCallback)
return self
end
---
--- 设置内容修改完毕的回调
---
---@param endChangeCallback fun(str:string):void
--- function(string s)...end
--- callback:内容修改完毕的回调
--- s:修改之后的内容
---@return EditTextView
function _class:setEndChangedCallback(endChangeCallback)
return self
end
---
--- 设置点击键盘'Return'按钮的回调
---
---@param returnCallback fun():void
--- callback:点击键盘'Return'按钮的回调
---@return EditTextView
function _class:setReturnCallback(returnCallback)
return self
end
---
--- 设置文本是否可编辑
---
---@param canEdit boolean 文本是否可编辑
---@return EditTextView
function _class:setCanEdit(canEdit)
return self
end
---
--- 设置view的内边距
---
---@param top number top:距顶部的距离
---@param right number right:距右侧的距离
---@param bottom number bottom:距底部的距离
---@param left number left:距左侧的距离
---@return EditTextView
function _class:padding(top, right, bottom, left)
return self
end
---
--- 取消键盘显示
---
---@return EditTextView
function _class:dismissKeyboard()
return self
end
---
--- 弹出键盘显示
---
---@return EditTextView
function _class:showKeyboard()
return self
end
---
--- 设置光标颜色
---
---@param cursorColor Color color:光标颜色
---@return EditTextView
function _class:setCursorColor(cursorColor)
return self
end
---
--- 添加子视图
---
---
--- 将子视图添加到当前视图,该方法只有容器类拥有
---
---@param view View 任意继承自View的视图实例对象
---@return EditTextView
function _class:addView(view)
return self
end
---
--- 设置视图宽度
---
---
--- view宽度,可设置MeasurementType的枚举值(SDK>=1.0.5), 默认是MeasurementType.WRAP_CONTENT
---
---@param stringSize number 宽度值
---@return EditTextView
function _class:width(stringSize)
return self
end
---
--- 获取视图宽度
---
---
--- 获取视图的宽度
---
---@return number 浮点数,视图宽度
function _class:width()
return 0
end
---
--- 设置视图高度
---
---
--- view高度,可设置MeasurementType的枚举值(SDK>=1.0.5, 默认是MeasurementType.WRAP_CONTENT
---
---@param stringSize number 高度值
---@return EditTextView
function _class:height(stringSize)
return self
end
---
--- 获取视图高度
---
---
--- 获取视图的高度值
---
---@return number 浮点数,视图高度
function _class:height()
return 0
end
---
--- 设置视图的上外边距
---
---
--- 设置视图的上外边距,SDK>=1.0.2,只能在LinearLayout中有用
---
---@param value number 间距值
---@return EditTextView
function _class:marginTop(value)
return self
end
---
--- 获取视图的上外边距
---
---
--- 获取视图的上外边距, SDK>=1.0.2 只能在特殊layout中有用
---
---@return number 间距值
function _class:marginTop()
return 0
end
---
--- 设置视图的左外边距
---
---
--- 设置视图的左外边距,SDK>=1.0.2 只能在特殊layout中有用
---
---@param value number 间距值
---@return EditTextView
function _class:marginLeft(value)
return self
end
---
--- 获取视图的左外边距
---
---
--- 获取视图的左外边距,SDK>=1.0.2 只能在特殊layout中有用
---
---@return number 浮点数,间距值
function _class:marginLeft()
return 0
end
---
--- 设置视图的下外边距
---
---
--- 获取视图的下外边距,SDK>=1.0.2 只能在特殊layout中有用,具体请参考[Lua基础布局简介](Lua基础布局简介-Step1)
---
---@param value number 间距值
---@return EditTextView
function _class:marginBottom(value)
return self
end
---
--- 获取视图的下外边距
---
---
--- 获取视图的下外边距,SDK>=1.0.2 只能在特殊layout中有用,具体请参考[Lua基础布局简介](Lua基础布局简介-Step1)
---
---@return number 浮点数,间距值
function _class:marginBottom()
return 0
end
---
--- 设置视图的右外边距
---
---
--- 设置视图的右外边距,SDK>=1.0.2 只能在特殊layout中有用,具体请参考[Lua基础布局简介](Lua基础布局简介-Step1)
---
---@param value number 间距值
---@return EditTextView
function _class:marginRight(value)
return self
end
---
--- 获取视图的右外边距
---
---
--- 获取视图的右外边距,SDK>=1.0.2 只能在特殊layout中有用,具体请参考[Lua基础布局简介](Lua基础布局简介-Step1)
---
---@return number 浮点数,间距值
function _class:marginRight()
return 0
end
---
--- 约束优先级,范围0-1000
---
---
--- 设置约束计算优先级,数值越大越优先计算,占据的可用位置便越大,具体请参考[Lua基础布局简介](Lua基础布局简介-Step1)
---
---@param priority number 范围0-1000
---@return EditTextView
---@note 只能在LinearLayout中有用
function _class:priority(priority)
return self
end
---
--- 获取约束优先级,范围0-1000
---
---
--- 获取约束计算优先级,数值越大越优先计算,占据的可用位置便越大,具体请参考[Lua基础布局简介](Lua基础布局简介-Step1)
---
---@return number 约束优先级
---@note 只能在LinearLayout中有用
function _class:priority()
return 0
end
---
--- 约束权重(百分比),范围0-1000
---
---
--- 约束权重(百分比)。当子视图A的Weight为3,B的Weight为4时,则A占容器的3/7,B占容器的4/7。
---
---@param weight number 范围0-1000
---@return EditTextView
---@note 只能在LinearLayout中有用
function _class:weight(weight)
return self
end
---
--- 获取约束权重(百分比),范围0-1000
---
---
--- 获取约束权重(百分比)。
---
---@return number 约束权重
---@note 只能在LinearLayout中有用
function _class:weight()
return 0
end
---
--- 设置视图的内边距
---
---@param top number top:距顶部的距离
---@param right number right:距右侧的距离
---@param bottom number bottom:距底部的距离
---@param left number left:距左侧的距离
---@return EditTextView
function _class:padding(top, right, bottom, left)
return self
end
---
--- 设置最大宽度约束
---
---
--- 设置最大宽度约束,SDK>=1.1.5,配合自适应使用,当宽度为WRAP_CONTENT或MATCH_PARENT时有效
---
---@param number_a number 约束值
---@return EditTextView
---@note 配合自适应使用,对于嵌套视图父视图设置该属性,子视图超出父视图范围的情况,可以导致效果和预期不一致,此时需要对父视图使用clipToBounds切割子视图,iOS默认不切割子视图
function _class:setMaxWidth(number_a)
return self
end
---
--- 设置最小宽度约束
---
---
--- 设置视图最小宽度约束,SDK>=1.1.5,配合自适应使用,当宽度为WRAP_CONTENT或MATCH_PARENT时有效
---
---@param value number 约束值
---@return EditTextView
---@note 配合自适应使用,对于嵌套视图父视图设置该属性,子视图超出父视图范围的情况,可以导致效果和预期不一致,此时需要对父视图使用clipToBounds切割子视图,iOS默认不切割子视图
function _class:setMinWidth(value)
return self
end
---
--- 设置最大高度约束
---
---
--- 设置视图最大高度约束,SDK>=1.1.5,配合自适应使用,当高度为WRAP_CONTENT或MATCH_PARENT时有效
---
---@param value number 约束值
---@return EditTextView
---@note 配合自适应使用,对于嵌套视图父视图设置该属性,子视图超出父视图范围的情况,可以导致效果和预期不一致,此时需要对父视图使用clipToBounds切割子视图,iOS默认不切割子视图
function _class:setMaxHeight(value)
return self
end
---
--- 设置最小高度约束
---
---
--- 设置视图最小高度约束,SDK>=1.1.5,配合自适应使用,当高度为WRAP_CONTENT或MATCH_PARENT时有效
---
---@param value number 约束值
---@return EditTextView
---@note 配合自适应使用,对于嵌套视图父视图设置该属性,子视图超出父视图范围的情况,可以导致效果和预期不一致,此时需要对父视图使用clipToBounds切割子视图,iOS默认不切割子视图
function _class:setMinHeight(value)
return self
end
---
--- 返回该视图的父视图对象
---
---
--- 返回当前控件的父视图,window返回nil
---
---@return View 父视图
---@note window返回nil
function _class:superview()
return View()
end
---
--- 添加子视图
---
---
--- 将子视图添加到当前视图,该方法只有容器类拥有
---
---@param subView View 任意继承自View的视图实例对象
---@return EditTextView
function _class:addView(subView)
return self
end
---
--- 将视图插入到当前视图的某一个层级
---
---
--- 将视图插入到当前视图的某个层级,该方法只有容器类拥有
---
---@param subView View 子视图
---@param idx number idx:插入的位置,0为最底部,往上递增
---@return EditTextView
function _class:insertView(subView, idx)
return self
end
---
--- 从父视图中移除自身
---
---
--- 从父视图中移除自身
---
---@return EditTextView
function _class:removeFromSuper()
return self
end
---
--- 移除当前视图所有的子视图
---
---
--- 移除当前视图的所有子视图
---
---@return EditTextView
function _class:removeAllSubviews()
return self
end
---
--- 坐标转换
---
---
--- 将自身的点的坐标换算到参考视图的坐标系中
---
---@param otherView View 参考视图
---@param point Point 被转换的坐标点,来自于自身
---@return Point 转换之后的点,位于参考视图
---@note 被转换的坐标来自于自身
function _class:convertPointTo(otherView, point)
return Point()
end
---
--- 坐标转换
---
---
--- 将参考view的点坐标换算到自身的坐标系中
---
---@param otherView View 参考视图
---@param point Point 被转换的坐标点,来自于参考视图
---@return Point 转换后的坐标点,位于自身
---@note 被转换的坐标来自于参考视图
function _class:convertPointFrom(otherView, point)
return Point()
end
---
--- 布局相关
---
---
--- 设置当前view吸附状态
---
---@param gravity Gravity 吸附效果,枚举参考[Gravity](Gravity),布局参考[Lua基础布局简介](Lua基础布局简介-Step1)
---@return EditTextView
---@note SDK>=1.0.2 只能在特殊layout中有用,eg: LinearLayout,默认吸附左上角
function _class:setGravity(gravity)
return self
end
---
--- 坐标转换
---
---
--- 将自身的点的坐标换算到参考view的坐标中, 在可滚动视图中,与android一致,表现为屏幕上显示的相对坐标
---
---@param otherView View 参考视图
---@param point Point 被转换的点
---@return Point 转换后的点
function _class:convertRelativePointTo(otherView, point)
return Point()
end
---
--- 设置视图透明度,范围 0 ~ 1
---
---@param value number 透明值:0.0~1.0
---@return EditTextView
---@note 在iOS,当透明度小于0.1之后,将无法响应事件
function _class:alpha(value)
return self
end
---
--- 获取视图透明度
---
---@return number 透明值
function _class:alpha()
return 0
end
---
--- 设置视图是否隐藏,默认为false,不隐藏。该方法隐藏后依然占位,如果不想占位,请使用gone
---
---@param isHidden boolean 是否隐藏,默认false
---@return EditTextView
function _class:hidden(isHidden)
return self
end
---
--- 获取视图是否隐藏
---
---@return boolean 布尔值
function _class:hidden()
return true
end
---
--- 设置视图是否隐藏,开启后,视图在LinearLayout中将不占位置
---
---
--- 设置当前视图是否隐藏且不占位,SDK>=1.2.1,在新布局中有效,hidden方法是隐藏但是占位
---
---@param isGone boolean 是否隐藏,传true隐藏,传false展示
---@return EditTextView
function _class:gone(isGone)
return self
end
---
--- 获取视图是否隐藏
---
---
--- 获取当前视图是否是隐藏且不占位,SDK>=1.2.1,在新布局有效
---
---@return boolean 布尔值,是否隐藏
function _class:gone()
return true
end
---
--- 设置视图的边框宽度
---
---@param value number 边框宽度
---@return EditTextView
function _class:borderWidth(value)
return self
end
---
--- 获取视图的边框宽度值
---
---@return number 浮点数,视图宽度
function _class:borderWidth()
return 0
end
---
--- 设置视图的边框颜色
---
---@param color Color 颜色,默认为黑色
---@return EditTextView
function _class:borderColor(color)
return self
end
---
--- 获取视图的边框颜色
---
---@return Color 颜色
function _class:borderColor()
return Color()
end
---
--- 设置视图的背景颜色
---
---@param color Color 颜色
---@return EditTextView
function _class:bgColor(color)
return self
end
---
--- 获取视图的背景颜色
---
---@return Color 颜色
function _class:bgColor()
return Color()
end
---
--- 设置视图的圆角半径
---
---@param radius number 半径值
---@return EditTextView
---@note iOS默认不切割,使用[CornerManager](CornerManager)开启自动切割,调用clipToBounds手动控制是否切割,Android默认切割超出部分
function _class:cornerRadius(radius)
return self
end
---
--- 获取视图的圆角半径,默认返回左上角
---
---@return number 浮点数,半径值
function _class:cornerRadius()
return 0
end
---
--- 设置圆角半径,根据不同的位置
---
---@param radius number 圆角半径
---@param corner RectCorner TOP_LEFT:左上 TOP_RIGHT:右上 BOTTOM_LEFT:左下 BOTTOM_RIGHT:右下 , @see RectCorner
---@return EditTextView
---@note 不能与阴影连用
function _class:setCornerRadiusWithDirection(radius, corner)
return self
end
---
--- 根据不同的方向获取视图圆角半径
---
---@param corner RectCorner TOP_LEFT:左上 TOP_RIGHT:右上 BOTTOM_LEFT:左下 BOTTOM_RIGHT:右下 , @see RectCorner
---@return number 圆角半径,默认返回左上角
function _class:getCornerRadiusWithDirection(corner)
return 0
end
---
--- 设置子视图是否在view的边界内绘制
---
---@param isClip boolean 是否开启边界内绘制
---@return EditTextView
---@note Android:clipToBounds只能对parent使用,parent会遍历子View,让所有子View都统一clipToBounds。注:parent自己不生效,需要调用parent的parent才行。
--- IOS:clipToBounds只能对View自己生效
function _class:clipToBounds(isClip)
return self
end
---
--- 设置圆角后,是否切割,默认切割false;优化性能使用
---
---
--- <# nil #
---
---@param noClip boolean 是否切割
---@return EditTextView
---@note iOS空实现,仅Android可用,Android sdk1.5.0 默认切割子View。可以改用addCornerMask()绘制圆角遮罩
function _class:notClip(noClip)
return self
end
---
--- 以覆盖一张中间透明周边含有指定颜色圆角的图片的方式实现圆角效果
---
---
--- 在iOS上, 切割圆角在一定情况下会触发离屏渲染等问题,在大量圆角且可滚动的页面中,可能会有明显的掉帧体验(低端设备比较明显),为了优化这种性能问题,所以提供该方案来解决类似的性能问题。
---
---@param cornerRadius number cornerRadius:圆角半径
---@param maskColor Color maskColor:圆角遮罩的颜色
---@param corners RectCorner 指定含有圆角的位置,并且可以通过与方式指定多个圆角,具体枚举值见[RectCorner](RectCorner)
---@return EditTextView
---@note 这是一种提高圆角切割性能的方案,对于子视图超出父视图显示的情况,不建议使用该方式。
function _class:addCornerMask(cornerRadius, maskColor, corners)
return self
end
---
--- 设置线性渐变色
---
---@param startColor Color start:开始颜色
---@param endColor Color end:结束颜色
---@param isVertical boolean vertical:true代表从上到下,false代表从左到右
---@return EditTextView
function _class:setGradientColor(startColor, endColor, isVertical)
return self
end
---
--- 设置线性渐变色,支持正向反向
---
---@param startColor Color 开始颜色
---@param endColor Color 结束颜色
---@param type GradientType gradientType:GradientType.LEFT_TO_RIGHT 值为1 代表从左到右, GradientType.RIGHT_TO_LEFT 值为2 代表从右到左, GradientType.TOP_TO_BOTTOM 值为3 代表从上到下,GradientType.BOTTOM_TO_TOP代 值为4 表从下到上
---@return EditTextView
function _class:setGradientColorWithDirection(startColor, endColor, type)
return self
end
---
--- 设置当前视图是否可以响应用户的点击,触摸等交互事件
---
---@param usable boolean 是否可以用户交互
---@return EditTextView
---@note 该属性关闭后,不仅会导致自身无法响应事件,而且子视图也无法响应事件。所以当业务中遇到某些控件无法响应,可以考虑是否是自身或父视图禁用了用户交互。
function _class:enabled(usable)
return self
end
---
--- 获取当前视图是否可以响应用户的点击,触摸等交互事件
---
---
--- <# nil #
---
---@return boolean 布尔值
function _class:enabled()
return true
end
---
--- 设置点击事件回调
---
---@param callback fun():void
--- 回调格式:
--- ```
--- function()
--- end
--- ```
---@return EditTextView
---@note iOS采用的是手势监听,所以要注意事件冲突,在冲突时可使用touchEnd方法
function _class:onClick(callback)
return self
end
---
--- 设置长按回调
---
---@param callback fun():void
--- 回调格式:
--- ```
--- function()
--- end
--- ```
---@return EditTextView
function _class:onLongPress(callback)
return self
end
---
--- 设置有坐标的点击回调
---
---@param callback fun(x:number, y:number):void
--- 回调格式:
--- ```
--- function(number x,number y)
--- ---x:x轴坐标
--- ---y:y轴坐标
--- end
--- ```
---@return EditTextView
---@note 已废弃,在需要 回调点击坐标的情况下请结合实际场景使用touchBegin或者touchEnd方法
function _class:onTouch(callback)
return self
end
---
--- 获取是否有焦点
---
---
--- 获取当前视图是否有焦点,在iOS端理解为第一响应者
---
---@return boolean true是否焦点
function _class:hasFocus()
return true
end
---
--- 判断是否能获取焦点
---
---
--- 获取当前视图是否可以获得焦点
---
---@return boolean true为可以获得焦点
function _class:canFocus()
return true
end
---
--- 获取焦点
---
---
--- 请求焦点,即请求成为第一响应者
---
---@return EditTextView
function _class:requestFocus()
return self
end
---
--- 取消焦点
---
---
--- 取消焦点,即取消第一响应者
---
---@return EditTextView
function _class:cancelFocus()
return self
end
---
--- 触摸开始的回调
---
---
--- 设置当触摸开始时的回调,并回调坐标值
---
---@param callback fun(x:number, y:number):void
--- 回调格式:
--- ```
--- function(number x,number y)
--- ---x:x轴坐标
--- ---y:y轴坐标
--- end
--- ```
---@return EditTextView
function _class:touchBegin(callback)
return self
end
---
--- 触摸移动中的回调
---
---
--- 设置触摸移动中的回调,并回调坐标值
---
---@param callback fun(x:number, y:number):void
--- 回调格式:
--- ```
--- function(number x,number y)
--- ---x:x轴坐标
--- ---y:y轴坐标
--- end
--- ```
---@return EditTextView
---@note 该回调会在移动中多次调用
function _class:touchMove(callback)
return self
end
---
--- 触摸结束后的回调
---
---
--- 设置触摸结束后的回调,并回调坐标值
---
---@param callback fun(x:number, y:number):void
--- 回调格式:
--- ```
--- function(number x,number y)
--- ---x:x轴坐标
--- ---y:y轴坐标
--- end
--- ```
---@return EditTextView
---@note 该坐标是手指抬起时的坐标
function _class:touchEnd(callback)
return self
end
---
--- 触摸取消的回调
---
---
--- 设置触摸取消时的回调,并回调坐标值
---
---@param callback fun(x:number, y:number):void
--- 回调格式:
--- ```
--- function(number x,number y)
--- ---x:x轴坐标
--- ---y:y轴坐标
--- end
--- ```
---@return EditTextView
---@note 该回调在用户移出当前视图时会调用
function _class:touchCancel(callback)
return self
end
---
--- 触摸开始时的回调
---
---
--- 增强版触摸开始时回调,会在回调中返回额外的信息
---
---@param callback fun(map:table):void
--- 回调格式:
--- ```
--- function(map)
--- ---map参数如下:
--- ---x:触摸时相对父控件x坐标值
--- ---y:触摸时相对父控件y坐标值
--- ---screenX:触摸时相对屏幕x坐标
--- ---screenY:触摸时相对屏幕Y坐标
--- ---target:触摸到的view
--- ---timeStamp:触摸时间(单位s)
--- end
--- ```
---@return EditTextView
function _class:touchBeginExtension(callback)
return self
end
---
--- 触摸移动时的回调
---
---
--- 增强版触摸移动中回调,会在回调中返回额外的信息
---
---@param callback fun(map:table):void
--- 回调格式:
--- ```
--- function(map)
--- ---map参数如下:
--- ---x:触摸时相对父控件x坐标值
--- ---y:触摸时相对父控件y坐标值
--- ---screenX:触摸时相对屏幕x坐标
--- ---screenY:触摸时相对屏幕Y坐标
--- ---target:触摸到的view
--- ---timeStamp:触摸时间(单位s)
--- end
--- ```
---@return EditTextView
function _class:touchMoveExtension(callback)
return self
end
---
--- 触摸结束时的回调
---
---
--- 增强版触摸结束的回调,会在回调中返回额外的信息
---
---@param callback fun(map:table):void
--- 回调格式:
--- ```
--- function(map)
--- ---map参数如下:
--- ---x:触摸时相对父控件x坐标值
--- ---y:触摸时相对父控件y坐标值
--- ---screenX:触摸时相对屏幕x坐标
--- ---screenY:触摸时相对屏幕Y坐标
--- ---target:触摸到的view
--- ---timeStamp:触摸时间(单位s)
--- end
--- ```
---@return EditTextView
function _class:touchEndExtension(callback)
return self
end
---
--- 触摸取消时的回调
---
---
--- 增强版触摸取消时的回调,会在回调中返回额外的信息
---
---@param callback fun(map:table):void
--- 回调格式:
--- ```
--- function(map)
--- ---map参数如下:
--- ---x:触摸时相对父控件x坐标值
--- ---y:触摸时相对父控件y坐标值
--- ---screenX:触摸时相对屏幕x坐标
--- ---screenY:触摸时相对屏幕Y坐标
--- ---target:触摸到的view
--- ---timeStamp:触摸时间(单位s)
--- end
--- ```
---@return EditTextView
function _class:touchCancelExtension(callback)
return self
end
---
--- 设置是否开启键盘出现后视图自动位移
---
---@param isOpen boolean 是否开启
---@return EditTextView
---@note 已废弃
function _class:setPositionAdjustForKeyboard(isOpen)
return self
end
---
--- 是否开启键盘出现后视图自动位移,并可设置偏移量
---
---@param isOpen boolean 是否开启
---@param offset number 偏移量
---@return EditTextView
---@note 已废弃
function _class:setPositionAdjustForKeyboardAndOffset(isOpen, offset)
return self
end
---
--- 锚点,动画作用的位置,从0~1的比例,在视图中对应位置
---
---@param x number 横向位置,范围0~1
---@param y number 竖向位置,范围0~1
---@return EditTextView
function _class:anchorPoint(x, y)
return self
end
---
--- 旋转视图,可以控制绝对旋转还是叠加旋转
---
---@param rotate number 旋转角度值,0~360
---@param add boolean 是否叠加,默认false
---@return EditTextView
---@note 已废弃,请使用rotation方法
function _class:transform(rotate, add)
return self
end
---
--- 旋转视图
---
---
--- 旋转视图,范围-360~360,默认在视图旋转状态基础上进行叠加旋转
---
---@param rotate number 旋转角度值,0~360
---@param notAdding boolean 基于当前状态,旋转angle弧度 SDK>=1.2.2 ,@notAdding 是否不叠旋转 SDK>=1.5.1
---@return EditTextView
function _class:rotation(rotate, notAdding)
return self
end
---
--- 缩放视图
---
---
--- 设置视图横向和纵向的缩放比例
---
---@param x number x轴缩放倍数0~max
---@param y number y轴缩放倍数0~max
---@param add boolean 设置当前视图缩放是否从初始状态开始,默认false在当前视图缩放比例基础上进行缩放
---@return EditTextView
---@note 参数c是iOS平台隐藏参数,默认不要传
function _class:scale(x, y, add)
return self
end
---
--- 位移视图
---
---
--- 设置视图的横向和纵向的偏移量
---
---@param x number x轴位移量(单位是pt,dp)
---@param y number y轴位移量(单位是pt,dp)
---@param add boolean 设置当前视图位移是否从初始状态开始,默认false在当前视图位移基础上进行位移
---@return EditTextView
---@note 参数c是iOS隐藏属性,默认不要传
function _class:translation(x, y, add)
return self
end
---
--- 重置Transform
---
---
--- 当我们在设置了Transform属性(rotation,scale,translation)之后想要重置到初始化状态时,可以调用该方法
---
---@return EditTextView
function _class:transformIdentity()
return self
end
---
--- 移除视图上的帧动画
---
---
--- 移除视图上设置过的帧动画,即Animation动画
---
---@return EditTextView
function _class:removeAllAnimation()
return self
end
---
--- 视图截屏
---
---
--- 截图方法,当业务有需要将当前视图的内容保存下来的时候,可以调用该方法进行截图
---
---@param filename string 保存图片的文件名
---@return string 图片路径
---@note 请在界面绘制完毕后,再进行截图操作
function _class:snapshot(filename)
return "string"
end
---
--- 添加高斯模糊
---
---
--- 为当前视图增加高斯模糊效果
---
---@return EditTextView
---@note iOS有效,Android空实现
function _class:addBlurEffect()
return self
end
---
--- 移除高斯模糊
---
---
--- 移除当前视图上增加的高斯模糊效果
---
---@return EditTextView
---@note iOS有效,Android空实现
function _class:removeBlurEffect()
return self
end
---
--- 设置点击时的效果
---
---
--- 开启视图的高亮点击效果,通常用在cell的点击效果上
---
---@param open boolean 是否打开
---@return EditTextView
---@note Android上为波纹效果,iOS上是一种灰色高亮
function _class:openRipple(open)
return self
end
---
--- 设置是否开启点击收起键盘功能
---
---
--- 设置是否开启点击收起键盘功能,只能当子视图唤起的键盘,才能触发收起
---
---@param open boolean 是否开启点击取消编辑功能
---@return EditTextView
function _class:canEndEditing(open)
return self
end
---
--- 将当前视图的子视图移动到所有子视图的最上层
---
---
--- 在添加子视图时,默认是新添加的视图在已有的上层,当业务需要将最早添加的视图移动到最上层是,使用该方法
---
--- ⚠️LinearLayout不可使用该方法。️Android不能实现将某个View放入图层下方或上方,View可以做到是通过将子视图加入顺序调换实现,LinearLayout若调换顺序,将导致布局出错
---
---@param subView View 子视图
---@return EditTextView
---@note LinearLayout不可使用该方法。️Android不能实现将某个View放入图层下方或上方,View可以做到是通过将子视图加入顺序调换实现,LinearLayout若调换顺序,将导致布局出错
function _class:bringSubviewToFront(subView)
return self
end
---
--- 将子视图放到最下层
---
---
--- 在添加子视图是,默认新添加的视图在最上层,当业务需要将新添加的视图移动到最下层时,使用该方法
---
--- ⚠️LinearLayout不可使用该方法。️Android不能实现将某个View放入图层下方或上方,View可以做到是通过将子视图加入顺序调换实现,LinearLayout若调换顺序,将导致布局出错
---
---@param subView View 子视图
---@return EditTextView
---@note LinearLayout不可使用该方法。️Android不能实现将某个View放入图层下方或上方,View可以做到是通过将子视图加入顺序调换实现,LinearLayout若调换顺序,将导致布局出错
function _class:sendSubviewToBack(subView)
return self
end
---
--- 给视图设置背景图片
---
---@param imageName string 图片名字,不带后缀
---@return EditTextView
---@note 背景图片只支持本地资源
function _class:bgImage(imageName)
return self
end
---
--- 给视图添加矩形或圆形阴影
---
---@param shadowColor Color 阴影颜色,Android不可修改
---@param shadowOffset Size 阴影偏移量
---@param shadowRadius number 阴影半径
---@param opacity number 阴影透明度0~1.0
---@param isOval boolean 是否是圆形阴影,默认为false
---@return EditTextView
function _class:addShadow(shadowColor, shadowOffset, shadowRadius, opacity, isOval)
return self
end
---
--- 设置视图阴影
---
---@param shadowOffset Size 阴影偏移量
---@param shadowRadius number 阴影半径,数值越大,阴影越大,默认3
---@param opacity number 阴影透明度0~1.0
---@return EditTextView
---@note 1.cornerRadius+Shadow 使用时:
--- 1)不能对同一个View用ClipToBounds(),否则无效;
--- 2)Android 给子View使用Shadow,子View不能充满容器,否则阴影被Parent切割
--- 2.setCornerRadiusWithDirection 禁止与Shadow连用;
--- 3.阴影的View有Z轴高度,会遮挡没有Z轴高度的同层View
---
function _class:setShadow(shadowOffset, shadowRadius, opacity)
return self
end
---
--- 子视图从父视图移除时的回调
---
---
--- 当这个视图从父视图移除,或者当该视图的父视图从祖父视图移除时都会回调
---
---@param callback fun():void
--- 回调格式:
--- ```
--- function()
--- end
--- ```
---@return EditTextView
function _class:onDetachedView(callback)
return self
end
---
--- 开始画布动画(CanvasAnimation),不会影响布局
---
---@param animation CanvasAnimation 画布动画
---@return EditTextView
---@note 不可使用FrameAnimation和Animation
function _class:startAnimation(animation)
return self
end
---
--- 停止View里的画布动画
---
---@return EditTextView
---@note 非画布动画不会停止
function _class:clearAnimation()
return self
end
return _class |
-- create node Divide
require "moon.sg"
local node = moon.sg.new_node("sg_div")
if node then
node:set_pos(moon.mouse.get_position())
end |
require "TimedActions/ISBaseTimedAction"
G_OnPickLockTimedAction = ISBaseTimedAction:derive("G_OnPickLockTimedAction");
function G_OnPickLockTimedAction:isValid()
return self.character:getInventory():contains("Paperclip") and self.character:getInventory():contains("Screwdriver")
end
function G_OnPickLockTimedAction:start()
getSoundManager():PlayWorldSoundWav("gtv_picklock", self.object:getSquare(), 0, 7, 1, true);
end
function G_OnPickLockTimedAction:update()
self.character:faceThisObject(self.object)
end
function G_OnPickLockTimedAction:stop()
ISBaseTimedAction.stop(self)
end
function G_OnPickLockTimedAction:perform()
local perkLvl = self.character:getPerkLevel(Perks.Lightfoot)
self.character:getXp():AddXP(Perks.Lightfoot, 2);
if perkLvl < 1 then
local pup = ZombRand(10);
if pup == 0 then
getSoundManager():PlayWorldSoundWav("PZ_MetalSnap", self.object:getSquare(), 0.5, 5, 1, true);
self.character:getInventory():RemoveOneOf("Paperclip")
ISBaseTimedAction.perform(self)
return
end
end
if perkLvl < 8 then
local pup = ZombRand(5);
if pup == 0 then
getSoundManager():PlayWorldSoundWav("PZ_MetalSnap", self.object:getSquare(), 0.5, 5, 1, true);
self.character:getInventory():RemoveOneOf("Paperclip")
end
end
self.object:setLockedByKey(false);
getSoundManager():PlayWorldSound("unlockDoor", self.object:getSquare(), 0, 10, 0.7, true);
ISBaseTimedAction.perform(self)
end
function G_OnPickLockTimedAction:new(character, object, time)
local o = {}
setmetatable(o, self)
self.__index = self
o.stopOnWalk = true
o.stopOnRun = true
o.maxTime = time
o.character = character;
o.object = object
return o
end |
if not modules then modules = { } end modules ['data-aux'] = {
version = 1.001,
comment = "companion to luat-lib.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
local find = string.find
local type, next = type, next
local trace_locating = false trackers.register("resolvers.locating", function(v) trace_locating = v end)
local resolvers = resolvers
local report_scripts = logs.reporter("resolvers","scripts")
function resolvers.updatescript(oldname,newname) -- oldname -> own.name, not per se a suffix
-- local scriptpath = "scripts/context/lua"
local scriptpath = "context/lua"
newname = file.addsuffix(newname,"lua")
local oldscript = resolvers.cleanpath(oldname)
if trace_locating then
report_scripts("to be replaced old script %a", oldscript)
end
local newscripts = resolvers.findfiles(newname) or { }
if #newscripts == 0 then
if trace_locating then
report_scripts("unable to locate new script")
end
else
for i=1,#newscripts do
local newscript = resolvers.cleanpath(newscripts[i])
if trace_locating then
report_scripts("checking new script %a", newscript)
end
if oldscript == newscript then
if trace_locating then
report_scripts("old and new script are the same")
end
elseif not find(newscript,scriptpath,1,true) then
if trace_locating then
report_scripts("new script should come from %a",scriptpath)
end
elseif not (find(oldscript,file.removesuffix(newname).."$") or find(oldscript,newname.."$")) then
if trace_locating then
report_scripts("invalid new script name")
end
else
local newdata = io.loaddata(newscript)
if newdata then
if trace_locating then
report_scripts("old script content replaced by new content")
end
io.savedata(oldscript,newdata)
break
elseif trace_locating then
report_scripts("unable to load new script")
end
end
end
end
end
|
function momoIRTweak.compatibility.SpaceX()
-- drydock-assembly drydock-structural
-- fusion-reactor hull-component protection-field
-- space-thruster fuel-cell habitation
-- life-support command astrometrics
-- ftl-drive
if (settings.startup["momo-spaceEx"].value) then
--- using
local ITEM = momoIRTweak.FastItem
local Repi = momoIRTweak.recipe.ReplaceIngredient
local AddIng = momoIRTweak.recipe.AddIngredient
local GetIng = momoIRTweak.recipe.GetIngredient
local function ReplaceItem(recipeName, targetItem, newItemName, defaultAmount)
local amount = defaultAmount
local ing = GetIng(recipeName, targetItem)
if (ing) then
amount = math.floor(ing.amount / 4)
end
Repi(recipeName, targetItem, ITEM(newItemName, amount))
end
ReplaceItem("drydock-assembly", "processing-unit", "controller-mk3", 50)
ReplaceItem("space-thruster", "processing-unit", "controller-mk3", 25)
ReplaceItem("fuel-cell", "processing-unit", "controller-mk3", 25)
ReplaceItem("habitation", "processing-unit", "controller-mk3", 25)
ReplaceItem("life-support", "processing-unit", "controller-mk3", 25)
ReplaceItem("command", "processing-unit", "controller-mk3", 25)
ReplaceItem("astrometrics", "processing-unit", "controller-mk3", 75)
ReplaceItem("ftl-drive", "processing-unit", "controller-mk3", 125)
local function AddIngredient(recipeName, refItem, ingredient, increaseFactor, defaultAmount)
local amount = defaultAmount
local ing = GetIng(recipeName, refItem)
if (ing) then
amount = math.floor(ing.amount * increaseFactor)
end
momoIRTweak.recipe.SaveAddIngredient(recipeName, ITEM(ingredient, amount))
end
AddIngredient("habitation", "steel-plate", "bronze-plate-heavy", 3, 100)
AddIngredient("habitation", "controller-mk3", "menarite-processor", 3, 75)
AddIngredient("habitation", "", "ion-probe", 1, 5)
AddIngredient("hull-component", "steel-plate", "bronze-plate-heavy", 5, 100)
AddIngredient("life-support", "pipe", "titanium-bulkhead", 1, 200)
AddIngredient("life-support", "controller-mk3", "menarite-processor", 4, 100)
AddIngredient("life-support", "", "ion-probe", 1, 10)
AddIngredient("ftl-drive", "low-density-structure", "duranium-bulkhead", 1, 100)
AddIngredient("ftl-drive", "controller-mk3", "menarite-processor", 6, 125 * 6)
AddIngredient("astrometrics", "low-density-structure", "duranium-bulkhead", 1, 100)
AddIngredient("astrometrics", "controller-mk3", "menarite-processor", 6, 75 * 6)
AddIngredient("astrometrics", "", "impulse-probe", 1, 5)
AddIngredient("command", "low-density-structure", "duranium-bulkhead", 1, 100)
AddIngredient("command", "controller-mk3", "menarite-processor", 5, 250)
AddIngredient("space-thruster", "low-density-structure", "duranium-bulkhead", 1, 100)
--- replace technology ingredient with k science
local spaceExTechnologies = {
"space-assembly",
"space-construction",
"space-casings",
"protection-fields",
"fusion-reactor",
"space-thrusters",
"fuel-cells",
"habitation",
"life-support-systems",
"spaceship-command",
"astrometrics",
"ftl-theory-A",
"ftl-theory-B",
"ftl-theory-C",
"ftl-theory-D1",
"ftl-theory-D2",
"ftl-propulsion",
}
for i, technology in pairs(spaceExTechnologies) do
momoIRTweak.technology.ReplaceIngredient(technology, momoIRTweak.science.kMapping)
if (momoIRTweak.technology.HasIngredient(technology, momoIRTweak.science.k3)) then
table.insert(data.raw.technology[technology].unit.ingredients, {momoIRTweak.science.kMatter, 3})
end
end
end
end
|
help(
[[
This module loads c-blosc 1.7.1
A blocking, shuffling and loss-less compression library that can be faster than
`memcpy()`
]])
whatis("Loads c-blosc")
local version = "1.7.1"
local base = "/cvmfs/oasis.opensciencegrid.org/osg/modules/cblosc/"..version
prepend_path("LD_LIBRARY_PATH", pathJoin(base, "lib"))
prepend_path("PATH", pathJoin(base, "bin"))
prepend_path("CPATH", base.."/include")
prepend_path("LIBRARY_PATH", base.."/lib")
load('snappy/1.1.3')
family('cblosc')
|
-----------------------------------
-- Area: Misareaux_Coast
-- NPC: ??? (Spawn Gration)
-- !pos 113.563 -16.302 38.912 25
-----------------------------------
local ID = require("scripts/zones/Misareaux_Coast/IDs")
require("scripts/globals/npc_util")
-----------------------------------
function onTrade(player, npc, trade)
if (npcUtil.tradeHas(trade, 12370) or npcUtil.tradeHas(trade, 12359)) and npcUtil.popFromQM(player, npc, ID.mob.GRATION) then -- Hickory Shield or Picaroon's Shield
player:confirmTrade()
end
end
function onTrigger(player, npc)
player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY)
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
end
|
object_static_structure_general_cave_stalactite_snow_style_03 = object_static_structure_general_shared_cave_stalactite_snow_style_03:new {
}
ObjectTemplates:addTemplate(object_static_structure_general_cave_stalactite_snow_style_03, "object/static/structure/general/cave_stalactite_snow_style_03.iff")
|
do
-- will hold the currently playing sources
local sources = {}
-- check for sources that finished playing and remove them
-- add to love.update
function love.audio.update()
local remove = {}
for _,s in pairs(sources) do
if s:isStopped() then
remove[#remove + 1] = s
end
end
for i,s in ipairs(remove) do
sources[s] = nil
end
end
-- overwrite love.audio.play to create and register source if needed
local play = love.audio.play
function love.audio.play(what, how, loop)
local src = what
if type(what) ~= "userdata" or not what:typeOf("Source") then
src = love.audio.newSource(what, how)
src:setLooping(loop or false)
end
play(src)
sources[src] = src
return src
end
-- stops a source
local stop = love.audio.stop
function love.audio.stop(src)
if not src then return end
stop(src)
sources[src] = nil
end
end |
local timeUtil = {}
function timeUtil.secondsToDigitalTime(seconds)
local display = ""
local remaingSeconds = 0 -- The number of seconds left after converting seconds to minutes.
-- Convert minutes to seconds.
if seconds >= 60 then
local minutes = math.floor(seconds / 60)
if minutes >= 10 then
display = display .. math.floor(minutes / 10)
display = display .. (minutes % 10)
display = display .. ":"
else
display = display .. 0
display = display .. minutes
display = display .. ":"
end
remaingSeconds = seconds % 60
else
display = display .. "00:"
remaingSeconds = seconds
end
-- Display the remaining seconds.
if remaingSeconds >= 10 then
display = display .. math.floor(remaingSeconds / 10)
display = display .. remaingSeconds % 10
else
display = display .. "0"
display = display .. remaingSeconds
end
return display
end
return timeUtil |
return {
version = "1.1",
luaversion = "5.1",
tiledversion = "2018.01.23",
orientation = "orthogonal",
renderorder = "right-down",
width = 40,
height = 40,
tilewidth = 16,
tileheight = 16,
nextobjectid = 31,
properties = {
["collidable"] = "true"
},
tilesets = {
{
name = "GGJ_background",
firstgid = 1,
filename = "escritorio.tsx",
tilewidth = 16,
tileheight = 16,
spacing = 0,
margin = 0,
image = "../img/atlas01.png",
imagewidth = 640,
imageheight = 360,
tileoffset = {
x = 0,
y = 0
},
grid = {
orientation = "orthogonal",
width = 16,
height = 16
},
properties = {},
terrains = {
{
name = "Novo Terreno",
tile = 202,
properties = {}
}
},
tilecount = 880,
tiles = {
{
id = 383,
objectGroup = {
type = "objectgroup",
name = "",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "index",
properties = {},
objects = {
{
id = 1,
name = "",
type = "",
shape = "rectangle",
x = 0,
y = 0.0909091,
width = 4.81818,
height = 15.9091,
rotation = 0,
visible = true,
properties = {}
},
{
id = 2,
name = "",
type = "",
shape = "rectangle",
x = 0.181818,
y = 0,
width = 15.8182,
height = 5,
rotation = 0,
visible = true,
properties = {}
}
}
}
},
{
id = 384,
objectGroup = {
type = "objectgroup",
name = "",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "index",
properties = {},
objects = {
{
id = 1,
name = "",
type = "",
shape = "rectangle",
x = 0,
y = 0.0909091,
width = 16,
height = 4.81818,
rotation = 0,
visible = true,
properties = {}
}
}
}
},
{
id = 385,
objectGroup = {
type = "objectgroup",
name = "",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "index",
properties = {},
objects = {
{
id = 1,
name = "",
type = "",
shape = "rectangle",
x = 0,
y = 0.0880682,
width = 15.9091,
height = 4.91761,
rotation = 0,
visible = true,
properties = {}
},
{
id = 2,
name = "",
type = "",
shape = "rectangle",
x = 11.0085,
y = 0.122159,
width = 4.94034,
height = 15.8523,
rotation = 0,
visible = true,
properties = {}
}
}
}
},
{
id = 423,
objectGroup = {
type = "objectgroup",
name = "",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "index",
properties = {},
objects = {
{
id = 1,
name = "",
type = "",
shape = "rectangle",
x = -0.0909091,
y = 0,
width = 5.09091,
height = 15.9091,
rotation = 0,
visible = true,
properties = {}
}
}
}
},
{
id = 424,
objectGroup = {
type = "objectgroup",
name = "",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "index",
properties = {},
objects = {
{
id = 1,
name = "",
type = "",
shape = "rectangle",
x = 0.193182,
y = 0.159091,
width = 16.0568,
height = 15.7045,
rotation = 0,
visible = true,
properties = {}
}
}
}
},
{
id = 425,
objectGroup = {
type = "objectgroup",
name = "",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "index",
properties = {},
objects = {
{
id = 1,
name = "",
type = "",
shape = "rectangle",
x = 11,
y = 0,
width = 4.91304,
height = 16.0435,
rotation = 0,
visible = true,
properties = {}
}
}
}
},
{
id = 463,
objectGroup = {
type = "objectgroup",
name = "",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "index",
properties = {},
objects = {
{
id = 3,
name = "",
type = "",
shape = "rectangle",
x = 0.03125,
y = -0.03125,
width = 4.96875,
height = 15.9688,
rotation = 0,
visible = true,
properties = {}
}
}
}
},
{
id = 465,
objectGroup = {
type = "objectgroup",
name = "",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "index",
properties = {},
objects = {
{
id = 1,
name = "",
type = "",
shape = "rectangle",
x = 10.9565,
y = 0,
width = 5.04348,
height = 15.9565,
rotation = 0,
visible = true,
properties = {}
}
}
}
},
{
id = 505,
objectGroup = {
type = "objectgroup",
name = "",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "index",
properties = {},
objects = {
{
id = 1,
name = "",
type = "",
shape = "rectangle",
x = 11,
y = 0,
width = 5.04348,
height = 15.9565,
rotation = 0,
visible = true,
properties = {}
}
}
}
},
{
id = 545,
objectGroup = {
type = "objectgroup",
name = "",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "index",
properties = {},
objects = {
{
id = 1,
name = "",
type = "",
shape = "rectangle",
x = 11.0435,
y = 0,
width = 5,
height = 15.913,
rotation = 0,
visible = true,
properties = {}
},
{
id = 2,
name = "",
type = "",
shape = "rectangle",
x = 0,
y = 10.9375,
width = 15.8125,
height = 4.9375,
rotation = 0,
visible = true,
properties = {}
}
}
}
},
{
id = 584,
objectGroup = {
type = "objectgroup",
name = "",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "index",
properties = {},
objects = {
{
id = 1,
name = "",
type = "",
shape = "rectangle",
x = -0.25,
y = 0.125,
width = 16.125,
height = 15.875,
rotation = 0,
visible = true,
properties = {}
}
}
}
},
{
id = 585,
objectGroup = {
type = "objectgroup",
name = "",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "index",
properties = {},
objects = {
{
id = 1,
name = "",
type = "",
shape = "rectangle",
x = -0.375,
y = -0.375,
width = 16.25,
height = 16.375,
rotation = 0,
visible = true,
properties = {}
}
}
}
}
}
},
{
name = "elevatorTileset",
firstgid = 881,
filename = "elevatorTileset.tsx",
tilewidth = 16,
tileheight = 16,
spacing = 0,
margin = 0,
image = "../img/Elevator2.png",
imagewidth = 288,
imageheight = 64,
tileoffset = {
x = 0,
y = 0
},
grid = {
orientation = "orthogonal",
width = 16,
height = 16
},
properties = {},
terrains = {},
tilecount = 72,
tiles = {}
},
{
name = "objetos",
firstgid = 953,
filename = "objetos.tsx",
tilewidth = 192,
tileheight = 192,
spacing = 0,
margin = 0,
image = "../img/tileset.png",
imagewidth = 5184,
imageheight = 192,
tileoffset = {
x = 0,
y = 0
},
grid = {
orientation = "orthogonal",
width = 192,
height = 192
},
properties = {},
terrains = {},
tilecount = 27,
tiles = {}
}
},
layers = {
{
type = "tilelayer",
name = "tileLayerGround",
x = 0,
y = 0,
width = 40,
height = 40,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "lua",
data = {
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300
}
},
{
type = "tilelayer",
name = "tileLayerWalls",
x = 0,
y = 0,
width = 40,
height = 40,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {
["collidable"] = "true"
},
encoding = "lua",
data = {
384, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 385, 386,
424, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 425, 426,
464, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 465, 466,
504, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 506,
504, 4, 4, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 506,
504, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 515, 516, 517, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 515, 516, 517, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 595, 596, 597, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 595, 596, 597, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 635, 636, 637, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 635, 636, 637, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 675, 676, 677, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 675, 676, 677, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 515, 516, 385, 385, 385, 385, 385, 516, 517, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 424, 425, 425, 425, 425, 425, 425, 425, 426, 0, 0, 0, 0, 0, 0, 4, 4, 4, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 424, 596, 425, 425, 425, 425, 425, 425, 426, 0, 0, 0, 0, 0, 0, 4, 4, 4, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 424, 636, 637, 635, 636, 637, 635, 425, 426, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 424, 425, 425, 425, 425, 425, 425, 425, 426, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 424, 425, 425, 425, 425, 425, 425, 425, 426, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 424, 425, 425, 425, 425, 425, 425, 425, 426, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 556, 556, 556, 556, 556, 556, 557, 0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 0, 0, 4, 4, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 471, 471, 471, 471, 471, 471, 471, 471, 471, 0, 0, 0, 0, 0, 0, 0, 0, 4, 4, 0, 0, 0, 4, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 471, 471, 471, 471, 471, 471, 471, 471, 471, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 515, 516, 517, 0, 0, 0, 0, 0, 511, 511, 511, 511, 511, 511, 511, 511, 511, 0, 0, 0, 0, 515, 516, 516, 516, 516, 516, 516, 516, 516, 516, 517,
504, 0, 0, 0, 0, 0, 0, 0, 555, 556, 557, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 470, 625, 625, 625, 625, 625, 625, 625, 625, 625, 472,
504, 0, 0, 0, 0, 0, 0, 0, 595, 596, 597, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 470, 625, 625, 625, 625, 625, 625, 625, 625, 625, 472,
504, 0, 0, 0, 0, 0, 0, 0, 635, 636, 637, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 470, 625, 625, 625, 625, 625, 625, 471, 625, 625, 472,
504, 0, 0, 0, 0, 0, 0, 0, 675, 676, 677, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 470, 625, 625, 625, 625, 625, 625, 471, 625, 625, 472,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 555, 556, 556, 556, 556, 556, 556, 556, 556, 556, 557,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 595, 595, 595, 595, 881, 882, 883, 595, 595, 596, 472,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 635, 635, 635, 635, 899, 900, 901, 635, 635, 636, 472,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 425, 425, 425, 425, 917, 918, 919, 929, 425, 425, 472,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 465, 465, 465, 465, 935, 936, 937, 465, 465, 465, 512,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 506,
504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 506,
544, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 545, 546,
585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585
}
},
{
type = "objectgroup",
name = "objDecoracao",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "topdown",
properties = {},
objects = {
{
id = 2,
name = "",
type = "",
shape = "rectangle",
x = -18.5,
y = 161.5,
width = 192,
height = 192,
rotation = 0,
gid = 976,
visible = true,
properties = {}
},
{
id = 3,
name = "",
type = "",
shape = "rectangle",
x = 42,
y = 141,
width = 192,
height = 192,
rotation = 0,
gid = 975,
visible = true,
properties = {}
},
{
id = 4,
name = "",
type = "",
shape = "rectangle",
x = -77.5,
y = 140,
width = 192,
height = 192,
rotation = 0,
gid = 970,
visible = true,
properties = {}
},
{
id = 5,
name = "",
type = "",
shape = "rectangle",
x = 142.667,
y = 226.667,
width = 192,
height = 192,
rotation = 0,
gid = 973,
visible = true,
properties = {}
},
{
id = 7,
name = "",
type = "",
shape = "rectangle",
x = 190.667,
y = 465.333,
width = 192,
height = 192,
rotation = 0,
gid = 953,
visible = true,
properties = {}
},
{
id = 8,
name = "",
type = "",
shape = "rectangle",
x = 209.333,
y = 465.333,
width = 192,
height = 192,
rotation = 0,
gid = 953,
visible = true,
properties = {}
},
{
id = 9,
name = "",
type = "",
shape = "rectangle",
x = 247,
y = 465.167,
width = 192,
height = 192,
rotation = 0,
gid = 953,
visible = true,
properties = {}
},
{
id = 10,
name = "",
type = "",
shape = "rectangle",
x = 228.334,
y = 465.167,
width = 192,
height = 192,
rotation = 0,
gid = 953,
visible = true,
properties = {}
},
{
id = 16,
name = "",
type = "",
shape = "rectangle",
x = 93,
y = 139,
width = 192,
height = 192,
rotation = 0,
gid = 956,
visible = true,
properties = {}
},
{
id = 17,
name = "",
type = "",
shape = "rectangle",
x = 277,
y = 471,
width = 192,
height = 192,
rotation = 0,
gid = 956,
visible = true,
properties = {}
},
{
id = 18,
name = "",
type = "",
shape = "rectangle",
x = 403,
y = 287,
width = 192,
height = 192,
rotation = 0,
gid = 957,
visible = true,
properties = {}
},
{
id = 21,
name = "",
type = "",
shape = "rectangle",
x = 438,
y = 386,
width = 192,
height = 192,
rotation = 0,
gid = 977,
visible = true,
properties = {}
},
{
id = 26,
name = "",
type = "",
shape = "rectangle",
x = 64,
y = 283,
width = 192,
height = 192,
rotation = 0,
gid = 979,
visible = true,
properties = {}
},
{
id = 27,
name = "",
type = "",
shape = "rectangle",
x = 336,
y = 137,
width = 192,
height = 192,
rotation = 0,
gid = 978,
visible = true,
properties = {}
},
{
id = 28,
name = "",
type = "",
shape = "rectangle",
x = 302,
y = 137,
width = 192,
height = 192,
rotation = 0,
gid = 978,
visible = true,
properties = {}
},
{
id = 29,
name = "",
type = "",
shape = "rectangle",
x = 457,
y = 139,
width = 192,
height = 192,
rotation = 0,
gid = 978,
visible = true,
properties = {}
},
{
id = 30,
name = "",
type = "",
shape = "rectangle",
x = 375,
y = 140,
width = 192,
height = 192,
rotation = 0,
gid = 979,
visible = true,
properties = {}
}
}
},
{
type = "objectgroup",
name = "objLayer",
visible = false,
opacity = 1,
offsetx = 0,
offsety = 0,
draworder = "topdown",
properties = {},
objects = {
{
id = 1,
name = "Exit",
type = "trigger",
shape = "point",
x = 552,
y = 526.667,
width = 0,
height = 0,
rotation = 0,
visible = true,
properties = {}
},
{
id = 22,
name = "itemSpawner",
type = "",
shape = "point",
x = 598.667,
y = 104,
width = 0,
height = 0,
rotation = 0,
visible = true,
properties = {
["item"] = "secret"
}
},
{
id = 25,
name = "itemSpawner",
type = "",
shape = "point",
x = 498,
y = 98,
width = 0,
height = 0,
rotation = 0,
visible = true,
properties = {
["item"] = "radio"
}
},
{
id = 24,
name = "itemSpawner",
type = "",
shape = "point",
x = 97.3333,
y = 190,
width = 0,
height = 0,
rotation = 0,
visible = true,
properties = {
["item"] = "radio"
}
},
{
id = 23,
name = "ennemySpawner",
type = "",
shape = "rectangle",
x = 162.667,
y = 540,
width = 16,
height = 16,
rotation = 0,
gid = 220,
visible = true,
properties = {
["id"] = 1
}
},
{
id = 15,
name = "ennemySpawner",
type = "",
shape = "rectangle",
x = 332,
y = 129,
width = 16,
height = 16,
rotation = 0,
gid = 220,
visible = true,
properties = {
["id"] = 1
}
},
{
id = 14,
name = "ennemySpawner",
type = "",
shape = "rectangle",
x = 83,
y = 540,
width = 16,
height = 16,
rotation = 0,
gid = 220,
visible = true,
properties = {
["id"] = 1
}
},
{
id = 13,
name = "triggerDialog",
type = "",
shape = "rectangle",
x = 36,
y = 264,
width = 74.6667,
height = 114.667,
rotation = 0,
gid = 219,
visible = true,
properties = {
["runLuaChain"] = "SpawnEnemy(1)",
["type"] = "trigger"
}
},
{
id = 12,
name = "Player",
type = "",
shape = "rectangle",
x = 17.8334,
y = 183,
width = 16,
height = 16,
rotation = 0,
gid = 180,
visible = true,
properties = {}
}
}
},
{
type = "tilelayer",
name = "tileLayerWallsFG",
x = 0,
y = 0,
width = 40,
height = 40,
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
properties = {},
encoding = "lua",
data = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 515, 516, 517, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 515, 516, 517, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 430, 431, 431, 431, 431, 431, 431, 431, 432, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 515, 516, 517, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 515, 516, 516, 516, 516, 516, 516, 516, 516, 516, 517,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
}
}
}
|
if FirstLoad then
WaypointChains = false
end
--config.DebugWaypoints = true
local ChainTypes = {
["Door"] = "entrance",
["Doorentrance1"] = "entrance",
["Doorentrance2"] = "entrance",
["Doorexit1"] = "entrance",
["Doorexit2"] = "entrance",
["Cardoor"] = "drone_factory_exit",
["Dronein"] = "rocket_entrance",
["Droneout"] = "rocket_exit",
["Dronedoor"] = "tunnel_entrance",
["Pathpassage"] = "passage_entrance",
}
function GetEntityWaypointChains(entity)
local waypoint_chains = WaypointChains[entity]
if waypoint_chains then return waypoint_chains end
waypoint_chains = {}
WaypointChains[entity] = waypoint_chains
if entity and IsValidEntity(entity) then
local first, last = GetAllSpots(entity, "idle")
local spot_chains
for spot = first, last do
local note = GetSpotAnnotation(entity, spot)
if note and #note > 0 then
local def
for k, v in string.gmatch(note, "(%w+)=([%w_]+)") do
def = def or {}
def[k] = tonumber(v) or v
end
local chain_idx = def and def.chain
if chain_idx then
-- create chain if this is the first spot in it
local spot_name = GetSpotName(entity, spot)
spot_chains = spot_chains or {}
local list = spot_chains[spot_name]
local chain
if list then
chain = table.find_value(list, "chain", chain_idx)
else
list = {}
spot_chains[spot_name] = list
end
if not chain then
chain = {
type = ChainTypes[spot_name],
name = spot_name,
chain = chain_idx,
openInside = 1,
openOutside = 2,
}
list[#list + 1] = chain
end
-- some chains have a door entity
if (def.entity or def.door) and not chain.door then
chain.outside = def.outside and def.outside > 0 or false
chain.door = def.door or def.entity
chain.door_spot = def.door_spot
chain.openInside = def.openInside or chain.openInside
chain.openOutside = def.openOutside or chain.openOutside
end
-- save spot at waypoint index
chain[def.waypoint] = spot
end
end
end
if spot_chains then
for spot_name, chains in sorted_pairs(spot_chains) do
table.append(waypoint_chains, chains)
end
end
end
return waypoint_chains
end
function OnMsg.EntitiesLoaded()
WaypointChains = {}
end
local ShowWaypoints
if config.DebugWaypoints then
ShowWaypoints = function(waypoints, open, color_line, color_door)
color_line = color_line or RGB(255, 255, 0)
color_door = color_door or RGB(255, 0, 0)
local line = PlaceObject("Polyline")
line:SetEnumFlags(const.efVisible)
local points, colors, texts = {}, {}, {}
for i=1,#waypoints do
local w = waypoints[i]
local c = i == open and color_door or color_line
local z = terrain.GetSurfaceHeight(w)
points[i] = w
colors[i] = c
local t = Text:new()
t:SetPos(w:SetZ((w:z() or terrain.GetHeight(w)) + 10*guic))
t:SetColor(c)
t:SetText(tostring(i))
texts[i] = t
end
line:SetPos(AveragePoint2D(points))
line:SetMesh(points, colors)
return {line = line, texts = texts}
end
end
local function HideWaypoints(data)
if data then
if IsValid(data.line) then
DoneObject(data.line)
end
data.line = false
local texts = data.texts
for i = 1, #texts do
if IsValid(texts[i]) then
DoneObject(texts[i])
end
end
data.texts = ""
end
end
----- WaypointsObj
DefineClass.WaypointsObj = {
__parents = { "Object" },
waypoint_chains = false,
entrance_fallback = false,
}
function WaypointsObj:GameInit()
self:BuildWaypointChains()
end
function WaypointsObj:BuildWaypointChains()
local waypoint_chains = {}
self.waypoint_chains = waypoint_chains
local GetHeight = terrain.GetHeight
for _, chain in ipairs(GetEntityWaypointChains(self:GetEntity())) do
local instance_chain = {
openInside = chain.openInside,
openOutside = chain.openOutside,
name = chain.name,
}
-- attach door
if chain.door then
local door = self:GetAttach(chain.door)
if not door then
door = PlaceObject(chain.door)
CopyColorizationMaterial(self, door)
self:Attach(door)
end
instance_chain.door = door
end
local pos1 = self:GetSpotPos(chain[1])
assert(chain[1] and pos1, string.format("Invalid entrance/waypoints for class %s", self.class) )-- invalid entrance
local dz1 = pos1:z() - GetHeight(pos1)
-- convert spots to points, add points if there are points under the terrain
for i = 2, #chain do
local pos2 = self:GetSpotPos(chain[i])
local dz2 = pos2:z() - GetHeight(pos2)
-- waypoint
instance_chain[#instance_chain + 1] = dz1 > 0 and pos1 or pos1:SetZ(pos1:z() - dz1)
if dz1 > 0 and dz2 < 0 or dz1 < 0 and dz2 > 0 then
-- one of the points is underground - insert a new point where the terrain
local pt1, pt2
if dz1 > 0 then
pt1, pt2 = pos1, pos2
else
pt2, pt1 = pos2, pos1
end
for i = 1, 15 do
local pt = pt1:Lerp(pt2, i, 16)
local h = GetHeight(pt)
if pt:z() <= h then
instance_chain[#instance_chain + 1] = pt:SetZ(h)
break
end
end
end
pos1, dz1 = pos2, dz2
end
-- don't forget the last waypoint
instance_chain[#instance_chain + 1] = dz1 > 0 and pos1 or pos1:SetZ(pos1:z() - dz1)
local chains = waypoint_chains
if chain.type then
chains = waypoint_chains[chain.type]
if not chains then
chains = {}
waypoint_chains[chain.type] = chains
end
end
chains[#chains + 1] = instance_chain
end
end
function WaypointsObj:GetEntranceFallback()
local fallback = self.entrance_fallback
if not fallback and self:IsValidPos() then
local origin = self:GetPos():SetInvalidZ()
local pt, dir = origin, RotateRadius(guim, self:GetAngle())
local retries = 100
while retries > 0 and not terrain.IsPassable(pt) do
pt = pt + dir
retries = retries - 1
end
if retries == 0 then
print("once", "Unit stuck in holder!", self.Template)
pt = origin
end
fallback = { pt - dir, pt }
self.entrance_fallback = fallback
end
return fallback, fallback[2]
end
function WaypointsObj:GetEntrance(target, entrance_type, spot_name)
if not self:IsValidPos() then
return
end
target = target or self
if self:HasSpot("Yard") then
return nil, nil, "Yard"
end
local entrance = self:NearestWaypoints2D(target, entrance_type or "entrance", spot_name)
if entrance then
return entrance, entrance[#entrance]
end
return self:GetEntranceFallback()
end
function GetBestWaypointsChain(target, eval, waypoint_chains, chain_type, spot_name, eval_idx, range_dist, target_in_range, idx_in_range)
local best
chain_type = chain_type or spot_name and ChainTypes[spot_name]
if chain_type then
waypoint_chains = waypoint_chains and waypoint_chains[chain_type]
end
if waypoint_chains then
local obj_in_range = IsValid(target_in_range) and target_in_range
for i = 1, #waypoint_chains do
local chain = waypoint_chains[i]
if (not spot_name or chain.name == spot_name) and
(not target_in_range or
(obj_in_range and obj_in_range:GetVisualDist(idx_in_range and chain[idx_in_range] or chain[#chain]) or
target_in_range:Dist(idx_in_range and chain[idx_in_range] or chain[#chain])) <= range_dist) and
(not best or eval(target, eval_idx and chain[eval_idx] or chain[#chain], eval_idx and best[eval_idx] or best[#best]))
then
best = chain
end
end
end
return best
end
function WaypointsObj:NearestWaypoints(target, chain_type, spot_name, chain_idx)
return GetBestWaypointsChain(target, IsCloser, self.waypoint_chains, chain_type, spot_name, chain_idx)
end
function WaypointsObj:NearestWaypoints2D(target, chain_type, spot_name, chain_idx)
return GetBestWaypointsChain(target, IsCloser2D, self.waypoint_chains, chain_type, spot_name, chain_idx)
end
function WaypointsObj:FindWaypointsInRange(spot_name, first_range, first_target, last_range, last_target)
if first_range == "Nearest" then
return GetBestWaypointsChain(first_target, IsCloser, self.waypoint_chains, nil, spot_name, 1, last_range, last_target)
elseif last_range == "Nearest" then
return GetBestWaypointsChain(last_target, IsCloser, self.waypoint_chains, nil, spot_name, nil, first_range, first_target, 1)
end
local chain_type = spot_name and ChainTypes[spot_name]
local waypoint_chains = self.waypoint_chains
if chain_type then
waypoint_chains = waypoint_chains and waypoint_chains[chain_type]
end
if waypoint_chains then
local target1 = IsValid(first_target) and first_target
local target2 = IsValid(last_target) and last_target
for i = 1, #waypoint_chains do
local chain = waypoint_chains[i]
if (not spot_name or chain.name == spot_name) and
(not first_target or (target1 and target1:GetVisualDist(chain[1]) or first_target:Dist(chain[1])) <= first_range) and
(not last_target or (target2 and target2:GetVisualDist(chain[#chain]) or last_target:Dist(chain[#chain])) <= last_range)
then
return chain
end
end
end
end
function FollowWaypointPath(unit, path, first, last, wait_door_open)
if not path then return end
first = first or #path
last = last or #path
local add_next = first <= last and 1 or -1
if unit:IsValidPos() then
assert(unit:IsCloser2D(path[first], 100*guim))
unit:Goto(path[first], "sl")
if not unit:IsValidPos() then
return -- action was interrupted
end
else
unit:SetPos(path[first])
if first ~= last then
unit:Face(path[first + add_next], 0)
end
end
local door = path.door
local open = door and (first <= last and path.openInside or path.openOutside)
unit.visit_door_opened = false
local debug_line = ShowWaypoints and ShowWaypoints(path, open)
if debug_line then
unit:PushDestructor(function(unit) HideWaypoints(debug_line) end)
end
for i = first + add_next, last, add_next do
if i - add_next == open and IsValid(door) then
unit.visit_door_opened = door
door:Open()
unit:PushDestructor(function(unit)
local door = unit.visit_door_opened
if IsValid(door) then
door:Close()
end
unit.visit_door_opened = false
end)
if wait_door_open or wait_door_open == nil and open == 1 then
unit:WaitDoorOpening(door)
if not unit:IsValidPos() then
break -- action was interrupted
end
end
end
unit:Goto(path[i], "sl")
if not unit:IsValidPos() then
break -- action was interrupted
end
end
if unit.visit_door_opened then
unit:PopAndCallDestructor()
end
if debug_line then unit:PopAndCallDestructor() end
end
function WaypointsObj:LeadIn(unit, entrance)
assert(type(entrance) == "table")
if not entrance then return end
unit.lead_in_out = self
self:OnEnterUnit(unit)
-- execute FollowWaypointPath in the destructor to make it uninterruptible
unit:PushDestructor(function(unit)
FollowWaypointPath(unit, entrance, #entrance, 1)
unit.lead_in_out = false
unit:SetOutside(false)
end)
unit:PopAndCallDestructor()
end
function WaypointsObj:LeadOut(unit, entrance)
assert(type(entrance) == "table")
if not entrance then return end
unit.lead_in_out = self
-- execute FollowWaypointPath in the destructor to make it uninterruptible
unit:PushDestructor(function(unit)
FollowWaypointPath(unit, entrance, 1, #entrance)
if not unit:IsValidPos() then
unit:SetPos(entrance[#entrance])
unit:SetAngle(CalcOrientation(entrance[#entrance-1], entrance[#entrance]))
end
unit.lead_in_out = false
unit:SetOutside(not unit.current_dome)
self:OnExitUnit(unit)
end)
unit:PopAndCallDestructor()
end
function WaypointsObj:OnEnterUnit(unit)
unit:SetHolder(self)
unit:ShowAttachedSigns(false)
end
function WaypointsObj:OnExitUnit(unit)
if unit.holder == self then
unit:SetHolder(false)
end
unit:ValidateCurrentDomeOnExit(self)
unit:ShowAttachedSigns(true)
end
function AttachDoors(obj, entity)
for _, chain in ipairs(GetEntityWaypointChains(entity)) do
if chain.door and not obj:GetAttach(chain.door) then
local door = PlaceObject(chain.door)
CopyColorizationMaterial(obj, door)
obj:Attach(door)
end
end
end
|
--[[
Copyright (c) 2016 by Marco Lizza ([email protected])
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgement in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
]]--
-- MODULE INCLUSIONS -----------------------------------------------------------
local config = require('game.config')
local constants = require('game.constants')
local graphics = require('lib.graphics')
-- MODULE DECLARATION ----------------------------------------------------------
local Starfield = {
}
-- MODULE OBJECT CONSTRUCTOR ---------------------------------------------------
Starfield.__index = Starfield
function Starfield.new()
local self = setmetatable({}, Starfield)
return self
end
-- LOCAL CONSTANTS -------------------------------------------------------------
-- LOCAL FUNCTIONS -------------------------------------------------------------
-- MODULE FUNCTIONS ------------------------------------------------------------
function Starfield:initialize()
self.angle = 0
self.ticker = 0
self.layers = {}
local steps = config.starfield.layers - 1
local step = (config.starfield.max_speed - config.starfield.min_speed) / steps
for i = 1, config.starfield.layers do
local layer = {
speed = step * (i - 1) + config.starfield.min_speed,
alpha = (255 / steps) * (i - 1),
stars = {}
}
for _ = 1, config.starfield.stars_per_layer do
layer.stars[#layer.stars + 1] = {
position = { love.math.random(constants.SCREEN_WIDTH), love.math.random(constants.SCREEN_HEIGHT) }
}
end
self.layers[#self.layers + 1] = layer
end
end
function Starfield:update(dt)
self.ticker = self.ticker + dt
if self.ticker >= config.starfield.reorient_timeout then
self.angle = love.math.random() * 2 * math.pi
self.ticker = 0
end
local vx, vy = math.cos(self.angle), math.sin(self.angle)
for _, layer in ipairs(self.layers) do
local speed = layer.speed * dt
for _, star in ipairs(layer.stars) do
local x, y = unpack(star.position)
local nx, ny = x + vx * speed, y + vy * speed
nx = (nx + constants.SCREEN_WIDTH) % constants.SCREEN_WIDTH
ny = (ny + constants.SCREEN_WIDTH) % constants.SCREEN_WIDTH
star.position = { nx, ny }
end
end
end
function Starfield:draw()
for _, layer in ipairs(self.layers) do
for _, star in ipairs(layer.stars) do
local x, y = unpack(star.position)
-- We are drawing the stars as squares, since "love.graphics.points"
-- is not autoscaled (obviously).
graphics.square(x, y, 1, 'lightcyan', layer.alpha)
end
end
end
-- END OF MODULE ---------------------------------------------------------------
return Starfield
-- END OF FILE -----------------------------------------------------------------
|
local class = require("lib/middleclass")
local module = {}
module.Circle = class('components/circle')
function module.Circle:initialize(parameters)
self.radius = parameters.radius or 50
self.style = parameters.style or "fill"
self.lineWidth = parameters.lineWidth or 1
end
return module
|
local NotificationBindable = Instance.new("BindableFunction")
NotificationBindable.OnInvoke = callback
--
game.StarterGui:SetCore("SendNotification", {
Title = "Dynamic Client";
Text = "Friend Request Spam Activated.";
Icon = "rbxassetid://4774152984";
Duration = 3;
Callback = NotificationBindable;
})
local RobloxReplicatedStorage = game:GetService('RobloxReplicatedStorage')
RemoteEvent_NewFollower = RobloxReplicatedStorage:WaitForChild('NewFollower')
while wait(0) do
for i,v in pairs(game.Players:GetChildren()) do
game.Players.LocalPlayer:RequestFriendship(v)
RemoteEvent_NewFollower:FireServer(v, true)
wait(0.01)
RemoteEvent_NewFollower:FireServer(v, false)
game.Players.LocalPlayer:RevokeFriendship(v)
end
end
|
local S = farming.intllib
-- lettuce
minetest.register_craftitem("farming:lettuce", {
description = S("Lettuce"),
inventory_image = "farming_lettuce.png",
groups = {seed = 2, food_lettuce = 1, flammable = 2},
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:lettuce_1")
end,
on_use = minetest.item_eat(2),
})
local def = {
drawtype = "plantlike",
tiles = {"farming_lettuce_1.png"},
paramtype = "light",
sunlight_propagates = true,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 2, plant = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:lettuce_1", table.copy(def))
-- stage 2
def.tiles = {"farming_lettuce_2.png"}
minetest.register_node("farming:lettuce_2", table.copy(def))
-- stage 3
def.tiles = {"farming_lettuce_3.png"}
minetest.register_node("farming:lettuce_3", table.copy(def))
-- stage 4
def.tiles = {"farming_lettuce_4.png"}
minetest.register_node("farming:lettuce_4", table.copy(def))
-- stage 5
def.tiles = {"farming_lettuce_5.png"}
def.groups.growing = nil
def.drop = {
items = {
{items = {'farming:lettuce 2'}, rarity = 1},
{items = {'farming:lettuce 1'}, rarity = 2}
}
}
minetest.register_node("farming:lettuce_5", table.copy(def))
-- add to registered_plants
farming.registered_plants["farming:lettuce"] = {
crop = "farming:lettuce",
seed = "farming:lettuce",
minlight = farming.min_light,
maxlight = farming.max_light,
steps = 5
}
|
local signatures = {
['sodium_init'] = [[
int %s(void)
]],
['sodium_memzero'] = [[
void %s(void * const pnt, const size_t len)
]],
['randombytes_random'] = [[
uint32_t %s(void)
]],
['randombytes_uniform'] = [[
uint32_t %s(const uint32_t upper_bound)
]],
['randombytes_buf'] = [[
void %s(void * const buf, const size_t size)
]],
['randombytes_buf_deterministic'] = [[
void %s(void * const buf, const size_t size,
const unsigned char *seed)
]],
['randombytes_close'] = [[
int %s(void)
]],
['randombytes_stir'] = [[
void %s(void)
]],
}
return signatures
|
rootElement = getRootElement()
thisResource = getThisResource()
missionTimers = {}
bool = { [false]=true, [true]=true }
addEvent ( "onClientMissionTimerElapsed", true )
addEventHandler("onClientResourceStart",resourceRoot,
function()
triggerServerEvent ( "onClientMissionTimerDownloaded", getLocalPlayer() )
end
)
addEventHandler ("onClientResourceStop",rootElement,
function()
for i,timer in ipairs(getElementsByType("missiontimer",source)) do
destroyElement(timer)
end
end
)
function createMissionTimer ( duration, countdown, timerFormat, x, y, bg, font, scale, r, g, b )
sourceResource = sourceResource or thisResource
local element = createElement ( "missiontimer" )
setElementParent ( element, getResourceDynamicElementRoot(sourceResource) )
setupMissionTimer ( element, duration, countdown, timerFormat, x, y, bg, font, scale, r, g, b )
return element
end
function setupMissionTimer ( element, duration, countdown, timerFormat, x, y, bg, font, scale, r, g, b )
if missionTimers[element] then return end
addEventHandler ( "onClientElementDestroy", element, onMissionTimerDestroy )
missionTimers[element] = {}
missionTimers[element].x = tonumber(x) or 0
missionTimers[element].y = tonumber(y) or 0
missionTimers[element].countdown = countdown
missionTimers[element].duration = duration
missionTimers[element].originalTick = getTickCount()
missionTimers[element].timerFormat = type( timerFormat ) == "string" and timerFormat or "%m:%s:%cs"
missionTimers[element].bg = (bool[bg] == nil and true) or bg
missionTimers[element].font = font or "default-bold"
missionTimers[element].scale = tonumber(scale) or 1
missionTimers[element].hurrytime = 15000
missionTimers[element].formatWidth = dxGetTextWidth(missionTimers[element].timerFormat, missionTimers[element].scale, missionTimers[element].font)
missionTimers[element].colour = (r and g and b) and tocolor(r, g, b) or tocolor(255,255,255)
missionTimers[element].timer = setTimer ( triggerEvent, duration, 1, "onClientMissionTimerElapsed", element )
end
function setMissionTimerTime ( timer, time )
if missionTimers[timer] then
missionTimers[timer].duration = tonumber(time) or missionTimers[timer].remaining
missionTimers[timer].originalTick = getTickCount()
if isTimer( missionTimers[timer].timer ) then
killTimer ( missionTimers[timer].timer )
end
missionTimers[timer].timer = setTimer ( triggerEvent, missionTimers[timer].duration, 1, "onClientMissionTimerElapsed", element )
return true
end
return false
end
function getMissionTimerTime ( timer )
if missionTimers[timer] then
if missionTimers[timer].countdown then
return math.max(missionTimers[timer].duration - (getTickCount() - missionTimers[timer].originalTick),0)
else
return (getTickCount() - missionTimers[timer].originalTick)
end
end
return false
end
function setMissionTimerFrozen ( timer, frozen )
if frozen == not not missionTimers[timer].frozen then return false end
if missionTimers[timer] and bool[frozen] then
missionTimers[timer].frozen = frozen or nil
if frozen then
if isTimer( missionTimers[timer].timer ) then
killTimer ( missionTimers[timer].timer )
end
missionTimers[timer].timer = nil
missionTimers[timer].duration = getMissionTimerTime ( timer )
else
missionTimers[timer].timer = setTimer ( triggerEvent, missionTimers[timer].duration, 1, "onClientMissionTimerElapsed", timer )
missionTimers[timer].originalTick = getTickCount()
end
return true
end
return false
end
function isMissionTimerFrozen ( timer )
return not not missionTimers[timer].frozen
end
function setMissionTimerHurryTime ( timer, time )
missionTimers[timer].hurrytime = tonumber(time) or 15000
end
function setMissionTimerFormat( timer, timerFormat )
if type( timerFormat ) ~= "string" then return false end
if missionTimers[timer] then
missionTimers[timer].timerFormat = timerFormat
missionTimers[timer].formatWidth = dxGetTextWidth(missionTimers[timer].timerFormat, missionTimers[timer].scale, missionTimers[timer].font)
end
end
function onMissionTimerDestroy()
for i,timer in ipairs(getTimers()) do
if timer == missionTimers[source].timer then
killTimer ( timer )
break
end
end
missionTimers[source] = nil
end
|
local command = require('core.command')
local ffi = require('ffi')
ffi.cdef[[
void* GetConsoleWindow();
bool ShowWindow(void*, int);
bool IsWindowVisible(void*);
]]
local C = ffi.C
local hwnd = C.GetConsoleWindow()
local cw = command.new('cw')
local commands = {
show = true,
hide = false,
}
local check = function(command)
if command == nil then
return not C.IsWindowVisible(hwnd)
end
return commands[command]
end
cw:register(function(command)
C.ShowWindow(hwnd, check(command) and 5 or 0)
end, '[visible:one_of(show,hide)]')
|
require "devmode"
local Board = require "sources.board"
local Scaling = require "sources.scaling"
local Storage = require "sources.storage"
TITLE = "ChineseCheckersLöve"
ID = "chinese.checkers.love"
WIDTH = 800
HEIGHT = 600
-- Affichage des identifiants des cases
DEVMODE_SHOW_TILES_ID = false
-- Affichage des coups possibles
DEVMODE_SHOW_ALLOWED_MOVES = true
-- Interface graphique
local ui = nil
-- Calques
local layers = {}
-- Écran affiché (constitué d'une pile de calques)
local screen = {}
-- Données de la partie courante
local game = {}
--[[ Gestion des sauvegardes ]]--
local function slotname(id)
return string.format("gamesave%d.lua", id)
end
function removeGame()
local slot = game.slot
if slot then
if slot.lastModified then
Storage.remove(slotname(slot.id))
slot.lastModified = nil
end
slot.creationTime = 0
slot.board = nil
end
end
function saveGame()
local slot = game.slot
if slot and slot.board then
if slot.creationTime == 0 then
slot.creationTime = os.time()
end
Storage.save(slotname(slot.id), {
creationTime = slot.creationTime;
board = slot.board;
})
slot.lastModified = Storage.lastModified(slotname(slot.id))
end
end
--[[ Gestion des traductions ]]--
function tr(id)
if not id or not Language then
return ""
end
local translation = Translations[Language]
if translation and translation[id] then
return translation[id]
end
return id
end
--[[ Gestion des calques ]]--
function popLayer()
table.remove(screen)
end
function pushLayer(layer)
if layers[layer] then
table.insert(screen, layer)
end
end
function switchLayer(layer)
if layers[layer] then
screen = { layer }
end
end
function topLayer(layer)
return screen[#screen] == layer
end
--[[ Callbacks ]]--
function love.load()
math.randomseed(os.time())
love.window.setTitle(TITLE)
love.filesystem.setIdentity(ID)
love.window.setMode(WIDTH, HEIGHT, {
resizable = true;
fullscreentype = "desktop";
highdpi = true;
})
-- Chargement des plateaux de jeu
Boards = {
require "sources.boards.chinese_checkers",
require "sources.boards.chinese_checkers_2players",
require "sources.boards.chinese_checkers_variant",
}
if DEVMODE then
table.insert(Boards, 1, require "sources.boards.chinese_checkers_debug")
end
-- Chargement des sauvegardes
Slots = {}
for id = 1,4 do
local board = nil
local creationTime = 0
local data = Storage.load(slotname(id))
if data then
board = Board.load(data.board)
creationTime = data.creationTime or 0
end
table.insert(Slots, {
id = id;
creationTime = creationTime;
board = board;
lastModified = board and Storage.lastModified(slotname(id)) or nil;
})
end
-- Chargement des traductions
Translations = {
en = require "sources.Languages.en";
fr = require "sources.Languages.fr";
}
Language = "en"
-- Définition de l'interface graphique
ui = require "sources.ui"
-- Chargement des calques
layers = {
game_new = require "sources.layers.game_new";
game_over = require "sources.layers.game_over";
game_remove = require "sources.layers.game_remove";
play = require "sources.layers.play";
title = require "sources.layers.title";
}
-- Lancement du jeu
pushLayer("title")
end
function love.update(dt)
end
function love.draw()
Scaling.preRender(WIDTH, HEIGHT)
local x, y = Scaling.position(WIDTH, HEIGHT, love.mouse.getPosition())
local select = love.mouse.isDown(1)
ui.start(x, y, select)
for _,layer in ipairs(screen) do
layers[layer](game, ui)
end
if love.keyboard.isDown("tab") and topLayer("play") then
ui.standings(game.slot.board)
end
ui.stop()
Scaling.postRender()
end
function love.keypressed(key, scancode, isrepeat)
if not DEVMODE then
return
end
if key == "kp0" then
DEVMODE_SHOW_TILES_ID = not DEVMODE_SHOW_TILES_ID
print("Show Tiles ID: "..tostring(DEVMODE_SHOW_TILES_ID))
elseif key == "kp." then
DEVMODE_SHOW_ALLOWED_MOVES = not DEVMODE_SHOW_ALLOWED_MOVES
print("Show Allowed Moves: "..tostring(DEVMODE_SHOW_ALLOWED_MOVES))
elseif key == "return" then
love.window.setFullscreen(not love.window.getFullscreen())
elseif key == "l" then
Language = (Language == "en") and "fr" or "en"
elseif key == "backspace" and topLayer("play") then
if game.selectedTile then
game.selectedTile = nil
else
Board.cancelLastMove(game.slot.board)
saveGame()
end
end
end |
ITEM.name = "Anorak"
ITEM.model ="models/kek1ch/rookie_outfit.mdl"
ITEM.newModel ="models/stalkerisaac/playermodel/male_01_anorak.mdl"
ITEM.description= "A worn anorak."
ITEM.longdesc = "A simple polyester-cotton mix anorak. Doesn't provide much protection from anything except the wind and rain. "
ITEM.width = 2
ITEM.height = 2
ITEM.price = 2000
--ITEM.busflag = {"SPECIAL6", "SPECIAL5", "SPECIAL7"}
ITEM.busflag = "suits1"
ITEM.br = 0
ITEM.fbr = 0
ITEM.ar = 0
ITEM.far = 0
ITEM.repairCost = ITEM.price/100*1
ITEM.ballisticlevels = {"0","l","l","0","0"}
ITEM.img = ix.util.GetMaterial("vgui/hud/outfit_anorak1.png")
ITEM.weight = 0.760
ITEM.miscslots = 1
ITEM.skincustom[1] = {
name = "Skin 0",
skingroup = 0,
}
ITEM.skincustom[2] = {
name = "Skin 1",
skingroup = 1,
}
ITEM.skincustom[3] = {
name = "Skin 2",
skingroup = 2,
}
ITEM.skincustom[4] = {
name = "Skin 3",
skingroup = 3,
}
ITEM.skincustom[5] = {
name = "Skin 4",
skingroup = 4,
}
ITEM.skincustom[6] = {
name = "Skin 5",
skingroup = 5,
}
ITEM.skincustom[7] = {
name = "Skin 6",
skingroup = 6,
}
ITEM.skincustom[8] = {
name = "Skin 7",
skingroup = 7,
}
ITEM.skincustom[9] = {
name = "Skin 8",
skingroup = 8,
}
ITEM.skincustom[10] = {
name = "Skin 9",
skingroup = 9,
}
ITEM.skincustom[11] = {
name = "Skin 10",
skingroup = 10,
}
ITEM.skincustom[12] = {
name = "Skin 11",
skingroup = 11,
}
ITEM.skincustom[13] = {
name = "Skin 12",
skingroup = 12,
}
ITEM.skincustom[14] = {
name = "Skin 13",
skingroup = 13,
}
ITEM.skincustom[15] = {
name = "Skin 14",
skingroup = 14,
}
ITEM.skincustom[16] = {
name = "Skin 15",
skingroup = 15,
}
ITEM.skincustom[17] = {
name = "Skin 16",
skingroup = 16,
}
ITEM.skincustom[18] = {
name = "Skin 17",
skingroup = 17,
}
ITEM.skincustom[19] = {
name = "Skin 18",
skingroup = 18,
}
ITEM.skincustom[20] = {
name = "Skin 19",
skingroup = 19,
}
ITEM.skincustom[21] = {
name = "Skin 20",
skingroup = 20,
}
ITEM.skincustom[22] = {
name = "Skin 21",
skingroup = 21,
}
ITEM.skincustom[23] = {
name = "Skin 22",
skingroup = 22,
}
ITEM.skincustom[24] = {
name = "Skin 23",
skingroup = 23,
}
ITEM.skincustom[25] = {
name = "Skin 24",
skingroup = 24,
}
ITEM.skincustom[26] = {
name = "Skin 25",
skingroup = 25,
}
ITEM.skincustom[27] = {
name = "Skin 26",
skingroup = 26,
}
ITEM.skincustom[28] = {
name = "Skin 27",
skingroup = 27,
}
ITEM.skincustom[29] = {
name = "Skin 28",
skingroup = 28,
}
ITEM.skincustom[30] = {
name = "Skin 29",
skingroup = 29,
}
ITEM.skincustom[31] = {
name = "Skin 30",
skingroup = 30,
}
ITEM.skincustom[32] = {
name = "Skin 31",
skingroup = 31,
}
ITEM.skincustom[33] = {
name = "Skin 32",
skingroup = 32,
} |
local gamemode = ScriptedGamemode()
gamemode.PlayerNicks = {}
gamemode:On("PlayerControlledEntityUpdate", function (self, player, oldEntity, newEntity)
local id = player:GetPlayerIndex()
local text = self.PlayerNicks[id]
if (text) then
text:Hide()
end
if (newEntity) then
local text = newEntity:AddText({
Font = "BW_Names",
Hovering = true,
OutlineThickness = 2,
RenderOrder = 10,
Text = player:GetName()
})
text:SetHoveringHeight(20)
local size = text:GetSize()
text:SetOffset(Vec2(-size.x / 2, -size.y))
local team = self:GetPlayerTeam(player)
if (team) then
text:SetColor(team:GetColor())
end
self.PlayerNicks[id] = text
else
self.PlayerNicks[id] = nil
end
end)
gamemode:On("PlayerNameUpdate", function (self, player, newName)
local id = player:GetPlayerIndex()
local text = self.PlayerNicks[id]
if (text) then
text:SetText(newName)
local size = text:GetSize()
text:SetOffset(Vec2(-size.x / 2, -size.y))
end
end)
gamemode:On("PlayerLeave", function (self, player)
local id = player:GetPlayerIndex()
local text = self.PlayerNicks[id]
if (text) then
text:Hide()
end
self.PlayerNicks[id] = nil
end)
gamemode:On("PlayerTeamUpdate", function (self, player, team)
local id = player:GetPlayerIndex()
local text = self.PlayerNicks[id]
if (text) then
text:SetColor(team and team:GetColor() or {r = 255, g = 255, b = 255})
end
end)
|
object_tangible_wearables_base_base_cybernetic_legs = object_tangible_wearables_base_shared_base_cybernetic_legs:new {
}
ObjectTemplates:addTemplate(object_tangible_wearables_base_base_cybernetic_legs, "object/tangible/wearables/base/base_cybernetic_legs.iff")
|
--[[
Copyright (c) 2015, Robert 'Bobby' Zenz
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.
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 THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
--]]
--- Various functions for working with numbers.
numberutil = {}
--- Formats the given number into a nice, readable string.
--
-- @param number The number to format.
-- @param decimal_places Optional. How many decimal places to show. The number
-- will be rounded to this amount of decimal places,
-- if omitted, as many as there are are printed.
-- @param decimal_separator Optional. The decimal separator to use, defaults
-- to a dot.
-- @param thousand_separator Optional. The thousand separator to use, defaults
-- to a comma.
-- @return The formatted number.
function numberutil.format(number, decimal_places, decimal_separator, thousand_separator)
decimal_separator = decimal_separator or "."
thousand_separator = thousand_separator or ","
if decimal_places then
number = mathutil.round(number, decimal_places)
end
local number_string = tostring(number)
local start_index, end_index, minus, integer, fraction = string.find(number_string, "(-?)(%d+)([.]?%d*)")
local formatted = ""
if #integer > 3 then
for index = #integer, 3, -3 do
formatted = thousand_separator .. string.sub(integer, index - 2, index) .. formatted
end
local rest = math.fmod(#integer, 3)
if rest > 0 then
formatted = string.sub(integer, 1, rest) .. formatted
end
else
formatted = integer .. formatted
end
if minus ~= nil and minus ~= "" then
formatted = minus .. formatted
end
if decimal_places == nil or decimal_places > 0 then
if fraction ~= nil and fraction ~= "" then
fraction = string.sub(fraction, 2)
if decimal_places and #fraction < decimal_places then
fraction = fraction .. string.rep("0", decimal_places - #fraction)
end
formatted = formatted .. decimal_separator .. fraction
elseif decimal_places ~= nil then
formatted = formatted .. decimal_separator .. string.rep("0", decimal_places)
end
end
return formatted
end
|
-- Baked Clay by TenPlus1
local clay = {
{"natural", "Natural"},
{"white", "White"},
{"grey", "Grey"},
{"black", "Black"},
{"red", "Red"},
{"yellow", "Yellow"},
{"green", "Green"},
{"cyan", "Cyan"},
{"blue", "Blue"},
{"magenta", "Magenta"},
{"orange", "Orange"},
{"violet", "Violet"},
{"brown", "Brown"},
{"pink", "Pink"},
{"dark_grey", "Dark Grey"},
{"dark_green", "Dark Green"}
}
local techcnc_mod = minetest.get_modpath("technic_cnc")
local stairs_mod = minetest.get_modpath("stairs")
local stairsplus_mod = minetest.get_modpath("moreblocks")
and minetest.global_exists("stairsplus")
for _, clay in pairs(clay) do
-- node
minetest.register_node("bakedclay:" .. clay[1], {
description = clay[2] .. " Baked Clay",
tiles = {"baked_clay_" .. clay[1] ..".png"},
groups = {cracky = 3, bakedclay = 1},
sounds = default.node_sound_stone_defaults()
})
-- craft recipe
if clay[1] ~= "natural" then
minetest.register_craft({
output = "bakedclay:" .. clay[1] .. " 8",
recipe = {
{"group:bakedclay", "group:bakedclay", "group:bakedclay"},
{"group:bakedclay", "dye:" .. clay[1], "group:bakedclay"},
{"group:bakedclay", "group:bakedclay", "group:bakedclay"}
}
})
end
-- stairs plus
if stairsplus_mod then
stairsplus:register_all("bakedclay", "baked_clay_" .. clay[1],
"bakedclay:" .. clay[1], {
description = clay[2] .. " Baked Clay",
tiles = {"baked_clay_" .. clay[1] .. ".png"},
groups = {cracky = 3},
sounds = default.node_sound_stone_defaults()
})
stairsplus:register_alias_all("bakedclay", clay[1],
"bakedclay", "baked_clay_" .. clay[1])
minetest.register_alias("stairs:slab_bakedclay_".. clay[1],
"bakedclay:slab_baked_clay_" .. clay[1])
minetest.register_alias("stairs:stair_bakedclay_".. clay[1],
"bakedclay:stair_baked_clay_" .. clay[1])
-- stairs redo
elseif stairs_mod and stairs.mod then
stairs.register_all("bakedclay_" .. clay[1], "bakedclay:" .. clay[1],
{cracky = 3},
{"baked_clay_" .. clay[1] .. ".png"},
clay[2] .. " Baked Clay",
default.node_sound_stone_defaults())
-- default stairs
elseif stairs_mod then
stairs.register_stair_and_slab("bakedclay_".. clay[1], "bakedclay:".. clay[1],
{cracky = 3},
{"baked_clay_" .. clay[1] .. ".png"},
clay[2] .. " Baked Clay Stair",
clay[2] .. " Baked Clay Slab",
default.node_sound_stone_defaults())
end
-- register bakedclay for use in technic_cnc mod
if techcnc_mod then
technic_cnc.register_all("bakedclay:" .. clay[1],
{cracky = 3, not_in_creative_inventory = 1},
{"baked_clay_" .. clay[1] .. ".png"},
clay[2] .. " Baked Clay")
end
end
-- Terracotta blocks (textures by D3monPixel, thanks for use :)
for _, clay in pairs(clay) do
if clay[1] ~= "natural" then
local texture = "baked_clay_terracotta_" .. clay[1] ..".png"
minetest.register_node("bakedclay:terracotta_" .. clay[1], {
description = clay[2] .. " Glazed Terracotta",
tiles = {
texture .. "",
texture .. "",
texture .. "^[transformR180",
texture .. "",
texture .. "^[transformR270",
texture .. "^[transformR90",
},
paramtype2 = "facedir",
groups = {cracky = 3, terracotta = 1},
sounds = default.node_sound_stone_defaults(),
on_place = minetest.rotate_node
})
minetest.register_craft({
type = "cooking",
output = "bakedclay:terracotta_" .. clay[1],
recipe = "bakedclay:" .. clay[1]
})
end
end
minetest.register_alias("bakedclay:terracotta_light_blue", "bakedclay:terracotta_cyan")
-- cook clay block into white baked clay
minetest.register_craft({
type = "cooking",
output = "bakedclay:natural",
recipe = "default:clay",
})
-- register a few extra dye colour options
minetest.register_craft( {
type = "shapeless",
output = "dye:dark_grey 3",
recipe = {"dye:black", "dye:black", "dye:white"}
})
minetest.register_craft( {
type = "shapeless",
output = "dye:green 4",
recipe = {"default:cactus"}
})
minetest.register_craft( {
type = "shapeless",
output = "dye:brown 4",
recipe = {"default:dry_shrub"}
})
-- only add light grey recipe if unifieddye mod isnt present (conflict)
if not minetest.get_modpath("unifieddyes") then
minetest.register_craft( {
type = "shapeless",
output = "dye:grey 3",
recipe = {"dye:black", "dye:white", "dye:white"}
})
end
-- 2x2 red baked clay makes 16x clay brick
minetest.register_craft( {
output = "default:clay_brick 16",
recipe = {
{"bakedclay:red", "bakedclay:red"},
{"bakedclay:red", "bakedclay:red"},
}
})
-- register some new flowers to fill in missing dye colours
-- flower registration (borrowed from default game)
local function add_simple_flower(name, desc, box, f_groups)
f_groups.snappy = 3
f_groups.flower = 1
f_groups.flora = 1
f_groups.attached_node = 1
minetest.register_node("bakedclay:" .. name, {
description = desc,
drawtype = "plantlike",
waving = 1,
tiles = {"baked_clay_" .. name .. ".png"},
inventory_image = "baked_clay_" .. name .. ".png",
wield_image = "baked_clay_" .. name .. ".png",
sunlight_propagates = true,
paramtype = "light",
walkable = false,
buildable_to = true,
stack_max = 99,
groups = f_groups,
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = box
}
})
end
local flowers = {
{"delphinium", "Blue Delphinium",
{-0.15, -0.5, -0.15, 0.15, 0.3, 0.15}, {color_cyan = 1}},
{"thistle", "Thistle",
{-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_magenta = 1}},
{"lazarus", "Lazarus Bell",
{-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_pink = 1}},
{"mannagrass", "Reed Mannagrass",
{-0.15, -0.5, -0.15, 0.15, 0.2, 0.15}, {color_dark_green = 1}}
}
for _,item in pairs(flowers) do
add_simple_flower(unpack(item))
end
-- mapgen for new flowers
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.004,
spread = {x = 100, y = 100, z = 100},
seed = 7133,
octaves = 3,
persist = 0.6
},
y_min = 10,
y_max = 90,
decoration = "bakedclay:delphinium"
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "default:dirt_with_dry_grass"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.004,
spread = {x = 100, y = 100, z = 100},
seed = 7134,
octaves = 3,
persist = 0.6
},
y_min = 15,
y_max = 90,
decoration = "bakedclay:thistle"
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "default:dirt_with_rainforest_litter"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.01,
spread = {x = 100, y = 100, z = 100},
seed = 7135,
octaves = 3,
persist = 0.6
},
y_min = 1,
y_max = 90,
decoration = "bakedclay:lazarus",
spawn_by = "default:jungletree",
num_spawn_by = 1
})
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:dirt_with_grass", "default:sand"},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.009,
spread = {x = 100, y = 100, z = 100},
seed = 7136,
octaves = 3,
persist = 0.6
},
y_min = 1,
y_max = 15,
decoration = "bakedclay:mannagrass",
spawn_by = "group:water",
num_spawn_by = 1
})
-- lucky blocks
if minetest.get_modpath("lucky_block") then
local p = "bakedclay:"
lucky_block:add_blocks({
{"dro", {"bakedclay:"}, 10, true},
{"fal", {p.."black", p.."blue", p.."brown", p.."cyan", p.."dark_green",
p.."dark_grey", p.."green", p.."grey", p.."magenta", p.."orange",
p.."pink", p.."red", p.."violet", p.."white", p.."yellow", p.."natural"}, 0},
{"fal", {p.."black", p.."blue", p.."brown", p.."cyan", p.."dark_green",
p.."dark_grey", p.."green", p.."grey", p.."magenta", p.."orange",
p.."pink", p.."red", p.."violet", p.."white", p.."yellow", p.."natural"}, 0, true},
{"dro", {p.."delphinium"}, 5},
{"dro", {p.."lazarus"}, 5},
{"dro", {p.."mannagrass"}, 5},
{"dro", {p.."thistle"}, 6},
{"flo", 5, {p.."natural", p.."black", p.."blue", p.."brown", p.."cyan",
p.."dark_green", p.."dark_grey", p.."green", p.."grey", p.."magenta",
p.."orange", p.."pink", p.."red", p.."violet", p.."white", p.."yellow"}, 2},
{"nod", "default:chest", 0, {
{name = p.."natural", max = 30},
{name = p.."black", max = 30},
{name = p.."blue", max = 30},
{name = p.."brown", max = 30},
{name = p.."cyan", max = 30},
{name = p.."dark_green", max = 30},
{name = p.."dark_grey", max = 30},
{name = p.."green", max = 30},
{name = p.."grey", max = 30},
{name = p.."magenta", max = 30},
{name = p.."orange", max = 30},
{name = p.."pink", max = 30},
{name = p.."red", max = 30},
{name = p.."violet", max = 30},
{name = p.."white", max = 30},
{name = p.."yellow", max = 30}
}},
})
p = "bakedclay:terracotta_"
lucky_block:add_blocks({
{"nod", "default:chest", 0, {
{name = p.."black", max = 20},
{name = p.."blue", max = 20},
{name = p.."brown", max = 20},
{name = p.."cyan", max = 20},
{name = p.."dark_green", max = 20},
{name = p.."dark_grey", max = 20},
{name = p.."green", max = 20},
{name = p.."grey", max = 20},
{name = p.."magenta", max = 20},
{name = p.."orange", max = 20},
{name = p.."pink", max = 20},
{name = p.."red", max = 20},
{name = p.."violet", max = 20},
{name = p.."white", max = 20},
{name = p.."yellow", max = 20}
}}
})
end
-- colored clay compatibility
if minetest.settings:get_bool("colored_clay_compatibility") == true then
local cc = {
{"black", "black"},
{"blue", "blue"},
{"bright", "natural"},
{"brown", "brown"},
{"cyan", "cyan"},
{"dark_green", "dark_green"},
{"dark_grey", "dark_grey"},
{"green", "green"},
{"grey", "grey"},
{"hardened", "natural"},
{"magenta", "magenta"},
{"orange", "orange"},
{"pink", "pink"},
{"red", "red"},
{"violet", "violet"},
{"white", "white"},
{"yellow", "yellow"}
}
for n = 1, #cc do
local nod1 = "colored_clay:" .. cc[n][1]
local nod2 = "bakedclay:" .. cc[n][2]
minetest.register_alias(nod1, nod2)
if stairsplus_mod then
stairsplus:register_alias_all("colored_clay", cc[n][1], "bakedclay", cc[n][2])
end
end
end
-- flowerpot mod
if minetest.get_modpath("flowerpot") then
flowerpot.register_node("bakedclay:delphinium")
flowerpot.register_node("bakedclay:thistle")
flowerpot.register_node("bakedclay:lazarus")
flowerpot.register_node("bakedclay:mannagrass")
end
print ("[MOD] Baked Clay loaded")
|
heraldConvoTemplate = ConvoTemplate:new {
initialScreen = "init",
templateType = "Lua",
luaClassHandler = "herald_conv_handler",
screens = {}
}
init = ConvoScreen:new {
id = "init",
leftDialog = "",
stopConversation = "false",
options = {
}
}
heraldConvoTemplate:addScreen(init);
npc_1_1 = ConvoScreen:new {
id = "npc_1_1",
leftDialog = ":npc_1_1",
stopConversation = "false",
options = {
{ ":player_1_1", "npc_2_1" },
{ ":player_2_1", "npc_3_1" },
{ ":player_3_1", "npc_4_1" }
}
}
heraldConvoTemplate:addScreen(npc_1_1);
npc_2_1 = ConvoScreen:new {
id = "npc_2_1",
leftDialog = ":npc_2_1",
stopConversation = "true",
options = {}
}
heraldConvoTemplate:addScreen(npc_2_1);
npc_3_1 = ConvoScreen:new {
id = "npc_3_1",
leftDialog = ":npc_3_1",
stopConversation = "true",
options = {}
}
heraldConvoTemplate:addScreen(npc_3_1);
npc_4_1 = ConvoScreen:new {
id = "npc_4_1",
leftDialog = ":npc_4_1",
stopConversation = "false",
options = {
{ ":player_1_1", "npc_2_1" },
{ ":player_2_1", "npc_3_1" }
}
}
heraldConvoTemplate:addScreen(npc_4_1);
npc_work_1 = ConvoScreen:new {
id = "npc_work_1",
leftDialog = ":npc_work_1",
stopConversation = "false",
options = {
{ ":player_reset", "npc_backtowork_1" },
{ ":player_sorry", "npc_reset" }
}
}
heraldConvoTemplate:addScreen(npc_work_1);
npc_backtowork_1 = ConvoScreen:new {
id = "npc_backtowork_1",
leftDialog = ":npc_backtowork_1",
stopConversation = "true",
options = {}
}
heraldConvoTemplate:addScreen(npc_backtowork_1);
npc_reset = ConvoScreen:new {
id = "npc_reset",
leftDialog = ":npc_reset",
stopConversation = "true",
options = {}
}
heraldConvoTemplate:addScreen(npc_reset);
addConversationTemplate("heraldConvoTemplate", heraldConvoTemplate); |
-----------------------------------
-- Area: Windurst Waters [S]
-- NPC: Ezura-Romazura
-- Standard Merchant NPC
-----------------------------------
local ID = require("scripts/zones/Windurst_Waters_[S]/IDs")
require("scripts/globals/shop")
-----------------------------------
function onTrade(player, npc, trade)
end
function onTrigger(player, npc)
local stock =
{
4771, 123750, -- Scroll of Stone V
4781, 133110, -- Scroll of Water V
4766, 144875, -- Scroll of Aero V
4756, 162500, -- Scroll of Fire V
4761, 186375, -- Scroll of Blizzard V
4893, 168150, -- Scroll of Stoneja
4895, 176700, -- Scroll of Waterja
4890, 193800, -- Scroll of Firaja
4892, 185240, -- Scroll of Aeroja
4863, 126000, -- Scroll of Break
}
player:showText(npc, ID.text.EZURAROMAZURA_SHOP_DIALOG)
tpz.shop.general(player, stock)
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
end
|
local bit = require('bit')
local fs_ffi = require('acid.fs_ffi')
local strutil = require('acid.strutil')
local util = require('acid.util')
local _M = {}
function _M.is_exist(path)
local _, err, errmsg = fs_ffi.access(path, fs_ffi.F_OK)
if err ~= nil then
return nil, err, errmsg
end
return true, nil, nil
end
function _M.is_dir(path)
local file_stat, err, errmsg = fs_ffi.stat(path)
if err ~= nil then
return nil, err, errmsg
end
if bit.band(file_stat.st_mode, fs_ffi.S_IFDIR) ~= 0 then
return true, nil, nil
end
return false, nil, nil
end
function _M.is_file(path)
local file_stat, err, errmsg = fs_ffi.stat(path)
if err ~= nil then
return nil, err, errmsg
end
if bit.band(file_stat.st_mode, fs_ffi.S_IFREG) ~= 0 then
return true, nil, nil
end
return false, nil, nil
end
function _M.read_dir(path)
if not _M.is_dir(path) then
return nil, 'PathTypeError', 'path is not a directory'
end
local entries, err, errmsg = fs_ffi.readdir(path)
if err ~= nil then
return nil, err, errmsg
end
local entry_names = {}
for _, entry in ipairs(entries) do
local name = entry.d_name
if name ~= '.' and name ~= '..' then
table.insert(entry_names, name)
end
end
return entry_names, nil, nil
end
function _M.make_dir(path, mode, name_or_uid, name_or_gid)
mode = mode or tonumber('755', 8)
local uid
local gid
if name_or_uid ~= nil then
local user, err, errmsg = util.get_user(name_or_uid)
if err ~= nil then
return nil, 'GetUserError', string.format(
'failed to get user: %s, %s, %s',
tostring(name_or_uid), err, errmsg)
end
uid = user.pw_uid
end
if name_or_gid ~= nil then
local group, err, errmsg = util.get_group(name_or_gid)
if err ~= nil then
return nil, 'GetGroupError', string.format(
'failed to get group: %s, %s, %s',
tostring(name_or_gid), err, errmsg)
end
gid = group.gr_gid
end
if not _M.is_exist(path) then
local _, err, errmsg = fs_ffi.mkdir(path, mode)
if err ~= nil then
return nil, 'MkdirError', string.format(
'failed to make dir: %s, %s, %s',
path, err, errmsg)
end
else
if not _M.is_dir(path) then
return nil, 'PathExistError', string.format(
'path: %s exist, and is not directory', path)
end
if mode ~= nil then
local _, err, errmsg = fs_ffi.chmod(path, mode)
if err ~= nil then
return nil, 'ChmodError', string.format(
'failed to chmod dir: %s, %s, %s',
path, err, errmsg)
end
end
end
if uid == nil or gid == nil then
return true, nil, nil
end
local _, err, errmsg = fs_ffi.chown(path, uid, gid)
if err ~= nil then
return nil, 'ChownError', string.format(
'failed to chown dir: %s, %s, %s',
path, err, errmsg)
end
return true, nil, nil
end
function _M.base_path(path)
local elts = strutil.rsplit(path, '/', {maxsplit=1})
if #elts == 1 then
return ''
end
if elts[1] == '' then
return '/'
end
return elts[1]
end
function _M.make_dirs(path, mode, name_or_uid, name_or_gid)
if path == '' then
return true, nil, nil
end
if _M.is_exist(path) and _M.is_dir(path) then
return true, nil, nil
end
local _, err, errmsg = _M.make_dirs(_M.base_path(path), mode,
name_or_uid, name_or_gid)
if err ~= nil then
return nil, err, errmsg
end
local _, err, errmsg = _M.make_dir(path, mode, name_or_uid, name_or_gid)
if err ~= nil then
return nil, err, errmsg
end
return true, nil, nil
end
function _M.remove_one_entry(entry, base_path)
local name = entry.d_name
if name == '.' or name == '..' then
return true, nil, nil
end
local path = base_path .. '/' .. name
local d_type = entry.d_type
if d_type == fs_ffi.DT_DIR then
local _, err, errmsg = _M.remove_tree(path)
if err ~= nil then
return nil, err, errmsg
end
elseif d_type == fs_ffi.DT_REG then
local _, err = os.remove(path)
if err ~= nil then
return nil, 'RemoveError', string.format(
'failed to remove file: %s, %s', path, err)
end
else
return nil, 'InvalidFileType', string.format(
'file: %s type is: %d, not a directory or regular file',
path, d_type)
end
return true, nil, nil
end
function _M.remove_tree(path, opts)
opts = opts or {}
if not _M.is_exist(path) then
return true, nil, nil
end
if not _M.is_dir(path) then
return nil, 'PathError', string.format(
'path: %s is not a directory', path)
end
local entries, err, errmsg = fs_ffi.readdir(path)
if err ~= nil then
return nil, err, errmsg
end
for _, entry in ipairs(entries) do
local _, err, errmsg = _M.remove_one_entry(entry, path)
if err ~= nil then
return nil, err, errmsg
end
end
if opts.keep_root ~= true then
local _, err = os.remove(path)
if err ~= nil then
return nil, 'RemoveError', string.format(
'failed to remove file: %s, %s', path, err)
end
end
return true, nil, nil
end
function _M.file_size(file_name)
local file_stat, err, errmsg = fs_ffi.stat(file_name)
if err ~= nil then
return nil, err, errmsg
end
return file_stat.st_size, nil, nil
end
function _M.write(path, data, mode)
local oflag = bit.bor(fs_ffi.O_CREAT, fs_ffi.O_TRUNC, fs_ffi.O_WRONLY)
local file, err, errmsg = fs_ffi.open(path, oflag, mode)
if err ~= nil then
return nil, err, errmsg
end
local _, err, errmsg = file:write(data, {retry=true, max_try_n=3})
if err ~= nil then
file:close()
return nil, err, errmsg
end
local _, err, errmsg = file:close()
if err ~= nil then
return nil, err, errmsg
end
return true, nil, nil
end
function _M.atomic_write(path, data, mode)
local tmp_path = string.format('%s_tmp_%d_%s', path, math.random(10000),
ngx.md5(data))
local _, err, errmsg = _M.write(tmp_path, data, mode)
if err ~= nil then
os.remove(tmp_path)
return nil, err, errmsg
end
local _, err = os.rename(tmp_path, path)
if err ~= nil then
os.remove(tmp_path)
return nil, 'RenameError', err
end
return true, nil, nil
end
function _M.read(path)
local bufs = {}
local file, err, errmsg = fs_ffi.open(path, fs_ffi.O_RDONLY)
if err ~= nil then
return nil, err, errmsg
end
local read_block_size = 1024 * 1024 * 10
while true do
local buf, err, errmsg = file:read(read_block_size)
if err ~= nil then
file:close()
return nil, err, errmsg
end
table.insert(bufs, buf)
if #buf == 0 then
break
end
end
local _, err, errmsg = file:close()
if err ~= nil then
return nil, err, errmsg
end
return table.concat(bufs), nil, nil
end
function _M.get_sorted_unique_fns(origin_fns)
local prev_fn = nil
local fns = {}
table.sort(origin_fns)
for _, fn in ipairs(origin_fns) do
if prev_fn ~= fn then
table.insert(fns, fn)
prev_fn = fn
end
end
return fns
end
return _M
|
GM.NotifyFadeTime = 8
local DefaultFont = "FRETTA_MEDIUM"
local DefaultFontEntity = "FRETTA_MEDIUM"
local PANEL = {}
function PANEL:Init()
self:DockPadding(8, 2, 8, 2)
end
local matGrad = Material("VGUI/gradient-r")
function PANEL:Paint()
surface.SetMaterial(matGrad)
surface.SetDrawColor(0, 0, 0, 180)
local align = self:GetParent():GetAlign()
if align == RIGHT then
surface.DrawTexturedRect(self:GetWide() * 0.25, 0, self:GetWide(), self:GetTall())
elseif align == CENTER then
surface.DrawTexturedRect(self:GetWide() * 0.25, 0, self:GetWide() * 0.25, self:GetTall())
surface.DrawTexturedRectRotated(self:GetWide() * 0.625, self:GetTall() / 2, self:GetWide() * 0.25, self:GetTall(), 180)
else
surface.DrawTexturedRectRotated(self:GetWide() * 0.25, self:GetTall() / 2, self:GetWide() / 2, self:GetTall(), 180)
end
end
function PANEL:AddLabel(text, col, font, extramargin)
local label = vgui.Create("DLabel", self)
label:SetText(text)
label:SetFont(font or DefaultFont)
label:SetTextColor(col or color_white)
label:SizeToContents()
if extramargin then
label:SetContentAlignment(7)
label:DockMargin(0, label:GetTall() * 0.2, 0, 0)
else
label:SetContentAlignment(4)
end
label:Dock(LEFT)
end
function PANEL:AddImage(mat, col)
local img = vgui.Create("DImage", self)
img:SetImage(mat)
if col then
img:SetImageColor(col)
end
img:SizeToContents()
local height = img:GetTall()
if height > self:GetTall() then
img:SetSize(self:GetTall() / height * img:GetWide(), self:GetTall())
end
img:DockMargin(0, (self:GetTall() - img:GetTall()) / 2, 0, 0)
img:Dock(LEFT)
end
function PANEL:AddKillIcon(class)
local icondata = killicon.GetIcon(class)
if icondata then
self:AddImage(icondata[1], icondata[2])
else
local fontdata = killicon.GetFont(class) or killicon.GetFont("default")
if fontdata then
self:AddLabel(fontdata[2], fontdata[3], fontdata[1], true)
end
end
end
function PANEL:SetNotification(...)
local args = {...}
local defaultcol = color_white
local defaultfont
for k, v in ipairs(args) do
local vtype = type(v)
if vtype == "table" then
if v.r and v.g and v.b then
defaultcol = v
elseif v.font then
if v.font == "" then
defaultfont = nil
else
local th = draw.GetFontHeight(v.font)
if tw then
defaultfont = v.font
end
end
elseif v.killicon then
self:AddKillIcon(v.killicon)
if v.headshot then
self:AddKillIcon("headshot")
end
elseif v.image then
self:AddImage(v.image, v.color)
end
elseif vtype == "Player" then
local avatar = vgui.Create("AvatarImage", self)
local size = self:GetTall() >= 32 and 32 or 16
avatar:SetSize(size, size)
if v:IsValid() then
avatar:SetPlayer(v, size)
end
avatar:SetAlpha(220)
avatar:Dock(LEFT)
avatar:DockMargin(0, (self:GetTall() - avatar:GetTall()) / 2, 0, 0)
if v:IsValid() then
self:AddLabel(" "..v:Name(), team.GetColor(v:Team()), DefaultFontEntity)
else
self:AddLabel(" ?", team.GetColor(TEAM_UNASSIGNED), DefaultFontEntity)
end
elseif vtype == "Entity" then
self:AddLabel("["..(v:IsValid() and v:GetClass() or "?").."]", COLOR_RED, DefaultFontEntity)
else
local text = tostring(v)
self:AddLabel(text, defaultcol, defaultfont)
end
end
end
vgui.Register("DEXNotification", PANEL, "Panel")
local PANEL = {}
AccessorFunc(PANEL, "m_Align", "Align", FORCE_NUMBER)
AccessorFunc(PANEL, "m_MessageHeight", "MessageHeight", FORCE_NUMBER)
function PANEL:Init()
self:SetAlign(LEFT)
self:SetMessageHeight(32)
self:ParentToHUD()
self:InvalidateLayout()
end
function PANEL:PerformLayout()
end
function PANEL:Paint()
end
function PANEL:AddNotification(...)
local notif = vgui.Create("DEXNotification", self)
notif:SetTall(BetterScreenScale() * self:GetMessageHeight())
notif:SetNotification(...)
local w = 0
for _, p in pairs(notif:GetChildren()) do
w = w + p:GetWide()
end
if self:GetAlign() == RIGHT then
notif:DockPadding(self:GetWide() - w - 32, 0, 8, 0)
elseif self:GetAlign() == CENTER then
notif:DockPadding((self:GetWide() - w) / 2, 0, 0, 0)
else
notif:DockPadding(8, 0, 8, 0)
end
notif:Dock(TOP)
local args = {...}
local FadeTime = GAMEMODE.NotifyFadeTime
for k, v in pairs(args) do
if type(v) == "table" and v.CustomTime and type(v.CustomTime == "number") then
FadeTime = v.CustomTime
break
end
end
notif:SetAlpha(1)
notif:AlphaTo(255, 0.5)
notif:AlphaTo(1, 1, FadeTime - 1)
notif.DieTime = CurTime() + FadeTime
return notif
end
function PANEL:Think()
local time = CurTime()
for i, pan in pairs(self:GetChildren()) do
if pan.DieTime and time >= pan.DieTime then
pan:Remove()
local dummy = vgui.Create("Panel", self)
dummy:SetTall(0)
dummy:Dock(TOP)
dummy:Remove()
end
end
end
vgui.Register("DEXNotificationsList", PANEL, "Panel")
|
-- vpath.lua - VPI handling
local _VPATH = {}
function _VPATH.new()
local self = { ready = 0 }
-- Our VCI handlers are stored here
local VCI = {}
local function _input(data)
end
-- Send data through VCI, via VPI
function self.put(vci, data)
VCI[vci].put(data)
end
-- Read data from VPI, through VCI
function self.get(vci, data)
cooked_data = VCI[vci].get(data)
-- TODO: Handle data from here
end
return self
end
return _VPATH
|
{data={name="???", author="Magnus siiftun1857 Frankline"}, blocks={
{1259800, command={
--faction=0
}}}} |
local colors = {
white = "#F8F8F2",
darker_black = "#232531",
black = "#282A36", -- nvim bg
black2 = "#303341",
one_bg = "#373844", -- real bg of onedark
one_bg2 = "#44475a",
one_bg3 = "#565761",
grey = "#5e5f69",
grey_fg = "#666771",
grey_fg2 = "#6e6f79",
light_grey = "#73747e",
red = "#E95678",
baby_pink = "#DE8C92",
pink = "#FF79C6",
line = "#373844", -- for lines like vertsplit
green = "#69ff94",
vibrant_green = "#69FF94",
nord_blue = "#b389ef",
blue = "#BD93F9",
yellow = "#F1FA8C",
sun = "#FFFFA5",
purple = "#BD93F9",
dark_purple = "#BD93F9",
teal = "#0088cc",
orange = "#FFB86C",
cyan = "#8BE9FD",
statusline_bg = "#2b2d39",
lightbg = "#343642",
lightbg2 = "#2f313d",
pmenu_bg = "#b389ef",
folder_bg = "#BD93F9",
}
return colors
|
function Div(el)
-- this function takes in an element as a parameter
if el.classes[1] == "box" then
-- classes is a field of a Div element; if the class of the element is solution, perform the table.insert function
-- Pandoc can determine the class of the Div by interpreting it in fenced div notation (i.e. ::: notes)
table.insert(
el.content, 1,
pandoc.RawBlock("latex", "\\begin{shaded*}"))
-- table.insert takes in 3 paramters: the array to be modified, the index at which
-- the new element should be inserted (where 1 is the first index), and the element to be inserted
-- this function inserts "\\begin{solution}" at the beginning of the Div element
table.insert(
el.content,
pandoc.RawBlock("latex", "\\end{shaded*}"))
-- this function inserts "\\end{solution}" at the end of the Div element
end
-- the following if statement performs the same function as the previous, but for the "notes" custom block instead
if el.classes[1] == "notes" then
table.insert(
el.content, 1,
pandoc.RawBlock("latex", "\\begin{notes}"))
table.insert(
el.content,
pandoc.RawBlock("latex", "\\end{notes}"))
end
if el.classes[1] == "learning-objectives" then
table.insert(
el.content, 1,
pandoc.RawBlock("latex", "\\begin{learning-objectives}"))
table.insert(
el.content,
pandoc.RawBlock("latex", "\\end{learning-objectives}"))
end
if el.classes[1] == "authors" then
table.insert(
el.content, 1,
pandoc.RawBlock("latex", "\\begin{authors}"))
table.insert(
el.content,
pandoc.RawBlock("latex", "\\end{authors}"))
end
return el
-- return the Div element with modifications made
end |
----------------------------------------
-- Group Calendar 5 Copyright (c) 2018 John Stephen
-- This software is licensed under the MIT license.
-- See the included LICENSE.txt file for more information.
----------------------------------------
----------------------------------------
-- Limits
----------------------------------------
GroupCalendar.DefaultLimits =
{
[40] =
{
ClassLimits =
{
P = {Min = 4, Max = 6},
R = {Min = 4, Max = 6},
D = {Min = 4, Max = 6},
W = {Min = 4, Max = 6},
H = {Min = 4, Max = 6},
K = {Min = 4, Max = 6},
M = {Min = 4, Max = 6},
L = {Min = 4, Max = 6},
S = {Min = 4, Max = 6},
},
RoleLimits =
{
H = {Min = 4, Max = 10},
T = {Min = 4, Max = 8},
R = {Min = 5, Max = 27},
M = {Min = 5, Max = 27},
},
MaxAttendance = 40,
},
[25] =
{
ClassLimits =
{
P = {Min = 2, Max = 4},
R = {Min = 2, Max = 4},
D = {Min = 2, Max = 4},
W = {Min = 2, Max = 4},
H = {Min = 2, Max = 4},
K = {Min = 2, Max = 4},
M = {Min = 2, Max = 4},
L = {Min = 2, Max = 4},
S = {Min = 2, Max = 4},
},
RoleLimits =
{
H = {Min = 4, Max = 6},
T = {Min = 4, Max = 6},
R = {Min = 4, Max = 14},
M = {Min = 4, Max = 14},
},
MaxAttendance = 25,
},
[20] =
{
ClassLimits =
{
P = {Min = 2, Max = 3},
R = {Min = 2, Max = 3},
D = {Min = 2, Max = 3},
W = {Min = 2, Max = 3},
H = {Min = 2, Max = 3},
K = {Min = 2, Max = 3},
M = {Min = 2, Max = 3},
L = {Min = 2, Max = 3},
S = {Min = 2, Max = 3},
},
RoleLimits =
{
H = {Min = 3, Max = 6},
T = {Min = 3, Max = 6},
R = {Min = 2, Max = 6},
M = {Min = 2, Max = 6},
},
MaxAttendance = 20,
},
[15] =
{
ClassLimits =
{
P = {Min = 1, Max = 3},
R = {Min = 1, Max = 3},
D = {Min = 1, Max = 3},
W = {Min = 1, Max = 3},
H = {Min = 1, Max = 3},
K = {Min = 1, Max = 3},
M = {Min = 1, Max = 3},
L = {Min = 1, Max = 3},
S = {Min = 1, Max = 3},
},
RoleLimits =
{
H = {Min = 3, Max = 4},
T = {Min = 3, Max = 4},
R = {Min = 2, Max = 4},
M = {Min = 2, Max = 4},
},
MaxAttendance = 15,
},
[10] =
{
ClassLimits =
{
P = {Min = 1, Max = 2},
R = {Min = 1, Max = 2},
D = {Min = 1, Max = 2},
W = {Min = 1, Max = 2},
H = {Min = 1, Max = 2},
K = {Min = 1, Max = 2},
M = {Min = 1, Max = 2},
L = {Min = 1, Max = 2},
S = {Min = 1, Max = 2},
},
RoleLimits =
{
H = {Min = 2, Max = 3},
T = {Min = 2, Max = 3},
R = {Min = 2, Max = 3},
M = {Min = 2, Max = 3},
},
MaxAttendance = 10,
},
[5] =
{
ClassLimits =
{
P = {Max = 1},
R = {Max = 1},
D = {Max = 1},
W = {Max = 1},
H = {Max = 1},
K = {Max = 1},
M = {Max = 1},
L = {Max = 1},
S = {Max = 1},
},
RoleLimits =
{
H = {Min = 1, Max = 1},
T = {Min = 1, Max = 1},
R = {Min = 1, Max = 2},
M = {Min = 1, Max = 2},
},
MaxAttendance = 5,
},
}
----------------------------------------
--
----------------------------------------
function GroupCalendar:LimitsAreEqual(pOldLimits, pNewLimits)
if (pNewLimits == nil) ~= (pOldLimits == nil) then
return false
end
if not pNewLimits then
return true
end
-- Not the same if max attendance changed
if pNewLimits.MaxAttendance ~= pOldLimits.MaxAttendance then
return false
end
-- Not the same if their limits modes don't match
if ((pNewLimits.ClassLimits == nil) ~= (pOldLimits.ClassLimits == nil))
or ((pNewLimits.RoleLimits == nil) ~= (pOldLimits.RoleLimits == nil)) then
return false
end
if pNewLimits.ClassLimits then
for vClassID, vClassInfo in pairs(GroupCalendar.ClassInfoByClassID) do
local vNewClassLimits = pNewLimits.ClassLimits[vClassID]
local vOldClassLimits = pOldLimits.ClassLimits[vClassID]
if (vNewClassLimits == nil) ~= (vOldClassLimits == nil) then
return false
end
if vNewClassLimits then
if vNewClassLimits.Min ~= vOldClassLimits.Min
or vNewClassLimits.Max ~= vOldClassLimits.Max then
return false
end
end
end
end
if pNewLimits.RoleLimits then
for vRoleCode, vRoleInfo in pairs(GroupCalendar.RolesInfoByID) do
local vNewRoleLimits = pNewLimits.RoleLimits[vRoleCode]
local vOldRoleLimits = pOldLimits.RoleLimits[vRoleCode]
if (vNewRoleLimits == nil) ~= (vOldRoleLimits == nil) then
return false
end
if vNewRoleLimits then
if vNewRoleLimits.Min ~= vOldRoleLimits.Min
or vNewRoleLimits.Max ~= vOldRoleLimits.Max
or (vNewRoleLimits.Class == nil) ~= (vOldRoleLimits.Class == nil) then
return false
end
if vNewRoleLimits.Class then
for vClassID, vClassInfo in pairs(GroupCalendar.ClassInfoByClassID) do
local vNewClassLimit = vNewRoleLimits.Class[vClassID]
local vOldClassLimit = vOldRoleLimits.Class[vClassID]
if vNewClassLimit ~= vOldClassLimit then
return false
end
end
end
end
end
end
-- Done, they're the same
return true
end
----------------------------------------
-- Classes
----------------------------------------
GroupCalendar.ClassInfoByClassID =
{
DRUID =
{
ClassCode = "D",
Roles = {"H", "T", "M", "R"},
TalentRoles = {"R", "M", "H"}, -- Balance, Feral, Restoration
DefaultRole = "M",
},
HUNTER =
{
ClassCode = "H",
Roles = {"R"},
TalentRoles = {"R", "R", "R"}, -- Beast mastery, Marksmanship, Survival
DefaultRole = "R",
},
MAGE =
{
ClassCode = "M",
Roles = {"R"},
TalentRoles = {"R", "R", "R"}, -- Frost, Arcane, Fire
DefaultRole = "R",
},
PALADIN =
{
ClassCode = "L",
Roles = {"H", "T", "M"},
TalentRoles = {"H", "T", "M"}, -- Holy, Protection, Retribution
DefaultRole = "H",
},
PRIEST =
{
ClassCode = "P",
Roles = {"H", "R"},
TalentRoles = {"H", "H", "R"}, -- Discipline, Holy, Shadow
DefaultRole = "H",
},
ROGUE =
{
ClassCode = "R",
Roles = {"M"},
TalentRoles = {"M", "M", "M"}, -- Assassination, Combat, Subtlety
DefaultRole = "M",
},
SHAMAN =
{
ClassCode = "S",
Roles = {"H", "M", "R"},
TalentRoles = {"R", "M", "H"}, -- Elemental, Enhancement, Restoration
DefaultRole = "H",
},
WARLOCK =
{
ClassCode = "K",
Roles = {"R"},
TalentRoles = {"R", "R", "R"}, -- Affliction, Demonology, Destruction
DefaultRole = "R",
},
WARRIOR =
{
ClassCode = "W",
Roles = {"T", "M"},
TalentRoles = {"M", "M", "T"}, -- Arms, Fury, Protection
DefaultRole = "T",
},
DEATHKNIGHT =
{
ClassCode = "T",
Roles = {"T", "M"},
TalentRoles = {"M", "M", "M"}, -- Blood, Frost, Unholy
DefaultRole = "M",
},
MONK =
{
ClassCode = "O",
Roles = {"T", "H", "M"},
TalentRoles = {"T", "H", "M"}, -- Brewmaster, Mistweaver, Windwalker
DefaultRole = "M",
},
DEMONHUNTER =
{
ClassCode = "N",
Roles = {"T", "M"},
TalentRoles = {"M", "T"}, -- Havoc, Vengeance
DefaultRole = "M",
},
}
GroupCalendar.ClassInfoByClassCode = {}
for vClassID, vClassInfo in pairs(GroupCalendar.ClassInfoByClassID) do
vClassInfo.ClassID = vClassID
GroupCalendar.ClassInfoByClassCode[vClassInfo.ClassCode] = vClassInfo
end
----------------------------------------
-- Roles
----------------------------------------
GroupCalendar.Roles =
{
{ID = "H", Name = GroupCalendar.cHRole, Color = RAID_CLASS_COLORS.PRIEST, ColorCode = GroupCalendar.RAID_CLASS_COLOR_CODES.PRIEST},
{ID = "T", Name = GroupCalendar.cTRole, Color = RAID_CLASS_COLORS.WARRIOR, ColorCode = GroupCalendar.RAID_CLASS_COLOR_CODES.WARRIOR},
{ID = "R", Name = GroupCalendar.cRRole, Color = RAID_CLASS_COLORS.MAGE, ColorCode = GroupCalendar.RAID_CLASS_COLOR_CODES.MAGE},
{ID = "M", Name = GroupCalendar.cMRole, Color = RAID_CLASS_COLORS.ROGUE, ColorCode = GroupCalendar.RAID_CLASS_COLOR_CODES.ROGUE},
}
-- RoleInfoByID
GroupCalendar.RoleInfoByID = {}
for vRoleIndex, vRoleInfo in pairs(GroupCalendar.Roles) do
vRoleInfo.SortOrder = vRoleIndex
vRoleInfo.Classes = {}
GroupCalendar.RoleInfoByID[vRoleInfo.ID] = vRoleInfo
end
-- Add the class list to the role infos
for vClassID, vClassInfo in pairs(GroupCalendar.ClassInfoByClassID) do
for _, vRoleCode in pairs(vClassInfo.Roles) do
GroupCalendar.RoleInfoByID[vRoleCode].Classes[vClassID] = true
end
end
|
-- Copyright (c) 2008 Mikael Lind
--
-- Permission is hereby granted, free of charge, to any person
-- obtaining a copy of this software and associated documentation
-- files (the "Software"), to deal in the Software without
-- restriction, including without limitation the rights to use,
-- copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the
-- Software is furnished to do so, subject to the following
-- conditions:
--
-- The above copyright notice and this permission notice shall be
-- included in all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-- OTHER DEALINGS IN THE SOFTWARE.
local import = require("import")
local curses = require("curses")
local Game = import("Game").Game
local actions = import("actions")
local ai = import("ai")
local ui = import("ui")
local commands = import("commands")
local directions = import("directions").directions
function sign(n)
if n < 0 then
return -1
elseif n > 0 then
return 1
else
return 0
end
end
function protected_main(win)
curses.cbreak()
curses.keypad(win, 1)
curses.noecho()
local game = Game:new()
while true do
local thing = game.queue:pop()
if thing == game.hero then
ui.update_screen(win, game)
game.message = nil
local command = ui.read_command(win)
if command == "quit" then
break
elseif command ~= nil then
commands.handle_command(command, win, game)
end
elseif thing.env then
ai.ai_action(game, thing)
end
if thing.env then
game.queue:push(thing)
end
end
end
function main()
local win = curses.initscr()
local status, result = pcall(protected_main, win)
curses.endwin()
if not status then
error(result)
end
end
main()
|
object_tangible_food_generic_drink_bantha_blaster = object_tangible_food_generic_shared_drink_bantha_blaster:new {
}
ObjectTemplates:addTemplate(object_tangible_food_generic_drink_bantha_blaster, "object/tangible/food/generic/drink_bantha_blaster.iff")
|
require "System"
System.Enum = System.ValueType:new()
|
HowToColossus = HowToColossus or {}
local HowToColossus = HowToColossus
local WM = GetWindowManager()
local COLOSSUS = 1
local HORN = 2
local MAJOR_VULNE_ID = 122397
local MAJOR_FORCE_ID = 40225
local HORN_ID = 40224
function HowToColossus.SaveColossusLoc()
HowToColossus.savedVariables.collossusAlertX = ColossusAlert:GetLeft()
HowToColossus.savedVariables.collossusAlertY = ColossusAlert:GetTop()
end
function HowToColossus.SaveHornLoc()
HowToColossus.savedVariables.hornAlertX = HornAlert:GetLeft()
HowToColossus.savedVariables.hornAlertY = HornAlert:GetTop()
end
function HowToColossus.SaveColossusWin()
HowToColossus.savedVariables.collossusWindowX = ColossusWindow:GetLeft()
HowToColossus.savedVariables.collossusWindowY = ColossusWindow:GetTop()
end
function HowToColossus.SaveHornWin()
HowToColossus.savedVariables.hornWindowX = HornWindow:GetLeft()
HowToColossus.savedVariables.hornWindowY = HornWindow:GetTop()
end
function HowToColossus.SetUIHidden(hide)
HornAlert:SetHidden(hide)
ColossusAlert:SetHidden(hide)
HornWindow:SetHidden(hide)
ColossusWindow:SetHidden(hide)
end
function HowToColossus.UpdateWindowPannel()
local rows = {}
for key, value in pairs(HowToColossus.groupUltimates) do
local segmentRow
if value.ultType == COLOSSUS and HowToColossus.showColossus then
if WM:GetControlByName("ColossusWindow_Segment", key) then
segmentRow = WM:GetControlByName("ColossusWindow_Segment", key)
else
segmentRow = WM:CreateControlFromVirtual("ColossusWindow_Segment", ColossusWindow, "ColossusWindow_Segment", key)
end
elseif value.ultType == HORN and HowToColossus.showHorn then
if WM:GetControlByName("HornWindow_Segment", key) then
segmentRow = WM:GetControlByName("HornWindow_Segment", key)
else
segmentRow = WM:CreateControlFromVirtual("HornWindow_Segment", HornWindow, "HornWindow_Segment", key)
end
end
value.segmentRow = segmentRow
segmentRow:GetNamedChild('_Name'):SetText(value.name)
segmentRow:GetNamedChild('_Value'):SetText(value.ultPercent .. "%")
if value.ultPercent >= 100 then
segmentRow:GetNamedChild('_Value'):SetColor(unpack {0, 1, 0})
elseif value.ultPercent >= 70 then
segmentRow:GetNamedChild('_Value'):SetColor(unpack {1, 1, 0})
else
segmentRow:GetNamedChild('_Value'):SetColor(unpack {1, 1, 1})
end
table.insert(rows, {key, value.ultPercent})
end
table.sort(rows, function(a, b) return a[2] > b[2] end)
for i, row in ipairs(rows) do
local player = HowToColossus.groupUltimates[row[1]]
if player.ultType == COLOSSUS and HowToColossus.showColossus then
player.segmentRow:SetAnchor(TOPLEFT, ColossusWindow, TOPLEFT, 22, i*24)
elseif player.ultType == HORN and HowToColossus.showHorn then
player.segmentRow:SetAnchor(TOPLEFT, HornWindow, TOPLEFT, 22, i*24)
end
player.segmentRow:SetHidden(false)
end
HowToColossus.SetUIHidden(false)
end
|
function on_activate(parent, ability)
local targets = parent:targets():hostile():attackable()
local targeter = parent:create_targeter(ability)
targeter:set_selection_attackable()
targeter:add_all_selectable(targets)
targeter:add_all_effectable(targets)
targeter:activate()
end
function on_target_select(parent, ability, targets)
local target = targets:first()
local cb = ability:create_callback(parent)
cb:add_target(target)
cb:set_before_attack_fn("create_parent_effect")
ability:activate(parent)
parent:anim_weapon_attack(target, cb)
game:play_sfx("sfx/swish-9")
end
function create_parent_effect(parent, ability, targets)
local target = targets:first()
local stats = parent:stats()
local effect = parent:create_effect(ability:name(), 0)
local stats = parent:stats()
local amount = 20 + stats.caster_level
effect:add_num_bonus("melee_accuracy", amount)
effect:add_num_bonus("ranged_accuracy", amount)
effect:add_num_bonus("crit_chance", 10)
effect:apply()
local duration = 0.89
local anim = parent:create_anim("teleport", duration)
anim:set_position(anim:param(parent:center_x() - 0.5),
anim:param(parent:center_y() - 1.75))
anim:set_particle_size_dist(anim:fixed_dist(2.0), anim:fixed_dist(3.0))
anim:set_color(anim:param(0.0), anim:param(0.0), anim:param(0.0), anim:param(0.9))
anim:activate()
end
|
return {
"icons/fat_medusa_weapon_mirror01",
"icons/weapon/wp_talisman05_000_001",
"icons/weapon/wp_talisman09_mob-qrich",
"icons/weapon/wp_talisman12_000_001",
"icons/weapon/wp_talisman14_000_002",
"icons/weapon/wp_talisman14_000_003",
"icons/weapon/wp_talisman14_mob-kafke-cloth-01",
"icons/weapon/wp_talisman15_000_002",
"icons/weapon/wp_talisman15_mob-kath",
"icons/weapon/wp_talisman17_mob-kath",
"icons/weapon/wp_talisman19_000_003",
"icons/weapon/wp_talisman21_mob-graf",
"icons/weapon/wp_quaro_book_weapon",
"icons/wp_talisman014_000_001",
"icons/wp_talisman015_000_001",
"icons/wp_talisman016_000_001",
"icons/wp_talisman017_000_001",
"icons/wp_talisman018_000_001",
"icons/wp_talisman019_000_001",
"icons/wp_talisman01_010_001",
"icons/wp_talisman01_010_003",
"icons/wp_talisman02_010_002",
"icons/wp_talisman03_020_001",
"icons/wp_talisman04_020_002",
"icons/wp_talisman05_020_003",
"icons/wp_talisman06_030_001",
"icons/wp_talisman07_030_003",
"icons/wp_talisman08_040_001",
"icons/wp_talisman09_040_002",
"icons/wp_talisman20_000_001",
"icons/weapon/wp_talisman18_mob-skull-rock",
"icons/weapon/wp_talisman09_mob-forlorn",
"icons/weapon/wp_talisman10_mob-forlorn",
"icons/weapon/wp_talisman02_mob-blight",
"icons/weapon/wp_talisman04_mob-blight",
"icons/weapon/wp_talisman07-mob-z36-02",
"icons/weapon/wp_talisman08-mob-z36-01",
"icons/weapon/wp_talisman12_mob-fu-01",
"icons/weapon/wp_talisman14_mob-fu-01",
"icons/weapon/wp_talisman07_z37-01",
"icons/weapon/wp_talisman17_z37-02",
"icons/weapon/wp_talisman04_z38-01",
"icons/weapon/wp_talisman20_z38-02",
}
|
-- simon.lua v1.1 -- by Tallow
--
-- Set up a list of points to click on request. Useful for paint or
-- ad-hoc macros.
--
dofile("common.inc");
askText = singleLine([[
Simon v1.1 (by Tallow) --
Sets up a list of points and then click on them in sequence.
]]);
clickList = {};
clickDelay = 150;
is_stats = true;
function getPoints()
local was_shifted = lsShiftHeld();
local is_done = false;
local mx = 0;
local my = 0;
local z = 0;
while not is_done do
mx, my = srMousePos();
local is_shifted = lsShiftHeld();
if is_shifted and not was_shifted then
clickList[#clickList + 1] = {mx, my};
end
was_shifted = is_shifted;
checkBreak();
lsPrint(10, 10, z, 1.0, 1.0, 0xFFFFFFff,
"Adding Points (" .. #clickList .. ")");
local y = 60;
lsPrint(5, y, z, 0.7, 0.7, 0xf0f0f0ff, "Tap shift to add a point.");
y = y + 30;
local start = math.max(1, #clickList - 20);
local index = 0;
for i=start,#clickList do
local xOff = (index % 3) * 100;
local yOff = (index - index%3)/2 * 15;
lsPrint(20 + xOff, y + yOff, z, 0.5, 0.5, 0xffffffff,
"(" .. clickList[i][1] .. ", " .. clickList[i][2] .. ")");
index = index + 1;
end
if lsButtonText(10, lsScreenY - 30, z, 100, 0xFFFFFFff, "Next") then
is_done = 1;
end
if lsButtonText(lsScreenX - 110, lsScreenY - 30, z, 100, 0xFFFFFFff,
"End script") then
error "Clicked End Script button";
end
lsDoFrame();
lsSleep(10);
end
end
function promptRun()
local is_done = false;
local count = 1;
while not is_done do
checkBreak();
lsPrint(10, 10, 0, 1.0, 1.0, 0xffffffff,
"Configure Sequence");
local y = 60;
lsPrint(5, y, 0, 1.0, 1.0, 0xffffffff, "Passes:");
is_done, count = lsEditBox("passes", 120, y, 0, 50, 30, 1.0, 1.0,
0x000000ff, 1);
count = tonumber(count);
if not count then
is_done = false;
lsPrint(10, y+18, 10, 0.7, 0.7, 0xFF2020ff, "MUST BE A NUMBER");
count = 1;
end
y = y + 48;
is_stats = lsCheckBox(10, y, 10, 0xffffffff, "Wait for Stats", is_stats);
y = y + 32;
if not is_stats then
lsPrint(5, y, 0, 1.0, 1.0, 0xffffffff, "Delay (ms):");
is_done, clickDelay = lsEditBox("delay", 120, y, 0, 50, 30, 1.0, 1.0,
0x000000ff, 100);
clickDelay = tonumber(clickDelay);
if not clickDelay then
is_done = false;
lsPrint(10, y+18, 10, 0.7, 0.7, 0xFF2020ff, "MUST BE A NUMBER");
clickDelay = 100;
end
end
if lsButtonText(10, lsScreenY - 30, 0, 100, 0xFFFFFFff, "Begin") then
is_done = 1;
end
if lsButtonText(lsScreenX - 110, lsScreenY - 30, 0, 100, 0xFFFFFFff,
"End script") then
error(quit_message);
end
lsSleep(50);
lsDoFrame();
end
return count;
end
function clickSequence(count)
for i=1,count do
for j=1,#clickList do
checkBreak();
safeClick(clickList[j][1], clickList[j][2]);
local message = "Pass " .. i .. "/" .. count .. " -- ";
message = message .. "Clicked " .. j .. "/" .. #clickList .. "\n";
if is_stats then
sleepWithStatus(500, message .. "Waiting between clicks");
waitForStats(message .. "Waiting For Stats");
else
sleepWithStatus(clickDelay, message .. "Waiting Fixed Delay");
end
end
end
end
function doit()
askForWindow(askText);
getPoints();
local is_done = false;
while not is_done do
local count = promptRun();
if count > 0 then
askForFocus();
clickSequence(count);
else
is_done = true;
end
end
end
function waitForStats(message)
local stats = findStats();
while not stats do
sleepWithStatus(500, message, 0xff3333ff);
stats = findStats();
end
end
function findStats()
srReadScreen();
local stats = srFindImage("AllStats-Black.png");
if not stats then
stats = srFindImage("AllStats-Black2.png");
end
if not stats then
stats = srFindImage("AllStats-Black3.png");
end
return stats;
end
|
--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
local core = require("apisix.core")
local http = require("resty.http")
local json = require("cjson")
local fetch_local_conf = require("apisix.core.config_local").local_conf
local norm_path = require("pl.path").normpath
local _M = {}
local function fetch_vault_conf()
local conf, err = fetch_local_conf()
if not conf then
return nil, "failed to fetch vault configuration from config yaml: " .. err
end
if not conf.vault then
return nil, "accessing vault data requires configuration information"
end
return conf.vault
end
local function make_request_to_vault(method, key, skip_prefix, data)
local vault, err = fetch_vault_conf()
if not vault then
return nil, err
end
local httpc = http.new()
-- config timeout or default to 5000 ms
httpc:set_timeout((vault.timeout or 5)*1000)
local req_addr = vault.host
if not skip_prefix then
req_addr = req_addr .. norm_path("/v1/"
.. vault.prefix .. "/" .. key)
else
req_addr = req_addr .. norm_path("/v1/" .. key)
end
local res, err = httpc:request_uri(req_addr, {
method = method,
headers = {
["X-Vault-Token"] = vault.token
},
body = core.json.encode(data or {}, true)
})
if not res then
return nil, err
end
return res.body
end
-- key is the vault kv engine path, joined with config yaml vault prefix.
-- It takes an extra optional boolean param skip_prefix. If enabled, it simply doesn't use the
-- prefix defined inside config yaml under vault config for fetching data.
local function get(key, skip_prefix)
core.log.info("fetching data from vault for key: ", key)
local res, err = make_request_to_vault("GET", key, skip_prefix)
if not res or err then
return nil, "failed to retrtive data from vault kv engine " .. err
end
return json.decode(res)
end
_M.get = get
-- key is the vault kv engine path, data is json key vaule pair.
-- It takes an extra optional boolean param skip_prefix. If enabled, it simply doesn't use the
-- prefix defined inside config yaml under vault config for storing data.
local function set(key, data, skip_prefix)
core.log.info("stroing data into vault for key: ", key,
"and value: ", core.json.delay_encode(data, true))
local res, err = make_request_to_vault("POST", key, skip_prefix, data)
if not res or err then
return nil, "failed to store data into vault kv engine " .. err
end
return true
end
_M.set = set
-- key is the vault kv engine path, joined with config yaml vault prefix.
-- It takes an extra optional boolean param skip_prefix. If enabled, it simply doesn't use the
-- prefix defined inside config yaml under vault config for deleting data.
local function delete(key, skip_prefix)
core.log.info("deleting data from vault for key: ", key)
local res, err = make_request_to_vault("DELETE", key, skip_prefix)
if not res or err then
return nil, "failed to delete data into vault kv engine " .. err
end
return true
end
_M.delete = delete
return _M
|
return {'amicaal','amice','amict','amigo','aminen','aminozuur','aminozuurvolgorde','amine','amin','amie','amina','amine','amir','amira','amit','amiri','amini','amier','amicale','amicaler','amices','amicten','aminozuren','amicaalst','amigos','amies','amins','aminas','amines','amirs','amiras','amits'} |
--------------------------------------------------------------------------------
--- Tools to ensure correct code behaviour
-- @module lua-nucleo.ensure
-- This file is a part of lua-nucleo library
-- @copyright lua-nucleo authors (see file `COPYRIGHT` for the license)
--------------------------------------------------------------------------------
local error, tostring, pcall, type, pairs, ipairs, select, next
= error, tostring, pcall, type, pairs, ipairs, select, next
local math_min, math_max, math_abs = math.min, math.max, math.abs
local string_char = string.char
local tdeepequals,
tstr,
taccumulate,
tnormalize
= import 'lua-nucleo/table.lua'
{
'tdeepequals',
'tstr',
'taccumulate',
'tnormalize'
}
local tifindallpermutations
= import 'lua-nucleo/table-utils.lua'
{
'tifindallpermutations'
}
local assert_is_number
= import 'lua-nucleo/typeassert.lua'
{
'assert_is_number'
}
local make_checker
= import 'lua-nucleo/checker.lua'
{
'make_checker'
}
-- TODO: Write tests for the function below
-- https://github.com/lua-nucleo/lua-nucleo/issues/13
--- @param msg
-- @param value
-- @param ...
local ensure = function(msg, value, ...)
if not value then
error(
"ensure failed: " .. msg
.. ((...) and (": " .. (tostring(...) or "?")) or ""),
2
)
end
return value, ...
end
-- TODO: Write tests for the function below
-- https://github.com/lua-nucleo/lua-nucleo/issues/13
--- @param msg
-- @param actual
-- @param expected
local ensure_equals = function(msg, actual, expected)
return
(actual ~= expected)
and error(
"ensure_equals failed: " .. msg
.. ": actual `" .. tostring(actual)
.. "', expected `" .. tostring(expected)
.. "'",
2
)
or actual -- NOTE: Should be last to allow false and nil values.
end
--- @param msg
-- @param value
-- @param expected_type
local ensure_is = function(msg, value, expected_type)
local actual = type(value)
return
(actual ~= expected_type)
and error(
"ensure_is failed: " .. msg
.. ": actual type `" .. tostring(actual)
.. "', expected type `" .. tostring(expected_type)
.. "'",
2
)
or value -- NOTE: Should be last to allow false and nil values.
end
-- TODO: Write tests for the function below
-- https://github.com/lua-nucleo/lua-nucleo/issues/13
--- @param msg
-- @param actual
-- @param expected
local ensure_tequals = function(msg, actual, expected)
if type(expected) ~= "table" then
error(
"ensure_tequals failed: " .. msg
.. ": bad expected type, must be `table', got `"
.. type(expected) .. "'",
2
)
end
if type(actual) ~= "table" then
error(
"ensure_tequals failed: " .. msg
.. ": bad actual type, expected `table', got `"
.. type(actual) .. "'",
2
)
end
-- TODO: Employ tdiff() (when it would be written)
-- TODO: Use checker to get info on all bad keys!
for k, expected_v in pairs(expected) do
local actual_v = actual[k]
if actual_v ~= expected_v then
error(
"ensure_tequals failed: " .. msg
.. ": bad actual value at key `" .. tostring(k)
.. "': got `" .. tostring(actual_v)
.. "', expected `" .. tostring(expected_v)
.. "'",
2
)
end
end
for k, actual_v in pairs(actual) do
if expected[k] == nil then
error(
"ensure_tequals failed: " .. msg
.. ": unexpected actual value at key `" .. tostring(k)
.. "': got `" .. tostring(actual_v)
.. "', should be nil",
2
)
end
end
return actual
end
--- @param msg
-- @param actual
-- @param expected
local ensure_tdeepequals = function(msg, actual, expected)
-- Heavy! Use ensure_tequals if possible
if not tdeepequals(actual, expected) then
-- TODO: Bad! Improve error reporting (use tdiff)
error(
"ensure_tdeepequals failed: " .. msg .. ":"
.. "\n actual: " .. tstr(actual)
.. "\nexpected: " .. tstr(expected),
2
)
end
end
-- TODO: ?! Improve and generalize!
local strdiff_msg
do
-- TODO: Generalize?
local string_window = function(str, pos, window_radius)
return str:sub(
math_max(1, pos - window_radius),
math_min(pos + window_radius, #str)
)
end
-- TODO: Uncomment and move to proper tests
--[=[
assert(string_window("abCde", 3, 0) == [[C]])
assert(string_window("abCde", 3, 1) == [[bCd]])
assert(string_window("abCde", 3, 2) == [[abCde]])
assert(string_window("abCde", 3, 3) == [[abCde]])
--]=]
local nl_byte = ("\n"):byte()
strdiff_msg = function(actual, expected, window_radius)
window_radius = window_radius or 10
local result = false
--print(("%q"):format(expected))
--print(("%q"):format(actual))
if type(actual) ~= "string" or type(expected) ~= "string" then
result = "(bad input)"
else
local nactual, nexpected = #actual, #expected
local len = math_min(nactual, nexpected)
local lineno, lineb = 1, 1
for i = 1, len do
local ab, eb = expected:byte(i), actual:byte(i)
--print(string_char(eb), string_char(ab))
if ab ~= eb then
-- TODO: Do not want to have \n-s here. Too low level?!
result = "different at byte " .. i .. " (line " .. lineno .. ", offset " .. lineb .. "):\n\n expected |"
.. string_window(expected, i, window_radius)
.. "|\nvs. actual |"
.. string_window(actual, i, window_radius)
.. "|\n\n"
break
end
if eb == nl_byte then
lineno, lineb = lineno + 1, 1
end
end
if nactual > nexpected then
result = (result or "different: ") .. "actual has " .. (nactual - nexpected) .. " extra characters"
elseif nactual < nexpected then
result = (result or "different:" ) .. "expected has " .. (nexpected - nactual) .. " extra characters"
end
end
return result or "(identical)"
end
end
--------------------------------------------------------------------------------
--- @param msg
-- @param actual
-- @param expected
-- @param ...
local ensure_strequals = function(msg, actual, expected, ...)
if actual == expected then
return actual, expected, ...
end
error(
"ensure_strequals: " .. msg .. ":\n"
.. strdiff_msg(actual, expected)
.. "\nactual:\n" .. tostring(actual)
.. "\nexpected:\n" .. tostring(expected)
)
end
--------------------------------------------------------------------------------
--- Checks if the `actual` string exists in the `expected` linear string array.
-- <br />
-- Returns all the arguments intact cutting the `msg` at beginning on success.
-- <br />
-- Raises the error on fail.
-- @tparam string msg Failing message that will be used in the error message if
-- the check fails.
-- @tparam string actual A string to check.
-- @tparam string[] expected The linear array table of strings.
-- @tparam any[] ... Custom arguments.
-- @raise `ensure_strvariant failed error` if unable to find the `actual` string
-- in `expected`.
-- @treturn string `actual` intact.
-- @treturn string[] `expected` intact.
-- @treturn any[] ... The rest of the arguments intact.
-- @usage
-- local ensure_strvariant
-- = import 'lua-nucleo/ensure.lua'
-- {
-- 'ensure_strvariant'
-- }
--
-- -- will pass without errors:
-- ensure_strvariant('find elem1', 'elem1', { 'elem0', 'elem1', 'elem2' })
--
-- -- will throw the error:
-- ensure_strvariant(
-- 'find the_element_that_cannot_be_found',
-- 'the_element_that_cannot_be_found',
-- { 'elem0', 'elem1', 'elem2' }
-- )
local ensure_strvariant = function(msg, actual, expected, ...)
local confirmed = false
if expected == nil then
confirmed = actual == nil
elseif type(expected) == 'string' then
confirmed = actual == expected
elseif type(expected) == 'table' then
for i = 1, #expected do
if actual == expected[i] then
confirmed = true
break
end
end
end
if confirmed then
return actual, expected, ...
end
local expected_str
if expected == nil then
expected_str = 'nil'
elseif type(expected) == 'string' then
expected_str = expected
elseif type(expected) == 'table' then
expected_str = table.concat(expected, ' or ')
else
expected_str = 'unexpected type of the expected value: ' .. type(expected)
end
error(
"ensure_strvariant failed: " .. msg .. ":\n"
.. strdiff_msg(actual, expected)
.. "\nactual:\n" .. tostring(actual)
.. "\nexpected:\n" .. expected_str
)
end
--- Checks if the `actual` string is constructed by the elements of
-- the `expected_elements_list` linear string array table. Expected that
-- elements are joined together with the `expected_sep` in between and not
-- necessarily have the same order as in the `expected_elements_list`. Also,
-- expected that the constructed list is prefixed by the `expected_prefix` and
-- terminated by the `expected_suffix`.
-- <br />
-- Returns all the arguments intact cutting the `msg` at beginning on success.
-- <br />
-- Raises the error on fail.
-- <br />
-- Best for simple long lists.
-- <br />
-- <br />
-- <b>How it works:</b> cut `expected_prefix` and `expected_suffix` from the
-- `actual` and break by `expected_sep`. Then find missing and excess elements
-- in two array traverses. Raises the error if found any.
-- @tparam string msg Failing message that will be used in the error message if
-- the check fails.
-- @tparam string actual A string to check.
-- @tparam string expected_prefix Expected prefix. Expected that the
-- `actual` must start with the `expected_prefix`.
-- @tparam string[] expected_elements_list Expected elements list. Expected that
-- `expected_elements_list` elements exist in the `actual`
-- whatever the original order from the `expected_elements_list`.
-- @tparam string expected_sep Expected separator character. Expected that this
-- separator is used to join list elements together.
-- @tparam string expected_suffix Expected suffix character. Expected that the
-- `actual` ends with the `expected_suffix`.
-- @tparam any[] ... Custom arguments.
-- @raise `ensure_strlist failed error` if the check fails.
-- @treturn string `actual` intact.
-- @treturn string `expected_prefix` intact.
-- @treturn string[] `expected_elements_list` intact.
-- @treturn string `expected_sep` intact.
-- @treturn string `expected_suffix` intact.
-- @treturn any[] ... The rest of the arguments intact.
-- @usage
-- local ensure_strlist
-- = import 'lua-nucleo/ensure.lua'
-- {
-- 'ensure_strlist'
-- }
--
-- -- will pass without errors:
-- ensure_strlist(
-- 'output check',
-- '(a,b,c,d,e)',
-- '(',
-- { 'a', 'b', 'c', 'd', 'e' },
-- ',',
-- ')'
-- )
--
-- -- will fail because the real separator is ', ':
-- -- ensure_strlist(
-- -- 'output check',
-- -- '(a, b, c, d, e)',
-- -- '(',
-- -- { 'a', 'b', 'c', 'd', 'e' },
-- -- ',',
-- -- ')'
-- -- )
--
-- -- will pass without errors:
-- ensure_strlist(
-- 'output check',
-- '1+b*c+m^2/2',
-- '',
-- { '1', 'b*c', 'm^2/2' },
-- '+',
-- ''
-- )
local ensure_strlist = function(
msg,
actual,
expected_prefix,
expected_elements_list,
expected_sep,
expected_suffix,
...
)
if #expected_prefix > 0 then
ensure_strequals(msg, actual:sub(1, #expected_prefix), expected_prefix)
end
if #expected_suffix > 0 then
ensure_strequals(msg, actual:sub(-#expected_suffix), expected_suffix)
end
local actual_joined = actual:sub(1 + #expected_prefix, -1 - #expected_suffix)
local missed_elements = { }
local excess_elements = { }
for _, elem in ipairs(expected_elements_list) do
missed_elements[elem] = true
end
for elem in actual_joined:gmatch('([^' .. expected_sep .. ']+)') do
if missed_elements[elem] then
missed_elements[elem] = nil
else
excess_elements[#excess_elements + 1] = elem
end
end
for elem, _ in pairs(missed_elements) do
error(
msg .. ': expected element is not found: ' .. tostring(elem)
)
end
for _, elem in ipairs(excess_elements) do
error(
msg .. ': excess element is found: ' .. tostring(elem)
)
end
return actual, expected_prefix, expected_elements_list, expected_sep,
expected_suffix, ...
end
--- Checks if the `actual` string is constructed by the elements of
-- the `expected_elements_list` linear string array table. Expected that
-- elements are joined together with the `expected_sep` in between and not
-- necessarily have the same order as in the `expected_elements_list`. Also,
-- expected that the constructed list is prefixed by the `expected_prefix` and
-- terminated by the `expected_suffix`.
-- <br />
-- Returns all the arguments intact cutting the `msg` at beginning on success.
-- <br />
-- Raises the error on fail.
-- <br />
-- Best for complex short lists.
-- <br />
-- <br />
-- <b>How it works:</b> `tifindallpermutations` for the `expected_elements_list`
-- then build a table array containing all possible `actual`s using
-- `expected_prefix`, `expected_sep`, `expected_suffix` for each resulted
-- permutation. The `ensure_strvariant` is invoked as
-- `ensure_strvariant(msg, actual, expected_actuals)`
-- @tparam string msg Failing message that will be used in the error message if
-- the check fails.
-- @tparam string actual A string to check.
-- @tparam string expected_prefix Expected prefix. Expected that the
-- `actual` must start with the `expected_prefix`.
-- @tparam string[] expected_elements_list Expected elements list. Expected that
-- `expected_elements_list` elements exist in the `actual`
-- whatever the original order from the `expected_elements_list`.
-- @tparam string expected_sep Expected separator. Expected that this
-- separator is used to join list elements together.
-- @tparam string expected_suffix Expected suffix / footer. Expected that the
-- `actual` ends with the `expected_suffix`.
-- @tparam any[] ... Custom arguments.
-- @raise `ensure_strpermutations failed error` if the check fails.
-- @treturn string `actual` intact.
-- @treturn string `expected_prefix` intact.
-- @treturn string[] `expected_elements_list` intact.
-- @treturn string `expected_sep` intact.
-- @treturn string `expected_suffix` intact.
-- @treturn any[] ... The rest of the arguments intact.
-- @usage
-- local ensure_strpermutations
-- = import 'lua-nucleo/ensure.lua'
-- {
-- 'ensure_strpermutations'
-- }
--
-- -- will pass without errors:
-- ensure_strlist(
-- 'output check', "('a'+'b'+'c')", "('", { 'a', 'b', 'c' }) "'+'", "')"
-- )
-- ensure_strlist(
-- 'output check', "('a'+'c'+'b')", "('", { 'a', 'b', 'c' }) "'+'", "')"
-- )
-- ensure_strlist(
-- 'output check', "('c'+'a'+'b')", "('", { 'a', 'b', 'c' }) "'+'", "')"
-- )
-- ensure_strlist(
-- 'output check', "('b'+'a'+'c')", "('", { 'a', 'b', 'c' }) "'+'", "')"
-- )
-- ensure_strlist(
-- 'output check', "('b'+'c'+'a')", "('", { 'a', 'b', 'c' }) "'+'", "')"
-- )
--
-- -- wrong separator:
-- -- ensure_strlist(
-- -- 'output check', "('a'+'b'+'c')", "('", { 'a', 'b', 'c' }) "' + '", "')"
-- -- )
--
-- -- wrong prefix:
-- -- ensure_strlist(
-- -- 'output check', "['a'+'b'+'c')", "('", { 'a', 'b', 'c' }) "'+'", "')"
-- -- )
--
-- -- wrong suffix:
-- -- ensure_strlist(
-- -- 'output check', "('a'+'b'+'c')", "('", { 'a', 'b', 'c' }) "'+'", "');"
-- -- )
--
-- -- missing elements:
-- -- ensure_strlist(
-- -- 'output check', "('a'+'b')", "('", { 'a', 'b', 'c' }) "'+'", "');"
-- -- )
--
-- -- excess elements:
-- -- ensure_strlist(
-- -- 'output check', "('a'+'b'+'c')", "('", { 'a', 'b' }) "'+'", "');"
-- -- )
local ensure_strpermutations = function(
msg,
actual,
expected_prefix,
expected_elements_list,
expected_sep,
expected_suffix,
...
)
local expected_elements_list_permutations = { }
tifindallpermutations(
expected_elements_list, expected_elements_list_permutations
)
local expected_variants = { }
for i = 1, #expected_elements_list_permutations do
local p = expected_elements_list_permutations[i]
local expected = expected_prefix
for j = 1, #p do
if j > 1 then
expected = expected .. expected_sep
end
expected = expected .. tostring(p[j])
end
expected = expected .. expected_suffix
expected_variants[#expected_variants + 1] = expected
end
return ensure_strvariant(msg, actual, expected_variants)
end
--------------------------------------------------------------------------------
--- @param msg
-- @param expected_message
-- @param res
-- @param actual_message
-- @param ...local ensure_error = function(msg, expected_message, res, actual_message, ...)
local ensure_error = function(msg, expected_message, res, actual_message, ...)
if res ~= nil then
error(
"ensure_error failed: " .. msg
.. ": failure expected, got non-nil result: `" .. tostring(res) .. "'",
2
)
end
-- TODO: Improve error reporting
ensure_strequals(msg, actual_message, expected_message)
end
--------------------------------------------------------------------------------
--- @param msg
-- @param substring
-- @param res
-- @param err
local ensure_error_with_substring = function(msg, substring, res, err)
if res ~= nil then
error(
"ensure_error_with_substring failed: " .. msg
.. ": failure expected, got non-nil result: `" .. tostring(res) .. "'",
2
)
end
if
substring ~= err and
not err:find(substring, nil, true) and
not err:find(substring)
then
error(
"ensure_error_with_substring failed: " .. msg
.. ": can't find expected substring `" .. tostring(substring)
.. "' in error message:\n" .. err
)
end
end
--------------------------------------------------------------------------------
--- @param msg
-- @param fn
-- @param substring
local ensure_fails_with_substring = function(msg, fn, substring)
local res, err = pcall(fn)
if res ~= false then
error("ensure_fails_with_substring failed: " .. msg .. ": call was expected to fail, but did not")
end
if type(err) ~= "string" then
error("ensure_fails_with_substring failed: " .. msg .. ": call failed with non-string error")
end
if
substring ~= err and
not err:find(substring, nil, true) and
not err:find(substring)
then
error(
"ensure_fails_with_substring failed: " .. msg
.. ": can't find expected substring `" .. tostring(substring)
.. "' in error message:\n" .. err
)
end
end
--------------------------------------------------------------------------------
--- @param msg
-- @param str
-- @param substring
local ensure_has_substring = function(msg, str, substring)
if type(str) ~= "string" then
error(
"ensure_has_substring failed: " .. msg .. ": value is not a string",
2
)
end
ensure(
'ensure_has_substring failed: ' .. msg
.. ": can't find expected substring `" .. tostring(substring)
.. "' in string: `" .. str .. "'",
(str == substring)
or str:find(substring, nil, true)
or str:find(substring)
)
return str
end
--------------------------------------------------------------------------------
--- We want 99.9% probability of success
-- Would not work for high-contrast weights. Use for tests only.
-- @param num_runs
-- @param weights
-- @param stats
-- @param max_acceptable_diff
local ensure_aposteriori_probability = function(num_runs, weights, stats, max_acceptable_diff)
ensure_equals("total sum check", taccumulate(stats), num_runs)
local apriori_probs = tnormalize(weights)
local aposteriori_probs = tnormalize(stats)
for k, apriori in pairs(apriori_probs) do
local aposteriori = assert_is_number(aposteriori_probs[k])
ensure("apriori must be positive", apriori > 0)
ensure("aposteriori must be non-negative", aposteriori >= 0)
-- TODO: Lame check. Improve it.
local diff = math_abs(apriori - aposteriori) / apriori
if diff > max_acceptable_diff then
error(
"inacceptable apriori-aposteriori difference key: `" .. tostring(k) .. "'"
.. " num_runs: " .. num_runs
.. " apriori: " .. apriori
.. " aposteriori: " .. aposteriori
.. " actual_diff: " .. diff
.. " max_diff: " .. max_acceptable_diff
)
end
aposteriori_probs[k] = nil -- To check there is no extra data below.
end
ensure_equals("no extra data", next(aposteriori_probs), nil)
end
--- @param msg
-- @param num
-- @param expected
-- @param ...
local ensure_returns = function(msg, num, expected, ...)
local checker = make_checker()
-- Explicit check to separate no-return-values from all-nils
local actual_num = select("#", ...)
if num ~= actual_num then
checker:fail(
"return value count mismatch: expected "
.. num .. " actual " .. actual_num
)
end
for i = 1, math_max(num, actual_num) do
if not tdeepequals(expected[i], (select(i, ...))) then
-- TODO: Enhance error reporting (especially for tables and long strings)
checker:fail(
"return value #" .. i .. " mismatch: "
.. "actual `" .. tstr((select(i, ...)))
.. "', expected `" .. tstr(expected[i])
.. "'"
)
end
end
if not checker:good() then
error(
checker:msg(
"return values check failed: " .. msg .. "\n -- ",
"\n -- "
),
2
)
end
return ...
end
return
{
ensure = ensure;
ensure_equals = ensure_equals;
ensure_is = ensure_is;
ensure_tequals = ensure_tequals;
ensure_tdeepequals = ensure_tdeepequals;
ensure_strequals = ensure_strequals;
ensure_strvariant = ensure_strvariant;
ensure_strlist = ensure_strlist;
ensure_strpermutations = ensure_strpermutations;
ensure_error = ensure_error;
ensure_error_with_substring = ensure_error_with_substring;
ensure_fails_with_substring = ensure_fails_with_substring;
ensure_has_substring = ensure_has_substring;
ensure_aposteriori_probability = ensure_aposteriori_probability;
ensure_returns = ensure_returns;
}
|
-- This tests the 'text_path' and 'glyph_path' methods. The output image
-- shows the outlines of some text, with the paths filled and then stroked
-- in a different colour.
--
-- The first line of text uses 'text_path' to get a path for a string, but
-- also uses a custom matrix transformation to get an unusual backwards
-- oblique effect.
--
-- The second line of text uses 'glyph_path', so each glyph is individually
-- positioned and selected by glyph ID instead of Unicode character.
local Cairo = require "oocairo"
local FONT_NAME, FONT_SIZE = "Sans", 200
local IMG_WD, IMG_HT = 350, 370
local function draw_outline_of_path (cr)
-- Draw actual path, with curves in tact, in black.
cr:set_source_rgb(0.8, 0.5, 0.8)
cr:fill_preserve()
cr:set_source_rgb(0, 0, 0)
cr:set_line_width(4)
cr:stroke()
end
local surface = Cairo.image_surface_create("rgb24", IMG_WD, IMG_HT)
local cr = Cairo.context_create(surface)
-- White background.
cr:set_source_rgb(1, 1, 1)
cr:paint()
cr:select_font_face(FONT_NAME)
cr:set_font_size(FONT_SIZE)
-- Just for fun, adjust the matrix to do a shear transform on the font,
-- creating a kind of backwards oblique effect.
cr:save()
local mat = cr:get_font_matrix()
mat[3] = 60
cr:set_font_matrix(mat)
local x, y = 45, 165
cr:move_to(x, y)
cr:text_path("foo")
draw_outline_of_path(cr)
cr:restore() -- restore normal font matrix, disabling shearing
-- The exact glyph numbers will depend on the font. This is intended to
-- spell out 'bar', but the actual glyphs you get might be different.
x, y = 5, 335
cr:glyph_path({ {69,x,y}, {68,x+150,y+20}, {85,x+245,y-20} })
draw_outline_of_path(cr)
surface:write_to_png("text-path.png")
-- vi:ts=4 sw=4 expandtab
|
local runService = game:GetService("RunService")
-- Used to create a tunnel between client and server
local src = script.Parent.Parent
local packages = src.Parent
local maidConstructor = require(packages:WaitForChild("maid"))
local class = {}
local fusion = script.Parent.Parent
local Abstract = require(script.Parent:WaitForChild("Abstract"))
local Types = require(fusion.Types)
local useDependency = require(fusion.Dependencies.useDependency)
local initDependency = require(fusion.Dependencies.initDependency)
local updateAll = require(fusion.Dependencies.updateAll)
class.__index = class
setmetatable(class, Abstract)
--[[
Returns the value currently stored in this State object.
The state object will be registered as a dependency unless `asDependency` is
false.
]]
function class:Get(asDependency: boolean?): any
if asDependency ~= false then
useDependency(self)
end
if type(self._value) == "table" and self._value.Get ~= nil then
return self._value:Get()
else
return self._value
end
end
--[[
Updates the value stored in this State object.
If `force` is enabled, this will skip equality checks and always update the
state object and any dependents - use this with care as this can lead to
unnecessary updates.
]]
function class:Set(newValue: any, force: boolean?)
-- if the value hasn't changed, no need to perform extra work here
if self._value == newValue and not force then
return
end
self:_SetValue(newValue)
-- update any derived state objects if necessary
updateAll(self)
end
function class:Ping()
local event = self.getRemoteEvent(self._transmitName..tostring(self._transmitId or ""))
if runService:IsClient() then
event:FireServer()
else
event:FireClient(self._player)
end
end
local function Receiver<T>(name: string, id: string | nil, lockedPlayer: Player | nil): Types.State<T>
local self = Abstract.new("Receiver", nil)
setmetatable(self, class)
self._transmitName = name
self._transmitId = id
self._transmitPlayer = lockedPlayer
local event = self.getRemoteEvent(self._transmitName..tostring(self._transmitId or ""))
if runService:IsClient() then
self._Maid:GiveTask(event.OnClientEvent:Connect(function(newVal)
self:Set(newVal)
end))
else
self._Maid:GiveTask(event.OnServerEvent:Connect(function(plr, newVal)
if self._player == nil or self._player == plr then
self:Set(newVal)
end
end))
end
initDependency(self)
self:Ping()
return self
end
return Receiver
|
-- gitgutter highlights
local lush = require("lush")
local base = require("lush_jsx.base")
local M = {}
M = lush(function()
return {
-- git-gutter
GitGutterAdd {base.LushJSXGreenSign},
GitGutterChange {base.LushJSXAquaSign},
GitGutterDelete {base.LushJSXRedSign},
GitGutterChangeDelete {base.LushJSXAquaSign},
}
end)
return M
|
function onCreate()
-- background shit
makeLuaSprite('HTFunkersBG', 'HTFunkersBG', -600, -40);
addLuaSprite('HTFunkersBG', false);
makeAnimatedLuaSprite('Russel And Flaky','Russel And Flaky',-570,440)
addAnimationByPrefix('Russel And Flaky','dance','Russel And Flaky bop' ,24,true)
addLuaSprite('Russel And Flaky', 'dance', 'Russel And Flaky bop', true)
objectPlayAnimation('Russel And Flaky','dance' ,false)
scaleObject('Russel And Flaky',0.4,0.36)
-- sprites that only load if Low Quality is turned off
addLuaSprite('Russel And Flaky', false);
addLuaSprite('HTFunkersBG', false);
close(true); --For performance reasons, close this script once the stage is fully loaded, as this script won't be used anymore after loading the stage
end |
if vim.g.loaded_markdown_tools == 1 then
return
end
vim.api.nvim_exec("command! MarkdownImagePaste lua require'markdown_image_paste.modules'.MarkdownImagePaste()", true)
vim.api.nvim_exec("command! MarkdownImageDelete lua require'markdown_image_paste.modules'.MarkdownImageDelete()", true)
vim.api.nvim_exec("command! MarkdownGenPdf lua require'markdown_gen_doc.modules'.MarkdownGenPdf()", true)
vim.api.nvim_exec("command! TexImagePaste lua require'markdown_image_paste.modules'.TexImagePaste()", true)
vim.api.nvim_exec("command! TexImageDelete lua require'markdown_image_paste.modules'.TexImageDelete()", true)
vim.g.loaded_markdown_tools = 1
|
local Enum = require("api.Enum")
local Gui = require("api.Gui")
local MapEdit = {}
function MapEdit.start()
local MapEditLayer = require("mod.elona.api.gui.MapEditLayer")
Gui.mes_newline()
Gui.mes("building.home.design.help")
MapEditLayer:new():query()
end
function MapEdit.is_tile_selectable(tile)
local tile_data = data["base.map_tile"]:ensure(tile)
if tile_data.disable_in_map_edit then
return false
end
if tile_data.elona_atlas == 0 or tile_data.elona_atlas == 2 then
-- TODO support world map editing
return false
end
if tile_data.wall_kind == 1 then
return false
end
if tile_data.kind == Enum.TileRole.Crop or tile_data.kind == Enum.TileRole.Dryground then
return false
end
return true
end
function MapEdit.calc_selectable_tiles()
local list = data["base.map_tile"]:iter()
:filter(function(t) return MapEdit.is_tile_selectable(t._id) end)
:to_list()
table.sort(list, function(a, b) return (a.elona_id or -1) < (b.elona_id or -1) end)
return fun.iter(list):extract("_id"):to_list()
end
return MapEdit
|
--
-- Copyright (c) 2018 Milos Tosic. All rights reserved.
-- License: http://www.opensource.org/licenses/BSD-2-Clause
--
-- https://github.com/bkaradzic/bgfx
local params = { ... }
local BGFX_ROOT = params[1]
local BGFX_INCLUDE = {
BGFX_ROOT .. "include",
BGFX_ROOT .. "3rdparty",
BGFX_ROOT .. "3rdparty/khronos",
BGFX_ROOT .. "3rdparty/dxsdk/include",
find3rdPartyProject("bx") .. "include",
find3rdPartyProject("bimg") .. "include"
}
local BFGX_FILES = {
BGFX_ROOT .. "src/amalgamated.cpp",
BGFX_ROOT .. "include/**.h"
}
function projectDependencies_bgfx()
local dependencies = { "bx", "bimg" }
if (getTargetOS() == "linux" or getTargetOS() == "freebsd") then
table.insert(dependencies, "X11")
table.insert(dependencies, "GL")
end
if _OPTIONS["with-glfw"] then
table.insert(dependencies, "GL")
end
return dependencies
end
function projectExtraConfigExecutable_bgfx()
if _OPTIONS["with-glfw"] then
links {
"glfw3"
}
configuration { "linux or freebsd" }
links {
"Xrandr",
"Xinerama",
"Xi",
"Xxf86vm",
"Xcursor",
}
configuration { "osx" }
linkoptions {
"-framework CoreVideo",
"-framework IOKit",
}
configuration {}
end
configuration { "vs20* or mingw*", "not orbis", "not durango", "not winphone*", "not winstore*" }
links {
"gdi32",
"psapi",
}
configuration { "winphone8* or winstore8*" }
removelinks {
"DelayImp",
"gdi32",
"psapi"
}
links {
"d3d11",
"dxgi"
}
linkoptions {
"/ignore:4264" -- LNK4264: archiving object file compiled with /ZW into a static library; note that when authoring Windows Runtime types it is not recommended to link with a static library that contains Windows Runtime metadata
}
configuration { "android*" }
linkoptions {
"-shared",
}
links {
"EGL",
"GLESv2",
}
configuration { "linux-* or freebsd" }
links {
"pthread",
}
configuration { "rpi" }
links {
-- "EGL",
"bcm_host",
"vcos",
"vchiq_arm",
"pthread",
}
configuration { "osx" }
linkoptions {
"-framework CoreFoundation",
"-framework Cocoa",
"-framework QuartzCore",
"-framework OpenGL",
"-weak_framework Metal",
"-weak_framework MetalKit",
}
configuration { "ios*" }
kind "ConsoleApp"
linkoptions {
"-framework CoreFoundation",
"-framework Foundation",
"-framework OpenGLES",
"-framework UIKit",
"-framework QuartzCore",
}
if getTargetOS() == "ios" then
configuration { "xcode4", "ios" }
kind "WindowedApp"
end
configuration {}
end
function projectExtraConfig_bgfx()
includedirs { BGFX_INCLUDE }
defines { BGFX_DEFINES }
end
function projectAdd_bgfx()
local BGFX_DEFINES = {}
if _OPTIONS["with-glfw"] then
BGFX_DEFINES = { "BGFX_CONFIG_MULTITHREADED=0" }
end
if isAppleTarget() then
table.insert(BFGX_FILES, BGFX_ROOT .. "src/amalgamated.mm")
end
addProject_3rdParty_lib("bgfx", BFGX_FILES)
end
|
SILE.registerCommand("alt", function(o, c)
local options = {}
for i=1,#c do
SILE.call("hbox", {}, {c[i]})
options[#options + 1] = SILE.typesetter.state.nodes[#SILE.typesetter.state.nodes]
SILE.typesetter.state.nodes[#SILE.typesetter.state.nodes] = nil
end
alt = SILE.nodefactory.newAlternative({
options=options,
selected=1
})
alt.width=nil
SILE.typesetter.state.nodes[#SILE.typesetter.state.nodes+1] = alt
end) |
wrk.method = "POST"
wrk.body = "name=test&content=hello"
wrk.headers["Content-Type"] = "application/x-www-form-urlencoded"
wrk.headers["Cookie"] = "user=admin"
cnt = 0
errs = 0
request = function ()
body = "name=test&content=hello" .. tostring(cnt)
cnt = cnt + 1
-- io.write("req " .. body .. "\n")
return wrk.format(nil, "/edit_page", nil, body)
end
response = function (status, headers, body)
-- out = ""
-- for k, v in pairs(headers) do
-- out = out .. k .. " -> " .. v .. "\n"
-- end
-- io.write(out)
if string.find(headers["location"], "failed") then
errs = errs + 1
io.write(string.format("error %d/%d\n", errs, cnt))
end
end
done = function(summary, latency, requests)
io.write(string.format("%d/%d failed\n", errs, summary.requests))
end
|
-- repl.lua
i = dfselct("OUT"); -- get element count for port "OUT"
value, IPaddr, size, type = dfsrecv("IN")
while value == 0 do
string = dfsderef(IPaddr)
for j = 0, i - 1 do
value, IPaddr2 = dfscrep(string)
--myprint(IPaddr2)
value = dfssend("OUT["..j.."]", IPaddr2)
end
--myprint(IPaddr)
value = dfsdrop(IPaddr)
value, IPaddr, size, type = dfsrecv("IN")
end
return 0 |
includeFile("tatooine/tatooine_world_boss/custom_jawa_boss.lua")
includeFile("tatooine/tatooine_world_boss/custom_jawa_bodyguard.lua")
includeFile("tatooine/tatooine_world_boss/custom_krayt_queen.lua")
|
object_mobile_dressed_valarian_thug_gran = object_mobile_shared_dressed_valarian_thug_gran:new {
}
ObjectTemplates:addTemplate(object_mobile_dressed_valarian_thug_gran, "object/mobile/dressed_valarian_thug_gran.iff")
|
local plstring = require("pl.stringx")
local _M = {}
_M.format = string.format
_M.lower = string.lower
_M.upper = string.upper
_M.find = string.find
_M.split = plstring.split
_M.replace = plstring.replace
return _M
|
local g = vim.g
g.db_ui_use_nerd_fonts = 1
|
local tostring = tostring
local string = require "string"
local table = require "table"
local export = { }
function export.required (selector)
local format = "Selector [%s] is required but not implemented!"
return string.format (format, tostring (selector))
end
function export.conflict (selector)
local format = "A conflict arises on object's selector [%s]!"
return string.format (format, tostring (selector))
end
function export.violation (selector)
local format = table.concat ({
"Violation of contract by applied talent!",
"Selector [%s] is not required neither provided."
}, " ")
return string.format (format, tostring (selector))
end
return export
-- END --
|
if submode ~= "maps" then
eventGameStart()
end |
----------------------------- 以下为 UI代码 不可修改 -----------------------------------
---@type Framework.UI.Prefab
local super = require("Framework.UI.Prefab")
---@class Examples.04_Button.UI_04:Framework.UI.Prefab
---@field m_Button Framework.UI.Button
---@field m_Text Framework.UI.TextField
UI_04 = class("Examples.04_Button.UI_04", super)
function UI_04:ctor(autoBind)
super.ctor(self)
self.m_Button = Button.New()
self:InsertChild(self.m_Button)
self.m_Text = TextField.New()
self:InsertChild(self.m_Text)
if autoBind ~= false then
self:bindExtend()
end
end
function UI_04:GetAssetPath()
return "Assets/UI/Prefab/Example/UI_04.prefab"
end
----------------------------- 以下为 逻辑代码 可以修改 -----------------------------------
return UI_04
|
-- Stone Monster by PilzAdam
mobs:register_mob("mobs:stone_monster", {
-- animal, monster, npc, barbarian
type = "monster",
-- aggressive, deals 8 damage to player when hit
passive = false,
attack_type = "dogfight",
pathfinding = false,
reach = 2,
damage = 4,
-- health & armor
hp_min = 20,
hp_max = 25,
armor = 80,
-- textures and model
collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
visual = "mesh",
mesh = "mobs_stone_monster.b3d",
textures = {
{"mobs_stone_monster.png"},
{"mobs_stone_monster2.png"}, -- by AMMOnym
},
blood_texture = "default_stone.png",
-- sounds
makes_footstep_sound = true,
sounds = {
random = "mobs_stonemonster",
attack = "mobs_stonemonster_attack",
},
-- speed and jump, sinks in water
walk_velocity = 1,
run_velocity = 3,
jump = true,
floats = 0,
view_range = 16,
-- chance of dropping torch, iron lump, coal lump and/or silver coins
drops = {
{name = "default:torch",
chance = 10, min = 3, max = 5,},
{name = "default:iron_lump", chance = 5, min = 1, max = 2,},
{name = "default:coal_lump", chance = 3, min = 1, max = 3,},
{name = "maptools:silver_coin", chance = 1, min = 1, max = 1,},
},
-- damaged by
water_damage = 0,
lava_damage = 0,
light_damage = 0,
-- model animation
animation = {
speed_normal = 15,
speed_run = 15,
stand_start = 0,
stand_end = 14,
walk_start = 15,
walk_end = 38,
run_start = 40,
run_end = 63,
punch_start = 40,
punch_end = 63,
},
})
-- spawns on stone between -1 and 5 light, 1 in 9000 chance, 1 in area below -25
mobs:spawn_specific("mobs:stone_monster", {"default:stone", "default:desert_stone"}, {"air"}, -1, 5, 30, 9000, 1, -31000, -25, false)
-- register spawn egg
mobs:register_egg("mobs:stone_monster", "Stone Monster", "mobs_stone_monster_inv.png", 1)
minetest.register_craft({
output = "mobs:stone_monster",
recipe = {
{"default:stone", "default:stone", "default:stone"},
{"default:stone", "default:nyancat_rainbow", "default:stone"},
{"default:stone", "default:stone", "default:stone"}
}
})
|
---
-- @author wesen
-- @copyright 2020 wesen <[email protected]>
-- @release 0.1
-- @license MIT
--
local Object = require "classic"
---
-- Provides the template data for Total coverage data objects.
--
-- @type Total
--
local Total = Object:extend()
---
-- The raw Total coverage data
--
-- @tfield CoverageData.Total totalCoverageData
--
Total.totalCoverageData = nil
---
-- Total constructor.
--
-- @tparam CoverageData.Total _totalCoverageData The raw Total coverage data
--
function Total:new(_totalCoverageData)
self.totalCoverageData = _totalCoverageData
end
-- Public Methods
---
-- Generates and returns a regular table that contains all template values that are required to
-- visualize the raw Total coverage data.
--
-- @treturn table The template values
--
function Total:toTemplateValues()
return {
-- Base
startTimestamp = self:getFormattedStartTimestamp()
}
end
---
-- Returns the formatted start timestamp.
--
-- @treturn string The formatted start timestamp
--
function Total:getFormattedStartTimestamp()
return os.date("%Y-%m-%d %H:%M:%S", self.totalCoverageData:getStartTimestamp())
end
return Total
|
--[[
Utility functions
Copyright (C) 2016 Kui Jia
All rights reserved.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.
--]]
local M = {}
function M.dataPreProcessing_CIFAR(trnData, testData)
-- trnData, testData is of the BypeTensor type
-- trnData of the size 50000 x 3 x 32 x 32, testData of the size 10000 x 3 x 32 x 32
trnData = trnData:float()
testData = testData:float()
local numTrain, dim, height, width = trnData:size(1), trnData:size(2), trnData:size(3), trnData:size(4)
local numTest = testData:size(1)
-- remove data mean (across samples)
local dataMean = torch.mean(trnData, 1)
trnData:add(-1, dataMean:expand(numTrain, dim, height, width))
testData:add(-1, dataMean:expand(numTest, dim, height, width))
-- normalize by image mean and std as suggested in "An Analysis of Single-Layer Networks in Unsupervised Feature Learning", Adam Coates, Honglak Lee, Andrew Y. Ng
local contrastNormalizationFlag = true
if contrastNormalizationFlag then
local num, z, n, dim, data
data = torch.cat(trnData, testData, 1)
z = data:view(data:size(1),-1)
z:add(-1, torch.mean(z, 2):expand(z:size(1), z:size(2)))
num, dim = z:size(1), z:size(2)
n = torch.std(z, 2):expand(num, dim)
z:cmul(torch.cdiv(torch.mean(n, 1):expand(num, dim), torch.clamp(n, 40, 1e100)))
data = z:view(-1, 3, height, width)
-- extract training and test data
trnData = data:sub(1,trnData:size(1), 1,3, 1,32, 1,32)
testData = data:sub(trnData:size(1)+1,trnData:size(1)+testData:size(1), 1,3, 1,32, 1,32)
data = nil
end
local whitenDataFlag = true
if whitenDataFlag then
local z, num, dim, W, V, E, mid, en
z = trnData:view(trnData:size(1),-1)
num, dim = z:size(1), z:size(2)
W = z:t() * z / z:size(1)
E, V = torch.symeig(W, 'V') -- vector E contains eigenvalues, and matrix V contains eigenvectors
-- the scale is selected to approximately preserve the norm of W
en = torch.Tensor(1,1):fill(torch.sqrt(torch.mean(E)))
en = en:float()
mid = V * torch.diag(torch.squeeze(torch.cdiv(en:expand(E:size(1),1), torch.clamp(torch.sqrt(torch.abs(E)), 10, 1e100)))) * V:t()
z = z * mid
trnData = z:view(-1, 3, height, width) --for trnData
z = testData:view(testData:size(1),-1)
z = z * mid
testData = z:view(-1, 3, height, width) --for testData
end
return trnData, testData
end
function M.writeErrsToFile(fpath, epoch, top1Err, top5Err, mode)
-- mode ~ 'train' | 'val' | 'best' | 'final'
local file
if paths.filep(fpath) then
file = io.open(fpath, 'a') -- append
else
file = io.open(fpath, 'w') -- create a new one
end
if mode == 'train' then
file:write(string.format('Training-Epoch:%d top1:%7.3f top5:%7.3f\n', epoch, top1Err, top5Err))
elseif mode == 'val' then
file:write(string.format(' Testing-Epoch:%d top1:%7.3f top5:%7.3f\n', epoch, top1Err, top5Err))
elseif mode == 'best' then
file:write(string.format(' Best so far | top1:%7.3f top5:%7.3f |\n',
top1Err, top5Err))
elseif mode == 'final' then
file:write(string.format('----- The final best result | top1:%7.3f top5:%7.3f | -----\n', top1Err, top5Err))
else
error('The mode of writing erros to file must be either train, val, best, or final!')
end
file:close()
end
function M.writeSingularValueToFile(fpath, SVs)
-- mode ~ 'train' | 'val' | 'best' | 'final'
local file
if paths.filep(fpath) then
file = io.open(fpath, 'a') -- append
else
file = io.open(fpath, 'w') -- create a new one
end
file:write(string.format('Layer: '))
for idx = 1, SVs:size(1), 1 do
file:write(string.format('%7.4f ', SVs[idx]))
end
file:write(string.format('\n'))
file:close()
end
return M |
object_mobile_tyrok = object_mobile_shared_tyrok:new {
}
ObjectTemplates:addTemplate(object_mobile_tyrok, "object/mobile/tyrok.iff")
|
--control.lua
script.on_event(defines.events.on_built_entity, function(e)
on_drop_car(e)
end)
script.on_event(defines.events.on_player_driving_changed_state, function(x)
on_exit_car(x)
end)
function on_drop_car(e)
if e.created_entity.name == "car" then
local player = game.players[e.player_index]
--put the player in the car
e.created_entity.set_driver(player)
--Grab fuel from the player inventory and insert it into the car
if player.get_item_count("nuclear-fuel") > 0 then
if player.get_item_count("nuclear-fuel")>= 50 then
e.created_entity.insert{name="nuclear-fuel", count = 50}
player.remove_item{name = "nuclear-fuel", count = 50}
else
e.created_entity.insert{name="nuclear-fuel", count = player.get_item_count("nuclear-fuel")}
player.remove_item{name = "nuclear-fuel", count = player.get_item_count("nuclear-fuel")}
end
elseif player.get_item_count("rocket-fuel") > 0 then
if player.get_item_count("rocket-fuel")>= 50 then
e.created_entity.insert{name="rocket-fuel", count = 50}
player.remove_item{name = "rocket-fuel", count = 50}
else
e.created_entity.insert{name="rocket-fuel", count = player.get_item_count("rocket-fuel")}
player.remove_item{name = "rocket-fuel", count = player.get_item_count("rocket-fuel")}
end
elseif player.get_item_count("solid-fuel") > 0 then
if player.get_item_count("solid-fuel")>= 50 then
e.created_entity.insert{name="solid-fuel", count = 50}
player.remove_item{name = "solid-fuel", count = 50}
else
e.created_entity.insert{name="solid-fuel", count = player.get_item_count("solid-fuel")}
player.remove_item{name = "solid-fuel", count = player.get_item_count("solid-fuel")}
end
elseif player.get_item_count("coal") > 0 then
if player.get_item_count("coal")>= 50 then
e.created_entity.insert{name="coal", count = 50}
player.remove_item{name = "coal", count = 50}
else
e.created_entity.insert{name="coal", count = player.get_item_count("coal")}
player.remove_item{name = "coal", count = player.get_item_count("coal")}
end
elseif player.get_item_count("wood") > 0 then
if player.get_item_count("wood")>= 50 then
e.created_entity.insert{name="wood", count = 50}
player.remove_item{name = "wood", count = 50}
else
e.created_entity.insert{name="wood", count = player.get_item_count("wood")}
player.remove_item{name = "wood", count = player.get_item_count("wood")}
end
else
game.print("No fuel in player inventory")
end
end
end
function on_exit_car(x)
if x.entity.get_driver() == nil and x.entity.get_passenger() == nil and x.entity.name == "car" then
local player = game.players[x.player_index]
--give the player a replacement car
player.insert{name="car", count = 1}
--Get all the stuff out of the car
local storageDic = x.entity.get_inventory(defines.inventory.car_trunk).get_contents()
local ammoDic = x.entity.get_inventory(defines.inventory.car_trunk).get_contents()
local fuelDic = x.entity.get_fuel_inventory().get_contents()
for key,val in pairs(fuelDic) do
player.insert{name = key, count = fuelDic[key]}
end
for key,val in pairs(storageDic) do
player.insert{name = key, count = storageDic[key]}
end
for key,val in pairs(ammoDic) do
player.insert{name = key, count = ammoDic[key]}
end
--destroy the car and everything in it
x.entity.destroy()
end
end |
slot0 = class("ChargeAwardPage", import("...base.BaseActivityPage"))
slot0.OnInit = function (slot0)
slot0.bg = slot0:findTF("bg")
slot0.charge = slot0:findTF("charge")
slot0.take = slot0:findTF("take")
slot0.finish = slot0:findTF("finish")
end
slot0.OnDataSetting = function (slot0)
return
end
slot0.OnFirstFlush = function (slot0)
onButton(slot0, slot0.charge, function ()
slot0:emit(ActivityMediator.EVENT_GO_SCENE, SCENE.CHARGE, {
wrap = ChargeScene.TYPE_DIAMOND
})
end)
onButton(slot0, slot0.take, function ()
slot0:emit(ActivityMediator.EVENT_OPERATION, {
cmd = 1,
activity_id = slot0.activity.id
})
end)
end
slot0.OnUpdateFlush = function (slot0)
setActive(slot0.charge, slot0.activity.data2 == 0 and slot0.activity.data1 == 0)
setButtonEnabled(slot0.take, slot0.activity.data2 == 0)
setActive(slot0.take, slot0.activity.data1 > 0)
setActive(slot0.finish, slot0.activity.data2 == 1)
end
slot0.OnDestroy = function (slot0)
clearImageSprite(slot0.bg)
end
return slot0
|
local blip, endblip
local jobstate = 0
local route = 0
local oldroute = -1
local marker, endmarker
local routescompleted = 0
local deliveryStopTimer = nil
local wage = 0
routes = {
{ 1615.5283203125, -1614.431640625, 12.10223865509 },
{ 1476.5732421875, -1735.2548828125, 11.943592071533 },
{ 1360.8798828125, -1284.318359375, 11.949401855469 },
{ 1192.7392578125, -1333.7568359375, 12.945232391357 },
{ 1019.5927734375, -928.279296875, 42.1796875 }, --northern gas station
{ 1027, -1364.4248046875, 12.138906478882 },
{ 649.2734375, -1467.0302734375, 13.317453384399 },
{ 786.884765625, -1612.86328125, 11.937650680542 },
{ 815.9462890625, -1392.9716796875, 12.95408821106 },
{ 1826.69140625, -1845.1533203125, 13.578125 },
{ 2400.4296875, -1486.8359375, 23.828125 },
{ 2148.263671875, -1006.384765625, 61.870578765869 },
{ 2857.71484375, -1536.0712890625, 10.576637268066 },
{ 2197.541015625, -2657.6513671875, 13.118523597717 },
{ 1751.4375, -2060.2880859375, 13.166693687439 }
}
--[[for k, v in pairs(routes) do
createBlip(v[1], v[2], v[3], 51, 2, 255, 127, 255)
createMarker(v[1], v[2], v[3], "checkpoint", 4, 255, 200, 0, 150)
end]]
local truck = { [414] = true }
function resetTruckerJob()
jobstate = 0
routescompleted = 0
oldroute = -1
if (isElement(marker)) then
destroyElement(marker)
marker = nil
end
if (isElement(blip)) then
destroyElement(blip)
blip = nil
end
if (isElement(endmarker)) then
destroyElement(endmarker)
endmarker = nil
end
if (isElement(endcolshape)) then
destroyElement(endcolshape)
endcolshape = nil
end
if (isElement(endblip)) then
destroyElement(endblip)
endblip = nil
end
if deliveryStopTimer then
killTimer(deliveryStopTimer)
deliveryStopTimer = nil
end
wage = 0
end
function displayTruckerJob(notext)
if (jobstate==0) then
jobstate = 1
blip = createBlip(-69.087890625, -1111.1103515625, 0.64266717433929, 51, 2, 255, 127, 255)
if not notext then
outputChatBox("#FF9933Approach the #CCCCCCblip#FF9933 on your radar and enter the van to start your job.", 255, 194, 15, true)
end
end
end
function startTruckerJob()
if (jobstate==1) then
local vehicle = getPedOccupiedVehicle(getLocalPlayer())
if vehicle and getVehicleController(vehicle) == getLocalPlayer() and truck[getElementModel(vehicle)] then
outputChatBox("#FF9933Drive to the #FFFF00blip#FF9933 to complete your first delivery.", 255, 194, 15, true)
outputChatBox("#FF9933Remember to #FFFF00follow the street rules#FF9933.", 255, 194, 15, true)
outputChatBox("#FF9933If your truck is #FFFF00damaged#FF9933, the customers may pay less or refuse to accept the goods.", 255, 194, 15, true)
destroyElement(blip)
local rand = math.random(1, #routes)
route = routes[rand]
local x, y, z = route[1], route[2], route[3]
blip = createBlip(x, y, z, 0, 2, 255, 200, 0)
marker = createMarker(x, y, z, "checkpoint", 4, 255, 200, 0, 150)
addEventHandler("onClientMarkerHit", marker, waitAtDelivery)
addEventHandler("onClientMarkerLeave", marker, checkWaitAtDelivery)
jobstate = 2
oldroute = rand
triggerServerEvent("loadDeliveryProgress", getLocalPlayer(), 0, 0)
else
outputChatBox("You must be in the van to start this job.", 255, 0, 0)
end
end
end
function waitAtDelivery(thePlayer)
local vehicle = getPedOccupiedVehicle(getLocalPlayer())
if thePlayer == getLocalPlayer() and vehicle and getVehicleController(vehicle) == getLocalPlayer() and truck[getElementModel(vehicle)] then
if getElementHealth(vehicle) < 350 then
outputChatBox("You need to get your truck repaired.", 255, 0, 0)
else
deliveryStopTimer = setTimer(nextDeliveryCheckpoint, 5000, 1)
outputChatBox("#FF9933Wait a moment while your truck is processed.", 255, 0, 0, true )
end
end
end
function checkWaitAtDelivery(thePlayer)
local vehicle = getPedOccupiedVehicle(getLocalPlayer())
if vehicle and thePlayer == getLocalPlayer() and getVehicleController(vehicle) == getLocalPlayer() then
if getElementHealth(vehicle) >= 350 then
outputChatBox("You didn't wait at the dropoff point.", 255, 0, 0)
if deliveryStopTimer then
killTimer(deliveryStopTimer)
deliveryStopTimer = nil
end
end
end
end
function nextDeliveryCheckpoint()
deliveryStopTimer = nil
if jobstate == 2 or jobstate == 3 then
local vehicle = getPedOccupiedVehicle(getLocalPlayer())
if vehicle and getVehicleController(vehicle) == getLocalPlayer() and truck[getElementModel(vehicle)] then
destroyElement(marker)
destroyElement(blip)
local health = getElementHealth(vehicle)
if health >= 975 then
pay = 60 -- bonus: $60
elseif health >= 800 then
pay = 50
elseif health >= 350 then
-- 350 (black smoke) to 800, round to $5
pay = math.ceil( 10 * ( health - 300 ) / 500 ) * 5
else
outputDebugString("{TRUCKING} Should not happen")
pay = 0
end
wage = wage + pay
routescompleted = routescompleted + 1
outputChatBox("You completed your " .. routescompleted .. ". trucking run and earned $" .. pay .. ".", 0, 255, 0)
outputChatBox("#FF9933You can now either return to the #CC0000warehouse #FF9933and obtain your wage", 0, 0, 0, true)
outputChatBox("#FF9933or continue onto the next #FFFF00drop off point#FF9933 and increase your wage.", 0, 0, 0, true)
triggerServerEvent("saveDeliveryProgress", getLocalPlayer(), routescompleted, wage)
-- next drop off
local rand = -1
repeat
rand = math.random(1, #routes)
until oldroute ~= rand and getDistanceBetweenPoints2D(routes[oldroute][1], routes[oldroute][2], routes[rand][1], routes[rand][2]) > 250
route = routes[rand]
oldroute = rand
local x, y, z = route[1], route[2], route[3]
blip = createBlip(x, y, z, 0, 2, 255, 200, 0)
marker = createMarker(x, y, z, "checkpoint", 4, 255, 200, 0, 150)
addEventHandler("onClientMarkerHit", marker, waitAtDelivery)
addEventHandler("onClientMarkerLeave", marker, checkWaitAtDelivery)
if jobstate == 2 then
-- no final checkpoint set yet
endblip = createBlip(-69.087890625, -1111.1103515625, 0.64266717433929, 0, 2, 255, 0, 0)
endmarker = createMarker(-69.087890625, -1111.1103515625, 0.64266717433929, "checkpoint", 4, 255, 0, 0, 150)
setMarkerIcon(endmarker, "finish")
addEventHandler("onClientMarkerHit", endmarker, endDelivery)
end
jobstate = 3
-- increase global supplies by 3
triggerServerEvent("updateGlobalSupplies", getRootElement(), 3)
else
outputChatBox("#FF9933You must be in a van to complete deliverys.", 255, 0, 0, true ) -- Wrong car type.
end
end
end
function endDelivery(thePlayer)
if thePlayer == getLocalPlayer() then
local vehicle = getPedOccupiedVehicle(getLocalPlayer())
local id = getElementModel(vehicle) or 0
if not vehicle or getVehicleController(vehicle) ~= getLocalPlayer() or not (truck[id]) then
outputChatBox("#FF9933You must be in a van to complete deliverys.", 255, 0, 0, true ) -- Wrong car type.
else
outputChatBox("You earned $" .. wage .. " on your trucking runs.", 255, 194, 15)
triggerServerEvent("giveTruckingMoney", getLocalPlayer(), wage)
triggerServerEvent("saveDeliveryProgress", getLocalPlayer(), 0, 0)
triggerServerEvent("respawnTruck", getLocalPlayer(), vehicle)
resetTruckerJob()
displayTruckerJob(true)
end
end
end
addEvent("restoreTruckerJob", true)
addEventHandler("restoreTruckerJob", getRootElement(), function() displayTruckerJob(true) end )
addEvent("loadTruckerJob", true)
addEventHandler("loadTruckerJob", getRootElement(), function(r, w) routescompleted = r wage = w end )
addEvent("startTruckJob", true)
addEventHandler("startTruckJob", getRootElement(), startTruckerJob) |
items={}
Item("sword","a sword",1,"item_sword",
{
pta_min=1,
pta_max=2,
portee=5
}
)
Item("cure","a cure",2,"item_tome",
{
pta_type = "s",
pta_min = 5,
pta_max = 10,
mana = 10
}
)
Item("sheld","a sheld",1,"item_sheld",
{
pta_type = "b",
pta_min = 5,
pta_max = 10,
defence = 10
}
)
|
local ids = require 'ids'
local TEX_HEADER = [[
-- textures.txt: strings for wall, floor, and ceiling textures.
-- `name` is what appears when you click on a texture.
-- `use` is what appears when you double-click (i.e. attempt to use) it.
-- `texids` is a list of texture IDs (0-511); most textures have a few variants
-- with the same name and usage message, and thus, multiple texids.
]]
local TEX_TEMPLATE = [[
-- %s
texture {
texids = { %s };
name = %q;
use = %q;
}
]]
-- Given a resfile, unpacks the texture name and usage messages and returns
-- a string containing them.
return function(rf)
local names = rf:read(ids.TEX_NAMES)
local msgs = rf:read(ids.TEX_MSGS)
local textures = {} -- ordered list of textures and map (name => texture)
for texid = 0,#names do
-- strings are nul terminated
local name = names[texid]
local msg = msgs[texid]
local key = name .. '\n' .. msg
if textures[key] then
table.insert(textures[key].texids, texid)
else
textures[key] = {
texids = { texid };
name = name;
use = msg;
}
table.insert(textures, textures[key])
end
end
local buf = { TEX_HEADER }
for _,tex in ipairs(textures) do
table.insert(buf, TEX_TEMPLATE:format(
tex.name, table.concat(tex.texids, ', '), tex.name, tex.use))
end
return table.concat(buf, '')
end
|
local locales = require "faker.locales"
local helpers = require "faker.helpers"
local split = helpers.split
table.copy = helpers.table_copy
local M = {
add_locale = locales.add_locale,
address = require("faker.core.address"),
app = require("faker.core.app"),
avatar = require("faker.core.avatar"),
beer = require("faker.core.beer"),
--Bitcoin = require("faker.core.bitcoin"),
book = require("faker.core.book"),
boolean = require("faker.core.boolean"),
business = require("faker.core.business"),
cat = require("faker.core.cat"),
chucknorris = require("faker.core.chuck_norris"),
--Code = require("faker.core.code"),
color = require("faker.core.color"),
commerce = require("faker.core.commerce"),
company = require("faker.core.company"),
crypto = require("faker.core.crypto"),
--Date = require("faker.core.date"),
educator = require("faker.core.educator"),
file = require("faker.core.file"),
finance = require("faker.core.finance"),
gameofthrones = require("faker.core.game_of_thrones"),
hacker = require("faker.core.hacker"),
hipster = require("faker.core.hipster"),
idnumber = require("faker.core.id_number"),
internet = require("faker.core.internet"),
lorem = require("faker.core.lorem"),
music = require("faker.core.music"),
name = require("faker.core.name"),
number = require("faker.core.number"),
phonenumber = require("faker.core.phone_number"),
placeholdit = require("faker.core.placeholdit"),
pokemon = require("faker.core.pokemon"),
slackemoji = require("faker.core.slack_emoji"),
space = require("faker.core.space"),
superhero = require("faker.core.superhero"),
team = require("faker.core.team"),
--Time = require("faker.core.time"),
university = require("faker.core.university"),
vehicle = require("faker.core.vehicle"),
yoda = require("faker.core.yoda")
}
local numbers = helpers.range('0', '9'); M.Numbers = numbers;
local u_letters = helpers.range('A', 'Z'); M.ULetters = u_letters;
local letters = helpers.array_merge(u_letters, helpers.range('a', 'z')); M.Letters = letters;
function set_locale(name)
if name == nil then
name = locales.base_locale
end
if not locales.has_locale(name) then
locales.add_locale(name)
end
locales.current_locale = name
return true
end
M.set_locale = set_locale
function get_locale()
return locales.current_locale
end
M.get_locale = get_locale
M.set_locale('en')
return M
|
-- -*- coding: utf-8-unix -*-
---
-- @file Scale9.lua
-- @author Junichi Yamazaki
-- @since 2012-08-31
local pScale9
local count = 0
local asset = "asset://Horiz.png.imag"
function setup()
count = 0
pScale9 = UI_Scale9(nil, 7000, 10, 10, 100, 100, asset)
pScale9_2 = UI_Scale9(nil, 6000, 60, 60, 200, 200, asset)
end
function execute(deltaT)
count = count + 1
if count == 20 then
syslog(string.format("TASK alpha"))
prop = TASK_getProperty(pScale9)
prop.alpha = 128
TASK_setProperty(pScale9, prop)
end
if count == 40 then
syslog(string.format("TASK color"))
prop = TASK_getProperty(pScale9)
prop.color = 0xFF00FF
TASK_setProperty(pScale9, prop)
end
if count == 60 then
syslog(string.format("TASK scalex"))
prop = TASK_getProperty(pScale9)
prop.scaleX = 2.0
TASK_setProperty(pScale9, prop)
end
if count == 80 then
syslog(string.format("TASK scaley"))
prop = TASK_getProperty(pScale9)
prop.scaleY = 2.0
TASK_setProperty(pScale9, prop)
end
if count == 100 then
syslog(string.format("TASK rot"))
prop = TASK_getProperty(pScale9)
prop.rot = 25.0
TASK_setProperty(pScale9, prop)
end
if count == 120 then
syslog(string.format("TASK x"))
prop = TASK_getProperty(pScale9)
prop.x = 200
TASK_setProperty(pScale9, prop)
end
if count == 140 then
syslog(string.format("TASK y"))
prop = TASK_getProperty(pScale9)
prop.y = 200
TASK_setProperty(pScale9, prop)
end
if count == 160 then
syslog(string.format("TASK visible = false"))
prop = TASK_getProperty(pScale9)
prop.visible = false
TASK_setProperty(pScale9, prop)
end
if count == 180 then
syslog(string.format("TASK visible = true"))
prop = TASK_getProperty(pScale9)
prop.visible = true
TASK_setProperty(pScale9, prop)
end
if count == 200 then
syslog(string.format("order"))
prop = TASK_getProperty(pScale9)
prop.order = 5000
TASK_setProperty(pScale9, prop)
end
if count == 220 then
syslog(string.format("width"))
prop = TASK_getProperty(pScale9)
prop.width = 400
TASK_setProperty(pScale9, prop)
end
if count == 240 then
syslog(string.format("height"))
prop = TASK_getProperty(pScale9)
prop.height = 50
TASK_setProperty(pScale9, prop)
end
if count == 300 then
syslog(string.format("CMD UI_SCALE9_SETWIDTH"))
sysCommand(pScale9, UI_SCALE9_SETWIDTH, 600)
end
if count == 400 then
syslog(string.format("CMD UI_SCALE9_SETHEIGHT"))
sysCommand(pScale9, UI_SCALE9_SETHEIGHT, 100)
end
-- syslog("" .. count)
end
function leave()
end
|
local t = Def.ActorFrame{
Def.Quad{
InitCommand=cmd(FullScreen;diffuse,color("1,1,1,1"));
};
};
t[#t+1] = Def.ActorFrame{
LoadActor("sound")..{
OnCommand=cmd(queuecommand,"Play");
PlayCommand=cmd(play);
};
LoadActor("Konami")..{
InitCommand=cmd(Center);
OnCommand=cmd(diffusealpha,0;linear,0.5;diffusealpha,1;sleep,5;linear,0.5;diffusealpha,0);
};
LoadActor("Bemani")..{
InitCommand=cmd(Center);
OnCommand=cmd(diffusealpha,0;sleep,6.6;linear,0.5;diffusealpha,1;sleep,5;linear,0.5;diffusealpha,0);
};
LoadActor("EAmuse")..{
InitCommand=cmd(Center);
OnCommand=cmd(diffusealpha,0;sleep,12.6;linear,0.5;diffusealpha,1;sleep,5;linear,0.5;diffusealpha,0);
};
LoadActor("RSA")..{
InitCommand=cmd(Center);
OnCommand=cmd(diffusealpha,0;sleep,18.6;linear,0.5;diffusealpha,1;sleep,5;linear,0.5;diffusealpha,0);
};
};
return t;
|
object_mobile_smuggler_fence_norris = object_mobile_shared_smuggler_fence_norris:new {
}
ObjectTemplates:addTemplate(object_mobile_smuggler_fence_norris, "object/mobile/smuggler_fence_norris.iff")
|
return {'mba','mbabane'} |
object_static_particle_pt_smoke_holocron_blue = object_static_particle_shared_pt_smoke_holocron_blue:new {
}
ObjectTemplates:addTemplate(object_static_particle_pt_smoke_holocron_blue, "object/static/particle/pt_smoke_holocron_blue.iff")
|
-----------------------------------
-- Area: Ru'Lude Gardens
-- NPC: Explorer Moogle
-- Type: Mog Tablet
-- !pos 1.000 -1 0.000 243
--
-- Auto-Script: Requires Verification (Verified by Brawndo)
-----------------------------------
function onTrade(player, npc, trade)
end
function onTrigger(player, npc)
player:startEvent(10114)
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
end
|
local _M = {}
local strutil = require("acid.strutil")
local tableutil = require("acid.tableutil")
local mime = require("acid.ngx.mime")
local merge = require("acid.ngx.merge")
local repr = tableutil.repr
function _M.get_url_argument()
local uri = ngx.var.request_uri
local elts = strutil.split( uri, '[?][?]' )
local uris, objnames = elts[1], elts[2]
objnames = strutil.split(objnames, ';')
return uris, objnames
end
function _M.get_ip(host)
return '127.0.0.1'
end
function _M.doit()
local uri, objnames = _M.get_url_argument()
local headers = ngx.req.get_headers()
local host = headers.host
local parts = {}
for i, name in ipairs(objnames) do
local ip = _M.get_ip(host)
local port = '9001'
local url = ip .. ':' .. port .. uri .. '/' .. name
table.insert(parts, {urls={url}})
end
if #parts == 0 then
ngx.status = 200
ngx.exit(ngx.HTTP_OK)
end
ngx.header['Content-Type'] = mime.by_fn(parts[1].urls[1])
return merge.multi_part({}, parts)
end
return _M;
|
#!/usr/bin/env lua
---
-- @author Gianluca Fiore
-- @copyright 2012-2014, Gianluca Fiore <[email protected]>
--
package.path = "/mnt/d/Script/lib/?.lua;" .. package.path
local markdown = require("markdown") -- that's the markdown.lua implementation from http://www.frykholm.se/files/markdown.lua
local lfs = require("lfs")
-- Regexp to match markdown files
local rMdown = ".*%.[mM][aA]?[rR]?[kK]?[dD][oO]?[wW]?[nN]?"
-- html closing string
local html_footer = [[</body></html>]]
local usage = [[USAGE: Markdown.lua (file|directory) [title]
where file is a file containing markdown formatted text or where directory
is a valid path having under it one or more markdown formatted files
title is an optional string to be used in the <title> html tag]]
---Function equivalent to POSIX basename
--@param str a string
function basename(str)
local name = string.gsub(str, "(.*/)(.*)", "%2")
return name
end
---Returns only the filename stripping the extension
--@param str a filename complete with extension
function filename(str)
local name = string.gsub(str, "(.*)%.(.*)", "%1")
return name
end
---Returns the html header by check if the parameter given is a string;
--if not, return basename of file or the string in the <title> tag
--@param v the value to be returned, if a string
function generate_html_header(v)
-- two strings, up until and thereafter the title tag
local html1 = [[ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>]]
local html2 = [[</title>
<link rel="stylesheet" type="text/css" href="file:///mnt/d/Script/lib/markdown.css" />
<link rel="stylesheet" type="text/css" media="print" href="file:///mnt/d/Script/lib/markdown-print.css" />
</head>
<body>
]]
if type(v) == 'string' then
return html1 .. v .. html2
else
return html1 .. basename(arg[1]) .. html2
end
end
---Convert a markdown file to one with the same name but in html
--@param file the file to convert
function mkdtohtml(file)
local f = assert(io.open(file, "r"), "couldn't open file")
local n = filename(file)
local html_file = io.open(n .. '.html', "w")
html_file:write(generate_html_header(arg[2]))
html_file:write(markdown(f:read("*a")))
html_file:write(html_footer)
html_file:close()
end
---Check if a path exists and if it does, return a string telling
--whether it is a file or a directory
--@param path the path to check
function fileordir(path)
attrs = lfs.attributes(path)
if not attrs then
print(path, " is not a valid directory or file")
print(usage)
os.exit(1)
else
if attrs.mode == "directory" then
return 'directory'
else
return 'file'
end
end
end
---Search inside a directory for all markdown files and adds them all to
--a table
--@param dir the base directory into which to search
--@param tbl the table that will contain all file paths
function browseformkd(dir, tbl)
for f in lfs.dir(dir) do
if f ~= "." and f ~= ".." then
local file = dir .. "/" .. f
local attr = lfs.attributes(file)
if attr.mode == "directory" then
browseformkd(file, tbl)
else
if string.match(file, rMdown) then
-- it's a markdown file then, add to the table
table.insert(tbl, file)
end
end
end
end
end
if not arg[1] then
print(usage)
os.exit(1)
else
path = fileordir(arg[1])
if path == 'file' then
mkdtohtml(arg[1])
else
-- The table containing all mkdown files
local mkdtable = {}
browseformkd(arg[1], mkdtable)
for i,n in ipairs(mkdtable) do
mkdtohtml(n)
end
end
end
|
PLUGIN.name = "Vendors"
PLUGIN.author = "Chessnut"
PLUGIN.desc = "Adds NPC vendors that can sell things."
if (SERVER) then
AddCSLuaFile("cl_editor.lua")
end
nut.util.include("sv_logging.lua")
nut.util.include("sh_enums.lua")
nut.util.include("sv_networking.lua")
nut.util.include("cl_networking.lua")
nut.util.include("sv_data.lua")
nut.util.include("sv_hooks.lua")
nut.util.include("cl_hooks.lua")
|
function Dulce(_x, _y)
-- show warning indicator
Indicator(_x)
-- delay spawning by one second
Timer(1, function()
sfx(13)
add(world, {
id = {
class = "enemy",
subclass = "dulce",
size = "medium"
},
pos = {
x=_x,
y=_y
},
vel = {
x=0,
y=C.DULCE_MOVE_VY
},
box = {
w = 15,
h = 13
},
hitframe = false,
hp = 2,
enemyWeapon = {
type = "dulce",
cooldown = 0
},
outOfBoundsDestroy = true,
shadow = true,
drawTag = "actor",
draw = function(self, _offset)
_offset = _offset or 0
spr(36, self.pos.x+_offset, self.pos.y+_offset, 2, 2)
end
})
end)
end |
function start (song)
print("Song: " .. song .. " @ " .. bpm .. " downscroll: " .. downscroll)
end
function update (elapsed)
local currentBeat = (songPos / 1000)*(bpm/84)
if curStep >= 192 then
for i=0,8 do
setActorY(_G['defaultStrum'..i..'Y'] + 10 * math.sin((currentBeat + i*0.25) * math.pi), i)
end
end
end
function beatHit (beat)
-- do nothing
end
function stepHit (step)
end
function keyPressed (key)
-- do nothing
end
print("Mod Chart script loaded :)")
|
--[[
================================================================================
ProjectNukeCorePackets
================================================================================
Author: stuntguy3000
--]]
-- GeneralCommunicationPacket Object
GeneralCommunicationPacket = ProjectNukeCoreClasses.Packet.new(0, nil)
-- End GeneralCommunicationPacket |
---@class EquipWindow
local EquipWindow = DClass("EquipWindow", BaseWindow)
_G.EquipWindow = EquipWindow
function EquipWindow:ctor(data)
EquipMgr:setCurSelectHero(data[1])
EquipMgr:initEquipingEquips()
end
function EquipWindow:addListeners()
self.messager:addListener(Msg.EQUIP_OPEN_SELECTSUIT, self.openSelectSuit)
end
function EquipWindow:onDispose()
self.messager:dispose()
end
function EquipWindow:onAsset()
self.assetKeys = {
"UI/Component/EquipInfoCell"
}
self.assetComplete = function(index, obj)
if index == 1 then
self.cell_EquipInfo = obj:GetComponent(typeof(Button))
end
end
end
function EquipWindow:onInit()
self:addListeners()
self.nodes.uiGesture:AddHandler(
UIGestureType.All,
function(e)
if e.type == UIGestureType.Move then
self.nodes.model:RotateModel(-e.deltaPosition.x)
end
end
)
--self.nodes.nodePopup.gameObject:SetActive(true)
self.nodes.nodeShowSuit.gameObject:SetActive(false)
self.cpt_OwnEquip = self:createComponent(self.nodes.nodeOwnEquip, Equip_OwnEquip)
--self.cpt_PopupSuit = self:createComponent(self.nodes.nodeShowSuit, EquipOwn_ChangeSuit)
self.cpt_Equip = self:createComponent(self.nodes.nodeEquip, Equip_Equip)
--self.cpt_Popup = UIUtil.createComponent(self.nodes.nodePopup, Equip_PopupDetail)
end
---@param open number 当前显示的套装id
function EquipWindow:openSelectSuit(open)
if open then
UIManager.openWindow("EquipOwnChangeSuitPopup", nil, open)
else
UIManager.closeWindow("EquipOwnChangeSuitPopup")
end
--self.cpt_PopupSuit.gameObject:SetActive(open)
end
function EquipWindow:onOpen()
self.cpt_OwnEquip:onOpen()
--self.cpt_PopupSuit:onInit()
self.cpt_Equip:onInit()
--self.cpt_Popup:onInit()
end
|
-- Options related to the interface implementation.
options.cache = true
options.charset = ''
options.close = false
options.info = true
options.limit = 0
options.range = math.huge
|
--
-- DICOM Web Viewer (DWV) lua script for integration in a Conquest PACS server.
--
-- Usage
-- In the dicom.ini of your web server, create the dwv viewer:
-- >> [dwv]
-- >> source = viewers\dwv.lua
-- And set it as the default viewer:
-- >> [webdefaults]
-- >> ...
-- >> viewer = dwv
-- This script relies on the 'kFactorFile', 'ACRNemaMap' and 'Dictionary'
-- variables being set correctly.
-- Then copy the DWV distribution files (without the html files) in a 'dwv' folder
-- in the web folder of your web server.
-- Get ids
local patientid = string.gsub(series2, ':.*$', '')
local seriesuid = string.gsub(series2, '^.*:', '')
-- Functions declaration
function getstudyuid()
local a, b, s
s = servercommand('get_param:MyACRNema')
b = newdicomobject()
b.PatientID = patientid
b.SeriesInstanceUID = seriesuid
b.StudyInstanceUID = ''
a = dicomquery(s, 'SERIES', b)
return a[0].StudyInstanceUID
end
function queryimages()
local images, imaget, b, s
s = servercommand('get_param:MyACRNema')
b = newdicomobject()
b.PatientID = patientid
b.SeriesInstanceUID = seriesuid
b.SOPInstanceUID = ''
images = dicomquery(s, 'IMAGE', b)
imaget={}
for k=0,#images-1 do
imaget[k+1]={}
imaget[k+1].SOPInstanceUID = images[k].SOPInstanceUID
end
table.sort(imaget, function(a,b) return a.SOPInstanceUID < b.SOPInstanceUID end)
return imaget
end
-- Main
local studyuid = getstudyuid()
local images = queryimages()
-- create the url lua array
local urlRoot = webscriptadress
urlRoot = urlRoot .. '?requestType=WADO&contentType=application/dicom'
urlRoot = urlRoot .. '&seriesUID=' .. seriesuid
urlRoot = urlRoot .. '&studyUID=' .. studyuid
local urls = {}
for i=1, #images do
urls[i] = urlRoot .. '&objectUID=' .. images[i].SOPInstanceUID
end
-- Generate html
HTML('Content-type: text/html\n\n')
print([[<!DOCTYPE html>]])
print([[<html>]])
print([[<head>]])
print([[
<title>DICOM Web Viewer</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="/dwv/style.css">
<style>
body { background-color: #222; color: white;
margin: 10px; padding: 0; font-size: 80%; }
#pageHeader h1 { display: inline-block; margin: 0; color: #fff; }
#pageHeader a { color: #ddf; }
#pageHeader #toolbar { display: inline-block; float: right; }
#toolbox li:first-child { list-style-type: none; padding-bottom: 10px; margin-left: -20px; }
#pageMain { position: absolute; height: 92%; width: 99%; bottom: 5px; left: 5px; background-color: #333; }
#infotl { color: #333; text-shadow: 0 1px 0 #fff; }
#infotr { color: #333; text-shadow: 0 1px 0 #fff; }
</style>
]])
-- path with extra /dwv
print([[
<link rel="stylesheet" href="/dwv/ext/jquery-ui/themes/ui-darkness/jquery-ui-1.10.3.min.css">
]])
-- path with extra /dwv
print([[
<!-- Third party -->
<script type="text/javascript" src="/dwv/ext/jquery/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="/dwv/ext/jquery-ui/jquery-ui-1.10.3.min.js"></script>
<script type="text/javascript" src="/dwv/ext/flot/jquery.flot.min.js"></script>
<script type="text/javascript" src="/dwv/ext/openjpeg/openjpeg.js"></script>
]])
-- path with extra /dwv
print([[
<!-- Local -->
<script type="text/javascript" src="/dwv/dwv-0.5.1.min.js"></script>
]])
print([[<script type="text/javascript">]])
print([[
function toggle(dialogName)
{
if( $(dialogName).dialog('isOpen') ) $(dialogName).dialog('close');
else $(dialogName).dialog('open');
}
]])
print([[
// check browser support
dwv.html.browser.check();
// main application
var app = new dwv.App();
]])
print([[
// jquery
$(document).ready(function(){
// initialise buttons
$("button").button();
$("#toggleInfoLayer").button({ icons:
{ primary: "ui-icon-comment" }, text: false });
// create dialogs
$("#openData").dialog({ position:
{my: "left top", at: "left top", of: "#pageMain"} });
$("#toolbox").dialog({ position:
{my: "left top+200", at: "left top", of: "#pageMain"} });
$("#history").dialog({ position:
{my: "left top+370", at: "left top", of: "#pageMain"},
autoOpen: false });
$("#tags").dialog({ position:
{my: "right top", at: "right top", of: "#pageMain"},
autoOpen: false, width: 500, height: 590 });
$("#help").dialog({ position:
{my: "right top", at: "right top", of: "#pageMain"},
autoOpen: false, width: 500, height: 590 });
]])
print([[
// image dialog
$("#layerDialog").dialog({ position:
{my: "left+320 top", at: "left top", of: "#pageMain"}});
// default size
$("#layerDialog").dialog({ width: "auto", resizable: false });
// Resizable but keep aspect ratio
// TODO it seems to add a border that bothers getting the cursor position...
//$("#layerContainer").resizable({ aspectRatio: true });
]])
print([[
// button listeners
var button = null;
// open
button = document.getElementById("open-btn");
if( button ) button.onclick = function() { toggle("#openData"); };
// toolbox
button = document.getElementById("toolbox-btn");
if( button ) button.onclick = function() { toggle("#toolbox"); };
// history
button = document.getElementById("history-btn");
if( button ) button.onclick = function() { toggle("#history"); };
// tags
button = document.getElementById("tags-btn");
if( button ) button.onclick = function() { toggle("#tags"); };
// layerDialog
button = document.getElementById("layerDialog-btn");
if( button ) button.onclick = function() { toggle("#layerDialog"); };
// info
button = document.getElementById("info-btn");
if( button ) button.onclick = function() { app.toggleInfoLayerDisplay(); };
// help
button = document.getElementById("help-btn");
if( button ) button.onclick = function() { toggle("#help"); };
]])
print([[
// initialise the application
app.init();
// align layers when the window is resized
window.onresize = app.resize;
// possible load from URL
//var inputUrls = dwv.html.getUriParam();
// help
// TODO Seems accordion only works when at end...
$("#accordion").accordion({ collapsible: "true", active: "false", heightStyle: "content" });
]])
-- create javascript url array
print([[ var inputUrls = []])
for i=1, #images do
print(' "'..urls[i]..'",')
end
print([[ ];]])
-- load data
print([[
if( inputUrls && inputUrls.length > 0 ) app.loadURL(inputUrls);
});
]])
print([[</script>]])
print([[</head>]])
print([[<body>]])
print([[<div id="pageHeader">]])
print([[
<!-- Title #dwvversion -->
<h1>DICOM Web Viewer (<a href="https://github.com/ivmartel/dwv">dwv</a> v0.5.1)</h1>
<!-- Toolbar -->
<div id="toolbar">
<button id="open-btn">File</button>
<button id="toolbox-btn">Toolbox</button>
<button id="history-btn">History</button>
<button id="tags-btn">Tags</button>
<button id="layerDialog-btn">Image</button>
<button id="info-btn">Info</button>
<button id="help-btn">Help</button>
</div><!-- /toolbar -->
]])
print([[</div><!-- pageHeader -->]])
print([[<div id="pageMain">]])
print([[
<!-- Open file -->
<div id="openData" title="File">
<div id="loaderlist"></div>
<div id="progressbar"></div>
</div>
]])
print([[
<!-- Toolbox -->
<div id="toolbox" title="Toolbox">
<ul id="toolList"></ul>
</div>
<!-- History -->
<div id="history" title="History"></div>
<!-- Tags -->
<div id="tags" title="Tags"></div>
<!-- Help -->
<div id="help" title="Help"></div>
]])
print([[
<!-- Layer Container -->
<div id="layerDialog" title="Image">
<div id="layerContainer">
<canvas id="imageLayer">Only for HTML5 compatible browsers...</canvas>
<canvas id="drawLayer">Only for HTML5 compatible browsers...</canvas>
<canvas id="tempLayer">Only for HTML5 compatible browsers...</canvas>
<div id="infoLayer">
<div id="infotl"></div>
<div id="infotr"></div>
<div id="infobl"></div>
<div id="infobr"><div id="plot"></div></div>
</div><!-- /infoLayer -->
</div><!-- /layerContainer -->
</div><!-- /layerDialog -->
]])
print([[</div><!-- pageMain -->]])
print([[</body>]])
print([[</html>]])
|
--[[ TO DO
-- Implement player filtering for reporting function
-- Implement temporary mob_filters variable for reporting function
]]
percent_table = {
intimidate = S{"hit","block","anticipate","parry","evade"},
evade = S{"hit","block","anticipate","parry"},
parry = S{"nonparry"},
anticipate = S{"hit","block"},
block = S{"nonblock"},
absorb = S{"hit","block"},
melee = S{"miss","+crit"},
crit = S{"melee"},
ranged = S{"r_miss","+r_crit"},
r_crit = S{"ranged"},
ws = S{"ws_miss"},
ja = S{"ja_miss"},
['1'] = S{'2','3','4','5','6','7','8'},
['2'] = S{'1','3','4','5','6','7','8'},
['3'] = S{'1','2','4','5','6','7','8'},
['4'] = S{'1','2','3','5','6','7','8'},
['5'] = S{'1','2','3','4','6','7','8'},
['6'] = S{'1','2','3','4','5','7','8'},
['7'] = S{'1','2','3','4','5','6','8'},
['8'] = S{'1','2','3','4','5','6','7'},
}
-- Returns a table of players
function get_players()
local player_table = L{}
for mob,players in pairs(database) do
for player,__ in pairs(players) do
if not player_table:contains(player) then
player_table:append(player)
end
end
end
return player_table
end
-- Returns a table of monsters
function get_mobs()
local mob_table = L{}
for mob,players in pairs(database) do
if not mob_table:contains(mob) then
mob_table:append(mob)
end
end
return mob_table
end
-- Returns a list of players, sorted by a particular stat or stat type, and limited to a number (or to 20, if no number provided)
function get_sorted_players(sort_value,limit)
local player_table = get_players()
if not get_players() then
return nil
end
if not limit then
limit = 20
end
if S{'multi','1','2','3','4','5','6','7','8'}:contains(sort_value) then
sort_value = 'melee'
end
local sorted_player_table = L{}
for i=1,limit,+1 do
player_name = nil
top_result = 0
for __,player in pairs(player_table) do
if sort_value == 'damage' then -- sort by total damage
if get_player_damage(player) > top_result and not sorted_player_table:contains(player) then
top_result = get_player_damage(player)
player_name = player
end
elseif sort_value == 'defense' then -- sort by total parry/hit/evades/blocks
player_hits_received = get_player_stat_tally('parry',player) + get_player_stat_tally('hit',player) + get_player_stat_tally('evade',player) + get_player_stat_tally('block',player)
if player_hits_received > top_result and not sorted_player_table:contains(player) then
top_result = player_hits_received
player_name = player
end
elseif S{'ws','ja','spell','mb'}:contains(sort_value) and get_player_stat_avg(sort_value,player) then -- sort by avg
if get_player_stat_avg(sort_value,player) > top_result and not sorted_player_table:contains(player) then
top_result = get_player_stat_avg(sort_value,player)
player_name = player
end
elseif S{'hit','miss','nonblock','nonparry','r_miss','ws_miss','ja_miss','enfeeb','enfeeb_miss'}:contains(sort_value) then -- sort by tally
if get_player_stat_tally(sort_value,player) > top_result and not sorted_player_table:contains(player) then
top_result = get_player_stat_tally(sort_value,player)
player_name = player
end
elseif (S{'melee','ranged','crit','r_crit'}:contains(sort_value) or get_stat_type(sort_value)=="defense") and get_player_stat_percent(sort_value,player) then -- sort by percent
if get_player_stat_percent(sort_value,player) > top_result and not sorted_player_table:contains(player) then
top_result = get_player_stat_percent(sort_value,player)
player_name = player
end
elseif S{'sc','add','spike'}:contains(sort_value) then --sort by damage
if get_player_stat_damage(sort_value,player) > top_result and not sorted_player_table:contains(player) then
top_result = get_player_stat_damage(sort_value,player)
player_name = player
end
end
end
if player_name then sorted_player_table:append(player_name) end
end
return sorted_player_table
end
--takes table and collapses WS, JA, and spells
function collapse_categories(t)
for key,value in pairs(t) do
if get_stat_type(key)=='category' then -- ws, ja, spell
spells = value
t[key].tally = 0
t[key].damage = 0
for spell,data in pairs(value) do
if type(data)=='table' then
t[key].tally = data.tally
t[key].damage = data.damage
t[key][spell] = nil
end
end
return
elseif type(value)=='table' then -- go deeper
collapse_categories(value)
else
return -- hit a dead end, go back
end
end
return t
end
function collapse_mobs(s_type,mob_filters)
local player_table = nil
for mob,players in pairs(copy(database)) do
if not player_table then
player_table = {}
end
if check_filters('mob',mob) then
for player,player_data in pairs(players) do
if check_filters('player',player) then
if not player_table[player] then
player_table[player] = player_data
else
merge_tables(player_table[player],player_data)
end
end
end
end
end
if player_table then
collapse_categories(player_table)
end
return player_table
end
function get_player_spell_table(spell_type,mob_filters)
local player_table = nil
for mob,players in pairs(database) do
if not player_table then
player_table = {}
end
if check_filters('mob',mob) then
for player,mob_player_table in pairs(players) do
if check_filters('player',player) then
if not player_table[player] then
player_table[player] = {}
end
if mob_player_table['category'] and mob_player_table['category'][spell_type] then
for spell,spell_table in pairs(mob_player_table['category'][spell_type]) do
if not player_table[player][spell] then
player_table[player][spell] = {}
end
for datum,value in pairs(spell_table) do
if not player_table[player][spell][datum] then
player_table[player][spell][datum] = 0
end
player_table[player][spell][datum] = player_table[player][spell][datum] + value
end
end
end
end
end
end
end
return player_table
end
function get_player_stat_tally(stat,plyr,mob_filters)
if type(stat)=='number' then stat=tostring(stat) end
local tally = 0
for mob,mob_table in pairs(database) do
if check_filters('mob',mob) then
if database[mob][plyr] and database[mob][plyr][get_stat_type(stat)] and database[mob][plyr][get_stat_type(stat)][stat] then
if database[mob][plyr][get_stat_type(stat)][stat].tally then
tally = tally + database[mob][plyr][get_stat_type(stat)][stat].tally
elseif get_stat_type(stat)=="category" then
for spell,spell_table in pairs (database[mob][plyr][get_stat_type(stat)][stat]) do
if spell_table.tally then
tally = tally + spell_table.tally
end
end
end
end
end
end
return tally
end
function get_player_stat_damage(stat,plyr,mob_filters)
if type(stat)=='number' then stat=tostring(stat) end
local damage = 0
for mob,mob_table in pairs(database) do
if (mob_filters and mob==mob_filters) or (not mob_filters and check_filters('mob',mob)) then
if database[mob][plyr] and database[mob][plyr][get_stat_type(stat)] and database[mob][plyr][get_stat_type(stat)][stat] then
if database[mob][plyr][get_stat_type(stat)][stat].damage then
damage = damage + database[mob][plyr][get_stat_type(stat)][stat].damage
elseif get_stat_type(stat)=="category" then
for spell,spell_table in pairs (database[mob][plyr][get_stat_type(stat)][stat]) do
if spell_table.damage then
damage = damage + spell_table.damage
end
end
end
end
end
end
return damage
end
function get_player_stat_avg(stat,plyr,mob_filters)
if S{'ws_miss','ja_miss','enfeeb','enfeeb_miss'}:contains(stat) then return nil end
if type(stat)=='number' then stat=tostring(stat) end
local total,tally,result,digits = 0,0,0,0
if stat=='multi' then
digits = 2
for i,__ in pairs(stat_types.multi) do
total = total + (get_player_stat_tally(i,plyr,mob_filters) * tonumber(i))
tally = tally + get_player_stat_tally(i,plyr,mob_filters)
end
else
digits = 0
total = get_player_stat_damage(stat,plyr,mob_filters)
tally = get_player_stat_tally(stat,plyr,mob_filters)
end
if tally == 0 then return nil end
local shift = 10 ^ digits
result = math.floor( (total / tally)*shift + 0.5 ) / shift
return result
end
function get_player_stat_percent(stat,plyr,mob_filters)
if type(stat)=='number' then stat=tostring(stat) end
if stat=="damage" then
dividend = get_player_damage(plyr,mob_filters)
divisor = get_player_damage(nil,mob_filters)
else
if not percent_table[stat] then
return nil
end
dividend = get_player_stat_tally(stat,plyr,mob_filters)
divisor = get_player_stat_tally(stat,plyr,mob_filters)
if percent_table[stat] then
for v,__ in pairs(percent_table[stat]) do
-- if string begins with +
if type(v)=='string' and v:startswith('+') then
dividend = dividend + get_player_stat_tally(string.sub(v,2),plyr,mob_filters)
divisor = divisor + get_player_stat_tally(string.sub(v,2),plyr,mob_filters)
else
divisor = divisor + get_player_stat_tally(v,plyr,mob_filters)
end
end
end
end
if dividend==0 or divisor==0 then
return nil
end
digits = 4
shift = 10 ^ digits
result = math.floor( (dividend / divisor) *shift + 0.5 ) / shift
return result * 100
end
function get_player_damage(plyr,mob_filters)
local damage = 0
for mob,players in pairs(database) do
if (mob_filters and mob==mob_filters) or (not mob_filters and check_filters('mob',mob)) then
for player,mob_player_table in pairs(players) do
if not plyr or (plyr and player==plyr) then
if mob_player_table.total_damage then
damage = damage + mob_player_table.total_damage
end
end
end
end
end
return damage
end
-- For old versions of exports
function find_total_damage(plyr,mnst)
local damage = 0
if database[mnst] and database[mnst][plyr] then
for stat in damage_types:it() do
damage = damage + get_player_stat_damage(stat,plyr,mnst)
end
end
return damage
end
--Copyright (c) 2013~2016, F.R
--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 <addon name> 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 <your name> 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. |
-- AUTO BUILD, DON'T MODIFY!
dofile "autobuild/jiguang-types.lua"
name = "jiguang"
path = "../../frameworks/plugins/jiguang"
headers = [[
#include "lua-bindings/lua_conv.h"
#include "lua-bindings/lua_conv_manual.h"
#include "cclua/xlua.h"
#include "JiGuang.h"
]]
chunk = nil
luaopen = nil
typeconf 'cclua::plugin::JPush'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen([[cclua::runtime::registerFeature("jpush", true);]])
.ifdef('*', '#ifdef CCLUA_BUILD_JPUSH')
.func(nil, 'static void init(const std::string &appKey, const std::string &channel)')
.func(nil, 'static void setAlias(const std::string &alias)')
.func(nil, 'static void deleteAlias()')
.func(nil, 'static void addTags(const std::set<std::string> &tags)')
.func(nil, 'static void setTags(const std::set<std::string> &tags)')
.func(nil, 'static void deleteTags(const std::set<std::string> &tags)')
.func(nil, 'static void cleanTags()')
.func(nil, 'static void setDebug(bool enabled)')
.func(nil, 'static void setLogOFF()')
.func(nil, 'static void setBadge(int value)')
.func(nil, 'static bool isEnabled()')
.func(nil, 'static void requestPermission()')
.func(nil, 'static std::string getRegistrationID()')
.prop('enabled', nil, nil)
.prop('registrationID', nil, nil)
typeconf 'cclua::plugin::JAuth'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen([[cclua::runtime::registerFeature("jauth", true);]])
.ifdef('*', '#ifdef CCLUA_BUILD_JAUTH')
.func(nil, 'static void init(const std::string &appKey, const std::string &channel)')
.func(nil, 'static bool isInitSuccess()')
.func(nil, 'static void setDebug(bool enabled)')
.func(nil, 'static bool checkVerifyEnable()')
.func(nil, 'static void clearPreLoginCache()')
.func(nil, 'static void dismissLoginAuth(@optional bool needCloseAnim)')
.func(nil, 'static void setSmsIntervalTime(long intervalTime)')
.func(nil, 'static void configUI(cocos2d::ValueMap &value, @optional bool landscape)')
.callback {
funcs = {
'static void getToken(int timeout, @localvar const std::function<void (const cocos2d::Value &)> callback)'
},
tag_maker = 'Token',
tag_mode = 'new',
tag_store = 0,
tag_scope = 'once',
}
.callback {
funcs = {
'static void preLogin(int timeout, @localvar const std::function<void (const cocos2d::Value &)> callback)'
},
tag_maker = 'preLogin',
tag_mode = 'new',
tag_store = 0,
tag_scope = 'once',
}
.callback {
funcs = {
'static void loginAuth(int timeout, @localvar const std::function<void (const cocos2d::Value &)> callback)'
},
tag_maker = 'loginAuth',
tag_mode = 'new',
tag_store = 0,
tag_scope = 'once',
}
.callback {
funcs = {
'static void getSmsCode(const std::string &phonenum, const std::string &signid, const std::string &tempid, @localvar const std::function<void (const cocos2d::Value &)> callback)'
},
tag_maker = 'SmsCode',
tag_mode = 'new',
tag_store = 0,
tag_scope = 'once',
}
.prop('initSuccess', nil, nil)
typeconf 'cclua::plugin::JAnalytics::EventType'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen(nil)
.ifdef('*', '#ifdef CCLUA_BUILD_JANALYTICS')
.enum('LOGIN', 'cclua::plugin::JAnalytics::EventType::LOGIN')
.enum('REGISTER', 'cclua::plugin::JAnalytics::EventType::REGISTER')
.enum('PURCHASE', 'cclua::plugin::JAnalytics::EventType::PURCHASE')
.enum('BROWSE', 'cclua::plugin::JAnalytics::EventType::BROWSE')
.enum('COUNT', 'cclua::plugin::JAnalytics::EventType::COUNT')
.enum('CALCULATE', 'cclua::plugin::JAnalytics::EventType::CALCULATE')
typeconf 'cclua::plugin::JAnalytics'
.supercls(nil)
.reg_luatype(true)
.chunk(nil)
.luaopen([[cclua::runtime::registerFeature("janalytics", true);]])
.ifdef('*', '#ifdef CCLUA_BUILD_JANALYTICS')
.func(nil, 'static void init(const std::string &appKey, const std::string &channel)')
.func(nil, 'static void startTrackPage(const std::string &pageName)')
.func(nil, 'static void stopTrackPage(const std::string &pageName)')
.func(nil, 'static void trackEvent(cclua::plugin::JAnalytics::EventType type, cocos2d::ValueMap &value)')
.func(nil, 'static void identifyAccount(cocos2d::ValueMap &value)')
.func(nil, 'static void detachAccount()')
.func(nil, 'static void setFrequency(int frequency)')
.func(nil, 'static void setDebug(bool enable)')
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.