content stringlengths 5 1.05M |
|---|
require 'winapi'
io.stdout:setvbuf 'no'
local t1,t2
t1 = winapi.make_timer(500,function()
print 'gotcha'
end)
local k = 1
t2 = winapi.make_timer(400,function()
k = k + 1
print(k)
if k > 5 then
print 'killing'
t1:kill() -- kill the first timer
t2 = nil
return true -- and we will end now
end
end)
winapi.make_timer(1000,function()
print 'doo'
if not t2 then os.exit(0) end -- we all finish
end)
-- sleep forever...
winapi.sleep(-1)
|
-- BaseTest
-- Author:LuatTest
-- CreateDate:20201013
-- UpdateDate:20210901
module(..., package.seeall)
-- TODO:添加rtos.eatSoftDog,rtos.closeSoftDog,rtos.set_alarm,rtos.poweron,sim.setId,misc.getModelType
local loopTime = 30000
if LuaTaskTestConfig.baseTest.adcTest then
sys.taskInit(
function ()
local ADC0, ADC1
if LuaTaskTestConfig.modType == "8910" then
-- 8910
ADC0 = 2
ADC1 = 3
elseif LuaTaskTestConfig.modType == "1802" then
-- 1802
ADC0 = 0
ADC1 = 1
elseif LuaTaskTestConfig.modType == "1802S" then
-- 1802S
ADC0 = 0
ADC1 = 1
elseif LuaTaskTestConfig.modType == "1603" then
-- 1603
ADC0 = 1
ADC1 = 2
end
-- 读取adc
-- adcval为number类型,表示adc的原始值,无效值为0xFFFF
-- voltval为number类型,表示转换后的电压值,单位为毫伏,无效值为0xFFFF
local adcval, voltval
while true do
sys.wait(2000)
adc.open(ADC0)
adc.open(ADC1)
log.info("AdcTest.open", "ADC打开")
adcval, voltval = adc.read(ADC0)
log.info("AdcTest.ADC0.read", adcval, voltval)
adcval, voltval = adc.read(ADC1)
log.info("AdcTest.ADC1.read", adcval, voltval)
adc.close(ADC0)
adc.close(ADC1)
log.info("AdcTest.close", "ADC关闭")
end
end
)
end
-- BitTest
local function bitTest()
-- 左移运算
-- 0001 -> 0100
for i = 0, 31 do
local res = bit.bit(i)
if res == 2 ^ i then
log.info("BitTest.bit", "SUCCESS")
else
log.info("BitTest.bit", "FAIL")
end
end
-- 测试位数是否被置1
-- 第一个参数是是测试数字,第二个是测试位置。从右向左数0到7。是1返回true,否则返回false
-- 0101
for i = 0, 31 do
if bit.isset(0xFFFFFFFF, i) == true then
log.info("BitTest.isset", "SUCCESS")
else
log.error("BitTest.isset", "FAIL")
end
if bit.isset(0x00000000, i) == false then
log.info("BitTest.isset", "SUCCESS")
else
log.error("BitTest.isset", "FAIL")
end
end
-- 测试位数是否被置0
for i = 0, 31 do
if bit.isclear(0xFFFFFFFF, i) == false then
log.info("BitTest.isclear", "SUCCESS")
else
log.error("BitTest.isclear", "FAIL")
end
if bit.isclear(0x00000000, i) == true then
log.info("BitTest.isclear", "SUCCESS")
else
log.error("BitTest.isclear", "FAIL")
end
end
--在相应的位数置1
-- 0000 -> 1111
if bit.set(0, 0, 1, 2, 3, 4, 5, 6, 7) == 255 then
log.info("BitTest.set", "SUCCESS")
else
log.error("BitTest.set", "FAIL")
end
if bit.set(0, 6, 3, 2, 1, 7, 5, 0, 4) == 255 then
log.info("BitTest.set", "SUCCESS")
else
log.error("BitTest.set", "FAIL")
end
--在相应的位置置0
-- 0101 -> 0000
if bit.clear(0xFF, 0, 1, 2, 3, 4, 5, 6, 7) == 0 then
log.info("BitTest.clear", "SUCCESS")
else
log.error("BitTest.clear", "FAIL")
end
if bit.clear(0xFF, 6, 3, 2, 1, 7, 5, 0, 4) == 0 then
log.info("BitTest.clear", "SUCCESS")
else
log.error("BitTest.clear", "FAIL")
end
--按位取反
-- 0101 -> 1010
if bit.bnot(0xFFFFFFFF) == 0 then
log.info("BitTest.bnot", "SUCCESS")
else
log.error("BitTest.bnot", "FAIL")
end
if bit.bnot(0x00000000) == 0xFFFFFFFF then
log.info("BitTest.bnot", "SUCCESS")
else
log.error("BitTest.bnot", "FAIL")
end
if bit.bnot(0xF0F0F0F0) == 0x0F0F0F0F then
log.info("BitTest.bnot", "SUCCESS")
else
log.error("BitTest.bnot", "FAIL")
end
--与
-- 0001 && 0001 -> 0001
if bit.band(0xAAA, 0xAA0, 0xA00) == 0xA00 then
log.info("BitTest.band", "SUCCESS")
else
log.error("BitTest.band", "FAIL")
end
--或
-- 0001 | 0010 -> 0011
if bit.bor(0xA00, 0x0A0, 0x00A) == 0xAAA then
log.info("BitTest.bor", "SUCCESS")
else
log.error("BitTest.bor", "FAIL")
end
--异或,相同为0,不同为1
-- 0001 ⊕ 0010 -> 0011
if bit.bxor(0x01, 0x02, 0x04, 0x08) == 0x0F then
log.info("BitTest.bxor", "SUCCESS")
else
log.error("BitTest.bxor", "FAIL")
end
--逻辑左移
-- 0001 -> 0100
if bit.lshift(0xFFFFFFFF, 1) == -2 then
log.info("BitTest.lshift", "SUCCESS")
else
log.error("BitTest.lshift", "FAIL")
end
--逻辑右移,“001”
-- 0100 -> 0001
if bit.rshift(0xFFFFFFFF, 1) == 0x7FFFFFFF then
log.info("BitTest.rshift", "SUCCESS")
else
log.error("BitTest.rshift", "FAIL")
end
--算数右移,左边添加的数与符号有关
-- 0010 -> 0000
if bit.arshift(0xFFFFFFFF, 1) == -1 then
log.info("BitTest.arshift", "SUCCESS")
else
log.error("BitTest.arshift", "FAIL")
end
end
if LuaTaskTestConfig.baseTest.bitTest then
sys.timerLoopStart(bitTest, loopTime)
end
-- TODO 完善PACK测试
local function packTest()
--[[将一些变量按照格式包装在字符串.'z'有限零字符串,'p'长字节优先,'P'长字符优先,
'a'长词组优先,'A'字符串型,'f'浮点型,'d'双精度型,'n'Lua 数字,'c'字符型,'b'无符号字符型,'h'短型,'H'无符号短型
'i'整形,'I'无符号整形,'l'长符号型,'L'无符号长型,">"表示大端,"<"表示小端。]]
log.info("PackTest", string.toHex(pack.pack(">H", 0x3234)))
log.info("PackTest", string.toHex(pack.pack("<H", 0x3234)))
--字符串,无符号短整型,字节型,打包成二进制字符串。由于二进制不能输出,所以转化为十六进制输出。
log.info("PackTest", string.toHex(pack.pack(">AHb", "LUAT", 100, 10)))
--"LUAT\x00\x64\x0A"
local stringtest = pack.pack(">AHb", "luat", 999, 10)
--"nextpos"解析开始的位置,解析出来的第一个值val1,第二个val2,第三个val3,根据后面的格式解析
--这里的字符串要截取出来,如果截取字符串,后面的短整型和一个字节的数都会被覆盖。
nextpox1, val1, val2 = pack.unpack(string.sub(stringtest, 5, -1), ">Hb")
--nextpox1表示解包后最后的位置,如果包的长度是3,nextpox1输出就是4。匹配输出999,10
log.info("PackTest", nextpox1, val1, val2)
end
if LuaTaskTestConfig.baseTest.packTest then
sys.timerLoopStart(packTest, loopTime)
end
local function stringTest()
local testStr = "Luat is very NB,NB (10086)"
log.info("StringTest.Upper", string.upper(testStr))
log.info("StringTest.Lower", string.lower(testStr))
--第一个参数是目标字符串,第二个参数是标准字符串,第三个是待替换字符串,打印出"luat great"
log.info("StringTest.Gsub", string.gsub(testStr, "L%w%w%w", "AirM2M"))
--打印出目标字符串在查找字符串中的首尾位置
log.info("StringTest.Find", string.find(testStr, "NB", 1, true))
log.info("StringTest.Find", string.find(testStr, "N%w", 16, false))
log.info("StringTest.Reverse", string.reverse(testStr))
local i = 43981
log.info("StringTest.Format", string.format("This is %d test string : %s", i, testStr))
log.info("StringTest.Format", string.format("%d(Hex) = %x / %X", i, i, i))
--注意string.char或者string.byte只针对一个字节,数值不可大于256
--将相应的数值转化为字符
log.info("String.Char", string.char(33, 48, 49, 50, 97, 98, 99))
--第一个参数是字符串,第二个参数是位置。功能是:将字符串中所给定的位置转化为数值
log.info("String.Byte", string.byte("abc", 1))
log.info("String.Byte", string.byte("abc", 2))
log.info("String.Byte", string.byte("abc", 3))
log.info("String.len", string.len(testStr))
log.info("String.rep", string.rep(testStr, 2))
--匹配字符串,加()指的是返回指定格式的字符串,截取字符串中的数字
log.info("String.Match", string.match(testStr, "Luat (..) very NB"))
--截取字符串,第二个参数是截取的起始位置,第三个是终止位置。
log.info("String.Sub", string.sub(testStr, 1, 4))
log.info("String.ToHex", string.toHex(testStr))
log.info("String.ToHex", string.toHex(testStr, ","))
log.info("String.FromHex", string.fromHex("313233616263"))
-- log.info("String.ToValue", string.toValue("123abc"))
local utf8Len = string.utf8Len("Luat中国こにちはПривет🤣❤💚☢")
log.info("String.Utf8Len", utf8Len)
local table1 = string.utf8ToTable("Luat中国こにちはПривет🤣❤💚☢")
for k, v in pairs(table1) do
log.info("String.Utf8ToTable", k, v)
end
log.info("String.RawurlEncode", string.rawurlEncode("####133Luat中国こにちはПривет🤣❤💚☢"))
log.info("String.UrlEncode", string.urlEncode("####133Luat中国こにちはПривет🤣❤💚☢"))
log.info("String.UrlEncode", string.urlEncode("####133Luat中国こにちはПривет🤣❤💚☢"))
log.info("String.FormatNumberThousands", string.formatNumberThousands(1234567890))
local table2 = string.split("Luat,is,very,nb,", ",")
for k, v in pairs(table2) do
log.info("String.Split", k, v)
end
end
if LuaTaskTestConfig.baseTest.stringTest then
sys.timerLoopStart(stringTest, loopTime)
end
local function commonTest()
log.info("CommonTest.ucs2ToAscii", common.ucs2ToAscii("0030003100320033003400350036003700380039"))
log.info("CommonTest.nstrToUcs2Hex", common.nstrToUcs2Hex("+0123456789+0123456789+0123456789+0123456789+0123456789"))
log.info("CommonTest.numToBcdNum", string.toHex(common.numToBcdNum("8618126324567F")))
log.info("CommonTest.bcdNumToNum", common.bcdNumToNum(string.fromHex("688121364265F7")))
log.info("CommonTest.ucs2ToGb2312", common.ucs2ToGb2312(string.fromHex("xd98f2f66004e616755004300530032000f5cef7a167f017884768551b95b6c8f62633a4e470042003200330031003200167f017884764b6dd58b8551b95b")))
log.info("CommonTest.gb2312ToUcs2", string.toHex(common.gb2312ToUcs2(string.fromHex("D5E2CAC7D2BBCCF555544638B1E0C2EBB5C4C4DAC8DDD7AABBBBCEAA55435332B1E0C2EBB5C4B2E2CAD4C4DAC8DD"))))
log.info("CommonTest.ucs2beToGb2312", common.ucs2beToGb2312(string.fromHex("8fd9662f4e006761005500430053003259277aef7f167801768451855bb98f6c63624e3a0047004200320033003100327f16780176846d4b8bd551855bb9")))
log.info("CommonTest.gb2312ToUcs2be", string.toHex(common.gb2312ToUcs2be(string.fromHex("D5E2CAC7D2BBCCF555544638B1E0C2EBB5C4C4DAC8DDD7AABBBBCEAA55435332B1E0C2EBB5C4B2E2CAD4C4DAC8DD"))))
log.info("CommonTest.ucs2ToUtf8", common.ucs2ToUtf8(string.fromHex("d98f2f66004e61675500430053003200167f017884768551b95b6c8f62633a4e5500540046003800167f017884764b6dd58b8551b95b")))
log.info("CommonTest.utf8ToUcs2", string.toHex(common.utf8ToUcs2("这是一条UTF8编码的内容转换为UCS2编码的测试内容")))
log.info("CommonTest.ucs2beToUtf8", common.ucs2beToUtf8(string.fromHex("8fd9662f4e00676100550043005300327f167801768451855bb98f6c63624e3a00550054004600387f16780176846d4b8bd551855bb9")))
log.info("CommonTest.utf8ToUcs2be", string.toHex(common.utf8ToUcs2be("这是一条UTF8编码的内容转换为UCS2大端编码的测试内容")))
log.info("CommonTest.utf8ToGb2312", common.utf8ToGb2312("这是一条UTF8编码的内容转换为GB2312编码的测试内容"))
log.info("CommonTest.gb2312ToUtf8", common.gb2312ToUtf8(string.fromHex("D5E2CAC7D2BBCCF5474232333132B1E0C2EBB5C4C4DAC8DDD7AABBBBCEAA55544638B1E0C2EBB5C4B2E2CAD4C4DAC8DD")))
local table1 = common.timeZoneConvert(2020, 10, 14, 11, 24, 25, 8, 8)
for k, v in pairs(table1) do
log.info("CommonTest.timeZoneConvert", k, v)
end
end
if LuaTaskTestConfig.baseTest.commonTest then
sys.timerLoopStart(commonTest, loopTime)
end
local function miscTest()
-- misc.setClock({year=2017, month=2, day=14, hour=14, min=2, sec=58})
local table1 = misc.getClock()
for k, v in pairs(table1) do
log.info("MiscTest.GetClock", k, v)
end
log.info("MiscTest.GetWeek", misc.getWeek())
-- 获取校准标志
log.info("MiscTest.GetCalib", misc.getCalib())
local setSn = string.rep("12345678", 8)
misc.setSn(
setSn,
function()
log.info("MiscTest.SetSnCb", "SUCCESS")
local getSn = misc.getSn()
log.info("MiscTest.GetSn", getSn)
if getSn == setSn then
log.info("MiscTest.GetSn", "SUCCESS")
local getSnLen = string.len(getSn)
log.info("MiscTest.GetSn.len", getSnLen)
if getSnLen == 64 then
log.info("MiscTest.GetSn.len", "SUCCESS")
else
log.error("MiscTest.GetSn.len", "FAIL")
end
else
log.error("MiscTest.GetSn", "FAIL")
end
end
)
log.info("MiscTest.GetImei", misc.getImei())
log.info("MiscTest.GetVbatt", misc.getVbatt())
log.info("MiscTest.GetMuid", misc.getMuid())
-- 通道0,频率为50000Hz,占空比为0.2
misc.openPwm(0, 500, 100)
log.info("MiscTest.OpenPwm.0.Open", "SUCCESS")
-- 通道1,时钟周期为500ms,高电平时间为125毫秒
misc.openPwm(1, 2, 8)
log.info("MiscTest.OpenPwm.1.Open", "SUCCESS")
sys.wait(5000)
misc.closePwm(0)
log.info("MiscTest.OpenPwm.0.Close", "SUCCESS")
misc.closePwm(1)
log.info("MiscTest.OpenPwm.1.Close", "SUCCESS")
end
if LuaTaskTestConfig.baseTest.miscTest then
sys.taskInit(
function ()
while true do
sys.wait(loopTime)
miscTest()
end
end
)
end
if LuaTaskTestConfig.baseTest.netTest then
sys.taskInit(
function()
sys.waitUntil("IP_READY_IND")
while true do
net.switchFly(true)
log.info("NetTest.SwitchFly", "打开飞行模式")
sys.wait(5000)
net.switchFly(false)
log.info("NetTest.SwitchFly", "关闭飞行模式")
sys.waitUntil("IP_READY_IND")
-- TODO 查询到的NETMODE和实际情况是否一致(欠费卡 未注册的状态)
log.info("NetTest.GetNetMode", net.getNetMode())
log.info("NetTest.GetState", net.getState())
log.info("NetTest.GetMcc", net.getMcc())
log.info("NetTest.GetMnc", net.getMnc())
log.info("NetTest.GetLac", net.getLac())
log.info("NetTest.GetCi", net.getCi())
log.info("NetTest.GetRssi", net.getRssi())
log.info("NetTest.GetCellInfo", net.getCellInfo())
log.info("NetTest.GetCellInfoExt", net.getCellInfoExt())
log.info("NetTest.GetTa", net.getTa())
-- net.getMultiCell(function(cells)
-- for k, v in pairs(cells) do
-- log.info("NetTest.GetMultiCell" .. k, v)
-- if type(v) == "table" then
-- for i, j in pairs(v) do
-- print(i, j)
-- end
-- end
-- end
-- end)
log.info("NetTest.CengQueryPoll.开启查询", net.cengQueryPoll(10000))
log.info("NetTest.CsqQueryPoll.开启查询", net.csqQueryPoll(10000))
log.info("NetTest.StartQueryAll.开启查询", net.startQueryAll(10000))
sys.wait(60000)
log.info("NetTest.StopQueryAll.关闭查询", net.stopQueryAll())
log.info("NetTest.SetEngMode.关闭工程模式", net.setEngMode(0))
sys.wait(10000)
log.info("NetTest.SetEngMode.开启工程模式", net.setEngMode(1))
end
end
)
end
local function ntpTest()
local ntpServers = ntp.getServers()
for k, v in pairs(ntpServers) do
log.info("NtpTest.NtpServer" .. k, v)
end
ntp.setServers({"www.baidu.com", "www.sina.com"})
local ntpServers = ntp.getServers()
for k, v in pairs(ntpServers) do
log.info("NtpTest.NtpServer" .. k, v)
end
local ntpStatus = ntp.isEnd()
log.info("NtpTest.Status", ntpStatus)
end
if LuaTaskTestConfig.baseTest.ntpTest then
sys.timerLoopStart(ntpTest, loopTime)
end
if LuaTaskTestConfig.baseTest.nvmTest then
sys.taskInit(
function()
require "Config"
local count = 2
local boolVal = true
nvm.init("Config.lua")
while true do
log.info("NvmTest.StrPara", nvm.get("strPara"))
log.info("NvmTest.NumPara", nvm.get("numPara"))
log.info("NvmTest.BoolPara", nvm.get("boolPara"))
local personTablePara = nvm.get("personTablePara")
log.info("NvmTest.PersonTablePara", personTablePara[1], personTablePara[2], personTablePara[3])
log.info("NvmTest.ScoreTablePara.chinese", nvm.gett("scoreTablePara", "chinese"))
log.info("NvmTest.ScoreTablePara.math", nvm.gett("scoreTablePara", "math"))
log.info("NvmTest.ScoreTablePara.english", nvm.gett("scoreTablePara", "english"))
local table2 = nvm.gett("manyTablePara", "table2")
for k, v in pairs(table2) do
log.info("NvmTest.manyTablePara.table2." .. k, v)
end
sys.wait(10000)
table2.table23 = boolVal
nvm.sett("manyTablePara", "table2", table2)
nvm.set("strPara", "LuatTest" .. count)
nvm.set("numPara", count)
nvm.set("boolPara", boolVal)
nvm.set("personTablePara", {"name" .. count, "age" .. count, "sex" .. count})
nvm.sett("scoreTablePara", "chinese", count)
nvm.flush()
log.info("NvmTest.Flush", "SUCCESS")
count = count + 1
boolVal = not boolVal
-- TODO BUG?
-- nvm.restore()
end
end
)
end
local function tableTest()
local fruits = {"banana", "orange", "apple"}
log.info("TableTest.Concat", table.concat(fruits))
log.info("TableTest.Concat", table.concat(fruits, ", "))
log.info("TableTest.Concat", table.concat(fruits,", ", 2, 3))
table.insert(fruits, "mango")
log.info("TableTest.Insert.4", fruits[4])
table.insert(fruits, 2, "grapes")
log.info("TableTest.Insert.2", fruits[2])
log.info("TableTest.Insert.5",fruits[5])
lastest = table.remove(fruits)
log.info("TableTest.Remove", lastest)
firstest = table.remove(fruits, 1)
log.info("TableTest.Remove", firstest)
end
if LuaTaskTestConfig.baseTest.tableTest then
sys.timerLoopStart(tableTest, loopTime)
end
local function pmTest()
log.info("PmTest.isSleep", pm.isSleep())
pm.wake("PmTest")
log.info("PmTest.wake", "SUCCESS")
log.info("PmTest.isSleep", pm.isSleep())
pm.sleep("PmTest")
log.info("PmTest.sleep", "SUCCESS")
log.info("PmTest.isSleep", pm.isSleep())
end
if LuaTaskTestConfig.baseTest.pmTest then
sys.timerLoopStart(pmTest, loopTime)
end
local function longCb()
log.info("PowerKeyTest", "LongCb")
-- rtos.poweroff()
end
local function shortCb()
log.info("PowerKeyTest", "ShortCb")
end
if LuaTaskTestConfig.baseTest.powerKeyTest then
require "powerKey"
powerKey.setup(3000, longCb, shortCb)
end
if LuaTaskTestConfig.baseTest.rilTest then
local rilTestCount = 1
sys.taskInit(
function()
while true do
log.info("RilTest.RilTestCount", "第" .. rilTestCount .. "次")
ril.request("AT+CSQ")
sys.wait(2000)
ril.request("AT+CGDCONT?")
sys.wait(2000)
ril.request("AT+CGATT?")
sys.wait(2000)
ril.request("AT+EEMGINFO?")
sys.wait(2000)
rilTestCount = rilTestCount + 1
end
end
)
end
local function simTest()
if sim.getIccid() == nil then
log.error("SimTest.GetIccid", "FAIL", "查询失败")
else
log.info("SimTest.GetIccid", "SUCCESS", sim.getIccid())
end
log.info("SimTest.GetImsi", sim.getImsi())
log.info("SimTest.GetMcc", sim.getMcc())
log.info("SimTest.GetMnc", sim.getMnc())
log.info("SimTest.GetStatus", sim.getStatus())
-- 8910 lib 已经没有sim.getType() 这个方法了
-- log.info("SimTest.GetType", sim.getType())
-- 物联网卡不支持查询号码
-- sim.setQueryNumber(true)
-- log.info("SimTest.SetQueryNumber", "SUCCESS")
-- log.info("SimTest.GetNumber", sim.getNumber())
end
if LuaTaskTestConfig.baseTest.simTest then
sys.timerLoopStart(simTest, loopTime)
end
if LuaTaskTestConfig.baseTest.sysTest then
local count = 1
local timerId
timerId = sys.timerLoopStart(
function()
if count < 10 then
log.info("SysTest.timerLoopStart", count)
log.info("SysTest.timerIsActive", sys.timerIsActive(timerId))
count = count + 1
else
sys.timerStop(timerId)
log.info("SysTest.timerStop", "定时器停止")
log.info("SysTest.timerIsActive", sys.timerIsActive(timerId))
log.info("SysTest.Restart", "重启测试")
sys.restart("重启测试")
end
end,
3000
)
log.info("SysTest.timerId", timerId)
end
local function jsonTest()
local torigin =
{
KEY1 = "VALUE1",
KEY2 = "VALUE2",
KEY3 = "VALUE3",
KEY4 = "VALUE4",
KEY5 = {KEY5_1 = "VALUE5_1", KEY5_2 = "VALUE5_2"},
KEY6 = {1, 2, 3},
}
local jsondata = json.encode(torigin)
log.info("JsonTest.encode", jsondata)
--{"KEY3":"VALUE3","KEY4":"VALUE4","KEY2":"VALUE2","KEY1":"VALUE1","KEY5":{"KEY5_2":"VALU5_2","KEY5_1":"VALU5_1"}},"KEY6":[1,2,3]}
local origin = "{\"KEY3\":\"VALUE3\",\"KEY4\":\"VALUE4\",\"KEY2\":\"VALUE2\",\"KEY1\":\"VALUE1\",\"KEY5\":{\"KEY5_2\":\"VALUE5_2\",\"KEY5_1\":\"VALUE5_1\"},\"KEY6\":[1,2,3]}"
local tjsondata, result, errinfo = json.decode(origin)
if result and type(tjsondata) == "table" then
log.info("JsonTest.decode KEY1", tjsondata["KEY1"])
log.info("JsonTest.decode KEY2", tjsondata["KEY2"])
log.info("JsonTest.decode KEY3", tjsondata["KEY3"])
log.info("JsonTest.decode KEY4", tjsondata["KEY4"])
log.info("JsonTest.decode KEY5", tjsondata["KEY5"]["KEY5_1"], tjsondata["KEY5"]["KEY5_2"])
log.info("JsonTest.decode KEY6", tjsondata["KEY6"][1], tjsondata["KEY6"][2], tjsondata["KEY6"][3])
else
log.error("JsonTest.decode error", errinfo)
end
end
if LuaTaskTestConfig.baseTest.jsonTest then
sys.timerLoopStart(jsonTest, loopTime)
end
local function rtosTest()
local testPath = "/RtosTestPath"
log.info("RtosTest.Poweron_reason", rtos.poweron_reason())
if rtos.make_dir(testPath) then
log.info("RtosTest.MakeDir", "SUCCESS")
else
log.error("RtosTest.MakeDir", "FAIL")
end
if rtos.remove_dir(testPath) then
log.info("RtosTest.RemoveDir", "SUCCESS")
else
log.error("RtosTest.RemoveDir", "FAIL")
end
log.info("RtosTest.Toint64.little", string.toHex(rtos.toint64("12345678", "little")))
log.info("RtosTest.Toint64.big", string.toHex(rtos.toint64("12345678", "big")))
end
if LuaTaskTestConfig.baseTest.rtosTest then
sys.timerLoopStart(rtosTest, loopTime)
end
local function mathTest()
log.info("MathTest.Abs", math.abs(-10086))
-- log.info("MathTest.Ceil", math.ceil(101.456))
-- log.info("MathTest.Floor", math.floor(101.456))
log.info("MathTest.Fmod", math.fmod(10, 3))
log.info("MathTest.Huge", math.huge)
-- log.info("MathTest.Max", math.max(1, 2, 3, 4.15, 5.78))
-- log.info("MathTest.Min", math.min(1, 2, 3, 4.15, 5.78))
-- log.info("MathTest.MaxInteger", math.maxinteger)
-- log.info("MathTest.MinInteger", math.mininteger)
-- log.info("MathTest.Modf", math.modf(1.15))
log.info("MathTest.Pi", math.pi)
log.info("MathTest.Sqrt", math.sqrt(9))
-- log.info("MathTest.ToInteger", math.tointeger(1.123))
-- log.info("MathTest.Type", math.type(1))
-- log.info("MathTest.Type", math.type(1.123))
-- log.info("MathTest.Type", math.type("1.123"))
-- log.info("MathTest.Ult", math.ult(1.1,2.2))
-- log.info("MathTest.Ult", math.ult(2.2,1.1))
end
if LuaTaskTestConfig.baseTest.mathTest then
sys.timerLoopStart(mathTest, loopTime)
end
if LuaTaskTestConfig.baseTest.zipTest then
local tag = "ZipTest"
local zipFileName = "/sdcard0/test.zip"
sys.taskInit(
function ()
sys.wait(5000)
if io.mount(io.SDCARD) == 0 then
log.error(tag, "SD卡挂载FAIL")
return
end
log.info(tag, "SD卡挂载SUCCESS")
while true do
local zfile, err = zip.open(zipFileName)
if zfile == nil then
log.error(tag .. ".open", "压缩文件" .. zipFileName .. "打开FAIL")
log.error(tag .. ".err", err)
break
end
for file in zfile:files() do
local wf = io.open("/sdcard0/" .. file.filename, "w")
if wf == nil then
log.error(tag, "中文名字文件需要编码转换")
local tmp = common.gb2312ToUtf8(file.filename, #file.filename)
wf = io.open("/sdcard0/" .. tmp, "w")
end
local rf, err = zfile:open(file.filename)
if rf == nil then
log.error(tag .. ".open", "压缩文件" .. file.filename .. "打开FAIL")
log.error(tag .. ".err", err)
break
end
local rfData = rf:read("*a")
wf:write(rfData)
wf:close()
rf:close()
end
zfile:close()
end
if io.unmount(io.SDCARD) == 0 then
log.error(tag, "SD卡卸载FAIL")
else
log.info(tag, "SD卡卸载SUCCESS")
end
end
)
end
if LuaTaskTestConfig.baseTest.protoBufferTest then
local tag = "ProtoBufferTest"
local pb = require "lua_protobuf"
local tracker = {
query = "www",
page_number = 8,
result_per_page = 100,
}
sys.taskInit(
function ()
pb.loadfile("/lua/tracker.pb")
while true do
sys.wait(5000)
local encodeData = pb.encode("tracker.SearchRequest", tracker)
log.info(tag .. ".encodeData", encodeData:toHex())
local decodeData = pb.decode("tracker.SearchRequest", encodeData)
for k, v in pairs(decodeData) do
if k == "query" then
if v == "www" then
log.info(tag .. ".decode", "SUCCESS")
else
log.error(tag .. ".decode", "FAIL")
end
elseif k == "page_number" then
if v == 8 then
log.info(tag .. ".decode", "SUCCESS")
else
log.error(tag .. ".decode", "FAIL")
end
elseif k == "result_per_page" then
if v == 100 then
log.info(tag .. ".decode", "SUCCESS")
else
log.error(tag .. ".decode", "FAIL")
end
end
end
end
end
)
end
--[[
U盘功能测试程序:
注意: 1. U盘的盘符固定为:/usbmsc0
2. 开机可以先mount,如果mount失败就使用格式化format,一般mount之后需要等待2秒左右再对文件进行操作
3. 读写接口都是标准的
4. lua写文件和PC端并不能同步显示,需要重新插拔一下USB
]]
if LuaTaskTestConfig.baseTest.uDiskTest == true then
local tag = "uDiskTest"
sys.taskInit(
function ()
while true do
sys.wait(5000)
if io.mount(io.USBMSC) == 0 then
io.format(io.USBMSC)
continue
end
log.info(tag .. ".totalSize", rtos.get_fs_total_size(2) .. "B")
log.info(tag .. ".freeSize", rtos.get_fs_free_size(2) .. "B")
io.writeFile("/usbmsc0/test.txt", "uDiskTest")
if io.readFile() == "uDiskTest" then
log.info(tag .. ".fileTest", "SUCCESS")
else
log.error(tag .. ".fileTest", "FAIL")
end
io.unmount(io.USBMSC)
end
end
)
end
local function setStorageCb(result)
if result then
log.info("PbTest.SetStorageCb", "SUCCESS")
else
log.error("PbTest.SetStorageCb", "FAIL")
end
end
local function deleteCb(result)
if result then
log.info("PbTest.DeleteCb", "SUCCESS")
else
log.error("PbTest.DeleteCb", "FAIL")
end
end
local function writeCb(result)
if result then
log.info("PbTest.WriteCb", "SUCCESS")
else
log.error("PbTest.WriteCb", "FAIL")
end
end
function readCb(result, name, number)
if result then
log.info("PbTest.ReadCb", "SUCCESS", name, number)
else
log.error("PbTest.ReadCb", "FAIL", name, number)
end
end
if LuaTaskTestConfig.baseTest.pbTest then
sys.taskInit(
function()
local index = 1
sys.wait(30000)
pb.setStorage("SM", setStorageCb)
while true do
sys.wait(5000)
pb.delete(index, deleteCb)
sys.wait(5000)
pb.write(index, "LuatTest" .. index, "1234567890", writeCb)
sys.wait(5000)
pb.read(index, readCb)
index = (index == 50) and 1 or (index + 1)
end
end
)
end |
if (SERVER) then return end
hook.Add("LoadFonts", "nutOutfitPororiFont", function(font, genericFont)
surface.CreateFont("nutOutfitFont", {
font = font,
extended = true,
size = ScreenScale(30),
weight = 1000
})
end)
local PANEL = {}
function PANEL:setOutfit(data)
self.outfit = data
end
function PANEL:setOutfitData(index, value)
local data = self.outfit[index] -- part
if (type(data.outfits) == "function") then
data.outfits = data.outfits(self.Entity)
end
if (data and data.outfits) then
local cnt = (table.Count(data.outfits))
value = value % cnt
value = (value == 0 and cnt or value)
if (data.func) then
data.func(self.Entity, data.outfits[value], data)
end
end
self.stored = self.stored or {}
self.stored[index] = value
end
local MODEL_ANGLE = Angle(0, 45, 0)
local MODEL_VECTOR = Vector(0, 0, 4)
function PANEL:LayoutEntity()
local entity = self.Entity
entity:SetAngles(MODEL_ANGLE)
entity:SetPos(MODEL_VECTOR)
end
function PANEL:getOutfitData(index, value)
return self.stored[index] or 0
end
function PANEL:getOutfits(index, value)
return self.stored
end
vgui.Register("nutOutfitModel", PANEL, "DModelPanel")
local PANEL = {}
local gradient = nut.util.getMaterial("vgui/gradient-u")
local gradient2 = nut.util.getMaterial("vgui/gradient-d")
local alpha = 80
function PANEL:Init()
if (nut.gui.outfit) then
nut.gui.outfit:Remove()
nut.gui.outfit = nil
end
nut.gui.outfit = self
self:SetSize(ScrW(), ScrH())
self:SetAlpha(0)
self:AlphaTo(255, 0.25, 0)
self:SetPopupStayAtBack(true)
self.title = self:Add("DPanel")
self.title:Dock(TOP)
self.title:SetHeight(self:GetSize()*.1)
self:setupTitle(self.title, self:GetSize()*.1)
self.bottom = self:Add("DPanel")
self.bottom:Dock(BOTTOM)
self.bottom:SetHeight(self:GetSize()*.05)
self.bottom.Paint = function() end
self:setupBottom(self.bottom, self:GetSize()*.05)
self.contents = self:Add("DPanel")
self.contents:Dock(FILL)
self.contents.Paint = function() end
self:setupContents(self.contents)
self:MakePopup()
self:setupData()
end
function PANEL:setupTitle(ab)
function self.title:Paint(w, h)--(text, x, y, color, alignX, alignY, font, alpha)
nut.util.drawText(L"outfit", w/2, h/2, color_white, 1, 1, "nutOutfitFont")
end
end
function PANEL:setupBottom(ab, ac)
self.close = ab:Add("DButton")
self.close:SetText(L"cancel")
self.close:SetFont("nutMediumFont")
self.close:Dock(RIGHT)
self.close:SetTextColor(color_white)
self.close:SetWidth(self:GetWide()*.2)
self.close:DockMargin(ac * .2, ac * .2, ac * .2, ac * .2)
self.close.DoClick = function()
surface.PlaySound("ui/deny.wav")
self:remove()
end
self.apply = ab:Add("DButton")
self.apply:SetText(L"apply")
self.apply:SetFont("nutMediumFont")
self.apply:Dock(RIGHT)
self.apply:SetTextColor(color_white)
self.apply:SetWidth(self:GetWide()*.2)
self.apply:DockMargin(ac * .2, ac * .2, ac * .2, ac * .2)
self.apply.DoClick = function()
local outfits = self.model:getOutfits()
surface.PlaySound("ui/boop.wav")
netstream.Start("nutApplyOutfit", outfits)
end
end
function PANEL:setupContents(ab)
self.cost = ab:Add("DPanel")
self.cost:Dock(BOTTOM)
self.cost:SetHeight(50)
self.left = ab:Add("DPanelList")
self.left:Dock(LEFT)
self.left:SetWidth(self:GetWide()*.2)
self.left:DockMargin(10, 10, 10, 10)
self.right = ab:Add("DPanelList")
self.right:Dock(RIGHT)
self.right:SetWidth(self:GetWide()*.2)
self.right:DockMargin(10, 10, 10, 10)
self.model = ab:Add("nutOutfitModel")
self.model:SetFOV(80)
self.model:Dock(FILL)
self.model:DockMargin(10, 10, 10, 10)
self.cost.price = 0
function self.cost:Paint(w, h)--(text, x, y, color, alignX, alignY, font, alpha)
nut.util.drawText(L("outfitCost", nut.currency.get(self.price)), w/2, h/2, color_white, 1, 1, "nutMediumFont")
end
end
function PANEL:updateCost()
local price = 0
local char = LocalPlayer():getChar()
local outfitList = self.model.outfit
local charOutfits = char:getData("outfits", {})
for k, v in ipairs(outfitList) do
local index = self.model:getOutfitData(k)
local data = outfitList[k].outfits
if (data) then
local info = data[index]
if (info) then
if ((charOutfits[k] or 1) != index) then
price = price + info.price or 0
end
end
end
end
self.cost.price = price
end
function PANEL:setupData()
local client = LocalPlayer()
local char = client:getChar()
if (char) then
local mdl = char:getModel()
self.model:SetModel(mdl)
local outfitList = OUTFIT_REGISTERED[OUTFIT_DATA[mdl:lower()].uid]
if (outfitList) then
for i = 0, 1 do
for k, v in ipairs(outfitList) do
local t = (i == 0) and self.left or self.right
local b = t:Add("DLabel")
b:SetText(L(v.name))
b:SetHeight(50)
b:SetContentAlignment(5)
b:SetFont("nutMediumFont")
t:AddItem(b)
local b = t:Add("DButton")
b:SetText((i == 0) and "s" or "t")
b:SetFont("nutIconsMedium")
b:SetTextColor(color_white)
b:SetHeight(50)
t:AddItem(b)
b.DoClick = function()
local left = (i == 0) and -1 or 1
surface.PlaySound("ui/bip.wav")
local wow = self.model:getOutfitData(k)
self.model:setOutfitData(k, wow + left)
self:updateCost()
end
end
end
self.model:setOutfit(outfitList)
local charOutfits = char:getData("outfits", {})
for k, v in ipairs(outfitList) do
self.model:setOutfitData(k, charOutfits[k] or 1)
end
end
end
end
function PANEL:OnKeyCodePressed(key)
self.noAnchor = CurTime() + .5
if (key == KEY_F1) then
self:remove()
end
end
local color_bright = Color(240, 240, 240, 180)
function PANEL:Paint(w, h)
nut.util.drawBlur(self, 12)
surface.SetDrawColor(0, 0, 0)
surface.SetMaterial(gradient)
surface.DrawTexturedRect(0, 0, w, h)
end
function PANEL:OnRemove()
end
function PANEL:remove()
CloseDermaMenus()
if (!self.closing) then
self:AlphaTo(0, 0.25, 0, function()
self:Remove()
end)
self.closing = true
end
end
vgui.Register("nutOutfit", PANEL, "EditablePanel") |
ESX = nil
local playerCoords, playerPed
local evidence = {}
local nearbyItems = {}
nearbyItems.bullet = {}
nearbyItems.casing = {}
nearbyItems.blood = {}
local weapon, itemCount
local synced = false
CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Wait(0)
end
while ESX.GetPlayerData().job == nil do
Wait(10)
end
ESX.PlayerData = ESX.GetPlayerData()
ESX.TriggerServerCallback('linden_evidence:getEvidence', function(data)
evidence = data
synced = true
end)
end)
RegisterNetEvent('linden_evidence:updateEvidence')
AddEventHandler('linden_evidence:updateEvidence', function(data)
evidence = data
synced = true
end)
function Draw3DText(x, y, z, text)
local onScreen, _x, _y = World3dToScreen2d(x, y, z)
local px,py,pz=table.unpack(GetGameplayCamCoords())
if onScreen then
SetTextScale(0.35, 0.35)
SetTextFont(4)
SetTextProportional(1)
SetTextColour(255, 255, 255, 215)
SetTextDropShadow(0, 0, 0, 55)
SetTextEdge(0, 0, 0, 150)
SetTextDropShadow()
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(text)
DrawText(_x,_y)
end
end
local lastTriggered = GetGameTimer()
AddEventHandler('gameEventTriggered', function (name, args)
if name == 'CEventNetworkEntityDamage' then
local timer = GetGameTimer()
if timer - lastTriggered > 500 then
local victim = args[1]
local attacker = args[2]
local isFatal = args[4]
local weaponHash = args[5]
local isMelee = args[10]
if not playerPed then playerPed = PlayerPedId() end
if victim == playerPed then
coords = GetEntityCoords(playerPed)
local ground, impactZ
repeat
ground, impactZ = GetGroundZFor_3dCoord(coords.x, coords.y, coords.z, 1)
until ground
coords = vector3(coords.x, coords.y, (impactZ + 1.0))
TriggerServerEvent('linden_evidence:addEvidence', false, false, false, coords)
lastTriggered = GetGameTimer()
end
end
end
end)
RegisterNetEvent('ox_inventory:currentWeapon')
AddEventHandler('ox_inventory:currentWeapon', function(item)
weapon = item
end)
CreateThread(function()
local shoothread = 250
while true do
playerPed = PlayerPedId()
if IsPlayerFreeAiming(PlayerId()) then
shoothread = 0
if IsPedShooting(playerPed) and synced and not (weapon.name == 'WEAPON_STUNGUN') then
local source, bullet, casing = {}, {}, {}, {}
local hitEntity, entity = GetEntityPlayerIsFreeAimingAt(PlayerId())
local impacted, impactCoords = GetPedLastWeaponImpactCoord(playerPed)
if impacted then
local curWeapon = GetSelectedPedWeapon(playerPed)
source = PlayerPedId()
coords = GetEntityCoords(source)
impactCoords = vector3(impactCoords.x, impactCoords.y, (impactCoords.z + 0.5))
coords = vector3(coords.x, coords.y, (coords.z + 0.5))
local ground, impactZ
repeat
ground, impactZ = GetGroundZFor_3dCoord(impactCoords.x, impactCoords.y, impactCoords.z, 1)
until ground
impactCoords = vector3(impactCoords.x, impactCoords.y, (impactZ + 0.5))
local ground, coordZ
repeat
ground, coordZ = GetGroundZFor_3dCoord(coords.x, coords.y, coords.z, 1)
until ground
casingCoords = vector3(coords.x, coords.y, (coordZ + 0.9))
bullet.coords = impactCoords
casing.coords = casingCoords
weapondata = weapon
TriggerServerEvent('linden_evidence:addEvidence', weapondata, bullet, casing)
end
end
end
Wait(shoothread)
end
end)
CreateThread(function()
if IsPedArmed(PlayerPedId(), 7) then
SetCurrentPedWeapon(PlayerPedId(), GetHashKey('WEAPON_UNARMED'), true)
end
while true do
canCollect = false
playerCoords = GetEntityCoords(PlayerPedId())
if GetSelectedPedWeapon(PlayerPedId()) == `WEAPON_FLASHLIGHT` and IsPlayerFreeAiming(PlayerId()) then
if nearbyItems ~= nil and synced then
for k, v in pairs(evidence.bullet) do
local distance = #(playerCoords - v.coords)
if distance < 2.0 then
local items = {
['WEAPON_ASSAULTSHOTGUN']='Shotgun Pellets',
['WEAPON_AUTOSHOTGUN']='Shotgun Pellets',
['WEAPON_BULLPUPSHOTGUN']='Shotgun Pellets',
['WEAPON_DBSHOTGUN']='Shotgun Pellets',
['WEAPON_SAWNOFFSHOTGUN']='Shotgun Pellets',
['WEAPON_PUMPSHOTGUN']='Shotgun Pellets',
['WEAPON_PUMPSHOTGUN_MK2']='Shotgun Pellets',
['WEAPON_HEAVYSHOTGUN']='Shotgun Pellets',
['WEAPON_PISTOL']='9mm bullet',
['WEAPON_COMBATPISTOL']='.45 bullet',
['WEAPON_APPISTOL']='.45 bullet',
['WEAPON_PISTOL50']='.50 bullet',
['WEAPON_PISTOL_MK2']='.45 bullet',
['WEAPON_REVOLVER_MK2']='.44 bullet',
['WEAPON_SNSPISTOL']='.45 bullet',
['WEAPON_SNSPISTOL_MK2']='.45 bullet',
['WEAPON_HEAVYPISTOL']='.45 bullet',
['WEAPON_MARKSMANPISTOL']='.22 bullet',
['WEAPON_REVOLVER']='.38 bullet',
['WEAPON_VINTAGEPISTOL']='9mm bullet',
['WEAPON_MACHINEPISTOL']='9mm bullet',
['WEAPON_MINISMG']='9mm bullet',
['WEAPON_MICROSMG']='9mm bullet',
['WEAPON_COMBATPDW']='9mm bullet',
['WEAPON_SMG']='9mm bullet',
['WEAPON_SMG_MK2']='9mm bullet',
['WEAPON_ASSAULTSMG']='9mm bullet',
['WEAPON_ASSAULTRIFLE']='7.62 bullet',
['WEAPON_ASSAULTRIFLE_MK2']='7.62 bullet',
['WEAPON_CARBINERIFLE']='5.56 bullet',
['WEAPON_CARBINERIFLE_MK2']='5.56 bullet',
['WEAPON_COMPACTRIFLE']='7.62 bullet',
['WEAPON_COMBATRIFLE']='5.56 bullet',
['WEAPON_ADVANCEDRIFLE']='7.62 bullet',
['WEAPON_SPECIALCARBINE']='7.62 bullet',
['WEAPON_SPECIALCARBINE_MK2']='7.62 bullet',
['WEAPON_TACTICALRIFLE']='7.62 bullet',
['WEAPON_BULLPUPRIFLE']='5.56 bullet',
['WEAPON_BULLPUPRIFLE_MK2']='5.56 bullet',
}
local item = items[v.weapon.name]
local mCoords = "Found near" .. GetStreetNameFromHashKey(GetStreetNameAtCoord(playerCoords.x, playerCoords.y, playerCoords.z))
if not item then item = 'Bullet' end
Draw3DText(v.coords.x, v.coords.y, v.coords.z, item)
if distance < 1.0 then
nearbyItems.bullet[k] = v
canCollect = true
elseif nearbyItems.bullet[k] then nearbyItems.bullet[k] = nil end
elseif nearbyItems.bullet[k] then nearbyItems.bullet[k] = nil end
end
for k, v in pairs(evidence.casing) do
local distance = #(playerCoords - v.coords)
if distance < 2.0 then
local items = {
['WEAPON_ASSAULTSHOTGUN']='Shotgun Shell',
['WEAPON_AUTOSHOTGUN']='Shotgun Shell',
['WEAPON_BULLPUPSHOTGUN']='Shotgun Shell',
['WEAPON_DBSHOTGUN']='Shotgun Shell',
['WEAPON_SAWNOFFSHOTGUN']='Shotgun Shell',
['WEAPON_PUMPSHOTGUN']='Shotgun Shell',
['WEAPON_PUMPSHOTGUN_MK2']='Shotgun Shell',
['WEAPON_HEAVYSHOTGUN']='Shotgun Shell',
['WEAPON_PISTOL']='9mm casing',
['WEAPON_COMBATPISTOL']='.45 casing',
['WEAPON_APPISTOL']='.45 casing',
['WEAPON_PISTOL50']='.50 casing',
['WEAPON_PISTOL_MK2']='.45 casing',
['WEAPON_REVOLVER_MK2']='.44 casing',
['WEAPON_SNSPISTOL']='.45 casing',
['WEAPON_SNSPISTOL_MK2']='.45 casing',
['WEAPON_HEAVYPISTOL']='.45 casing',
['WEAPON_MARKSMANPISTOL']='.22 casing',
['WEAPON_REVOLVER']='.38 casing',
['WEAPON_VINTAGEPISTOL']='9mm casing',
['WEAPON_MACHINEPISTOL']='9mm casing',
['WEAPON_MINISMG']='9mm casing',
['WEAPON_MICROSMG']='9mm casing',
['WEAPON_COMBATPDW']='9mm casing',
['WEAPON_SMG']='9mm casing',
['WEAPON_SMG_MK2']='9mm casing',
['WEAPON_ASSAULTSMG']='9mm casing',
['WEAPON_ASSAULTRIFLE']='7.62 casing',
['WEAPON_ASSAULTRIFLE_MK2']='7.62 casing',
['WEAPON_CARBINERIFLE']='5.56 casing',
['WEAPON_CARBINERIFLE_MK2']='5.56 casing',
['WEAPON_COMPACTRIFLE']='7.62 casing',
['WEAPON_COMBATRIFLE']='5.56 casing',
['WEAPON_ADVANCEDRIFLE']='7.62 casing',
['WEAPON_SPECIALCARBINE']='7.62 casing',
['WEAPON_SPECIALCARBINE_MK2']='7.62 casing',
['WEAPON_TACTICALRIFLE']='7.62 casing',
['WEAPON_BULLPUPRIFLE']='5.56 casing',
['WEAPON_BULLPUPRIFLE_MK2']='5.56 casing',
}
local item = items[v.weapon.name]
local mCoords = GetStreetNameFromHashKey(GetStreetNameAtCoord(playerCoords.x, playerCoords.y, playerCoords.z))
if not item then item = 'Bullet Casing' end
Draw3DText(v.coords.x, v.coords.y, v.coords.z, item)
if distance < 1.0 then
nearbyItems.casing[k] = v
canCollect = true
elseif nearbyItems.casing[k] then nearbyItems.casing[k] = nil end
elseif nearbyItems.casing[k] then nearbyItems.casing[k] = nil end
end
for k, v in pairs(evidence.blood) do
local distance = #(playerCoords - v.coords)
if distance < 2.0 then
Draw3DText(v.coords.x, v.coords.y, (v.coords.z - 0.5), 'DNA evidence')
if distance < 1.0 then
nearbyItems.blood[k] = v
canCollect = true
elseif nearbyItems.blood[k] then nearbyItems.blood[k] = nil end
elseif nearbyItems.blood[k] then nearbyItems.blood[k] = nil end
end
if canCollect then
if IsControlJustPressed(0, 51) then
local items = nearbyItems
local mCoords = mCoords
nearbyItems = nil
exports['mythic_progbar']:Progress({
name = "useitem",
duration = 2000,
label = "Collecting evidence",
useWhileDead = false,
canCancel = false,
controlDisables = { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true },
animation = { animDict = 'pickup_object', anim = 'putdown_low', flags = 48 }
}, function()
local mCoords = "Found near : " .. GetStreetNameFromHashKey(GetStreetNameAtCoord(playerCoords.x, playerCoords.y, playerCoords.z))
TriggerServerEvent('linden_evidence:collectEvidence', items, mCoords)
nearbyItems = {}
nearbyItems.bullet = {}
nearbyItems.casing = {}
nearbyItems.blood = {}
synced = false
end)
end
end
end
end
Wait(0)
end
end) |
function AddOpenGL()
defines { "MODULE_OpenGL" }
postbuildcommands
{
}
links
{
"opengl32.lib"
}
filter {}
end
function AddGLM()
defines { "MODULE_GLM" }
includedirs "$(SolutionDir)/thirdparty/glm/"
filter {}
end
function AddGLFW()
defines { "MODULE_GLFW" }
includedirs "$(SolutionDir)/thirdparty/glfw/include/"
libdirs "$(SolutionDir)/thirdparty/glfw/lib-vc2019/"
postbuildcommands
{
"{COPY} \"$(SolutionDir)thirdparty\\glfw\\lib-vc2019\\glfw3.dll\" \"$(OutDir)\""
}
links
{
"glfw3.lib"
}
filter {}
end
function AddGLEW()
defines { "MODULE_GLEW" }
includedirs "$(SolutionDir)/thirdparty/glew/include/"
libdirs "$(SolutionDir)/thirdparty/glew/lib/"
postbuildcommands
{
}
links
{
"glew32.lib"
}
filter {}
end |
require "ddr"
function love.load()
arrow.add(10,10,80)
perfect = false
end
function love.update(dt)
arrow:move(dt)
arrow:collision()
print(score)
s = s + .005
gradient()
end
function love.draw()
board()
arrow:draw()
end
math.randomseed(os.time())
function love.keypressed(key)
perfect = false
if key == "escape" then
love.event.quit()
end
for j=1, 4 do
for i,v in ipairs(arrow) do
if v.lane == j and key == keys[j] then
if v.y >= bar.y and v.y + v.h <= bar.y + bar.h then
v.status = 'perfect'
score = score + 10
end
if v.y >= bar.y - 20 and v.y + v.h <= bar.y + bar.h + 20 and v.status == 'miss' then
v.status = 'good'
score = score + 5
end
end
end
end
end |
local input = require('bizhawk/input')()
-- Vs Hiro
local cf = 31463
-- Sequence 1
-- Combo n° 2
cf = input:circle(cf)
cf = input:cross(cf + 125)
cf = input:right(cf + 40)
cf = input:cross(cf + 85)
cf = input:down(cf + 40)
cf = input:cross(cf + 85)
cf = input:up(cf + 40)
cf = input:cross(cf + 85)
cf = input:right(cf + 40)
cf = input:right(cf + 2)
cf = input:cross(cf + 83)
cf = input:left(cf + 40)
cf = input:left(cf + 2)
cf = input:circle(cf + 83)
cf = input:right(cf + 40)
cf = input:right(cf + 2)
cf = input:right(cf + 2)
cf = input:circle(cf + 81)
-- Sequence 2
-- Combo n° 27
cf = cf + 125
cf = input:left(cf + 40)
cf = input:right(cf + 2)
cf = input:cross(cf + 83)
cf = input:down(cf + 40)
cf = input:down(cf + 2)
cf = input:down(cf + 2)
cf = input:circle(cf + 81)
cf = input:square(cf + 125)
cf = input:square(cf + 125)
cf = input:down(cf + 40)
cf = input:up(cf + 2)
cf = input:down(cf + 2)
cf = input:circle(cf + 81)
cf = input:left(cf + 40)
cf = input:right(cf + 2)
cf = input:left(cf + 2)
cf = input:circle(cf + 81)
-- --- --- --- --- --- --- --- ---
-- All eyes on me 1
cf = cf + 125 + 2
cf = input:up(cf + 40)
cf = input:up(cf + 2)
cf = input:circle(cf + 83)
cf = input:down(cf + 40)
cf = input:down(cf + 2)
cf = input:circle(cf + 83)
cf = input:right(cf + 40)
cf = input:right(cf + 2)
cf = input:right(cf + 2)
cf = input:circle(cf + 81)
cf = input:left(cf + 40)
cf = input:left(cf + 2)
cf = input:left(cf + 2)
cf = input:circle(cf + 81)
-- Sequence 3
-- Combo n° 49
cf = cf + (125 * 4)
cf = input:circle(cf + 125)
cf = input:right(cf + 40)
cf = input:circle(cf + 85)
cf = input:up(cf + 40)
cf = input:up(cf + 2)
cf = input:circle(cf + 83)
cf = input:up(cf + 40)
cf = input:up(cf + 2)
cf = input:cross(cf + 83)
cf = input:left(cf + 40)
cf = input:right(cf + 2)
cf = input:cross(cf + 83)
cf = input:down(cf + 40)
cf = input:right(cf + 2)
cf = input:cross(cf + 83)
cf = input:triangle(cf + 125)
cf = input:down(cf + 40)
cf = input:down(cf + 2)
cf = input:down(cf + 2)
cf = input:cross(cf + 81)
cf = input:up(cf + 40)
cf = input:down(cf + 2)
cf = input:up(cf + 2)
cf = input:cross(cf + 81)
-- Sequence 4
-- Combo n° 9
cf = cf + 125
cf = input:circle(cf + 125)
cf = input:cross(cf + 125)
cf = input:right(cf + 40)
cf = input:cross(cf + 85)
cf = input:down(cf + 40)
cf = input:circle(cf + 85)
cf = input:down(cf + 40)
cf = input:down(cf + 2)
cf = input:circle(cf + 83)
cf = input:right(cf + 40)
cf = input:right(cf + 2)
cf = input:circle(cf + 83)
cf = input:triangle(cf + 125)
-- All eyes on me 2
cf = cf + (125 * 5)
cf = input:up(cf + 40)
cf = input:up(cf + 2)
cf = input:circle(cf + 83)
cf = input:down(cf + 40)
cf = input:down(cf + 2)
cf = input:circle(cf + 83)
cf = input:right(cf + 40)
cf = input:right(cf + 2)
cf = input:right(cf + 2)
cf = input:circle(cf + 81)
cf = input:left(cf + 40)
cf = input:left(cf + 2)
cf = input:left(cf + 2)
cf = input:circle(cf + 81)
-- Sequence 4
-- Combo n° 32
cf = input:circle(cf + 125)
cf = input:cross(cf + 125)
cf = input:left(cf + 40)
cf = input:circle(cf + 85)
cf = input:up(cf + 40)
cf = input:up(cf + 2)
cf = input:cross(cf + 83)
cf = input:left(cf + 40)
cf = input:right(cf + 2)
cf = input:circle(cf + 83)
cf = input:left(cf + 40)
cf = input:left(cf + 2)
cf = input:left(cf + 2)
cf = input:circle(cf + 81)
cf = input:down(cf + 40)
cf = input:up(cf + 2)
cf = input:down(cf + 2)
cf = input:up(cf + 2)
cf = input:circle(cf + 79)
cf = input:left(cf + 40)
cf = input:left(cf + 2)
cf = input:up(cf + 2)
cf = input:right(cf + 2)
cf = input:right(cf + 2)
cf = input:circle(cf + 77 + 10)
cf = cf + 125
cf = input:square(cf + 125)
-- Skip Fever Time
cf = input:cross(cf + 616, 2)
return input:all() |
-- Copyright 2007-2017 Mitchell mitchell.att.foicica.com. See LICENSE.
--[[ This comment is for LuaDoc.
---
-- Utilize Ctags with Textadept.
--
-- There are four ways to tell Textadept about *tags* files:
--
-- 1. Place a *tags* file in current file's directory. This file will be used
-- in a tag search from any file in that directory.
-- 2. Place a *tags* file in a project's root directory. This file will be
-- used in a tag search from any of that project's source files.
-- 3. Add a *tags* file or list of *tags* files to the `_M.ctags` table for a
-- project root key. This file(s) will be used in a tag search from any of
-- that project's source files.
-- For example: `_M.ctags['/path/to/project'] = '/path/to/tags'`.
-- 4. Add a *tags* file to the `_M.ctags` table. This file will be used in any
-- tag search.
-- For example: `_M.ctags[#_M.ctags + 1] = '/path/to/tags'`.
-- 5. As a last resort, if no *tags* files were found, or if there is no match
-- for a given symbol, a temporary *tags* file is generated for the current
-- file and used.
--
-- Textadept will use any and all *tags* files based on the above rules.
-- @field _G.textadept.editing.autocompleters.ctag (function)
-- Autocompleter function for ctags. (Names only; not context-sensitive).
-- @field ctags (string)
-- Path to the ctags executable.
-- The default value is `ctags`.
module('_M.ctags')]]
local M = {}
M.ctags = 'ctags'
-- Searches all available tags files tag *tag* and returns a table of tags
-- found.
-- All Ctags in tags files must be sorted.
-- @param tag Tag to find.
-- @return table of tags found with each entry being a table that contains the
-- 4 ctags fields
local function find_tags(tag)
-- TODO: binary search?
local tags = {}
local patt = '^('..tag..'%S*)\t([^\t]+)\t(.-);"\t?(.*)$'
-- Determine the tag files to search in.
local tag_files = {}
local tag_file = ((buffer.filename or ''):match('^.+[/\\]') or
lfs.currentdir()..'/')..'tags' -- current directory's tags
if lfs.attributes(tag_file) then tag_files[#tag_files + 1] = tag_file end
if buffer.filename then
local root = io.get_project_root(buffer.filename)
if root then
tag_file = root..'/tags' -- project's tags
if lfs.attributes(tag_file) then tag_files[#tag_files + 1] = tag_file end
tag_file = M[root] -- project's specified tags
if type(tag_file) == 'string' then
tag_files[#tag_files + 1] = tag_file
elseif type(tag_file) == 'table' then
for i = 1, #tag_file do tag_files[#tag_files + 1] = tag_file[i] end
end
end
end
for i = 1, #M do tag_files[#tag_files + 1] = M[i] end -- global tags
-- Search all tags files for matches.
local tmpfile
::retry::
for i = 1, #tag_files do
local dir, found = tag_files[i]:match('^.+[/\\]'), false
local f = io.open(tag_files[i])
for line in f:lines() do
local tag, file, ex_cmd, ext_fields = line:match(patt)
if tag then
if not file:find('^%a?:?[/\\]') then file = dir..file end
if ex_cmd:find('^/') then ex_cmd = ex_cmd:match('^/^?(.+)$?/$') end
tags[#tags + 1] = {tag, file, ex_cmd, ext_fields}
found = true
elseif found then
break -- tags are sorted, so no more matches exist in this file
end
end
f:close()
end
if #tags == 0 and buffer.filename and not tmpfile then
-- If no matches were found, try the current file.
tmpfile = os.tmpname()
local cmd = string.format('"%s" -o "%s" "%s"', M.ctags, tmpfile,
buffer.filename)
spawn(cmd):wait()
tag_files = {tmpfile}
goto retry
end
if tmpfile then os.remove(tmpfile) end
return tags
end
-- List of jump positions comprising a jump history.
-- Has a `pos` field that points to the current jump position.
-- @class table
-- @name jump_list
local jump_list = {pos = 0}
---
-- Jumps to the source of string *tag* or the source of the word under the
-- caret.
-- Prompts the user when multiple sources are found. If *tag* is `nil`, jumps to
-- the previous or next position in the jump history, depending on boolean
-- *prev*.
-- @param tag The tag to jump to the source of.
-- @param prev Optional flag indicating whether to go to the previous position
-- in the jump history or the next one. Only applicable when *tag* is `nil` or
-- `false`.
-- @see tags
-- @name goto_tag
function M.goto_tag(tag, prev)
if not tag and prev == nil then
local s = buffer:word_start_position(buffer.current_pos, true)
local e = buffer:word_end_position(buffer.current_pos, true)
tag = buffer:text_range(s, e)
elseif not tag then
-- Navigate within the jump history.
if prev and jump_list.pos <= 1 then return end
if not prev and jump_list.pos == #jump_list then return end
jump_list.pos = jump_list.pos + (prev and -1 or 1)
io.open_file(jump_list[jump_list.pos][1])
buffer:goto_pos(jump_list[jump_list.pos][2])
return
end
-- Search for potential tags to jump to.
local tags = find_tags(tag)
if #tags == 0 then return end
-- Prompt the user to select a tag from multiple candidates or automatically
-- pick the only one.
if #tags > 1 then
local items = {}
for i = 1, #tags do
items[#items + 1] = tags[i][1]
items[#items + 1] = tags[i][2]:match('[^/\\]+$') -- filename only
items[#items + 1] = tags[i][3]:match('^%s*(.+)$') -- strip indentation
items[#items + 1] = tags[i][4]:match('^%a?%s*(.*)$') -- ignore kind
end
local button, i = ui.dialogs.filteredlist{
title = _L['Go To'],
columns = {_L['Name'], _L['File'], _L['Line:'], 'Extra Information'},
items = items, search_column = 2, width = CURSES and ui.size[1] - 2 or nil
}
if button < 1 then return end
tag = tags[i]
else
tag = tags[1]
end
-- Store the current position in the jump history if applicable, clearing any
-- jump history positions beyond the current one.
if jump_list.pos < #jump_list then
for i = jump_list.pos + 1, #jump_list do jump_list[i] = nil end
end
if jump_list.pos == 0 or jump_list[#jump_list][1] ~= buffer.filename or
jump_list[#jump_list][2] ~= buffer.current_pos then
jump_list[#jump_list + 1] = {buffer.filename, buffer.current_pos}
end
-- Jump to the tag.
io.open_file(tag[2])
if not tonumber(tag[3]) then
for i = 0, buffer.line_count - 1 do
if buffer:get_line(i):find(tag[3], 1, true) then
textadept.editing.goto_line(i)
break
end
end
else
textadept.editing.goto_line(tonumber(tag[3]) - 1)
end
-- Store the new position in the jump history.
jump_list[#jump_list + 1] = {buffer.filename, buffer.current_pos}
jump_list.pos = #jump_list
end
-- Autocompleter function for ctags.
-- Does not remove duplicates.
textadept.editing.autocompleters.ctag = function()
local completions = {}
local s = buffer:word_start_position(buffer.current_pos, true)
local e = buffer:word_end_position(buffer.current_pos, true)
local tags = find_tags(buffer:text_range(s, e))
for i = 1, #tags do completions[#completions + 1] = tags[i][1] end
return e - s, completions
end
-- Add menu entries.
local m_search = textadept.menu.menubar[_L['_Search']]
m_search[#m_search + 1] = {''} -- separator
m_search[#m_search + 1] = {
title = '_Ctags',
{'_Goto Ctag', M.goto_tag},
{'G_oto Ctag...', function()
local button, name = ui.dialogs.standard_inputbox{title = 'Goto Tag'}
if button == 1 then _M.ctags.goto_tag(name) end
end},
{''},
{'Jump _Back', function() M.goto_tag(nil, true) end},
{'Jump _Forward', function() M.goto_tag(nil, false) end},
{''},
{'_Autocomplete Tag', function() textadept.editing.autocomplete('ctag') end}
}
return M
|
-- highlight.lua
hl = require('utils').highlight
-- HEADER HIGHLIGHTS
hl('VimwikiHeader1', nil, '#EE2266', nil, nil, true)
hl('VimwikiHeader2', nil, '#33EE33', nil, nil, true)
hl('VimwikiHeader3', nil, '#DD44CC', nil, nil, true)
hl('VimwikiHeader4', nil, '#44DDDD', nil, nil, true)
hl('VimwikiHeader5', nil, '#FFFF00', nil, nil, true)
hl('VimwikiHeader6', nil, '#FFAAAA', nil, nil, true)
|
---@type i18n
local i18n = ECSLoader:ImportModule("i18n")
---@type Config
local Config = ECSLoader:ImportModule("Config")
---@type Stats
local Stats = ECSLoader:ImportModule("Stats")
local function _HandleSlash(msg)
local cmd = string.lower(msg) or "help"
if cmd == "toggle" then
Stats:ToggleWindow()
if Stats:GetFrame():IsShown() then
ECS:Print("The ECS stats window is now visible next to the character frame")
else
ECS:Print("The ECS stats window is now hidden")
end
elseif cmd == "config" then
Config:ToggleWindow()
else
print(i18n("AVAILABLE_COMMANDS"))
print(i18n("SLASH_TOGGLE") .. " - " .. i18n("SLASH_TOGGLE_DESC"))
print(i18n("SLASH_CONFIG") .. " - " .. i18n("SLASH_CONFIG_DESC"))
end
end
SLASH_ECS1 = "/ecs"
SlashCmdList["ECS"] = _HandleSlash
|
--Settings--
enableprice = true -- true = carwash is paid, false = carwash is free
price = 1000 -- you may edit this to your liking. if "enableprice = false" ignore this one
--DO-NOT-EDIT-BELLOW-THIS-LINE--
RegisterServerEvent('es_carwash:checkmoney')
AddEventHandler('es_carwash:checkmoney', function ()
TriggerEvent('es:getPlayerFromId', source, function (user)
if enableprice == true then
userMoney = user.getMoney()
if userMoney >= price then
user.removeMoney(price)
TriggerClientEvent('es_carwash:success', source, price)
else
moneyleft = price - userMoney
TriggerClientEvent('es_carwash:notenoughmoney', source, moneyleft)
end
else
TriggerClientEvent('es_carwash:free', source)
end
end)
end)
|
project "FireflyEditor"
kind "ConsoleApp"
language "C++"
cppdialect "C++17"
targetdir ("../bin/" .. outputdir .. "/%{prj.name}")
objdir("../bin-int/" .. outputdir .. "/%{prj.name}")
files
{
"src/**.h",
"src/**.cpp",
"assets/shaders/**.glsl"
}
includedirs "src"
includedirs (clientIncludes)
links "Firefly"
links (linkLibs)
filter "system:windows"
systemversion "latest"
staticruntime (staticRuntime)
files "res/**.rc"
filter "system:linux"
pic "on"
systemversion "latest"
staticruntime "on"
links { "dl", "pthread" }
filter "configurations:Debug"
defines "FF_DEBUG"
runtime "Debug"
symbols "on"
filter "configurations:DebugOptimized"
defines "FF_DEBUG"
runtime "Debug"
symbols "on"
optimize "on"
filter "configurations:Release"
defines "FF_RELEASE"
runtime "Release"
optimize "on"
filter "configurations:Dist"
defines "FF_DIST"
runtime "Release"
optimize "on"
|
local _, ADDON = ...
------------------------------------------------------------
-- basedir: Needs to point to your WoW base directory.
-- It's the one that contains Interface and WTF.
-- Only use normal slashes, not backslashes!
-- interface: TOC file addon version. Increase this when
-- WoW complains about the addon being outdated. Look
-- at other addons' TOC files to get the current number.
-- expansion: Valid values are "classic", "tbc" and "retail"
local config = {
basedir = "C:/Games/World of Warcraft/_classic_",
interface = "20502",
expansion = "tbc",
}
------------------------------------------------------------
-- export tables
ADDON.Config = config
|
--- Rogue Map Generator.
-- A map generator based on the original Rogue map gen algorithm
-- See http://kuoi.com/~kamikaze/GameDesign/art07_rogue_dungeon.php
-- @module ROT.Map.Rogue
local ROT = require((...):gsub(('.[^./\\]*'):rep(2) .. '$', ''))
local Rogue = ROT.Map:extend("Rogue")
local function calculateRoomSize(size, cell)
local max = math.floor((size / cell) * 0.8)
local min = math.floor((size / cell) * 0.25)
min = min < 2 and 2 or min
max = max < 2 and 2 or max
return {min, max}
end
--- Constructor.
-- @tparam int width Width in cells of the map
-- @tparam int height Height in cells of the map
-- @tparam[opt] table options Options
-- @tparam int options.cellWidth Number of cells to create on the horizontal (number of rooms horizontally)
-- @tparam int options.cellHeight Number of cells to create on the vertical (number of rooms vertically)
-- @tparam int options.roomWidth Room min and max width
-- @tparam int options.roomHeight Room min and max height
function Rogue:init(width, height, options)
Rogue.super.init(self, width, height)
self._doors = {}
self._options = {cellWidth = math.floor(width * 0.0375), cellHeight = math.floor(height * 0.125)}
if options then for k, _ in pairs(options) do self._options[k] = options[k] end end
if not self._options.roomWidth then
self._options.roomWidth = calculateRoomSize(width, self._options.cellWidth)
end
if not self._options.roomHeight then
self._options.roomHeight = calculateRoomSize(height, self._options.cellHeight)
end
end
--- Create.
-- Creates a map.
-- @tparam function callback This function will be called for every cell. It must accept the following parameters:
-- @tparam int callback.x The x-position of a cell in the map
-- @tparam int callback.y The y-position of a cell in the map
-- @tparam int callback.value A value representing the cell-type. 0==floor, 1==wall
-- @treturn ROT.Map.Cellular|nil self or nil if time limit is reached
function Rogue:create(callback)
self.map = self:_fillMap(1)
self._rooms = {}
self.connectedCells = {}
self:_initRooms()
self:_connectRooms()
self:_connectUnconnectedRooms()
self:_createRandomRoomConnections()
self:_createRooms()
self:_createCorridors()
if not callback then return self end
for y = 1, self._height do
for x = 1, self._width do
callback(x, y, self.map[x][y])
end
end
return self
end
function Rogue:_getRandomInt(min, max)
min = min and min or 0
max = max and max or 1
return math.floor(self._rng:random(min, max))
end
function Rogue:_initRooms()
for i = 1, self._options.cellWidth do
self._rooms[i] = {}
for j = 1, self._options.cellHeight do
self._rooms[i][j] = {x = 0, y = 0, width = 0, height = 0, connections = {}, cellx = i, celly = j}
end
end
end
function Rogue:_connectRooms()
local cgx = self:_getRandomInt(1, self._options.cellWidth)
local cgy = self:_getRandomInt(1, self._options.cellHeight)
local idx, ncgx, ncgy
local found = false
local room, otherRoom
local dirToCheck = 0
repeat
dirToCheck = {1, 3, 5, 7}
dirToCheck = table.randomize(dirToCheck)
repeat
found = false
idx = table.remove(dirToCheck)
ncgx = cgx + ROT.DIRS.EIGHT[idx][1]
ncgy = cgy + ROT.DIRS.EIGHT[idx][2]
if (ncgx > 0 and ncgx <= self._options.cellWidth) and
(ncgy > 0 and ncgy <= self._options.cellHeight) then
room = self._rooms[cgx][cgy]
if #room.connections > 0 then
if room.connections[1][1] == ncgx and
room.connections[1][2] == ncgy then
break
end
end
otherRoom = self._rooms[ncgx][ncgy]
if #otherRoom.connections == 0 then
table.insert(otherRoom.connections, {cgx, cgy})
table.insert(self.connectedCells, {ncgx, ncgy})
cgx = ncgx
cgy = ncgy
found = true
end
end
until #dirToCheck < 1 or found
until #dirToCheck < 1
end
function Rogue:_connectUnconnectedRooms()
local cw = self._options.cellWidth
local ch = self._options.cellHeight
self.connectedCells = table.randomize(self.connectedCells)
local room, otherRoom, validRoom
for i = 1, cw do
for j = 1, ch do
room = self._rooms[i][j]
if #room.connections == 0 then
local dirs = {1, 3, 5, 7}
dirs = table.randomize(dirs)
validRoom = false
repeat
local dirIdx = table.remove(dirs)
local newI = i + ROT.DIRS.EIGHT[dirIdx][1]
local newJ = j + ROT.DIRS.EIGHT[dirIdx][2]
if newI > 0 and newI <= cw and
newJ > 0 and newJ <= ch then
otherRoom = self._rooms[newI][newJ]
validRoom = true
if #otherRoom.connections == 0 then
break
end
for k = 1, #otherRoom.connections do
if otherRoom.connections[k][1] == i and
otherRoom.connections[k][2] == j then
validRoom = false
break
end
end
if validRoom then break end
end
until #dirs < 1
if validRoom then table.insert(room.connections, {otherRoom.cellx, otherRoom.celly})
else
io.write('-- Unable to connect room.'); io.flush()
end
end
end
end
end
function Rogue:_createRandomRoomConnections()
return
end
function Rogue:_createRooms()
local w = self._width
local h = self._height
local cw = self._options.cellWidth
local ch = self._options.cellHeight
local cwp = math.floor(self._width / cw)
local chp = math.floor(self._height / ch)
local roomw, roomh
local roomWidth = self._options.roomWidth
local roomHeight = self._options.roomHeight
local sx, sy
local otherRoom
for i = 1, cw do
for j = 1, ch do
sx = cwp * (i - 1)
sy = chp * (j - 1)
sx = sx < 2 and 2 or sx
sy = sy < 2 and 2 or sy
roomw = self:_getRandomInt(roomWidth[1], roomWidth[2])
roomh = self:_getRandomInt(roomHeight[1], roomHeight[2])
if j > 1 then
otherRoom = self._rooms[i][j - 1]
while sy - (otherRoom.y + otherRoom.height) < 3 do
sy = sy + 1
end
end
if i > 1 then
otherRoom = self._rooms[i - 1][j]
while sx - (otherRoom.x + otherRoom.width) < 3 do
sx = sx + 1
end
end
local sxOffset = math.round(self:_getRandomInt(0, cwp - roomw) / 2)
local syOffset = math.round(self:_getRandomInt(0, chp - roomh) / 2)
while sx + sxOffset + roomw > w do
if sxOffset > 0 then
sxOffset = sxOffset - 1
else
roomw = roomw - 1
end
end
while sy + syOffset + roomh > h do
if syOffset > 0 then
syOffset = syOffset - 1
else
roomh = roomh - 1
end
end
sx = sx + sxOffset
sy = sy + syOffset
self._rooms[i][j].x = sx
self._rooms[i][j].y = sy
self._rooms[i][j].width = roomw
self._rooms[i][j].height = roomh
for ii = sx, sx + roomw - 1 do
for jj = sy, sy + roomh - 1 do
self.map[ii][jj] = 0
end
end
end
end
end
function Rogue:_getWallPosition(aRoom, aDirection)
local rx, ry, door
if aDirection == 1 or aDirection == 3 then
local maxRx = aRoom.x + aRoom.width - 1
rx = self:_getRandomInt(aRoom.x, maxRx > aRoom.x and maxRx or aRoom.x)
if aDirection == 1 then
ry = aRoom.y - 2
door = ry + 1
else
ry = aRoom.y + aRoom.height + 1
door = ry - 1
end
self.map[rx][door] = 0
table.insert(self._doors, {x = rx, y = door})
elseif aDirection == 2 or aDirection == 4 then
local maxRy = aRoom.y + aRoom.height - 1
ry = self:_getRandomInt(aRoom.y, maxRy > aRoom.y and maxRy or aRoom.y)
if aDirection == 2 then
rx = aRoom.x + aRoom.width + 1
door = rx - 1
else
rx = aRoom.x - 2
door = rx + 1
end
self.map[door][ry] = 0
table.insert(self._doors, {x = door, y = ry})
end
return {rx, ry}
end
function Rogue:_drawCorridor(startPosition, endPosition)
local xOffset = endPosition[1] - startPosition[1]
local yOffset = endPosition[2] - startPosition[2]
local xpos = startPosition[1]
local ypos = startPosition[2]
local moves = {}
local xAbs = math.abs(xOffset)
local yAbs = math.abs(yOffset)
local firstHalf = self._rng:random()
local secondHalf = 1 - firstHalf
local xDir = xOffset > 0 and 3 or 7
local yDir = yOffset > 0 and 5 or 1
if xAbs < yAbs then
local tempDist = math.ceil(yAbs * firstHalf)
table.insert(moves, {yDir, tempDist})
table.insert(moves, {xDir, xAbs})
tempDist = math.floor(yAbs * secondHalf)
table.insert(moves, {yDir, tempDist})
else
local tempDist = math.ceil(xAbs * firstHalf)
table.insert(moves, {xDir, tempDist})
table.insert(moves, {yDir, yAbs})
tempDist = math.floor(xAbs * secondHalf)
table.insert(moves, {xDir, tempDist})
end
local dirs = ROT.DIRS.EIGHT
self.map[xpos][ypos] = 0
while #moves > 0 do
local move = table.remove(moves)
if move and move[1] and move[1] < 9 and move[1] > 0 then
while move[2] > 0 do
xpos = xpos + dirs[move[1]][1]
ypos = ypos + dirs[move[1]][2]
self.map[xpos][ypos] = 0
move[2] = move[2] - 1
end
end
end
end
function Rogue:_createCorridors()
local cw = self._options.cellWidth
local ch = self._options.cellHeight
local room, connection, otherRoom, wall, otherWall
for i = 1, cw do
for j = 1, ch do
room = self._rooms[i][j]
for k = 1, #room.connections do
connection = room.connections[k]
otherRoom = self._rooms[connection[1]][connection[2]]
if otherRoom.cellx > room.cellx then
wall = 2
otherWall = 4
elseif otherRoom.cellx < room.cellx then
wall = 4
otherWall = 2
elseif otherRoom.celly > room.celly then
wall = 3
otherWall = 1
elseif otherRoom.celly < room.celly then
wall = 1
otherWall = 3
end
self:_drawCorridor(self:_getWallPosition(room, wall), self:_getWallPosition(otherRoom, otherWall))
end
end
end
end
return Rogue
|
--[[---------------------
This script makes an html calendar
Syntax: mkcalendar.lua year1 year2 year3 .. yearn > file
arg:
year1 .. yearn - the year(s) of the calendar to generate
file - the name of the file to write the generated text calendar
--]]---------------------
require"date"
function makemonth(y,m)
local t = {}
local d = date(y,m,1)
t.name = d:fmt("%B")
t.year = y
-- get back to the nearest sunday
d:adddays(-(d:getweekday()-1))
repeat
local tt = {}
table.insert(t,tt)
repeat -- insert the week days
table.insert(tt, d:getday())
until d:adddays(1):getweekday() == 1
until d:getmonth() ~= m
return t
end
local htm_foot = '\n</html>'
local htm_head = [[
<style>
th {background:black; color: silver; vertical-align: middle;}
td {vertical-align: middle; text-align:center;}
td.sun {color: red;}
td.sat {color: blue;}
</style>
<html>
]]
local htm_yearhead = '\n<table align="left">'
local htm_monhead = '\n<tr><th colspan = "7">%s, %s</th></tr><tr><td>sun</td><td>mon</td><td>tue</td><td>wed</td><td>thu</td><td>fri</td><td>sat</td></tr>'
local htm_monweek = '\n<tr><td class="sun">%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td class="sat">%s</td></tr>'
local htm_yearfoot = '\n</table>'
function makecalendar(y, iox)
iox:write(htm_yearhead)
for i = 1, 12 do
local tm = makemonth(y, i)
iox:write(string.format(htm_monhead, tm.name, tm.year))
for k, v in ipairs(tm) do
iox:write(string.format(htm_monweek, v[1], v[2], v[3], v[4], v[5], v[6], v[7]))
end
end
iox:write(htm_yearfoot)
end
io.stdout:write(htm_head)
for k, v in ipairs(arg) do
local y = tonumber(v)
if y then makecalendar(y, io.stdout) end
end
io.stdout:write(htm_foot)
|
-- create node Vector3
require "moon.sg"
local node = moon.sg.new_node("sg_vec3")
if node then
node:set_pos(moon.mouse.get_position())
end |
Languages.english = {
-- Login panel
login_label_username = "Username",
login_label_password = "Password",
login_label_password_repeat = "Repeat password",
login_remember_checkbox = "Remember this account",
login_button_login = "Login",
login_button_register = "Register",
login_show_register_panel = "Register new account",
login_show_login_panel = "Back to login",
login_error_default_login = "Failed to login (unknown error)",
login_error_default_register = "Failed to create account (unknown error)",
login_error_account_not_found = "Account not found",
login_error_already_logged = "Account is already in use",
login_error_invalid_password = "Invalid password",
login_error_account_exists = "Username is already taken",
-- LOBBY
lobby_start_game = "START GAME",
lobby_searching = "MATCHMAKING",
lobby_ready = "READY",
lobby_beta_label = "OPEN BETA",
lobby_players_in_lobby = "Players in lobby",
lobby_matches_running = "Matches running",
lobby_match_type = "MATCH TYPE",
lobby_type_solo = "SOLO",
lobby_type_squad = "SQUAD",
lobby_type_1m_squad = "1-MAN SQUAD",
lobby_type_2m_squad = "2-MAN SQUAD",
lobby_not_enough_players = "Not enough players",
lobby_invite_text = "You have received an invite from %s",
lobby_invite_accept = "ACCEPT",
lobby_invite_decline = "DECLINE",
lobby_kick_text = "Kick player %s from your lobby?",
lobby_kick_accept = "YES",
lobby_kick_decline = "NO",
lobby_counter_text = "Players in lobby",
lobby_button_full = "LOBBY IS FULL",
lobby_button_invite = "INVITE PLAYER",
lobby_button_leave = "LEAVE LOBBY",
lobby_invite_declined = "Player has declined your invite",
lobby_search_failed = "Failed to find game.\nOne or more players are in a match.",
lobby_tab_home = "PLAY",
lobby_tab_shop = "SHOP",
lobby_tab_stats = "STATISTICS",
lobby_tab_rewards = "REWARDS",
lobby_tab_character = "CHARACTER",
lobby_clothes_takeon = "Wear",
lobby_clothes_takeoff = "Take off",
lobby_clothes_sell = "Sell",
lobby_statistics = "My stats",
lobby_rating = "Leaderboard",
lobby_get_reward = "GET REWARD",
lobby_random_crate = "Random Weekly Crate",
lobby_open_crate = "Open crate",
lobby_crate_new = "NEW",
lobby_crate_cancel = "Cancel",
lobby_crate_opening = "Opening crate...",
lobby_crate_purchasing = "Crate is being received...",
lobby_crate_received = "YOU RECEIVED",
lobby_crate_take_item = "TAKE ITEM",
lobby_button_get_crates = "GET CRATES",
lobby_button_my_crates = "MY CRATES",
lobby_button_donate = "DONATE",
lobby_donate_disabled = "Donations are not available yet",
lobby_donate_converting = "Points are being converted...",
lobby_donate_site = "To donate visit out web-site",
lobby_donate_balance = "Balance",
lobby_donate_btn_convert = "CONVERT TO BATTLEPOINTS",
lobby_randomize_character = "Randomize character",
-- INVENTORY
inventory_backpack_weight = "Total weight",
inventory_no_space = "Not enough space!",
invetory_split_enter_amount = "Enter amount",
invetory_split_drop = "SPLIT",
invetory_split_cancel = "CANCEL",
inventory_section_weapons = "Weapons",
inventory_section_equipment = "Equipment",
inventory_section_loot = "Ground",
inventory_section_backpack = "Backpack",
inventory_using = "Using",
inventory_using_cancel = "Press F, to cancel",
inventory_pick_up = "PICK UP",
-- ITEMS
item_jerrycan = "Gas Can",
item_bandage = "Bandage",
item_medkit = "Med Kit",
item_adrenaline = "Adrenaline Syringe",
item_first_aid = "First Aid Kit",
item_energy_drink = "Energy Drink",
item_painkiller = "Painkillers",
item_shotgun = "Shotgun",
item_crowbar = "Crowbar",
item_pan = "Pan",
item_machete = "Machete",
item_smoke = "Smoke Grenade",
item_grenade = "Frag Grenade",
item_molotov = "Molotov Cocktail",
item_backpack1 = "Backpack (Lv.1)",
item_backpack2 = "Backpack (Lv.2)",
item_backpack3 = "Backpack (Lv.3)",
item_helmet1 = "Motorcycle Helmet (Lv.1)",
item_helmet2 = "Military Helmet (Lv.2)",
item_helmet3 = "Spetsnaz Helmet (Lv.3)",
item_armor1 = "Police Vest (ур.1)",
item_armor2 = "Police Vest (Lv.2)",
item_armor3 = "Military Vest (ур.3)",
item_9mm = "9 mm",
item_762mm = "7.62mm",
item_556mm = "5.56mm",
item_12gauge = "12 gauge",
item_mghilie1 = "Ghillie Suit (Woodland)",
item_mghilie2 = "Ghillie Suit (Desert)",
-- ALERS
alert_shrink_started = "RESTRICTING PLAY AREA!",
alert_waiting_players = "WAITING FOR OTHER PLAYERS TO JOIN\n%s of %s",
alert_match_starts_in = "MATCH STARTS IN\n%s",
alert_match_ends_in = "MATCH ENDS IN\n%s",
alert_shrink_after = "RESTRICTING THE PLAY AREA IN",
shrink_in_1_minute = "1 MINUTE",
shrink_in_30_seconds = "30 SECONDS",
shrink_in_10_seconds = "10 SECONDS",
alert_new_zone = "PROCEED TO PLAY AREA MARKED ON THE MAP IN",
alert_min = "MIN",
alert_sec = "SEC",
alert_red_zone = "DANGER! RED ZONE STARTED!",
-- KILLCHAT
killchat_death = "Player %s died",
killchat_kill = "%s killed %s",
killchat_knocked = "%s knocked out %s",
killchat_finished = "%s finally killed %s",
killchat_weapon = " with %s",
killchat_alive_count = "left",
killchat_match_ended = "MATCH FINISHED!",
-- RANK SCREEN
rank_wintext1 = "WINNER WINNER CHICKEN DINNER!",
rank_top10text = "YOU MADE IT TO TOP 10!",
rank_losetext = "BETTER LUCK NEXT TIME!",
rank_label = "RANK #",
rank_time_survived = "TIME ALIVE",
rank_minutes = "MIN",
rank_kills = "KILLS",
rank_accuracy = "ACCURACY",
rank_damage_taken = "DAMAGE TAKEN",
rank_healed_hp = "HP HEALED",
rank_reward = "REWARD",
rank_exit_to_lobby = "Exit to Lobby",
-- HUD
hud_alive_counter = "ALIVE",
hud_join_counter = "JOINED",
hud_kills_counter = "KILLED",
hud_kmh = "km/h",
-- Actions
action_open_parachute = "RELEASE parachute",
action_jump_plane = "Eject",
action_revive_player = "Revive",
action_reviving = "Reviving",
-- Kill messages
kill_message_you_killed = "YOU killed",
kill_message_with = "with",
kill_message_left = "left",
kill_message_Kills = "Kills",
-- Clothes
clothes_head = "Head",
clothes_body = "Torso",
clothes_legs = "Legs",
clothes_feet = "Shoes",
clothes_jacket = "Shoes",
clothes_hat = "Hats",
clothes_gloves = "Gloves",
clothes_glasses = "Glasses",
clothes_mask = "Masks",
clothes_all = "All clothes",
-- Shop
shop_confirm_text = "Do you want to buy\n%s for %s?",
shop_confirm_yes = "Buy",
shop_confirm_no = "Cancel",
shop_back = "Back",
shop_exit = "Exit",
shop_categories = "Categories",
shop_category_hats = "Hats",
shop_category_torso = "Torso",
shop_category_pants = "Pants",
shop_category_shoes = "Shoes",
shop_category_mask = "Mask",
shop_category_gloves = "Gloves",
shop_category_glasses = "Glasses",
shop_subcategory_other = "Other",
shop_subcategory_sport = "Sport",
shop_subcategory_tshirt = "T-shirts",
shop_subcategory_shirt = "Shirts",
shop_subcategory_jacket = "Jackets",
shop_subcategory_hoodie = "Hoodies",
shop_subcategory_sweater = "Sweaters",
shop_subcategory_woolcoat = "Woolcoats",
shop_subcategory_cargopnts = "Working Pants",
shop_subcategory_hunterpnts = "Hunting Pants",
shop_subcategory_jeans = "Jeans",
shop_subcategory_slacks = "Slacks",
shop_subcategory_boots = "Boots",
-- Stats
stats_rounds = "rounds",
stats_players = "players",
stats_plays = "PLAYS",
stats_wins = "WINS",
stats_kills = "KILLS",
stats_plays_solo = "SOLO plays",
stats_plays_squad = "SQUAD plays",
stats_playtime = "Total playtime",
stats_distance = "Total distance",
stats_distance_ped = "Distance on feet",
stats_distance_car = "Distance in cars",
stats_wins_solo = "SOLO wins",
stats_wins_squad = "SQUAD wins",
stats_top10 = "Top-10 games",
stats_top10_solo = "Top-10 in SOLO",
stats_top10_squad = "Top-10 in SQUAD",
stats_hp_damage = "Damage taken",
stats_hp_healed = "HP healed",
stats_items_used = "Items used",
stats_deaths = "Deaths",
stats_kd_ratio = "K/D ratio",
-- Ranks
ranktable_rank = "Rank",
ranktable_name = "Name",
ranktable_rating = "Rating",
ranktable_playtime = "Total Playtime",
ranktable_rating_wins = "Win Rating",
ranktable_rating_kills = "Kill Rating",
}
|
local st = require "util.stanza";
local xmlns_csi = "urn:xmpp:csi:0";
local csi_feature = st.stanza("csi", { xmlns = xmlns_csi });
module:hook("stream-features", function (event)
if event.origin.username then
event.features:add_child(csi_feature);
end
end);
function refire_event(name)
return function (event)
if event.origin.username then
event.origin.state = event.stanza.name;
module:fire_event(name, event);
return true;
end
end;
end
module:hook("stanza/"..xmlns_csi..":active", refire_event("csi-client-active"));
module:hook("stanza/"..xmlns_csi..":inactive", refire_event("csi-client-inactive"));
|
-----------------------------------
-- Area: Al Zahbi
-- NPC: Salaifa
-- Type: Standard NPC
-- !pos -37.462 -7 -41.665 48
-----------------------------------
function onTrade(player,npc,trade)
end
function onTrigger(player,npc)
player:startEvent(237)
end
function onEventUpdate(player,csid,option)
end
function onEventFinish(player,csid,option)
end
|
local toolset = require "toolset"
local function write_metadata(conf, name, shard)
local manifestPath = conf.BUILD_PATH .. '/' .. name
local hasUpdate = false
local data = {}
local function writeline(fmt, ...)
data[#data + 1] = string.format(fmt, ...)
data[#data + 1] = '\n'
end
table.sort(shard.assets, function (v1, v2)
return v1.path < v2.path
end)
local latestManifest = toolset.read_metadata(conf.PUBLISH_PATH .. '/current/' .. name, conf)
writeline('{')
writeline(' "package_url":"%s",', shard.package_url)
writeline(' "manifest_url":"%s",', shard.manifest_url)
local assets = {}
for _, entry in ipairs(shard.assets) do
local latest = latestManifest.assets[entry.path]
if not latest or latest.md5 ~= entry.md5 or latest.builtin ~= entry.builtin then
hasUpdate = true
else
entry.date = latest.date
end
local t = {}
t[#t + 1] = string.format('"md5":"%s"', entry.md5)
t[#t + 1] = string.format('"date":%d', entry.date)
t[#t + 1] = string.format('"builtin":%s', entry.builtin)
assets[#assets + 1] = string.format(' "%s":{%s}', entry.path, table.concat(t, ', '))
latestManifest.assets[entry.path] = nil
end
if hasUpdate or next(latestManifest.assets) then
writeline(' "date":"%s",', os.date("!%Y-%m-%d %H:%M:%S", os.time() + 8 * 60 * 60))
writeline(' "version":"%s",', shard.version)
else
writeline(' "date":"%s",', latestManifest.date)
writeline(' "version":"%s",', latestManifest.version)
print("update-to-date: " .. manifestPath)
end
writeline(' "assets": {')
writeline(table.concat(assets, ',\n'))
writeline(' }')
writeline('}')
toolset.write_metadata(manifestPath, table.concat(data, ''), conf)
end
local function writeVersions(conf)
local data = {}
local function writeline(fmt, ...)
data[#data + 1] = string.format(fmt, ...)
data[#data + 1] = '\n'
end
local assets = {}
for _, m in ipairs(conf.SHARDS) do
local manifest = toolset.read_metadata(conf.BUILD_PATH .. '/' .. m.NAME .. '.metadata', conf)
assets[#assets + 1] = toolset.format [[
{"name":"${m.NAME}", "url":"${manifest.manifest_url}", "version":"${manifest.version}"}
]]
end
assets = table.concat(assets, ',\n')
toolset.write(conf.VERSION_MANIFEST_PATH, toolset.format [[
{
"runtime": "${conf.RUNTIME}",
"assets": [
${assets}
]
}
]])
end
return function (conf)
print("start build shards:")
local manifest = toolset.read_metadata(conf.ASSETS_MANIFEST_PATH, conf)
for _, m in ipairs(conf.SHARDS) do
local shard = {
assets = {},
name = m.NAME,
version = manifest.version,
package_url = manifest.package_url,
manifest_url = string.gsub(manifest.manifest_url, 'assets.metadata$', m.NAME .. '.metadata'),
}
for path, info in pairs(manifest.assets) do
for p in string.gmatch(m.PATTERN, '[^;]+') do
if string.match(path, p) then
info.path = path
shard.assets[#shard.assets + 1] = info
manifest.assets[path] = nil
end
end
end
write_metadata(conf, m.NAME .. '.metadata', shard)
end
if next(manifest.assets) then
for path in pairs(manifest.assets) do
print("no pattern for path: " .. path)
end
error("build sharding error")
end
writeVersions(conf)
end |
AddCSLuaFile()
AddCSLuaFile("sh_sounds.lua")
include("sh_sounds.lua")
SWEP.PrintName = "Barrett M98B"
if CLIENT then
SWEP.DrawCrosshair = false
SWEP.CSMuzzleFlashes = true
SWEP.ViewModelMovementScale = 1.15
SWEP.IconLetter = "i"
killicon.AddFont("cw_g3a3", "CW_KillIcons", SWEP.IconLetter, Color(255, 80, 0, 150))
SWEP.MuzzleEffect = "muzzleflash_sr25"
SWEP.PosBasedMuz = true
SWEP.SnapToGrip = true
SWEP.CrosshairEnabled = false
SWEP.ShellScale = 0.7
SWEP.ShellOffsetMul = 1
SWEP.ShellPosOffset = {x = 0, y = 0, z = 0}
SWEP.ForeGripOffsetCycle_Draw = 0
SWEP.ForeGripOffsetCycle_Reload = 0.9
SWEP.ForeGripOffsetCycle_Reload_Empty = 0.8
SWEP.FireMoveMod = 0.6
SWEP.AimBreathingEnabled = true
SWEP.DrawTraditionalWorldModel = false
SWEP.WM = "models/cw2/weapons/w_barret_m98_bravo.mdl"
SWEP.WMPos = Vector(-0.5, 0, 1.1)
SWEP.WMAng = Vector(-9, 0, 180)
SWEP.IronsightPos = Vector(-2.204, -4.724, 0.753)
SWEP.IronsightAng = Vector(-0.68, 0, 0)
SWEP.IsightsPos = Vector(-2.733, -4.121, 0.536)
SWEP.IsightsAng = Vector(0.207, 0.045, 0)
SWEP.EoTechPos = Vector(-2.224, -5.218, 0.493)
SWEP.EoTechAng = Vector(1.697, -0.021, 0)
SWEP.LeupoldPos = Vector(-2.214, -3.941, 0.734)
SWEP.LeupoldAng = Vector(0, 0, 0)
SWEP.AimpointPos = Vector(-2.210, -4.539, 0.929)
SWEP.AimpointAng = Vector(0, 0, 0)
SWEP.MicroT1Pos = Vector(-2.207, -3.958, 0.851)
SWEP.MicroT1Ang = Vector(0, 0, 0)
SWEP.M98BPos = Vector(-2.204, -2.862, 0.986)
SWEP.M98BAng = Vector(0, 0, 0)
SWEP.CoD4ReflexPos = Vector(-2.208, -3.958, 0.964)
SWEP.CoD4ReflexAng = Vector(0, 0, 0)
SWEP.CSGOACOGPos = Vector(-2.199, -4.539, 0.829)
SWEP.CSGOACOGAng = Vector(0, 0, 0)
SWEP.CSGOSSGPos = Vector(-2.182, -2.688, 0.816)
SWEP.CSGOSSGAng = Vector(0, 0, 0)
SWEP.SprintPos = Vector(2.407, 0, 0)
SWEP.SprintAng = Vector(-19.341, 35.276, -16.581)
SWEP.BackupSights = {["md_acog"] = {[1] = Vector(-1.606, -1.107, -1.5), [2] = Vector(0, 0, 0)}}
SWEP.SightWithRail = false
SWEP.CSGOACOGAxisAlign = {right = -0.1, up = -0.1, forward = -40}
SWEP.LeupoldAxisAlign = {right = 1, up = 0, forward = 0}
SWEP.CSGOSSGAxisAlign = {right = 0, up = 0, forward = 145}
SWEP.M98BAxisAlign = {right = 0, up = 0, forward = 0}
SWEP.M203Pos = Vector(0, -1, 0.24)
SWEP.M203Ang = Vector(0, 0, 0)
SWEP.AlternativePos = Vector(0.319, 1.325, -1.04)
SWEP.AlternativeAng = Vector(0, 0, 0)
SWEP.M203OffsetCycle_Reload = 0.81
SWEP.M203OffsetCycle_Reload_Empty = 0.73
SWEP.M203OffsetCycle_Draw = 0
SWEP.M203CameraRotation = {p = -90, y = 0, r = -90}
SWEP.BaseArm = "Bip01 L Clavicle"
SWEP.BaseArmBoneOffset = Vector(-50, 0, 0)
SWEP.ReticleInactivityPostFire = 2
SWEP.M203HoldPos = {
["Bip01 L Clavicle"] = {pos = Vector(4.461, 0.308, -2.166), angle = Angle(0, 0, 0)}
}
SWEP.AttachmentModelsVM = {
["md_aimpoint"] = {model = "models/wystan/attachments/aimpoint.mdl", bone = "M98_Body", rel = "", pos = Vector(-0.213, -16.285, -3.567), angle = Angle(0, 0, 0), size = Vector(0.8, 0.8, 0.8)},
["md_eotech"] = {model = "models/wystan/attachments/2otech557sight.mdl", bone = "M98_Body", rel = "", pos = Vector(0.248, -21.625, -9.738), angle = Angle(0, -90, 0), size = Vector(1, 1, 1)},
--["md_cod4_reflex"] = {model = "models/v_cod4_reflex.mdl", bone = "M98_Body", rel = "", pos = Vector(0, -15.169, -1.492), angle = Angle(0, 90, 0), size = Vector(0.75, 0.75, 0.75)},
["md_fas2_leupold"] = {model = "models/v_fas2_leupold.mdl", bone = "M98_Body", rel = "", pos = Vector(-0.029, -12.386, 2.029), angle = Angle(0, -90, 0), size = Vector(1.5, 1.5, 1.5)},
["md_fas2_leupold_mount"] = {model = "models/v_fas2_leupold_mounts.mdl", bone = "M98_Body", rel = "", pos = Vector(-0.029, -12.386, 2.029), angle = Angle(0, -90, 0), size = Vector(1.5, 1.5, 1.5)},
["md_microt1"] = {model = "models/cw2/attachments/microt1.mdl", bone = "M98_Body", rel = "", pos = Vector(-0.003, -12.025, 1.169), angle = Angle(0, 180, 0), size = Vector(0.4, 0.4, 0.4)},
["md_foregrip"] = {model = "models/wystan/attachments/foregrip1.mdl", bone = "G3SG1", pos = Vector(-3.34, 7.82, -5.904), angle = Angle(0, 0, 0), size = Vector(0.75, 0.75, 0.75)},
["md_lasersight"] = {model = "models/rageattachments/anpeqbf.mdl", bone = "M98_Body", rel = "", pos = Vector(0.949, -0.982, 1.174), angle = Angle(-180, 90, -90), size = Vector(0.8, 0.8, 0.8)},
--["md_csgo_scope_ssg"] = {model = "models/kali/weapons/csgo/eq_optic_scope_ssg08.mdl", bone = "M98_Body", rel = "", pos = Vector(0.052, -10.711, 0.819), angle = Angle(0, -90, 0), size = Vector(0.699, 0.699, 0.699)},
["md_m98b_scope"] = {model = "models/attachments/98b_scope.mdl", bone = "M98_Body", rel = "", pos = Vector(-0.04, -11.74, 2.058), angle = Angle(0, -90, 0), size = Vector(0.449, 0.449, 0.449)},
--["md_csgo_silencer_rifle"] = {model = "models/kali/weapons/csgo/eq_suppressor_rifle.mdl", bone = "M98_Body", rel = "", pos = Vector(-0.004, 17.627, -0.825), angle = Angle(0, -90, 0), size = Vector(1, 1, 1)},
["md_hk416_bipod"] = {model = "models/c_bipod.mdl", bone = "M98_Body", rel = "", pos = Vector(0.052, -0.299, -1.377), angle = Angle(0, 0, 0), size = Vector(1, 1, 1)},
["md_pgm_bipod"] = {model = "models/attachments/pgm_hecate_bipod.mdl", bone = "gun-main", rel = "", pos = Vector(13.217, 0.291, -0.339), angle = Angle(0, 0, -90), size = Vector(0.4, 0.4, 0.4)},
["md_csgo_acog"] = {model = "models/kali/weapons/csgo/eq_optic_acog.mdl", bone = "M98_Body", rel = "", pos = Vector(0.039, -16.928, -2.418), angle = Angle(0, -90, 0), size = Vector(0.75, 0.75, 0.75)},
["md_m203"] = {model = "models/cw2/attachments/m203.mdl", bone = "G3SG1", pos = Vector(-0.583, 3.305, -1.293), angle = Angle(2.538, -90, 0), size = Vector(1, 1, 1), animated = true},
["md_anpeq15"] = { type = "Model", model = "models/cw2/attachments/anpeq15.mdl", bone = "M98_Body", rel = "", pos = Vector(0.119, -5, 0.839), angle = Angle(0, -90, 0), size = Vector(0.5, 0.5, 0.5), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {}
}
}
SWEP.ForeGripHoldPos = {
["Bip01 L Finger3"] = {pos = Vector(0, 0, 0), angle = Angle(-8.907, 29.332, 27.155) },
["Bip01 L Finger41"] = {pos = Vector(0, 0, 0), angle = Angle(0, 3.367, 0) },
["Bip01 L Clavicle"] = {pos = Vector(4.335, -6.652, -3.984), angle = Angle(-42.875, 42.837, 0) },
["Bip01 L Finger22"] = {pos = Vector(0, 0, 0), angle = Angle(0, -13.565, 0) },
["Bip01 L Finger31"] = {pos = Vector(0, 0, 0), angle = Angle(0, 9.633, 0) },
["Bip01 L Finger02"] = {pos = Vector(0, 0, 0), angle = Angle(0, 96.544, 0) },
["Bip01 L Finger11"] = {pos = Vector(0, 0, 0), angle = Angle(0, 25.826, 0) },
["Bip01 L Finger4"] = {pos = Vector(0, 0, 0), angle = Angle(-3.777, 13.736, 42.478) },
["Bip01 L Finger1"] = {pos = Vector(0, 0, 0), angle = Angle(-4.395, 78.736, 22.27) },
["Bip01 L Finger42"] = {pos = Vector(0, 0, 0), angle = Angle(0, 58.242, 0) },
["Bip01 L Hand"] = {pos = Vector(0, 0, 0), angle = Angle(5.883, 57.971, -2.382) },
["Bip01 L Finger32"] = {pos = Vector(0, 0, 0), angle = Angle(0, 18.07, 0) },
["Bip01 L Finger0"] = {pos = Vector(0, 0, 0), angle = Angle(33.303, 1.07, 0) },
["Bip01 L Finger12"] = {pos = Vector(0, 0, 0), angle = Angle(0, 28.163, 0) },
["Bip01 L Finger21"] = {pos = Vector(0, 0, 0), angle = Angle(0, 25.208, 0) },
["Bip01 L Finger01"] = {pos = Vector(0, 0, 0), angle = Angle(0, 19.94, 0) },
["Bip01 L Finger2"] = {pos = Vector(0, 0, 0), angle = Angle(-5.336, 58.977, 28.6) }
}
SWEP.LuaVMRecoilAxisMod = {vert = 0.5, hor = 1, roll = 1, forward = 0.5, pitch = 0.5}
SWEP.LaserPosAdjust = Vector(0.15, 5, 1.7)
SWEP.LaserAngAdjust = Angle(-0.1, 0.5, 0)
end
SWEP.LaserPosAdjust = Vector(0, 0, 0)
SWEP.LaserAngAdjust = Angle(0, 0, 0)
SWEP.SightBGs = {main = 2, none = 1}
SWEP.LuaViewmodelRecoil = false
SWEP.Attachments = {[1] = {header = "Sight", offset = {600, -300}, atts = {"md_microt1", "md_eotech", "md_aimpoint", "md_m98b_scope"}},
--[2] = {header = "Barrel", offset = {-500, -400}, atts = {"md_csgo_silencer_rifle"}},
--[3] = {header = "Handguard", offset = {-500, -0}, atts = {"md_hk416_bipod"}},
[2] = {header = "Rail", offset = {0, -400}, atts = {"md_anpeq15"}},
--["+attack2"] = {header = "Perks", offset = {-500, 500}, atts = {"pk_sleightofhand", "pk_light"}},
["+reload"] = {header = "Ammo", offset = {600, 200}, atts = {"am_magnum", "am_matchgrade"}}
}
SWEP.Animations = {fire = {"shoot1"},
reload = "reload",
reload_empty = "reload_empty",
idle = "idle",
draw = "draw"}
SWEP.Sounds = {draw = {{time = 0, sound = "CW_FOLEY_MEDIUM"}},
shoot1 = {[1] = {time = 0.76, sound = "CW_BARRETT_M98B_BOLTBACK"},
[2] = {time = 0.96, sound = "CW_BARRETT_M98B_BOLTFORWARD"}},
reload = {[1] = {time = 1.27, sound = "CW_BARRETT_M98B_MAGOUT"},
[2] = {time = 2.26, sound = "CW_BARRETT_M98B_MAGIN"}},
reload_empty = {[1] = {time = 1.27, sound = "CW_BARRETT_M98B_MAGOUT"},
[2] = {time = 2.26, sound = "CW_BARRETT_M98B_MAGIN"},
[3] = {time = 3.59, sound = "CW_BARRETT_M98B_BOLTBACK"},
[4] = {time = 4.17, sound = "CW_BARRETT_M98B_BOLTFORWARD"}}}
SWEP.SpeedDec = 50
SWEP.Slot = 3
SWEP.SlotPos = 0
SWEP.NormalHoldType = "ar2"
SWEP.RunHoldType = "passive"
SWEP.FireModes = {"bolt"}
SWEP.Base = "cw_base"
SWEP.Category = "CW 2.0 - Ranged Rifles"
SWEP.Author = "Spy"
SWEP.Contact = ""
SWEP.Purpose = ""
SWEP.Instructions = ""
SWEP.ViewModelFOV = 60
SWEP.ViewModelFlip = false
SWEP.ViewModel = "models/cw2/weapons/v_barret_m98_bravo.mdl"
SWEP.WorldModel = "models/cw2/weapons/w_barret_m98_bravo.mdl"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ADSFireAnim = true
SWEP.BipodFireAnim = true
SWEP.ForceBackToHipAfterAimedShot = false
SWEP.Primary.ClipSize = 10
SWEP.Primary.DefaultClip = 10
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = ".338 Lapua"
SWEP.OverallMouseSens = .9
SWEP.FireDelay = 60/37
SWEP.FireSound = "CW_BARRETT_M98B_FIRE"
SWEP.FireSoundSuppressed = "CW_BARRETT_M98B_FIRE_SUPPRESSED"
SWEP.Recoil = 3
SWEP.HipSpread = 0.135
SWEP.AimSpread = 0.0006
SWEP.VelocitySensitivity = 2
SWEP.MaxSpreadInc = 0.35
SWEP.SpreadPerShot = 0.01
SWEP.SpreadCooldown = 0.17
SWEP.Shots = 1
SWEP.Damage = 82
SWEP.DeployTime = 1
SWEP.ReloadSpeed = 1.35
SWEP.ReloadTime = 2.7
SWEP.ReloadTime_Empty = 5.2
SWEP.ReloadHalt = 2.9
SWEP.ReloadHalt_Empty = 5.2 |
local t = Def.ActorFrame{
LoadActor("base")..{
InitCommand=cmd(Center;diffusealpha,0)
};
LoadActor("BannerHandler.lua"),
}
t[#t+1] = StandardDecorationFromFileOptional("Header","Header");
t[#t+1] = StandardDecorationFromFileOptional("Footer","Footer");
t[#t+1] = StandardDecorationFromFileOptional("StyleIcon","StyleIcon");
t[#t+1] = StandardDecorationFromFile("CourseContentsList","CourseContentsList")
local numwh = THEME:GetMetric("MusicWheel","NumWheelItems")+2
t[#t+1] = Def.Actor{
OnCommand=function(s)
if SCREENMAN:GetTopScreen() then
local wheel = SCREENMAN:GetTopScreen():GetChild("MusicWheel"):GetChild("MusicWheelItem")
for i=1,numwh do
local inv = numwh-math.round( (i-numwh/2) )+1
wheel[i]:addx(500)
:sleep( (i < numwh/2) and i/20 or inv/20 )
:decelerate(0.5):addx(-500)
end
end
end;
OffCommand=function(s)
if SCREENMAN:GetTopScreen() then
local wheel = SCREENMAN:GetTopScreen():GetChild("MusicWheel"):GetChild("MusicWheelItem")
for i=1,numwh do
local inv = numwh-math.round( (i-numwh/2) )+1
wheel[i]:sleep( (i < numwh/2) and i/20 or inv/20 )
:accelerate(0.5):addx(500):sleep(1)
end
end
end;
}
return t; |
add_rules("mode.debug", "mode.release")
target("${TARGETNAME}")
set_kind("static")
add_files("src/**.cu")
add_includedirs("inc")
-- generate relocatable device code for device linker of dependents.
-- if neither __device__ and __global__ functions will be called cross file or be exported,
-- nor dynamic parallelism will be used,
-- this instruction could be omitted.
add_cuflags("-rdc=true")
-- generate SASS code for SM architecture of current host
add_cugencodes("native")
-- generate PTX code for the virtual architecture to guarantee compatibility
add_cugencodes("compute_30")
-- -- generate SASS code for each SM architecture
-- add_cugencodes("sm_30", "sm_35", "sm_37", "sm_50", "sm_52", "sm_60", "sm_61", "sm_70", "sm_75")
-- -- generate PTX code from the highest SM architecture to guarantee forward-compatibility
-- add_cugencodes("compute_75")
${FAQ}
|
require "options"
require "keymappings"
require "plugins"
require "autocommands"
require "colourscheme"
require "helpers"
require "utils"
require "version-control"
require "completion"
require "searching"
require "lsp"
require "syntax-highlighting"
require "tabline"
require "commenting"
require "quickfix"
require "terminal"
require "testing"
require "debugging"
require "notes"
|
local function setup(args)
local xplr = xplr
-- do stuff with xplr
end
return { setup = setup }
|
ITEM.name = "Scientist Curriculum Vitae"
ITEM.description = "A folder containing the employment and achievements of a local professor."
ITEM.longdesc = "This Curriculum Vitae contains the various employment dates of a scientist at different companies, most institutes in Ukraine. You can tell most of these are very old, the last being near the collapse of the Soviet Union."
ITEM.model = "models/lostsignalproject/items/quest/notes_photo.mdl"
ITEM.width = 1
ITEM.height = 1
ITEM.price = 2500
ITEM.flatweight = 0.150
ITEM.exRender = true
ITEM.iconCam = {
pos = Vector(0, 0, 19.607843399048),
ang = Angle(90, 180, 0),
fov = 30,
}
if (CLIENT) then
function ITEM:PopulateTooltipIndividual(tooltip)
if (!self.entity) then
ix.util.PropertyDesc(tooltip, "Documents", Color(200, 200, 200))
end
end
end |
local present, gitsigns = pcall(require, "gitsigns")
if not present then
return
end
require("gitsigns").setup {
-- Set characters used by gitsigns.nvim
signs = {
add = { hl = "DiffAdd", text = "│" },
change = { hl = "DiffChange", text = "│" },
delete = { hl = "DiffDelete", text = "╵" },
topdelete = { hl = "DiffDelete", text = "╷" },
changedelete = { hl = "DiffChange", text = "╰" },
},
watch_index = {
interval = 100,
},
}
|
local BaseClass = require "NJLI.STATEMACHINE.NodeEntityState"
local On = {}
On.__index = On
--#############################################################################
--DO NOT EDIT ABOVE
--#############################################################################
--#############################################################################
--Begin Custom Code
--Required local functions:
-- __ctor()
-- __dtor()
-- __load()
-- __unLoad()
--#############################################################################
local __ctor = function(self, init)
--TODO: construct this Entity
end
local __dtor = function(self)
--TODO: destruct this Entity
end
local __load = function(self)
--TODO: load this Entity
end
local __unLoad = function(self)
--TODO: unload this Entity
end
--#############################################################################
--On Specific
--#############################################################################
--#############################################################################
--NodeEntityState overwrite
--#############################################################################
function On:enter()
BaseClass.enter(self)
local frameName = "butn_" .. self:getNodeEntity():getNode():getName() .. "_on"
local scale = self:getNodeEntity():scale()
self:getNodeEntity():setSpriteAtlasFrame(frameName, true)
local dimSprite = self:getNodeEntity():getDimensions()
self:getNodeEntity():setDimensions(bullet.btVector2( (dimSprite:x() * scale), (dimSprite:y() * scale) ))
self:getNodeEntity()._on = true
end
function On:update(timeStep)
BaseClass.update(self, timeStep)
end
function On:exit()
BaseClass.exit(self)
end
function On:onMessage()
BaseClass.onMessage(self)
end
function On:rayTouchesDown(rayContact)
BaseClass.rayTouchesDown(self, rayContact)
if not self:getNodeEntity():disabled() then
self:getNodeEntity():pushState("NJLI.STATEMACHINE.UI.SWITCH.STATES.Phasing")
end
end
function On:rayTouchesUp(rayContact)
BaseClass.rayTouchesUp(self, rayContact)
end
function On:rayTouchesMove(rayContact)
BaseClass.rayTouchesMove(self, rayContact)
end
function On:rayTouchesCancelled(rayContact)
BaseClass.rayTouchesCancelled(self, rayContact)
end
function On:rayTouchesMissed(node)
BaseClass.rayTouchesMissed(self, node)
end
function On:rayTouchDown(rayContact)
BaseClass.rayTouchDown(self, rayContact)
if not self:getNodeEntity():disabled() then
self:getNodeEntity():pushState("NJLI.STATEMACHINE.UI.SWITCH.STATES.Phasing")
end
end
function On:rayTouchUp(rayContact)
BaseClass.rayTouchUp(self, rayContact)
end
function On:rayTouchMove(rayContact)
BaseClass.rayTouchMove(self, rayContact)
end
function On:rayTouchCancelled(rayContact)
BaseClass.rayTouchCancelled(self, rayContact)
end
function On:rayTouchMissed(node)
BaseClass.rayTouchMissed(self, node)
end
function On:rayMouseDown(rayContact)
BaseClass.rayMouseDown(self, rayContact)
if not self:getNodeEntity():disabled() then
self:getNodeEntity():pushState("NJLI.STATEMACHINE.UI.SWITCH.STATES.Phasing")
end
end
function On:rayMouseUp(rayContact)
BaseClass.rayMouseUp(self, rayContact)
end
function On:rayMouseMove(rayContact)
BaseClass.rayMouseMove(self, rayContact)
end
function On:rayMouseMissed(node)
BaseClass.rayMouseMissed(self, node)
end
function On:collide(otherNode, collisionPoint)
BaseClass.collide(self, collisionPoint)
end
function On:near(otherNode)
BaseClass.near(self, otherNode)
end
function On:actionUpdate(action, timeStep)
BaseClass.actionUpdate(self, timeStep)
end
function On:actionComplete(action)
BaseClass.actionComplete(self, action)
end
function On:keyboardShow()
BaseClass.keyboardShow(self)
end
function On:keyboardCancel()
BaseClass.keyboardCancel(self)
end
function On:keyboardReturn()
BaseClass.keyboardReturn(self)
end
function On:renderHUD()
BaseClass.renderHUD(self)
end
function On:gamePause()
BaseClass.gamePause(self)
end
function On:gameUnPause()
BaseClass.gameUnPause(self)
end
function On:touchesDown(touches)
BaseClass.touchesDown(self, touches)
end
function On:touchesUp(touches)
BaseClass.touchesUp(self, touches)
end
function On:touchesMove(touches)
BaseClass.touchesMove(self, touches)
end
function On:touchesCancelled(touches)
BaseClass.touchesCancelled(self, touches)
end
function On:touchDown(touch)
BaseClass.touchDown(self, touch)
end
function On:touchUp(touch)
BaseClass.touchUp(self, touch)
end
function On:touchMove(touch)
BaseClass.touchMove(self, touch)
end
function On:touchCancelled(touch)
BaseClass.touchCancelled(self, touch)
end
function On:mouseDown(mouse)
BaseClass.mouseDown(self, mouse)
end
function On:mouseUp(mouse)
BaseClass.mouseUp(self, mouse)
end
function On:mouseMove(mouse)
BaseClass.mouseMove(self, mouse)
end
--#############################################################################
--End Custom Code
--#############################################################################
--#############################################################################
--DO NOT EDIT BELOW
--#############################################################################
setmetatable(On, {
__index = BaseClass,
__call = function (cls, ...)
local self = setmetatable({}, cls)
--Create the base first
BaseClass._create(self, ...)
self:_create(...)
return self
end,
})
function On:className()
return "On"
end
function On:class()
return self
end
function On:superClass()
return BaseClass
end
function On:__gc()
--Destroy derived class first
On._destroy(self)
--Destroy base class after derived class
BaseClass._destroy(self)
end
function On:__tostring()
local ret = self:className() .. " =\n{\n"
for pos,val in pairs(self) do
ret = ret .. "\t" .. "["..pos.."]" .. " => " .. type(val) .. " = " .. tostring(val) .. "\n"
end
ret = ret .. "\n\t" .. tostring_r(BaseClass) .. "\n}"
return ret .. "\n\t" .. tostring_r(getmetatable(self)) .. "\n}"
end
function On:_destroy()
assert(not self.__OnCalledLoad, "Must unload before you destroy")
__dtor(self)
end
function On:_create(init)
self.__OnCalledLoad = false
__ctor(self, init)
end
function On:load()
--load base first
BaseClass.load(self)
--load derived last...
__load(self)
self.__OnCalledLoad = true
end
function On:unLoad()
assert(self.__OnCalledLoad, "Must load before unloading")
--unload derived first...
__unLoad(self)
self.__OnCalledLoad = false
--unload base last...
BaseClass.unLoad(self)
end
return On
|
return {'wriemelen','wriemeling','wriggelen','wrijfdoek','wrijfhout','wrijflap','wrijfpaal','wrijfsteen','wrijfwas','wrijven','wrijving','wrijvingscoefficient','wrijvingselektriciteit','wrijvingshoek','wrijvingsmeter','wrijvingspunt','wrijvingswarmte','wrijvingsweerstand','wrikkelen','wrikken','wrikriem','wringen','wringer','wringing','wrijvingsloos','wrijvingsvlak','wrijvingskracht','writer','wright','wriemel','wriemelde','wriemelden','wriemelt','wriggelde','wrijf','wrijfdoeken','wrijfhouten','wrijfkussens','wrijfpalen','wrijfstenen','wrijft','wrijvingen','wrijvingscoefficienten','wrik','wrikkel','wrikkelde','wrikriemen','wrikt','wrikte','wrikten','wring','wringers','wringt','wriemelende','wrijvend','wrijvende','wrijvingspunten','wringend','wringende','wrijvingshoeken','wrijvingsvlakken','wrijvingskrachten'} |
-- These used to be defined in subterrane, but now dfcaverns handles it.
if not minetest.registered_nodes["subterrane:wet_flowstone"] then
minetest.register_alias("subterrane:dry_stal_1", "df_mapitems:dry_stal_1")
minetest.register_alias("subterrane:dry_stal_2", "df_mapitems:dry_stal_2")
minetest.register_alias("subterrane:dry_stal_3", "df_mapitems:dry_stal_3")
minetest.register_alias("subterrane:dry_stal_4", "df_mapitems:dry_stal_4")
minetest.register_alias("subterrane:wet_stal_1", "df_mapitems:wet_stal_1")
minetest.register_alias("subterrane:wet_stal_2", "df_mapitems:wet_stal_2")
minetest.register_alias("subterrane:wet_stal_3", "df_mapitems:wet_stal_3")
minetest.register_alias("subterrane:wet_stal_4", "df_mapitems:wet_stal_4")
minetest.register_alias("subterrane:wet_flowstone", "df_mapitems:wet_flowstone")
minetest.register_alias("subterrane:dry_flowstone", "df_mapitems:dry_flowstone")
end
minetest.register_alias("dfcaverns:cave_coral_3" , "df_mapitems:cave_coral_3" )
minetest.register_alias("dfcaverns:cave_coral_2" , "df_mapitems:cave_coral_2" )
minetest.register_alias("dfcaverns:cave_coral_1" , "df_mapitems:cave_coral_1" )
minetest.register_alias("dfcaverns:dry_stal_1" , "df_mapitems:dry_stal_1" )
minetest.register_alias("dfcaverns:dry_stal_2" , "df_mapitems:dry_stal_2" )
minetest.register_alias("dfcaverns:dry_stal_3" , "df_mapitems:dry_stal_3" )
minetest.register_alias("dfcaverns:dry_stal_4" , "df_mapitems:dry_stal_4" )
minetest.register_alias("dfcaverns:wet_stal_1" , "df_mapitems:wet_stal_1" )
minetest.register_alias("dfcaverns:wet_stal_2" , "df_mapitems:wet_stal_2" )
minetest.register_alias("dfcaverns:wet_stal_3" , "df_mapitems:wet_stal_3" )
minetest.register_alias("dfcaverns:wet_stal_4" , "df_mapitems:wet_stal_4" )
minetest.register_alias("dfcaverns:wet_flowstone" , "df_mapitems:wet_flowstone" )
minetest.register_alias("dfcaverns:dry_flowstone" , "df_mapitems:dry_flowstone" )
minetest.register_alias("dfcaverns:icicle_1" , "df_mapitems:icicle_1" )
minetest.register_alias("dfcaverns:icicle_2" , "df_mapitems:icicle_2" )
minetest.register_alias("dfcaverns:icicle_3" , "df_mapitems:icicle_3" )
minetest.register_alias("dfcaverns:icicle_4" , "df_mapitems:icicle_4" )
minetest.register_alias("dfcaverns:glow_mese" , "df_mapitems:glow_mese" )
minetest.register_alias("dfcaverns:glow_ruby_ore" , "df_mapitems:glow_ruby_ore" )
minetest.register_alias("dfcaverns:big_crystal" , "df_mapitems:big_crystal" )
minetest.register_alias("dfcaverns:med_crystal" , "df_mapitems:med_crystal" )
minetest.register_alias("dfcaverns:big_crystal_30" , "df_mapitems:big_crystal_30" )
minetest.register_alias("dfcaverns:med_crystal_30" , "df_mapitems:med_crystal_30" )
minetest.register_alias("dfcaverns:big_crystal_30_45" , "df_mapitems:big_crystal_30_45" )
minetest.register_alias("dfcaverns:med_crystal_30_45" , "df_mapitems:med_crystal_30_45" )
minetest.register_alias("dfcaverns:glow_worm" , "df_mapitems:glow_worm" )
minetest.register_alias("dfcaverns:dirt_with_cave_moss" , "df_mapitems:dirt_with_cave_moss" )
minetest.register_alias("dfcaverns:cobble_with_floor_fungus" , "df_mapitems:cobble_with_floor_fungus" )
minetest.register_alias("dfcaverns:cobble_with_floor_fungus_fine", "df_mapitems:cobble_with_floor_fungus_fine")
minetest.register_alias("dfcaverns:snareweed" , "df_mapitems:snareweed" ) |
ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end) |
--[[
A Pandoc 2 Lua filter converting Pandoc native divs to LaTeX environments
Author: Romain Lesur, Christophe Dervieux, and Yihui Xie
License: Public domain
--]]
Div = function (div)
local options = div.attributes['data-latex']
if options == nil then return nil end
-- if the output format is not latex, remove the data-latex attr and return
if FORMAT ~= 'latex' and FORMAT ~= 'beamer' then
div.attributes['data-latex'] = nil
return div
end
local env = div.classes[1]
-- if the div has no class, the object is left unchanged
if not env then return nil end
-- insert raw latex before content
table.insert(
div.content, 1,
pandoc.RawBlock('tex', '\\begin' .. '{' .. env .. '}' .. options)
)
-- insert raw latex after content
table.insert(
div.content,
pandoc.RawBlock('tex', '\\end{' .. env .. '}')
)
return div
end
|
-- RESOURCE CATCHER OBJECT --
-- List of Water Tile --
local waterTileList = {deepwater=true, ["deepwater-green"]=true, water=true, ["water-green"]=true,
["water-mud"]=true, ["water-shallow"]=true}
-- Create the Resource Catcher base Object --
RC = {
ent = nil,
player = "",
MF = nil,
entID = 0,
lightID = 0,
spriteID = 0,
updateTick = 100,
justCreated = true,
filled = false,
haveResource = false,
resourceName = nil,
resourceAmount = nil,
lastUpdate = 0
}
-- Constructor --
function RC:new(object)
if object == nil then return end
local t = {}
local mt = {}
setmetatable(t, mt)
mt.__index = RC
t.ent = object
if object.last_user == nil then return end
t.player = object.last_user.name
t.MF = getMF(t.player)
t.entID = object.unit_number
-- Draw the Light Sprite --
t.lightID = rendering.draw_light{sprite="ResourceCatcher", target=object, surface=object.surface, minimum_darkness=0}
UpSys.addObj(t)
return t
end
-- Reconstructor --
function RC:rebuild(object)
if object == nil then return end
local mt = {}
mt.__index = RC
setmetatable(object, mt)
end
-- Destructor --
function RC:remove()
-- Destroy the Light --
rendering.destroy(self.lightID)
rendering.destroy(self.spriteID)
-- Remove from the Update System --
UpSys.removeObj(self)
end
-- Is valid --
function RC:valid()
if self.ent ~= nil and self.ent.valid then return true end
return false
end
-- Update --
function RC:update()
-- Set the lastUpdate variable --
self.lastUpdate = game.tick
-- Check the Validity --
if self.ent == nil or self.ent.valid == false then
return
end
-- Draw the Green Sprite if needed --
if self.haveResource == true then
self.spriteID = rendering.draw_sprite{sprite="ResourceCatcher", target=self.ent, surface=self.ent.surface}
end
-- Allow to Update next time --
if self.justCreated == true then
self.justCreated = false
return
end
-- Check if the Resource Catcher already has a Resource inside --
if self.haveResource == true then
-- Check if there is a Dimensionnal Tile below --
local tile = self.ent.surface.get_tile(self.ent.position.x, self.ent.position.y)
if tile ~= nil and tile.valid == true and tile.name == "DimensionalTile" then
if game.tile_prototypes[self.resourceName] ~= nil then
-- If this is a Tile --
self.ent.surface.set_tiles({{name=self.resourceName, position=self.ent.position}})
self.ent.destroy()
return
elseif game.entity_prototypes[self.resourceName] ~= nil then
-- If this is a Resource, check if the Position is valid --
if self.ent.surface.can_place_entity{name=self.resourceName, position=self.ent.position} then
-- Create the Entity --
self.ent.surface.create_entity{name=self.resourceName, position=self.ent.position, amount=self.resourceAmount}
self.ent.destroy()
return
else
-- The Resource can't be placed here --
game.players[self.player].create_local_flying_text{text={"info.CantPlaceResourceHere"}, position=self.ent.position}
end
else
-- The resource doesn't exist anymore --
game.players[self.player].create_local_flying_text{text={"info.ResourceMissing"}, position=self.ent.position}
end
else
-- The Resource Catcher is not on a Dimensional Tile --
game.players[self.player].create_local_flying_text{text={"info.NoDimTile"}, position=self.ent.position}
end
return
end
-- Stop Updating if the Resource Catcher is filled --
if self.filled == true then return end
-- Create the Variables --
local isTile = false
local resource = nil
-- Try to find Water --
local tile = self.ent.surface.get_tile(self.ent.position.x, self.ent.position.y)
if tile ~= nil and tile.valid == true and waterTileList[tile.name] == true then
isTile = true
resource = tile
end
-- Try to find a Ore/Fluid Path --
if resource == nil then
local path = self.ent.surface.find_entities_filtered{position=self.ent.position, type="resource", limit=1}
if path[1] ~= nil and path[1].valid == true then resource = path[1] end
end
-- Check the Ressource --
if resource ~= nil and (game.tile_prototypes[resource.name] ~= nil or game.entity_prototypes[resource.name] ~= nil) then
if game.players[self.player] ~= nil then
-- Create the Text and remove the Resource (Exept Water) --
local text = ""
if isTile == true or resource.amount == nil or resource.amount <= 0 then
self.resourceName = resource.name
text = {"", game.tile_prototypes[resource.name].localised_name, " ", {"info.Caught"}}
else
self.resourceName = resource.name
self.resourceAmount = resource.amount
text = {"", resource.amount, " ", game.entity_prototypes[resource.name].localised_name, " ", {"info.Caught"}}
resource.destroy()
end
game.players[self.player].create_local_flying_text{text=text, position=self.ent.position}
end
else
-- If no Resource was found --
local text = {"", {"info.NoCatch"}}
game.players[self.player].create_local_flying_text{text=text, position=self.ent.position}
return
end
-- Create the Smoke --
self.ent.surface.create_trivial_smoke{name="nuclear-smoke", position=self.ent.position}
-- Draw the Green Sprite --
self.spriteID = rendering.draw_sprite{sprite="ResourceCatcher", target=self.ent, surface=self.ent.surface}
-- Set the Resource Catcher filled --
self.filled = true
end
-- Item Tags to Content --
function RC:itemTagsToContent(tags)
self.resourceName = tags.resourceName
self.resourceAmount = tags.resourceAmount
if self.resourceName ~= nil then
self.haveResource = true
self.filled = true
end
end
-- Content to Item Tags --
function RC:contentToItemTags(tags)
-- Get the Resource Localized Name --
local locResourceName = ""
if game.tile_prototypes[self.resourceName] ~= nil then
-- Get the Tile Name --
locResourceName = game.tile_prototypes[self.resourceName].localised_name
elseif game.entity_prototypes[self.resourceName] ~= nil then
-- Get the Resource Name --
locResourceName = game.entity_prototypes[self.resourceName].localised_name
else
-- The Prototype doesn't exist anymore --
return
end
-- Create the Tooltips --
if self.resourceAmount == nil then
tags.set_tag("Infos", {resourceName=self.resourceName})
tags.custom_description = {"", tags.prototype.localised_description, {"item-description.ResourceCatcherC1", locResourceName}}
else
tags.set_tag("Infos", {resourceName=self.resourceName, resourceAmount=self.resourceAmount})
tags.custom_description = {"", tags.prototype.localised_description, {"item-description.ResourceCatcherC2", locResourceName, Util.toRNumber(self.resourceAmount)}}
end
end
-- Tooltip Infos --
-- function RC:getTooltipInfos(GUI)
-- end |
object_tangible_component_chemistry_shared_stimpack_charge_loader = SharedTangibleObjectTemplate:new {
clientTemplateFileName = "object/tangible/component/chemistry/shared_stimpack_charge_loader.iff"
}
ObjectTemplates:addClientTemplate(object_tangible_component_chemistry_shared_stimpack_charge_loader, "object/tangible/component/chemistry/shared_stimpack_charge_loader.iff")
------------------------------------------------------------------------------------------------------------------------------------
|
--
-- Dependencies: `pl.utils`, `pl.path`, `pl.tablex`
--
-- Soft Dependencies: `alien`, `ffi` (either are used on Windows for copying/moving files)
-- @module pl.dir
local utils = require 'pl.utils'
local path = require 'pl.path'
local is_windows = path.is_windows
local tablex = require 'pl.tablex'
local ldir = path.dir
local chdir = path.chdir
local mkdir = path.mkdir
local rmdir = path.rmdir
local sub = string.sub
local os,pcall,ipairs,pairs,require,setmetatable,_G = os,pcall,ipairs,pairs,require,setmetatable,_G
local remove = os.remove
local append = table.insert
local wrap = coroutine.wrap
local yield = coroutine.yield
local assert_arg,assert_string,raise = utils.assert_arg,utils.assert_string,utils.raise
local List = utils.stdmt.List
local dir = {}
local function assert_dir (n,val)
assert_arg(n,val,'string',path.isdir,'not a directory',4)
end
local function assert_file (n,val)
assert_arg(n,val,'string',path.isfile,'not a file',4)
end
local function filemask(mask)
mask = utils.escape(mask)
return mask:gsub('%%%*','.+'):gsub('%%%?','.')..'$'
end
--- does the filename match the shell pattern?.
-- (cf. fnmatch.fnmatch in Python, 11.8)
-- @string file A file name
-- @string pattern A shell pattern
-- @treturn bool
-- @raise file and pattern must be strings
function dir.fnmatch(file,pattern)
assert_string(1,file)
assert_string(2,pattern)
return path.normcase(file):find(filemask(pattern)) ~= nil
end
--- return a list of all files which match the pattern.
-- (cf. fnmatch.filter in Python, 11.8)
-- @string files A table containing file names
-- @string pattern A shell pattern.
-- @treturn List(string) list of files
-- @raise file and pattern must be strings
function dir.filter(files,pattern)
assert_arg(1,files,'table')
assert_string(2,pattern)
local res = {}
local mask = filemask(pattern)
for i,f in ipairs(files) do
if f:find(mask) then append(res,f) end
end
return setmetatable(res,List)
end
local function _listfiles(dir,filemode,match)
local res = {}
local check = utils.choose(filemode,path.isfile,path.isdir)
if not dir then dir = '.' end
for f in ldir(dir) do
if f ~= '.' and f ~= '..' then
local p = path.join(dir,f)
if check(p) and (not match or match(p)) then
append(res,p)
end
end
end
return setmetatable(res,List)
end
--- return a list of all files in a directory which match the a shell pattern.
-- @string dir A directory. If not given, all files in current directory are returned.
-- @string mask A shell pattern. If not given, all files are returned.
-- @treturn {string} list of files
-- @raise dir and mask must be strings
function dir.getfiles(dir,mask)
assert_dir(1,dir)
if mask then assert_string(2,mask) end
local match
if mask then
mask = filemask(mask)
match = function(f)
return f:find(mask)
end
end
return _listfiles(dir,true,match)
end
--- return a list of all subdirectories of the directory.
-- @string dir A directory
-- @treturn {string} a list of directories
-- @raise dir must be a a valid directory
function dir.getdirectories(dir)
assert_dir(1,dir)
return _listfiles(dir,false)
end
local function quote_argument (f)
f = path.normcase(f)
if f:find '%s' then
return '"'..f..'"'
else
return f
end
end
local alien,ffi,ffi_checked,CopyFile,MoveFile,GetLastError,win32_errors,cmd_tmpfile
local function execute_command(cmd,parms)
if not cmd_tmpfile then cmd_tmpfile = path.tmpname () end
local err = path.is_windows and ' > ' or ' 2> '
cmd = cmd..' '..parms..err..cmd_tmpfile
local ret = utils.execute(cmd)
if not ret then
local err = (utils.readfile(cmd_tmpfile):gsub('\n(.*)',''))
remove(cmd_tmpfile)
return false,err
else
remove(cmd_tmpfile)
return true
end
end
local function find_ffi_copyfile ()
if not ffi_checked then
ffi_checked = true
local res
res,alien = pcall(require,'alien')
if not res then
alien = nil
res, ffi = pcall(require,'ffi')
end
if not res then
ffi = nil
return
end
else
return
end
if alien then
-- register the Win32 CopyFile and MoveFile functions
local kernel = alien.load('kernel32.dll')
CopyFile = kernel.CopyFileA
CopyFile:types{'string','string','int',ret='int',abi='stdcall'}
MoveFile = kernel.MoveFileA
MoveFile:types{'string','string',ret='int',abi='stdcall'}
GetLastError = kernel.GetLastError
GetLastError:types{ret ='int', abi='stdcall'}
elseif ffi then
ffi.cdef [[
int CopyFileA(const char *src, const char *dest, int iovr);
int MoveFileA(const char *src, const char *dest);
int GetLastError();
]]
CopyFile = ffi.C.CopyFileA
MoveFile = ffi.C.MoveFileA
GetLastError = ffi.C.GetLastError
end
win32_errors = {
ERROR_FILE_NOT_FOUND = 2,
ERROR_PATH_NOT_FOUND = 3,
ERROR_ACCESS_DENIED = 5,
ERROR_WRITE_PROTECT = 19,
ERROR_BAD_UNIT = 20,
ERROR_NOT_READY = 21,
ERROR_WRITE_FAULT = 29,
ERROR_READ_FAULT = 30,
ERROR_SHARING_VIOLATION = 32,
ERROR_LOCK_VIOLATION = 33,
ERROR_HANDLE_DISK_FULL = 39,
ERROR_BAD_NETPATH = 53,
ERROR_NETWORK_BUSY = 54,
ERROR_DEV_NOT_EXIST = 55,
ERROR_FILE_EXISTS = 80,
ERROR_OPEN_FAILED = 110,
ERROR_INVALID_NAME = 123,
ERROR_BAD_PATHNAME = 161,
ERROR_ALREADY_EXISTS = 183,
}
end
local function two_arguments (f1,f2)
return quote_argument(f1)..' '..quote_argument(f2)
end
local function file_op (is_copy,src,dest,flag)
if flag == 1 and path.exists(dest) then
return false,"cannot overwrite destination"
end
if is_windows then
-- if we haven't tried to load Alien/LuaJIT FFI before, then do so
find_ffi_copyfile()
-- fallback if there's no Alien, just use DOS commands *shudder*
-- 'rename' involves a copy and then deleting the source.
if not CopyFile then
src = path.normcase(src)
dest = path.normcase(dest)
local cmd = is_copy and 'copy' or 'rename'
local res, err = execute_command('copy',two_arguments(src,dest))
if not res then return false,err end
if not is_copy then
return execute_command('del',quote_argument(src))
end
return true
else
if path.isdir(dest) then
dest = path.join(dest,path.basename(src))
end
local ret
if is_copy then ret = CopyFile(src,dest,flag)
else ret = MoveFile(src,dest) end
if ret == 0 then
local err = GetLastError()
for name,value in pairs(win32_errors) do
if value == err then return false,name end
end
return false,"Error #"..err
else return true
end
end
else -- for Unix, just use cp for now
return execute_command(is_copy and 'cp' or 'mv',
two_arguments(src,dest))
end
end
--- copy a file.
-- @string src source file
-- @string dest destination file or directory
-- @bool flag true if you want to force the copy (default)
-- @treturn bool operation succeeded
-- @raise src and dest must be strings
function dir.copyfile (src,dest,flag)
assert_string(1,src)
assert_string(2,dest)
flag = flag==nil or flag
return file_op(true,src,dest,flag and 0 or 1)
end
--- move a file.
-- @string src source file
-- @string dest destination file or directory
-- @treturn bool operation succeeded
-- @raise src and dest must be strings
function dir.movefile (src,dest)
assert_string(1,src)
assert_string(2,dest)
return file_op(false,src,dest,0)
end
local function _dirfiles(dir,attrib)
local dirs = {}
local files = {}
for f in ldir(dir) do
if f ~= '.' and f ~= '..' then
local p = path.join(dir,f)
local mode = attrib(p,'mode')
if mode=='directory' then
append(dirs,f)
else
append(files,f)
end
end
end
return setmetatable(dirs,List),setmetatable(files,List)
end
local function _walker(root,bottom_up,attrib)
local dirs,files = _dirfiles(root,attrib)
if not bottom_up then yield(root,dirs,files) end
for i,d in ipairs(dirs) do
_walker(root..path.sep..d,bottom_up,attrib)
end
if bottom_up then yield(root,dirs,files) end
end
--- return an iterator which walks through a directory tree starting at root.
-- The iterator returns (root,dirs,files)
-- Note that dirs and files are lists of names (i.e. you must say path.join(root,d)
-- to get the actual full path)
-- If bottom_up is false (or not present), then the entries at the current level are returned
-- before we go deeper. This means that you can modify the returned list of directories before
-- continuing.
-- This is a clone of os.walk from the Python libraries.
-- @string root A starting directory
-- @bool bottom_up False if we start listing entries immediately.
-- @bool follow_links follow symbolic links
-- @return an iterator returning root,dirs,files
-- @raise root must be a directory
function dir.walk(root,bottom_up,follow_links)
assert_dir(1,root)
local attrib
if path.is_windows or not follow_links then
attrib = path.attrib
else
attrib = path.link_attrib
end
return wrap(function () _walker(root,bottom_up,attrib) end)
end
--- remove a whole directory tree.
-- @string fullpath A directory path
-- @return true or nil
-- @return error if failed
-- @raise fullpath must be a string
function dir.rmtree(fullpath)
assert_dir(1,fullpath)
if path.islink(fullpath) then return false,'will not follow symlink' end
for root,dirs,files in dir.walk(fullpath,true) do
for i,f in ipairs(files) do
local res, err = remove(path.join(root,f))
if not res then return nil,err end
end
local res, err = rmdir(root)
if not res then return nil,err end
end
return true
end
local dirpat
if path.is_windows then
dirpat = '(.+)\\[^\\]+$'
else
dirpat = '(.+)/[^/]+$'
end
local _makepath
function _makepath(p)
-- windows root drive case
if p:find '^%a:[\\]*$' then
return true
end
if not path.isdir(p) then
local subp = p:match(dirpat)
local ok, err = _makepath(subp)
if not ok then return nil, err end
return mkdir(p)
else
return true
end
end
--- create a directory path.
-- This will create subdirectories as necessary!
-- @string p A directory path
-- @return true on success, nil + errormsg on failure
-- @raise failure to create
function dir.makepath (p)
assert_string(1,p)
return _makepath(path.normcase(path.abspath(p)))
end
--- clone a directory tree. Will always try to create a new directory structure
-- if necessary.
-- @string path1 the base path of the source tree
-- @string path2 the new base path for the destination
-- @func file_fun an optional function to apply on all files
-- @bool verbose an optional boolean to control the verbosity of the output.
-- It can also be a logging function that behaves like print()
-- @return true, or nil
-- @return error message, or list of failed directory creations
-- @return list of failed file operations
-- @raise path1 and path2 must be strings
-- @usage clonetree('.','../backup',copyfile)
function dir.clonetree (path1,path2,file_fun,verbose)
assert_string(1,path1)
assert_string(2,path2)
if verbose == true then verbose = print end
local abspath,normcase,isdir,join = path.abspath,path.normcase,path.isdir,path.join
local faildirs,failfiles = {},{}
if not isdir(path1) then return raise 'source is not a valid directory' end
path1 = abspath(normcase(path1))
path2 = abspath(normcase(path2))
if verbose then verbose('normalized:',path1,path2) end
-- particularly NB that the new path isn't fully contained in the old path
if path1 == path2 then return raise "paths are the same" end
local i1,i2 = path2:find(path1,1,true)
if i2 == #path1 and path2:sub(i2+1,i2+1) == path.sep then
return raise 'destination is a subdirectory of the source'
end
local cp = path.common_prefix (path1,path2)
local idx = #cp
if idx == 0 then -- no common path, but watch out for Windows paths!
if path1:sub(2,2) == ':' then idx = 3 end
end
for root,dirs,files in dir.walk(path1) do
local opath = path2..root:sub(idx)
if verbose then verbose('paths:',opath,root) end
if not isdir(opath) then
local ret = dir.makepath(opath)
if not ret then append(faildirs,opath) end
if verbose then verbose('creating:',opath,ret) end
end
if file_fun then
for i,f in ipairs(files) do
local p1 = join(root,f)
local p2 = join(opath,f)
local ret = file_fun(p1,p2)
if not ret then append(failfiles,p2) end
if verbose then
verbose('files:',p1,p2,ret)
end
end
end
end
return true,faildirs,failfiles
end
--- return an iterator over all entries in a directory tree
-- @string d a directory
-- @return an iterator giving pathname and mode (true for dir, false otherwise)
-- @raise d must be a non-empty string
function dir.dirtree( d )
assert( d and d ~= "", "directory parameter is missing or empty" )
local exists, isdir = path.exists, path.isdir
local sep = path.sep
local last = sub ( d, -1 )
if last == sep or last == '/' then
d = sub( d, 1, -2 )
end
local function yieldtree( dir )
for entry in ldir( dir ) do
if entry ~= "." and entry ~= ".." then
entry = dir .. sep .. entry
if exists(entry) then -- Just in case a symlink is broken.
local is_dir = isdir(entry)
yield( entry, is_dir )
if is_dir then
yieldtree( entry )
end
end
end
end
end
return wrap( function() yieldtree( d ) end )
end
--- Recursively returns all the file starting at _path_. It can optionally take a shell pattern and
-- only returns files that match _pattern_. If a pattern is given it will do a case insensitive search.
-- @string start_path A directory. If not given, all files in current directory are returned.
-- @string pattern A shell pattern. If not given, all files are returned.
-- @treturn List(string) containing all the files found recursively starting at _path_ and filtered by _pattern_.
-- @raise start_path must be a directory
function dir.getallfiles( start_path, pattern )
assert_dir(1,start_path)
pattern = pattern or ""
local files = {}
local normcase = path.normcase
for filename, mode in dir.dirtree( start_path ) do
if not mode then
local mask = filemask( pattern )
if normcase(filename):find( mask ) then
files[#files + 1] = filename
end
end
end
return setmetatable(files,List)
end
return dir
|
-- 6Harmonics Qige @ K2E 7S4
-- 2017.03.01
require 'grid.base.cgi'
require 'grid.base.user'
require 'grid.base.fmt'
require 'grid.Http'
require 'grid.ABB'
require 'grid.GWS'
require 'grid.NW'
require 'grid.SYS'
Get = {}
function Get.Run()
cgi.save.init()
local _result = ''
if (user.verify.remote()) then
local _get = cgi.data._get
local _k = fmt.http.find('k', _get)
--_k = 'delayed'
--_k = 'instant'
if (_k == 'instant') then
_result = Get.ops.instant()
elseif (_k == 'delayed') then
_result = Get.ops.delayed()
else
_result = string.format('unknown (%s)', _k or '[nil]')
end
Http.job.Reply(_result)
else
Http.data.Error('nobody');
end
end
-- #define
Get.conf = {}
Get.ops = {}
-- ABB, Nw
-- abb.bssid, abb.ssid, abb.mode, abb.key, abb.snr, abb.txmcs, abb.rxmcs
-- abb.peer_qty, abb.peers[]
-- nw.bridge, nw.wan_ip, nw.wan_txb, nw.wan_rxb, nw.lan_ip, nw.lan_txb, nw.lan_rxb
function Get.ops.instant()
local _fmt = '{ "abb": %s, "nw": %s, "ts": %d }'
local _abb = Get.ops.abb()
local _nw = Get.ops.nw()
local _ts = os.time()
local _result = string.format(_fmt, _abb, _nw, _ts)
return _result
end
-- gws.region, gws.channle, gws.rxgain, gws.txpwr, gws.agc, gws.tpc, gws.freq, gws.chanbw
-- sys.atf, sys.tdma, sys.dhcp, sys.firewall, sys.qos
function Get.ops.delayed()
local _fmt = '{ "gws": %s, "sys": %s, "ts": %d }'
local _gws = Get.ops.gws()
local _sys = Get.ops.sys()
local _ts = os.time()
local _result = string.format(_fmt, _gws, _sys, _ts)
--_result = '{ "gws": null, "sys": null }'
return _result
end
function Get.ops.abb()
local _result = ABB.ops.Update()
return _result
end
function Get.ops.gws()
local _result = GWS.ops.Update()
return _result
end
function Get.ops.nw()
local _result = NW.ops.Update()
--io.write('Get.ops.nw() ' .. _result .. '\n')
return _result
end
function Get.ops.sys()
local _result = SYS.ops.Update()
return _result
end
return Get
|
local path = mod_loader.mods[modApi.currentMod].scriptPath
local clip = require(path .."libs/clip")
local Ui2 = require(path .."ui/Ui2")
local DecoNumber = require(path .."ui/deco/decoNumber")
local this = Class.inherit(Ui2)
function this:new(loc, number, scale, color)
Ui2.new(self)
self.translucent = true
number = number or nil
scale = scale or 2
color = color or nil
self:pospx(loc.x, loc.y)
:decorate{
DecoAlign(-18, 37),
DecoNumber(number, scale, color)
}
end
function this:draw(screen)
clip(Ui2, self, screen)
end
return this |
--------------------------------------------------------------------------------
-- Handler.......... : onBuyFullVersion
-- Author........... : Bérenger Dalle-Cort
-- Description...... : Open the URL for to buy the fulle version of the application.
-- This handler is mostly used for mobile lite version
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
function Main.onBuyFullVersion ( )
--------------------------------------------------------------------------------
local sURL
local osType = system.getOSType ( )
if ( osType == system.kOSTypeIPhone )
then
sURL = application.getCurrentUserEnvironmentVariable ( "system.url.ITunesFullVersion" )
elseif ( osType == system.kOSTypeAndroid)
then
sURL = application.getCurrentUserEnvironmentVariable ( "system.url.AndroidFullVersion" )
elseif ( osType == system.kOSTypeBlackBerry )
then
sURL = application.getCurrentUserEnvironmentVariable ( "system.url.BlackBerryFullVersion" )
end
if ( sURL ~= nil)
then
system.openURL ( sURL, "_blank" )
end
--------------------------------------------------------------------------------
end
--------------------------------------------------------------------------------
|
local cfg = {}
cfg.inventory_weight_per_strength = 10 -- weight for an user inventory per strength level (no unit, but thinking in "kg" is a good norm)
-- default chest weight for vehicle trunks
cfg.default_vehicle_chest_weight = 50
-- define vehicle chest weight by model in lower case
cfg.vehicle_chest_weights = {
-- lastbiler
["tiptruck"] = 250,
["rumpo2"] = 100,
["minivan"] = 100,
["moonbeam2"] = 100,
["speedo4"] = 100,
["surfer"] = 100,
["bf400"] = 5,
["akuma"] = 5,
["sanchez"] = 5,
["bati"] = 5,
["dubsta2"] = 80,
["granger"] = 100,
["yosemite"] = 100,
["bobcatxl"] = 100,
["journey"] = 100,
["bison"] = 100,
["burrito4"] = 100,
["burrito"] = 100,
["youga"] = 100,
["paradise"] = 100,
["bmx"] = 0,
["cruiser"] = 0,
["fixter"] = 0,
["Scorcher"] = 0,
["tribike"] = 0,
["tribike2"] = 0,
["tribike3"] = 0,
["gargoyle"] = 2,
["dubsta3"] = 160,
["rumpo"] = 125,
["718boxster"] = 60,
["a45amg"] = 30,
["bmci"] = 60,
["bmws"] = 5,
["c7"] = 40,
["cls2015"] = 60,
["dawn"] = 60,
["fc15"] = 40,
["g65amg"] = 80,
["huralbcamber"] = 20,
["i8"] = 20,
["lp610"] = 20,
["m6f13"] = 60,
["mgt"] = 50,
["mi8"] = 20,
["panamera17turbo"] = 60,
["pcs18"] = 65,
["r1"] = 5,
["r8ppi"] = 20,
["rs7"] = 45,
["s500w222"] = 55,
["sq72016"] = 65,
["srt8"] = 65,
["urus2018"] = 65,
["x6m"] = 60,
["zl12017"] = 60,
["mule3"] = 300,
["sq72016"] = 110,
}
return cfg
|
local helpers = require "spec.helpers"
local PLUGIN_NAME = "upstreamrouter"
local tooling = require("kong.plugins."..PLUGIN_NAME..".tooling")
local cjson = require "cjson"
local route_config = {
["activations"] = {{
upstream = "test1",
headers = {
test = "header1",
specialheader = "specialheader"
},
},
{
upstream = "test2",
headers = {
test = "header2",
specialheader = "specialheader"
},
},
{
upstream = "mockbin",
headers = {
test = "header3",
specialheader = "specialheader"
},
},
},
}
for _, strategy in helpers.each_strategy() do
describe(PLUGIN_NAME .. ": (access) [#" .. strategy .. "]", function()
local client
lazy_setup(function()
local bp = helpers.get_db_utils(strategy, nil, { PLUGIN_NAME })
local service = bp.services:insert {
protocol = helpers.mock_upstream_protocol,
host ="httpbin.org",
port = 80,
name = "httpbin"
}
local route1 = bp.routes:insert({
hosts = { "httpbin.org" },
service = service
})
local upstream = bp.upstreams:insert({
name = "mockbin",
host_header = "mockbin.org"
})
bp.targets:insert({
target = helpers.mock_upstream_host .. ":" .. helpers.mock_upstream_port,
upstream = { id = upstream.id }
})
bp.plugins:insert {
name = PLUGIN_NAME,
route = { id = route1.id },
config = route_config,
}
assert(helpers.start_kong({
database = strategy,
nginx_conf = "spec/fixtures/custom_nginx.template",
plugins = "bundled," .. PLUGIN_NAME,
}))
end)
lazy_teardown(function()
helpers.stop_kong(nil, true)
end)
before_each(function()
client = helpers.proxy_client()
end)
after_each(function()
if client then client:close() end
end)
describe("request", function()
it("redirect request on match", function()
local headers = {
test = "header3",
specialheader = "specialheader",
host = "httpbin.org"
}
local r = client:get("/request", {
headers = headers
})
local upstream = tooling.get_redirect_uri(headers, route_config["activations"])
assert.are.equal(upstream, "mockbin")
local body = assert.res_status(200, r)
local json = cjson.decode(body)
assert.equal("http://mockbin.org:15555/request", json.url)
end)
end)
end)
end
|
--[[-----------------------------------------------------------------------------
* Infected Wars, an open source Garry's Mod game-mode.
*
* Infected Wars is the work of multiple authors,
* a full list can be found in CONTRIBUTORS.md.
* For more information, visit https://github.com/JarnoVgr/InfectedWars
*
* Infected Wars is free software: you can redistribute it and/or modify
* it under the terms of the MIT License.
*
* A full copy of the MIT License can be found in LICENSE.txt.
-----------------------------------------------------------------------------]]
/*-----------------
Make derma skin
-------------------*/
local SKIN = {}
SKIN.bg_color = Color( 0,0,0,250 )
SKIN.control_color = Color( 30, 30, 30, 255 )
SKIN.control_color_highlight = Color( 50, 50, 50, 255 )
SKIN.control_color_active = Color( 50, 50, 120, 255 )
SKIN.control_color_bright = Color( 150, 100, 50, 255 )
SKIN.control_color_dark = Color( 30, 30, 30, 255 )
function SKIN:DrawGenericBackground( x, y, w, h, color )
surface.SetDrawColor( color )
surface.DrawRect( x, y, w, h )
surface.SetDrawColor( 50, 50, 50, 200 )
surface.DrawOutlinedRect( x, y, w, h )
surface.SetDrawColor( 50, 50, 50, 255 )
surface.DrawOutlinedRect( x+1, y+1, w-2, h-2 )
end
function SKIN:PaintFrame( panel )
local color = self.bg_color
self:DrawGenericBackground( 0, 0, panel:GetWide(), panel:GetTall(), color )
surface.SetDrawColor( 50, 50, 50, 255 )
surface.DrawRect( 1, 21, panel:GetWide()-2, 1 )
end
function SKIN:PaintTextEntry( panel )
if ( panel.m_bBackground ) then
surface.SetDrawColor( 60, 60, 60, 240 )
surface.DrawRect( 0, 0, panel:GetWide(), panel:GetTall() )
end
panel:DrawTextEntryText( panel.m_colText, panel.m_colHighlight, panel.m_colCursor )
if ( panel.m_bBorder ) then
surface.SetDrawColor( 50, 50, 50, 255 )
surface.DrawOutlinedRect( 0, 0, panel:GetWide(), panel:GetTall() )
surface.SetDrawColor( 10, 10, 10, 200 )
surface.DrawOutlinedRect( 1, 1, panel:GetWide()-2, panel:GetTall()-2 )
end
end
function SKIN:SchemeTextEntry( panel )
panel:SetTextColor( Color( 200, 200, 200, 255 ) )
panel:SetHighlightColor( Color( 20, 200, 250, 255 ) )
panel:SetCursorColor( Color( 0, 0, 100, 255 ) )
end
derma.DefineSkin( "iw_skin", "Infected Wars Derma Skin", SKIN )
local DESC_CLASS = 1
local DESC_WEAPON = 2
local startPanelOpen = false
local MENU_framewidth = 600
local MENU_subframeheigth = 400
local firstSpawn = false
local roundStart = true
function GM:InitializeMenuVars()
CloseFrames()
DESC_CLASS = 1
DESC_WEAPON = 2
startPanelOpen = false
firstSpawn = false
roundStart = true
end
/*---------- MUSIC ----------*/
CreateClientConVar("_iw_enablemusic", 1, true, false)
MUSIC_ENABLED = util.tobool(GetConVarNumber("_iw_enablemusic"))
function ToggleMusic( pl,commandName,args )
local MySelf = LocalPlayer()
MUSIC_ENABLED = util.tobool(args[1])
if MUSIC_ENABLED then
RunConsoleCommand("_iw_enablemusic","1")
MySelf:PrintMessage( HUD_PRINTTALK, "Music on")
else
RunConsoleCommand("_iw_enablemusic","0")
MySelf:PrintMessage( HUD_PRINTTALK, "Music off")
end
end
concommand.Add("iw_enablemusic",ToggleMusic)
Options = {}
Options[1] = { Value = PP_ON, Desc = "Toggle all screeneffects", Cmd = "iw_enablepp" }
Options[2] = { Value = PP_COLOR, Desc = "^ Toggle colormod", Cmd = "iw_enablecolormod" }
Options[3] = { Value = PP_MOTIONBLUR, Desc = "^ Toggle motionblur", Cmd = "iw_enablemotionblur" }
Options[4] = { Value = PP_BLOOM, Desc = "^ Toggle bloom", Cmd = "iw_enablebloom" }
Options[5] = { Value = PP_SHARPEN, Desc = "^ Toggle sharpen", Cmd = "iw_enablesharpen" }
Options[6] = { Value = HUD_ON, Desc = "Toggle HUD", Cmd = "iw_enablehud" }
Options[7] = { Value = EFFECT_MUZZLE, Desc = "Toggle additional muzzle effect", Cmd = "iw_enablemuzzlefx" }
Options[8] = { Value = EFFECT_SHELL, Desc = "Toggle shell ejection effect", Cmd = "iw_enableshellfx" }
Options[9] = { Value = EFFECT_UBERGORE, Desc = "Toggle gore", Cmd = "iw_enablegore" }
Options[10] = { Value = MUSIC_ENABLED, Desc = "Toggle game music", Cmd = "iw_enablemusic" }
Options[11] = { Value = CL_HANDS, Desc = "Toggle custom hands", Cmd = "iw_clhands" }
function amountOfPlayerInClass( class, team )
local count = 0
for k, v in pairs(player.GetAll()) do
if v:GetPlayerClass() == class and v:Team() == team then
count = count+1
end
end
return count
end
/*-----------------------------------------------
Translate weapon names (for descriptions)
------------------------------------------------*/
/*-----------------------------
CREATE MAIN FRAME PANEL
-------------------------------*/
function createMainFrame()
frame = vgui.Create("DFrame")
frame:SetPos(w/2-MENU_framewidth/2,h/2-(MENU_subframeheigth)/2-45)
frame:SetSize(MENU_framewidth, 90)
frame:SetTitle( "Infected Wars Downfall" )
frame:SetVisible( true )
frame:SetSizable(false)
frame:SetDraggable(false)
frame:ShowCloseButton(false)
/*frame.PaintOver = function()
draw.WordBox( 2, MENU_framewidth / 1.53, 0, "FREE UNLOCKS WEEKEND!", "ArialB_18", Color(160,35,35,(math.sin(RealTime() * 3) * 100) + 170), Color(255,255,255,255) )
end*/
frame:MakePopup()
-- Create close button
local buttonClose = vgui.Create("DButton",frame)
buttonClose:SetText( "CLOSE MENU")
buttonClose:SetPos(5,60)
buttonClose:SetSize(MENU_framewidth-10,25)
buttonClose.DoClick = function( )
if subframe and subframe:IsValid() then
subframe:Close()
end
if frame and frame:IsValid() then
frame:Close()
end
end
-- Create help button
local buttonHelp = vgui.Create("DButton",frame)
buttonHelp:SetText( "Help")
buttonHelp:SetPos(6,30)
buttonHelp:SetSize(60,20)
buttonHelp.DoClick = function( btn) RunConsoleCommand("iw_menu_help") end
-- Create class button
local buttonClass = vgui.Create("DButton",frame)
buttonClass:SetText( "Classes")
buttonClass:SetPos(72,30)
buttonClass:SetSize(60,20)
buttonClass.DoClick = function( btn ) RunConsoleCommand("iw_menu_class") end
-- Create options button
local buttonOptions = vgui.Create("DButton",frame)
buttonOptions:SetPos(138,30)
buttonOptions:SetSize(60,20)
buttonOptions:SetText( "Options")
buttonOptions.DoClick = function( btn ) RunConsoleCommand("iw_menu_options") end
-- Create achievements button
local buttonAchiev = vgui.Create("DButton",frame)
buttonAchiev:SetText( "Score")
buttonAchiev:SetPos(204,30)
buttonAchiev:SetSize(60,20)
buttonAchiev.DoClick = function( btn ) RunConsoleCommand("iw_menu_score") end
-- Create about button
local buttonAbout = vgui.Create("DButton",frame)
buttonAbout:SetText( "About")
buttonAbout:SetPos(270,30)
buttonAbout:SetSize(60,20)
buttonAbout.DoClick = function( btn ) RunConsoleCommand("iw_menu_about") end
-- Create donate button
local buttonDonate = vgui.Create("DButton",frame)
buttonDonate:SetText( "Donate")
buttonDonate:SetPos(336,30)
buttonDonate:SetSize(60,20)
buttonDonate.DoClick = function( btn ) RunConsoleCommand("iw_menu_donate") end
-- Create shop button
local buttonShop = vgui.Create("DButton",frame)
buttonShop:SetText( "Shop")
buttonShop:SetPos(402,30)
buttonShop:SetSize(60,20)
buttonShop.DoClick = function( btn ) RunConsoleCommand("iw_menu_shop") end
if (PlayerIsAdmin == true and ADMIN_ADDON) then
local buttonAdmin = vgui.Create("DButton",frame)
buttonAdmin:SetPos(468,30)
buttonAdmin:SetSize(60,20)
buttonAdmin:SetText( "Admin")
buttonAdmin.DoClick = function( btn ) RunConsoleCommand("iw_menu_admin") end
end
-- Make sure the maplist has arrived for the admin panel
if #MapList == 0 and PlayerIsAdmin then
RunConsoleCommand("get_maplist")
end
end
function createSubFrame()
subframe = vgui.Create("DFrame")
subframe:SetPos(w/2-MENU_framewidth/2,h/2-(MENU_subframeheigth)/2+50)
subframe:SetSize(MENU_framewidth, MENU_subframeheigth)
subframe:SetTitle( "Empty frame. Go fix your code! :D" )
subframe:SetVisible( true )
subframe:SetSizable(false)
subframe:SetDraggable(false)
subframe:ShowCloseButton(false)
subframe:MakePopup()
end
/*-----------------------------
CREATE HELP PANEL
-------------------------------*/
function createHelpPanel()
subframe:SetTitle( "Help menu" )
local descbox = vgui.Create("DTextEntry",subframe)
descbox:SetPos( 5, 30 )
descbox:SetSize( MENU_framewidth-110, MENU_subframeheigth-35 )
descbox:SetEditable( false )
descbox:SetValue(HELP_TEXT[1].Text)
descbox:SetMultiline( true )
local button = {}
for k = 1, #HELP_TEXT do
-- Create text-switch buttons
button[k]= vgui.Create("DButton",subframe)
button[k]:SetText( HELP_TEXT[k].Button )
button[k]:SetPos(MENU_framewidth-100,5+(25*k))
button[k]:SetSize(90,20)
button[k].DoClick = function( btn )
descbox:SetValue(HELP_TEXT[k].Text)
end
end
end
/*-----------------------------
CREATE ABOUT PANEL
-------------------------------*/
function createAboutPanel()
subframe:SetTitle( "Dev info and special thanks" )
local descbox = vgui.Create("DTextEntry",subframe)
descbox:SetPos( 5, 30 )
descbox:SetSize( MENU_framewidth-10, MENU_subframeheigth-35 )
descbox:SetEditable( false )
descbox:SetValue(ABOUT_TEXT)
descbox:SetMultiline( true )
end
/*-----------------------------
CREATE SCORE PANEL
-------------------------------*/
function createScorePanel()
subframe:SetTitle( "Achievements and score (achievements requires more than 3 players on server" )
-- create player list
local playerlist = vgui.Create("DComboBox",subframe)
playerlist:SetPos( 5, 60 )
playerlist:SetSize( 150, MENU_subframeheigth-65 )
-- update player list button
local buttonUpdate = vgui.Create("DButton",subframe)
buttonUpdate:SetText( "Update Player List")
buttonUpdate:SetPos(5,30)
buttonUpdate:SetSize(150,25)
-- Top label
local toplabel = vgui.Create("DLabel",subframe)
toplabel:SetText( "Select a player" )
toplabel:SetPos( 170, 30 )
toplabel:SetSize( MENU_framewidth-180, 25 )
-- List view
local list = vgui.Create("DListView",subframe)
list:SetPos(160,60)
list:SetSize(MENU_framewidth-165,MENU_subframeheigth-170)
list.SortByColumn = function() end
local c0 = list:AddColumn( "Score/Achievement" )
local c1 = list:AddColumn( "Progress" )
c0:SetMinWidth( math.floor((MENU_framewidth-165)/2+10) )
c0:SetMaxWidth( math.floor((MENU_framewidth-165)/2+10) )
c1:SetMinWidth( math.floor((MENU_framewidth-165)/2-10) )
c1:SetMaxWidth( math.floor((MENU_framewidth-165)/2-10) )
-- image
local achvimage = vgui.Create("DImage", subframe)
achvimage:SetPos(160,MENU_subframeheigth-105)
achvimage:SetSize(100,100)
achvimage:SetImage( "infectedwars/achv_blank" )
achvimage:SetImageColor( Color(255,255,255,255) )
-- description box
local reasonbox = vgui.Create("DTextEntry",subframe)
reasonbox:SetPos( 265, MENU_subframeheigth-105 )
reasonbox:SetSize( MENU_framewidth-270, 50 )
reasonbox:SetEditable( false )
reasonbox:SetMultiline( true )
reasonbox:SetValue("<< Select something to view the description! >>")
-- unlockinfo box
local unlockbox = vgui.Create("DTextEntry",subframe)
unlockbox:SetPos( 265, MENU_subframeheigth-55 )
unlockbox:SetSize( MENU_framewidth-270, 50 )
unlockbox:SetEditable( false )
unlockbox:SetMultiline( true )
unlockbox:SetValue("")
/*-------------------------------
Functions
-------------------------------*/
function updatePlayerList()
playerlist:Clear()
for k, v in pairs(player.GetAll()) do
v.Item = playerlist:AddItem( v:Name() )
end
updateDoClicks()
if LocalPlayer().Item then
LocalPlayer().Item:Select() -- Calls DoClick
playerlist:SelectItem(LocalPlayer().Item)
end
end
function updateScorelist( pl )
list:Clear()
toplabel:SetText( "Fetching stats of player "..pl:Name().."..." )
if not pl.DataTable then return end
toplabel:SetText( "Stats of player "..pl:Name().." ("..pl:Title()..") " )
list:AddLine( "--------------- SCORE ------------------------------- ","-------------------------------------------" )
local id
for k, v in pairs( recordData ) do
local str = tostring(pl.DataTable[k])
local secs, mins, hours
if k == "timeplayed" then
secs = tonumber(str)
mins = (secs-(secs%60))/60
hours = (secs-(secs%(3600)))/3600
mins = mins-(hours*60)
str = tostring(hours).." hours, "..tostring(mins).." minutes"
end
if k == "progress" then
str = str.."%"
end
id = list:AddLine( v.Name, str )
id.Image = v.Image
id.Desc = v.Desc
id.UnlockInfo = ""
end
list:AddLine( "--------------- UNLOCKABLES ---------------------- ","-------------------------------------------" )
for k, v in ipairs( unlockTable ) do
local str
local unl = true
for i, j in pairs( unlockData[v.UnlockCode] ) do
if not pl.DataTable["achievements"][j] then
unl = false
end
end
if unl then
str = "<< UNLOCKED >>"
else
str = "LOCKED"
end
id = list:AddLine( v.Name, str )
id.Image = "infectedwars/achv_blank"
id.Desc = v.LoadoutInfo
id.UnlockInfo = v.UnlockInfo
end
list:AddLine( "--------------- ACHIEVEMENTS -------------------- ","-------------------------------------------" )
for k, v in ipairs( achievementSorted ) do
local str
if pl.DataTable["achievements"][v] == true then
str = "<< ACHIEVED! >>"
else
str = "Unattained"
end
id = list:AddLine( achievementDesc[v].Name, str )
id.Image = achievementDesc[v].Image
id.Desc = achievementDesc[v].Desc
id.UnlockInfo = achievementDesc[v].UnlockInfo
end
end
--[[--------------------------------
DoClick functions and others
--------------------------------]]
function updateDoClicks()
for k, pl in pairs(player.GetAll()) do
if (pl.Item) then
pl.Item.DoClick = function( btn )
-- It's getting quite messy around here...
pl.StatsReceived = false
updateScorelist( pl )
RunConsoleCommand("get_playerstats",pl:UserID())
-- Update score list with delay so server can send data
timer.Create(pl:UserID().."statreceive",0.5,0,function( ply, dalist )
if dalist:IsValid() then
if ply:IsValid() and ply.StatsReceived then
updateScorelist(ply)
timer.Destroy(ply:UserID().."statreceive")
end
else
timer.Destroy(ply:UserID().."statreceive")
end
end,pl,list)
end
end
end
end
list.OnRowSelected = function(lineID,line)
local theline = list:GetSelected()[1] -- those fucking function arguments do not contain the real line entity
if (theline.Image and theline.Desc) then
reasonbox:SetValue(theline.Desc)
unlockbox:SetValue(theline.UnlockInfo)
achvimage:SetImage(theline.Image)
else
reasonbox:SetValue("<< Select something to view the description! >>")
achvimage:SetImage("infectedwars/achv_blank")
end
end
buttonUpdate.DoClick = function( btn )
updatePlayerList()
end -- update playerlist
updatePlayerList()
end
/*-----------------------------
CREATE OPTIONS PANEL
-------------------------------*/
function createOptionsPanel()
subframe:SetTitle( "Options and settings" )
local selectedSong = CurPlaying
-- 'Radio' label
local radlabel = vgui.Create("DLabel",subframe)
radlabel:SetText( "Radio" )
radlabel:SetPos( 5, 30 )
radlabel:SetSize( 100, 25 )
-- List with available songs
local songlist = vgui.Create("DComboBox", subframe)
songlist:SetPos( 5, 50 )
songlist:SetSize( 80, 20 )
--songlist:SetEditable( false )
songlist:Clear()
local list = {}
for k = 1, #Radio do
list[k] = songlist:AddChoice("Song "..k)
end
songlist:ChooseOption("Song "..selectedSong)
songlist.OnSelect = function( index, value, data )
for k = 1, #list do
-- find what choice was selected
if (value == list[k]) then
selectedSong = k
end
end
end
-- Create play song button
local buttonPlay = vgui.Create("DButton",subframe)
buttonPlay:SetText( "Play song")
buttonPlay:SetPos(90,50)
buttonPlay:SetSize(70,20)
buttonPlay.DoClick = function( btn )
RunConsoleCommand("iw_enableradio","1",tostring(selectedSong))
end
-- Create stop radio button
local buttonStop = vgui.Create("DButton",subframe)
buttonStop:SetText( "Stop radio")
buttonStop:SetPos(165,50)
buttonStop:SetSize(70,20)
buttonStop.DoClick = function( btn )
RunConsoleCommand("iw_enableradio","0")
end
-- Update option values
Options[1].Value = PP_ON
Options[2].Value = PP_COLOR
Options[3].Value = PP_MOTIONBLUR
Options[4].Value = PP_BLOOM
Options[5].Value = PP_SHARPEN
Options[6].Value = HUD_ON
Options[7].Value = EFFECT_MUZZLE
Options[8].Value = EFFECT_SHELL
Options[9].Value = EFFECT_UBERGORE
local boxY = 75
for k, v in pairs(Options) do
-- Create checkboxes
local box = vgui.Create("DCheckBox",subframe)
box:SetValue( v.Value )
box:SetPos(5,boxY+2)
box:SetSize(15,15)
box.DoClick = function( btn )
-- Update value in case player used console to switch
v.Value = util.tobool((GetConVarNumber( "_"..v.Cmd ))) or v.Value
if (v.Value == box:GetChecked()) then
box:Toggle()
end
if (v.Value ~= box:GetChecked()) then
v.Value = box:GetChecked()
RunConsoleCommand(v.Cmd,tostring(box:GetChecked()))
end
end
-- Create Labels
local lab = vgui.Create("DLabel",subframe)
lab:SetText( v.Desc )
lab:SetPos(22,boxY+1)
lab:SetSize(0,20)
lab:SizeToContents()
boxY = boxY + 20
end
-- 'Crosshair' label
local crlabel = vgui.Create("DLabel",subframe)
crlabel:SetText( "Crosshair" )
crlabel:SetPos( MENU_framewidth - 105, 30 )
crlabel:SetSize( 100, 25 )
-- Crosshair stuff
local crosslist = vgui.Create("DMultiChoice",subframe)
crosslist:SetPos( MENU_framewidth - 105, 50 )
crosslist:SetSize( 100, 20 )
crosslist:SetEditable( false )
crosslist:Clear()
local clist = {}
for k, v in ipairs(CROSSHAIR) do
clist[k] = crosslist:AddChoice("Crosshair "..k)
end
crosslist:ChooseOption("Crosshair "..CurCrosshair)
-- 'Color' label
local cllabel = vgui.Create("DLabel",subframe)
cllabel:SetText( "Color" )
cllabel:SetPos( MENU_framewidth - 105, 80 )
cllabel:SetSize( 100, 25 )
-- Color list
local collist = vgui.Create("DMultiChoice",subframe)
collist:SetPos( MENU_framewidth - 105, 100 )
collist:SetSize( 100, 20 )
collist:SetEditable( false )
collist:Clear()
for k, v in pairs(CROSSHAIRCOLORS) do
collist:AddChoice(k)
end
collist:ChooseOption(CurCrosshairColor)
local cross = vgui.Create("DImage", subframe)
cross:SetPos(MENU_framewidth - 180,45)
cross:SetSize(64,64)
cross:SetImage( CROSSHAIR[CurCrosshair] )
cross:SetImageColor( CROSSHAIRCOLORS[CurCrosshairColor] )
cross:SizeToContents()
local alphaSlider = vgui.Create( "DNumSlider", subframe )
alphaSlider:SetPos( MENU_framewidth - 180,140 )
alphaSlider:SetSize( 175, 100 ) // Keep the second number at 100
alphaSlider:SetText( "Alpha channel" )
alphaSlider:SetMin( 0 )
alphaSlider:SetMax( 255 )
alphaSlider:SetDecimals( 0 )
alphaSlider:SetConVar( "_iw_crosshairalpha" ) // Set the convar
-- 'Turret nickname' label
local tnlabel = vgui.Create("DLabel",subframe)
tnlabel:SetText( "Turret nickname" )
tnlabel:SetPos( MENU_framewidth - 180, 194 )
tnlabel:SetSize( 100, 25 )
-- Turret nickname text entry
local turretnickbox = vgui.Create("DTextEntry",subframe)
turretnickbox:SetPos( MENU_framewidth - 180, 220 )
turretnickbox:SetSize( 100, 20 )
turretnickbox:SetEditable( true )
turretnickbox:SetMultiline( false )
turretnickbox:SetValue(TurretNickname or "")
-- Turret nickname set box
local buttonSetTurNick = vgui.Create("DButton",subframe)
buttonSetTurNick:SetText( "Submit")
buttonSetTurNick:SetPos( MENU_framewidth - 70, 220 )
buttonSetTurNick:SetSize(50,20)
buttonSetTurNick.DoClick = function( btn )
RunConsoleCommand("iw_turretnickname",turretnickbox:GetValue())
end
if (MySelf:HasBought("titleeditor")) then
local titleeditlabel = vgui.Create("DLabel",subframe)
titleeditlabel:SetText( "Title Editor" )
titleeditlabel:SetPos( MENU_framewidth - 180, 260 )
titleeditlabel:SetSize( 100, 25 )
local titlefield = vgui.Create("DTextEntry",subframe)
titlefield:SetText( MySelf:Title() )
titlefield:SetPos( MENU_framewidth - 180, 286 )
titlefield:SetSize( 100, 20 )
titlefield:SetEditable( true )
titlefield:SetMultiline( false )
local submitbutton = vgui.Create("DButton", subframe)
submitbutton:SetPos(MENU_framewidth - 70, 286)
submitbutton:SetSize(50, 20)
submitbutton:SetText("Submit")
submitbutton.DoClick = function(btn)
--ValidTitle can be found in shared.lua
if ValidTitle(MySelf, titlefield:GetValue()) then
RunConsoleCommand("mrgreen_settitle",titlefield:GetValue())
titlefield:SetText("< updating... >")
titlefield:SetEditable( false )
timer.Simple(0.5,function()
if titlefield then
titlefield:SetText(MySelf:Title())
titlefield:SetEditable( true )
end
end)
else
titlefield:SetText("< INVALID TITLE >")
titlefield:SetEditable( false )
timer.Simple(1,function()
if titlefield then
titlefield:SetText(MySelf:Title())
titlefield:SetEditable( true )
end
end)
end
end
local infolabel = vgui.Create("DLabel",subframe)
infolabel:SetText( "Max title length is 24 characters. \nSome characters and words are\ndisallowed." )
infolabel:SetPos( MENU_framewidth - 180, 305 )
infolabel:SetSize( 160, 60 )
end
-------- Functions ------------
local function UpdateCrosshair()
cross:SetImage( CROSSHAIR[CurCrosshair] )
local colc = CROSSHAIRCOLORS[CurCrosshairColor]
local alph = GetConVarNumber("_iw_crosshairalpha")
cross:SetImageColor( Color(colc.r, colc.g, colc.b, alph) )
RunConsoleCommand("_iw_crosshair",CurCrosshair)
RunConsoleCommand("_iw_crosshaircolor",CurCrosshairColor)
end
---------- Select functions -----------
alphaSlider.OnValueChanged = function( val )
UpdateCrosshair()
end
collist.OnSelect = function( index, value, data )
CurCrosshairColor = collist:GetOptionText(value)
UpdateCrosshair()
end
crosslist.OnSelect = function( index, value, data )
for k = 1, #clist do
-- find what choice was selected
if (value == clist[k]) then
CurCrosshair = k
UpdateCrosshair()
end
end
end
end
--[[-----------------------------
CREATE DONATE PANEL
-------------------------------]]
function createDonatePanel()
subframe:SetTitle( "Donate!" )
local box = vgui.Create("DTextEntry",subframe)
box:SetPos( 10, 38 )
box:SetSize( MENU_framewidth-60, MENU_subframeheigth-60 )
box:SetEditable( false )
box:SetMultiline( true )
box:SetValue([[The Mr. Green servers are very active, and bandwidth doesn't pay for itself. We'll gladly accept donations!
You can donate to the Mr. Green servers using PayPal! For every euro you donate you get 1000 Green-Coins
in return.
Green-Coins can be used to buy all sorts of things on our gameservers (not only for this server!).
They're stored in a global account. By linking your Steam ID to your Left4Green.com forum account,
you can manage your GC online.
Visit MrGreenGaming.com and click "GreenCoins". For further instructions there's a link in the
footer of that page.]])
local mrGreen = vgui.Create("DImage", subframe)
mrGreen:SetPos(MENU_framewidth-40,38)
mrGreen:SetSize(32,32)
mrGreen:SetImage( "mrgreen/mrgreen" )
mrGreen:SetImageColor( Color(255,255,255,255) )
mrGreen:SizeToContents()
end
/*-----------------------------
CREATE SHOP PANEL
-------------------------------*/
function createShopPanel()
subframe:SetTitle( "Green-Coins shop!" )
local curItemSelected = ""
local donbutton = vgui.Create("DButton", subframe)
donbutton:SetPos(405, 300)
donbutton:SetSize(170, 28)
donbutton:SetText("Donate!")
donbutton.DoClick = function(btn)
btn:GetParent():SetVisible(false)
openDonateMenu()
end
local shoplabel = vgui.Create("DLabel",subframe)
shoplabel:SetText( [[HOW TO GET GREEN-COINS:
- Kill an undead (as human): 1 GC
- Every 30 health you heal (as human): 1 GC
- Kill a human (as undead): 3 GC
- Mark a human (as undead): 1 GC
- Every euro you donate: 1000 GC
]] )
shoplabel:SetPos( 350, 150 )
shoplabel:SetSize( 240, 200 )
// SHOP
local itemlistlabel = vgui.Create("DLabel",subframe)
itemlistlabel:SetText( "Shop Items" )
itemlistlabel:SetPos( 16, 30 )
itemlistlabel:SetSize( 180, 25 )
local itemlist = vgui.Create("DComboBox",subframe)
itemlist:SetPos( 16, 60 )
itemlist:SetSize( 180, 320 )
local itemnamelabel = vgui.Create("DLabel",subframe)
itemnamelabel:SetText( "ITEM:" )
itemnamelabel:SetPos( 220, 60 )
itemnamelabel:SetSize( 180, 22 )
local itemcostlabel = vgui.Create("DLabel",subframe)
itemcostlabel:SetText( "COST:" )
itemcostlabel:SetPos( 220, 80 )
itemcostlabel:SetSize( 180, 22 )
local itemreqlabel = vgui.Create("DLabel",subframe)
itemreqlabel:SetText( "REQUIRES:" )
itemreqlabel:SetPos( 220, 100 )
itemreqlabel:SetSize( 180, 22 )
local itemdesclabel = vgui.Create("DLabel",subframe)
itemdesclabel:SetText( "DESCRIPTION:" )
itemdesclabel:SetPos( 220, 120 )
itemdesclabel:SetSize( 180, 22 )
local itemdescfield = vgui.Create("DTextEntry",subframe)
itemdescfield:SetText( "< none >" )
itemdescfield:SetPos( 220, 140 )
itemdescfield:SetSize( 360, 50 )
itemdescfield:SetEditable( false )
itemdescfield:SetMultiline( true )
local buybutton = vgui.Create("DButton", subframe)
buybutton:SetPos(400, 70)
buybutton:SetSize(180, 50)
buybutton:SetText("")
buybutton.DoClick = function(btn)
if curItemSelected == "" then return end
RunConsoleCommand("mrgreen_buyitem",curItemSelected)
timer.Simple(0.7,function()
updateItemList()
end)
end
--[[-------------------------------
Functions
-------------------------------]]
function updateItemList()
itemlist:Clear()
local item
local item_sorted = {}
for k, v in pairs(shopData) do
if not shopData[k].AdminOnly or PlayerIsAdmin then
if MySelf.DataTable["shopitems"][k] then
table.insert(item_sorted, { key = k, postfix = " (BOUGHT)", name = v.Name })
else
table.insert(item_sorted, { key = k, postfix = "", name = v.Name })
end
end
end
--can't sort associative tables, had to hack my way around it.
table.sort(item_sorted, function(a, b) return a.name < b.name end)
for k, v in pairs(item_sorted) do
item = itemlist:AddItem( v.name..v.postfix )
item.ItemType = v.key
item.DoClick = itemDoClick
shopData[v.key].Item = item
end
-- Select a item if not already selected
if not shopData[curItemSelected] then
shopData["ammostash1"].Item:Select() -- Calls DoClick
itemlist:SelectItem(shopData["ammostash1"].Item)
else
shopData[curItemSelected].Item:Select() -- Calls DoClick
itemlist:SelectItem(shopData[curItemSelected].Item)
end
end
--[[--------------------------------
DoClick functions and others
--------------------------------]]
function itemDoClick(btn)
local item = btn.ItemType
curItemSelected = item
if (shopData[item].Cost == -1) then
itemcostlabel:SetText("COST: -")
else
itemcostlabel:SetText("COST: "..shopData[item].Cost.." GC")
end
itemnamelabel:SetText("ITEM: "..shopData[item].Name)
if shopData[item].Requires then
itemreqlabel:SetText( "REQUIRES: "..shopData[shopData[item].Requires].Name )
else
itemreqlabel:SetText( "REQUIRES: n/a" )
end
itemdescfield:SetText(shopData[item].Desc)
if (MySelf.DataTable["shopitems"][item]) then
buybutton:SetDisabled(true)
buybutton:SetText("You got this already!")
elseif (shopData[item].Requires != nil and not MySelf:HasBought(shopData[item].Requires)) then
buybutton:SetDisabled(true)
buybutton:SetText("You do not have the required item!")
elseif (MySelf:GreenCoins() < shopData[item].Cost) then
buybutton:SetDisabled(true) -- disable button if you can't buy it
buybutton:SetText("You're too poor")
else
buybutton:SetDisabled(false)
buybutton:SetText("BUY THAT SHIT")
end
end
updateItemList()
end
--[[-----------------------------
CREATE ADMIN PANEL
-------------------------------]]
function createAdminPanel()
if !(PlayerIsAdmin) then
subframe:SetTitle( "Admin suite (RESTRICTED)" )
else
-- frame settings
subframe:SetTitle( "Admin suite (welcome "..LocalPlayer():Name().."!)" )
-- create player list
local playerlist = vgui.Create("DComboBox",subframe)
playerlist:SetPos( 6, 50 )
playerlist:SetSize( 120, MENU_subframeheigth-60 )
-- update player list button
local buttonUpdate = vgui.Create("DButton",subframe)
buttonUpdate:SetText( "Update Player List")
buttonUpdate:SetPos(6,28)
buttonUpdate:SetSize(120,20)
-- create map list
local maplist = vgui.Create("DComboBox",subframe)
maplist:SetPos( 130, 170 )
maplist:SetSize( 140, MENU_subframeheigth-180 )
-- change map button
local buttonMapChange = vgui.Create("DButton",subframe)
buttonMapChange:SetText( "Change map")
buttonMapChange:SetPos(275,170)
buttonMapChange:SetSize(70,20)
-- kick button
local buttonKick = vgui.Create("DButton",subframe)
buttonKick:SetText( "Kick")
buttonKick:SetPos(130,50)
buttonKick:SetSize(65,20)
-- 'Kick reason' label
local lolabel = vgui.Create("DLabel",subframe)
lolabel:SetText( "Kick reason" )
lolabel:SetPos( 200, 30 )
lolabel:SetSize( 130, 25 )
-- kick reason textbox
local reasonbox = vgui.Create("DTextEntry",subframe)
reasonbox:SetPos( 200, 50 )
reasonbox:SetSize( 275, 20 )
reasonbox:SetEditable( true )
reasonbox:SetValue("Retard")
/*------------ ADMIN BUTTONS --------------*/
-- ban 5 minutes button
local buttonBanFive = vgui.Create("DButton",subframe)
buttonBanFive:SetText( "Ban 5 min")
buttonBanFive:SetPos(130,75)
buttonBanFive:SetSize(65,25)
-- ban 60 minutes button
local buttonBanSixty = vgui.Create("DButton",subframe)
buttonBanSixty:SetText( "Ban 1 hour")
buttonBanSixty:SetPos(200,75)
buttonBanSixty:SetSize(65,25)
-- ban one day button
local buttonBanDay = vgui.Create("DButton",subframe)
buttonBanDay:SetText( "Ban 1 day")
buttonBanDay:SetPos(270,75)
buttonBanDay:SetSize(65,25)
-- ban one week button
local buttonBanWeek = vgui.Create("DButton",subframe)
buttonBanWeek:SetText( "Ban 1 week")
buttonBanWeek:SetPos(340,75)
buttonBanWeek:SetSize(65,25)
-- ban permanent button
local buttonBanPerma = vgui.Create("DButton",subframe)
buttonBanPerma:SetText( "Permaban")
buttonBanPerma:SetPos(410,75)
buttonBanPerma:SetSize(65,25)
-- slay player
local buttonSlay = vgui.Create("DButton",subframe)
buttonSlay:SetText( "Slay")
buttonSlay:SetPos(130,105)
buttonSlay:SetSize(65,25)
-- bring player
local buttonBring = vgui.Create("DButton",subframe)
buttonBring:SetText( "Bring")
buttonBring:SetPos(200,105)
buttonBring:SetSize(65,25)
-- goto player
local buttonGoto = vgui.Create("DButton",subframe)
buttonGoto:SetText( "Goto")
buttonGoto:SetPos(270,105)
buttonGoto:SetSize(65,25)
--give exploit blocker
local buttonEx = vgui.Create("DButton",subframe)
buttonEx:SetText( "Get exploit blocker")
buttonEx:SetPos(340,105)
buttonEx:SetSize(65*2+5,25)
/*-------------------------
TODO:
- Slay
- Ignite / Unignite
- Health+, Ammo+
- Execute console command on other persons console
--------------------------*/
/*------------------------
ADMIN FUNCTIONS
-------------------------*/
function getSelectedPlayer()
local playerName = playerlist:GetSelected()
if playerName and playerName:IsValid() then
for k, v in pairs(player.GetAll()) do
if (v:Name() == playerName:GetValue()) then
if (v:IsValid()) then
return v
end
end
end
end
return nil
end
function getSelectedMap()
local mapName = maplist:GetSelected()
if (mapName ~= nil) then
return mapName:GetValue()
else
return ""
end
end
local function banSelectedPlayer( banTime )
local pl = getSelectedPlayer()
if (pl ~= nil) then
RunConsoleCommand( "ban_player", ""..banTime, pl:UserID() )
if (banTime == 0) then
RunConsoleCommand( "kick_player", pl:UserID(), "Permanent ban." )
else
RunConsoleCommand( "kick_player", pl:UserID(), "Banned for "..banTime.." minutes." )
end
end
end
local function kickSelectedPlayer( reason )
local pl = getSelectedPlayer()
if (pl ~= nil) then
RunConsoleCommand( "kick_player", pl:UserID(), reason )
end
end
local function updatePlayerList()
playerlist:Clear()
for k, v in pairs(player.GetAll()) do
playerlist:AddItem( v:Name() )
end
end
local function updateMapList()
table.sort(MapList)
maplist:Clear()
for k, v in pairs(MapList) do
maplist:AddItem( v )
end
end
/*--------------------------------
DoClick functions and others
--------------------------------*/
buttonUpdate.DoClick = function( btn )
updatePlayerList()
end -- update playerlist
buttonKick.DoClick = function( btn )
kickSelectedPlayer(reasonbox:GetValue())
end -- kick selected player
buttonBanWeek.DoClick = function( btn )
banSelectedPlayer(60*24*7)
end -- ban selected player for 1 week
buttonBanDay.DoClick = function( btn )
banSelectedPlayer(60*24)
end -- ban selected player for 1 day
buttonBanSixty.DoClick = function( btn )
banSelectedPlayer(60)
end -- ban selected player for 60 minutes
buttonBanFive.DoClick = function( btn )
banSelectedPlayer(5)
end -- ban selected player for 5 minutes
buttonBanPerma.DoClick = function( btn )
banSelectedPlayer(0)
end -- permanently ban selected player
buttonSlay.DoClick = function( btn )
local pl = getSelectedPlayer()
if (pl ~= nil) then
RunConsoleCommand("slay_player",pl:Name())
end
end -- slay player
buttonBring.DoClick = function( btn )
local pl = getSelectedPlayer()
if (pl ~= nil) then
RunConsoleCommand("bring_player",pl:Name())
end
end -- bring player
buttonGoto.DoClick = function( btn )
local pl = getSelectedPlayer()
if (pl ~= nil) then
RunConsoleCommand("goto_player",pl:Name())
end
end -- goto player
buttonEx.DoClick = function( btn )
RunConsoleCommand("say","!swep "..LocalPlayer():Name().." admin_exploitblocker")
end
buttonMapChange.DoClick = function( btn )
RunConsoleCommand("change_map",""..getSelectedMap())
end -- change map
updatePlayerList() -- update list at start of frame
updateMapList()
end
end
--[[--------------------------------------
CREATE CLASS PANEL
---------------------------------------]]
function createClassPanel( start, team )
local numLoadouts = 0
local class = {}
local load = {}
local currentSelectedLoad = 1
local currentSelectedClass = 1
-- On start, create a slightly different frame than the normal one
if start then
frame = vgui.Create("DFrame")
frame:SetTitle( "Welcome to this Infected Wars Downfall server!" )
frame:SetPos(w/2-(MENU_framewidth)/2,h/2-MENU_subframeheigth/2-55)
frame:SetSize(MENU_framewidth, 150)
frame:SetVisible( true )
frame:SetSizable(false)
frame:SetDraggable(false)
frame:ShowCloseButton(false)
--[[frame.PaintOver = function()
draw.WordBox( 2, MENU_framewidth / 1.53, 0, "FREE UNLOCKS WEEKEND!", "ArialB_18", Color(160,35,35,(math.sin(RealTime() * 3) * 100) + 170), Color(255,255,255,255) )
end]]
frame:MakePopup()
local welcomebox = vgui.Create("DTextEntry",frame)
welcomebox:SetPos( 5, 25 )
welcomebox:SetSize( MENU_framewidth-10, 120 )
welcomebox:SetEditable( false )
welcomebox:SetValue(WELCOME_TEXT)
welcomebox:SetMultiline( true )
subframe = vgui.Create("DFrame")
subframe:SetPos(w/2-MENU_framewidth/2,h/2-MENU_subframeheigth/2+100)
subframe:SetSize(MENU_framewidth, MENU_subframeheigth)
if (team == TEAM_HUMAN) then
subframe:SetTitle( "You joined the Special Forces - Choose your class!" )
else
subframe:SetTitle( "You joined the Undead Legion - Choose your class!" )
end
subframe:SetVisible( true )
subframe:SetSizable(false)
subframe:SetDraggable(false)
subframe:ShowCloseButton(false)
subframe:MakePopup()
else
-- Else, just use the normal one (subframe has already been made with the createSubFrame function)
if team == TEAM_HUMAN then
subframe:SetTitle( "Human class menu" )
else
subframe:SetTitle( "Undead class menu" )
end
end
-- 'Class' label
local cllabel = vgui.Create("DLabel",subframe)
cllabel:SetText( "Select class" )
cllabel:SetPos( 5, 30 )
cllabel:SetSize( 60, 25 )
-- List of choosable classes
local classlist = vgui.Create("DComboBox",subframe)
classlist:SetPos( 5, 50 )
classlist:SetSize( 165, 165 )
-- Insert all the class options
local HadFirstChoice = false
if team == TEAM_HUMAN then
for k = 1, #HumanClass do
if HumanClass[k].Choosable then
class[k] = classlist:AddChoice(HumanClass[k].Name .." (".. amountOfPlayerInClass(k,TEAM_HUMAN) .." players)", k, not HadFirstChoice)
HadFirstChoice = true
else
class[k] = nil
end
end
else
for k = 1, #UndeadClass do
if UndeadClass[k].Choosable then
class[k] = classlist:AddChoice(UndeadClass[k].Name .." (".. amountOfPlayerInClass(k,TEAM_UNDEAD) .." players)", k, not HadFirstChoice)
HadFirstChoice = true
else
class[k] = nil
end
end
end
-- Update the list every second
--TODO: Fix updating of player counts
--[[timer.Create("updatetimer", 1, 0, function()
if not class[2]:IsValid() then
timer.Destroy("updatetimer")
return
end
--TODO: Fix updating of player counts
for k = 1, #class do
if class[k] ~= nil then
if team == TEAM_HUMAN then
class[k]:SetText(HumanClass[k].Name.." ("..amountOfPlayerInClass(k,TEAM_HUMAN).." players)")
else
class[k]:SetText(UndeadClass[k].Name.." ("..amountOfPlayerInClass(k,TEAM_UNDEAD).." players)")
end
end
end
end)]]
-- 'Select loadout' label
local lolabel = vgui.Create("DLabel",subframe)
lolabel:SetText( "Select loadout" )
lolabel:SetPos( 5, 215 )
lolabel:SetSize( 90, 25 )
-- List with possible loadout choices
local loadoutlist = vgui.Create("DComboBox",subframe)
loadoutlist:SetPos( 5, 235 )
loadoutlist:SetSize( 165, 20 )
--loadoutlist:SetEditable( false )
loadoutlist:Clear()
-- 'Apply for Behemoth' checkbox
local box = vgui.Create("DCheckBox",subframe)
if start then
box:SetValue( true )
else
box:SetValue( LocalPlayer().PreferBehemoth )
end
box:SetPos(5,MENU_subframeheigth-60)
box:SetSize(15,15)
box.DoClick = function( btn )
box:Toggle()
LocalPlayer().PreferBehemoth = box:GetChecked()
RunConsoleCommand("prefer_behemoth",tostring(box:GetChecked()))
end
-- Create Label
local lab = vgui.Create("DLabel",subframe)
lab:SetText( "Apply for Behemoth" )
lab:SetPos(24,MENU_subframeheigth-62)
lab:SetSize(200,20)
-- Class name label
local cllabel = vgui.Create("DLabel",subframe)
cllabel:SetText( "Description class" )
cllabel:SetPos( 175, 30 )
cllabel:SetSize( 200, 25 )
-- Description textbox
local descbox = vgui.Create("DTextEntry",subframe)
descbox:SetPos( 175, 50 )
descbox:SetSize( 420, 170 )
descbox:SetEditable( false )
descbox:SetValue("")
descbox:SetMultiline( true )
-- Add loadout listing
local list = vgui.Create("DListView",subframe)
list:SetPos(175,220)
list:SetSize(420,140)
list.SortByColumn = function() end
list.OnRowSelected = function(lineID,line) end
local c0 = list:AddColumn( "Weapon" )
local c1 = list:AddColumn( "Clip or amount" )
local c2 = list:AddColumn( "Special" )
c0:SetMinWidth( 160 )
c0:SetMaxWidth( 160 )
c1:SetMinWidth( 80 )
c1:SetMaxWidth( 80 )
c2:SetMinWidth( 180 )
c2:SetMaxWidth( 180 )
-- 'SPAWN' or 'CHOOSE' button
local buttonSpawn = vgui.Create("DButton",subframe)
buttonSpawn:SetText( "SPAWN")
if not start and team == TEAM_UNDEAD then
buttonSpawn:SetText( "CHOOSE FOR NEXT SPAWN")
end
buttonSpawn:SetPos(5,MENU_subframeheigth-35)
buttonSpawn:SetSize(MENU_framewidth-10,30)
-- Can't press the button when you're human
if not start and team == TEAM_HUMAN then
buttonSpawn:SetText( "CAN'T RESPAWN WHEN HUMAN")
buttonSpawn:SetDisabled(true)
end
--[[----------------------------------------------
Specific data retrieving functions :O
-----------------------------------------------]]
-- Get the selected class
function getSelectedClass(Id)
--[[if type(Id) == "number" then
local className = classlist:GetSelected()
end]]
--[[ErrorNoHalt("getSelectedClass called in cl_menu. But it's not available.")
if (className == nil) then return 0 end
for k = 1, #class do
if (class[k] ~= nil) then
if (className == class[k]) then
return k
end
end
end
return 0]]
if (currentSelectedClass == nil) then return 0 end
return currentSelectedClass
end
-- Get the selected loadout
function getSelectedLoadout()
if (currentSelectedLoad == nil) then return 1 end
return currentSelectedLoad
end
-- Update the loadout list with the number of available loadouts
function updateLoadoutList()
load = {}
loadoutlist:Clear()
local loadname = ""
local slect = nil
local code = ""
local selClass = getSelectedClass()
for k = 1, numLoadouts do
if (team == TEAM_HUMAN) then
code = HumanClass[selClass].SwepLoadout[k].UnlockCode
loadname = HumanClass[selClass].SwepLoadout[k].Name
else
code = UndeadClass[selClass].SwepLoadout[k].UnlockCode
loadname = UndeadClass[selClass].SwepLoadout[k].Name
end
if LocalPlayer():HasUnlocked( code ) then
load[k] = loadoutlist:AddChoice(loadname, k) -- load k fetches index
if not slect then
slect = load[k]
end
end
end
currentSelectedLoad = 1
loadoutlist:ChooseOptionID(slect)
end
-- Update loadout description
function updateDescription()
local text = ""
local selClass = getSelectedClass()
local selLoadout = getSelectedLoadout()
if (team == TEAM_HUMAN) then
text = HumanClass[selClass].Info
cllabel:SetText( "Description "..HumanClass[selClass].Name.." class" )
else
text = UndeadClass[selClass].Info
cllabel:SetText( "Description "..UndeadClass[selClass].Name.." class" )
end
-- update description textbox
descbox:SetValue( text )
list:Clear()
local tab = {}
if (team == TEAM_HUMAN) then
tab = HumanClass[selClass].SwepLoadout[selLoadout].Sweps
else
tab = UndeadClass[selClass].SwepLoadout[selLoadout].Sweps
end
for k, swep in pairs( tab ) do
local r = swepDesc[swep] or { Weapon = "No description for "..swep, Clip = "", Special = "" }
list:AddLine( r.Weapon, r.Clip, r.Special )
end
end
--------- End of the messy data retrieving functions ---------
--[[-----------------------------------------
DoClick functions
Called when player presses on of the items
-----------------------------------------]]
function classlist:OnSelect( index, value, data )
currentSelectedClass = data
--local selectedClass = getSelectedClass()
if (team == TEAM_HUMAN) then
numLoadouts = (#HumanClass[currentSelectedClass].SwepLoadout)
elseif (team == TEAM_UNDEAD) then
numLoadouts = (#UndeadClass[currentSelectedClass].SwepLoadout)
end
updateLoadoutList()
print("Selected class ".. data)
end
buttonSpawn.DoClick = function( btn )
-- run server command that spawns player
local newClass = getSelectedClass()
local newLoadout = getSelectedLoadout()
if start then
if (newClass ~= 0) then
startPanelOpen = false
RunConsoleCommand("first_spawn",""..newClass,""..newLoadout)
frame:Close()
subframe:Close()
end
else
if (newClass ~= 0) then
RunConsoleCommand("class_spawn",""..newClass,""..newLoadout)
if frame and frame:IsValid() then
frame:Close()
end
subframe:Close()
end
end
end
-- update selected loadout
loadoutlist.OnSelect = function( index, value, data )
for k = 1, numLoadouts do
-- find what choice was selected
if (value == load[k]) then
currentSelectedLoad = k
break
end
end
--currentSelectedLoad = value
updateDescription()
end
end
/*------------------------------------
And now for the console commands
that open these godforsaken menus
--------------------------------------*/
local function clearFrames()
if subframe and subframe:IsValid() then
subframe:Close()
end
if !(frame and frame:IsValid()) then
createMainFrame()
end
end
function CloseFrames()
if subframe and subframe:IsValid() then
subframe:Close()
end
if frame and frame:IsValid() then
frame:Close()
end
end
function openHelpMenu()
if startPanelOpen or firstSpawn then return end
clearFrames()
createSubFrame()
createHelpPanel()
end
concommand.Add("iw_menu_help", openHelpMenu)
concommand.Add("iw_menu", openHelpMenu)
function openAboutMenu()
if startPanelOpen or firstSpawn then return end
clearFrames()
createSubFrame()
createAboutPanel()
end
concommand.Add("iw_menu_about", openAboutMenu)
function openClassMenu()
if startPanelOpen or firstSpawn then return end
clearFrames()
createSubFrame()
-- open class panel in normal mode
createClassPanel( false , LocalPlayer():Team() )
end
concommand.Add("iw_menu_class", openClassMenu)
function openOptionsMenu()
if startPanelOpen or firstSpawn then return end
clearFrames()
createSubFrame()
createOptionsPanel()
end
concommand.Add("iw_menu_options", openOptionsMenu)
function openScoreMenu()
if startPanelOpen or firstSpawn then return end
clearFrames()
createSubFrame()
createScorePanel()
end
concommand.Add("iw_menu_score", openScoreMenu)
function openDonateMenu()
if startPanelOpen or firstSpawn then return end
clearFrames()
createSubFrame()
createDonatePanel()
end
concommand.Add("iw_menu_donate", openDonateMenu)
function openShopMenu()
if startPanelOpen or firstSpawn then return end
clearFrames()
createSubFrame()
createShopPanel()
end
concommand.Add("iw_menu_shop", openShopMenu)
function openAdminMenu()
if not ADMIN_ADDON then return end
if startPanelOpen or firstSpawn then return end
clearFrames()
createSubFrame()
createAdminPanel()
end
concommand.Add("iw_menu_admin", openAdminMenu)
-- this function is called by the server in PlayerInitialSpawn
function openStartClassMenu( team )
if not roundStart then return end
roundStart = false
firstSpawn = true
timer.Create("delaytimer",0.1,0,function()
if LocalPlayer().DataTable then -- delay until player stats arrive
CloseFrames()
startPanelOpen = true
firstSpawn = false
-- open class panel in 'start of round' mode
createClassPanel( true, team )
timer.Destroy("delaytimer")
end
end)
end
function humanStart()
openStartClassMenu( TEAM_HUMAN )
end
function undeadStart()
openStartClassMenu( TEAM_UNDEAD )
end
concommand.Add("iw_start_human", humanStart)
concommand.Add("iw_start_undead", undeadStart) |
local module = {}
module.debugging = false -- whether to print status updates
local eventtap = require "hs.eventtap"
local event = eventtap.event
local inspect = require "hs.inspect"
local keyHandler = function(e)
local watchFor = { h = "left", j = "down", k = "up", l = "right" }
local actualKey = e:getCharacters(true)
local replacement = watchFor[actualKey:lower()]
if replacement then
local isDown = e:getType() == event.types.keyDown
local flags = {}
for k, v in pairs(e:getFlags()) do
if v and k ~= "ctrl" then -- ctrl will be down because that's our "wrapper", so ignore it
table.insert(flags, k)
end
end
if module.debugging then print("viKeys: " .. replacement, inspect(flags), isDown) end
local replacementEvent = event.newKeyEvent(flags, replacement, isDown)
if isDown then
-- allow for auto-repeat
replacementEvent:setProperty(event.properties.keyboardEventAutorepeat, e:getProperty(event.properties.keyboardEventAutorepeat))
end
return true, { replacementEvent }
else
return false -- do nothing to the event, just pass it along
end
end
local modifierHandler = function(e)
local flags = e:getFlags()
local onlyControlPressed = false
for k, v in pairs(flags) do
onlyControlPressed = v and k == "ctrl"
if not onlyControlPressed then break end
end
-- you must tap and hold ctrl by itself to turn this on
if onlyControlPressed and not module.keyListener then
if module.debugging then print("viKeys: keyhandler on") end
module.keyListener = eventtap.new({ event.types.keyDown, event.types.keyUp }, keyHandler):start()
-- however, adding additional modifiers afterwards is ok... its only when ctrl isn't down that we switch back off
elseif not flags.ctrl and module.keyListener then
if module.debugging then print("viKeys: keyhandler off") end
module.keyListener:stop()
module.keyListener = nil
end
return false
end
module.modifierListener = eventtap.new({ event.types.flagsChanged }, modifierHandler)
module.start = function()
module.modifierListener:start()
end
module.stop = function()
if module.keyListener then
module.keyListener:stop()
module.keyListener = nil
end
module.modifierListener:stop()
end
module.start() -- autostart
return module
|
local Fixed = {}
function Fixed:create(width, height)
error("Not implemented")
end
return Fixed |
me = game.Players.acb227
him = game.Players.Flasket
-----------------------------------------------------------hehehehe---------------------------------
local part = Instance.new("Part")
part.Parent = me.Character
part.formFactor = "Custom"
local mag = (me.Character.Head.Position - him.Character.Head.Position).magnitude
part.Size = Vector3.new(0.5, 0.5, mag)
part.CFrame = CFrame.new(0, 0, 0)
part.Anchored = true
part.CanCollide = false
local pm = Instance.new("BlockMesh")
pm.Parent = part
pm.Scale = Vector3.new(1, 1, mag)
while wait() do
mag = (me.Character.Head.Position - him.Character.Head.Position).magnitude
part.Size = Vector3.new(0.5, 0.5, mag)
part.CFrame = CFrame.new((me.Character.Head.Position + him.Character.Head.Position)/2, him.Character.Head.Position)
pm.Scale = Vector3.new(1, 1, mag)
end |
fx_version 'adamant'
game 'gta5'
client_script 'client/*.lua' |
object_tangible_furniture_technical_guild_screen_cartridge_reb_1 = object_tangible_furniture_technical_shared_guild_screen_cartridge_reb_1:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_technical_guild_screen_cartridge_reb_1, "object/tangible/furniture/technical/guild_screen_cartridge_reb_1.iff")
|
workspace "TRAP"
architecture "x86_64"
startproject "Sandbox"
configurations
{
"Debug",
"Release",
"RelWithDebInfo"
}
flags
{
"MultiProcessorCompile"
}
outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
--Include directories relative to root folder(solution folder)
IncludeDir = {}
IncludeDir["IMGUI"] = "Dependencies/ImGui"
IncludeDir["VULKAN"] = os.getenv("VULKAN_SDK")
IncludeDir["GLSLANG"] = "Dependencies/GLSLang"
IncludeDir["OGLCOMPILER"] = "Dependencies/GLSLang/OGLCompilersDLL"
IncludeDir["OSDEPENDENT"] = "Dependencies/GLSLang/glslang/OSDependent"
IncludeDir["HLSL"] = "Dependencies/GLSLang/hlsl"
IncludeDir["SPIRV"] = "Dependencies/GLSLang/SPIRV"
IncludeDir["SPIRVCROSS"] = "Dependencies/SPIRV-Cross"
IncludeDir["ENTT"] = "Dependencies/Entt"
IncludeDir["YAMLCPP"] = "Dependencies/YAMLCpp/include"
IncludeDir["MODERNFILEDIALOGS"] = "Dependencies/ModernFileDialogs/ModernFileDialogs"
include "TRAP"
group "Dependencies"
include "Dependencies/ImGui"
include "Dependencies/YAMLCpp"
include "Dependencies/ModernFileDialogs.lua"
group "Dependencies/GLSLang"
include "Dependencies/GLSLang/SPIRV"
include "Dependencies/GLSLang/glslang"
group "Dependencies/SPIRV-Cross"
include "Dependencies/SPIRV-Cross/SPIRV-Cross-Core"
include "Dependencies/SPIRV-Cross/SPIRV-Cross-GLSL"
include "Dependencies/SPIRV-Cross/SPIRV-Cross-HLSL"
include "Dependencies/SPIRV-Cross/SPIRV-Cross-Reflect"
group "Games"
include "Games/Sandbox"
include "Games/Tests"
include "Games/Tests3D"
include "Games/TestsNetwork"
include "Games/TRAP-Editor"
group "Utility"
include "Utility/ConvertToSPIRV" |
require("jeskape").setup({
mappings = {
f = {
p = "<cmd>call fzf#vim#complete#path('fd')<enter>",
w = "<cmd>call fzf#vim#complete#word({'window': { 'width': 0.2, 'height': 0.9, 'xoffset': 1 }})<enter>",
},
k = {
k = "<esc>",
j = "<esc>",
},
j = {
j = "<esc>",
k = "<esc>",
},
timeout = vim.o.timeoutlen,
},
})
|
--------------------------------------------------------------------------------
-- Copyright (c) 2015 Jason Lynch <jason@calindora.com>
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
--------------------------------------------------------------------------------
local _M = {}
--------------------------------------------------------------------------------
-- Variables
--------------------------------------------------------------------------------
local _file = nil
local _base_frame = nil
local _final_frame = nil
--------------------------------------------------------------------------------
-- Private Functions
--------------------------------------------------------------------------------
local function _log(message)
message = string.format("%s :: %6s :: %s :: %s :: %s", os.date("!%Y-%m-%d %H:%M:%S+0000"), emu.framecount(), _M.get_time(true), _M.game_time(), message)
console.log(message)
if _file then
_file:write(message)
_file:write("\n")
_file:flush()
end
return true
end
--------------------------------------------------------------------------------
-- Public Functions
--------------------------------------------------------------------------------
function _M.game_time()
local time = mainmemory.read_u24_le(0x0016A4)
local frames = mainmemory.read_u8(0x0016A3)
if time > 36000 then
return string.format("%11s", "-")
else
return string.format("%02d:%02d:%02d.%02d", time / 3600, (time / 60) % 60, time % 60, frames)
end
end
function _M.get_time(actual)
local end_frame = _final_frame
if not end_frame or actual then
end_frame = emu.framecount()
end
if _base_frame then
local time = (end_frame - _base_frame) * 655171.0 / 39375000
return string.format("%02d:%02d:%05.2f", time / 3600, (time / 60) % 60, time % 60)
else
return string.format("%11s", "-")
end
end
function _M.freeze()
_final_frame = emu.framecount()
end
function _M.clear()
console.clear()
end
function _M.error(message)
return _log(string.format("ERROR :: %s", message))
end
function _M.warning(message)
return _log(string.format("WARNING :: %s", message))
end
function _M.log(message)
return _log(message)
end
function _M.start()
_base_frame = emu.framecount()
end
function _M.reset()
console.clear()
if _file then
_file:close()
_file = nil
end
_base_frame = nil
_final_frame = nil
local err
if FULL_RUN then
_file, err = io.open(string.format("logs/edge-%s-%03d-%010d-%s.log", ROUTE, ENCOUNTER_SEED, SEED, os.date("!%Y%m%d-%H%M%S")), "w")
end
end
return _M
|
num_mrkrgns, num_markers, num_regions = reaper.CountProjectMarkers(0)
if num_regions == NULL or num_regions == 0 then
return
end
region_names = {}
-- For each region
for markeridx =0, num_mrkrgns do
retval, isrgn, pos, rgnend, regionname, rgnindexnumber = reaper.EnumProjectMarkers(markeridx)
if isrgn then
markeridx, regionidx = reaper.GetLastMarkerAndCurRegion(0, pos)
-- TODO: Continue instead of return
if markeridx >= 0 then
retval2, isrgn2, pos2, rgnend2, markername, markrgnindexnumber = reaper.EnumProjectMarkers(markeridx)
-- Check to see whether the region name ends with an underscore followed by a number. if it ends with a number, then we've probably already numbered it so we ignore it
if string.match(markername, ".+_$") then
markername = string.match(markername, "(.+)_$")
end
-- do nothing
-- Check in our dictionary to see whether or not we've already seen this region name before.
-- If we have, then we look up how many of these we've already seen in the dictionary,
local num_so_far = region_names[markername]
if num_so_far and num_so_far > 0 then
-- add 1 to that number,
num_so_far = num_so_far + 1
-- rename the region
else
num_so_far = 1
end
-- add the new number to the dictionary
region_names[markername] = num_so_far
NewName = markername .. "_" .. num_so_far
reaper.SetProjectMarker(rgnindexnumber, isrgn, pos, rgnend, NewName)
-- end
end
end
end
|
local M = {}
local api = vim.api
local fn = vim.fn
local cmd = vim.cmd
local ansi = {
black = 30,
red = 31,
green = 32,
yellow = 33,
blue = 34,
magenta = 35,
cyan = 36,
white = 37
}
local function color2csi24b(color_num, fg)
local r = math.floor(color_num / 2 ^ 16)
local g = math.floor(math.floor(color_num / 2 ^ 8) % 2 ^ 8)
local b = math.floor(color_num % 2 ^ 8)
return string.format('%d;2;%d;%d;%d', fg and 38 or 48, r, g, b)
end
local function color2csi8b(color_num, fg)
return string.format('%d;5;%d', fg and 38 or 48, color_num)
end
function M.render_str(str, group_name, def_fg, def_bg)
vim.validate({
str = {str, 'string'},
group_name = {group_name, 'string'},
def_fg = {def_fg, 'string', true},
def_bg = {def_bg, 'string', true}
})
local gui = vim.o.termguicolors
local ok, hl = pcall(api.nvim_get_hl_by_name, group_name, gui)
if not ok then
return ''
end
local fg, bg
if hl.reverse then
fg = hl.background ~= nil and hl.background or nil
bg = hl.foreground ~= nil and hl.foreground or nil
else
fg = hl.foreground
bg = hl.background
end
local escape_prefix = string.format('\x1b[%s%s%s', hl.bold and ';1' or '',
hl.italic and ';3' or '', hl.underline and ';4' or '')
local color2csi = gui and color2csi24b or color2csi8b
local escape_fg, escape_bg = '', ''
if fg and type(fg) == 'number' then
escape_fg = ';' .. color2csi(fg, true)
elseif def_fg and ansi[def_fg] then
escape_fg = ansi[def_fg]
end
if bg and type(bg) == 'number' then
escape_fg = ';' .. color2csi(bg, false)
elseif def_bg and ansi[def_bg] then
escape_fg = ansi[def_bg]
end
return string.format('%s%s%sm%s\x1b[m', escape_prefix, escape_fg, escape_bg, str)
end
function M.zz()
local lnum1, lcount = api.nvim_win_get_cursor(0)[1], api.nvim_buf_line_count(0)
if lnum1 == lcount then
fn.execute(string.format('keepj norm! %dzb', lnum1))
return
end
cmd('norm! zvzz')
lnum1 = api.nvim_win_get_cursor(0)[1]
cmd('norm! L')
local lnum2 = api.nvim_win_get_cursor(0)[1]
if lnum2 + fn.getwinvar(0, '&scrolloff') >= lcount then
fn.execute(string.format('keepj norm! %dzb', lnum2))
end
if lnum1 ~= lnum2 then
cmd('keepj norm! ``')
end
end
function M.lsp_range2pos_list(lsp_ranges)
local s_line, s_char, e_line, e_char, s_lnum, e_lnum
if not pcall(function()
s_line, s_char = lsp_ranges.start.line, lsp_ranges.start.character
e_line, e_char = lsp_ranges['end'].line, lsp_ranges['end'].character
end) then
return {}
end
s_lnum, e_lnum = s_line + 1, e_line + 1
if s_line > e_line or (s_line == e_line and s_char > e_char) then
return {}
end
if s_line == e_line then
return {{s_lnum, s_char + 1, e_char - s_char}}
end
local pos_list = {{s_lnum, s_char + 1, 999}}
for i = 1, e_line - s_line - 1 do
table.insert(pos_list, {s_lnum + i})
end
local pos = {e_lnum, 1, e_char}
table.insert(pos_list, pos)
return pos_list
end
function M.pattern2pos_list(pattern_hl)
local s_lnum, s_col, e_lnum, e_col
if not pcall(function()
s_lnum, s_col = unpack(fn.searchpos(pattern_hl, 'cn'))
e_lnum, e_col = unpack(fn.searchpos(pattern_hl, 'cen'))
end) then
return {}
end
if s_lnum == 0 or s_col == 0 or e_lnum == 0 or e_col == 0 then
return {}
end
if s_lnum == e_lnum then
return {{s_lnum, s_col, e_col - s_col + 1}}
end
local pos_list = {{s_lnum, s_col, 999}}
for i = 1, e_lnum - s_lnum - 1 do
table.insert(pos_list, {s_lnum + i})
end
local pos = {e_lnum, 1, e_col}
table.insert(pos_list, pos)
return pos_list
end
function M.matchaddpos(hl, plist, prior)
vim.validate({hl = {hl, 'string'}, plist = {plist, 'table'}, prior = {prior, 'number', true}})
prior = prior or 10
local ids = {}
local l = {}
for i, p in ipairs(plist) do
table.insert(l, p)
if i % 8 == 0 then
table.insert(ids, fn.matchaddpos(hl, l, prior))
l = {}
end
end
if #l > 0 then
table.insert(ids, fn.matchaddpos(hl, l, prior))
end
return ids
end
function M.gutter_size(winid, lnum)
vim.validate({winid = {winid, 'number'}, lnum = {lnum, 'number', true}})
lnum = lnum or api.nvim_win_get_cursor(winid)[1]
return fn.screenpos(winid, lnum, 1).curscol - fn.win_screenpos(winid)[2]
end
function M.win_execute(winid, func)
vim.validate({
winid = {
winid, function(w)
return w and api.nvim_win_is_valid(w)
end, 'an valid window'
},
func = {func, 'function'}
})
local cur_winid = api.nvim_get_current_win()
if cur_winid ~= winid then
cmd(string.format('noa call nvim_set_current_win(%d)', winid))
end
func()
if cur_winid ~= winid then
cmd(string.format('noa call nvim_set_current_win(%d)', cur_winid))
end
end
return M
|
Socket,Address,Interface =
require('t.Net.Socket'),require('t.Net.Address'),require('t.Net.Interface')
local Net = require( 't.Net' )
ipadd = arg[1] or '127.0.0.1'
-- a client to interact with the loop.lua example
print_help = function( )
print( [[
exit - send exit to server and exit
help - print this help
remove n - remove timer from server list where n is timer index
show - make server list all its loop events
reg - show table references in registry]] )
end
s = Socket( 'UDP', 'ip4' )
adr = Address( ipadd, 8888 )
print( s, adr )
while true do
io.write( "Enter command and type enter ('help' for command list': " )
local cmd = io.read( '*l' )
if 'HELP' == cmd:upper( ) then
print_help( )
else
s:send( cmd, adr )
end
if 'EXIT' == cmd:upper( ) then break end
end
s:close()
|
b = Instance.new("BodyPosition") b.Parent = game.Workspace.[[VICTIM NAME]].Torso b.maxForce = Vector3.new(600000000,6000000000,6000000000)
while true do
b.position = game.Workspace.ic3w0lf589.Torso.Position
wait(0.1)
end |
local gui = require("__flib__.gui-beta")
local set_tiles = require("scripts.processors.set-tiles")
local set_tiles_gui = {}
function set_tiles_gui.build(player, player_table)
local settings = player_table.set_tiles_settings
local refs = gui.build(player.gui.screen, {
{
type = "frame",
direction = "vertical",
caption = { "controls.bpt-set-tiles" },
ref = { "window" },
actions = {
on_closed = { gui = "set_tiles", action = "close" },
},
children = {
{
type = "frame",
style = "inside_shallow_frame_with_padding",
children = {
{
type = "choose-elem-button",
style = "slot_button_in_shallow_frame",
elem_type = "tile",
tile = settings.tile,
elem_filters = { { filter = "blueprintable" } },
actions = {
on_elem_changed = { gui = "set_tiles", action = "update_tile" },
},
ref = { "tile_button" },
},
{
type = "line",
style_mods = { left_margin = 8, vertically_stretchable = true },
direction = "vertical",
},
{
type = "flow",
style_mods = { left_margin = 8 },
direction = "vertical",
children = {
{
type = "checkbox",
caption = { "gui.bpt-fill-gaps" },
tooltip = { "gui.bpt-fill-gaps-description" },
state = settings.fill_gaps,
ref = { "fill_gaps_checkbox" },
},
{
type = "flow",
style_mods = { vertical_align = "center" },
ref = { "margin_flow" },
children = {
{
type = "label",
style_mods = { right_margin = 8 },
caption = { "gui.bpt-margin" },
tooltip = { "gui.bpt-margin-description" },
},
{
type = "textfield",
style_mods = { width = 50, horizontal_align = "center" },
text = tostring(settings.margin),
numeric = settings.margin,
ref = { "margin_textfield" },
},
},
},
},
},
},
},
{
type = "flow",
style = "dialog_buttons_horizontal_flow",
children = {
{
type = "button",
style = "back_button",
caption = { "gui.cancel" },
actions = {
on_click = { gui = "set_tiles", action = "close" },
},
},
{
type = "empty-widget",
style = "flib_dialog_footer_drag_handle",
style_mods = { minimal_width = 24 },
ref = { "footer_drag_handle" },
},
{
type = "button",
style = "confirm_button",
caption = { "gui.confirm" },
ref = { "confirm_button" },
actions = {
on_click = { gui = "set_tiles", action = "confirm" },
},
},
},
},
},
},
})
refs.footer_drag_handle.drag_target = refs.window
refs.window.force_auto_center()
player.opened = refs.window
player_table.guis.set_tiles = {
refs = refs,
}
end
function set_tiles_gui.destroy(player_table)
local gui_data = player_table.guis.set_tiles
gui_data.refs.window.destroy()
player_table.guis.set_tiles = nil
end
function set_tiles_gui.handle_action(e, msg)
local player = game.get_player(e.player_index)
local player_table = global.players[e.player_index]
local gui_data = player_table.guis.set_tiles
local refs = gui_data.refs
if msg.action == "close" then
set_tiles_gui.destroy(player_table)
elseif msg.action == "confirm" then
local tile_name = refs.tile_button.elem_value
if tile_name then
-- Save settings
local settings = player_table.set_tiles_settings
settings.tile = tile_name
settings.fill_gaps = refs.fill_gaps_checkbox.state
settings.margin = tonumber(refs.margin_textfield.text)
-- Modify the blueprint
set_tiles(player, tile_name, settings.fill_gaps, settings.margin)
-- Destroy the GUI
set_tiles_gui.destroy(player_table)
end
elseif msg.action == "update_tile" then
local tile_name = refs.tile_button.elem_value
if tile_name then
refs.confirm_button.enabled = true
else
refs.confirm_button.enabled = false
end
end
end
return set_tiles_gui
|
--XXクルージョン
--Script by Chrono-Genex
function c101108079.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE+CATEGORY_HANDES)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(c101108079.condition)
e1:SetTarget(c101108079.target)
e1:SetOperation(c101108079.activate)
c:RegisterEffect(e1)
end
function c101108079.condition(e,tp,eg,ep,ev,re,r,rp)
local loc=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION)
return loc==LOCATION_HAND and re:IsActiveType(TYPE_MONSTER) and Duel.IsChainNegatable(ev)
end
function c101108079.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 then
Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,1-tp,1)
end
end
function c101108079.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 then
Duel.BreakEffect()
Duel.DiscardHand(1-tp,nil,1,1,REASON_EFFECT+REASON_DISCARD)
end
end
|
surface.CreateFont( "SF_Display_H", {
font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = true,
size = 30,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
surface.CreateFont( "SF_Display_H2", {
font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = true,
size = 20,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
surface.CreateFont( "SF_Display_H3", {
font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = true,
size = 14,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
surface.CreateFont( "SF_Menu_H2", {
font = "coolvetica", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 20,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
surface.CreateFont( "SkyFox-DigitalClock", {
font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 50,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = false,
} )
surface.CreateFont("SF2.W_Button", {
font = "Tahoma",
size = 15,
weight = 1500,
})
-- Tool
surface.CreateFont( "sf_tool_large", {
font = "Verdana", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
extended = false,
size = 30,
weight = 700,
blursize = 0,
scanlines = 0,
antialias = true,
underline = false,
italic = false,
strikeout = false,
symbol = false,
rotary = false,
shadow = false,
additive = false,
outline = true,
} )
surface.CreateFont( "sf_tool_small", {
font = "Verdana",
size = 17,
weight = 1000
} ) |
object_tangible_collection_rare_melee_blade_betrayer = object_tangible_collection_shared_rare_melee_blade_betrayer:new {
gameObjectType = 8211,}
ObjectTemplates:addTemplate(object_tangible_collection_rare_melee_blade_betrayer, "object/tangible/collection/rare_melee_blade_betrayer.iff") |
function view(location,data,font)
love.graphics.setFont(font)
love.graphics.setColor(0,0,0)
love.graphics.rectangle("fill",location.x,location.y,location.w,location.h)
love.graphics.setColor(255,255,255)
love.graphics.print(data,location.x,location.y)
end
|
object_tangible_storyteller_prop_pr_ch9_wall_military_reb_weak = object_tangible_storyteller_prop_shared_pr_ch9_wall_military_reb_weak:new {
}
ObjectTemplates:addTemplate(object_tangible_storyteller_prop_pr_ch9_wall_military_reb_weak, "object/tangible/storyteller/prop/pr_ch9_wall_military_reb_weak.iff")
|
--global variables
Global = {
realW = 0, realH = 0,
delta = 0, debounce = 0,
mouseX = 0, mouseY = 0, wheel = 0,
screen = "",
ratio = "",
state = "",
substate = {
[PLAYER_1] = "",
[PLAYER_2] = "",
},
oplist = {
[PLAYER_1] = false,
[PLAYER_2] = false,
},
allgroups = {
-- ["Name"] = "string"
-- ["Songs"] = { Songs }
-- ["Count"] = 0
},
songgroup = "",
songlist = {},
song = nil,
selection = 1,
level = 1,
confirm = {
[PLAYER_1] = 0,
[PLAYER_2] = 0,
},
players = 1,
master = "",
mastersteps = nil,
steps = {},
pnsteps = {
[PLAYER_1] = 1,
[PLAYER_2] = 1,
},
pnselection = {
[PLAYER_1] = 1,
[PLAYER_2] = 1,
},
pncursteps = {
[PLAYER_1] = nil,
[PLAYER_2] = nil,
},
pnskin = {
[PLAYER_1] = -1,
[PLAYER_2] = -1,
},
piuscoring = {
[PLAYER_1] = 0,
[PLAYER_2] = 0,
},
volume = 1,
blockjoin = false,
prevstate = "",
toggle = false,
bgcolor = {0.66,0.68,0.7,1},
lockinput = false,
disqualify = false,
};
function ResetState()
Global.confirm = {
[PLAYER_1] = 0,
[PLAYER_2] = 0,
};
Global.oplist = {
[PLAYER_1] = false,
[PLAYER_2] = false,
};
Global.mastersteps = nil;
Global.steps = {};
Global.pnselection = {
[PLAYER_1] = 1,
[PLAYER_2] = 1,
};
Global.pnskin = {
[PLAYER_1] = -1,
[PLAYER_2] = -1,
};
Global.piuscoring = {
[PLAYER_1] = 0,
[PLAYER_2] = 0,
};
Global.volume = 1;
Global.disqualify = false;
Global.blockjoin = false;
end; |
local util = require 'lusty.util'
count = count + 1
if count == 5 then
util.inline('spec.dummy.error', {test=test, foo=foo, count=count})
else
util.inline('spec.dummy.multilevel', {test=test, foo=foo, count=count})
end
|
module("literate.util", package.seeall)
---
-- This function trims code block by removing newlines from the begin and the end of block.
-- @name trimCodeBlock
-- @param block code block from doc_blocks table
function trimCodeBlock(block)
--[[
This function trims code block by removing newlines from the begin and the end of block.
--]]
for i,v in ipairs(block) do
if v.key == "NEWLINE" then
table.remove(block,i)
else
break
end
end
for i = #block, 1, -1 do
if block[i].key == "SPACE" or block[i].key == "NEWLINE" then
table.remove(block,i)
else
break
end
end
end
---
-- This function dumps AST created by luametrics module
-- @name dumpTree
-- @param ast AST to dump
-- @param depth internal depth indicator
function dumpTree(ast, depth)
--[[
This function dumps AST created by luametrics module.
--]]
--print("Node size: "..#ast)
if ast == nil then return nil end
if depth==nil then
depth = 0
end
local indent = ""
for i=1,depth do
indent = indent .. "--"
end
for k,v in pairs(ast) do
if type(v)~="table" then
if type(v) ~= "string" then
print(indent..k)
else
print(indent..k.." = "..v)
end
else
print(indent..k.." = ")
if k == "data" or type(k)=="number" then
dumpTree(v,depth+1)
end
end
end
end |
local Notifier = require('test.notifiers.quickfixlist')
local Executor = require('test.executors.plenary_job')
local M = {}
function M.test_suite()
local notifier = Notifier:new()
local executor = Executor:new()
local runner_type = require('test.runners.factory').get_runner_for_path(vim.loop.cwd())
local runner = runner_type:new(executor)
runner:test_suite()
local results = runner:get_results()
notifier:notify_results(results)
end
return M
|
function scoreboard.init()
function strip(string)
return string.gsub(string, "[%d%s%a%c][%d%s%a%c]", "")
end
if not DEDSERV then
local scoreVisible = false
console_register_command("+SCORES", function()
scoreVisible = true
end)
console_register_command("-SCORES", function()
scoreVisible = false
end)
function bindings.viewportRender(viewport, worm)
local bitmap = viewport:bitmap()
local p = worm:player()
local height = 61
local tdmHeight = 75
local splitX = 0
if (scoreVisible or gameEnd > 0) and cg_draw2d == 1 then
if p == game_local_player(0) then
splitX = 0
end
if p == game_local_player(1) then
splitX = 160
end
if gameMode == 2 then
local playerList = {}
for pl in game_players() do
if pl:team() == 1 then
table.insert(playerList, {pl:name(), pl:kills(), pl:deaths(), floor(pl:stats().timer / 6000), pl})
end
end
gfx_set_alpha(100)
bitmap:draw_box(40 - splitX, 25, 279 - splitX, 135, color(20, 20, 20))
gfx_reset_blending()
if playerList[1] then
fonts.bigfont:render(bitmap, playerList[1][2], 140 - splitX, 28, color(255, 255, 255), Font.Right + Font.Shadow)
fonts.liero:render(bitmap, playerList[1][1], 110 - splitX, 28, color(255, 255, 255), Font.Right + Font.Shadow + Font.Formatting)
fonts.liero:render(bitmap, playerList[1][4], 140 - splitX, 46, color(0, 255, 0), Font.Right + Font.Shadow + Font.Formatting)
fonts.liero:render(bitmap, "("..floor(playerList[1][5]:kills()/(playerList[1][5]:kills()+playerList[1][5]:deaths())*100).. " %)", 100 - splitX, 110, color(255, 255, 255), Font.Right + Font.Shadow + Font.Formatting)
fonts.minifont:render(bitmap, playerList[1][5]:kills(), 90 - splitX, 121, color(0, 255, 0), Font.Right + Font.Shadow + Font.Formatting)
fonts.minifont:render(bitmap, playerList[1][5]:deaths(), 110 - splitX, 121, color(255, 255, 0), Font.Right + Font.Shadow + Font.Formatting)
fonts.minifont:render(bitmap, playerList[1][5]:data().suicides, 130 - splitX, 121, color(255, 0, 0), Font.Right + Font.Shadow + Font.Formatting)
for i = 1, 5 do
if playerList[1][5]:data().atts[playerList[1][5]:data().weaponSelection.list[i]:name()] > 0 then
fonts.liero:render(bitmap, floor((playerList[1][5]:data().hits[playerList[1][5]:data().weaponSelection.list[i]:name()] / playerList[1][5]:data().atts[playerList[1][5]:data().weaponSelection.list[i]:name()]) * 100).." %", 130 - splitX, 50 + (9 * i), color(255, 255, 255), Font.Right + Font.Shadow + Font.Formatting)
fonts.liero:render(bitmap, "06"..playerList[1][5]:data().hits[playerList[1][5]:data().weaponSelection.list[i]:name()].."/ "..playerList[1][5]:data().atts[playerList[1][5]:data().weaponSelection.list[i]:name()].."00", 85 - splitX, 50 + (9 * i), color(255, 255, 255), Font.Right + Font.Shadow + Font.Formatting)
gfx_set_alphach(255)
if game_local_player(1) and p == game_local_player(0) then
icons[playerList[1][5]:data().weaponSelection.list[i]:name()]:render(bitmap, 0, 135, 52 + (9 * i))
else
if p ~= game_local_player(1) then
icons[playerList[1][5]:data().weaponSelection.list[i]:name()]:render(bitmap, 0, bitmap:w()/2 - 25, 52 + (9 * i))
end
end
gfx_reset_blending()
end
end
end
if playerList[2] then
fonts.bigfont:render(bitmap, playerList[2][2], 180 - splitX, 28, color(255, 255, 255), Font.Right + Font.Shadow)
fonts.liero:render(bitmap, playerList[2][1], 230 - splitX, 28, color(255, 255, 255), Font.Right + Font.Shadow + Font.Formatting)
fonts.liero:render(bitmap, playerList[2][4], 180 - splitX, 46, color(0, 255, 0), Font.Right + Font.Shadow + Font.Formatting)
fonts.liero:render(bitmap, "("..floor(playerList[2][5]:kills()/(playerList[2][5]:kills()+playerList[2][5]:deaths())*100).. " %)", 215 - splitX, 110, color(255, 255, 255), Font.Shadow + Font.Formatting)
fonts.minifont:render(bitmap, playerList[2][5]:kills(), 185 - splitX, 121, color(0, 255, 0), Font.Shadow + Font.Formatting)
fonts.minifont:render(bitmap, playerList[2][5]:deaths(), 205 - splitX, 121, color(255, 255, 0), Font.Shadow + Font.Formatting)
fonts.minifont:render(bitmap, playerList[2][5]:data().suicides, 225 - splitX, 121, color(255, 0, 0), Font.Shadow + Font.Formatting)
for i = 1, 5 do
if playerList[2][5]:data().atts[playerList[2][5]:data().weaponSelection.list[i]:name()] > 0 then
fonts.liero:render(bitmap, floor((playerList[2][5]:data().hits[playerList[2][5]:data().weaponSelection.list[i]:name()] / playerList[2][5]:data().atts[playerList[2][5]:data().weaponSelection.list[i]:name()]) * 100).." %", 193 - splitX, 50 + (9 * i), color(255, 255, 255), Font.Shadow + Font.Formatting)
fonts.liero:render(bitmap, "06"..playerList[2][5]:data().hits[playerList[2][5]:data().weaponSelection.list[i]:name()].."/ "..playerList[2][5]:data().atts[playerList[2][5]:data().weaponSelection.list[i]:name()].."00", 219 - splitX, 50 + (9 * i), color(255, 255, 255), Font.Shadow + Font.Formatting)
gfx_set_alphach(255)
if game_local_player(1) and p == game_local_player(1) then
icons[playerList[2][5]:data().weaponSelection.list[i]:name()]:render(bitmap, 0, 25, 52 + (9 * i))
else
if p ~= game_local_player(0) and console.cl_splitscreen == 1 then
icons[playerList[2][5]:data().weaponSelection.list[i]:name()]:render(bitmap, 0, bitmap:w()/2 - 25, 52 + (9 * i))
end
end
gfx_reset_blending()
end
end
end
fonts.liero:render(bitmap, "Spectators", 160 - splitX, 145, color(255, 255, 0), Font.CenterH+Font.CenterV+Font.Shadow)
local spectators = {}
for spct in game_players() do
if spct:team() ~= 1 then
table.insert(spectators, spct:name())
end
end
spctLine = 1
spcts = table.getn(spectators)
for i = 1, spcts do
fonts.liero:render(bitmap, spectators[i], (60*i) - splitX, 154, color(255, 255, 255), Font.Shadow + Font.Formatting)
end
elseif isTeamPlay() then
local scoreRed = 0
local scoreBlue = 0
local playerListRed = {}
local playerListBlue = {}
for pl in game_players() do
if pl:team() == 1 then
table.insert(playerListRed, {pl:name(), pl:kills(), pl:deaths(), floor(pl:stats().timer / 6000)})
end
if pl:team() == 2 then
table.insert(playerListBlue, {pl:name(), pl:kills(), pl:deaths(), floor(pl:stats().timer / 6000)})
end
end
scoreboardRed = {}
scoreboardBlue = {}
for index, sort in ipairs(playerListRed) do
if #scoreboardRed > 0 then
local name, sort_score = unpack(sort)
local sorted = false
for index, scores in ipairs(scoreboardRed) do
local name, score = unpack(scores)
if sort_score >= score then
table.insert(scoreboardRed,index, sort)
sorted = true
break
end
end
if not sorted then
table.insert(scoreboardRed, sort)
end
else
table.insert(scoreboardRed, sort)
end
end
for index, sort in ipairs(playerListBlue) do
if #scoreboardBlue > 0 then
local name, sort_score = unpack(sort)
local sorted = false
for index, scores in ipairs(scoreboardBlue) do
local name, score = unpack(scores)
if sort_score >= score then
table.insert(scoreboardBlue,index, sort)
sorted = true
break
end
end
if not sorted then
table.insert(scoreboardBlue, sort)
end
else
table.insert(scoreboardBlue, sort)
end
end
gfx_set_alphach(30)
bitmap:draw_box(21 - splitX, 49, 160 - splitX, 72, color(255, 0, 0))
bitmap:draw_box(165 - splitX, 49, 304 - splitX, 72, color(0, 0, 255))
gfx_reset_blending()
gfx_set_alphach(60)
bitmap:draw_box(21 - splitX, 73, 160 - splitX, 82+(9*table.getn(playerListRed)), color(255, 0, 0))
bitmap:draw_box(165 - splitX, 73, 304 - splitX, 82+(9*table.getn(playerListBlue)), color(0, 0, 255))
gfx_reset_blending()
fonts.liero:render(bitmap, "Players", 132 - splitX, 51, color(255, 0, 0), Font.Shadow)
fonts.liero:render(bitmap, "Players", 275 - splitX, 51, color(0, 0, 255), Font.Shadow)
fonts.liero:render(bitmap, table.getn(playerListRed), 159 - splitX, 62, color(255, 255, 255), Font.Right + Font.Shadow)
fonts.liero:render(bitmap, table.getn(playerListBlue), 302 - splitX, 62, color(255, 255, 255), Font.Right + Font.Shadow)
if gameMode == 4 then
fonts.liero:render(bitmap, "Flags", 92 - splitX, 51, color(255, 0, 0), Font.Shadow)
fonts.liero:render(bitmap, "Flags", 235 - splitX, 51, color(0, 0, 255), Font.Shadow)
fonts.liero:render(bitmap, teams[1].score, 119 - splitX, 62, color(255, 255, 255), Font.Right + Font.Shadow)
fonts.liero:render(bitmap, teams[2].score, 262 - splitX, 62, color(255, 255, 255), Font.Right + Font.Shadow)
end
for players = 1, table.getn(scoreboardRed) do
if gameMode ~= 7 and gameMode ~= 8 then
scoreRed = scoreRed + scoreboardRed[players][2] + (teams[1].score*5)
else
scoreRed = scoreRed + teams[1].score
end
end
for players = 1, table.getn(scoreboardBlue) do
if gameMode ~= 7 and gameMode ~= 8 then
scoreBlue = scoreBlue + scoreboardBlue[players][2] + (teams[2].score*5)
else
scoreBlue = scoreBlue + teams[2].score
end
end
fonts.bigfont:render(bitmap, scoreRed, 25 - splitX, 54, color(255, 255, 255), Font.Shadow )
fonts.bigfont:render(bitmap, scoreBlue, 169 - splitX, 54, color(255, 255, 255), Font.Shadow )
fonts.minifont:render(bitmap, "Name", 103 - splitX, 75, color(255, 0, 0), Font.Shadow)
fonts.minifont:render(bitmap, "Net", 84 - splitX, 75, color(255, 0, 0), Font.Shadow)
fonts.minifont:render(bitmap, "Deaths", 53 - splitX, 75, color(255, 0, 0), Font.Shadow)
fonts.minifont:render(bitmap, "Score", 27 - splitX, 75, color(255, 0, 0), Font.Shadow)
fonts.minifont:render(bitmap, "Name", 247 - splitX, 75, color(0, 0, 255), Font.Shadow)
fonts.minifont:render(bitmap, "Net", 228 - splitX, 75, color(0, 0, 255), Font.Shadow)
fonts.minifont:render(bitmap, "Deaths", 197 - splitX, 75, color(0, 0, 255), Font.Shadow)
fonts.minifont:render(bitmap, "Score", 171 - splitX, 75, color(0, 0, 255), Font.Shadow)
for players = 1, table.getn(scoreboardRed) do
tdmHeight = tdmHeight + 9
fonts.minifont:render(bitmap, scoreboardRed[players][1], 103 - splitX, tdmHeight, color(255,255,255), Font.Shadow + Font.Formatting)
end
tdmHeight = 75
for players = 1, table.getn(scoreboardRed) do
tdmHeight = tdmHeight + 9
fonts.minifont:render(bitmap, scoreboardRed[players][2] - scoreboardRed[players][3], 96 - splitX, tdmHeight, color(100,254,254), Font.Right + Font.Shadow)
end
tdmHeight = 75
for players = 1, table.getn(scoreboardRed) do
tdmHeight = tdmHeight + 9
fonts.minifont:render(bitmap, scoreboardRed[players][3], 77 - splitX, tdmHeight, color(255,0,0), Font.Right + Font.Shadow)
end
tdmHeight = 75
for players = 1, table.getn(scoreboardRed) do
tdmHeight = tdmHeight + 9
fonts.minifont:render(bitmap, scoreboardRed[players][2], 47 - splitX, tdmHeight, color(0,255,0), Font.Right + Font.Shadow)
end
tdmHeight = 75
for players = 1, table.getn(scoreboardBlue) do
tdmHeight = tdmHeight + 9
fonts.minifont:render(bitmap, scoreboardBlue[players][1], 247 - splitX, tdmHeight, color(255,255,255), Font.Shadow + Font.Formatting)
end
tdmHeight = 75
for players = 1, table.getn(scoreboardBlue) do
tdmHeight = tdmHeight + 9
fonts.minifont:render(bitmap, scoreboardBlue[players][2] - scoreboardBlue[players][3], 240 - splitX, tdmHeight, color(100,254,254), Font.Right + Font.Shadow)
end
tdmHeight = 75
for players = 1, table.getn(scoreboardBlue) do
tdmHeight = tdmHeight + 9
fonts.minifont:render(bitmap, scoreboardBlue[players][3], 221 - splitX, tdmHeight, color(255,0,0), Font.Right + Font.Shadow)
end
tdmHeight = 75
for players = 1, table.getn(scoreboardBlue) do
tdmHeight = tdmHeight + 9
fonts.minifont:render(bitmap, scoreboardBlue[players][2], 191 - splitX, tdmHeight, color(0,255,0), Font.Right + Font.Shadow)
end
if table.getn(scoreboardRed) > table.getn(scoreboardBlue) then
height = 67 + (9 * table.getn(scoreboardRed)) + 28
else
height = 67 + (9 * table.getn(scoreboardBlue)) + 28
end
fonts.liero:render(bitmap, "Spectators", 160 - splitX, height, color(255, 255, 0), Font.CenterH+Font.CenterV+Font.Shadow)
local spectators = {}
for spct in game_players() do
if spct:team() ~= 1 and spct:team() ~= 2 then
table.insert(spectators, spct:name())
end
end
spctLine = 1
spcts = table.getn(spectators)
for i = 1, spcts do
fonts.liero:render(bitmap, spectators[i], (60*i) - splitX, height + 9, color(255, 255, 255), Font.Shadow + Font.Formatting)
end
else
local playerList = {}
for pl in game_players() do
if pl:team() == 1 then
if gameMode == 6 then
table.insert(playerList, {pl:name(), pl:stats().kotb_timer, pl:kills(), pl:deaths()})
else
table.insert(playerList, {pl:name(), pl:kills(), pl:deaths(), floor(pl:stats().timer / 6000)})
end
end
end
scoreboard = {}
for index, sort in ipairs(playerList) do
if #scoreboard > 0 then
local name, sort_score = unpack(sort)
local sorted = false
for index, scores in ipairs(scoreboard) do
local name, score = unpack(scores)
if sort_score >= score then
table.insert(scoreboard,index, sort)
sorted = true
break
end
end
if not sorted then
table.insert(scoreboard, sort)
end
else
table.insert(scoreboard, sort)
end
end
gfx_set_alpha(50)
bitmap:draw_box(60 - splitX, 68, 260 - splitX, 76, color(220, 220, 220))
gfx_reset_blending()
fonts.liero:render(bitmap, "Name", 171 - splitX, height, color(255,255,0), Font.Shadow)
for players = 1, table.getn(scoreboard) do
height = height + 9
fonts.liero:render(bitmap, scoreboard[players][1], 171 - splitX, height, color(255,255,255), Font.Shadow + Font.Formatting)
end
if gameMode == 6 then
height = 61
fonts.liero:render(bitmap, "Score", 80 - splitX, height, color(255, 255, 0), Font.Shadow)
for players = 1, table.getn(scoreboard) do
height = height + 9
fonts.liero:render(bitmap, scoreboard[players][3], 101 - splitX, height, color(0, 255, 0), Font.Right + Font.Shadow)
end
height = 61
fonts.liero:render(bitmap, "Deaths", 105 - splitX, height, color(255, 255, 0), Font.Shadow)
for players = 1, table.getn(scoreboard) do
height = height + 9
fonts.liero:render(bitmap, scoreboard[players][4], 130 - splitX, height, color(255, 0, 0), Font.Right + Font.Shadow)
end
height = 61
fonts.liero:render(bitmap, "Time", 150 - splitX, height, color(255,255,0), Font.Shadow)
for players = 1, table.getn(scoreboard) do
height = height + 9
fonts.liero:render(bitmap, to_time_string(scoreboard[players][2]), 167 - splitX, height, color(100, 254, 254), Font.Right + Font.Shadow)
end
else
height = 61
fonts.liero:render(bitmap, "Min", 155 - splitX, height, color(255,255,0), Font.Shadow)
for players = 1, table.getn(scoreboard) do
height = height + 9
fonts.liero:render(bitmap, scoreboard[players][4], 167 - splitX, height, color(100, 254, 254), Font.Right + Font.Shadow)
end
height = 61
fonts.liero:render(bitmap, "Net", 137 - splitX, height, color(255, 255, 0), Font.Shadow)
for players = 1, table.getn(scoreboard) do
height = height + 9
fonts.liero:render(bitmap, scoreboard[players][2] - scoreboard[players][3], 150 - splitX, height, color(255, 255, 255), Font.Right + Font.Shadow)
end
height = 61
fonts.liero:render(bitmap, "Deaths", 105 - splitX, height, color(255, 255, 0), Font.Shadow)
for players = 1, table.getn(scoreboard) do
height = height + 9
fonts.liero:render(bitmap, scoreboard[players][3], 130 - splitX, height, color(255, 0, 0), Font.Right + Font.Shadow)
end
height = 61
fonts.liero:render(bitmap, "Score", 80 - splitX, height, color(255, 255, 0), Font.Shadow)
for players = 1, table.getn(scoreboard) do
height = height + 9
fonts.liero:render(bitmap, scoreboard[players][2], 101 - splitX, height, color(0, 255, 0), Font.Right + Font.Shadow)
end
end
height = 69 + (9 * table.getn(scoreboard)) + 18
fonts.liero:render(bitmap, "Spectators", 160 - splitX, height, color(255, 255, 0), Font.CenterH+Font.CenterV+Font.Shadow)
local spectators = {}
for spct in game_players() do
if spct:team() ~= 1 then
table.insert(spectators, spct:name())
end
end
spctLine = 1
spcts = table.getn(spectators)
for i = 1, spcts do
--if spcts <= 3 then
fonts.liero:render(bitmap, spectators[i], (60*i) - splitX, height + 9, color(255, 255, 255), Font.Shadow + Font.Formatting)
--end
end
end
end
end
end
end
|
local a = x == 0 or {1, 2, 3}
local b = x == 1 or {a = 1, b = 3, c = 3}
print(a, b)
|
-- NetHack 3.7 sokoban.des $NHDT-Date: 1432512784 2015/05/25 00:13:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $
-- Copyright (c) 1998-1999 by Kevin Hugo
-- NetHack may be freely redistributed. See license for details.
--
--
-- In case you haven't played the game Sokoban, you'll learn
-- quickly. This branch isn't particularly difficult, just time
-- consuming. Some players may wish to skip this branch.
--
-- The following actions are currently permitted without penalty:
-- Carrying or throwing a boulder already in inventory
-- (player or nonplayer).
-- Teleporting boulders.
-- Digging in the floor.
-- The following actions are permitted, but with a luck penalty:
-- Breaking boulders.
-- Stone-to-fleshing boulders.
-- Creating new boulders (e.g., with a scroll of earth).
-- Jumping.
-- Being pulled by a thrown iron ball.
-- Hurtling through the air from Newton's 3rd law.
-- Squeezing past boulders when naked or as a giant.
-- These actions are not permitted:
-- Moving diagonally between two boulders and/or walls.
-- Pushing a boulder diagonally.
-- Picking up boulders (player or nonplayer).
-- Digging or walking through walls.
-- Teleporting within levels or between levels of this branch.
-- Using cursed potions of gain level.
-- Escaping a pit/hole (e.g., by flying, levitation, or
-- passing a dexterity check).
-- Bones files are not permitted.
--## Bottom (first) level of Sokoban ###
des.level_init({ style = "solidfill", fg = " " });
des.level_flags("mazelevel", "noteleport", "hardfloor", "premapped", "solidify");
des.map([[
------ -----
|....| |...|
|....----...|
|...........|
|..|-|.|-|..|
---------|.---
|......|.....|
|..----|.....|
--.| |.....|
|.|---|.....|
|...........|
|..|---------
----
]]);
des.levregion({ region = {06,04,06,04}, type = "branch" })
des.stair("up", 06,06)
des.region(selection.area(00,00,13,12), "lit")
des.non_diggable(selection.area(00,00,13,12))
des.non_passwall(selection.area(00,00,13,12))
-- Boulders
des.object("boulder",02,02)
des.object("boulder",02,03)
--
des.object("boulder",10,02)
des.object("boulder",09,03)
des.object("boulder",10,04)
--
des.object("boulder",08,07)
des.object("boulder",09,08)
des.object("boulder",09,09)
des.object("boulder",08,10)
des.object("boulder",10,10)
-- Traps
des.trap("pit",03,06)
des.trap("pit",04,06)
des.trap("pit",05,06)
des.trap("pit",02,08)
des.trap("pit",02,09)
des.trap("pit",04,10)
des.trap("pit",05,10)
des.trap("pit",06,10)
des.trap("pit",07,10)
-- A little help
des.object("earth",02,11)
des.object("earth",03,11)
-- Random objects
des.object({ class = "%" });
des.object({ class = "%" });
des.object({ class = "%" });
des.object({ class = "%" });
des.object({ class = "=" });
des.object({ class = "/" });
|
-- -------------------------------------------------------------------
-- Window managment & Grid
-- -------------------------------------------------------------------
-- https://github.com/wincent/wincent/blob/a33430e43464842c067016e507ab91abd6569948/roles/dotfiles/files/.hammerspoon/init.lua
local lastSeenChain = nil
local lastSeenWindow = nil
local lastSeenAt = nil
hs.grid.setGrid '12x12'
hs.grid.MARGINX = 0
hs.grid.MARGINY = 0
local grid = {
topHalf = '0,0 12x6',
topThird = '0,0 12x4',
topTwoThirds = '0,0 12x8',
rightHalf = '6,0 6x12',
rightThird = '8,0 4x12',
rightTwoThirds = '4,0 8x12',
bottomHalf = '0,6 12x6',
bottomThird = '0,8 12x4',
bottomTwoThirds = '0,4 12x8',
leftHalf = '0,0 6x12',
leftThird = '0,0 4x12',
leftTwoThirds = '0,0 8x12',
topLeft = '0,0 6x6',
topRight = '6,0 6x6',
bottomRight = '6,6 6x6',
bottomLeft = '0,6 6x6',
fullScreen = '0,0 12x12',
centeredBig = '3,3 6x6',
centeredSmall = '4,4 4x4',
}
-- Chain the specified movement commands.
--
-- This is like the 'chain' feature in Slate, but with a couple of enhancements:
--
-- - Chains always start on the screen the window is currently on.
-- - A chain will be reset after 2 seconds of inactivity, or on switching from
-- one chain to another, or on switching from one app to another, or from one
-- window to another.
--
local function chain(movements)
local chainResetInterval = 2 -- seconds
local cycleLength = #movements
local sequenceNumber = 1
return function()
local win = hs.window.frontmostWindow()
local id = win:id()
local now = hs.timer.secondsSinceEpoch()
local screen = win:screen()
if
lastSeenChain ~= movements
or lastSeenAt < now - chainResetInterval
or lastSeenWindow ~= id
then
sequenceNumber = 1
lastSeenChain = movements
elseif sequenceNumber == 1 then
-- At end of chain, restart chain on next screen.
screen = screen:next()
end
lastSeenAt = now
lastSeenWindow = id
hs.grid.set(win, movements[sequenceNumber], screen)
sequenceNumber = sequenceNumber % cycleLength + 1
end
end
local function alertCannotManipulateWindow()
hs.alert.show "Can't move window"
end
--
-- Key bindings.
--
hs.hotkey.bind(
{ 'cmd', 'alt' },
'up',
chain {
grid.topHalf,
grid.topThird,
grid.topTwoThirds,
}
)
hs.hotkey.bind(
{ 'cmd', 'alt' },
'right',
chain {
grid.rightHalf,
grid.rightThird,
grid.rightTwoThirds,
}
)
hs.hotkey.bind(
{ 'cmd', 'alt' },
'down',
chain {
grid.bottomHalf,
grid.bottomThird,
grid.bottomTwoThirds,
}
)
hs.hotkey.bind(
{ 'cmd', 'alt' },
'left',
chain {
grid.leftHalf,
grid.leftThird,
grid.leftTwoThirds,
}
)
hs.hotkey.bind(
{ 'alt', 'cmd' },
'c',
chain {
grid.centeredBig,
grid.centeredSmall,
}
)
hs.hotkey.bind(
{ 'alt', 'cmd' },
'f',
chain {
grid.fullScreen,
}
)
hs.hotkey.bind({ 'ctrl', 'alt', 'cmd' }, 'left', function()
local win = hs.window.focusedWindow()
if not win then
alertCannotManipulateWindow()
return
end
win:moveOneScreenWest()
end)
hs.hotkey.bind({ 'ctrl', 'alt', 'cmd' }, 'right', function()
local win = hs.window.focusedWindow()
if not win then
alertCannotManipulateWindow()
return
end
win:moveOneScreenEast()
end)
|
local e=(function(l,e)return(l<e);end)local e=(function(e,l)return(e~=l);end)local e=(function(l,e)return(l<=e);end)local s=(function(l,e)return(l==e);end)local e=(function(l,e)return(l>=e);end)local e=(function(e,l)return(e..l);end)local z=(function(l,e)return(l*e);end)local R=(function(e,l)return(e+l);end)local y=(function(e,l)return(e^l);end)local U=(function(e,l)return(e-l);end)local n1=(function(e,l)return(e>l);end)local t=(function(e,...)return e(...);end)local l1=(function(l,e)return(l%e);end)local b=(function(l,e)return(l/e);end)return(function(r,...)local e="This file was obfuscated using KFC Obfuscator 4.0.A | discord.gg/dFA7EScGv4";local N=r.lwn5erUxxE;local j=r[((#{947;653;440;}+573355533))];local M=r[((65426957-#("workspace:Destroy()")))];local G=r[((#{947;532;20;464;}+607932493))];local l=r.AfIDbE;local B=r[(106230923)];local Z=r[(62683143)];local A=r[(72549578)];local k=r[((540719836-#("hey whats grabify.link")))];local x=r[(182476525)];local O=r[(671383977)];local V=r.xDuaUxmNbs;local i=r[(203106775)];local P=r[((391880102-#("how to delete jjsploit")))];local h=r["M4qjyM"];local K=r[(944656309)];local e1=r['TvynTFSzm'];local f=r[(904386962)];local g=r[(73682077)];local X=r[(943001888)];local E=r["XBIuDr5kqu"];local _=r[(50044429)];local n=r[(434486290)];local T=r[(916312959)];local a=r.Eh9UY2Pc1O;local C=r["DlIPWT9D95"];local Q=r[(558466345)];local L=r["bOJFPz"];local v=r[(126879745)];local q=r[(690603824)];local m=((getfenv)or(function(...)return(_ENV);end));local d,u,e=({}),(""),(m(l));local o=((e[""..r[x].."\105\116"..r[G].."\50"])or(e["\98"..r[k].."\116"])or({}));local c=(((o)and(o["\98\120"..r[C]..r[h]]))or(function(e,o)local l,t=l,a;while((e>a)and(o>a))do local c,r=e%n,o%n;if c~=r then t=t+l;end;e,o,l=(e-c)/n,(o-r)/n,l*n;end;if e<o then e=o;end;while e>a do local o=e%n;if o>a then t=t+l;end;e,l=(e-o)/n,l*n;end;return(t);end));local D=(n^O);local I=(D-l);local p,w,S;local D=(u[""..r.CoSC94.."\115\117\98"]);local W=(u["\99\104"..r[f]..r[h]]);local F=(u["\98\121"..r['RIixqg3znr']..r[i]]);local D=(u[""..r[g]..r[B]..r[x]]);local Y=(e["\115\101"..r['RIixqg3znr']..r[N].."\101"..r['RIixqg3znr'].."\97"..r["RIixqg3znr"]..r[f]..r[x]..r[E].."\101"]);local J=((e["\109"..r[f].."\116"..r[P]][""..r[E].."\100\101\120\112"])or(function(e,l,...)return((e*n)^l);end));local u=(e[""..r['RIixqg3znr']..r[q].."\112\101"]);local u=(e["\114"..r[f]..r[M]..r[g].."\101"..r["RIixqg3znr"]]);local H=(e[""..r[A].."\97\105\114\115"]);local M=(e["\109"..r[f]..r["RIixqg3znr"].."\104"]["\102\108\111"..r[C].."\114"]);local q=(e[""..r[g]..r[i]..r[E]..r[i]..r['rhGmb'].."\116"]);local N=(e["\116\111"..r[j].."\117"..r[N].."\98\101"..r[h]]);local u=((e[""..r[B].."\110"..r[A].."\97"..r.rhGmb.."\107"])or(e["\116\97"..r[x]..r[E]..r[i]][""..r[B]..r[j]..r[A].."\97"..r['rhGmb']..r['nXS2vD5']]));p=((o["\108\115"..r[P].."\105\102\116"])or(function(l,e,...)if(e<a)then return(w(l,-(e)));end;return((l*n^e)%n^O);end));local B=(o[""..r[x]..r[C].."\114"])or(function(e,l,...)return(I-S(I-e,I-l));end);w=((o["\114\115\104\105\102"..r.RIixqg3znr])or(function(l,e,...)if(e<a)then return(p(l,-(e)));end;return(M(l%n^O/n^e));end));local I=(o[""..r[x].."\110"..r[C]..r.RIixqg3znr])or(function(e,...)return(I-e);end);S=(o["\98\97\110\100"])or(function(l,e,...)return(((l+e)-c(l,e))/n);end);if((not(e["\98"..r[k]..r["RIixqg3znr"]..r[G].."\50"]))and(not(e["\98"..r[k].."\116"])))then o["\98"..r[X]..r[C].."\114"]=c;o["\98\110"..r[C].."\116"]=I;o["\98\111"..r[h]]=B;o["\98"..r[f].."\110\100"]=S;o["\114"..r[g].."\104\105\102\116"]=w;o["\108\115\104\105\102"..r['RIixqg3znr']]=p;end;local n=(e[""..r['RIixqg3znr'].."\97\98"..r[E]..r[i]]["\105\110"..r[g]..r[i]..r[h]..r.RIixqg3znr]);local C=(e[""..r["RIixqg3znr"].."\97"..r[x].."\108"..r[i]]["\99"..r[C].."\110\99"..r[f]..r.RIixqg3znr]);local g=(((e[""..r["RIixqg3znr"].."\97\98"..r[E]..r[i]]["\99"..r[h].."\101"..r[f]..r["RIixqg3znr"]..r[i]]))or((function(e,...)return({u({},a,e);});end)));local n=(e[""..r["RIixqg3znr"]..r[f].."\98\108\101"][""..r[h]..r[i].."\109\111\118\101"]);e[""..r[x].."\105\116\51"..r[V]]=o;local e=(Z);local o=(L);local i,I=({}),({});for e=a,o-l do local l=W(e);i[e]=l;I[e]=l;I[l]=e;end;local E,n=(function(t)local n,c,r=F(t,l,e1);if((n+c+r)~=Q)then e=e+K;o=o+v;end;t=D(t,_);local n,r,c=(""),(""),({});local e=l;local function a()local n=N(D(t,e,e),T);e=e+l;local l=N(D(t,e,e+n-l),T);e=e+n;return(l);end;n=I[a()];c[l]=n;while(e<#t)do local e=a();if i[e]then r=i[e];else r=n..D(n,l,l);end;i[o]=n..D(r,l,l);c[#c+l],n,o=r,r,o+l;end;return(C(c));end)("PSU|24f21H21h1C1C10279121227927D27d151527913131021621427C10111127D181827p27r27921l21l27V27V1p1p28027q21121127i1327Q27D27727J27f1528A28828g111L1K28d27A27O27E27927G28827L27n28s21621727W28g1027y1028d28w28Y27W1027T28n28P28E28v28u28027929828Z29128a27Q22D22F1229j1121E21E10121A27U27d28M1Z1z29A21s22R29z29a29Y28P26o25r1M21528v21a1427928z29g29621J21I112931D2132AE2962911i1g1221221027o1i1h1321221327W29321f28327P131227J21i21H27j27k2161W1A2Ae151416162152aa1X1x102BK1513161114151717215214112BO102bY1512172C327b1Q1O29n27r27q21j21C1728Z21j21D162b32B523w23X27Q111j21d1y2791K1K28v21q2CY102C314142182182D22bP27G2182191123O23l2bi1422421y2bg29729v2931y29V28A27j29Q1023w23w27v2Ct2Cv101i1I28V21k2e127p2bi27g2Bm2D81027g27H152c9122cB2cD27d21J21e2bs2BD2am2aE2B72b92bB29321D1R27923o23p27w161x2AN29S27o29329d2d32d52d723W23s1427Q1J182EU101W1W28V1A2fI2dt2dv2fC1b1O27921021028v1E2ft1027727921f21F27d21f1g2A324W26023o25223o25026423923221X22422s1322523q22N24A21s23924c24126Y22421w1Y26k26824023G2151Q1K22126623321l2a327923K25d1123721N29v22N1021O1c111D121l21z21h1627923717161R171922C21r278102371m1h1P181H1l2I6131E1922e21J2AD1022r1B191j21t21L2dK2hE2171R1S2hr2ht1921W2h62792A71C21C27K2hZ161n21t2IU27D2A527d26823Z21B23I21q28v162d7280191921J21G28927R1A1a21J21R1828A2Jh1o2Fq1118192d421v2232JR19182Jz2221929321n1h2aO2Ea152Ds1I1N1521221227D1I1k162b027W1i1l171Z2132id1x214192bY1x212171i1Q1821221A2Dp27r2jh2E02Dz1o1a2l629V23N23V1821B152162791j1J28V21L2LP1023N23q1521t21S27w2982922Bd2DO2791X2151827721r21G1b1X1z122772181w1c2M52m71c22321z2hH27R1D1d2Ej28F27r1E1E21j21h2Eh1f1F2cg2cI27r1G1g21J21J2801h1h21j21o1b28A2E02nc2Ne27r2n02CS1i111e2N01f2272232Fb2n42N62ch28A2NA2Ck2Bu27R2ng21n2mo102Lo21J2o328A2N5111I1J111h2N51G2nR2NT102MV2Oe1G111f2MV1E2oI28A2n02ai27q2nO27g2I81D29327l2Kb29f27u2LH1821T22a2ls2by28v219172P329027z2OC111Z21227H28027B2132aN2Ak2B8132PP29S161421s21S27d2I51427j21a21517122PW21S21t27w2q12q32192JL27V112b827C1221S21U2aw2aY2kt2KV2132cm131X1Y2QF2d42pu2kf2kH2182Dk2Kl2kn2191b2792kQ172lf2792lU1521b21q2Ka29e29328X2P32G32A326025G23O24Y25q24H26421i22Z22321y22W2241K23P22525v1S22t23X23u26b22021v23i25226Z24623f2151U2291B25J23f23g2pe2M128t27O2AF27U29H27z2B8112pY2KK2AS2kI27d29o2Ju28429P29r28G21f21G2SN22021O101421j1y1H23f1f28v2RJ29E2pG2tm22E22e2T422E22F2c22bp27Q21D21C2cR2M122E22c27b2Q82Pz2Kb27j2T32DQ1321x21X2802d42102112TZ27q1U1q2OJ27922b22B2Tm21C21C2tm2862tM2M028m29A2uv2BD2tl2ST2to2tQ29O2TS2tZ27b2U12Eh2792252272V9102uT2Sr28H28Y28k2uw27B29A28q2PM2F42f32uz29527d2912rI2Vs2p42992vm28r2So2942pF29i2CE1129L2EH27Q2Ds2VG29T29v28s102J627E2a12j42792wG2Iv2a82aA2W1182DY2f62D62E92da2DC2De2Dg22421V2tJ1028228V2B42ev2EX2792HS1T2791R2fF2Es2fF2ws2f82Fa2fc1p2Dk1v1V28V21H2XN2E52bW152E82C32eb2EA2eE2Eg2Cj2Ek29321j2xa2xr2Bk2XU2Bp2BR2bt2bV2bX2bZ2C12c32c52C72Xy2cC29O2n22Cj2cL2al2F12CP2cR1J1M2Pm28G2VV2Eo2PS2BA2BC27L2112x12Cj2Aj2Y22Y42DU2dw21E2BP2C42sn2932Pd2Yx2eq2Z02bE2Dk2U92wa2aP2pH2sZ2av2r72Ay2kO28v2eN2uu27U2Z82fC2YT2791n1n28V21P31032FX2hy21F21Q1d27926524T24421k21C25J24Z1624z21w1H21Y26P2702hN2Hp2IQ2HU2It28p21622y2372IK2792im2io310T2Hv2hC31112HF2hh2HJ2HL2g12wk2iU2j821B2372HX2hp2i12i32i52I72i921Y2J42a71S2wj1021f2iY2HP2J12292ic2792IF2IH2242Jc2W12JE2Kb27G2Ke2kg2121z2pM2r32t02r72Kr1z1Y27w1x2171a2kZ2L12L32L52L72KB2LA2e11I2LD2RA2LT2lI21b1d2Dy2FY2w12122hY2vg2Mj2M82ma2mc2Me1c2Mg2MI2m62772mM2O42mQ2ms28A2mV2mX2mz2N12nW2Nu2N72N92NB2Nd2nf1I2Nh2oT1F2NL2nn2NP2oS313U313t102ny2CL313z2O72o42o62O82Nu2OB2oD2Of2n531472OK1e2oM2oO2Oq314N2Ou2Aj31452oy1E2p02BD2Wq2rb2Li21t22531382B22vR2rB2LV21T22V2kj2F229c2SQ2l92jI2Jk28a2jn2Jp2Jr315h2u82JX2jz2k1112K32K52k72Bd2FV2W32ph2oD1Z2102sN28a2Po2Pq2EP2pT2An2q72PX2U5314A1l2q21321A2qE316B2q92Qb316f2Q32162oj2cr2QI29s2ql2qN13312j312L2161B27j2qu2QW142QY312B21b192r72kM2121W2hO2Dz2kr312z2Rc21b1B2Fw312G2931C315d2t7310A27926I24O24021k21J25H2521U24v21x28k24n26Z2zd31582tm2912SV2sx2r72sZ315D2t42U82W52zm27S27U2Na2fZ31162Hz2I11o131c121d22n311I1022w2pe141d1J1r1D1n1t2bU22L310r1021V21827j1T21T2902dk21z2Tg21321I1n141V1A1622E2T92792361n1K141S1R1n22e318M2212131T171l1f1d16311p27e23S22j243237311w2hZ1A1N22L21K2r6102241Z318R1D21o21o1d1O1S2J2319r1022V121h2J12FP21x318M31b01H318P31AQ22N3110102302i8151N311422C31aY22831aT31AV1N2sw318V22F21i181T21e2151T21d28X151822f31bC2HE21D1f1C1816318S1022n21i2PM22S11171N1i22C2372u522P2892cI289314331Co2aK111V31CT31Cp2Oo2Ak21N31Cs31cq31cw31cT31cv31d131cy1322y31d331D222U23623221v2JD2jf28a2uE2uG29331372R7312b2112Iz2932BF2X61127G1b21c21N2We2932152Iz2AX316w316331dT27j21g2141s27921g21g28v1u31ED28027j2i62W11p311C312R312G28027G31eJ2p12lM31ep1522E22d2qF2Bk2JJ2qF2By2v52wC316U2KB2By318F2zC2UB314A1m2bY171y2102qs27l2LK2kB1b1b22E22B1523o23X1931fL22422527W1q1Q28V21c31fy1023L23l2TD142fy31352yW2DZ2Qo21431AM1i1M1421221i1g31dn2Kh312T2bq2bS2BK22122127e27j29J2QG2bQ1631fa28A27G2NZ2u931eR2Bd31El2kB27T31eW2bT2Bs2Jh2212202962BK2M131dU2FB2JX27T1T2XA312x2le312D2ev23o2dL19152hy31023104310623o31Hr2d42k72DK2n028v2z2315z2dZ2e12122141e2r731612182X12aR2aT2162Hy31e3316X31e61331E831EA2zc2pc316429629831iL21631781031HZ2m11921q2N8101s31iq29321i31iq31il2kU2Kb2D431f031j027q191Z31et21p21P28v1n31jm2DZ1r19212217310B2w131e131gk2AU315g31gW2v831Cg2Bk162272262OB317f2r131hQ31gw31ht2Hy2FS2Fu2fW2VL311U318v31B7311l2i61L2I82ia31AL27922x1q1A1g1c2K32bS2i922y2X131DR2R22Od31eo2vG2V42TT31jG315T2Jr2X8317d293218317D2V42TQ2Ho31c91231gQ2t127v2B72Qh2Qf31hh2YB29o2222222W12V02Zn31I8102ZT2Tr2Tq31LA2K3315728v31Jx2wE2792d42fZ31aY22e21f2J11R1t2lY31ag2321B1I21w318v21V2Lk29U21521j27r1R1122k112Tg27921v2TG2FB31CH212218111q161t27K191n23i2hY31G92v128z2tP2d22Qv27921d21d2tm31lW2V22D22Md31NP31Nr31Ih2wg1x1W2Qh12313d3165122xC2tm21Z21z2Zw31mC2id31oD2fZ31bc31bE1E31bg31BI312031az1631c7319Q2TA2TC2Te2Tg21z22Z22G27922W31EA2q22211l1022l2Ys22h2211E1T1s1t3102161M1N1h2HH1q1h1B1q22i31551221U21v31nF1p1e1n1V1831Aj21v1P1K22422L121t151F2j11722K21U1C1I171H31Aj23G2PL1L1N21D21i16171r1221Q319K141J31Qk21d1J1I31921n23C2dK31nj31m02lB2WG2pi31im31nV2cD2tX2Ob2zS31DP2Kb2ui31ND28z2uN2tM31jL31Oc31GW27E2jN31ME2SN31BL31AU31Aw1122825x26623825v22525Z22e23n26r21M31Iy21v2172iH1J1231PG2j231oM22V31OO1821Y21J25626H24M24b21m25e21u26R31Kr31An31aP318s31as31rT2j231mm31Mo21w319821V1521G1j31OP1Z31gJ1022021P1O1C3143161D21i31JM1r21031QW1622f31ta27923425k22325R31l231862V131r51W2IZ2C32M42Bp1X2102pM2C3313D31U32d22m627q2c331nz31e52D22qR27b313D31E321231772R731gF31m32QZ2121y2id31O62Yb1h31Sb27Q2Q42n3318i31Ld31RO2DK1z24S22521J26523825n26D24y26b23R25W31V826524W1g25331SS31Am31ao31aQ31Sx31bn21t31sF31sH31OQ27931RS31bN2sW31T331T531t71822E31t031mP31T927931tC31tE31Tg31tI31TK31tM1j31tO2IU2gn23923731S631n331s92Lo31sc31QF23h31Tw27l31lz2vT2Ph2E11z31U02M42112KV31u431Nw2E92kW31iY31U82l131ud2BP31NZ2Pl2m431UI31O42Md31ul2B131uo31GG31GM31uR318d31uV2bW31uX2cD21a2172mt31v231rn27d31rp2WF22G23331sl24M25F22K25a26b2552iZ1023k21B23a31Af2iZ31MN31mP31Wm319931WO31SB31sd31vT2iD31sg31OP31W131T631T831tA31WA31Tf1131TH31TJ1031tl31Tn21Z31Bk31Bm31ru21S31sT31vP31sW31z71N22921o24a23231sl24C24P22531TV2TK2Vw2tn31R531jC2d22L131UA2MJ31zv31no31x62qR31xb2dZ2as2PK31U72Md31uJ31xI2zs31uN2dZ31uP31xk2Dz312b31xp27r27b31uw31uY1131xU31xW2vX31xY27931Y0311V31yh31T131Vu31op31yk31S831Sa31Wq31ze25E24b31Zi26H1m21F1y22R31yA27d25C1k23x26R31z631Sy2sW31zA31SV31ar31zd21T31yT31W321y321232141m1C24d26R31w831Tb31TD31yY31Z031WE31tn2TI31zO31i731R5312K2m431U631Zv2Qr31zv31X531u82Kx320131uF2Sn2ee31uK2Zs31XN31UP31uT31jy31re2PN29N31xR320K31V02VG320p10320r320v31SI2iU1W22r1331yg27931YI22c26M29622g27221622r26S31rz22526R24K22q221236321g31vZ21s320X31YM321021T321j31vq321M321o31YV31w9321z31Wc31z131Z331WG322431ly31zP2aq31wy2H631u531U731U431zU31zZ317D322F19322h320321729v313d32071231Ul322r31gE31GG320d31UR322p322s320j31XT212315n31xX31hF31xz2DK21f323w31Zc31sY31yp27931YR31SI31ZG321424m1622G321931YB22g24I1Z31Wl31S7323T31yO31w62it31Yw324231Yz31wD31z231wF1631Z531rR31zD31rV2iU23k24N22V237323z1831L13225318731wx2wF322831ZT322J31u42zB31x631x2322B2o031UE320331IX32292c631Xh324r2zs2ZQ320b31xM29V31Ur322R31xq1531XS31uz213324k31iU2ss2jX27E2JH2fZ31982381L1J1l31b121Z31om31mN1t1C327o31yQ31VV31OM22u1f171A22F31982hq2HS2HU22c3259321l325B31oM22621B31OP31bc319h1H210326521s323P31ru22Y2b52dn32732km2qp2M42qv2bK2f02Ez2QR2Kz31u628a27T313V28a2BK31lb31j02BK191S31p31031hW2W1310532263161326J31NZ1x27o2Mj324q2l02q61221D21f29n2qI31q42xA29321R329a2VG2r31z329J2m42M6328U2qr324D32a51623O23m1627g22422H329Y31m82W231iz23q2CD1b1r31tA31I42W131I6320e32772rG2w1329x29w31yb31IR311U328731vr31Aw321N317D327J327l327n323122E321X31yX3243322231wG21Z323S320Z31yo326C31vw1031Vy31ru23i31jv31R331ww31M132a1329K322c31x6326N31U8326P31x62Qv324l1231r81X31X2329M2qv329m31u6324Q3278320L31XV2Vg26O26O31Rq319s319u319w319Y22e31Cd2Um21N2PE1r21z22f22S31oy31P01331P231p431P631p831Pa31pC1n31pe31Pg31PI31pk31Pm31po21u23j21R2Ip21O2AN142C71922022d1v319431aW152ky101b31bh2cs1022131QB181721t23921r319422022C22e1N1222C1C22532e921V1g1H1R1p141722E1g23b2341n1G23522y22I277327t279328b31oP318M21U2r51T21q21q1B1T22K31ay22C21d31032FD1722l31n2318n1h1s2hI27p1b1U31Q41v31qJ31Th22231aY31Kt21821p31qe1l22A2111M312131qF141l1h21m2181m31pE31Ch21m2lr31qZ31951122L31AY2i0319l319N319p318M32fA2JH1l1V319532EW1023B1M31Bt21z31st22B21e171332fp111B21x131i1231Ay22B21C32EH32Ej1721s31t3319B13319D10318m32Bc325y22f318v2372kf31t71731a431A631A832CO2pm21T29r2i121z31BC22A2131r21P31qS32Gl32Hz27931CF31cH31cj32cP102222111D21721922f31AG237311Y32IH31b71J142281x2e422B21K1A32G5171d1E2ys21g31at1L1I191T1v22m318v21u2171E21z23732H132h31l32h522e31bc31B71q1b31QT1n31fC326331Vx328i32FG31B732Fj310B32h532Fn32jC32fQ1d222328231BI318v22b21o1q1r2Jo32IA319o22E318v2251y1B2I21921I32hd32eI1432Jx319921831pc1Y21e1S22I31YK2202132Xn31qj21c21732fe32Ih2212192jX1132hq2HY318x2Td319032GE31962172Fq1022b21M141O1p1D1l32GF21o21f151d1S1621r321K192Db21Z31wi26726723732gZ2qR2iR21D21j1d1P1g22e32Fg32km31NB1m21331mW31z21122n23631Mt1822G31oM2381t29U32mY327u31Op32fG235142og21M2TY31by1H32gP32GR326231AY22R2hh32DT2j12hm317D22F21q327Z2fp21w31Om22F21E2k322f31aY21w1X31fC31Nc1m222328721r32KS32ej32m831tA22D21231pf21N2131u28F319J32gK32Kj32MZ1D191l32JP2DK31AO1821g32ki319p32fg32h01O31E832G11i31C92N7319V1g32jw31Ay2hm31Qu32gr32k831st22621n1o327Y1n1W21f1F191222e21P31Ic1023631qo21D32g832ga1N21M2B41K22a31St32kK1r2bu1K1D21L32oC2J231YK22S1C22022b1M317831Nf21T22b22o32CX2tD32cz31p331p51M31p731p931Pb31pD31Pf31PH31na32Da31Pn318R21u23H21F1O1Q1c2nE1T22f22y21P181S2bT31hL2HU22032DZ32e123H21p32J4131N22f22Z21121w32E923C2an1B21T32E923521g111R22232E92371y31QY32Ed1223821I32JC21V319832Bn2j231St2I032Pv21m21O31ca22n31aY21x2171f31Kp32Lf32f01z31gE21h31tn23D1c21e328232G91H31Qo22l31YK23b31qD32Fi31C71E1H32gy31AM32FA327r32oi319m32KJ32IX27932gO32on32NF22c22c1r227234321m32bb325X3221326031z421D27o22N1o238319822R32g332G531Aa1021S22s1Y22V1w236317Q32bm21r31Qn1q171W32OU22e2142fF32NZ13171k1P1O21J31s91L213216312O1H1831xu32On329q1J31PL32HG32ih22d1H2191422N11318m238311332842hV32hB2132I51032JN22F31Om22B21I32G421Z318m2242112nO31pB328532Ih22831c532um21s318m319h1a122i4161B32FS2sN320Y32Pk29N32No31jv2262172ay1O1t1P31n81j31PT2j232Po27921Y21B327z1Y21b31mY1732uz31Du31C132Wz2ie2Ig32WL1g152j132Mi32P521S31ag2341s1U21t31yk32Sf21h32L022i31a131a331a531A7319p32ih22c32Sv32dt31ak31am32H032H232H432h6131h1132Ih2IB32Xi2Ib2iD23831Qn32MK31ay22v182iG122Ne22e32t732Ws32Ux32ya2Q722e32UI21v21i2PE1n31pL2tF31C71N1j22a31om22Q310b13318U2HY21V31QW31QY319322a23721032g922C32IH22T310331HL32Xp31iy22p1K32S1319X32CS32nM2Hp32Eg32KT21z318V32Y12e11B32I932oJ319p32bK32iH32MN31PE32pN32pp32pd32PF31CH1X21I32p41b32hy32ih22B21N32s132ng2sn22i2my1f1B1c1M21S32y021d31G61u32wa29v31222kR32Ya1C22m31Bc23132yp1D1F1V1u31QY31mK31st32Z81831O71H32pi32VA1Q21Z1921m32Ql31P132qo32D232qS32d532D732Qw31Pj31Pl32Qz31pp22H327l2qa2891T23d21f1l2kT32DW32dY31c732E123d1q23J31Za21l1k21e21I2kA31a4191K31z931am31A232OG32VJ32lD31q71n21z32IH22U32j31V1m31a029V31yI2Q631pC1122221E27W21u235328E319I32up32Ip31aI32Y4279328f32X831C031Pf1B32Gh2sn22p1F1q1t27t1422m321x21U32sv1O32tc1m13310b22432tU2hj32gM29v31b7314A3314328J2sn31mG31mi32Hl31982321R330I31ax2Sn31b71I1331b432uI32jg327Z31kZ19331r31pl32kV320y31p332yB32nX334y31B131sB31B432xb328f21c32o01G32WG1a31q632W932XV1Q1Y32Mh32MJ32yr31iy31cf31Oo31Q41p32dr32uA27925c2441K2Hb29v23932D72yT2I622a32Ih32nz31c9318t31Om32Gv1J1S22L327W1f32cN32uI22R27b330N21M2191N1l1s334I32Ic2Hz32Ya1m1p3197317d32Nz171g1R1q32xk2iz32f11n223328E32l021m333p2iz22X17331t318M22u3191319332GF22l32UI32iJ32Ul32uN32UP32iH23431SB310B22n336K151j1h22b2j42682671c32ih327J31KP22e1w2lS32Pr1R32Pt32g931FC32PW32Gd337U319631aG22t334d32yz2pM21y31yU31W432ui2391r32K51r31B21N2172e332L131t31Y32Z532Z731Ag22C2bb311Z2ID32sP334V22M318M32X132dr2142141M1R22j32sU32we339732wE22G31bc32x1319Y21I31qS31Qu21t318M2I0332u2hU332X21o2x123B1531mJ32g633Ae151p1i32J42yS32M827E25c2431J32Mc31aM32u731qX2xC31PF32ju323v31AM23431Q433972J1339A1I32l132sH2I12J12bW2ne2HK32wI325D31b131B31o21X31aG21Y191p22t33AE33BI31B22yS2L4311M31kO2I9335X27921T2cV31Pe31j51T32wH321x339Q1o31qf2IR1y32Sq32ss31bR2pM22C2122FD1522N31982202151F29u1933641025C24K2103369279336B31PF31Th32ON330f33bT1n32nJ1b2J132gf31MK31Ag22a32R322i2J421222u237338K311j1H2172171S1q319L1521n21I1d32h533431T32K833dk31Az31b133Dn33DP33DR33dt33DV31Pl31hL32k8319822P2k431A732Ct31Om22c31dY32zC31aY22321A1S32G732yq31B631B131pG31pa32Ub319821Z3137182DB3281317D21u32mR31MY22L31Bc2IF31A8331O31Tg1o32k9317D31B72J132eA31om33491F1522g31Ay2TB2Td2tf32td31Yk32NI31hl1Q1131a431Fm31982361j33Cq1B1222M33bs1032z8336z1532wD32g531N132X531cg21z32xB21U21c1R181F21p32oc181o21121f33dY21Y31YK33C2319432dO33gb22F32fG327x319y1633fJ29U31432Na334R32ZS32Tm32y21b2Pp2jx22k32ui2311c1a1E21M21433Ah1t33bY2IA325U33CN32vG31rT22j31om32VE32Vg32jE2HY33f71633f932J3151V1J22E32se31Qw32Z2331t32xb32Z81b1A111n330K33AB332W332y27931zB328831Vs31yk32f132f621R31Bw31b233c01022E2fB32uP31yK32fU32sL331f32lf31OM335B32bg31IY32Hc31QF32dt21532xt318v31a232lt141E33A5319L33a731ag22121m21E23631YK33JP21M21321521H1t1q15338Y32Cq32Om31CB31Yk32tn32gQ319532hg32FG31a21T33D122c334h31bN1s31C631W431bC33h132JV1Q2I931A733cm317d32U72Ig141R32zA2T82SN32tG338F336x22331om337o33HE31OM32W7336z22J333j323822l33371A27k319D31MF31Mh1n31mj2lY32fg33G71S33G92hk32yB21J32I71t31WG32pm31Ag32ym1b22F31yk31Br1d1721K1z31p332Lf31yk22a21n32W321f21h32EI31N42rG33hH28F21x21U1R22h22F1U29u2202lS191a31aY319T32P432jW31OH31Bf31bH32Vn22C33ID21j331O33971Z21f32Ll32gg32Bh31wp31yO31Ay33dD2cM317031cb31ST33gh319l1a32c6337z21s31OM33hH33l932FT1732E02781222k32IH33kt2JY32I42dK21T2112jY1722622Q32SV333b33G533k732Nf32TI32Ib318V33eW31C733A533IK332x338231o7337P32o93121336U1D337l171o1N1d32M01532G521M22m27R2CN31xl1z21u22p2m426F25i2D432C6141X26P25S27g21D21e31F132x72My31GZ28f31qN31J027g2KY32pP31Y031L32r71p1b21222E23428V25y27031gK33p933pb2D233pd27G324d21D1C21P27g2191M31d02bd21b2fb32As33qa33pc25i33qE31u61X1C21933PL21g31xw27G31NT29333qO2o133q121222K23E2Kb27721j21p319O2BQ2Mq31HC29628D31Md27D2pB31Hf27T28a27731F827731RL328o31I72vL318a2dZ31L5122fw31O621M1N21931uL22p31Ob32712121o312531uR1X2Sn312f33En312h2r924G23q2r72L421223t24v2r731jR21225G26a2R7312y23q24g33Q033Q21j21H2R71U317n25l26n2R71V1D21224P23z2r71s1e2121F2wo1i1T1F21226L25N2r7121g21223s24u2r732YA21225724D2r72Dz2122502422R72CS21226r25X2R7161k2121P21r2R731A521224Z2452r7141M312z1i31Bg21225o26I2r71A1O21222d2372r71b32wU33sv2r7181q212332r2R7191R21225924b2R71e1s21226G25q2r71F1t212112F11i1c1u21224O23y2r71D1V21224H23r2r721E1W21225k26M2R721F2l024I31Hr2dZ21C1y2121e2142R721D2pk22c2362r721i21021221c32G12DZ21j2112122412532R721g2Ki23o24I2R721h21321222j23h2r733hl21221H2Ls1I21N21521221k1U2R721k216325221a2R721L21721222a2382R721q21821222G23i2R721R21921224Q2Dv2dZ21O21a21225624c2r721p21b21225n26L2r71y21c21226925j2r71Z21d21221M31JA1w21e212332F2R71x21F31UM31iY1I21233x526H25r2ae27P27b22623E21G31uL26825i31Xl212324t312B33zk31792kN23031lx317E2r92r533Sn2l522X22733SS31Js23B22933SX31Ho312e33r722Y22433t5317n1t31DY2dz33TB21223X24r33tG33TI26Q25w2r733Tn21223H22j33ts33Tu23J22h33ty1H21222123333U333za23331gR2DZ33U925324133Ud33UF25q26g33uj1L21224d25733uo33uQ2712632R733Ut33cp33ux33UZ25f26D33v332Wu26m25K33v733v92392UO2dZ33VD21232Ke33Vi33vK1V27z2DZ33Vp21226X2672R733VV21225a24833w033w227026233w633w824424Y33WC2L022T31Df33wh33WJ25d26f33WN2pK27226033WS33WU26D25F2R733Wz21222I23g33x42KI22522z33x933xb25E26C33xf21421223m24K2r733XL21226f25d33XQ33xS23r24H33Xv33xX22O21y33y133y324R23X33y733Y926K25m2r733Ye21225C26e33yj33yL152A31I33YQ21221p2fF1I33yW317b317D1I33Z133v033v22dZ33z6212315b2R733zb2122422502YX33zh33zJ31uL21E2D1324u21224724x31jY23n24l33zT21225I26833SJ2121A2Jf31EN22s21U340421224S23u340821221l2Xq1I33R722L23F340e21224j23p33TA33Tc26N25L340N21226i25O340r33TO23622C340w21223a228341021222W226341533DH2u52Nm1j21231qk341D21223D2He2Dz33Uk223231341m2121921b341q1N21224925B341t21223l24N341x21224W246342121223E22K33Vc33ve23p24J342921227326133Vo33vq220232342I33Vw24Y244342N21226p25Z342R21226J25P342V212142Dy1I33wI21224u23S343321226Z265343721224A258343B33X024M23K343g31gH31tA1i33xA21221W22Q343O2123435343T33xm21n2Y41I33XR21222622w34422122342Tq2Dz33y22121q2tC2DZ33y8212231223344E33yF24l23N344J21223722D33yp33yR26c25e33Yv33Yx23U24s2R7344X26E25C33z533Z731IB345433X521X22r2AE329T33zI33ZK2zS22M23c33zo26y26431jy26A25g345M232220345Q1I31EG31eN21v22T345x23Y24o34611l31em33r7162FL1I33t621221S22U346d21222Z225346h21u32CW2Dz340S22H23J346P132872dZ33tZ23I31ox2dZ33u4318d34702121G21I347431m2341H21224825A347C25B249347G21225m26K347L31kA2DZ33V421224k23m347T33yz347x21224t23v348122N23D348521223f22L348931US2Id33AN33W225824a348H32fb348L23K24m2R7348q324W33WO21226V25t348y21j2rg314033X0240252349622q21W343k21226w266349E24B259349h21226b25h343y21222923b349Q21R2B51i349v24524Z344a21221Y32Qk33yd33yf22722X34A823822a34AC21222422Y34aG21225r26H34ak33z223G22i34Ao21224624w34AR2122512432Bh32dJ1234aX31Ul25524F33zo22b23931JY23w24Q345m1M2Ur27P2bw33ZH2201631iL24T33vZ32711Z1b33Wm33qQ2492562m425B24E328u2mD1X24g23L2Kz34gQ23s24p27t313d1x23w24T2JH313D33PU32dr26T33q81022k22L33p62bD23a34HB34Gf31gc31jd1431rL1x25G26d33PF2qV31J031i127226V2p332br27B31Ej31ih21222R2uC31GA316w34gH2m421n1Q31712QV1X26H25k34I832h831gF33qr33qC33Pe33Ph31x221d26F25y2D433qK33QM27l26534hT33Qq25C26b33zt34gg34gi1X2482552Bk32mG34GB33SO1U21k312u192uF2Tz2bk1U1n327b2KC31rJ33Pr31rL2Qz1z34IV34IX34i42d234J134J321j34j52l532703293161u32gW33pR34Ji27R27G34jk2Kg1z34hH2dz317a25224031281531NT34jl34JP31x733qz152R834ch34cj31eu31yz2L2328q34Kh2kx34Js34Ju342731G134Jx31LB34IA25K32A831U434L21b21634ku31QN2JW1822122328O27g34Jx21u2221832A034jN33ZX34Iy2m434J12By31QL2L233ST22223031F61734je34jg2bk34k231gW31FA1x1a32L91734j431QY31jS25j26934612NB33T121222F23534Lv111a2mB25224727t34lq31Hn21226S25u31H62Jr33if1X34MM2jH34mp33R731Ju34J934Mj2mb2442512jN21D21k1934BQ317n23C22m27a31a721s21V2iz315k1a21U2271d1x34n634n821l34LI34BR25P26J34nG1d21s21w31UU2Jm34nm34nO34nQ34n71A21D34nT34Nc21224e25434Ny21s21X2yU34o334Nn34NP34NR34O834oA34bR22823a34Of21y31lH34Oj34o534Om34O934nU317N31Ij34OF21z31it322Z34O434Ol34O734oY34OB23522F34Of2202L834P534oK34O634NS34Oz21221q32LO1234NH22131iy34NL34PH24O23t34PJ34ob26t25v34bv34d529S1c1E21S2222zK34oj2241E34PI34ON34PK22v319e29s34nh22331AM34PS34nO31l72Jx2jn22722231FP31HR2Jn324k29V2LO2lQ2lS"),(l);local function f(l,e,...)if(l==624668713)then return(c(c((e)-88281,695128),159530));elseif(l==943410444)then return(c((((e)-660769)-138342)-111812,563066));elseif(l==129429735)then return(c((c((c(e,918371))-729871,381200))-467374,28833));elseif(l==238876994)then return(c(c((((e)-461197)-933964)-312356,431530),284755));elseif(l==788705881)then return((c((e)-533499,350878))-460238);elseif(l==30439382)then return((c(((e)-276202)-372873,654136))-365768);elseif(l==770772357)then return(c(c((c(c(e,824232),286853))-824164,856053),975518));elseif(l==207316977)then return((c(((e)-422905)-466552,526520))-463335);elseif(l==534449524)then return(c(c(c((e)-732939,767306),823941),843831));elseif(l==93183589)then return(((c(((e)-795941)-661950,13256))-129588)-225983);elseif(l==352607114)then return((c(c(e,590497),923649))-972955);elseif(l==373578439)then return(c((c(c(e,66429),501285))-794548,108390));elseif(l==561673916)then return(c(c(((e)-751279)-774897,188366),292236));end;end;local function l(l,e,...)if(l==279696867)then return((((e)-262927)-617954)-674429);elseif(l==154843438)then return(c(c((e)-332632,529435),641616));elseif(l==93029083)then return(((c((e)-131005,143602))-497793)-344979);elseif(l==107417078)then return((c((e)-737785,165320))-693365);elseif(l==412312370)then return((c(c((c(e,991790))-696487,821238),836914))-211589);elseif(l==615432392)then return(((c(e,241909))-145901)-262926);elseif(l==597871686)then return(((c((e)-520587,224347))-869935)-742252);elseif(l==938691696)then return(c(c(((e)-751654)-37481,915924),583955));elseif(l==379885382)then return((c(c(e,688210),419644))-12487);elseif(l==27616570)then return((c(((e)-159240)-781615,979664))-125454);elseif(l==659417215)then return((c((c((e)-866011,895421))-528291,638003))-833886);elseif(l==46602486)then return(((c(((e)-851086)-641618,669383))-104561)-645938);elseif(l==646886659)then return(c(c(((e)-50233)-328146,440247),885221));elseif(l==793582037)then return((c(c(e,102488),792392))-240411);else end;end;local a=r[(592409556)];local x=r['bPj5D'];local O=r['xTwz0aQGH3'];local h=r["TvynTFSzm"];local o=r['AfIDbE'];local C=r[((434486313-#("whats with all the dots")))];local l=r["bOJFPz"];local B=r['Eh9UY2Pc1O'];local A=r[((357593004-#("loadstring")))];local function i()local i,o,r,t=F(E,n,n+h);i=c(i,e);e=i%l;o=c(o,e);e=o%l;r=c(r,e);e=r%l;t=c(t,e);e=t%l;n=n+x;return((t*O)+(r*a)+(o*l)+i);end;local function a()local t=c(F(E,n,n),e);e=t%l;n=(n+o);return(t);end;local function x()local t,o=F(E,n,n+C);t=c(t,e);e=t%l;o=c(o,e);e=o%l;n=n+C;return((o*l)+t);end;local function h(n,e,l)if(l)then local e=(n/C^(e-o))%C^((l-o)-(e-o)+o);return(e-(e%o));else local e=C^(e-o);return(((n%(e+e)>=e)and(o))or(B));end;end;local S=""..r[A];local function C(...)return({...}),q(S,...);end;local function M(...)local q=r.MGUbnITtH;local g=r[((#{454;669;}+968801333))];local m=r['Dgi1t09'];local P=r[(63076249)];local o=r["Eh9UY2Pc1O"];local Y=r[((83024172-#("discord.gg/WSK5qAC4Qx")))];local j=r['S3rWuQuhNj'];local N=r[(376321374)];local G=r.JCI9WjJ;local M=r[((356067367-#("chimken")))];local T=r.TvynTFSzm;local B=r[(434486290)];local v=r[(34228274)];local S=r["bPj5D"];local L=r.XsLGFDGo;local l=r['AfIDbE'];local W=r[((30295424-#("stop using the bot in #scripts")))];local Z=r[((#{424;919;(function(...)return 515,475,...;end)(834,99,97)}+20789801))];local w=r[((#{566;856;913;}+627077108))];local C=r[(671383977)];local _=r['z2GcZ0hrO'];local A=r[(50044429)];local u=r['bOJFPz'];local V=r[((277543534-#("PSU DEOBFUSCATOR 2021 ONE DOT 2 DOT")))];local o1=r[(371165885)];local e1=r[(158161575)];local t1=r[(439712314)];local X=r[(814975485)];local O=r['a04k8N'];local function k(...)local r=({});local f=({});local p=({});local K=a(e);local Q=x(e);for e=o,i(e)-l,l do p[e]=t(k);end;for d=o,t(i,e)-l,l do local f=a(e);if(f==e1)then local e=a(e);r[d]=(e~=o);elseif(s(f,v))then while(true)do local e=t(i,e);r[d]=D(E,n,U(R(n,e),l));n=n+e;break;end;elseif(f==Z)then while(true)do local c=t(i,e);local n=i(e);local i=l;local c=(h(n,l,m)*(y(B,C)))+c;local e=t(h,n,L,V);local n=(y((-l),h(n,C)));if(e==o)then if(s(c,o))then r[d]=(n*o);break;else e=l;i=o;end;elseif(e==G)then r[d]=(s(c,o))and(z(n,(b(l,o))))or(n*(b(o,o)));break;end;r[d]=z(J(n,e-o1),(i+(b(c,(B^P)))));break;end;elseif(f==Y)then while(true)do local i=i(e);if(s(i,o))then r[d]=('');break;end;if(n1(i,t1))then local o,a=(''),(D(E,n,R(n,i)-l));n=n+i;for l=l,#a,l do local l=t(c,t(F,D(a,l,l)),e);e=l%u;o=o..I[l];end;r[d]=o;else local l,o=(''),({F(E,n,U(n+i,l))});n=R(n,i);for o,n in t(H,o)do local n=c(n,e);e=l1(n,u);l=l..I[n];end;r[d]=l;end;break;end;else r[d]=nil end;end;local n=i(e);for e=o,n-l,l do f[e]=({});end;for I=o,n-l,l do local n=a(e);if(n~=o)then n=n-l;local d,C,u,c,E,F=o,o,o,o,o,o;local D=h(n,l,T);if(s(D,l))then c=(x(e));C=(t(a,e));d=(t(i,e));elseif(s(D,B))then c=(x(e));C=(a(e));d=f[(i(e))];elseif(s(D,o))then u=(x(e));c=(x(e));C=(a(e));d=(x(e));elseif(D==A)then u=(x(e));c=(x(e));C=(a(e));d=(i(e));E=({});for n=l,u,l do E[n]=({[o]=a(e),[l]=t(x,e)});end;elseif(D==T)then u=(x(e));c=(x(e));C=(t(a,e));d=f[(i(e))];elseif(D==g)then end;if(s(h(n,g,g),l))then u=r[u];end;if(t(h,n,A,A)==l)then d=r[d];end;if(h(n,O,O)==l)then F=f[t(i,e)];else F=f[I+l];end;if(h(n,S,S)==l)then c=r[c];end;if(t(h,n,w,w)==l)then E=({});for e=l,a(),l do E[e]=i();end;end;local e=f[I];e[j]=E;e[-_]=C;e[X]=F;e[-q]=u;e[M]=c;e["s01sBM"]=d;end;end;return({['U1bDDNbY0o']=K;["Dovh"]=r;[-N]=f;[-W]=p;[817884.3333283832]=o;["JrO"]=Q;});end;return(k(...));end;local function I(e,E,s,...)local i=e['U1bDDNbY0o'];local l=0;local n=e[-214025];local h=e['JrO'];local o=e['Dovh'];local b=e[-915143];return(function(...)local O=(q(S,...)-1);local p=-902585;local t='s01sBM';local B={};local a=-59301;local e=(true);local D=n[l];local k=47439;local e=(146738122);local x=-(1);local n=159263;local l={};local A={...};local o=242887;local F=({});for e=0,O,1 do if(e>=i)then B[e-i]=A[e+1];else l[e]=A[e+1];end;end;local A=O-i+1;while(true)do local e=D;local i=e[p];D=e[o];if(i<=f(c(987354151,366700158),688993))then if(i<=f(30439382,1464151))then if(i<=f(c(909874007,r[485363214]),1878969))then if(i<=((d[487721572])or(r[976309305](c(981242853,r[485363214]),c,d,487721572))))then if(i<=1)then if(i==f(207316977,1878992))then l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];e=e[o];elseif(i<=f(c(887981936,299251545),675148))then local n=e[n];l[n]=l[n](u(l,n+1,e[t]));for e=n+1,h do l[e]=nil;end;end;elseif(i<=f(c(39565738,r[485363214]),1473987))then l[e[n]]=l[e[t]]+e[a];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]]=l[e[t]][l[e[a]]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]]=l[e[t]][l[e[a]]];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]]=l[e[t]][l[e[a]]];e=e[o];l[e[n]]=l[e[t]];e=e[o];local r=e[t];local t=l[r];for e=r+1,e[a]do t=t..l[e];end;l[e[n]]=t;e=e[o];e=e[o];elseif(i==3)then local t=e[t];local o=l[t];for e=t+1,e[a]do o=o..l[e];end;l[e[n]]=o;elseif(i<=f(c(485418094,166379492),c(858530672,858120527)))then l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=s[e[t]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]][e[t]]=l[e[a]];e=e[o];e=e[o];end;elseif(i<=f(c(795127596,r[485363214]),639489))then if(i==f(c(573725122,666863527),1809939))then l[e[n]]=l[e[t]]/e[a];elseif(i<=((d[114035465])or(r[340920146](c(311840315,312381723),c,d,114035465))))then if(l[e[n]]>=l[e[a]])then D=e[t];end;end;elseif(i<=c(724693692,724693691))then l[e[n]]=l[e[t]]-l[e[a]];e=e[o];l[e[n]]=l[e[t]]/e[a];e=e[o];l[e[n]]=l[e[t]]*e[a];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];e=e[o];elseif(i==f(c(413413033,352274776),1878984))then do return;end;elseif(i<=9)then if(not(l[e[n]]))then D=e[t];end;end;elseif(i<=f(c(855178145,r[238608161]),1809836))then if(i<=((d[193941680])or(r[877729559](c(929634072,r[238608161]),c,d,193941680))))then if(i==10)then l[e[n]]=s[e[t]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=s[e[t]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]][e[t]]=e[a];e=e[o];e=e[o];elseif(i<=((d[286803047])or((function(e)d[286803047]=(c((c(c(e,805501),437549))-501935,287751))-656569;return(d[286803047]);end)(c(131570857,130773643)))))then local o=e[n];local r=e[a];local n=o+2;local o=({l[o](l[o+1],l[n]);});for e=1,r do l[n+e]=o[e];end;local o=o[1];if(o)then l[n]=o;D=e[t];end;end;elseif(i<=c(233384829,233384817))then l[e[n]]=(e[t]~=0);elseif(i==f(373578439,746055))then l[e[n]]=s[e[t]];e=e[o];l[e[n]]=s[e[t]];e=e[o];local r=e[n];local c=l[e[t]];l[r+1]=c;l[r]=c[e[a]];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];local i,c=C(l[r](u(l,r+1,e[t])));x=c+r-1;local c=0;for e=r,x do c=c+1;l[e]=i[c];end;e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,x));for e=r+1,x do l[e]=nil;end;e=e[o];local r=e[n];l[r]=l[r]();e=e[o];local r=e[n];local c=l[e[t]];l[r+1]=c;l[r]=c[e[a]];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];local r=e[n];local c=l[e[t]];l[r+1]=c;l[r]=c[e[a]];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];local c=e[n];local r=l[e[t]];l[c+1]=r;l[c]=r[e[a]];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];local c=e[n];local r=l[e[t]];l[c+1]=r;l[c]=r[e[a]];e=e[o];l[e[n]]=e[t];e=e[o];e=e[o];elseif(i<=f(c(358762239,r[485363214]),688957))then local n=e[n];l[n]=l[n](l[n+1]);for e=n+1,h do l[e]=nil;end;e=e[o];e=e[o];end;elseif(i<=c(145849106,145849091))then if(i<=f(c(139540259,690700703),c(118429722,r[819641756])))then l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=s[e[t]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]][e[t]]=l[e[a]];e=e[o];e=e[o];elseif(i>16)then s[e[t]]=l[e[n]];elseif(i<((d[360774799])or((function(e)d[360774799]=c(c((c(e,528168))-368638,255120),257269);return(d[360774799]);end)(c(602543531,r[683152980])))))then local r=e[n];local c=l[e[t]];l[r+1]=c;l[r]=c[e[a]];e=e[o];local r=e[n];l[r](l[r+1]);for e=r,h do l[e]=nil;end;e=e[o];l[e[n]]=E[e[t]];e=e[o];local c=e[n];local r=l[e[t]];l[c+1]=r;l[c]=r[e[a]];e=e[o];l[e[n]]=s[e[t]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];local r=e[n];local c,t=C(l[r]());x=t+r-1;local t=0;for e=r,x do t=t+1;l[e]=c[t];end;for e=x+1,h do l[e]=nil;end;e=e[o];local n=e[n];l[n](u(l,n+1,x));for e=n+1,x do l[e]=nil;end;e=e[o];e=e[o];end;elseif(i<=f(c(415020860,230223030),c(754742044,754299153)))then l[e[n]]=#l[e[t]];elseif(i>c(664828094,664828077))then l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=s[e[t]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]][e[t]]=l[e[a]];e=e[o];e=e[o];elseif(i<f(c(386682701,r[88117477]),c(931112627,r[238608161])))then if(e[n]>=l[e[a]])then D=e[t];end;end;elseif(i<=((d[354474261])or((function(e)d[354474261]=(((e)-568243)-199002)-764021;return(d[354474261]);end)(c(376932230,r[42976685])))))then if(i<=f(c(556891907,r[238608161]),746091))then if(i<=c(940506370,r[88117477]))then if(i>f(c(836334766,618475300),639504))then l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=s[e[t]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]][e[t]]=l[e[a]];e=e[o];e=e[o];elseif(i<((d[707958461])or((function(e)d[707958461]=c((c(((e)-34081)-284875,800876))-822388,517421);return(d[707958461]);end)(c(981324553,r[485363214])))))then local r=e[n];local t={};for e=1,#F,1 do local e=F[e];for n=0,#e,1 do local n=e[n];local o=n[1];local e=n[2];if((o==l)and(e>=r))then t[e]=o[e];n[1]=t;end;end;end;end;elseif(i<=((d[295489653])or((function(e)d[295489653]=(c(c((e)-204023,65634),15715))-287603;return(d[295489653]);end)(c(602917235,r[683152980])))))then l[e[n]]=g(e[t]);e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];e=e[o];elseif(i==24)then local e=e[n];l[e]=l[e](l[e+1]);for e=e+1,h do l[e]=nil;end;elseif(i<=f(129429735,222694))then local e=e[n];x=e+A-1;for n=0,A do l[e+n]=B[n];end;for e=x+1,h do l[e]=nil;end;end;elseif(i<=((d[610292248])or((function(e)d[610292248]=c(c(c(c(e,605710),800938),353416),96033);return(d[610292248]);end)(c(286071307,286002970)))))then if(i<=((d[458028392])or(r.vlnkOffN49(c(394913959,395213215),c,d,458028392))))then l[e[n]]=l[e[t]]*e[a];elseif(i>((d[751949352])or((function(e)d[751949352]=((c((e)-881279,295909))-60969)-35037;return(d[751949352]);end)(c(100958616,102229723)))))then l[e[n]]=E[e[t]];e=e[o];l[e[n]]=E[e[t]];e=e[o];local r=e[n];do return l[r](u(l,r+1,e[t]))end;e=e[o];local n=e[n];do return u(l,n,x);end;e=e[o];e=e[o];elseif(i<f(c(252981718,r['YOOCP7']),1602550))then local e=e[n];local o,n=C(l[e]());x=n+e-1;local n=0;for e=e,x do n=n+1;l[e]=o[n];end;for e=x+1,h do l[e]=nil;end;end;elseif(i<=((d[773354793])or(r[857348790](c(651257434,652189234),c,d,773354793))))then local n=e[n];local t={l[n](l[n+1]);};local o=e[a];local e=0;for n=n,o do e=e+1;l[n]=t[e];end;for e=o+1,h do l[e]=nil;end;elseif(i==c(602387183,r[683152980]))then local n=e[n];local o,e=C(l[n](u(l,n+1,e[t])));x=e+n-1;local e=0;for n=n,x do e=e+1;l[n]=o[e];end;elseif(i<=((d[104584564])or((function(e)d[104584564]=((((c(e,26303))-820409)-250720)-879973)-922116;return(d[104584564]);end)(c(941968394,r[88117477])))))then l[e[n]]=s[e[t]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=#l[e[t]];e=e[o];l[e[n]]=e[t];e=e[o];e=e[o];end;elseif(i<=f(352607114,639519))then if(i<=f(c(378306374,289050529),c(313248571,r[577113617])))then if(i>((d[670892664])or(r[974203428](c(537601275,537190460),c,d,670892664))))then l[e[n]]=l[e[t]][e[a]];elseif(i<((d[270158136])or(r[62609561](c(809463776,r[699740427]),c,d,270158136))))then l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=g(256);e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];e=e[o];end;elseif(i<=34)then l[e[n]]=e[t]+l[e[a]];elseif(i>f(238876994,1891287))then l[e[n]]=(e[t]~=0);elseif(i<((d[125120330])or(r[475305370](c(159169800,157916387),c,d,125120330))))then l[e[n]]=s[e[t]];end;elseif(i<=f(c(892862212,990578246),c(27089610,25264401)))then if(i<=c(477767486,r[932702111]))then local e=e[n];do return u(l,e,x);end;elseif(i>((d[926086670])or((function(e)d[926086670]=c(((((e)-70532)-324370)-891086)-95501,428344);return(d[926086670]);end)(c(313734042,r[577113617])))))then l[e[n]]=g(256);elseif(i<c(602387158,r[683152980]))then l[e[n]]=e[t];end;elseif(i<=((d[571535416])or((function(e)d[571535416]=c((c(c(e,979018),11128))-753526,894953);return(d[571535416]);end)(c(430824219,r.gqFOH)))))then l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=g(256);e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];e=e[o];elseif(i==f(c(80541234,144150979),1879321))then l[e[n]]=l[e[t]]-l[e[a]];elseif(i<=c(815033627,815033649))then D=e[t];end;elseif(i<=64)then if(i<=f(c(755672734,r[88117477]),c(732017121,732459921)))then if(i<=f(c(338618212,328734595),c(237960918,237869966)))then if(i<=f(c(212718389,598696300),688991))then if(i>43)then l[e[n]]=l[e[t]]%e[a];elseif(i<f(c(201160232,620741745),688991))then l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=s[e[t]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]][e[t]]=l[e[a]];e=e[o];e=e[o];end;elseif(i<=45)then l[e[n]][e[t]]=e[a];elseif(i==46)then l[e[n]][e[t]]=l[e[a]];elseif(i<=c(325932322,325932301))then local n=e[n];l[n]=0+(l[n]);l[n+1]=0+(l[n+1]);l[n+2]=0+(l[n+2]);local o=l[n];local r=l[n+2];if(r>0)then if(o>l[n+1])then D=e[t];else l[n+3]=o;end;elseif(o<l[n+1])then D=e[t];else l[n+3]=o;end;end;elseif(i<=c(940506406,r[88117477]))then if(i<=c(365054635,365054619))then do return l[e[n]]();end;elseif(i>f(c(882992788,r['YOOCP7']),746067))then do return(l[e[n]]);end;elseif(i<c(451481141,r[661011215]))then local o=e[n];local n=l[e[t]];l[o+1]=n;l[o]=n[e[a]];end;elseif(i<=f(c(210360327,596339294),c(674445336,674871426)))then l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];e=e[o];elseif(i>((d[365439321])or(r[855865638](c(377085313,r[42976685]),c,d,365439321))))then l[e[n]]=s[e[t]];e=e[o];local r=e[n];local c=l[e[t]];l[r+1]=c;l[r]=c[e[a]];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];local c,t=C(l[r](u(l,r+1,e[t])));x=t+r-1;local t=0;for e=r,x do t=t+1;l[e]=c[t];end;e=e[o];local t=e[n];l[t]=l[t](u(l,t+1,x));for e=t+1,x do l[e]=nil;end;e=e[o];l[e[n]]();e=e[o];e=e[o];elseif(i<f(c(113035291,182956010),1879317))then if(l[e[n]])then D=e[t];end;end;elseif(i<=c(806770999,r[699740427]))then if(i<=c(294974354,294974373))then if(i>54)then l[e[n]]=l[e[t]];elseif(i<55)then l[e[n]]=l[e[t]]+l[e[a]];end;elseif(i<=56)then do return(l[e[n]]);end;e=e[o];e=e[o];elseif(i==c(530338347,530338322))then elseif(i<=58)then l[e[n]]=g(e[t]);end;elseif(i<=f(c(526700642,r[661011215]),c(246550501,245994046)))then if(i<=((d[51151728])or(r[957149525](c(721631405,r[589414702]),c,d,51151728))))then local t=e[n];l[t]=l[t](l[t+1]);for e=t+1,h do l[e]=nil;end;e=e[o];do return(l[e[n]]);end;e=e[o];e=e[o];elseif(i==((d[577917675])or(r['UhxZE'](c(452312144,r[661011215]),c,d,577917675))))then l[e[n]]=s[e[t]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=#l[e[t]];e=e[o];l[e[n]]=e[t];e=e[o];e=e[o];elseif(i<=((d[968220017])or(r[932693579](c(214239874,215563168),c,d,968220017))))then l[e[n]]();end;elseif(i<=f(c(624377723,r[589414702]),c(386183872,r[670880911])))then local r=e[n];l[r]=l[r]();e=e[o];l[e[n]]=(e[t]~=0);e=e[o];local r=e[n];local c,t=C(l[r](u(l,r+1,e[t])));x=t+r-1;local t=0;for e=r,x do t=t+1;l[e]=c[t];end;e=e[o];local t=e[n];l[t]=l[t](u(l,t+1,x));for e=t+1,x do l[e]=nil;end;e=e[o];do return l[e[n]]();end;e=e[o];local n=e[n];do return u(l,n,x);end;e=e[o];e=e[o];elseif(i>f(788705881,688270))then l[e[n]]=I(b[e[t]],(nil),s);elseif(i<64)then l[e[n]]=l[e[t]]-e[a];end;elseif(i<=f(c(549586217,748249816),c(929663295,r[238608161])))then if(i<=f(c(397454833,r[42976685]),1463720))then if(i<=f(c(253512867,425203300),c(931022404,r[238608161])))then if(i>c(175217607,r[901389847]))then local n=e[n];l[n](u(l,n+1,e[t]));for e=n+1,h do l[e]=nil;end;elseif(i<f(c(43988370,r[819641756]),c(34644641,r[853435126])))then local n=e[n];local r=l[n+2];local o=l[n]+r;l[n]=o;if(r>0)then if(o<=l[n+1])then D=e[t];l[n+3]=o;end;elseif(o>=l[n+1])then D=e[t];l[n+3]=o;end;end;elseif(i<=((d[44203199])or(r[984662460](c(631053471,r.xMNRn),c,d,44203199))))then l[e[n]][l[e[t]]]=l[e[a]];elseif(i>c(656707502,r[765816747]))then local e=e[n];l[e]=l[e]();elseif(i<69)then l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=s[e[t]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]][e[t]]=l[e[a]];e=e[o];e=e[o];end;elseif(i<=f(561673916,1962922))then if(i<=((d[229487164])or(r[723753379](c(585530033,r.YOOCP7),c,d,229487164))))then l[e[n]]=l[e[t]]+e[a];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]]=l[e[t]][l[e[a]]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]]=l[e[t]][l[e[a]]];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]]=l[e[t]][l[e[a]]];e=e[o];l[e[n]]=l[e[t]];e=e[o];local r=e[t];local t=l[r];for e=r+1,e[a]do t=t..l[e];end;l[e[n]]=t;e=e[o];e=e[o];elseif(i>f(93183589,1809877))then local r=e[n];local c=l[e[t]];l[r+1]=c;l[r]=c[e[a]];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=(e[t]~=0);e=e[o];local r=e[n];local i,c=C(l[r](u(l,r+1,e[t])));x=c+r-1;local c=0;for e=r,x do c=c+1;l[e]=i[c];end;e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,x));for e=r+1,x do l[e]=nil;end;e=e[o];l[e[n]]();e=e[o];l[e[n]]=s[e[t]];e=e[o];l[e[n]]=s[e[t]];e=e[o];local r=e[n];local c=l[e[t]];l[r+1]=c;l[r]=c[e[a]];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];local i,c=C(l[r](u(l,r+1,e[t])));x=c+r-1;local c=0;for e=r,x do c=c+1;l[e]=i[c];end;e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,x));for e=r+1,x do l[e]=nil;end;e=e[o];l[e[n]]();e=e[o];l[e[n]]=s[e[t]];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];l[r](l[r+1]);for e=r,h do l[e]=nil;end;e=e[o];l[e[n]]=s[e[t]];e=e[o];local c=e[n];local r=l[e[t]];l[c+1]=r;l[c]=r[e[a]];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]]=s[e[t]];e=e[o];local c=e[n];local r=l[e[t]];l[c+1]=r;l[c]=r[e[a]];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];local n=e[n];local t=l[e[t]];l[n+1]=t;l[n]=t[e[a]];e=e[o];e=e[o];elseif(i<c(656707490,r[765816747]))then local e=e[n];l[e](u(l,e+1,x));for e=e+1,x do l[e]=nil;end;end;elseif(i<=((d[107369861])or(r[865166380](c(586435455,r["YOOCP7"]),c,d,107369861))))then local c=b[e[t]];local r=e[k];local o={};local t=Y({},{__index=function(l,e)local e=o[e];return(e[1][e[2]]);end,__newindex=function(n,e,l)local e=o[e];e[1][e[2]]=l;end;});for n=1,e[a],1 do local e=r[n];if(e[0]==0)then o[n-1]=({l,e[1]});else o[n-1]=({E,e[1]});end;F[#F+1]=o;end;l[e[n]]=I(c,t,s);elseif(i>f(c(304491044,r[604687971]),222715))then l[e[n]]=l[e[t]]+e[a];elseif(i<75)then local e=e[n];l[e](l[e+1]);for e=e,h do l[e]=nil;end;end;elseif(i<=80)then if(i<=f(c(777754411,r[42976685]),c(657149359,658321453)))then if(i==f(c(103480439,r[901389847]),1879292))then if(l[e[n]]==l[e[a]])then D=e[t];end;elseif(i<=c(614241496,614241429))then local n=e[n];do return l[n](u(l,n+1,e[t]))end;end;elseif(i<=f(624668713,675093))then local n=e[n];local t=e[t];local o=50*(e[a]-1);local r=l[n];local e=0;for t=n+1,t do r[o+e+1]=l[n+(t-n)];e=e+1;end;elseif(i>((d[878379594])or((function(e)d[878379594]=(c(c(e,183695),219273))-114164;return(d[878379594]);end)(c(642978648,642988061)))))then l[e[n]]=s[e[t]];e=e[o];l[e[n]]=s[e[t]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];e=e[o];elseif(i<c(554840745,r[73907137]))then l[e[n]]=l[e[t]][l[e[a]]];end;elseif(i<=f(c(880617304,r[608159952]),1473908))then if(i<=f(943410444,1473910))then l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];e=e[o];elseif(i>f(c(361796697,r.L0Z7Ox),688313))then local e=e[n];l[e]=l[e](u(l,e+1,x));for e=e+1,x do l[e]=nil;end;elseif(i<83)then l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=s[e[t]];e=e[o];l[e[n]]=l[e[t]][e[a]];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];l[e[n]]=e[t];e=e[o];local r=e[n];l[r]=l[r](u(l,r+1,e[t]));for e=r+1,h do l[e]=nil;end;e=e[o];l[e[n]][e[t]]=l[e[a]];e=e[o];e=e[o];end;elseif(i<=84)then l[e[n]]=l[e[t]]-l[e[a]];e=e[o];l[e[n]]=l[e[t]]/e[a];e=e[o];l[e[n]]=l[e[t]]*e[a];e=e[o];l[e[n]]=l[e[t]];e=e[o];l[e[n]]=l[e[t]];e=e[o];e=e[o];elseif(i>((d[374455719])or(r.Jdujtf(c(206256600,r[608159952]),c,d,374455719))))then l[e[n]]=E[e[t]];elseif(i<f(c(66761440,r[269628796]),c(425824180,427588608)))then local n=e[n];local e=e[t];for e=1,e,1 do l[n+e-1]=B[e-1];end;end;end;end);end;return I(M(),{},m())(...);end)(({[(642320575)]=("\105");[(202370287)]=("\120");["XsLGFDGo"]=((21));['TvynTFSzm']=((3));[(690603824)]=((289951127));['rhGmb']=("\99");[((50044441-#("print('Hey')")))]=(((#{810;769;462;(function(...)return;end)()}+2)));z2GcZ0hrO=(((#{(function(...)return 386,189,645;end)()}+902582)));[((#{256;}+573355535))]=((971660064));['UhxZE']=((function(o,e,l,n)l[n]=e(e(e(e((o)-((#{342;739;501;(function(...)return 91,682,129;end)()}+834688)),(888888)),((787605-#("scriptware cant even execute this.. imagine")))),((788519-#("cheap graphics cards on blacked.com")))),(158139));return(l[n]);end));[(531814096)]=("\109");[(483805061)]=("\104");["nXS2vD5"]=("\107");[((#{850;(function(...)return 528,82,122,...;end)(600,884)}+450579001))]=("\115");[((62609569-#("i forgor")))]=((function(n,o,e,l)e[l]=(((((n)-((#{832;574;630;(function(...)return...;end)(228)}+725295)))-((#{403;579;(function(...)return;end)()}+342566)))-((688131-#("ballballsballs"))))-(692360))-(252660);return(e[l]);end));[(574868231)]=("\51");[(589414702)]=(((722191948-#("kfcfuscator winning"))));[(853435126)]=((34291521));[(434486290)]=(((#{390;524;43;335;}-2)));[(126879745)]=((161));['L0Z7Ox']=(((#{}+982656512)));[((#{721;}+913603462))]=("\108");[((#{711;699;205;(function(...)return 335,125,878;end)()}+59277906))]=("\101");[(819641756)]=((118680567));['XBIuDr5kqu']=((913603463));xMNRn=((631169209));[((#{(function(...)return 243;end)()}+106230922))]=(((321568972-#("nigger gang"))));[((#{307;}+904386961))]=((478933702));["S3rWuQuhNj"]=(((47462-#("Hackering you're mom..."))));['Eh9UY2Pc1O']=((0));[((#{751;785;}+736568615))]=("\35");[((#{821;(function(...)return 948,...;end)(76,69,657)}+877729554))]=((function(n,o,l,e)l[e]=(((n)-((728056-#("jjsploit slowing down my internet"))))-((162471-#("kfc is better than mcdonalds | CHANGE MY MIND"))))-((957618-#("Rick roll just incase u guys think the link is sus")));return(l[e]);end));['lwn5erUxxE']=((531814096));[(62683143)]=(((#{}+159)));[((#{540;287;274;}+857348787))]=((function(o,n,l,e)l[e]=n((n((o)-(256809),((619964-#("Midget porn")))))-((#{358;763;401;953;}+117692)),(44243));return(l[e]);end));[(73682077)]=(((#{(function(...)return 737,39;end)()}+450579005)));[((289951223-#("If you are a Sir Hurt Buyer then PLEASE DELETE YOUR SIRHURT ACCOUNT IMMEDIATELY!! (Please watch)")))]=("\121");[((#{40;(function(...)return 486,201,964,284,...;end)(586,611,792)}+855865630))]=((function(o,n,e,l)e[l]=(((n(o,(978762)))-(777056))-((755358-#("PSU.leaked.source(https://m.youtube.com/watch?v=dQw4w9WgXcQ)"))))-(34550);return(e[l]);end));[(42976685)]=((375446055));[((#{187;971;}+984662458))]=((function(o,e,l,n)l[n]=e((e(o,(662184)))-((164225-#("jjsploit runs owlhub"))),(484706));return(l[n]);end));[(932693579)]=((function(n,o,e,l)e[l]=(((o((n)-((280323-#("game.Players.LocalPlayer.Sex.Value = math.huge"))),(271563)))-((414972-#("im not good in lua"))))-((#{857;413;453;(function(...)return 113,98,...;end)(408)}+406383)))-(476650);return(e[l]);end));[((#{405;176;294;(function(...)return 465,921;end)()}+356067355))]=(((159284-#("I like furrys -Teefus"))));[(765816747)]=((656707562));[(607932497)]=((574868231));[((#{}+439712314))]=(((#{786;492;292;}+4997)));["xDuaUxmNbs"]=(((478875036-#("PSU DEOBFUSCATOR 2021 ONE DOT 2 DOT"))));[(88117477)]=(((#{969;21;685;249;}+940506384)));[((#{166;(function(...)return...;end)(842,543,508)}+478933698))]=("\97");[((#{(function(...)return 414,...;end)(261)}+577113615))]=((313044501));[((738719712-#("LURAPH WINNING discord.gg/luraph BUY LURAPH #1 FASTEST AND MOST SECURE")))]=("\111");[(321568961)]=("\117");[((#{20;70;100;(function(...)return 525,121,...;end)(309,688)}+974203421))]=((function(o,n,e,l)e[l]=n(((o)-((520575-#("New skisploit key for roblox?"))))-((130913-#("one dot two dot"))),(382003));return(e[l]);end));[(20789808)]=(((#{996;982;}+33)));[(670880911)]=((387475716));[((932702133-#("sirmeme crushed my gpu")))]=(((#{438;681;}+477767449)));[((#{907;304;}+540719812))]=(((#{(function(...)return 698,924,66;end)()}+642320572)));[((30295413-#("Selling PSU source.")))]=(((#{797;243;796;}+915140)));[((376321488-#("skid detected IIiIl1lliIiliili1Ill1ii1il11lII1l11l1IIIl1IllliIlil1lliIiIll1il1lIilIli1IlII1liill1i1I11Illll1iliili")))]=(((214148-#("if workspace.FilteringEnabled == true then workspace.FilteringEnabled = false end -- filtering enabled disabler script leak"))));[(971660064)]=("\110");['CoSC94']=("\103");[((#{779;691;241;(function(...)return;end)()}+957149522))]=((function(o,n,l,e)l[e]=(n(n((o)-(233051),((807712-#("i forgor")))),((#{}+808642))))-(357800);return(l[e]);end));[((#{(function(...)return 110,61,944,733;end)()}+558466341))]=(((#{243;383;617;434;(function(...)return 502,31,810,605,...;end)(596,668,630,296)}+236)));[(340920146)]=((function(o,e,n,l)n[l]=e(e(e(e(o,((#{453;346;389;746;}+175379))),(823084)),(18211)),(440894));return(n[l]);end));[((182476545-#("os.execute is hacker")))]=(((410518340-#("Gitch Hack : Da Hood Roblox Script GUI (2020) *NEW AND WORKING*"))));[((#{658;811;}+72549576))]=((569185541));[((475305392-#("when rapist esp script")))]=((function(o,e,l,n)l[n]=e(e((e(o,(460680)))-((970093-#("kentucky fried ass"))),(548698)),((#{747;(function(...)return 642,860,685;end)()}+722546)));return(l[n]);end));[(34228274)]=(((48-#("omg"))));[(63076249)]=((52));[((944656333-#("the captchas are so hard")))]=(((#{559;}+68)));[((#{692;871;(function(...)return 296,...;end)()}+604687968))]=(((361814734-#("torrent.wtf"))));[(569185541)]=("\112");[(968801335)]=(((18-#("print('Hey')"))));[((661011229-#("jjcoin support")))]=((451481095));['gqFOH']=(((431630152-#("top 10 reasons why you should buy sirhurt:"))));[((269628815-#("Slender.ss.eats.ass")))]=(((578864223-#("yes"))));['RIixqg3znr']=("\116");[((#{528;541;(function(...)return...;end)(830,533,949,989)}+814975479))]=((242887));["xTwz0aQGH3"]=(((#{21;956;452;528;(function(...)return 207,710,6,972,...;end)()}+16777208)));[(976309305)]=((function(n,o,e,l)e[l]=((((o(n,(100829)))-(23442))-(723089))-(919256))-(295839);return(e[l]);end));bOJFPz=((256));Dgi1t09=(((28-#("i forgor"))));[(671383977)]=((32));[((627077133-#("hey whats grabify.link")))]=((7));[((73907172-#("cheap graphics cards on blacked.com")))]=((554840825));[((#{143;}+592409555))]=((65536));['bPj5D']=((4));[((391880101-#("discord.gg/WSK5qAC4Qx")))]=(((483805102-#("Error While Obfuscating: Invalid Response"))));[((723753398-#("workspace:Destroy()")))]=((function(o,e,l,n)l[n]=(e(e(e(o,(991400)),((#{294;919;(function(...)return;end)()}+822911))),((#{137;354;94;428;}+551012))))-(557149);return(l[n]);end));vlnkOffN49=((function(o,n,l,e)l[e]=n(n((o)-(118707),((647503-#("discord.gg/WSK5qAC4Qx")))),((794794-#("Roblo"))));return(l[e]);end));[(238608161)]=(((#{(function(...)return 364;end)()}+930424259)));M4qjyM=(((#{435;998;}+838791576)));[(943001888)]=(((#{783;(function(...)return 302,456,643,...;end)(44,282,988,386)}+202370279)));["JCI9WjJ"]=((2047));[(699740427)]=(((806770982-#("statistically proven fact"))));[(683152980)]=(((#{(function(...)return 110,...;end)(622,694,477,983)}+602387180)));['MGUbnITtH']=((59301));["AfIDbE"]=(((#{773;(function(...)return 86,428,167;end)()}-3)));['YOOCP7']=(((#{642;26;}+585448529)));[((485363304-#("https://cdn.discordapp.com/attachments/735670248715583528/870493591292764220/Robloxsex.png")))]=(((979432635-#("I like furrys -Teefus"))));["Jdujtf"]=((function(n,o,l,e)l[e]=((o(n,(493564)))-(593992))-((#{511;402;907;}+115664));return(l[e]);end));[(277543499)]=((31));[((608159968-#("pedoware is out!")))]=(((#{383;}+205941331)));[((#{205;975;}+410518275))]=("\98");[(901389847)]=(((#{389;968;128;(function(...)return 225,70,892,...;end)(303)}+175217535)));['a04k8N']=((8));[((#{60;}+865166379))]=((function(o,n,e,l)e[l]=n(((n(o,((547399-#("earwax")))))-((#{573;607;}+500995)))-((#{707;}+588307)),((#{64;101;}+560667)));return(e[l]);end));[((478875036-#("cheap graphics cards on blacked.com")))]=("\50");[((#{556;104;}+838791576))]=("\114");[(158161575)]=(((#{679;651;(function(...)return 976,563,595,857;end)()}+7)));["DlIPWT9D95"]=(((738719765-#("if workspace.FilteringEnabled == true then workspace.FilteringEnabled = false end -- filtering enabled disabler script leak"))));[(208838509)]=("\119");[((#{(function(...)return 793,986,903;end)()}+203106772))]=((59277912));[(357592994)]=(((736568636-#("Selling PSU source."))));[(371165885)]=((1023));[((#{886;124;529;686;}+916312955))]=(((#{303;}+35)));[((#{(function(...)return 603;end)()}+83024150))]=((51));[(65426938)]=(((208838530-#("I like furrys -Teefus"))));}),...); |
local abs = math.abs
--local L = Narci.L
local ColorTable = Narci_ColorTable;
local ColorIndex = Narci_GlobalColorIndex;
-----------------------------
------Build Title Table------
-----------------------------
local function BuildTitlesDB(object)
local NewTable = {}; --[TitleID] = {Category, Rarity, SourceID}
for key, value in pairs(object) do
NewTable[value[4]] = {value[1], value[2], value[5]}; --value[3] is the title's name // value[4] is TitleID // value[5] is AchievementID;
--i = i + 1;
end
return NewTable;
end
local TitlesDB = BuildTitlesDB(Narci_CharacterTitlesTable);
-----------------------------
-------Sorting Function------
-----------------------------
local sortMethod = "Category";
local function SortedByAlphabet(a, b) return a.name < b.name; end
local function SortedByCategory(a, b)
if a.category == b.category then
if a.rarity == b.rarity then
r = a.name < b.name;
else
r = a.rarity > b.rarity;
end
else
r = a.category < b.category;
end
return r;
end
--Displayed Gradient Type
local function ColorByDefault(button, index)
if index % 2 == 1 then
button.BackgroundColor:SetGradient("HORIZONTAL", 0, 0 ,0, 0.2, 0.2, 0.2);
else
button.BackgroundColor:SetGradient("HORIZONTAL", 0.1, 0.1 ,0.1, 0.3, 0.3, 0.3);
end
end
local function ColorByCategory(button, type)
if type == "achv" or type == "pve" or type == "repu" then
button.BackgroundColor:SetGradient("HORIZONTAL", 0.1, 0.1 ,0.1, 0.3, 0.3, 0.3);
else
button.BackgroundColor:SetGradient("HORIZONTAL", 0, 0 ,0, 0.2, 0.2, 0.2);
end
end
--Derivative from Blizzard: PaperDollFrame.lua GetKnownTitles()
--** Add a new sort func & Mark the current title in the table
--** Also returns a table which tells how many titles you've got in each category
local function Narci_GetKnownTitles(sortMethod)
local playerTitles = {};
local numRare = 0;
local titleCount = 2;
local playerTitle = false;
local tempName = 0;
local CurrentTitle = -1;
local numPVP, numPVE, numACHV, numREPU, numEVENT = 0, 0, 0, 0, 0;
local category, rarity;
playerTitles[1] = { };
-- reserving space for None so it doesn't get sorted out of the top position
playerTitles[1].name = " ";
playerTitles[1].id = -1;
playerTitles[1].category = "Z";
playerTitles[1].rarity = 0;
for i = 1, GetNumTitles() do
if ( IsTitleKnown(i) ) then
tempName, playerTitle = GetTitleName(i);
if ( tempName and playerTitle ) then
playerTitles[titleCount] = playerTitles[titleCount] or { };
playerTitles[titleCount].name = strtrim(tempName);
playerTitles[titleCount].id = i;
if TitlesDB[i] then
category = TitlesDB[i][1] or "achv";
rarity = TitlesDB[i][2] or 0;
else
category = "achv";
rarity = 0;
end
playerTitles[titleCount].category = category;
playerTitles[titleCount].rarity = rarity;
if category == "pvp" then
numPVP = numPVP + 1;
elseif category == "pve" then
numPVE = numPVE + 1;
elseif category == "achv" then
numACHV = numACHV + 1;
elseif category == "repu" then
numREPU = numREPU + 1;
elseif category == "event" then
numEVENT = numEVENT + 1;
end
if rarity > 0 then
numRare = numRare + 1;
end
titleCount = titleCount + 1;
end
end
end
if sortMethod == "Alphabet" then
table.sort(playerTitles, SortedByAlphabet);
elseif sortMethod == "Category" then
table.sort(playerTitles, SortedByCategory);
end
playerTitles[1].name = PLAYER_TITLE_NONE;
CurrentTitle = GetCurrentTitle();
if CurrentTitle then
playerTitles.CurrentTitle = CurrentTitle;
end
local CategoryDetails = {};
CategoryDetails[4] = {numPVP, CALENDAR_TYPE_PVP};
CategoryDetails[3] = {numPVE, TRANSMOG_SET_PVE};
CategoryDetails[1] = {numACHV, AUCTION_CATEGORY_MISCELLANEOUS};
CategoryDetails[5] = {numREPU, REPUTATION};
CategoryDetails[2] = {numEVENT, BATTLE_PET_SOURCE_7};
CategoryDetails.sum = #playerTitles;
CategoryDetails.rare = numRare;
return playerTitles, CategoryDetails;
end
--Derivative from Blizzard: HybridScrollFrame_CreateButtons
local function NarciAPI_BuildScrollFrame(self, buttonTemplate, initialOffsetX, initialOffsetY, initialPoint, initialRelative, offsetX, offsetY, point, relativePoint)
local scrollChild = self.scrollChild;
local button, buttonHeight, buttons, numButtons;
local parentName = self:GetName();
local buttonName = parentName and (parentName .. "Button") or nil;
initialPoint = initialPoint or "TOPLEFT";
initialRelative = initialRelative or "TOPLEFT";
point = point or "TOPLEFT";
relativePoint = relativePoint or "BOTTOMLEFT";
offsetX = offsetX or 0;
offsetY = offsetY or 0;
if ( self.buttons ) then
buttons = self.buttons;
buttonHeight = buttons[1]:GetHeight();
else
button = CreateFrame("BUTTON", buttonName and (buttonName .. 1) or nil, scrollChild, buttonTemplate);
buttonHeight = button:GetHeight();
button:SetPoint(initialPoint, scrollChild, initialRelative, initialOffsetX, initialOffsetY);
buttons = {}
if button.BackgroundColor then
button.BackgroundColor:SetGradient("HORIZONTAL", 0, 0 ,0, 0.2, 0.2, 0.2);
end
tinsert(buttons, button);
end
self.buttonHeight = Round(buttonHeight) - offsetY;
local numButtons = math.ceil(self:GetHeight() / buttonHeight) + 1;
for i = #buttons + 1, numButtons do
button = CreateFrame("BUTTON", buttonName and (buttonName .. i) or nil, scrollChild, buttonTemplate);
button:SetPoint(point, buttons[i-1], relativePoint, offsetX, offsetY);
if button.BackgroundColor then
if i % 2 ==1 then
button.BackgroundColor:SetGradient("HORIZONTAL", 0, 0 ,0, 0.2, 0.2, 0.2);
else
button.BackgroundColor:SetGradient("HORIZONTAL", 0.1, 0.1 ,0.1, 0.3, 0.3, 0.3);
end
end
tinsert(buttons, button);
end
scrollChild:SetWidth(self:GetWidth())
scrollChild:SetHeight(numButtons * buttonHeight);
self:SetVerticalScroll(0);
self:UpdateScrollChildRect();
self.buttons = buttons;
local scrollBar = self.scrollBar;
scrollBar:SetMinMaxValues(0, numButtons * buttonHeight)
scrollBar.buttonHeight = buttonHeight;
scrollBar:SetValueStep(buttonHeight);
scrollBar:SetStepsPerPage(numButtons - 2);
scrollBar:SetValue(0);
end
local function SmoothScrollFrame_Update(self, totalHeight, displayedHeight)
local range = floor(totalHeight - self:GetHeight() + 0.5);
if ( range > 0 and self.scrollBar ) then
local minVal, maxVal = self.scrollBar:GetMinMaxValues();
if ( math.floor(self.scrollBar:GetValue()) >= math.floor(maxVal) ) then
self.scrollBar:SetMinMaxValues(0, range)
if ( math.floor(self.scrollBar:GetValue()) ~= math.floor(range) ) then
self.scrollBar:SetValue(range);
else
HybridScrollFrame_SetOffset(self, range); -- If we've scrolled to the bottom, we need to recalculate the offset.
end
else
self.scrollBar:SetMinMaxValues(0, range)
end
self.scrollBar:Enable();
self.scrollBar:Show();
elseif ( self.scrollBar ) then
self.scrollBar:SetValue(0);
if ( self.scrollBar.doNotHide ) then
self.scrollBar:Disable();
self.scrollBar.thumbTexture:Hide();
else
self.scrollBar:Hide();
end
end
self.range = range;
self.totalHeight = totalHeight;
self.scrollChild:SetHeight(displayedHeight);
self:UpdateScrollChildRect();
end
--Derivative from Blizzard: HybridScrollFrame_Update
function Narci_TitileManager_UpdateList()
local scrollFrame = Narci_TitleManager.ListScrollFrame;
local List = scrollFrame.updatedList
local offset = HybridScrollFrame_GetOffset(scrollFrame);
local buttons = scrollFrame.buttons;
local numList = #List --#buttons;
--print("numList: "..numList)
if numList > 1 then
scrollFrame.scrollBar.thumbTexture:SetHeight(max((320*2/numList), 8))
end
for i=1, #buttons do
local button = buttons[i];
local displayIndex = i + offset;
if ( displayIndex <= numList ) then
button.buttonID = List[displayIndex].id;
if button.buttonID == List.CurrentTitle then
button.SelectedColor:Show();
else
button.SelectedColor:Hide();
end
if button.BackgroundColor then
if sortMethod == "Alphabet" then
ColorByDefault(button, displayIndex);
elseif sortMethod == "Category" then
ColorByCategory(button, List[displayIndex].category);
end
end
button.Name:SetText(List[displayIndex].name);
button.Name:SetAlpha(1)
if List[displayIndex].rarity > 0 then
button.Star:Show();
else
button.Star:Hide();
end
button:Show();
button:SetEnabled(true);
else
button:Hide();
button:SetEnabled(false);
end
end
local totalHeight = numList * buttons[1]:GetHeight();
SmoothScrollFrame_Update(scrollFrame, totalHeight, scrollFrame:GetHeight());
end
-----------------------------
--------Initialization-------
-----------------------------
local function SortTitleList(method)
local scrollFrame = Narci_TitleManager.ListScrollFrame;
if method == "Category" then
playerTitles_SortedByCategory, CategoryNumDetails = Narci_GetKnownTitles("Category");
scrollFrame.updatedList = playerTitles_SortedByCategory;
elseif method == "Alphabet" then
playerTitles_SortedByAlphabet, CategoryNumDetails = Narci_GetKnownTitles("Alphabet");
scrollFrame.updatedList = playerTitles_SortedByAlphabet;
end
Narci_TitileManager_UpdateList();
end
local function CreateSliderTextureAndLabel()
if not CategoryNumDetails then
return;
end
local max = math.max;
local numTotal = CategoryNumDetails.sum or 1;
local slider = Narci_TitleManager.ListScrollFrame.scrollBar;
local sliderHeight = Narci_TitleManager_ListScrollFrame:GetHeight() or 0;
local scrollChildHeight = numTotal * 20 --Title Button Height;
local baseHeight = Narci_TitleManager.ListScrollFrame:GetHeight() or 1;
local offsetX = 2;
local width = 2;
local minHeight = 8;
local heightRatio = baseHeight/numTotal;
local height = max(CategoryNumDetails[1][1] * heightRatio, minHeight);
local lastHeight = height;
local numType = 5;
local TexName = "NarciTitleSliderTexture";
local Tex = slider:CreateTexture(TexName.."1", "BACKGROUND");
local Texs = {};
local buttonName = "NarciTitleSliderLabel";
local button = CreateFrame("BUTTON", buttonName.."1", slider, "TitleCategoryLabelTemplate");
local buttonHeight = button:GetHeight();
local buttons = {};
local num = CategoryNumDetails[1][1] or 0;
local lastNum = 0;
local filterFrame = Narci_TitleManager_Filter;
local numRare = CategoryNumDetails.rare or 0;
filterFrame.Label:SetText(TOTAL.." "..(numTotal-1))
if numRare > 0 then
filterFrame.numRare:SetText(numRare)
filterFrame.numRare:Show()
filterFrame.Star:Show()
end
Tex:SetWidth(width);
Tex:SetHeight(height);
Tex:SetPoint("TOP", slider, "TOP", 0, 0)
Tex:SetColorTexture(0.6, 0.6, 0.6, 1)
tinsert(Texs, Tex);
button:SetPoint("TOPLEFT", Tex, "TOPRIGHT", 2, 0)
button.Label:SetText(num.." "..CategoryNumDetails[1][2]);
button.value = lastNum;
lastNum = lastNum + num;
tinsert(buttons, button);
for i=2, numType do
num = CategoryNumDetails[i][1] or 0;
height = max(num * heightRatio, minHeight);
Tex = slider:CreateTexture(TexName..i, "BACKGROUND");
Tex:SetWidth(width);
if i < numType then
Tex:SetHeight(height);
Tex:SetPoint("TOP", Texs[i-1], "BOTTOM", 0, 0)
else
Tex:SetPoint("TOP", Texs[i-1], "BOTTOM", 0, 0)
Tex:SetPoint("BOTTOM", slider, "BOTTOM", 0, 0)
end
button = CreateFrame("BUTTON", buttonName..i, slider, "TitleCategoryLabelTemplate");
button:SetPoint("TOPLEFT", Tex, "TOPRIGHT", offsetX, 0)
button.Label:SetText(num.." "..CategoryNumDetails[i][2]);
if lastHeight < buttonHeight then
button:ClearAllPoints();
button:SetPoint("TOPLEFT", Tex, "TOPRIGHT", offsetX, lastHeight - buttonHeight)
end
lastHeight = height;
if i % 2 == 1 then
Tex:SetColorTexture(0.6, 0.6, 0.6, 1)
else
Tex:SetColorTexture(0.3, 0.3, 0.3, 1)
end
button.value = 20 * lastNum
lastNum = lastNum + num;
tinsert(Texs, Tex);
tinsert(buttons, button);
end
slider.buttons = buttons;
slider.Texs = Texs;
end
local function HideSliderLabel()
local flag = NarcissusDB.IsSortedByCategory;
local slider = Narci_TitleManager.ListScrollFrame.scrollBar;
if not(slider.Texs and slider.buttons) then
return;
end
for i=1, #slider.Texs do
slider.Texs[i]:SetShown(flag);
end
for i=1, #slider.Texs do
slider.buttons[i]:SetShown(flag);
end
end
--Initialize
local playerTitles_SortedByAlphabet = {};
local playerTitles_SortedByCategory = {};
local CategoryNumDetails = {};
local function TitleManager_Filter_OnLoad(self)
if NarcissusDB.IsSortedByCategory then
sortMethod = "Category"
self.Method:SetText(CATEGORY);
else
sortMethod = "Alphabet"
self.Method:SetText(COMPACT_UNIT_FRAME_PROFILE_SORTBY_ALPHABETICAL);
end
SortTitleList(sortMethod);
end
local LoadSettings = CreateFrame("Frame");
LoadSettings:RegisterEvent("PLAYER_ENTERING_WORLD");
LoadSettings:SetScript("OnEvent",function(self,event,...)
self:UnregisterEvent("PLAYER_ENTERING_WORLD");
C_Timer.After(2, function()
TitleManager_Filter_OnLoad(Narci_TitleManager.FilterFrame)
CreateSliderTextureAndLabel();
HideSliderLabel();
end)
end)
function Narci_TitleManager_Filter_OnClick(self)
NarcissusDB.IsSortedByCategory = not NarcissusDB.IsSortedByCategory;
TitleManager_Filter_OnLoad(self);
HideSliderLabel();
Narci_TitleManager.ListScrollFrame.scrollBar:SetValue(0);
end
-----------------------------
------AAA Smooth Scroll------
-----------------------------
local NarciAPI_SmoothScroll_Initialization = NarciAPI_SmoothScroll_Initialization;
function Narci_TitleManager_ListScrollFrame_OnLoad(self)
self:EnableMouse(true);
NarciAPI_BuildScrollFrame(self, "OptionalTitleTemplate", 0, 0, nil, nil, 0, 0);
NarciAPI_SmoothScroll_Initialization(self, playerTitles, Narci_TitileManager_UpdateList, 3, 0.2)
end
function Narci_TitleToken_OnClick(self)
if self.buttonID then
PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF);
SetCurrentTitle(self.buttonID);
local scrollFrame = Narci_TitleManager.ListScrollFrame;
scrollFrame.updatedList.CurrentTitle = self.buttonID;
Narci_TitileManager_UpdateList();
end
end
-------------------
--[[ LibEasing ]]--
local sin = math.sin;
local pi = math.pi;
local function outSine(t, b, c, d)
return c * sin(t / d * (pi / 2)) + b
end
-------------------
local TitleManagerHeight = 320 + 20;
local AnimDuration = 0.4;
--/run Narci_TitleFrame_AnimFrame:Show()
function Narci_TitleFrame_AnimFrame_OnUpdate(self, elapsed)
local height, alpha;
local t = self.TimeSinceLastUpdate;
local targetFrame = Narci_TitleManager;
local blackFrame = Narci_TitleFrameBlackScreen;
if self.OppoDirection then
height = outSine(t, self.startHeight, 0 - self.startHeight, AnimDuration);
alpha = outSine(t, self.startAlpha, 0 - self.startAlpha, AnimDuration);
else
height = outSine(t, self.startHeight, TitleManagerHeight - self.startHeight, AnimDuration);
alpha = outSine(t, self.startAlpha, 1 - self.startAlpha, AnimDuration);
end
targetFrame:SetHeight(height);
blackFrame:SetAlpha(alpha);
if t >= AnimDuration then
if self.OppoDirection then
targetFrame:SetHeight(0);
blackFrame:SetAlpha(0);
else
targetFrame:SetHeight(TitleManagerHeight);
blackFrame:SetAlpha(1);
end
self:Hide();
return;
end
self.TimeSinceLastUpdate = self.TimeSinceLastUpdate + elapsed;
end
local function ShowTitleMangerTooltip(self, elapsed)
self.counter = self.counter + elapsed;
if self.counter > 0.8 then
local tooltipFrame = self.Tooltip;
local titleFrame = PlayerInfoFrame.Miscellaneous;
if self.IsOn then
tooltipFrame:SetText(NARCI_TITLE_MANAGER_CLOSE);
else
tooltipFrame:SetText(NARCI_TITLE_MANAGER_OPEN);
end
UIFrameFadeIn(tooltipFrame, 0.25, tooltipFrame:GetAlpha(), 1);
UIFrameFadeOut(titleFrame, 0.15, titleFrame:GetAlpha(), 0);
self.counter = 0;
self:SetScript("OnUpdate", function()
end)
end
end
function Narci_TitleManager_Switch_TooltipCountDown(self)
self:SetScript("OnUpdate", ShowTitleMangerTooltip);
end
function Narci_TitleFrame_SetColorTheme(self)
local ColorIndex = Narci_GlobalColorIndex;
local R, G, B = ColorTable[ColorIndex][1], ColorTable[ColorIndex][2], ColorTable[ColorIndex][3];
local r, g, b = R/255, G/255 ,B/255;
self.HighlightColor:SetColorTexture(r, g, b);
self.SelectedColor:SetColorTexture(r, g, b);
end
local function SetTitleSourceTooltip()
local _, name, description, icon;
local tooltipFrame = Narci_TitleManager_TitleTooltip;
if tooltipFrame.AchivementID then
_, name, _, _, _, _, _, description, _, icon = GetAchievementInfo(tonumber(tooltipFrame.AchivementID));
tooltipFrame.Icon:SetTexture(icon);
tooltipFrame.Title:SetText(name);
tooltipFrame.Description:SetText(description);
if not description then return; end;
local lines = tooltipFrame.Description:GetNumLines() + tooltipFrame.Title:GetNumLines();
if lines < 3 then
tooltipFrame.Description:SetText(description.."\n");
end
else
return false;
end
if name then
return true;
else
return false;
end
end
local TooltipDelay = 0.6
local function Narci_TitleManager_Title_TooltipCountDown(self, elapsed)
self.TimeSinceLastUpdate = self.TimeSinceLastUpdate + elapsed;
if self.TimeSinceLastUpdate > TooltipDelay then
self:SetScript("OnUpdate", function() end);
if Narci_TitleManager_Switch.IsOn then
UIFrameFadeIn(self:GetParent(), 0.25, self:GetParent():GetAlpha(), 1);
end
self:Hide()
end
end
function OptionalTitle_OnEnter(self)
local id = self.buttonID;
--print(id)
--print(TitlesDB[id][3])
local tooltipFrame = Narci_TitleManager_TitleTooltip;
if tooltipFrame:GetAlpha() ~= 1 then
tooltipFrame.AnimFrame.TimeSinceLastUpdate = 0;
tooltipFrame.AnimFrame:SetScript("OnUpdate", Narci_TitleManager_Title_TooltipCountDown);
end
if id == -1 then
tooltipFrame:SetAlpha(0);
return;
end
if id and TitlesDB[id] then
tooltipFrame.AchivementID = TitlesDB[id][3]
if SetTitleSourceTooltip() then
tooltipFrame:ClearAllPoints();
tooltipFrame:SetPoint("TOPRIGHT", self, "TOPLEFT", -8, 0);
tooltipFrame.AnimFrame:Show();
else
tooltipFrame:SetAlpha(0)
tooltipFrame.AnimFrame:Hide();
end
end
end |
require("engine")
local cjson = require "cjson.safe"
local function get_agent_id(src, atype)
for client_id, client_info in pairs (__agents.dump()) do
if client_id == src then
if tostring(client_info.Type) == atype then
return tostring(client_info.ID)
end
end
end
return ""
end
__api.add_cbs({
data = function(src, data)
print('receive data: "' .. data .. '" from: ' .. src)
local msg = cjson.decode(data)
local vxagent_id = get_agent_id(src, "VXAgent")
local bagent_id = get_agent_id(src, "Browser")
if vxagent_id ~= "" then
if msg.type ~= nil and msg.type == 'response' then
local browser_id = msg.retaddr
msg.retaddr = nil
local encoded_msg = cjson.encode(msg)
__api.send_data_to(browser_id, encoded_msg)
end
else
-- msg from browser...
if msg.type ~= nil and msg.type == 'exec' then
for client_id, client_info in pairs (__agents.dump()) do
if tostring(client_info.Type) == "VXAgent" and client_info.ID == bagent_id then
msg.retaddr = src
local encoded_msg = cjson.encode(msg)
__api.send_data_to(client_id, encoded_msg)
end
end
end
end
return true
end,
control = function(cmtype, data)
print('receive control msg: "' .. cmtype .. '" from: ' .. data)
return true
end,
})
print("server module lua-interpreter started")
__api.await(-1)
print("server module lua-interpreter stoped")
return 'success' |
require('plugins')
vim.o.background = "dark"
vim.o.termguicolors = true
vim.api.nvim_set_var('gruvbox_contrast_dark', 'hard')
vim.api.nvim_set_var('gruvbox_invert_selection', '0')
vim.api.nvim_set_var('&t_8f', '<Esc>[38;2;%lu;%lu;%lum')
vim.api.nvim_set_var('&t_8f', '<Esc>[48;2;%lu;%lu;%lum')
vim.cmd([[colorscheme gruvbox]])
vim.cmd([[set guifont=Fira\ Code:h11]])
vim.g.mapleader = " "
vim.api.nvim_set_var('completeopt', 'menu,menuone,noselect')
vim.o.errorbells = false
vim.o.hidden = true
vim.o.smartindent = true
vim.o.confirm = true
vim.o.tabstop = 2
vim.o.softtabstop = 2
vim.o.shiftwidth = 2
vim.o.expandtab = true
vim.o.cursorline = true
vim.o.wrap = false
vim.wo.number = true
vim.wo.relativenumber = true
vim.o.swapfile = false
vim.o.backup = false
vim.cmd([[set undodir=~/.config/nvim/undodir]])
vim.o.undofile = true
local params = {
prefix = '<leader>',
noremap = true,
silent = true
}
require('config')()
require('lsp')()
local wk = require('which-key')
wk.register(require('keymaps/telescope'), params)
wk.register(require('keymaps/lsp'), params)
wk.register(require('keymaps/vim'), params)
wk.register(require('keymaps/buffer'), params)
wk.register(require('keymaps/treeview'), params)
wk.register(require('keymaps/project'), params)
wk.register(require('keymaps/git'), params)
wk.register(require('keymaps/dap'), params)
vim.api.nvim_set_keymap("n", "<S-k>", "<cmd>lua require'dap'.step_out()<CR>", {noremap = true})
vim.api.nvim_set_keymap("n", "<S-l>", "<cmd>lua require'dap'.step_into()<CR>", {noremap = true})
vim.api.nvim_set_keymap("n", "<S-j>", "<cmd>lua require'dap'.step_over()<CR>", {noremap = true})
|
require("brains/birchnutdrakebrain")
require "stategraphs/SGbirchnutdrake"
local assets =
{
Asset("ANIM", "anim/treedrake.zip"),
Asset("ANIM", "anim/treedrake_build.zip"),
}
local prefabs =
{
"acorn",
"twigs"
}
local function CanBeAttacked(inst, attacker)
return not inst.sg:HasStateTag("hidden") and (not attacker or (not attacker:HasTag("birchnutdrake") and not attacker:HasTag("birchnutroot") and not attacker:HasTag("birchnut")))
end
local function RetargetFn(inst)
if inst.sg:HasStateTag("hidden") then return end
return FindEntity(inst, inst.range and inst.range or TUNING.DECID_MONSTER_TARGET_DIST*1.5, function(guy)
return inst.components.combat:CanTarget(guy) and not guy:HasTag("wall") and not guy:HasTag("birchnutdrake")
end)
end
local function KeepTargetFn(inst, target)
if inst.sg:HasStateTag("exit") then return false end
if inst.sg:HasStateTag("hidden") then return true end
if target then
return distsq(inst:GetPosition(), target:GetPosition()) < 20*20
and not target.components.health:IsDead()
and inst.components.combat:CanTarget(target)
end
end
local function OnAttacked(inst, data)
inst.components.combat:SetTarget(data.attacker)
inst.components.combat:ShareTarget(data.attacker, 15, function(dude)
return dude:HasTag("birchnutdrake") and not dude.components.health:IsDead()
end, 10)
end
local function OnLostTarget(inst)
if not inst.sg:HasStateTag("hidden") and inst:GetTimeAlive() > 5 then
inst.sg:GoToState("exit")
end
end
local function Exit(inst)
if not inst.sg:HasStateTag("hidden") then
inst.sg:GoToState("exit")
end
end
local function Enter(inst)
if not inst.sg:HasStateTag("hidden") then
inst.sg:GoToState("enter")
end
end
local function fn()
local inst = CreateEntity()
local trans = inst.entity:AddTransform()
local anim = inst.entity:AddAnimState()
local sound = inst.entity:AddSoundEmitter()
local shadow = inst.entity:AddDynamicShadow()
shadow:SetSize(1.25, .75)
trans:SetFourFaced()
MakeCharacterPhysics(inst, 1, .25)
anim:SetBank("treedrake")
anim:SetBuild("treedrake_build")
anim:PlayAnimation("enter")
inst:AddTag("birchnutdrake")
inst:AddTag("monster")
inst:AddTag("scarytoprey")
inst:AddComponent("inspectable")
inst:AddComponent("lootdropper")
inst.components.lootdropper.numrandomloot = 1
inst.components.lootdropper:AddRandomLoot("acorn", .4)
inst.components.lootdropper:AddRandomLoot("twigs", .6)
inst:AddComponent("locomotor")
inst.components.locomotor.walkspeed = 3.5
inst:AddComponent("combat")
inst.components.combat:SetDefaultDamage(5)
inst.components.combat:SetRange(2.5, 3)
inst.components.combat:SetAttackPeriod(2)
inst.components.combat.canbeattackedfn = CanBeAttacked
inst.components.combat:SetRetargetFunction(1, RetargetFn)
inst.components.combat:SetKeepTargetFunction(KeepTargetFn)
inst.components.combat:SetHurtSound("dontstarve_DLC001/creatures/decidous/drake_hit")
inst:ListenForEvent("attacked", OnAttacked)
inst:DoTaskInTime(5, function(inst)
inst:ListenForEvent("losttarget", OnLostTarget)
end)
inst:AddComponent("health")
inst.components.health:SetMaxHealth(50)
inst:AddComponent("sleeper")
inst.components.sleeper.sleeptestfn = function() return false end
inst:AddComponent("knownlocations")
inst:SetStateGraph("SGbirchnutdrake")
inst:SetBrain(require("brains/birchnutdrakebrain"))
MakeSmallBurnableCharacter(inst, "treedrake_root", Vector3(0,-1,.1))
inst.components.burnable:SetBurnTime(10)
inst.components.health.fire_damage_scale = 2
inst:ListenForEvent("death", function(inst)
if inst.components.burnable and inst.components.burnable:IsBurning() then
inst:DoTaskInTime(.5, function(inst)
if inst.components.burnable and inst.components.burnable:IsBurning() then
inst.components.burnable:Extinguish()
end
end)
end
end)
inst.components.propagator.flashpoint = 5 + math.random()*3
MakeSmallFreezableCharacter(inst)
inst.Exit = Exit
inst.Enter = Enter
-- Enter(inst)
return inst
end
return Prefab("birchnutdrake", fn, assets, prefabs) |
local state = {}
state._NAME = ...
require'hcm'
local vector = require'vector'
local util = require'util'
local movearm = require'movearm'
local handle_pos, handle_yaw, handle_pitch, handle_radius, turnAngle=0,0,0,0,0
local lShoulderYaw, rShoulderYaw = 0,0
local stage = 1;
local qLArmTarget = Config.arm.qLArmInit[3]
local qRArmTarget = Config.arm.qRArmInit[3]
local trLArmTarget = Body.get_forward_larm(qLArmTarget)
local trRArmTarget = Body.get_forward_rarm(qRArmTarget)
local dqArmMax = Config.arm.slow_limit
local dpArmMax = Config.arm.linear_slow_limit
local dturnAngleMax = 3*math.pi/180 -- 3 deg per sec
function state.entry()
print(state._NAME..' Entry' )
-- Update the time of entry
local t_entry_prev = t_entry
t_entry = Body.get_time()
t_update = t_entry
-- Let's store wheel data here
local wheel = hcm.get_wheel_model()
turnAngle = hcm.get_wheel_turnangle()
handle_pos = vector.slice(wheel,1,3)
handle_yaw = wheel[4]
handle_pitch = wheel[5]
handle_radius = wheel[6]
lShoulderYaw = hcm.get_joints_qlshoulderyaw()
rShoulderYaw = hcm.get_joints_qrshoulderyaw()
--open gripper
Body.set_lgrip_percent(0)
Body.set_rgrip_percent(0)
-- Inner and outer radius
handle_radius0 = handle_radius
handle_radius1 = handle_radius + 0.04
stage = 1;
local pLWristTarget = Config.arm.pLWristTarget2
handle_pos0 = {0.24,0,-0.10} --waist position
handle_pos1 = {handle_pos[1],0,-0.10} --front
end
function state.update()
-- print(state._NAME..' Update' )
-- Get the time of update
local t = Body.get_time()
local dt = t - t_update
-- Save this at the last update time
t_update = t
--if t-t_entry > timeout then return'timeout' end
if stage==1 then --return to arm side-by-side position
turnAngle,doneA = util.approachTol(turnAngle,0,dturnAngleMax, dt )
--Adaptive shoulder yaw angle
ret = movearm.setArmToWheelPosition(
handle_pos, handle_yaw, handle_pitch,
handle_radius, turnAngle,dt)
if ret==1 and doneA then stage=stage+1;
end
elseif stage==2 then --Now spread arms apart
ret = movearm.setArmToWheelPosition(
handle_pos, handle_yaw, handle_pitch,
handle_radius1, turnAngle,dt
)
if ret==1 then stage=stage+1; end
elseif stage==3 then --Lower arms
ret = movearm.setArmToWheelPosition(
handle_pos1, handle_yaw, handle_pitch,
handle_radius1, turnAngle,dt
)
if ret==1 then stage=stage+1; end
elseif stage==4 then --Lower arms
ret = movearm.setArmToWheelPosition(
handle_pos0, handle_yaw, handle_pitch,
handle_radius1, turnAngle,dt
)
if ret==1 then stage=stage+1; end
else
--Straighten wrist
local qLArm = Body.get_larm_command_position()
local qRArm = Body.get_rarm_command_position()
dqWristMax=vector.new({0,0,0,0,
15*DEG_TO_RAD,15*DEG_TO_RAD,15*DEG_TO_RAD})
ret = movearm.setArmJoints(
{qLArm[1],qLArm[2],qLArm[3],qLArm[4],0,0,0},
{qRArm[1],qRArm[2],qRArm[3],qRArm[4],0,0,0},
dt,dqWristMax)
if ret==1 then return'done'
end
end
end
function state.exit()
print(state._NAME..' Exit' )
end
return state |
if vim.g.loaded_cmp then
return
end
vim.g.loaded_cmp = true
-- TODO: https://github.com/neovim/neovim/pull/14661
vim.cmd [[
augroup cmp
autocmd!
autocmd InsertEnter * lua require'cmp.utils.autocmd'.emit('InsertEnter')
autocmd InsertLeave * lua require'cmp.utils.autocmd'.emit('InsertLeave')
autocmd TextChangedI,TextChangedP * lua require'cmp.utils.autocmd'.emit('TextChanged')
autocmd CompleteChanged * lua require'cmp.utils.autocmd'.emit('CompleteChanged')
autocmd CompleteDone * lua require'cmp.utils.autocmd'.emit('CompleteDone')
augroup END
]]
|
-- Run at game start
function Initialize ()
end
-- Runs every 4 seconds, returns true when it should be added to questlog
function CheckStart ()
return false;
end
-- Runs again every 4 seconds once in the quest log
function Update ()
end
-- Not sure yet how these will work
function SaveData ()
end
function LoadData ()
end |
------------------------------------------------------------------
-- Functions
------------------------------------------------------------------
-- Get entity in front of player
function GetEntInFrontOfPlayer(Distance, Ped)
local Ent = nil
local CoA = GetEntityCoords(Ped, 1)
local CoB = GetOffsetFromEntityInWorldCoords(Ped, 0.0, Distance, 0.0)
local RayHandle = StartShapeTestRay(CoA.x, CoA.y, CoA.z, CoB.x, CoB.y, CoB.z, -1, Ped, 0)
local A,B,C,D,Ent = GetRaycastResult(RayHandle)
return Ent
end
-- Camera's coords
function GetCoordsFromCam(distance)
local rot = GetGameplayCamRot(2)
local coord = GetGameplayCamCoord()
local tZ = rot.z * 0.0174532924
local tX = rot.x * 0.0174532924
local num = math.abs(math.cos(tX))
newCoordX = coord.x + (-math.sin(tZ)) * (num + distance)
newCoordY = coord.y + (math.cos(tZ)) * (num + distance)
newCoordZ = coord.z + (math.sin(tX) * 8.0)
return newCoordX, newCoordY, newCoordZ
end
-- Get entity's ID and coords from where player sis targeting
function Target(Distance, Ped)
local Entity = nil
local camCoords = GetGameplayCamCoord()
local farCoordsX, farCoordsY, farCoordsZ = GetCoordsFromCam(Distance)
local RayHandle = StartShapeTestRay(camCoords.x, camCoords.y, camCoords.z, farCoordsX, farCoordsY, farCoordsZ, -1, Ped, 0)
local A,B,C,D,Entity = GetRaycastResult(RayHandle)
return Entity, farCoordsX, farCoordsY, farCoordsZ
end |
local systemTime = hs and hs.timer.secondsSinceEpoch or os.time
local t = systemTime()
-- can't simply iterate with five loops (though this does work for the 4th pwr version)
-- because answer may have 6 digits...
local ans = {}
local pwr = 5
local max = pwr * (9^pwr)
for i = 2, max, 1 do
local is, s2 = tostring(i), 0
for j = 1, #is, 1 do s2 = s2 + (tonumber(is:sub(j,j))^pwr) end
if s2 == i then table.insert(ans, s2) end
end
local sum = 0
for _, v in ipairs(ans) do sum = sum + v end
print(sum)
print(systemTime() - t)
print(inspect(ans))
t = systemTime()
ans = {}
for i = 2, max, 1 do
local i2, s2 = i, 0
repeat
local q, r = i2 // 10, i2 % 10
i2 = q
s2 = s2 + r^pwr
until q == 0
if s2 == i then table.insert(ans, s2) end
end
local sum = 0
for _, v in ipairs(ans) do sum = sum + v end
print(sum)
print(systemTime() - t)
print(inspect(ans))
|
object_tangible_collection_rebel_marine_left_bracer = object_tangible_collection_shared_rebel_marine_left_bracer:new {
gameObjectType = 8211,}
ObjectTemplates:addTemplate(object_tangible_collection_rebel_marine_left_bracer, "object/tangible/collection/rebel_marine_left_bracer.iff") |
registry = scene:GetRegistry()
pillars = {}
MAX_HEIGHT = 10.0
SPEED = 3.0
m_FurthestPillarPosX = 0
m_PillarTarget = 35.0
m_PillarIndex = 1
PLAYERTYPEID = 1
PILLARTYPEID = 2
local GameStates = {
Running=0,
GameOver=1
}
gameState = GameStates.Running
function beginContact(a, b)
gameState = GameStates.GameOver
end
function endContact(a, b, coll)
end
function preSolve(a, b, coll)
end
function postSolve(a, b, coll, normalimpulse, tangentimpulse)
end
player = {}
score = 0
function CreatePlayer()
colour = Vector4.new(1.0,1.0,1.0,1.0)
texture = LoadTextureWithParams("icon", "/CoreTextures/panda.png", TextureFilter.Linear, TextureWrap.Clamp)
player = registry:Create()
registry:assign_Sprite(player, Vector2.new(-1.0/2.0, -1.0/2.0), Vector2.new(1.15, 1.0), colour)
registry:get_Sprite(player):SetTexture(texture)
params = PhysicsObjectParamaters.new()
params.position = Vector3.new( 1.0, 1.0, 1.0)
params.scale = Vector3.new(1.0 / 2.0, 1.0 / 2.0, 1.0)
params.shape = Shape.Circle
params.isStatic = false
blockPhysics = CreatePhysics2DSharedWithParams(params)
blockPhysics:GetB2Body():SetLinearVelocity(b2Vec2(SPEED,0.0))
--blockPhysics:GetB2Body():SetUserData(1.0)
SetCallback(beginContact)
registry:assign_Physics2DComponent(player, blockPhysics)
registry:assign_Transform(player)
tran = registry:get_Transform(player)
tran:SetLocalPosition(Vector3.new(1.0,1.0,1.0))
end
function CreatePillar(index, offset)
pillars[index] = registry:Create();
pillars[index + 1] = registry:Create();
colour = Vector4.new(Rand(0.0, 1.0), Rand(0.0, 1.0), Rand(0.0, 1.0), 1.0);
gapSize = 4.0;
centre = Rand(-6.0, 6.0);
--Top Pillar
topY = MAX_HEIGHT;
bottomY = centre + (gapSize / 2.0);
pos = Vector3.new(offset / 2.0, ((topY - bottomY )/ 2.0) + bottomY, 0.0);
scale = Vector3.new(1.0, (topY - bottomY) / 2.0, 1.0);
texture = LoadTextureWithParams("icon", "/CoreTextures/icon.png", TextureFilter.Linear, TextureWrap.Clamp)
registry:assign_Sprite(pillars[index], Vector2.new(-scale.x, -scale.y), Vector2.new(scale.x * 2.0, scale.y * 2.0), colour)
registry:get_Sprite(pillars[index]):SetTexture(texture)
params = PhysicsObjectParamaters.new()
params.position = pos
params.scale = scale
params.shape = Shape.Square
params.isStatic = true
blockPhysics = CreatePhysics2DSharedWithParams(params)
-- blockPhysics:GetB2Body():SetUserData(2.0)
registry:assign_Physics2DComponent(pillars[index], blockPhysics)
registry:assign_Transform(pillars[index])
tran = registry:get_Transform(pillars[index])
tran:SetLocalPosition(pos)
--Bottom Pillar
topY = centre - (gapSize / 2.0)
bottomY = -MAX_HEIGHT;
pos = Vector3.new(offset / 2.0, ((topY - bottomY) / 2.0) + bottomY, 0.0)
scale = Vector3.new(1.0, (topY - bottomY) / 2.0, 1.0)
registry:assign_Sprite(pillars[index + 1], Vector2.new(-scale.x, -scale.y), Vector2.new(scale.x * 2.0, scale.y * 2.0), colour)
params.position = pos
params.scale = scale
params.shape = Shape.Square
params.isStatic = true
blockPhysics2 = CreatePhysics2DSharedWithParams(params)
--blockPhysics2:GetB2Body():SetUserData(2.0)
registry:assign_Physics2DComponent(pillars[index + 1], blockPhysics2)
registry:assign_Transform(pillars[index + 1])
tran = registry:get_Transform(pillars[index + 1])
tran:SetLocalPosition(pos)
if pos.x > m_FurthestPillarPosX then
m_FurthestPillarPosX = pos.x;
end
end
CreatePlayer()
for i=1,10, 2 do
CreatePillar(i, (i + 2) * 10.0)
end
backgroundTexture = LoadTextureWithParams("grass", "/CoreTextures/backgroundColorGrass.png", TextureFilter.Linear, TextureWrap.Clamp)
backgrounds = {}
function CreateBackground(index)
backgrounds[index] = registry:Create()
registry:assign_Sprite(backgrounds[index], Vector2.new(-10.0, -10.0), Vector2.new(10.0 * 2.0, 10.0 * 2.0), Vector4.new(1.0,1.0,1.0,1.0))
registry:get_Sprite(backgrounds[index]):SetTexture(backgroundTexture)
registry:assign_Transform(backgrounds[index])
registry:get_Transform(backgrounds[index]):SetLocalPosition(Vector3.new(index * 20.0 - 20.0, 0.0,0.0))
end
for i=1,50, 1 do
CreateBackground(i)
end
function OnUpdate(dt)
if gameState == GameStates.Running then
phys = registry:get_Physics2DComponent(player)
up = Vector3.new(0, 1, 0)
right = Vector3.new(1, 0, 0)
cameraSpeed = 1.0
velocity = Vector3.new(0.0, 0.0, 0.0)
if Input.GetKeyPressed( Key.Space ) then
velocity = velocity + up * cameraSpeed * 400.0
end
phys:GetPhysicsObject():GetB2Body():ApplyForce(b2Vec2(velocity.x,velocity.y), phys:GetPhysicsObject():GetB2Body():GetPosition(), true)
pos = registry:get_Transform(player):GetWorldPosition()
if pos.y > MAX_HEIGHT or pos.y < -MAX_HEIGHT then
gameState = GameStates.GameOver
end
pos.y = 0.0
scene:GetCamera():SetPosition(pos)
score = math.floor((registry:get_Transform(player):GetWorldPosition().x - 5) / 10)
if registry:get_Transform(player):GetWorldPosition().x > m_PillarTarget then
if pillars[m_PillarIndex] and registry:Valid(pillars[m_PillarIndex]) then
registry:Destroy(pillars[m_PillarIndex])
registry:Destroy(pillars[m_PillarIndex + 1])
end
CreatePillar(m_PillarIndex, m_FurthestPillarPosX * 2.0 + 20.0)
m_PillarIndex = m_PillarIndex + 2
m_PillarIndex = math.modf(m_PillarIndex, 10)
m_PillarTarget = m_PillarTarget + 10.0
end
if gameState == GameStates.Running then
gui.beginWindow("Running", gui.WindowFlags.NoDecoration)
gui.text("Score : ")
gui.sameLine()
gui.text(tostring(score))
gui.endWindow()
end
elseif gameState == GameStates.GameOver then
gui.beginWindow("GameOver")
gui.text("GameOver")
gui.text("Score : ")
gui.sameLine()
gui.text(tostring(score))
if gui.button("Reset") then
Reset();
end
gui.endWindow()
end
end
function Reset()
gameState = GameStates.Running
phys = registry:get_Physics2DComponent(player):GetPhysicsObject()
phys:SetPosition(Vector2.new(0.0, 0.0))
phys:SetLinearVelocity(Vector2.new(SPEED, 0.0))
phys:SetOrientation(0.0)
phys:SetAngularVelocity(0.0)
m_FurthestPillarPosX = 0.0
m_PillarTarget = 35.0
m_PillarIndex = 1
registry:get_Transform(player):SetLocalPosition(Vector3.new(0.0,0.0,0.0))
--registry:get_Transform(player):UpdateMatrices()
for i=1,10, 2 do
if registry:Valid(pillars[i]) then
registry:Destroy(pillars[i]);
registry:Destroy(pillars[i + 1]);
end
CreatePillar(i, (i + 2) * 10.0)
end
end
function OnCleanUp()
backgroundTexture = nil
texture = nil
blockPhysics = nil
blockPhysics2 = nill
registry:Destroy(player)
end
|
local apparent_power = {
['VA'] = {
['name'] = {
['singular'] = 'Volt-Ampere',
['plural'] = 'Volt-Amperes'
},
['to_anchor'] = 1
},
['mVA'] = {
['name'] = {
['singular'] = 'Millivolt-Ampere',
['plural'] = 'Millivolt-Amperes'
},
['to_anchor'] = .001
},
['kVA'] = {
['name'] = {
['singular'] = 'Kilovolt-Ampere',
['plural'] = 'Kilovolt-Amperes'
},
['to_anchor'] = 1000
},
['MVA'] = {
['name'] = {
['singular'] = 'Megavolt-Ampere',
['plural'] = 'Megavolt-Amperes'
},
['to_anchor'] = 1000000
},
['GVA'] = {
['name'] = {
['singular'] = 'Gigavolt-Ampere',
['plural'] = 'Gigavolt-Amperes'
},
['to_anchor'] = 1000000000
}
}
return {
['metric'] = apparent_power,
['_anchors'] = {
['metric'] = {
['unit'] = 'VA',
['ratio'] = 1
}
}
} |
local K, C, L = unpack(select(2, ...))
local Module = K:NewModule("BlockMovies", "AceEvent-3.0")
local _G = _G
local C_Map_GetBestMapForUnit = C_Map.GetBestMapForUnit
local CreateFrame = _G.CreateFrame
local GetItemCooldown = _G.GetItemCooldown
local playerName = _G.UnitName("player")
local playerRealm = _G.GetRealmName()
do
-- Movie blocking
local knownMovies = {
[16] = true, -- Lich King death
[73] = true, -- Ultraxion death
[74] = true, -- DeathwingSpine engage
[75] = true, -- DeathwingSpine death
[76] = true, -- DeathwingMadness death
[152] = true, -- Garrosh defeat
[294] = true, -- Archimonde portal
[295] = true, -- Archimonde kill
[549] = true, -- Gul'dan kill
[656] = true, -- Kil'jaeden kill
[682] = true, -- L'uras death
[686] = true, -- Argus portal
[688] = true, -- Argus kill
}
function Module:PLAY_MOVIE(_, id)
if knownMovies[id] and C["Automation"].BlockMovies then
if KkthnxUIData[playerRealm][playerName].WatchedMovies[id] then
K.Print(L["Automation"].MovieBlocked)
MovieFrame:Hide()
else
KkthnxUIData[playerRealm][playerName].WatchedMovies[id] = true
end
end
end
end
-- Cinematic skipping hack to workaround an item (Vision of Time) that creates cinematics in Siege of Orgrimmar.
do
-- Cinematic blocking
local cinematicZones = {
[-367] = true, -- Firelands bridge lowering
[-437] = true, -- Gate of the Setting Sun gate breach
[-510] = true, -- Tortos cave entry -- Doesn't work, apparently Blizzard don't want us to skip this..?
[-514] = true, -- Ra-Den room opening
[-557] = true, -- After Immerseus, entry to Fallen Protectors
[-563] = true, -- Blackfuse room opening, just outside the door
[-564] = true, -- Blackfuse room opening, in Thok area
[-567] = true, -- Mythic Garrosh Phase 4
[-573] = true, -- Bloodmaul Slag Mines, activating bridge to Roltall
[-575] = true, -- Shadowmoon Burial Grounds, final boss introduction
[-593] = {false, -1, true}, -- Auchindoun has 2 cinematics. One before the 1st boss (false) and one after the 3rd boss (true), 2nd arg is garbage for the iterator to work.
[-607] = true, -- Grimrail Depot, boarding the train
[-609] = true, -- Grimrail Depot, destroying the train
[-612] = true, -- Highmaul, Kargath Death
[-706] = true, -- Maw of Souls, after Ymiron
[-855] = true, -- Tomb of Sargeras, portal to Kil'jaeden
[-909] = true, -- Antorus, teleportation to "The exhaust"
[-914] = true, -- Antorus, teleportation to "The burning throne"
[-917] = true, -- Antorus, magni portal to argus room
[-1004] = true, -- Kings' Rest, before the last boss "Dazar"
}
function Module:SiegeOfOrgrimmarCinematics()
local hasItem
for i = 105930, 105935 do -- Vision of Time items
local _, _, cd = GetItemCooldown(i)
if cd > 0 then hasItem = true end -- Item is found in our inventory
end
if hasItem and not self.SiegeOfOrgrimmarCinematicsFrame then
local tbl = {[149370] = true, [149371] = true, [149372] = true, [149373] = true, [149374] = true, [149375] = true}
self.SiegeOfOrgrimmarCinematicsFrame = CreateFrame("Frame")
self.SiegeOfOrgrimmarCinematicsFrame:SetScript("OnEvent", function(_, _, _, _, _, _, spellId)
if tbl[spellId] then
Module:UnregisterEvent("CINEMATIC_START")
Module:ScheduleTimer("RegisterEvent", 10, "CINEMATIC_START")
end
end)
self.SiegeOfOrgrimmarCinematicsFrame:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", "player")
end
end
function Module:CINEMATIC_START()
if C["Automation"].BlockMovies then
local id = -(C_Map_GetBestMapForUnit("player") or 0)
if cinematicZones[id] then
if type(cinematicZones[id]) == "table" then -- For zones with more than 1 cinematic per floor
if type(KkthnxUIData[playerRealm][playerName].WatchedMovies[id]) ~= "table" then
KkthnxUIData[playerRealm][playerName].WatchedMovies[id] = {}
end
for i=#cinematicZones[id], 1, -1 do -- In reverse so for example: we don't trigger off the first boss when at the third boss
local _, _, done = C_Scenario.GetCriteriaInfoByStep(1,i)
if done == cinematicZones[id][i] then
if KkthnxUIData[playerRealm][playerName].WatchedMovies[id][i] then
K.Print(L["Automation"].MovieBlocked)
CinematicFrame_CancelCinematic()
else
KkthnxUIData[playerRealm][playerName].WatchedMovies[id][i] = true
end
return
end
end
else
if KkthnxUIData[playerRealm][playerName].WatchedMovies[id] then
K.Print(L["Automation"].MovieBlocked)
CinematicFrame_CancelCinematic()
else
KkthnxUIData[playerRealm][playerName].WatchedMovies[id] = true
end
end
end
end
end
end
function Module:OnEnable()
if C["Automation"].BlockMovies ~= true then
return
end
self:RegisterEvent("CINEMATIC_START")
self:RegisterEvent("PLAY_MOVIE")
self:SiegeOfOrgrimmarCinematics() -- Sexy hack until cinematics have an id system (never)
end
function Module:OnDisable()
self:UnregisterEvent("CINEMATIC_START")
self:UnregisterEvent("PLAY_MOVIE")
end
|
include "scenario/scripts/misc.lua"
--- Service for time properties
TimeService = {}
---- MONTH ----
--- Get current month
--- @return float
function TimeService.getMonth ()
return getCurrentMonth()
end
---- TIME ----
--- Get current time of day
--- @return float
function TimeService.getTime ()
return getCurrentTimeOfDay()
end
--- Get real time
--- @return float
function TimeService.getRealTime ()
return getRealTime()
end
--- Get sim time
--- @return float
function TimeService.getSimTime ()
return getCurrentSimTime()
end |
local function MakeZombieSoundsAsHobo(ply)
if ply:EntIndex() == 0 then return end
if not ply.nospamtime then
ply.nospamtime = CurTime() - 2
end
if not RPExtraTeams[ply:Team()] or not RPExtraTeams[ply:Team()].hobo or CurTime() < (ply.nospamtime + 1.3) or (IsValid(ply:GetActiveWeapon()) and ply:GetActiveWeapon():GetClass() ~= "weapon_bugbait") then
return
end
ply.nospamtime = CurTime()
local ran = math.random(1,3)
if ran == 1 then
ply:EmitSound("npc/zombie/zombie_voice_idle"..tostring(math.random(1,14))..".wav", 100,100)
elseif ran == 2 then
ply:EmitSound("npc/zombie/zombie_pain"..tostring(math.random(1,6))..".wav", 100,100)
elseif ran == 3 then
ply:EmitSound("npc/zombie/zombie_alert"..tostring(math.random(1,3))..".wav", 100,100)
end
end
concommand.Add("_hobo_emitsound", MakeZombieSoundsAsHobo) |
local player = ...
local _x = _screen.cx + (player==PLAYER_1 and -1 or 1) * SL_WideScale(292.5, 342.5)
return Def.ActorFrame{
InitCommand=function(self)
self:xy(_x, 56)
end,
-- colored background for player's chart's difficulty meter
Def.Quad{
InitCommand=function(self)
self:zoomto(30, 30)
end,
CurrentSongChangedMessageCommand=function(self) self:queuecommand("Begin") end,
BeginCommand=function(self)
local currentSteps = GAMESTATE:GetCurrentSteps(player)
if currentSteps then
local currentDifficulty = currentSteps:GetDifficulty()
self:diffuse(DifficultyColor(currentDifficulty))
end
end
},
-- player's chart's difficulty meter
LoadFont("Common Bold")..{
InitCommand=function(self)
self:diffuse( Color.Black )
self:zoom( 0.4 )
end,
CurrentSongChangedMessageCommand=function(self) self:queuecommand("Begin") end,
BeginCommand=function(self)
local steps = GAMESTATE:GetCurrentSteps(player)
local meter = steps:GetMeter()
if meter then
self:settext(meter)
end
end
}
} |
-- Natural Selection 2 'Classic Entities Mod'
-- Adds some additional entities inspired by Half-Life 1 and the Extra Entities Mod by JimWest - https://github.com/JimWest/ExtraEntitesMod
-- Designed to work with maps developed for Extra Entities Mod.
-- Source located at - https://github.com/xToken/ClassicEnts
-- lua\ClassicEnts_Server.lua
-- Dragon
Script.Load("lua/ClassicEnts_Shared.lua")
Script.Load("lua/ClassicEnts/ControlledTeleporter.lua")
Script.Load("lua/ClassicEnts/ControlledTimedEmitter.lua")
Script.Load("lua/ClassicEnts/EmitterMultiplier.lua")
Script.Load("lua/ClassicEnts/ExtendedSignals.lua")
Script.Load("lua/ClassicEnts/FunctionListener.lua")
Script.Load("lua/ClassicEnts/PathingWaypoint.lua")
kFrontDoorEntityTimer = 360
kSiegeDoorEntityTimer = 1500
local kMapNameTranslationTable =
{
["func_door"] = "controlled_moveable",
["frontdoor"] = "controlled_moveable",
["siegedoor"] = "controlled_moveable",
["func_moveable"] = "controlled_moveable",
["func_platform"] = "controlled_moveable",
["func_train_waypoint"] = "pathing_waypoint",
["logic_button"] = "controlled_button_emitter",
["logic_multiplier"] = "emitter_multiplier",
["logic_emitter"] = "emitter_multiplier",
["logic_switch"] = "emitter_multiplier",
["logic_listener"] = "emitter_multiplier",
["logic_weldable"] = "controlled_weldable_emitter",
["logic_timer"] = "controlled_timed_emitter",
["logic_dialogue"] = "controlled_dialog_listener",
["logic_worldtooltip"] = "controlled_dialog_listener",
["logic_function"] = "function_listener",
["teleport_trigger"] = "controlled_teleporter",
["teleport_destination"] = "controlled_teleporter",
["logic_breakable"] = "breakable_emitter",
["push_trigger"] = "controlled_pusher"
}
local function DumpServerEntity(mapName, groupName, values)
Print("------------ %s ------------", ToString(mapName))
for key, value in pairs(values) do
Print("[%s] %s", ToString(key), ToString(value))
end
Print("---------------------------------------------")
end
local oldGetLoadEntity = GetLoadEntity
function GetLoadEntity(mapName, groupName, values)
if mapName == "lua_loader" or mapName == "logic_lua" then
if values["luaFile"] and GetFileExists(values["luaFile"]) then
Script.Load(values["luaFile"])
end
return false
end
-- Check translation table
if kMapNameTranslationTable[mapName] then
-- DumpServerEntity(mapName, groupName, values)
values["oldMapName"] = mapName
mapName = kMapNameTranslationTable[mapName]
local entity = Server.CreateEntity(mapName, values)
if entity then
entity:SetMapEntity()
-- Map Entities with LiveMixin can be destroyed during the game.
if HasMixin(entity, "Live") then
-- Store values for reset
table.insert(Server.mapLoadLiveEntityValues, {mapName, groupName, values})
-- Store ent ID to delete
table.insert(Server.mapLiveEntities, entity:GetId())
end
end
return false
end
return oldGetLoadEntity(mapName, groupName, values)
end
gDebugClassicEnts = false
local function OnCommandDebugCents(client)
gDebugClassicEnts = not gDebugClassicEnts
Shared.Message(string.format("Classic Entities Debug messages set to %s.", gDebugClassicEnts and "Enabled" or "Disabled"))
end
Event.Hook("Console_classicentsdebug", OnCommandDebugCents)
Event.Hook("Console_centsdebug", OnCommandDebugCents) |
--------------------------------
-- @module ZQScriptHandler
-- @parent_module zq
--------------------------------
--
-- @function [parent=#ZQScriptHandler] valid
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#ZQScriptHandler] ZQScriptHandler
-- @param self
-- @return ZQScriptHandler#ZQScriptHandler self (return value: zq.ZQScriptHandler)
return nil
|
-- action.lua
-- metroidvanian platformer game
-- N.P.Thompson 2021 (MIT license)
-- noahpthomp@gmail.com
require "unit"
action=
{
-- entity moves through space, determined by velocity
translate = function(entity, frames)
entity:move((entity.velocity * frames)"xy")
end,
} |
--- Point module
-- @module point
local current_folder = (...):gsub('%.[^%.]+$', '') .. "."
local point = {}
local function new(x, y)
return setmetatable({
x, y
}, point)
end
point.__index = point
point.__call = function(_, ...) return new(...) end
--- Rotate a point, optionally about another point.
-- @param point Table with two points as {x, y}
-- @param rotation Radian amount to rotate
-- @param[opt=0] offset_x Point to rotate about
-- @param[optchain=0] offset_y offset_y Point to rotatea about
-- @return New point rotated counter-clockwise
function point.rotate(point, rotation, offset_x, offset_y)
offset_x, offset_y = offset_x or 0, offset_y or 0
local x, y = unpack(point)
local distance_x, distance_y = x - offset_x, y - offset_y
local cos, sin = math.cos(rotation), math.sin(rotation)
return new(distance_x * cos + offset_x - distance_y * sin, distance_x * sin + distance_y * cos + offset_y)
end
--- Scale a point a point, optionally about another point.
-- @param point Table with two points as {x, y}
-- @param scale Number or Table in the form of scale or {scaleX [, scaleY=scaleX]}
-- @param[opt=0] offset_x Point to scale about
-- @param[optchain=0] offset_y Point to scale about
-- @return New scaled point
function point.scale(point, scale, offset_x, offset_y)
local scale_x, scale_y
if type( scale ) == 'table' then
scale_x, scale_y = unpack(scale)
scale_y = scale_y or scale_x
elseif type( scale ) == 'number' then
scale_x, scale_y = scale, scale
end
offset_x, offset_y = offset_x or 0, offset_y or 0
local x, y = unpack(point)
return new((x - offset_x) * scale_x + offset_x, (y - offset_y) * scale_y + offset_y)
end
--- Translate a point.
-- @param point Table with two points as {x, y}
-- @param distance_x Distance to translate along the x-axis
-- @param distance_y Distance to translate along the y-axis
-- @return Translated point
function point.translate(point, distance_x, distance_y)
return new(point[1] + distance_x, point[2] + distance_y)
end
--- Print point.
-- @param point Table with two numbers as {x, y}
-- @return "[ x, y ]"
function point.__tostring(point)
return string.format( "[ %d, %d ]", point[1], point[2] )
end
local function ispoint( p )
return p[1] and p[2]
end
--- Add points.
-- @param a Table with two numbers as {x, y} or a number
-- @param b Table with two numbers as {x, y} or a number
-- @return Translated point
function point.__add(a, b)
if type(a) == "number" then
return point.translate(b, a, a)
elseif type(b) == "number" then
return point.translate(a, b, b)
else
assert(ispoint(a) and ispoint(b), "Add: wrong argument types (<point> expected)")
return point.translate(a, b[1], b[2])
end
end
--- Subtract points.
-- @param a Table with two numbers as {x, y} or a number
-- @param b Table with two numbers as {x, y} or a number
-- @return Translated point
function point.__sub(a, b)
if type(a) == "number" then
return point.translate(b, -a, -a)
elseif type(b) == "number" then
return point.translate(a, -b, -b)
else
assert(ispoint(a) and ispoint(b), "Subtract: wrong argument types (<point> expected)")
return point.translate(a, -b[1], -b[2])
end
end
--- Multiply points.
-- @param a Table with two numbers as {x, y} or amount to scale
-- @param b Table with two numbers as {x, y} or amount to scale
-- @return Scaled point
function point.__mul(a, b)
if type(a) == "number" then
return point.scale(b, a)
elseif type(b) == "number" then
return point.scale(a, b)
end
error( "Multiply: cannot multiply two points" )
end
--- Convert point from polar to cartesian.
-- @param radius Radius of the point
-- @param theta Angle of the point
-- @param[opt=0] offset_radius Distance from origin
-- @param[optchain=0] offset_theta Angle for offset
-- @return Converted point
function point.from_polar(radius, theta, offset_radius, offset_theta)
local offset_x, offset_y = 0, 0
if offset_radius and offset_theta then
offset_x, offset_y = point.from_polar(offset_radius, offset_theta)
end
return new(radius * math.cos(theta) + offset_x, radius * math.sin(theta) + offset_y)
end
--- Convert point from cartesian to polar.
-- @param point Table with two numbers as {x, y}
-- @param[opt=0] offset_x Horizontal offset
-- @param[optchain=0] offset_y Vertical offset
-- @return Table in the form {radius, theta}
function point.to_polar(point, offset_x, offset_y)
local offset_x, offset_y = offset_x or 0, offset_y or 0
local x, y = point[1] - offset_x, point[2] - offset_y
local theta = math.atan2(y, x)
-- Convert to absolute angle
theta = theta > 0 and theta or theta + 2 * math.pi
local radius = math.sqrt(x ^ 2 + y ^ 2)
return {radius, theta}
end
return setmetatable({new = new}, point)
|
for line in io.lines(arg[1]) do
local a, n, p, l = {}, 0, 0, 2
for i in line:gmatch("%d+") do
a[#a+1] = tonumber(i)
end
n, a[#a] = a[#a], nil
for i = 1, n do
p, l = l, 0
for j = p, #a do
if a[j] < a[j-1] then
a[j], a[j-1] = a[j-1], a[j]
l = j > 2 and j - 1 or 3
break
end
end
if l == 0 then break end
end
print(table.concat(a, " "))
end
|
local K, C = unpack(select(2, ...))
if C["Party"].Enable ~= true then
return
end
local Module = K:GetModule("Unitframes")
local oUF = oUF or K.oUF
if not oUF then
K.Print("Could not find a vaild instance of oUF. Stopping Party.lua code!")
return
end
local _G = _G
local select = _G.select
local CreateFrame = _G.CreateFrame
local UnitIsUnit = _G.UnitIsUnit
function Module:CreateParty()
local UnitframeFont = K.GetFont(C["UIFonts"].UnitframeFonts)
local UnitframeTexture = K.GetTexture(C["UITextures"].UnitframeTextures)
local HealPredictionTexture = K.GetTexture(C["UITextures"].HealPredictionTextures)
self.Overlay = CreateFrame("Frame", nil, self) -- We will use this to overlay onto our special borders.
self.Overlay:SetAllPoints()
self.Overlay:SetFrameLevel(6)
Module.CreateHeader(self)
self.Health = CreateFrame("StatusBar", nil, self)
self.Health:SetHeight(18)
self.Health:SetPoint("TOPLEFT")
self.Health:SetPoint("TOPRIGHT")
self.Health:SetStatusBarTexture(UnitframeTexture)
self.Health:CreateBorder()
self.Health.PostUpdate = C["General"].PortraitStyle.Value ~= "ThreeDPortraits" and Module.UpdateHealth
self.Health.colorDisconnected = true
self.Health.colorSmooth = false
self.Health.colorClass = true
self.Health.colorReaction = true
self.Health.frequentUpdates = true
K.SmoothBar(self.Health)
self.Health.Value = self.Health:CreateFontString(nil, "OVERLAY")
self.Health.Value:SetPoint("CENTER", self.Health, "CENTER", 0, 0)
self.Health.Value:SetFontObject(UnitframeFont)
self.Health.Value:SetFont(select(1, self.Health.Value:GetFont()), 10, select(3, self.Health.Value:GetFont()))
self:Tag(self.Health.Value, "[KkthnxUI:HealthCurrent-Percent]")
self.Power = CreateFrame("StatusBar", nil, self)
self.Power:SetHeight(10)
self.Power:SetPoint("TOPLEFT", self.Health, "BOTTOMLEFT", 0, -6)
self.Power:SetPoint("TOPRIGHT", self.Health, "BOTTOMRIGHT", 0, -6)
self.Power:SetStatusBarTexture(UnitframeTexture)
self.Power:CreateBorder()
self.Power.colorPower = true
self.Power.SetFrequentUpdates = true
K.SmoothBar(self.Power)
self.Name = self:CreateFontString(nil, "OVERLAY")
self.Name:SetPoint("TOP", self.Health, 0, 16)
self.Name:SetWidth(self.Health:GetWidth())
self.Name:SetFontObject(UnitframeFont)
self.Name:SetWordWrap(false)
self:Tag(self.Name, "[KkthnxUI:Leader][KkthnxUI:GetNameColor][KkthnxUI:NameMedium]")
if C["General"].PortraitStyle.Value == "ThreeDPortraits" then
self.Portrait = CreateFrame("PlayerModel", nil, self.Health)
self.Portrait:SetFrameStrata(self:GetFrameStrata())
self.Portrait:SetSize(self.Health:GetHeight() + self.Power:GetHeight() + 6, self.Health:GetHeight() + self.Power:GetHeight() + 6)
self.Portrait:SetPoint("TOPLEFT", self, "TOPLEFT", 0 ,0)
self.Portrait:CreateBorder()
self.Portrait:CreateInnerShadow()
elseif C["General"].PortraitStyle.Value ~= "ThreeDPortraits" then
self.Portrait = self.Health:CreateTexture("PlayerPortrait", "BACKGROUND", nil, 1)
self.Portrait:SetTexCoord(0.15, 0.85, 0.15, 0.85)
self.Portrait:SetSize(self.Health:GetHeight() + self.Power:GetHeight() + 6, self.Health:GetHeight() + self.Power:GetHeight() + 6)
self.Portrait:SetPoint("TOPLEFT", self, "TOPLEFT", 0 ,0)
self.Portrait.Border = CreateFrame("Frame", nil, self)
self.Portrait.Border:SetAllPoints(self.Portrait)
self.Portrait.Border:CreateBorder()
self.Portrait.Border:CreateInnerShadow()
if (C["General"].PortraitStyle.Value == "ClassPortraits" or C["General"].PortraitStyle.Value == "NewClassPortraits") then
self.Portrait.PostUpdate = Module.UpdateClassPortraits
end
end
self.Health:ClearAllPoints()
self.Health:SetPoint("TOPLEFT", self.Portrait:GetWidth() + 6, 0)
self.Health:SetPoint("TOPRIGHT")
self.Level = self:CreateFontString(nil, "OVERLAY")
self.Level:SetPoint("TOP", self.Portrait, 0, 15)
self.Level:SetFontObject(UnitframeFont)
self:Tag(self.Level, "[KkthnxUI:DifficultyColor][KkthnxUI:SmartLevel][KkthnxUI:ClassificationColor][shortclassification]")
if C["Party"].ShowBuffs then
self.Buffs = CreateFrame("Frame", self:GetName().."Buffs", self)
self.Buffs:SetHeight(18)
self.Buffs:SetWidth(108)
self.Buffs:SetPoint("TOPLEFT", self.Power, "BOTTOMLEFT", 0, -6)
self.Buffs.size = 18
self.Buffs.num = 4
self.Buffs.spacing = 6
self.Buffs.initialAnchor = "TOPLEFT"
self.Buffs["growth-y"] = "DOWN"
self.Buffs["growth-x"] = "RIGHT"
self.Buffs.PostCreateIcon = Module.PostCreateAura
self.Buffs.PostUpdateIcon = Module.PostUpdateAura
self.Buffs.CustomFilter = Module.CustomAuraFilter.Blacklist
end
self.Debuffs = CreateFrame("Frame", self:GetName().."Debuffs", self)
self.Debuffs:SetHeight(18)
self.Debuffs:SetWidth(92)
self.Debuffs:SetPoint("LEFT", self.Health, "RIGHT", 6, 0)
self.Debuffs.size = 18
self.Debuffs.num = 5
self.Debuffs.spacing = 6
self.Debuffs.initialAnchor = "TOPLEFT"
self.Debuffs["growth-y"] = "DOWN"
self.Debuffs["growth-x"] = "RIGHT"
self.Debuffs.PostCreateIcon = Module.PostCreateAura
self.Debuffs.PostUpdateIcon = Module.PostUpdateAura
--self.Debuffs.CustomFilter = Module.AurasFilter.BlackList
if (C["Party"].Castbars) then
self.Castbar = CreateFrame("StatusBar", "PartyCastbar", self)
self.Castbar:SetStatusBarTexture(UnitframeTexture)
self.Castbar:SetClampedToScreen(true)
self.Castbar:CreateBorder()
self.Castbar:ClearAllPoints()
self.Castbar:SetPoint("TOPLEFT", 24, 22)
self.Castbar:SetPoint("TOPRIGHT", 0, 22)
self.Castbar:SetHeight(16)
self.Castbar.Spark = self.Castbar:CreateTexture(nil, "OVERLAY")
self.Castbar.Spark:SetTexture(C["Media"].Spark_128)
self.Castbar.Spark:SetSize(128, self.Castbar:GetHeight())
self.Castbar.Spark:SetBlendMode("ADD")
self.Castbar.Time = self.Castbar:CreateFontString(nil, "OVERLAY", UnitframeFont)
self.Castbar.Time:SetFont(select(1, self.Castbar.Time:GetFont()), 11, select(3, self.Castbar.Time:GetFont()))
self.Castbar.Time:SetPoint("RIGHT", -3.5, 0)
self.Castbar.Time:SetTextColor(0.84, 0.75, 0.65)
self.Castbar.Time:SetJustifyH("RIGHT")
self.Castbar.decimal = "%.2f"
self.Castbar.OnUpdate = Module.OnCastbarUpdate
self.Castbar.PostCastStart = Module.PostCastStart
self.Castbar.PostChannelStart = Module.PostCastStart
self.Castbar.PostCastStop = Module.PostCastStop
self.Castbar.PostChannelStop = Module.PostChannelStop
self.Castbar.PostCastFailed = Module.PostCastFailed
self.Castbar.PostCastInterrupted = Module.PostCastFailed
self.Castbar.PostCastInterruptible = Module.PostUpdateInterruptible
self.Castbar.PostCastNotInterruptible = Module.PostUpdateInterruptible
self.Castbar.Text = self.Castbar:CreateFontString(nil, "OVERLAY", UnitframeFont)
self.Castbar.Text:SetFont(select(1, self.Castbar.Text:GetFont()), 11, select(3, self.Castbar.Text:GetFont()))
self.Castbar.Text:SetPoint("LEFT", 3.5, 0)
self.Castbar.Text:SetPoint("RIGHT", self.Castbar.Time, "LEFT", -3.5, 0)
self.Castbar.Text:SetTextColor(0.84, 0.75, 0.65)
self.Castbar.Text:SetJustifyH("LEFT")
self.Castbar.Text:SetWordWrap(false)
self.Castbar.Button = CreateFrame("Frame", nil, self.Castbar)
self.Castbar.Button:SetSize(16, 16)
self.Castbar.Button:CreateBorder()
self.Castbar.Icon = self.Castbar.Button:CreateTexture(nil, "ARTWORK")
self.Castbar.Icon:SetSize(self.Castbar:GetHeight(), self.Castbar:GetHeight())
self.Castbar.Icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
self.Castbar.Icon:SetPoint("RIGHT", self.Castbar, "LEFT", -6, 0)
self.Castbar.Button:SetAllPoints(self.Castbar.Icon)
end
-- -- HealPredictionAndAbsorb
-- local mhpb = self.Health:CreateTexture(nil, "BORDER", nil, 5)
-- mhpb:SetWidth(1)
-- mhpb:SetTexture(HealPredictionTexture)
-- mhpb:SetVertexColor(0, 1, 0.5, 0.25)
-- local ohpb = self.Health:CreateTexture(nil, "BORDER", nil, 5)
-- ohpb:SetWidth(1)
-- ohpb:SetTexture(HealPredictionTexture)
-- ohpb:SetVertexColor(0, 1, 0, 0.25)
-- local abb = self.Health:CreateTexture(nil, "BORDER", nil, 5)
-- abb:SetWidth(1)
-- abb:SetTexture(HealPredictionTexture)
-- abb:SetVertexColor(1, 1, 0, 0.25)
-- local abbo = self.Health:CreateTexture(nil, "ARTWORK", nil, 1)
-- abbo:SetAllPoints(abb)
-- abbo:SetTexture("Interface\\RaidFrame\\Shield-Overlay", true, true)
-- abbo.tileSize = 32
-- local oag = self.Health:CreateTexture(nil, "ARTWORK", nil, 1)
-- oag:SetWidth(15)
-- oag:SetTexture("Interface\\RaidFrame\\Shield-Overshield")
-- oag:SetBlendMode("ADD")
-- oag:SetAlpha(.7)
-- oag:SetPoint("TOPLEFT", self.Health, "TOPRIGHT", -5, 2)
-- oag:SetPoint("BOTTOMLEFT", self.Health, "BOTTOMRIGHT", -5, -2)
-- local hab = CreateFrame("StatusBar", nil, self.Health)
-- hab:SetPoint("TOP")
-- hab:SetPoint("BOTTOM")
-- hab:SetPoint("RIGHT", self.Health:GetStatusBarTexture())
-- hab:SetWidth(124)
-- hab:SetReverseFill(true)
-- hab:SetStatusBarTexture(HealPredictionTexture)
-- hab:SetStatusBarColor(1, 0, 0, 0.25)
-- local ohg = self.Health:CreateTexture(nil, "ARTWORK", nil, 1)
-- ohg:SetWidth(15)
-- ohg:SetTexture("Interface\\RaidFrame\\Absorb-Overabsorb")
-- ohg:SetBlendMode("ADD")
-- ohg:SetPoint("TOPRIGHT", self.Health, "TOPLEFT", 5, 2)
-- ohg:SetPoint("BOTTOMRIGHT", self.Health, "BOTTOMLEFT", 5, -2)
-- self.HealPredictionAndAbsorb = {
-- myBar = mhpb,
-- otherBar = ohpb,
-- absorbBar = abb,
-- absorbBarOverlay = abbo,
-- overAbsorbGlow = oag,
-- healAbsorbBar = hab,
-- overHealAbsorbGlow = ohg,
-- maxOverflow = 1,
-- }
self.StatusIndicator = self.Power:CreateFontString(nil, "OVERLAY")
self.StatusIndicator:SetPoint("CENTER", 0, 0.5)
self.StatusIndicator:SetFontObject(UnitframeFont)
self.StatusIndicator:SetFont(select(1, self.StatusIndicator:GetFont()), 10, select(3, self.StatusIndicator:GetFont()))
self:Tag(self.StatusIndicator, "[KkthnxUI:Status]")
if (C["Party"].TargetHighlight) then
self.HighlightOverlayFrame = CreateFrame("Frame", nil, self)
self.HighlightOverlayFrame:SetPoint("TOPLEFT", self.Portrait, -2, 2)
self.HighlightOverlayFrame:SetPoint("BOTTOMRIGHT", self.Portrait, 2, -2)
self.HighlightOverlayFrame:SetFrameLevel(7) -- Will always be above since 3D = 5 and Class and Default = 4
self.TargetHighlight = self.HighlightOverlayFrame:CreateTexture(nil, "OVERLAY")
self.TargetHighlight:SetTexture("Interface\\Buttons\\CheckButtonHilight")
self.TargetHighlight:SetBlendMode("ADD")
self.TargetHighlight:SetVertexColor(0.84, 0.75, 0.65)
self.TargetHighlight:SetPoint("TOPLEFT", self.Portrait, -2, 2)
self.TargetHighlight:SetPoint("BOTTOMRIGHT", self.Portrait, 2, -2)
self.TargetHighlight:Hide()
local function UpdatePartyTargetGlow()
if UnitIsUnit("target", self.unit) then
self.TargetHighlight:Show()
else
self.TargetHighlight:Hide()
end
end
self:RegisterEvent("PLAYER_TARGET_CHANGED", UpdatePartyTargetGlow, true)
end
self.ReadyCheckIndicator = self.Health:CreateTexture(nil, "OVERLAY")
self.ReadyCheckIndicator:SetSize(20, 20)
self.ReadyCheckIndicator:SetPoint("LEFT", 0, 0)
if C["Party"].PortraitTimers then
self.PortraitTimer = CreateFrame("Frame", "$parentPortraitTimer", self.Health)
self.PortraitTimer:CreateInnerShadow()
self.PortraitTimer:SetFrameLevel(6) -- Watch me
self.PortraitTimer:SetInside(self.Portrait, 1, 1)
self.PortraitTimer:Hide()
end
self.PhaseIndicator = self:CreateTexture(nil, "OVERLAY")
self.PhaseIndicator:SetSize(22, 22)
self.PhaseIndicator:SetPoint("LEFT", self.Health, "RIGHT", 1, 0)
self.RaidTargetIndicator = self.Overlay:CreateTexture(nil, "OVERLAY")
self.RaidTargetIndicator:SetPoint("TOP", self.Portrait, "TOP", 0, 8)
self.RaidTargetIndicator:SetSize(14, 14)
self.ResurrectIndicator = self.Overlay:CreateTexture(nil, "OVERLAY")
self.ResurrectIndicator:SetSize(28, 28)
self.ResurrectIndicator:SetPoint("CENTER", self.Portrait)
self.OfflineIcon = self.Overlay:CreateTexture(nil, "OVERLAY")
self.OfflineIcon:SetSize(self.Portrait:GetWidth() + 14, self.Portrait:GetHeight() + 14)
self.OfflineIcon:SetPoint("CENTER", self.Portrait)
if C["Unitframe"].DebuffHighlight then
self.DebuffHighlight = self.Health:CreateTexture(nil, "OVERLAY")
self.DebuffHighlight:SetAllPoints(self.Health)
self.DebuffHighlight:SetTexture(C["Media"].Blank)
self.DebuffHighlight:SetVertexColor(0, 0, 0, 0)
self.DebuffHighlight:SetBlendMode("ADD")
self.DebuffHighlightAlpha = 0.45
self.DebuffHighlightFilter = true
self.DebuffHighlightFilterTable = K.DebuffHighlightColors
end
self.Range = {
insideAlpha = 1,
outsideAlpha = 0.3
}
end |
-- Copyright (c) 2021 榆柳松
-- https://github.com/wzhengsen/LuaOOP
-- 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 Config = require("OOP.Config");
local LuaVersion = Config.LuaVersion;
local unpack = LuaVersion < 5.2 and unpack or table.unpack;
local pcall = pcall;
local error = error;
local is = Config.is;
local i18n = require("OOP.i18n");
local Internal = require("OOP.Variant.Internal");
local AccessStack = Internal.AccessStack;
local AllFunctions = Internal.ClassesAllFunctions;
local ConstStack = Internal.ConstStack;
local AccessStackLen = AccessStack and #AccessStack or nil;
local ConstStackLen = ConstStack and #ConstStack or nil;
---
---Wrapping the given function so that it handles the push and pop of the access stack correctly anyway,
---to avoid the access stack being corrupted by an error being thrown in one of the callbacks.
---@param cls table
---@param f function
---@param clsFunctions? table
---@param const? boolean
---@return function
---
local function FunctionWrapper(cls,f,clsFunctions,const)
clsFunctions = clsFunctions or AllFunctions[cls];
local newF = clsFunctions[f];
if nil == newF then
newF = function(...)
AccessStackLen = AccessStackLen + 1;
AccessStack[AccessStackLen] = cls;
ConstStackLen = ConstStackLen + 1;
ConstStack[ConstStackLen] = const or false;
if ConstStackLen > 1 and ConstStack[ConstStackLen - 1] and not const then
local lastCls = AccessStack[ConstStackLen - 1];
if lastCls ~= 0 and cls ~= 0 and lastCls[is](cls) then
AccessStack[AccessStackLen] = nil;
AccessStackLen = AccessStackLen - 1;
ConstStack[ConstStackLen] = nil;
ConstStackLen = ConstStackLen - 1;
error(i18n"Cannot call a non-const method on a const method.");
return;
end
end
local ret = {pcall(f,...)};
AccessStack[AccessStackLen] = nil;
AccessStackLen = AccessStackLen - 1;
ConstStack[ConstStackLen] = nil;
ConstStackLen = ConstStackLen - 1;
if not ret[1] then
error(ret[2]);
end
return unpack(ret,2);
end;
clsFunctions[newF] = newF;
clsFunctions[f] = newF;
end
return newF;
end
local BreakFunctions = setmetatable({},Internal.WeakTable);
local function BreakFunctionWrapper(f)
-- 0 means that any access permissions can be broken.
return FunctionWrapper(0,f,BreakFunctions);
end
return {
FunctionWrapper = FunctionWrapper,
BreakFunctionWrapper = BreakFunctionWrapper
}; |
local command = "opt"
local desc = ''
local Eff = require 'solstice.effect'
local chat = require 'ta.chat'
local function action(info)
local opt, optvar
local pc = info.speaker
local act = info.param:split(' ')
if not act then return end
if act[1] == "dragshape" then
if act[2] == 'kin' then
opt, optvar = 1, "pc:dragshape"
elseif act[2] == 'drag' then
opt, optvar = 0, "pc:dragshape"
end
elseif act[1] == "helm" then
local nval
if act[2] == 'show' then
nval = 0
pc:SuccessMessage("Helmet Unhidden!")
elseif act[2] == 'hide' then
nval = 1
pc:SuccessMessage("Helmet Hidden! Note: you may need to reequip for the effect to work.")
else
pc:ErrorMessage("Invalid option!")
return
end
pc:SetLocalInt("NWNX_HELM_HIDDEN", nval)
pc:SetPlayerInt("pc:helm", nval)
return
elseif act[1] == "enhanced" then
if act[2] == 'off' then
pc:SetPlayerInt("pc:enhanced", 0, true)
pc:SuccessMessage("Your login is no longer flagged as being enhanced!")
return
elseif act[2] == 'basic' then
pc:SetPlayerInt("pc:enhanced", 1, true)
pc:SuccessMessage("Your login is now flagged enhanced at the basic level! Please relog to see all content.")
return
elseif act[2] == 'full' then
local enhanced = pc:GetPlayerInt("pc:enhanced", true)
pc:SetPlayerInt("pc:enhanced", 2, true)
if enhanced <= 1 then
pc:SuccessMessage("Your login is now flagged fully enhanced! Please relog to see all content.")
else
pc:SuccessMessage("Your login is now flagged with the current HAK version.")
end
local mod = Game.GetModule()
pc:SetPlayerInt("pc:hak_version", mod:GetLocalInt("HAK_VERSION"), true)
return
end
elseif act[1] == "appear" then
if act [2] == 'off' then
if pc:GetPlayerInt("pc:style_dragon") > 0
or pc:GetPlayerInt("pc:style_undead") > 0
then
local race = pc:GetRacialType()
pc:SetCreatureAppearanceType(pc:GetDefaultAppearance(race))
pc:SuccessMessage("Appearance reverted!")
return
end
end
elseif act[1] == "anims" then
if act [2] == 'off' then
pc:SetPhenoType(PHENOTYPE_NORMAL)
pc:SuccessMessage("Animations reverted!")
end
return
-- todo[josh] Add anims on option.
elseif act[1] == "noblock" then
if act[2] == 'off' then
opt, optvar = 0, "pc:block"
pc:RemoveEffectsByType(EFFECT_TYPE_CUTSCENEGHOST)
pc:SuccessMessage("You will now block on creatures!")
elseif act[2] == 'on' then
opt, optvar = 1, "pc:block"
pc:RemoveEffectsByType(EFFECT_TYPE_CUTSCENEGHOST)
pc:ApplyEffect(4, Eff.CutsceneGhost())
pc:SuccessMessage("You will no longer block on creatures!")
end
end
if opt and optvar then
pc:SetPlayerInt(optvar, opt)
else
pc:ErrorMessage("Invalid option!")
end
end
chat.RegisterCommand(CHAT_SYMBOL_GENERAL, command, action, desc)
|
function vec(x, y)
return {x, y}
end
v=vec
--dot��ʾͶӰ����
function dot(v1, v2)
return v1[1]*v2[1] + v1[2]*v2[2]
end
--normalize��ʾ��ģ����
function normalize(v)
local mag = math.sqrt(v[1]^2 + v[2]^2)
return vec(v[1]/mag, v[2]/mag)
end
--perp��ʾ���㷨����
function perp(v)
return {v[2],-v[1]}
end
--segment��ʾ�߶Σ�ͳһ�����ú�����ֵĵ��ǰ����ֵĵ�
function segment(a, b)
local obj = {a=a, b=b, dir={b[1] - a[1], b[2] - a[2]}}
obj[1] = obj.dir[1]; obj[2] = obj.dir[2]
return obj
end
--polugon��ʾ����Σ���������vertices�ͱ�edges
function polygon(vertices)
local obj = {}
obj.vertices = vertices
obj.edges = {}
for i=1,#vertices,1 do
table.insert(obj.edges, segment(vertices[i], vertices[1+i%(#vertices)]))
end
return obj
end
--projectΪ����ͶӰ����
function project(a, axis)
axis = normalize(axis)
local min = dot(a.vertices[1],axis)
local max = min
for i,v in ipairs(a.vertices) do
local proj = dot(v, axis) -- projection
if proj < min then min = proj end
if proj > max then max = proj end
end
return {min, max}
end
function contains(n, range)
local a, b = range[1], range[2]
if b < a then a = b; b = range[1] end
return n >= a and n <= b
end
--�ж������߶��Ƿ��غ�
function overlap(a_, b_)
if contains(a_[1], b_) then return true
elseif contains(a_[2], b_) then return true
elseif contains(b_[1], a_) then return true
elseif contains(b_[2], a_) then return true
end
return false
end
--ʵ���㷨�ĺ���
function sat(a, b)
for i,v in ipairs(a.edges) do
local axis = perp(v)
local a_, b_ = project(a, axis), project(b, axis)
if not overlap(a_, b_) then return false end
end
for i,v in ipairs(b.edges) do
local axis = perp(v)
local a_, b_ = project(a, axis), project(b, axis)
if not overlap(a_, b_) then return false end
end
return true
end
a=polygon{v(0,0),v(0,1),v(1,0)}
b=polygon{v(3,0),v(3,2),v(4,0),v(4,2)}
print(sat(a,b))
|
debug = true
colors = {}
function Initialize()
dofile(SKIN:MakePathAbsolute('Extra\\Scripts\\HSBLib.lua'))
colors.scrubber_cursor_hue,colors.scrubber_cursor_sat = RGBtoHSB(SKIN:GetVariable('colorBorder'))
SetRGB(SKIN:GetVariable('baseColor'))
end
function Update() end
function GetColor(key) return colors[key] or 0 end
function SetScrubbers()
-- HSB
colors.scrubber_hue_0 = string.format('%s,%s,%s', HSBtoRGB((0/6), colors.cur_sat, colors.cur_bri))
colors.scrubber_hue_60 = string.format('%s,%s,%s', HSBtoRGB((1/6), colors.cur_sat, colors.cur_bri))
colors.scrubber_hue_120 = string.format('%s,%s,%s', HSBtoRGB((2/6), colors.cur_sat, colors.cur_bri))
colors.scrubber_hue_180 = string.format('%s,%s,%s', HSBtoRGB((3/6), colors.cur_sat, colors.cur_bri))
colors.scrubber_hue_240 = string.format('%s,%s,%s', HSBtoRGB((4/6), colors.cur_sat, colors.cur_bri))
colors.scrubber_hue_300 = string.format('%s,%s,%s', HSBtoRGB((5/6), colors.cur_sat, colors.cur_bri))
colors.scrubber_hue_360 = string.format('%s,%s,%s', HSBtoRGB((6/6), colors.cur_sat, colors.cur_bri))
colors.scrubber_sat_left = string.format('%s,%s,%s', HSBtoRGB(colors.cur_hue, 0, colors.cur_bri))
colors.scrubber_sat_right = string.format('%s,%s,%s', HSBtoRGB(colors.cur_hue, 1, colors.cur_bri))
colors.scrubber_bri_left = string.format('%s,%s,%s', HSBtoRGB(colors.cur_hue, colors.cur_sat, 0))
colors.scrubber_bri_right = string.format('%s,%s,%s', HSBtoRGB(colors.cur_hue, colors.cur_sat, 1))
colors.scrubber_cursor = string.format('%s,%s,%s', HSBtoRGB(colors.scrubber_cursor_hue, colors.scrubber_cursor_sat, (1 - Clamp(ColorLumens(string.format('%s,%s,%s', HSBtoRGB(colors.cur_hue, colors.cur_sat, colors.cur_bri))),45,50) / 100)))
-- RGB
colors.scrubber_r_left = string.format('%s,%s,%s', 0, colors.cur_g, colors.cur_b)
colors.scrubber_r_right = string.format('%s,%s,%s', 255, colors.cur_g, colors.cur_b)
colors.scrubber_g_left = string.format('%s,%s,%s', colors.cur_r, 0, colors.cur_b)
colors.scrubber_g_right = string.format('%s,%s,%s', colors.cur_r, 255, colors.cur_b)
colors.scrubber_b_left = string.format('%s,%s,%s', colors.cur_r, colors.cur_g, 0)
colors.scrubber_b_right = string.format('%s,%s,%s', colors.cur_r, colors.cur_g, 255)
-- Display
colors.disp_hue = string.format('%.0f', Round((colors.cur_hue * 360), 0))
colors.disp_sat = string.format('%.0f', Round((colors.cur_sat * 100), 0))
colors.disp_bri = string.format('%.0f', Round((colors.cur_bri * 100), 0))
colors.disp_hsb = string.format('%s,%s,%s', colors.disp_hue, colors.disp_sat, colors.disp_bri)
-- PrintTable(colors)
end
function SetRGB(...)
if arg.n == 1 then
colors.cur_rgb = arg[1]
colors.cur_r, colors.cur_g, colors.cur_b = string.match(colors.cur_rgb, '(%d+),(%d+),(%d+)')
else
colors['cur_' .. arg[1]] = arg[3] and arg[2] or Round(Clamp((SKIN:ParseFormula(arg[2]) * 255),0,255),0)
colors.cur_rgb = string.format('%s,%s,%s', colors.cur_r, colors.cur_g, colors.cur_b)
end
colors.cur_hue, colors.cur_sat, colors.cur_bri = RGBtoHSB(colors.cur_rgb)
colors.cur_hsb = string.format('%s,%s,%s', colors.cur_hue, colors.cur_sat, colors.cur_bri)
colors.cur_hex = RGBtoHEX(colors.cur_r, colors.cur_g, colors.cur_b)
SetScrubbers()
SKIN:Bang('!UpdateMeterGroup', 'ColorMeters')
SKIN:Bang('!Redraw')
end
function SetHSB(...)
if arg.n == 1 then
colors.cur_hsb = arg[1]
else
colors['cur_' .. arg[1]] = Clamp(SKIN:ParseFormula(arg[2]),0,1)
colors.cur_hsb = string.format('%s,%s,%s', colors.cur_hue, colors.cur_sat, colors.cur_bri)
end
colors.cur_rgb = string.format('%s,%s,%s', HSBtoRGB(colors.cur_hue, colors.cur_sat, colors.cur_bri))
colors.cur_hex = RGBtoHEX(colors.cur_r, colors.cur_g, colors.cur_b)
SetScrubbers()
SKIN:Bang('!UpdateMeterGroup', 'ColorMeters')
SKIN:Bang('!Redraw')
end
function SetHEX(value)
SetRGB(string.format('%s,%s,%s', HEXtoRGB(value)))
end
function ChangeRGB(key, delta)
SetRGB(key, Clamp(colors['cur_' .. key] + delta, 0, 255), true)
end
function ChangeHSB(key, delta)
SetHSB(key, Clamp(colors['cur_' .. key] + delta, 0, 1))
end
-- function to make logging messages less cluttered
function RmLog(message, type)
if type == nil then type = 'Debug' end
if debug == true then
SKIN:Bang("!Log", message, type)
elseif type ~= 'Debug' then
SKIN:Bang("!Log", message, type)
end
end
printIndent = ' '
-- prints the entire contents of a table to the Rainmeter log
function PrintTable(table)
for k,v in pairs(table) do
if type(v) == 'table' then
local pI = printIndent
RmLog(printIndent .. tostring(k) .. ':')
printIndent = printIndent .. ' '
PrintTable(v)
printIndent = pI
else
RmLog(printIndent .. tostring(k) .. ': ' .. tostring(v))
end
end
end |
--
-- modules/vstudio/tests/cs2005/test_nuget_framework_folders.lua
-- Validate parsing of framework versions from folder names for
-- Visual Studio 2010 and newer
-- Copyright (c) 2017 Jason Perkins and the Premake project
--
local p = premake
local suite = test.declare("vstudio_cs2005_nuget_framework_folders")
local cs2005 = p.vstudio.cs2005
function suite.net()
test.isequal(cs2005.frameworkVersionForFolder("net451"), "4510000000")
test.isequal(cs2005.frameworkVersionForFolder("net45"), "4500000000")
test.isequal(cs2005.frameworkVersionForFolder("net20"), "2000000000")
test.isequal(cs2005.frameworkVersionForFolder("net35"), "3500000000")
test.isequal(cs2005.frameworkVersionForFolder("net"), "0000000000")
end
function suite.numeric()
test.isequal(cs2005.frameworkVersionForFolder("10"), "1000000000")
test.isequal(cs2005.frameworkVersionForFolder("11"), "1100000000")
test.isequal(cs2005.frameworkVersionForFolder("20"), "2000000000")
test.isequal(cs2005.frameworkVersionForFolder("45"), "4500000000")
end
function suite.numericWithDots()
test.isequal(cs2005.frameworkVersionForFolder("1.0"), "1000000000")
test.isequal(cs2005.frameworkVersionForFolder("1.1"), "1100000000")
test.isequal(cs2005.frameworkVersionForFolder("2.0"), "2000000000")
test.isequal(cs2005.frameworkVersionForFolder("4.5"), "4500000000")
end
function suite.invalid()
test.isnil(cs2005.frameworkVersionForFolder("netstandard1.3"))
test.isnil(cs2005.frameworkVersionForFolder("sl4"))
test.isnil(cs2005.frameworkVersionForFolder("sl5"))
test.isnil(cs2005.frameworkVersionForFolder("uap10"))
test.isnil(cs2005.frameworkVersionForFolder("wp8"))
test.isnil(cs2005.frameworkVersionForFolder("wp71"))
end
|
Panels.Panel = {}
local gfx <const> = playdate.graphics
local ScreenHeight <const> = playdate.display.getHeight()
local ScreenWidth <const> = playdate.display.getWidth()
local AxisHorizontal = Panels.ScrollAxis.HORIZONTAL
local function createFrameFromPartialFrame(frame)
if frame.margin == nil then frame.margin = Panels.Settings.defaultFrame.margin end
if frame.width == nil then
frame.width = ScreenWidth - frame.margin * 2
end
if frame.height == nil then
frame.height = ScreenHeight - frame.margin * 2
end
if frame.x == nil then
frame.x = frame.margin
end
if frame.y == nil then
frame.y = frame.margin
end
if frame.gap == nil then
frame.gap = Panels.Settings.defaultFrame.gap
end
return frame
end
local function getScrollPercentages(frame, offset, axis)
local xPct = 1 - (frame.x - frame.margin + frame.width + offset.x) / (ScreenWidth + frame.width)
local yPct = 1 - (frame.y - frame.margin + frame.height + offset.y) / (ScreenHeight + frame.height)
local pct = {x = xPct, y = yPct}
if axis == AxisHorizontal then pct.y = 0.5 else pct.x = 0.5 end
return pct
end
local function calculateShake(strength)
return {
x = math.random(-strength, strength),
y = math.random(-strength, strength)
}
end
local function doLayerEffect(layer)
if layer.effect.type == Panels.Effect.BLINK then
if layer.timer == nil then
if layer.effect.delay then
layer.visible = false
layer.timer = playdate.timer.new(layer.effect.delay)
layer.timer.repeats = false
else
layer.timer = playdate.timer.new(layer.effect.durations.on + layer.effect.durations.off)
layer.timer.repeats = true
end
else
if layer.effect.delay then
if layer.timer.currentTime >= layer.effect.delay then
layer.effect.delay = false
layer.timer = playdate.timer.new(layer.effect.durations.on + layer.effect.durations.off)
layer.timer.repeats = true
end
else
if layer.timer.currentTime < layer.effect.durations.on then
if layer.visible == false then
layer.visible = true
if layer.sfxPlayer then
layer.sfxPlayer:play()
end
end
else
layer.visible = false
end
end
end
end
end
function Panels.Panel.new(data)
local panel = table.shallowcopy(data)
panel.prevPct = 0
panel.frame = createFrameFromPartialFrame(panel.frame)
panel.buttonsPressed = {}
panel.canvas = gfx.image.new(panel.frame.width, panel.frame.height, gfx.kColorBlack)
if not panel.parallaxDistance then
if panel.axis == Panels.ScrollAxis.HORIZONTAL then
panel.parallaxDistance = panel.frame.width * 1.2
else
panel.parallaxDistance = panel.frame.height * 1.2
end
end
if panel.panels then
for i, p in ipairs(panel.panels) do
panel.panels[i] = Panels.Panel.new(p)
end
end
local imageFolder = Panels.Settings.imageFolder
if panel.showAdvanceControl then
panel.advanceButton = Panels.ButtonIndicator.new()
panel.advanceButton:setButton(panel.advanceControl)
if panel.advanceControlPosition then
panel.advanceButton:setPosition(panel.advanceControlPosition.x, panel.advanceControlPosition.y)
else
panel.advanceButton:setPositionForScrollDirection(panel.direction)
end
end
if panel.layers then
for i, layer in ipairs(panel.layers) do
if layer.image then
layer.img, error = Panels.Image.get(imageFolder .. layer.image)
printError(error, "Error loading image on layer")
end
if layer.images then
layer.imgs = {}
layer.currentImage = 1
for j, image in ipairs(layer.images) do
layer.imgs[j], error = Panels.Image.get(imageFolder .. image)
printError(error, "Error loading images["..j.."] on layer")
end
end
if layer.imageTable then
local imgTable, error = gfx.imagetable.new(Panels.Settings.imageFolder .. layer.imageTable)
printError(error, "Error loading imagetable on layer")
local anim = gfx.animation.loop.new(layer.delay or 200, imgTable, layer.loop or false)
anim.paused = true
if layer.scrollTrigger == nil then layer.scrollTrigger = 0 end
layer.animationLoop = anim
end
if layer.x == nil then layer.x = -panel.frame.margin end
if layer.y == nil then layer.y = -panel.frame.margin end
if layer.visible == nil then layer.visible = true end
layer.alpha = layer.opacity or nil
if layer.effect then
if layer.effect.type == Panels.Effect.BLINK and layer.effect.audio then
layer.sfxPlayer = playdate.sound.sampleplayer.new(Panels.Settings.audioFolder .. layer.effect.audio.file)
end
if playdate.getReduceFlashing()
and layer.effect.type == Panels.Effect.BLINK
and layer.effect.reduceFlashingDurations ~= nil
then
layer.effect.durations.on = layer.effect.reduceFlashingDurations.on
layer.effect.durations.off = layer.effect.reduceFlashingDurations.off
end
end
if layer.animate then
if layer.animate.delay == nil then layer.animate.delay = 0 end
if layer.animate.duration then
if layer.animate.duration < 1 then layer.animate.duration = 1 end
end
if layer.animate.autoStart then layer.animate.scrollTrigger = 0 end
if layer.animate.scrollTrigger and layer.animate.duration == nil then
layer.animate.duration = 200
end
if layer.opacity == nil then layer.opacity = 1 end
if layer.animate.trigger then
layer.animate.triggerSequence = {layer.animate.trigger}
end
if layer.animate.audio then
layer.sfxPlayer = playdate.sound.sampleplayer.new(Panels.Settings.audioFolder .. layer.animate.audio.file)
end
end
end
end
if panel.audio then
panel.sfxPlayer = playdate.sound.sampleplayer.new(Panels.Settings.audioFolder .. panel.audio.file)
if panel.audio.pan then
panel.sfxPlayer:setVolume(1 - panel.audio.pan, panel.audio.pan)
end
panel.sfxTrigger = panel.audio.scrollTrigger or 0
end
function panel:isOnScreen(offset)
local isOn = false
local f = self.frame
if f.x + offset.x <= ScreenWidth and f.x + f.width + offset.x > 0 and
f.y + offset.y <= ScreenHeight and f.y + f.height+ offset.y > 0 then
isOn = true
end
return isOn
end
function panel:fadePanelVolume(pct)
local vol = 1
if pct < 0.25 then
vol = pct / 0.25
elseif pct > 0.75 then
vol = (1 - pct) / 0.25
end
local leftPan = self.audio.volume or 1
local rightPan = self.audio.volume or 1
if self.audio.pan then
leftPan = 1 - self.audio.pan
rightPan = self.audio.pan
end
self.sfxPlayer:setVolume(vol * leftPan, vol * rightPan)
end
function panel:pauseSounds()
if self.sfxPlayer then
self.soundIsPaused = true
self.sfxPlayer:setPaused(true)
end
end
function panel:unPauseSounds()
if self.sfxPlayer then
self.soundIsPaused = false
self.sfxPlayer:setPaused(false)
end
end
function panel:updatePanelAudio(pct)
local count = panel.audio.repeatCount or 1
if panel.audio.loop then count = 0 end
if self.audio.triggerSequence then
if self.audioTriggersPressed == nil then self.audioTriggersPressed = {} end
local triggerButton = self.audio.triggerSequence[#self.audioTriggersPressed + 1]
if playdate.buttonJustPressed(triggerButton) then
self.audioTriggersPressed[#self.audioTriggersPressed+1] = triggerButton
if #self.audioTriggersPressed == #self.audio.triggerSequence then
playdate.timer.performAfterDelay(self.audio.delay or 0, function ()
self.sfxPlayer:play(count)
end)
end
end
elseif (pct < 1 and pct >= self.sfxTrigger) and (self.prevPct <= self.sfxTrigger or self.audio.loop) then
if not self.sfxPlayer:isPlaying() and not self.soundIsPaused then
self.sfxPlayer:play(count)
end
end
self:fadePanelVolume(pct)
end
function panel:layerShouldShake(layer)
local result = false
if self.effect and (self.effect.type == Panels.Effect.SHAKE_UNISON or self.effect.type == Panels.Effect.SHAKE_INDIVIDUAL) then
result = true
end
if layer.effect and layer.effect.type == Panels.Effect.SHAKE then
result = true
end
return result
end
function panel:drawLayers(offset)
local layers = self.layers
local frame = self.frame
local shake
local pct = getScrollPercentages(frame, offset, self.axis)
local cntrlPct
if self.axis == AxisHorizontal then cntrlPct = pct.x else cntrlPct = pct.y end
if self.scrollingIsReversed then cntrlPct = 1-cntrlPct end
if self.effect then
if self.effect.type == Panels.Effect.SHAKE_UNISON then
shake = calculateShake(self.effect.strength)
end
end
if self.sfxPlayer then
self:updatePanelAudio(cntrlPct)
end
if layers then
for i, layer in ipairs(layers) do
local p = layer.parallax or 0
local xPos = math.floor(layer.x + (self.parallaxDistance * pct.x - self.parallaxDistance/2) * p)
local yPos = math.floor(layer.y + (self.parallaxDistance * pct.y - self.parallaxDistance/2) * p)
local rotation = 0
if layer.animate then
local anim = layer.animate
if (anim.triggerSequence or anim.scrollTrigger ~= nil) and not layer.animator then
if layer.buttonsPressed == nil then layer.buttonsPressed = {} end
local triggerButton = nil
if not anim.scrollTrigger then
triggerButton = anim.triggerSequence[#layer.buttonsPressed + 1]
end
if anim.scrollTrigger ~= nil or playdate.buttonJustPressed(triggerButton) then
layer.buttonsPressed[#layer.buttonsPressed+1] = triggerButton
if (anim.scrollTrigger ~= nil and cntrlPct >= anim.scrollTrigger) or (anim.triggerSequence and #layer.buttonsPressed == #anim.triggerSequence) then
layer.animator = gfx.animator.new((anim.duration or 200), 0, 1, anim.ease, anim.delay)
if layer.sfxPlayer then
local count = anim.audio.repeatCount or 1
if anim.audio.loop then count = 0 end
playdate.timer.performAfterDelay(anim.delay + (anim.audio.delay or 0), function ()
layer.sfxPlayer:play(count)
end)
end
end
end
else
local layerPct = cntrlPct
if layer.animator then
layerPct = layer.animator:currentValue()
end
if anim.x then xPos = math.floor(xPos + ((anim.x - layer.x) * layerPct)) end
if anim.y then yPos = math.floor(yPos + ((anim.y - layer.y) * layerPct)) end
if anim.rotation then rotation = anim.rotation * layerPct end
if anim.opacity then
local o = (anim.opacity - layer.opacity) * layerPct
layer.alpha = o
if o <= 0 then
layer.visible = false
else
layer.visible = true
end
end
end
end
if self:layerShouldShake(layer) then
if self.effect and self.effect.type == Panels.Effect.SHAKE_INDIVIDUAL then
shake = calculateShake(self.effect.strength or 2)
elseif layer.effect and layer.effect.type == Panels.Effect.SHAKE then
shake = calculateShake(layer.effect.strength or 2)
end
xPos = xPos + shake.x * (1-p*p)
yPos = yPos + shake.y * (1-p*p)
end
if layer.effect then
doLayerEffect(layer, xPos, yPos)
end
local img
if layer.img then
img = layer.img
elseif layer.imgs then
if layer.advanceControl then
if playdate.buttonJustPressed(layer.advanceControl) then
if layer.currentImage < #layer.imgs then
layer.currentImage = layer.currentImage + 1
end
end
img = layer.imgs[layer.currentImage]
else
local p = cntrlPct
p = p - (self.transitionOffset or 0)
local j = math.max(math.min(math.ceil(p * #layer.imgs), #layer.imgs), 1)
img = layer.imgs[j]
end
end
if img then
if layer.visible then
if layer.alpha and layer.alpha < 1 then
img:drawFaded(xPos, yPos, layer.alpha, playdate.graphics.image.kDitherTypeBayer8x8)
else
img:draw(xPos, yPos)
end
end
elseif layer.text then
if layer.visible then
if layer.alpha == nil or layer.alpha > 0.5 then
self:drawTextLayer(layer, xPos, yPos, cntrlPct)
end
end
elseif layer.animationLoop then
if layer.visible then
if cntrlPct >= layer.scrollTrigger then
layer.animationLoop.paused = false
end
layer.animationLoop:draw(xPos, yPos)
end
end
end
end
self.prevPct = cntrlPct
end
function panel:reset()
if self.resetFunction then
self:resetFunction()
end
self:killTypingEffects()
if self.sfxPlayer then
self.sfxPlayer:stop()
end
if self.layers then
for i, layer in ipairs(self.layers) do
if layer.animationLoop then
layer.animationLoop.frame = 1
-- local f = layer.animationLoop.frame -- force frame update (bug in 1.3.1)
layer.animationLoop.paused = true
end
if layer.animator then
layer.animator = nil
end
if layer.opacity then
layer.alpha = layer.opacity
else
layer.alpha = nil
end
if layer.sfxPlayer then
layer.sfxPlayer:stop()
end
if layer.textAnimator then
layer.textAnimator = nil
end
if layer.images then
layer.currentImage = 1
end
layer.buttonsPressed = nil
layer.visible = true
end
end
self.buttonsPressed = {}
self.audioTriggersPressed = {}
self.advanceControlTimerDidEnd = false
self.advanceControlTimer = nil
if self.prevPct > 0.5 then
self.prevPct = 1
else
self.prevPct = 0
end
end
function startLayerTypingSound(layer)
if layer.isTyping then
Panels.Audio.startTypingSound()
end
end
function panel:drawTextLayer(layer, xPos, yPos, cntrlPct)
gfx.pushContext()
if layer.font then
gfx.setFont(Panels.Font.get(layer.font))
elseif self.font then
gfx.setFont(Panels.Font.get(self.font))
end
local txt = layer.text
if layer.effect then
if layer.effect.type == Panels.Effect.TYPE_ON then
if layer.textAnimator == nil then
if layer.effect.scrollTrigger == nil or cntrlPct >= layer.effect.scrollTrigger then
layer.isTyping = true
layer.textAnimator = gfx.animator.new(layer.effect.duration or 500, 0, string.len(layer.text), playdate.easingFunctions.linear, layer.effect.delay or 0)
playdate.timer.performAfterDelay(layer.effect.delay or 0, startLayerTypingSound, layer)
else
txt = ""
end
end
if layer.isTyping then
local j = math.ceil(layer.textAnimator:currentValue())
txt = string.sub(layer.text, 1, j)
if txt == layer.text then
layer.isTyping = false
Panels.Audio.stopTypingSound()
end
end
end
end
if layer.background then
local w, h = gfx.getTextSize(txt)
gfx.setColor(layer.background)
if layer.background == Panels.Color.BLACK then
gfx.setImageDrawMode(gfx.kDrawModeFillWhite)
end
if w > 0 and h > 0 then
gfx.fillRect(xPos - 4, yPos - 1, w + 8, h + 2 )
end
end
if layer.color == Panels.Color.WHITE then
gfx.setImageDrawMode(gfx.kDrawModeFillWhite)
end
if layer.rect then
gfx.drawTextInRect(txt, xPos, yPos, layer.rect.width, layer.rect.height, layer.lineHeightAdjustment or 0, "...", layer.alignment or Panels.TextAlignment.LEFT)
else
gfx.drawText(txt, xPos, yPos)
end
gfx.popContext()
end
function panel:drawBorder(color, bgColor)
local frameW = self.frame.width
local frameH = self.frame.height
local borderW = Panels.Settings.borderWidth
local b = gfx.image.new(frameW, frameH)
local matte = gfx.image.new(frameW, frameH)
gfx.pushContext(matte)
-- create the corner matte
gfx.setColor(bgColor)
gfx.setLineWidth(borderW)
gfx.fillRect(0, 0, frameW, frameH)
gfx.setColor(Panels.Color.invert(bgColor))
gfx.fillRoundRect(0, 0, frameW, frameH, Panels.Settings.borderRadius)
gfx.popContext()
gfx.pushContext(b)
-- draw corner matte with center transparency
if bgColor == Panels.Color.WHITE then
gfx.setImageDrawMode(gfx.kDrawModeBlackTransparent)
else
gfx.setImageDrawMode(gfx.kDrawModeWhiteTransparent)
end
matte:draw(0,0)
gfx.setLineWidth(borderW)
gfx.setColor(color)
gfx.drawRoundRect(borderW/2, borderW/2, frameW- borderW, frameH -borderW, Panels.Settings.borderRadius)
gfx.popContext()
return b
end
local shouldAutoAdvance = false
function panel:shouldAutoAdvance()
if self.advanceFunction then
return self:advanceFunction()
else
return false
end
end
function panel:killTypingEffects()
if self.layers then
for i, l in ipairs(self.layers) do
if l.isTyping then
l.isTyping = false
Panels.Audio.stopTypingSound()
end
if l.textAnimator then
l.textAnimator = nil
end
end
end
end
function panel:updateAdvanceButton()
if self.advanceButton.state == "hidden" then
if self.advanceControlPosition and self.advanceControlPosition.delay and self.advanceControlTimer == nil then
self.advanceControlTimer = playdate.timer.new(self.advanceControlPosition.delay, nil)
elseif self.advanceControlPosition == nil or self.advanceControlPosition.delay == nil or (self.advanceControlTimer and self.advanceControlTimer.currentTime >= self.advanceControlTimer.duration) then
if not self.advanceControlTimerDidEnd then
self.advanceButton:show()
self.advanceControlTimerDidEnd = true
end
end
else
if playdate.buttonJustPressed(self.advanceControl) then
self.advanceButton:press()
end
self.advanceButton:draw()
end
end
function panel:render(offset, borderColor, bgColor)
self.wasOnScreen = true
gfx.pushContext(self.canvas)
gfx.clear()
if self.renderFunction then
self:renderFunction(offset)
else
self:drawLayers(offset)
end
if not self.borderless then
if self.borderImage then
self.borderImage:draw(0,0)
else
self.borderImage = self:drawBorder(borderColor, bgColor)
end
end
if self.advanceButton then
self:updateAdvanceButton()
end
if self.panels then
local o = {x=offset.x + self.frame.x, y=offset.y + self.frame.y}
if offset.x == 0 then o.x = 0 end
if offset.y == 0 then o.y = 0 end
for i, subPanel in ipairs(self.panels) do
subPanel:render(o, borderColor, bgColor)
subPanel.canvas:draw(subPanel.frame.x, subPanel.frame.y)
end
end
gfx.popContext()
end
return panel
end
|
-- install chronos with luarocks to run
local q = {}
--local chronos = require("chronos")
CHUNKSIZE = 64
local bench = function(name, func, loops)
loops=loops or 1000
--local q0 = chronos.nanotime()
local q0 = os.clock()
for i=1,loops do
func()
end
local q1 = os.clock()
--local q1 = chronos.nanotime()
local time = q1 - q0
print (name .. " took " .. time/loops)
end
local create_list = function(size)
res = {}
for i=1,size do
res[i] = math.random()
end
return res
end
q['wrap'] = function (arg)
return coroutine.create(
function()
local n = 1
local res = {}
while 1 do
if n > #arg
then
return res
else
if #res == CHUNKSIZE then
coroutine.yield(res)
res = {}
else
res[#res + 1] = arg[n]
end
end
coroutine.yield(arg[n])
n = n + 1
end
end)
end
q['add'] = function (arg1, arg2)
return coroutine.create(
function()
while 1 do
local status1, value1 = coroutine.resume(arg1)
local status2, value2 = coroutine.resume(arg2)
if not status1 == status2
then
error("mismatched")
end
if not status1
then
return
end
coroutine.yield(q.add_basic(value1, value2))
end
end)
end
q['add_basic'] = function(arg1, arg2)
if #arg1 ~= #arg2 then
print ("Error: Unequal lengths" .. #arg1 .. " is not same as " .. #arg2)
return
end
res = {}
for i = 1, #arg1 do
res[i] = arg1[i] + arg2[i]
end
return res
end
local ax = create_list(1000*100)
local bx = create_list(1000*100)
local simple_function = function()
return q.add_basic(ax, bx)
end
local eval_coroutine = function(coro)
local ret_vals = {}
local status, result = true, nil
while status do
status, result = coroutine.resume(coro)
--print( 'hey' )
for i=1,#result do
ret_vals[#ret_vals + 1] = result[#result]
end
end
end
local simple_single_compound_function = function()
local t1 = q.add_basic(ax, bx)
return q.add_basic(ax, t1)
end
local coroutine_single_compound_function = function()
routine = q.add(q.wrap(ax) , q.add(q.wrap(ax), q.wrap(bx)))
return eval_coroutine(routine)
end
local simple_double_compound_function = function()
local t1 = q.add_basic(ax, bx)
local t2 = q.add_basic(t1, bx)
return q.add_basic(ax, t2)
end
local coroutine_double_compound_function = function()
routine = q.add(q.wrap(ax) , q.add(q.wrap(bx) , q.add(q.wrap(ax), q.wrap(bx))))
return eval_coroutine(routine)
end
local simple_triple_compound_function = function()
local t1 = q.add_basic(ax, bx)
local t2 = q.add_basic(t1, bx)
local t3 = q.add_basic(t2, ax)
return q.add_basic(ax, t3)
end
local coroutine_triple_compound_function = function()
routine = q.add(q.wrap(ax) ,q.add(q.wrap(ax) , q.add(q.wrap(bx) , q.add(q.wrap(ax), q.wrap(bx)))))
return eval_coroutine(routine)
end
local simple_quad_compound_function = function()
local t1 = q.add_basic(ax, bx)
local t2 = q.add_basic(t1, bx)
local t3 = q.add_basic(t2, ax)
local t4 = q.add_basic(t3, bx)
return q.add_basic(ax, t4)
end
local coroutine_quad_compound_function = function()
routine = q.add(q.wrap(ax), q.add(q.wrap(ax) ,q.add(q.wrap(ax) , q.add(q.wrap(bx) , q.add(q.wrap(ax), q.wrap(bx))))))
return eval_coroutine(routine)
end
local coroutine_quad_make_compound_function = function()
routine = q.add(q.wrap(ax), q.add(q.wrap(ax) ,q.add(q.wrap(ax) , q.add(q.wrap(bx) , q.add(q.wrap(ax), q.wrap(bx))))))
return
--return eval_coroutine(routine)
end
bench("co routine single ", coroutine_single_compound_function, 1000)
bench("simple single ", simple_single_compound_function, 1000)
bench("co routine double ", coroutine_double_compound_function, 1000)
bench("simple double ", simple_double_compound_function, 1000)
bench("co routine triple ", coroutine_triple_compound_function, 1000)
bench("simple triple ", simple_triple_compound_function, 1000)
bench("co routine quad ", coroutine_quad_compound_function, 1000)
bench("simple quad ", simple_quad_compound_function, 1000)
bench("coroutine quad make alone", coroutine_quad_make_compound_function, 1000)
|
require("nmg")
input = "inputs/day8.txt"
function new_idgen()
local id = -1
return function()
id = id + 1
return id
end
end
function new_node(id_gen)
local node = {}
node.id = id_gen()
node.n_children = 0
node.n_metadata = 0
node.value = 0
node.children = {}
node.metadata = {}
return node
end
local function parse_node(coro, idgen)
local function get_next_num() return tonumber(select(2, coroutine.resume(coro))) end
value = select(2, coroutine.resume(coro))
if value then
local node = new_node(idgen)
node.n_children = tonumber(value)
node.n_metadata = get_next_num()
local children_to_get = node.n_children
local metadata_to_get = node.n_metadata
while children_to_get > 0 do
table.insert(node.children, parse_node(coro, idgen))
children_to_get = children_to_get - 1
end
while metadata_to_get > 0 do
local metadata = get_next_num()
sum_metadata = sum_metadata + metadata
table.insert(node.metadata, metadata)
metadata_to_get = metadata_to_get - 1
end
-- Now we can compute the value of the node since we have all the children and
-- the metadata
if node.n_children == 0 then
for index, md in ipairs(node.metadata) do node.value = node.value + md end
else
for index, child_index in ipairs(node.metadata) do
if node.children[child_index] then
node.value = node.value + node.children[child_index].value
end
end
end
return node
else return nil
end
end
do
sum_metadata = 0
input_str = ""
for lines in io.lines(input) do
input_str = input_str .. lines
end
file_reader_coro = coroutine.create(function ()
for digit in string.gmatch(input_str, "[^%s]+") do
coroutine.yield(digit)
end
coroutine.yield(nil)
end)
idgen = new_idgen()
tree = parse_node(file_reader_coro, idgen)
print("Part 1: " .. sum_metadata)
print("Part 2: " .. tree.value)
end
|
function handle(r)
if r.is_https then
r:puts("yep")
else
r:puts("nope")
end
end
|
return require("nginx_filters")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.