content
stringlengths 5
1.05M
|
|---|
-- atom types:
-- nil
-- true
-- {num=3.4}
-- {char='a'}
-- {str='bc'}
-- {sym='foo'}
-- non-atom type:
-- {car={num=3.4}, cdr=nil}
--
-- should {} mean anything special? currently just '(nil)
function atom(x)
return x == nil or x.num or x.char or x.str or x.sym
end
function car(x) return x.car end
function cdr(x) return x.cdr end
function cons(x, y) return {car=x, cdr=y} end
function iso(x, y)
if x == nil then return y == nil end
local done={}
if done[x] then return done[x] == y end
done[x] = y
if atom(x) then
if not atom(y) then return nil end
for k, v in pairs(x) do
if y[k] ~= v then return nil end
end
return true
end
for k, v in pairs(x) do
if not iso(y[k], v) then return nil end
end
for k, v in pairs(y) do
if not iso(x[k], v) then return nil end
end
return true
end
-- primitives; feel free to add more
-- format: lisp name = lua function that implements it
unary_functions = {
atom=atom,
car=car,
cdr=cdr,
}
binary_functions = {
cons=cons,
iso=iso,
}
function lookup(env, s)
if env[s] then return env[s] end
if env.next then return lookup(env.next, s) end
end
function eval(x, env)
function symeq(x, s)
return x and x.sym == s
end
if x.sym then
return lookup(env, x.sym)
elseif atom(x) then
return x
-- otherwise x is a pair
elseif symeq(x.car, 'quote') then
return x.cdr
elseif unary_functions[x.car.sym] then
return eval_unary(x, env)
elseif binary_functions[x.car.sym] then
return eval_binary(x, env)
-- special forms that don't always eval all their args
elseif symeq(x.car, 'if') then
return eval_if(x, env)
elseif symeq(x.car.car, 'fn') then
return eval_fn(x, env)
elseif symeq(x.car.car, 'label') then
return eval_label(x, env)
end
end
function eval_unary(x, env)
return unary_functions[x.car.sym](eval(x.cdr.car, env))
end
function eval_binary(x, env)
return binary_functions[x.car.sym](eval(x.cdr.car, env),
eval(x.cdr.cdr.car, env))
end
function eval_if(x, env)
-- syntax: (if check b1 b2)
local check = x.cdr.car
local b1 = x.cdr.cdr.car
local b2 = x.cdr.cdr.cdr.car
if eval(check, env) then
return eval(b1, env)
else
return eval(b2, env)
end
end
function eval_fn(x, env)
-- syntax: ((fn params body*) args*)
local callee = x.car
local args = x.cdr
local params = callee.cdr.car
local body = callee.cdr.cdr
return eval_exprs(body,
bind_env(params, args, env))
end
function bind_env(params, args, env)
if params == nil then return env end
local result = {next=env}
while true do
result[params.car.sym] = eval(args.car, env)
params = params.cdr
args = args.cdr
if params == nil then break end
end
return result
end
function eval_exprs(xs, env)
local result = nil
while xs do
result = eval(xs.car, env)
xs = xs.cdr
end
return result
end
function eval_label(x, env)
-- syntax: ((label f (fn params body*)) args*)
local callee = x.car
local args = x.cdr
local f = callee.cdr.car
local fn = callee.cdr.cdr.car
return eval({car=fn, cdr=args},
bind_env({f}, {callee}, env))
end
-- testing
function num(n) return {num=n} end
function char(c) return {char=c} end
function str(s) return {str=s} end
function sym(s) return {sym=s} end
function list(...)
-- gotcha: no element in arg can be nil; that short-circuits the ipairs below
local result = nil
local curr = nil
for _, x in ipairs({...}) do
if curr == nil then
result = {car=x}
curr = result
else
curr.cdr = {car=x}
curr = curr.cdr
end
end
return result
end
function p(x)
p2(x)
print()
end
function p2(x)
if x == nil then
io.write('nil')
elseif x == true then
io.write('true')
elseif x.num then
io.write(x.num)
elseif x.char then
io.write("\\"..x.char)
elseif x.str then
io.write('"'..x.str..'"')
elseif x.sym then
io.write(x.sym)
elseif x.cdr == nil then
io.write('(')
p2(x.car)
io.write(')')
elseif atom(x.cdr) then
io.write('(')
p2(x.car)
io.write(' . ')
p2(x.cdr)
io.write(')')
else
io.write('(')
while true do
p2(x.car)
x = x.cdr
if x == nil then break end
if atom(x) then
io.write(' . ')
p2(x)
break
end
io.write(' ')
end
io.write(')')
end
end
x = {num=3.4}
p(x)
p(cons(x, nil))
p(list(x))
p(iso(cons(x, nil), cons(x, nil)))
p(iso(list(x), list(x)))
p(iso(list(x, x), list(x)))
p(iso(list(x, x), list(x, x)))
p(iso(x, cons(x, nil)))
p (list(sym("cons"), num(42), num(1)))
p(eval(list(sym("cons"), num(42), num(1)), {}))
-- ((fn () 42)) => 42
-- can't use list here because of the gotcha above
assert(iso(eval(cons(cons(sym('fn'), cons(nil, cons(num(42))))), {}), num(42)))
-- ((fn (a) (cons a 1)) 42) => '(42 . 1)
assert(iso(eval(cons(cons(sym('fn'), cons(cons(sym('a')), cons(cons(sym('cons'), cons(sym('a'), cons(num(1))))))), cons(num(42)))), cons(num(42), num(1))))
|
vim.api.nvim_set_keymap("n", "RR", ":call CompileRunGccH()<CR>", { silent = true, noremap = true })
vim.api.nvim_set_keymap("n", "Rf", ":call CompileRunGccF()<CR>", { silent = true, noremap = true })
vim.cmd([[
func! CompileRunGccH()
exec "w"
if &filetype == 'c'
exec "!gcc % -o %< -g"
:FloatermNew --position=bottom --wintype=split --height=0.35 time ./%<
elseif &filetype == 'cpp'
exec "!g++ -std=c++11 % -Wall -o %< -g"
:FloatermNew --position=bottom --wintype=split --height=0.35 time ./%<
elseif &filetype == 'rust'
exec "!rustc %"
:FloatermNew --position=bottom --wintype=split --height=0.35 time ./%<
elseif &filetype == 'java'
:FloatermNew --position=bottom --wintype=split --height=0.35 javac % && java %<
elseif &filetype == 'haskell'
:FloatermNew --position=bottom --wintype=split --height=0.35 runhaskell %
elseif &filetype == 'lua'
:FloatermNew --position=bottom --wintype=split --height=0.35 lua %
elseif &filetype == 'sh'
:FloatermNew --position=bottom --wintype=split --height=0.35 bash %
elseif &filetype == 'python'
:FloatermNew --position=bottom --wintype=split --height=0.35 python3 %
elseif &filetype == 'r'
:FloatermNew --position=bottom --wintype=split --height=0.35 Rscript %
elseif &filetype == 'markdown'
exec "MarkdownPreview"
elseif &filetype == 'tex'
silent! exec "VimtexStopAll"
silent! exec "VimtexCompile"
elseif &filetype == 'html'
silent! exec "!chromium % &"
elseif &filetype == 'javascript'
:FloatermNew --position=bottom --wintype=split --height=0.35 export DEBUG="INFO,ERROR,WARNING"; node --trace-warnings .
elseif &filetype == 'go'
:FloatermNew --position=bottom --wintype=split --height=0.35 go run %
endif
endfunc
]])
vim.cmd([[
func! CompileRunGccF()
exec "w"
if &filetype == 'c'
exec "!gcc % -o %< -g"
:FloatermNew time ./%<
elseif &filetype == 'cpp'
exec "!g++ -std=c++11 % -Wall -o %< -g"
:FloatermNew time ./%<
elseif &filetype == 'rust'
exec "!rustc %"
:FloatermNew time ./%<
elseif &filetype == 'java'
:FloatermNew javac % && java %<
elseif &filetype == 'lua'
:FloatermNew lua %
elseif &filetype == 'haskell'
:FloatermNew runhaskell %
elseif &filetype == 'sh'
:FloatermNew bash %
elseif &filetype == 'python'
:FloatermNew python3 %
elseif &filetype == 'r'
:FloatermNew Rscript %
elseif &filetype == 'javascript'
:FloatermNew export DEBUG="INFO,ERROR,WARNING"; node --trace-warnings .
elseif &filetype == 'go'
:FloatermNew go run %
endif
endfunc
]])
|
local cachedModule = {}
local modules = {}
local moduleLoaded = {}
local moduleParents = {}
local moduleBody = {}
local function createModule(name, dependency)
modules[name] = true
local parents = {}
if (type(dependency) == "table") then
for _, v in ipairs(dependency) do
if (v ~= name) then
parents[#parents + 1] = v
end
end
end
moduleLoaded[name] = false
moduleParents[name] = parents
return function (body)
moduleBody[name] = body
end
end
local function loadModule(name)
if (not moduleLoaded[name]) then
local result
local body = moduleBody[name]
local parents = moduleParents[name]
moduleLoaded[name] = true
if (#parents > 0) then
local imports = {}
for _, v in ipairs(parents) do
imports[v] = loadModule(v)
end
result = body(imports)
else
result = body()
end
cachedModule[name] = result
return result
end
return cachedModule[name]
end
local function loadModules()
for k, _ in pairs(modules) do
loadModule(k)
end
end
module = {
create = createModule,
load = loadModule,
init = loadModules,
}
|
-- 1.71secs per section
-- 0.85secs per section/2
-- 0.42secs per section/4
local swaySlow = false
local swaySlowCamCentre = false
local swayIntenseDefault = false
local swayIntenserDefault = false
local swayScreenCam = false
local fadingCam = false
local faded = false
local waitForBeatFade = false
local receptor = null
local R0 = null
local R1 = null
local R2 = null
local R3 = null
local R4 = null
local R5 = null
local R6 = null
local R7 = null
local currentBeat = null
function songStart()
R0 = _G['receptor_0']
R1 = _G['receptor_1']
R2 = _G['receptor_2']
R3 = _G['receptor_3']
R4 = _G['receptor_4']
R5 = _G['receptor_5']
R6 = _G['receptor_6']
R7 = _G['receptor_7']
end
function update(elapsed)
if swaySlowDefault then
currentBeat = (songPos / 1000)*(bpm/60)
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX + 32 * math.sin((currentBeat))
end
end
if swaySlowCamCentre then
currentBeat = (songPos / 1000)*(bpm/60)
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX + 32 * math.sin((currentBeat)) + 320
end
end
if swaySlowSwapped then
currentBeat = (songPos / 1000)*(bpm/60)
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX + 32 * math.sin((currentBeat)) + 640
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX + 32 * math.sin((currentBeat)) - 640
end
end
if swayIntenseDefault then
currentBeat = (songPos / 1000)*(bpm/60)
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX + 64 * math.sin((currentBeat))
receptor.y = receptor.defaultY + 16 * math.cos((currentBeat + i*32) * math.pi)
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX - 64 * math.sin((currentBeat))
receptor.y = receptor.defaultY + 16 * math.cos((currentBeat + i*32) * math.pi)
end
end
if swayIntenserDefault then
currentBeat = (songPos / 1000)*(bpm/60)
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX + 80 * math.sin((currentBeat))
receptor.y = receptor.defaultY - 32 * math.cos((currentBeat + i*32) * math.pi)
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX - 80 * math.sin((currentBeat))
receptor.y = receptor.defaultY - 32 * math.cos((currentBeat + i*32) * math.pi)
end
end
if swayScreenCam then
currentBeat = (songPos / 1000)*(bpm/60)
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX - 320 * math.sin((currentBeat)) + 320
receptor.y = receptor.defaultY - 48 * math.cos((currentBeat + i*8) * math.pi)
end
end
if fadingCam then
if curBeat % 2 == 0 and not waitForBeatFade then
waitForBeatFade = true
faded = not faded
if faded then
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 0.5, 0.85)
end
else
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 0.1, 0.85)
end
end
end
end
end
function beatHit(beat)
waitForBeatFade = false
end
function keyPressed(key)
if curStep >= 1920 and curStep < 2176 then
for i = 4, 7 do
receptor = _G['receptor_'..i]
if key == 'left' then
receptor.tweenPos(receptor, receptor.defaultX - 340, receptor.y, 0.05)
elseif key == 'down' then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 20, 0.05)
elseif key == 'up' then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 20, 0.05)
elseif key == 'right' then
receptor.tweenPos(receptor, receptor.defaultX - 300, receptor.y, 0.05)
end
end
end
if curStep >= 2176 and curStep < 2416 then
for i = 4, 7 do
receptor = _G['receptor_'..i]
if key == 'left' then
receptor.tweenPos(receptor, receptor.defaultX - 360, receptor.y, 0.05)
elseif key == 'down' then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 40, 0.05)
elseif key == 'up' then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 40, 0.05)
elseif key == 'right' then
receptor.tweenPos(receptor, receptor.defaultX - 280, receptor.y, 0.05)
end
end
end
end
function stepHit(step)
-- Moving Arrows for Cam
if step == 64 then
R0:tweenAlpha(0, 1.71)
R1:tweenAlpha(0, 1.71)
R3:tweenAlpha(0, 1.71)
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX - 80, receptor.y, 1.71)
end
end
if step == 80 then
R1:tweenAlpha(1, 1.71)
R2:tweenAlpha(0, 1.71)
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 80, 1.71)
end
end
if step == 96 then
R1:tweenAlpha(0, 1.71)
R3:tweenAlpha(1, 1.71)
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 80, 1.71)
end
end
if step == 112 then
R2:tweenAlpha(1, 0.85)
R3:tweenAlpha(0, 0.85)
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX, receptor.y, 0.85)
end
end
if step == 120 then
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.x, receptor.defaultY, 0.85)
receptor.tweenAlpha(receptor, 1, 0.85)
end
end
-- Moving Arrows for BF
if step == 128 then
R6:tweenAlpha(0, 1.71)
R7:tweenAlpha(0, 1.71)
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX + 80, receptor.y, 1.71)
end
end
if step == 144 then
R4:tweenAlpha(0, 1.71)
R6:tweenAlpha(1, 1.71)
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX, receptor.y, 1.71)
end
end
if step == 160 then
R5:tweenAlpha(0, 1.71)
R4:tweenAlpha(1, 1.71)
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 80, 1.71)
end
end
if step == 176 then
R4:tweenAlpha(0, 0.85)
R5:tweenAlpha(1, 0.85)
R6:tweenAlpha(0, 0.85)
R7:tweenAlpha(1, 0.85)
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 40, 0.85)
end
end
if step == 184 then
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.x, receptor.defaultY, 0.85)
receptor.tweenAlpha(receptor, 1, 0.85)
end
end
-- Moving Arrows for Cam
if step == 188 then
for i = 1, 3 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 0, 0.42)
end
end
if step == 192 then
R0:tweenAlpha(0, 1.71)
R2:tweenAlpha(1, 1.71)
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX - 80, receptor.y, 1.71)
end
end
if step == 208 then
R2:tweenAlpha(0, 1.71)
R1:tweenAlpha(1, 1.71)
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 80, 1.71)
end
end
if step == 224 then
R1:tweenAlpha(0, 1.71)
R3:tweenAlpha(1, 1.71)
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 40, 1.71)
end
end
if step == 240 then
R3:tweenAlpha(0, 0.85)
R2:tweenAlpha(1, 0.85)
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX, receptor.y, 0.85)
end
end
if step == 248 then
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.x, receptor.defaultY, 0.85)
receptor.tweenAlpha(receptor, 1, 0.85)
end
end
-- Blinking Note for This Part
if step == 210
or step == 214
or step == 218
or step == 238 then
R0.alpha = 1
end
if step == 211
or step == 215
or step == 219
or step == 239 then
R0:tweenAlpha(0, 0.3)
end
-- down arrow
if step == 206
or step == 242
or step == 246 then
R1.alpha = 1
end
if step == 207
or step == 243
or step == 247 then
R1:tweenAlpha(0, 0.3)
end
-- up arrow
if step == 226
or step == 230
or step == 234 then
R2.alpha = 1
end
if step == 227
or step == 231
or step == 235 then
R2:tweenAlpha(0, 0.3)
end
-- right arrow
if step == 194
or step == 198
or step == 202
or step == 222 then
R3.alpha = 1
end
if step == 195
or step == 199
or step == 203
or step == 223 then
R3:tweenAlpha(0, 0.3)
end
-- Soft Part
if step == 256 then
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX + 320, receptor.defaultY, 1.71)
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 0, 0.85)
end
end
if step == 272 then
swaySlowCamCentre = true
end
if step == 312 then
swaySlowCamCentre = false
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 0.85)
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 1, 0.85)
end
end
if step == 320 then
swaySlowDefault = true
end
if step == 358 then
swaySlowDefault = false
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX + 640, receptor.defaultY, 2.50)
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX - 640, receptor.defaultY, 2.50)
end
end
if step == 384 then
swaySlowSwapped = true
end
if step == 486 then
swaySlowSwapped = false
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 1.25)
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 1.25)
end
end
-- Arrow Duet Part 1
for i = 0, 3 do
receptor = _G['receptor_'..i]
if step == 512 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 80, 0.85)
end
if step == 522 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 40, 0.20)
end
if step == 524 then
receptor.tweenPos(receptor, receptor.defaultX - 64, receptor.y, 0.20)
end
if step == 526 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 0.85)
end
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
if step == 512 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 80, 0.85)
end
if step == 522 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 40, 0.20)
end
if step == 524 then
receptor.tweenPos(receptor, receptor.defaultX + 64, receptor.y, 0.20)
end
if step == 526 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 0.85)
end
end
if step == 544 then
swayIntenseDefault = true
end
if step == 572 then
swayIntenseDefault = false
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 0.42)
end
end
-- Arrow Duet Part 2
for i = 0, 3 do
receptor = _G['receptor_'..i]
if step == 576 then
receptor.tweenPos(receptor, receptor.defaultX - 64, receptor.y, 0.85)
end
if step == 586 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.y, 0.20)
end
if step == 588 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 80, 0.20)
end
if step == 590 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY, 0.85)
end
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
if step == 576 then
receptor.tweenPos(receptor, receptor.defaultX + 64, receptor.y, 0.85)
end
if step == 586 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.y, 0.20)
end
if step == 588 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 80, 0.20)
end
if step == 590 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY, 0.85)
end
end
if step == 608 then
swayIntenseDefault = true
end
if step == 636 then
swayIntenseDefault = false
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 0.42)
end
end
-- Arrow Duet Part 3
for i = 0, 3 do
receptor = _G['receptor_'..i]
if step == 640 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 80, 0.85)
end
if step == 650 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 40, 0.20)
end
if step == 652 then
receptor.tweenPos(receptor, receptor.defaultX - 64, receptor.y, 0.20)
end
if step == 654 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 0.85)
end
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
if step == 640 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 80, 0.85)
end
if step == 650 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 40, 0.20)
end
if step == 652 then
receptor.tweenPos(receptor, receptor.defaultX + 64, receptor.y, 0.20)
end
if step == 654 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 0.85)
end
end
if step == 672 then
swayIntenserDefault = true
end
if step == 700 then
swayIntenserDefault = false
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 0.42)
end
end
-- Arrow Duet Part 4
for i = 0, 3 do
receptor = _G['receptor_'..i]
if step == 704 then
receptor.tweenPos(receptor, receptor.defaultX - 64, receptor.y, 0.85)
end
if step == 714 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.y, 0.20)
end
if step == 716 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 80, 0.20)
end
if step == 718 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY, 0.60)
end
if step == 730 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 80, 0.20)
end
if step == 732 then
receptor.tweenPos(receptor, receptor.defaultX + 64, receptor.y, 0.20)
end
if step == 734 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 2.5)
end
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
if step == 704 then
receptor.tweenPos(receptor, receptor.defaultX + 64, receptor.y, 0.85)
end
if step == 714 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.y, 0.20)
end
if step == 716 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 80, 0.20)
end
if step == 718 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY, 0.60)
end
if step == 730 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 80, 0.20)
end
if step == 732 then
receptor.tweenPos(receptor, receptor.defaultX - 64, receptor.y, 0.20)
end
if step == 734 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 2.5)
end
end
if step == 752 then
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 0, 0.85)
end
end
-- Centred Arrow Time
if step == 762 then
R1.x = R1.x + 60
R2.x = R2.x + 580
R3.x = R3.x + 640
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX - 320
end
end
if step == 768 then
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 1, 6.8)
end
end
-- Blinking Notes for Cam
-- left arrow
if step == 768 or step == 776
or step == 780 or step == 792
or step == 796 or step == 808
or step == 812 or step == 824
or step == 828 then
R0.alpha = 1
end
if step == 769 or step == 777
or step == 781 or step == 793
or step == 797 or step == 809
or step == 813 or step == 825
or step == 829 then
R0:tweenAlpha(0, 0.1)
end
-- down arrow
if step == 772 or step == 784
or step == 788 or step == 800
or step == 804 or step == 816
or step == 820 then
R1.alpha = 1
end
if step == 773 or step == 785
or step == 789 or step == 801
or step == 805 or step == 817
or step == 821 then
R1:tweenAlpha(0, 0.1)
end
-- up arrow
if step == 768 or step == 778
or step == 782 or step == 794
or step == 798 or step == 810
or step == 814 or step == 826
or step == 830 then
R2.alpha = 1
end
if step == 769 or step == 779
or step == 783 or step == 795
or step == 799 or step == 811
or step == 815 or step == 827
or step == 831 then
R2:tweenAlpha(0, 0.1)
end
-- right arrow
if step == 770 or step == 774
or step == 786 or step == 790
or step == 802 or step == 806
or step == 818 or step == 822 then
R3.alpha = 1
end
if step == 771 or step == 775
or step == 787 or step == 791
or step == 803 or step == 807
or step == 819 or step == 823 then
R3:tweenAlpha(0, 0.1)
end
if step == 832 then
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 1, 0.42)
end
end
-- Beatdrop!
if step == 880 then
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX + 320
end
end
if step == 882
or step == 884 then
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX
end
end
if step == 883 then
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX + 640
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX - 640
end
end
if step == 886 then
R0.alpha = 0
R7.alpha = 0
end
if step == 887 then
R1.alpha = 0
R6.alpha = 0
end
if step == 888 then
R2.alpha = 0
R5.alpha = 0
end
if step == 889 then
R3.alpha = 0
R4.alpha = 0
end
if step == 892 then
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 1, 0.42)
end
end
-- Chorus
for i = 0, 3 do
receptor = _G['receptor_'..i]
if step == 896 then
receptor.tweenPos(receptor, receptor.defaultX - 40, receptor.y, 0.85)
end
if step == 920 then
receptor.tweenPos(receptor, receptor.defaultX - 80, receptor.y, 0.60)
end
if step == 928 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.y, 0.30)
end
if step == 936 then
receptor.tweenPos(receptor, receptor.defaultX - 80, receptor.y, 0.85)
end
if step == 984 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.y, 0.60)
end
if step == 990 then
receptor.tweenPos(receptor, receptor.defaultX - 80, receptor.y, 0.42)
end
if step == 1080 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 80, 0.20)
end
if step == 1083 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 0.20)
end
if step == 1086 then
receptor.tweenPos(receptor, receptor.defaultX - 80, receptor.y, 0.20)
end
if step == 1088 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 0.85)
end
if step == 1112 then
receptor.tweenPos(receptor, receptor.defaultX + 80, receptor.y, 0.60)
end
if step == 1118 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.y, 0.85)
end
if step == 1136 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 1.71)
end
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
if step == 896 then
receptor.tweenPos(receptor, receptor.defaultX - 80, receptor.y, 0.85)
end
if step == 920 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.y, 0.60)
end
if step == 926 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY - 80, 0.85)
end
if step == 952 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY, 0.20)
end
if step == 955 then
receptor.tweenPos(receptor, receptor.defaultX - 80, receptor.y, 0.20)
end
if step == 958 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.y, 0.20)
end
if step == 964 then
receptor.tweenPos(receptor, receptor.defaultX - 80, receptor.y, 0.60)
end
if step == 970 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 80, 0.20)
end
if step == 978 then
receptor.tweenPos(receptor, receptor.defaultX - 160, receptor.y, 0.60)
end
if step == 984 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY, 0.60)
end
if step == 990 then
receptor.tweenPos(receptor, receptor.defaultX - 80, receptor.y, 0.85)
end
if step == 1018 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 80, 0.20)
end
if step == 1021 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.y, 0.20)
end
if step == 1032 then
receptor.tweenPos(receptor, receptor.defaultX - 80, receptor.y, 0.60)
end
if step == 1048 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 0.60)
end
if step == 1054 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 80, 0.20)
end
if step == 1060 then
receptor.tweenPos(receptor, receptor.defaultX + 80, receptor.defaultY, 0.20)
end
if step == 1092 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY, 0.42)
end
if step == 1112 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY + 80, 0.60)
end
if step == 1118 then
receptor.tweenPos(receptor, receptor.x, receptor.defaultY, 0.85)
end
if step == 1136 then
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 1.71)
end
end
-- Post Chorus
if step == 1152 then
swayIntenseDefault = true
end
if step == 1276 then
swayIntenseDefault = false
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 0.42)
end
end
if step == 1280 then
swayIntenserDefault = true
end
if step == 1344
or step == 1359 then
swayIntenserDefault = false
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 0.42)
receptor.tweenAlpha(receptor, 0, 1.45)
end
end
if step == 1358
or step == 1374
or step == 1408 then
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.alpha = 1
end
end
if step == 1375 then
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 0, 3.42)
end
end
-- Another Soft Part
if step == 1504 then
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX + 320, receptor.defaultY, 3.42)
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 0, 3.42)
end
end
if step == 1536 then
swaySlowCamCentre = true
end
if step == 1584 then
swaySlowCamCentre = false
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 1.71)
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 1, 1.71)
end
end
if step == 1600 then
swaySlowDefault = true
end
-- Chorus (Key Pressed Function)
if step == 1904 then
swaySlowDefault = false
swayScreenCam = true
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.alpha = 0
end
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.x = receptor.defaultX - 320
end
end
if step == 1912 then
for i = 4, 7 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 1, 0.85)
end
end
if step == 2176 then
for i = 0, 3 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 0.3, 0.85)
end
end
if step == 2304 then
fadingCam = true
end
-- Ending
if step == 2416 then
fadingCam = false
swayScreenCam = false
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.tweenPos(receptor, receptor.defaultX, receptor.defaultY, 1.71)
receptor.tweenAlpha(receptor, 1, 1.71)
end
end
if step == 2662 then
for i = 0, 7 do
receptor = _G['receptor_'..i]
receptor.tweenAlpha(receptor, 0, 1.71)
end
end
end
|
-- Behavior for enemy morgiana
started = false
update = function(B, W)
if (not started) then
started = true
B:say("MorgianaStart", 4)
end
end
|
-- Copyright 2017-2019, Firaxis Games.
-- Leader container list on top of the HUD
include("InstanceManager");
include("LeaderIcon");
include("PlayerSupport");
include("SupportFunctions");
include("GameCapabilities"); -- CUI
include("cui_settings"); -- CUI
include("cui_leader_icon_support"); -- CUI
-- ===========================================================================
-- CONSTANTS
-- ===========================================================================
local SCROLL_SPEED :number = 3;
local UPDATE_FRAMES :number = 2; -- HACK: Require 2 frames to update size change :(
local LEADER_ART_OFFSET_X :number = -4;
local LEADER_ART_OFFSET_Y :number = -9;
-- ===========================================================================
-- GLOBALS
-- ===========================================================================
g_maxNumLeaders = 0; -- Number of leaders that can fit in the ribbon
g_kRefreshRequesters = {} -- Who requested a (refresh of stats)
-- ===========================================================================
-- MEMBERS
-- ===========================================================================
local m_kLeaderIM :table = InstanceManager:new("LeaderInstance", "LeaderContainer", Controls.LeaderStack);
local m_leadersMet :number = 0; -- Number of leaders in the ribbon
local m_scrollIndex :number = 0; -- Index of leader that is supposed to be on the far right. TODO: Remove this and instead scroll based on visible area.
local m_scrollPercent :number = 0; -- Necessary for scroll lerp
local m_isScrolling :boolean = false;
local m_uiLeadersByID :table = {}; -- map of (entire) leader controls based on player id
local m_uiLeadersByPortrait :table = {}; -- map of leader portraits based on player id
local m_uiChatIconsVisible :table = {};
local m_leaderInstanceHeight:number = 0; -- How tall is an instantiated leader instance.
local m_ribbonStats :number = -1; -- From Options menu, enum of how this should display.
local m_isIniting :boolean = true; -- Tracking if initialization is occuring.
local m_kActiveIds :table = {}; -- Which player(s) are active.
local m_isYieldsSubscribed :boolean = false; -- Are yield events subscribed to?
-- ===========================================================================
-- Cleanup leaders
-- ===========================================================================
function ResetLeaders()
m_kLeaderIM:ResetInstances();
m_leadersMet = 0;
m_uiLeadersByID = {};
m_uiLeadersByPortrait = {};
m_scrollPercent = 0;
m_scrollIndex = 0;
m_leaderInstanceHeight = 0;
RealizeScroll();
end
-- ===========================================================================
function OnLeaderClicked(playerID : number )
-- Send an event to open the leader in the diplomacy view (only if they met)
local localPlayerID:number = Game.GetLocalPlayer();
local pPlayer:table = PlayerConfigurations[localPlayerID];
local isAlive:boolean = (localPlayerID ~= PlayerTypes.NONE and pPlayer:IsAlive())
if (playerID == localPlayerID or Players[localPlayerID]:GetDiplomacy():HasMet(playerID)) and isAlive then
LuaEvents.DiplomacyRibbon_OpenDiplomacyActionView( playerID );
end
end
-- ===========================================================================
function ShowStats( uiLeader:table )
uiLeader.StatStack:SetHide(false);
uiLeader.StatStack:CalculateSize();
uiLeader.StatBacking:SetColorByName("HUDRIBBON_STATS_SHOW");
uiLeader.ActiveLeaderAndStats:SetHide(false);
end
-- ===========================================================================
function HideStats( uiLeader:table )
uiLeader.StatStack:SetHide(true);
uiLeader.StatBacking:SetColorByName("HUDRIBBON_STATS_HIDE");
uiLeader.ActiveLeaderAndStats:SetHide(true);
end
-- ===========================================================================
-- UI Callback
-- ===========================================================================
function OnLeaderSizeChanged( uiLeader:table )
-- local pSize:table = uiLeader.LeaderContainer:GetSize();
-- uiLeader.ActiveLeaderAndStats:SetSizeVal( pSize.x + LEADER_ART_OFFSET_X, pSize.y + LEADER_ART_OFFSET_Y );
end
-- ===========================================================================
-- The four following getter functions are exposed for scenario/mod usage
-- ===========================================================================
function GetLeaderIcon()
return LeaderIcon:GetInstance(m_kLeaderIM);
end
-- ===========================================================================
function GetUILeadersByID()
return m_uiLeadersByID;
end
-- ===========================================================================
function GetUILeadersByPortrait()
return m_uiLeadersByPortrait;
end
-- ===========================================================================
function GetLeadersMet()
return m_leadersMet;
end
-- ===========================================================================
-- Add a leader (from right to left)
-- iconName, What icon to draw for the leader portrait
-- playerID, gamecore's player ID
-- kProps, (optional) properties about the leader
-- isUnique, no other leaders are like this one
-- isMasked, even if stats are show, hide their values.
-- ===========================================================================
function AddLeader(iconName : string, playerID : number, kProps: table)
local isUnique:boolean = false;
if kProps == nil then kProps={}; end
if kProps.isUnqiue then isUnqiue=kProps.isUnqiue; end
m_leadersMet = m_leadersMet + 1;
-- Create a new leader instance
local oLeaderIcon :object = GetLeaderIcon();
local uiPortraitButton :table = oLeaderIcon.Controls.SelectButton;
m_uiLeadersByID[playerID] = oLeaderIcon;
m_uiLeadersByPortrait[uiPortraitButton] = oLeaderIcon;
oLeaderIcon:UpdateIcon(iconName, playerID, isUnqiue);
oLeaderIcon:RegisterCallback(Mouse.eLClick, function() OnLeaderClicked(playerID); end);
-- CUI >> use advenced tooltip
--[[
-- If using focus, setup mouse in/out callbacks... otherwise clear them.
if m_ribbonStats == RibbonHUDStats.FOCUS then
uiPortraitButton:RegisterMouseEnterCallback(
function( uiControl:table )
ShowStats( oLeaderIcon );
end
);
uiPortraitButton:RegisterMouseExitCallback(
function( uiControl:table )
HideStats( oLeaderIcon );
end
);
else
uiPortraitButton:ClearMouseEnterCallback();
uiPortraitButton:ClearMouseExitCallback();
end
]]
local allianceData = CuiGetAllianceData(playerID);
LuaEvents.CuiLeaderIconToolTip(oLeaderIcon.Controls.Portrait, playerID);
LuaEvents.CuiRelationshipToolTip(oLeaderIcon.Controls.Relationship, playerID, allianceData);
-- << CUI
oLeaderIcon.LeaderContainer:RegisterSizeChanged(
function( uiControl )
OnLeaderSizeChanged( oLeaderIcon );
end
);
FinishAddingLeader( playerID, oLeaderIcon, kProps );
-- Returning so mods can override them and modify the icons
return oLeaderIcon;
end
-- ===========================================================================
-- Complete adding a leader.
-- Two steps for allowing easier MOD overrides/explansion.
-- ===========================================================================
function FinishAddingLeader( playerID:number, uiLeader:table, kProps:table)
local isMasked:boolean = false;
if kProps.isMasked then isMasked = kProps.isMasked; end
-- Show fields for enabled victory types.
local isHideScore :boolean = isMasked or (not Game.IsVictoryEnabled("VICTORY_SCORE") or not GameCapabilities.HasCapability("CAPABILITY_DISPLAY_SCORE"));
local isHideMilitary:boolean = isMasked or (not Game.IsVictoryEnabled("VICTORY_CONQUEST") or not GameCapabilities.HasCapability("CAPABILITY_DISPLAY_TOP_PANEL_YIELDS"));
local isHideScience :boolean = isMasked or (not GameCapabilities.HasCapability("CAPABILITY_SCIENCE") or not GameCapabilities.HasCapability("CAPABILITY_DISPLAY_TOP_PANEL_YIELDS"));
local isHideCulture :boolean = isMasked or (not GameCapabilities.HasCapability("CAPABILITY_CULTURE") or not GameCapabilities.HasCapability("CAPABILITY_DISPLAY_TOP_PANEL_YIELDS"));
local isHideGold :boolean = isMasked or (not GameCapabilities.HasCapability("CAPABILITY_GOLD") or not GameCapabilities.HasCapability("CAPABILITY_DISPLAY_TOP_PANEL_YIELDS"));
local isHideFaith :boolean = isMasked or (not GameCapabilities.HasCapability("CAPABILITY_RELIGION") or not GameCapabilities.HasCapability("CAPABILITY_DISPLAY_TOP_PANEL_YIELDS"));
uiLeader.Score:SetHide( isHideScore );
uiLeader.Military:SetHide( isHideMilitary );
uiLeader.Science:SetHide( isHideScience );
uiLeader.Culture:SetHide( isHideCulture );
uiLeader.Gold:SetHide( isHideGold );
uiLeader.Faith:SetHide( isHideFaith );
UpdateStatValues( playerID, uiLeader );
end
-- ===========================================================================
-- Clears leaders and re-adds them to the stack
-- ===========================================================================
function UpdateLeaders()
ResetLeaders();
m_ribbonStats = Options.GetUserOption("Interface", "RibbonStats");
-- Add entries for everyone we know (Majors only)
local kPlayers :table = PlayerManager.GetAliveMajors();
local kMetPlayers :table = {};
local kUniqueLeaders:table = {};
local localPlayerID:number = Game.GetLocalPlayer();
local pPlayer : table = PlayerConfigurations[localPlayerID];
if localPlayerID ~= -1 then
local localPlayer :table = Players[localPlayerID];
local localDiplomacy:table = localPlayer:GetDiplomacy();
table.sort(kPlayers, function(a:table,b:table) return localDiplomacy:GetMetTurn(a:GetID()) < localDiplomacy:GetMetTurn(b:GetID()) end);
AddLeader("ICON_"..PlayerConfigurations[localPlayerID]:GetLeaderTypeName(), localPlayerID, {}); --First, add local player.
kMetPlayers, kUniqueLeaders = GetMetPlayersAndUniqueLeaders(); --Fill table for other players.
else
-- No local player so assume it's auto-playing, or local player is dead and observing; show everyone.
for _, pPlayer in ipairs(kPlayers) do
local playerID:number = pPlayer:GetID();
kMetPlayers[ playerID ] = true;
if (kUniqueLeaders[playerID] == nil) then
kUniqueLeaders[playerID] = true;
else
kUniqueLeaders[playerID] = false;
end
end
end
--Then, add the leader icons.
for _, pPlayer in ipairs(kPlayers) do
local playerID:number = pPlayer:GetID();
if(playerID ~= localPlayerID) then
local isMet :boolean = kMetPlayers[playerID];
local pPlayerConfig :table = PlayerConfigurations[playerID];
local isHumanMP :boolean = (GameConfiguration.IsAnyMultiplayer() and pPlayerConfig:IsHuman());
if (isMet or isHumanMP) then
local leaderName:string = pPlayerConfig:GetLeaderTypeName();
local isMasked :boolean = (isMet==false) and isHumanMP; -- Multiplayer human but haven't met
local isUnique :boolean = kUniqueLeaders[leaderName];
local iconName :string = "ICON_LEADER_DEFAULT";
-- If in an MP game and a player leaves the name returned will be NIL.
if isMet and (leaderName ~= nil) then
iconName = "ICON_"..leaderName;
end
AddLeader(iconName, playerID, {
isMasked=isMasked,
isUnique=isUnique
}
);
end
end
end
RealizeSize();
end
-- ===========================================================================
-- Updates size and location of BG and Scroll controls
-- additionalElementsWidth, from MODS that add additional content.
-- ===========================================================================
function RealizeSize( additionalElementsWidth:number )
if additionalElementsWidth == nil then
additionalElementsWidth = 0;
end
local MIN_LEFT_HOOKS :number = 260;
local RIGHT_HOOKS_INITIAL :number = 163;
local WORLD_TRACKER_OFFSET :number = 80; -- Amount of additional space the World Tracker check-box takes up.
local launchBarWidth :number = MIN_LEFT_HOOKS;
local partialScreenBarWidth :number = RIGHT_HOOKS_INITIAL; --Width of the upper right-hand of screen.
-- Loop through leaders in determining size.
m_leaderInstanceHeight = 0;
for _,uiLeader in ipairs(m_uiLeadersByID) do
-- If all are shown then use max size.
if m_ribbonStats == RibbonHUDStats.SHOW then
m_leaderInstanceHeight = math.max( uiLeader.LeaderContainer:GetSizeY(), m_leaderInstanceHeight );
else
-- just the leader portrait.
m_leaderInstanceHeight = uiLeader.SelectButton:GetSizeY();
end
end
-- When not showing stats, leaders can be pushed closer together.
if m_ribbonStats == RibbonHUDStats.SHOW then
Controls.LeaderStack:SetStackPadding( 0 );
else
Controls.LeaderStack:SetStackPadding( -8 );
end
Controls.LeaderStack:CalculateSize();
-- Obtain controls
local uiPartialScreenHookRoot:table = ContextPtr:LookUpControl( "/InGame/PartialScreenHooks/RootContainer" );
local uiPartialScreenHookBar :table = ContextPtr:LookUpControl( "/InGame/PartialScreenHooks/ButtonStack" );
local uiLaunchBar :table = ContextPtr:LookUpControl( "/InGame/LaunchBar/ButtonStack" );
if (uiLaunchBar ~= nil) then
launchBarWidth = math.max(uiLaunchBar:GetSizeX() + WORLD_TRACKER_OFFSET, MIN_LEFT_HOOKS);
end
if (uiPartialScreenHookBar~=nil) then
if uiPartialScreenHookRoot and uiPartialScreenHookRoot:IsVisible() then
partialScreenBarWidth = uiPartialScreenHookBar:GetSizeX();
else
partialScreenBarWidth = 0; -- There are no partial screen hooks at all; backing is invisible.
end
end
local screenWidth:number, screenHeight:number = UIManager:GetScreenSizeVal(); -- Cache screen dimensions
local SIZE_LEADER :number = 63; -- Size of leader icon and border.
local paddingLeader :number = Controls.LeaderStack:GetStackPadding();
local maxSize :number = screenWidth - launchBarWidth - partialScreenBarWidth;
local size :number = maxSize;
g_maxNumLeaders = math.floor(maxSize / (SIZE_LEADER + paddingLeader));
if m_leadersMet > 0 then
-- Compute size of the background shadow
local BG_PADDING_EDGE :number = 50; -- Account for the (tons of) alpha on edges of shadow graphic.
local MINIMUM_BG_SIZE :number = 100;
local bgSize :number = 0;
if (m_leadersMet > g_maxNumLeaders) then
bgSize = g_maxNumLeaders * (SIZE_LEADER + paddingLeader) + additionalElementsWidth + BG_PADDING_EDGE;
else
bgSize = m_leadersMet * (SIZE_LEADER + paddingLeader) + additionalElementsWidth + BG_PADDING_EDGE;
end
bgSize = math.max(bgSize, MINIMUM_BG_SIZE);
Controls.RibbonContainer:SetSizeX( bgSize );
-- Compute actual size of the container
local PADDING_EDGE :number = 8;
size = g_maxNumLeaders * (SIZE_LEADER + paddingLeader) + PADDING_EDGE + additionalElementsWidth;
end
Controls.ScrollContainer:SetSizeX(size);
Controls.ScrollContainer:SetSizeY( m_leaderInstanceHeight );
Controls.LeaderScroll:SetSizeX(size);
Controls.RibbonContainer:SetOffsetX(partialScreenBarWidth);
Controls.LeaderScroll:CalculateSize();
RealizeScroll();
end
-- ===========================================================================
-- Updates visibility of previous and next buttons
-- ===========================================================================
function RealizeScroll()
Controls.NextButtonContainer:SetHide( not CanScrollLeft() );
Controls.PreviousButtonContainer:SetHide( not CanScrollRight() );
end
-- ===========================================================================
function CanScrollLeft()
return m_scrollIndex > 0;
end
-- ===========================================================================
function CanScrollRight()
return m_leadersMet - m_scrollIndex > g_maxNumLeaders;
end
-- ===========================================================================
-- Initialize scroll animation in a particular direction
-- ===========================================================================
function Scroll(direction : number)
m_scrollPercent = 0;
m_scrollIndex = m_scrollIndex + direction;
if(m_scrollIndex < 0) then
m_scrollIndex = 0;
end
if(not m_isScrolling) then
ContextPtr:SetUpdate( UpdateScroll );
m_isScrolling = true;
end
RealizeScroll();
end
-- ===========================================================================
-- Update scroll animation (only called while animating)
-- ===========================================================================
function UpdateScroll(deltaTime : number)
local start :number = Controls.LeaderScroll:GetScrollValue();
local destination :number = 1.0 - (m_scrollIndex / (m_leadersMet - g_maxNumLeaders));
m_scrollPercent = m_scrollPercent + (SCROLL_SPEED * deltaTime);
if(m_scrollPercent >= 1) then
m_scrollPercent = 1
EndScroll();
end
Controls.LeaderScroll:SetScrollValue(start + (destination - start) * m_scrollPercent);
end
-- ===========================================================================
-- Cleans up scroll update callback when done scrollin
-- ===========================================================================
function EndScroll()
ContextPtr:ClearUpdate();
m_isScrolling = false;
RealizeScroll();
end
-- ===========================================================================
-- SystemUpdateUI Callback
-- ===========================================================================
function OnUpdateUI(type:number, tag:string, iData1:number, iData2:number, strData1:string)
if(type == SystemUpdateUI.ScreenResize) then
RealizeSize();
end
end
-- ===========================================================================
-- EVENT
-- Options menu changed
-- ===========================================================================
function OnUserOptionChanged( eOptionSet:number, hOptionKey:number, newOptionValue )
local ribbonStatsHash :number = DB.MakeHash("RibbonStats");
if hOptionKey == ribbonStatsHash then
RealizeYieldEvents(); -- Change subscription to events (if necessary)
m_kLeaderIM:DestroyInstances(); -- Look is changing, start with new instances.
m_scrollIndex = 0; -- Reset scroll position to start.
UpdateLeaders(); -- Now update all the leaders.
RealizeScroll();
-- Play appropriate animations
for id,_ in pairs(m_kActiveIds) do
if Players[id] and Players[id]:IsTurnActive() then
OnTurnBegin( id );
end
end
end
end
-- ===========================================================================
-- EVENT
-- Diplomacy Callback
-- ===========================================================================
function OnDiplomacyMeet(player1ID:number, player2ID:number)
local localPlayerID:number = Game.GetLocalPlayer();
-- Have a local player?
if(localPlayerID ~= PlayerTypes.NONE) then
-- Was the local player involved?
if (player1ID == localPlayerID or player2ID == localPlayerID) then
UpdateLeaders();
end
end
end
-- ===========================================================================
-- EVENT
-- Diplomacy Callback
-- ===========================================================================
function OnDiplomacyWarStateChange(player1ID:number, player2ID:number)
local localPlayerID:number = Game.GetLocalPlayer();
-- Have a local player?
if(localPlayerID ~= PlayerTypes.NONE) then
-- Was the local player involved?
if (player1ID == localPlayerID or player2ID == localPlayerID) then
UpdateLeaders();
end
end
end
-- ===========================================================================
-- EVENT
-- Diplomacy Callback
-- ===========================================================================
function OnDiplomacySessionClosed(sessionID:number)
local localPlayerID:number = Game.GetLocalPlayer();
-- Have a local player?
if(localPlayerID ~= PlayerTypes.NONE) then
-- Was the local player involved?
local diplomacyInfo:table = DiplomacyManager.GetSessionInfo(sessionID);
if(diplomacyInfo ~= nil and (diplomacyInfo.FromPlayer == localPlayerID or diplomacyInfo.ToPlayer == localPlayerID)) then
UpdateLeaders();
end
end
end
-- ===========================================================================
-- EVENT
-- ===========================================================================
function OnInterfaceModeChanged(eOldMode:number, eNewMode:number)
if eNewMode == InterfaceModeTypes.VIEW_MODAL_LENS then
ContextPtr:SetHide(true);
end
if eOldMode == InterfaceModeTypes.VIEW_MODAL_LENS then
ContextPtr:SetHide(false);
end
end
-- ===========================================================================
function UpdateStatValues( playerID:number, uiLeader:table )
local pPlayer:table = Players[playerID];
if uiLeader.Score:IsVisible() then
local score :number = Round( pPlayer:GetScore() );
uiLeader.Score:SetText("[ICON_Capital]"..tostring(score));
end
if uiLeader.Military:IsVisible() then
local military :number = Round( Players[playerID]:GetStats():GetMilitaryStrengthWithoutTreasury() );
uiLeader.Military:SetText( "[ICON_Strength]"..tostring(military));
end
if uiLeader.Science:IsVisible() then
local science :number = Round(pPlayer:GetTechs():GetScienceYield() );
uiLeader.Science:SetText( "[ICON_Science]"..tostring(science));
end
if uiLeader.Culture:IsVisible() then
local culture :number = Round(pPlayer:GetCulture():GetCultureYield() );
uiLeader.Culture:SetText( "[ICON_Culture]"..tostring(culture));
end
if uiLeader.Gold:IsVisible() then
local pTreasury :table = pPlayer:GetTreasury();
local gold :number = math.floor( pTreasury:GetGoldBalance() );
uiLeader.Gold:SetText( "[ICON_Gold]"..tostring(gold));
end
if uiLeader.Faith:IsVisible() then
local faith :number = Round( Players[playerID]:GetReligion():GetFaithBalance() );
uiLeader.Faith:SetText( "[ICON_Faith]"..tostring(faith));
end
-- Show or hide all stats based on options.
if m_ribbonStats == RibbonHUDStats.SHOW then
if uiLeader.StatStack:IsHidden() or m_isIniting then
ShowStats( uiLeader );
end
elseif m_ribbonStats == RibbonHUDStats.FOCUS or m_ribbonStats == RibbonHUDStats.HIDE then
if uiLeader.StatStack:IsVisible() or m_isIniting then
HideStats( uiLeader );
end
end
end
-- ===========================================================================
-- EVENT
-- ===========================================================================
function OnTurnBegin( playerID:number )
local uiLeader :table = m_uiLeadersByID[playerID];
if(uiLeader ~= nil) then
UpdateStatValues( playerID, uiLeader );
local localPlayerID:number = Game.GetLocalPlayer();
if(localPlayerID == PlayerTypes.NONE or localPlayerID == PlayerTypes.OBSERVER)then
return;
end
-- Update the approripate animation (alpha vs slide) based on what mode is being used.
if m_ribbonStats == RibbonHUDStats.SHOW then
if(not(playerID == localPlayerID or Players[localPlayerID]:GetDiplomacy():HasMet(playerID))) then
uiLeader.LeaderContainer:SetSizeVal(63,63);
end
local pSize:table = uiLeader.LeaderContainer:GetSize();
uiLeader.ActiveLeaderAndStats:SetSizeVal( pSize.x + LEADER_ART_OFFSET_X, pSize.y + LEADER_ART_OFFSET_Y );
uiLeader.ActiveLeaderAndStats:SetToBeginning();
uiLeader.ActiveLeaderAndStats:Play();
else
uiLeader.ActiveSlide:SetToBeginning();
uiLeader.ActiveSlide:Play();
end
end
-- Kluge: autoplay layout will frequently size ribbon before other panels and place it behind them in the HUD.
local localPlayer:number = Game.GetLocalPlayer();
local isAutoPlay:boolean = (localPlayer == PlayerTypes.NONE or localPlayer == PlayerTypes.OBSERVER);
if isAutoPlay then
RealizeSize();
end
m_kActiveIds[playerID] = true;
UpdateLeaders();
end
-- ===========================================================================
function ResetActiveAnim( playerID:number )
local uiLeader :table = m_uiLeadersByID[playerID];
if(uiLeader ~= nil) then
uiLeader.ActiveLeaderAndStats:SetToBeginning();
uiLeader.ActiveSlide:SetToBeginning();
end
end
-- ===========================================================================
-- EVENT
-- ===========================================================================
function OnTurnEnd( playerID:number )
local uiLeader :table = m_uiLeadersByID[playerID];
if(uiLeader ~= nil) then
if m_ribbonStats == RibbonHUDStats.SHOW then
uiLeader.ActiveLeaderAndStats:Reverse();
else
uiLeader.ActiveSlide:Reverse();
end
end
m_kActiveIds[playerID] = nil;
end
-- ===========================================================================
-- EVENT
-- ===========================================================================
function OnLocalTurnBegin()
local playerID :number = Game.GetLocalPlayer();
if playerID == PlayerTypes.NONE then return; end;
OnTurnBegin( playerID );
end
-- ===========================================================================
-- EVENT
-- ===========================================================================
function OnLocalTurnEnd()
local playerID :number = Game.GetLocalPlayer();
if playerID == PlayerTypes.NONE then return; end;
OnTurnEnd( playerID );
end
-- ===========================================================================
-- LUAEvent
-- ===========================================================================
function OnLaunchBarResized( width:number )
RealizeSize();
end
-- ===========================================================================
-- UI Callback
-- ===========================================================================
function OnScrollLeft()
if CanScrollLeft() then
Scroll(-1);
end
end
-- ===========================================================================
-- UI Callback
-- ===========================================================================
function OnScrollRight()
if CanScrollRight() then
Scroll(1);
end
end
-- ===========================================================================
function OnChatReceived(fromPlayer:number, stayOnScreen:boolean)
local instance:table= m_uiLeadersByID[fromPlayer];
if instance == nil then return; end
if stayOnScreen then
Controls.ChatIndicatorWaitTimer:Stop();
instance.ChatIndicatorFade:RegisterEndCallback(function() end);
table.insert(m_uiChatIconsVisible, instance.ChatIndicatorFade);
else
Controls.ChatIndicatorWaitTimer:Stop();
instance.ChatIndicatorFade:RegisterEndCallback(function()
Controls.ChatIndicatorWaitTimer:RegisterEndCallback(function()
instance.ChatIndicatorFade:RegisterEndCallback(function() instance.ChatIndicatorFade:SetToBeginning(); end);
instance.ChatIndicatorFade:Reverse();
end);
Controls.ChatIndicatorWaitTimer:SetToBeginning();
Controls.ChatIndicatorWaitTimer:Play();
end);
end
instance.ChatIndicatorFade:Play();
end
-- ===========================================================================
function OnChatPanelShown(fromPlayer:number, stayOnScreen:boolean)
for _, chatIndicatorFade in ipairs(m_uiChatIconsVisible) do
chatIndicatorFade:RegisterEndCallback(function() chatIndicatorFade:SetToBeginning(); end);
chatIndicatorFade:Reverse();
end
chatIndicatorFade = {};
end
-- ===========================================================================
function OnLoadGameViewStateDone()
if(GameConfiguration.IsAnyMultiplayer()) then
for leaderID, uiLeader in pairs(m_uiLeadersByID) do
if Players[leaderID]:IsTurnActive() then
uiLeader.ActiveLeaderAndStats:SetToBeginning();
uiLeader.ActiveLeaderAndStats:Play();
end
end
end
end
-- ===========================================================================
-- UI Callback
-- Refresh the stats.
-- ===========================================================================
function OnRefresh()
ContextPtr:ClearRequestRefresh();
if table.count(g_kRefreshRequesters) > 0 then
local localPlayerID:number = Game.GetLocalPlayer();
if localPlayerID ~= PlayerTypes.NONE and localPlayerID ~= PlayerTypes.OBSERVER and Players[localPlayerID]:IsTurnActive() then
local uiLeader :table = m_uiLeadersByID[localPlayerID];
if uiLeader ~= nil then
UpdateStatValues( localPlayerID, uiLeader );
end
end
else
UI.DataError("Attempt to refresh diplomacy ribbon stats but no event triggered the refresh!");
end
g_kRefreshRequesters = {}; -- Clear out for next refresh
end
-- ===========================================================================
-- Event
-- Special from most other yield events as this may trigger on players other
-- than the local player for actions such as making a deal.
-- ===========================================================================
function OnTreasuryChanged( playerID:number, yield:number , balance:number)
local uiLeader :table = m_uiLeadersByID[playerID];
if uiLeader ~= nil then
UpdateStatValues( playerID, uiLeader );
end
-- If refresh is pending for local player, it can be cleared.
if playerID == Game.GetLocalPlayer() and table.count(g_kRefreshRequesters) > 0 then
ContextPtr:ClearRequestRefresh();
end
end
-- ===========================================================================
-- Only the local player's yields should be update by event to prevent
-- multiplay changes that telgraph to others what is occuring.
-- ===========================================================================
function OnLocalStatUpdateRequest( eventName:string )
table.insert( g_kRefreshRequesters, eventName );
ContextPtr:RequestRefresh();
end
-- ===========================================================================
-- For use in scenarios to force show ribbon yields (i.e. PirateScenario)
-- ===========================================================================
function SetRibbonOption( option : number )
m_ribbonStats = option;
end
-- ===========================================================================
-- For use in scenarios/mods
-- ===========================================================================
function GetLeaderInstanceByID(playerID : number)
return m_uiLeadersByID[playerID];
end
-- ===========================================================================
function StopRibbonAnimation(playerID)
local uiLeader :table = m_uiLeadersByID[playerID];
if(uiLeader ~= nil) then
uiLeader.ActiveLeaderAndStats:SetToBeginning();
uiLeader.ActiveSlide:SetToBeginning();
end
end
-- ===========================================================================
function OnStartObserverMode()
UpdateLeaders();
end
-- ===========================================================================
-- Define EVENT callback functions so they can be added/removed based on
-- whether or not yield stats are being shown.
-- ===========================================================================
OnAnarchyBegins = function() OnLocalStatUpdateRequest( "OnAnarchyBegins" ); end
OnAnarchyEnds = function() OnLocalStatUpdateRequest( "OnAnarchyEnds" ); end
OnCityFocusChanged = function() OnLocalStatUpdateRequest( "OnCityFocusChanged" ); end
OnCityInitialized = function() OnLocalStatUpdateRequest( "OnCityInitialized" ); end
OnCityProductionChanged = function() OnLocalStatUpdateRequest( "OnCityProductionChanged" ); end
OnCityWorkerChanged = function() OnLocalStatUpdateRequest( "OnCityWorkerChanged" ); end
OnDiplomacySessionClosed = function() OnLocalStatUpdateRequest( "OnDiplomacySessionClosed" ); end
OnFaithChanged = function() OnLocalStatUpdateRequest( "OnFaithChanged" ); end
OnGovernmentChanged = function() OnLocalStatUpdateRequest( "OnGovernmentChanged" ); end
OnGovernmentPolicyChanged = function() OnLocalStatUpdateRequest( "OnGovernmentPolicyChanged" ); end
OnGovernmentPolicyObsoleted = function() OnLocalStatUpdateRequest( "OnGovernmentPolicyObsoleted" ); end
OnGreatWorkCreated = function() OnLocalStatUpdateRequest( "OnGreatWorkCreated" ); end
OnImprovementAddedToMap = function() OnLocalStatUpdateRequest( "OnImprovementAddedToMap" ); end
OnImprovementRemovedFromMap = function() OnLocalStatUpdateRequest( "OnImprovementRemovedFromMap" ); end
OnPantheonFounded = function() OnLocalStatUpdateRequest( "OnPantheonFounded" ); end
OnPlayerAgeChanged = function() OnLocalStatUpdateRequest( "OnPlayerAgeChanged" ); end
OnResearchCompleted = function() OnLocalStatUpdateRequest( "OnResearchCompleted" ); end
OnUnitAddedToMap = function() OnLocalStatUpdateRequest( "OnUnitAddedToMap" ); end
OnUnitGreatPersonActivated = function() OnLocalStatUpdateRequest( "OnUnitGreatPersonActivated" ); end
OnUnitKilledInCombat = function() OnLocalStatUpdateRequest( "OnUnitKilledInCombat" ); end
OnUnitRemovedFromMap = function() OnLocalStatUpdateRequest( "OnUnitRemovedFromMap" ); end
-- ===========================================================================
function SubscribeYieldEvents()
m_isYieldsSubscribed = true;
Events.AnarchyBegins.Add( OnAnarchyBegins );
Events.AnarchyEnds.Add( OnAnarchyEnds );
Events.CityFocusChanged.Add( OnCityFocusChanged );
Events.CityInitialized.Add( OnCityInitialized );
Events.CityProductionChanged.Add( OnCityProductionChanged );
Events.CityWorkerChanged.Add( OnCityWorkerChanged );
Events.FaithChanged.Add( OnFaithChanged );
Events.GovernmentChanged.Add( OnGovernmentChanged );
Events.GovernmentPolicyChanged.Add( OnGovernmentPolicyChanged );
Events.GovernmentPolicyObsoleted.Add( OnGovernmentPolicyObsoleted );
Events.GreatWorkCreated.Add( OnGreatWorkCreated );
Events.ImprovementAddedToMap.Add( OnImprovementAddedToMap );
Events.ImprovementRemovedFromMap.Add( OnImprovementRemovedFromMap );
Events.PantheonFounded.Add( OnPantheonFounded );
Events.PlayerAgeChanged.Add( OnPlayerAgeChanged );
Events.ResearchCompleted.Add( OnResearchCompleted );
Events.TreasuryChanged.Add( OnTreasuryChanged );
Events.UnitAddedToMap.Add( OnUnitAddedToMap );
Events.UnitGreatPersonActivated.Add( OnUnitGreatPersonActivated );
Events.UnitKilledInCombat.Add( OnUnitKilledInCombat );
Events.UnitRemovedFromMap.Add( OnUnitRemovedFromMap );
end
-- ===========================================================================
function UnsubscribeYieldEvents()
m_isYieldsSubscribed = false;
Events.AnarchyBegins.Remove( OnAnarchyBegins );
Events.AnarchyEnds.Remove( OnAnarchyEnds );
Events.CityFocusChanged.Remove( OnCityFocusChanged );
Events.CityInitialized.Remove( OnCityInitialized );
Events.CityProductionChanged.Remove( OnCityProductionChanged );
Events.CityWorkerChanged.Remove( OnCityWorkerChanged );
Events.FaithChanged.Remove( OnFaithChanged );
Events.GovernmentChanged.Remove( OnGovernmentChanged );
Events.GovernmentPolicyChanged.Remove( OnGovernmentPolicyChanged );
Events.GovernmentPolicyObsoleted.Remove( OnGovernmentPolicyObsoleted );
Events.GreatWorkCreated.Remove( OnGreatWorkCreated );
Events.ImprovementAddedToMap.Remove( OnImprovementAddedToMap );
Events.ImprovementRemovedFromMap.Remove( OnImprovementRemovedFromMap );
Events.PantheonFounded.Remove( OnPantheonFounded );
Events.PlayerAgeChanged.Remove( OnPlayerAgeChanged );
Events.ResearchCompleted.Remove( OnResearchCompleted );
Events.TreasuryChanged.Remove( OnTreasuryChanged );
Events.UnitAddedToMap.Remove( OnUnitAddedToMap );
Events.UnitGreatPersonActivated.Remove( OnUnitGreatPersonActivated );
Events.UnitKilledInCombat.Remove( OnUnitKilledInCombat );
Events.UnitRemovedFromMap.Remove( OnUnitRemovedFromMap );
end
-- ===========================================================================
-- Only listen for events related to yield updates if they are showing.
-- ===========================================================================
function RealizeYieldEvents()
if m_ribbonStats == RibbonHUDStats.HIDE then
if m_isYieldsSubscribed==false then
return; -- Already un-subscribed.
end
UnsubscribeYieldEvents();
else
if m_isYieldsSubscribed then return; end; -- Already subscribed.
SubscribeYieldEvents();
end
end
-- ===========================================================================
-- CALLBACK
-- ===========================================================================
function OnShutdown()
if m_isYieldsSubscribed then
UnsubscribeYieldEvents();
end
Events.DiplomacyDeclareWar.Remove( OnDiplomacyWarStateChange );
Events.DiplomacyMakePeace.Remove( OnDiplomacyWarStateChange );
Events.DiplomacyMeet.Remove( OnDiplomacyMeet );
Events.DiplomacyRelationshipChanged.Remove( UpdateLeaders );
Events.DiplomacySessionClosed.Remove( OnDiplomacySessionClosed );
Events.InterfaceModeChanged.Remove( OnInterfaceModeChanged );
Events.LoadGameViewStateDone.Remove( OnLoadGameViewStateDone );
Events.LocalPlayerChanged.Remove(UpdateLeaders);
Events.LocalPlayerTurnBegin.Remove( OnLocalTurnBegin );
Events.LocalPlayerTurnEnd.Remove( OnLocalTurnEnd );
Events.MultiplayerPlayerConnected.Remove(UpdateLeaders);
Events.MultiplayerPostPlayerDisconnected.Remove(UpdateLeaders);
Events.PlayerInfoChanged.Remove(UpdateLeaders);
Events.PlayerDefeat.Remove(UpdateLeaders);
Events.PlayerRestored.Remove(UpdateLeaders);
Events.RemotePlayerTurnBegin.Remove( OnTurnBegin );
Events.RemotePlayerTurnEnd.Remove( OnTurnEnd );
Events.SystemUpdateUI.Remove( OnUpdateUI );
Events.UserOptionChanged.Remove( OnUserOptionChanged );
LuaEvents.ChatPanel_OnChatReceived.Remove(OnChatReceived);
LuaEvents.EndGameMenu_StartObserverMode.Remove( OnStartObserverMode );
LuaEvents.LaunchBar_Resize.Remove( OnLaunchBarResized );
LuaEvents.PartialScreenHooks_Realize.Remove(RealizeSize);
LuaEvents.WorldTracker_OnChatShown.Remove(OnChatPanelShown);
end
-- ===========================================================================
function LateInitialize()
RealizeYieldEvents();
ContextPtr:SetRefreshHandler( OnRefresh );
Controls.NextButton:RegisterCallback( Mouse.eLClick, OnScrollLeft );
Controls.PreviousButton:RegisterCallback( Mouse.eLClick, OnScrollRight );
Controls.LeaderScroll:SetScrollValue(1);
Events.DiplomacyDeclareWar.Add( OnDiplomacyWarStateChange );
Events.DiplomacyMakePeace.Add( OnDiplomacyWarStateChange );
Events.DiplomacyMeet.Add( OnDiplomacyMeet );
Events.DiplomacyRelationshipChanged.Add( UpdateLeaders );
Events.DiplomacySessionClosed.Add( OnDiplomacySessionClosed );
Events.InterfaceModeChanged.Add( OnInterfaceModeChanged );
Events.LoadGameViewStateDone.Add( OnLoadGameViewStateDone );
Events.LocalPlayerChanged.Add(UpdateLeaders);
Events.LocalPlayerTurnBegin.Add( OnLocalTurnBegin );
Events.LocalPlayerTurnEnd.Add( OnLocalTurnEnd );
Events.MultiplayerPlayerConnected.Add(UpdateLeaders);
Events.MultiplayerPostPlayerDisconnected.Add(UpdateLeaders);
Events.PlayerInfoChanged.Add(UpdateLeaders);
Events.PlayerDefeat.Add(UpdateLeaders);
Events.PlayerRestored.Add(UpdateLeaders);
Events.RemotePlayerTurnBegin.Add( OnTurnBegin );
Events.RemotePlayerTurnEnd.Add( OnTurnEnd );
Events.SystemUpdateUI.Add( OnUpdateUI );
Events.UserOptionChanged.Add( OnUserOptionChanged );
LuaEvents.ChatPanel_OnChatReceived.Add(OnChatReceived);
LuaEvents.EndGameMenu_StartObserverMode.Add( OnStartObserverMode );
LuaEvents.LaunchBar_Resize.Add( OnLaunchBarResized );
LuaEvents.PartialScreenHooks_Realize.Add(RealizeSize);
LuaEvents.WorldTracker_OnChatShown.Add(OnChatPanelShown);
if not BASE_LateInitialize then -- Only update leaders if this is the last in the call chain.
UpdateLeaders();
end
end
-- ===========================================================================
function OnInit( isReload:boolean )
LateInitialize();
m_isIniting = false;
local localPlayerID:number = Game.GetLocalPlayer();
if localPlayerID ~= PlayerTypes.NONE and localPlayerID ~= PlayerTypes.OBSERVER and Players[localPlayerID]:IsTurnActive() then
OnLocalTurnBegin();
end
end
-- ===========================================================================
-- Main Initialize
-- ===========================================================================
function Initialize()
ContextPtr:SetInitHandler( OnInit );
ContextPtr:SetShutdown( OnShutdown );
end
Initialize();
|
local http = require "resty.http"
local resty_random = require "resty.random"
local server = require "spec.support.server"
local str = require "resty.string"
local function get_hook_secret()
local httpc = http.new()
local res, err = httpc:request_uri("http://127.0.0.1:9080/hook-server-secret")
assert.equal(nil, err)
assert.equal(200, res.status)
assert.string(res.body)
assert.equal(64, string.len(res.body))
return res.body
end
describe("hook server", function()
before_each(server.stop)
after_each(server.stop)
it("without secret", function()
server.start()
local httpc = http.new()
local res, err = httpc:request_uri("http://127.0.0.1:8999/deploy-challenge", {
method = "POST",
body = "a=1&b=2",
headers = {
["Content-Type"] = "application/x-www-form-urlencoded",
},
})
assert.equal(nil, err)
assert.equal(401, res.status)
local error_log = server.read_error_log()
assert.matches("auto-ssl: unauthorized access to hook server (hook secret did not match)", error_log, nil, true)
assert.Not.matches("[warn]", error_log, nil, true)
assert.Not.matches("[alert]", error_log, nil, true)
assert.Not.matches("[emerg]", error_log, nil, true)
end)
it("unknown path", function()
server.start()
local httpc = http.new()
local res, err = httpc:request_uri("http://127.0.0.1:8999/foobar", {
method = "POST",
body = "a=1&b=2",
headers = {
["X-Hook-Secret"] = get_hook_secret(),
["Content-Type"] = "application/x-www-form-urlencoded",
},
})
assert.equal(nil, err)
assert.equal(404, res.status)
local error_log = server.read_error_log()
assert.matches("auto-ssl: unknown request to hook server: /foobar", error_log, nil, true)
assert.Not.matches("[warn]", error_log, nil, true)
assert.Not.matches("[alert]", error_log, nil, true)
assert.Not.matches("[emerg]", error_log, nil, true)
end)
it("missing POST args", function()
server.start()
local httpc = http.new()
local res, err = httpc:request_uri("http://127.0.0.1:8999/deploy-challenge", {
method = "POST",
body = "foo=bar",
headers = {
["X-Hook-Secret"] = get_hook_secret(),
["Content-Type"] = "application/x-www-form-urlencoded",
},
})
assert.equal(nil, err)
assert.equal(500, res.status)
local error_log = server.read_error_log()
assert.matches("assertion failed!", error_log, nil, true)
assert.Not.matches("[warn]", error_log, nil, true)
assert.Not.matches("[alert]", error_log, nil, true)
assert.Not.matches("[emerg]", error_log, nil, true)
end)
it("POST body execeeds allowed size", function()
server.start()
local httpc = http.new()
local res, err = httpc:request_uri("http://127.0.0.1:8999/deploy-challenge", {
method = "POST",
body = str.to_hex(resty_random.bytes(256000)),
headers = {
["X-Hook-Secret"] = get_hook_secret(),
["Content-Type"] = "application/x-www-form-urlencoded",
},
})
assert.equal(nil, err)
assert.equal(413, res.status)
local error_log = server.read_error_log()
assert.matches("client intended to send too large body", error_log, nil, true)
assert.Not.matches("[warn]", error_log, nil, true)
assert.Not.matches("[alert]", error_log, nil, true)
assert.Not.matches("[emerg]", error_log, nil, true)
end)
it("POST body execeeds buffer size", function()
server.start({
hook_server = {
client_max_body_size = "1m",
},
})
local httpc = http.new()
local res, err = httpc:request_uri("http://127.0.0.1:8999/deploy-challenge", {
method = "POST",
body = str.to_hex(resty_random.bytes(256000)),
headers = {
["X-Hook-Secret"] = get_hook_secret(),
["Content-Type"] = "application/x-www-form-urlencoded",
},
})
assert.equal(nil, err)
assert.equal(500, res.status)
local error_log = server.read_error_log()
assert.matches("a client request body is buffered to a temporary file", error_log, nil, true)
if ngx.config.ngx_lua_version < 10008 then -- v0.10.8
assert.matches("auto-ssl: failed to parse POST args: requesty body in temp file not supported", error_log, nil, true)
else
assert.matches("auto-ssl: failed to parse POST args: request body in temp file not supported", error_log, nil, true)
end
assert.Not.matches("[alert]", error_log, nil, true)
assert.Not.matches("[emerg]", error_log, nil, true)
end)
it("successful deploy-challenge", function()
server.start()
local httpc = http.new()
local res, err = httpc:request_uri("http://127.0.0.1:8999/deploy-challenge", {
method = "POST",
body = "domain=example.com&token_filename=foo&token_value=bar",
headers = {
["X-Hook-Secret"] = get_hook_secret(),
["Content-Type"] = "application/x-www-form-urlencoded",
},
})
assert.equal(nil, err)
assert.equal(200, res.status)
assert.equal("", res.body)
local challenge_res, challenge_err = httpc:request_uri("http://127.0.0.1:9080/.well-known/acme-challenge/foo", {
headers = {
["Host"] = "example.com",
},
})
assert.equal(nil, challenge_err)
assert.equal(200, challenge_res.status)
assert.equal("bar\n", challenge_res.body)
local error_log = server.read_error_log()
assert.Not.matches("[warn]", error_log, nil, true)
assert.Not.matches("[error]", error_log, nil, true)
assert.Not.matches("[alert]", error_log, nil, true)
assert.Not.matches("[emerg]", error_log, nil, true)
end)
end)
|
Gamestate = require "libs.hump.gamestate"
Juego = require "entidades.juego"
Menu = require "escenas.menu"
function love.load()
love.graphics.setNewFont("assets/font/lunchds.ttf", 20)
Gamestate.registerEvents()
Gamestate.switch(Menu)
end
function draw_fisicas(world)
for _, body in pairs(world:getBodies()) do
for _, fixture in pairs(body:getFixtures()) do
local shape = fixture:getShape()
if shape:typeOf("CircleShape") then
local cx, cy = body:getWorldPoints(shape:getPoint())
love.graphics.circle("line", cx, cy, shape:getRadius())
elseif shape:typeOf("PolygonShape") then
love.graphics.polygon("line", body:getWorldPoints(shape:getPoints()))
else
love.graphics.line(body:getWorldPoints(shape:getPoints()))
end
end
end
end
|
-- This is a luacov reporter module that outputs the lcov tracefile format
-- The format is documented in the 'geninfo' manpage
local reporter = require "luacov.reporter"
local md5sumhex
local md5_ok, md5 = pcall(require, "md5")
if md5_ok and md5.sumhexa then -- lmd5 by lhf
md5sumhex = md5.sumhexa
elseif md5_ok and md5.digest then -- md5 by roberto
md5sumhex = md5.digest
else
local luaossl_ok, digest = pcall(require, "openssl.digest")
if luaossl_ok then
function md5sumhex(str)
return (digest.new("md5"):final(str)):gsub(".", function(c)
return string.format("%02x", c:byte())
end)
end
end
end
local LcovReporter = setmetatable({}, reporter.ReporterBase)
LcovReporter.__index = LcovReporter
function LcovReporter:on_new_file(filename)
self:write("SF:", filename, "\n")
end
function LcovReporter:on_mis_line(filename, lineno, line) -- luacheck: no unused args
self:write(string.format("DA:%d,%d", lineno, 0))
if md5sumhex then
self:write(",", md5sumhex(line))
end
self:write("\n")
end
function LcovReporter:on_hit_line(filename, lineno, line, hits) -- luacheck: no unused args
self:write(string.format("DA:%d,%d", lineno, hits))
if md5sumhex then
self:write(",", md5sumhex(line))
end
self:write("\n")
end
function LcovReporter:on_end_file(filename, hits, miss) -- luacheck: no unused args
self:write(string.format("LH:%d\nLF:%d\nend_of_record\n", hits, hits+miss))
end
return {
LcovReporter = LcovReporter;
report = function()
return reporter.report(LcovReporter)
end;
}
|
local helper = {}
--- Creates a new empty mesh.
function helper.new_mesh()
local mesh = {}
mesh.vertexes = {}
mesh.segments = {}
mesh.colors = {}
return mesh
end
--- Adds a line to a mesh.
-- @params mesh table: a properly formated mesh. Possibly created with `new_mesh`.
-- @params vertex table: a list of either 2D or 3D vertexes. The coordinates of the vertexes are floats.
-- @params colors table: a list of colors. There should be as many colors as there are vertexes.
-- @params close_loop boolean: whether the line should be a closed loop, with the first vertex being linked with the last vertex.
function helper.add_line_to_mesh(mesh, vertexes, colors, close_loop)
local vertex_count = #mesh.vertexes
local color_count = #mesh.colors
local segment_count = #mesh.segments
local number_of_new_segments = #vertexes - 1
local segments = {}
for i = 1, #vertexes do
table.insert(mesh.vertexes, vertexes[i])
table.insert(mesh.colors, colors[i])
end
table.insert(segments, vertex_count)
for i = 1, number_of_new_segments do
table.insert(segments, vertex_count + i)
end
if close_loop then
table.insert(segments, vertex_count)
end
table.insert(mesh.segments, segments)
end
function helper.add_cube_to_mesh(mesh, center, side_length, color)
local half = side_length / 2
local x = center[1]
local y = center[2]
local z = center[3]
local a = {x - half, y - half, z - half}
local b = {x - half, y + half, z - half}
local c = {x + half, y + half, z - half}
local d = {x + half, y - half, z - half}
local e = {x - half, y - half, z + half}
local f = {x - half, y + half, z + half}
local g = {x + half, y + half, z + half}
local h = {x + half, y - half, z + half}
helper.add_line_to_mesh(mesh, {a, b, c, d}, {color, color, color, color}, true)
helper.add_line_to_mesh(mesh, {e, f, g, h}, {color, color, color, color}, true)
helper.add_line_to_mesh(mesh, {a, e}, {color, color})
helper.add_line_to_mesh(mesh, {b, f}, {color, color})
helper.add_line_to_mesh(mesh, {c, g}, {color, color})
helper.add_line_to_mesh(mesh, {d, h}, {color, color})
end
--- Returns a integer encoding a color.
-- @params r,g,b,a (integers in the [0,255] range): the red, green, blue, and alpha components of the color.
function helper.make_color(r, g, b, a)
local color = r * 256 + g
color = color * 256 + b
color = color * 256 + a
return color
end
return helper
|
while true do
local m = Instance.new("Message")
m.Parent = game.Workspace
m.Text = "A meteor is coming towards us!!! AHHH!!!"
wait(3)
m:remove()
local b = Instance.new("Part")
b.Parent = game.Workspace
b.Position = Vector3.new(0,5000,0)
b.Size = Vector3.new(200,500,200)
b.BrickColor = BrickColor.new(199)
b.Transparency = 0
wait(10)
b:remove()
wait(1000)
end
|
spawns = {}
spawns.list = {}
spawns.sprites = {sprites.baseA, sprites.baseB, sprites.baseC, sprites.baseD}
spawns.flagDist = 90
function spawns.get(letter)
return spawns.list[letter]
end
function spawns.create()
spawns.list.A = spawns.createNumber(1)
spawns.list.B = spawns.createNumber(2)
spawns.list.C = spawns.createNumber(3)
spawns.list.D = spawns.createNumber(4)
end
function spawns.createNumber(index)
local tex = spawns.sprites[index]
local loc = level.spawns.locations[index]
local w2 = tex:getWidth() / 2
local spawn = {
sprite = tex,
x = loc.x,
y = loc.y,
r = math.pi * (index * .5 + .25),
ox = w2,
oy = w2,
color = {r = 255, g = 255, b = 255},
colorName = '',
flagAngle = love.math.random() * math.pi / 2,
flagTime = love.math.random() * math.pi,
flagSway = 0,
flagSwayTime = love.math.random() * math.pi,
flag1 = 'none',
flag2 = 'none',
flag3 = 'none',
flag4 = 'none',
flag5 = 'none',
}
spawn.collider = hc.rectangle(-w2 * .75, -w2 * .75, w2 * 1.5, w2 * 1.5)
spawn.collider.parent = spawn
spawn.collider.class = 'spawn'
spawn.collider:moveTo(spawn.x, spawn.y)
spawn.collider:rotate(spawn.r)
return spawn
end
function spawns.update()
for letter, spawn in pairs(spawns.list) do
spawn.flagSway = math.sin(spawn.flagSwayTime) * 0.3
spawn.flagAngle = math.sin(spawn.flagTime) * spawn.flagSway
spawn.flagTime = spawn.flagTime + 0.02 * love.math.random()
spawn.flagSwayTime = spawn.flagSwayTime + 0.021 * love.math.random()
end
if game.mode == game.captureTheFlag then spawns.countFlags() end
end
function spawns.draw()
for name, data in pairs(spawns.list) do
love.graphics.draw(data.sprite, data.x, data.y, data.r, 1, 1, data.ox, data.oy)
if(config.showColliders) then data.collider:draw('line') end
spawns.drawFlags(data)
end
end
function spawns.drawFlags(spawn)
local flag = flags.colorToSprite[spawn.flag1]
spawns.drawFlag(flag, spawn.x, spawn.y, spawn.flagAngle)
flag = flags.colorToSprite[spawn.flag2]
spawns.drawFlag(flag, spawn.x - spawns.flagDist, spawn.y, spawn.flagAngle)
flag = flags.colorToSprite[spawn.flag3]
spawns.drawFlag(flag, spawn.x + spawns.flagDist, spawn.y, spawn.flagAngle)
flag = flags.colorToSprite[spawn.flag4]
spawns.drawFlag(flag, spawn.x, spawn.y - spawns.flagDist, spawn.flagAngle)
flag = flags.colorToSprite[spawn.flag5]
spawns.drawFlag(flag, spawn.x, spawn.y + spawns.flagDist, spawn.flagAngle)
end
function spawns.drawFlag(flag, x, y, r)
if flag == nil then return end
love.graphics.draw(flag, x, y, r, 1, 1, 0, flags.oy)
love.graphics.draw(sprites.cannonBall, x, y, 0, 1, 1, bullets.ox, bullets.oy)
end
function spawns.addFlag(spawn, color)
if flags.colorToPowerup[color] == nil then return end
if spawn.flag1 == 'none' then spawn.flag1 = color
elseif spawn.flag2 == 'none' then spawn.flag2 = color
elseif spawn.flag3 == 'none' then spawn.flag3 = color
elseif spawn.flag4 == 'none' then spawn.flag4 = color
elseif spawn.flag5 == 'none' then spawn.flag5 = color
end
end
function spawns.getFlag(spawn)
if spawn.flag5 ~= 'none' then
local temp = spawn.flag5
spawn.flag5 = 'none'
return temp
elseif spawn.flag4 ~= 'none' then
local temp = spawn.flag4
spawn.flag4 = 'none'
return temp
elseif spawn.flag3 ~= 'none' then
local temp = spawn.flag3
spawn.flag3 = 'none'
return temp
elseif spawn.flag2 ~= 'none' then
local temp = spawn.flag2
spawn.flag2 = 'none'
return temp
elseif spawn.flag1 ~= 'none' then
local temp = spawn.flag1
spawn.flag1 = 'none'
return temp
else
return 'none'
end
end
function spawns.countFlags()
local hiscore = 0
for name, spawn in pairs(spawns.list) do
local score = spawns.countFlagsFor(spawn)
if score > hiscore then hiscore = score end
local ship = ships.getBySpawn(spawn)
if ship then ship.score = score end
end
if hiscore == #ships.list then game.stop() end
end
function spawns.countFlagsFor(spawn)
local count = 0
if spawn.flag1 ~= 'none' then count = count + 1 end
if spawn.flag2 ~= 'none' then count = count + 1 end
if spawn.flag3 ~= 'none' then count = count + 1 end
if spawn.flag4 ~= 'none' then count = count + 1 end
if spawn.flag5 ~= 'none' then count = count + 1 end
return count
end
function spawns.stealFlag(spawn, ship)
if ship.color == spawn.color then
if string.find(ship.powerup, 'Flag') then
local color = string.gsub(ship.powerup, 'Flag', '')
ships.setPowerup(ship, 'none')
spawns.addFlag(spawn, color)
end
else
if ship.powerup == 'none' then
local flag = spawns.getFlag(spawn)
if flag ~= 'none' then ships.setPowerup(ship, flag .. 'Flag') end
end
end
end
function spawns.removeAll()
for i, spawn in ipairs(spawns.list) do
hc.remove(spawn.collider)
end
spawns.list = {}
end
|
local monster = {};
local small_monster;
local large_monster;
local config;
local enemy_character_base_type_def = sdk.find_type_definition("snow.enemy.EnemyCharacterBase");
local enemy_character_base_type_def_update_method = enemy_character_base_type_def:get_method("update");
local is_boss_enemy_method = sdk.find_type_definition("snow.enemy.EnemyCharacterBase"):get_method("get_isBossEnemy");
sdk.hook(enemy_character_base_type_def_update_method, function(args)
pcall(monster.update_monster, sdk.to_managed_object(args[2]));
end, function(retval)
return retval;
end);
local tick_count = 0;
local last_update_tick = 0;
local recorded_monsters = {};
local updated_monsters = {};
local known_big_monsters = {};
local num_known_monsters = 0;
local num_updated_monsters = 0;
local updates_this_tick = 0;
-- run every tick to keep track of msonsters
-- whenever we've updated enough monsters to surpass how many we've seen,
-- we reset and start over
-- this allows us to only update N monsters per tick to save on performance
-- the reason for this is that the hooks on all the monsters' update functions
-- causes a HUGE performance hit (adds ~3+ ms to UpdateBehavior and frame time)
re.on_pre_application_entry("UpdateBehavior", function()
tick_count = tick_count + 1;
updates_this_tick = 0;
if num_known_monsters ~= 0 and num_updated_monsters >= num_known_monsters or tick_count >= num_known_monsters * 2 then
recorded_monsters = {};
updated_monsters = {};
known_big_monsters = {};
last_update_tick = 0;
tick_count = 0;
num_known_monsters = 0;
num_updated_monsters = 0;
updates_this_tick = 0;
end
end)
function monster.update_monster(enemy)
if enemy == nil then
return;
end
if not recorded_monsters[enemy] then
num_known_monsters = num_known_monsters + 1
recorded_monsters[enemy] = true
end
-- saves on a method call.
if not known_big_monsters[enemy] then
known_big_monsters[enemy] = is_boss_enemy_method:call(enemy);
end
local is_large = known_big_monsters[enemy];
if is_large == nil then
return;
end
-- this is the VERY LEAST thing we should do all the time
-- so the position doesn't lag all over the place
-- due to how infrequently we update the monster(s).
if is_large then
large_monster.update_position(enemy);
large_monster.update_ailments(enemy);
else
small_monster.update_position(enemy);
small_monster.update_ailments(enemy);
end
if updated_monsters[enemy] then
if is_large then
if not config.current_config.global_settings.performance.prioritize_large_monsters then
return;
end
else
return;
end
end
-- is it old tick?
-- is update limit reached?
if tick_count == last_update_tick and updates_this_tick >= config.current_config.global_settings.performance.max_monster_updates_per_tick then
return;
end
-- actually update the enemy now. we don't do this very often
-- due to how much CPU time it takes to update each monster.
if is_large then
if not config.current_config.global_settings.performance.prioritize_large_monsters then
updates_this_tick = updates_this_tick + 1;
last_update_tick = tick_count;
num_updated_monsters = num_updated_monsters + 1;
updated_monsters[enemy] = true;
end
large_monster.update(enemy);
else
updates_this_tick = updates_this_tick + 1;
last_update_tick = tick_count;
num_updated_monsters = num_updated_monsters + 1;
updated_monsters[enemy] = true;
small_monster.update(enemy);
end
end
function monster.init_module()
small_monster = require("MHR_Overlay.Monsters.small_monster");
large_monster = require("MHR_Overlay.Monsters.large_monster");
config = require("MHR_Overlay.Misc.config");
end
return monster;
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
require("lualib_bundle");
local ____exports = {}
____exports.Animation = __TS__Class()
local Animation = ____exports.Animation
Animation.name = "Animation"
function Animation.prototype.____constructor(self, image, frame_width, frame_height, duration, x, y)
if x == nil then
x = 0
end
if y == nil then
y = 0
end
self.frames = {}
self.frame_index = 0
self.duration = 0
self.x = x
self.y = y
self.image_object = image
self.total_duration = duration
self.width = frame_width
self.height = frame_height
local image_width = image:getWidth()
local image_height = image:getHeight()
local width_frames = math.floor(image_width / frame_width)
local height_frames = math.floor(image_height / frame_height)
do
local width_index = 0
while width_index < width_frames do
do
local height_index = 0
while height_index < height_frames do
__TS__ArrayPush(
self.frames,
love.graphics.newQuad(
width_index * frame_width,
height_index * frame_height,
frame_width,
frame_height,
image_width,
image_height
)
)
height_index = height_index + 1
end
end
width_index = width_index + 1
end
end
end
function Animation.prototype.update(self, dt)
self.duration = self.duration + dt
if self.duration > self.total_duration / #self.frames then
self.duration = 0
self.frame_index = self.frame_index + 1
if self.frame_index > #self.frames - 1 then
self.frame_index = 0
end
end
end
function Animation.prototype.draw(self)
love.graphics.draw(self.image_object, self.frames[self.frame_index + 1], self.x, self.y)
end
return ____exports
|
local IAspectModdable = class.interface("IAspectModdable", {
-- on_refresh = "function",
-- calc = "function",
-- mod = "function",
-- mod_base = "function"
})
function IAspectModdable:init()
self.temp = {}
end
function IAspectModdable:on_refresh()
self.temp = {}
end
function IAspectModdable:calc(target, key, base_value)
self.temp = self.temp or {}
if not base_value then
if self.temp[key] ~= nil then
return self.temp[key]
end
end
return self[key]
end
function IAspectModdable:mod(target, prop, v, method, params)
local defaults = self
if params and params.no_default then
defaults = nil
end
table.merge_ex_single(self.temp, v, method or "add", defaults, prop)
return self.temp[prop]
end
function IAspectModdable:mod_base(target, prop, v, method, params)
local defaults = self.proto
if params and params.no_default then
defaults = nil
end
table.merge_ex_single(self, v, method or "add", defaults, prop)
return self[prop]
end
return IAspectModdable
|
-- Adapted from https://mods.factorio.com/mod/inserter-throughput, under the Unlicense
local abs = math.abs
local sqrt = math.sqrt
local acos = math.acos
local round_up = math.ceil
local full_circle_in_radians = math.pi * 2
-- belt speed in tiles per tick
-- inserters can put items in the vicinity of their drop spot,
-- as long as there is no item center directly beneath them
-- e.g. they can place the second item on the very next tick
-- also, the inserter can put down an item either before or after
-- the belt moves in a given tick (usually before)
-- picking items up is vastly more complex and therefore not implemented
local function get_belt_penalty(belt_speed, stack_size)
local penalty = 0
stack_size = stack_size - 1
local item_center_offset = belt_speed
local acted = true
while stack_size > 0 do
if item_center_offset > 0 then
stack_size = stack_size - 1
item_center_offset = item_center_offset - 0.25 -- one item is 0.25 tiles long
acted = true
end
item_center_offset = item_center_offset + belt_speed
if not acted and (item_center_offset > 0) then
stack_size = stack_size - 1
item_center_offset = item_center_offset - 0.25 -- one item is 0.25 tiles long
acted = true
end
penalty = penalty + 1
acted = false
end
return penalty
end
local function calc_internal(
rotation_speed,
extension_speed,
pickup_vector,
drop_vector,
stack_size,
pickup_belt_speed,
drop_belt_speed
)
local pickup_x, pickup_y, drop_x, drop_y = pickup_vector[1], pickup_vector[2], drop_vector[1], drop_vector[2]
local pickup_length = sqrt(pickup_x * pickup_x + pickup_y * pickup_y)
local drop_length = sqrt(drop_x * drop_x + drop_y * drop_y)
-- get angle from the dot product
local angle = acos((pickup_x * drop_x + pickup_y * drop_y) / (pickup_length * drop_length))
-- rotation speed is in full circles per tick
local ticks_per_cycle = 2 * round_up(angle / full_circle_in_radians / rotation_speed)
local extension_time = 2 * round_up(abs(pickup_length - drop_length) / extension_speed)
if ticks_per_cycle < extension_time then
ticks_per_cycle = extension_time
end
if (pickup_belt_speed > 0) and (stack_size > 1) then
ticks_per_cycle = ticks_per_cycle + get_belt_penalty(pickup_belt_speed, stack_size)
end
if (drop_belt_speed > 0) and (stack_size > 1) then
ticks_per_cycle = ticks_per_cycle + get_belt_penalty(drop_belt_speed, stack_size)
end
return stack_size * 60 / ticks_per_cycle -- 60 = ticks per second
end
local function vector(from, to)
return {to.x - from.x, to.y - from.y}
end
local function calc(inserter)
local inserter_position = inserter.position
local prototype = inserter.type == "entity-ghost" and inserter.ghost_prototype or inserter.prototype
local stack_size = inserter.inserter_stack_size_override
if stack_size == 0 then
local force = inserter.force
if prototype.stack then
stack_size = 1 + force.stack_inserter_capacity_bonus
else
stack_size = 1 + force.inserter_stack_size_bonus
end
end
local pickup_position = inserter.pickup_position
local pickup_target = inserter.pickup_target
local pickup_belt_speed = 0
if not pickup_target then
pickup_target = inserter.surface.find_entities_filtered{
position = pickup_position}[1]
end
if pickup_target then
if pickup_target.type == "entity-ghost" then
pickup_belt_speed = pickup_target.ghost_prototype.belt_speed or 0
else
pickup_belt_speed = pickup_target.prototype.belt_speed or 0
end
end
local drop_position = inserter.drop_position
local drop_target = inserter.drop_target
local drop_belt_speed = 0
if not drop_target then
drop_target = inserter.surface.find_entities_filtered{
position = drop_position}[1]
end
if drop_target then
if drop_target.type == "entity-ghost" then
drop_belt_speed = drop_target.ghost_prototype.belt_speed or 0
else
drop_belt_speed = drop_target.prototype.belt_speed or 0
end
end
local value = calc_internal(
prototype.inserter_rotation_speed,
prototype.inserter_extension_speed,
vector(inserter_position, pickup_position),
vector(inserter_position, drop_position),
stack_size,
pickup_belt_speed,
drop_belt_speed
)
return value
end
return calc
|
return [===[
<!-- ....................................................................... -->
<!-- XHTML 1.1 DTD ........................................................ -->
<!-- file: xhtml11.dtd
-->
<!-- XHTML 1.1 DTD
This is XHTML, a reformulation of HTML as a modular XML application.
The Extensible HyperText Markup Language (XHTML)
Copyright 1998-2008 World Wide Web Consortium
(Massachusetts Institute of Technology, European Research Consortium
for Informatics and Mathematics, Keio University).
All Rights Reserved.
Permission to use, copy, modify and distribute the XHTML DTD and its
accompanying documentation for any purpose and without fee is hereby
granted in perpetuity, provided that the above copyright notice and
this paragraph appear in all copies. The copyright holders make no
representation about the suitability of the DTD for any purpose.
It is provided "as is" without expressed or implied warranty.
Author: Murray M. Altheim <altheim@eng.sun.com>
Revision: $Id: xhtml11.dtd,v 1.1 2010/11/24 20:56:19 bertails Exp $
-->
<!-- This is the driver file for version 1.1 of the XHTML DTD.
Please use this public identifier to identify it:
"-//W3C//DTD XHTML 1.1//EN"
-->
<!ENTITY % XHTML.version "-//W3C//DTD XHTML 1.1//EN" >
<!-- Use this URI to identify the default namespace:
"http://www.w3.org/1999/xhtml"
See the Qualified Names module for information
on the use of namespace prefixes in the DTD.
Note that XHTML namespace elements are not prefixed by default,
but the XHTML namespace prefix is defined as "xhtml" so that
other markup languages can extend this one and use the XHTML
prefixed global attributes if required.
-->
<!ENTITY % NS.prefixed "IGNORE" >
<!ENTITY % XHTML.prefix "xhtml" >
<!-- Be sure to include prefixed global attributes - we don't need
them, but languages that extend XHTML 1.1 might.
-->
<!ENTITY % XHTML.global.attrs.prefixed "INCLUDE" >
<!-- Reserved for use with the XLink namespace:
-->
<!ENTITY % XLINK.xmlns "" >
<!ENTITY % XLINK.xmlns.attrib "" >
<!-- For example, if you are using XHTML 1.1 directly, use the public
identifier in the DOCTYPE declaration, with the namespace declaration
on the document element to identify the default namespace:
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/MarkUp/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en">
...
</html>
Revisions:
(none)
-->
<!-- reserved for future use with document profiles -->
<!ENTITY % XHTML.profile "" >
<!-- ensure XHTML Notations are disabled -->
<!ENTITY % xhtml-notations.module "IGNORE" >
<!-- Bidirectional Text features
This feature-test entity is used to declare elements
and attributes used for bidirectional text support.
-->
<!ENTITY % XHTML.bidi "INCLUDE" >
<?doc type="doctype" role="title" { XHTML 1.1 } ?>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- Pre-Framework Redeclaration placeholder .................... -->
<!-- this serves as a location to insert markup declarations
into the DTD prior to the framework declarations.
-->
<!ENTITY % xhtml-prefw-redecl.module "IGNORE" >
<![%xhtml-prefw-redecl.module;[
%xhtml-prefw-redecl.mod;
<!-- end of xhtml-prefw-redecl.module -->]]>
<!ENTITY % xhtml-events.module "INCLUDE" >
<!-- Inline Style Module ........................................ -->
<!ENTITY % xhtml-inlstyle.module "INCLUDE" >
<![%xhtml-inlstyle.module;[
<!ENTITY % xhtml-inlstyle.mod
PUBLIC "-//W3C//ELEMENTS XHTML Inline Style 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-inlstyle-1.mod" >
%xhtml-inlstyle.mod;]]>
<!-- declare Document Model module instantiated in framework
-->
<!ENTITY % xhtml-model.mod
PUBLIC "-//W3C//ENTITIES XHTML 1.1 Document Model 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml11-model-1.mod" >
<!-- adding the lang attribute into the I18N collection -->
<!ENTITY % xhtml-datatypes.module "INCLUDE" >
<![%xhtml-datatypes.module;[
<!ENTITY % xhtml-datatypes.mod
PUBLIC "-//W3C//ENTITIES XHTML Datatypes 1.0//EN"
"xhtml-datatypes-1.mod" >
%xhtml-datatypes.mod;]]>
<!ENTITY % lang.attrib
"xml:lang %LanguageCode.datatype; #IMPLIED
lang %LanguageCode.datatype; #IMPLIED"
>
<!-- Modular Framework Module (required) ......................... -->
<!ENTITY % xhtml-framework.module "INCLUDE" >
<![%xhtml-framework.module;[
<!ENTITY % xhtml-framework.mod
PUBLIC "-//W3C//ENTITIES XHTML Modular Framework 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-framework-1.mod" >
%xhtml-framework.mod;]]>
<!-- Post-Framework Redeclaration placeholder ................... -->
<!-- this serves as a location to insert markup declarations
into the DTD following the framework declarations.
-->
<!ENTITY % xhtml-postfw-redecl.module "IGNORE" >
<![%xhtml-postfw-redecl.module;[
%xhtml-postfw-redecl.mod;
<!-- end of xhtml-postfw-redecl.module -->]]>
<!-- Text Module (Required) ..................................... -->
<!ENTITY % xhtml-text.module "INCLUDE" >
<![%xhtml-text.module;[
<!ENTITY % xhtml-text.mod
PUBLIC "-//W3C//ELEMENTS XHTML Text 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-text-1.mod" >
%xhtml-text.mod;]]>
<!-- Hypertext Module (required) ................................. -->
<!ENTITY % xhtml-hypertext.module "INCLUDE" >
<![%xhtml-hypertext.module;[
<!ENTITY % xhtml-hypertext.mod
PUBLIC "-//W3C//ELEMENTS XHTML Hypertext 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-hypertext-1.mod" >
%xhtml-hypertext.mod;]]>
<!-- Lists Module (required) .................................... -->
<!ENTITY % xhtml-list.module "INCLUDE" >
<![%xhtml-list.module;[
<!ENTITY % xhtml-list.mod
PUBLIC "-//W3C//ELEMENTS XHTML Lists 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-list-1.mod" >
%xhtml-list.mod;]]>
<!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- Edit Module ................................................ -->
<!ENTITY % xhtml-edit.module "INCLUDE" >
<![%xhtml-edit.module;[
<!ENTITY % xhtml-edit.mod
PUBLIC "-//W3C//ELEMENTS XHTML Editing Elements 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-edit-1.mod" >
%xhtml-edit.mod;]]>
<!-- BIDI Override Module ....................................... -->
<!ENTITY % xhtml-bdo.module "%XHTML.bidi;" >
<![%xhtml-bdo.module;[
<!ENTITY % xhtml-bdo.mod
PUBLIC "-//W3C//ELEMENTS XHTML BIDI Override Element 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-bdo-1.mod" >
%xhtml-bdo.mod;]]>
<!-- Ruby Module ................................................ -->
<!ENTITY % Ruby.common.attlists "INCLUDE" >
<!ENTITY % Ruby.common.attrib "%Common.attrib;" >
<!ENTITY % xhtml-ruby.module "INCLUDE" >
<![%xhtml-ruby.module;[
<!ENTITY % xhtml-ruby.mod
PUBLIC "-//W3C//ELEMENTS XHTML Ruby 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-ruby-1.mod" >
%xhtml-ruby.mod;]]>
<!-- Presentation Module ........................................ -->
<!ENTITY % xhtml-pres.module "INCLUDE" >
<![%xhtml-pres.module;[
<!ENTITY % xhtml-pres.mod
PUBLIC "-//W3C//ELEMENTS XHTML Presentation 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-pres-1.mod" >
%xhtml-pres.mod;]]>
<!-- Link Element Module ........................................ -->
<!ENTITY % xhtml-link.module "INCLUDE" >
<![%xhtml-link.module;[
<!ENTITY % xhtml-link.mod
PUBLIC "-//W3C//ELEMENTS XHTML Link Element 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-link-1.mod" >
%xhtml-link.mod;]]>
<!-- Document Metainformation Module ............................ -->
<!ENTITY % xhtml-meta.module "INCLUDE" >
<![%xhtml-meta.module;[
<!ENTITY % xhtml-meta.mod
PUBLIC "-//W3C//ELEMENTS XHTML Metainformation 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-meta-1.mod" >
%xhtml-meta.mod;]]>
<!-- Base Element Module ........................................ -->
<!ENTITY % xhtml-base.module "INCLUDE" >
<![%xhtml-base.module;[
<!ENTITY % xhtml-base.mod
PUBLIC "-//W3C//ELEMENTS XHTML Base Element 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-base-1.mod" >
%xhtml-base.mod;]]>
<!-- Scripting Module ........................................... -->
<!ENTITY % xhtml-script.module "INCLUDE" >
<![%xhtml-script.module;[
<!ENTITY % xhtml-script.mod
PUBLIC "-//W3C//ELEMENTS XHTML Scripting 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-script-1.mod" >
%xhtml-script.mod;]]>
<!-- Style Sheets Module ......................................... -->
<!ENTITY % xhtml-style.module "INCLUDE" >
<![%xhtml-style.module;[
<!ENTITY % xhtml-style.mod
PUBLIC "-//W3C//ELEMENTS XHTML Style Sheets 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-style-1.mod" >
%xhtml-style.mod;]]>
<!-- Image Module ............................................... -->
<!ENTITY % xhtml-image.module "INCLUDE" >
<![%xhtml-image.module;[
<!ENTITY % xhtml-image.mod
PUBLIC "-//W3C//ELEMENTS XHTML Images 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-image-1.mod" >
%xhtml-image.mod;]]>
<!-- Client-side Image Map Module ............................... -->
<!ENTITY % xhtml-csismap.module "INCLUDE" >
<![%xhtml-csismap.module;[
<!ENTITY % xhtml-csismap.mod
PUBLIC "-//W3C//ELEMENTS XHTML Client-side Image Maps 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-csismap-1.mod" >
%xhtml-csismap.mod;]]>
<!-- Server-side Image Map Module ............................... -->
<!ENTITY % xhtml-ssismap.module "INCLUDE" >
<![%xhtml-ssismap.module;[
<!ENTITY % xhtml-ssismap.mod
PUBLIC "-//W3C//ELEMENTS XHTML Server-side Image Maps 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-ssismap-1.mod" >
%xhtml-ssismap.mod;]]>
<!-- Param Element Module ....................................... -->
<!ENTITY % xhtml-param.module "INCLUDE" >
<![%xhtml-param.module;[
<!ENTITY % xhtml-param.mod
PUBLIC "-//W3C//ELEMENTS XHTML Param Element 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-param-1.mod" >
%xhtml-param.mod;]]>
<!-- Embedded Object Module ..................................... -->
<!ENTITY % xhtml-object.module "INCLUDE" >
<![%xhtml-object.module;[
<!ENTITY % xhtml-object.mod
PUBLIC "-//W3C//ELEMENTS XHTML Embedded Object 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-object-1.mod" >
%xhtml-object.mod;]]>
<!-- Tables Module ............................................... -->
<!ENTITY % xhtml-table.module "INCLUDE" >
<![%xhtml-table.module;[
<!ENTITY % xhtml-table.mod
PUBLIC "-//W3C//ELEMENTS XHTML Tables 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-table-1.mod" >
%xhtml-table.mod;]]>
<!-- Forms Module ............................................... -->
<!ENTITY % xhtml-form.module "INCLUDE" >
<![%xhtml-form.module;[
<!ENTITY % xhtml-form.mod
PUBLIC "-//W3C//ELEMENTS XHTML Forms 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-form-1.mod" >
%xhtml-form.mod;]]>
<!-- Legacy Markup ............................................... -->
<!ENTITY % xhtml-legacy.module "IGNORE" >
<![%xhtml-legacy.module;[
<!ENTITY % xhtml-legacy.mod
PUBLIC "-//W3C//ELEMENTS XHTML Legacy Markup 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-legacy-1.mod" >
%xhtml-legacy.mod;]]>
<!-- Document Structure Module (required) ....................... -->
<!ENTITY % xhtml-struct.module "INCLUDE" >
<![%xhtml-struct.module;[
<!ENTITY % xhtml-struct.mod
PUBLIC "-//W3C//ELEMENTS XHTML Document Structure 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-struct-1.mod" >
%xhtml-struct.mod;]]>
<!-- end of XHTML 1.1 DTD ................................................. -->
<!-- ....................................................................... -->
]===]
|
local TXT = Localize{
[0] = " ",
[1] = "Door",
[2] = "Leave the Cave",
[3] = "Chest",
[4] = "Button",
[5] = "Lever",
[6] = "Vault",
[7] = "Cabinet",
[8] = "Switch",
[9] = "",
[10] = "Bookcase",
[11] = "",
[12] = "",
[13] = "",
[14] = "You Successfully disarm the trap",
[15] = "",
[16] = "Take a Drink",
[17] = "Not Very Refreshing",
[18] = "Refreshing",
}
table.copy(TXT, evt.str, true)
Game.MapEvtLines:RemoveEvent(3)
evt.map[3] = function()
evt.SetDoorState{Id = 1, State = 2} -- switch state
end
evt.hint[176] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(176)
evt.map[176] = function()
evt.OpenChest{Id = 1}
end
evt.hint[177] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(177)
evt.map[177] = function()
evt.OpenChest{Id = 2}
end
evt.hint[178] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(178)
evt.map[178] = function()
evt.OpenChest{Id = 3}
end
evt.hint[179] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(179)
evt.map[179] = function()
evt.OpenChest{Id = 4}
end
evt.hint[180] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(180)
evt.map[180] = function()
evt.OpenChest{Id = 5}
end
evt.hint[181] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(181)
evt.map[181] = function()
evt.OpenChest{Id = 6}
end
evt.hint[182] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(182)
evt.map[182] = function()
evt.OpenChest{Id = 7}
end
evt.hint[183] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(183)
evt.map[183] = function()
evt.OpenChest{Id = 8}
end
evt.hint[184] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(184)
evt.map[184] = function()
evt.OpenChest{Id = 9}
end
evt.hint[185] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(185)
evt.map[185] = function()
evt.OpenChest{Id = 10}
end
evt.hint[186] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(186)
evt.map[186] = function()
evt.OpenChest{Id = 11}
end
evt.hint[187] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(187)
evt.map[187] = function()
evt.OpenChest{Id = 12}
end
evt.hint[188] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(188)
evt.map[188] = function()
evt.OpenChest{Id = 13}
end
evt.hint[189] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(189)
evt.map[189] = function()
evt.OpenChest{Id = 14}
end
evt.hint[190] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(190)
evt.map[190] = function()
evt.OpenChest{Id = 15}
end
evt.hint[191] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(191)
evt.map[191] = function()
evt.OpenChest{Id = 16}
end
evt.hint[192] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(192)
evt.map[192] = function()
evt.OpenChest{Id = 17}
end
evt.hint[193] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(193)
evt.map[193] = function()
evt.OpenChest{Id = 18}
end
evt.hint[194] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(194)
evt.map[194] = function()
evt.OpenChest{Id = 19}
end
evt.hint[195] = evt.str[3] -- "Chest"
Game.MapEvtLines:RemoveEvent(195)
evt.map[195] = function()
evt.OpenChest{Id = 0}
end
evt.hint[196] = evt.str[100] -- ""
Game.MapEvtLines:RemoveEvent(196)
evt.map[196] = function()
if not evt.Cmp{"QBits", Value = 740} then -- Dwarf Bones - I lost it
evt.Add{"Inventory", Value = 1428} -- "Zokarr IV's Skull"
evt.Add{"QBits", Value = 740} -- Dwarf Bones - I lost it
end
end
evt.hint[197] = evt.str[12] -- ""
Game.MapEvtLines:RemoveEvent(197)
evt.map[197] = function()
local i
if evt.Cmp{"MapVar14", Value = 1} then
return
end
i = Game.Rand() % 6
if i == 3 then
evt.Add{"Inventory", Value = 1490} -- "Phylt-laced ore"
goto _9
elseif i == 4 then
evt.DamagePlayer{-- ERROR: Const not found
Player = "All", DamageType = const.Damage.Fire, Damage = 50}
evt.StatusText{Str = 13} -- ""
goto _8
elseif i == 5 then
goto _8
end
evt.Add{"Inventory", Value = 1489} -- "Siertal-laced ore"
::_9::
evt.Set{"MapVar14", Value = 1}
evt.SetTexture{Facet = 2, Name = "cwb1"}
do return end
::_8::
evt.Add{"Inventory", Value = 1491} -- "Kergar-laced ore"
goto _9
end
function events.LoadMap()
if evt.Cmp{"MapVar14", Value = 1} then
evt.SetTexture{Facet = 2, Name = "cwb1"}
end
end
evt.hint[198] = evt.str[12] -- ""
Game.MapEvtLines:RemoveEvent(198)
evt.map[198] = function()
local i
if evt.Cmp{"MapVar15", Value = 1} then
return
end
i = Game.Rand() % 6
if i == 3 then
evt.Add{"Inventory", Value = 1490} -- "Phylt-laced ore"
goto _9
elseif i == 4 then
evt.DamagePlayer{-- ERROR: Const not found
Player = "All", DamageType = const.Damage.Fire, Damage = 50}
evt.StatusText{Str = 13} -- ""
goto _8
elseif i == 5 then
goto _8
end
evt.Add{"Inventory", Value = 1489} -- "Siertal-laced ore"
::_9::
evt.Set{"MapVar15", Value = 1}
evt.SetTexture{Facet = 3, Name = "cwb1"}
do return end
::_8::
evt.Add{"Inventory", Value = 1491} -- "Kergar-laced ore"
goto _9
end
function events.LoadMap()
if evt.Cmp{"MapVar15", Value = 1} then
evt.SetTexture{Facet = 3, Name = "cwb1"}
end
end
evt.hint[199] = evt.str[12] -- ""
Game.MapEvtLines:RemoveEvent(199)
evt.map[199] = function()
local i
if evt.Cmp{"MapVar16", Value = 1} then
return
end
i = Game.Rand() % 6
if i == 3 then
evt.Add{"Inventory", Value = 1490} -- "Phylt-laced ore"
goto _9
elseif i == 4 then
evt.DamagePlayer{-- ERROR: Const not found
Player = "All", DamageType = const.Damage.Fire, Damage = 50}
evt.StatusText{Str = 13} -- ""
goto _8
elseif i == 5 then
goto _8
end
evt.Add{"Inventory", Value = 1489} -- "Siertal-laced ore"
::_9::
evt.Set{"MapVar16", Value = 1}
evt.SetTexture{Facet = 4, Name = "cwb1"}
do return end
::_8::
evt.Add{"Inventory", Value = 1491} -- "Kergar-laced ore"
goto _9
end
function events.LoadMap()
if evt.Cmp{"MapVar16", Value = 1} then
evt.SetTexture{Facet = 4, Name = "cwb1"}
end
end
Game.MapEvtLines:RemoveEvent(451)
evt.map[451] = function()
evt.MoveToMap{X = 1168, Y = 9584, Z = -143, Direction = 0, LookAngle = 0, SpeedZ = 0, HouseId = 0, Icon = 0, Name = "0"}
end
Game.MapEvtLines:RemoveEvent(452)
evt.map[452] = function()
evt.MoveToMap{X = 1232, Y = 6896, Z = -384, Direction = 0, LookAngle = 0, SpeedZ = 0, HouseId = 0, Icon = 0, Name = "0"}
evt.CastSpell{Spell = 6, Mastery = const.GM, Skill = 7, FromX = 13891, FromY = 229, FromZ = 161, ToX = 13891, ToY = 4912, ToZ = 161} -- "Fireball"
evt.CastSpell{Spell = 6, Mastery = const.GM, Skill = 7, FromX = 14618, FromY = 857, FromZ = 161, ToX = 9284, ToY = 857, ToZ = 161} -- "Fireball"
end
Timer(function()
evt.CastSpell{Spell = 6, Mastery = const.GM, Skill = 7, FromX = 13891, FromY = 229, FromZ = 161, ToX = 13891, ToY = 4912, ToZ = 161} -- "Fireball"
evt.CastSpell{Spell = 6, Mastery = const.GM, Skill = 7, FromX = 14618, FromY = 857, FromZ = 161, ToX = 9284, ToY = 857, ToZ = 161} -- "Fireball"
end, 2.5*const.Minute)
evt.hint[454] = evt.str[100] -- ""
Game.MapEvtLines:RemoveEvent(454)
evt.map[454] = function() -- Timer(<function>, 4*const.Minute)
evt.CastSpell{Spell = 18, Mastery = const.GM, Skill = 8, FromX = -9861, FromY = -3949, FromZ = -479, ToX = -9861, ToY = -106, ToZ = -479} -- "Lightning Bolt"
end
Timer(evt.map[454].last, 4*const.Minute)
evt.hint[455] = evt.str[100] -- ""
Game.MapEvtLines:RemoveEvent(455)
evt.map[455] = function()
evt.CastSpell{Spell = 15, Mastery = const.GM, Skill = 4, FromX = -10624, FromY = 3456, FromZ = -639, ToX = -10624, ToY = 3456, ToZ = -639} -- "Sparks"
end
evt.hint[456] = evt.str[100] -- ""
Game.MapEvtLines:RemoveEvent(456)
evt.map[456] = function() -- Timer(<function>, 3.5*const.Minute)
if not evt.CheckSkill{const.Skills.DisarmTraps, Mastery = const.GM, Level = 40} then
evt.CastSpell{Spell = 24, Mastery = const.GM, Skill = 5, FromX = 12023, FromY = 15154, FromZ = -639, ToX = 11704, ToY = 15854, ToZ = -479} -- "Poison Spray"
evt.CastSpell{Spell = 24, Mastery = const.GM, Skill = 5, FromX = 11398, FromY = 15726, FromZ = -639, ToX = 11673, ToY = 15051, ToZ = -479} -- "Poison Spray"
evt.CastSpell{Spell = 24, Mastery = const.GM, Skill = 5, FromX = 11066, FromY = 15649, FromZ = -639, ToX = 11360, ToY = 14922, ToZ = -479} -- "Poison Spray"
evt.CastSpell{Spell = 24, Mastery = const.GM, Skill = 5, FromX = 11179, FromY = 14849, FromZ = -639, ToX = 11047, ToY = 15637, ToZ = -479} -- "Poison Spray"
evt.CastSpell{Spell = 24, Mastery = const.GM, Skill = 5, FromX = 10704, FromY = 15259, FromZ = -639, ToX = 11620, ToY = 15422, ToZ = -479} -- "Poison Spray"
end
end
Timer(evt.map[456].last, 3.5*const.Minute)
evt.hint[501] = evt.str[2] -- "Leave the Cave"
Game.MapEvtLines:RemoveEvent(501)
evt.map[501] = function()
evt.MoveToMap{X = -4324, Y = 1811, Z = 3905, Direction = 172, LookAngle = 0, SpeedZ = 0, HouseId = 0, Icon = 3, Name = "7D07.blv"}
end
evt.hint[502] = evt.str[2] -- "Leave the Cave"
Game.MapEvtLines:RemoveEvent(502)
evt.map[502] = function()
evt.MoveToMap{X = -7766, Y = 7703, Z = -1535, Direction = 1792, LookAngle = 0, SpeedZ = 0, HouseId = 0, Icon = 3, Name = "7D24.blv"}
end
|
package.path = "../?.lua;"..package.path;
--[[
This is a generic file to try out various things ad-hoc
meant to try and throw away
]]
local winman = require("WinMan")
local maths = require("maths")
local radians = maths.radians
local degrees = maths.degrees
local map = maths.map
local cos = math.cos
local sin = math.sin
local CheckerGraphic = require("CheckerGraphic")
local Gradient = require("Gradient")
local LinearGradient, RadialGradient = Gradient.LinearGradient, Gradient.RadialGradient
local guistyle = require("guistyle")
local desktopWidth = 1200
local desktopHeight = 1080
--[[
void draw(SkCanvas* canvas) {
SkColor colors[] = { SK_ColorRED, SK_ColorBLUE };
SkPoint horz[] = { { 0, 0 }, { 256, 0 } };
SkPaint paint;
paint.setShader(SkGradientShader::MakeLinear(horz, colors, nullptr, SK_ARRAY_COUNT(colors),
SkShader::kClamp_TileMode));
canvas->drawPaint(paint);
paint.setBlendMode(SkBlendMode::kDstIn);
SkColor alphas[] = { SK_ColorBLACK, SK_ColorTRANSPARENT };
SkPoint vert[] = { { 0, 0 }, { 0, 256 } };
paint.setShader(SkGradientShader::MakeLinear(vert, alphas, nullptr, SK_ARRAY_COUNT(alphas),
SkShader::kClamp_TileMode));
canvas->drawPaint(paint);
canvas->clipRect( { 30, 30, 226, 226 } );
canvas->drawColor(SkColorSetA(SK_ColorGREEN, 128), SkBlendMode::kSrcOver);
}
--]]
local function app(params)
local win1 = WMCreateWindow(params)
local chk = CheckerGraphic:new({
frame = {x=0,y=0,width=256,height=256};
columns = 32;
rows = 32;
color1 = 192;
color2 = 80;
})
local horz = LinearGradient({
values = {0, 0, 256, 0};
extendMode = BL_EXTEND_MODE_REPEAT;
stops = {
{offset = 0.0, uint32 = 0xffff0000},
{offset = 1.0, uint32 = 0xff0000ff}
};
})
local vert = LinearGradient({
values = {0, 0, 0, 256};
extendMode = BL_EXTEND_MODE_REPEAT;
stops = {
{offset = 0.0, uint32 = 0xff000000},
{offset = 1.0, uint32 = 0x00000000}
};
})
function win1.draw(self, ctx)
ctx = ctx or self:getDrawingContext()
ctx:clear()
-- draw checkboard pattern
chk:draw(ctx)
ctx:setFillStyle(horz);
ctx:fillAll();
-- inset
ctx:setFillStyle(vert)
ctx:fillAll();
ctx:setCompOp(BL_COMP_OP_DST_IN)
ctx:clip(30,30,256-60,256-60)
ctx:setFillStyle(0xff00ff00)
ctx:fillAll();
end
win1:show()
local function drawproc()
win1:draw()
end
periodic(1000/10, drawproc)
--[[
while true do
win1:draw()
yield()
end
--]]
end
local function startup()
spawn(app, {frame = {x=40, y=40, width=256, height=256}})
end
winman {width = desktopWidth, height=desktopHeight, startup = startup, frameRate=30}
|
return function(tests, t)
local Combination = require(game:GetService("ServerStorage").BookWriterPlugin.Plugin.Input.Combination)
local Shift = Enum.ModifierKey.Shift
local Ctrl = Enum.ModifierKey.Ctrl
local Alt = Enum.ModifierKey.Alt
local Meta = Enum.ModifierKey.Meta
tests["Combinations work as expected"] = function()
for alt = 0, 1 do
for shift = 0, 1 do
for ctrl = 0, 1 do
for meta = 0, 1 do
local combination = Combination.Get(shift == 1, ctrl == 1, alt == 1, meta == 1)
t.equals((shift == 1), Combination.Contains(combination, Shift), "shift")
t.equals((ctrl == 1), Combination.Contains(combination, Ctrl), "ctrl")
t.equals((alt == 1), Combination.Contains(combination, Alt), "alt")
t.equals((meta == 1), Combination.Contains(combination, Meta), "meta")
end
end
end
end
end
end
|
Spell = require "spell"
require "utils.keyboard"
SkillTree = require "skill_tree"
Constst = require "utils.consts"
local player = {}
player.__index = player
local maxSpeed = 150
local accSpeed = 500
local slowdownSpeed = 250
local playerRadius = 30
local spells = {
[Constst.parent] = {
maxDistance = 100,
r = 30,
time = 0.1,
minDmg = 15,
maxDmg = 30,
speed = 0,
manaCost = 15,
},
[Constst.skillTag1] = {
maxDistance = playerRadius,
r = 40,
time = 0.1,
minDmg = 20,
maxDmg = 50,
speed = 0,
manaCost = 10,
},
[Constst.skillTag2] = {
maxDistance = playerRadius,
r = 20,
time = 2,
minDmg = 15,
maxDmg = 20,
speed = 700,
manaCost = 15,
},
}
local function new(x, y)
x = x or 0
y = y or 0
return setmetatable({
x = x,
y = y,
dx = 0,
dy = 0,
r = playerRadius,
hp = 100,
invTimer = 0,
currentSpell = Constst.parent,
mana = 100,
manaRegen = 5,
skillTree = SkillTree()}, player)
end
function player:update(dt, field)
self.invTimer = self.invTimer - dt
self.mana = math.min(self.mana + self.manaRegen * dt, 100)
if isKeyDown('w') then
self.dy = self.dy - accSpeed * dt
elseif isKeyDown('s') then
self.dy = self.dy + accSpeed * dt
elseif self.dy > 0 then
self.dy = self.dy - slowdownSpeed * dt
if self.dy < 0 then
self.dy = 0
end
elseif self.dy < 0 then
self.dy = self.dy + slowdownSpeed * dt
if self.dy > 0 then
self.dy = 0
end
end
if isKeyDown('a') then
self.dx = self.dx - accSpeed * dt
elseif isKeyDown('d') then
self.dx = self.dx + accSpeed * dt
elseif self.dx > 0 then
self.dx = self.dx - slowdownSpeed * dt
if self.dx < 0 then
self.dx = 0
end
elseif self.dx < 0 then
self.dx = self.dx + slowdownSpeed * dt
if self.dx > 0 then
self.dx = 0
end
end
if self.dx > maxSpeed then
self.dx = maxSpeed
elseif self.dx < -maxSpeed then
self.dx = -maxSpeed
end
if self.dy > maxSpeed then
self.dy = maxSpeed
elseif self.dy < -maxSpeed then
self.dy = -maxSpeed
end
local newX = self.x + self.dx * dt
local newY = self.y + self.dy * dt
if field:isWalkable(newX, newY) >= 0 then
self.x = newX
self.y = newY
elseif field:isWalkable(self.x, newY) >= 0 then
self.y = newY
self.dx = 0
elseif field:isWalkable(newX, self.y) >= 0 then
self.x = newX
self.dy = 0
end
local t = field:isWalkable(self.x, self.y)
if t > 0 then
self:hit(-t)
end
end
function player:draw(mouseX, mouseY)
love.graphics.setColor(0.5, 0.5, 0.5)
love.graphics.circle(
'fill',
self.x,
self.y,
self.r)
local distanceX = mouseX - self.x
local distanceY = mouseY - self.y
local distance = math.sqrt(distanceX^2 + distanceY^2)
local angle = math.atan2(distanceY, distanceX)
local eyeBallX = self.x + math.cos(angle) * math.min(distance, self.r - 5)
local eyeBallY = self.y + math.sin(angle) * math.min(distance, self.r - 5)
love.graphics.setColor(1, 1, 1)
love.graphics.circle('fill', eyeBallX, eyeBallY, 5)
love.graphics.print(math.floor(self.hp), self.x, self.y)
love.graphics.print(math.floor(self.mana), self.x, self.y + 25)
love.graphics.print(self.currentSpell, self.x, self.y + 50)
end
local function castSpell(spellTag, x, y, angle, mouseDistance)
local spellInfo = spells[spellTag]
local distance = math.min(mouseDistance, spellInfo.maxDistance)
return Spell(
x + math.cos(angle) * distance,
y + math.sin(angle) * distance,
spellInfo.r,
spellInfo.time,
spellInfo.minDmg,
spellInfo.maxDmg,
spellInfo.speed,
angle
)
end
function player:canCastSpell()
return self.mana >= spells[self.currentSpell].manaCost
end
function player:castSpell(mouseX, mouseY)
local distanceX = mouseX - self.x
local distanceY = mouseY - self.y
local distance = math.sqrt(distanceX^2 + distanceY^2)
local angle = math.atan2(distanceY, distanceX)
if self:canCastSpell() then
self.mana = self.mana - spells[self.currentSpell].manaCost
return castSpell(self.currentSpell, self.x, self.y, angle, distance)
end
end
function player:setSpell(spellTag)
if self.skillTree:isSkillLearned(spellTag) then
self.currentSpell = spellTag
end
end
function player:hit(dmg)
if self.invTimer <= 0 then
self.hp = self.hp - dmg
self.invTimer = 0.1
end
end
function player:alive()
return self.hp > 0 and self.hp < 200
end
return setmetatable({new = new},
{__call = function(_, ...) return new(...) end})
|
minetest.register_on_prejoinplayer(function(name, ip)
if name:find("%u.*%d%d%d$") then
minetest.log("action", "Player with name " .. name .. " was blocked by no_guests")
return "Please change your name to not end in numbers"
end
end)
|
function item_double_butterfly_on_spell_start(keys)
keys.caster:EmitSound("DOTA_Item.Butterfly")
keys.ability:ApplyDataDrivenModifier(keys.caster, keys.caster, "modifier_double_butterfly_speed", nil)
end
function item_actual_butterfly_on_spell_start(keys)
keys.caster:EmitSound("DOTA_Item.Butterfly")
keys.ability:ApplyDataDrivenModifier(keys.caster, keys.caster, "modifier_actual_butterfly_speed", nil)
end
|
local S = aurum.get_translator()
screalms.register("aurum:primus", {
description = S"Primus Hortum",
size = vector.new(16000, 2048, 16000),
apply_player = function(player)
player:set_sky{
type = "plain",
base_color = "#336633",
}
player:set_clouds{
color = "#004400bb",
speed = {x = 0, z = -4},
thickness = 32,
density = 0.6,
height = 400,
}
player:set_sun{
sunrise_visible = false,
}
screalms.apply_underground(player)
end,
aurum_dungeon_loot = function(pos)
return {
count = math.random(1, 2),
list = {
{
count = math.random(1, 2),
preciousness = {0, 5},
groups = {"raw_food", "seed", "raw"},
},
},
}
end,
})
-- Spreading fire is snuffed out in Primus Hortum.
local old = fire.on_spread
function fire.on_spread(pos, ...)
if screalms.pos_to_realm(pos) == "aurum:primus" then
local box = b.box.new_radius(pos, 3)
for _,fpos in ipairs(minetest.find_nodes_in_area(box.a, box.b, "fire:basic_flame")) do
minetest.remove_node(fpos)
end
end
old(pos, ...)
end
|
require("vinevim.theme.alpha")
require("vinevim.theme.bufferline")
require("vinevim.theme.colors")
require("vinevim.theme.filetree")
require("vinevim.theme.indent")
require("vinevim.theme.lualine")
|
-- The chat and UI colors
CarTracker.Config.Color = Color(200, 200, 200)
|
local types = require('tags.types')
local cache = require('tags.cache')
local ctags = {}
local tag_info = {}
-- most recent tag that is a 'scope'
tag_info.scope = nil
function ctags.new_tag()
local tag = {}
tag.name = ''
tag.type = ''
tag.parent = nil
tag.children = {}
tag.line = -1
tag.index = -1
return tag
end
function ctags.new_struct()
local struct = {}
struct.tags = {}
struct.functions = ctags.new_tag()
struct.functions.name = 'functions'
struct.functions.line = 0
return struct
end
function ctags.get_output()
if not cache.current_updated() and cache.current.render then
return cache.current.render
end
cache.current.list = {}
cache.current.index = 1
local output = {}
for _, tag in ipairs(cache.current.tags) do
vim.list_extend(output, ctags.render_tag(tag, 0))
cache.current.index = cache.current.index + 1
table.insert(output, '')
end
cache.current.render = output
return output
end
function ctags.render_tag(tag, depth)
tag.index = cache.current.index
cache.current.list[cache.current.index] = tag
cache.current.index = cache.current.index + 1
local output = {}
if cache.current.open[tag] then
table.insert(output, '+ ' .. string.rep(' ', depth) .. tag.name)
for _, child in ipairs(tag.children) do
if #child.children ~= 0 then
table.insert(output, ctags.render_tag(child, depth + 1))
end
child.index = cache.current.index
cache.current.list[cache.current.index] = child
cache.current.index = cache.current.index + 1
table.insert(output, string.rep(' ', depth + 2) .. child.name)
end
else
table.insert(output, '- ' .. string.rep(' ', depth) .. tag.name)
end
return output
end
function ctags.ParseOutput(output)
local parsed_tags = ctags.new_struct()
tag_info.scope = ctags.new_tag()
for _, line in ipairs(output) do
ctags.ParseTagline(line, parsed_tags)
end
cache.current.tags = parsed_tags.tags
table.insert(cache.current.tags, parsed_tags.functions)
--print(vim.inspect(cache.current.tags))
--vim.fn.writefile(tags.ctags_output, 'tags.out')
end
-- Structure of a tag line:
-- tagname<TAB>filename<TAB>expattern;"fields
-- fields: <TAB>name:value
-- fields that are always present: kind, line
function ctags.ParseTagline(line, parsed_tags)
-- ignore comments
if string.match(line, '!_TAG') then
return
end
-- ignore invalid tags
local parts = vim.split(line, ';"\t')
if #parts ~= 2 then
return
end
local typeinfo = types[cache.current.ftype]
local contents = vim.split(parts[1], '\t')
local fields = vim.split(parts[2], '\t')
local tag = ctags.new_tag()
tag.name = contents[1]
tag.type = fields[1]
local line = vim.split(fields[2], ':')
tag.line = tonumber(line[2])
if typeinfo.member[tag.type] then
tag.parent = tag_info.scope
table.insert(tag_info.scope.children, tag)
end
if tag.type == 't' and string.match(tag_info.scope.name, '__anon') then
tag_info.scope.name = tag.name
tag_info.scope.line = tag.line
end
if tag.type == 'f' then
tag.parent = parsed_tags.functions
table.insert(parsed_tags.functions.children, tag)
end
if typeinfo.scope[tag.type] then
table.insert(parsed_tags.tags, tag)
tag_info.scope = tag
end
end
return ctags
|
Locales['de'] = {
['press_collect_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu sammeln',
['press_process_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu verarbeiten',
['press_sell_coke'] = 'drücke ~INPUT_CONTEXT~ um Koks zu verkaufen',
['press_collect_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu sammeln',
['press_process_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu verarbeiten',
['press_sell_meth'] = 'drücke ~INPUT_CONTEXT~ um Meth zu verkaufen',
['press_collect_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu sammeln',
['press_process_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu verarbeiten',
['press_sell_weed'] = 'drücke ~INPUT_CONTEXT~ um Grass zu verkaufen',
['press_collect_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu sammeln',
['press_process_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu verarbeiten',
['press_sell_opium'] = 'drücke ~INPUT_CONTEXT~ um Opium zu verkaufen',
['act_imp_police'] = 'aktion ~r~nihct möglich~s~, ~b~Polizisten~s~: ',
['inv_full_coke'] = 'Du kannst nicht länger Koks sammeln, dein Inventar ist ~r~VOLL~s~',
['pickup_in_prog'] = '~y~Sammeln im gange~s~...',
['too_many_pouches'] = 'du hast zuviele Pakete',
['not_enough_coke'] = 'du hast nicht genug Koks zum ~r~verpacken~s~',
['packing_in_prog'] = '~y~Verarbeitung im gange~s~...',
['no_pouchs_sale'] = 'Du hast nicht genug Portionen zum ~r~verkaufen~s~',
['sold_one_coke'] = 'du verkaufst ~g~x1 Portion Koks~s~',
['sale_in_prog'] = '~g~Verkauf im gange~s~...',
['inv_full_meth'] = 'Du kannst nicht länger Meth sammeln, dein Inventar ist ~r~VOLL~s~',
['not_enough_meth'] = 'du hast nicht genug Meth zum ~r~verpacken~s~',
['sold_one_meth'] = 'du verkaufst ~g~x1 Portion Meth~s~',
['inv_full_weed'] = 'Du kannst nicht länger Grass sammeln, dein Inventar ist ~r~VOLL~s~',
['not_enough_weed'] = 'du hast nicht genug Grass zum ~r~verarbeiten~s~',
['sold_one_weed'] = 'du verkaufst ~g~x1 Portion Grass~s~',
['used_one_weed'] = 'du benutzt 1x ~b~Grass',
['inv_full_opium'] = 'Du kannst nicht länger Opium sammeln, dein Inventar ist ~r~VOLL~s~',
['not_enough_opium'] = 'du hast nicht genug Opium zum ~r~verarbeiten~s~',
['sold_one_opium'] = 'du verkaufst ~g~x1 Portion Opium~s~',
['used_one_opium'] = 'du benutzt 1x ~b~Opium',
}
|
-- Copyright 2021 Kafka-Tarantool-Loader
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
---
--- Created by Igor Kuznetsov.
--- DateTime: 5/10/21 12:13
---
local t = require("luatest")
local g1 = t.group("new_query")
local helper = require("test.helper.integration")
local cluster = helper.cluster
g1.before_each(
function()
local api = cluster:server("api-1").net_box
local r, err = api:call("insert_record", { "EMPLOYEES_TRANSFER", { 1, 1, 1, 1, "123", "123", "123", 100 } })
t.assert_equals(err, nil)
t.assert_equals(r, 1)
r, err = api:call("insert_record", { "EMPLOYEES_TRANSFER_HIST", { 1, 1, 1, 1, 1, "123", "1000", "1000", 5000 } })
t.assert_equals(err, nil)
t.assert_equals(r, 1)
end
)
g1.after_each(
function()
local storage1 = cluster:server("master-1-1").net_box
local storage2 = cluster:server("master-2-1").net_box
storage1:call("box.execute", { "truncate table EMPLOYEES_TRANSFER" })
storage2:call("box.execute", { "truncate table EMPLOYEES_TRANSFER_HIST" })
end
)
g1.test_incorrect_query = function()
local api = cluster:server("api-1").net_box
local _, err = api:call("query", { [[SELECT * FROM EMPLOYEES_TRANSFER as "a"
INNER JOIN EMPLOYEES_HIST as "b" ON "a"."id" = "b"."a_id"
WHERE "id" = 5 and "name" = '123']] })
t.assert_equals(err, "query wasn't s implemented")
end
g1.test_simple_query = function()
local api = cluster:server("api-1").net_box
local r, err = api:call("query", { [[SELECT * FROM EMPLOYEES_TRANSFER where "id" = 5 and "name" = '123']] })
t.assert_equals(err, nil)
t.assert_equals(r, {
metadata = {
{name = "id", type = "number"},
{name = "sysFrom", type = "number"},
{name = "reqId", type = "number"},
{name = "sysOp", type = "number"},
{name = "name", type = "string"},
{name = "department", type = "string"},
{name = "manager", type = "string"},
{name = "salary", type = "number"},
{name = "bucket_id", type = "unsigned"},
},
rows = {},
})
r, err = api:call("query", { [[SELECT * FROM EMPLOYEES_TRANSFER where "id" = 1]] })
t.assert_equals(err, nil)
t.assert_equals(r, {
metadata = {
{name = "id", type = "number"},
{name = "sysFrom", type = "number"},
{name = "reqId", type = "number"},
{name = "sysOp", type = "number"},
{name = "name", type = "string"},
{name = "department", type = "string"},
{name = "manager", type = "string"},
{name = "salary", type = "number"},
{name = "bucket_id", type = "unsigned"},
},
rows = {
{ 1, 1, 1, 1, "123", "123", "123", 100, 3939 }
},
})
r, err = api:call("query", { [[SELECT * FROM (
SELECT "id", "name", "department", "manager", "salary", "bucket_id" FROM EMPLOYEES_TRANSFER WHERE "sysOp" > 0
UNION ALL
SELECT "id", "name", "department", "manager", "salary", "bucket_id" FROM EMPLOYEES_TRANSFER_HIST WHERE "sysOp" > 0
) as "t1"
WHERE "id" = 1]] })
t.assert_equals(err, nil)
t.assert_equals(r, {
metadata = {
{ name = "id", type = "number" },
{ name = "name", type = "string" },
{ name = "department", type = "string" },
{ name = "manager", type = "string" },
{ name = "salary", type = "number" },
{ name = "bucket_id", type = "unsigned" },
},
rows = {
{ 1, "123", "123", "123", 100, 3939 },
{ 1, "123", "1000", "1000", 5000, 3939 }
},
})
end
g1.test_union_query = function()
local api = cluster:server("api-1").net_box
local r, err = api:call("query", { [[SELECT * FROM (
SELECT "id", "name", "department", "manager", "salary", "bucket_id" FROM EMPLOYEES_TRANSFER WHERE "sysOp" > 0
UNION ALL
SELECT "id", "name", "department", "manager", "salary", "bucket_id" FROM EMPLOYEES_TRANSFER_HIST WHERE "sysOp" > 0
) as "t1"
WHERE "id" = 1]] })
t.assert_equals(err, nil)
t.assert_equals(r, {
metadata = {
{ name = "id", type = "number" },
{ name = "name", type = "string" },
{ name = "department", type = "string" },
{ name = "manager", type = "string" },
{ name = "salary", type = "number" },
{ name = "bucket_id", type = "unsigned" },
},
rows = {
{ 1, "123", "123", "123", 100, 3939 },
{ 1, "123", "1000", "1000", 5000, 3939 }
},
})
end
|
--[[Glaives of Wisdom intelligence to damage
Author: chrislotix
Date: 10.1.2015.]]
function IntToDamage(keys)
local ability = keys.ability
local caster = keys.caster
local target = keys.target
local int_caster = caster:GetIntellect()
local int_damage = ability:GetLevelSpecialValueFor("intellect_damage_pct", (ability:GetLevel() -1))
local damage_table = {}
damage_table.attacker = caster
damage_table.damage_type = ability:GetAbilityDamageType()
damage_table.ability = ability
damage_table.victim = target
damage_table.damage = int_caster * int_damage / 100
ApplyDamage(damage_table)
end
--[[Author: YOLOSPAGHETTI
Date: 02.02.2016
Adds stacks to the aesthetic modifiers]]
function AddStacks(keys)
local ability = keys.ability
local caster = keys.caster
local int_steal_modifier = "modifier_glaives_of_wisdom_status"
local int_steal = ability:GetLevelSpecialValueFor("int_steal", (ability:GetLevel() -1))
local duration = ability:GetLevelSpecialValueFor("int_steal_duration", (ability:GetLevel() -1))
if(caster:HasModifier(int_steal_modifier)) then
local stacks = caster:GetModifierStackCount( int_steal_modifier, ability )
-- Adds stacks to the aesthetic modifiers
ability:ApplyDataDrivenModifier(caster, caster, int_steal_modifier, {Duration = duration})
caster:SetModifierStackCount( int_steal_modifier, ability, stacks + int_steal )
else
-- Applies aesthetic stack modifiers to the caster
ability:ApplyDataDrivenModifier(caster, caster, int_steal_modifier, {Duration = duration})
caster:SetModifierStackCount( int_steal_modifier, ability, int_steal )
end
end
--[[Author: YOLOSPAGHETTI
Date: 02.02.2016
Removes stacks from the aesthetic modifiers]]
function RemoveStacks(keys)
local ability = keys.ability
local caster = keys.caster
local int_steal_modifier = "modifier_glaives_of_wisdom_status"
local duration = ability:GetLevelSpecialValueFor("int_steal_duration", (ability:GetLevel() -1))
local levels_since_start = 0
local game_time = GameRules:GetGameTime()
-- Checks how many times the ability has been leveled up during the modifier duration
if ability.level_four_time ~= null then
if ability.level_four_time > game_time - duration then
levels_since_start = levels_since_start + 1
end
end
if ability.level_three_time ~= null then
if ability.level_three_time > game_time - duration then
levels_since_start = levels_since_start + 1
end
end
if ability.level_two_time ~= null then
if ability.level_two_time > game_time - duration then
levels_since_start = levels_since_start + 1
end
end
-- Sets the stacks to remove accordingly
local int_steal = ability:GetLevelSpecialValueFor("int_steal", (ability:GetLevel() - levels_since_start -1))
-- Removes the stacks from the aesthetic modifier
local stacks = caster:GetModifierStackCount( int_steal_modifier, ability )
caster:SetModifierStackCount( int_steal_modifier, ability, stacks - int_steal )
end
--[[Author: YOLOSPAGHETTI
Date: 02.02.2016
Notes ability level up times to help with properly removing stacks]]
function LevelTime(keys)
local ability = keys.ability
-- Keeps note of the time the ability is leveled
if ability:GetLevel() == 2 then
ability.level_two_time = GameRules:GetGameTime()
elseif ability:GetLevel() == 3 then
ability.level_three_time = GameRules:GetGameTime()
elseif ability:GetLevel() == 4 then
ability.level_four_time = GameRules:GetGameTime()
end
end
-- Added code from Rook's essence shift
function OrbSteal( keys )
if keys.target:IsHero() and keys.target:IsOpposingTeam(keys.caster:GetTeam()) then
local previous_stack_count = 0
if keys.caster:HasModifier("modifier_silencer_glaives_of_wisdom_datadriven_buff_counter") then
previous_stack_count = keys.caster:GetModifierStackCount("modifier_silencer_glaives_of_wisdom_datadriven_buff_counter", keys.caster)
keys.caster:RemoveModifierByNameAndCaster("modifier_silencer_glaives_of_wisdom_datadriven_buff_counter", keys.caster)
end
keys.ability:ApplyDataDrivenModifier(keys.caster, keys.caster, "modifier_silencer_glaives_of_wisdom_datadriven_buff_counter", nil)
keys.caster:SetModifierStackCount("modifier_silencer_glaives_of_wisdom_datadriven_buff_counter", keys.caster, previous_stack_count + keys.IntSteal)
keys.ability:ApplyDataDrivenModifier(keys.caster, keys.caster, "modifier_silencer_glaives_of_wisdom_datadriven_buff", nil)
end
end
function BuffOnDestroy( keys )
if keys.caster:HasModifier("modifier_silencer_glaives_of_wisdom_datadriven_buff_counter") then
local previous_stack_count = keys.caster:GetModifierStackCount("modifier_silencer_glaives_of_wisdom_datadriven_buff_counter", keys.caster)
if previous_stack_count > 1 then
keys.caster:SetModifierStackCount("modifier_silencer_glaives_of_wisdom_datadriven_buff_counter", keys.caster, previous_stack_count - keys.IntSteal)
else
keys.caster:RemoveModifierByNameAndCaster("modifier_silencer_glaives_of_wisdom_datadriven_buff_counter", keys.caster)
end
end
end
|
local compareAscending = function(left, right)
if left < right then
return true
elseif left >= right then
return false
end
end
local compareDescending = function(left, right)
if left > right then
return true
elseif left <= right then
return false
end
end
function Auctionator.Utilities.NumberComparator(order, fieldName)
return function(left, right)
if order == Auctionator.Constants.SORT.ASCENDING then
return compareAscending((left and left[fieldName] or 0), (right and right[fieldName] or 0))
else
return compareDescending((left and left[fieldName] or 0), (right and right[fieldName] or 0))
end
end
end
function Auctionator.Utilities.StringComparator(order, fieldName)
return function(left, right)
if left == nil then left = {} end
if right == nil then right = {} end
if order == Auctionator.Constants.SORT.ASCENDING then
return compareAscending((left[fieldName] or ""), (right[fieldName] or ""))
else
return compareDescending((left[fieldName] or ""), (right[fieldName] or ""))
end
end
end
|
function shortcutOpen()
Interface.openWindow(shortcut_class.getValue(), shortcut_db.getValue())
end
|
local fadeInTime, fadeOutTime, maxAlpha, animScale, iconSize, holdTime, showSpellName, ignoredSpells, invertIgnored
local cooldowns, animating, watching = { }, { }, { }
local GetTime = GetTime
local defaultSettings = {
fadeInTime = 0.3,
fadeOutTime = 0.7,
maxAlpha = 0.7,
animScale = 1.5,
iconSize = 75,
holdTime = 0,
petOverlay = {1,1,1},
showSpellName = nil,
x = UIParent:GetWidth()*UIParent:GetEffectiveScale()/2,
y = UIParent:GetHeight()*UIParent:GetEffectiveScale()/2
}
local defaultSettingsPerCharacter = {
ignoredSpells = "",
invertIgnored = false
}
local DCP = CreateFrame("frame")
DCP:SetScript("OnEvent", function(self, event, ...) self[event](self, ...) end)
DCP:SetMovable(true)
DCP:RegisterForDrag("LeftButton")
DCP:SetScript("OnDragStart", function(self) self:StartMoving() end)
DCP:SetScript("OnDragStop", function(self)
self:StopMovingOrSizing()
DCP_Saved.x = self:GetLeft()+self:GetWidth()/2
DCP_Saved.y = self:GetBottom()+self:GetHeight()/2
self:ClearAllPoints()
self:SetPoint("CENTER",UIParent,"BOTTOMLEFT",DCP_Saved.x,DCP_Saved.y)
end)
DCP.TextFrame = DCP:CreateFontString(nil, "ARTWORK")
DCP.TextFrame:SetFont(STANDARD_TEXT_FONT, 14, "OUTLINE")
DCP.TextFrame:SetShadowOffset(2,-2)
DCP.TextFrame:SetPoint("CENTER",DCP,"CENTER")
DCP.TextFrame:SetWidth(185)
DCP.TextFrame:SetJustifyH("CENTER")
DCP.TextFrame:SetTextColor(1,1,1)
local DCPT = DCP:CreateTexture(nil,"BACKGROUND")
DCPT:SetAllPoints(DCP)
-----------------------
-- Utility Functions --
-----------------------
local function tcount(tab)
local n = 0
for _ in pairs(tab) do
n = n + 1
end
return n
end
local function memoize(f)
local cache = nil
local memoized = {}
local function get()
if (cache == nil) then
cache = f()
end
return cache
end
memoized.resetCache = function()
cache = nil
end
setmetatable(memoized, {__call = get})
return memoized
end
local function GetPetActionIndexByName(name)
for i=1, NUM_PET_ACTION_SLOTS, 1 do
if (GetPetActionInfo(i) == name) then
return i
end
end
return nil
end
local function RefreshLocals()
fadeInTime = DCP_Saved.fadeInTime
fadeOutTime = DCP_Saved.fadeOutTime
maxAlpha = DCP_Saved.maxAlpha
animScale = DCP_Saved.animScale
iconSize = DCP_Saved.iconSize
holdTime = DCP_Saved.holdTime
showSpellName = DCP_Saved.showSpellName
invertIgnored = DCP_SavedPerCharacter.invertIgnored
ignoredSpells = { }
for _,v in ipairs({strsplit(",",DCP_SavedPerCharacter.ignoredSpells)}) do
ignoredSpells[strtrim(v)] = true
end
end
--------------------------
-- Cooldown / Animation --
--------------------------
local elapsed = 0
local runtimer = 0
local function OnUpdate(_,update)
elapsed = elapsed + update
if (elapsed > 0.05) then
for i,v in pairs(watching) do
if (GetTime() >= v[1] + 0.5) then
local getCooldownDetails
if (v[2] == "spell") then
getCooldownDetails = memoize(function()
local start, duration, enabled = GetSpellCooldown(v[3])
return {
name = GetSpellInfo(v[3]),
texture = GetSpellTexture(v[3]),
start = start,
duration = duration,
enabled = enabled
}
end)
elseif (v[2] == "item") then
getCooldownDetails = memoize(function()
local start, duration, enabled = GetItemCooldown(i)
return {
name = GetItemInfo(i),
texture = v[3],
start = start,
duration = duration,
enabled = enabled
}
end)
elseif (v[2] == "pet") then
getCooldownDetails = memoize(function()
local name, texture = GetPetActionInfo(v[3])
local start, duration, enabled = GetPetActionCooldown(v[3])
return {
name = name,
texture = texture,
isPet = true,
start = start,
duration = duration,
enabled = enabled
}
end)
end
local cooldown = getCooldownDetails()
if ((ignoredSpells[cooldown.name] ~= nil) ~= invertIgnored) then
watching[i] = nil
else
if (cooldown.enabled ~= 0) then
if (cooldown.duration and cooldown.duration > 2.0 and cooldown.texture) then
cooldowns[i] = getCooldownDetails
end
end
if (not (cooldown.enabled == 0 and v[2] == "spell")) then
watching[i] = nil
end
end
end
end
for i,getCooldownDetails in pairs(cooldowns) do
local cooldown = getCooldownDetails()
local remaining = cooldown.duration-(GetTime()-cooldown.start)
if (remaining <= 0) then
tinsert(animating, {cooldown.texture,cooldown.isPet,cooldown.name})
cooldowns[i] = nil
end
end
elapsed = 0
if (#animating == 0 and tcount(watching) == 0 and tcount(cooldowns) == 0) then
DCP:SetScript("OnUpdate", nil)
return
end
end
if (#animating > 0) then
runtimer = runtimer + update
if (runtimer > (fadeInTime + holdTime + fadeOutTime)) then
tremove(animating,1)
runtimer = 0
DCP.TextFrame:SetText(nil)
DCPT:SetTexture(nil)
DCPT:SetVertexColor(1,1,1)
else
if (not DCPT:GetTexture()) then
if (animating[1][3] ~= nil and showSpellName) then
DCP.TextFrame:SetText(animating[1][3])
end
DCPT:SetTexture(animating[1][1])
if animating[1][2] then
DCPT:SetVertexColor(unpack(DCP_Saved.petOverlay))
end
end
local alpha = maxAlpha
if (runtimer < fadeInTime) then
alpha = maxAlpha * (runtimer / fadeInTime)
elseif (runtimer >= fadeInTime + holdTime) then
alpha = maxAlpha - ( maxAlpha * ((runtimer - holdTime - fadeInTime) / fadeOutTime))
end
DCP:SetAlpha(alpha)
local scale = iconSize+(iconSize*((animScale-1)*(runtimer/(fadeInTime+holdTime+fadeOutTime))))
DCP:SetWidth(scale)
DCP:SetHeight(scale)
end
end
end
--------------------
-- Event Handlers --
--------------------
function DCP:ADDON_LOADED(addon)
if (not DCP_Saved) then
DCP_Saved = {unpack(defaultSettings)}
else
for i,v in pairs(defaultSettings) do
if (not DCP_Saved[i]) then
DCP_Saved[i] = v
end
end
end
if (not DCP_SavedPerCharacter) then
-- Unpack as shallow clone to avoid reset-to-default as considering the
-- value assigned from the legacy saved variable below.
DCP_SavedPerCharacter = {unpack(defaultSettingsPerCharacter)}
-- Backwards compatibility: Assign from legacy saved value if exists.
if (DCP_Saved.ignoredSpells) then
DCP_SavedPerCharacter.ignoredSpells = DCP_Saved.ignoredSpells
end
else
for i,v in pairs(defaultSettingsPerCharacter) do
if (not DCP_SavedPerCharacter[i]) then
DCP_SavedPerCharacter[i] = v
end
end
end
RefreshLocals()
self:SetPoint("CENTER",UIParent,"BOTTOMLEFT",DCP_Saved.x,DCP_Saved.y)
self:UnregisterEvent("ADDON_LOADED")
end
DCP:RegisterEvent("ADDON_LOADED")
function DCP:SPELL_UPDATE_COOLDOWN()
for i,getCooldownDetails in pairs(cooldowns) do
getCooldownDetails.resetCache()
end
end
DCP:RegisterEvent("SPELL_UPDATE_COOLDOWN")
function DCP:UNIT_SPELLCAST_SUCCEEDED(unit,lineID,spellID)
if (unit == "player") then
watching[spellID] = {GetTime(),"spell",spellID}
if (not self:IsMouseEnabled()) then
self:SetScript("OnUpdate", OnUpdate)
end
end
end
DCP:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
function DCP:COMBAT_LOG_EVENT_UNFILTERED()
local _,event,_,_,_,sourceFlags,_,_,_,_,_,spellID = CombatLogGetCurrentEventInfo()
if (event == "SPELL_CAST_SUCCESS") then
if (bit.band(sourceFlags,COMBATLOG_OBJECT_TYPE_PET) == COMBATLOG_OBJECT_TYPE_PET and bit.band(sourceFlags,COMBATLOG_OBJECT_AFFILIATION_MINE) == COMBATLOG_OBJECT_AFFILIATION_MINE) then
local name = GetSpellInfo(spellID)
local index = GetPetActionIndexByName(name)
if (index and not select(7,GetPetActionInfo(index))) then
watching[spellID] = {GetTime(),"pet",index}
elseif (not index and spellID) then
watching[spellID] = {GetTime(),"spell",spellID}
else
return
end
if (not self:IsMouseEnabled()) then
self:SetScript("OnUpdate", OnUpdate)
end
end
end
end
DCP:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
function DCP:PLAYER_ENTERING_WORLD()
local inInstance,instanceType = IsInInstance()
if (inInstance and instanceType == "arena") then
self:SetScript("OnUpdate", nil)
wipe(cooldowns)
wipe(watching)
end
end
DCP:RegisterEvent("PLAYER_ENTERING_WORLD")
hooksecurefunc("UseAction", function(slot)
local actionType,itemID = GetActionInfo(slot)
if (actionType == "item") then
local texture = GetActionTexture(slot)
watching[itemID] = {GetTime(),"item",texture}
end
end)
hooksecurefunc("UseInventoryItem", function(slot)
local itemID = GetInventoryItemID("player", slot);
if (itemID) then
local texture = GetInventoryItemTexture("player", slot)
watching[itemID] = {GetTime(),"item",texture}
end
end)
hooksecurefunc("UseContainerItem", function(bag,slot)
local itemID = GetContainerItemID(bag, slot)
if (itemID) then
local texture = select(10, GetItemInfo(itemID))
watching[itemID] = {GetTime(),"item",texture}
end
end)
-------------------
-- Options Frame --
-------------------
SlashCmdList["DOOMCOOLDOWNPULSE"] = function() if (not DCP_OptionsFrame) then DCP:CreateOptionsFrame() end DCP_OptionsFrame:Show() end
SLASH_DOOMCOOLDOWNPULSE1 = "/dcp"
SLASH_DOOMCOOLDOWNPULSE2 = "/cooldownpulse"
SLASH_DOOMCOOLDOWNPULSE3 = "/doomcooldownpulse"
function DCP:CreateOptionsFrame()
local sliders = {
{ text = "Icon Size", value = "iconSize", min = 30, max = 125, step = 5 },
{ text = "Fade In Time", value = "fadeInTime", min = 0, max = 1.5, step = 0.1 },
{ text = "Fade Out Time", value = "fadeOutTime", min = 0, max = 1.5, step = 0.1 },
{ text = "Max Opacity", value = "maxAlpha", min = 0, max = 1, step = 0.1 },
{ text = "Max Opacity Hold Time", value = "holdTime", min = 0, max = 1.5, step = 0.1 },
{ text = "Animation Scaling", value = "animScale", min = 0, max = 2, step = 0.1 },
}
local buttons = {
{ text = "Close", func = function(self) self:GetParent():Hide() end },
{ text = "Test", func = function(self)
DCP_OptionsFrameButton3:SetText("Unlock")
DCP:EnableMouse(false)
RefreshLocals()
tinsert(animating,{"Interface\\Icons\\Spell_Nature_Earthbind",nil,"Spell Name"})
DCP:SetScript("OnUpdate", OnUpdate)
end },
{ text = "Unlock", func = function(self)
if (self:GetText() == "Unlock") then
RefreshLocals()
DCP:SetWidth(iconSize)
DCP:SetHeight(iconSize)
self:SetText("Lock")
DCP:SetScript("OnUpdate", nil)
DCP:SetAlpha(1)
DCPT:SetTexture("Interface\\Icons\\Spell_Nature_Earthbind")
DCP:EnableMouse(true)
else
DCP:SetAlpha(0)
self:SetText("Unlock")
DCP:EnableMouse(false)
end end },
{ text = "Defaults", func = function(self)
for i,v in pairs(defaultSettings) do
DCP_Saved[i] = v
end
for i,v in pairs(defaultSettingsPerCharacter) do
DCP_SavedPerCharacter[i] = v
end
for i,v in pairs(sliders) do
getglobal("DCP_OptionsFrameSlider"..i):SetValue(DCP_Saved[v.value])
end
DCP_OptionsFramePetColorBox:GetNormalTexture():SetVertexColor(unpack(DCP_Saved.petOverlay))
DCP_OptionsFrameIgnoreTypeButtonWhitelist:SetChecked(false)
DCP_OptionsFrameIgnoreTypeButtonBlacklist:SetChecked(true)
DCP_OptionsFrameIgnoreBox:SetText("")
DCP:ClearAllPoints()
DCP:SetPoint("CENTER",UIParent,"BOTTOMLEFT",DCP_Saved.x,DCP_Saved.y)
end },
}
local optionsframe = CreateFrame("frame","DCP_OptionsFrame",UIParent,BackdropTemplateMixin and "BackdropTemplate")
optionsframe:SetBackdrop({
bgFile="Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile="Interface\\DialogFrame\\UI-DialogBox-Border",
tile=1, tileSize=32, edgeSize=32,
insets={left=11, right=12, top=12, bottom=11}
})
optionsframe:SetWidth(220)
optionsframe:SetHeight(540)
optionsframe:SetPoint("CENTER",UIParent)
optionsframe:EnableMouse(true)
optionsframe:SetMovable(true)
optionsframe:RegisterForDrag("LeftButton")
optionsframe:SetScript("OnDragStart", function(self) self:StartMoving() end)
optionsframe:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
optionsframe:SetFrameStrata("FULLSCREEN_DIALOG")
optionsframe:SetScript("OnHide", function() RefreshLocals() end)
tinsert(UISpecialFrames, "DCP_OptionsFrame")
local header = optionsframe:CreateTexture(nil,"ARTWORK")
header:SetTexture("Interface\\DialogFrame\\UI-DialogBox-Header.blp")
header:SetWidth(350)
header:SetHeight(68)
header:SetPoint("TOP",optionsframe,"TOP",0,12)
local headertext = optionsframe:CreateFontString(nil,"ARTWORK","GameFontNormal")
headertext:SetPoint("TOP",header,"TOP",0,-14)
headertext:SetText("Doom_CooldownPulse")
for i,v in pairs(sliders) do
local slider = CreateFrame("slider", "DCP_OptionsFrameSlider"..i, optionsframe, "OptionsSliderTemplate")
if (i == 1) then
slider:SetPoint("TOP",optionsframe,"TOP",0,-40)
else
slider:SetPoint("TOP",getglobal("DCP_OptionsFrameSlider"..(i-1)),"BOTTOM",0,-35)
end
local valuetext = slider:CreateFontString(nil,"ARTWORK","GameFontNormalSmall")
valuetext:SetPoint("TOP",slider,"BOTTOM",0,-1)
valuetext:SetText(format("%.1f",DCP_Saved[v.value]))
getglobal("DCP_OptionsFrameSlider"..i.."Text"):SetText(v.text)
getglobal("DCP_OptionsFrameSlider"..i.."Low"):SetText(v.min)
getglobal("DCP_OptionsFrameSlider"..i.."High"):SetText(v.max)
slider:SetMinMaxValues(v.min,v.max)
slider:SetValueStep(v.step)
slider:SetValue(DCP_Saved[v.value])
slider:SetScript("OnValueChanged",function()
local val=slider:GetValue() DCP_Saved[v.value]=val
valuetext:SetText(format("%.1f",val))
if (DCP:IsMouseEnabled()) then
DCP:SetWidth(DCP_Saved.iconSize)
DCP:SetHeight(DCP_Saved.iconSize)
end end)
end
local pettext = optionsframe:CreateFontString(nil,"ARTWORK","GameFontNormalSmall")
pettext:SetPoint("TOPLEFT","DCP_OptionsFrameSlider"..#sliders,"BOTTOMLEFT",-15,-30)
pettext:SetText("Pet color overlay:")
local petcolorselect = CreateFrame('Button',"DCP_OptionsFramePetColorBox",optionsframe)
petcolorselect:SetPoint("LEFT",pettext,"RIGHT",10,0)
petcolorselect:SetWidth(20)
petcolorselect:SetHeight(20)
petcolorselect:SetNormalTexture('Interface/ChatFrame/ChatFrameColorSwatch')
petcolorselect:GetNormalTexture():SetVertexColor(unpack(DCP_Saved.petOverlay))
petcolorselect:SetScript("OnEnter",function(self) GameTooltip:SetOwner(self, "ANCHOR_CURSOR") GameTooltip:SetText("Note: Use white if you don't want any overlay for pet cooldowns") end)
petcolorselect:SetScript("OnLeave",function(self) GameTooltip:Hide() end)
petcolorselect:SetScript('OnClick', function(self)
self.r,self.g,self.b = unpack(DCP_Saved.petOverlay)
OpenColorPicker(self)
ColorPickerFrame:SetPoint("TOPLEFT",optionsframe,"TOPRIGHT")
end)
petcolorselect.swatchFunc = function(self) DCP_Saved.petOverlay={ColorPickerFrame:GetColorRGB()} petcolorselect:GetNormalTexture():SetVertexColor(ColorPickerFrame:GetColorRGB()) end
petcolorselect.cancelFunc = function(self) DCP_Saved.petOverlay={self.r,self.g,self.b} petcolorselect:GetNormalTexture():SetVertexColor(unpack(DCP_Saved.petOverlay)) end
local petcolorselectbg = petcolorselect:CreateTexture(nil, 'BACKGROUND')
petcolorselectbg:SetWidth(17)
petcolorselectbg:SetHeight(17)
petcolorselectbg:SetTexture(1,1,1)
petcolorselectbg:SetPoint('CENTER')
local spellnametext = optionsframe:CreateFontString(nil,"ARTWORK","GameFontNormalSmall")
spellnametext:SetPoint("TOPLEFT",pettext,"BOTTOMLEFT",0,-18)
spellnametext:SetText("Show spell name:")
local spellnamecbt = CreateFrame("CheckButton","DCP_OptionsFrameSpellNameCheckButton",optionsframe,"OptionsCheckButtonTemplate")
spellnamecbt:SetPoint("LEFT",spellnametext,"RIGHT",6,0)
spellnamecbt:SetChecked(DCP_Saved.showSpellName)
spellnamecbt:SetScript("OnClick", function(self)
local newState = self:GetChecked()
self:SetChecked(newState)
DCP_Saved.showSpellName = newState
RefreshLocals()
end)
local ignoretext = optionsframe:CreateFontString(nil,"ARTWORK","GameFontNormalSmall")
ignoretext:SetPoint("TOPLEFT",spellnametext,"BOTTOMLEFT",0,-18)
ignoretext:SetText("Filter spells:")
local ignoretypebuttonblacklist = CreateFrame("Checkbutton","DCP_OptionsFrameIgnoreTypeButtonBlacklist",optionsframe,"UIRadioButtonTemplate")
ignoretypebuttonblacklist:SetPoint("TOPLEFT",ignoretext,"BOTTOMLEFT",0,-4)
ignoretypebuttonblacklist:SetChecked(not DCP_SavedPerCharacter.invertIgnored)
ignoretypebuttonblacklist:SetScript("OnClick", function()
DCP_OptionsFrameIgnoreTypeButtonWhitelist:SetChecked(false)
DCP_SavedPerCharacter.invertIgnored = false
RefreshLocals()
end)
local ignoretypetextblacklist = optionsframe:CreateFontString(nil,"ARTWORK","GameFontNormalSmall")
ignoretypetextblacklist:SetPoint("LEFT",ignoretypebuttonblacklist,"RIGHT",4,0)
ignoretypetextblacklist:SetText("Blacklist")
local ignoretypebuttonwhitelist = CreateFrame("Checkbutton","DCP_OptionsFrameIgnoreTypeButtonWhitelist",optionsframe,"UIRadioButtonTemplate")
ignoretypebuttonwhitelist:SetPoint("LEFT",ignoretypetextblacklist,"RIGHT",10,0)
ignoretypebuttonwhitelist:SetChecked(DCP_SavedPerCharacter.invertIgnored)
ignoretypebuttonwhitelist:SetScript("OnClick", function()
DCP_OptionsFrameIgnoreTypeButtonBlacklist:SetChecked(false)
DCP_SavedPerCharacter.invertIgnored = true
RefreshLocals()
end)
local ignoretypetextwhitelist = optionsframe:CreateFontString(nil,"ARTWORK","GameFontNormalSmall")
ignoretypetextwhitelist:SetPoint("LEFT",ignoretypebuttonwhitelist,"RIGHT",4,0)
ignoretypetextwhitelist:SetText("Whitelist")
local ignorebox = CreateFrame("EditBox","DCP_OptionsFrameIgnoreBox",optionsframe,"InputBoxTemplate")
ignorebox:SetAutoFocus(false)
ignorebox:SetPoint("TOPLEFT",ignoretypebuttonblacklist,"BOTTOMLEFT",4,2)
ignorebox:SetWidth(170)
ignorebox:SetHeight(32)
ignorebox:SetText(DCP_SavedPerCharacter.ignoredSpells)
ignorebox:SetScript("OnEnter",function(self) GameTooltip:SetOwner(self, "ANCHOR_CURSOR") GameTooltip:SetText("Note: Separate multiple spells with commas") end)
ignorebox:SetScript("OnLeave",function(self) GameTooltip:Hide() end)
ignorebox:SetScript("OnEnterPressed", function(self) self:ClearFocus() end)
ignorebox:SetScript("OnEditFocusLost",function(self)
DCP_SavedPerCharacter.ignoredSpells = ignorebox:GetText()
RefreshLocals()
end)
for i,v in pairs(buttons) do
local button = CreateFrame("Button", "DCP_OptionsFrameButton"..i, optionsframe, "UIPanelButtonTemplate")
button:SetHeight(24)
button:SetWidth(75)
button:SetPoint("BOTTOM", optionsframe, "BOTTOM", ((i%2==0 and -1) or 1)*45, ceil(i/2)*15 + (ceil(i/2)-1)*15)
button:SetText(v.text)
button:SetScript("OnClick", function(self) PlaySound(852) v.func(self) end)
end
end
|
local UIButton = import(".UIButton")
local UIPushButton = class("UIPushButton", UIButton)
UIPushButton.NORMAL = "normal"
UIPushButton.PRESSED = "pressed"
UIPushButton.DISABLED = "disabled"
function UIPushButton:ctor(images, options)
UIPushButton.super.ctor(self, {
{name = "disable", from = {"normal", "pressed"}, to = "disabled"},
{name = "enable", from = {"disabled"}, to = "normal"},
{name = "press", from = "normal", to = "pressed"},
{name = "release", from = "pressed", to = "normal"},
}, "normal", options)
if type(images) ~= "table" then images = {normal = images} end
self:setButtonImage(UIPushButton.NORMAL, images["normal"], true)
self:setButtonImage(UIPushButton.PRESSED, images["pressed"], true)
self:setButtonImage(UIPushButton.DISABLED, images["disabled"], true)
end
function UIPushButton:setButtonImage(state, image, ignoreEmpty)
assert(state == UIPushButton.NORMAL
or state == UIPushButton.PRESSED
or state == UIPushButton.DISABLED,
string.format("UIPushButton:setButtonImage() - invalid state %s", tostring(state)))
UIPushButton.super.setButtonImage(self, state, image, ignoreEmpty)
if state == UIPushButton.NORMAL then
if not self.images_[UIPushButton.PRESSED] then
self.images_[UIPushButton.PRESSED] = image
end
if not self.images_[UIPushButton.DISABLED] then
self.images_[UIPushButton.DISABLED] = image
end
end
return self
end
function UIPushButton:onTouch_(event, x, y)
if event == "began" then
if not self:checkTouchInSprite_(x, y) then return false end
self.fsm_:doEvent("press")
self:dispatchEvent({name = UIButton.PRESSED_EVENT, x = x, y = y, touchInTarget = true})
return true
end
local touchInTarget = self:checkTouchInSprite_(x, y)
if event == "moved" then
if touchInTarget and self.fsm_:canDoEvent("press") then
self.fsm_:doEvent("press")
self:dispatchEvent({name = UIButton.PRESSED_EVENT, x = x, y = y, touchInTarget = true})
elseif not touchInTarget and self.fsm_:canDoEvent("release") then
self.fsm_:doEvent("release")
self:dispatchEvent({name = UIButton.RELEASE_EVENT, x = x, y = y, touchInTarget = false})
end
else
if self.fsm_:canDoEvent("release") then
self.fsm_:doEvent("release")
self:dispatchEvent({name = UIButton.RELEASE_EVENT, x = x, y = y, touchInTarget = touchInTarget})
end
if event == "ended" and touchInTarget then
self:dispatchEvent({name = UIButton.CLICKED_EVENT, x = x, y = y, touchInTarget = true})
end
end
end
return UIPushButton
|
return {'dweepachtig','dweepster','dweepziek','dweepzucht','dweepzuchtig','dweil','dweilen','dweilorkest','dweilpauze','dweilwagen','dwepen','dweper','dweperig','dweperij','dwerg','dwergachtig','dwergeik','dwergengestalte','dwerggroei','dwergstaat','dwergstern','dwergvinvis','dwergvleermuis','dwergvolk','dwergwerpen','dwergberk','dwergplaneet','dwerghamster','dwergster','dwergenkoning','dwergkonijn','dwergmens','dwerguil','dwergvorm','dweilband','dwerggeit','dweilwater','dweep','dweepachtige','dweept','dweepte','dweepten','dweepzieke','dweepzuchtige','dweilde','dweilden','dweilt','dweiltje','dwepend','dweperige','dweperijen','dwepers','dwergachtige','dwergeiken','dwergen','dwergje','dwergjes','dwergvleermuizen','dwergvolken','dweepsters','dweilorkesten','dweilpauzes','dweilwagens','dwergstaatje','dwergstaten','dwergsterns','dwergvinvissen','dwergberken','dwergvolkeren','dwerghamsters','dwergmensen','dweiltjes','dwergvormen','dwergkonijntje','dwergkonijnen','dwergstaatjes'}
|
return {
fields = {
add = { type = "table",
schema = {
fields = {
form = { type = "array" },
headers = { type = "array" },
querystring = { type = "array" }
}
}
},
remove = { type = "table",
schema = {
fields = {
form = { type = "array" },
headers = { type = "array" },
querystring = { type = "array" }
}
}
}
}
}
|
local Import = require"Toolbox.Import"
local Vlpeg = Import.Module.Relative"Vlpeg"
local Object = Import.Module.Relative"Object"
return Object(
"Nested.PEG.Apply", {
Construct = function(self, SubPattern, Value)
self.SubPattern = SubPattern
self.Value = Value
end;
Decompose = function(self, Canonical)
return Vlpeg.Apply(
self.SubPattern(Canonical),
self.Value
)
end;
Copy = function(self)
return -self.SubPattern, self.Value
end;
ToString = function(self)
return tostring(self.SubPattern) .."/".. tostring(self.Value)
end;
}
)
|
-- Plugins
local packer = require "jesse.plugin.packer"
local use = packer.use
local use_rocks = packer.use_rocks
-- Install
packer.startup {
function()
-- Util
use "wbthomason/packer.nvim"
use "nvim-lua/plenary.nvim"
use {
"rcarriga/nvim-notify",
config = function()
require "jesse.plugin.config.nvim-notify"
end,
}
use "kyazdani42/nvim-web-devicons"
-- Performance
-- use "lewis6991/impatient.nvim"
-- Colors
use {
"catppuccin/nvim",
as = "catppuccin",
config = function()
require "jesse.plugin.config.catppuccin"
vim.cmd [[colorscheme catppuccin]]
end,
}
use {
"norcalli/nvim-colorizer.lua",
config = function()
require("colorizer").setup()
end,
}
-- Dashboard
use {
"goolord/alpha-nvim",
config = function()
require("alpha").setup(require("alpha.themes.dashboard").opts)
end,
}
-- Line
use {
"feline-nvim/feline.nvim",
config = function()
require("feline").setup {
components = require "jesse.plugin.config.feline",
}
end,
}
-- Navigation
use "farmergreg/vim-lastplace"
use {
"petertriho/nvim-scrollbar",
config = function()
require "jesse.plugin.config.nvim-scrollbar"
end,
}
use {
"nvim-telescope/telescope.nvim",
requires = { { "nvim-lua/plenary.nvim" } },
config = function()
require "jesse.plugin.config.telescope"
end,
}
use "nvim-telescope/telescope-fzy-native.nvim"
-- Completion
use {
"hrsh7th/nvim-cmp",
requires = { { "onsails/lspkind-nvim" }, { "L3MON4D3/LuaSnip" } },
config = function()
require "jesse.plugin.config.cmp"
end,
}
use "onsails/lspkind-nvim"
use "hrsh7th/cmp-buffer"
use "hrsh7th/cmp-path"
use "hrsh7th/cmp-nvim-lua"
use "hrsh7th/cmp-nvim-lsp"
use "f3fora/cmp-spell"
use {
"windwp/nvim-autopairs",
config = function()
require "jesse.plugin.config.nvim-autopairs"
end,
}
-- Language
use "neovim/nvim-lspconfig"
use "williamboman/nvim-lsp-installer"
use "jose-elias-alvarez/null-ls.nvim"
use {
"nvim-treesitter/nvim-treesitter",
run = ":TSUpdate",
config = function()
require "jesse.plugin.config.treesitter"
end,
}
use "b0o/schemastore.nvim"
use "RRethy/nvim-treesitter-endwise"
-- TS
use "jose-elias-alvarez/nvim-lsp-ts-utils"
-- Snippets
use "L3MON4D3/LuaSnip"
use "saadparwaiz1/cmp_luasnip"
-- Git
use {
"lewis6991/gitsigns.nvim",
requires = {
"nvim-lua/plenary.nvim",
},
config = function()
require "jesse.plugin.config.gitsigns"
end,
}
-- Tree
use {
"kyazdani42/nvim-tree.lua",
requires = {
"kyazdani42/nvim-web-devicons", -- optional, for file icon
},
config = function()
require "jesse.plugin.config.nvim-tree"
end,
}
-- Comment
use {
"numToStr/Comment.nvim",
config = function()
require("Comment").setup()
end,
}
-- use "JoosepAlviste/nvim-ts-context-commentstring"
-- Automatically set up your configuration after cloning packer.nvim
if PACKER_BOOTSTRAP then
require("packer").sync()
end
end,
}
|
-- RU support by ForgottenLight
-- Add support for unoffical Russian languages to MailLooter.
-- Compatible with RuESO 10.0
local CORE = MailLooter.Core
-- General
ZO_CreateStringId("SI_MAILLOOTER_ADDON_NAME", "MailLooter (Сборщик почты)")
ZO_CreateStringId("SI_MAILLOOTER_TITLE", "MailLooter (Сборщик почты)")
-- There may be up to 6 strings for the defaults.
MailLooter.defaultAutoReturnSubjects =
{ "return", "bounce", "rts", "return to sender", "вернуть" }
-- These must match the titles of offical mails.
MailLooter.unofficalLang = {
["lang"] = "ru", -- The language code
["titlesAvA"] = { -- Offical AvA Mails
},
["titlesHirelings"] = { -- Offical Hireling Mails
["Сырье для кузнеца"] = { true, CRAFTING_TYPE_BLACKSMITHING},
["Сырье для портного"] = { true, CRAFTING_TYPE_WOODWORKING},
["Сырье для столяра"] = { true, CRAFTING_TYPE_CLOTHIER},
["Сырье для зачарователя"] = { true, CRAFTING_TYPE_ENCHANTING},
["Сырье для снабженца"] = { true, CRAFTING_TYPE_PROVISIONING},
},
["titlesStores"] = { -- Offical Guild Store Mails
["Срок продажи предмета истек"] = { true, CORE.SUBTYPE_STORE_EXPIRED },
["Предмет приобретен"] = { true, CORE.SUBTYPE_STORE_PURCHASED },
["Продажа предмета отменена"] = { true, CORE.SUBTYPE_STORE_CANCELLED },
["Предмет продан"] = { true, CORE.SUBTYPE_STORE_SOLD },
},
}
--
-- Addon Translated strings below:
--
-- Keybingings:
ZO_CreateStringId("SI_BINDING_NAME_MAILLOOTER_OPEN", "Открыть")
ZO_CreateStringId("SI_BINDING_NAME_MAILLOOTER_QUICK_LOOT_ALL", "Открыть и собрать все")
ZO_CreateStringId("SI_BINDING_NAME_MAILLOOTER_QUICK_LOOT_FILTERED", "Открыть и собрать выбранное")
-- Keybind Strip
ZO_CreateStringId("SI_MAILLOOTER_STRIP_LOOT_MAIN", "Собрать почту")
ZO_CreateStringId("SI_MAILLOOTER_STRIP_CANCEL", "Отменить")
ZO_CreateStringId("SI_MAILLOOTER_STRIP_CLEAR", "Очистить")
-- Summary Bar
ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_INBOX", "ВХОДЯЩИЕ:")
ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_ALL", "Вся почта:")
ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_UNREAD", "Нечитан.:")
ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_LOOTABLE", "Собираемые:")
--ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_AVA", "AvA:")
ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_HIRELING", "Наемники:")
ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_STORE", "Продажи:")
--ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_COD", "CoD:")
ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_OTHER", "Прочие:")
ZO_CreateStringId("SI_MAILLOOTER_SUMMERY_DONE", "Выполнено.")
ZO_CreateStringId("SI_MAILLOOTER_SUMMERY_LOOTING", "Сбор почты...")
-- Filter Bar Tool Tips
ZO_CreateStringId("SI_MAILLOOTER_FILTER_ALL", "Все письма, которые можно собрать")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_AVA", "Письма связанные с Войной Альянсов")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_HIRELING", "Письма от Ремесленных Наемников")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_STORE", "Письма из Гильд.Магазина")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_COD", "COD Письма\n(требующие оплату при получении)")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_RETURNED", "Возвращенные письма")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_SIMPLE", "Простые письма")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_COD_RECEIPT", "Пришедшая оплата за отправленные вами COD письма")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_HIRELING_SMITH", "Письма от Наемника-Кузнеца")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_HIRELING_CLOTH", "Письма от Наемника-Портного")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_HIRELING_ENCHANT", "Письма от Наемника-Зачарователя")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_HIRELING_PROVISION", "Письма от Наемника-Снабженца")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_HIRELING_WOOD", "Письма от Наемника-Столяра")
-- Filter Bar Label
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_ALL", "ВСЕ")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_AVA", "Война Альянсов")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_HIRELING", "Наемники")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_STORE", "Гильд.Магазин")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_COD", "COD")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_RETURNED", "Возвращенные")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_SIMPLE", "Простые")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_COD_RECEIPT", "Оплата за COD")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_SMITH", "Кузнец")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_CLOTH", "Портной")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_ENCHANT", "Зачарователь")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_PROVISION", "Снабженц")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_WOOD", "Столяр")
ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_COMPLEX","Несколько фильтров")
--ZO_CreateStringId("SI_MAILLOOTER_FILTER_LABEL_NOTHING","NONE")
-- Overview
ZO_CreateStringId("SI_MAILLOOTER_OVERVIEW", "Обзор")
ZO_CreateStringId("SI_MAILLOOTER_OVERVIEW_TOTAL", "ВСЕГО Писем")
ZO_CreateStringId("SI_MAILLOOTER_OVERVIEW_ALL", "Собрано:")
ZO_CreateStringId("SI_MAILLOOTER_OVERVIEW_AVA", "AvA:")
ZO_CreateStringId("SI_MAILLOOTER_OVERVIEW_HIRELING", "Наемники:")
ZO_CreateStringId("SI_MAILLOOTER_OVERVIEW_STORE", "Магазин:")
ZO_CreateStringId("SI_MAILLOOTER_OVERVIEW_COD", "COD:")
ZO_CreateStringId("SI_MAILLOOTER_OVERVIEW_RETURNED", "Возвращенные:")
ZO_CreateStringId("SI_MAILLOOTER_OVERVIEW_SIMPLE", "Простые:")
ZO_CreateStringId("SI_MAILLOOTER_OVERVIEW_COD_RTN", "Оплата за COD:")
ZO_CreateStringId("SI_MAILLOOTER_OVERVIEW_AUTO_RTN", "Авто-возврат:")
ZO_CreateStringId("SI_MAILLOOTER_OVERVIEW_COD_PAID", "Выплачено за COD:")
-- Alerts
ZO_CreateStringId("SI_MAILLOOTER_NOTHING_TO_LOOT", "Не найдено писем для сбора")
ZO_CreateStringId("SI_MAILLOOTER_TIMEOUT", "Превышено время ожидания письма")
-- Settings
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AWO", "Настройки общиe нa aккaунт")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AWO_DESC",
"Все параметры на этой странице сохраняются как общие на аккаунт и будут применяться для всех Ваших персонажей. Только фильтры сбора на закладке Сборцик Почты (не на этой странице) сохраняются отдельно для каждого персонажа.")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_GO", "Основные настройки")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_RES_IS", "Зарезервировать (4) места в инвентаре")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_RES_IS_TT", "Зарезервировать места в инвентаре необходимые для деконструкции предметов на ремесленном станке.")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_RES_CUS", "Настроить кол-во зарезервированных мест")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_COD_OPTIONS", "Настройки COD")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_COD_ENABLE", "Оплачивать и собирать COD письма")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_COD_LIMITS", "Лимиты для COD писем")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_COD_L_DESC",
"У Сборщика Почты есть два ограничения для COD писем:\n - максимальная стоимость одного письма\n - максимальная стоимость всех писем.\nЗначение |cFF0000НОЛЬ|r отключает ограничение.")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_COD_MAX_PRICE","Макс.стоимость COD письма")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_COD_MAX_COMB_PRICE","Макс.стоимость всех COD писем")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_SIMPLE", "Простые письма")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_SIM_DESC",
"Настройки сбора писем от игроков, содержащих предметы или деньги. Письмо определяется как простое основываясь на его теме и тексте сообщения.")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_SIM_ENABLE", "Включить сбор простых писем")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_SIM_DELETE", "Удалять простое письмо после сбора")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_SIM_SUB_T", "Условия для темы письма")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_SIM_SUB_DESC",
"Считать письмо простым, если кол-во слов в теме меньше либо равно N. Письма, содержащие в теме слова из списка авто-возврата, указанные ниже, простыми не считаются.")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_SIM_SUB_COUNT", "Кол-во слов в теме")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_SIM_BODY_T", "Условия для текста письма")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_SIM_BODY_DESC",
"Считать письмо простым, если кол-во слов в тексте письма меньше либо равно N.")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_SIM_BODY_COUNT","Кол-во слов в тексте письма")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AR_TITLE","Авто-возврат отправителю")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AR_DECT", "Определение писем для Авто-Возврата")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AR_DECT_DESC",
"Можно задать до 6 разных слов или фраз. Если какое(ие) нидудь из них присутствуют в теме письма MailLooter будет считать, что такое письмо надо автоматически вернуть отправителю. Во время сравнения с заголовком письма: Заглавные и прописные буквы не различаются, пунктуация игнорируется и лишние пробелы также игнорируются. Оставьте поле 'Тема N' пустым чтобы отключить его. Аддон будет либо игнорировать, либо автоматически возвращать соответствующие письма.")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AR_EXAMPLES","Примеры:")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AR_EX1_T","1. Использовать другой аддон для Авто-Возврата")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AR_EX1_DESC",
"Убедитесь, что 'Разрешить Авто-Возврат писем' ОТКЛЮЧЕНО. Заполните 6 полей 'Тема N' словами, по которым другой аддон определяет Авто-Возвращаемые письма. MailLooter проигнорирует эти письма, чтобы не мешать работе другого аддона.")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AR_EX2_T","2. Использовать этот аддон для Авто-Возврата")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AR_EX2_DESC",
"Убедитесь, что 'Разрешить Авто-Возврат писем' ВКЛЮЧЕНО. Заполните 6 полей 'Тема N' словами, по которым вы хотите определять Авто-Возвращаемые письма. MailLooter автоматически вернет отправителю эти письма во время выполнения сбора почты.")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AR_EX3_T","3. Не выполнять Авто-Возврат писем")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AR_EX3_DESC",
"Убедитесь, что 'Разрешить Авто-Возврат писем' ОТКЛЮЧЕНО. Оставьте 6 полей 'Тема N' пустыми. MailLooter не будет автоматически возвращать какие-либо письма, также никакие письма не будут считаться подлежащими авто-возврату.")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AR_SUBJECT","Тема <<1>>:")
ZO_CreateStringId("SI_MAILLOOTER_SETTINGS_AR_ENABLE","Разрешить Авто-Возврат писем")
-- Loot Fragment
ZO_CreateStringId("SI_MAILLOOTER_LOOT_HEADER_TYPE", "Тип")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_HEADER_NAME", "Название")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_HEADER_VALUE", "Цена")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_MT_UNKNOWN", "Письма неизвесного типа")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_MT_AVA", "AvA письма")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_MT_HIRELING", "Письма от Наемников")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_MT_STORE", "Письма из Гильд.Магазина")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_MT_COD", "COD письма")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_MT_RETURNED", "Возвращенные письма")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_MT_SIMPLE", "Письма игроков")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_MT_COD_RECEIPT", "Оплаченные COD письма")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_MN_MONEY", "Деньги")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_MN_COD_PAYMENT", "COD Payment")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_MN_RETURNED", "Возврат денег")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_MN_SIMPLE", "Простое письмо")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_EXTRA_FROM", "От: ")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_EXTRA_RETURNED_FROM","|cFF0000Возврат|r от: ")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_EXTRA_EXPIRED", "|cFF0000Просрочено|r")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_EXTRA_CANCELED", "|cFF0000Отменено|r")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_FOOTER_LOOTED", "Собрано")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_FOOTER_INV_SPACE","Место в инвентаре: ")
ZO_CreateStringId("SI_MAILLOOTER_LOOT_FOOTER_INV_RES4", "(%d зарезервировано)")
-- END OF FILE --
|
ITEM.name = "Bear Claw"
ITEM.model ="models/lostsignalproject/items/parts/chimera_claw.mdl"
ITEM.description = "An large claw belonging to a bear."
ITEM.longdesc = "The claw of a bear. Very durable, probably mostly used more for digging than mauling, as the bears incredible strength lets it crush bones with ease."
ITEM.width = 1
ITEM.height = 1
ITEM.price = 9200
ITEM.pricepertier = 1000
ITEM.baseweight = 0.950
ITEM.varweight = 0.150
|
---@class Integer : java.lang.Integer
---@field public MIN_VALUE int
---@field public MAX_VALUE int
---@field public TYPE Class|Unknown
---@field digits char[]
---@field DigitTens byte[]
---@field DigitOnes byte[]
---@field sizeTable int[]
---@field private value int
---@field public SIZE int
---@field public BYTES int
---@field private serialVersionUID long
Integer = {}
---@private
---@param arg0 int
---@param arg1 int
---@return String
function Integer:toUnsignedString0(arg0, arg1) end
---@public
---@param arg0 int
---@param arg1 int
---@return int
function Integer:rotateLeft(arg0, arg1) end
---@private
---@param arg0 int
---@param arg1 int
---@return String
function Integer:toStringUTF16(arg0, arg1) end
---@public
---@param arg0 int
---@param arg1 int
---@return int
function Integer:compareUnsigned(arg0, arg1) end
---@public
---@return int
---@overload fun(arg0:int)
function Integer:hashCode() end
---@public
---@param arg0 int
---@return int
function Integer:hashCode(arg0) end
---@public
---@param arg0 String
---@return int
---@overload fun(arg0:String, arg1:int)
---@overload fun(arg0:CharSequence, arg1:int, arg2:int, arg3:int)
function Integer:parseInt(arg0) end
---@public
---@param arg0 String
---@param arg1 int
---@return int
function Integer:parseInt(arg0, arg1) end
---@public
---@param arg0 CharSequence
---@param arg1 int
---@param arg2 int
---@param arg3 int
---@return int
function Integer:parseInt(arg0, arg1, arg2, arg3) end
---@public
---@param arg0 String
---@return Integer
---@overload fun(arg0:String, arg1:Integer)
---@overload fun(arg0:String, arg1:int)
function Integer:getInteger(arg0) end
---@public
---@param arg0 String
---@param arg1 Integer
---@return Integer
function Integer:getInteger(arg0, arg1) end
---@public
---@param arg0 String
---@param arg1 int
---@return Integer
function Integer:getInteger(arg0, arg1) end
---@public
---@return byte
function Integer:byteValue() end
---@public
---@param arg0 int
---@return String
function Integer:toBinaryString(arg0) end
---@public
---@param arg0 int
---@return String
function Integer:toHexString(arg0) end
---@public
---@param arg0 int
---@return int
function Integer:lowestOneBit(arg0) end
---@private
---@param arg0 int
---@param arg1 int
---@param arg2 byte[]
---@param arg3 int
---@return void
function Integer:formatUnsignedIntUTF16(arg0, arg1, arg2, arg3) end
---@public
---@param arg0 int
---@return int
function Integer:numberOfTrailingZeros(arg0) end
---@private
---@param arg0 int
---@param arg1 int
---@param arg2 byte[]
---@param arg3 int
---@return void
function Integer:formatUnsignedInt(arg0, arg1, arg2, arg3) end
---@public
---@param arg0 int
---@return String
function Integer:toOctalString(arg0) end
---@public
---@param arg0 int
---@return Integer
---@overload fun(arg0:String)
---@overload fun(arg0:String, arg1:int)
function Integer:valueOf(arg0) end
---@public
---@param arg0 String
---@return Integer
function Integer:valueOf(arg0) end
---@public
---@param arg0 String
---@param arg1 int
---@return Integer
function Integer:valueOf(arg0, arg1) end
---@public
---@return float
function Integer:floatValue() end
---@public
---@return double
function Integer:doubleValue() end
---@public
---@return String
---@overload fun(arg0:int)
---@overload fun(arg0:int, arg1:int)
function Integer:toString() end
---@public
---@param arg0 int
---@return String
function Integer:toString(arg0) end
---@public
---@param arg0 int
---@param arg1 int
---@return String
function Integer:toString(arg0, arg1) end
---@public
---@param arg0 int
---@param arg1 int
---@return int
function Integer:sum(arg0, arg1) end
---@public
---@param arg0 int
---@return int
function Integer:numberOfLeadingZeros(arg0) end
---@public
---@param arg0 int
---@return int
function Integer:highestOneBit(arg0) end
---@public
---@param arg0 MethodHandles.Lookup
---@return Integer
function Integer:resolveConstantDesc(arg0) end
---@public
---@param arg0 int
---@param arg1 int
---@return int
function Integer:compare(arg0, arg1) end
---@public
---@param arg0 int
---@return String
---@overload fun(arg0:int, arg1:int)
function Integer:toUnsignedString(arg0) end
---@public
---@param arg0 int
---@param arg1 int
---@return String
function Integer:toUnsignedString(arg0, arg1) end
---@param arg0 int
---@param arg1 int
---@param arg2 byte[]
---@return int
function Integer:getChars(arg0, arg1, arg2) end
---@public
---@param arg0 int
---@return long
function Integer:toUnsignedLong(arg0) end
---@param arg0 int
---@return int
function Integer:stringSize(arg0) end
---@public
---@param arg0 Object
---@return boolean
function Integer:equals(arg0) end
---@public
---@return short
function Integer:shortValue() end
---@public
---@param arg0 int
---@param arg1 int
---@return int
function Integer:rotateRight(arg0, arg1) end
---@public
---@param arg0 Integer
---@return int
function Integer:compareTo(arg0) end
---@public
---@param arg0 int
---@param arg1 int
---@return int
function Integer:divideUnsigned(arg0, arg1) end
---@public
---@param arg0 int
---@return int
function Integer:signum(arg0) end
---@public
---@return long
function Integer:longValue() end
---@public
---@return int
function Integer:intValue() end
---@public
---@param arg0 int
---@return int
function Integer:reverse(arg0) end
---@public
---@return Optional|Unknown
function Integer:describeConstable() end
---@public
---@param arg0 String
---@return int
---@overload fun(arg0:String, arg1:int)
---@overload fun(arg0:CharSequence, arg1:int, arg2:int, arg3:int)
function Integer:parseUnsignedInt(arg0) end
---@public
---@param arg0 String
---@param arg1 int
---@return int
function Integer:parseUnsignedInt(arg0, arg1) end
---@public
---@param arg0 CharSequence
---@param arg1 int
---@param arg2 int
---@param arg3 int
---@return int
function Integer:parseUnsignedInt(arg0, arg1, arg2, arg3) end
---@public
---@param arg0 int
---@return int
function Integer:reverseBytes(arg0) end
---@public
---@param arg0 String
---@return Integer
function Integer:decode(arg0) end
---@public
---@param arg0 int
---@param arg1 int
---@return int
function Integer:max(arg0, arg1) end
---@public
---@param arg0 int
---@param arg1 int
---@return int
function Integer:min(arg0, arg1) end
---@public
---@param arg0 int
---@param arg1 int
---@return int
function Integer:remainderUnsigned(arg0, arg1) end
---@public
---@param arg0 int
---@return int
function Integer:bitCount(arg0) end
|
local common_local = common
if not (type(common) == 'table' and common.class and common.instance) then
assert(common_class ~= false, 'No class commons specification available.')
require('HC.class')
common_local = common
end
local Track = {}
local tracks = {}
--location is centre
function Track:init(game, object, _, map)
if object.shape == "polyline" then
self.polyline = object.polyline
end
tracks[object.name] = self
end
function Track:debugDraw(cx, cy)
-- Object.draw(self, cx, cy)
--if debugDrawCollisionShapes then
love.graphics.line(
cx + self.polyline[1].x, cy + self.polyline[1].y,
cx + self.polyline[2].x, cy + self.polyline[2].y
)
--end
end
function Track:update(game, dt)
end
local function debugDrawAll(cx, cy)
for trackName, track in pairs(tracks) do
track:debugDraw(cx, cy)
end
end
local function getTrack(trackName)
return tracks[trackName]
end
local function newTrack(...)
return common_local.instance(Track, ...)
end
Track = common_local.class('Track', Track)
return {
Track = Track,
newTrack = newTrack,
debugDrawAll = debugDrawAll,
getTrack = getTrack
}
|
local utils = require("refactoring.code_generation.utils")
local function go_class_function(opts)
return string.format(
[[
func %s %s(%s) {
%s
}
]],
opts.className,
opts.name,
table.concat(opts.args, ", "),
utils.stringify_code(opts.body)
)
end
local function go_function(opts)
return string.format(
[[
func %s(%s) {
%s
}
]],
opts.name,
table.concat(opts.args, ", "),
utils.stringify_code(opts.body)
)
end
local function go_call_class_func(opts)
return string.format(
"%s.%s(%s)",
opts.class_type,
opts.name,
table.concat(opts.args, ", ")
)
end
local function constant(opts)
return string.format("%s := %s\n", opts.name, opts.value)
end
local go = {
print_var = function(prefix, var)
return string.format(
'fmt.Println(fmt.Sprintf("%s %%v", %s))',
prefix,
var
)
end,
print = function(statement)
return string.format('fmt.Println("%s")', statement)
end,
constant = function(opts)
return constant(opts)
end,
["return"] = function(code)
return string.format("return %s", utils.stringify_code(code))
end,
["function"] = function(opts)
return go_function(opts)
end,
class_function = function(opts)
return go_class_function(opts)
end,
call_function = function(opts)
return string.format("%s(%s)", opts.name, table.concat(opts.args, ", "))
end,
call_class_function = function(opts)
return go_call_class_func(opts)
end,
terminate = function(code)
return code .. "\n"
end,
}
return go
|
return Def.Quad {
Name="OptionsUnderlineRight",
InitCommand=function(self) self:zoomto(1,3) end
}
|
--------------------------------------------------------------------------------
-- config.lua
--------------------------------------------------------------------------------
local aspectRatio = display.pixelHeight / display.pixelWidth
application = {
content = {
width = aspectRatio > 1.5 and 800 or math.ceil(1200 / aspectRatio),
height = aspectRatio < 1.5 and 1200 or math.ceil(800 * aspectRatio),
scale = "letterBox",
fps = 60,
imageSuffix = {
["@2x"] = 1.3
}
}
}
|
--[[
TheNexusAvenger
Tests the order of the quests.
Split into 2 modules because the test
go above the string limit when syncing
the scripts in with Rojo.
--]]
local NexusUnitTesting = require("NexusUnitTesting")
local QuestsTest = require(script.Parent)
--[[
Tests the dialogs data order.
Some data is missing, so some dialogs may seem odd (like the initial dialogs).
--]]
NexusUnitTesting:RegisterUnitTest(QuestsTest.new("TestDialogOrderPart2"):SetRun(function(self)
--OnlyTwentyCharacters and before are coverd in another module due to the character llimit.
--Set the quests from the initial test.
self:SetQuests({ActiveQuests={["Friendly Solar Crane"] = true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true}})
--Test SolarCrane's dialogs (part 1).
self:AssertDialog("SolarCrane","SolarCrane_FriendlySolarCrane_CHECKUP")
self:SetQuests({ActiveQuests={},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true}})
self:AssertDialog("SolarCrane","SolarCrane_BumpInTheNight_START")
self:SetQuests({ActiveQuests={["Bump In The Night"] = true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true}})
self:AssertDialog("SolarCrane",nil)
self:SetInventory({"Ghost Candle","Ghost Candle","Ghost Candle","Ghost Candle","Ghost Candle","Ghost Candle","Ghost Candle","Ghost Candle","Ghost Candle","Ghost Candle"})
self:AssertDialog("SolarCrane","SolarCrane_BumpInTheNight_DONE")
self:SetQuests({ActiveQuests={},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true}})
self:AssertDialog("SolarCrane","SolarCrane_PawinormalActivity_START")
self:SetQuests({ActiveQuests={["Paw-inormal Activity"]=true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true}})
self:AssertDialog("SolarCrane",nil)
self:SetQuests({ActiveQuests={["Paw-inormal Activity"]=true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true},MonsterKillCounters={["Ghost Wolf"] = 20}})
self:AssertDialog("SolarCrane","SolarCrane_PawinormalActivity_DONE")
self:SetQuests({ActiveQuests={},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true}})
self:AssertDialog("SolarCrane","SolarCrane_SpookyScholar_START")
self:SetQuests({ActiveQuests={["Spooky Scholar"] = true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true}})
self:AssertDialog("SolarCrane","SolarCrane_SpookyScholar_MID")
--Test Raeglyn's dialogs.
self:AssertDialog("Raeglyn","Raeglyn_SpookyScholar_CHECKUP")
self:SetQuests({ActiveQuests={},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true}})
self:AssertDialog("Raeglyn","Raeglyn_SpiritBox_START")
self:SetQuests({ActiveQuests={["Spirit Box"] = true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true}})
self:AssertDialog("Raeglyn",nil)
self:SetInventory({"Spirit Box Piece","Spirit Box Piece","Spirit Box Piece","Spirit Box Piece","Spirit Box Piece","Spirit Box Piece","Spirit Box Piece","Spirit Box Piece","Spirit Box Piece","Spirit Box Piece","Spirit Box Piece","Spirit Box Piece","Spirit Box Piece"})
self:AssertDialog("Raeglyn","Raeglyn_SpiritBox_DONE")
self:SetQuests({ActiveQuests={},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true}})
self:AssertDialog("Raeglyn","Raeglyn_GhostWarrior_START")
self:SetQuests({ActiveQuests={["Ghost Warrior"] = true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true}})
self:AssertDialog("Raeglyn",nil)
self:SetQuests({ActiveQuests={["Ghost Warrior"] = true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true},MonsterKillCounters={["Ghost"] = 20}})
self:AssertDialog("Raeglyn","Raeglyn_GhostWarrior_DONE")
self:SetQuests({ActiveQuests={},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true}})
self:AssertDialog("Raeglyn","Raeglyn_GhostGoGome_START")
self:SetQuests({ActiveQuests={["Ghost Go Home"] = true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true}})
self:AssertDialog("Raeglyn",nil)
--Test SolarCrane's dialogs (part 2).
self:AssertDialog("SolarCrane","SolarCrane_CadaverousPallor_START")
self:SetQuests({ActiveQuests={["Cadaverous Pallor"] = true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true,["Ghost Go Home"] = true}})
self:AssertDialog("SolarCrane",nil)
self:SetInventory({PetCostumeHat="PetGhostCostumeHat",PetCostumeCollar="PetGhostCostumeCollar",PetCostumeBack="PetGhostCostumeCape",PetCostumeAnkle="PetGhostCostumeAnklet"})
self:AssertDialog("SolarCrane","SolarCrane_CadaverousPallor_DONE")
self:SetQuests({ActiveQuests={},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true,["Ghost Go Home"] = true,["Cadaverous Pallor"] = true}})
self:AssertDialog("SolarCrane","SolarCrane_SkeleTroll")
self:SetQuests({ActiveQuests={["Skele-Troll"] = true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true,["Ghost Go Home"] = true,["Cadaverous Pallor"] = true}})
self:AssertDialog("SolarCrane",nil)
--Test Sorcus's dialogs (part 1).
self:AssertDialog("Sorcus","Sorcus_SkeleTroll_CHECKUP")
self:SetQuests({ActiveQuests={},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true,["Ghost Go Home"] = true,["Cadaverous Pallor"] = true,["Skele-Troll"] = true}})
self:AssertDialog("Sorcus","Sorcus_ICU_START")
self:SetQuests({ActiveQuests={["I C U"] = true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true,["Ghost Go Home"] = true,["Cadaverous Pallor"] = true,["Skele-Troll"] = true}})
self:AssertDialog("Sorcus","Sorcus_NOTWORTHY")
--Test Games's dialogs.
self:AssertDialog("Games","Games_ICU_CHECKUP")
self:SetQuests({ActiveQuests={},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true,["Ghost Go Home"] = true,["Cadaverous Pallor"] = true,["Skele-Troll"] = true,["I C U"] = true}})
self:AssertDialog("Games","Games_LensFlare_START")
self:SetQuests({ActiveQuests={["Lens Flare"] = true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true,["Ghost Go Home"] = true,["Cadaverous Pallor"] = true,["Skele-Troll"] = true,["I C U"] = true}})
self:AssertDialog("Games","Games_FALLBACK")
--Test Sorcus's dialogs (part 2).
self:SetInventory({"Lens","Lens","Lens","Lens","Lens","Lens","Lens","Lens","Lens","Lens","Lens","Lens","Lens"})
self:AssertDialog("Sorcus","Sorcus_LensFlare_DONE")
self:SetQuests({ActiveQuests={},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true,["Ghost Go Home"] = true,["Cadaverous Pallor"] = true,["Skele-Troll"] = true,["I C U"] = true,["Lens Flare"] = true}})
self:AssertDialog("Sorcus","Sorcus_ClearThySoul_START")
self:SetQuests({ActiveQuests={["Clear Thy Soul"] = true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true,["Ghost Go Home"] = true,["Cadaverous Pallor"] = true,["Skele-Troll"] = true,["I C U"] = true,["Lens Flare"] = true}})
self:AssertDialog("Sorcus","Sorcus_NOTWORTHY")
self:SetInventory({"Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls","Souls"})
self:AssertDialog("Sorcus","Sorcus_ClearThySoul_DONE")
self:SetQuests({ActiveQuests={},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true,["Ghost Go Home"] = true,["Cadaverous Pallor"] = true,["Skele-Troll"] = true,["I C U"] = true,["Lens Flare"] = true,["Clear Thy Soul"] = true}})
self:AssertDialog("Sorcus","Sorcus_EndOfDays_START")
self:SetQuests({ActiveQuests={["End of Days"] = true},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true,["Ghost Go Home"] = true,["Cadaverous Pallor"] = true,["Skele-Troll"] = true,["I C U"] = true,["Lens Flare"] = true,["Clear Thy Soul"] = true}})
self:AssertDialog("Sorcus","Sorcus_NOTWORTHY")
self:SetInventory({PetCostumeHat="PetGrimReaperCostumeHat",PetCostumeCollar="PetGrimReaperCostumeCollar",PetCostumeBack="PetGrimReaperCostumeCape",PetCostumeAnkle="PetGrimReaperCostumeAnklet"})
self:AssertDialog("Sorcus","Sorcus_EndofDays_DONE")
self:SetQuests({ActiveQuests={},CompletedQuests={["Fortifying Town Hall"] = true,["Frazzled Jim"] = true,["The beginning..."] = true,["Turning on the Lights"]=true,["A quick remedy"]=true,["AmazonianAstronaut"]=true,["A Mysterious Potion"]=true,["Return to ReeseMcBlox"]=true,["Monsterous Candy Corn"]=true,["The Final Ingredient"] = true,["Return To AmazonianAstronaut"] = true,["A Costume For A Witch"] = true,["Find BrightEyes"] = true,["Spider Venom Moat"] = true,["Dance Ray Gun"] = true,["BrightEyes BLOXikin"] = true,["Mech Suit"] = true,["Find Telamom"] = true,["Action Figure Madness"] = true,["The 13 Swords"] = true,["Fried Chicken Fracas"] = true,["Attack Of The SwampWolves"] = true,["Missing CodeWriter"] = true,["Spider Smash"] = true,["Mission Accomplished"] = true,["It's Not Easy Bein' Green"] = true,["Spread The Good 'Mews'"] = true,["Disappearing Paintbrushes"] = true,["Not a Painter"] = true,["Cats Off To You"] = true,["Howling Good Time"] = true,["Silent Isn't the Night"] = true,["Fur'-ocious Fashion"] = true,["Paint The Town Red"] = true,["A Needed Sacrifice"] = true,["Helping Keith"] = true,["Taking Candy From Monsters"] = true,["Demonic Powers"] = true,["Help OstrichSized"] = true,["Wise Wizard"] = true,["Scare-ub Scuffle"] = true,["Squeeky Scarabs"] = true,["Mummy's Home"] = true,["Creeper Crunchies"] = true,["Jackal and Hide"] = true,["Tomb Sweet Tomb"] = true,["All Wrapped Up"] = true,["Grab a Bite"] = true,["Zombie Antidote"] = true,["A Good Distance"] = true,["Preparing For ZA"] = true,["One Zombie Down"] = true,["Real Meaty"] = true,["Not so Cured"] = true,["Experiment Gone Wrong"] = true,["Lost His Marbles"] = true,["Clank Clank"] = true,["Locating Totbl"] = true,["Clearing the Castle"] = true,["BLOXing Time"] = true,["Stitched Together"] = true,["Barely Human"] = true,["Starting a Fire"] = true,["I'm not food!"] = true,["Dog Treats"] = true,["Clean-up Crew"] = true,["Is it safe?"] = true,["Wolfy"] = true,["Friendly Solar Crane"] = true,["Bump In The Night"] = true,["Paw-inormal Activity"]=true,["Spooky Scholar"] = true,["Spirit Box"] = true,["Ghost Warrior"] = true,["Ghost Go Home"] = true,["Cadaverous Pallor"] = true,["Skele-Troll"] = true,["I C U"] = true,["Lens Flare"] = true,["Clear Thy Soul"] = true,["End of Days"] = true}})
end))
return true
|
data:extend(
{
{
type = "recipe",
name = "stack-pack",
energy_required = 1,
enabled = "true",
ingredients =
{
{"wooden-chest", 50},
{"iron-chest", 50},
{"steel-chest", 50},
{"storage-tank", 50},
{"transport-belt", 100},
{"fast-transport-belt", 100},
{"express-transport-belt", 100},
{"underground-belt", 50},
{"fast-underground-belt", 50},
{"express-underground-belt", 50},
{"splitter", 50},
{"fast-splitter", 50},
{"express-splitter", 50},
{"burner-inserter", 50},
{"inserter", 50},
{"long-handed-inserter", 50},
{"fast-inserter", 50},
{"filter-inserter", 50},
{"stack-inserter", 50},
{"stack-filter-inserter", 50},
{"small-electric-pole", 50},
{"medium-electric-pole", 50},
{"big-electric-pole", 50},
{"substation", 50},
{"pipe", 100},
{"pipe-to-ground", 50},
{"pump", 50},
{"rail", 100},
{"train-stop", 10},
{"rail-signal", 50},
{"rail-chain-signal", 50},
{"locomotive", 5},
{"cargo-wagon", 5},
{"fluid-wagon", 5},
{"artillery-wagon", 5},
{"car", 1},
{"tank", 1},
{"logistic-robot", 50},
{"construction-robot", 50},
{"logistic-chest-active-provider", 50},
{"logistic-chest-passive-provider", 50},
{"logistic-chest-storage", 50},
{"logistic-chest-buffer", 50},
{"logistic-chest-requester", 50},
{"roboport", 10},
{"small-lamp", 50},
{"red-wire", 200},
{"green-wire", 200},
{"arithmetic-combinator", 50},
{"decider-combinator", 50},
{"constant-combinator", 50},
{"power-switch", 50},
{"programmable-speaker", 50},
{"stone-brick", 100},
{"concrete", 100},
{"hazard-concrete", 100},
{"refined-concrete", 100},
{"refined-hazard-concrete", 100},
{"landfill", 100},
{"cliff-explosives", 20},
{"repair-pack", 100},
{"boiler", 50},
{"steam-engine", 10},
{"steam-turbine", 10},
{"solar-panel", 50},
{"accumulator", 50},
{"nuclear-reactor", 10},
{"heat-exchanger", 50},
{"heat-pipe", 50},
{"burner-mining-drill", 50},
{"electric-mining-drill", 50},
{"offshore-pump", 20},
{"pumpjack", 20},
{"stone-furnace", 50},
{"steel-furnace", 50},
{"electric-furnace", 50},
{"assembling-machine-50", 50},
{"assembling-machine-2", 50},
{"assembling-machine-3", 50},
{"oil-refinery", 10},
{"chemical-plant", 10},
{"centrifuge", 50},
{"lab", 10},
{"beacon", 10},
{"speed-module", 50},
{"speed-module-2", 50},
{"speed-module-3", 50},
{"effectivity-module", 50},
{"effectivity-module-2", 50},
{"effectivity-module-3", 50},
{"productivity-module", 50},
{"productivity-module-2", 50},
{"productivity-module-3", 50},
{"wood", 100},
{"coal", 50},
{"stone", 50},
{"iron-ore", 50},
{"copper-ore", 50},
{"uranium-ore", 50},
{"raw-fish", 100},
{"iron-plate", 100},
{"copper-plate", 100},
{"solid-fuel", 50},
{"steel-plate", 100},
{"plastic-bar", 100},
{"sulfur", 50},
{"battery", 200},
{"explosives", 50},
{"crude-oil-barrel", 10},
{"heavy-oil-barrel", 10},
{"light-oil-barrel", 10},
{"lubricant-barrel", 10},
{"petroleum-gas-barrel", 10},
{"sulfuric-acid-barrel", 10},
{"water-barrel", 10},
{"copper-cable", 200},
{"iron-stick", 100},
{"iron-gear-wheel", 100},
{"empty-barrel", 10},
{"electronic-circuit", 200},
{"advanced-circuit", 200},
{"processing-unit", 100},
{"engine-unit", 50},
{"electric-engine-unit", 50},
{"flying-robot-frame", 50},
{"satellite", 1},
{"rocket-control-unit", 10},
{"low-density-structure", 10},
{"rocket-fuel", 10},
{"nuclear-fuel", 1},
{"uranium-235", 100},
{"uranium-238", 100},
{"uranium-fuel-cell", 50},
{"used-up-uranium-fuel-cell", 50},
{"automation-science-pack", 200},
{"logistic-science-pack", 200},
{"military-science-pack", 200},
{"chemical-science-pack", 200},
{"production-science-pack", 200},
{"utility-science-pack", 200},
{"space-science-pack", 1000},
{"pistol", 5},
{"submachine-gun", 5},
{"shotgun", 5},
{"combat-shotgun", 5},
{"rocket-launcher", 5},
{"flamethrower", 5},
{"land-mine", 100},
{"firearm-magazine", 200},
{"piercing-rounds-magazine", 200},
{"uranium-rounds-magazine", 200},
{"shotgun-shell", 200},
{"piercing-shotgun-shell", 200},
{"cannon-shell", 200},
{"explosive-cannon-shell", 200},
{"uranium-cannon-shell", 200},
{"explosive-uranium-cannon-shell", 200},
{"artillery-shell", 1},
{"rocket", 200},
{"explosive-rocket", 200},
{"atomic-bomb", 10},
{"flamethrower-ammo", 200},
{"grenade", 100},
{"cluster-grenade", 100},
{"poison-capsule", 100},
{"slowdown-capsule", 100},
{"defender-capsule", 100},
{"distractor-capsule", 100},
{"destroyer-capsule", 100},
{"discharge-defense-remote", 1},
{"artillery-targeting-remote", 1},
{"light-armor", 1},
{"heavy-armor", 1},
{"modular-armor", 1},
{"power-armor", 1},
{"power-armor-mk2", 1},
{"solar-panel-equipment", 20},
{"fusion-reactor-equipment", 20},
{"energy-shield-equipment", 20},
{"energy-shield-mk2-equipment", 20},
{"battery-equipment", 20},
{"battery-mk2-equipment", 20},
{"personal-laser-defense-equipment", 20},
{"discharge-defense-equipment", 20},
{"belt-immunity-equipment", 20},
{"exoskeleton-equipment", 20},
{"personal-roboport-equipment", 20},
{"personal-roboport-mk2-equipment", 20},
{"night-vision-equipment", 20},
{"stone-wall", 100},
{"gate", 50},
{"gun-turret", 50},
{"laser-turret", 50},
{"flamethrower-turret", 50},
{"artillery-turret", 10},
{"radar", 50},
{"rocket-silo", 1}
},
result = "stack-pack"
}
})
|
-- recipes.lua
data:extend {
{
type = "recipe",
name = "ret-electric-locomotive",
result = "ret-electric-locomotive",
ingredients = {
{"steel-plate", 40},
{"electric-engine-unit", 30},
{"advanced-circuit", 20},
{"iron-gear-wheel", 20}
},
energy_required = 8,
enabled = false
},
{
type = "recipe",
name = "ret-power-pole",
result = "ret-pole-placer",
ingredients = {
{"steel-plate", 4},
{"iron-stick", 2},
{"copper-plate", 4}
},
energy_required = 1,
enabled = false
},
{
type = "recipe",
name = "ret-signal-pole",
result = "ret-signal-pole-placer",
ingredients = {
{"ret-pole-placer", 1},
{"rail-signal", 1}
},
energy_required = 1,
enabled = false
},
{
type = "recipe",
name = "ret-chain-pole",
result = "ret-chain-pole-placer",
ingredients = {
{"ret-pole-placer", 1},
{"rail-chain-signal", 1}
},
energy_required = 1,
enabled = false
},
{
type = "recipe",
name = "ret-pole-debugger",
result = "ret-pole-debugger",
ingredients = {
{"electronic-circuit", 3}
},
enabled = false
},
{
type = "recipe",
name = "ret-electric-locomotive-mk2",
result = "ret-electric-locomotive-mk2",
ingredients = {
{"ret-electric-locomotive", 1},
{"electric-engine-unit", 20},
{"advanced-circuit", 20},
{"processing-unit", 5}
},
energy_required = 16,
enabled = false
},
{
type = "recipe",
name = "ret-modular-locomotive",
result = "ret-modular-locomotive",
ingredients = {
{"ret-electric-locomotive-mk2", 1},
{"electric-engine-unit", 20},
{"processing-unit", 20},
{"low-density-structure", 30}
},
energy_required = 32,
enabled = false
},
{
type = "recipe",
name = "ret-train-speed-module",
result = "ret-train-speed-module",
ingredients = {
{"speed-module-3", 3},
{"processing-unit", 2},
{"low-density-structure", 5}
},
energy_required = 30,
enabled = false
},
{
type = "recipe",
name = "ret-train-productivity-module",
result = "ret-train-productivity-module",
ingredients = {
{"productivity-module-3", 3},
{"processing-unit", 2},
{"low-density-structure", 5}
},
energy_required = 30,
enabled = false
},
{
type = "recipe",
name = "ret-train-efficiency-module",
result = "ret-train-efficiency-module",
ingredients = {
{"effectivity-module-3", 3},
{"processing-unit", 2},
{"low-density-structure", 5}
},
energy_required = 30,
enabled = false
},
{
type = "recipe",
name = "ret-train-battery-module",
result = "ret-train-battery-module",
ingredients = {
{"battery", 30},
{"processing-unit", 2},
{"low-density-structure", 5}
},
energy_required = 30,
enabled = false
}
}
|
Tuple = {}
function Tuple.first(...)
return select(1, ...)
end
function Tuple.second(...)
return select(2, ...)
end
function Tuple.third(...)
return select(3, ...)
end
function Tuple.fourth(...)
return select(4, ...)
end
|
-- Require the class.
local logger = require "luchia.core.logger"
-- Set up a shortcut to the logger function.
local log = logger.logger
-- Log something.
log:info("Hello world!")
|
object_ship_awing_tier7 = object_ship_shared_awing_tier7:new {
}
ObjectTemplates:addTemplate(object_ship_awing_tier7, "object/ship/awing_tier7.iff")
|
--[[
Quest Map
by CaptainBlagbird
https://github.com/CaptainBlagbird
--]]
local strings = {
-- General
QUESTMAP_COMPLETED = "Erledigt",
QUESTMAP_UNCOMPLETED = "Unerledigt",
QUESTMAP_HIDDEN = "Manuell ausgeblendet",
QUESTMAP_STARTED = "Begonnen",
QUESTMAP_GUILD = "Guild",
QUESTMAP_DAILY = "Daily",
QUESTMAP_SKILL = "Fertigkeitspunkt",
QUESTMAP_CADWELL = "Cadwells Almanach",
QUESTMAP_DUNGEON = "Dungeon",
QUESTMAP_HOLIDAY = "Holiday",
QUESTMAP_WEEKLY = "Weekly",
QUESTMAP_ZONESTORY = "Zone Story",
QUESTMAP_HIDE = "Quest ausblenden",
QUESTMAP_UNHIDE = "Quest einblenden",
QUESTMAP_MSG_HIDDEN = "Quest ausgeblendet",
QUESTMAP_MSG_UNHIDDEN = "Quest eingeblendet",
QUESTMAP_MSG_HIDDEN_P = "Quests ausgeblendet",
QUESTMAP_MSG_UNHIDDEN_P = "Quests eingeblendet",
QUESTMAP_QUESTS = "Quests",
QUESTMAP_QUEST_SUBFILTER = "Subfilter",
QUESTMAP_SLASH_USAGE = "Bitte verwende ein Argument nach dem Befehl:\n 'hide' - Alle quests in der aktuellen Karte ausblenden\n 'unhide' - Alle quests in der aktuellen Karte einblenden",
QUESTMAP_SLASH_MAPINFO = "Bitte erst die Karte öffnen.",
QUESTMAP_LIB_REQUIRED = "nicht installiert/aktiviert.",
-- Settings menu
QUESTMAP_MENU_ICON_SET = "Icon-Set",
QUESTMAP_MENU_REPEATABLE_ICON_SET = "Repeatable Icon set",
QUESTMAP_MENU_PIN_SIZE = "Grösse der Kartenmarkierung",
QUESTMAP_MENU_PIN_SIZE_TT = "Definiert die Anzeigegrösse der Kartenmarkierungen (Standard: "..QuestMap.settings_default.pinSize..")",
QUESTMAP_MENU_PIN_LVL = "Ebene der Kartenmarkierung",
QUESTMAP_MENU_PIN_LVL_TT = "Definiert auf welcher Ebene die Kartenmarkierungen gezeichnet werden (Standard: "..QuestMap.settings_default.pinLevel..")",
QUESTMAP_MENU_DISP_MSG = "Ein-/ausblende-Nachricht anzeigen",
QUESTMAP_MENU_DISP_MSG_TT = "Ein-/ausschalten der Nachricht die angezeigt wird, wenn Markierungen ein-/ausgeblendet werden",
QUESTMAP_MENU_TOGGLE_HIDDEN_MSG = "Schalter am Pin: Verstecke/Zeige Quests",
QUESTMAP_MENU_TOGGLE_HIDDEN_MSG_TT = "Aktiviert oder deaktiviert einen Schalter an den Karten Quest Pins, welche die Quests anzeigt oder versteckt, wenn du den Pin anklickst.",
QUESTMAP_MENU_TOGGLE_COMPLETED_MSG = "Schalter am Pin: Verstecke/Zeige erledigte Quest Liste",
QUESTMAP_MENU_TOGGLE_COMPLETED_MSG_TT = "Aktiviert oder deaktiviert einen Schalter an den Karten Quest Pins von erledigten Quests, welche eine Quest Liste anzeigt oder versteckt, wenn du den Pin anklickst.",
QUESTMAP_MENU_HIDDEN_QUESTS_T = "Quests manuell ausblenden",
QUESTMAP_MENU_HIDDEN_QUESTS_1 = "Du kannst Questmarkierungen manuell ausblenden indem du sie anklickst. (Um ausgeblendete Questmarkierungen zu sehen, aktiviere den Filter für Kartenmarkierungen rechts neben der Karte.)",
QUESTMAP_MENU_HIDDEN_QUESTS_2 = "Zum gleichzeitigen ein-/ausblenden aller Kartenmarkierung einer bestimmten Karte kannst du den Chat-Befehl '/qm hide' oder '/qm unhide' verwenden.",
QUESTMAP_MENU_HIDDEN_QUESTS_B = "Willst du ALLE ausgeblendeten Markierungen zurücksetzen, dann benütze diese Schaltfläche:",
QUESTMAP_MENU_RESET_HIDDEN = "Ausgebl. zurücksetzen",
QUESTMAP_MENU_RESET_HIDDEN_TT = "Manuell ausgeblendete Markierungen zurücksetzen",
QUESTMAP_MENU_RESET_HIDDEN_W = "Kann nicht rückgängig gemacht werden!",
QUESTMAP_MENU_RESET_NOTE = "Hinweis: Unten auf '"..GetString(SI_OPTIONS_DEFAULTS).."' klicken setzt die manuell ausgeblendeten Questmarkierungen NICHT zurück.",
QUESTMAP_MENU_SHOW_SUFFIX = "Zeige Tooltip Anhang",
QUESTMAP_MENU_SHOW_SUFFIX_TT = "Aktiviert den Quest Pin Tooltip Anhang Infotext, z.B. für Farbenblinde Benutzer oder auch aus persönlicher Vorliebe.\nDer Anhangstext enthält eine Information, ob die Quest unbekannt/angenommen/erledigt ist.",
-- Uncompleted quest pin text
QUESTMAP_UNCOMPLETED_PIN_COLOR = "Unerledigte Quest Pin Farbe",
QUESTMAP_UNCOMPLETED_PIN_COLOR_DESC = "Ändere die unerledigte Quest Pin Farbe",
QUESTMAP_UNCOMPLETED_TOOLTIP_COLOR = "Unerledigte Quest Tooltip Farbe",
QUESTMAP_UNCOMPLETED_TOOLTIP_COLOR_DESC = "Ändere die unerledigte Quest Tooltip Farbe",
-- Completed quest pin text
QUESTMAP_COMPLETED_PIN_COLOR = "Erledigte Quest Pin Farbe",
QUESTMAP_COMPLETED_PIN_COLOR_DESC = "Ändere die erledigte Quest Pin Farbe",
QUESTMAP_COMPLETED_TOOLTIP_COLOR = "Erledigte Quest Tooltip Farbe",
QUESTMAP_COMPLETED_TOOLTIP_COLOR_DESC = "Ändere die erledigte Quest Tooltip Farbe",
-- Hidden quest pin text
QUESTMAP_HIDDEN_PIN_COLOR = "Versteckte Quest Pin Farbe",
QUESTMAP_HIDDEN_PIN_COLOR_DESC = "Ändere die versteckte Quest Pin Farbe",
QUESTMAP_HIDDEN_TOOLTIP_COLOR = "Versteckte Quest Tooltip Farbe",
QUESTMAP_HIDDEN_TOOLTIP_COLOR_DESC = "Ändere die versteckte Quest Tooltip Farbe",
-- Started quest pin text
QUESTMAP_STARTED_PIN_COLOR = "Gestartete Quest Pin Farbe",
QUESTMAP_STARTED_PIN_COLOR_DESC = "Ändere die gestartete Quest Pin Farbe",
QUESTMAP_STARTED_TOOLTIP_COLOR = "Gestartete Quest Tooltip Farbe",
QUESTMAP_STARTED_TOOLTIP_COLOR_DESC = "Ändere die gestartete Quest Tooltip Farbe",
-- Guild quest pin text
QUESTMAP_GUILD_PIN_COLOR = "Guild Quest Pin Color",
QUESTMAP_GUILD_PIN_COLOR_DESC = "Change Guild Quest Pin Color",
QUESTMAP_GUILD_TOOLTIP_COLOR = "Guild Quest Tooltip Color",
QUESTMAP_GUILD_TOOLTIP_COLOR_DESC = "Change Guild Quest Tooltip Color",
-- Daily quest pin text
QUESTMAP_DAILY_PIN_COLOR = "Tägliche Quest Pin Farbe",
QUESTMAP_DAILY_PIN_COLOR_DESC = "Ändere die tägliche Quest Pin Farbe",
QUESTMAP_DAILY_TOOLTIP_COLOR = "Daily Quest Tooltip Farbe",
QUESTMAP_DAILY_TOOLTIP_COLOR_DESC = "Ändere die tägliche Quest Tooltip Farbe",
-- Weekly Duration quest pin text
QUESTMAP_WEEKLY_PIN_COLOR = "Weekly Quest Pin Color",
QUESTMAP_WEEKLY_PIN_COLOR_DESC = "Change Weekly Quest Pin Color",
QUESTMAP_WEEKLY_TOOLTIP_COLOR = "Weekly Quest Tooltip Color",
QUESTMAP_WEEKLY_TOOLTIP_COLOR_DESC = "Change Weekly Quest Tooltip Color",
-- Holiday quest pin text
QUESTMAP_HOLIDAY_PIN_COLOR = "Holiday Quest Pin Color",
QUESTMAP_HOLIDAY_PIN_COLOR_DESC = "Change Holiday Quest Pin Color",
QUESTMAP_HOLIDAY_TOOLTIP_COLOR = "Holiday Quest Tooltip Color",
QUESTMAP_HOLIDAY_TOOLTIP_COLOR_DESC = "Change Holiday Quest Tooltip Color",
-- Cadwell quest pin text
QUESTMAP_CADWELL_PIN_COLOR = "Cadwell Quest Pin Farbe",
QUESTMAP_CADWELL_PIN_COLOR_DESC = "Ändere die Cadwell Quest Pin Farbe",
QUESTMAP_CADWELL_TOOLTIP_COLOR = "Cadwell Quest Tooltip Farbe",
QUESTMAP_CADWELL_TOOLTIP_COLOR_DESC = "Ändere die Cadwell Quest Tooltip Farbe",
-- Skill quest pin text
QUESTMAP_SKILL_PIN_COLOR = "Fertigkeit Quest Pin Farbe",
QUESTMAP_SKILL_PIN_COLOR_DESC = "Ändere die Fertigkeit Quest Pin Farbe",
QUESTMAP_SKILL_TOOLTIP_COLOR = "Fertigkeit Quest Tooltip Farbe",
QUESTMAP_SKILL_TOOLTIP_COLOR_DESC = "Ändere die Fertigkeit Quest Tooltip Farbe",
-- Dungeon quest pin text
QUESTMAP_DUNGEON_PIN_COLOR = "Verlies Quest Pin Farbe",
QUESTMAP_DUNGEON_PIN_COLOR_DESC = "Ändere die Verlies Quest Pin Farbe",
QUESTMAP_DUNGEON_TOOLTIP_COLOR = "Verlies Quest Tooltip Farbe",
QUESTMAP_DUNGEON_TOOLTIP_COLOR_DESC = "Ändere die Verlies Quest Tooltip Farbe",
-- Zonestory quest pin text
QUESTMAP_ZONESTORY_PIN_COLOR = "Zonestory Quest Pin Color",
QUESTMAP_ZONESTORY_PIN_COLOR_DESC = "Change Zonestory Quest Pin Color",
QUESTMAP_ZONESTORY_TOOLTIP_COLOR = "Zonestory Quest Tooltip Color",
QUESTMAP_ZONESTORY_TOOLTIP_COLOR_DESC = "Change Zonestory Quest Tooltip Color",
-- Prologue quest pin text
QUESTMAP_PROLOGUE_PIN_COLOR = "Prologue Quest Pin Color",
QUESTMAP_PROLOGUE_PIN_COLOR_DESC = "Change Prologue Quest Pin Color",
QUESTMAP_PROLOGUE_TOOLTIP_COLOR = "Prologue Quest Tooltip Color",
QUESTMAP_PROLOGUE_TOOLTIP_COLOR_DESC = "Change Prologue Quest Tooltip Color",
-- Pledges quest pin text
QUESTMAP_PLEDGES_PIN_COLOR = "Pledges Quest Pin Color",
QUESTMAP_PLEDGES_PIN_COLOR_DESC = "Change Pledges Quest Pin Color",
QUESTMAP_PLEDGES_TOOLTIP_COLOR = "Pledges Quest Tooltip Color",
QUESTMAP_PLEDGES_TOOLTIP_COLOR_DESC = "Change Pledges Quest Tooltip Color",
}
for key, value in pairs(strings) do
ZO_CreateStringId(key, value)
SafeAddVersion(key, 1)
end
|
local pairs = pairs
local char = string.char
local CHARACTER_VALUES = {
{200, "🫂"}, {50, "💖"}, {10, "✨"}, {5, "🥺"}, {1, ","}
}
local function encodeChar(charValue, nested)
if charValue == 0 then return nested and "" or "❤️" end
for _, v in pairs(CHARACTER_VALUES) do
if charValue >= v[1] then
-- val, currentCase = v[1], v[2]
-- return currentCase .. encodeChar(charValue - val)
return v[2] .. encodeChar(charValue - v[1], true)
end
end
end
local encoding = {}
local decoding = {}
for i = 0, 255 do
local c, r = char(i), encodeChar(i)
encoding[c] = r
decoding[r] = c
end
return {encoding = encoding, decoding = decoding}
|
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
include("bfarm_config.lua")
include("bfarm/bfarm_plants.lua")
function ENT:Initialize()
self:SetModel(FARMER_MARKET_MODEL)
self:SetHullType(HULL_HUMAN)
self:SetHullSizeNormal()
self:SetNPCState(NPC_STATE_SCRIPT)
self:SetBloodColor(BLOOD_COLOR_RED)
self:SetSolid(SOLID_BBOX)
end
function ENT:StartTouch(ent)
end
|
object_tangible_holiday_life_day_rewards_09_lifeday_fireplace_01 = object_tangible_holiday_life_day_rewards_09_shared_lifeday_fireplace_01:new {
}
ObjectTemplates:addTemplate(object_tangible_holiday_life_day_rewards_09_lifeday_fireplace_01, "object/tangible/holiday/life_day/rewards_09/lifeday_fireplace_01.iff")
|
local name = "buffalo"
local version = "0.13.12"
food = {
name = name,
description = "A Go web development eco-system, designed to make your life easier.",
homepage = "https://gobuffalo.io",
version = version,
packages = {
{
os = "darwin",
arch = "amd64",
url = "https://github.com/gobuffalo/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "_" .. version .. "_darwin_amd64.tar.gz",
sha256 = "b76582a12cc1e4e84bd248a189b1efeb73502a9f16f673c9782c427233ac729a",
resources = {
{
path = name .. "-no-sqlite",
installpath = "bin/" .. name,
executable = true
}
}
},
{
os = "linux",
arch = "amd64",
url = "https://github.com/gobuffalo/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "_" .. version .. "_linux_amd64.tar.gz",
sha256 = "dff7c9cfe6c5cc502f86821f9d3ef60595b88ae0f7f8700424760e6841ce55bb",
resources = {
{
path = name .. "-no-sqlite",
installpath = "bin/" .. name,
executable = true
}
}
},
{
os = "windows",
arch = "amd64",
url = "https://github.com/gobuffalo/" .. name .. "/releases/download/v" .. version .. "/" .. name .. "_" .. version .. "_windows_amd64.tar.gz",
sha256 = "8f2b4a05d8b8b983e3541d344b0e3a63004c9674ba6912726e631c2b7ae73fcf",
resources = {
{
path = name .. "-no-sqlite.exe",
installpath = "bin\\" .. name .. ".exe"
}
}
}
}
}
|
require('tranquility').setup('selenized_green')
|
---
--- Created by Administrator.
--- DateTime: 2017/12/14 11:06
---
local print = print
local tconcat = table.concat
local tinsert = table.insert
local type = type
local pairs = pairs
local tostring = tostring
local next = next
local function pr (t, name, indent)
local tableList = {}
function table_r (t, name, indent, full)
local id = not full and name or type(name)~="number" and tostring(name) or '['..name..']'
local tag = indent .. id .. ' = '
local out = {} -- result
if type(t) == "table" then
if tableList[t] ~= nil then
tinsert(out, tag .. '{} -- ' .. tableList[t] .. ' (self reference)')
else
tableList[t]= full and (full .. '.' .. id) or id
if next(t) then -- Table not empty
tinsert(out, tag .. '{')
for key,value in pairs(t) do
tinsert(out,table_r(value,key,indent .. '| ',tableList[t]))
end
tinsert(out,indent .. '}')
else tinsert(out,tag .. '{}') end
end
else
local val = type(t)~="number" and type(t)~="boolean" and '"'..tostring(t)..'"' or tostring(t)
tinsert(out, tag .. val)
end
return tconcat(out, '\n')
end
return table_r(t,name or 'Value',indent or '')
end
local function print_r (t, name)
print(pr(t,name))
end
return print_r
|
-- create nordic_ble protocol dissector and its fields
p_nordic_ble = Proto ("nordic_ble", "Nordic BLE sniffer meta")
local hf_nordic_ble_sync_word = ProtoField.uint16("nordic_ble.sync_word", "Sync word. Always 0xBEEF.", base.HEX)
local hf_nordic_ble_board_id = ProtoField.uint8("nordic_ble.board_id", "board", base.DEC)
local hf_nordic_ble_header_length = ProtoField.uint8("nordic_ble.hlen", "length of header", base.DEC)
local hf_nordic_ble_payload_length = ProtoField.uint8("nordic_ble.plen", "length of payload", base.DEC)
local hf_nordic_ble_protocol_version = ProtoField.uint8("nordic_ble.protover", "protocol version", base.DEC, nil, 0, "Version of nordic_ble protocol, only for Sniffer v1.0.0 and upwards")
local hf_nordic_ble_packet_counter = ProtoField.uint16("nordic_ble.packet_counter", "uart packet counter", base.DEC, nil, 0, "Global packet counter for packets sent on UART.")
local hf_nordic_ble_id = ProtoField.uint8("nordic_ble.id", "packet id", base.DEC, nil, 0, "Packet ID. Specifies the type of the packet")
local hf_nordic_ble_ble_header_length = ProtoField.uint8("nordic_ble.hlen", "length of header", base.DEC)
local hf_nordic_ble_flags = ProtoField.uint8("nordic_ble.flags", "flags", base.DEC, nil, 0, "Flags")
local crc_tfs = {
"OK",
"Incorrect"
}
local hf_nordic_ble_crcok = ProtoField.bool("nordic_ble.crcok", "CRC", base.None, crc_tfs, 0, "Cyclic Redundancy Check state")
local direction_tfs = {
"Master -> Slave",
"Slave -> Master"
}
local hf_nordic_ble_direction = ProtoField.bool("nordic_ble.direction", "direction", base.None, direction_tfs, 0, "Direction")
local encrypted_tfs = {
"Yes",
"No"
}
local hf_nordic_ble_encrypted = ProtoField.bool("nordic_ble.encrypted", "encrypted", base.None, encrypted_tfs, 0, "Was the packet encrypted")
mic_tfs = {
"OK",
"Incorrect"
}
local hf_nordic_ble_micok = ProtoField.bool("nordic_ble.micok", "MIC", base.None, mic_tfs, 0, "Message Integrity Check state")
local hf_nordic_ble_channel = ProtoField.uint8("nordic_ble.channel", "channel", base.DEC, nil, 0, "Channel")
local hf_nordic_ble_rssi = ProtoField.int16("nordic_ble.rssi", "RSSI (dBm)", base.DEC, nil, 0, "Received Signal Strength Indicator")
local hf_nordic_ble_event_counter = ProtoField.uint16("nordic_ble.event_counter", "event counter", base.HEX, nil, 0, "Event Counter")
local hf_nordic_ble_delta_time = ProtoField.uint32("nordic_ble.delta_time", "delta time (us end to start)", base.DEC, nil, 0, "Delta time: us since last reported packet.")
local hf_nordic_ble_delta_time_ss = ProtoField.uint32("nordic_ble.delta_time_ss", "delta time (us start to start)", base.DEC, nil, 0, "Delta time: us since start of last reported packet.")
p_nordic_ble.fields = {
hf_nordic_ble_sync_word,
hf_nordic_ble_board_id,
hf_nordic_ble_header_length,
hf_nordic_ble_payload_length,
hf_nordic_ble_protocol_version,
hf_nordic_ble_packet_counter,
hf_nordic_ble_id,
hf_nordic_ble_ble_header_length,
hf_nordic_ble_flags,
hf_nordic_ble_crcok,
hf_nordic_ble_direction,
hf_nordic_ble_encrypted,
hf_nordic_ble_micok,
hf_nordic_ble_channel,
hf_nordic_ble_rssi,
hf_nordic_ble_event_counter,
hf_nordic_ble_delta_time,
hf_nordic_ble_delta_time_ss
}
-- Size of various UART Packet header fields
local BEEF_LENGTH_BYTES = 2
local HEADER_LEN_LENGTH_BYTES = 1
local PACKET_LEN_LENGTH_BYTES = 1
local PROTOVER_LENGTH_BYTES = 1
local COUNTER_LENGTH_BYTES = 2
local ID_LENGTH_BYTES = 1
local BLE_HEADER_LEN_LENGTH_BYTES = 1
local FLAGS_LENGTH_BYTES = 1
local CHANNEL_LENGTH_BYTES = 1
local RSSI_LENGTH_BYTES = 1
local EVENT_COUNTER_LENGTH_BYTES = 2
local TIMESTAMP_LENGTH_BYTES = 4
local BOARD_ID_INDEX = 0
local BOARD_ID_LENGTH = 1
-- Define the index of the various fields in the UART_PACKET header
local UART_PACKET_HEADER_LEN_INDEX = 0
local UART_PACKET_PACKET_LEN_INDEX = UART_PACKET_HEADER_LEN_INDEX + HEADER_LEN_LENGTH_BYTES
local UART_PACKET_PROTOVER_INDEX = UART_PACKET_PACKET_LEN_INDEX + PACKET_LEN_LENGTH_BYTES
local UART_PACKET_COUNTER_INDEX = UART_PACKET_PROTOVER_INDEX + PROTOVER_LENGTH_BYTES
local UART_PACKET_ID_INDEX = UART_PACKET_COUNTER_INDEX + COUNTER_LENGTH_BYTES
local UART_PACKET_BLE_HEADER_LEN_INDEX = UART_PACKET_ID_INDEX + ID_LENGTH_BYTES
local UART_PACKET_FLAGS_INDEX = UART_PACKET_BLE_HEADER_LEN_INDEX + BLE_HEADER_LEN_LENGTH_BYTES
local UART_PACKET_CHANNEL_INDEX = UART_PACKET_FLAGS_INDEX + FLAGS_LENGTH_BYTES
local UART_PACKET_RSSI_INDEX = UART_PACKET_CHANNEL_INDEX + CHANNEL_LENGTH_BYTES
local UART_PACKET_EVENT_COUNTER_INDEX = UART_PACKET_RSSI_INDEX + RSSI_LENGTH_BYTES
local UART_PACKET_TIMESTAMP_INDEX = UART_PACKET_EVENT_COUNTER_INDEX + EVENT_COUNTER_LENGTH_BYTES
local UART_PACKET_ACCESS_ADDRESS_INDEX = UART_PACKET_TIMESTAMP_INDEX + TIMESTAMP_LENGTH_BYTES
local INDEX_OF_LENGTH_FIELD_IN_BLE_PACKET = 5
local INDEX_OF_LENGTH_FIELD_IN_EVENT_PACKET = UART_PACKET_TIMESTAMP_INDEX + TIMESTAMP_LENGTH_BYTES + INDEX_OF_LENGTH_FIELD_IN_BLE_PACKET
local UART_HEADER_LEN = 6
local BLE_HEADER_LEN = 10
local PROTOVER = 1
local US_PER_BYTE = 8
local NOF_BLE_BYTES_NOT_INCLUDED_IN_BLE_LENGTH = 10 -- Preamble (1) + AA (4) + Header (1) + Length (1) + CRC (3) = 10 Bytes
local BLE_METADATA_TRANFER_TIME_US = US_PER_BYTE * NOF_BLE_BYTES_NOT_INCLUDED_IN_BLE_LENGTH
local UART_HEADER_LENGTH = UART_PACKET_ACCESS_ADDRESS_INDEX
local BLE_MIN_PACKET_LENGTH = NOF_BLE_BYTES_NOT_INCLUDED_IN_BLE_LENGTH
local BLE_MAX_PACKET_LENGTH = 50
local MIN_TOTAL_LENGTH = BLE_HEADER_LEN + BLE_MIN_PACKET_LENGTH
local MAX_TOTAL_LENGTH = UART_HEADER_LENGTH + BLE_MAX_PACKET_LENGTH
local BLE_LENGTH_POS = UART_HEADER_LENGTH + 5
local bad_length = false
local bad_mic = false
local btle_dissector_handle = Dissector.get("btle")
function dissect_board_id_and_strip_it_from_tvb (tvb, pinfo, tree)
tree:add(hf_nordic_ble_board_id, tvb(BOARD_ID_INDEX, BOARD_ID_LENGTH))
return tvb(BOARD_ID_LENGTH):tvb()
end
function dissect_lengths (tvb, pinfo, tree)
local bad_length = false
local hlen = tvb(UART_PACKET_HEADER_LEN_INDEX, 1):uint()
local plen = tvb(UART_PACKET_PACKET_LEN_INDEX, 1):uint()
if (hlen + plen) ~= tvb:len() then
tree:add(hf_nordic_ble_header_length, tvb(UART_PACKET_HEADER_LEN_INDEX, 1))
item = tree:add(hf_nordic_ble_payload_length, tvb(UART_PACKET_PACKET_LEN_INDEX, 1))
item:add_expert_info(PI_MALFORMED, PI_ERROR, "UART packet lengths do not match actual packet length.")
bad_length = true
elseif (hlen + plen) < MIN_TOTAL_LENGTH then
tree:add(hf_nordic_ble_header_length, tvb(UART_PACKET_HEADER_LEN_INDEX, 1))
item = tree:add(hf_nordic_ble_payload_length, tvb(UART_PACKET_HEADER_LEN_INDEX, 1))
item:add_expert_info(PI_MALFORMED, PI_ERROR, "UART packet length is too small (likely corrupted).")
bad_length = true
elseif (hlen + plen) > MAX_TOTAL_LENGTH then
tree:add(hf_nordic_ble_header_length, tvb(UART_PACKET_HEADER_LEN_INDEX, 1))
item = tree:add(hf_nordic_ble_payload_length, tvb(UART_PACKET_PACKET_LEN_INDEX, 1))
item:add_expert_info(PI_MALFORMED, PI_ERROR, "UART packet length is too large (likely corrupted).")
bad_length = true
end
return bad_length
end
function dissect_protover (tvb, tree)
local protover = tvb(UART_PACKET_PROTOVER_INDEX, 1):uint()
end
function dissect_packet_counter (tvb, tree)
tree:add_le(hf_nordic_ble_packet_counter, tvb(UART_PACKET_COUNTER_INDEX, 2))
end
function dissect_id (tvb, tree)
local id = tvb(UART_PACKET_ID_INDEX, 1):uint()
end
function dissect_ble_hlen (tvb, tree)
local ble_hlen = tvb(UART_PACKET_BLE_HEADER_LEN_INDEX, 1):uint()
end
function dissect_flags (tvb, pinfo, tree)
local bad_mic = false
local flags = tvb(UART_PACKET_FLAGS_INDEX, 1):uint()
local crcok = bit.band(flags, 1)
local dir = bit.band(flags, 2)
local encrypted = bit.band(flags, 4)
local micok = bit.band(flags, 8)
if dir > 0 then
pinfo.cols.src = "Master"
pinfo.cols.dst = "Slave"
else
pinfo.cols.src = "Slave"
pinfo.cols.dst = "Master"
end
local flags_item = tree:add(hf_nordic_ble_flags, tvb(UART_PACKET_FLAGS_INDEX, 1))
if encrypted > 0 then -- if encrypted, add MIC status
local item = tree:add_le(hf_nordic_ble_micok, tvb(UART_PACKET_FLAGS_INDEX, 1), micok > 0)
if micok == 0 then
-- MIC is bad
item:add_expert_info(PI_CHECKSUM, PI_WARN, "MIC is bad")
item:add_expert_info(PI_UNDECODED, PI_WARN, "Decryption failed (wrong key?)")
bad_mic = true
end
end
tree:add_le(hf_nordic_ble_encrypted, tvb(UART_PACKET_FLAGS_INDEX, 1), encrypted > 0)
tree:add_le(hf_nordic_ble_direction, tvb(UART_PACKET_FLAGS_INDEX, 1), dir > 0)
local item = tree:add_le(hf_nordic_ble_crcok, tvb(UART_PACKET_FLAGS_INDEX, 1), crcok > 0)
local bad_crc = false
if crcok == 0 then
-- CRC is bad
item:add_expert_info(PI_MALFORMED, PI_ERROR, "CRC is bad")
bad_crc = true
end
return bad_mic
end
function dissect_channel (tvb, tree)
tree:add(hf_nordic_ble_channel, tvb(UART_PACKET_CHANNEL_INDEX, 1))
end
function dissect_rssi (tvb, tree)
local rssi = (-1)*(tvb(UART_PACKET_RSSI_INDEX, 1):uint())
tree:add(hf_nordic_ble_rssi, tvb(UART_PACKET_RSSI_INDEX, 1), rssi)
end
function dissect_event_counter (tvb, tree)
local adv_aa = 0x8e89bed6
local aa = tvb(UART_HEADER_LENGTH, 4):le_uint()
if aa ~= adv_aa then
tree:add_le(hf_nordic_ble_event_counter, tvb(UART_PACKET_EVENT_COUNTER_INDEX, 2))
end
end
local previous_ble_packet_length = 0
function dissect_ble_delta_time (tvb, tree)
-- end - start
local delta_time = tvb(UART_PACKET_TIMESTAMP_INDEX, 4):le_uint()
tree:add_le(hf_nordic_ble_delta_time, tvb(UART_PACKET_TIMESTAMP_INDEX, 4))
-- start - start
local delta_time_ss = BLE_METADATA_TRANFER_TIME_US + (US_PER_BYTE * previous_ble_packet_length) + delta_time
tree:add(hf_nordic_ble_delta_time_ss, tvb(UART_PACKET_TIMESTAMP_INDEX, 4), delta_time_ss)
previous_ble_packet_length = tvb(UART_PACKET_PACKET_LEN_INDEX, 1):uint()
end
function dissect_header_1_0_0 (tvb, pinfo, tree)
local nordic_ble_tree = tree:add(p_nordic_ble, tvb(0))
tvb = dissect_board_id_and_strip_it_from_tvb(tvb, pinfo, nordic_ble_tree)
bad_length = dissect_lengths(tvb, pinfo, nordic_ble_tree)
dissect_protover(tvb, nordic_ble_tree)
dissect_packet_counter(tvb, nordic_ble_tree)
dissect_id(tvb, nordic_ble_tree)
dissect_ble_hlen(tvb, nordic_ble_tree)
bad_mic = dissect_flags(tvb, pinfo, nordic_ble_tree)
dissect_channel(tvb, nordic_ble_tree)
dissect_rssi(tvb, nordic_ble_tree)
dissect_event_counter(tvb, nordic_ble_tree)
dissect_ble_delta_time(tvb, nordic_ble_tree)
end
-- nordic_ble dissector function
function p_nordic_ble.dissector (tvb, pinfo, tree)
local payload_tvb = nil
bad_length = false
bad_mic = false;
dissect_header_1_0_0(tvb, pinfo, tree)
-- have to take BOARD_ID into account, as the stripped version is local to dissect_1_0_0
payload_tvb = tvb:range(UART_HEADER_LENGTH + BOARD_ID_LENGTH,
tvb:len() - UART_HEADER_LENGTH - BOARD_ID_LENGTH):tvb()
if bad_length == false then
btle_dissector_handle:call(payload_tvb, pinfo, tree)
end
if bad_mic == true then
pinfo.cinfo = "Encrypted packet decrypted incorrectly (bad MIC)"
end
return UART_HEADER_LENGTH + BOARD_ID_LENGTH
end
-- Initialization routine
function p_nordic_ble.init()
end
local wtap_encap_table = DissectorTable.get("wtap_encap")
wtap_encap_table:add(wtap.USER10, p_nordic_ble) -- corresponds to pcap network type value 157, user type 10
|
businessAccounts = {}
currentAccounts = {}
savingsAccounts = {}
gangAccounts = {}
bankCards = {}
function tprint (t, s)
for k, v in pairs(t) do
local kfmt = '["' .. tostring(k) ..'"]'
if type(k) ~= 'string' then
kfmt = '[' .. k .. ']'
end
local vfmt = '"'.. tostring(v) ..'"'
if type(v) == 'table' then
tprint(v, (s or '')..kfmt)
else
if type(v) ~= 'string' then
vfmt = tostring(v)
end
print(type(t)..(s or '')..kfmt..' = '..vfmt)
end
end
end
function generatebusinessAccount(acc, sc, bid)
local self = {}
self.accountNumber = tonumber(acc)
self.sortCode = tonumber(sc)
self.bid = bid
local processed = false
local bankAccount = exports.ghmattimysql:executeSync('SELECT * FROM bank_accounts WHERE account_number=@acc AND sort_code=@sc AND businessid=@bid', {['@acc'] = self.accountNumber, ['@sc'] = self.sortCode, ['@bid'] = self.bid})
if bankAccount[1] ~= nil then
self.account_id = bankAccount[1].record_id
self.balance = bankAccount[1].amount
self.account_type = "business"
self.account_for = bankAccount[1].business
if self.account_for == "realestate" then
self.account_name = "Real Estates"
elseif self.account_for == "police" then
self.account_name = "Police"
elseif self.account_for == "ems" then
self.account_name = "EMS Medical Services"
elseif self.account_for == "taxi" then
self.account_name = "Taxi Services"
elseif self.account_for == "cardealer" then
self.account_name = "Car Dealership"
end
end
processed = true
repeat Wait(0) until processed == true
self.saveAccount = function()
exports['ghmattimysql']:execute("UPDATE `bank_accounts` SET `amount` = @amount WHERE `record_id` = @rid", {['@amount'] = self.balance, ['@rid'] = self.account_id}, function() end)
end
local rTable = {}
rTable.getName = function()
return self.account_name
end
rTable.getType = function()
return self.account_type
end
rTable.getEntity = function()
return self.account_for
end
rTable.getBalance = function()
return self.balance
end
rTable.getBankDetails = function()
return { ['number'] = self.accountNumber, ['sortcode'] = self.sortCode }
end
rTable.getBankStatement = function(limit)
local resLimit = limit or 30
local processed = false
local statement
local res = exports.ghmattimysql:executeSync("SELECT * FROM `bank_statements` WHERE `account` = 'business' AND `business` = @bus AND `account_number` = @acc AND `sort_code` = @sc AND `businessid` = @bid LIMIT @limit", {['@bus'] = bankAccount[1].business, ['@acc'] = self.accountNumber, ['@sc'] = self.sortCode, ['@limit'] = resLimit, ['@bid'] = self.bid})
statement = res
processed = true
repeat Wait(0) until processed == true
return statement
end
-- Update Functions
rTable.deductBalance = function(amt, text)
if type(amt) == "number" and text then
if amt <= self.balance then
self.balance = self.balance - amt
exports['ghmattimysql']:execute("INSERT INTO `bank_statements` (`account`, `business`, `businessid`, `account_number`, `sort_code`, `withdraw`, `balance`, `type`) VALUES('business', @bus, @bid, @ac, @sc, @amt, @bal, @text)", {
['@bus'] = self.account_for,
['@ac'] = self.accountNumber,
['@sc'] = self.sortCode,
['@amt'] = amt,
['@bal'] = self.balance,
['@text'] = text,
['@bid'] = self.bid
}, function(inserted)
if inserted > 0 then
self.saveAccount()
end
end)
end
end
end
rTable.addBalance = function(amt, text)
if type(amt) == "number" and text then
self.balance = self.balance + amt
exports['ghmattimysql']:execute("INSERT INTO `bank_statements` (`account`, `business`, `businessid`, `account_number`, `sort_code`, `deposited`, `balance`, `type`) VALUES('business', @bus, @bid, @ac, @sc, @amt, @bal, @text)", {
['@bus'] = self.account_for,
['@ac'] = self.accountNumber,
['@sc'] = self.sortCode,
['@amt'] = amt,
['@bal'] = self.balance,
['@text'] = text,
['@bid'] = self.bid
}, function(inserted)
if inserted > 0 then
self.saveAccount()
end
end)
end
end
rTable.payWages = function()
-- Need to look into making at some point.Bala
end
return rTable
end
-------------------------------------
--- CREATE A NEW business ACCOUNT ---
-------------------------------------
function createbusinessAccount(accttype, bid, startingBalance)
if businessAccounts[accttype] == nil then
businessAccounts[accttype] = {}
end
local newBalance = tonumber(startingBalance) or 1000000
local checkExists = exports.ghmattimysql:executeSync("SELECT * FROM `bank_accounts` WHERE `business` = @accttype AND `businessid` = @bid", {['@accttype'] = accttype, ['@bid'] = bid})
if checkExists[1] == nil then
local sc = math.random(100000,999999)
local acct = math.random(10000000,99999999)
exports['ghmattimysql']:execute("INSERT INTO `bank_accounts` (`business`, `businessid`, `account_number`, `sort_code`, `amount`, `account_type`) VALUES (@business, @bid, @acnum, @sc, @bal, 'business')", {['@business'] = accttype, ['@acnum'] = acct, ['@sc'] = sc, ['@bal'] = newBalance, ['@bid'] = bid }, function(success)
if success > 0 then
businessAccounts[accttype][tonumber(bid)] = generatebusinessAccount(acct, sc, bid)
end
end)
end
end
exports('createbusinessAccount', function(accttype, bid, startingbalance)
createbusinessAccount(accttype, bid, startingbalance)
end)
|
local _, ns = ...
ns.Config = {
chatfont = AbuGlobal.GlobalConfig.Fonts.Normal,
disableFade = true,
chatOutline = false,
classColoredChat = true,
enableHyperlinkTooltip = true,
enableBorderColoring = true,
tab = {
fontSize = 12,
fontOutline = true,
normalColor = {1, 1, 1},
flashColor = {1, 0, 1},
selectedColor = {0, 0.75, 1},
},
}
|
local Menu = require('menu')
local scanWifi = require('scan-wifi')
local scanBluetooth = require('scan-bluetooth')
local life = require('life')
local drawHeader = function()
disp:drawLine(23,0,105,0)
disp:drawRBox(21,2,87,11,1)
disp:drawLine(23,14,105,14)
disp:setDrawColor(2)
disp:drawStr(23,11, 'CactusCon 2017')
disp:setDrawColor(1)
end
local mainMenu = Menu:new({
renderCallback=drawHeader,
offsetX=14,
offsetY=26,
items={
{name='WiFi Scan', callback=scanWifi},
{name='BlueTooth Scan', callback=scanBluetooth},
{name='Game of Life',callback=life}
}})
return function()
mainMenu:setup()
end
|
local FrameTime = FrameTime
local util_QuickTrace = util.QuickTrace
local VectorRand = VectorRand
local Vector = Vector
local Angle = Angle
local physenv_GetGravity = physenv.GetGravity
local BUILDER, PART = pac.PartTemplate("base_drawable")
PART.ClassName = "jiggle"
PART.Group = 'model'
PART.Icon = 'icon16/chart_line.png'
BUILDER:StartStorableVars()
BUILDER:GetSet("Strain", 0.5, {editor_onchange = function(self, num)
self.sens = 0.25
num = tonumber(num)
return math.Clamp(num, 0, 1) * 0.999
end})
BUILDER:GetSet("Speed", 1)
BUILDER:GetSet("ConstantVelocity", Vector(0, 0, 0))
BUILDER:GetSet("LocalVelocity", true)
BUILDER:GetSet("JiggleAngle", true)
BUILDER:GetSet("JigglePosition", true)
BUILDER:GetSet("ConstrainPitch", false)
BUILDER:GetSet("ConstrainYaw", false)
BUILDER:GetSet("ConstrainRoll", false)
BUILDER:GetSet("ConstrainX", false)
BUILDER:GetSet("ConstrainY", false)
BUILDER:GetSet("ConstrainZ", false)
BUILDER:GetSet("ConstrainSphere", 0)
BUILDER:GetSet("StopRadius", 0)
BUILDER:GetSet("Ground", false)
BUILDER:GetSet("ResetOnHide", false)
BUILDER:EndStorableVars()
local math_AngleDifference = math.AngleDifference
function PART:Reset()
local pos, ang = self:GetDrawPosition()
self.pos = pos or Vector()
self.vel = Vector()
self.ang = ang or Angle()
self.angvel = Angle()
end
function PART:Initialize()
self.pos = Vector()
self.vel = Vector()
self.ang = Angle()
self.angvel = Angle()
self.first_time_reset = true
end
function PART:OnShow()
if self.ResetOnHide then
self:Reset()
end
end
local inf, ninf = math.huge, -math.huge
local function check_num(num)
if num ~= inf and num ~= ninf and (num >= 0 or num <= 0) then
return num
end
return 0
end
function PART:OnDraw()
local pos, ang = self:GetDrawPosition()
if self.first_time_reset then
self:Reset()
self.first_time_reset = false
end
local delta = FrameTime()
local speed = self.Speed * delta
self.vel = self.vel or VectorRand()
self.pos = self.pos or pos * 1
if self.StopRadius ~= 0 and self.pos and self.pos:Distance(pos) < self.StopRadius then
self.vel = Vector()
return
end
if self.JigglePosition then
if not self.ConstrainX then
self.vel.x = self.vel.x + (pos.x - self.pos.x)
if self.LocalVelocity then
self.vel = self.vel + ang:Right() * self.ConstantVelocity.x
else
self.vel.x = self.vel.x + self.ConstantVelocity.x
end
self.pos.x = self.pos.x + (self.vel.x * (self.Invert and -speed or speed))
self.vel.x = self.vel.x * self.Strain
else
self.pos.x = pos.x
end
if not self.ConstrainY then
self.vel.y = self.vel.y + (pos.y - self.pos.y)
if self.LocalVelocity then
self.vel = self.vel + ang:Forward() * self.ConstantVelocity.y
else
self.vel.y = self.vel.y + self.ConstantVelocity.y
end
self.pos.y = self.pos.y + (self.vel.y * speed)
self.vel.y = self.vel.y * self.Strain
else
self.pos.y = pos.y
end
if not self.ConstrainZ then
self.vel.z = self.vel.z + (pos.z - self.pos.z)
if self.LocalVelocity then
self.vel = self.vel + ang:Up() * self.ConstantVelocity.z
else
self.vel.z = self.vel.z + self.ConstantVelocity.z
end
self.pos.z = self.pos.z + (self.vel.z * speed)
self.vel.z = self.vel.z * self.Strain
else
self.pos.z = pos.z
end
if self.Ground then
self.pos.z = util_QuickTrace(pos, physenv_GetGravity() * 100).HitPos.z
end
else
self.pos = pos
end
if self.ConstrainSphere > 0 then
local len = math.min(self.pos:Distance(pos), self.ConstrainSphere)
self.pos = pos + (self.pos - pos):GetNormalized() * len
end
if self.JiggleAngle then
self.angvel = self.angvel or ang * 1
self.ang = self.ang or ang * 1
if not self.ConstrainPitch then
self.angvel.p = self.angvel.p + math_AngleDifference(ang.p, self.ang.p)
self.ang.p = math_AngleDifference(self.ang.p, self.angvel.p * -speed)
self.angvel.p = self.angvel.p * self.Strain
end
if not self.ConstrainYaw then
self.angvel.y = self.angvel.y + math_AngleDifference(ang.y, self.ang.y)
self.ang.y = math_AngleDifference(self.ang.y, self.angvel.y * -speed)
self.angvel.y = self.angvel.y * self.Strain
end
if not self.ConstrainRoll then
self.angvel.r = self.angvel.r + math_AngleDifference(ang.r, self.ang.r)
self.ang.r = math_AngleDifference(self.ang.r, self.angvel.r * -speed)
self.angvel.r = self.angvel.r * self.Strain
end
else
self.ang = ang
end
end
function PART:OnThink()
self.pos.x = check_num(self.pos.x)
self.pos.y = check_num(self.pos.y)
self.pos.z = check_num(self.pos.z)
self.ang.p = check_num(self.ang.p)
self.ang.y = check_num(self.ang.y)
self.ang.r = check_num(self.ang.r)
end
BUILDER:Register()
|
local Modules = game:GetService("Players").LocalPlayer.PlayerGui.AvatarEditorInGame.Modules
local Roact = require(Modules.Packages.Roact)
local RoactRodux = require(Modules.Packages.RoactRodux)
local RoactServices = require(Modules.Common.RoactServices)
local AppPageLocalizationKeys = require(Modules.NotLApp.AppPageLocalizationKeys)
local DeviceOrientationMode = require(Modules.NotLApp.DeviceOrientationMode)
local AppPage = require(Modules.NotLApp.AppPage)
local AvatarExperienceView = require(Modules.AvatarExperience.Common.Components.AvatarExperienceView)
local AvatarExperienceUtils = require(Modules.AvatarExperience.Common.Utils)
local AvatarNavigationItemsView = require(Modules.AvatarExperience.AvatarEditor.Components.AvatarNavigationItemsView)
local TopBar = require(Modules.InGameEditor.Components.TopBar)
local AppPageLocalizationKeys = require(Modules.NotLApp.AppPageLocalizationKeys)
local IsCatalogEnabled = require(Modules.Config.IsCatalogEnabled)
local Toggle3DFullView = require(Modules.AvatarExperience.AvatarEditor.Thunks.Toggle3DFullView)
local ToggleUIFullView = require(Modules.AvatarExperience.AvatarEditor.Thunks.ToggleUIFullView)
local FFlagEnableAvatarExperienceLandingPage = false
local AvatarEditorPage = Roact.PureComponent:extend("AvatarEditorPage")
function AvatarEditorPage:init()
self.changeView = function()
local isFullView = self.props.isFullView
local toggle3DFullView = self.props.toggle3DFullView
local toggleUIFullView = self.props.toggleUIFullView
if isFullView then
toggle3DFullView()
else
toggleUIFullView()
end
end
end
function AvatarEditorPage:renderTopBar()
return Roact.createElement(TopBar, {
showNotifications = false,
showCatalogButton = IsCatalogEnabled,
showBackButton = false,
showSearch = false,
textKey = AppPageLocalizationKeys[AppPage.AvatarEditor],
transparentBackground = FFlagEnableAvatarExperienceLandingPage,
hideSiteMessageBanner = isPortrait,
})
end
function AvatarEditorPage:render()
local isUIFullView = self.props.isUIFullView
local isFullView = self.props.isFullView
local page = self.props.page
return Roact.createElement(AvatarExperienceView, {
bottomBarEnabled = not FFlagEnableAvatarExperienceLandingPage,
changeViewFunction = self.changeView,
isFullView = page == AppPage.AvatarExperienceLandingPage or isFullView,
isUIFullView = isUIFullView,
topBar = self:renderTopBar(),
}, {
AvatarNavigationItemsView = Roact.createElement(AvatarNavigationItemsView),
})
end
return RoactRodux.UNSTABLE_connect2(
function(state, props)
local deviceOrientation = state.DeviceOrientation
local isPortrait = deviceOrientation == DeviceOrientationMode.Portrait
return {
page = AvatarExperienceUtils.getCurrentPage(state),
isUIFullView = state.AvatarExperience.AvatarEditor.UIFullView,
isFullView = state.AvatarExperience.AvatarEditor.FullView,
isPortrait = isPortrait,
}
end,
function(dispatch)
return {
toggleUIFullView = function()
dispatch(ToggleUIFullView())
end,
toggle3DFullView = function()
dispatch(Toggle3DFullView())
end,
}
end
)(AvatarEditorPage)
|
giant_carrion_spat = Creature:new {
objectName = "@mob/creature_names:giant_carrion_spat",
socialGroup = "carrion_spat",
faction = "",
level = 18,
chanceHit = 0.32,
damageMin = 160,
damageMax = 170,
baseXp = 1426,
baseHAM = 3500,
baseHAMmax = 4300,
armor = 0,
resists = {-1,125,5,145,145,-1,-1,-1,-1},
meatType = "meat_avian",
meatAmount = 350,
hideType = "",
hideAmount = 0,
boneType = "bone_avian",
boneAmount = 295,
milk = 0,
tamingChance = 0.25,
ferocity = 0,
pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY,
creatureBitmask = PACK + KILLER + STALKER,
optionsBitmask = AIENABLED,
diet = CARNIVORE,
scale = 2.0,
templates = {"object/mobile/giant_carrion_spat.iff"},
hues = { 24, 25, 26, 27, 28, 29, 30, 31 },
controlDeviceTemplate = "object/intangible/pet/carrion_spat_hue.iff",
lootGroups = {},
weapons = {},
conversationTemplate = "",
attacks = {
{"dizzyattack",""},
{"stunattack",""}
}
}
CreatureTemplates:addCreatureTemplate(giant_carrion_spat, "giant_carrion_spat")
|
forgive = {
cast = async(function(player, target)
-- TODO: fix legend mark to say "Has been forgiven x times, recently by xxxx"
local karma = target.karma
player.npcGraphic = 0
player.npcColor = 0
player.dialogType = 0
player.lastClick = player.ID
local magicCost = 0
if (not player:canCast(0, 1, 0)) then
return
end
if (player.magic < magicCost) then
player:sendMinitext("You do not have enough mana.")
return
end
if not player:karmaCheck("dragon") then
player:dialogSeq(
{
t,
"Your soul is too impure restore karma. Improve your karma first."
},
0
)
return
end
local penalty = math.random() + 1
local choice
if karma <= -3 then
-- snake karma
if target.ID == player.ID then
player:dialogSeq({t, "You cannot restore your own karma."}, 0)
return
end
choice = player:menuSeq(
"Are you sure you want to restore " .. player.name .. "'s karma? It will cost between 1 and 2 points of karma to do so.",
{"Yes, I want to restore them.", "No, nevermind."},
{}
)
if choice == 1 then
--Yes
player:removeKarma(penalty)
target:sendAnimation(49)
target.karma = 0
target:sendMinitext("Your karma has been restored.")
target.registry["been_forgiven"] = target.registry[
"been_forgiven"
] + 1
if not target:hasLegend("been_forgiven") then
target:addLegend(
"Has been forgiven",
"been_forgiven",
12,
128
)
else
target:removeLegendbyName("been_forgiven")
target:addLegend(
"Has been forgiven " .. target.registry["been_forgiven"] .. " times",
"been_forgiven",
12,
128
)
end
player:dialogSeq(
{t, target.name .. "'s karma has been restored to Cat."},
0
)
elseif choice == 2 then
-- No
player:dialogSeq({t, "Very well."}, 0)
end
else
player:dialogSeq(
{t, target.name .. "'s karma is not Snake level."},
0
)
end
end),
requirements = function(player)
local level = 60
local items = {Item("acorn").id, Item("light_fox_fur").id, 0}
local itemAmounts = {70, 20, 50}
local description = "4 way invisible blockade that surrounds the caster. Any mobs in one of those 4 spaces will be paralyzed until the barrier wears off."
return level, items, itemAmounts, description
end
}
|
local core = require "core"
local style = require "core.style"
local command = require "core.command"
local keymap = require "core.keymap"
local DocView = require "core.docview"
local bracket_maps = {
-- [ ] ( ) { }
{ [91] = 93, [40] = 41, [123] = 125, step = 1 },
-- ] [ ) ( } {
{ [93] = 91, [41] = 40, [125] = 123, step = -1 },
}
local function get_matching_bracket(doc, line, col, line_limit, open_byte, close_byte, step)
local end_line = line + line_limit * step
local depth = 0
while line ~= end_line do
local byte = doc.lines[line]:byte(col)
if byte == open_byte then
depth = depth + 1
elseif byte == close_byte then
depth = depth - 1
if depth == 0 then return line, col end
end
local prev_line, prev_col = line, col
line, col = doc:position_offset(line, col, step)
if line == prev_line and col == prev_col then
break
end
end
end
local state = {}
local function update_state(line_limit)
line_limit = line_limit or math.huge
-- reset if we don't have a document (eg. DocView isn't focused)
local doc = core.active_view.doc
if not doc then
state = {}
return
end
-- early exit if nothing has changed since the last call
local line, col = doc:get_selection()
local change_id = doc:get_change_id()
if state.doc == doc and state.line == line and state.col == col
and state.change_id == change_id and state.limit == line_limit then
return
end
-- find matching bracket if we're on a bracket
local line2, col2
for _, map in ipairs(bracket_maps) do
for i = 0, -1, -1 do
local line, col = doc:position_offset(line, col, i)
local open = doc.lines[line]:byte(col)
local close = map[open]
if close then
line2, col2 = get_matching_bracket(doc, line, col, line_limit, open, close, map.step)
goto found
end
end
end
::found::
-- update
state = {
change_id = change_id,
doc = doc,
line = line,
col = col,
line2 = line2,
col2 = col2,
limit = line_limit,
}
end
local update = DocView.update
function DocView:update(...)
update(self, ...)
update_state(100)
end
local draw_line_text = DocView.draw_line_text
function DocView:draw_line_text(idx, x, y)
draw_line_text(self, idx, x, y)
if self.doc == state.doc and idx == state.line2 then
local color = style.bracketmatch_color or style.syntax["function"]
local x1 = x + self:get_col_x_offset(idx, state.col2)
local x2 = x + self:get_col_x_offset(idx, state.col2 + 1)
local h = math.ceil(1 * SCALE)
renderer.draw_rect(x1, y + self:get_line_height() - h, x2 - x1, h, color)
end
end
command.add("core.docview", {
["bracket-match:move-to-matching"] = function()
update_state()
if state.line2 then
core.active_view.doc:set_selection(state.line2, state.col2)
end
end,
})
keymap.add { ["ctrl+m"] = "bracket-match:move-to-matching" }
|
local ui_path = (...):match('(.-)[^%.]+$') .. '.'
local Object = require(ui_path .. 'classic.classic')
local Base = require(ui_path .. 'Base')
local Draggable = require(ui_path .. 'Draggable')
local Resizable = require(ui_path .. 'Resizable')
local Checkbox = Object:extend('Checkbox')
Checkbox:implement(Base)
Checkbox:implement(Draggable)
Checkbox:implement(Resizable)
function Checkbox:new(ui, x, y, w, h, settings)
local settings = settings or {}
self.ui = ui
self.id = self.ui.addToElementsList(self)
self.type = 'Checkbox'
self:basePreNew(x, y, w, h, settings)
self.draggable = settings.draggable or false
if self.draggable then self:draggableNew(settings) end
self.resizable = settings.resizable or false
if self.resizable then self:resizableNew(settings) end
self.checked_enter = false
self.checked_exit = false
self.checked = false
self.checked_str = 'false'
self.previous_checked = false
self:basePostNew()
end
function Checkbox:update(dt, parent)
self:basePreUpdate(dt, parent)
if self.resizable then self:resizableUpdate(dt, parent) end
if self.draggable then self:draggableUpdate(dt, parent) end
self.checked_enter, self.checked_exit = false, false
-- Check for checked_enter
if self.checked and self.previous_checked then
if self.checked_str == 'false' then
self.checked_enter = true
self.checked_str = 'true'
elseif self.checked_str == 'true' then
self.checked_exit = true
self.checked_str = 'false'
end
else
self.checked_enter = false
self.checked_exit = false
end
-- Change state
if self.released and (self.hot or self.selected) then
self.checked = not self.checked
end
self.previous_checked = self.checked
self:basePostUpdate(dt)
end
function Checkbox:draw()
self:basePreDraw()
self:basePostDraw()
end
function Checkbox:toggle()
self.checked = not self.checked
end
return Checkbox
|
function scoreOracle(sentenceStream, maxSummarySize, refCounts, stopwordlist, thresh, use_cuda)
local SKIP = 1
local SELECT = 2
local buffer = Tensor(1, maxSummarySize):zero()
local streamSize = sentenceStream:size(1)
local actions = ByteTensor(streamSize, 2):fill(0)
local summaryBuffer = LongTensor(streamSize + 1, maxSummarySize):zero()
local oracleF1 = 0
for i=1, streamSize do
actions[i][SELECT] = 1
predsummary = buildFullSummary(actions:narrow(1, 1, i),
sentenceStream:narrow(1, 1, i), use_cuda)
summaryCounts = buildTokenCounts(predsummary, stopwordlist)
recall, prec, f1 = rougeScores(summaryCounts, refCounts)
if (f1 - oracleF1) >= thresh then
oracleF1 = f1
else
actions[i][SELECT] = 0
actions[i][SKIP] = 1
end
end
return oracleF1
end
function buildModel(model, vocabSize, embeddingSize, metric, adapt, use_cuda)
-- Small experiments seem to show that the Tanh activations performed better\
-- than the ReLU for the bow model
if model == 'bow' then
print(string.format("Running bag-of-words model to learn %s", metric))
sentenceLookup = nn.Sequential()
:add(nn.LookupTableMaskZero(vocabSize, embeddingSize))
:add(nn.Sum(2, 3, true)) -- Not averaging blows up model so keep this true
:add(nn.Tanh())
else
print(string.format("Running LSTM model to learn %s", metric))
sentenceLookup = nn.Sequential()
:add(nn.LookupTableMaskZero(vocabSize, embeddingSize))
:add(nn.SplitTable(2))
:add(nn.Sequencer(nn.LSTM(embeddingSize, embeddingSize)))
:add(nn.SelectTable(-1)) -- selects last state of the LSTM
:add(nn.Linear(embeddingSize, embeddingSize))
:add(nn.ReLU())
end
local queryLookup = sentenceLookup:clone("weight", "gradWeight")
local summaryLookup = sentenceLookup:clone("weight", "gradWeight")
local pmodule = nn.ParallelTable()
:add(sentenceLookup)
:add(queryLookup)
:add(summaryLookup)
if model == 'bow' then
nnmodel = nn.Sequential()
:add(pmodule)
:add(nn.JoinTable(2))
:add(nn.Tanh())
:add(nn.Linear(embeddingSize * 3, 2))
else
nnmodel = nn.Sequential()
:add(pmodule)
:add(nn.JoinTable(2))
:add(nn.ReLU())
:add(nn.Linear(embeddingSize * 3, 2))
end
if adapt then
print("Adaptive regularization")
local logmod = nn.Sequential()
:add(nn.Linear(embeddingSize * 3, 1))
:add(nn.LogSigmoid())
:add(nn.SoftMax())
local regmod = nn.Sequential()
:add(nn.Linear(embeddingSize * 3, 2))
local fullmod = nn.ConcatTable()
:add(regmod)
:add(logmod)
local final = nn.Sequential()
:add(pmodule)
:add(nn.JoinTable(2))
:add(fullmod)
nnmodel = final
end
if use_cuda then
return nnmodel:cuda()
end
return nnmodel
end
function buildSummary(actions, sentences, buffer, use_cuda)
buffer:zero()
if use_cuda then
actions = actions:double()
sentences = sentences:double()
buffer = buffer:double()
end
local bufferSize = buffer:size(2)
local actionsSize = actions:size(1)
local sentencesSize = sentences:size(2)
local mask1 = torch.eq(actions:select(2,2), 1):view(actionsSize, 1):expand(actionsSize, sentencesSize)
local allTokens = sentences:maskedSelect(mask1)
local mask2 = torch.gt(allTokens,0)
local allTokens = allTokens:maskedSelect(mask2)
if allTokens:dim() > 0 then
local copySize = math.min(bufferSize, allTokens:size(1))
buffer[1]:narrow(1, bufferSize - copySize + 1, copySize):copy(
allTokens:narrow(1, allTokens:size(1) - copySize + 1, copySize)
)
end
if use_cuda then
buffer = buffer:cuda()
end
return buffer
end
function buildFullSummary(actions, sentences, use_cuda)
local SKIP = 1
local SELECT = 2
if use_cuda then
actions = actions
sentences = sentences
selected = ByteTensor(actions:narrow(2, SELECT, 1)):double()
else
selected = ByteTensor(actions:narrow(2, SELECT, 1))
end
local indxs = selected:eq(1):resize(selected:size(1)):nonzero()
if #torch.totable(indxs) == 0 then
return torch.zeros(1, 2)
end
local indxs = indxs:resize(indxs:size(1))
predictedsummary = sentences:index(1, indxs)
if use_cuda then
predictedsummary = predictedsummary:cuda()
end
return predictedsummary
end
function buildTokenCounts(summary, stopwordlist)
local counts = {}
for i=1, summary:size(1) do
for j=1, summary:size(2) do
if summary[i][j] > 0 then
local token = summary[i][j]
if counts[token] == nil then
counts[token] = 1
else
counts[token] = counts[token] + 1
end
end
end
end
-- Removing stop words here
if stopwordlist ~= nil then
for k, stopword in pairs(stopwordlist) do
if counts[stopword] ~= nil then
counts[stopword] = nil
end
end
end
return counts
end
function rougeScores(genSummary, refSummary)
local genTotal = 0
local refTotal = 0
local intersection = 0
-- Inserting the missing keys
for k, genCount in pairs(genSummary) do
if refSummary[k] == nil then
refSummary[k] = 0
end
end
for k, refCount in pairs(refSummary) do
local genCount = genSummary[k]
if genCount == nil then
genCount = 0
end
intersection = intersection + math.min(refCount, genCount)
refTotal = refTotal + refCount
genTotal = genTotal + genCount
end
recall = intersection / refTotal
prec = intersection / genTotal
if refTotal == 0 then
recall = 0
end
if genTotal == 0 then
prec = 0
end
-- tmp = {intersection, refTotal, genTotal}
if recall > 0 or prec > 0 then
f1 = (2 * recall * prec) / (recall + prec)
else
f1 = 0
end
return recall, prec, f1
end
function sampleMemory(newinput, memory_hist, memsize, use_cuda)
local sentMemory = torch.cat(newinput[1][1]:double(), memory_hist[1][1]:double(), 1)
local queryMemory = torch.cat(newinput[1][2]:double(), memory_hist[1][2]:double(), 1)
local sumryMemory = torch.cat(newinput[1][3]:double(), memory_hist[1][3]:double(), 1)
local rewardMemory = torch.cat(newinput[2]:double(), memory_hist[2]:double(), 1)
local actionMemory = torch.cat(newinput[3], memory_hist[3], 1)
--- specifying rows to index
if sentMemory:size(1) >= memsize then
-- My hack for sampling based on non-zero rewards
local p = torch.abs(rewardMemory) / torch.abs(rewardMemory):sum()
-- local p = torch.ones(memsize) / memsize
local indxs = torch.multinomial(p, memsize, true)
local sentMemory = sentMemory:index(1, indxs)
local queryMemory = queryMemory:index(1, indxs)
local sumryMemory = sumryMemory:index(1, indxs)
local rewardMemory = rewardMemory:index(1, indxs)
local actionMemory = actionMemory:index(1, indxs)
end
--- Selecting random samples of the data
local inputMemory = {sentMemory, queryMemory, sumryMemory}
if use_cuda then
inputMemory = {sentMemory:cuda(), queryMemory:cuda(), sumryMemory:cuda()}
end
return {inputMemory, rewardMemory, actionMemory}
end
function stackMemory(newinput, memory_hist, memsize, adapt, use_cuda)
local sentMemory = torch.cat(newinput[1][1]:double(), memory_hist[1][1]:double(), 1)
local queryMemory = torch.cat(newinput[1][2]:double(), memory_hist[1][2]:double(), 1)
local sumryMemory = torch.cat(newinput[1][3]:double(), memory_hist[1][3]:double(), 1)
local rewardMemory = torch.cat(newinput[2]:double(), memory_hist[2]:double(), 1)
if use_cuda then
actionMemory = torch.cat(newinput[3]:double(), memory_hist[3]:double(), 1)
else
actionMemory = torch.cat(newinput[3], memory_hist[3], 1)
end
--- specifying rows to index
if sentMemory:size(1) <= memsize then
nend = sentMemory:size(1)
nstart = 1
else
nstart = math.max(memsize - sentMemory:size(1), 1)
nend = memsize + nstart
end
--- Selecting n last data points
sentMemory = sentMemory[{{nstart, nend}}]
queryMemory = queryMemory[{{nstart, nend}}]
sumryMemory = sumryMemory[{{nstart, nend}}]
rewardMemory = rewardMemory[{{nstart, nend}}]
actionMemory = actionMemory[{{nstart, nend}}]
local inputMemory = {sentMemory, queryMemory, sumryMemory}
if use_cuda then
inputMemory = {sentMemory:cuda(), queryMemory:cuda(), sumryMemory:cuda()}
rewardMemory = rewardMemory:cuda()
actionMemory = torch.ByteTensor(#actionMemory):copy(actionMemory):cuda()
end
return {inputMemory, rewardMemory, actionMemory}
end
-- input = {sentenceStream, queryBatch, summaryBatch}
-- memory = {input, reward, actions, regValues}
-- memory = { {sentenceStream, queryBatch, summaryBatch},
-- reward, actions, regValues}
function stackMemory(newinput, memory_hist, memsize, adapt, use_cuda)
local sentMemory = torch.cat(newinput[1][1]:double(), memory_hist[1][1]:double(), 1)
local queryMemory = torch.cat(newinput[1][2]:double(), memory_hist[1][2]:double(), 1)
local sumryMemory = torch.cat(newinput[1][3]:double(), memory_hist[1][3]:double(), 1)
local rewardMemory = torch.cat(newinput[2]:double(), memory_hist[2]:double(), 1)
if adapt then
regMemory = torch.cat(newinput[4]:double(), memory_hist[4]:double(), 1)
end
if use_cuda then
actionMemory = torch.cat(newinput[3]:double(), memory_hist[3]:double(), 1)
else
actionMemory = torch.cat(newinput[3], memory_hist[3], 1)
end
--- specifying rows to index
if sentMemory:size(1) <= memsize then
nend = sentMemory:size(1)
nstart = 1
else
nstart = math.max(memsize - sentMemory:size(1), 1)
nend = memsize + nstart
end
--- Selecting n last data points
sentMemory = sentMemory[{{nstart, nend}}]
queryMemory = queryMemory[{{nstart, nend}}]
sumryMemory = sumryMemory[{{nstart, nend}}]
rewardMemory = rewardMemory[{{nstart, nend}}]
actionMemory = actionMemory[{{nstart, nend}}]
if use_cuda then
inputMemory = {sentMemory:cuda(), queryMemory:cuda(), sumryMemory:cuda()}
rewardMemory = rewardMemory:cuda()
actionMemory = torch.ByteTensor(#actionMemory):copy(actionMemory):cuda()
end
inputMemory = {sentMemory, queryMemory, sumryMemory}
if adapt then
regMemory = regMemory[{{nstart, nend}}]
return {inputMemory, rewardMemory, actionMemory, regMemory}
end
return {inputMemory, rewardMemory, actionMemory}
end
function backPropSampled(input_memory, params, gradParams, optimParams, model, criterion, batch_size, n_backprops, use_cuda)
local n = input_memory[1][1]:size(1)
local p = torch.ones(n) / n
local loss = 0
for i=1, n_backprops do
local indxs = torch.multinomial(p, batch_size, true)
local xinput = {
input_memory[1][1]:index(1, indxs),
input_memory[1][2]:index(1, indxs),
input_memory[1][3]:index(1, indxs)
}
local reward = input_memory[2]:index(1, indxs)
local actions_in = input_memory[3]:index(1, indxs)
local function feval(params)
gradParams:zero()
local maskLayer = nn.MaskedSelect()
if use_cuda then
maskLayer = maskLayer:cuda()
end
local predQ = model:forward(xinput)
local predQOnActions = maskLayer:forward({predQ, actions_in})
local lossf = criterion:forward(predQOnActions, reward)
local gradOutput = criterion:backward(predQOnActions, reward)
local gradMaskLayer = maskLayer:backward({predQ, actions_in}, gradOutput)
model:backward(xinput, gradMaskLayer[1])
return lossf, gradParams
end
--- optim.rmsprop returns \theta, f(\theta):= loss function
_, lossv = optim.rmsprop(feval, params, optimParams)
loss = loss + lossv[1]
end
return loss/n_backprops
end
function backProp(input_memory, params, gradParams, optimParams, model, criterion, batch_size, memsize, adapt, use_cuda)
maskLayer = nn.MaskedSelect()
-- input and Actions
local inputs = {input_memory[1], input_memory[3]}
local rewards = input_memory[2]
local dataloader = dl.TensorLoader(inputs, rewards)
for k, xin, reward in dataloader:sampleiter(batch_size, memsize) do
xinput = xin[1]
actions_in = xin[2]
if use_cuda then
maskLayer = nn.MaskedSelect():cuda()
actions_in = torch.CudaByteTensor(#actions_in):copy(actions_in)
end
local function feval(params)
gradParams:zero()
if adapt then
local predTotal = model:forward(xinput)
local predQ = predTotal[1]
local predReg = predTotal[2]
local predQOnActions = maskLayer:forward({predQ, actions_in})
local ones = torch.ones(predQ:size(1)):resize(predQ:size(1))
lossf = criterion:forward({predQOnActions, predReg}, {reward, ones})
local gradOutput = criterion:backward({predQOnActions, predReg}, {reward, ones})
local gradMaskLayer = maskLayer:backward({predQ, actions_in}, gradOutput[1])
model:backward(xinput, {gradMaskLayer[1], gradOutput[2]})
else
local predQ = model:forward(xinput)
local predQOnActions = maskLayer:forward({predQ, actions_in})
lossf = criterion:forward(predQOnActions, reward)
local gradOutput = criterion:backward(predQOnActions, reward)
local gradMaskLayer = maskLayer:backward({predQ, actions_in}, gradOutput)
model:backward(xinput, gradMaskLayer[1])
end
return lossf, gradParams
end
--- optim.rmsprop returns \theta, f(\theta):= loss function
_, lossv = optim.rmsprop(feval, params, optimParams)
end
return lossv[1]
end
function initialize_variables(inputs, n_samples, input_path, K_tokens, maxSummarySize, stopwordlist, thresh, use_cuda)
if n_samples > 0 then
print("Running on a subset of %i observations" % n_samples)
-- Have to add one because I'm removing the first row due to headers
n_samples = n_samples + 1
else
n_samples = nil
end
local vocabSize = 0
local maxseqlen = 0
local maxseqlenq = getMaxQuerylen(inputs)
local vocabSizeq = getVocabSizeQuery(inputs)
-- local maxseqlenq = getMaxseq(inputs)
-- local vocabSizeq = getVocabSize(inputs)
local query_data = {}
for query_id = 1, #inputs do
input_fn = inputs[query_id]['inputs']
nugget_fn = inputs[query_id]['nuggets']
input_file = csvigo.load({path = input_path .. input_fn, mode = "large", verbose = false})
nugget_file = csvigo.load({path = input_path .. nugget_fn, mode = "large", verbose = false})
-- This is just for experimentation
input_file = geti_n(input_file, 2, n_samples)
-- input_file = geti_n(input_file, 2, #input_file)
-- have to drop the header
nugget_file = geti_n(nugget_file, 2, #nugget_file)
vocabSize = math.max(vocabSize, vocabSizeq, getVocabSize(input_file))
maxseqlen = math.max(maxseqlen, maxseqlenq, getMaxseq(input_file))
xtdm = buildTermDocumentTable(input_file, K_tokens)
nuggets = buildTermDocumentTable(nugget_file, nil)
ntdm = {}
for i=1, #nuggets do
ntdm = tableConcat(table.unpack(nuggets), ntdm)
end
-- Initializing the bookkeeping variables and storing them
-- The empty row insertion is a little silly but works
local query = LongTensor{padZeros({inputs[query_id]['query'], {0} }, maxseqlenq)[1]}
local sentenceStream = LongTensor(padZeros(xtdm, K_tokens))
local streamSize = sentenceStream:size(1)
local refSummary = Tensor{ntdm}
local refCounts = buildTokenCounts(refSummary, stopwordlist)
local buffer = Tensor(1, maxSummarySize):zero()
local actions = ByteTensor(streamSize, 2):fill(0)
local actionsOpt = ByteTensor(streamSize, 2):fill(0)
local exploreDraws = Tensor(streamSize)
local summaryBuffer = LongTensor(streamSize + 1, maxSummarySize):zero()
local qValues = Tensor(streamSize, 2):zero()
local rouge = Tensor(streamSize + 1):zero()
local rougeOpt = Tensor(streamSize + 1):zero()
local summary = summaryBuffer:zero():narrow(1,1,1)
local oracleF1 = scoreOracle(sentenceStream, maxSummarySize, refCounts, stopwordlist, thresh, use_cuda)
local regValues = Tensor(streamSize, 1):zero()
query_data[query_id] = {
sentenceStream,
streamSize,
query,
actions,
exploreDraws,
summaryBuffer,
qValues,
rouge,
actionsOpt,
rougeOpt,
refSummary,
refCounts,
buffer,
oracleF1,
regValues
}
end
return vocabSize, query_data
end
function forwardpass(query_data, query_id, model, epsilon, gamma, metric, thresh, stopwordlist, adapt, use_cuda)
local SKIP = 1
local SELECT = 2
-- math.randomseed(420)
-- torch.manualSeed(420)
-- Extact variables
local sentenceStream = query_data[query_id][1]
local streamSize = query_data[query_id][2]
local query = query_data[query_id][3]
local actions = query_data[query_id][4]
local exploreDraws = query_data[query_id][5]
local summaryBuffer = query_data[query_id][6]
local qValues = query_data[query_id][7]
local rouge = query_data[query_id][8]
local actionsOpt = query_data[query_id][9]
local rougeOpt = query_data[query_id][10]
local refSummary = query_data[query_id][11]
local refCounts = query_data[query_id][12]
local buffer = query_data[query_id][13]
local regValues = query_data[query_id][15]
-- Have to set clear the inputs at the beginning of each scoring round
actions:fill(0)
actionsOpt:fill(0)
rouge:fill(0)
rougeOpt:fill(0)
qValues:fill(0)
summaryBuffer:fill(0)
buffer:fill(0)
exploreDraws:fill(0)
exploreDraws:uniform(0, 1)
summary = summaryBuffer:zero():narrow(1,1,1) -- summary starts empty
regValues:fill(0)
for i=1, streamSize do -- Iterating through individual sentences
local sentence = sentenceStream:narrow(1, i, 1)
pred = model:forward({sentence, query, summary})
if adapt then
qValues[i]:copy(pred[1])
regValues[i]:copy(pred[2])
else
qValues[i]:copy(pred)
end
-- epsilon greedy strategy
if exploreDraws[i] <= epsilon then
actions[i][torch.random(SKIP, SELECT)] = 1
else
if qValues[i][SKIP] > qValues[i][SELECT] then
actions[i][SKIP] = 1
else
actions[i][SELECT] = 1
end
end
-- Storing the optimal predictions
if qValues[i][SKIP] > qValues[i][SELECT] then
actionsOpt[i][SKIP] = 1
else
actionsOpt[i][SELECT] = 1
end
summary = buildSummary(
actions:narrow(1, 1, i),
sentenceStream:narrow(1, 1, i),
summaryBuffer:narrow(1, i + 1, 1),
use_cuda
)
summaryOpt = buildSummary(
actionsOpt:narrow(1, 1, i),
sentenceStream:narrow(1, 1, i),
summaryBuffer:narrow(1, i + 1, 1),
use_cuda
)
predsummary = buildFullSummary(actions:narrow(1, 1, i),
sentenceStream:narrow(1, 1, i), use_cuda)
predsummaryOpt = buildFullSummary(actionsOpt:narrow(1, 1, i),
sentenceStream:narrow(1, 1, i), use_cuda)
summaryCounts = buildTokenCounts(predsummary, stopwordlist)
summaryCountsOpt = buildTokenCounts(predsummaryOpt, stopwordlist)
recall, prec, f1 = rougeScores(summaryCounts, refCounts)
rOpt, pOpt, f1Opt = rougeScores(summaryCountsOpt, refCounts)
if metric == "f1" then
rouge[i + 1] = threshold(f1, thresh)
rougeOpt[i] = threshold(f1Opt, thresh)
elseif metric == "recall" then
rouge[i + 1] = threshold(recall, thresh)
rougeOpt[i] = threshold(rOpt, thresh)
elseif metric == "precision" then
rouge[i + 1] = threshold(prec, thresh)
rougeOpt[i] = threshold(pOpt, thresh)
end
end
local max, argmax = torch.max(qValues, 2)
local reward0 = rouge:narrow(1,2, streamSize) - rouge:narrow(1,1, streamSize)
local reward_tm1 = rougeOpt:narrow(1,2, streamSize) - rougeOpt:narrow(1,1, streamSize)
local reward = reward0 + gamma * reward_tm1
local querySize = query:size(2)
local summaryBatch = summaryBuffer:narrow(1, 1, streamSize)
local queryBatch = query:view(1, querySize):expand(streamSize, querySize)
local input = {sentenceStream, queryBatch, summaryBatch}
if use_cuda then
if adapt then
local input = {
sentenceStream:cuda(), queryBatch:cuda(),
summaryBatch:cuda()
}
memory = {input, reward:cuda(), actions:cuda(), regValues:cuda()}
else
local input = {sentenceStream:cuda(), queryBatch:cuda(), summaryBatch:cuda()}
memory = {input, reward:cuda(), actions:cuda()}
end
else
if adapt then
memory = {input, reward, actions, regValues}
else
memory = {input, reward, actions}
end
end
--- Last ones are the total performance
return memory, recall, prec, f1, qValues
end
function train(inputs, query_data, model, nepochs, nnmod, metric, thresh, gamma, epsilon, delta, base_explore_rate, end_baserate, mem_size, batch_size, optimParams, n_backprops, stopwordlist, adapt, use_cuda)
math.randomseed(420)
torch.manualSeed(420)
criterion = nn.MSECriterion()
if adapt then
criterion = nn.ParallelCriterion():add(nn.MSECriterion()):add(nn.BCECriterion())
end
local SKIP = 1
local SELECT = 2
if use_cuda then
criterion = criterion:cuda()
model = model:cuda()
end
query_randomF1 = {}
local params, gradParams = model:getParameters()
local perf = io.open(string.format("Code/Performance/Simulation/%s_%s_perf.txt", nnmod, metric), 'w')
perf:write(string.format("epoch;epsilon;loss;randomF1;oracleF1;rougeF1;rougeRecall;rougePrecision;actual;pred;nselect;nskip;query\n"))
print_mv = torch.floor(nepochs/10)
for epoch=0, nepochs do
if (epoch % print_mv) == 0 then
print("...executing epoch %i" % epoch)
end
for query_id=1, #inputs do
-- Score the queries
memory, rougeRecall, rougePrecision, rougeF1, qValues = forwardpass(
query_data, query_id, model, epsilon, gamma,
metric, thresh, stopwordlist, adapt, use_cuda
)
-- Build the memory
if epoch == 0 then
query_randomF1[query_id] = rougeF1
if query_id == 1 then
fullmemory = memory
end
else
-- fullmemory = sampleMemory(memory, fullmemory, mem_size, use_cuda)
fullmemory = stackMemory(memory, fullmemory, mem_size, adapt, use_cuda)
end
--- Running backprop
loss = backProp(fullmemory, params, gradParams, optimParams, model, criterion, batch_size, mem_size, adapt, use_cuda)
-- loss = backPropSampled(fullmemory, params, gradParams, optimParams, model, criterion, batch_size, n_backprops, use_cuda)
nactions = torch.totable(memory[3]:sum(1))[1]
perf_string = string.format("%i; %.3f; %.6f; %.6f; %.6f; %.6f; %.6f; %.6f; {min=%.3f, max=%.3f}; {min=%.3f, max=%.3f}; %i; %i; %i\n",
epoch, epsilon, loss, query_randomF1[query_id], query_data[query_id][14], -- this is the oracle
rougeF1, rougeRecall, rougePrecision,
memory[2]:min(), memory[2]:max(),
qValues:min(), qValues:max(),
nactions[SELECT], nactions[SKIP],
inputs[query_id]['query_id']
)
perf:write(perf_string)
local avpfile = io.open(string.format("Code/plotdata/%s/%i/%i_epoch.txt", nnmod, query_id, epoch), 'w')
avpfile:write("predSkip;predSelect;actual;Skip;Select;query\n")
for i=1, memory[1][1]:size(1) do
avp_string = string.format("%.6f;%.6f;%6f;%i;%i;%i\n",
qValues[i][SKIP], qValues[i][SELECT], memory[2][i],
memory[3][i][SKIP], memory[3][i][SELECT], query_id)
avpfile:write(avp_string)
end
avpfile:close()
end
if (epsilon - delta) <= base_explore_rate then
epsilon = base_explore_rate
if epoch > end_baserate then
base_explore_rate = 0.
end
else
epsilon = epsilon - delta
end
end
print(string.format("Model complete {Selected = %i; Skipped = %i}; Final Rouge Recall, Precision, F1 = {%.6f;%.6f;%.6f}",
nactions[SELECT], nactions[SKIP], rougeRecall, rougePrecision, rougeF1))
end
function trainCV(inputs, query_data, model, nepochs, nnmod, metric, thresh, gamma, epsilon, delta, base_explore_rate, end_baserate, mem_size, batch_size, optimParams, n_backprops, use_cuda)
math.randomseed(420)
torch.manualSeed(420)
criterion = nn.MSECriterion()
local SKIP = 1
local SELECT = 2
if use_cuda then
criterion = criterion:cuda()
model = model:cuda()
end
ranF1s = {}
local params, gradParams = model:getParameters()
local perf = io.open(string.format("Code/Performance/CV/%s_%s_perf.txt", nnmod, metric), 'w')
perf:write(string.format("epoch;epsilon;loss;randomF1;oracleF1;rougeF1;rougeRecall;rougePrecision;actual;pred;nselect;nskip;query;testQuery;Test\n"))
for test_query=1, #inputs do
for epoch=0, nepochs do
for query_id=1, #inputs do
-- Score the queries
memory, rougeRecall, rougePrecision, rougeF1, qValues = forwardpass(
query_data, query_id, model, epsilon, gamma,
metric, thresh, stopwordlist, use_cuda
)
-- Build the memory
if epoch == 0 then
ranF1s[query_id] = rougeF1
if query_id ~= test_query and fullmemory == nil then
fullmemory = memory
end
else
--- By not storing the memory of the test query we won't back prop on it
if query_id ~= test_query then
fullmemory = stackMemory(memory, fullmemory, mem_size, adapt, use_cuda)
-- fullmemory = sampleMemory(memory, fullmemory, mem_size, use_cuda)
end
end
if query_id ~= test_query then
--- Running backprop
loss = backProp(fullmemory, params, gradParams, optimParams, model, criterion, batch_size, mem_size, use_cuda)
-- loss = backPropSampled(input_memory, params, gradParams, optimParams, model, criterion, batch_size, n_backprops, use_cuda)
else
loss = 0.
end
nactions = torch.totable(memory[3]:sum(1))[1]
perf_string = string.format("%i; %.3f; %.6f; %.6f; %.6f; %.6f; %.6f; %.6f; {min=%.3f, max=%.3f}; {min=%.3f, max=%.3f}; %i; %i; %i; %i; %s\n",
epoch, epsilon, loss, ranF1s[query_id], query_data[query_id][14], -- this is the oracle
rougeF1, rougeRecall, rougePrecision,
memory[2]:min(), memory[2]:max(),
qValues:min(), qValues:max(),
nactions[SELECT], nactions[SKIP],
query_id, test_query, query_id==test_query
)
perf:write(perf_string)
end
if (epsilon - delta) <= base_explore_rate then
epsilon = base_explore_rate
if epoch > end_baserate then
base_explore_rate = 0.
end
else
epsilon = epsilon - delta
end
end
end
print(string.format("Model complete {Selected = %i; Skipped = %i}; Final Rouge Recall, Precision, F1 = {%.6f;%.6f;%.6f}",
nactions[SELECT], nactions[SKIP], rougeRecall, rougePrecision, rougeF1))
end
|
WireToolSetup.setCategory("Input, Output")
WireToolSetup.open("dynamic_button", "Dynamic Button", "gmod_wire_dynamic_button", nil, "Dynamic Buttons")
if CLIENT then
language.Add("tool.wire_dynamic_button.name", "Dynamic Button Tool (Wire)")
language.Add("tool.wire_dynamic_button.desc", "Spawns a dynamic button for use with the wire system.")
TOOL.Information = {
{
name = "left",
text = "Create/Update " .. TOOL.Name
}
}
language.Add("WireDynamicButtonTool_toggle", "Toggle")
language.Add("WireDynamicButtonTool_entityout", "Output Entity")
language.Add("WireDynamicButtonTool_value_on", "Value On:")
language.Add("WireDynamicButtonTool_value_off", "Value Off:")
language.Add("WireDynamicButtonTool_materials_on", "Material On:")
language.Add("WireDynamicButtonTool_materials_off", "Material Off:")
language.Add("WireDynamicButtonTool_colour_on", "Color On:")
language.Add("WireDynamicButtonTool_colour_off", "Color Off:")
end
WireToolSetup.BaseLang()
WireToolSetup.SetupMax(20)
if SERVER then
function TOOL:GetConVars()
return self:GetClientNumber("toggle") ~= 0, self:GetClientNumber("value_on"), self:GetClientNumber("value_off"), self:GetClientInfo("description"), self:GetClientNumber("entityout") ~= 0, self:GetClientInfo("material_on"), self:GetClientInfo("material_off"), self:GetClientNumber("on_r"), self:GetClientNumber("on_g"), self:GetClientNumber("on_b"), self:GetClientNumber("off_r"), self:GetClientNumber("off_g"), self:GetClientNumber("off_b")
end
-- Uses default WireToolObj:MakeEnt's WireLib.MakeWireEnt function
end
TOOL.ClientConVar = {
model = "models/bull/ranger.mdl",
model_category = "dynamic_button",
toggle = "0",
value_off = "0",
value_on = "1",
description = "",
entityout = "0",
material_on = "bull/dynamic_button_1",
material_off = "bull/dynamic_button_0",
on_r = 0,
on_g = 255,
on_b = 0,
off_r = 255,
off_g = 0,
off_b = 0
}
function TOOL.BuildCPanel(panel)
WireToolHelpers.MakePresetControl(panel, "wire_dynamic_button")
ModelPlug_AddToCPanel_Multi(panel, {
dynamic_button = "Normal",
dynamic_button_small = "Small"
}, "wire_dynamic_button", "#Dynamic_Button_Model", 1.3)
panel:NumSlider("#WireDynamicButtonTool_value_on", "wire_dynamic_button_value_on", -10, 10, 1)
panel:AddControl("ListBox", {
Label = "#WireDynamicButtonTool_materials_on",
Options = list.Get("WireDynamicButtonMaterialsOn")
})
panel:AddControl("Color", {
Label = "#WireDynamicButtonTool_colour_on",
Red = "wire_dynamic_button_on_r",
Green = "wire_dynamic_button_on_g",
Blue = "wire_dynamic_button_on_b"
})
panel:NumSlider("#WireDynamicButtonTool_value_off", "wire_dynamic_button_value_off", -10, 10, 1)
panel:AddControl("ListBox", {
Label = "#WireDynamicButtonTool_materials_off",
Options = list.Get("WireDynamicButtonMaterialsOff")
})
panel:AddControl("Color", {
Label = "#WireDynamicButtonTool_colour_off",
Red = "wire_dynamic_button_off_r",
Green = "wire_dynamic_button_off_g",
Blue = "wire_dynamic_button_off_b"
})
panel:CheckBox("#WireDynamicButtonTool_toggle", "wire_dynamic_button_toggle")
panel:CheckBox("#WireDynamicButtonTool_entityout", "wire_dynamic_button_entityout")
end
|
pico-8 cartridge // http://www.pico-8.com
version 8
__lua__
--stealth elf v%%git_count%%
--a game by @josefnpat and @therickywill
states = {}
function switch_state(target)
if states[target].init then
states[target]:init()
end
current_state = states[target]
end
_printh = printh
printh = function(msg,file)
_printh(msg,file or "log.txt")
end
|
-- generate C test file to check type sizes etc
local S = require "syscall"
local ffi = require "ffi"
local s, t = S.s, S.t
-- TODO fix these, various naming issues
S.ctypes["struct linux_dirent64"] = nil
S.ctypes["struct statfs64"] = nil
S.ctypes["struct flock64"] = nil
S.ctypes["struct stat64"] = nil
S.ctypes["struct fdb_entry"] = nil
S.ctypes["struct seccomp_data"] = nil
S.ctypes["sighandler_t"] = nil
S.ctypes["struct rlimit64"] = nil
S.ctypes["struct mq_attr"] = nil
-- fixes for constants
S.__WALL = S.WALL; S.WALL = nil
S.__WCLONE = S.WCLONE; S.WCLONE = nil
-- remove seccomp for now as no support on the ARM box
for k, _ in pairs(S) do
if k:sub(1, 8) == 'SECCOMP_' then S[k] = nil end
end
-- fake constants
S.MS_RO = nil
S.MS_RW = nil
S.IFF_ALL = nil
S.IFF_NONE = nil
-- TODO find the headers/flags for these if exist, or remove
S.SA_RESTORER = nil
S.AF_DECNET = nil
S.SIG_HOLD = nil
S.NOTHREAD = nil
S.RTF_PREFIX_RT = nil
S.RTF_EXPIRES = nil
S.RTF_ROUTEINFO = nil
S.RTF_ANYCAST = nil
-- include kitchen sink, garbage can etc
print [[
#include "assert.h"
#define _GNU_SOURCE
#define __USE_GNU
#define _FILE_OFFSET_BITS 64
#define _LARGE_FILES 1
#define __USE_FILE_OFFSET64
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/epoll.h>
#include <signal.h>
#include <sys/utsname.h>
#include <time.h>
#include <linux/aio_abi.h>
#include <sys/resource.h>
#include <sys/sysinfo.h>
#include <sys/time.h>
#include <sys/un.h>
#include <netinet/ip.h>
#include <poll.h>
#include <sys/signalfd.h>
#include <linux/rtnetlink.h>
#include <sys/vfs.h>
#include <sys/timex.h>
#include <linux/posix_types.h>
#include <linux/if.h>
#include <linux/if_bridge.h>
#include <sys/mman.h>
#include <sched.h>
#include <sys/xattr.h>
#include <linux/if_arp.h>
#include <sys/capability.h>
#include <linux/sched.h>
#include <termios.h>
#include <unistd.h>
#include <sys/prctl.h>
#include <sys/mount.h>
#include <sys/uio.h>
#include <net/route.h>
#include <sys/inotify.h>
#include <sys/wait.h>
#include <linux/mman.h>
#include <linux/veth.h>
#include <linux/sockios.h>
#include <dirent.h>
#include <linux/reboot.h>
#include <sys/timerfd.h>
#include <linux/falloc.h>
#include <sys/eventfd.h>
int main(int argc, char **argv) {
]]
-- iterate over S.ctypes
for k, v in pairs(S.ctypes) do
print("assert(sizeof(" .. k .. ") == " .. ffi.sizeof(v) .. ");")
end
-- test all the constants
for k, v in pairs(S) do
if type(S[k]) == "number" then
print("assert(" .. k .. " == " .. v .. ");")
end
end
-- TODO test error codes
print [[
}
]]
|
return function(HooI)
local ClickEvent = HooI.class("ClickEvent")
function ClickEvent:initialize(entity, button, isPressed)
self.entity = entity
self.button = button
self.isPressed = isPressed
end
return ClickEvent
end
|
if redis.call('get', KEYS[1]) == ARGS[1] then
if redis.call('expire',KEYS[1],ARGS[2]) then
return true
end
end
return false
|
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
function ENT:Initialize()
self:SetModel("models/props_foliage/spikeplant01.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
self:SetCollisionGroup(0)
self:SetColor(255,255,255,255)
self:DrawShadow( false )
end
function ENT:OnTakeDamage(dmg)
end
function ENT:StartTouch(ent)
end
function ENT:EndTouch(ent)
end
function ENT:AcceptInput(name,activator,caller)
end
function ENT:KeyValue(key,value)
end
function ENT:OnRemove()
end
function ENT:OnRestore()
end
function ENT:PhysicsCollide(data,physobj)
end
function ENT:PhysicsSimulate(phys,deltatime)
end
function ENT:PhysicsUpdate(phys)
end
function ENT:Think()
end
function ENT:Touch(hitEnt)
end
function ENT:UpdateTransmitState(Entity)
end
function ENT:Use(activator,caller)
end
|
return {'plu','pluche','pluchen','plug','pluggen','plugger','plugkraan','pluim','pluimage','pluimbal','pluimborstel','pluimen','pluimgedierte','pluimgewicht','pluimgraaf','pluimgras','pluimhoed','pluimpje','pluimriet','pluimstaart','pluimstrijken','pluimstrijker','pluimstrijkerij','pluimvee','pluimveebedrijf','pluimveeconsulent','pluimveehouder','pluimveehouderij','pluimveemest','pluimveesector','pluimveeslachterij','pluimveestapel','pluimveeteelt','pluimveevlees','pluimveevoer','pluis','pluizen','pluizer','pluizerig','pluizerij','pluizig','pluk','plukbaar','plukgeld','plukharen','plukken','plukker','plukloon','plukmand','plukrijp','pluksel','pluktijd','plumeau','plumpudding','plunderaar','plunderen','plundering','plundertocht','plunje','plunjebaal','plunjer','plunjerpomp','plunjers','plunjezak','pluralis','pluralisme','pluralistisch','pluraliteit','pluriform','pluriformiteit','plus','plusfour','plusminus','plusminusteken','pluspakket','pluspion','pluspool','pluspunt','plussen','plusser','plusstrook','plusteken','plustoets','plutocraat','plutocratie','plutocratisch','plutonisch','plutonisme','plutonium','plutoniumbom','plutoniumvoorraad','pluvier','pluviometer','plurk','pluisachtig','pluksgewijs','plutoniumschip','plutoniumtransport','pluraal','pluimveevleessector','plusklas','plusremise','pluktuin','pluimveebedrijfsleven','plusdraad','plugboer','pluto','pluijm','plugge','pluimers','plum','pluijmen','plugers','pluister','pluijgers','pluut','pluggers','plugkranen','pluimages','pluimballen','pluimde','pluimden','pluimgraven','pluimhoeden','pluimpjes','pluimstaarten','pluimstrijkerijen','pluimstrijkers','pluimt','pluimveehouderijen','pluimveehouders','pluisde','pluisden','pluisje','pluist','pluizerige','pluizeriger','pluizers','pluizige','pluiziger','pluizigste','plukhaar','plukhaarde','plukje','plukjes','plukkers','plukmanden','pluksels','plukt','plukte','plukten','plumeaus','plumeautje','plumpuddingen','plunder','plunderaars','plunderde','plunderden','plunderend','plunderingen','plundert','plundertochten','plunderzieke','plunjebalen','plunjes','plunjezakken','plurale','pluralia','pluralistische','pluriforme','pluriformer','plusfours','pluspakketten','pluspunten','plustekens','plutocraten','plutocratieen','plutocratische','plutonische','pluvieren','pluviometers','plugde','plugt','pluimstrijkte','pluimveebedrijven','pluimveeslachterijen','pluizerijen','plunderende','pluralissen','plusminustekens','pluspolen','plussers','plusstroken','pluste','pluisachtige','plukbare','plutoniumvoorraden','plus','plurken','pluksgewijze','plutoniumtransporten','plusjes','plusje','plugjes','pluisjes','pluspuntje','pluspionnen','pluspuntjes','pluimveesectoren','plunjerpompen','pluktuinen'}
|
module('properties', package.seeall)
local function get_variables(class)
local vars = {}
local function traverse(c)
for i, var in ipairs(c) do
if var.label == "Variable" and var.xarg.access == "public" then
table.insert(vars, var)
end
end
for b in string.gmatch(c.xarg.bases or '', '([^;]+);') do
local base = fullnames[b]
if base then traverse(base) end
end
end
traverse(class)
return vars
end
function fill_properties(classes)
for c in pairs(classes) do
local props = {}
local vars = get_variables(c)
for i, var in ipairs(vars) do
local targetType = typesystem[var.xarg.type_name]
if targetType then
local sget = typesystem[c.xarg.fullname..'*'].get(1)
local getter =
' ' .. c.xarg.fullname .. '* self = ' .. sget .. ';\n' ..
' lqtL_selfcheck(L, self, "'..c.xarg.fullname..'");\n' ..
' ' .. targetType.push('self->'..var.xarg.name) .. ';\n' ..
' return 1;\n'
local setter
if not var.xarg.type_constant then
setter =
' ' .. c.xarg.fullname .. '* self = ' .. sget .. ';\n' ..
' lqtL_selfcheck(L, self, "'..c.xarg.fullname..'");\n' ..
' self->' .. var.xarg.name .. ' = ' .. targetType.get(3) .. ';\n' ..
' return 0;\n'
end
table.insert(props, { class=c.xarg.cname, name = var.xarg.name, type = var.xarg.type_name,
getter = getter, setter = setter })
end
end
if next(props) then
local properties = ''
local getters, setters = {}, {}
for i, p in ipairs(props) do
properties = properties .. 'static int '..p.class..'_get_'..p.name..'(lua_State *L) {\n'..p.getter..'}\n'
table.insert(getters, p)
if p.setter then
properties = properties .. 'static int '..p.class..'_set_'..p.name..'(lua_State *L) {\n'..p.setter..'}\n'
table.insert(setters, p)
end
end
-- there can be less setters than getters, due to 'const'
for i,g in ipairs(getters) do
getters[i] = ' {"'..g.name..'", '..g.class..'_get_'..g.name..'},'
end
for i,s in ipairs(setters) do
setters[i] = ' {"'..s.name..'", '..s.class..'_set_'..s.name..'},'
end
c.properties = properties..'\n'..
'static luaL_Reg lqt_getters'..c.xarg.id..'[] = {\n'..table.concat(getters, '\n')..' {NULL, NULL}\n};\n\n' ..
'static luaL_Reg lqt_setters'..c.xarg.id..'[] = {\n'..table.concat(setters, '\n')..' {NULL, NULL}\n};\n\n'
end
end
end
|
local types = require "resty.nettle.types.common"
local context = require "resty.nettle.types.knuth-lfib"
local lib = require "resty.nettle.library"
local ffi = require "ffi"
local ffi_new = ffi.new
local ffi_str = ffi.string
local setmetatable = setmetatable
local knuth = { func = lib.nettle_knuth_lfib_random }
knuth.__index = knuth
function knuth.context(seed)
local ctx = ffi_new(context)
lib.nettle_knuth_lfib_init(ctx, seed or 0)
return ctx
end
function knuth.new(seed)
local self = setmetatable({ context = ffi_new(context) }, knuth)
lib.nettle_knuth_lfib_init(self.context, seed or 0)
return self
end
function knuth:number()
return lib.nettle_knuth_lfib_get(self.context)
end
function knuth:array(len)
local b = ffi_new(types.uint32_t, len)
lib.nettle_knuth_lfib_get_array(self.context, len, b)
local r = {}
for i = 1, len do r[i] = b[i - 1] end
return r
end
function knuth:random(len)
local b = types.buffers(len)
lib.nettle_knuth_lfib_random(self.context, len, b)
return ffi_str(b, len)
end
return knuth
|
-- Generated by github.com/davyxu/tabtoy
-- Version: 2.8.10
local tab = {
TShop = {
{ Id = 1, Itemid = 1001, Name = "苹果iPhoneX", Type = 1, Num = 1, Rmb = 8488, Price = 169760, Send = 0 },
{ Id = 2, Itemid = 3017, Name = "【中国黄金】黄金金条10g", Type = 1, Num = 1, Rmb = 2893, Price = 57860, Send = 0 },
{ Id = 3, Itemid = 3018, Name = "【周大福】十二生肖狗吉星高照足金黄金吊坠2g", Type = 1, Num = 1, Rmb = 840, Price = 16800, Send = 0 },
{ Id = 4, Itemid = 3019, Name = "南极人纯棉四件套", Type = 1, Num = 1, Rmb = 149, Price = 2980, Send = 0 },
{ Id = 5, Itemid = 3020, Name = "小米空气净化器", Type = 1, Num = 1, Rmb = 529, Price = 10580, Send = 0 },
{ Id = 6, Itemid = 3021, Name = "小熊养生壶", Type = 1, Num = 1, Rmb = 129, Price = 2580, Send = 0 }
}
}
-- Id
tab.TShopById = {}
for _, rec in pairs(tab.TShop) do
tab.TShopById[rec.Id] = rec
end
tab.Enum = {
}
return tab
|
return {
PlaceObj("ModItemOptionToggle", {
"name", "RemoveBuildingLimits",
"DisplayName", T(302535920011236, "Remove Building Limits"),
"DefaultValue", true,
}),
}
|
local mod = DBM:NewMod(2170, "DBM-Party-BfA", 3, 1041)
local L = mod:GetLocalizedStrings()
mod:SetRevision("20190420174733")
mod:SetCreatureID(135475, 135470, 135472)
mod:SetEncounterID(2140)
mod:SetZone()
mod:SetUsedIcons(1)
mod:SetBossHPInfoToHighest()
mod:RegisterCombat("combat")
mod:RegisterEventsInCombat(
"SPELL_AURA_APPLIED 267256 266231",
"SPELL_AURA_REMOVED 267256",
"SPELL_CAST_START 266206 266951 266237 267273 267060",
"SPELL_CAST_SUCCESS 266231",
"UNIT_DIED",
"CHAT_MSG_RAID_BOSS_EMOTE",
"UNIT_SPELLCAST_SUCCEEDED boss1 boss2 boss3",
"UNIT_TARGETABLE_CHANGED boss1 boss2 boss3"
)
--TODO, finish accurate detection of who starts fight, and bosses swapping in and out.
--TODO, I believe the inactive bosses assisting is health based off the enabled boss, so timers only work for ACTIVE boss.
local warnSeveringAxe = mod:NewTargetNoFilterAnnounce(266231, 3, nil, "Healer")
--Kula the Butcher
local specWarnWhirlingAxes = mod:NewSpecialWarningDodge(266206, nil, nil, nil, 2, 1)
local specWarnSeveringAxe = mod:NewSpecialWarningDefensive(266231, nil, nil, nil, 1, 1)
--local specWarnGTFO = mod:NewSpecialWarningGTFO(238028, nil, nil, nil, 1, 8)
--Aka'ali the Conqueror
local specWarnBarrelThrough = mod:NewSpecialWarningYou(266951, nil, nil, nil, 1, 1)
local yellBarrelThrough = mod:NewYell(266951)
local yellBarrelThroughFades = mod:NewShortFadesYell(266951)
local specWarnBarrelThroughSoak = mod:NewSpecialWarningMoveTo(266951, nil, nil, nil, 1, 1)
local specWarnDebilitatingBackhand = mod:NewSpecialWarningRun(266237, nil, nil, nil, 4, 1)
--Zanazal the Wise
local specWarnPoisonNova = mod:NewSpecialWarningInterrupt(267273, "HasInterrupt", nil, nil, 1, 2)
local specWarnTotems = mod:NewSpecialWarningSwitch(267060, nil, nil, nil, 1, 2)
local specWarnEarthwall = mod:NewSpecialWarningDispel(267256, "MagicDispeller", nil, nil, 1, 2)
--Kula the Butcher
local timerWhirlingAxesCD = mod:NewCDTimer(10.8, 266206, nil, nil, nil, 3)--Used inactive
local timerSeveringAxeCD = mod:NewCDTimer(13, 266231, nil, nil, nil, 3)--Actual timer needs doing
--Aka'ali the Conqueror
local timerBarrelThroughCD = mod:NewCDTimer(23.1, 266951, nil, nil, nil, 3)--Used inactive
local timerDebilitatingBackhandCD = mod:NewCDTimer(24.3, 266237, nil, nil, nil, 5, nil, DBM_CORE_TANK_ICON..DBM_CORE_DEADLY_ICON)
--Zanazal the Wise
local timerPoisonNovaCD = mod:NewCDTimer(133, 267273, nil, nil, nil, 4, nil, DBM_CORE_INTERRUPT_ICON)--Used inactive
local timerTotemsCD = mod:NewCDTimer(13, 267060, nil, nil, nil, 1, nil, DBM_CORE_DAMAGE_ICON)--Actual timer needs doing
--mod:AddRangeFrameOption(5, 194966)
mod:AddSetIconOption("SetIconOnBarrel", 266951, true, false, {1})
mod.vb.phase = 1
mod.vb.bossOne = 0
mod.vb.bossTwo = 0
mod.vb.earthTotemActive = false
mod.vb.bossName = "nil"
--Engage Timers
local function whoDat(self, delay)
for i = 1, 3 do--Might actually only need to check boss 1
local bossUID = "boss"..i
if UnitCanAttack("player", bossUID) then
local cid = self:GetUnitCreatureId(bossUID)
if cid == 135475 then -- Kula the Butcher
timerWhirlingAxesCD:Start(6-delay)
timerSeveringAxeCD:Start(22.2-delay)--SUCCESS
elseif cid == 135470 then -- Aka'ali the Conqueror
--timerBarrelThroughCD:Start(1-delay)
--timerDebilitatingBackhandCD:Start(1-delay)
elseif cid == 135472 then -- Zanazal the Wise
timerPoisonNovaCD:Start(8.8-delay)
timerTotemsCD:Start(23.5-delay)
end
end
end
end
function mod:OnCombatStart(delay)
self.vb.phase = 1
self.vb.bossOne = 0
self.vb.bossTwo = 0
self.vb.bossName = "nil"
self.vb.earthTotemActive = false
self:Schedule(2, whoDat, self, delay)
end
function mod:OnCombatEnd()
-- if self.Options.RangeFrame then
-- DBM.RangeCheck:Hide()
-- end
end
function mod:SPELL_AURA_APPLIED(args)
local spellId = args.spellId
if spellId == 267256 and not self.vb.earthTotemActive and not args:IsDestTypePlayer() then
specWarnEarthwall:Show(args.destName)
specWarnEarthwall:Play("dispelboss")
self.vb.bossName = args.destName
elseif spellId == specWarnSeveringAxe then
if args:IsPlayer() then
specWarnSeveringAxe:Show()
specWarnSeveringAxe:Play("defensive")
else
warnSeveringAxe:Show(args.destName)
end
end
end
--mod.SPELL_AURA_APPLIED_DOSE = mod.SPELL_AURA_APPLIED
function mod:SPELL_AURA_REMOVED(args)
local spellId = args.spellId
if spellId == 267256 then
self.vb.bossName = "nil"
end
end
function mod:SPELL_CAST_START(args)
local spellId = args.spellId
if spellId == 266206 then
specWarnWhirlingAxes:Show()
specWarnWhirlingAxes:Play("watchstep")
local cid = self:GetCIDFromGUID(args.sourceGUID)
if cid ~= self.vb.bossOne and cid ~= self.vb.bossTwo then
timerWhirlingAxesCD:Start()
end
elseif spellId == 266951 then
local cid = self:GetCIDFromGUID(args.sourceGUID)
if cid ~= self.vb.bossOne and cid ~= self.vb.bossTwo then
timerBarrelThroughCD:Start()
end
elseif spellId == 266237 then
if self:IsTanking("player", "boss1", nil, true) then
specWarnDebilitatingBackhand:Show()
specWarnDebilitatingBackhand:Play("justrun")
--specWarnDebilitatingBackhand:ScheduleVoice(3.5, "justrun")
end
timerDebilitatingBackhandCD:Start()
elseif spellId == 267273 then
if self:CheckInterruptFilter(args.sourceGUID, false, true, true) then
specWarnPoisonNova:Show(args.sourceName)
specWarnPoisonNova:Play("kickcast")
end
local cid = self:GetCIDFromGUID(args.sourceGUID)
if cid ~= self.vb.bossOne and cid ~= self.vb.bossTwo then
--timerPoisonNovaCD:Start()--Not enough data
end
elseif spellId == 267060 then
self.vb.earthTotemActive = true
specWarnTotems:Show()
specWarnTotems:Play("changetarget")
--timerTotemsCD:Start()--Not enough data
end
end
function mod:SPELL_CAST_SUCCESS(args)
local spellId = args.spellId
if spellId == 266231 then
--timerSeveringAxeCD:Start()--Not enough data
end
end
function mod:UNIT_DIED(args)
local cid = self:GetCIDFromGUID(args.destGUID)
if cid == 135759 then--Earth Totem
self.vb.earthTotemActive = false
if self.vb.bossName ~= "nil" then
specWarnEarthwall:Show(self.vb.bossName)
specWarnEarthwall:Play("dispelboss")
end
end
end
function mod:CHAT_MSG_RAID_BOSS_EMOTE(msg, npc, _, _, target)
if msg:find("spell:266951") then
local targetname = DBM:GetUnitFullName(target)
if targetname then
if targetname == UnitName("player") then
specWarnBarrelThrough:Show()
specWarnBarrelThrough:Play("targetyou")
yellBarrelThrough:Yell()
yellBarrelThroughFades:Countdown(8)
else
specWarnBarrelThroughSoak:Show(targetname)
specWarnBarrelThroughSoak:Play("gathershare")
end
if self.Options.SetIconOnBarrel then
self:SetIcon(targetname, 1, 8)
end
end
end
end
--[[
function mod:SPELL_PERIODIC_DAMAGE(_, _, _, _, destGUID, _, _, _, spellId)
if spellId == 228007 and destGUID == UnitGUID("player") and self:AntiSpam(2, 4) then
specWarnGTFO:Show()
specWarnGTFO:Play("watchfeet")
end
end
mod.SPELL_PERIODIC_MISSED = mod.SPELL_PERIODIC_DAMAGE
--]]
function mod:UNIT_SPELLCAST_SUCCEEDED(uId, _, spellId)
if spellId == 34098 and self:AntiSpam(3, uId) then--ClearAllDebuffs (sometimes fires twice, so antispam needed)
timerWhirlingAxesCD:Stop()
timerBarrelThroughCD:Stop()
timerDebilitatingBackhandCD:Stop()
timerPoisonNovaCD:Stop()
timerTotemsCD:Stop()
self.vb.phase = self.vb.phase + 1
local cid = self:GetUnitCreatureId(uId)
if self.vb.phase == 2 then
self.vb.bossOne = cid
--Start Boss 1 Timer (17sec)
if cid == 135475 then -- Kula the Butcher
-- timerWhirlingAxesCD:Start(17)
elseif cid == 135470 then -- Aka'ali the Conqueror
-- timerBarrelThroughCD:Start(17)
elseif cid == 135472 then -- Zanazal the Wise
-- timerPoisonNovaCD:Start(17)
end
else
self.vb.bossTwo = cid
--Start Boss 1 Timer (17.9-25.5-28.9sec)
if self.vb.bossOne == 135475 then -- Kula the Butcher
-- timerWhirlingAxesCD:Start(25.5)
elseif self.vb.bossOne == 135470 then -- Aka'ali the Conqueror
-- timerBarrelThroughCD:Start(25.5)
elseif self.vb.bossOne == 135472 then -- Zanazal the Wise
-- timerPoisonNovaCD:Start(25.5)
end
--Start Boss 2 Timer (47.1/55.5 seconds)
if cid == 135475 then -- Kula the Butcher
-- timerWhirlingAxesCD:Start(55.5)
elseif cid == 135470 then -- Aka'ali the Conqueror
-- timerBarrelThroughCD:Start(55.5)
elseif cid == 135472 then -- Zanazal the Wise
-- timerPoisonNovaCD:Start(55.5)
end
end
--[[elseif spellID == 267422 then--Boss 1 Assist
if self.vb.bossOne == 135475 then -- Kula the Butcher
elseif self.vb.bossOne == 135470 then -- Aka'ali the Conqueror
elseif self.vb.bossOne == 135472 then -- Zanazal the Wise
end
elseif spellId == 267437 then--Boss 2 Assist
if cid == 135475 then -- Kula the Butcher
elseif cid == 135470 then -- Aka'ali the Conqueror
elseif cid == 135472 then -- Zanazal the Wise
end--]]
end
end
--2nd and 3rd Boss timers
function mod:UNIT_TARGETABLE_CHANGED(uId)
if UnitCanAttack("player", uId) then
local cid = self:GetUnitCreatureId(uId)
if cid == 135475 then -- Kula the Butcher
timerWhirlingAxesCD:Start(8)
timerSeveringAxeCD:Start(22.2)
elseif cid == 135470 then -- Aka'ali the Conqueror
timerBarrelThroughCD:Start(6)
timerDebilitatingBackhandCD:Start(15.7)
elseif cid == 135472 then -- Zanazal the Wise
timerPoisonNovaCD:Start(18.1)
timerTotemsCD:Start(19.2)
end
end
end
|
help([[The Portable Hardware Locality (hwloc) software package provides a portable abstraction
(across OS, versions, architectures, ...) of the hierarchical topology of modern architectures, including
NUMA memory nodes, sockets, shared caches, cores and simultaneous multithreading. It also gathers various
system attributes such as cache and memory information as well as the locality of I/O devices such as
network interfaces, InfiniBand HCAs or GPUs. It primarily aims at helping applications with gathering
information about modern computing hardware so as to exploit it accordingly and efficiently. - Homepage: http://www.open-mpi.org/projects/hwloc/]])
whatis([[Description: The Portable Hardware Locality (hwloc) software package provides a portable abstraction
(across OS, versions, architectures, ...) of the hierarchical topology of modern architectures, including
NUMA memory nodes, sockets, shared caches, cores and simultaneous multithreading. It also gathers various
system attributes such as cache and memory information as well as the locality of I/O devices such as
network interfaces, InfiniBand HCAs or GPUs. It primarily aims at helping applications with gathering
information about modern computing hardware so as to exploit it accordingly and efficiently. - Homepage: http://www.open-mpi.org/projects/hwloc/]])
local root = "/opt/apps/software/hwloc/1.11.3-GCC-5.4.0-2.26"
conflict("hwloc")
if not isloaded("GCC/5.4.0-2.26") then
load("GCC/5.4.0-2.26")
end
if not isloaded("numactl/2.0.11-GCC-5.4.0-2.26") then
load("numactl/2.0.11-GCC-5.4.0-2.26")
end
prepend_path("CPATH", pathJoin(root, "include"))
prepend_path("LD_LIBRARY_PATH", pathJoin(root, "lib"))
prepend_path("LIBRARY_PATH", pathJoin(root, "lib"))
prepend_path("MANPATH", pathJoin(root, "share/man"))
prepend_path("PATH", pathJoin(root, "bin"))
prepend_path("PATH", pathJoin(root, "sbin"))
prepend_path("PKG_CONFIG_PATH", pathJoin(root, "lib/pkgconfig"))
setenv("EBROOTHWLOC", root)
setenv("EBVERSIONHWLOC", "1.11.3")
setenv("EBDEVELHWLOC", pathJoin(root, "easybuild/hwloc-1.11.3-GCC-5.4.0-2.26-easybuild-devel"))
-- Built with EasyBuild version 3.1.0
|
function love.conf(t)
t.window.width = 1060
t.window.height = 800
end
|
#!/usr/bin/env luajit
local function printf(fmt, ...) io.write(string.format(fmt, ...)) end
local epi=require"epidemiologie"
local last=1
local fib=epi.model.fibonacci(math.huge,1.26)
local exp=epi.model.exp(1,1.26)
print(" i fib exp")
for i=1,60 do
local m1, m2=fib(), exp()
printf("%3d %8.1f %8.1f\n",i, m1,m2)
end
|
function genStorageTanks(inputs)
-- Copy electric furnace
local item = table.deepcopy(data.raw.item["storage-tank"])
local recipe = table.deepcopy(data.raw.recipe["storage-tank"])
local entity = table.deepcopy(data.raw["storage-tank"]["storage-tank"])
local tech = table.deepcopy(data.raw.technology["fluid-handling"])
--Item
if inputs.new then
item.name = "5d-storage-tank-" .. inputs.number
end
item.icon = "__5dim_storage__/graphics/icon/storage-tank/storage-tank-icon-" .. inputs.number .. ".png"
item.subgroup = inputs.subgroup
item.order = inputs.order
item.place_result = item.name
--Recipe
recipe.name = item.name
recipe.result = item.name
recipe.icon = item.icon
recipe.icon_size = 64
recipe.enabled = false
recipe.ingredients = inputs.ingredients
--Entity
entity.name = item.name
entity.next_upgrade = inputs.nextUpdate or nil
entity.icon = item.icon
entity.minable.result = item.name
entity.fluid_box.base_area = inputs.capacity
entity.pictures.picture.sheets[1].hr_version.filename =
"__5dim_storage__/graphics/entities/storage-tank/storage-tank-" .. inputs.number .. ".png"
data:extend({entity, recipe, item})
if inputs.tech then
-- Technology
tech.name = "fluid-handling-" .. inputs.tech.number
tech.unit.count = inputs.tech.count
tech.unit.ingredients = inputs.tech.packs
tech.prerequisites = inputs.tech.prerequisites
tech.effects = {
{
type = "unlock-recipe",
recipe = item.name
}
}
data:extend({tech})
end
end
|
local string = string
local window = window
local webview = webview
local widget = widget
local theme = theme
local luakit = luakit
local lousy = require("lousy")
local util = lousy.util
local print = print
local ipairs = ipairs
local type = type
module("plugins.private_browsing_tabs")
-- Private tab label
theme.private_tab_fg = "#bc66ab"
theme.private_tab_bg = "#290f24"
theme.private_tab_ntheme = "#dddddd"
theme.private_selected_fg = "#ffffff"
theme.private_selected_bg = "#492f44"
theme.private_selected_ntheme = "#bdbdbd"
theme.private_loading_fg = "#33aadd"
theme.private_loading_bg = "#330022"
-- Store the old update_tablist function
_update_tablist = window.methods.update_tablist
-- Override the update_tablist with a new function
window.methods.update_tablist = function(w)
local current = w.tabs:current()
local tab_fg, tab_bg, nfg, selected_nfg, loading_fg, selected_tab_fg, selected_tab_bg
local notrust_fg, trust_fg = theme.tab_notrust_fg, theme.tab_trust_fg
local escape = lousy.util.escape
local tabs, tfmt = {}, ' <span foreground="%s">%s</span> %s'
for i, view in ipairs(w.tabs.children) do
if view.enable_private_browsing then
tab_fg = theme.private_tab_fg
tab_bg = theme.private_tab_bg
nfg = theme.private_tab_ntheme
selected_nfg = theme.private_selected_ntheme
loading_fg = theme.private_loading_fg
selected_tab_fg = theme.private_selected_fg
selected_tab_bg = theme.private_selected_bg
else
tab_fg = theme.tab_fg
tab_bg = theme.tab_bg
nfg = theme.tab_ntheme
selected_nfg = theme.selected_ntheme
loading_fg = theme.tab_loading_fg
selected_tab_fg = theme.tab_selected_fg
selected_tab_bg = theme.tab_selected_bg
end
-- Get tab number theme
local ntheme = nfg
if view:loading() then -- Show loading on all tabs
ntheme = loading_fg
elseif current == i then -- Show ssl trusted/untrusted on current tab
local trusted = view:ssl_trusted()
ntheme = selected_nfg
if trusted == false or (trusted ~= nil and not w.checking_ssl) then
ntheme = notrust_fg
elseif trusted then
ntheme = trust_fg
end
end
local title = (view.enable_private_browsing and "(Private)") or view.title or view.uri or "(Untitled)"
tabs[i] = {
title = string.format(tfmt, ntheme or tab_fg, i, escape(title)),
fg = (current == i and selected_tab_fg) or tab_fg,
bg = (current == i and selected_tab_bg) or tab_bg,
}
end
if #tabs < 2 then tabs, current = {}, 0 end
w.tablist:update(tabs, current)
end
--Store the old new_tab method from window
_new_tab = window.methods.new_tab
--Override the new_tab method with a new one
window.methods.new_tab = function (w, arg, switch, order)
local view
-- Use blank tab first
if w.has_blank and w.tabs:count() == 1 and w.tabs[1].uri == "about:blank" then
view = w.tabs[1]
end
w.has_blank = nil
-- Make new webview widget
if not view then
view = webview.new(w)
if w.view and w.view.enable_private_browsing then
view.enable_private_browsing = true
end
-- Get tab order function
if not order and taborder then
order = (switch == false and taborder.default_bg)
or taborder.default
end
pos = w.tabs:insert((order and order(w, view)) or -1, view)
if switch ~= false then w.tabs:switch(pos) end
end
-- Load uri or webview history table
if type(arg) == "string" then view.uri = arg
elseif type(arg) == "table" then view.history = arg end
-- Update statusbar widgets
w:update_tab_count()
w:update_tablist()
return view
end
define_colors = function(view)
end
|
return {
name = 'pierce',
offset = 2,
ow = 5,
costumes = {
{name='Pierce Hawthorne', sheet='base', category='base' },
{name='Astronaut', sheet='astronaut', category='s2e4' },
{name='Birthday Suit', sheet='naked', category='s3e20' },
-- {name='Beastmaster', sheet='beast', category='s1e7' },
{name='Canoe', sheet='canoe', category='s1e19' },
{name='Captain Kirk', sheet='kirk', category='s2e6' },
{name='Drugs', sheet='drugs', category='s2e13' },
-- {name='Cookie Crisp Wizard', sheet='cookie', category='s1e20' },
{name='Hotdog', sheet='hotdog', category='s2e21' },
{name='Hula Paint Hallucination', sheet='hulapaint', category='s3e7' },
{name='Janet Reno', sheet='janetreno', category='s1e16' },
{name='The Gimp', sheet='gimp', category='s2e19' },
{name='Level 5 Laser Lotus', sheet='lotus', category='s2e3' },
{name='Magnum', sheet='magnum', category='s3e5' },
{name='Paintball Trooper', sheet='paintball', category='s2e24' },
{name='Planet Christmas', sheet='planet_christmas', category='s3e10' },
{name='Wheelchair', sheet='wheelchair', category='s2e9' },
{name='Zombie', sheet='zombie', category='s2e6' },
-- {name='Pillow Man', sheet='pillow', category='s3e14' }
},
animations = {
dead = {
right = {'once', {'6,2'}, 1},
left = {'once', {'6,1'}, 1}
},
jump = {
right = {'once', {'7,2'}, 1},
left = {'once', {'7,1'}, 1}
},
hold = {
right = {'once', {'7,12'}, 1},
left = {'once', {'7,11'}, 1}
},
holdwalk = {
right = {'loop', {'1-4,14'}, 0.16},
left = {'loop', {'1-4,13'}, 0.16}
},
holdjump = {
right = {'once', {'1,10'}, 1},
left = {'once', {'1,11'}, 1},
},
hurt = {
right = {'once', {'2,6'}, 1},
left = {'once', {'2,5'}, 1}
},
walk = {
right = {'loop', {'2-5,2'}, 0.16},
left = {'loop', {'2-5,1'}, 0.16}
},
idle = {
right = {'once', {'1,2'}, 1},
left = {'once', {'1,1'}, 1}
},
crouch = {
right = {'once', {'3,6'}, 1},
left = {'once', {'3,5'}, 1}
},
crouchwalk = { --state for walking towards the camera
right = {'loop', {'2-3,3'}, 0.16},
left = {'loop', {'2-3,3'}, 0.16}
},
attack = {
left = {'loop', {'6,5', '8,5'}, 0.16},
right = {'loop', {'6,6', '8,6'}, 0.16}
},
attackjump = {
left = {'loop', {'7,3','9,3'}, 0.16},
right = {'loop', {'7,4','9,4'}, 0.16}
},
attackwalk = {
left = {'loop', {'5,3','6,3','9,3','6,3'}, 0.16},
right = {'loop', {'5,4','6,4','9,4','6,4'}, 0.16}
},
wieldwalk = { --state for walking while holding a weapon
left = {'loop', {'5-6,3'}, 0.16},
right = {'loop', {'5-6,4'}, 0.16},
},
wieldidle = { --state for standing while holding a weapon
left = {'once', {'1,5'}, 1},
right = {'once', {'1,6'}, 1},
},
wieldjump = { --state for jumping while holding a weapon
left = {'once', {'5,3'}, 1},
right = {'once', {'5,4'}, 1},
},
wieldaction = { --state for swinging a weapon
left = {'once', {'5,5','6,5','9,5','6,5'}, 0.09},
right = {'once', {'5,4','6,4','9,4','6,4'}, 0.09},
},
gaze = {
right = {'once', {'8,2'}, 1},
left = {'once', {'8,1'}, 1}
},
gazeidle = { --state for looking away from the camera
right = {'once', {'1,4'}, 1},
left = {'once', {'1,4'}, 1},
},
gazewalk = { --state for walking away from the camera
right = {'loop', {'2-3,4'}, 0.16},
left = {'loop', {'2-3,4'}, 0.16}
},
flyin = {'once', {'4,3'}, 1},
warp = {'once', {'1-4,1'}, 0.08}
}
}
|
insulate("Control function declaration", function()
local parser = require("snabbp4.syntax.parser")
local config = {preprocess = true}
local input = [[
control egress {
// Check for unknown egress state or bad retagging with mTag.
apply(egress_check);
apply(egress_meter) {
hit {
apply(hysteresis_check);
apply(meter_policy);
}
}
}
]]
local statements = parser.parse(input, config)
local control_function = statements[1]
it("should parse control function declaration node", function()
local node = control_function.node
assert.is_equal(node, "control_function_declaration")
end)
end)
|
-- shared logic file for map manager - don't call any subsystem-specific functions here
|
require("surround").setup {
context_offset = 100,
load_autogroups = false,
mappings_style = "sandwich",
map_insert_mode = true,
quotes = {"'", '"'},
brackets = {"(", '{', '['},
space_on_closing_char = false,
pairs = {
nestable = { b = { "(", ")" }, s = { "[", "]" }, B = { "{", "}" }, a = { "<", ">" } },
linear = { q = { "'", "'" }, t = { "`", "`" }, d = { '"', '"' }
},
prefix = "s",
}
}
|
AddCSLuaFile()
local name = "Whelen 600"
local COMPONENT = {}
COMPONENT.Model = "models/noble/whelen_600/whelen_600.mdl"
COMPONENT.Skin = 0
COMPONENT.Bodygroups = {}
COMPONENT.NotLegacy = true
COMPONENT.ColorInput = 1
COMPONENT.UsePhases = true
COMPONENT.DefaultColors = {
[1] = "WHITE"
}
COMPONENT.Meta = {
whelen600_light = {
AngleOffset = 0,
W = 9.1,
H = 9.1,
Sprite = "sprites/emv/emv_whelen_600",
Scale = 2,
NoLegacy = true,
DirAxis = "Up",
DirOffset = 90,
WMult = 1.5
}
}
COMPONENT.Positions = {
[1] = { Vector( 1.3, -.1, 3.15 ), Angle( 0, -90, 0 ), "whelen600_light" }
}
COMPONENT.Sections = {
["light_main"] = {
[1] = {
{ 1, "_1"}
}
}
}
COMPONENT.Patterns = {
["light_main"] = {
["code1"] = { 1, 1, 1, 0, 0, 0 },
["code2"] = { 1, 1, 0, 0 },
["code3"] = { 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0 },
["code1A"] = { 0, 0, 0, 1, 1, 1 },
["code2A"] = { 0, 0, 1, 1 },
["code3A"] = { 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0 },
["code1FDNY"] = { 1, 1, 0, 0 },
["code2FDNY"] = { 1, 0, 0 },
["code3FDNY"] = { 1, 0, 0 },
["code1FDNY2"] = { 0, 1, 1, 0 },
["code2FDNY2"] = { 0, 1, 0 },
["code3FDNY2"] = { 0, 1, 0 },
["code1FDNY3"] = { 0, 0, 1, 1 },
["code2FDNY3"] = { 0, 1, 0 },
["code3FDNY3"] = { 0, 1, 0 }
},
}
COMPONENT.TrafficDisconnect = {}
COMPONENT.Modes = {
Primary = {
M1 = { ["light_main"] = "code1" },
M2 = { ["light_main"] = "code2" },
M3 = { ["light_main"] = "code3" }
},
Auxiliary = {
L = {},
R = {},
D = {}
}
}
EMVU:AddAutoComponent( COMPONENT, name )
|
local runService = game:GetService("RunService")
local packages = script.Parent.Parent.Parent
local synthetic = require(script.Parent.Parent)
local util = require(script.Parent.Parent:WaitForChild("Util"))
local fusion = util.initFusion(require(packages:WaitForChild('fusion')))
local maidConstructor = require(packages:WaitForChild('maid'))
local typographyConstructor = require(packages:WaitForChild('typography'))
local enums = require(script.Parent.Parent:WaitForChild("Enums"))
local effects = require(script.Parent.Parent:WaitForChild("Effects"))
local constructor = {}
function constructor.new(params)
local inst
--[=[
@class Switch
@tag Component
@tag Molecule
A basic [switch](https://material.io/components/switches).
]=]
--public states
local public = {}
--[=[
@prop Color Color3 | FusionState | nil
Color used for activated state
@within Switch
]=]
public.Color = util.import(params.Color) or fusion.State(Color3.new(0.5,0,1))
--[=[
@prop BackgroundColor Color3 | FusionState | nil
Color used for off state
@within Switch
]=]
public.BackgroundColor = util.import(params.BackgroundColor) or fusion.State(Color3.new(0.5,0.5,0.5))
--[=[
@prop Input bool | FusionState | nil
Whether the switch is on or off
@within Switch
]=]
public.Input = util.import(params.Input) or fusion.State(false)
--[=[
@prop Typography Typography | FusionState | nil
The Typography to be used for this component
@within Switch
]=]
public.Typography = util.import(params.Typography) or typographyConstructor.new(Enum.Font.SourceSans, 10, 14)
local _Input = fusion.Computed(function()
if public.Input:get() == true then
return 1
else
return 0
end
end)
--[=[
@prop Value bool
Whether the switch is on or off
@within Switch
@readonly
]=]
--[=[
@prop SynthClassName string
Attribute used to identify what type of component it is
@within Switch
@readonly
]=]
public.SynthClassName = fusion.Computed(function()
return script.Name
end)
--influencers
local _Hovered = fusion.State(false)
local _Clicked = fusion.State(false)
--properties
local _Padding, _TextSize, _Font = util.getTypographyStates(public.Typography)
_Padding = fusion.Computed(function()
local pad = public.Typography:get().Padding
return UDim.new(pad.Scale, pad.Offset*0.5)
end)
--constructor
inst = util.set(synthetic.New "ProgressBar", public, params, {
[fusion.OnEvent "Activated"] = function(x,y)
-- local absPos = Vector2.new(x,y)
local knob = inst:FindFirstChild("Knob")
local knobColor = fusion.State(knob.BackgroundColor3)
local function getPos()
local v2 = knob.AbsolutePosition + knob.AbsoluteSize*0.5
return UDim2.fromOffset(v2.X, v2.Y)
end
local position = fusion.State(getPos())
effects.ripple(position, knobColor)
effects.sound("ui_tap-variant-01")
local rippleMaid = maidConstructor.new()
rippleMaid:GiveTask(runService.RenderStepped:Connect(function(delta)
position:set(getPos())
knobColor:set(knob.BackgroundColor3)
end))
task.delay(1, function()
rippleMaid:Destroy()
end)
public.Input:set(not public.Input:get())
end,
[fusion.OnEvent "InputBegan"] = function()
_Hovered:set(true)
end,
[fusion.OnEvent "InputEnded"] = function()
_Hovered:set(false)
_Clicked:set(false)
end,
Size = fusion.Computed(function()
local height = _TextSize:get() + _Padding:get().Offset*2
return UDim2.fromOffset(height*1.85, height)
end),
Color = util.getInteractionColor(_Clicked, _Hovered, public.Color),
BackgroundColor = util.getInteractionColor(_Clicked, _Hovered, public.BackgroundColor),
Notches = 2,
Alpha = _Input,
KnobEnabled = true,
BarPadding = _Padding,
Padding = _Padding,
})
public.Value = fusion.Computed(function()
return public.Input:get()
end)
return inst
end
return constructor
|
local bin = vim.fn.stdpath("data") .. "/lspinstall/lua/sumneko-lua-language-server"
local server = vim.fn.stdpath("data") .. "/lspinstall/lua/sumneko-lua/extension/server/"
local lsp_config = require("lsp")
if vim.fn.filereadable(bin) == 0 then require("lspinstall").install_server("lua") end
require'lspconfig'.sumneko_lua.setup {
cmd = { bin },
settings = {
Lua = {
runtime = { version = 'LuaJIT', path = vim.split(package.path, ';') },
diagnostics = { globals = { 'vim' } },
workspace = { library = { [vim.fn.expand('$VIMRUNTIME/lua')] = true, [vim.fn.expand('$VIMRUNTIME/lua/vim/lsp')] = true }, maxPreload = 10000 }
}
},
on_attach = lsp_config.common_on_attach
}
local os = ""
local ext = ""
if vim.fn.has('win64') == 1 or vim.fn.has('win32') == 1 or vim.fn.has('win16') == 1 then
os = "WINDOWS"
ext = ".exe"
else
os = vim.fn.toupper(vim.fn.substitute(vim.fn.system("uname"), '\n', '', ''))
end
local os_table = { WINDOWS = "Windows", CYGWIN = "Windows", MINGW = "Windows", LINUX = "Linux", DARWIN = "macOS" }
os = os_table[os]
require('nlua.lsp.nvim').setup(require('lspconfig'), {
cmd = { server .. "bin/" .. os .. "/lua-language-server" .. ext, "-E", server .. "main.lua" },
globals = { "Color", "c", "Group", "g", "s" }
})
|
local K, C, L = unpack(select(2, ...))
local oUF = oUF or K.oUF
if not oUF then
K.Print("Could not find a vaild instance of oUF. Tags.lua code!")
return
end
local _G = _G
local ALTERNATE_POWER_INDEX = Enum.PowerType.Alternate or 10
local CHAT_MSG_AFK = _G.CHAT_MSG_AFK
local DEAD = _G.DEAD
local DND = _G.DND
local GetCreatureDifficultyColor = _G.GetCreatureDifficultyColor
local GetNumArenaOpponentSpecs = _G.GetNumArenaOpponentSpecs
local HEALER = _G.HEALER
local PLAYER_OFFLINE = _G.PLAYER_OFFLINE
local TANK = _G.TANK
local UNKNOWN = _G.UNKNOWN
local UnitBattlePetLevel = _G.UnitBattlePetLevel
local UnitClass = _G.UnitClass
local UnitClassification = _G.UnitClassification
local UnitEffectiveLevel = _G.UnitEffectiveLevel
local UnitGroupRolesAssigned = _G.UnitGroupRolesAssigned
local UnitHasVehicleUI = _G.UnitHasVehicleUI
local UnitHealth = _G.UnitHealth
local UnitHealthMax = _G.UnitHealthMax
local UnitIsAFK = _G.UnitIsAFK
local UnitIsBattlePetCompanion = _G.UnitIsBattlePetCompanion
local UnitIsConnected = _G.UnitIsConnected
local UnitIsDND = _G.UnitIsDND
local UnitIsDead = _G.UnitIsDead
local UnitIsDeadOrGhost = _G.UnitIsDeadOrGhost
local UnitIsGhost = _G.UnitIsGhost
local UnitIsGroupAssistant = _G.UnitIsGroupAssistant
local UnitIsGroupLeader = _G.UnitIsGroupLeader
local UnitIsPlayer = _G.UnitIsPlayer
local UnitIsRaidOfficer = _G.UnitIsRaidOfficer
local UnitIsTapDenied = _G.UnitIsTapDenied
local UnitIsWildBattlePet = _G.UnitIsWildBattlePet
local UnitLevel = _G.UnitLevel
local UnitPower = _G.UnitPower
local UnitPowerType = _G.UnitPowerType
local UnitReaction = _G.UnitReaction
local UnitStagger = _G.UnitStagger
local function ColorPercent(value)
local r, g, b
if value < 20 then
r, g, b = 1, 0.1, 0.1
elseif value < 35 then
r, g, b = 1, 0.5, 0
elseif value < 80 then
r, g, b = 1, 0.9, 0.3
else
r, g, b = 1, 1, 1
end
return K.RGBToHex(r, g, b)..value
end
local function ValueAndPercent(cur, per)
if per < 100 then
return K.ShortValue(cur).." - "..ColorPercent(per)
else
return K.ShortValue(cur)
end
end
oUF.Tags.Methods["hp"] = function(unit)
if UnitIsDeadOrGhost(unit) or not UnitIsConnected(unit) then
return oUF.Tags.Methods["DDG"](unit)
else
local per = oUF.Tags.Methods["perhp"](unit) or 0
local cur = UnitHealth(unit)
if (unit == "player" and not UnitHasVehicleUI(unit)) or unit == "target" or unit == "focus" or string.find(unit, "party") then
return ValueAndPercent(cur, per)
else
return ColorPercent(per)
end
end
end
oUF.Tags.Events["hp"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_NAME_UPDATE UNIT_CONNECTION PLAYER_FLAGS_CHANGED"
oUF.Tags.Methods["power"] = function(unit)
local cur = UnitPower(unit)
local per = oUF.Tags.Methods["perpp"](unit) or 0
if (unit == "player" and not UnitHasVehicleUI(unit)) or unit == "target" or unit == "focus" then
if per < 100 and UnitPowerType(unit) == 0 then
return K.ShortValue(cur).." - "..per
else
return K.ShortValue(cur)
end
else
return per
end
end
oUF.Tags.Events["power"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER UNIT_DISPLAYPOWER"
oUF.Tags.Methods["color"] = function(unit)
local class = select(2, UnitClass(unit))
local reaction = UnitReaction(unit, "player")
if UnitIsDeadOrGhost(unit) or not UnitIsConnected(unit) then
return "|cffA0A0A0"
elseif UnitIsTapDenied(unit) then
return K.RGBToHex(oUF.colors.tapped)
elseif UnitIsPlayer(unit) then
return K.RGBToHex(K.Colors.class[class])
elseif reaction then
return K.RGBToHex(K.Colors.reaction[reaction])
else
return K.RGBToHex(1, 1, 1)
end
end
oUF.Tags.Events["color"] = "UNIT_HEALTH UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION PLAYER_FLAGS_CHANGED"
oUF.Tags.Methods["afkdnd"] = function(unit)
if UnitIsAFK(unit) then
return "|cffCFCFCF <"..CHAT_MSG_AFK..">|r"
elseif UnitIsDND(unit) then
return "|cffCFCFCF <"..DND..">|r"
else
return ""
end
end
oUF.Tags.Events["afkdnd"] = "PLAYER_FLAGS_CHANGED"
oUF.Tags.Methods["DDG"] = function(unit)
if UnitIsDead(unit) then
return "|cffCFCFCF"..DEAD.."|r"
elseif UnitIsGhost(unit) then
return "|cffCFCFCF"..L["Ghost"].."|r"
elseif not UnitIsConnected(unit) and GetNumArenaOpponentSpecs() == 0 then
return "|cffCFCFCF"..PLAYER_OFFLINE.."|r"
end
end
oUF.Tags.Events["DDG"] = "UNIT_HEALTH UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_NAME_UPDATE UNIT_CONNECTION UNIT_FLAGS PLAYER_FLAGS_CHANGED"
-- Level tags
oUF.Tags.Methods["fulllevel"] = function(unit)
if not UnitIsConnected(unit) then
return "??"
end
local realLevel = UnitLevel(unit)
local level = UnitEffectiveLevel(unit)
if UnitIsWildBattlePet(unit) or UnitIsBattlePetCompanion(unit) then
level = UnitBattlePetLevel(unit)
end
local color = K.RGBToHex(GetCreatureDifficultyColor(level))
local str
if level > 0 then
local realTag = level ~= realLevel and "*" or ""
str = color..level..realTag.."|r"
else
str = "|cffff0000??|r"
end
local class = UnitClassification(unit)
if class == "worldboss" then
str = "|cffAF5050Boss|r"
elseif class == "rareelite" then
str = str.."|cffAF5050R|r+"
elseif class == "elite" then
str = str.."|cffAF5050+|r"
elseif class == "rare" then
str = str.."|cffAF5050R|r"
end
return str
end
oUF.Tags.Events["fulllevel"] = "UNIT_LEVEL PLAYER_LEVEL_UP UNIT_CLASSIFICATION_CHANGED"
-- RaidFrame tags
oUF.Tags.Methods["raidhp"] = function(unit)
if UnitIsDeadOrGhost(unit) or not UnitIsConnected(unit) then
return oUF.Tags.Methods["DDG"](unit)
elseif C["Raid"].HealthFormat.Value == 2 then
local per = oUF.Tags.Methods["perhp"](unit) or 0
return ColorPercent(per)
elseif C["Raid"].HealthFormat.Value == 3 then
local cur = UnitHealth(unit)
return K.ShortValue(cur)
elseif C["Raid"].HealthFormat.Value == 4 then
local loss = UnitHealthMax(unit) - UnitHealth(unit)
if loss == 0 then return end
return K.ShortValue(loss)
end
end
oUF.Tags.Events["raidhp"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_NAME_UPDATE UNIT_CONNECTION PLAYER_FLAGS_CHANGED"
-- Nameplate tags
oUF.Tags.Methods["nphp"] = function(unit)
local per = oUF.Tags.Methods["perhp"](unit) or 0
if C["Nameplate"].FullHealth then
local cur = UnitHealth(unit)
return ValueAndPercent(cur, per)
elseif per < 100 then
return ColorPercent(per)
end
end
oUF.Tags.Events["nphp"] = "UNIT_HEALTH_FREQUENT UNIT_MAXHEALTH UNIT_CONNECTION"
oUF.Tags.Methods["nppp"] = function(unit)
local per = oUF.Tags.Methods["perpp"](unit)
local color
if per > 85 then
color = K.RGBToHex(1, .1, .1)
elseif per > 50 then
color = K.RGBToHex(1, 1, .1)
else
color = K.RGBToHex(.8, .8, 1)
end
per = color..per.."|r"
return per
end
oUF.Tags.Events["nppp"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER"
oUF.Tags.Methods["nplevel"] = function(unit)
local level = UnitLevel(unit)
if level and level ~= UnitLevel("player") then
if level > 0 then
level = K.RGBToHex(GetCreatureDifficultyColor(level))..level.."|r "
else
level = "|cffff0000??|r "
end
else
level = ""
end
return level
end
oUF.Tags.Events["nplevel"] = "UNIT_LEVEL PLAYER_LEVEL_UP UNIT_CLASSIFICATION_CHANGED"
oUF.Tags.Methods["pppower"] = function(unit)
local cur = UnitPower(unit)
local per = oUF.Tags.Methods["perpp"](unit) or 0
if UnitPowerType(unit) == 0 then
return per
else
return cur
end
end
oUF.Tags.Events["pppower"] = "UNIT_POWER_FREQUENT UNIT_MAXPOWER UNIT_DISPLAYPOWER"
-- AltPower value tag
oUF.Tags.Methods["altpower"] = function(unit)
local cur = UnitPower(unit, ALTERNATE_POWER_INDEX)
if cur > 0 then
local _, r, g, b = UnitAlternatePowerTextureInfo(unit, 2)
if not r then
r, g, b = 1, 1, 1
end
return K.RGBToHex(r, g, b)..cur
else
return nil
end
end
oUF.Tags.Events["altpower"] = "UNIT_POWER_UPDATE UNIT_POWER_BAR_SHOW UNIT_POWER_BAR_HIDE"
-- Monk stagger
oUF.Tags.Methods["monkstagger"] = function(unit)
if unit ~= "player" or K.Class ~= "MONK" then
return
end
local cur = UnitStagger(unit) or 0
local perc = cur / UnitHealthMax(unit)
if cur == 0 then
return
end
return K.ShortValue(cur).." - "..K.MyClassColor..K.Round(perc * 100).."%"
end
oUF.Tags.Events["monkstagger"] = "UNIT_MAXHEALTH UNIT_AURA"
oUF.Tags.Methods["leadassist"] = function(unit)
local IsLeader = UnitIsGroupLeader(unit)
local IsAssistant = UnitIsGroupAssistant(unit) or UnitIsRaidOfficer(unit)
local Assist, Lead = IsAssistant and "|cffffd100[A]|r " or "", IsLeader and "|cffffd100[L]|r " or ""
return (Lead..Assist)
end
oUF.Tags.Events["leadassist"] = "UNIT_NAME_UPDATE PARTY_LEADER_CHANGED GROUP_ROSTER_UPDATE"
oUF.Tags.Methods["lfdrole"] = function(unit)
local role = UnitGroupRolesAssigned(unit)
local roleString = ""
local IsTank = TANK or UNKNOWN
local IsHealer = HEALER or UNKNOWN
local Tank, Healer = IsTank and "|cff0099CC[T]|r " or "", IsHealer and "|cff00FF00[H]|r " or ""
if (role == "TANK") then
roleString = Tank
elseif (role == "HEALER") then
roleString = Healer
end
return roleString
end
oUF.Tags.Events["lfdrole"] = "UNIT_NAME_UPDATE PLAYER_ROLES_ASSIGNED GROUP_ROSTER_UPDATE"
|
local main = require(game.Nanoblox)
local Args = {}
-- ARRAY
Args.array = {
-----------------------------------
{
name = "player",
aliases = {},
description = "",
defaultValue = 0,
playerArg = true,
parse = function(self, qualifiers)
local targetsDict = {}
for qualifierName, qualifierArgs in pairs(qualifiers or {}) do
local targets = main.modules.Qualifiers.dictionary[qualifierName]
for _, plr in pairs(targets) do
targetsDict[plr] = true
end
end
local players = {}
for plr, _ in pairs(targetsDict) do
table.insert(players, plr)
end
return players
end,
};
-----------------------------------
{
name = "players",
aliases = {},
description = "",
defaultValue = 0,
playerArg = true,
parse = function(self, qualifiers)
return main.modules.Args.dictionary.player:parse(qualifiers)
end,
};
-----------------------------------
{
name = "optionalplayers",
aliases = {},
description = "Hides the players argument for general use and only displays it within the preview menu.",
defaultValue = 0,
playerArg = true,
hidden = true,
parse = function(self, qualifiers)
if qualifiers == nil then
return main.Players:GetPlayers()
end
local qualifierPresent = false
for k,v in pairs(self.qualifiers) do
qualifierPresent = true
end
if not qualifierPresent then
return main.Players:GetPlayers()
end
return main.modules.Args.dictionary.player:parse(qualifiers)
end,
};
-----------------------------------
{
-- Consider filters for specific players or broadcast
name = "text",
aliases = {"string", "reason", "question", "teamname"},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "code",
aliases = {"lua"},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "number",
aliases = {"integer", "studs", "speed", "intensity"},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "degrees",
aliases = {},
description = "",
defaultValue = 180,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "role",
aliases = {},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "color",
aliases = {"colour", "color3", "uigradient", "colorgradient", "gradient"},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "bool",
aliases = {"boolean", "trueOrFalse", "yesOrNo"},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "stat",
aliases = {"statName"},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "scale", -- Consider scale limits
aliases = {},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "gearId", -- Consider gear limits
aliases = {},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "user",
aliases = {"username", "userid", "playerid", "playername"},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "team",
aliases = {},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "teamcolor",
aliases = {},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "material",
aliases = {},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "tool",
aliases = {"gear", "item"},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
{
name = "morph",
aliases = {},
description = "",
defaultValue = 0,
parse = function(self, stringToParse)
end,
};
-----------------------------------
};
-- DICTIONARY
-- This means instead of scanning through the array to find a name match
-- you can simply do ``Args.dictionary.ARGUMENT_NAME`` to return its item
Args.dictionary = {}
for _, item in pairs(Args.array) do
Args.dictionary[item.name] = item
for _, alias in pairs(item.aliases) do
Args.dictionary[alias] = item
end
end
-- SORTED ARRAY(S)
Args.playerArgsWithoutHiddenDictionary = {}
for _, item in pairs(Args.array) do
if item.playerArg and not item.hidden then
Args.playerArgsWithoutHiddenDictionary[item.name] = true
end
end
return Args
|
modifier_zabuza_slow = class({})
--------------------------------------------------------------------------------
-- Classifications
function modifier_zabuza_slow:IsHidden()
return false
end
function modifier_zabuza_slow:IsDebuff()
return true
end
function modifier_zabuza_slow:IsStunDebuff()
return false
end
function modifier_zabuza_slow:IsPurgable()
return true
end
--------------------------------------------------------------------------------
-- Initializations
function modifier_zabuza_slow:OnCreated( kv )
-- references
self.caster = self:GetCaster()
self.slow_percent = self:GetAbility():GetSpecialValueFor( "ms_slow_start" )
end
function modifier_zabuza_slow:OnRefresh( kv )
self:OnCreated( kv )
end
function modifier_zabuza_slow:OnRemoved()
end
function modifier_zabuza_slow:OnDestroy()
end
--------------------------------------------------------------------------------
-- Modifier Effects
function modifier_zabuza_slow:DeclareFunctions()
local funcs = {
MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE ,
}
return funcs
end
function modifier_zabuza_slow:GetModifierMoveSpeedBonus_Percentage()
return -1 * self.slow_percent
end
--------------------------------------------------------------------------------
-- Status Effects
function modifier_zabuza_slow:CheckState()
local state = { }
return state
end
--------------------------------------------------------------------------------
-- Graphics & Animations
--[[function modifier_zabuza_slow:GetStatusEffectName()
return "particles/units/heroes/onoki/onoki_turn_to_stone.vpcf"
end
--------------------------------------------------------------------------------
function modifier_zabuza_slow:StatusEffectPriority()
return 1000
end
--------------------------------------------------------------------------------
function modifier_zabuza_slow:GetEffectName()
return "particles/units/heroes/onoki/onoki_speed_debuff.vpcf"
end
function modifier_zabuza_slow:GetEffectAttachType()
return PATTACH_ABSORIGIN_FOLLOW
end]]
|
local status_ok, comment = pcall(require, 'Comment')
if not status_ok then
print('Could not load Comment.nvim')
return
end
comment.setup({
pre_hook = function(ctx)
local U = require('Comment.utils')
local location = nil
if ctx.ctype == U.ctype.block then
location = require('ts_context_commentstring.utils').get_cursor_location()
elseif ctx.cmotion == U.cmotion.v or ctx.cmotion == U.cmotion.V then
location = require('ts_context_commentstring.utils').get_visual_start_location()
end
return require('ts_context_commentstring.internal').calculate_commentstring({
key = ctx.ctype == U.ctype.line and '__default' or '__multiline',
location = location,
})
end,
})
nnoremap('<C-_><C-_>', '<CMD>lua require("Comment.api").toggle_current_linewise()<CR>')
xnoremap('<C-_><C-_>', '<ESC><CMD>lua require("Comment.api").toggle_linewise_op(vim.fn.visualmode())<CR>')
|
local FORMNAME = "epic_view"
epic.form.epic_view = function(pos, playername)
local meta = minetest.get_meta(pos)
local name = meta:get_string("name")
local formspec = "size[8,2;]" ..
"label[0,0;Epic start block]" ..
"label[0,1;" .. name .. "]" ..
"button_exit[5.5,1;2,1;start;Start]"
minetest.show_formspec(playername,
FORMNAME .. ";" .. minetest.pos_to_string(pos),
formspec
)
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
local parts = formname:split(";")
local name = parts[1]
if name ~= FORMNAME then
return
end
local pos = minetest.string_to_pos(parts[2])
if fields.start then
epic.start(player:get_player_name(), pos)
end
end)
|
local Name=game.Players.LocalPlayer.Name
local player=game.Players[Name]
local char=player.Character
local Suit=false
local Tag=Instance.new("ObjectValue")
Tag.Name="creator"
Tag.Value=player
local Welds={}
if script.Parent.className~="HopperBin" then
local h=Instance.new("HopperBin")
h.Name="Gold rush"
h.Parent=player.Backpack
script.Parent=h
end
pcall(function() char.Sword:remove() end)
pcall(function() char.Sheath:remove() end)
pcall(function() char.Suit:remove() end)
local m=Instance.new("Model")
m.Name="Sword"
m.Parent=char
local otherm=Instance.new("Model")
otherm.Name="Sheath"
otherm.Parent=char
--SWORD--
local p=Instance.new("Part")
p.Size=Vector3.new(1,3,1)
p.BrickColor = BrickColor.new("Gold")
p.Reflectance=0.4
p.CanCollide=false
p.Parent=m
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.4,1.2,0.2)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=char.Torso
w.C0=CFrame.new(0,0,0.65)*CFrame.Angles(0,0,math.rad(150))
w.C1=CFrame.new(0,0.25,0)
local HoldWeld=w
local Blade=p
Welds["MAIN"]=HoldWeld
local p=Instance.new("Part")
p.Size=Vector3.new(1,3,1)
p.BrickColor = BrickColor.new("Silver")
p.Parent=m
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.02,1,0.21)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Blade
w.C0=CFrame.new(0,-.2,0)
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor=BrickColor.new("Silver")
p.Parent=m
p.Reflectance=0.4
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.6,.2,.3)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Blade
w.C0=CFrame.new(0,-1.45,0)
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor=BrickColor.new("Silver")
p.Parent=m
p.Reflectance=0.4
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.4,.2,.3)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Blade
w.C0=CFrame.new(0.4,-1.37,0)*CFrame.Angles(0,0,math.rad(30))
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor=BrickColor.new("Silver")
p.Parent=m
p.Reflectance=0.4
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.4,.2,.3)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Blade
w.C0=CFrame.new(-0.4,-1.37,0)*CFrame.Angles(0,0,math.rad(-30))
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor=BrickColor.new("Gold")
p.Parent=m
local mes=Instance.new("CylinderMesh")
mes.Parent=p
mes.Scale=Vector3.new(.2,1.25,.2)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Blade
w.C0=CFrame.new(0,-2,0)
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor = BrickColor.new("Silver")
p.Parent=m
p.Reflectance=0.4
local mes=Instance.new("CylinderMesh")
mes.Parent=p
mes.Scale=Vector3.new(.21,.1,.21)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Blade
w.C0=CFrame.new(0,-2.75,0)
for i=1,10 do
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor = BrickColor.new("Silver")
p.Parent=m
local mes=Instance.new("CylinderMesh")
mes.Parent=p
mes.Scale=Vector3.new(.21,.05,.21)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Blade
w.C0=CFrame.new(0,-2.7+.9*(i/9),0)
end
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor = BrickColor.new("Gold")
p.Parent=m
p.Reflectance=0.4
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(.28,.24,.205)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Blade
w.C0=CFrame.new(0,1.45,0)*CFrame.Angles(0,0,math.rad(-45))
local Tip=p
--/SWORD--
--SHEATH--
local p=Instance.new("Part")
p.Size=Vector3.new(1,3,1)
p.Reflectance=0.0
p.BrickColor = BrickColor.new("Silver")
p.Parent=otherm
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.6,1.2,0.3)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=char.Torso
w.C0=CFrame.new(0,0,0.65)*CFrame.Angles(0,0,math.rad(-30))
local Back=p
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor = BrickColor.new("Gold")
p.Parent=otherm
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.1,.25,0.31)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Back
w.C0=CFrame.new(-0.1,-1.5,0)*CFrame.Angles(0,0,math.rad(45))
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor = BrickColor.new("Gold")
p.Parent=otherm
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.1,.25,0.31)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Back
w.C0=CFrame.new(0.1,-1.5,0)*CFrame.Angles(0,0,math.rad(-45))
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor = BrickColor.new("Gold")
p.Parent=otherm
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.1,.25,0.31)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Back
w.C0=CFrame.new(-0.1,1.29,0)*CFrame.Angles(0,0,math.rad(-45))
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor = BrickColor.new("Gold")
p.Parent=otherm
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.1,.25,0.31)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Back
w.C0=CFrame.new(0.1,1.29,0)*CFrame.Angles(0,0,math.rad(45))
local p=Instance.new("Part")
p.Size=Vector3.new(1,3,1)
p.BrickColor = BrickColor.new("Gold")
p.Parent=otherm
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.1,1.25,0.32)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Back
w.C0=CFrame.new(0,-0.25/2.5,0)
local p=Instance.new("Part")
p.Size=Vector3.new(1,3,1)
p.BrickColor = BrickColor.new("Gold")
p.Parent=otherm
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.02,1.12,0.325)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Back
w.C0=CFrame.new(0,0,0)
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor = BrickColor.new("Gold")
p.Parent=otherm
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.1,.25,0.31)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Back
w.C0=CFrame.new(0.1,.25/2,0)*CFrame.Angles(0,0,math.rad(45))
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor = BrickColor.new("Gold")
p.Parent=otherm
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.1,.25,0.31)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Back
w.C0=CFrame.new(-0.1,.25/2,0)*CFrame.Angles(0,0,math.rad(-45))
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor = BrickColor.new("Gold")
p.Parent=otherm
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.1,.25,0.31)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Back
w.C0=CFrame.new(0.1,-.25/2,0)*CFrame.Angles(0,0,math.rad(-45))
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor = BrickColor.new("Gold")
p.Parent=otherm
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.1,.25,0.31)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Back
w.C0=CFrame.new(-0.1,-.25/2,0)*CFrame.Angles(0,0,math.rad(45))
local p=Instance.new("Part")
p.Size=Vector3.new(1,3,1)
p.BrickColor = BrickColor.new("Silver")
p.Parent=otherm
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(0.55,.5,0.25)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Back
w.C0=CFrame.new(0,.85,0)
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.BrickColor = BrickColor.new("Gold")
p.Parent=m
p.Reflectance=0.4
local mes=Instance.new("BlockMesh")
mes.Parent=p
mes.Scale=Vector3.new(.42,.35,.305)
local w=Instance.new("Weld")
w.Parent=p
w.Part1=p
w.Part0=Back
w.C0=CFrame.new(0,-1.45,0)*CFrame.Angles(0,0,math.rad(-45))
for _,v in pairs(otherm:children()) do
v.CanCollide=false
v.Locked=true
end
--/SHEATH--
b=Instance.new("IntValue")
b.Value=0
b.Parent=char.Sword
function Click()
if b.Value~=0 then
pcall(function() DCLICK:disconnect() end)
wait(0.25)
Button()
wait()
DCLICK=b.Changed:connect(Click)
end
end
DCLICK=b.Changed:connect(Click)
Arms={char.Torso["Left Shoulder"],char.Torso["Right Shoulder"]}
function Button(mouse)
if b.Value==1 then
local rw=Welds["rw"]
for i=0,0.7,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(math.rad(4.5), math.rad(-6),0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
wait()
for i=0,0.4,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(math.rad(-10),0,0)
rw.C0 = rw.C0*CFrame.new(0, 0.1, 0)
end
wait()
for i=0,0.4,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(math.rad(10),0,0)
rw.C0 = rw.C0*CFrame.new(0, -0.1, 0)
end
for i=0,0.9,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(math.rad(-4.5), math.rad(6),0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
rw.C0=OrgR0
rw.C1=OrgR1
b.Value=0
else
local rw=Welds["rw"]
for i=0,0.3,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(0,math.rad(6),0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
wait()
for i=0,1,0.5 do
wait()
rw.C1 = CFrame.new(1.5,0.5,0)*CFrame.fromEulerAnglesXYZ(math.rad(50)+math.rad(60)*i, 0,0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
for i=0,1,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(math.rad(-10), 0,0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
for i=0,0.3,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(math.rad(10), 0,0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
wait()
for i=0,0.3,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(0,math.rad(-6),0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
rw.C0=OrgR0
rw.C1=OrgR1
b.Value=0
end
end
function Charge()
local rw=Welds["rw"]
for i=0,1.2,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(math.rad(1), math.rad(6),math.rad(2))
rw.C0 = CFrame.new(0, 0.5, 0)
end
wait()
for i=1,6 do
wait()
local Laz=Instance.new("Part")
Laz.Anchored=false
Laz.BrickColor = BrickColor.new("Gold")
Laz.Reflectance=0
Laz.Shape="Ball"
Laz.Transparency=1-i/9
Laz.TopSurface="Smooth"
Laz.BottomSurface="Smooth"
Laz.CanCollide=false
Laz.Size=Vector3.new(1,1,1)
Laz.Parent=char.Sword
w=Instance.new("Weld")
w.Part1=Laz
w.Part0=Blade
w.Parent=Laz
local Me=Instance.new("SpecialMesh")
Me.MeshType="Sphere"
Me.Parent=Laz
for i=1,7,0.75 do
Me.Scale = Vector3.new(i/2.5,i,i/2.5)
wait()
end
Laz:remove()
end
end
function SHOCK()
Charge()
wait()
for i=0,0.7,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(math.rad(-10),0,0)
rw.C0 = rw.C0*CFrame.new(0, 0, 0)
end
for i=1,35 do
p=Instance.new("Part")
p.Size=Vector3.new(1,9,7)
p.Transparency=0.2
p.BrickColor = BrickColor.new("Gold")
p.Reflectance=0.1
p.CanCollide=true
p.Velocity=Vector3.new(9000,300,0)
p.Touched:connect(function(h)
if h.Parent~=char and h.Parent.Parent~=char then
h.Anchored=false
h:BreakJoints()
h.Velocity=(h.Position-char.Torso.Position).unit*-500
end
end)
p.TopSurface="Smooth"
p.BottomSurface="Smooth"
p.Anchored=true
p.Parent=char
p.CFrame=char.Torso.CFrame*CFrame.Angles(0,math.rad(90),0)*CFrame.new(6+i,0,0)
Delay(0,function()
local p=p
for i=3,10 do
p.Transparency=i/10
wait()
end
p:remove()
end)
wait()
end
for i=0,0.7,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(math.rad(10),0,0)
rw.C0 = rw.C0*CFrame.new(0, 0, 0)
end
wait()
for i=0,1.2,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(math.rad(-1), math.rad(-6),math.rad(-2))
rw.C0 = CFrame.new(0, 0.5, 0)
end
rw.C0=OrgR0
rw.C1=OrgR1
end
function GATE()
local rw=Welds["rw"]
for i=0,0.3,0.1 do
wait(0.06)
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(0,math.rad(6),0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
wait()
for i=0,2,0.5 do
wait(0.06)
rw.C1 = CFrame.new(1.5,0.5,0)*CFrame.fromEulerAnglesXYZ(math.rad(50)+math.rad(60)*i, 0,0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
wait()
local b=Instance.new("BodyPosition")
b.position=char.Torso.Position+Vector3.new(0,30,0)
b.maxForce=Vector3.new(200,999999999,200)
b.Parent=char.Torso
wait(0.75)
for i=0,2,0.5 do
wait(0.05)
local p=Blade:Clone()
p.Transparency=0.5
p.Reflectance=0
p.BrickColor = BrickColor.new("Gold")
p.Anchored=true
p.CanCollide=false
p.Parent=char
Delay(0.75,function() p:remove() end)
rw.C1 = CFrame.new(1.5,0.5,0)*CFrame.fromEulerAnglesXYZ(math.rad(50)+math.rad(-60)*i, 0,0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
b:remove()
function Check(d)
for _,v in pairs(game.Players:getPlayers()) do
if v.Name~=Name and v.Character and v.Character:findFirstChild("Torso") and (v.Character.Torso.Position-Star.Position).magnitude<d then
v.Character.Humanoid:TakeDamage(5)
v.Character.Humanoid.PlatformStand=true
v.Character.Torso.Velocity=(v.Character.Torso.Position-Star.Position).unit*120
end
end
end
wait(0.5)
Tor=Instance.new("Part")
Tor.Size=Vector3.new(1,1,1)
Tor.BrickColor = BrickColor.new("Gold")
Tor.Reflectance=0
Tor.Anchored=true
Tor.Transparency=1
Tor.CanCollide=false
Tor.Parent=char
Tor.TopSurface="Weld"
Star=Tor
Mesh=Instance.new("CylinderMesh")
Mesh.Parent=Tor
Mesh.Scale=Vector3.new(3,1.2,3)
Tor.CFrame=CFrame.new(char.Torso.Position.x,workspace.Base.Position.y,char.Torso.Position.z)
Delay(0.1,function()
for i=1,40 do
wait()
Mesh.Scale=Mesh.Scale+Vector3.new(1,0,1)
Star.Transparency=i/50
Dist=Mesh.Scale.x/2
Check(Dist)
end
Tor:remove()
end)
for i=0,0.3,0.1 do
wait(0.06)
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(0,math.rad(-6),0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
rw.C0=OrgR0
rw.C1=OrgR1
end
function GHOST()
--Use animation for the bustersword shooting projectile
--When landed, become minor blackhole, sucking people in w/ minor damage
--when done, explode into spikey explosion =D Massive damage
end
function PORT(mouse)
local mouset=mouse.Target
local mouseh=mouse.Hit
if mouset then
local Laz=Instance.new("Part")
Laz.Anchored=false
Laz.BrickColor = BrickColor.new("Gold")
Laz.Reflectance=0
Laz.Transparency=1
Laz.Shape="Ball"
Laz.TopSurface="Smooth"
Laz.BottomSurface="Smooth"
Laz.CanCollide=false
Laz.Size=Vector3.new(1,1,1)
Laz.CFrame=char.Torso.CFrame
Laz.Parent=char.Torso
Laz.Transparency=1
w = Instance.new("Weld")
w.Parent = Laz
w.Part0 = w.Parent
w.Part1 = char.Torso
w.C0 = CFrame.new(0,0,0)
local Me=Instance.new("SpecialMesh")
Me.MeshType="Sphere"
Me.Scale=Vector3.new(15,15,15)
Me.Parent=Laz
for i=1,20 do
Me.Scale=Me.Scale+Vector3.new(-0.5,-0.5,-0.5)
Laz.Transparency=Laz.Transparency-1/20
wait()
end
char.Torso.CFrame=mouseh*CFrame.new(0,5,0)
for i=1,20 do
Me.Scale=Me.Scale+Vector3.new(0.5,0.5,0.5)
Laz.Transparency=i/20
wait()
end
Laz:remove()
end
end
function RUSH()
local rw=Welds["rw"]
for i=0,0.3,0.1 do
wait(0.06)
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(0,math.rad(6),0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
wait()
for i=0,0.9,0.05 do
wait()
rw.C1 = CFrame.new(1.5,0.5,0)*CFrame.fromEulerAnglesXYZ(math.rad(50)+math.rad(-60)*(i/1), 0,0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
wait()
local p=Instance.new("Part")
p.Locked=true
p.BrickColor = BrickColor.new("Gold")
p.Name="Lan"
p.CanCollide=false
p.Touched:connect(function(h)
if h.Parent~=char and h.Parent.Parent~=char and h.Name~="Base" then
h.Anchored=false
h:BreakJoints()
h.Velocity=(h.Position-char.Torso.Position).unit*500
end
end)
p.Size=Vector3.new(1,6,1)
Mesh=Instance.new("SpecialMesh")
Mesh.MeshType="FileMesh"
Mesh.Scale=Vector3.new(0.7,7.3,0.7)
Mesh.MeshId="http://roblox.com/asset/?id=1033714"
Mesh.Parent=p
p.Parent=char
w=Instance.new("Weld")
w.Part1=Blade
w.Part0=p
w.Parent=p
w.C0=CFrame.new(0,1,0)
local b=Instance.new("BodyVelocity")
b.maxForce = Vector3.new(math.huge,math.huge,math.huge)
b.velocity=char.Torso.CFrame.lookVector*65
b.Parent=char.Torso
for i=1,20 do
b.velocity=char.Torso.CFrame.lookVector*65
local Blue=p:clone()
Blue.CanCollide=false
Blue.Anchored=true
Blue.CFrame=p.CFrame
Blue.BrickColor = BrickColor.new("Gold")
Blue.Parent=char
Delay(0,function()
local Blue=Blue
for i=1,5 do
Blue.Transparency=Blue.Transparency+1/20
wait()
end
Blue:remove()
end)
wait()
end
wait(0.05)
p:remove()
b:remove()
wait()
for i=0,0.2,0.05 do
wait()
rw.C1 = CFrame.new(1.5,0.5,0)*CFrame.fromEulerAnglesXYZ(math.rad(50)+math.rad(60)*(i/1), 0,0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
for i=0,0.3,0.1 do
wait(0.06)
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(0,math.rad(-6),0)
rw.C0 = CFrame.new(0, 0.5, 0)
end
rw.C0=OrgR0
rw.C1=OrgR1
end
function NUKE()
Charge()
for i=0,0.7,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(math.rad(-10),0,0)
rw.C0 = rw.C0*CFrame.new(0, 0, 0)
end
local Laz=Instance.new("Part")
Laz.Anchored=false
Laz.BrickColor=BrickColor:Blue()
Laz.Reflectance=0
Laz.Transparency=1
Laz.Shape="Ball"
Laz.TopSurface="Smooth"
Laz.BottomSurface="Smooth"
Laz.CanCollide=false
Laz.Size=Vector3.new(1,1,1)
Laz.CFrame=char.Torso.CFrame
Laz.Parent=char.Torso
Laz.Transparency=1
w = Instance.new("Weld")
w.Parent = Laz
w.Part0 = w.Parent
w.Part1 = char.Torso
w.C0 = CFrame.new(0,0,0)
local Me=Instance.new("SpecialMesh")
Me.MeshType="Sphere"
Me.Scale=Vector3.new(25,25,25)
Me.Parent=Laz
for i=1,35 do
Me.Scale=Me.Scale+Vector3.new(-0.5,-0.5,-0.5)
Laz.Transparency=Laz.Transparency-1/35
wait()
end
Laz:remove()
local e=Instance.new("Explosion")
e.BlastRadius=22
e.BlastPressure=0
e.Position=char.Torso.Position
e.Hit:connect(function(p)
if p.Parent~=char and p.Parent.Parent~=char then
p.Anchored=false
p:BreakJoints()
p.Velocity=(p.Position-e.Position).unit*200
end
end)
e.Parent=char
for i=0,0.7,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(math.rad(10),0,0)
rw.C0 = rw.C0*CFrame.new(0, 0, 0)
end
wait()
for i=0,1.2,0.1 do
wait()
rw.C1 = rw.C1*CFrame.fromEulerAnglesXYZ(math.rad(-1), math.rad(-6),math.rad(-2))
rw.C0 = CFrame.new(0, 0.5, 0)
end
rw.C0=OrgR0
rw.C1=OrgR1
end
De=0
Equip=false
function EQUIP(mouse)
if De==0 then
Equip=true
De=1
--pcall(function() game["LocalBackpack"]:children()[1]:remove() end)
rs=char.Torso["Right Shoulder"]
p1=rs.Part1
p0=rs.Part0
rs.Part0=nil
rw=Instance.new("Weld")
rw.Parent=char
rw.Part1=char.Torso
rw.Part0=char["Right Arm"]
rw.C1=CFrame.new(1.5,0,0)*CFrame.Angles(0,0,0)
R1=rw.C1
R0=rw.C0
Arms["rw"]=rw
Welds["rw"]=rw
Weld=Welds["MAIN"]
for i=0,1,0.1 do
wait(0.05)
rw.C1 = CFrame.new(1.5,0.5,0)*CFrame.fromEulerAnglesXYZ(math.rad(270)*i, i,-i)
rw.C0 = CFrame.new(0, 0.5, 0)
end
pcall(function() Weld.Part0=char["Right Arm"]
Weld.C0=CFrame.new(0,-1.1,-2.35)*CFrame.Angles(math.rad(90),math.rad(90),math.rad(180))
Connec=Blade.Touched:connect(function(h)
if h.Parent and h.Parent:findFirstChild("Humanoid") and not h.Parent:findFirstChild("Ice") and h.Parent.Name~=Name then
Tag:clone().Parent=h.Parent.Humanoid
h.Parent.Torso.Name="Ice"
h.Parent.Ice.Anchored=true
local i=Instance.new("Part")
i.Parent=h.Parent
i.Size=Vector3.new(5,7,5)
i.TopSurface="Smooth"
i.BottomSurface="Smooth"
i.Anchored=true
i.CFrame=h.Parent.Ice.CFrame
i.BrickColor=BrickColor:Blue()
i.Reflectance=0.4
i.Transparency=0.5
end
end)
end)
for i=0,1,0.5 do
wait(0.05)
rw.C1 = CFrame.new(1.5,0.5,0) * CFrame.fromEulerAnglesXYZ(math.rad(135)-math.rad(67.5)*i, 0, math.rad(45-22.5*i))
rw.C0 = CFrame.new(0, 0.5, 0) * CFrame.fromEulerAnglesXYZ(0,0,0)
end
wait()
for i=0,1,0.25 do
rw.C1=rw.C1*CFrame.Angles(math.rad(-3.5),math.rad(-2),math.rad(-6))
wait(0.05)
end
Delay(0,function()
while Equip==true do
wait(0.08)
local p=Instance.new("Part")
p.Size=Vector3.new(1,1,1)
p.Reflectance=0.3
p.BrickColor=BrickColor:Blue()
p.Anchored=true
p.CanCollide=false
p.Parent=char
p.CFrame=Blade.CFrame*CFrame.new(math.random(-1,1)*math.random(),math.random(-2,2)*math.random(),math.random(-1,1)*math.random())*CFrame.Angles(math.random(-360,360),math.random(-360,360),math.random(-360,360))
local m=Instance.new("BlockMesh")
m.Scale=Vector3.new(0.15,0.15,0.15)
m.Parent=p
Delay(0,function()
local p=p
for i=1,3 do
wait(0.05)
p.Transparency=i/3
end
p:remove()
end)
end
end)
OrgR0=rw.C0
OrgR1=rw.C1
local rw=rw
mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function() b.Value=b.Value+1 end)
Attack=false
mouse.KeyDown:connect(function(key)
if Attack==false then
if key=="q" then
Attack=true
SHOCK()
Attack=false
elseif key=="e" then
Attack=true
GATE()
Attack=false
elseif key=="r" then
Attack=true
RUSH()
Attack=false
elseif key=="t" then
Attack=true
GHOST()
Attack=false
elseif key=="y" then
Attack=true
PORT(mouse)
Attack=false
elseif key=="u" then
Attack=true
NUKE()
Attack=false
end
end
end)
wait()
De=0
end
end
--setfenv(EQUIP,getfenv(0))
script.Parent.Selected:connect(function(mouse)
EQUIP(mouse)
end)
script.Parent.Deselected:connect(function()
if Equip == false then
return
end
Equip=false
for i=0,1,0.1 do
rw.C1=rw.C1*CFrame.Angles(math.rad(17),math.rad(8),math.rad(4))
wait(0.04)
end
Welds["MAIN"].Part0=char.Torso
Welds["MAIN"].C0=CFrame.new(0,0,0.65)*CFrame.Angles(0,0,math.rad(150))
Welds["MAIN"].C1=CFrame.new(0,0.25,0)
Connec:disconnect()
for i=0,1,0.1 do
rw.C1=rw.C1*CFrame.Angles(math.rad(-19),math.rad(-3),math.rad(-6))
wait()
end
pcall(function()
rs.Part0=p0
rs.Part1=p1
rs.Parent=char.Torso
rw:remove()
end)
end)
--Suit--
if Suit then
color=BrickColor:Blue()
color2=BrickColor.new("Gold")
pcall(function() char.Suit:remove() end)
model = Instance.new("Model")
model.Parent = char
model.Name = "Suit"
Tors=Instance.new("Part")
Tors.Size=char.Torso.Size
Tors.BrickColor=color
Tors.Reflectance=0.75
Tors.CanCollide=false
Tors.Parent=model
Mesh=Instance.new("BlockMesh")
Mesh.Parent=Tors
Mesh.Scale=Vector3.new(1.01,0.9,1.01)
w = Instance.new("Weld")
w.Parent = char.Torso
w.Part0 = w.Parent
w.Part1 = Tors
w.C0 = CFrame.new(0,0,0)
for _,v in pairs(char:children()) do
if string.sub(v.Name,1,4)=="Left" or string.sub(v.Name,1,4)=='Righ' then
Tor=Instance.new("Part")
Tor.Size=v.Size
Tor.BrickColor=color
Tor.Reflectance=0.75
Tor.CanCollide=false
Tor.Parent=model
Mesh=Instance.new("BlockMesh")
Mesh.Parent=Tor
Mesh.Scale=Vector3.new(1.01,0.9,1.01)
w = Instance.new("Weld")
w.Parent = v
w.Part0 = w.Parent
w.Part1 = Tor
w.C0 = CFrame.new(0,0,0)
Tor=Instance.new("Part")
Tor.Size=Vector3.new(1,1,1)
Tor.BrickColor=color
Tor.Reflectance=0.1
Tor.Locked=true
Tor.CanCollide=true
Tor.Parent=model
Tor.TopSurface="Smooth"
Tor.BottomSurface="Smooth"
Mesh=Instance.new("BlockMesh")
Mesh.Bevel=0.05
Mesh.Parent=Tor
Mesh.Scale=Vector3.new(1.1,0.4,1.1)
w = Instance.new("Weld")
w.Parent = v
w.Part0 = w.Parent
w.Part1 = Tor
w.C0 = CFrame.new(0,-0.6,0)
end
end
Tor=Instance.new("Part")
Tor.Size=Vector3.new(1,1,1)
Tor.BrickColor=color2
Tor.CanCollide=false
Tor.Parent=model
Mesh=Instance.new("BlockMesh")
Mesh.Parent=Tor
Mesh.Scale=Vector3.new(.4,0.4,0.01)
w = Instance.new("Weld")
w.Parent = char.Torso
w.Part0 = w.Parent
w.Part1 = Tor
w.C0 = CFrame.new(0,0,-0.51)
Tor=Instance.new("Part")
Tor.Size=Vector3.new(1,1,1)
Tor.BrickColor=color2
Tor.CanCollide=false
Tor.Parent=model
Mesh=Instance.new("CylinderMesh")
Mesh.Parent=Tor
Mesh.Scale=Vector3.new(.5,0.5,0.049)
w = Instance.new("Weld")
w.Parent = char.Torso
w.Part0 = w.Parent
w.Part1 = Tor
w.C0 = CFrame.new(0,0,-0.49)*CFrame.Angles(0,0,math.rad(90))
Tor=Instance.new("Part")
Tor.Size=Vector3.new(1,1,1)
Tor.BrickColor=color2
Tor.CanCollide=false
Tor.Parent=model
Mesh=Instance.new("CylinderMesh")
Mesh.Parent=Tor
Mesh.Scale=Vector3.new(.5,0.5,0.049)
w = Instance.new("Weld")
w.Parent = char.Torso
w.Part0 = w.Parent
w.Part1 = Tor
w.C0 = CFrame.new(0,0,-0.49)
Tor=Instance.new("Part")
Tor.Size=Vector3.new(1,1,1)
Tor.BrickColor=color
Tor.CanCollide=false
Tor.Parent=model
Mesh=Instance.new("SpecialMesh")
Mesh.MeshType="Sphere"
Mesh.Parent=Tor
Mesh.Scale=Vector3.new(.25,.25,.25)
w = Instance.new("Weld")
w.Parent = char.Torso
w.Part0 = w.Parent
w.Part1 = Tor
w.C0 = CFrame.new(0,0,-0.49)
Tor=Instance.new("Part")
Tor.Size=Vector3.new(1,1,1)
Tor.BrickColor=color2
Tor.CanCollide=false
Tor.Parent=model
Mesh=Instance.new("CylinderMesh")
Mesh.Parent=Tor
Mesh.Scale=Vector3.new(.5,0.5,0.049)
w = Instance.new("Weld")
w.Parent = char.Torso
w.Part0 = w.Parent
w.Part1 = Tor
w.C0 = CFrame.new(0.27,0,-0.49)
Tor=Instance.new("Part")
Tor.Size=Vector3.new(1,1,1)
Tor.BrickColor=color2
Tor.CanCollide=false
Tor.Parent=model
Mesh=Instance.new("CylinderMesh")
Mesh.Parent=Tor
Mesh.Scale=Vector3.new(.5,0.5,0.049)
w = Instance.new("Weld")
w.Parent = char.Torso
w.Part0 = w.Parent
w.Part1 = Tor
w.C0 = CFrame.new(-0.27,0,-0.49)
Tor=Instance.new("Part")
Tor.Size=Vector3.new(1,1,1)
Tor.BrickColor=color2
Tor.CanCollide=false
Tor.Parent=model
Mesh=Instance.new("CylinderMesh")
Mesh.Parent=Tor
Mesh.Scale=Vector3.new(.5,0.5,0.049)
w = Instance.new("Weld")
w.Parent = char.Torso
w.Part0 = w.Parent
w.Part1 = Tor
w.C0 = CFrame.new(0,0.295,-0.49)*CFrame.Angles(0,0,math.rad(90))
Tor=Instance.new("Part")
Tor.Size=Vector3.new(1,1,1)
Tor.BrickColor=color2
Tor.CanCollide=false
Tor.Parent=model
Mesh=Instance.new("CylinderMesh")
Mesh.Parent=Tor
Mesh.Scale=Vector3.new(.5,0.5,0.049)
w = Instance.new("Weld")
w.Parent = char.Torso
w.Part0 = w.Parent
w.Part1 = Tor
w.C0 = CFrame.new(0,-0.295,-0.49)*CFrame.Angles(0,0,math.rad(90))
end
--/Suit--
--MediaFire
|
local thismod = minetest.get_current_modname()
minetest.register_node(thismod .. ":resigned_grass",{
description = "Resigned Grass",
groups = {crumbly = 2, event = 2, oddly_breakable_by_hand = 2, wac_check = 1},
tiles = {
"wac_node_resigned_grass_top.png",
"wac_node_resigned_dirt.png",
"wac_node_resigned_dirt.png^wac_node_resigned_grass_overlay.png"
},
sounds = {footstep = {name = "wac_resignedgrasswalk"}}
})
minetest.register_node(thismod .. ":smashed_egg", {
description = "Smashed Eggcorn",
groups = {choppy = 1, eggy = 2, falling_node = 1},
tiles = {"wac_node_eggcorn_hashed.png"},
drawtype = "nodebox",
paramtype = "light",
walkable = false,
buildable_to = true,
node_box = {
type = "fixed",
fixed = {
{-0.125, -0.5, 0.1875, 0.125, -0.4375, 0.3125}, -- NodeBox1
{-0.3125, -0.5, 0.1875, -0.25, -0.4375, 0.3125}, -- NodeBox3
{0.25, -0.5, -0.4375, 0.3125, -0.4375, -0.25}, -- NodeBox4
{-0.1875, -0.5, -0.5, -0.0625, -0.375, -0.25}, -- NodeBox6
{0.375, -0.5, -0.4375, 0.4375, -0.4375, -0.3125}, -- NodeBox7
{-0.0625, -0.5, -0.1875, 0, -0.4375, 0}, -- NodeBox8
{0, -0.5, -0.1875, 0.125, -0.375, -0.125}, -- NodeBox9
{0.3125, -0.5, 0, 0.4375, -0.4375, 0.0625}, -- NodeBox10
}
},
on_construct = function(pos)
local timer = minetest.get_node_timer(pos)
timer:start(3)
end,
on_timer = function(pos)
minetest.remove_node(pos)
end
})
minetest.register_node(thismod .. ":stone",{
description = "Stone",
groups = {crumbly = 2, event = 2, oddly_breakable_by_hand = 2, wac_check = 1},
tiles = {"wac_node_stone.png"},
})
minetest.register_abm({
label = "Clean up old games",
nodenames = {"group:wac_check"},
interval = 10,
chance = 1,
action = function(pos)
local id = minetest.get_meta(pos):get_float("wac_id")
if (not id) or (id == 0) then
return minetest.after(math.random() * 10,
function() return minetest.remove_node(pos) end)
end
end
})
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.