content
stringlengths 5
1.05M
|
|---|
MOVE = function (x, y)
print("[LUA] MOVE " .. x .. " " .. y)
c = inlua_move_player(manager, x, y)
print("[LUA] C move function returned: " .. c)
--call move function in C++
end
|
--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements. See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License. You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
local core = require("apisix.core")
local log_util = require("apisix.utils.log-util")
local producer = require ("resty.rocketmq.producer")
local acl_rpchook = require("resty.rocketmq.acl_rpchook")
local bp_manager_mod = require("apisix.utils.batch-processor-manager")
local plugin = require("apisix.plugin")
local type = type
local plugin_name = "rocketmq-logger"
local batch_processor_manager = bp_manager_mod.new("rocketmq logger")
local ngx = ngx
local lrucache = core.lrucache.new({
type = "plugin",
})
local schema = {
type = "object",
properties = {
meta_format = {
type = "string",
default = "default",
enum = {"default", "origin"},
},
nameserver_list = {
type = "array",
minItems = 1,
items = {
type = "string"
}
},
topic = {type = "string"},
key = {type = "string"},
tag = {type = "string"},
timeout = {type = "integer", minimum = 1, default = 3},
use_tls = {type = "boolean", default = false},
access_key = {type = "string", default = ""},
secret_key = {type = "string", default = ""},
include_req_body = {type = "boolean", default = false},
include_req_body_expr = {
type = "array",
minItems = 1,
items = {
type = "array",
items = {
type = "string"
}
}
},
include_resp_body = {type = "boolean", default = false},
include_resp_body_expr = {
type = "array",
minItems = 1,
items = {
type = "array",
items = {
type = "string"
}
}
},
},
required = {"nameserver_list", "topic"}
}
local metadata_schema = {
type = "object",
properties = {
log_format = log_util.metadata_schema_log_format,
},
}
local _M = {
version = 0.1,
priority = 402,
name = plugin_name,
schema = batch_processor_manager:wrap_schema(schema),
metadata_schema = metadata_schema,
}
function _M.check_schema(conf, schema_type)
if schema_type == core.schema.TYPE_METADATA then
return core.schema.check(metadata_schema, conf)
end
local ok, err = core.schema.check(schema, conf)
if not ok then
return nil, err
end
return log_util.check_log_schema(conf)
end
local function create_producer(nameserver_list, producer_config)
core.log.info("create new rocketmq producer instance")
local prod = producer.new(nameserver_list, "apisixLogProducer")
if producer_config.use_tls then
prod:setUseTLS(true)
end
if producer_config.access_key ~= '' then
local aclHook = acl_rpchook.new(producer_config.access_key, producer_config.secret_key)
prod:addRPCHook(aclHook)
end
prod:setTimeout(producer_config.timeout)
return prod
end
local function send_rocketmq_data(conf, log_message, prod)
local result, err = prod:send(conf.topic, log_message, conf.tag, conf.key)
if not result then
return false, "failed to send data to rocketmq topic: " .. err ..
", nameserver_list: " .. core.json.encode(conf.nameserver_list)
end
core.log.info("queue: ", result.sendResult.messageQueue.queueId)
return true
end
function _M.body_filter(conf, ctx)
log_util.collect_body(conf, ctx)
end
function _M.log(conf, ctx)
local entry
if conf.meta_format == "origin" then
entry = log_util.get_req_original(ctx, conf)
else
local metadata = plugin.plugin_metadata(plugin_name)
core.log.info("metadata: ", core.json.delay_encode(metadata))
if metadata and metadata.value.log_format
and core.table.nkeys(metadata.value.log_format) > 0
then
entry = log_util.get_custom_format_log(ctx, metadata.value.log_format)
core.log.info("custom log format entry: ", core.json.delay_encode(entry))
else
entry = log_util.get_full_log(ngx, conf)
core.log.info("full log entry: ", core.json.delay_encode(entry))
end
end
if batch_processor_manager:add_entry(conf, entry) then
return
end
-- reuse producer via lrucache to avoid unbalanced partitions of messages in rocketmq
local producer_config = {
timeout = conf.timeout * 1000,
use_tls = conf.use_tls,
access_key = conf.access_key,
secret_key = conf.secret_key,
}
local prod, err = core.lrucache.plugin_ctx(lrucache, ctx, nil, create_producer,
conf.nameserver_list, producer_config)
if err then
return nil, "failed to create the rocketmq producer: " .. err
end
core.log.info("rocketmq nameserver_list[1] port ",
prod.client.nameservers[1].port)
-- Generate a function to be executed by the batch processor
local func = function(entries, batch_max_size)
local data, err
if batch_max_size == 1 then
data = entries[1]
if type(data) ~= "string" then
data, err = core.json.encode(data) -- encode as single {}
end
else
data, err = core.json.encode(entries) -- encode as array [{}]
end
if not data then
return false, 'error occurred while encoding the data: ' .. err
end
core.log.info("send data to rocketmq: ", data)
return send_rocketmq_data(conf, data, prod)
end
batch_processor_manager:add_entry_to_new_processor(conf, entry, ctx, func)
end
return _M
|
--[[-----------------------------------------------------------------------------------------------------------------------
Teleport a player
-----------------------------------------------------------------------------------------------------------------------]]--
local PLUGIN = {}
PLUGIN.Title = "Teleport"
PLUGIN.Description = "Teleport a player."
PLUGIN.Author = "Overv & Divran"
PLUGIN.ChatCommand = "tp"
PLUGIN.Usage = "[players]"
PLUGIN.Privileges = { "Teleport" }
function PLUGIN:Call( ply, args )
if ( ply:EV_HasPrivilege( "Teleport" ) and ply:IsValid() ) then
local players = evolve:FindPlayer( args, ply )
if (#players > 0) then
local size = Vector( 32, 32, 72 )
local tr = {}
tr.start = ply:GetShootPos()
tr.endpos = ply:GetShootPos() + ply:GetAimVector() * 100000000
tr.filter = ply
local trace = util.TraceEntity( tr, ply )
local EyeTrace = ply:GetEyeTraceNoCursor()
if (trace.HitPos:Distance(EyeTrace.HitPos) > size:Length()) then -- It seems the player wants to teleport through a narrow spot... Force them there even if there is something in the way.
trace = EyeTrace
trace.HitPos = trace.HitPos + trace.HitNormal * size * 1.2
end
size = size * 1.5
for i, pl in ipairs( players ) do
if ( pl:InVehicle() ) then pl:ExitVehicle() end
pl:SetPos( trace.HitPos + trace.HitNormal * ( i - 1 ) * size )
pl:SetLocalVelocity( Vector( 0, 0, 0 ) )
end
evolve:Notify( evolve.colors.blue, ply:Nick(), evolve.colors.white, " has teleported ", evolve.colors.red, evolve:CreatePlayerList( players ), evolve.colors.white, "." )
else
evolve:Notify( ply, evolve.colors.red, evolve.constants.noplayers )
end
else
evolve:Notify( ply, evolve.colors.red, evolve.constants.notallowed )
end
end
function PLUGIN:Menu( arg, players )
if ( arg ) then
RunConsoleCommand( "ev", "tp", unpack( players ) )
else
return "Teleport", evolve.category.teleportation
end
end
evolve:RegisterPlugin( PLUGIN )
|
local currentChapter = nil
-- Reassigns identifiers for all all Headers level 2 and higher. Level 2 Headers
-- correspond to chapters, and are identified by the first word in their content
-- field. Headers of level more than 2 are identified by "#<chapter>-<anchor>",
-- where "<chapter>" is the identifier of the chapter this header is nested in,
-- and "<anchor>" is this Header's existing identifier.
function Header (el)
if el.level == 2 then
local title = pandoc.utils.stringify(el.content[1])
currentChapter = title:match("%w+")
el.identifier = currentChapter
elseif el.level > 2 then
el.identifier = currentChapter .. '-' .. el.identifier
end
return el
end
-- Performs the following transformations on Link targets:
--
-- Case 1:
-- [text]({{ site.baseurl }}/chapter/#more-stuff) -> [text](#chapter-more-stuff)
--
-- Case 2:
-- [text]({{ site.baseurl }}/chapter/) -> [text](#chapter)
--
-- All other Links are ignored.
function Link (el)
local n
-- When parsing a markdown link such as "[stuff]({{ site.baseurl }}/Naturals",
-- pandoc encodes the link's URL with percent-encoding, resulting in the
-- link "[stuff](%7B%7B%20site.baseurl%20%7D%7D/Naturals)".
local baseurl = "%%7B%%7B%%20site%.baseurl%%20%%7D%%7D"
el.target, n = el.target:gsub("^" .. baseurl .. "/(%w+)/#([%w-]+)$", -- case 1
"#%1-%2")
if n == 0 then
el.target = el.target:gsub("^" .. baseurl .. "/(%w+)/$", -- case 2
"#%1")
end
return el
end
|
newoption {
trigger = "name",
value = "unnamed",
description = "Project name.",
}
if not _OPTIONS["name"] then error("missing name option") end
newoption {
trigger = "location",
value = "./",
description = "Where to generate the project.",
}
if not _OPTIONS["location"] then
_OPTIONS["location"] = "./"
end
location_dir = _OPTIONS["location"]
include(location_dir .. "conanbuildinfo.premake.lua")
project_name = _OPTIONS["name"]
function setup_pch()
local header = project_name .. "_precompiled.h"
pchheader(header)
pchsource "src/precompiled.cpp"
forceincludes{ header }
end
workspace(project_name)
location(location_dir)
conan_basic_setup()
project(project_name)
kind "ConsoleApp"
language "C++"
cppdialect "C++17"
targetdir = location_dir .. "bin/%{cfg.buildcfg}"
targetname("sfid")
files{
"src/**",
}
includedirs{
"src",
path.getabsolute("../lib/src"),
}
setup_pch()
links{"SFID"}
flags{"MultiProcessorCompile"}
defines{"_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS"}
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
externalproject "SFID"
location ("../../build/lib-" .. conan_build_type .. "/")
kind "StaticLib"
language "C++"
-- tests
function add_test(name)
project("test-" .. name)
files{
"tests/".. name .. "/**",
"src/precompiled.cpp"
}
kind "ConsoleApp"
language "C++"
cppdialect "C++17"
targetdir = location_dir .. "bin/%{cfg.buildcfg}"
includedirs{
"src",
}
setup_pch()
flags{"MultiProcessorCompile"}
links{"SFID"}
defines{"_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS"}
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
end
test_dirs = os.matchdirs("./tests/*")
for k,v in pairs(test_dirs) do
add_test( string.sub(v, string.len("tests/") + 1) )
end
|
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
-- Setup nvim-cmp.
local cmp = require'cmp'
local lspkind = require'lspkind'
cmp.setup({
snippet = {
expand = function(args)
-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` user.
-- require('luasnip').lsp_expand(args.body) -- For `luasnip` user.
vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` user.
end,
},
formatting = {
format = lspkind.cmp_format {
-- enables text annotations
-- default: true
with_text = true,
-- default symbol map
-- can be either 'default' (requires nerd-fonts font) or
-- 'codicons' for codicon preset (requires vscode-codicons font)
-- default: 'default'
preset = 'default',
menu = {
buffer = "[BUFFER]",
nvim_lsp = "[LSP]",
ultisnips = "[ULTISNIPS]",
spell = "[SPELL]",
path = "[PATH]",
},
-- override preset symbols
-- default: {}
symbol_map = {
Text = "",
Method = "",
Function = "",
Constructor = "",
Field = "ﰠ",
Variable = "",
Class = "ﴯ",
Interface = "",
Module = "",
Property = "ﰠ",
Unit = "塞",
Value = "",
Enum = "",
Keyword = "",
Snippet = "",
Color = "",
File = "",
Reference = "",
Folder = "",
EnumMember = "",
Constant = "",
Struct = "פּ",
Event = "",
Operator = "",
TypeParameter = ""
},
},
},
mapping = {
['<C-j>'] = cmp.mapping.select_next_item(
{ behavior = cmp.SelectBehavior.Select }
),
['<C-k>'] = cmp.mapping.select_prev_item(
{ behavior = cmp.SelectBehavior.Select }
),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.close(),
['<Tab>'] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Replace,
select = true,
})
},
sources = {
-- { name = 'vsnip' }, -- For vsnip user
-- { name = 'luasnip' }, -- For luasnip user
{ name = 'ultisnips' }, -- For ultisnips user
{ name = 'nvim_lua' },
{ name = 'nvim_lsp' },
{ name = 'path' },
{ name = 'spell', keyword_length = 4 },
{ name = "buffer" , keyword_length = 5},
},
experimental = {
ghost_text = true
}
})
|
function onCreate()
makeLuaSprite('bg', 'bgs/eerie/Eerie_bg_final_FINAL', -250, -160);
scaleObject('bg',1.65,1.65);
--setLuaSpriteScrollFactor('bg', 0.9, 0.9);
if not lowQuality then
makeAnimatedLuaSprite('Peeps', 'bgs/eerie/Peeps', -150, 50);
scaleObject('Peeps', 0.9,0.9);
luaSpriteAddAnimationByPrefix('Peeps', 'Idle', 'people');
end
addLuaSprite('bg', false);
addLuaSprite('Peeps', false);
close(true); --For performance reasons, close this script once the stage is fully loaded, as this script won't be used anymore after loading the stage
end
|
local Polyflag = require(game:GetService("ReplicatedStorage"):WaitForChild("polyflag"))
--[[
local flag = Polyflag.new()
flag:newV("A", Vector3.new(0, 0, 0))
--]]
|
-- Copyright 2021 SmartThings
--
-- 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.
local constants = require "st.zigbee.constants"
local clusters = require "st.zigbee.zcl.clusters"
local device_management = require "st.zigbee.device_management"
local messages = require "st.zigbee.messages"
local mgmt_bind_resp = require "st.zigbee.zdo.mgmt_bind_response"
local mgmt_bind_req = require "st.zigbee.zdo.mgmt_bind_request"
local zdo_messages = require "st.zigbee.zdo"
local OnOff = clusters.OnOff
local PowerConfiguration = clusters.PowerConfiguration
local do_configure = function(self, device)
device:send(device_management.build_bind_request(device, PowerConfiguration.ID, self.environment_info.hub_zigbee_eui))
device:send(device_management.build_bind_request(device, OnOff.ID, self.environment_info.hub_zigbee_eui))
device:send(PowerConfiguration.attributes.BatteryPercentageRemaining:configure_reporting(device, 30, 21600, 1))
-- Read binding table
local addr_header = messages.AddressHeader(
constants.HUB.ADDR,
constants.HUB.ENDPOINT,
device:get_short_address(),
device.fingerprinted_endpoint_id,
constants.ZDO_PROFILE_ID,
mgmt_bind_req.BINDING_TABLE_REQUEST_CLUSTER_ID
)
local binding_table_req = mgmt_bind_req.MgmtBindRequest(0) -- Single argument of the start index to query the table
local message_body = zdo_messages.ZdoMessageBody({
zdo_body = binding_table_req
})
local binding_table_cmd = messages.ZigbeeMessageTx({
address_header = addr_header,
body = message_body
})
device:send(binding_table_cmd)
end
local function zdo_binding_table_handler(driver, device, zb_rx)
for _, binding_table in pairs(zb_rx.body.zdo_body.binding_table_entries) do
if binding_table.dest_addr_mode.value == binding_table.DEST_ADDR_MODE_SHORT then
-- send add hub to zigbee group command
driver:add_hub_to_zigbee_group(binding_table.dest_addr.value)
else
driver:add_hub_to_zigbee_group(0x0000)
end
end
end
local ikea_of_sweden = {
NAME = "IKEA Sweden",
lifecycle_handlers = {
doConfigure = do_configure
},
zigbee_handlers = {
zdo = {
[mgmt_bind_resp.MGMT_BIND_RESPONSE] = zdo_binding_table_handler
}
},
sub_drivers = {
require("zigbee-multi-button.ikea.TRADFRI_remote_control"),
require("zigbee-multi-button.ikea.TRADFRI_on_off_switch"),
require("zigbee-multi-button.ikea.TRADFRI_open_close_remote")
},
can_handle = function(opts, driver, device, ...)
return device:get_manufacturer() == "IKEA of Sweden" or device:get_manufacturer() == "KE"
end
}
return ikea_of_sweden
|
local serial = {}
local termemu = require("ui/termemu")
-- implements a serial port
-- port 0x10: commands
-- 0: idle
-- 1: write
-- 2: read
-- 3: enable interrupts
-- 4: disable interrupts
-- port 0x11: in/out byte
local tc = [[
local sch = love.thread.getChannel("serialin")
while true do
local c = (io.read() or "").."\n"
sch:push(c)
end
]]
local tcpt = [[
local sch = love.thread.getChannel("serialin")
local soch = love.thread.getChannel("serialout")
local port = sch:pop()
local socket = require("socket")
local server = assert(socket.bind("*", port))
while true do
local client = server:accept()
client:settimeout(0.05)
while true do
local ok = true
local b, err = client:receive(1)
if err == "closed" then break end
if b == "\r" then
sch:push("\n")
else
sch:push(b)
end
local x = soch:pop()
while x do
if x == "\n" then
ok, err = client:send("\r\n")
else
ok, err = client:send(x)
end
if err == "closed" then
soch:push(x)
break
end
x = soch:pop()
end
if not ok then
break
end
end
end
]]
local ports = 0
function serial.new(vm, c, bus)
local s = {}
local stdo = false
local tcpo = false
local doint = false
local port11 = 0xFFFF
local int = c.int
s.num = ports
local intnum
if s.num == 0 then
intnum = 0x4
elseif s.num == 1 then
intnum = 0x5
end
local iq = {}
local oq = {}
local function qchar(c)
iq[#iq + 1] = c
if doint then
int(intnum)
end
end
local citronoffset = s.num*2
bus.addPort(0x10+citronoffset, function (e,t,v)
if t == 1 then
if v == 3 then
doint = true
elseif v == 4 then
doint = false
end
else
return 0 -- always idle since this is all synchronous (god bless emulators)
end
return true
end)
bus.addPort(0x11+citronoffset, function (sz,t,v)
if t == 1 then
if s.termemu then
s.termemu.putc(string.char(s.termemu.sanitize(v)))
end
if stdo then
io.write(string.char(v))
io.flush()
elseif tcpo then
love.thread.getChannel("serialout"):push(string.char(v))
end
else
if #iq > 0 then -- input queue has stuff
v = string.byte(table.remove(iq,1))
else
v = 0xFFFF -- nada
end
if sz == 0 then
return band(v, 0xFF)
elseif sz == 1 then
return band(v, 0xFFFF)
else
return v
end
end
return true
end)
function s.stream(e)
for i = 1, #e do
local c = e:sub(i,i)
qchar(c)
end
end
function s.read()
if #oq > 0 then
return table.remove(oq,1)
else
return false
end
end
function s.reset()
doint = false
iq = {}
oq = {}
end
vm.registerOpt("-insf"..tostring(s.num), function (arg, i)
s.stream(io.open(arg[i+1]):read("*a"))
return 2
end)
if s.num == 0 then
vm.registerOpt("-serial,stdio", function (arg, i)
if tcpo then
error("-serial,stdio and -serial,tcp are mutually exclusive")
end
stdo = true
love.thread.newThread(tc):start()
vm.registerCallback("update", function (dt)
local x = love.thread.getChannel("serialin"):pop()
while x do
s.stream(x)
x = love.thread.getChannel("serialin"):pop()
end
end)
return 1
end)
vm.registerOpt("-serial,tcp", function (arg, i)
if stdo then
error("-serial,stdio and -serial,tcp are mutually exclusive")
end
tcpo = true
love.thread.getChannel("serialin"):push(tonumber(arg[i+1]))
love.thread.newThread(tcpt):start()
vm.registerCallback("update", function (dt)
local x = love.thread.getChannel("serialin"):pop()
while x do
s.stream(x)
x = love.thread.getChannel("serialin"):pop()
end
end)
return 2
end)
end
ports = ports + 1
s.termemu = termemu.new(vm, s.stream, s.num)
vm.addBigScreen("tty"..s.num, s.termemu)
return s
end
return serial
|
bullet = {}
function bullet:new(o)
o = o or {x=0, y=0, vx=1, vy=1}
setmetatable(o, self)
self.__index = self
o.wid = 6
o.hig = 6
o.type = 'bullet'
o._seed = math.random(0, 10000)/10000
return o
end
function bullet:draw(o)
love.graphics.setColor(hslToRgb(o._seed, 0.5, 0.5))
love.graphics.circle('line', o.x, o.y, 3)
love.graphics.circle('line', o.x, o.y, 3.8)
love.graphics.setColor(1,1,1)
love.graphics.circle('fill', o.x, o.y, 3)
end
function bullet:update(o)
local dt = love.timer.getDelta()
o.x = o.x + o.vx * dt*65
o.y = o.y + o.vy * dt*65
end
|
local util = require('darcula.util')
-- Load the theme
local set = function ()
util.load()
end
return { set = set }
|
position = {x = -23.890869140625, y = 1.43733668327332, z = -17.7199993133545}
rotation = {x = -8.52952143759467E-05, y = 270.027221679688, z = -0.000314870296278968}
|
-- 用来做性能测试
-- 需要配置成自己的源码目录
package.path = "../src/?.lua;"
.. "/usr/local/openresty/lualib/?.lua;"
.. package.path
local dx_proto = require "core.net.dx_protocol"
local chat_proto = require "core.chat.dx_chat_protocol"
local cjson = require "cjson.safe"
local client = require "resty.websocket.client"
local semaphore = require "ngx.semaphore"
--- postman ---
local postman = {}
function postman:new()
local o = {}
o.msg_box = ngx.shared.msg_box
return setmetatable(o, { __index = postman })
end
function postman:post(id, msg)
local len, err = self.msg_box:lpush(id, cjson.encode(msg))
if not len then
ngx.log(ngx.ERR, "ngx.shared.msg_box: ", err)
return nil, "ngx.shared.msg_box: " .. err
end
return len, "ok"
end
function postman:take(id)
if id == nil then
return nil, "id err"
end
local msg, err = self.msg_box:rpop(id)
if not msg then
return nil, err
end
return msg, "ok"
end
--- postman ---
--- dx_cli ---
local dx_cli = {}
function dx_cli:new()
local o = {}
o.is_running = false
o.ping_thread = nil
o.post_thread = nil
o.send_thread = nil
o.ws = nil
o.ticket = nil
o.to_id = nil
o.keepalive = 1
o.send_interval = 1
o.sema = semaphore.new()
o.postman = postman:new()
return setmetatable(o, { __index = dx_cli })
end
function dx_cli:log(text)
print(self.ticket .. ":" .. text)
end
function dx_cli:send(msg)
local raw = dx_proto.pack(msg)
assert(raw)
local bytes, err = self.ws:send_binary(raw)
if not bytes then
self:log("failed to send frame: " .. err)
-- return
end
self:log("send: " .. raw)
end
function dx_cli:send_loop()
while self.is_running do
local msg, _ = self.postman:take(self.ticket)
while msg do
self:send(msg)
msg, _ = self.postman:take(self.ticket)
end
-- 让给receive执行
self.sema:wait(1)
end
end
function dx_cli:ping()
-- {"_type":2,"_time":1602128760415,"_ver":1}
while self.is_running do
local ping = {
_type = chat_proto.MSG_T_PING,
_ver = chat_proto.VER_1,
_time = ngx.now() * 1000
}
self.postman:post(self.ticket, ping)
ngx.sleep(self.keepalive)
end
end
function dx_cli:post_loop()
-- {"_from":"88","_type":4,"_to":"99","_chat_type":0,"_payload":{"text":"dfasfasdf跌幅达时空裂缝。。。sdfsad"},"_ver":1,"_time":1602131323987,"_offline":0}
-- while self.is_running do
for i = 1, self.send_cnt do
local content = "ttttttt" .. ngx.now()
local msg = {
_type = chat_proto.MSG_T_PCHAT,
_ver = chat_proto.VER_1,
_time = ngx.now() * 1000,
_from = self.ticket,
_to = self.to_id,
_chat_type = chat_proto.CHAT_T_TXT,
_offline = 0,
_payload = {
text = content
}
}
self.postman:post(self.ticket, msg)
ngx.sleep(self.send_interval)
end
end
function dx_cli:run(ticket, keepalive, recv_cnt, send_cnt, send_interval, to, uri)
self.ticket = ticket
self.keepalive = keepalive
self.recv_cnt = recv_cnt
self.send_cnt = send_cnt
self.send_interval = send_interval
self.uri = uri
self.to_id = to
local err = nil
self.ws, err = client:new{
timeout = 500000, -- 单位毫秒
max_payload_len = 65535}
local ok = nil
ok, err = self.ws:connect(self.uri)
if not ok then
self:log("failed to connect: " .. err)
return
end
self:log("connected..." .. self.uri)
self.is_running = true
-- auth
-- {"_payload":{"ticket":"99"},"_type":3,"_time":1602126017218,"_ver":1}
local auth_msg = {
_type = chat_proto.MSG_T_AUTH,
_ver = chat_proto.VER_1,
_time = ngx.now() * 1000,
_payload = {ticket = self.ticket}
}
self:send(cjson.encode(auth_msg))
local data = nil
local typ = nil
data, typ, err = self.ws:recv_frame()
if not data then
self:log("failed to receive the frame: " .. err)
self.is_running = false
-- goto close_conn
return
end
local msg = nil
msg, err = dx_proto.unpack(data)
-- {"_payload":{"uid":"99","cd":0},"_type":3,"_time":1602126017218,"_ver":1}
self:log(cjson.encode(msg))
assert(msg)
assert(msg.payload)
local chat_msg = cjson.decode(msg.payload)
assert(chat_msg._payload)
assert(chat_msg._type)
assert(chat_msg._payload.uid)
assert(chat_msg._payload.cd)
if chat_msg._payload.cd ~= 0 then
self:log("auth error cd:" .. chat_msg._payload.cd)
self.is_running = false
-- goto close_conn
return
end
self:log("auth ok " .. cjson.encode(msg))
-- send_loop thread
if not self.send_thread then
self.send_thread = ngx.thread.spawn(self.send_loop, self)
end
-- ping thread
if not self.ping_thread then
self.ping_thread = ngx.thread.spawn(self.ping, self)
end
-- post_loop thread
if not self.post_thread then
self.post_thread = ngx.thread.spawn(self.post_loop, self)
end
-- receive data
for i = 1, recv_cnt do
self.sema:post(1)
data, typ, err = self.ws:recv_frame()
if not data then
self:log("failed to receive the frame: " .. err)
break
end
-- self:log(i .. " recv: " .. data)
end
self.is_running = false
-- self:log("before wait ping_thread " .. type(self.ping_thread))
if self.ping_thread then
ngx.thread.wait(self.ping_thread)
-- self:log("after wait ping_thread " .. type(self.ping_thread))
end
-- self:log("before wait post_thread " .. type(self.post_thread))
if self.post_thread then
ngx.thread.wait(self.post_thread)
-- self:log("after wait post_thread " .. type(self.post_thread))
end
-- self:log("before wait send_thread " .. type(self.send_thread))
if self.send_thread then
ngx.thread.wait(self.send_thread)
-- self:log("after wait send_thread " .. type(self.send_thread))
end
-- close
local bytes = nil
bytes, err = self.ws:send_close()
if not bytes then
self:log("failed to send close frame: " .. err)
end
self.ws:close()
end
--- dx_cli ---
-- 启动命令及参数:
-- resty clitest.lua uri ticket [to] [keepalive] [send_interval] [recv_cnt] [client_cnt]
-- 示例:resty --shdict 'msg_box 32m' -c 9998 --main-include main_conf.conf clitest.lua ws://127.0.0.1:8008/chat 1 2 1 1 10 10 1
if arg[1] == '-h' then
print(
[[
resty --shdict 'msg_box 32m' -c 9998 --main-include main_conf.conf clitest.lua uri ticket [to] [keepalive] [send_interval] [recv_cnt] [send_cnt] [client_cnt]
功能:用来做性能测试
参数说明:
uri: websocket地址
ticket: 用来鉴权的票据,目前只能是数字,配合client_cnt参数,用来性能测试
to: 如果是0表示以ticket + 1的规则自动生成;如果大于0表示指定值
keepalive: ping命令的间隔时间,浮点类型 1表示一秒,0.5表示500ms
send_interval: 发送频率,即时间间隔,浮点类型 1表示一秒,0.5表示500ms
recv_cnt: 总共接受多少条消息停止
send_cnt: 总共发送多少条消息后停止
client_cnt: 开启多少个客户端
]]
)
end
-- 获得参数
local uri = arg[1] -- or "ws://127.0.0.1:8008/chat"
local t = arg[2]
local to = arg[3] or 0
local keepalive = arg[4] or 1
local send_interval = arg[5] or 1
local recv_cnt = arg[6] or 1
local send_cnt = arg[7] or 1
local client_cnt = arg[8] or 1
assert(uri)
assert(t)
local benchmark_thread = {}
for i = t, client_cnt + t do
local cli = dx_cli:new()
local ticket = i
if to == 0 then
to = i + 1
end
-- benchmark thread
if not benchmark_thread[i] then
benchmark_thread[i] = ngx.thread.spawn(cli.run, cli, ticket, keepalive, recv_cnt, send_cnt, send_interval, to, uri)
print("start benchmark_thread[" .. i .. "] ")
end
end
for i = t, client_cnt + t do
-- print("before wait benchmark_thread[" .. i .. "] " .. type(benchmark_thread[i]))
if benchmark_thread[i] then
ngx.thread.wait(benchmark_thread[i])
-- print("after wait benchmark_thread[" .. i .. "] " .. type(benchmark_thread[i]))
end
end
|
--
-- Copyright (c) 2020 lalawue
--
-- This library is free software; you can redistribute it and/or modify it
-- under the terms of the MIT license. See LICENSE for details.
--
if not CincauEnginType then
require("app.app_env")
end
local Server = CincauServer
local Config = CincauConfig
local Router = CincauRouter
Config.logger.setLevel(Config.log_level)
local function http_callback(config, req, response)
local func, params = Router:resolve(req.method, req.path)
if func then
func(config, req, response, params)
elseif Router.pageNotFound then
Router:pageNotFound(config, req, response, params)
else
Config.logger.err("router failed to resolve method:%s path:%s", req.method, req.path)
end
end
local function runApp()
Server.run(Config, http_callback)
end
xpcall(runApp, CincauTracebackHandler)
|
local zombieMenus = {}
function GM:GetZombieMenus()
return zombieMenus
end
function GM:ResetZombieMenus()
for k, v in pairs(zombieMenus) do
v:Remove()
end
zombieMenus = {}
end
net.Receive("zm_queue", function(len)
local type = net.ReadString()
local id = ents.GetByIndex(net.ReadInt(32))
local menu = zombieMenus[id]
if menu then
menu:AddQueue(type)
end
end)
net.Receive("zm_remove_queue", function(um)
local id = ents.GetByIndex(net.ReadUInt(16))
local menu = zombieMenus[id]
if menu then
menu:UpdateQueue()
end
end)
|
return 'O_O'
|
-- Works similar to the TrunkNotes {{children}} function, but skips Lua pages,
-- peages that start with "Special", and pages whose names end with ":Index".
-- Also, tries to pretty-print page names so SomeWikiWord becomes "Some
-- Wiki Word".
--
-- Usage:
--
-- {{lua ChildrenEx.lua,CategoryName}}
--
-- {{lua ChildrenEx.lua,CategoryName,Unsorted}}
search_for = args[1]
unsorted = args[2]
list_items = {}
a = wiki.search(search_for .. ":")
the_output = ""
for i, name in pairs(a) do
if name:find("Special:") then
-- Skip special pages
elseif name:find(".lua") then
-- Skip Lua pages
elseif name:match(":[Ii]ndex$") then
-- Skip index page
else
page_title = name:gsub(args[1] .. ":", "")
page_title = page_title:gsub("([%u]+)", " %1")
page_title = page_title:gsub("([%d]+)", " %1")
page_title = page_title:gsub("^%s*(.-)%s*$", "%1")
list_entry = "- [[" .. name .. "|" .. page_title .. "]]"
table.insert(list_items, list_entry)
end
end
if not unsorted then
table.sort(list_items)
end
for i, item in ipairs(list_items) do
the_output = the_output .. item .. "\n"
end
return the_output
|
local strings = {}
function strings.trim(str)
return str:gsub("^%s*(.-)%s*$", "%1")
end
function strings.trim_start(str)
return str:gsub("^%s*(.-)$", "%1")
end
function strings.lpad(str, len, char)
if char == nil then char = ' ' end
return str .. string.rep(char, len - #str)
end
return strings
|
--[[
================================================================================
ProjectNukeApplicarionRC
Application: Reactor Controller
================================================================================
Author: stuntguy3000
--]]
|
-- SearchToggle.lua
-- @Author : Dencer (tdaddon@163.com)
-- @Link : https://dengsir.github.io
-- @Date : 12/28/2019, 1:35:39 AM
---@type ns
local ns = select(2, ...)
local L = ns.L
local GameTooltip = GameTooltip
local ipairs = ipairs
local tinsert, tremove = table.insert, table.remove
local format = string.format
local tContains = tContains
local ADD = ADD
local DELETE = DELETE
local SEARCH = SEARCH
---@type tdBag2SearchToggle
local SearchToggle = ns.Addon:NewClass('UI.SearchToggle', ns.UI.MenuButton)
function SearchToggle:Constructor(_, meta)
self.meta = meta
self:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
self:SetScript('OnClick', self.OnClick)
self:SetScript('OnEnter', self.OnEnter)
self:SetScript('OnLeave', GameTooltip_Hide)
self:SetScript('OnShow', self.OnShow)
end
function SearchToggle:OnShow()
self:RegisterEvent('SEARCH_CHANGED', 'CloseMenu')
end
function SearchToggle:OnClick(button)
if button == 'LeftButton' then
self.meta.frame:ToggleSearchBoxFocus()
ns.PlayToggleSound(1)
else
self:ToggleMenu()
end
end
function SearchToggle:OnEnter()
ns.AnchorTooltip(self)
GameTooltip:SetText(SEARCH)
GameTooltip:AddLine(ns.LeftButtonTip(L.TOOLTIP_SEARCH_TOGGLE))
GameTooltip:AddLine(ns.RightButtonTip(L.TOOLTIP_SEARCH_RECORDS))
GameTooltip:Show()
end
function SearchToggle:CreateMenu()
local result = {}
local searches = self.meta.sets.searches
local text = ns.Addon:GetSearch()
if text and text ~= '' and not tContains(searches, text) then
tinsert(result, {
text = format('%s |cff00ffff%s|r', ADD, text),
notCheckable = true,
func = function()
tinsert(searches, text)
end,
})
tinsert(result, self.SEPARATOR)
end
if #searches == 0 then
tinsert(result, {text = L['No record'], disabled = true, notCheckable = true})
else
for i, item in ipairs(searches) do
tinsert(result, {
text = item,
func = function()
ns.Addon:SetSearch(item)
end,
hasArrow = true,
checked = text == item,
menuList = {
{
text = DELETE,
notCheckable = true,
func = function()
tremove(searches, i)
self:CloseMenu()
end,
},
},
})
end
end
tinsert(result, self.SEPARATOR)
tinsert(result, {
text = L['Global search'],
notCheckable = true,
func = function()
ns.Addon:ToggleFrame(ns.BAG_ID.SEARCH, true)
end,
})
return result
end
|
name = "Name here"
author = "Sascha Kastens"
version = "1.0"
email = "mail@skastens.de"
short_descr = "Short description here."
description = "Description here"
function filter(gn)
target = "reading_frame"
gfi = gt.feature_node_iterator_new(gn)
curnode = gfi:next()
count = 0
while not(curnode == nil) do
if (curnode:get_type() == target) then
if (curnode:get_strand() == '+') then
count = count + 1
end
end
curnode = gfi:next()
end
if (count >= 2) then
return false
end
return true
end
|
return {'voicemail','voile','voiture','voicerecorder','voigt','voiles','voitures','voituurtje'}
|
local wibox = require("wibox")
local awful = require("awful")
local gears = require("gears")
local beautiful = require("beautiful")
local dpi = require("beautiful.xresources").apply_dpi
local function tabobj_support(self, c, index, clients)
-- Self is the background widget in this context
if not c.bling_tabbed then
return
end
local group = c.bling_tabbed
-- Single item tabbed group's dont get special rendering
if #group.clients > 1 then
local wrapper = wibox.widget({
{
-- This is so dumb... but it works so meh
{
id = "row1",
layout = wibox.layout.flex.horizontal,
},
{
id = "row2",
layout = wibox.layout.flex.horizontal,
},
spacing = dpi(2),
layout = wibox.layout.fixed.vertical,
},
id = "click_role",
widget = wibox.container.margin,
margins = dpi(5),
})
for idx, c in ipairs(group.clients) do
if c and c.icon then
-- TODO: Don't do this in a -1iq way
if idx <= 2 then
wrapper
:get_children_by_id("row1")[1]
:add(awful.widget.clienticon(c))
else
wrapper
:get_children_by_id("row2")[1]
:add(awful.widget.clienticon(c))
end
end
end
self.widget = wrapper
end
end
return tabobj_support
|
--[[
This was all made by MXKhronos on ROBLOX. I just made this work for many other exploits.
All credits go to him.
--]]
local FirebaseService = {};
-- Basic Information
local HttpService = game:GetService("HttpService")
local URL = _G.FirebaseURL
local Token = _G.FirebaseToken
function FirebaseService:GetFirebase(name, database)
-- Basic Auth
database = URL
local databaseName = database..HttpService:UrlEncode(name);
local authentication = ".json?auth="..Token;
local Firebase = {};
-- Gets the Database
function Firebase.GetDatastore()
return databaseName;
end
function Firebase:GetAsync(directory)
local data = nil;
local getTick = tick();
local tries = 0; repeat until pcall(function() tries = tries +1;
data = HttpService:GetAsync(databaseName..HttpService:UrlEncode(directory and "/"..directory or "")..authentication, true);
end) or tries > 2;
if type(data) == "string" then
if data:sub(1,1) == '"' then
return data:sub(2, data:len()-1);
elseif data:len() <= 0 then
return nil;
end
end
return tonumber(data) or data ~= "null" and data or nil;
end
-- Sets Your Values and Such
function Firebase:SetAsync(directory, value, header)
if value == "[]" then self:RemoveAsync(directory); return end;
header = header or {["X-HTTP-Method-Override"]="PUT"};
local replyJson = "";
if type(value) == "string" and value:len() >= 1 and value:sub(1,1) ~= "{" and value:sub(1,1) ~= "[" then
value = '"'..value..'"';
end
local success, errorMessage = pcall(function()
replyJson = HttpService:PostAsync(databaseName..HttpService:UrlEncode(directory and "/"..directory or "")..authentication, value, Enum.HttpContentType.ApplicationUrlEncoded, false, header);
end);
if not success then
warn("FirebaseService>> [ERROR] "..errorMessage);
pcall(function()
replyJson = HttpService:JSONDecode(replyJson or "[]");
end)
end
end
function Firebase:RemoveAsync(directory)
self:SetAsync(directory, "", {["X-HTTP-Method-Override"]="DELETE"});
end
function Firebase:UpdateAsync(directory, callback)
local data = self:GetAsync(directory);
local callbackData = callback(data);
if callbackData then
self:SetAsync(directory, callbackData);
end
end
return Firebase;
end
return FirebaseService;
|
object_building_heroic_shared_hoth_ion = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_hoth_ion.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_hoth_ion, "object/building/heroic/shared_hoth_ion.iff")
object_building_heroic_shared_dark_tower_b = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_dark_tower_b.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_dark_tower_b, "object/building/heroic/shared_dark_tower_b.iff")
object_building_heroic_shared_moncal_tower_e = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_moncal_tower_e.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_moncal_tower_e, "object/building/heroic/shared_moncal_tower_e.iff")
object_building_heroic_shared_hoth_rebel_transport = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_hoth_rebel_transport.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_hoth_rebel_transport, "object/building/heroic/shared_hoth_rebel_transport.iff")
object_building_heroic_shared_dark_tower_e = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_dark_tower_e.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_dark_tower_e, "object/building/heroic/shared_dark_tower_e.iff")
object_building_heroic_shared_bespin_huge_tower = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_bespin_huge_tower.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_bespin_huge_tower, "object/building/heroic/shared_bespin_huge_tower.iff")
object_building_heroic_shared_bespin_tower_g = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_bespin_tower_g.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_bespin_tower_g, "object/building/heroic/shared_bespin_tower_g.iff")
object_building_heroic_shared_cloud_city = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_cloud_city.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_cloud_city, "object/building/heroic/shared_cloud_city.iff")
object_building_heroic_shared_hoth_generator = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_hoth_generator.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_hoth_generator, "object/building/heroic/shared_hoth_generator.iff")
object_building_heroic_shared_bespin_tower_b = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_bespin_tower_b.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_bespin_tower_b, "object/building/heroic/shared_bespin_tower_b.iff")
object_building_heroic_shared_bespin_tower_e = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_bespin_tower_e.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_bespin_tower_e, "object/building/heroic/shared_bespin_tower_e.iff")
object_building_heroic_shared_echo_base = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_echo_base.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_echo_base, "object/building/heroic/shared_echo_base.iff")
object_building_heroic_shared_ig88_factory_arena = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_ig88_factory_arena.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_ig88_factory_arena, "object/building/heroic/shared_ig88_factory_arena.iff")
object_building_heroic_shared_hoth_generator_destroyed = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_hoth_generator_destroyed.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_hoth_generator_destroyed, "object/building/heroic/shared_hoth_generator_destroyed.iff")
object_building_heroic_shared_moncal_tower_d = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_moncal_tower_d.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_moncal_tower_d, "object/building/heroic/shared_moncal_tower_d.iff")
object_building_heroic_shared_dark_tower_c = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_dark_tower_c.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_dark_tower_c, "object/building/heroic/shared_dark_tower_c.iff")
object_building_heroic_shared_cloud_platform = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_cloud_platform.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_cloud_platform, "object/building/heroic/shared_cloud_platform.iff")
object_building_heroic_shared_bespin_tower_a = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_bespin_tower_a.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_bespin_tower_a, "object/building/heroic/shared_bespin_tower_a.iff")
object_building_heroic_shared_bespin_tower_f = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_bespin_tower_f.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_bespin_tower_f, "object/building/heroic/shared_bespin_tower_f.iff")
object_building_heroic_shared_ptower = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_ptower.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_ptower, "object/building/heroic/shared_ptower.iff")
object_building_heroic_shared_dark_tower_d = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_dark_tower_d.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_dark_tower_d, "object/building/heroic/shared_dark_tower_d.iff")
object_building_heroic_shared_golan_laser_battery = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_golan_laser_battery.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_golan_laser_battery, "object/building/heroic/shared_golan_laser_battery.iff")
object_building_heroic_shared_dark_tower_a = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_dark_tower_a.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_dark_tower_a, "object/building/heroic/shared_dark_tower_a.iff")
object_building_heroic_shared_axkva_min_lair = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_axkva_min_lair.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_axkva_min_lair, "object/building/heroic/shared_axkva_min_lair.iff")
object_building_heroic_shared_moncal_tower_f = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_moncal_tower_f.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_moncal_tower_f, "object/building/heroic/shared_moncal_tower_f.iff")
object_building_heroic_shared_exar_kun_tomb = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_exar_kun_tomb.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_exar_kun_tomb, "object/building/heroic/shared_exar_kun_tomb.iff")
object_building_heroic_shared_dark_huge_tower = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_dark_huge_tower.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_dark_huge_tower, "object/building/heroic/shared_dark_huge_tower.iff")
object_building_heroic_shared_bespin_tower_c = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_bespin_tower_c.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_bespin_tower_c, "object/building/heroic/shared_bespin_tower_c.iff")
object_building_heroic_shared_frozen_tauntaun = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_frozen_tauntaun.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_frozen_tauntaun, "object/building/heroic/shared_frozen_tauntaun.iff")
object_building_heroic_shared_bespin_tower_d = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_bespin_tower_d.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_bespin_tower_d, "object/building/heroic/shared_bespin_tower_d.iff")
object_building_heroic_shared_dark_tower_f = SharedBuildingObjectTemplate:new {
clientTemplateFileName = "object/building/heroic/shared_dark_tower_f.iff"
}
ObjectTemplates:addClientTemplate(object_building_heroic_shared_dark_tower_f, "object/building/heroic/shared_dark_tower_f.iff")
|
--!A cross-platform build utility based on Lua
--
-- 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.
--
-- Copyright (C) 2015-2020, TBOOX Open Source Group.
--
-- @author ruki
-- @file xmake.lua
--
-- define toolchain
toolchain("gnu-rm")
-- set homepage
set_homepage("https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm")
set_description("GNU Arm Embedded Toolchain")
-- mark as standalone toolchain
set_kind("standalone")
-- on load
on_load(function (toolchain)
-- load basic configuration of cross toolchain
toolchain:load_cross_toolchain()
-- add basic flags
toolchain:add("ldflags", "--specs=nosys.specs", "--specs=nano.specs", {force = true})
toolchain:add("shflags", "--specs=nosys.specs", "--specs=nano.specs", {force = true})
toolchain:add("syslinks", "c", "m")
end)
|
-- Libreria per il modulo Squadra
local lib = {}
local c = require("Colore-data")
-- Implementa lo switch sulla classe allenatore
lib.trainerClass = {
Grunt = 'Team Rocket Grunt',
Admin = 'Executive'
}
lib.trainerClass.Executive = lib.trainerClass.Admin
-- Mette il giusto numero di Poké Ball vuote e piene in fondo alla tabella
lib.balls = function(num1, num2)
local party = {'[[File:Ballfull.png]]'}
for a = 2, num1 do
table.insert(party, '[[File:Ballfull.png]]')
end
for a = num1 + 1, num2 and 3 or 6 do
table.insert(party, '[[File:Ballempty.png]]')
end
if num2 then
for a = 1, num2 do
table.insert(party, '[[File:Ballfull.png]]')
end
for a = num2 + 1, 3 do
table.insert(party, '[[File:Ballempty.png]]')
end
end
return table.concat(party)
end
--[[
Takes a string that can be both a color name (possibly followed by a variant)
or an hex. In the former case returns the pair (name, variant), in the latter
returns the hex, adding a leading hash if needed.
--]]
lib.getColor = function(colorString)
local colorName = colorString:match('(%S+)')
if c[colorName] then
return colorName, colorString:match('%s(%a+)') or 'normale'
end
return colorString:find('%X') and '#' .. colorString or colorString
end
--[[
Ritorna i valori esadecimali dei colori prendendoli dal
modulo colore/data qualora non siano già esadecimali.
Se chiamata con due tabelle utilizza la prima come sorgente
e aggiunge elementi alla seconda; se invece la seconda
non è presente, viene creata al suo posto una tabella vuota.
--]]
lib.gethex = function(sources, toadd)
toadd = toadd or {}
for k, v in pairs(sources) do
local name, var = lib.getColor(v)
toadd[k] = var and c[name][var] or name
end
return toadd
end
-- Dà la giusta impaginazione ai Box dei Pokémon
lib.party = function(poke, separator)
for k, v in pairs(poke) do
poke[k] = '|\n' .. v
end
if #poke > 4 then
table.insert(poke, 4, separator)
elseif #poke == 4 then
table.insert(poke, 3, separator)
end
return table.concat(poke, '\n')
end
return lib
|
--[[
Date 2016/08/04
Author soniceryd
Desc
]]--
local restfulRoute = require("luaweb.route.restful")
local restfulRouter = {}
function restfulRouter:new(request)
local instance = {
routes = {restfulRoute:new(request)}
}
setmetatable(instance,{__index = self})
return instance
end
function restfulRouter:route()
if self.routes ~= nil and #self.routes >= 1 then
for k,route in ipairs(self.routes) do
local require_name,action,request = nil
local ok = pcall(function(route)require_name,action,request = route:match() end,route)
if ok and require_name ~= nil and action ~= nil and type(require(require_name)[action]) == 'function' then
return function()
require(require_name)[action](request)
end
else
return function()
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)
end
end
end
end
end
return restfulRouter
|
local UV = require('uv')
local user_meta = require('utils').user_meta
local emitter_meta = require('emitter').meta
local udp_prototype = {}
setmetatable(udp_prototype, emitter_meta)
local function new_udp()
local udp = {
userdata = UV.new_udp(),
prototype = udp_prototype
}
setmetatable(udp, user_meta)
return udp
end
return {
new = new_udp,
prototype = udp_prototype,
meta = udp_meta
}
|
xLogs.RegisterCategory("Connection", "Players")
xLogs.RegisterCategory("Disconnection", "Players")
xLogs.RegisterCategory("Deaths", "Players")
xLogs.RegisterCategory("Respawn", "Players")
xLogs.RegisterCategory("Say", "Players")
xLogs.RegisterCategory("Team Say", "Players")
xLogs.RegisterCategory("Damage", "Players")
xLogs.RegisterCategory("Pickup", "Players")
hook.Add("PlayerInitialSpawn", "xLogsPlayers-Connection", function(ply)
xLogs.Log(xLogs.Core.Player(ply).." has connected", "Connection")
end)
hook.Add("PlayerDisconnected", "xLogsPlayers-Disconnection", function(ply)
if ply:IsTimingOut() then
xLogs.Log(xLogs.Core.Player(ply).." has timed out", "Disconnection")
else
xLogs.Log(xLogs.Core.Player(ply).." has disconnected", "Disconnection")
end
end)
hook.Add("PlayerDeath", "xLogsPlayers-Death", function(victim, inflictor, attacker)
if attacker:IsPlayer() then
xLogs.Log(xLogs.Core.Player(victim).." was killed by "..xLogs.Core.Player(attacker), "Deaths")
else
xLogs.Log(xLogs.Core.Player(victim).." has died", "Deaths")
end
end)
hook.Add("PlayerSpawn", "xLogsPlayers-Respawn", function(ply)
xLogs.Log(xLogs.Core.Player(ply).." has respawned", "Respawn")
end)
hook.Add("EntityTakeDamage", "xLogsPlayers-Damage", function(target, dmgData)
if target:IsPlayer() and dmgData:GetAttacker():IsPlayer() then
xLogs.Log(xLogs.Core.Player(target).." took "..xLogs.Core.Color(math.Round(dmgData:GetDamage()), Color(200, 0, 0)).." damage from "..xLogs.Core.Player(dmgData:GetAttacker()), "Damage")
elseif target:IsPlayer() then
xLogs.Log(xLogs.Core.Player(target).." took "..xLogs.Core.Color(math.Round(dmgData:GetDamage()), Color(200, 0, 0)).." damage from "..xLogs.Core.Color(dmgData:GetAttacker():GetClass(), Color(0, 200, 200)), "Damage")
end
end)
hook.Add("PlayerCanPickupWeapon", "xLogsPlayers-Pickup", function(ply, weapon)
xLogs.Log(xLogs.Core.Player(ply).." attempted to pick up weapon "..xLogs.Core.Color(weapon:GetClass(), Color(0, 0, 200)), "Pickup")
end)
hook.Add("PlayerCanPickupItem", "xLogsPlayers-Pickup", function(ply, item)
xLogs.Log(xLogs.Core.Player(ply).." attempted to pick up item "..xLogs.Core.Color(item:GetClass(), Color(0, 0, 200)), "Pickup")
end)
hook.Add("PlayerSay", "xLogsPlayers-Say", function(ply, text, isTeam)
if ply:IsPlayer() then
if isTeam then
xLogs.Log(xLogs.Core.Player(ply).." said: "..text, "Team Say")
else
xLogs.Log(xLogs.Core.Player(ply).." said: "..text, "Say")
end
end
end)
|
require("vue/__tests__/e2eUtils")
describe('e2e: tree', function()
local = setupPuppeteer()
function testTree(apiType)
local baseUrl = nil
expect():toBe(12)
expect():toBe(4)
expect():toBe(4)
expect():toBe(false)
expect():toBe('[+]')
expect():toBe(true)
expect(#()):toBe(4)
expect():toContain('[-]')
expect():toContain('hello')
expect():toContain('wat')
expect():toContain('child folder')
expect():toContain('[+]')
expect(#()):toBe(5)
expect():toContain('hello')
expect():toContain('wat')
expect():toContain('child folder')
expect():toContain('[+]')
expect():toContain('new stuff')
expect(#()):toBe(6)
expect():toContain('hello')
expect():toContain('wat')
expect():toContain('child folder')
expect():toContain('[+]')
expect():toContain('new stuff')
expect():toContain('new stuff')
expect():toBe(true)
expect():toContain('[-]')
expect(#()):toBe(5)
expect():toBe(false)
expect():toContain('[+]')
expect():toBe(true)
expect():toContain('[-]')
expect():toBe(15)
expect():toBe(5)
expect():toContain('[-]')
expect(#()):toBe(2)
end
test('classic', function()
end
, E2E_TIMEOUT)
test('composition', function()
end
, E2E_TIMEOUT)
end
)
|
local slides = param.get( "slides", "table" )
local show_slides = {}
for i, slide in ipairs( slides ) do
if slide.initiative then
show_slides[ #show_slides + 1 ] = slide
end
end
slot.select( "slideshow", function ()
ui.container { attr = { class = "slideshow" }, content = function ()
for i, slide in ipairs( show_slides ) do
if slide.initiative.issue.closed then
view = "finished"
elseif slide.initiative.issue.fully_frozen then
view = "voting"
elseif slide.initiative.issue.half_frozen then
view = "verification"
elseif slide.initiative.issue.admitted then
view = "discussion"
else
view = "admission"
end
ui.container { attr = { class = "slide slide-" .. i }, content = function ()
if slide.initiative.issue.closed then
util.initiative_pie(slide.initiative, 150)
end
ui.container {
attr = { class = "slideshowTitle" },
content = slide.title
}
execute.view {
module = "initiative", view = "_list_element", params = {
initiative = slide.initiative
}
}
end }
end
end }
end )
ui.script{ script = [[
var slideshowCurrent = 0;
var slideshowCount = ]] .. #show_slides .. [[ ;
function slideshowShowSlide(i) {
$(".slideshow .slide").slideUp();
$(".slideshow .slide-" + i).slideDown();
slideshowCurrent = i;
}
function slideshowShowNext() {
var next = slideshowCurrent + 1;
if (next > slideshowCount) {
next = 1;
}
slideshowShowSlide(next);
window.setTimeout(slideshowShowNext, 7500);
}
slideshowShowNext();
]]}
|
--[[
module:MediaPlayer
author:DylanYang
time:2021-02-07 17:00:05
]]
local _M = Class("MediaPlayer")
function _M.public:Play()
end
return _M
|
function interfaceConsole()
love.graphics.setFont(font_13)
local line
local y = 0
local fps = love.timer.getFPS( )
local console_size = 20
for line = 1, console_size, 1 do
--[[if line == 1 then
love.graphics.print("FPS: ".. fps, 0, y)
if]]
if console_string[line] == nil then
--love.graphics.print(console_string[line], 0, y)
love.graphics.print("nil", 0, y)
else
love.graphics.print(console_string[line], 0, y)
end
y = y + 13
end
love.graphics.setFont(font_26)
end
function interfaceDrawRightString()
love.graphics.print(rstring, love.graphics.getWidth() - 200, 8)
end
function interfaceDrawMode()
if mode_console == true then
--local fps = love.timer.getFPS( )
--love.graphics.print("FPS: ".. fps, 0, 0)
interfaceConsole()
--else
end
if mode_teleport == true then
interfaceDrawRightString()
end
end
|
local M = {}
M.setup = function()
local status_ok, spectre = pcall(require, "spectre")
if not status_ok then
return
end
spectre.setup({
mapping = {
["toggle_line"] = {
map = "dd",
cmd = "<cmd>lua require('spectre').toggle_line()<CR>",
desc = "toggle current item",
},
["enter_file"] = {
map = "<cr>",
cmd = "<cmd>lua require('spectre.actions').select_entry()<CR>",
desc = "goto current file",
},
["send_to_qf"] = {
map = "\\q",
cmd = "<cmd>lua require('spectre.actions').send_to_qf()<CR>",
desc = "send all item to quickfix",
},
["replace_cmd"] = {
map = "\\c",
cmd = "<cmd>lua require('spectre.actions').replace_cmd()<CR>",
desc = "input replace vim command",
},
["show_option_menu"] = {
map = "\\o",
cmd = "<cmd>lua require('spectre').show_options()<CR>",
desc = "show option",
},
["run_replace"] = {
map = "\\R",
cmd = "<cmd>lua require('spectre.actions').run_replace()<CR>",
desc = "replace all",
},
["change_view_mode"] = {
map = "\\v",
cmd = "<cmd>lua require('spectre').change_view()<CR>",
desc = "change result view mode",
},
["toggle_live_update"] = {
map = "tu",
cmd = "<cmd>lua require('spectre').toggle_live_update()<CR>",
desc = "update change when vim write file.",
},
["toggle_ignore_case"] = {
map = "ti",
cmd = "<cmd>lua require('spectre').change_options('ignore-case')<CR>",
desc = "toggle ignore case",
},
["toggle_ignore_hidden"] = {
map = "th",
cmd = "<cmd>lua require('spectre').change_options('hidden')<CR>",
desc = "toggle search hidden",
},
-- you can put your mapping here it only use normal mode
},
})
end
return M
|
beautifulPeople = { [90]=true, [92]=true, [93]=true, [97]=true, [138]=true, [139]=true, [140]=true, [146]=true, [152]=true }
cop = { [280]=true, [281]=true, [282]=true, [283]=true, [84]=true, [286]=true, [288]=true, [287]=true }
swat = { [285]=true }
flashCar = { [601]=true, [541]=true, [415]=true, [480]=true, [411]=true, [506]=true, [451]=true, [477]=true, [409]=true, [580]=true, [575]=true, [603]=true }
emergencyVehicles = { [416]=true, [427]=true, [490]=true, [528]=true, [407]=true, [544]=true, [523]=true, [598]=true, [596]=true, [597]=true, [599]=true, [601]=true }
local pictureValue = 0
local collectionValue = 0
local localPlayer = getLocalPlayer()
-- Ped at submission desk just for the aesthetics.
local victoria = createPed(141, 359.7, 173.57419128418, 1008.3893432617)
setPedRotation(victoria, 270)
setElementDimension(victoria, 1289)
setElementInterior(victoria, 3)
setPedAnimation ( victoria, "INT_OFFICE", "OFF_Sit_Idle_Loop", -1, true, false, false )
function snapPicture(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement )
local logged = getElementData(localPlayer, "loggedin")
if (logged==1) then
local theTeam = getPlayerTeam(localPlayer)
if (theTeam) then
local factionType = getElementData(theTeam, "type")
if (factionType==6) then
if (weapon == 43) then
pictureValue = 0
local onScreenPlayers = {}
local players = getElementsByType( "player" )
for theKey, thePlayer in ipairs(players) do -- thePlayer ~= localPlayer
if (isElementOnScreen(thePlayer) == true ) then
table.insert(onScreenPlayers, thePlayer) -- Identify everyone who is on the screen as the picture is taken.
end
end
for theKey,thePlayer in ipairs(onScreenPlayers) do
local Tx,Ty,Tz = getElementPosition(thePlayer)
local Px,Py,Pz = getElementPosition(getLocalPlayer())
local isclear = isLineOfSightClear (Px, Py, Pz +1, Tx, Ty, Tz, true, true, false, true, true, false)
if (isclear) then
-------------------
-- Player Checks --
-------------------
local skin = getElementModel(thePlayer)
if(beautifulPeople[skin]) then
pictureValue=pictureValue+50
end
if(getPedWeapon(thePlayer)~=0)and(getPedTotalAmmo(thePlayer)~=0) then
pictureValue=pictureValue+25
if (cop[skin])then
pictureValue=pictureValue+5
end
end
if(swat[skin])then
pictureValue=pictureValue+50
end
if(getPedControlState(thePlayer, "fire"))then
pictureValue=pictureValue+50
end
if(isPedChoking(thePlayer))then
pictureValue=pictureValue+50
end
if(isPedDoingGangDriveby(thePlayer))then
pictureValue=pictureValue+100
end
if(isPedHeadless(thePlayer))then
pictureValue=pictureValue+200
end
if(isPedOnFire(thePlayer))then
pictureValue=pictureValue+250
end
if(isPlayerDead(thePlayer))then
pictureValue=pictureValue+150
end
if (#onScreenPlayers>3)then
pictureValue=pictureValue+10
end
--------------------
-- Vehicle checks --
--------------------
local vehicle = getPedOccupiedVehicle(thePlayer)
if(vehicle)then
if(flashCar[vehicle])then
pictureValue=pictureValue+200
end
if(emergencyVehicle[vehicle])and(getVehicleSirensOn(vehicle)) then
pictureValue=pictureValue+100
end
if not (isVehicleOnGround(vehicle))then
pictureValue=pictureValue+200
end
end
end
end
if(pictureValue==0)then
outputChatBox("No one is going to pay for that picture...", 255, 0, 0)
else
collectionValue = collectionValue + pictureValue
outputChatBox("#FF9933That's a keeper! Picture value: $"..pictureValue, 255, 104, 91, true)
end
outputChatBox("#FF9933Collection value: $"..collectionValue, 255, 104, 91, true)
end
end
end
end
end
addEventHandler("onClientPlayerWeaponFire", getLocalPlayer(), snapPicture)
-- /totalvalue to see how much your collection of pictures is worth.
function showValue()
outputChatBox("#FF9933Collection value: $"..collectionValue, 255, 104, 91, true)
end
addCommandHandler("totalvalue", showValue, false, false)
-- /sellpics to sell your collection of pictures to the news company.
function sellPhotos()
local theTeam = getPlayerTeam(localPlayer)
local factionType = getElementData(theTeam, "type")
if (factionType==6) then
if not(photoSubmitDeskMarker)then
photoSubmitDeskMarker = createMarker( 362, 173, 1007, "cylinder", 1, 0, 100, 255, 170 )
photoSubmitDeskColSphere = createColSphere( 362, 173, 1007, 2 )
setElementInterior(photoSubmitDeskMarker,3)
setElementInterior(photoSubmitDeskColSphere,3)
setElementDimension(photoSubmitDeskMarker, 1289)
setElementDimension(photoSubmitDeskColSphere, 1289)
outputChatBox("#FF9933You can sell your photographs at the #3399FFSan Andreas Network Tower #FF9933((/sellpics at the front desk)).", 255, 255, 255, true)
else
if (isElementWithinColShape(localPlayer, photoSubmitDeskColSphere))then
if(collectionValue==0)then
outputChatBox("None of the pictures you have are worth anything.", 255, 0, 0, true)
else
triggerServerEvent("submitCollection", localPlayer, collectionValue)
collectionValue = 0
end
else
outputChatBox("#FF9933You can sell your photographs at the #3399FFSan Andreas Network Tower #FF9933((/sellpics at the front desk)).", 255, 255, 255, true)
end
end
end
end
addCommandHandler("sellpics", sellPhotos, false, false)
|
-- initialization block
file.CreateDir("http_cache")
if sql.Query([[
CREATE TABLE IF NOT EXISTS `http_cache` (
`URL` TEXT PRIMARY KEY NOT NULL,
`Name` TEXT NOT NULL UNIQUE,
`ETag` TEXT,
`LastModified` TEXT,
`LastValidation` INTEGER NOT NULL,
`MaxAge` INTEGER NOT NULL,
`CRC32` INTEGER NOT NULL
)
]]) == false then
error(sql.LastError())
end
-- end of initialization block
http_cache = {}
local http_cache = http_cache
include("file.lua")
local timezone_difference = os.time() - os.time(os.date("!*t"))
local function GetUTCTime()
return os.time() - timezone_difference
end
http_cache.GetUTCTime = GetUTCTime
-- taken from https://github.com/Tieske/uuid
local lua_version = tonumber(string.match(_VERSION, "%d%.*%d*"))
local time = SysTime or os.clock or os.time
local function randomseed()
local seed = math.floor(math.abs(time() * 10000))
if seed >= 2 ^ 32 then
-- integer overflow, so reduce to prevent a bad seed
seed = seed - math.floor(seed / 2 ^ 32) * (2 ^ 32)
end
if lua_version < 5.2 then
-- 5.1 uses (incorrect) signed int
math.randomseed(seed - 2 ^ (32 - 1))
else
-- 5.2 uses (correct) unsigned int
math.randomseed(seed)
end
end
local valid_characters = {
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"-", "_", " ", "!", "@", "#", "$", "%", "^", "&", "(", ")", "=", "+", ";", "'", ",", "~", "`", "[", "]", "{", "}"
}
local function GenerateRandomName()
randomseed()
local v = valid_characters
local s = #valid_characters
local r = math.random
return -- 32 bytes of valid filesystem characters (59 valid characters)
v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] ..
v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] ..
v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] ..
v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)] .. v[r(1, s)]
end
http_cache.GenerateRandomName = GenerateRandomName
--[[
local function GenerateUUID()
randomseed()
return string.format(
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
math.random(0, 255), math.random(0, 255), math.random(0, 255), math.random(0, 255),
math.random(0, 255), math.random(0, 255),
bit.band(math.random(0, 255), 0x0F) + 0x40, math.random(0, 255),
bit.band(math.random(0, 255), 0x3F) + 0x80, math.random(0, 255),
math.random(0, 255), math.random(0, 255), math.random(0, 255), math.random(0, 255), math.random(0, 255), math.random(0, 255)
)
end
http_cache.GenerateUUID = GenerateUUID
]]
local function StringXOR(str)
if #str == 0 then
return ""
end
local crc = util.CRC(str)
local xor = {
math.floor(crc / 0x1000000) % 0x100,
math.floor(crc / 0x10000) % 0x100,
math.floor(crc / 0x100) % 0x100,
crc % 0x100
}
local xstr = ""
for i = 1, #str do
xstr = xstr .. string.char(bit.band(bit.bxor(string.byte(str, i, i), xor[(i - 1) % 4 + 1]), 0xFF))
end
return xstr
end
http_cache.StringXOR = StringXOR
local function GetInfo(xurl)
local data = sql.Query("SELECT `Name`, `ETag`, `LastModified`, `LastValidation`, `MaxAge`, `CRC32` FROM `http_cache` WHERE `URL` = " .. sql.SQLStr(xurl))
if type(data) ~= "table" or data[1] == nil then
return false
end
local entry = data[1]
entry.LastValidation = tonumber(entry.LastValidation)
entry.MaxAge = tonumber(entry.MaxAge)
entry.CRC32 = tonumber(entry.CRC32)
return entry.Name, entry.ETag, entry.LastModified, entry.LastValidation, entry.MaxAge, entry.CRC32
end
http_cache.GetInfo = GetInfo
local query_simple = "INSERT OR REPLACE INTO `http_cache` (`URL`, `Name`, `LastValidation`, `MaxAge`, `CRC32`) VALUES(%s, %s, %d, %d, %d)"
local query_modified = "INSERT OR REPLACE INTO `http_cache` (`URL`, `Name`, `LastModified`, `LastValidation`, `MaxAge`, `CRC32`) VALUES(%s, %s, %s, %d, %d, %d)"
local query_etag = "INSERT OR REPLACE INTO `http_cache` (`URL`, `Name`, `ETag`, `LastValidation`, `MaxAge`, `CRC32`) VALUES(%s, %s, %s, %d, %d, %d)"
local query_both = "INSERT OR REPLACE INTO `http_cache` (`URL`, `Name`, `ETag`, `LastModified`, `LastValidation`, `MaxAge`, `CRC32`) VALUES(%s, %s, %s, %s, %d, %d, %d)"
local function UpdateInfo(xurl, name, etag, lastmodified, lastvalidation, maxage, crc32)
local query
if etag ~= nil and lastmodified ~= nil then
query = string.format(query_both, xurl, name, etag, lastmodified, lastvalidation, maxage, crc32)
elseif etag ~= nil then
query = string.format(query_etag, xurl, name, etag, lastvalidation, maxage, crc32)
elseif lastmodified ~= nil then
query = string.format(query_modified, xurl, name, lastmodified, lastvalidation, maxage, crc32)
else
query = string.format(query_simple, xurl, name, lastvalidation, maxage, crc32)
end
if sql.Query(query) == false then
print(sql.LastError())
return false
end
return true
end
http_cache.UpdateInfo = UpdateInfo
return http_cache
|
mail_foot_db = {
id0 = {
source = "An Unwelcome Guest",
drop_rate = "quest",
name = "Scalehide Spurs",
category_territory = "",
territory = "War Zone",
id = "0",
expansion = "",
location = "Redridge Mountains"
},
id1 = {
source = "An Unwelcome Guest",
drop_rate = "quest",
name = "Spiritbound Boots",
category_territory = "",
territory = "War Zone",
id = "1",
expansion = "",
location = "Redridge Mountains"
},
id2 = {
source = "Gren Tornfur",
drop_rate = "0.0",
name = "Kaldorei Archer's Greaves",
category_territory = "",
territory = "War Zone",
id = "2",
expansion = "",
location = "Darkshore"
},
id3 = {
source = "Thelar Moonstrike",
drop_rate = "0.0",
name = "Blightguard's Footguards",
category_territory = "",
territory = "War Zone",
id = "3",
expansion = "",
location = "Darkshore"
},
id4 = {
source = "Fetid Devourer",
drop_rate = "0.0",
name = "Fused Monstrosity Stompers",
category_territory = "Raid",
territory = "Horde",
id = "4",
expansion = "Battle For Azeroth",
location = "Uldir"
},
id5 = {
source = "Warbringer Yenajz",
drop_rate = "Unknown",
name = "Yenajz's Chitinous Stompers",
category_territory = "",
territory = "Horde",
id = "5",
expansion = "Battle For Azeroth",
location = "Stormsong Valley"
},
id6 = {
source = "Tzane",
drop_rate = "Unknown",
name = "Swampwalker's Soul-Treads",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "6",
expansion = "Battle For Azeroth",
location = "Nazmir"
},
id7 = {
source = "Hoarder Jena",
drop_rate = "Unknown",
name = "Akunda's Grounding Boots",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "7",
expansion = "Battle For Azeroth",
location = "Vol'dun"
},
id8 = {
source = "Sister Lilyana",
drop_rate = "Unknown",
name = "Stormbreaker Galoshes",
category_territory = "",
territory = "Horde",
id = "8",
expansion = "Battle For Azeroth",
location = "Stormsong Valley"
},
id9 = {
source = "Honorbound Spiritcaller",
drop_rate = "0.0",
name = "Gayeong's Gentle Step",
category_territory = "",
territory = "Horde",
id = "9",
expansion = "Battle For Azeroth",
location = "Stormsong Valley"
},
id10 = {
source = "Provisioner Lija",
drop_rate = "Unknown",
name = "Torga Scale Boots",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "10",
expansion = "Battle For Azeroth",
location = "Nazmir"
},
id11 = {
source = "Rawani Kanae",
drop_rate = "Unknown",
name = "Lightgrace Sabatons",
category_territory = "Raid",
territory = "Horde",
id = "11",
expansion = "Battle For Azeroth",
location = "Battle of Dazar'alor"
},
id12 = {
source = "Opulence",
drop_rate = "Unknown",
name = "Boots of the Gilded Path",
category_territory = "Raid",
territory = "Horde",
id = "12",
expansion = "Battle For Azeroth",
location = "Battle of Dazar'alor"
},
id13 = {
source = "Natalhakata",
drop_rate = "Unknown",
name = "Gral Worshipper's Waders",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "13",
expansion = "Battle For Azeroth",
location = "Dazar'alor"
},
id14 = {
source = "Provisioner Fray",
drop_rate = "Unknown",
name = "Yardarm Sharpshooter's Boots",
category_territory = "",
territory = "Horde",
id = "14",
expansion = "Battle For Azeroth",
location = "Boralus"
},
id15 = {
source = "Yazma",
drop_rate = "Unknown",
name = "Souldrifting Sabatons",
category_territory = "Dungeon",
territory = "Horde",
id = "15",
expansion = "Battle For Azeroth",
location = "Atal'Dazar"
},
id16 = {
source = "Trothak",
drop_rate = "0.0",
name = "Shell-Kickers",
category_territory = "Dungeon",
territory = "Horde",
id = "16",
expansion = "Battle For Azeroth",
location = "Freehold"
},
id17 = {
source = "Jes Howlis",
drop_rate = "0.0",
name = "Gnawed Iron Fetters",
category_territory = "Dungeon",
territory = "Horde",
id = "17",
expansion = "Battle For Azeroth",
location = "Tol Dagor"
},
id18 = {
source = "Akaali the Conqueror",
drop_rate = "Unknown",
name = "Boots of the Headlong Conqueror",
category_territory = "Dungeon",
territory = "Horde",
id = "18",
expansion = "Battle For Azeroth",
location = "Kings' Rest"
},
id19 = {
source = "Dread Captain Lockwood",
drop_rate = "0.0",
name = "Sure-Foot Sabatons",
category_territory = "Dungeon",
territory = "Horde",
id = "19",
expansion = "Battle For Azeroth",
location = "Siege of Boralus"
},
id20 = {
source = "Adderis",
drop_rate = "Unknown",
name = "Sabatons of Coruscating Energy",
category_territory = "Dungeon",
territory = "Horde",
id = "20",
expansion = "Battle For Azeroth",
location = "Temple of Sethraliss"
},
id21 = {
source = "Cragmaw the Infested",
drop_rate = "0.0",
name = "Waders of the Infested",
category_territory = "Dungeon",
territory = "Horde",
id = "21",
expansion = "Battle For Azeroth",
location = "The Underrot"
},
id22 = {
source = "Sister Briar",
drop_rate = "Unknown",
name = "Bramble Looped Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "22",
expansion = "Battle For Azeroth",
location = "Waycrest Manor"
},
id23 = {
source = "Corrupted Tideskipper",
drop_rate = "0.0",
name = "Boralus-Captain's Chain Boots",
category_territory = "",
territory = "Horde",
id = "23",
expansion = "Battle For Azeroth",
location = "Stormsong Valley"
},
id24 = {
source = "Tempestria",
drop_rate = "0.0",
name = "Saurolisk Broodmother Boots",
category_territory = "",
territory = "Horde",
id = "24",
expansion = "Battle For Azeroth",
location = "Tiragarde Sound"
},
id25 = {
source = "Golrakahn",
drop_rate = "0.0",
name = "Thundercrash Footguards",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "25",
expansion = "Battle For Azeroth",
location = "Zuldazar"
},
id26 = {
source = "Gut-Gut the Glutton",
drop_rate = "0.0",
name = "Gluttonous Carnivore Treads",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "26",
expansion = "Battle For Azeroth",
location = "Vol'dun"
},
id27 = {
source = "Korgresh Coldrage",
drop_rate = "0.0",
name = "7th Legionnaire's Sabatons",
category_territory = "",
territory = "Horde",
id = "27",
expansion = "",
location = "Arathi Highlands"
},
id28 = {
source = "Kovork",
drop_rate = "0.0",
name = "Honorbound Vanguard's Sabatons",
category_territory = "",
territory = "Horde",
id = "28",
expansion = "",
location = "Arathi Highlands"
},
id29 = {
source = "Blood Troll Brutalizer",
drop_rate = "0.0",
name = "Zalamar Greaves",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "29",
expansion = "Battle For Azeroth",
location = "Nazmir"
},
id30 = {
source = "Volzith the Whisperer",
drop_rate = "0.0",
name = "Eventide Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "30",
expansion = "Battle For Azeroth",
location = "Shrine of the Storm"
},
id31 = {
source = "Savagemane Ravasaur",
drop_rate = "0.0",
name = "Ravascale Striders",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "31",
expansion = "Battle For Azeroth",
location = "Zuldazar"
},
id32 = {
source = "Scaleclaw Broodmother",
drop_rate = "0.0",
name = "Bonepicker Footguards",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "32",
expansion = "Battle For Azeroth",
location = "Vol'dun"
},
id33 = {
source = "Imonar the Soulhunter",
drop_rate = "Unknown",
name = "Deft Soulhunter's Sabatons",
category_territory = "Raid",
territory = "Horde",
id = "33",
expansion = "Legion",
location = "Antorus, the Burning Throne"
},
id34 = {
source = "Varimathras",
drop_rate = "Unknown",
name = "Nathrezim Shade-Walkers",
category_territory = "Raid",
territory = "Horde",
id = "34",
expansion = "Legion",
location = "Antorus, the Burning Throne"
},
id35 = {
source = "Occularus",
drop_rate = "Unknown",
name = "Sabatons of Ceaseless Assault",
category_territory = "",
territory = "Horde",
id = "35",
expansion = "Legion",
location = "Black Temple"
},
id36 = {
source = "Aggramar",
drop_rate = "Unknown",
name = "Greatboots of the Searing Tempest",
category_territory = "Raid",
territory = "Horde",
id = "36",
expansion = "Legion",
location = "Antorus, the Burning Throne"
},
id37 = {
source = "Harjatan",
drop_rate = "0.0",
name = "Insulated Finpads",
category_territory = "Raid",
territory = "Horde",
id = "37",
expansion = "Legion",
location = "Tomb of Sargeras"
},
id38 = {
source = "Kiljaeden",
drop_rate = "Unknown",
name = "Star-Stalker Treads",
category_territory = "Raid",
territory = "Horde",
id = "38",
expansion = "Legion",
location = "Tomb of Sargeras"
},
id39 = {
source = "Ghostly Acolyte",
drop_rate = "0.0",
name = "Treads of Panicked Escape",
category_territory = "Raid",
territory = "Horde",
id = "39",
expansion = "Legion",
location = "Tomb of Sargeras"
},
id40 = {
source = "Malificus",
drop_rate = "Unknown",
name = "Treads of Disorderly Retreat",
category_territory = "",
territory = "Horde",
id = "40",
expansion = "Legion",
location = "Broken Shore"
},
id41 = {
source = "Spellblade Aluriel",
drop_rate = "Unknown",
name = "Sabatons of Burning Steps",
category_territory = "Raid",
territory = "Horde",
id = "41",
expansion = "Legion",
location = "The Nighthold"
},
id42 = {
source = "High Botanist Telarn",
drop_rate = "0.0",
name = "Shal'dorei Weedstompers",
category_territory = "Raid",
territory = "Horde",
id = "42",
expansion = "Legion",
location = "The Nighthold"
},
id43 = {
source = "Calamir",
drop_rate = "Unknown",
name = "Frostburned Sabatons",
category_territory = "",
territory = "Horde",
id = "43",
expansion = "Legion",
location = "Azsuna"
},
id44 = {
source = "Vizaduum the Watcher",
drop_rate = "0.0",
name = "Doomstride Footguards",
category_territory = "Dungeon",
territory = "Horde",
id = "44",
expansion = "Legion",
location = "Return to Karazhan"
},
id45 = {
source = "Blood in the Tides",
drop_rate = "quest",
name = "Outrigger Boots",
category_territory = "",
territory = "Horde",
id = "45",
expansion = "Battle For Azeroth",
location = "Tiragarde Sound"
},
id46 = {
source = "Life Preserver",
drop_rate = "quest",
name = "Crone-Seeker's Boots",
category_territory = "",
territory = "Horde",
id = "46",
expansion = "Battle For Azeroth",
location = "Drustvar"
},
id47 = {
source = "Unnecessary Duress",
drop_rate = "quest",
name = "Stormchaser Boots",
category_territory = "",
territory = "Horde",
id = "47",
expansion = "Battle For Azeroth",
location = "Stormsong Valley"
},
id48 = {
source = "Rastakhans Might",
drop_rate = "quest",
name = "Torcalin Boots",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "48",
expansion = "Battle For Azeroth",
location = "Zuldazar"
},
id49 = {
source = "Aided Escape",
drop_rate = "quest",
name = "Resilient Outcast's Boots",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "49",
expansion = "Battle For Azeroth",
location = "Vol'dun"
},
id50 = {
source = "Big Gulls Wont Die",
drop_rate = "quest",
name = "Anglin' Art's Waders",
category_territory = "",
territory = "Horde",
id = "50",
expansion = "Battle For Azeroth",
location = "Drustvar"
},
id51 = {
source = "For Kul Tiras!",
drop_rate = "quest",
name = "Outrigger Walkers",
category_territory = "",
territory = "Horde",
id = "51",
expansion = "Battle For Azeroth",
location = "Tiragarde Sound"
},
id52 = {
source = "Roughneck Riders",
drop_rate = "quest",
name = "Outrigger Striders",
category_territory = "",
territory = "Horde",
id = "52",
expansion = "Battle For Azeroth",
location = "Tiragarde Sound"
},
id53 = {
source = "Ravenous Landsharks",
drop_rate = "quest",
name = "Torcalin Sabatons",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "53",
expansion = "Battle For Azeroth",
location = "Zuldazar"
},
id54 = {
source = "Grand Theft Telemancy",
drop_rate = "quest",
name = "Torcalin Treads",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "54",
expansion = "Battle For Azeroth",
location = "Zuldazar"
},
id55 = {
source = "Witchrending",
drop_rate = "quest",
name = "Crone-Seeker's Walkers",
category_territory = "",
territory = "Horde",
id = "55",
expansion = "Battle For Azeroth",
location = "Drustvar"
},
id56 = {
source = "Grizzled",
drop_rate = "quest",
name = "Stormchaser Striders",
category_territory = "",
territory = "Horde",
id = "56",
expansion = "Battle For Azeroth",
location = "Stormsong Valley"
},
id57 = {
source = "Kelvaxs Home",
drop_rate = "quest",
name = "Death-Pledged Treads",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "57",
expansion = "Battle For Azeroth",
location = "Nazmir"
},
id58 = {
source = "Cease all Summoning",
drop_rate = "quest",
name = "Death-Pledged Footguards",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "58",
expansion = "Battle For Azeroth",
location = "Nazmir"
},
id59 = {
source = "Kragwa the Terrible",
drop_rate = "quest",
name = "Death-Pledged Boots",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "59",
expansion = "Battle For Azeroth",
location = "Nazmir"
},
id60 = {
source = "Catch Me if You Can",
drop_rate = "quest",
name = "Death-Pledged Striders",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "60",
expansion = "Battle For Azeroth",
location = "Nazmir"
},
id61 = {
source = "The Head of Her Enemy",
drop_rate = "quest",
name = "Torcalin Walkers",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "61",
expansion = "Battle For Azeroth",
location = "Zuldazar"
},
id62 = {
source = "Sulthis Stone",
drop_rate = "quest",
name = "Resilient Outcast's Sabatons",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "62",
expansion = "Battle For Azeroth",
location = "Vol'dun"
},
id63 = {
source = "Enemy Within",
drop_rate = "quest",
name = "Outrigger Waders",
category_territory = "",
territory = "Horde",
id = "63",
expansion = "Battle For Azeroth",
location = "Tiragarde Sound"
},
id64 = {
source = "Building Defenses",
drop_rate = "quest",
name = "Crone-Seeker's Treads",
category_territory = "",
territory = "Horde",
id = "64",
expansion = "Battle For Azeroth",
location = "Drustvar"
},
id65 = {
source = "Ettin It Done",
drop_rate = "quest",
name = "Stormchaser Footguards",
category_territory = "",
territory = "Horde",
id = "65",
expansion = "Battle For Azeroth",
location = "Stormsong Valley"
},
id66 = {
source = "Reclaiming our Defenses",
drop_rate = "quest",
name = "Stormchaser Treads",
category_territory = "",
territory = "Horde",
id = "66",
expansion = "Battle For Azeroth",
location = "Stormsong Valley"
},
id67 = {
source = "Battle Victorious",
drop_rate = "quest",
name = "Stormchaser Footgear",
category_territory = "",
territory = "Horde",
id = "67",
expansion = "Battle For Azeroth",
location = "Stormsong Valley"
},
id68 = {
source = "This Be Mutiny",
drop_rate = "quest",
name = "Resilient Outcast's Footgear",
category_territory = "Outdoor Zone",
territory = "Horde",
id = "68",
expansion = "Battle For Azeroth",
location = "Vol'dun"
},
id69 = {
source = "Elfyra",
drop_rate = "Unknown",
name = "Boots of False Promises",
category_territory = "Dungeon",
territory = "Horde",
id = "69",
expansion = "Legion",
location = "Return to Karazhan"
},
id70 = {
source = "Odyn",
drop_rate = "Unknown",
name = "Radiant Soul Sabatons",
category_territory = "Raid",
territory = "Horde",
id = "70",
expansion = "Legion",
location = "Trial of Valor"
},
id71 = {
source = "Ysondre",
drop_rate = "0.0",
name = "Malignant Sabatons",
category_territory = "Raid",
territory = "Horde",
id = "71",
expansion = "Legion",
location = "The Emerald Nightmare"
},
id72 = {
source = "Elerethe Renferal",
drop_rate = "0.0",
name = "Black Venom Sabatons",
category_territory = "Raid",
territory = "Horde",
id = "72",
expansion = "Legion",
location = "The Emerald Nightmare"
},
id73 = {
source = "Ursoc",
drop_rate = "0.0",
name = "Scored Ironclaw Sabatons",
category_territory = "Raid",
territory = "Horde",
id = "73",
expansion = "Legion",
location = "The Emerald Nightmare"
},
id74 = {
source = "God-King Skovald",
drop_rate = "0.0",
name = "Felstep Footguards",
category_territory = "Dungeon",
territory = "Horde",
id = "74",
expansion = "Legion",
location = "Halls of Valor"
},
id75 = {
source = "Dresaron",
drop_rate = "0.0",
name = "Whelp Handler's Lined Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "75",
expansion = "Legion",
location = "Darkheart Thicket"
},
id76 = {
source = "Serpentrix",
drop_rate = "0.0",
name = "Hydra Scale Sabatons",
category_territory = "Dungeon",
territory = "Horde",
id = "76",
expansion = "Legion",
location = "Eye of Azshara"
},
id77 = {
source = "Fel Lord Betrug",
drop_rate = "0.0",
name = "Begrudging Trudgers",
category_territory = "Dungeon",
territory = "Horde",
id = "77",
expansion = "Legion",
location = "Violet Hold"
},
id78 = {
source = "Lord Kurtalos Ravencrest",
drop_rate = "Unknown",
name = "Ravencrest's Unerring Striders",
category_territory = "Dungeon",
territory = "Horde",
id = "78",
expansion = "Legion",
location = "Black Rook Hold"
},
id79 = {
source = "Millificent Manastorm",
drop_rate = "Unknown",
name = "Plasma-Drilled Steel Toes",
category_territory = "Dungeon",
territory = "Horde",
id = "79",
expansion = "Legion",
location = "Violet Hold"
},
id80 = {
source = "Tirathon Saltheril",
drop_rate = "0.0",
name = "Striders of Furious Flight",
category_territory = "Dungeon",
territory = "Horde",
id = "80",
expansion = "Legion",
location = "Vault of the Wardens"
},
id81 = {
source = "Agronox",
drop_rate = "0.0",
name = "Corruption-Fused Stompers",
category_territory = "Dungeon",
territory = "Horde",
id = "81",
expansion = "Legion",
location = "Cathedral of Eternal Night"
},
id82 = {
source = "Zuraal the Ascended",
drop_rate = "0.0",
name = "Void-Coated Stompers",
category_territory = "Dungeon",
territory = "Horde",
id = "82",
expansion = "Legion",
location = "The Seat of the Triumvirate"
},
id83 = {
source = "Dreadsoul Wrathguard",
drop_rate = "0.0",
name = "Geta of Tay'Shute",
category_territory = "",
territory = "Horde",
id = "83",
expansion = "Legion",
location = "Broken Shore"
},
id84 = {
source = "Flamesmith Lanying",
drop_rate = "Unknown",
name = "Farseer's Footwraps",
category_territory = "",
territory = "",
id = "84",
expansion = "Legion",
location = "The Maelstrom"
},
id85 = {
source = "Outfitter Reynolds",
drop_rate = "Unknown",
name = "Treads of the Unseen Path",
category_territory = "",
territory = "",
id = "85",
expansion = "Legion",
location = "Trueshot Lodge"
},
id86 = {
source = "Felsiege Infernal",
drop_rate = "0.0",
name = "Vilescale Sabatons",
category_territory = "",
territory = "Horde",
id = "86",
expansion = "Legion",
location = "Highmountain"
},
id87 = {
source = "Dargrul",
drop_rate = "0.0",
name = "Bitestone Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "87",
expansion = "Legion",
location = "Neltharion's Lair"
},
id88 = {
source = "Ymiron, the Fallen King",
drop_rate = "0.0",
name = "Tideskorn Sabatons",
category_territory = "Dungeon",
territory = "Horde",
id = "88",
expansion = "Legion",
location = "Maw of Souls"
},
id89 = {
source = "Ixdreloth",
drop_rate = "0.0",
name = "Sea Stalker's Boots",
category_territory = "",
territory = "Horde",
id = "89",
expansion = "Legion",
location = "Highmountain"
},
id90 = {
source = "Advisor Melandrus",
drop_rate = "Unknown",
name = "Ley Dragoon's Stompers",
category_territory = "Dungeon",
territory = "Horde",
id = "90",
expansion = "Legion",
location = "Court of Stars"
},
id91 = {
source = "Zagmothar",
drop_rate = "0.0",
name = "Manaburst Greaves",
category_territory = "",
territory = "Horde",
id = "91",
expansion = "Legion",
location = "Val'sharah"
},
id92 = {
source = "Cordana Felsong",
drop_rate = "0.0",
name = "Mardum Chain Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "92",
expansion = "Legion",
location = "Vault of the Wardens"
},
id93 = {
source = "Dreadsworn Annihilator",
drop_rate = "0.0",
name = "Isle Watcher's Boots",
category_territory = "",
territory = "Horde",
id = "93",
expansion = "Legion",
location = "Azsuna"
},
id94 = {
source = "Dreadsworn Annihilator",
drop_rate = "0.0",
name = "Bramblemail Boots",
category_territory = "",
territory = "Horde",
id = "94",
expansion = "Legion",
location = "Azsuna"
},
id95 = {
source = "Hellfire Infernal",
drop_rate = "0.0",
name = "Skyhorn Boots",
category_territory = "",
territory = "Horde",
id = "95",
expansion = "Legion",
location = "Thunder Totem"
},
id96 = {
source = "Felsiege Infernal",
drop_rate = "0.0",
name = "Spider Stompers",
category_territory = "",
territory = "Horde",
id = "96",
expansion = "Legion",
location = "Highmountain"
},
id97 = {
source = "Fel Commander Erixtol",
drop_rate = "0.0",
name = "Ered'ruin Boots",
category_territory = "",
territory = "Horde",
id = "97",
expansion = "Legion",
location = "Highmountain"
},
id98 = {
source = "Hertha Grimdottir",
drop_rate = "0.0",
name = "Exile's Chain Boots",
category_territory = "",
territory = "Horde",
id = "98",
expansion = "Legion",
location = "Suramar"
},
id99 = {
source = "First Arcanist Thalyssra",
drop_rate = "Unknown",
name = "Footpads of the Nightrunners",
category_territory = "",
territory = "Horde",
id = "99",
expansion = "Legion",
location = "Suramar"
},
id100 = {
source = "Holly McTilla",
drop_rate = "Unknown",
name = "Warmongering Gladiator's Footguards of Cruelty",
category_territory = "",
territory = "War Zone",
id = "100",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id101 = {
source = "Holly McTilla",
drop_rate = "Unknown",
name = "Warmongering Gladiator's Footguards of Prowess",
category_territory = "",
territory = "War Zone",
id = "101",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id102 = {
source = "Holly McTilla",
drop_rate = "Unknown",
name = "Warmongering Gladiator's Footguards of Victory",
category_territory = "",
territory = "War Zone",
id = "102",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id103 = {
source = "Malukah Lightsong",
drop_rate = "Unknown",
name = "Warmongering Gladiator's Footguards of Cruelty",
category_territory = "",
territory = "Alliance",
id = "103",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id104 = {
source = "Malukah Lightsong",
drop_rate = "Unknown",
name = "Warmongering Gladiator's Footguards of Prowess",
category_territory = "",
territory = "Alliance",
id = "104",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id105 = {
source = "Malukah Lightsong",
drop_rate = "Unknown",
name = "Warmongering Gladiator's Footguards of Victory",
category_territory = "",
territory = "Alliance",
id = "105",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id106 = {
source = "Tyrant Velhari",
drop_rate = "Unknown",
name = "Spiked Throatcrusher Boots",
category_territory = "Raid",
territory = "Horde",
id = "106",
expansion = "Warlords Of Draenor",
location = "Hellfire Citadel"
},
id107 = {
source = "Amelia Clarke",
drop_rate = "Unknown",
name = "Wild Gladiator's Footguards of Cruelty",
category_territory = "",
territory = "War Zone",
id = "107",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id108 = {
source = "Amelia Clarke",
drop_rate = "Unknown",
name = "Wild Gladiator's Footguards of Prowess",
category_territory = "",
territory = "War Zone",
id = "108",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id109 = {
source = "Amelia Clarke",
drop_rate = "Unknown",
name = "Wild Gladiator's Footguards of Victory",
category_territory = "",
territory = "War Zone",
id = "109",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id110 = {
source = "Cladd Dawnstrider",
drop_rate = "Unknown",
name = "Wild Gladiator's Footguards of Cruelty",
category_territory = "",
territory = "Alliance",
id = "110",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id111 = {
source = "Cladd Dawnstrider",
drop_rate = "Unknown",
name = "Wild Gladiator's Footguards of Prowess",
category_territory = "",
territory = "Alliance",
id = "111",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id112 = {
source = "Cladd Dawnstrider",
drop_rate = "Unknown",
name = "Wild Gladiator's Footguards of Victory",
category_territory = "",
territory = "Alliance",
id = "112",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id113 = {
source = "Li ",
drop_rate = "Unknown",
name = "Warmongering Combatant's Footguards of Cruelty",
category_territory = "",
territory = "War Zone",
id = "113",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id114 = {
source = "Li ",
drop_rate = "Unknown",
name = "Warmongering Combatant's Footguards of Prowess",
category_territory = "",
territory = "War Zone",
id = "114",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id115 = {
source = "Taeloxe Soulshrivel",
drop_rate = "Unknown",
name = "Warmongering Combatant's Footguards of Cruelty",
category_territory = "",
territory = "Alliance",
id = "115",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id116 = {
source = "Taeloxe Soulshrivel",
drop_rate = "Unknown",
name = "Warmongering Combatant's Footguards of Prowess",
category_territory = "",
territory = "Alliance",
id = "116",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id117 = {
source = "Shadow-Lord Iskar",
drop_rate = "0.0",
name = "Surefooted Chain Treads",
category_territory = "Raid",
territory = "Horde",
id = "117",
expansion = "Warlords Of Draenor",
location = "Hellfire Citadel"
},
id118 = {
source = "Sargerei Soul Cleaver",
drop_rate = "0.0",
name = "Unhallowed Voidlink Boots",
category_territory = "Raid",
territory = "Horde",
id = "118",
expansion = "Warlords Of Draenor",
location = "Hellfire Citadel"
},
id119 = {
source = "Iron Reaver",
drop_rate = "0.0",
name = "Die-Cast Ringmail Sabatons",
category_territory = "Raid",
territory = "Horde",
id = "119",
expansion = "Warlords Of Draenor",
location = "Hellfire Citadel"
},
id120 = {
source = "Xhulhorac",
drop_rate = "0",
name = "Rancorbite Sabatons",
category_territory = "Raid",
territory = "Horde",
id = "120",
expansion = "Warlords Of Draenor",
location = "Hellfire Citadel"
},
id121 = {
source = "Mannoroth",
drop_rate = "0",
name = "Hellstorm Sabatons",
category_territory = "Raid",
territory = "Horde",
id = "121",
expansion = "Warlords Of Draenor",
location = "Hellfire Citadel"
},
id122 = {
source = "Blood Guard Axelash",
drop_rate = "Unknown",
name = "Primal Gladiator's Footguards of Cruelty",
category_territory = "",
territory = "Alliance",
id = "122",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id123 = {
source = "Blood Guard Axelash",
drop_rate = "Unknown",
name = "Primal Gladiator's Footguards of Prowess",
category_territory = "",
territory = "Alliance",
id = "123",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id124 = {
source = "Blood Guard Axelash",
drop_rate = "Unknown",
name = "Primal Gladiator's Footguards of Victory",
category_territory = "",
territory = "Alliance",
id = "124",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id125 = {
source = "Kargath Bladefist",
drop_rate = "0.0",
name = "Treads of Sand and Blood",
category_territory = "Raid",
territory = "Horde",
id = "125",
expansion = "Warlords Of Draenor",
location = "Highmaul"
},
id126 = {
source = "Imperator Margok",
drop_rate = "0.0",
name = "Face Kickers",
category_territory = "Raid",
territory = "Horde",
id = "126",
expansion = "Warlords Of Draenor",
location = "Highmaul"
},
id127 = {
source = "Foreman Feldspar",
drop_rate = "Unknown",
name = "Slagstomper Treads",
category_territory = "Raid",
territory = "Horde",
id = "127",
expansion = "Warlords Of Draenor",
location = "Blackrock Foundry"
},
id128 = {
source = "Flamebender Kagraz",
drop_rate = "0.0",
name = "Treads of Rekindled Flames",
category_territory = "Raid",
territory = "Horde",
id = "128",
expansion = "Warlords Of Draenor",
location = "Blackrock Foundry"
},
id129 = {
source = "Operator Thogar",
drop_rate = "0.0",
name = "Railwalker's Ratcheted Boots",
category_territory = "Raid",
territory = "Horde",
id = "129",
expansion = "Warlords Of Draenor",
location = "Blackrock Foundry"
},
id130 = {
source = "Lady Fleshsear",
drop_rate = "0.0",
name = "Gatecrasher's Chain Boots",
category_territory = "",
territory = "Horde",
id = "130",
expansion = "Warlords Of Draenor",
location = "Frostwall"
},
id131 = {
source = "Ingrid Blackingot",
drop_rate = "Unknown",
name = "Primal Gladiator's Footguards of Cruelty",
category_territory = "",
territory = "War Zone",
id = "131",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id132 = {
source = "Ingrid Blackingot",
drop_rate = "Unknown",
name = "Primal Gladiator's Footguards of Prowess",
category_territory = "",
territory = "War Zone",
id = "132",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id133 = {
source = "Ingrid Blackingot",
drop_rate = "Unknown",
name = "Primal Gladiator's Footguards of Victory",
category_territory = "",
territory = "War Zone",
id = "133",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id134 = {
source = "Franzok",
drop_rate = "0",
name = "Drop Kickers",
category_territory = "Raid",
territory = "Horde",
id = "134",
expansion = "Warlords Of Draenor",
location = "Blackrock Foundry"
},
id135 = {
source = "Blackhand",
drop_rate = "0",
name = "Ram-Carrier's Treads",
category_territory = "Raid",
territory = "Horde",
id = "135",
expansion = "Warlords Of Draenor",
location = "Blackrock Foundry"
},
id136 = {
source = "Darkshard Acidback",
drop_rate = "0.0",
name = "Treads of the Veteran Smith",
category_territory = "Raid",
territory = "Horde",
id = "136",
expansion = "Warlords Of Draenor",
location = "Blackrock Foundry"
},
id137 = {
source = "Rukhmar",
drop_rate = "Unknown",
name = "Talongrip Spurs",
category_territory = "",
territory = "Horde",
id = "137",
expansion = "Warlords Of Draenor",
location = "Spires of Arak"
},
id138 = {
source = "Kromog",
drop_rate = "Unknown",
name = "Ashlink Treads",
category_territory = "Raid",
territory = "Horde",
id = "138",
expansion = "Warlords Of Draenor",
location = "Blackrock Foundry"
},
id139 = {
source = "Blademaster Jubeithos",
drop_rate = "Unknown",
name = "Bladewalk Boots",
category_territory = "Raid",
territory = "Horde",
id = "139",
expansion = "Warlords Of Draenor",
location = "Hellfire Citadel"
},
id140 = {
source = "Slugg Spinbolt",
drop_rate = "Unknown",
name = "Wild Combatant's Footguards of Cruelty",
category_territory = "",
territory = "War Zone",
id = "140",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id141 = {
source = "Slugg Spinbolt",
drop_rate = "Unknown",
name = "Wild Combatant's Footguards of Prowess",
category_territory = "",
territory = "War Zone",
id = "141",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id142 = {
source = "Fobbly Kickfix",
drop_rate = "Unknown",
name = "Wild Combatant's Footguards of Cruelty",
category_territory = "",
territory = "Alliance",
id = "142",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id143 = {
source = "Fobbly Kickfix",
drop_rate = "Unknown",
name = "Wild Combatant's Footguards of Prowess",
category_territory = "",
territory = "Alliance",
id = "143",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id144 = {
source = "Thogar Gorefist",
drop_rate = "0.0",
name = "Sabatons of Radiating Ire",
category_territory = "",
territory = "Horde",
id = "144",
expansion = "Warlords Of Draenor",
location = "Tanaan Jungle"
},
id145 = {
source = "To Old Friends",
drop_rate = "quest",
name = "Thornbrace Boots",
category_territory = "",
territory = "Horde",
id = "145",
expansion = "Legion",
location = "Val'sharah"
},
id146 = {
source = "The Three",
drop_rate = "quest",
name = "Whitewater Boots",
category_territory = "",
territory = "Horde",
id = "146",
expansion = "Legion",
location = "Highmountain"
},
id147 = {
source = "Brogrul the Mighty",
drop_rate = "0.0",
name = "Mighty Chain Footpads",
category_territory = "",
territory = "Horde",
id = "147",
expansion = "Legion",
location = "Highmountain"
},
id148 = {
source = "Darkheart Thicket: Enter the Nightmare",
drop_rate = "quest",
name = "Sabatons of the Receding Nightmare",
category_territory = "",
territory = "Horde",
id = "148",
expansion = "Legion",
location = "Val'sharah"
},
id149 = {
source = "Withered Exile",
drop_rate = "0.0",
name = "Faronaar Chain Greaves",
category_territory = "",
territory = "Horde",
id = "149",
expansion = "Legion",
location = "Azsuna"
},
id150 = {
source = "Direbeak Patriarch",
drop_rate = "0.0",
name = "Hillstride Greaves",
category_territory = "",
territory = "Horde",
id = "150",
expansion = "Legion",
location = "Stormheim"
},
id151 = {
source = "Mist Seer",
drop_rate = "0.0",
name = "Valdisdall Greaves",
category_territory = "",
territory = "Horde",
id = "151",
expansion = "Legion",
location = "Stormheim"
},
id152 = {
source = "Felbound Desecrator",
drop_rate = "0.0",
name = "Dreadroot Linked Greaves",
category_territory = "",
territory = "Horde",
id = "152",
expansion = "Legion",
location = "Highmountain"
},
id153 = {
source = "Felsoul Doomguard",
drop_rate = "0.0",
name = "Warpwind Greaves",
category_territory = "",
territory = "Horde",
id = "153",
expansion = "Legion",
location = "Suramar"
},
id154 = {
source = "Save Yourself",
drop_rate = "quest",
name = "Seaspray Sabatons",
category_territory = "",
territory = "Horde",
id = "154",
expansion = "Legion",
location = "Azsuna"
},
id155 = {
source = "A Grim Trophy",
drop_rate = "quest",
name = "Blighthound Master's Greaves",
category_territory = "",
territory = "Horde",
id = "155",
expansion = "Legion",
location = "Stormheim"
},
id156 = {
source = "Spread Your Lunarwings and Fly",
drop_rate = "quest",
name = "Thornbrace Sabatons",
category_territory = "",
territory = "Horde",
id = "156",
expansion = "Legion",
location = "Val'sharah"
},
id157 = {
source = "Ormgul the Pestilent",
drop_rate = "quest",
name = "Whitewater Sabatons",
category_territory = "",
territory = "Horde",
id = "157",
expansion = "Legion",
location = "Highmountain"
},
id158 = {
source = "Regal Remains",
drop_rate = "quest",
name = "Runesworn Boots",
category_territory = "",
territory = "Horde",
id = "158",
expansion = "Legion",
location = "Stormheim"
},
id159 = {
source = "Signal Boost",
drop_rate = "quest",
name = "Tinkmaster's Buzzing Kickers",
category_territory = "",
territory = "Horde",
id = "159",
expansion = "Legion",
location = "Stormheim"
},
id160 = {
source = "The Scythe of Souls",
drop_rate = "quest",
name = "Seaspray Chain Boots",
category_territory = "",
territory = "Horde",
id = "160",
expansion = "Legion",
location = "Azsuna"
},
id161 = {
source = "Nobundos Last Stand",
drop_rate = "quest",
name = "Elementally-Infused Boots",
category_territory = "",
territory = "",
id = "161",
expansion = "Legion",
location = "The Exodar"
},
id162 = {
source = "They Have A Pitlord",
drop_rate = "quest",
name = "Felmonger's Treads",
category_territory = "",
territory = "Horde",
id = "162",
expansion = "Legion",
location = "Highmountain"
},
id163 = {
source = "The Butcher",
drop_rate = "0",
name = "Bonebreaker Boots",
category_territory = "Raid",
territory = "Horde",
id = "163",
expansion = "Warlords Of Draenor",
location = "Highmaul"
},
id164 = {
source = "Terongor",
drop_rate = "Unknown",
name = "Streamslither Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "164",
expansion = "Warlords Of Draenor",
location = "Auchindoun"
},
id165 = {
source = "Terongor",
drop_rate = "Unknown",
name = "Sharpeye Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "165",
expansion = "Warlords Of Draenor",
location = "Auchindoun"
},
id166 = {
source = "Terongor",
drop_rate = "Unknown",
name = "Rockhide Treads",
category_territory = "Dungeon",
territory = "Horde",
id = "166",
expansion = "Warlords Of Draenor",
location = "Auchindoun"
},
id167 = {
source = "Terongor",
drop_rate = "Unknown",
name = "Lavalink Stompers",
category_territory = "Dungeon",
territory = "Horde",
id = "167",
expansion = "Warlords Of Draenor",
location = "Auchindoun"
},
id168 = {
source = "Terongor",
drop_rate = "Unknown",
name = "Morningscale Treads",
category_territory = "Dungeon",
territory = "Horde",
id = "168",
expansion = "Warlords Of Draenor",
location = "Auchindoun"
},
id169 = {
source = "Grunlek",
drop_rate = "Unknown",
name = "Warsong Boots",
category_territory = "",
territory = "Horde",
id = "169",
expansion = "Warlords Of Draenor",
location = "Frostwall"
},
id170 = {
source = "Bregg Coppercast",
drop_rate = "Unknown",
name = "Primal Combatant's Footguards of Cruelty",
category_territory = "",
territory = "War Zone",
id = "170",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id171 = {
source = "Bregg Coppercast",
drop_rate = "Unknown",
name = "Primal Combatant's Footguards of Prowess",
category_territory = "",
territory = "War Zone",
id = "171",
expansion = "Warlords Of Draenor",
location = "Stormshield"
},
id172 = {
source = "Swift Onyx Flayer",
drop_rate = "0.0",
name = "Flayerscale Carapace Stompers",
category_territory = "",
territory = "Horde",
id = "172",
expansion = "Warlords Of Draenor",
location = "Gorgrond"
},
id173 = {
source = "Stone Guard Brokefist",
drop_rate = "Unknown",
name = "Primal Combatant's Footguards of Cruelty",
category_territory = "",
territory = "Alliance",
id = "173",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id174 = {
source = "Stone Guard Brokefist",
drop_rate = "Unknown",
name = "Primal Combatant's Footguards of Prowess",
category_territory = "",
territory = "Alliance",
id = "174",
expansion = "Warlords Of Draenor",
location = "Warspear"
},
id175 = {
source = "Blinding Solar Flare",
drop_rate = "0.0",
name = "Packrunner Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "175",
expansion = "Warlords Of Draenor",
location = "Skyreach"
},
id176 = {
source = "Obliterating Ogres",
drop_rate = "quest",
name = "Stormsteppe Sabatons",
category_territory = "",
territory = "Horde",
id = "176",
expansion = "Warlords Of Draenor",
location = "Nagrand"
},
id177 = {
source = "Durkath Steelmaw",
drop_rate = "0.0",
name = "Steelmaw's Stompers",
category_territory = "",
territory = "Horde",
id = "177",
expansion = "Warlords Of Draenor",
location = "Spires of Arak"
},
id178 = {
source = "Felborn Instructor",
drop_rate = "0.0",
name = "Sunspring Greaves",
category_territory = "",
territory = "Horde",
id = "178",
expansion = "Warlords Of Draenor",
location = "Tanaan Jungle"
},
id179 = {
source = "The Right Parts for the Job",
drop_rate = "quest",
name = "Fungal Reisistant Chainmail Boots",
category_territory = "",
territory = "Horde",
id = "179",
expansion = "Warlords Of Draenor",
location = "Spires of Arak"
},
id180 = {
source = "Cackling Pyromaniac",
drop_rate = "0.0",
name = "Spirestrider Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "180",
expansion = "Warlords Of Draenor",
location = "Auchindoun"
},
id181 = {
source = "Adept of the Dawn",
drop_rate = "0.0",
name = "Snarlthorn Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "181",
expansion = "Warlords Of Draenor",
location = "Skyreach"
},
id182 = {
source = "Nightmare in the Tomb",
drop_rate = "quest",
name = "Sha'tari Deadeye Sabatons",
category_territory = "",
territory = "Horde",
id = "182",
expansion = "Warlords Of Draenor",
location = "Talador"
},
id183 = {
source = "Hatred Undying",
drop_rate = "quest",
name = "Ravenchain Sabatons",
category_territory = "",
territory = "Horde",
id = "183",
expansion = "Warlords Of Draenor",
location = "Spires of Arak"
},
id184 = {
source = "Chi-Ji",
drop_rate = "Unknown",
name = "Prideful Gladiator's Footguards of Meditation",
category_territory = "",
territory = "Horde",
id = "184",
expansion = "Mists Of Pandaria",
location = "Timeless Isle"
},
id185 = {
source = "Chi-Ji",
drop_rate = "Unknown",
name = "Prideful Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Horde",
id = "185",
expansion = "Mists Of Pandaria",
location = "Timeless Isle"
},
id186 = {
source = "Chi-Ji",
drop_rate = "Unknown",
name = "Prideful Gladiator's Footguards of Alacrity",
category_territory = "",
territory = "Horde",
id = "186",
expansion = "Mists Of Pandaria",
location = "Timeless Isle"
},
id187 = {
source = "Chi-Ji",
drop_rate = "Unknown",
name = "Prideful Gladiator's Sabatons of Cruelty",
category_territory = "",
territory = "Horde",
id = "187",
expansion = "Mists Of Pandaria",
location = "Timeless Isle"
},
id188 = {
source = "Chi-Ji",
drop_rate = "Unknown",
name = "Prideful Gladiator's Sabatons of Cruelty",
category_territory = "",
territory = "Horde",
id = "188",
expansion = "Mists Of Pandaria",
location = "Timeless Isle"
},
id189 = {
source = "Chi-Ji",
drop_rate = "Unknown",
name = "Prideful Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Horde",
id = "189",
expansion = "Mists Of Pandaria",
location = "Timeless Isle"
},
id190 = {
source = "Chi-Ji",
drop_rate = "Unknown",
name = "Prideful Gladiator's Footguards of Alacrity",
category_territory = "",
territory = "Horde",
id = "190",
expansion = "Mists Of Pandaria",
location = "Timeless Isle"
},
id191 = {
source = "Chi-Ji",
drop_rate = "Unknown",
name = "Prideful Gladiator's Footguards of Meditation",
category_territory = "",
territory = "Horde",
id = "191",
expansion = "Mists Of Pandaria",
location = "Timeless Isle"
},
id192 = {
source = "Lakebottom Zapper",
drop_rate = "0.0",
name = "Spiffy Chainmail Boots",
category_territory = "",
territory = "Horde",
id = "192",
expansion = "Warlords Of Draenor",
location = "Talador"
},
id193 = {
source = "Cackling Pyromaniac",
drop_rate = "0.0",
name = "Varashi Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "193",
expansion = "Warlords Of Draenor",
location = "Auchindoun"
},
id194 = {
source = "Jinrokh the Breaker",
drop_rate = "0.0",
name = "Ghostbinder Greatboots",
category_territory = "Raid",
territory = "Horde",
id = "194",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id195 = {
source = "Tortos",
drop_rate = "0.0",
name = "Quakestompers",
category_territory = "Raid",
territory = "Horde",
id = "195",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id196 = {
source = "Jinrokh the Breaker",
drop_rate = "0.0",
name = "Ghostbinder Greatboots",
category_territory = "Raid",
territory = "Horde",
id = "196",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id197 = {
source = "Tortos",
drop_rate = "0.0",
name = "Quakestompers",
category_territory = "Raid",
territory = "Horde",
id = "197",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id198 = {
source = "Rook Stonetoe",
drop_rate = "Unknown",
name = "Sabatons of Defilement",
category_territory = "Raid",
territory = "Horde",
id = "198",
expansion = "Mists Of Pandaria",
location = "Siege of Orgrimmar"
},
id199 = {
source = "Iron Juggernaut",
drop_rate = "0.0",
name = "Minelayer's Padded Boots",
category_territory = "Raid",
territory = "Horde",
id = "199",
expansion = "Mists Of Pandaria",
location = "Siege of Orgrimmar"
},
id200 = {
source = "Iron Juggernaut",
drop_rate = "0.0",
name = "Treads of Autonomic Motion",
category_territory = "Raid",
territory = "Horde",
id = "200",
expansion = "Mists Of Pandaria",
location = "Siege of Orgrimmar"
},
id201 = {
source = "General Nazgrim",
drop_rate = "0.0",
name = "Ravager's Pathwalkers",
category_territory = "Raid",
territory = "Horde",
id = "201",
expansion = "Mists Of Pandaria",
location = "Siege of Orgrimmar"
},
id202 = {
source = "Siegecrafter Blackfuse",
drop_rate = "0.0",
name = "Powder-Stained Totemic Treads",
category_territory = "Raid",
territory = "Horde",
id = "202",
expansion = "Mists Of Pandaria",
location = "Siege of Orgrimmar"
},
id203 = {
source = "Nathrezim Helot",
drop_rate = "0.0",
name = "Deathweb Greaves",
category_territory = "",
territory = "Horde",
id = "203",
expansion = "Warlords Of Draenor",
location = "Talador"
},
id204 = {
source = "Bad at Breaking",
drop_rate = "quest",
name = "Wildwood Wrangler Sabatons",
category_territory = "",
territory = "Horde",
id = "204",
expansion = "Warlords Of Draenor",
location = "Gorgrond"
},
id205 = {
source = "Jinrokh the Breaker",
drop_rate = "0.0",
name = "Ghostbinder Greatboots",
category_territory = "Raid",
territory = "Horde",
id = "205",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id206 = {
source = "Tortos",
drop_rate = "0.0",
name = "Quakestompers",
category_territory = "Raid",
territory = "Horde",
id = "206",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id207 = {
source = "Dark Ritualist",
drop_rate = "0.0",
name = "Scalehide Spurs",
category_territory = "Raid",
territory = "Horde",
id = "207",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id208 = {
source = "Gastropod",
drop_rate = "0.0",
name = "Spiritbound Boots",
category_territory = "Raid",
territory = "Horde",
id = "208",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id209 = {
source = "Boneyard Tunneler",
drop_rate = "0.0",
name = "Warpscale Greaves",
category_territory = "",
territory = "Horde",
id = "209",
expansion = "Warlords Of Draenor",
location = "Gorgrond"
},
id210 = {
source = "Jinrokh the Breaker",
drop_rate = "0.0",
name = "Ghostbinder Greatboots",
category_territory = "Raid",
territory = "Horde",
id = "210",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id211 = {
source = "Tortos",
drop_rate = "0.0",
name = "Quakestompers",
category_territory = "Raid",
territory = "Horde",
id = "211",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id212 = {
source = "Sand Elemental",
drop_rate = "0.0",
name = "Scalehide Spurs",
category_territory = "Raid",
territory = "Horde",
id = "212",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id213 = {
source = "Lightning Guardian",
drop_rate = "0.0",
name = "Spiritbound Boots",
category_territory = "Raid",
territory = "Horde",
id = "213",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id214 = {
source = "Acon Deathwielder",
drop_rate = "Unknown",
name = "Grievous Gladiator's Footguards of Meditation",
category_territory = "",
territory = "Horde",
id = "214",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id215 = {
source = "Acon Deathwielder",
drop_rate = "Unknown",
name = "Grievous Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Horde",
id = "215",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id216 = {
source = "Acon Deathwielder",
drop_rate = "Unknown",
name = "Grievous Gladiator's Footguards of Alacrity",
category_territory = "",
territory = "Horde",
id = "216",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id217 = {
source = "Acon Deathwielder",
drop_rate = "Unknown",
name = "Grievous Gladiator's Sabatons of Cruelty",
category_territory = "",
territory = "Horde",
id = "217",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id218 = {
source = "Ethan Natice",
drop_rate = "Unknown",
name = "Grievous Gladiator's Sabatons of Cruelty",
category_territory = "",
territory = "Horde",
id = "218",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id219 = {
source = "Ethan Natice",
drop_rate = "Unknown",
name = "Grievous Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Horde",
id = "219",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id220 = {
source = "Ethan Natice",
drop_rate = "Unknown",
name = "Grievous Gladiator's Footguards of Alacrity",
category_territory = "",
territory = "Horde",
id = "220",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id221 = {
source = "Ethan Natice",
drop_rate = "Unknown",
name = "Grievous Gladiator's Footguards of Meditation",
category_territory = "",
territory = "Horde",
id = "221",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id222 = {
source = "Inshatar",
drop_rate = "0.0",
name = "Boots of the Shadowborn",
category_territory = "",
territory = "Horde",
id = "222",
expansion = "Warlords Of Draenor",
location = "Shadowmoon Valley"
},
id223 = {
source = "The Master Siegesmith",
drop_rate = "quest",
name = "Grom'gar Chain Boots",
category_territory = "",
territory = "Horde",
id = "223",
expansion = "Warlords Of Draenor",
location = "Frostfire Ridge"
},
id224 = {
source = "Amber-Shaper Unsok",
drop_rate = "0.0",
name = "Monstrous Stompers",
category_territory = "Raid",
territory = "Horde",
id = "224",
expansion = "Mists Of Pandaria",
location = "Heart of Fear"
},
id225 = {
source = "Protector Kaolan",
drop_rate = "Unknown",
name = "Lightning Prisoner's Boots",
category_territory = "Raid",
territory = "Horde",
id = "225",
expansion = "Mists Of Pandaria",
location = "Terrace of Endless Spring"
},
id226 = {
source = "Elder Regail",
drop_rate = "Unknown",
name = "Lightning Prisoner's Boots",
category_territory = "Raid",
territory = "Horde",
id = "226",
expansion = "Mists Of Pandaria",
location = "Terrace of Endless Spring"
},
id227 = {
source = "Gormaul Tower",
drop_rate = "quest",
name = "Frostwolf Ringmail Boots",
category_territory = "",
territory = "Horde",
id = "227",
expansion = "Warlords Of Draenor",
location = "Frostfire Ridge"
},
id228 = {
source = "Escape From Shazgul",
drop_rate = "quest",
name = "Rangari Initiate Sabatons",
category_territory = "",
territory = "Horde",
id = "228",
expansion = "Warlords Of Draenor",
location = "Shadowmoon Valley"
},
id229 = {
source = "Gromkar Grunt",
drop_rate = "0.0",
name = "Highland Greaves",
category_territory = "",
territory = "Horde",
id = "229",
expansion = "Warlords Of Draenor",
location = "Gorgrond"
},
id230 = {
source = "Circle the Wagon",
drop_rate = "quest",
name = "Moonchain Boots",
category_territory = "",
territory = "Horde",
id = "230",
expansion = "Warlords Of Draenor",
location = "Shadowmoon Valley"
},
id231 = {
source = "Feng the Accursed",
drop_rate = "0.0",
name = "Wildfire Worldwalkers",
category_territory = "Raid",
territory = "Horde",
id = "231",
expansion = "Mists Of Pandaria",
location = "Mogu'shan Vaults"
},
id232 = {
source = "Meng the Demented",
drop_rate = "Unknown",
name = "Meng's Treads of Insanity",
category_territory = "Raid",
territory = "Horde",
id = "232",
expansion = "Mists Of Pandaria",
location = "Mogu'shan Vaults"
},
id233 = {
source = "Elder Regail",
drop_rate = "Unknown",
name = "Lightning Prisoner's Boots",
category_territory = "Raid",
territory = "Horde",
id = "233",
expansion = "Mists Of Pandaria",
location = "Terrace of Endless Spring"
},
id234 = {
source = "Jinrokh the Breaker",
drop_rate = "0.0",
name = "Ghostbinder Greatboots",
category_territory = "Raid",
territory = "Horde",
id = "234",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id235 = {
source = "Tortos",
drop_rate = "0.0",
name = "Quakestompers",
category_territory = "Raid",
territory = "Horde",
id = "235",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id236 = {
source = "Bloodmaul Enforcer",
drop_rate = "0.0",
name = "Tangleheart Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "236",
expansion = "Warlords Of Draenor",
location = "Bloodmaul Slag Mines"
},
id237 = {
source = "Sha of Anger",
drop_rate = "Unknown",
name = "Malevolent Gladiator's Sabatons of Cruelty",
category_territory = "",
territory = "Horde",
id = "237",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id238 = {
source = "Sha of Anger",
drop_rate = "Unknown",
name = "Malevolent Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Horde",
id = "238",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id239 = {
source = "Sha of Anger",
drop_rate = "Unknown",
name = "Malevolent Gladiator's Footguards of Alacrity",
category_territory = "",
territory = "Horde",
id = "239",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id240 = {
source = "Sha of Anger",
drop_rate = "Unknown",
name = "Malevolent Gladiator's Footguards of Meditation",
category_territory = "",
territory = "Horde",
id = "240",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id241 = {
source = "Feng the Accursed",
drop_rate = "0.0",
name = "Wildfire Worldwalkers",
category_territory = "Raid",
territory = "Horde",
id = "241",
expansion = "Mists Of Pandaria",
location = "Mogu'shan Vaults"
},
id242 = {
source = "Meng the Demented",
drop_rate = "Unknown",
name = "Meng's Treads of Insanity",
category_territory = "Raid",
territory = "Horde",
id = "242",
expansion = "Mists Of Pandaria",
location = "Mogu'shan Vaults"
},
id243 = {
source = "Amber-Shaper Unsok",
drop_rate = "0.0",
name = "Monstrous Stompers",
category_territory = "Raid",
territory = "Horde",
id = "243",
expansion = "Mists Of Pandaria",
location = "Heart of Fear"
},
id244 = {
source = "Protector Kaolan",
drop_rate = "Unknown",
name = "Lightning Prisoner's Boots",
category_territory = "Raid",
territory = "Horde",
id = "244",
expansion = "Mists Of Pandaria",
location = "Terrace of Endless Spring"
},
id245 = {
source = "Feng the Accursed",
drop_rate = "0.0",
name = "Wildfire Worldwalkers",
category_territory = "Raid",
territory = "Horde",
id = "245",
expansion = "Mists Of Pandaria",
location = "Mogu'shan Vaults"
},
id246 = {
source = "Meng the Demented",
drop_rate = "Unknown",
name = "Meng's Treads of Insanity",
category_territory = "Raid",
territory = "Horde",
id = "246",
expansion = "Mists Of Pandaria",
location = "Mogu'shan Vaults"
},
id247 = {
source = "Amber-Shaper Unsok",
drop_rate = "0.0",
name = "Monstrous Stompers",
category_territory = "Raid",
territory = "Horde",
id = "247",
expansion = "Mists Of Pandaria",
location = "Heart of Fear"
},
id248 = {
source = "Elder Asani",
drop_rate = "0.0",
name = "Lightning Prisoner's Boots",
category_territory = "Raid",
territory = "Horde",
id = "248",
expansion = "Mists Of Pandaria",
location = "Terrace of Endless Spring"
},
id249 = {
source = "Greater Cave Bat",
drop_rate = "0.0",
name = "Treads of Edward the Odd",
category_territory = "Raid",
territory = "Horde",
id = "249",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id250 = {
source = "Commander Oxheart",
drop_rate = "Unknown",
name = "Steps of the War Serpent",
category_territory = "",
territory = "Horde",
id = "250",
expansion = "Mists Of Pandaria",
location = "Townlong Steppes"
},
id251 = {
source = "Commander Oxheart",
drop_rate = "Unknown",
name = "Sandals of the Elder Sage",
category_territory = "",
territory = "Horde",
id = "251",
expansion = "Mists Of Pandaria",
location = "Townlong Steppes"
},
id252 = {
source = "Galleon",
drop_rate = "Unknown",
name = "Burnmender Boots",
category_territory = "",
territory = "Horde",
id = "252",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id253 = {
source = "Galleon",
drop_rate = "Unknown",
name = "Treads of Gentle Nudges",
category_territory = "",
territory = "Horde",
id = "253",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id254 = {
source = "Nalak",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Sabatons of Cruelty",
category_territory = "",
territory = "Horde",
id = "254",
expansion = "Mists Of Pandaria",
location = "Isle of Thunder"
},
id255 = {
source = "Nalak",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Horde",
id = "255",
expansion = "Mists Of Pandaria",
location = "Isle of Thunder"
},
id256 = {
source = "Nalak",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Footguards of Alacrity",
category_territory = "",
territory = "Horde",
id = "256",
expansion = "Mists Of Pandaria",
location = "Isle of Thunder"
},
id257 = {
source = "Nalak",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Footguards of Meditation",
category_territory = "",
territory = "Horde",
id = "257",
expansion = "Mists Of Pandaria",
location = "Isle of Thunder"
},
id258 = {
source = "Doris Chiltonius",
drop_rate = "Unknown",
name = "Malevolent Gladiator's Sabatons of Cruelty",
category_territory = "",
territory = "Horde",
id = "258",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id259 = {
source = "Doris Chiltonius",
drop_rate = "Unknown",
name = "Malevolent Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Horde",
id = "259",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id260 = {
source = "Doris Chiltonius",
drop_rate = "Unknown",
name = "Malevolent Gladiator's Footguards of Alacrity",
category_territory = "",
territory = "Horde",
id = "260",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id261 = {
source = "Doris Chiltonius",
drop_rate = "Unknown",
name = "Malevolent Gladiator's Footguards of Meditation",
category_territory = "",
territory = "Horde",
id = "261",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id262 = {
source = "Tuskripper Grukna",
drop_rate = "Unknown",
name = "Boots of the Healing Stream",
category_territory = "",
territory = "Horde",
id = "262",
expansion = "Mists Of Pandaria",
location = "Krasarang Wilds"
},
id263 = {
source = "Tuskripper Grukna",
drop_rate = "Unknown",
name = "Greaves of Manifest Destiny",
category_territory = "",
territory = "Horde",
id = "263",
expansion = "Mists Of Pandaria",
location = "Krasarang Wilds"
},
id264 = {
source = "Agent Malley",
drop_rate = "Unknown",
name = "Totem-Binder Boots",
category_territory = "",
territory = "Horde",
id = "264",
expansion = "Mists Of Pandaria",
location = "Krasarang Wilds"
},
id265 = {
source = "Agent Malley",
drop_rate = "Unknown",
name = "Odlaw's Everwalkers",
category_territory = "",
territory = "Horde",
id = "265",
expansion = "Mists Of Pandaria",
location = "Krasarang Wilds"
},
id266 = {
source = "Nalak",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Footguards of Meditation",
category_territory = "",
territory = "Horde",
id = "266",
expansion = "Mists Of Pandaria",
location = "Isle of Thunder"
},
id267 = {
source = "Nalak",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Horde",
id = "267",
expansion = "Mists Of Pandaria",
location = "Isle of Thunder"
},
id268 = {
source = "Nalak",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Footguards of Alacrity",
category_territory = "",
territory = "Horde",
id = "268",
expansion = "Mists Of Pandaria",
location = "Isle of Thunder"
},
id269 = {
source = "Nalak",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Sabatons of Cruelty",
category_territory = "",
territory = "Horde",
id = "269",
expansion = "Mists Of Pandaria",
location = "Isle of Thunder"
},
id270 = {
source = "Armsmaster Holinka",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Sabatons of Cruelty",
category_territory = "",
territory = "Horde",
id = "270",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id271 = {
source = "Armsmaster Holinka",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Horde",
id = "271",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id272 = {
source = "Armsmaster Holinka",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Footguards of Alacrity",
category_territory = "",
territory = "Horde",
id = "272",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id273 = {
source = "Armsmaster Holinka",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Footguards of Meditation",
category_territory = "",
territory = "Horde",
id = "273",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id274 = {
source = "Roo Desvin",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Footguards of Meditation",
category_territory = "",
territory = "Horde",
id = "274",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id275 = {
source = "Roo Desvin",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Horde",
id = "275",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id276 = {
source = "Roo Desvin",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Footguards of Alacrity",
category_territory = "",
territory = "Horde",
id = "276",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id277 = {
source = "Roo Desvin",
drop_rate = "Unknown",
name = "Tyrannical Gladiator's Sabatons of Cruelty",
category_territory = "",
territory = "Horde",
id = "277",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id278 = {
source = "Raigonn",
drop_rate = "0.0",
name = "Treads of Fixation",
category_territory = "Dungeon",
territory = "Horde",
id = "278",
expansion = "Mists Of Pandaria",
location = "Gate of the Setting Sun"
},
id279 = {
source = "Raigonn",
drop_rate = "0.0",
name = "Treads of Fixation",
category_territory = "Dungeon",
territory = "Horde",
id = "279",
expansion = "Mists Of Pandaria",
location = "Gate of the Setting Sun"
},
id280 = {
source = "Wing Leader Neronok",
drop_rate = "0.0",
name = "Airbender Sandals",
category_territory = "Dungeon",
territory = "Horde",
id = "280",
expansion = "Mists Of Pandaria",
location = "Siege of Niuzao Temple"
},
id281 = {
source = "Rattlegore",
drop_rate = "0.0",
name = "Bone Golem Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "281",
expansion = "Mists Of Pandaria",
location = "Scholomance"
},
id282 = {
source = "Fires and Fears of Old",
drop_rate = "quest",
name = "Withered Wood Sabatons",
category_territory = "",
territory = "Horde",
id = "282",
expansion = "Mists Of Pandaria",
location = "Dread Wastes"
},
id283 = {
source = "Fires and Fears of Old",
drop_rate = "quest",
name = "Wind-Reaver Sabatons",
category_territory = "",
territory = "Horde",
id = "283",
expansion = "Mists Of Pandaria",
location = "Dread Wastes"
},
id284 = {
source = "Hayden Christophen",
drop_rate = "Unknown",
name = "Dreadful Gladiator's Sabatons of Cruelty",
category_territory = "",
territory = "Horde",
id = "284",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id285 = {
source = "Hayden Christophen",
drop_rate = "Unknown",
name = "Dreadful Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Horde",
id = "285",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id286 = {
source = "Hayden Christophen",
drop_rate = "Unknown",
name = "Dreadful Gladiator's Footguards of Alacrity",
category_territory = "",
territory = "Horde",
id = "286",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id287 = {
source = "Hayden Christophen",
drop_rate = "Unknown",
name = "Dreadful Gladiator's Footguards of Meditation",
category_territory = "",
territory = "Horde",
id = "287",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id288 = {
source = "Wing Leader Neronok",
drop_rate = "0.0",
name = "Airbender Sandals",
category_territory = "Dungeon",
territory = "Horde",
id = "288",
expansion = "Mists Of Pandaria",
location = "Siege of Niuzao Temple"
},
id289 = {
source = "Raigonn",
drop_rate = "0.0",
name = "Treads of Fixation",
category_territory = "Dungeon",
territory = "Horde",
id = "289",
expansion = "Mists Of Pandaria",
location = "Gate of the Setting Sun"
},
id290 = {
source = "Wing Leader Neronok",
drop_rate = "0.0",
name = "Airbender Sandals",
category_territory = "Dungeon",
territory = "Horde",
id = "290",
expansion = "Mists Of Pandaria",
location = "Siege of Niuzao Temple"
},
id291 = {
source = "Rattlegore",
drop_rate = "0.0",
name = "Bone Golem Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "291",
expansion = "Mists Of Pandaria",
location = "Scholomance"
},
id292 = {
source = "Mistweaver Xia",
drop_rate = "Unknown",
name = "Sandals of the Elder Sage",
category_territory = "",
territory = "Horde",
id = "292",
expansion = "Mists Of Pandaria",
location = "Timeless Isle"
},
id293 = {
source = "Amber Arms",
drop_rate = "quest",
name = "Wind-Reaver Shoes",
category_territory = "",
territory = "Horde",
id = "293",
expansion = "Mists Of Pandaria",
location = "Dread Wastes"
},
id294 = {
source = "Amber Arms",
drop_rate = "quest",
name = "Withered Wood Shoes",
category_territory = "",
territory = "Horde",
id = "294",
expansion = "Mists Of Pandaria",
location = "Dread Wastes"
},
id295 = {
source = "Rockhide Calf",
drop_rate = "0.0",
name = "Frostlink Greaves",
category_territory = "",
territory = "Horde",
id = "295",
expansion = "Warlords Of Draenor",
location = "Shadowmoon Valley"
},
id296 = {
source = "Shadowmoon Void Priestess",
drop_rate = "0.0",
name = "Gronnling Greaves",
category_territory = "",
territory = "Horde",
id = "296",
expansion = "Warlords Of Draenor",
location = "Shadowmoon Valley"
},
id297 = {
source = "Blackrock Forgeworker",
drop_rate = "0.0",
name = "Blackrock Chain Boots",
category_territory = "",
territory = "Horde",
id = "297",
expansion = "Warlords Of Draenor",
location = "Tanaan Jungle"
},
id298 = {
source = "Milau",
drop_rate = "0.0",
name = "Yak Greaves",
category_territory = "",
territory = "Horde",
id = "298",
expansion = "Mists Of Pandaria",
location = "Vale of Eternal Blossoms"
},
id299 = {
source = "The Field Armorer",
drop_rate = "quest",
name = "Earthmover Sabatons",
category_territory = "",
territory = "Horde",
id = "299",
expansion = "Mists Of Pandaria",
location = "Townlong Steppes"
},
id300 = {
source = "The Field Armorer",
drop_rate = "quest",
name = "Osul Peak Sabatons",
category_territory = "",
territory = "Horde",
id = "300",
expansion = "Mists Of Pandaria",
location = "Townlong Steppes"
},
id301 = {
source = "Gastropod",
drop_rate = "0.0",
name = "Battered Saurscale Boots",
category_territory = "Raid",
territory = "Horde",
id = "301",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id302 = {
source = "Zandalari Dinomancer",
drop_rate = "0.0",
name = "Brittle Flamereaver Treads",
category_territory = "",
territory = "Horde",
id = "302",
expansion = "Mists Of Pandaria",
location = "Isle of Giants"
},
id303 = {
source = "Zandalari Blade Initiate",
drop_rate = "0.0",
name = "Lifestep Treads",
category_territory = "Raid",
territory = "Horde",
id = "303",
expansion = "Mists Of Pandaria",
location = "Throne of Thunder"
},
id304 = {
source = "Gurthan Swiftblade",
drop_rate = "0.0",
name = "Treads of Exotic Mastery",
category_territory = "Dungeon",
territory = "Horde",
id = "304",
expansion = "Mists Of Pandaria",
location = "Mogu'shan Palace"
},
id305 = {
source = "The Burlap Grind",
drop_rate = "quest",
name = "Dreaming Spirit Sabatons",
category_territory = "",
territory = "Horde",
id = "305",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id306 = {
source = "The Burlap Grind",
drop_rate = "quest",
name = "Yak Herder Sabatons",
category_territory = "",
territory = "Horde",
id = "306",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id307 = {
source = "The Fearmaster",
drop_rate = "quest",
name = "Dreaming Spirit Boots",
category_territory = "",
territory = "Horde",
id = "307",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id308 = {
source = "The Fearmaster",
drop_rate = "quest",
name = "Yak Herder Boots",
category_territory = "",
territory = "Horde",
id = "308",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id309 = {
source = "Yorsahj the Unsleeping",
drop_rate = "0.0",
name = "Mindstrainer Treads",
category_territory = "Raid",
territory = "Horde",
id = "309",
expansion = "Cataclysm",
location = "Dragon Soul"
},
id310 = {
source = "Hagara the Stormbinder",
drop_rate = "0.0",
name = "Treads of Dormant Dreams",
category_territory = "Raid",
territory = "Horde",
id = "310",
expansion = "Cataclysm",
location = "Dragon Soul"
},
id311 = {
source = "Ethereal Sha",
drop_rate = "0.0",
name = "Willow Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "311",
expansion = "Mists Of Pandaria",
location = "Shado-Pan Monastery"
},
id312 = {
source = "Needleback Porcupine",
drop_rate = "0.0",
name = "Mountain Greaves",
category_territory = "",
territory = "Horde",
id = "312",
expansion = "Mists Of Pandaria",
location = "Dread Wastes"
},
id313 = {
source = "Len at Arms",
drop_rate = "Unknown",
name = "Wasteland Ringmail Sabatons",
category_territory = "",
territory = "Horde",
id = "313",
expansion = "Mists Of Pandaria",
location = "Vale of Eternal Blossoms"
},
id314 = {
source = "Len at Arms",
drop_rate = "Unknown",
name = "Wasteland Chain Sabatons",
category_territory = "",
territory = "Horde",
id = "314",
expansion = "Mists Of Pandaria",
location = "Vale of Eternal Blossoms"
},
id315 = {
source = "Muddy Water",
drop_rate = "quest",
name = "Huangtze Scale Sabatons",
category_territory = "",
territory = "Horde",
id = "315",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id316 = {
source = "Muddy Water",
drop_rate = "quest",
name = "Wild Plains Sabatons",
category_territory = "",
territory = "Horde",
id = "316",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id317 = {
source = "Wisdom Has A Price",
drop_rate = "quest",
name = "Sarjun Boots",
category_territory = "",
territory = "Horde",
id = "317",
expansion = "Mists Of Pandaria",
location = "Krasarang Wilds"
},
id318 = {
source = "Wisdom Has A Price",
drop_rate = "quest",
name = "Deepwild Greaves",
category_territory = "",
territory = "Horde",
id = "318",
expansion = "Mists Of Pandaria",
location = "Krasarang Wilds"
},
id319 = {
source = "Shannox",
drop_rate = "0.0",
name = "Treads of Implicit Obedience",
category_territory = "Raid",
territory = "Horde",
id = "319",
expansion = "Cataclysm",
location = "Firelands"
},
id320 = {
source = "Baleroc",
drop_rate = "0.0",
name = "Decimation Treads",
category_territory = "Raid",
territory = "Horde",
id = "320",
expansion = "Cataclysm",
location = "Firelands"
},
id321 = {
source = "Alizabal",
drop_rate = "0.0",
name = "Cataclysmic Gladiator's Sabatons of Meditation",
category_territory = "Raid",
territory = "Horde",
id = "321",
expansion = "Cataclysm",
location = "Baradin Hold"
},
id322 = {
source = "Alizabal",
drop_rate = "0.0",
name = "Cataclysmic Gladiator's Sabatons of Alacrity",
category_territory = "Raid",
territory = "Horde",
id = "322",
expansion = "Cataclysm",
location = "Baradin Hold"
},
id323 = {
source = "Alizabal",
drop_rate = "0.0",
name = "Cataclysmic Gladiator's Sabatons of Alacrity",
category_territory = "Raid",
territory = "Horde",
id = "323",
expansion = "Cataclysm",
location = "Baradin Hold"
},
id324 = {
source = "Alizabal",
drop_rate = "0.0",
name = "Cataclysmic Gladiator's Sabatons of Cruelty",
category_territory = "Raid",
territory = "Horde",
id = "324",
expansion = "Cataclysm",
location = "Baradin Hold"
},
id325 = {
source = "JamusVaz",
drop_rate = "Unknown",
name = "Sabatons of the Graceful Spirit",
category_territory = "",
territory = "Alliance",
id = "325",
expansion = "",
location = "Orgrimmar"
},
id326 = {
source = "JamusVaz",
drop_rate = "Unknown",
name = "Boneshard Boots",
category_territory = "",
territory = "Alliance",
id = "326",
expansion = "",
location = "Orgrimmar"
},
id327 = {
source = "Hagara the Stormbinder",
drop_rate = "0.0",
name = "Treads of Dormant Dreams",
category_territory = "Raid",
territory = "Horde",
id = "327",
expansion = "Cataclysm",
location = "Dragon Soul"
},
id328 = {
source = "Yorsahj the Unsleeping",
drop_rate = "0.0",
name = "Mindstrainer Treads",
category_territory = "Raid",
territory = "Horde",
id = "328",
expansion = "Cataclysm",
location = "Dragon Soul"
},
id329 = {
source = "Wyrmhorn Turtle",
drop_rate = "0.0",
name = "Snake Greaves",
category_territory = "",
territory = "Horde",
id = "329",
expansion = "Mists Of Pandaria",
location = "Valley of the Four Winds"
},
id330 = {
source = "Alin the Finder",
drop_rate = "Unknown",
name = "Mountainscaler Ringmail Sabatons",
category_territory = "",
territory = "Horde",
id = "330",
expansion = "Mists Of Pandaria",
location = "Townlong Steppes"
},
id331 = {
source = "Alin the Finder",
drop_rate = "Unknown",
name = "Mountainscaler Chain Sabatons",
category_territory = "",
territory = "Horde",
id = "331",
expansion = "Mists Of Pandaria",
location = "Townlong Steppes"
},
id332 = {
source = "Yorsahj the Unsleeping",
drop_rate = "0.0",
name = "Mindstrainer Treads",
category_territory = "Raid",
territory = "Horde",
id = "332",
expansion = "Cataclysm",
location = "Dragon Soul"
},
id333 = {
source = "Hagara the Stormbinder",
drop_rate = "0.0",
name = "Treads of Dormant Dreams",
category_territory = "Raid",
territory = "Horde",
id = "333",
expansion = "Cataclysm",
location = "Dragon Soul"
},
id334 = {
source = "Pages of History",
drop_rate = "quest",
name = "Jade Witch Sabatons",
category_territory = "",
territory = "Horde",
id = "334",
expansion = "Mists Of Pandaria",
location = "The Jade Forest"
},
id335 = {
source = "Pages of History",
drop_rate = "quest",
name = "Fox Grove Sabatons",
category_territory = "",
territory = "Horde",
id = "335",
expansion = "Mists Of Pandaria",
location = "The Jade Forest"
},
id336 = {
source = "Celea",
drop_rate = "Unknown",
name = "Stormscale Boots",
category_territory = "",
territory = "Horde",
id = "336",
expansion = "Legion",
location = "Azsuna"
},
id337 = {
source = "Rugok",
drop_rate = "Unknown",
name = "Moccasins of Verdurous Glooms",
category_territory = "",
territory = "Alliance",
id = "337",
expansion = "",
location = "Orgrimmar"
},
id338 = {
source = "Rugok",
drop_rate = "Unknown",
name = "Boots of the Perilous Seas",
category_territory = "",
territory = "Alliance",
id = "338",
expansion = "",
location = "Orgrimmar"
},
id339 = {
source = "Atramedes",
drop_rate = "0.0",
name = "Boots of Vertigo",
category_territory = "Raid",
territory = "Horde",
id = "339",
expansion = "Cataclysm",
location = "Blackwing Descent"
},
id340 = {
source = "Maloriak",
drop_rate = "0.0",
name = "Treads of Flawless Creation",
category_territory = "Raid",
territory = "Horde",
id = "340",
expansion = "Cataclysm",
location = "Blackwing Descent"
},
id341 = {
source = "Argaloth",
drop_rate = "0.0",
name = "Vicious Gladiator's Sabatons of Meditation",
category_territory = "Raid",
territory = "Horde",
id = "341",
expansion = "Cataclysm",
location = "Baradin Hold"
},
id342 = {
source = "Argaloth",
drop_rate = "0.0",
name = "Vicious Gladiator's Sabatons of Cruelty",
category_territory = "Raid",
territory = "Horde",
id = "342",
expansion = "Cataclysm",
location = "Baradin Hold"
},
id343 = {
source = "Argaloth",
drop_rate = "0.0",
name = "Vicious Gladiator's Sabatons of Alacrity",
category_territory = "Raid",
territory = "Horde",
id = "343",
expansion = "Cataclysm",
location = "Baradin Hold"
},
id344 = {
source = "Argaloth",
drop_rate = "0.0",
name = "Vicious Gladiator's Sabatons of Alacrity",
category_territory = "Raid",
territory = "Horde",
id = "344",
expansion = "Cataclysm",
location = "Baradin Hold"
},
id345 = {
source = "Provisioner Arok",
drop_rate = "Unknown",
name = "Earthmender's Boots",
category_territory = "",
territory = "Horde",
id = "345",
expansion = "Cataclysm",
location = "Shimmering Expanse"
},
id346 = {
source = "Provisioner Whitecloud",
drop_rate = "Unknown",
name = "Treads of Malorne",
category_territory = "",
territory = "Horde",
id = "346",
expansion = "Cataclysm",
location = "Mount Hyjal"
},
id347 = {
source = "Maloriak",
drop_rate = "0.0",
name = "Treads of Flawless Creation",
category_territory = "Raid",
territory = "Horde",
id = "347",
expansion = "Cataclysm",
location = "Blackwing Descent"
},
id348 = {
source = "Atramedes",
drop_rate = "0.0",
name = "Boots of Vertigo",
category_territory = "Raid",
territory = "Horde",
id = "348",
expansion = "Cataclysm",
location = "Blackwing Descent"
},
id349 = {
source = "Damek Bloombeard",
drop_rate = "Unknown",
name = "Fiery Treads",
category_territory = "",
territory = "Horde",
id = "349",
expansion = "Cataclysm",
location = "Molten Front"
},
id350 = {
source = "Varlan Highbough",
drop_rate = "Unknown",
name = "Lancer's Greaves",
category_territory = "",
territory = "Horde",
id = "350",
expansion = "Cataclysm",
location = "Molten Front"
},
id351 = {
source = "Occuthar",
drop_rate = "0.0",
name = "Ruthless Gladiator's Sabatons of Meditation",
category_territory = "Raid",
territory = "Horde",
id = "351",
expansion = "Cataclysm",
location = "Baradin Hold"
},
id352 = {
source = "Occuthar",
drop_rate = "0.0",
name = "Ruthless Gladiator's Sabatons of Cruelty",
category_territory = "Raid",
territory = "Horde",
id = "352",
expansion = "Cataclysm",
location = "Baradin Hold"
},
id353 = {
source = "Occuthar",
drop_rate = "0.0",
name = "Ruthless Gladiator's Sabatons of Alacrity",
category_territory = "Raid",
territory = "Horde",
id = "353",
expansion = "Cataclysm",
location = "Baradin Hold"
},
id354 = {
source = "Occuthar",
drop_rate = "0.0",
name = "Ruthless Gladiator's Sabatons of Alacrity",
category_territory = "Raid",
territory = "Horde",
id = "354",
expansion = "Cataclysm",
location = "Baradin Hold"
},
id355 = {
source = "Shannox",
drop_rate = "0.0",
name = "Treads of Implicit Obedience",
category_territory = "Raid",
territory = "Horde",
id = "355",
expansion = "Cataclysm",
location = "Firelands"
},
id356 = {
source = "Baleroc",
drop_rate = "0.0",
name = "Decimation Treads",
category_territory = "Raid",
territory = "Horde",
id = "356",
expansion = "Cataclysm",
location = "Firelands"
},
id357 = {
source = "Ecton Brasstumbler",
drop_rate = "Unknown",
name = "Ruthless Gladiator's Sabatons of Cruelty",
category_territory = "",
territory = "Horde",
id = "357",
expansion = "",
location = "Tanaris"
},
id358 = {
source = "Ecton Brasstumbler",
drop_rate = "Unknown",
name = "Ruthless Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Horde",
id = "358",
expansion = "",
location = "Tanaris"
},
id359 = {
source = "Ecton Brasstumbler",
drop_rate = "Unknown",
name = "Ruthless Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Horde",
id = "359",
expansion = "",
location = "Tanaris"
},
id360 = {
source = "Ecton Brasstumbler",
drop_rate = "Unknown",
name = "Ruthless Gladiator's Sabatons of Meditation",
category_territory = "",
territory = "Horde",
id = "360",
expansion = "",
location = "Tanaris"
},
id361 = {
source = "Echo of Jaina",
drop_rate = "0.0",
name = "Dead End Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "361",
expansion = "Cataclysm",
location = "End Time"
},
id362 = {
source = "Arcurion",
drop_rate = "0.0",
name = "Surestride Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "362",
expansion = "Cataclysm",
location = "Hour of Twilight"
},
id363 = {
source = "Forgemaster Throngus",
drop_rate = "0.0",
name = "Dark Iron Chain Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "363",
expansion = "Cataclysm",
location = "Grim Batol"
},
id364 = {
source = "Drahga Shadowburner",
drop_rate = "0.0",
name = "Red Scale Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "364",
expansion = "Cataclysm",
location = "Grim Batol"
},
id365 = {
source = "Forgemaster Throngus",
drop_rate = "0.0",
name = "Dark Iron Chain Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "365",
expansion = "Cataclysm",
location = "Grim Batol"
},
id366 = {
source = "Drahga Shadowburner",
drop_rate = "0.0",
name = "Red Scale Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "366",
expansion = "Cataclysm",
location = "Grim Batol"
},
id367 = {
source = "Anraphet",
drop_rate = "0.0",
name = "Boots of Crumbling Ruin",
category_territory = "Dungeon",
territory = "Horde",
id = "367",
expansion = "Cataclysm",
location = "Halls of Origination"
},
id368 = {
source = "Anraphet",
drop_rate = "0.0",
name = "Boots of Crumbling Ruin",
category_territory = "Dungeon",
territory = "Horde",
id = "368",
expansion = "Cataclysm",
location = "Halls of Origination"
},
id369 = {
source = "Commander Springvale",
drop_rate = "0.0",
name = "Haunting Footfalls",
category_territory = "Dungeon",
territory = "Alliance",
id = "369",
expansion = "",
location = "Shadowfang Keep"
},
id370 = {
source = "Rogoc",
drop_rate = "Unknown",
name = "Bloodthirsty Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Alliance",
id = "370",
expansion = "",
location = "Orgrimmar"
},
id371 = {
source = "Rogoc",
drop_rate = "Unknown",
name = "Bloodthirsty Gladiator's Sabatons of Alacrity",
category_territory = "",
territory = "Alliance",
id = "371",
expansion = "",
location = "Orgrimmar"
},
id372 = {
source = "Rogoc",
drop_rate = "Unknown",
name = "Bloodthirsty Gladiator's Sabatons of Cruelty",
category_territory = "",
territory = "Alliance",
id = "372",
expansion = "",
location = "Orgrimmar"
},
id373 = {
source = "Rogoc",
drop_rate = "Unknown",
name = "Bloodthirsty Gladiator's Sabatons of Meditation",
category_territory = "",
territory = "Alliance",
id = "373",
expansion = "",
location = "Orgrimmar"
},
id374 = {
source = "Gnomebliteration",
drop_rate = "quest",
name = "Fireball Treads",
category_territory = "",
territory = "Horde",
id = "374",
expansion = "Cataclysm",
location = "Uldum"
},
id375 = {
source = "The Source of Their Power",
drop_rate = "quest",
name = "Treads of the Neferset",
category_territory = "Dungeon",
territory = "Horde",
id = "375",
expansion = "Cataclysm",
location = "Lost City of the Tol'vir"
},
id376 = {
source = "Forgemaster Throngus",
drop_rate = "0.0",
name = "Dark Iron Chain Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "376",
expansion = "Cataclysm",
location = "Grim Batol"
},
id377 = {
source = "Drahga Shadowburner",
drop_rate = "0.0",
name = "Red Scale Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "377",
expansion = "Cataclysm",
location = "Grim Batol"
},
id378 = {
source = "Echo of Jaina",
drop_rate = "0.0",
name = "Dead End Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "378",
expansion = "Cataclysm",
location = "End Time"
},
id379 = {
source = "Crafter Kwon",
drop_rate = "Unknown",
name = "Faded Forest Ringmail Sabatons",
category_territory = "",
territory = "Horde",
id = "379",
expansion = "Mists Of Pandaria",
location = "Timeless Isle"
},
id380 = {
source = "Crafter Kwon",
drop_rate = "Unknown",
name = "Faded Forest Chain Sabatons",
category_territory = "",
territory = "Horde",
id = "380",
expansion = "Mists Of Pandaria",
location = "Timeless Isle"
},
id381 = {
source = "Hozen Groundpounder",
drop_rate = "0.0",
name = "Saurok Greaves",
category_territory = "",
territory = "Horde",
id = "381",
expansion = "Mists Of Pandaria",
location = "The Jade Forest"
},
id382 = {
source = "Terracotta Guardian",
drop_rate = "0.0",
name = "Steppe Greaves",
category_territory = "",
territory = "Horde",
id = "382",
expansion = "Mists Of Pandaria",
location = "Kun-Lai Summit"
},
id383 = {
source = "Seeking Zinjun",
drop_rate = "quest",
name = "Landfall Chain Boots",
category_territory = "",
territory = "Horde",
id = "383",
expansion = "Mists Of Pandaria",
location = "The Jade Forest"
},
id384 = {
source = "Seeking Zinjun",
drop_rate = "quest",
name = "Landfall Sabatons",
category_territory = "",
territory = "Horde",
id = "384",
expansion = "Mists Of Pandaria",
location = "The Jade Forest"
},
id385 = {
source = "Kung Din",
drop_rate = "quest",
name = "Landfall Chain Boots",
category_territory = "",
territory = "Horde",
id = "385",
expansion = "Mists Of Pandaria",
location = "The Jade Forest"
},
id386 = {
source = "Kung Din",
drop_rate = "quest",
name = "Landfall Sabatons",
category_territory = "",
territory = "Horde",
id = "386",
expansion = "Mists Of Pandaria",
location = "The Jade Forest"
},
id387 = {
source = "Coup de Grace",
drop_rate = "quest",
name = "Lifecrusher Treads",
category_territory = "",
territory = "Horde",
id = "387",
expansion = "Cataclysm",
location = "Twilight Highlands"
},
id388 = {
source = "Coup de Grace",
drop_rate = "quest",
name = "Lifecrusher Treads",
category_territory = "",
territory = "Horde",
id = "388",
expansion = "Cataclysm",
location = "Twilight Highlands"
},
id389 = {
source = "Mercy for the Bound",
drop_rate = "quest",
name = "Smoking Stride Treads",
category_territory = "",
territory = "Horde",
id = "389",
expansion = "Cataclysm",
location = "Twilight Highlands"
},
id390 = {
source = "Parting Packages",
drop_rate = "quest",
name = "Repair Crew Treads",
category_territory = "",
territory = "Horde",
id = "390",
expansion = "Cataclysm",
location = "Twilight Highlands"
},
id391 = {
source = "Finding Beak",
drop_rate = "quest",
name = "Friendfinder Treads",
category_territory = "",
territory = "Horde",
id = "391",
expansion = "Cataclysm",
location = "Twilight Highlands"
},
id392 = {
source = "Twilight Crossfire",
drop_rate = "0.0",
name = "Talondeep Greaves",
category_territory = "Raid",
territory = "Horde",
id = "392",
expansion = "Cataclysm",
location = "The Bastion of Twilight"
},
id393 = {
source = "A Disarming Distraction",
drop_rate = "quest",
name = "Treads of the Starry Obelisk",
category_territory = "",
territory = "Horde",
id = "393",
expansion = "Cataclysm",
location = "Uldum"
},
id394 = {
source = "Battlezone",
drop_rate = "quest",
name = "Tank Director's Treads",
category_territory = "",
territory = "Horde",
id = "394",
expansion = "Cataclysm",
location = "Uldum"
},
id395 = {
source = "Wild Vortex",
drop_rate = "0.0",
name = "Treads of the Wyrmhunter",
category_territory = "Dungeon",
territory = "Horde",
id = "395",
expansion = "Cataclysm",
location = "The Vortex Pinnacle"
},
id396 = {
source = "Schnottz Infantryman",
drop_rate = "0.0",
name = "Hiri'watha Greaves",
category_territory = "",
territory = "Horde",
id = "396",
expansion = "Cataclysm",
location = "Uldum"
},
id397 = {
source = "Haunted Servitor",
drop_rate = "0.0",
name = "Highperch Greaves",
category_territory = "Dungeon",
territory = "Alliance",
id = "397",
expansion = "",
location = "Shadowfang Keep"
},
id398 = {
source = "Earthen Destroyer",
drop_rate = "0.0",
name = "Thornsnarl Greaves",
category_territory = "Raid",
territory = "Horde",
id = "398",
expansion = "Cataclysm",
location = "Dragon Soul"
},
id399 = {
source = "Aessinas Miracle",
drop_rate = "quest",
name = "Treads of Restoration",
category_territory = "",
territory = "Horde",
id = "399",
expansion = "Cataclysm",
location = "Mount Hyjal"
},
id400 = {
source = "Gust Soldier",
drop_rate = "0.0",
name = "Bramblescar Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "400",
expansion = "Cataclysm",
location = "The Vortex Pinnacle"
},
id401 = {
source = "Celea",
drop_rate = "Unknown",
name = "Tsunami Boots",
category_territory = "",
territory = "Horde",
id = "401",
expansion = "Legion",
location = "Azsuna"
},
id402 = {
source = "Sealing the Way",
drop_rate = "quest",
name = "Rockslide Treads",
category_territory = "",
territory = "Horde",
id = "402",
expansion = "Cataclysm",
location = "Deepholm"
},
id403 = {
source = "Lady Deathwhisper",
drop_rate = "0.0",
name = "Necrophotic Greaves",
category_territory = "Raid",
territory = "Horde",
id = "403",
expansion = "Wrath Of The Lich King",
location = "Icecrown Citadel"
},
id404 = {
source = "Prince Keleseth",
drop_rate = "Unknown",
name = "Treads of the Wasteland",
category_territory = "Raid",
territory = "Horde",
id = "404",
expansion = "Wrath Of The Lich King",
location = "Icecrown Citadel"
},
id405 = {
source = "Halion",
drop_rate = "0.0",
name = "Returning Footfalls",
category_territory = "Raid",
territory = "Horde",
id = "405",
expansion = "Wrath Of The Lich King",
location = "The Ruby Sanctum"
},
id406 = {
source = "Twilight Zealot",
drop_rate = "0.0",
name = "Southfury Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "406",
expansion = "Cataclysm",
location = "Blackrock Caverns"
},
id407 = {
source = "Taken Gilblin",
drop_rate = "0.0",
name = "Sundown Greaves",
category_territory = "",
territory = "Horde",
id = "407",
expansion = "Cataclysm",
location = "Abyssal Depths"
},
id408 = {
source = "Halion",
drop_rate = "0.0",
name = "Returning Footfalls",
category_territory = "Raid",
territory = "Horde",
id = "408",
expansion = "Wrath Of The Lich King",
location = "The Ruby Sanctum"
},
id409 = {
source = "Halion",
drop_rate = "0.0",
name = "Boots of Divided Being",
category_territory = "Raid",
territory = "Horde",
id = "409",
expansion = "Wrath Of The Lich King",
location = "The Ruby Sanctum"
},
id410 = {
source = "Twilight Zealot",
drop_rate = "0.0",
name = "Nazferiti Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "410",
expansion = "Cataclysm",
location = "Blackrock Caverns"
},
id411 = {
source = "Trial By Fire",
drop_rate = "quest",
name = "Impressive Greaves",
category_territory = "",
territory = "Horde",
id = "411",
expansion = "Cataclysm",
location = "Mount Hyjal"
},
id412 = {
source = "Sweeping the Shelf",
drop_rate = "quest",
name = "Treads of the Dreamwolf",
category_territory = "",
territory = "Horde",
id = "412",
expansion = "Cataclysm",
location = "Mount Hyjal"
},
id413 = {
source = "Sweeping the Shelf",
drop_rate = "quest",
name = "Wolfcall Stompers",
category_territory = "",
territory = "Horde",
id = "413",
expansion = "Cataclysm",
location = "Mount Hyjal"
},
id414 = {
source = "Swift Action",
drop_rate = "quest",
name = "Atoll Treaders",
category_territory = "",
territory = "Horde",
id = "414",
expansion = "Cataclysm",
location = "Shimmering Expanse"
},
id415 = {
source = "Swift Action",
drop_rate = "quest",
name = "Atoll Treaders",
category_territory = "",
territory = "Horde",
id = "415",
expansion = "Cataclysm",
location = "Shimmering Expanse"
},
id416 = {
source = "Come Prepared",
drop_rate = "quest",
name = "Nephropsis Treads",
category_territory = "",
territory = "Horde",
id = "416",
expansion = "Cataclysm",
location = "Shimmering Expanse"
},
id417 = {
source = "Come Prepared",
drop_rate = "quest",
name = "Nephropsis Treads",
category_territory = "",
territory = "Horde",
id = "417",
expansion = "Cataclysm",
location = "Shimmering Expanse"
},
id418 = {
source = "Gluth",
drop_rate = "0.0",
name = "Boots of Persistence",
category_territory = "Raid",
territory = "Horde",
id = "418",
expansion = "Wrath Of The Lich King",
location = "Naxxramas"
},
id419 = {
source = "Gluth",
drop_rate = "0.0",
name = "Trespasser's Boots",
category_territory = "Raid",
territory = "Horde",
id = "419",
expansion = "Wrath Of The Lich King",
location = "Naxxramas"
},
id420 = {
source = "Gluth",
drop_rate = "0.0",
name = "Atonement Greaves",
category_territory = "Raid",
territory = "Horde",
id = "420",
expansion = "Wrath Of The Lich King",
location = "Naxxramas"
},
id421 = {
source = "Gluth",
drop_rate = "0.0",
name = "Crippled Treads",
category_territory = "Raid",
territory = "Horde",
id = "421",
expansion = "Wrath Of The Lich King",
location = "Naxxramas"
},
id422 = {
source = "Gluth",
drop_rate = "0.0",
name = "Eruption-Scarred Boots",
category_territory = "Raid",
territory = "Horde",
id = "422",
expansion = "Wrath Of The Lich King",
location = "Naxxramas"
},
id423 = {
source = "Sapphiron",
drop_rate = "0.0",
name = "Boots of the Great Construct",
category_territory = "Raid",
territory = "Horde",
id = "423",
expansion = "Wrath Of The Lich King",
location = "Naxxramas"
},
id424 = {
source = "Bragund Brightlink",
drop_rate = "Unknown",
name = "Pack-Ice Striders",
category_territory = "",
territory = "",
id = "424",
expansion = "Legion",
location = "Dalaran"
},
id425 = {
source = "Bragund Brightlink",
drop_rate = "Unknown",
name = "Treads of Coastal Wandering",
category_territory = "",
territory = "",
id = "425",
expansion = "Legion",
location = "Dalaran"
},
id426 = {
source = "Emalon the Storm Watcher",
drop_rate = "0.0",
name = "Deadly Gladiator's Sabatons of Salvation",
category_territory = "Raid",
territory = "Horde",
id = "426",
expansion = "Wrath Of The Lich King",
location = "Vault of Archavon"
},
id427 = {
source = "Koralon the Flame Watcher",
drop_rate = "0.0",
name = "Furious Gladiator's Sabatons of Salvation",
category_territory = "Raid",
territory = "Horde",
id = "427",
expansion = "Wrath Of The Lich King",
location = "Vault of Archavon"
},
id428 = {
source = "Toravon the Ice Watcher",
drop_rate = "0.0",
name = "Relentless Gladiator's Sabatons of Salvation",
category_territory = "Raid",
territory = "Horde",
id = "428",
expansion = "Wrath Of The Lich King",
location = "Vault of Archavon"
},
id429 = {
source = "Emalon the Storm Watcher",
drop_rate = "0.0",
name = "Deadly Gladiator's Sabatons of Dominance",
category_territory = "Raid",
territory = "Horde",
id = "429",
expansion = "Wrath Of The Lich King",
location = "Vault of Archavon"
},
id430 = {
source = "Koralon the Flame Watcher",
drop_rate = "0.0",
name = "Furious Gladiator's Sabatons of Dominance",
category_territory = "Raid",
territory = "Horde",
id = "430",
expansion = "Wrath Of The Lich King",
location = "Vault of Archavon"
},
id431 = {
source = "Toravon the Ice Watcher",
drop_rate = "0.0",
name = "Relentless Gladiator's Sabatons of Dominance",
category_territory = "Raid",
territory = "Horde",
id = "431",
expansion = "Wrath Of The Lich King",
location = "Vault of Archavon"
},
id432 = {
source = "Emalon the Storm Watcher",
drop_rate = "0.0",
name = "Deadly Gladiator's Sabatons of Triumph",
category_territory = "Raid",
territory = "Horde",
id = "432",
expansion = "Wrath Of The Lich King",
location = "Vault of Archavon"
},
id433 = {
source = "Koralon the Flame Watcher",
drop_rate = "0.0",
name = "Furious Gladiator's Sabatons of Triumph",
category_territory = "Raid",
territory = "Horde",
id = "433",
expansion = "Wrath Of The Lich King",
location = "Vault of Archavon"
},
id434 = {
source = "Toravon the Ice Watcher",
drop_rate = "0.0",
name = "Relentless Gladiator's Sabatons of Triumph",
category_territory = "Raid",
territory = "Horde",
id = "434",
expansion = "Wrath Of The Lich King",
location = "Vault of Archavon"
},
id435 = {
source = "Sartharion",
drop_rate = "0.0",
name = "Sabatons of Firmament",
category_territory = "Raid",
territory = "Horde",
id = "435",
expansion = "Wrath Of The Lich King",
location = "The Obsidian Sanctum"
},
id436 = {
source = "Archmage Alvareaux",
drop_rate = "Unknown",
name = "Boots of Twinkling Stars",
category_territory = "",
territory = "",
id = "436",
expansion = "Wrath Of The Lich King",
location = "Dalaran"
},
id437 = {
source = "Champion Rosslai",
drop_rate = "Unknown",
name = "Titan-Forged Sabatons of Dominance",
category_territory = "",
territory = "",
id = "437",
expansion = "Wrath Of The Lich King",
location = "Wintergrasp"
},
id438 = {
source = "Champion Rosslai",
drop_rate = "Unknown",
name = "Titan-Forged Sabatons of Salvation",
category_territory = "",
territory = "",
id = "438",
expansion = "Wrath Of The Lich King",
location = "Wintergrasp"
},
id439 = {
source = "Champion Rosslai",
drop_rate = "Unknown",
name = "Titan-Forged Sabatons of Triumph",
category_territory = "",
territory = "",
id = "439",
expansion = "Wrath Of The Lich King",
location = "Wintergrasp"
},
id440 = {
source = "Stormcaller Brundir",
drop_rate = "Unknown",
name = "Greaves of Swift Vengeance",
category_territory = "Raid",
territory = "Horde",
id = "440",
expansion = "Wrath Of The Lich King",
location = "Ulduar"
},
id441 = {
source = "XT-002 Deconstructor",
drop_rate = "0.0",
name = "Brass-Lined Boots",
category_territory = "Raid",
territory = "Horde",
id = "441",
expansion = "Wrath Of The Lich King",
location = "Ulduar"
},
id442 = {
source = "General Vezax",
drop_rate = "0.0",
name = "Boots of the Forgotten Depths",
category_territory = "Raid",
territory = "Horde",
id = "442",
expansion = "Wrath Of The Lich King",
location = "Ulduar"
},
id443 = {
source = "Storm Tempered Keeper",
drop_rate = "0.0",
name = "Boots of Unsettled Prey",
category_territory = "Raid",
territory = "Horde",
id = "443",
expansion = "Wrath Of The Lich King",
location = "Ulduar"
},
id444 = {
source = "Eydis Darkbane",
drop_rate = "Unknown",
name = "Sabatons of Ruthless Judgment",
category_territory = "Raid",
territory = "Horde",
id = "444",
expansion = "Wrath Of The Lich King",
location = "Crusaders' Coliseum: Trial of the Crusader"
},
id445 = {
source = "Eydis Darkbane",
drop_rate = "Unknown",
name = "Sabatons of Ruthless Judgment",
category_territory = "Raid",
territory = "Horde",
id = "445",
expansion = "Wrath Of The Lich King",
location = "Crusaders' Coliseum: Trial of the Crusader"
},
id446 = {
source = "Eydis Darkbane",
drop_rate = "Unknown",
name = "Greaves of Ruthless Judgment",
category_territory = "Raid",
territory = "Horde",
id = "446",
expansion = "Wrath Of The Lich King",
location = "Crusaders' Coliseum: Trial of the Crusader"
},
id447 = {
source = "Eydis Darkbane",
drop_rate = "Unknown",
name = "Greaves of Ruthless Judgment",
category_territory = "Raid",
territory = "Horde",
id = "447",
expansion = "Wrath Of The Lich King",
location = "Crusaders' Coliseum: Trial of the Crusader"
},
id448 = {
source = "Lord Jaraxxus",
drop_rate = "0.0",
name = "Sentinel Scouting Greaves",
category_territory = "Raid",
territory = "Horde",
id = "448",
expansion = "Wrath Of The Lich King",
location = "Crusaders' Coliseum: Trial of the Crusader"
},
id449 = {
source = "Lord Jaraxxus",
drop_rate = "0.0",
name = "Warsong Poacher's Greaves",
category_territory = "Raid",
territory = "Horde",
id = "449",
expansion = "Wrath Of The Lich King",
location = "Crusaders' Coliseum: Trial of the Crusader"
},
id450 = {
source = "Lord Jaraxxus",
drop_rate = "0.0",
name = "Sentinel Scouting Greaves",
category_territory = "Raid",
territory = "Horde",
id = "450",
expansion = "Wrath Of The Lich King",
location = "Crusaders' Coliseum: Trial of the Crusader"
},
id451 = {
source = "Lord Jaraxxus",
drop_rate = "0.0",
name = "Warsong Poacher's Greaves",
category_territory = "Raid",
territory = "Horde",
id = "451",
expansion = "Wrath Of The Lich King",
location = "Crusaders' Coliseum: Trial of the Crusader"
},
id452 = {
source = "Lord Jaraxxus",
drop_rate = "0.0",
name = "Boots of Tortured Space",
category_territory = "Raid",
territory = "Horde",
id = "452",
expansion = "Wrath Of The Lich King",
location = "Crusaders' Coliseum: Trial of the Crusader"
},
id453 = {
source = "Lord Jaraxxus",
drop_rate = "0.0",
name = "Sabatons of Tortured Space",
category_territory = "Raid",
territory = "Horde",
id = "453",
expansion = "Wrath Of The Lich King",
location = "Crusaders' Coliseum: Trial of the Crusader"
},
id454 = {
source = "Lord Jaraxxus",
drop_rate = "0.0",
name = "Sabatons of Tortured Space",
category_territory = "Raid",
territory = "Horde",
id = "454",
expansion = "Wrath Of The Lich King",
location = "Crusaders' Coliseum: Trial of the Crusader"
},
id455 = {
source = "Lord Jaraxxus",
drop_rate = "0.0",
name = "Boots of Tortured Space",
category_territory = "Raid",
territory = "Horde",
id = "455",
expansion = "Wrath Of The Lich King",
location = "Crusaders' Coliseum: Trial of the Crusader"
},
id456 = {
source = "Devourer of Souls",
drop_rate = "0.0",
name = "Soul Screaming Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "456",
expansion = "Wrath Of The Lich King",
location = "The Forge of Souls"
},
id457 = {
source = "Falric",
drop_rate = "0.0",
name = "Muddied Boots of Brill",
category_territory = "Dungeon",
territory = "Horde",
id = "457",
expansion = "Wrath Of The Lich King",
location = "Halls of Reflection"
},
id458 = {
source = "Lady Deathwhisper",
drop_rate = "0.0",
name = "Necrophotic Greaves",
category_territory = "Raid",
territory = "Horde",
id = "458",
expansion = "Wrath Of The Lich King",
location = "Icecrown Citadel"
},
id459 = {
source = "Prince Keleseth",
drop_rate = "Unknown",
name = "Treads of the Wasteland",
category_territory = "Raid",
territory = "Horde",
id = "459",
expansion = "Wrath Of The Lich King",
location = "Icecrown Citadel"
},
id460 = {
source = "Scourgelord Tyrannus",
drop_rate = "0.0",
name = "Mudslide Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "460",
expansion = "Wrath Of The Lich King",
location = "Pit of Saron"
},
id461 = {
source = "Falric",
drop_rate = "0.0",
name = "Spiked Toestompers",
category_territory = "Dungeon",
territory = "Horde",
id = "461",
expansion = "Wrath Of The Lich King",
location = "Halls of Reflection"
},
id462 = {
source = "Festergut",
drop_rate = "0.0",
name = "Taldron's Long Neglected Boots",
category_territory = "Raid",
territory = "Horde",
id = "462",
expansion = "Wrath Of The Lich King",
location = "Icecrown Citadel"
},
id463 = {
source = "Rotface",
drop_rate = "0.0",
name = "Shuffling Shoes",
category_territory = "Raid",
territory = "Horde",
id = "463",
expansion = "Wrath Of The Lich King",
location = "Icecrown Citadel"
},
id464 = {
source = "Toravon the Ice Watcher",
drop_rate = "0.0",
name = "Wrathful Gladiator's Sabatons of Triumph",
category_territory = "Raid",
territory = "Horde",
id = "464",
expansion = "Wrath Of The Lich King",
location = "Vault of Archavon"
},
id465 = {
source = "Toravon the Ice Watcher",
drop_rate = "0.0",
name = "Wrathful Gladiator's Sabatons of Salvation",
category_territory = "Raid",
territory = "Horde",
id = "465",
expansion = "Wrath Of The Lich King",
location = "Vault of Archavon"
},
id466 = {
source = "Toravon the Ice Watcher",
drop_rate = "0.0",
name = "Wrathful Gladiator's Sabatons of Dominance",
category_territory = "Raid",
territory = "Horde",
id = "466",
expansion = "Wrath Of The Lich King",
location = "Vault of Archavon"
},
id467 = {
source = "Sindragosa",
drop_rate = "0.0",
name = "Wyrmwing Treads",
category_territory = "Raid",
territory = "Horde",
id = "467",
expansion = "Wrath Of The Lich King",
location = "Icecrown Citadel"
},
id468 = {
source = "Sindragosa",
drop_rate = "0.0",
name = "Wyrmwing Treads",
category_territory = "Raid",
territory = "Horde",
id = "468",
expansion = "Wrath Of The Lich King",
location = "Icecrown Citadel"
},
id469 = {
source = "Rotface",
drop_rate = "0.0",
name = "Shuffling Shoes",
category_territory = "Raid",
territory = "Horde",
id = "469",
expansion = "Wrath Of The Lich King",
location = "Icecrown Citadel"
},
id470 = {
source = "Festergut",
drop_rate = "0.0",
name = "Taldron's Long Neglected Boots",
category_territory = "Raid",
territory = "Horde",
id = "470",
expansion = "Wrath Of The Lich King",
location = "Icecrown Citadel"
},
id471 = {
source = "Halion",
drop_rate = "0.0",
name = "Boots of Divided Being",
category_territory = "Raid",
territory = "Horde",
id = "471",
expansion = "Wrath Of The Lich King",
location = "The Ruby Sanctum"
},
id472 = {
source = "Stormcaller Brundir",
drop_rate = "Unknown",
name = "Greaves of Swift Vengeance",
category_territory = "Raid",
territory = "Horde",
id = "472",
expansion = "Wrath Of The Lich King",
location = "Ulduar"
},
id473 = {
source = "XT-002 Deconstructor",
drop_rate = "Unknown",
name = "Brass-Lined Boots",
category_territory = "Raid",
territory = "Horde",
id = "473",
expansion = "Wrath Of The Lich King",
location = "Ulduar"
},
id474 = {
source = "General Vezax",
drop_rate = "Unknown",
name = "Boots of the Forgotten Depths",
category_territory = "Raid",
territory = "Horde",
id = "474",
expansion = "Wrath Of The Lich King",
location = "Ulduar"
},
id475 = {
source = "Cyanigosa",
drop_rate = "0.0",
name = "Boots of the Portal Guardian",
category_territory = "Dungeon",
territory = "Horde",
id = "475",
expansion = "Wrath Of The Lich King",
location = "The Violet Hold"
},
id476 = {
source = "Unbound Firestorm",
drop_rate = "0.0",
name = "Boots of the Terrestrial Guardian",
category_territory = "Dungeon",
territory = "Horde",
id = "476",
expansion = "Wrath Of The Lich King",
location = "Halls of Lightning"
},
id477 = {
source = "Chrono-Lord Epoch",
drop_rate = "0.0",
name = "Treads of Altered History",
category_territory = "Dungeon",
territory = "Horde",
id = "477",
expansion = "Wrath Of The Lich King",
location = "The Culling of Stratholme"
},
id478 = {
source = "Keristrasza",
drop_rate = "0.0",
name = "Dragon Slayer's Sabatons",
category_territory = "Dungeon",
territory = "Horde",
id = "478",
expansion = "Wrath Of The Lich King",
location = "The Nexus"
},
id479 = {
source = "Brann Bronzebeard",
drop_rate = "Unknown",
name = "Sabatons of the Ages",
category_territory = "Dungeon",
territory = "Horde",
id = "479",
expansion = "Wrath Of The Lich King",
location = "Halls of Stone"
},
id480 = {
source = "Lavanthor",
drop_rate = "0.0",
name = "Twin-Headed Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "480",
expansion = "Wrath Of The Lich King",
location = "The Violet Hold"
},
id481 = {
source = "One of a Kind",
drop_rate = "quest",
name = "Scaled Boots of Fallen Hope",
category_territory = "Dungeon",
territory = "Horde",
id = "481",
expansion = "Wrath Of The Lich King",
location = "Gundrak"
},
id482 = {
source = "Celea",
drop_rate = "Unknown",
name = "Dragonstompers",
category_territory = "",
territory = "Horde",
id = "482",
expansion = "Legion",
location = "Azsuna"
},
id483 = {
source = "Celea",
drop_rate = "Unknown",
name = "Scaled Icewalkers",
category_territory = "",
territory = "Horde",
id = "483",
expansion = "Legion",
location = "Azsuna"
},
id484 = {
source = "Irisee",
drop_rate = "Unknown",
name = "Treads of the Glorious Spirit",
category_territory = "",
territory = "Horde",
id = "484",
expansion = "Wrath Of The Lich King",
location = "Icecrown"
},
id485 = {
source = "Trellis Morningsun",
drop_rate = "Unknown",
name = "Treads of Whispering Dreams",
category_territory = "",
territory = "Horde",
id = "485",
expansion = "Wrath Of The Lich King",
location = "Icecrown"
},
id486 = {
source = "Keristrasza",
drop_rate = "0.0",
name = "Dragon Slayer's Sabatons",
category_territory = "Dungeon",
territory = "Horde",
id = "486",
expansion = "Wrath Of The Lich King",
location = "The Nexus"
},
id487 = {
source = "Auzin",
drop_rate = "Unknown",
name = "Pack-Ice Striders",
category_territory = "",
territory = "",
id = "487",
expansion = "Wrath Of The Lich King",
location = "Dalaran"
},
id488 = {
source = "Stormfury Revenant",
drop_rate = "0.0",
name = "Spiderlord Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "488",
expansion = "Wrath Of The Lich King",
location = "Halls of Lightning"
},
id489 = {
source = "Stormforged Tactician",
drop_rate = "0.0",
name = "Spectral Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "489",
expansion = "Wrath Of The Lich King",
location = "Halls of Lightning"
},
id490 = {
source = "Iris Moondreamer",
drop_rate = "Unknown",
name = "Stormbinder Greaves",
category_territory = "",
territory = "Horde",
id = "490",
expansion = "Cataclysm",
location = "Mount Hyjal"
},
id491 = {
source = "Iris Moondreamer",
drop_rate = "Unknown",
name = "Stormbinder Boots",
category_territory = "",
territory = "Horde",
id = "491",
expansion = "Cataclysm",
location = "Mount Hyjal"
},
id492 = {
source = "Iris Moondreamer",
drop_rate = "Unknown",
name = "Stormbinder Sabatons",
category_territory = "",
territory = "Horde",
id = "492",
expansion = "Cataclysm",
location = "Mount Hyjal"
},
id493 = {
source = "Iris Moondreamer",
drop_rate = "Unknown",
name = "Beastsoul Greaves",
category_territory = "",
territory = "Horde",
id = "493",
expansion = "Cataclysm",
location = "Mount Hyjal"
},
id494 = {
source = "Mind Tricks",
drop_rate = "quest",
name = "The Darkspeaker's Sabatons",
category_territory = "",
territory = "Horde",
id = "494",
expansion = "Wrath Of The Lich King",
location = "Icecrown"
},
id495 = {
source = "Argent Priestess",
drop_rate = "0.0",
name = "Ulduar Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "495",
expansion = "Wrath Of The Lich King",
location = "Crusaders' Coliseum: Trial of the Champion"
},
id496 = {
source = "Demolitionist Extraordinaire",
drop_rate = "quest",
name = "Mammoth Mukluks",
category_territory = "",
territory = "Horde",
id = "496",
expansion = "Wrath Of The Lich King",
location = "The Storm Peaks"
},
id497 = {
source = "Chain of Command",
drop_rate = "quest",
name = "Savryn's Muddy Boots",
category_territory = "",
territory = "Horde",
id = "497",
expansion = "Wrath Of The Lich King",
location = "Icecrown"
},
id498 = {
source = "The Rider of the Unholy",
drop_rate = "quest",
name = "Blood-Encrusted Boots",
category_territory = "",
territory = "Horde",
id = "498",
expansion = "Wrath Of The Lich King",
location = "Icecrown"
},
id499 = {
source = "Skadi the Ruthless",
drop_rate = "0.0",
name = "Skadi's Scaled Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "499",
expansion = "Wrath Of The Lich King",
location = "Utgarde Pinnacle"
},
id500 = {
source = "Dark Zealot",
drop_rate = "0.0",
name = "Cormorant Footwraps",
category_territory = "",
territory = "Horde",
id = "500",
expansion = "Wrath Of The Lich King",
location = "Icecrown"
},
id501 = {
source = "Unyielding Constrictor",
drop_rate = "0.0",
name = "Wolvar Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "501",
expansion = "Wrath Of The Lich King",
location = "Gundrak"
},
id502 = {
source = "Moragg",
drop_rate = "0.0",
name = "Mammoth Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "502",
expansion = "Wrath Of The Lich King",
location = "The Violet Hold"
},
id503 = {
source = "An Issue of Trust",
drop_rate = "quest",
name = "Skeleton Smashers",
category_territory = "",
territory = "Horde",
id = "503",
expansion = "Wrath Of The Lich King",
location = "Sholazar Basin"
},
id504 = {
source = "Exterminate the Intruders",
drop_rate = "quest",
name = "Treads of Bound Life",
category_territory = "",
territory = "Horde",
id = "504",
expansion = "Wrath Of The Lich King",
location = "Sholazar Basin"
},
id505 = {
source = "Blaze Magmaburn",
drop_rate = "Unknown",
name = "Guardian's Chain Sabatons",
category_territory = "",
territory = "Horde",
id = "505",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id506 = {
source = "Blaze Magmaburn",
drop_rate = "Unknown",
name = "Guardian's Linked Sabatons",
category_territory = "",
territory = "Horde",
id = "506",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id507 = {
source = "Blaze Magmaburn",
drop_rate = "Unknown",
name = "Guardian's Mail Sabatons",
category_territory = "",
territory = "Horde",
id = "507",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id508 = {
source = "Blaze Magmaburn",
drop_rate = "Unknown",
name = "Guardian's Ringmail Sabatons",
category_territory = "",
territory = "Horde",
id = "508",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id509 = {
source = "Anomalus",
drop_rate = "0.0",
name = "Cleated Ice Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "509",
expansion = "Wrath Of The Lich King",
location = "The Nexus"
},
id510 = {
source = "Death to the Traitor King",
drop_rate = "quest",
name = "Husk Shard Sabatons",
category_territory = "Dungeon",
territory = "Horde",
id = "510",
expansion = "Wrath Of The Lich King",
location = "Azjol-Nerub"
},
id511 = {
source = "Anomalus",
drop_rate = "0.0",
name = "Cleated Ice Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "511",
expansion = "Wrath Of The Lich King",
location = "The Nexus"
},
id512 = {
source = "The Prophet Tharonja",
drop_rate = "0.0",
name = "Shoveltusk Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "512",
expansion = "Wrath Of The Lich King",
location = "Drak'Tharon Keep"
},
id513 = {
source = "The Leaders at JinAlai",
drop_rate = "quest",
name = "Boots of the Great Sacrifice",
category_territory = "",
territory = "Horde",
id = "513",
expansion = "Wrath Of The Lich King",
location = "Zul'Drak"
},
id514 = {
source = "Trolls Is Gone Crazy!",
drop_rate = "quest",
name = "Freedom-Path Treads",
category_territory = "",
territory = "Horde",
id = "514",
expansion = "Wrath Of The Lich King",
location = "Zul'Drak"
},
id515 = {
source = "Theremis",
drop_rate = "Unknown",
name = "Skyshatter Boots",
category_territory = "",
territory = "Horde",
id = "515",
expansion = "",
location = "Isle of Quel'Danas"
},
id516 = {
source = "Theremis",
drop_rate = "Unknown",
name = "Skyshatter Treads",
category_territory = "",
territory = "Horde",
id = "516",
expansion = "",
location = "Isle of Quel'Danas"
},
id517 = {
source = "Theremis",
drop_rate = "Unknown",
name = "Skyshatter Greaves",
category_territory = "",
territory = "Horde",
id = "517",
expansion = "",
location = "Isle of Quel'Danas"
},
id518 = {
source = "Theremis",
drop_rate = "Unknown",
name = "Gronnstalker's Boots",
category_territory = "",
territory = "Horde",
id = "518",
expansion = "",
location = "Isle of Quel'Danas"
},
id519 = {
source = "Drakkari Guardian",
drop_rate = "0.0",
name = "Trapper Footwraps",
category_territory = "Dungeon",
territory = "Horde",
id = "519",
expansion = "Wrath Of The Lich King",
location = "Drak'Tharon Keep"
},
id520 = {
source = "The Iron Thane and His Anvil",
drop_rate = "quest",
name = "Short-Circuiting Boots",
category_territory = "",
territory = "Horde",
id = "520",
expansion = "Wrath Of The Lich King",
location = "Grizzly Hills"
},
id521 = {
source = "Voices From the Dust",
drop_rate = "quest",
name = "Plane-Shifted Boots",
category_territory = "",
territory = "Horde",
id = "521",
expansion = "Wrath Of The Lich King",
location = "Grizzly Hills"
},
id522 = {
source = "Plundering Geist",
drop_rate = "0.0",
name = "Amberpine Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "522",
expansion = "Wrath Of The Lich King",
location = "Ahn'kahet: The Old Kingdom"
},
id523 = {
source = "Kitzie Crankshot",
drop_rate = "Unknown",
name = "Vindicator's Chain Sabatons",
category_territory = "",
territory = "Horde",
id = "523",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id524 = {
source = "Kitzie Crankshot",
drop_rate = "Unknown",
name = "Vindicator's Linked Sabatons",
category_territory = "",
territory = "Horde",
id = "524",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id525 = {
source = "Kitzie Crankshot",
drop_rate = "Unknown",
name = "Vindicator's Mail Sabatons",
category_territory = "",
territory = "Horde",
id = "525",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id526 = {
source = "Kitzie Crankshot",
drop_rate = "Unknown",
name = "Vindicator's Ringmail Sabatons",
category_territory = "",
territory = "Horde",
id = "526",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id527 = {
source = "Krikthir the Gatewatcher",
drop_rate = "0.0",
name = "Orca Footwraps",
category_territory = "Dungeon",
territory = "Horde",
id = "527",
expansion = "Wrath Of The Lich King",
location = "Azjol-Nerub"
},
id528 = {
source = "The Plume of Alystros",
drop_rate = "quest",
name = "Verdant Linked Boots",
category_territory = "",
territory = "Horde",
id = "528",
expansion = "Wrath Of The Lich King",
location = "Dragonblight"
},
id529 = {
source = "Something That Doesnt Melt",
drop_rate = "quest",
name = "Tightened Chainmesh Boots",
category_territory = "",
territory = "Horde",
id = "529",
expansion = "Wrath Of The Lich King",
location = "Dragonblight"
},
id530 = {
source = "Strengthen the Ancients",
drop_rate = "quest",
name = "Star's Rest Treads",
category_territory = "",
territory = "Horde",
id = "530",
expansion = "Wrath Of The Lich King",
location = "Dragonblight"
},
id531 = {
source = "Celea",
drop_rate = "Unknown",
name = "Frostscale Boots",
category_territory = "",
territory = "Horde",
id = "531",
expansion = "Legion",
location = "Azsuna"
},
id532 = {
source = "Rage Winterchill",
drop_rate = "0.0",
name = "Stillwater Boots",
category_territory = "Raid",
territory = "Horde",
id = "532",
expansion = "The Burning Crusade",
location = "Hyjal Summit"
},
id533 = {
source = "Anetheron",
drop_rate = "0.0",
name = "Quickstrider Moccasins",
category_territory = "Raid",
territory = "Horde",
id = "533",
expansion = "The Burning Crusade",
location = "Hyjal Summit"
},
id534 = {
source = "High Warlord Najentus",
drop_rate = "0.0",
name = "Boots of Oceanic Fury",
category_territory = "Raid",
territory = "Horde",
id = "534",
expansion = "The Burning Crusade",
location = "Black Temple"
},
id535 = {
source = "Teron Gorefiend",
drop_rate = "0.0",
name = "Softstep Boots of Tracking",
category_territory = "Raid",
territory = "Horde",
id = "535",
expansion = "The Burning Crusade",
location = "Black Temple"
},
id536 = {
source = "High Warlord Najentus",
drop_rate = "Unknown",
name = "Boots of Oceanic Fury",
category_territory = "Raid",
territory = "Horde",
id = "536",
expansion = "The Burning Crusade",
location = "Black Temple"
},
id537 = {
source = "Teron Gorefiend",
drop_rate = "Unknown",
name = "Softstep Boots of Tracking",
category_territory = "Raid",
territory = "Horde",
id = "537",
expansion = "The Burning Crusade",
location = "Black Temple"
},
id538 = {
source = "Plundering Geist",
drop_rate = "0.0",
name = "Nifflevar Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "538",
expansion = "Wrath Of The Lich King",
location = "Ahn'kahet: The Old Kingdom"
},
id539 = {
source = "Celea",
drop_rate = "Unknown",
name = "Nerubian Boots",
category_territory = "",
territory = "Horde",
id = "539",
expansion = "Legion",
location = "Azsuna"
},
id540 = {
source = "Lady Vashj",
drop_rate = "0.0",
name = "Cobra-Lash Boots",
category_territory = "Raid",
territory = "Horde",
id = "540",
expansion = "The Burning Crusade",
location = "Serpentshrine Cavern"
},
id541 = {
source = "Return to Valgarde",
drop_rate = "quest",
name = "Streamlined Stompers",
category_territory = "",
territory = "Horde",
id = "541",
expansion = "Wrath Of The Lich King",
location = "Howling Fjord"
},
id542 = {
source = "All Hail the Conqueror of Skorn!",
drop_rate = "quest",
name = "Sun-Fired Striders",
category_territory = "",
territory = "Horde",
id = "542",
expansion = "Wrath Of The Lich King",
location = "Howling Fjord"
},
id543 = {
source = "Alpha Worg",
drop_rate = "quest",
name = "Darksteel Ringmail Greaves",
category_territory = "",
territory = "Horde",
id = "543",
expansion = "Wrath Of The Lich King",
location = "Howling Fjord"
},
id544 = {
source = "Dragonflayer Runecaster",
drop_rate = "0.0",
name = "Skom Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "544",
expansion = "Wrath Of The Lich King",
location = "Utgarde Keep"
},
id545 = {
source = "We Strike!",
drop_rate = "quest",
name = "Tundrastrider Boots",
category_territory = "",
territory = "Horde",
id = "545",
expansion = "Wrath Of The Lich King",
location = "Borean Tundra"
},
id546 = {
source = "Vision of Air",
drop_rate = "quest",
name = "Chilled Mail Boots",
category_territory = "",
territory = "Horde",
id = "546",
expansion = "Wrath Of The Lich King",
location = "Borean Tundra"
},
id547 = {
source = "Kezzik the Striker",
drop_rate = "Unknown",
name = "General's Chain Sabatons",
category_territory = "",
territory = "Horde",
id = "547",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id548 = {
source = "Nightbane",
drop_rate = "0.0",
name = "Ferocious Swift-Kickers",
category_territory = "Raid",
territory = "Horde",
id = "548",
expansion = "The Burning Crusade",
location = "Karazhan"
},
id549 = {
source = "Kezzik the Striker",
drop_rate = "Unknown",
name = "General's Linked Sabatons",
category_territory = "",
territory = "Horde",
id = "549",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id550 = {
source = "Kezzik the Striker",
drop_rate = "Unknown",
name = "General's Mail Sabatons",
category_territory = "",
territory = "Horde",
id = "550",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id551 = {
source = "Echo of Medivh",
drop_rate = "Unknown",
name = "Fiend Slayer Boots",
category_territory = "Raid",
territory = "Horde",
id = "551",
expansion = "The Burning Crusade",
location = "Karazhan"
},
id552 = {
source = "Gruul the Dragonkiller",
drop_rate = "0.0",
name = "Windshear Boots",
category_territory = "Raid",
territory = "Horde",
id = "552",
expansion = "The Burning Crusade",
location = "Gruul's Lair"
},
id553 = {
source = "Kezzik the Striker",
drop_rate = "Unknown",
name = "Marshal's Chain Sabatons",
category_territory = "",
territory = "Horde",
id = "553",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id554 = {
source = "Kezzik the Striker",
drop_rate = "Unknown",
name = "Marshal's Linked Sabatons",
category_territory = "",
territory = "Horde",
id = "554",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id555 = {
source = "Kezzik the Striker",
drop_rate = "Unknown",
name = "Marshal's Mail Sabatons",
category_territory = "",
territory = "Horde",
id = "555",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id556 = {
source = "High Astromancer Solarian",
drop_rate = "0.0",
name = "Star-Strider Boots",
category_territory = "Raid",
territory = "Horde",
id = "556",
expansion = "The Burning Crusade",
location = "The Eye"
},
id557 = {
source = "The Lurker Below",
drop_rate = "0",
name = "Tempest-Strider Boots",
category_territory = "Raid",
territory = "Horde",
id = "557",
expansion = "The Burning Crusade",
location = "Serpentshrine Cavern"
},
id558 = {
source = "Hyakiss the Lurker",
drop_rate = "Unknown",
name = "Glider's Sabatons",
category_territory = "Raid",
territory = "Horde",
id = "558",
expansion = "The Burning Crusade",
location = "Karazhan"
},
id559 = {
source = "Geras",
drop_rate = "Unknown",
name = "Inferno Forged Boots",
category_territory = "",
territory = "",
id = "559",
expansion = "The Burning Crusade",
location = "Shattrath City"
},
id560 = {
source = "Izzee the Clutch",
drop_rate = "Unknown",
name = "Veteran's Chain Sabatons",
category_territory = "",
territory = "Horde",
id = "560",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id561 = {
source = "Izzee the Clutch",
drop_rate = "Unknown",
name = "Veteran's Linked Sabatons",
category_territory = "",
territory = "Horde",
id = "561",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id562 = {
source = "Izzee the Clutch",
drop_rate = "Unknown",
name = "Veteran's Mail Sabatons",
category_territory = "",
territory = "Horde",
id = "562",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id563 = {
source = "Izzee the Clutch",
drop_rate = "Unknown",
name = "Veteran's Ringmail Sabatons",
category_territory = "",
territory = "Horde",
id = "563",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id564 = {
source = "Geras",
drop_rate = "Unknown",
name = "Treads of the Life Path",
category_territory = "",
territory = "",
id = "564",
expansion = "The Burning Crusade",
location = "Shattrath City"
},
id565 = {
source = "Geras",
drop_rate = "Unknown",
name = "Treads of Booming Thunder",
category_territory = "",
territory = "",
id = "565",
expansion = "The Burning Crusade",
location = "Shattrath City"
},
id566 = {
source = "Watchkeeper Gargolmar",
drop_rate = "0.0",
name = "Wild Stalker Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "566",
expansion = "The Burning Crusade",
location = "Hellfire Ramparts"
},
id567 = {
source = "Rokmar the Crackler",
drop_rate = "0.0",
name = "Wavefury Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "567",
expansion = "The Burning Crusade",
location = "The Slave Pens"
},
id568 = {
source = "Shirrak the Dead Watcher",
drop_rate = "0.0",
name = "Magma Plume Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "568",
expansion = "The Burning Crusade",
location = "Auchenai Crypts"
},
id569 = {
source = "Into the Heart of the Labyrinth",
drop_rate = "quest",
name = "Auchenai Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "569",
expansion = "The Burning Crusade",
location = "Shadow Labyrinth"
},
id570 = {
source = "Dalliah the Doomsayer",
drop_rate = "0.0",
name = "Outland Striders",
category_territory = "Dungeon",
territory = "Horde",
id = "570",
expansion = "The Burning Crusade",
location = "The Arcatraz"
},
id571 = {
source = "Dragonflayer Strategist",
drop_rate = "0.0",
name = "Horrorblood Treads",
category_territory = "Dungeon",
territory = "Horde",
id = "571",
expansion = "Wrath Of The Lich King",
location = "Utgarde Keep"
},
id572 = {
source = "Zereketh the Unbound",
drop_rate = "0.0",
name = "Outland Striders",
category_territory = "Dungeon",
territory = "Horde",
id = "572",
expansion = "The Burning Crusade",
location = "The Arcatraz"
},
id573 = {
source = "Rokmar the Crackler",
drop_rate = "0.0",
name = "Wavefury Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "573",
expansion = "The Burning Crusade",
location = "The Slave Pens"
},
id574 = {
source = "Phantom Guardsman",
drop_rate = "0.0",
name = "Talhide Lined-Boots",
category_territory = "Raid",
territory = "Horde",
id = "574",
expansion = "The Burning Crusade",
location = "Karazhan"
},
id575 = {
source = "Gruul the Dragonkiller",
drop_rate = "0.0",
name = "Netherstorm Greaves",
category_territory = "Raid",
territory = "Horde",
id = "575",
expansion = "The Burning Crusade",
location = "Gruul's Lair"
},
id576 = {
source = "Dragonflayer Strategist",
drop_rate = "0.0",
name = "Garmaul Footwraps",
category_territory = "Dungeon",
territory = "Horde",
id = "576",
expansion = "Wrath Of The Lich King",
location = "Utgarde Keep"
},
id577 = {
source = "Dragonflayer Ironhelm",
drop_rate = "0.0",
name = "Njord Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "577",
expansion = "Wrath Of The Lich King",
location = "Utgarde Keep"
},
id578 = {
source = "Pathaleon the Calculator",
drop_rate = "0.0",
name = "Sundered Footwraps",
category_territory = "Dungeon",
territory = "Horde",
id = "578",
expansion = "The Burning Crusade",
location = "The Mechanar"
},
id579 = {
source = "Dealing with the Overmaster",
drop_rate = "quest",
name = "Landing Boots",
category_territory = "",
territory = "Horde",
id = "579",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id580 = {
source = "Reclaiming Holy Grounds",
drop_rate = "quest",
name = "Blackened Chain Greaves",
category_territory = "",
territory = "Horde",
id = "580",
expansion = "The Burning Crusade",
location = "Shadowmoon Valley"
},
id581 = {
source = "Darkweaver Syth",
drop_rate = "0.0",
name = "Sky-Hunter Swift Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "581",
expansion = "The Burning Crusade",
location = "Sethekk Halls"
},
id582 = {
source = "Kelidan the Breaker",
drop_rate = "0.0",
name = "Wave-Crest Striders",
category_territory = "Dungeon",
territory = "Horde",
id = "582",
expansion = "The Burning Crusade",
location = "The Blood Furnace"
},
id583 = {
source = "Warp Splinter",
drop_rate = "0.0",
name = "Boots of the Endless Hunt",
category_territory = "Dungeon",
territory = "Horde",
id = "583",
expansion = "The Burning Crusade",
location = "The Botanica"
},
id584 = {
source = "Sunfury Warp-Master",
drop_rate = "0.0",
name = "Skettis Footwraps",
category_territory = "",
territory = "Horde",
id = "584",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id585 = {
source = "Rightful Repossession",
drop_rate = "quest",
name = "Duro Footgear",
category_territory = "",
territory = "Horde",
id = "585",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id586 = {
source = "Turning Point",
drop_rate = "quest",
name = "Greaves of Spellpower",
category_territory = "",
territory = "Horde",
id = "586",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id587 = {
source = "Kraator",
drop_rate = "0.0",
name = "Abyssal Mail Greaves",
category_territory = "",
territory = "Horde",
id = "587",
expansion = "The Burning Crusade",
location = "Shadowmoon Valley"
},
id588 = {
source = "Ethereum Prisoner",
drop_rate = "0.0",
name = "Mistshroud Boots",
category_territory = "",
territory = "Horde",
id = "588",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id589 = {
source = "Avian Ripper",
drop_rate = "0.0",
name = "Der'izu Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "589",
expansion = "The Burning Crusade",
location = "Sethekk Halls"
},
id590 = {
source = "Celea",
drop_rate = "Unknown",
name = "Scaled Draenic Boots",
category_territory = "",
territory = "Horde",
id = "590",
expansion = "Legion",
location = "Azsuna"
},
id591 = {
source = "Elemental Power Extraction",
drop_rate = "quest",
name = "Heavy-Duty Engineering Boots",
category_territory = "",
territory = "Horde",
id = "591",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id592 = {
source = "Avian Ripper",
drop_rate = "0.0",
name = "Ironspine Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "592",
expansion = "The Burning Crusade",
location = "Sethekk Halls"
},
id593 = {
source = "Windroc Mastery",
drop_rate = "quest",
name = "Windroc Boots",
category_territory = "",
territory = "Horde",
id = "593",
expansion = "The Burning Crusade",
location = "Nagrand"
},
id594 = {
source = "Avian Ripper",
drop_rate = "0.0",
name = "Blood Knight Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "594",
expansion = "The Burning Crusade",
location = "Sethekk Halls"
},
id595 = {
source = "Protecting Our Own",
drop_rate = "quest",
name = "Protector's Boots",
category_territory = "",
territory = "Horde",
id = "595",
expansion = "The Burning Crusade",
location = "Blade's Edge Mountains"
},
id596 = {
source = "Ethereal Crypt Raider",
drop_rate = "0.0",
name = "Marshcreeper Sludgeboots",
category_territory = "Dungeon",
territory = "Horde",
id = "596",
expansion = "The Burning Crusade",
location = "Mana-Tombs"
},
id597 = {
source = "Helping the Lost Find Their Way",
drop_rate = "quest",
name = "Fleet Refugee's Boots",
category_territory = "",
territory = "Horde",
id = "597",
expansion = "The Burning Crusade",
location = "Terokkar Forest"
},
id598 = {
source = "Pandemonius",
drop_rate = "0.0",
name = "Boots of the Outlander",
category_territory = "Dungeon",
territory = "Horde",
id = "598",
expansion = "The Burning Crusade",
location = "Mana-Tombs"
},
id599 = {
source = "Ethereal Priest",
drop_rate = "0.0",
name = "Boots of the Pathfinder",
category_territory = "Dungeon",
territory = "Horde",
id = "599",
expansion = "The Burning Crusade",
location = "Mana-Tombs"
},
id600 = {
source = "Pandemonius",
drop_rate = "0.0",
name = "Boots of the Outlander",
category_territory = "Dungeon",
territory = "Horde",
id = "600",
expansion = "The Burning Crusade",
location = "Mana-Tombs"
},
id601 = {
source = "Ethereal Crypt Raider",
drop_rate = "0.0",
name = "Fenclaw Footwraps",
category_territory = "Dungeon",
territory = "Horde",
id = "601",
expansion = "The Burning Crusade",
location = "Mana-Tombs"
},
id602 = {
source = "Underbog Shambler",
drop_rate = "0.0",
name = "Boots of Savagery",
category_territory = "Dungeon",
territory = "Horde",
id = "602",
expansion = "The Burning Crusade",
location = "The Underbog"
},
id603 = {
source = "Ethereal Crypt Raider",
drop_rate = "0.0",
name = "Wrathfin Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "603",
expansion = "The Burning Crusade",
location = "Mana-Tombs"
},
id604 = {
source = "The Rock Flayer Matriarch",
drop_rate = "quest",
name = "Boots of the Earthcaller",
category_territory = "",
territory = "Horde",
id = "604",
expansion = "The Burning Crusade",
location = "Hellfire Peninsula"
},
id605 = {
source = "WANTED: Blacktalon the Savage",
drop_rate = "quest",
name = "Venn'ren's Boots",
category_territory = "",
territory = "Horde",
id = "605",
expansion = "The Burning Crusade",
location = "Hellfire Peninsula"
},
id606 = {
source = "Celea",
drop_rate = "Unknown",
name = "Felscale Boots",
category_territory = "",
territory = "Horde",
id = "606",
expansion = "Legion",
location = "Azsuna"
},
id607 = {
source = "Doomsayer Jurim",
drop_rate = "0.0",
name = "Grim Greaves",
category_territory = "",
territory = "Horde",
id = "607",
expansion = "The Burning Crusade",
location = "Terokkar Forest"
},
id608 = {
source = "Shadowmoon Adept",
drop_rate = "0.0",
name = "Nexus-Strider Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "608",
expansion = "The Burning Crusade",
location = "The Blood Furnace"
},
id609 = {
source = "Bonechewer Hungerer",
drop_rate = "0.0",
name = "Netherstalker Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "609",
expansion = "The Burning Crusade",
location = "Hellfire Ramparts"
},
id610 = {
source = "Bonechewer Hungerer",
drop_rate = "0.0",
name = "Felstone Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "610",
expansion = "The Burning Crusade",
location = "Hellfire Ramparts"
},
id611 = {
source = "Bonechewer Hungerer",
drop_rate = "0.0",
name = "Unyielding Footwraps",
category_territory = "Dungeon",
territory = "Horde",
id = "611",
expansion = "The Burning Crusade",
location = "Hellfire Ramparts"
},
id612 = {
source = "Lucifron",
drop_rate = "0.0",
name = "Earthfury Boots",
category_territory = "Raid",
territory = "Horde",
id = "612",
expansion = "",
location = "Molten Core"
},
id613 = {
source = "Gehennas",
drop_rate = "0.0",
name = "Giantstalker's Boots",
category_territory = "Raid",
territory = "Horde",
id = "613",
expansion = "",
location = "Molten Core"
},
id614 = {
source = "Broodlord Lashlayer",
drop_rate = "0.0",
name = "Dragonstalker's Greaves",
category_territory = "Raid",
territory = "Horde",
id = "614",
expansion = "",
location = "Blackwing Lair"
},
id615 = {
source = "Broodlord Lashlayer",
drop_rate = "0.0",
name = "Greaves of Ten Storms",
category_territory = "Raid",
territory = "Horde",
id = "615",
expansion = "",
location = "Blackwing Lair"
},
id616 = {
source = "Golemagg the Incinerator",
drop_rate = "0.0",
name = "Sabatons of the Flamewalker",
category_territory = "Raid",
territory = "Horde",
id = "616",
expansion = "",
location = "Molten Core"
},
id617 = {
source = "The Prophet Skeram",
drop_rate = "0.0",
name = "Boots of the Fallen Prophet",
category_territory = "Raid",
territory = "Horde",
id = "617",
expansion = "",
location = "Temple of Ahn'Qiraj"
},
id618 = {
source = "Krixel Pinchwhistle",
drop_rate = "Unknown",
name = "Replica Marshal's Chain Boots",
category_territory = "",
territory = "Horde",
id = "618",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id619 = {
source = "Krixel Pinchwhistle",
drop_rate = "Unknown",
name = "Replica Marshal's Mail Boots",
category_territory = "",
territory = "Horde",
id = "619",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id620 = {
source = "Leeni ",
drop_rate = "Unknown",
name = "Replica General's Chain Boots",
category_territory = "",
territory = "Horde",
id = "620",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id621 = {
source = "Leeni ",
drop_rate = "Unknown",
name = "Replica General's Mail Boots",
category_territory = "",
territory = "Horde",
id = "621",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id622 = {
source = "Baruma",
drop_rate = "Unknown",
name = "Replica Beastmaster's Boots",
category_territory = "",
territory = "Horde",
id = "622",
expansion = "Cataclysm",
location = "Darkmoon Island"
},
id623 = {
source = "Baruma",
drop_rate = "Unknown",
name = "Replica Boots of The Five Thunders",
category_territory = "",
territory = "Horde",
id = "623",
expansion = "Cataclysm",
location = "Darkmoon Island"
},
id624 = {
source = "Lethon",
drop_rate = "0.0",
name = "Malignant Footguards",
category_territory = "",
territory = "Horde",
id = "624",
expansion = "",
location = "The Hinterlands"
},
id625 = {
source = "Spirestone Warlord",
drop_rate = "0.0",
name = "Wind Dancer Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "625",
expansion = "",
location = "Blackrock Spire"
},
id626 = {
source = "Spirestone Battle Lord",
drop_rate = "0.0",
name = "Swiftdart Battleboots",
category_territory = "Dungeon",
territory = "Horde",
id = "626",
expansion = "",
location = "Blackrock Spire"
},
id627 = {
source = "Samuel Hawke",
drop_rate = "Unknown",
name = "Highlander's Chain Greaves",
category_territory = "",
territory = "Horde",
id = "627",
expansion = "",
location = "Arathi Highlands"
},
id628 = {
source = "Samuel Hawke",
drop_rate = "Unknown",
name = "Highlander's Mail Greaves",
category_territory = "",
territory = "Horde",
id = "628",
expansion = "",
location = "Arathi Highlands"
},
id629 = {
source = "Rutherford Twing",
drop_rate = "Unknown",
name = "Defiler's Chain Greaves",
category_territory = "",
territory = "Horde",
id = "629",
expansion = "",
location = "Arathi Highlands"
},
id630 = {
source = "Rutherford Twing",
drop_rate = "Unknown",
name = "Defiler's Mail Greaves",
category_territory = "",
territory = "Horde",
id = "630",
expansion = "",
location = "Arathi Highlands"
},
id631 = {
source = "General Rajaxx",
drop_rate = "0",
name = "Boots of the Qiraji General",
category_territory = "Raid",
territory = "Horde",
id = "631",
expansion = "",
location = "Ruins of Ahn'Qiraj"
},
id632 = {
source = "Krixel Pinchwhistle",
drop_rate = "Unknown",
name = "Replica Knight-Lieutenant's Chain Boots",
category_territory = "",
territory = "Horde",
id = "632",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id633 = {
source = "Krixel Pinchwhistle",
drop_rate = "Unknown",
name = "Replica Knight-Lieutenant's Mail Greaves",
category_territory = "",
territory = "Horde",
id = "633",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id634 = {
source = "Krixel Pinchwhistle",
drop_rate = "Unknown",
name = "Replica Knight-Lieutenant's Chain Greaves",
category_territory = "",
territory = "Horde",
id = "634",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id635 = {
source = "Leeni ",
drop_rate = "Unknown",
name = "Replica Blood Guard's Chain Boots",
category_territory = "",
territory = "Horde",
id = "635",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id636 = {
source = "Leeni ",
drop_rate = "Unknown",
name = "Replica Blood Guard's Chain Greaves",
category_territory = "",
territory = "Horde",
id = "636",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id637 = {
source = "Leeni ",
drop_rate = "Unknown",
name = "Replica Blood Guard's Mail Walkers",
category_territory = "",
territory = "Horde",
id = "637",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id638 = {
source = "Leeni ",
drop_rate = "Unknown",
name = "Replica Blood Guard's Mail Greaves",
category_territory = "",
territory = "Horde",
id = "638",
expansion = "The Burning Crusade",
location = "Netherstorm"
},
id639 = {
source = "Barum",
drop_rate = "Unknown",
name = "Replica Beaststalker's Boots",
category_territory = "",
territory = "Horde",
id = "639",
expansion = "Cataclysm",
location = "Darkmoon Island"
},
id640 = {
source = "Barum",
drop_rate = "Unknown",
name = "Replica Boots of Elements",
category_territory = "",
territory = "Horde",
id = "640",
expansion = "Cataclysm",
location = "Darkmoon Island"
},
id641 = {
source = "Quartermaster Zigris",
drop_rate = "0.0",
name = "Veteran Spearman's Chain Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "641",
expansion = "",
location = "Blackrock Spire"
},
id642 = {
source = "Blackwing Technician",
drop_rate = "0.0",
name = "Hero's Boots",
category_territory = "Raid",
territory = "Horde",
id = "642",
expansion = "",
location = "Blackwing Lair"
},
id643 = {
source = "Overlord Wyrmthalak",
drop_rate = "0.0",
name = "Mercurial Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "643",
expansion = "",
location = "Blackrock Spire"
},
id644 = {
source = "Overlord Wyrmthalak",
drop_rate = "0.0",
name = "Masterwork Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "644",
expansion = "",
location = "Blackrock Spire"
},
id645 = {
source = "HiveZara Wasp",
drop_rate = "0.0",
name = "Warstrike Sabatons",
category_territory = "Raid",
territory = "Horde",
id = "645",
expansion = "",
location = "Ruins of Ahn'Qiraj"
},
id646 = {
source = "Spitting Scarab",
drop_rate = "0.0",
name = "Impenetrable Sabatons",
category_territory = "Raid",
territory = "Horde",
id = "646",
expansion = "",
location = "Ruins of Ahn'Qiraj"
},
id647 = {
source = "Vekniss Guardian",
drop_rate = "0.0",
name = "Magnificent Greaves",
category_territory = "Raid",
territory = "Horde",
id = "647",
expansion = "",
location = "Temple of Ahn'Qiraj"
},
id648 = {
source = "HiveZara Wasp",
drop_rate = "0.0",
name = "Triumphant Sabatons",
category_territory = "Raid",
territory = "Horde",
id = "648",
expansion = "",
location = "Ruins of Ahn'Qiraj"
},
id649 = {
source = "Burning Felguard",
drop_rate = "0.0",
name = "Ornate Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "649",
expansion = "",
location = "Blackrock Spire"
},
id650 = {
source = "Burning Felguard",
drop_rate = "0.0",
name = "Engraved Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "650",
expansion = "",
location = "Blackrock Spire"
},
id651 = {
source = "Twilight Geolord",
drop_rate = "0.0",
name = "Bloodlust Boots",
category_territory = "",
territory = "Horde",
id = "651",
expansion = "",
location = "Silithus"
},
id652 = {
source = "Avatar of Hakkar",
drop_rate = "Unknown",
name = "Bloodshot Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "652",
expansion = "",
location = "Sunken Temple"
},
id653 = {
source = "Blazing Fireguard",
drop_rate = "0.0",
name = "Ebonhold Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "653",
expansion = "",
location = "Blackrock Depths"
},
id654 = {
source = "Curtail the Darktail",
drop_rate = "quest",
name = "Enohar's Old Hunting Boots",
category_territory = "",
territory = "Horde",
id = "654",
expansion = "",
location = "Blasted Lands"
},
id655 = {
source = "Eliminate the Okrillon",
drop_rate = "quest",
name = "Nethergarde Boots",
category_territory = "",
territory = "Horde",
id = "655",
expansion = "",
location = "Blasted Lands"
},
id656 = {
source = "Ogre Combat",
drop_rate = "quest",
name = "Boots of Intimidation",
category_territory = "",
territory = "Horde",
id = "656",
expansion = "",
location = "Blasted Lands"
},
id657 = {
source = "Pick Your Fate",
drop_rate = "quest",
name = "Boots of Financial Victory",
category_territory = "",
territory = "Horde",
id = "657",
expansion = "",
location = "Blasted Lands"
},
id658 = {
source = "Silicate Feeder",
drop_rate = "0.0",
name = "Merciless Greaves",
category_territory = "Raid",
territory = "Horde",
id = "658",
expansion = "",
location = "Ruins of Ahn'Qiraj"
},
id659 = {
source = "Samuel Hawke",
drop_rate = "Unknown",
name = "Highlander's Chain Greaves",
category_territory = "",
territory = "Horde",
id = "659",
expansion = "",
location = "Arathi Highlands"
},
id660 = {
source = "Samuel Hawke",
drop_rate = "Unknown",
name = "Highlander's Mail Greaves",
category_territory = "",
territory = "Horde",
id = "660",
expansion = "",
location = "Arathi Highlands"
},
id661 = {
source = "Rutherford Twing",
drop_rate = "Unknown",
name = "Defiler's Chain Greaves",
category_territory = "",
territory = "Horde",
id = "661",
expansion = "",
location = "Arathi Highlands"
},
id662 = {
source = "Rutherford Twing",
drop_rate = "Unknown",
name = "Defiler's Mail Greaves",
category_territory = "",
territory = "Horde",
id = "662",
expansion = "",
location = "Arathi Highlands"
},
id663 = {
source = "Dark Keeper Bethek",
drop_rate = "0.0",
name = "Crusader's Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "663",
expansion = "",
location = "Blackrock Depths"
},
id664 = {
source = "A Bird of Legend",
drop_rate = "quest",
name = "Legend Eater Boots",
category_territory = "",
territory = "Horde",
id = "664",
expansion = "",
location = "Winterspring"
},
id665 = {
source = "Houndmaster Grebmar",
drop_rate = "0.0",
name = "Fleetfoot Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "665",
expansion = "",
location = "Blackrock Depths"
},
id666 = {
source = "High Justice Grimstone",
drop_rate = "Unknown",
name = "Savage Gladiator Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "666",
expansion = "",
location = "Blackrock Depths"
},
id667 = {
source = "High Interrogator Gerstahn",
drop_rate = "0.0",
name = "Greaves of Withering Despair",
category_territory = "Dungeon",
territory = "Horde",
id = "667",
expansion = "",
location = "Blackrock Depths"
},
id668 = {
source = "Stone Guardian",
drop_rate = "0.0",
name = "Ironhide Greaves",
category_territory = "",
territory = "Horde",
id = "668",
expansion = "",
location = "Un'Goro Crater"
},
id669 = {
source = "Chop Chop",
drop_rate = "quest",
name = "Treant-Bark Shoes",
category_territory = "",
territory = "Horde",
id = "669",
expansion = "",
location = "Winterspring"
},
id670 = {
source = "Houndmaster Grebmar",
drop_rate = "0.0",
name = "Lord's Boots",
category_territory = "Dungeon",
territory = "Horde",
id = "670",
expansion = "",
location = "Blackrock Depths"
},
id671 = {
source = "Placing the Pawns",
drop_rate = "quest",
name = "Subversive Steps",
category_territory = "",
territory = "Horde",
id = "671",
expansion = "",
location = "Burning Steppes"
},
id672 = {
source = "Placing the Pawns",
drop_rate = "quest",
name = "Subversive Steps",
category_territory = "",
territory = "Horde",
id = "672",
expansion = "",
location = "Burning Steppes"
},
id673 = {
source = "SEVEN! YUP!",
drop_rate = "quest",
name = "Gor'Tesh's Boots",
category_territory = "",
territory = "Horde",
id = "673",
expansion = "",
location = "Burning Steppes"
},
id674 = {
source = "Not Fireflies, Flameflies",
drop_rate = "quest",
name = "Lava Boots",
category_territory = "",
territory = "Horde",
id = "674",
expansion = "",
location = "Burning Steppes"
},
id675 = {
source = "Ragnaros",
drop_rate = "0.0",
name = "Elven Chain Boots",
category_territory = "Raid",
territory = "Horde",
id = "675",
expansion = "",
location = "Molten Core"
},
id676 = {
source = "Sandfury Witch Doctor",
drop_rate = "0.0",
name = "Protector Ankleguards",
category_territory = "Dungeon",
territory = "Horde",
id = "676",
expansion = "",
location = "Zul'Farrak"
},
id677 = {
source = "Nekrum Gutchewer",
drop_rate = "Unknown",
name = "Sezz'ziz's Captive Kickers",
category_territory = "Dungeon",
territory = "Horde",
id = "677",
expansion = "",
location = "Zul'Farrak"
},
id678 = {
source = "Thuzadin Acolyte",
drop_rate = "0.0",
name = "Myrmidon's Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "678",
expansion = "",
location = "Stratholme"
},
id679 = {
source = "Irontree Chopper",
drop_rate = "0.0",
name = "Formidable Sabatons",
category_territory = "",
territory = "Horde",
id = "679",
expansion = "",
location = "Felwood"
},
id680 = {
source = "The Grand Tablet",
drop_rate = "quest",
name = "Translation Boots",
category_territory = "",
territory = "Horde",
id = "680",
expansion = "",
location = "Tanaris"
},
id681 = {
source = "The Grand Tablet",
drop_rate = "quest",
name = "Translation Boots",
category_territory = "",
territory = "Horde",
id = "681",
expansion = "",
location = "Tanaris"
},
id682 = {
source = "Disarming Bears",
drop_rate = "quest",
name = "Timbermaw Boots",
category_territory = "",
territory = "Horde",
id = "682",
expansion = "",
location = "Felwood"
},
id683 = {
source = "Barricade",
drop_rate = "0.0",
name = "Warmonger's Greaves",
category_territory = "",
territory = "Horde",
id = "683",
expansion = "",
location = "Badlands"
},
id684 = {
source = "Timmy the Cruel",
drop_rate = "0.0",
name = "Timmy's Galoshes",
category_territory = "Dungeon",
territory = "Horde",
id = "684",
expansion = "",
location = "Stratholme"
},
id685 = {
source = "Sandfury Blood Drinker",
drop_rate = "0.0",
name = "Gryphon Mail Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "685",
expansion = "",
location = "Zul'Farrak"
},
id686 = {
source = "Just Trying to Kill Some Bugs",
drop_rate = "quest",
name = "Bootscuff Boots",
category_territory = "",
territory = "Horde",
id = "686",
expansion = "",
location = "Tanaris"
},
id687 = {
source = "Hazzard Disposal",
drop_rate = "quest",
name = "Mr. Tauren's Boots",
category_territory = "",
territory = "Horde",
id = "687",
expansion = "",
location = "Felwood"
},
id688 = {
source = "Risen Guardsman",
drop_rate = "0.0",
name = "Champion's Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "688",
expansion = "",
location = "Stratholme"
},
id689 = {
source = "Jaedenar Adept",
drop_rate = "0.0",
name = "Khan's Greaves",
category_territory = "",
territory = "Horde",
id = "689",
expansion = "",
location = "Felwood"
},
id690 = {
source = "Immolthar",
drop_rate = "0.0",
name = "Odious Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "690",
expansion = "",
location = "Dire Maul"
},
id691 = {
source = "Ravaged Cadaver",
drop_rate = "0.0",
name = "Blackforge Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "691",
expansion = "",
location = "Stratholme"
},
id692 = {
source = "Gordok Reaver",
drop_rate = "0.0",
name = "Bonelink Sabatons",
category_territory = "Dungeon",
territory = "Horde",
id = "692",
expansion = "",
location = "Dire Maul"
},
id693 = {
source = "A Strange Request",
drop_rate = "quest",
name = "Boots of Delivery",
category_territory = "",
territory = "Horde",
id = "693",
expansion = "",
location = "Badlands"
},
id694 = {
source = "Culling the Corrupted",
drop_rate = "quest",
name = "Felpaw Boots",
category_territory = "",
territory = "Horde",
id = "694",
expansion = "",
location = "Felwood"
},
id695 = {
source = "The Mark of Quality",
drop_rate = "quest",
name = "Pratt's Handcrafted Greaves",
category_territory = "",
territory = "Horde",
id = "695",
expansion = "",
location = "Feralas"
},
id696 = {
source = "The Mark of Quality",
drop_rate = "quest",
name = "Jangdor's Handcrafted Greaves",
category_territory = "",
territory = "Horde",
id = "696",
expansion = "",
location = "Feralas"
},
id697 = {
source = "Immolthar",
drop_rate = "0.0",
name = "Ancient Greaves",
category_territory = "Dungeon",
territory = "Horde",
id = "697",
expansion = "",
location = "Dire Maul"
},
id698 = {
source = "Samuel Hawke",
drop_rate = "Unknown",
name = "Highlander's Chain Greaves",
category_territory = "",
territory = "Horde",
id = "698",
expansion = "",
location = "Arathi Highlands"
},
id699 = {
source = "Samuel Hawke",
drop_rate = "Unknown",
name = "Highlander's Mail Greaves",
category_territory = "",
territory = "Horde",
id = "699",
expansion = "",
location = "Arathi Highlands"
},
id700 = {
source = "Rutherford Twing",
drop_rate = "Unknown",
name = "Defiler's Chain Greaves",
category_territory = "",
territory = "Horde",
id = "700",
expansion = "",
location = "Arathi Highlands"
},
id701 = {
source = "Rutherford Twing",
drop_rate = "Unknown",
name = "Defiler's Mail Greaves",
category_territory = "",
territory = "Horde",
id = "701",
expansion = "",
location = "Arathi Highlands"
}
}
|
-- There should not be any 2d-distance above 10km in GTAV
-- Distance (in meters) displayed at MaxRings
ND_mTracker_MaxDistance = 3000
-- MaxRings to scale the display
ND_mTracker_MaxRings = 6
-- Key to Close the App, currently: ESC
ND_mTracker_StoppingKey = 322
-- ScalingTypes
-- "SQRT": Scale distance with Square Root
-- "LOG": Scale distance logarithmically
-- "LIN": Scale distance linearily
ND_mTracker_ScalingType = "SQRT"
|
-- just a stub to aid loading
function init()
-- set all outputs positive for chunkloading purposes
for i=1, object.outputNodeCount() do object.setOutputNodeLevel(i-1, true) end
end
|
object_tangible_item_pvp_spec_ops_imperial_dye_kit = object_tangible_item_shared_pvp_spec_ops_imperial_dye_kit:new {
}
ObjectTemplates:addTemplate(object_tangible_item_pvp_spec_ops_imperial_dye_kit, "object/tangible/item/pvp_spec_ops_imperial_dye_kit.iff")
|
--White
minetest.register_craftitem("cupcakes:white_cupcake", {
description = "White Cupcake",
inventory_image = "cupcake_texture.png^[colorize:white:200^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:white_cupcake",
recipe = {
{"dye:white"},
{"farming:bread"},
{"default:paper"}
}
})
--Pink
minetest.register_craftitem("cupcakes:pink_cupcake", {
description = "Pink Cupcake",
inventory_image = "cupcake_texture.png^[colorize:pink:200^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:pink_cupcake",
recipe = {
{"dye:pink"},
{"farming:bread"},
{"default:paper"}
}
})
--Blue
minetest.register_craftitem("cupcakes:blue_cupcake", {
description = "Blue Cupcake",
inventory_image = "cupcake_texture.png^[colorize:blue:200^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:blue_cupcake",
recipe = {
{"dye:blue"},
{"farming:bread"},
{"default:paper"}
}
})
--Red
minetest.register_craftitem("cupcakes:red_cupcake", {
description = "Red Cupcake",
inventory_image = "cupcake_texture.png^[colorize:red:200^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:red_cupcake",
recipe = {
{"dye:red"},
{"farming:bread"},
{"default:paper"}
}
})
--Violet
minetest.register_craftitem("cupcakes:violet_cupcake", {
description = "Violet Cupcake",
inventory_image = "cupcake_texture.png^[colorize:purple:200^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:violet_cupcake",
recipe = {
{"dye:violet"},
{"farming:bread"},
{"default:paper"}
}
})
--Cyan
minetest.register_craftitem("cupcakes:cyan_cupcake", {
description = "Cyan Cupcake",
inventory_image = "cupcake_texture.png^[colorize:cyan:200^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:cyan_cupcake",
recipe = {
{"dye:cyan"},
{"farming:bread"},
{"default:paper"}
}
})
--Grey
minetest.register_craftitem("cupcakes:grey_cupcake", {
description = "Grey Cupcake",
inventory_image = "cupcake_texture.png^[colorize:grey:200^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:grey_cupcake",
recipe = {
{"dye:grey"},
{"farming:bread"},
{"default:paper"}
}
})
--Black
minetest.register_craftitem("cupcakes:black_cupcake", {
description = "Black Cupcake",
inventory_image = "cupcake_texture.png^[colorize:black:200^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:black_cupcake",
recipe = {
{"dye:black"},
{"farming:bread"},
{"default:paper"}
}
})
--Brown
minetest.register_craftitem("cupcakes:brown_cupcake", {
description = "Brown Cupcake",
inventory_image = "cupcake_texture.png^[colorize:orange:100^[colorize:black:100^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:brown_cupcake",
recipe = {
{"dye:brown"},
{"farming:bread"},
{"default:paper"}
}
})
--Green
minetest.register_craftitem("cupcakes:green_cupcake", {
description = "Green Cupcake",
inventory_image = "cupcake_texture.png^[colorize:green:200^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:green_cupcake",
recipe = {
{"dye:green"},
{"farming:bread"},
{"default:paper"}
}
})
--Orange
minetest.register_craftitem("cupcakes:orange_cupcake", {
description = "Orange Cupcake",
inventory_image = "cupcake_texture.png^[colorize:orange:200^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:orange_cupcake",
recipe = {
{"dye:orange"},
{"farming:bread"},
{"default:paper"}
}
})
--Yellow
minetest.register_craftitem("cupcakes:yellow_cupcake", {
description = "Yellow Cupcake",
inventory_image = "cupcake_texture.png^[colorize:yellow:200^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:yellow_cupcake",
recipe = {
{"dye:yellow"},
{"farming:bread"},
{"default:paper"}
}
})
--Magenta
minetest.register_craftitem("cupcakes:magenta_cupcake", {
description = "Magenta Cupcake",
inventory_image = "cupcake_texture.png^[colorize:magenta:200^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:magenta_cupcake",
recipe = {
{"dye:magenta"},
{"farming:bread"},
{"default:paper"}
}
})
--Dark grey
minetest.register_craftitem("cupcakes:dark_grey_cupcake", {
description = "Dark Grey Cupcake",
inventory_image = "cupcake_texture.png^[colorize:black:100^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:dark_grey_cupcake",
recipe = {
{"dye:dark_grey"},
{"farming:bread"},
{"default:paper"}
}
})
--Dark green
minetest.register_craftitem("cupcakes:dark_green_cupcake", {
description = "Dark Green Cupcake",
inventory_image = "cupcake_texture.png^[colorize:green:100^[colorize:black:100^cupcake_paper_texture.png",
on_use = minetest.item_eat(8),
})
minetest.register_craft({
output = "cupcakes:dark_green_cupcake",
recipe = {
{"dye:dark_green"},
{"farming:bread"},
{"default:paper"}
}
})
|
---------------------------------------------------
-- Licensed under the GNU General Public License v2
-- * (c) 2010, Adrian C. <anrxc@sysphere.org>
---------------------------------------------------
-- {{{ Grab environment
local tonumber = tonumber
local io = { popen = io.popen }
local setmetatable = setmetatable
local string = { match = string.match }
-- }}}
-- Ossvol: provides volume levels of requested OSS mixers
module("vicious.contrib.ossvol")
-- {{{ Volume widget type
local function worker(format, warg)
if not warg then return end
local mixer_state = {
["on"] = "♫", -- "",
["off"] = "♩" -- "M"
}
-- Get mixer control contents
local f = io.popen("ossmix -c")
local mixer = f:read("*all")
f:close()
-- Capture mixer control state
local volu = tonumber(string.match(mixer, warg .. "[%s]([%d%.]+)"))/0.25
local mute = string.match(mixer, "vol%.mute[%s]([%a]+)")
-- Handle mixers without data
if volu == nil then
return {0, mixer_state["off"]}
end
-- Handle mixers without mute
if mute == "OFF" and volu == "0"
-- Handle mixers that are muted
or mute == "ON" then
mute = mixer_state["off"]
else
mute = mixer_state["on"]
end
return {volu, mute}
end
-- }}}
setmetatable(_M, { __call = function(_, ...) return worker(...) end })
|
--[[
Runs the specified action when mpv shutsdown using the nircmd command line tool for windows
available at: https://github.com/CogentRedTester/mpv-scripts
By default the command will only be sent if mpv finishes playing the current file before shutting down,
this means quitting the player manually will not trigger the action, unless the `always_run_on_shutdown`
option is set to yes.
This means that you need to set keep-open and loop to `no` for the script to do anything.
Commands are set with script messages:
script-message after-playback [command] {flag}
Valid commands are:
nothing - do nothing, the default, and is used to disable prior commands
lock - locks the computer so that it needs a password to reopen
sleep - puts the computer to sleep
logoff - logs the current user off
hibernate - activates hibernate mode
displayoff - turns off the displays (computer is still running like normal)
shutdown - shuts down computer after 60 seconds
reboot - reboots the computer after 60 seconds
Valid flags are:
osd - displays osd message (when setting the command, not when it is executed) (default)
no_osd - does not display osd message (when setting the command, not when it is executed)
There is time to disable the shutdown and reboot commands by sending a command to nircmd directly through cmd/powershell.
This must be sent within 60 seconds of the commands being sent. The command is "nircmd abortshutdown"
The default command can be set with script-opts:
script-opts=afterplayback-default=[command]
See the options table for more options
]]--
msg = require 'mp.msg'
utils = require 'mp.utils'
opt = require 'mp.options'
--OPTIONS--
local o = {
--default action
default = "nothing",
--runs the action every time the player shuts down
--normally actions are only run when playback ends naturally
always_run_on_shutdown = false,
--set whether to output status messages to the OSD
osd_output = true
}
local commands = {}
local current_action = "nothing"
local active = false
function osd_message(message)
if o.osd_output then
mp.osd_message(message, 2)
end
end
--sets the list of commands to send to nircmd
function set_action(action, flag)
msg.debug('flag = "' .. tostring(flag) .. '"')
--disables or enables the osd for the duration of the function if the flags are set
local osd = o.osd_output
if flag == 'osd' then
o.osd_output = true
elseif flag == 'no_osd' then
o.osd_output = false
end
if active or action ~= "nothing" then
msg.info('after playback: ' .. action)
osd_message('after playback: ' .. action)
end
commands = {'nircmd'}
active = true
if action == 'sleep' then
commands[2] = "standby"
elseif action == "logoff" then
commands[2] = "exitwin"
commands[3] = "logoff"
elseif action == "hibernate" then
commands[2] = "hibernate"
elseif action == "shutdown" then
commands[2] = "initshutdown"
commands[3] = "60 seconds before system shuts down"
commands[4] = "60"
elseif action == "reboot" then
commands[2] = "initshutdown"
commands[3] = "60 seconds before system reboots"
commands[4] = "60"
commands[5] = "reboot"
elseif action == "lock" then
commands[2] = "lockws"
elseif action == "displayoff" then
commands[2] = "monitor"
commands[3] = "off"
elseif action == "nothing" then
active = false
else
msg.warn('unknown action "' .. action .. '"')
osd_message('after-playback: unknown action')
action = current_action
end
o.osd_output = osd
current_action = action
end
--runs the saved action if the script is activated
function run_action()
if active == false then return end
msg.info('executing command "' .. current_action .. '"')
mp.command_native({
name = 'subprocess',
playback_only = false,
args = commands
})
end
--runs when the file is closed.
--runs the command if the reason for the close was eof.
--this is necessary because the eof property is set to nil immediately,
--so it can't return true for the above function. We don't want to run
--the action when the user quits themselves, so we need an extra check
local reason = ""
function recordEOF(event)
if not active then return end;
msg.debug('saving reason for end-file: "' .. event.reason .. '"')
reason = event.reason
end
--runs the saved action if the file was closed naturally
function shutdown()
if not active then return end;
msg.debug('shutting down mpv, testing for shutdown reason')
if reason == "eof" or o.always_run_on_shutdown
then
msg.debug('shutdown caused by eof, running action')
run_action()
end
end
--sets the default option on mpv player launch
opt.read_options(o, 'afterplayback')
set_action(o.default)
msg.verbose('default action after playback is "' .. current_action .. '"')
mp.register_event('end-file', recordEOF)
mp.register_event('shutdown', shutdown)
mp.register_script_message('after-playback', set_action)
|
--json_test.lua
local ljson = require("lcjson")
local lcrypt = require("lcrypt")
local json_encode = ljson.encode
local json_decode = ljson.decode
local new_guid = lcrypt.guid_new
local test = {
tid = 3.1415926,
player_id = new_guid()
}
print(test.tid)
print(test.player_id)
local a = json_encode(test)
print(a)
local b = json_decode(a)
print(type(b.tid), b.tid)
print(type(b.player_id), b.player_id)
os.exit()
|
-- @Author: csxiaoyaojianxian
-- @Date: 2018-02-01 09:54:56
-- @Last Modified by: csxiaoyaojianxian
-- @Last Modified time: 2018-02-01 11:35:52
mt = {}
function mt:New( ... )
local o = { name = "Pandora" };
setmetatable(o, self);
self.__index = self;
print(self);
return o;
end
function mt:Foo( ... )
print(self.name .. " Hello World");
end
local obj = mt:New();
obj:Foo();
|
-- Generated By protoc-gen-lua Do not Edit
local protobuf = require "protobuf"
module('BceSellProp_pb', package.seeall)
local BCESELLPROP = protobuf.Descriptor();
local BCESELLPROP_PROPPEW_FIELD = protobuf.FieldDescriptor();
local BCESELLPROP_COUNT_FIELD = protobuf.FieldDescriptor();
BCESELLPROP_PROPPEW_FIELD.name = "propPew"
BCESELLPROP_PROPPEW_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.BceSellProp.propPew"
BCESELLPROP_PROPPEW_FIELD.number = 1
BCESELLPROP_PROPPEW_FIELD.index = 0
BCESELLPROP_PROPPEW_FIELD.label = 2
BCESELLPROP_PROPPEW_FIELD.has_default_value = false
BCESELLPROP_PROPPEW_FIELD.default_value = 0
BCESELLPROP_PROPPEW_FIELD.type = 5
BCESELLPROP_PROPPEW_FIELD.cpp_type = 1
BCESELLPROP_COUNT_FIELD.name = "count"
BCESELLPROP_COUNT_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.BceSellProp.count"
BCESELLPROP_COUNT_FIELD.number = 2
BCESELLPROP_COUNT_FIELD.index = 1
BCESELLPROP_COUNT_FIELD.label = 1
BCESELLPROP_COUNT_FIELD.has_default_value = true
BCESELLPROP_COUNT_FIELD.default_value = 1
BCESELLPROP_COUNT_FIELD.type = 5
BCESELLPROP_COUNT_FIELD.cpp_type = 1
BCESELLPROP.name = "BceSellProp"
BCESELLPROP.full_name = ".com.xinqihd.sns.gameserver.proto.BceSellProp"
BCESELLPROP.nested_types = {}
BCESELLPROP.enum_types = {}
BCESELLPROP.fields = {BCESELLPROP_PROPPEW_FIELD, BCESELLPROP_COUNT_FIELD}
BCESELLPROP.is_extendable = false
BCESELLPROP.extensions = {}
BceSellProp = protobuf.Message(BCESELLPROP)
_G.BCESELLPROP_PB_BCESELLPROP = BCESELLPROP
|
-- @.getSortedKeys.lua
--
@.getSortedKeys = function(collection, desc)
local sortedKeys = {}
for k, v in pairs(collection) do
table.insert(sortedKeys, k)
end
if desc then
table.sort(sortedKeys, _.gt)
else
table.sort(sortedKeys, _.lt)
end
return sortedKeys
end
|
function onUpdate(elapsed)
songPos = getSongPosition()
local currentBeat = (songPos/5000)*(curBpm/60)
local currentBeat2 = (songPos/500)*(curBpm/60)
setCharacterY('dad',getCharacterY('dad') + (math.sin(currentBeat) * 0.9))
end
|
function lib.any(t) return t[math.random(#t)] end
function lib.bsearch(t,x, lo,hi, mid)
lo,hi = lo or 1,hi or #t
while lo <= hi do
io.write(".")
mid = (lo + hi)//2
if t[mid] >= x then hi= mid - 1 else lo= mid + 1 end end
return lo>#t and #t or lo end
function lib.firsts(a,b) return a[1] < b[1] end
fmt = string.format
function lib.many(t,n, u) u={};for j=1,n do t[1+#t]=lib.any(t) end; return u end
function lib.map(t,f, p,u)
f,u = f or lib.same, {}
p = debug.getinfo(f).nparams -- only available in LUA 5.2+
f= function(k,v) if p==2 then return f(k,v) else return f(v) end end
for k,v in pairs(t) do lib.push(u, f(k,v)) end; return u end
function lib.new(k,t) k.__index=k; return setmetatable(t,k) end
function lib.o(t, u)
if type(t)~="table" then return tostring(t) end
local key=function(k) return string.format(":%s %s",k,lib.o(t[k])) end
u = #t>0 and map(t,lib.o) or lib.map(lib.sort(lib.slots(t)),key)
return '{'..table.concat(u," ").."}" end
function lib.push(t,x) table.insert(t,x); return x end
function lib.rows(file, x)
file = io.input(file)
return function()
x=io.read(); if x then return lib.things(x) else io.close(file) end end end
function lib.same(x) return x end
function lib.seconds(a,b) return a[2] < b[2] end
function slots(t, u)
u={}
for k,_ in pairs(t) do k=tostring(k); if k:sub(1,1)~="_" then u[1+#u]=k end end
return u end
function lib.sort(t,f) table.sort(t,f); return t end
function lib.thing(x)
x = x:match"^%s*(.-)%s*$"
if x=="true" then return true elseif x=="false" then return false end
return tonumber(x) or x end
function lib.things(x,sep, t)
t={}
for y in x:gmatch(sep or"([^,]+)") do lib.push(lib.thing(y)) end
return t end
return lib
|
return {'pik','pikant','pikanterie','pikantig','pikbroek','pikdonker','pikdraad','pikeren','piket','piketdienst','pikethamer','piketpaal','piketspel','piketten','piketteren','pikeur','pikhaak','pikhamer','pikhouweel','pikkedonker','pikkel','pikkelen','pikken','pikker','pikkerig','pikketanis','pikkig','pikol','pikorde','pikslee','pikton','piktoorts','pikzwart','pikolet','pikaar','pikkemaat','pikante','pikanter','pikantere','pikanterieen','pikantst','pikantste','pikbroeken','pikdonkere','pikeer','pikeerde','pikeert','piketdiensten','piketpalen','pikette','pikeurs','pikhaken','pikhamers','pikhouwelen','pikkedonkere','pikkelde','pikkels','pikkelt','pikkeltje','pikkeltjes','pikkers','pikols','pikordes','pikt','pikte','pikten','piktonnen','pikzwarte','pikantige','pikants','piketpaaltje','piketpaaltjes','piketspellen','piketteerde','pikkerige','pikketanissen','pikolets'}
|
sptbl["autowah"] = {
files = {
module = "autowah.c",
header = "autowah.h",
example = "ex_autowah.c",
},
func = {
create = "sp_autowah_create",
destroy = "sp_autowah_destroy",
init = "sp_autowah_init",
compute = "sp_autowah_compute",
},
params = {
optional = {
{
name = "level",
type = "SPFLOAT*",
description = "Overall level (between 0 and 1)",
default = 0.1
},
{
name = "wah",
type = "SPFLOAT*",
description ="wah amount",
default = 0
},
{
name = "mix",
type = "SPFLOAT*",
description ="Wet/dry amount (100 = wet, 0 = dry)",
default = 100
},
}
},
modtype = "module",
description = [[Automatic wah pedal
An automatic wah effect, ported from Guitarix via Faust.
]],
ninputs = 1,
noutputs = 1,
inputs = {
{
name = "input",
description = "Audio input"
},
},
outputs = {
{
name = "output",
description = "Audio output."
},
}
}
|
--
-- Basic recursive equality checker.
--
local function deepEquals(a, b)
local typeA = type(a)
local typeB = type(b)
if typeA ~= typeB then
return false
end
if typeA ~= 'table' then
return a == b
end
local meta = getmetatable(a)
if meta and meta.__eq then
return a == b
end
for k, v in pairs(a) do
local other = b[k]
if other == nil or not deepEquals(v, other) then
return false
end
end
for k, v in pairs(b) do
local other = a[k]
if other == nil or not deepEquals(v, other) then
return false
end
end
return true
end
return deepEquals
|
local path = technic.modpath.."/machines/other"
-- mesecons and tubes related
dofile(path.."/injector.lua")
dofile(path.."/constructor.lua")
if minetest.get_modpath("mesecons_mvps") ~= nil then
dofile(path.."/frames.lua")
end
dofile(path.."/anchor.lua")
|
--[[
CHANGE LIST:
09.01.2015 - Standizard the variables, remove unnecessary funcion
]]
--[[
Author: kritth
Date: 5.1.2015.
Register the target and order to attack
]]
function focusfire_register( keys )
-- Variables
local caster = keys.caster
local ability = keys.ability
local modifierAttackSpeed = "modifier_focusfire_attackspeed_buff_datadriven"
local modifierDamageDebuff = "modifier_focusfire_damage_debuff_datadriven"
-- Set target
caster.focusfire_target = keys.target
-- Apply buff
ability:ApplyDataDrivenModifier( caster, caster, modifierAttackSpeed, {} )
ability:ApplyDataDrivenModifier( caster, caster, modifierDamageDebuff, {} )
-- Order to attack immediately
local order =
{
UnitIndex = caster:entindex(),
OrderType = DOTA_UNIT_ORDER_ATTACK_TARGET,
TargetIndex = keys.target:entindex()
}
ExecuteOrderFromTable( order )
end
--[[
Author: kritth
Date: 5.1.2015.
Add/Remove damage debuff modifier when attack start
]]
function focusfire_on_attack_landed( keys )
-- Variables
local caster = keys.caster
local target = keys.target
local ability = keys.ability
local modifierToRemove = "modifier_focusfire_attackspeed_buff_datadriven"
-- Check if it hit the specified target
if target ~= caster.focusfire_target then
caster:RemoveModifierByName( modifierToRemove )
else
ability:ApplyDataDrivenModifier( caster, caster, modifierToRemove, {} )
end
end
|
local sceneManager = require 'src/common/sceneManager'
local assets = require 'src/common/assets'
local dictionary = require 'src/common/dictionary'
local globals = require 'src/common/globals'
local colors = require 'src/common/colors'
local buttonManager = (require 'src/components/buttonManager').new()
local settings = {};
local music
local GRID_X = 400
local GRID_Y = 200
local DELTA_Y = 75
local function toggleFullScreen()
love.window.setFullscreen(not love.window.getFullscreen())
end
local function goToChooseLanguage()
sceneManager.changeScene(require 'src/scenes/chooseLanguage', true)
end
local function goBack()
sceneManager.changeScene(require 'src/menu/mainMenu')
end
function settings.load()
buttonManager:load()
buttonManager:newArrowButton({
fn = goBack,
x = 25,
y = 25,
direction = 'left',
onHeader = true,
})
buttonManager:newTextButton({
text = dictionary.localize('ToggleFullscreen'),
fn = toggleFullScreen,
x = GRID_X,
y = GRID_Y,
})
buttonManager:newTextButton({
text = dictionary.localize('ChooseLanguage'),
fn = goToChooseLanguage,
x = GRID_X,
y = GRID_Y + DELTA_Y,
})
music = assets.menuMusic
music:play()
end
function settings.unload()
buttonManager:unload()
music:pause()
end
function settings.update(dt)
buttonManager:update(dt)
end
function settings.draw()
-- header
love.graphics.setColor(colors.lightgray)
love.graphics.rectangle(
'fill',
0,
0,
globals.baseScreenWidth,
globals.headerHeight
)
local textFont = assets.squareFont
love.graphics.setFont(textFont)
love.graphics.setColor(colors.black)
local titleText = dictionary.localize('Settings')
local textWidth = textFont:getWidth(titleText)
local textHeight = textFont:getHeight(titleText)
love.graphics.print(titleText, globals.baseScreenWidth / 2 - textWidth / 2, 50 - textHeight / 2)
buttonManager:draw()
end
function settings.mousereleased(_, _, button)
buttonManager:mouseReleased(button)
end
return settings;
|
--[[ Code to be repeated to create a staircase mine
Series of turtle commands:
- Dig Up
- Move Up
- Dig Up
- Move down
- dig down
- move down
- dig Forward
- move forward ]]
print("how deep?")
nDeep=tonumber(io.read())
print("What slot is the fill material in?")
nSlot=tonumber(io.read())
function clear(direction)
cont=true
if direction == nil or direction == 'forward' then
-- Loop to interate until space in front of turtle is clear
while cont do
if turtle.detect() then
turtle.dig()
else
cont=false
end
end
elseif direction == 'up' then
-- Loop to interate until space in above turtle is clear
while cont do
if turtle.detectUp() then
turtle.digUp()
else
cont=false
end
end
elseif direction == 'down' then
-- Loop to interate until space in below turtle is clear
while cont do
if turtle.detectDown() then
turtle.digDown()
else
cont=false
end
end
else
error('function clear called incorrectly')
end
end
function fillDown(slot)
if not turtle.detectDown() then
turtle.select(slot)
turtle.placeDown()
end
end
for i=1,nDeep do
clear('up')
turtle.up()
clear('up')
turtle.down()
turtle.digDown()
turtle.down()
fillDown(nSlot)
clear('forward')
turtle.forward()
end
|
trone_thanamiroc = Creature:new {
objectName = "",
socialGroup = "",
faction = "",
level = 23,
chanceHit = 0.35,
damageMin = 210,
damageMax = 220,
baseXp = 2219,
baseHAM = 5900,
baseHAMmax = 7200,
armor = 0,
resists = {0,20,0,-1,-1,50,50,-1,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0,
ferocity = 0,
pvpBitmask = ATTACKABLE,
creatureBitmask = KILLER,
optionsBitmask = AIENABLED,
diet = HERBIVORE,
templates = {
"object/mobile/dressed_criminal_assassin_human_male_01.iff",
"object/mobile/tusken_raider.iff",
"object/mobile/dressed_quest_farmer.iff",
"object/mobile/dressed_commoner_tatooine_nikto_male_01.iff",
"object/mobile/dressed_criminal_pirate_human_male_01.iff",
"object/mobile/dressed_criminal_slicer_human_male_01.iff",
"object/mobile/dressed_diplomat_human_male_01.iff",
"object/mobile/dressed_diplomat_human_male_02.iff",
"object/mobile/dressed_diplomat_human_male_03.iff",
},
lootGroups = {
{
groups = {
{group = "task_loot_bren_kingal_atst_pilots_helmet", chance = 10000000}
},
lootChance = 10000000
}
},
weapons = {"pirate_weapons_heavy"},
conversationTemplate = "",
attacks = merge(marksmanmaster,brawlermaster)
}
CreatureTemplates:addCreatureTemplate(trone_thanamiroc, "trone_thanamiroc")
|
-- Resolve entitty name to key
local function find_shorter(n, k, cb)
local test = function(p)
return string.find(wh.tob64(p.k), k) == 1
end
local match
if test(n.kad.root) then
match = n.kad.root
end
for _, bucket in ipairs(n.kad.buckets) do
for _, p in ipairs(bucket) do
if test(p) then
if match then
-- there's an possible ambiguity. fails
return cb(nil)
else
match = p
end
end
end
end
if match then
return cb(match.k)
else
return cb(nil)
end
end
local function find_b64_wh(n, k, cb)
local ok, k = pcall(wh.fromb64, k, 'wh')
if ok then
if #k ~= 32 then k = nil end
else
k = nil
end
return cb(k)
end
local function find_b64_wg(n, k, cb)
local ok, k = pcall(wh.fromb64, k, 'wg')
if ok then
if #k ~= 32 then k = nil end
else
k = nil
end
return cb(k)
end
local function find_local_hostname(n, h, cb)
if n.kad.root.hostname == h then
return cb(n.kad.root.k)
end
for _, bucket in ipairs(n.kad.buckets) do
for _, p in ipairs(bucket) do
if not p.alias and p.hostname == h and p.k then
return cb(p.k)
end
end
end
return cb()
end
local function find_prefix(n, k, cb)
if #k >= 43 then
return cb()
end
local k2 = k .. string.rep("A", 43-#k)
return find_b64_wh(n, k2, cb)
end
return function(n, hostname, result_cb, prefix)
if hostname == nil then
return nil
end
local cbs = {
find_shorter,
find_b64_wh,
find_b64_wg,
find_local_hostname,
}
if prefix then
cbs[#cbs+1] = find_prefix
end
if n.ns then
for _, ns in ipairs(n.ns) do
cbs[#cbs+1] = ns
end
end
local i = nil
local cont_cb
function cont_cb()
local cb
i, cb = next(cbs, i)
if i and cb then
return cb(n, hostname, function(k)
if k then
return result_cb(k)
else
return cont_cb()
end
end)
else
return result_cb(nil)
end
end
return cont_cb()
end
|
-- Prepares an RGB image in [0,1] for VGG
function getPreprocessConv()
local mean_pixel = torch.Tensor({103.939, 116.779, 123.68})
local conv = nn.SpatialConvolution(3,3, 1,1)
conv.weight:zero()
conv.weight[{1,3}] = 255
conv.weight[{2,2}] = 255
conv.weight[{3,1}] = 255
conv.bias = -mean_pixel
conv.gradBias = nil
conv.gradWeight = nil
conv.parameters = function() --[[nop]] end
conv.accGradParameters = function() --[[nop]] end
return conv
end
function getTVDenoisingConv(strength)
local conv = nn.SpatialConvolution(3,3, 3,3, 1,1, 1,1):noBias()
conv.weight:zero()
for i=1,3 do
conv.weight[{i,i}] = torch.Tensor{
{0, strength, 0},
{strength, 1 - 4*strength, strength},
{0, strength, 0}
}
end
return conv
end
function getIdentityConv()
local conv = nn.SpatialConvolution(3,3, 3,3, 1,1, 1,1)
conv.weight:zero()
conv.bias:zero()
for i=1,3 do
conv.weight[{i,i,2,2}] = 1
end
return conv
end
-- simple interpolation.
function interpolate(vec_a, vec_b, weight_a)
assert(weight_a >= 0 and weight_a <= 1, 'interp coefficient must be in [0,1]')
local vec_interp = vec_a:clone()
vec_interp:mul(weight_a):add(torch.mul(vec_b, 1-weight_a))
return vec_interp
end
function augmentWithInterpolations(inputs)
assert(inputs:nDimension()==4)
assert(inputs:size(1)>1)
local numSamples = inputs:size(1)
local batch_size = numSamples
for b=1,numSamples-1 do
batch_size = batch_size + b
end
local C,H,W = inputs:size(2), inputs:size(3), inputs:size(4)
local augmented_inputs = inputs.new():resize(batch_size,C,H,W)
augmented_inputs[{{1,numSamples}}] = inputs
local next_idx = numSamples+1
for i=1,numSamples do
for j=i+1,numSamples do
local interp = interpolate(inputs[i], inputs[j], 0.5)
augmented_inputs[next_idx] = interp
next_idx = next_idx + 1
end
end
return augmented_inputs
end
|
local _;
local huge = math.huge;
local format = format;
local sIsFade;
local sIsWarnColor;
local sIsSwiftmend;
local sHotSetup;
local sBuffs2Hots = { };
local sHotCols;
local sHotSlots;
local sBarColors;
local sIsHotShowIcon;
local sHotSlotCfgs;
local sIsChargesIcon;
local sClipL, sClipR, sClipT, sClipB = 0, 1, 0, 1;
local sIsPlayerKnowsSwiftmend = false;
local sSwiftmendUnits = { };
VUHDO_MY_HOTS = { };
local VUHDO_MY_HOTS = VUHDO_MY_HOTS;
VUHDO_OTHER_HOTS = { };
local VUHDO_OTHER_HOTS = VUHDO_OTHER_HOTS;
VUHDO_MY_AND_OTHERS_HOTS = { };
local VUHDO_MY_AND_OTHERS_HOTS = VUHDO_MY_AND_OTHERS_HOTS;
local VUHDO_ACTIVE_HOTS = { };
local VUHDO_ACTIVE_HOTS_OTHERS = { };
local sOthersHotsInfo = { };
local VUHDO_CHARGE_TEXTURES = {
"Interface\\AddOns\\VuhDo\\Images\\hot_stacks1", "Interface\\AddOns\\VuhDo\\Images\\hot_stacks2",
"Interface\\AddOns\\VuhDo\\Images\\hot_stacks3", "Interface\\AddOns\\VuhDo\\Images\\hot_stacks4" };
local VUHDO_SHIELD_TEXTURES = {
"Interface\\AddOns\\VuhDo\\Images\\shield_stacks1", "Interface\\AddOns\\VuhDo\\Images\\shield_stacks2",
"Interface\\AddOns\\VuhDo\\Images\\shield_stacks3", "Interface\\AddOns\\VuhDo\\Images\\shield_stacks4" };
local VUHDO_CHARGE_COLORS = { "HOT_CHARGE_1", "HOT_CHARGE_2", "HOT_CHARGE_3", "HOT_CHARGE_4" };
local VUHDO_HOT_CFGS = { "HOT1", "HOT2", "HOT3", "HOT4", "HOT5", "HOT6", "HOT7", "HOT8", "HOT9", "HOT10", };
local VUHDO_CACHE_SPELL_ONLY_BY_ID = {
[VUHDO_SPELL_ID.SOOTHING_MIST] = true,
[VUHDO_SPELL_ID.RIPTIDE] = true,
[VUHDO_SPELL_ID.CENARION_WARD] = true,
};
-- BURST CACHE -------------------------------------------------
local floor = floor;
local table = table;
local UnitBuff = UnitBuff;
local GetSpellCooldown = GetSpellCooldown;
local GetTime = GetTime;
local strfind = strfind;
local pairs = pairs;
local twipe = table.wipe;
local tostring = tostring;
local _G = _G;
local VUHDO_getHealthBar;
local VUHDO_getBarRoleIcon;
local VUHDO_updateAllClusterIcons;
local VUHDO_shouldScanUnit;
local VUHDO_getShieldLeftCount;
local VUHDO_resolveVehicleUnit;
local VUHDO_isPanelVisible;
local VUHDO_getHealButton;
local VUHDO_getUnitButtons;
local VUHDO_getBarIcon;
local VUHDO_getBarIconTimer;
local VUHDO_getBarIconCounter;
local VUHDO_getBarIconCharge;
local VUHDO_getBarIconClockOrStub;
local VUHDO_backColor;
local VUHDO_textColor;
local VUHDO_UIFrameFlash;
local VUHDO_UIFrameFlashStop;
local VUHDO_PANEL_SETUP;
local VUHDO_CAST_ICON_DIFF;
local VUHDO_HEALING_HOTS;
local VUHDO_RAID;
local sIsClusterIcons;
local sIsOthersHots;
function VUHDO_customHotsInitLocalOverrides()
-- variables
VUHDO_PANEL_SETUP = _G["VUHDO_PANEL_SETUP"];
VUHDO_CAST_ICON_DIFF = _G["VUHDO_CAST_ICON_DIFF"];
VUHDO_HEALING_HOTS = _G["VUHDO_HEALING_HOTS"];
VUHDO_RAID = _G["VUHDO_RAID"];
VUHDO_ACTIVE_HOTS = _G["VUHDO_ACTIVE_HOTS"];
VUHDO_ACTIVE_HOTS_OTHERS = _G["VUHDO_ACTIVE_HOTS_OTHERS"];
-- functions
VUHDO_getUnitButtons = _G["VUHDO_getUnitButtons"];
VUHDO_getHealthBar = _G["VUHDO_getHealthBar"];
VUHDO_getBarRoleIcon = _G["VUHDO_getBarRoleIcon"];
VUHDO_updateAllClusterIcons = _G["VUHDO_updateAllClusterIcons"];
VUHDO_shouldScanUnit = _G["VUHDO_shouldScanUnit"];
VUHDO_getShieldLeftCount = _G["VUHDO_getShieldLeftCount"];
VUHDO_resolveVehicleUnit = _G["VUHDO_resolveVehicleUnit"];
VUHDO_isPanelVisible = _G["VUHDO_isPanelVisible"];
VUHDO_getHealButton = _G["VUHDO_getHealButton"];
VUHDO_getBarIcon = _G["VUHDO_getBarIcon"];
VUHDO_getBarIconTimer = _G["VUHDO_getBarIconTimer"];
VUHDO_getBarIconCounter = _G["VUHDO_getBarIconCounter"];
VUHDO_getBarIconCharge = _G["VUHDO_getBarIconCharge"];
VUHDO_getBarIconClockOrStub = _G["VUHDO_getBarIconClockOrStub"];
VUHDO_backColor = _G["VUHDO_backColor"];
VUHDO_textColor = _G["VUHDO_textColor"];
sBarColors = VUHDO_PANEL_SETUP["BAR_COLORS"];
sHotCols = sBarColors["HOTS"];
sIsFade = sHotCols["isFadeOut"];
VUHDO_UIFrameFlash = sHotCols["isFlashWhenLow"] and _G["VUHDO_UIFrameFlash"] or function() end;
VUHDO_UIFrameFlashStop = sHotCols["isFlashWhenLow"] and _G["VUHDO_UIFrameFlashStop"] or function() end;
sIsWarnColor = sHotCols["WARNING"]["enabled"];
sHotSetup = VUHDO_PANEL_SETUP["HOTS"];
sHotSlots = VUHDO_PANEL_SETUP["HOTS"]["SLOTS"];
sIsHotShowIcon = sHotSetup["iconRadioValue"] == 1;
sIsChargesIcon = sHotSetup["stacksRadioValue"] == 3;
sIsClusterIcons = VUHDO_INTERNAL_TOGGLES[16] or VUHDO_INTERNAL_TOGGLES[18]; -- -- VUHDO_UPDATE_NUM_CLUSTER -- VUHDO_UPDATE_MOUSEOVER_CLUSTER
sIsOthersHots = VUHDO_ACTIVE_HOTS["OTHER"];
sHotSlotCfgs = { };
for tCnt = 1, 10 do
sHotSlotCfgs[tCnt] = VUHDO_PANEL_SETUP["HOTS"]["SLOTCFG"][tostring(tCnt)];
end
end
----------------------------------------------------
--
function VUHDO_hotsSetClippings(aLeft, aRight, aTop, aBottom)
sClipL, sClipR, sClipT, sClipB = aLeft, aRight, aTop, aBottom;
end
--
local tOphEmpty = { nil, 0 };
function VUHDO_getOtherPlayersHotInfo(aUnit)
return sOthersHotsInfo[aUnit] or tOphEmpty;
end
--
function VUHDO_setKnowsSwiftmend(aKnowsSwiftmend)
sIsPlayerKnowsSwiftmend = aKnowsSwiftmend;
end
--
--
local tCopy = { };
local function VUHDO_copyColor(aColor)
tCopy["R"], tCopy["G"], tCopy["B"], tCopy["O"] = aColor["R"], aColor["G"], aColor["B"], aColor["O"];
tCopy["TR"], tCopy["TG"], tCopy["TB"], tCopy["TO"] = aColor["TR"], aColor["TG"], aColor["TB"], aColor["TO"];
tCopy["useBackground"], tCopy["useText"], tCopy["useOpacity"] = aColor["useBackground"], aColor["useText"], aColor["useOpacity"];
return tCopy;
end
--
local tHotBar;
local function VUHDO_customizeHotBar(aButton, aRest, anIndex, aDuration, aColor)
tHotBar = VUHDO_getHealthBar(aButton, anIndex + 3);
if aColor then tHotBar:SetVuhDoColor(aColor); end
if (aDuration or 0) == 0 or not aRest then tHotBar:SetValue(0);
else tHotBar:SetValue(aRest / aDuration); end
end
--
local tHotName;
local tDuration2;
local tChargeTexture;
local tIsChargeShown;
local tIcon;
local tTimer;
local tCounter;
local tClock;
local tDuration;
local tHotCfg;
local tIsChargeAlpha;
local tStarted;
local function VUHDO_customizeHotIcons(aButton, aHotName, aRest, aTimes, anIcon, aDuration, aShieldCharges, aColor, anIndex, aClipL, aClipR, aClipT, aClipB)
tHotCfg = sBarColors[VUHDO_HOT_CFGS[anIndex]];
tIcon = VUHDO_getBarIcon(aButton, anIndex);
if not tIcon then return end; -- Noch nicht erstellt von redraw
if not aRest then
VUHDO_UIFrameFlashStop(tIcon);
VUHDO_getBarIconFrame(aButton, anIndex):Hide();
return;
else
VUHDO_getBarIconFrame(aButton, anIndex):Show();
end
tTimer = VUHDO_getBarIconTimer(aButton, anIndex);
tCounter = VUHDO_getBarIconCounter(aButton, anIndex);
tClock = VUHDO_getBarIconClockOrStub(aButton, anIndex, tHotCfg["isClock"]);
tChargeTexture = VUHDO_getBarIconCharge(aButton, anIndex);
if aColor and aColor["useText"] and aColor["TR"] then
tCounter:SetTextColor(VUHDO_textColor(aColor));
end
if anIcon and (sIsHotShowIcon or aColor) then
if VUHDO_ATLAS_TEXTURES[anIcon] then
tIcon:SetAtlas(anIcon);
else
tIcon:SetTexture(anIcon);
end
end
tIcon:SetTexCoord(aClipL or sClipL, aClipR or sClipR, aClipT or sClipT, aClipB or sClipB);
aTimes = aTimes or 0;
tIsChargeShown = sIsChargesIcon and aTimes > 0;
if aRest == 999 then -- Other players' HoTs
if aTimes > 0 then
tIcon:SetAlpha(tHotCfg["O"]);
tCounter:SetText(aTimes > 1 and aTimes or "");
else
VUHDO_UIFrameFlashStop(tIcon);
tIcon:SetAlpha(0);
tCounter:SetText("");
end
tTimer:SetText("");
tClock:SetAlpha(0);
return;
elseif aRest > 0 then
tIcon:SetAlpha((aRest < 10 and sIsFade) and tHotCfg["O"] * aRest * 0.1 or tHotCfg["O"]);
if aRest < 10 or tHotCfg["isFullDuration"] then
tDuration = (tHotCfg["countdownMode"] == 2 and aRest < sHotCols["WARNING"]["lowSecs"])
and format("%.1f", aRest) or format("%d", aRest);
else
tDuration = (tHotCfg["O"] > 0 or tIsChargeShown) and "" or "X";
end
tTimer:SetText(tDuration);
tStarted = floor(10 * (GetTime() - aDuration + aRest) + 0.5) * 0.1;
if tClock:GetAlpha() == 0 or (tClock:GetAttribute("started") or tStarted) ~= tStarted then
tClock:SetAlpha(1);
tClock:SetCooldown(tStarted, aDuration);
tClock:SetAttribute("started", tStarted);
end
tIcon:SetAlpha((sIsFade and aRest < 10) and tHotCfg["O"] * aRest * 0.1 or tHotCfg["O"]);
if aRest > 5 then
VUHDO_UIFrameFlashStop(tIcon);
tTimer:SetTextColor(1, 1, 1, 1);
else
tDuration2 = aRest * 0.2;
tTimer:SetTextColor(1, tDuration2, tDuration2, 1);
VUHDO_UIFrameFlash(tIcon, 0.2, 0.1, 5, true, 0, 0.1);
end
tCounter:SetText(aTimes > 1 and aTimes or "");
else
VUHDO_UIFrameFlashStop(tIcon);
tTimer:SetText("");
tClock:SetAlpha(0);
tIcon:SetAlpha(tHotCfg["O"]);
tCounter:SetText(aTimes > 1 and aTimes or "");
end
--@TESTING
--aTimes = floor(aRest / 3.5);
if aTimes > 4 then aTimes = 4; end
tIsChargeAlpha = false;
if aColor and aColor["useSlotColor"] then
tHotColor = VUHDO_copyColor(tHotCfg);
elseif aColor and (not aColor["isDefault"] or not sIsHotShowIcon) then
tHotColor = aColor;
if aTimes > 1 and not aColor["noStacksColor"] then
tChargeColor = sBarColors[VUHDO_CHARGE_COLORS[aTimes]];
if sHotCols["useColorBack"] then
tHotColor["R"], tHotColor["G"], tHotColor["B"], tHotColor["O"]
= tChargeColor["R"], tChargeColor["G"], tChargeColor["B"], tChargeColor["O"];
tIsChargeAlpha = true;
end
if sHotCols["useColorText"] then
tHotColor["TR"], tHotColor["TG"], tHotColor["TB"], tHotColor["TO"]
= tChargeColor["TR"], tChargeColor["TG"], tChargeColor["TB"], tChargeColor["TO"];
end
end
if tHotColor["useText"] and not sIsHotShowIcon then
tTimer:SetTextColor(VUHDO_textColor(tHotColor));
end
elseif sIsWarnColor and aRest < sHotCols["WARNING"]["lowSecs"] then
tHotColor = sHotCols["WARNING"];
tTimer:SetTextColor(VUHDO_textColor(tHotColor));
else
tHotColor = VUHDO_copyColor(tHotCfg);
if sIsHotShowIcon then
tHotColor["R"], tHotColor["G"], tHotColor["B"] = 1, 1, 1;
elseif aTimes <= 1 or not sHotCols["useColorText"] then
tTimer:SetTextColor(VUHDO_textColor(tHotColor));
end
if aTimes > 1 then
tChargeColor = sBarColors[VUHDO_CHARGE_COLORS[aTimes]];
if sHotCols["useColorBack"] then
tHotColor["R"], tHotColor["G"], tHotColor["B"], tHotColor["O"]
= tChargeColor["R"], tChargeColor["G"], tChargeColor["B"], tChargeColor["O"];
tIsChargeAlpha = true;
end
if sHotCols["useColorText"] then
tHotColor["TR"], tHotColor["TG"], tHotColor["TB"], tHotColor["TO"]
= tChargeColor["TR"], tChargeColor["TG"], tChargeColor["TB"], tChargeColor["TO"];
tTimer:SetTextColor(VUHDO_textColor(tHotColor));
end
end
end
tIcon:SetVertexColor(tHotColor["R"], tHotColor["G"], tHotColor["B"], tIsChargeAlpha and tHotColor["O"]);
if tIsChargeShown then
tChargeTexture:SetTexture(VUHDO_CHARGE_TEXTURES[aTimes]);
if tHotColor["R"] then tChargeTexture:SetVertexColor(VUHDO_backColor(tHotColor)); end
tChargeTexture:Show();
elseif aShieldCharges > 0 then
if sIsHotShowIcon then tHotColor = tHotCfg; end
tChargeTexture:SetTexture(VUHDO_SHIELD_TEXTURES[aShieldCharges]);
if tHotColor["R"] then
tChargeTexture:SetVertexColor(tHotColor["R"] + 0.15, tHotColor["G"] + 0.15, tHotColor["B"] + 0.15, tHotColor["O"]);
end
tChargeTexture:Show();
else
tChargeTexture:Hide();
end
end
--
local tAllButtons;
local tShieldCharges;
local tIsMatch;
local tIsMine, tIsOthers;
local function VUHDO_updateHotIcons(aUnit, aHotName, aRest, aTimes, anIcon, aDuration, aMode, aColor, aHotSpellName, aClipL, aClipR, aClipT, aClipB)
tAllButtons = VUHDO_getUnitButtons(VUHDO_resolveVehicleUnit(aUnit));
if not tAllButtons then return; end
tShieldCharges = VUHDO_getShieldLeftCount(aUnit, aHotSpellName or aHotName, aMode) or 0; -- if not our shield don't show remaining absorption
for tIndex, tHotName in pairs(sHotSlots) do
if aHotName == tHotName then
if aMode == 0 or aColor then tIsMatch = true; -- Bouquet => aColor ~= nil
else
tIsMine, tIsOthers = sHotSlotCfgs[tIndex]["mine"], sHotSlotCfgs[tIndex]["others"];
tIsMatch = (aMode == 1 and tIsMine and not tIsOthers)
or (aMode == 2 and not tIsMine and tIsOthers)
or (aMode == 3 and tIsMine and tIsOthers);
end
if tIsMatch then
if tIndex >= 6 and tIndex <= 8 then
for _, tButton in pairs(tAllButtons) do
VUHDO_customizeHotBar(tButton, aRest, tIndex, aDuration, aColor);
end
else
for _, tButton in pairs(tAllButtons) do
VUHDO_customizeHotIcons(tButton, aHotName, aRest, aTimes, anIcon, aDuration, tShieldCharges, aColor, tIndex, aClipL, aClipR, aClipT, aClipB);
end
end
end
end
end
end
--
local tHotIconFrame;
local function VUHDO_removeButtonHots(aButton)
for tCnt = 1, 5 do
VUHDO_UIFrameFlashStop(VUHDO_getBarIcon(aButton, tCnt));
tHotIconFrame = VUHDO_getBarIconFrame(aButton, tCnt);
if tHotIconFrame then tHotIconFrame:Hide(); end
end
for tCnt = 9, 10 do
VUHDO_UIFrameFlashStop(VUHDO_getBarIcon(aButton, tCnt));
tHotIconFrame = VUHDO_getBarIconFrame(aButton, tCnt);
if tHotIconFrame then tHotIconFrame:Hide(); end
end
for tCnt = 9, 11 do
VUHDO_getHealthBar(aButton, tCnt):SetValue(0);
end
VUHDO_getBarRoleIcon(aButton, 51):Hide(); -- Swiftmend indicator
end
--
function VUHDO_removeHots(aUnit)
for _, tButton in pairs(VUHDO_getUnitButtonsSafe(aUnit)) do
VUHDO_removeButtonHots(tButton);
end
end
local VUHDO_removeHots = VUHDO_removeHots;
--
local tCount;
local tHotInfo;
local tAlive;
local function VUHDO_snapshotHot(aHotName, aRest, aStacks, anIcon, anIsMine, aDuration, aUnit, anExpiry)
aStacks = aStacks or 0;
tCount = aStacks == 0 and 1 or aStacks;
tAlive = GetTime() - anExpiry + (aDuration or 0);
if anIsMine then
if not VUHDO_MY_HOTS[aUnit][aHotName] then VUHDO_MY_HOTS[aUnit][aHotName] = { }; end
tHotInfo = VUHDO_MY_HOTS[aUnit][aHotName];
tHotInfo[1], tHotInfo[2], tHotInfo[3], tHotInfo[4], tHotInfo[5] = aRest, aStacks, anIcon, aDuration, tAlive;
elseif VUHDO_ACTIVE_HOTS_OTHERS[aHotName] then
if not VUHDO_OTHER_HOTS[aUnit][aHotName] then VUHDO_OTHER_HOTS[aUnit][aHotName] = { }; end
tHotInfo = VUHDO_OTHER_HOTS[aUnit][aHotName];
if not tHotInfo[1] then
tHotInfo[1], tHotInfo[2], tHotInfo[3], tHotInfo[4], tHotInfo[5] = aRest, aStacks, anIcon, aDuration, tAlive;
else
if aRest > tHotInfo[1] then tHotInfo[1] = aRest; end
tHotInfo[2] = tHotInfo[2] + tCount;
end
end
if not VUHDO_MY_AND_OTHERS_HOTS[aUnit][aHotName] then VUHDO_MY_AND_OTHERS_HOTS[aUnit][aHotName] = { }; end
tHotInfo = VUHDO_MY_AND_OTHERS_HOTS[aUnit][aHotName];
if not tHotInfo[1] then
tHotInfo[1], tHotInfo[2], tHotInfo[3], tHotInfo[4], tHotInfo[5] = aRest, aStacks, anIcon, aDuration, tAlive;
else
if anIsMine or aRest > tHotInfo[1] then tHotInfo[1] = aRest; end
tHotInfo[2] = tHotInfo[2] + tCount;
end
end
local VUHDO_IGNORE_HOT_IDS = {
[67358] = true, -- "Rejuvenating" proc has same name in russian and spanish as rejuvenation
[126921] = true, -- "Weakened Soul" by Shao-Tien Soul-Render
}
--
function VUHDO_hotBouquetCallback(aUnit, anIsActive, anIcon, aTimer, aCounter, aDuration, aColor, aBuffName, aBouquetName, anImpact, aTimer2, aClipL, aClipR, aClipT, aClipB)
VUHDO_updateHotIcons(aUnit, "BOUQUET_" .. (aBouquetName or ""), aTimer, aCounter, anIcon, aDuration, 0, aColor, aBuffName, aClipL, aClipR, aClipT, aClipB);
end
--
local tOtherHotCnt;
local tIconFound;
local tOtherIcon;
local tBuffIcon;
local tExpiry;
local tRest;
local tStacks;
local tCaster;
local tBuffName;
local tStart, tEnabled;
local tSmDuration;
local tDiffIcon;
local tHotFromBuff;
local tIsCastByPlayer;
local tDuration;
local tSpellId, tDebuffOffset;
local tNow;
local tFilter;
local function VUHDO_updateHots(aUnit, anInfo)
if anInfo["isVehicle"] then
VUHDO_removeHots(aUnit);
aUnit = anInfo["petUnit"];
if not aUnit then return; end-- bei z.B. focus/target
end
if not VUHDO_MY_HOTS[aUnit] then VUHDO_MY_HOTS[aUnit] = { }; end
if not VUHDO_OTHER_HOTS[aUnit] then VUHDO_OTHER_HOTS[aUnit] = { }; end
if not VUHDO_MY_AND_OTHERS_HOTS[aUnit] then VUHDO_MY_AND_OTHERS_HOTS[aUnit] = { }; end
for _, tHotInfo in pairs(VUHDO_MY_HOTS[aUnit]) do tHotInfo[1] = nil end -- Rest == nil => Icon l�schen
for _, tHotInfo in pairs(VUHDO_OTHER_HOTS[aUnit]) do tHotInfo[1] = nil; end
for _, tHotInfo in pairs(VUHDO_MY_AND_OTHERS_HOTS[aUnit]) do tHotInfo[1] = nil; end
sIsSwiftmend = false;
tOtherIcon = nil;
tOtherHotCnt = 0;
if not sOthersHotsInfo[aUnit] then
sOthersHotsInfo[aUnit] = { nil, 0 };
else
sOthersHotsInfo[aUnit][1], sOthersHotsInfo[aUnit][2] = nil, 0;
end
if VUHDO_shouldScanUnit(aUnit) then
tNow = GetTime();
tDebuffOffset = nil;
for tCnt = 1, huge do
if not tDebuffOffset then
tBuffName, tBuffIcon, tStacks, _, tDuration, tExpiry, tCaster, _, _, tSpellId = UnitBuff(aUnit, tCnt);
if not tBuffIcon then
tDebuffOffset = tCnt - 1;
end
end
if tDebuffOffset then -- Achtung kein elseif
tBuffName, tBuffIcon, tStacks, _, tDuration, tExpiry, tCaster, _, _, tSpellId = UnitDebuff(aUnit, tCnt - tDebuffOffset);
if not tBuffIcon then
break;
end
end
tIsCastByPlayer = tCaster == "player" or tCaster == VUHDO_PLAYER_RAID_ID;
if sIsPlayerKnowsSwiftmend and not sIsSwiftmend then
if VUHDO_SPELL_ID.REGROWTH == tBuffName or VUHDO_SPELL_ID.REJUVENATION == tBuffName or VUHDO_SPELL_ID.GERMINATION == tBuffName then
tStart, tSmDuration, tEnabled = GetSpellCooldown(VUHDO_SPELL_ID.SWIFTMEND);
if tEnabled ~= 0 and (tStart == nil or tSmDuration == nil or tStart <= 0 or tSmDuration <= 1.6) then
sIsSwiftmend = true;
end
end
end
if (tExpiry or 0) == 0 then
tExpiry = (tNow + 9999);
end
if not VUHDO_CACHE_SPELL_ONLY_BY_ID[tBuffName] then
tHotFromBuff = sBuffs2Hots[tBuffName .. tBuffIcon] or sBuffs2Hots[tSpellId];
else
tHotFromBuff = sBuffs2Hots[tSpellId];
end
if tHotFromBuff == "" or VUHDO_IGNORE_HOT_IDS[tSpellId] then -- non hot buff
elseif tHotFromBuff then -- Hot buff cached
tRest = tExpiry - tNow;
if tRest > 0 then
VUHDO_snapshotHot(tHotFromBuff, tRest, tStacks, tBuffIcon, tIsCastByPlayer, tDuration, aUnit, tExpiry);
end
else -- not yet scanned
if not VUHDO_CACHE_SPELL_ONLY_BY_ID[tBuffName] then
sBuffs2Hots[tBuffName .. tBuffIcon] = "";
end
sBuffs2Hots[tSpellId] = "";
for tHotCmpName, _ in pairs(VUHDO_ACTIVE_HOTS) do
tDiffIcon = VUHDO_CAST_ICON_DIFF[tHotCmpName];
if tDiffIcon == tBuffIcon
or (tDiffIcon == nil and tBuffName == tHotCmpName)
or tostring(tSpellId or -1) == tHotCmpName then
tRest = tExpiry - tNow;
if tRest > 0 then
VUHDO_snapshotHot(tHotCmpName, tRest, tStacks, tBuffIcon, tIsCastByPlayer, tDuration, aUnit, tExpiry);
end
if not VUHDO_CACHE_SPELL_ONLY_BY_ID[tBuffName] then
sBuffs2Hots[tBuffName .. tBuffIcon] = tHotCmpName;
end
sBuffs2Hots[tSpellId] = tHotCmpName;
break;
end
end
end
if not tIsCastByPlayer and VUHDO_HEALING_HOTS[tBuffName] and not VUHDO_ACTIVE_HOTS_OTHERS[tBuffName] then
tOtherIcon = tBuffIcon;
tOtherHotCnt = tOtherHotCnt + 1;
sOthersHotsInfo[aUnit][1] = tOtherIcon;
sOthersHotsInfo[aUnit][2] = tOtherHotCnt;
end
end
-- Other players' HoTs
if sIsOthersHots then VUHDO_updateHotIcons(aUnit, "OTHER", 999, tOtherHotCnt, tOtherIcon, nil, 0, nil, nil, nil, nil, nil, nil); end
-- Clusters
if sIsClusterIcons then VUHDO_updateAllClusterIcons(aUnit, anInfo); end
-- Swiftmend
if sIsPlayerKnowsSwiftmend then sSwiftmendUnits[aUnit] = sIsSwiftmend; end
end -- Should scan unit
-- Own
for tHotCmpName, tHotInfo in pairs(VUHDO_MY_HOTS[aUnit]) do
VUHDO_updateHotIcons(aUnit, tHotCmpName, tHotInfo[1], tHotInfo[2], tHotInfo[3], tHotInfo[4], 1, nil, nil, nil, nil, nil, nil);
if not tHotInfo[1] then twipe(tHotInfo); VUHDO_MY_HOTS[aUnit][tHotCmpName] = nil; end
end
-- Others
for tHotCmpName, tHotInfo in pairs(VUHDO_OTHER_HOTS[aUnit]) do
VUHDO_updateHotIcons(aUnit, tHotCmpName, tHotInfo[1], tHotInfo[2], tHotInfo[3], tHotInfo[4], 2, nil, nil, nil, nil, nil, nil);
if not tHotInfo[1] then twipe(tHotInfo); VUHDO_OTHER_HOTS[aUnit][tHotCmpName] = nil; end
end
-- Own+Others
for tHotCmpName, tHotInfo in pairs(VUHDO_MY_AND_OTHERS_HOTS[aUnit]) do
VUHDO_updateHotIcons(aUnit, tHotCmpName, tHotInfo[1], tHotInfo[2], tHotInfo[3], tHotInfo[4], 3, nil, nil, nil, nil, nil, nil);
if not tHotInfo[1] then twipe(tHotInfo); VUHDO_MY_AND_OTHERS_HOTS[aUnit][tHotCmpName] = nil; end
end
end
--
local tIcon;
function VUHDO_swiftmendIndicatorBouquetCallback(aUnit, anIsActive, anIcon, aTimer, aCounter, aDuration, aColor, aBuffName, aBouquetName, anImpact, aTimer2, aClipL, aClipR, aClipT, aClipB)
for _, tButton in pairs(VUHDO_getUnitButtonsSafe(aUnit)) do
if anIsActive and aColor then
tIcon = VUHDO_getBarRoleIcon(tButton, 51);
if VUHDO_ATLAS_TEXTURES[anIcon] then
tIcon:SetAtlas(anIcon);
else
tIcon:SetTexture(anIcon);
end
tIcon:SetVertexColor(VUHDO_backColor(aColor));
tIcon:SetTexCoord(aClipL or 0, aClipR or 1, aClipT or 0, aClipB or 1);
tIcon:Show();
else
VUHDO_getBarRoleIcon(tButton, 51):Hide();
end
end
end
--
local sIsSuspended = false;
function VUHDO_suspendHoTs(aFlag)
sIsSuspended = aFlag;
end
--
function VUHDO_updateAllHoTs()
if sIsSuspended then return; end
twipe(sSwiftmendUnits);
for tUnit, tInfo in pairs(VUHDO_RAID) do
VUHDO_updateHots(tUnit, tInfo);
end
end
--
function VUHDO_removeAllHots()
local tButton;
local tCnt2;
for tCnt = 1, 10 do
if VUHDO_getActionPanel(tCnt) then
if VUHDO_isPanelVisible(tCnt) then
tCnt2 = 1;
while true do
tButton = VUHDO_getHealButton(tCnt2, tCnt);
if not tButton then break; end -- Auch nicht belegte buttons ausblenden
VUHDO_removeButtonHots(tButton);
tCnt2 = tCnt2 + 1;
end
end
else
break;
end
end
VUHDO_updatePlayerTarget();
end
--
function VUHDO_resetHotBuffCache()
twipe(sBuffs2Hots);
end
function VUHDO_isUnitSwiftmendable(aUnit)
return sSwiftmendUnits[aUnit];
end
|
-- Sorted Pairs function, pass in the sort function
local function spairs(t, order)
-- Collect keys
local keys = {}
for k in pairs(t) do keys[#keys + 1] = k end
-- If order function given, sort by passing the table and keys a, b,
-- otherwise just sort keys
if order then
table.sort(keys, function(a,b) return order(t, a, b) end)
else
table.sort(keys)
end
-- Return the iterator function
local i = 0
return function()
i = i + 1
if keys[i] then
return keys[i], t[keys[i]]
end
end
end
require "Window"
-----------------------------------------------------------------------------------------------
-- MarketplaceToVendor Module Definition
-----------------------------------------------------------------------------------------------
local MarketplaceToVendor = {}
-----------------------------------------------------------------------------------------------
-- Constants
-----------------------------------------------------------------------------------------------
-- e.g. local kiExampleVariableMax = 999
-----------------------------------------------------------------------------------------------
-- Initialization
-----------------------------------------------------------------------------------------------
function MarketplaceToVendor:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
-- initialize variables here
return o
end
function MarketplaceToVendor:Init()
local bHasConfigureFunction = false
local strConfigureButtonText = ""
local tDependencies = {
"MarketplaceCommodity",
}
Apollo.RegisterAddon(self, bHasConfigureFunction, strConfigureButtonText, tDependencies)
end
-----------------------------------------------------------------------------------------------
-- MarketplaceToVendor OnLoad
-----------------------------------------------------------------------------------------------
function MarketplaceToVendor:OnLoad()
-- load our form file
self.xmlDoc = XmlDoc.CreateFromFile("MarketplaceToVendor.xml")
self.xmlDoc:RegisterCallback("OnDocLoaded", self)
end
-----------------------------------------------------------------------------------------------
-- MarketplaceToVendor OnDocLoaded
-----------------------------------------------------------------------------------------------
function MarketplaceToVendor:OnDocLoaded()
if self.xmlDoc ~= nil and self.xmlDoc:IsLoaded() then
self.wndMain = Apollo.LoadForm(self.xmlDoc, "MarketplaceToVendorForm", nil, self)
if self.wndMain == nil then
Apollo.AddAddonErrorText(self, "Could not load the main window for some reason.")
return
end
self.wndMain:Show(false, true)
-- if the xmlDoc is no longer needed, you should set it to nil
-- self.xmlDoc = nil
-- Register handlers for events, slash commands and timer, etc.
-- e.g. Apollo.RegisterEventHandler("KeyDown", "OnKeyDown", self)
Apollo.RegisterSlashCommand("mv", "OnMarketplaceToVendorOn", self)
-- Do additional Addon initialization here
Apollo.RegisterEventHandler("CommodityInfoResults", "OnCommodityInfoResults", self)
Apollo.RegisterEventHandler("ToggleMarketplaceWindow", "OnMarketplaceWindowOpened", self)
Apollo.RegisterEventHandler("MarketplaceWindowClose", "OnMarketplaceWindowClosed", self)
self.wndIsScanningText = self.wndMain:FindChild("IsScanningText")
self.wndIncludeTaxesCheckbox = self.wndMain:FindChild("IncludeTaxesCheckbox")
self.listItems = {}
self.vendorItems = {}
self.wndIncludeTaxesCheckbox:SetCheck(true)
self:OnMarketplaceWindowClosed()
end
end
-----------------------------------------------------------------------------------------------
-- MarketplaceToVendor Functions
-----------------------------------------------------------------------------------------------
-- Define general functions here
-- on SlashCommand "/mv"
function MarketplaceToVendor:OnMarketplaceToVendorOn()
self.wndMain:Invoke() -- show the window
end
function MarketplaceToVendor:ScanCx(wndHandler, wndControl, eMouseButton)
self.queue = {}
for idx, family in ipairs(MarketplaceLib.GetCommodityFamilies()) do
for idx2, category in ipairs(MarketplaceLib.GetCommodityCategories(family.nId)) do
for idx3, type in ipairs(MarketplaceLib.GetCommodityTypes(category.nId)) do
for idx4, item in ipairs(MarketplaceLib.GetCommodityItems(type.nId)) do
table.insert(self.queue, item.nId)
end
end
end
end
self.queueIndex = 0
self.isScanning = true
self.wndIsScanningText:Show(true)
self.vendorItems = {}
for i, id in ipairs(self.queue) do
MarketplaceLib.RequestCommodityInfo(id)
end
end
function MarketplaceToVendor:OnCommodityInfoResults(nItemId, tStats, tOrders)
if tStats.arSellOrderPrices[1].monPrice:GetAmount() > 0 then
-- Top 1
local vendorProfit = self:GetVendorProfit(tStats.arSellOrderPrices[1].monPrice:GetAmount(), nItemId)
if vendorProfit > 0 then
local itemData = { item = Item.GetDataFromId(nItemId), tStats = tStats, vendorProfit = vendorProfit }
table.insert(self.vendorItems, itemData)
end
end
if self.isScanning then
self.queueIndex = self.queueIndex + 1
if self.queueIndex >= #self.queue then
self.isScanning = false
self.wndIsScanningText:Show(false)
self:RefreshVendorList()
end
end
end
function MarketplaceToVendor:ClearVendorList()
for i, listItem in ipairs(self.listItems) do
listItem:Destroy()
end
self.listItems = {}
end
function MarketplaceToVendor:RefreshVendorList()
self:ClearVendorList()
local wndList = self.wndMain:FindChild("VendorList")
if #self.vendorItems == 0 then
table.insert(self.listItems, self:AddListItem(wndList, "No profitable commodities found."))
else
for i, item in spairs(self.vendorItems, function(t, a, b) return t[a].vendorProfit > t[b].vendorProfit end) do
table.insert(self.listItems, self:AddListItem(wndList, item.item:GetName(), item.vendorProfit))
end
end
wndList:ArrangeChildrenVert()
end
function MarketplaceToVendor:OrderVendorItemsByProfit(t, a, b)
return t[a].vendorProfit < t[b].vendorProfit
end
function MarketplaceToVendor:GetVendorProfit(sellPrice, nItemId, quantity)
quantity = quantity or 1
local item = Item.GetDataFromId(nItemId)
if item == nil then
return 0
end
local vendorPrice = item:GetSellPrice()
if vendorPrice == nil then
return 0
end
local profit = (vendorPrice:GetAmount() - sellPrice) * quantity
if self.wndIncludeTaxesCheckbox:IsChecked() then
local pricePercentageTax = sellPrice * quantity * MarketplaceLib.kfCommodityBuyOrderTaxMultiplier
if pricePercentageTax < MarketplaceLib.knCommodityBuyOrderTaxMinimum then
profit = profit - MarketplaceLib.knCommodityBuyOrderTaxMinimum
else
profit = profit - pricePercentageTax
end
end
return profit
end
function MarketplaceToVendor:AddListItem(wndTarget, name, profit)
local wndListItem = Apollo.LoadForm(self.xmlDoc, "ListItem", wndTarget, self)
wndListItem:FindChild("NameText"):SetText(name)
if profit ~= nil then
wndListItem:FindChild("ProfitCash"):SetAmount(profit)
wndListItem:FindChild("ProfitCash"):Show(true)
end
return wndListItem
end
function MarketplaceToVendor:OnMarketplaceWindowOpened()
local scanButton = self.wndMain:FindChild("ScanButton")
scanButton:Enable(true)
local marketplaceClosedText = self.wndMain:FindChild("MarketplaceClosedText")
marketplaceClosedText:Show(false)
end
function MarketplaceToVendor:OnMarketplaceWindowClosed()
local scanButton = self.wndMain:FindChild("ScanButton")
scanButton:Enable(false)
local marketplaceClosedText = self.wndMain:FindChild("MarketplaceClosedText")
marketplaceClosedText:Show(true)
end
-----------------------------------------------------------------------------------------------
-- MarketplaceToVendorForm Functions
-----------------------------------------------------------------------------------------------
function MarketplaceToVendor:OnScanCx(wndHandler, wndControl, eMouseButton)
self:ScanCx()
end
function MarketplaceToVendor:OnCancel(wndHandler, wndControl, eMouseButton)
self.wndMain:Show(false)
end
-----------------------------------------------------------------------------------------------
-- MarketplaceToVendor Instance
-----------------------------------------------------------------------------------------------
local MarketplaceToVendorInst = MarketplaceToVendor:new()
MarketplaceToVendorInst:Init()
|
local vec3 = require "modules.vec3"
local utils = require "modules.utils"
local constants = require "modules.constants"
local function tolerance(v, t)
return math.abs(v - t) < 1e-6
end
describe("utils:", function()
it("interpolates between two numbers", function()
assert.is_true(tolerance(utils.lerp(0, 1, 0.5), 0.5))
end)
it("interpolates between two vectors", function()
local a = vec3(0, 0, 0)
local b = vec3(1, 1, 1)
local c = vec3(0.5, 0.5, 0.5)
assert.is.equal(utils.lerp(a, b, 0.5), c)
a = vec3(5, 5, 5)
b = vec3(0, 0, 0)
c = vec3(2.5, 2.5, 2.5)
assert.is.equal(utils.lerp(a, b, 0.5), c)
end)
it("decays exponentially", function()
local v = utils.decay(0, 1, 0.5, 1)
assert.is_true(tolerance(v, 0.39346934028737))
end)
end)
--[[
clamp(value, min, max)
deadzone(value, size)
threshold(value, threshold)
tolerance(value, threshold)
map(value, min_in, max_in, min_out, max_out)
lerp(progress, low, high)
smoothstep(progress, low, high)
round(value, precision)
wrap(value, limit)
is_pot(value)
project_on(out, a, b)
project_from(out, a, b)
mirror_on(out, a, b)
reflect(out, i, n)
refract(out, i, n, ior)
angle_to(a, b)
angle_between(a, b)
--]]
|
local dbConfig = {}
local dbStat = {}
dbConfig.host = get("dbHost") or "127.0.0.1"
dbConfig.hostType = get("dbHostType") or "host"
dbConfig.user = get("dbUser") or "root"
dbConfig.pass = get("dbPass") or ""
dbConfig.name = get("dbName") or ""
dbConfig.prefix = split(get("dbPrefix"), ",")
dbConfig.timeout = tonumber(get("dbTimeout")) or -1
dbStat.correctQuery = 0
dbStat.wrongQuery = 0
function dbStartConnection()
dbConfig["connect"] = dbConnect("mysql", "dbname="..dbConfig["name"]..";"..dbConfig["hostType"].."="..dbConfig["host"], dbConfig["user"], dbConfig["pass"])
if dbConfig["connect"] then outputDebugString("[MySQL] Połączono z bazą danych MySQL")
else
outputDebugString("[MySQL] Failed connect to database", 1)
cancelEvent()
end
end
function getDbHandler()
return dbConfig["connect"]
end
function dbQueryEx(str, ...)
local arg = {...}
str = dbPrefix(str)
local queryHandle = dbQuery(dbConfig["connect"], str, unpack(arg))
if queryHandle then
local result = {dbPoll(queryHandle, dbConfig["timeout"])}
if result[1] then
dbStat["correctQuery"] = dbStat["correctQuery"] + 1
elseif result[1] == false then
dbStat["wrongQuery"] = dbStat["wrongQuery"] + 1 --DB error result
else
dbStat["wrongQuery"] = dbStat["wrongQuery"] + 1 --DB not responding
dbFree(queryHandle)
end
return unpack(result)
else
dbStat["wrongQuery"] = dbStat["wrongQuery"] + 1 --DB error send query
return false
end
end
function dbExecEx(str, ...)
local arg = {...}
str = dbPrefix(str)
local queryHandle = dbExec(dbConfig["connect"], str, unpack(arg))
if queryHandle then dbStart["correctQuery"] = dbStat["correctQuery"] + 1
else dbStat["wrongQuery"] = dbStat["wrongQuery"] + 1 end --DB error send query
return queryHandle
end
function dbPrefix(str)
return string.gsub(str, "#pref([1-9])_",
function(arg1)
return (dbConfig["prefix"][tonumber(arg1)] or "table").."_"
end
)
end
addEventHandler("onResourceStart", resourceRoot, dbStartConnection)
|
data:extend({
{
type = "technology",
name = "decoration",
icon = "__5dim_decoration__/graphics/icon/decoration.png",
icon_size = 128,
effects =
{
{
type = "unlock-recipe",
recipe = "5d-banner-1"
},
{
type = "unlock-recipe",
recipe = "5d-banner-2"
},
{
type = "unlock-recipe",
recipe = "5d-banner-3"
},
{
type = "unlock-recipe",
recipe = "5d-statue"
},
{
type = "unlock-recipe",
recipe = "5d-obelisk"
},
{
type = "unlock-recipe",
recipe = "5d-letter-01"
},
{
type = "unlock-recipe",
recipe = "5d-letter-02"
},
{
type = "unlock-recipe",
recipe = "5d-letter-03"
},
{
type = "unlock-recipe",
recipe = "5d-letter-04"
},
{
type = "unlock-recipe",
recipe = "5d-letter-05"
},
{
type = "unlock-recipe",
recipe = "5d-letter-06"
},
{
type = "unlock-recipe",
recipe = "5d-letter-07"
},
{
type = "unlock-recipe",
recipe = "5d-letter-08"
},
{
type = "unlock-recipe",
recipe = "5d-letter-09"
},
{
type = "unlock-recipe",
recipe = "5d-letter-10"
},
{
type = "unlock-recipe",
recipe = "5d-letter-11"
},
{
type = "unlock-recipe",
recipe = "5d-letter-12"
},
{
type = "unlock-recipe",
recipe = "5d-letter-13"
},
{
type = "unlock-recipe",
recipe = "5d-letter-14"
},
{
type = "unlock-recipe",
recipe = "5d-letter-14"
},
{
type = "unlock-recipe",
recipe = "5d-letter-15"
},
{
type = "unlock-recipe",
recipe = "5d-letter-16"
},
{
type = "unlock-recipe",
recipe = "5d-letter-17"
},
{
type = "unlock-recipe",
recipe = "5d-letter-18"
},
{
type = "unlock-recipe",
recipe = "5d-letter-19"
},
{
type = "unlock-recipe",
recipe = "5d-letter-20"
},
{
type = "unlock-recipe",
recipe = "5d-letter-21"
},
{
type = "unlock-recipe",
recipe = "5d-letter-22"
},
{
type = "unlock-recipe",
recipe = "5d-letter-23"
},
{
type = "unlock-recipe",
recipe = "5d-letter-24"
},
{
type = "unlock-recipe",
recipe = "5d-letter-25"
},
{
type = "unlock-recipe",
recipe = "5d-letter-26"
},
{
type = "unlock-recipe",
recipe = "5d-letter-27"
},
{
type = "unlock-recipe",
recipe = "5d-letter-28"
},
{
type = "unlock-recipe",
recipe = "5d-letter-29"
},
{
type = "unlock-recipe",
recipe = "5d-letter-30"
},
{
type = "unlock-recipe",
recipe = "5d-letter-31"
},
{
type = "unlock-recipe",
recipe = "5d-letter-32"
},
{
type = "unlock-recipe",
recipe = "5d-letter-33"
},
{
type = "unlock-recipe",
recipe = "5d-letter-34"
},
{
type = "unlock-recipe",
recipe = "5d-letter-35"
},
{
type = "unlock-recipe",
recipe = "5d-letter-36"
},
{
type = "unlock-recipe",
recipe = "5d-letter-37"
},
{
type = "unlock-recipe",
recipe = "5d-letter-38"
},
{
type = "unlock-recipe",
recipe = "5d-letter-39"
},
{
type = "unlock-recipe",
recipe = "5d-letter-40"
},
{
type = "unlock-recipe",
recipe = "5d-letter-41"
},
{
type = "unlock-recipe",
recipe = "5d-letter-42"
},
{
type = "unlock-recipe",
recipe = "5d-letter-43"
},
{
type = "unlock-recipe",
recipe = "5d-letter-44"
},
{
type = "unlock-recipe",
recipe = "5d-letter-45"
},
{
type = "unlock-recipe",
recipe = "5d-letter-46"
},
{
type = "unlock-recipe",
recipe = "5d-letter-47"
},
{
type = "unlock-recipe",
recipe = "5d-letter-48"
},
{
type = "unlock-recipe",
recipe = "5d-letter-49"
},
{
type = "unlock-recipe",
recipe = "5d-letter-50"
},
{
type = "unlock-recipe",
recipe = "5d-letter-51"
},
{
type = "unlock-recipe",
recipe = "5d-letter-52"
},
{
type = "unlock-recipe",
recipe = "5d-letter-53"
},
{
type = "unlock-recipe",
recipe = "5d-letter-54"
},
{
type = "unlock-recipe",
recipe = "5d-letter-55"
},
{
type = "unlock-recipe",
recipe = "5d-arrow-1"
},
{
type = "unlock-recipe",
recipe = "5d-arrow-2"
},
{
type = "unlock-recipe",
recipe = "5d-arrow-3"
},
{
type = "unlock-recipe",
recipe = "5d-arrow-4"
},
{
type = "unlock-recipe",
recipe = "5d-concrete-a"
},
{
type = "unlock-recipe",
recipe = "5d-concrete-m"
},
{
type = "unlock-recipe",
recipe = "5d-concrete-v"
},
{
type = "unlock-recipe",
recipe = "5d-concrete-b2"
},
{
type = "unlock-recipe",
recipe = "5d-concrete-b"
},
{
type = "unlock-recipe",
recipe = "5d-concrete-r"
},
},
prerequisites = {"optics"},
unit =
{
count = 20,
ingredients = {{"science-pack-1", 1}},
time = 5
},
order = "c-a"
},
})
|
function music_init()
uart.setup(1, 9600, 8, uart.PARITY_NONE, uart.STOPBITS_1)
end
function music(i)
uart.write(1,0x7E,0x05,0x41,0x00,i,0x44+i,0xEF)
end
music_init()
|
-- Copyright (C) 2020 Jacob Shtabnoy <shtabnoyjacob@scps.net>
-- Licensed under the terms of the ISC License, see LICENSE
local Type = require("lefthook.Type");
local WebhookBatch = {};
WebhookBatch.__index = WebhookBatch;
function WebhookBatch:addWebhook(webhook)
Type(webhook, 1).table();
table.insert(self.webhooks, webhook);
end
function WebhookBatch:executeBatch(form)
Type(form, 1).table();
for _,v in pairs(self.webhooks) do
v:execute(form);
end
end
function WebhookBatch.new(webhooks)
Type(webhooks, 1).table.null();
local webhooks = webhooks or {};
local self = setmetatable({}, WebhookBatch);
self.webhooks = webhooks;
return self;
end
return WebhookBatch;
|
--------------------------------------------------- αυтнσя : αя∂αναη81 -----------------------------------------------
-- Create And Spawn Car Near The Player Who Excute The Command
function createVehicleForPlayer(player, command, model)
local x, y, z = getElementPosition(player)
createVehicle(model, x, y + 5, z)
outputChatBox("Mashin Ba Hash Code >> "..model.." << Sakhte Shode")
end
-- Commands For Spawing Car
addCommandHandler('createvehicle', createVehicleForPlayer, false, false)
addCommandHandler('car', createVehicleForPlayer, false, false)
addCommandHandler('cc', createVehicleForPlayer, false, false)
-- Delete Cars (Those which Are Without Driver)
function loopVehicles(p)
local count = 0
for i, v in ipairs (getElementsByType ("vehicle")) do
if v then
local occupants = countOccupants(v)
if not occupants or occupants == 0 then
if getVehicleType(v) == "Trailer" then
if not getVehicleTowingVehicle(v) then
destroyElement (v)
count = count+1
end
else
destroyElement (v)
count = count+1
end
end
end
end
end
-- Commands For Deleting Cars
addCommandHandler ("dvall", loopVehicles)
addCommandHandler ("deletevehicles", loopVehicles)
function countOccupants(vehicle)
if vehicle and getElementType(vehicle) == "vehicle" then
local ppl = getVehicleOccupants(vehicle)
if not ppl then
return false
else
local counter = 0
for seat, player in pairs(ppl) do
counter = counter + 1
end
return counter
end
end
end
--------------------------------------------------- αυтнσя : αя∂αναη81 -----------------------------------------------
|
function printVerse(name)
local sb = string.lower(name)
sb = sb:gsub("^%l", string.upper)
local x = sb
local x0 = x:sub(1,1)
local y
if x0 == 'A' or x0 == 'E' or x0 == 'I' or x0 == 'O' or x0 == 'U' then
y = string.lower(x)
else
y = x:sub(2)
end
local b = "b" .. y
local f = "f" .. y
local m = "m" .. y
if x0 == 'B' then
b = y
elseif x0 == 'F' then
f = y
elseif x0 == 'M' then
m = y
end
print(x .. ", " .. x .. ", bo-" .. b)
print("Banana-fana fo-" .. f)
print("Fee-fi-mo-" .. m)
print(x .. "!")
print()
return nil
end
local nameList = { "Gary", "Earl", "Billy", "Felix", "Mary", "Steve" }
for _,name in pairs(nameList) do
printVerse(name)
end
|
local splash = {}
local filmgrain_effect = moonshine(moonshine.effects.desaturate)
.chain(moonshine.effects.filmgrain)
.chain(moonshine.effects.vignette)
filmgrain_effect.filmgrain.size = 10
filmgrain_effect.filmgrain.opacity = .6
filmgrain_effect.desaturate.tint = {138, 111, 48}
function splash.enter()
state = STATE_SPLASH
end
function splash.update()
player_input:update()
if player_input:pressed('pause') or player_input:pressed('back') or player_input:pressed('quit') or player_input:pressed('fire') or player_input:pressed('sel') then
mainmenu.enter()
end
end
function splash.draw()
local f = math.random(3)
local img = image["title"..f]
if love.math.random() > 0.7 then filmgrain_effect.filmgrain.size = love.math.random() * 10 + 5 end
if love.math.random() > 0.7 then filmgrain_effect.filmgrain.opacity = love.math.random() * 0.2 end
if love.math.random() > 0.7 then filmgrain_effect.desaturate.strength = love.math.random() * .1 + .1 end
if love.math.random() > 0.7 then filmgrain_effect.vignette.radius = love.math.random() * .1 + .6 end
if love.math.random() > 0.7 then filmgrain_effect.vignette.opacity = love.math.random() * .1 + .6 end
filmgrain_effect(function()
love.graphics.draw(img, 0, 0, 0, window.w / img:getWidth(), window.h / img:getHeight())
end)
end
return splash
|
/*
* @package : rlib
* @author : Richard [http://steamcommunity.com/profiles/76561198135875727]
* @copyright : (C) 2018 - 2020
* @since : 1.0.0
* @website : https://rlib.io
* @docs : https://docs.rlib.io
*
* MIT License
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* standard tables and localization
*/
rlib = rlib or { }
local base = rlib
local mf = base.manifest
local prefix = mf.prefix
local cfg = base.settings
/*
* simplifiy funcs
*/
local function log( ... ) base:log( ... ) end
/*
* Localized rlib routes
*/
local helper = base.h
local design = base.d
local ui = base.i
local mats = base.m
local cvar = base.v
/*
* Localized lua funcs
*
* absolutely hate having to do this, but for squeezing out every bit of performance, we need to.
*/
local pairs = pairs
local type = type
local tostring = tostring
local IsValid = IsValid
local istable = istable
local isfunction = isfunction
local isnumber = isnumber
local IsColor = IsColor
local Color = Color
local ScreenScale = ScreenScale
local gui = gui
local vgui = vgui
local table = table
local math = math
local surface = surface
local draw = draw
local string = string
local sf = string.format
/*
* helper :: predefined materials
*
* list of internal gmod mat paths
*/
helper._vgui =
{
[ 'avatarimage' ] = 'AvatarImage',
[ 'avatar' ] = 'AvatarImage',
[ 'av' ] = 'AvatarImage',
[ 'dbinder' ] = 'DBinder',
[ 'binder' ] = 'DBinder',
[ 'dbubblecontainer' ] = 'DBubbleContainer',
[ 'bubble' ] = 'DBubbleContainer',
[ 'dbutton' ] = 'DButton',
[ 'button'] = 'DButton',
[ 'btn'] = 'DButton',
[ 'dcategorylist' ] = 'DCategoryList',
[ 'categories' ] = 'DCategoryList',
[ 'catlst' ] = 'DCategoryList',
[ 'catlist' ] = 'DCategoryList',
[ 'dcheckbox' ] = 'DCheckBox',
[ 'checkbox' ] = 'DCheckBox',
[ 'chkbox' ] = 'DCheckBox',
[ 'cbox' ] = 'DCheckBox',
[ 'cb' ] = 'DCheckBox',
[ 'dcollapsiblecategory' ] = 'DCollapsibleCategory',
[ 'catexpand' ] = 'DCollapsibleCategory',
[ 'dcolorcombo' ] = 'DColorCombo',
[ 'clrcombo' ] = 'DColorCombo',
[ 'clrcbo' ] = 'DColorCombo',
[ 'dcolorcube' ] = 'DColorCube',
[ 'clrcube' ] = 'DColorCube',
[ 'dcolormixer' ] = 'DColorMixer',
[ 'clrmixer' ] = 'DColorMixer',
[ 'dcolorpalette' ] = 'DColorPalette',
[ 'clrpal' ] = 'DColorPalette',
[ 'dcolumnsheet' ] = 'DColumnSheet',
[ 'colsheet' ] = 'DColumnSheet',
[ 'dcombobox' ] = 'DComboBox',
[ 'combobox' ] = 'DComboBox',
[ 'cbo' ] = 'DComboBox',
[ 'dfilebrowser' ] = 'DFileBrowser',
[ 'file' ] = 'DFileBrowser',
[ 'dform' ] = 'DForm',
[ 'form' ] = 'DForm',
[ 'DFrame' ] = 'DFrame',
[ 'frame' ] = 'DFrame',
[ 'frm' ] = 'DFrame',
[ 'dgrid' ] = 'DGrid',
[ 'grid' ] = 'DGrid',
[ 'dhtml' ] = 'DHTML',
[ 'dweb' ] = 'DHTML',
[ 'html' ] = 'HTML',
[ 'web' ] = 'HTML',
[ 'dhtmlcontrols' ] = 'DHTMLControls',
[ 'dhtmlctrls' ] = 'DHTMLControls',
[ 'ctrls' ] = 'DHTMLControls',
[ 'dhtmctrl' ] = 'DHTMLControls',
[ 'htmctrl' ] = 'DHTMLControls',
[ 'dcbar' ] = 'DHTMLControls',
[ 'diconlayout' ] = 'DIconLayout',
[ 'iconlayout' ] = 'DIconLayout',
[ 'dico' ] = 'DIconLayout',
[ 'ilayout' ] = 'DIconLayout',
[ 'il' ] = 'DIconLayout',
[ 'dimage' ] = 'DImage',
[ 'img' ] = 'DImage',
[ 'dlabel' ] = 'DLabel',
[ 'label' ] = 'DLabel',
[ 'lbl' ] = 'DLabel',
[ 'dlistlayout' ] = 'DListLayout',
[ 'lstlayout' ] = 'DListLayout',
[ 'lstlo' ] = 'DListLayout',
[ 'listview' ] = 'DListView',
[ 'lstview' ] = 'DListView',
[ 'dmenu' ] = 'DMenu',
[ 'menu' ] = 'DMenu',
[ 'mnu' ] = 'DMenu',
[ 'dmenubar' ] = 'DMenuBar',
[ 'menubar' ] = 'DMenuBar',
[ 'mnubar' ] = 'DMenuBar',
[ 'menuopt' ] = 'DMenuOption',
[ 'mnuopt' ] = 'DMenuOption',
[ 'menucvar' ] = 'DMenuOptionCVar',
[ 'mnucvar' ] = 'DMenuOptionCVar',
[ 'dmodelpanel' ] = 'DModelPanel',
[ 'model' ] = 'DModelPanel',
[ 'mdl' ] = 'DModelPanel',
[ 'modelselect' ] = 'DModelSelect',
[ 'mdlsel' ] = 'DModelSelect',
[ 'notify' ] = 'DNotify',
[ 'numscale' ] = 'DNumberScratch',
[ 'numscratch' ] = 'DNumberScratch',
[ 'numwang' ] = 'DNumberWang',
[ 'numslider' ] = 'DNumSlider',
[ 'dpanel' ] = 'DPanel',
[ 'pnl' ] = 'DPanel',
[ 'dprogress' ] = 'DProgress',
[ 'progress' ] = 'DProgress',
[ 'prog' ] = 'DProgress',
[ 'dproperties' ] = 'DProperties',
[ 'prop' ] = 'DProperties',
[ 'psheet' ] = 'DPropertySheet',
[ 'rgb' ] = 'DRGBPicker',
[ 'dscrollpanel' ] = 'DScrollPanel',
[ 'scrollpanel' ] = 'DScrollPanel',
[ 'scrollpnl' ] = 'DScrollPanel',
[ 'spanel' ] = 'DScrollPanel',
[ 'spnl' ] = 'DScrollPanel',
[ 'dsp' ] = 'DScrollPanel',
[ 'sgrip' ] = 'DScrollBarGrip',
[ 'grip' ] = 'DScrollBarGrip',
[ 'autosize' ] = 'DSizeToContents',
[ 'slider' ] = 'DSlider',
[ 'sprite' ] = 'DSprite',
[ 'tab' ] = 'DTab',
[ 'dtextentry' ] = 'DTextEntry',
[ 'dte' ] = 'DTextEntry',
[ 'entry' ] = 'DTextEntry',
[ 'txt' ] = 'DTextEntry',
[ 'dt' ] = 'DTextEntry',
[ 'dtilelayout' ] = 'DTileLayout',
[ 'tlayout' ] = 'DTileLayout',
[ 'tlo' ] = 'DTileLayout',
[ 'tip' ] = 'DTooltip',
[ 'tooltip' ] = 'DTooltip',
[ 'dtree' ] = 'DTree',
[ 'tree' ] = 'DTree',
[ 'treenode' ] = 'DTree_Node',
[ 'node' ] = 'DTree_Node',
[ 'treebtn' ] = 'DTree_Node_Button',
[ 'nodebtn' ] = 'DTree_Node_Button',
[ 'vdivider' ] = 'DVerticalDivider',
[ 'verdiv' ] = 'DVerticalDivider',
[ 'vsbar' ] = 'DVScrollBar',
[ 'geditable' ] = 'EditablePanel',
[ 'gpanel' ] = 'Panel',
[ 'material' ] = 'Material',
[ 'mat' ] = 'Material',
[ 'panellist' ] = 'PanelList',
[ 'panellst' ] = 'PanelList',
[ 'pnllist' ] = 'PanelList',
[ 'rtxt' ] = 'RichText',
[ 'rt' ] = 'RichText',
}
/*
* helper :: ui :: id preferences
*/
helper._vgui_id =
{
[ 1 ] = 'DFrame',
[ 2 ] = 'DPanel',
[ 3 ] = 'Panel',
[ 4 ] = 'EditablePanel',
}
/*
* dock definitions
*
* in addition to default glua enums assigned to docking,
* the following entries can be used.
*/
local dock_align =
{
[ 'fill' ] = FILL,
[ 'left' ] = LEFT,
[ 'top' ] = TOP,
[ 'right' ] = RIGHT,
[ 'bottom' ] = BOTTOM,
[ 'f' ] = FILL,
[ 'l' ] = LEFT,
[ 't' ] = TOP,
[ 'r' ] = RIGHT,
[ 'b' ] = BOTTOM,
}
/*
* interface :: cvars :: define
*
* cvars to be used throughout the interface
*/
ui.cvars =
{
{ sid = 1, stype = 'dropdown', is_visible = false, id = 'rlib_language', name = 'Preferred language', desc = 'default interface language', forceset = false, default = 'en' },
{ sid = 1, stype = 'checkbox', is_visible = true, id = 'rlib_animations_enabled', name = 'Animations enabled', desc = 'interface animations', forceset = false, default = 1 },
{ sid = 2, stype = 'checkbox', is_visible = true, id = 'console_timestamps', name = 'Show timestamps in console', desc = 'show timestamp in logs', forceset = false, default = 0 },
}
/*
* Localized translation func
*/
local function lang( ... )
return base:lang( ... )
end
/*
* prefix ids
*/
local function pid( str, suffix )
local state = ( isstring( suffix ) and suffix ) or ( base and base.manifest.prefix ) or false
return rlib.get:pref( str, state )
end
/*
* metatables
*/
local dmeta = FindMetaTable( 'Panel' )
/*
* ui :: element
*
* gets the correct element based on the class provided
*
* @param : str class
* @return : str
*/
function ui.element( class )
class = helper.str:clean( class )
return ( class and helper._vgui and helper._vgui[ class ] or class ) or false
end
/*
* ui :: getscale
*/
function ui:GetScale( )
return math.Clamp( ScrH( ) / 1080, 0.75, 1 )
end
/*
* ui :: scale
*
* standard scaling
*
* @param : int iclamp
* @return : int
*/
function ui:scale( iclamp )
return math.Clamp( ScrW( ) / 1920, iclamp or 0.75, 1 )
end
/*
* ui :: Scale640
*
* works similar to glua ScreenScale( )
*
* @param : int val
* @param : int iMax
* @return : int
*/
function ui:Scale640( val, iMax )
iMax = isnumber( iMax ) and iMax or ScrW( )
return val * ( iMax / 640.0 )
end
/*
* ui :: controlled scale
*
* a more controlled solution to screen scaling because I dislike how doing simple ScreenScaling never
* makes things perfect.
*
* yes I know, an rather odd way, but it works for the time being.
*
* -w 800 -h 600
* -w 1024 -h 768
* -w 1280 -h 720
* -w 1366 -h 768
* -w 1920 -h -1080
*
* @note : deprecated in a future version with new system
*
* @param : bool bSimple
* @param : int i800
* @param : int i1024
* @param : int i1280
* @param : int i1366
* @param : int i1600
* @param : int i1920
* @param : int i2xxx
* @return : int
*/
function ui:cscale( bSimple, i800, i1024, i1280, i1366, i1600, i1920, i2xxx )
if not isbool( bSimple ) then
log( 2, 'func [ %s ]: bSimple not bool', debug.getinfo( 1, 'n' ).name )
end
if not i800 then
log( 2, 'func [ %s ]: no scale int specified', debug.getinfo( 1, 'n' ).name )
end
if not i1024 then i1024, i1280, i1366, i1600, i1920, i2xxx = i800, i800, i800, i800, i800, i800 end
if not i1280 then i1280, i1366, i1600, i1920, i2xxx = i800, i800, i800, i800, i800 end
if not i1366 then i1366, i1600, i1920, i2xxx = i1280, i1280, i1280, i1280 end
if not i1600 then i1600, i1920, i2xxx = i1366, i1366, i1366 end
if not i1920 then i1920, i2xxx = i1600, i1600 end
if not i2xxx then i2xxx = i1920 end
if ScrW( ) <= 800 then
return bSimple and i800 or ScreenScale( i800 )
elseif ScrW( ) > 800 and ScrW( ) <= 1024 then
return bSimple and i1024 or ScreenScale( i1024 )
elseif ScrW( ) > 1024 and ScrW( ) <= 1280 then
return bSimple and i1280 or ScreenScale( i1280 )
elseif ScrW( ) > 1280 and ScrW( ) <= 1366 then
return bSimple and i1366 or ScreenScale( i1366 )
elseif ScrW( ) > 1366 and ScrW( ) <= 1600 then
return bSimple and i1600 or ScreenScale( i1600 )
elseif ScrW( ) > 1600 and ScrW( ) <= 1920 then
return bSimple and i1920 or ScreenScale( i1920 )
elseif ScrW( ) > 1920 then
return bSimple and i2xxx or self:Scale640( i1920, 1920 )
end
end
/*
* ui :: smartscale :: strict
*
* a more controlled solution to screen scaling because I dislike how doing simple ScreenScaling never
* makes things perfect.
*
* yes I know, an rather odd way, but it works for the time being.
*
* -w 800 -h 600
* -w 1024 -h 768
* -w 1280 -h 720
* -w 1366 -h 768
* -w 1920 -h -1080
*
* @note : deprecated in a future version with new system
*
* @param : bool bSimple
* @param : int i800
* @param : int i1024
* @param : int i1280
* @param : int i1366
* @param : int i1600
* @param : int i1920
* @param : int i2560
* @return : int
*/
function ui:SmartScale_Strict( bSimple, i800, i1024, i1280, i1366, i1600, i1920, i2560 )
if not isbool( bSimple ) then
log( 2, 'func [ %s ]: bSimple not bool', debug.getinfo( 1, 'n' ).name )
end
if not i800 then
log( 2, 'func [ %s ]: no scale int specified', debug.getinfo( 1, 'n' ).name )
end
if not i1024 then i1024, i1280, i1366, i1600, i1920, i2560 = i800, i800, i800, i800, i800, i800 end
if not i1280 then i1280, i1366, i1600, i1920, i2560 = i800, i800, i800, i800, i800 end
if not i1366 then i1366, i1600, i1920, i2560 = i1280, i1280, i1280, i1280 end
if not i1600 then i1600, i1920, i2560 = i1366, i1366, i1366 end
if not i1920 then i1920, i2560 = i1600, i1600 end
if not i2560 then i2560 = i1920 end
if ScrW( ) <= 800 then
return bSimple and i800 or ScreenScale( i800 )
elseif ScrW( ) > 800 and ScrW( ) <= 1024 then
return bSimple and i1024 or ScreenScale( i1024 )
elseif ScrW( ) > 1024 and ScrW( ) <= 1280 then
return bSimple and i1280 or ScreenScale( i1280 )
elseif ScrW( ) > 1280 and ScrW( ) <= 1366 then
return bSimple and i1366 or ScreenScale( i1366 )
elseif ScrW( ) > 1366 and ScrW( ) <= 1600 then
return bSimple and i1600 or ScreenScale( i1600 )
elseif ScrW( ) > 1600 and ScrW( ) <= 1920 then
return bSimple and i1920 or ScreenScale( i1920 )
elseif ScrW( ) > 1920 then
return bSimple and i2560 or self:Scale640( i2560, 2560 )
end
end
/*
* ui :: clamp scale
*
* scale utilizing a clamped w and h value
*
* @param : int w
* @param : int h
* @return : int w, h
*/
function ui:ClampScale( w, h )
h = isnumber( h ) and h or w
return math.Clamp( 1920, 0, ScrW( ) / w ), math.Clamp( 1080, 0, ScrH( ) / h )
end
/*
* ui :: clamp scale :: width
*
* clamp a width value
*
* @param : int w
* @param : int min
* @param : int max
* @return : int
*/
function ui:ClampScale_w( w, min, max )
w = isnumber( w ) and w or ScrW( )
return math.Clamp( ScreenScale( w ), min or 0, max or ScreenScale( w ) )
end
/*
* ui :: clamp scale :: height
*
* clamp a height value
*
* @param : int h
* @param : int min
* @param : int max
* @return : int
*/
function ui:ClampScale_h( h, min, max )
h = isnumber( h ) and h or ScrH( )
return math.Clamp( ScreenScale( h ), min or 0, max or ScreenScale( h ) )
end
/*
* ui :: basic scale
*
* basic scaling control
*
* @note : deprecated in future
*
* @param : int s
* @param : int m
* @param : int l
* @return : int
*/
function ui:bscale( s, m, l )
if not m then m = s end
if not l then l = s end
if ScrW( ) <= 1280 then
return ScreenScale( s )
elseif ScrW( ) >= 1281 and ScrW( ) <= 1600 then
return ScreenScale( m )
elseif ScrW( ) >= 1601 then
return ScreenScale( l )
else
return s
end
end
/*
* ui :: scalesimple
*
* simple scaling
*
* @note : deprecated in future
*
* @param : int s
* @param : int m
* @param : int l
* @return : int
*/
function ui:scalesimple( s, m, l )
if not m then m = s end
if not l then l = s end
if ScrW( ) <= 1280 then
return s
elseif ScrW( ) >= 1281 and ScrW( ) <= 1600 then
return m
elseif ScrW( ) >= 1601 then
return l
else
return s
end
end
/*
* ui :: setscale
*
* calculates the screenscaled size (w, h) of a panel
*
* @param : int w
* @param : int h
* @return : int, int
*/
function ui:setscale( w, h )
w = isnumber( w ) and w or 300
h = isnumber( h ) and h or w
local sc_w, sc_h = self:scalesimple( 0.85, 0.85, 0.90 ), self:scalesimple( 0.85, 0.85, 0.90 )
local pnl_w, pnl_h = w, h
local ui_w, ui_h = sc_w * pnl_w, sc_h * pnl_h
return ui_w, ui_h
end
/*
* ui :: valid
*
* checks validation of a panel
* uses this vs isvalid for future control
*
* @param : pnl pnl
* @return : bool
*/
function ui:valid( pnl )
return IsValid( pnl ) and true or false
end
/*
* ui :: update
*
* executes invalidatelayout if pnl valid
*
* @alias : rehash, invalidate
*
* @param : pnl pnl
* @return : void
*/
function ui:rehash( pnl )
if not self:valid( pnl ) then return end
pnl:InvalidateLayout( )
end
ui.invalidate = ui.rehash
/*
* ui :: clear
*
* clears an interface
*
* @param : pnl pnl
*/
function ui:clear( pnl )
if not self:valid( pnl ) then return end
pnl:Clear( )
end
/*
* ui :: close
*
* hides or removes the DFrame, and calls DFrame:OnClose.
* to set whether the frame is hidden or removed, use DFrame:SetDeleteOnClose.
*
* @param : pnl pnl
*/
function ui:close( pnl )
if not self:valid( pnl ) then return end
pnl:Close( )
end
/*
* ui :: visible
*
* checks a panel for validation and if currently visible
*
* @param : pnl pnl
* @return : bool
*/
function ui:visible( pnl )
return self:valid( pnl ) and pnl:IsVisible( ) and true or false
end
/*
* ui :: destroy
*
* checks a panel for validation and then removes it completely.
*
* @param : pnl pnl
* @param : bool halt
* @param : bool kmouse [optional]
* @param : pnl subpanel [optional]
*/
function ui:destroy( pnl, halt, kmouse, sub )
if sub and not self:valid( sub ) then return end
if self:valid( pnl ) then pnl:Remove( ) end
if kmouse then
gui.EnableScreenClicker( false )
end
if halt then return false end
end
/*
* ui :: destroy visible
*
* checks a panel for validation and visible then removes it completely.
*
* @param : pnl pnl
*/
function ui:destroy_visible( pnl )
if self:valid( pnl ) and self:visible( pnl ) then
pnl:Remove( )
end
end
/*
* ui :: hide
*
* checks a panel for validation and if its currently visible and then sets panel visibility to false.
*
* @param : pnl pnl
* @param : bool kmouse
*/
function ui:hide( pnl, kmouse )
if self:valid( pnl ) then
pnl:SetVisible( false )
if kmouse then
gui.EnableScreenClicker( false )
end
end
end
/*
* ui :: autosize
*
* applies SizeToContents( ) to specified pnl
*
* @param : pnl pnl
*/
function ui:autosize( pnl )
if not self:visible( pnl ) then return end
pnl:SizeToContents( )
end
/*
* ui :: hide visible
*
* checks a panel for validation and if its currently visible and then sets panel visibility to false.
*
* @param : pnl pnl
* @param : bool kmouse
*/
function ui:hide_visible( pnl, kmouse )
if self:valid( pnl ) and self:visible( pnl ) then
pnl:SetVisible( false )
if kmouse then
gui.EnableScreenClicker( false )
end
end
end
/*
* ui :: show
*
* checks a panel for validation and if its not currently visible and then sets panel to visible.
*
* @param : pnl pnl
* @param : bool kmouse
*/
function ui:show( pnl, kmouse )
if self:valid( pnl ) and not self:visible( pnl ) then
pnl:SetVisible( true )
if kmouse then
gui.EnableScreenClicker( true )
end
end
end
/*
* ui :: visibility flip
*
* determines if a panel is currently either visible or not and then flips the panel visibility status.
*
* providing a sub panel will check both the parent and sub for validation, but only flip the sub panel
* if the parent panel is valid.
*
* @param : pnl pnl
* @param : pnl sub
*/
function ui:visible_flip( pnl, sub )
if not self:valid( pnl ) then return end
if sub then
if not self:valid( sub ) then return end
else
sub = pnl
end
if self:visible( pnl ) then
sub:SetVisible( false )
else
sub:SetVisible( true )
end
end
/*
* ui :: set visible
*
* allows for a bool to be passed to determine if the pnl should be visible or not
*
* @param : pnl pnl
* @param : bool b
*/
function ui:setvisible( pnl, b )
if not self:valid( pnl ) then return end
pnl:SetVisible( b or false )
end
/*
* ui :: setpos
*
* checks an obj for validation and sets its position
*
* @param : pnl pnl
* @param : int x
* @param : int y
*/
function ui:pos( pnl, x, y )
x = x or 0
y = y or 0
if self:valid( pnl ) and self:visible( pnl ) then
pnl:SetPos( x, y )
end
end
/*
* ui :: movecenter
*
* anim to move panel to center
*
* can be used as
* panel:MoveTo( base.h.movetocenter( p_size_w, p_size_h, 0.4 ) )
*
* @param : int w
* @param : int h
* @param : int time
* @return : int (w), int (h)
*/
function ui:movecenter( w, h, time )
if not time then time = 0.5 end
return ScrW( ) / 2 - math.Clamp( 1920, 0, ScrW( ) / w ) / 2, ScrH( ) / 2 - math.Clamp( 1080, 0, ScrH( ) / h ) / 2, time, 0, -1
end
/*
* ui :: pos :: center
*
* animation to move panel to center
*
* dframes may not allow top-down animations to work properly and start the panel off-screen, so the
* effect may not be as desired.
*
* @param : pnl pnl
* @param : int time
* @param : str, int from :: [optional] :: default left
*/
function ui:pos_center( pnl, time, from )
if not self:valid( pnl ) then return end
local w, h = pnl:GetSize( )
time = isnumber( time ) and time or 0
from = from or 3
local init_w, init_h = -w, ( ScrH( ) / 2 ) - ( h / 2 )
local move_w, move_h = ScrW( ) / 2 - w / 2, ScrH( ) / 2 - h / 2
if ( from == 'top' or from == 2 ) then
init_w, init_h = ScrW( ) / 2 - w / 2, - h
elseif ( from == 'right' or from == 3 ) then
init_w, init_h = ScrW( ) + w, ( ScrH( ) / 2 ) - ( h / 2 )
elseif ( from == 'bottom' or from == 4 ) then
init_w, init_h = ScrW( ) / 2 - w / 2, ScrH( ) + h
end
-- for testing even though time should never be zero
if not time then
init_w, init_h = move_w, move_h
end
pnl:SetPos( init_w, init_h )
pnl:MoveTo( move_w, move_h, time, 0, -1 )
end
/*
* ui :: pos :: anim
*
* forces a pnl to center screen based on animation settings
*
* @param : pnl pnl
* @param : int time
* @param : str, int from :: [optional] :: default left
*/
function ui:pos_anim( pnl, time, from )
if not self:visible( pnl ) then return end
time = isnumber( time ) and time or 0.4
from = isnumber( from ) and from or 4
if cvar:GetBool( 'rlib_animations_enabled' ) then
self:pos_center( pnl, time, from )
else
self:pos_center( pnl )
end
end
/*
* ui :: settext
*
* method to setting text
*
* @param : pnl pnl
* @param : str text
* @param : str font
*/
function ui:settext( pnl, text, font )
if not self:valid( pnl ) then return end
text = isstring( text ) and text or ''
if font then
pnl:SetFont( font )
end
pnl:SetText( text )
end
/*
* ui :: register panel
*
* creates a usable panel that may need to be accessed globally. Do not store local panels using
* this method.
*
* places registered pnl in :: base.p[ mod ][ panel_id ]
*
* @param : str id
* @param : str mod
* @param : pnl pnl
* @param : str desc
*/
function ui:register( id, mod, panel, desc )
if not helper.str:valid( id ) then
log( 2, lang( 'inf_reg_id_invalid' ) )
return false
end
mod = ( isstring( mod ) and mod ) or ( istable( mod ) and mod.id ) or prefix
base.p = istable( base.p ) and base.p or { }
id = helper.str:clean( id )
if ui:valid( panel ) then
base.p[ mod ] = base.p[ mod ] or { }
base.p[ mod ][ id ] =
{
pnl = panel,
desc = desc or lang( 'none' )
}
log( 6, lang( 'inf_registered', id ) )
end
end
/*
* ui :: registered :: load
*
* loads a previously registered panel
*
* @ex : local content = ui:load( 'pnl.parent.content', 'xtask' )
^ if not content or not ui:valid( content.pnl ) then return end
^ content.pnl:Clear( )
*
* @param : str id
* @param : str, tbl mod
* @return : tbl
*/
function ui:load( id, mod )
if not helper.str:valid( id ) then
log( 2, lang( 'inf_load_id_invalid' ) )
return false
end
mod = ( isstring( mod ) and mod ) or ( istable( mod ) and mod.id ) or prefix
if not istable( base.p ) then
log( 2, lang( 'inf_load_tbl_invalid' ) )
return false
end
id = helper.str:clean( id )
if not istable( base.p[ mod ] ) or not istable( base.p[ mod ][ id ] ) then return end
return IsValid( base.p[ mod ][ id ].pnl ) and base.p[ mod ][ id ] or false
end
/*
* ui :: registered :: call panel
*
* calls a previously registered panel similar to ui.load
* but this validates and calls just the panel.
*
* @ex : local pnl = ui:call( id, mod )
* if not pnl then return end
*
* @param : str id
* @param : str, tbl mod
* @return : tbl
*/
function ui:call( id, mod )
if not helper.str:valid( id ) then
log( 2, lang( 'inf_load_id_invalid' ) )
return false
end
mod = ( isstring( mod ) and mod ) or ( istable( mod ) and mod.id ) or prefix
if not istable( base.p ) then
log( 2, lang( 'inf_load_tbl_invalid' ) )
return false
end
id = helper.str:clean( id )
if not istable( base.p[ mod ] ) or not istable( base.p[ mod ][ id ] ) then return end
return IsValid( base.p[ mod ][ id ].pnl ) and base.p[ mod ][ id ].pnl or false
end
/*
* ui :: unregister panel
*
* removes a registered panel from the library
*
* @param : str id
* @param : str, tbl mod
*/
function ui:unregister( id, mod )
if not helper.str:valid( id ) then
log( 2, lang( 'inf_unreg_id_invalid' ) )
return false
end
mod = isstring( mod ) and mod or prefix
if not istable( base.p ) then
log( 2, lang( 'inf_unreg_tbl_invalid' ) )
return false
end
id = helper.str:clean( id )
if base.p[ mod ] and base.p[ mod ][ id ] then
base.p[ mod ][ id ] = nil
log( 6, lang( 'inf_unregister', id ) )
end
end
/*
* ui :: create
*
* utilities vgui.Register as a shortcut
* used for pnls registered under the rlib:resources( ) method
*
* if no class provided; defaults to DFrame
*
* @ex : ui:create( mod, 'bg', PANEL, 'pnl' )
* : ui:create( mod, 'bg', PANEL )
* : ui:create( mod, 'bg', PANEL, 1 )
* : ui:create( mod, 'bg', PANEL, 2 )
*
* @param : tbl mod
* @param : str id
* @param : pnl pnl
* @param : str, int class
*/
function ui:create( mod, id, pnl, class )
if not id or not pnl then return end
local call = rlib:resource( mod, 'pnl', id )
if isnumber( class ) then
class = helper._vgui_id[ class ]
elseif isstring( class ) then
class = ( class and ui.element( class ) )
else
class = 'DFrame'
end
vgui.Register( call, pnl, class )
end
/*
* ui :: validate registered pnl
*
* determines if a registered pnl is valid
*
* @param : str panel
* @return : bool
*/
function ui:ok( panel )
if not panel then return false end
return ( panel and self:valid( panel.pnl ) and true ) or false
end
/*
* ui :: registered :: dispatch
*
* destroys a registered pnl
* ensures a pnl is a valid pnl first
*
* @param : str id
* @param : str, tbl mod
* @return : void
*/
function ui:dispatch( id, mod )
if not helper.str:valid( id ) then
log( 2, lang( 'inf_load_id_invalid' ) )
return
end
local pnl = ui:call( id, mod )
if not pnl then return end
self:unregister( id, mod )
self:destroy( pnl )
end
/*
* ui :: registered :: stage
*
* shows a registered pnl
* ensures a pnl is a valid pnl first
*
* @param : str id
* @param : str, tbl mod
* @return : void
*/
function ui:stage( id, mod )
if not helper.str:valid( id ) then
log( 2, lang( 'inf_load_id_invalid' ) )
return
end
local pnl = ui:call( id, mod )
if not pnl then return end
self:show( pnl )
end
/*
* ui :: registered :: unstage
*
* hides a registered pnl
* ensures a pnl is a valid pnl first
*
* @param : str id
* @param : str, tbl mod
* @return : void
*/
function ui:unstage( id, mod )
if not helper.str:valid( id ) then
log( 2, lang( 'inf_load_id_invalid' ) )
return
end
local pnl = ui:call( id, mod )
if not pnl then return end
self:hide( pnl )
end
/*
* ui :: create fonts
*
* creates a generic set of fonts to be used with the library
*
* @param : str suffix
* @param : str font
* @param : int scale [ optional ]
*/
function ui:fonts_register( suffix, font, scale )
suffix = isstring( suffix ) and suffix or prefix
font = isstring( font ) and font or pid( 'sys_entry_default' )
scale = isnumber( scale ) and scale or self:scale( )
local char_last = string.sub( suffix, -1 )
local font_sz =
{
[ 12 ] = '12',
[ 14 ] = '14',
[ 16 ] = '16',
[ 18 ] = '18',
[ 20 ] = '20',
[ 24 ] = '24',
[ 32 ] = '32',
}
local font_wgts =
{
[ 400 ] = '400',
[ 600 ] = '600',
[ 800 ] = '800',
}
if char_last ~= '.' then
suffix = suffix .. '.'
end
for sz, sz_name in pairs( font_sz ) do
local calc_sz = sz * scale
surface.CreateFont( suffix .. sz_name, { font = font, size = calc_sz } )
for wg, wg_name in pairs( font_wgts ) do
surface.CreateFont( suffix .. sz_name .. '.' .. wg_name, { font = font, size = calc_sz, weight = 600 } )
end
end
end
/*
* ui :: html :: img :: full
*
* returns an html element supporting outside images
* typically used for ui backgrounds
*
* @param : tbl, str src
* @param : bool bRand
* @return : str
*/
function ui:html_img_full( src, bRand )
local resp = bRand and table.Random( src ) or isstring( src ) and src
return [[
<body style='overflow: hidden; height: auto; width: auto;'>
<img src=']] .. resp .. [[' style='position: absolute; height: 100%; width: 100%; top: 0%; left: 0%; margin: auto;'>
</body>
]]
end
/*
* ui :: html :: img
*
* returns an html element supporting outside images
* typically used for ui backgrounds
*
* @param : tbl, str src
* @param : bool bRand
* @return : str
*/
function ui:html_img( src, bRand )
local resp = bRand and table.Random( src ) or isstring( src ) and src
return [[
<body style='overflow: hidden; height: 100%; width: 100%; margin:0px;'>
<img width='100%' height='100%' src=']] .. resp .. [['>
</body>
]]
end
/*
* ui :: html :: size
*
* returns an html element supporting outside images
* allows for specific size to be provided
*
* @param : str src
* @param : int w
* @param : int h
* @return : str
*/
function ui:html_img_sz( src, w, h )
local resp = isstring( src ) and src or tostring( src )
h = isnumber( h ) and h or w
return [[
<body style='overflow: hidden; height: 100%; width: 100%; margin:0px;'>
<img width=']] .. w .. [[' height=']] .. h .. [[' src=']] .. resp .. [['>
</body>
]]
end
/*
* ui :: html :: iframe
*
* returns an html element supporting outside sites
* typically used for ui backgrounds / live wallpapers
*
* @param : tbl, str src
* @param : bool bRand
* @return : str
*/
function ui:html_iframe( src, bRand )
local resp = bRand and table.Random( src ) or isstring( src ) and src
return [[
<body style='overflow: hidden; height: 100%; width: 100%; margin:0px;'>
<iframe width='100%' frameborder='0' height='100%' src=']] .. resp .. [['></iframe>
</body>
]]
end
/*
* ui :: get :: svg
*
* utilized for svg resources
*
* @param : tbl, str src
* @param : bool bShow
* @return : str
*/
function ui:getsvg( src, bShow )
src = isstring( src ) and src or ''
local display = not bShow and 'display:none;' or ''
return [[
<body style='overflow: hidden; height: 100%; width: 100%; margin:0px;]] .. display .. [['>
<iframe width='100%' frameborder='0' height='100%' src=']] .. src .. [['></iframe>
</body>
]]
end
ui.OnHover = function( s ) return s:IsHovered( ) end
ui.OnHoverChild = function( s ) return s:IsHovered( ) or s:IsChildHovered( ) end
/*
* ui classes
*
* credit to threebow for the idea as he utilized such a method in tdlib.
* it makes creating new panels a lot more clean thanks to metatables
*
* ive obviously made my own changes and taken a slightly different
* direction, but the original idea is thanks to him
*
* this dude is the apple to my pie; and the straw to my berry.
*
* @source : https://github.com/Threebow/tdlib
*/
local uclass = { }
/*
* ui :: class :: Run
*
* @param : str name
* @param : func fn
*/
function uclass.run( pnl, name, fn )
if not name then return end
if not isfunction( fn ) then return end
name = pnl.Override or name
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
/*
* ui :: class :: NoPaint
*/
function uclass.nopaint( pnl )
pnl.Paint = nil
end
uclass.nostyle = uclass.nopaint
uclass.nodraw = uclass.nopaint
/*
* ui :: class :: paint
*
* @param : func fn
*/
function uclass.paint( pnl, fn )
if not isfunction( fn ) then return end
uclass.nopaint( pnl )
pnl[ 'Paint' ] = fn
end
uclass.style = uclass.paint
uclass.draw = uclass.paint
/*
* ui :: class :: paint :: save
*
* @param : func fn
*/
function uclass.savepaint( pnl )
pnl.OldPaint = pnl.Paint
end
uclass.savedraw = uclass.savepaint
/*
* ui :: class :: paint :: get
*
* @param : func fn
*/
function uclass.getpaint( pnl )
return pnl.OldPaint
end
uclass.getdraw = uclass.getpaint
/*
* ui :: class :: SetPaintedManually
*
* @param : bool b
*/
function uclass.paintmanual( pnl, b )
pnl:SetPaintedManually( b )
end
uclass.drawmanual = uclass.paintmanual
/*
* ui :: class :: Panel :: Name
*
* @param : str name
*/
function uclass.name( pnl, name )
if not name then return end
pnl:SetName( name )
end
/*
* ui :: class :: Panel :: SetConVar
*
* @param : str id
*/
function uclass.convar( pnl, id )
id = isstring( id ) and id or ''
pnl:SetConVar( id )
end
/*
* ui :: class :: Panel :: ConVarChanged
*
* @param : str val
*/
function uclass.convar_chg( pnl, val )
val = isstring( val ) and val or ''
pnl:ConVarChanged( val )
end
/*
* ui :: class :: Panel :: ConVarNumberThink
*/
function uclass.convar_think_int( pnl )
pnl:ConVarNumberThink( )
end
/*
* ui :: class :: Panel :: ConVarStringThink
*/
function uclass.convar_think_str( pnl )
pnl:ConVarStringThink( )
end
/*
* ui :: class :: convarname
*
* @alias : cvar
*
* @param : str id
*/
function uclass.cvar( pnl, id )
id = isstring( id ) and id or ''
pnl.convarname = id
end
/*
* ui :: class :: route
*
* @alias : route
*
* @param : str id
* @param : mix data
*/
function uclass.route( pnl, id, data )
if not id then return end
data = data or ''
pnl[ id ] = data
end
/*
* ui :: class :: attach
*
* @alias : attach
*
* @param : pnl child
*/
function uclass.attach( pnl, child )
if not ui:valid( child ) then return end
pnl:Attach( child )
end
/*
* ui :: class :: action
*
* @alias : action
*
* @param : func fn
*/
function uclass.action( pnl, fn )
if not isfunction( fn ) then return end
pnl:SetAction( fn )
end
/*
* ui :: class :: slider :: barcolor
*
* @alias : clr_bar
*
* @param : clr clr
*/
function uclass.clr_bar( pnl, clr )
if not clr then return end
pnl.BarColor = clr
end
/*
* ui :: class :: paint :: over
*
* @alias : paintover, drawover, po
*
* @param : func fn
*/
function uclass.paintover( pnl, fn )
if not isfunction( fn ) then return end
pnl[ 'PaintOver' ] = fn
end
uclass.drawover = uclass.paintover
uclass.po = uclass.paintover
/*
* ui :: class :: paint :: box
*
* @alias : paintbox, box, drawbox, pb
*
* @param : clr clr
* @param : int x
* @param : int y
* @param : int w
* @param : int h
*/
function uclass.paintbox( pnl, clr, x, y, w, h )
clr = IsColor( clr ) and clr or Color( 25, 25, 25, 255 )
x = isnumber( x ) and x or 0
y = isnumber( y ) and y or 0
local sz_w = isnumber( w ) and w or 0
local sz_h = isnumber( h ) and h or 0
uclass.nopaint( pnl )
pnl[ 'Paint' ] = function( s, w2, h2 )
local def_w = ( sz_w ~= 0 and sz_w ) or w2
local def_h = ( sz_h ~= 0 and sz_h ) or h2
design.box( x, y, def_w, def_h, clr )
end
end
uclass.box = uclass.paintbox
uclass.drawbox = uclass.paintbox
uclass.pb = uclass.paintbox
/*
* ui :: class :: paint :: entry
*
* @alias : paintentry, drawentry
*
* @param : clr clr_text
* @param : clr clr_cur
* @param : clr clr_hl
*/
function uclass.paintentry( pnl, clr_text, clr_cur, clr_hl )
clr_text = IsColor( clr_text ) and clr_text or Color( 255, 255, 255, 255 )
clr_cur = IsColor( clr_cur ) and clr_cur or Color( 150, 150, 150, 255 )
clr_hl = IsColor( clr_hl ) and clr_hl or Color( 25, 25, 25, 255 )
pnl[ 'Paint' ] = function( s, w, h )
s:SetTextColor ( clr_text )
s:SetCursorColor ( clr_cur )
s:SetHighlightColor ( clr_hl )
s:DrawTextEntryText ( s:GetTextColor( ), s:GetHighlightColor( ), s:GetCursorColor( ) )
end
end
uclass.drawentry = uclass.paintentry
/*
* ui :: class :: paint :: rounded box
*
* @alias : paintrbox, drawrbox, rbox
*
* @param : clr clr
* @param : int x
* @param : int y
* @param : int w
* @param : int h
*/
function uclass.paintrbox( pnl, clr, r, x, y, w, h )
clr = IsColor( clr ) and clr or Color( 25, 25, 25, 255 )
r = isnumber( r ) and r or 4
x = isnumber( x ) and x or 0
y = isnumber( y ) and y or 0
local sz_w = isnumber( w ) and w or 0
local sz_h = isnumber( h ) and h or 0
uclass.nopaint( pnl )
pnl[ 'Paint' ] = function( s, w2, h2 )
local def_w = ( sz_w ~= 0 and sz_w ) or w2
local def_h = ( sz_h ~= 0 and sz_h ) or h2
design.rbox( r, x, y, def_w, def_h, clr )
end
end
uclass.drawrbox = uclass.paintrbox
uclass.rbox = uclass.paintrbox
/*
* ui :: class :: debug :: where
*
* applies a simple painted box to the specified element to determine
* location on the screen
*
* @alias : debug_where, where
*
* @param : clr clr
*/
function uclass.debug_where( pnl, clr )
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
uclass.nopaint( pnl )
pnl[ 'PaintOver' ] = function( s, w, h )
design.box( 0, 0, w, h, clr )
end
end
uclass.where = uclass.debug_where
/*
* ui :: class :: PerformLayout
*
* @alias : performlayout, pl
*
* @param : func fn
*/
function uclass.performlayout( pnl, fn )
if not isfunction( fn ) then return end
local name = 'PerformLayout'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
uclass.pl = uclass.performlayout
/*
* ui :: class :: onclick
*
* @alias : onclick, oc
*
* @param : func fn
*/
function uclass.onclick( pnl, fn )
if not isfunction( fn ) then return end
local name = 'DoClick'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
uclass.oc = uclass.onclick
/*
* ui :: class :: onclick :: rem
*
* @alias : onclick_r, ocr, click_r
*
* @param : pnl panel
* @param : bool bHide
*/
function uclass.onclick_r( pnl, panel, bHide )
pnl[ 'DoClick' ] = function( s, ... )
if not ui:valid( panel ) then return end
if bHide then
ui:hide( panel )
else
ui:destroy( panel )
end
end
end
uclass.ocr = uclass.onclick_r
uclass.click_r = uclass.onclick_r
/*
* ui :: class :: onclick :: rem visible
*
* @alias : onclick_rv, ocrv
*
* @param : pnl panel
* @param : bool bHide
*/
function uclass.onclick_rv( pnl, panel, bHide )
pnl[ 'DoClick' ] = function( s, ... )
if not ui:valid( panel ) then return end
if bHide then
ui:hide( panel )
else
ui:destroy_visible( panel )
end
end
end
uclass.ocrv = uclass.onclick_rv
/*
* ui :: class :: onclick :: fade out
*
* @alias : onclick_fadeout, ocfo
*
* @param : pnl panel
* @param : int delay
* @param : bool bHide
*/
function uclass.onclick_fadeout( pnl, panel, delay, bHide )
pnl[ 'DoClick' ] = function( s, ... )
if not ui:valid( panel ) then return end
delay = isnumber( delay ) and delay or 1
panel:AlphaTo( 0, delay, 0, function( )
if bHide then
ui:hide( panel )
else
ui:destroy( panel )
end
end )
end
end
uclass.ocfo = uclass.onclick_fadeout
/*
* ui :: class :: onremove
*
* @alias : onremove, remove, orem
*
* @param : func fn
*/
function uclass.onremove( pnl, fn )
if not isfunction( fn ) then return end
local name = 'OnRemove'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
uclass.remove = uclass.onremove
uclass.orem = uclass.onremove
/*
* ui :: class :: OnTextChanged
*
* @alias : ontxtchg, otch
*
* @param : func fn
*/
function uclass.ontxtchg( pnl, fn )
if not isfunction( fn ) then return end
local name = 'OnTextChanged'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
uclass.otch = uclass.ontxtchg
/*
* ui :: class :: noedit
*
* supplying bUseForce will automatically reset text each time text changed.
* used as a workaround for times when SetEditable simply doesnt work.
*
* if bUseForce = true, src contains original text to replace box with
*
* @alias : noedit, tlock
*
* @param : func fn
* @param : str src
* @param : bool bUseForce
*/
function uclass.noedit( pnl, bUseForce, src )
if not bUseForce then
pnl:SetEditable( false )
return
end
pnl[ 'OnTextChanged' ] = function( s, ... )
if not isstring( src ) then return end
s:SetText( src )
end
end
uclass.tlock = uclass.noedit
/*
* ui :: class :: openurl
*
* @alias : openurl, ourl
*
* @param : str uri
*/
function uclass.openurl( pnl, uri )
if not isstring( uri ) then return end
pnl[ 'DoClick' ] = function( s )
gui.OpenURL( uri )
end
end
uclass.ourl = uclass.openurl
/*
* ui :: class :: OnSelect
*
* @alias : onselect, osel
*
* @param : func fn
*/
function uclass.onselect( pnl, fn )
if not isfunction( fn ) then return end
local name = 'OnSelect'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
uclass.osel = uclass.onselect
/*
* ui :: class :: DComboBox :: doclick
*
* @alias : cboclick, odc
*
* @param : func fn
*/
function uclass.cboclick( pnl, fn )
if not isfunction( fn ) then return end
pnl[ 'DoClick' ] = function( s, ... )
if s:IsMenuOpen( ) then return s:CloseMenu( ) end
fn( s, ... )
end
end
uclass.odc = uclass.cboclick
/*
* ui :: class :: DComboBox :: OpenMenu
*
* @alias : omenu
*
* @param : func fn
*/
function uclass.omenu( pnl, fn )
if not isfunction( fn ) then return end
local name = 'OpenMenu'
local orig = pnl[ name ]
pnl[ name ] = function( ... )
if isfunction( orig ) then orig( ... ) end
fn( ... )
end
end
/*
* ui :: class :: DTextEntry :: m_bLoseFocusOnClickAway
*
* @alias : onclick_nofocus, ocnf
*
* @param : bool b
*/
function uclass.onclick_nofocus( pnl, b )
pnl.m_bLoseFocusOnClickAway = b or false
end
uclass.ocnf = uclass.onclick_nofocus
/*
* ui :: class :: OnGetFocus
*
* @alias : ongetfocus, ogfo, getfocus
*
* @param : func fn
*/
function uclass.ongetfocus( pnl, fn )
if not isfunction( fn ) then return end
local name = 'OnGetFocus'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
uclass.ogfo = uclass.ongetfocus
uclass.getfocus = uclass.ongetfocus
uclass.ogfocus = uclass.ongetfocus
/*
* ui :: class :: DNum :: OnValueChanged
*
* @alias : onvaluechanged, ovc
*
* @param : func fn
*/
function uclass.onvaluechanged( pnl, fn )
if not isfunction( fn ) then return end
local name = 'OnValueChanged'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
uclass.ovc = uclass.onvaluechanged
/*
* ui :: class :: DTextEntry :: OnChange
*
* @alias : onchange, ochg
*
* @param : func fn
*/
function uclass.onchange( pnl, fn )
if not isfunction( fn ) then return end
pnl[ 'OnChange' ] = fn
end
uclass.ochg = uclass.onchange
/*
* ui :: class :: onOptionChanged
*
* @alias : onoptchange, ooc
*
* @param : func fn
*/
function uclass.onoptchange( pnl, fn )
if not isfunction( fn ) then return end
local name = 'onOptionChanged'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
uclass.ooc = uclass.onoptchange
/*
* ui :: class :: enabled :: check
*
* @alias : enabled_chk, echk
*
* @param : func fn
*/
function uclass.enabled_chk( pnl, fn )
if not isfunction( fn ) then return end
local name = 'enabled'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
uclass.echk = uclass.enabled_chk
/*
* ui :: class :: onclose
*
* @alias : onclose
*
* @param : func fn
*/
function uclass.onclose( pnl, fn )
if not isfunction( fn ) then return end
local name = 'OnClose'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
/*
* ui :: class :: think
*
* @alias : think, logic
*
* @param : func fn
*/
function uclass.think( pnl, fn )
if not isfunction( fn ) then return end
local name = 'Think'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
uclass.logic = uclass.think
/*
* ui :: class :: DModelPanel :: norotate
*
* forces dmodelpanel to not auto-rotate the model
*
* @alias : norotate
*/
function uclass.norotate( pnl )
pnl[ 'LayoutEntity' ] = function( s, ... ) return end
end
/*
* ui :: class :: DModelPanel :: LayoutEntity
*
* @alias : norotate, le
*/
function uclass.layoutent( pnl, fn )
if not isfunction( fn ) then return end
local name = 'LayoutEntity'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
uclass.le = uclass.layoutent
/*
* ui :: class :: DModelPanel :: onmousepress
*
* rerouted action to define particular mouse definitions
*
* @alias : onmouse, omp
*/
function uclass.onmouse( pnl )
pnl[ 'OnMousePressed' ] = function( s, act )
if pnl:IsHovered( ) or s.hover then
if act == MOUSE_LEFT and pnl.DoClick then pnl:DoClick( ) end
if act == MOUSE_RIGHT and pnl.DoRightClick then pnl:DoRightClick( ) end
if act == MOUSE_MIDDLE and pnl.DoMiddleClick then pnl:DoMiddleClick( ) end
end
end
end
uclass.omp = uclass.onmouse
/*
* ui :: class :: Dock
*
* @alias : dock, static
*
* @param : int pos
*/
function uclass.dock( pnl, pos )
pos = ( type( pos ) == 'number' and pos ) or ( dock_align[ pos ] ) or FILL
pnl:Dock( pos )
end
uclass.static = uclass.dock
/*
* ui :: class :: Dock :: left
*
* @alias : left
*/
function uclass.left( pnl )
pnl:Dock( LEFT )
end
/*
* ui :: class :: Dock :: top
*
* @alias : top
*/
function uclass.top( pnl )
pnl:Dock( TOP )
end
/*
* ui :: class :: Dock :: right
*
* @alias : right
*/
function uclass.right( pnl )
pnl:Dock( RIGHT )
end
/*
* ui :: class :: Dock :: bottom
*
* @alias : bottom
*/
function uclass.bottom( pnl )
pnl:Dock( BOTTOM )
end
/*
* ui :: class :: Dock :: fill
*
* @alias : fill
*/
function uclass.fill( pnl )
pnl:Dock( FILL )
end
/*
* ui :: class :: Dock, DockMargin
*
* @alias : docker, docker_m
*
* @param : int pos
* @param : int il
* @param : int it
* @param : int ir
* @param : int ib
*/
function uclass.docker( pnl, pos, il, it, ir, ib )
pos = ( type( pos ) == 'number' and pos ) or ( dock_align[ pos ] ) or FILL
il = isnumber( il ) and il or 0
if not it then it, ir, ib = il, il, il end
if not ir then ir, ib = it, it end
if not ib then ib = ir end
pnl:Dock( pos )
pnl:DockMargin( il, it, ir, ib )
end
uclass.docker_m = uclass.docker
/*
* ui :: class :: Dock, DockPadding
*
* @alias : docker_p
*
* @param : int pos
* @param : int il
* @param : int it
* @param : int ir
* @param : int ib
*/
function uclass.docker_p( pnl, pos, il, it, ir, ib )
pos = ( type( pos ) == 'number' and pos ) or ( dock_align[ pos ] ) or FILL
il = isnumber( il ) and il or 0
if not it then it, ir, ib = il, il, il end
if not ir then ir, ib = it, it end
if not ib then ib = ir end
pnl:Dock( pos )
pnl:DockPadding( il, it, ir, ib )
end
/*
* ui :: class :: DockPadding
*
* @alias : padding, dock_p
*
* @param : int il
* @param : int it
* @param : int ir
* @param : int ib
*/
function uclass.padding( pnl, il, it, ir, ib )
il = isnumber( il ) and il or 0
if not it then it, ir, ib = il, il, il end
if not ir then ir, ib = it, it end
if not ib then ib = ir end
pnl:DockPadding( il, it, ir, ib )
end
uclass.dock_p = uclass.padding
/*
* ui :: class :: DockMargin
*
* @alias : margin, dock_m
*
* @param : int il
* @param : int it
* @param : int ir
* @param : int ib
*/
function uclass.margin( pnl, il, it, ir, ib )
il = isnumber( il ) and il or 0
if not it then it, ir, ib = il, il, il end
if not ir then ir, ib = it, it end
if not ib then ib = ir end
pnl:DockMargin( il, it, ir, ib )
end
uclass.dock_m = uclass.margin
/*
* ui :: class :: Panel :: SetPadding
*
* @alias : offset, oset
*
* @param : int i
*/
function uclass.offset( pnl, i )
i = isnumber( i ) and i or 0
pnl:SetPadding( i )
end
uclass.oset = uclass.offset
/*
* ui :: class :: SetWide
*
* @alias : wide, width
*
* @param : int w
*/
function uclass.wide( pnl, w, err )
if isstring( w ) and w == 'screen' then
pnl:SetWide( ScrW( ) )
return
end
w = isnumber( w ) and w or 25
pnl:SetWide( w )
end
uclass.width = uclass.wide
/*
* ui :: class :: SetMinWidth
*
* @alias : minwide, wmin
*
* @param : int w
*/
function uclass.minwide( pnl, w )
w = isnumber( w ) and w or 30
pnl:SetMinWidth( w )
end
uclass.wmin = uclass.minwide
/*
* ui :: class :: SetTall
*
* @alias : tall, height
*
* @param : int h
*/
function uclass.tall( pnl, h )
if isstring( h ) and h == 'screen' then
pnl:SetTall( ScrH( ) )
return
end
h = isnumber( h ) and h or 25
pnl:SetTall( h )
end
uclass.height = uclass.tall
/*
* ui :: class :: SetMinHeight
*
* @alias : mintall, hmin
*
* @param : int h
*/
function uclass.mintall( pnl, h )
h = isnumber( h ) and h or 30
pnl:SetMinHeight( h )
end
uclass.hmin = uclass.mintall
/*
* ui :: class :: SetSize
*
* term 'scr' || w, h blank : autosize fullscreen based on resolution
* term 'scr' : autosize one particular dimension to full monitor resolution
*
* @alias : size, sz
*
* @param : int w, str
* @param : int h, str
*/
function uclass.size( pnl, w, h )
if not w or ( isstring( w ) and ( ( w == 'screen' ) or ( w == 'scr' ) ) ) then
pnl:SetSize( ScrW( ), ScrH( ) )
return
end
w = ( isnumber( w ) and w ) or ( isstring( w ) and ( w == 'screen' or w == 'scr' ) and ScrW( ) ) or 25
h = ( isnumber( h ) and h ) or ( isstring( h ) and ( h == 'screen' or h == 'scr' ) and ScrH( ) ) or w
pnl:SetSize( w, h )
end
uclass.sz = uclass.size
/*
* ui :: class :: SetPos
*
* @alias : pos
*
* @param : int x
* @param : int y
*/
function uclass.pos( pnl, x, y )
x = isnumber( x ) and x or 0
y = isnumber( y ) and y or isnumber( x ) and x or 0
pnl:SetPos( x, y )
end
/*
* ui :: class :: SetSpaceX
*
* @alias : space_x
*
* @param : int i
*/
function uclass.space_x( pnl, i )
i = isnumber( i ) and i or 0
pnl:SetSpaceX( i )
end
/*
* ui :: class :: SetSpaceY
*
* @alias : space_y
*
* @param : int i
*/
function uclass.space_y( pnl, i )
i = isnumber( i ) and i or 0
pnl:SetSpaceY( i )
end
/*
* ui :: class :: SetSpaceX, SetSpaceY
*
* @alias : spacing, space_xy
*
* @param : int x
* @param : int y
*/
function uclass.spacing( pnl, x, y )
x = isnumber( x ) and x or 0
y = isnumber( y ) and y or isnumber( x ) and x or 0
pnl:SetSpaceX( x )
pnl:SetSpaceY( y )
end
uclass.space_xy = uclass.spacing
/*
* ui :: class :: DIconLayout :: SetLayoutDir
*
* sets the direction that it will be layed out, using the DOCK_ Enums.
* currently only TOP and LEFT are supported.
*
* @alias : lodir, lod
*
* @param : int enum
*/
function uclass.lodir( pnl, enum )
enum = isnumber( enum ) and enum or LEFT
pnl:SetLayoutDir( enum )
end
uclass.lod = uclass.lodir
/*
* ui :: class :: SetColor
*
* @alias : clr, color
*
* @param : clr clr
*/
function uclass.clr( pnl, clr )
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
pnl:SetColor( clr )
end
uclass.color = uclass.clr
/*
* ui :: class :: DTextEntry :: SetCursorColor
*
* @alias : cursorclr, cclr
*
* @param : clr clr
*/
function uclass.cursorclr( pnl, clr )
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
pnl:SetCursorColor( clr )
end
uclass.cclr = uclass.cursorclr
/*
* ui :: class :: DTextEntry :: SetHighlightColor
*
* @alias : highlightclr, hlclr
*
* @param : clr clr
*/
function uclass.highlightclr( pnl, clr )
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
pnl:SetHighlightColor( clr )
end
uclass.hlclr = uclass.highlightclr
/*
* ui :: class :: Panel :: CursorPos
*
* @alias : cursorpos, cpos
*/
function uclass.cursorpos( pnl )
pnl:CursorPos( )
end
uclass.cpos = uclass.cursorpos
/*
* ui :: class :: Panel :: SetSteamID
*
* @alias : steamid, sid
*
* @param : int sid
* 64bit SteamID of the player to load avatar of
*
* @param : int size
* Size of the avatar to use. Acceptable sizes are 32, 64, 184.
*/
function uclass.steamid( pnl, sid, size )
pnl:SetSteamID( sid, size )
end
uclass.sid = uclass.steamid
/*
* ui :: class :: Panel :: SetCursor
*
* @alias : cursor, cur
*
* @param : str str
*/
function uclass.cursor( pnl, str )
str = isstring( str ) and str or 'none'
pnl:SetCursor( str )
end
uclass.cur = uclass.cursor
/*
* ui :: class :: Panel :: SetCursorColor
*
* @alias : cursor_clr, curclr
*
* @param : clr clr
*/
function uclass.cursor_clr( pnl, clr )
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
pnl:SetCursorColor( clr )
end
uclass.curclr = uclass.setcursor_clr
/*
* ui :: class :: Panel :: SetCursorColor, SetCursor
*
* @param : clr clr
* @param : str str
*/
function uclass.setcursor( pnl, clr, str )
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
str = isstring( str ) and str or 'none'
pnl:SetCursorColor( clr )
pnl:SetCursor( str )
end
uclass.scur = uclass.setcursor
/*
* ui :: class :: DHTML :: SetScrollbars
*
* @param : bool b
*/
function uclass.sbar( pnl, b )
pnl:SetScrollbars( b or false )
end
/*
* ui :: class :: DTextEntry, RichText :: SetVerticalScrollbarEnabled
*
* @param : bool b
*/
function uclass.vsbar( pnl, b )
pnl:SetVerticalScrollbarEnabled( b or false )
end
/*
* ui :: class :: DTextEntry, RichText :: SetVerticalScrollbarEnabled
*
* @param : bool b
*/
function uclass.noscroll( pnl )
pnl:SetVerticalScrollbarEnabled( false )
end
/*
* ui :: class :: Panel :: SetMultiline
*
* @param : bool b
*/
function uclass.multiline( pnl, b )
pnl:SetMultiline( b or false )
end
uclass.mline = uclass.multiline
/*
* ui :: class :: Panel :: focus
*/
function uclass.focus( pnl )
pnl:RequestFocus( )
end
/*
* ui :: class :: OnFocusChanged
*
* @param : func fn
*/
function uclass.onfocuschg( pnl, fn )
if not isfunction( fn ) then return end
pnl[ 'OnFocusChanged' ] = fn
end
uclass.focuschg = uclass.onfocuschg
/*
* ui :: class :: DTextEntry :: SetEditable
*
* @param : bool b
*/
function uclass.canedit( pnl, b )
pnl:SetEditable( b or false )
end
uclass.editable = uclass.canedit
/*
* ui :: class :: DTextEntry :: OnEnter
*
* @param : func fn
*/
function uclass.onenter( pnl, fn )
local name = 'OnEnter'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
/*
* ui :: class :: DTextEntry :: AllowInput
*
* @param : func fn
*/
function uclass.allowinput( pnl, fn )
local name = 'AllowInput'
local orig = pnl[ name ]
pnl[ name ] = function( s, ... )
if isfunction( orig ) then orig( s, ... ) end
fn( s, ... )
end
end
/*
* ui :: class :: DProgress :: SetFraction
*
* @param : int i
*/
function uclass.fraction( pnl, i )
i = isnumber( i ) and i or 1
pnl:SetFraction( i )
end
uclass.frac = uclass.fraction
/*
* ui :: class :: DLabel, DTextEntry :: SetFont
*
* @param : str str
*/
function uclass.setfont( pnl, str )
str = isstring( str ) and str or pid( 'sys_entry_default' )
pnl:SetFont( str )
end
uclass.font = uclass.setfont
/*
* ui :: class :: Panel :: SizeToChildren
*
* resizes the panel to fit the bounds of its children
*
* panel must have its layout updated (Panel:InvalidateLayout) for this function to work properly
* size_w and size_h parameters are false by default. calling this function with no arguments will result in a no-op.
*
* @param : int w
* : adjust width of pnl
*
* @param : int h
* : adjust height of pnl
*/
function uclass.autosize_child( pnl, w, h )
pnl:SizeToChildren( w, h )
end
uclass.aszch = uclass.autosize_child
/*
* ui :: class :: Panel :: SizeToContents
*
* resizes the panel so that its width and height fit all of the content inside
*
* must call AFTER setting text/font or adjusting child panels
*/
function uclass.autosize( pnl )
pnl:SizeToContents( )
end
uclass.asz = uclass.autosize
uclass.autosz = uclass.autosize
/*
* ui :: class :: Panel :: SizeToContentsX
*
* resizes the panel objects width to accommodate all child objects/contents
*
* only works on Label derived panels such as DLabel by default, and on any
* panel that manually implemented Panel:GetContentSize method.
*
* must call AFTER setting text/font or adjusting child panels
*
* @param : int val
* : number of extra pixels to add to the width. Can be a negative number, to reduce the width.
*/
function uclass.autosize_x( pnl, val )
val = isnumber( val ) and val or 0
pnl:SizeToContentsX( val )
end
uclass.asz_x = uclass.autosize_x
uclass.autosz_x = uclass.autosize_x
/*
* ui :: class :: Panel :: SizeToContentsY
*
* resizes the panel object's height to accommodate all child objects/contents
*
* only works on Label derived panels such as DLabel by default, and on any
* panel that manually implemented Panel:GetContentSize method
*
* must call AFTER setting text/font or adjusting child panels
*
* @param : int val
* : number of extra pixels to add to the height. Can be a negative number, to reduce the height
*/
function uclass.autosize_y( pnl, val )
val = isnumber( val ) and val or 0
pnl:SizeToContentsY( val )
end
uclass.asz_y = uclass.autosize_y
uclass.autosz_y = uclass.autosize_y
/*
* ui :: class :: Panel :: SizeTo
*
* uses animation to resize the panel to the specified size
*
* @param : int w
* : arget width of the panel. Use -1 to retain the current width
*
* @param : int h
* : target height of the panel. Use -1 to retain the current height
*
* @param : int time
* : time to perform the animation within
*
* @param : int delay
* : delay before the animation starts
*
* @param : int ease
* : easing of the start and/or end speed of the animation. See Panel:NewAnimation for how this works
*
* @param : fn cb
* : function to be called once the animation finishes. Arguments are:
* ( tbl ) : animData - The AnimationData structure that was used
* ( pnl ) : panel object that was resized
*/
function uclass.tosize( pnl, w, h, time, delay, ease, cb )
pnl:SizeTo( w, h, time, delay, ease, cb )
end
uclass.tosz = uclass.tosize
/*
* ui :: class :: Panel :: SetContentAlignment
*
* sets the alignment of the contents
*
* @param : int int
* : direction of the content, based on the number pad.
*
* 1 : bottom-left
* 2 : bottom-center
* 3 : bottom-right
* 4 : middle-left
* 5 : center
* 6 : middle-right
* 7 : top-left
* 8 : top-center
* 9 : top-right
*/
function uclass.align( pnl, int )
int = isnumber( int ) and int or 4
pnl:SetContentAlignment( int )
end
/*
* ui :: class :: Panel :: AlignTop
*
* aligns the panel on the top of its parent with the specified offset
*
* @param : int int
* : align offset
*/
function uclass.aligntop( pnl, int )
int = isnumber( int ) and int or 0
pnl:AlignTop( int )
end
/*
* ui :: class :: Panel :: AlignBottom
*
* aligns the panel on the bottom of its parent with the specified offset
*
* @param : int int
* : align offset
*/
function uclass.alignbottom( pnl, int )
int = isnumber( int ) and int or 0
pnl:AlignBottom( int )
end
/*
* ui :: class :: Panel :: AlignLeft
*
* aligns the panel on the left of its parent with the specified offset
*
* @param : int int
* : align offset
*/
function uclass.alignleft( pnl, int )
int = isnumber( int ) and int or 0
pnl:AlignLeft( int )
end
/*
* ui :: class :: Panel :: AlignRight
*
* aligns the panel on the right of its parent with the specified offset
*
* @param : int int
* : align offset
*/
function uclass.alignright( pnl, int )
int = isnumber( int ) and int or 0
pnl:AlignRight( int )
end
/*
* ui :: class :: Panel :: LocalToScreen
*
* absolute screen position of the position specified relative to the panel.
*
* @param : int x
* : x coordinate of the position on the panel to translate
*
* @param : int y
* : y coordinate of the position on the panel to translate
*/
function uclass.local2scr( pnl, x, y )
x = isnumber( x ) and x or 0
y = isnumber( y ) and y or 0
pnl:LocalToScreen( x, y )
end
uclass.l2s = uclass.local2scr
/*
* ui :: class :: Panel :: ScreenToLocal
*
* translates global screen coordinate to coordinates relative to the panel
*
* @param : int x
* : x coordinate of the screen position to be translated
*
* @param : int y
* : y coordinate of the screed position be to translated
*/
function uclass.scr2local( pnl, x, y )
x = isnumber( x ) and x or 0
y = isnumber( y ) and y or 0
pnl:ScreenToLocal( x, y )
end
uclass.s2l = uclass.scr2local
/*
* ui :: class :: Panel :: SetDrawOnTop
*
* @param : bool b
* : whether or not to draw the panel in front of all others
*/
function uclass.drawtop( pnl, b )
pnl:SetDrawOnTop( b or false )
end
/*
* ui :: class :: DHTML :: SetHTML
*
* set HTML code within a panel
*
* @param : str str
* : html code to set
*/
function uclass.html( pnl, str )
pnl:SetHTML( str )
end
/*
* ui :: class :: DHTML :: AddressBar
*
* sets the address bar for a dhtml panel
*
* @param : str str
* : address to set
*/
function uclass.addr( pnl, addr )
if not ui:valid( pnl.AddressBar ) then return end
pnl.AddressBar:SetText( addr )
end
/*
* ui :: class :: DHTML :: SetHTML
*
* sets html code in DHTML pnl to display a full-size img from an external site
*
* @param : str str
* : html code to set
*/
function uclass.imgsrc( pnl, str )
local code = ui:html_img( str )
pnl:SetHTML( code )
end
/*
* ui :: class :: svg
*
* loads an outside svg file
* typically used for stats
*
* @param : str src
* : html code to set
*/
function uclass.svg( pnl, src, bShow )
src = isstring( src ) and src or ''
local html = ui:getsvg( src, bShow )
pnl:SetHTML( html )
end
/*
* ui :: class :: Panel :: CenterHorizontal
*
* centers the panel horizontally with specified fraction
*
* @param : flt flt
* : center fraction.
*/
function uclass.center_h( pnl, flt )
flt = isnumber( flt ) and flt or 0.5
pnl:CenterHorizontal( flt )
end
/*
* ui :: class :: Panel :: CenterVertical
*
* centers the panel vertically with specified fraction
*
* @param : flt flt
* : center fraction.
*/
function uclass.center_v( pnl, flt )
flt = isnumber( flt ) and flt or 0.5
pnl:CenterVertical( flt )
end
/*
* ui :: class :: DTextEntry, DLabel :: SetTextColor
*
* sets the text color of the DLabel. This will take precedence
* over DLabel:SetTextStyleColor
*
* @param : clr clr
* : text color. Uses the Color structure.
*/
function uclass.textclr( pnl, clr )
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
pnl:SetTextColor( clr )
pnl[ 'Think' ] = function( s, ... )
s:SetTextColor( clr )
end
end
/*
* ui :: class :: DLabel :: SetText
*
* sets the text value of a panel object containing text, such as a Label,
* TextEntry or RichText and their derivatives, such as DLabel, DTextEntry or DButton
*
* @param : str str
* : text value to set.
*
* @param : bool bautosz
* : enables SizeToContents( )
*/
function uclass.text( pnl, str, bautosz )
str = isstring( str ) and str or ''
pnl:SetText( str )
if bautosz then
pnl:SizeToContents( )
end
end
/*
* ui :: class :: DLabel :: SetText, SetTextColor
*
* set text clr, font, and string
*
* @param : clr clr
* : text color. Uses the Color structure
*
* @param : str font
* : font of the label
*
* @param : str text
* : text to display
*
* @param : bool bautosz
* : enables SizeToContents( )
*
* @param : int align
* : SetContentAlignment( )
*/
function uclass.txt( pnl, text, clr, font, bautosz, align )
text = isstring( text ) and text or ''
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
font = isstring( font ) and font or pid( 'sys_entry_default' )
pnl:SetTextColor( clr )
pnl:SetFont( font )
pnl:SetText( text )
if bautosz then
pnl:SizeToContents( )
end
if align then
pnl:SetContentAlignment ( align )
end
pnl[ 'Think' ] = function( s, ... )
s:SetTextColor( clr )
end
end
/*
* ui :: class :: DLabel :: SetText, SetTextColor
*
* set text clr, font, and string
*
* @param : clr clr
* : text color. Uses the Color structure
*
* @param : str font
* : font of the label
*
* @param : str text
* : text to display
*
* @param : bool bautosz
* : enables SizeToContents( )
*/
function uclass.textadv( pnl, clr, font, text, bautosz )
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
font = isstring( font ) and font or pid( 'sys_entry_default' )
text = isstring( text ) and text or ''
pnl:SetTextColor( clr )
pnl:SetFont( font )
pnl:SetText( text )
if bautosz then
pnl:SizeToContents( )
end
pnl[ 'Think' ] = function( s, ... )
s:SetTextColor( clr )
end
end
/*
* ui :: class :: DLabel :: SetText, SetTextColor
*
* set text clr, font, and string
*
* @param : str text
* : text to display
*
* @param : clr clr
* : text color. Uses the Color structure
*
* @param : str font
* : font of the label
*
* @param : bool bautosz
* : enables SizeToContents( )
*
* @param : int align
* : set content alignment
*/
function uclass.label( pnl, text, clr, font, bautosz, align )
text = isstring( text ) and text or ''
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
font = isstring( font ) and font or pid( 'sys_entry_default' )
bautosz = bautosz or false
align = isnumber( align ) and align or 4
pnl:SetText ( text )
pnl:SetColor ( clr )
pnl:SetFont ( font )
if bautosz then
pnl:SizeToContents( )
end
if align then
pnl:SetContentAlignment ( align )
end
pnl[ 'Think' ] = function( s, ... )
s:SetColor( clr )
end
end
uclass.lbl = uclass.label
/*
* ui :: class :: Panel :: AlphaTo
*
* animation to transition the current alpha value of a panel to a new alpha, over a set period of time and after a specified delay.
*
* @param : int alpha
* : alpha value (0-255) to approach
*
* @param : int dur
* : time in seconds it should take to reach the alpha
*
* @param : int delay
* : delay before the animation starts.
*
* @param : func cb
* : function to be called once the animation finishes
*/
function uclass.alphato( pnl, alpha, dur, delay, cb )
alpha = isnumber( alpha ) and alpha or 255
dur = isnumber( dur ) and dur or 1
delay = isnumber( delay ) and delay or 0
pnl:AlphaTo( alpha, dur, delay, cb )
end
uclass.a2 = uclass.alphato
/*
* ui :: class :: DLabel :: SetText
*
* sets the text value of a panel object containing text, such as a Label,
* TextEntry or RichText and their derivatives, such as DLabel, DTextEntry or DButton
*/
function uclass.notext( pnl )
pnl:SetText( '' )
end
/*
* ui :: class :: Panel :: SetEnabled
*
* Sets the enabled state of a disable-able panel object, such as a DButton or DTextEntry.
* See Panel:IsEnabled for a function that retrieves the "enabled" state of a panel
*
* @param : bool b
* : Whether to enable or disable the panel object
*/
function uclass.enabled( pnl, b )
pnl:SetEnabled( b or false )
end
uclass.on = uclass.enabled
uclass.seton = uclass.enabled
uclass.enable = uclass.enabled
/*
* ui :: class :: DMenuBar, DPanel :: SetDisabled
*
* sets whether or not to disable the panel
*
* @param : bool b
* : true to disable the panel (mouse input disabled and background
* alpha set to 75), false to enable it (mouse input enabled and background alpha set to 255).
*/
function uclass.disabled( pnl, b )
pnl:SetDisabled( b or false )
end
uclass.off = uclass.disabled
uclass.setoff = uclass.disabled
/*
* ui :: class :: Panel :: SetParent
*
* sets the parent of the panel
*
* @param : pnl parent
* : new parent of the panel
*/
function uclass.parent( pnl, parent )
pnl:SetParent( parent )
end
/*
* ui :: class :: Panel :: HasFocus
*
* returns if the panel is focused
*
* @return : bool
* : hasFocus
*/
function uclass.hasfocus( pnl )
pnl:HasFocus( )
end
/*
* ui :: class :: Panel :: HasParent
*
* returns whether the panel is a descendent of the given panel
*
* @param : pnl parent
* : parent pnl
*
* @return : bool
* : true if the panel is contained within parent
*/
function uclass.hasparent( pnl, parent )
pnl:HasParent( parent )
end
/*
* ui :: class :: Panel :: HasChildren
*
* returns whenever the panel has child panels
*
* @return : bool
* : true if the panel has children
*/
function uclass.haschild( pnl )
pnl:HasChildren( )
end
/*
* ui :: class :: Panel :: SetWrap
*
* sets whether text wrapping should be enabled or disabled on Label and
* DLabel panels. Use DLabel:SetAutoStretchVertical to automatically correct
* vertical size; Panel:SizeToContents will not set the correct height
*
* @param : bool b
* : true to enable text wrapping, false otherwise.
*/
function uclass.wrap( pnl, b )
pnl:SetWrap( b or false )
end
/*
* ui :: class :: Label :: SetAutoStretchVertical
*
* automatically adjusts the height of the label dependent of the height of the text inside of it.
*
* @param : bool b
* : true to enable auto stretching, false otherwise.
*/
function uclass.autoverticle( pnl, b )
pnl:SetAutoStretchVertical( b or false )
end
/*
* ui :: class :: Panel :: OnCursorEntered, OnCursorExited
*
* shortcut for oncursor hover functions
* : s.hover
*/
function uclass.onhover( pnl )
pnl.OnCursorEntered = function( s ) s.hover = true end
pnl.OnCursorExited = function( s ) s.hover = false end
end
uclass.ohover = uclass.onhover
uclass.ohvr = uclass.onhover
/*
* ui :: class :: Panel :: OnCursorEntered, OnCursorExited :: dim
*
* dims the btn when mouse cursor hovers
*
* @param : clr clr
*/
function uclass.onhover_dim( pnl, clr, x, y, w, h )
uclass.onhover( pnl )
clr = IsColor( clr ) and clr or Color( 0, 0, 0, 200 )
x = isnumber( x ) and x or 0
y = isnumber( y ) and y or x or 0
w = isnumber( w ) and w or nil
h = isnumber( h ) and h or nil
pnl.PaintOver = function( s, sz_w, sz_h )
if s.hover then
sz_w = isnumber( w ) and w or sz_w
sz_h = isnumber( h ) and h or sz_h
design.box( x, y, sz_w, sz_h, clr )
end
end
end
uclass.ohoverdim = uclass.onhover_dim
uclass.ohvrdim = uclass.onhover_dim
uclass.odim = uclass.onhover_dim
/*
* ui :: class :: Panel :: OnDisabled
*
* sets a local pnl var to check if pnl is disabled or not
* : s.disabled
*/
function uclass.ondisabled( pnl )
pnl.Think = function( s )
if s:GetDisabled( ) then
s.disabled = true
else
s.disabled = false
end
end
end
/*
* ui :: class :: Chkbox :: GetChecked
*
* sets a local pnl var to check if pnl is disabled or not
* : s.disabled
*/
function uclass.onchk( pnl )
pnl.Think = function( s )
if s:GetChecked( ) then
s.chk = true
else
s.chk = false
end
end
end
uclass.ochk = uclass.onchk
/*
* ui :: class :: DButton, DImage :: SetImage
*
* sets an image to be displayed as the button's background.
*
* @param : str img
* : image file to use, relative to /materials. If this is nil, the image background is removed.
*
* @param : str img2
* : backup img
*/
function uclass.setimg( pnl, img, img2 )
img2 = isstring( img2 ) and img2 or 'vgui/avatar_default'
pnl:SetImage( img, img2 )
end
uclass.simg = uclass.setimg
/*
* ui :: class :: DTextEntry :: GetUpdateOnType
*
* returns whether the DTextEntry is set to run DTextEntry:OnValueChange every
* time a character is typed or deleted or only when Enter is pressed.
*/
function uclass.autoupdate( pnl )
pnl:GetUpdateOnType( )
end
/*
* ui :: class :: DTextEntry :: SetUpdateOnType
*
* sets whether we should fire DTextEntry:OnValueChange
* every time we type or delete a character or only when Enter is pressed.
*/
function uclass.setautoupdate( pnl, b )
pnl:SetUpdateOnType( b or false )
end
/*
* ui :: class :: Panel :: SetAllowNonAsciiCharacters
*
* configures a text input to allow user to type characters that are not included in
* the US-ASCII (7-bit ASCII) character set.
*
* characters not included in US-ASCII are multi-byte characters in UTF-8. They can be
* accented characters, non-Latin characters and special characters.
*
* @param : bool b
* : true in order not to restrict input characters.
*/
function uclass.allowascii( pnl, b )
pnl:SetAllowNonAsciiCharacters( b or false )
end
uclass.ascii = uclass.allowascii
/*
* ui :: class :: DPropertySheet :: AddSheet
*
* adds a new tab.
*
* @param : str name
* : name of the tab
*
* @param : pnl panel
* : panel to be used as contents of the tab. This normally should be a DPanel
*
* @param : str ico
* : icon for the tab. This will ideally be a silkicon, but any material name can be used.
*
* @param : bool bnostretchx
* : should DPropertySheet try to fill itself with given panel horizontally.
*
* @param : bool bnostretchy
* : should DPropertySheet try to fill itself with given panel vertically.
*
* @param : str tip
* : tooltip for the tab when user hovers over it with his cursor
*/
function uclass.newsheet( pnl, name, panel, ico, bnostretchx, bnostretchy, tip )
name = isstring( name ) and name or 'untitled'
panel = ui:valid( panel ) and panel or nil
ico = isstring( ico ) and ico or ''
bnostretchx = bnostretchx or false
bnostretchy = bnostretchy or false
tip = isstring( tip ) and tip or ''
pnl:AddSheet( name, panel, ico, bnostretchx, bnostretchy, tip )
end
/*
* ui :: class :: DColumnSheet :: AddSheet
*
* adds a new column/tab.
*
* @param : str name
* : name of the column/tab
*
* @param : pnl panel
* : panel to be used as contents of the tab. This normally would be a DPanel
*
* @param : str ico
* : icon for the tab. This will ideally be a silkicon, but any material name can be used.
*/
function uclass.newsheet_col( pnl, name, panel, ico )
name = isstring( name ) and name or 'untitled'
panel = ui:valid( panel ) and panel or nil
ico = isstring( ico ) and ico or ''
pnl:AddSheet( name, panel, ico )
end
/*
* ui :: class :: Panel :: Clear
*
* marks all of the panel's children for deletion.
*/
function uclass.clear( pnl )
pnl:Clear( )
end
/*
* ui :: class :: DFrame :: Close
*
* hides or removes DFrame, calls DFrame:OnClose.
*/
function uclass.close( pnl )
pnl:Close( )
end
/*
* ui :: class :: DFrame :: DeleteOnClose
*
* destroys pnl when closed
*
* @param : bool b
*/
function uclass.delonclose( pnl, b )
pnl:SetDeleteOnClose( b )
end
uclass.doc = uclass.delonclose
/*
* ui :: class :: DComboBox :: SetValue
*
* sets the text shown in the combo box when the menu is not collapsed.
*
* @param : str opt
*/
function uclass.value( pnl, opt )
pnl:SetValue( opt )
end
uclass.val = uclass.value
/*
* ui :: class :: DComboBox :: SetValue
*/
function uclass.novalue( pnl )
pnl:SetValue( '' )
end
uclass.noval = uclass.novalue
/*
* ui :: class :: DCheckBox :: SetValue
*
* sets checked state of checkbox, calls the checkbox's DCheckBox:OnChange and Panel:ConVarChanged methods.
*
* @param : bool opt
*/
function uclass.value_cbox( pnl, b )
pnl:SetValue( b or false )
end
uclass.valcbox = uclass.value_cbox
/*
* ui :: class :: Panel :: GetValue
*
* returns the value the obj holds
*
* @return : str
*/
function uclass.getvalue( pnl )
pnl:GetValue( )
end
uclass.gval = uclass.getvalue
/*
* ui :: class :: DCheckBox :: SetChecked
*
* sets the checked state of the checkbox. Does not call the checkbox's
* DCheckBox:OnChange and Panel:ConVarChanged methods, unlike DCheckBox:SetValue.
*
* @param : bool b
*/
function uclass.checked( pnl, b )
pnl:SetChecked( b or false )
end
uclass.schk = uclass.checked
uclass.toggle = uclass.checked
/*
* ui :: class :: DComboBox :: AddChoice
*
* adds a choice to the combo box.
*
* @param : str str
* @param : mix data
* @param : bool bsel
* @param : pnl icon
*/
function uclass.newchoice( pnl, str, data, bsel, icon )
pnl:AddChoice( str, data, bsel, icon )
end
/*
* ui :: class :: Panel :: Destroy
*
* completely removes the specified panel
*/
function uclass.destroy( pnl )
ui:destroy( pnl )
end
/*
* ui :: class :: Panel :: Show
*
* shows the specified panel
*/
function uclass.show( pnl )
ui:show( pnl )
end
/*
* ui :: class :: Panel :: Hide
*
* hides the specified panel
*/
function uclass.hide( pnl )
ui:hide( pnl )
end
/*
* ui :: class :: Panel :: MakePopup
*
* focuses the panel and enables it to receive input.
* automatically calls Panel:SetMouseInputEnabled and Panel:SetKeyboardInputEnabled
* and sets them to true.
*
* : bKeyDisabled
* set TRUE to disable keyboard input
*
* : bMouseDisabled
* set TRUE to disable mouse input
*/
function uclass.popup( pnl, bKeyDisabled, bMouseDisabled )
pnl:MakePopup( )
if bKeyDisabled then
pnl:SetKeyboardInputEnabled( false )
end
if bMouseDisabled then
pnl:SetMouseInputEnabled( false )
end
end
/*
* ui :: class :: DFrame :: SetDraggable
*
* sets whether the frame should be draggable by the user.
* DFrame can only be dragged from its title bar.
*
* @param : bool b
*/
function uclass.candrag( pnl, b )
pnl:SetDraggable( b or false )
end
uclass.draggable = uclass.candrag
uclass.drag = uclass.candrag
/*
* ui :: class :: DFrame :: SetDraggable
*
* forces frame to not allow dragging
*/
function uclass.nodrag( pnl )
pnl:SetDraggable( false )
end
/*
* ui :: class :: DFrame :: SetSizable
*
* sets whether or not the DFrame can be resized by the user.
* this is achieved by clicking and dragging in the bottom right corner of the frame.
*
* @param : bool b
*/
function uclass.canresize( pnl, b )
pnl:SetSizable( b or false )
end
uclass.resizable = uclass.canresize
uclass.resize = uclass.canresize
/*
* ui :: class :: DFrame :: SetScreenLock
*
* sets whether the DFrame is restricted to the boundaries of the screen resolution.
*
* @param : bool b
*/
function uclass.lockscreen( pnl, b )
pnl:SetScreenLock( b or false )
end
uclass.ls = uclass.lockscreen
uclass.scrlock = uclass.lockscreen
/*
* ui :: class :: DFrame :: SetPaintShadow
*
* sets whether or not the shadow effect bordering the DFrame should be drawn.
*
* @param : bool b
*/
function uclass.shadow( pnl, b )
pnl:SetPaintShadow( b or false )
end
/*
* ui :: class :: DFrame :: IsActive
*
* determines if the frame or one of its children has the screen focus.
*/
function uclass.isactive( pnl )
pnl:IsActive( )
end
/*
* ui :: class :: blur
*
* adds blur to the specified pnl
*
* @param : int amt [ optional ]
* : how intense blur will be
*/
function uclass.blur( pnl, amt )
amt = isnumber( amt ) and amt or 10
uclass.nopaint( pnl )
pnl[ 'Paint' ] = function( s, w, h )
design.blur( s, amt )
end
end
/*
* ui :: class :: blurbox
*
* adds blur and a single box to the pnl paint hook
*
* @param : clr clr
* : clr for box
*
* @param : int amt [ optional ]
* : how intense blur will be
*/
function uclass.blurbox( pnl, clr, amt )
clr = IsColor( clr ) and clr or Color( 0, 0, 0, 200 )
amt = isnumber( amt ) and amt or 10
uclass.nopaint( pnl )
pnl[ 'Paint' ] = function( s, w, h )
design.blur( s, amt )
design.box( 0, 0, w, h, clr )
end
end
/*
* ui :: class :: DFrame :: SetBackgroundBlur
*
* blurs background behind the frame.
*
* @param : bool b
* : whether or not to create background blur or not.
*/
function uclass.blur_bg( pnl, b )
pnl:SetBackgroundBlur( b or false )
end
/*
* ui :: class :: DFrane :: SetTitle
*
* sets the title of the frame.
*
* @param : str str
* : text to set as title for frame
*/
function uclass.title( pnl, str )
str = isstring( str ) and str or ''
pnl:SetTitle( str )
end
/*
* ui :: class :: DFrane :: SetTitle
*
* clears the dframe title
*/
function uclass.notitle( pnl )
pnl:SetTitle( '' )
end
/*
* ui :: class :: DFrame :: ShowCloseButton
*
* determines whether the DFrame's control box (close, minimise and maximise buttons) is displayed.
*
* @param : bool b
*/
function uclass.showclose( pnl, b )
pnl:ShowCloseButton( b or true )
end
uclass.canclose = uclass.showclose
/*
* ui :: class :: DFrame :: ShowCloseButton
*
* automatically hides the close button on dframe pnls
*/
function uclass.noclose( pnl )
pnl:ShowCloseButton( false )
end
/*
* ui :: class :: Panel :: SetPaintBackground
*
* sets whether or not to paint/draw the panel background.
*
* @param : bool b
*/
function uclass.paintbg( pnl, b )
pnl:SetPaintBackground( b or false )
end
uclass.pbg = uclass.paintbg
uclass.drawbg = uclass.paintbg
/*
* ui :: class :: Panel :: SetPaintBackgroundEnabled
*
* sets whenever all the default background of the panel should be drawn or not.
*
* @param : bool b
*/
function uclass.paintbg_enabled( pnl, b )
pnl:SetPaintBackgroundEnabled( b or true )
end
uclass.pbg_on = uclass.paintbg_enabled
uclass.drawbg_on = uclass.paintbg_enabled
/*
* ui :: class :: Panel :: SetPaintBorderEnabled
*
* sets whenever all the default border of the panel should be drawn or not.
*
* @param : bool b
*/
function uclass.paintborder( pnl, b )
pnl:SetPaintBorderEnabled( b or true )
end
/*
* ui :: class :: Panel :: SetPaintBackgroundEnabled, SetPaintBorderEnabled, SetPaintBackground
*
* @param : bool b
*/
function uclass.enginedraw( pnl, b )
pnl:SetPaintBackgroundEnabled( b or true )
pnl:SetPaintBorderEnabled( b or true )
pnl:SetPaintBackground( b or true )
end
/*
* ui :: class :: DFrame :: Center
*
* centers the panel on its parent.
*/
function uclass.center( pnl )
pnl:Center( )
end
/*
* ui :: class :: Panel :: GetParent
*
* returns the parent of the panel, returns nil if there is no parent.
*/
function uclass.getparent( pnl )
pnl:GetParent( )
end
/*
* ui :: class :: Panel :: GetChild
*
* gets a child by its index.
*
* @param : int id
*/
function uclass.getchild( pnl, id )
id = isnumber( id ) and id or 0
pnl:GetChild( id )
end
/*
* ui :: class :: Panel :: GetChildren
*
* returns a table with all the child panels of the panel.
*/
function uclass.getchildren( pnl )
pnl:GetChildren( )
end
/*
* ui :: class :: Panel :: InvalidateLayout
*
* causes the panel to re-layout in the next frame.
* during the layout process PANEL:PerformLayout will be called on the target panel.
*
* @param : bool b
*/
function uclass.invalidate( pnl, b )
pnl:InvalidateLayout( b or false )
end
uclass.nullify = uclass.invalidate
/*
* ui :: class :: Panel :: InvalidateChildren
*
* invalidates the layout of this panel object and all its children.
* this will cause these objects to re-layout immediately, calling PANEL:PerformLayout.
* if you want to perform the layout in the next frame, you will have loop manually through
* all children, and call Panel:InvalidateLayout on each.
*
* @param : bool b
* : true = the method will recursively invalidate the layout of all children. Otherwise, only immediate children are affected.
*/
function uclass.invalidate_childen( pnl, b )
pnl:InvalidateChildren( b or false )
end
uclass.nullify_ch = uclass.invalidate_childen
/*
* ui :: class :: Panel :: InvalidateParent
*
* invalidates the layout of the parent of this panel object.
* this will cause it to re-layout, calling PANEL:PerformLayout.
*
* @param : bool b
* : true = the re-layout will occur immediately, otherwise it will be performed in the next frame.
*/
function uclass.invalidate_parent( pnl, b )
pnl:InvalidateParent( b or false )
end
uclass.nullify_pa = uclass.invalidate_parent
/*
* ui :: class :: Panel :: SetCookieName, SetCookie
*
* @param : str name
* @param : str val
*/
function uclass.cookie( pnl, name, val )
if not name then return end
pnl:SetCookieName( name )
pnl:SetCookie( name, val )
end
/*
* ui :: class :: Panel :: DeleteCookie
*
* @param : str name
*/
function uclass.delcookie( pnl, name )
if not name then return end
pnl:DeleteCookie( name )
end
/*
* ui :: class :: Panel :: MoveTo
*
* @param : int x
* @param : int y
* @param : int time
* @param : int delay
* @param : int ease
* @param : fn cb
*/
function uclass.moveto( pnl, x, y, time, delay, ease, cb )
pnl:MoveTo( x, y, time, delay, ease, cb )
end
uclass.move = uclass.moveto
/*
* ui :: class :: Panel :: MoveToBack
*
* @param : bool b
*/
function uclass.movetoback( pnl, b )
pnl:MoveToBack( b or false )
end
uclass.m2b = uclass.movetoback
uclass.back = uclass.movetoback
/*
* ui :: class :: Panel :: MoveToFront
*/
function uclass.movetofront( pnl )
pnl:MoveToFront( )
end
uclass.m2f = uclass.movetofront
uclass.front = uclass.movetofront
/*
* ui :: class :: Panel :: MoveToAfter
*
* @param : pnl panel
*/
function uclass.movetoafter( pnl, panel )
if not panel then return end
pnl:MoveToAfter( panel )
end
uclass.m2af = uclass.movetoafter
uclass.after = uclass.movetoafter
/*
* ui :: class :: Panel :: MoveToBefore
*
* @param : pnl panel
*/
function uclass.movetobefore( pnl, panel )
if not panel then return end
pnl:MoveToBefore( panel )
end
uclass.m2bf = uclass.movetobefore
uclass.before = uclass.movetobefore
/*
* ui :: class :: Panel :: MoveBelow
*
* @param : pnl panel
*/
function uclass.movebelow( pnl, panel )
if not panel then return end
pnl:MoveBelow( panel )
end
uclass.mb = uclass.movebelow
uclass.below = uclass.movebelow
/*
* ui :: class :: Panel :: SetZPos
*
* @param : int pos
*/
function uclass.zpos( pnl, pos )
pos = isnumber( pos ) and pos or 1
pnl:SetZPos( pos )
end
/*
* ui :: class :: Panel :: SetKeyboardInputEnabled
*
* @param : bool b
*/
function uclass.allowkeyboard( pnl, b )
pnl:SetKeyboardInputEnabled( b or false )
end
uclass.keys_ok = uclass.allowkeyboard
/*
* ui :: class :: Panel :: SetMouseInputEnabled
*
* @param : bool b
*/
function uclass.allowmouse( pnl, b )
pnl:SetMouseInputEnabled( b or false )
end
uclass.mouse_ok = uclass.allowmouse
/*
* ui :: class :: Panel :: SetRounded
*
* @param : bool b
*/
function uclass.rounded( pnl, b )
pnl:SetRounded( b or false )
end
/*
* ui :: class :: Panel :: SetOpacity
*
* @param : int i
*/
function uclass.opacity( pnl, i )
i = isnumber( i ) and i or 255
pnl:SetOpacity( i )
end
/*
* ui :: class :: Panel :: SetAlpha
*
* @param : int int
*/
function uclass.alpha( pnl, int )
int = isnumber( int ) and int or 255
pnl:SetAlpha( int )
end
/*
* ui :: class :: Panel :: SetHeader
*
* @param : str str
*/
function uclass.header( pnl, str )
str = isstring( str ) and str or 'Welcome'
pnl:SetHeader( str )
end
/*
* ui :: class :: Panel :: ActionShow
*/
function uclass.actshow( pnl )
pnl:ActionShow( )
end
/*
* ui :: class :: Panel :: ActionHide
*/
function uclass.acthide( pnl )
pnl:ActionHide( )
end
/*
* ui :: class :: Panel :: Param
*
* can be used to call panel child function
*
* @ex : func in PANEL file: PANEL:GetItemID( )
* : call from pmeta: :param( 'ItemID', 293 )
*
* @alias : param, define
*
* @param : str name
* @param : mix val
*/
function uclass.param( pnl, name, val )
if not name or not pnl[ name ] then return end
val = val or ''
pnl[ name ]( pnl, val )
end
uclass.define = uclass.param
/*
* ui :: class :: Panel :: var
*
* @ex : var( 'health', 0 )
*
* @call : self.item.health
* : item.health
*
* @alias : var
*
* @param : str name
* @param : mix val
*/
function uclass.var( pnl, name, val )
val = val or ''
pnl[ name ] = val
end
/*
* ui :: class :: Panel :: SetTooltip
*
* displays tooltips via the default gmod method
*
* @assoc : tooltip
* @alias : gtooltip, gtip
*
* @param : str str
*/
function uclass.gtooltip( pnl, str )
str = isstring( str ) and str or ''
pnl:SetTooltip( str )
end
uclass.gtip = uclass.gtooltip
/*
* ui :: class :: Panel :: Tooltips
*
* displays tooltips
* custom tooltip alternative to the default gmod SetTooltip func
*
* @assoc : gtooltip
* @alias : tooltip, tip
*
* @param : str str
* @param : clr clr_t
* @param : clr clr_i
* @param : clr clr_o
*/
local pnl_tippy = false
function uclass.tooltip( pnl, str, clr_t, clr_i, clr_o )
/*
* validate tip
*/
if not isstring( str ) then return end
/*
* define clrs
*/
local clr_text = IsColor( clr_t ) and clr_t or cfg.tips.clrs.text
local clr_box = IsColor( clr_i ) and clr_i or cfg.tips.clrs.inner
local clr_out = IsColor( clr_o ) and clr_o or cfg.tips.clrs.outline
/*
* fn :: draw tooltip
*
* @param : pnl parent
*/
local function draw_tooltip( parent )
/*
* check :: existing tippy pnl
*/
if pnl_tippy and ui:valid( pnl_tippy ) then return end
/*
* define :: cursor pos
*/
local pos_x, pos_y = input.GetCursorPos( )
/*
* set / get font text size
*/
surface.SetFont( pid( 'sys_tippy_text' ) )
local sz_w, sz_h = surface.GetTextSize( str )
sz_w = sz_w + 50
/*
* create pnl
*/
pnl_tippy = ui.new( 'pnl', pnl )
:nodraw ( )
:pos ( pos_x + 10, pos_y - 35 )
:size ( sz_w, 25 )
:popup ( )
:front ( )
:m2f ( )
:var ( 'TipWidth', sz_w )
:zpos ( 9999 )
:drawtop ( true )
:logic( function( s )
/*
* requires parent pnl
*/
if not ui:valid( parent ) then
ui:destroy( pnl_tippy )
return
end
/*
* update mouse pos
*/
local wid = s.TipWidth or 0
pos_x, pos_y = input.GetCursorPos( )
pos_x = math.Clamp( pos_x, ( sz_w / 2 ) - 10, ScrW( ) - ( sz_w / 2 ) )
pos_y = math.Clamp( pos_y, 45, ScrH( ) - 0 )
s:SetPos( pos_x + ( 15 / 2 ) - ( wid / 2 ), pos_y - 45 )
end )
:draw( function( s, w, h )
design.rbox( 4, 0, 0, sz_w, 25, clr_out )
design.rbox( 4, 1, 1, sz_w - 2, 25 - 2, clr_box )
draw.SimpleText( sf( '%s %s' , helper.get:utf8char( cfg.tips.clrs.utf ), str ), pid( 'sys_tippy_text' ), 15, ( 25 / 2 ), clr_text, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER )
end )
end
pnl.OnCursorEntered = function( s )
draw_tooltip ( s )
s.hover = true
end
pnl.OnCursorExited = function( s )
if s:IsChildHovered( ) then
return
end
ui:destroy ( pnl_tippy )
s.hover = false
end
end
uclass.tip = uclass.tooltip
/*
* ui :: class :: DModel :: SetModel
*
* @alias : model, mdl, setmdl
*
* @param : str str
* @param : int skin
* @param : str bodygrp
*/
function uclass.model( pnl, str, skin, bodygrp )
skin = isnumber( skin ) and skin or 0
bodygrp = isstring( bodygrp ) and bodygrp or ''
pnl:SetModel( str, skin, bodygrp )
end
uclass.mdl = uclass.model
uclass.setmdl = uclass.model
/*
* ui :: class :: DModel :: SetFOV
*
* @alias : fov, setfov
*
* @param : int i
*/
function uclass.fov( pnl, i )
i = isnumber( i ) and i or 120
pnl:SetFOV( i )
end
uclass.setfov = uclass.fov
/*
* ui :: class :: DModel :: SetAmbientLight
*
* @param : clr clr
*/
function uclass.light( pnl, clr )
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
pnl:SetAmbientLight( clr )
end
/*
* ui :: class :: DNum :: SetMin
*
* @alias : min, setmin
*
* @param : int min
*/
function uclass.min( pnl, min )
min = isnumber( min ) and min or 0
pnl:SetMin( min )
end
uclass.setmin = uclass.min
/*
* ui :: class :: DNum :: SetMax
*
* @alias : max, setmax
*
* @param : int max
*/
function uclass.max( pnl, max )
max = isnumber( max ) and max or 1000
pnl:SetMax( max )
end
uclass.setmax = uclass.max
/*
* ui :: class :: DNum :: minmax
*
* @alias : minmax, setminmax
*
* @param : int min
* @param : int max
*/
function uclass.minmax( pnl, min, max )
min = isnumber( min ) and min or 0
pnl:SetMin( min )
if max then
pnl:SetMax( max )
end
end
uclass.setminmax = uclass.minmax
/*
* ui :: class :: DModel :: SetCamPos
*
* @param : vec pos
*/
function uclass.cam( pnl, pos )
pos = isvector( pos ) and pos or Vector( 0, 0, 0 )
pnl:SetCamPos( pos )
end
/*
* ui :: class :: DModel :: SetLookAt
*
* @param : vec pos
*/
function uclass.look( pnl, pos )
pos = isvector( pos ) and pos or Vector( 0, 0, 0 )
pnl:SetLookAt( pos )
end
/*
* ui :: class :: ItemStore :: SetContainerID
*
* returns iventory id from itemstore addon from gmodstore
*
* @param : int id
*/
function uclass.inventory_id( pnl, id )
id = isnumber( id ) and id or 0
pnl:SetContainerID( id )
end
uclass.inv_id = uclass.inventory_id
/*
* ui :: class :: Panel :: OpenURL
*
* returns iventory id from itemstore addon from gmodstore
*
* @param : str uri
*/
function uclass.url( pnl, uri )
uri = isstring( uri ) and uri or 'http://google.com/'
pnl:OpenURL( uri )
end
/*
* ui :: class :: DGrid :: AddItem
*
* @param : pnl panel
*/
function uclass.additem( pnl, panel )
if not panel then return end
pnl:AddItem( panel )
end
/*
* ui :: class :: DGrid :: SetCols
*
* number of columns this panel should have.
*
* @param : int cols
* : desired number of columns
*/
function uclass.col( pnl, cols )
cols = isnumber( cols ) and cols or 1
pnl:SetCols( cols )
end
/*
* ui :: class :: DGrid :: SetColWide
*
* number of columns this panel should have.
*
* @param : int w
* : width of each column.
*/
function uclass.col_wide( pnl, w )
w = isnumber( w ) and w or 1
pnl:SetColWide( w )
end
/*
* ui :: class :: DGrid :: colstall
*
* height of each row.
* cell panels (grid items) will not be resized or centered.
*
* @param : int h
* : height of each column.
*/
function uclass.col_tall( pnl, h )
h = isnumber( h ) and h or 20
pnl:SetRowHeight( h )
end
/*
* ui :: class :: DHTML :: img url
*
* sets the img url to use for a dhtml element
* supports both a string url or a table of strings
*
* @param : int h
* : height of each column.
*/
function uclass.imgurl( pnl, src, bRand )
bRand = bRand or false
local img = ui:html_img_full( src, bRand )
pnl:SetHTML( img )
end
/*
* ui :: class :: RichText :: AppendText
*
* @param : str str
*/
function uclass.appendtxt( pnl, str )
str = isstring( str ) and str or ''
pnl:AppendText( str )
end
/*
* ui :: class :: RichText :: InsertColorChange
*
* @param : clr clr
*/
function uclass.appendclr( pnl, clr )
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
local clr_append = clr
pnl:InsertColorChange( clr_append.r, clr_append.g, clr_append.b, clr_append.a )
end
/*
* ui :: class :: RichText :: InsertColorChange
*
* @param : clr clr
*/
function uclass.appendfont( pnl, font, clr )
font = isstring( font ) and font or ''
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
pnl[ 'PerformLayout' ] = function( s, ... )
s:SetFontInternal( font )
s:SetFGColor( clr )
end
end
/*
* ui :: class :: RichText :: InsertColorChange, AppendText
*
* @param : str str
* @param : clr clr
*/
function uclass.append( pnl, str, clr )
str = isstring( str ) and str or ''
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
if IsColor( clr ) then
local clr_append = clr
pnl:InsertColorChange( clr_append.r, clr_append.g, clr_append.b, clr_append.a )
end
pnl:AppendText( str )
end
/*
* ui :: class :: anim :: hover :: fill
*
* animation causes box to slide in from the specified direction
*
* @ex :anim_hover_fill( Color( 255, 255, 255, 255 ), LEFT, 10 )
*
* @param : clr clr
* @param : int, enum dir
* @param : int sp
* @param : bool bDrawRepl
*/
function uclass.anim_hover_fill( pnl, clr, dir, sp, bDrawRepl )
clr = IsColor( clr ) and clr or Color( 5, 5, 5, 200 )
dir = dir or LEFT
sp = isnumber( sp ) and sp or 10
mat = isbool( mat )
pnl:SetupAnim( 'OnHoverFill', sp, ui.OnHover )
local function draw_action( s, w, h )
local x, y, fw, fh
if dir == LEFT then
x, y, fw, fh = 0, 0, math.Round( w * s.OnHoverFill ), h
elseif dir == TOP then
x, y, fw, fh = 0, 0, w, math.Round( h * s.OnHoverFill )
elseif dir == RIGHT then
local prog = math.Round( w * s.OnHoverFill )
x, y, fw, fh = w - prog, 0, prog, h
elseif dir == BOTTOM then
local prog = math.Round( h * s.OnHoverFill )
x, y, fw, fh = 0, h - prog, w, prog
end
design.box( x, y, fw, fh, clr )
end
if not bDrawRepl then
pnl:drawover( function( s, w, h )
draw_action( s, w, h )
end )
else
pnl:draw( function( s, w, h )
draw_action( s, w, h )
end )
end
end
/*
* ui :: class :: anim :: hover :: fade
*
* displays a fade animation on hover
*
* @ex :anim_hover_fade( Color( 255, 255, 255, 255 ), 5, 0, false )
*
* @param : clr clr
* @param : int sp
* @param : int r
* @param : bool bDrawRepl
*/
function uclass.anim_hover_fade( pnl, clr, sp, r, bDrawRepl )
clr = IsColor( clr ) and clr or Color( 5, 5, 5, 200 )
sp = isnumber( sp ) and sp or 10
pnl:SetupAnim( 'OnHoverFade', sp, ui.OnHover )
local function draw_action( s, w, h )
local da = ColorAlpha( clr, clr.a * s.OnHoverFade )
if r and r > 0 then
design.rbox( r, 0, 0, w, h, da )
else
design.box( 0, 0, w, h, da )
end
end
if not bDrawRepl then
pnl:drawover( function( s, w, h )
draw_action( s, w, h )
end )
else
pnl:draw( function( s, w, h )
draw_action( s, w, h )
end )
end
end
/*
* ui :: class :: anim :: onclick circle
*
* creates a simple onclick animation with a poly expanding outward while becoming transparent
* based on mouse position
*
* @param : clr clr
* @param : int sp_r
* @param : int sp_a
* @param : int r
*/
function uclass.anim_click_circle( pnl, clr, sp_r, sp_a, r )
clr = IsColor( clr ) and clr or Color( 5, 5, 5, 200 )
sp_r = isnumber( sp_r ) and sp_r or 2
sp_a = isnumber( sp_a ) and sp_a or 1
r = 100
pnl.radius = 0
pnl.a = 0
pnl.pos_x = 0
pnl.pos_y = 0
pnl:paintover( function( s, w, h )
if s.a < 1 then return end
design.circle_simple( s.pos_x, s.pos_y, s.radius, ColorAlpha( clr, s.a ) )
s.radius = Lerp( FrameTime( ) * sp_r, s.radius, r or w )
s.a = Lerp( FrameTime( ) * sp_a, s.a, 0 )
end)
pnl:onclick( function( cir )
cir.pos_x, cir.pos_y = cir:CursorPos( )
cir.radius = 0
cir.a = clr.a
end )
end
/*
* ui :: class :: anim :: onclick outline
*
* creates a simple onclick animation with a poly expanding outward while becoming transparent
* based on mouse position
*
* @param : clr clr
* @param : int sp_r
* @param : int sp_a
* @param : int r
*/
function uclass.anim_click_ol( pnl, clr, clr2, sp_r, sp_a, r )
clr = IsColor( clr ) and clr or Color( 5, 5, 5, 200 )
clr2 = IsColor( clr2 ) and clr2 or Color( 5, 5, 5, 255 )
sp_r = isnumber( sp_r ) and sp_r or 2
sp_a = isnumber( sp_a ) and sp_a or 2
r = 125
pnl.radius = 0
pnl.a = 0
pnl.pos_x = 0
pnl.pos_y = 0
pnl:paintover( function( s, w, h )
if s.a < 1 then return end
design.circle_ol( s.pos_x, s.pos_y, s.radius, ColorAlpha( clr, s.a ), ColorAlpha( clr, s.a ), ColorAlpha( clr, s.a ) )
s.radius = Lerp( FrameTime( ) * sp_r, s.radius, r or w )
s.a = Lerp( FrameTime( ) * sp_a, s.a, 0 )
end )
pnl:onclick( function( cir )
cir.pos_x, cir.pos_y = cir:CursorPos( )
cir.radius = 0
cir.a = clr.a
end )
end
/*
* ui :: class :: anim :: fade light
*
* animates a pnl by setting pnl opacity to X with fade effect
*
* @param : int alpha
* @param : int time
* @param : fn fn
*/
function uclass.anim_light( pnl, alpha, time, fn )
alpha = isnumber( alpha ) and alpha or 255
time = isnumber( time ) and time or 0.5
pnl:AlphaTo( alpha, time, 0, function( )
fn( pnl )
end )
end
uclass.anim_l = uclass.anim_light
/*
* ui :: class :: anim :: dark
*
* animates a pnl by setting pnl opacity to X with fade effect
*
* @param : int time
* @param : fn fn
*/
function uclass.anim_dark( pnl, time, fn )
time = isnumber( time ) and time or 0.5
pnl:AlphaTo( 0, time, 0, function( )
fn( pnl )
end )
end
uclass.anim_d = uclass.anim_dark
/*
* ui :: class :: anim :: to color
*
* changes pnl color using animated fade
*
* @param : clr clr
* @param : int time
* @param : fn fn
*/
function uclass.anim_color( pnl, clr, time, fn )
clr = IsColor( clr ) and clr or Color( 255, 255, 255, 255 )
time = isnumber( time ) and time or 0.5
pnl:ColorTo( clr, time, 0, function( )
fn( pnl )
end )
end
uclass.anim_clr = uclass.anim_color
/*
* ui :: class :: avatar
*
* @param : ply pl
* @param : int sz
*/
function uclass.player( pnl, pl, sz )
if not helper.ok.ply( pl ) then return end
sz = isnumber( sz ) and sz or 32
pnl:SetPlayer( pl, sz )
end
uclass.ply = uclass.player
/*
* ui :: class :: DButton :: setup
*
* sets up a button using various classes
* should be the first thing executed when creating a new btn element
*/
function uclass.bsetup( pnl )
pnl:nopaint ( )
pnl:onhover ( )
pnl:ondisabled ( )
pnl:notext ( )
end
uclass.SetupBtn = uclass.bsetup
/*
* ui :: class :: SetupAnim
*
* setup of animations
*
* @alias : SetupAnim, setupanim, anim_setup
*
* @param : str name
* @param : int sp
* @param : func fn
*/
function uclass.SetupAnim( pnl, name, sp, fn )
fn = pnl.FnAnim or fn
pnl[ name ] = 0
pnl[ 'Think' ] = function( s )
s[ name ] = Lerp(FrameTime( ) * sp, s[ name ], fn( s ) and 1 or 0 )
end
end
uclass.setupanim = uclass.SetupAnim
uclass.anim_setup = uclass.SetupAnim
/*
* metatable :: ui
*
* mt registers new associated classes
*/
function dmeta:ui( )
self.Class = function( pnl, name, ... )
local fn = uclass[ name ]
assert( fn, lang( 'logs_inf_pnl_assert', name ) )
fn( pnl, ... )
return pnl
end
for k, v in pairs( uclass ) do
self[ k ] = function( pnl, ... )
if not pnl then return end
return pnl:Class( k, ... )
end
end
return self
end
/*
* ui :: new
*
* creates a new vgui element
*
* @note : deprecated in v3.1
*
* @param : str class
* @param : pnl panel
* @param : str name
*/
function ui.new( class, panel, name )
if not class then
log( 2, lang( 'logs_inf_regclass_err' ) )
return
end
class = ui.element( class ) or class
name = isstring( name ) and name or 'none'
local pnl = vgui.Create( class, panel, name )
if not ui:valid( pnl ) then return end
return pnl:ui( )
end
ui.gmod = ui.new
/*
* ui :: rlib
*
* creates new pnl for rlib
* pnl must be registered in the modules env / manifest file
*
* @ex : ui.rlib( mod, 'rlib_module_pnl' )
* : ui.rlib( mod, 'rlib_module_pnl', parent )
*
* @param : tbl mod
* @param : str id
* @param : pnl panel
* @param : str name
*/
function ui.rlib( mod, id, panel, name )
if not id then
log( 2, lang( 'logs_inf_regclass_err' ) )
return
end
local call = rlib:resource( mod, 'pnl', id )
name = isstring( name ) and name or 'none'
local pnl = vgui.Create( call, panel, name )
if not ui:valid( pnl ) then return end
return pnl:ui( )
end
/*
* ui :: add
*
* creates a new vgui element, adds the specified object to the panel.
* similar to Panel:Add( )
*
* @param : str class
* @param : pnl parent
*/
function ui.add( class, parent )
if not class then
log( 2, lang( 'logs_inf_regclass_err' ) )
return
end
class = ui.element( class ) or class
local pnl = parent:Add( class )
return pnl:ui( )
end
/*
* ui :: route // relink
*
* routes one pnl to another while providing access to metatable classes
*
* @ex : mod.pnl.root = ui.route( mod.pnl.root, self )
* : mod.pnl.root = ui.relink( mod.pnl.root, self )
*
* @param : pnl parent
* @param : pnl pnl
*/
function ui.route( parent, pnl )
parent = pnl
return pnl:ui( )
end
uclass.relink = uclass.route
uclass.symlink = uclass.route
/*
* ui :: get
*
* returns the metatable for an existing pnl
* useful for continuing where you left off when setting values for a pnl
*
* @ex : local root_pnl = ui.get( mod.pnl.root )
* :wide ( 100 )
*
* @param : pnl pnl
* : target panel
*/
function ui.get( pnl )
if not ui:valid( pnl ) then return end
return pnl:ui( )
end
/*
* ui :: edit
*
* allows you to edit a pnl on the fly
* validates the panel first prior and prevents random
* nil pnl errors from occuring
*
* @ex : ui.edit( mod.pnl.root, 'wide', 500 )
* : ui.edit( mod.pnl.root, 'zpos', 1 )
*
* @param : pnl pnl
* @param : str fn_name
* @param : vararg ...
* : target panel
*/
function ui.edit( pnl, fn_name, ... )
if not ui:valid( pnl ) then return end
if not isstring( fn_name ) then return end
uclass[ fn_name ]( pnl, ... )
end
|
-- Author: Edward Koltun
-- Date: March 3, 2022
--[[
$module FCMStrings
Summary of modifications:
- Methods that accept `FCString` now also accept Lua `string` and `number` (except for folder loading methods which do not accept `number`).
- Setters that accept `FCStrings` now also accept multiple arguments of `FCString`, Lua `string`, or `number`.
]]
local mixin = require("library.mixin")
local library = require("library.general_library")
local props = {}
local temp_str = finale.FCString()
--[[
% AddCopy
**[Override]**
Accepts Lua `string` and `number` in addition to `FCString`.
@ self (FCMStrings)
@ str (FCString|string|number)
: (boolean) True on success.
]]
function props:AddCopy(str)
mixin.assert_argument(str, {"string", "number", "FCString"}, 2)
if type(str) ~= "userdata" then
temp_str.LuaString = tostring(str)
str = temp_str
end
return self:AddCopy_(str)
end
--[[
% AddCopies
**[Override]**
Same as `AddCopy`, but accepts multiple arguments so that multiple strings can be added at a time.
@ self (FCMStrings)
@ ... (FCStrings|FCString|string|number) `number`s will be cast to `string`
: (boolean) `true` if successful
]]
function props:AddCopies(...)
for i = 1, select("#", ...) do
local v = select(i, ...)
mixin.assert_argument(v, {"FCStrings", "FCString", "string", "number"}, i + 1)
if type(v) == "userdata" and v:ClassName() == "FCStrings" then
for str in each(v) do
v:AddCopy_(str)
end
else
mixin.FCStrings.AddCopy(self, v)
end
end
return true
end
--[[
% CopyFrom
**[Override]**
Accepts multiple arguments.
@ self (FCMStrings)
@ ... (FCStrings|FCString|string|number) `number`s will be cast to `string`
: (boolean) `true` if successful
]]
function props:CopyFrom(...)
local num_args = select("#", ...)
local first = select(1, ...)
mixin.assert_argument(first, {"FCStrings", "FCString", "string", "number"}, 2)
if library.is_finale_object(first) and first:ClassName() == "FCStrings" then
self:CopyFrom_(first)
else
self:ClearAll_()
mixin.FCMStrings.AddCopy(self, first)
end
for i = 2, num_args do
local v = select(i, ...)
mixin.assert_argument(v, {"FCStrings", "FCString", "string", "number"}, i + 1)
if type(v) == "userdata" then
if v:ClassName() == "FCString" then
self:AddCopy_(v)
elseif v:ClassName() == "FCStrings" then
for str in each(v) do
v:AddCopy_(str)
end
end
else
temp_str.LuaString = tostring(v)
self:AddCopy_(temp_str)
end
end
return true
end
--[[
% Find
**[Override]**
Accepts Lua `string` and `number` in addition to `FCString`.
@ self (FCMStrings)
@ str (FCString|string|number)
: (FCMString|nil)
]]
function props:Find(str)
mixin.assert_argument(str, {"string", "number", "FCString"}, 2)
if type(str) ~= "userdata" then
temp_str.LuaString = tostring(str)
str = temp_str
end
return self:Find_(str)
end
--[[
% FindNocase
**[Override]**
Accepts Lua `string` and `number` in addition to `FCString`.
@ self (FCMStrings)
@ str (FCString|string|number)
: (FCMString|nil)
]]
function props:FindNocase(str)
mixin.assert_argument(str, {"string", "number", "FCString"}, 2)
if type(str) ~= "userdata" then
temp_str.LuaString = tostring(str)
str = temp_str
end
return self:FindNocase_(str)
end
--[[
% LoadFolderFiles
**[Override]**
Accepts Lua `string` in addition to `FCString`.
@ self (FCMStrings)
@ folderstring (FCString|string)
: (boolean) True on success.
]]
function props:LoadFolderFiles(folderstring)
mixin.assert_argument(folderstring, {"string", "FCString"}, 2)
if type(str) ~= "userdata" then
temp_str.LuaString = tostring(folderstring)
folderstring = temp_str
end
return self:LoadFolderFiles_(folderstring)
end
--[[
% LoadSubfolders
**[Override]**
Accepts Lua `string` in addition to `FCString`.
@ self (FCMStrings)
@ folderstring (FCString|string)
: (boolean) True on success.
]]
function props:LoadSubfolders(folderstring)
mixin.assert_argument(folderstring, {"string", "FCString"}, 2)
if type(str) ~= "userdata" then
temp_str.LuaString = tostring(folderstring)
folderstring = temp_str
end
return self:LoadSubfolders_(folderstring)
end
--[[
% InsertStringAt
**[>= v0.59] [Fluid] [Override]**
Accepts Lua `string` and `number` in addition to `FCString`.
@ self (FCMStrings)
@ str (FCString|string|number)
@ index (number)
]]
if finenv.MajorVersion > 0 or finenv.MinorVersion >= 59 then
function props:InsertStringAt(str, index)
mixin.assert_argument(str, {"string", "number", "FCString"}, 2)
mixin.assert_argument(index, "number", 3)
if type(str) ~= "userdata" then
temp_str.LuaString = tostring(str)
str = temp_str
end
self:InsertStringAt_(str, index)
end
end
return props
|
require "luaClass.init"
_ENV=namespace "test"
using_namespace "luaClass"
---@class EmmyLuaTest
local EmmyLuaTest=class "EmmyLuaTest" {
public{
FUNCTION.EmmyLuaTest;
FUNCTION.get;
FUNCTION.set;
};
protected{
MEMBER.lua23333;
MEMBER.lua996;
}
}
function EmmyLuaTest:EmmyLuaTest()
self.lua23333=996;
self.lua996=9999;
end
---@return number
function EmmyLuaTest:get()
return self.lua23333
end
---@param value number
---@return number
function EmmyLuaTest:set(value)
return self.lua996
end
local emmy=EmmyLuaTest()
print(emmy:get())
|
#!/usr/bin/luajit
-- ---------------------------------------------
-- dae_gifanim.lua 2014/03/30
-- Copyright (c) 2014 Jun Mizutani,
-- released under the MIT open source license.
-- ---------------------------------------------
-- usage
-- $ luajit dae_gifanim.lua collada.dae texture.png
-- $ convert -delay 3 ss_*.png dae_anim.gif
package.path = "../LjES/?.lua;" .. package.path
local demo = require("demo")
require("ColladaShape")
require("Schedule")
-- globals
local TEXTUTE_FILE = ""
local COLLADA_FILE = "hand.dae"
local g_totalVertices = 0
local g_totalTriangles = 0
local skeletons = {}
local bones = {}
local BONE = 1
local MESH = 1
local MAXBONE = 1
local HELP = false
local MAXMESH = 1
local anim_stopped = false
local shapes
demo.screen(0, 0)
local aSpace = demo.getSpace()
function setBoneParams()
bones = skeletons[MESH]
if bones then MAXBONE = #bones end
end
function showBones(true_or_false)
for i = 1, #shapes do
local shape = shapes[i]
local skeleton = shape:getSkeleton()
skeleton:showBone(true_or_false)
end
demo.aSpace:scanSkeletons()
end
function createBoneShape(a, r, g, b)
local shape = Shape:new()
shape:simpleBone(a)
shape:shaderParameter("color", {r, g, b, 1.0})
return shape
end
-- --------------------------------------------------------------------
-- main
-- --------------------------------------------------------------------
if arg[1] ~= nil then COLLADA_FILE = arg[1] end
if arg[2] ~= nil then TEXTUTE_FILE = arg[2] end
demo.backgroundColor(0.2, 0.2, 0.4)
-- texture
if TEXTUTE_FILE ~= "" then
require("Texture")
tex = Texture:new()
tex:readImageFromFile(TEXTUTE_FILE)
end
local start = aSpace:now()
local boneFlag = true
local verboseFlag = false
-- load collada
local collada = ColladaShape:new()
local collada_text = util.readFile(COLLADA_FILE)
collada:parse(collada_text ,verboseFlag)
shapes = collada:makeShapes(boneFlag, verboseFlag)
collada:releaseMeshes()
for i = 1, #shapes do
shapes[i]:releaseObjects()
end
if shapes[1].anim ~= nil then
shapes[1].anim:list()
end
MAXMESH = #shapes
-- print loading time
local time = aSpace:now() - start
util.printf("loading time = %f sec \n", time)
local node = aSpace:addNode(nil, "node1")
node:setPosition(0, 0, 0)
local fig = aSpace:addNode(node, "fig")
fig:setPosition(0, 0, 0)
fig:setAttitude(0, 0, 0)
-- set bone shape
local size = demo.getShapeSize(shapes)
local bone_shape = createBoneShape(size.max/100, 1, 1, 1)
-- set eye position
local eye = aSpace:addNode(nil, "eye")
eye:setPosition(size.centerx, size.centery, size.max * 1.2)
for i = 1, #shapes do
local shape = shapes[i]
local skeleton = shape:getSkeleton()
if (skeleton ~= nil) and (skeleton:getBoneCount() > 0) then
skeleton:setBoneShape(bone_shape)
table.insert(skeletons, skeleton:getBoneOrder())
else
util.printf("No skeleton")
end
fig:addShape(shape)
if TEXTUTE_FILE ~= "" then
shape:shaderParameter("use_texture", 1)
shape:shaderParameter("texture", tex)
shape:shaderParameter("color", {1.0, 1.0, 1.0, 1.0})
else
shape:shaderParameter("use_texture", 0)
shape:shaderParameter("color", {0.8, 0.7, 0.6, 1.0})
end
util.printf("object vertex#=%d triangle#=%d\n", shape:getVertexCount(),
shape:getTriangleCount())
g_totalVertices = g_totalVertices + shape:getVertexCount()
g_totalTriangles = g_totalTriangles + shape:getTriangleCount()
end
demo.aText:setScale(1)
setBoneParams()
-- --------------------------------------------
-- [1][2][3][4][5][6][7][8][9][0][-][^][\]
-- [Q][W][e][r][T][y][u][I][o][P][@]
-- [A][S][D][F][G][h][J][K][l]
-- [Z][X][c][v][B][n][m][,][.][/]
-- --------------------------------------------
function keyFunc(key)
local ROT = 1.0
local MOV = 0.3
if (key == 'h') then
demo.aText:clearScreen()
if HELP then HELP = false else HELP = true end
elseif (key == 'w') then node:rotateX(ROT)
elseif (key == 's') then node:rotateX(-ROT)
elseif (key == 'a') then node:rotateY(ROT)
elseif (key == 'd') then node:rotateY(-ROT)
elseif (key == 'z') then node:rotateZ(ROT)
elseif (key == 'x') then node:rotateZ(-ROT)
elseif (key == 'j') then
BONE = BONE - 1
if BONE < 1 then BONE = 1 end
elseif (key == 'k') then
BONE = BONE + 1
if BONE > MAXBONE then BONE = MAXBONE end
elseif (key == 'o') then fig.shapes[MESH]:hide(true)
elseif (key == 'i') then fig.shapes[MESH]:hide(false)
elseif (key == 'm') then
MESH = MESH + 1
if MESH > MAXMESH then MESH = MAXMESH end
setBoneParams()
if BONE > MAXBONE then BONE = MAXBONE end
elseif (key == 'n') then
MESH = MESH - 1 if MESH < 1 then MESH = 1 end
setBoneParams()
if BONE > MAXBONE then BONE = MAXBONE end
elseif (key == '1') then eye:move( MOV, 0, 0)
elseif (key == '2') then eye:move(-MOV, 0, 0)
elseif (key == '3') then eye:move( 0, MOV, 0)
elseif (key == '4') then eye:move( 0,-MOV, 0)
elseif (key == '5') then eye:move( 0, 0, MOV)
elseif (key == '6') then eye:move( 0, 0,-MOV)
elseif (key == '9') then showBones(true)
elseif (key == '0') then showBones(false)
elseif (key == '@') then
fig.shapes[1].anim:start()
anim_stopped = false
elseif (key == '/') then
fig.shapes[1].anim:transitionTo(1000, 1, -1)
-- BONE は MESH に依存することに注意
elseif bones ~= nil then
if (key == 'e') then bones[BONE]:rotateX(ROT)
elseif (key == 'r') then bones[BONE]:rotateX(-ROT)
elseif (key == 'c') then bones[BONE]:rotateZ(ROT)
elseif (key == 'v') then bones[BONE]:rotateZ(-ROT)
elseif (key == 'y') then bones[BONE]:rotateY(ROT)
elseif (key == 'u') then bones[BONE]:rotateY(-ROT)
end
end
return key
end
function draw_help()
local t = demo.aText
t:writeAt(3, 3, "+ -")
t:writeAt(2, 4, "[w] - [s] : rotate X")
t:writeAt(2, 5, "[a] - [d] : rotate Y")
t:writeAt(2, 6, "[z] - [x] : rotate Z")
t:writeAt(0, 7, "Bone")
t:writeAt(2, 8, "[e] - [r] : rotate X")
t:writeAt(2, 9, "[c] - [v] : rotate Z")
t:writeAt(2,10, "[y] - [u] : rotate Y")
t:writeAt(2,12, "[n] - [m] : select Mesh")
t:writeAt(2,13, "[j] - [k] : select Bone")
t:writeAt(2,14, "[o] - [i] : hide / show")
t:writeAt(2,15, "[0] - [9] : hide/show bones")
t:writeAt(2,16, "[p] : Screenshot")
t:writeAt(2,17, "[t] : on top")
t:writeAt(2,18, "[b] : on bottom")
t:writeAt(2,19, "[g] : initial screen")
t:writeAt(2,20, "[f] : full screen ")
t:writeAt(2,21, "[h] : help on/off ")
t:writeAt(2,22, "[@] : Replay animation")
t:writeAt(2,24, "[q] : QUIT")
end
local g_count = 0
function draw()
local t = demo.aText
if HELP then
draw_help()
else
t:writefAt(0, 3, "Vertices :%6d", g_totalVertices)
t:writefAt(0, 4, "Triangles :%6d", g_totalTriangles)
t:writeAt(2, 21, "[h] : help on/off ")
end
--node:rotateY(0.5)
if fig.shapes[1].anim ~= nil then
local running = fig.shapes[1].anim:playFps(33)
if running < 0 then fig.shapes[1].anim:start() end
end
aSpace:draw(eye)
demo.aScreen:screenShot(string.format("ss_%03d.png", g_count))
g_count = g_count + 1
if bones ~= nil and bones[BONE] ~= nil then
t:writefAt(0, 2, "Mesh:%2d/%2d Bone:%2d/%2d [%s] ",
MESH, MAXMESH, BONE, MAXBONE, bones[BONE].name)
t:writefAt(40, 0, "World H:%6.2f, P:%6.2f, B:%6.2f",
bones[BONE]:getWorldAttitude())
t:writefAt(46, 1, "X:%6.2f, Y:%6.2f, Z:%6.2f",
unpack(bones[BONE]:getWorldPosition()))
t:writefAt(40, 2, "Local h:%6.2f, p:%6.2f, b:%6.2f",
bones[BONE]:getLocalAttitude())
t:writefAt(46, 3, "x:%6.2f, y:%6.2f, z:%6.2f",
unpack(bones[BONE]:getPosition()))
--[[
t:writefAt(40, 5, "Node H:%6.2f, P:%6.2f, B:%6.2f",
fig:getWorldAttitude())
t:writefAt(46, 6, "X:%6.2f, Y:%6.2f, Z:%6.2f",
unpack(fig:getWorldPosition()))
--]]
else
t:writefAt(0,2, "Mesh:%2d/%2d Bone:%2d/%2d ",
MESH, MAXMESH, BONE, MAXBONE)
end
end
--showBones(true)
if fig.shapes[1].anim ~= nil then
fig.shapes[1].anim:start()
end
demo.loop(draw, true, keyFunc)
demo.exit()
|
-- thermite_mine
-- thermite_spark_mine
-- thermite_drip_mine
-- steam_mine
return {
["thermite_mine"] = {
fakelight = {
air = false,
class = [[CSimpleGroundFlash]],
count = 4,
ground = true,
water = false,
properties = {
colormap = [[1 0.8 0.3 1 1 0.8 0.15 1 0 0 0 0.1]],
size = [[16 r0.15]],
sizegrowth = [[0 r-0.15]],
texture = [[groundflash]],
ttl = [[150 r4 r-4]],
},
},
fakelight1 = {
air = false,
class = [[CSimpleGroundFlash]],
count = 4,
ground = true,
water = false,
properties = {
colormap = [[1 0.8 0.3 1 1 0.8 0.15 1 0 0 0 0.1]],
size = [[23 r0.15]],
sizegrowth = [[0 r-0.25]],
texture = [[groundflash]],
ttl = [[100 r4 r-4]],
},
},
smokecloud = {
air = false,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
underwater = false,
water = true,
properties = {
airdrag = 0.83,
colormap = [[0.6 0.3 0 0.8 0.1 0.1 0.1 0.8 0.1 0.1 0.1 0.8 0 0 0 0.01]],
directional = false,
emitrot = 0,
emitrotspread = [[0 r360 r-360]],
emitvector = [[0,1,0]],
gravity = [[0, 0.1, 0]],
numparticles = 28,
particlelife = 52,
particlelifespread = 30,
particlesize = 5,
particlesizespread = 25,
particlespeed = [[2 i0.25]],
particlespeedspread = 4,
pos = [[0, 0, 0]],
sizegrowth = -0.35,
sizemod = 1.0,
texture = [[GenericSmokeCloud1]],
useairlos = true,
},
},
Spawner_thermite_smoke = {
air = true,
class = [[CExpGenSpawner]],
count = 20, --10
ground = true,
water = true,
unit = 0,
properties = {
delay = [[2 i4]],
explosiongenerator = [[custom:thermite_smoke_mine]],
pos = [[-5 r5,-2 r2,-5 r5]],
},
},
Spawner_thermite_glow = {
air = true,
class = [[CExpGenSpawner]],
count = 20, --10
ground = true,
water = true,
unit = 0,
properties = {
delay = [[2 i4]],
explosiongenerator = [[custom:thermite_glow_mine]],
pos = [[-5 r5,-2 r2,-5 r5]],
},
},
Spawner_thermite_spark = {
air = true,
class = [[CExpGenSpawner]],
count = 80, --10
ground = true,
water = true,
unit = 0,
properties = {
delay = [[2 i1]],
explosiongenerator = [[custom:thermite_spark_mine]],
pos = [[0, 0, 0]],
},
},
Spawner_thermite_drip = {
air = false, -- will only trigger if spawned on air + unit(check spawn conditions in ceg)
class = [[CExpGenSpawner]],
count = 38, --10
ground = false,
water = false,
unit = true,
properties = {
delay = [[2 i2]],
explosiongenerator = [[custom:thermite_drip_mine]],
pos = [[-5 r5,-2 r2,-5 r5]],
},
},
Spawner_Steam = {
air = false,
class = [[CExpGenSpawner]],
count = 20, --5
ground = false,
water = true,
properties = {
delay = [[0 i5]],
explosiongenerator = [[custom:steam_mine]],
pos = [[0, 0, 0]],
},
},
},
["thermite_smoke_mine"] = {
smokecloud = {
air = false,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
underwater = false,
water = true,
properties = {
airdrag = 0.83,
colormap = [[0.6 0.3 0 0.8 0.1 0.1 0.1 0.8 0.1 0.1 0.1 0.8 0 0 0 0.01]],
directional = false,
emitrot = 0,
emitrotspread = [[0 r360 r-360]],
emitvector = [[0,1,0]],
gravity = [[0, 0.1, 0]],
numparticles = 4,
particlelife = 52,
particlelifespread = 30,
particlesize = 5,
particlesizespread = 25,
particlespeed = [[2 i0.25]],
particlespeedspread = 4,
pos = [[0, 0, 0]],
sizegrowth = -0.35,
sizemod = 1.0,
texture = [[GenericSmokeCloud1]],
useairlos = true,
},
},
},
["thermite_glow_mine"] = {
explosionball = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 0.92,
colormap = [[1 0.5 0 .2 0.9 0.8 0.7 0.5 0.6 0.3 0 .1 0 0 0 0.01]],
directional = true,
emitrot = 0,
emitrotspread = 360,
emitvector = [[0, 1, 0]],
gravity = [[0, 0, 0]],
numparticles = 6,
particlelife = 44,
particlelifespread = 4,
particlesize = 2,
particlesizespread = 8,
particlespeed = [[0 r0.2 i-0.05]],
particlespeedspread = 1.5,
pos = [[0, 5, 0]],
sizegrowth = [[0.50 r-.50]],
sizemod = 1.0,
texture = [[smokeorange]],
useairlos = true,
},
},
explosionball_white = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
water = true,
properties = {
airdrag = 0.92,
colormap = [[1 0.5 0 .7 0.9 0.9 0.9 0.5 0.6 0.6 0.6 .1 0 0 0 0.01]],
directional = true,
emitrot = 0,
emitrotspread = 360,
emitvector = [[0, 1, 0]],
gravity = [[0, 0, 0]],
numparticles = 2,
particlelife = 44,
particlelifespread = 4,
particlesize = 2,
particlesizespread = 8,
particlespeed = [[0 r0.2 i-0.05]],
particlespeedspread = 1.5,
pos = [[0, 5, 0]],
sizegrowth = [[0.50 r-.50]],
sizemod = 1.0,
texture = [[smokeorange]],
useairlos = true,
},
},
},
["thermite_spark_mine"] = {
spark = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = true,
unit = 0,
water = false,
properties = {
airdrag = 0.86,
colormap = [[1 0.5 0 .01 0.6 .24 0.05 .008 0 0 0 0.01]],
directional = true,
emitrot = 0,
emitrotspread = [[0 r-360 r360]],
emitvector = [[0, 1, 0]],
gravity = [[0, -.25 r0.15 r-1, 0]],
numparticles = 5,
particlelife = 11,
particlelifespread = 30,
particlesize = 1,
particlesizespread = 2,
particlespeed = 5,
particlespeedspread = 3,
pos = [[0, 0, 0]],
sizegrowth = [[0.0 r.05]],
sizemod = 1.0,
texture = [[Plasma]],
useairlos = true,
},
},
},
["thermite_drip_mine"] = {
spark = {
air = true,
class = [[CSimpleParticleSystem]],
count = 1,
ground = false,
unit = false,
water = false,
properties = {
airdrag = 0.70,
colormap = [[1 0.5 0 .01 0.6 .24 0.05 .008 0 0 0 0.01]],
directional = true,
emitrot = 180,
emitrotspread = [[0 r-360 r360]],
emitvector = [[0, 0.75, 0]],
gravity = [[0, -1.25 r0.15 r1, 0]],
numparticles = 9,
particlelife = 11,
particlelifespread = 50,
particlesize = 1,
particlesizespread = 2,
particlespeed = 0.6,
particlespeedspread = 3,
pos = [[-6 r6,0,-6 r6]],
sizegrowth = [[0.0 r.05]],
sizemod = 1.0,
texture = [[Plasma]],
useairlos = true,
},
},
},
["steam_mine"] = {
steamcloud = {
air = false,
class = [[CSimpleParticleSystem]],
count = 1,
ground = false,
underwater = false,
water = true,
properties = {
airdrag = 0.83,
colormap = [[0.05 0.05 0.05 0.01 0.05 0.05 0.05 0.01 0 0 0 0.01]],
directional = false,
emitrot = 0,
emitrotspread = [[0 r360 r-360]],
emitvector = [[0,1,0]],
gravity = [[0, 0.6, 0]],
numparticles = 7,
particlelife = 27,
particlelifespread = 30,
particlesize = 6,
particlesizespread = 25,
particlespeed = [[2 i0.25]],
particlespeedspread = 4,
pos = [[0, 0, 0]],
sizegrowth = -0.35,
sizemod = 1.0,
texture = [[clouds2]],
useairlos = true,
},
},
},
}
|
-- Apocalypse Rising Scripts I made :D:D
-- Ultimate God Mode(Infinite Stamina, Hunger, Thirst, and Health)
-- Ultimate God Mode
STAMINA = true
GETPLAYER = game.Workspace:FindFirstChild(game.Workspace.HillaryAssassination.Name)
while wait() do
game.Lighting.Remote.AddHealth:FireServer(GETPLAYER.Humanoid, 999999)
game.Players.LocalPlayer.playerstats.Hunger.Value = 100
game.Players.LocalPlayer.playerstats.Thirst.Value = 100
if STAMINA == true then
game.Players.LocalPlayer.Backpack.GlobalFunctions.Stamina.Value = 100
end
end
-- TP All Cars to you
-- TP All Cars
for get, Car in pairs(workspace.Vehicles:GetChildren()) do
if Car.Name == Firetruck.Name then
Car:MoveTo(workspace[game.Players.LocalPlayer.Name].Torso.Position + Vector3.new(math.random(0,20),0,math.random(0,20)))
end
end
--Set Car Speed(In CAR Variable, put Vehicle name where it says VEHICLE)
-- Car Speed
CAR = game.Workspace.Vehicles.VEHICLE.Name
for i,v in ipairs(game.Workspace.Vehicles:GetChildren()) do
local Car = game.Workspace.Vehicles[CAR]
Car.Stats.MaxSpeed.Offroad.Value = 500
Car.Stats.MaxSpeed.Value = 500
end
while wait() do
for i,v in pairs(game.Workspace.Vehicles:GetChildren()) do
if v.Name ~= "Holder" or v.Name ~= "VehicleWreck" then
if v:FindFirstChild("Stats") then
v.Stats.Engine.Value = 100
v.Stats.Tank.Value = 100
v.Stats.Hull.Value = 100
v.Stats.Armor.Value = 100
v.Stats.Fuel.Value = 100
end
end
end
end
|
-- This file should return a table that contains static values that aren't user-
-- configurable, but should be accessible at various places.
return {
content_types = {
"raw",
"markdown",
--"latex",
--"ascii",
--"imgonly"
},
}
|
local cmp = require("cmp")
return {
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<Tab>"] = cmp.mapping.select_next_item(),
["<S-Tab>"] = cmp.mapping.select_prev_item(),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
["<C-e>"] = cmp.mapping.confirm({
behavior = cmp.ConfirmBehavior.Insert,
select = true,
}),
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-4), { "i", "c" }),
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(4), { "i", "c" }),
["<PageUp>"] = function(fallback)
for i = 1, 8 do
cmp.mapping.select_prev_item()(nil)
end
end,
["<PageDown>"] = function(fallback)
for i = 1, 8 do
cmp.mapping.select_next_item()(nil)
end
end,
}
|
local getZoneNameEx = function(x, y, z)
local zone = getZoneName(x, y, z)
if zone == 'East Beach' then
return 'Bayrampaşa'
elseif zone == 'Ganton' then
return 'Bağcılar'
elseif zone == 'East Los Santos' then
return 'Bayrampaşa'
elseif zone == 'Las Colinas' then
return 'Çatalca'
elseif zone == 'Jefferson' then
return 'Esenler'
elseif zone == 'Glen Park' then
return 'Esenler'
elseif zone == 'Downtown Los Santos' then
return 'Kağıthane'
elseif zone == 'Commerce' then
return 'Beyoğlu'
elseif zone == 'Market' then
return 'Mecidiyeköy'
elseif zone == 'Temple' then
return '4. Levent'
elseif zone == 'Vinewood' then
return 'Kemerburgaz'
elseif zone == 'Richman' then
return '4. Levent'
elseif zone == 'Rodeo' then
return 'Sarıyer'
elseif zone == 'Mulholland' then
return 'Kemerburgaz'
elseif zone == 'Red County' then
return 'Kemerburgaz'
elseif zone == 'Mulholland Intersection' then
return 'Kemerburgaz'
elseif zone == 'Los Flores' then
return 'Sancak Tepe'
elseif zone == 'Willowfield' then
return 'Zeytinburnu'
elseif zone == 'Playa del Seville' then
return 'Zeytinburnu'
elseif zone == 'Ocean Docks' then
return 'İkitelli'
elseif zone == 'Los Santos' then
return 'İstanbul'
elseif zone == 'Los Santos International' then
return 'Atatürk Havalimanı'
elseif zone == 'Jefferson' then
return 'Esenler'
elseif zone == 'Verdant Bluffs' then
return 'Rümeli Hisarı'
elseif zone == 'Verona Beach' then
return 'Ataköy'
elseif zone == 'Santa Maria Beach' then
return 'Florya'
elseif zone == 'Marina' then
return 'Bakırköy'
elseif zone == 'Idlewood' then
return 'Güngören'
elseif zone == 'El Corona' then
return 'Küçükçekmece'
elseif zone == 'Unity Station' then
return 'Merter'
elseif zone == 'Little Mexico' then
return 'Taksim'
elseif zone == 'Pershing Square' then
return 'Taksim'
elseif zone == 'Las Venturas' then
return 'Edirne'
else
return zone
end
end
addCommandHandler('p', function(thePlayer, cmd, ...)
if thePlayer:getData('called') or thePlayer:getData('caller') then
if (...) then
local message = table.concat({...}, " ")
if thePlayer:getData('call.services') then
global:sendLocalText(thePlayer, '#D0D0D0(Telefon) '..thePlayer.name:gsub("_"," ")..': '..message, 196, 255, 255)
thePlayer:outputChat('[!]#D0D0D0 İhbar gönderdiniz, lütfen sabırla bekleyin.',195,184,116,true)
if thePlayer:getData('call.num') == 155 then
for _, p in ipairs(getPlayersInTeam(getTeamFromName ("İstanbul Emniyet Müdürlüğü"))) do
p:outputChat('#6464FF[!]#8B8B8E (CH: 155) '..thePlayer:getData('lastPhoneId')..' telefon numarasıyla bir ihbar geldi.',0,0,0,true)
p:outputChat('#6464FF[!]#8B8B8E (CH: 155) İhbar: '..message,0,0,0,true)
p:outputChat('#6464FF[!]#8B8B8E (CH: 155) Lokasyon: '..getZoneNameEx(thePlayer.position.x, thePlayer.position.y, thePlayer.position.z),0,0,0,true)
triggerClientEvent(p,"walkie.sound",p)
end
elseif thePlayer:getData('call.num') == 156 then
for _, p in ipairs(getPlayersInTeam(getTeamFromName ("İstanbul İl Jandarma Komutanlığı"))) do
p:outputChat('#6464FF[!]#8B8B8E (CH: 156) '..thePlayer:getData('lastPhoneId')..' telefon numarasıyla bir ihbar geldi.',0,0,0,true)
p:outputChat('#6464FF[!]#8B8B8E (CH: 156) İhbar: '..message,0,0,0,true)
p:outputChat('#6464FF[!]#8B8B8E (CH: 156) Lokasyon: '..getZoneNameEx(thePlayer.position.x, thePlayer.position.y, thePlayer.position.z),0,0,0,true)
triggerClientEvent(p,"walkie.sound",p)
end
elseif thePlayer:getData('call.num') == 112 then
for _, p in ipairs(getPlayersInTeam(getTeamFromName ("İstanbul Devlet Hastanesi"))) do
p:outputChat('#5F5F5F[!]#D55858 (CH: 112) '..thePlayer:getData('lastPhoneId')..' telefon numarasıyla bir ihbar geldi.',0,0,0,true)
p:outputChat('#5F5F5F[!]#D55858 (CH: 112) İhbar: '..message,0,0,0,true)
p:outputChat('#5F5F5F[!]#D55858 (CH: 112) Lokasyon: '..getZoneNameEx(thePlayer.position.x, thePlayer.position.y, thePlayer.position.z),0,0,0,true)
triggerClientEvent(p,"walkie.sound",p)
end
end
thePlayer:setData('call.services', nil)
thePlayer:setData('called', nil)
thePlayer:setData('caller', nil)
thePlayer:setData('call.num', nil)
thePlayer:setData('callTarget', nil)
else
local targetPlayer = thePlayer:getData('callTarget') or nil
if targetPlayer then
if thePlayer:getData('callWaiting') then
thePlayer:outputChat('[!]#D0D0D0 Karşı tarafın aramayı kabul etmesini bekleyin.',195,184,116,true)
else
global:sendLocalText(thePlayer, '#D0D0D0(Telefon) '..thePlayer.name:gsub("_"," ")..': '..message, 196, 255, 255)
targetPlayer:outputChat('#D0D0D0Telefon: '..message,195,184,116,true)
end
else
thePlayer:outputChat('[!]#D0D0D0 Herhangi bir telefon görüşmesinde değilsin.',195,184,116,true)
end
end
else
thePlayer:outputChat('[!]#D0D0D0 /'..cmd..' Text',195,184,116,true)
end
end
end)
|
--[[Author: YOLOSPAGHETTI
Date: March 30, 2016
Gives vision to the caster's team]]
function GiveVisionEnd(keys)
local caster = keys.caster
local target = keys.target
local ability = keys.ability
local vision_radius = ability:GetLevelSpecialValueFor("vision_radius", ability:GetLevel() -1)
local vision_duration = ability:GetLevelSpecialValueFor("vision_duration", ability:GetLevel() -1)
AddFOWViewer(caster:GetTeam(), target:GetAbsOrigin(), vision_radius, vision_duration, false)
end
|
local tr = aegisub.gettext
script_name = tr"复查小助手"
script_description = tr"检查字幕里可能存在的常见问题,并自动修复或提示,部分功能依赖Yutils"
script_author = "晨轩°"
script_version = "1.2.0 Alpha"
-- 载入re库 正则表达
local re = require 'aegisub.re'
include("utils.lua")
-- 辅助支持表
local default_config = {
debug = {
level = 4
}
}
cx_Aeg_Lua = {
debug = {
-- 调试输出定义
-- 设置调试输出等级
level = default_config.debug.level
-- 修改调试输出等级(0~5 设置大于5的等级时不会输出任何信息,设置值小于0时会被置0)
,changelevel = function (level)
if type(level) ~= 'number' then error('错误的调试等级设置!',2) end
if level < 0 then level = 0 end
cx_Aeg_Lua.debug.level = level
end
-- 普通输出(带换行、不带换行)
,println = function (msg)
if cx_Aeg_Lua.debug.level > 5 then return end
if msg ~= nil then
aegisub.debug.out(cx_Aeg_Lua.debug.level, tostring(msg).."\n")
else
aegisub.debug.out(cx_Aeg_Lua.debug.level, "\n")
end
end
,print = function (msg)
if cx_Aeg_Lua.debug.level > 5 then return end
if msg == nil then return end
aegisub.debug.out(cx_Aeg_Lua.debug.level, tostring(msg))
end
-- 输出一个变量的字符串表示
,var_export = function (value)
aegisub.debug.out(cx_Aeg_Lua.debug.level, '('..type(value)..')'..tostring(value)..'\n')
end
-- 直接输出一个表达式结构信息
,var_dump = function (value)
-- print覆盖
local function print(msg)
cx_Aeg_Lua.debug.println(msg)
end
-- 好用的table输出函数
local function print_r(t)
local print_r_cache={}
local function sub_print_r(t,indent)
if (print_r_cache[tostring(t)]) then
print(indent.."*"..tostring(t))
else
print_r_cache[tostring(t)]=true
if (type(t)=="table") then
for pos,val in pairs(t) do
if (type(val)=="table") then
print(indent.."["..pos.."] => "..tostring(t).." {")
sub_print_r(val,indent..string.rep(" ",string.len(pos)+8))
print(indent..string.rep(" ",string.len(pos)+6).."}")
elseif (type(val)=="string") then
print(indent.."["..pos..'] => "'..val..'"')
else
print(indent.."["..pos.."] => "..tostring(val))
end
end
else
print(indent..tostring(t))
end
end
end
if (type(t)=="table") then
print(tostring(t).." {")
sub_print_r(t," ")
print("}")
else
sub_print_r(t," ")
end
print()
end
-- 运行函数
print_r(value)
-- 打印结果
end
}
,display = {
-- 显示一个简单的提示窗口,参数(提示信息[,类型标识[,默认值]])
--[[ 类型标识(返回类型):
0-提示框(nil),提示需要每行尽可能短(不超过9个字)
1-确认取消框(bool)
2-单行文本输入框(string or nil)
3-单行整数输入框(number or nil)
4-单行小数输入框(number or nil)
注意:整数与小数输入有误时不会限制或报错,可能得到奇怪的结果。
]]
confirm = function (msg,type_num,default)
local config = {} -- 窗口配置
local result = nil -- 返回结果
local buttons = nil
local button_ids = nil
if type(msg) ~= 'string' then
error('display.confirm参数错误-1,提示信息必须存在且为文本类型!',2)
end
if type_num == nil then type_num = 0 end
if type(type_num) ~= 'number' then
-- db.var_export(type_num)
error('display.confirm参数错误-2,类型标识必须是数值!',2)
end
if type_num == 0 then
config = {
{class="label", label=msg, x=0, y=0,width=8}
}
buttons = {'OK!'}
button_ids = {ok = 'OK!'}
elseif type_num == 1 then
config = {
{class="label", label=msg, x=0, y=0,width=12}
}
elseif type_num == 2 then
if default == nil then default = '' end
config = {
{class="label", label=msg, x=0, y=0,width=12},
{class="edit", name='text',text=tostring(default), x=0, y=1,width=12}
}
elseif type_num == 3 then
if default == nil then default = 0 end
if type(type_num) ~= 'number' then
error('display.confirm参数错误-3,此标识的默认值必须为数值!',2)
end
config = {
{class="label", label=msg, x=0, y=0,width=12},
{class="intedit", name='int',value=default, x=0, y=1,width=12}
}
elseif type_num == 4 then
if default == nil then default = 0 end
if type(type_num) ~= 'number' then
error('display.confirm参数错误-3,此标识的默认值必须为数值!',2)
end
config = {
{class="label", label=msg, x=0, y=0,width=12},
{class="floatedit", name='float',value=default, x=0, y=1,width=12}
}
else
error('display.confirm参数错误,无效的类型标识!',2)
end
-- 显示对话框
btn, btnresult = aegisub.dialog.display(config,buttons,button_ids)
-- 处理并返回结果
if type_num == 0 then
result = nil
elseif type_num == 1 then
if btn ~= false then
result = true
else
result = false
end
elseif type_num == 2 then
if btn ~= false then
result = btnresult.text
end
elseif type_num == 3 then
if btn ~= false then
result = btnresult.int
end
elseif type_num == 4 then
if btn ~= false then
result = btnresult.float
end
end
-- debug.var_export(result)
return result
end
}
}
debug = cx_Aeg_Lua.debug
display = cx_Aeg_Lua.display
-- 来自karaskel的函数,从subs表收集样式和元数据(有大改)
function karaskel_collect_head(subs)
local meta = {
-- X和Y脚本分辨率
res_x = 0, res_y = 0,
-- 视频/脚本分辨率不匹配的宽高比校正比值
video_x_correct_factor = 1.0
}
local styles = { n = 0 }
local first_style_line = nil -- 文件里的第一行样式位置
-- 第一遍:收集所有现有样式并获取分辨率信息
for i = 1, #subs do
if aegisub.progress.is_cancelled() then error("User cancelled") end
local l = subs[i]
aegisub.progress.set((i/#subs)*4)
if l.class == "style" then
if not first_style_line then first_style_line = i end
-- 将样式存储到样式表中
styles.n = styles.n + 1
styles[styles.n] = l
styles[l.name] = l
l.margin_v = l.margin_t -- 方便
elseif l.class == "info" then
local k = l.key:lower()
meta[k] = l.value
end
end
-- 修正解析度数据(分辨率数据?)
if meta.playresx then
meta.res_x = math.floor(meta.playresx)
end
if meta.playresy then
meta.res_y = math.floor(meta.playresy)
end
if meta.res_x == 0 and meta_res_y == 0 then
meta.res_x = 384
meta.res_y = 288
elseif meta.res_x == 0 then
-- This is braindead, but it's how TextSub does things...
-- 这真是令人头疼,但是这是TextSub做事的方式...
if meta.res_y == 1024 then
meta.res_x = 1280
else
meta.res_x = meta.res_y / 3 * 4
end
elseif meta.res_y == 0 then
-- As if 1280x960 didn't exist
-- 好像不存在1280x960
if meta.res_x == 1280 then
meta.res_y = 1024
else
meta.res_y = meta.res_x * 3 / 4
end
end
local video_x, video_y = aegisub.video_size()
if video_y then
-- 分辨率校正因子
meta.video_x_correct_factor =
(video_y / video_x) / (meta.res_y / meta.res_x)
end
return meta, styles
end
-- 来自karaskel的函数,计算行尺寸信息
function karaskel_preproc_line_pos(meta,line)
-- 有效边距
line.margin_v = line.margin_t
line.eff_margin_l = ((line.margin_l > 0) and line.margin_l) or line.styleref.margin_l
line.eff_margin_r = ((line.margin_r > 0) and line.margin_r) or line.styleref.margin_r
line.eff_margin_t = ((line.margin_t > 0) and line.margin_t) or line.styleref.margin_t
line.eff_margin_b = ((line.margin_b > 0) and line.margin_b) or line.styleref.margin_b
line.eff_margin_v = ((line.margin_v > 0) and line.margin_v) or line.styleref.margin_v
-- 以及定位
if line.styleref.align == 1 or line.styleref.align == 4 or line.styleref.align == 7 then
-- Left aligned::左对齐
line.left = line.eff_margin_l
line.center = line.left + line.width / 2
line.right = line.left + line.width
line.x = line.left
line.halign = "left"
elseif line.styleref.align == 2 or line.styleref.align == 5 or line.styleref.align == 8 then
-- Centered::中心对齐
line.left = (meta.res_x - line.eff_margin_l - line.eff_margin_r - line.width) / 2 + line.eff_margin_l
line.center = line.left + line.width / 2
line.right = line.left + line.width
line.x = line.center
line.halign = "center"
elseif line.styleref.align == 3 or line.styleref.align == 6 or line.styleref.align == 9 then
-- Right aligned::右对齐
line.left = meta.res_x - line.eff_margin_r - line.width
line.center = line.left + line.width / 2
line.right = line.left + line.width
line.x = line.right
line.halign = "right"
end
line.hcenter = line.center
if line.styleref.align >=1 and line.styleref.align <= 3 then
-- Bottom aligned::底部对齐
line.bottom = meta.res_y - line.eff_margin_b
line.middle = line.bottom - line.height / 2
line.top = line.bottom - line.height
line.y = line.bottom
line.valign = "bottom"
elseif line.styleref.align >= 4 and line.styleref.align <= 6 then
-- Mid aligned::中间对齐
line.top = (meta.res_y - line.eff_margin_t - line.eff_margin_b - line.height) / 2 + line.eff_margin_t
line.middle = line.top + line.height / 2
line.bottom = line.top + line.height
line.y = line.middle
line.valign = "middle"
elseif line.styleref.align >= 7 and line.styleref.align <= 9 then
-- Top aligned::顶部对齐
line.top = line.eff_margin_t
line.middle = line.top + line.height / 2
line.bottom = line.top + line.height
line.y = line.top
line.valign = "top"
end
line.vcenter = line.middle
end
-- table表的copy函数(来自Yutils)
function table.copy(t, depth)
-- Check argument
if type(t) ~= "table" or depth ~= nil and not(type(depth) == "number" and depth >= 1) then
error("table and optional depth expected", 2)
end
-- Copy & return
local function copy_recursive(old_t)
local new_t = {}
for key, value in pairs(old_t) do
new_t[key] = type(value) == "table" and copy_recursive(value) or value
end
return new_t
end
local function copy_recursive_n(old_t, depth)
local new_t = {}
for key, value in pairs(old_t) do
new_t[key] = type(value) == "table" and depth >= 2 and copy_recursive_n(value, depth-1) or value
end
return new_t
end
return depth and copy_recursive_n(t, depth) or copy_recursive(t)
end
-- 计算行尺寸信息,参数(元信息表,行对应样式,行对象)
function line_math_pos(meta,style,line)
line.styleref = style
-- 计算行的尺寸信息
line.width, line.height, line.descent, line.ext_lead = aegisub.text_extents(style, line.text)
line.width = line.width * meta.video_x_correct_factor
-- 计算行的布局信息
karaskel_preproc_line_pos(meta,line)
end
-- 行错误检测,收集并选择可能错误的所有行信息,参数(字幕对象,样式表,元信息表),返回值新选择行,错误计数
-- 旗下函数通用返回值 bool-是否存在问题,line-行,msg-错误信息
function subs_check_line(subs,styles,meta,select_check)
new_selected = {}
-- 默认检测
select_check_def = {
size = true,-- 尺寸异常
error_char = true, -- 乱码字符
style = true -- 样式不存在
}
if not select_check then
select_check = select_check_def
end
-- 行尺寸检测设置
line_size_check = true
-- 定义筛选后用于返回后续处理的行表(允许判断的有效行下标)
local dialogues = {} -- 对话行的表(start_line对话行开始下标)
local styles_less = {} -- 样式不存在记录
-- 获取视频信息
video_xres, video_yres, video_ar, video_artype = aegisub.video_size()
if not(video_xres and video_yres) then
line_size_check = false
debug.println('行尺寸检测:检测到未打开视频,此功能已禁用')
else
debug.println('行错误检测:视频分辨率信息 '..video_xres..'x'..video_yres)
end
-- 计数表
cout = {
check_line_total = 0, -- 检测行的总数
dialogue_effect_total = 0, -- 对话行中特效不为空的行
dialogue_actor_total = 0, -- 对话行中说话人不为空的行
dialogue_comment_total = 0, -- 对话行中的注释行总数
check_total = 0, -- 检测的总行数
ignore_total = 0,-- 忽略行总数
err_total = 0, -- 错误行总数
err_size = 0, -- 错误行中的尺寸异常行计数
err_char = 0, -- 错误行中的可疑字符行计数
err_style = 0, -- 错误行中的使用不存在样式的行计数
err_styles_str = '' -- 错误样式的文字信息
}
-- 存储异常样式的表
err_styles = {}
-- 存储异常样式文字版
err_styles_str = ''
-- 对话行行数存储
line_n = 0
debug.println('行错误检测:开始检测行')
-- debug.var_dump(meta)
--debug.var_dump(styles)
-- 编译正则表达式
expr = re.compile([[(\{[\s\S]+?\}){1}]],re.NOSUB)
for i = 1,#subs do
if aegisub.progress.is_cancelled() then
debug.println('\n复查助手:'..'用户取消操作\n\n')
aegisub.cancel()
end
if subs[i].class == 'dialogue' then
aegisub.progress.set((i/#subs)*80 + 10)
line_n = line_n + 1
-- 检测到对话行
line = subs[i]
-- 只判断特效与说话人都未设置且没有被注释的行
if line.comment then
cout.dialogue_comment_total = cout.dialogue_comment_total + 1
end
if line.effect ~= '' then
cout.dialogue_effect_total = cout.dialogue_effect_total + 1
end
if line.actor ~= '' then
cout.dialogue_actor_total = cout.dialogue_actor_total + 1
end
if not line.comment and line.effect == '' and line.actor == '' then
-- 判断该行是否存在ASS标签,存在ASS标签则忽略此行
result = expr:match(line.text)
if not result then
-- 筛选后的行:非注释、不存在ASS标签且特效与说话人为空
-- 插入行解析数据(排除不解析的行)
table.insert(dialogues,{pos = i,start_time = line.start_time,end_time = line.end_time,style = line.style})
--[[
属性:
pos -- 行下标
start_time -- 该行开始时间
end_time -- 该行结束时间
style -- 该行样式
]]
-- 异常标记,检测完成后若有错误则为true
typebool = false
-- 检查是否含有可疑字符(可能导致压制错误)
bool,line,msg = line_check_char(line)
if bool then
if select_check.error_char then
typebool = true
debug.println('乱码字符检测:第'..line_n..'行,'..msg)
end
cout.err_char = cout.err_char + 1
end
style = styles[line.style]
if style then
if line_size_check then
-- 只有对应样式存在且允许执行时执行此函数
bool,line,msg = line_check_width(meta,style,line)
if bool then
if select_check.size then
typebool = true
debug.println('行尺寸检测:第'..line_n..'行,'..msg)
end
cout.err_size = cout.err_size + 1
end
end
else
-- 样式不存在
if select_check.style then
-- 允许检查
if not err_styles[line.style] then
-- 此前没有检测出这个错误样式
typebool = true
-- 添加到检查表
err_styles[line.style] = true
if err_styles_str == '' then
err_styles_str = line.style
else
err_styles_str = err_styles_str..' , '..line.style
end
end
msg = '样式 '..line.style..' 不存在'
debug.println('行样式检测:第'..line_n..'行,'..msg)
end
cout.err_style = cout.err_style + 1
end
if typebool then
-- 将异常行置入新选择表
subs[i] = line
table.insert(new_selected,i)
end
else
cout.ignore_total = cout.ignore_total + 1
end
else
cout.ignore_total = cout.ignore_total + 1
end
end
end
cout.check_line_total = line_n
cout.check_total = #subs
cout.err_total = #new_selected
-- 添加错误样式记录文字版
cout.err_styles_str = err_styles_str
return new_selected,cout
end
-- 标准检测函数
function line_check_default(line)
return false,line,''
end
-- 行尺寸检测 检测行是否超出屏幕显示范围
function line_check_width(meta,style,line)
-- 拷贝当前行到临时变量
temp_line = table.copy(line)
-- 计算整行尺寸
line_math_pos(meta,style,temp_line)
-- 检测到越界时修改为true
fix_type = false
msg = ''
--[[
line.left 行的左边缘X坐标,假设其给定对齐,有效边距并且没有碰撞检测
line.center 行中心X坐标,假设其给定对齐,有效边距并且没有碰撞检测
line.right 行的右边X坐标,假设其给定对齐,有效边距并且没有碰撞检测
line.top 行的顶边Y坐标,假设其给定对齐,有效边距并且没有碰撞检测
line.middle 行垂直中心 Y 坐标,假定其给定对齐,有效边距和无碰撞检测 line.vcenter是此的别名
line.bottom 行的下边Y坐标,假设其给定对齐,有效边距并且没有碰撞检测
meta.playresy and meta.playresx
]]
--debug.var_dump(meta)
--debug.var_dump(temp_line)
if temp_line.left < 0 or temp_line.left > meta.res_x then
fix_type = true
msg = msg..' 左越界'
end
if temp_line.right > meta.res_x then
fix_type = true
msg = msg..' 右越界'
end
if temp_line.top < 0 or temp_line.top > meta.res_y then
fix_type = true
msg = msg..' 上越界'
end
if temp_line.bottom > meta.res_y then
fix_type = true
msg = msg..' 下越界'
end
if fix_type then
return true,line,msg
end
return false,line,''
end
-- 可能会引起压制错误的字符
--[[
㊚
₂
㊤
₃
㊛
㊧
㊥
₄
㊨
㊙
㊦
▦
▧
㎥
▤
▥
⁴
▨
▩
・
♬
☞
◑
₁
◐
☜
▷
◁
♢
♤
♧
♡
▶
◀
㏘
㊚₂㊤₃㊛㊧㊥₄㊨㊙㊦▦▧㎥▤▥⁴▨▩・♬☞◑₁◐☜▷◁♢♤♧♡▶◀㏘
]]
local check_char = [[^\u2E80-\uFE4F]]
-- 检测并标记任何查找到的可能导致压制错误的行
function line_check_char(line)
-- 忽略存在ASS标签的行之后
-- 检查是否存在可能引起压制错误的字符
result = re.match(line.text, "["..check_char.."]+?",re.NOSUB)
if result then
-- 发现了存在可能引起压制错误的行
msg = '检测到可疑字符 '..result[1].str..' 在第 '..result[1].first..'个字符'
-- debug.var_dump(result)
return true,line,msg
end
-- 没有问题
return false,line,''
end
-- 60FPS修复
function fix_60fps(subs)
debug.println('60FPS修复:'..'开始修复')
-- 代码来自 Kiriko 的 60FPS修复
for i = 1, #subs do
if subs[i].class == "dialogue" then
local line=subs[i]
if line.start_time%50 == 0 and line.start_time ~= 0 then
line.start_time=line.start_time+10
end
if line.end_time%50 == 0 then
line.end_time=line.end_time+10
end
subs[i]=line
end
end
debug.println('60FPS修复:'..'修复完成')
end
-- 使用指定样式渲染文本
function text_to_shape(text,style)
if style.class ~= 'style' then return end
text = tostring(text)
FONT_HANDLE = decode.create_font(style.fontname, style.bold, style.italic, style.underline, style.strikeout, style.fontsize)
shape = FONT_HANDLE.text_to_shape(line.text)
return shape
end
-- 样式检测
-- 字幕对象解析,解析并检测样式以及检查是否存在未安装字体(字体检测需要Yutils支持)
-- 返回值 bool-是否异常,styles-样式表,meta-元信息表,null_styles_str-未安装字体列表(文本型)
function subs_check_style(subs)
debug.println('样式检测:收集样式及元信息...')
-- 未安装字体列表(文本型)
null_styles_str = ''
meta,styles = karaskel_collect_head(subs)
aegisub.progress.set(8)
err_num = 0
debug.println('样式检测:脚本分辨率信息 '..meta.res_x..'x'..meta.res_y)
debug.println('样式检测:收集到 '..#styles..' 个样式')
if Yutils then
debug.println('样式检测:开始检测未安装字体')
-- 获取系统字体列表
fonts = Yutils.decode.list_fonts(false)
result_type = false
-- 建立样式的字体表
styles_front = {}
for name,style in pairs(styles) do
if name ~= 'n' then
-- 插入表
styles_front[style.fontname] = {}
styles_front[style.fontname].name = name
end
end
aegisub.progress.set(9)
-- 对字体进行标记
for i = 1,#fonts do
if styles_front[fonts[i].name] then
styles_front[fonts[i].name].check = true
end
end
-- 输出错误信息(如果存在)
for frontname,style_info in pairs(styles_front) do
if not style_info.check then
-- 这个鬼样式的对应字体不存在
debug.println('样式检测:样式 '..style_info.name..' 的 '..frontname..' 字体未安装')
if null_styles_str == '' then
null_styles_str = frontname..'('..style_info.name..')'
else
null_styles_str = null_styles_str..' , '..frontname..'('..style_info.name..')'
end
err_num = err_num + 1
end
end
else
debug.println('样式检测:Yutils载入失败,字体检测无法运行')
end
aegisub.progress.set(10)
debug.println('样式检测:检测完毕')
return result_type,styles,meta,err_num,null_styles_str
end
-- 闪轴与叠轴检测的前置
-- 字幕对象解析,解析并排序,返回排序后的数组(subs_sort_arr)
-- 返回值 subs_sort_arr-排序后的数组,line_start-对话行起始编号
function parse_sort(subs,basic_progress,add_progress)
subs_sort_arr = {}
line_start = 0
-- 编译正则表达式
expr = re.compile([[(\{[\s\S]+?\}){1}]],re.NOSUB)
expr1 = re.compile([[[^\s]{1}]],re.NOSUB)
if not basic_progress then basic_progress = 0 end
if not add_progress then add_progress = 30 end
-- 解析忽略非对话行、空行、注释行、带特效标签的行、特效不为空的行
for i = 1,#subs do
aegisub.progress.set( i/#subs * add_progress + basic_progress)
line = subs[i]
if line.class == 'dialogue' then
if line_start == 0 then line_start = i - 1 end
if line.text ~= '' then
result = expr:match(line.text)
iter = expr1:gfind(line.text)
str, start_idx, end_idx = iter() -- 检测是否为纯空白行
if start_idx and not result and not line.comment and line.effect == '' then
table.insert (subs_sort_arr, {
pos = i ,
line_id = i - line_start,
start_time = line.start_time ,
end_time = line.end_time ,
style = line.style
})
end
end
end
end
-- 排序函数
local function sort_comp(element1, elemnet2)
if element1 == nil then
return false;
end
if elemnet2 == nil then
return true;
end
return element1.start_time < elemnet2.start_time
end
table.sort(subs_sort_arr,sort_comp)
return subs_sort_arr
end
-- 闪轴检测,参数 subs_sort_arr(parse_sort函数返回值),subs(存在时检测并修复闪轴)
-- 返回值 新选择行
function check_interval200(subs_sort_arr,subs)
--[[
{
pos = i ,
start_time = line.start_time ,
end_time = line.end_time ,
style = line.style
}
]]
-- 缓存每个样式的前一行数据
style_chace = {}
-- 选择行
new_selected = {}
for i,tl in ipairs(subs_sort_arr) do
if style_chace[tl.style] then
interva = tl.start_time - style_chace[tl.style].end_time
if interva < 200 and interva > 0 then
-- <200ms判断为闪轴
-- 添加检测到的闪轴到新选择行
table.insert(new_selected,style_chace[tl.style].pos)
if subs then
-- 如果字幕对象存在,就应该整活了
-- 每行起始时间不变,上一行结束时间向后调至紧贴下一行起始时间
pre_line = subs[style_chace[tl.style].pos]
line = subs[tl.pos]
pre_line.end_time = line.start_time
subs[style_chace[tl.style].pos] = pre_line
end
end
end
style_chace[tl.style] = tl
end
return new_selected
end
-- 叠轴、灵异轴检测,参数 subs_sort_arr(parse_sort函数返回值)
-- 返回值 新选择行
function check_overlap(subs_sort_arr,new_selected,basic_progress,add_progress)
-- 无法自动修复,这种怪操作要挨锤的
-- 缓存每个样式的前一行数据
style_chace = {}
-- 选择行
if not new_selected then new_selected = {} end
if not basic_progress then basic_progress = 30 end
if not add_progress then add_progress = 70 end
for i,tl in ipairs(subs_sort_arr) do
aegisub.progress.set( i/#subs_sort_arr * add_progress + basic_progress)
if style_chace[tl.style] then
-- 同一样式 本行的开始时间小于上一行的结束时间 (单人这种轴太怪了,多人同一个样式也挺怪的)
if tl.start_time < style_chace[tl.style].end_time then
debug.println("叠轴检测:".."第"..tl.line_id.."行发现叠轴")
table.insert(new_selected,tl.pos)
end
-- 一行的开始时间大于结束时间的畸形种
if tl.start_time > tl.end_time then
aegisub.debug.out(0, "叠轴检测:".."第"..tl.line_id.."行发现灵异轴")
table.insert(new_selected,tl.pos)
end
end
style_chace[tl.style] = tl
end
return new_selected
end
-- 检测开始函数,正常规范三参数+检测限制参数
function check_start(subs, selected_lines, active_line, select_check)
--复查助手
select_check_def = {
size = true,-- 尺寸异常检测
error_char = true, -- 乱码字符检测
style = true, -- 样式不存在检测
overlap = true -- 叠轴检测
}
if not select_check then
select_check = select_check_def
end
aegisub.progress.task('复 查 助 手')
aegisub.progress.set(0)
--[[
if #subs > 10000 then
debug.println('复查助手:检测到字幕行行数超过一万..')
if not display.confirm('检测到行数超过一万行\n是否继续?\n继续运行,运行时间可能较长',1) then
aegisub.progress.task0('复查助手运行结束')
debug.println('自动复查:选择停止')
aegisub.cancel()
end
debug.println('复查助手:继续运行...')
end
]]
msg = [[小助手提醒您:
1.智能60FPS修复(视频已打开)(自动)
2.识别可能导致压制乱码的字符
3.识别单行字幕过长(视频已打开)
4.识别不存在的样式
5.同样式非注释行重叠
注:文件名也可能导致压制乱码,请自行检查
注:注释、说话人或特效不为空的行将被忽略
确定后开始自动复查!]]
debug.println(msg..'\n')
if not display.confirm(msg,1) then
aegisub.progress.task('复查助手运行结束')
debug.println('复查助手:选择停止')
aegisub.cancel()
end
debug.println('复查助手:检查开始\n')
aegisub.progress.set(1)
-- 智能60FPS修复
aegisub.progress.task('智能60FPS修复')
debug.println('智能60FPS修复...')
-- 判断前10s的帧数(视频需要至少10S长...)
frame = aegisub.frame_from_ms(10000)
if frame and frame > 500 and frame < 700 then
debug.println('智能60FPS修复:'..'判断为60FPS')
-- 这种情况就可以判定为60FPS了
fix_60fps(subs)
else
debug.println('智能60FPS修复:'..'视频不为60FPS或视频未打开,跳过修复')
end
aegisub.progress.set(5)
--debug.println('智能60FPS修复执行完毕...')
debug.println()
-- 样式检测
aegisub.progress.task('样式字体检测...')
style_check,styles,meta,style_check_err_num,style_check_str = subs_check_style(subs)
debug.println()
aegisub.progress.set(10)
-- 行错误检测
aegisub.progress.task('行错误检测')
debug.println('行错误检测...')
new_selected,check_line_cout = subs_check_line(subs,styles,meta,select_check)
--debug.println('行错误检测执行完毕...')
aegisub.progress.set(90)
aegisub.progress.task('叠轴检测')
overlap_line_n = 0
if select_check.overlap then
-- 解析
subs_sort_arr = parse_sort(subs,90,3)
aegisub.progress.set(93)
-- 检测行(更新选择)
chace_ns = #new_selected
new_selected = check_overlap(subs_sort_arr,new_selected,93,7)
-- 叠轴行数
overlap_line_n = #new_selected - chace_ns
end
aegisub.progress.set(100)
debug.println()
aegisub.progress.task('复查助手运行结束')
debug.println('====复查助手·统计====')
if style_check or #new_selected ~= 0 or style_check_err_num ~= 0 then
debug.println('?:这ASS怪怪的')
debug.println('实际检测行:'..check_line_cout.check_line_total-check_line_cout.ignore_total)
if Yutils then
debug.println('字体未安装:'..style_check_err_num)
if style_check_err_num ~= 0 then
debug.println('未安装字体(所属样式):'..style_check_str)
end
else
debug.println('未安装字体检测:警告,未安装Yutils,检测无法运行。')
end
if select_check.overlap then
if overlap_line_n ~= 0 then
debug.println('!!!警告,当前叠轴行数不为0,建议仔细检查!!!')
end
debug.println('叠轴行数:'..overlap_line_n)
end
debug.println('异常对话行总数(不计叠轴):'..check_line_cout.err_total)
if check_line_cout.err_total ~= 0 then
if select_check.size then
debug.println('尺寸过大的行:'..check_line_cout.err_size)
end
if select_check.error_char then
debug.println('存在可疑字符的行:'..check_line_cout.err_char)
end
if select_check.style then
debug.println('使用不存在样式的行:'..check_line_cout.err_style)
if check_line_cout.err_style ~= 0 then
debug.println('不存在的样式:'..cout.err_styles_str)
end
end
end
debug.println('所有检测到的异常行已经标记\n关闭窗口后显示标记结果')
else
debug.println('所有检测执行完毕')
debug.println('总识别行:'..#subs)
debug.println('总检测行:'..check_line_cout.check_line_total-check_line_cout.ignore_total)
if not Yutils then
debug.println('未安装字体检测:警告,未安装Yutils,检测无法运行。')
end
debug.println('特效不为空的行:'..check_line_cout.dialogue_effect_total)
debug.println('忽略检测行总数:'..check_line_cout.ignore_total)
debug.println('说话人不为空的行:'..check_line_cout.dialogue_actor_total)
debug.println('这个ASS看起来没什么不对(')
end
if #new_selected == 0 then
return
else
return new_selected
end
end
-- 菜单的选择启动函数
function macro_main(subs, selected_lines, active_line)
-- 修改全局提示等级
debug.changelevel(3)
-- 默认全都检查
return check_start(subs, selected_lines, active_line)
end
function macro_select_sizeover(subs, selected_lines, active_line)
-- 你这行,太长了吧?
-- 修改全局提示等级
debug.changelevel(4)
select_check = {
size = true,-- 尺寸异常检测
error_char = false, -- 乱码字符检测
style = false, -- 样式不存在检测
overlap = false -- 叠轴检测
}
-- 检查限制
return check_start(subs, selected_lines, active_line, select_check)
end
function macro_select_errchar(subs, selected_lines, active_line)
-- zai?为什么用特殊字符,还是这种特殊字符?
-- 修改全局提示等级
debug.changelevel(4)
select_check = {
size = false,-- 尺寸异常检测
error_char = true, -- 乱码字符检测
style = false, -- 样式不存在检测
overlap = false -- 叠轴检测
}
-- 检查限制
return check_start(subs, selected_lines, active_line, select_check)
end
function macro_select_nullstyle(subs, selected_lines, active_line)
-- 这样式咋空了
-- 修改全局提示等级
debug.changelevel(3)
select_check = {
size = false,-- 尺寸异常检测
error_char = false, -- 乱码字符检测
style = true, -- 样式不存在检测
overlap = false -- 叠轴检测
}
-- 检查限制
return check_start(subs, selected_lines, active_line, select_check)
end
function macro_select_basic(subs, selected_lines, active_line)
-- 最基础的检查
-- 修改全局提示等级
debug.changelevel(3)
select_check = {
size = false,-- 尺寸异常检测
error_char = false, -- 乱码字符检测
style = false, -- 样式不存在检测
overlap = false -- 叠轴检测
}
-- 检查限制
return check_start(subs, selected_lines, active_line, select_check)
end
function macro_interval200(subs, selected_lines, active_line)
-- 检查行间隔是否<200ms
-- 修改全局提示等级
debug.changelevel(4)
-- 解析
subs_sort_arr = parse_sort(subs)
-- 判断行
new_selected = check_interval200(subs_sort_arr)
if #new_selected ~= 0 then
return new_selected
end
display.confirm('未发现间隔小于200ms的行',0)
end
function macro_interval200_fix(subs, selected_lines, active_line)
-- 检查行间隔是否<200ms
-- 修改全局提示等级
debug.changelevel(4)
msg = '是否确认进行修复?'
debug.println(msg..'\n')
if not display.confirm(msg,1) then
aegisub.progress.task('复查助手运行结束')
debug.println('复查助手:选择停止')
aegisub.cancel()
end
-- 解析
subs_sort_arr = parse_sort(subs)
-- 判断行
new_selected = check_interval200(subs_sort_arr,subs)
if #new_selected ~= 0 then
return new_selected
end
display.confirm('未发现间隔小于200ms的行',0)
end
function macro_select_overlap(subs, selected_lines, active_line)
aegisub.progress.task('复 查 助 手')
-- 兄啊,同一个人说话怎么叠一起的?
-- 修改全局提示等级
debug.changelevel(3)
msg = [[小助手提醒您:
1.智能60FPS修复(视频已打开)(自动)
2.识别可能导致压制乱码的字符
3.识别单行字幕过长(视频已打开)
4.识别不存在的样式
5.同样式非注释行重叠
注:文件名也可能导致压制乱码,请自行检查
注:注释、说话人或特效不为空的行将被忽略]]
debug.println(msg..'\n')
aegisub.progress.set(0)
-- 解析
subs_sort_arr = parse_sort(subs)
aegisub.progress.set(30)
-- 检测行
new_selected = check_overlap(subs_sort_arr)
aegisub.progress.set(100)
debug.println()
debug.println()
debug.println('====复查助手·统计====')
if #new_selected ~= 0 then
debug.println('如无意外,此轴可锤')
debug.println('叠轴计数:'..#new_selected)
return new_selected
end
debug.println('看起来没有叠轴的存在呢')
display.confirm('未发现可能存在的叠轴',0)
end
function macro_fix60fps(subs, selected_lines, active_line)
debug.changelevel(4)
fix_60fps(subs)
display.confirm('我跟你说,它 好 了'.."\n"..'*此功能重复使用无影响',0)
end
function macro_about()
-- 修改全局提示等级
debug.changelevel(1)
version_log = [[
更新日志:
1.2.0 Alpha 2019-12-20
·更新了特殊符号检测算法,可以检测常用字符以外的符号。
·检测所有除了中日韩统一表意文字(CJK Unified Ideographs)之外的特殊字符。
]]
msg = '复查小助手 '..script_version.."\n"..
[[
本助手的功能有
1.智能60FPS修复(视频已打开)(自动)
2.识别可能导致压制乱码的字符
3.识别单行字幕过长(视频已打开)
4.识别不存在的样式
5.同样式非注释行重叠以及包含
6.闪轴检测及修复(行间隔<200ms)
注:60FPS修复经过测试多次使用对ASS无负面影响
注:闪轴检测为独立功能,仅在菜单内提供,不自动使用,并且提供自动修复选项。
注:文件名也可能导致压制乱码,请自行检查
注:注释、说话人或特效不为空的行将被忽略
注:本助手的提示等级为level 3 如果不能正常显示信息或者其他异常请检查您的设置
注:本插件所做修改可由AEG的撤销功能撤回
作者:晨轩°(3309003591)
本关于的最后修改时间:2019-12-16 01:39:28
]]
debug.println(msg)
end
-- 注册AEG菜单
aegisub.register_macro(script_name, script_description, macro_main, macro_can_use)
aegisub.register_macro(script_name.."-菜单".."/基本检查", "查查更健康", macro_select_basic, macro_can_use)
aegisub.register_macro(script_name.."-菜单".."/独立检测/选择尺寸过大的行", "太长是不好的", macro_select_sizeover, macro_can_use)
aegisub.register_macro(script_name.."-菜单".."/独立检测/选择含可疑字符行", "可能引起压制错误的行", macro_select_errchar, macro_can_use)
aegisub.register_macro(script_name.."-菜单".."/独立检测/检测不存在的样式", "兄啊,你这有点不对劲啊", macro_select_nullstyle, macro_can_use)
aegisub.register_macro(script_name.."-菜单".."/独立检测/检测叠轴", "兄啊,同一个人说话怎么叠一起的?", macro_select_overlap, macro_can_use)
aegisub.register_macro(script_name.."-菜单".."/检测字幕闪现(行间隔<200ms)", "这ass费眼睛", macro_interval200, macro_can_use)
aegisub.register_macro(script_name.."-菜单".."/修复字幕闪现(行间隔<200ms)", "它不会费眼睛了", macro_interval200_fix, macro_can_use)
aegisub.register_macro(script_name.."-菜单".."/60fps修复", "这个60FPS的视频看起来中暑了,不如我们...", macro_fix60fps, macro_can_use)
aegisub.register_macro(script_name.."-菜单".."/关于", "一些说明", macro_about, macro_can_use)
|
local PANEL = {}
function PANEL:Init()
self.AdvisorIconMat = Material("resource/materials/advisor.png", "smooth")
self.GCAIconMat = Material("resource/materials/gca.png", "smooth")
self.Image = vgui.Create("DImage", self)
self.Image:SetMaterial(self.AdvisorIconMat)
self.Image:SetSize(128, 128)
self.Image:SetMouseInputEnabled(true)
self.Image:SetCursor("hand")
function self.Image:OnMousePressed()
gui.OpenURL(Advisor.RepositoryURL)
end
self.GCAImage = vgui.Create("DImage", self)
self.GCAImage:SetMaterial(self.GCAIconMat)
self.GCAImage:SetSize(128, 128)
self.GCAImage:SetMouseInputEnabled(true)
self.GCAImage:SetCursor("hand")
function self.GCAImage:OnMousePressed()
gui.OpenURL("https://g-ca.fr/")
end
self.CreditBody = vgui.Create("DTextEntry", self)
self.CreditBody:SetEditable(false)
self.CreditBody:SetMultiline(true)
self.CreditBody:SetFont("Advisor:Rubik.Header")
local text =
[[
Advisor
The ultimate open source administration framework.
Created by Erlite @ github.com/Erlite & Erlite#1337
Special Thanks:
- Game Creators Area @ discord.gg/gca
- Enzo @ en-zo.dev
- Brique au bob
- Pilot2
- Yoh Sambre
]]
self.CreditBody:SetTextColor(Color(255, 255, 255))
self.CreditBody:SetText(text)
self.CreditBody:SizeToContents()
self.CreditBody:SetPaintBackground(false)
self.Footer = vgui.Create("Advisor.Footer", self)
self.Footer:Dock(BOTTOM)
end
function PANEL:PerformLayout(w, h)
self.Image:SetPos(32, 32)
self.GCAImage:SetPos(64 + self.Image:GetWide(), 32)
self.CreditBody:SetPos( 32, 48 + self.Image:GetTall())
self.CreditBody:SetSize( w, h )
end
vgui.Register("Advisor.Menu.Credits", PANEL, "Advisor.Panel")
|
//=============================================================================//
// ___ ___ _ _ _ __ _ ___ ___ __ __
// |_ _|| __| / \ | \_/ | / _| / \ | o \ o \\ V /
// | | | _| | o || \_/ | ( |_n| o || / / \ /
// |_| |___||_n_||_| |_| \__/|_n_||_|\\_|\\ |_| 2007
//
//=============================================================================//
include( "menu/oldfonts.lua" )
include( "menu/progressbar.lua" )
include( "menu/logo.lua" )
include( "menu/getmaps.lua" )
include( "menu/maplist_listview.lua" )
include( "menu/maplist_iconview.lua" )
include( "menu/startgame.lua" )
include( "menu/map_options.lua" )
include( "menu/playgame.lua" )
include( "menu/loading.lua" )
include( "menu/extensions/extensions.lua" )
include( "menu/achievements.lua" )
include("debug.lua")
include("errors.lua")
include("selector.lua")
timer.Simple( 0, function()
hook.Run( "GameContentChanged" )
end )
if(file.Exists("sounds/leymenu/gamestartup.mp3", "GAME")) then
timer.Simple(1, function()
surface.PlaySound("leymenu/gamestartup.mp3")
end)
end
|
--<< SERVICES >>
local DataStoreService = game:GetService("DataStoreService")
local RunService = game:GetService("RunService")
--<< CONSTANTS >>
local RETRY_TIME = 0.1
local MAX_RETRIES = 30
--<< UTILITY >>
local Utility = {}
function Utility.Wait(t)
local end_time = os.clock() + t
while os.clock() < t do
RunService.Heartbeat:Wait()
end
return os.clock() - end_time + t
end
function Utility.Ternary(condition, a, b)
if condition then
return a
else
return b
end
end
function Utility.RetryRequest(datastore_request_type, retry_function, returns)
local data, retries, success = nil, 0, false
repeat
retries = retries + 1
while not DataStoreService:GetRequestBudgetForRequestType(datastore_request_type) do
Utility.Wait(RETRY_TIME)
end
success, data = pcall(retry_function)
until success or (retries > MAX_RETRIES)
return Utility.Ternary(returns, Utility.Ternary(success, data, success), success)
end
--<< SAFE >>
Utility.Safe = {}
function Utility.Safe.GetAsync(datastore, save_key)
return Utility.RetryRequest(
Enum.DataStoreRequestType.GetAsync,
function()
return datastore:GetAsync(
save_key
)
end,
true
)
end
function Utility.Safe.GetOrderedAsync(ordered_datastore, page_size)
return Utility.RetryRequest(
Enum.DataStoreRequestType.GetSortedAsync,
function()
return ordered_datastore:GetSortedAsync(
false,
page_size
)
end,
true
)
end
function Utility.Safe.UpdateAsync(datastore, save_key, update_function)
return Utility.RetryRequest(
Enum.DataStoreRequestType.UpdateAsync,
function()
return datastore:UpdateAsync(
save_key,
update_function
)
end,
true
)
end
function Utility.Safe.SetAsync(datastore, save_key, data)
return Utility.RetryRequest(
Enum.DataStoreRequestType.SetIncrementAsync,
function()
datastore:SetAsync(
save_key,
data
)
end,
false
)
end
function Utility.Safe.SetOrderedAsync(ordered_datastore, save_key, data)
return Utility.RetryRequest(
Enum.DataStoreRequestType.SetIncrementSortedAsync,
function()
ordered_datastore:SetAsync(
save_key,
data
)
end,
false
)
end
--<< RETURNEE >>
return Utility
|
local CONF = require "conf"
-- Simple neural network implementation (perceptron)
local Neuron = {}
function Neuron.new(x, y)
local o = {
value = 0;
inputs = {};
dirty = false; -- Means that the value of the neuron has to be recalculated
x = x;
y = y;
}
return o
end
-- Every node has a ID which is used as the key to the neurons array
local NeuralNetwork = {}
local NeuralNetwork_mt = { __index = NeuralNetwork }
function NeuralNetwork.new(num_inputs, num_outputs)
local o = {
neurons = {};
num_inputs = num_inputs;
num_outputs = num_outputs;
next_neuron = num_inputs + num_outputs + 1;
}
-- 1 to num_inputs are input nodes
for i = 1, num_inputs do
o.neurons[i] = Neuron.new(0, (i - 1) * 32)
end
-- num_inputs + 1 to num_inputs + num_outputs are output nodes
for i = 1, num_outputs do
o.neurons[CONF.MAX_NEURONS - i] = Neuron.new(600, (i - 1) * 32)
end
setmetatable(o, NeuralNetwork_mt)
return o
end
function NeuralNetwork:add_connection(from, to, weight, id)
local neurons = self.neurons
if type(from) == "table" then
table.insert(neurons[from.to].inputs, from)
else
table.insert(neurons[to].inputs, {
to = to;
from = from;
weight = weight;
id = id;
})
end
end
function NeuralNetwork:add_neuron()
self.neurons[self.next_neuron] = Neuron.new(math.random(400) + 100, math.random(400) + 50)
self.next_neuron = self.next_neuron + 1
return self.next_neuron - 1
end
function NeuralNetwork:create_neuron(num)
if self.next_neuron < num then
self.next_neuron = num + 1 -- Makes sure the next neuron won't override previous neurons
end
self.neurons[num] = Neuron.new(math.random(400) + 100, math.random(400) + 50)
end
function NeuralNetwork:has_neuron(num)
return self.neurons[num] ~= nil
end
function NeuralNetwork:activate(inputs)
local ns = self.neurons
for i = 1, self.num_inputs do
assert(inputs[i] ~= nil, "INPUT WAS NIL")
self.neurons[i].value = inputs[i]
end
for i, _ in pairs(ns) do
if i > self.num_inputs then
ns[i].dirty = true
end
end
for i, _ in pairs(ns) do
if ns[i].dirty then
self:activate_neuron(i)
end
end
end
function NeuralNetwork:activate_neuron(neuron)
local n = self.neurons[neuron]
if not n.dirty then return end
if #n.inputs > 0 then
local sum = 0
for i = 1, #n.inputs do
local e = n.inputs[i]
if self.neurons[e.from].dirty then
self:activate_neuron(e.from)
end
sum = sum + self.neurons[e.from].value * e.weight
end
n.value = math.sigmoid(sum)
else
n.value = 0
end
n.dirty = false
end
function NeuralNetwork:get_outputs()
local ret = {}
for i = 1, self.num_outputs do
ret[i] = self.neurons[CONF.MAX_NEURONS - i].value
end
return ret
end
return {
NeuralNetwork = NeuralNetwork;
Neuron = Neuron;
}
|
-- === "standard" library ===
local log = hs.logger.new('riptide.zen', 'debug')
-- Check if string contains some other string
-- Usage: "it's all in vain":has("vain") == true
function string:has(pattern)
-- Don't laugh. Loaded lua might not have a toboolean method.
if self:match(pattern) then return true else return false end
end
-- Load an icon from ./icons dir.
function getIcon(name, size)
img = hs.image.imageFromPath('./icons/' .. name .. '.png')
if size == nil then
return img
else
log:d('size')
return img:setSize({h = size, w = size})
end
end
|
package("mini-test")
set_kind("library", {headeronly = true})
set_homepage("https://github.com/wu1274704958/mini-test")
set_description("cpp toolbox libraries.")
set_license("MIT")
set_urls("https://github.com/wu1274704958/mini-test.git")
add_versions("0.21", "21a1d5ca2e15b29a62e0d0337f1da00883084a70")
on_install(function (package)
os.cp("include", package:installdir(""))
end)
on_test(function (package)
end)
|
return {'club','clubachtig','clubarts','clubbelang','clubbestuur','clubblad','clubcard','clubcircuit','clubcultuur','clubdag','clubdas','clubeigenaar','clubembleem','clubfauteuil','clubgebonden','clubgebouw','clubgeest','clubgenoot','clubgenote','clubgeschiedenis','clubgevoel','clubhistorie','clubhit','clubhuis','clubkaart','clubkampioen','clubkas','clubkleur','clubleider','clubleiding','clublid','clublied','clubliefde','clublokaal','clubnaam','clubniveau','clubrecord','clubsandwich','clubscene','clubschaken','clubspeler','clubteam','clubtenue','clubtopscorer','clubtrainer','clubverband','clubvoetbal','clubvoorzitter','clubwedstrijd','clubzetel','cluster','clusterbeleid','clusterbom','clusteren','clustering','clustervorming','clubsjaal','clubvolleybal','clusterbijeenkomst','clusterprijs','clubcompetitie','clubavond','clubkampioenschap','clublogo','clustermunitie','clubcoach','clubkleding','clubman','clubsite','clusterhoofdpijn','clubbijeenkomst','clubfeest','clubhouse','clubjaar','clubleven','clubmanager','clubmatch','clubmiddag','clubmuziek','cluborgaan','clubrit','clubsecretaris','clubsfeer','clubshirt','clubtent','clubtraining','clubtrouw','clubvlag','clusterknooppunt','clustermanager','clubterrein','clubmensen','clubpas','clubshow','clubwerk','clubactie','clubgebeuren','clubkostuum','clusterniveau','clubtitel','clubtrofee','clubwinkel','cluistra','clubachtige','clubblaadje','clubbladen','clubcompetities','clubfauteuils','clubgebouwen','clubgenoten','clubhuizen','clubje','clubjes','clubkampioenschappen','clubkleuren','clubleden','clubs','clubteams','clubtrainers','clubvoorzitters','clubzetels','clusterde','clusterden','clusterfouten','clustergemeenten','clusters','clustert','clusterwapens','clubliederen','clubcards','clubkaarten','clubwedstrijden','clusterbommen','clubsjaals','clubsjaaltje','clusterbijeenkomsten','clubavonden','clubkampioenen','clubrecords','clubspelers','clubcoaches','clustermanagers','clublokalen','clubshows','clubdagen','clubleiders','clubnamen','clubsites','clubritten','clubtrainingen','clubhuisje','clubbelangen','clubmiddagen','clusterbommetjes','clubartsen','clubblaadjes','clubmanagers','clubtenten','clubeigenaars','clubhuisjes','clubgebouwtje','clusterhoofdpijnen','clubverbanden','clusterknooppunten'}
|
local Networking = script:GetCustomProperty("Networking"):WaitForObject()
local API = require(script:GetCustomProperty("GameStateAPI"))
--Projectiles and Dangers
local Fireball = script:GetCustomProperty("Fireball")
local Explosion = script:GetCustomProperty("Explosion")
local Triggers = script:GetCustomProperty("Triggers"):WaitForObject()
local Level1 = script:GetCustomProperty("Level1"):WaitForObject()
local Level2 = script:GetCustomProperty("Level2"):WaitForObject()
local L1R1 = Level1:FindChildByName("R1")
local L1R2 = Level1:FindChildByName("R2")
local L2R1 = Level2:FindChildByName("R1")
local L2R2 = Level2:FindChildByName("R2")
local projectileTable = {}
local currentLevel = 0
local currentPhase = 0
local elapsedTime = 0
local phaseTick = 0
local level1Lanterns = {}
local level2Lanterns = {}
local testPosition = Vector3.New(-23400, 15600, -3350)
local gracePeriod = 0
function PopulateLanterns()
for i = 2, 7 do
level1Lanterns[i] = {}
end
level1Lanterns[2][1] = Vector3.New(-21500, 13750, -3450)
level1Lanterns[2][2] = Vector3.New(-26250, 23450, -1900)
level1Lanterns[2][3] = Vector3.New(-28750, 12550, -1350)
level1Lanterns[4][1] = Vector3.New(-24400, 17500, 2600)
level1Lanterns[6][1] = Vector3.New(-19900, 20200, -1150)
level1Lanterns[7][1] = Vector3.New(-29950, 19050, 1800)
for i = 2, 7 do
level2Lanterns[i] = {}
end
level2Lanterns[2][1] = Vector3.New(-7100, -7050, 850)
level2Lanterns[2][2] = Vector3.New(-13600, -10350, 1200)
level2Lanterns[2][3] = Vector3.New(-8900, -11600, 4150)
level2Lanterns[2][4] = Vector3.New(-11250, -5900, 4500)
level2Lanterns[4][1] = Vector3.New(-12500, -9150, 6750)
level2Lanterns[6][1] = Vector3.New(-8050, -6950, 6950)
end
PopulateLanterns()
-- a. Impelment Fireball
-- b. Implement Spinning Hitbox
-- c. Static Triggers + Client side object display
function ResetLevels()
L1R1:StopRotate()
L1R2:StopRotate()
L2R1:StopRotate()
L2R2:StopRotate()
L1R1.collision = Collision.FORCE_OFF
L1R1.visibility = Visibility.FORCE_OFF
L1R2.collision = Collision.FORCE_OFF
L1R2.visibility = Visibility.FORCE_OFF
L2R1.collision = Collision.FORCE_OFF
L2R1.visibility = Visibility.FORCE_OFF
L2R2.collision = Collision.FORCE_OFF
L2R2.visibility = Visibility.FORCE_OFF
end
function TriggerOverlap(trigger, other)
if gracePeriod > 0 then
return
end
if currentPhase < trigger.serverUserData.phase then
return
end
if Object.IsValid(other) and other:IsA("Player") and not other.isDead then
other:ApplyDamage(Damage.New(50 + currentLevel * 50))
end
end
function KillTrigger(trigger, other)
if gracePeriod > 0 then
return
end
if Object.IsValid(other) and other:IsA("Player") and not other.isDead then
other:ApplyDamage(Damage.New(50 + currentLevel * 50))
end
end
function RegisterTriggers()
for i, folder in ipairs(Triggers:GetChildren()) do
for _, trigger in ipairs(folder:GetChildren()) do
trigger.beginOverlapEvent:Connect(TriggerOverlap)
trigger.serverUserData.phase = i
end
end
for _, trigger in ipairs(Level1:FindDescendantsByType("Trigger")) do
trigger.beginOverlapEvent:Connect(KillTrigger)
end
for _, trigger in ipairs(Level2:FindDescendantsByType("Trigger")) do
trigger.beginOverlapEvent:Connect(KillTrigger)
end
end
RegisterTriggers()
function ImpactEvent(projectile, other, hit)
if hit then
World.SpawnAsset(Explosion, {position = hit:GetImpactPosition()})
end
if Object.IsValid(other) and other:IsA("Player") and not other.isDead then
local damage = Damage.New(50 + currentLevel * 50)
other:ApplyDamage(damage)
end
end
function SpawnFireball(position, radius)
for _, player in ipairs(Game.GetPlayers()) do
if (player:GetWorldPosition() - position).size < radius then
local projectile = Projectile.Spawn(Fireball, position,
Quaternion.New(Rotation.New(position - player:GetWorldPosition(), Vector3.UP)):GetForwardVector())
projectile.speed = 300
projectile.gravityScale = 0
projectile.capsuleRadius = 100
projectile.lifeSpan = 2
projectile.homingTarget = player
projectileTable[projectile] = projectile.impactEvent:Connect(ImpactEvent)
Task.Spawn(function()
projectileTable[projectile]:Disconnect()
projectileTable[projectile] = nil
end, 3.5)
break
end
end
end
ResetLevels()
function UpdateState(level, phase)
if level ~= currentLevel then
Networking:SetCustomProperty("Level", level)
end
gracePeriod = gracePeriod + 1
Task.Spawn(
function()
Task.Wait(3)
gracePeriod = gracePeriod - 1
end
)
currentLevel = level
currentPhase = phase
elapsedTime = 0
phaseTick = 0
if level == 1 then
if phase == 4 then -- 4
L1R1:RotateContinuous(Vector3.New(0, 0, 1))
L1R1.collision = Collision.FORCE_ON
L1R1.visibility = Visibility.INHERIT
elseif phase == 6 then -- 6
L1R2:RotateContinuous(Vector3.New(0, 0, -1))
L1R2.collision = Collision.FORCE_ON
L1R2.visibility = Visibility.INHERIT
end
elseif level == 2 then
if phase == 4 then
L2R1:RotateContinuous(Vector3.New(0, 0, 1))
L2R1.collision = Collision.FORCE_ON
L2R1.visibility = Visibility.INHERIT
elseif phase == 6 then
L2R2:RotateContinuous(Vector3.New(0, 0, -1))
L2R2.collision = Collision.FORCE_ON
L2R2.visibility = Visibility.INHERIT
end
end
Networking:SetCustomProperty("Phase", currentPhase)
if level == 0 then
ResetLevels()
end
end
API.RegisterDangerCallback(UpdateState)
function ProcessTick(level, phase, tick)
if phase > 1 and tick % 10 == 0 then -- DEBUG, change back to 10
for i = 2, phase do
if level == 1 or level == 3 then
for _, position in pairs(level1Lanterns[i]) do
SpawnFireball(position, i < 4 and 5000 or 2500)
end
elseif level == 2 or level == 4 then
for _, position in pairs(level2Lanterns[i]) do
SpawnFireball(position, i < 4 and 3750 or 2500)
end
end
end
end
-- 2, 5 = fireball. Every 10 seconds? Then 5?
-- 3, 5 = More static death triggers.
-- 4, 6 = spinning death triggers
-- 7 = ice traps?
end
function Tick(deltaTime)
if currentLevel == 0 then
return
end
elapsedTime = elapsedTime + deltaTime
if elapsedTime > 1 then
elapsedTime = elapsedTime - 1
phaseTick = phaseTick + 1
ProcessTick(currentLevel, currentPhase, phaseTick)
end
end
|
------------------------------------------------------------------------------
--
-- This file is part of the Corona game engine.
-- For overview and more information on licensing please refer to README.md
-- Home page: https://github.com/coronalabs/corona
-- Contact: support@coronalabs.com
--
------------------------------------------------------------------------------
simulator =
{
device = "winphone-phone",
screenOriginX = 48,
screenOriginY = 144,
screenWidth = 480,
screenHeight = 800,
deviceImage = "HTC-8S.png",
displayManufacturer = "Not Supported Yet", -- Unsupported on WP8, return the stub implementation
displayName = "WindowsPhone",
supportsScreenRotation = true,
hasAccelerometer = true,
windowTitleBarName = "HTC Windows Phone 8S",
defaultFontSize = 25.333,
}
|
-- Lua 5.2 compatibility
local unpack = unpack or table.unpack
local check = {} -- helper functions, defined at the bottom of the file
local Tester = torch.class('torch.Tester')
function Tester:__init()
self.errors = {}
self.tests = {}
self.warnings = {}
self._warningCount = {}
self.disabledTests = {}
self._currentTestName = ''
-- To maintain backwards compatibility (at least for a short while),
-- disable exact dimension checking of tensors when :assertTensorEq is
-- called. Thus {{1}} == {1} when this flag is true.
--
-- Note that other methods that suppose tensor checking (such as
-- :assertGeneralEq) ignore this flag, since previously they didn't
-- exist or support tensor equality checks at all, so there is no
-- old code that uses these functions and relies on the behaviour.
--
-- Note also that if the dimension check fails with this flag is true, then
-- will show a warning.
self._assertTensorEqIgnoresDims = true
end
function Tester:setEarlyAbort(earlyAbort)
self.earlyAbort = earlyAbort
end
function Tester:setRethrowErrors(rethrow)
self.rethrow = rethrow
end
function Tester:setSummaryOnly(summaryOnly)
self.summaryOnly = summaryOnly
end
-- Add a success to the test.
function Tester:_success()
local name = self._currentTestName
self.assertionPass[name] = self.assertionPass[name] + 1
return true
end
function Tester:_addDebugInfo(message)
local ss = debug.traceback('tester', 3) or ''
ss = ss:match('.-\n([^\n]+\n[^\n]+)\n[^\n]+xpcall') or ''
local name = self._currentTestName
return (name ~= '' and name .. '\n' or '') .. message .. '\n' .. ss
end
-- Add a failure to the test.
function Tester:_failure(message)
if self.rethrow then error(message, 2) end
local name = self._currentTestName
self.assertionFail[name] = self.assertionFail[name] + 1
self.errors[#self.errors + 1] = self:_addDebugInfo(message)
return false
end
-- Add a warning to the test
function Tester:_warning(message)
local name = self._currentTestName
self._warningCount[name] = (self._warningCount[name] or 0) + 1
self.warnings[#self.warnings + 1] = self:_addDebugInfo(message)
end
-- Call this during a test run with `condition = true` to log a success, or with
-- `condition = false` to log a failure (using `message`).
function Tester:_assert_sub(condition, message)
if condition then
return self:_success()
else
return self:_failure(message)
end
end
local function getMessage(message, ...)
assert(next{...} == nil, "Unexpected arguments passed to test function")
if message then
assert(type(message) == 'string', 'message parameter must be a string')
if message ~= '' then
return message .. '\n'
end
end
return ''
end
--[[ Historically, some test functions have accepted both a message and a
tolerance, and some just a message (e.g., assertTableEq). Now assertTableEq
accepts both a tolerance and a message, so allow the two arguments to be passed
in either order to maintain backwards compatibility (and more generally,
for convenience). (We still document the ordering as "tolerance, message" for
clarity.) This function also sanitizes them (ensures they are non-nil, etc).
]]
local function getToleranceAndMessage(defaultTolerance, ...)
local args = {...}
local message = nil
local tolerance = nil
for _, a in ipairs(args) do
if type(a) == 'string' then
if message then
error("Unexpected string argument; already have message", a)
end
message = a .. '\n'
elseif type(a) == 'number' then
if tolerance then
error("Unexpected number argument; already have tolerance", a)
end
tolerance = a
assert(tolerance >= 0, "tolerance cannot be negative")
else
error("Unrecognized argument; should be a tolerance or message", a)
end
end
message = message or ''
tolerance = tolerance or defaultTolerance
return tolerance, message
end
function Tester:assert(condition, ...)
local message = getMessage(...)
if type(condition) ~= 'boolean' then
self:_warning(" :assert should only be used for boolean conditions. "
.. "To check for non-nil variables, do this explicitly: "
.. "Tester:assert(var ~= nil).")
end
return self:_assert_sub(condition,
string.format('%sBOOL violation condition=%s',
message, tostring(condition)))
end
function Tester:assertGeneralEq(got, expected, ...)
return self:_eqOrNeq(got, expected, false, ...)
end
function Tester:eq(got, expected, ...)
return self:assertGeneralEq(got, expected, ...)
end
function Tester:assertGeneralNe(got, unexpected, ...)
return self:_eqOrNeq(got, unexpected, true, ...)
end
function Tester:ne(got, unexpected, ...)
return self:assertGeneralNe(got, unexpected, ...)
end
function Tester:_eqOrNeq(got, expected, negate, ...)
local tolerance, message = getToleranceAndMessage(0, ...)
local success, subMessage = check.areEq(got, expected, tolerance, negate)
subMessage = subMessage or ''
return self:_assert_sub(success, message .. subMessage)
end
function Tester:assertlt(a, b, ...)
local message = getMessage(...)
return self:_assert_sub(a < b,
string.format('%sLT failed: %s >= %s',
message, tostring(a), tostring(b)))
end
function Tester:assertgt(a, b, ...)
local message = getMessage(...)
return self:_assert_sub(a > b,
string.format('%sGT failed: %s <= %s',
message, tostring(a), tostring(b)))
end
function Tester:assertle(a, b, ...)
local message = getMessage(...)
return self:_assert_sub(a <= b,
string.format('%sLE failed: %s > %s',
message, tostring(a), tostring(b)))
end
function Tester:assertge(a, b, ...)
local message = getMessage(...)
return self:_assert_sub(a >= b,
string.format('%sGE failed: %s < %s',
message, tostring(a), tostring(b)))
end
function Tester:assertalmosteq(a, b, ...)
local tolerance, message = getToleranceAndMessage(1e-16, ...)
local diff = math.abs(a - b)
return self:_assert_sub(
diff <= tolerance,
string.format(
'%sALMOST_EQ failed: %s ~= %s with tolerance=%s',
message, tostring(a), tostring(b), tostring(tolerance)))
end
function Tester:asserteq(a, b, ...)
local message = getMessage(...)
return self:_assert_sub(a == b,
string.format('%sEQ failed: %s ~= %s',
message, tostring(a), tostring(b)))
end
function Tester:assertne(a, b, ...)
local message = getMessage(...)
if type(a) == type(b) and type(a) == 'table' or type(a) == 'userdata' then
self:_warning(" :assertne should only be used to compare basic lua "
.. "objects (numbers, booleans, etc). Consider using "
.. "either :assertGeneralNe or :assert(a ~= b).")
end
return self:_assert_sub(a ~= b,
string.format('%sNE failed: %s == %s',
message, tostring(a), tostring(b)))
end
function Tester:assertTensorEq(ta, tb, ...)
return self:_assertTensorEqOrNeq(ta, tb, false, ...)
end
function Tester:assertTensorNe(ta, tb, ...)
return self:_assertTensorEqOrNeq(ta, tb, true, ...)
end
function Tester:_assertTensorEqOrNeq(ta, tb, negate, ...)
assert(torch.isTensor(ta), "First argument should be a Tensor")
assert(torch.isTensor(tb), "Second argument should be a Tensor")
local tolerance, message = getToleranceAndMessage(0, ...)
local success, subMessage =
check.areTensorsEq(ta, tb, tolerance, negate,
self._assertTensorEqIgnoresDims)
subMessage = subMessage or ''
if self._assertTensorEqIgnoresDims and (not negate) and success
and not ta:isSameSizeAs(tb) then
self:_warning("Tensors have the same content but different dimensions. "
.. "For backwards compatability, they are considered equal, "
.. "but this may change in the future. Consider using :eq "
.. "to check for equality instead.")
end
return self:_assert_sub(success, message .. subMessage)
end
function Tester:assertTableEq(ta, tb, ...)
return self:_assertTableEqOrNeq(ta, tb, false, ...)
end
function Tester:assertTableNe(ta, tb, ...)
return self:_assertTableEqOrNeq(ta, tb, true, ...)
end
function Tester:_assertTableEqOrNeq(ta, tb, negate, ...)
assert(type(ta) == 'table', "First argument should be a Table")
assert(type(tb) == 'table', "Second argument should be a Table")
return self:_eqOrNeq(ta, tb, negate, ...)
end
function Tester:assertError(f, ...)
return self:assertErrorObj(f, function() return true end, ...)
end
function Tester:assertNoError(f, ...)
local message = getMessage(...)
local status, err = pcall(f)
return self:_assert_sub(status,
string.format('%sERROR violation: err=%s', message,
tostring(err)))
end
function Tester:assertErrorMsg(f, errmsg, ...)
return self:assertErrorObj(f, function(err) return err == errmsg end, ...)
end
function Tester:assertErrorPattern(f, errPattern, ...)
local function errcomp(err)
return string.find(err, errPattern) ~= nil
end
return self:assertErrorObj(f, errcomp, ...)
end
function Tester:assertErrorObj(f, errcomp, ...)
local message = getMessage(...)
local status, err = pcall(f)
return self:_assert_sub((not status) and errcomp(err),
string.format('%sERROR violation: err=%s', message,
tostring(err)))
end
function Tester:add(f, name)
if type(f) == "table" then
assert(name == nil, "Name parameter is forbidden for a table of tests, "
.. "since its use is ambiguous")
if f.__isTestSuite then
f = f.__tests
else
self:_warning("Should use TestSuite rather than plain lua table")
end
for i, v in pairs(f) do
-- We forbid nested tests because the "expected" behaviour when a named
-- test is run in the case that the named test is in fact a table of
-- tests is not supported. Similar issue with _setUp and _tearDown
-- functions inside nested tests.
assert(type(v) ~= 'table', "Nested sets of tests are not supported")
self:add(v, i)
end
return self
end
assert(type(f) == 'function',
"Only tables of functions and functions supported")
if name == '_setUp' then
assert(not self._setUp, "Only one set-up function allowed")
self._setUp = f
elseif name == '_tearDown' then
assert(not self._tearDown, "Only one tear-down function allowed")
self._tearDown = f
else
name = name or 'unknown'
if self.tests[name] ~= nil then
error('Test with name ' .. name .. ' already exists!')
end
self.tests[name] = f
end
return self
end
function Tester:disable(testNames)
if type(testNames) == 'string' then
testNames = {testNames}
end
assert(type(testNames) == 'table', "Expecting name or list for disable")
for _, name in ipairs(testNames) do
assert(self.tests[name], "Unrecognized test '" .. name .. "'")
self.disabledTests[name] = true
end
return self
end
function Tester:run(testNames)
local tests = self:_getTests(testNames)
self.assertionPass = {}
self.assertionFail = {}
self.haveWarning = {}
self.testError = {}
for name in pairs(tests) do
self.assertionPass[name] = 0
self.assertionFail[name] = 0
self.testError[name] = 0
self._warningCount[name] = 0
end
self:_run(tests)
self:_report(tests)
-- Throws an error on test failure/error, so that test script returns
-- with nonzero return value.
for name in pairs(tests) do
assert(self.assertionFail[name] == 0,
'An error was found while running tests!')
assert(self.testError[name] == 0,
'An error was found while running tests!')
end
return 0
end
local function pluralize(num, str)
local stem = num .. ' ' .. str
if num == 1 then
return stem
else
return stem .. 's'
end
end
local NCOLS = 80
local coloured
local enable_colors, c = pcall(require, 'sys.colors')
if arg and enable_colors then -- have we been invoked from the commandline?
coloured = function(str, colour)
return colour .. str .. c.none
end
else
c = {}
coloured = function(str)
return str
end
end
function Tester:_run(tests)
local ntests = 0
for _ in pairs(tests) do
ntests = ntests + 1
end
local ntestsAsString = string.format('%u', ntests)
local cfmt = string.format('%%%uu/%u ', ntestsAsString:len(), ntestsAsString)
local cfmtlen = ntestsAsString:len() * 2 + 2
local function bracket(str)
return '[' .. str .. ']'
end
io.write('Running ' .. pluralize(ntests, 'test') .. '\n')
local i = 1
for name, fn in pairs(tests) do
self._currentTestName = name
-- TODO: compute max length of name and cut it down to size if needed
local strinit = coloured(string.format(cfmt, i), c.cyan)
.. self._currentTestName .. ' '
.. string.rep('.',
NCOLS - 6 - 2 -
cfmtlen - self._currentTestName:len())
.. ' '
io.write(strinit .. bracket(coloured('WAIT', c.cyan)))
io.flush()
local status, message, pass, skip
if self.disabledTests[name] then
skip = true
else
skip = false
if self._setUp then
self._setUp(name)
end
if self.rethrow then
status = true
local nerr = #self.errors
message = fn()
pass = nerr == #self.errors
else
status, message, pass = self:_pcall(fn)
end
if self._tearDown then
self._tearDown(name)
end
end
io.write('\r')
io.write(strinit)
if skip then
io.write(bracket(coloured('SKIP', c.yellow)))
elseif not status then
self.testError[name] = 1
io.write(bracket(coloured('ERROR', c.magenta)))
elseif not pass then
io.write(bracket(coloured('FAIL', c.red)))
else
io.write(bracket(coloured('PASS', c.green)))
if self._warningCount[name] > 0 then
io.write('\n' .. string.rep(' ', NCOLS - 10))
io.write(bracket(coloured('+warning', c.yellow)))
end
end
io.write('\n')
io.flush()
if self.earlyAbort and (i < ntests) and (not status or not pass)
and (not skip) then
io.write('Aborting on first error, not all tests have been executed\n')
break
end
i = i + 1
collectgarbage()
end
end
function Tester:_pcall(f)
local nerr = #self.errors
local stat, result = xpcall(f, debug.traceback)
if not stat then
self.errors[#self.errors + 1] =
self._currentTestName .. '\n Function call failed\n' .. result .. '\n'
end
return stat, result, stat and (nerr == #self.errors)
end
function Tester:_getTests(testNames)
if testNames == nil then
return self.tests
end
if type(testNames) == 'string' then
testNames = {testNames}
end
assert(type(testNames) == 'table',
"Only accept a name or table of test names (or nil for all tests)")
local function getMatchingNames(pattern)
local matchingNames = {}
for name in pairs(self.tests) do
if string.match(name, pattern) then
table.insert(matchingNames, name)
end
end
return matchingNames
end
local tests = {}
for _, pattern in ipairs(testNames) do
local matchingNames = getMatchingNames(pattern)
assert(#matchingNames > 0, "Couldn't find test '" .. pattern .. "'")
for _, name in ipairs(matchingNames) do
tests[name] = self.tests[name]
end
end
return tests
end
function Tester:_report(tests)
local ntests = 0
local nfailures = 0
local nerrors = 0
local nskipped = 0
local nwarnings = 0
self.countasserts = 0
for name in pairs(tests) do
ntests = ntests + 1
self.countasserts = self.countasserts + self.assertionFail[name]
+ self.assertionPass[name]
if self.assertionFail[name] > 0 then
nfailures = nfailures + 1
end
if self.testError[name] > 0 then
nerrors = nerrors + 1
end
if self._warningCount[name] > 0 then
nwarnings = nwarnings + 1
end
if self.disabledTests[name] then
nskipped = nskipped + 1
end
end
if self._warningCount[''] then
nwarnings = nwarnings + self._warningCount['']
end
io.write('Completed ' .. pluralize(self.countasserts, 'assert'))
io.write(' in ' .. pluralize(ntests, 'test') .. ' with ')
io.write(coloured(pluralize(nfailures, 'failure'),
nfailures == 0 and c.green or c.red))
io.write(' and ')
io.write(coloured(pluralize(nerrors, 'error'),
nerrors == 0 and c.green or c.magenta))
if nwarnings > 0 then
io.write(' and ')
io.write(coloured(pluralize(nwarnings, 'warning'), c.yellow))
end
if nskipped > 0 then
io.write(' and ')
io.write(coloured(nskipped .. ' disabled', c.yellow))
end
io.write('\n')
-- Prints off a message separated by -----
local haveSection = false
local function addSection(text)
local function printDashes()
io.write(string.rep('-', NCOLS) .. '\n')
end
if not haveSection then
printDashes()
haveSection = true
end
io.write(text .. '\n')
printDashes()
end
if not self.summaryOnly then
for _, v in ipairs(self.errors) do
addSection(v)
end
for _, v in ipairs(self.warnings) do
addSection(v)
end
end
end
--[[ Tests for tensor equality between two tensors of matching sizes and types.
Tests whether the maximum element-wise difference between `ta` and `tb` is less
than or equal to `tolerance`.
Arguments:
* `ta` (tensor)
* `tb` (tensor)
* `tolerance` (number) maximum elementwise difference between `ta` and `tb`.
* `negate` (boolean) if true, we invert success and failure.
* `storage` (boolean) if true, we print an error message referring to Storages
rather than Tensors.
Returns:
1. success, boolean that indicates success
2. failure_message, string or nil
]]
function check.areSameFormatTensorsEq(ta, tb, tolerance, negate, storage)
local function ensureHasAbs(t)
-- Byte, Char and Short Tensors don't have abs
return t.abs and t or t:double()
end
ta = ensureHasAbs(ta)
tb = ensureHasAbs(tb)
local diff = ta:clone():add(-1, tb):abs()
local err = diff:max()
local success = err <= tolerance
if negate then
success = not success
end
local errMessage
if not success then
local prefix = storage and 'Storage' or 'Tensor'
local violation = negate and 'NE(==)' or 'EQ(==)'
errMessage = string.format('%s%s violation: max diff=%s, tolerance=%s',
prefix,
violation,
tostring(err),
tostring(tolerance))
end
return success, errMessage
end
--[[ Tests for tensor equality.
Tests whether the maximum element-wise difference between `ta` and `tb` is less
than or equal to `tolerance`.
Arguments:
* `ta` (tensor)
* `tb` (tensor)
* `tolerance` (number) maximum elementwise difference between `ta` and `tb`.
* `negate` (boolean) if negate is true, we invert success and failure.
* `ignoreTensorDims` (boolean, default false) if true, then tensors of the same
size but different dimensions can still be considered equal, e.g.,
{{1}} == {1}. For backwards compatibility.
Returns:
1. success, boolean that indicates success
2. failure_message, string or nil
]]
function check.areTensorsEq(ta, tb, tolerance, negate, ignoreTensorDims)
ignoreTensorDims = ignoreTensorDims or false
if not ignoreTensorDims and ta:dim() ~= tb:dim() then
return negate, 'The tensors have different dimensions'
end
if ta:type() ~= tb:type() then
return negate, 'The tensors have different types'
end
-- If we are comparing two empty tensors, return true.
-- This is needed because some functions below cannot be applied to tensors
-- of dimension 0.
if ta:dim() == 0 and tb:dim() == 0 then
return not negate, 'Both tensors are empty'
end
local sameSize
if ignoreTensorDims then
sameSize = ta:nElement() == tb:nElement()
else
sameSize = ta:isSameSizeAs(tb)
end
if not sameSize then
return negate, 'The tensors have different sizes'
end
return check.areSameFormatTensorsEq(ta, tb, tolerance, negate, false)
end
local typesMatching = {
['torch.ByteStorage'] = torch.ByteTensor,
['torch.CharStorage'] = torch.CharTensor,
['torch.ShortStorage'] = torch.ShortTensor,
['torch.IntStorage'] = torch.IntTensor,
['torch.LongStorage'] = torch.LongTensor,
['torch.FloatStorage'] = torch.FloatTensor,
['torch.DoubleStorage'] = torch.DoubleTensor,
}
--[[ Tests for storage equality.
Tests whether the maximum element-wise difference between `sa` and `sb` is less
than or equal to `tolerance`.
Arguments:
* `sa` (storage)
* `sb` (storage)
* `tolerance` (number) maximum elementwise difference between `a` and `b`.
* `negate` (boolean) if negate is true, we invert success and failure.
Returns:
1. success, boolean that indicates success
2. failure_message, string or nil
]]
function check.areStoragesEq(sa, sb, tolerance, negate)
if sa:size() ~= sb:size() then
return negate, 'The storages have different sizes'
end
local typeOfsa = torch.type(sa)
local typeOfsb = torch.type(sb)
if typeOfsa ~= typeOfsb then
return negate, 'The storages have different types'
end
local ta = typesMatching[typeOfsa](sa)
local tb = typesMatching[typeOfsb](sb)
return check.areSameFormatTensorsEq(ta, tb, tolerance, negate, true)
end
--[[ Tests for general (deep) equality.
The types of `got` and `expected` must match.
Tables are compared recursively. Keys and types of the associated values must
match, recursively. Numbers are compared with the given tolerance.
Torch tensors and storages are compared with the given tolerance on their
elementwise difference. Other types are compared for strict equality with the
regular Lua == operator.
Arguments:
* `got`
* `expected`
* `tolerance` (number) maximum elementwise difference between `a` and `b`.
* `negate` (boolean) if negate is true, we invert success and failure.
Returns:
1. success, boolean that indicates success
2. failure_message, string or nil
]]
function check.areEq(got, expected, tolerance, negate)
local errMessage
if type(got) ~= type(expected) then
if not negate then
errMessage = 'EQ failed: values have different types (first: '
.. type(got) .. ', second: ' .. type(expected) .. ')'
end
return negate, errMessage
elseif type(got) == 'number' then
local diff = math.abs(got - expected)
local ok = (diff <= tolerance)
if negate then
ok = not ok
end
if not ok then
if negate then
errMessage = string.format("NE failed: %s == %s",
tostring(got), tostring(expected))
else
errMessage = string.format("EQ failed: %s ~= %s",
tostring(got), tostring(expected))
end
if tolerance > 0 then
errMessage = errMessage .. " with tolerance=" .. tostring(tolerance)
end
end
return ok, errMessage
elseif type(expected) == "table" then
return check.areTablesEq(got, expected, tolerance, negate)
elseif torch.isTensor(got) then
return check.areTensorsEq(got, expected, tolerance, negate)
elseif torch.isStorage(got) then
return check.areStoragesEq(got, expected, tolerance, negate)
else
-- Below: we have the same type which is either userdata or a lua type
-- which is not a number.
local ok = (got == expected)
if negate then
ok = not ok
end
if not ok then
if negate then
errMessage = string.format("NE failed: %s (%s) == %s (%s)",
tostring(got), type(got),
tostring(expected), type(expected))
else
errMessage = string.format("EQ failed: %s (%s) ~= %s (%s)",
tostring(got), type(got),
tostring(expected), type(expected))
end
end
return ok, errMessage
end
end
--[[ Tests for (deep) table equality.
Tables are compared recursively. Keys and types of the associated values must
match, recursively. Numbers are compared with the given tolerance.
Torch tensors and storages are compared with the given tolerance on their
elementwise difference. Other types are compared for strict equality with the
regular Lua == operator.
Arguments:
* `t1` (table)
* `t2` (table)
* `tolerance` (number) maximum elementwise difference between `a` and `b`.
* `negate` (boolean) if negate is true, we invert success and failure.
Returns:
1. success, boolean that indicates success
2. failure_message, string or nil
]]
function check.areTablesEq(t1, t2, tolerance, negate)
-- Implementation detail: Instead of doing a depth-first table comparison
-- check (for example, using recursion), let's do a breadth-first search
-- using a queue. Why? Because if we have two tables that are quite deep
-- (e.g., a gModule from nngraph), then if they are different then it's
-- more useful to the user to show how they differ at as-shallow-a-depth
-- as possible.
local queue = {}
queue._head = 1
queue._tail = 1
function queue.isEmpty()
return queue._tail == queue._head
end
function queue.pop()
queue._head = queue._head + 1
return queue[queue._head - 1]
end
function queue.push(value)
queue[queue._tail] = value
queue._tail = queue._tail + 1
end
queue.push({t1, t2})
while not queue.isEmpty() do
local location
t1, t2, location = unpack(queue.pop())
local function toSublocation(key)
local keyAsString = tostring(key)
return (location and location .. "." .. keyAsString) or keyAsString
end
for key, value1 in pairs(t1) do
local sublocation = toSublocation(key)
if t2[key] == nil then
return negate, string.format(
"Entry %s missing in second table (is %s in first)",
sublocation, tostring(value1))
end
local value2 = t2[key]
if type(value1) == 'table' and type(value2) == 'table' then
queue.push({value1, value2, sublocation})
else
local ok, message = check.areEq(value1, value2, tolerance, false)
if not ok then
message = 'At table location ' .. sublocation .. ': ' .. message
return negate, message
end
end
end
for key, value2 in pairs(t2) do
local sublocation = toSublocation(key)
if t1[key] == nil then
return negate, string.format(
"Entry %s missing in first table (is %s in second)",
sublocation, tostring(value2))
end
end
end
return not negate, 'The tables are equal'
end
|
--
-- methylpy 1.4.3 modulefile
--
-- "URL: https://www.psc.edu/resources/software"
-- "Category: Biological Sciences"
-- "Description: methylpy is an analysis pipeline for DNA methylation data."
-- "Keywords: singularity bioinformatics"
whatis("Name: methylpy")
whatis("Version: 1.4.3")
whatis("Category: Biological Sciences")
whatis("URL: https://www.psc.edu/resources/software")
whatis("Description: methylpy is an analysis pipeline for DNA methylation data.")
help([[
Description
-----------
methylpy, a pyhton-based analysis pipeline for
* (single-cell) (whole-genome) bisulfite sequencing data
* (single-cell) NOMe-seq data
* differential methylation analysis
To load the module type
> module load methylpy/1.4.3
To unload the module type
> module unload methylpy/1.4.3
Documentation
-------------
For help, type
> methylpy --help
Repository
----------
https://github.com/yupenghe/methylpy
Tools included in this module are
* methylpy
]])
local package = "methylpy"
local version = "1.4.3"
local base = pathJoin("/opt/packages",package,version)
prepend_path("PATH", base)
|
Config = {
Navigation = {
Doors = {
Anim = { Dict = "pickup_object", Name = "putdown_low", Flag = 48, Duration = 1200 },
Distances = {
[-1] = 1.5,
[4] = 2.0,
[5] = 2.0,
},
}
},
Values = {
GearShiftDownDelay = 800, -- How long, in milliseconds, the clutch will be forced to 0.0 after clutching down, preventing a double clutch.
},
Repair = {
Energy = 0.05, -- How much energy is required and taken when switching parts or repairing.
EnergyNearLift = 0.01, -- Same as energy, but while near a lift.
SalvageChance = 0.8, -- The chance when, removing a broken part, they obtain its "salvage."
Degradation = 0.1, -- How much random durability can be taken (from 0) from the part being removed.
Engine = { -- Repairing the engine (using a Repair Kit, or other item definition where item.part == "Engine").
ItemDurability = { 0.1, 0.15 }, -- Range of durability taken from the item used to repair.
MaxHealth = 0.8, -- The health to set the engine when not near a lift.
},
CarJack = { -- Repairing tires (using a Car Jack).
ItemDurability = { 0.05, 0.1 }, -- Range of durability taken from the item used to repair.
},
},
Washing = {
ItemDurability = 0.1, -- How much durability to take, scaled with vehicle dirt level.
},
DamageMults = {
Base = 1.5,
CarCollision = 2.0,
WorldCollision = 1.0,
},
Stalling = {
MinDamage = 20.0,
StallTime = { 1000, 3000 },
},
Spinning = {
CutChance = 0.5, -- Chance the engine will cut out while spinning out and stalling.
LowSpeed = 30.0, -- How fast (MPH) the vehicle must be going to stall out in a vehicle collision.
HighSpeed = 70.0, -- How fast (MPH) the vehicle must be going to stall out normally, when spinning out.
DotProduct = 0.5, -- The minimum dot product before stalling, compared with the forward vector and velocity of the vehicle.
},
Locking = {
Delay = 2000,
Anim = {
Flag = 48,
Dict = "anim@mp_player_intmenu@key_fob@",
Name = "fob_click",
Duration = 1000,
},
-- Vehicle classes that cannot be locked.
Blacklist = {
[8] = true, -- Motorcycles
[13] = true, -- Cycles
[14] = true, -- Boats
},
},
Parts = {
{
-- Sends power to wheels and turn car?
Name = "Axle",
DamageMult = 0.5,
Repair = {
Duration = 9000,
Emote = "mechfix2",
Dist = 3.0,
},
Update = function(part, vehicle, health, handling)
handling["fSteeringLock"] = handling["fSteeringLock"] * Lerp(0.7, 1.0, health)
handling["fSuspensionReboundDamp"] = handling["fSuspensionReboundDamp"] * Lerp(0.9, 1.0, health)
handling["fSuspensionCompDamp"] = handling["fSuspensionCompDamp"] * Lerp(0.9, 1.0, health)
handling["fSuspensionForce"] = handling["fSuspensionForce"] * Lerp(0.8, 1.0, health)
handling["fTractionCurveLateral"] = handling["fTractionCurveLateral"] * Lerp(1.0, 2.0, 1.0 - health)
end,
},
{
Name = "Engine",
Bone = "engine",
DamageMult = 0.5,
Repair = {
Duration = 7000,
Emote = "mechfix",
},
Update = function(part, vehicle, health, handling)
local health = (part.health or 1.0) * 1000.0
health = health > 1.0 and health or -4000.0
if not Damage.healths.engine or math.abs(Damage.healths.engine - health) > 1.0 then
Damage.healths.engine = health
Damage:UpdateVehicle()
end
handling["fInitialDriveMaxFlatVel"] = handling["fInitialDriveMaxFlatVel"] * Lerp(0.8, 1.0, health) * (MaxFlatModifier or 1.0)
end,
Parts = {
{
-- Uses coolant to prevent the engine from overheating.
Name = "Radiator",
Offset = vector3(0.0, 0.3, 0.0),
Repair = {
Duration = 7000,
Emote = "mechfix",
},
},
{
-- Runs electrical components.
Name = "Battery",
Offset = vector3(-0.4, 0.0, 0.0),
Repair = {
Duration = 7000,
Emote = "mechfix",
},
},
{
-- Recharges the battery.
Name = "Alternator",
Offset = vector3(-0.4, 0.3, 0.0),
Repair = {
Duration = 7000,
Emote = "mechfix",
},
},
{
Name = "Transmission",
Offset = vector3(0.0, -0.3, 0.0),
Repair = {
Duration = 7000,
Emote = "mechfix",
},
Update = function(part, vehicle, health, handling)
handling["fClutchChangeRateScaleUpShift"] = handling["fClutchChangeRateScaleUpShift"] * Lerp(0.2, 1.0, health)
handling["fClutchChangeRateScaleDownShift"] = handling["fClutchChangeRateScaleDownShift"] * Lerp(0.2, 1.0, health)
end,
},
{
Name = "Fuel Injector",
Offset = vector3(0.4, 0.0, 0.0),
Condition = function(vehicle, parent)
return GetVehicleHandlingFloat(vehicle, "CHandlingData", "fPetrolTankVolume") > 0.01
end,
Repair = {
Duration = 7000,
Emote = "mechfix",
},
Update = function(part, vehicle, health, handling)
handling["fInitialDriveMaxFlatVel"] = handling["fInitialDriveMaxFlatVel"] * Lerp(0.7, 1.0, health)
end,
},
},
},
{
Name = "Fuel Tank",
Bone = "wheel_lr",
Offset = vector3(0.0, 0.0, 0.4),
Condition = function(vehicle, parent)
return GetVehicleHandlingFloat(vehicle, "CHandlingData", "fPetrolTankVolume") > 0.01
end,
Repair = {
Duration = 9000,
Emote = "mechfix3",
},
},
{
Name = "Muffler",
Bone = {
"exhaust_10",
"exhaust_11",
"exhaust_12",
"exhaust_13",
"exhaust_14",
"exhaust_15",
"exhaust_16",
"exhaust_2",
"exhaust_3",
"exhaust_4",
"exhaust_5",
"exhaust_6",
"exhaust_7",
"exhaust_8",
"exhaust_9",
"exhaust",
},
Repair = {
Duration = 9000,
Emote = "mechfix2",
},
},
{
Name = "Tire",
Update = function(part, vehicle, health, handling)
handling["fTractionCurveLateral"] = handling["fTractionCurveLateral"] * Lerp(1.0, 1.15, 1.0 - health) * (TractionCurveModifier or 1.0)
handling["fTractionLossMult"] = handling["fTractionLossMult"] * Lerp(1.0, 1.15, 1.0 - health) * (TractionLossModifier or 1.0)
end,
Bone = {
"wheel_f",
"wheel_lf",
"wheel_lm1",
"wheel_lm2",
"wheel_lm3",
"wheel_lr",
"wheel_r",
"wheel_rf",
"wheel_rm1",
"wheel_rm2",
"wheel_rm3",
"wheel_rr",
},
Parts = {
{
Name = "Brakes",
Offset = vector3(0.0, 0.15, 0.15),
Condition = function(vehicle, parent)
local frontBias = GetVehicleHandlingFloat(vehicle, "CHandlingData", "fBrakeBiasFront")
local isFront = parent and parent.offset and parent.offset.y > 0.0
return (frontBias >= 0.4 and frontBias <= 0.6) or (frontBias > 0.6 and isFront) or (frontBias < 0.4 and not isFront)
end,
Repair = {
Duration = 9000,
Emote = "mechfix2",
},
Update = function(part, vehicle, health, handling)
handling["fBrakeForce"] = handling["fBrakeForce"] * Lerp(0.5, 1.0, health) * (BrakeModifier or 1.0)
end,
},
{
Name = "Shocks",
Offset = vector3(-0.2, 0.0, 0.0),
Repair = {
Duration = 9000,
Emote = "mechfix2",
},
Update = function(part, vehicle, health, handling)
handling["fSuspensionReboundDamp"] = handling["fSuspensionReboundDamp"] * Lerp(0.8, 1.0, health)
handling["fSuspensionCompDamp"] = handling["fSuspensionCompDamp"] * Lerp(0.8, 1.0, health)
handling["fSuspensionForce"] = handling["fSuspensionForce"] * Lerp(0.7, 1.0, health)
end,
},
},
Repair = {
Duration = 9000,
Emote = "mechfix2",
},
},
},
Lifts = {
-- Benny's Original Motorworks.
{
Coords = vector3(-223.23358154296875, -1330.025634765625, 30.890380859375),
Radius = 5.0,
},
-- Power Autos.
{
Coords = vector3(-32.56019973754883, -1065.721923828125, 28.3964900970459),
Radius = 5.0,
},
-- Hayes Auto.
{
Coords = vector3(-1417.732421875, -445.36322021484375, 35.90966415405273),
Radius = 3.0,
},
{
Coords = vector3(-1411.4639892578125, -442.3568420410156, 36.01815414428711),
Radius = 3.0,
},
{
Coords = vector3(-1423.6483154296875, -449.8814392089844, 35.79834747314453),
Radius = 3.0,
},
},
Sirens = {
Police = {
[1] = false,
[2] = "VEHICLES_HORNS_SIREN_1",
[3] = "VEHICLES_HORNS_SIREN_2",
[4] = "VEHICLES_HORNS_POLICE_WARNING", -- RESIDENT_VEHICLES_SIREN_PA20A_WAIL
},
Ambulance = {
[1] = false,
[2] = "RESIDENT_VEHICLES_SIREN_WAIL_01",
[3] = "RESIDENT_VEHICLES_SIREN_QUICK_01",
[4] = "VEHICLES_HORNS_AMBULANCE_WARNING",
},
Firetruck = {
[1] = false,
[2] = "RESIDENT_VEHICLES_SIREN_FIRETRUCK_WAIL_01",
[3] = "RESIDENT_VEHICLES_SIREN_FIRETRUCK_QUICK_01",
[4] = "VEHICLES_HORNS_FIRETRUCK_WARNING",
},
Bike = {
[1] = false,
[2] = "RESIDENT_VEHICLES_SIREN_WAIL_03",
[3] = "RESIDENT_VEHICLES_SIREN_QUICK_03",
},
Agency = {
[1] = false,
[2] = "RESIDENT_VEHICLES_SIREN_WAIL_02",
[3] = "RESIDENT_VEHICLES_SIREN_QUICK_02",
},
},
Handling = {
Fields = {
["fMass"] = "float",
["fInitialDragCoeff"] = "float",
["fDownforceModifier"] = "float",
["fPercentSubmerged"] = "float",
["fDriveBiasFront"] = "float",
["nInitialDriveGears"] = "integer",
["fInitialDriveForce"] = "float",
["fDriveInertia"] = "float",
["fClutchChangeRateScaleUpShift"] = "float",
["fClutchChangeRateScaleDownShift"] = "float",
["fInitialDriveMaxFlatVel"] = "float",
["fBrakeForce"] = "float",
["fBrakeBiasFront"] = "float",
["fHandBrakeForce"] = "float",
["fSteeringLock"] = "float",
["fTractionCurveMax"] = "float",
["fTractionCurveMin"] = "float",
["fTractionCurveLateral"] = "float",
["fTractionSpringDeltaMax"] = "float",
["fLowSpeedTractionLossMult"] = "float",
["fCamberStiffnesss"] = "float",
["fTractionBiasFront"] = "float",
["fTractionLossMult"] = "float",
["fSuspensionForce"] = "float",
["fSuspensionCompDamp"] = "float",
["fSuspensionReboundDamp"] = "float",
["fSuspensionUpperLimit"] = "float",
["fSuspensionLowerLimit"] = "float",
["fSuspensionRaise"] = "float",
["fSuspensionBiasFront"] = "float",
["fAntiRollBarForce"] = "float",
["fAntiRollBarBiasFront"] = "float",
["fRollCentreHeightFront"] = "float",
["fRollCentreHeightRear"] = "float",
["fCollisionDamageMult"] = "float",
["fWeaponDamageMult"] = "float",
["fDeformationDamageMult"] = "float",
["fEngineDamageMult"] = "float",
["fPetrolTankVolume"] = "float",
["fOilVolume"] = "float",
["fSeatOffsetDistX"] = "float",
["fSeatOffsetDistY"] = "float",
["fSeatOffsetDistZ"] = "float",
["nMonetaryValue"] = "integer",
},
Types = {
["float"] = {
getter = GetVehicleHandlingFloat,
setter = function(vehicle, _type, fieldName, value)
local value = tonumber(value)
if value == nil then error("value not number") end
SetVehicleHandlingFloat(vehicle, _type, fieldName, value + 0.0)
end,
},
["integer"] = {
getter = GetVehicleHandlingInt,
setter = function(vehicle, _type, fieldName, value)
local value = tonumber(value)
if value == nil then error("value not number") end
SetVehicleHandlingInt(vehicle, _type, fieldName, math.floor(value))
end,
},
},
},
Taxis = {
[`taxi`] = true,
},
}
|
cflags{
'-std=c99', '-Wall', '-Wpedantic',
'-D FT2_BUILD_LIBRARY',
'-D FT_CONFIG_OPTION_SYSTEM_ZLIB',
'-D HAVE_FCNTL_H',
'-D HAVE_UNISTD_H',
'-I $srcdir/builds/unix',
'-I $srcdir/include/freetype/config',
'-I $srcdir/include',
'-isystem $builddir/pkg/zlib/include',
}
pkg.hdrs = copy('$outdir/include', '$srcdir/include', paths[[
ft2build.h
freetype/(
freetype.h
ftadvanc.h
ftbdf.h
ftbitmap.h
ftcache.h
ftcolor.h
fterrdef.h
fterrors.h
ftfntfmt.h
ftglyph.h
ftimage.h
ftmm.h
ftmodapi.h
ftmoderr.h
ftoutln.h
ftparams.h
ftsizes.h
ftsnames.h
ftstroke.h
ftsynth.h
ftsystem.h
fttrigon.h
fttypes.h
t1tables.h
ttnameid.h
tttables.h
tttags.h
config/(
ftconfig.h
ftheader.h
ftoption.h
ftstdlib.h
integer-types.h
mac-support.h
public-macros.h
)
)
]])
cc('src/gzip/ftgzip.c', {'pkg/zlib/headers'})
lib('libfreetype.a', [[
builds/unix/ftsystem.c
src/(
base/(
ftdebug.c ftinit.c ftbase.c
ftbbox.c ftbdf.c ftbitmap.c ftcid.c ftfstype.c ftgasp.c
ftglyph.c ftgxval.c ftmm.c ftotval.c ftpatent.c ftpfr.c
ftstroke.c ftsynth.c fttype1.c ftwinfnt.c
)
truetype/truetype.c
type1/type1.c
cff/cff.c
cid/type1cid.c
pfr/pfr.c
type42/type42.c
winfonts/winfnt.c
pcf/pcf.c
bdf/bdf.c
sfnt/sfnt.c
autofit/autofit.c
pshinter/pshinter.c
raster/raster.c
smooth/smooth.c
cache/ftcache.c
gzip/ftgzip.c.o
lzw/ftlzw.c
bzip2/ftbzip2.c
psaux/psaux.c
psnames/psnames.c
)
$builddir/pkg/zlib/libz.a
]])
fetch 'git'
|
local ffi = require'ffi'
local usb = require'ljusb'
local sched = require'lumen.sched'
local printf = function(...) io.write(string.format(...)) io.flush() end
local dev = usb:libusb_open_device_with_vid_pid(0x6444, 0x0001)
assert(dev ~= nil, "unable to open device")
--data transfer direction: device to host, class request, recipient: other
local main = function()
local v = usb.libusb_get_version()
printf("libusb v%i.%i.%i.%i\n", v.major, v.minor, v.micro, v.nano)
local bmRequestType_d2h = (0x80 + 0x20 + 0x03)
local trf = usb.Transfer()
local trf_waitd = {trf:event_any()}
trf:control_setup(
bmRequestType_d2h, 0, 0, 0, 2
):submit(dev)
printf("transfer submitted: %s\n", trf)
usb:start_event_handler():set_as_attached()
sched.wait(trf_waitd)
printf("setting count: %i\n", tonumber(ffi.cast('uint16_t *', trf.buffer + 8)[0]))
end
sched.run(main)
sched.loop()
--usb:libusb_exit()
|
local DebugStats = {}
local Camera = require("src.Camera")
local Map = require("src.Map")
-----------------------------------------------------------
local displayGroup = display.newGroup();
local prevTime = 0
local dbTog = 0
local dCount = 1
local memory = "0"
local mod
local rectCount
local debugX
local debugY
local debugLocX
local debugLocY
local debugVelX
local debugVelY
local debugAccX
local debugAccY
local debugMemory
local debugFPS
local frameRate
local frameArray = {}
local avgFrame = 1
local lowFrame = 100
DebugStats.debug = function(fps)
if not fps then
fps = display.fps
end
if dbTog == 0 then
mod = display.fps / fps
local size = 14
local boxHeight = 20
local boxWidth = 180
if display.viewableContentHeight > 512 then
size = 18
boxHeight = 30
boxWidth = 220
end
if display.viewableContentHeight > 1024 then
size = 36
boxHeight = 50
boxWidth = 360
end
rectCount = native.newTextBox( 0, display.contentHeight * .05, boxWidth, boxHeight );
rectCount.font = native.newFont( "Helvetica", size );
rectCount:setTextColor( 1, 1, 1);
rectCount.alpha = 1.0;
rectCount.hasBackground = false;
rectCount.text = 'null';
debugX = native.newTextBox( 0, rectCount.y + rectCount.height, boxWidth, boxHeight );
debugX.font = native.newFont( "Helvetica", size );
debugX:setTextColor( 1, 1, 1);
debugX.alpha = 1.0;
debugX.hasBackground = false;
debugX.text = 'null';
debugY = native.newTextBox( 0, debugX.y + debugX.height, boxWidth, boxHeight );
debugY.font = native.newFont( "Helvetica", size );
debugY:setTextColor( 1, 1, 1);
debugY.alpha = 1.0;
debugY.hasBackground = false;
debugY.text = 'null';
debugLocX = native.newTextBox( 0, debugY.y + debugY.height, boxWidth, boxHeight );
debugLocX.font = native.newFont( "Helvetica", size );
debugLocX:setTextColor( 1, 1, 1);
debugLocX.alpha = 1.0;
debugLocX.hasBackground = false;
debugLocX.text = 'null';
debugLocY = native.newTextBox( 0, debugLocX.y + debugLocX.height, boxWidth, boxHeight );
debugLocY.font = native.newFont( "Helvetica", size );
debugLocY:setTextColor( 1, 1, 1);
debugLocY.alpha = 1.0;
debugLocY.hasBackground = false;
debugLocY.text = 'null';
debugMemory = native.newTextBox( 0, debugLocY.y + debugLocY.height, boxWidth, boxHeight );
debugMemory.font = native.newFont( "Helvetica", size );
debugMemory:setTextColor( 1, 1, 1);
debugMemory.alpha = 1.0;
debugMemory.hasBackground = false;
debugMemory.text = 'null';
debugFPS = native.newTextBox( 0, debugMemory.y + debugMemory.height, boxWidth, boxHeight );
debugFPS.font = native.newFont( "Helvetica", size );
debugFPS:setTextColor( 1, 1, 1);
debugFPS.alpha = 1.0;
debugFPS.hasBackground = false;
debugFPS.text = 'null';
displayGroup:insert(rectCount);
displayGroup:insert(debugX);
displayGroup:insert(debugY);
displayGroup:insert(debugLocX);
displayGroup:insert(debugLocY);
displayGroup:insert(debugMemory);
displayGroup:insert(debugFPS);
displayGroup.anchorX = 0;
displayGroup.anchorY = 0;
displayGroup.x = -math.abs(display.screenOriginX);
displayGroup.y = -math.abs(display.screenOriginY);
displayGroup.anchorChildren = true;
dbTog = 1
end
local layer = Map.refLayer
local sumRects = 0
for i = 1, #Map.map.layers, 1 do
if Map.totalRects[i] then
sumRects = sumRects + Map.totalRects[i]
end
end
if Map.map.orientation == Map.Type.Isometric then
local cameraX = string.format("%g", Camera.McameraX)
local cameraY = string.format("%g", Camera.McameraY)
debugX.text = "cameraX: "..cameraX
debugX:toFront()
debugY.text = "cameraY: "..cameraY
debugY:toFront()
debugLocX.text = "cameraLocX: "..Camera.McameraLocX
debugLocY.text = "cameraLocY: "..Camera.McameraLocY
else
local cameraX = string.format("%g", Camera.McameraX)
local cameraY = string.format("%g", Camera.McameraY)
debugX.text = "cameraX: "..cameraX
debugX:toFront()
debugY.text = "cameraY: "..cameraY
debugY:toFront()
debugLocX.text = "cameraLocX: "..Camera.McameraLocX
debugLocY.text = "cameraLocY: "..Camera.McameraLocY
end
debugLocX:toFront()
debugLocY:toFront()
rectCount.text = "Total Tiles: "..sumRects
rectCount:toFront()
dCount = dCount + 1
if dCount >= 60 / mod then
dCount = 1
memory = string.format("%g", collectgarbage("count") / 1000)
end
debugMemory.text = "Memory: "..memory.." MB"
debugMemory:toFront()
local curTime = system.getTimer()
local dt = curTime - prevTime
prevTime = curTime
local fps = math.floor(1000/dt) * mod
local lowDelay = 20 / mod
if #frameArray < lowDelay then
frameArray[#frameArray + 1] = fps
else
local temp = 0
for i = 1, #frameArray, 1 do
temp = temp + frameArray[i]
end
avgFrame = temp / lowDelay
frameArray = {}
end
debugFPS.text = "FPS: "..fps.." AVG: "..avgFrame
debugFPS:toFront()
end
-----------------------------------------------------------
return DebugStats
|
-- modifiable
--
local options = {
fileformat = "unix", -- line endings are written as a newline character
fileformats = "unix,dos", -- defines the EOL format that will be tried when starting a new buffer
backup = false, -- create a backup file
clipboard = "unnamedplus", -- allow access to the system clipboard
hlsearch = false, -- don't highlight search pattern
incsearch = true, -- while typing show the matching search pattern
ignorecase = true, -- ignore case in search pattern
smartcase = true, -- smart case
mouse = "a", -- enable mouse mode
number = true, -- show line numbers
relativenumber = true, -- make the line numbers relative to the current line
undofile = true, -- save undo history
-- guifont = "JetBrains_Mono:h13:cANSI:qDRAFT", -- font used in graphical neovim
guifont = "JetBrains Mono:h13:1:cANSI", -- font used in graphical neovim
equalalways = true, -- all windows have the same size after splitting
scrolloff = 5, -- always show 5 lines below the cursor
visualbell = off, -- disable visual bell
belloff = all, -- disable the bell for all events
expandtab = true, -- convert tabs into spaces
shiftwidth = 2, -- number of spaces inserted for each indentation
tabstop = 2, -- insert 2 spaces for a tab
updatetime = 300, -- number of milliseconds before the swap file is written to disk
autoindent = true, -- copy indent from the current line when starting a new line
cindent = true, -- amount of indent for a line according to the c indenting rules
inccommand = "split", -- shows partial off-screen results in a preview window
splitbelow = true, -- force all horizontal splits below the current window
splitright = true, -- force all vertical splits right of the current window
}
-- nvim_tree_quit_on_open = 0,
-- nvim_tree_indent_markers = 1,
-- nvim_tree_git_hl = 1,
-- nvim_tree_create_in_closed_folder = 1,
-- nvim_tree_refresh_wait = 600,
for k, v in pairs(options) do
vim.opt[k] = v
end
-- OS specific terminal
if vim.fn.has('win32') then
vim.o.shell="pwsh.exe"
end
|
local Exporter = { }
x2c.Classes.Exporter = Exporter
function Exporter:Init(Config)
self.Config = Config
self.Types = { }
end
function Exporter:Write()
error("Not implemented!")
end
function Exporter:RegisterType(tinfo)
self.Types[#self.Types + 1] = tinfo
end
function Exporter:GetObserver()
local Observer = x2c.Classes.ObserverBroadcast.New()
Observer:Add(self)
return Observer
end
---------------------------------------
function Exporter:InitTypeExporterInfo(data)
error("Not implemented!")
end
function Exporter:InitTypeExporterMemberInfo(data)
error("Not implemented!")
end
---------------------------------------
function Exporter:MakeStructure(data)
error("Not implemented!")
end
function Exporter:MakeAlias(data)
error("Not implemented!")
end
function Exporter:MakeEnum(data)
error("Not implemented!")
end
function Exporter:MakeContainer(data)
error("Not implemented!")
end
---------------------------------------
function x2c.EnableExporter(class)
if class.Enabled then
return true
end
class.Enabled = true
local o = class:GetObserver()
if not o then
error("Failed to create observer for ", class.Name)
end
x2c.observers[#x2c.observers + 1] = o
return true
end
function x2c.RegisterExporter(class, name)
x2c.exporters[name] = class
class.Enabled = false
class.Name = name
local arg = "--enable-" .. name
x2c.ArgumentsTable[arg] = {
Help = "Enable " .. name .. " exporter",
func = function()
x2c.EnableExporter(class)
return 0
end,
}
end
---------------------------------------
require "exporters/cxx-common"
require "exporters/cxxpugi"
|
function main(fichier)
nc.initscr() --on démare ncurses
nc.noecho()
nc.curs_set(0)
local sizeT = {x = 0,y = 0} --on impose des valeurs nulles pour forcer un calcul au début
nc.start_color()
nc.use_default_colors()
local dataFile = getDataFile()
local couleurs,boolPositionOrigine = readDataFile(dataFile)
nc.set_color(1)
nc.init_pair(1,couleurs.texte,couleurs.fond)
nc.init_pair(2,couleurs.fond,couleurs.texte)
local c = "" --le carractère tampon pour l'input de l'utilisateur
local tabFich = convertFichTable(fichier)
if not tabFich then
nc.endwin()
io.stderr:write("Cannot show '"..fichier.."': No such file\n")
return nil
end
local formatTab = {}
local actLine = 1 --la ligne à laquelle on commence à lire
local boolPosition = boolPositionOrigine -- booleen qui sert à savoir si on veut que la position soit affichée en haut à droite de l'écran
while c~=string.byte("q") and c~=string.byte("Q") and c~=nc.KEY_END do
local toogleSavePosBool = false --sert à savoir si on doit afficher une update des paramètres
if sizeChange(sizeT) then
formatTab = formatage(tabFich,sizeT.x)
display(formatTab,sizeT,actLine,boolPosition)
end
c = nc.getch()
if c == nc.KEY_UP and actLine > 1 then --déplacement
actLine = actLine - 1
elseif c == nc.KEY_DOWN then
actLine = actLine + 1
elseif c == nc.KEY_NPAGE then
actLine = actLine + sizeT.y
elseif c == nc.KEY_PPAGE then
actLine = actLine - sizeT.y
elseif c == nc.KEY_LEFT then --couleur
editCouleur(couleurs,false,-1)
elseif c == nc.KEY_RIGHT then
editCouleur(couleurs,false,1)
elseif c == string.byte("n") then
editCouleur(couleurs,true,1)
elseif c == string.byte("b") then
editCouleur(couleurs,true,-1)
elseif c == string.byte("p") then --affichage de la position
boolPosition = not boolPosition
elseif c == string.byte("P") then --on sauvegarde la valeur par défaut de l'affichage de la position
boolPositionOrigine = boolPosition
saveData(dataFile,couleurs,boolPositionOrigine)
toogleSavePosBool = true --on doit afficher que l'on a mis a jour la position par défaut
end
if actLine > #formatTab then --si un resize fait que la position n'est plus bonne à répare le truc, //à changer
actLine = #formatTab
elseif actLine < 1 then
actLine = 1
end
display(formatTab,sizeT,actLine,boolPosition) --on affiche
if toogleSavePosBool then
displayPositionSeting(boolPositionOrigine,sizeT)
end
end
nc.endwin()
saveData(dataFile,couleurs,boolPositionOrigine)
end
function sizeChange(sizeT) --revoie un bouléen informant d'un éventuel changement de l'écrant
local check = {}
check.y,check.x = nc.getmaxyx()
if check.x ~= sizeT.x or check.y ~= sizeT.y then --si il y a changement on met à jour sizeT
sizeT.x = check.x
sizeT.y = check.y
return true
else
return false
end
end
function convertFichTable(fichier) --converti le contenu du fichier dans une table ou chaque ligne correspond à un élément de la table
local tab={}
local f=io.open(fichier,"r")
if not f then return false end --si le fichier n'existe pas on envoie un message disant cela
local num=1
local flag=true
while f and flag do
local lign=f:read()
if lign==nil then
flag=false
else
tab[num]=lign
end
num=num+1
end
if f then f:close() end
return tab
end
function formatage(tabFich,tailleMax) --permet de découper la table du fichier en dans pour que les grosses lignes s'affichent bien
local ret = {}
for i=1,#tabFich do
ret[#ret + 1] = tabFich[i]
while sous_formatage(ret,tailleMax) do end --on découpe la nouvelle ligne au besoin
end
return ret
end
function sous_formatage(formatTab,tailleMax) --découpe au besoin la dernière ligne de formatTab et renvoie true si ça a été fait
if #formatTab[#formatTab] <= tailleMax then
return false
else
pointeur = tailleMax+1
while pointeur > 0 and formatTab[#formatTab]:sub(pointeur,pointeur)~=" " do
pointeur = pointeur - 1
end
if pointeur == 0 then --si il n'y a pas d'endroit où couper la ligne on fait une coupure barbare
pointeur = tailleMax
end
formatTab[#formatTab + 1] = formatTab[#formatTab]:sub(pointeur+1,#formatTab[#formatTab]) -- On met à la ligne suivante ce que la fin de la découpe et on laisse à la ligne une ligne de la bonne taille
formatTab[#formatTab - 1] = formatTab[#formatTab - 1]:sub(1,pointeur) --on pense au -1 car on a agrandit formatTab
return true
end
end
function display(formatTab,sizeT,ligne,boolPosition) --affiche la le texte à partir de la ligne ligne
clean(sizeT)
for y=0,sizeT.y-1 do
if formatTab[ligne+y] then
nc.mvprintw(y,0,formatTab[ligne+y])
end
end
if boolPosition then
local pourcent = (ligne/#formatTab)*100
local mod = 0
if pourcent < 10 then
pourcent = tostring(pourcent):sub(1,1)
mod = 1
elseif pourcent >= 100 then
pourcent = "100"
mod = -1
else
pourcent = tostring(pourcent):sub(1,2)
end
nc.set_color(2)
nc.mvprintw(0,sizeT.x-7+mod," "..pourcent.." % ")
nc.set_color(1)
end
nc.refresh()
end
function displayPositionSeting(boolPositionOrigine,sizeT)
local str
if boolPositionOrigine then
str = "on"
else
str = "off"
end
nc.set_color(2)
nc.mvprintw(sizeT.y-1,2," By default the position indicator will be "..str.." ")
nc.set_color(1)
nc.refresh()
end
function clean(sizeT) --enlève tout ce qui peut nous déranger de l'écrant
for x=0,sizeT.x+5 do
for y=0,sizeT.y+5 do
nc.mvprintw(y,x," ")
end
end
end
function readDataFile(file) --permet de lire les informations sur les couleurs et l'état de l'affichage de la position qui sont stockées dans ~/.ASC/evenmorelua/dataFile
local f = io.open(file,"r")
local pos = false
ret = {}
if f then
ret.fond = tonumber(f:read())
ret.texte = tonumber(f:read())
pos = f:read() == "true" --converti ce que l'on lit en bool
f:close()
else
ret.fond = 0
ret.texte = 15
ret.pos = false
os.execute("mkdir -p ~/.config/ASC/evenmorelua")
end
return ret,pos
end
function editCouleur(couleurs,boolFond,mod) --édite les couleurs et boolFond permet de savoir si on change le fond ou le texte; mod vaut +1 ou -1 en fonctions du changement que l'on veut
if boolFond then
couleurs.fond = math.floor(couleurs.fond + mod)
if couleurs.fond < -1 then
couleurs.fond = 15
end
if couleurs.fond > 15 then
couleurs.fond = -1
end
else
couleurs.texte = math.floor(couleurs.texte + mod)
if couleurs.texte < 0 then
couleurs.texte = 15
end
if couleurs.texte > 15 then
couleurs.texte = 0
end
end
nc.init_pair(1,couleurs.texte,couleurs.fond)
nc.init_pair(2,couleurs.fond,couleurs.texte)
end
function saveData(file,couleurs,boolPosition)
local p = io.open(file,"w")
p:write(tostring(couleurs.fond),"\n",tostring(couleurs.texte),"\n",tostring(boolPosition))
p:close()
end
function getDataFile()
local f=io.popen("echo $HOME","r") --récupération du nom du sossier maison
local home=f:read()
f:close()
return home.."/.config/ASC/evenmorelua/dataFile"
end
function informations()
io.stderr:write("This program is meant to nicely display text on a terminal.\n")
io.stderr:write("Usage : evenmorelua [file]\n")
io.stderr:write("If file is not specified it will try to read from stdin.\n")
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.