content
stringlengths 5
1.05M
|
|---|
return {
version = "1.5",
luaversion = "5.1",
tiledversion = "1.7.2",
orientation = "orthogonal",
renderorder = "right-down",
width = 16,
height = 16,
tilewidth = 16,
tileheight = 16,
nextlayerid = 5,
nextobjectid = 44,
properties = {},
tilesets = {
{
name = "dungeon-tileset",
firstgid = 1,
tilewidth = 16,
tileheight = 16,
spacing = 0,
margin = 0,
columns = 10,
image = "../../art/tilesets/dungeon.png",
imagewidth = 160,
imageheight = 176,
objectalignment = "topleft",
tileoffset = {
x = 0,
y = 0
},
grid = {
orientation = "orthogonal",
width = 16,
height = 16
},
properties = {},
wangsets = {},
tilecount = 110,
tiles = {
{
id = 0,
type = "wall"
},
{
id = 1,
type = "wall"
},
{
id = 2,
type = "wall"
},
{
id = 3,
type = "wall"
},
{
id = 4,
type = "wall"
},
{
id = 5,
type = "wall"
},
{
id = 6,
type = "floor"
},
{
id = 7,
type = "floor"
},
{
id = 8,
type = "floor"
},
{
id = 9,
type = "floor"
},
{
id = 10,
type = "wall"
},
{
id = 11,
type = "floor"
},
{
id = 12,
type = "floor"
},
{
id = 13,
type = "floor"
},
{
id = 14,
type = "floor"
},
{
id = 15,
type = "wall"
},
{
id = 16,
type = "floor"
},
{
id = 17,
type = "floor"
},
{
id = 18,
type = "floor"
},
{
id = 19,
type = "floor"
},
{
id = 20,
type = "wall"
},
{
id = 21,
type = "floor"
},
{
id = 22,
type = "floor"
},
{
id = 23,
type = "floor"
},
{
id = 24,
type = "floor"
},
{
id = 25,
type = "wall"
},
{
id = 26,
type = "floor"
},
{
id = 27,
type = "floor"
},
{
id = 28,
type = "floor"
},
{
id = 29,
type = "floor"
},
{
id = 30,
type = "wall"
},
{
id = 31,
type = "floor"
},
{
id = 32,
type = "floor"
},
{
id = 33,
type = "floor"
},
{
id = 34,
type = "floor"
},
{
id = 35,
type = "wall"
},
{
id = 36,
type = "wall"
},
{
id = 37,
type = "wall"
},
{
id = 40,
type = "wall"
},
{
id = 41,
type = "wall"
},
{
id = 42,
type = "wall"
},
{
id = 43,
type = "wall"
},
{
id = 44,
type = "wall"
},
{
id = 45,
type = "wall"
},
{
id = 50,
type = "wall"
},
{
id = 51,
type = "wall"
},
{
id = 52,
type = "wall"
},
{
id = 53,
type = "wall"
},
{
id = 54,
type = "wall"
},
{
id = 55,
type = "wall"
},
{
id = 60,
type = "floor"
},
{
id = 61,
type = "floor"
},
{
id = 62,
type = "floor"
},
{
id = 63,
type = "floor"
},
{
id = 70,
type = "floor"
},
{
id = 71,
type = "floor"
},
{
id = 72,
type = "floor"
},
{
id = 73,
type = "floor"
},
{
id = 78,
type = "pit"
},
{
id = 100,
type = "pit"
}
}
}
},
layers = {
{
type = "tilelayer",
x = 0,
y = 0,
width = 16,
height = 16,
id = 1,
name = "map",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
encoding = "lua",
data = {
1, 2, 3, 4, 5, 2, 3, 8, 5, 2, 3, 4, 5, 2, 6, 0,
11, 12, 13, 14, 101, 101, 13, 14, 13, 101, 101, 14, 13, 14, 6, 0,
21, 22, 7, 8, 79, 79, 101, 8, 101, 79, 79, 101, 101, 10, 16, 0,
31, 22, 17, 18, 79, 79, 17, 18, 19, 79, 79, 79, 19, 20, 26, 0,
11, 22, 29, 8, 79, 30, 28, 17, 10, 17, 79, 79, 29, 101, 79, 0,
21, 22, 27, 20, 79, 7, 9, 17, 7, 9, 79, 79, 9, 79, 79, 0,
31, 22, 20, 20, 79, 20, 20, 8, 29, 19, 79, 30, 19, 79, 79, 0,
79, 22, 20, 20, 79, 29, 27, 20, 10, 7, 79, 9, 101, 79, 79, 0,
79, 101, 18, 19, 79, 7, 9, 27, 8, 7, 79, 29, 79, 79, 16, 0,
79, 79, 101, 19, 79, 30, 20, 29, 8, 27, 79, 101, 79, 79, 26, 0,
79, 79, 18, 19, 17, 17, 17, 8, 27, 27, 18, 10, 29, 30, 36, 0,
21, 22, 7, 8, 9, 10, 7, 8, 9, 10, 7, 8, 9, 10, 16, 0,
31, 22, 17, 18, 19, 20, 17, 18, 19, 20, 17, 18, 19, 20, 26, 0,
11, 22, 27, 28, 29, 30, 27, 28, 29, 30, 2, 3, 4, 5, 36, 0,
1, 32, 33, 101, 33, 34, 33, 34, 33, 34, 13, 14, 13, 14, 16, 0,
41, 42, 43, 79, 101, 42, 43, 44, 45, 42, 43, 44, 45, 42, 46, 0
}
},
{
type = "tilelayer",
x = 0,
y = 0,
width = 16,
height = 16,
id = 3,
name = "scatter",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
encoding = "lua",
data = {
0, 0, 0, 0, 0, 0, 91, 0, 91, 0, 0, 0, 0, 0, 0, 0,
0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 78, 0, 0, 0, 0, 0, 78, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 76, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
},
{
type = "objectgroup",
draworder = "topdown",
id = 2,
name = "entities",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
objects = {
{
id = 7,
name = "Light",
type = "",
shape = "rectangle",
x = 80,
y = 160,
width = 16,
height = 16,
rotation = 0,
gid = 87,
visible = true,
properties = {}
},
{
id = 20,
name = "PlayerStart",
type = "",
shape = "rectangle",
x = 112,
y = 208,
width = 16,
height = 16,
rotation = 0,
gid = 76,
visible = true,
properties = {}
},
{
id = 21,
name = "Boulder",
type = "",
shape = "rectangle",
x = 96,
y = 112,
width = 16,
height = 16,
rotation = 0,
gid = 107,
visible = true,
properties = {}
},
{
id = 22,
name = "Boulder",
type = "",
shape = "rectangle",
x = 112,
y = 112,
width = 16,
height = 16,
rotation = 0,
gid = 107,
visible = true,
properties = {}
},
{
id = 23,
name = "Boulder",
type = "",
shape = "rectangle",
x = 128,
y = 112,
width = 16,
height = 16,
rotation = 0,
gid = 107,
visible = true,
properties = {}
},
{
id = 24,
name = "Boulder",
type = "",
shape = "rectangle",
x = 80,
y = 96,
width = 16,
height = 16,
rotation = 0,
gid = 107,
visible = true,
properties = {}
},
{
id = 25,
name = "Boulder",
type = "",
shape = "rectangle",
x = 144,
y = 96,
width = 16,
height = 16,
rotation = 0,
gid = 107,
visible = true,
properties = {}
},
{
id = 26,
name = "Boulder",
type = "",
shape = "rectangle",
x = 96,
y = 80,
width = 16,
height = 16,
rotation = 0,
gid = 107,
visible = true,
properties = {}
},
{
id = 27,
name = "Boulder",
type = "",
shape = "rectangle",
x = 112,
y = 80,
width = 16,
height = 16,
rotation = 0,
gid = 107,
visible = true,
properties = {}
},
{
id = 28,
name = "Boulder",
type = "",
shape = "rectangle",
x = 128,
y = 80,
width = 16,
height = 16,
rotation = 0,
gid = 107,
visible = true,
properties = {}
},
{
id = 29,
name = "Boulder",
type = "",
shape = "rectangle",
x = 80,
y = 64,
width = 16,
height = 16,
rotation = 0,
gid = 107,
visible = true,
properties = {}
},
{
id = 30,
name = "Boulder",
type = "",
shape = "rectangle",
x = 96,
y = 64,
width = 16,
height = 16,
rotation = 0,
gid = 107,
visible = true,
properties = {}
},
{
id = 31,
name = "Boulder",
type = "",
shape = "rectangle",
x = 128,
y = 64,
width = 16,
height = 16,
rotation = 0,
gid = 107,
visible = true,
properties = {}
},
{
id = 32,
name = "Boulder",
type = "",
shape = "rectangle",
x = 144,
y = 64,
width = 16,
height = 16,
rotation = 0,
gid = 107,
visible = true,
properties = {}
},
{
id = 33,
name = "Coffee",
type = "",
shape = "rectangle",
x = 176,
y = 224,
width = 16,
height = 16,
rotation = 0,
gid = 90,
visible = true,
properties = {}
},
{
id = 36,
name = "Tomb-GoldenKey",
type = "",
shape = "rectangle",
x = 112,
y = 32,
width = 16,
height = 16,
rotation = 0,
gid = 85,
visible = true,
properties = {}
},
{
id = 37,
name = "ExitDoor",
type = "",
shape = "rectangle",
x = 112,
y = 0,
width = 16,
height = 16,
rotation = 0,
gid = 37,
visible = true,
properties = {}
},
{
id = 39,
name = "MovableMirror-UR",
type = "",
shape = "rectangle",
x = 80,
y = 160,
width = 16,
height = 16,
rotation = 0,
gid = 105,
visible = true,
properties = {
["initialFacingDir"] = "UpRight"
}
},
{
id = 40,
name = "MovableMirror-UL",
type = "",
shape = "rectangle",
x = 112,
y = 160,
width = 16,
height = 16,
rotation = 0,
gid = 2147483753,
visible = true,
properties = {
["initialFacingDir"] = "UpLeft"
}
}
}
},
{
type = "objectgroup",
draworder = "topdown",
id = 4,
name = "reverb",
visible = true,
opacity = 1,
offsetx = 0,
offsety = 0,
parallaxx = 1,
parallaxy = 1,
properties = {},
objects = {
{
id = 41,
name = "large_room",
type = "",
shape = "rectangle",
x = 16,
y = 16,
width = 208,
height = 192,
rotation = 0,
visible = true,
properties = {}
},
{
id = 42,
name = "corridor",
type = "",
shape = "rectangle",
x = 160,
y = 224,
width = 64,
height = 16,
rotation = 0,
visible = true,
properties = {}
},
{
id = 43,
name = "large_room",
type = "",
shape = "rectangle",
x = 16,
y = 208,
width = 144,
height = 32,
rotation = 0,
visible = true,
properties = {}
}
}
}
}
}
|
-- $Id$
--******************************************************************************
-- Copyright 2002 Noemi Rodriquez & Roberto Ierusalimschy. All rights reserved.
--******************************************************************************
--------------------------------------------------------------------------------
------------------------------ ##### ## ------------------------------
------------------------------ ## ## # ## ------------------------------
------------------------------ ## ## ## ## ------------------------------
------------------------------ ## ## # ## ------------------------------
------------------------------ ##### ### ###### ------------------------------
-------------------------------- --------------------------------
----------------------- An Object Request Broker in Lua ------------------------
--------------------------------------------------------------------------------
-- Project: OiL - ORB in Lua: An Object Request Broker in Lua --
-- Release: 0.5 --
-- Title : Properties management package for OiL --
-- Authors: Leonardo S. A. Maciel <leonardo@maciel.org> --
--------------------------------------------------------------------------------
-- Interface: --
--------------------------------------------------------------------------------
-- Notes: --
--------------------------------------------------------------------------------
local require = require
local rawget = rawget
local rawset = rawset
local oo = require "loop.base"
module("oil.properties", oo.class) --[[VERBOSE]] local verbose = require "oil.verbose"
--------------------------------------------------------------------------------
-- Key constants ---------------------------------------------------------------
local PARENT = {}
local DEFAULT = {}
--------------------------------------------------------------------------------
-- Properties implementation ---------------------------------------------------
function __index(self, key)
if key then
local parent = rawget(self, PARENT)
local default = rawget(self, DEFAULT)
local value = parent and parent[key] or default and default[key] or nil
rawset(self, key, value)
return value
else
return nil
end
end
function __init(self, parent, default)
return oo.rawnew(self, {[PARENT] = parent,
[DEFAULT]= default})
end
|
------------------------------------------------------------------------------
-- Test programs.
-- Copyright © 2013–2015 Peter Colberg.
-- Distributed under the MIT license. (See accompanying file LICENSE.)
------------------------------------------------------------------------------
require("strict")
pcall(require, "luacov")
local cl = require("opencl")
local test = require("test")
local tests = {}
table.insert(tests, function(device)
local context = cl.create_context({device})
local source = [[
__kernel void add(
__global float *restrict a,
__global const float *restrict b)
{
const size_t gid = get_global_id(0);
a[gid] += b[gid];
}
__kernel void multiply(
__global float *restrict a,
__global const float *restrict b)
{
const size_t gid = get_global_id(0);
a[gid] *= b[gid];
}
]]
local program = context:create_program_with_source(source)
program:build()
assert(program:get_info("context") == context)
assert(program:get_info("num_devices") == 1)
local devices = program:get_info("devices")
assert(#devices == 1)
assert(devices[1] == device)
assert(program:get_info("source") == source)
local binary_sizes = program:get_info("binary_sizes")
assert(#binary_sizes == 1)
assert(binary_sizes[1] > 0)
local binaries = program:get_info("binaries")
assert(#binaries == 1)
assert(#binaries[1] == binary_sizes[1])
if not device:get_info("version"):match("^OpenCL 1%.[01] ") then
assert(program:get_info("num_kernels") == 2)
assert(program:get_info("kernel_names") == "add;multiply")
end
end)
table.insert(tests, function(device)
local context = cl.create_context({device})
local program = context:create_program_with_source([[
__kernel void add(
__global float *restrict a)
{
const size_t gid = get_global_id(0);
a[gid] += VALUE;
}
]])
assert(program:get_build_info(device, "status") == nil)
if not device:get_info("version"):match("^OpenCL 1%.[01] ") then
assert(program:get_build_info(device, "binary_type") == nil)
end
program:build("-D VALUE=1")
assert(program:get_build_info(device, "status") == "success")
assert(program:get_build_info(device, "options") == "-D VALUE=1")
assert(type(program:get_build_info(device, "log")) == "string")
if not device:get_info("version"):match("^OpenCL 1%.[01] ") then
assert(program:get_build_info(device, "binary_type") == "executable")
end
end)
test.test_devices(tests)
|
filename = "lua-dns.log"
function init (args)
local needs = {}
needs["protocol"] = "dns"
return needs
end
function setup (args)
SCLogNotice("lua: setup()")
file = assert(io.open(SCLogPath() .. "/" .. filename, "w"))
end
function log(args)
ts = SCPacketTimeString()
ip_ver, src_ip, dst_ip, proto, sp, dp = SCFlowTuple()
tx_id = DnsGetTxid()
queries = DnsGetQueries()
if queries ~= nil then
for n, t in pairs(queries) do
msg = string.format(
"%s [**] Query TX %04x [**] %s [**] %s [**] %s:%d -> %s:%d",
ts,
tx_id,
t["rrname"],
t["type"],
src_ip,
sp,
dst_ip,
dp)
write(msg)
end
end
rcode = DnsGetRcode()
if rcode ~= nil then
msg = string.format(
"%s [**] Response TX %04x [**] %s [**] %s:%d -> %s:%d",
ts,
tx_id,
rcode,
src_ip,
sp,
dst_ip,
dp)
write(msg)
end
answers = DnsGetAnswers()
if answers ~= nil then
for n, t in pairs(answers) do
msg = string.format(
"%s [**] Response TX %04x [**] %s [**] %s [**] TTL %d [**] %s [**] %s:%d -> %s:%d",
ts,
tx_id,
t["rrname"],
t["type"],
t["ttl"],
t["addr"],
src_ip,
sp,
dst_ip,
dp);
write(msg)
end
end
authorities = DnsGetAuthorities()
if authorities ~= nil then
for n, t in pairs(authorities) do
msg = string.format(
"%s [**] Response TX %04x [**] %s [**] %s [**] TTL %d [**] %s:%d -> %s:%d",
ts,
tx_id,
t["rrname"],
t["type"],
t["ttl"],
src_ip,
sp,
dst_ip,
dp);
write(msg)
end
end
end
function deinit(args)
file:close(file)
end
function write(msg)
file:write(msg .. "\n")
end
|
local md = require('lmbedtls.md')
local utils = require('util')
local assert = require('assert')
local tap = require('util/tap')
--console.log(md)
local test = tap.test
test("test md", function()
assert.equal(utils.hexEncode(md.md5('test')), "098f6bcd4621d373cade4e832627b4f6")
assert.equal(utils.hexEncode(md.sha1('test')), "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3")
assert.equal(utils.hexEncode(md.sha256('test')), "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08")
assert.equal(utils.hexEncode(md.sha512('test')), "ee26b0dd4af7e749aa1a8ee3c10ae9923f618980772e473f8819a5d4940e0db27ac185f8a0e1d5f84f88bc887fd67b143732c304cc5fa9ad8e6f57f50028a8ff")
local md5 = md.new(md.MD5)
--console.log(md5)
md5:update('te')
md5:update('st')
assert.equal(utils.hexEncode(md5:finish()), "098f6bcd4621d373cade4e832627b4f6")
end)
test("test hmac", function()
local md5 = md.new(md.MD5, "test")
--console.log(test)
md5:update('te')
md5:update('st')
assert.equal(utils.hexEncode(md5:finish()), "cd4b0dcbe0f4538b979fb73664f51abe")
end)
tap.run()
|
scriptId = 'com.tylercasson.scripts.missionControl'
-- Global:
-- Spread Fingers to toggle Mission Control
-- Make a Fist to toggle Application Windows for the current application
-- Mission Control:
-- Wave Left to move right a space
-- Wave Right to move left a space
-- Application Windows:
-- Wave Left to highlight the previous window
-- Wave Right to highlight the next window
applicationWindowsAreShowing = false
missionControlIsShowing = false
-- Mission Control Actions
function toggleMissionControl()
missionControlIsShowing = not missionControlIsShowing
myo.keyboard("up_arrow", "press", "control")
end
function toggleApplicationWindows()
applicationWindowsAreShowing = not applicationWindowsAreShowing
myo.keyboard("down_arrow", "press", "control")
end
function moveLeft()
if applicationWindowsAreShowing then
-- Swap the control direction for changing highlighted window
myo.keyboard("right_arrow", "press")
else
myo.keyboard("left_arrow", "press", "control")
end
end
function moveRight()
if applicationWindowsAreShowing then
-- Swap the control direction for changing highlighted window
myo.keyboard("left_arrow", "press")
else
myo.keyboard("right_arrow", "press", "control")
end
end
-- Helpers
function conditionallySwapWave(pose)
if myo.getArm() == "left" then
if pose == "waveIn" then
pose = "waveOut"
elseif pose == "waveOut" then
pose = "waveIn"
end
end
return pose
end
-- Unlock mechanism
function unlock()
enabled = true
extendUnlock()
end
function extendUnlock()
enabledSince = myo.getTimeMilliseconds()
end
-- Triggers
function onPoseEdge(pose, edge)
if pose == "thumbToPinky" then
if edge == "off" then
enabled = true
enabledSince = myo.getTimeMilliseconds()
elseif edge == "on" and not enabled then
-- Vibrate twice on unlock
myo.vibrate("short")
myo.vibrate("short")
end
end
if enabled then
pose = conditionallySwapWave(pose)
if pose == "waveIn" and edge == "on" then
moveRight()
extendUnlock()
end
if pose == "waveOut" and edge == "on" then
moveLeft()
extendUnlock()
end
if pose == "fingersSpread" and edge == "on" then
if not applicationWindowsAreShowing then
toggleMissionControl()
elseif applicationWindowsAreShowing then
toggleApplicationWindows()
end
extendUnlock()
end
if pose == "fist" and edge == "on" then
if not missionControlIsShowing then
toggleApplicationWindows()
elseif missionControlIsShowing then
toggleMissionControl()
end
extendUnlock()
end
end
end
-- All timeouts in milliseconds
ENABLED_TIMEOUT = 2200
function onPeriodic()
if enabled then
if myo.getTimeMilliseconds() - enabledSince > ENABLED_TIMEOUT then
enabled = false
-- Vibrate once on lock
myo.vibrate("short")
end
end
end
ingoreInApps = {
["app"] = {
"com.apple.iTunes",
"com.apple.iWork.Keynote",
"org.videolan.vlc",
"com.adobe.Reader",
"com.microsoft.Powerpoint"
},
["title"] = {
"Netflix"
}
}
function onForegroundWindowChange(app, title)
-- myo.debug(app .. " — " .. title .. "\n")
local wantActive = true
activeApp = ""
if platform == "MacOS" then
for key, list in pairs(ingoreInApps) do
if key == "app" then
for index, name in pairs(list) do
if string.match(app, name) then
wantActive = false
return wantActive
end
end
elseif key == "title" then
for index, name in pairs(list) do
if string.match(title, name) then
wantActive = false
return wantActive
end
end
end
end
end
return wantActive
end
function activeAppName()
return activeApp
end
function onActiveChange(isActive)
if not isActive then
enabled = false
end
end
|
local playerModule = {}
function playerModule.newplayer (width, height)
local x, y = width/2 - 10, height/2 - 10
local rotation = 0
return {
try = function ()
return x
end,
update = function (dt)
-- x = x + 0.5
-- if x > width then
-- x = 0
-- end
end,
draw = function ()
love.graphics.setColor(255,0,0);
love.graphics.rectangle("line", x, y, 30, 30)
love.graphics.setColor(255,255,255);
end,
keypressed = function (key)
if love.keyboard.isDown("right") then
rotation = 0
elseif love.keyboard.isDown("up") then
rotation = 90
elseif love.keyboard.isDown("left") then
rotation = 180
elseif love.keyboard.isDown("down") then
rotation = 270
end
print(rotation)
end,
getPosition = function () return {x = x, y = y} end
}
end
return playerModule
|
-- Part of BioLua by SweetPalma, 2017. All rights reserved.
-- BioLua OOP system unit tests:
describe('biolua.object', function()
local Object, Vector, vector
it('Successfully imports', function()
Object = require 'biolua.object'
assert.type('table', Object)
end)
it('Successfully extends using :extend', function()
Vector = Object:extend {__name = 'Vector'}
assert.equal(Vector.__super, Object)
assert.equal(Vector.__name, 'Vector')
assert.type('function', Vector.__call)
assert.type('string', Vector.__id)
end)
it('Successfully extends using .assign', function()
function Vector:__init(x, y)
self.x = x
self.y = y
end
function Vector:__index(key)
if key == 1 then
return self.x
elseif key == 2 then
return self.y
else
return rawget(self, key)
end
end
function Vector:__newindex(key, value)
if key == 1 then
self.x = value
elseif key == 2 then
self.y = value
else
return rawset(self, key, value)
end
end
function Vector:__tostring()
return 'Vector(' .. self.x .. ', ' .. self.y .. ')'
end
function Vector:__unm()
return Vector(-self.x, -self.y)
end
function Vector.__add(one, two)
if type(one) == 'table' and type(two) == 'table'
and one.x and one.y and two.x and two.y then
return Vector(one.x + two.x, one.y + two.y)
end
end
function Vector.__sub(one, two)
if type(one) == 'table' and type(two) == 'table'
and one.x and one.y and two.x and two.y then
return Vector(one.x - two.x, one.y - two.y)
end
end
function Vector.__eq(one, two)
if type(one) == 'table' and type(two) == 'table'
and one.x and one.y and two.x and two.y then
return one.x == two.x and one.y == two.y
else
return false
end
end
function Vector.__lt(one, two)
if type(one) == 'table' and type(two) == 'table'
and one.x and one.y and two.x and two.y then
return one:magnitude() < two:magnitude()
end
end
function Vector.__le(one, two)
return Vector.__lt(one, two) or Vector.__eq(one, two)
end
function Vector:magnitude()
return math.sqrt(self.x ^ 2 + self.y ^ 2)
end
end)
it('Successfully performs initialization', function()
vector = Vector(15, 10)
assert.equal(vector.__proto, Vector)
assert.equal(vector.__super, Object)
assert.type('string', Vector.__id)
assert.equal(vector.extend, nil)
assert.equal(vector.__call, nil)
end)
it('Successfully calls __init', function()
assert.equal(vector.x, 15)
assert.equal(vector.y, 10)
end)
it('Successfully calls instance method', function()
assert.equal(math.floor(vector:magnitude()), 18)
end)
it('Successfully calls metamethods', function()
local a, b = Vector(10, 5), Vector(5, 5)
assert.equal(a.x, a[1])
assert.equal(a.y, a[2])
assert.equal(tostring(a), 'Vector(10, 5)')
local unm = -a
assert.equal(unm.x, -a.x)
assert.equal(unm.y, -a.y)
local sum = a + b
assert.equal(sum.x, 15)
assert.equal(sum.y, 10)
local dif = a - b
assert.equal(dif.x, a.x - b.x)
assert.equal(dif.y, a.y - b.y)
assert.equal(a == b, false)
assert.equal(b == a, false)
assert.equal(a == Vector(10, 5), true)
assert.equal(Vector(10, 5) == a, true)
assert.equal(a >= b, true)
assert.equal(b <= a, true)
assert.equal(a <= b, false)
assert.equal(b >= a, false)
-- There is no need to test all metamethods.
end)
it('Successfully performs typechecks', function()
local a = Vector(10, 10)
assert.equal(a:is(a), true)
assert.equal(a:is(Vector), true)
assert.equal(a:is(Object), true)
assert.equal(a:is(Vector(5, 5)), false)
assert.equal(a:is(Vector(10, 10)), false)
-- It compares __id, avoiding using __eq.
end)
end)
|
--[[------------------------------------------------------
# osc send client
This is a simple UDP client (based on lens.Socket) to send OSC messages.
NOTE: This class needs the [lens](http://doc.lubyk.org/lens.html) library.
## Usage example
local osc = require 'osc'
client = osc.Client('127.0.0.1', 11000)
client:send('/hello', 'lubyk', 2014)
--]]------------------------------------------------------
local lub = require 'lub'
local lens = require 'lens'
local osc = require 'osc'
local lib = lub.class 'osc.Client'
local mapReceive, missingEntry
local UDP, send, pack =
lens.Socket.UDP, lens.Socket.send, osc.pack
-- # Class functions
-- Create a new client connected to a given `host` and `port`.
function lib.new(host, port)
local self = {
socket = lens.Socket(UDP),
}
setmetatable(self, lib)
self.socket:connect(host, port)
return self
end
-- # Methods
-- Send osc message.
function lib:send(url, ...)
send(self.socket, pack(url, ...))
end
return lib
|
--[[
© CloudSixteen.com do not share, re-distribute or modify
without permission of its author (kurozael@gmail.com).
Clockwork was created by Conna Wiles (also known as kurozael.)
http://cloudsixteen.com/license/clockwork.html
--]]
-- A function to load the shipments.
function cwSaveItems:LoadShipments()
local shipments = Clockwork.kernel:RestoreSchemaData("plugins/shipments/"..game.GetMap());
for k, v in pairs(shipments) do
if (Clockwork.item.stored[v.item]) then
local entity = Clockwork.entity:CreateShipment(
{key = v.key, uniqueID = v.uniqueID}, v.item, v.amount, v.position, v.angles
);
if (IsValid(entity) and !v.isMoveable) then
local physicsObject = entity:GetPhysicsObject();
if (IsValid(physicsObject)) then
physicsObject:EnableMotion(false);
end;
end;
end;
end;
end;
-- A function to save the shipments.
function cwSaveItems:SaveShipments()
local shipments = {};
for k, v in pairs(ents.FindByClass("cw_shipment")) do
local physicsObject = v:GetPhysicsObject();
local itemTable = v:GetItemTable();
local bMoveable = nil;
if (IsValid(physicsObject)) then
bMoveable = physicsObject:IsMoveable();
end;
shipments[#shipments + 1] = {
key = Clockwork.entity:QueryProperty(v, "key"),
item = itemTable("uniqueID"),
angles = v:GetAngles(),
amount = table.Count(v.cwInventory[itemTable("uniqueID")]),
uniqueID = Clockwork.entity:QueryProperty(v, "uniqueID"),
position = v:GetPos(),
isMoveable = bMoveable
};
end;
Clockwork.kernel:SaveSchemaData("plugins/shipments/"..game.GetMap(), shipments);
end;
-- A function to load the items.
function cwSaveItems:LoadItems()
local items = Clockwork.kernel:RestoreSchemaData("plugins/items/"..game.GetMap());
for k, v in pairs(items) do
local itemTable = Clockwork.item:CreateInstance(v.item, v.itemID, v.data);
if (itemTable) then
local entity = Clockwork.entity:CreateItem(
{key = v.key, uniqueID = v.uniqueID}, itemTable, v.position, v.angles
);
entity.cwInventory = Clockwork.inventory:ToLoadable(v.inventory or {});
if (IsValid(entity) and !v.isMoveable) then
local physicsObject = entity:GetPhysicsObject();
if (IsValid(physicsObject)) then
physicsObject:EnableMotion(false);
end;
end;
end;
end;
end;
-- A function to save the items.
function cwSaveItems:SaveItems()
local items = {};
for k, v in pairs(ents.FindByClass("cw_item")) do
local physicsObject = v:GetPhysicsObject();
local itemTable = v:GetItemTable();
local bMoveable = false;
if (IsValid(physicsObject)) then
bMoveable = physicsObject:IsMoveable();
end;
if (itemTable and Clockwork.plugin:Call("ShouldSaveItem", v, itemTable)) then
items[#items + 1] = {
key = Clockwork.entity:QueryProperty(v, "key"),
item = itemTable("uniqueID"),
data = itemTable("data"),
itemID = itemTable("itemID"),
angles = v:GetAngles(),
uniqueID = Clockwork.entity:QueryProperty(v, "uniqueID"),
position = v:GetPos(),
isMoveable = bMoveable,
inventory = Clockwork.inventory:ToSaveable(v.cwInventory or {})
};
end;
end;
Clockwork.kernel:SaveSchemaData("plugins/items/" .. game.GetMap(), items);
end;
|
--[[--- A C lexical scanner using LPeg.
= CREDITS
= based on the C lexer in Peter Odding's lua-lxsh
@module macro.clexer
--]]
local clexer = {}
local lpeg = require 'lpeg'
local P, R, S, C, Cc, Ct = lpeg.P, lpeg.R, lpeg.S, lpeg.C, lpeg.Cc, lpeg.Ct
-- create a pattern which captures the lua value [id] and the input matching
-- [patt] in a table
local function token(id, patt) return Ct(Cc(id) * C(patt)) end
-- private interface
local table_of_tokens
local extra_tokens
function clexer.add_extra_tokens(extra)
extra_tokens = extra_tokens or {}
for _,t in ipairs(extra) do
table.insert(extra_tokens,t)
end
table_of_tokens = nil -- re-initialize
end
function clexer.init ()
local digit = R('09')
local upp, low = R'AZ', R'az'
local oct, dec = R'07', R'09'
local hex = dec + R'AF' + R'af'
local letter = upp + low
local alnum = letter + dec + '_'
local endline = S'\r\n\f'
local newline = '\r\n' + endline
local escape = '\\' * ( newline
+ S'\\"\'?abfnrtv'
+ (#oct * oct^-3)
+ ('x' * #hex * hex^-2))
-- range of valid characters after first character of identifier
local idsafe = R('AZ', 'az', '\127\255') + P '_'
-- operators
local OT = P '=='
if extra_tokens then
for _,ex in ipairs(extra_tokens) do
OT = OT + P(ex)
end
end
local operator = token('operator', OT + P '.' + P'>>=' + '<<=' + '--' + '>>' + '>=' + '/=' + '==' + '<='
+ '+=' + '<<' + '*=' + '++' + '&&' + '|=' + '||' + '!=' + '&=' + '-='
+ '^=' + '%=' + '->' + S',)*%+&(-~/^]{}|.[>!?:=<;')
-- identifiers
local ident = token('iden', idsafe * (idsafe + digit) ^ 0)
-- keywords
local keyword = token('keyword', (P 'auto' + P 'break' + P 'case' + P'char' +
P 'const' + P 'continue' + P 'default' +
P 'do' + P 'double' + P 'else' + P 'enum' + P 'extern' + P 'float' +
P 'for' + P 'goto' + P 'if' + P 'int' + P 'long' + P 'register' +
P 'return' + P 'short' + P 'signed' + P 'sizeof' + P 'static' +
P 'struct' + P 'switch' + P 'typedef' + P 'union' + P 'void' +
P 'volatile' + P 'while') * -(idsafe + digit))
-- numbers
local number_sign = S'+-'^-1
local number_decimal = digit ^ 1
local number_hexadecimal = P '0' * S 'xX' * R('09', 'AF', 'af') ^ 1
local number_float = (digit^1 * P'.' * digit^0 + P'.' * digit^1) *
(S'eE' * number_sign * digit^1)^-1
local number = token('number', number_hexadecimal +
number_float +
number_decimal)
local string = token('string', '"' * ((1 - S'\\\r\n\f"') + escape)^0 * '"')
local char = token('char',"'" * ((1 - S"\\\r\n\f'") + escape) * "'")
-- comments
local singleline_comment = P '//' * (1 - S '\r\n\f') ^ 0
local multiline_comment = '/*' * (1 - P'*/')^0 * '*/'
local comment = token('comment', multiline_comment + singleline_comment)
local prepro = token('prepro',P '#' * (1 - S '\r\n\f') ^ 0)
-- whitespace
local whitespace = token('space', S('\r\n\f\t ')^1)
-- ordered choice of all tokens and last-resort error which consumes one character
local any_token = whitespace + number + keyword + ident +
string + char + comment + prepro + operator + token('error', 1)
table_of_tokens = Ct(any_token ^ 0)
end
-- increment [line] by the number of line-ends in [text]
local function sync(line, text)
local index, limit = 1, #text
while index <= limit do
local start, stop = text:find('\r\n', index, true)
if not start then
start, stop = text:find('[\r\n\f]', index)
if not start then break end
end
index = stop + 1
line = line + 1
end
return line
end
clexer.sync = sync
clexer.line = 0
-- we only need to synchronize the line-counter for these token types
local multiline_tokens = { comment = true, space = true }
clexer.multiline_tokens = multiline_tokens
function clexer.scan_c_tokenlist(input)
if not table_of_tokens then
clexer.init()
end
assert(type(input) == 'string', 'bad argument #1 (expected string)')
local line = 1
local tokens = lpeg.match(table_of_tokens, input)
for i, token in pairs(tokens) do
local t = token[1]
if t == 'operator' or t == 'error' then
token[1] = token[2]
end
token[3] = line
if multiline_tokens[t] then
line = sync(line, token[2])
end
end
return tokens
end
--- get a token iterator from a source containing Lua code.
-- S is the source - can be a string or a file-like object (i.e. read() returns line)
-- Note that this token iterator includes spaces and comments, and does not convert
-- string and number tokens - so e.g. a string token is quoted and a number token is
-- an unconverted string.
function clexer.scan_c(input,name)
if type(input) ~= 'string' and input.read then
input = input:read('*a')
end
local tokens = clexer.scan_c_tokenlist(input)
local i, n = 1, #tokens
return function(k)
if k ~= nil then
k = i + k
if k < 1 or k > n then return nil end
return tokens[k]
end
local tok = tokens[i]
i = i + 1
if tok then
clexer.line = tok[3]
clexer.name = name
return tok[1],tok[2]
end
end
end
return clexer
|
-- 封装一些与数组有关的操作
-- @verson 1.0
-- @author 拐 <geyunfei@gmail.com>
-- @date Oct 10th,2018
local M = {}
M._VERSION = "1.0"
local mt = { __index = M }
-- 取一个table中每个元素的key值
function M:get_by_key (array ,key )
local res = {}
for i , v in ipairs(array) do
res[i] = v[key]
end
return res
end
function M:group_by_key(array,col)
local res = {}
for i , v in ipairs(array) do
local key = v[col]
if res [key] == nil then
res[key] = {}
end
res[key][#(res[key])+1]=v
end
return res
end
function M:fill_by_key(array,col)
local res = {}
for i, v in ipairs(array) do
res[v[col]]=v
end
return res
end
function M:get_keys(array)
local res = {}
for i,v in pairs(array) do
res[#res+1]=i
end
return res
end
return M
|
system_configs =
{
delete_stop = false,
slots = 100,
default_info = [[ Hola, Aqui debes colocar la informacion de tu grupo ]],
default_color1 = "#00ff00",
default_color2 = "#ffffff",
GUI_co_effect = false
}
|
return {'bie','bieb','biecht','biechtbriefje','biechteling','biechtelinge','biechten','biechtgeheim','biechthokje','biechtspiegel','biechtstoel','biechtvader','bieden','bieder','biedermeier','biedgedrag','bieding','biedingsbericht','biedingsoorlog','biedingsproces','biedingsstrijd','biedkoers','biedoorlog','biedplicht','biedprijs','biedronde','biedster','biedsysteem','bief','biefburger','biefstuk','biel','biels','bielsen','bielzen','bier','bieraccijns','bierazijn','bierbak','bierblikje','bierbottelarij','bierbrouwen','bierbrouwer','bierbrouwerij','bierbuik','bierconcern','biercultuur','bierdrinker','bieren','bierfabrikant','bierfeest','bierfles','bierflesje','biergebruik','biergigant','biergist','bierglas','biergroep','bierhal','bierhuis','bierkaai','bierkaartje','bierkan','bierkelder','bierkrat','bierkruik','bierliefhebber','bierlucht','biermagnaat','biermarkt','biermerk','bieromzet','bierpap','bierpomp','bierpot','bierprijs','bierproducent','bierproductie','bierpul','bierpulletje','bierpulletjes','bierreclame','biersector','biersoort','biersteker','bierstekerij','bierstelling','biertapperij','biertent','biertje','bierton','biervat','bierverbruik','bierverkoop','bierviltje','biervoorraad','bierwacht','bierwagen','bies','bieslook','biest','biet','bietebauw','bietencampagne','bietenkroot','bietenpulp','bietensalade','bietensap','bietensla','bietenstroop','bietje','biets','bietsen','bietser','bietsuiker','biezen','biezenmandje','biezenmat','biennale','bierschuim','biedermeiertje','biedverloop','biedermeiertijd','biedstijl','biergarten','biesbok','bietenteelt','bierconsumptie','bierkaart','biedingsprocedure','bierbostel','biercafe','bierfestival','bierfiets','bierkenner','bierland','biermuseum','bierpens','bierronde','biertap','bierteam','biertuin','bierwereld','bierwinkel','bietenbrug','bietensoep','bierindustrie','biedproces','bietenveld','bierbereiding','bierhandel','bierbeslag','biezenweide','bierbeek','bierk','bieke','biemans','biermans','bierings','biemond','bierens','bierbooms','bielderman','bierling','bierma','biesma','biesterbos','bieze','bierkens','bieleman','biesmans','biermann','bien','biegel','bielsma','biewenga','biekens','biel','bieleveld','biemolt','biesot','biere','biesen','biechtbriefjes','biechtelingen','biechtgeheimen','biechtspiegels','biechtstoelen','biechtte','biechtten','biechtvaders','bied','biedend','bieders','biedt','biefburgers','biefstukje','biefstukjes','biefstukken','bierblikjes','bierbrouwerijen','bierbrouwers','bierbuiken','bierconcerns','bierdrinkende','bierdrinkers','bierfabrikanten','bierflesjes','bierflessen','bierglazen','bierhandelaars','bierhuizen','bierkannen','bierkelders','bierkratten','bierkruiken','biermerken','bierpompen','bierpotten','bierpullen','bierstekerijen','bierstekers','bierstellingen','biertjes','biertonnen','biervaten','bierviltjes','bierwagens','biesde','biesje','biesjes','bietebauwen','bieten','bietjes','bietst','bietste','bietsten','biedende','biedingen','bierbakken','biervaatje','bierwachten','bietenkroten','biersoorten','biebs','bierkaartjes','biedermeiertjes','biechthokjes','biergartens','biesbokken','bietsers','biekes','bierliefhebbers','bierbuikje','bierkenners','bierprijzen','biertenten','bierkratjes','bierverkopen','bietenvelden','bierkratje','bierproducenten','bierbuikjes','bierhallen','biedrondes','bierreclames','biertuinen','bierfietsen','biezenmatten','biedprijzen','biergiganten','biermarkten','bierfeestje','biedkoersen','biedingsberichten','biedsystemen','bierfestivals','bierlanden','bieslandse'}
|
AddCSLuaFile()
DEFINE_BASECLASS( "base_gmodentity" )
ENT.PrintName = "Lamp"
ENT.Editable = true
AccessorFunc( ENT, "Texture", "FlashlightTexture" )
-- Set up our data table
function ENT:SetupDataTables()
self:NetworkVar( "Bool", 0, "On", { KeyName = "on", Edit = { type = "Boolean", order = 1, title = "#entedit.enabled" } } )
self:NetworkVar( "Bool", 1, "Toggle", { KeyName = "toggle", Edit = { type = "Boolean", order = 2, title = "#tool.lamp.toggle" } } )
self:NetworkVar( "Float", 0, "LightFOV", { KeyName = "fov", Edit = { type = "Float", order = 3, min = 10, max = 170, title = "#tool.lamp.fov" } } )
self:NetworkVar( "Float", 1, "Distance", { KeyName = "dist", Edit = { type = "Float", order = 4, min = 64, max = 2048, title = "#tool.lamp.distance" } } )
self:NetworkVar( "Float", 2, "Brightness", { KeyName = "bright", Edit = { type = "Float", order = 5, min = 0, max = 8, title = "#tool.lamp.brightness" } } )
if ( SERVER ) then
self:NetworkVarNotify( "On", self.OnUpdateLight )
self:NetworkVarNotify( "LightFOV", self.OnUpdateLight )
self:NetworkVarNotify( "Brightness", self.OnUpdateLight )
self:NetworkVarNotify( "Distance", self.OnUpdateLight )
end
end
-- Custom drive mode
function ENT:GetEntityDriveMode()
return "drive_noclip"
end
function ENT:Initialize()
if ( SERVER ) then
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_VPHYSICS )
self:SetSolid( SOLID_VPHYSICS )
self:DrawShadow( false )
local phys = self:GetPhysicsObject()
if ( IsValid( phys ) ) then phys:Wake() end
end
if ( CLIENT ) then
self.PixVis = util.GetPixelVisibleHandle()
end
end
if ( SERVER ) then
function ENT:Think()
self.BaseClass.Think( self )
if ( !IsValid( self.flashlight ) ) then return end
if ( string.FromColor( self.flashlight:GetColor() ) != string.FromColor( self:GetColor() ) ) then
self.flashlight:SetColor( self:GetColor() )
self:UpdateLight()
end
end
function ENT:OnTakeDamage( dmginfo )
self:TakePhysicsDamage( dmginfo )
end
function ENT:Use( activator, caller )
end
function ENT:Switch( bOn )
self:SetOn( bOn )
end
function ENT:OnSwitch( bOn )
if ( bOn == self:GetOn() ) then return end
if ( !bOn ) then
SafeRemoveEntity( self.flashlight )
self.flashlight = nil
return
end
self.flashlight = ents.Create( "env_projectedtexture" )
self.flashlight:SetParent( self )
-- The local positions are the offsets from parent..
self.flashlight:SetLocalPos( vector_origin )
self.flashlight:SetLocalAngles( angle_zero )
self.flashlight:SetKeyValue( "enableshadows", 1 )
self.flashlight:SetKeyValue( "nearz", 12 )
self.flashlight:SetKeyValue( "lightfov", math.Clamp( self:GetLightFOV(), 10, 170 ) )
local dist = self:GetDistance()
if ( !game.SinglePlayer() ) then dist = math.Clamp( dist, 64, 2048 ) end
self.flashlight:SetKeyValue( "farz", dist )
local c = self:GetColor()
local b = self:GetBrightness()
if ( !game.SinglePlayer() ) then b = math.Clamp( b, 0, 8 ) end
self.flashlight:SetKeyValue( "lightcolor", Format( "%i %i %i 255", c.r * b, c.g * b, c.b * b ) )
self.flashlight:Spawn()
self.flashlight:Input( "SpotlightTexture", NULL, NULL, self:GetFlashlightTexture() )
end
function ENT:Toggle()
self:SetOn( !self:GetOn() )
end
function ENT:OnUpdateLight( name, old, new )
if ( name == "On" ) then
self:OnSwitch( new )
end
if ( !IsValid( self.flashlight ) ) then return end
if ( name == "LightFOV" ) then
self.flashlight:Input( "FOV", NULL, NULL, tostring( math.Clamp( new, 10, 170 ) ) )
elseif ( name == "Distance" ) then
if ( !game.SinglePlayer() ) then new = math.Clamp( new, 64, 2048 ) end
self.flashlight:SetKeyValue( "farz", new )
elseif ( name == "Brightness" ) then
local c = self:GetColor()
local b = new
if ( !game.SinglePlayer() ) then b = math.Clamp( b, 0, 8 ) end
self.flashlight:SetKeyValue( "lightcolor", Format( "%i %i %i 255", c.r * b, c.g * b, c.b * b ) )
end
end
function ENT:UpdateLight()
if ( !IsValid( self.flashlight ) ) then return end
self.flashlight:Input( "SpotlightTexture", NULL, NULL, self:GetFlashlightTexture() )
self.flashlight:Input( "FOV", NULL, NULL, tostring( math.Clamp( self:GetLightFOV(), 10, 170 ) ) )
local dist = self:GetDistance()
if ( !game.SinglePlayer() ) then dist = math.Clamp( dist, 64, 2048 ) end
self.flashlight:SetKeyValue( "farz", dist )
local c = self:GetColor()
local b = self:GetBrightness()
if ( !game.SinglePlayer() ) then b = math.Clamp( b, 0, 8 ) end
self.flashlight:SetKeyValue( "lightcolor", Format( "%i %i %i 255", c.r * b, c.g * b, c.b * b ) )
end
-- The rest is for client only
return
end
-- Show the name of the player that spawned it..
function ENT:GetOverlayText()
return self:GetPlayerName()
end
local matLight = Material( "sprites/light_ignorez" )
--local matBeam = Material( "effects/lamp_beam" )
function ENT:DrawEffects()
-- No glow if we're not switched on!
if ( !self:GetOn() ) then return end
local LightNrm = self:GetAngles():Forward()
local ViewNormal = self:GetPos() - EyePos()
local Distance = ViewNormal:Length()
ViewNormal:Normalize()
local ViewDot = ViewNormal:Dot( LightNrm * -1 )
local LightPos = self:GetPos() + LightNrm * 5
-- glow sprite
--[[
render.SetMaterial( matBeam )
local BeamDot = BeamDot = 0.25
render.StartBeam( 3 )
render.AddBeam( LightPos + LightNrm * 1, 128, 0.0, Color( r, g, b, 255 * BeamDot) )
render.AddBeam( LightPos - LightNrm * 100, 128, 0.5, Color( r, g, b, 64 * BeamDot) )
render.AddBeam( LightPos - LightNrm * 200, 128, 1, Color( r, g, b, 0) )
render.EndBeam()
--]]
if ( ViewDot >= 0 ) then
render.SetMaterial( matLight )
local Visibile = util.PixelVisible( LightPos, 16, self.PixVis )
if ( !Visibile ) then return end
local Size = math.Clamp( Distance * Visibile * ViewDot * 2, 64, 512 )
Distance = math.Clamp( Distance, 32, 800 )
local Alpha = math.Clamp( ( 1000 - Distance ) * Visibile * ViewDot, 0, 100 )
local Col = self:GetColor()
Col.a = Alpha
render.DrawSprite( LightPos, Size, Size, Col, Visibile * ViewDot )
render.DrawSprite( LightPos, Size * 0.4, Size * 0.4, Color( 255, 255, 255, Alpha ), Visibile * ViewDot )
end
end
-- We have to do this to ensure DrawTranslucent is called for Opaque only models to draw our effects
ENT.RenderGroup = RENDERGROUP_BOTH
function ENT:DrawTranslucent( flags )
BaseClass.DrawTranslucent( self, flags )
self:DrawEffects()
end
|
local mod = DBM:NewMod(192, "DBM-Firelands", nil, 78)
local L = mod:GetLocalizedStrings()
local sndWOP = mod:SoundMM("SoundWOP")
mod:SetRevision(("$Revision: 79 $"):sub(12, -3))
mod:SetCreatureID(52498)
mod:SetZone()
mod:RegisterCombat("combat")
mod:RegisterEventsInCombat(
"SPELL_AURA_APPLIED",
"SPELL_AURA_REMOVED",
"SPELL_CAST_START",
"SPELL_CAST_SUCCESS",
"SPELL_DAMAGE",
"SPELL_MISSED",
"RAID_BOSS_EMOTE"
)
local warnSmolderingDevastation = mod:NewCountAnnounce(99052, 4)--Use count announce, cast time is pretty obvious from the bar, but it's useful to keep track how many of these have been cast.
local warnWidowKiss = mod:NewTargetAnnounce(99476, 3, nil, false)
local warnPhase2Soon = mod:NewPrePhaseAnnounce(2, 3)
local warnFixate = mod:NewTargetAnnounce(99526, 4)--Heroic ability
local specWarnFixate = mod:NewSpecialWarningYou(99526)
local specWarnTouchWidowKiss = mod:NewSpecialWarningYou(99476, mod:IsTank())
local specWarnSmolderingDevastation = mod:NewSpecialWarningSpell(99052)
local specWarnVolatilePoison = mod:NewSpecialWarningMove(99278)--Heroic ability
local specWarnTouchWidowKissOther = mod:NewSpecialWarningTarget(99476, mod:IsTank())
local timerSpinners = mod:NewNextTimer(15, "ej2770", nil, nil, nil, 97370) -- 15secs after Smoldering cast start
local timerSpiderlings = mod:NewNextTimer(30, "ej2778", nil, nil, nil, 72106)
local timerDrone = mod:NewNextTimer(60, "ej2773", nil, nil, nil, 28866)
local timerSmolderingDevastationCD = mod:NewNextCountTimer(90, 99052)
local timerEmberFlareCD = mod:NewNextTimer(6, 98934)
local timerSmolderingDevastation = mod:NewCastTimer(8, 99052)
local timerFixate = mod:NewTargetTimer(10, 99526)
local timerWidowKiss = mod:NewTargetTimer(23, 99476, nil, false)
local smolderingCount = 0
mod:AddBoolOption("SetIconOnFixate", true)
mod:AddBoolOption("RangeFrame")
function mod:repeatSpiderlings()
timerSpiderlings:Start()
self:ScheduleMethod(30, "repeatSpiderlings")
end
function mod:repeatDrone()
timerDrone:Start()
sndWOP:Schedule(60, "drone")
self:ScheduleMethod(60, "repeatDrone")
end
function mod:OnCombatStart(delay)
timerSmolderingDevastationCD:Start(82-delay, 1)
timerSpinners:Start(12-delay)
timerSpiderlings:Start(12.5-delay)
self:ScheduleMethod(11-delay , "repeatSpiderlings")
timerDrone:Start(45-delay)
sndWOP:Schedule(45-delay, "drone")
self:ScheduleMethod(45-delay, "repeatDrone")
smolderingCount = 0
end
function mod:OnCombatEnd()
if self.Options.RangeFrame then
DBM.RangeCheck:Hide()
end
end
function mod:SPELL_AURA_APPLIED(args)
if args:IsSpellID(99506) then--Applied debuff after cast. Used to announce special warnings and start target timer, only after application confirmed and not missed.
timerWidowKiss:Start(args.destName)
elseif args:IsSpellID(99526, 99559) and args:IsDestTypePlayer() then--99526 is on player, 99559 is on drone, leaving both for now with a filter, may remove 99559 and filter later.
warnFixate:Show(args.destName)
timerFixate:Start(args.destName)
if self.Options.SetIconOnFixate then
self:SetIcon(args.destName, 8, 10)
end
if args:IsPlayer() then
specWarnFixate:Show()
sndWOP:Play("awayspider")
end
end
end
function mod:SPELL_AURA_REMOVED(args)
if args:IsSpellID(99506) then
timerWidowKiss:Cancel(args.destName)
elseif args:IsSpellID(99526) then
if self.Options.SetIconOnFixate then
self:SetIcon(args.destName, 0)
end
end
end
function mod:SPELL_CAST_START(args)
if args:IsSpellID(99052) then
smolderingCount = smolderingCount + 1
warnSmolderingDevastation:Show(smolderingCount)
if self:GetUnitCreatureId("target") == 52498 or self:GetBossTarget(52498) == DBM:GetUnitFullName("target") then--If spider is you're target or it's tank is, you're up top.
specWarnSmolderingDevastation:Show()
end
sndWOP:Play("boomrun")
sndWOP:Schedule(5, "countthree")
sndWOP:Schedule(6, "counttwo")
sndWOP:Schedule(7, "countone")
timerSmolderingDevastation:Start()
timerEmberFlareCD:Cancel()--Cast immediately after Devastation, so don't need to really need to update timer, just cancel last one since it won't be cast during dev
if smolderingCount == 3 then -- 3rd cast = start P2
warnPhase2Soon:Show()
self:UnscheduleMethod("repeatSpiderlings")
self:UnscheduleMethod("repeatDrone")
timerSpiderlings:Cancel()
timerDrone:Cancel()
sndWOP:Cancel("drone")
if self.Options.RangeFrame and not DBM.RangeCheck:IsShown() and self:IsTank() then
DBM.RangeCheck:Show(10)
end
else
timerSmolderingDevastationCD:Start(90, smolderingCount+1)
timerSpinners:Start()
if smolderingCount == 2 then
sndWOP:Schedule(80, "ptwo")
end
end
end
end
function mod:SPELL_CAST_SUCCESS(args)
if args:IsSpellID(99476) then--Cast debuff only, don't add other spellid. (99476 spellid uses on SPELL_CAST_START, NOT SPELL_AURA_APPLIED),
warnWidowKiss:Show(args.destName)
if args:IsPlayer() then
specWarnTouchWidowKiss:Show()
else
specWarnTouchWidowKissOther:Show(args.destName)
end
if self:IsTank() or self:IsHealer() then
sndWOP:Play("changemt")
end
--Phase 1 ember flares. Only show for people who are actually up top.
elseif args:IsSpellID(98934, 100648, 100834, 100835) and (self:GetUnitCreatureId("target") == 52498 or self:GetBossTarget(52498) == DBM:GetUnitFullName("target")) then
timerEmberFlareCD:Start()
--Phase 2 ember flares. Show for everyone
elseif args:IsSpellID(99859, 100649, 100935, 100936) then
timerEmberFlareCD:Start()
end
end
function mod:SPELL_DAMAGE(_, _, _, _, destGUID, _, _, _, spellId)
if (spellId == 99278 or spellId == 101133) and destGUID == UnitGUID("player") and self:AntiSpam(3) then
specWarnVolatilePoison:Show()
sndWOP:Play("runaway")
end
end
mod.SPELL_MISSED = mod.SPELL_DAMAGE
function mod:RAID_BOSS_EMOTE(msg)
if msg == L.EmoteSpiderlings then
sndWOP:Play("spiderling")
self:UnscheduleMethod("repeatSpiderlings") -- in case it is off
self:repeatSpiderlings()
elseif msg == L.EmoteSpinners then
sndWOP:Schedule(1, "spinner")
sndWOP:Schedule(11, "spinner")
sndWOP:Schedule(21, "spinner")
end
end
|
addEventHandler("onClientResourceStart", resourceRoot,
function ()
b1 = guiCreateButton(429, 272, 136, 123, "", false)
guiSetAlpha(b1, 0.00)
guiSetProperty(b1, "NormalTextColour", "FFAAAAAA")
b2 = guiCreateButton(600, 273, 136, 123, "", false)
guiSetAlpha(b2, 0.00)
guiSetProperty(b2, "NormalTextColour", "FFAAAAAA")
b3 = guiCreateButton(772, 273, 136, 123, "", false)
guiSetAlpha(b3, 0.00)
guiSetProperty(b3, "NormalTextColour", "FFAAAAAA")
b4 = guiCreateButton(430, 431, 136, 123, "", false)
guiSetAlpha(b4, 0.00)
guiSetProperty(b4, "NormalTextColour", "FFAAAAAA")
b5 = guiCreateButton(600, 429, 136, 123, "", false)
guiSetAlpha(b5, 0.00)
guiSetProperty(b5, "NormalTextColour", "FFAAAAAA")
b6 = guiCreateButton(772, 431, 136, 123, "", false)
guiSetAlpha(b6, 0.00)
guiSetProperty(b6, "NormalTextColour", "FFAAAAAA")
--buy = guiCreateButton(569, 598, 203, 83, "", false)
--guiSetAlpha(buy, 0.00)
--guiSetProperty(buy, "NormalTextColour", "FFAAAAAA")
Close = guiCreateButton(888, 205, 20, 19, "", false)
guiSetAlpha(Close, 0.00)
guiSetProperty(Close, "NormalTextColour", "FFAAAAAA")
end
)
function dxbutton()
dxDrawLine(774 - 1, 431 - 1, 774 - 1, 553, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(911, 431 - 1, 774 - 1, 431 - 1, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(774 - 1, 553, 911, 553, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(911, 553, 911, 431 - 1, tocolor(62, 62, 62, 108), 1, false)
dxDrawRectangle(774, 431, 137, 122, tocolor(85, 85, 85, 90), false)
dxDrawLine(599 - 1, 430 - 1, 599 - 1, 552, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(736, 430 - 1, 599 - 1, 430 - 1, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(599 - 1, 552, 736, 552, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(736, 552, 736, 430 - 1, tocolor(62, 62, 62, 108), 1, false)
dxDrawRectangle(599, 430, 137, 122, tocolor(85, 85, 85, 90), false)
dxDrawLine(430 - 1, 431 - 1, 430 - 1, 553, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(567, 431 - 1, 430 - 1, 431 - 1, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(430 - 1, 553, 567, 553, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(567, 553, 567, 431 - 1, tocolor(62, 62, 62, 108), 1, false)
dxDrawRectangle(430, 431, 137, 122, tocolor(85, 85, 85, 90), false)
dxDrawLine(772 - 1, 273 - 1, 772 - 1, 395, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(909, 273 - 1, 772 - 1, 273 - 1, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(772 - 1, 395, 909, 395, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(909, 395, 909, 273 - 1, tocolor(62, 62, 62, 108), 1, false)
dxDrawRectangle(772, 273, 137, 122, tocolor(85, 85, 85, 90), false)
dxDrawLine(599 - 1, 273 - 1, 599 - 1, 395, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(736, 273 - 1, 599 - 1, 273 - 1, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(599 - 1, 395, 736, 395, tocolor(62, 62, 62, 108), 1, false)
dxDrawLine(736, 395, 736, 273 - 1, tocolor(62, 62, 62, 108), 1, false)
dxDrawRectangle(599, 273, 137, 122, tocolor(85, 85, 85, 90), false)
dxDrawImage(772, 430, 139, 123, "img/8.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(597, 430, 139, 123, "img/11.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(428, 430, 138, 121, "img/12.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(772, 272, 137, 120, "img/13.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(599, 271, 137, 124, "img/14.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawLine(428 - 1, 273 - 1, 428 - 1, 395, tocolor(62, 62, 62, 90), 1, false)
dxDrawLine(565, 273 - 1, 428 - 1, 273 - 1, tocolor(62, 62, 62, 90), 1, false)
dxDrawLine(428 - 1, 395, 565, 395, tocolor(62, 62, 62, 90), 1, false)
dxDrawLine(565, 395, 565, 273 - 1, tocolor(62, 62, 62, 90), 1, false)
dxDrawRectangle(428, 273, 137, 122, tocolor(85, 85, 85, 90), false)
dxDrawImage(428, 271, 139, 124, "img/1.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawLine(567 - 1, 597 - 1, 567 - 1, 681, tocolor(51, 51, 51, 108), 1, false)
--dxDrawLine(772, 597 - 1, 567 - 1, 597 - 1, tocolor(51, 51, 51, 108), 1, false)
--dxDrawLine(567 - 1, 681, 772, 681, tocolor(51, 51, 51, 108), 1, false)
--dxDrawLine(772, 681, 772, 597 - 1, tocolor(51, 51, 51, 108), 1, false)
--dxDrawRectangle(567, 597, 205, 84, tocolor(51, 51, 51, 108), false)
--dxDrawText("Buy", 568, 598, 772, 681, tocolor(4, 101, 0, 206), 3.00, "pricedown", "center", "center", false, false, false, false, false)
dxDrawRectangle(886, 203, 23, 21, tocolor(87, 0, 0, 206), false)
dxDrawText("X", 887, 204, 908, 224, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)
dxDrawLine(429 - 1, 402 - 1, 429 - 1, 421, tocolor(43, 43, 43, 161), 1, false)
dxDrawLine(908, 402 - 1, 429 - 1, 402 - 1, tocolor(43, 43, 43, 161), 1, false)
dxDrawLine(429 - 1, 421, 908, 421, tocolor(43, 43, 43, 161), 1, false)
dxDrawLine(908, 421, 908, 402 - 1, tocolor(43, 43, 43, 161), 1, false)
dxDrawRectangle(429, 402, 479, 19, tocolor(74, 74, 74, 161), false)
dxDrawLine(429 - 1, 562 - 1, 429 - 1, 581, tocolor(43, 43, 43, 161), 1, false)
dxDrawLine(908, 562 - 1, 429 - 1, 562 - 1, tocolor(43, 43, 43, 161), 1, false)
dxDrawLine(429 - 1, 581, 908, 581, tocolor(43, 43, 43, 161), 1, false)
dxDrawLine(908, 581, 908, 562 - 1, tocolor(43, 43, 43, 161), 1, false)
dxDrawRectangle(429, 562, 479, 19, tocolor(74, 74, 74, 161), false)
dxDrawText("8$", 432, 403, 563, 421, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
dxDrawText("5$", 600, 403, 731, 421, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
dxDrawText("3$", 777, 402, 908, 420, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
dxDrawText("15$", 429, 563, 560, 581, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
dxDrawText("13$", 599, 564, 730, 582, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
dxDrawText("7$", 777, 563, 908, 581, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "top", false, false, false, false, false)
dxDrawLine(754, 563, 754, 580, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(577, 562, 577, 579, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(578, 403, 578, 420, tocolor(255, 255, 255, 255), 1, false)
dxDrawLine(753, 402, 753, 419, tocolor(255, 255, 255, 255), 1, false)
end
function dXpanel ()
local showed = not showed
if showed then
addEventHandler("onClientRender",root,dxbutton)
showCursor ( true )
end
end
addEvent("onHitMarkerShowDxPanel",true)
addEventHandler("onHitMarkerShowDxPanel",localPlayer,dXpanel)
--bindKey ("F7","down", dXpanel)
function Closing ()
if (source==Close) then
removeEventHandler("onClientRender", root, dxbutton)
showCursor ( false )
end
end
addEventHandler ("onClientGUIClick",root,Closing)
function buttonFood1 ()
if (source==b1)then
setPedAnimation( localPlayer, "vending", "vend_use" )
triggerServerEvent ( "takeMoneysB1", localPlayer)
setTimer(function()
setPedAnimation(localPlayer)
end, 2600, 0)
end
end
addEventHandler ("onClientGUIClick",root,buttonFood1)
function buttonFood2 ()
if (source==b2)then
setPedAnimation( localPlayer, "vending", "vend_use" )
triggerServerEvent ( "takeMoneysB2", localPlayer)
setTimer(function()
setPedAnimation(localPlayer)
end, 2600, 0)
end
end
addEventHandler ("onClientGUIClick",root,buttonFood2)
function buttonFood3 ()
if (source==b3)then
setPedAnimation( localPlayer, "vending", "vend_use" )
triggerServerEvent ( "takeMoneysB3", localPlayer)
setTimer(function()
setPedAnimation(localPlayer)
end, 2600, 0)
end
end
addEventHandler ("onClientGUIClick",root,buttonFood3)
function buttonFood4 ()
if (source==b4)then
setPedAnimation( localPlayer, "vending", "vend_use" )
triggerServerEvent ( "takeMoneysB4", localPlayer)
setTimer(function()
setPedAnimation(localPlayer)
end, 2600, 0)
end
end
addEventHandler ("onClientGUIClick",root,buttonFood4)
function buttonFood5 ()
if (source==b5)then
setPedAnimation( localPlayer, "vending", "vend_use" )
triggerServerEvent ( "takeMoneysB5", localPlayer)
setTimer(function()
setPedAnimation(localPlayer)
end, 2600, 0)
end
end
addEventHandler ("onClientGUIClick",root,buttonFood5)
function buttonFood6 ()
if (source==b6)then
setPedAnimation( localPlayer, "vending", "vend_use" )
triggerServerEvent ( "takeMoneysB6", localPlayer)
setTimer(function()
setPedAnimation(localPlayer)
end, 2600, 0)
end
end
addEventHandler ("onClientGUIClick",root,buttonFood6)
|
function shorten_str (str)
if str:len() > 30 then
return str:sub(1,30) .. ".."
else
return str
end
end
require'lualine'.setup {
options = {
theme = 'auto',
section_separators = {'', ''},
component_separators = {'', ''}
},
sections = {
lualine_a = {{'mode', fmt = function(str) return str:sub(1,1) end}},
lualine_b = {{'branch', fmt = shorten_str}},
lualine_c = {
{
'filename',
file_status = true, -- displays file status (readonly status, modified status)
path = 1, -- 0 = just filename, 1 = relative path, 2 = absolute path
shorting_target = 40 -- Shortens path to leave 40 space in the window
}
},
lualine_x = {'encoding', 'fileformat', {'filetype', colored = false}},
lualine_y = {'progress'},
lualine_z = {'location'}
},
extensions = {'nvim-tree', 'fzf'}
}
|
local finders = require('telescope.finders')
local pickers = require('telescope.pickers')
local actions = require('telescope.actions')
local conf = require('telescope.config').values
local function file_exists(file)
local f = io.open(file, "rb")
if f then f:close() end
return f ~= nil
end
local function read_file(file)
local entries = {}
if not file_exists(file) then return {} end
for line in io.lines(file) do
if line:match("@%w*{") then
local entry = line:gsub("@%w*{", "")
entry = entry:sub(1, -2)
entries[#entries + 1] = entry
end
end
return entries
end
local function bibtex_picker(opts)
local directory = io.popen('find . -maxdepth 1 -type f -name "*.bib"')
local references = {}
for file in directory:lines() do
table.insert(references, file:sub(3))
end
directory:close()
opts = opts or {}
local results = {}
for _, r in pairs(references) do
local result = read_file(r)
for _, entry in pairs(result) do
table.insert(results, entry)
end
end
pickers.new(opts, {
prompt_title = 'Bibtex References',
finder = finders.new_table {
results = results,
entry_maker = function(line)
return {
value = line,
ordinal = line,
display = line
}
end
},
previewer = nil,
sorter = conf.generic_sorter(opts),
attach_mappings = function(prompt_bufnr)
actions._goto_file_selection:replace(function(_, _)
local entry = "\\cite{"..actions.get_selected_entry().value.."}"
actions.close(prompt_bufnr)
vim.api.nvim_put({entry}, "", true, true)
-- TODO: prettier insert mode? <16-01-21, @noahares> --
vim.api.nvim_feedkeys("A", "n", true)
end)
return true
end,
}):find()
end
return {
bibtex_picker = bibtex_picker
}
|
Assets = require "modules/assets"
MapTools = require "modules/MapTools"
Settings = require "modules/Settings"
l = require "modules/l"
-- local defaultImg = Assets.images.enemy_lvl_1
counter = 0
-- Pawns (enemies)
enemy = {
state = 1,
name = 'Enemy',
img = Assets.enemies[1],
xPos = 65,
yPos = 129,
prevTile = {},
currentTile = {},
speed = 4,
hp = 500,
mana = 100,
rechargeTimer = 2,
onMap = false,
direction = 0,
xOffset = 0,
yOffset = 0
}
function enemy:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
return o
end
function enemy.update(dt)
enemy.spawn(dt)
for i,pawn in ipairs(activeWave) do
local prevTile, nextTile, e_direction = MapTools.getNextCell(map, pawn.prevTile, pawn.currentTile)
if prevTile.isLast then
table.remove(activeWave, i)
player_lives = player_lives - 1
end
pawn.direction = math.rad(e_direction)
if e_direction == 180 then
pawn.xOffset = 64
pawn.yOffset = 64
elseif e_direction == 270 then
pawn.xOffset = 0
pawn.yOffset = 0
elseif e_direction == 90 then
pawn.xOffset = 64
pawn.yOffset = 64
else
pawn.xOffset = 0
pawn.yOffset = 0
end
if pawn.xPos > nextTile.xPos then
if nextTile.xPos > pawn.xPos - pawn.speed then
pawn.xPos = nextTile.xPos
else
pawn.xPos = pawn.xPos - pawn.speed
end
elseif pawn.xPos < nextTile.xPos then
if nextTile.xPos < pawn.xPos + pawn.speed then
pawn.xPos = nextTile.xPos
else
pawn.xPos = pawn.xPos + pawn.speed
end
elseif pawn.yPos > nextTile.yPos then
if nextTile.yPos > pawn.yPos - pawn.speed then
pawn.yPos = nextTile.yPos
else
pawn.yPos = pawn.yPos - pawn.speed
end
elseif pawn.yPos < nextTile.yPos then
if nextTile.yPos < pawn.yPos + pawn.speed then
pawn.yPos = nextTile.yPos
else
pawn.yPos = pawn.yPos + pawn.speed
end
elseif pawn.xPos == nextTile.xPos and pawn.yPos == nextTile.yPos then
pawn.prevTile = prevTile
pawn.currentTile = nextTile
end
end
end
function enemy.draw()
for i,enemy in ipairs(activeWave) do
if enemy.onMap then
-- if enemy.direction == math.pi or 0 then
-- l.d(enemy.img, enemy.yPos, enemy.xPos, enemy.direction, 1, 1)
l.d(enemy.img, enemy.yPos, enemy.xPos, enemy.direction, 1, 1, enemy.xOffset, enemy.yOffset)
-- else
-- l.d(enemy.img, enemy.yPos, enemy.xPos, enemy.direction, 1, 1, 64, 64)
-- end
end
end
end
function enemy.spawn(dt)
spawnTimer = spawnTimer - dt
if spawnTimer <= 0 then
local enemy = Enemy:new()
enemy.prevTile = map[3][2]
enemy.currentTile = map[3][3]
enemy.name = enemy.name .. ' ' .. counter
enemy.onMap = true
if enemiesLeft > 0 then
table.insert(activeWave, enemy)
enemiesLeft = enemiesLeft - 1
end
counter = counter + 1
spawnTimer = 1
end
end
function enemy.calculateReward(target)
return ((target.hp * target.speed)/2) * -1
end
function enemy.upgradeEnemy()
enemy.name = 'Enemy' .. ' ' .. wave_index
enemy.img = Assets.enemies[wave_index]
enemy.speed = enemy.speed + 0.5
enemy.hp = enemy.hp + 50
enemy.mana = enemy.mana + 100
print('Enemy upgraded')
end
return enemy
|
{
["xOffset"] = -404.99997701562,
["BFbackdrop"] = false,
["yOffset"] = -160.00002024313,
["anchorPoint"] = "CENTER",
["customTextUpdate"] = "update",
["actions"] = {
["start"] = {
["do_glow"] = true,
["glow_frame"] = "WeakAuras:++Focus",
["glow_action"] = "show",
},
["finish"] = {
},
},
["fontFlags"] = "OUTLINE",
["animation"] = {
["start"] = {
["duration_type"] = "seconds",
["type"] = "none",
},
["main"] = {
["duration_type"] = "seconds",
["type"] = "none",
},
["finish"] = {
["duration_type"] = "seconds",
["type"] = "none",
},
},
["trigger"] = {
["rem"] = "3",
["use_power"] = false,
["use_character"] = false,
["hand"] = "main",
["spellName"] = 0,
["use_resting"] = false,
["use_health"] = false,
["subeventSuffix"] = "_CAST_START",
["use_pvpflagged"] = false,
["event"] = "Chat Message",
["use_name"] = true,
["check"] = "update",
["itemName"] = 0,
["use_hostility"] = false,
["use_inverse"] = true,
["subeventPrefix"] = "SPELL",
["use_class"] = false,
["use_hand"] = true,
["custom_type"] = "status",
["custom_hide"] = "custom",
["use_HasPet"] = true,
["debuffType"] = "HELPFUL",
["use_mounted"] = true,
["type"] = "custom",
["use_level"] = false,
["unevent"] = "auto",
["use_unit"] = true,
["names"] = {
[1] = "Mark of the Wild",
},
["inverse"] = true,
["unit"] = "focus",
["use_threatUnit"] = true,
["use_spellName"] = true,
["custom"] = "function()\n if not UnitExists(\"focus\") then\n return true\n end\nend",
["events"] = "PLAYER_FOCUS_CHANGED",
["remOperator"] = "<=",
["use_percenthealth"] = false,
["use_itemName"] = true,
["rune"] = 0,
},
["desaturate"] = false,
["font"] = "Friz Quadrata TT",
["height"] = 64,
["load"] = {
["use_size"] = false,
["use_never"] = false,
["spec"] = {
["multi"] = {
},
},
["use_name"] = false,
["role"] = {
["single"] = "TANK",
["multi"] = {
["DAMAGER"] = true,
["TANK"] = true,
},
},
["name"] = "Mimayuri",
["use_class"] = false,
["use_difficulty"] = false,
["class"] = {
["single"] = "WARRIOR",
["multi"] = {
["MAGE"] = true,
["PRIEST"] = true,
["PALADIN"] = true,
["SHAMAN"] = true,
},
},
["size"] = {
["multi"] = {
["ten"] = true,
["twentyfive"] = true,
["party"] = true,
},
},
},
["fontSize"] = 12,
["displayStacks"] = "%s",
["regionType"] = "icon",
["iconInset"] = 0,
["selfPoint"] = "CENTER",
["BFskin"] = "Blizzard",
["icon"] = true,
["stickyDuration"] = false,
["stacksContainment"] = "INSIDE",
["zoom"] = 0,
["auto"] = false,
["untrigger"] = {
["use_name"] = false,
["custom"] = "function()\n if UnitExists(\"focus\") then\n return true\n end\nend",
["unit"] = "focus",
["use_level"] = false,
["use_character"] = false,
["use_unit"] = true,
},
["additional_triggers"] = {
},
["BFgloss"] = 0,
["frameStrata"] = 1,
["width"] = 64,
["disjunctive"] = true,
["color"] = {
[1] = 1,
[2] = 1,
[3] = 1,
[4] = 1,
},
["numTriggers"] = 1,
["inverse"] = false,
["id"] = "--Focus",
["displayIcon"] = "Interface\\Icons\\Ability_Warrior_FocusedRage",
["stacksPoint"] = "BOTTOMRIGHT",
["textColor"] = {
[1] = 1,
[2] = 1,
[3] = 1,
[4] = 1,
},
}
|
return {
lintCommand = "rustfmt",
lintStdin = true,
formatCommand = "rustfmt",
formatStdin = true
}
|
local local0 = 2.2
local local1 = 0 - local0
local local2 = 0 - local0
local local3 = 0 - local0
local local4 = 0 - local0
local local5 = 0 - local0
local local6 = 0 - local0
local local7 = 0 - local0
local local8 = 3.2 - local0
local local9 = 0 - local0
local local10 = 6.4 - local0
local local11 = 0 - local0
local local12 = 5 - local0
local local13 = 0 - local0
local local14 = 7 - local0
local local15 = 0 - local0
local local16 = 8.4 - local0
function OnIf_251000(arg0, arg1, arg2)
if arg2 == 0 then
IllegitimateChildren251000_ActAfter_RealTime(arg0, arg1)
end
return
end
function IllegitimateChildren251000Battle_Activate(arg0, arg1)
local local0 = {}
local local1 = {}
local local2 = {}
Common_Clear_Param(local0, local1, local2)
local local3 = 1
local local4 = 1
local local5 = 1
local local6 = 1
local local7 = 1
if arg0:HasSpecialEffectId(TARGET_SELF, 480) then
local3 = 0
end
if arg0:HasSpecialEffectId(TARGET_SELF, 481) then
local4 = 0
end
if arg0:HasSpecialEffectId(TARGET_SELF, 482) then
local5 = 0
end
if arg0:HasSpecialEffectId(TARGET_SELF, 483) then
local6 = 0
end
if arg0:HasSpecialEffectId(TARGET_SELF, 484) then
local7 = 0
end
local local8 = arg0:GetDist(TARGET_ENE_0)
local local9 = arg0:GetRandam_Int(1, 100)
local local10 = 1
local local11 = 1
local local12 = 1
local local13 = 1
local local14 = arg0:GetHpRate(TARGET_SELF)
local local15 = 6
local local16 = 3
local local17 = arg0:GetNumber(2)
if arg0:IsFinishTimer(0) == false then
local10 = 0
end
if arg0:IsFinishTimer(2) == false then
local11 = 0
end
if arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_F, 30) == false then
local12 = 0
end
if local8 < 13 or arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_F, 30) == false then
local13 = 0
end
if arg0:GetEventRequest(0) == 100 then
local0[26] = 100
elseif arg0:GetNumber(0) < 1 and local14 < 0.75 then
local0[25] = 100
elseif local3 + local4 + local5 + local6 + local7 < 5 and local14 < 0.5 and arg0:IsFinishTimer(3) == true then
local0[21] = 100
elseif arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_B, 180) then
local0[20] = 100
elseif 0.75 <= local14 then
if local15 <= local8 then
local0[1] = 20 * local4
if local17 == 1 and 0 < local0[1] then
local0[1] = 1
end
local0[2] = 15 * local5
if local17 == 2 and 0 < local0[2] then
local0[2] = 1
end
local0[3] = 10 * local4 * local5
if local17 == 3 and 0 < local0[3] then
local0[3] = 1
end
local0[10] = 20 * local5
if local17 == 10 and 0 < local0[10] then
local0[10] = 1
end
local0[11] = 20 * local4
if local17 == 11 and 0 < local0[11] then
local0[11] = 1
end
local0[13] = 15
if local17 == 13 and 0 < local0[13] then
local0[13] = 1
end
local0[18] = 25 * local12
if local17 == 18 and 0 < local0[18] then
local0[18] = 1
end
elseif local16 <= local8 then
local0[1] = 20 * local4
if local17 == 1 and 0 < local0[1] then
local0[1] = 1
end
local0[2] = 15 * local5
if local17 == 2 and 0 < local0[2] then
local0[2] = 1
end
local0[3] = 10 * local4 * local5
if local17 == 3 and 0 < local0[3] then
local0[3] = 1
end
local0[10] = 20 * local5
if local17 == 10 and 0 < local0[10] then
local0[10] = 1
end
local0[11] = 20 * local4
if local17 == 11 and 0 < local0[11] then
local0[11] = 1
end
local0[13] = 15
if local17 == 13 and 0 < local0[13] then
local0[13] = 1
end
local0[18] = 25 * local12
if local17 == 18 and 0 < local0[18] then
local0[18] = 1
end
else
local0[4] = 20
if local17 == 4 and 0 < local0[4] then
local0[4] = 1
end
local0[8] = 30 * local4
if local17 == 8 and 0 < local0[8] then
local0[8] = 1
end
local0[9] = 30 * local5
if local17 == 9 and 0 < local0[9] then
local0[9] = 1
end
local0[12] = 20
if local17 == 12 and 0 < local0[12] then
local0[12] = 1
end
end
elseif 0.5 <= local14 then
if local15 <= local8 then
local0[15] = 20
if local17 == 15 and 0 < local0[15] then
local0[15] = 1
end
local0[1] = 10 * local4
if local17 == 1 and 0 < local0[1] then
local0[1] = 1
end
local0[2] = 10 * local5
if local17 == 2 and 0 < local0[2] then
local0[2] = 1
end
local0[3] = 10 * local4 * local5
if local17 == 3 and 0 < local0[3] then
local0[3] = 1
end
local0[10] = 5 * local5
if local17 == 10 and 0 < local0[10] then
local0[10] = 1
end
local0[11] = 5 * local4
if local17 == 11 and 0 < local0[11] then
local0[11] = 1
end
local0[13] = 10
if local17 == 13 and 0 < local0[13] then
local0[13] = 1
end
local0[18] = 40 * local12
if local17 == 18 and 0 < local0[18] then
local0[18] = 1
end
local0[7] = 10 * local11
if local17 == 7 and 0 < local0[7] then
local0[7] = 1
end
local0[5] = 20
if local17 == 5 and 0 < local0[5] then
local0[5] = 1
end
elseif local16 <= local8 then
local0[1] = 10 * local4
if local17 == 1 and 0 < local0[1] then
local0[1] = 1
end
local0[2] = 10 * local5
if local17 == 2 and 0 < local0[2] then
local0[2] = 1
end
local0[3] = 10 * local4 * local5
if local17 == 3 and 0 < local0[3] then
local0[3] = 1
end
local0[10] = 10 * local5
if local17 == 10 and 0 < local0[10] then
local0[10] = 1
end
local0[11] = 10 * local4
if local17 == 11 and 0 < local0[11] then
local0[11] = 1
end
local0[13] = 10
if local17 == 13 and 0 < local0[13] then
local0[13] = 1
end
local0[18] = 40 * local12
if local17 == 18 and 0 < local0[18] then
local0[18] = 1
end
local0[7] = 20 * local11
if local17 == 7 and 0 < local0[7] then
local0[7] = 1
end
local0[5] = 20
if local17 == 5 and 0 < local0[5] then
local0[5] = 1
end
else
local0[4] = 20
if local17 == 4 and 0 < local0[4] then
local0[4] = 1
end
local0[8] = 30 * local4
if local17 == 8 and 0 < local0[8] then
local0[8] = 1
end
local0[9] = 30 * local5
if local17 == 9 and 0 < local0[9] then
local0[9] = 1
end
local0[12] = 20
if local17 == 12 and 0 < local0[12] then
local0[12] = 1
end
end
elseif local15 <= local8 then
local0[15] = 20
if local17 == 15 and 0 < local0[15] then
local0[15] = 1
end
local0[6] = 130 * local10
if local17 == 6 and 0 < local0[6] then
local0[6] = 1
end
local0[22] = 5 * local4
if local17 == 22 and 0 < local0[22] then
local0[22] = 1
end
local0[23] = 5 * local5
if local17 == 23 and 0 < local0[23] then
local0[23] = 1
end
local0[24] = 5 * local4 * local5
if local17 == 24 and 0 < local0[24] then
local0[24] = 1
end
local0[13] = 5
if local17 == 13 and 0 < local0[13] then
local0[13] = 1
end
local0[18] = 30 * local12
if local17 == 18 and 0 < local0[18] then
local0[18] = 1
end
local0[7] = 10 * local11
if local17 == 7 and 0 < local0[7] then
local0[7] = 1
end
local0[5] = 10
if local17 == 5 and 0 < local0[5] then
local0[5] = 1
end
local0[16] = 10
if local17 == 16 and 0 < local0[16] then
local0[16] = 1
end
local0[19] = 80 * local13
if local17 == 19 and 0 < local0[19] then
local0[19] = 1
end
elseif local16 <= local8 then
local0[6] = 110 * local10
if local17 == 6 and 0 < local0[6] then
local0[6] = 1
end
local0[22] = 10 * local4
if local17 == 22 and 0 < local0[22] then
local0[22] = 1
end
local0[23] = 10 * local5
if local17 == 23 and 0 < local0[23] then
local0[23] = 1
end
local0[24] = 10 * local4 * local5
if local17 == 24 and 0 < local0[24] then
local0[24] = 1
end
local0[13] = 10
if local17 == 13 and 0 < local0[13] then
local0[13] = 1
end
local0[18] = 30 * local12
if local17 == 18 and 0 < local0[18] then
local0[18] = 1
end
local0[7] = 20 * local11
if local17 == 7 and 0 < local0[7] then
local0[7] = 1
end
local0[5] = 10
if local17 == 5 and 0 < local0[5] then
local0[5] = 1
end
local0[16] = 20
if local17 == 16 and 0 < local0[16] then
local0[16] = 1
end
else
local0[6] = 110 * local10
if local17 == 6 and 0 < local0[6] then
local0[6] = 1
end
local0[4] = 15
if local17 == 4 and 0 < local0[4] then
local0[4] = 1
end
local0[8] = 20 * local4
if local17 == 8 and 0 < local0[8] then
local0[8] = 1
end
local0[9] = 20 * local5
if local17 == 9 and 0 < local0[9] then
local0[9] = 1
end
local0[12] = 15
if local17 == 12 and 0 < local0[12] then
local0[12] = 1
end
local0[17] = 20
if local17 == 17 and 0 < local0[17] then
local0[17] = 1
end
end
local1[1] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act01)
local1[2] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act02)
local1[3] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act03)
local1[4] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act04)
local1[5] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act05)
local1[6] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act06)
local1[7] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act07)
local1[8] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act08)
local1[9] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act09)
local1[10] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act10)
local1[11] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act11)
local1[12] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act12)
local1[13] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act13)
local1[15] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act15)
local1[16] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act16)
local1[17] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act17)
local1[18] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act18)
local1[19] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act19)
local1[20] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act20)
local1[21] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act21)
local1[22] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act22)
local1[23] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act23)
local1[24] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act24)
local1[25] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act25)
local1[26] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act26)
local1[30] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act30)
local1[31] = REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_Act31)
Common_Battle_Activate(arg0, arg1, local0, local1, REGIST_FUNC(arg0, arg1, IllegitimateChildren251000_ActAfter_AdjustSpace), local2)
return
end
local0 = 8.4 - local0
function IllegitimateChildren251000_Act01(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = 9999
local local2 = UPVAL0 + 1
local local3 = arg0:GetRandam_Int(1, 100)
local local4 = arg0:GetRandam_Int(1, 100)
local local5 = arg0:GetHpRate(TARGET_SELF)
local local6 = 1
local local7 = 1
if arg0:HasSpecialEffectId(TARGET_SELF, 482) then
local6 = 0
end
if arg0:HasSpecialEffectId(TARGET_SELF, 481) then
local7 = 0
end
if local5 < 0.5 then
local1 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local5 < 0.5 then
local2 = 999
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local1, 0, 3)
end
if local4 <= 33 or local6 == 0 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3000, TARGET_ENE_0, local2, 0, -1)
elseif local4 <= 67 then
arg1:AddSubGoal(GOAL_COMMON_ComboAttackTunableSpin, 10, 3000, TARGET_ENE_0, local2, 0, -1)
arg1:AddSubGoal(GOAL_COMMON_ComboFinal, 10, 3001, TARGET_ENE_0, local2, 0, -1)
else
arg1:AddSubGoal(GOAL_COMMON_ComboAttackTunableSpin, 10, 3000, TARGET_ENE_0, local2, 0, -1)
arg1:AddSubGoal(GOAL_COMMON_ComboRepeat, 10, 3001, TARGET_ENE_0, local2, 0, -1)
arg1:AddSubGoal(GOAL_COMMON_ComboFinal, 10, 3003, TARGET_ENE_0, local2, 0, -1)
end
arg0:SetNumber(2, 1)
GetWellSpace_Odds = 33
return GetWellSpace_Odds
end
local0 = 8.8 - local0
function IllegitimateChildren251000_Act02(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = 9999
local local2 = UPVAL0 + 1
local local3 = arg0:GetRandam_Int(1, 100)
local local4 = arg0:GetHpRate(TARGET_SELF)
local local5 = 1
local local6 = 1
if arg0:HasSpecialEffectId(TARGET_SELF, 482) then
local5 = 0
end
if arg0:HasSpecialEffectId(TARGET_SELF, 481) then
local6 = 0
end
if local4 < 0.5 then
local1 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local4 < 0.5 then
local2 = 999
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local1, 0, 3)
end
if arg0:GetRandam_Int(1, 100) <= 50 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3002, TARGET_ENE_0, local2, 0, -1)
else
arg1:AddSubGoal(GOAL_COMMON_ComboAttackTunableSpin, 10, 3002, TARGET_ENE_0, local2, 0, -1)
arg1:AddSubGoal(GOAL_COMMON_ComboFinal, 10, 3003, TARGET_ENE_0, local2, 0, -1)
end
arg0:SetNumber(2, 2)
GetWellSpace_Odds = 33
return GetWellSpace_Odds
end
local0 = 9.8 - local0
function IllegitimateChildren251000_Act03(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = 9999
local local2 = arg0:GetRandam_Int(1, 100)
local local3 = arg0:GetHpRate(TARGET_SELF)
local local4 = 1
local local5 = 1
if arg0:HasSpecialEffectId(TARGET_SELF, 482) then
local4 = 0
end
if arg0:HasSpecialEffectId(TARGET_SELF, 481) then
local5 = 0
end
if local3 < 0.5 then
local1 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local3 < 0.5 then
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local1, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3004, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 3)
GetWellSpace_Odds = 33
return GetWellSpace_Odds
end
local0 = 7 - local0
function IllegitimateChildren251000_Act04(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = 9999
local local2 = arg0:GetRandam_Int(1, 100)
local local3 = arg0:GetHpRate(TARGET_SELF)
if local3 < 0.5 then
local1 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local3 < 0.5 then
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local1, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3005, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 4)
GetWellSpace_Odds = 75
return GetWellSpace_Odds
end
local0 = 14.4 - local0
local0 = 0 - local0
function IllegitimateChildren251000_Act05(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = UPVAL1
local local2 = 9999
local local3 = UPVAL0 + 1
local local4 = arg0:GetRandam_Int(1, 100)
local local5 = arg0:GetHpRate(TARGET_SELF)
if local5 < 0.5 then
local2 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local5 < 0.5 then
local3 = 999
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local2, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3006, TARGET_ENE_0, local3, 0, -1)
arg0:SetNumber(2, 5)
if arg0:GetNumber(0) == 0 then
arg0:SetNumber(0, 1)
end
GetWellSpace_Odds = 50
return GetWellSpace_Odds
end
local0 = 999 - local0
local0 = 0 - local0
function IllegitimateChildren251000_Act06(arg0, arg1, arg2)
local local0 = arg0:GetDist(TARGET_ENE_0)
local local1 = UPVAL0
local local2 = UPVAL1
local local3 = 9999
local local4 = 0
local local5 = arg0:GetRandam_Int(1, 100)
if arg0:GetHpRate(TARGET_SELF) < 0.5 then
local3 = 0
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3007, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 6)
arg0:SetTimer(0, 30)
if arg0:GetNumber(0) == 1 then
arg0:SetNumber(0, 2)
end
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = 11.4 - local0
local0 = 0 - local0
function IllegitimateChildren251000_Act07(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = UPVAL1
local local2 = 9999
local local3 = arg0:GetRandam_Int(1, 100)
local local4 = arg0:GetHpRate(TARGET_SELF)
if local4 < 0.5 then
local2 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local4 < 0.5 then
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local2, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3008, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 7)
arg0:SetTimer(2, 30)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = local8
local0 = 0 - local0
function IllegitimateChildren251000_Act08(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = UPVAL1
local local2 = 9999
local local3 = arg0:GetRandam_Int(1, 100)
local local4 = arg0:GetHpRate(TARGET_SELF)
if local4 < 0.5 then
local2 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local4 < 0.5 then
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local2, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3015, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 8)
GetWellSpace_Odds = 25
return GetWellSpace_Odds
end
local0 = 3.6 - local0
local0 = 0 - local0
function IllegitimateChildren251000_Act09(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = UPVAL1
local local2 = 9999
local local3 = arg0:GetRandam_Int(1, 100)
local local4 = arg0:GetHpRate(TARGET_SELF)
if local4 < 0.5 then
local2 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local4 < 0.5 then
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local2, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3016, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 9)
GetWellSpace_Odds = 25
return GetWellSpace_Odds
end
local0 = 9.4 - local0
local0 = 0 - local0
function IllegitimateChildren251000_Act10(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = UPVAL1
local local2 = 9999
local local3 = arg0:GetRandam_Int(1, 100)
local local4 = arg0:GetHpRate(TARGET_SELF)
if local4 < 0.5 then
local2 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local4 < 0.5 then
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local2, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3017, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 10)
GetWellSpace_Odds = 25
return GetWellSpace_Odds
end
local0 = 8.2 - local0
local0 = 0 - local0
function IllegitimateChildren251000_Act11(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = UPVAL1
local local2 = 9999
local local3 = arg0:GetRandam_Int(1, 100)
local local4 = arg0:GetHpRate(TARGET_SELF)
if local4 < 0.5 then
local2 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local4 < 0.5 then
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local2, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3018, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 11)
GetWellSpace_Odds = 25
return GetWellSpace_Odds
end
local0 = 3.4 - local0
local0 = 0 - local0
function IllegitimateChildren251000_Act12(arg0, arg1, arg2)
local local0 = arg0:GetDist(TARGET_ENE_0)
local local1 = UPVAL0
local local2 = UPVAL1
local local3 = 9999
local local4 = 0
local local5 = arg0:GetRandam_Int(1, 100)
if arg0:GetHpRate(TARGET_SELF) < 0.5 then
local3 = 0
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3019, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 12)
GetWellSpace_Odds = 25
return GetWellSpace_Odds
end
local0 = 11.4 - local0
local0 = 0 - local0
function IllegitimateChildren251000_Act13(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = UPVAL1
local local2 = 9999
local local3 = arg0:GetRandam_Int(1, 100)
local local4 = arg0:GetHpRate(TARGET_SELF)
if local4 < 0.5 then
local2 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local4 < 0.5 then
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local2, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3020, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 13)
GetWellSpace_Odds = 50
return GetWellSpace_Odds
end
local0 = 14.8 - local0
local0 = 0 - local0
function IllegitimateChildren251000_Act15(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = UPVAL1
local local2 = 9999
local local3 = arg0:GetRandam_Int(1, 100)
local local4 = arg0:GetHpRate(TARGET_SELF)
if local4 < 0.5 then
local2 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local4 < 0.5 then
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local2, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3022, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 15)
if arg0:GetNumber(0) == 0 then
arg0:SetNumber(0, 1)
end
GetWellSpace_Odds = 0
return GetWellSpace_Odds
end
local0 = 11 - local0
local0 = 0 - local0
function IllegitimateChildren251000_Act16(arg0, arg1, arg2)
local local0 = arg0:GetDist(TARGET_ENE_0)
local local1 = UPVAL0
local local2 = UPVAL1
local local3 = 9999
local local4 = UPVAL0 + 1
local local5 = 0
if arg0:GetHpRate(TARGET_SELF) < 0.5 then
local3 = 0
end
if arg0:GetRandam_Int(1, 100) <= 0 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3023, TARGET_ENE_0, local4, 0, -1)
else
arg1:AddSubGoal(GOAL_COMMON_ComboAttackTunableSpin, 10, 3023, TARGET_ENE_0, local4, 0, -1)
arg1:AddSubGoal(GOAL_COMMON_ComboFinal, 10, 3025, TARGET_ENE_0, local4, 0, -1)
end
arg0:SetNumber(2, 16)
if arg0:GetNumber(0) == 1 then
arg0:SetNumber(0, 2)
end
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = 2 - local0
local0 = 0 - local0
function IllegitimateChildren251000_Act17(arg0, arg1, arg2)
local local0 = arg0:GetDist(TARGET_ENE_0)
local local1 = UPVAL0
local local2 = UPVAL1
local local3 = 9999
local local4 = UPVAL0 + 1
local local5 = 0
if arg0:GetHpRate(TARGET_SELF) < 0.5 then
local3 = 0
end
if arg0:GetRandam_Int(1, 100) <= 0 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3024, TARGET_ENE_0, local4, 0, -1)
else
arg1:AddSubGoal(GOAL_COMMON_ComboAttackTunableSpin, 10, 3024, TARGET_ENE_0, local4, 0, -1)
arg1:AddSubGoal(GOAL_COMMON_ComboFinal, 10, 3031, TARGET_ENE_0, local4, 0, -1)
end
arg0:SetNumber(2, 17)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = 20.5 - local0
local0 = 0 - local0
function IllegitimateChildren251000_Act18(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = UPVAL1
local local2 = 9999
local local3 = arg0:GetRandam_Int(1, 100)
local local4 = arg0:GetHpRate(TARGET_SELF)
if local4 < 0.5 then
local2 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local4 < 0.5 then
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local2, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3032, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 18)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = 16.1 - local0
local0 = 0 - local0
function IllegitimateChildren251000_Act19(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = UPVAL1
local local2 = 9999
local local3 = arg0:GetRandam_Int(1, 100)
local local4 = arg0:GetHpRate(TARGET_SELF)
if local4 < 0.5 then
local2 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local4 < 0.5 then
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local2, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3033, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 19)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
function IllegitimateChildren251000_Act20(arg0, arg1, arg2)
local local0 = arg0:GetDist(TARGET_ENE_0)
local local1 = arg0:GetRandam_Int(1, 100)
if local0 <= -1.3 then
if arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_L, 180) then
arg1:AddSubGoal(GOAL_COMMON_SpinStep, 3, 713, TARGET_ENE_0, 0, AI_DIR_TYPE_R, 0)
else
arg1:AddSubGoal(GOAL_COMMON_SpinStep, 3, 712, TARGET_ENE_0, 0, AI_DIR_TYPE_L, 0)
end
elseif local0 <= 5 and (not not arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_L, 90) or arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_R, 90)) then
if arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_L, 180) then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3026, TARGET_ENE_0, DIST_None, 0, 90)
else
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3027, TARGET_ENE_0, DIST_None, 0, 90)
end
elseif local0 <= 8 and arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_B, 120) then
if arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_L, 180) then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3028, TARGET_ENE_0, DIST_None, 0, 90)
else
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3029, TARGET_ENE_0, DIST_None, 0, 90)
end
else
arg1:AddSubGoal(GOAL_COMMON_Turn, 3, TARGET_ENE_0, 0, 0, 0)
end
arg0:SetNumber(2, 20)
GetWellSpace_Odds = 0
return GetWellSpace_Odds
end
function IllegitimateChildren251000_Act21(arg0, arg1, arg2)
local local0 = arg0:GetDist(TARGET_ENE_0)
local local1 = arg0:GetRandam_Int(1, 100)
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 5, 3030, TARGET_ENE_0, 100, 0, 90)
arg0:SetNumber(2, 21)
arg0:SetTimer(3, 60)
GetWellSpace_Odds = 0
return GetWellSpace_Odds
end
local0 = 8.4 - local0
function IllegitimateChildren251000_Act22(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = 9999
local local2 = UPVAL0 + 1
local local3 = arg0:GetRandam_Int(1, 100)
local local4 = arg0:GetHpRate(TARGET_SELF)
if local4 < 0.5 then
local1 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local4 < 0.5 then
local2 = 999
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local1, 0, 3)
end
if local3 <= 33 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3010, TARGET_ENE_0, local2, 0, -1)
elseif local3 <= 67 then
arg1:AddSubGoal(GOAL_COMMON_ComboAttackTunableSpin, 10, 3010, TARGET_ENE_0, local2, 0, -1)
arg1:AddSubGoal(GOAL_COMMON_ComboFinal, 10, 3011, TARGET_ENE_0, local2, 0, -1)
else
arg1:AddSubGoal(GOAL_COMMON_ComboAttackTunableSpin, 10, 3010, TARGET_ENE_0, local2, 0, -1)
arg1:AddSubGoal(GOAL_COMMON_ComboRepeat, 10, 3011, TARGET_ENE_0, local2, 0, -1)
arg1:AddSubGoal(GOAL_COMMON_ComboFinal, 10, 3013, TARGET_ENE_0, local2, 0, -1)
end
arg0:SetNumber(2, 22)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = 8.8 - local0
function IllegitimateChildren251000_Act23(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = 9999
local local2 = UPVAL0 + 1
local local3 = arg0:GetHpRate(TARGET_SELF)
if local3 < 0.5 then
local1 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local3 < 0.5 then
local2 = 999
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local1, 0, 3)
end
if arg0:GetRandam_Int(1, 100) <= 50 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3012, TARGET_ENE_0, local2, 0, -1)
else
arg1:AddSubGoal(GOAL_COMMON_ComboAttackTunableSpin, 10, 3012, TARGET_ENE_0, local2, 0, -1)
arg1:AddSubGoal(GOAL_COMMON_ComboFinal, 10, 3013, TARGET_ENE_0, local2, 0, -1)
end
arg0:SetNumber(2, 23)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = 9.8 - local0
function IllegitimateChildren251000_Act24(arg0, arg1, arg2)
local local0 = UPVAL0
local local1 = 9999
local local2 = arg0:GetRandam_Int(1, 100)
local local3 = arg0:GetHpRate(TARGET_SELF)
if local3 < 0.5 then
local1 = 0
end
if arg0:GetNumber(1) ~= 0 then
local0 = 999
arg0:SetNumber(1, 0)
elseif local3 < 0.5 then
if arg0:GetRandam_Int(1, 100) <= 30 then
local0 = 999
else
local0 = local0 + arg0:GetRandam_Int(0, 5)
end
end
if local0 <= arg0:GetDist(TARGET_ENE_0) then
Approach_Act(arg0, arg1, local0, local1, 0, 3)
end
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3014, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
arg0:SetNumber(2, 24)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
local0 = local8
function IllegitimateChildren251000_Act25(arg0, arg1, arg2)
if arg0:GetDist(TARGET_ENE_0) <= 3 then
if arg0:IsOnNearMeshByPos(TARGET_SELF, AI_DIR_TYPE_B, 10) then
arg1:AddSubGoal(GOAL_COMMON_SpinStep, MoveTimeS, 711, TARGET_ENE_0, 0, AI_DIR_TYPE_B, 10)
else
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 10, 3015, TARGET_ENE_0, UPVAL0 + 1, 0, -1)
end
end
IllegitimateChildren251000_Act15(arg0, arg1, arg2)
arg0:SetNumber(0, 1)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
function IllegitimateChildren251000_Act26(arg0, arg1, arg2)
local local0 = arg0:GetDist(TARGET_ENE_0)
IllegitimateChildren251000_Act21(arg0, arg1, arg2)
arg0:SetNumber(0, 2)
GetWellSpace_Odds = 100
return GetWellSpace_Odds
end
function IllegitimateChildren251000_ActAfter_RealTime(arg0, arg1)
local local0 = arg0:GetDist(TARGET_ENE_0)
local local1 = arg0:GetRandam_Int(1, 100)
local local2 = arg0:GetRandam_Int(1, 100)
local local3 = arg0:GetHpRate(TARGET_SELF)
local local4 = arg0:GetRandam_Float(2, 3.5)
local local5 = 0
if 0.75 <= local3 then
arg1:AddSubGoal(GOAL_COMMON_SidewayMove, arg0:GetRandam_Float(1.5, 2.5), TARGET_ENE_0, arg0:GetRandam_Int(0, 1), arg0:GetRandam_Int(30, 45), true, true, -1)
elseif 0.5 <= local3 then
if 12 <= local0 then
arg1:AddSubGoal(GOAL_COMMON_SpinStep, 3, 710, TARGET_ENE_0, 0, AI_DIR_TYPE_F, 0)
elseif local0 <= 2 then
arg1:AddSubGoal(GOAL_COMMON_SpinStep, 3, 711, TARGET_ENE_0, 0, AI_DIR_TYPE_B, 0)
elseif arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_L, 180) then
arg1:AddSubGoal(GOAL_COMMON_SpinStep, 3, 713, TARGET_ENE_0, 0, AI_DIR_TYPE_R, 0)
else
arg1:AddSubGoal(GOAL_COMMON_SpinStep, 3, 712, TARGET_ENE_0, 0, AI_DIR_TYPE_L, 0)
end
end
return
end
function IllegitimateChildren251000_ActAfter_AdjustSpace(arg0, arg1, arg2)
arg1:AddSubGoal(GOAL_COMMON_If, 10, 0)
return
end
function IllegitimateChildren251000Battle_Update(arg0, arg1)
return GOAL_RESULT_Continue
end
function IllegitimateChildren251000Battle_Terminate(arg0, arg1)
return
end
function IllegitimateChildren251000Battle_Interupt(arg0, arg1)
local local0 = arg0:GetRandam_Int(1, 100)
local local1 = arg0:GetHpRate(TARGET_SELF)
local local2 = 1
local local3 = 1
if arg0:HasSpecialEffectId(TARGET_SELF, 481) then
local2 = 0
end
if arg0:HasSpecialEffectId(TARGET_SELF, 482) then
local3 = 0
end
if GuardBreak_Act(arg0, arg1, 9.8, 100) then
if local1 < 0.5 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3014, TARGET_ENE_0, AttDist, 0, -1)
else
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3004, TARGET_ENE_0, AttDist, 0, -1)
end
return true
elseif arg0:IsInterupt(INTERUPT_Shoot) then
if local0 <= 50 then
arg1:ClearSubGoal()
if arg0:IsInsideTarget(TARGET_ENE_0, AI_DIR_TYPE_F, 180) then
if arg0:GetDist(TARGET_ENE_0) < 3.4 then
if local2 == 1 and local3 == 1 then
if local0 <= 25 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3015, TARGET_ENE_0, AttDist, 0, -1)
elseif local0 <= 50 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3016, TARGET_ENE_0, AttDist, 0, -1)
elseif local0 <= 75 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3005, TARGET_ENE_0, AttDist, 0, -1)
else
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3019, TARGET_ENE_0, AttDist, 0, -1)
end
elseif local2 == 1 then
if local0 <= 50 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3015, TARGET_ENE_0, AttDist, 0, -1)
elseif local0 <= 75 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3005, TARGET_ENE_0, AttDist, 0, -1)
else
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3019, TARGET_ENE_0, AttDist, 0, -1)
end
elseif local3 == 1 then
if local0 <= 50 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3016, TARGET_ENE_0, AttDist, 0, -1)
elseif local0 <= 75 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3005, TARGET_ENE_0, AttDist, 0, -1)
else
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3019, TARGET_ENE_0, AttDist, 0, -1)
end
elseif local0 <= 50 then
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3005, TARGET_ENE_0, AttDist, 0, -1)
else
arg1:AddSubGoal(GOAL_COMMON_AttackTunableSpin, 1, 3019, TARGET_ENE_0, AttDist, 0, -1)
end
elseif local2 == 1 and local3 == 1 then
if local1 < 0.5 then
IllegitimateChildren251000_Act23(arg0, arg1, paramTbl)
else
IllegitimateChildren251000_Act03(arg0, arg1, paramTbl)
end
elseif local2 == 1 then
if local1 < 0.5 then
IllegitimateChildren251000_Act21(arg0, arg1, paramTbl)
else
IllegitimateChildren251000_Act01(arg0, arg1, paramTbl)
end
elseif local3 == 1 then
if local1 < 0.5 then
IllegitimateChildren251000_Act22(arg0, arg1, paramTbl)
else
IllegitimateChildren251000_Act02(arg0, arg1, paramTbl)
end
elseif local0 <= 50 then
IllegitimateChildren251000_Act04(arg0, arg1, paramTbl)
else
IllegitimateChildren251000_Act13(arg0, arg1, paramTbl)
end
return true
else
return false
end
else
return false
end
end
local local4 = arg0:GetNumber(7)
if arg0:IsInterupt(INTERUPT_Damaged) then
if local4 == 0 then
local4 = 16
end
arg0:SetNumber(7, local4 * 2)
end
if 100 <= local4 then
arg0:SetNumber(7, 100)
end
if arg0:IsInterupt(INTERUPT_Damaged) then
if local0 <= arg0:GetNumber(7) then
arg0:SetNumber(7, 0)
arg1:ClearSubGoal()
arg0:SetNumber(1, 1)
IllegitimateChildren251000Battle_Activate(arg0, arg1)
return true
else
return false
end
else
return false
end
end
return
|
-----------------------------------------------------
-- Battery widget for Awesome WM
-- based on battery widget from:
-- https://github.com/streetturtle/awesome-wm-widgets
-----------------------------------------------------
local wibox = require("wibox")
local spawn = require("awful.spawn")
local timer = require("gears.timer")
local widget = {}
local function worker(user_args)
local args = user_args or {}
local battery_name = args.battery or "BAT0"
local battery_path = "/sys/class/power_supply/" .. battery_name
local get_battery_cmd = ''
local image_path_make = function(val, charging)
local charge_status = ""
if charging == 'Charging' then
charge_status = "-charging"
end
local battery_level = string.format("%03d", val)
local path = os.getenv("HOME") .. '/.config/awesome/icons/battery-' .. battery_level .. charge_status .. '.png'
return path
end
local image_path = image_path_make(100)
local battery_image = wibox.widget {
image = image_path,
resize = true,
widget = wibox.widget.imagebox
}
local battery_text = wibox.widget.textbox()
local widget = wibox.widget {
battery_image,
battery_text,
layout = wibox.layout.fixed.horizontal,
}
local update_widget = function(stdout, _, _, _)
local space = string.find(stdout, " ")
local status = string.sub(stdout, 1, space - 1)
local battery_level = tonumber(string.sub(stdout, space + 1, -1))
local battery_level_10 = math.floor(battery_level / 10 + 0.5) * 10
battery_text:set_text(" " .. battery_level .. "% ")
battery_image.image = image_path_make(battery_level_10, status)
end
timer {
timeout = 60,
call_now = true,
autostart = true,
callback = function()
spawn.easy_async_with_shell("echo $(cat " .. battery_path .. "/status) $(cat " .. battery_path .. "/capacity)", update_widget)
end
}
return widget
end
return setmetatable(widget, {
__call = worker
})
|
object_tangible_component_weapon_core_weapon_core_melee_advanced = object_tangible_component_weapon_core_shared_weapon_core_melee_advanced:new {
}
ObjectTemplates:addTemplate(object_tangible_component_weapon_core_weapon_core_melee_advanced, "object/tangible/component/weapon/core/weapon_core_melee_advanced.iff")
|
world = require("World")
local Entity = require("Entity")
local Hunter = require("Hunter")
local Rabbit = require("Rabbit")
local RedScore = 0
local BlueScore = 0
DEBUG = false
debuglog = ""
g_state = nil
stateSwitcher = require("StateSwitcher")
function love.load( args )
stateSwitcher.load(args,"MenuState")
end
function love.update( dt )
if string.len(debuglog) > 1000 then -- cleanup when 'debuglog' gets too long
debuglog = ""
end
g_state.update( dt )
end
function love.draw()
g_state.draw()
end
function love.keypressed( key, isrepeat )
g_state.keypressed( key, isrepeat )
end
function love.keyreleased( key )
g_state.keyreleased( key )
end
function love.mousepressed( x, y, button )
g_state.mousepressed( x, y, button )
end
function love.mousereleased( x, y, button )
g_state.mousereleased( x, y, button )
end
function love.joystickpressed( joystick, button )
g_state.joystickpressed( joystick, button )
end
function love.joystickreleased( joystick, button )
g_state.joystickreleased( joystick, button )
end
|
--2
local ws = require('websocket')
local conf = {}
local sides = {
"left", "right", "back"
}
function setSides(count)
for i = 1, table.getn(conf.sides) do
redstone.setOutput(conf.sides[i], i <= count)
end
end
function init()
local filename = 'var/signal.conf'
if fs.exists(filename) then
local file = fs.open(filename, 'r')
conf = textutils.unserialise(file.readAll())
file.close()
else
conf = {
sides = { 'back' },
computerName = 'Signal slider',
methodKey = 'Level'
}
local file = fs.open(filename, 'w')
file.write(textutils.serialise(conf))
file.close()
end
ws.methods({
{
type = "slider",
key = conf.methodKey,
value = 0,
min = 0,
max = table.getn(conf.sides),
fn = function (level)
setSides(tonumber(level))
return level
end
}
})
end
init()
ws.connect(conf.computerName)
ws.runtime()
|
function removequotes(text)
if string.len(text) > 1 then
if string.sub(text, 1, 1) == "\"" and string.sub(text, string.len(text), string.len(text)) == "\"" then
return string.sub(text, 2, string.len(text) - 1)
else
return text
end
elseif string.len(text) == 1 and string.sub(text, 1, 1) ~= "\"" then
return text
else
return ""
end
end
function strjoin(delimiter, list)
local len = table.getn(list)
if len == 0 then return "" end
local string = list[1]
for i = 2, len do string = string .. delimiter .. list[i] end
return string
end
function argsplit(text)
local list = {}
local pos = 1
local last = " "
local inquote = false
local current = ""
while pos <= string.len(text) do
if string.sub(text, pos, pos) == " " then
if inquote then
current = current .. string.sub(text, pos, pos)
elseif string.len(current) > 0 then
table.insert(list, current)
current = ""
end
elseif string.sub(text, pos, pos) == "\"" then
if not inquote or last ~= "\\" then
inquote = not inquote
end
current = current .. string.sub(text, pos, pos)
else
current = current .. string.sub(text, pos, pos)
end
last = string.sub(text, pos, pos)
pos = pos + 1
end
if string.len(current) > 0 then
table.insert(list, current)
end
return list
end
function strsplit(delimiter, text)
local list = {}
local pos = 1
if delimiter == "" then -- this would result in endless loops
return list
end
while true do
local first, last = string.find(text, delimiter, pos)
if first then -- found?
table.insert(list, string.sub(text, pos, first-1))
pos = last+1
else
table.insert(list, string.sub(text, pos))
break
end
end
return list
end
function onlyfile(filename)
local pos = 1
while true do
local startPos, endPos = string.find(filename, "\\", pos)
if startPos then
pos = endPos+1
else
return string.sub(filename, pos)
end
end
return filename
end
function argsjoin(target, list)
local len = table.getn(list)
if len == 0 then
return ""
end
if len == 1 then
return " \""..list[1].."\" \""..target..onlyfile(list[1]).."\""
end
if string.sub(list[1], string.len(list[1])) ~= "\\" then
list[1] = list[1].."\\"
end
local string = ""
for i = 2, len do
string = string.." \""..list[1]..list[i].."\" \""..target..list[i].."\""
end
return string
end
function fileargsjoin(list)
local len = table.getn(list)
if len == 0 then
return ""
end
if len == 1 then
return " \""..list[1].."\""
end
if string.sub(list[1], string.len(list[1])) ~= "\\" then
list[1] = list[1].."\\"
end
local string = ""
for i = 2, len do
string = string.." \""..list[1]..list[i].."\""
end
return string
end
menuentries = {}
-- this function is run by wehack.dll
function clickevent(id)
menuentries[id]:Click()
end
MenuEntry = {}
MenuEntry_mt = { __index = MenuEntry }
function MenuEntry:create()
local o = {}
setmetatable( o, MenuEntry_mt )
return o
end
function MenuEntry:Init(o,menu,name,cb)
o.menu = menu
o.name = name
o.cb = cb or function () end
o.id = wehack.addmenuentry(menu,name,"clickevent")
menuentries[o.id] = o
return o
end
function MenuEntry:New(menu,name,cb)
local o = MenuEntry:create()
MenuEntry:Init(o,menu,name,cb)
return o
end
function MenuEntry:Click()
if self.cb then
self.cb(self)
end
end
function inheritsFrom(base)
local newclass = {}
local classmt = { __index = newclass }
function newclass:create()
local o = {}
setmetatable(o,classmt)
return o
end
if base then
setmetatable(newclass,{__index = base} )
end
return newclass
end
-- Toggleable Menu Entry with saved state in registry
TogMenuEntry = inheritsFrom(MenuEntry)
function TogMenuEntry:Init(o,menu,name,cb,default)
MenuEntry:Init(o,menu,name,cb)
local state = grim.getregpair(confregpath,name)
if state == "on" or (state ~= "off" and default) then
o.checked = true
grim.setregstring(confregpath,name,"on") -- set in case this is the first time we're running this
wehack.checkmenuentry(o.menu,o.id,1)
if o.cb then
o.cb(o)
end
else
wehack.checkmenuentry(o.menu,o.id,0)
o.checked = false
end
return o
end
function TogMenuEntry:redraw()
if self.checked then
wehack.checkmenuentry(self.menu,self.id,1)
grim.setregstring(confregpath,self.name,"on")
else
wehack.checkmenuentry(self.menu,self.id,0)
grim.setregstring(confregpath,self.name,"off")
end
end
function TogMenuEntry:New(menu,name,cb,default)
o = TogMenuEntry:create()
TogMenuEntry:Init(o,menu,name,cb,default)
return o
end
function TogMenuEntry:Click()
self.checked = not self.checked
self.redraw(self)
if self.cb then
self.cb(self)
end
end
|
-- ZPU base instructions implementation
-- this file contains the implementations of the opcodes(returned as opcode table).
-- most code by vifino, some improvements by max1220
local bitlib = require("bitlib")
local bnot = assert(bitlib.bnot)
local band = assert(bitlib.band)
local bor = assert(bitlib.bor)
local bxor = assert(bitlib.bxor)
local lshift = assert(bitlib.lshift)
local rshift = assert(bitlib.rshift)
-- helpers
local function v_push(self, v)
self.rSP = band(self.rSP - 4, 0xFFFFFFFF)
self:set32(self.rSP, v)
end
local function v_pop(self)
local v = self:get32(self.rSP)
self.rSP = band(self.rSP + 4, 0xFFFFFFFC)
return v
end
-- OPs!
local function op_im(self, i, last)
if last then
v_push(self, bor(lshift(band(v_pop(self), 0x1FFFFFFF), 7), i))
else
if band(i, 0x40) ~= 0 then i = bor(i, 0xFFFFFF80) end
v_push(self, i)
end
end
local function op_loadsp(self, i)
local addr = band(self.rSP + lshift(bxor(i, 0x10), 2), 0xFFFFFFFC)
v_push(self, self:get32(addr))
end
local function op_storesp(self, i)
-- Careful with the ordering! Documentation suggests the OPPOSITE of what it should be!
-- https://github.com/zylin/zpugcc/blob/master/toolchain/gcc/libgloss/zpu/crt0.S#L836
-- This is a good testpoint:
-- 0x81 0x3F
-- This should leave zpuinst.rSP + 4 on stack.
-- You can work it out from the sources linked.
local bsp = band(self.rSP + lshift(bxor(i, 0x10), 2), 0xFFFFFFFC)
self:set32(bsp, v_pop(self))
end
local function op_addsp(self, i)
local addr = band(self.rSP + lshift(i, 2), 0xFFFFFFFC)
v_push(self, band(self:get32(addr) + v_pop(self), 0xFFFFFFFF))
end
local function op_load(self)
self:set32(self.rSP, self:get32(band(self:get32(self.rSP), 0xFFFFFFFC)))
end
local function op_store(self)
self:set32(band(v_pop(self), 0xFFFFFFFC), v_pop(self))
end
local function op_add(self)
local a = v_pop(self)
self:set32(self.rSP, band(a + self:get32(self.rSP), 0xFFFFFFFF))
end
local function op_and(self)
v_push(self, band(v_pop(self), v_pop(self)))
end
local function op_or(self)
v_push(self, bor(v_pop(self), v_pop(self)))
end
local function op_not(self)
v_push(self, bnot(v_pop(self)))
end
local function op_emulate(self, op)
v_push(self, band(self.rIP + 1, 0xFFFFFFFF))
self.rIP = lshift(op, 5)
return "EMULATE ".. op .. "/" .. bor(op, 0x20)
end
local op_flip_tb = {
[0] = 0,
[1] = 2,
[2] = 1,
[3] = 3
}
local function op_flip_byte(i)
local a = op_flip_tb[rshift(band(i, 0xC0), 6)]
local b = op_flip_tb[rshift(band(i, 0x30), 4)]
local c = op_flip_tb[rshift(band(i, 0x0C), 2)]
local d = op_flip_tb[band(i, 0x03)]
return bor(bor(a, lshift(b, 2)), bor(lshift(c, 4), lshift(d, 6)))
end
local function op_flip(self)
local v = v_pop(self)
local a = op_flip_byte(band(rshift(v, 24), 0xFF))
local b = op_flip_byte(band(rshift(v, 16), 0xFF))
local c = op_flip_byte(band(rshift(v, 8), 0xFF))
local d = op_flip_byte(band(v, 0xFF))
v_push(self, bor(bor(lshift(d, 24), lshift(c, 16)), bor(lshift(b, 8), a)))
end
local function ip_adv(self)
self.rIP = band(self.rIP + 1, 0xFFFFFFFF)
end
-- do_* function are for instruction decoding
-- base instructions
local function do_POPPC(self)
self.rIP = v_pop(self)
return "POPPC"
end
local function do_LOAD(self)
op_load(self)
ip_adv(self)
return "LOAD"
end
local function do_STORE(self)
op_store(self)
ip_adv(self)
return "STORE"
end
local function do_PUSHSP(self)
v_push(self, self.rSP)
ip_adv(self)
return "PUSHSP"
end
local function do_POPSP(self)
self.rSP = band(v_pop(self), 0xFFFFFFFC)
ip_adv(self)
return "POPSP"
end
local function do_ADD(self)
op_add(self)
ip_adv(self)
return "ADD"
end
local function do_AND(self)
op_and(self)
ip_adv(self)
return "AND"
end
local function do_OR(self)
op_or(self)
ip_adv(self)
return "OR"
end
local function do_NOT(self)
op_not(self)
ip_adv(self)
return "NOT"
end
local function do_FLIP(self)
op_flip(self)
ip_adv(self)
return "FLIP"
end
local function do_NOP(self)
ip_adv(self) return "NOP"
end
-- instructions that require immediate decoding
local function do_IM(self, op, lim)
local tmp = band(op, 0x7F)
op_im(self, tmp, lim)
self.fLastIM = true
ip_adv(self)
return "IM "..tmp
end
local function do_LOADSP(self, op)
local tmp = band(op, 0x1F)
op_loadsp(self, tmp)
ip_adv(self)
return "LOADSP " .. (bxor(0x10, tmp) * 4)
end
local function do_STORESP(self, op)
local tmp = band(op, 0x1F)
op_storesp(self, tmp)
ip_adv(self)
return "STORESP " .. (bxor(0x10, tmp) * 4)
end
local function do_EMULATE(self, op)
return op_emulate(self, band(op, 0x1F))
end
local function do_ADDSP(self, op)
local tmp = band(op, 0xF)
op_addsp(self, tmp)
ip_adv(self)
return "ADDSP " .. tmp
end
-- OP lookup table
local op_table = {
[0x04] = do_POPPC,
[0x08] = do_LOAD,
[0x0C] = do_STORE,
[0x02] = do_PUSHSP,
[0x0D] = do_POPSP,
[0x05] = do_ADD,
[0x06] = do_AND,
[0x07] = do_OR,
[0x09] = do_NOT,
[0x0A] = do_FLIP,
[0x0B] = do_NOP,
}
for op=0x80, 0xFF do
op_table[op] = do_IM
end
for op=0x60, 0x7F do
op_table[op] = do_LOADSP
end
for op=0x40, 0x5F do
op_table[op] = do_STORESP
end
for op=0x20, 0x3F do
op_table[op] = do_EMULATE
end
for op=0x10, 0x1F do
op_table[op] = do_ADDSP
end
return op_table
|
-- This code is part of Qiskit.
--
-- Copyright IBM 2020
math.randomseed(os.time())
function QuantumCircuit ()
local qc = {}
local function set_registers (n,m)
qc.num_qubits = n
qc.num_clbits = m or 0
end
qc.set_registers = set_registers
qc.data = {}
function qc.initialize (ket)
ket_copy = {}
for j, amp in pairs(ket) do
if type(amp)=="number" then
ket_copy[j] = {amp, 0}
else
ket_copy[j] = {amp[0], amp[1]}
end
end
qc.data = {{'init',ket_copy}}
end
function qc.add_circuit (qc2)
qc.num_qubits = math.max(qc.num_qubits,qc2.num_qubits)
qc.num_clbits = math.max(qc.num_clbits,qc2.num_clbits)
for g, gate in pairs(qc2.data) do
qc.data[#qc.data+1] = ( gate )
end
end
function qc.x (q)
qc.data[#qc.data+1] = ( {'x',q} )
end
function qc.rx (theta,q)
qc.data[#qc.data+1] = ( {'rx',theta,q} )
end
function qc.h (q)
qc.data[#qc.data+1] = ( {'h',q} )
end
function qc.cx (s,t)
qc.data[#qc.data+1] = ( {'cx',s,t} )
end
function qc.measure (q,b)
qc.data[#qc.data+1] = ( {'m',q,b} )
end
function qc.rz (theta,q)
qc.h(q)
qc.rx(theta,q)
qc.h(q)
end
function qc.ry (theta,q)
qc.rx(math.pi/2,q)
qc.rz(theta,q)
qc.rx(-math.pi/2,q)
end
function qc.z (q)
qc.rz(math.pi,q)
end
function qc.y (q)
qc.z(q)
qc.x(q)
end
return qc
end
function simulate (qc, get, shots)
if not shots then
shots = 1024
end
function as_bits (num,bits)
-- returns num converted to a bitstring of length bits
-- adapted from https://stackoverflow.com/a/9080080/1225661
local bitstring = {}
for index = bits, 1, -1 do
b = num - math.floor(num/2)*2
num = math.floor((num - b) / 2)
bitstring[index] = b
end
return bitstring
end
function get_out (j)
raw_out = as_bits(j-1,qc.num_qubits)
out = ""
for b=0,qc.num_clbits-1 do
if outputnum_clbitsap[b] then
out = raw_out[qc.num_qubits-outputnum_clbitsap[b]]..out
end
end
return out
end
ket = {}
for j=1,2^qc.num_qubits do
ket[j] = {0,0}
end
ket[1] = {1,0}
outputnum_clbitsap = {}
for g, gate in pairs(qc.data) do
if gate[1]=='init' then
for j, amp in pairs(gate[2]) do
ket[j] = {amp[1], amp[2]}
end
elseif gate[1]=='m' then
outputnum_clbitsap[gate[3]] = gate[2]
elseif gate[1]=="x" or gate[1]=="rx" or gate[1]=="h" then
j = gate[#gate]
for i0=0,2^j-1 do
for i1=0,2^(qc.num_qubits-j-1)-1 do
b1=i0+2^(j+1)*i1 + 1
b2=b1+2^j
e = {{ket[b1][1],ket[b1][2]},{ket[b2][1],ket[b2][2]}}
if gate[1]=="x" then
ket[b1] = e[2]
ket[b2] = e[1]
elseif gate[1]=="rx" then
theta = gate[2]
ket[b1][1] = e[1][1]*math.cos(theta/2)+e[2][2]*math.sin(theta/2)
ket[b1][2] = e[1][2]*math.cos(theta/2)-e[2][1]*math.sin(theta/2)
ket[b2][1] = e[2][1]*math.cos(theta/2)+e[1][2]*math.sin(theta/2)
ket[b2][2] = e[2][2]*math.cos(theta/2)-e[1][1]*math.sin(theta/2)
elseif gate[1]=="h" then
for k=1,2 do
ket[b1][k] = (e[1][k] + e[2][k])/math.sqrt(2)
ket[b2][k] = (e[1][k] - e[2][k])/math.sqrt(2)
end
end
end
end
elseif gate[1]=="cx" then
s = gate[2]
t = gate[3]
if s>t then
h = s
l = t
else
h = t
l = s
end
for i0=0,2^l-1 do
for i1=0,2^(h-l-1)-1 do
for i2=0,2^(qc.num_qubits-h-1)-1 do
b1 = i0 + 2^(l+1)*i1 + 2^(h+1)*i2 + 2^s + 1
b2 = b1 + 2^t
e = {{ket[b1][1],ket[b1][2]},{ket[b2][1],ket[b2][2]}}
ket[b1] = e[2]
ket[b2] = e[1]
end
end
end
end
end
if get=="statevector" then
return ket
else
probs = {}
for j,amp in pairs(ket) do
probs[j] = amp[1]^2 + amp[2]^2
end
if get=="expected_counts" then
c = {}
for j,p in pairs(probs) do
out = get_out(j)
if c[out] then
c[out] = c[out] + probs[j]*shots
else
if out then -- in case of pico8 weirdness
c[out] = probs[j]*shots
end
end
end
return c
else
m = {}
for s=1,shots do
cumu = 0
un = true
r = math.random()
for j,p in pairs(probs) do
cumu = cumu + p
if r<cumu and un then
m[s] = get_out(j)
un = false
end
end
end
if get=="memory" then
return m
elseif get=="counts" then
c = {}
for s=1,shots do
if c[m[s]] then
c[m[s]] = c[m[s]] + 1
else
if m[s] then -- in case of pico8 weirdness
c[m[s]] = 1
else
if c["error"] then
c["error"] = c["error"]+1
else
c["error"] = 1
end
end
end
end
return c
end
end
end
end
|
local function Event(callback, instance)
local object = {}
object.callback = callback
object.instance = instance
function object:handle_messages(message_id, message, sender)
if message_id == hash("handle_event") then
if instance ~= nil then
self.callback(instance)
else
self.callback()
end
end
end
return object
end
return Event
|
return function(player, context, instance, properties)
local newProperties = {}
for _, index in pairs(properties) do
local property = context.RbxAPI.GetIndexProperty(index)
newProperties[property] = true
end
local node = context.Nodes.GetNode(instance)
if node then
if next(newProperties) then
node:_setReplicatedProperties(newProperties)
else
context.Nodes.RemoveNode(instance)
end
end
end
|
--requires = {'kyazdani42/nvim-web-devicons', opt = true},
--config = function()
--[[
require'lualine'.setup{
options = {
theme = 'gruvbox',
section_separators = {'', ''},
component_separators = {'', ''},
icons_enabled = true,
},
sections = {
lualine_a = { {'mode', upper = true} },
lualine_b = { {'branch', icon = ''} },
lualine_c = { {'filename', file_status = true} },
lualine_x = { 'encoding', 'fileformat', 'filetype' },
lualine_y = { 'progress' },
lualine_z = { 'location' },
},
inactive_sections = {
lualine_a = { },
lualine_b = { },
lualine_c = { 'filename' },
lualine_x = { 'location' },
lualine_y = { },
lualine_z = { }
},
extensions = { 'fzf' }
}
]]
|
---
-- @section voice_manager
---
-- Whether or not the @{Player} can use the voice chat.
-- @note Has to be registered on both client and server to hide the UI
-- element and stop the voicechat
-- @param Player ply @{Player} who wants to use the voice chat
-- @param boolean isTeam Are they trying to use the team voice chat
-- @return[default=true] boolean Whether or not the @{Player} can use the voice chat
-- @hook
-- @realm shared
function GM:TTT2CanUseVoiceChat(ply, isTeam)
return true
end
|
fx_version 'cerulean'
games { 'gta5' }
lua54 'yes'
author 'CharlesHacks#9999'
description '3D positional audio library for FiveM.'
version '0.0.1'
--
-- Server
--
server_scripts {
'config.lua',
'server/server.lua',
}
--
-- Client
--
client_scripts {
'config.lua',
'client/client.lua',
}
--
-- NUI
--
ui_page 'nui/nui.html'
files {
'nui/nui.html',
'nui/app.js',
'nui/lib/*.js',
'sounds/**/*.ogg',
}
|
local idl = require "oil.corba.idl"
local base = require "oil.tests.corba.cdr.base"
local suite = base.newsuite(...)
--------------------------------------------------------------------------------
for name in pairs(idl.BasicTypes) do
suite:add(name, idl.TypeCode, idl[name])
end
--------------------------------------------------------------------------------
suite:add("string", idl.TypeCode, base.string{ maxlength = 2 }, idl.string)
--------------------------------------------------------------------------------
local values = {
Object = base.Object{},
struct = base.struct{
{ name = "field1", type = idl.string },
{ name = "field2", type = idl.string },
},
union = base.union{
switch = idl.ulong,
options = {
{ label = 1, name = "field1", type = idl.string },
{ label = 2, name = "field2", type = idl.string },
},
},
enum = base.enum{ "a", "e", "i", "o", "u" },
sequence = base.sequence{ elementtype = idl.string, maxlength = 2 },
array = base.array{ elementtype = idl.string, length = 2 },
typedef = base.typedef{ original_type = idl.string },
except = base.except{
{ name = "field1", type = idl.string },
{ name = "field2", type = idl.string },
},
valuetype = base.valuetype{
base_value = base.valuetype{
name = "BaseValue",
{ name = "base1", type = idl.string, access = "private" },
{ name = "base2", type = idl.string, access = "private" },
},
{ name = "field1", type = idl.string, access = "private" },
{ name = "field2", type = idl.string, access = "private" },
},
}
for name, value in pairs(values) do
suite:add(name, idl.TypeCode, value)
end
--------------------------------------------------------------------------------
suite:add("duplicated",
function()
return idl.TypeCode
end,
function()
local person = base.struct{
{ name = "name", type = idl.string },
{ name = "age", type = idl.short },
{ name = "gender", type = base.enum{ "male", "female" } },
}
return base.struct{
{ name = "husband", type = person },
{ name = "wife", type = person },
}
end)
--------------------------------------------------------------------------------
suite:add("recursive",
function()
return idl.TypeCode
end,
function()
local treenode = base.struct{{ name = "value", type = idl.string }}
local fields = treenode.fields
fields[#fields+1] = setmetatable({ name = "leaves", type = treenode },
getmetatable(fields[#fields]))
return treenode
end)
--------------------------------------------------------------------------------
suite:add("nesting",
function()
return idl.TypeCode, idl.TypeCode
end,
function()
local A = base.struct{
name = "A",
{ name = "field1", type = idl.null },
{ name = "field2", type = idl.null },
}
local B = base.struct{
name = "B",
{ name = "field1", type = idl.null },
{ name = "field2", type = A },
}
local C = base.struct{
name = "C",
{ name = "field1", type = A },
{ name = "field2", type = B },
}
return C, B
end)
--------------------------------------------------------------------------------
return suite
|
fct2 = math.random(6) + 2;
tp = math.floor(1000/fct2)
res = math.random(tp - 110) + 110;
fct1 = res * fct2
val1 = math.floor(fct1/(fct2*100))
ost1 = fct1 - val1 * 100 *fct2
val2 = math.floor(ost1/(fct2*10))
ost2 = ost1 - val2 * 10 * fct2
if (ost2 == 0) then
res = res - 1
fct1 = res * fct2
val1 = math.floor(fct1/(fct2*100))
ost1 = fct1 - val1 * 100 * fct2
val2 = math.floor(ost1/(fct2*10))
ost2 = ost1 - val2 * 10 * fct2
end
tm1 = val1 * 100 * fct2
tm2 = val2 * 10 * fct2
tm3 = ost2
out1 = val1 * 100
out2 = val2 * 10
out3 = res - out1 - out2
|
return {
vulkan = {[[C:\VulkanSDK\1.1.130.0\Include]]}
}
|
local PATH = (...):gsub('%.[^%.]+$', '')
local ffi = require "ffi"
local Transform = require(PATH..".transform")
local Mesh = {}
-- The vertex format for the model mesh
Mesh.modelFormat = {
{"VertexPosition", "float", 3},
{"VertexTexCoord", "float", 2},
}
-- The vertex format for the model attributes mesh
Mesh.attributesFormat = {
{"MatRow1", "float", 4},
{"MatRow2", "float", 4},
{"MatRow3", "float", 4},
{"MatRow4", "float", 4},
{"VertexColor", "byte", 4},
{"Frame", "float", 1},
}
--- Creates a new mesh containing the model attributes for a model.
-- @param voxelCount The number of voxels that will fit in the batch.
-- @param usage The SpriteBatchUsage used to update this mesh.
-- @returns modelAttributes A mesh containing the model attributes to be attached (applied) to the model.
-- @returns instanceData A ByteData object holding the memory space where all the data is stored.
-- @returns vertexBuffer An Array of Transforms where each element corresponds to one instance on the batch.
function Mesh.newModelAttributes(voxelCount, usage)
local memoryUsage = voxelCount * Transform.instanceSize
local instanceData = love.data.newByteData(memoryUsage)
local vertexBuffer = Transform.castInstances(instanceData:getPointer())
ffi.gc(vertexBuffer, function () instanceData:release() end)
-- The attribute mesh has only the per-instance attributes of the models
local modelAttributes = love.graphics.newMesh(Mesh.attributesFormat, instanceData, "points", usage)
return modelAttributes, instanceData, vertexBuffer
end
--- Constructs all the vertices for the layers in a model.
-- @param width The width of each layer in pixels.
-- @param height The height of each layer in pixels.
-- @param layers The number of layers in the model.
-- @returns vertices The table containing all the vertices for the model.
function Mesh.newVertices(width, height, layers)
local uvStep = 1 / layers
local vertices = {}
local start_u, end_u = 0, 1
-- First layer is bottom and the last is top
for layer = 0, layers - 1 do
local start_v, end_v = 1 - (layer + 1) * uvStep, 1 - layer * uvStep
local o = (layer * 4)
vertices[o+1] = {-width/2, -height/2, layer, start_u, start_v} -- top-left
vertices[o+2] = { width/2, -height/2, layer, end_u, start_v} -- top-right
vertices[o+3] = {-width/2, height/2, layer, start_u, end_v } -- bottom-left
vertices[o+4] = { width/2, height/2, layer, end_u, end_v } -- bottom-right
end
return vertices
end
--- Creates a new vertex map for all the quads (layers) that compose the models.
-- @param quads The number of quads (layers) on the model.
-- @returns vertexMap A vertex map to form the requested quads.
function Mesh.newVertexMap(quads)
local vertexMap = {}
for i = 0, quads - 1 do
local v, o = i * 6, i * 4
-- 1 --- 2 For each layer there are two triangles
-- | /| Top-left is composed of vertices 1, 2 and 3
-- | / | Bottom-right is composed of 4, 3, 2
-- |/ | Both have clockwise winding
-- 3 --- 4 And are pointing up in the Z axis
vertexMap[v+1] = o + 1
vertexMap[v+2] = o + 2
vertexMap[v+3] = o + 3
vertexMap[v+4] = o + 4
vertexMap[v+5] = o + 3
vertexMap[v+6] = o + 2
end
return vertexMap
end
--- Applies the model attributes to the model mesh.
-- @param model The Mesh to apply the attributes to.
-- @param attributes The Mesh containing the attributes for each instance of the model.
-- @returns model The Mesh provided as model, now with the attributes applied.
function Mesh.applyAttributes(model, attributes)
for _, v in ipairs(Mesh.attributesFormat) do
model:attachAttribute(v[1], attributes, "perinstance")
end
return model
end
--- Creates a new mesh with the provided number of vertices, texture, and model attributes.
-- @param vertices The number of vertices for the model (based on the number of layers).
-- @param texture The texture to use for this model.
-- @param layers The number of layers the model has.
-- @param modelAttributes A mesh which will hold the model attributes for this model.
-- @returns mesh The new mesh constructed from the parameters.
function Mesh.newMesh(vertices, texture, layers, modelAttributes)
local mesh = love.graphics.newMesh(Mesh.modelFormat, vertices, "triangles", "static")
mesh:setVertexMap(Mesh.newVertexMap(layers))
mesh:setTexture(texture)
Mesh.applyAttributes(mesh, modelAttributes)
return mesh
end
return Mesh
|
---
BLEND_ZERO = 0
---
BLEND_ONE = 1
---
BLEND_DST_COLOR = 2
---
BLEND_ONE_MINUS_DST_COLOR = 3
---
BLEND_SRC_ALPHA = 4
---
BLEND_ONE_MINUS_SRC_ALPHA = 5
---
BLEND_DST_ALPHA = 6
---
BLEND_ONE_MINUS_DST_ALPHA = 7
---
BLEND_SRC_ALPHA_SATURATE = 8
---
BLEND_SRC_COLOR = 9
---
BLEND_ONE_MINUS_SRC_COLOR = 10
---
BLENDFUNC_ADD = 0
---
BLENDFUNC_SUBTRACT = 1
---
BLENDFUNC_REVERSE_SUBTRACT = 2
---
BLENDFUNC_MIN = 3
---
BLENDFUNC_MAX = 4
--- Place the light from the front
BOX_FRONT = 0
--- Place the light behind
BOX_BACK = 1
--- Place the light to the right
BOX_RIGHT = 2
--- Place the light to the left
BOX_LEFT = 3
--- Place the light to the top
BOX_TOP = 4
--- Place the light to the bottom
BOX_BOTTOM = 5
--- Huge static prop, possibly leftover from goldsrc
RENDERGROUP_STATIC_HUGE = 0
--- Huge opaque entity, possibly leftover from goldsrc
RENDERGROUP_OPAQUE_HUGE = 1
--- Static props?
RENDERGROUP_STATIC = 6
--- For non transparent/solid entities. For scripted entities, this will have ENTITY:Draw called
RENDERGROUP_OPAQUE = 7
--- For translucent/transparent entities For scripted entities, this will have ENTITY:DrawTranslucent called
RENDERGROUP_TRANSLUCENT = 8
--- For both translucent/transparent and opaque/solid anim entities For scripted entities, this will have both, ENTITY:Draw and ENTITY:DrawTranslucent called
RENDERGROUP_BOTH = 9
--- Solid weapon view models
RENDERGROUP_VIEWMODEL = 10
--- Transparent overlays etc
RENDERGROUP_VIEWMODEL_TRANSLUCENT = 11
--- For brush entities
RENDERGROUP_OPAQUE_BRUSH = 12
--- Unclassfied. Won't get drawn.
RENDERGROUP_OTHER = 13
--- Default render mode. Transparently has no effect.
RENDERMODE_NORMAL = 0
--- Supports transparency. Use this to make alpha of Color work for your entity. For players, it must be set for their active weapon aswell.
RENDERMODE_TRANSCOLOR = 1
---
RENDERMODE_TRANSTEXTURE = 2
--- Intended for glowing sprites. Allows transparency, and forces the sprite or model to be rendered unlit.
--- The size of a sprite rendered with Glow is consistent with the screen size (unlike the alternative World Space Glow), making it appear larger at a distance, in comparison to the world.
--- The GlowProxySize keyvalue affects this Render Mode on sprites.
RENDERMODE_GLOW = 3
--- Enables Alphatesting. Legacy port from Goldsource. Obsolete in Source due to Alphatesting being handled in materials. Does not allow transparency.
RENDERMODE_TRANSALPHA = 4
--- Add the material's color values to the existing image, instead of performing a multiplication. Sprites will appear through world geometry and the sprite/model will always brighten the world. Allows transparency.
RENDERMODE_TRANSADD = 5
--- Causes the material to be not be drawn at all, similarly to Don't Render.
RENDERMODE_ENVIROMENTAL = 6
--- Functions like Additive, but also blends between animation frames. Requires the material to have a functioning animating texture. Allows transparency.
RENDERMODE_TRANSADDFRAMEBLEND = 7
--- Functions similarly to Additive, except that the alpha channel controls the opacity of the sprite. An example of use is for dark sprites, with an example material being sprites/strider_blackball.vmt.
RENDERMODE_TRANSALPHADD = 8
--- Functions similarly to Glow, with the exception that the size of the sprite is relative to the world rather than the screen.
--- The GlowProxySize keyvalue affects this Render Mode on sprites.
RENDERMODE_WORLDGLOW = 9
--- The entity is still being drawn and networked albeit invisible, therefore not making this Render Mode ideal for performance reasons.
--- To completely avoid drawing and networking an entity, see EF_NODRAW.
RENDERMODE_NONE = 10
--- Only allowed for render targets that don't want a depth buffer (because if they have a depth buffer, the render target must be less than or equal to the size of the framebuffer).
RT_SIZE_NO_CHANGE = 0
--- Don't play with the specified width and height other than making sure it fits in the framebuffer.
RT_SIZE_DEFAULT = 1
--- Apply picmip to the render target's width and height.
RT_SIZE_PICMIP = 2
--- frame_buffer_width / 4
RT_SIZE_HDR = 3
--- Same size as frame buffer, or next lower power of 2 if we can't do that.
RT_SIZE_FULL_FRAME_BUFFER = 4
--- Target of specified size, don't mess with dimensions
RT_SIZE_OFFSCREEN = 5
--- Same size as the frame buffer, rounded up if necessary for systems that can't do non-power of two textures.
RT_SIZE_FULL_FRAME_BUFFER_ROUNDED_UP = 6
--- Rounded down to power of 2, essentially
RT_SIZE_REPLAY_SCREENSHOT = 7
--- Use the size passed in. Don't clamp it to the frame buffer size. Really.
RT_SIZE_LITERAL = 8
---
RT_SIZE_LITERAL_PICMIP = 9
---
STUDIO_RENDER = 1
---
STUDIO_VIEWXFORMATTACHMENTS = 2
---
STUDIO_DRAWTRANSLUCENTSUBMODELS = 4
---
STUDIO_TWOPASS = 8
---
STUDIO_STATIC_LIGHTING = 16
---
STUDIO_WIREFRAME = 32
---
STUDIO_ITEM_BLINK = 64
---
STUDIO_NOSHADOWS = 128
---
STUDIO_WIREFRAME_VCOLLIDE = 256
--- Not a studio flag, but used to flag when we want studio stats
STUDIO_GENERATE_STATS = 16777216
--- Not a studio flag, but used to flag model as using shadow depth material override
STUDIO_SSAODEPTHTEXTURE = 134217728
--- Not a studio flag, but used to flag model as using shadow depth material override
STUDIO_SHADOWDEPTHTEXTURE = 1073741824
--- Not a studio flag, but used to flag model as a non-sorting brush model
STUDIO_TRANSPARENCY = 2147483648
--- Preserves the existing stencil buffer value.
STENCILOPERATION_KEEP = 1
--- Sets the value in the stencil buffer to 0.
STENCILOPERATION_ZERO = 2
--- Sets the value in the stencil buffer to the reference value, set using render.SetStencilReferenceValue.
STENCILOPERATION_REPLACE = 3
--- Increments the value in the stencil buffer by 1, clamping the result.
STENCILOPERATION_INCRSAT = 4
--- Decrements the value in the stencil buffer by 1, clamping the result.
STENCILOPERATION_DECRSAT = 5
--- Inverts the value in the stencil buffer.
STENCILOPERATION_INVERT = 6
--- Increments the value in the stencil buffer by 1, wrapping around on overflow.
STENCILOPERATION_INCR = 7
--- Decrements the value in the stencil buffer by 1, wrapping around on overflow.
STENCILOPERATION_DECR = 8
--- Never passes.
STENCILCOMPARISONFUNCTION_NEVER = 1
--- Passes where the reference value is less than the stencil value.
STENCILCOMPARISONFUNCTION_LESS = 2
--- Passes where the reference value is equal to the stencil value.
STENCILCOMPARISONFUNCTION_EQUAL = 3
--- Passes where the reference value is less than or equal to the stencil value.
STENCILCOMPARISONFUNCTION_LESSEQUAL = 4
--- Passes where the reference value is greater than the stencil value.
STENCILCOMPARISONFUNCTION_GREATER = 5
--- Passes where the reference value is not equal to the stencil value.
STENCILCOMPARISONFUNCTION_NOTEQUAL = 6
--- Passes where the reference value is greater than or equal to the stencil value.
STENCILCOMPARISONFUNCTION_GREATEREQUAL = 7
--- Always passes.
STENCILCOMPARISONFUNCTION_ALWAYS = 8
--- Never passes.
STENCIL_NEVER = 1
--- Passes where the reference value is less than the stencil value.
STENCIL_LESS = 2
--- Passes where the reference value is equal to the stencil value.
STENCIL_EQUAL = 3
--- Passes where the reference value is less than or equal to the stencil value.
STENCIL_LESSEQUAL = 4
--- Passes where the reference value is greater than the stencil value.
STENCIL_GREATER = 5
--- Passes where the reference value is not equal to the stencil value.
STENCIL_NOTEQUAL = 6
--- Passes where the reference value is greater than or equal to the stencil value.
STENCIL_GREATEREQUAL = 7
--- Always passes.
STENCIL_ALWAYS = 8
--- Preserves the existing stencil buffer value.
STENCIL_KEEP = 1
--- Sets the value in the stencil buffer to 0.
STENCIL_ZERO = 2
--- Sets the value in the stencil buffer to the reference value, set using render.SetStencilReferenceValue.
STENCIL_REPLACE = 3
--- Increments the value in the stencil buffer by 1, clamping the result.
STENCIL_INCRSAT = 4
--- Decrements the value in the stencil buffer by 1, clamping the result.
STENCIL_DECRSAT = 5
--- Inverts the value in the stencil buffer.
STENCIL_INVERT = 6
--- Increments the value in the stencil buffer by 1, wrapping around on overflow.
STENCIL_INCR = 7
--- Decrements the value in the stencil buffer by 1, wrapping around on overflow.
STENCIL_DECR = 8
SCREENFADE = {}
--- Fade out after the hold time has passed
SCREENFADE.IN = 1
--- Fade in, hold time passes, disappear
SCREENFADE.OUT = 2
--- With white color, turns the screen black
SCREENFADE.MODULATE = 4
--- No effects, never disappear
SCREENFADE.STAYOUT = 8
--- Appear, Disappear, no effects
SCREENFADE.PURGE = 16
--- Only allowed for render targets that don't want a depth buffer (because if they have a depth buffer, the render target must be less than or equal to the size of the framebuffer).
RT_SIZE_NO_CHANGE = 0
--- Don't play with the specified width and height other than making sure it fits in the framebuffer.
RT_SIZE_DEFAULT = 1
--- Apply picmip to the render target's width and height.
RT_SIZE_PICMIP = 2
--- frame_buffer_width / 4
RT_SIZE_HDR = 3
--- Same size as frame buffer, or next lower power of 2 if we can't do that.
RT_SIZE_FULL_FRAME_BUFFER = 4
--- Target of specified size, don't mess with dimensions
RT_SIZE_OFFSCREEN = 5
--- Same size as the frame buffer, rounded up if necessary for systems that can't do non-power of two textures.
RT_SIZE_FULL_FRAME_BUFFER_ROUNDED_UP = 6
--- Rounded down to power of 2, essentially
RT_SIZE_REPLAY_SCREENSHOT = 7
--- Use the size passed in. Don't clamp it to the frame buffer size. Really.
RT_SIZE_LITERAL = 8
---
RT_SIZE_LITERAL_PICMIP = 9
---
CREATERENDERTARGETFLAGS_HDR = 1
---
CREATERENDERTARGETFLAGS_AUTOMIPMAP = 2
---
CREATERENDERTARGETFLAGS_UNFILTERABLE_OK = 4
---
IMAGE_FORMAT_DEFAULT = -1
---
IMAGE_FORMAT_RGBA8888 = 0
---
IMAGE_FORMAT_ABGR8888 = 1
---
IMAGE_FORMAT_RGB888 = 2
---
IMAGE_FORMAT_BGR888 = 3
---
IMAGE_FORMAT_RGB565 = 4
---
IMAGE_FORMAT_ARGB8888 = 11
---
IMAGE_FORMAT_BGRA8888 = 12
---
IMAGE_FORMAT_RGBA16161616 = 25
---
IMAGE_FORMAT_RGBA16161616F = 24
--- None. No change.
_G.kRenderFxNone = 0
--- Slowly pulses the entitys transparency, +-15 to the current alpha.
_G.kRenderFxPulseSlow = 1
--- Quickly pulses the entitys transparency, +-15 to the current alpha.
_G.kRenderFxPulseFast = 2
--- Slowly pulses the entitys transparency, +-60 to the current alpha.
_G.kRenderFxPulseSlowWide = 3
--- Quickly pulses the entitys transparency, +-60 to the current alpha.
_G.kRenderFxPulseFastWide = 4
--- Slowly fades away the entity, making it completely invisible. Starts from whatever alpha the entity currently has set.
_G.kRenderFxFadeSlow = 5
--- Quickly fades away the entity, making it completely invisible. Starts from whatever alpha the entity currently has set.
_G.kRenderFxFadeFast = 6
--- Slowly solidifies the entity, making it fully opaque. Starts from whatever alpha the entity currently has set.
_G.kRenderFxSolidSlow = 7
--- Quickly solidifies the entity, making it fully opaque. Starts from whatever alpha the entity currently has set.
_G.kRenderFxSolidFast = 8
--- Slowly switches the entitys transparency between its alpha and 0.
_G.kRenderFxStrobeSlow = 9
--- Quickly switches the entitys transparency between its alpha and 0.
_G.kRenderFxStrobeFast = 10
--- Very quickly switches the entitys transparency between its alpha and 0.
_G.kRenderFxStrobeFaster = 11
--- Same as Strobe Slow, but the interval is more randomized.
_G.kRenderFxFlickerSlow = 12
--- Same as Strobe Fast, but the interval is more randomized.
_G.kRenderFxFlickerFast = 13
---
_G.kRenderFxNoDissipation = 14
--- Flickers ( randomizes ) the entitys transparency
_G.kRenderFxDistort = 15
--- Same as Distort, but fades the entity away the farther you are from it.
_G.kRenderFxHologram = 16
---
_G.kRenderFxExplode = 17
---
_G.kRenderFxGlowShell = 18
---
_G.kRenderFxClampMinScale = 19
---
_G.kRenderFxEnvRain = 20
---
_G.kRenderFxEnvSnow = 21
---
_G.kRenderFxSpotlight = 22
---
_G.kRenderFxRagdoll = 23
--- Quickly pulses the entitys transparency, from 0 to 255.
_G.kRenderFxPulseFastWider = 24
---
MATERIAL_LINES = 1
---
MATERIAL_LINE_LOOP = 5
---
MATERIAL_LINE_STRIP = 4
---
MATERIAL_POINTS = 0
---
MATERIAL_POLYGON = 6
---
MATERIAL_QUADS = 7
---
MATERIAL_TRIANGLES = 2
---
MATERIAL_TRIANGLE_STRIP = 3
--- Counter clock wise cull mode
MATERIAL_CULLMODE_CCW = 0
--- Clock wise cull mode
MATERIAL_CULLMODE_CW = 1
--- No fog
MATERIAL_FOG_NONE = 0
--- Linear fog
MATERIAL_FOG_LINEAR = 1
--- For use in conjunction with render.SetFogZ. Does not work if start distance is bigger than end distance. Ignores density setting. Seems to be broken? Used for underwater fog by the engine.
MATERIAL_FOG_LINEAR_BELOW_FOG_Z = 2
--- No light
MATERIAL_LIGHT_DISABLE = 0
--- Point light
MATERIAL_LIGHT_POINT = 1
--- Directional light
MATERIAL_LIGHT_DIRECTIONAL = 2
--- Spot light
MATERIAL_LIGHT_SPOT = 3
--- Do not create a depth-stencil buffer. Use the default depth-stencil buffer if used as render target 0.
MATERIAL_RT_DEPTH_SHARED = 0
--- Create a depth-stencil buffer. Use the created depth-stencil buffer if used as render target 0.
MATERIAL_RT_DEPTH_SEPARATE = 1
--- Do not create a depth-stencil buffer. Disable depth and stencil buffer usage if used as render target 0.
MATERIAL_RT_DEPTH_NONE = 2
--- Create a depth-stencil buffer. Use the created depth-stencil buffer if used as render target 0. Creates a color texture despite the name. Seems to behave the same as MATERIAL_RT_DEPTH_SEPARATE.
MATERIAL_RT_DEPTH_ONLY = 3
--- Not spectating
OBS_MODE_NONE = 0
---
OBS_MODE_DEATHCAM = 1
--- TF2-like freezecam
OBS_MODE_FREEZECAM = 2
--- Same as OBS_MODE_CHASE, but you can't rotate the view
OBS_MODE_FIXED = 3
--- First person cam
OBS_MODE_IN_EYE = 4
--- Chase cam, 3rd person cam, free rotation around the spectated target
OBS_MODE_CHASE = 5
--- Free roam/noclip-alike. Does not work from GM:PlayerDeath
OBS_MODE_ROAMING = 6
--- Particle spawns in entity's origin and does not follow it
PATTACH_ABSORIGIN = 0
--- Particle attaches to entity's origin and follows the entity
PATTACH_ABSORIGIN_FOLLOW = 1
--- Create at a custom origin, but don't follow
PATTACH_CUSTOMORIGIN = 2
--- Particle attaches to passed to ParticleEffectAttach attachment id, but does not follow the entity
PATTACH_POINT = 3
--- Particle attaches to passed to ParticleEffectAttach attachment id and follows the entity
PATTACH_POINT_FOLLOW = 4
--- Particle spawns in the beginning of coordinates ( Vector( 0, 0, 0 ) ), used for control points that don't attach to an entity
PATTACH_WORLDORIGIN = 5
TEXFILTER = {}
---
TEXFILTER.NONE = 0
---
TEXFILTER.POINT = 1
---
TEXFILTER.LINEAR = 2
---
TEXFILTER.ANISOTROPIC = 3
_G.color_white = Color(255, 255, 255, 255)
_G.color_black = Color(0, 0, 0, 255)
_G.color_transparent = Color(255, 255, 255, 0)
--- @class pixelvis_handle_t
local pixelvis_handle_t = {}
|
function Rokmar_Grievous_Wound(Unit, event, miscunit, misc)
print "Rokmar Grievous Wound"
Unit:FullCastSpellOnTarget(30923,Unit:GetClosestPlayer())
Unit:SendChatMessage(11, 0, "Bad wound...")
end
function Rokmar_Water_Split(Unit, event, miscunit, misc)
print "Rokmar Water Split"
Unit:FullCastSpellOnTarget(38973,Unit:GetClosestPlayer())
Unit:SendChatMessage(11, 0, "Grrrr...")
end
function Rokmar_Moss(Unit)
print "Rokmar Moss"
Unit:FullCastSpellOnTarget(30925,unit:GetClosestPlayer())
Unit:SendChatMessage(11, 0, "Grrrr...")
end
function Rokmar(unit, event, miscunit, misc)
print "Rokmar"
unit:RegisterEvent("Rokmar_Grievous_Wound",10000,0)
unit:RegisterEvent("Rokmar_Water_Split",13000,0)
unit:RegisterEvent("Rokmar_Moss",15000,0)
end
RegisterUnitEvent(17991,1,"Rokmar")
|
--[[
© 2020 TERRANOVA do not share, re-distribute or modify
without permission of the author.
--]]
ITEM.name = "Glasses";
ITEM.model = "models/props_junk/cardboard_box004a.mdl";
ITEM.outfitCategory = "glasses";
ITEM.category = "Clothing";
ITEM.description = "Glasses Base";
ITEM.width = 1;
ITEM.height = 1;
ITEM.price = 40
ITEM.backgroundColor = Color(19, 72, 96, 100)
ITEM.dropSound = {
"terranova/ui/clothes1.wav",
"terranova/ui/clothes2.wav",
"terranova/ui/clothes3.wav",
}
ITEM.iconCam = {
pos = Vector(-0.048255149275064, 145.85707092285, 0.012072434648871),
ang = Angle(0, 270, 0),
fov = 3.4040450253535
}
|
local plugin = require 'bluegate.plugins.plugin'
local util = require 'bluegate.utils.util'
local pretty = require 'pl.pretty'
local strx = require "pl.stringx"
local db = require "bluegate.dao.factory"
local node = require "bluegate.node"
local LogHandler = plugin.extend()
LogHandler.PRIORITY = 9000
LogHandler.VERSION = "1.0"
local client = require "resty.kafka.client"
local producer = require "resty.kafka.producer"
function LogHandler:_init()
self.name = "logkafka"
broker_list = {
{ host = node.conf.kafka.host, port = node.conf.kafka.port },
}
ngx.log(ngx.DEBUG,"-------->logkafka")
end
function LogHandler:log()
-- 定义json便于日志数据整理收集
local log_json = {}
log_json["status"] = ngx.var.status
log_json["host"]=ngx.var.host
log_json["server_name"]=ngx.var.server_name
log_json["server_addr"]=ngx.var.server_addr
log_json["server_port"]=ngx.var.server_port
log_json["server_protocol"]=ngx.var.server_protocol
log_json["body_bytes_sent"] = ngx.var.body_bytes_sent
log_json["request_uri"] = ngx.var.request_uri
log_json["upstream_response_time"] = ngx.var.upstream_response_time
log_json["request_time"] = ngx.var.request_time
log_json["upstream_addr"] = ngx.var.upstream_addr
log_json["scheme"] = ngx.var.scheme
log_json["time_local"] = ngx.var.time_local
log_json["http_referer"] = ngx.var.http_referer
log_json["http_user_agent"] = ngx.var.http_user_agent
log_json["http_x_forwarded_for"] = ngx.var.http_x_forwarded_for
log_json["remote_addr"] = ngx.var.remote_addr
log_json["remote_user"] = ngx.var.remote_user
log_json["mc"] = "amc"
-- 转换json为字符串
local message = cjson.encode(log_json);
-- 定义kafka异步生产者
local bp = producer:new(broker_list, { producer_type = "async" })
local ok, err = bp:send(node.conf.kafka.topic, nil, message)
if not ok then
ngx.log(ngx.ERR, "kafka send err:", err)
return
end
ngx.log(ngx.DEBUG,"ok=",ok)
end
return LogHandler
|
--[[
Flappy Bird Clone
Lua Build for Love2d
BaseState for state passed from StateMachine
Defines behavior and updates/rendering
Author: Troy Martin
beef.erikson.studios@gmail.com
]]
BaseState = Class{}
function BaseState:init() end
function BaseState:enter() end
function BaseState:exit() end
function BaseState:update(dt) end
function BaseState:render() end
|
local Context = require "context"
local MMC = require "mmc"
usage = [[mmc [OPTIONS]\n
-h/--help: Print this help.\n
-i/--input PATH: Input path to compress (file or dir).\n
-o/--output PATH: compression destination.\n
--overwrite: Overwrite the input content.\n
-c/--compression-level LEVEL: Compression level (Possible values: S, [M], L).\n
--img-min-length: Image minimum length.\n
--vid-bitrate: Video bitrate.\n
--vid-crf: Video CRF.\n
-l/--log-level LEVEL: Log level (Possible values: DEBUG, [INFO], ERROR).\n]]
local ctx = Context:new()
local i = 1
while i <= #arg do
a = arg[i]
if a=="-h" or a=="--help" then
print(usage)
os.exit(0)
elseif a=="-i" or a=="--input" then
i = i+1; ctx.inputPath = arg[i]
elseif a=="-o" or a=="--output" then
i = i+1; ctx.outputPath = arg[i]
elseif a == "--overwrite" then
ctx.outputMode = "OVERWRITE"
elseif a=="-c" or a=="--compression-level" then
i = i+1; ctx.compressionlevel = string.upper(arg[i])
elseif a =="--img-min-length" then
i = i+1; ctx.imgMinLength = tonumber(arg[i])
elseif a == "--vid-bitrate" then
i = i+1; ctx.videoBitrate = tonumber(arg[i])
elseif a == "--vid-crf" then
i = i+1; ctx.videoCrf = tonumber(arg[i])
elseif a=="-l" or a=="--log-level" then
i = i+1; ctx.loglevel = string.upper(arg[i])
else
error("Unknown arg " .. a)
end
i = i+1
end
MMC(ctx)
|
local centerOfMass = {}
local realVeh = nil
function math.round(number, decimals, method)
decimals = decimals or 0
local factor = 10 ^ decimals
if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
else return tonumber(("%."..decimals.."f"):format(number)) end
end
function playError()
playSoundFrontEnd(4)
end
local wHandling, wEdit, bSave , handlingList, theVehicle = nil, nil, nil, nil, nil
local saveToSQL = nil
local btn = {}
function createHandlingWindow(mode)
--outputDebugString(tostring(mode))
theVehicle = getPedOccupiedVehicle(localPlayer)
if not theVehicle or not mode then
return false
end
saveToSQL = mode
local width, height = 400, 400
local scrWidth, scrHeight = guiGetScreenSize()
local x = 0
local y = scrHeight-height
local year = getElementData(theVehicle, "year")
local brand = getElementData(theVehicle, "brand")
local model = getElementData(theVehicle, "model")
local vehicle_shop_id = getElementData(theVehicle, "vehicle_shop_id")
local vehName = year.." "..brand.." "..model
local title = ""
if mode == 0 then
title = "ALL instances of #"..vehicle_shop_id.." ("..vehName..")"
elseif mode == 1 then
title = "Unique Handling of vehicle ID#"..getElementData(theVehicle, "dbid").." ("..vehName..")"
elseif mode == 2 then
title = "Vehicle Stats - "..vehName
else
title = ""
end
if wHandling and isElement(wHandling) then
closeHandlingWindows()
end
local handlingCurrent = getVehicleHandling(theVehicle)
wHandling = guiCreateWindow(x, y, width, height, title, false)
guiWindowSetMovable(wHandling,false)
guiWindowSetSizable(wHandling,false)
--guiCreateStaticImage(0.05, 0.02, 0.9, 0.25, "logo.png", true, wHandling)
handlingList = guiCreateGridList(0, 0.05, 1, 0.875, true, wHandling)
guiGridListSetSortingEnabled(handlingList, false)
nameColumn = guiGridListAddColumn(handlingList, "Name", 0.73)
valueColumn = guiGridListAddColumn(handlingList, "Value", 0.2)
-- Engine Handling Lines
maxVelocity = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, maxVelocity, nameColumn, "Max Speed (Km/h)", false, false)
guiGridListSetItemText(handlingList, maxVelocity, valueColumn, ""..tostring(math.round(handlingCurrent["maxVelocity"], 0)).."", false, false)
acceleration = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, acceleration, nameColumn, "Acceleration", false, false)
guiGridListSetItemText(handlingList, acceleration, valueColumn, ""..tostring(math.round(handlingCurrent["engineAcceleration"], 1)).."", false, false)
engineInertia = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, engineInertia, nameColumn, "Engine Inertia", false, false)
guiGridListSetItemText(handlingList, engineInertia, valueColumn, ""..tostring(math.round(handlingCurrent["engineInertia"], 1)).."", false, false)
-- Suspension Handling Lines
lowerLimit = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, lowerLimit, nameColumn, "Suspension Height", false, false)
guiGridListSetItemText(handlingList, lowerLimit, valueColumn, ""..tostring(handlingCurrent["suspensionLowerLimit"]).."", false, false)
suspensionBias = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, suspensionBias, nameColumn, "Suspension Bias", false, false)
guiGridListSetItemText(handlingList, suspensionBias, valueColumn, ""..tostring(math.round(handlingCurrent["suspensionFrontRearBias"], 1)).."", false, false)
suspensionForce = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, suspensionForce, nameColumn, "Suspension Force", false, false)
guiGridListSetItemText(handlingList, suspensionForce, valueColumn, ""..tostring(math.round(handlingCurrent["suspensionForceLevel"], 3)).."", false, false)
suspensionDamping = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, suspensionDamping, nameColumn, "Suspension Damping", false, false)
guiGridListSetItemText(handlingList, suspensionDamping, valueColumn, ""..tostring(math.round(handlingCurrent["suspensionDamping"], 5)).."", false, false)
steeringLock = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, steeringLock, nameColumn, "Steering Lock", false, false)
guiGridListSetItemText(handlingList, steeringLock, valueColumn, ""..tostring(math.round(handlingCurrent["steeringLock"], 1)).."", false, false)
driveType = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, driveType, nameColumn, "Drive Type", false, false)
guiGridListSetItemText(handlingList, driveType, valueColumn, ""..tostring(handlingCurrent["driveType"]).."", false, false)
massWeight = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, massWeight, nameColumn, "Mass Weight (Kg)", false, false)
guiGridListSetItemText(handlingList, massWeight, valueColumn, ""..tostring(math.round(handlingCurrent["mass"], 0)).."", false, false)
massX = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, massX, nameColumn, "Center of Mass X", false, false)
guiGridListSetItemText(handlingList, massX, valueColumn, ""..math.round(handlingCurrent["centerOfMass"][1], 2).."", false, false)
massY = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, massY, nameColumn, "Center of Mass Y", false, false)
guiGridListSetItemText(handlingList, massY, valueColumn, ""..math.round(handlingCurrent["centerOfMass"][2], 2).."", false, false)
massZ = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, massZ, nameColumn, "Center of Mass Z", false, false)
guiGridListSetItemText(handlingList, massZ, valueColumn, ""..math.round(handlingCurrent["centerOfMass"][3], 2).."", false, false)
dragCoeff = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, dragCoeff, nameColumn, "Drag Coefficiency", false, false)
guiGridListSetItemText(handlingList, dragCoeff, valueColumn, ""..tostring(math.round(handlingCurrent["dragCoeff"], 1)).."", false, false)
brakeForce = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, brakeForce, nameColumn, "Braking Power", false, false)
guiGridListSetItemText(handlingList, brakeForce, valueColumn, ""..tostring(math.round(handlingCurrent["brakeDeceleration"], 1)).."", false, false)
brakeBias = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, brakeBias, nameColumn, "Braking Bias", false, false)
guiGridListSetItemText(handlingList, brakeBias, valueColumn, ""..tostring(math.round(handlingCurrent["brakeBias"], 1)).."", false, false)
tracMultiply = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, tracMultiply, nameColumn, "Traction Multiplier", false, false)
guiGridListSetItemText(handlingList, tracMultiply, valueColumn, ""..tostring(math.round(handlingCurrent["tractionMultiplier"], 2)).."", false, false)
tracBias = guiGridListAddRow(handlingList)
guiGridListSetItemText(handlingList, tracBias, nameColumn, "Traction Bias", false, false)
guiGridListSetItemText(handlingList, tracBias, valueColumn, ""..tostring(math.round(handlingCurrent["tractionBias"], 2)).."", false, false)
if mode == 0 then -- All Instances
bReset = guiCreateButton(0.05, 0.925, 0.45, 0.05, "Load Default", true, wHandling)
addEventHandler( "onClientGUIClick", bReset,
function( button )
if button == "left" then
triggerServerEvent("handlingSystem:resetHandling", getLocalPlayer(), theVehicle, mode)
playSuccess()
end
end,
false)
guiSetEnabled(bReset, false)
bSave = guiCreateButton(0.5, 0.925, 0.45, 0.05, "Save To Database", true, wHandling)
addEventHandler( "onClientGUIClick", bSave,
function( button )
if button == "left" then
applyHandling(theVehicle, saveToSQL)
showConfirmReloadAllInstances(vehicle_shop_id, vehName)
end
end,
false)
guiSetEnabled(bSave, false)
elseif mode == 1 or mode == 2 then -- Car shop test drive or Edit Unique Handling
local btnW = 0.2
btn["close"] = guiCreateButton(0.01, 0.925, btnW , 0.05, "Close", true, wHandling)
addEventHandler( "onClientGUIClick", btn["close"],
function( button )
if button == "left" then
closeHandlingWindows()
--triggerServerEvent("handlingSystem:resetHandling", getLocalPlayer(), theVehicle, mode)
--playSuccess()
end
end,
false)
--guiSetEnabled(btn["close"] , false)
if mode == 1 then -- Edit Unique Handling
btn["reset"] = guiCreateButton(0.01+(btnW*1+0.005), 0.925, btnW, 0.05, "Reset", true, wHandling)
addEventHandler( "onClientGUIClick", btn["reset"],
function( button )
if button == "left" then
closeHandlingWindows()
triggerServerEvent("handlingSystem:resetHandling", getLocalPlayer(), theVehicle, mode)
playSuccess()
end
end,
false)
guiSetEnabled(btn["reset"] , false)
btn["save"] = guiCreateButton(0.01+(btnW*2+0.005), 0.925, btnW*2, 0.05, "Save To Database", true, wHandling)
addEventHandler( "onClientGUIClick", btn["save"],
function( button )
if button == "left" then
applyHandling(theVehicle, mode)
--showConfirmSaveUniqueHandling(theVehicle, mode)
end
end,
false)
guiSetEnabled(btn["save"] , false)
end
end
addEventHandler("onClientGUIDoubleClick", handlingList, editHandlingWindow)
if (exports.mrp_integration:isPlayerVehicleConsultant(localPlayer) or exports.mrp_integration:isPlayerAdmin(localPlayer)) then
if btn["save"] and isElement(btn["save"]) then
guiSetEnabled(btn["save"] , true)
end
if btn["reset"] and isElement(btn["reset"]) then
guiSetEnabled(btn["reset"] , true)
end
if bSave and isElement(bSave) then
guiSetEnabled(bSave, true)
end
if bReset and isElement(bReset) then
guiSetEnabled(bReset, true)
end
elseif exports.mrp_integration:isPlayerVCTMember(localPlayer) then
if bReset and isElement(bReset) then
guiSetEnabled(bReset, true)
end
else
removeEventHandler("onClientGUIDoubleClick", handlingList, editHandlingWindow)
end
end
addEvent("veh-manager:handling:edithandling", true)
addEventHandler("veh-manager:handling:edithandling",localPlayer, createHandlingWindow)
--addCommandHandler("edithandling", createHandlingWindow)
function closeHandlingWindows()
if wHandling and isElement(wHandling) then
destroyElement(wHandling)
wHandling = nil
end
closeEditWindow()
closeConfirmReloadAllInstances()
end
function applyHandling(veh, saveToSQL)
local maxVelocityS = guiGridListGetItemText(handlingList, maxVelocity, valueColumn )
local accelerationS = guiGridListGetItemText(handlingList, acceleration, valueColumn )
local engineInertiaS = guiGridListGetItemText(handlingList, engineInertia, valueColumn )
local lowerLimitS = guiGridListGetItemText(handlingList, lowerLimit, valueColumn )
local suspensionBiasS = guiGridListGetItemText(handlingList, suspensionBias, valueColumn )
local suspensionForceS = guiGridListGetItemText(handlingList, suspensionForce, valueColumn )
local suspensionDampingS = guiGridListGetItemText(handlingList, suspensionDamping, valueColumn )
local steeringLockS = guiGridListGetItemText(handlingList, steeringLock, valueColumn )
local driveTypeS = guiGridListGetItemText(handlingList, driveType, valueColumn )
local massWeightS = guiGridListGetItemText(handlingList, massWeight, valueColumn )
local dragCoeffS = guiGridListGetItemText(handlingList, dragCoeff, valueColumn )
local brakeForceS = guiGridListGetItemText(handlingList, brakeForce, valueColumn )
local brakeBiasS = guiGridListGetItemText(handlingList, brakeBias, valueColumn )
local tracMultiplyS = guiGridListGetItemText(handlingList, tracMultiply, valueColumn )
local tracBiasS = guiGridListGetItemText(handlingList, tracBias, valueColumn )
local massXS = guiGridListGetItemText(handlingList, massX, valueColumn )
local massYS = guiGridListGetItemText(handlingList, massY, valueColumn )
local massZS = guiGridListGetItemText(handlingList, massZ, valueColumn )
local centerOfMass = {}
table.insert(centerOfMass, 1, massXS)
table.insert(centerOfMass, 2, massYS)
table.insert(centerOfMass, 3, massZS)
-- Limits
if tonumber(engineInertiaS) < 0.1 or tonumber(engineInertiaS) > 30 then -- Engine Intertia 0.1 - 30
outputChatBox("Error: Engine Intertia must be between 0.1 and 30.", 255, 0, 0)
playError()
return
elseif tonumber(suspensionDampingS) < 0.01 or tonumber(suspensionDampingS) > 0.2 then -- Suspension Damping 0.01 - 0.2
outputChatBox("Error: Suspension Damping must be between 0.01 and 0.2.", 255, 0, 0)
playError()
return
end
playSuccess() -- If continues play success sound.
triggerServerEvent("handlingSystem:setHandling", getLocalPlayer(), veh, saveToSQL, maxVelocityS, accelerationS, engineInertiaS, lowerLimitS, suspensionBiasS, suspensionForceS, suspensionDampingS, steeringLockS, driveTypeS, massWeightS, dragCoeffS, brakeForceS, brakeBiasS, tracMultiplyS, tracBiasS, centerOfMass)
end
function editHandlingWindow()
if saveToSQL == 1 or saveToSQL == 0 then
local width = 200
local height = 125
local screenwidth, screenheight = guiGetScreenSize()
local x = (screenwidth - width)/2
local y = (screenheight - height)/2
if not (wEdit) then
sr, sc = guiGridListGetSelectedItem(handlingList)
name = guiGridListGetItemText(handlingList, sr, sc)
value = guiGridListGetItemText(handlingList, sr, valueColumn)
if (source == handlingList) and not (name == "") then
guiSetInputEnabled(true)
wEdit = guiCreateWindow(x, y, width, height, "Edit Handling - ".. name .."", false)
newValue = guiCreateEdit(0.03, 0.20, 2.0, 0.3, ""..value.."", true, wEdit)
finishEdit = guiCreateButton(0.6, 0.75, 0.4, 0.2, "Done", true, wEdit)
addEventHandler("onClientGUIClick", finishEdit, newHandling)
cancelEdit = guiCreateButton(0.05, 0.75, 0.4, 0.2, "Cancel", true, wEdit)
addEventHandler("onClientGUIClick", cancelEdit, cancelHandling)
if name == "Drive Type" then
info = guiCreateLabel(0.05,0.55,0.9,0.2, "rwd/fwd/awd", true, wEdit)
guiLabelSetHorizontalAlign(info, "center", true)
else
for k, v in pairs(handlingValues) do
if name == tostring(v[1]) then
info = guiCreateLabel(0.05,0.55,0.9,0.2, "Min: "..v[2].." Max: "..v[3].."", true, wEdit)
guiLabelSetHorizontalAlign(info, "center", true)
end
end
end
addEventHandler("onClientGUIChanged", newValue, checkValues)
end
end
end
end
function closeEditWindow()
if wEdit and isElement(wEdit) then
destroyElement(wEdit)
wEdit = nil
end
end
function checkValues()
for k, v in pairs(handlingValues) do
if name == tostring(v[1]) then
if string.len(guiGetText(source)) > 0 then
if tonumber(guiGetText(source)) > v[2] - 0.0001 and tonumber(guiGetText(source)) < v[3] + 0.0001 then
guiSetEnabled(finishEdit, true)
else
guiSetEnabled(finishEdit, false)
end
else
guiSetEnabled(finishEdit, false)
end
elseif name == "Drive Type" then
if tostring(guiGetText(source)) == "rwd" or tostring(guiGetText(source)) == "fwd" or tostring(guiGetText(source)) == "awd" then
guiSetEnabled(finishEdit, true)
else
guiSetEnabled(finishEdit, false)
end
end
end
end
function newHandling()
if (source==finishEdit) and (newValue) then
local data = guiGetText(newValue)
guiGridListSetItemText(handlingList, sr, valueColumn, data, false, false)
applyHandling(theVehicle, false)
destroyElement(wEdit)
wEdit = nil
guiSetInputEnabled(false)
showCursor(false)
playSuccess()
end
end
function cancelHandling()
if (source==cancelEdit) then
guiSetInputEnabled(false)
destroyElement(wEdit)
wEdit = nil
guiSetInputEnabled(false)
showCursor(false)
end
end
local GUIEditor_Window = {}
local GUIEditor_Button = {}
local GUIEditor_Label = {}
local driveTestTimer = nil
function showConfirmReloadAllInstances(vehicle_shop_id, vehName)
closeConfirmReloadAllInstances()
local width, height = 522,252
local scrWidth, scrHeight = guiGetScreenSize()
local x = (scrWidth-width)/2
local y = (scrHeight-height)/2
GUIEditor_Window["reloadconfirmw"] = guiCreateWindow(x, y, width, height, "Reload all vehicles instances of #"..vehicle_shop_id.."("..vehName..")",false)
GUIEditor_Label["reloadconfirml"] = guiCreateLabel(0.0383,0.1429,0.931,0.6468,"You have changed handlings for all instances of vehicle shop ID #"..vehicle_shop_id.."("..vehName.."). \n\nHowever, vehicles existed in game before this moment didn't get effected until next vehicle system restart. \n\nDo you want to force reload all vehicles instances of this model?\n\n*Reloading all vehicle instances might causes server's massive lag, try to avoid reloading all instances unnecessarily by using /reloadveh [id] instead*",true,GUIEditor_Window["reloadconfirmw"])
guiLabelSetHorizontalAlign(GUIEditor_Label["reloadconfirml"],"left",true)
GUIEditor_Button["reloadconfirm_ok"] = guiCreateButton(0.0172,0.8294,0.4808,0.127,"Reload ALL, I know what I'm doing",true,GUIEditor_Window["reloadconfirmw"])
addEventHandler( "onClientGUIClick", GUIEditor_Button["reloadconfirm_ok"],
function( button )
if button == "left" then
triggerServerEvent("vehicle_manager:handling:reloadAllInstancesOf", localPlayer, vehicle_shop_id )
playSuccess()
closeConfirmReloadAllInstances()
end
end,
false)
GUIEditor_Button["reloadconfirml_cancel"] = guiCreateButton(0.4981,0.8294,0.4789,0.127,"Cancel",true,GUIEditor_Window["reloadconfirmw"])
addEventHandler( "onClientGUIClick", GUIEditor_Button["reloadconfirml_cancel"],
function( button )
if button == "left" then
closeConfirmReloadAllInstances()
end
end,
false)
end
function closeConfirmReloadAllInstances()
if GUIEditor_Window["reloadconfirmw"] and isElement(GUIEditor_Window["reloadconfirmw"]) then
destroyElement(GUIEditor_Window["reloadconfirmw"])
GUIEditor_Window["reloadconfirmw"] = nil
end
end
function showDriveTestTimer(veh, driveTestTimeSec, thePed)
realVeh = veh
closeCountdownDriveTest()
local width, height = 314,83
local scrWidth, scrHeight = guiGetScreenSize()
local x = scrWidth/2 - (width/2)
local y = 20
GUIEditor_Window["drivetest"] = guiCreateWindow(x, y, width, height,"",false)
guiSetAlpha(GUIEditor_Window["drivetest"],0.80000001192093)
guiWindowSetMovable(GUIEditor_Window["drivetest"],false)
guiWindowSetSizable(GUIEditor_Window["drivetest"],false)
guiSetProperty(GUIEditor_Window["drivetest"],"AlwaysOnTop","true")
--guiSetProperty(GUIEditor_Window["drivetest"],"TitlebarEnabled","false")
GUIEditor_Label["second"] = guiCreateLabel(5,22,305,18,"You have "..driveTestTimeSec.." seconds before this test drive ends.",false,GUIEditor_Window["drivetest"])
guiLabelSetHorizontalAlign(GUIEditor_Label["second"],"center",false)
GUIEditor_Button["finish"] = guiCreateButton(15,46,286,26,"FINISH",false,GUIEditor_Window["drivetest"])
addEventHandler( "onClientGUIClick", GUIEditor_Button["finish"], function()
if source == GUIEditor_Button["finish"] then
exports.mrp_global:fadeToBlack()
setTimer(function ()
closeCountdownDriveTest()
triggerServerEvent("vehicle_manager:handling:finishTestDrive", localPlayer, veh, thePed )
end, 1000, 1)
playSuccess()
setTimer(function ()
exports.mrp_global:fadeFromBlack(source)
end, 3000, 1)
end
end)
if thePed then
guiSetSize(GUIEditor_Window["drivetest"], width, height+28, false)
GUIEditor_Button["orderfinish"] = guiCreateButton(15,46+28,286,26,"ORDER & FINISH",false,GUIEditor_Window["drivetest"])
addEventHandler( "onClientGUIClick", GUIEditor_Button["orderfinish"], function()
if source == GUIEditor_Button["orderfinish"] then
exports.mrp_global:fadeToBlack()
setTimer(function ()
closeCountdownDriveTest()
triggerServerEvent("vehicle_manager:handling:finishTestDrive", localPlayer, veh, thePed, true )
end, 1000, 1)
playSuccess()
setTimer(function ()
exports.mrp_global:fadeFromBlack(source)
end, 3000, 1)
end
end)
end
countdownDriveTest(driveTestTimeSec)
setTimer(function()
exports.mrp_global:fadeFromBlack()
end, 1000, 1)
end
addEvent("veh-manager:handling:testdrivetimerGUI", true)
addEventHandler("veh-manager:handling:testdrivetimerGUI",localPlayer, showDriveTestTimer)
function countdownDriveTest(driveTestTimeSec)
if isElement(GUIEditor_Label["second"]) then
driveTestTimer = setTimer(function()
driveTestTimeSec = driveTestTimeSec - 1
guiSetText(GUIEditor_Label["second"], "You have "..driveTestTimeSec.." seconds before this test drive ends.")
if driveTestTimeSec <= 0 then
closeCountdownDriveTest()
end
end, 1000, 0)
end
end
function closeCountdownDriveTest()
if GUIEditor_Window["drivetest"] and isElement(GUIEditor_Window["drivetest"]) then
destroyElement(GUIEditor_Window["drivetest"])
GUIEditor_Window["drivetest"] = nil
end
killDriveTestTimer()
closeHandlingWindows()
realVeh = nil
end
function killDriveTestTimer()
if isTimer(driveTestTimer) then
killTimer(driveTestTimer)
end
end
function start_cl_resource()
exports.mrp_global:fadeFromBlack()
end
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),start_cl_resource)
function killTestDrive()
if realVeh then
closeCountdownDriveTest()
triggerServerEvent("vehicle_manager:handling:finishTestDrive", localPlayer, realVeh, thePed, false, true )
end
end
-- changing chars should kill dis
addEventHandler('onClientChangeChar', root, killTestDrive)
addEventHandler('onClientPlayerChangeNick', localPlayer, killTestDrive)
|
local XMLUtils = {}
local _buffer = {}
local _entities = { amp=38, apos=39, gt=62, lt=60, nbsp=32, quot=34 }
function XMLUtils.encode(str)
str = string.gsub(str, "&", "&")
str = string.gsub(str, "<", "<")
str = string.gsub(str, ">", ">")
str = string.gsub(str, "'", "'")
return str
end
function XMLUtils.decode(aSource)
local len = #aSource
local blen = 0
local pos1 = 1
local pos2 = 1
while true do
pos2 = string.find(aSource, '&', pos1, true)
if pos2 == nil then
blen = blen+1
_buffer[blen] = string.sub(aSource, pos1)
break
end
if pos2>pos1 then
blen = blen+1
_buffer[blen] = string.sub(aSource, pos1, pos2 - 1)
end
pos1 = pos2 + 1
pos2 = pos1
local ends = math.min(len, pos2 + 10)
for i=pos2,ends do
if string.byte(aSource,pos2,pos2) == 59 then -- ''
break
end
pos2=pos2+1
end
if pos2 <= ends and pos2 > pos1 then
local entity = string.sub(aSource, pos1, pos2-1)
local u = 0
if string.byte(entity,1,1) == 35 then --'#'
if #entity > 1 then
if string.byte(entity,2,2) == 120 then --'x'
u = tonumber(string.sub(entity, 3), 16)
else
u = tonumber(string.sub(entity, 2))
end
blen = blen+1
_buffer[blen] = string.char(u)
pos1 = pos2 + 1
else
blen = blen+1
_buffer[blen] = '&'
end
else
u = _entities[entity]
if u ~= nil then
blen = blen+1
_buffer[blen] = string.char(u)
pos1 = pos2 + 1
else
blen = blen+1
_buffer[blen] = '&'
end
end
else
blen = blen+1
_buffer[blen] = '&'
end
end
return table.concat(_buffer,'',1,blen)
end
return XMLUtils
|
table.append = table.insert
table.empty = function (t)
return next(t) == nil
end
table.size = function (t)
local size = 0
for i, n in pairs(table) do
size = size + 1
end
return size
end
table.find = function (table, value, sensitive)
local sensitive = sensitive or true
if(not sensitive and type(value) == "string") then
for i, v in pairs(table) do
if(type(v) == "string") then
if(v:lower() == value:lower()) then
return i
end
end
end
return nil
end
for i, v in pairs(table) do
if(v == value) then
return i
end
end
return nil
end
table.getPos = table.find
table.contains = function (txt, str)
for i, v in pairs(str) do
if(txt:find(v) and not txt:find('(%w+)' .. v) and not txt:find(v .. '(%w+)')) then
return true
end
end
return false
end
table.isStrIn = table.contains
table.count = function (table, item)
local count = 0
for i, n in pairs(table) do
if(item == n) then
count = count + 1
end
end
return count
end
table.countElements = table.count
table.getCombinations = function (table, num)
local a, number, select, newList = {}, table.size(table), num, {}
for i = 1, select do
table.insert(a, i)
end
local newThing = {}
while(true) do
local newRow = {}
for i = 1, select do
table.insert(newRow, table[a[i]])
end
table.insert(newList, newRow)
i = select
while(a[i] == (number - select + i)) do
i = i - 1
end
if(i < 1) then
break
end
a[i] = a[i] + 1
for j = i, select do
a[j] = a[i] + j - i
end
end
return newList
end
function table.serialize(x, recur)
local t = type(x)
recur = recur or {}
if(t == nil) then
return "nil"
elseif(t == "string") then
return string.format("%q", x)
elseif(t == "number") then
return tostring(x)
elseif(t == "boolean") then
return x and "true" or "false"
elseif(getmetatable(x)) then
error("Can not serialize a table that has a metatable associated with it.")
elseif(t == "table") then
if(table.find(recur, x)) then
error("Can not serialize recursive tables.")
end
table.append(recur, x)
local s = "{"
for k, v in pairs(x) do
s = s .. "[" .. table.serialize(k, recur) .. "]" .. " = " .. table.serialize(v, recur) .. ", "
end
return s:sub(0, s:len() - 2) .. "}"
end
error("Can not serialize value of type '" .. t .. "'.")
end
function table.unserialize(str)
if(type(str) ~= 'string' or str:len() == 0) then
return {}
end
return loadstring("return " .. str)()
end
|
data.raw["gui-style"].default["heli-listbox_button"] =
{
type = "button_style",
parent = "button",
font = "default-bold",
align = "left",
scalable = true,
height = 23,
top_padding = 0,
right_padding = 0,
bottom_padding = 0,
left_padding = 5,
left_click_sound =
{
{
filename = "__core__/sound/list-box-click.ogg",
volume = 1
}
},
default_font_color={r=1, g=1, b=1},
default_graphical_set =
{
type = "composition",
filename = "__Helicopters__/graphics/gui/black.png",
priority = "extra-high-no-scale",
corner_size = {0, 0},
position = {0, 0}
},
hovered_font_color={r=1, g=1, b=1},
hovered_graphical_set =
{
type = "composition",
filename = "__Helicopters__/graphics/gui/grey.png",
priority = "extra-high-no-scale",
corner_size = {0, 0},
position = {0, 0}
},
clicked_font_color = {r=0, g=0, b=0},
clicked_graphical_set =
{
type = "composition",
filename = "__Helicopters__/graphics/gui/orange.png",
priority = "extra-high-no-scale",
corner_size = {0, 0},
position = {0, 0}
},
}
data.raw["gui-style"].default["heli-clear_text_button"] =
{
type = "button_style",
parent = "button",
scalable = true,
width = 15,
height = 15,
top_padding = 4,
right_padding = 0,
bottom_padding = 0,
left_padding = 0,
default_graphical_set =
{
type = "monolith",
--monolith_border = 1,
monolith_image =
{
filename = "__Helicopters__/graphics/icons/clear-text.png",
priority = "extra-high-no-scale",
width = 15,
height = 15
},
stretch_monolith_image_to_size = false
},
hovered_graphical_set =
{
type = "monolith",
--monolith_border = 1,
monolith_image =
{
filename = "__Helicopters__/graphics/icons/clear-text.png",
priority = "extra-high-no-scale",
width = 15,
height = 15,
x = 15,
},
stretch_monolith_image_to_size = false
},
clicked_graphical_set =
{
type = "monolith",
--monolith_border = 1,
monolith_image =
{
filename = "__Helicopters__/graphics/icons/clear-text.png",
priority = "extra-high-no-scale",
width = 15,
height = 15,
x = 30,
},
stretch_monolith_image_to_size = false
},
}
|
--[[
XmlRpc.lua
Depends on LrXml.
--]]
local XmlRpc, dbg = Object:newClass{ className = 'XmlRpc' }
--- Constructor for extending class.
--
function XmlRpc:newClass( t )
return Object.newClass( self, t )
end
--- Constructor for new instance.
--
-- @param t parameter table may include url, or it may be supplied later.
--
function XmlRpc:new( t )
local o = Object.new( self, t )
if o.url then
else
error( "XmlRpc needs URL" )
end
return o
end
-- Initializer for submission URL, in case not known at construction time.
--
-- @param t parameter table to include url.
--
function XmlRpc:_init( t )
self.url = t.url
end
--- send rpc request, and fetch expected reply.
--
-- @param t (table or string, required)
-- <br>If string, its the remote procedure name, and default timeout is implied.
-- <br>If table, it must have procName in it, and optional timeout.
-- @param ... remote procedure parameters.
--
-- @return sts (boolean, always) true iff worked.
-- @return msgOrValues (string or table) error messages or array of return values, properly typed (may be empty table, but wont be nil).
--
function XmlRpc:sendAndReceive( t, ... )
assert( self.url ~= nil, "Missing XmlRpc Url..." )
local encodeArray
local encodeStruct
-- *** WARNING: No attempt is made to discern if array table has struct elems - struct elems will be ignored if looks like array.
local function encodeValue( v )
local val = v
local typ = type( v )
Debug.lognpp( "Encoding param: ", typ, val )
if typ == 'table' then
if #val > 0 or tab:isEmpty( val ) then -- looks like an array (encode empty tables as array)
val = encodeArray( v )
typ = 'array'
else
val = encodeStruct( v )
typ = 'struct'
end
elseif typ == 'string' then
-- good
elseif typ == 'number' then
if num:isInteger( v ) then
-- typ = 'int'
typ = 'i4'
else
typ = 'double'
end
elseif typ == 'boolean' then
if v then
val = 1
else
val = 0
end
else
error( "type not supported " .. typ )
end
return { value = val, type = typ }
end
local function encodeKeyValuePair( key, value )
local kvp = { name = key }
kvp.value = encodeValue( value )
return kvp
end
local function encodeArray( array ) -- how is this not causing a strict global policy violation?
Debug.lognpp( "Encoding array: ", array )
local a = {}
for i, v in ipairs( array ) do
a[#a + 1] = encodeValue( v )
end
return a
end
local function encodeStruct( struct )
Debug.lognpp( "Encoding struct: ", struct )
local a = {}
for k, v in pairs( struct ) do
a[#a + 1] = encodeKeyValuePair( k, v )
end
return a
end
local name, tmo, params
if type( t ) == 'table' then
name = t.procName or error( "need proc-name" )
tmo = t.timeout or 10
else
name = t
tmo = 10
end
Debug.lognpp( "Decoding parameters for remote procedure call: " .. name )
if name == 'reply' then
Debug.lognpp( {...} )
end
-- first translate ... to type/value pairs: just to make the code simpler for now (albeit less efficient).
params = {}
for i,v in ipairs{ ... } do
params[#params + 1] = encodeValue( v )
end
if name == 'reply' then
Debug.lognpp( params )
end
local bldr = LrXml.createXmlBuilder( false ) -- false => include decl.
local buildStruct
local buildArray
local function buildValue( v )
Debug.lognpp( "building param value", v )
bldr:beginBlock( "value" )
if v.type == 'array' then
buildArray( v.value )
elseif v.type == 'struct' then
buildStruct( v.value )
else
bldr:tag( v.type, v.value )
end
bldr:endBlock()
end
local function buildArray( a )
Debug.lognpp( "building array param", a )
bldr:beginBlock( "array" )
bldr:beginBlock( "data" )
for i, v in ipairs( a ) do
buildValue( v )
end
bldr:endBlock()
bldr:endBlock()
end
local function buildStruct( a )
Debug.lognpp( "building struct param", a )
bldr:beginBlock( "struct" )
for i, v in ipairs( a ) do
bldr:beginBlock( "member" )
bldr:tag( 'name', v.name )
bldr:beginBlock( "value" )
bldr:tag( v.value.type, v.value.value )
bldr:endBlock()
bldr:endBlock()
end
bldr:endBlock()
end
bldr:beginBlock( "methodCall" )
bldr:tag( "methodName", name ) -- no attrs
if params and #params > 0 then
bldr:beginBlock( "params" )
for i,v in ipairs( params ) do
bldr:beginBlock( "param" )
buildValue( v )
bldr:endBlock()
end
bldr:endBlock()
end
bldr:endBlock()
local xmlReq = bldr:serialize()
dbg( "req:", xmlReq, "url:", self.url, "tmo:", tmo )
local reqHdrs = {}
reqHdrs[#reqHdrs + 1] = { field='Content-Length', value='' .. xmlReq:len() }
-- S E N D X M L R E Q U E S T A N D R E C E I V E R E P L Y
--local body, hdrs = LrHttp.post( self.url, xmlReq, reqHdrs, "POST", tmo ) -- this would be OK, but status check below for debug...
local status, body, hdrs = LrTasks.pcall( LrHttp.post, self.url, xmlReq, reqHdrs, "POST", tmo )
-- dbg( "hdrs: ", #hdrs )
if status then
if hdrs then
if hdrs.status ~= nil then
if hdrs.status ~= 200 then
return false, "Web server http response status: " .. hdrs.status
else
-- fall-through to continue
end
else
Debug.lognpp( "hdrs", hdrs )
return false, "Web server did not respond to http request (check internet connection)."
end
else
return false, "LrHttp.post did not return header table."
end
else
return false, "Unable to acquire HTTP post response: " .. str:to( body )
end
local start, stop = body:find( '<?xml', 1, true )
if start then
body = body:sub( start )
dbg( "body: ", body )
else
error( "Spec requires xml declaration in response: " .. body:sub( 1, 100 ) )
end
local xml = LrXml.parseXml( body ) -- xml IS root node.
if not xml then
error( "Invalid response from " .. self.url .. " - unparsable xml." )
end
-- dbg( "root: ", xml:name() )
if xml:name() ~= 'methodResponse' then
error( "Invalid xml response from " .. self.url .. " - root node not method-response, is: " .. xml:name() )
end
local paramNode = xml:childAtIndex( 1 )
if not paramNode then
error( "Invalid xml response from " .. self.url .. " - no param node." )
end
-- note: this implementation requires at least a one-parameter response from the server.
-- I dunno if the spec also thinks thats a good idea, but I sure do...
if paramNode:name() == 'params' then
local values = self:_getParamValues( paramNode )
return true, values
elseif paramNode:name() == 'fault' then -- calling context decodes fault response.
local faultStruct = self:_getFaultStruct( xml )
return false, str:fmt( "RPC Server Fault, fault-code: ^1, fault-string: ^2", str:to( faultStruct.faultCode ), str:to( faultStruct.faultString ) )
else
error( "Invalid xml response from " .. self.url .. " - param node not recognized: " .. paramNode:name() )
end
end
-- Get response parameter values.
--
-- @param params params node.
--
function XmlRpc:_getParamValues( params )
local index = 0
local max = params:childCount()
local decodeArray
local function decodeValue( valueNode )
local typeNode = valueNode:childAtIndex( 1 )
if typeNode:name() == 'array' then
return decodeArray( typeNode:childAtIndex( 1 ) ) -- data node
else
local typ = typeNode:name()
local val = typeNode:text()
if typ == 'string' then
-- good to go
elseif typ == 'int' or typ == 'i4' then
val = tonumber( val )
elseif typ == 'boolean' then
if val == "1" then
val = true
elseif val == "0" then
val = false
else
error( "bad boolean" )
end
elseif typ == 'double' then
val = tonumber( val )
elseif typ == 'array' then
val = decodeArray( val )
else
error( "type not implemented: " .. typ )
end
return val
end
end
function decodeArray( dataNode )
assert( dataNode:name() == 'data', "not data" )
local a = {}
local max = dataNode:childCount()
for i = 1, max do
a[#a + 1] = decodeValue( dataNode:childAtIndex( i ) )
end
return a
end
local values = {}
for index = 1, max do
local node = params:childAtIndex( index )
if node then -- param node
local valueNode = node:childAtIndex( 1 ) -- value node
if valueNode:name() == 'value' then
values[#values + 1] = decodeValue( valueNode )
else
error( "Invalid value node name." )
end
else
error( "No param node." )
end
end
return values
end
-- Iterate response parameters, given original xml response.
--
-- @param xml (xmlDomInstance) original xml response.
--
-- @return (table) { faultCode=..., faultString=... }
--
function XmlRpc:_getFaultStruct( xml )
local fault = xml:childAtIndex( 1 ) -- xml is method-response (root).
local struct = {}
local valueNode = fault:childAtIndex( 1 )
if valueNode then -- value node
local structNode = valueNode:childAtIndex( 1 )
if structNode:name() == 'struct' then
local memberNode = structNode:childAtIndex( 1 )
if memberNode:name() == 'member' then
local nameNode = memberNode:childAtIndex( 1 )
if nameNode:name() == 'name' then
if nameNode:text() == 'faultCode' then
local valueNode = memberNode:childAtIndex( 2 ):childAtIndex( 1 ) -- skipping over the type.
if valueNode then
local faultCode = num:numberFromString( valueNode:text() )
if faultCode then
struct.faultCode = faultCode
else
error( "No fault code" )
end
else
error( "No fault code value node" )
end
else
error( "No fault code name node" )
end
else
error( "bogus fault code name" )
end
else
error( "no fault code member" )
end
memberNode = structNode:childAtIndex( 2 )
if memberNode:name() == 'member' then
local nameNode = memberNode:childAtIndex( 1 )
if nameNode:name() == 'name' then
if nameNode:text() == 'faultString' then
local valueNode = memberNode:childAtIndex( 2 ):childAtIndex( 1 ) -- skipping over the type.
if valueNode then
local faultString = valueNode:text()
if str:is( faultString ) then
struct.faultString = faultString
else
error( "No fault string" )
end
else
error( "No fault string value node" )
end
else
error( "No fault string name node" )
end
else
error( "bogus fault string name" )
end
else
error( "no fault string member" )
end
else
error( "no fault struct" )
end
else
error( "no fault value node" )
end
return struct
end
return XmlRpc
|
-- Tue Aug 6 17:30:49 2019
-- (c) Alexander Veledzimovich
-- ui PHOTON
-- lua<5.3
local utf8 = require('utf8')
local unpack = table.unpack or unpack
local nuklear = require('nuklear')
local set = require('editor/set')
local UI = {}
function UI.editor(nk,PS)
local PH = PS.photons[PS.systems.value]
nk:frameBegin()
if nk:windowBegin('Code', 0, set.MIDHEI, set.CODEWID, set.CODEHEI,
'border', 'title', 'movable', 'minimizable',
'scrollbar','scalable') then
local _,_,_,hei = nk:windowGetContentRegion()
if PH then
nk:layoutRow('dynamic', hei-set.GROUPMARGIN*2, 1)
if nk:widgetIsHovered() then
nk:tooltip(PS.tooltip)
end
PS.codestate = nk:edit('box', PH.code)
end
end
nk:windowEnd()
local edh = set.DOUBHEI*2+set.GROUPMARGIN*2+set.SINGHEI*4+set.GROUPMARGIN*8
if nk:windowBegin('Editor', set.MIDWID, 0,
set.EDWID, edh,
'border', 'title', 'movable', 'minimizable') then
nk:layoutRow('dynamic',set.DOUBHEI+set.GROUPMARGIN*2, 1)
nk:groupBegin('Menu','border')
nk:layoutRow('dynamic',set.DOUBHEI,6)
if nk:button('New') then PS.new() end
if nk:button('Clone') then PS.clone() end
if nk:button('Delete') then PS.delete() end
if nk:button('Export') then PS.export() end
nk:edit('simple',PH and PH.set.pname or {value='name'})
nk:styleLoadColors(set.COLORS)
nk:selectable('Single',nil,'centered',PS.single)
nk:styleDefault()
nk:groupEnd()
if PH then
nk:layoutRow('dynamic',set.SINGHEI+set.GROUPMARGIN*2, 1)
nk:groupBegin('Control','border')
nk:layoutRow('dynamic',set.SINGHEI, 7)
if nk:button('Start') then PH:start() end
if nk:button('Pause') then PH:pause() end
if nk:button('Stop') then PH:stop() end
if nk:button('Reset') then PH:reset() end
nk:styleLoadColors(set.COLORS)
nk:selectable('Setup',nil,'centered',PS.hotset)
nk:combobox(PS.systems,PS.systems.items)
nk:selectable('Marks', nil, 'centered',PS.marks)
nk:styleDefault()
nk:groupEnd()
nk:layoutRow('dynamic',set.SINGHEI*2+set.GROUPMARGIN*3, 1)
nk:groupBegin('Buffer','border')
nk:layoutRow('dynamic',set.SINGHEI, {0.2,0.05,0.25,0.25,0.25})
nk:label('Insert Mode')
nk:spacing(1)
nk:radio('top',PH.set.mode)
nk:radio('bottom',PH.set.mode)
nk:radio('random',PH.set.mode)
nk:layoutRow('dynamic',set.SINGHEI, 2)
nk:property('Buffer', 1, PH.set.buffer, set.PBUFFER, 10, 100)
nk:property('Lifetime', -1, PH.set.lifetime, set.PTIME, 1, 1)
nk:groupEnd()
end
end
nk:windowEnd()
if nk:windowBegin('Setup', set.MIDWID, edh, set.EDWID, set.EDHEI-edh,
'border', 'title', 'movable', 'minimizable') then
if PH then
nk:layoutRow('dynamic',set.SINGHEI+set.GROUPMARGIN*2, 1)
nk:groupBegin('Emit','border')
nk:layoutRow('dynamic',set.SINGHEI, {0.2,0.5,0.1,0.05,0.15})
if nk:button('Emit') then
PH:emit()
end
nk:slider(1, PH.set.emit, set.PEMIT, 1)
nk:label(PH.set.emit.value,'left')
nk:label('E','right')
nk:label(PH.count,'right')
nk:groupEnd()
nk:layoutRow('dynamic',set.SINGHEI*5+set.GROUPMARGIN*5, 1)
nk:groupBegin('Area','border')
nk:layoutRow('dynamic',set.SINGHEI, 1)
nk:property('Emission Rate', 0, PH.set.rate, set.PEMIT, 1, 10)
nk:layoutRow('dynamic',set.SINGHEI, 4)
nk:checkbox('outside', PH.set.areaDir)
nk:radio('none',PH.set.areaForm)
nk:radio('uniform',PH.set.areaForm)
nk:radio('normal',PH.set.areaForm)
nk:layoutRow('dynamic',set.SINGHEI, 4)
nk:checkbox('relative',PH.set.relative)
nk:radio('ellipse',PH.set.areaForm)
nk:radio('borderellipse','sphere',PH.set.areaForm)
nk:radio('borderrectangle','perimeter',PH.set.areaForm)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Emission Area X', 0, PH.set.areaX, set.VIEWWID, 1, 10)
nk:property('Emission Area Y', 0, PH.set.areaY, set.VIEWWID, 1, 10)
nk:layoutRow('dynamic',set.SINGHEI,1)
nk:property('Emission Area Angle',
0, PH.set.areaAng,set.PI2, 0.01, 0.1)
nk:groupEnd()
local oldform = PH.set.form.value
nk:layoutRow('dynamic',set.DOUBHEI+set.GROUPMARGIN*2, 1)
nk:groupBegin('Texture','border')
nk:layoutRow('dynamic', set.DOUBHEI,{0.2,0.6,0.2})
nk:label('Texture','left')
if nk:comboboxBegin('Select',nil,nil,set.FORMHEI) then
nk:layoutRow('dynamic', set.SINGHEI,1)
for i=1,#PH.forms do
nk:radio(PH.forms[i], PH.set.form)
end
for k,_ in pairs(PS.imgbase) do
nk:layoutRow('dynamic', set.SINGHEI,1)
nk:radio(k,PH.set.form)
end
nk:comboboxEnd()
end
nk:label(PH.set.form.value,'centered')
nk:groupEnd()
if PH.set.form.value ~= oldform then
PH:setImageData()
end
local imagedata = PS.imgbase[PH.set.form.value]
local imdwid,imdhei
if imagedata then
imdwid,imdhei = imagedata:getDimensions()
end
local oldwid, oldhei
oldwid = PH.set.wid.value
oldhei = PH.set.hei.value
nk:layoutRow('dynamic',set.SINGHEI, 2)
nk:property('Width', 1, PH.set.wid, set.PWH, 0.1, 1)
nk:property('Height', 1, PH.set.hei, set.PWH, 0.1, 1)
nk:layoutRow('dynamic',set.SINGHEI, 2)
nk:property('Quad X', 1, PH.set.qCols, set.PQUAD, 1, 1)
nk:property('Quad Y', 1, PH.set.qRows, set.PQUAD, 1, 1)
if imagedata then
PH.set.wid.value = imdwid/PH.set.qCols.value
PH.set.hei.value = imdhei/PH.set.qRows.value
end
if oldwid ~= PH.set.wid.value then
PH.set.offsetX.value = PH.set.wid.value/2
PH:setImageData()
end
if oldhei ~= PH.set.hei.value then
PH.set.offsetY.value = PH.set.hei.value/2
PH:setImageData()
end
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Offset X', 0, PH.set.offsetX, PH.set.wid.value, 1, 1)
nk:property('Offset Y', 0, PH.set.offsetY, PH.set.hei.value, 1, 1)
local rowclr = #PH.set.color/4
nk:layoutRow('dynamic', set.COLORROWHEI, rowclr/4)
UI.layoutColors(nk,PH,1,rowclr)
nk:layoutRow('dynamic', set.COLORROWHEI, rowclr/4)
UI.layoutColors(nk,PH,rowclr+1, #PH.set.color)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Time Min',
0, PH.set.timeMin, PH.set.timeMax.value, 0.01, 0.1)
nk:property('Time Max',
PH.set.timeMin.value, PH.set.timeMax, set.PTIME, 0.01, 0.1)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Size 1', 0, PH.set.size1, set.PSIZE, 0.01, 0.1)
nk:property('Size 2', 0, PH.set.size2, set.PSIZE, 0.01, 0.1)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Size 3', 0, PH.set.size3, set.PSIZE, 0.01, 0.1)
nk:property('Size 4', 0, PH.set.size4, set.PSIZE, 0.01, 0.1)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Size 5', 0, PH.set.size5, set.PSIZE, 0.01, 0.1)
nk:property('Size 6', 0, PH.set.size6, set.PSIZE, 0.01, 0.1)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Size 7', 0, PH.set.size7, set.PSIZE, 0.01, 0.1)
nk:property('Size 8', 0, PH.set.size8, set.PSIZE, 0.01, 0.1)
nk:layoutRow('dynamic',set.SINGHEI,1)
nk:property('Size Variation', 0, PH.set.sizeVar, 1, 0.01, 0.01)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Speed Min',
0, PH.set.speedMin, PH.set.speedMax.value, 1,10)
nk:property('Speed Max',
PH.set.speedMin.value, PH.set.speedMax, set.PSPEED, 1,10)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Acc X Min',
-set.PSPEED, PH.set.accXMin, PH.set.accXMax.value, 1, 10)
nk:property('Acc X Max',
PH.set.accXMin.value, PH.set.accXMax,set.PSPEED, 1,10)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Acc Y Min',
-set.PSPEED, PH.set.accYMin, PH.set.accYMax.value, 1,10)
nk:property('Acc Y Max',
PH.set.accYMin.value, PH.set.accYMax,set.PSPEED, 1,10)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Rad Acc Min',
-set.PSPEED, PH.set.radAccMin, PH.set.radAccMax.value, 1,10)
nk:property('Rad Acc Max',
PH.set.radAccMin.value, PH.set.radAccMax,set.PSPEED,1,10)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Tang Acc Min',
-set.PSPEED, PH.set.tanAccMin, PH.set.tanAccMax.value, 1, 10)
nk:property('Tang Acc Max',
PH.set.tanAccMin.value, PH.set.tanAccMax,set.PSPEED,1, 10)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Damp Min',
0, PH.set.dampMin, PH.set.dampMax.value, 0.01,0.01)
nk:property('Damp Max',
PH.set.dampMin.value, PH.set.dampMax, 1, 0.01,0.01)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Direction',0, PH.set.dir, set.PI2, 0.01,0.1)
nk:property('Spread', 0, PH.set.spread, set.PI2, 0.01,0.1)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Spin Min',
-set.PI2, PH.set.spinMin, PH.set.spinMax.value, 0.01,0.1)
nk:property('Spin Max',
PH.set.spinMin.value, PH.set.spinMax,set.PI2, 0.01,0.1)
nk:layoutRow('dynamic',set.SINGHEI,1)
nk:property('Spin Variation', 0, PH.set.spinVar, 1, 0.01,0.01)
nk:layoutRow('dynamic',set.SINGHEI,2)
nk:property('Rotate Min',0, PH.set.rotateMin,
PH.set.rotateMax.value, 0.01,0.1)
nk:property('Rotate Max',
PH.set.rotateMin.value, PH.set.rotateMax,set.PI2, 0.01,0.1)
end
end
nk:windowEnd()
nk:frameEnd()
end
local hex = {value=set.MAXHEX}
function UI.layoutColors(nk,PH,st,fin)
for i=st,fin,4 do
local clr = PH.set.color
local clr255 = {clr[i]*255,clr[i+1]*255, clr[i+2]*255,clr[i+3]*255}
local color = nuklear.colorRGBA(unpack(clr255))
if nk:comboboxBegin(nil, color, nil, set.COLORBOXHEI) then
nk:layoutRow('dynamic', set.PICKERHEI, 1)
local rgba = {'R',clr255[i],'G',clr255[i+1],
'B',clr255[i+2],'A',clr255[i+3]}
rgba[2],rgba[4],rgba[6],rgba[8] = nuklear.colorParseRGBA(
nk:colorPicker(color))
nk:layoutRow('dynamic',set.DOUBHEI, 1)
local act = nk:edit('field',hex)
if act=='inactive' then
local sharpColor = nuklear.colorRGBA(unpack(
{rgba[2],rgba[4],rgba[6],rgba[8]}))
hex.value = sharpColor:sub(2)
end
if tonumber(hex.value,16) then
local hexStr = '#'..hex.value
if #hexStr==9 then
rgba[2],rgba[4],rgba[6],rgba[8] = nuklear.colorParseRGBA(hexStr)
end
end
for j=1, #rgba,2 do
nk:layoutRow('dynamic',set.SINGHEI, 1)
rgba[j+1] = nk:property(rgba[j],0, rgba[j+1], 255, 1, 1)
end
PH.set.color[i] = rgba[2]/255
PH.set.color[i+1] = rgba[4]/255
PH.set.color[i+2] = rgba[6]/255
PH.set.color[i+3] = rgba[8]/255
nk:comboboxEnd()
end
end
end
return UI
|
meta.name = "TAS Tool"
meta.version = "WIP"
meta.description = "STILL BUGGY AND RERECORD DOESN'T WORK PERFECTLY! This is The Tool for Tool Assisted Speedrunning Spelunky 2, to be used in seeded runs with Overlunky frame advance features. In a TAS, you record your inputs frame by frame, with the ability to rerecord your steps if you screw up. The resulting inputs are then played back in real time to recreate the perfect inhuman run."
meta.author = "Dregu"
local seed_text = ""
local seed = 0
local frames = {}
local pos = {}
local levels = {}
local stopped = true
local stolen = false
local cutcb = -1
local rerecord_level = -1
local rerecord_frame = 0
local rerecording = false
local window_open = true
local mode = 1
local pause = true
local skip = true
local turbo = true
local draw = true
local delay = 1
register_option_button("open", "Show TAS window", function()
window_open = true
end)
local function clear_run()
frames = {}
pos = {}
levels = {}
rerecord_level = -1
rerecord_frame = 0
rerecording = false
end
set_callback(function(ctx)
if window_open then
window_open = ctx:window("TAS", 0, 0, 0, 0, true, function()
ctx:win_text("Seed")
seed_text = ctx:win_input_text("##Seed", seed_text)
ctx:win_inline()
if ctx:win_button("Restart") then
rerecord_level = -1
rerecord_frame = 0
rerecording = false
if seed_text ~= "" then
local new_seed = tonumber(seed_text, 16)
if new_seed ~= seed then
clear_run()
end
seed = new_seed
else
seed = math.random(0, 0xffffffff)
seed_text = string.format("%X", seed)
clear_run()
end
set_seed(seed)
end
ctx:win_inline()
if ctx:win_button("Reset") then
clear_run()
set_seed(seed)
end
ctx:win_separator()
ctx:win_text("Recording")
rerecord_frame = ctx:win_slider_int("##Frame", rerecord_frame, 0, state.time_level)
ctx:win_inline()
if ctx:win_button("Rerecord level from frame") then
mode = 1
rerecord_level = state.level_count
rerecording = true
set_seed(seed)
end
ctx:win_separator()
ctx:win_text("Playback")
if ctx:win_button("Playback level") then
mode = 2
rerecord_level = state.level_count
rerecording = false
set_seed(seed)
end
ctx:win_inline()
if ctx:win_button("Playback run") then
mode = 2
rerecord_level = -1
rerecord_frame = 0
rerecording = false
set_seed(seed)
end
ctx:win_separator()
ctx:win_text("Options")
pause = ctx:win_check("Start levels paused", pause)
skip = ctx:win_check("Skip level transitions", skip)
turbo = ctx:win_check("Skip fades", turbo)
draw = ctx:win_check("Draw history", draw)
end)
end
if draw and pos[state.level_count] and #pos[state.level_count] > 3 then
local cpos = pos[state.level_count]
for i=2,#cpos do
if (rerecord_frame > 0 and i >= rerecord_frame) or not cpos[i] or not cpos[i-1] then break end
local x1, y1 = screen_position(cpos[i-1].x, cpos[i-1].y)
local x2, y2 = screen_position(cpos[i].x, cpos[i].y)
local col = cpos[i].l == state.camera_layer and 0xff0000aa or 0xff000066
ctx:draw_line(x1, y1, x2, y2, 2, col)
end
end
end, ON.GUIFRAME)
set_callback(function()
if not rerecording then
rerecord_frame = 0
end
end, ON.PRE_LEVEL_GENERATION)
set_callback(function()
if rerecord_level ~= -1 and state.level_count ~= rerecord_level then
prinspect("Skipping level")
state.level_count = state.level_count + 1
local next = levels[state.level_count]
state.screen_next = SCREEN.LEVEL
state.world_next = next[1]
state.level_next = next[2]
state.theme_next = next[3]
state.time_total = next[9]
state.shoppie_aggro = next[10]+1
state.shoppie_aggro_next = next[11]+1
state.merchant_aggro = next[12]+1
state.loading = 1
else
if rerecord_level == -1 then
prinspect("Saving stats")
local holding = players[1].holding_uid
if holding ~= -1 then
holding = get_entity(holding).type.id
end
levels[state.level_count] = { state.world, state.level, state.theme, players[1].health, players[1].inventory.bombs, players[1].inventory.ropes, players[1]:get_powerups(), holding, state.time_total, state.shoppie_aggro, state.shoppie_aggro_next, state.merchant_aggro }
elseif state.level_count >= rerecord_level then
prinspect("Rerecord level reached")
rerecord_level = -1
local next = levels[state.level_count]
state.time_total = next[9]
players[1].health = next[4]
players[1].inventory.bombs = next[5]
players[1].inventory.ropes = next[6]
players[1].health = next[4]
players[1].inventory.bombs = next[5]
players[1].inventory.ropes = next[6]
for i,v in ipairs(next[7]) do
players[1]:give_powerup(v)
end
if levels[state.level_count][8] ~= -1 then
pick_up(players[1].uid, spawn(next[8], 0, 0, LAYER.PLAYER, 0, 0))
end
end
if mode == 1 and pause and state.time_level >= rerecord_frame then -- record
if state.pause == 0 then
state.pause = 0x20
end
elseif mode == 2 or state.time_level < rerecord_frame and state.time_level < #frames[state.level_count] then -- playback
steal_input(players[1].uid)
stopped = false
stolen = true
end
end
end, ON.LEVEL)
set_callback(function()
if #players < 1 then return end
if frames[state.level_count] == nil then
frames[state.level_count] = {}
pos[state.level_count] = {}
end
if (mode == 2 and not stopped) or (mode == 1 and state.time_level < rerecord_frame) then -- playback
local input = frames[state.level_count][state.time_level+delay]
if input and stolen then
message('Sending '..string.format('%04x', input)..' '..state.time_level..'/'..#frames[state.level_count])
send_input(players[1].uid, input)
elseif stolen and state.time_level >= #frames[state.level_count] and players[1].state ~= CHAR_STATE.ENTERING and state.loading == 0 then
message('Playback ended, recording')
return_input(players[1].uid)
stolen = false
stopped = true
if pause then
state.pause = 0x20
end
mode = 1
end
end
if mode == 1 and state.time_level == rerecord_frame then
if pause then
state.pause = 0x20
end
if stolen then
message('Rerecording from frame')
return_input(players[1].uid)
stolen = false
stopped = true
end
rerecording = false
end
if mode == 1 and state.time_level >= rerecord_frame then -- record
frames[state.level_count][state.time_level] = read_input(players[1].uid)
message('Recording '..string.format('%04x', frames[state.level_count][state.time_level])..' '..state.time_level..'/'..#frames[state.level_count])
local x, y, l = get_position(players[1].uid)
pos[state.level_count][state.time_level] = {x=x, y=y, l=l}
end
end, ON.FRAME)
set_callback(function()
if skip then
warp(state.world_next, state.level_next, state.theme_next)
end
end, ON.TRANSITION)
set_global_interval(function()
if state.logic.olmec_cutscene ~= nil then
state.logic.olmec_cutscene.timer = 809
if pause and mode == 1 then
cutcb = set_callback(function()
if state.pause == 0 then
clear_callback(cutcb)
state.pause = 0x20
end
end, ON.GUIFRAME)
end
end
if state.logic.tiamat_cutscene ~= nil then
state.logic.tiamat_cutscene.timer = 379
if pause and mode == 1 then
cutcb = set_callback(function()
if state.pause == 0 then
clear_callback(cutcb)
state.pause = 0x20
end
end, ON.GUIFRAME)
end
end
end, 1)
set_callback(function()
if turbo then
state.fadeout = 0
state.fadein = 0
end
end, ON.LOADING)
-- 43D3D0DD
|
local ffi = require("ffi");
local Application = require("Application");
local NativeSocket = require("NativeSocket");
local ws2_32 = require("ws2_32");
Application:setMessageQuanta(5);
local SocketServer = {}
setmetatable(SocketServer, {
__call = function(self, ...)
return self:create(...);
end,
});
local SocketServer_mt = {
__index = SocketServer;
}
SocketServer.init = function(self, socket, onAccept)
--print("SocketServer.init: ", socket, onAccept, onAcceptParam)
local obj = {
ServerSocket = socket;
OnAccept = onAccept;
};
setmetatable(obj, SocketServer_mt);
return obj;
end
SocketServer.create = function(self, port, onAccept, autoclose)
autoclose = autoclose or false;
port = port or 9090;
--print("SocketServer:create(): ", port, onAccept);
local socket, err = NativeSocket:createServer({port = port, backlog = 150, autoclose = autoclose})
if not socket then
print("Server Socket not created!!")
return nil, err
end
return self:init(socket, onAccept);
end
function SocketServer.handleAccepted(self, sock)
--print("SocketServer.handleAccepted(): ", sock);
if self.OnAccept then
--print("SocketServer.handleAccepter, CALLING self.OnAccept: ", sock)
return self.OnAccept(sock);
else
--print("NO OnAccept available, closing socket...")
ws2_32.closesocket(sock);
end
end
-- The primary application loop
SocketServer.loop = function(self)
while true do
local sock, err = self.ServerSocket:accept();
--print("SocketServer.loop, Accepted: ", sock, err)
if sock then
self:handleAccepted(sock);
else
print("Accept ERROR: ", err);
end
--collectgarbage();
end
end
SocketServer.run = function(self)
--print("SocketServer.run()");
spawn(self.loop, self);
Application:run();
end
return SocketServer;
|
-- Include Guard
--#if(includeGuard()) then return end
-- Use single big table or many small tables?
#local LIST_IN_SINGLE_TBL = false
#local ENTRY_CACHE = false
#local LAST_REF = true
#if(LIST_IN_SINGLE_TBL) then
#local FIRST = 1
#local LAST = 2
local function listCreate(tbl)
local lst = {false, false}
if(not tbl) then return lst end
for i = 1, #tbl do
lst[i*2 - 1] = i*2 + 1
lst[i*2 + 2] = tbl[i]
end
#if(LAST_REF) then
lst[$LAST] = #tbl*2 + 1
#end
return lst
end
local function listInsert(lst, v, hint)
#if(LAST_REF) then
local i = hint or lst[$LAST] or 1
#else
local i = hint or 1
#end
while(lst[i]) do
i = lst[i]
end
local newIdx = #lst + 1
lst[i] = newIdx
lst[newIdx + 1] = v
#if(LAST_REF) then
lst[$LAST] = newIdx
#end
return newIdx
end
local function listRemove(lst, n)
local i = 1
while(n > 1 and lst[i]) do
i = lst[i]
n = n - 1
end
if(lst[i]) then
local nextIdx = lst[i]
local v = lst[nextIdx + 1]
#if(LAST_REF) then
if(not lst[nextIdx]) then
lst[$LAST] = i
end
#end
lst[i] = lst[nextIdx]
--lst[nextIdx] = nil
--lst[nextIdx + 1] = nil
return v
end
end
local function listGetSize(lst)
local i, size = 1, 0
while(lst[i]) do
i = lst[i]
size = size + 1
end
return size
end
local function listIsEmpty(lst)
return not lst[1]
end
#else -- LIST_IN_SINGLE_TBL
#local VAL = 1
#local NEXT = 2
#local LAST = VAL
#local FIRST = NEXT
#if(ENTRY_CACHE) then
local g_ListEntryCache = {}
#end
local function listCreate(tbl)
local head = {false, false}
if(not tbl) then return head end
local entry = head
local newEntry
for i = 1, #tbl do
#if(ENTRY_CACHE) then
newEntry = table.remove(g_ListEntryCache)
if(newEntry) then
newEntry[$VAL], newEntry[$NEXT] = tbl[i], false
else
newEntry = {tbl[i], false}
end
#else
newEntry = {tbl[i], false}
#end
entry[$NEXT] = newEntry
entry = newEntry
end
#if(LAST_REF) then
head[$LAST] = newEntry
#end
return head
end
local function listInsert(head, v, hint)
#if(LAST_REF) then
local entry = hint or head[$LAST] or head
#else
local entry = hint or head
#end
while(entry[$NEXT]) do
entry = entry[$NEXT]
end
local newEntry = {v, false}
entry[$NEXT] = newEntry
#if(LAST_REF) then
head[$LAST] = newEntry
#end
return newEntry
end
local function listRemove(head, n)
local entry = head
while(n > 1 and entry) do
entry = entry[$NEXT]
n = n - 1
end
local nextEntry = entry[$NEXT]
if(entry and nextEntry) then
local v = nextEntry[$VAL]
#if(LAST_REF) then
if(not nextEntry[$NEXT]) then
head[$LAST] = entry
end
#end
#if(ENTRY_CACHE) then
table.insert(g_ListEntryCache, nextEntry)
#end
entry[$NEXT] = nextEntry[$NEXT]
return v
end
end
local function listGetSize(head)
local entry = head
local size = 0
while(entry[$NEXT]) do
size = size + 1
entry = entry[$NEXT]
end
return size
end
local function listIsEmpty(head)
return not head[$NEXT]
end
#end
#local TEST = false
#if(TEST) then
# print('List test is active!')
local function test(val1, val2, ln)
if(val1 == val2) then return end
print('Test failed: '..tostring(val1)..'<>'..tostring(val2)..' (line '..ln..')')
os.exit(-1)
end
local l = listCreate{1, 2, 3, 4}
test(listGetSize(l), 4, $__LINE__)
test(listRemove(l, 1), 1, $__LINE__)
test(listGetSize(l), 3, $__LINE__)
test(listRemove(l, 2), 3, $__LINE__)
test(listGetSize(l), 2, $__LINE__)
test(listIsEmpty(l), false, $__LINE__)
test(listRemove(l, 1), 2, $__LINE__)
test(listRemove(l, 1), 4, $__LINE__)
test(listIsEmpty(l), true, $__LINE__)
#end
|
local love = require('love')
local RenderSystem = ECS.System({
pool = {"position", "render"}
})
function RenderSystem:draw()
for _, e in ipairs(self.pool) do
love.graphics.circle("fill", e.position.x, e.position.y, 5)
end
end
return RenderSystem
|
--加载并运行LUA代码,同时设置一些关键路径
local args = {}
--string.gmatch (s, pattern)
--返回一个迭代器函数。 每次调用这个函数都会继续以 pattern (参见 §6.4.1) 对 s 做匹配,并返回所有捕获到的值。 如果 pattern 中没有指定捕获,则每次捕获整个 pattern
for word in string.gmatch(..., "%S+") do --这里pattern表达的意思是 非空白字符一次或多次
table.insert(args, word)--插入到args中
end
--所以上面处理的结果就是,如果传入的参数是a b c d,则得到的args为:{['1']=a, ['2']=b, ['3']=c, ['4']=d}
SERVICE_NAME = args[1] --传入的服务名,比如第一次启动snlua服务传入的是bootstrap
local main, pattern
local err = {}
--作用:拆分LUA_SERVICE中配置的多个路径,并替换?为实际的脚本名,执行脚本
for pat in string.gmatch(LUA_SERVICE, "([^;]+);*") do --pattern:捕获;之前的子串(子串不包含;)
local filename = string.gsub(pat, "?", SERVICE_NAME) --将子串中的?替换为服务名
local f, msg = loadfile(filename) --加载lua文件,如果没有语法错误, 则以函数形式返回编译好的代码块; 否则,返回 nil 加上错误消息。
if not f then --出错了
table.insert(err, msg) --保存出错信息
else --成功了
pattern = pat --路径
main = f --返回的主函数(这里的主函数指的是要加载运行的lua代码)
break --跳出循环
end
end
if not main then --没有找到主函数
error(table.concat(err, "\n")) --抛出错误
end
LUA_SERVICE = nil
package.path , LUA_PATH = LUA_PATH --设置package.path,置空LUA_PATH
package.cpath , LUA_CPATH = LUA_CPATH --设置package.cpath,置空LUA_CPATH
--print(pattern)
local service_path = string.match(pattern, "(.*/)[^/?]+$") --捕获这种配置字符串 ./lualib/?/init.lua 捕获到./lualib/?/,大部分都是形如./service/?.lua
--print(service_path)
if service_path then
service_path = string.gsub(service_path, "?", args[1]) --替换?为服务名,如./lublib/example/
package.path = service_path .. "?.lua;" .. package.path --将./lublib/example/?.lua添加到package.path
SERVICE_PATH = service_path --设置SERVICE_PATH
else
local p = string.match(pattern, "(.*/).+$") --捕获形如./service/?.lua,捕获到./service
SERVICE_PATH = p --设置SERVICE_PATH
end
if LUA_PRELOAD then --如果有预加载的文件
local f = assert(loadfile(LUA_PRELOAD)) --加载预加载文件
f(table.unpack(args)) --运行预加载函数
LUA_PRELOAD = nil --置空
end
--select(index,...) 如果 index 是个数字, 那么返回参数中第 index 个之后的部分; 负的数字会从后向前索引(-1 指最后一个参数)。 否则,index 必须是字符串 "#", 此时 select 返回参数的个数。
main(select(2, table.unpack(args)))--运行主函数,取出除了服务名的后续参数传入主函数
|
TomTomDB = {
["profileKeys"] = {
["Nevaar - Thrall"] = "Default",
["Ischozar - Thrall"] = "Default",
["Drâon - Thrall"] = "Default",
},
["profiles"] = {
["Default"] = {
["general"] = {
["announce"] = true,
},
["arrow"] = {
["lock"] = true,
["position"] = {
"TOP", -- [1]
nil, -- [2]
"TOP", -- [3]
-1.000007510185242, -- [4]
-94.99999237060547, -- [5]
},
["stickycorpse"] = true,
},
["minimap"] = {
["default_iconsize"] = 18,
},
["mapcoords"] = {
["cursorenable"] = false,
["playerenable"] = false,
},
["block"] = {
["enable"] = false,
["position"] = {
"TOP", -- [1]
nil, -- [2]
"TOP", -- [3]
383.0003051757813, -- [4]
-74.99996948242188, -- [5]
},
},
},
},
}
TomTomWaypoints = nil
TomTomWaypointsM = {
["profileKeys"] = {
["Nevaar - Thrall"] = "Nevaar - Thrall",
["Ischozar - Thrall"] = "Ischozar - Thrall",
["Drâon - Thrall"] = "Drâon - Thrall",
},
["profiles"] = {
["Nevaar - Thrall"] = {
},
["Ischozar - Thrall"] = {
},
["Drâon - Thrall"] = {
},
},
}
|
-- test_comp_netstream.lua
Computicle = require("Computicle");
local comp = Computicle:createFromFile("comp_getbing.lua");
comp:waitForFinish();
|
--[[
-- added by wsh @ 2017-12-01
-- UILogin控制层
--]]
---@class UILoginCtrl:UIBaseCtrl
local UILoginCtrl = BaseClass("UILoginCtrl", UIBaseCtrl)
---@return UIBaseCtrl
local base = UIBaseCtrl
local calkmm = function(arg)
local msg = pb.decode("cs.CSLoginReq", arg)
Logger.LogError(msg.UserName)
local list = msg.IDList
Logger.LogError(list[1])
end
local function OnConnect(self, sender, result, msg)
if result < 0 then
Logger.LogError("Connect err : " .. msg)
return
end
-- TODO:
local msd_id = MsgIDDefine.LOGIN_REQ_LOGIN
local msg = {}
msg.UserName = "lisi"
msg.Password = "1222233"
msg.IDList = {}
msg.IDList[1] = 9000
msg.IDList[2] = 8888
Logger.Log("fasong")
Logger.Log(msd_id)
SingleGet.HallConnector():SendMessage(msd_id, "cs.CSLoginReq", msg)
end
local function OnClose(self, sender, result, msg)
if result < 0 then
Logger.LogError("Close err : " .. msg)
return
end
end
local function ConnectServer(self)
SingleGet.HallConnector():Connect("127.0.0.1", 8088, Bind(self, OnConnect), Bind(self, OnClose))
--SingleGet.HallConnector():Connect("127.0.0.1", 10020, OnConnect, OnClose)
end
local function LoginServer(self, name, password)
-- 合法性检验
if string.len(name) > 20 or string.len(name) < 1 then
-- TODO:错误弹窗
Logger.LogError("name length err!")
return
end
if string.len(password) > 20 or string.len(password) < 1 then
-- TODO:错误弹窗
Logger.LogError("password length err!")
return
end
-- 检测是否有汉字
for i = 1, string.len(name) do
local curByte = string.byte(name, i)
if curByte > 127 then
-- TODO:错误弹窗
Logger.LogError("name err : only ascii can be used!")
return
end
end
SingleGet.ClientData():SetAccountInfo(name, password)
Logger.Log("ceshi ")
-- TODO start socket
ConnectServer(self)
SingleGet.SceneManager():SwitchScene(SceneConfig.HomeScene)
end
local function ChooseServer(self)
SingleGet.UIManager():OpenWindow(UIWindowNames.UILoginServer)
end
local function OnCreate(self)
base.OnAddListener(10001, calkmm)
end
UILoginCtrl.LoginServer = LoginServer
UILoginCtrl.ChooseServer = ChooseServer
UILoginCtrl.OnCreate = OnCreate
return UILoginCtrl
|
-----------------------------------
--
-- Zone: Grand_Palace_of_HuXzoi (34)
--
-----------------------------------
require("scripts/zones/Grand_Palace_of_HuXzoi/globals");
local ID = require("scripts/zones/Grand_Palace_of_HuXzoi/IDs");
require("scripts/globals/conquest");
require("scripts/globals/status");
-----------------------------------
function onInitialize(zone)
zone:registerRegion( 1, -507, -4, 697, -501, 4, 702);
zone:registerRegion( 2, -102, -4, 541, -97, 4, 546);
zone:registerRegion( 3, -178, -4, 97, -173, 4, 103);
zone:registerRegion( 4, -497, -4, 97, -492, 4, 102);
zone:registerRegion( 5, -742, -4, 372, -736, 4, 379);
zone:registerRegion( 6, 332, -4, 696, 338, 4, 702);
zone:registerRegion( 7, 737, -4, 541, 742, 4, 546);
zone:registerRegion( 8, 661, -4, 87, 667, 4, 103);
zone:registerRegion( 9, 340, -4, 97, 347, 4, 102);
zone:registerRegion(10, 97, -4, 372, 103, 4, 378);
GRAND_PALACE_OF_HUXZOI.pickTemperancePH();
end;
function onConquestUpdate(zone, updatetype)
tpz.conq.onConquestUpdate(zone, updatetype)
end;
function onZoneIn(player,prevZone)
local cs = -1;
if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos(-20,-1.5,-355.482,192);
end
player:setCharVar("Hu-Xzoi-TP",0);
return cs;
end;
function afterZoneIn(player)
player:entityVisualPacket("door");
player:entityVisualPacket("dtuk");
player:entityVisualPacket("2dor");
player:entityVisualPacket("cryq");
end;
function onRegionEnter(player,region)
if (player:getCharVar("Hu-Xzoi-TP") == 0 and player:getAnimation() == tpz.anim.NONE) then -- prevent 2cs at same time
player:startEvent(149 + region:GetRegionID());
end
end;
function onRegionLeave(player,region)
end;
function onEventUpdate(player,csid,option)
if (csid >= 150 and csid <= 159) then
player:setCharVar("Hu-Xzoi-TP",1);
end
end;
function onEventFinish(player,csid,option)
if (csid >= 150 and csid <= 159) then
player:setCharVar("Hu-Xzoi-TP",0);
end
end;
function onGameHour(zone)
end;
|
slimes = {}
--big slimes
minetest.register_entity("slimes:slime_big", {
initial_properties = {
physical = true,
collide_with_objects = false,
collisionbox = {-2.5,-2.5,-2.5, 2.5,2.5,2.5},
visual = "mesh",
mesh = "slime_big.x",
--visual_size = {3,3},slime_inside
textures = {"slime_outside.png","slime_inside.png","eye_right.png","eye_left.png","mouth.png"},
},
slime_size = "big",
timer = 0, --timer for state
state = 0, --0 stand, 1 jump around, 2 attack
state_change = 0, --when to change state
on_activate = function(self)
self.object:set_animation({x=10,y=50},7, 0)
--self.object:set_animation({x=70,y=95},40, 0)
self.object:setacceleration({x=0,y=-10,z=0})
self.object:set_hp(25)
end,
on_step = function(self,dtime)
slimes.state_change(self,dtime)
slimes.movement(self)
end,
on_punch = function(self)
slimes.slime_punch(self)
end,
})
--medium slimes
minetest.register_entity("slimes:slime_medium", {
initial_properties = {
physical = true,
collide_with_objects = false,
collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5},
visual = "mesh",
mesh = "slime.x",
--visual_size = {3,3},slime_inside
textures = {"slime_outside.png","slime_inside.png","eye_right.png","eye_left.png","mouth.png"},
},
slime_size = "medium",
timer = 0, --timer for state
state = 0, --0 stand, 1 jump around, 2 attack
state_change = 0, --when to change state
on_activate = function(self)
self.object:set_animation({x=10,y=50},7, 0)
--self.object:set_animation({x=70,y=95},40, 0)
self.object:setacceleration({x=0,y=-10,z=0})
self.object:set_hp(10)
end,
on_step = function(self,dtime)
slimes.state_change(self,dtime)
slimes.movement(self)
end,
on_punch = function(self)
slimes.slime_punch(self)
end,
})
--small slimes
minetest.register_entity("slimes:slime_small", {
initial_properties = {
physical = true,
collide_with_objects = false,
collisionbox = {-0.1,-0.1,-0.1, 0.1,0.1,0.1},
visual = "mesh",
mesh = "slime_small.x",
--visual_size = {3,3},slime_inside
textures = {"slime_outside.png","slime_inside.png","eye_right.png","eye_left.png","mouth.png"},
},
slime_size = "small",
timer = 0, --timer for state
state = 0, --0 stand, 1 jump around, 2 attack
state_change = 0, --when to change state
on_activate = function(self)
self.object:set_animation({x=10,y=50},7, 0)
--self.object:set_animation({x=70,y=95},40, 0)
self.object:setacceleration({x=0,y=-10,z=0})
self.object:set_hp(3)
end,
on_step = function(self,dtime)
slimes.state_change(self,dtime)
slimes.movement(self)
end,
on_punch = function(self)
slimes.slime_punch(self)
end,
})
local load_technic_items = false
for _,v in pairs(minetest.get_modnames()) do
if v == "technic" then
load_technic_items = true
break
end
end
if load_technic_items == true then
slimes.slime_drop = {"slimes:beer","slimes:hawaiin_pizza","mesecons_materials:glue"}
minetest.register_craftitem("slimes:beer", {
description = "Ice Cold Beer",
inventory_image = "beer.png",
on_use = minetest.item_eat(20),
})
minetest.register_craftitem("slimes:hawaiin_pizza", {
description = "Delicious Hawaiin Pizza",
inventory_image = "hawaiin_pizza.png",
on_use = minetest.item_eat(20),
})
else
slimes.slime_drop = {"default:sapling", "default:dirt_with_grass"}
end
--when a slime is punched
slimes.slime_punch = function(self)
local hp = self.object:get_hp()
local size_check = 0
local pos = self.object:getpos()
if self.slime_size == "big" then
size_check = 3
elseif self.slime_size == "medium" then
size_check = 0.5
elseif self.slime_size == "small" then
size_check = 0.1
end
minetest.sound_play("slime_hit", {
max_hear_distance = 20,
gain = 10.0,
object = self.object,
})
--die
if hp <= 0 then
minetest.add_particlespawner({
amount = 80,
time = 0.1,
minpos = {x=pos.x-(size_check), y=pos.y-(size_check), z=pos.z-(size_check)},
maxpos = {x=pos.x+(size_check), y=pos.y+(size_check), z=pos.z+(size_check)},
minvel = {x=-5, y=-5, z=-5},
maxvel = {x=5, y=5, z=5},
minacc = {x=0, y=-10, z=0},
maxacc = {x=0, y=-10, z=0},
minexptime = 1,
maxexptime = 1,
minsize = size_check*2,
maxsize = size_check,
collisiondetection = true,
vertical = false,
texture = "slime_particles.png",
})
slimes.slime_duplicate(self)
if self.slime_size == "small" then
minetest.add_item(pos,slimes.slime_drop[math.random(1,table.getn(slimes.slime_drop))])
end
--hurt
else
minetest.add_particlespawner({
amount = 40,
time = 0.1,
minpos = {x=pos.x-(size_check), y=pos.y-(size_check), z=pos.z-(size_check)},
maxpos = {x=pos.x+(size_check), y=pos.y+(size_check), z=pos.z+(size_check)},
minvel = {x=-2, y=-2, z=-2},
maxvel = {x=2, y=2, z=2},
minacc = {x=0, y=-10, z=0},
maxacc = {x=0, y=-10, z=0},
minexptime = 1,
maxexptime = 1,
minsize = size_check*2,
maxsize = size_check,
collisiondetection = true,
vertical = false,
texture = "slime_particles.png",
})
end
end
--the state timer for slimes
slimes.state_change = function(self,dtime)
self.timer = self.timer + dtime
local vel = self.object:getvelocity()
if self.timer > self.state_change then
self.state = math.random(0,1)
self.state_change = math.random(3,9)
self.timer = 0
if self.state == 1 then
self.object:setyaw((math.random(0, 360) - 180) / 180 * math.pi)
end
end
end
--how slimes check to move around
slimes.movement = function(self)
local pos = self.object:getpos()
local vel = self.object:getvelocity()
local y_check = 0
if self.slime_size == "big" then
y_check = 3
elseif self.slime_size == "medium" then
y_check = 1
elseif self.slime_size == "small" then
y_check = 0.2
end
--standing still
if self.state == 0 and vel.y <= 0 then
if vel.y == 0 then
self.object:setvelocity({x=0,y=vel.y,z=0})
end
end
--jumping around
if self.state == 1 and vel.y <= 0.5 then
if vel.y == 0 then
--check for node below before jumping
if minetest.registered_items[minetest.get_node({x=pos.x,y=pos.y-y_check,z=pos.z}).name].walkable then
slimes.jump(self,pos)
end
end
end
end
--how a slime moves around
slimes.jump = function(self,pos)
local y_check = 0
local jump_height = 0
if self.slime_size == "big" then
y_check = 3
jump_height = 16
elseif self.slime_size == "medium" then
y_check = 1
jump_height = 6
elseif self.slime_size == "small" then
y_check = 0.2
jump_height = 6
end
minetest.add_particlespawner({
amount = y_check*25, -- this only works for mobs dividing by 5 on size
time = 0.1,
minpos = {x=pos.x-(y_check/2), y=pos.y-(y_check/2), z=pos.z-(y_check/2)},
maxpos = {x=pos.x+(y_check/2), y=pos.y-(y_check/2), z=pos.z+(y_check/2)},
minvel = {x=0, y=1, z=0},
maxvel = {x=0, y=2, z=0},
minacc = {x=0, y=-10, z=0},
maxacc = {x=0, y=-10, z=0},
minexptime = 1,
maxexptime = 1,
minsize = y_check*2,
maxsize = y_check,
collisiondetection = true,
vertical = false,
texture = "slime_particles.png",
})
local yaw = self.object:getyaw()
local dir_x = -math.sin(yaw) * (y_check*2)
local dir_z = math.cos(yaw) * (y_check*2)
self.object:setvelocity({x=dir_x,y=jump_height,z=dir_z})
self.object:set_animation({x=70,y=95},60, 0, false)
--a hack to make slimes animated correctly
minetest.after(1,function(self)
self.object:set_animation({x=10,y=50},7, 0)
end,self)
minetest.sound_play("slime_jump", {
max_hear_distance = 6,
gain = 1.0,
object = self.object,
})
end
--add smaller slimes on die
slimes.slime_duplicate = function(self)
local pos = self.object:getpos()
if self.slime_size == "big" then
for i = 1,math.random(4,8) do
minetest.add_entity({x=pos.x-math.random(-2.5,2.5),y=pos.y,z=pos.z-math.random(-2.5,2.5)}, "slimes:slime_medium")
end
elseif self.slime_size == "medium" then
for i = 1,math.random(6,16) do
minetest.add_entity({x=pos.x-math.random(-0.5,0.5),y=pos.y,z=pos.z-math.random(-0.5,0.5)}, "slimes:slime_small")
end
end
end
minetest.override_item("default:stick", {
on_place = function(itemstack, placer, pointed_thing)
pointed_thing.above.y = pointed_thing.above.y + 2.5
minetest.add_entity(pointed_thing.above,"slimes:slime_big")
end,
})
|
f = compiler.load("local a = 2 return 1 and a");
assert(f and type(f) == 'function')
assert(f() == 2)
print 'Ok'
|
--- Injects luarocks modules installed at ./rocks_modules into your love game.
-- See http://github.com/Alloyed/loverocks for details
-- (c) Kyle McLamb, 2015 <alloyed@tfwno.gf>, MIT License.
-- TODO: Configurable prefixes, binary modules
local function inject()
local luarocks_paths = {
"rocks/share/lua/5.1/?.lua",
"rocks/share/lua/5.1/?/init.lua",
}
if love.filesystem.getRequirePath then -- 0.10
local all_paths = {unpack(luarocks_paths)}
table.insert(all_paths, love.filesystem.getRequirePath())
local path = table.concat(all_paths, ';')
love.filesystem.setRequirePath(path)
package.path = "" -- Don't let outside files seep in
else
local function loader(modname)
local modpath = modname:gsub('%.', '/')
for _, elem in ipairs(luarocks_paths) do
elem = elem:gsub('%?', modpath)
if love.filesystem.exists(elem) then
return love.filesystem.load(elem)
end
end
return "\n no module '" .. modname .. "' in LOVERocks path."
end
table.insert(package.loaders, loader)
end
end
return setmetatable({inject = inject}, {__call = inject})
|
--[[
Tests for the fizz buzz module
--]]
local fizz_buzz = require 'src/random/fizz_buzz'
describe('fizz buzz', function()
it('should return number if number is not divisible by 3 or 5', function()
assert.is.equal(1, fizz_buzz(1))
assert.is.equal(2, fizz_buzz(2))
assert.is.equal(4, fizz_buzz(4))
end)
it('should return fizz if the number is 3', function()
assert.is.equal('fizz', fizz_buzz(3))
end)
it('should return buzz if the number is 5', function()
assert.is.equal('buzz', fizz_buzz(5))
end)
it('should return fizz buzz if the number is divisible by 3 and 5', function()
assert.is.equal('fizz buzz', fizz_buzz(7 * 5 * 3))
end)
it('should assert for 0 and below', function()
local error_input_0 = function()
fizz_buzz(0)
end
local error_input_below_0 = function()
fizz_buzz(-2)
end
assert.has_error(error_input_0, 'Error: number must be > 0')
assert.has_error(error_input_below_0, 'Error: number must be > 0')
end)
end)
|
simvis_attributes =
{
melee_size = 2,
melee_block_ratio = 80,
melee_unsynced_damage_ratio = 7,
selection_volume = 1,
selection_ground = 1,
-- Shadow Types:
-- 0 = None
-- 1 = blob (rotated by light dir)
-- 2 = blob (rotated by object dir)
-- 3 = shadow map
-- 4 = stencil shadow volume
shadow_type = 3,
shadow_scale = 0.08,
occluder = 1,
}
simvis_attributes_strings =
{
shadow_texture = "Shadows/shadow_dir_blob-dot.tga"
}
|
require("__subterra__.scripts.utils")
if not subterra.tick_events then subterra.tick_events = {} end
local check_telepads = require("__subterra__.scripts.events.updates.check_telepads")
local update_belt_elevators = require("__subterra__.scripts.events.updates.update_belt_elevators")
local update_power = require("__subterra__.scripts.events.updates.update_power")
local update_radars = require("__subterra__.scripts.events.updates.update_radars")
local cleanup_ghosts = require("__subterra__.scripts.events.updates.cleanup_ghosts")
local do_player_drawing = require("__subterra__.scripts.events.ui.do_player_drawing")
-- Teleports players if standing on stairs
-- event fired every 12th of a second by default
local pad_interval = (subterra and subterra.config and subterra.config.TELEPAD_UPDATE_INTERVAL) or 5
register_nth_tick_event (pad_interval, check_telepads)
-- update belts
register_event(defines.events.on_tick, update_belt_elevators)
-- power
register_event(defines.events.on_tick, update_power)
-- cleans up invalid ghosts
-- event fired every 10th of a second by default
local ghost_interval = (subterra and subterra.config and subterra.config.GHOST_CLEANUP_INTERVAL) or 6
register_nth_tick_event (ghost_interval, cleanup_ghosts)
local draw_interval = (subterra and subterra.config and subterra.config.BOX_DURATION) or 60
register_nth_tick_event(draw_interval, do_player_drawing)
-- radars
register_event(defines.events.on_tick, update_radars)
|
-- Copyright 2016 The Cartographer Authors
--
-- 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.
include "map_builder.lua"
include "trajectory_builder.lua"
options = {
map_builder = MAP_BUILDER,
trajectory_builder = TRAJECTORY_BUILDER,
map_frame = "map",
tracking_frame = "camera_gyro_frame",
published_frame = "base_link",
odom_frame = "odom",
provide_odom_frame = true,
publish_frame_projected_to_2d = false,
use_pose_extrapolator = true,
use_odometry =true,
use_nav_sat = false,
use_landmarks = false,
num_laser_scans = 1,
num_multi_echo_laser_scans = 0,
num_subdivisions_per_laser_scan = 1,
num_point_clouds = 0,
lookup_transform_timeout_sec = 0.2,
submap_publish_period_sec = 0.3,
pose_publish_period_sec = 5e-3,
trajectory_publish_period_sec = 30e-3,
rangefinder_sampling_ratio = 1.,
odometry_sampling_ratio = 1.,
fixed_frame_pose_sampling_ratio = 1.,
imu_sampling_ratio = 1.,
landmarks_sampling_ratio = 1.,
}
MAP_BUILDER.use_trajectory_builder_2d = true
TRAJECTORY_BUILDER.pure_localization_trimmer = {
max_submaps_to_keep = 2,
}
--POSE_GRAPH.optimization_problem.log_solver_summary = true
TRAJECTORY_BUILDER_2D.use_imu_data=true
TRAJECTORY_BUILDER_2D.min_range = 0.1
TRAJECTORY_BUILDER_2D.max_range =25
TRAJECTORY_BUILDER_2D.missing_data_ray_length = 25
TRAJECTORY_BUILDER_2D.num_accumulated_range_data =1
TRAJECTORY_BUILDER_2D.voxel_filter_size =0.01
TRAJECTORY_BUILDER_2D.use_online_correlative_scan_matching = false
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.linear_search_window =0.1
TRAJECTORY_BUILDER_2D.real_time_correlative_scan_matcher.angular_search_window =math.rad(20.)
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.occupied_space_weight =1
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.translation_weight=30.
TRAJECTORY_BUILDER_2D.ceres_scan_matcher.rotation_weight=10.
TRAJECTORY_BUILDER_2D.motion_filter.max_time_seconds=5
TRAJECTORY_BUILDER_2D.motion_filter.max_distance_meters =0.2
TRAJECTORY_BUILDER_2D.motion_filter.max_angle_radians=math.rad(20.)
TRAJECTORY_BUILDER_2D.submaps.num_range_data=50
TRAJECTORY_BUILDER_2D.submaps.range_data_inserter.probability_grid_range_data_inserter.hit_probability= 0.6
TRAJECTORY_BUILDER_2D.submaps.range_data_inserter.probability_grid_range_data_inserter.miss_probability =0.4
POSE_GRAPH.optimize_every_n_nodes =30
POSE_GRAPH.constraint_builder.min_score = 0.65
POSE_GRAPH.global_constraint_search_after_n_seconds=5
POSE_GRAPH.constraint_builder.global_localization_min_score = 0.65
-- fast localization
MAP_BUILDER.num_background_threads = 8
POSE_GRAPH.constraint_builder.sampling_ratio = 0.5
POSE_GRAPH.global_sampling_ratio =0.1
POSE_GRAPH.constraint_builder.log_matches =true
POSE_GRAPH.optimization_problem.odometry_translation_weight=1
POSE_GRAPH.optimization_problem.odometry_rotation_weight=1
return options
|
local Modules = game:GetService("Players").LocalPlayer.PlayerGui.AvatarEditorInGame.Modules
local AvatarEditorService = game:GetService("AvatarEditorService")
local Logging = require(Modules.Packages.Logging)
local Promise = require(Modules.Packages.Promise)
local PerformFetch = require(Modules.NotLApp.Thunks.PerformFetch)
local SetRecommendedAssetsAction = require(Modules.AvatarExperience.Catalog.Actions.SetRecommendedAssetsAction)
local CatalogConstants = require(Modules.AvatarExperience.Catalog.CatalogConstants)
local tableToCamelCaseKeys = require(Modules.Util.tableToCamelCaseKeys)
local avatarAssetTypeFromTypeId = require(Modules.Util.avatarAssetTypeFromTypeId)
local function keyMapper(assetId)
return CatalogConstants.RecommendedItemsForAssetsKey ..tostring(assetId)
end
return function(assetId, assetTypeId)
return PerformFetch.Single(keyMapper(assetId), function(store)
local assetInfo = store:getState().AvatarExperience.Common.Assets[tostring(assetId)]
if assetInfo ~= nil and assetInfo.receivedRecommendedData then
return Promise.resolve()
end
return Promise.new(function(resolve, reject)
coroutine.wrap(function()
local assetType = avatarAssetTypeFromTypeId(assetTypeId)
local data
pcall(function()
data = AvatarEditorService:GetRecommendedAssets(assetType, assetId)
end)
if data then
data = tableToCamelCaseKeys(data)
store:dispatch(SetRecommendedAssetsAction(assetId, data, assetTypeId))
local recommendedAssetIds = {}
for _,assetItem in pairs(data) do
table.insert(recommendedAssetIds, assetItem.item.assetId)
end
resolve(data)
else
Logging.warn("Response from GetRecommendedAssets is malformed!")
reject({HttpError = Enum.HttpError.OK})
end
end)()
end)
end)
end
|
local trinketBurntMatch =
TrinketPatches.util.registerEID("5% chance to turn fire into lower tier fire") ..
Isaac.GetTrinketIdByName("Burnt Match")
-- Make sure it doesn't appear regularly
local f =
TrinketPatches.util.register("MC_POST_GAME_STARTED") ..
function()
TrinketPatches.game:GetItemPool():RemoveTrinket(trinketBurntMatch)
end
local f =
TrinketPatches.util.register("MC_POST_NEW_ROOM") ..
function()
local room = TrinketPatches.game:GetRoom()
local player = Isaac.GetPlayer(0)
if room:IsFirstVisit() and player:HasTrinket(trinketBurntMatch) then
for _, ent in pairs(Isaac.GetRoomEntities()) do
if TrinketPatches.util.isFire(ent) then
TrinketPatches.util.log(ent.Variant)
if TrinketPatches.util.chance(5, false) and ent.Variant > 0 then
Isaac.Spawn(EntityType.ENTITY_FIREPLACE, ent.Variant - 1, 0, ent.Position, Vector(0, 0), nil)
ent:Remove()
end
end
end
end
end
err()
|
----------------------------------------------------------------
-- Copyright (c) 2012 Klei Entertainment Inc.
-- All Rights Reserved.
-- SPY SOCIETY.
----------------------------------------------------------------
local simdefs = include( "sim/simdefs" )
local simquery = include( "sim/simquery" )
local array = include( "modules/array" )
local mathutil = include( "modules/mathutil" )
local simfactory = include( "sim/simfactory" )
local mission_util = include( "sim/missions/mission_util" )
local util = include( "modules/util" )
--------------------------------------------------------------------------
-- Inventory functions
local function isCarryable( unit )
return unit:hasAbility( "carryable" ) ~= nil
end
local function canCarry( unit, targetUnit )
if unit == targetUnit then
return false
end
if not simquery.isAgent( unit ) or unit:getTraits().isDrone then
return false, STRINGS.UI.REASON.CANT_CARRY
end
if not isCarryable( targetUnit ) then
return false, STRINGS.UI.REASON.NOT_CARRYABLE
end
if targetUnit:getTraits().anarchySpecialItem and not unit:getTraits().anarchyItemBonus then
return false
end
if targetUnit:getTraits().largeSafeMapIntel and not unit:getTraits().largeSafeMapIntel then
return false
end
local x0, y0 = unit:getLocation()
local x1, y1 = targetUnit:getLocation()
if x0 and x1 and (x0 ~= x1 or y0 ~= y1) then
if not targetUnit:getTraits().reachable or not simquery.canReach( unit:getSim(), x0, y0, x1, y1 ) then
return false, STRINGS.UI.REASON.CANT_REACH
end
end
return true
end
local function pickupItem( sim, unit, item )
assert( unit )
assert( item )
if item:getTraits().pickup_trigger then
sim:triggerEvent( item:getTraits().pickup_trigger )
end
unit._sim:dispatchEvent( simdefs.EV_UNIT_PICKEDUP, {unit=item} )
if item:getTraits().deployed and item:getTraits().dynamicImpassOnDeploy then
item:getTraits().dynamicImpass = nil
end
if item:getTraits().mainframe_icon_on_deploy then
item:getTraits().mainframe_icon = nil
end
sim:triggerEvent(simdefs.TRG_UNIT_PICKEDUP, {item=item, unit=unit})
item:getTraits().deployed = nil
sim:warpUnit( item )
unit:addChild( item )
sim:triggerEvent( "agentGotItem", {item=item} )
unit._sim:dispatchEvent( simdefs.EV_PLAY_SOUND, "SpySociety/HUD/gameplay/HUD_ItemStorage_PutIn" )
unit._sim:dispatchEvent( simdefs.EV_UNIT_GET_ITEM, { item = item} )
if not unit:isPC() and item:getTraits().transporterBeacon then
sim:dispatchEvent( simdefs.EV_SHOW_MODAL, {header=item:getTraits().beaconLostHeader, txt=item:getTraits().beaconLostBody } )
sim:getPC():glimpseUnit( sim, item:getID() )
end
end
local function giftUnit( sim, unit, itemTemplate, showModal )
if showModal == nil then
showModal = true
end
if type(itemTemplate) == "string" then
local unitdefs = include( "sim/unitdefs" )
itemTemplate = unitdefs.lookupTemplate( itemTemplate )
end
local newUnit= simfactory.createUnit( itemTemplate, sim )
if not unit:getTraits().inventoryMaxSize or (unit:getInventoryCount() < 8) then
sim:spawnUnit( newUnit )
unit:addChild( newUnit )
if unit:isPC() and showModal then
sim:dispatchEvent( simdefs.EV_SHOW_MODAL, {header=STRINGS.UI.DIALOGS.ITEM_RECEIVED, txt=util.sformat(STRINGS.UI.DIALOGS.INVENTORY_RECIEVED,unit:getName(),newUnit:getName()) } )
end
return newUnit
elseif unit:getLocation() then
sim:spawnUnit( newUnit )
sim:warpUnit( newUnit, sim:getCell( unit:getLocation() ))
if unit:isPC() and showModal then
sim:dispatchEvent( simdefs.EV_SHOW_MODAL, {header=STRINGS.UI.DIALOGS.ITEM_RECEIVED, txt=util.sformat(STRINGS.UI.DIALOGS.INVENTORY_ON_FLOOR,unit:getName(),newUnit:getName()) } )
end
return newUnit
else
return nil
end
end
local function dropItem( sim, unit, item )
assert( unit )
assert( item )
local cell = sim:getCell( unit:getLocation() )
assert( cell )
sim:dispatchEvent( simdefs.EV_PLAY_SOUND, "SpySociety/HUD/gameplay/HUD_ItemStorage_TakeOut" )
sim:triggerEvent(simdefs.TRG_UNIT_DROPPED, {item=item, unit=unit})
unit:removeChild( item )
if item:getTraits().drop_dropdisguise then
unit:setDisguise(false)
end
if item:getTraits().equipped then
item:getTraits().equipped = nil
end
sim:warpUnit( item, cell )
end
local function dropAll( sim, unit )
assert( unit )
local cell = sim:getCell( unit:getLocation() )
assert( cell )
for i=#unit:getChildren(),1,-1 do
local childUnit = unit:getChildren()[i]
if isCarryable( childUnit ) then
dropItem( sim, unit, childUnit )
end
end
end
local function unequipItem( userUnit, item )
assert( array.find( userUnit:getChildren(), item ) ~= nil )
assert( item:getTraits().equipped )
userUnit:setAiming( false )
item:getTraits().equipped = nil
end
local function equipItem( userUnit, item )
assert( array.find( userUnit:getChildren(), item ) ~= nil ) -- Must be possessed
assert( not item:getTraits().equipped ) -- Must not already be equipped
assert( item:getTraits().slot ) -- Must specify an equip slot
-- Must first unequip anything that is already equipped in this slot.
for _,childUnit in pairs(userUnit:getChildren()) do
if childUnit:getTraits().slot == item:getTraits().slot and childUnit:getTraits().equipped then
unequipItem( userUnit, childUnit )
break
end
end
item:getTraits().equipped = true
end
local function autoEquip( unit )
if simquery.getEquippedGun( unit ) == nil then
for _,childUnit in pairs( unit:getChildren() ) do
if childUnit:getTraits().slot == "gun" then
equipItem( unit, childUnit )
break
end
end
end
if simquery.getEquippedMelee( unit ) == nil then
for _,childUnit in pairs( unit:getChildren() ) do
if childUnit:getTraits().slot == "melee" then
equipItem( unit, childUnit )
break
end
end
end
end
local function giveItem( unit, targetUnit, item )
assert( array.find( unit:getChildren(), item ))
if item:getTraits().equipped then
unequipItem( unit, item )
end
unit:removeChild( item )
if item:getTraits().drop_dropdisguise then
unit:setDisguise(false)
end
targetUnit:addChild( item )
if targetUnit:getPlayerOwner() == targetUnit._sim:getCurrentPlayer() then
targetUnit._sim:dispatchEvent( simdefs.EV_PLAY_SOUND, "SpySociety/HUD/gameplay/HUD_ItemStorage_PutIn" )
else
targetUnit._sim:dispatchEvent( simdefs.EV_PLAY_SOUND, "SpySociety/HUD/gameplay/HUD_ItemStorage_TakeOut" )
end
unit:getSim():triggerEvent( "agentGotItem", {item=item} )
targetUnit._sim:dispatchEvent( simdefs.EV_UNIT_GET_ITEM, { item = item} )
end
local function giveAll( unit, targetUnit )
while #unit:getChildren() > 0 do
giveItem( unit, targetUnit, unit:getChildren()[1] )
end
end
---------------------------------------------
-- Unequip (if equipped) and remove item from the unit's inventory.
-- The item is despawned from the sim, not dropped.
local function trashItem( sim, unit, item )
local x1, y1 = unit:getLocation()
local y1 = y1 - 0.75
local x1 = x1 - 0.75
if item:getTraits().equipped then
unequipItem( unit, item )
end
if item:getTraits().installed then
if item:getTraits().addAbilities then
unit:removeAbility(sim, item:getTraits().addAbilities)
end
if item:getTraits().addTrait then
for i,trait in ipairs(item:getTraits().addTrait)do
unit:getTraits()[trait[1]] = nil
end
end
if item:getTraits().modTrait then
for i,trait in ipairs(item:getTraits().modTrait)do
unit:getTraits()[trait[1]] = unit:getTraits()[trait[1]] + trait[2]
end
end
if item:getTraits().modSkill then
local skill = unit:getSkills()[item:getTraits().modSkill]
if skill then
while skill._currentLevel > 1 do
skill:levelDown( sim, unit )
end
end
if item:getTraits().modSkillLock then
for i,skill in ipairs(item:getTraits().modSkillLock) do
unit:getTraits().skillLock[skill] = false
end
end
end
end
if item:getTraits().drop_dropdisguise then
unit:setDisguise(false)
end
unit:removeChild( item )
sim:despawnUnit( item )
end
local function useItem( sim, unit, item )
local x1, y1 = unit:getLocation()
if item:getTraits().cooldown then
local mod = 0
if unit:countAugments( "augment_torque_injectors" ) > 0 then
mod = mod +1
end
item:getTraits().cooldown = math.max(item:getTraits().cooldownMax - mod, 0)
if mod > 0 then
sim:dispatchEvent( simdefs.EV_UNIT_FLOAT_TXT, {txt = STRINGS.ITEMS.AUGMENTS.TORQUE_INJECTORS, x = x1, y = y1,color={r=255/255,g=255/255,b=51/255,a=1}} )
end
if unit:countAugments( "augment_tony_2" ) > 0 and not unit:getTraits().tonyBonus then
if item:getTraits().cooldownMax - mod > 2 then
unit:getPlayerOwner():addCPUs(2, sim, x1,y1)
sim:dispatchEvent( simdefs.EV_UNIT_FLOAT_TXT, {txt = STRINGS.UI.FLY_TXT.THERMAL_GENERATOR, x = x1, y = y1,color={r=255/255,g=255/255,b=51/255,a=1}} )
unit:getTraits().tonyBonus = 1
end
end
if not sim:getTags().isTutorial then
sim:dispatchEvent( simdefs.EV_SHOW_COOLDOWN, {})
end
end
if item:getTraits().melee == true then
if unit:countAugments( "augment_nika_2" ) > 0 then
if not unit:getTraits().augment_nika_2_triggered then
for _, item in pairs( unit:getChildren() ) do
if item:getTraits().cooldown then
item:getTraits().cooldown = math.max(item:getTraits().cooldown - 1, 0)
sim:dispatchEvent( simdefs.EV_UNIT_FLOAT_TXT, {txt = STRINGS.ITEMS.AUGMENTS.NIKAS_2, x = x1, y = y1,color={r=255/255,g=255/255,b=51/255,a=1}} )
end
end
end
if sim:isVersion("0.17.9") then
unit:getTraits().augment_nika_2_triggered = true
end
end
end
if item:getTraits().usesCharges == true then
item:getTraits().charges = item:getTraits().charges -1
end
if item:getTraits().pwrCost then
item:getPlayerOwner():addCPUs( -item:getTraits().pwrCost, sim, x1,y1)
end
if item:getTraits().ammo then
item:getTraits().ammo = item:getTraits().ammo - 1
end
if item:getTraits().energyWeapon then
item:getTraits().energyWeapon = "active"
end
if item:getTraits().disposable and item:getUnitOwner() then
trashItem( sim, item:getUnitOwner(), item )
end
end
--------------------------------------------------------------------------
return
{
isCarryable = isCarryable,
canCarry = canCarry,
giftUnit = giftUnit,
giveItem = giveItem,
giveAll = giveAll,
pickupItem = pickupItem,
dropItem = dropItem,
dropAll = dropAll,
equipItem = equipItem,
unequipItem = unequipItem,
autoEquip = autoEquip,
trashItem = trashItem,
useItem = useItem,
}
|
_G = _G
local os = _G.os
local ipairs, pairs, table, string, collectgarbage = ipairs, pairs, table, string, collectgarbage
local arg = arg
local print, type, tostring = print, type, tostring
local getfenv = getfenv
local tonumber = tonumber
local tinsert = table.insert
local gsub = string.gsub
local find = string.find
local strsub = string.sub
local format = string.format
local concat = table.concat
local strfind = string.find
local io = io
local assert = assert
local loadstring = loadstring
local mongrel2 = require 'mongrel2'
local parent_env = getfenv(1)
module("web")
local this_env = getfenv(1)
local exports = { "get", "post", "routing", "redirect_request_to",
"mandatory", "optional", "numeric", "lisp_like_id",
"redirect_to_root", "render_verbatim", "render", "p", "include", "escape", "mongrel2connect"
}
debugging = false
-- debugging = true
function redirect_request_to(uri)
return function(page, req, resp, params)
if debugging then
print("Redirecting to uri:", uri)
end
req.redirect_to(uri)
-- page:redirect(req.script_name .. uri)
end
end
function begin_handling(mreq)
local page = page_new()
local request = {}
local response = {}
if mreq then
local apath = mreq.headers.PATH
local apatt = mreq.headers.PATTERN
local asub = string.sub(apath, 1, #apatt)
request.method = mreq.headers.METHOD
-- FIXME: this needs to be better than this
if asub == apatt and not (string.sub(apath, #apath) == '/') then
if apatt == '/' then
request.url = apath
else
request.url = string.sub(apath, 1+#apatt)
end
else
if apatt == '/' then
request.url = apath
else
request.url = '/' -- mreq.headers.PATH
end
end
if debugging then
print("apath:", apath, " apatt:", apatt, " asub:", asub, " url:",
request.url)
end
request.body = mreq.body
request.remote_addr = mreq.headers['x-forwarded-for']
request.referer = mreq.headers['referer']
request.query_string = mreq.headers.QUERY
request.script_name = mreq.headers.PATTERN
request.fullscripturl = "http://" ..
mreq.headers.host .. mreq.headers.PATTERN
else
if not arg then
request.method = os.getenv("REQUEST_METHOD")
request.url = os.getenv("PATH_INFO")
request.query_string = os.getenv("QUERY_STRING")
request.script_name = os.getenv("SCRIPT_NAME")
request.fullscripturl = "http://" .. os.getenv("SERVER_NAME") .. os.getenv("SCRIPT_NAME")
else
-- CLI testing
print("CLI use")
request.testing = true
request.method = arg[1] or "GET"
request.url = arg[2] or "/default_url_please_supply_correct" .. os.date("%s") -- "/"
request.query_string = arg[3] or "test=1"
request.script_name = arg[0]
request.fullscripturl = "http://" .. "myserver" .. "/testscript.lua"
end
end
request.redirect_to = function(uri)
page:redirect(request.script_name .. uri)
end
page.url_to = function(page, path)
return(request.fullscripturl .. path)
end
page.link_to = function(page, resource, text)
return '<a href="' .. request.script_name .. resource .. '">' .. text .. '</a>'
end
page._ = {} -- temp storage for rendering
return page, request, response
end
function end_handling(page)
collectgarbage("step")
if not page.no_default_response then
local res = page:full_response()
return page:zmq_response()
-- print(res)
end
-- return(res)
-- print("200 HTTP/1.0 OK\r\nContent-length: 10\r\n\r\n0123456789\r\n")
end
-- core stuff - string operations
function split(str, pat)
local t = {} -- NOTE: use {n = 0} in Lua-5.0
local fpat = "(.-)" .. pat
local last_end = 1
if str then
local s, e, cap = str:find(fpat, 1)
while s do
if s ~= 1 or cap ~= "" then
table.insert(t,cap)
end
last_end = e+1
s, e, cap = str:find(fpat, last_end)
end
if last_end <= #str then
cap = str:sub(last_end)
table.insert(t, cap)
end
end
return t
end
function split_path(str)
return split(str,'[\\/]+')
end
function words(str)
return split(str, "[ ]+")
end
-- serialization
function basicSerialize (o)
if type(o) == "number" then
return tostring(o)
elseif type(o) == "nil" then
return "nil"
elseif type(o) == "boolean" then
return tostring(o)
else -- assume it is a string
return string.format("%q", o)
end
end
function save (name, value, saved)
saved = saved or {} -- initial value
local ret = name .. " = "
if type(value) == "number" or type(value) == "string" or type(value) == "nil" or type(value) == "boolean" then
ret = ret .. basicSerialize(value) .. "\n"
elseif type(value) == "table" then
if saved[value] then -- value already saved?
ret = ret .. saved[value] .. "\n"
else
saved[value] = name -- save name for next time
ret = ret .. "{}\n" -- create a new table
for k,v in pairs(value) do -- save its fields
local fieldname = string.format("%s[%s]", name, basicSerialize(k))
ret = ret .. save(fieldname, v, saved)
end
end
else
ret = ret .. ("cannot save a " .. type(value))
end
return ret
end
-- string operations
function StringAccumulator()
local otab = {""}
otab.p = function(s)
-- table.insert(otab, s)
table.insert(otab, s) -- push 's' into the the stack
for i=table.getn(otab)-1, 1, -1 do
if string.len(otab[i]) > string.len(otab[i+1]) then
break
end
otab[i] = otab[i] .. table.remove(otab)
end
end
otab.ppp = function(...)
for i,v in ipairs(arg) do
otab.p(v)
end
end
otab.result = function(body)
return table.concat(otab)
end
return otab
end
------ cgilua.urlcode
----------------------------------------------------------------------------
-- Decode an URL-encoded string (see RFC 2396)
----------------------------------------------------------------------------
function unescape (str)
str = string.gsub (str, "+", " ")
str = string.gsub (str, "%%(%x%x)", function(h) return string.char(tonumber(h,16)) end)
str = string.gsub (str, "\r\n", "\n")
return str
end
----------------------------------------------------------------------------
-- URL-encode a string (see RFC 2396)
----------------------------------------------------------------------------
function escape (str)
str = string.gsub (str, "\n", "\r\n")
str = string.gsub (str, "([^0-9a-zA-Z ])", -- locale independent
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub (str, " ", "+")
return str
end
----------------------------------------------------------------------------
-- Insert a (name=value) pair into table [[args]]
-- @param args Table to receive the result.
-- @param name Key for the table.
-- @param value Value for the key.
-- Multi-valued names will be represented as tables with numerical indexes
-- (in the order they came).
----------------------------------------------------------------------------
function insertfield (args, name, value)
if not args[name] then
args[name] = value
else
local t = type (args[name])
if t == "string" then
args[name] = {
args[name],
value,
}
elseif t == "table" then
table.insert (args[name], value)
else
error ("CGILua fatal error (invalid args table)!")
end
end
end
----------------------------------------------------------------------------
-- Parse url-encoded request data
-- (the query part of the script URL or url-encoded post data)
--
-- Each decoded (name=value) pair is inserted into table [[args]]
-- @param query String to be parsed.
-- @param args Table where to store the pairs.
----------------------------------------------------------------------------
function parsequery (query, args)
if type(query) == "string" then
local insertfield, unescape = insertfield, unescape
string.gsub (query, "([^&=]+)=([^&=]*)&?",
function (key, val)
insertfield (args, unescape(key), unescape(val))
end)
end
end
----------------------------------------------------------------------------
-- URL-encode the elements of a table creating a string to be used in a
-- URL for passing data/parameters to another script
-- @param args Table where to extract the pairs (name=value).
-- @return String with the resulting encoding.
----------------------------------------------------------------------------
function encodetable (args)
if args == nil or next(args) == nil then -- no args or empty args?
return ""
end
local strp = ""
for key, vals in pairs(args) do
if type(vals) ~= "table" then
vals = {vals}
end
for i,val in ipairs(vals) do
strp = strp.."&"..escape(key).."="..escape(val)
end
end
-- remove first &
return string.sub(strp,2)
end
------ cgilua.cookies
local function optional_value (what, name)
if name ~= nil and name ~= "" then
return format("; %s=%s", what, name)
else
return ""
end
end
function build_cookie (name, value, options)
if not name or not value then
error("cookie needs a name and a value")
end
local expires = ""
options = options or {}
if options.expires then
local t = date("!%A, %d-%b-%Y %H:%M:%S GMT", options.expires)
expires = optional_value("expires", t)
end
return name .. "=" .. escape(value) ..
expires ..
optional_value("path", options.path) ..
optional_value("domain", options.domain) ..
optional_value("secure", options.secure)
end
----------------------------------------------------------------------------
-- Sets a value to a cookie, with the given options.
-- Generates an HTML META tag, thus it can be used in Lua Pages.
-- @param name String with the name of the cookie.
-- @param value String with the value of the cookie.
-- @param options Table with the options (optional).
function set_cookie_html (name, value, options)
return format('<meta http-equiv="Set-Cookie" content="%s">',
build_cookie(name, value, options))
end
----------------------------------------------------------------------------
-- Gets the value of a cookie.
-- @param name String with the name of the cookie.
-- @return String with the value associated with the cookie.
function get_cookie (name)
local cookies = os.getenv("HTTP_COOKIE") or ""
cookies = ";" .. cookies .. ";"
cookies = gsub(cookies, "%s*;%s*", ";") -- remove extra spaces
local pattern = ";" .. name .. "=(.-);"
local _, __, value = strfind(cookies, pattern)
return value and unescape(value)
end
----------------------------------------------------------------------------
-- Deletes a cookie, by setting its value to "xxx".
-- @param name String with the name of the cookie.
-- @param options Table with the options (optional).
function delete_cookie (name, options)
options = options or {}
options.expires = 1
set_cookie(name, "xxx", options)
end
-- webpage stuff
function page_new()
page = {
body = StringAccumulator(),
header = {
["Content-Type"] = "text/html; charset=utf-8",
["Status"] = "200"
},
redirect = function(t, url)
t.header["Status"] = "302"
t.header["Location"] = url
end,
write = function (pg, ...)
for i,v in ipairs(arg) do
pg.body.p(tostring(v))
end
end,
render_form = function(pg, form)
return render_form(form)
end,
add_form = function(pg, form)
pg:write(render_form(form))
end,
set_cookie = function (pg, name, value, options)
pg.header["Set-Cookie"] = build_cookie(name, value, options)
end,
zmq_response = function(pg)
local body, code, status, headers
body = pg.body.result()
code = 200
status = "OK"
if(pg.header["Status"]) then
code = pg.header["Status"]
end
headers = pg.header
return body, code, status, headers
end,
full_response = function(pg)
local o = ""
local hdr = StringAccumulator()
local cnt = pg.body.result()
local standalone = true
pg.header["Content-Length"] = string.len(cnt)
local firstline = ""
for k, v in pairs(pg.header) do
hdr.p(k .. ": " .. v .. "\r\n")
end
return firstline .. hdr.result() .. "\r\n" .. pg.body.result()
end,
}
return page
end
function send_response(printfunc)
end
------ forms
function render_form(form)
if not form then return "" end
local s = StringAccumulator()
local p = s.ppp
local pff = function()
attrs = { "action", "id", "class", "style" }
for i,fn in ipairs(attrs) do
if form[fn] then p(" ", fn, "=\"", form[fn], "\"") end
end
end
local esc = function(str)
str = string.gsub(str, "\"", """)
return str
end
local esc2 = function(str)
str = string.gsub(str, "\<", "<")
return str
end
local pef = function(field, attrs)
for i,fn in ipairs(attrs) do
if field[fn] then
p(" ", fn, "=\"", esc(field[fn]), "\"")
end
end
end
p("<form method=\"", (form.method or "get"), "\"")
pff()
p(">\n")
for i,inp in ipairs(form) do
if inp.html then
p(inp.html)
else
local attrs = { "name", "value", "id", "class", "style", "autocomplete", "title", "accesskey" }
local attrs2 = { "name", "id", "class", "style", "autocomplete", "title", "accesskey" }
if inp.label then
p("<label>", inp.label)
if inp.small_label then
p("<span class='small-label'>", inp.small_label, "</span>")
end
p("</label>")
end
if inp[1] == "textarea" then
p("<textarea")
pef(inp, attrs2)
p(">")
if inp.value then p(esc2(inp.value)) end
p("</textarea>")
else
p("<input type=\"", inp[1], "\"")
pef(inp, attrs)
p(" />\n")
end
end
end
p("</form>\n")
return s.result()
end
------
function check_param(src, k, v)
local ret
for i, chk in ipairs(v) do
local ret, msg = chk(src, k)
if ret == 0 then
return 0, msg
elseif ret == 2 then
return 2
end
end
-- if we made it to here, means all ok
return 2
end
function check_params(src, dst, template)
local errors = {}
for k, v in pairs(template) do
if type(v) == "table" then
local res, err = check_param(src, k, v)
if res == 0 then
errors[#errors + 1] = err
else
dst[k] = src[k]
end
end
end
return #errors == 0, errors
end
function pack(...)
return arg
end
function request_method(meth, x)
-- ease on the eye, the matches are always "whole-string"
x[1] = "^" .. x[1] .. "$"
return function(page, req, resp, params, predicate)
-- logprint("page:" , page, req, resp, params)
if req then
-- if debugging then print("Method of ", req.method, meth) end
if req.method == meth then
local url_match = pack(string.match(req.url, x[1]))
if debugging then
print("trying to match:" .. req.url .. " against " .. x[1] .. " with result " .. tostring(#url_match) .. "<br>")
end
if #url_match > 0 then
local local_params = {}
for i, v in ipairs(url_match) do
if debugging then print("PATH_CAPTURE:", x[1], ":", i, ":", v) end
params["path_capture_" .. i] = unescape(v)
end
-- print("PARAMS", params.test)
local res, errors = check_params(params, local_params, x.params or {} )
if debugging then print("Param check:", res, errors) end
if res then
if predicate then
if not predicate(page, req, resp, params) then
if debugging then print("Precall failed, continue checking") end
return "next"
end
end
local funcname = x[2]
if type(funcname) == "string" then
--- magic - to get the env of the "main" script
local func = parent_env[funcname]
page._.controller = funcname
local res2 = func(page, req, resp, local_params)
if page._.controller and not page.rendered then
if not page._.view then
page._.view = page._.controller
end
render(page._.view .. ".html", page, req, resp, local_params)
end
return res2
elseif type(funcname) == "function" then
local func = funcname
page._.controller = nil -- "*unknown*"
return func(page, req, resp, local_params)
end
elseif x.next_if_bad_args then
-- fail soft if we were asked to
if debugging then print("Validation error: " .. msg) end
else
-- fail hard (default)
-- need to bounce off to the coroutine that will handle the error
if x.on_error then
return x.on_error(page, req, resp, params, errors)
else
return
end
end
end
end
return true
else
-- introspection (no request)
return "Method: " .. meth .. " " .. x[1]
end
end
end
function get(x)
return request_method("GET", x)
end
function post(x)
return request_method("POST", x)
end
local steps = 0
local matcher = nil
function get_routes()
return matcher(nil, nil, "routes")
end
function routing(rules, mreq)
local page, request, response = begin_handling(mreq)
--XX local parent_env = getfenv(2)
-- print = rules.print
-- read = rules.read
--XX print, read = parent_env.print, parent_env.read
if debugging then
for i, r in ipairs(rules) do print(i, r(nil, nil)) end
end
-- the matcher function is a simple linear walker when it comes to business logic
matcher = function(page, req, resp, params)
-- print("Matcher arg:", page, req, resp, params)
if req and resp then
for i, func in ipairs(rules) do
-- profiling
steps = steps + 1
-- note that we are calling the function that was returned by the request_method function
local res = func(page, req, resp, params, rules.predicate)
-- page:write("<br>".. req.url .. tostring(res))
if res == nil then
if debugging then print("Found: ", i) end
return true
elseif res == "next" then
-- skip to next
end
end
elseif not req and not resp then
-- some introspection - to know when the version number has been bumped
return rules.version
elseif not req and resp == "routes" then
local s = ""
for i, r in ipairs(rules) do
s = s .. "\n" .. i .. ":" .. r(nil, nil)
end
return s
end
end
local arguments = {}
if request.method == "GET" then
parsequery(request.query_string, arguments)
elseif request.method == "POST" then
parsequery(request.query_string, arguments)
if not request.testing then
parsequery(request.body, arguments)
end
end
matcher(page, request, response, arguments)
return end_handling(page)
end
------ input fields validation predicates
--[[
parameter predicates, they need to return:
0: failure.
1: continue checking
2: success, stop checking
]]
function optional(dirty_params, pname, clean_params)
if dirty_params[pname] then
return 1
else
return 2
end
end
function mandatory(dirty_params, pname, clean_params)
if dirty_params[pname] then
return 1
else
return 0, { field = pname, message = "a mandatory parameter" }
end
end
function numeric(dirty_params, pname, clean_params)
-- FIXME
if string.match(dirty_params[pname], "^[0-9]+$") then
return 1
else
return 0, { field = pname, message = "should be numeric" }
end
end
function lisp_like_id(dirty_params, pname, clean_params)
if pname and dirty_params[pname] and string.match(dirty_params[pname], "^[-_a-zA-Z0-9]+$") then
return 1
else
return 0, { field = pname, message = "lisp-like field needed" }
end
end
function redirect_to_root(page, req, resp, params)
print("Redirecting to root")
req.redirect_to("/")
end
---------- rendering / templating
function p(val)
return (string.gsub(string.gsub(tostring(val or ""), "\"", """), "\<", "<"))
end
local outfunc = "table.insert(_render_result_,"
local function out (s, i, f)
s = strsub(s, i, f or -1)
if s == "" then return s end
-- we could use `%q' here, but this way we have better control
s = gsub(s, "([\\\n\'])", "\\%1")
-- substitute '\r' by '\'+'r' and let `loadstring' reconstruct it
s = gsub(s, "\r", "\\r")
return format(" %s'%s'); ", outfunc, s)
end
function translate (s)
s = gsub(s, "^#![^\n]+\n", "")
if compatmode then
s = gsub(s, "$|(.-)|%$", "<?lua = %1 ?>")
s = gsub(s, "<!%-%-$$(.-)$$%-%->", "<?lua %1 ?>")
end
s = gsub(s, "<%%(.-)%%>", "<?lua %1 ?>")
local res = { [[
function _render_(page, req, resp, params)
local _render_result_ = {}
]] }
local start = 1 -- start of untranslated part in `s'
while true do
local ip, fp, target, exp, code = find(s, "<%?(%w*)[ \t]*(=?)(.-)%?>", start)
if not ip then break end
tinsert(res, out(s, start, ip-1))
if target ~= "" and target ~= "lua" then
-- not for Lua; pass whole instruction to the output
tinsert(res, out(s, ip, fp))
else
if exp == "=" then -- expression?
tinsert(res, format(" %s%s);", outfunc, code))
else -- command
tinsert(res, format(" %s ", code))
end
end
start = fp + 1
end
tinsert(res, out(s, start))
tinsert(res, "\rreturn table.concat(_render_result_);\rend\rreturn _render_\r")
return concat(res)
end
local template_cache = {}
function compile (string, chunkname)
local f, err = template_cache[string]
-- FIXME: caching - the next line.
-- if f then return f.func end
f = {}
f.func, err = loadstring (translate (string), chunkname)
if f.func then
f.name = chunkname
template_cache[string] = f
return f.func
else
error (err, 3)
return nil
end
end
local BOM = string.char(239) .. string.char(187) .. string.char(191)
function get_src_content(fname)
local argv=parent_env['arg']
local fh = assert (io.open("./" .. argv[0] .. ".d/" .. fname))
local src = fh:read("*a")
fh:close()
if src:sub(1,3) == BOM then src = src:sub(4) end
return src
end
function include(fname, page, req, resp, params)
local src = get_src_content(fname)
local func = compile(src, fname)
if func then
return func()(page, req, resp, params)
else
return nil
end
end
function render(fname, page, req, resp, params)
page:write(include(fname, page, req, resp, params))
page.rendered = true
-- page:write(translate(src, fname))
end
function render_verbatim(fname, page, req, resp, params)
local src = get_src_content(fname)
page:write(src)
page.rendered = true
end
function mongrel2connect(rules)
local io_threads = 1
local ctx = mongrel2.new(io_threads)
-- Creates a new connection object using the mongrel2 context
local conn = ctx:new_connection(rules.sender_id, rules.sub_addr, rules.pub_addr)
while true do
local req = conn:recv()
if req:is_disconnect() then
-- print 'Disconnected'
else
local response = ""
-- response = response_string:format(req.sender, req.conn_id, req.path, dump(req.headers), req.body)
conn:reply_http(req, routing(rules, req))
end
end
ctx:term()
end
for i, v in ipairs(exports) do
parent_env[v] = this_env[v]
end
|
local _, ns = ...
local _, _, L = unpack(ns)
--if GetLocale() ~= "enUS" then return end
L["Version Check"] = "Only support NDui v%s"
L["Changelog"] = "Changelog"
L["Option Tips"] = "|nOptions not marked with an asterisk (*) require an UI Reload.|n|nDouble click on slider header would reset its value."
L["Tips"] = "Tips"
L["EditBox Tip"] = "|nPress KEY ENTER when you finish typing."
L["Actionbar"] = "Actionbar"
L["UnitFrames"] = "UnitFrames"
L["Chat"] = "Chat"
L["Skins"] = "Skins"
L["Tooltip"] = "Tooltip"
L["Misc"] = "Misc"
L["UnitFramesFader"] = "UnitFrames Fader"
L["UnitFramesFaderTip"] = "Enable unitframes fader, Only support player frame and pet frame."
L["Fade Settings"] = "Fade Settings"
L["Fade Condition"] = "Fade Condition"
L["Fade Delay"] = "Fade Out Delay"
L["Smooth"] = "Smooth"
L["MinAlpha"] = "Min Alpha"
L["MaxAlpha"] = "Max Alpha"
L["Hover"] = "Hover"
L["Combat"] = "Combat"
L["Target"] = "Target"
L["Focus"] = "Focus"
L["Health"] = "Health"
L["Casting"] = "Casting"
L["Emote"] = "E"
L["ChatEmote"] = "Chat Emote"
L["ChatEmoteTip"] = "Click emote button to open emote panel or input symbol {"
L["ChatClassColor"] = "Player Name Color"
L["ChatClassColorTip"] = "Use class color for the names of players when they are mentioned."
L["ChatRaidIndex"] = "Show Team Index"
L["ChatRaidIndexTip"] = "Show team index after raid member name."
L["ChatLinkIcon"] = "Show Chat Link Icon"
L["ReplaceTexture"] = "Replace NDui Texture"
L["ReplaceTextureTip"]= "Replace NDui Textur|nSupport LibSharedMedia-3.0."
L["Texture Style"] = "Texture Style"
L["Addon Skin"] = "Addon Skin"
L["LootEnhancedEnable"] = "Enable Loot Enhanced"
L["LootEnhancedTip"] = "Loot Enhanced, need enable NDui Reskin Lootframe."
L["LootAnnounceButton"] = "Loot Announce Button"
L["Announce Target Name"] = "Announce Target Name"
L["Rarity Threshold"] = "Rarity Threshold"
L["Loots in chest"] = "Loots in chest"
L["Loots"] = "Loots"
L["Announce Loots to"] = "Announce Loots to "
L["GlobalFadeEnable"] = "Enable Global Fade"
L["Fade Alpha"] = "Fade Out Alpha"
L["Bar1"] = "Bar1"
L["Bar2"] = "Bar2"
L["Bar3"] = "Bar3"
L["Bar4"] = "Bar4"
L["Bar5"] = "Bar5"
L["CustomBar"] = "CustomBar"
L["PetBar"] = "PetBar"
L["StanceBar"] = "StanceBar"
L["AspectBar"] = "AspectBar"
L["Bags"] = "Bags"
L["OfflineBag"] = "Offline Bag"
L["OfflineBagEnable"] = "Enable Offline Bag"
L["Set KeyBinding"] = "Set KeyBinding"
L["OfflineBagTip"] = "Click the button in NDui backpack to open Offline Bag, or set KeyBinding, or input '/ndpb' command"
L["BagsWidth"] = "Bags Width"
L["BagsIconSize"] = "Bags IconSize"
L["Open OfflineBag"] = "Open OfflineBag"
L["Open Bag"] = "Open Bag"
L["Toggle OfflineBag"] = "Show/Hide OfflineBag"
L["TOOLTIP_CHANGE_PLAYER"] = "View another character\'s items."
L["TOOLTIP_RETURN_TO_SELF"] = "Return to the current character."
L["LootRoll"] = "Enable LootRoll Enhanced"
L["LootRollTip"] = "/teks test, /mm move"
L["teksLoot LootRoll"] = "teksLoot LootRoll"
L["Frame Width"] = "Frame Width"
L["Frame Height"] = "Frame Height"
L["Growth Direction"] = "Growth Direction"
L["Up"] = "Up"
L["Down"] = "Down"
L["Style"] = "Bar Style"
L["Style 1"] = "Style 1"
L["Style 2"] = "Style 2"
L["EnhancedUITip"] = "Click the arrow on TOPRIGHT corner of the panel to toggle."
L["EnhancedTrainers"] = "Enhance trainers"
L["EnhancedGuildUI"] = "Extended Guild UI"
L["EnhancedTalentUI"] = "Enhanced TalentUI"
L["ChatHide"] = "ChatFrame Hide"
L["ChatHideTip"] = "Need lock NDui ChatFrame Settings."
L["AutoShow"] = "Auto show ChatFrame"
L["AutoShowTip"] = "Auto show ChatFrame and blink when new wisper received."
L["AutoHide"] = "Auto hide ChatFrame"
L["AutoHideTip"] = "Hide ChatFrame when no news comed for a while."
L["AutoHideTime"] = "Auto hide time"
L["Click to hide ChatFrame"] = "Click to hide ChatFrame"
L["Click to show ChatFrame"] = "Click to show ChatFrame"
L["You have new wisper"] = "You have new wisper"
L["HideToggle"] = "Hide Details toggle button"
L["AFK Mode"] = "AFK Mode"
L["No Guild"] = "No Guild"
L["MageBar"] = "MageBar"
L["MageBarTip"] = "Mage's portal action bar."
L["MageBarVertical"] = "Verticle MageBar"
L["MageBarSize"] = "MageBar Size"
L["CategoryArrow"] = "Fade NDui stats panel arrow"
L["Teleport"] = "Teleport"
L["Portal"] = "Portal"
L["Food"] = "Conjure Food"
L["Water"] = "Conjure Water"
L["Mana Gem"] = "Mana Gem"
L["SearchForIcons"] = "Search for icons"
L["SearchForIconsGUITip"] = "Add a search box on icon selector, support Macro, Equipment Manager, Guild Bank."
L["SearchForIconsTip"] = "|nSupport Spell ID、Item ID、Icon ID|n|nPress KEY ENTER when entering Icon ID."
L["TankFrame"] = "Tank Frame"
L["Target Frame"] = "Target Frame"
L["Power Height"] = "Power Height"
|
return [==[
/*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery.min.map
*/(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=d.getElementsByTagName("*"),r=d.getElementsByTagName("a")[0],!n||!r||!n.length)return{};s=o.createElement("select"),l=s.appendChild(o.createElement("option")),a=d.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==d.className,leadingWhitespace:3===d.firstChild.nodeType,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:"/a"===r.getAttribute("href"),opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:!!a.value,optSelected:l.selected,enctype:!!o.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==o.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===o.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!l.disabled;try{delete d.test}catch(h){t.deleteExpando=!1}a=o.createElement("input"),a.setAttribute("value",""),t.input=""===a.getAttribute("value"),a.value="t",a.setAttribute("type","radio"),t.radioValue="t"===a.value,a.setAttribute("checked","t"),a.setAttribute("name","t"),u=o.createDocumentFragment(),u.appendChild(a),t.appendChecked=a.checked,t.checkClone=u.cloneNode(!0).cloneNode(!0).lastChild.checked,d.attachEvent&&(d.attachEvent("onclick",function(){t.noCloneEvent=!1}),d.cloneNode(!0).click());for(f in{submit:!0,change:!0,focusin:!0})d.setAttribute(c="on"+f,"t"),t[f+"Bubbles"]=c in e||d.attributes[c].expando===!1;return d.style.backgroundClip="content-box",d.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===d.style.backgroundClip,b(function(){var n,r,a,s="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",u=o.getElementsByTagName("body")[0];u&&(n=o.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",u.appendChild(n).appendChild(d),d.innerHTML="<table><tr><td></td><td>t</td></tr></table>",a=d.getElementsByTagName("td"),a[0].style.cssText="padding:0;margin:0;border:0;display:none",p=0===a[0].offsetHeight,a[0].style.display="",a[1].style.display="none",t.reliableHiddenOffsets=p&&0===a[0].offsetHeight,d.innerHTML="",d.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===d.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==u.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(d,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(d,null)||{width:"4px"}).width,r=d.appendChild(o.createElement("div")),r.style.cssText=d.style.cssText=s,r.style.marginRight=r.style.width="0",d.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(r,null)||{}).marginRight)),typeof d.style.zoom!==i&&(d.innerHTML="",d.style.cssText=s+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===d.offsetWidth,d.style.display="block",d.innerHTML="<div></div>",d.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==d.offsetWidth,t.inlineBlockNeedsLayout&&(u.style.zoom=1)),u.removeChild(n),n=d=a=r=null)}),n=s=u=l=r=a=null,t}();var O=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,B=/([A-Z])/g;function P(e,n,r,i){if(b.acceptData(e)){var o,a,s=b.expando,u="string"==typeof n,l=e.nodeType,p=l?b.cache:e,f=l?e[s]:e[s]&&s;if(f&&p[f]&&(i||p[f].data)||!u||r!==t)return f||(l?e[s]=f=c.pop()||b.guid++:f=s),p[f]||(p[f]={},l||(p[f].toJSON=b.noop)),("object"==typeof n||"function"==typeof n)&&(i?p[f]=b.extend(p[f],n):p[f].data=b.extend(p[f].data,n)),o=p[f],i||(o.data||(o.data={}),o=o.data),r!==t&&(o[b.camelCase(n)]=r),u?(a=o[n],null==a&&(a=o[b.camelCase(n)])):a=o,a}}function R(e,t,n){if(b.acceptData(e)){var r,i,o,a=e.nodeType,s=a?b.cache:e,u=a?e[b.expando]:b.expando;if(s[u]){if(t&&(o=n?s[u]:s[u].data)){b.isArray(t)?t=t.concat(b.map(t,b.camelCase)):t in o?t=[t]:(t=b.camelCase(t),t=t in o?[t]:t.split(" "));for(r=0,i=t.length;i>r;r++)delete o[t[r]];if(!(n?$:b.isEmptyObject)(o))return}(n||(delete s[u].data,$(s[u])))&&(a?b.cleanData([e],!0):b.support.deleteExpando||s!=s.window?delete s[u]:s[u]=null)}}}b.extend({cache:{},expando:"jQuery"+(p+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?b.cache[e[b.expando]]:e[b.expando],!!e&&!$(e)},data:function(e,t,n){return P(e,t,n)},removeData:function(e,t){return R(e,t)},_data:function(e,t,n){return P(e,t,n,!0)},_removeData:function(e,t){return R(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&b.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),b.fn.extend({data:function(e,n){var r,i,o=this[0],a=0,s=null;if(e===t){if(this.length&&(s=b.data(o),1===o.nodeType&&!b._data(o,"parsedAttrs"))){for(r=o.attributes;r.length>a;a++)i=r[a].name,i.indexOf("data-")||(i=b.camelCase(i.slice(5)),W(o,i,s[i]));b._data(o,"parsedAttrs",!0)}return s}return"object"==typeof e?this.each(function(){b.data(this,e)}):b.access(this,function(n){return n===t?o?W(o,e,b.data(o,e)):null:(this.each(function(){b.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function W(e,n,r){if(r===t&&1===e.nodeType){var i="data-"+n.replace(B,"-$1").toLowerCase();if(r=e.getAttribute(i),"string"==typeof r){try{r="true"===r?!0:"false"===r?!1:"null"===r?null:+r+""===r?+r:O.test(r)?b.parseJSON(r):r}catch(o){}b.data(e,n,r)}else r=t}return r}function $(e){var t;for(t in e)if(("data"!==t||!b.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}b.extend({queue:function(e,n,r){var i;return e?(n=(n||"fx")+"queue",i=b._data(e,n),r&&(!i||b.isArray(r)?i=b._data(e,n,b.makeArray(r)):i.push(r)),i||[]):t},dequeue:function(e,t){t=t||"fx";var n=b.queue(e,t),r=n.length,i=n.shift(),o=b._queueHooks(e,t),a=function(){b.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),o.cur=i,i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return b._data(e,n)||b._data(e,n,{empty:b.Callbacks("once memory").add(function(){b._removeData(e,t+"queue"),b._removeData(e,n)})})}}),b.fn.extend({queue:function(e,n){var r=2;return"string"!=typeof e&&(n=e,e="fx",r--),r>arguments.length?b.queue(this[0],e):n===t?this:this.each(function(){var t=b.queue(this,e,n);b._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&b.dequeue(this,e)})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(e,t){return e=b.fx?b.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,o=b.Deferred(),a=this,s=this.length,u=function(){--i||o.resolveWith(a,[a])};"string"!=typeof e&&(n=e,e=t),e=e||"fx";while(s--)r=b._data(a[s],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(u));return u(),o.promise(n)}});var I,z,X=/[\t\r\n]/g,U=/\r/g,V=/^(?:input|select|textarea|button|object)$/i,Y=/^(?:a|area)$/i,J=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,G=/^(?:checked|selected)$/i,Q=b.support.getSetAttribute,K=b.support.input;b.fn.extend({attr:function(e,t){return b.access(this,b.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,t){return b.access(this,b.prop,e,t,arguments.length>1)},removeProp:function(e){return e=b.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,a=0,s=this.length,u="string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).addClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):" ")){o=0;while(i=t[o++])0>r.indexOf(" "+i+" ")&&(r+=i+" ");n.className=b.trim(r)}return this},removeClass:function(e){var t,n,r,i,o,a=0,s=this.length,u=0===arguments.length||"string"==typeof e&&e;if(b.isFunction(e))return this.each(function(t){b(this).removeClass(e.call(this,t,this.className))});if(u)for(t=(e||"").match(w)||[];s>a;a++)if(n=this[a],r=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(X," "):"")){o=0;while(i=t[o++])while(r.indexOf(" "+i+" ")>=0)r=r.replace(" "+i+" "," ");n.className=e?b.trim(r):""}return this},toggleClass:function(e,t){var n=typeof e,r="boolean"==typeof t;return b.isFunction(e)?this.each(function(n){b(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n){var o,a=0,s=b(this),u=t,l=e.match(w)||[];while(o=l[a++])u=r?u:!s.hasClass(o),s[u?"addClass":"removeClass"](o)}else(n===i||"boolean"===n)&&(this.className&&b._data(this,"__className__",this.className),this.className=this.className||e===!1?"":b._data(this,"__className__")||"")})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;r>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(X," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,o=this[0];{if(arguments.length)return i=b.isFunction(e),this.each(function(n){var o,a=b(this);1===this.nodeType&&(o=i?e.call(this,n,a.val()):e,null==o?o="":"number"==typeof o?o+="":b.isArray(o)&&(o=b.map(o,function(e){return null==e?"":e+""})),r=b.valHooks[this.type]||b.valHooks[this.nodeName.toLowerCase()],r&&"set"in r&&r.set(this,o,"value")!==t||(this.value=o))});if(o)return r=b.valHooks[o.type]||b.valHooks[o.nodeName.toLowerCase()],r&&"get"in r&&(n=r.get(o,"value"))!==t?n:(n=o.value,"string"==typeof n?n.replace(U,""):null==n?"":n)}}}),b.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;for(;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(b.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&b.nodeName(n.parentNode,"optgroup"))){if(t=b(n).val(),o)return t;a.push(t)}return a},set:function(e,t){var n=b.makeArray(t);return b(e).find("option").each(function(){this.selected=b.inArray(b(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,r){var o,a,s,u=e.nodeType;if(e&&3!==u&&8!==u&&2!==u)return typeof e.getAttribute===i?b.prop(e,n,r):(a=1!==u||!b.isXMLDoc(e),a&&(n=n.toLowerCase(),o=b.attrHooks[n]||(J.test(n)?z:I)),r===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==i&&(s=e.getAttribute(n)),null==s?t:s):null!==r?o&&a&&"set"in o&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r):(b.removeAttr(e,n),t))},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(w);if(o&&1===e.nodeType)while(n=o[i++])r=b.propFix[n]||n,J.test(n)?!Q&&G.test(n)?e[b.camelCase("default-"+n)]=e[r]=!1:e[r]=!1:b.attr(e,n,""),e.removeAttribute(Q?n:r)},attrHooks:{type:{set:function(e,t){if(!b.support.radioValue&&"radio"===t&&b.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,o,a,s=e.nodeType;if(e&&3!==s&&8!==s&&2!==s)return a=1!==s||!b.isXMLDoc(e),a&&(n=b.propFix[n]||n,o=b.propHooks[n]),r!==t?o&&"set"in o&&(i=o.set(e,r,n))!==t?i:e[n]=r:o&&"get"in o&&null!==(i=o.get(e,n))?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):V.test(e.nodeName)||Y.test(e.nodeName)&&e.href?0:t}}}}),z={get:function(e,n){var r=b.prop(e,n),i="boolean"==typeof r&&e.getAttribute(n),o="boolean"==typeof r?K&&Q?null!=i:G.test(n)?e[b.camelCase("default-"+n)]:!!i:e.getAttributeNode(n);return o&&o.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?b.removeAttr(e,n):K&&Q||!G.test(n)?e.setAttribute(!Q&&b.propFix[n]||n,n):e[b.camelCase("default-"+n)]=e[n]=!0,n}},K&&Q||(b.attrHooks.value={get:function(e,n){var r=e.getAttributeNode(n);return b.nodeName(e,"input")?e.defaultValue:r&&r.specified?r.value:t},set:function(e,n,r){return b.nodeName(e,"input")?(e.defaultValue=n,t):I&&I.set(e,n,r)}}),Q||(I=b.valHooks.button={get:function(e,n){var r=e.getAttributeNode(n);return r&&("id"===n||"name"===n||"coords"===n?""!==r.value:r.specified)?r.value:t},set:function(e,n,r){var i=e.getAttributeNode(r);return i||e.setAttributeNode(i=e.ownerDocument.createAttribute(r)),i.value=n+="","value"===r||n===e.getAttribute(r)?n:t}},b.attrHooks.contenteditable={get:I.get,set:function(e,t,n){I.set(e,""===t?!1:t,n)}},b.each(["width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{set:function(e,r){return""===r?(e.setAttribute(n,"auto"),r):t}})})),b.support.hrefNormalized||(b.each(["href","src","width","height"],function(e,n){b.attrHooks[n]=b.extend(b.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return null==r?t:r}})}),b.each(["href","src"],function(e,t){b.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),b.support.style||(b.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),b.support.optSelected||(b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),b.support.enctype||(b.propFix.enctype="encoding"),b.support.checkOn||b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,n){return b.isArray(n)?e.checked=b.inArray(b(e).val(),n)>=0:t}})});var Z=/^(?:input|select|textarea)$/i,et=/^key/,tt=/^(?:mouse|contextmenu)|click/,nt=/^(?:focusinfocus|focusoutblur)$/,rt=/^([^.]*)(?:\.(.+)|)$/;function it(){return!0}function ot(){return!1}b.event={global:{},add:function(e,n,r,o,a){var s,u,l,c,p,f,d,h,g,m,y,v=b._data(e);if(v){r.handler&&(c=r,r=c.handler,a=c.selector),r.guid||(r.guid=b.guid++),(u=v.events)||(u=v.events={}),(f=v.handle)||(f=v.handle=function(e){return typeof b===i||e&&b.event.triggered===e.type?t:b.event.dispatch.apply(f.elem,arguments)},f.elem=e),n=(n||"").match(w)||[""],l=n.length;while(l--)s=rt.exec(n[l])||[],g=y=s[1],m=(s[2]||"").split(".").sort(),p=b.event.special[g]||{},g=(a?p.delegateType:p.bindType)||g,p=b.event.special[g]||{},d=b.extend({type:g,origType:y,data:o,handler:r,guid:r.guid,selector:a,needsContext:a&&b.expr.match.needsContext.test(a),namespace:m.join(".")},c),(h=u[g])||(h=u[g]=[],h.delegateCount=0,p.setup&&p.setup.call(e,o,m,f)!==!1||(e.addEventListener?e.addEventListener(g,f,!1):e.attachEvent&&e.attachEvent("on"+g,f))),p.add&&(p.add.call(e,d),d.handler.guid||(d.handler.guid=r.guid)),a?h.splice(h.delegateCount++,0,d):h.push(d),b.event.global[g]=!0;e=null}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,p,f,d,h,g,m=b.hasData(e)&&b._data(e);if(m&&(c=m.events)){t=(t||"").match(w)||[""],l=t.length;while(l--)if(s=rt.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){p=b.event.special[d]||{},d=(r?p.delegateType:p.bindType)||d,f=c[d]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=f.length;while(o--)a=f[o],!i&&g!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(f.splice(o,1),a.selector&&f.delegateCount--,p.remove&&p.remove.call(e,a));u&&!f.length&&(p.teardown&&p.teardown.call(e,h,m.handle)!==!1||b.removeEvent(e,d,m.handle),delete c[d])}else for(d in c)b.event.remove(e,d+t[l],n,r,!0);b.isEmptyObject(c)&&(delete m.handle,b._removeData(e,"events"))}},trigger:function(n,r,i,a){var s,u,l,c,p,f,d,h=[i||o],g=y.call(n,"type")?n.type:n,m=y.call(n,"namespace")?n.namespace.split("."):[];if(l=f=i=i||o,3!==i.nodeType&&8!==i.nodeType&&!nt.test(g+b.event.triggered)&&(g.indexOf(".")>=0&&(m=g.split("."),g=m.shift(),m.sort()),u=0>g.indexOf(":")&&"on"+g,n=n[b.expando]?n:new b.Event(g,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=i),r=null==r?[n]:b.makeArray(r,[n]),p=b.event.special[g]||{},a||!p.trigger||p.trigger.apply(i,r)!==!1)){if(!a&&!p.noBubble&&!b.isWindow(i)){for(c=p.delegateType||g,nt.test(c+g)||(l=l.parentNode);l;l=l.parentNode)h.push(l),f=l;f===(i.ownerDocument||o)&&h.push(f.defaultView||f.parentWindow||e)}d=0;while((l=h[d++])&&!n.isPropagationStopped())n.type=d>1?c:p.bindType||g,s=(b._data(l,"events")||{})[n.type]&&b._data(l,"handle"),s&&s.apply(l,r),s=u&&l[u],s&&b.acceptData(l)&&s.apply&&s.apply(l,r)===!1&&n.preventDefault();if(n.type=g,!(a||n.isDefaultPrevented()||p._default&&p._default.apply(i.ownerDocument,r)!==!1||"click"===g&&b.nodeName(i,"a")||!b.acceptData(i)||!u||!i[g]||b.isWindow(i))){f=i[u],f&&(i[u]=null),b.event.triggered=g;try{i[g]()}catch(v){}b.event.triggered=t,f&&(i[u]=f)}return n.result}},dispatch:function(e){e=b.event.fix(e);var n,r,i,o,a,s=[],u=h.call(arguments),l=(b._data(this,"events")||{})[e.type]||[],c=b.event.special[e.type]||{};if(u[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){s=b.event.handlers.call(this,e,l),n=0;while((o=s[n++])&&!e.isPropagationStopped()){e.currentTarget=o.elem,a=0;while((i=o.handlers[a++])&&!e.isImmediatePropagationStopped())(!e.namespace_re||e.namespace_re.test(i.namespace))&&(e.handleObj=i,e.data=i.data,r=((b.event.special[i.origType]||{}).handle||i.handler).apply(o.elem,u),r!==t&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,n){var r,i,o,a,s=[],u=n.delegateCount,l=e.target;if(u&&l.nodeType&&(!e.button||"click"!==e.type))for(;l!=this;l=l.parentNode||this)if(1===l.nodeType&&(l.disabled!==!0||"click"!==e.type)){for(o=[],a=0;u>a;a++)i=n[a],r=i.selector+" ",o[r]===t&&(o[r]=i.needsContext?b(r,this).index(l)>=0:b.find(r,this,null,[l]).length),o[r]&&o.push(i);o.length&&s.push({elem:l,handlers:o})}return n.length>u&&s.push({elem:this,handlers:n.slice(u)}),s},fix:function(e){if(e[b.expando])return e;var t,n,r,i=e.type,a=e,s=this.fixHooks[i];s||(this.fixHooks[i]=s=tt.test(i)?this.mouseHooks:et.test(i)?this.keyHooks:{}),r=s.props?this.props.concat(s.props):this.props,e=new b.Event(a),t=r.length;while(t--)n=r[t],e[n]=a[n];return e.target||(e.target=a.srcElement||o),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,i,a,s=n.button,u=n.fromElement;return null==e.pageX&&null!=n.clientX&&(i=e.target.ownerDocument||o,a=i.documentElement,r=i.body,e.pageX=n.clientX+(a&&a.scrollLeft||r&&r.scrollLeft||0)-(a&&a.clientLeft||r&&r.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||r&&r.scrollTop||0)-(a&&a.clientTop||r&&r.clientTop||0)),!e.relatedTarget&&u&&(e.relatedTarget=u===e.target?n.toElement:u),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return b.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==o.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===o.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,r){var i=b.extend(new b.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?b.event.trigger(i,null,t):b.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},b.removeEvent=o.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]===i&&(e[r]=null),e.detachEvent(r,n))},b.Event=function(e,n){return this instanceof b.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?it:ot):this.type=e,n&&b.extend(this,n),this.timeStamp=e&&e.timeStamp||b.now(),this[b.expando]=!0,t):new b.Event(e,n)},b.Event.prototype={isDefaultPrevented:ot,isPropagationStopped:ot,isImmediatePropagationStopped:ot,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=it,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=it,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=it,this.stopPropagation()}},b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){b.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;
return(!i||i!==r&&!b.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),b.support.submitBubbles||(b.event.special.submit={setup:function(){return b.nodeName(this,"form")?!1:(b.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=b.nodeName(n,"input")||b.nodeName(n,"button")?n.form:t;r&&!b._data(r,"submitBubbles")&&(b.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),b._data(r,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&b.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return b.nodeName(this,"form")?!1:(b.event.remove(this,"._submit"),t)}}),b.support.changeBubbles||(b.event.special.change={setup:function(){return Z.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(b.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),b.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),b.event.simulate("change",this,e,!0)})),!1):(b.event.add(this,"beforeactivate._change",function(e){var t=e.target;Z.test(t.nodeName)&&!b._data(t,"changeBubbles")&&(b.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||b.event.simulate("change",this.parentNode,e,!0)}),b._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return b.event.remove(this,"._change"),!Z.test(this.nodeName)}}),b.support.focusinBubbles||b.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){b.event.simulate(t,e.target,b.event.fix(e),!0)};b.event.special[t]={setup:function(){0===n++&&o.addEventListener(e,r,!0)},teardown:function(){0===--n&&o.removeEventListener(e,r,!0)}}}),b.fn.extend({on:function(e,n,r,i,o){var a,s;if("object"==typeof e){"string"!=typeof n&&(r=r||n,n=t);for(a in e)this.on(a,n,r,e[a],o);return this}if(null==r&&null==i?(i=n,r=n=t):null==i&&("string"==typeof n?(i=r,r=t):(i=r,r=n,n=t)),i===!1)i=ot;else if(!i)return this;return 1===o&&(s=i,i=function(e){return b().off(e),s.apply(this,arguments)},i.guid=s.guid||(s.guid=b.guid++)),this.each(function(){b.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,o;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,b(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if("object"==typeof e){for(o in e)this.off(o,n,e[o]);return this}return(n===!1||"function"==typeof n)&&(r=n,n=t),r===!1&&(r=ot),this.each(function(){b.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){b.event.trigger(e,t,this)})},triggerHandler:function(e,n){var r=this[0];return r?b.event.trigger(e,n,r,!0):t}}),function(e,t){var n,r,i,o,a,s,u,l,c,p,f,d,h,g,m,y,v,x="sizzle"+-new Date,w=e.document,T={},N=0,C=0,k=it(),E=it(),S=it(),A=typeof t,j=1<<31,D=[],L=D.pop,H=D.push,q=D.slice,M=D.indexOf||function(e){var t=0,n=this.length;for(;n>t;t++)if(this[t]===e)return t;return-1},_="[\\x20\\t\\r\\n\\f]",F="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=F.replace("w","w#"),B="([*^$|!~]?=)",P="\\["+_+"*("+F+")"+_+"*(?:"+B+_+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+O+")|)|)"+_+"*\\]",R=":("+F+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+P.replace(3,8)+")*)|.*)\\)|)",W=RegExp("^"+_+"+|((?:^|[^\\\\])(?:\\\\.)*)"+_+"+$","g"),$=RegExp("^"+_+"*,"+_+"*"),I=RegExp("^"+_+"*([\\x20\\t\\r\\n\\f>+~])"+_+"*"),z=RegExp(R),X=RegExp("^"+O+"$"),U={ID:RegExp("^#("+F+")"),CLASS:RegExp("^\\.("+F+")"),NAME:RegExp("^\\[name=['\"]?("+F+")['\"]?\\]"),TAG:RegExp("^("+F.replace("w","w*")+")"),ATTR:RegExp("^"+P),PSEUDO:RegExp("^"+R),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+_+"*(even|odd|(([+-]|)(\\d*)n|)"+_+"*(?:([+-]|)"+_+"*(\\d+)|))"+_+"*\\)|)","i"),needsContext:RegExp("^"+_+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+_+"*((?:-\\d)?\\d*)"+_+"*\\)|)(?=[^-]|$)","i")},V=/[\x20\t\r\n\f]*[+~]/,Y=/^[^{]+\{\s*\[native code/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,G=/^(?:input|select|textarea|button)$/i,Q=/^h\d$/i,K=/'|\\/g,Z=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,et=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,tt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{q.call(w.documentElement.childNodes,0)[0].nodeType}catch(nt){q=function(e){var t,n=[];while(t=this[e++])n.push(t);return n}}function rt(e){return Y.test(e+"")}function it(){var e,t=[];return e=function(n,r){return t.push(n+=" ")>i.cacheLength&&delete e[t.shift()],e[n]=r}}function ot(e){return e[x]=!0,e}function at(e){var t=p.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function st(e,t,n,r){var i,o,a,s,u,l,f,g,m,v;if((t?t.ownerDocument||t:w)!==p&&c(t),t=t||p,n=n||[],!e||"string"!=typeof e)return n;if(1!==(s=t.nodeType)&&9!==s)return[];if(!d&&!r){if(i=J.exec(e))if(a=i[1]){if(9===s){if(o=t.getElementById(a),!o||!o.parentNode)return n;if(o.id===a)return n.push(o),n}else if(t.ownerDocument&&(o=t.ownerDocument.getElementById(a))&&y(t,o)&&o.id===a)return n.push(o),n}else{if(i[2])return H.apply(n,q.call(t.getElementsByTagName(e),0)),n;if((a=i[3])&&T.getByClassName&&t.getElementsByClassName)return H.apply(n,q.call(t.getElementsByClassName(a),0)),n}if(T.qsa&&!h.test(e)){if(f=!0,g=x,m=t,v=9===s&&e,1===s&&"object"!==t.nodeName.toLowerCase()){l=ft(e),(f=t.getAttribute("id"))?g=f.replace(K,"\\$&"):t.setAttribute("id",g),g="[id='"+g+"'] ",u=l.length;while(u--)l[u]=g+dt(l[u]);m=V.test(e)&&t.parentNode||t,v=l.join(",")}if(v)try{return H.apply(n,q.call(m.querySelectorAll(v),0)),n}catch(b){}finally{f||t.removeAttribute("id")}}}return wt(e.replace(W,"$1"),t,n,r)}a=st.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},c=st.setDocument=function(e){var n=e?e.ownerDocument||e:w;return n!==p&&9===n.nodeType&&n.documentElement?(p=n,f=n.documentElement,d=a(n),T.tagNameNoComments=at(function(e){return e.appendChild(n.createComment("")),!e.getElementsByTagName("*").length}),T.attributes=at(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),T.getByClassName=at(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),T.getByName=at(function(e){e.id=x+0,e.innerHTML="<a name='"+x+"'></a><div name='"+x+"'></div>",f.insertBefore(e,f.firstChild);var t=n.getElementsByName&&n.getElementsByName(x).length===2+n.getElementsByName(x+0).length;return T.getIdNotName=!n.getElementById(x),f.removeChild(e),t}),i.attrHandle=at(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==A&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},T.getIdNotName?(i.find.ID=function(e,t){if(typeof t.getElementById!==A&&!d){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){return e.getAttribute("id")===t}}):(i.find.ID=function(e,n){if(typeof n.getElementById!==A&&!d){var r=n.getElementById(e);return r?r.id===e||typeof r.getAttributeNode!==A&&r.getAttributeNode("id").value===e?[r]:t:[]}},i.filter.ID=function(e){var t=e.replace(et,tt);return function(e){var n=typeof e.getAttributeNode!==A&&e.getAttributeNode("id");return n&&n.value===t}}),i.find.TAG=T.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==A?n.getElementsByTagName(e):t}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},i.find.NAME=T.getByName&&function(e,n){return typeof n.getElementsByName!==A?n.getElementsByName(name):t},i.find.CLASS=T.getByClassName&&function(e,n){return typeof n.getElementsByClassName===A||d?t:n.getElementsByClassName(e)},g=[],h=[":focus"],(T.qsa=rt(n.querySelectorAll))&&(at(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||h.push("\\["+_+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||h.push(":checked")}),at(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&h.push("[*^$]="+_+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||h.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),h.push(",.*:")})),(T.matchesSelector=rt(m=f.matchesSelector||f.mozMatchesSelector||f.webkitMatchesSelector||f.oMatchesSelector||f.msMatchesSelector))&&at(function(e){T.disconnectedMatch=m.call(e,"div"),m.call(e,"[s!='']:x"),g.push("!=",R)}),h=RegExp(h.join("|")),g=RegExp(g.join("|")),y=rt(f.contains)||f.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},v=f.compareDocumentPosition?function(e,t){var r;return e===t?(u=!0,0):(r=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&r||e.parentNode&&11===e.parentNode.nodeType?e===n||y(w,e)?-1:t===n||y(w,t)?1:0:4&r?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var r,i=0,o=e.parentNode,a=t.parentNode,s=[e],l=[t];if(e===t)return u=!0,0;if(!o||!a)return e===n?-1:t===n?1:o?-1:a?1:0;if(o===a)return ut(e,t);r=e;while(r=r.parentNode)s.unshift(r);r=t;while(r=r.parentNode)l.unshift(r);while(s[i]===l[i])i++;return i?ut(s[i],l[i]):s[i]===w?-1:l[i]===w?1:0},u=!1,[0,0].sort(v),T.detectDuplicates=u,p):p},st.matches=function(e,t){return st(e,null,null,t)},st.matchesSelector=function(e,t){if((e.ownerDocument||e)!==p&&c(e),t=t.replace(Z,"='$1']"),!(!T.matchesSelector||d||g&&g.test(t)||h.test(t)))try{var n=m.call(e,t);if(n||T.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(r){}return st(t,p,null,[e]).length>0},st.contains=function(e,t){return(e.ownerDocument||e)!==p&&c(e),y(e,t)},st.attr=function(e,t){var n;return(e.ownerDocument||e)!==p&&c(e),d||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):d||T.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},st.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},st.uniqueSort=function(e){var t,n=[],r=1,i=0;if(u=!T.detectDuplicates,e.sort(v),u){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e};function ut(e,t){var n=t&&e,r=n&&(~t.sourceIndex||j)-(~e.sourceIndex||j);if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function lt(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function ct(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function pt(e){return ot(function(t){return t=+t,ot(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}o=st.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r];r++)n+=o(t);return n},i=st.selectors={cacheLength:50,createPseudo:ot,match:U,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(et,tt),e[3]=(e[4]||e[5]||"").replace(et,tt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||st.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&st.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return U.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&z.test(n)&&(t=ft(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(et,tt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[e+" "];return t||(t=RegExp("(^|"+_+")"+e+"("+_+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==A&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=st.attr(r,e);return null==i?"!="===t:t?(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i+" ").indexOf(n)>-1:"|="===t?i===n||i.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,f,d,h,g=o!==a?"nextSibling":"previousSibling",m=t.parentNode,y=s&&t.nodeName.toLowerCase(),v=!u&&!s;if(m){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===y:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?m.firstChild:m.lastChild],a&&v){c=m[x]||(m[x]={}),l=c[e]||[],d=l[0]===N&&l[1],f=l[0]===N&&l[2],p=d&&m.childNodes[d];while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if(1===p.nodeType&&++f&&p===t){c[e]=[N,d,f];break}}else if(v&&(l=(t[x]||(t[x]={}))[e])&&l[0]===N)f=l[1];else while(p=++d&&p&&p[g]||(f=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===y:1===p.nodeType)&&++f&&(v&&((p[x]||(p[x]={}))[e]=[N,f]),p===t))break;return f-=i,f===r||0===f%r&&f/r>=0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||st.error("unsupported pseudo: "+e);return r[x]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?ot(function(e,n){var i,o=r(e,t),a=o.length;while(a--)i=M.call(e,o[a]),e[i]=!(n[i]=o[a])}):function(e){return r(e,0,n)}):r}},pseudos:{not:ot(function(e){var t=[],n=[],r=s(e.replace(W,"$1"));return r[x]?ot(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),!n.pop()}}),has:ot(function(e){return function(t){return st(e,t).length>0}}),contains:ot(function(e){return function(t){return(t.textContent||t.innerText||o(t)).indexOf(e)>-1}}),lang:ot(function(e){return X.test(e||"")||st.error("unsupported lang: "+e),e=e.replace(et,tt).toLowerCase(),function(t){var n;do if(n=d?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===f},focus:function(e){return e===p.activeElement&&(!p.hasFocus||p.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!i.pseudos.empty(e)},header:function(e){return Q.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:pt(function(){return[0]}),last:pt(function(e,t){return[t-1]}),eq:pt(function(e,t,n){return[0>n?n+t:n]}),even:pt(function(e,t){var n=0;for(;t>n;n+=2)e.push(n);return e}),odd:pt(function(e,t){var n=1;for(;t>n;n+=2)e.push(n);return e}),lt:pt(function(e,t,n){var r=0>n?n+t:n;for(;--r>=0;)e.push(r);return e}),gt:pt(function(e,t,n){var r=0>n?n+t:n;for(;t>++r;)e.push(r);return e})}};for(n in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})i.pseudos[n]=lt(n);for(n in{submit:!0,reset:!0})i.pseudos[n]=ct(n);function ft(e,t){var n,r,o,a,s,u,l,c=E[e+" "];if(c)return t?0:c.slice(0);s=e,u=[],l=i.preFilter;while(s){(!n||(r=$.exec(s)))&&(r&&(s=s.slice(r[0].length)||s),u.push(o=[])),n=!1,(r=I.exec(s))&&(n=r.shift(),o.push({value:n,type:r[0].replace(W," ")}),s=s.slice(n.length));for(a in i.filter)!(r=U[a].exec(s))||l[a]&&!(r=l[a](r))||(n=r.shift(),o.push({value:n,type:a,matches:r}),s=s.slice(n.length));if(!n)break}return t?s.length:s?st.error(e):E(e,u).slice(0)}function dt(e){var t=0,n=e.length,r="";for(;n>t;t++)r+=e[t].value;return r}function ht(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=C++;return t.first?function(t,n,r){while(t=t[i])if(1===t.nodeType||o)return e(t,n,r)}:function(t,n,s){var u,l,c,p=N+" "+a;if(s){while(t=t[i])if((1===t.nodeType||o)&&e(t,n,s))return!0}else while(t=t[i])if(1===t.nodeType||o)if(c=t[x]||(t[x]={}),(l=c[i])&&l[0]===p){if((u=l[1])===!0||u===r)return u===!0}else if(l=c[i]=[p],l[1]=e(t,n,s)||r,l[1]===!0)return!0}}function gt(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function mt(e,t,n,r,i){var o,a=[],s=0,u=e.length,l=null!=t;for(;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),l&&t.push(s));return a}function yt(e,t,n,r,i,o){return r&&!r[x]&&(r=yt(r)),i&&!i[x]&&(i=yt(i,o)),ot(function(o,a,s,u){var l,c,p,f=[],d=[],h=a.length,g=o||xt(t||"*",s.nodeType?[s]:s,[]),m=!e||!o&&t?g:mt(g,f,e,s,u),y=n?i||(o?e:h||r)?[]:a:m;if(n&&n(m,y,s,u),r){l=mt(y,d),r(l,[],s,u),c=l.length;while(c--)(p=l[c])&&(y[d[c]]=!(m[d[c]]=p))}if(o){if(i||e){if(i){l=[],c=y.length;while(c--)(p=y[c])&&l.push(m[c]=p);i(null,y=[],l,u)}c=y.length;while(c--)(p=y[c])&&(l=i?M.call(o,p):f[c])>-1&&(o[l]=!(a[l]=p))}}else y=mt(y===a?y.splice(h,y.length):y),i?i(null,a,y,u):H.apply(a,y)})}function vt(e){var t,n,r,o=e.length,a=i.relative[e[0].type],s=a||i.relative[" "],u=a?1:0,c=ht(function(e){return e===t},s,!0),p=ht(function(e){return M.call(t,e)>-1},s,!0),f=[function(e,n,r){return!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):p(e,n,r))}];for(;o>u;u++)if(n=i.relative[e[u].type])f=[ht(gt(f),n)];else{if(n=i.filter[e[u].type].apply(null,e[u].matches),n[x]){for(r=++u;o>r;r++)if(i.relative[e[r].type])break;return yt(u>1&>(f),u>1&&dt(e.slice(0,u-1)).replace(W,"$1"),n,r>u&&vt(e.slice(u,r)),o>r&&vt(e=e.slice(r)),o>r&&dt(e))}f.push(n)}return gt(f)}function bt(e,t){var n=0,o=t.length>0,a=e.length>0,s=function(s,u,c,f,d){var h,g,m,y=[],v=0,b="0",x=s&&[],w=null!=d,T=l,C=s||a&&i.find.TAG("*",d&&u.parentNode||u),k=N+=null==T?1:Math.random()||.1;for(w&&(l=u!==p&&u,r=n);null!=(h=C[b]);b++){if(a&&h){g=0;while(m=e[g++])if(m(h,u,c)){f.push(h);break}w&&(N=k,r=++n)}o&&((h=!m&&h)&&v--,s&&x.push(h))}if(v+=b,o&&b!==v){g=0;while(m=t[g++])m(x,y,u,c);if(s){if(v>0)while(b--)x[b]||y[b]||(y[b]=L.call(f));y=mt(y)}H.apply(f,y),w&&!s&&y.length>0&&v+t.length>1&&st.uniqueSort(f)}return w&&(N=k,l=T),x};return o?ot(s):s}s=st.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=ft(e)),n=t.length;while(n--)o=vt(t[n]),o[x]?r.push(o):i.push(o);o=S(e,bt(i,r))}return o};function xt(e,t,n){var r=0,i=t.length;for(;i>r;r++)st(e,t[r],n);return n}function wt(e,t,n,r){var o,a,u,l,c,p=ft(e);if(!r&&1===p.length){if(a=p[0]=p[0].slice(0),a.length>2&&"ID"===(u=a[0]).type&&9===t.nodeType&&!d&&i.relative[a[1].type]){if(t=i.find.ID(u.matches[0].replace(et,tt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}o=U.needsContext.test(e)?0:a.length;while(o--){if(u=a[o],i.relative[l=u.type])break;if((c=i.find[l])&&(r=c(u.matches[0].replace(et,tt),V.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=r.length&&dt(a),!e)return H.apply(n,q.call(r,0)),n;break}}}return s(e,p)(r,t,d,n,V.test(e)),n}i.pseudos.nth=i.pseudos.eq;function Tt(){}i.filters=Tt.prototype=i.pseudos,i.setFilters=new Tt,c(),st.attr=b.attr,b.find=st,b.expr=st.selectors,b.expr[":"]=b.expr.pseudos,b.unique=st.uniqueSort,b.text=st.getText,b.isXMLDoc=st.isXML,b.contains=st.contains}(e);var at=/Until$/,st=/^(?:parents|prev(?:Until|All))/,ut=/^.[^:#\[\.,]*$/,lt=b.expr.match.needsContext,ct={children:!0,contents:!0,next:!0,prev:!0};b.fn.extend({find:function(e){var t,n,r,i=this.length;if("string"!=typeof e)return r=this,this.pushStack(b(e).filter(function(){for(t=0;i>t;t++)if(b.contains(r[t],this))return!0}));for(n=[],t=0;i>t;t++)b.find(e,this[t],n);return n=this.pushStack(i>1?b.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=b(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(b.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1))},filter:function(e){return this.pushStack(ft(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?lt.test(e)?b(e,this.context).index(this[0])>=0:b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,o=[],a=lt.test(e)||"string"!=typeof e?b(e,t||this.context):0;for(;i>r;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&11!==n.nodeType){if(a?a.index(n)>-1:b.find.matchesSelector(n,e)){o.push(n);break}n=n.parentNode}}return this.pushStack(o.length>1?b.unique(o):o)},index:function(e){return e?"string"==typeof e?b.inArray(this[0],b(e)):b.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?b(e,t):b.makeArray(e&&e.nodeType?[e]:e),r=b.merge(this.get(),n);return this.pushStack(b.unique(r))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),b.fn.andSelf=b.fn.addBack;function pt(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}b.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(e,t,n){return b.dir(e,"parentNode",n)},next:function(e){return pt(e,"nextSibling")},prev:function(e){return pt(e,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(e,t,n){return b.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return b.dir(e,"previousSibling",n)},siblings:function(e){return b.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.merge([],e.childNodes)}},function(e,t){b.fn[e]=function(n,r){var i=b.map(this,t,n);return at.test(e)||(r=n),r&&"string"==typeof r&&(i=b.filter(r,i)),i=this.length>1&&!ct[e]?b.unique(i):i,this.length>1&&st.test(e)&&(i=i.reverse()),this.pushStack(i)}}),b.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?b.find.matchesSelector(t[0],e)?[t[0]]:[]:b.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&9!==o.nodeType&&(r===t||1!==o.nodeType||!b(o).is(r)))1===o.nodeType&&i.push(o),o=o[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});function ft(e,t,n){if(t=t||0,b.isFunction(t))return b.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return b.grep(e,function(e){return e===t===n});if("string"==typeof t){var r=b.grep(e,function(e){return 1===e.nodeType});if(ut.test(t))return b.filter(t,r,!n);t=b.filter(t,r)}return b.grep(e,function(e){return b.inArray(e,t)>=0===n})}function dt(e){var t=ht.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}var ht="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",gt=/ jQuery\d+="(?:null|\d+)"/g,mt=RegExp("<(?:"+ht+")[\\s/>]","i"),yt=/^\s+/,vt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bt=/<([\w:]+)/,xt=/<tbody/i,wt=/<|&#?\w+;/,Tt=/<(?:script|style|link)/i,Nt=/^(?:checkbox|radio)$/i,Ct=/checked\s*(?:[^=]|=\s*.checked.)/i,kt=/^$|\/(?:java|ecma)script/i,Et=/^true\/(.*)/,St=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,At={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:b.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},jt=dt(o),Dt=jt.appendChild(o.createElement("div"));At.optgroup=At.option,At.tbody=At.tfoot=At.colgroup=At.caption=At.thead,At.th=At.td,b.fn.extend({text:function(e){return b.access(this,function(e){return e===t?b.text(this):this.empty().append((this[0]&&this[0].ownerDocument||o).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(b.isFunction(e))return this.each(function(t){b(this).wrapAll(e.call(this,t))});if(this[0]){var t=b(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&1===e.firstChild.nodeType)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return b.isFunction(e)?this.each(function(t){b(this).wrapInner(e.call(this,t))}):this.each(function(){var t=b(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=b.isFunction(e);return this.each(function(n){b(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){b.nodeName(this,"body")||b(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){var n,r=0;for(;null!=(n=this[r]);r++)(!e||b.filter(e,[n]).length>0)&&(t||1!==n.nodeType||b.cleanData(Ot(n)),n.parentNode&&(t&&b.contains(n.ownerDocument,n)&&Mt(Ot(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){var e,t=0;for(;null!=(e=this[t]);t++){1===e.nodeType&&b.cleanData(Ot(e,!1));while(e.firstChild)e.removeChild(e.firstChild);e.options&&b.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return b.clone(this,e,t)})},html:function(e){return b.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(gt,""):t;if(!("string"!=typeof e||Tt.test(e)||!b.support.htmlSerialize&&mt.test(e)||!b.support.leadingWhitespace&&yt.test(e)||At[(bt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(vt,"<$1></$2>");try{for(;i>r;r++)n=this[r]||{},1===n.nodeType&&(b.cleanData(Ot(n,!1)),n.innerHTML=e);n=0}catch(o){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=b.isFunction(e);return t||"string"==typeof e||(e=b(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(b(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=f.apply([],e);var i,o,a,s,u,l,c=0,p=this.length,d=this,h=p-1,g=e[0],m=b.isFunction(g);if(m||!(1>=p||"string"!=typeof g||b.support.checkClone)&&Ct.test(g))return this.each(function(i){var o=d.eq(i);m&&(e[0]=g.call(this,i,n?o.html():t)),o.domManip(e,n,r)});if(p&&(l=b.buildFragment(e,this[0].ownerDocument,!1,this),i=l.firstChild,1===l.childNodes.length&&(l=i),i)){for(n=n&&b.nodeName(i,"tr"),s=b.map(Ot(l,"script"),Ht),a=s.length;p>c;c++)o=l,c!==h&&(o=b.clone(o,!0,!0),a&&b.merge(s,Ot(o,"script"))),r.call(n&&b.nodeName(this[c],"table")?Lt(this[c],"tbody"):this[c],o,c);if(a)for(u=s[s.length-1].ownerDocument,b.map(s,qt),c=0;a>c;c++)o=s[c],kt.test(o.type||"")&&!b._data(o,"globalEval")&&b.contains(u,o)&&(o.src?b.ajax({url:o.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):b.globalEval((o.text||o.textContent||o.innerHTML||"").replace(St,"")));l=i=null}return this}});function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function Ht(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function qt(e){var t=Et.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function Mt(e,t){var n,r=0;for(;null!=(n=e[r]);r++)b._data(n,"globalEval",!t||b._data(t[r],"globalEval"))}function _t(e,t){if(1===t.nodeType&&b.hasData(e)){var n,r,i,o=b._data(e),a=b._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)b.event.add(t,n,s[n][r])}a.data&&(a.data=b.extend({},a.data))}}function Ft(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!b.support.noCloneEvent&&t[b.expando]){i=b._data(t);for(r in i.events)b.removeEvent(t,r,i.handle);t.removeAttribute(b.expando)}"script"===n&&t.text!==e.text?(Ht(t).text=e.text,qt(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),b.support.html5Clone&&e.innerHTML&&!b.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Nt.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){b.fn[e]=function(e){var n,r=0,i=[],o=b(e),a=o.length-1;for(;a>=r;r++)n=r===a?this:this.clone(!0),b(o[r])[t](n),d.apply(i,n.get());return this.pushStack(i)}});function Ot(e,n){var r,o,a=0,s=typeof e.getElementsByTagName!==i?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==i?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],r=e.childNodes||e;null!=(o=r[a]);a++)!n||b.nodeName(o,n)?s.push(o):b.merge(s,Ot(o,n));return n===t||n&&b.nodeName(e,n)?b.merge([e],s):s}function Bt(e){Nt.test(e.type)&&(e.defaultChecked=e.checked)}b.extend({clone:function(e,t,n){var r,i,o,a,s,u=b.contains(e.ownerDocument,e);if(b.support.html5Clone||b.isXMLDoc(e)||!mt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(Dt.innerHTML=e.outerHTML,Dt.removeChild(o=Dt.firstChild)),!(b.support.noCloneEvent&&b.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||b.isXMLDoc(e)))for(r=Ot(o),s=Ot(e),a=0;null!=(i=s[a]);++a)r[a]&&Ft(i,r[a]);if(t)if(n)for(s=s||Ot(e),r=r||Ot(o),a=0;null!=(i=s[a]);a++)_t(i,r[a]);else _t(e,o);return r=Ot(o,"script"),r.length>0&&Mt(r,!u&&Ot(e,"script")),r=s=i=null,o},buildFragment:function(e,t,n,r){var i,o,a,s,u,l,c,p=e.length,f=dt(t),d=[],h=0;for(;p>h;h++)if(o=e[h],o||0===o)if("object"===b.type(o))b.merge(d,o.nodeType?[o]:o);else if(wt.test(o)){s=s||f.appendChild(t.createElement("div")),u=(bt.exec(o)||["",""])[1].toLowerCase(),c=At[u]||At._default,s.innerHTML=c[1]+o.replace(vt,"<$1></$2>")+c[2],i=c[0];while(i--)s=s.lastChild;if(!b.support.leadingWhitespace&&yt.test(o)&&d.push(t.createTextNode(yt.exec(o)[0])),!b.support.tbody){o="table"!==u||xt.test(o)?"<table>"!==c[1]||xt.test(o)?0:s:s.firstChild,i=o&&o.childNodes.length;while(i--)b.nodeName(l=o.childNodes[i],"tbody")&&!l.childNodes.length&&o.removeChild(l)
}b.merge(d,s.childNodes),s.textContent="";while(s.firstChild)s.removeChild(s.firstChild);s=f.lastChild}else d.push(t.createTextNode(o));s&&f.removeChild(s),b.support.appendChecked||b.grep(Ot(d,"input"),Bt),h=0;while(o=d[h++])if((!r||-1===b.inArray(o,r))&&(a=b.contains(o.ownerDocument,o),s=Ot(f.appendChild(o),"script"),a&&Mt(s),n)){i=0;while(o=s[i++])kt.test(o.type||"")&&n.push(o)}return s=null,f},cleanData:function(e,t){var n,r,o,a,s=0,u=b.expando,l=b.cache,p=b.support.deleteExpando,f=b.event.special;for(;null!=(n=e[s]);s++)if((t||b.acceptData(n))&&(o=n[u],a=o&&l[o])){if(a.events)for(r in a.events)f[r]?b.event.remove(n,r):b.removeEvent(n,r,a.handle);l[o]&&(delete l[o],p?delete n[u]:typeof n.removeAttribute!==i?n.removeAttribute(u):n[u]=null,c.push(o))}}});var Pt,Rt,Wt,$t=/alpha\([^)]*\)/i,It=/opacity\s*=\s*([^)]*)/,zt=/^(top|right|bottom|left)$/,Xt=/^(none|table(?!-c[ea]).+)/,Ut=/^margin/,Vt=RegExp("^("+x+")(.*)$","i"),Yt=RegExp("^("+x+")(?!px)[a-z%]+$","i"),Jt=RegExp("^([+-])=("+x+")","i"),Gt={BODY:"block"},Qt={position:"absolute",visibility:"hidden",display:"block"},Kt={letterSpacing:0,fontWeight:400},Zt=["Top","Right","Bottom","Left"],en=["Webkit","O","Moz","ms"];function tn(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=en.length;while(i--)if(t=en[i]+n,t in e)return t;return r}function nn(e,t){return e=t||e,"none"===b.css(e,"display")||!b.contains(e.ownerDocument,e)}function rn(e,t){var n,r,i,o=[],a=0,s=e.length;for(;s>a;a++)r=e[a],r.style&&(o[a]=b._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&nn(r)&&(o[a]=b._data(r,"olddisplay",un(r.nodeName)))):o[a]||(i=nn(r),(n&&"none"!==n||!i)&&b._data(r,"olddisplay",i?n:b.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}b.fn.extend({css:function(e,n){return b.access(this,function(e,n,r){var i,o,a={},s=0;if(b.isArray(n)){for(o=Rt(e),i=n.length;i>s;s++)a[n[s]]=b.css(e,n[s],!1,o);return a}return r!==t?b.style(e,n,r):b.css(e,n)},e,n,arguments.length>1)},show:function(){return rn(this,!0)},hide:function(){return rn(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:nn(this))?b(this).show():b(this).hide()})}}),b.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Wt(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,u=b.camelCase(n),l=e.style;if(n=b.cssProps[u]||(b.cssProps[u]=tn(l,u)),s=b.cssHooks[n]||b.cssHooks[u],r===t)return s&&"get"in s&&(o=s.get(e,!1,i))!==t?o:l[n];if(a=typeof r,"string"===a&&(o=Jt.exec(r))&&(r=(o[1]+1)*o[2]+parseFloat(b.css(e,n)),a="number"),!(null==r||"number"===a&&isNaN(r)||("number"!==a||b.cssNumber[u]||(r+="px"),b.support.clearCloneStyle||""!==r||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(r=s.set(e,r,i))===t)))try{l[n]=r}catch(c){}}},css:function(e,n,r,i){var o,a,s,u=b.camelCase(n);return n=b.cssProps[u]||(b.cssProps[u]=tn(e.style,u)),s=b.cssHooks[n]||b.cssHooks[u],s&&"get"in s&&(a=s.get(e,!0,r)),a===t&&(a=Wt(e,n,i)),"normal"===a&&n in Kt&&(a=Kt[n]),""===r||r?(o=parseFloat(a),r===!0||b.isNumeric(o)?o||0:a):a},swap:function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i}}),e.getComputedStyle?(Rt=function(t){return e.getComputedStyle(t,null)},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==u||b.contains(e.ownerDocument,e)||(u=b.style(e,n)),Yt.test(u)&&Ut.test(n)&&(i=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=u,u=s.width,l.width=i,l.minWidth=o,l.maxWidth=a)),u}):o.documentElement.currentStyle&&(Rt=function(e){return e.currentStyle},Wt=function(e,n,r){var i,o,a,s=r||Rt(e),u=s?s[n]:t,l=e.style;return null==u&&l&&l[n]&&(u=l[n]),Yt.test(u)&&!zt.test(n)&&(i=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":u,u=l.pixelLeft+"px",l.left=i,a&&(o.left=a)),""===u?"auto":u});function on(e,t,n){var r=Vt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function an(e,t,n,r,i){var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;for(;4>o;o+=2)"margin"===n&&(a+=b.css(e,n+Zt[o],!0,i)),r?("content"===n&&(a-=b.css(e,"padding"+Zt[o],!0,i)),"margin"!==n&&(a-=b.css(e,"border"+Zt[o]+"Width",!0,i))):(a+=b.css(e,"padding"+Zt[o],!0,i),"padding"!==n&&(a+=b.css(e,"border"+Zt[o]+"Width",!0,i)));return a}function sn(e,t,n){var r=!0,i="width"===t?e.offsetWidth:e.offsetHeight,o=Rt(e),a=b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,o);if(0>=i||null==i){if(i=Wt(e,t,o),(0>i||null==i)&&(i=e.style[t]),Yt.test(i))return i;r=a&&(b.support.boxSizingReliable||i===e.style[t]),i=parseFloat(i)||0}return i+an(e,t,n||(a?"border":"content"),r,o)+"px"}function un(e){var t=o,n=Gt[e];return n||(n=ln(e,t),"none"!==n&&n||(Pt=(Pt||b("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(Pt[0].contentWindow||Pt[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=ln(e,t),Pt.detach()),Gt[e]=n),n}function ln(e,t){var n=b(t.createElement(e)).appendTo(t.body),r=b.css(n[0],"display");return n.remove(),r}b.each(["height","width"],function(e,n){b.cssHooks[n]={get:function(e,r,i){return r?0===e.offsetWidth&&Xt.test(b.css(e,"display"))?b.swap(e,Qt,function(){return sn(e,n,i)}):sn(e,n,i):t},set:function(e,t,r){var i=r&&Rt(e);return on(e,t,r?an(e,n,r,b.support.boxSizing&&"border-box"===b.css(e,"boxSizing",!1,i),i):0)}}}),b.support.opacity||(b.cssHooks.opacity={get:function(e,t){return It.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=b.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===b.trim(o.replace($t,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=$t.test(o)?o.replace($t,i):o+" "+i)}}),b(function(){b.support.reliableMarginRight||(b.cssHooks.marginRight={get:function(e,n){return n?b.swap(e,{display:"inline-block"},Wt,[e,"marginRight"]):t}}),!b.support.pixelPosition&&b.fn.position&&b.each(["top","left"],function(e,n){b.cssHooks[n]={get:function(e,r){return r?(r=Wt(e,n),Yt.test(r)?b(e).position()[n]+"px":r):t}}})}),b.expr&&b.expr.filters&&(b.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!b.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||b.css(e,"display"))},b.expr.filters.visible=function(e){return!b.expr.filters.hidden(e)}),b.each({margin:"",padding:"",border:"Width"},function(e,t){b.cssHooks[e+t]={expand:function(n){var r=0,i={},o="string"==typeof n?n.split(" "):[n];for(;4>r;r++)i[e+Zt[r]+t]=o[r]||o[r-2]||o[0];return i}},Ut.test(e)||(b.cssHooks[e+t].set=on)});var cn=/%20/g,pn=/\[\]$/,fn=/\r?\n/g,dn=/^(?:submit|button|image|reset|file)$/i,hn=/^(?:input|select|textarea|keygen)/i;b.fn.extend({serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=b.prop(this,"elements");return e?b.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!b(this).is(":disabled")&&hn.test(this.nodeName)&&!dn.test(e)&&(this.checked||!Nt.test(e))}).map(function(e,t){var n=b(this).val();return null==n?null:b.isArray(n)?b.map(n,function(e){return{name:t.name,value:e.replace(fn,"\r\n")}}):{name:t.name,value:n.replace(fn,"\r\n")}}).get()}}),b.param=function(e,n){var r,i=[],o=function(e,t){t=b.isFunction(t)?t():null==t?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=b.ajaxSettings&&b.ajaxSettings.traditional),b.isArray(e)||e.jquery&&!b.isPlainObject(e))b.each(e,function(){o(this.name,this.value)});else for(r in e)gn(r,e[r],n,o);return i.join("&").replace(cn,"+")};function gn(e,t,n,r){var i;if(b.isArray(t))b.each(t,function(t,i){n||pn.test(e)?r(e,i):gn(e+"["+("object"==typeof i?t:"")+"]",i,n,r)});else if(n||"object"!==b.type(t))r(e,t);else for(i in t)gn(e+"["+i+"]",t[i],n,r)}b.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){b.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),b.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var mn,yn,vn=b.now(),bn=/\?/,xn=/#.*$/,wn=/([?&])_=[^&]*/,Tn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Nn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Cn=/^(?:GET|HEAD)$/,kn=/^\/\//,En=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Sn=b.fn.load,An={},jn={},Dn="*/".concat("*");try{yn=a.href}catch(Ln){yn=o.createElement("a"),yn.href="",yn=yn.href}mn=En.exec(yn.toLowerCase())||[];function Hn(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(w)||[];if(b.isFunction(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function qn(e,n,r,i){var o={},a=e===jn;function s(u){var l;return o[u]=!0,b.each(e[u]||[],function(e,u){var c=u(n,r,i);return"string"!=typeof c||a||o[c]?a?!(l=c):t:(n.dataTypes.unshift(c),s(c),!1)}),l}return s(n.dataTypes[0])||!o["*"]&&s("*")}function Mn(e,n){var r,i,o=b.ajaxSettings.flatOptions||{};for(i in n)n[i]!==t&&((o[i]?e:r||(r={}))[i]=n[i]);return r&&b.extend(!0,e,r),e}b.fn.load=function(e,n,r){if("string"!=typeof e&&Sn)return Sn.apply(this,arguments);var i,o,a,s=this,u=e.indexOf(" ");return u>=0&&(i=e.slice(u,e.length),e=e.slice(0,u)),b.isFunction(n)?(r=n,n=t):n&&"object"==typeof n&&(a="POST"),s.length>0&&b.ajax({url:e,type:a,dataType:"html",data:n}).done(function(e){o=arguments,s.html(i?b("<div>").append(b.parseHTML(e)).find(i):e)}).complete(r&&function(e,t){s.each(r,o||[e.responseText,t,e])}),this},b.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){b.fn[t]=function(e){return this.on(t,e)}}),b.each(["get","post"],function(e,n){b[n]=function(e,r,i,o){return b.isFunction(r)&&(o=o||i,i=r,r=t),b.ajax({url:e,type:n,dataType:o,data:r,success:i})}}),b.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:yn,type:"GET",isLocal:Nn.test(mn[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?Mn(Mn(e,b.ajaxSettings),t):Mn(b.ajaxSettings,e)},ajaxPrefilter:Hn(An),ajaxTransport:Hn(jn),ajax:function(e,n){"object"==typeof e&&(n=e,e=t),n=n||{};var r,i,o,a,s,u,l,c,p=b.ajaxSetup({},n),f=p.context||p,d=p.context&&(f.nodeType||f.jquery)?b(f):b.event,h=b.Deferred(),g=b.Callbacks("once memory"),m=p.statusCode||{},y={},v={},x=0,T="canceled",N={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!c){c={};while(t=Tn.exec(a))c[t[1].toLowerCase()]=t[2]}t=c[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?a:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=v[n]=v[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)m[t]=[m[t],e[t]];else N.always(e[N.status]);return this},abort:function(e){var t=e||T;return l&&l.abort(t),k(0,t),this}};if(h.promise(N).complete=g.add,N.success=N.done,N.error=N.fail,p.url=((e||p.url||yn)+"").replace(xn,"").replace(kn,mn[1]+"//"),p.type=n.method||n.type||p.method||p.type,p.dataTypes=b.trim(p.dataType||"*").toLowerCase().match(w)||[""],null==p.crossDomain&&(r=En.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===mn[1]&&r[2]===mn[2]&&(r[3]||("http:"===r[1]?80:443))==(mn[3]||("http:"===mn[1]?80:443)))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=b.param(p.data,p.traditional)),qn(An,p,n,N),2===x)return N;u=p.global,u&&0===b.active++&&b.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Cn.test(p.type),o=p.url,p.hasContent||(p.data&&(o=p.url+=(bn.test(o)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=wn.test(o)?o.replace(wn,"$1_="+vn++):o+(bn.test(o)?"&":"?")+"_="+vn++)),p.ifModified&&(b.lastModified[o]&&N.setRequestHeader("If-Modified-Since",b.lastModified[o]),b.etag[o]&&N.setRequestHeader("If-None-Match",b.etag[o])),(p.data&&p.hasContent&&p.contentType!==!1||n.contentType)&&N.setRequestHeader("Content-Type",p.contentType),N.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+Dn+"; q=0.01":""):p.accepts["*"]);for(i in p.headers)N.setRequestHeader(i,p.headers[i]);if(p.beforeSend&&(p.beforeSend.call(f,N,p)===!1||2===x))return N.abort();T="abort";for(i in{success:1,error:1,complete:1})N[i](p[i]);if(l=qn(jn,p,n,N)){N.readyState=1,u&&d.trigger("ajaxSend",[N,p]),p.async&&p.timeout>0&&(s=setTimeout(function(){N.abort("timeout")},p.timeout));try{x=1,l.send(y,k)}catch(C){if(!(2>x))throw C;k(-1,C)}}else k(-1,"No Transport");function k(e,n,r,i){var c,y,v,w,T,C=n;2!==x&&(x=2,s&&clearTimeout(s),l=t,a=i||"",N.readyState=e>0?4:0,r&&(w=_n(p,N,r)),e>=200&&300>e||304===e?(p.ifModified&&(T=N.getResponseHeader("Last-Modified"),T&&(b.lastModified[o]=T),T=N.getResponseHeader("etag"),T&&(b.etag[o]=T)),204===e?(c=!0,C="nocontent"):304===e?(c=!0,C="notmodified"):(c=Fn(p,w),C=c.state,y=c.data,v=c.error,c=!v)):(v=C,(e||!C)&&(C="error",0>e&&(e=0))),N.status=e,N.statusText=(n||C)+"",c?h.resolveWith(f,[y,C,N]):h.rejectWith(f,[N,C,v]),N.statusCode(m),m=t,u&&d.trigger(c?"ajaxSuccess":"ajaxError",[N,p,c?y:v]),g.fireWith(f,[N,C]),u&&(d.trigger("ajaxComplete",[N,p]),--b.active||b.event.trigger("ajaxStop")))}return N},getScript:function(e,n){return b.get(e,t,n,"script")},getJSON:function(e,t,n){return b.get(e,t,n,"json")}});function _n(e,n,r){var i,o,a,s,u=e.contents,l=e.dataTypes,c=e.responseFields;for(s in c)s in r&&(n[c[s]]=r[s]);while("*"===l[0])l.shift(),o===t&&(o=e.mimeType||n.getResponseHeader("Content-Type"));if(o)for(s in u)if(u[s]&&u[s].test(o)){l.unshift(s);break}if(l[0]in r)a=l[0];else{for(s in r){if(!l[0]||e.converters[s+" "+l[0]]){a=s;break}i||(i=s)}a=a||i}return a?(a!==l[0]&&l.unshift(a),r[a]):t}function Fn(e,t){var n,r,i,o,a={},s=0,u=e.dataTypes.slice(),l=u[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u[1])for(i in e.converters)a[i.toLowerCase()]=e.converters[i];for(;r=u[++s];)if("*"!==r){if("*"!==l&&l!==r){if(i=a[l+" "+r]||a["* "+r],!i)for(n in a)if(o=n.split(" "),o[1]===r&&(i=a[l+" "+o[0]]||a["* "+o[0]])){i===!0?i=a[n]:a[n]!==!0&&(r=o[0],u.splice(s--,0,r));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(c){return{state:"parsererror",error:i?c:"No conversion from "+l+" to "+r}}}l=r}return{state:"success",data:t}}b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return b.globalEval(e),e}}}),b.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),b.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=o.head||b("head")[0]||o.documentElement;return{send:function(t,i){n=o.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||i(200,"success"))},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var On=[],Bn=/(=)\?(?=&|$)|\?\?/;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=On.pop()||b.expando+"_"+vn++;return this[e]=!0,e}}),b.ajaxPrefilter("json jsonp",function(n,r,i){var o,a,s,u=n.jsonp!==!1&&(Bn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Bn.test(n.data)&&"data");return u||"jsonp"===n.dataTypes[0]?(o=n.jsonpCallback=b.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,u?n[u]=n[u].replace(Bn,"$1"+o):n.jsonp!==!1&&(n.url+=(bn.test(n.url)?"&":"?")+n.jsonp+"="+o),n.converters["script json"]=function(){return s||b.error(o+" was not called"),s[0]},n.dataTypes[0]="json",a=e[o],e[o]=function(){s=arguments},i.always(function(){e[o]=a,n[o]&&(n.jsonpCallback=r.jsonpCallback,On.push(o)),s&&b.isFunction(a)&&a(s[0]),s=a=t}),"script"):t});var Pn,Rn,Wn=0,$n=e.ActiveXObject&&function(){var e;for(e in Pn)Pn[e](t,!0)};function In(){try{return new e.XMLHttpRequest}catch(t){}}function zn(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}b.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&In()||zn()}:In,Rn=b.ajaxSettings.xhr(),b.support.cors=!!Rn&&"withCredentials"in Rn,Rn=b.support.ajax=!!Rn,Rn&&b.ajaxTransport(function(n){if(!n.crossDomain||b.support.cors){var r;return{send:function(i,o){var a,s,u=n.xhr();if(n.username?u.open(n.type,n.url,n.async,n.username,n.password):u.open(n.type,n.url,n.async),n.xhrFields)for(s in n.xhrFields)u[s]=n.xhrFields[s];n.mimeType&&u.overrideMimeType&&u.overrideMimeType(n.mimeType),n.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");try{for(s in i)u.setRequestHeader(s,i[s])}catch(l){}u.send(n.hasContent&&n.data||null),r=function(e,i){var s,l,c,p;try{if(r&&(i||4===u.readyState))if(r=t,a&&(u.onreadystatechange=b.noop,$n&&delete Pn[a]),i)4!==u.readyState&&u.abort();else{p={},s=u.status,l=u.getAllResponseHeaders(),"string"==typeof u.responseText&&(p.text=u.responseText);try{c=u.statusText}catch(f){c=""}s||!n.isLocal||n.crossDomain?1223===s&&(s=204):s=p.text?200:404}}catch(d){i||o(-1,d)}p&&o(s,c,p,l)},n.async?4===u.readyState?setTimeout(r):(a=++Wn,$n&&(Pn||(Pn={},b(e).unload($n)),Pn[a]=r),u.onreadystatechange=r):r()},abort:function(){r&&r(t,!0)}}}});var Xn,Un,Vn=/^(?:toggle|show|hide)$/,Yn=RegExp("^(?:([+-])=|)("+x+")([a-z%]*)$","i"),Jn=/queueHooks$/,Gn=[nr],Qn={"*":[function(e,t){var n,r,i=this.createTween(e,t),o=Yn.exec(t),a=i.cur(),s=+a||0,u=1,l=20;if(o){if(n=+o[2],r=o[3]||(b.cssNumber[e]?"":"px"),"px"!==r&&s){s=b.css(i.elem,e,!0)||n||1;do u=u||".5",s/=u,b.style(i.elem,e,s+r);while(u!==(u=i.cur()/a)&&1!==u&&--l)}i.unit=r,i.start=s,i.end=o[1]?s+(o[1]+1)*n:n}return i}]};function Kn(){return setTimeout(function(){Xn=t}),Xn=b.now()}function Zn(e,t){b.each(t,function(t,n){var r=(Qn[t]||[]).concat(Qn["*"]),i=0,o=r.length;for(;o>i;i++)if(r[i].call(e,t,n))return})}function er(e,t,n){var r,i,o=0,a=Gn.length,s=b.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;var t=Xn||Kn(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,o=1-r,a=0,u=l.tweens.length;for(;u>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&u?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:b.extend({},t),opts:b.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Xn||Kn(),duration:n.duration,tweens:[],createTween:function(t,n){var r=b.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),c=l.props;for(tr(c,l.opts.specialEasing);a>o;o++)if(r=Gn[o].call(l,e,c,l.opts))return r;return Zn(l,c),b.isFunction(l.opts.start)&&l.opts.start.call(e,l),b.fx.timer(b.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function tr(e,t){var n,r,i,o,a;for(i in e)if(r=b.camelCase(i),o=t[r],n=e[i],b.isArray(n)&&(o=n[1],n=e[i]=n[0]),i!==r&&(e[r]=n,delete e[i]),a=b.cssHooks[r],a&&"expand"in a){n=a.expand(n),delete e[r];for(i in n)i in e||(e[i]=n[i],t[i]=o)}else t[r]=o}b.Animation=b.extend(er,{tweener:function(e,t){b.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;i>r;r++)n=e[r],Qn[n]=Qn[n]||[],Qn[n].unshift(t)},prefilter:function(e,t){t?Gn.unshift(e):Gn.push(e)}});function nr(e,t,n){var r,i,o,a,s,u,l,c,p,f=this,d=e.style,h={},g=[],m=e.nodeType&&nn(e);n.queue||(c=b._queueHooks(e,"fx"),null==c.unqueued&&(c.unqueued=0,p=c.empty.fire,c.empty.fire=function(){c.unqueued||p()}),c.unqueued++,f.always(function(){f.always(function(){c.unqueued--,b.queue(e,"fx").length||c.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],"inline"===b.css(e,"display")&&"none"===b.css(e,"float")&&(b.support.inlineBlockNeedsLayout&&"inline"!==un(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",b.support.shrinkWrapBlocks||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(i in t)if(a=t[i],Vn.exec(a)){if(delete t[i],u=u||"toggle"===a,a===(m?"hide":"show"))continue;g.push(i)}if(o=g.length){s=b._data(e,"fxshow")||b._data(e,"fxshow",{}),"hidden"in s&&(m=s.hidden),u&&(s.hidden=!m),m?b(e).show():f.done(function(){b(e).hide()}),f.done(function(){var t;b._removeData(e,"fxshow");for(t in h)b.style(e,t,h[t])});for(i=0;o>i;i++)r=g[i],l=f.createTween(r,m?s[r]:0),h[r]=s[r]||b.style(e,r),r in s||(s[r]=l.start,m&&(l.end=l.start,l.start="width"===r||"height"===r?1:0))}}function rr(e,t,n,r,i){return new rr.prototype.init(e,t,n,r,i)}b.Tween=rr,rr.prototype={constructor:rr,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(b.cssNumber[n]?"":"px")},cur:function(){var e=rr.propHooks[this.prop];return e&&e.get?e.get(this):rr.propHooks._default.get(this)},run:function(e){var t,n=rr.propHooks[this.prop];return this.pos=t=this.options.duration?b.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):rr.propHooks._default.set(this),this}},rr.prototype.init.prototype=rr.prototype,rr.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=b.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){b.fx.step[e.prop]?b.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[b.cssProps[e.prop]]||b.cssHooks[e.prop])?b.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},rr.propHooks.scrollTop=rr.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},b.each(["toggle","show","hide"],function(e,t){var n=b.fn[t];b.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(ir(t,!0),e,r,i)}}),b.fn.extend({fadeTo:function(e,t,n,r){return this.filter(nn).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=b.isEmptyObject(e),o=b.speed(t,n,r),a=function(){var t=er(this,b.extend({},e),o);a.finish=function(){t.stop(!0)},(i||b._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return"string"!=typeof e&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",o=b.timers,a=b._data(this);if(n)a[n]&&a[n].stop&&i(a[n]);else for(n in a)a[n]&&a[n].stop&&Jn.test(n)&&i(a[n]);for(n=o.length;n--;)o[n].elem!==this||null!=e&&o[n].queue!==e||(o[n].anim.stop(r),t=!1,o.splice(n,1));(t||!r)&&b.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=b._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=b.timers,a=r?r.length:0;for(n.finish=!0,b.queue(this,e,[]),i&&i.cur&&i.cur.finish&&i.cur.finish.call(this),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}});function ir(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=Zt[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}b.each({slideDown:ir("show"),slideUp:ir("hide"),slideToggle:ir("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){b.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),b.speed=function(e,t,n){var r=e&&"object"==typeof e?b.extend({},e):{complete:n||!n&&t||b.isFunction(e)&&e,duration:e,easing:n&&t||t&&!b.isFunction(t)&&t};return r.duration=b.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in b.fx.speeds?b.fx.speeds[r.duration]:b.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){b.isFunction(r.old)&&r.old.call(this),r.queue&&b.dequeue(this,r.queue)},r},b.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},b.timers=[],b.fx=rr.prototype.init,b.fx.tick=function(){var e,n=b.timers,r=0;for(Xn=b.now();n.length>r;r++)e=n[r],e()||n[r]!==e||n.splice(r--,1);n.length||b.fx.stop(),Xn=t},b.fx.timer=function(e){e()&&b.timers.push(e)&&b.fx.start()},b.fx.interval=13,b.fx.start=function(){Un||(Un=setInterval(b.fx.tick,b.fx.interval))},b.fx.stop=function(){clearInterval(Un),Un=null},b.fx.speeds={slow:600,fast:200,_default:400},b.fx.step={},b.expr&&b.expr.filters&&(b.expr.filters.animated=function(e){return b.grep(b.timers,function(t){return e===t.elem}).length}),b.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){b.offset.setOffset(this,e,t)});var n,r,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,b.contains(n,a)?(typeof a.getBoundingClientRect!==i&&(o=a.getBoundingClientRect()),r=or(s),{top:o.top+(r.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(r.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},b.offset={setOffset:function(e,t,n){var r=b.css(e,"position");"static"===r&&(e.style.position="relative");var i=b(e),o=i.offset(),a=b.css(e,"top"),s=b.css(e,"left"),u=("absolute"===r||"fixed"===r)&&b.inArray("auto",[a,s])>-1,l={},c={},p,f;u?(c=i.position(),p=c.top,f=c.left):(p=parseFloat(a)||0,f=parseFloat(s)||0),b.isFunction(t)&&(t=t.call(e,n,o)),null!=t.top&&(l.top=t.top-o.top+p),null!=t.left&&(l.left=t.left-o.left+f),"using"in t?t.using.call(e,l):i.css(l)}},b.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===b.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),b.nodeName(e[0],"html")||(n=e.offset()),n.top+=b.css(e[0],"borderTopWidth",!0),n.left+=b.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-b.css(r,"marginTop",!0),left:t.left-n.left-b.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||o.documentElement;while(e&&!b.nodeName(e,"html")&&"static"===b.css(e,"position"))e=e.offsetParent;return e||o.documentElement})}}),b.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);b.fn[e]=function(i){return b.access(this,function(e,i,o){var a=or(e);return o===t?a?n in a?a[n]:a.document.documentElement[i]:e[i]:(a?a.scrollTo(r?b(a).scrollLeft():o,r?o:b(a).scrollTop()):e[i]=o,t)},e,i,arguments.length,null)}});function or(e){return b.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}b.each({Height:"height",Width:"width"},function(e,n){b.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){b.fn[i]=function(i,o){var a=arguments.length&&(r||"boolean"!=typeof i),s=r||(i===!0||o===!0?"margin":"border");return b.access(this,function(n,r,i){var o;return b.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(o=n.documentElement,Math.max(n.body["scroll"+e],o["scroll"+e],n.body["offset"+e],o["offset"+e],o["client"+e])):i===t?b.css(n,r,s):b.style(n,r,i,s)},n,a?i:t,a,null)}})}),e.jQuery=e.$=b,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return b})})(window);]==]
|
local ArenaSprite, super = Class(Object)
function ArenaSprite:init(arena, x, y)
super:init(self, x, y)
self.arena = arena
self.width = arena.width
self.height = arena.height
self:setScaleOrigin(0.5, 0.5)
self:setRotationOrigin(0.5, 0.5)
self.background = true
self.debug_select = false
end
function ArenaSprite:update()
self.width = self.arena.width
self.height = self.arena.height
super:update(self)
end
function ArenaSprite:draw()
if self.background then
love.graphics.setColor(self.arena:getBackgroundColor())
self:drawBackground()
end
super:draw(self)
local r,g,b,a = self:getDrawColor()
local arena_r,arena_g,arena_b,arena_a = self.arena:getDrawColor()
love.graphics.setColor(r * arena_r, g * arena_g, b * arena_b, a * arena_a)
love.graphics.setLineStyle("rough")
love.graphics.setLineWidth(self.arena.line_width)
love.graphics.line(unpack(self.arena.border_line))
end
function ArenaSprite:drawBackground()
for _,triangle in ipairs(self.arena.triangles) do
love.graphics.polygon("fill", unpack(triangle))
end
end
function ArenaSprite:canDeepCopyKey(key)
return super:canDeepCopyKey(self, key) and key ~= "arena"
end
return ArenaSprite
|
require("scripts/globals/mixins")
require("scripts/globals/status")
g_mixins = g_mixins or {}
g_mixins.maat = function(mob)
mob:addListener("SPAWN", "JOB_SPECIAL_SPAWN", function(mob)
if (mob:getMainJob() == tpz.job.NIN) then
mob:setLocalVar("specialThreshold", 40)
elseif (mob:getMainJob() == tpz.job.DRG) then
mob:setLocalVar("specialThreshold", 75)
else
mob:setLocalVar("specialThreshold", math.random(50, 60))
end
end)
mob:addListener("ROAM_TICK", "MAAT_RTICK", function(mob)
if mob:getLocalVar("engaged") == 0 then
for _, player in pairs(mob:getZone():getPlayers()) do
if player:checkDistance(mob) < 8 then
local ID = zones[mob:getZoneID()]
mob:messageText(mob, ID.text.YOU_DECIDED_TO_SHOW_UP)
mob:setLocalVar("engaged", player:getID())
end
end
end
end)
mob:addListener("ENGAGE", "MAAT_ENGAGE", function(mob, target)
if mob:getLocalVar("engaged") == 0 then
local ID = zones[mob:getZoneID()]
mob:messageText(mob, ID.text.YOU_DECIDED_TO_SHOW_UP)
mob:setLocalVar("engaged", target:getID())
end
end)
mob:addListener("DISENGAGE", "MAAT_DISENGAGE", function(mob)
engagedID = mob:getLocalVar("engaged")
if engagedID ~= 0 then
player = GetPlayerByID(engagedID)
if player:getHP() == 0 then
local ID = zones[mob:getZoneID()]
mob:showText(mob, ID.text.LOOKS_LIKE_YOU_WERENT_READY)
end
end
end)
mob:addListener("COMBAT_TICK", "MAAT_CTICK", function(mob)
local defaultAbility =
{
[tpz.job.WAR] = tpz.jsa.MIGHTY_STRIKES_MAAT,
[tpz.job.MNK] = tpz.jsa.HUNDRED_FISTS_MAAT,
[tpz.job.WHM] = tpz.jsa.BENEDICTION_MAAT,
[tpz.job.BLM] = tpz.jsa.MANAFONT_MAAT,
[tpz.job.RDM] = tpz.jsa.CHAINSPELL_MAAT,
[tpz.job.THF] = tpz.jsa.PERFECT_DODGE_MAAT,
[tpz.job.PLD] = tpz.jsa.INVINCIBLE_MAAT,
[tpz.job.DRK] = tpz.jsa.BLOOD_WEAPON_MAAT,
[tpz.job.BST] = tpz.jsa.FAMILIAR_MAAT,
[tpz.job.BRD] = tpz.jsa.SOUL_VOICE_MAAT,
[tpz.job.RNG] = tpz.jsa.EES_MAAT,
[tpz.job.SAM] = tpz.jsa.MEIKYO_SHISUI_MAAT,
[tpz.job.NIN] = tpz.jsa.MIJIN_GAKURE_MAAT,
[tpz.job.DRG] = tpz.jsa.CALL_WYVERN_MAAT,
[tpz.job.SMN] = tpz.jsa.ASTRAL_FLOW_MAAT,
}
if mob:getHPP() < mob:getLocalVar("specialThreshold") then
local ID = zones[mob:getZoneID()]
mob:messageText(mob, ID.text.NOW_THAT_IM_WARMED_UP)
mob:useMobAbility(defaultAbility[mob:getMainJob()])
mob:setLocalVar("specialThreshold", 0)
end
if mob:getHPP() < 20 or (mob:getMainJob() == tpz.job.WHM and mob:getBattleTime() > 300) then
local ID = zones[mob:getZoneID()]
mob:showText(mob, ID.text.YOUVE_COME_A_LONG_WAY)
mob:getBattlefield():win()
end
end)
mob:addListener("ITEM_STOLEN", "MAAT_ITEM_STOLEN", function(mob, player, itemId)
if mob:getMainJob() == tpz.job.THF then
local ID = zones[mob:getZoneID()]
mob:messageText(mob, ID.text.YOUVE_COME_A_LONG_WAY)
mob:getBattlefield():win()
end
end)
mob:addListener("DEATH", "MAAT_DEATH", function(mob, killer)
local ID = zones[mob:getZoneID()]
mob:messageText(mob, ID.text.YOUVE_COME_A_LONG_WAY)
end)
mob:addListener("WEAPONSKILL_TAKE", "MAAT_WEAPONSKILL_TAKE", function(target, user, wsid, tp, action)
local ID = zones[target:getZoneID()]
target:messageText(target, ID.text.THAT_LL_HURT_IN_THE_MORNING)
end)
mob:addListener("WEAPONSKILL_USE", "MAAT_WEAPONSKILL_USE", function(mob, target, wsid, tp, action)
local ID = zones[mob:getZoneID()]
if (wsid == 1028) then -- Tackle
mob:messageText(mob, ID.text.TAKE_THAT_YOU_WHIPPERSNAPPER)
elseif (wsid == 1033) then -- Dragon Kick
mob:messageText(mob, ID.text.TEACH_YOU_TO_RESPECT_ELDERS)
elseif (wsid == 1034) then -- Asuran Fists
mob:messageText(mob, ID.text.LOOKS_LIKE_YOU_WERENT_READY)
end
end)
end
return g_mixins.maat
|
uart.setup(0,9600,8,0,1,0)
sv=net.createServer(net.TCP, 60)
global_c = nil
sv:listen(9999, function(c)
if global_c~=nil then
global_c:close()
end
global_c=c
c:on("receive",function(sck,pl) uart.write(0,pl) end)
end)
uart.on("data",4, function(data)
if global_c~=nil then
global_c:send(data)
end
end, 0)
|
local AS = unpack(AddOnSkins)
if not AS:CheckAddOn('ModelPique') then return end
function AS:ModelPique()
AS:SkinFrame(ModelPiqueFrame)
ModelPiqueFrame:SetTemplate("Transparent")
AS:SkinButton(ModelPiqueFrameCancelButton)
AS:SkinCloseButton(ModelPiqueFrameCloseButton)
AS:Kill(ModelPiqueFramePortrait)
--Reposition Frame
ModelPiqueModel:ClearAllPoints()
ModelPiqueModel:Point('BOTTOMLEFT', ModelPiqueFrame, 'BOTTOMLEFT', 5, 5)
--Reposition buttons
ModelPiqueFrameCancelButton:ClearAllPoints()
ModelPiqueFrameCancelButton:Point('BOTTOMRIGHT', ModelPiqueFrame, 'BOTTOMRIGHT', -8, 8)
ModelPiqueFrameCloseButton:ClearAllPoints()
ModelPiqueFrameCloseButton:Point('TOPRIGHT', ModelPiqueFrame, 'TOPRIGHT', 0, 0)
--Resize Frame
ModelPiqueFrame:Size(327, 410)
end
AS:RegisterSkin('ModelPique', AS.ModelPique)
|
---@diagnostic disable: lowercase-global, undefined-global
--[[----------------------------------------------------如何创建一个样式----------------------------------------------------
--1. 创建一个样式
style = lvgl.style_t()
--2. 为样式进行初始化
lvgl.style_init(style)
--3. 添加具体的样式
lvgl.style_set_bg_opa(style, lvgl.STATE_DEFAULT, lvgl.OPA_COVER)
lvgl.style_set_bg_color(style, lvgl.STATE_DEFAULT, lvgl.color_hex(0xFF00FF))
想要了解更多详情,你也可以复制此链接进入官网进行查看
https://docs.lvgl.io/7.11/overview/style.html
]]
--样式:父级容器
demo_BaseContStyle = lvgl.style_t()
lvgl.style_init(demo_BaseContStyle)
lvgl.style_set_radius(demo_BaseContStyle, lvgl.STATE_DEFAULT, 0)
lvgl.style_set_bg_color(demo_BaseContStyle, lvgl.STATE_DEFAULT, lvgl.color_hex(0x333333))
lvgl.style_set_bg_color(demo_BaseContStyle, (lvgl.STATE_PRESSED or lvgl.STATE_CHECKED), lvgl.color_hex(0x333333))
lvgl.style_set_text_color(demo_BaseContStyle, lvgl.STATE_DEFAULT, lvgl.color_hex(0xF5F5F5))
lvgl.style_set_border_opa(demo_BaseContStyle, lvgl.STATE_DEFAULT, lvgl.OPA_0)
--所有Demo的基础样式:填充颜色以及字体说明颜色
demo_ThemeStyle_IndicAndFont = lvgl.style_t()
lvgl.style_init(demo_ThemeStyle_IndicAndFont)
lvgl.style_set_bg_color(demo_ThemeStyle_IndicAndFont, lvgl.STATE_DEFAULT, lvgl.color_hex(0x0A2594))
lvgl.style_set_bg_color(demo_ThemeStyle_IndicAndFont, (lvgl.STATE_PRESSED or lvgl.STATE_CHECKED), lvgl.color_hex(0x0A2594))
lvgl.style_set_text_color(demo_ThemeStyle_IndicAndFont, lvgl.STATE_DEFAULT, lvgl.color_hex(0xF5F5F5))
--所有Demo的基础样式:背景颜色
demo_ThemeStyle_Bg = lvgl.style_t()
lvgl.style_init(demo_ThemeStyle_Bg)
lvgl.style_set_bg_color(demo_ThemeStyle_Bg, lvgl.STATE_DEFAULT, lvgl.color_hex(0x808080))
lvgl.style_set_bg_color(demo_ThemeStyle_Bg, (lvgl.STATE_CHECKED or lvgl.STATE_PRESSED), lvgl.color_hex(0x808080))
lvgl.style_set_bg_color(demo_ThemeStyle_Bg, lvgl.STATE_DISABLED, lvgl.color_hex(0x808080))
--所有Demo的基础样式:字体样式(白色)
demo_ThemeFontStyle = lvgl.style_t()
lvgl.style_init(demo_ThemeFontStyle)
lvgl.style_set_text_color(demo_ThemeFontStyle, lvgl.STATE_DEFAULT, lvgl.color_hex(0xF5F5F5))
--LED颜色样式1(红色)
demo_LEDStyle_Red = lvgl.style_t()
lvgl.style_init(demo_LEDStyle_Red)
lvgl.style_set_bg_color(demo_LEDStyle_Red, lvgl.STATE_DEFAULT, lvgl.color_hex(0xFF0000))
--LED颜色样式1(黄色)
demo_LEDStyle_Yellow = lvgl.style_t()
lvgl.style_init(demo_LEDStyle_Yellow)
lvgl.style_set_bg_color(demo_LEDStyle_Yellow, lvgl.STATE_DEFAULT, lvgl.color_hex(0xFFFF00))
--LED颜色样式1(绿色)
demo_LEDStyle_Green = lvgl.style_t()
lvgl.style_init(demo_LEDStyle_Green)
lvgl.style_set_bg_color(demo_LEDStyle_Green, lvgl.STATE_DEFAULT, lvgl.color_hex(0x00FF00))
--Line颜色样式1(绿色)
demo_LineStyle_Green = lvgl.style_t()
lvgl.style_init(demo_LineStyle_Green)
lvgl.style_set_line_color(demo_LineStyle_Green, lvgl.STATE_DEFAULT, lvgl.color_hex(0x00FF00))
--LineMeter样式
demo_LineMeterStyle = lvgl.style_t()
lvgl.style_init(demo_LineMeterStyle)
lvgl.style_set_bg_color(demo_LineMeterStyle, lvgl.STATE_DEFAULT, lvgl.color_hex(0x808080))
lvgl.style_set_line_color(demo_LineMeterStyle, lvgl.STATE_DEFAULT, lvgl.color_hex(0x00FF00))
lvgl.style_set_scale_grad_color(demo_LineMeterStyle, lvgl.STATE_DEFAULT, lvgl.color_hex(0x00FF00))
lvgl.style_set_scale_end_color(demo_LineMeterStyle, lvgl.STATE_DEFAULT, lvgl.color_hex(0x00FF00))
--Page的样式
demo_PageStyle = lvgl.style_t()
lvgl.style_init(demo_PageStyle)
lvgl.style_set_bg_color(demo_PageStyle, lvgl.STATE_DEFAULT, lvgl.color_hex(0xA0A0A0))
|
local UIBase = require('ui.UIBase')
local SkillRewardView = class("SkillRewardView",UIBase)
local LoopScrollRect = require("ui.uiScripts.SkillRewardScrollComponent")
local upperLeft = Vector2(230,-6)
local xOffset = -15
local spaceY = 97
local itemScript = "ui.uiScripts.SkillInfo"
function SkillRewardView:Awake()
self.isInited = false
--所有技能
self.currentMySkills = {}
--当前所有技能的behaviour
self.newSkillBehaviour = {}
self. mySkillBehaviour = {}
--英雄对应的技能
self. heroSkills = {}
--选择的技能
self.currentNewSkill = nil
self.currentMySkill = nil
end
function SkillRewardView:OnShow(data)
self.super.OnShow(self)
--dump(data)
self.newSkillsData = data.newSkills
self.mySkillData = data.heroSkill1
self.heroSkills["Hero1Skill"] = data.heroSkill1
self.heroSkills["Hero2Skill"] = data.heroSkill2
self.heroSkills["Hero3Skill"] = data.heroSkill3
self.currentMySkills = self.heroSkills["Hero1Skill"]
--默认选择的技能都为第一个
self.currentNewSkill = self.newSkillsData[1]
self.currentMySkill = self.currentMySkills[1]
if self.isInited == true then
self.newSkillScroll:Reset(self.newSkillsData)
self.mySkillScroll:Reset(self.heroSkills["Hero1Skill"])
end
end
function SkillRewardView:Start()
-- utils:StartCoroutine(function()
-- coroutine.yield(utils:WaitForRemove(self));
-- self.super.RemoveAllButtonListeners(self);
-- print("ButtonListener移除完毕")
-- end)
self.Close.onClick:AddListener(function() UIManager:CloseUI(self) end)
self.Hero1.onClick:AddListener(function() self:Hero1Click() end)
self.Hero2.onClick:AddListener(function() self:Hero2Click() end)
self.Hero3.onClick:AddListener(function() self:Hero3Click() end)
self.Confirm.onClick:AddListener(function() self:ConfirmReplace() end)
self:InitGrid()
end
function SkillRewardView:OnUpdate()
if self.isInited == true then
self.newSkillScroll:ObliqueUpdate()
self.mySkillScroll:ObliqueUpdate()
end
end
function SkillRewardView:OnHide()
end
function SkillRewardView:InitGrid()
self.newSkillScroll = LoopScrollRect.new(6, 1, self.newSkillsData)
self.newSkillScroll.view = self
self.newSkillScroll.xOffset = xOffset
self.newSkillScroll.spaceY = spaceY
self.newSkillScroll.upperLeft = upperLeft
self.newSkillScroll.selectShowItem = self.SelectNewSkill
self.mySkillScroll = LoopScrollRect.new(6, 1, self.mySkillData)
self.mySkillScroll.view = self
self.mySkillScroll.xOffset = xOffset
self.mySkillScroll.spaceY = spaceY
self.mySkillScroll.upperLeft = upperLeft
self.mySkillScroll.selectShowItem = self.SelectMySkill
utils:StartCoroutine(function()
local f, asset = coroutine.yield(utils:WaitAndLoadAsset("Assets/GameMain/UI/UIItems/SkillPrefab.prefab"))
if f:isResolved() then
self.newSkillScroll.initGridEvent = SkillRewardView.InitNewSkillGridEvent
self.newSkillScroll.refreshDataEvent = SkillRewardView.RefreshNewSkillDataEvent
self.newSkillScroll.resetDataEvent = SkillRewardView.ResetNewSkillDataEvent
--self.newSkillScroll.obliqueUpdateEvent = SkillRewardView.UpdateEvent
self.mySkillScroll.initGridEvent = SkillRewardView.InitMySkillGridEvent
self.mySkillScroll.refreshDataEvent = SkillRewardView.RefreshMySkillDataEvent
self.mySkillScroll.resetDataEvent = SkillRewardView.ResetMySkillDataEvent
--self.mySkillScroll.obliqueUpdateEvent = SkillRewardView.UpdateEvent
self.newSkillScroll:init(asset,self.NewSkillGrid)
self.mySkillScroll:init(asset,self.MySkillGrid)
self.isInited = true
else
Debug.LogError("Cannot load ItemPrefab");
end
end)
end
function SkillRewardView:Hero1Click()
self.mySkillScroll:Reset(self.heroSkills["Hero1Skill"])
self.currentMySkills = self.heroSkills["Hero1Skill"]
self:SetDefaultData()
end
function SkillRewardView:Hero2Click()
self.mySkillScroll:Reset(self.heroSkills["Hero2Skill"])
self.currentMySkills = self.heroSkills["Hero2Skill"]
self:SetDefaultData()
end
function SkillRewardView:Hero3Click()
self.mySkillScroll:Reset(self.heroSkills["Hero3Skill"])
self.currentMySkills = self.heroSkills["Hero3Skill"]
self:SetDefaultData()
end
function SkillRewardView:SetDefaultData()
self.currentMySkill = self.currentMySkills[1]
self.currentNewSkill= self.newSkillsData[1]
--刷新Grid
end
function SkillRewardView:ConfirmReplace()
local UOD = {}
UOD.oldSkill = self.currentMySkill
UOD.newSkill = self.currentNewSkill
UIManager:OpenUI("ReplaceSkillView",UOD)
end
-----------------------------------------------------------------
--mySkill 相关
function SkillRewardView.InitMySkillGridEvent(self,obj,rectTransform)
local behaviour = obj.gameObject:AddLuaBehaviour(itemScript)
table.insert(self.mySkillBehaviour, behaviour)
behaviour.LuaTable.isNewSkill = false
end
function SkillRewardView.RefreshMySkillDataEvent(self,item,data)
SkillRewardView.SetSkillData(self.mySkillBehaviour,item,data)
end
function SkillRewardView.ResetMySkillDataEvent(self,rectTransform,data)
SkillRewardView.SetSkillData(self.mySkillBehaviour,rectTransform,data)
end
-----------------------------------------------------------------
--newSkill 相关
function SkillRewardView.InitNewSkillGridEvent(self,obj,rectTransform)
local behaviour = obj.gameObject:AddLuaBehaviour(itemScript)
table.insert(self.newSkillBehaviour, behaviour)
behaviour.LuaTable.isNewSkill = true
end
function SkillRewardView.RefreshNewSkillDataEvent(self,item,data)
SkillRewardView.SetSkillData(self.newSkillBehaviour,item,data)
end
function SkillRewardView.ResetNewSkillDataEvent(self,rectTransform,data)
SkillRewardView.SetSkillData(self.newSkillBehaviour,rectTransform,data)
end
-----------------------------------------------------------------
function SkillRewardView.SetSkillData(skillBehaviours,item,data)
if data == nil then return end
local behaviour = skillBehaviours[tonumber(item.name)]
local table = behaviour.LuaTable
table["itemName"] = data.name
table["itemId"] = data.id
table["dataIndex"] = data.dataIndex
table["itemIntro"] = data.itemIntro
--table["itemIcon"] = data.itemIcon
table.Text.text = data.dataIndex
end
return SkillRewardView
|
-----------------------------------
-- Area: Crawlers Nest [S]
-- NPC: Kalsu-Kalasu
-- !pos 304.768 -33.519 -19.168 171
-- Notes: Gives Green Letter required to start "Snake on the plains"
-----------------------------------
require("scripts/globals/settings");
require("scripts/globals/keyitems");
local ID = require("scripts/zones/Crawlers_Nest_[S]/IDs");
-----------------------------------
function onTrade(player,npc,trade)
end;
function onTrigger(player,npc)
if (player:getCampaignAllegiance() > 0) then
if (player:getCampaignAllegiance() == 2) then
player:startEvent(3);
else
-- message for other nations missing
player:startEvent(3);
end
elseif (player:hasKeyItem(tpz.ki.GREEN_RECOMMENDATION_LETTER) == true) then
player:startEvent(2);
elseif (player:hasKeyItem(tpz.ki.GREEN_RECOMMENDATION_LETTER) == false) then
player:startEvent(1);
end
end;
function onEventUpdate(player,csid,option)
end;
function onEventFinish(player,csid,option)
if (csid == 1 and option == 0) then
player:addKeyItem(tpz.ki.GREEN_RECOMMENDATION_LETTER);
player:messageSpecial(ID.text.KEYITEM_OBTAINED, tpz.ki.GREEN_RECOMMENDATION_LETTER);
end
end;
|
-- This is an experiment to see how fast ffi calls are and how ugly/pretty
-- the bindings are.
local FFI = require('ffi')
local Fs = require('fs')
local Path = require('path')
-- Read the combined libuv and http_parser header file
FFI.cdef(Fs.read_file_sync(Path.join(__dirname, "ffi_uv.h")))
local C = FFI.C
local server = FFI.new("uv_stream_t")
local settings = FFI.new("http_parser_settings")
local refbuf = FFI.new("uv_buf_t")
p({server=server,settings=settings,refbuf=refbuf})
local RESPONSE =
"HTTP/1.1 200 OK\r\n" ..
"Content-Type: text/plain\r\n" ..
"Content-Length: 12\r\n" ..
"\r\n"
FFI.cdef([[
typedef struct {
uv_tcp_t handle;
http_parser parser;
uv_write_t write_req;
} client_t;
]])
local function on_close
--void on_close(uv_handle_t* handle) {
-- free(handle);
-- // printf("disconnected\n");
--}
--uv_buf_t on_alloc(uv_handle_t* handle, size_t suggested_size) {
-- uv_buf_t buf;
-- buf.base = malloc(suggested_size);
-- buf.len = suggested_size;
-- return buf;
--}
--void on_read(uv_stream_t* stream, ssize_t nread, uv_buf_t buf) {
-- client_t* client = stream->data;
-- size_t parsed;
-- if (nread >= 0) {
-- parsed = http_parser_execute(&client->parser, &settings, buf.base, nread);
-- if (parsed < nread) {
-- uv_close((uv_handle_t*)stream, on_close);
-- fprintf(stderr, "parse error\n");
-- }
-- } else {
-- uv_err_t err = uv_last_error(uv_default_loop());
-- if (err.code == UV_EOF) {
-- uv_close((uv_handle_t*)stream, on_close);
-- } else {
-- fprintf(stderr, "read: %s\n", uv_strerror(err));
-- }
-- }
-- free(buf.base);
--}
--void on_connection(uv_stream_t* server_handle, int status) {
-- assert(server_handle == &server);
-- // printf("connected\n");
-- client_t* client = malloc(sizeof(client_t));
-- uv_tcp_init(uv_default_loop(), &client->handle);
-- client->handle.data = client;
-- client->parser.data = client;
-- int r = uv_accept(&server, (uv_stream_t*)&client->handle);
-- if (r) {
-- uv_err_t err = uv_last_error(uv_default_loop());
-- fprintf(stderr, "accept: %s\n", uv_strerror(err));
-- exit(-1);
-- }
-- http_parser_init(&client->parser, HTTP_REQUEST);
-- uv_read_start((uv_stream_t*)&client->handle, on_alloc, on_read);
--}
--void after_write(uv_write_t* req, int status) {
-- //printf("after_write\n");
-- uv_close((uv_handle_t*)req->handle, on_close);
--}
--int on_headers_complete(http_parser* parser) {
-- client_t* client = parser->data;
-- // printf("http message!\n");
-- uv_write(&client->write_req, (uv_stream_t*)&client->handle, &refbuf, 1, after_write);
-- return 1;
--}
--int main() {
-- refbuf.base = RESPONSE;
-- refbuf.len = sizeof(RESPONSE);
-- settings.on_headers_complete = on_headers_complete;
-- uv_tcp_init(uv_default_loop(), (uv_tcp_t*)&server);
-- struct sockaddr_in address = uv_ip4_addr("0.0.0.0", 8080);
-- int r = uv_tcp_bind((uv_tcp_t*)&server, address);
-- if (r) {
-- uv_err_t err = uv_last_error(uv_default_loop());
-- fprintf(stderr, "bind: %s\n", uv_strerror(err));
-- return -1;
-- }
-- r = uv_listen(&server, 128, on_connection);
-- if (r) {
-- uv_err_t err = uv_last_error(uv_default_loop());
-- fprintf(stderr, "listen: %s\n", uv_strerror(err));
-- return -1;
-- }
-- // Block in the main loop
-- uv_run(uv_default_loop());
-- return 0;
--}
|
local M = {}
function M.config()
require("indent_blankline").setup({
char = "│",
use_treesitter = true,
show_current_context = false,
max_indent_increase = 1,
show_trailing_blankline_indent = false,
filetype_exclude = {
"Preview",
"__doc__",
"help",
"log",
"man",
"markdown",
"neo-tree",
"neo-tree-popup",
"peekaboo",
"terminal",
"translator",
"aerial",
"lspinfo",
"lspsagafinder",
"Trouble",
"qf",
"",
},
buftype_exclude = { "terminal", "man", "trouble" },
context_patterns = {
"class",
"function",
"method",
"if",
"table",
"dictionary",
"list",
"parameters",
"expression_list",
"for_statement",
-- json
"array",
"object",
},
})
end
return setmetatable({}, {
__call = function()
return M.config()
end,
})
|
local Data = require "nvim-lsp-installer.data"
local log = require "nvim-lsp-installer.log"
local fetch = require "nvim-lsp-installer.core.fetch"
local spawn = require "nvim-lsp-installer.core.spawn"
local list_find_first = Data.list_find_first
local M = {}
---@alias GitHubRelease {tag_name:string, prerelease: boolean, draft: boolean}
---@alias GitHubTag {name: string}
---@async
---@param repo string The GitHub repo ("username/repo").
function M.fetch_releases(repo)
log.fmt_trace("Fetching GitHub releases for repo=%s", repo)
local path = ("repos/%s/releases"):format(repo)
return spawn.gh({ "api", path })
:map(function(result)
return result.stdout
end)
:recover_catching(function()
return fetch(("https://api.github.com/%s"):format(path)):get_or_throw()
end)
:map_catching(vim.json.decode)
end
---@alias FetchLatestGithubReleaseOpts {tag_name_pattern:string}
---@async
---@param repo string The GitHub repo ("username/repo").
---@param opts FetchLatestGithubReleaseOpts|nil
---@return Result @of GitHubRelease
function M.fetch_latest_release(repo, opts)
opts = opts or {}
return M.fetch_releases(repo):map_catching(
---@param releases GitHubRelease[]
function(releases)
---@type GitHubRelease|nil
local latest_release = list_find_first(
releases,
---@param release GitHubRelease
function(release)
local is_stable_release = not release.prerelease and not release.draft
if opts.tag_name_pattern then
return is_stable_release and release.tag_name:match(opts.tag_name_pattern)
end
return is_stable_release
end
)
if not latest_release then
log.fmt_info("Failed to find latest release. repo=%s, opts=%s", repo, opts)
error "Failed to find latest release."
end
log.fmt_debug("Resolved latest version repo=%s, tag_name=%s", repo, latest_release.tag_name)
return latest_release
end
)
end
---@async
---@param repo string The GitHub repo ("username/repo").
function M.fetch_tags(repo)
local path = ("repos/%s/tags"):format(repo)
return spawn.gh({ "api", path })
:map(function(result)
return result.stdout
end)
:recover_catching(function()
return fetch(("https://api.github.com/%s"):format(path)):get_or_throw()
end)
:map_catching(vim.json.decode)
end
---@async
---@param repo string The GitHub repo ("username/repo").
function M.fetch_latest_tag(repo)
return M.fetch_tags(repo):map_catching(function(tags)
if vim.tbl_count(tags) == 0 then
error "No tags found."
end
return tags[1]
end)
end
return M
|
#include "scripts/utils.lua"
#include "scripts/savedata.lua"
#include "scripts/menu.lua"
#include "datascripts/keybinds.lua"
#include "datascripts/inputList.lua"
#include "datascripts/color4.lua"
toolName = "shapecollapsor"
toolReadableName = "Shape Collapsor"
local menu_disabled = false
local aabbActive = false
local aabbMinPosSet = false
local aabbMaxPosSet = false
local aimPoint = Vec()
local aabbMinPos = Vec()
local aabbMaxPos = Vec()
local faceSprite = LoadSprite("MOD/sprites/square.png")
local red = 1
local green = 0
local blue = 0
local alpha = 1
local spriteAlpha = 0.5
local firingMode = 1
local firingModes = 2
local frontLookRot = QuatLookAt(Vec(0, 0, 0), Vec(0, 0, -1))
local topLookRot = QuatLookAt(Vec(0, 0, 0), Vec(0, -1, 0))
local sideLookRot = QuatLookAt(Vec(0, 0, 0), Vec(-1, 0, 0))
local largeOperationWarning = false
local cutModeExtraWide = 0
local cutModePerUnit = 0.5
local cutModeHoleSize = 0.5
local cutModeOverrideMax = true
savedVars = {
PerUnit = { default = 5, current = nil, valueType = "float" },
HoleSize = { default = 10, current = nil, valueType = "float" },
}
function init()
saveFileInit(savedVars)
menu_init()
RegisterTool(toolName, toolReadableName, "MOD/vox/tool.vox")
SetBool("game.tool." .. toolName .. ".enabled", true)
end
function tick(dt)
if not menu_disabled then
menu_tick(dt)
end
local isMenuOpenRightNow = isMenuOpen()
if not canUseTool() then
return
end
if aabbActive then
if GetPlayerGrabShape() ~= 0 or GetPlayerGrabBody() ~= 0 then
clearAaBbVars()
return
end
local maxPos = nil
if aabbMaxPosSet then
maxPos = aabbMaxPos
else
maxPos = aimPoint
end
renderAabbZone(aabbMinPos, maxPos)
local perUnit = cutModePerUnit
if firingMode == 1 then
perUnit = GetValue("PerUnit")
end
largeOperationWarning = checkLargeOperation(aabbMinPos, maxPos, perUnit)
end
if isMenuOpenRightNow then
return
end
if InputPressed(binds["Toggle_Mode"]) then
changeFiringMode()
end
if InputPressed(binds["Cancel_Operation"]) then
clearAaBbVars()
end
handleToolBody()
aimLogic()
if InputPressed(binds["Alt_Fire"]) or (aabbActive and InputPressed(binds["Shoot"])) then
altFireLogic()
return
end
if aabbActive then
return
end
if InputPressed(binds["Shoot"]) then
shootLogic()
end
end
function draw(dt)
menu_draw(dt)
if not canUseTool() then
return
end
if largeOperationWarning then
UiPush()
UiFont("bold.ttf", 18)
c_UiColor(Color4.Yellow)
c_UiTextOutline(Color4.Black, 0.5)
UiAlign("center bottom")
UiTranslate(UiCenter(), UiMiddle() - 20)
UiText("Large Operation!")
UiPop()
end
end
function canUseTool()
return GetString("game.player.tool") == toolName and GetPlayerVehicle() == 0 and GetString("game.player.canusetool")
end
function handleToolBody()
local toolBody = GetToolBody()
local toolShapes = GetBodyShapes(toolBody)
local redVox = toolShapes[1]
local yellowVox = toolShapes[2]
local heldPosition = Vec(0.15, -0.3, -0.5)
local hiddenPosition = Vec(0, 0, 1)
if firingMode == 1 then
SetShapeLocalTransform(redVox, Transform(heldPosition, Quat()))
SetShapeLocalTransform(yellowVox, Transform(hiddenPosition, Quat()))
elseif firingMode == 2 then
SetShapeLocalTransform(redVox, Transform(hiddenPosition, Quat()))
SetShapeLocalTransform(yellowVox, Transform(heldPosition, Quat()))
end
end
function shootLogic()
local cameraTransform = GetPlayerCameraTransform()
local origin = cameraTransform.pos
local direction = TransformToParentVec(cameraTransform, Vec(0, 0, -1))
local hit, hitPoint, distance, normal, shape = raycast(origin, direction)
if not hit then
return
end
largeOperationWarning = false
collapseShape(shape)
--local shapeBody = GetShapeBody(shape)
--[[local bodyShapes = GetBodyShapes(shapeBody)
for i = 1, #bodyShapes do
collapseShape(bodyShapes[i])
end]]--
end
function checkLargeOperation(minPos, maxPos, perUnit, maxUnit, maxSpace)
local xWidth = math.abs(minPos[1] - maxPos[1]) / perUnit
local yWidth = math.abs(minPos[2] - maxPos[2]) / perUnit
local zWidth = math.abs(minPos[3] - maxPos[3]) / perUnit
maxUnit = maxUnit or 50
maxSpace = maxSpace or 30
--[[DebugPrint("x " .. xWidth .. " / " .. perUnit .. " = " .. xWidth / perUnit)
DebugPrint("y " .. yWidth .. " / " .. perUnit .. " = " .. yWidth / perUnit)
DebugPrint("z " .. zWidth .. " / " .. perUnit .. " = " .. zWidth / perUnit)]]--
local space = xWidth * zWidth * yWidth
if (xWidth / perUnit > maxUnit or yWidth / perUnit > maxUnit or zWidth / perUnit > maxUnit) or space > maxSpace then
return true
end
return false
end
function checkAxis(a, b, i)
if a[i] > b[i] then
local backup = b[i]
b[i] = a[i]
a[i] = backup
end
end
function changeFiringMode()
firingMode = firingMode + 1
if firingMode > firingModes then
firingMode = 1
end
if firingMode == 1 then
red = 1
green = 0
blue = 0
alpha = 1
spriteAlpha = 0.5
elseif firingMode == 2 then
red = 1
green = 1
blue = 0
alpha = 0.75
spriteAlpha = 0.25
end
end
function clearAaBbVars()
aabbActive = false
aabbMinPosSet = false
aabbMaxPosSet = false
largeOperationWarning = false
end
function altFireLogic()
if aabbActive and aabbMinPosSet and aabbMaxPosSet then
clearAaBbVars()
checkAxis(aabbMinPos, aabbMaxPos, 1)
checkAxis(aabbMinPos, aabbMaxPos, 2)
checkAxis(aabbMinPos, aabbMaxPos, 3)
if firingMode == 1 then
collapseAaBb(aabbMinPos, aabbMaxPos)
elseif firingMode == 2 then
cutOutAaBb(aabbMinPos, aabbMaxPos)
end
return
end
local cameraTransform = GetPlayerCameraTransform()
local origin = cameraTransform.pos
local direction = TransformToParentVec(cameraTransform, Vec(0, 0, -1))
local hit, hitPoint, distance, normal, shape = raycast(origin, direction)
if not hit then
return
end
aabbActive = true
if not aabbMinPosSet then
aabbMinPosSet = true
aabbMinPos = VecCopy(hitPoint)
elseif not aabbMaxPosSet then
aabbMaxPosSet = true
aabbMaxPos = VecCopy(hitPoint)
end
end
function aimLogic()
local cameraTransform = GetPlayerCameraTransform()
local origin = cameraTransform.pos
local direction = TransformToParentVec(cameraTransform, Vec(0, 0, -1))
local hit, hitPoint, distance, normal, shape = raycast(origin, direction)
if not hit then
if not aabbActive then
largeOperationWarning = false
end
return
end
local shapeBody = GetShapeBody(shape)
aimPoint = VecCopy(hitPoint)
local shapeMin, shapeMax = GetShapeBounds(shape)
largeOperationWarning = checkLargeOperation(shapeMin, shapeMax, GetValue("PerUnit"), 5)
if not aabbActive then
DrawShapeOutline(shape)
DrawShapeHighlight(shape, 0.5)
end
end
function cutOutAaBb(minPos, maxPos)
local xWidth, yWidth, zWidth, cRBT, cRBB,
cRFT, cRFB, cLBT, cLBB, cLFT, cLFB = getAaBbCorners(minPos, maxPos, 1)
-- front
collapseAaBb(cLFT, cRFB, cutModeExtraWide, cutModePerUnit, cutModeHoleSize, cutModeOverrideMax)
-- back
collapseAaBb(cLBT, cRBB, cutModeExtraWide, cutModePerUnit, cutModeHoleSize, cutModeOverrideMax)
-- left
collapseAaBb(cLFT, cLBB, cutModeExtraWide, cutModePerUnit, cutModeHoleSize, cutModeOverrideMax)
-- right
collapseAaBb(cRFT, cRBB, cutModeExtraWide, cutModePerUnit, cutModeHoleSize, cutModeOverrideMax)
-- top
collapseAaBb(cLFT, cRBT, cutModeExtraWide, cutModePerUnit, cutModeHoleSize, cutModeOverrideMax)
-- bottom
collapseAaBb(cLFB, cRBB, cutModeExtraWide, cutModePerUnit, cutModeHoleSize, cutModeOverrideMax)
end
function collapseShape(shape)
local shapeMin, shapeMax = GetShapeBounds(shape)
collapseAaBb(shapeMin, shapeMax)
end
function collapseAaBb(minPos, maxPos, extraWide, perUnit, holeSize, overrideMax, offset)
extraWide = extraWide or 0
perUnit = perUnit or GetValue("PerUnit")
holeSize = holeSize or GetValue("HoleSize")
overrideMax = overrideMax or false
offset = offset or 0.5
local xWidth = math.abs(minPos[1] - maxPos[1])
local yWidth = math.abs(minPos[2] - maxPos[2])
local zWidth = math.abs(minPos[3] - maxPos[3])
xWidth = xWidth + extraWide
yWidth = yWidth + extraWide
zWidth = zWidth + extraWide
--[[if checkLargeOperation(minPos, maxPos, perUnit) and not overrideMax then
return
end]]--
local dirToMin = VecDir(minPos, maxPos)
minPos = VecAdd(minPos, VecScale(dirToMin, offset * perUnit))
local startIndex = -extraWide
for x = startIndex, xWidth, perUnit do
for y = startIndex, yWidth, perUnit do
for z = startIndex, zWidth, perUnit do
local currVec = VecAdd(minPos, Vec(x, y, z))
--SpawnParticle(currVec, Vec(), 50)
MakeHole(currVec, holeSize, holeSize, holeSize)
end
end
end
end
function getAaBbCorners(minPos, maxPos, extraWide)
if extraWide ~= nil and extraWide ~= 0 then
local dirToMin = VecDir(maxPos, minPos)
local dirToMax = VecDir(minPos, maxPos)
minPos = VecAdd(minPos, VecScale(dirToMin, extraWide))
maxPos = VecAdd(maxPos, VecScale(dirToMax, extraWide))
end
local xWidth = -(minPos[1] - maxPos[1])
local yWidth = -(minPos[2] - maxPos[2])
local zWidth = -(minPos[3] - maxPos[3])
local cRBT = VecAdd(maxPos, Vec(0, -yWidth, 0)) --corner right back top cRBT
local cRBB = maxPos -- corner right back bottom cRBB
local cRFT = VecAdd(minPos, Vec(xWidth, 0, 0)) -- corner right front top cRFT
local cRFB = VecAdd(maxPos, Vec(0, 0, -zWidth)) -- corner right front bottom cRFB
local cLBT = VecAdd(minPos, Vec(0, 0, zWidth)) -- corner left back top cLBT
local cLBB = VecAdd(minPos, Vec(0, yWidth, zWidth)) -- corner left back bottom cLBB
local cLFT = minPos -- corner left front top cLFT
local cLFB = VecAdd(minPos, Vec(0, yWidth, 0)) -- corner left front bottom cLFB
return xWidth, yWidth, zWidth, cRBT, cRBB, cRFT, cRFB, cLBT, cLBB, cLFT, cLFB
end
function renderAabbZone(minPos, maxPos)
local xWidth, yWidth, zWidth, cRBT, cRBB,
cRFT, cRFB, cLBT, cLBB, cLFT, cLFB = getAaBbCorners(minPos, maxPos)
local frontFace = VecLerp(cLFT, cRFB, 0.5)
local backFace = VecLerp(cLBT, cRBB, 0.5)
local leftFace = VecLerp(cLFT, cLBB, 0.5)
local rightFace = VecLerp(cRFT, cRBB, 0.5)
local topFace = VecLerp(cLFT, cRBT, 0.5)
local bottomFace = VecLerp(cLFB, cRBB, 0.5)
DebugLine(cRBT, cRBB, red, green, blue, alpha)
DebugLine(cRFT, cRFB, red, green, blue, alpha)
DebugLine(cLBT, cLBB, red, green, blue, alpha)
DebugLine(cLFT, cLFB, red, green, blue, alpha)
DebugLine(cRBT, cLBT, red, green, blue, alpha)
DebugLine(cLBB, cRBB, red, green, blue, alpha)
DebugLine(cRFT, cLFT, red, green, blue, alpha)
DebugLine(cLFB, cRFB, red, green, blue, alpha)
DebugLine(cRFT, cRBT, red, green, blue, alpha)
DebugLine(cRFB, cRBB, red, green, blue, alpha)
DebugLine(cLFT, cLBT, red, green, blue, alpha)
DebugLine(cLFB, cLBB, red, green, blue, alpha)
renderFace(frontFace, frontLookRot, xWidth, yWidth)
renderFace(backFace, frontLookRot, xWidth, yWidth)
renderFace(leftFace, sideLookRot, zWidth, yWidth)
renderFace(rightFace, sideLookRot, zWidth, yWidth)
renderFace(topFace, topLookRot, xWidth, zWidth)
renderFace(bottomFace, topLookRot, xWidth, zWidth)
end
function renderFace(pos, rot, xWidth, yWidth)
DrawSprite(faceSprite, Transform(pos, rot), xWidth, yWidth, red, green, blue, spriteAlpha, false, false)
end
function GetValue(name)
if savedVars[name] == nil then
DebugPrint(toolReadableName.. " Error: " .. name .. " value not found!")
end
return savedVars[name].current
end
function SetValue(name, value)
if savedVars[name] == nil then
DebugPrint(toolReadableName.. " Error: " .. name .. " value not found!")
end
savedVars[name].current = value
end
function ResetValueToDefault(name)
if savedVars[name] == nil then
DebugPrint(toolReadableName.. " Error: " .. name .. " value not found!")
end
savedVars[name].current = savedVars[name].default
end
function ResetValuesToDefault()
for varName, varData in pairs(savedVars) do
ResetValueToDefault(varName)
end
end
|
local Chara = Elona.require("Chara")
local Enums = Elona.require("Enums")
local FOV = Elona.require("FOV")
local GUI = Elona.require("GUI")
local I18N = Elona.require("I18N")
local Math = Elona.require("Math")
local Skill = Elona.require("Skill")
local Rand = Elona.require("Rand")
local eating_effect = {}
local function eat_message(eater, locale_id, color)
local locale_key = "core.locale.food.effect.corpse." .. locale_id
if FOV.you_see(eater) then
GUI.txt(I18N.get(locale_key, eater), color)
end
end
local function mod_resist_chance(eater, elem, chance)
if Rand.one_in(chance) then
eater:modify_resistance(elem, 50)
end
end
function eating_effect.iron(eater)
eat_message(eater, "iron", Enums.Color.Purple)
eater:apply_ailment(Enums.StatusAilment.Dimmed, 200)
end
function eating_effect.deformed_eye(eater)
eat_message(eater, "deformed_eye", Enums.Color.Purple)
eater:modify_sanity(-25)
eater:apply_ailment(Enums.StatusAilment.Insane, 500)
end
function eating_effect.horse(eater)
eat_message(eater, "horse", Enums.Color.Green)
eater:gain_skill_exp("core.attribute_constitution", 100)
end
function eating_effect.holy_one(eater)
eat_message(eater, "holy_one", Enums.Color.Green)
eater:modify_sanity(-50)
mod_resist_chance(eater, Enums.Element.Mind, 5)
end
function eating_effect.at(eater)
eat_message(eater, "at", Enums.Color.None)
end
function eating_effect.guard(eater)
if not Chara.is_player(eater) then
return
end
eat_message(eater, "guard", Enums.Color.Purple)
eater:modify_karma(-15)
end
function eating_effect.vesda(eater)
if not Chara.is_player(eater) then
return
end
eat_message(eater, "vesda", Enums.Color.Green)
eater:modify_resistance(Enums.Element.Fire, 100)
end
function eating_effect.insanity(eater)
eat_message(eater, "insanity", Enums.Color.Purple)
eater:modify_resistance(Enums.Element.Mind, 50)
eater:modify_sanity(-500)
eater:apply_ailment(Enums.StatusAilment.Insane, 1000)
end
function eating_effect.putit(eater)
eat_message(eater, "putit", Enums.Color.Green)
eater:gain_skill_exp("core.attribute_charisma", 150)
end
function eating_effect.cupid_of_love(eater)
eat_message(eater, "cupid_of_love", Enums.Color.Green)
eater:gain_skill_exp("core.attribute_charisma", 400)
end
local function eating_effect_poisonous(gain_resist)
return function(eater)
eat_message(eater, "poisonous", Enums.Color.Purple)
eater:apply_ailment(Enums.StatusAilment.Poisoned, 100)
if gain_resist then
mod_resist_chance(eater, Enums.Element.Poison, 6)
end
end
end
eating_effect.cobra = eating_effect_poisonous(true)
eating_effect.poisonous = eating_effect_poisonous(false)
function eating_effect.troll(eater)
eat_message(eater, "troll", Enums.Color.Green)
eater:gain_skill_exp("core.healing", 200)
end
function eating_effect.rotten_one(eater)
eat_message(eater, "rotten_one", Enums.Color.Purple)
eater:eat_rotten_food()
end
function eating_effect.beetle(eater)
eat_message(eater, "beetle", Enums.Color.Green)
eater:gain_skill_exp("core.attribute_strength", 250)
end
function eating_effect.mandrake(eater)
eat_message(eater, "mandrake", Enums.Color.Green)
eater:gain_skill_exp("core.meditation", 500)
end
function eating_effect.grudge(eater)
eat_message(eater, "grudge", Enums.Color.Purple)
eater:apply_ailment(Enums.StatusAilment.Confused, 200)
end
function eating_effect.calm(eater)
eat_message(eater, "calm", Enums.Color.Green)
eater:modify_sanity(20)
end
function eating_effect.fire_crab(eater)
eating_effect.calm(eater)
mod_resist_chance(eater, Enums.Element.Fire, 5)
end
function eating_effect.fire_centipede(eater)
mod_resist_chance(eater, Enums.Element.Fire, 5)
end
function eating_effect.yith(eater)
eat_message(eater, "insanity", Enums.Color.Purple)
eater:modify_sanity(-50)
mod_resist_chance(eater, Enums.Element.Mind, 5)
end
function eating_effect.lightning(eater)
eat_message(eater, "lightning", Enums.Color.Purple)
eater:apply_ailment(Enums.StatusAilment.Paralyzed, 300)
end
function eating_effect.cat(eater)
if not Chara.is_player(eater) then
return
end
eat_message(eater, "cat", Enums.Color.None)
eater:modify_karma(-5)
end
function eating_effect.ether(eater)
if not Chara.is_player(eater) then
return
end
eat_message(eater, "ether", Enums.Color.Purple)
eater:modify_corruption(1000)
end
local function eating_effect_giant(amount)
return function(eater)
eat_message(eater, "giant", Enums.Color.Green)
eater:gain_skill_exp("core.attribute_constitution", amount)
end
end
eating_effect.cyclops = eating_effect_giant(500)
eating_effect.titan = eating_effect_giant(800)
function eating_effect.imp(eater)
eat_message(eater, "imp", Enums.Color.Green)
eater:gain_skill_exp("core.attribute_magic", 500)
end
function eating_effect.hand(eater)
eat_message(eater, "strength", Enums.Color.Green)
eater:gain_skill_exp("core.attribute_strength", 400)
end
function eating_effect.mammoth(eater)
eat_message(eater, "strength", Enums.Color.Green)
-- NOTE: doesn't apply anything?
end
local function eating_effect_ghost(amount)
return function(eater)
eat_message(eater, "ghost", Enums.Color.Green)
eater:gain_skill_exp("core.attribute_will", amount);
end
end
eating_effect.ghost = eating_effect_ghost(250)
eating_effect.nymph = eating_effect_ghost(400)
function eating_effect.quickling(eater)
eat_message(eater, "quickling", Enums.Color.Green)
local current = eater:get_skill("core.attribute_speed").current_level
local amount = Math.clamp(2500 - current * current / 10, 20, 2500)
eater:gain_skill_exp("core.attribute_speed", amount);
end
function eating_effect.alien(eater)
eat_message(eater, "alien", Enums.Color.None)
eater:make_pregnant()
end
function eating_effect.fire_ent(eater)
mod_resist_chance(eater, Enums.Element.Fire, 3)
end
function eating_effect.ice_ent(eater)
mod_resist_chance(eater, Enums.Element.Cold, 3)
end
function eating_effect.electric_cloud(eater)
mod_resist_chance(eater, Enums.Element.Lightning, 4)
end
function eating_effect.chaos_cloud(eater)
eat_message(eater, "chaos_cloud", Enums.Color.Purple)
eater:apply_ailment(Enums.StatusAilment.Confused, 300)
mod_resist_chance(eater, Enums.Element.Chaos, 5)
end
function eating_effect.floating_eye(eater)
eating_effect.lightning(eater)
mod_resist_chance(eater, Enums.Element.Nerve, 3)
end
function eating_effect.chaos_eye(eater)
eating_effect.lightning(eater)
mod_resist_chance(eater, Enums.Element.Chaos, 3)
end
function eating_effect.mad_gaze(eater)
eating_effect.lightning(eater)
mod_resist_chance(eater, Enums.Element.Mind, 3)
end
local function eating_effect_pumpkin(resist_gain_chance)
return function(eater)
mod_resist_chance(eater, Enums.Element.Mind, resist_gain_chance)
end
end
eating_effect.pumpkin = eating_effect_pumpkin(10)
eating_effect.greater_pumpkin = eating_effect_pumpkin(8)
eating_effect.halloween_nightmare = eating_effect_pumpkin(6)
function eating_effect.stalker(eater)
mod_resist_chance(eater, Enums.Element.Darkness, 4)
end
return eating_effect
|
local jwt = require "resty.jwt"
local json = require "guan.utils.json"
local BasePlugin = require("guan.plugins.base")
local ngx_re_gmatch = ngx.re.gmatch
local string_gsub = string.gsub
local function retrieve_token(request)
local authorization_header = request.get_headers()['authorization']
if authorization_header then
local iterator, iter_err = ngx_re_gmatch(authorization_header, "\\s*(Device|Token)\\s+(.+)")
if not iterator then
ngx.log(ngx.WARN, "cannot find token")
return nil, iter_err
end
local m, err = iterator()
if err then
return nil, err
end
if m and #m > 1 then
return m[2]
end
end
end
local JwtDecodePlugin = BasePlugin:extend()
function JwtDecodePlugin:new()
JwtDecodePlugin.super.new(self, "jwt-decode-plugin")
end
function JwtDecodePlugin:check_config(config)
local errors = {}
local secret = config.secret
if not secret then
errors[#errors+1] = "jwt-decode-plugin missing config: secret"
end
return #errors == 0, errors[1], errors
end
function JwtDecodePlugin:run(option)
JwtDecodePlugin.super.run(self)
if not option.secret then
ngx.log(ngx.WARN, "can not find jwt secret")
end
local access_token, err = retrieve_token(ngx.req)
if err then
ngx.exit(ngx.HTTP_UNAUTHORIZED)
end
local jwt_obj = jwt:verify(option.secret or '', access_token)
ngx.log(ngx.ERR, "jwt_obj.payload ", json.encode(jwt_obj.payload))
if not jwt_obj.verified then
ngx.log(ngx.ERR, "jwt token not verified: ", json.encode(jwt_obj))
ngx.exit(ngx.HTTP_UNAUTHORIZED)
end
ngx.log(ngx.ERR, "verified")
if jwt_obj.header.exp < ngx.now() then
ngx.log(ngx.ERR, "jwt token expired: ", json.encode(jwt_obj))
ngx.exit(ngx.HTTP_UNAUTHORIZED)
end
for k, v in pairs(jwt_obj.payload) do
local x_header = "x-" .. string_gsub(k, '_', '-')
ngx.log(ngx.DEBUG, "kv: " .. k .. v)
ngx.req.set_header(x_header, v)
end
end
return JwtDecodePlugin
|
--[[Dalliah the Doomsayer yells: Ahh... just what I needed.
Dalliah the Doomsayer yells: Completely ineffective. Just like someone else I know.
Dalliah the Doomsayer yells: Congratulations. I've wanted to do that for years.
Dalliah the Doomsayer yells: Don't worry about me; kill that worthless dullard instead!
Dalliah the Doomsayer yells: I suppose I'll end up fighting them all myself.
Dalliah the Doomsayer yells: I'll cut you to pieces!
Dalliah the Doomsayer yells: I've grown used to cleaning up your messes.
Dalliah the Doomsayer yells: It is unwise to anger me!
Dalliah the Doomsayer yells: More than you can handle, scryer?
Dalliah the Doomsayer yells: Now I'm really angry.
Dalliah the Doomsayer yells: Reap the whirlwind!
Dalliah the Doomsayer yells: That is much better.
Dalliah the Doomsayer yells: What would you know about commitment, sheet-sah?
Dalliah the Doomsayer yells: When I need someone to prance around like an overstuffed peacock, I'll call on you.
Dalliah the Doomsayer yells: Why would I call on you?
Dalliah the Doomsayer yells: You chose the wrong opponent.]]
function Dalliah(Unit, event, miscUnit, misc)
Unit:RegisterEvent("Dalliah_Red", 11000, 0)
Unit:RegisterEvent("Dalliah_Whirlwind_Heal", 21000, 0)
Unit:RegisterEvent("Dalliah_Doomsayer", 31000, 0)
end
function Dalliah_Red(Unit, event, miscUnit, misc)
Unit:FullCastSpellOnTarget(14264, Unit:GetClosestPlayer())
end
function Dalliah_Whirlwind_Heal(Unit)
Unit:FullCastSpell(36142)
end
function Dalliah_Doomsayer(Unit, event, miscUnit, misc)
Unit:FullCastSpellOnTarget(36173, Unit:GetClosestPlayer())
end
RegisterUnitEvent(20885, 1, "Dalliah")
|
DarthCaedusCave = ScreenPlay:new {
numberOfActs = 1,
screenplayName = "DarthCaedusCave"
}
registerScreenPlay("DarthCaedusCave", true)
function DarthCaedusCave:start()
if (isZoneEnabled("mandalore")) then
self:spawnMobiles()
end
end
function DarthCaedusCave:spawnMobiles()
--Cave of Darth Caedus
spawnMobile("mandalore", "darth_caedus_follower", 1800, 9.6, -15.6, -8.5, -47, 8566152)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 9.9, -23.8, -27.6, 0, 8566153)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -10.1, -30.9, -29.6, 71, 8566153)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -8.8, -38.6, -51.5, -3, 8566153)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 0.8, -40.9, -72.8, 122, 8566154)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -13.5, -40.9, -77.5, 51, 8566154)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 20.1, -43.1, -56.6, -127, 8566154)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 38.9, -45.9, -53.3, -112, 8566155)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 46.2, -47.1, -56.4, -89, 8566155)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 49.1, -46.1, -94.5, -48, 8566155)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 24.8, -45.7, -107.4, 48, 8566155)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 0.6, -45.2, -43.6, -35, 8566156)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -9.3, -45.5, -146.5, 30, 8566156)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -10.7, -44.9, -133.1, 80, 8566156)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 24.8, -49.0, -136.7, -22, 8566156)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 57.6, -49.5, -133.6, -67, 8566156)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 57.9, -55.7, -152.1, -116, 8566156)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 61.7, -56.6, -162.8, -71, 8566156)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 56.1, -56.7, -168.0, -18, 8566156)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 45.9, -56.6, -165.5, 8, 8566156)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 4.7, -64.1, -180.3, 98, 8566157)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -11.5, -65.2, -205.2, -8, 8566158)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -2.7, -64.1, -236.0, -23, 8566158)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -21.7, -65.6, -242.6, 64, 8566158)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -33.4, -66.3, -180.7, 89, 8566157)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -55.1, -70.8, -191.1, 6, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -68.2, -70.0, -198.4, 23, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -85.0, -69.9, -203.0, 82, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -110.2, -69.0, -205.3, 12, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -123.3, -69.8, -195.4, 61, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -122.0, -70.1, -178.3, 164, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -95.8, -72.2, -181.4, 26, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -95.5, -73.9, -168.0, 128, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -70.2, -70.7, -158.2, 154, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -100.9, -69.1, -138.9, 174, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -124.0, -69.7, -144.0, 174, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -111.4, -69.2, -119.4, 138, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -92.2, -70.4, -124.1, -158, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -86.4, -69.9, -97.8, -145, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -66.3, -68.4, -101.8, -97, 8566160)
spawnMobile("mandalore", "darth_caedus_follower", 1800, 68.2, -70.6, -86.3, -128, 8566160)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -35.0, -71.0, -87.7, -114, 8566160)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -19.9, -69.1, -98.4, -145, 8566160)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -38.9, -70.3, -108.6, -53, 8566160)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -24.5, -78.2, -133.7, -8, 8566161)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -48.4, -87.2, -146.7, 80, 8566161)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -76.3, -99.3, -156.4, 34, 8566159)
spawnMobile("mandalore", "darth_caedus_follower", 1800, -79.2, -100.6, -136.5, 116, 8566159)
spawnMobile("mandalore", "darth_caedus", 10800, -91.1, -100.7, -95.8, 170, 8566162)
end
|
local Modules = game:GetService("Players").LocalPlayer.PlayerGui.AvatarEditorInGame.Modules
local Roact = require(Modules.Packages.Roact)
local UIBlox = require(Modules.Packages.UIBlox)
local withStyle = UIBlox.Style.withStyle
local withLocalization = require(Modules.Packages.Localization.withLocalization)
local ImageSetLabel = UIBlox.Core.ImageSet.Label
local Images = UIBlox.App.ImageSet.Images
local FitChildren = require(Modules.NotLApp.FitChildren)
local BodySizeSlider = require(Modules.AvatarExperience.AvatarEditor.Components.BodySizeSlider)
local ICON_SIZE = 36
local TALL_IMAGE_SET = Images["icons/menu/body_tall"]
local THIN_IMAGE_SET = Images["icons/menu/body_thin"]
local HEAVY_IMAGE_SET = Images["icons/menu/body_heavy"]
local SHORT_IMAGE_SET = Images["icons/menu/body_short"]
local BodySizeRadar = Roact.PureComponent:extend("BodySizeRadar")
function BodySizeRadar:render()
return withStyle(function(stylePalette)
return withLocalization({
bodySize = "Feature.Avatar.Label.BodySize",
})(function(localized)
local lockNavigationCallback = self.props.lockNavigationCallback
local unlockNavigationCallback = self.props.unlockNavigationCallback
local layoutOrder = self.props.LayoutOrder
local fontInfo = stylePalette.Font
local theme = stylePalette.Theme
local font = fontInfo.Header2.Font
local fontSize = fontInfo.BaseSize * fontInfo.Header2.RelativeSize
return Roact.createElement(FitChildren.FitFrame, {
Size = UDim2.new(1, 0, 0, 0),
BackgroundTransparency = 1,
LayoutOrder = layoutOrder,
fitAxis = FitChildren.FitAxis.Height,
}, {
UIListLayout = Roact.createElement("UIListLayout", {
Padding = UDim.new(0, 24),
FillDirection = Enum.FillDirection.Vertical,
SortOrder = Enum.SortOrder.LayoutOrder,
HorizontalAlignment = Enum.HorizontalAlignment.Center,
}),
BodySizeLabel = Roact.createElement("TextLabel", {
Size = UDim2.new(1, 0, 0, fontSize),
BackgroundTransparency = 1,
Text = localized.bodySize,
TextSize = fontSize,
TextColor3 = theme.TextDefault.Color,
TextTransparency = theme.TextDefault.TextTransparency,
TextXAlignment = Enum.TextXAlignment.Left,
LayoutOrder = 1,
Font = font,
}),
BodySizeContainer = Roact.createElement(FitChildren.FitFrame, {
Size = UDim2.new(1, 0, 0, 0),
BackgroundTransparency = 1,
LayoutOrder = 2,
fitAxis = FitChildren.FitAxis.Height,
}, {
UIListLayout = Roact.createElement("UIListLayout", {
Padding = UDim.new(0, 8),
FillDirection = Enum.FillDirection.Vertical,
SortOrder = Enum.SortOrder.LayoutOrder,
HorizontalAlignment = Enum.HorizontalAlignment.Center,
}),
TallIcon = Roact.createElement(ImageSetLabel, {
AnchorPoint = Vector2.new(0, 0.5),
LayoutOrder = 1,
Size = UDim2.new(0, ICON_SIZE, 0, ICON_SIZE),
BackgroundTransparency = 1,
ImageColor3 = theme.IconEmphasis.Color,
Image = TALL_IMAGE_SET,
}),
Wrapper = Roact.createElement(FitChildren.FitFrame, {
Size = UDim2.new(1, 0, 0, 0),
BackgroundTransparency = 1,
LayoutOrder = 2,
fitAxis = FitChildren.FitAxis.Height,
}, {
UIListLayout = Roact.createElement("UIListLayout", {
FillDirection = Enum.FillDirection.Horizontal,
SortOrder = Enum.SortOrder.LayoutOrder,
HorizontalAlignment = Enum.HorizontalAlignment.Center,
VerticalAlignment = Enum.VerticalAlignment.Center,
}),
ThinIcon = Roact.createElement(ImageSetLabel, {
AnchorPoint = Vector2.new(0, 0.5),
LayoutOrder = 1,
Size = UDim2.new(0, ICON_SIZE, 0, ICON_SIZE),
BackgroundTransparency = 1,
ImageColor3 = theme.IconEmphasis.Color,
Image = THIN_IMAGE_SET,
}),
BodySize = Roact.createElement(BodySizeSlider, {
LayoutOrder = 2,
lockNavigationCallback = lockNavigationCallback,
unlockNavigationCallback = unlockNavigationCallback,
}),
HeavyIcon = Roact.createElement(ImageSetLabel, {
AnchorPoint = Vector2.new(0, 0.5),
LayoutOrder = 3,
Size = UDim2.new(0, ICON_SIZE, 0, ICON_SIZE),
ImageColor3 = theme.IconEmphasis.Color,
BackgroundTransparency = 1,
Image = HEAVY_IMAGE_SET,
}),
}),
ShortIcon = Roact.createElement(ImageSetLabel, {
AnchorPoint = Vector2.new(0, 0.5),
LayoutOrder = 3,
Size = UDim2.new(0, ICON_SIZE, 0, ICON_SIZE),
BackgroundTransparency = 1,
ImageColor3 = theme.IconEmphasis.Color,
Image = SHORT_IMAGE_SET,
}),
}),
})
end)
end)
end
return BodySizeRadar
|
--[[
This file was extracted by 'EsoLuaGenerator' at '2021-09-04 16:42:29' using the latest game version.
NOTE: This file should only be used as IDE support; it should NOT be distributed with addons!
****************************************************************************
CONTENTS OF THIS FILE IS COPYRIGHT ZENIMAX MEDIA INC.
****************************************************************************
]]
--------------------------------
-- ZO_Pregame_Settings_Keyboard
--------------------------------
ZO_Pregame_Settings_Keyboard = ZO_Object:Subclass()
function ZO_Pregame_Settings_Keyboard:New(...)
local object = ZO_Object.New(self)
object:Initialize(...)
return object
end
function ZO_Pregame_Settings_Keyboard:Initialize(control)
self.control = control
self.settingsCategories = ZO_GameMenuManager_GetVisibleSettingsEntries()
local subcategoriesMenuControl = control:GetNamedChild("Subcategory")
self.subcategoriesMenu = ZO_Horizontal_Menu:New(subcategoriesMenuControl, ZO_HORIZONAL_MENU_ALIGN_CENTER)
subcategoriesMenuControl:SetAnchor(BOTTOM, ZO_OptionsWindow:GetNamedChild("Divider"), TOP)
SETTINGS_FRAGMENT = ZO_FadeSceneFragment:New(control)
SETTINGS_FRAGMENT:RegisterCallback("StateChange", function(oldState, newState)
if newState == SCENE_FRAGMENT_SHOWING then
self:ShowSettings()
elseif newState == SCENE_FRAGMENT_HIDDEN then
self:HideSettings()
end
end)
local function OnHorizontalMenuItemSetup(menuControl, data)
menuControl:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
local name = data.name
if type(data.name) == "function" then
name = data.name()
end
menuControl:SetText(name)
end
local HORIZONTAL_SPACING = 30
self.subcategoriesMenu:AddTemplate("ZO_Pregame_Settings_Keyboard_Subcategory_Label", OnHorizontalMenuItemSetup, HORIZONTAL_SPACING)
end
function ZO_Pregame_Settings_Keyboard:UpdateSettingsDisplay(isShown)
local optionsBackground = ZO_OptionsWindow:GetNamedChild("BGLeft")
local optionsTitle = ZO_OptionsWindow:GetNamedChild("Title")
optionsBackground:SetHidden(isShown)
optionsTitle:SetHidden(isShown)
end
function ZO_Pregame_Settings_Keyboard:BuildSubcategoriesMenu()
if not self.isSubcategoriesMenuBuilt then
for i, subcategory in ipairs(self.settingsCategories) do
local function OnSelectionCallback(control)
subcategory.callback(control, ZO_ReanchorControlTopHorizontalMenu)
end
self.subcategoriesMenu:AddMenuItem(subcategory.name, subcategory.name, OnSelectionCallback, subcategory.unselectedCallback)
end
self.isSubcategoriesMenuBuilt = true
end
end
function ZO_Pregame_Settings_Keyboard:ShowSettings()
self:BuildSubcategoriesMenu()
-- Select first sub category by default when showing settings
if #self.settingsCategories > 0 then
self.subcategoriesMenu:SetSelectedByIndex(1)
end
local SHOW_SETTINGS = true
self:UpdateSettingsDisplay(SHOW_SETTINGS)
end
function ZO_Pregame_Settings_Keyboard:SetOnExitCallback(onExitCallback)
self.onExitCallback = onExitCallback
end
function ZO_Pregame_Settings_Keyboard:HideSettings()
self.subcategoriesMenu:SetSelectedByIndex(nil)
local HIDE_SETTINGS = false
self:UpdateSettingsDisplay(HIDE_SETTINGS)
if self.onExitCallback then
self.onExitCallback()
end
end
-- Global XML
function ZO_Pregame_Settings_Keyboard_Initialized(control)
PREGAME_SETTINGS_KEYBOARD = ZO_Pregame_Settings_Keyboard:New(control)
end
function ZO_Pregame_Settings_Keyboard_Subcategory_Label_MouseUp(self, upInside)
if upInside then
PREGAME_SETTINGS_KEYBOARD.subcategoriesMenu:SetSelectedByIndex(self.data.index)
end
end
function ZO_Pregame_Settings_Keyboard_OnMouseUp(upInside)
if upInside then
PREGAME_SETTINGS_KEYBOARD:HideSettings()
end
end
|
local authorize = require 'http.middleware.authorize'
local request = require 'http.functional.request'
local writer = require 'http.functional.response'
local describe, it, assert = describe, it, assert
describe('http.middleware.authorize', function()
it('extends time left', function()
local options = {
auth_cookie = {name = '_a'},
ticket = {
max_age = 15,
decode = function(self, c)
assert.equals('cookie', c)
return '1', 5
end,
encode = function(self, p)
assert.equals('1', p)
return '2'
end
}
}
local app = authorize(function() end, options)
local w = writer.new()
local req = request.new {
headers = {
cookie = '_a=cookie'
}
}
app(w, req)
assert.equals('_a=2; Path=/; HttpOnly', w.headers['Set-Cookie'])
end)
end)
|
local os, string, table = os, string, table
local gears = require('gears')
local glib = require('lgi')
local Container = require('sanity/util/container')
local text = require('sanity/util/text')
local DateTime = glib.GLib.DateTime
local TimeZone = glib.GLib.TimeZone
local spawn = require('awful.spawn')
local markup = require('lain.util.markup')
local textbox = require('wibox.widget.textbox')
-- http://man7.org/linux/man-pages/man3/strptime.3.html
local date_fmt = '%a %m/%d %I:%M'
local refresh = 60
local text_color = colors.white
local function calc_timeout()
return refresh - os.time() % refresh
end
local date_text = textbox()
function strip_leading_zero(s)
return s:gsub('^0', '', 1)
end
local clock_container = Container {
widget = date_text,
color = text_color,
}
local cal_table = {}
local timer
function clock_update()
local now = DateTime.new_now(TimeZone.new_local())
date_text:set_markup(markup.fg.color(text_color, strip_leading_zero(now:format(date_fmt))))
spawn.easy_async_with_shell('cal | tail -n +2', function(stdout)
local cal_table_idx = 1
local split_stdout = text.split(text.trim_end(stdout), '\n')
for i=1, #split_stdout do
cal_table[cal_table_idx] = '\n'
cal_table[cal_table_idx+1] = ' '
cal_table[cal_table_idx+2] = split_stdout[i]
cal_table[cal_table_idx+3] = ' '
cal_table_idx = cal_table_idx + 4
end
local padded_cal = table.concat(cal_table, '', 1, cal_table_idx-1)
local dom_str = string.format(' %s ', strip_leading_zero(now:format('%d')))
padded_cal = padded_cal:gsub(
dom_str,
markup.fg.color(colors.blue, dom_str)
)
clock_container:set_markup(
string.format(
'%s\n%s',
now:format(' %I:%M %p %Z (%z) \n %A %B %d '),
padded_cal
)
)
end)
timer.timeout = calc_timeout()
return true
end
timer = gears.timer.weak_start_new(refresh, clock_update)
timer:emit_signal('timeout')
return clock_container
|
local Attributor = {}
Attributor.__index = Attributor
function Attributor:getAttr(node, attrName)
local node_ = node
if node.__isPocoNodeWrapper__ == nil then
node_ = node[1]
end
return node_:getAttr(attrName)
end
function Attributor:setAttr(node, attrName, attrVal)
local node_ = node
if node.__isPocoNodeWrapper__ == nil then
node_ = node[1]
end
node_:setAttr(attrName, attrVal)
end
return Attributor
|
local M = {}
local sched=require 'sched'
local toribio = require 'toribio'
M.init = function(conf)
sched.run(function()
local file = io.open(conf.outfile or 'data.log', 'w')
local motor = toribio.wait_for_device(conf.motorname)
while true do
local l = motor:get_load()
print(l)
file:write(l..'\n')
file:flush()
sched.sleep(conf.interval or 5)
end
end)
end
return M
|
invoker_ghost_walk_lua = class({})
LinkLuaModifier( "modifier_invoker_ghost_walk_lua", "lua_abilities/invoker_ghost_walk_lua/modifier_invoker_ghost_walk_lua", LUA_MODIFIER_MOTION_NONE )
LinkLuaModifier( "modifier_invoker_ghost_walk_lua_debuff", "lua_abilities/invoker_ghost_walk_lua/modifier_invoker_ghost_walk_lua_debuff", LUA_MODIFIER_MOTION_NONE )
--------------------------------------------------------------------------------
-- Ability Start
function invoker_ghost_walk_lua:OnSpellStart()
-- unit identifier
local caster = self:GetCaster()
-- load data
local duration = self:GetSpecialValueFor("duration")
-- add modifier
caster:AddNewModifier(
caster, -- player source
self, -- ability source
"modifier_invoker_ghost_walk_lua", -- modifier name
{ duration = duration } -- kv
)
-- Effects
self:PlayEffects()
end
function invoker_ghost_walk_lua:PlayEffects()
-- Get Resources
local particle_cast = "particles/units/heroes/hero_invoker/invoker_ghost_walk.vpcf"
local sound_cast = "Hero_Invoker.GhostWalk"
-- Create Particle
local effect_cast = ParticleManager:CreateParticle( particle_cast, PATTACH_ABSORIGIN_FOLLOW, self:GetCaster() )
ParticleManager:ReleaseParticleIndex( effect_cast )
-- Create Sound
EmitSoundOn( sound_cast, self:GetCaster() )
end
|
ghomrassen_giant_canyon_krayt_dragon_lair_neutral_large = Lair:new {
mobiles = {{"gr_giant_canyon_krayt_dragon",1},{"gr_canyon_krayt_dragon",2}},
spawnLimit = 9,
buildingsVeryEasy = {"object/tangible/lair/base/poi_all_lair_bones_large_evil_fire_red.iff"},
buildingsEasy = {"object/tangible/lair/base/poi_all_lair_bones_large_evil_fire_red.iff"},
buildingsMedium = {"object/tangible/lair/base/poi_all_lair_bones_large_evil_fire_red.iff"},
buildingsHard = {"object/tangible/lair/base/poi_all_lair_bones_large_evil_fire_red.iff"},
buildingsVeryHard = {"object/tangible/lair/base/poi_all_lair_bones_large_evil_fire_red.iff"},
}
addLairTemplate("ghomrassen_giant_canyon_krayt_dragon_lair_neutral_large", ghomrassen_giant_canyon_krayt_dragon_lair_neutral_large)
|
--// services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
--// modules
local EZReplicator = require(ReplicatedStorage:WaitForChild("EZReplicator"))
--// wait for main subscription
local MAIN_SUBSCRIPTION = EZReplicator:WaitForSubscription("MAIN")
--// detect when a property has been changed in the MAIN subscription
--// this basically logs any changes made to the subscription
MAIN_SUBSCRIPTION.PropertyChanged:Connect(function(propIndex, propValue)
print(tostring(propIndex) .. ": " .. tostring(propValue))
end)
|
-- This example shows how to create a new sprite stacking all the
-- other sprites each in one layer.
if #app.sprites < 1 then
return app.alert "You should have at least one sprite opened"
end
local bounds = Rectangle()
for i,sprite in ipairs(app.sprites) do
bounds = bounds:union(sprite.bounds)
end
local function getTitle(filename)
return filename:match("^.+/(.+)$")
end
local newSprite = Sprite(bounds.width, bounds.height)
local firstLayer = newSprite.layers[1]
newSprite:deleteCel(newSprite.cels[1])
for i,sprite in ipairs(app.sprites) do
if sprite ~= newSprite then
while #newSprite.frames < #sprite.frames do
newSprite:newEmptyFrame()
end
local newLayer = newSprite:newLayer()
newLayer.name = getTitle(sprite.filename)
for j,frame in ipairs(sprite.frames) do
local cel = newSprite:newCel(newLayer, frame)
cel.image:drawSprite(sprite, frame)
end
end
end
newSprite:deleteLayer(firstLayer)
app.activeFrame = 1
|
local Source = {}
Source.new = function()
return setmetatable({}, { __index = Source })
end
Source.get_metadata = function(_)
return {
priority = 100;
dup = 1;
menu = '[Omni]';
}
end
Source.determine = function(self, context)
if vim.bo.omnifunc == '' then
return nil
end
local keyword_pattern_offset = self:_call(vim.bo.omnifunc, { 1, '' })
if keyword_pattern_offset == -2 or keyword_pattern_offset == -3 then
return nil
end
keyword_pattern_offset = math.min(keyword_pattern_offset, context.col - 1) + 1
local trigger_character_offset = 0
if not string.match(string.sub(context.before_line, -1, -1), '%a') then
trigger_character_offset = keyword_pattern_offset
end
return {
keywod_pattern_offset = keyword_pattern_offset,
trigger_character_offset = trigger_character_offset,
}
end
Source.complete = function(self, args)
local items = self:_call(vim.bo.omnifunc, { 0, args.input })
if type(items) ~= 'table' then
return args.abort()
end
args.callback({ items = items })
end
Source._call = function(_, func, args)
local prev_pos = vim.api.nvim_win_get_cursor(0)
local _, result = pcall(function()
return vim.api.nvim_call_function(func, args)
end)
local next_pos = vim.api.nvim_win_get_cursor(0)
if prev_pos[1] ~= next_pos[1] or prev_pos[2] ~= next_pos[2] then
vim.api.nvim_win_set_cursor(0, prev_pos)
end
return result
end
return Source.new()
|
local ffi = require("ffi")
local C = ffi.load('./libcogshared')
ffi.cdef[[
//cog_types.h
//types
typedef int cog_anim_id;
typedef int cog_snd_id;
typedef int cog_sprite_id;
typedef int cog_text_id;
typedef int cog_text_multiline_id;
typedef void* cog_dataptr;
typedef char* cog_string;
typedef struct cog_pos2 {
double x;
double y;
} cog_pos2;
typedef struct cog_vec2 {
double x;
double y;
} cog_vec2;
typedef struct cog_dim2 {
double w;
double h;
} cog_dim2;
typedef struct cog_color {
double r;
double g;
double b;
double a;
} cog_color;
//cog_list.h
typedef struct cog_list {
struct cog_list* next;
cog_dataptr data;
uint32_t size; //size of data member
} cog_list;
//List structure:
// NULL -> a0 -> a1 -> a2 -> a3 ->|
// / \ |
// |-----------------------------|
// The first element has COG_LIST_ENDSENTINAL as its data field.
// The last element is a pointer to the first element again, thereby acting as a sentinal to for loops.
//
//Memory:
// All data members are alloced and dealloced by the list data structure.
// Do not rely on these data values lying around for reference elsewhere.
cog_list* cog_list_alloc(uint32_t size);
void cog_list_init(cog_list* list, uint32_t size);
//----------------------------------------------------------------------
// Adds data to this list. List will handle freeing data.
//----------------------------------------------------------------------
void cog_list_append(cog_list* list, cog_dataptr data);
//----------------------------------------------------------------------
// Removes elem w/ data == data in this list.
//----------------------------------------------------------------------
void cog_list_remove(cog_list* list, cog_dataptr data);
//----------------------------------------------------------------------
// Empties list and frees data.
//----------------------------------------------------------------------
void cog_list_removeall(cog_list* list);
//----------------------------------------------------------------------
// Returns: Length of list.
//----------------------------------------------------------------------
uint32_t cog_list_len(cog_list* list);
//----------------------------------------------------------------------
// Pops the front element of the list and returns it.
//----------------------------------------------------------------------
cog_dataptr cog_list_pop(cog_list* list);
//cog_main.h
bool cog_hasquit();
void cog_init();
void cog_loopstep();
void cog_mainloop();
void cog_quit();
//cog_anim.h
typedef struct {
cog_anim_id id;
uint32_t layer;
uint32_t current_frame;
uint32_t current_frame_millis;
cog_list frames;
uint32_t n_frames;
//User attributes
uint32_t transition_millis;
bool looped;
bool paused;
cog_pos2 pos;
cog_dim2 dim;
double rot;
cog_vec2 vel;
double ang_vel;
bool finished;
} cog_anim;
cog_anim_id cog_anim_add(const char* anim_img, int n_frames);
bool cog_anim_collides_anim(cog_anim_id id0, cog_anim_id id1);
bool cog_anim_collides_sprite(cog_anim_id id0, cog_sprite_id id1);
cog_anim* cog_anim_get(cog_anim_id);
void cog_anim_remove(cog_anim_id id);
void cog_anim_removeall(void);
void cog_anim_set(cog_anim_id id, cog_anim src);
void cog_anim_set_frames(cog_anim_id id, int frame0, ...);
/*-----------------------------------------------------------------------------
* Internal
*-----------------------------------------------------------------------------*/
double cog_anim_dist_anim(cog_anim_id id0, cog_anim_id id1);
double cog_anim_dist_sprite(cog_anim_id id0, cog_sprite_id id1);
void cog_anim_draw_layer(uint32_t layer);
void cog_anim_init();
void cog_anim_update(uint32_t deltamillis);
void cog_snd_init(void);
cog_snd_id cog_snd_add(const char* fname);
void cog_snd_play(cog_snd_id id);
void cog_snd_play_sfx(cog_snd_id snd);
void cog_snd_play_music(cog_snd_id snd);
void cog_snd_stop(cog_snd_id id);
void cog_snd_stopall();
//cog_sprite.h
typedef int GLuint;
typedef struct {
cog_sprite_id id;
uint32_t layer;
GLuint tex_id;
//These are the coords and dimensions of the sprite within the image.
//(Can have multiple sprites per image - cog_anims are implemented using this)
cog_pos2 tex_pos;
cog_dim2 tex_dim;
//User attributes
cog_pos2 pos;
cog_dim2 dim;
double rot;
cog_vec2 vel;
double ang_vel;
} cog_sprite;
cog_sprite_id cog_sprite_add(const char* img);
cog_sprite_id cog_sprite_add_inactive(const char* img);
bool cog_sprite_collides_sprite(cog_sprite_id id0, cog_sprite_id id1);
cog_sprite* cog_sprite_get(cog_sprite_id);
void cog_sprite_remove(cog_sprite_id id);
void cog_sprite_removeall(void);
void cog_sprite_set(cog_sprite_id id, cog_sprite src);
]]
cog = {}
cog.init = C.cog_init
cog.loopstep = C.cog_loopstep
cog.mainloop = C.cog_mainloop
cog.hasquit = C.cog_hasquit
cog.quit = C.cog_quit
cog.dim2 = {}
function cog.dim2.new(w, h) return ffi.new("cog_dim2", w, h) end
cog.vec2 = {}
function cog.vec2.new(x, y) return ffi.new("cog_vec2", x, y) end
cog.pos2 = {}
function cog.pos2.new(x, y) return ffi.new("cog_pos2", x, y) end
cog.anim = {}
cog.anim.add = C.cog_anim_add
cog.anim.get = C.cog_anim_get
function cog.anim.new() return ffi.new("cog_anim") end
cog.anim.set = C.cog_anim_set
cog.anim.set_frames = C.cog_anim_set_frames
cog.sprite = {}
cog.sprite.add = C.cog_sprite_add
cog.sprite.get = C.cog_sprite_get
function cog.sprite.new() return ffi.new("cog_sprite") end
cog.sprite.set = C.cog_sprite_set
cog.snd = {}
cog.snd.add = C.cog_snd_add
cog.snd.play = C.cog_snd_play
return cog
--return C
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.