content
stringlengths 5
1.05M
|
|---|
return Def.ActorFrame {
Def.Quad{
InitCommand=cmd(halign,0;x,SCREEN_LEFT;y,SCREEN_CENTER_Y-160;zoomto,SCREEN_WIDTH-200,24;diffuse,color("#000000"));
};
Def.Quad{
InitCommand=cmd(halign,0;x,SCREEN_LEFT;y,SCREEN_CENTER_Y-130;zoomto,SCREEN_WIDTH-200,24;diffuse,color("#000000"));
};
Def.Quad{
InitCommand=cmd(halign,0;x,SCREEN_LEFT;y,SCREEN_CENTER_Y-100;zoomto,SCREEN_WIDTH-200,24;diffuse,color("#000000"));
};
Def.Quad{
InitCommand=cmd(halign,0;x,SCREEN_LEFT;y,SCREEN_CENTER_Y-70;zoomto,SCREEN_WIDTH-200,24;diffuse,color("#000000"));
};
Def.Quad{
InitCommand=cmd(halign,0;x,SCREEN_LEFT;y,SCREEN_CENTER_Y-40;zoomto,SCREEN_WIDTH-200,24;diffuse,color("#000000"));
};
Def.Quad{
InitCommand=cmd(halign,0;x,SCREEN_LEFT;y,SCREEN_CENTER_Y-10;zoomto,SCREEN_WIDTH-200,24;diffuse,color("#000000"));
};
Def.Quad{
InitCommand=cmd(halign,0;x,SCREEN_LEFT;y,SCREEN_CENTER_Y+20;zoomto,SCREEN_WIDTH-500,24;diffuse,color("#000000"));
};
LoadActor( "Back" )..{
InitCommand=cmd(Center);
OnCommand=cmd(addx,-SCREEN_WIDTH;sleep,0.5;accelerate,0.5;addx,SCREEN_WIDTH);
OffCommand=cmd(sleep,1;accelerate,0.5;addx,SCREEN_WIDTH);
};
};
|
_ENV=namespace ()
using_namespace "luaClass"
using_namespace "container"
using_namespace "game"
class("AnimateManager"){
CLASS_DEBUG(false);
public{
STATICFUNC.getInstance(function(cls)
if cls.s_instance==nil then
cls.s_instance=cls()
end
return cls.s_instance
end);
}
}
function AnimateManager:AnimateManager()
self.path=Path:getInstance().root.animation
self.skillPath=Path:getInstance().root.skillAnimation
self.skillBuffer={}
end
function AnimateManager:createBattleAnimate(animation)
local animateName=animation.name
self:loadAnimateByFile(self.path..animateName)
local attack=self:createAction(animateName,1,animation.attackEndIndex,animation.attacktime,"attack"):retain()
local defend=self:createAction(animateName,1,animation.defendEndIndex,animation.defendtime,"defend"):retain()
local stand=self:createAction(animateName,1,animation.standEndIndex,animation.standtime,"stand"):retain()
local move=self:createAction(animateName,1,animation.moveEndIndex,animation.movetime,"move"):retain()
local sprite=cc.Sprite:createWithSpriteFrame(cc.SpriteFrameCache:getInstance():getSpriteFrame(
string.format( "%s_%s_%i.png",animateName,"stand",1 )
))
return SpriteAnimate(sprite,attack,defend,stand,move,animation)
end
function AnimateManager:loadAnimateByFile(fileName)
display.loadSpriteFrames(fileName..".plist",fileName..".png")
end
function AnimateManager:createAction(prefix,fromIndex,endIndex,time,modName)
-- body
local t={}
for i=fromIndex,endIndex do
t[#t+1]=
cc.SpriteFrameCache:getInstance():getSpriteFrame(
string.format( "%s_%s_%i.png",prefix,modName,i )
)
end
local timGap=time/(endIndex-fromIndex+1)
local anim=cc.Animation:createWithSpriteFrames(t,timGap)
anim:setRestoreOriginalFrame( true )
local action=cc.Animate:create(anim)
if(modName=="stand")then
return cc.RepeatForever:create(action)
else
return action
end
end
function AnimateManager:getSkillAnimation(animationName)
local res=self.skillBuffer[animationName]
if res then return res end
self:loadAnimateByFile(self.skillPath..animationName)
local animation=ResScriptManager:getInstance().skillAnimationsQuery:get(animationName)
local action=self:createAction(animationName,1,animation.animationEndIndex,animation.time,"skill")
action:retain()
self.skillBuffer[animationName]=action
return action
end
function AnimateManager:clearSkillAnimation()
for _,action in pairs(self.skillBuffer) do
action:release()
end
self.skillBuffer={}
end
|
local map = wincent.vim.map
local imap = function (lhs, rhs, opts)
opts = opts or {}
return map('i', lhs, rhs, opts)
end
return imap
|
return {
base00 = "011627", -- bg
base01 = "0c2132", -- lightbg
base02 = "172c3d", -- selection bg
base03 = "223748", -- comments, line highlighting
base04 = "2c4152", -- dark foreground
base05 = "aeb6c3", -- Default Foreground, Caret, Delimiters, Operators
base06 = "d6deeb", -- Light Foreground (Not often used)
base07 = "feffff", -- Light Background (Not often used)
base08 = "7fdbca", -- Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted
base09 = "f78c6c", -- Integers, Boolean, Constants, XML Attributes, Markup Link Url
base0A = "c792ea", -- Classes, Markup Bold, Search Text Background
base0B = "ecc48d", -- Strings, Inherited Class, Markup Code, Diff Inserted
base0C = "91b9ff", -- Support, Regular Expressions, Escape Characters, Markup Quotes
base0D = "82aaff", -- Functions, Methods, Attribute IDs, Headings
base0E = "c792ea", -- Keywords, Storage, Selector, Markup Italic, Diff Changed
base0F = "d6deeb", -- Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?>
}
|
--[[
Copyright (c) 2016, Steve Freegard <steve.freegard@fsl.com>
Copyright (c) 2016, Vsevolod Stakhov
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.
]]--
-- Check messages for 'bulkiness' using DCC
local N = 'dcc'
local symbol_bulk = "DCC_BULK"
local symbol = "DCC_REJECT"
local opts = rspamd_config:get_all_opt(N)
local lua_util = require "lua_util"
local rspamd_logger = require "rspamd_logger"
local dcc = require("lua_scanners").filter('dcc').dcc
if confighelp then
rspamd_config:add_example(nil, 'dcc',
"Check messages for 'bulkiness' using DCC",
[[
dcc {
socket = "/var/dcc/dccifd"; # Unix socket
servers = "127.0.0.1:10045" # OR TCP upstreams
timeout = 2s; # Timeout to wait for checks
body_max = 999999; # Bulkness threshold for body
fuz1_max = 999999; # Bulkness threshold for fuz1
fuz2_max = 999999; # Bulkness threshold for fuz2
}
]])
return
end
local rule
local function check_dcc (task)
dcc.check(task, task:get_content(), nil, rule)
end
-- Configuration
-- WORKAROUND for deprecated host and port settings
if opts['host'] ~= nil and opts['port'] ~= nil then
opts['servers'] = opts['host'] .. ':' .. opts['port']
rspamd_logger.warnx(rspamd_config, 'Using host and port parameters is deprecated. '..
'Please use servers = "%s:%s"; instead', opts['host'], opts['port'])
end
if opts['host'] ~= nil and not opts['port'] then
opts['socket'] = opts['host']
rspamd_logger.warnx(rspamd_config, 'Using host parameters is deprecated. '..
'Please use socket = "%s"; instead', opts['host'])
end
-- WORKAROUND for deprecated host and port settings
if not opts.symbol_bulk then opts.symbol_bulk = symbol_bulk end
if not opts.symbol then opts.symbol = symbol end
rule = dcc.configure(opts)
if rule then
local id = rspamd_config:register_symbol({
name = 'DCC_CHECK',
callback = check_dcc
})
rspamd_config:register_symbol{
type = 'virtual',
parent = id,
name = opts.symbol
}
rspamd_config:register_symbol{
type = 'virtual',
parent = id,
name = opts.symbol_bulk
}
rspamd_config:register_symbol{
type = 'virtual',
parent = id,
name = 'DCC_FAIL'
}
rspamd_config:set_metric_symbol({
group = N,
score = 1.0,
description = 'Detected as bulk mail by DCC',
one_shot = true,
name = opts.symbol_bulk,
})
rspamd_config:set_metric_symbol({
group = N,
score = 2.0,
description = 'Rejected by DCC',
one_shot = true,
name = opts.symbol,
})
rspamd_config:set_metric_symbol({
group = N,
score = 0.0,
description = 'DCC failure',
one_shot = true,
name = 'DCC_FAIL',
})
else
lua_util.disable_module(N, "config")
rspamd_logger.infox('DCC module not configured');
end
|
-- Copyright (C) by Midoks(midoks@163.com)
-- http://www.graphicsmagick.org/download.html
local time_helper = require "resty.gm.time_helper"
local setmetatable = setmetatable
local _M = { _VERSION = '0.01' }
local mt = { __index = _M }
local debug_sort = 0
function _M.new(self)
local p = setmetatable({
gm_path = 'gm',
gm_cmd = '',
gm_bg_color = 'white',
start_time = time_helper.current_time_millis(),
debug = false
}, mt)
return p
end
function _M.setBin( self, path )
self.gm_path = path
end
--[[
clear cmd value
]]
function _M:clear(self)
self.gm_cmd = ""
end
--[[
format conversion
@param o_img string:original picture
@param n_img string:now pictures
@param q int :quality
]]
function _M.gm_format(self,o_img, n_img, q)
local cmd = ''
if q > 0 then
cmd = "convert -quality " .. q .. " "..o_img.." +profile \"*\" "..n_img
else
cmd = "convert "..o_img.." +profile \"*\" "..n_img
end
self.gm_cmd = cmd
end
--[[
quality
@param o_img :original picture
@param n_img :now pictures
@param quality :quality
]]
function _M.gm_quality(self,o_img, n_img, q)
local cmd = "convert -quality ".. q.. " "..o_img.." +profile \"*\" "..n_img
self.gm_cmd = cmd
end
--[[
thumbnail
@param o_img :original picture
@param n_img :now pictures
@param w :width
@param h :height
@crop_type :
""-> 填充后保证等比缩图 1
_ -> 等比缩图 2
! -> 非等比缩图,按给定的参数缩图(缺点:长宽比会变化) 3
^ -> 裁剪后保证等比缩图 (缺点:裁剪了图片的一部分) 4
> -> 只缩小不放大 5
$ -> 限制宽度,只缩小不放大(比如网页版图片用于手机版时) 6
]]
function _M.gm_thumbnail(self, o_img, n_img, w, h, crop_type, q)
local cmd = ''
if q > 0 then
cmd = 'convert ' .. o_img .. " -quality "..q
else
cmd = 'convert ' .. o_img
end
if (crop_type == '') then
cmd = cmd..' -thumbnail '.. w..'x'..h .. ' -background ' .. self.gm_bg_color .. ' -gravity center -extent ' .. w..'x'..h
elseif (crop_type == '_') then
cmd = cmd..' -thumbnail '.. w..'x'..h
elseif (crop_type == '!') then
cmd = cmd..' -thumbnail "'.. w..'x'..h .. '!" -extent ' .. w..'x'..h
elseif (crop_type == '^') then
cmd = cmd..' -thumbnail "'.. w..'x'..h .. '^" -extent ' .. w..'x'..h
elseif (crop_type == '>' or crop_type == '$') then
cmd = cmd..' -resize "'.. w..'x'..h .. '>"'
else
self:log('crop_type error:'..crop_type)
ngx.exit(404)
end
cmd = cmd .." +profile \"*\" " .. ' '..n_img
self.gm_cmd = cmd
end
--[[
download
@param path : path
@param url : url
]]
function _M.download( self, path, url )
local time_start = time_helper.current_time_millis()
local file, err = io.open(path)
if err then
os.execute('curl -o '..path..' '..url)
else
file:close()
end
if self.debug then
local time_end = time_helper.current_time_millis()
self:log("*----*download consuming:".. (time_end - time_start)*1000 .."ms*----*")
end
end
--[[
debug false or true
@param bool b
ngx.header["gm-debug-s"] = " ---- debug start ---- "
ngx.header["gm-debug-e"] = " ---- debug end ---- "
]]
function _M.D(self, d)
if d then
self.debug = d
self:log("*----*debug start*----*")
end
end
--[[
log
]]
function _M.log(self, msg)
if self.debug then
ngx.header["gm-debug-"..debug_sort] = msg
debug_sort = debug_sort + 1
end
end
function _M.run(self)
local gm_cmd = self.gm_path .. " " .. self.gm_cmd
self:log(gm_cmd)
os.execute(gm_cmd)
self:log("*----*debug end* ----*")
if self.debug then
local time_end = time_helper.current_time_millis()
self:log("*----*time consuming:".. (time_end - self.start_time)*1000 .."ms* ----*")
end
debug_sort = 0
end
function _M.i(self)
local list = {
0x47,0x49,0x46,0x38,0x39,0x61,
0x01,0x00,0x01,0x00,0x80,0xff,
0x00,0xff,0xff,0xff,0x00,0x00,
0x00,0x2c,0x00,0x00,0x00,0x00,
0x01,0x00,0x01,0x00,0x00,0x02,
0x02,0x44,0x01,0x00,0x3b
}
ngx.header.content_type = "image/jpeg"
local s = ""
for i=1,table.getn(list) do
s = s..string.format("%c", list[i])
end
ngx.say(s)
return true
end
-- test
function _M.t( self )
ngx.header.content_type ="text/plain";
ngx.say('t')
end
return _M
|
-- local function data(file, tag, names, stripFunc, postFunc)
local parser = require "otherData.featParser"
local names =
{
"Chronicler",
"Archival Training",
"Archive Tutor",
"Targeted Profiling",
"Observation Party",
"Cinematic Analysis"
}
local m = string.match
local function strip(parser, str)
-- local firstFeat = parser.names[1]
return str
end
local function post(feats, str)
local ex = {}
return ex
end
return parser("chronicler.txt", "Chronicler Class", names, strip)
|
-- router_mgr.lua
local pairs = pairs
local log_err = logger.err
local log_info = logger.info
local mrandom = math.random
local signal_quit = signal.quit
local tinsert = table.insert
local tunpack = table.unpack
local sformat = string.format
local sid2name = service.id2name
local srouter_id = service.router_id
local check_success = utility.check_success
local qhash_code = quanta.hash_code
local timer_mgr = quanta.get("timer_mgr")
local thread_mgr = quanta.get("thread_mgr")
local event_mgr = quanta.get("event_mgr")
local update_mgr = quanta.get("update_mgr")
local config_mgr = quanta.get("config_mgr")
local NetwkTime = enum("NetwkTime")
local RouterMgr = singleton()
local prop = property(RouterMgr)
prop:accessor("master", nil)
prop:accessor("routers", {})
prop:accessor("candidates", {})
prop:accessor("ready_watchers", {})
prop:accessor("close_watchers", {})
function RouterMgr:__init()
self:setup()
end
--初始化
function RouterMgr:setup()
--router配置
self:load_router()
--router接口
self:build_service()
--注册事件
event_mgr:add_listener(self, "rpc_router_update")
event_mgr:add_listener(self, "rpc_service_close")
event_mgr:add_listener(self, "rpc_service_ready")
event_mgr:add_listener(self, "rpc_service_kickout")
--加入更新
update_mgr:attach_frame(self)
--心跳定时器
timer_mgr:loop(NetwkTime.HEARTBEAT_TIME, function()
for _, node in pairs(self.routers) do
node.client:heartbeat()
end
end)
end
--添加router
function RouterMgr:add_router(router_conf, index)
local router_id = srouter_id(router_conf.host_id, index)
if not self.routers[router_id] then
local host = router_conf.host
--端口推导
local port = router_conf.port + (index - 1)
local RpcClient = import("network/rpc_client.lua")
self.routers[router_id] = {
addr = host,
router_id = router_id,
next_connect_time = 0,
client = RpcClient(self, host, port)
}
end
end
--错误处理
function RouterMgr:on_socket_error(client, token, err)
log_err("[RouterMgr][on_socket_error] router lost %s:%s, err=%s", client.ip, client.port, err)
end
--连接成功
function RouterMgr:on_socket_connect(client, res)
log_info("[RouterMgr][on_socket_connect] router %s:%s success!", client.ip, client.port)
--switch master
self:switch_master()
--server register
client:send("rpc_service_register", quanta.id)
end
--切换主router
function RouterMgr:switch_master()
self.candidates = {}
for _, node in pairs(self.routers) do
if node.client:is_alive() then
tinsert(self.candidates, node)
end
end
local node = self:random_router()
if node then
self.master = node
log_info("[RouterMgr][switch_master] switch router addr: %s", node.addr)
end
end
--更新
function RouterMgr:on_frame()
local now_tick = quanta.now
for _, node in pairs(self.routers) do
local client = node.client
if not client:is_alive() then
if now_tick > node.next_connect_time then
node.next_connect_time = now_tick + NetwkTime.RECONNECT_TIME
client:connect()
end
else
if client:check_lost(now_tick) then
log_info("[RouterMgr][on_frame] router lost: %s:%s", client.ip, client.port)
if node == self.master then
self:switch_master()
end
end
end
end
end
--查找指定router
function RouterMgr:get_router(router_id)
return self.routers[router_id]
end
--查找随机router
function RouterMgr:random_router()
local count = #self.candidates
if count > 0 then
return self.candidates[mrandom(count)]
end
end
--查找hash router
function RouterMgr:hash_router(hash_key)
local count = #self.candidates
if count > 0 then
local index = qhash_code(hash_key, count)
return self.candidates[index]
end
end
--通过router发送点对点消息
function RouterMgr:forward_client(router, method, ...)
if router then
return router.client:forward_socket(method, ...)
end
return false, "router not connected"
end
--通过router发送广播,并收集所有的结果
function RouterMgr:collect(service_id, rpc, ...)
local collect_res = {}
local session_id = thread_mgr:build_session_id()
local ok, code, target_cnt = self:forward_client(self.master, "call_broadcast", session_id, service_id, rpc, ...)
if ok and check_success(code) then
while target_cnt > 0 do
target_cnt = target_cnt - 1
local ok_c, code_c, res = thread_mgr:yield(session_id, "collect", NetwkTime.RPC_CALL_TIMEOUT)
if ok_c and check_success(code_c) then
tinsert(collect_res, res)
end
end
end
return ok, code, collect_res
end
--通过router传递广播
function RouterMgr:broadcast(service_id, rpc, ...)
return self:forward_client(self.master, "call_broadcast", 0, service_id, rpc, ...)
end
--发送给指定目标
function RouterMgr:call_target(target, rpc, ...)
if target == quanta.id then
local res = event_mgr:notify_listener(rpc, ...)
return tunpack(res)
end
local session_id = thread_mgr:build_session_id()
return self:forward_client(self:hash_router(target), "call_target", session_id, target, rpc, ...)
end
--发送给指定目标
function RouterMgr:send_target(target, rpc, ...)
if target == quanta.id then
event_mgr:notify_listener(rpc, ...)
return true
end
return self:forward_client(self:hash_router(target), "call_target", 0, target, rpc, ...)
end
--发送给指定目标
function RouterMgr:random_call(target, rpc, ...)
local session_id = thread_mgr:build_session_id()
return self:forward_client(self:random_router(), "call_target", session_id, target, rpc, ...)
end
--发送给指定目标
function RouterMgr:random_send(target, rpc, ...)
return self:forward_client(self:random_router(), "call_target", 0, target, rpc, ...)
end
--指定路由发送给指定目标
function RouterMgr:router_call(router_id, target, rpc, ...)
local session_id = thread_mgr:build_session_id()
return self:forward_client(self:get_router(router_id), "call_target", session_id, target, rpc, ...)
end
--指定路由发送给指定目标
function RouterMgr:router_send(router_id, target, rpc, ...)
return self:forward_client(self:get_router(router_id), "call_target", 0, target, rpc, ...)
end
--发送给指定service的hash
function RouterMgr:call_hash(service_id, hash_key, rpc, ...)
local session_id = thread_mgr:build_session_id()
return self:forward_client(self:hash_router(hash_key), "call_hash", session_id, service_id, hash_key, rpc, ...)
end
--发送给指定service的hash
function RouterMgr:send_hash(service_id, hash_key, rpc, ...)
return self:forward_client(self:hash_router(hash_key), "call_hash", 0, service_id, hash_key, rpc, ...)
end
--发送给指定service的hash
function RouterMgr:random_hash(service_id, hash_key, rpc, ...)
return self:forward_client(self:random_router(hash_key), "call_hash", 0, service_id, hash_key, rpc, ...)
end
--发送给指定service的random
function RouterMgr:call_random(service_id, rpc, ...)
local session_id = thread_mgr:build_session_id()
return self:forward_client(self:hash_router(service_id), "call_random", session_id, service_id, rpc, ...)
end
--发送给指定service的random
function RouterMgr:send_random(service_id, rpc, ...)
return self:forward_client(self:hash_router(service_id), "call_random", 0, service_id, rpc, ...)
end
--发送给指定service的master
function RouterMgr:call_master(service_id, rpc, ...)
local session_id = thread_mgr:build_session_id()
return self:forward_client(self:hash_router(service_id), "call_master", session_id, service_id, rpc, ...)
end
--发送给指定service的master
function RouterMgr:send_master(service_id, rpc, ...)
return self:forward_client(self:hash_router(service_id), "call_master", 0, service_id, rpc, ...)
end
--router加载
function RouterMgr:load_router()
local router_db = config_mgr:init_table("router", "host")
for _, router_conf in router_db:iterator() do
for index = 1, router_conf.count do
self:add_router(router_conf, index)
end
end
end
--生成针对服务的访问接口
function RouterMgr:build_service_method(service, service_id)
local method_list = {
["call_%s_hash"] = function(obj, hash_key, rpc, ...)
return obj:call_hash(service_id, hash_key, rpc, ...)
end,
["send_%s_hash"] = function(obj, hash_key, rpc, ...)
return obj:send_hash(service_id, hash_key, rpc, ...)
end,
["random_%s_hash"] = function(obj, hash_key, rpc, ...)
return obj:random_hash(service_id, hash_key, rpc, ...)
end,
["call_%s_master"] = function(obj, rpc, ...)
return obj:call_master(service_id, rpc, ...)
end,
["send_%s_master"] = function(obj, rpc, ...)
return obj:send_master(service_id, rpc, ...)
end,
["call_%s_random"] = function(obj, rpc, ...)
return obj:call_random(service_id, rpc, ...)
end,
["send_%s_random"] = function(obj, rpc, ...)
return obj:send_random(service_id, rpc, ...)
end,
["call_%s_all"] = function(obj, rpc, ...)
return obj:broadcast(service_id, rpc, ...)
end,
["collect_%s"] = function(obj, rpc, ...)
return obj:collect(service_id, rpc, ...)
end,
}
for fmt_key, handler in pairs(method_list) do
local method = sformat(fmt_key, service)
if not RouterMgr[method] then
RouterMgr[method] = handler
end
end
end
--生成针对服务的访问接口
function RouterMgr:build_service()
local service_db = config_mgr:get_table("service")
for _, service_conf in service_db:iterator() do
local service = service_conf.name
local service_id = service_conf.id
self:build_service_method(service, service_id)
end
end
--监听服务断开
function RouterMgr:watch_service_close(listener, service_name)
if not self.close_watchers[service_name] then
self.close_watchers[service_name] = {}
end
self.close_watchers[service_name][listener] = true
end
--监听服务注册
function RouterMgr:watch_service_ready(listener, service_name)
if not self.ready_watchers[service_name] then
self.ready_watchers[service_name] = {}
end
self.ready_watchers[service_name][listener] = true
end
--业务事件响应
-------------------------------------------------------------------------------
-- 刷新router配置
function RouterMgr:rpc_router_update()
self:load_router()
end
--服务器关闭
function RouterMgr:rpc_service_close(id, router_id)
if self.master and self.master.router_id == router_id then
local server_name = sid2name(id)
local listener_set = self.close_watchers[server_name]
for listener in pairs(listener_set or {}) do
listener:on_service_close(id, server_name)
end
end
end
--服务器注册
function RouterMgr:rpc_service_ready(id, router_id)
if self.master and self.master.router_id == router_id then
local server_name = sid2name(id)
local listener_set = self.ready_watchers[server_name]
for listener in pairs(listener_set or {}) do
listener:on_service_ready(id, server_name, router_id)
end
end
end
--服务被踢下线
function RouterMgr:rpc_service_kickout(router_id, reason)
log_err("[RouterMgr][rpc_service_kickout] reason:%s router_id:%s", reason, router_id)
signal_quit()
end
quanta.router_mgr = RouterMgr()
return RouterMgr
|
object_tangible_furniture_all_frn_all_holocron_dode = object_tangible_furniture_all_shared_frn_all_holocron_dode:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_all_frn_all_holocron_dode, "object/tangible/furniture/all/frn_all_holocron_dode.iff")
|
local function getRenderAdornee(adornee: Instance)
if adornee:IsA("BasePart") then
return adornee :: BasePart
elseif adornee:IsA("Model") then
return adornee :: Model
elseif adornee:IsA("Attachment") then
return adornee :: Attachment
elseif adornee:IsA("Humanoid") then
return adornee.Parent :: Model
elseif adornee:IsA("Accessory") or adornee:IsA("Clothing") then
return adornee:FindFirstChildWhichIsA("BasePart")
elseif adornee:IsA("Tool") then
local handle: BasePart? = adornee:FindFirstChild("Handle")
return if handle and handle:IsA("BasePart") then handle :: BasePart else nil
else
return nil
end
end
return getRenderAdornee
|
local K, C = unpack(select(2, ...))
local Module = K:NewModule("TooltipQuality", "AceHook-3.0")
local GetModule = K:GetModule("Tooltip")
function Module:SetBorderColor(_, tt)
if not tt.GetItem then
return
end
local _, link = tt:GetItem()
if link then
local _, _, quality = GetItemInfo(link)
if quality then
tt:SetBackdropBorderColor(GetItemQualityColor(quality))
end
end
end
function Module:ToggleState()
if C["Tooltip"].ItemQualityBorder then
if not self:IsHooked(GetModule, "SetStyle", "SetBorderColor") then
self:SecureHook(GetModule, "SetStyle", "SetBorderColor")
end
else
self:UnhookAll()
end
end
function Module:OnEnable()
if not C["Tooltip"].ItemQualityBorder then return end
self:ToggleState()
end
|
module("luci.controller.wrtbwmon", package.seeall)
function index()
if not nixio.fs.access("/etc/config/wrtbwmon") then
return
end
entry({"admin", "network", "usage"},
alias("admin", "network", "usage", "details"),
_("Traffic Status"), 60).acl_depends={ "luci-app-wrtbwmon" }
entry({"admin", "network", "usage", "details"},
view("wrtbwmon/details"),
_("Details"), 10)
entry({"admin", "network", "usage", "config"},
view("wrtbwmon/config"),
_("Configuration"), 20)
entry({"admin", "network", "usage", "custom"},
view("wrtbwmon/custom"),
_("User file"), 30)
end
|
---@class LambdaClass
---@overload fun(a: number): LambdaClass
local LambdaClass = {}
setmetatable(LambdaClass, {
---@param a number
__call = function(_, a)
local self = --[[---@type LambdaClass]] {}
---@return number
function self.getNumber()
return a
end
return self
end
})
local missingArg = LambdaClass(<error descr="Missing argument: a: number">)</error>
local wrongArg = LambdaClass(<error descr="Type mismatch. Required: 'number' Found: '\"one\"'">"one"</error>)
local lambdaClass = LambdaClass(1)
---@type number
local aNumber = lambdaClass.getNumber()
---@type string
local aString = <error descr="Type mismatch. Required: 'string' Found: 'number'">lambdaClass.getNumber()</error>
|
registrar = {
ASSET = 0,
DRAWABLE = 0,
ENTITY = 0,
FACTORY = 0,
PHYSICS = 1,
ANIMATION = 1,
INPUT = 1,
SCRIPT = 0,
ASSET = 0,
CAMERA = 1,
MOUSE_MOVE = 0,
UI = 1,
}
selected = false
mouseOver = false
animState = "idle_right"
lastAnimState = "idle_right"
function setup()
health = 100
max_health = 100
print("setup peon", entityId)
--setProgress(entityId, "top", health, max_health)
setTag(entityId, "peon")
attachAnimationSet(entityId, "Assets/orksvhumans/Sprites/peon_animation.json")
loopAnimation(entityId)
end
-- Standard Mouse/Key events
function onMouseMove(x, y, button)
end
function onMouseUp(x, y, button)
if selected and button == MOUSE_BUTTON_RIGHT then
cameraPos = getCameraPosition()
mousePos = Vector2f.new(x, y)
cameraPos:add(mousePos)
setTarget(entityId, cameraPos:getX(), cameraPos:getY(), 32)
setSpeed(entityId, 10)
elseif button == MOUSE_BUTTON_LEFT and not mouseOver then
selected = false
end
end
function onMouseDown(x, y, button)
end
function onKeyDown(keyId, ctrl, shft)
end
function onKeyUp(keyId, ctrl, shft)
end
-- Entity Mouse Events
function onMouseEnterEntity()
mouseOver = true
end
function onMouseExitEntity()
mouseOver = false
end
function onClickEntity(button)
selected = true
end
function onDragEntity(button)
end
-- Collition Callback --
function onCollision(id)
end
function update(delta)
vel = getVelocity(entityId)
x = vel:getX()
y = vel:getY()
speed = getSpeed(entityId)
if speed ~= 0 then
moving = true
change = true
if x > y then
if x > 0 then
animState = "walk_right"
else
direction = "walk_left"
end
else
if y > 0 then
direction = "walk_down"
else
direction = "walk_up"
end
end
else
if animState == "walk_right" then
anim_state = "idle_right"
elseif animState == "walk_left" then
animState = "idle_left"
elseif anmState == "down" then
animState = "idle_down"
elseif animState == "up" then
animState = "idle_up"
end
end
if animState ~= lastAnimState then
setAnimation(entityId, animState)
end
lastAnimState = animState
end
|
local radio = require('radio')
local util = require('radio.core.util')
local class = require('radio.core.class')
local block = require('radio.core.block')
local composite = require('radio.core.composite')
local pipe = require('radio.core.pipe')
describe("composite", function ()
it("connection logic", function ()
local TestSource = block.factory("TestSource")
function TestSource:instantiate()
self:add_type_signature({}, {block.Output("out", radio.types.ComplexFloat32)})
end
local TestBlock = block.factory("TestBlock")
function TestBlock:instantiate()
self:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local TestAddBlock = block.factory("TestAddBlock")
function TestAddBlock:instantiate()
self:add_type_signature({block.Input("in1", radio.types.ComplexFloat32), block.Input("in2", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local TestSplitBlock = block.factory("TestSplitBlock")
function TestSplitBlock:instantiate()
self:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {block.Output("out1", radio.types.Float32), block.Output("out2", radio.types.Float32)})
end
local TestSink = block.factory("TestSink")
function TestSink:instantiate()
self:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {})
end
-- Connect by name
--[[
a c d f
[ 1 ] -> [ 3 ] -> [ 4 ] -> [ 6 ] -> [ 7 ]
^ ^
b | e | g h
[ 2 ] [ 5 ] -> [ 8 ] -> [ 9 ]
--]]
local top = radio.CompositeBlock()
local b1 = TestSource()
local b2 = TestSource()
local b3 = TestAddBlock()
local b4 = TestBlock()
local b5 = TestSource()
local b6 = TestAddBlock()
local b7 = TestSink()
local b8 = TestBlock()
local b9 = TestSink()
top:connect(b1, "out", b3, "in1")
top:connect(b2, "out", b3, "in2")
top:connect(b3, "out", b4, "in")
top:connect(b4, "out", b6, "in1")
top:connect(b5, "out", b6, "in2")
top:connect(b6, "out", b7, "in")
top:connect(b5, "out", b8, "in")
top:connect(b8, "out", b9, "in")
assert.are.same({b3.inputs[1].pipe}, b1.outputs[1].pipes) -- a
assert.are.same({b3.inputs[2].pipe}, b2.outputs[1].pipes) -- b
assert.are.same({b4.inputs[1].pipe}, b3.outputs[1].pipes) -- c
assert.are.same({b6.inputs[1].pipe}, b4.outputs[1].pipes) -- d
assert.are.same({b6.inputs[2].pipe, b8.inputs[1].pipe}, b5.outputs[1].pipes) -- e and g
assert.are.same({b7.inputs[1].pipe}, b6.outputs[1].pipes) -- f
assert.are.same({b9.inputs[1].pipe}, b8.outputs[1].pipes) -- g
-- Linear connections and connect by name
local top = radio.CompositeBlock()
local b1 = TestSource()
local b2 = TestSource()
local b3 = TestAddBlock()
local b4 = TestBlock()
local b5 = TestSource()
local b6 = TestAddBlock()
local b7 = TestSink()
local b8 = TestBlock()
local b9 = TestSink()
top:connect(b3, b4)
top:connect(b6, b7)
top:connect(b5, b8, b9)
top:connect(b1, "out", b3, "in1")
top:connect(b2, "out", b3, "in2")
top:connect(b4, "out", b6, "in1")
top:connect(b5, "out", b6, "in2")
assert.are.same({b3.inputs[1].pipe}, b1.outputs[1].pipes) -- a
assert.are.same({b3.inputs[2].pipe}, b2.outputs[1].pipes) -- b
assert.are.same({b4.inputs[1].pipe}, b3.outputs[1].pipes) -- c
assert.are.same({b6.inputs[1].pipe}, b4.outputs[1].pipes) -- d
assert.are.same({b8.inputs[1].pipe, b6.inputs[2].pipe}, b5.outputs[1].pipes) -- e and g
assert.are.same({b7.inputs[1].pipe}, b6.outputs[1].pipes) -- f
assert.are.same({b9.inputs[1].pipe}, b8.outputs[1].pipes) -- g
-- Check invalid connections
local top = radio.CompositeBlock()
local b1 = TestSource()
local b2 = TestBlock()
local b3 = TestAddBlock()
local b4 = TestSplitBlock()
local b5 = TestSink()
-- Linear connection of 2 output ports to 1 input port
assert.has_error(function () top:connect(b4, b2) end)
-- Linear connection of 1 output port to 2 input ports
assert.has_error(function () top:connect(b2, b3) end)
-- Unknown source pipe
assert.has_error(function () top:connect(b1, "foo", b2, "in") end)
-- Unknown destination pipe
assert.has_error(function () top:connect(b1, "out", b2, "foo") end)
-- Duplicate input connection
top:connect(b1, "out", b2, "in")
assert.has_error(function () top:connect(b1, "out", b2, "in") end)
end)
it("input/output aliasing", function ()
local blk = radio.CompositeBlock()
-- Check aliased pipe properties
blk:add_type_signature({block.Input("in1", radio.types.Float32), block.Input("in2", radio.types.Float32)}, {block.Output("out1", radio.types.Byte), block.Output("out2", radio.types.Bit)})
assert.is.equal(1, #blk.signatures)
assert.is.equal(2, #blk.inputs)
assert.is_true(class.isinstanceof(blk.inputs[1], pipe.AliasedPipeInput))
assert.is_true(class.isinstanceof(blk.inputs[2], pipe.AliasedPipeInput))
assert.is.equal("in1", blk.inputs[1].name)
assert.is.equal("in2", blk.inputs[2].name)
assert.is.equal(2, #blk.outputs)
assert.is_true(class.isinstanceof(blk.outputs[1], pipe.AliasedPipeOutput))
assert.is_true(class.isinstanceof(blk.outputs[2], pipe.AliasedPipeOutput))
assert.is.equal("out1", blk.outputs[1].name)
assert.is.equal("out2", blk.outputs[2].name)
-- Test blocks for composition
local TestBlock1 = block.factory("TestBlock1")
function TestBlock1:instantiate()
self:add_type_signature({block.Input("in", radio.types.Float32)}, {block.Output("out", radio.types.Bit)})
end
local TestBlock2 = block.factory("TestBlock2")
function TestBlock2:instantiate()
self:add_type_signature({block.Input("in", radio.types.Float32)}, {})
end
local TestBlock3 = block.factory("TestBlock3")
function TestBlock3:instantiate()
self:add_type_signature({block.Input("in", radio.types.Float32)}, {block.Output("out", radio.types.Byte)})
end
local b1 = TestBlock1()
local b2 = TestBlock2()
local b3 = TestBlock3()
-- Check valid composite to block aliases
--[[
blk
--------------
in1 -> | --> [b1] --> | -> out1
in2 -> | --> [b2] |
| \-> [b3] --> | -> out2
---------------
--]]
blk:connect(blk, "in1", b1, "in")
blk:connect(blk, "in2", b2, "in")
blk:connect(blk, "in2", b3, "in")
blk:connect(blk, "out1", b1, "out")
blk:connect(blk, "out2", b3, "out")
assert.is.equal(1, #blk.inputs[1].real_inputs)
assert.is.equal(2, #blk.inputs[2].real_inputs)
assert.is.equal(b1.inputs[1], blk.inputs[1].real_inputs[1])
assert.is.equal(b2.inputs[1], blk.inputs[2].real_inputs[1])
assert.is.equal(b3.inputs[1], blk.inputs[2].real_inputs[2])
assert.is.equal(b1.outputs[1], blk.outputs[1].real_output)
assert.is.equal(b3.outputs[1], blk.outputs[2].real_output)
-- Check valid composite to composite aliases
--[[
blk2
---------------------|
in -> | --> in1 [blk] out2 | -> out
| \-> in2 |
---------------------
]]--
local blk2 = radio.CompositeBlock()
blk2:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.Byte)})
blk2:connect(blk2, 'in', blk, 'in1')
blk2:connect(blk2, 'in', blk, 'in2')
blk2:connect(blk2, 'out', blk, 'out2')
assert.is.equal(3, #blk2.inputs[1].real_inputs)
assert.is.equal(b1.inputs[1], blk2.inputs[1].real_inputs[1])
assert.is.equal(b2.inputs[1], blk2.inputs[1].real_inputs[2])
assert.is.equal(b3.inputs[1], blk2.inputs[1].real_inputs[3])
assert.is.equal(b3.outputs[1], blk2.outputs[1].real_output)
-- Check invalid composite to block aliases
local blk = radio.CompositeBlock()
blk:add_type_signature({block.Input("in1", radio.types.ComplexFloat32), block.Input("in2", radio.types.Float32)}, {block.Output("out", radio.types.Byte)})
-- Invalid pipe direction
assert.has_error(function () blk:connect(blk, "out", b1, "in") end)
assert.has_error(function () blk:connect(blk, "in", b3, "out") end)
-- Duplicate output connection
local b4 = TestBlock3()
blk:connect(blk, "out", b3, "out")
assert.has_error(function () blk:connect(blk, "out", b4, "out") end)
assert.has_error(function () blk:connect(b4, "out", blk, "out") end)
end)
it("crawl connections", function ()
--[[
Composite3
Composite1 Composite2
[0] - [ [ [A] - [B] ] - [ [A] - [B] ] - [1]
|
[C]
--]]
local TestBlock = block.factory("TestBlock")
function TestBlock:instantiate()
self:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local c1 = radio.CompositeBlock()
local c1a = TestBlock()
local c1b = TestBlock()
local c1c = TestBlock()
c1:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
c1:connect(c1a, c1b, c1c)
c1:connect(c1, "in", c1a, "in")
c1:connect(c1, "out", c1b, "out")
local c2 = radio.CompositeBlock()
local c2a = TestBlock()
local c2b = TestBlock()
c2:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
c2:connect(c2a, c2b)
c2:connect(c2, "in", c2a, "in")
c2:connect(c2, "out", c2b, "out")
local c3 = radio.CompositeBlock()
c3:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
c3:connect(c1, c2)
c3:connect(c3, "in", c1, "in")
c3:connect(c3, "out", c2, "out")
local top = radio.CompositeBlock()
local b0 = TestBlock()
local b1 = TestBlock()
top:connect(b0, c3, b1)
-- Check top's uncrawled connections
local expected_connections = {
[c1a.inputs[1]] = b0.outputs[1],
[b1.inputs[1]] = c2b.outputs[1]
}
assert.is.equal(2, util.table_length(top._connections))
assert.is.same(expected_connections, top._connections)
-- Check top's crawled connections
local expected_blocks = {
[b0] = true, [c1a] = true, [c1b] = true,
[c1c] = true, [c2a] = true, [c2b] = true,
[b1] = true
}
local expected_connections = {
[c1a.inputs[1]] = b0.outputs[1], [c1b.inputs[1]] = c1a.outputs[1],
[c1c.inputs[1]] = c1b.outputs[1], [c2a.inputs[1]] = c1b.outputs[1],
[c2b.inputs[1]] = c2a.outputs[1], [b1.inputs[1]] = c2b.outputs[1]
}
local blocks, connections = composite._crawl_connections(top._connections)
assert.is.equal(7, util.table_length(blocks))
assert.is.equal(6, util.table_length(connections))
assert.is.same(expected_blocks, blocks)
assert.is.same(expected_connections, connections)
end)
it("build dependency graph", function ()
--[[
-- [1] -- [2] -- [3] -- [4] -- [5] --
| \
-- [6] -- [7] \- [8] -- [9] --
]]--
local TestBlock = block.factory("TestBlock")
function TestBlock:instantiate()
self:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local TestAddBlock = block.factory("TestAddBlock")
function TestAddBlock:instantiate()
self:add_type_signature({block.Input("in1", radio.types.ComplexFloat32), block.Input("in2", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local top = radio.CompositeBlock()
local b1 = TestBlock()
local b2 = TestBlock()
local b3 = TestAddBlock()
local b4 = TestBlock()
local b5 = TestBlock()
local b6 = TestBlock()
local b7 = TestBlock()
local b8 = TestBlock()
local b9 = TestBlock()
top:connect(b1, b2)
top:connect(b6, b7)
top:connect(b2, "out", b3, "in1")
top:connect(b7, "out", b3, "in2")
top:connect(b3, b4, b5)
top:connect(b3, b8, b9)
-- Check dependency graph
local dependency_graph = composite._build_dependency_graph(top._connections)
assert.is.equal(9, util.table_length(dependency_graph))
assert.are.same({b4}, dependency_graph[b5])
assert.are.same({b8}, dependency_graph[b9])
assert.are.same({b3}, dependency_graph[b4])
assert.are.same({b3}, dependency_graph[b8])
assert.is_true(util.array_equals({b7, b2}, dependency_graph[b3]) or util.array_equals({b2, b7}, dependency_graph[b3]))
assert.are.same({b6}, dependency_graph[b7])
assert.are.same({b1}, dependency_graph[b2])
assert.are.same({}, dependency_graph[b1])
assert.are.same({}, dependency_graph[b6])
end)
it("build revese dependency graph", function ()
--[[
-- [1] -- [2] -- [3] -- [4] -- [5] --
| \
-- [6] -- [7] \- [8] -- [9] --
]]--
local TestBlock = block.factory("TestBlock")
function TestBlock:instantiate()
self:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local TestAddBlock = block.factory("TestAddBlock")
function TestAddBlock:instantiate()
self:add_type_signature({block.Input("in1", radio.types.ComplexFloat32), block.Input("in2", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local top = radio.CompositeBlock()
local b1 = TestBlock()
local b2 = TestBlock()
local b3 = TestAddBlock()
local b4 = TestBlock()
local b5 = TestBlock()
local b6 = TestBlock()
local b7 = TestBlock()
local b8 = TestBlock()
local b9 = TestBlock()
top:connect(b1, b2)
top:connect(b6, b7)
top:connect(b2, "out", b3, "in1")
top:connect(b7, "out", b3, "in2")
top:connect(b3, b4, b5)
top:connect(b3, b8, b9)
-- Check dependency graph
local dependency_graph = composite._build_reverse_dependency_graph(top._connections)
assert.is.equal(9, util.table_length(dependency_graph))
assert.are.same({}, dependency_graph[b5])
assert.are.same({}, dependency_graph[b9])
assert.are.same({b5}, dependency_graph[b4])
assert.are.same({b9}, dependency_graph[b8])
assert.is_true(util.array_equals({b4, b8}, dependency_graph[b3]) or util.array_equals({b8, b4}, dependency_graph[b3]))
assert.are.same({b3}, dependency_graph[b7])
assert.are.same({b3}, dependency_graph[b2])
assert.are.same({b2}, dependency_graph[b1])
assert.are.same({b7}, dependency_graph[b6])
end)
it("build skip set", function ()
--[[
-- [1] -- [2] -- [3] -- [4] -- [5] --
| \
-- [6] -- [7] \- [8] -- [9] --
]]--
local TestBlock = block.factory("TestBlock")
function TestBlock:instantiate()
self:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local TestAddBlock = block.factory("TestAddBlock")
function TestAddBlock:instantiate()
self:add_type_signature({block.Input("in1", radio.types.ComplexFloat32), block.Input("in2", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local top = radio.CompositeBlock()
local b1 = TestBlock()
local b2 = TestBlock()
local b3 = TestAddBlock()
local b4 = TestBlock()
local b5 = TestBlock()
local b6 = TestBlock()
local b7 = TestBlock()
local b8 = TestBlock()
local b9 = TestBlock()
top:connect(b1, b2)
top:connect(b6, b7)
top:connect(b2, "out", b3, "in1")
top:connect(b7, "out", b3, "in2")
top:connect(b3, b4, b5)
top:connect(b3, b8, b9)
-- Check dependency graph
local dependency_graph = composite._build_skip_set(top._connections)
assert.is.equal(9, util.table_length(dependency_graph))
assert.are.same({[b2] = true, [b3] = true, [b4] = true, [b5] = true, [b8] = true, [b9] = true}, dependency_graph[b1])
assert.are.same({[b3] = true, [b4] = true, [b5] = true, [b8] = true, [b9] = true}, dependency_graph[b2])
assert.are.same({[b4] = true, [b5] = true, [b8] = true, [b9] = true}, dependency_graph[b3])
assert.are.same({[b5] = true}, dependency_graph[b4])
assert.are.same({}, dependency_graph[b5])
assert.are.same({[b7] = true, [b3] = true, [b4] = true, [b5] = true, [b8] = true, [b9] = true}, dependency_graph[b6])
assert.are.same({[b3] = true, [b4] = true, [b5] = true, [b8] = true, [b9] = true}, dependency_graph[b7])
assert.are.same({[b9] = true}, dependency_graph[b8])
assert.are.same({}, dependency_graph[b9])
end)
it("build evaluation order", function ()
--[[
-- [1] -- [2] -- [3] -- [4] -- [5] --
| \
-- [6] -- [7] \- [8] -- [9] --
]]--
local TestBlock = block.factory("TestBlock")
function TestBlock:instantiate()
self:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local TestAddBlock = block.factory("TestAddBlock")
function TestAddBlock:instantiate()
self:add_type_signature({block.Input("in1", radio.types.ComplexFloat32), block.Input("in2", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local top = radio.CompositeBlock()
local b1 = TestBlock()
local b2 = TestBlock()
local b3 = TestAddBlock()
local b4 = TestBlock()
local b5 = TestBlock()
local b6 = TestBlock()
local b7 = TestBlock()
local b8 = TestBlock()
local b9 = TestBlock()
top:connect(b1, b2)
top:connect(b6, b7)
top:connect(b2, "out", b3, "in1")
top:connect(b7, "out", b3, "in2")
top:connect(b3, b4, b5)
top:connect(b3, b8, b9)
-- Check evaluation order
local dependency_graph = composite._build_dependency_graph(top._connections)
local evaluation_order = composite._build_evaluation_order(dependency_graph)
assert.is_true(util.array_find(evaluation_order, b1) < util.array_find(evaluation_order, b2))
assert.is_true(util.array_find(evaluation_order, b2) < util.array_find(evaluation_order, b3))
assert.is_true(util.array_find(evaluation_order, b3) < util.array_find(evaluation_order, b4))
assert.is_true(util.array_find(evaluation_order, b4) < util.array_find(evaluation_order, b5))
assert.is_true(util.array_find(evaluation_order, b6) < util.array_find(evaluation_order, b7))
assert.is_true(util.array_find(evaluation_order, b7) < util.array_find(evaluation_order, b3))
assert.is_true(util.array_find(evaluation_order, b3) < util.array_find(evaluation_order, b8))
assert.is_true(util.array_find(evaluation_order, b8) < util.array_find(evaluation_order, b9))
end)
it("running errors", function ()
local TestSource = block.factory("TestSource")
function TestSource:instantiate()
self:add_type_signature({}, {block.Output("out", radio.types.ComplexFloat32)})
end
local TestBlock = block.factory("TestBlock")
function TestBlock:instantiate()
self:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local TestAddBlock = block.factory("TestAddBlock")
function TestAddBlock:instantiate()
self:add_type_signature({block.Input("in1", radio.types.ComplexFloat32), block.Input("in2", radio.types.ComplexFloat32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local TestSink = block.factory("TestSink")
function TestSink:instantiate()
self:add_type_signature({block.Input("in", radio.types.ComplexFloat32)}, {})
end
-- Unconnected inputs
local top = radio.CompositeBlock()
local b0 = TestBlock()
local b1 = TestSink()
top:connect(b0, b1)
assert.has_error(function () top:_prepare_to_run() end)
local top = radio.CompositeBlock()
local b0 = TestSource()
local b1 = TestAddBlock()
local b2 = TestSink()
top:connect(b0, "out", b1, "in1")
top:connect(b1, "out", b2, "in")
assert.has_error(function () top:_prepare_to_run() end)
-- Input rate mismatch
local top = radio.CompositeBlock()
local b0 = TestSource()
local b1 = TestSource()
local b2 = TestAddBlock()
b0.get_rate = function (self) return 1 end
b1.get_rate = function (self) return 2 end
top:connect(b0, "out", b2, "in1")
top:connect(b1, "out", b2, "in2")
assert.has_error(function () top:_prepare_to_run() end)
-- No compatible signatures
local TestAddBlock = block.factory("TestAddBlock")
function TestAddBlock:instantiate()
self:add_type_signature({block.Input("in1", radio.types.ComplexFloat32), block.Input("in2", radio.types.Float32)}, {block.Output("out", radio.types.ComplexFloat32)})
end
local top = radio.CompositeBlock()
local b0 = TestSource()
local b1 = TestSource()
local b2 = TestAddBlock()
local b3 = TestSink()
top:connect(b0, "out", b2, "in1")
top:connect(b1, "out", b2, "in2")
top:connect(b2, "out", b3, "in")
assert.has_error(function () top:_prepare_to_run() end)
-- Initialization error
function TestSink:initialize()
error('foobar')
end
local top = radio.CompositeBlock()
local b0 = TestSource()
local b1 = TestSink()
top:connect(b0, b1)
assert.has_error(function () top:_prepare_to_run() end)
end)
end)
|
function onCreate()
makeLuaSprite('grass2', 'grass2', -100, -200);
addLuaSprite('grass2',false)
setLuaSpriteScrollFactor('grass2', 0.134, 0.9);
makeLuaSprite('grass', 'grass', -200, -150);
addLuaSprite('grass',false)
setLuaSpriteScrollFactor('grass', 0.9, 0.9);
makeAnimatedLuaSprite('backgroundboopers', 'backboopers', -100, -200);
addAnimationByPrefix('recolor', 'backgroundboopers', 'backboopers idle', 24, true);
-- the less scroll factor the more the sprite is stuck to the camera
setScrollFactor('backgroundboopers', 0.8, 0.9);
addLuaSprite('backgroundboopers', false);
setPropertyLuaSprite('backgroundboopers', 'antialiasing', true);
end
|
--[[
Copyright (c) 2014 Juan Carlos González Amestoy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
--]]
local bit=require('bit')
local h=require('h')
local re=require('h.text.re')
local addressParser=require('rvm.parsers.address').parser
local numberParser=require('rvm.parsers.number').parser
local function gchar(c)
if c<32 or c>=128 then return '.' end
return string.char(c)
end
return {
name='memory',
abbr='m',
lastAddress=0,
lastMask=0,
lastType=0,
lastBlock=0,
lastLines=10,
lastSize=8,
doCmd=function(self,cs,str)
local lines,g
local ad,pos=addressParser:match(str)
local t,b,a,m=machine.mem.selectMemory(ad,cs)
if str=='' then
t=self.lastType
a=self.lastAddress
m=self.lastMask
b=self.lastBlock
lines=self.lastLines
g=self.lastSize
else
str=str(pos)
lines,pos=numberParser:match(str)
str=str(pos)
g,pos=numberParser:match(str)
g=g and g or 8
end
if not h.eqAny(g,8,16,32) then
cs.red('Error width must be 8 16 or 32 not "').white('%d',g).red('"\n')
return
end
local f
if t~=nil then
self.lastLines=lines
if t==0 or t==1 then
print(t,b,machine.mem.blockMem[t][b])
f=machine.mem.blockMem[t][b]
elseif t==2 then
f=machine.mem.get
else
return
end
lines=lines and lines-1 or 9
for i=0,lines do
cs.yellow('0x%.4x ',a)
local ascii={}
if g==8 then
for j=0,15 do
local d=f(machine.mem,a)
ascii[#ascii+1]=gchar(d)
cs.lime('%.2x ',d)
a=bit.band(a+1,m)
end
elseif g==16 then
for j=0,7 do
local d=f(machine.mem,a)
local v=d
ascii[#ascii+1]=gchar(d)
a=bit.band(a+1,m)
d=f(machine.mem,a)
ascii[#ascii+1]=gchar(d)
v=v+d*0x100
a=bit.band(a+1,m)
cs.lime('%.4x ',v)
end
else
for j=0,7 do
local d=f(machine.mem,a)
local v=d
ascii[#ascii+1]=gchar(d)
a=bit.band(a+1,m)
d=f(machine.mem,a)
ascii[#ascii+1]=gchar(d)
v=v+d*0x100
a=bit.band(a+1,m)
d=f(machine.mem,a)
ascii[#ascii+1]=gchar(d)
v=v+d*0x10000
a=bit.band(a+1,m)
d=f(machine.mem,a)
ascii[#ascii+1]=gchar(d)
v=v+d*0x1000000
a=bit.band(a+1,m)
cs.lime('%.8x ',v)
end
end
cs.moccasin('%s\n',table.concat(ascii))
end
self.lastType=t
self.lastBlock=b
self.lastMask=m
self.lastAddress=a
self.lastSize=g
else
cs.red('Error: Sintax error.\n')
end
return 0
end
}
|
local vm = require 'vm.vm'
local library = require 'library'
local guide = require 'parser.guide'
local function checkStdLibrary(source)
if source.library then
return source
end
local globalName = vm.getGlobal(source)
if not globalName then
return nil
end
local name = globalName:match '^s|(.+)$'
if library.global[name] then
return library.global[name]
end
end
local function getLibInNode(source, nodeLib)
if not nodeLib then
return nil
end
if not nodeLib.child then
return nil
end
local key = guide.getName(source)
local defLib = nodeLib.child[key]
return defLib
end
local function getNodeAsTable(source)
local node = source.node
local nodeGlobalName = vm.getGlobal(node)
if not nodeGlobalName then
return nil
end
local nodeName = nodeGlobalName:match '^s|(.+)$'
return getLibInNode(source, library.global[nodeName])
end
local function getNodeAsObject(source)
local node = source.node
local values = vm.getValue(node)
if not values then
return nil
end
for i = 1, #values do
local value = values[i]
local type = value.type
local nodeLib = library.object[type]
local lib = getLibInNode(source, nodeLib)
if lib then
return lib
end
end
return nil
end
local function checkNode(source)
if source.type == 'method' then
source = source.parent
elseif source.type == 'field' then
source = source.parent
end
if source.type == 'getfield'
or source.type == 'getmethod'
or source.type == 'getindex' then
return getNodeAsTable(source)
or getNodeAsObject(source)
end
end
local function getLibrary(source)
return checkNode(source)
or checkStdLibrary(source)
or vm.eachRef(source, function (src)
return checkStdLibrary(src)
or checkNode(src)
end, 100)
end
function vm.getLibrary(source)
local cache = vm.cache.getLibrary[source]
if cache ~= nil then
return cache
end
local unlock = vm.lock('getLibrary', source)
if not unlock then
return
end
cache = getLibrary(source) or false
vm.cache.getLibrary[source] = cache
unlock()
return cache
end
|
function WeaponLionGadget1:_shoot_bipod_rays()
local camera = managers.player:player_unit():camera()
local point_1 = camera:position()
local point_2 = mvector3.copy(point_1)
mvector3.add_scaled(point_2, camera:forward(), SimpleBipods:option("forward_ray_length"))
local point_3 = mvector3.copy(point_2)
mvector3.add_scaled(point_3, -camera:rotation():z(), 100)
local mask = managers.slot:get_mask("world_geometry")
local obstacle = self._unit:raycast("ray", point_1, point_2, "slot_mask", mask)
local surface, success
if obstacle then
surface = nil
success = false
else
surface = self._unit:raycast("ray", point_2, point_3, "slot_mask", mask)
success = surface and surface.ray:angle(surface.normal) > 135
end
return point_1, point_2, point_3, obstacle, surface, success
end
function WeaponLionGadget1:_is_deployable()
if self._is_npc or self:_is_in_blocked_deployable_state() then
return false
end
local point_1, point_2, point_3, obstacle, surface, success = self:_shoot_bipod_rays()
if success then
self._from = point_2
self._to = point_3
return true
else
return false
end
end
function WeaponLionGadget1:is_usable()
return self._unit:raycast(self._from, self._to) and true or false
end
function WeaponLionGadget1:set_is_local_player(state)
self._is_local_player = state
end
Hooks:PostHook(WeaponLionGadget1, "update", "SimpleBipods_draw_rays", function (self)
if not self._is_local_player then
return
end
if SimpleBipods:option("draw_rays") then
local point_1, point_2, point_3, obstacle, surface, success = self:_shoot_bipod_rays()
if obstacle then
Application:draw_line(point_1, point_2, 1, 0, 0)
Application:draw_line(point_2, point_3, 1, 0, 0)
else
Application:draw_line(point_1, point_2, 0, 1, 0)
if surface then
if success then
Application:draw_line(point_2, point_3, 0, 1, 0)
else
Application:draw_line(point_2, point_3, 1, 1, 0)
end
else
Application:draw_line(point_2, point_3, 1, 0, 0)
end
end
end
end)
Hooks:PostHook(WeaponLionGadget1, "check_state", "SimpleBipods_enable_update", function (self)
self._unit:set_extension_update_enabled(Idstring("base"), true)
end)
|
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
local function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local player = Player(cid)
if msgcontains(msg, "angelina") then
if player:getStorageValue(Storage.OutfitQuest.MageSummoner.AddonWand) == 1 then
npcHandler:say({
"Angelina had been imprisoned? My, these are horrible news, but I am so glad to hear that she is safe now. ...",
"I will happily carry out her wish and reward you, but I fear I need some important ingredients for my blessing spell first. ...",
"Will you gather them for me?"
}, cid)
npcHandler.topic[cid] = 1
end
elseif msgcontains(msg, "wand") or msgcontains(msg, "rod") then
if player:getStorageValue(Storage.OutfitQuest.MageSummoner.AddonWand) == 2 then
npcHandler:say("Did you bring a sample of each wand and each rod with you?", cid)
npcHandler.topic[cid] = 3
end
elseif msgcontains(msg, "sulphur") then
if player:getStorageValue(Storage.OutfitQuest.MageSummoner.AddonWand) == 3 then
npcHandler:say("Did you obtain 10 ounces of magic sulphur?", cid)
npcHandler.topic[cid] = 4
end
elseif msgcontains(msg, "soul stone") then
if player:getStorageValue(Storage.OutfitQuest.MageSummoner.AddonWand) == 4 then
npcHandler:say("Were you actually able to retrieve the Necromancer's soul stone?", cid)
npcHandler.topic[cid] = 5
end
elseif msgcontains(msg, "ankh") then
if player:getStorageValue(Storage.OutfitQuest.MageSummoner.AddonWand) == 5 then
npcHandler:say("Am I sensing enough holy energy from ankhs here?", cid)
npcHandler.topic[cid] = 6
end
elseif msgcontains(msg, "yes") then
if npcHandler.topic[cid] == 1 then
npcHandler:say({
"Thank you, I promise that your efforts won't be in vain! Listen closely now: First, I need a sample of five druid rods and five sorcerer wands. ...",
"I need a snakebite rod, a moonlight rod, a necrotic rod, a terra rod and a hailstorm rod. Then, I need a wand of vortex, a wand of dragonbreath ...",
"... a wand of decay, a wand of cosmic energy and a wand of inferno. Please bring them all at once so that their energy will be balanced. ...",
"Secondly, I need 10 ounces of magic sulphur. It can absorb the elemental energy of all the wands and rods and bind it to something else. ...",
"Next, I will need a soul stone. These can be used as a vessel for energy, evil as well as good. They are rarely used nowaday though. ...",
"Lastly, I need a lot of holy energy. I can extract it from ankhs, but only a small amount each time. I will need about 20 ankhs. ...",
"Did you understand everything I told you and will help me with my blessing?"
}, cid)
npcHandler.topic[cid] = 2
elseif npcHandler.topic[cid] == 2 then
npcHandler:say("Alright then. Come back to with a sample of all five wands and five rods, please.", cid)
player:setStorageValue(Storage.OutfitQuest.MageSummoner.AddonWand, 2)
npcHandler.topic[cid] = 0
elseif npcHandler.topic[cid] == 3 then
if player:getItemCount(2181) > 0 and player:getItemCount(2182) > 0 and player:getItemCount(2183) > 0 and player:getItemCount(2185) > 0 and player:getItemCount(2186) > 0 and player:getItemCount(2187) > 0 and player:getItemCount(2188) > 0 and player:getItemCount(2189) > 0 and player:getItemCount(2190) > 0 and player:getItemCount(2191) > 0 then
npcHandler:say("Thank you, that must have been a lot to carry. Now, please bring me 10 ounces of magic sulphur.", cid)
player:removeItem(2181, 1)
player:removeItem(2182, 1)
player:removeItem(2183, 1)
player:removeItem(2185, 1)
player:removeItem(2186, 1)
player:removeItem(2187, 1)
player:removeItem(2188, 1)
player:removeItem(2189, 1)
player:removeItem(2190, 1)
player:removeItem(2191, 1)
player:setStorageValue(Storage.OutfitQuest.MageSummoner.AddonWand, 3)
npcHandler.topic[cid] = 0
end
elseif npcHandler.topic[cid] == 4 then
if player:removeItem(5904, 10) then
npcHandler:say("Very good. I will immediately start to prepare the ritual and extract the elemental energy from the wands and rods. Please bring me the Necromancer's soul stone now.", cid)
player:setStorageValue(Storage.OutfitQuest.MageSummoner.AddonWand, 4)
npcHandler.topic[cid] = 0
end
elseif npcHandler.topic[cid] == 5 then
if player:removeItem(5809, 1) then
npcHandler:say("You have found a rarity there, |PLAYERNAME|. This will become the tip of your blessed wand. Please bring me 20 ankhs now to complete the ritual.", cid)
player:setStorageValue(Storage.OutfitQuest.MageSummoner.AddonWand, 5)
npcHandler.topic[cid] = 0
end
elseif npcHandler.topic[cid] == 6 then
if player:removeItem(2193, 20) then
npcHandler:say("The ingredients for the ritual are complete! I will start to prepare your blessed wand,... I'm glad to tell you that I have finished the ritual, |PLAYERNAME|. Here is your new wand. I hope you carry it proudly for everyone to see.", cid)
player:setStorageValue(Storage.OutfitQuest.MageSummoner.AddonWand, 6)
player:addOutfitAddon(141, 1)
player:addOutfitAddon(130, 1)
player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)
npcHandler.topic[cid] = 0
end
end
end
return true
end
npcHandler:setMessage(MESSAGE_GREET, "Welcome in the name of the gods, pilgrim |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Be careful on your journeys.")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Be careful on your journeys.")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
|
local path = (...)
local sub1 = path:match("(.-)%.[^%.]+$")
local sub2 = sub1:match("(.-)%.[^%.]+$")
local font_path = sub2:gsub("%.", "/").."/res/font/%s/%s.ttf"
local dpi_scale = love.window.getDPIScale()
local function make_font(typeface, weight, size)
return love.graphics.newFont(font_path:format(typeface, weight), size*dpi_scale);
end
return {
H1 = make_font( "Roboto" , "Light" , 96);
H2 = make_font( "Roboto" , "Light" , 60);
H3 = make_font( "Roboto" , "Regular" , 48);
H4 = make_font( "Roboto" , "Regular" , 34);
H5 = make_font( "Roboto" , "Regular" , 24);
H6 = make_font( "Roboto" , "Medium" , 20);
subtitle1 = make_font( "Roboto" , "Regular" , 16);
subtitle2 = make_font( "Roboto" , "Medium" , 14);
body1 = make_font( "Roboto" , "Regular" , 16);
body2 = make_font( "Roboto" , "Regular" , 14);
button = make_font( "Roboto" , "Medium" , 14);
caption = make_font( "Roboto" , "Regular" , 12);
overline = make_font( "Roboto" , "Regular" , 10);
}
|
local CreateGuideViewFactory = class();
CreateGuideViewFactory.getView = function(self,p_keyString,p_data)
local wnd = nil;
if p_keyString == "safeBox" then
local _class = require("hall/bankrupt/widget/differentGuide/safeBoxGuide");
wnd = new(_class,p_data);
elseif p_keyString == "toShare" then
local _class = require("hall/bankrupt/widget/differentGuide/shareGuide");
wnd = new(_class,p_data);
elseif p_keyString == "getMoney" then
local _class = require("hall/bankrupt/widget/differentGuide/countDownOverGuide");
wnd = new(_class,p_data);
elseif p_keyString == "toMatch" then
local _class = require("hall/bankrupt/widget/differentGuide/matchGuide");
wnd = new(_class,p_data);
elseif p_keyString == "toCutCD" then
local _class = require("hall/bankrupt/widget/differentGuide/cutCDGuide");
wnd = new(_class,p_data);
else
Log.v("CreateGuideViewFactory","CreateGuideViewFactory.getView");
end
return wnd;
end
return CreateGuideViewFactory;
|
-- Generated by CSharp.lua Compiler
local System = System
local UnityEngine = UnityEngine
local CSharpLuaProjectProtocol
local CSharpLuaSettingProto
System.import(function (out)
CSharpLuaProjectProtocol = CSharpLua.Project.Protocol
CSharpLuaSettingProto = CSharpLua.Project.Protocol.SettingProto
end)
System.namespace("Sample", function (namespace)
namespace.class("TestProtobuf", function (namespace)
local Run, Encode, Decode
Run = function ()
protobuf.register_file("Assets/Lua/3rd/pbc/Protocol/CommonPrototype.pb")
local default = CSharpLuaProjectProtocol.SettingProto()
default.SettingsMark = 101
local proto = default
local extern = CSharpLuaSettingProto.ValuePairProto()
extern.Key = "a"
extern.Value = "b"
proto.Values:Add(extern)
local bytes = Encode(proto)
local t = Decode(bytes, CSharpLuaProjectProtocol.SettingProto)
UnityEngine.Debug.LogFormat("ProtobufDecode {0}", t.SettingsMark)
end
Encode = function (proto)
local bytes = nil
bytes = encodeProtobuf(proto)
return bytes
end
Decode = function (bytes, T)
local t = nil
t = decodeProtobuf(bytes, T)
return t
end
return {
Run = Run
}
end)
end)
|
---------------------------------------------------------------------------------------------------
modifier_faceless_void_time_dilation_degen_oaa = modifier_faceless_void_time_dilation_degen_oaa or class({})
function modifier_faceless_void_time_dilation_degen_oaa:IsHidden()
return true
end
function modifier_faceless_void_time_dilation_degen_oaa:IsDebuff()
return true
end
function modifier_faceless_void_time_dilation_degen_oaa:IsPurgable()
return true
end
function modifier_faceless_void_time_dilation_degen_oaa:OnCreated()
local ability = self:GetAbility()
if ability then
self.heal_prevent_percent = ability:GetSpecialValueFor("heal_prevent_percent")
else
self.heal_prevent_percent = -10
end
end
function modifier_faceless_void_time_dilation_degen_oaa:OnRefresh()
local ability = self:GetAbility()
if ability then
self.heal_prevent_percent = ability:GetSpecialValueFor("heal_prevent_percent")
else
self.heal_prevent_percent = -10
end
end
function modifier_faceless_void_time_dilation_degen_oaa:DeclareFunctions()
return {
MODIFIER_PROPERTY_HEAL_AMPLIFY_PERCENTAGE_TARGET,
MODIFIER_PROPERTY_HP_REGEN_AMPLIFY_PERCENTAGE,
MODIFIER_PROPERTY_LIFESTEAL_AMPLIFY_PERCENTAGE,
MODIFIER_PROPERTY_SPELL_LIFESTEAL_AMPLIFY_PERCENTAGE,
}
end
function modifier_faceless_void_time_dilation_degen_oaa:GetModifierHealAmplify_PercentageTarget()
return self.heal_prevent_percent
end
function modifier_faceless_void_time_dilation_degen_oaa:GetModifierHPRegenAmplify_Percentage()
return self.heal_prevent_percent
end
function modifier_faceless_void_time_dilation_degen_oaa:GetModifierLifestealRegenAmplify_Percentage()
return self.heal_prevent_percent
end
function modifier_faceless_void_time_dilation_degen_oaa:GetModifierSpellLifestealRegenAmplify_Percentage()
return self.heal_prevent_percent
end
|
-- midi module
local Midi = {}
function Midi.hello()
print("hi midi")
end
function Midi.to_midi_msg(data)
-- data table structure
-- (1, message.status);
-- (2, message.channel);
-- (3, message.pitch);
-- (4, message.velocity);
-- (5, message.control);
-- (6, message.value);
-- (7, message.portNum);
-- (8, message.portName);
local msg = {}
-- note on
if data[1] == 144 then
msg = {
note = data[3],
vel = data[4],
ch = data[2],
--type = "note_on"
}
if data[4] == 0 then -- if velocity is zero then send note-off
msg.type = "note_off"
else
msg.type = "note_on" -- otherwise its a note-on
end
-- note off
elseif data[1] == 128 then
msg = {
type = "note_off",
note = data[3],
vel = data[4],
ch = data[2]
}
-- cc
elseif data[1] + (data[2] - 1) == 176 then
msg = {
type = "cc",
cc = data[5],
val = data[6],
ch = data[2]
}
-- program change
elseif data[1] + (data[2] - 1) == 192 then
msg = {
type = "program_change",
val = data[6],
ch = data[2]
}
-- start
elseif data[1] == 250 then
msg.type = "start"
-- stop
elseif data[1] == 252 then
msg.type = "stop"
-- continue
elseif data[1] == 251 then
msg.type = "continue"
-- clock
elseif data[1] == 248 then
msg.type = "clock"
-- song position pointer
elseif data[1] == 242 then
msg = {
type = "song_position",
-- not sure how lsb/msb are sent
--lsb = data[2],
--msb = data[3]
}
-- song select
elseif data[1] == 243 then
msg = {
type = "song_select",
val = data[6]
}
end
return msg
end
-- Get MIDI Data and set knob values
function Midi.knobs(msg_data)
if msg_data[1] ~= nil then
m = Midi.to_midi_msg(msg_data)
--tab.print(m)
if m.type == "cc" then
if m.cc == 21 then
knob1 = m.val/127
end
if m.cc == 22 then
knob2 = m.val/127
end
if m.cc == 23 then
knob3 = m.val/127
end
if m.cc == 24 then
knob4 = m.val/127
end
if m.cc == 7 then
knob5 = m.val/127
end
end
--midi_msg = {} -- do I need to reset?
end
end
return Midi
|
---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by heyqule.
--- DateTime: 3/17/2021 8:16 PM
---
require('ArmouredBiters/control')
require('Cold_Biters/control')
require('Explosive_Biters/control')
|
local baseg = cat.require"module/graphics/base_graphics"
local circle = cat.class("point",baseg){
radius = 10;
}
function circle:__init__(fill_mode,x,y,radius)
baseg.__init__(self,fill_mode,x,y)
self.radius = radius or 10
end
function circle:set_radius(r)
self.radius = radius or self.radius
end
function circle:draw()
love.graphics.setColor(self.color:unpack())
love.graphics.circle(self.fill_mode,self.position.x,self.position.y,self.radius)
love.graphics.setColor(255,255,255,255)
end
return circle
|
--[[a = {p = print}
a.p("Hello World")
print = math.sin()
a.p(print(1))
sin = a.print
sin(10,20)
--]]
function foo(x)
return 2 * x
end
network = {
{name = "grauna", IP = "210.26.30.34"},
{name = "arraial", IP = "210.26.30.23"},
{name = "lua", IP = "210.26.23.12"},
{name = "derain", IP = "210.26.23.20"},
}
table.sort(network,function(a,b)
return (a.name < b.name)
end
)
for i = 1,4 do
print(network[i].name,network[i].IP)
end
table.sort(network,function(a,b)
return (a.IP < b.IP)
end
)
for i = 1,4 do
print(network[i].name,network[i].IP)
end
function eraseTerminal()
io.write("\27[2J")
end
function mark(x,y)
io.write(string.format("\27[%d;%dH*",y,x))
end
TermSize = {w = 80,h = 24}
function plot (f)
eraseTerminal()
for i = 1,TermSize.w do
local x = (i/TermSize.w)*2 - 1
local y = (f(x) + 1)/2 * TermSize.h
mark(i,y)
end
io.read()
end
--plot(function (x) return math.sin(x*2*math.pi) end)
names = {"Peter","Paul","Mary"}
grades = {Mary = 10,Paul = 7,Peter = 8}
table.sort(names,function(n1,n2)
return grades[n1] > grades[n2]
end)
for i = 1,3 do
print(names[i])
end
function sortbygrade(names,grades)
table.sort(names,function(n1,n2)
return grades[n1] > grades[n2]
end)
end
for i = 1,3 do
print(names[i])
end
--[[function newCounter()
local i = 0
return function()
i = i + 1
return i
end
end
c1 = newCounter()
print(c1())
print(c1())
function digitButton(digit)
return Button{
label = digit
action = function()
add_to_display(digit)
end
}
end--]]
oldSin = math.sin
math.sin = function (x)
return oldSin(x * math.pi / 180)
end
do
local oldSin = math.sin
local k = math.pi / 180
math.sin = function (x)
return oldSin(x * k)
end
end
do
local oldOpen = io.open
io.open = function(filename,mode)
if access_OK(filename,mode) then
return oldOpen(filename,mode)
else
return nil,"access denied"
end
end
end
Lib = {}
Lib.foo = function (x,y)
return x + y
end
Lib.goo = function(x,y)
return x - y
end
Lib = {
foo = function (x,y) return x + y end,
goo = function (x,y) return x - y end
}
Lib = {}
function Lib.foo (x,y)
return x + y
end
function Lib.goo (x,y)
return x - y
end
local fact
fact = function(n)
if n == 0 then
return 1
else
return n * fact(n - 1)
end
end
function foo (n)
if n > 0 then
return foo(n - 1)
end
end
function room1()
local move = io.read()
if move == "south" then
return room3()
elseif move == "east" then
return room2()
else
print("invalid move")
return room1()
end
end
function room2()
local move = io.read()
if move == "south" then
return room4()
elseif move == "west" then
return room1()
else
print("invalid move")
return room2()
end
end
function room3()
local move = io.read()
if move == "north" then
return room1()
elseif move == "east" then
return room4()
else
print("invalid move")
return room3()
end
end
function room4()
print("congratilations!")
end
|
---@class FrameInfoConst
---A constant FrameInfo object, passed into Lua as an argument by the FileHandler write callback function. This has similar attributes/properties as FrameInfo, but the fields can only be read from, not written to.
---
---Since: 1.11.3
---@param time NSTime Mode: Retrieve only. The packet timestamp as an NSTime object.
---@param data any Mode: Retrieve only. The data buffer containing the packet.
---@param rec_type any Mode: Retrieve only. The record type of the packet frame - see wtap_presence_flags in init.lua for values.
---@param flags any Mode: Retrieve only. The presence flags of the packet frame - see wtap_presence_flags in init.lua for bits.
---@param captured_length number Mode: Retrieve only. The captured packet length, and thus the length of the buffer in the FrameInfoConst.data field.
---@param original_length number Mode: Retrieve only. The on-the-wire packet length, which may be longer than the captured_length.
---@param encap any Mode: Retrieve only. The packet encapsulation type, if the file supports per-packet types. See wtap_encaps in init.lua for possible packet encapsulation types to use as the value for this field.
---@param comment string Mode: Retrieve only. A comment for the packet; nil if there is none.
FrameInfoConst = {}
---Generates a string of debug info for the FrameInfo
---@return string String of debug information.
function FrameInfoConst:__tostring()
end
---Tells Wireshark to write directly to given file from the frame data buffer, for length bytes. Returns true if succeeded, else false.
---@param file File The File object userdata, provided by Wireshark previously in a writing-based callback.
---@param length number optional. The number of bytes to write to the file at the current cursor position, or all if not supplied.
---@return boolean True if succeeded, else returns false along with the error number and string error description.
function FrameInfoConst:write_data(file, length)
end
|
local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local string = _tl_compat and _tl_compat.string or string; local table = _tl_compat and _tl_compat.table or table; local types = require('legendary.types')
local M = {}
local _current_id = 0
local function next_id()
_current_id = _current_id + 1
return _current_id
end
local last_used_item
local keymaps = require('legendary.config').keymaps
local commands = require('legendary.config').commands
local autocmds = require('legendary.config').autocmds
local utils = require('legendary.utils')
local formatter = require('legendary.formatter')
function M.bind_keymap(keymap, kind)
keymap = utils.resolve_description(keymap)
keymap.kind = (kind or 'legendary.keymap')
keymap.id = next_id()
types.validate_keymap(keymap)
if not keymap or type(keymap) ~= 'table' then
utils.notify(string.format('Expected table, got %s', type(keymap)))
return
end
if utils.list_contains(keymaps, keymap) then
return
end
if keymap.opts and (keymap.opts.buffer == 0 or keymap.opts.buffer == true) then
keymap.opts.buffer = vim.api.nvim_get_current_buf()
end
utils.set_keymap(keymap)
require('legendary.formatter').update_padding(keymap)
for _, resolved_keymap in ipairs(utils.resolve_with_per_mode_description(keymap)) do
keymap.id = next_id()
table.insert(keymaps, resolved_keymap)
end
end
function M.bind_keymaps(new_keymaps, kind)
if not new_keymaps or type(new_keymaps) ~= 'table' then
return
end
if not vim.tbl_islist(new_keymaps) then
utils.notify(
string.format('Expected list-like table, got %s, at require("legendary").bind_keymaps', type(new_keymaps)))
return
end
vim.tbl_map(function(keymap)
M.bind_keymap(keymap, kind)
end, new_keymaps)
end
function M.bind_command(cmd, kind)
cmd = utils.resolve_description(cmd)
cmd.kind = (kind or 'legendary.command')
cmd.id = next_id()
types.validate_command(cmd)
if not cmd or type(cmd) ~= 'table' then
utils.notify(string.format('Expected table, got %s', type(cmd)))
return
end
if cmd.opts and cmd.opts.buffer == 0 then
cmd.opts.buffer = vim.api.nvim_get_current_buf()
end
if utils.list_contains(commands, cmd) then
return
end
utils.set_command(cmd)
require('legendary.formatter').update_padding(cmd)
table.insert(commands, cmd)
end
function M.bind_commands(cmds, kind)
if not cmds or type(cmds) ~= 'table' then
return
end
if not vim.tbl_islist(cmds) then
utils.notify(
string.format('Expected list-like table, got %s, at require("legendary").bind_commands', type(cmds)))
return
end
vim.tbl_map(function(cmd)
M.bind_command(cmd, kind)
end, cmds)
end
local function bind_autocmd(autocmd, group, kind)
autocmd = utils.resolve_description(autocmd)
autocmd.kind = (kind or 'legendary.autocmd')
autocmd.id = next_id()
types.validate_autocmd(autocmd)
if not vim.api.nvim_create_augroup then
utils.notify(
'Sorry, managing autocmds via legendary.nvim is only supported on Neovim 0.7+ (requires `vim.api.nvim_create_augroup` and `vim.api.nvim_create_autocmd` API functions).')
return
end
if not autocmd or type(autocmd) ~= 'table' then
utils.notify(string.format('Expected table, got %s', type(autocmd)))
return
end
if utils.list_contains(autocmds, autocmd) then
return
end
if autocmd.opts and autocmd.opts.buffer == 0 then
autocmd.opts.buffer = vim.api.nvim_get_current_buf()
end
utils.set_autocmd(autocmd, group)
if autocmd.description and #autocmd.description > 0 and not (autocmd.opts or {}).once then
require('legendary.formatter').update_padding(autocmd)
table.insert(autocmds, autocmd)
end
end
local function bind_augroup(augroup, kind)
augroup = utils.resolve_description(augroup)
types.validate_augroup(augroup)
if not vim.api.nvim_create_augroup then
utils.notify(
'Sorry, managing autocmds via legendary.nvim is only supported on Neovim 0.7+ (requires `vim.api.nvim_create_augroup` and `vim.api.nvim_create_autocmd` API functions).')
return
end
local group_name = augroup and augroup.name or ''
if #group_name == 0 then
utils.notify('augroup must have a name')
return
end
local clear = augroup and augroup.clear
if clear == nil then
clear = true
end
vim.api.nvim_create_augroup(group_name, { clear = clear })
for _, autocmd in ipairs(augroup) do
autocmd.opts = autocmd.opts or {}
autocmd.opts.group = group_name
bind_autocmd(autocmd, group_name, kind)
end
end
function M.bind_autocmds(au, kind)
if utils.is_user_augroup(au) then
bind_augroup(au)
elseif utils.is_user_autocmd(au) then
bind_autocmd(au)
else
vim.tbl_map(function(augroup_or_autocmd)
if utils.is_user_augroup(augroup_or_autocmd) then
bind_augroup(augroup_or_autocmd, kind)
elseif utils.is_user_autocmd(augroup_or_autocmd) then
bind_autocmd(augroup_or_autocmd, kind)
end
end, au)
end
end
function M.find(item_kind, filters)
item_kind = item_kind or ''
local current_mode = (vim.fn.mode() or '')
local visual_selection = nil
if utils.is_visual_mode(current_mode) then
visual_selection = utils.get_marks()
utils.send_escape_key()
end
local cursor_position = vim.api.nvim_win_get_cursor(0)
local items
if item_kind == 'legendary.keymap' then
items = keymaps
elseif item_kind == 'legendary.command' then
items = commands
elseif item_kind == 'legendary.autocmd' then
items = autocmds
else
items = vim.list_extend({}, keymaps)
items = vim.list_extend(items, commands)
items = vim.list_extend(items, autocmds)
end
if
require('legendary.config').most_recent_item_at_top and
last_used_item and
type(item_kind) == 'string' and
vim.startswith(last_used_item.kind, item_kind) then
for i, item in ipairs(items) do
if item.id == last_used_item.id then
table.remove(items, i)
table.insert(items, 1, item)
goto last_used_item_found
end
end
::last_used_item_found::
end
filters = filters or {}
if type(filters) == 'function' then
filters = { filters }
end
table.insert(filters, function(item)
return item.opts == nil or item.opts.buffer == nil or item.opts.buffer == vim.api.nvim_get_current_buf()
end)
for _, filter in ipairs(filters) do
if type(filter) ~= 'function' then
utils.notify('Passed an item filter that is not a function', vim.log.levels.WARN)
goto skip_filter
end
items = vim.tbl_filter(function(item)
local result = filter(item)
if type(result) ~= 'boolean' then
return true
end
return result
end, items)
::skip_filter::
end
local select_kind = string.format(
'legendary.%s',
type(item_kind) == 'string' and #item_kind > 0 and item_kind or 'items')
local prompt = require('legendary.config').select_prompt
if type(prompt) == 'function' then
prompt = (prompt)(select_kind)
end
vim.ui.select(items, {
prompt = vim.trim((prompt) or ''),
kind = select_kind,
format_item = formatter.format,
}, function(selected)
if not selected then
return
end
if require('legendary.config').most_recent_item_at_top then
last_used_item = vim.tbl_extend('force', {}, selected)
end
vim.schedule(function()
require('legendary.executor').try_execute(
selected,
vim.api.nvim_get_current_buf(),
visual_selection,
current_mode,
cursor_position)
end)
end)
end
return M
|
start_money = 50000
map_update_ms = 80
first_spawn_location = {212225.000000, 192940.000000, 1400.000000, -180.0} -- x, y, z, h
vehicle_health_update_ms = 200
vehicle_speed_update_ms = 20
start_time = 10.0 -- 0 to 24
time_locked = true -- does the time is locked
time_update_ms = 25000
time_update_value = 0.1
max_level = 300
xp_base = 1000 -- xp needed to pass 1 level
xp_added_level = 500 -- xp added to xp needed to pass next level
criminal_bonus_base = 1000 -- criminal kill bonus at start
criminal_bonus_added = 500 -- criminal kill bonus added at each offence
passive_time_to_disable_ms = 30000
passive_delay_after_disable_to_enable_again_ms = 60000
clothing_store_price = 100
sell_vehicle_percentage = 75
max_weapon_ammo = 9999
armor_cost = 250
race_money_won_mult_for_each_player = 1.5
race_money_won = 500 -- money won (race_money_won*(race_money_won_mult_for_each_player*number_of_players_in_race))/place_in_race
race_xp_won_mult_for_each_player = 1.5
race_xp_won = 250 -- xp won (race_xp_won*(race_xp_won_mult_for_each_player*number_of_players_in_race))/place_in_race
save_command_cooldown_s = 120
save_interval_s = 900
grocery_heist_cooldown_s = 300
grocery_heist_money_min = 200
grocery_heist_money_max = 2000
grocery_energy_bar_price = 2
grocery_energy_bar_health_given = 10
max_energy_bars = 100
duels_win_reward_min = 250
duels_win_reward_max = 1000
duels_weapon = 11
max_friends = 30
salary_interval_s = 900
salary_money = 2500
police_car_id = 3
nitro_price_percentage = 10 -- Price of the nitro in percentage of the vehicle price
car_paint_cost = 500
Hats_Price = 50
_Shooting_range_price = 25
_Shooting_range_bullets = 60
_Shooting_range_xp_earned = 150 -- xp at 100 accuracy
_CQB_price = 50
_CQB_max_public_records = 3
_CQB_xp_earned = 200
_Bunkers_raw_materials_steal_xp_earned = 400
_Bunkers_raw_materials_steal_kill_bonus = 5000
_Bunkers_weapons_sell_kill_bonus = 10000
admins = {
--"steamid",
}
noclip_speed = 100
OnlineKeys = {
ACTION_KEY = "E",
ADMIN_KEY = "F10",
PLAYER_MENU_KEY = "P",
POLICE_KEY = "O",
SHOWMOUSE_KEY = "I",
TAB_KEY = "Tab",
MAP_KEY = "M",
LEAVE_MENU_KEY = "Y", -- the key to open the duel menu, heist menu and racing menu to leave
OPEN_VEHICLE_HOOD_KEY = "F2",
CLOSE_VEHICLE_HOOD_KEY = "F3",
OPEN_VEHICLE_TRUNK_KEY = "F4",
CLOSE_VEHICLE_TRUNK_KEY = "F5",
HELP_KEY = "F1",
RESET_ANIMATION_KEY = "1", -- you'll need to modify things to change the script because it's 1 and &
}
spawns = {}
spawns["gas"] = {
x = 125773.000000,
y = 80246.000000,
z = 1645.000000,
roty = 90.0,
}
spawns["town"] = {
x = 172955.000000,
y = 183155.000000,
z = 2142.000000,
roty = 0.0,
}
spawns["harbor"] = {
x = 60934.000000,
y = 183517.000000,
z = 756.000000,
roty = 0.0,
}
spawns["smalltown"] = {
x = 41456.000000,
y = 134472.000000,
z = 1726.000000,
roty = 0.0,
}
spawns["smalltown2"] = {
x = -17583.000000,
y = -234.000000,
z = 2283.000000,
roty = 0.0,
}
spawns["military"] = {
x = 153582.000000,
y = -148690.000000,
z = 1435.000000,
roty = 0.0,
}
spawns["town2"] = {
x = -170537.000000,
y = -38049.000000,
z = 1243.000000,
roty = 0.0,
}
atms_objects = {
{-20544,-15466,2060,107}, -- x,y,z,roty
{43904,132866,1566,93},
{136728,192593,1288,-90},
{212682,190483,1306,-180},
{-75655,86857,2192,-103},
{-180478,-67312,1146,-87},
{129241,78087,1573,93},
}
clothes_npcs = {
{178325,186782,1299,-52}, -- x,y,z,roty
}
car_dealer_vehicles = {
{1, 10000}, -- model, price
{4, 20000},
{5, 15000},
{6, 75000},
{7, 25000},
{11, 15000},
{12, 50000},
{13, 40000},
{25, 2500},
{27, 15000},
{29, 10000},
{35, 15000},
{37, 100000},
{40, 50000},
{43, 10000},
{50, 15000},
}
weapons_shops_weapons = {
{2, 4, 1500, 30, 1}, -- weapon model id, weapon object id, price, ammo_sold, price_for_1_bullet
{3, 5, 800, 30, 1},
{4, 6, 800, 30, 1},
{5, 7, 1000, 30, 1},
{6, 8, 3000, 30, 3},
{7, 9, 3000, 30, 3},
{8, 10, 6000, 30, 1},
{9, 11, 3000, 30, 1},
{10, 12, 6000, 30, 1},
{11, 13, 10000, 30, 2},
{12, 14, 8000, 30, 2},
{13, 15, 30000, 30, 2},
{14, 16, 10000, 30, 2},
{15, 17, 15000, 30, 4},
{16, 18, 6000, 30, 2},
{17, 19, 10000, 30, 2},
{18, 20, 10000, 30, 2},
{19, 21, 12000, 30, 2},
{20, 22, 20000, 30, 5},
}
police_npcs = { -- npcs to join police
{173558,192275,1321, 0} -- x, y, z, heading
}
special_vehicles = {
{10, 500000}, -- model, price
{26, 1200000},
{30, 2500000},
}
Vehicle_armors = {
{1, 3000, 20}, -- level required, price, armor in percentage (100 = vehicle damage / 2)
{2, 6000, 40},
{3, 9000, 60},
{5, 12000, 80},
{8, 20000, 100},
}
wtem_text = [[
Ways to earn money : <br>
You can play racing with players <br>
You can kill players to steal a part of the money the have on them (You'll become a criminal and you'll have a kill bonus on you if you do that) <br>
You can be a Policeman and kill criminals to earn their kill bonus (You'll become a criminal if you kill someone that is not/no longer a criminal) <br>
You can rob grocery stores <br>
You can do a heist (appartment needed) <br>
You earn money while playing on the server <br>
You can do duels with players (press E on them) <br>
]]
wycd_text = [[
In Onset Online the first thing that you should do is withdraw money at an ATM (Press M to open the map). <br>
Then you should buy a garage to store vehicles <br>
You can now buy a vehicle at a car dealer <br>
You should also buy a weapon and ammo at a Gun Store <br>
Open the map to see what you can do <br>
]]
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ADVANCED
action_distance = 275
spawn_loc = {123051.28125, 168295, 3114.56494, 0.0} -- x, y, z, ry
input_while_in_ui = INPUT_GAMEANDUI
special_spawn_camera_distance = 1000
special_vehicles_spawn_destroy_after_s_if_is_on_the_same_loc = 60
special_vehicles_spawn_higher_distance3d_considered_as_same_loc = 1200
special_vehicles_spawn_cooldown_if_spawn_failed_ms = 3000
police_vehicles_spawn_destroy_after_s_if_is_on_the_same_loc = 60
police_vehicles_spawn_higher_distance3d_considered_as_same_loc = 1200
police_spawn_cooldown_ms = 5000
AnimationsKeys = {
{"2", "é"},
{"3", 'Quote'},
{"4", "Apostrophe"},
{"5", "Left Parantheses"},
{"6", "Hyphen"},
{"7", "è"},
{"8", "Underscore"},
{"9", "ç"},
{"0", "à"},
}
pickups_triggers = {
{1443, "OnPlayerCashAction"}, -- model id, server event
{2, "OnPlayerGarageAction"},
{334, "OnPlayerRacingAction"},
{615, "OnPlayerGroceryHeistMoneyAction"}
}
actions = {
{5, 494, "OnATMAction"}, -- hittype, model id, client event
{4, 3, "OnPlayerClothingAction"},
{4, 14, "OnPlayerCarDealerAction"},
{5, 340, "OnPlayerManageVehiclesAction"},
{4, 25, "OnPlayerWeaponShopAction"},
{4, 13, "OnPlayerPoliceAction"},
{4, 4, "OnPlayerGroceryAction"},
{4, 26, "OnPlayerSpecialVehiclesAction"},
{4, 10, "OnPlayerHatsStoreAction"},
{5, 1475, "OnPlayerHeistFinalPhaseTakeMoney"},
{3, 14, "OnPlayerHeistFinalPhasePutMoney"},
{4, 29, "OnPlayerTraining"},
{4, 12, "OnPlayerBunker"},
}
garages = {}
garages[1] = {}
garages[1].price = 25000
garages[1].entrance = {172610, 207304, 1408} -- x, y, z
garages[1].manage = {173676, 207122, 1408}
garages[1].exit = {173805, 207448, 1408}
garages[1].vexit = {172099, 206838, 1408, 180}
garages[1].vehicles = { -- where vehicles are in the garage
{173266, 207321, 1408, -180}, -- x, y, z, roty
{173266, 206855, 1408, -180},
{173266, 206312, 1408, -180},
{173266, 205859, 1408, -180},
}
garages[2] = {}
garages[2].price = 25000
garages[2].entrance = {128998, 75212, 1563} -- x, y, z
garages[2].manage = {128850, 74113, 1563}
garages[2].exit = {129160, 74009, 1563}
garages[2].vexit = {128533, 75460, 1563, 90}
garages[2].vehicles = { -- where vehicles are in the garage
{129005, 74636, 1563, 90}, -- x, y, z, roty
{128545, 74636, 1563, 90},
{128018, 74636, 1563, 90},
{127544, 74636, 1563, 90},
}
garages[3] = {}
garages[3].price = 20000
garages[3].entrance = {-185733, -51400, 1143} -- x, y, z
garages[3].manage = {-186493, -50271, 1143}
garages[3].exit = {-185969, -50880, 1143}
garages[3].vexit = {-184533, -51573, 1143, -90}
garages[3].vehicles = { -- where vehicles are in the garage
{-186271, -51392, 1143, 0}, -- x, y, z, roty
{-185374, -50518, 1143, -90},
{-184592, -50518, 1143, -90},
}
garages[4] = {}
garages[4].price = 20000
garages[4].entrance = {175578, 204015, 1305} -- x, y, z
garages[4].manage = {174487, 204817, 1305}
garages[4].exit = {175092, 204305, 1305}
garages[4].vexit = {175714, 202905, 1305, 0}
garages[4].vehicles = { -- where vehicles are in the garage
{175569, 204636, 1305, -90}, -- x, y, z, roty
{174686, 203728, 1305, 0},
{174686, 202919, 1305, 0},
}
car_dealer_npcs = {
{203059,184339,1304,-39}, -- x,y,z,roty
{-182398,-32513,1145,-82},
}
car_dealer_showcase = {
{204686, 182836, 1304, 90, 204900, 183400, 1304, 0, -135, 0}, -- it will be for the first car dealer here vehicle x, y, z, roty camera x, y, z, rotx, roty, rotz
{-182003, -33028, 1145, 0, -181156, -33304, 1145, 0, 135, 0},
}
weapons_shops = {
{206125,193455,1354,180,205961,193065,1462, -90, 0, 0}, -- npc x, y, z, heading weapon_showcase x, y, z, rotx, roty, rotz
{-181997,-41340,1160,0,-181865,-40977,1268, -90, 180, 0},
}
racing_objects = {
{122498, 108730, 2422}, -- this will be to start race 1, x, y, z
{-90958, 39844, 4701},
{196249, 179529, 1304},
{123925, 82024, 1564},
{214192, 99924, 1469},
{-73275, 82465, 2192},
{175904, 157777, 4814},
{195924, 8647, 5678},
{180693, -52970, 1586},
{68536, 184122, 615},
{152094, 218657, 357},
{100200, -13244, 1247},
{100800, -35249, 1301},
{141254, -110083, 1239},
}
grocery_npcs = {
{171343, 203854, 1410, 180, 171092, 203854, 1410}, -- x, y, z, h, heist money loc x, y, z
{42696, 137887, 1578, 0, 42901, 137887, 1578},
{-15370, -2762, 2062, 110, -15448, -2571, 2062},
{128775, 77621, 1573, 90, 128775, 77839, 1574},
{-169052, -39452, 1146, 50, -168900, -39285, 1146},
}
specials_vehicles_stores = {
{
npc = {146579, 179977, 1441, 180}, -- x, y, z, h
vehicle_show_pos = {148264, 178912, 1529},
vehicle_show_rot = 180,
},
{
npc = {34247, 209164, 545, -90},
vehicle_show_pos = {32140, 209637, 545},
vehicle_show_rot = -90,
},
{
npc = {147656, -135895, 1246, -20},
vehicle_show_pos = {144875, -135689, 1251},
vehicle_show_rot = -20,
},
{
npc = {169149, -150632, 1247, 70},
vehicle_show_pos = {168528, -152166, 1313},
vehicle_show_rot = 160,
},
}
duels_locations = {
{{174801, 182972, 1960, -180}, {168772, 185192, 1950, -90}}, -- player 1 loc, player 2 loc
{{172588, 195556, 1356, 0}, {173427, 190317, 1354, 0}},
{{164396, 198961, 410, 180}, {147883, 198961, 410, 0}},
{{158881, 226845, 850, 10}, {171093, 227171, 800, -175}},
{{191546, 194566, 13400, -90}, {191546, 191063, 13400, 90}},
{{135733, 190753, 1340, 180}, {133227, 193779, 1340, 0}},
{{130104, 203778, 1330, 0}, {143825, 206676, 1340, 180}},
{{59047, 199851, 580, 0}, {58978, 187903, 600, 0}},
{{45863, 145111, 1450, 0}, {37673, 144256, 1450, 90}},
{{-20350, -30557, 2250, -25}, {-15562, -31957, 2250, 155}},
{{-71481, 23526, 4750, 65}, {-92495, 37439, 4750, -115}},
{{-170798, 84210, 1575, 90}, {-181151, 83682, 1575, 90}},
}
Default_friends_settings = '[{"settingid": 1, "setting": 2}]'
Friend_Settings = {
{
"Vehicle Access",
{
"Access of your vehicles to everyone",
"Access of your vehicles to you and your friends",
"Access of your vehicles to you"
}
},
}
Appartments = {
{
Entrance = {200746, 198356, 1295},
Appartment_path = "/Game/Geometry/Prefabs/PF_Apartment_01b",
Appartment_loc = {200755, 200150, 7100},
Appartment_rot = {0, 180, 0},
Appartment_tp = {200918, 200779, 7196, 90},
Appartment_exit = {200789, 200278, 7195},
Appartment_exit_tp = {201657, 197531, 1380, -90},
Price = 100000,
Heist_Trigger = {200915, 201040, 7195},
},
}
Police_cars_spawns = {
{
{173088, 191359, 1322}, -- trigger x, y, z
{172501, 190751, 1322, 0} -- car spawn x, y, z, h
},
{
{172592, 193905, 1322},
{173165, 193711, 1322, 90}
},
}
Onset_Customs = {
{
{139763, 207134, 140144, 208229, 1289}, -- zone minx, miny, maxx, maxy, z
{140314, 208350, 1289, -90}, -- vehicle x, y, z, h
{139934, 207563, 1330, 60}, -- cam x, y, z, h
{141519, 206303, 1289, 0}, -- exit x, y, z, h
},
{
{22758, 134529, 23231, 136065, 1552}, -- zone minx, miny, maxx, maxy, z
{22119, 134887, 1553, 0}, -- vehicle x, y, z, h
{22649, 135046, 1594, -164}, -- cam x, y, z, h
{23127, 137102, 1552, 90}, -- exit x, y, z, h
},
}
Hats_Objects = {
398, -- from
477 -- to
}
Hats_Stores = {
{
{181339, 186803, 1299, -130}, -- npc x, y, z, h
{180906, 186492, 1299, 90}, -- player teleport x, y, z, h
},
}
_Training = { -- You shouldn't add more Training locations yourself
{
npc = {-14486, 135909, 1559, 0}, -- npc x, y, z, h
shooting_range_location = {-14473, 135666, 1558, -175}, -- shooting range teleport player x, y, z, h
CQB_spawn_location = {-13708, 135450, 1558, -70},
CQB_targets_locations = {
{-13535, 134097},
{-14048, 132851},
{-14218, 132898},
{-14252, 133255},
{-14777, 132768},
{-15408, 132895},
{-14373, 134063},
{-14374, 134357},
{-15327, 134990},
{-15023, 135016},
},
CQB_Objects = {
{1, -14180, 135230, 1621, 0, 5, 0, 3.18, 1, 3.23}, -- modelid, x, y, z, rx, ry, rz, sx, sy, sz
},
CQB_end_trigger = {-14495, 135313, 1558},
},
}
_Animations = {
"STOP",
"COMBINE",
"PICKUP_LOWER",
"PICKUP_MIDDLE",
"PICKUP_UPPER",
"HANDSHEAD_KNEEL",
"HANDSHEAD_STAND",
"HANDSUP_KNEEL",
"HANDSUP_STAND",
"ENTERCODE",
"VOMIT",
"CROSSARMS",
"DABSAREGAY",
"DONTKNOW",
"DUSTOFF",
"FACEPALM",
"IDONTLISTEN",
"FLEXX",
"HALTSTOP",
"INEAR_COMM",
"ITSJUSTRIGHT",
"FALLONKNEES",
"KUNGFU",
"CALLME",
"SALUTE",
"SHOOSH",
"SLAPOWNASS",
"SLAPOWNASS2",
"THROATSLIT",
"THUMBSUP",
"WAVE3",
"WIPEOFFSWEAT",
"KICKDOOR",
"LOCKDOOR",
"CRAZYMAN",
"DARKSOULS",
"SMOKING",
"CLAP",
"SIT01",
"SIT02",
"SIT03",
"SIT04",
"SIT05",
"SIT06",
"SIT07",
"LAY01",
"LAY02",
"LAY03",
"LAY04",
"LAY05",
"LAY06",
"LAY07",
"LAY08",
"LAY09",
"LAY10",
"LAY11",
"LAY12",
"LAY13",
"LAY14",
"LAY15",
"LAY16",
"LAY17",
"LAY18",
"WAVE",
"WAVE2",
"STRETCH",
"BOW",
"CALL_GUARDS",
"CALL_SOMEONE",
"CALL_SOMEONE2",
"CHECK_EQUIPMENT",
"CHECK_EQUIPMENT2",
"CHECK_EQUIPMENT3",
"CLAP2",
"CLAP3",
"CHEER",
"DRUNK",
"FIX_STUFF",
"GET_HERE",
"GET_HERE2",
"GOAWAY",
"LAUGH",
"SALUTE2",
"THINKING",
"THROW",
"TRIUMPH",
"WASH_WINDOWS",
"WATCHING",
"DANCE01",
"DANCE02",
"DANCE03",
"DANCE04",
"DANCE05",
"DANCE06",
"DANCE07",
"DANCE08",
"DANCE09",
"DANCE10",
"DANCE11",
"DANCE12",
"DANCE13",
"DANCE14",
"DANCE15",
"DANCE16",
"DANCE17",
"DANCE18",
"DANCE19",
"DANCE20",
"CUFF",
"CUFF2",
"REVIVE",
"PICKAXE_SWING",
"CROSSARMS2",
"BARCLEAN01",
"BARCLEAN02",
"PHONE_PUTAWAY",
"PHONE_TAKEOUT",
"PHONE_TALKING01",
"PHONE_TALKING02",
"PHONE_TALKING03",
"DRINKING",
"SHRUG",
"SMOKING01",
"SMOKING02",
"SMOKING03",
"THINKING01",
"WALLLEAN01",
"WALLLEAN02",
"WALLLEAN03",
"WALLLEAN04",
"YAWN",
"FISHING",
"PHONE_TAKEOUT_HOLD",
"PHONE_HOLD",
"SHOUT01",
"CART_IDLE",
"CARRY_IDLE",
"CARRY_SETDOWN",
"CARRY_SHOULDER_IDLE",
"CARRY_SHOULDER_SETDOWN",
"HANDSHAKE",
"PUSHUP_START",
"PUSHUP_IDLE",
"PUSHUP_END",
"SLAP01",
"SLAP01_REACT",
"DANCE21",
"DANCE22",
"DANCE23",
"DANCE24",
"DANCE25",
"DANCE26",
"DANCE27",
"DANCE28",
"DANCE29",
"DANCE30",
"DANCE31",
"DANCE32",
"DANCE33",
"DANCE34",
"DANCE35",
"DANCE36",
"DANCE37",
"DANCE38",
"DANCE39",
"DANCE40",
}
--------------------------------------------------------------------------------------------------
-- HEIST CONFIG
robbers_invincible_from_no_police_players = true
no_kill_bonus_after_kills = 20 -- Kill bonus won't be given if there is too much police kills
heist_phases = {
{
type = "GET_VEHICLE",
vehicle = 14,
vehpos = {162785, -161888, 1243, 70}, -- veh x, y, z, h
vehpos_after = {204235, 200428, 1304, -90}, -- where to put vehicle and spawn for final phase
veh_armor_percentage = 50, -- damage of 75 % here
kill_bonus_robber = 1000,
veh_pos_str = "military", -- used for the police alert
},
}
heist_final_phase = {
use_vehicle_of_phase = 1,
bank_enter_trigger = {191330, 198219, 1306, -90},
bank_exit_trigger = {189857, 201556, 810, 180},
objects = {
{1475, 184692, 202579, 55, 0, 90, 0, 1, 1, 1},
{1475, 184392, 202579, 55, 0, 90, 0, 1, 1, 1},
{1475, 184092, 202579, 55, 0, 90, 0, 1, 1, 1},
{1475, 183873, 202901, 55, 0, 0, 0, 1, 1, 1},
{1475, 184092, 203167, 55, 0, -90, 0, 1, 1, 1},
{1475, 184392, 203167, 55, 0, -90, 0, 1, 1, 1},
{1475, 184692, 203167, 55, 0, -90, 0, 1, 1, 1},
},
boat = {-229580, 24338, 5, 180}, -- x, y, z, heading
boat_zone = {-228968, 22582, -227975, 23746, 150}, -- minx, miny, maxx, maxy, z
police_players_required = 2,
money_won_max_per_player = 100000,
money_taken_per_action = 25000,
waypoint_loc = {184392, 202901, 155},
vector_push_boat = {-30000, 0, 0},
kill_bonus_robber = 2000,
}
----------------------------------------------------------------------------------------------------------
-- BUNKERS CONFIG
_Bunkers_raw_materials_steal_locations = {
{988, 146650, -137699, 1151, "military"}, -- pickup modelid, x, y, z, location text for police alert
{988, 165472, -157689, 1166, "military"},
}
_Bunker_SellWeapons = {
final_zone = {-59570, 150971, -56966, 151608, 170}, -- minx, miny, maxx, maxy, z
}
_Bunkers = {
{
Bunker_price = 100000,
Bunker_enter_location = {46389, 48157, 3058}, -- x, y, z
Bunker_spawn_after_exit = {46336, 48427, 3022, 100}, -- x, y, z, h
Bunker_spawn_after_enter = {46060, 48150, 2263, 180}, -- x, y, z, h
Bunker_exit_location = {46410, 48154, 2263}, -- x, y, z
Bunker_NPC_Waiting = {"SIT04", 45774.98828125, 48310, 2263, -90}, -- anim, x, y, z, h
Bunker_NPC_Working = {"BARCLEAN01", 45957, 48283, 2263, 90}, -- anim, x, y, z, h
Bunker_progress_text3d_location = {45621, 48189, 2263}, -- x, y, z
Bunker_Interval_To_Add_1_percent_s = 36,
Raw_materials_steal_add_percent = 25, -- add ... percent of raw mats in storage when stealing raw mats
Full_Raw_Materials_price = 20000,
Bunker_Full_Sell_Money = 25000,
Bunker_Working_Objects = {
{13, 45942.2421875, 48348.53515625, 2261.4875488281, 90, -90, 0, 1, 1, 1}, -- modelid, x, y, z, rx, ry, rz, sx, sy, sz
{986, 45872.5625, 48373.30859375, 2259.9440917969, 0, 24.249610900879, 0, 0.45, 0.8, 0.4},
{987, 45985.64453125, 48397.296875, 2259.8813476, 0, -5.3097558021545, 0, 0.45, 0.8, 0.4},
{13, 45851.50390625, 48386.36328125, 2270.4096679, 0, -65, 0, 1, 1, 1},
{13, 45853.98046875, 48380.5234375, 2270.4096679, 0, -65, 0, 1, 1, 1},
},
Bunker_Objects = {
{952, 45774.98828125, 48351.9296875, 2167.8408203125, 0, 0, 0, 1, 1, 1}, -- modelid, x, y, z, rx, ry, rz, sx, sy, sz
{542, 45927.7578125, 48361.359375, 2167.8408203125, 0, 0, 0, 1, 1, 1},
},
Bunker_Percentage_Objects = {
{
p = 10,
objects = {
{985, 45362.421875, 48311.69921875, 2348.951171875, 0, 0, 0, 0.45, 0.8, 0.4},
{985, 45247.25, 48311.69921875, 2348.951171875, 0, 0, 0, 0.45, 0.8, 0.4},
}
},
{
p = 20,
objects = {
{985, 45210.5625, 48239.4453125, 2167.8408203125, 0, 0, 0, 0.45, 0.8, 0.4},
{985, 45307.76953125, 48239.4453125, 2167.8408203125, 0, 0, 0, 0.45, 0.8, 0.4},
}
},
{
p = 30,
objects = {
{985, 45405.15234375, 48239.4453125, 2167.8408203125, 0, 0, 0, 0.45, 0.8, 0.4},
{985, 45210.5625, 48239.4453125, 2192.0764160156, 0, 0, 0, 0.45, 0.8, 0.4}, -- z dist = 24.2355957031
}
},
{
p = 40,
objects = {
{985, 45307.76953125, 48239.4453125, 2192.0764160156, 0, 0, 0, 0.45, 0.8, 0.4},
{985, 45405.15234375, 48239.4453125, 2192.0764160156, 0, 0, 0, 0.45, 0.8, 0.4},
}
},
{
p = 50,
objects = {
{985, 45210.5625, 48239.4453125, 2216.31201172, 0, 0, 0, 0.45, 0.8, 0.4},
{985, 45307.76953125, 48239.4453125, 2216.31201172, 0, 0, 0, 0.45, 0.8, 0.4},
}
},
{
p = 60,
objects = {
{985, 45405.15234375, 48239.4453125, 2216.31201172, 0, 0, 0, 0.45, 0.8, 0.4},
{985, 45210.5625, 48239.4453125, 2240.54760742, 0, 0, 0, 0.45, 0.8, 0.4},
}
},
{
p = 70,
objects = {
{985, 45307.76953125, 48239.4453125, 2240.54760742, 0, 0, 0, 0.45, 0.8, 0.4},
{985, 45405.15234375, 48239.4453125, 2240.54760742, 0, 0, 0, 0.45, 0.8, 0.4},
}
},
{
p = 80,
objects = {
{985, 45210.5625, 48239.4453125, 2264.78320312, 0, 0, 0, 0.45, 0.8, 0.4},
{985, 45307.76953125, 48239.4453125, 2264.78320312, 0, 0, 0, 0.45, 0.8, 0.4},
}
},
{
p = 90,
objects = {
{985, 45405.15234375, 48239.4453125, 2264.78320312, 0, 0, 0, 0.45, 0.8, 0.4},
{985, 45210.5625, 48239.4453125, 2289.01879882, 0, 0, 0, 0.45, 0.8, 0.4},
}
},
{
p = 100,
objects = {
{985, 45307.76953125, 48239.4453125, 2289.01879882, 0, 0, 0, 0.45, 0.8, 0.4},
{985, 45405.15234375, 48239.4453125, 2289.01879882, 0, 0, 0, 0.45, 0.8, 0.4},
}
},
},
},
}
----------------------------------------------------------------------------------------------------
-- CLOTHES CONFIG
Clothing_presets_clothes = {
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
14,
15,
16,
17,
18,
19,
20,
25,
26,
27,
28,
29,
}
Advanced_clothing_presets = {
male = {
{
clothes = {
body = {"/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal01_LPR", false, false, false, {"/Game/CharacterModels/Materials/HZN_Materials/M_HZN_Body_NoShoesLegsTorso", 3}},
clothing0 = {"/Game/CharacterModels/BikerSuit/Meshes/SK_BikerSuit"},
},
},
{
clothes = {
body = {"/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal01_LPR", false, false, false, {"/Game/CharacterModels/Materials/HZN_Materials/M_HZN_Body_NoShoesLegsTorso", 3}},
clothing0 = {"/Game/CharacterModels/BikerSuit/Meshes/SK_BikerSuit"},
clothing1 = {"/Game/CharacterModels/BikerSuit/Meshes/SK_BikerHelmet"},
},
},
},
female = {
},
}
Clothing_bodies = {
male = {
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal01_LPR",
hair = true,
body_mask_slot = 3,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal02_LPR",
body_mask_slot = 3,
hair = true
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal03_LPR",
body_mask_slot = 3,
hair = true
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal04_LPR",
body_mask_slot = 0,
hair = true
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal05_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal06_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal07_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal08_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal09_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal10_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal11_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal12_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal13_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal14_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal15_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal16_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal17_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal18_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal19_LPR",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/SkeletalMesh/BodyMerged/HZN_CH3D_Normal20_LPR",
body_mask_slot = 0,
},
},
female = {
{
path = "/Game/CharacterModels/Female/Meshes/SK_Female01",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/Female/Meshes/SK_Female02",
body_mask_slot = 0,
},
{
path = "/Game/CharacterModels/Female/Meshes/SK_Female03",
body_mask_slot = 0,
},
}
}
Clothing_hairs = {
male = {
"/Game/CharacterModels/SkeletalMesh/SK_Hair01",
"/Game/CharacterModels/SkeletalMesh/SK_Hair02",
"/Game/CharacterModels/SkeletalMesh/SK_Hair03",
"/Game/CharacterModels/SkeletalMesh/SK_Hair04",
"/Game/CharacterModels/SkeletalMesh/SK_Hair05",
"/Game/CharacterModels/SkeletalMesh/SK_Hair06",
"/Game/CharacterModels/SkeletalMesh/SK_Hair07",
"/Game/CharacterModels/SkeletalMesh/SK_Hair08",
"/Game/CharacterModels/SkeletalMesh/SK_Hair09",
"/Game/CharacterModels/SkeletalMesh/SK_Hair10",
"/Game/CharacterModels/SkeletalMesh/SK_Hair11",
"/Game/CharacterModels/SkeletalMesh/SK_Hair12",
"/Game/CharacterModels/SkeletalMesh/SK_Hair13",
"/Game/CharacterModels/SkeletalMesh/SK_Hair14",
"/Game/CharacterModels/SkeletalMesh/SK_Hair15",
"/Game/CharacterModels/SkeletalMesh/SK_Hair16",
"/Game/CharacterModels/SkeletalMesh/SK_Hair17",
"/Game/CharacterModels/SkeletalMesh/SK_Hair18",
},
female = {
"/Game/CharacterModels/Female/Meshes/SK_Hair01",
"/Game/CharacterModels/Female/Meshes/SK_Hair02",
"/Game/CharacterModels/Female/Meshes/SK_Hair03",
}
}
Clothing_torso = {
male = {
{"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_TShirt_LPR", true},
{"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_TShirt_Knitted_LPR", true},
{"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_TShirt_Knitted2_LPR", true},
{"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_Shirt_LPR", true},
{"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_FormalShirt_LPR", true},
{"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_FormalShirt2_LPR", true},
{"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Knitted_Shirt_LPR", true},
{"/Game/CharacterModels/Clothing/Meshes/SK_Undershirt01"},
{"/Game/CharacterModels/Clothing/Meshes/SK_TShirt01", true},
{"/Game/CharacterModels/Clothing/Meshes/SK_ShirtCombo01", true}, --path, can't put jacket
{"/Game/CharacterModels/Clothing/Meshes/SK_Pullover", true},
},
female = {
{"/Game/CharacterModels/Female/Meshes/SK_Undershirt01"},
{"/Game/CharacterModels/Female/Meshes/SK_TShirt02", true},
{"/Game/CharacterModels/Female/Meshes/SK_TShirt01", true},
{"/Game/CharacterModels/Female/Meshes/SK_ShirtCombo01", true},
{"/Game/CharacterModels/Female/Meshes/SK_Pullover01", true},
{"/Game/CharacterModels/Female/Meshes/HZN_Outfit_Piece_Shirt_LPR", true},
{"/Game/CharacterModels/Female/Meshes/HZN_Outfit_Piece_FormalShirt_LPR", true},
{"/Game/CharacterModels/Female/Meshes/SK_Jacket02", true},
{"/Game/CharacterModels/Female/Meshes/SK_Jacket01", true},
}
}
Clothing_jackets = {
male = {
"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_Labcoat_LPR",
"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_FormalJacket_LPR",
},
female = {
"/Game/CharacterModels/Female/Meshes/HZN_Outfit_Piece_FormalJacket_LPR",
"/Game/CharacterModels/Female/Meshes/HZN_Outfit_Piece_Labcoat_LPR",
}
}
Clothing_pants = {
male = {
{"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_FormalPants_LPR", true}, -- hide legs
{"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_DenimPants_LPR", true},
{"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_CargoPants_LPR", true},
{"/Game/CharacterModels/Clothing/Meshes/SK_Shorts01"},
{"/Game/CharacterModels/Clothing/Meshes/SK_Jeans01", true},
},
female = {
{"/Game/CharacterModels/Female/Meshes/SK_Shorts01"},
{"/Game/CharacterModels/Female/Meshes/SK_Pants02", true},
{"/Game/CharacterModels/Female/Meshes/SK_Pants01", true},
{"/Game/CharacterModels/Female/Meshes/SK_Jeans01", true},
{"/Game/CharacterModels/Female/Meshes/HZN_Outfit_Piece_FormalPants_LPR", true},
{"/Game/CharacterModels/Female/Meshes/HZN_Outfit_Piece_DenimPants_LPR", true},
{"/Game/CharacterModels/Female/Meshes/HZN_Outfit_Piece_CargoPants_LPR", true},
},
}
Clothing_shoes = {
male = {
"/Game/CharacterModels/Clothing/Meshes/SK_Shoes01",
"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_NormalShoes_LPR",
"/Game/CharacterModels/SkeletalMesh/Outfits/HZN_Outfit_Piece_BusinessShoes_LPR"
},
female = {
"/Game/CharacterModels/Female/Meshes/SK_Shoes01",
"/Game/CharacterModels/Female/Meshes/SK_Shoes03",
"/Game/CharacterModels/Female/Meshes/SK_Shoes04",
"/Game/CharacterModels/Female/Meshes/SK_Shoes05",
"/Game/CharacterModels/Female/Meshes/SK_Shoes06",
}
}
Body_materials = { -- Don't modify this
male = {
full = "/Game/CharacterModels/Materials/HZN_Materials/M_HZN_Body", -- /Game/CharacterModels/Materials/HZN_Materials/M_HZN_Body_NoClothes
nolegs = "/Game/CharacterModels/Materials/HZN_Materials/M_HZN_Body_NoLegs",
noshoes = "/Game/CharacterModels/Materials/HZN_Materials/M_HZN_Body_NoShoes",
noshoeslegs = "/Game/CharacterModels/Materials/HZN_Materials/M_HZN_Body_NoShoesLegs",
noshoeslegstorso = "/Game/CharacterModels/Materials/HZN_Materials/M_HZN_Body_NoShoesLegsTorso",
notorso = "/Game/CharacterModels/Materials/HZN_Materials/M_HZN_Body_NoTorso",
},
female = {
full = "/Game/CharacterModels/Female/Materials/Skins/MI_BodySkin", -- /Game/CharacterModels/Female/Materials/Skins/MI_Body_NoClothes
nolegs = "/Game/CharacterModels/Female/Materials/Skins/MI_Body_NoLegs",
noshoeslegs = "/Game/CharacterModels/Female/Materials/Skins/MI_Body_NoShoes", -- /Game/CharacterModels/Female/Materials/Skins/MI_Body_NoShoesLegs
noshoeslegstorso = "/Game/CharacterModels/Female/Materials/Skins/MI_Body_NoShoesLegs", -- /Game/CharacterModels/Female/Materials/Skins/MI_Body_NoShoesLegsTorso
}
}
|
workspace "PrevEngine"
startproject "Sandbox"
architecture "x64"
configurations {
"Debug",
"Release",
"Distribute"
}
outputDir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}/"
IncludeDir = {}
IncludeDir["GLAD"] = "PrevEngine/vendor/GLAD/include"
IncludeDir["ImGui"] = "PrevEngine/vendor/ImGui"
IncludeDir["glm"] = "PrevEngine/vendor/glm/glm"
IncludeDir["Box2D"] = "PrevEngine/vendor/Box2D"
IncludeDir["stb"] = "PrevEngine/vendor/stb"
include "PrevEngine/vendor/GLAD"
include "PrevEngine/vendor/ImGui"
include "PrevEngine/vendor/Box2D"
include "PrevEngine/vendor/stb"
include "PrevEngine/vendor/glm"
-- Used by both
IncludeDir["entityx"] = "PrevEngine/vendor/entityx"
include "PrevEngine/vendor/entityx"
IncludeDir["lua"] = "Sandbox/vendor/lua"
include "Sandbox/vendor/lua"
--[[
Rendering API supported | renderingAPI
---------------------------------------
DirectX | PV_RENDERING_API_DIRECTX // currently not supported
OpenGL | PV_RENDERING_API_OPENGL
]]--
renderingAPI = "PV_RENDERING_API_OPENGL"
if (renderingAPI ~= "PV_RENDERING_API_OPENGL") then
io.write("Only OpenGL supported. Use renderingAPI = \"PV_RENDERING_API_OPENGL\"")
end
--[[
Platform supported | platform
----------------------------------
Window | PV_PLATFORM_WINDOWS
]]--
platform = "PV_PLATFORM_WINDOWS"
--[[
Windowing API supprted | windowingAPI
--------------------------------------
Win32 | PV_WINDOWING_API_WIN32 -- Dosen't support imgui viewport and can be only used if PV_PLATFORM_WINDOWS
GLFW | PV_WINDOWING_API_GLFW -- Cross platform and support imgui viewport
]]--
windowingAPI = "PV_WINDOWING_API_GLFW"
if (windowingAPI == "PV_WINDOWING_API_GLFW") then
IncludeDir["glfw"] = "PrevEngine/vendor/glfw/include"
include "PrevEngine/vendor/glfw"
end
project "PrevEngine"
location "PrevEngine"
kind "StaticLib"
language "C++"
targetdir ("bin/" .. outputDir .. "%{prj.name}")
objdir ("bin-int/" .. outputDir .. "%{prj.name}")
files {
"%{prj.name}/src/**.h",
"%{prj.name}/src/**.cpp"
}
if (windowingAPI == "PV_WINDOWING_API_GLFW") then
removefiles {
"%{prj.name}/src/platform/windows/windowswindow.cpp",
"%{prj.name}/src/platform/windows/windowswindow.h",
"%{prj.name}/src/platform/windows/imguiwindowsinit.cpp",
"%{prj.name}/src/platform/windows/imguiwindowsinit.h",
}
links {
"GLFW"
}
includedirs {
"%{IncludeDir.glfw}",
}
else
removefiles {
"%{prj.name}/src/platform/glfw/**.*",
}
end
includedirs {
"%{prj.name}/src",
"%{IncludeDir.GLAD}",
"%{IncludeDir.ImGui}",
"%{IncludeDir.glm}",
"%{IncludeDir.entityx}",
"%{IncludeDir.Box2D}",
"%{IncludeDir.lua}",
"%{IncludeDir.stb}"
}
links {
"GLAD",
"ImGui",
"entityx",
"Box2D",
"lua"
}
filter "system:windows"
cppdialect "C++17"
staticruntime "On"
systemversion "latest"
defines {
platform,
renderingAPI,
windowingAPI,
"PV_BUILD_LIB",
"PV_ENABLE_ASSERTS",
"_CRT_SECURE_NO_WARNINGS"
}
removefiles {
"%{prj.name}/src/platform/linux/*",
}
pchheader "pch.h"
filter "action:vs*"
pchsource "PrevEngine/src/pch.cpp"
filter "configurations:Debug"
defines {"PV_DEBUG"}
symbols "On"
filter "configurations:Release"
defines {"PV_RELEASE"}
optimize "On"
filter "configurations:Distribute"
defines {"PV_DIST"}
optimize "On"
project "Sandbox"
location "Sandbox"
kind "ConsoleApp"
language "C++"
targetdir ("bin/" .. outputDir .. "%{prj.name}")
objdir ("bin-int/" .. outputDir .. "%{prj.name}")
files {
"%{prj.name}/src/**.h",
"%{prj.name}/src/**.cpp",
}
includedirs {
"PrevEngine/src",
"%{prj.name}/src",
"%{IncludeDir.glm}",
"%{IncludeDir.entityx}",
"%{IncludeDir.Box2D}",
"%{IncludeDir.lua}"
}
links {
"PrevEngine"
}
filter "system:windows"
cppdialect "C++17"
staticruntime "On"
systemversion "latest"
defines {
platform,
windowingAPI,
"_CRT_SECURE_NO_WARNINGS"
}
pchheader "pch.h"
filter "action:vs*"
pchsource "Sandbox/src/pch.cpp"
filter "configurations:Debug"
defines {"PV_DEBGU"}
symbols "On"
filter "configurations:Release"
defines {"PV_RELEASE"}
optimize "On"
filter "configurations:Distribute"
defines {"PV_DIST"}
optimize "On"
|
--时穿剑·鸳鸯剑
local m=14000007
local cm=_G["c"..m]
function cm.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,nil,2,2,cm.lcheck)
c:EnableReviveLimit()
--direct attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DIRECT_ATTACK)
e1:SetCondition(cm.dircon)
c:RegisterEffect(e1)
--battle damage to effect damage
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_BATTLE_DAMAGE_TO_EFFECT)
c:RegisterEffect(e2)
--actlimit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(0,1)
e3:SetValue(cm.aclimit)
e3:SetCondition(cm.actcon)
c:RegisterEffect(e3)
--active
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(m,0))
e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e4:SetCode(EVENT_DAMAGE)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetTarget(cm.atktg)
e4:SetCondition(cm.atkcon)
e4:SetOperation(cm.atkop)
c:RegisterEffect(e4)
end
function cm.lcheck(g,lc)
return g:GetClassCount(Card.GetCode)==g:GetCount()
end
function cm.sfilter(c,e,tp,tc)
return c:IsSetCard(0x1404) and c:IsAbleToHand() and not c:IsCode(tc:GetCode())
end
function cm.dircon(e)
return e:GetHandler():GetColumnGroupCount()==0
end
function cm.aclimit(e,re,tp)
return not re:GetHandler():IsImmuneToEffect(e)
end
function cm.actcon(e)
return Duel.GetAttacker()==e:GetHandler() or Duel.GetAttackTarget()==e:GetHandler()
end
function cm.atkcon(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp and bit.band(r,REASON_EFFECT)~=0 and re:GetHandler():IsSetCard(0x1404)
end
function cm.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function cm.atkop(e,tp,eg,ep,ev,re,r,rp)
local tc=re:GetHandler()
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE)
local s=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,0)
local nseq=math.log(s,2)
if Duel.MoveSequence(c,nseq) and Duel.IsExistingMatchingCard(cm.sfilter,tp,LOCATION_DECK,0,1,nil,e,tp,tc) then return true end
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,cm.sfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,tc)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
|
--------------------------------
-- @module Widget
-- @extend ProtectedNode,LayoutParameterProtocol
-- @parent_module ccui
--------------------------------
-- Changes the percent that is widget's percent size<br>
-- param percent that is widget's percent size
-- @function [parent=#Widget] setSizePercent
-- @param self
-- @param #vec2_table percent
--------------------------------
--
-- @function [parent=#Widget] getCustomSize
-- @param self
-- @return size_table#size_table ret (return value: size_table)
--------------------------------
--
-- @function [parent=#Widget] getLeftBoundary
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- Sets whether the widget should be flipped horizontally or not.<br>
-- param bFlippedX true if the widget should be flipped horizaontally, false otherwise.
-- @function [parent=#Widget] setFlippedX
-- @param self
-- @param #bool flippedX
--------------------------------
-- Gets the Virtual Renderer of widget.<br>
-- For example, a button's Virtual Renderer is it's texture renderer.<br>
-- return Node pointer.
-- @function [parent=#Widget] getVirtualRenderer
-- @param self
-- @return Node#Node ret (return value: cc.Node)
--------------------------------
-- brief Allow widget touch events to propagate to its parents. Set false will disable propagation<br>
-- since v3.3
-- @function [parent=#Widget] setPropagateTouchEvents
-- @param self
-- @param #bool isPropagate
--------------------------------
-- Returns size percent of widget<br>
-- return size percent
-- @function [parent=#Widget] getSizePercent
-- @param self
-- @return vec2_table#vec2_table ret (return value: vec2_table)
--------------------------------
-- Set the percent(x,y) of the widget in OpenGL coordinates<br>
-- param percent The percent (x,y) of the widget in OpenGL coordinates
-- @function [parent=#Widget] setPositionPercent
-- @param self
-- @param #vec2_table percent
--------------------------------
-- brief Specify widget to swallow touches or not<br>
-- since v3.3
-- @function [parent=#Widget] setSwallowTouches
-- @param self
-- @param #bool swallow
--------------------------------
--
-- @function [parent=#Widget] getLayoutSize
-- @param self
-- @return size_table#size_table ret (return value: size_table)
--------------------------------
-- Sets whether the widget is hilighted<br>
-- The default value is false, a widget is default to not hilighted<br>
-- param hilight true if the widget is hilighted, false if the widget is not hilighted.
-- @function [parent=#Widget] setHighlighted
-- @param self
-- @param #bool hilight
--------------------------------
-- Changes the position type of the widget<br>
-- see PositionType<br>
-- param type the position type of widget
-- @function [parent=#Widget] setPositionType
-- @param self
-- @param #int type
--------------------------------
-- Query whether the widget ignores user deinfed content size or not<br>
-- return bool
-- @function [parent=#Widget] isIgnoreContentAdaptWithSize
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#Widget] getVirtualRendererSize
-- @param self
-- @return size_table#size_table ret (return value: size_table)
--------------------------------
-- Determines if the widget is highlighted<br>
-- return true if the widget is highlighted, false if the widget is not hignlighted .
-- @function [parent=#Widget] isHighlighted
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Gets LayoutParameter of widget.<br>
-- see LayoutParameter<br>
-- param type Relative or Linear<br>
-- return LayoutParameter
-- @function [parent=#Widget] getLayoutParameter
-- @param self
-- @return LayoutParameter#LayoutParameter ret (return value: ccui.LayoutParameter)
--------------------------------
-- Checks a point if is in widget's space<br>
-- param point<br>
-- return true if the point is in widget's space, flase otherwise.
-- @function [parent=#Widget] hitTest
-- @param self
-- @param #vec2_table pt
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Gets the position type of the widget<br>
-- see PositionType<br>
-- return type the position type of widget
-- @function [parent=#Widget] getPositionType
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
--
-- @function [parent=#Widget] getTopBoundary
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- Note: when you set _ignoreSize to true, no matther you call setContentSize or not, <br>
-- the widget size is always equal to the return value of the member function getVirtualRendererSize.<br>
-- param ignore, set member variabl _ignoreSize to ignore
-- @function [parent=#Widget] ignoreContentAdaptWithSize
-- @param self
-- @param #bool ignore
--------------------------------
-- When a widget is in a layout, you could call this method to get the next focused widget within a specified direction. <br>
-- If the widget is not in a layout, it will return itself<br>
-- param dir the direction to look for the next focused widget in a layout<br>
-- param current the current focused widget<br>
-- return the next focused widget in a layout
-- @function [parent=#Widget] findNextFocusedWidget
-- @param self
-- @param #int direction
-- @param #ccui.Widget current
-- @return Widget#Widget ret (return value: ccui.Widget)
--------------------------------
-- Determines if the widget is enabled<br>
-- return true if the widget is enabled, false if the widget is disabled.
-- @function [parent=#Widget] isEnabled
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- return whether the widget is focused or not
-- @function [parent=#Widget] isFocused
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#Widget] getTouchBeganPosition
-- @param self
-- @return vec2_table#vec2_table ret (return value: vec2_table)
--------------------------------
-- Determines if the widget is touch enabled<br>
-- return true if the widget is touch enabled, false if the widget is touch disabled.
-- @function [parent=#Widget] isTouchEnabled
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#Widget] getActionTag
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
-- Gets world position of widget.<br>
-- return world position of widget.
-- @function [parent=#Widget] getWorldPosition
-- @param self
-- @return vec2_table#vec2_table ret (return value: vec2_table)
--------------------------------
-- return true represent the widget could accept focus, false represent the widget couldn't accept focus
-- @function [parent=#Widget] isFocusEnabled
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- param focus pass true to let the widget get focus or pass false to let the widget lose focus<br>
-- return void
-- @function [parent=#Widget] setFocused
-- @param self
-- @param #bool focus
--------------------------------
--
-- @function [parent=#Widget] setActionTag
-- @param self
-- @param #int tag
--------------------------------
-- Sets whether the widget is touch enabled<br>
-- The default value is false, a widget is default to touch disabled<br>
-- param visible true if the widget is touch enabled, false if the widget is touch disabled.
-- @function [parent=#Widget] setTouchEnabled
-- @param self
-- @param #bool enabled
--------------------------------
-- Sets whether the widget should be flipped vertically or not.<br>
-- param bFlippedY true if the widget should be flipped vertically, flase otherwise.
-- @function [parent=#Widget] setFlippedY
-- @param self
-- @param #bool flippedY
--------------------------------
-- Sets whether the widget is enabled<br>
-- true if the widget is enabled, widget may be touched , false if the widget is disabled, widget cannot be touched.<br>
-- The default value is true, a widget is default to enabled<br>
-- param enabled
-- @function [parent=#Widget] setEnabled
-- @param self
-- @param #bool enabled
--------------------------------
--
-- @function [parent=#Widget] getRightBoundary
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- To set the bright style of widget.<br>
-- see BrightStyle<br>
-- param style BrightStyle::NORMAL means the widget is in normal state, BrightStyle::HIGHLIGHT means the widget is in highlight state.
-- @function [parent=#Widget] setBrightStyle
-- @param self
-- @param #int style
--------------------------------
-- Sets a LayoutParameter to widget.<br>
-- see LayoutParameter<br>
-- param LayoutParameter pointer<br>
-- param type Relative or Linear
-- @function [parent=#Widget] setLayoutParameter
-- @param self
-- @param #ccui.LayoutParameter parameter
--------------------------------
--
-- @function [parent=#Widget] clone
-- @param self
-- @return Widget#Widget ret (return value: ccui.Widget)
--------------------------------
-- param enable pass true/false to enable/disable the focus ability of a widget<br>
-- return void
-- @function [parent=#Widget] setFocusEnabled
-- @param self
-- @param #bool enable
--------------------------------
--
-- @function [parent=#Widget] getBottomBoundary
-- @param self
-- @return float#float ret (return value: float)
--------------------------------
-- Determines if the widget is bright<br>
-- return true if the widget is bright, false if the widget is dark.
-- @function [parent=#Widget] isBright
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Return whether the widget is propagate touch events to its parents or not<br>
-- since v3.3
-- @function [parent=#Widget] isPropagateTouchEvents
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#Widget] getCurrentFocusedWidget
-- @param self
-- @return Widget#Widget ret (return value: ccui.Widget)
--------------------------------
-- when a widget calls this method, it will get focus immediately.
-- @function [parent=#Widget] requestFocus
-- @param self
--------------------------------
-- @overload self, size_table
-- @overload self
-- @function [parent=#Widget] updateSizeAndPosition
-- @param self
-- @param #size_table parentSize
--------------------------------
--
-- @function [parent=#Widget] getTouchMovePosition
-- @param self
-- @return vec2_table#vec2_table ret (return value: vec2_table)
--------------------------------
-- Gets the size type of widget.<br>
-- see SizeType<br>
-- param type that is widget's size type
-- @function [parent=#Widget] getSizeType
-- @param self
-- @return int#int ret (return value: int)
--------------------------------
--
-- @function [parent=#Widget] addTouchEventListener
-- @param self
-- @param #function callback
--------------------------------
--
-- @function [parent=#Widget] getTouchEndPosition
-- @param self
-- @return vec2_table#vec2_table ret (return value: vec2_table)
--------------------------------
-- Gets the percent (x,y) of the widget in OpenGL coordinates<br>
-- see setPosition(const Vec2&)<br>
-- return The percent (x,y) of the widget in OpenGL coordinates
-- @function [parent=#Widget] getPositionPercent
-- @param self
-- @return vec2_table#vec2_table ret (return value: vec2_table)
--------------------------------
-- Set a click event handler to the widget
-- @function [parent=#Widget] addClickEventListener
-- @param self
-- @param #function callback
--------------------------------
-- Returns the flag which indicates whether the widget is flipped horizontally or not.<br>
-- It only flips the texture of the widget, and not the texture of the widget's children.<br>
-- Also, flipping the texture doesn't alter the anchorPoint.<br>
-- If you want to flip the anchorPoint too, and/or to flip the children too use:<br>
-- widget->setScaleX(sprite->getScaleX() * -1);<br>
-- return true if the widget is flipped horizaontally, false otherwise.
-- @function [parent=#Widget] isFlippedX
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Return the flag which indicates whether the widget is flipped vertically or not.<br>
-- It only flips the texture of the widget, and not the texture of the widget's children.<br>
-- Also, flipping the texture doesn't alter the anchorPoint.<br>
-- If you want to flip the anchorPoint too, and/or to flip the children too use:<br>
-- widget->setScaleY(widget->getScaleY() * -1);<br>
-- return true if the widget is flipped vertically, flase otherwise.
-- @function [parent=#Widget] isFlippedY
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#Widget] isClippingParentContainsPoint
-- @param self
-- @param #vec2_table pt
-- @return bool#bool ret (return value: bool)
--------------------------------
-- Changes the size type of widget.<br>
-- see SizeType<br>
-- param type that is widget's size type
-- @function [parent=#Widget] setSizeType
-- @param self
-- @param #int type
--------------------------------
-- Sets whether the widget is bright<br>
-- The default value is true, a widget is default to bright<br>
-- param visible true if the widget is bright, false if the widget is dark.
-- @function [parent=#Widget] setBright
-- @param self
-- @param #bool bright
--------------------------------
-- Return whether the widget is swallowing touch or not<br>
-- since v3.3
-- @function [parent=#Widget] isSwallowTouches
-- @param self
-- @return bool#bool ret (return value: bool)
--------------------------------
--
-- @function [parent=#Widget] enableDpadNavigation
-- @param self
-- @param #bool enable
--------------------------------
-- Allocates and initializes a widget.
-- @function [parent=#Widget] create
-- @param self
-- @return Widget#Widget ret (return value: ccui.Widget)
--------------------------------
-- Returns the "class name" of widget.
-- @function [parent=#Widget] getDescription
-- @param self
-- @return string#string ret (return value: string)
--------------------------------
-- Changes the position (x,y) of the widget in OpenGL coordinates<br>
-- Usually we use p(x,y) to compose Vec2 object.<br>
-- The original point (0,0) is at the left-bottom corner of screen.<br>
-- param position The position (x,y) of the widget in OpenGL coordinates
-- @function [parent=#Widget] setPosition
-- @param self
-- @param #vec2_table pos
--------------------------------
--
-- @function [parent=#Widget] setContentSize
-- @param self
-- @param #size_table contentSize
--------------------------------
-- Default constructor
-- @function [parent=#Widget] Widget
-- @param self
return nil
|
local route_111_rest = DoorSlot("route_111", "rest")
local route_111_rest_hub = DoorSlotHub("route_111", "rest", route_111_rest)
route_111_rest:setHubIcon(route_111_rest_hub)
local route_111_mirage = DoorSlot("route_111", "mirage")
local route_111_mirage_hub = DoorSlotHub("route_111", "mirage", route_111_mirage)
route_111_mirage:setHubIcon(route_111_mirage_hub)
local route_111_regi = DoorSlot("route_111", "regi")
local route_111_regi_hub = DoorSlotHub("route_111", "regi", route_111_regi)
route_111_regi:setHubIcon(route_111_regi_hub)
local route_111_winstrate = DoorSlot("route_111", "winstrate")
local route_111_winstrate_hub = DoorSlotHub("route_111", "winstrate", route_111_winstrate)
route_111_winstrate:setHubIcon(route_111_winstrate_hub)
|
-- Encoding: utf-8
-- Started: 2014-10-06
-- Author: Shmuel Zeigerman
-- luacheck: globals rex Editors MenuPos
local function LOG(fmt,...) win.OutputDebugString(fmt:format(...)) end
local function ErrMsg (msg, title, flags)
far.Message(msg, title or "[Highlight] Error", nil, (flags or "").."w")
end
-- Global variables
rex = rex or {}
Editors = Editors or {}
MenuPos = MenuPos or 1
if not rex.new then
local DllName = far.PluginStartupInfo().ModuleDir .. "rex_onig.dl"
local luaopen = package.loadlib(DllName, "luaopen_rex_onig")
if not luaopen then
ErrMsg("Could not load\n" .. DllName)
return
end
rex = luaopen()
local Utf8ToUtf16 = win.Utf8ToUtf16
local orig_new = rex.new
rex.new = function (pat, cf, syn)
return orig_new(Utf8ToUtf16(pat), cf, "UTF16_LE", syn or "PERL_NG")
end
local methods = getmetatable(orig_new(".")).__index
methods.findW = function(r, s, init) -- simplified method: only 1-st capture
local from, to, cap = r:find(s, 2*init-1)
if from then from, to = (from+1)/2, to/2; return from, to, cap; end
end
methods.tfindW = function(r, s, init)
local from, to, t = r:tfind(s, 2*init-1)
if from then from, to = (from+1)/2, to/2; return from, to, t; end
end
end
local function NormalizeFastLines (p)
p = math.floor(tonumber(p) or 200)
p = math.max(p, 0)
p = math.min(p, 999999)
return p
end
local function NormalizeColorPriority (p)
p = math.floor(tonumber(p) or 10)
p = math.max(p, 0)
p = math.min(p, 0xFFFFFFFF)
return p
end
local F = far.Flags
local band, bor, bxor, lshift = bit64.band, bit64.bor, bit64.bxor, bit64.lshift
local acFlags = bor(F.ECF_TABMARKCURRENT, F.ECF_AUTODELETE)
local AppTitle
local Hist_Config, Config
local Hist_Extra, Extra
local Owner
local PatEndLine = rex.new("$")
local Classes = {}
local libDialog = require "far2.dialog"
local libHistory = require "far2.history"
-- initialize AppTitle, Owner, Hist_Config, Config.
do
local info = export.GetGlobalInfo()
AppTitle, Owner = info.Title, info.Guid
Hist_Config = libHistory.newsettings(nil, "Config")
Config = Hist_Config.Data
Hist_Extra = libHistory.newsettings(nil, "ExtraData")
Extra = Hist_Extra.Data
far.ReloadDefaultScript = Config.bDebugMode
Config.nColorPriority = NormalizeColorPriority(Config.nColorPriority)
Config.nFastLines = NormalizeFastLines(Config.nFastLines)
if Config.bFastMode==nil then Config.bFastMode=true end -- default=true
if Config.On==nil then Config.On=true end -- default=true
end
-- NOT USED: IS IT REALLY NEEDED?
local function toreal(id, y, pos) return editor.TabToReal(id, y, pos) end
local function template(str, ...)
local rep = {...}
str = str:gsub("%%(.)",
function(c)
local n = tonumber(c)
return n and rep[n] and win.Utf16ToUtf8(rep[n]) or c
end)
return str
end
local COLNAMES = {
black =0x0;
darkblue =0x1;
darkgreen =0x2;
darkaqua =0x3;
darkred =0x4;
darkpurple =0x5;
darkyellow =0x6; gold =0x6;
darkwhite =0x7; gray7=0x7; grey7=0x7;
gray =0x8; grey =0x8; gray8=0x8; grey8=0x8;
blue =0x9;
green =0xA;
aqua =0xB;
red =0xC;
purple =0xD;
yellow =0xE;
white =0xF;
}
local function ProcessFullColor(color)
if type(color) == "number" then
return color
elseif type(color) == "string" then
local fg,bg = color:match("(%l+)[%- ]+on[%- ]+(%l+)") -- e.g. "yellow on gold"
if fg and COLNAMES[fg] and COLNAMES[bg] then
return bor(COLNAMES[fg], lshift(COLNAMES[bg],4))
end
if COLNAMES[color] then -- specified only one color, let it be frground; inverse for bkground
return bor(COLNAMES[color], lshift(bxor(COLNAMES[color],0x8),4))
end
end
return 0x0F
end
local function FormColor (syntax, elem)
if elem.color then
return ProcessFullColor(elem.color)
end
local fgdefault = 0x0F
local bgdefault = COLNAMES[syntax.bgcolor] or syntax.bgcolor or 0x00
local fgcolor = band( COLNAMES[elem.fgcolor] or elem.fgcolor or fgdefault, 0x0F )
local bgcolor = band( COLNAMES[elem.bgcolor] or elem.bgcolor or bgdefault, 0x0F )
return bor(fgcolor, lshift(bgcolor,4))
end
local function CompileSyntax (Syntax, filename, classname)
local function s_error (msg, numelement) -- syntax_error
local s = ([[
%s
file: %s
class: %s
element: #%d]]):format(msg, filename, classname, numelement)
error(s)
end
local Out = {}
local tPatterns = {}
for i,v in ipairs(Syntax) do
local T = {}
Out[i] = T
if v.pattern==nil and v.pat_open==nil then
s_error("neither field 'pattern' nor 'pat_open' specified", i)
end
if v.pattern then
if type(v.pattern)~="string" then s_error("field 'pattern': string expected", i) end
tPatterns[i] = "(".. v.pattern ..")"
else
if type(v.pat_open)~="string" then s_error("field 'pat_open': string expected", i) end
if type(v.pat_close)~="string" then s_error("field 'pat_close': string expected", i) end
tPatterns[i] = "(".. v.pat_open ..")"
T.pat_close = v.pat_close
T.pat_skip = type(v.pat_skip)=="string" and rex.new(v.pat_skip,"x")
T.pat_continue = type(v.pat_continue)=="string" and rex.new(v.pat_continue,"x")
end
local pat = rex.new(v.pattern or v.pat_open) -- can throw error
T.capstart = i==1 and 1 or (Out[i-1].capend + 1)
T.capend = T.capstart + pat:capturecount()
T.color = FormColor(Syntax, v)
T.color_unfinished = ProcessFullColor(v.color_unfinished)
end
Out.pattern = rex.new(table.concat(tPatterns,"|"), "x");
Out.bracketcolor = tonumber(Syntax.bracketcolor) or 0x1C
Out.bracketmatch = Syntax.bracketmatch and true
return Out
end
local function MakeGetString (EditorID, ymin, ymax, ymin_paint)
local func = editor.GetStringW
local y = ymin - 1
return function()
if y < ymax then
y = y + 1
return func(EditorID,y,3), y, y >= ymin_paint
end
end
end
local function RedrawSyntax (Syn, ei, GetNextString, Priority, extrapattern, extracolor)
local current -- current item of Syn
local pat_close
local ID = ei.EditorID
local openbracket, bstack, bpattern, opattern
if Syn.bracketmatch then
local char = editor.GetString(ID, nil, 3):sub(ei.CurPos, ei.CurPos)
openbracket = char=="(" or char=="[" or char=="{"
local closebracket = char==")" or char=="]" or char=="}"
bstack = openbracket and 0 or closebracket and {}
if bstack then
if char=="(" or char==")" then
bpattern, opattern = rex.new("([()])"), "(\0"
elseif char=="[" or char=="]" then
bpattern, opattern = rex.new("([\\[\\]])"), "[\0"
else
bpattern, opattern = rex.new("([{}])"), "{\0"
end
editor.AddColor(ID,ei.CurLine,ei.CurPos,ei.CurPos,acFlags,Syn.bracketcolor,Priority+1,Owner)
end
end
for str, y, need_paint in GetNextString do
if bstack and need_paint then
if openbracket then
if y >= ei.CurLine then
local start = (y == ei.CurLine) and ei.CurPos+1 or 1
while true do
local from, to, br = bpattern:findW(str, start)
if not from then break end
start = to + 1
if br == opattern then
bstack = bstack + 1
else
if bstack > 0 then
bstack = bstack - 1
else
editor.AddColor(ID, y, from, to, acFlags, Syn.bracketcolor, Priority+1, Owner)
bstack = nil
break
end
end
end
end
else -- if closebracket
if y <= ei.CurLine then
local start = 1
while true do
local from, to, br = bpattern:findW(str, start)
if not from then
if y == ei.CurLine then bstack = nil; end
break
end
start = to + 1
if y == ei.CurLine and from == ei.CurPos then
if bstack[1] then
editor.AddColor(ID, bstack[#bstack-1], bstack[#bstack], bstack[#bstack],
acFlags, Syn.bracketcolor, Priority+1, Owner)
end
bstack = nil
break
else
if br == opattern then
bstack[#bstack+1] = y
bstack[#bstack+1] = from
else
bstack[#bstack] = nil
bstack[#bstack] = nil
end
end
end
end
end
end
if need_paint and extrapattern then
local start = 1
while true do
local from, to = extrapattern:findW(str, start)
if not from then break end
start = to>=from and to+1 or from+1
if to >= from then
editor.AddColor(ID, y, from, to, acFlags, extracolor, Priority+2, Owner)
end
end
end
local left = 1
while true do
if current == nil then -- outside long string or long comment
local from, to, capts = Syn.pattern:tfindW(str, left)
if from == nil then break end
local color
for _,v in ipairs(Syn) do
if capts[v.capstart] then
color = v.color
if v.pat_close then
current = v
pat_close = rex.new(template(v.pat_close, unpack(capts,v.capstart+1,v.capend)), "x")
end
break
end
end
if need_paint and color then
editor.AddColor(ID, y, from, to, acFlags, color, Priority, Owner)
end
left = (to >= from and to or from) + 1
else -- inside long string or long comment
if current.pat_skip then
local color = current.color
local old_left = left
local nextline
local from, to = current.pat_skip:findW(str, left)
if from then
left = to + 1
end
if current.pat_continue then
from, to = current.pat_continue:findW(str, left)
if from == left then
nextline = true
else
from, to = pat_close:findW(str, left)
if from == nil then
color = current.color_unfinished or color
from, to = PatEndLine:findW(str, left)
end
end
end
if need_paint and old_left <= to then
editor.AddColor(ID, y, old_left, to, acFlags, color, Priority, Owner)
end
if nextline == nil then
left = to + 1
current = nil
else
break
end
else
local from, to = pat_close:findW(str, left)
if not from then from, to = PatEndLine:findW(str, left) end
if need_paint and left <= to then
editor.AddColor(ID, y, left, to, acFlags, current.color, Priority, Owner)
end
if from <= to then
left = to + 1
current = nil
else
break
end
end
end
end
end
end
local function RedrawExtraPattern (ei, Priority, extrapattern, extracolor)
local ID = ei.EditorID
local GetNextString = MakeGetString(ID,
ei.TopScreenLine,
math.min(ei.TopScreenLine+ei.WindowSizeY-1, ei.TotalLines),
ei.TopScreenLine)
while true do
local str, y, need_paint = GetNextString()
if not str then break end
if need_paint then
local start = 1
while true do
local from, to = extrapattern:findW(str, start)
if not from then break end
start = to>=from and to+1 or from+1
if to >= from then
editor.AddColor(ID, y, from, to, acFlags, extracolor, Priority+2, Owner)
end
end
end
end
end
local function ShowSettings()
local Guid = win.Uuid("77D9B9B8-162A-4DEC-BF8F-16079D5F79E7")
local Width = 73
local X1, X2 = 5, math.floor(Width/2-1)
local X3, X4 = X2+1, Width-6
local Dlg = libDialog.NewDialog()
Dlg.dbox = {F.DI_DOUBLEBOX, 3, 1, Width-4, 12, 0,0,0,0, AppTitle}
Dlg.sboxAll = {F.DI_SINGLEBOX, X1, 2, X2, 7, 0,0,0,0, "All files"}
Dlg.cbHighAll = {F.DI_CHECKBOX, X1+1, 3, 0, 0, 0,0,0,0, "&Highlight"}
Dlg.cbFastAll = {F.DI_CHECKBOX, X1+1, 4, 0, 0, 0,0,0,0, "&Fast rendering"}
Dlg.labFastLinesAll = {F.DI_TEXT, X1+5, 5, 0, 0, 0,0,0,0, "&Lines"}
Dlg.edFastLinesAll = {F.DI_FIXEDIT, X2-11, 5, X2-2, 0, 0,0,"999999",F.DIF_MASKEDIT, ""}
Dlg.label = {F.DI_TEXT, X1+1, 6, 0, 0, 0,0,0,0, "Color &priority"}
Dlg.edPriorAll = {F.DI_FIXEDIT, X2-11, 6, X2-2, 0, 0,0,"9999999999",F.DIF_MASKEDIT, ""}
Dlg.sboxCur = {F.DI_SINGLEBOX, X3, 2, X4, 7, 0,0,0,0, "Current file"}
Dlg.cbHighCur = {F.DI_CHECKBOX, X3+1, 3, 0, 0, 0,0,0,0, "H&ighlight"}
Dlg.cbFastCur = {F.DI_CHECKBOX, X3+1, 4, 0, 0, 0,0,0,0, "F&ast rendering"}
Dlg.labFastLinesCur = {F.DI_TEXT, X3+5, 5, 0, 0, 0,0,0,0, "Li&nes"}
Dlg.edFastLinesCur = {F.DI_FIXEDIT, X4-11, 5, X4-2, 0, 0,0,"999999",F.DIF_MASKEDIT, ""}
Dlg.label = {F.DI_TEXT, X3+1, 6, 0, 0, 0,0,0,0, "Color p&riority"}
Dlg.edPriorCur = {F.DI_FIXEDIT, X4-11, 6, X4-2, 0, 0,0,"9999999999",F.DIF_MASKEDIT, ""}
Dlg.btBench = {F.DI_BUTTON, 5, 8, 0, 0, 0, 0,0,F.DIF_BTNNOCLOSE,"&Benchmark"}
Dlg.edBench = {F.DI_EDIT, 19, 8, Width-7, 0, 0, 0,0,F.DIF_READONLY, ""}
Dlg.cbDebug = {F.DI_CHECKBOX, 5, 9, 0, 0, 0,0,0,0, "&Debug mode"}
Dlg.sep = {F.DI_TEXT, -1, 10, 0, 0, 0, 0,0,F.DIF_SEPARATOR,""}
Dlg.btOk = {F.DI_BUTTON, 0, 11, 0, 0, 0, 0,0,{DIF_DEFAULTBUTTON=1,DIF_CENTERGROUP=1},"OK"}
Dlg.btCancel = {F.DI_BUTTON, 0, 11, 0, 0, 0, 0,0,F.DIF_CENTERGROUP,"Cancel"}
Dlg.cbHighAll.Selected = Config.On and 1 or 0
Dlg.cbFastAll.Selected = Config.bFastMode and 1 or 0
Dlg.edFastLinesAll.Data = Config.nFastLines
Dlg.edPriorAll.Data = Config.nColorPriority
Dlg.cbDebug.Selected = Config.bDebugMode and 1 or 0
local ei = editor.GetInfo()
local state = Editors[ei.EditorID]
if state and state.Class then
Dlg.cbHighCur.Selected = state.On and 1 or 0
Dlg.cbFastCur.Selected = state.bFastMode and 1 or 0
Dlg.edFastLinesCur.Data = state.nFastLines
Dlg.edPriorCur.Data = state.nColorPriority
else
for i=Dlg.sboxCur.id, Dlg.edPriorCur.id do Dlg[i][9] = "DIF_DISABLE" end
end
local function CheckEnableFastLines (hDlg)
if not state then return end
local enab = Dlg.cbFastAll:GetCheck(hDlg)
Dlg.labFastLinesAll:Enable(hDlg, enab)
Dlg.edFastLinesAll:Enable(hDlg, enab)
enab = Dlg.cbFastCur:GetCheck(hDlg)
Dlg.labFastLinesCur:Enable(hDlg, enab)
Dlg.edFastLinesCur:Enable(hDlg, enab)
end
local function RereadEditFields (hDlg)
if not state then return end
state.nFastLines = NormalizeFastLines(Dlg.edFastLinesCur:GetText(hDlg))
Dlg.edFastLinesCur:SetText(hDlg, state.nFastLines)
state.nColorPriority = NormalizeColorPriority(Dlg.edPriorCur:GetText(hDlg))
Dlg.edPriorCur:SetText(hDlg, state.nColorPriority)
end
local function DlgProc (hDlg,Msg,Param1,Param2)
if Msg == F.DN_INITDIALOG then
CheckEnableFastLines(hDlg)
elseif Msg == F.DN_BTNCLICK then
if Param1 == Dlg.cbFastAll.id then
CheckEnableFastLines(hDlg)
elseif Param1 == Dlg.cbHighCur.id then
if state then
RereadEditFields(hDlg)
state.On = not state.On
editor.Redraw()
end
elseif Param1 == Dlg.cbFastCur.id then
if state then
CheckEnableFastLines(hDlg)
state.bFastMode = not state.bFastMode
RereadEditFields(hDlg)
editor.Redraw()
end
elseif Param1 == Dlg.btBench.id then
RereadEditFields(hDlg)
Dlg.edBench:SetText(hDlg, "")
local t1 = os.clock()
for k=1,math.huge do
editor.Redraw()
local t2 = os.clock()
if t2-t1 > 1 then
t1=(t2-t1)*1000/k; break
end
end
Dlg.edBench:SetText(hDlg, ("%f msec"):format(t1))
end
end
end
if Dlg.btOk.id == far.Dialog (Guid,-1,-1,Width,14,"Settings",Dlg,nil,DlgProc) then
Config.On = (Dlg.cbHighAll.Selected ~= 0)
Config.bFastMode = (Dlg.cbFastAll.Selected ~= 0)
Config.nFastLines = NormalizeFastLines(Dlg.edFastLinesAll.Data)
Config.nColorPriority = NormalizeColorPriority(Dlg.edPriorAll.Data)
Config.bDebugMode = (Dlg.cbDebug.Selected ~= 0)
if state then
state.nFastLines = NormalizeFastLines(Dlg.edFastLinesCur.Data)
state.nColorPriority = NormalizeColorPriority(Dlg.edPriorCur.Data)
end
far.ReloadDefaultScript = Config.bDebugMode
Hist_Config:save()
editor.Redraw()
end
end
do
local info = {
Flags = bor(F.PF_EDITOR, F.PF_DISABLEPANELS),
PluginMenuGuids = win.Uuid("BE07BD22-B463-4C8E-8BA2-2DA1497C9086"),
PluginMenuStrings = { AppTitle },
}
function export.GetPluginInfo() return info end
end
local function SetClass (EditorID, Class, Activate)
local state = {}
Editors[EditorID] = state
state.Class = Class
state.On = Activate or Config.On
state.bFastMode = Class and Class.fastlines and true or Config.bFastMode
state.nFastLines = Class and Class.fastlines or Config.nFastLines
state.nColorPriority = Config.nColorPriority
state.extracolor = Extra.Color or 0xE0
end
local function SetExtraPattern (EditorID, extrapattern)
local state = Editors[EditorID]
if state then state.extrapattern = extrapattern end
end
local function GetExtraPattern (EditorID)
local state = Editors[EditorID]
return state and state.extrapattern
end
local function EnumMenuItems(items) -- add hot keys
local n = 1
for _,v in ipairs(items) do
if v.text and not v.separator then
if n>=1 and n<=9 then v.text = "&"..n..". "..v.text
elseif n==10 then v.text = "&0. "..v.text
elseif n>=11 and n<=36 then
local s = string.char(string.byte("A")+n-11)
v.text = "&"..s..". "..v.text
else
break
end
n = n + 1
end
end
return items
end
local function MenuSelectSyntax()
local props = { Title="Select syntax", HelpTopic="SelectSyntax" }
local items = { {text="Highlight OFF"; checked=true}, {separator=true} }
local ei = editor.GetInfo()
local state = Editors[ei.EditorID]
for k,v in ipairs(Classes) do
local m = k + 2
items[m] = { text=v.name; syntax=v }
if state and state.Class and state.Class.name == v.name then
props.SelectIndex = m
items[m].checked = state.On
items[1].checked = nil
end
end
local item = far.Menu(props, EnumMenuItems(items))
if item then
SetClass(ei.EditorID, item.syntax, true)
editor.Redraw(ei.EditorID)
end
end
local function HighlightExtra()
local ei = editor.GetInfo()
local state = Editors[ei.EditorID]
local extracolor = state.extracolor
local sepflags = bor(F.DIF_BOXCOLOR, F.DIF_SEPARATOR)
local editflags = bor(F.DIF_HISTORY, F.DIF_USELASTHISTORY)
local Dlg = libDialog.NewDialog()
local s1 = "&Search for:"
local x = s1:len()
Dlg.frame = {"DI_DOUBLEBOX", 3, 1, 72, 8, 0, 0, 0, 0, "Highlight extra"}
Dlg.lab = {"DI_TEXT", 5, 2, 0, 2, 0, 0, 0, 0, s1}
Dlg.sSearchPat = {"DI_EDIT", 5+x, 2, 70, 2, 0, "SearchText", 0, editflags, ""}
Dlg.sep = {"DI_TEXT", 5, 3, 0, 0, 0, 0, 0, sepflags, ""}
Dlg.bCaseSens = {"DI_CHECKBOX", 5, 4, 0, 0, 0, 0, 0, 0, "&Case sensitive"}
Dlg.bRegExpr = {"DI_CHECKBOX", 26, 4, 0, 0, 0, 0, 0, 0, "Re&g. expression"}
Dlg.labColor = {"DI_TEXT", 54, 4, 0, 0, 0, 0, 0, 0, "Text Text"}
Dlg.bWholeWords = {"DI_CHECKBOX", 5, 5, 0, 0, 0, 0, 0, 0, "&Whole words"}
Dlg.bExtended = {"DI_CHECKBOX", 26, 5, 0, 0, 0, 0, 0, 0, "&Ignore spaces"}
Dlg.btColor = {"DI_BUTTON", 54, 5, 0, 0, 0, 0, 0, F.DIF_BTNNOCLOSE, "C&olor"}
Dlg.sep = {"DI_TEXT", -1, 6, 0, 0, 0, 0, 0, sepflags,""}
Dlg.btOk = {"DI_BUTTON", 0, 7, 0, 0, 0, 0, 0, {DIF_DEFAULTBUTTON=1,DIF_CENTERGROUP=1},"OK"}
Dlg.btReset = {"DI_BUTTON", 0, 7, 0, 0, 0, 0, 0, F.DIF_CENTERGROUP,"&Reset"}
Dlg.btCancel = {"DI_BUTTON", 0, 7, 0, 0, 0, 0, 0, F.DIF_CENTERGROUP,"Cancel"}
local function CheckRegexChange (hDlg)
local bRegex = Dlg.bRegExpr:GetCheck(hDlg)
if bRegex then Dlg.bWholeWords:SetCheck(hDlg, false) end
Dlg.bWholeWords:Enable(hDlg, not bRegex)
--if not bRegex then Dlg.bExtended:SetCheck(hDlg, false) end
--Dlg.bExtended:Enable(hDlg, bRegex)
end
local function DlgProc (hDlg, msg, param1, param2)
if msg == F.DN_INITDIALOG then
CheckRegexChange (hDlg)
elseif msg == F.DN_BTNCLICK then
if param1 == Dlg.btColor.id then
local c = far.ColorDialog(extracolor)
if c then
extracolor = c
hDlg:send(F.DM_REDRAW)
end
else
CheckRegexChange (hDlg)
end
elseif msg == F.DN_CTLCOLORDLGITEM then
if param1 == Dlg.labColor.id then
param2[1] = extracolor
return param2
end
elseif msg == F.DN_CLOSE then
if param1 == Dlg.btReset.id then
SetExtraPattern(editor.GetInfo().EditorID, nil)
elseif param1 == Dlg.btOk.id then
local data = {}
libDialog.SaveDataDyn(hDlg, Dlg, data)
local sSearchPat = data.sSearchPat
local flags, syn = "", nil
if not data.bCaseSens then flags = flags.."i" end
if data.bExtended then flags = flags.."x" end
if not data.bRegExpr then syn = "ASIS" end
if data.bWholeWords then
syn = nil
local sNeedEscape = "[~!@#$%%^&*()%-+[%]{}\\|:;'\",<.>/?]"
sSearchPat = "\\b" .. sSearchPat:gsub(sNeedEscape, "\\%1") .. "\\b"
end
local ok, r = pcall(rex.new, sSearchPat, flags, syn)
if ok then
SetExtraPattern(editor.GetInfo().EditorID, r)
for k,v in pairs(data) do Extra[k]=v end
state.extracolor = extracolor
Extra.Color = extracolor
Hist_Extra:save()
else
ErrMsg(r)
return 0
end
end
end
end
Dlg.bCaseSens.Selected = Extra.bCaseSens and 1 or 0
Dlg.bRegExpr.Selected = Extra.bRegExpr and 1 or 0
Dlg.bWholeWords.Selected = Extra.bWholeWords and 1 or 0
Dlg.bExtended.Selected = Extra.bExtended and 1 or 0
local Guid = win.Uuid("A6E9A4FF-E9B4-4F16-9404-D5B8A515D16E")
far.Dialog (Guid,-1,-1,76,10,"HighlightExtra",Dlg,0,DlgProc)
end
function export.Open (From, Guid, Item)
if From == F.OPEN_EDITOR then
local item, pos = far.Menu({Title=AppTitle, SelectIndex=MenuPos}, {
{text="&1. Select syntax"; act=MenuSelectSyntax; },
{text="&2. Highlight extra"; act=HighlightExtra; },
{text="&3. Settings"; act=ShowSettings; }
})
if item then
MenuPos = pos
item.act()
end
elseif From == F.OPEN_FROMMACRO then
if far.MacroGetArea() == F.MACROAREA_EDITOR then
if Item[1] == "own" then
if Item[2] == "SelectSyntax" then MenuSelectSyntax()
elseif Item[2] == "HighlightExtra" then HighlightExtra()
elseif Item[2] == "Settings" then ShowSettings()
end
end
end
end
end
local FirstLineMap = {}
local function OnNewEditor (id, ei)
if ei then
local firstline = editor.GetString(id,1,3):lower()
local name = firstline:match("highlight:%s*([%w_]+)")
if name and FirstLineMap[name] then
SetClass(id, FirstLineMap[name], false)
else
for _,class in ipairs(Classes) do
if far.ProcessName("PN_CMPNAMELIST", class.filemask, ei.FileName, "PN_SKIPPATH") then
SetClass(id, class, false); break
end
end
end
if not Editors[id] then
SetClass(id, nil, false)
end
end
end
function export.ProcessEditorEvent (id, event, param)
if event == F.EE_READ then
if not Editors[id] then
OnNewEditor(id, editor.GetInfo(id))
end
elseif event == F.EE_CLOSE then
Editors[id] = nil
elseif event == F.EE_REDRAW then
local ei = editor.GetInfo(id)
if not Editors[id] then
OnNewEditor(id, ei)
end
local state = Editors[id]
if state and ei then
if state.Class and state.On then
local GetNextString = MakeGetString(
ei.EditorID,
state.bFastMode and math.max(ei.TopScreenLine-state.nFastLines, 1) or 1,
math.min(ei.TopScreenLine+ei.WindowSizeY-1, ei.TotalLines),
ei.TopScreenLine)
RedrawSyntax(state.Class.CS, ei, GetNextString, state.nColorPriority,
state.extrapattern, state.extracolor)
elseif state.extrapattern then
RedrawExtraPattern(ei, state.nColorPriority, state.extrapattern, state.extracolor)
end
end
end
end
local AddClass_filename
local function AddClass (t)
if type(t)~="table" then error("function Class() called with a non-table argument",2) end
if type(t.syntax)~="table" then error("field 'syntax': a table expected",2) end
if type(t.name)~="string" then error("field 'name': a string expected",2) end
if type(t.filemask)~="string" then error("field 'filemask': a string expected",2) end
if t.fastlines and type(t.fastlines)~="number"
then error("field 'fastlines': a number expected",2) end
local class = { syntax=t.syntax; name=t.name; filemask=t.filemask }
if type(t.firstline) == "string" then
FirstLineMap[t.firstline:lower()] = class
end
class.filename = AddClass_filename
class.CS = CompileSyntax(t.syntax, t.filename, t.name)
if t.fastlines then
class.fastlines = math.floor(math.max(0, t.fastlines))
end
Classes[#Classes+1] = class
end
do
far.RecursiveSearch(far.PluginStartupInfo().ModuleDir.."syntaxes", "*.lua",
function (item, fullpath)
if not item.FileAttributes:find("d") then
local f, msg = loadfile(fullpath)
if f then
AddClass_filename = fullpath
local ok, msg = pcall(setfenv(f, {Class=AddClass}))
if not ok then ErrMsg(msg, nil, "wl") end
else
ErrMsg(msg)
end
end
end)
table.sort(Classes,
function(a, b) return win.CompareString(a.name, b.name, "u", "cS") < 0 end) -- for menu
end
|
--[[
Turn-In Mod
version 2.1
Authored by Ian Friedman
Sabindeus of Smolderthorn (Alliance)
The repeatable quest turn in automating machine.
Thanks to Arcanemagus of Hyjal for extra bug fixes and coding input
]]
local L = TURNIN_LOCALIZATION_INFO;
local TI_activenumber = 1;
local TI_availnumber = 1;
local TI_specnum = 0;
local TI_VersionString = "2.1";
local TI_gossipclosed = false;
local TI_NPCInQuestion = nil;
TI_LoadedNPCIndex = 0;
TI_TempNPCListMaxSize = 5;
TI_TempNPCList = {};
local TI_GossipDefaults = {
availquest = L["availquest"],
activequest = L["activequest"],
gossip = L["gossip"],
vendor = L["vendor"],
taxi = L["taxi"],
trainer = L["trainer"],
battlemaster = L["battlemaster"],
binder = L["binder"],
healer = L["healer"],
banker = L["banker"],
};
local TI_FunctionList = {
g = {
availquest = SelectGossipAvailableQuest,
activequest = SelectGossipActiveQuest,
default = SelectGossipOption
},
q = {
availquest = SelectAvailableQuest,
activequest = SelectActiveQuest
}
};
local TI_DefaultStatus = {
state = true, --bf@178.com
version = TI_VersionString,
options = {},
debugstate = false,
usedefault=true,
autoadd=false
};
local TI_events = {
"GOSSIP_SHOW",
"GOSSIP_CLOSED",
"QUEST_DETAIL",
"QUEST_COMPLETE",
"QUEST_PROGRESS",
"QUEST_GREETING",
"QUEST_FINISHED"
};
function TI_message(...)
local x = {...};
for k,v in pairs(x) do
DEFAULT_CHAT_FRAME:AddMessage(tostring(v));
end
end
function TI_debug(...)
if(TI_status.debugstate) then
TI_message(...)
end
end
local function TI_NPCIndexGenerate()
TI_NPCIndex = {};
for k,v in pairs(TI_NPCDB) do
table.insert(TI_NPCIndex, k);
end
table.sort(TI_NPCIndex);
end
local function TI_OptionsInit()
TI_status.options = {};
for k,v in pairs(TI_GossipDefaults) do
local temp = {};
temp.name = v;
temp.type = k;
if k == "activequest" or k == "availquest" then --bf@178.com
temp.state = true; --bf@178.com
else --bf@178.com
temp.state = false;
end --bf@178.com
table.insert(TI_status.options, temp);
end
end
local function TI_VarInit()
if(not TI_status or TI_status.version ~= TI_VersionString) then
TI_status = TI_copyTable(TI_DefaultStatus);
end
if(not TI_status.options or #TI_status.options == 0) then
TI_OptionsInit();
end
if(not TI_NPCDB) then
TI_NPCDB = {};
end
if(not TI_NPCIndex) then
TI_NPCIndexGenerate();
end
TI_PopulateOptions("vars loaded");
end
local function TI_HandleQuestProgress()
local questname = GetTitleText();
local npcname = UnitName("npc");
if(QuestFrame:IsVisible()) then
if(TI_NPCDB[npcname]) then
local thisnpc = TI_NPCDB[npcname];
if(thisnpc.state) then
for i,current in ipairs(thisnpc) do
if(current.name == questname and current.state) then
TI_CompleteQuest();
end
end
else
if(TI_IsNPCOn(UnitName("npc"), "activequest")) then
TI_CompleteQuest();
end
end
else
if(TI_IsNPCOn(UnitName("npc"), "activequest")) then
TI_CompleteQuest();
end
end
end
end
local function TI_GetQuests(type)
local numQuests = (getglobal("GetNum"..type.."Quests"))();
local qfn = getglobal("Get"..type.."Title");
local ret = {};
local qname;
local i=1;
for i=1,numQuests do
qname = qfn(i);
ret[i] = {name=qname};
end
return ret;
end
function TI_OnLoad()
SlashCmdList["TI"] = TI_SlashCmdHandler;
SLASH_TI1 = "/turnin";
SLASH_TI2 = "/ti";
tinsert(UISpecialFrames,"TI_OptionsFrame");
TI_message("Turn In loaded");
TI_gossipclosed = false;
TI_VarInit();
if(TI_status.state) then
TI_LoadEvents();
end
TI_activenumber = 1;
TI_availnumber = 1;
TI_specnum = 0;
StaticPopupDialogs["TI_NPCINQUESTION"] = {
text = "The NPC %s is already in your NPC Database. Do you wish to replace his gossip options with the current ones? (Note: This will overwrite your settings for this NPC.)",
button1 = "Yes",
button2 = "No",
OnAccept = function()
TI_AddNPCToList(TI_NPCInQuestion.list, TI_NPCInQuestion.name, true);
end,
timeout=0,
whileDead = 1,
hideOnEscape = 1
};
end
function TI_LoadEvents()
for k,v in pairs(TI_events) do
TurnIn:RegisterEvent(v);
end
end
function TI_ResetPointers()
TI_activenumber = 1;
TI_availnumber = 1;
TI_specnum = 0;
end
function TI_UnloadEvents()
for k,v in pairs(TI_events) do
TurnIn:UnregisterEvent(v);
end
end
function TI_Switch(state)
if(state=="on") then
TI_status.state = true;
TI_LoadEvents();
TI_message("Turn In On");
elseif(state=="off") then
TI_ResetPointers();
TI_status.state = false;
TI_UnloadEvents();
TI_message("Turn In Off");
elseif(state=="toggle") then
if(TI_status.state) then
TI_Switch("off");
else
TI_Switch("on");
end
end
TI_StatusIndicatorUpdate();
end
function TI_SlashCmdHandler(cmd)
cmdlist = {strsplit(" ", cmd)};
local commands = {
on = function ()
TI_Switch("on");
end,
off = function ()
TI_Switch("off");
end,
toggle = function ()
TI_Switch("toggle");
end,
status = function ()
if(TI_status.state) then
TI_message("Turn In On");
else
TI_message("Turn In Off");
end
end,
window = function ()
TI_OptionsFrame:Show();
end,
recent = function ()
TI_TempNPCListWindow:Show();
end,
debug = function ()
if(TI_status.debugstate) then
TI_status.debugstate = false;
TI_message("debug mode off");
else
TI_status.debugstate = true;
TI_message("debug mode on");
end
end
};
if(commands[cmdlist[1]]) then
commands[cmdlist[1]](cmdlist[2], cmdlist[3], cmdlist[4]);
else
TI_message("Turn In 2.1 Help", "--------------", "/ti on - turns Turn In on", "/ti off - turns Turn In off", "/ti toggle - toggles Turn In on or off", "/ti window - shows the options window", "/ti recent - shows the recently visited NPCs");
end
end
function TI_IsNPCOn(npcname, type)
local opton = false;
if(type ~= nil) then
for k,v in pairs(TI_status.options) do
if(v.type == type and v.state == true) then
opton = true;
end
end
else
opton = true;
end
if(TI_NPCDB[npcname] == nil and TI_status.usedefault == true and opton == true) then
TI_debug("case 1");
return true;
elseif(TI_NPCDB[npcname] ~= nil and TI_NPCDB[npcname].state) then
TI_debug("case 2");
return true;
elseif(TI_NPCDB[npcname] ~= nil and TI_status.usedefault == true and not TI_NPCDB[npcname].state and opton == true) then
TI_debug("case 4");
return true;
else
TI_debug("case 3");
return false;
end
end
function TI_OnEvent(self, event, ...)
local addon = ...;
if event == "ADDON_LOADED" and addon == "TurnIn" then
TI_OnLoad();
self:UnregisterEvent("ADDON_LOADED");
else
if(TI_status.state and not IsShiftKeyDown()) then
if(event == "QUEST_GREETING") then
TI_debug("Quest Greeting");
TI_lastquestframe = "greeting";
if(QuestFrame:IsVisible()) then
if(TI_gossipclosed) then
TI_debug("resetting pointers");
TI_gossipclosed = false;
TI_ResetPointers();
end
TI_HandleGossipWindow("q");
end
end
if(event == "GOSSIP_SHOW") then
TI_debug("Gossip Show");
if(GossipFrame:IsVisible()) then
if(TI_gossipclosed) then
TI_debug("resetting pointers");
TI_gossipclosed = false;
TI_ResetPointers();
end
TI_HandleGossipWindow("g");
end
end
if(event == "GOSSIP_CLOSED") then
TI_debug("Gossip Closed");
if(not GossipFrame:IsVisible()) then
TI_gossipclosed = true;
end;
end
if(event == "QUEST_COMPLETE") then
TI_debug("Quest Complete");
if(TI_IsNPCOn(UnitName("npc"), "activequest")) then
if(not (GetNumQuestChoices() > 1)) then
GetQuestReward(1);
end
end
TI_ResetPointers();
end
if(event == "QUEST_PROGRESS") then
TI_debug("Quest Progress");
TI_gossipclosed = false;
TI_lastquestframe = "progress";
TI_HandleQuestProgress();
end
if(event == "QUEST_DETAIL") then
TI_debug("Quest Detail");
TI_gossipclosed = false;
if(TI_IsNPCOn(UnitName("npc"), "availquest")) then
BigFoot_DelayCall(AcceptQuest,0.1);
end
TI_ResetPointers();
end
if(event == "QUEST_FINISHED") then
TI_debug("Quest Finished");
if(not QuestFrame:IsVisible() and TI_lastquestframe == "greeting") then
TI_debug("looks like the quest frame closed, resetting pointers on next open");
TI_gossipclosed = true;
end
end
end
end
end
function TI_CompleteQuest()
if(IsQuestCompletable()) then
CompleteQuest();
TI_ResetPointers();
elseif GetNumGossipOptions()>0 then
DeclineQuest();
end
end
function TI_HandleGossipWindow(gorq)
local SAcQ;
local SAvQ;
local AvailableQuests;
local ActiveQuests;
local GossipOptions;
if(gorq == "g") then
AvailableQuests = TI_TabulateGossipAvailableQuests(GetGossipAvailableQuests());
ActiveQuests = TI_TabulateGossipActiveQuests(GetGossipActiveQuests());
GossipOptions = TI_TabulateGossipOptions(GetGossipOptions());
SAcQ = SelectGossipActiveQuest;
SAvQ = SelectGossipAvailableQuest;
elseif(gorq == "q") then
AvailableQuests = TI_GetQuests("Available");
ActiveQuests = TI_GetQuests("Active");
GossipOptions = {};
SAcQ=SelectActiveQuest;
SAvQ=SelectAvailableQuest;
end
local ListEntry = {};
for i,v in ipairs(AvailableQuests) do
local x={};
x.name = v.name;
x.gorq = gorq;
x.args = i;
x.type = "availquest";
x.icon = v.icon;
x.state = false;
table.insert(ListEntry, x);
end
for i,v in ipairs(ActiveQuests) do
local x={};
x.name = v.name;
x.gorq = gorq;
x.args = i;
x.type = "activequest";
x.icon = v.icon;
x.state = false;
table.insert(ListEntry, x);
end
for i,v in ipairs(GossipOptions) do
local x={};
x.name = v.name;
x.gorq = gorq;
x.args = i;
x.type = v.type;
x.state = false;
table.insert(ListEntry, x);
end
ListEntry.state = false;
local TotalOptions = #AvailableQuests+#ActiveQuests+#GossipOptions;
--if(TI_activenumber > ActiveQuests.getn()) TI_activenumber = 1;
if(TotalOptions < 1) then
return;
end
local npcname = UnitName("npc");
TI_AddNPCToTempList(npcname, ListEntry);
if(TI_status.autoadd and (not TI_NPCDB[npcname])) then
TI_debug("autoadd on, adding this NPC", TI_status.autoadd, TI_NPCDB[npcname]);
TI_AddNPCToList(ListEntry, npcname);
end
-- If a NPC is in the Database but a new dialog option has appeared (new daily/completed quest) then add it to the DB
if (TI_NPCDB[npcname]) then
for k1, v1 in ipairs(ListEntry) do
local found = false;
for k2, v2 in ipairs(TI_NPCDB[npcname]) do
if (v2.type == v1.type and v2.name == v1.name) then
found = true;
end
end
if (not found) then
table.insert(TI_NPCDB[npcname], v1)
TI_PopulateOptions("npclist updated");
end
end
end
if(TI_availnumber > TotalOptions or TI_activenumber > TotalOptions) then
TI_ResetPointers();
return;
end
TI_debug(npcname);
if(TI_NPCDB[npcname]) then
local thisnpc = TI_NPCDB[npcname];
if(thisnpc.state) then
TI_debug("npc is active, using his options");
for i1,current in ipairs(thisnpc) do
if (current.state == true) then
TI_debug("Current Quest: "..current.name);
if (TI_specnum == 0 or i1 > TI_specnum) then
TI_specnum = i1;
if (current.type == "availquest") then
for i2,v2 in ipairs(AvailableQuests) do
if (v2.name == current.name) then
TI_debug(i1.."-Available Match Found: "..current.name);
TI_FunctionList[current.gorq]["availquest"](i2);
return;
end
end
elseif (current.type == "activequest") then
for i2,v2 in ipairs(ActiveQuests) do
if (v2.name == current.name) then
TI_debug(i1.."-Active Match Found: "..current.name..", "..current.type);
TI_FunctionList[current.gorq]["activequest"](i2);
return;
end
end
elseif (current.type == "gossip") then
for i2,v2 in ipairs(GossipOptions) do
if (v2.name == current.name) then
SelectGossipOption(i2);
return;
end
end
end
end
end
end
return;
else
TI_debug("npc in list, but not active");
end
else
TI_debug("npc not in list");
end
if(TI_status.usedefault == false) then
TI_debug("npc not in list, default set to off, returning.");
return;
end;
TI_debug("using default config");
for i,current in ipairs(TI_status.options) do
if(current.state) then
if(current.type == "availquest" and #AvailableQuests > 0 and TI_availnumber <= #AvailableQuests) then
TI_availnumber = TI_availnumber + 1;
SAvQ(TI_availnumber-1);
TI_debug("Selecting Available Quest ".. TI_availnumber-1);
return;
elseif(current.type == "activequest" and #ActiveQuests > 0 and TI_activenumber <= #ActiveQuests) then
TI_activenumber = TI_activenumber + 1;
SAcQ(TI_activenumber-1);
TI_debug("Selecting Active Quest ".. TI_activenumber-1);
return;
elseif(#GossipOptions > 0) then
for j,val in ipairs(GossipOptions) do
if(val.type == current.type) then
TI_ResetPointers();
SelectGossipOption(j);
return;
end
end
end
end
end
end
function TI_AddNPCToList(OptList, npcname, confirminquestion)
if (npcname == nil) then
npcname = UnitName("npc");
end
if(#OptList > 0) then
if(TI_NPCDB[npcname] == nil) then
TI_NPCDB[npcname] = TI_copyTable(OptList);
table.insert(TI_NPCIndex, npcname);
table.sort(TI_NPCIndex);
TI_PopulateOptions("npclist updated");
elseif(confirminquestion == true) then
TI_NPCDB[npcname] = TI_copyTable(OptList);
TI_PopulateOptions("npclist updated");
else
TI_NPCInQuestion = {name=npcname, list=OptList};
StaticPopup_Show("TI_NPCINQUESTION", npcname);
end
end
end
function TI_AddNPCToTempList(name, list)
local temp = {};
temp.name = name;
temp.list = list;
temp.location = GetSubZoneText() .. ", " .. GetRealZoneText();
table.insert(TI_TempNPCList, 1, temp);
if(#TI_TempNPCList > TI_TempNPCListMaxSize) then
table.remove(TI_TempNPCList, TI_TempNPCListMaxSize);
end
TI_TempNPCListUpdate();
end
function TI_DeleteTempNPCIndex(index)
table.remove(TI_TempNPCList, index);
TI_TempNPCListUpdate();
end
function TI_AddTempNPCIndex(index)
TI_AddNPCToList(TI_TempNPCList[index].list, TI_TempNPCList[index].name);
end
function TI_DeleteNPC(index)
local name = TI_NPCIndex[index];
table.remove(TI_NPCIndex, index);
TI_NPCDB[name] = nil;
end
function TI_TabulateGossipOptions(...)
local x = {};
local arg = {...};
for i=1, #arg, 2 do
local temp = {};
temp.name = arg[i];
temp.type = arg[i+1];
table.insert(x, temp);
end
return x;
end
function TI_TabulateGossipAvailableQuests(...)
local x = {};
for i=1, select("#", ...), 5 do
local temp = {};
temp.name = select(i, ...);
isTrivial = select(i+2, ...);
isDaily = select(i+3, ...);
isRepeatable = select(i+4, ...);
if ( isDaily ) then
temp.icon = "Interface\\GossipFrame\\DailyQuestIcon";
elseif ( isRepeatable ) then
temp.icon = "Interface\\GossipFrame\\DailyActiveQuestIcon";
else
temp.icon = "Interface\\GossipFrame\\AvailableQuestIcon";
end
table.insert(x, temp);
end
return x;
end
function TI_TabulateGossipActiveQuests(...)
local x = {};
for i=1, select("#", ...), 4 do
local temp = {};
temp.name = select(i, ...);
isComplete = select(i+3, ...);
if(isComplete) then
temp.icon = "Interface\\GossipFrame\\ActiveQuestIcon";
else
temp.icon = "Interface\\GossipFrame\\IncompleteQuestIcon";
end
table.insert(x, temp);
end
return x;
end
--[[this function stolen from WhisperCast by Sarris, whom I love dearly for his contribution to Paladins everywhere.
]]
function TI_copyTable( src )
local copy = {}
for k1,v1 in pairs(src) do
if ( type(v1) == "table" ) then
copy[k1]=TI_copyTable(v1)
else
copy[k1]=v1
end
end
return copy
end
|
local M = require('xe.node_def._checker')
local CalcParamNum = M.CalcParamNum
local CheckName = M.CheckName
local CheckVName = M.CheckVName
local CheckExpr = M.CheckExpr
local CheckPos = M.CheckPos
local CheckExprOmit = M.CheckExprOmit
local CheckCode = M.CheckCode
local CheckParam = M.CheckParam
local CheckNonBlank = M.CheckNonBlank
local CheckClassName = M.CheckClassName
local IsBlank = M.IsBlank
local CheckResFileInPack = M.CheckResFileInPack
local CheckAnonymous = M.CheckAnonymous
local MakeFullPath = M.MakeFullPath
local setv = {
{ 'Object', 'any', CheckExpr },
{ 'Velocity', 'any', CheckExpr },
{ 'Angle', 'any', CheckExpr },
{ 'Aim to player', 'bool', CheckExpr },
{ 'Set rotation', 'bool', CheckExpr },
disptype = {
en = 'set velocity of object',
zh = '设置object速度',
},
forbidparent = { 'folder', 'root' },
allowchild = {},
default = { ['type'] = 'setv', attr = { 'self', '3', '0', 'false', 'true' } },
totext = function(nodedata)
local aim
if nodedata.attr[4] == 'true' then
aim = ' aim to player'
else
aim = ''
end
return string.format("set %s's velocity=%s angle=%s%s", nodedata.attr[1], nodedata.attr[2], nodedata.attr[3], aim)
end,
tohead = function(nodedata)
return string.format("SetV2(%s,%s,%s,%s,%s)\n", nodedata.attr[1], nodedata.attr[2], nodedata.attr[3], nodedata.attr[5], nodedata.attr[4])
end,
}
local setcolor = {
{ 'Object', 'any', CheckExpr },
{ 'Blend mode', 'blend', CheckExprOmit },
{ 'Alpha', 'any', CheckExpr },
{ 'Red', 'any', CheckExpr },
{ 'Green', 'any', CheckExpr },
{ 'Blue', 'any', CheckExpr },
disptype = {
en = 'set color and blend mode of object',
zh = '设置object颜色与混合模式',
},
forbidparent = { 'folder', 'root' },
allowchild = {},
default = { ['type'] = 'setcolor', attr = { 'self', '', '255', '255', '255', '255' } },
totext = function(nodedata)
return string.format("set %s's color to (%s,%s,%s,%s) and blend mode to %q", nodedata.attr[1], nodedata.attr[3], nodedata.attr[4], nodedata.attr[5], nodedata.attr[6], nodedata.attr[2])
end,
tohead = function(nodedata)
return string.format("_object.set_color(%s,%q,%s,%s,%s,%s)\n", nodedata.attr[1], nodedata.attr[2], nodedata.attr[3], nodedata.attr[4], nodedata.attr[5], nodedata.attr[6])
end,
}
local objectsetimg = {
{ 'Object', 'any', CheckExpr },
{ 'Image', 'image', CheckNonBlank },
disptype = {
en = 'set image of object',
zh = '设置object图像',
},
forbidparent = { 'folder', 'root' },
allowchild = {},
default = { ['type'] = 'objectsetimg', attr = { 'self', '' } },
totext = function(nodedata)
return string.format("set %s's image to %q", nodedata.attr[1], nodedata.attr[2])
end,
tohead = function(nodedata)
return string.format("%s.img = %q\n", nodedata.attr[1], nodedata.attr[2])
end,
}
local unitforeach = {
{ 'Group', 'group', CheckExpr },
disptype = {
en = 'iterate object of a group',
zh = '遍历碰撞组中的object',
},
forbidparent = { 'folder', 'root' },
forbidancestor = { 'unitforeach' },
totext = function(nodedata)
return string.format("for each unit in group %s", nodedata.attr[1])
end,
tohead = function(nodedata)
return string.format("for _, unit in ObjList(%s) do\n", nodedata.attr[1])
end,
tofoot = function(nodedata)
return "end\n"
end,
}
local unitkill = {
{ 'Object', 'any', CheckExpr },
{ 'Trigger event callback', 'bool', CheckExpr },
disptype = {
en = 'kill object',
zh = '对object执行kill操作',
},
forbidparent = { 'folder', 'root' },
allowchild = {},
default = { ['type'] = 'unitkill', attr = { 'self', 'true' } },
totext = function(nodedata)
return string.format("kill %s", nodedata.attr[1])
end,
tohead = function(nodedata)
return string.format("_kill(%s, %s)\n", nodedata.attr[1], nodedata.attr[2])
end,
}
local unitdel = {
{ 'Object', 'any', CheckExpr },
{ 'Trigger event callback', 'bool', CheckExpr },
disptype = {
en = 'delete object',
zh = '对object执行delete操作',
},
forbidparent = { 'folder', 'root' },
allowchild = {},
default = { ['type'] = 'unitdel', attr = { 'self', 'true' } },
totext = function(nodedata)
return string.format("delete %s", nodedata.attr[1])
end,
tohead = function(nodedata)
return string.format("_del(%s, %s)\n", nodedata.attr[1], nodedata.attr[2])
end,
}
--
local setaccel = {
{ 'Object', 'any', CheckExpr },
{ 'Acceleration', 'any', CheckExpr },
{ 'Angle', 'any', CheckExpr },
{ 'Aim to player', 'bool', CheckExpr },
disptype = {
en = 'set acceleration of object',
zh = '设置object加速度',
},
forbidparent = { 'root', 'folder' },
allowchild = {},
default = { ['type'] = 'setaccel', ['attr'] = { 'self', '0.05', '0', 'false' } },
totext = function(nodedata)
local ret
if nodedata.attr[3] == 'original' then
ret = "set acceleration of " .. nodedata.attr[2] .. " , at the velocity direction"
else
ret = "set acceleration of " .. nodedata.attr[2] .. " , angle of " .. nodedata.attr[3]
end
if nodedata.attr[4] == "true" then
ret = ret .. ", aim to player"
end
return ret
end,
tohead = function(nodedata)
local rot = nodedata.attr[3]
if rot == "original" then
rot = "'original'"
end
return string.format("_set_a(%s, %s, %s, %s)\n", nodedata.attr[1], nodedata.attr[2], rot, nodedata.attr[4])
end
}
local setgravity = {
{ 'Object', 'any', CheckExpr },
{ 'Gravity', 'any', CheckExpr },
disptype = {
en = 'set gravity of object',
zh = '设置object重力',
},
forbidparent = { 'root', 'folder' },
allowchild = {},
default = { ['type'] = 'setgravity', ['attr'] = { 'self', '0.05' } },
totext = function(nodedata)
return "set gravity of " .. nodedata.attr[2]
end,
tohead = function(nodedata)
return string.format("_set_g(%s, %s)\n", nodedata.attr[1], nodedata.attr[2])
end
}
local setfv = {
{ 'Object', 'any', CheckExpr },
{ 'Max velocity', 'any', CheckExpr },
{ 'Max X-velocity', 'any', CheckExpr },
{ 'Max Y-velocity', 'any', CheckExpr },
disptype = {
en = 'set velocity limit of object',
zh = '设置object速度限制',
},
forbidparent = { 'root', 'folder' },
allowchild = {},
default = { ['type'] = 'setfv', ['attr'] = { 'self', 'original', 'original', 'original' } },
totext = function(nodedata)
local ret = "set "
if nodedata.attr[2] ~= "original" then
if ret ~= "set " then
ret = ret .. ","
end
ret = ret .. " max velocity of " .. nodedata.attr[2]
end
if nodedata.attr[3] ~= "original" then
if ret ~= "set " then
ret = ret .. ","
end
ret = ret .. " max X-velocity of " .. nodedata.attr[3]
end
if nodedata.attr[4] ~= "original" then
if ret ~= "set " then
ret = ret .. ","
end
ret = ret .. " max Y-velocity of " .. nodedata.attr[4]
end
if ret == "set " then
ret = ret .. "nothing"
end
return ret
end,
tohead = function(nodedata)
local attr = {}
for i = 2, 4 do
attr[i] = nodedata.attr[i]
end
local v, vx, vy = unpack(attr, 2, 4)
if v == "original" then
v = "'original'"
end
if vx == "original" then
vx = "'original'"
end
if vy == "original" then
vy = "'original'"
end
return string.format("_forbid_v(%s, %s, %s, %s)\n", nodedata.attr[1], v, vx, vy)
end
}
--]]
local _def = {
setv = setv,
setcolor = setcolor,
objectsetimg = objectsetimg,
unitforeach = unitforeach,
unitkill = unitkill,
unitdel = unitdel,
setaccel = setaccel,
setgravity = setgravity,
setfv = setfv,
}
for k, v in pairs(_def) do
require('xe.node_def._def').DefineNode(k, v)
end
|
-- Copyright 2006-2017 Mitchell mitchell.att.foicica.com. See LICENSE.
-- Diff LPeg lexer.
local l = require('lexer')
local token, word_match = l.token, l.word_match
local P, R, S = lpeg.P, lpeg.R, lpeg.S
local M = {_NAME = 'diff'}
-- Text, separators, and file headers.
local index = token(l.COMMENT, 'Index: ' * l.any^0 * P(-1))
local separator = token(l.COMMENT, ('---' + P('*')^4 + P('=')^1) * l.space^0 *
-1)
local header = token('header', (P('*** ') + '--- ' + '+++ ') * l.any^1)
-- Location.
local location = token(l.NUMBER, ('@@' + l.digit^1 + '****') * l.any^1)
-- Additions, deletions, and changes.
local addition = token('addition', S('>+') * l.any^0)
local deletion = token('deletion', S('<-') * l.any^0)
local change = token('change', '! ' * l.any^0)
M._rules = {
{'index', index},
{'separator', separator},
{'header', header},
{'location', location},
{'addition', addition},
{'deletion', deletion},
{'change', change},
{'any_line', token('default', l.any^1)},
}
M._tokenstyles = {
header = l.STYLE_COMMENT,
addition = 'fore:$(color.green)',
deletion = 'fore:$(color.red)',
change = 'fore:$(color.yellow)'
}
M._LEXBYLINE = true
return M
|
local module = {}
local Latte, Elements, Packages = nil, nil, {}
local function fetch()
Packages = {}
for _,v in pairs(Latte.Constructors.Window.Window.Pages.Players:GetChildren()) do
if string.lower(v.Name) ~= "target" and v:IsA("Frame") then
table.insert(Packages, v.Name)
end
end
for _,v in pairs(Latte.Constructors.Window.Window.Pages.Server:GetChildren()) do
if v:IsA("Frame") then
table.insert(Packages, v.Name)
end
end
end
module.setup = function()
local Active = false
local Top = Latte.Constructors.Window.Window.Pages.Parent.Top
local Linear = Latte.Modules.TweenInfo.Linear(Latte.Modules.Stylesheet.Duration.Short)
local SearchComp = script.SearchComp:Clone()
local UICorner = Instance.new("UICorner")
local Searchbox = script.SearchBox:Clone()
local QuitSearch = nil
UICorner.CornerRadius = UDim.new(0, 6)
SearchComp.Visible = false
Searchbox.Visible = false
UICorner.Parent = SearchComp
Searchbox.Parent = Top
SearchComp.Parent = Top.Parent
Searchbox.Input:GetPropertyChangedSignal("Text"):Connect(function()
if #Packages == 0 then fetch() end
for _, v in pairs(SearchComp.Container:GetChildren()) do
if v:IsA("TextButton") then
v:Destroy()
end
end
if string.len(Searchbox.Input.Text) >= 1 then
local matcher = Latte.Modules.Matcher.new(Packages, true, true)
for i, v in pairs(matcher:match(Searchbox.Input.Text)) do
if i <= 3 then
local Location = Latte.Constructors.Window.Window.Pages.Server:FindFirstChild(v) and Latte.Constructors.Window.Window.Pages.Server or Latte.Constructors.Window.Window.Pages.Players
local Item = script.Item:Clone()
Item.Name, Item.Title.Text = v, v
Item.MouseButton1Click:Connect(function()
Active = false
Searchbox.Visible = false
SearchComp.Visible = false
Searchbox.Input.Text = ""
Latte.Constructors.Window.SwitchPage(Location.Name)
Latte.Constructors.Window.Window.Menu.setActive(Location.Name)
wait(Latte.Modules.Stylesheet.Duration.Short)
Location.CanvasPosition = Vector2.new(0, 0)
-- TODO: Find a better way to do this, the current method is pretty hardcoded.
Latte.Modules.Tween.new(Location, Latte.Modules.TweenInfo.Quint(Latte.Modules.Stylesheet.Duration.Short) ,{CanvasPosition = Vector2.new(0, Location:FindFirstChild(v).AbsolutePosition.Y - 155)})
end)
Item.LayoutOrder = i
Item.Parent = SearchComp.Container
end
end
end
end)
QuitSearch = Latte.Components.RoundButton.new("Exit", "rbxassetid://6235536018", Searchbox, function()
Active = false
Searchbox.Visible = false
SearchComp.Visible = false
end)
Latte.Constructors.Window.Window.newButton("Search", "rbxassetid://6521439400", "Right", 0, function()
Active = true
Searchbox.Input:CaptureFocus()
Searchbox.Visible = true
SearchComp.Visible = true
end).Image.Size = UDim2.new(0.35, 0, 0.35, 0)
QuitSearch.ZIndex = 3
QuitSearch.Image.ImageColor3 = Color3.fromRGB(150, 150, 150)
QuitSearch.Position = UDim2.new(1, 0, 0, 0)
QuitSearch.AnchorPoint = Vector2.new(1, 0)
end
module.init = function()
Latte = module.Latte
Elements = module.Elements
end
return module
|
-- circular buffer implementation. useful to represent fixed size queue
-- adapted from https://gist.github.com/johndgiese/3e1c6d6e0535d4536692
-- we are defining our own __eq, don't need copy and may contain reference
-- to fully-fledged objects, so we don't use a struct
circular_buffer = new_class()
-- params
-- max_length int max length of the buffer
-- state vars
-- _buffer stringify-able data content, with length at most max_length
-- _start_index into index of the oldest inserted entry, and where the circular buffer semantically starts
function circular_buffer:_init(max_length)
assert(max_length >= 1, "circular_buffer:_init: max_length must be a positive integer")
self.max_length = max_length
self._buffer = {}
self._start_index = 1
end
--#if log
function circular_buffer:_tostring()
return "circular_buffer("..self.max_length..", {"..joinstr_table(", ", self._buffer).."})"
end
--#endif
-- two circular buffers are considered equal when they have the same max length,
-- the same buffer size and their reordered content is the same
-- this means two circular buffers may be equal if their contents are circularly
-- the same, but the start index is different
-- if you want to compare a buffer content to a sequence of arbitrary size,
-- you'll need to examine self._buffer itself
function circular_buffer.__eq(lhs, rhs)
if not (getmetatable(lhs) == getmetatable(rhs) and
lhs.max_length == rhs.max_length and
#lhs._buffer == #rhs._buffer) then
return false
end
for i = 1, #lhs._buffer do
-- rely on get to rotate correctly
if lhs:get(i) ~= rhs:get(i) then
return false
end
end
return true
end
function circular_buffer:__len()
return #(self._buffer)
end
function circular_buffer:__ipairs()
-- return iterator function, table, and starting point
return self._stateless_iter, self, 0
end
function circular_buffer:_stateless_iter(i)
i = i + 1
local v = self:get(i)
if v then return i, v end
end
function circular_buffer._rotate_indice(i, n)
return ((i - 1) % n) + 1
end
-- positive values index from oldest to newest, in normal sense (starting with 1)
-- negative values index from newest to oldest, in reverse sense (starting with -1)
function circular_buffer:get(i)
local history_length = #(self._buffer)
if i == 0 or math.abs(i) > history_length then
return nil
elseif i > 0 then
local i_rotated = self._rotate_indice(self._start_index - 1 + i, history_length)
return self._buffer[i_rotated]
else -- i < 0
-- i is increasing in the negative sense, so it's really +i
local i_rotated = self._rotate_indice(self._start_index + i, history_length)
return self._buffer[i_rotated]
end
end
function circular_buffer:is_filled()
return #self._buffer == self.max_length
end
-- push a new element to the buffer and return true iff an old element was replaced
function circular_buffer:push(value)
if self:is_filled() then
local value_to_be_removed = self._buffer[self._start_index]
self._buffer[self._start_index] = value
self._start_index = self._start_index == self.max_length and 1 or self._start_index + 1
return true
else
self._buffer[#(self._buffer) + 1] = value
return false
end
end
function circular_buffer:clear(value)
clear_table(self._buffer)
self._start_index = 1
end
|
local obj = { __gc = true }
setmetatable(obj, obj)
-- Garbage collector
obj.__gc = function(t)
t:stop()
end
-- Metadata
obj.name = "MX"
obj.version = "0.1"
obj.author = "Michael Xander"
obj.homepage = "https://michaelxander.com"
obj.license = "MIT - https://opensource.org/licenses/MIT"
-- Properties
obj.caffeinateStatus = nil
obj.hotkeyToggle = nil
obj.menuBarItem = nil
-- Where to load files from
obj.spoonPath = hs.spoons.scriptPath()
function obj:init() end
local launchbotSets = {
{
name = "Daily",
items = {
"https://mymorningroutine.com",
"https://www.nytimes.com",
"https://www.newyorker.com",
"https://news.ycombinator.com",
"https://reddit.com",
"https://macstories.net",
"https://brettterpstra.com"
}
},
}
function openLaunchbotItems(set)
local selectedSet = hs.fnutils.find(launchbotSets, function(el) return el.name == set end)
if selectedSet then
for _, item in pairs(selectedSet.items) do hs.urlevent.openURL(item) end
else
hs.alert("Launchbot: Set not found")
end
end
function obj:bindHotkeys(mapping)
local spec = {
toggle = hs.fnutils.partial(self.clicked, self),
}
hs.spoons.bindHotkeysToSpec(spec, mapping)
return self
end
function getMenuItems()
return {
{ title = "Caffeinate", fn = function() obj.clicked() end, checked = obj.caffeinateStatus },
{ title = "-" },
{ title = hs.battery.capacity().." mAh, "..hs.battery.cycles(), disabled = true },
{ title = "-" },
{ title = "Launchbot", disabled = true },
{ title = "Daily", fn = function() openLaunchbotItems("Daily") end },
}
end
function obj:start()
self.menuBarItem = hs.menubar.new()
self.menuBarItem:setMenu(function() return getMenuItems() end)
self.menuBarItem:setClickCallback(self.clicked)
if self.hotkeyToggle then
self.hotkeyToggle:enable()
end
self.setDisplay(hs.caffeinate.get("displayIdle"))
return self
end
function obj:stop()
self.menuBarItem:delete()
if self.hotkeyToggle then
self.hotkeyToggle:disable()
end
self.menuBarItem = nil
return self
end
function obj.setDisplay(state)
local icon = "/logo-"..(state and 1 or 0)..".pdf"
obj.menuBarItem:setIcon(obj.spoonPath..icon)
obj.caffeinateStatus = state
end
function obj.clicked()
obj.setDisplay(hs.caffeinate.toggle("displayIdle"))
end
return obj
|
local dir = _DIR
local work_dir = ''
local yml
local os = os()
local install_dir
local class_installer = {}
function class_installer:new (work_dir_)
work_dir = work_dir_
if not file_exist(work_dir_ .. '/package.lua') then
out('package.yml lose,this not a correct package')
return false
end
print('start parse:', work_dir_ .. '/package.yml')
local pStr = file_get_contents(work_dir_ .. '/package.lua')
if not pStr then
print('parse fail,check syntax:', err)
return
end
yml = loadstring(pStr)()
local conf = require('oshine.cwm.conf')
install_dir = conf.install_dir
print(json_encode({ l = 123, gg = 12 }))
print("package parse done:==", json_encode(yml))
if not yml.name then
assert(false, 'no package [name] in package.yml,it is not a correct package.')
end
print('current os:', os)
print('package support platform :', yml.platform or 'mac windows linux')
-- check platform
if not yml.platform or yml.platform == 'all' then
return self
end
for _, v in pairs(str_split(yml.platform, " ")) do
if trim(v) == os then
return self
end
end
assert(false, 'not support your os:' .. os)
end
function class_installer:yml_conf ()
return yml
end
function class_installer:is_installed ()
local ini = require('ini'):new()
local ok = ini.open(install_ini)
if not ok then
out(false, 'can not open ini file,new one.')
return false
end
if ini:key('installed', yml.package_name) == yml.package_name then
out('package:' .. yml.package_name .. ' already installed,', 'you can use -r to reinstall this package.')
return true
end
end
function class_installer:download (source)
end
function class_installer:install_plugs ()
-- check package.yml
print('copy start...')
-- before install
print(pcall(function()
local before = require('install.before')
if before then
before.run()
end
end))
local r, e = copy(work_dir, install_dir .. '/' .. yml.name)
print("copy:===", work_dir, install_dir .. '/' .. yml.name, r, e)
-- before install
pcall(function()
local after = require(yml.name .. '.install.after')
if after then
after.run()
end
end)
-- map cmd
local callback = function(file, is_dir)
print('file callback:===', file, is_dir)
if str_index(file, '.lua') == #file - #'.lua' then
if not is_dir then
local real_file = str_split(str_replace(file, '\\', '/'), '/')
local name = str_split(real_file[#real_file], '.')[1]
local origin_name = name
if os == 'windows' then
-- windows mcd
if str_index(file, 'windows') > -1 then
name = 'windows.' .. name
end
-- cwm cmd oshine/bitmap check
file_put_contents(install_dir .. '/bin/' .. origin_name .. '.cmd', '@echo off \n::Generate by cwm ,do not modify this file \n' ..
'cwm cmd ' .. yml.name .. ' ' .. name)
elseif os == 'linux' or os == 'drawin' then
-- linux and mac cmd
if str_index(file, 'linux') > -1 then
name = 'linux.' .. name
elseif str_index(file, 'drawin') > -1 then
name = 'drawin.' .. name
end
file_put_contents(install_dir .. '/bin/' .. origin_name .. '.sh', '#Generate by cwm ,do not modify this file \n' ..
'cwm cmd ' .. yml.name .. ' ' .. name)
end
end
end
end
file_in_folder(install_dir .. '/' .. yml.name .. '/cmd/', callback)
end
function class_installer:install(dir)
end
return class_installer
|
--
-- Copyright (c) 2007, Trent Gamblin
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
-- -- Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
-- -- Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
-- -- Neither the name of the <organization> nor the
-- names of its contributors may be used to endorse or promote products
-- derived from this software without specific prior written permission.
--
-- THIS SOFTWARE IS PROVIDED BY <copyright holder> ``AS IS'' AND ANY
-- EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-- DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
-- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--
-- constants
BUFFER_WIDTH = 320
BUFFER_HEIGHT = 240
TILE_SIZE = 16
DIRECTION_NORTH = 1
DIRECTION_EAST = 2
DIRECTION_SOUTH = 3
DIRECTION_WEST = 4
MOVE_NONE = 1
MOVE_WANDER = 2
MOVE_WALK = 3
min_battle_dist = 20
max_battle_dist = 50
last_player_x = 0
last_player_y = 0
accumulated_distance = 0
curr_battle_dist = 0
battle_probability = 10
initial_player_pos_set = false
battle_types = {}
num_battle_types = 0
function init_random_battles(min_dist, max_dist, probability)
min_battle_dist = min_dist
max_battle_dist = max_dist
curr_battle_dist = 0
battle_probability = probability
end
function time_for_battle()
if (initial_player_pos_set == false) then
last_player_x, last_player_y = getObjectPosition(1)
accumulated_distance = getAccumulatedDistance()
initial_player_pos_set = true
end
new_player_x, new_player_y = getObjectPosition(1)
if (new_player_x < 0 or new_player_y < 0 or
(new_player_x+TILE_SIZE) >= BUFFER_WIDTH or
(new_player_y+8) >= BUFFER_HEIGHT) then
return false
end
change_x = math.abs(last_player_x - new_player_x)
change_y = math.abs(last_player_y - new_player_y)
if (not (change_x == 0) and not (change_y == 0)) then
change = math.sqrt(change_x*change_x + change_y*change_y)
elseif (not (change_x == 0)) then
change = change_x
else
change = change_y
end
moved = false
if (not (change == 0)) then
moved = true
end
curr_battle_dist = curr_battle_dist + change
curr_battle_dist = curr_battle_dist + accumulated_distance
accumulated_distance = 0
last_player_x = new_player_x
last_player_y = new_player_y
if (curr_battle_dist < min_battle_dist) then
return false
elseif (curr_battle_dist > max_battle_dist) then
curr_battle_dist = 0
return true
elseif (moved) then
n = randint(1000)
if (n <= battle_probability) then
curr_battle_dist = 0
return true
else
return false
end
end
end
-- battle_type is:
-- array of { id, x, y }
function add_battle_type(battle_type)
num_battle_types = num_battle_types + 1
battle_types[num_battle_types] = battle_type
end
function check_battle()
if (time_for_battle()) then
battle_type = randint(num_battle_types)
startBattle(battle_types[battle_type], get_battle_terrain())
accumulated_distance = 0
setAccumulatedDistance(0)
else
setAccumulatedDistance(curr_battle_dist)
end
end
function get_battle_terrain()
x, y = getObjectPosition(1)
x = x + TILE_SIZE/2
l1, l2, l3 = getTileIndices(x/TILE_SIZE+1, y/TILE_SIZE+1)
if (l1 == 127 or l2 == 127 or l3 == 127) then
return "forest"
elseif (l1 == 128 or l2 == 128 or l3 == 128) then
return "plains"
elseif (l1 == 154 or l2 == 154 or l3 == 154) then
return "cave"
elseif (l1 == 2 or l2 == 2 or l3 == 2) then
return "sand"
elseif (l1 == 310 or l2 == 310 or l3 == 310) then
return "inforest"
else
return "ohnoes"
end
end
function dist(x1, y1, x2, y2)
dx = x1 - x2
dy = y1 - y2
return math.sqrt(dx*dx + dy*dy)
end
function closeto(n1, n2)
ACCEPTABLE_DISTANCE = 0.9
if (n1 >= (n2-ACCEPTABLE_DISTANCE) and n1 <= (n2+ACCEPTABLE_DISTANCE)) then
return true
else
return false
end
end
function a_or_and(s)
ss = string.lower(string.sub(s,1,1))
if (ss == "a" or ss == "e" or ss == "i" or ss == "o" or ss == "u") then
return "an"
else
return "a"
end
end
Object = {
MAX_WANDER_DIST = 16,
MIN_WANDER_DIST = 8,
move_type = MOVE_NONE,
number = -1,
x = 0,
y = 0,
startx = 0,
starty = 0,
endx = 0,
endy = 0,
width = TILE_SIZE,
height = 8,
anim_set = nil,
rest = 1000,
next_move = 0
}
function Object:new(o)
o = o or {}
setmetatable(o, self)
self.__index = self
o.startx = o.x
o.starty = o.y
o.destx = o.x
o.desty = o.y
o.rest = o.rest or Object.rest
o.next_move = 0
o.lastx = o.lastx or 0
o.lasty = o.lasty or 0
o.range = o.range or 40
o.width = o.width or 16
o.base_height = o.base_height or 8
o.total_height = o.total_height or 16
addObject(o.x, o.y, o.width, o.base_height, o.total_height);
if (not (o.anim_set == nil)) then
setObjectAnimationSet(o.number, o.anim_set)
end
if (not o.no_input) then
setObjectInputToScriptControlled(o.number);
end
if (not (o.move_type == nil) and (o.move_type == MOVE_WANDER)) then
o:wander()
end
return o
end
function Object:scriptify(o)
o = o or {}
setmetatable(o, self)
self.__index = self
o.startx = o.x
o.starty = o.y
o.destx = o.x
o.desty = o.y
o.rest = o.rest or Object.rest
o.next_move = 0
o.lastx = o.lastx or 0
o.lasty = o.lasty or 0
setObjectInputToScriptControlled(o.number);
if (not (o.move_type == nil) and (o.move_type == MOVE_WANDER)) then
o:wander()
end
return o
end
function Object:rand_wander_dist()
range = Object.MAX_WANDER_DIST - Object.MIN_WANDER_DIST
return math.random() * range + Object.MIN_WANDER_DIST
end
function Object:rand_wander_direction()
r = math.floor(math.random() * 4) + 1
return r
end
function Object:wander()
move_dist = self.rand_wander_dist()
dx = self.x - self.startx
dy = self.y - self.starty
if (math.abs(dx) > self.range or math.abs(dy) > self.range) then
if (dx < -self.range) then
self.destx = self.x + 20
elseif (dx > self.range) then
self.destx = self.x - 20
end
if (dy < -self.range) then
self.desty = self.y + 20
elseif (dy > self.range) then
self.desty = self.y - 20
end
else
dir = self.rand_wander_direction()
if (dir == DIRECTION_NORTH) then
self.desty = self.y - move_dist
elseif (dir == DIRECTION_EAST) then
self.destx = self.x + move_dist
elseif (dir == DIRECTION_SOUTH) then
self.desty = self.y + move_dist
else
self.destx = self.x - move_dist
end
end
if (self.destx < 0) then
self.destx = 0
elseif (self.destx >= (BUFFER_WIDTH-self.width)) then
self.destx = BUFFER_WIDTH-self.width-1
end
if (self.desty < 0) then
self.desty = 0
elseif (self.desty >= (BUFFER_HEIGHT-self.height)) then
self.desty = BUFFER_HEIGHT-self.height-1
end
end
function Object:move(step)
if (self.move_type == self.MOVE_NONE) then
return
end
self.x, self.y = getObjectPosition(self.number)
l = 0
r = 0
u = 0
d = 0
if (closeto(self.x, self.destx)) then
self.x = self.destx
elseif (self.x < self.destx) then
r = 1
else
l = 1
end
if (closeto(self.y, self.desty)) then
self.y = self.desty
elseif (self.y < self.desty) then
d = 1
else
u = 1
end
self.next_move = self.next_move + step
if (self.x == self.destx and self.y == self.desty and self.next_move > self.rest) then
self.next_move = 0
if (self.move_type == MOVE_WANDER) then
self:wander()
end
else
moveObject(self.number, l, r, u, d)
end
if (self.next_move > self.rest) then
if (self.lastx == self.x and self.lasty == self.y) then
self.next_move = 0
if (self.move_type == MOVE_WANDER) then
self:wander()
end
end
end
self.lastx = self.x
self.lasty = self.y
end
Door = {}
function Door:activate()
if (not self.locked and self.count >= 250) then
playSound("door")
self.count = 0
setObjectSolid(self.number, not objectIsSolid(self.number))
if (objectIsSolid(self.number)) then
--if (objectIsColliding(self.number)) then
if (objectsAreColliding(self.number, 1)) then
setObjectSolid(self.number, false)
else
advanceObjectAnimation(self.number)
end
else
advanceObjectAnimation(self.number)
end
end
end
function Door:update(step)
self.count = self.count + step
end
function Door:new(o)
o = Object:new(o)
o.activate = Door.activate
o.update = Door.update
o.locked = o.locked or false
o.count = 0
setObjectAnimated(o.number, false)
return o
end
Chest = {}
function Chest:activate()
if (not self.open) then
if (self.itemtype == ITEM_GOLD) then
advanceObjectAnimation(self.number)
giveGold(self.quantity)
setMilestone(self.milestone, true)
msg = "You found " .. self.quantity .. " gold!$";
playSound("give")
doPickupMessage(msg)
self.open = true
else
i = findInventoryItem(self.id)
if (i < 0) then
i = findFirstEmptyInventorySlot()
if (i < 0) then
doMessage("You can't carry anything else...$")
else
advanceObjectAnimation(self.number)
setInventory(i, self.id, self.quantity)
setMilestone(self.milestone, true)
playSound("give")
if (self.quantity > 1) then
msg = "You found " .. self.quantity .. " " .. item_names[self.id] .. "s!$"
doPickupMessage(msg)
else
msg = "You found " .. a_or_and(item_names[self.id]) .. " " .. item_names[self.id] .. "!$"
doPickupMessage(msg)
end
self.open = true
end
else
advanceObjectAnimation(self.number)
addToInventory(i, self.quantity)
playSound("give")
if (self.quantity > 1) then
msg = "You found " .. self.quantity .. " " .. item_names[self.id] .. "s!$"
doPickupMessage(msg)
else
msg = "You found " .. a_or_and(item_names[self.id]) .. " " .. item_names[self.id] .. "!$"
doPickupMessage(msg)
end
setMilestone(self.milestone, true)
self.open = true
end
end
end
end
function Chest:new(o)
o = Object:new(o)
o.activate = Chest.activate
o.open = checkMilestone(o.milestone)
if (o.open) then
advanceObjectAnimation(o.number)
end
o.itemtype = o.itemtype or ITEM_ITEM
o.id = o.id or 0
o.quantity = o.quantity or 1
setObjectAnimated(o.number, false)
return o
end
StillBird = {}
function StillBird:update(step)
self.change_count = self.change_count - step
if (self.change_count <= 0) then
self.direction = randint(4)
setObjectSubAnimation(self.number, self.direction)
self.change_count = randint(4000) + 1000
end
self.chirp_count = self.chirp_count - step
if (self.chirp_count <= 0) then
playSound("chirp")
self.chirp_count = randint(5000) + 5000
end
end
function StillBird:new(o)
o = Object:new(o)
o.update = StillBird.update
o.direction = randint(4)
setObjectSubAnimation(o.number, o.direction)
setObjectAnimated(o.number, false)
o.change_count = randint(4000) + 1000
o.chirp_count = randint(5000)
setObjectHigh(o.number)
return o;
end
FlyingBird = {}
function FlyingBird:fly()
self.flying = true
if (self.direction == 1) then
self.direction = 2
else
self.direction = 1
end
if (self.direction == 1) then
self.y = BUFFER_HEIGHT-self.height
self.speed = -0.08
else
self.y = 0
self.speed = 0.08
end
setObjectSubAnimation(self.number, self.direction)
if (randint(2) == 1) then
self.xinc = -(math.random()*0.04+0.02)
else
self.xinc = math.random()*0.04+0.02
end
self.x = (150-randint(300))+BUFFER_WIDTH/2
end
function FlyingBird:update(step)
if (self.flying) then
self.y = self.y + self.speed * step
self.x = self.x + self.xinc * step
if (self.y <= 0 or self.x <= 0 or self.y+self.height >= BUFFER_HEIGHT
or self.x+self.width >= BUFFER_WIDTH) then
self.flying = false
self.wait = 10000
setObjectHidden(self.number, true)
end
setObjectPosition(self.number, self.x, self.y)
else
self.wait = self.wait - step
if (self.wait <= 0) then
self:fly()
setObjectPosition(self.number, self.x, self.y)
setObjectHidden(self.number, false)
end
end
end
function FlyingBird:new(o)
o = Object:new(o)
o.update = FlyingBird.update
o.fly = FlyingBird.fly
if (o.direction == nil) then
o.direction = randint(2)
elseif (o.direction == 1) then
o.direction = 2
else
o.direction = 1
end
setObjectSolid(o.number, false)
setObjectHigh(o.number, true)
o:fly()
o:update(1)
return o
end
Duck = {}
function Duck:update(step)
self.x = self.x + self.speed * step
setObjectPosition(self.number, self.x, self.y)
if (self.direction == DIRECTION_EAST) then
tx = (self.x + self.width) / TILE_SIZE
else
tx = self.x / TILE_SIZE
end
ty = (self.y + self.height/2) / TILE_SIZE
if (not tileIsSolid(tx, ty)) then
self.speed = - self.speed;
if (self.direction == DIRECTION_EAST) then
setObjectSubAnimation(self.number, 2)
self.direction = DIRECTION_WEST
else
setObjectSubAnimation(self.number, 1)
self.direction = DIRECTION_EAST
end
end
end
function Duck:new(o)
o = Object:new(o)
o.update = Duck.update
if (o.direction == DIRECTION_WEST) then
setObjectSubAnimation(o.number, 2)
o.speed = -0.01
else
o.speed = 0.01
end
setObjectAnimated(o.number, false)
setObjectSolid(o.number, false)
return o;
end
|
function f1()
function f2()
function f3()
-- body
end
end
end
|
local Snowflake = require('../Snowflake')
local format = string.format
local Emoji, property = class('Emoji', Snowflake)
Emoji.__description = "Represents a custom Discord emoji."
function Emoji:__init(data, parent)
Snowflake.__init(self, data, parent)
end
function Emoji:__tostring()
return format('%s: %s', self.__name, self._name)
end
local function getString(self)
return format('<:%s:%s>', self._name, self._id)
end
local function getUrl(self)
return format("https://discordapp.com/api/emojis/%s.png", self._id)
end
property('name', '_name', nil, 'string', "Emoji name")
property('guild', '_parent', nil, 'Guild', "Discord guild in which the emoji exists")
property('managed', '_managed', nil, 'boolean', "Whether the emoji is managed by an integration")
property('requireColons', '_require_colons', nil, 'boolean', "Whether the emoji must be wrapped by colons")
property('string', getString, nil, 'string', "Discord client resolveable string similar to a mentionString")
property('url', getUrl, nil, 'string', "URL that points to the emoji's image file")
return Emoji
|
local Screen, Menu, FileRequester = require("screen"), require("menu"), require("filerequester")
local scrn, anim, frame, filename, saved, history
local canvasvp, toolbarvp, palettevp, sidebarvp
local updateagain, icons, wpaper, menu, crosshair, nopointer
local tools = {"move", "brush", "picker", "select", "fill", "line", "circle", "box"}
local tool, fgcolor, bgcolor, brushsize
local brushmode, brushmasked, brushcolor, brush = 3, true, 1024, nil
local startx, starty
local clipx, clipy, clipw, cliph = 0, 0, 1, 1
local globalpal, fixedfps = true, true
local playing = false
function _init(args)
scrn = Screen:new("Loading..", 10, 2)
gfx.fgcolor(0)
gfx.bar(0, 0, 2, 2)
gfx.fgcolor(1)
gfx.bar(0, 0, 1, 1)
gfx.bar(1, 1, 1, 1)
wpaper = image.new(2, 2, 1)
image.copy(wpaper, 0, 0, 0, 0, 2, 2)
icons = image.load(_DIR .. "paint.gif")
local sw, sh = view.size(scrn.rootvp)
local hk = sh / 240
menu = {
{
label = "File",
menu = {
{label = "Load..", action = reqload, hotkey = "l"},
{label = "Save", action = save, hotkey = "s"},
{label = "Save as..", action = reqsave},
{label = "Quit", action = quit, hotkey = "q"}
}
},
{
label = "Brush",
onopen = updatebrushmenu,
menu = {
{label = "Masked", _masked = true, action = reqbrushmode, hotkey = "m"},
{
label = "Bitwise",
onopen = updatebrushmenu,
menu = {
{label = "Zero", _mode = 0, action = reqbrushmode},
{label = "ConNonimpl", _mode = 1, action = reqbrushmode},
{label = "And", _mode = 2, action = reqbrushmode},
{label = "Source", _mode = 3, action = reqbrushmode, hotkey = "0"},
{label = "MatNonimpl", _mode = 4, action = reqbrushmode},
{label = "Xor", _mode = 5, action = reqbrushmode},
{label = "Dest", _mode = 6, action = reqbrushmode},
{label = "Or", _mode = 7, action = reqbrushmode},
{label = "Not", _mode = 8, action = reqbrushmode}
}
},
{
label = "Index math",
onopen = updatebrushmenu,
menu = {
{label = "Min", _mode = 9, action = reqbrushmode},
{label = "Max", _mode = 10, action = reqbrushmode},
{label = "Average", _mode = 11, action = reqbrushmode},
{label = "Add", _mode = 12, action = reqbrushmode},
{label = "Subtract", _mode = 13, action = reqbrushmode},
{label = "Multiply", _mode = 14, action = reqbrushmode},
{label = "Divide", _mode = 15, action = reqbrushmode}
}
},
{
label = "Color",
onopen = updatebrushmenu,
menu = {
{label = "Error diffusion", _errdiff = true, action = toggleerrdiff},
{label = "Background", _mode = 16, action = reqbrushmode},
{label = "Foreground", _mode = 17, action = reqbrushmode, hotkey = "8"},
{label = "Src bg", _mode = 18, action = reqbrushmode},
{label = "Source", _mode = 20, action = reqbrushmode, hotkey = "9"},
{label = "Darker", _mode = 21, action = reqbrushmode},
{label = "Lighter", _mode = 22, action = reqbrushmode},
{label = "Average", _mode = 23, action = reqbrushmode},
{label = "Add", _mode = 24, action = reqbrushmode},
{label = "Subtract", _mode = 25, action = reqbrushmode},
{label = "Multiply", _mode = 26, action = reqbrushmode},
{label = "Hue", _mode = 28, action = reqbrushmode},
{label = "Saturation", _mode = 29, action = reqbrushmode},
{label = "Lightness", _mode = 30, action = reqbrushmode},
{label = "Grayness", _mode = 31, action = reqbrushmode}
}
}
}
},
{
label = "Anim",
onopen = updateanimmenu,
menu = {
{label = "Global palette", action = toggleglobalpal},
{label = "Fixed framerate", action = togglefixedfps},
{label = "Insert frame", action = insertframe, hotkey = "n"},
{label = "Remove frame", action = removeframe, hotkey = "e"},
{label = "Clear frame", action = clearframe, hotkey = "k"}
}
},
{
label = "Screen",
menu = {
{
label = "Size",
onopen = updatesizemenu,
menu = {
{label = " 80x" .. math.floor(60 * hk), _mode = 0, action = reqmode, hotkey = "1"},
{label = "160x" .. math.floor(60 * hk), _mode = 1, action = reqmode},
{label = "320x" .. math.floor(60 * hk), _mode = 2, action = reqmode},
{label = "640x" .. math.floor(60 * hk), _mode = 3, action = reqmode},
{label = " 80x" .. math.floor(120 * hk), _mode = 4, action = reqmode},
{label = "160x" .. math.floor(120 * hk), _mode = 5, action = reqmode, hotkey = "2"},
{label = "320x" .. math.floor(120 * hk), _mode = 6, action = reqmode},
{label = "640x" .. math.floor(120 * hk), _mode = 7, action = reqmode},
{label = " 80x" .. math.floor(240 * hk), _mode = 8, action = reqmode},
{label = "160x" .. math.floor(240 * hk), _mode = 9, action = reqmode},
{label = "320x" .. math.floor(240 * hk), _mode = 10, action = reqmode, hotkey = "3"},
{label = "640x" .. math.floor(240 * hk), _mode = 11, action = reqmode},
{label = " 80x" .. math.floor(480 * hk), _mode = 12, action = reqmode},
{label = "160x" .. math.floor(480 * hk), _mode = 13, action = reqmode},
{label = "320x" .. math.floor(480 * hk), _mode = 14, action = reqmode},
{label = "640x" .. math.floor(480 * hk), _mode = 15, action = reqmode, hotkey = "4"}
}
},
{
label = "Colors",
onopen = updatecolorsmenu,
menu = {
{label = " 2", _bpp = 1, action = reqbpp},
{label = " 4", _bpp = 2, action = reqbpp},
{label = " 8", _bpp = 3, action = reqbpp},
{label = " 16", _bpp = 4, action = reqbpp},
{label = " 32", _bpp = 5, action = reqbpp},
{label = " 64", _bpp = 6, action = reqbpp},
{label = "128", _bpp = 7, action = reqbpp},
{label = "256", _bpp = 8, action = reqbpp}
}
},
{label = "Hide cursor", action = togglepointer, hotkey = "h"}
}
}
}
menu = scrn:attachwindow("menu", Menu:new(menu))
menu.onopen = function()
return view.focused(canvasvp) == false and view.focused(palettevp) == false
end
filename = "user:"
anim = {}
history = {}
frame = 1
tool = 2
bgcolor = 0
fgcolor = 15
brushsize = 1
brush = image.new(brushsize, brushsize, 8)
canvasvp = view.new(scrn.rootvp, 0, 0, 32, 32)
crosshair = makepointer()
nopointer = image.new(1, 1, 2)
toolbarvp = view.new(scrn.rootvp, 0, 0, 10, #icons * 9 + 1)
sidebarvp = view.new(scrn.rootvp, 0, 0, 1, 1)
palettevp = view.new(scrn.rootvp, 0, 0, 1, 1)
view.zindex(scrn.titlevp, -1)
sys.stepinterval(-2)
loadanim(args[1] or "user:new.gif")
end
function _step(t)
if playing then
frame = frame + 1
if frame > #anim then
frame = 1
end
if not globalpal then
scrn:usepalette(anim[frame])
end
scrn:title(
filename ..
"[" ..
frame ..
"/" .. #anim .. " " .. image.duration(anim[fixedfps and 1 or frame]) .. "ms]" .. (saved and "" or " *")
)
view.active(canvasvp)
local iw, ih = image.size(anim[frame])
image.draw(anim[frame], 0, 0, 0, 0, iw, ih)
sys.stepinterval(image.duration(anim[fixedfps and 1 or frame]))
if #anim <= 1 then
view.active(scrn.rootvp)
input.text("5")
end
end
if updateagain then
updateui()
end
view.active(scrn.rootvp)
local key = input.text()
input.text("")
if key == "1" then
frame = 1
elseif key == "2" then
if frame > 1 then
frame = frame - 1
else
frame = #anim
end
elseif key == "3" then
if frame < #anim then
frame = frame + 1
else
frame = 1
end
elseif key == "4" then
frame = #anim
elseif key == "5" then
playing = not playing
sys.stepinterval(-2)
elseif key == "6" then
local f = fixedfps and 1 or frame
if image.duration(anim[f]) >= 10 then
makeuniq(f)
image.duration(anim[f], math.abs(image.duration(anim[f]) - 10))
end
elseif key == "7" then
local f = fixedfps and 1 or frame
makeuniq(f)
image.duration(anim[f], image.duration(anim[f]) + 10)
elseif key == "-" then
if brushsize > 1 then
brushsize = brushsize - 1
end
brushcolor = 1024
elseif key == "+" then
brushsize = brushsize + 1
brushcolor = 1024
elseif key == "r" then
ramppalette(bgcolor, fgcolor)
elseif key == " " then
settool("move")
elseif key == "b" then
settool("brush")
elseif key == "x" then
settool("box")
else
if key ~= "" then
for i, v in ipairs(tools) do
if string.sub(v, 1, #key) == key then
tool = i
end
end
end
end
if key ~= "" then
updateui()
end
key = input.hotkey()
if key == "z" then
undo()
end
stepui(t)
stepcanvas(t)
scrn:step(t)
autohideui()
if view.focused(canvasvp) == true or view.focused(palettevp) == true then
menu:close()
end
end
function reqload()
if scrn.children["req"] then
return
end
local req = FileRequester:new("Load GIF..", {".gif"}, filename .. "/../")
req.ondone = function(self, filename)
if filename then
loadanim(filename)
end
end
scrn:attachwindow("req", req)
end
function loadanim(_filename)
playing = false
sys.stepinterval(-2)
for i, img in ipairs(anim) do
pcall(image.forget, img)
end
while #history > 0 do
for i, v in ipairs(history[1]) do
pcall(image.forget, v)
end
table.remove(history, 1)
end
filename = _filename
anim = image.load(filename) or {defaultimage()}
frame = 1
local iw, ih = image.size(anim[frame])
view.size(canvasvp, iw, ih)
local mode, bpp = scrn:mode()
screenmode(mode, minbpp(anim))
globalpal = hasglobalpal(anim)
fixedfps = hasfixedfps(anim)
commit()
saved = true
end
function reqsave()
if scrn.children["req"] then
return
end
local req = FileRequester:new("Save GIF..", {".gif"}, filename .. "/../")
req.ondone = function(self, filename)
if filename then
saveanim(filename)
end
end
scrn:attachwindow("req", req)
end
function save()
saveanim(filename)
end
function saveanim(_filename)
filename = _filename or filename
if globalpal and not hasglobalpal(anim) then
for i, v in ipairs(anim) do
makeuniq(i)
end
end
if fixedfps then
local ms = image.duration(anim[1])
for i, v in ipairs(anim) do
if image.duration(v) ~= ms then
makeuniq(i)
image.duration(anim[i], ms)
end
end
end
image.save(filename, anim)
saved = true
updateagain = true
end
function quit()
sys.exit()
end
function updatesizemenu(struct)
local mode, bpp = scrn:mode()
for i, item in ipairs(struct.menu) do
item.checked = mode == item._mode
end
end
function updatecolorsmenu(struct)
local mode, bpp = scrn:mode()
for i, item in ipairs(struct.menu) do
item.checked = bpp == item._bpp
end
end
function updatebrushmenu(struct)
for i, item in ipairs(struct.menu) do
item.checked = brushmode == item._mode
if item._masked then
item.checked = brushmasked
end
if item._errdiff then
view.active(canvasvp)
item.checked = image.errordiffusion()
end
end
end
function updateanimmenu(struct)
struct.menu[1].checked = globalpal
struct.menu[2].checked = fixedfps
end
function reqmode(struct)
local mode, bpp = scrn:mode()
screenmode(struct._mode, bpp)
end
function reqbpp(struct)
local mode, bpp = scrn:mode()
screenmode(mode, struct._bpp)
end
function reqbrushmode(struct)
if struct._masked then
brushmasked = not brushmasked
else
brushmode = struct._mode
end
end
function toggleglobalpal(struct)
globalpal = not globalpal
updateui()
end
function togglefixedfps(struct)
fixedfps = not fixedfps
updateui()
end
function togglepointer(struct)
struct.checked = not struct.checked
view.active(canvasvp)
if struct.checked then
image.pointer(nopointer)
else
image.pointer(crosshair, 5, 5)
end
end
function toggleerrdiff(struct)
view.active(canvasvp)
image.errordiffusion(not image.errordiffusion())
end
function insertframe()
table.insert(anim, frame, makeuniq(frame))
commit()
frame = frame + 1
updateui()
end
function removeframe()
if #anim > 1 then
table.remove(anim, frame)
commit()
end
if frame > #anim then
frame = #anim
end
updateui()
end
function clearframe()
view.active(canvasvp)
makeuniq(frame)
gfx.cls()
copycanvas(anim[frame])
commit()
updateui()
end
function screenmode(mode, bpp)
scrn:mode(mode, bpp)
local sw, sh = view.size(scrn.rootvp)
view.position(scrn.mainvp, 0, 0)
view.size(scrn.mainvp, sw, sh)
view.position(scrn.titlevp, 0, 0)
view.position(toolbarvp, 0, 16)
local vw, vh = view.size(canvasvp)
view.position(canvasvp, (sw - vw) / 2, (sh - vh) / 2)
view.position(palettevp, 0, 0)
view.size(palettevp, sw, sh)
view.position(sidebarvp, 0, 0)
view.size(sidebarvp, 24, sh)
updateui()
updateagain = true
end
function updateui()
scrn:usepalette(anim[globalpal and 1 or frame])
scrn:autocolor()
scrn:title(
filename ..
"[" ..
frame .. "/" .. #anim .. " " .. image.duration(anim[fixedfps and 1 or frame]) .. "ms]" .. (saved and "" or " *")
)
local mode, bpp = scrn:mode()
local sw, sh = view.size(scrn.rootvp)
local x, y, s = 0, 0, 0
if updateagain then
view.active(scrn.mainvp)
image.copymode(20)
image.draw(wpaper, 0, 0, 0, 0, sw, sh)
end
view.active(toolbarvp)
gfx.bgcolor(scrn.darkcolor)
gfx.fgcolor(scrn.lightcolor)
gfx.cls()
image.copymode(20)
x, y = 1, 1
for i = 1, #icons do
if tool == i then
gfx.bar(x - 1, y - 1, 1, 10)
image.draw(icons[i], x + 1, y, 0, 0, 8, 8)
else
image.draw(icons[i], x, y, 0, 0, 8, 8)
end
y = y + 9
end
view.active(sidebarvp)
gfx.bgcolor(scrn.darkcolor)
gfx.cls()
local f = globalpal and 1 or frame
local r, g, b = scrn:palette(fgcolor)
x, y = view.size(sidebarvp)
gfx.fgcolor(gfx.nearestcolor(0, 15, 15))
gfx.bar(0, 0, 8, y)
gfx.fgcolor(gfx.nearestcolor(15, 0, 15))
gfx.bar(8, 0, 8, y)
gfx.fgcolor(gfx.nearestcolor(15, 15, 0))
gfx.bar(16, 0, 8, y)
gfx.fgcolor(gfx.nearestcolor(15, 0, 0))
gfx.bar(0, (1 - r / 15) * y, 8, y)
gfx.fgcolor(gfx.nearestcolor(0, 15, 0))
gfx.bar(8, (1 - g / 15) * y, 8, y)
gfx.fgcolor(gfx.nearestcolor(0, 0, 15))
gfx.bar(16, (1 - b / 15) * y, 8, y)
gfx.fgcolor(scrn.darkcolor)
gfx.bar(0, (1 - r / 15) * y - 2, 8, 4)
gfx.bar(8, (1 - g / 15) * y - 2, 8, 4)
gfx.bar(16, (1 - b / 15) * y - 2, 8, 4)
gfx.fgcolor(fgcolor)
gfx.bar(0 + 1, (1 - r / 15) * y - 1, 6, 2)
gfx.bar(8 + 1, (1 - g / 15) * y - 1, 6, 2)
gfx.bar(16 + 1, (1 - b / 15) * y - 1, 6, 2)
view.active(canvasvp)
local iw, ih = image.size(anim[frame])
view.size(canvasvp, iw, ih)
image.copymode(3)
image.draw(anim[frame], 0, 0, 0, 0, iw, ih)
bgcolor = gfx.bgcolor(image.bgcolor(anim[globalpal and 1 or frame]))
view.active(palettevp)
x, y = view.size(palettevp)
image.copymode(20)
image.draw(wpaper, 0, 0, x, y, sw, sh)
image.copymode(3)
s = math.min(math.max(3, math.floor(sw / 32)), 10)
x, y = 0, 1
for i = 0, math.pow(2, bpp) - 1 do
if x > sw - s then
x = 0
y = y + s
end
gfx.fgcolor(i)
local d = (fgcolor == i and -1 or (bgcolor == i and 1 or 0))
gfx.bar(x + d, y + d, s, s)
x = x + s
end
x, y = view.size(palettevp, sw, y + s)
view.size(sidebarvp, 24, sh - y - 11)
local gm, gc = view.screenmode(scrn.rootvp)
local lm, lc = view.screenmode(canvasvp)
updateagain = (gm ~= lm) or (gc ~= lc)
end
function autohideui()
view.active(scrn.rootvp)
local mx, my, mb = input.mouse()
if mb > 0 or menu.struct.vp or scrn.children["req"] then
return
end
local sw, sh = view.size(scrn.rootvp)
local vw, vh, foc
local focs = 0
local x, y, smy = 0, 0, my
view.active(canvasvp)
vw, vh = view.size(canvasvp)
local cl, ct = view.position(canvasvp)
local cr, cb = sw - vw - cl, sh - vh - ct
mx, my, mb = input.mouse()
if mx >= 0 and my >= 0 and mx < vw and my < vh then
foc = canvasvp
end
view.active(scrn.titlevp)
vw, vh = view.size(scrn.titlevp)
mx, my, mb = input.mouse()
if my > vh then
if ct < vh then
view.position(scrn.titlevp, 0, -vh)
end
else
view.position(scrn.titlevp, 0, 0)
foc = scrn.titlevp
focs = focs + 1
end
view.active(toolbarvp)
vw, vh = view.size(toolbarvp)
mx, my, mb = input.mouse()
if vh < sh then
y = (1 / 2) * (sh - vh)
else
y = (smy / sh) * (sh - vh)
end
if mx > vw then
if cl < vw then
view.position(toolbarvp, -vw, y)
end
else
view.position(toolbarvp, 0, y)
foc = toolbarvp
focs = focs + 1
end
view.active(sidebarvp)
vw, vh = view.size(sidebarvp)
mx, my, mb = input.mouse()
if mx < -1 then
if cr < vw then
view.position(sidebarvp, sw, 11)
end
else
view.position(sidebarvp, sw - vw, 11)
foc = sidebarvp
focs = focs + 1
end
view.active(palettevp)
vw, vh = view.size(palettevp)
mx, my, mb = input.mouse()
if my < -1 then
if cb < vh then
view.position(palettevp, 0, sh)
end
else
view.position(palettevp, 0, sh - vh)
foc = palettevp
focs = focs + 1
end
if focs == 1 then
view.zindex(foc, -1)
end
if foc == scrn.titlevp then
foc = scrn.mainvp
end
if foc and view.focused(foc) == false then
view.focused(foc, true)
updateui()
end
end
function stepui(t)
local mx, my, mb
view.active(palettevp)
mx, my, mb = input.mouse()
if mb == 1 then
fgcolor = gfx.pixel(mx, my)
view.active(canvasvp)
gfx.fgcolor(fgcolor)
updateui()
end
if mb == 2 then
bgcolor = gfx.pixel(mx, my)
view.active(canvasvp)
gfx.bgcolor(bgcolor)
image.bgcolor(anim[globalpal and 1 or frame], bgcolor)
updateui()
end
view.active(toolbarvp)
mx, my, mb = input.mouse()
if mb == 1 then
tool = math.floor(my / 9) + 1
startx, starty = nil, nil
updateui()
end
view.active(sidebarvp)
local vw, vh = view.size(sidebarvp)
mx, my, mb = input.mouse()
my = my - vh / 32
if mb == 1 then
local f = globalpal and 1 or frame
local r, g, b = image.palette(makeuniq(f), fgcolor)
local ch = math.floor(mx / (vw / 3))
if ch == 0 then
image.palette(anim[f], fgcolor, (1 - my / vh) * 15, g, b)
elseif ch == 1 then
image.palette(anim[f], fgcolor, r, (1 - my / vh) * 15, b)
elseif ch == 2 then
image.palette(anim[f], fgcolor, r, g, (1 - my / vh) * 15)
end
updateui()
end
end
function stepcanvas(t)
view.active(canvasvp)
local mx, my, mb = input.mouse()
if tools[tool] == "move" then
local vx, vy = view.position(canvasvp)
local vw, vh = view.size(canvasvp)
local iw, ih = image.size(anim[frame])
if mb == 1 then
if startx then
view.position(canvasvp, vx + mx - startx, vy + my - starty)
else
startx, starty = mx, my
end
elseif mb == 2 then
if not startx then
clipx, clipy = (mx - vw / 2) / vw, (my - vh / 2) / vh
if math.abs(clipx) > math.abs(clipy) then
clipy = 0
else
clipx = 0
end
startx, starty = 0, 0
end
if clipx > 0 then
view.size(canvasvp, mx, vh)
elseif clipy > 0 then
view.size(canvasvp, vw, my)
elseif clipx < 0 then
startx = startx - mx
view.size(canvasvp, vw - mx, vh)
view.position(canvasvp, vx + mx, vy)
elseif clipy < 0 then
starty = starty - my
view.size(canvasvp, vw, vh - my)
view.position(canvasvp, vx, vy + my)
end
gfx.cls()
image.draw(anim[frame], startx, starty, 0, 0, iw, ih)
else
if clipx and startx then
resizeanim(startx, starty, vw - iw - startx, vh - ih - starty)
commit()
end
clipx, clipy = nil, nil
startx, starty = nil, nil
end
elseif tools[tool] == "brush" then
local iw, ih = image.size(anim[frame])
if mb > 0 then
if mb > 1 then
updatebrush(gfx.fgcolor(bgcolor))
else
updatebrush(gfx.fgcolor(fgcolor))
end
if startx then
paintline(startx, starty, mx, my, 1)
else
makeuniq()
image.copymode(brushmode, brushmasked)
paintat(mx, my)
end
startx, starty = mx, my
else
image.copymode(3)
if startx then
copycanvas(anim[frame])
commit()
end
image.draw(anim[frame], 0, 0, 0, 0, iw, ih)
image.copymode(brushmode, brushmasked)
updatebrush(gfx.fgcolor(fgcolor))
paintat(mx, my)
startx, starty = nil, nil
end
elseif tools[tool] == "picker" then
if mb == 1 then
fgcolor = gfx.pixel(mx, my)
gfx.fgcolor(fgcolor)
updateui()
end
if mb == 2 then
bgcolor = gfx.pixel(mx, my)
gfx.bgcolor(bgcolor)
image.bgcolor(anim[frame], bgcolor)
updateui()
end
elseif tools[tool] == "select" then
local iw, ih = image.size(anim[frame])
if mb > 0 then
if startx then
image.copymode(3)
image.draw(anim[frame], 0, 0, 0, 0, iw, ih)
gfx.fgcolor(scrn.darkcolor)
gfx.line(startx - 1, starty - 1, mx, starty - 1)
gfx.line(startx - 1, starty - 1, startx - 1, my)
gfx.line(startx - 1, my, mx, my)
gfx.line(mx, starty - 1, mx, my)
gfx.fgcolor(scrn.lightcolor)
gfx.line(startx - 2, starty - 2, mx + 1, starty - 2)
gfx.line(startx - 2, starty - 2, startx - 2, my + 1)
gfx.line(startx - 2, my + 1, mx + 1, my + 1)
gfx.line(mx + 1, starty - 2, mx + 1, my + 1)
else
makeuniq()
startx, starty = mx, my
end
else
image.copymode(3)
image.draw(anim[frame], 0, 0, 0, 0, iw, ih)
if startx then
clipx, clipy = math.max(0, math.min(mx, startx)), math.max(0, math.min(my, starty))
clipw, cliph = math.min(iw, math.abs(mx - startx)), math.min(ih, math.abs(my - starty))
image.forget(brush)
brush = image.new(clipw, cliph, 8)
image.copy(brush, clipx, clipy, 0, 0, clipw, cliph)
image.copypalette(brush)
image.bgcolor(brush, bgcolor)
brushcolor = clipw == 0 or cliph == 0
settool("brush")
updateui()
end
-- image.copymode(brushmode, brushmasked)
-- updatebrush(gfx.fgcolor(fgcolor))
-- paintat(mx, my)
startx, starty = nil, nil
end
elseif tools[tool] == "fill" then
if mb > 0 then
if mb > 1 then
gfx.fgcolor(bgcolor)
else
gfx.fgcolor(fgcolor)
end
makeuniq()
local target = gfx.pixel(mx, my)
local pool = {{mx, my}}
if gfx.fgcolor() == target then
table.remove(pool)
end
local iw, ih = image.size(anim[frame])
while #pool > 0 do
local p = table.remove(pool)
if gfx.pixel(p[1], p[2]) == target and p[1] >= 0 and p[2] >= 0 and p[1] < iw and p[2] < ih then
gfx.plot(p[1], p[2])
table.insert(pool, {p[1], p[2] - 1})
table.insert(pool, {p[1], p[2] + 1})
table.insert(pool, {p[1] - 1, p[2]})
table.insert(pool, {p[1] + 1, p[2]})
end
end
startx, starty = mx, my
else
if startx then
copycanvas(anim[frame])
commit()
end
startx, starty = nil, nil
end
elseif tools[tool] == "line" then
local iw, ih = image.size(anim[frame])
if mb > 0 then
if mb > 1 then
updatebrush(gfx.fgcolor(bgcolor))
else
updatebrush(gfx.fgcolor(fgcolor))
end
if startx then
image.copymode(3)
image.draw(anim[frame], 0, 0, 0, 0, iw, ih)
image.copymode(brushmode, brushmasked)
paintline(startx, starty, mx, my)
else
makeuniq()
image.copymode(brushmode, brushmasked)
paintat(mx, my)
startx, starty = mx, my
end
else
image.copymode(3)
if startx then
copycanvas(anim[frame])
commit()
end
image.draw(anim[frame], 0, 0, 0, 0, iw, ih)
image.copymode(brushmode, brushmasked)
updatebrush(gfx.fgcolor(fgcolor))
paintat(mx, my)
startx, starty = nil, nil
end
elseif tools[tool] == "circle" then
local iw, ih = image.size(anim[frame])
if mb > 0 then
if mb > 1 then
updatebrush(gfx.fgcolor(bgcolor))
else
updatebrush(gfx.fgcolor(fgcolor))
end
if startx then
image.copymode(3)
image.draw(anim[frame], 0, 0, 0, 0, iw, ih)
image.copymode(brushmode, brushmasked)
paintcircle(startx, starty, mx - startx, my - starty)
else
makeuniq()
image.copymode(brushmode, brushmasked)
paintat(mx, my)
startx, starty = mx, my
end
else
image.copymode(3)
if startx then
copycanvas(anim[frame])
commit()
end
image.draw(anim[frame], 0, 0, 0, 0, iw, ih)
image.copymode(brushmode, brushmasked)
updatebrush(gfx.fgcolor(fgcolor))
paintat(mx, my)
startx, starty = nil, nil
end
elseif tools[tool] == "box" then
local iw, ih = image.size(anim[frame])
if mb > 0 then
if mb > 1 then
updatebrush(gfx.fgcolor(bgcolor))
else
updatebrush(gfx.fgcolor(fgcolor))
end
if startx then
image.copymode(3)
image.draw(anim[frame], 0, 0, 0, 0, iw, ih)
image.copymode(brushmode, brushmasked)
paintline(startx, starty, mx, starty, 1)
paintline(mx, starty, mx, my, 1)
paintline(mx, my, startx, my, 1)
paintline(startx, my, startx, starty, 1)
else
makeuniq()
image.copymode(brushmode, brushmasked)
paintat(mx, my)
startx, starty = mx, my
end
else
image.copymode(3)
if startx then
copycanvas(anim[frame])
commit()
end
image.draw(anim[frame], 0, 0, 0, 0, iw, ih)
image.copymode(brushmode, brushmasked)
updatebrush(gfx.fgcolor(fgcolor))
paintat(mx, my)
startx, starty = nil, nil
end
end
end
function commit()
local commit = {}
for i, v in ipairs(anim) do
table.insert(commit, v)
end
table.insert(history, commit)
while #history > 32 do
for i, v in ipairs(history[1]) do
local uniq = true
for j, w in ipairs(history[2]) do
if v == w then
uniq = false
end
end
if uniq then
image.forget(v)
end
end
table.remove(history, 1)
end
saved = false
end
function undo()
local commit = table.remove(history)
local same = #commit == #anim
while same do
for i, v in ipairs(anim) do
if anim[i] ~= commit[i] then
same = false
frame = i
end
end
if same and #history > 0 then
commit = table.remove(history)
same = #commit == #anim
else
same = false
end
end
table.insert(history, commit)
for i, v in ipairs(anim) do
local uniq = true
for j, w in ipairs(commit) do
if v == w then
uniq = false
end
end
if uniq then
image.forget(v)
end
end
anim = {}
for j, w in ipairs(commit) do
table.insert(anim, w)
end
saved = false
if frame > #anim then
frame = #anim
end
updateui()
end
function copycanvas(img)
view.active(canvasvp)
local w, h = view.size(canvasvp)
local mode, bpp = scrn:mode()
local newframe = img or image.new(w, h, bpp)
image.copypalette(newframe)
image.copy(newframe, 0, 0, 0, 0, w, h)
image.bgcolor(newframe, bgcolor)
image.duration(newframe, image.duration(anim[fixedfps and 1 or frame]))
return newframe
end
function makeuniq(framenum)
framenum = framenum or frame
local oldframe = frame
local commit = history[#history]
local uniq = true
for i, v in ipairs(commit) do
if anim[framenum] == v then
uniq = false
end
end
if not uniq then
frame = framenum
updateui()
anim[frame] = copycanvas()
if frame ~= oldframe then
frame = oldframe
updateui()
end
saved = false
end
return anim[framenum]
end
function resizeanim(l, t, r, b)
view.active(canvasvp)
local iw, ih = image.size(anim[1])
view.size(canvasvp, l + iw + r, t + ih + b)
for i, v in ipairs(anim) do
if not globalpal then
scrn:usepalette(v)
bgcolor = image.bgcolor(v)
end
gfx.cls()
image.draw(v, l, t, 0, 0, iw, ih)
anim[i] = copycanvas()
if not fixedfps then
image.duration(anim[i], image.duration(v))
end
end
updateui()
end
function ramppalette(first, last)
local f = globalpal and 1 or frame
makeuniq(f)
first, last = math.min(first, last), math.max(first, last)
local diff = last - first
local fr, fg, fb = image.palette(anim[f], first)
local lr, lg, lb = image.palette(anim[f], last)
local diffr, diffg, diffb = lr - fr, lg - fg, lb - fb
for i = 0, diff do
image.palette(anim[f], first + i, fr + (i / diff) * diffr, fg + (i / diff) * diffg, fb + (i / diff) * diffb)
end
end
function updatebrush(fgcolor)
if brushcolor then
local bw, bh = image.size(brush)
if bw ~= brushsize or bh ~= brushsize then
image.forget(brush)
brush = image.new(brushsize, brushsize, 8)
brushcolor = 1024
end
if brushcolor ~= fgcolor then
for y = 0, brushsize do
for x = 0, brushsize do
image.pixel(brush, x, y, fgcolor)
end
end
brushcolor = fgcolor
image.copypalette(brush)
image.bgcolor(brush, fgcolor == bgcolor and fgcolor + 1 or bgcolor)
end
end
end
function paintat(x, y)
local bw, bh = image.size(brush)
image.draw(brush, x - math.floor(bw / 2), y - math.floor(bh / 2), 0, 0, bw, bh)
end
function paintline(x1, y1, x2, y2, s)
local l = math.max(math.abs(x1 - x2), math.abs(y1 - y2))
if l == 0 then
if s then
return
end
return paintat(x1, y1)
end
for i = (s or 0), l do
paintat(x1 + .5 + (i / l) * (x2 - x1), y1 + .5 + (i / l) * (y2 - y1))
end
end
function paintcircle(cx, cy, rx, ry)
if rx == 0 and ry == 0 then
paintat(cx, cy)
else
div = rx == ry and 4 or 2
step = 8 / (2 * math.pi * math.abs(math.min(rx, ry)))
for a = 0, math.pi / div, step do
x1 = math.round(rx * math.sin(a))
y1 = math.round(ry * math.cos(a))
x2 = math.round(rx * math.sin(a + step))
y2 = math.round(ry * math.cos(a + step))
paintline(cx + x1, cy - y1, cx + x2, cy - y2)
paintline(cx + x1, cy + y1, cx + x2, cy + y2)
paintline(cx - x1, cy - y1, cx - x2, cy - y2)
paintline(cx - x1, cy + y1, cx - x2, cy + y2)
if div == 4 then
paintline(cx + y1, cy - x1, cx + y2, cy - x2)
paintline(cx + y1, cy + x1, cx + y2, cy + x2)
paintline(cx - y1, cy - x1, cx - y2, cy - x2)
paintline(cx - y1, cy + x1, cx - y2, cy + x2)
end
end
end
end
function makepointer()
gfx.fgcolor(1)
gfx.line(0, 5, 10, 5)
gfx.line(5, 0, 5, 10)
gfx.fgcolor(0)
gfx.plot(5, 5)
gfx.fgcolor(2)
for i = 2, 20, 2 do
gfx.plot(5 - i, 5)
gfx.plot(5 + i, 5)
gfx.plot(5, 5 - i)
gfx.plot(5, 5 + i)
end
local pimg = image.new(11, 11, 2)
image.copy(pimg, 0, 0, 0, 0, 11, 11)
image.pointer(pimg, 5, 5)
return pimg
end
function minbpp(anim)
local colors, c, bpp = 0, 0, 0
local w, h = image.size(anim[1])
for i = 1, #anim do
for y = 1, h do
for x = 1, w do
c = image.pixel(anim[i], x - 1, y - 1)
if c > colors then
colors = c
end
end
end
end
colors = colors + 1
while math.pow(2, bpp) < colors do
bpp = bpp + 1
end
return math.max(1, bpp)
end
function hasglobalpal(anim)
local bpp = image.colordepth(anim[1])
local colors = math.pow(2, bpp)
for i = 2, #anim do
for c = 0, colors - 1 do
local r1, g1, b1 = image.palette(anim[1], c)
local r2, g2, b2 = image.palette(anim[i], c)
if r1 ~= r2 or g1 ~= g2 or b1 ~= b2 then
return false
end
end
end
return true
end
function hasfixedfps(anim)
local firstint = image.duration(anim[1])
for i = 2, #anim do
if firstint ~= image.duration(anim[i]) then
return false
end
end
return true
end
function defaultimage()
local img = image.new(240, 135, 6)
image.pixel(img, 0, 0, 255)
return img
end
function math.round(x)
return x >= 0 and math.floor(x + 0.5) or math.ceil(x - 0.5)
end
function settool(name)
tool = 1
while tools[tool] ~= name and tool < #tools do
tool = tool + 1
end
end
|
--[[
This library defines functions to initialize the values of the rawcodes[] array, which
should contain the rawcodes of all existing Deco Builders, in alphabetical order. Special builders
are listed first, though.
]]--
local decobuilders = {}
decobuilders.typeIds = {}
decobuilders.typeIds.specialDecos = {
'u015', -- Units and Trees
'u02E', -- Terrain
'u003', -- Docks
'u00W' -- Misc
}
decobuilders.typeIds.basicDecos = {
'u014', -- Archways
'u00A', -- Bushes
'u035', -- Camp
'u016', -- City 1
'u017', -- City 2
'u01T', -- City 3
'u00N', -- Corpses
'u00B', -- Crops
'u01P', -- Dungeons
'u036', -- Effects
'u01C', -- Fire
'u03Q', -- Furniture
'u00V', -- Gates
'u03P', -- Ice
'u013', -- Rocks
'u01R', -- Seats
'u01N', -- Statue 1
'u000', -- Walls (Wood)
'u02J', -- Walls 1
'u02K', -- Walls 2
'u00Z', -- Water
'u02P' -- Webs
}
decobuilders.typeIds.advancedDecos = {
'u02G', -- Arabian 1
'u02H', -- Arabian 2
'u01E', -- Blacksmith
'u03A', -- Blocks
'u029', -- Celtic
'u039', -- Chaos
'u027', -- Chess
'u02D', -- Dalaran
'u02O', -- Draenei
'u03Z', -- Drow
'u02A', -- Elves Blood
'u045', -- Elves High
'u040', -- Elves Forest
'u03I', -- Fence
'u005', -- Flags
'u02C', -- Floors
'u004', -- Flowers 1
'u006', -- Flowers 2
'u025', -- Forsaken
'u02R', -- Goblin
'u02S', -- Gravestones
'u02I', -- Mansion
'u01D', -- Market
'u01S', -- Medieval 1
'u02L', -- Medieval 2
'u046', -- Mushrooms
'u03R', -- Naga
'u03S', -- Nordic
'u00Y', -- Obelisks
'u02N', -- Pandaren
'u026', -- Quilboar
'u02Q', -- Rostrodle
'u02T', -- Ruined 1
'u044', -- Ruined 2
'u00X', -- Ruins
'u001', -- Runes
'u02M', -- Runic
'u00G', -- S&S Kingdom 1
'u00L', -- S&S Kingdom 2
'u008', -- S&S Manor 1
'u009', -- S&S Manor 2
'u023', -- Statue 2
'u007', -- Tableware
'u01B', -- Trees
'u01O', -- Village
'u011', -- Walls (Icecrown)
'u012', -- Walls (Ruins)
'u010' -- Walls (Stone)
}
return decobuilders
|
--[[
ElvUI_BetterTalentFrame
Copyright (C) Arwic-Frostmourne, All rights reserved.
]]--
local KUI, E, L, V, P, G = unpack(select(2, ...))
local KBT = KUI:NewModule("KuiBetterTalents", "AceHook-3.0", "AceEvent-3.0")
-- Config
local activateButtonWidth = 200
local activateButtonHeight = 20
local tabDim = 30
local tabSep = 10
local tabXOffset = 2
local specTabPrefix = "KUI_KBT_SpecTab"
local talentRowCount = 7
local talentColCount = 3
local r, g, b = unpack(E["media"].rgbvaluecolor)
-- ensures the db is valid
function KBT:VerifyDB()
if KUIDataPerCharDB == nil then
KUIDataPerCharDB = {}
end
if KUIDataPerCharDB["talents"] == nil then
KUIDataPerCharDB["talents"] = {}
end
if KUIDataPerCharDB["talents"]["pve"] == nil then
KUIDataPerCharDB["talents"]["pve"] = {}
end
end
-- returns the pve talent info for a given spec at the given row and column
function KBT:GetCachedTalentInfo(specIndex, row, col)
-- VerifyDB only guarantees us ["talents"]["pve"], not our spec table
if KUIDataPerCharDB["talents"]["pve"][specIndex] == nil then
return nil
end
return KUIDataPerCharDB["talents"]["pve"][specIndex][row][col]
end
-- returns the talent button frame at the given row and column
function KBT:GetTalentButtonFrame(row, col)
return _G["PlayerTalentFrameTalentsTalentRow" .. row .. "Talent" .. col]
end
-- returns the texture widget of the talent button at the given row and column
function KBT:GetTalentButtonTexture(row, col)
return _G["PlayerTalentFrameTalentsTalentRow" .. row .. "Talent" .. col .. "IconTexture"]
end
-- caches the current specs talent configuration
function KBT:UpdateTalentCache()
-- always recreate the currents specs talent table
self:VerifyDB()
KUIDataPerCharDB["talents"]["pve"][GetSpecialization()] = {}
-- save the current specs talents
local curSpec =KUIDataPerCharDB["talents"]["pve"][GetSpecialization()]
for i = 1, talentRowCount do
curSpec[i] = {}
for j = 1, talentColCount do
curSpec[i][j] = {}
curSpec[i][j].talentID,
curSpec[i][j].name,
curSpec[i][j].texture,
curSpec[i][j].selected,
curSpec[i][j].available,
curSpec[i][j].spellid,
curSpec[i][j].tier,
curSpec[i][j].column = GetTalentInfo(i, j, GetActiveSpecGroup())
end
end
end
function KBT:GetSpecTabIcon(index)
return _G[specTabPrefix .. index]
end
---------- UPDATE ----------
function KBT:UpdateActivateButton()
PlayerTalentFrame_UpdateSpecFrame(PlayerTalentFrameSpecialization, KBT.selectedSpec)
for i = 1, GetNumSpecializations() do
_G["PlayerTalentFrameSpecializationSpecButton"..i]:SetScript("OnClick", function()
KBT.selectedSpec = i
self:Update()
end)
end
end
function KBT:UpdateSpecTab()
-- enable the activate button if the selected spec is not currently active
PlayerTalentFrameSpecializationLearnButton:SetEnabled(KBT.selectedSpec ~= GetSpecialization())
for i = 1, GetNumSpecializations(), 1 do
local icon = self:GetSpecTabIcon(i)
if icon and icon.overlay then
icon.overlay:SetShown(KBT.selectedSpec == i)
end
end
end
function KBT:UpdateTalentsTab()
-- update the talent cache
self:UpdateTalentCache()
-- replace the talent buttons with the selected specs talents
for i = 1, talentRowCount do
for j = 1, talentColCount do
-- get vars
local btn = self:GetTalentButtonFrame(i, j)
local talentInfo = self:GetCachedTalentInfo(KBT.selectedSpec, i, j)
local btnTexture = self:GetTalentButtonTexture(i, j)
-- this is new in BFA and it messes with how we display non active spec talents
if btn.ShadowedTexture ~= nil then
btn.ShadowedTexture:Hide()
end
if talentInfo ~= nil then
-- we have a talent cached for this button
-- update the button with new talent info
btn.name:SetText(talentInfo.name)
btn.icon:SetTexture(talentInfo.texture)
-- highlight the button if it is for a selected talent
btnTexture:SetDesaturated(not (talentInfo.selected and KBT.selectedSpec == GetSpecialization()))
-- update the button's tooltip
btn:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetTalent(talentInfo.talentID)
GameTooltip:Show()
end)
btn:SetScript("OnLeave", function(self)
GameTooltip_Hide()
end)
if KBT.selectedSpec == GetSpecialization() then
-- this is the currently active spec, we need to enable full functionality so the user can select talents
-- enable the buttons click event
btn:SetScript("OnClick", PlayerTalentButton_OnClick)
local _, classId = UnitClass("player")
local color = RAID_CLASS_COLORS[classId]
btn.bg.SelectedTexture:SetColorTexture(r, g, b, 0.5)
-- show the selected texture if the talent is selected
btn.bg.SelectedTexture:SetShown(talentInfo.selected)
else
-- we arnt viewing the active spec
-- disable the buttons click event
btn:SetScript("OnClick", function(...) end)
-- non active specs have light grey highlighs
btn.bg.SelectedTexture:SetColorTexture(75/255, 75/255, 75/255, 0.5)
-- show the selected texture if the talent is selected
btn.bg.SelectedTexture:SetShown(talentInfo.selected)
end
else
-- we dont have a talent cached for this button
-- show unknown message and advise user to switch spec to update their data
btn.name:SetText("Unknown Talent")
btn.icon:SetTexture(0)
btn.bg.SelectedTexture:SetShown(false)
btn:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText("Unknown Talent", 1, 0, 0)
GameTooltip:AddLine("Activate this specialization to update this talent.", nil, nil, nil, true)
GameTooltip:Show()
end)
btn:SetScript("OnLeave", function(self)
GameTooltip_Hide()
end)
end
end
end
end
function KBT:Update()
self:UpdateActivateButton()
self:UpdateSpecTab()
self:UpdateTalentsTab()
end
---------- INIT ----------
function KBT:InitActivateButton()
-- make the activate button appear on every tab
local btn = PlayerTalentFrameSpecializationLearnButton
if btn ~= nil then
btn:SetText("Activate Specialization")
btn:SetSize(activateButtonWidth, activateButtonHeight)
btn:SetParent(PlayerTalentFrame)
btn:SetScript("OnClick", function(self, button)
SetSpecialization(KBT.selectedSpec)
end)
btn:SetEnabled(KBT.selectedSpec ~= GetSpecialization())
end
end
function KBT:InitSpecIcons()
-- add new spec spellbook style tabs to the top right of the talent frame
for i = 1, GetNumSpecializations() do
local spedID, specName, specDesc, specIcon = GetSpecializationInfo(i)
-- create the button
btn = CreateFrame("Button", specTabPrefix .. i, PlayerTalentFrame)
btn:SetFrameStrata("LOW")
btn:SetPoint("TOPLEFT", PlayerTalentFrame, "TOPRIGHT", tabXOffset, -((tabSep + tabDim) * i))
btn:SetSize(tabDim, tabDim)
btn:CreateBackdrop("Default") -- ElvUI func
-- add a tooltip containing the specs description
btn:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetText(specName, 1, 1, 1) -- This sets the top line of text, in gold.
GameTooltip:AddLine(specDesc, nil, nil, nil, true)
GameTooltip:Show()
end)
btn:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
-- set a click action
btn:SetScript("OnClick", function(self, button)
KBT.selectedSpec = i
KBT:SendMessage("KLIX_KBT_SPEC_SELECTION_CHANGED", KBT.selectedSpec)
KBT:Update()
end)
-- give it an icon
if btn.icon == nil then
btn.icon = btn:CreateTexture()
btn.icon:SetSize(tabDim, tabDim)
btn.icon:SetPoint("TOPLEFT")
btn.icon:SetTexture(specIcon)
btn.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9)
end
btn.icon:SetShown(true)
-- give the icon an overlay to indicate the currently selected spec
if btn.overlay == nil then
btn.overlay = btn:CreateTexture(nil, "OVERLAY")
btn.overlay:SetSize(tabDim, tabDim)
btn.overlay:SetPoint("TOPLEFT")
btn.overlay:SetColorTexture(1.0, 1.0, 1.0, 0.51)
end
btn.overlay:SetShown(KBT.selectedSpec == i)
end
end
function KBT:PLAYER_SPECIALIZATION_CHANGED()
self:UpdateTalentCache()
end
function KBT:PLAYER_LOGOUT()
self:UpdateTalentCache()
end
function KBT:PLAYER_ENTERING_WORLD()
if not self.hasRunOneTime then
TalentFrame_LoadUI() -- make sure the talent frame is loaded
self:VerifyDB() -- make sure the db exists
self:UpdateTalentCache() -- update the currently selected spec and talents
KBT.selectedSpec = GetSpecialization() -- select the players current spec by default
self:InitActivateButton() -- initialise the activate button
self:InitSpecIcons() -- initialise the spec spellbook icons
self:SecureHook("PlayerTalentFrame_Update", "Update")
-- default to talents tab if required
if E.db.KlixUI.talents.DefaultToTalentsTab then
PlayerTalentFrameTab2:Click()
end
-- hide the pvp talents flyout if required
if E.db.KlixUI.talents.AutoHidePvPTalents then
PlayerTalentFrameTalentsPvpTalentButton:Click()
end
self.hasRunOneTime = true
end
end
---------- MAIN ----------
function KBT:Initialize()
if not E.db.KlixUI.talents.enable then return end
-- register events
self:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED")
self:RegisterEvent("PLAYER_LOGOUT")
self:RegisterEvent("PLAYER_ENTERING_WORLD")
end
KUI:RegisterModule(KBT:GetName())
|
local cmd = vim.cmd
local g = vim.g
local wo = vim.wo
local bo = vim.bo
local o = vim.o
g.mapleader = ' '
wo.number = true
o.hidden = true
wo.wrap = false
wo.cursorline = true
o.mouse = 'a'
o.splitbelow = true
o.splitright = true
o.timeoutlen = 1000
o.updatetime = 100
o.cmdheight = 2
-- Tab
o.tabstop = 2
o.shiftwidth = 2
o.smarttab = true
o.expandtab = true
o.smartindent = true
|
--[[
SOURCE_ https://gist.github.com/bitingsock/ad58ee5da560ecb922fa4a867ac0ecfd
COMMIT_ 20200802
自定义快捷键 快速切换音频输出设备
此脚本优于在 input.conf 中使用 cycle-values audio-device 参数的方案
示例在 input.conf 中写入两行:
CTRL+a script-binding cycle_adevice/back
ALT+a script-binding cycle_adevice/next
]]--
local opt = require 'mp.options'
local user_opts = {
api = "" -- <wasapi/openal/sdl> 限制音频接口
}
opt.read_options(user_opts)
local deviceList = {}
local function cycle_adevice(s, e, d)
while s ~= e + d do -- until the loop would cycle back to the number we started on
if string.find(mp.get_property("audio-device"), deviceList[s].name, 1, true) then
while true do
if s + d == 0 then --the device list starts at 1; 0 means we iterated to far
s = #deviceList + 1 --so lets restart at the last device
elseif s + d == #deviceList + 1 then --we iterated past the last device
s = 0 --then start from the beginning
end
s = s + d --next device
if string.find(deviceList[s].name, user_opts.api, 1, true) then
mp.set_property("audio-device",deviceList[s].name)
deviceList[s].description = "■ "..deviceList[s].description
local list = "音频输出设备:\n"
for i=1,#deviceList do
if string.find(deviceList[i].name, user_opts.api, 1, true) then
if deviceList[i].name~=deviceList[s].name then list = list.."□ " end
list=list..deviceList[i].description.."\n"
end
end
if mp.get_property("vid")=="no" then
print("audio="..deviceList[s].description)
else
mp.osd_message(list, 3)
end
return
end
end
end
s = s + d
end
end
local function cycle_back()
deviceList = mp.get_property_native("audio-device-list")
cycle_adevice(#deviceList, 1, -1) --'s'tart at last device, 'e'nd at device 1, iterate backward 'd'elta=-1
end
local function cycle_next()
deviceList = mp.get_property_native("audio-device-list")
cycle_adevice(1, #deviceList, 1) --'s'tart at device 1, 'e'nd at last device, iterate forward 'd'elta=1
end
mp.add_key_binding(nil, "next", cycle_next)
mp.add_key_binding(nil, "back", cycle_back)
|
local _2afile_2a = "fnl/conjure/fs.fnl"
local _0_
do
local name_0_ = "conjure.fs"
local module_0_
do
local x_0_ = package.loaded[name_0_]
if ("table" == type(x_0_)) then
module_0_ = x_0_
else
module_0_ = {}
end
end
module_0_["aniseed/module"] = name_0_
module_0_["aniseed/locals"] = ((module_0_)["aniseed/locals"] or {})
do end (module_0_)["aniseed/local-fns"] = ((module_0_)["aniseed/local-fns"] or {})
do end (package.loaded)[name_0_] = module_0_
_0_ = module_0_
end
local autoload
local function _1_(...)
return (require("conjure.aniseed.autoload")).autoload(...)
end
autoload = _1_
local function _2_(...)
local ok_3f_0_, val_0_ = nil, nil
local function _2_()
return {autoload("conjure.aniseed.core"), autoload("conjure.config"), autoload("conjure.aniseed.nvim"), autoload("conjure.aniseed.string")}
end
ok_3f_0_, val_0_ = pcall(_2_)
if ok_3f_0_ then
_0_["aniseed/local-fns"] = {autoload = {a = "conjure.aniseed.core", config = "conjure.config", nvim = "conjure.aniseed.nvim", str = "conjure.aniseed.string"}}
return val_0_
else
return print(val_0_)
end
end
local _local_0_ = _2_(...)
local a = _local_0_[1]
local config = _local_0_[2]
local nvim = _local_0_[3]
local str = _local_0_[4]
local _2amodule_2a = _0_
local _2amodule_name_2a = "conjure.fs"
do local _ = ({nil, _0_, nil, {{}, nil, nil, nil}})[2] end
local env
do
local v_0_
local function env0(k)
local v = nvim.fn.getenv(k)
if (a["string?"](v) and not a["empty?"](v)) then
return v
end
end
v_0_ = env0
local t_0_ = (_0_)["aniseed/locals"]
t_0_["env"] = v_0_
env = v_0_
end
local config_dir
do
local v_0_
do
local v_0_0
local function config_dir0()
return ((env("XDG_CONFIG_HOME") or (env("HOME") .. "/.config")) .. "/conjure")
end
v_0_0 = config_dir0
_0_["config-dir"] = v_0_0
v_0_ = v_0_0
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["config-dir"] = v_0_
config_dir = v_0_
end
local findfile
do
local v_0_
do
local v_0_0
local function findfile0(name, path)
local res = nvim.fn.findfile(name, path)
if not a["empty?"](res) then
return res
end
end
v_0_0 = findfile0
_0_["findfile"] = v_0_0
v_0_ = v_0_0
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["findfile"] = v_0_
findfile = v_0_
end
local resolve_above
do
local v_0_
do
local v_0_0
local function resolve_above0(name)
return (findfile(name, ".;") or findfile(name, (nvim.fn.getcwd() .. ";")) or findfile(name, (config_dir() .. ";")))
end
v_0_0 = resolve_above0
_0_["resolve-above"] = v_0_0
v_0_ = v_0_0
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["resolve-above"] = v_0_
resolve_above = v_0_
end
local file_readable_3f
do
local v_0_
do
local v_0_0
local function file_readable_3f0(path)
return (1 == nvim.fn.filereadable(path))
end
v_0_0 = file_readable_3f0
_0_["file-readable?"] = v_0_0
v_0_ = v_0_0
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["file-readable?"] = v_0_
file_readable_3f = v_0_
end
local split_path
do
local v_0_
do
local v_0_0
local function split_path0(path)
local function _3_(_241)
return not a["empty?"](_241)
end
return a.filter(_3_, str.split(path, "/"))
end
v_0_0 = split_path0
_0_["split-path"] = v_0_0
v_0_ = v_0_0
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["split-path"] = v_0_
split_path = v_0_
end
local join_path
do
local v_0_
do
local v_0_0
local function join_path0(parts)
return str.join("/", a.concat(parts))
end
v_0_0 = join_path0
_0_["join-path"] = v_0_0
v_0_ = v_0_0
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["join-path"] = v_0_
join_path = v_0_
end
local resolve_relative_to
do
local v_0_
do
local v_0_0
local function resolve_relative_to0(path, root)
local function loop(parts)
if a["empty?"](parts) then
return path
else
if file_readable_3f(join_path(a.concat({root}, parts))) then
return join_path(parts)
else
return loop(a.rest(parts))
end
end
end
return loop(split_path(path))
end
v_0_0 = resolve_relative_to0
_0_["resolve-relative-to"] = v_0_0
v_0_ = v_0_0
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["resolve-relative-to"] = v_0_
resolve_relative_to = v_0_
end
local resolve_relative
do
local v_0_
do
local v_0_0
local function resolve_relative0(path)
local relative_file_root = config["get-in"]({"relative_file_root"})
if relative_file_root then
return resolve_relative_to(path, relative_file_root)
else
return path
end
end
v_0_0 = resolve_relative0
_0_["resolve-relative"] = v_0_0
v_0_ = v_0_0
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["resolve-relative"] = v_0_
resolve_relative = v_0_
end
local apply_path_subs
do
local v_0_
do
local v_0_0
local function apply_path_subs0(path, path_subs)
local function _4_(path0, _3_)
local _arg_0_ = _3_
local pat = _arg_0_[1]
local rep = _arg_0_[2]
return path0:gsub(pat, rep)
end
return a.reduce(_4_, path, a["kv-pairs"](path_subs))
end
v_0_0 = apply_path_subs0
_0_["apply-path-subs"] = v_0_0
v_0_ = v_0_0
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["apply-path-subs"] = v_0_
apply_path_subs = v_0_
end
local localise_path
do
local v_0_
do
local v_0_0
local function localise_path0(path)
return resolve_relative(apply_path_subs(path, config["get-in"]({"path_subs"})))
end
v_0_0 = localise_path0
_0_["localise-path"] = v_0_0
v_0_ = v_0_0
end
local t_0_ = (_0_)["aniseed/locals"]
t_0_["localise-path"] = v_0_
localise_path = v_0_
end
return nil
|
function DrawVolumeScreen()
love.graphics.clear(unpack(colors.black))
GameFont:setLineHeight(1)
love.graphics.setColor(0, 0, 0, 100)
love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight())
local blackImage = love.graphics.newImage(settings.black_screen_path)
local blackImageScale = 2 * dimensions.window_width / 1920 * 2
local backW = (dimensions.window_width * 1 / 5)
local backX = (dimensions.window_width / 2 - backW / 2)
local backY = blackImage:getHeight() * blackImageScale + 10
local backH = 60
local musicVolumeW =
(dimensions.window_width * 1 / 3.75 +
(love.graphics.newText(GameFont, "Music Volume (" .. settings.music_volume .. ")"):getWidth() / 4))
local musicVolumeX = (dimensions.window_width / 2 - musicVolumeW / 2)
local musicVolumeY = blackImage:getHeight() * blackImageScale - 480
local musicVolumeH = 60
local sfxVolumeW =
(dimensions.window_width * 1 / 3.75 +
(love.graphics.newText(GameFont, "SFX Volume (" .. settings.sfx_volume .. ")"):getWidth() / 4))
local sfxVolumeX = (dimensions.window_width / 2 - sfxVolumeW / 2)
local sfxVolumeY = blackImage:getHeight() * blackImageScale - 370
local sfxVolumeH = 60
local speechVolumeW =
(dimensions.window_width * 1 / 3.75 +
(love.graphics.newText(GameFont, "Speech Volume (" .. settings.speech_volume .. ")"):getWidth() / 4))
local speechVolumeX = (dimensions.window_width / 2 - speechVolumeW / 2)
local speechVolumeY = blackImage:getHeight() * blackImageScale - 260
local speechVolumeH = 60
local dx = 8
local dy = 8
love.graphics.setColor(0.44, 0.56, 0.89)
if TitleSelection == "SFX Volume" then
love.graphics.rectangle("fill", sfxVolumeX - dx, sfxVolumeY - dy, sfxVolumeW + 2 * dx, sfxVolumeH + 2 * dy)
elseif TitleSelection == "Speech Volume" then
love.graphics.rectangle(
"fill",
speechVolumeX - dx,
speechVolumeY - dy,
speechVolumeW + 2 * dx,
speechVolumeH + 2 * dy
)
elseif TitleSelection == "Music Volume" then
love.graphics.rectangle(
"fill",
musicVolumeX - dx,
musicVolumeY - dy,
musicVolumeW + 2 * dx,
musicVolumeH + 2 * dy
)
else
love.graphics.rectangle("fill", backX - dx, backY - dy, backW + 2 * dx, backH + 2 * dy)
end
love.graphics.setColor(222, 0, 0)
love.graphics.rectangle("fill", backX, backY, backW, backH)
love.graphics.setColor(0.3, 0.3, 0.3)
love.graphics.rectangle("fill", musicVolumeX, musicVolumeY, musicVolumeW, musicVolumeH)
love.graphics.setColor(0.25, 0.41, 0.88)
love.graphics.rectangle(
"fill",
musicVolumeX,
musicVolumeY,
(musicVolumeW / 100) * settings.music_volume,
musicVolumeH
)
love.graphics.setColor(0.3, 0.3, 0.3)
love.graphics.rectangle("fill", sfxVolumeX, sfxVolumeY, sfxVolumeW, sfxVolumeH)
love.graphics.setColor(0.25, 0.41, 0.88)
love.graphics.rectangle("fill", sfxVolumeX, sfxVolumeY, (sfxVolumeW / 100) * settings.sfx_volume, sfxVolumeH)
love.graphics.setColor(0.3, 0.3, 0.3)
love.graphics.rectangle("fill", speechVolumeX, speechVolumeY, speechVolumeW, speechVolumeH)
love.graphics.setColor(0.25, 0.41, 0.88)
love.graphics.rectangle(
"fill",
speechVolumeX,
speechVolumeY,
(speechVolumeW / 100) * settings.speech_volume,
speechVolumeH
)
love.graphics.setColor(1, 1, 1)
local textScale = 3
local backText = love.graphics.newText(GameFont, "Back")
love.graphics.draw(
backText,
backX + backW / 2 - (backText:getWidth() * textScale) / 2,
backY + backH / 2 - (backText:getHeight() * textScale) / 2,
0,
textScale,
textScale
)
local musicVolumeText = love.graphics.newText(GameFont, "Music Volume (" .. settings.music_volume .. ")")
love.graphics.draw(
musicVolumeText,
musicVolumeX + musicVolumeW / 2 - (musicVolumeText:getWidth() * textScale) / 2,
musicVolumeY + musicVolumeH / 2 - (musicVolumeText:getHeight() * textScale) / 2,
0,
textScale,
textScale
)
local sfxVolumeText = love.graphics.newText(GameFont, "SFX Volume (" .. settings.sfx_volume .. ")")
love.graphics.draw(
sfxVolumeText,
sfxVolumeX + sfxVolumeW / 2 - (sfxVolumeText:getWidth() * textScale) / 2,
sfxVolumeY + sfxVolumeH / 2 - (sfxVolumeText:getHeight() * textScale) / 2,
0,
textScale,
textScale
)
local speechVolumeText = love.graphics.newText(GameFont, "Speech Volume (" .. settings.speech_volume .. ")")
love.graphics.draw(
speechVolumeText,
speechVolumeX + speechVolumeW / 2 - (speechVolumeText:getWidth() * textScale) / 2,
speechVolumeY + speechVolumeH / 2 - (speechVolumeText:getHeight() * textScale) / 2,
0,
textScale,
textScale
)
return self
end
volumeSelections = {}
volumeSelections[0] = "Back"
volumeSelections[1] = "Speech Volume"
volumeSelections[2] = "SFX Volume"
volumeSelections[3] = "Music Volume"
TitleSelection = "Back"
SelectionIndex = 0
blip2 = love.audio.newSource("sounds/selectblip2.wav", "static")
jingle = love.audio.newSource("sounds/selectjingle.wav", "static")
blip2:setVolume(settings.sfx_volume / 100 / 2)
jingle:setVolume(settings.sfx_volume / 100 / 2)
VolumeConfig = {
displayed = false,
onKeyPressed = function(key)
if key == controls.start_button then
love.graphics.clear(0, 0, 0)
if TitleSelection == "Back" then
blip2:stop()
blip2:play()
screens.options.displayed = true
DrawOptionsScreen()
screens.volume.displayed = false
SelectionIndex = 1
TitleSelection = "Volume"
end
elseif key == controls.pause_nav_up then
blip2:stop()
blip2:play()
SelectionIndex = SelectionIndex + 1
if (SelectionIndex > 3) then
SelectionIndex = 0
end
TitleSelection = volumeSelections[SelectionIndex]
elseif key == controls.pause_nav_down then
blip2:stop()
blip2:play()
SelectionIndex = SelectionIndex - 1
if (SelectionIndex < 0) then
SelectionIndex = 3
end
TitleSelection = volumeSelections[SelectionIndex]
elseif key == controls.press_right then
if TitleSelection == "Music Volume" then
if settings.music_volume < 100 then
settings.music_volume = settings.music_volume + 5
MusicVolume = settings.music_volume
for i, v in pairs(Music) do
v:setVolume(settings.music_volume / 100)
end
blip2:stop()
blip2:play()
end
elseif TitleSelection == "SFX Volume" then
if settings.sfx_volume < 100 then
settings.sfx_volume = settings.sfx_volume + 5
SFXVolume = settings.sfx_volume
for i, v in pairs(Sounds) do
if i ~= "maletalk" and i ~= "femaletalk" then
v:setVolume(settings.sfx_volume / 100)
end
end
blip2:stop()
blip2:play()
end
elseif TitleSelection == "Speech Volume" then
if settings.speech_volume < 100 then
settings.speech_volume = settings.speech_volume + 5
SFXVolume = settings.speech_volume
blip2:stop()
blip2:play()
end
end
elseif key == controls.press_left then
if TitleSelection == "Music Volume" then
if settings.music_volume > 0 then
settings.music_volume = settings.music_volume - 5
MusicVolume = settings.music_volume
for i, v in pairs(Music) do
v:setVolume(settings.music_volume / 100)
end
blip2:stop()
blip2:play()
end
elseif TitleSelection == "SFX Volume" then
if settings.sfx_volume > 0 then
settings.sfx_volume = settings.sfx_volume - 5
SFXVolume = settings.sfx_volume
for i, v in pairs(Sounds) do
if i ~= "maletalk" and i ~= "femaletalk" then
v:setVolume(settings.sfx_volume / 100)
end
end
blip2:stop()
blip2:play()
end
elseif TitleSelection == "Speech Volume" then
if settings.speech_volume > 0 then
settings.speech_volume = settings.speech_volume - 5
SFXVolume = settings.speech_volume
blip2:stop()
blip2:play()
end
end
end
end,
onKeyReleased = function(key)
end,
onDisplay = function()
screens.pause.displayed = false
screens.courtRecords.displayed = false
screens.options.displayed = false
screens.title.displayed = false
screens.volume.displayed = true
TitleSelection = "Back"
SelectionIndex = 0
end,
draw = function()
if screens.volume.displayed == true then
DrawVolumeScreen()
blip2:setVolume(settings.sfx_volume / 100 / 2)
jingle:setVolume(settings.sfx_volume / 100 / 2)
end
end
}
|
local util = require("spec.util")
describe("assignment with any", function()
it("is ok from any type", util.check [[
local a: any
local i = 0
a = i
local s = "string"
a = s
local m = { ["foo"] = 2, ["bar"] = 3 }
a = m
local arr = {1,2,3}
a = arr
local E = {}
a = E
local f = function():string return "wee" end
a = f
local a2: any
a = a2
a2 = a
]])
end)
|
-- Code created by Kwik - Copyright: kwiksher.com {{year}}
-- Version: {{vers}}
-- Project: {{ProjName}}
--
local _M = {}
--
function _M:gotoURL(pLink)
system.openURL(pLink)
end
--
return _M
|
PLUGIN.name = "PDA chatting system"
PLUGIN.author = "verne"
PLUGIN.description = "PDA chatting system, supporting avatars and nicknames"
ix.config.Add("pdaWiringEnabled", false, "If true, PDA Wiring will be enabled.", nil, {
category = "PDA Wiring"
})
ix.config.Add("pdaWiringCooldown", 120, "The cooldown between wiring another transaction again.", nil, {
data = {min = 0, max = 600},
category = "PDA Wiring"
})
ix.config.Add("pdaWiringSendTime", 20, "The time it takes for the transaction to go through.", nil, {
data = {min = 0, max = 600},
category = "PDA Wiring"
})
ix.config.Add("pdaWiringReputationNeeded", true, "If true, PDA wiring will require a reputation threshold to be used.", nil, {
category = "PDA Wiring"
})
ix.config.Add("pdaWiringReputationNeededMinimum", 50, "The minimum amount of reputation needed to access PDA Wiring. Check reputation plugin for threshold values. DEFAULT = ROOKIE (50 REPUTATION)", nil, {
data = {min = 0, max = 20943},
category = "PDA Wiring"
})
ix.config.Add("pdaWiringReputationNeededRank", "Rookie", "The rank name set in the notification for reputation needed for PDA Wiring. Check reputation plugin for ranks.", nil, {
category = "PDA Wiring"
})
ix.config.Add("pdaWiringMaximumTransactionLimit", 10000, "The maximum amount of money a person can wire within one transaction.", nil, {
data = {min = 1, max = 999999},
category = "PDA Wiring"
})
--removal of helix chats we dont use
hook.Add("InitializedChatClasses", "ixChatRemoval2", function()
ix.chat.classes["ooc"] = nil
ix.chat.classes["pm"] = nil
ix.chat.Register("ooc", {
CanSay = function(self, speaker, text)
/*local pda = speaker:GetCharacter():GetData("pdaequipped", false)
if pda then
return true
else
return false
end*/
return true
end,
OnChatAdd = function(self, speaker, text, bAnonymous, data)
chat.AddText(Color(0,191,255), "[GPDA-"..speaker:GetCharacter():GetData("pdanickname", speaker:GetCharacter():GetName()).."] ", Material(speaker:GetCharacter():GetPdaavatar()), color_white, ": "..text)
end,
prefix = {"//", "/OOC", "/gpda"},
description = "Send a message over the Global PDA network",
CanHear = function(self, speaker, listener)
/*local pda = speaker:GetCharacter():GetData("pdaequipped", false)
if pda then
listener:EmitSound( "stalkersound/da-2_beep1.ogg", 90, 100, 1, CHAN_AUTO )
return true
else
return false
end*/
listener:EmitSound( "stalkersound/da-2_beep1.ogg", 90, 100, 1, CHAN_AUTO )
return true
end,
})
ix.chat.Register("pm", {
format = "[PMPDA] %s %s -> %s %s: %s",
color = Color(0, 191, 255, 255),
deadCanChat = true,
OnChatAdd = function(self, speaker, text, bAnonymous, data)
chat.AddText(self.color, "[PPDA-"..speaker:GetCharacter():GetData("pdanickname", speaker:GetCharacter():GetName()).."] ", " ", Material(speaker:GetCharacter():GetPdaavatar()), color_white, " TO ", self.color, "[PPDA-"..data.target:GetCharacter():GetData("pdanickname", data.target:GetCharacter():GetName()).." ] ", " ", Material(data.target:GetCharacter():GetPdaavatar()), color_white, "\nMESSAGE : ", text)
surface.PlaySound("stalkersound/pda/pda.wav")
end
})
end)
-- Overwrites defualt PM Command
function PLUGIN:InitializedPlugins()
ix.command.list["pm"] = nil
ix.command.Add("ppda", {
description = "@cmdPM",
arguments = {
ix.type.player,
ix.type.text
},
alias = {"PM", "pmpda"},
OnRun = function(self, client, target, message)
if ((client.ixNextPM or 0) < CurTime()) then
ix.chat.Send(client, "pm", message, false, {client, target}, {target = target})
client.ixNextPM = CurTime() + 0.5
target.ixLastPM = client
end
end
})
end
ix.char.RegisterVar("pdaavatar", {
field = "pdaavatar",
fieldType = ix.type.string,
default = "vgui/icons/face_31.png",
bNoDisplay = true,
})
-- NPC talker PDA
local icon = Material("vgui/icons/news.png")
ix.chat.Register("npcpdainternal", {
CanSay = function(self, speaker, text)
return true
end,
OnChatAdd = function(self, speaker, text, bAnonymous, data)
chat.AddText(Color(180,61,61), "[GPDA-"..data.name.."] ", Color(0,241,255), icon, ": "..data.message)
end,
prefix = {},
CanHear = function(self, speaker, listener)
listener:EmitSound( "stalkersound/pda/pda_news.wav", 55, 100, 0.2, CHAN_AUTO )
return true
end,
})
ix.command.Add("npcpda", {
adminOnly = true,
description = "Write a PDA message from an arbitrary name",
arguments = {
ix.type.string,
ix.type.text
},
OnRun = function(self, client, npcname, message)
ix.chat.Send(client, "npcpdainternal", message, nil, nil, {
name = npcname,
message = message
})
end
})
do
hook.Add("InitializedConfig", "ixWireCommand", function()
local WIRE_NAME = string.gsub(ix.util.ExpandCamelCase(ix.currency.plural), "%s", "")
ix.command.Add("Wire" .. WIRE_NAME, { -- Yeah there is a lot of if statements and config referencing. Do not commit money laundering with this or the UKM will come for you.
alias = {"WireMoney"},
description = "Wires the specified amount of money from your account to the target.",
arguments = {ix.type.string, ix.type.number},
OnRun = function(self, client, target, amount)
if not ix.config.Get("pdaWiringEnabled", true) then return client:Notify("[STALKERNET WIRING] Error! - System admin has disabled the ability to wire transactions.") end
if ix.config.Get("pdaWiringReputationNeeded", true) and client:getReputation() < ix.config.Get("pdaWiringReputationNeededMinimum", 50) then return client:Notify("[STALKERNET WIRING] Error! - You need to be " .. ix.config.Get("pdaWiringReputationNeededRank", "Rookie") .. "+ to unlock this feature.") end
client.timeNextWire = client.timeNextWire or CurTime()
if client.timeNextWire > CurTime() then return client:Notify("[STALKERNET WIRING] Error! - You need to wait " .. math.Round(client.timeNextWire - CurTime(), 1) .. " Second(s) until you can wire again.") end
amount = math.Round(amount)
if (amount > ix.config.Get("pdaWiringMaximumTransactionLimit")) then return client:Notify("[STALKERNET WIRING] Error! - You can not send more than " .. ix.currency.symbol .. ix.config.Get("pdaWiringMaximumTransactionLimit") .. " in one transaction.") end
if (amount < 1) then return client:Notify("[STALKERNET WIRING] Error! - The amount must be greater than 0.") end
if not ix.util.FindPlayer(target) then return client:Notify("[STALKERNET WIRING] Error! - No target account detected") end
target = ix.util.FindPlayer(target)
if target == client then return client:Notify("[STALKERNET WIRING] Error! - You cannot wire money to yourself.") end
if not client:GetCharacter():HasMoney(amount) then return client:Notify("[STALKERNET WIRING] Error! - Lack of funds in account to send.") end
if (timer.Exists("ixPDAWiringSend" .. client:SteamID())) then return client:Notify("[STALKERNET WIRING] Error! - Transaction already outgoing.") end
client:Notify("[STALKERNET WIRING] Beginning to wire " .. ix.currency.symbol .. amount .. " to " .. target:Nick() .. " - ETA: " .. ix.config.Get("pdaWiringSendTime", 20) .. " Seconds.")
timer.Create("ixPDAWiringSend" .. client:SteamID(), ix.config.Get("pdaWiringSendTime", 20), 1, function()
target = target
if not target:GetCharacter() then return end
if not IsValid(target) then return client:Notify("[STALKERNET WIRING] Error! - No target account detected") end
if not IsValid(client) then return end
if not client:GetCharacter():HasMoney(amount) then return client:Notify("[STALKERNET WIRING] Error! - Lack of funds in account to send.") end
client.timeNextWire = CurTime() + ix.config.Get("pdaWiringCooldown", 120)
client:GetCharacter():TakeMoney(amount)
target:GetCharacter():GiveMoney(amount)
client:Notify("[STALKERNET WIRING] Wiring Successful! - " .. ix.currency.symbol .. amount .. " to " .. target:Nick())
target:Notify("[STALKERNET WIRING] You have received " .. ix.currency.symbol .. amount .. " from " .. client:Nick())
end)
end
})
end)
end
|
include('shared.lua')
local Emitter = ParticleEmitter(Vector(0,0,0))
function ENT:Initialize()
self.Timer = CurTime() + 3
self.DustTimer = 0
self.Distance = 2500
self.SpawnTable = {}
local trace = {}
trace.start = self.Entity:GetPos()
trace.endpos = trace.start + Vector(2500,2500,0)
local tr = util.TraceLine( trace )
self.Left = trace.start + Vector(2500,2500,0)
if tr.Hit then
-- self.Left = tr.HitPos
end
trace = {}
trace.start = self.Entity:GetPos()
trace.endpos = trace.start + Vector(-2500,-2500,0)
tr = util.TraceLine( trace )
self.Right = trace.start + Vector(-2500,-2500,0)
if tr.Hit then
-- self.Right = tr.HitPos
end
end
function ENT:Think()
if self.Timer then
if self.Timer > CurTime() then return end
end
local mypos = self:GetPos()
local dist = LocalPlayer():GetPos():Distance(mypos)
if(dist < 3000) then
if self.DustTimer < CurTime() then
self.DustTimer = CurTime() + 0.1
local vec = Vector( math.random( self.Right.x, self.Left.x ), math.random( self.Right.y, self.Left.y ), self.Entity:GetPos().z )
local trace = {}
trace.start = Vector( math.random( self.Right.x, self.Left.x ), math.random( self.Right.y, self.Left.y ), self.Entity:GetPos().z )
trace.endpos = Vector( math.random( self.Right.x, self.Left.x ), math.random( self.Right.y, self.Left.y ), self.Entity:GetPos().z - 9000 )
trace.filter = self.Entity
local tr = util.TraceLine( trace )
local roll = math.random( -360, 360 )
local particle = Emitter:Add( "particle/particle_smokegrenade", tr.HitPos )
particle:SetDieTime( 10 )
particle:SetStartAlpha( 0 )
particle:SetEndAlpha( 150 )
particle:SetStartSize( math.random( 400, 800 ) )
particle:SetEndSize( 600 )
particle:SetRoll( roll )
particle:SetColor( 100, 100, 100 )
table.insert( self.SpawnTable, { CurTime() + 10, tr.HitPos, roll } )
end
for k,v in pairs( self.SpawnTable ) do
if v[1] <= CurTime() then
local particle = Emitter:Add( "particle/particle_smokegrenade", v[2] )
particle:SetVelocity( Vector( 0, 0, math.random( -10, 10 ) ) )
particle:SetDieTime( 10 )
particle:SetStartAlpha( 150 )
particle:SetEndAlpha( 0 )
particle:SetStartSize( 600 )
particle:SetEndSize( math.random( 400, 800 ) )
particle:SetRoll( v[3] )
particle:SetColor( 100, 100, 100 )
table.remove( self.SpawnTable, k )
break
end
end
end
end
function ENT:OnRemove()
if IsValid( Emitter ) then
--Emitter:Finish()
end
end
function ENT:Draw()
end
|
--[[
Gadget: MultiParam
A small gadget that collects a vent data table and a table of multi-params and melds them into the vent data table. The new function then becomes one that randomly picks from the multi-param table for that key and executes it.
Usage:
---------------------
local CBE = require("CBE.Library")
local multiparam = require("multiparam")
local myVentParams = { -- Vent parameters, not VentGroup parameters
preset = "flame",
build = function() return display.newImage("smoke.png") end -- Mundane old single-build function
}
local editParams = {
build = {
function() -- The first build function you want to add
return display.newImageRect("smoke.png", 24, 24)
end,
function() -- The second build function you want to add
return display.newImageRect("ember.png", 10, 10)
end,
function() -- The third build function you want to add
return display.newImageRect("flame.png", 30, 30)
end
}
}
local myVent = CBE.newVent(multiparam.edit(myVentParams, editParams)) -- Edit the params using the editParams
myVent.start()
---------------------
--]]
local multiparam = {}
local mrand = math.random
local pairs = pairs
local type = type
local either = function(t) if t and #t>1 then return t[mrand(#t)] elseif t and #t == 1 then return t[1] elseif not t then error("Missing table for 'either'", 3) end end
function multiparam.edit(params, params2)
assert(params and params2, "Missing 1 or more arguments to 'edit'")
for k, v in pairs(params2) do
if type(v) == "table" and type(v[1]) == "function" then
params[k] = function(...)
return either(v)(...)
end
end
end
return params
end
return multiparam
|
local function toGridCode(tVector)
return math.floor(tVector.x/16), math.floor(tVector.y/16), math.floor(tVector.z/16), tVector.x % 16, tVector.y % 16, tVector.z % 16
end
local function setGrid(tMap, x, y, z, grid)
if not tMap.map[x] then
tMap.map[x] = {}
end
if not tMap.map[x][y] then
tMap.map[x][y] = {}
end
tMap.map[x][y][z] = grid
return tMap.map[x][y][z]
end
local function getGrid(tMap, x, y, z)
if not tMap.map[x] or not tMap.map[x][y] or not tMap.map[x][y][z] then
return tMap:load(x, y, z)
else
return tMap.map[x][y][z]
end
end
local mapMethods = {
getGrid = function(self, tVector, y, z)
local gX, gY, gZ
if y and z then
gX, gY, gZ = tVector, y, z
else
gX, gY, gZ = toGridCode(tVector)
end
return getGrid(self, gX, gY, gZ)
end,
load = function(self, tVector, y, z)
local gX, gY, gZ
if y and z then
gX, gY, gZ = tVector, y, z
else
gX, gY, gZ = toGridCode(tVector)
end
local gridPath = fs.combine(self.mapDir, gX..","..gY..","..gZ)
if fs.exists(gridPath) then
local handle = fs.open(gridPath, "r")
if handle then
local grid = handle.readAll()
handle.close()
grid = textutils.unserialise(grid)
if type(grid) == "table" then
return setGrid(self, gX, gY, gZ, grid)
end
end
end
return setGrid(self, gX, gY, gZ, {})
end,
loadAll = function(self)
if fs.exists(self.mapDir) and fs.isDir(self.mapDir) then
for _, gridFile in ipairs(fs.list(self.mapDir)) do
local _, _, gX, gY, gZ = string.find(gridFile, "(.+)%,(.+)%,(.+)")
if gX and gY and gX then
self:load(tonumber(gX), tonumber(gY), tonumber(gZ))
end
end
end
end,
save = function(self, tVector, y, z)
local gX, gY, gZ
if y and z then
gX, gY, gZ = tVector, y, z
else
gX, gY, gZ = toGridCode(tVector)
end
if self.map[gX] and self.map[gX][gY] and self.map[gX][gY][gZ] then
local grid = self.map[gX][gY][gZ]
if next(grid) then
local handle = fs.open(fs.combine(self.mapDir, gX..","..gY..","..gZ), "w")
if handle then
handle.write(textutils.serialise(grid))
handle.close()
end
else
fs.delete(fs.combine(self.mapDir, gX..","..gY..","..gZ))
end
end
end,
saveAll = function(self)
for gX, YZmap in pairs(self.map) do
for gY, Zmap in pairs(YZmap) do
for gZ, grid in pairs(Zmap) do
self:save(gX, gY, gZ)
end
end
end
end,
get = function(self, tVector)
local gX, gY, gZ, pX, pY, pZ = toGridCode(tVector)
local grid = getGrid(self, gX, gY, gZ)
if grid[pX] and grid[pX][pY] then
return grid[pX][pY][pZ]
end
end,
set = function(self, tVector, value)
local gX, gY, gZ, pX, pY, pZ = toGridCode(tVector)
local grid = getGrid(self, gX, gY, gZ)
if not grid[pX] then
grid[pX] = {}
end
if not grid[pX][pY] then
grid[pX][pY] = {}
end
grid[pX][pY][pZ] = value
return grid[pX][pY][pZ]
end,
getOrSet = function(self, tVector, value)
local gX, gY, gZ, pX, pY, pZ = toGridCode(tVector)
local grid = getGrid(self, gX, gY, gZ)
if grid[pX] and grid[pX][pY] and grid[pX][pY][pZ] then
return grid[pX][pY][pZ], false
else
if not grid[pX] then
grid[pX] = {}
end
if not grid[pX][pY] then
grid[pX][pY] = {}
end
grid[pX][pY][pZ] = value
return grid[pX][pY][pZ], true
end
end,
}
local mapMetatable = {__index = mapMethods}
function new(mapDir)
local tMap = {}
if type(mapDir) == "string" then
if not fs.exists(mapDir) then
fs.makeDir(mapDir)
elseif not fs.isDir(mapDir) then
error("new: not a valid directory")
end
tMap.mapDir = mapDir
else
error("new: directory must be string")
end
tMap.map = {}
setmetatable(tMap, mapMetatable)
return tMap
end
|
Scrap_AutoSell = nil
Scrap_AutoRepair = nil
Scrap_Safe = nil
Scrap_Learn = nil
Scrap_Glow = nil
Scrap_Icons = nil
Scrap_Tut = nil
Scrap_Version = nil
|
--- Font.
-- Is a pointer to a [JUCE Font](http://www.juce.com/api/classFont.html).
-- Can be used by @{juce.Graphics} for text operations.
-- @classmod juce.Font
ffi.cdef [[
pFont Font_new(const char *typefaceName, float fontHeight, int styleFlags, bool hinted);
void Font_delete(pFont f);
]]
--- Constuctor.
-- Caveat : on OSX and Linux, hinting only works for protoplug's
-- built-in hinted fonts (`DejaVu Sans Mono` and `Source Code Pro`). On
-- Windows it's available for every font. Cross-platform hinting is on the be
-- todo list.
-- @tparam string typefaceName
-- @tparam number fontHeight
-- @param[opt=0] styleFlags any combination of @{styles}
-- @tparam[opt=false] bool hinted
-- @within Constructors
-- @constructor
-- @function Font
local Font = setmetatable({}, {
__call = function (self, typefaceName, fontHeight, styleFlags, hinted)
styleFlags = styleFlags or 0
hinted = hinted or false;
return ffi.gc(
protolib.Font_new(typefaceName, fontHeight, styleFlags, hinted),
protolib.Font_delete
)
end
})
--- Font styles.
-- @table juce.Font.styles
Font.styles = {
plain = 0, -- `0`
bold = 1, -- `1`
italic = 2, -- `2`
underlined = 4 -- `4`
}
return Font
|
--[[
Copyright 2019 Teverse
@File add.lua
@Author(s) Jay, Ly, joritochip
@Updated 5/8/19
--]]
-- TODO: Create a UI that allows the user to select what primitive to insert
-- UI should also allow user to specify default values for the created primitives
TOOL_NAME = "Add"
TOOL_ICON = "fa:s-plus-square"
TOOL_DESCRIPTION = "Use this to insert shapes."
local toolsController = require("tevgit:create/controllers/tool.lua")
local selectionController = require("tevgit:create/controllers/select.lua")
local uiController = require("tevgit:create/controllers/ui.lua")
local propertyController = require("tevgit:create/controllers/propertyEditor.lua")
local toolSettings = require("tevgit:create/controllers/toolSettings.lua")
local helpers = require("tevgit:create/helpers.lua")
local meshShortcuts = {
cube = "primitive:cube",
sphere = "primitive:sphere",
cylinder = "primitive:cylinder",
torus = "primitive:torus",
cone = "primitive:cone",
wedge = "primitive:wedge",
corner = "primitive:corner",
worker = "tevurl:3d/worker.glb",
duck = "tevurl:3d/Duck.glb",
avocado = "tevurl:3d/Avocado.glb",
}
local toolIsActive
-- storing tool specific content in tool.data isn't really needed anymore due to modules...
local placeholderBlock = engine.construct(
"block",
nil,
{
name = "createModeAddToolPlaceholderObject",
size = vector3(1, 1, 1),
static = true,
opacity = 0.5,
physics = false,
workshopLocked=true,
static=true,
castsShadows = false,
position = vector3(0, -100, 0)
}
)
local insertProps = {
opacity = 1,
castsShadows = true,
name = "newBlock",
static=true
}
local configWindow = uiController.createWindow(uiController.workshop.interface, guiCoord(0, 66, 0, 203), guiCoord(0, 140, 0, 48), "Inserter")
local editBtn = uiController.create("guiTextBox", configWindow.content, {
size = guiCoord(1,-10,1,-10),
position = guiCoord(0,5,0,5),
align = enums.align.middle,
text = "Edit Insertable"
}, "main")
local meshWindow = uiController.createWindow(uiController.workshop.interface, guiCoord(0, 66, 0, 266), guiCoord(0, 175, 0, 22), "Presets")
local curY = 0
local curX = 0
local btnNum = 0
for meshName, actualMeshName in pairs(meshShortcuts) do
local btn = uiController.create("guiTextBox", meshWindow.content, {
size = guiCoord(.5, -10, 0, 18),
position = guiCoord(curX, 5, 0, curY + 8),
borderRadius = 3,
text = meshName,
fontSize = 16,
align = enums.align.middle
}, "primary")
btn:mouseLeftReleased(function()
placeholderBlock.mesh = actualMeshName
end)
btnNum = btnNum + 1
if curX == 0.5 then
curY = curY + 24
curX = 0
else
curX = 0.5
end
end
local meshWindowY = (22 + (math.ceil(btnNum / 2) * 26))
print(btnNum)
print((math.ceil(btnNum / 2) * 26))
print(meshWindowY)
meshWindow.size = guiCoord(0, 175, 0, meshWindowY)
local editing = false
local db = false
editBtn:mouseLeftReleased(function ()
if editing then editing = false return end
if db then return end
db = true
editing = true
editBtn.text = "Back"
-- hide these from the property editor...
propertyController.excludePropertyList = {
["position"]=true,
["workshopLocked"]=true,
["name"]=true
}
local wasPropertyEditing = propertyController.instanceEditing
propertyController.generateProperties(placeholderBlock)
propertyController.window.visible = true
local startSize = propertyController.window.size
local startPos = propertyController.window.position
engine.tween:begin(propertyController.window, 0.25, {position = guiCoord(2/3, 0, 0, 100), size = guiCoord(1/3, -10, 1, -110)}, "inOutQuad")
local camPos = workspace.camera.position
local camRot = workspace.camera.rotation
placeholderBlock.position = vector3(0,-1000,0)
for p,v in pairs(insertProps) do
placeholderBlock[p] = v
end
workspace.camera.position = vector3(-3,-1000,-20)
workspace.camera:lookAt(vector3(-3,-999,0))
repeat
wait()
until propertyController.instanceEditing ~= placeholderBlock or not editing or not toolIsActive
for p,v in pairs(insertProps) do
insertProps[p] = placeholderBlock[p]
end
placeholderBlock.opacity = 0.5
placeholderBlock.name = "createModeAddToolPlaceholderObject"
placeholderBlock.castsShadows = false
placeholderBlock.physics = false
placeholderBlock.static = true
placeholderBlock.workshopLocked = true
workspace.camera.position = camPos
workspace.camera.rotation = camRot
engine.tween:begin(propertyController.window, 0.25, {position = startPos, size = startSize}, "inOutQuad")
wait(0.3)
propertyController.excludePropertyList = {}
if wasPropertyEditing then
propertyController.generateProperties(wasPropertyEditing)
end
editing = false
db=false
editBtn.text = "Edit Insertable"
end)
configWindow.visible = false
meshWindow.visible = false
local function onToolActivated(toolId)
configWindow.visible = true
meshWindow.visible = true
--[[
@Description
Initializes the process (making placeholders & events) for placing blocks
@Params
Integer, toolId
The unique {toolId} given after registering the tool
]]
selectionController.selectable = false
toolIsActive = true
local tool = toolsController.tools[toolId]
local mouseDown = 0
--[[tool.data.placeholderBlock = engine.construct(
"block",
nil,
{
name = "createModeAddToolPlaceholderObject",
size = vector3(1, 1, 1),
static = true,
opacity = 0.5,
physics = false,
castsShadows = false
}
)]]
local lastInsertPosition = vector3(0.1,12,04)
local function placeBlock()
if lastInsertPosition ~= placeholderBlock.position then
lastInsertPosition = placeholderBlock.position
local newBlock = placeholderBlock:clone()
newBlock.workshopLocked = false
newBlock.physics = true
newBlock.parent = engine.workspace
for p,v in pairs(insertProps) do
newBlock[p] = v
end
propertyController.generateProperties(newBlock)
selectionController.setSelection({newBlock})
end
end
tool.data.mouseDownEvent = engine.input:mouseLeftPressed(function(input)
if input.systemHandled then return end
placeBlock()
local curTime = os.clock()
mouseDown = curTime
wait(1)
if (mouseDown == curTime) then
while (wait(.05)) and (mouseDown == curTime and toolsController.currentToolId == toolId) do
placeBlock()
end
end
end)
tool.data.mouseUpEvent = engine.input:mouseLeftReleased(function(input)
if input.systemHandled then return end
mouseDown = 0
end)
tool.data.keyPressedEvent = engine.input:keyPressed(function(input)
if input.systemHandled then return end
if input.key == enums.key.r then
placeholderBlock.rotation = placeholderBlock.rotation * quaternion:setEuler(0,math.rad(45),0)
end
end)
while (toolIsActive and wait() and placeholderBlock) do
if not editing then
local mouseHit = engine.physics:rayTestScreenAllHits(engine.input.mousePosition, placeholderBlock)
if #mouseHit > 0 then
placeholderBlock.position = helpers.roundVectorWithToolSettings(mouseHit[1].hitPosition + vector3(0, 0.5, 0))
end
end
end
placeholderBlock.position = vector3(0,-10000,0) --lol
end
local function onToolDeactivated(toolId)
configWindow.visible = false
meshWindow.visible = false
--[[
@Description
Clears up any loose ends during deactivation
@Params
Integer, toolId
The unique {toolId} given after registering the tool
]]
toolIsActive = false
selectionController.selectable = true
local tool = toolsController.tools[toolId]
tool.data.mouseDownEvent:disconnect()
tool.data.mouseDownEvent = nil
tool.data.mouseUpEvent:disconnect()
tool.data.mouseUpEvent = nil
tool.data.keyPressedEvent:disconnect()
tool.data.keyPressedEvent = nil
--tool.data.placeholderBlock:destroy()
--tool.data.placeholderBlock = nil
placeholderBlock.position = vector3(0,-10000,0) --lol
placeholderBlock.static = true
placeholderBlock.physics = false
end
return toolsController:register({
name = TOOL_NAME,
icon = TOOL_ICON,
description = TOOL_DESCRIPTION,
hotKey = enums.key.number1,
activated = onToolActivated,
deactivated = onToolDeactivated
})
|
-- File with hosts
return {
["localhost"] = {
plugins_to_run={
"CpuUsage",
"DiskUsageMountedOnRootDisk",
"SystemUptime",
"ProcessesCount",
"SwapUsage",
-- for debugging
-- "ValueWithTimestampInSeconds",
-- "ValueWithTimestampInMilliseconds",
-- "NoSeriesMeasurement",
-- "NoSeriesMeasurementNALC",
-- "NoSeriesMeasurementNoCustomAlarmText",
-- "TestPluginsTimeout",
-- "AlarmUpdateSeverityAndText",
-- "AlarmUpdateSeverityAndTextAndIgnoreText",
-- "AlarmUpdateTextOnly",
-- "AlarmUpdateSeverityOnly",
}
},
-- example of monitoring of a remote host
-- ["www.google.com"] = {
-- plugins_to_run={
-- "ContentAvailability",
-- },
-- is_child_device=true,
-- },
}
|
--[[
Copyright (c) Jason White. MIT license.
Description:
High-level rule resolution. Client scripts add targets that may depend on each
other. Since these targets can be defined in any order, they are added to a list
and dependencies are resolved after all targets are defined.
]]
--[[
List of targets.
]]
local targets = {}
--[[
Common table for all rules to "inherit" from.
]]
local common = {
-- Name of the target
name = "",
-- Command line prefix.
prefix = {},
-- List of dependencies
deps = {},
-- List of source files
srcs = {},
-- Location where this rule was created.
scriptdir = "",
}
--[[
Converts the target's name to a usable path. This strips off anything past
and including a ':'. This is a useful naming convention where multiple
targets share the same base name but eventually get output to separate
paths. For example, a shared library "libfoo.so" and a static library
"libfoo.a" both have "foo" as the name. With this, the rules can be named
"foo:shared" and "foo:static" to avoid a target name clash.
]]
function common:basename()
return string.match(self.name, "^[^:]*")
end
--[[
Adds a target to the table.
]]
local function add(target)
target.scriptdir = SCRIPT_DIR
table.insert(targets, target)
return target
end
--[[
Resolve dependencies. For all targets, the .rules method is called with the
set of dependencies.
]]
local function resolve()
local index = {}
for k,v in ipairs(targets) do
assert(not index[v.name], "Target name '".. v.name .."' is not unique")
index[v.name] = v
end
-- Resolve dependencies
for k,v in ipairs(targets) do
local deps = {}
for _,dep in ipairs(v.deps) do
local d = index[dep]
assert(d, string.format("Dependency '%s' does not exist for target '%s'", dep, v.name))
table.insert(deps, d)
end
-- Replace string dependencies with resolved dependencies.
v.deps = deps
v:rules()
end
end
return {
common = common,
add = add,
resolve = resolve,
}
|
function Auctionator.Utilities.ApplyThrottlingButton(button, isThrottling)
button:SetEnabled(not isThrottling)
if isThrottling then
button:SetTooltip("Throttled. Waiting for the server.")
else
button:SetTooltip("")
end
end
|
HUD_PLUS = HUD_PLUS or {}
HUD = HUD or {}
if istable(HUD) then
HUD.PLUS = {} -- I keep doing the mistake of using HUD.PLUS instead of HUD_PLUS.
local HUD_PLUS_META = {
__index = function(tab,key)
return HUD_PLUS[key]
end,
__newindex = function(tab,key,value)
HUD_PLUS[key] = value
end
}
setmetatable(HUD.PLUS,HUD_PLUS_META)
end
HUD_PLUS.FontName = "Roboto"
HUD_PLUS.FontSize = 16
HUD_PLUS.FontBold = false
HUD_PLUS.FontItalic = false
HUD_PLUS.FontUnderline = false
HUD_PLUS.FontAntiAlias = true
HUD_PLUS.FontShadow = false
HUD_PLUS.FontAdditive = false
HUD_PLUS.RecreateFont = function()
surface.CreateFont("HUD+",{
font=HUD_PLUS.FontName,
size=HUD_PLUS.FontSize,
weight=HUD_PLUS.FontBold and 800 or 500,
italic=HUD_PLUS.FontItalic,
underline=HUD_PLUS.FontUnderline,
antialias=HUD_PLUS.FontAntiAlias,
shadow=HUD_PLUS.FontShadow,
additive=HUD_PLUS.FontAdditive
})
end
HUD_PLUS.RecreateFont()
HUD_PLUS.enabled = true
HUD_PLUS.backgroundColor = Color(0,0,0,127)
HUD_PLUS.foregroundColor = Color(0,255,0)
HUD_PLUS.cornerRadius = 8
HUD_PLUS.extraRadius = 8
HUD_PLUS.signal_rate = 5
HUD_PLUS.unittable = {
data = {"B","KiB","MiB","GiB","TiB"}
}
HUD_PLUS.GetUnit = function(self,typ,mag)
return self.unittable[typ][mag]
end
HUD_PLUS.MaterialTable = {}
HUD_PLUS.GetMaterial = function(self,name)
if not self.MaterialTable[name] then
self.MaterialTable[name] = Material(name)
end
return self.MaterialTable[name]
end
HUD_PLUS.DoNothing = function(...)
return ...
end
HUD_PLUS.lastmem = 0
HUD_PLUS.maxmem = HUD_PLUS.maxmem or 0
HUD_PLUS.mem_x = 0.8
HUD_PLUS.mem_y = 0.1
HUD_PLUS.__memory = {}
HUD_PLUS.DrawMem = true
HUD_PLUS.DrawMemHUD = function(self)
if not self.DrawMem then return false end
local sw,sh = self.ScrW,self.ScrH
local xm,ym = sw*self.mem_x,sh*self.mem_y
local oym = ym
local maxw,t1,t2 = 0
local kbs = collectgarbage("count")
local texts = {
"GLua Client Memory Usage:",
string.format(" Bytes: %s %s (%.1f %s)",string.Comma(kbs*1024),self:GetUnit("data",1),kbs/1024,self:GetUnit("data",3)),
string.format(" Highest: %.1f %s (%.1f%%)",self.maxmem/1024,self:GetUnit("data",3),kbs/self.maxmem*100),
string.format(" Delta: %.1f %s/frame (%.1f %s/s)",kbs - self.lastmem,self:GetUnit("data",2),(kbs - self.lastmem)/RealFrameTime()/1024,self:GetUnit("data",3))
}
surface.SetFont("HUD+")
surface.SetTextColor(self.foregroundColor)
for k,v in pairs(texts) do
t1,t2 = surface.GetTextSize(v)
maxw = math.max(maxw,t1)
HUD_PLUS.__memory[k] = ym
ym = ym + t2
end
if self.backgroundColor.a > 0 then
draw.RoundedBox(self.cornerRadius,xm-self.extraRadius,oym-self.extraRadius,maxw+self.extraRadius*2,ym-oym+self.extraRadius*2,self.backgroundColor)
end
for k,v in pairs(texts) do
surface.SetTextPos(xm,HUD_PLUS.__memory[k])
surface.DrawText(v)
end
self.maxmem = math.max(self.maxmem,kbs)
self.lastmem = kbs
end
HUD_PLUS.curmem_server = 0
HUD_PLUS.lastmem_server = 0
HUD_PLUS.curmem_server_timestamp = 0
HUD_PLUS.lastmem_server_timestamp = 0
HUD_PLUS.maxmem_server = HUD_PLUS.maxmem_server or 0
HUD_PLUS.mems_x = 0.8
HUD_PLUS.mems_y = 0.2
HUD_PLUS.DrawServerMem = true
HUD_PLUS.DrawBasicMemUnits = false
HUD_PLUS.DrawServerMemHUD = function(self)
if not self.DrawServerMem then return false end
if self.curmem_server_timestamp == 0 then return false end
local sw,sh = self.ScrW,self.ScrH
local xm,ym = sw*self.mems_x,sh*self.mems_y
local oym = ym
local maxw,t1,t2 = 0
local kbs = self.curmem_server
local texts = {
"GLua Server Memory Usage:",
string.format(" Bytes: %s %s (%.1f %s)",string.Comma(kbs*1024),self:GetUnit("data",1),kbs/1024,self:GetUnit("data",3)),
string.format(" Highest: %.1f %s (%.1f%%)",self.maxmem_server/1024,self:GetUnit("data",3),kbs/self.maxmem_server*100),
string.format(" Delta: %.1f %s/s",(kbs - self.lastmem_server)/(self.curmem_server_timestamp - self.lastmem_server_timestamp)/1024,self:GetUnit("data",3))
}
surface.SetFont("HUD+")
surface.SetTextColor(self.foregroundColor)
for k,v in pairs(texts) do
t1,t2 = surface.GetTextSize(v)
maxw = math.max(maxw,t1)
HUD_PLUS.__memory[k] = ym
ym = ym + t2
end
if self.backgroundColor.a > 0 then
draw.RoundedBox(self.cornerRadius,xm-self.extraRadius,oym-self.extraRadius,maxw+self.extraRadius*2,ym-oym+self.extraRadius*2,self.backgroundColor)
end
for k,v in pairs(texts) do
surface.SetTextPos(xm,HUD_PLUS.__memory[k])
surface.DrawText(v)
end
end
HUD_PLUS.lastentscantime = 0
HUD_PLUS.itements = {}
local large_ammo = "icon16/package_add.png"
local small_ammo = "icon16/package.png"
local doors = "icon16/door.png"
HUD_PLUS.itemtable = {
item_healthkit = "icon16/heart_add.png",
item_healthvial = "icon16/heart.png",
item_battery = "icon16/lightning.png",
item_ammo_357 = small_ammo,
item_ammo_357_large = large_ammo,
item_ammo_ar2 = small_ammo,
item_ammo_ar2_large = large_ammo,
item_ammo_ar2_altfire = large_ammo,
item_ammo_crossbow = large_ammo,
item_ammo_pistol = small_ammo,
item_ammo_pistol_large = large_ammo,
item_box_buckshot = large_ammo,
item_rpg_round = large_ammo,
item_ammo_smg1 = small_ammo,
item_ammo_smg1_large = large_ammo,
item_ammo_smg1_grenade = large_ammo,
["class C_BaseEntity"] = "icon16/magnifier.png",
func_door = doors,
prop_door_rotating = doors,
func_door_rotating = doors,
combine_mine = "icon16/bomb.png",
npc_grenade_frag = "icon16/exclamation.png",
grenade_helicopter = "icon16/exclamation.png",
item_healthcharger = "icon16/folder_heart.png",
item_suitcharger = "icon16/folder_lightbulb.png",
item_ammo_crate = "icon16/box.png",
}
HUD_PLUS.itemstartfade = 64
HUD_PLUS.itemendfade = 256
HUD_PLUS.itemhudsize = 32
HUD_PLUS.itemhudpanelsizeratio = 1.5
HUD_PLUS.DrawItemLocations = true
HUD_PLUS.DrawItemLocationsHUD = function(self)
if not self.DrawItemLocations then return false end
if self.lastentscantime < RealTime() then
--self.lastentscantime = RealTime() + 1/self.signal_rate
self.itements = ents.FindInSphere(self.EyePos,self.itemendfade*2)
end
cam.Start3D()
for k,v in pairs(self.itements) do
if (IsValid(v) and (self.itemtable[v:GetClass()] or v:IsWeapon() and not IsValid(v.Owner)) and v:GetModel() and v:GetModel()~="" and self.LocalPlayer:IsLineOfSightClear(v)) then
local pos = v:GetPos()+v:OBBCenter()
local lengthsqr = self.EyePos:DistToSqr(pos)
local dat = pos:ToScreen()
if dat.visible then
self.__memory[v] = {dat.x,dat.y,lengthsqr}
end
end
end
cam.End3D()
cam.PopModelMatrix()
local ih = self.itemhudsize
local ih2 = ih/2
local ih2r = ih2*self.itemhudpanelsizeratio
local ihr = ih*self.itemhudpanelsizeratio
for ent,tab in pairs(self.__memory) do
if IsValid(ent) then
local pX,pY,lengthsqr = unpack(tab)
surface.SetAlphaMultiplier(math.Clamp(math.Remap(lengthsqr,self.itemstartfade*self.itemstartfade,self.itemendfade*self.itemendfade,1,0),0,1))
draw.RoundedBox(self.cornerRadius,pX-ih2r,pY-ih2r,ihr,ihr,self.backgroundColor)
surface.SetDrawColor(color_white)
surface.SetMaterial(self:GetMaterial(self.itemtable[ent:GetClass()] or "icon16/gun.png"))
surface.DrawTexturedRect(pX-ih2,pY-ih2,ih,ih)
surface.SetAlphaMultiplier(1)
end
end
cam.PushModelMatrix(self.Matrix)
end
HUD_PLUS.MinHealthBarWidth = 0.1
HUD_PLUS.HealthBarHeight = 8
HUD_PLUS.HealthBarColor = Color(255,0,0)
HUD_PLUS.HealthBackgroundBarColor = Color(0,0,0)
HUD_PLUS.ArmorBarColor = Color(0,255,255)
HUD_PLUS.TargetIDX = 0.5
HUD_PLUS.TargetIDY = 0.2
HUD_PLUS.TargetIDDynamic = true
HUD_PLUS.DrawTargetID = true
HUD_PLUS.CachedEntity = NULL
HUD_PLUS.EntityNextFade = 0
HUD_PLUS.TargetIDFadeTime = 1
local customnames = {}
HUD_PLUS.GetNameFunction = function(self,ent)
return customnames[ent:GetClass()] or ent:IsPlayer() and ent:Nick() or ent.PrintName or language.GetPhrase(ent:GetClass())
end
HUD_PLUS.DrawTargetIDHUD = function(self)
if not self.DrawTargetID then return false end
local eyetrace = self.LocalPlayer:GetEyeTrace()
local ent = eyetrace.Entity
if IsValid(ent) then
self.EntityNextFade = self.RealTime + self.TargetIDFadeTime
self.CachedEntity = ent
elseif self.EntityNextFade > self.RealTime then
ent = self.CachedEntity
end
if (IsValid(ent) and ent:Health()>0) then
local drawpos = ent:GetPos()
drawpos.z = drawpos.z + ent:OBBMaxs().z
if self.TargetIDDynamic then
cam.PopModelMatrix()
cam.Start3D()
self.__memory = drawpos:ToScreen()
cam.End3D()
end
if not self.TargetIDDynamic or self.__memory.visible then
local pX,pY = 0,0
if self.TargetIDDynamic then
pX,pY = self.__memory.x,self.__memory.y
else
pX,pY = self.ScrW*self.TargetIDX,self.ScrH*self.TargetIDY
end
surface.SetFont("HUD+")
local armor = 0
if ent:GetNWInt("HUD_PLUS.ARMOR")~=0 then
armor = ent:GetNWInt("HUD_PLUS.ARMOR")
elseif ent.Armor then
if (isfunction(ent.Armor) and ent:Armor()>0) then
armor = ent:Armor()
elseif (tonumber(ent.Armor) or 0) > 0 then
armor = ent.Armor
end
end
local hp,mhp = ent:GetNWInt("HUD_PLUS.HEALTH",ent:Health()),ent:GetNWInt("HUD_PLUS.MAX_HEALTH",ent:GetMaxHealth())
local text = self:GetNameFunction(ent).." ("..hp.."/"..mhp..")"
if armor > 0 then
text = text..string.format("+%u",armor)
end
local hpp = math.Clamp(hp/mhp,0,1)
local textx,texty = surface.GetTextSize(text)
local hW = math.max(self.MinHealthBarWidth*self.ScrW,textx)
local hX,hY = pX-hW/2,pY-self.HealthBarHeight-texty-self.extraRadius
surface.SetAlphaMultiplier((self.EntityNextFade - self.RealTime) / self.TargetIDFadeTime)
draw.RoundedBox(self.cornerRadius,hX-self.extraRadius,hY-self.extraRadius,hW+self.extraRadius*2,self.HealthBarHeight+texty+self.extraRadius*2,self.backgroundColor)
surface.SetDrawColor(self.HealthBackgroundBarColor)
surface.DrawRect(hX,hY,hW,self.HealthBarHeight)
surface.SetDrawColor(self.HealthBarColor)
surface.DrawRect(hX,hY,hW*hpp,self.HealthBarHeight)
if armor > 0 then
local app = math.Clamp(armor/mhp,0,1)
surface.SetDrawColor(self.ArmorBarColor)
surface.DrawRect(hX,hY,hW*app,self.HealthBarHeight/2)
end
draw.SimpleText(text,"HUD+",pX,pY-self.extraRadius,self.foregroundColor,TEXT_ALIGN_CENTER,TEXT_ALIGN_BOTTOM)
surface.SetAlphaMultiplier(1)
end
if self.TargetIDDynamic then
cam.PushModelMatrix(self.Matrix)
end
end
end
HUD_PLUS.ConDisableDrawMem = CreateClientConVar("hud_plus_disable_clientmemory","0",false,false,"Disables the GLua Client Memory Usage.\nNote that this value is NOT saved between sessions - use the options menu for that!")
HUD_PLUS.ConDisableDrawMemServer = CreateClientConVar("hud_plus_disable_servermemory","0",false,false,"Disables the GLua Server Memory Usage.\nNote that this value is NOT saved between sessions - use the options menu for that!")
HUD_PLUS.ConDisableDrawItemLocations = CreateClientConVar("hud_plus_disable_itemlocations","0",false,false,"Disables the Item Locator HUD.\nNote that this value is NOT saved between sessions - use the options menu for that!")
HUD_PLUS.ConDisableDrawTargetIDHUD = CreateClientConVar("hud_plus_disable_targetids","0",false,false,"Disables the Accurate TargetID HUD.\nNote that this value is NOT saved between sessions - use the options menu for that!")
HUD_PLUS.DrawAllHUDs = function(self)
self:CalculateMatrix()
cam.PushModelMatrix(self.Matrix)
if not self.ConDisableDrawMem:GetBool() then
self:DrawMemHUD()
table.Empty(self.__memory)
end
if not self.ConDisableDrawMemServer:GetBool() then
self:DrawServerMemHUD()
table.Empty(self.__memory)
end
if not self.ConDisableDrawItemLocations:GetBool() then
self:DrawItemLocationsHUD()
end
if not self.ConDisableDrawTargetIDHUD:GetBool() then
self:DrawTargetIDHUD()
table.Empty(self.__memory)
end
cam.PopModelMatrix()
end
HUD_PLUS.DefineVariables = function(self)
self.ScrW = ScrW()
self.ScrH = ScrH()
self.LocalPlayer = LocalPlayer()
self.EyePos = EyePos()
self.RealTime = RealTime()
end
HUD_PLUS.ImpliedAngle = Angle()
HUD_PLUS.SwaySensitivity = 3.5
HUD_PLUS.SwayMagnitude = 10
HUD_PLUS.SwayPassiveAmplitude = 0.01
HUD_PLUS.SwayPassiveSpeed = 1
HUD_PLUS.SwayPassiveDirection = 90
HUD_PLUS.DoSway = true
HUD_PLUS.CalculateMatrix = function(self)
self.Matrix = Matrix()
if self.DoSway then
local angs = EyeAngles()
self.ImpliedAngle = LerpAngle(FrameTime()*self.SwaySensitivity,self.ImpliedAngle,angs)
local swayFactor = HUD_PLUS.SwayPassiveAmplitude * math.sin(CurTime()*HUD_PLUS.SwayPassiveSpeed) * self.ScrW
local dirInRads = math.rad(HUD_PLUS.SwayPassiveDirection)
local dX = math.Round(-math.AngleDifference(self.ImpliedAngle.y,angs.y)*self.SwayMagnitude) + math.sin(dirInRads) * swayFactor
local dY = math.Round(math.AngleDifference(self.ImpliedAngle.p,angs.p)*self.SwayMagnitude) + math.cos(dirInRads) * swayFactor
local vec = Vector(dX,dY,0)
self.Matrix:Translate(vec)
end
end
HUD_PLUS.PainterFunction = function()
if HUD_PLUS.enabled then
HUD_PLUS:DefineVariables()
HUD_PLUS:DrawAllHUDs()
end
end
HUD_PLUS.DataReceiveFunction = function(self,func)
if func == "mem-server" then
self.lastmem_server = self.curmem_server
self.lastmem_server_timestamp = self.curmem_server_timestamp
self.maxmem_server = math.max(self.maxmem_server,self.curmem_server)
self.curmem_server = net.ReadString()
self.curmem_server_timestamp = RealTime()
elseif func == "class-name-assignment" then
table.Empty(customnames)
for i=1,net.ReadUInt(16) do
customnames[net.ReadString()] = net.ReadString()
end
end
end
HUD_PLUS.DataRelayFunction = function(length,sender)
HUD_PLUS:DataReceiveFunction(net.ReadString())
end
net.Receive("HUD+",HUD_PLUS.DataRelayFunction)
hook.Add("HUDPaint","HUD+",HUD_PLUS.PainterFunction)
HUD_PLUS.AddToolTab = function()
spawnmenu.AddToolTab("Options")
end
HUD_PLUS.AddToolCategory = function()
spawnmenu.AddToolCategory("Options","HUD+","HUD+")
end
HUD_PLUS.AddToolMenuOption = function()
spawnmenu.AddToolMenuOption("Options","HUD+","HUD+_Options","Options","hud_plus_open_gui")
end
hook.Add("AddToolMenuTabs","HUD+",HUD_PLUS.AddToolTab)
hook.Add("AddToolMenuCategories","HUD+",HUD_PLUS.AddToolCategory)
hook.Add("PopulateToolMenu","HUD+",HUD_PLUS.AddToolMenuOption)
do -- a bunch of panel generating stuff:
HUD_PLUS.GenerateColorPanel = function(self,prop,parent)
local ColorPanel,ColorLabel,ColorLabelEdit = vgui.Create("DPanel",parent)
ColorPanel:Dock(FILL)
ColorPanel:InvalidateParent(true)
ColorPanel.Color = {ColorToHSV(self[prop])}
ColorPanel.Color[4] = self[prop].a/255
ColorPanel.UpdateColors = function(self)
local h,s,v,a2 = unpack(self.Color)
HUD_PLUS[prop] = HSVToColor(h,s,v)
HUD_PLUS[prop].a = a2*255
local r,g,b,a = HUD_PLUS[prop].r,HUD_PLUS[prop].g,HUD_PLUS[prop].b,HUD_PLUS[prop].a
ColorLabel:SetText(string.format("Current Color Value:\n {R=%u,G=%u,B=%u,A=%u}\n {H=%u,S=%.2f,V=%.2f,A=%.2f}\n\nHexadecimal (Press Enter to confirm):",
r,g,b,a,h,s,v,a2
))
ColorLabel:SizeToContentsY()
local rec_709luma = 0.2126*r + 0.7152*g + 0.0722*b -- https://en.wikipedia.org/wiki/Rec._709#Luma_coefficients
if rec_709luma-(1-math.sqrt(a2))*255 < 128 then
ColorLabel:SetTextColor(color_white)
else
ColorLabel:SetTextColor(color_black)
end
local largenum = bit.lshift(r,24)+bit.lshift(g,16)+bit.lshift(b,8)+a
if a >= 255 then
largenum = bit.rshift(largenum,8)
ColorLabelEdit:SetText(bit.tohex(largenum,6))
else
ColorLabelEdit:SetText(bit.tohex(largenum))
end
end
ColorPanel.GetColorNoAlpha = function(self)
return HSVToColor(unpack(self.Color))
end
ColorPanel.Paint = function(self,w,h)
surface.SetDrawColor(HUD_PLUS[prop])
surface.DrawRect(0,0,w,h)
end
local AlphaBar = vgui.Create("DAlphaBar",ColorPanel)
AlphaBar:SetWidth(self.ScrW/50)
AlphaBar:Dock(RIGHT)
AlphaBar:SetBarColor(ColorPanel:GetColorNoAlpha())
AlphaBar:SetValue(ColorPanel.Color[4])
AlphaBar.OnChange = function(self,alpha)
ColorPanel.Color[4] = alpha
ColorPanel:UpdateColors()
self:SetBarColor(ColorPanel:GetColorNoAlpha())
end
local SVCube = vgui.Create("DColorCube",ColorPanel)
SVCube:Dock(RIGHT)
SVCube:SetColor(self[prop])
SVCube:SetCursor("crosshair")
SVCube.OnUserChanged = function(self,col)
ColorPanel.Color[2],ColorPanel.Color[3] = select(2,ColorToHSV(col))
ColorPanel:UpdateColors()
AlphaBar:SetBarColor(ColorPanel:GetColorNoAlpha())
end
local HueBar = vgui.Create("DRGBPicker",ColorPanel)
HueBar:SetWidth(self.ScrW/50)
HueBar:Dock(RIGHT)
HueBar:InvalidateParent(true)
local hbH = select(2,HueBar:GetSize())
HueBar:SetRGB(HSVToColor(ColorPanel.Color[1],1,1))
HueBar.LastY = hbH*(1-(ColorPanel.Color[1]/360))
HueBar.OnChange = function(self,col)
ColorPanel.Color[1] = ColorToHSV(col)
ColorPanel:UpdateColors()
AlphaBar:SetBarColor(ColorPanel:GetColorNoAlpha())
SVCube:SetBaseRGB(HSVToColor(ColorPanel.Color[1],1,1))
end
SVCube:SetWidth(hbH)
ColorLabel = vgui.Create("DLabel",ColorPanel)
ColorLabel:Dock(TOP)
ColorLabelEdit = vgui.Create("DTextEntry",ColorPanel)
ColorLabelEdit:Dock(TOP)
ColorLabelEdit.OnEnter = function(self)
local hex = self:GetValue()
if tonumber("0x"..hex) then
local color_construct = {}
if #hex<5 then
color_construct.r = tonumber("0x"..hex[1]..hex[1]) or 0
color_construct.g = tonumber("0x"..hex[2]..hex[2]) or 0
color_construct.b = tonumber("0x"..hex[3]..hex[3]) or 0
color_construct.a = tonumber("0x"..hex[4]..hex[4]) or 255
else
color_construct.r = tonumber("0x"..hex:sub(1,2)) or 0
color_construct.g = tonumber("0x"..hex:sub(3,4)) or 0
color_construct.b = tonumber("0x"..hex:sub(5,6)) or 0
color_construct.a = tonumber("0x"..hex:sub(7,8)) or 255
end
ColorPanel.Color = {ColorToHSV(color_construct)}
ColorPanel.Color[4] = color_construct.a/255
ColorPanel:UpdateColors()
AlphaBar:SetValue(ColorPanel.Color[4])
AlphaBar:SetBarColor(ColorPanel:GetColorNoAlpha())
SVCube:SetColor(HUD_PLUS[prop])
HueBar:SetRGB(HSVToColor(ColorPanel.Color[1],1,1))
HueBar.LastY = hbH*(1-(ColorPanel.Color[1]/360))
end
end
local Palette = vgui.Create("DColorPalette",ColorPanel)
Palette:SetHeight(8)
Palette:Dock(FILL)
Palette:SetButtonSize(8)
Palette:SetNumRows(24)
Palette:Reset()
Palette.OnValueChanged = function(self,color)
ColorPanel.Color = {ColorToHSV(color)}
ColorPanel.Color[4] = color.a/255
ColorPanel:UpdateColors()
AlphaBar:SetValue(ColorPanel.Color[4])
AlphaBar:SetBarColor(ColorPanel:GetColorNoAlpha())
SVCube:SetColor(HUD_PLUS[prop])
HueBar:SetRGB(HSVToColor(ColorPanel.Color[1],1,1))
HueBar.LastY = hbH*(1-(ColorPanel.Color[1]/360))
end
Palette.OnRightClickButton = function(ctrl,btn)
local m = DermaMenu()
m:AddOption("Save Color",function()ctrl:SaveColor(btn,self:GetColor())end)
m:AddOption("Reset Palette",function()ctrl:ResetSavedColors()end)
m:Open()
end
ColorPanel:UpdateColors()
return ColorPanel
end
HUD_PLUS.GenerateIconPanel = function(self,prop,parent)
parent:InvalidateParent(true)
local MainPanel = vgui.Create("DPanel",parent)
MainPanel:Dock(FILL)
MainPanel.Paint = HUD_PLUS.SystemBlack
local IconPanel = vgui.Create("DPanel",MainPanel)
IconPanel:SetWidth(parent:GetTall())
IconPanel:Dock(RIGHT)
IconPanel.Paint = HUD_PLUS.DoNothing
local IconBrowser = vgui.Create("DIconBrowser",IconPanel)
IconBrowser:Dock(FILL)
IconBrowser:SelectIcon("icon16/accept.png")
local IconSearch = vgui.Create("DTextEntry",IconPanel)
IconSearch:Dock(TOP)
IconSearch:SetPlaceholderText("#spawnmenu.search")
IconSearch.OnChange = function(self)
IconBrowser:FilterByText(self:GetValue())
end
local ItemPanel = vgui.Create("DPanel",MainPanel)
ItemPanel.Paint = HUD_PLUS.DoNothing
ItemPanel:Dock(FILL)
local ItemListInternal = vgui.Create("DScrollPanel",ItemPanel)
ItemListInternal:Dock(FILL)
HUD_PLUS:PaintBar(ItemListInternal:GetVBar())
ItemListInternal.RegenerateList = function(self)
self:Clear()
local newentry
for k,v in SortedPairs(HUD_PLUS[prop]) do
local Item = vgui.Create("DPanel",self)
Item:SetHeight(32)
Item:Dock(TOP)
Item.Paint = HUD_PLUS.DoNothing
local ItemIcon = vgui.Create("DImageButton",Item)
ItemIcon:SetSize(32,32)
ItemIcon:SetImage(v)
ItemIcon:Dock(LEFT)
ItemIcon.DoClick = function(self)
local Selections = DermaMenu(ItemIcon)
local ApplyOption = Selections:AddOption("Apply Selected Icon",function()
HUD_PLUS[prop][k] = IconBrowser:GetSelectedIcon()
ItemListInternal:RegenerateList()
end)
ApplyOption:SetIcon(IconBrowser:GetSelectedIcon())
local DeleteOption = Selections:AddOption("Delete Entry",function()
HUD_PLUS[prop][k] = nil
ItemListInternal:RegenerateList()
end)
DeleteOption:SetIcon("icon16/delete.png")
Selections:Open()
end
ItemIcon.DoRightClick = ItemIcon.DoClick
local ItemName = vgui.Create("DTextEntry",Item)
HUD_PLUS:PaintTextBox(ItemName)
ItemName:Dock(FILL)
ItemName:SetText(k)
ItemName.Think = function(self)
if self:GetValue()~=k and not self:IsEditing() then
if not HUD_PLUS[prop][self:GetValue()] then
local oldV = HUD_PLUS[prop][k]
HUD_PLUS[prop][k] = nil
HUD_PLUS[prop][self:GetValue()] = oldV
end
ItemListInternal:RegenerateList()
end
end
if k == "< New Entry >" then
newentry = Item
end
end
if IsValid(newentry) then
self:ScrollToChild(newentry)
end
end
ItemListInternal:RegenerateList()
local ItemAddButton = vgui.Create("DButton",ItemPanel)
ItemAddButton:Dock(TOP)
ItemAddButton:SetText("Add Item")
ItemAddButton.DoClick = function(self)
HUD_PLUS[prop]["< New Entry >"] = IconBrowser:GetSelectedIcon()
ItemListInternal:RegenerateList()
end
return MainPanel
end
HUD_PLUS.AddColorOption = function(self,pnl,class,name)
local Category = pnl:Add(name)
Category.Paint = HUD_PLUS.DoNothing
Category:SetHeight(self.ScrH/6)
Category:SetContents(self:GenerateColorPanel(class,Category))
end
HUD_PLUS.AddIconOption = function(self,pnl,class,name)
local Category = pnl:Add(name)
Category.Paint = HUD_PLUS.DoNothing
Category:SetHeight(self.ScrH/3)
Category:SetContents(self:GenerateIconPanel(class,Category))
end
HUD_PLUS.AddNumberOption = function(self,pnl,class,name,mins,maxs,decimals,default)
local NumSlider = vgui.Create("DNumSlider",pnl)
NumSlider:SetMinMax(mins,maxs)
NumSlider:SetText(name)
NumSlider:SetValue(self[class])
if decimals then
NumSlider:SetDecimals(decimals)
end
if default then
NumSlider:SetDefaultValue(default)
end
NumSlider.OnValueChanged = function(self,val)
HUD_PLUS[class] = val
end
NumSlider.Label:SetTextColor(color_white)
NumSlider.TextArea:SetTextColor(color_white)
pnl:AddItem(NumSlider)
end
HUD_PLUS.AddCheckBoxOption = function(self,pnl,class,name)
local CheckBox = vgui.Create("DCheckBoxLabel",pnl)
CheckBox:SetText(name)
CheckBox:SetValue(self[class])
CheckBox.OnChange = function(self,val)
HUD_PLUS[class] = val
end
CheckBox.Label:SetTextColor(color_white)
pnl:AddItem(CheckBox)
end
HUD_PLUS.AddTextEntryOption = function(self,pnl,class,name)
local MainPanel = vgui.Create("DPanel",pnl)
MainPanel.Paint = HUD_PLUS.DoNothing
local TextLabel = vgui.Create("DLabel",MainPanel)
TextLabel:SetText(name)
TextLabel:SetTextColor(color_white)
TextLabel:SizeToContentsX()
TextLabel:Dock(LEFT)
local TextEntry = vgui.Create("DTextEntry",MainPanel)
HUD_PLUS:PaintTextBox(TextEntry)
TextEntry:Dock(FILL)
TextEntry:SetText(HUD_PLUS[class])
TextEntry.OnChange = function(self)
HUD_PLUS[class] = self:GetValue()
end
pnl:AddItem(MainPanel)
end
HUD_PLUS.AddButtonOption = function(self,pnl,name,func)
local Button = vgui.Create("DButton",pnl)
Button:SetText(name)
Button:SetTextColor(color_white)
Button.Paint = HUD_PLUS.SystemBlackButton
Button.DoClick = func
pnl:AddItem(Button)
end
HUD_PLUS.SystemBlackCol = Color(0,0,0,191)
HUD_PLUS.editableColor = Color(255,255,255,3)
HUD_PLUS.editColor = Color(255,255,255,31)
HUD_PLUS.hoverColor = Color(255,255,255,191)
HUD_PLUS.highlightColor = Color(0,255,255,191)
HUD_PLUS.SystemBlack = function(pnl,w,h)
draw.RoundedBox(4,0,0,w,h,HUD_PLUS.SystemBlackCol)
end
HUD_PLUS.SystemBlackButton = function(pnl,w,h)
draw.RoundedBox(4,0,0,w,h,pnl.Depressed and HUD_PLUS.highlightColor or pnl:IsHovered() and HUD_PLUS.hoverColor or HUD_PLUS.SystemBlackCol)
end
HUD_PLUS.SystemBlackBrighter = function(pnl,w,h)
draw.RoundedBox(4,0,0,w,h,HUD_PLUS.editableColor)
end
HUD_PLUS.PaintBar = function(self,pnl)
pnl.btnUp.Paint = function(self,w,h)
HUD_PLUS.SystemBlackButton(self,w,h)
draw.SimpleText("t","Marlett",w/2,h/2,color_white,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
end
pnl.btnDown.Paint = function(self,w,h)
HUD_PLUS.SystemBlackButton(self,w,h)
draw.SimpleText("u","Marlett",w/2,h/2,color_white,TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
end
pnl.btnGrip.Paint = HUD_PLUS.SystemBlackButton
pnl.Paint = HUD_PLUS.SystemBlackBrighter
end
HUD_PLUS.PaintTextBox = function(self,pnl)
pnl:SetPaintBackground(false)
pnl:SetDrawBorder(false)
pnl:SetTextColor(color_white)
pnl:SetCursorColor(color_white)
pnl:SetHighlightColor(HUD_PLUS.highlightColor)
pnl.OnGetFocus = function(self)
self.DrawEditOverlay = true
hook.Run("OnTextEntryGetFocus",self)
end
pnl.OnLoseFocus = function(self)
self.DrawEditOverlay = nil
hook.Run("OnTextEntryLoseFocus",self)
end
pnl.PaintOver = function(self,w,h)
if self.DrawEditOverlay then
draw.RoundedBox(4,0,0,w,h,HUD_PLUS.editColor)
else
draw.RoundedBox(4,0,0,w,h,HUD_PLUS.editableColor)
end
end
end
end
HUD_PLUS.ShowOptions = function()
HUD_PLUS:DefineVariables()
local Main = vgui.Create("DFrame")
Main:SetSize(HUD_PLUS.ScrW/3,HUD_PLUS.ScrH/2)
Main:Center()
Main:SetTitle("HUD+ Options")
Main:SetIcon("icon16/application_view_tile.png")
Main:SetSizable(true)
Main:SetDraggable(true)
Main:MakePopup()
Main.Paint = function(self,w,h)
HUD_PLUS.SystemBlack(self,w,h)
if self:IsActive() then
draw.RoundedBox(4,0,0,w,24,HUD_PLUS.SystemBlackCol)
end
draw.SimpleText("o","Marlett",w,h,color_white,TEXT_ALIGN_RIGHT,TEXT_ALIGN_BOTTOM)
end
local Sheets = vgui.Create("DPropertySheet",Main)
Sheets:Dock(FILL)
Sheets.Paint = HUD_PLUS.DoNothing
Sheets.InstallSheet = function(self,name,icn)
local Sheet = vgui.Create("DCategoryList",Sheets)
HUD_PLUS:PaintBar(Sheet:GetVBar())
Sheet:Dock(FILL)
Sheet.Paint = HUD_PLUS.SystemBlack
local InternalSheet = Sheets:AddSheet(name,Sheet,icn)
InternalSheet.Tab.Paint = function(self,w,h)
if self:IsActive() then
draw.RoundedBoxEx(8,0,0,w,h,HUD_PLUS.SystemBlackCol,true,true)
end
end
return Sheet
end
local GeneralList = Sheets:InstallSheet("General","icon16/world.png")
HUD_PLUS:AddCheckBoxOption(GeneralList,"enabled","Enable HUD")
HUD_PLUS:AddColorOption(GeneralList,"backgroundColor","Background Colour")
HUD_PLUS:AddColorOption(GeneralList,"foregroundColor","Foreground Colour")
HUD_PLUS:AddNumberOption(GeneralList,"cornerRadius","Roundness",0,32,0,8)
HUD_PLUS:AddNumberOption(GeneralList,"extraRadius","Padding",0,32,0,8)
HUD_PLUS:AddCheckBoxOption(GeneralList,"DoSway","Enable Sway")
HUD_PLUS:AddNumberOption(GeneralList,"SwaySensitivity","Sway Acceleration",0,64,2,3.5)
HUD_PLUS:AddNumberOption(GeneralList,"SwayMagnitude","Sway Magnitude",0,64,2,10)
HUD_PLUS:AddNumberOption(GeneralList,"SwayPassiveAmplitude","Passive Sway Magnitude",0,1,3,0.01)
HUD_PLUS:AddNumberOption(GeneralList,"SwayPassiveDirection","Passive Sway Direction",0,180,1,90)
HUD_PLUS:AddNumberOption(GeneralList,"SwayPassiveSpeed","Passive Sway Speed",0,32,2,1)
HUD_PLUS:AddButtonOption(GeneralList,"Reset All Options",function()
Main:Close()
HUD_PLUS:ResetEverything()
end)
local FontList = Sheets:InstallSheet("Fonts","icon16/font.png")
HUD_PLUS:AddTextEntryOption(FontList,"FontName","System Font Name:")
HUD_PLUS:AddNumberOption(FontList,"FontSize","Font Size",0,128,0,16)
HUD_PLUS:AddCheckBoxOption(FontList,"FontBold","Bold Font")
HUD_PLUS:AddCheckBoxOption(FontList,"FontItalic","Italic Font")
HUD_PLUS:AddCheckBoxOption(FontList,"FontUnderline","Underline Font")
HUD_PLUS:AddCheckBoxOption(FontList,"FontAntiAlias","Anti-alias Font")
HUD_PLUS:AddCheckBoxOption(FontList,"FontShadow","Enable Font Shadow")
HUD_PLUS:AddCheckBoxOption(FontList,"FontAdditive","Draw Font Additively")
HUD_PLUS:AddButtonOption(FontList,"Recreate Font",HUD_PLUS.RecreateFont)
local MemList = Sheets:InstallSheet("Memory Usage","icon16/script_gear.png")
HUD_PLUS:AddCheckBoxOption(MemList,"DrawMem","Draw Client HUD")
HUD_PLUS:AddNumberOption(MemList,"mem_x","Client Position X",0,1,3,0.8)
HUD_PLUS:AddNumberOption(MemList,"mem_y","Client Position Y",0,1,3,0.1)
HUD_PLUS:AddCheckBoxOption(MemList,"DrawServerMem","Draw Server HUD")
HUD_PLUS:AddNumberOption(MemList,"mems_x","Server Position X",0,1,3,0.8)
HUD_PLUS:AddNumberOption(MemList,"mems_y","Server Position Y",0,1,3,0.2)
HUD_PLUS:AddCheckBoxOption(MemList,"DrawBasicMemUnits","Display KB instead of KiB, MB instead of MiB, etc.")
MemList.Think = function(self)
if HUD_PLUS.DrawBasicMemUnits and not self.UseBasic then
self.UseBasic = true
HUD_PLUS.unittable.data = {"B","KB","MB","GB","TB"}
elseif not HUD_PLUS.DrawBasicMemUnits and self.UseBasic then
self.UseBasic = false
HUD_PLUS.unittable.data = {"B","KiB","MiB","GiB","TiB"}
end
end
local ItemList = Sheets:InstallSheet("Entity Indicators","icon16/bricks.png")
HUD_PLUS:AddCheckBoxOption(ItemList,"DrawItemLocations","Draw Entity Indicators")
HUD_PLUS:AddIconOption(ItemList,"itemtable","Entity Icons")
HUD_PLUS:AddNumberOption(ItemList,"itemstartfade","Start Fade",0,2048,0,64)
HUD_PLUS:AddNumberOption(ItemList,"itemendfade","End Fade",0,2048,0,256)
HUD_PLUS:AddNumberOption(ItemList,"itemhudsize","Indicator Size",0,512,0,32)
HUD_PLUS:AddNumberOption(ItemList,"itemhudpanelsizeratio","Border Size Multiplier",0,10,2,1.5)
local TargetIDList = Sheets:InstallSheet("TargetIDs","icon16/report_user.png")
HUD_PLUS:AddCheckBoxOption(TargetIDList,"DrawTargetID","Draw Target IDs")
HUD_PLUS:AddNumberOption(TargetIDList,"TargetIDFadeTime","Fade Time",0,10,2,1)
HUD_PLUS:AddNumberOption(TargetIDList,"TargetIDX","X Position",0,1,3,0.5)
HUD_PLUS:AddNumberOption(TargetIDList,"TargetIDY","Y Position",0,1,3,0.2)
HUD_PLUS:AddCheckBoxOption(TargetIDList,"TargetIDDynamic","Use Dynamic Position Instead")
HUD_PLUS:AddNumberOption(TargetIDList,"HealthBarHeight","Health Bar Height",0,32,0,8)
HUD_PLUS:AddNumberOption(TargetIDList,"MinHealthBarWidth","Minimum Health Bar Width",0,1,3,0.2)
HUD_PLUS:AddColorOption(TargetIDList,"HealthBarColor","Health Colour")
HUD_PLUS:AddColorOption(TargetIDList,"HealthBackgroundBarColor","Health Background Colour")
HUD_PLUS:AddColorOption(TargetIDList,"ArmorBarColor","Armour Colour")
end
HUD_PLUS.LoadEverything = function()
local data = util.JSONToTable(file.Read("hud+_scheme.txt","DATA") or "")
if data then
table.Merge(HUD_PLUS,data)
end
HUD_PLUS.maxmem = 0
HUD_PLUS.maxmem_server = 0
end
HUD_PLUS.SaveEverything = function()
file.Write("hud+_scheme.txt",util.TableToJSON(HUD_PLUS,true))
end
HUD_PLUS.ResetEverything = function()
include("autorun/client/hud+.lua")
end
hook.Add("InitPostEntity","HUD+",HUD_PLUS.LoadEverything)
hook.Add("ShutDown","HUD+",HUD_PLUS.SaveEverything)
concommand.Add("hud_plus_open_gui",HUD_PLUS.ShowOptions)
concommand.Add("hud_plus_reset",HUD_PLUS.ResetEverything)
|
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include("shared.lua")
util.AddNetworkString("weapon_locker_use")
util.AddNetworkString("weapon_locker_give")
local delay = 2
local nextOccurance = 0
function ENT:Initialize()
self:SetModel("models/Items/ammocrate_smg1.mdl")
self:PhysicsInit(SOLID_VPHYSICS)
self:SetMoveType(MOVETYPE_VPHYSICS)
self:SetSolid(SOLID_VPHYSICS)
local phys = self:GetPhysicsObject()
if(phys:IsValid()) then
phys:Wake()
end
end
function ENT:Use(activator)
if activator:IsValid() and activator:IsPlayer() then
local timeLeft = nextOccurance - CurTime()
if timeLeft < 0 then
net.Start("weapon_locker_use")
net.WriteEntity(activator)
net.Send(activator)
nextOccurance = CurTime() + delay
end
end
end
net.Receive("weapon_locker_give", function(len, ply)
local weapon = net.ReadString()
if weapon == "shotgun" then
ply:Give("m9k_remington870")
elseif weapon == "grenade" then
ply:Give("m9k_m61_frag")
ply:GiveAmmo(5, "grenade")
elseif weapon == "lmg" then
ply:Give("m9k_m249lmg")
elseif weapon == "ar1" then
ply:Give("m9k_m416")
elseif weapon == "ar2" then
ply:Give("m9k_g36")
elseif weapon == "dmr" then
ply:Give("m9k_m16a4_acog")
elseif weapon == "fillammo" then
ply:GiveAmmo(180, "ar2")
ply:GiveAmmo(30, "pistol")
end
end)
|
CParamCache = torch.class('CParamCache')
function CParamCache:__init()
self.taCache = {}
self.nFreqCache = 2
self.nCount = 0
end
function CParamCache:update(teP, dErr)
if dErr then
local nD = teP:size(1)
if self.taCache[nD] == nil then
self.taCache[nD] = {}
end
table.insert(self.taCache[nD], {teP = teP:clone(), dErr = dErr})
end
end
function CParamCache:getNew(nD)
return (torch.rand(nD)*2 - 1)
end
function CParamCache:get(nD)
local taCurrCache = self.taCache[nD]
if taCurrCache ~= nil then
self.nCount = self.nCount + 1
if (self.nCount % self.nFreqCache == 0 ) then
local idx = math.random(1, #taCurrCache)
return taCurrCache[idx].teP:clone()
end
end
return self:getNew(nD)
end
|
travelnet.MAX_STATIONS_PER_NETWORK = 24;
-- set this to true if you want a simulated beam effect
travelnet.travelnet_effect_enabled = false;
-- set this to true if you want a sound to be played when the travelnet is used
travelnet.travelnet_sound_enabled = false;
-- if you set this to false, travelnets cannot be created
-- (this may be useful if you want nothing but the elevators on your server)
travelnet.travelnet_enabled = true;
-- if you set travelnet.elevator_enabled to false, you will not be able to
-- craft, place or use elevators
travelnet.elevator_enabled = true;
-- if you set this to false, doors will be disabled
travelnet.doors_enabled = true;
-- starts an abm which re-adds travelnet stations to networks in case the savefile got lost
travelnet.abm_enabled = false;
-- change these if you want other receipes for travelnet or elevator
travelnet.travelnet_recipe = {
{"default:glass", "default:steel_ingot", "default:glass", },
{"default:glass", "default:mese", "default:glass", },
{"default:glass", "default:steel_ingot", "default:glass", }
}
travelnet.elevator_recipe = {
{"default:steel_ingot", "default:glass", "default:steel_ingot", },
{"default:steel_ingot", "", "default:steel_ingot", },
{"default:steel_ingot", "default:glass", "default:steel_ingot", }
}
travelnet.tiles_travelnet = {
"travelnet_travelnet_front.png", -- backward view
"travelnet_travelnet_back.png", -- front view
"travelnet_travelnet_side.png", -- sides :)
"default_steel_block.png", -- view from top
"default_clay.png", -- view from bottom
}
travelnet.tiles_elevator = {
"travelnet_elevator_front.png",
"travelnet_elevator_inside_controls.png",
"travelnet_elevator_sides_outside.png",
"travelnet_elevator_inside_ceiling.png",
"travelnet_elevator_inside_floor.png",
"default_steel_block.png"
}
travelnet.travelnet_inventory_image = "travelnet_inv.png"
travelnet.elevator_inventory_image = "travelnet_elevator_inv.png"
if( minetest.registered_nodes["mcl_core:wood"]) then
local w_texture = "default_wood.png^[transformR90"; -- "mcl_doors_door_spruce_lower.png";
travelnet.travelnet_recipe = {
{"mcl_stairs:slab_wood", "mcl_stairs:slab_wood", "mcl_stairs:slab_wood",},
{"mesecons_torch:mesecon_torch_on", "mcl_chests:chest", "mesecons_torch:mesecon_torch_on"},
{"mesecons_torch:mesecon_torch_on", "mcl_chests:chest", "mesecons_torch:mesecon_torch_on"},
-- {"core:glass", "mcl_core:iron_ingot", "mcl_core:glass", },
-- {"mcl_core:glass", "mesecons_torch:redstoneblock", "mcl_core:glass", },
-- {"mcl_core:glass", "mcl_core:iron_ingot", "mcl_core:glass", }
}
travelnet.elevator_recipe = {
{"mcl_stairs:slab_wood", "mcl_stairs:slab_wood", "mcl_stairs:slab_wood",},
{"mesecons_torch:mesecon_torch_on", "", "mesecons_torch:mesecon_torch_on"},
{"mesecons_torch:mesecon_torch_on", "", "mesecons_torch:mesecon_torch_on"},
-- {"mcl_core:iron_ingot", "mcl_core:glass", "mcl_core:iron_ingot", },
-- {"mcl_core:iron_ingot", "", "mcl_core:iron_ingot", },
-- {"mcl_core:iron_ingot", "mcl_core:glass", "mcl_core:iron_ingot", }
}
travelnet.tiles_travelnet = {
w_texture, -- backward view
w_texture, -- front view
w_texture, -- sides :)
w_texture, -- view from top
w_texture, -- view from bottom
}
travelnet.tiles_elevator = {
"mcl_core_planks_big_oak.png^[transformR90", -- front
"mcl_core_planks_big_oak.png^[transformR90", -- inside
"mcl_core_planks_big_oak.png^[transformR90", -- sides outside
"mcl_core_planks_big_oak.png^[transformR90", -- inside ceiling
"mcl_core_planks_big_oak.png^[transformR90", -- inside floor
"mcl_core_planks_big_oak.png^[transformR90", -- top
}
travelnet.travelnet_inventory_image = nil
travelnet.elevator_inventory_image = nil
end
-- if this function returns true, the player with the name player_name is
-- allowed to add a box to the network named network_name, which is owned
-- by the player owner_name;
-- if you want to allow *everybody* to attach stations to all nets, let the
-- function always return true;
-- if the function returns false, players with the travelnet_attach priv
-- can still add stations to that network
travelnet.allow_attach = function( player_name, owner_name, network_name )
return false;
end
-- if this returns true, a player named player_name can remove a travelnet station
-- from network_name (owned by owner_name) even though he is neither the owner nor
-- has the travelnet_remove priv
travelnet.allow_dig = function( player_name, owner_name, network_name )
return false;
end
-- if this function returns false, then player player_name will not be allowed to use
-- the travelnet station_name_start on networ network_name owned by owner_name to travel to
-- the station station_name_target on the same network;
-- if this function returns true, the player will be transfered to the target station;
-- you can use this code to i.e. charge the player money for the transfer or to limit
-- usage of stations to players in the same fraction on PvP servers
travelnet.allow_travel = function( player_name, owner_name, network_name, station_name_start, station_name_target )
--minetest.chat_send_player( player_name, "Player "..tostring( player_name ).." tries to use station "..tostring( station_name_start )..
-- " on network "..tostring( network_name ).." owned by "..tostring( owner_name ).." in order to travel to "..
-- tostring( station_name_target )..".");
return true;
end
travelnet.travelnet_sound_enabled = true
|
-- MIT License
--
-- Copyright (c) 2018 Mikkel Lykke Jørgensen (MLJWare)
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
--
-- The above copyright notice and this permission notice shall be included in all
-- copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-- SOFTWARE.
local path = (...)
local subpath = path:sub("^(.-)[^.]$")
local Vector3 = require (subpath.."Vector3")
local Matrix4x4 = require (subpath.."Matrix4x4")
local Transform = {}
Transform.__index = Transform
local function new(position, rotation, scale)
local self = setmetatable({
position = position or Vector3(0,0,0);
rotation = rotation or Vector3(0,0,0);
scale = scale or Vector3(1,1,1);
_matrix_ = Matrix4x4.new_identity();
}, Transform)
return self
end
setmetatable(Transform, {
__call = function (_, position, rotation, scale)
return new(position, rotation, scale)
end
})
function Transform.is(a)
return getmetatable(a) == Transform
end
function Transform:matrix()
return self._matrix_
: to_identity()
: rotate_vec (self.rotation)
: scale_vec (self.scale)
: translate_vec(self.position)
end
function Transform:copy()
return new(self.position:copy(), self.rotation:copy(), self.scale:copy())
end
function Transform:translate(tx, ty, tz)
self.position:addn(tx, ty, tz)
return self
end
function Transform:sendTo(shader, id)
self:matrix():sendTo(shader, id)
end
return Transform
|
--[[
Copyright (C) 2013-2018 Draios Inc dba Sysdig.
This file is part of sysdig.
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.
--]]
-- Chisel description
description = "Counts the total bytes read from and written to files.";
short_description = "Sum of file I/O bytes";
category = "I/O";
-- Chisel argument list
args =
{
}
tot = 0
totin = 0
totout = 0
-- Initialization callback
function on_init()
-- Request the fields
fbytes = chisel.request_field("evt.rawarg.res")
ftime = chisel.request_field("evt.time.s")
fisread = chisel.request_field("evt.is_io_read")
-- set the filter
chisel.set_filter("evt.is_io=true and fd.type=file")
chisel.set_interval_s(1)
return true
end
-- Event parsing callback
function on_event()
bytes = evt.field(fbytes)
isread = evt.field(fisread)
if bytes ~= nil and bytes > 0 then
tot = tot + bytes
if isread then
totin = totin + bytes
else
totout = totout + bytes
end
end
return true
end
function on_interval(delta)
etime = evt.field(ftime)
print(etime .. " in:" .. totin .. " out:" .. totout .. " tot:" .. tot)
tot = 0
totin = 0
totout = 0
return true
end
|
require 'nn'
local model = {}
-- warning: module 'data [type 5]' not found
table.insert(model, {'conv1', nn.SpatialConvolution(3, 96, 11, 11, 4, 4, 0, 0)})
table.insert(model, {'relu0', nn.ReLU(true)})
table.insert(model, {'cccp1', nn.SpatialConvolution(96, 96, 1, 1, 1, 1, 0, 0)})
table.insert(model, {'relu1', nn.ReLU(true)})
table.insert(model, {'cccp2', nn.SpatialConvolution(96, 96, 1, 1, 1, 1, 0, 0)})
table.insert(model, {'relu2', nn.ReLU(true)})
table.insert(model, {'pool0', nn.SpatialMaxPooling(3, 3, 2, 2, 0, 0):ceil()})
table.insert(model, {'conv2', nn.SpatialConvolution(96, 256, 5, 5, 1, 1, 2, 2)})
table.insert(model, {'relu3', nn.ReLU(true)})
table.insert(model, {'cccp3', nn.SpatialConvolution(256, 256, 1, 1, 1, 1, 0, 0)})
table.insert(model, {'relu5', nn.ReLU(true)})
table.insert(model, {'cccp4', nn.SpatialConvolution(256, 256, 1, 1, 1, 1, 0, 0)})
table.insert(model, {'relu6', nn.ReLU(true)})
table.insert(model, {'pool2', nn.SpatialMaxPooling(3, 3, 2, 2, 0, 0):ceil()})
table.insert(model, {'conv3', nn.SpatialConvolution(256, 384, 3, 3, 1, 1, 1, 1)})
table.insert(model, {'relu7', nn.ReLU(true)})
table.insert(model, {'cccp5', nn.SpatialConvolution(384, 384, 1, 1, 1, 1, 0, 0)})
table.insert(model, {'relu8', nn.ReLU(true)})
table.insert(model, {'cccp6', nn.SpatialConvolution(384, 384, 1, 1, 1, 1, 0, 0)})
table.insert(model, {'relu9', nn.ReLU(true)})
table.insert(model, {'pool3', nn.SpatialMaxPooling(3, 3, 2, 2, 0, 0):ceil()})
table.insert(model, {'drop', nn.Dropout(0.500000)})
table.insert(model, {'conv4-1024', nn.SpatialConvolution(384, 1024, 3, 3, 1, 1, 1, 1)})
table.insert(model, {'relu10', nn.ReLU(true)})
table.insert(model, {'cccp7-1024', nn.SpatialConvolution(1024, 1024, 1, 1, 1, 1, 0, 0)})
table.insert(model, {'relu11', nn.ReLU(true)})
table.insert(model, {'cccp8-1024', nn.SpatialConvolution(1024, 1000, 1, 1, 1, 1, 0, 0)})
table.insert(model, {'relu12', nn.ReLU(true)})
table.insert(model, {'pool4', nn.SpatialAveragePooling(6, 6, 1, 1, 0, 0):ceil()})
table.insert(model, {'loss', nn.SoftMax()})
return model
|
--proc/system/time: time functions
--Written by Cosmin Apreutesei. Public Domain.
setfenv(1, require'winapi')
ffi.cdef[[
DWORD GetTickCount();
ULONGLONG GetTickCount64();
BOOL QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount);
BOOL QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency);
BOOL QueryUnbiasedInterruptTime(PULONGLONG UnbiasedTime);
]]
GetTickCount = C.GetTickCount --NOTE: wraps around after 49 days of system runtime
function GetTickCount64() --Vista+
return C.GetTickCount64()
end
function QueryPerformanceCounter(counter)
counter = counter or types.LARGE_INTEGER(counter)
checknz(C.QueryPerformanceCounter(counter))
return counter
end
function QueryPerformanceFrequency(freq)
freq = freq or types.LARGE_INTEGER(freq)
checknz(C.QueryPerformanceFrequency(freq))
return freq
end
function QueryUnbiasedInterruptTime(time) --Vista+
time = time or ffi.new'ULONGLONG[1]'
checknz(C.QueryUnbiasedInterruptTime(time))
return time[0]
end
if not ... then
print('GetTickCount', GetTickCount())
--print('GetTickCount64', GetTickCount64())
print('QueryPerformanceCounter', QueryPerformanceCounter().QuadPart,
QueryPerformanceCounter().QuadPart - tonumber(QueryPerformanceCounter().QuadPart))
print('QueryPerformanceFrequency', QueryPerformanceFrequency().QuadPart)
--print('QueryUnbiasedInterruptTime', QueryUnbiasedInterruptTime())
end
|
function n0(n, start)
ROUND.chair[n].zero = ROUND.chair[n].zero or {}
if ROUND.topCard.card[2] == "n0" then
ROUND.chair[n].zero[ROUND.topCard.card[1]] = true
if ROUND.chair[n].zero.red and ROUND.chair[n].zero.blue and ROUND.chair[n].zero.yellow and ROUND.chair[n].zero.green then
unlockChair(ROUND.chair[n].owner, "elemental")
end
end
if ROUND.chair[n].owner == "Charlotte" and ROUND.gameMode[ROUND.topCard.card[1]] then
actionCardEffect()
actionCard(n, _G[ROUND.topCard.card[1]])
elseif ROUND.topCard.card[2] == "n0" and FLAG[ROUND.chair[n].flag].color == ROUND.topCard.card[1] and not ROUND.chair[n].peace2 then
actionCardEffect()
actionCard(n, _G[FLAG[ROUND.chair[n].flag].func])
elseif ROUND.gameMode.stack and not start then
local can = {}
local stack = false
for i, v in pairs(ROUND.chair[n].hand) do
if v[2] == ROUND.topCard.card[2] then
can[i] = true
stack = true
end
end
if stack then
if #ROUND.chair[n].hand == 2 then
showUno(n)
end
ROUND.chair[n].played = true
ROUND.chair[n].whiteList = can
showPass(n)
ui.addTextArea(19, string.format("<p align='center'><font color='#ffffff'>"..translate(ROUND.chair[n].owner, "WARN_STACKING"), ROUND.topCard.card[2]:sub(2,2)), ROUND.chair[n].owner, 200, 305, 400, nil, 0, 0, 0, false)
else
passTurn()
batataTimer(n)
ROUND.chair[n].confuse = false
end
elseif ROUND.gameMode.sequence and not start then
local can = {
n0 = {"x","n1"},
n1 = {"n0","n2"},
n2 = {"n1","n3"},
n3 = {"n2","n4"},
n4 = {"n3","n5"},
n5 = {"n4","n6"},
n6 = {"n5","n7"},
n7 = {"n6","n8"},
n8 = {"n7","n9"},
n9 = {"n8","x"},
}
local sequence = false
local pool = {}
if ROUND.chair[n].played then
if can[ROUND.topCard.card2[2]][1] == ROUND.topCard.card[2] then
ROUND.chair[n].played = "DOWN"
elseif can[ROUND.topCard.card2[2]][2] == ROUND.topCard.card[2] then
ROUND.chair[n].played = "UP"
end
end
if ROUND.chair[n].played == "DOWN" then
for i, v in pairs(ROUND.chair[n].hand) do
if ROUND.topCard.card[1] == v[1] and can[ROUND.topCard.card[2]][1] == v[2] then
pool[i] = true
sequence = true
end
end
elseif ROUND.chair[n].played == "UP" then
for i, v in pairs(ROUND.chair[n].hand) do
if ROUND.topCard.card[1] == v[1] and can[ROUND.topCard.card[2]][2] == v[2] then
pool[i] = true
sequence = true
end
end
else
for i, v in pairs(ROUND.chair[n].hand) do
if ROUND.topCard.card[1] == v[1] and (can[ROUND.topCard.card[2]][1] == v[2] or can[ROUND.topCard.card[2]][2] == v[2]) then
pool[i] = true
sequence = true
end
end
end
if sequence then
if #ROUND.chair[n].hand == 2 then
showUno(n)
end
ROUND.chair[n].whiteList = pool
if ROUND.chair[n].played then
if ROUND.chair[n].played == true then
if ROUND.chair[n].played == "DOWN" then
ui.addTextArea(19,"<p align='center'><font color='#ffffff'>"..translate(ROUND.chair[n].owner, "WARN_DOWN"), ROUND.chair[n].owner, 200, 305, 400, nil, 0, 0, 0, false)
elseif ROUND.chair[n].played == "UP" then
ui.addTextArea(19,"<p align='center'><font color='#ffffff'>"..translate(ROUND.chair[n].owner, "WARN_UP"), ROUND.chair[n].owner, 200, 305, 400, nil, 0, 0, 0, false)
end
else
local text = {DOWN="WARN_DOWN", UP="WARN_UP"}
ui.addTextArea(19,"<p align='center'><font color='#ffffff'>"..translate(ROUND.chair[n].owner, text[ROUND.chair[n].played]), ROUND.chair[n].owner, 200, 305, 400, nil, 0, 0, 0, false)
end
else
ROUND.chair[n].played = true
ui.addTextArea(19,"<p align='center'><font color='#ffffff'>"..translate(ROUND.chair[n].owner, "WARN_UP_DOWN"), ROUND.chair[n].owner, 200, 305, 400, nil, 0, 0, 0, false)
end
else
passTurn()
batataTimer(n)
ROUND.chair[n].confuse = false
end
elseif ROUND.gameMode.perfection and not start and isNumeric(ROUND.topCard.card) == #ROUND.chair[n].hand+1 then
ROUND.turn = previousChair(ROUND.turn)
explosion(37, ROUND.chair[n].x, 80, 10, 10)
ui.addTextArea(19, string.format("<p align='center'><font color='#ffffff'>%s", translate(ROUND.chair[n].owner, "WARN_PERFECTION")), ROUND.chair[n].owner, 200, 305, 400, nil, 0, 0, 0, false)
passTurn()
batataTimer(n, true)
else
passTurn()
batataTimer(n)
ROUND.chair[n].confuse = false
end
end
n1, n2, n3, n4, n5, n6, n7, n8, n9 = n0, n0, n0, n0, n0, n0, n0, n0, n0
|
local marketplace = game:GetService("MarketplaceService")
---
local gamepass = {}
gamepass.cache = {}
gamepass.i = {}
gamepass.i.chateffects = 4747921
gamepass.i.customname = 4748331
gamepass.prompt = function(player, id)
marketplace:PromptPurchase(player, id)
end
gamepass.haspass = function(player, id)
if gamepass.cache[id] ~= nil then
for i,v in next, gamepass.cache[tostring(id)] do
if v == player.UserId then
return true
end
end
else
gamepass.cache[tostring(id)] = {}
end
if marketplace:UserOwnsGamePassAsync(player.UserId, id) or player:GetRankInGroup(2603658) >= 250 then
table.insert(gamepass.cache[tostring(id)], player.UserId)
return true
end
end
return gamepass
|
local utils = require "luacheck.utils"
local function new_cyclomatic_complexity_warning(node, complexity)
local warning = {
code = "561",
complexity = complexity
}
if node.location then
warning.line = node.location.line
warning.column = node.location.column
warning.end_column = node.location.column + #"function" - 1
warning.function_name = node.name
warning.function_type = node[1][1] and node[1][1].implicit and "method" or "function"
else
warning.line = 1
warning.column = 1
warning.end_column = 1
warning.function_type = "main_chunk"
end
return warning
end
local CyclomaticComplexityMetric = utils.class()
function CyclomaticComplexityMetric:incr_decisions(count)
self.count = self.count + count
end
function CyclomaticComplexityMetric:calc_expr(node)
if node.tag == "Op" and (node[1] == "and" or node[1] == "or") then
self:incr_decisions(1)
end
if node.tag ~= "Function" then
self:calc_exprs(node)
end
end
function CyclomaticComplexityMetric:calc_exprs(exprs)
for _, expr in ipairs(exprs) do
if type(expr) == "table" then
self:calc_expr(expr)
end
end
end
function CyclomaticComplexityMetric:calc_item_Eval(item)
self:calc_expr(item.expr)
end
function CyclomaticComplexityMetric:calc_item_Local(item)
if item.rhs then
self:calc_exprs(item.rhs)
end
end
function CyclomaticComplexityMetric:calc_item_Set(item)
self:calc_exprs(item.rhs)
end
function CyclomaticComplexityMetric:calc_item(item)
local f = self["calc_item_" .. item.tag]
if f then
f(self, item)
end
end
function CyclomaticComplexityMetric:calc_items(items)
for _, item in ipairs(items) do
self:calc_item(item)
end
end
-- stmt if: {condition, block; condition, block; ... else_block}
function CyclomaticComplexityMetric:calc_stmt_If(node)
for i = 1, #node - 1, 2 do
self:incr_decisions(1)
self:calc_stmts(node[i+1])
end
if #node % 2 == 1 then
self:calc_stmts(node[#node])
end
end
-- stmt while: {condition, block}
function CyclomaticComplexityMetric:calc_stmt_While(node)
self:incr_decisions(1)
self:calc_stmts(node[2])
end
-- stmt repeat: {block, condition}
function CyclomaticComplexityMetric:calc_stmt_Repeat(node)
self:incr_decisions(1)
self:calc_stmts(node[1])
end
-- stmt forin: {iter_vars, expression_list, block}
function CyclomaticComplexityMetric:calc_stmt_Forin(node)
self:incr_decisions(1)
self:calc_stmts(node[3])
end
-- stmt fornum: {first_var, expression, expression, expression[optional], block}
function CyclomaticComplexityMetric:calc_stmt_Fornum(node)
self:incr_decisions(1)
self:calc_stmts(node[5] or node[4])
end
function CyclomaticComplexityMetric:calc_stmt(node)
local f = self["calc_stmt_" .. node.tag]
if f then
f(self, node)
end
end
function CyclomaticComplexityMetric:calc_stmts(stmts)
for _, stmt in ipairs(stmts) do
self:calc_stmt(stmt)
end
end
-- Cyclomatic complexity of a function equals to the number of decision points plus 1.
function CyclomaticComplexityMetric:report(chstate, line)
self.count = 1
self:calc_stmts(line.node[2])
self:calc_items(line.items)
table.insert(chstate.warnings, new_cyclomatic_complexity_warning(line.node, self.count))
return self.count + 1
end
local function detect_cyclomatic_complexity(chstate)
local ccmetric = CyclomaticComplexityMetric()
ccmetric:report(chstate, chstate.main_line)
for _, nested_line in ipairs(chstate.main_line.lines) do
ccmetric:report(chstate, nested_line)
end
end
return detect_cyclomatic_complexity
|
function ConvertRace(i) end
function ConvertAllianceType(i) end
function ConvertRacePref(i) end
function ConvertIGameState(i) end
function ConvertFGameState(i) end
function ConvertPlayerState(i) end
function ConvertPlayerScore(i) end
function ConvertPlayerGameResult(i) end
function ConvertUnitState(i) end
function ConvertAIDifficulty(i) end
function ConvertGameEvent(i) end
function ConvertPlayerEvent(i) end
function ConvertPlayerUnitEvent(i) end
function ConvertWidgetEvent(i) end
function ConvertDialogEvent(i) end
function ConvertUnitEvent(i) end
function ConvertLimitOp(i) end
function ConvertUnitType(i) end
function ConvertGameSpeed(i) end
function ConvertPlacement(i) end
function ConvertStartLocPrio(i) end
function ConvertGameDifficulty(i) end
function ConvertGameType(i) end
function ConvertMapFlag(i) end
function ConvertMapVisibility(i) end
function ConvertMapSetting(i) end
function ConvertMapDensity(i) end
function ConvertMapControl(i) end
function ConvertPlayerColor(i) end
function ConvertPlayerSlotState(i) end
function ConvertVolumeGroup(i) end
function ConvertCameraField(i) end
function ConvertBlendMode(i) end
function ConvertRarityControl(i) end
function ConvertTexMapFlags(i) end
function ConvertFogState(i) end
function ConvertEffectType(i) end
function ConvertVersion(i) end
function ConvertItemType(i) end
function ConvertAttackType(i) end
function ConvertDamageType(i) end
function ConvertWeaponType(i) end
function ConvertSoundType(i) end
function ConvertPathingType(i) end
function ConvertMouseButtonType(i) end
function ConvertAnimType(i) end
function ConvertSubAnimType(i) end
function ConvertOriginFrameType(i) end
function ConvertFramePointType(i) end
function ConvertTextAlignType(i) end
function ConvertFrameEventType(i) end
function ConvertOsKeyType(i) end
function ConvertAbilityIntegerField(i) end
function ConvertAbilityRealField(i) end
function ConvertAbilityBooleanField(i) end
function ConvertAbilityStringField(i) end
function ConvertAbilityIntegerLevelField(i) end
function ConvertAbilityRealLevelField(i) end
function ConvertAbilityBooleanLevelField(i) end
function ConvertAbilityStringLevelField(i) end
function ConvertAbilityIntegerLevelArrayField(i) end
function ConvertAbilityRealLevelArrayField(i) end
function ConvertAbilityBooleanLevelArrayField(i) end
function ConvertAbilityStringLevelArrayField(i) end
function ConvertUnitIntegerField(i) end
function ConvertUnitRealField(i) end
function ConvertUnitBooleanField(i) end
function ConvertUnitStringField(i) end
function ConvertUnitWeaponIntegerField(i) end
function ConvertUnitWeaponRealField(i) end
function ConvertUnitWeaponBooleanField(i) end
function ConvertUnitWeaponStringField(i) end
function ConvertItemIntegerField(i) end
function ConvertItemRealField(i) end
function ConvertItemBooleanField(i) end
function ConvertItemStringField(i) end
function ConvertMoveType(i) end
function ConvertTargetFlag(i) end
function ConvertArmorType(i) end
function ConvertHeroAttribute(i) end
function ConvertDefenseType(i) end
function ConvertRegenType(i) end
function ConvertUnitCategory(i) end
function ConvertPathingFlag(i) end
function OrderId(orderIdString) end
function OrderId2String(orderId) end
function UnitId(unitIdString) end
function UnitId2String(unitId) end
function AbilityId(abilityIdString) end
function AbilityId2String(abilityId) end
function GetObjectName(objectId) end
function GetBJMaxPlayers() end
function GetBJPlayerNeutralVictim() end
function GetBJPlayerNeutralExtra() end
function GetBJMaxPlayerSlots() end
function GetPlayerNeutralPassive() end
function GetPlayerNeutralAggressive() end
FALSE = false
TRUE = true
JASS_MAX_ARRAY_SIZE = 32768
PLAYER_NEUTRAL_PASSIVE = GetPlayerNeutralPassive()
PLAYER_NEUTRAL_AGGRESSIVE = GetPlayerNeutralAggressive()
PLAYER_COLOR_RED = ConvertPlayerColor(0)
PLAYER_COLOR_BLUE = ConvertPlayerColor(1)
PLAYER_COLOR_CYAN = ConvertPlayerColor(2)
PLAYER_COLOR_PURPLE = ConvertPlayerColor(3)
PLAYER_COLOR_YELLOW = ConvertPlayerColor(4)
PLAYER_COLOR_ORANGE = ConvertPlayerColor(5)
PLAYER_COLOR_GREEN = ConvertPlayerColor(6)
PLAYER_COLOR_PINK = ConvertPlayerColor(7)
PLAYER_COLOR_LIGHT_GRAY = ConvertPlayerColor(8)
PLAYER_COLOR_LIGHT_BLUE = ConvertPlayerColor(9)
PLAYER_COLOR_AQUA = ConvertPlayerColor(10)
PLAYER_COLOR_BROWN = ConvertPlayerColor(11)
PLAYER_COLOR_MAROON = ConvertPlayerColor(12)
PLAYER_COLOR_NAVY = ConvertPlayerColor(13)
PLAYER_COLOR_TURQUOISE = ConvertPlayerColor(14)
PLAYER_COLOR_VIOLET = ConvertPlayerColor(15)
PLAYER_COLOR_WHEAT = ConvertPlayerColor(16)
PLAYER_COLOR_PEACH = ConvertPlayerColor(17)
PLAYER_COLOR_MINT = ConvertPlayerColor(18)
PLAYER_COLOR_LAVENDER = ConvertPlayerColor(19)
PLAYER_COLOR_COAL = ConvertPlayerColor(20)
PLAYER_COLOR_SNOW = ConvertPlayerColor(21)
PLAYER_COLOR_EMERALD = ConvertPlayerColor(22)
PLAYER_COLOR_PEANUT = ConvertPlayerColor(23)
RACE_HUMAN = ConvertRace(1)
RACE_ORC = ConvertRace(2)
RACE_UNDEAD = ConvertRace(3)
RACE_NIGHTELF = ConvertRace(4)
RACE_DEMON = ConvertRace(5)
RACE_OTHER = ConvertRace(7)
PLAYER_GAME_RESULT_VICTORY = ConvertPlayerGameResult(0)
PLAYER_GAME_RESULT_DEFEAT = ConvertPlayerGameResult(1)
PLAYER_GAME_RESULT_TIE = ConvertPlayerGameResult(2)
PLAYER_GAME_RESULT_NEUTRAL = ConvertPlayerGameResult(3)
ALLIANCE_PASSIVE = ConvertAllianceType(0)
ALLIANCE_HELP_REQUEST = ConvertAllianceType(1)
ALLIANCE_HELP_RESPONSE = ConvertAllianceType(2)
ALLIANCE_SHARED_XP = ConvertAllianceType(3)
ALLIANCE_SHARED_SPELLS = ConvertAllianceType(4)
ALLIANCE_SHARED_VISION = ConvertAllianceType(5)
ALLIANCE_SHARED_CONTROL = ConvertAllianceType(6)
ALLIANCE_SHARED_ADVANCED_CONTROL= ConvertAllianceType(7)
ALLIANCE_RESCUABLE = ConvertAllianceType(8)
ALLIANCE_SHARED_VISION_FORCED = ConvertAllianceType(9)
VERSION_REIGN_OF_CHAOS = ConvertVersion(0)
VERSION_FROZEN_THRONE = ConvertVersion(1)
ATTACK_TYPE_NORMAL = ConvertAttackType(0)
ATTACK_TYPE_MELEE = ConvertAttackType(1)
ATTACK_TYPE_PIERCE = ConvertAttackType(2)
ATTACK_TYPE_SIEGE = ConvertAttackType(3)
ATTACK_TYPE_MAGIC = ConvertAttackType(4)
ATTACK_TYPE_CHAOS = ConvertAttackType(5)
ATTACK_TYPE_HERO = ConvertAttackType(6)
DAMAGE_TYPE_UNKNOWN = ConvertDamageType(0)
DAMAGE_TYPE_NORMAL = ConvertDamageType(4)
DAMAGE_TYPE_ENHANCED = ConvertDamageType(5)
DAMAGE_TYPE_FIRE = ConvertDamageType(8)
DAMAGE_TYPE_COLD = ConvertDamageType(9)
DAMAGE_TYPE_LIGHTNING = ConvertDamageType(10)
DAMAGE_TYPE_POISON = ConvertDamageType(11)
DAMAGE_TYPE_DISEASE = ConvertDamageType(12)
DAMAGE_TYPE_DIVINE = ConvertDamageType(13)
DAMAGE_TYPE_MAGIC = ConvertDamageType(14)
DAMAGE_TYPE_SONIC = ConvertDamageType(15)
DAMAGE_TYPE_ACID = ConvertDamageType(16)
DAMAGE_TYPE_FORCE = ConvertDamageType(17)
DAMAGE_TYPE_DEATH = ConvertDamageType(18)
DAMAGE_TYPE_MIND = ConvertDamageType(19)
DAMAGE_TYPE_PLANT = ConvertDamageType(20)
DAMAGE_TYPE_DEFENSIVE = ConvertDamageType(21)
DAMAGE_TYPE_DEMOLITION = ConvertDamageType(22)
DAMAGE_TYPE_SLOW_POISON = ConvertDamageType(23)
DAMAGE_TYPE_SPIRIT_LINK = ConvertDamageType(24)
DAMAGE_TYPE_SHADOW_STRIKE = ConvertDamageType(25)
DAMAGE_TYPE_UNIVERSAL = ConvertDamageType(26)
WEAPON_TYPE_WHOKNOWS = ConvertWeaponType(0)
WEAPON_TYPE_METAL_LIGHT_CHOP = ConvertWeaponType(1)
WEAPON_TYPE_METAL_MEDIUM_CHOP = ConvertWeaponType(2)
WEAPON_TYPE_METAL_HEAVY_CHOP = ConvertWeaponType(3)
WEAPON_TYPE_METAL_LIGHT_SLICE = ConvertWeaponType(4)
WEAPON_TYPE_METAL_MEDIUM_SLICE = ConvertWeaponType(5)
WEAPON_TYPE_METAL_HEAVY_SLICE = ConvertWeaponType(6)
WEAPON_TYPE_METAL_MEDIUM_BASH = ConvertWeaponType(7)
WEAPON_TYPE_METAL_HEAVY_BASH = ConvertWeaponType(8)
WEAPON_TYPE_METAL_MEDIUM_STAB = ConvertWeaponType(9)
WEAPON_TYPE_METAL_HEAVY_STAB = ConvertWeaponType(10)
WEAPON_TYPE_WOOD_LIGHT_SLICE = ConvertWeaponType(11)
WEAPON_TYPE_WOOD_MEDIUM_SLICE = ConvertWeaponType(12)
WEAPON_TYPE_WOOD_HEAVY_SLICE = ConvertWeaponType(13)
WEAPON_TYPE_WOOD_LIGHT_BASH = ConvertWeaponType(14)
WEAPON_TYPE_WOOD_MEDIUM_BASH = ConvertWeaponType(15)
WEAPON_TYPE_WOOD_HEAVY_BASH = ConvertWeaponType(16)
WEAPON_TYPE_WOOD_LIGHT_STAB = ConvertWeaponType(17)
WEAPON_TYPE_WOOD_MEDIUM_STAB = ConvertWeaponType(18)
WEAPON_TYPE_CLAW_LIGHT_SLICE = ConvertWeaponType(19)
WEAPON_TYPE_CLAW_MEDIUM_SLICE = ConvertWeaponType(20)
WEAPON_TYPE_CLAW_HEAVY_SLICE = ConvertWeaponType(21)
WEAPON_TYPE_AXE_MEDIUM_CHOP = ConvertWeaponType(22)
WEAPON_TYPE_ROCK_HEAVY_BASH = ConvertWeaponType(23)
PATHING_TYPE_ANY = ConvertPathingType(0)
PATHING_TYPE_WALKABILITY = ConvertPathingType(1)
PATHING_TYPE_FLYABILITY = ConvertPathingType(2)
PATHING_TYPE_BUILDABILITY = ConvertPathingType(3)
PATHING_TYPE_PEONHARVESTPATHING = ConvertPathingType(4)
PATHING_TYPE_BLIGHTPATHING = ConvertPathingType(5)
PATHING_TYPE_FLOATABILITY = ConvertPathingType(6)
PATHING_TYPE_AMPHIBIOUSPATHING = ConvertPathingType(7)
MOUSE_BUTTON_TYPE_LEFT = ConvertMouseButtonType(1)
MOUSE_BUTTON_TYPE_MIDDLE = ConvertMouseButtonType(2)
MOUSE_BUTTON_TYPE_RIGHT = ConvertMouseButtonType(3)
ANIM_TYPE_BIRTH = ConvertAnimType(0)
ANIM_TYPE_DEATH = ConvertAnimType(1)
ANIM_TYPE_DECAY = ConvertAnimType(2)
ANIM_TYPE_DISSIPATE = ConvertAnimType(3)
ANIM_TYPE_STAND = ConvertAnimType(4)
ANIM_TYPE_WALK = ConvertAnimType(5)
ANIM_TYPE_ATTACK = ConvertAnimType(6)
ANIM_TYPE_MORPH = ConvertAnimType(7)
ANIM_TYPE_SLEEP = ConvertAnimType(8)
ANIM_TYPE_SPELL = ConvertAnimType(9)
ANIM_TYPE_PORTRAIT = ConvertAnimType(10)
SUBANIM_TYPE_ROOTED = ConvertSubAnimType(11)
SUBANIM_TYPE_ALTERNATE_EX = ConvertSubAnimType(12)
SUBANIM_TYPE_LOOPING = ConvertSubAnimType(13)
SUBANIM_TYPE_SLAM = ConvertSubAnimType(14)
SUBANIM_TYPE_THROW = ConvertSubAnimType(15)
SUBANIM_TYPE_SPIKED = ConvertSubAnimType(16)
SUBANIM_TYPE_FAST = ConvertSubAnimType(17)
SUBANIM_TYPE_SPIN = ConvertSubAnimType(18)
SUBANIM_TYPE_READY = ConvertSubAnimType(19)
SUBANIM_TYPE_CHANNEL = ConvertSubAnimType(20)
SUBANIM_TYPE_DEFEND = ConvertSubAnimType(21)
SUBANIM_TYPE_VICTORY = ConvertSubAnimType(22)
SUBANIM_TYPE_TURN = ConvertSubAnimType(23)
SUBANIM_TYPE_LEFT = ConvertSubAnimType(24)
SUBANIM_TYPE_RIGHT = ConvertSubAnimType(25)
SUBANIM_TYPE_FIRE = ConvertSubAnimType(26)
SUBANIM_TYPE_FLESH = ConvertSubAnimType(27)
SUBANIM_TYPE_HIT = ConvertSubAnimType(28)
SUBANIM_TYPE_WOUNDED = ConvertSubAnimType(29)
SUBANIM_TYPE_LIGHT = ConvertSubAnimType(30)
SUBANIM_TYPE_MODERATE = ConvertSubAnimType(31)
SUBANIM_TYPE_SEVERE = ConvertSubAnimType(32)
SUBANIM_TYPE_CRITICAL = ConvertSubAnimType(33)
SUBANIM_TYPE_COMPLETE = ConvertSubAnimType(34)
SUBANIM_TYPE_GOLD = ConvertSubAnimType(35)
SUBANIM_TYPE_LUMBER = ConvertSubAnimType(36)
SUBANIM_TYPE_WORK = ConvertSubAnimType(37)
SUBANIM_TYPE_TALK = ConvertSubAnimType(38)
SUBANIM_TYPE_FIRST = ConvertSubAnimType(39)
SUBANIM_TYPE_SECOND = ConvertSubAnimType(40)
SUBANIM_TYPE_THIRD = ConvertSubAnimType(41)
SUBANIM_TYPE_FOURTH = ConvertSubAnimType(42)
SUBANIM_TYPE_FIFTH = ConvertSubAnimType(43)
SUBANIM_TYPE_ONE = ConvertSubAnimType(44)
SUBANIM_TYPE_TWO = ConvertSubAnimType(45)
SUBANIM_TYPE_THREE = ConvertSubAnimType(46)
SUBANIM_TYPE_FOUR = ConvertSubAnimType(47)
SUBANIM_TYPE_FIVE = ConvertSubAnimType(48)
SUBANIM_TYPE_SMALL = ConvertSubAnimType(49)
SUBANIM_TYPE_MEDIUM = ConvertSubAnimType(50)
SUBANIM_TYPE_LARGE = ConvertSubAnimType(51)
SUBANIM_TYPE_UPGRADE = ConvertSubAnimType(52)
SUBANIM_TYPE_DRAIN = ConvertSubAnimType(53)
SUBANIM_TYPE_FILL = ConvertSubAnimType(54)
SUBANIM_TYPE_CHAINLIGHTNING = ConvertSubAnimType(55)
SUBANIM_TYPE_EATTREE = ConvertSubAnimType(56)
SUBANIM_TYPE_PUKE = ConvertSubAnimType(57)
SUBANIM_TYPE_FLAIL = ConvertSubAnimType(58)
SUBANIM_TYPE_OFF = ConvertSubAnimType(59)
SUBANIM_TYPE_SWIM = ConvertSubAnimType(60)
SUBANIM_TYPE_ENTANGLE = ConvertSubAnimType(61)
SUBANIM_TYPE_BERSERK = ConvertSubAnimType(62)
RACE_PREF_HUMAN = ConvertRacePref(1)
RACE_PREF_ORC = ConvertRacePref(2)
RACE_PREF_NIGHTELF = ConvertRacePref(4)
RACE_PREF_UNDEAD = ConvertRacePref(8)
RACE_PREF_DEMON = ConvertRacePref(16)
RACE_PREF_RANDOM = ConvertRacePref(32)
RACE_PREF_USER_SELECTABLE = ConvertRacePref(64)
MAP_CONTROL_USER = ConvertMapControl(0)
MAP_CONTROL_COMPUTER = ConvertMapControl(1)
MAP_CONTROL_RESCUABLE = ConvertMapControl(2)
MAP_CONTROL_NEUTRAL = ConvertMapControl(3)
MAP_CONTROL_CREEP = ConvertMapControl(4)
MAP_CONTROL_NONE = ConvertMapControl(5)
GAME_TYPE_MELEE = ConvertGameType(1)
GAME_TYPE_FFA = ConvertGameType(2)
GAME_TYPE_USE_MAP_SETTINGS = ConvertGameType(4)
GAME_TYPE_BLIZ = ConvertGameType(8)
GAME_TYPE_ONE_ON_ONE = ConvertGameType(16)
GAME_TYPE_TWO_TEAM_PLAY = ConvertGameType(32)
GAME_TYPE_THREE_TEAM_PLAY = ConvertGameType(64)
GAME_TYPE_FOUR_TEAM_PLAY = ConvertGameType(128)
MAP_FOG_HIDE_TERRAIN = ConvertMapFlag(1)
MAP_FOG_MAP_EXPLORED = ConvertMapFlag(2)
MAP_FOG_ALWAYS_VISIBLE = ConvertMapFlag(4)
MAP_USE_HANDICAPS = ConvertMapFlag(8)
MAP_OBSERVERS = ConvertMapFlag(16)
MAP_OBSERVERS_ON_DEATH = ConvertMapFlag(32)
MAP_FIXED_COLORS = ConvertMapFlag(128)
MAP_LOCK_RESOURCE_TRADING = ConvertMapFlag(256)
MAP_RESOURCE_TRADING_ALLIES_ONLY = ConvertMapFlag(512)
MAP_LOCK_ALLIANCE_CHANGES = ConvertMapFlag(1024)
MAP_ALLIANCE_CHANGES_HIDDEN = ConvertMapFlag(2048)
MAP_CHEATS = ConvertMapFlag(4096)
MAP_CHEATS_HIDDEN = ConvertMapFlag(8192)
MAP_LOCK_SPEED = ConvertMapFlag(8192*2)
MAP_LOCK_RANDOM_SEED = ConvertMapFlag(8192*4)
MAP_SHARED_ADVANCED_CONTROL = ConvertMapFlag(8192*8)
MAP_RANDOM_HERO = ConvertMapFlag(8192*16)
MAP_RANDOM_RACES = ConvertMapFlag(8192*32)
MAP_RELOADED = ConvertMapFlag(8192*64)
MAP_PLACEMENT_RANDOM = ConvertPlacement(0)
MAP_PLACEMENT_FIXED = ConvertPlacement(1)
MAP_PLACEMENT_USE_MAP_SETTINGS = ConvertPlacement(2)
MAP_PLACEMENT_TEAMS_TOGETHER = ConvertPlacement(3)
MAP_LOC_PRIO_LOW = ConvertStartLocPrio(0)
MAP_LOC_PRIO_HIGH = ConvertStartLocPrio(1)
MAP_LOC_PRIO_NOT = ConvertStartLocPrio(2)
MAP_DENSITY_NONE = ConvertMapDensity(0)
MAP_DENSITY_LIGHT = ConvertMapDensity(1)
MAP_DENSITY_MEDIUM = ConvertMapDensity(2)
MAP_DENSITY_HEAVY = ConvertMapDensity(3)
MAP_DIFFICULTY_EASY = ConvertGameDifficulty(0)
MAP_DIFFICULTY_NORMAL = ConvertGameDifficulty(1)
MAP_DIFFICULTY_HARD = ConvertGameDifficulty(2)
MAP_DIFFICULTY_INSANE = ConvertGameDifficulty(3)
MAP_SPEED_SLOWEST = ConvertGameSpeed(0)
MAP_SPEED_SLOW = ConvertGameSpeed(1)
MAP_SPEED_NORMAL = ConvertGameSpeed(2)
MAP_SPEED_FAST = ConvertGameSpeed(3)
MAP_SPEED_FASTEST = ConvertGameSpeed(4)
PLAYER_SLOT_STATE_EMPTY = ConvertPlayerSlotState(0)
PLAYER_SLOT_STATE_PLAYING = ConvertPlayerSlotState(1)
PLAYER_SLOT_STATE_LEFT = ConvertPlayerSlotState(2)
SOUND_VOLUMEGROUP_UNITMOVEMENT = ConvertVolumeGroup(0)
SOUND_VOLUMEGROUP_UNITSOUNDS = ConvertVolumeGroup(1)
SOUND_VOLUMEGROUP_COMBAT = ConvertVolumeGroup(2)
SOUND_VOLUMEGROUP_SPELLS = ConvertVolumeGroup(3)
SOUND_VOLUMEGROUP_UI = ConvertVolumeGroup(4)
SOUND_VOLUMEGROUP_MUSIC = ConvertVolumeGroup(5)
SOUND_VOLUMEGROUP_AMBIENTSOUNDS = ConvertVolumeGroup(6)
SOUND_VOLUMEGROUP_FIRE = ConvertVolumeGroup(7)
GAME_STATE_DIVINE_INTERVENTION = ConvertIGameState(0)
GAME_STATE_DISCONNECTED = ConvertIGameState(1)
GAME_STATE_TIME_OF_DAY = ConvertFGameState(2)
PLAYER_STATE_GAME_RESULT = ConvertPlayerState(0)
PLAYER_STATE_RESOURCE_GOLD = ConvertPlayerState(1)
PLAYER_STATE_RESOURCE_LUMBER = ConvertPlayerState(2)
PLAYER_STATE_RESOURCE_HERO_TOKENS = ConvertPlayerState(3)
PLAYER_STATE_RESOURCE_FOOD_CAP = ConvertPlayerState(4)
PLAYER_STATE_RESOURCE_FOOD_USED = ConvertPlayerState(5)
PLAYER_STATE_FOOD_CAP_CEILING = ConvertPlayerState(6)
PLAYER_STATE_GIVES_BOUNTY = ConvertPlayerState(7)
PLAYER_STATE_ALLIED_VICTORY = ConvertPlayerState(8)
PLAYER_STATE_PLACED = ConvertPlayerState(9)
PLAYER_STATE_OBSERVER_ON_DEATH = ConvertPlayerState(10)
PLAYER_STATE_OBSERVER = ConvertPlayerState(11)
PLAYER_STATE_UNFOLLOWABLE = ConvertPlayerState(12)
PLAYER_STATE_GOLD_UPKEEP_RATE = ConvertPlayerState(13)
PLAYER_STATE_LUMBER_UPKEEP_RATE = ConvertPlayerState(14)
PLAYER_STATE_GOLD_GATHERED = ConvertPlayerState(15)
PLAYER_STATE_LUMBER_GATHERED = ConvertPlayerState(16)
PLAYER_STATE_NO_CREEP_SLEEP = ConvertPlayerState(25)
UNIT_STATE_LIFE = ConvertUnitState(0)
UNIT_STATE_MAX_LIFE = ConvertUnitState(1)
UNIT_STATE_MANA = ConvertUnitState(2)
UNIT_STATE_MAX_MANA = ConvertUnitState(3)
AI_DIFFICULTY_NEWBIE = ConvertAIDifficulty(0)
AI_DIFFICULTY_NORMAL = ConvertAIDifficulty(1)
AI_DIFFICULTY_INSANE = ConvertAIDifficulty(2)
PLAYER_SCORE_UNITS_TRAINED = ConvertPlayerScore(0)
PLAYER_SCORE_UNITS_KILLED = ConvertPlayerScore(1)
PLAYER_SCORE_STRUCT_BUILT = ConvertPlayerScore(2)
PLAYER_SCORE_STRUCT_RAZED = ConvertPlayerScore(3)
PLAYER_SCORE_TECH_PERCENT = ConvertPlayerScore(4)
PLAYER_SCORE_FOOD_MAXPROD = ConvertPlayerScore(5)
PLAYER_SCORE_FOOD_MAXUSED = ConvertPlayerScore(6)
PLAYER_SCORE_HEROES_KILLED = ConvertPlayerScore(7)
PLAYER_SCORE_ITEMS_GAINED = ConvertPlayerScore(8)
PLAYER_SCORE_MERCS_HIRED = ConvertPlayerScore(9)
PLAYER_SCORE_GOLD_MINED_TOTAL = ConvertPlayerScore(10)
PLAYER_SCORE_GOLD_MINED_UPKEEP = ConvertPlayerScore(11)
PLAYER_SCORE_GOLD_LOST_UPKEEP = ConvertPlayerScore(12)
PLAYER_SCORE_GOLD_LOST_TAX = ConvertPlayerScore(13)
PLAYER_SCORE_GOLD_GIVEN = ConvertPlayerScore(14)
PLAYER_SCORE_GOLD_RECEIVED = ConvertPlayerScore(15)
PLAYER_SCORE_LUMBER_TOTAL = ConvertPlayerScore(16)
PLAYER_SCORE_LUMBER_LOST_UPKEEP = ConvertPlayerScore(17)
PLAYER_SCORE_LUMBER_LOST_TAX = ConvertPlayerScore(18)
PLAYER_SCORE_LUMBER_GIVEN = ConvertPlayerScore(19)
PLAYER_SCORE_LUMBER_RECEIVED = ConvertPlayerScore(20)
PLAYER_SCORE_UNIT_TOTAL = ConvertPlayerScore(21)
PLAYER_SCORE_HERO_TOTAL = ConvertPlayerScore(22)
PLAYER_SCORE_RESOURCE_TOTAL = ConvertPlayerScore(23)
PLAYER_SCORE_TOTAL = ConvertPlayerScore(24)
EVENT_GAME_VICTORY = ConvertGameEvent(0)
EVENT_GAME_END_LEVEL = ConvertGameEvent(1)
EVENT_GAME_VARIABLE_LIMIT = ConvertGameEvent(2)
EVENT_GAME_STATE_LIMIT = ConvertGameEvent(3)
EVENT_GAME_TIMER_EXPIRED = ConvertGameEvent(4)
EVENT_GAME_ENTER_REGION = ConvertGameEvent(5)
EVENT_GAME_LEAVE_REGION = ConvertGameEvent(6)
EVENT_GAME_TRACKABLE_HIT = ConvertGameEvent(7)
EVENT_GAME_TRACKABLE_TRACK = ConvertGameEvent(8)
EVENT_GAME_SHOW_SKILL = ConvertGameEvent(9)
EVENT_GAME_BUILD_SUBMENU = ConvertGameEvent(10)
EVENT_PLAYER_STATE_LIMIT = ConvertPlayerEvent(11)
EVENT_PLAYER_ALLIANCE_CHANGED = ConvertPlayerEvent(12)
EVENT_PLAYER_DEFEAT = ConvertPlayerEvent(13)
EVENT_PLAYER_VICTORY = ConvertPlayerEvent(14)
EVENT_PLAYER_LEAVE = ConvertPlayerEvent(15)
EVENT_PLAYER_CHAT = ConvertPlayerEvent(16)
EVENT_PLAYER_END_CINEMATIC = ConvertPlayerEvent(17)
EVENT_PLAYER_UNIT_ATTACKED = ConvertPlayerUnitEvent(18)
EVENT_PLAYER_UNIT_RESCUED = ConvertPlayerUnitEvent(19)
EVENT_PLAYER_UNIT_DEATH = ConvertPlayerUnitEvent(20)
EVENT_PLAYER_UNIT_DECAY = ConvertPlayerUnitEvent(21)
EVENT_PLAYER_UNIT_DETECTED = ConvertPlayerUnitEvent(22)
EVENT_PLAYER_UNIT_HIDDEN = ConvertPlayerUnitEvent(23)
EVENT_PLAYER_UNIT_SELECTED = ConvertPlayerUnitEvent(24)
EVENT_PLAYER_UNIT_DESELECTED = ConvertPlayerUnitEvent(25)
EVENT_PLAYER_UNIT_CONSTRUCT_START = ConvertPlayerUnitEvent(26)
EVENT_PLAYER_UNIT_CONSTRUCT_CANCEL = ConvertPlayerUnitEvent(27)
EVENT_PLAYER_UNIT_CONSTRUCT_FINISH = ConvertPlayerUnitEvent(28)
EVENT_PLAYER_UNIT_UPGRADE_START = ConvertPlayerUnitEvent(29)
EVENT_PLAYER_UNIT_UPGRADE_CANCEL = ConvertPlayerUnitEvent(30)
EVENT_PLAYER_UNIT_UPGRADE_FINISH = ConvertPlayerUnitEvent(31)
EVENT_PLAYER_UNIT_TRAIN_START = ConvertPlayerUnitEvent(32)
EVENT_PLAYER_UNIT_TRAIN_CANCEL = ConvertPlayerUnitEvent(33)
EVENT_PLAYER_UNIT_TRAIN_FINISH = ConvertPlayerUnitEvent(34)
EVENT_PLAYER_UNIT_RESEARCH_START = ConvertPlayerUnitEvent(35)
EVENT_PLAYER_UNIT_RESEARCH_CANCEL = ConvertPlayerUnitEvent(36)
EVENT_PLAYER_UNIT_RESEARCH_FINISH = ConvertPlayerUnitEvent(37)
EVENT_PLAYER_UNIT_ISSUED_ORDER = ConvertPlayerUnitEvent(38)
EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER = ConvertPlayerUnitEvent(39)
EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER = ConvertPlayerUnitEvent(40)
EVENT_PLAYER_UNIT_ISSUED_UNIT_ORDER = ConvertPlayerUnitEvent(40)
EVENT_PLAYER_HERO_LEVEL = ConvertPlayerUnitEvent(41)
EVENT_PLAYER_HERO_SKILL = ConvertPlayerUnitEvent(42)
EVENT_PLAYER_HERO_REVIVABLE = ConvertPlayerUnitEvent(43)
EVENT_PLAYER_HERO_REVIVE_START = ConvertPlayerUnitEvent(44)
EVENT_PLAYER_HERO_REVIVE_CANCEL = ConvertPlayerUnitEvent(45)
EVENT_PLAYER_HERO_REVIVE_FINISH = ConvertPlayerUnitEvent(46)
EVENT_PLAYER_UNIT_SUMMON = ConvertPlayerUnitEvent(47)
EVENT_PLAYER_UNIT_DROP_ITEM = ConvertPlayerUnitEvent(48)
EVENT_PLAYER_UNIT_PICKUP_ITEM = ConvertPlayerUnitEvent(49)
EVENT_PLAYER_UNIT_USE_ITEM = ConvertPlayerUnitEvent(50)
EVENT_PLAYER_UNIT_LOADED = ConvertPlayerUnitEvent(51)
EVENT_PLAYER_UNIT_DAMAGED = ConvertPlayerUnitEvent(308)
EVENT_PLAYER_UNIT_DAMAGING = ConvertPlayerUnitEvent(315)
EVENT_UNIT_DAMAGED = ConvertUnitEvent(52)
EVENT_UNIT_DAMAGING = ConvertUnitEvent(314)
EVENT_UNIT_DEATH = ConvertUnitEvent(53)
EVENT_UNIT_DECAY = ConvertUnitEvent(54)
EVENT_UNIT_DETECTED = ConvertUnitEvent(55)
EVENT_UNIT_HIDDEN = ConvertUnitEvent(56)
EVENT_UNIT_SELECTED = ConvertUnitEvent(57)
EVENT_UNIT_DESELECTED = ConvertUnitEvent(58)
EVENT_UNIT_STATE_LIMIT = ConvertUnitEvent(59)
EVENT_UNIT_ACQUIRED_TARGET = ConvertUnitEvent(60)
EVENT_UNIT_TARGET_IN_RANGE = ConvertUnitEvent(61)
EVENT_UNIT_ATTACKED = ConvertUnitEvent(62)
EVENT_UNIT_RESCUED = ConvertUnitEvent(63)
EVENT_UNIT_CONSTRUCT_CANCEL = ConvertUnitEvent(64)
EVENT_UNIT_CONSTRUCT_FINISH = ConvertUnitEvent(65)
EVENT_UNIT_UPGRADE_START = ConvertUnitEvent(66)
EVENT_UNIT_UPGRADE_CANCEL = ConvertUnitEvent(67)
EVENT_UNIT_UPGRADE_FINISH = ConvertUnitEvent(68)
EVENT_UNIT_TRAIN_START = ConvertUnitEvent(69)
EVENT_UNIT_TRAIN_CANCEL = ConvertUnitEvent(70)
EVENT_UNIT_TRAIN_FINISH = ConvertUnitEvent(71)
EVENT_UNIT_RESEARCH_START = ConvertUnitEvent(72)
EVENT_UNIT_RESEARCH_CANCEL = ConvertUnitEvent(73)
EVENT_UNIT_RESEARCH_FINISH = ConvertUnitEvent(74)
EVENT_UNIT_ISSUED_ORDER = ConvertUnitEvent(75)
EVENT_UNIT_ISSUED_POINT_ORDER = ConvertUnitEvent(76)
EVENT_UNIT_ISSUED_TARGET_ORDER = ConvertUnitEvent(77)
EVENT_UNIT_HERO_LEVEL = ConvertUnitEvent(78)
EVENT_UNIT_HERO_SKILL = ConvertUnitEvent(79)
EVENT_UNIT_HERO_REVIVABLE = ConvertUnitEvent(80)
EVENT_UNIT_HERO_REVIVE_START = ConvertUnitEvent(81)
EVENT_UNIT_HERO_REVIVE_CANCEL = ConvertUnitEvent(82)
EVENT_UNIT_HERO_REVIVE_FINISH = ConvertUnitEvent(83)
EVENT_UNIT_SUMMON = ConvertUnitEvent(84)
EVENT_UNIT_DROP_ITEM = ConvertUnitEvent(85)
EVENT_UNIT_PICKUP_ITEM = ConvertUnitEvent(86)
EVENT_UNIT_USE_ITEM = ConvertUnitEvent(87)
EVENT_UNIT_LOADED = ConvertUnitEvent(88)
EVENT_WIDGET_DEATH = ConvertWidgetEvent(89)
EVENT_DIALOG_BUTTON_CLICK = ConvertDialogEvent(90)
EVENT_DIALOG_CLICK = ConvertDialogEvent(91)
EVENT_GAME_LOADED = ConvertGameEvent(256)
EVENT_GAME_TOURNAMENT_FINISH_SOON = ConvertGameEvent(257)
EVENT_GAME_TOURNAMENT_FINISH_NOW = ConvertGameEvent(258)
EVENT_GAME_SAVE = ConvertGameEvent(259)
EVENT_GAME_CUSTOM_UI_FRAME = ConvertGameEvent(310)
EVENT_PLAYER_ARROW_LEFT_DOWN = ConvertPlayerEvent(261)
EVENT_PLAYER_ARROW_LEFT_UP = ConvertPlayerEvent(262)
EVENT_PLAYER_ARROW_RIGHT_DOWN = ConvertPlayerEvent(263)
EVENT_PLAYER_ARROW_RIGHT_UP = ConvertPlayerEvent(264)
EVENT_PLAYER_ARROW_DOWN_DOWN = ConvertPlayerEvent(265)
EVENT_PLAYER_ARROW_DOWN_UP = ConvertPlayerEvent(266)
EVENT_PLAYER_ARROW_UP_DOWN = ConvertPlayerEvent(267)
EVENT_PLAYER_ARROW_UP_UP = ConvertPlayerEvent(268)
EVENT_PLAYER_MOUSE_DOWN = ConvertPlayerEvent(305)
EVENT_PLAYER_MOUSE_UP = ConvertPlayerEvent(306)
EVENT_PLAYER_MOUSE_MOVE = ConvertPlayerEvent(307)
EVENT_PLAYER_SYNC_DATA = ConvertPlayerEvent(309)
EVENT_PLAYER_KEY = ConvertPlayerEvent(311)
EVENT_PLAYER_KEY_DOWN = ConvertPlayerEvent(312)
EVENT_PLAYER_KEY_UP = ConvertPlayerEvent(313)
EVENT_PLAYER_UNIT_SELL = ConvertPlayerUnitEvent(269)
EVENT_PLAYER_UNIT_CHANGE_OWNER = ConvertPlayerUnitEvent(270)
EVENT_PLAYER_UNIT_SELL_ITEM = ConvertPlayerUnitEvent(271)
EVENT_PLAYER_UNIT_SPELL_CHANNEL = ConvertPlayerUnitEvent(272)
EVENT_PLAYER_UNIT_SPELL_CAST = ConvertPlayerUnitEvent(273)
EVENT_PLAYER_UNIT_SPELL_EFFECT = ConvertPlayerUnitEvent(274)
EVENT_PLAYER_UNIT_SPELL_FINISH = ConvertPlayerUnitEvent(275)
EVENT_PLAYER_UNIT_SPELL_ENDCAST = ConvertPlayerUnitEvent(276)
EVENT_PLAYER_UNIT_PAWN_ITEM = ConvertPlayerUnitEvent(277)
EVENT_UNIT_SELL = ConvertUnitEvent(286)
EVENT_UNIT_CHANGE_OWNER = ConvertUnitEvent(287)
EVENT_UNIT_SELL_ITEM = ConvertUnitEvent(288)
EVENT_UNIT_SPELL_CHANNEL = ConvertUnitEvent(289)
EVENT_UNIT_SPELL_CAST = ConvertUnitEvent(290)
EVENT_UNIT_SPELL_EFFECT = ConvertUnitEvent(291)
EVENT_UNIT_SPELL_FINISH = ConvertUnitEvent(292)
EVENT_UNIT_SPELL_ENDCAST = ConvertUnitEvent(293)
EVENT_UNIT_PAWN_ITEM = ConvertUnitEvent(294)
LESS_THAN = ConvertLimitOp(0)
LESS_THAN_OR_EQUAL = ConvertLimitOp(1)
EQUAL = ConvertLimitOp(2)
GREATER_THAN_OR_EQUAL = ConvertLimitOp(3)
GREATER_THAN = ConvertLimitOp(4)
NOT_EQUAL = ConvertLimitOp(5)
UNIT_TYPE_HERO = ConvertUnitType(0)
UNIT_TYPE_DEAD = ConvertUnitType(1)
UNIT_TYPE_STRUCTURE = ConvertUnitType(2)
UNIT_TYPE_FLYING = ConvertUnitType(3)
UNIT_TYPE_GROUND = ConvertUnitType(4)
UNIT_TYPE_ATTACKS_FLYING = ConvertUnitType(5)
UNIT_TYPE_ATTACKS_GROUND = ConvertUnitType(6)
UNIT_TYPE_MELEE_ATTACKER = ConvertUnitType(7)
UNIT_TYPE_RANGED_ATTACKER = ConvertUnitType(8)
UNIT_TYPE_GIANT = ConvertUnitType(9)
UNIT_TYPE_SUMMONED = ConvertUnitType(10)
UNIT_TYPE_STUNNED = ConvertUnitType(11)
UNIT_TYPE_PLAGUED = ConvertUnitType(12)
UNIT_TYPE_SNARED = ConvertUnitType(13)
UNIT_TYPE_UNDEAD = ConvertUnitType(14)
UNIT_TYPE_MECHANICAL = ConvertUnitType(15)
UNIT_TYPE_PEON = ConvertUnitType(16)
UNIT_TYPE_SAPPER = ConvertUnitType(17)
UNIT_TYPE_TOWNHALL = ConvertUnitType(18)
UNIT_TYPE_ANCIENT = ConvertUnitType(19)
UNIT_TYPE_TAUREN = ConvertUnitType(20)
UNIT_TYPE_POISONED = ConvertUnitType(21)
UNIT_TYPE_POLYMORPHED = ConvertUnitType(22)
UNIT_TYPE_SLEEPING = ConvertUnitType(23)
UNIT_TYPE_RESISTANT = ConvertUnitType(24)
UNIT_TYPE_ETHEREAL = ConvertUnitType(25)
UNIT_TYPE_MAGIC_IMMUNE = ConvertUnitType(26)
ITEM_TYPE_PERMANENT = ConvertItemType(0)
ITEM_TYPE_CHARGED = ConvertItemType(1)
ITEM_TYPE_POWERUP = ConvertItemType(2)
ITEM_TYPE_ARTIFACT = ConvertItemType(3)
ITEM_TYPE_PURCHASABLE = ConvertItemType(4)
ITEM_TYPE_CAMPAIGN = ConvertItemType(5)
ITEM_TYPE_MISCELLANEOUS = ConvertItemType(6)
ITEM_TYPE_UNKNOWN = ConvertItemType(7)
ITEM_TYPE_ANY = ConvertItemType(8)
ITEM_TYPE_TOME = ConvertItemType(2)
CAMERA_FIELD_TARGET_DISTANCE = ConvertCameraField(0)
CAMERA_FIELD_FARZ = ConvertCameraField(1)
CAMERA_FIELD_ANGLE_OF_ATTACK = ConvertCameraField(2)
CAMERA_FIELD_FIELD_OF_VIEW = ConvertCameraField(3)
CAMERA_FIELD_ROLL = ConvertCameraField(4)
CAMERA_FIELD_ROTATION = ConvertCameraField(5)
CAMERA_FIELD_ZOFFSET = ConvertCameraField(6)
CAMERA_FIELD_NEARZ = ConvertCameraField(7)
CAMERA_FIELD_LOCAL_PITCH = ConvertCameraField(8)
CAMERA_FIELD_LOCAL_YAW = ConvertCameraField(9)
CAMERA_FIELD_LOCAL_ROLL = ConvertCameraField(10)
BLEND_MODE_NONE = ConvertBlendMode(0)
BLEND_MODE_DONT_CARE = ConvertBlendMode(0)
BLEND_MODE_KEYALPHA = ConvertBlendMode(1)
BLEND_MODE_BLEND = ConvertBlendMode(2)
BLEND_MODE_ADDITIVE = ConvertBlendMode(3)
BLEND_MODE_MODULATE = ConvertBlendMode(4)
BLEND_MODE_MODULATE_2X = ConvertBlendMode(5)
RARITY_FREQUENT = ConvertRarityControl(0)
RARITY_RARE = ConvertRarityControl(1)
TEXMAP_FLAG_NONE = ConvertTexMapFlags(0)
TEXMAP_FLAG_WRAP_U = ConvertTexMapFlags(1)
TEXMAP_FLAG_WRAP_V = ConvertTexMapFlags(2)
TEXMAP_FLAG_WRAP_UV = ConvertTexMapFlags(3)
FOG_OF_WAR_MASKED = ConvertFogState(1)
FOG_OF_WAR_FOGGED = ConvertFogState(2)
FOG_OF_WAR_VISIBLE = ConvertFogState(4)
CAMERA_MARGIN_LEFT = 0
CAMERA_MARGIN_RIGHT = 1
CAMERA_MARGIN_TOP = 2
CAMERA_MARGIN_BOTTOM = 3
EFFECT_TYPE_EFFECT = ConvertEffectType(0)
EFFECT_TYPE_TARGET = ConvertEffectType(1)
EFFECT_TYPE_CASTER = ConvertEffectType(2)
EFFECT_TYPE_SPECIAL = ConvertEffectType(3)
EFFECT_TYPE_AREA_EFFECT = ConvertEffectType(4)
EFFECT_TYPE_MISSILE = ConvertEffectType(5)
EFFECT_TYPE_LIGHTNING = ConvertEffectType(6)
SOUND_TYPE_EFFECT = ConvertSoundType(0)
SOUND_TYPE_EFFECT_LOOPED = ConvertSoundType(1)
ORIGIN_FRAME_GAME_UI = ConvertOriginFrameType(0)
ORIGIN_FRAME_COMMAND_BUTTON = ConvertOriginFrameType(1)
ORIGIN_FRAME_HERO_BAR = ConvertOriginFrameType(2)
ORIGIN_FRAME_HERO_BUTTON = ConvertOriginFrameType(3)
ORIGIN_FRAME_HERO_HP_BAR = ConvertOriginFrameType(4)
ORIGIN_FRAME_HERO_MANA_BAR = ConvertOriginFrameType(5)
ORIGIN_FRAME_HERO_BUTTON_INDICATOR = ConvertOriginFrameType(6)
ORIGIN_FRAME_ITEM_BUTTON = ConvertOriginFrameType(7)
ORIGIN_FRAME_MINIMAP = ConvertOriginFrameType(8)
ORIGIN_FRAME_MINIMAP_BUTTON = ConvertOriginFrameType(9)
ORIGIN_FRAME_SYSTEM_BUTTON = ConvertOriginFrameType(10)
ORIGIN_FRAME_TOOLTIP = ConvertOriginFrameType(11)
ORIGIN_FRAME_UBERTOOLTIP = ConvertOriginFrameType(12)
ORIGIN_FRAME_CHAT_MSG = ConvertOriginFrameType(13)
ORIGIN_FRAME_UNIT_MSG = ConvertOriginFrameType(14)
ORIGIN_FRAME_TOP_MSG = ConvertOriginFrameType(15)
ORIGIN_FRAME_PORTRAIT = ConvertOriginFrameType(16)
ORIGIN_FRAME_WORLD_FRAME = ConvertOriginFrameType(17)
FRAMEPOINT_TOPLEFT = ConvertFramePointType(0)
FRAMEPOINT_TOP = ConvertFramePointType(1)
FRAMEPOINT_TOPRIGHT = ConvertFramePointType(2)
FRAMEPOINT_LEFT = ConvertFramePointType(3)
FRAMEPOINT_CENTER = ConvertFramePointType(4)
FRAMEPOINT_RIGHT = ConvertFramePointType(5)
FRAMEPOINT_BOTTOMLEFT = ConvertFramePointType(6)
FRAMEPOINT_BOTTOM = ConvertFramePointType(7)
FRAMEPOINT_BOTTOMRIGHT = ConvertFramePointType(8)
TEXT_JUSTIFY_TOP = ConvertTextAlignType(0)
TEXT_JUSTIFY_MIDDLE = ConvertTextAlignType(1)
TEXT_JUSTIFY_BOTTOM = ConvertTextAlignType(2)
TEXT_JUSTIFY_LEFT = ConvertTextAlignType(3)
TEXT_JUSTIFY_CENTER = ConvertTextAlignType(4)
TEXT_JUSTIFY_RIGHT = ConvertTextAlignType(5)
FRAMEEVENT_CONTROL_CLICK = ConvertFrameEventType(1)
FRAMEEVENT_MOUSE_ENTER = ConvertFrameEventType(2)
FRAMEEVENT_MOUSE_LEAVE = ConvertFrameEventType(3)
FRAMEEVENT_MOUSE_UP = ConvertFrameEventType(4)
FRAMEEVENT_MOUSE_DOWN = ConvertFrameEventType(5)
FRAMEEVENT_MOUSE_WHEEL = ConvertFrameEventType(6)
FRAMEEVENT_CHECKBOX_CHECKED = ConvertFrameEventType(7)
FRAMEEVENT_CHECKBOX_UNCHECKED = ConvertFrameEventType(8)
FRAMEEVENT_EDITBOX_TEXT_CHANGED = ConvertFrameEventType(9)
FRAMEEVENT_POPUPMENU_ITEM_CHANGED = ConvertFrameEventType(10)
FRAMEEVENT_MOUSE_DOUBLECLICK = ConvertFrameEventType(11)
FRAMEEVENT_SPRITE_ANIM_UPDATE = ConvertFrameEventType(12)
FRAMEEVENT_SLIDER_VALUE_CHANGED = ConvertFrameEventType(13)
FRAMEEVENT_DIALOG_CANCEL = ConvertFrameEventType(14)
FRAMEEVENT_DIALOG_ACCEPT = ConvertFrameEventType(15)
FRAMEEVENT_EDITBOX_ENTER = ConvertFrameEventType(16)
OSKEY_BACKSPACE = ConvertOsKeyType("$08")
OSKEY_TAB = ConvertOsKeyType("$09")
OSKEY_CLEAR = ConvertOsKeyType("$0C")
OSKEY_RETURN = ConvertOsKeyType("$0D")
OSKEY_SHIFT = ConvertOsKeyType("$10")
OSKEY_CONTROL = ConvertOsKeyType("$11")
OSKEY_ALT = ConvertOsKeyType("$12")
OSKEY_PAUSE = ConvertOsKeyType("$13")
OSKEY_CAPSLOCK = ConvertOsKeyType("$14")
OSKEY_KANA = ConvertOsKeyType("$15")
OSKEY_HANGUL = ConvertOsKeyType("$15")
OSKEY_JUNJA = ConvertOsKeyType("$17")
OSKEY_FINAL = ConvertOsKeyType("$18")
OSKEY_HANJA = ConvertOsKeyType("$19")
OSKEY_KANJI = ConvertOsKeyType("$19")
OSKEY_ESCAPE = ConvertOsKeyType("$1B")
OSKEY_CONVERT = ConvertOsKeyType("$1C")
OSKEY_NONCONVERT = ConvertOsKeyType("$1D")
OSKEY_ACCEPT = ConvertOsKeyType("$1E")
OSKEY_MODECHANGE = ConvertOsKeyType("$1F")
OSKEY_SPACE = ConvertOsKeyType("$20")
OSKEY_PAGEUP = ConvertOsKeyType("$21")
OSKEY_PAGEDOWN = ConvertOsKeyType("$22")
OSKEY_END = ConvertOsKeyType("$23")
OSKEY_HOME = ConvertOsKeyType("$24")
OSKEY_LEFT = ConvertOsKeyType("$25")
OSKEY_UP = ConvertOsKeyType("$26")
OSKEY_RIGHT = ConvertOsKeyType("$27")
OSKEY_DOWN = ConvertOsKeyType("$28")
OSKEY_SELECT = ConvertOsKeyType("$29")
OSKEY_PRINT = ConvertOsKeyType("$2A")
OSKEY_EXECUTE = ConvertOsKeyType("$2B")
OSKEY_PRINTSCREEN = ConvertOsKeyType("$2C")
OSKEY_INSERT = ConvertOsKeyType("$2D")
OSKEY_DELETE = ConvertOsKeyType("$2E")
OSKEY_HELP = ConvertOsKeyType("$2F")
OSKEY_0 = ConvertOsKeyType("$30")
OSKEY_1 = ConvertOsKeyType("$31")
OSKEY_2 = ConvertOsKeyType("$32")
OSKEY_3 = ConvertOsKeyType("$33")
OSKEY_4 = ConvertOsKeyType("$34")
OSKEY_5 = ConvertOsKeyType("$35")
OSKEY_6 = ConvertOsKeyType("$36")
OSKEY_7 = ConvertOsKeyType("$37")
OSKEY_8 = ConvertOsKeyType("$38")
OSKEY_9 = ConvertOsKeyType("$39")
OSKEY_A = ConvertOsKeyType("$41")
OSKEY_B = ConvertOsKeyType("$42")
OSKEY_C = ConvertOsKeyType("$43")
OSKEY_D = ConvertOsKeyType("$44")
OSKEY_E = ConvertOsKeyType("$45")
OSKEY_F = ConvertOsKeyType("$46")
OSKEY_G = ConvertOsKeyType("$47")
OSKEY_H = ConvertOsKeyType("$48")
OSKEY_I = ConvertOsKeyType("$49")
OSKEY_J = ConvertOsKeyType("$4A")
OSKEY_K = ConvertOsKeyType("$4B")
OSKEY_L = ConvertOsKeyType("$4C")
OSKEY_M = ConvertOsKeyType("$4D")
OSKEY_N = ConvertOsKeyType("$4E")
OSKEY_O = ConvertOsKeyType("$4F")
OSKEY_P = ConvertOsKeyType("$50")
OSKEY_Q = ConvertOsKeyType("$51")
OSKEY_R = ConvertOsKeyType("$52")
OSKEY_S = ConvertOsKeyType("$53")
OSKEY_T = ConvertOsKeyType("$54")
OSKEY_U = ConvertOsKeyType("$55")
OSKEY_V = ConvertOsKeyType("$56")
OSKEY_W = ConvertOsKeyType("$57")
OSKEY_X = ConvertOsKeyType("$58")
OSKEY_Y = ConvertOsKeyType("$59")
OSKEY_Z = ConvertOsKeyType("$5A")
OSKEY_LMETA = ConvertOsKeyType("$5B")
OSKEY_RMETA = ConvertOsKeyType("$5C")
OSKEY_APPS = ConvertOsKeyType("$5D")
OSKEY_SLEEP = ConvertOsKeyType("$5F")
OSKEY_NUMPAD0 = ConvertOsKeyType("$60")
OSKEY_NUMPAD1 = ConvertOsKeyType("$61")
OSKEY_NUMPAD2 = ConvertOsKeyType("$62")
OSKEY_NUMPAD3 = ConvertOsKeyType("$63")
OSKEY_NUMPAD4 = ConvertOsKeyType("$64")
OSKEY_NUMPAD5 = ConvertOsKeyType("$65")
OSKEY_NUMPAD6 = ConvertOsKeyType("$66")
OSKEY_NUMPAD7 = ConvertOsKeyType("$67")
OSKEY_NUMPAD8 = ConvertOsKeyType("$68")
OSKEY_NUMPAD9 = ConvertOsKeyType("$69")
OSKEY_MULTIPLY = ConvertOsKeyType("$6A")
OSKEY_ADD = ConvertOsKeyType("$6B")
OSKEY_SEPARATOR = ConvertOsKeyType("$6C")
OSKEY_SUBTRACT = ConvertOsKeyType("$6D")
OSKEY_DECIMAL = ConvertOsKeyType("$6E")
OSKEY_DIVIDE = ConvertOsKeyType("$6F")
OSKEY_F1 = ConvertOsKeyType("$70")
OSKEY_F2 = ConvertOsKeyType("$71")
OSKEY_F3 = ConvertOsKeyType("$72")
OSKEY_F4 = ConvertOsKeyType("$73")
OSKEY_F5 = ConvertOsKeyType("$74")
OSKEY_F6 = ConvertOsKeyType("$75")
OSKEY_F7 = ConvertOsKeyType("$76")
OSKEY_F8 = ConvertOsKeyType("$77")
OSKEY_F9 = ConvertOsKeyType("$78")
OSKEY_F10 = ConvertOsKeyType("$79")
OSKEY_F11 = ConvertOsKeyType("$7A")
OSKEY_F12 = ConvertOsKeyType("$7B")
OSKEY_F13 = ConvertOsKeyType("$7C")
OSKEY_F14 = ConvertOsKeyType("$7D")
OSKEY_F15 = ConvertOsKeyType("$7E")
OSKEY_F16 = ConvertOsKeyType("$7F")
OSKEY_F17 = ConvertOsKeyType("$80")
OSKEY_F18 = ConvertOsKeyType("$81")
OSKEY_F19 = ConvertOsKeyType("$82")
OSKEY_F20 = ConvertOsKeyType("$83")
OSKEY_F21 = ConvertOsKeyType("$84")
OSKEY_F22 = ConvertOsKeyType("$85")
OSKEY_F23 = ConvertOsKeyType("$86")
OSKEY_F24 = ConvertOsKeyType("$87")
OSKEY_NUMLOCK = ConvertOsKeyType("$90")
OSKEY_SCROLLLOCK = ConvertOsKeyType("$91")
OSKEY_OEM_NEC_EQUAL = ConvertOsKeyType("$92")
OSKEY_OEM_FJ_JISHO = ConvertOsKeyType("$92")
OSKEY_OEM_FJ_MASSHOU = ConvertOsKeyType("$93")
OSKEY_OEM_FJ_TOUROKU = ConvertOsKeyType("$94")
OSKEY_OEM_FJ_LOYA = ConvertOsKeyType("$95")
OSKEY_OEM_FJ_ROYA = ConvertOsKeyType("$96")
OSKEY_LSHIFT = ConvertOsKeyType("$A0")
OSKEY_RSHIFT = ConvertOsKeyType("$A1")
OSKEY_LCONTROL = ConvertOsKeyType("$A2")
OSKEY_RCONTROL = ConvertOsKeyType("$A3")
OSKEY_LALT = ConvertOsKeyType("$A4")
OSKEY_RALT = ConvertOsKeyType("$A5")
OSKEY_BROWSER_BACK = ConvertOsKeyType("$A6")
OSKEY_BROWSER_FORWARD = ConvertOsKeyType("$A7")
OSKEY_BROWSER_REFRESH = ConvertOsKeyType("$A8")
OSKEY_BROWSER_STOP = ConvertOsKeyType("$A9")
OSKEY_BROWSER_SEARCH = ConvertOsKeyType("$AA")
OSKEY_BROWSER_FAVORITES = ConvertOsKeyType("$AB")
OSKEY_BROWSER_HOME = ConvertOsKeyType("$AC")
OSKEY_VOLUME_MUTE = ConvertOsKeyType("$AD")
OSKEY_VOLUME_DOWN = ConvertOsKeyType("$AE")
OSKEY_VOLUME_UP = ConvertOsKeyType("$AF")
OSKEY_MEDIA_NEXT_TRACK = ConvertOsKeyType("$B0")
OSKEY_MEDIA_PREV_TRACK = ConvertOsKeyType("$B1")
OSKEY_MEDIA_STOP = ConvertOsKeyType("$B2")
OSKEY_MEDIA_PLAY_PAUSE = ConvertOsKeyType("$B3")
OSKEY_LAUNCH_MAIL = ConvertOsKeyType("$B4")
OSKEY_LAUNCH_MEDIA_SELECT = ConvertOsKeyType("$B5")
OSKEY_LAUNCH_APP1 = ConvertOsKeyType("$B6")
OSKEY_LAUNCH_APP2 = ConvertOsKeyType("$B7")
OSKEY_OEM_1 = ConvertOsKeyType("$BA")
OSKEY_OEM_PLUS = ConvertOsKeyType("$BB")
OSKEY_OEM_COMMA = ConvertOsKeyType("$BC")
OSKEY_OEM_MINUS = ConvertOsKeyType("$BD")
OSKEY_OEM_PERIOD = ConvertOsKeyType("$BE")
OSKEY_OEM_2 = ConvertOsKeyType("$BF")
OSKEY_OEM_3 = ConvertOsKeyType("$C0")
OSKEY_OEM_4 = ConvertOsKeyType("$DB")
OSKEY_OEM_5 = ConvertOsKeyType("$DC")
OSKEY_OEM_6 = ConvertOsKeyType("$DD")
OSKEY_OEM_7 = ConvertOsKeyType("$DE")
OSKEY_OEM_8 = ConvertOsKeyType("$DF")
OSKEY_OEM_AX = ConvertOsKeyType("$E1")
OSKEY_OEM_102 = ConvertOsKeyType("$E2")
OSKEY_ICO_HELP = ConvertOsKeyType("$E3")
OSKEY_ICO_00 = ConvertOsKeyType("$E4")
OSKEY_PROCESSKEY = ConvertOsKeyType("$E5")
OSKEY_ICO_CLEAR = ConvertOsKeyType("$E6")
OSKEY_PACKET = ConvertOsKeyType("$E7")
OSKEY_OEM_RESET = ConvertOsKeyType("$E9")
OSKEY_OEM_JUMP = ConvertOsKeyType("$EA")
OSKEY_OEM_PA1 = ConvertOsKeyType("$EB")
OSKEY_OEM_PA2 = ConvertOsKeyType("$EC")
OSKEY_OEM_PA3 = ConvertOsKeyType("$ED")
OSKEY_OEM_WSCTRL = ConvertOsKeyType("$EE")
OSKEY_OEM_CUSEL = ConvertOsKeyType("$EF")
OSKEY_OEM_ATTN = ConvertOsKeyType("$F0")
OSKEY_OEM_FINISH = ConvertOsKeyType("$F1")
OSKEY_OEM_COPY = ConvertOsKeyType("$F2")
OSKEY_OEM_AUTO = ConvertOsKeyType("$F3")
OSKEY_OEM_ENLW = ConvertOsKeyType("$F4")
OSKEY_OEM_BACKTAB = ConvertOsKeyType("$F5")
OSKEY_ATTN = ConvertOsKeyType("$F6")
OSKEY_CRSEL = ConvertOsKeyType("$F7")
OSKEY_EXSEL = ConvertOsKeyType("$F8")
OSKEY_EREOF = ConvertOsKeyType("$F9")
OSKEY_PLAY = ConvertOsKeyType("$FA")
OSKEY_ZOOM = ConvertOsKeyType("$FB")
OSKEY_NONAME = ConvertOsKeyType("$FC")
OSKEY_PA1 = ConvertOsKeyType("$FD")
OSKEY_OEM_CLEAR = ConvertOsKeyType("$FE")
ABILITY_IF_BUTTON_POSITION_NORMAL_X = ConvertAbilityIntegerField('abpx')
ABILITY_IF_BUTTON_POSITION_NORMAL_Y = ConvertAbilityIntegerField('abpy')
ABILITY_IF_BUTTON_POSITION_ACTIVATED_X = ConvertAbilityIntegerField('aubx')
ABILITY_IF_BUTTON_POSITION_ACTIVATED_Y = ConvertAbilityIntegerField('auby')
ABILITY_IF_BUTTON_POSITION_RESEARCH_X = ConvertAbilityIntegerField('arpx')
ABILITY_IF_BUTTON_POSITION_RESEARCH_Y = ConvertAbilityIntegerField('arpy')
ABILITY_IF_MISSILE_SPEED = ConvertAbilityIntegerField('amsp')
ABILITY_IF_TARGET_ATTACHMENTS = ConvertAbilityIntegerField('atac')
ABILITY_IF_CASTER_ATTACHMENTS = ConvertAbilityIntegerField('acac')
ABILITY_IF_PRIORITY = ConvertAbilityIntegerField('apri')
ABILITY_IF_LEVELS = ConvertAbilityIntegerField('alev')
ABILITY_IF_REQUIRED_LEVEL = ConvertAbilityIntegerField('arlv')
ABILITY_IF_LEVEL_SKIP_REQUIREMENT = ConvertAbilityIntegerField('alsk')
ABILITY_BF_HERO_ABILITY = ConvertAbilityBooleanField('aher')
ABILITY_BF_ITEM_ABILITY = ConvertAbilityBooleanField('aite')
ABILITY_BF_CHECK_DEPENDENCIES = ConvertAbilityBooleanField('achd')
ABILITY_RF_ARF_MISSILE_ARC = ConvertAbilityRealField('amac')
ABILITY_SF_NAME = ConvertAbilityStringField('anam')
ABILITY_SF_ICON_ACTIVATED = ConvertAbilityStringField('auar')
ABILITY_SF_ICON_RESEARCH = ConvertAbilityStringField('arar')
ABILITY_SF_EFFECT_SOUND = ConvertAbilityStringField('aefs')
ABILITY_SF_EFFECT_SOUND_LOOPING = ConvertAbilityStringField('aefl')
ABILITY_ILF_MANA_COST = ConvertAbilityIntegerLevelField('amcs')
ABILITY_ILF_NUMBER_OF_WAVES = ConvertAbilityIntegerLevelField('Hbz1')
ABILITY_ILF_NUMBER_OF_SHARDS = ConvertAbilityIntegerLevelField('Hbz3')
ABILITY_ILF_NUMBER_OF_UNITS_TELEPORTED = ConvertAbilityIntegerLevelField('Hmt1')
ABILITY_ILF_SUMMONED_UNIT_COUNT_HWE2 = ConvertAbilityIntegerLevelField('Hwe2')
ABILITY_ILF_NUMBER_OF_IMAGES = ConvertAbilityIntegerLevelField('Omi1')
ABILITY_ILF_NUMBER_OF_CORPSES_RAISED_UAN1 = ConvertAbilityIntegerLevelField('Uan1')
ABILITY_ILF_MORPHING_FLAGS = ConvertAbilityIntegerLevelField('Eme2')
ABILITY_ILF_STRENGTH_BONUS_NRG5 = ConvertAbilityIntegerLevelField('Nrg5')
ABILITY_ILF_DEFENSE_BONUS_NRG6 = ConvertAbilityIntegerLevelField('Nrg6')
ABILITY_ILF_NUMBER_OF_TARGETS_HIT = ConvertAbilityIntegerLevelField('Ocl2')
ABILITY_ILF_DETECTION_TYPE_OFS1 = ConvertAbilityIntegerLevelField('Ofs1')
ABILITY_ILF_NUMBER_OF_SUMMONED_UNITS_OSF2 = ConvertAbilityIntegerLevelField('Osf2')
ABILITY_ILF_NUMBER_OF_SUMMONED_UNITS_EFN1 = ConvertAbilityIntegerLevelField('Efn1')
ABILITY_ILF_NUMBER_OF_CORPSES_RAISED_HRE1 = ConvertAbilityIntegerLevelField('Hre1')
ABILITY_ILF_STACK_FLAGS = ConvertAbilityIntegerLevelField('Hca4')
ABILITY_ILF_MINIMUM_NUMBER_OF_UNITS = ConvertAbilityIntegerLevelField('Ndp2')
ABILITY_ILF_MAXIMUM_NUMBER_OF_UNITS_NDP3 = ConvertAbilityIntegerLevelField('Ndp3')
ABILITY_ILF_NUMBER_OF_UNITS_CREATED_NRC2 = ConvertAbilityIntegerLevelField('Nrc2')
ABILITY_ILF_SHIELD_LIFE = ConvertAbilityIntegerLevelField('Ams3')
ABILITY_ILF_MANA_LOSS_AMS4 = ConvertAbilityIntegerLevelField('Ams4')
ABILITY_ILF_GOLD_PER_INTERVAL_BGM1 = ConvertAbilityIntegerLevelField('Bgm1')
ABILITY_ILF_MAX_NUMBER_OF_MINERS = ConvertAbilityIntegerLevelField('Bgm3')
ABILITY_ILF_CARGO_CAPACITY = ConvertAbilityIntegerLevelField('Car1')
ABILITY_ILF_MAXIMUM_CREEP_LEVEL_DEV3 = ConvertAbilityIntegerLevelField('Dev3')
ABILITY_ILF_MAX_CREEP_LEVEL_DEV1 = ConvertAbilityIntegerLevelField('Dev1')
ABILITY_ILF_GOLD_PER_INTERVAL_EGM1 = ConvertAbilityIntegerLevelField('Egm1')
ABILITY_ILF_DEFENSE_REDUCTION = ConvertAbilityIntegerLevelField('Fae1')
ABILITY_ILF_DETECTION_TYPE_FLA1 = ConvertAbilityIntegerLevelField('Fla1')
ABILITY_ILF_FLARE_COUNT = ConvertAbilityIntegerLevelField('Fla3')
ABILITY_ILF_MAX_GOLD = ConvertAbilityIntegerLevelField('Gld1')
ABILITY_ILF_MINING_CAPACITY = ConvertAbilityIntegerLevelField('Gld3')
ABILITY_ILF_MAXIMUM_NUMBER_OF_CORPSES_GYD1 = ConvertAbilityIntegerLevelField('Gyd1')
ABILITY_ILF_DAMAGE_TO_TREE = ConvertAbilityIntegerLevelField('Har1')
ABILITY_ILF_LUMBER_CAPACITY = ConvertAbilityIntegerLevelField('Har2')
ABILITY_ILF_GOLD_CAPACITY = ConvertAbilityIntegerLevelField('Har3')
ABILITY_ILF_DEFENSE_INCREASE_INF2 = ConvertAbilityIntegerLevelField('Inf2')
ABILITY_ILF_INTERACTION_TYPE = ConvertAbilityIntegerLevelField('Neu2')
ABILITY_ILF_GOLD_COST_NDT1 = ConvertAbilityIntegerLevelField('Ndt1')
ABILITY_ILF_LUMBER_COST_NDT2 = ConvertAbilityIntegerLevelField('Ndt2')
ABILITY_ILF_DETECTION_TYPE_NDT3 = ConvertAbilityIntegerLevelField('Ndt3')
ABILITY_ILF_STACKING_TYPE_POI4 = ConvertAbilityIntegerLevelField('Poi4')
ABILITY_ILF_STACKING_TYPE_POA5 = ConvertAbilityIntegerLevelField('Poa5')
ABILITY_ILF_MAXIMUM_CREEP_LEVEL_PLY1 = ConvertAbilityIntegerLevelField('Ply1')
ABILITY_ILF_MAXIMUM_CREEP_LEVEL_POS1 = ConvertAbilityIntegerLevelField('Pos1')
ABILITY_ILF_MOVEMENT_UPDATE_FREQUENCY_PRG1 = ConvertAbilityIntegerLevelField('Prg1')
ABILITY_ILF_ATTACK_UPDATE_FREQUENCY_PRG2 = ConvertAbilityIntegerLevelField('Prg2')
ABILITY_ILF_MANA_LOSS_PRG6 = ConvertAbilityIntegerLevelField('Prg6')
ABILITY_ILF_UNITS_SUMMONED_TYPE_ONE = ConvertAbilityIntegerLevelField('Rai1')
ABILITY_ILF_UNITS_SUMMONED_TYPE_TWO = ConvertAbilityIntegerLevelField('Rai2')
ABILITY_ILF_MAX_UNITS_SUMMONED = ConvertAbilityIntegerLevelField('Ucb5')
ABILITY_ILF_ALLOW_WHEN_FULL_REJ3 = ConvertAbilityIntegerLevelField('Rej3')
ABILITY_ILF_MAXIMUM_UNITS_CHARGED_TO_CASTER = ConvertAbilityIntegerLevelField('Rpb5')
ABILITY_ILF_MAXIMUM_UNITS_AFFECTED = ConvertAbilityIntegerLevelField('Rpb6')
ABILITY_ILF_DEFENSE_INCREASE_ROA2 = ConvertAbilityIntegerLevelField('Roa2')
ABILITY_ILF_MAX_UNITS_ROA7 = ConvertAbilityIntegerLevelField('Roa7')
ABILITY_ILF_ROOTED_WEAPONS = ConvertAbilityIntegerLevelField('Roo1')
ABILITY_ILF_UPROOTED_WEAPONS = ConvertAbilityIntegerLevelField('Roo2')
ABILITY_ILF_UPROOTED_DEFENSE_TYPE = ConvertAbilityIntegerLevelField('Roo4')
ABILITY_ILF_ACCUMULATION_STEP = ConvertAbilityIntegerLevelField('Sal2')
ABILITY_ILF_NUMBER_OF_OWLS = ConvertAbilityIntegerLevelField('Esn4')
ABILITY_ILF_STACKING_TYPE_SPO4 = ConvertAbilityIntegerLevelField('Spo4')
ABILITY_ILF_NUMBER_OF_UNITS = ConvertAbilityIntegerLevelField('Sod1')
ABILITY_ILF_SPIDER_CAPACITY = ConvertAbilityIntegerLevelField('Spa1')
ABILITY_ILF_INTERVALS_BEFORE_CHANGING_TREES = ConvertAbilityIntegerLevelField('Wha2')
ABILITY_ILF_AGILITY_BONUS = ConvertAbilityIntegerLevelField('Iagi')
ABILITY_ILF_INTELLIGENCE_BONUS = ConvertAbilityIntegerLevelField('Iint')
ABILITY_ILF_STRENGTH_BONUS_ISTR = ConvertAbilityIntegerLevelField('Istr')
ABILITY_ILF_ATTACK_BONUS = ConvertAbilityIntegerLevelField('Iatt')
ABILITY_ILF_DEFENSE_BONUS_IDEF = ConvertAbilityIntegerLevelField('Idef')
ABILITY_ILF_SUMMON_1_AMOUNT = ConvertAbilityIntegerLevelField('Isn1')
ABILITY_ILF_SUMMON_2_AMOUNT = ConvertAbilityIntegerLevelField('Isn2')
ABILITY_ILF_EXPERIENCE_GAINED = ConvertAbilityIntegerLevelField('Ixpg')
ABILITY_ILF_HIT_POINTS_GAINED_IHPG = ConvertAbilityIntegerLevelField('Ihpg')
ABILITY_ILF_MANA_POINTS_GAINED_IMPG = ConvertAbilityIntegerLevelField('Impg')
ABILITY_ILF_HIT_POINTS_GAINED_IHP2 = ConvertAbilityIntegerLevelField('Ihp2')
ABILITY_ILF_MANA_POINTS_GAINED_IMP2 = ConvertAbilityIntegerLevelField('Imp2')
ABILITY_ILF_DAMAGE_BONUS_DICE = ConvertAbilityIntegerLevelField('Idic')
ABILITY_ILF_ARMOR_PENALTY_IARP = ConvertAbilityIntegerLevelField('Iarp')
ABILITY_ILF_ENABLED_ATTACK_INDEX_IOB5 = ConvertAbilityIntegerLevelField('Iob5')
ABILITY_ILF_LEVELS_GAINED = ConvertAbilityIntegerLevelField('Ilev')
ABILITY_ILF_MAX_LIFE_GAINED = ConvertAbilityIntegerLevelField('Ilif')
ABILITY_ILF_MAX_MANA_GAINED = ConvertAbilityIntegerLevelField('Iman')
ABILITY_ILF_GOLD_GIVEN = ConvertAbilityIntegerLevelField('Igol')
ABILITY_ILF_LUMBER_GIVEN = ConvertAbilityIntegerLevelField('Ilum')
ABILITY_ILF_DETECTION_TYPE_IFA1 = ConvertAbilityIntegerLevelField('Ifa1')
ABILITY_ILF_MAXIMUM_CREEP_LEVEL_ICRE = ConvertAbilityIntegerLevelField('Icre')
ABILITY_ILF_MOVEMENT_SPEED_BONUS = ConvertAbilityIntegerLevelField('Imvb')
ABILITY_ILF_HIT_POINTS_REGENERATED_PER_SECOND = ConvertAbilityIntegerLevelField('Ihpr')
ABILITY_ILF_SIGHT_RANGE_BONUS = ConvertAbilityIntegerLevelField('Isib')
ABILITY_ILF_DAMAGE_PER_DURATION = ConvertAbilityIntegerLevelField('Icfd')
ABILITY_ILF_MANA_USED_PER_SECOND = ConvertAbilityIntegerLevelField('Icfm')
ABILITY_ILF_EXTRA_MANA_REQUIRED = ConvertAbilityIntegerLevelField('Icfx')
ABILITY_ILF_DETECTION_RADIUS_IDET = ConvertAbilityIntegerLevelField('Idet')
ABILITY_ILF_MANA_LOSS_PER_UNIT_IDIM = ConvertAbilityIntegerLevelField('Idim')
ABILITY_ILF_DAMAGE_TO_SUMMONED_UNITS_IDID = ConvertAbilityIntegerLevelField('Idid')
ABILITY_ILF_MAXIMUM_NUMBER_OF_UNITS_IREC = ConvertAbilityIntegerLevelField('Irec')
ABILITY_ILF_DELAY_AFTER_DEATH_SECONDS = ConvertAbilityIntegerLevelField('Ircd')
ABILITY_ILF_RESTORED_LIFE = ConvertAbilityIntegerLevelField('irc2')
ABILITY_ILF_RESTORED_MANA__1_FOR_CURRENT = ConvertAbilityIntegerLevelField('irc3')
ABILITY_ILF_HIT_POINTS_RESTORED = ConvertAbilityIntegerLevelField('Ihps')
ABILITY_ILF_MANA_POINTS_RESTORED = ConvertAbilityIntegerLevelField('Imps')
ABILITY_ILF_MAXIMUM_NUMBER_OF_UNITS_ITPM = ConvertAbilityIntegerLevelField('Itpm')
ABILITY_ILF_NUMBER_OF_CORPSES_RAISED_CAD1 = ConvertAbilityIntegerLevelField('Cad1')
ABILITY_ILF_TERRAIN_DEFORMATION_DURATION_MS = ConvertAbilityIntegerLevelField('Wrs3')
ABILITY_ILF_MAXIMUM_UNITS = ConvertAbilityIntegerLevelField('Uds1')
ABILITY_ILF_DETECTION_TYPE_DET1 = ConvertAbilityIntegerLevelField('Det1')
ABILITY_ILF_GOLD_COST_PER_STRUCTURE = ConvertAbilityIntegerLevelField('Nsp1')
ABILITY_ILF_LUMBER_COST_PER_USE = ConvertAbilityIntegerLevelField('Nsp2')
ABILITY_ILF_DETECTION_TYPE_NSP3 = ConvertAbilityIntegerLevelField('Nsp3')
ABILITY_ILF_NUMBER_OF_SWARM_UNITS = ConvertAbilityIntegerLevelField('Uls1')
ABILITY_ILF_MAX_SWARM_UNITS_PER_TARGET = ConvertAbilityIntegerLevelField('Uls3')
ABILITY_ILF_NUMBER_OF_SUMMONED_UNITS_NBA2 = ConvertAbilityIntegerLevelField('Nba2')
ABILITY_ILF_MAXIMUM_CREEP_LEVEL_NCH1 = ConvertAbilityIntegerLevelField('Nch1')
ABILITY_ILF_ATTACKS_PREVENTED = ConvertAbilityIntegerLevelField('Nsi1')
ABILITY_ILF_MAXIMUM_NUMBER_OF_TARGETS_EFK3 = ConvertAbilityIntegerLevelField('Efk3')
ABILITY_ILF_NUMBER_OF_SUMMONED_UNITS_ESV1 = ConvertAbilityIntegerLevelField('Esv1')
ABILITY_ILF_MAXIMUM_NUMBER_OF_CORPSES_EXH1 = ConvertAbilityIntegerLevelField('exh1')
ABILITY_ILF_ITEM_CAPACITY = ConvertAbilityIntegerLevelField('inv1')
ABILITY_ILF_MAXIMUM_NUMBER_OF_TARGETS_SPL2 = ConvertAbilityIntegerLevelField('spl2')
ABILITY_ILF_ALLOW_WHEN_FULL_IRL3 = ConvertAbilityIntegerLevelField('irl3')
ABILITY_ILF_MAXIMUM_DISPELLED_UNITS = ConvertAbilityIntegerLevelField('idc3')
ABILITY_ILF_NUMBER_OF_LURES = ConvertAbilityIntegerLevelField('imo1')
ABILITY_ILF_NEW_TIME_OF_DAY_HOUR = ConvertAbilityIntegerLevelField('ict1')
ABILITY_ILF_NEW_TIME_OF_DAY_MINUTE = ConvertAbilityIntegerLevelField('ict2')
ABILITY_ILF_NUMBER_OF_UNITS_CREATED_MEC1 = ConvertAbilityIntegerLevelField('mec1')
ABILITY_ILF_MINIMUM_SPELLS = ConvertAbilityIntegerLevelField('spb3')
ABILITY_ILF_MAXIMUM_SPELLS = ConvertAbilityIntegerLevelField('spb4')
ABILITY_ILF_DISABLED_ATTACK_INDEX = ConvertAbilityIntegerLevelField('gra3')
ABILITY_ILF_ENABLED_ATTACK_INDEX_GRA4 = ConvertAbilityIntegerLevelField('gra4')
ABILITY_ILF_MAXIMUM_ATTACKS = ConvertAbilityIntegerLevelField('gra5')
ABILITY_ILF_BUILDING_TYPES_ALLOWED_NPR1 = ConvertAbilityIntegerLevelField('Npr1')
ABILITY_ILF_BUILDING_TYPES_ALLOWED_NSA1 = ConvertAbilityIntegerLevelField('Nsa1')
ABILITY_ILF_ATTACK_MODIFICATION = ConvertAbilityIntegerLevelField('Iaa1')
ABILITY_ILF_SUMMONED_UNIT_COUNT_NPA5 = ConvertAbilityIntegerLevelField('Npa5')
ABILITY_ILF_UPGRADE_LEVELS = ConvertAbilityIntegerLevelField('Igl1')
ABILITY_ILF_NUMBER_OF_SUMMONED_UNITS_NDO2 = ConvertAbilityIntegerLevelField('Ndo2')
ABILITY_ILF_BEASTS_PER_SECOND = ConvertAbilityIntegerLevelField('Nst1')
ABILITY_ILF_TARGET_TYPE = ConvertAbilityIntegerLevelField('Ncl2')
ABILITY_ILF_OPTIONS = ConvertAbilityIntegerLevelField('Ncl3')
ABILITY_ILF_ARMOR_PENALTY_NAB3 = ConvertAbilityIntegerLevelField('Nab3')
ABILITY_ILF_WAVE_COUNT_NHS6 = ConvertAbilityIntegerLevelField('Nhs6')
ABILITY_ILF_MAX_CREEP_LEVEL_NTM3 = ConvertAbilityIntegerLevelField('Ntm3')
ABILITY_ILF_MISSILE_COUNT = ConvertAbilityIntegerLevelField('Ncs3')
ABILITY_ILF_SPLIT_ATTACK_COUNT = ConvertAbilityIntegerLevelField('Nlm3')
ABILITY_ILF_GENERATION_COUNT = ConvertAbilityIntegerLevelField('Nlm6')
ABILITY_ILF_ROCK_RING_COUNT = ConvertAbilityIntegerLevelField('Nvc1')
ABILITY_ILF_WAVE_COUNT_NVC2 = ConvertAbilityIntegerLevelField('Nvc2')
ABILITY_ILF_PREFER_HOSTILES_TAU1 = ConvertAbilityIntegerLevelField('Tau1')
ABILITY_ILF_PREFER_FRIENDLIES_TAU2 = ConvertAbilityIntegerLevelField('Tau2')
ABILITY_ILF_MAX_UNITS_TAU3 = ConvertAbilityIntegerLevelField('Tau3')
ABILITY_ILF_NUMBER_OF_PULSES = ConvertAbilityIntegerLevelField('Tau4')
ABILITY_ILF_SUMMONED_UNIT_TYPE_HWE1 = ConvertAbilityIntegerLevelField('Hwe1')
ABILITY_ILF_SUMMONED_UNIT_UIN4 = ConvertAbilityIntegerLevelField('Uin4')
ABILITY_ILF_SUMMONED_UNIT_OSF1 = ConvertAbilityIntegerLevelField('Osf1')
ABILITY_ILF_SUMMONED_UNIT_TYPE_EFNU = ConvertAbilityIntegerLevelField('Efnu')
ABILITY_ILF_SUMMONED_UNIT_TYPE_NBAU = ConvertAbilityIntegerLevelField('Nbau')
ABILITY_ILF_SUMMONED_UNIT_TYPE_NTOU = ConvertAbilityIntegerLevelField('Ntou')
ABILITY_ILF_SUMMONED_UNIT_TYPE_ESVU = ConvertAbilityIntegerLevelField('Esvu')
ABILITY_ILF_SUMMONED_UNIT_TYPES = ConvertAbilityIntegerLevelField('Nef1')
ABILITY_ILF_SUMMONED_UNIT_TYPE_NDOU = ConvertAbilityIntegerLevelField('Ndou')
ABILITY_ILF_ALTERNATE_FORM_UNIT_EMEU = ConvertAbilityIntegerLevelField('Emeu')
ABILITY_ILF_PLAGUE_WARD_UNIT_TYPE = ConvertAbilityIntegerLevelField('Aplu')
ABILITY_ILF_ALLOWED_UNIT_TYPE_BTL1 = ConvertAbilityIntegerLevelField('Btl1')
ABILITY_ILF_NEW_UNIT_TYPE = ConvertAbilityIntegerLevelField('Cha1')
ABILITY_ILF_RESULTING_UNIT_TYPE_ENT1 = ConvertAbilityIntegerLevelField('ent1')
ABILITY_ILF_CORPSE_UNIT_TYPE = ConvertAbilityIntegerLevelField('Gydu')
ABILITY_ILF_ALLOWED_UNIT_TYPE_LOA1 = ConvertAbilityIntegerLevelField('Loa1')
ABILITY_ILF_UNIT_TYPE_FOR_LIMIT_CHECK = ConvertAbilityIntegerLevelField('Raiu')
ABILITY_ILF_WARD_UNIT_TYPE_STAU = ConvertAbilityIntegerLevelField('Stau')
ABILITY_ILF_EFFECT_ABILITY = ConvertAbilityIntegerLevelField('Iobu')
ABILITY_ILF_CONVERSION_UNIT = ConvertAbilityIntegerLevelField('Ndc2')
ABILITY_ILF_UNIT_TO_PRESERVE = ConvertAbilityIntegerLevelField('Nsl1')
ABILITY_ILF_UNIT_TYPE_ALLOWED = ConvertAbilityIntegerLevelField('Chl1')
ABILITY_ILF_SWARM_UNIT_TYPE = ConvertAbilityIntegerLevelField('Ulsu')
ABILITY_ILF_RESULTING_UNIT_TYPE_COAU = ConvertAbilityIntegerLevelField('coau')
ABILITY_ILF_UNIT_TYPE_EXHU = ConvertAbilityIntegerLevelField('exhu')
ABILITY_ILF_WARD_UNIT_TYPE_HWDU = ConvertAbilityIntegerLevelField('hwdu')
ABILITY_ILF_LURE_UNIT_TYPE = ConvertAbilityIntegerLevelField('imou')
ABILITY_ILF_UNIT_TYPE_IPMU = ConvertAbilityIntegerLevelField('ipmu')
ABILITY_ILF_FACTORY_UNIT_ID = ConvertAbilityIntegerLevelField('Nsyu')
ABILITY_ILF_SPAWN_UNIT_ID_NFYU = ConvertAbilityIntegerLevelField('Nfyu')
ABILITY_ILF_DESTRUCTIBLE_ID = ConvertAbilityIntegerLevelField('Nvcu')
ABILITY_ILF_UPGRADE_TYPE = ConvertAbilityIntegerLevelField('Iglu')
ABILITY_RLF_CASTING_TIME = ConvertAbilityRealLevelField('acas')
ABILITY_RLF_DURATION_NORMAL = ConvertAbilityRealLevelField('adur')
ABILITY_RLF_DURATION_HERO = ConvertAbilityRealLevelField('ahdu')
ABILITY_RLF_COOLDOWN = ConvertAbilityRealLevelField('acdn')
ABILITY_RLF_AREA_OF_EFFECT = ConvertAbilityRealLevelField('aare')
ABILITY_RLF_CAST_RANGE = ConvertAbilityRealLevelField('aran')
ABILITY_RLF_DAMAGE_HBZ2 = ConvertAbilityRealLevelField('Hbz2')
ABILITY_RLF_BUILDING_REDUCTION_HBZ4 = ConvertAbilityRealLevelField('Hbz4')
ABILITY_RLF_DAMAGE_PER_SECOND_HBZ5 = ConvertAbilityRealLevelField('Hbz5')
ABILITY_RLF_MAXIMUM_DAMAGE_PER_WAVE = ConvertAbilityRealLevelField('Hbz6')
ABILITY_RLF_MANA_REGENERATION_INCREASE = ConvertAbilityRealLevelField('Hab1')
ABILITY_RLF_CASTING_DELAY = ConvertAbilityRealLevelField('Hmt2')
ABILITY_RLF_DAMAGE_PER_SECOND_OWW1 = ConvertAbilityRealLevelField('Oww1')
ABILITY_RLF_MAGIC_DAMAGE_REDUCTION_OWW2 = ConvertAbilityRealLevelField('Oww2')
ABILITY_RLF_CHANCE_TO_CRITICAL_STRIKE = ConvertAbilityRealLevelField('Ocr1')
ABILITY_RLF_DAMAGE_MULTIPLIER_OCR2 = ConvertAbilityRealLevelField('Ocr2')
ABILITY_RLF_DAMAGE_BONUS_OCR3 = ConvertAbilityRealLevelField('Ocr3')
ABILITY_RLF_CHANCE_TO_EVADE_OCR4 = ConvertAbilityRealLevelField('Ocr4')
ABILITY_RLF_DAMAGE_DEALT_PERCENT_OMI2 = ConvertAbilityRealLevelField('Omi2')
ABILITY_RLF_DAMAGE_TAKEN_PERCENT_OMI3 = ConvertAbilityRealLevelField('Omi3')
ABILITY_RLF_ANIMATION_DELAY = ConvertAbilityRealLevelField('Omi4')
ABILITY_RLF_TRANSITION_TIME = ConvertAbilityRealLevelField('Owk1')
ABILITY_RLF_MOVEMENT_SPEED_INCREASE_PERCENT_OWK2 = ConvertAbilityRealLevelField('Owk2')
ABILITY_RLF_BACKSTAB_DAMAGE = ConvertAbilityRealLevelField('Owk3')
ABILITY_RLF_AMOUNT_HEALED_DAMAGED_UDC1 = ConvertAbilityRealLevelField('Udc1')
ABILITY_RLF_LIFE_CONVERTED_TO_MANA = ConvertAbilityRealLevelField('Udp1')
ABILITY_RLF_LIFE_CONVERTED_TO_LIFE = ConvertAbilityRealLevelField('Udp2')
ABILITY_RLF_MOVEMENT_SPEED_INCREASE_PERCENT_UAU1 = ConvertAbilityRealLevelField('Uau1')
ABILITY_RLF_LIFE_REGENERATION_INCREASE_PERCENT = ConvertAbilityRealLevelField('Uau2')
ABILITY_RLF_CHANCE_TO_EVADE_EEV1 = ConvertAbilityRealLevelField('Eev1')
ABILITY_RLF_DAMAGE_PER_INTERVAL = ConvertAbilityRealLevelField('Eim1')
ABILITY_RLF_MANA_DRAINED_PER_SECOND_EIM2 = ConvertAbilityRealLevelField('Eim2')
ABILITY_RLF_BUFFER_MANA_REQUIRED = ConvertAbilityRealLevelField('Eim3')
ABILITY_RLF_MAX_MANA_DRAINED = ConvertAbilityRealLevelField('Emb1')
ABILITY_RLF_BOLT_DELAY = ConvertAbilityRealLevelField('Emb2')
ABILITY_RLF_BOLT_LIFETIME = ConvertAbilityRealLevelField('Emb3')
ABILITY_RLF_ALTITUDE_ADJUSTMENT_DURATION = ConvertAbilityRealLevelField('Eme3')
ABILITY_RLF_LANDING_DELAY_TIME = ConvertAbilityRealLevelField('Eme4')
ABILITY_RLF_ALTERNATE_FORM_HIT_POINT_BONUS = ConvertAbilityRealLevelField('Eme5')
ABILITY_RLF_MOVE_SPEED_BONUS_INFO_PANEL_ONLY = ConvertAbilityRealLevelField('Ncr5')
ABILITY_RLF_ATTACK_SPEED_BONUS_INFO_PANEL_ONLY = ConvertAbilityRealLevelField('Ncr6')
ABILITY_RLF_LIFE_REGENERATION_RATE_PER_SECOND = ConvertAbilityRealLevelField('ave5')
ABILITY_RLF_STUN_DURATION_USL1 = ConvertAbilityRealLevelField('Usl1')
ABILITY_RLF_ATTACK_DAMAGE_STOLEN_PERCENT = ConvertAbilityRealLevelField('Uav1')
ABILITY_RLF_DAMAGE_UCS1 = ConvertAbilityRealLevelField('Ucs1')
ABILITY_RLF_MAX_DAMAGE_UCS2 = ConvertAbilityRealLevelField('Ucs2')
ABILITY_RLF_DISTANCE_UCS3 = ConvertAbilityRealLevelField('Ucs3')
ABILITY_RLF_FINAL_AREA_UCS4 = ConvertAbilityRealLevelField('Ucs4')
ABILITY_RLF_DAMAGE_UIN1 = ConvertAbilityRealLevelField('Uin1')
ABILITY_RLF_DURATION = ConvertAbilityRealLevelField('Uin2')
ABILITY_RLF_IMPACT_DELAY = ConvertAbilityRealLevelField('Uin3')
ABILITY_RLF_DAMAGE_PER_TARGET_OCL1 = ConvertAbilityRealLevelField('Ocl1')
ABILITY_RLF_DAMAGE_REDUCTION_PER_TARGET = ConvertAbilityRealLevelField('Ocl3')
ABILITY_RLF_EFFECT_DELAY_OEQ1 = ConvertAbilityRealLevelField('Oeq1')
ABILITY_RLF_DAMAGE_PER_SECOND_TO_BUILDINGS = ConvertAbilityRealLevelField('Oeq2')
ABILITY_RLF_UNITS_SLOWED_PERCENT = ConvertAbilityRealLevelField('Oeq3')
ABILITY_RLF_FINAL_AREA_OEQ4 = ConvertAbilityRealLevelField('Oeq4')
ABILITY_RLF_DAMAGE_PER_SECOND_EER1 = ConvertAbilityRealLevelField('Eer1')
ABILITY_RLF_DAMAGE_DEALT_TO_ATTACKERS = ConvertAbilityRealLevelField('Eah1')
ABILITY_RLF_LIFE_HEALED = ConvertAbilityRealLevelField('Etq1')
ABILITY_RLF_HEAL_INTERVAL = ConvertAbilityRealLevelField('Etq2')
ABILITY_RLF_BUILDING_REDUCTION_ETQ3 = ConvertAbilityRealLevelField('Etq3')
ABILITY_RLF_INITIAL_IMMUNITY_DURATION = ConvertAbilityRealLevelField('Etq4')
ABILITY_RLF_MAX_LIFE_DRAINED_PER_SECOND_PERCENT = ConvertAbilityRealLevelField('Udd1')
ABILITY_RLF_BUILDING_REDUCTION_UDD2 = ConvertAbilityRealLevelField('Udd2')
ABILITY_RLF_ARMOR_DURATION = ConvertAbilityRealLevelField('Ufa1')
ABILITY_RLF_ARMOR_BONUS_UFA2 = ConvertAbilityRealLevelField('Ufa2')
ABILITY_RLF_AREA_OF_EFFECT_DAMAGE = ConvertAbilityRealLevelField('Ufn1')
ABILITY_RLF_SPECIFIC_TARGET_DAMAGE_UFN2 = ConvertAbilityRealLevelField('Ufn2')
ABILITY_RLF_DAMAGE_BONUS_HFA1 = ConvertAbilityRealLevelField('Hfa1')
ABILITY_RLF_DAMAGE_DEALT_ESF1 = ConvertAbilityRealLevelField('Esf1')
ABILITY_RLF_DAMAGE_INTERVAL_ESF2 = ConvertAbilityRealLevelField('Esf2')
ABILITY_RLF_BUILDING_REDUCTION_ESF3 = ConvertAbilityRealLevelField('Esf3')
ABILITY_RLF_DAMAGE_BONUS_PERCENT = ConvertAbilityRealLevelField('Ear1')
ABILITY_RLF_DEFENSE_BONUS_HAV1 = ConvertAbilityRealLevelField('Hav1')
ABILITY_RLF_HIT_POINT_BONUS = ConvertAbilityRealLevelField('Hav2')
ABILITY_RLF_DAMAGE_BONUS_HAV3 = ConvertAbilityRealLevelField('Hav3')
ABILITY_RLF_MAGIC_DAMAGE_REDUCTION_HAV4 = ConvertAbilityRealLevelField('Hav4')
ABILITY_RLF_CHANCE_TO_BASH = ConvertAbilityRealLevelField('Hbh1')
ABILITY_RLF_DAMAGE_MULTIPLIER_HBH2 = ConvertAbilityRealLevelField('Hbh2')
ABILITY_RLF_DAMAGE_BONUS_HBH3 = ConvertAbilityRealLevelField('Hbh3')
ABILITY_RLF_CHANCE_TO_MISS_HBH4 = ConvertAbilityRealLevelField('Hbh4')
ABILITY_RLF_DAMAGE_HTB1 = ConvertAbilityRealLevelField('Htb1')
ABILITY_RLF_AOE_DAMAGE = ConvertAbilityRealLevelField('Htc1')
ABILITY_RLF_SPECIFIC_TARGET_DAMAGE_HTC2 = ConvertAbilityRealLevelField('Htc2')
ABILITY_RLF_MOVEMENT_SPEED_REDUCTION_PERCENT_HTC3 = ConvertAbilityRealLevelField('Htc3')
ABILITY_RLF_ATTACK_SPEED_REDUCTION_PERCENT_HTC4 = ConvertAbilityRealLevelField('Htc4')
ABILITY_RLF_ARMOR_BONUS_HAD1 = ConvertAbilityRealLevelField('Had1')
ABILITY_RLF_AMOUNT_HEALED_DAMAGED_HHB1 = ConvertAbilityRealLevelField('Hhb1')
ABILITY_RLF_EXTRA_DAMAGE_HCA1 = ConvertAbilityRealLevelField('Hca1')
ABILITY_RLF_MOVEMENT_SPEED_FACTOR_HCA2 = ConvertAbilityRealLevelField('Hca2')
ABILITY_RLF_ATTACK_SPEED_FACTOR_HCA3 = ConvertAbilityRealLevelField('Hca3')
ABILITY_RLF_MOVEMENT_SPEED_INCREASE_PERCENT_OAE1 = ConvertAbilityRealLevelField('Oae1')
ABILITY_RLF_ATTACK_SPEED_INCREASE_PERCENT_OAE2 = ConvertAbilityRealLevelField('Oae2')
ABILITY_RLF_REINCARNATION_DELAY = ConvertAbilityRealLevelField('Ore1')
ABILITY_RLF_DAMAGE_OSH1 = ConvertAbilityRealLevelField('Osh1')
ABILITY_RLF_MAXIMUM_DAMAGE_OSH2 = ConvertAbilityRealLevelField('Osh2')
ABILITY_RLF_DISTANCE_OSH3 = ConvertAbilityRealLevelField('Osh3')
ABILITY_RLF_FINAL_AREA_OSH4 = ConvertAbilityRealLevelField('Osh4')
ABILITY_RLF_GRAPHIC_DELAY_NFD1 = ConvertAbilityRealLevelField('Nfd1')
ABILITY_RLF_GRAPHIC_DURATION_NFD2 = ConvertAbilityRealLevelField('Nfd2')
ABILITY_RLF_DAMAGE_NFD3 = ConvertAbilityRealLevelField('Nfd3')
ABILITY_RLF_SUMMONED_UNIT_DAMAGE_AMS1 = ConvertAbilityRealLevelField('Ams1')
ABILITY_RLF_MAGIC_DAMAGE_REDUCTION_AMS2 = ConvertAbilityRealLevelField('Ams2')
ABILITY_RLF_AURA_DURATION = ConvertAbilityRealLevelField('Apl1')
ABILITY_RLF_DAMAGE_PER_SECOND_APL2 = ConvertAbilityRealLevelField('Apl2')
ABILITY_RLF_DURATION_OF_PLAGUE_WARD = ConvertAbilityRealLevelField('Apl3')
ABILITY_RLF_AMOUNT_OF_HIT_POINTS_REGENERATED = ConvertAbilityRealLevelField('Oar1')
ABILITY_RLF_ATTACK_DAMAGE_INCREASE_AKB1 = ConvertAbilityRealLevelField('Akb1')
ABILITY_RLF_MANA_LOSS_ADM1 = ConvertAbilityRealLevelField('Adm1')
ABILITY_RLF_SUMMONED_UNIT_DAMAGE_ADM2 = ConvertAbilityRealLevelField('Adm2')
ABILITY_RLF_EXPANSION_AMOUNT = ConvertAbilityRealLevelField('Bli1')
ABILITY_RLF_INTERVAL_DURATION_BGM2 = ConvertAbilityRealLevelField('Bgm2')
ABILITY_RLF_RADIUS_OF_MINING_RING = ConvertAbilityRealLevelField('Bgm4')
ABILITY_RLF_ATTACK_SPEED_INCREASE_PERCENT_BLO1 = ConvertAbilityRealLevelField('Blo1')
ABILITY_RLF_MOVEMENT_SPEED_INCREASE_PERCENT_BLO2 = ConvertAbilityRealLevelField('Blo2')
ABILITY_RLF_SCALING_FACTOR = ConvertAbilityRealLevelField('Blo3')
ABILITY_RLF_HIT_POINTS_PER_SECOND_CAN1 = ConvertAbilityRealLevelField('Can1')
ABILITY_RLF_MAX_HIT_POINTS = ConvertAbilityRealLevelField('Can2')
ABILITY_RLF_DAMAGE_PER_SECOND_DEV2 = ConvertAbilityRealLevelField('Dev2')
ABILITY_RLF_MOVEMENT_UPDATE_FREQUENCY_CHD1 = ConvertAbilityRealLevelField('Chd1')
ABILITY_RLF_ATTACK_UPDATE_FREQUENCY_CHD2 = ConvertAbilityRealLevelField('Chd2')
ABILITY_RLF_SUMMONED_UNIT_DAMAGE_CHD3 = ConvertAbilityRealLevelField('Chd3')
ABILITY_RLF_MOVEMENT_SPEED_REDUCTION_PERCENT_CRI1 = ConvertAbilityRealLevelField('Cri1')
ABILITY_RLF_ATTACK_SPEED_REDUCTION_PERCENT_CRI2 = ConvertAbilityRealLevelField('Cri2')
ABILITY_RLF_DAMAGE_REDUCTION_CRI3 = ConvertAbilityRealLevelField('Cri3')
ABILITY_RLF_CHANCE_TO_MISS_CRS = ConvertAbilityRealLevelField('Crs1')
ABILITY_RLF_FULL_DAMAGE_RADIUS_DDA1 = ConvertAbilityRealLevelField('Dda1')
ABILITY_RLF_FULL_DAMAGE_AMOUNT_DDA2 = ConvertAbilityRealLevelField('Dda2')
ABILITY_RLF_PARTIAL_DAMAGE_RADIUS = ConvertAbilityRealLevelField('Dda3')
ABILITY_RLF_PARTIAL_DAMAGE_AMOUNT = ConvertAbilityRealLevelField('Dda4')
ABILITY_RLF_BUILDING_DAMAGE_FACTOR_SDS1 = ConvertAbilityRealLevelField('Sds1')
ABILITY_RLF_MAX_DAMAGE_UCO5 = ConvertAbilityRealLevelField('Uco5')
ABILITY_RLF_MOVE_SPEED_BONUS_UCO6 = ConvertAbilityRealLevelField('Uco6')
ABILITY_RLF_DAMAGE_TAKEN_PERCENT_DEF1 = ConvertAbilityRealLevelField('Def1')
ABILITY_RLF_DAMAGE_DEALT_PERCENT_DEF2 = ConvertAbilityRealLevelField('Def2')
ABILITY_RLF_MOVEMENT_SPEED_FACTOR_DEF3 = ConvertAbilityRealLevelField('Def3')
ABILITY_RLF_ATTACK_SPEED_FACTOR_DEF4 = ConvertAbilityRealLevelField('Def4')
ABILITY_RLF_MAGIC_DAMAGE_REDUCTION_DEF5 = ConvertAbilityRealLevelField('Def5')
ABILITY_RLF_CHANCE_TO_DEFLECT = ConvertAbilityRealLevelField('Def6')
ABILITY_RLF_DEFLECT_DAMAGE_TAKEN_PIERCING = ConvertAbilityRealLevelField('Def7')
ABILITY_RLF_DEFLECT_DAMAGE_TAKEN_SPELLS = ConvertAbilityRealLevelField('Def8')
ABILITY_RLF_RIP_DELAY = ConvertAbilityRealLevelField('Eat1')
ABILITY_RLF_EAT_DELAY = ConvertAbilityRealLevelField('Eat2')
ABILITY_RLF_HIT_POINTS_GAINED_EAT3 = ConvertAbilityRealLevelField('Eat3')
ABILITY_RLF_AIR_UNIT_LOWER_DURATION = ConvertAbilityRealLevelField('Ens1')
ABILITY_RLF_AIR_UNIT_HEIGHT = ConvertAbilityRealLevelField('Ens2')
ABILITY_RLF_MELEE_ATTACK_RANGE = ConvertAbilityRealLevelField('Ens3')
ABILITY_RLF_INTERVAL_DURATION_EGM2 = ConvertAbilityRealLevelField('Egm2')
ABILITY_RLF_EFFECT_DELAY_FLA2 = ConvertAbilityRealLevelField('Fla2')
ABILITY_RLF_MINING_DURATION = ConvertAbilityRealLevelField('Gld2')
ABILITY_RLF_RADIUS_OF_GRAVESTONES = ConvertAbilityRealLevelField('Gyd2')
ABILITY_RLF_RADIUS_OF_CORPSES = ConvertAbilityRealLevelField('Gyd3')
ABILITY_RLF_HIT_POINTS_GAINED_HEA1 = ConvertAbilityRealLevelField('Hea1')
ABILITY_RLF_DAMAGE_INCREASE_PERCENT_INF1 = ConvertAbilityRealLevelField('Inf1')
ABILITY_RLF_AUTOCAST_RANGE = ConvertAbilityRealLevelField('Inf3')
ABILITY_RLF_LIFE_REGEN_RATE = ConvertAbilityRealLevelField('Inf4')
ABILITY_RLF_GRAPHIC_DELAY_LIT1 = ConvertAbilityRealLevelField('Lit1')
ABILITY_RLF_GRAPHIC_DURATION_LIT2 = ConvertAbilityRealLevelField('Lit2')
ABILITY_RLF_DAMAGE_PER_SECOND_LSH1 = ConvertAbilityRealLevelField('Lsh1')
ABILITY_RLF_MANA_GAINED = ConvertAbilityRealLevelField('Mbt1')
ABILITY_RLF_HIT_POINTS_GAINED_MBT2 = ConvertAbilityRealLevelField('Mbt2')
ABILITY_RLF_AUTOCAST_REQUIREMENT = ConvertAbilityRealLevelField('Mbt3')
ABILITY_RLF_WATER_HEIGHT = ConvertAbilityRealLevelField('Mbt4')
ABILITY_RLF_ACTIVATION_DELAY_MIN1 = ConvertAbilityRealLevelField('Min1')
ABILITY_RLF_INVISIBILITY_TRANSITION_TIME = ConvertAbilityRealLevelField('Min2')
ABILITY_RLF_ACTIVATION_RADIUS = ConvertAbilityRealLevelField('Neu1')
ABILITY_RLF_AMOUNT_REGENERATED = ConvertAbilityRealLevelField('Arm1')
ABILITY_RLF_DAMAGE_PER_SECOND_POI1 = ConvertAbilityRealLevelField('Poi1')
ABILITY_RLF_ATTACK_SPEED_FACTOR_POI2 = ConvertAbilityRealLevelField('Poi2')
ABILITY_RLF_MOVEMENT_SPEED_FACTOR_POI3 = ConvertAbilityRealLevelField('Poi3')
ABILITY_RLF_EXTRA_DAMAGE_POA1 = ConvertAbilityRealLevelField('Poa1')
ABILITY_RLF_DAMAGE_PER_SECOND_POA2 = ConvertAbilityRealLevelField('Poa2')
ABILITY_RLF_ATTACK_SPEED_FACTOR_POA3 = ConvertAbilityRealLevelField('Poa3')
ABILITY_RLF_MOVEMENT_SPEED_FACTOR_POA4 = ConvertAbilityRealLevelField('Poa4')
ABILITY_RLF_DAMAGE_AMPLIFICATION = ConvertAbilityRealLevelField('Pos2')
ABILITY_RLF_CHANCE_TO_STOMP_PERCENT = ConvertAbilityRealLevelField('War1')
ABILITY_RLF_DAMAGE_DEALT_WAR2 = ConvertAbilityRealLevelField('War2')
ABILITY_RLF_FULL_DAMAGE_RADIUS_WAR3 = ConvertAbilityRealLevelField('War3')
ABILITY_RLF_HALF_DAMAGE_RADIUS_WAR4 = ConvertAbilityRealLevelField('War4')
ABILITY_RLF_SUMMONED_UNIT_DAMAGE_PRG3 = ConvertAbilityRealLevelField('Prg3')
ABILITY_RLF_UNIT_PAUSE_DURATION = ConvertAbilityRealLevelField('Prg4')
ABILITY_RLF_HERO_PAUSE_DURATION = ConvertAbilityRealLevelField('Prg5')
ABILITY_RLF_HIT_POINTS_GAINED_REJ1 = ConvertAbilityRealLevelField('Rej1')
ABILITY_RLF_MANA_POINTS_GAINED_REJ2 = ConvertAbilityRealLevelField('Rej2')
ABILITY_RLF_MINIMUM_LIFE_REQUIRED = ConvertAbilityRealLevelField('Rpb3')
ABILITY_RLF_MINIMUM_MANA_REQUIRED = ConvertAbilityRealLevelField('Rpb4')
ABILITY_RLF_REPAIR_COST_RATIO = ConvertAbilityRealLevelField('Rep1')
ABILITY_RLF_REPAIR_TIME_RATIO = ConvertAbilityRealLevelField('Rep2')
ABILITY_RLF_POWERBUILD_COST = ConvertAbilityRealLevelField('Rep3')
ABILITY_RLF_POWERBUILD_RATE = ConvertAbilityRealLevelField('Rep4')
ABILITY_RLF_NAVAL_RANGE_BONUS = ConvertAbilityRealLevelField('Rep5')
ABILITY_RLF_DAMAGE_INCREASE_PERCENT_ROA1 = ConvertAbilityRealLevelField('Roa1')
ABILITY_RLF_LIFE_REGENERATION_RATE = ConvertAbilityRealLevelField('Roa3')
ABILITY_RLF_MANA_REGEN = ConvertAbilityRealLevelField('Roa4')
ABILITY_RLF_DAMAGE_INCREASE = ConvertAbilityRealLevelField('Nbr1')
ABILITY_RLF_SALVAGE_COST_RATIO = ConvertAbilityRealLevelField('Sal1')
ABILITY_RLF_IN_FLIGHT_SIGHT_RADIUS = ConvertAbilityRealLevelField('Esn1')
ABILITY_RLF_HOVERING_SIGHT_RADIUS = ConvertAbilityRealLevelField('Esn2')
ABILITY_RLF_HOVERING_HEIGHT = ConvertAbilityRealLevelField('Esn3')
ABILITY_RLF_DURATION_OF_OWLS = ConvertAbilityRealLevelField('Esn5')
ABILITY_RLF_FADE_DURATION = ConvertAbilityRealLevelField('Shm1')
ABILITY_RLF_DAY_NIGHT_DURATION = ConvertAbilityRealLevelField('Shm2')
ABILITY_RLF_ACTION_DURATION = ConvertAbilityRealLevelField('Shm3')
ABILITY_RLF_MOVEMENT_SPEED_FACTOR_SLO1 = ConvertAbilityRealLevelField('Slo1')
ABILITY_RLF_ATTACK_SPEED_FACTOR_SLO2 = ConvertAbilityRealLevelField('Slo2')
ABILITY_RLF_DAMAGE_PER_SECOND_SPO1 = ConvertAbilityRealLevelField('Spo1')
ABILITY_RLF_MOVEMENT_SPEED_FACTOR_SPO2 = ConvertAbilityRealLevelField('Spo2')
ABILITY_RLF_ATTACK_SPEED_FACTOR_SPO3 = ConvertAbilityRealLevelField('Spo3')
ABILITY_RLF_ACTIVATION_DELAY_STA1 = ConvertAbilityRealLevelField('Sta1')
ABILITY_RLF_DETECTION_RADIUS_STA2 = ConvertAbilityRealLevelField('Sta2')
ABILITY_RLF_DETONATION_RADIUS = ConvertAbilityRealLevelField('Sta3')
ABILITY_RLF_STUN_DURATION_STA4 = ConvertAbilityRealLevelField('Sta4')
ABILITY_RLF_ATTACK_SPEED_BONUS_PERCENT = ConvertAbilityRealLevelField('Uhf1')
ABILITY_RLF_DAMAGE_PER_SECOND_UHF2 = ConvertAbilityRealLevelField('Uhf2')
ABILITY_RLF_LUMBER_PER_INTERVAL = ConvertAbilityRealLevelField('Wha1')
ABILITY_RLF_ART_ATTACHMENT_HEIGHT = ConvertAbilityRealLevelField('Wha3')
ABILITY_RLF_TELEPORT_AREA_WIDTH = ConvertAbilityRealLevelField('Wrp1')
ABILITY_RLF_TELEPORT_AREA_HEIGHT = ConvertAbilityRealLevelField('Wrp2')
ABILITY_RLF_LIFE_STOLEN_PER_ATTACK = ConvertAbilityRealLevelField('Ivam')
ABILITY_RLF_DAMAGE_BONUS_IDAM = ConvertAbilityRealLevelField('Idam')
ABILITY_RLF_CHANCE_TO_HIT_UNITS_PERCENT = ConvertAbilityRealLevelField('Iob2')
ABILITY_RLF_CHANCE_TO_HIT_HEROS_PERCENT = ConvertAbilityRealLevelField('Iob3')
ABILITY_RLF_CHANCE_TO_HIT_SUMMONS_PERCENT = ConvertAbilityRealLevelField('Iob4')
ABILITY_RLF_DELAY_FOR_TARGET_EFFECT = ConvertAbilityRealLevelField('Idel')
ABILITY_RLF_DAMAGE_DEALT_PERCENT_OF_NORMAL = ConvertAbilityRealLevelField('Iild')
ABILITY_RLF_DAMAGE_RECEIVED_MULTIPLIER = ConvertAbilityRealLevelField('Iilw')
ABILITY_RLF_MANA_REGENERATION_BONUS_AS_FRACTION_OF_NORMAL = ConvertAbilityRealLevelField('Imrp')
ABILITY_RLF_MOVEMENT_SPEED_INCREASE_ISPI = ConvertAbilityRealLevelField('Ispi')
ABILITY_RLF_DAMAGE_PER_SECOND_IDPS = ConvertAbilityRealLevelField('Idps')
ABILITY_RLF_ATTACK_DAMAGE_INCREASE_CAC1 = ConvertAbilityRealLevelField('Cac1')
ABILITY_RLF_DAMAGE_PER_SECOND_COR1 = ConvertAbilityRealLevelField('Cor1')
ABILITY_RLF_ATTACK_SPEED_INCREASE_ISX1 = ConvertAbilityRealLevelField('Isx1')
ABILITY_RLF_DAMAGE_WRS1 = ConvertAbilityRealLevelField('Wrs1')
ABILITY_RLF_TERRAIN_DEFORMATION_AMPLITUDE = ConvertAbilityRealLevelField('Wrs2')
ABILITY_RLF_DAMAGE_CTC1 = ConvertAbilityRealLevelField('Ctc1')
ABILITY_RLF_EXTRA_DAMAGE_TO_TARGET = ConvertAbilityRealLevelField('Ctc2')
ABILITY_RLF_MOVEMENT_SPEED_REDUCTION_CTC3 = ConvertAbilityRealLevelField('Ctc3')
ABILITY_RLF_ATTACK_SPEED_REDUCTION_CTC4 = ConvertAbilityRealLevelField('Ctc4')
ABILITY_RLF_DAMAGE_CTB1 = ConvertAbilityRealLevelField('Ctb1')
ABILITY_RLF_CASTING_DELAY_SECONDS = ConvertAbilityRealLevelField('Uds2')
ABILITY_RLF_MANA_LOSS_PER_UNIT_DTN1 = ConvertAbilityRealLevelField('Dtn1')
ABILITY_RLF_DAMAGE_TO_SUMMONED_UNITS_DTN2 = ConvertAbilityRealLevelField('Dtn2')
ABILITY_RLF_TRANSITION_TIME_SECONDS = ConvertAbilityRealLevelField('Ivs1')
ABILITY_RLF_MANA_DRAINED_PER_SECOND_NMR1 = ConvertAbilityRealLevelField('Nmr1')
ABILITY_RLF_CHANCE_TO_REDUCE_DAMAGE_PERCENT = ConvertAbilityRealLevelField('Ssk1')
ABILITY_RLF_MINIMUM_DAMAGE = ConvertAbilityRealLevelField('Ssk2')
ABILITY_RLF_IGNORED_DAMAGE = ConvertAbilityRealLevelField('Ssk3')
ABILITY_RLF_FULL_DAMAGE_DEALT = ConvertAbilityRealLevelField('Hfs1')
ABILITY_RLF_FULL_DAMAGE_INTERVAL = ConvertAbilityRealLevelField('Hfs2')
ABILITY_RLF_HALF_DAMAGE_DEALT = ConvertAbilityRealLevelField('Hfs3')
ABILITY_RLF_HALF_DAMAGE_INTERVAL = ConvertAbilityRealLevelField('Hfs4')
ABILITY_RLF_BUILDING_REDUCTION_HFS5 = ConvertAbilityRealLevelField('Hfs5')
ABILITY_RLF_MAXIMUM_DAMAGE_HFS6 = ConvertAbilityRealLevelField('Hfs6')
ABILITY_RLF_MANA_PER_HIT_POINT = ConvertAbilityRealLevelField('Nms1')
ABILITY_RLF_DAMAGE_ABSORBED_PERCENT = ConvertAbilityRealLevelField('Nms2')
ABILITY_RLF_WAVE_DISTANCE = ConvertAbilityRealLevelField('Uim1')
ABILITY_RLF_WAVE_TIME_SECONDS = ConvertAbilityRealLevelField('Uim2')
ABILITY_RLF_DAMAGE_DEALT_UIM3 = ConvertAbilityRealLevelField('Uim3')
ABILITY_RLF_AIR_TIME_SECONDS_UIM4 = ConvertAbilityRealLevelField('Uim4')
ABILITY_RLF_UNIT_RELEASE_INTERVAL_SECONDS = ConvertAbilityRealLevelField('Uls2')
ABILITY_RLF_DAMAGE_RETURN_FACTOR = ConvertAbilityRealLevelField('Uls4')
ABILITY_RLF_DAMAGE_RETURN_THRESHOLD = ConvertAbilityRealLevelField('Uls5')
ABILITY_RLF_RETURNED_DAMAGE_FACTOR = ConvertAbilityRealLevelField('Uts1')
ABILITY_RLF_RECEIVED_DAMAGE_FACTOR = ConvertAbilityRealLevelField('Uts2')
ABILITY_RLF_DEFENSE_BONUS_UTS3 = ConvertAbilityRealLevelField('Uts3')
ABILITY_RLF_DAMAGE_BONUS_NBA1 = ConvertAbilityRealLevelField('Nba1')
ABILITY_RLF_SUMMONED_UNIT_DURATION_SECONDS_NBA3 = ConvertAbilityRealLevelField('Nba3')
ABILITY_RLF_MANA_PER_SUMMONED_HITPOINT = ConvertAbilityRealLevelField('Cmg2')
ABILITY_RLF_CHARGE_FOR_CURRENT_LIFE = ConvertAbilityRealLevelField('Cmg3')
ABILITY_RLF_HIT_POINTS_DRAINED = ConvertAbilityRealLevelField('Ndr1')
ABILITY_RLF_MANA_POINTS_DRAINED = ConvertAbilityRealLevelField('Ndr2')
ABILITY_RLF_DRAIN_INTERVAL_SECONDS = ConvertAbilityRealLevelField('Ndr3')
ABILITY_RLF_LIFE_TRANSFERRED_PER_SECOND = ConvertAbilityRealLevelField('Ndr4')
ABILITY_RLF_MANA_TRANSFERRED_PER_SECOND = ConvertAbilityRealLevelField('Ndr5')
ABILITY_RLF_BONUS_LIFE_FACTOR = ConvertAbilityRealLevelField('Ndr6')
ABILITY_RLF_BONUS_LIFE_DECAY = ConvertAbilityRealLevelField('Ndr7')
ABILITY_RLF_BONUS_MANA_FACTOR = ConvertAbilityRealLevelField('Ndr8')
ABILITY_RLF_BONUS_MANA_DECAY = ConvertAbilityRealLevelField('Ndr9')
ABILITY_RLF_CHANCE_TO_MISS_PERCENT = ConvertAbilityRealLevelField('Nsi2')
ABILITY_RLF_MOVEMENT_SPEED_MODIFIER = ConvertAbilityRealLevelField('Nsi3')
ABILITY_RLF_ATTACK_SPEED_MODIFIER = ConvertAbilityRealLevelField('Nsi4')
ABILITY_RLF_DAMAGE_PER_SECOND_TDG1 = ConvertAbilityRealLevelField('Tdg1')
ABILITY_RLF_MEDIUM_DAMAGE_RADIUS_TDG2 = ConvertAbilityRealLevelField('Tdg2')
ABILITY_RLF_MEDIUM_DAMAGE_PER_SECOND = ConvertAbilityRealLevelField('Tdg3')
ABILITY_RLF_SMALL_DAMAGE_RADIUS_TDG4 = ConvertAbilityRealLevelField('Tdg4')
ABILITY_RLF_SMALL_DAMAGE_PER_SECOND = ConvertAbilityRealLevelField('Tdg5')
ABILITY_RLF_AIR_TIME_SECONDS_TSP1 = ConvertAbilityRealLevelField('Tsp1')
ABILITY_RLF_MINIMUM_HIT_INTERVAL_SECONDS = ConvertAbilityRealLevelField('Tsp2')
ABILITY_RLF_DAMAGE_PER_SECOND_NBF5 = ConvertAbilityRealLevelField('Nbf5')
ABILITY_RLF_MAXIMUM_RANGE = ConvertAbilityRealLevelField('Ebl1')
ABILITY_RLF_MINIMUM_RANGE = ConvertAbilityRealLevelField('Ebl2')
ABILITY_RLF_DAMAGE_PER_TARGET_EFK1 = ConvertAbilityRealLevelField('Efk1')
ABILITY_RLF_MAXIMUM_TOTAL_DAMAGE = ConvertAbilityRealLevelField('Efk2')
ABILITY_RLF_MAXIMUM_SPEED_ADJUSTMENT = ConvertAbilityRealLevelField('Efk4')
ABILITY_RLF_DECAYING_DAMAGE = ConvertAbilityRealLevelField('Esh1')
ABILITY_RLF_MOVEMENT_SPEED_FACTOR_ESH2 = ConvertAbilityRealLevelField('Esh2')
ABILITY_RLF_ATTACK_SPEED_FACTOR_ESH3 = ConvertAbilityRealLevelField('Esh3')
ABILITY_RLF_DECAY_POWER = ConvertAbilityRealLevelField('Esh4')
ABILITY_RLF_INITIAL_DAMAGE_ESH5 = ConvertAbilityRealLevelField('Esh5')
ABILITY_RLF_MAXIMUM_LIFE_ABSORBED = ConvertAbilityRealLevelField('abs1')
ABILITY_RLF_MAXIMUM_MANA_ABSORBED = ConvertAbilityRealLevelField('abs2')
ABILITY_RLF_MOVEMENT_SPEED_INCREASE_BSK1 = ConvertAbilityRealLevelField('bsk1')
ABILITY_RLF_ATTACK_SPEED_INCREASE_BSK2 = ConvertAbilityRealLevelField('bsk2')
ABILITY_RLF_DAMAGE_TAKEN_INCREASE = ConvertAbilityRealLevelField('bsk3')
ABILITY_RLF_LIFE_PER_UNIT = ConvertAbilityRealLevelField('dvm1')
ABILITY_RLF_MANA_PER_UNIT = ConvertAbilityRealLevelField('dvm2')
ABILITY_RLF_LIFE_PER_BUFF = ConvertAbilityRealLevelField('dvm3')
ABILITY_RLF_MANA_PER_BUFF = ConvertAbilityRealLevelField('dvm4')
ABILITY_RLF_SUMMONED_UNIT_DAMAGE_DVM5 = ConvertAbilityRealLevelField('dvm5')
ABILITY_RLF_DAMAGE_BONUS_FAK1 = ConvertAbilityRealLevelField('fak1')
ABILITY_RLF_MEDIUM_DAMAGE_FACTOR_FAK2 = ConvertAbilityRealLevelField('fak2')
ABILITY_RLF_SMALL_DAMAGE_FACTOR_FAK3 = ConvertAbilityRealLevelField('fak3')
ABILITY_RLF_FULL_DAMAGE_RADIUS_FAK4 = ConvertAbilityRealLevelField('fak4')
ABILITY_RLF_HALF_DAMAGE_RADIUS_FAK5 = ConvertAbilityRealLevelField('fak5')
ABILITY_RLF_EXTRA_DAMAGE_PER_SECOND = ConvertAbilityRealLevelField('liq1')
ABILITY_RLF_MOVEMENT_SPEED_REDUCTION_LIQ2 = ConvertAbilityRealLevelField('liq2')
ABILITY_RLF_ATTACK_SPEED_REDUCTION_LIQ3 = ConvertAbilityRealLevelField('liq3')
ABILITY_RLF_MAGIC_DAMAGE_FACTOR = ConvertAbilityRealLevelField('mim1')
ABILITY_RLF_UNIT_DAMAGE_PER_MANA_POINT = ConvertAbilityRealLevelField('mfl1')
ABILITY_RLF_HERO_DAMAGE_PER_MANA_POINT = ConvertAbilityRealLevelField('mfl2')
ABILITY_RLF_UNIT_MAXIMUM_DAMAGE = ConvertAbilityRealLevelField('mfl3')
ABILITY_RLF_HERO_MAXIMUM_DAMAGE = ConvertAbilityRealLevelField('mfl4')
ABILITY_RLF_DAMAGE_COOLDOWN = ConvertAbilityRealLevelField('mfl5')
ABILITY_RLF_DISTRIBUTED_DAMAGE_FACTOR_SPL1 = ConvertAbilityRealLevelField('spl1')
ABILITY_RLF_LIFE_REGENERATED = ConvertAbilityRealLevelField('irl1')
ABILITY_RLF_MANA_REGENERATED = ConvertAbilityRealLevelField('irl2')
ABILITY_RLF_MANA_LOSS_PER_UNIT_IDC1 = ConvertAbilityRealLevelField('idc1')
ABILITY_RLF_SUMMONED_UNIT_DAMAGE_IDC2 = ConvertAbilityRealLevelField('idc2')
ABILITY_RLF_ACTIVATION_DELAY_IMO2 = ConvertAbilityRealLevelField('imo2')
ABILITY_RLF_LURE_INTERVAL_SECONDS = ConvertAbilityRealLevelField('imo3')
ABILITY_RLF_DAMAGE_BONUS_ISR1 = ConvertAbilityRealLevelField('isr1')
ABILITY_RLF_DAMAGE_REDUCTION_ISR2 = ConvertAbilityRealLevelField('isr2')
ABILITY_RLF_DAMAGE_BONUS_IPV1 = ConvertAbilityRealLevelField('ipv1')
ABILITY_RLF_LIFE_STEAL_AMOUNT = ConvertAbilityRealLevelField('ipv2')
ABILITY_RLF_LIFE_RESTORED_FACTOR = ConvertAbilityRealLevelField('ast1')
ABILITY_RLF_MANA_RESTORED_FACTOR = ConvertAbilityRealLevelField('ast2')
ABILITY_RLF_ATTACH_DELAY = ConvertAbilityRealLevelField('gra1')
ABILITY_RLF_REMOVE_DELAY = ConvertAbilityRealLevelField('gra2')
ABILITY_RLF_HERO_REGENERATION_DELAY = ConvertAbilityRealLevelField('Nsa2')
ABILITY_RLF_UNIT_REGENERATION_DELAY = ConvertAbilityRealLevelField('Nsa3')
ABILITY_RLF_MAGIC_DAMAGE_REDUCTION_NSA4 = ConvertAbilityRealLevelField('Nsa4')
ABILITY_RLF_HIT_POINTS_PER_SECOND_NSA5 = ConvertAbilityRealLevelField('Nsa5')
ABILITY_RLF_DAMAGE_TO_SUMMONED_UNITS_IXS1 = ConvertAbilityRealLevelField('Ixs1')
ABILITY_RLF_MAGIC_DAMAGE_REDUCTION_IXS2 = ConvertAbilityRealLevelField('Ixs2')
ABILITY_RLF_SUMMONED_UNIT_DURATION = ConvertAbilityRealLevelField('Npa6')
ABILITY_RLF_SHIELD_COOLDOWN_TIME = ConvertAbilityRealLevelField('Nse1')
ABILITY_RLF_DAMAGE_PER_SECOND_NDO1 = ConvertAbilityRealLevelField('Ndo1')
ABILITY_RLF_SUMMONED_UNIT_DURATION_SECONDS_NDO3 = ConvertAbilityRealLevelField('Ndo3')
ABILITY_RLF_MEDIUM_DAMAGE_RADIUS_FLK1 = ConvertAbilityRealLevelField('flk1')
ABILITY_RLF_SMALL_DAMAGE_RADIUS_FLK2 = ConvertAbilityRealLevelField('flk2')
ABILITY_RLF_FULL_DAMAGE_AMOUNT_FLK3 = ConvertAbilityRealLevelField('flk3')
ABILITY_RLF_MEDIUM_DAMAGE_AMOUNT = ConvertAbilityRealLevelField('flk4')
ABILITY_RLF_SMALL_DAMAGE_AMOUNT = ConvertAbilityRealLevelField('flk5')
ABILITY_RLF_MOVEMENT_SPEED_REDUCTION_PERCENT_HBN1 = ConvertAbilityRealLevelField('Hbn1')
ABILITY_RLF_ATTACK_SPEED_REDUCTION_PERCENT_HBN2 = ConvertAbilityRealLevelField('Hbn2')
ABILITY_RLF_MAX_MANA_DRAINED_UNITS = ConvertAbilityRealLevelField('fbk1')
ABILITY_RLF_DAMAGE_RATIO_UNITS_PERCENT = ConvertAbilityRealLevelField('fbk2')
ABILITY_RLF_MAX_MANA_DRAINED_HEROS = ConvertAbilityRealLevelField('fbk3')
ABILITY_RLF_DAMAGE_RATIO_HEROS_PERCENT = ConvertAbilityRealLevelField('fbk4')
ABILITY_RLF_SUMMONED_DAMAGE = ConvertAbilityRealLevelField('fbk5')
ABILITY_RLF_DISTRIBUTED_DAMAGE_FACTOR_NCA1 = ConvertAbilityRealLevelField('nca1')
ABILITY_RLF_INITIAL_DAMAGE_PXF1 = ConvertAbilityRealLevelField('pxf1')
ABILITY_RLF_DAMAGE_PER_SECOND_PXF2 = ConvertAbilityRealLevelField('pxf2')
ABILITY_RLF_DAMAGE_PER_SECOND_MLS1 = ConvertAbilityRealLevelField('mls1')
ABILITY_RLF_BEAST_COLLISION_RADIUS = ConvertAbilityRealLevelField('Nst2')
ABILITY_RLF_DAMAGE_AMOUNT_NST3 = ConvertAbilityRealLevelField('Nst3')
ABILITY_RLF_DAMAGE_RADIUS = ConvertAbilityRealLevelField('Nst4')
ABILITY_RLF_DAMAGE_DELAY = ConvertAbilityRealLevelField('Nst5')
ABILITY_RLF_FOLLOW_THROUGH_TIME = ConvertAbilityRealLevelField('Ncl1')
ABILITY_RLF_ART_DURATION = ConvertAbilityRealLevelField('Ncl4')
ABILITY_RLF_MOVEMENT_SPEED_REDUCTION_PERCENT_NAB1 = ConvertAbilityRealLevelField('Nab1')
ABILITY_RLF_ATTACK_SPEED_REDUCTION_PERCENT_NAB2 = ConvertAbilityRealLevelField('Nab2')
ABILITY_RLF_PRIMARY_DAMAGE = ConvertAbilityRealLevelField('Nab4')
ABILITY_RLF_SECONDARY_DAMAGE = ConvertAbilityRealLevelField('Nab5')
ABILITY_RLF_DAMAGE_INTERVAL_NAB6 = ConvertAbilityRealLevelField('Nab6')
ABILITY_RLF_GOLD_COST_FACTOR = ConvertAbilityRealLevelField('Ntm1')
ABILITY_RLF_LUMBER_COST_FACTOR = ConvertAbilityRealLevelField('Ntm2')
ABILITY_RLF_MOVE_SPEED_BONUS_NEG1 = ConvertAbilityRealLevelField('Neg1')
ABILITY_RLF_DAMAGE_BONUS_NEG2 = ConvertAbilityRealLevelField('Neg2')
ABILITY_RLF_DAMAGE_AMOUNT_NCS1 = ConvertAbilityRealLevelField('Ncs1')
ABILITY_RLF_DAMAGE_INTERVAL_NCS2 = ConvertAbilityRealLevelField('Ncs2')
ABILITY_RLF_MAX_DAMAGE_NCS4 = ConvertAbilityRealLevelField('Ncs4')
ABILITY_RLF_BUILDING_DAMAGE_FACTOR_NCS5 = ConvertAbilityRealLevelField('Ncs5')
ABILITY_RLF_EFFECT_DURATION = ConvertAbilityRealLevelField('Ncs6')
ABILITY_RLF_SPAWN_INTERVAL_NSY1 = ConvertAbilityRealLevelField('Nsy1')
ABILITY_RLF_SPAWN_UNIT_DURATION = ConvertAbilityRealLevelField('Nsy3')
ABILITY_RLF_SPAWN_UNIT_OFFSET = ConvertAbilityRealLevelField('Nsy4')
ABILITY_RLF_LEASH_RANGE_NSY5 = ConvertAbilityRealLevelField('Nsy5')
ABILITY_RLF_SPAWN_INTERVAL_NFY1 = ConvertAbilityRealLevelField('Nfy1')
ABILITY_RLF_LEASH_RANGE_NFY2 = ConvertAbilityRealLevelField('Nfy2')
ABILITY_RLF_CHANCE_TO_DEMOLISH = ConvertAbilityRealLevelField('Nde1')
ABILITY_RLF_DAMAGE_MULTIPLIER_BUILDINGS = ConvertAbilityRealLevelField('Nde2')
ABILITY_RLF_DAMAGE_MULTIPLIER_UNITS = ConvertAbilityRealLevelField('Nde3')
ABILITY_RLF_DAMAGE_MULTIPLIER_HEROES = ConvertAbilityRealLevelField('Nde4')
ABILITY_RLF_BONUS_DAMAGE_MULTIPLIER = ConvertAbilityRealLevelField('Nic1')
ABILITY_RLF_DEATH_DAMAGE_FULL_AMOUNT = ConvertAbilityRealLevelField('Nic2')
ABILITY_RLF_DEATH_DAMAGE_FULL_AREA = ConvertAbilityRealLevelField('Nic3')
ABILITY_RLF_DEATH_DAMAGE_HALF_AMOUNT = ConvertAbilityRealLevelField('Nic4')
ABILITY_RLF_DEATH_DAMAGE_HALF_AREA = ConvertAbilityRealLevelField('Nic5')
ABILITY_RLF_DEATH_DAMAGE_DELAY = ConvertAbilityRealLevelField('Nic6')
ABILITY_RLF_DAMAGE_AMOUNT_NSO1 = ConvertAbilityRealLevelField('Nso1')
ABILITY_RLF_DAMAGE_PERIOD = ConvertAbilityRealLevelField('Nso2')
ABILITY_RLF_DAMAGE_PENALTY = ConvertAbilityRealLevelField('Nso3')
ABILITY_RLF_MOVEMENT_SPEED_REDUCTION_PERCENT_NSO4 = ConvertAbilityRealLevelField('Nso4')
ABILITY_RLF_ATTACK_SPEED_REDUCTION_PERCENT_NSO5 = ConvertAbilityRealLevelField('Nso5')
ABILITY_RLF_SPLIT_DELAY = ConvertAbilityRealLevelField('Nlm2')
ABILITY_RLF_MAX_HITPOINT_FACTOR = ConvertAbilityRealLevelField('Nlm4')
ABILITY_RLF_LIFE_DURATION_SPLIT_BONUS = ConvertAbilityRealLevelField('Nlm5')
ABILITY_RLF_WAVE_INTERVAL = ConvertAbilityRealLevelField('Nvc3')
ABILITY_RLF_BUILDING_DAMAGE_FACTOR_NVC4 = ConvertAbilityRealLevelField('Nvc4')
ABILITY_RLF_FULL_DAMAGE_AMOUNT_NVC5 = ConvertAbilityRealLevelField('Nvc5')
ABILITY_RLF_HALF_DAMAGE_FACTOR = ConvertAbilityRealLevelField('Nvc6')
ABILITY_RLF_INTERVAL_BETWEEN_PULSES = ConvertAbilityRealLevelField('Tau5')
ABILITY_BLF_PERCENT_BONUS_HAB2 = ConvertAbilityBooleanLevelField('Hab2')
ABILITY_BLF_USE_TELEPORT_CLUSTERING_HMT3 = ConvertAbilityBooleanLevelField('Hmt3')
ABILITY_BLF_NEVER_MISS_OCR5 = ConvertAbilityBooleanLevelField('Ocr5')
ABILITY_BLF_EXCLUDE_ITEM_DAMAGE = ConvertAbilityBooleanLevelField('Ocr6')
ABILITY_BLF_BACKSTAB_DAMAGE = ConvertAbilityBooleanLevelField('Owk4')
ABILITY_BLF_INHERIT_UPGRADES_UAN3 = ConvertAbilityBooleanLevelField('Uan3')
ABILITY_BLF_MANA_CONVERSION_AS_PERCENT = ConvertAbilityBooleanLevelField('Udp3')
ABILITY_BLF_LIFE_CONVERSION_AS_PERCENT = ConvertAbilityBooleanLevelField('Udp4')
ABILITY_BLF_LEAVE_TARGET_ALIVE = ConvertAbilityBooleanLevelField('Udp5')
ABILITY_BLF_PERCENT_BONUS_UAU3 = ConvertAbilityBooleanLevelField('Uau3')
ABILITY_BLF_DAMAGE_IS_PERCENT_RECEIVED = ConvertAbilityBooleanLevelField('Eah2')
ABILITY_BLF_MELEE_BONUS = ConvertAbilityBooleanLevelField('Ear2')
ABILITY_BLF_RANGED_BONUS = ConvertAbilityBooleanLevelField('Ear3')
ABILITY_BLF_FLAT_BONUS = ConvertAbilityBooleanLevelField('Ear4')
ABILITY_BLF_NEVER_MISS_HBH5 = ConvertAbilityBooleanLevelField('Hbh5')
ABILITY_BLF_PERCENT_BONUS_HAD2 = ConvertAbilityBooleanLevelField('Had2')
ABILITY_BLF_CAN_DEACTIVATE = ConvertAbilityBooleanLevelField('Hds1')
ABILITY_BLF_RAISED_UNITS_ARE_INVULNERABLE = ConvertAbilityBooleanLevelField('Hre2')
ABILITY_BLF_PERCENTAGE_OAR2 = ConvertAbilityBooleanLevelField('Oar2')
ABILITY_BLF_SUMMON_BUSY_UNITS = ConvertAbilityBooleanLevelField('Btl2')
ABILITY_BLF_CREATES_BLIGHT = ConvertAbilityBooleanLevelField('Bli2')
ABILITY_BLF_EXPLODES_ON_DEATH = ConvertAbilityBooleanLevelField('Sds6')
ABILITY_BLF_ALWAYS_AUTOCAST_FAE2 = ConvertAbilityBooleanLevelField('Fae2')
ABILITY_BLF_REGENERATE_ONLY_AT_NIGHT = ConvertAbilityBooleanLevelField('Mbt5')
ABILITY_BLF_SHOW_SELECT_UNIT_BUTTON = ConvertAbilityBooleanLevelField('Neu3')
ABILITY_BLF_SHOW_UNIT_INDICATOR = ConvertAbilityBooleanLevelField('Neu4')
ABILITY_BLF_CHARGE_OWNING_PLAYER = ConvertAbilityBooleanLevelField('Ans6')
ABILITY_BLF_PERCENTAGE_ARM2 = ConvertAbilityBooleanLevelField('Arm2')
ABILITY_BLF_TARGET_IS_INVULNERABLE = ConvertAbilityBooleanLevelField('Pos3')
ABILITY_BLF_TARGET_IS_MAGIC_IMMUNE = ConvertAbilityBooleanLevelField('Pos4')
ABILITY_BLF_KILL_ON_CASTER_DEATH = ConvertAbilityBooleanLevelField('Ucb6')
ABILITY_BLF_NO_TARGET_REQUIRED_REJ4 = ConvertAbilityBooleanLevelField('Rej4')
ABILITY_BLF_ACCEPTS_GOLD = ConvertAbilityBooleanLevelField('Rtn1')
ABILITY_BLF_ACCEPTS_LUMBER = ConvertAbilityBooleanLevelField('Rtn2')
ABILITY_BLF_PREFER_HOSTILES_ROA5 = ConvertAbilityBooleanLevelField('Roa5')
ABILITY_BLF_PREFER_FRIENDLIES_ROA6 = ConvertAbilityBooleanLevelField('Roa6')
ABILITY_BLF_ROOTED_TURNING = ConvertAbilityBooleanLevelField('Roo3')
ABILITY_BLF_ALWAYS_AUTOCAST_SLO3 = ConvertAbilityBooleanLevelField('Slo3')
ABILITY_BLF_HIDE_BUTTON = ConvertAbilityBooleanLevelField('Ihid')
ABILITY_BLF_USE_TELEPORT_CLUSTERING_ITP2 = ConvertAbilityBooleanLevelField('Itp2')
ABILITY_BLF_IMMUNE_TO_MORPH_EFFECTS = ConvertAbilityBooleanLevelField('Eth1')
ABILITY_BLF_DOES_NOT_BLOCK_BUILDINGS = ConvertAbilityBooleanLevelField('Eth2')
ABILITY_BLF_AUTO_ACQUIRE_ATTACK_TARGETS = ConvertAbilityBooleanLevelField('Gho1')
ABILITY_BLF_IMMUNE_TO_MORPH_EFFECTS_GHO2 = ConvertAbilityBooleanLevelField('Gho2')
ABILITY_BLF_DO_NOT_BLOCK_BUILDINGS = ConvertAbilityBooleanLevelField('Gho3')
ABILITY_BLF_INCLUDE_RANGED_DAMAGE = ConvertAbilityBooleanLevelField('Ssk4')
ABILITY_BLF_INCLUDE_MELEE_DAMAGE = ConvertAbilityBooleanLevelField('Ssk5')
ABILITY_BLF_MOVE_TO_PARTNER = ConvertAbilityBooleanLevelField('coa2')
ABILITY_BLF_CAN_BE_DISPELLED = ConvertAbilityBooleanLevelField('cyc1')
ABILITY_BLF_IGNORE_FRIENDLY_BUFFS = ConvertAbilityBooleanLevelField('dvm6')
ABILITY_BLF_DROP_ITEMS_ON_DEATH = ConvertAbilityBooleanLevelField('inv2')
ABILITY_BLF_CAN_USE_ITEMS = ConvertAbilityBooleanLevelField('inv3')
ABILITY_BLF_CAN_GET_ITEMS = ConvertAbilityBooleanLevelField('inv4')
ABILITY_BLF_CAN_DROP_ITEMS = ConvertAbilityBooleanLevelField('inv5')
ABILITY_BLF_REPAIRS_ALLOWED = ConvertAbilityBooleanLevelField('liq4')
ABILITY_BLF_CASTER_ONLY_SPLASH = ConvertAbilityBooleanLevelField('mfl6')
ABILITY_BLF_NO_TARGET_REQUIRED_IRL4 = ConvertAbilityBooleanLevelField('irl4')
ABILITY_BLF_DISPEL_ON_ATTACK = ConvertAbilityBooleanLevelField('irl5')
ABILITY_BLF_AMOUNT_IS_RAW_VALUE = ConvertAbilityBooleanLevelField('ipv3')
ABILITY_BLF_SHARED_SPELL_COOLDOWN = ConvertAbilityBooleanLevelField('spb2')
ABILITY_BLF_SLEEP_ONCE = ConvertAbilityBooleanLevelField('sla1')
ABILITY_BLF_ALLOW_ON_ANY_PLAYER_SLOT = ConvertAbilityBooleanLevelField('sla2')
ABILITY_BLF_DISABLE_OTHER_ABILITIES = ConvertAbilityBooleanLevelField('Ncl5')
ABILITY_BLF_ALLOW_BOUNTY = ConvertAbilityBooleanLevelField('Ntm4')
ABILITY_SLF_ICON_NORMAL = ConvertAbilityStringLevelField('aart')
ABILITY_SLF_CASTER = ConvertAbilityStringLevelField('acat')
ABILITY_SLF_TARGET = ConvertAbilityStringLevelField('atat')
ABILITY_SLF_SPECIAL = ConvertAbilityStringLevelField('asat')
ABILITY_SLF_EFFECT = ConvertAbilityStringLevelField('aeat')
ABILITY_SLF_AREA_EFFECT = ConvertAbilityStringLevelField('aaea')
ABILITY_SLF_LIGHTNING_EFFECTS = ConvertAbilityStringLevelField('alig')
ABILITY_SLF_MISSILE_ART = ConvertAbilityStringLevelField('amat')
ABILITY_SLF_TOOLTIP_LEARN = ConvertAbilityStringLevelField('aret')
ABILITY_SLF_TOOLTIP_LEARN_EXTENDED = ConvertAbilityStringLevelField('arut')
ABILITY_SLF_TOOLTIP_NORMAL = ConvertAbilityStringLevelField('atp1')
ABILITY_SLF_TOOLTIP_TURN_OFF = ConvertAbilityStringLevelField('aut1')
ABILITY_SLF_TOOLTIP_NORMAL_EXTENDED = ConvertAbilityStringLevelField('aub1')
ABILITY_SLF_TOOLTIP_TURN_OFF_EXTENDED = ConvertAbilityStringLevelField('auu1')
ABILITY_SLF_NORMAL_FORM_UNIT_EME1 = ConvertAbilityStringLevelField('Eme1')
ABILITY_SLF_SPAWNED_UNITS = ConvertAbilityStringLevelField('Ndp1')
ABILITY_SLF_ABILITY_FOR_UNIT_CREATION = ConvertAbilityStringLevelField('Nrc1')
ABILITY_SLF_NORMAL_FORM_UNIT_MIL1 = ConvertAbilityStringLevelField('Mil1')
ABILITY_SLF_ALTERNATE_FORM_UNIT_MIL2 = ConvertAbilityStringLevelField('Mil2')
ABILITY_SLF_BASE_ORDER_ID_ANS5 = ConvertAbilityStringLevelField('Ans5')
ABILITY_SLF_MORPH_UNITS_GROUND = ConvertAbilityStringLevelField('Ply2')
ABILITY_SLF_MORPH_UNITS_AIR = ConvertAbilityStringLevelField('Ply3')
ABILITY_SLF_MORPH_UNITS_AMPHIBIOUS = ConvertAbilityStringLevelField('Ply4')
ABILITY_SLF_MORPH_UNITS_WATER = ConvertAbilityStringLevelField('Ply5')
ABILITY_SLF_UNIT_TYPE_ONE = ConvertAbilityStringLevelField('Rai3')
ABILITY_SLF_UNIT_TYPE_TWO = ConvertAbilityStringLevelField('Rai4')
ABILITY_SLF_UNIT_TYPE_SOD2 = ConvertAbilityStringLevelField('Sod2')
ABILITY_SLF_SUMMON_1_UNIT_TYPE = ConvertAbilityStringLevelField('Ist1')
ABILITY_SLF_SUMMON_2_UNIT_TYPE = ConvertAbilityStringLevelField('Ist2')
ABILITY_SLF_RACE_TO_CONVERT = ConvertAbilityStringLevelField('Ndc1')
ABILITY_SLF_PARTNER_UNIT_TYPE = ConvertAbilityStringLevelField('coa1')
ABILITY_SLF_PARTNER_UNIT_TYPE_ONE = ConvertAbilityStringLevelField('dcp1')
ABILITY_SLF_PARTNER_UNIT_TYPE_TWO = ConvertAbilityStringLevelField('dcp2')
ABILITY_SLF_REQUIRED_UNIT_TYPE = ConvertAbilityStringLevelField('tpi1')
ABILITY_SLF_CONVERTED_UNIT_TYPE = ConvertAbilityStringLevelField('tpi2')
ABILITY_SLF_SPELL_LIST = ConvertAbilityStringLevelField('spb1')
ABILITY_SLF_BASE_ORDER_ID_SPB5 = ConvertAbilityStringLevelField('spb5')
ABILITY_SLF_BASE_ORDER_ID_NCL6 = ConvertAbilityStringLevelField('Ncl6')
ABILITY_SLF_ABILITY_UPGRADE_1 = ConvertAbilityStringLevelField('Neg3')
ABILITY_SLF_ABILITY_UPGRADE_2 = ConvertAbilityStringLevelField('Neg4')
ABILITY_SLF_ABILITY_UPGRADE_3 = ConvertAbilityStringLevelField('Neg5')
ABILITY_SLF_ABILITY_UPGRADE_4 = ConvertAbilityStringLevelField('Neg6')
ABILITY_SLF_SPAWN_UNIT_ID_NSY2 = ConvertAbilityStringLevelField('Nsy2')
ITEM_IF_LEVEL = ConvertItemIntegerField('ilev')
ITEM_IF_NUMBER_OF_CHARGES = ConvertItemIntegerField('iuse')
ITEM_IF_COOLDOWN_GROUP = ConvertItemIntegerField('icid')
ITEM_IF_MAX_HIT_POINTS = ConvertItemIntegerField('ihtp')
ITEM_IF_HIT_POINTS = ConvertItemIntegerField('ihpc')
ITEM_IF_PRIORITY = ConvertItemIntegerField('ipri')
ITEM_IF_ARMOR_TYPE = ConvertItemIntegerField('iarm')
ITEM_IF_TINTING_COLOR_RED = ConvertItemIntegerField('iclr')
ITEM_IF_TINTING_COLOR_GREEN = ConvertItemIntegerField('iclg')
ITEM_IF_TINTING_COLOR_BLUE = ConvertItemIntegerField('iclb')
ITEM_IF_TINTING_COLOR_ALPHA = ConvertItemIntegerField('ical')
ITEM_RF_SCALING_VALUE = ConvertItemRealField('isca')
ITEM_BF_DROPPED_WHEN_CARRIER_DIES = ConvertItemBooleanField('idrp')
ITEM_BF_CAN_BE_DROPPED = ConvertItemBooleanField('idro')
ITEM_BF_PERISHABLE = ConvertItemBooleanField('iper')
ITEM_BF_INCLUDE_AS_RANDOM_CHOICE = ConvertItemBooleanField('iprn')
ITEM_BF_USE_AUTOMATICALLY_WHEN_ACQUIRED = ConvertItemBooleanField('ipow')
ITEM_BF_CAN_BE_SOLD_TO_MERCHANTS = ConvertItemBooleanField('ipaw')
ITEM_BF_ACTIVELY_USED = ConvertItemBooleanField('iusa')
ITEM_SF_MODEL_USED = ConvertItemStringField('ifil')
UNIT_IF_DEFENSE_TYPE = ConvertUnitIntegerField('udty')
UNIT_IF_ARMOR_TYPE = ConvertUnitIntegerField('uarm')
UNIT_IF_LOOPING_FADE_IN_RATE = ConvertUnitIntegerField('ulfi')
UNIT_IF_LOOPING_FADE_OUT_RATE = ConvertUnitIntegerField('ulfo')
UNIT_IF_AGILITY = ConvertUnitIntegerField('uagc')
UNIT_IF_INTELLIGENCE = ConvertUnitIntegerField('uinc')
UNIT_IF_STRENGTH = ConvertUnitIntegerField('ustc')
UNIT_IF_AGILITY_PERMANENT = ConvertUnitIntegerField('uagm')
UNIT_IF_INTELLIGENCE_PERMANENT = ConvertUnitIntegerField('uinm')
UNIT_IF_STRENGTH_PERMANENT = ConvertUnitIntegerField('ustm')
UNIT_IF_AGILITY_WITH_BONUS = ConvertUnitIntegerField('uagb')
UNIT_IF_INTELLIGENCE_WITH_BONUS = ConvertUnitIntegerField('uinb')
UNIT_IF_STRENGTH_WITH_BONUS = ConvertUnitIntegerField('ustb')
UNIT_IF_GOLD_BOUNTY_AWARDED_NUMBER_OF_DICE = ConvertUnitIntegerField('ubdi')
UNIT_IF_GOLD_BOUNTY_AWARDED_BASE = ConvertUnitIntegerField('ubba')
UNIT_IF_GOLD_BOUNTY_AWARDED_SIDES_PER_DIE = ConvertUnitIntegerField('ubsi')
UNIT_IF_LUMBER_BOUNTY_AWARDED_NUMBER_OF_DICE = ConvertUnitIntegerField('ulbd')
UNIT_IF_LUMBER_BOUNTY_AWARDED_BASE = ConvertUnitIntegerField('ulba')
UNIT_IF_LUMBER_BOUNTY_AWARDED_SIDES_PER_DIE = ConvertUnitIntegerField('ulbs')
UNIT_IF_LEVEL = ConvertUnitIntegerField('ulev')
UNIT_IF_FORMATION_RANK = ConvertUnitIntegerField('ufor')
UNIT_IF_ORIENTATION_INTERPOLATION = ConvertUnitIntegerField('uori')
UNIT_IF_ELEVATION_SAMPLE_POINTS = ConvertUnitIntegerField('uept')
UNIT_IF_TINTING_COLOR_RED = ConvertUnitIntegerField('uclr')
UNIT_IF_TINTING_COLOR_GREEN = ConvertUnitIntegerField('uclg')
UNIT_IF_TINTING_COLOR_BLUE = ConvertUnitIntegerField('uclb')
UNIT_IF_TINTING_COLOR_ALPHA = ConvertUnitIntegerField('ucal')
UNIT_IF_MOVE_TYPE = ConvertUnitIntegerField('umvt')
UNIT_IF_TARGETED_AS = ConvertUnitIntegerField('utar')
UNIT_IF_UNIT_CLASSIFICATION = ConvertUnitIntegerField('utyp')
UNIT_IF_HIT_POINTS_REGENERATION_TYPE = ConvertUnitIntegerField('uhrt')
UNIT_IF_PLACEMENT_PREVENTED_BY = ConvertUnitIntegerField('upar')
UNIT_IF_PRIMARY_ATTRIBUTE = ConvertUnitIntegerField('upra')
UNIT_RF_STRENGTH_PER_LEVEL = ConvertUnitRealField('ustp')
UNIT_RF_AGILITY_PER_LEVEL = ConvertUnitRealField('uagp')
UNIT_RF_INTELLIGENCE_PER_LEVEL = ConvertUnitRealField('uinp')
UNIT_RF_HIT_POINTS_REGENERATION_RATE = ConvertUnitRealField('uhpr')
UNIT_RF_MANA_REGENERATION = ConvertUnitRealField('umpr')
UNIT_RF_DEATH_TIME = ConvertUnitRealField('udtm')
UNIT_RF_FLY_HEIGHT = ConvertUnitRealField('ufyh')
UNIT_RF_TURN_RATE = ConvertUnitRealField('umvr')
UNIT_RF_ELEVATION_SAMPLE_RADIUS = ConvertUnitRealField('uerd')
UNIT_RF_FOG_OF_WAR_SAMPLE_RADIUS = ConvertUnitRealField('ufrd')
UNIT_RF_MAXIMUM_PITCH_ANGLE_DEGREES = ConvertUnitRealField('umxp')
UNIT_RF_MAXIMUM_ROLL_ANGLE_DEGREES = ConvertUnitRealField('umxr')
UNIT_RF_SCALING_VALUE = ConvertUnitRealField('usca')
UNIT_RF_ANIMATION_RUN_SPEED = ConvertUnitRealField('urun')
UNIT_RF_SELECTION_SCALE = ConvertUnitRealField('ussc')
UNIT_RF_SELECTION_CIRCLE_HEIGHT = ConvertUnitRealField('uslz')
UNIT_RF_SHADOW_IMAGE_HEIGHT = ConvertUnitRealField('ushh')
UNIT_RF_SHADOW_IMAGE_WIDTH = ConvertUnitRealField('ushw')
UNIT_RF_SHADOW_IMAGE_CENTER_X = ConvertUnitRealField('ushx')
UNIT_RF_SHADOW_IMAGE_CENTER_Y = ConvertUnitRealField('ushy')
UNIT_RF_ANIMATION_WALK_SPEED = ConvertUnitRealField('uwal')
UNIT_RF_DEFENSE = ConvertUnitRealField('udfc')
UNIT_RF_SIGHT_RADIUS = ConvertUnitRealField('usir')
UNIT_RF_PRIORITY = ConvertUnitRealField('upri')
UNIT_RF_SPEED = ConvertUnitRealField('umvc')
UNIT_RF_OCCLUDER_HEIGHT = ConvertUnitRealField('uocc')
UNIT_RF_HP = ConvertUnitRealField('uhpc')
UNIT_RF_MANA = ConvertUnitRealField('umpc')
UNIT_RF_ACQUISITION_RANGE = ConvertUnitRealField('uacq')
UNIT_RF_CAST_BACK_SWING = ConvertUnitRealField('ucbs')
UNIT_RF_CAST_POINT = ConvertUnitRealField('ucpt')
UNIT_RF_MINIMUM_ATTACK_RANGE = ConvertUnitRealField('uamn')
UNIT_BF_RAISABLE = ConvertUnitBooleanField('urai')
UNIT_BF_DECAYABLE = ConvertUnitBooleanField('udec')
UNIT_BF_IS_A_BUILDING = ConvertUnitBooleanField('ubdg')
UNIT_BF_USE_EXTENDED_LINE_OF_SIGHT = ConvertUnitBooleanField('ulos')
UNIT_BF_NEUTRAL_BUILDING_SHOWS_MINIMAP_ICON = ConvertUnitBooleanField('unbm')
UNIT_BF_HERO_HIDE_HERO_INTERFACE_ICON = ConvertUnitBooleanField('uhhb')
UNIT_BF_HERO_HIDE_HERO_MINIMAP_DISPLAY = ConvertUnitBooleanField('uhhm')
UNIT_BF_HERO_HIDE_HERO_DEATH_MESSAGE = ConvertUnitBooleanField('uhhd')
UNIT_BF_HIDE_MINIMAP_DISPLAY = ConvertUnitBooleanField('uhom')
UNIT_BF_SCALE_PROJECTILES = ConvertUnitBooleanField('uscb')
UNIT_BF_SELECTION_CIRCLE_ON_WATER = ConvertUnitBooleanField('usew')
UNIT_BF_HAS_WATER_SHADOW = ConvertUnitBooleanField('ushr')
UNIT_SF_NAME = ConvertUnitStringField('unam')
UNIT_SF_PROPER_NAMES = ConvertUnitStringField('upro')
UNIT_SF_GROUND_TEXTURE = ConvertUnitStringField('uubs')
UNIT_SF_SHADOW_IMAGE_UNIT = ConvertUnitStringField('ushu')
UNIT_WEAPON_IF_ATTACK_DAMAGE_NUMBER_OF_DICE = ConvertUnitWeaponIntegerField('ua1d')
UNIT_WEAPON_IF_ATTACK_DAMAGE_BASE = ConvertUnitWeaponIntegerField('ua1b')
UNIT_WEAPON_IF_ATTACK_DAMAGE_SIDES_PER_DIE = ConvertUnitWeaponIntegerField('ua1s')
UNIT_WEAPON_IF_ATTACK_MAXIMUM_NUMBER_OF_TARGETS = ConvertUnitWeaponIntegerField('utc1')
UNIT_WEAPON_IF_ATTACK_ATTACK_TYPE = ConvertUnitWeaponIntegerField('ua1t')
UNIT_WEAPON_IF_ATTACK_WEAPON_SOUND = ConvertUnitWeaponIntegerField('ucs1')
UNIT_WEAPON_IF_ATTACK_AREA_OF_EFFECT_TARGETS = ConvertUnitWeaponIntegerField('ua1p')
UNIT_WEAPON_IF_ATTACK_TARGETS_ALLOWED = ConvertUnitWeaponIntegerField('ua1g')
UNIT_WEAPON_RF_ATTACK_BACKSWING_POINT = ConvertUnitWeaponRealField('ubs1')
UNIT_WEAPON_RF_ATTACK_DAMAGE_POINT = ConvertUnitWeaponRealField('udp1')
UNIT_WEAPON_RF_ATTACK_BASE_COOLDOWN = ConvertUnitWeaponRealField('ua1c')
UNIT_WEAPON_RF_ATTACK_DAMAGE_LOSS_FACTOR = ConvertUnitWeaponRealField('udl1')
UNIT_WEAPON_RF_ATTACK_DAMAGE_FACTOR_MEDIUM = ConvertUnitWeaponRealField('uhd1')
UNIT_WEAPON_RF_ATTACK_DAMAGE_FACTOR_SMALL = ConvertUnitWeaponRealField('uqd1')
UNIT_WEAPON_RF_ATTACK_DAMAGE_SPILL_DISTANCE = ConvertUnitWeaponRealField('usd1')
UNIT_WEAPON_RF_ATTACK_DAMAGE_SPILL_RADIUS = ConvertUnitWeaponRealField('usr1')
UNIT_WEAPON_RF_ATTACK_PROJECTILE_SPEED = ConvertUnitWeaponRealField('ua1z')
UNIT_WEAPON_RF_ATTACK_PROJECTILE_ARC = ConvertUnitWeaponRealField('uma1')
UNIT_WEAPON_RF_ATTACK_AREA_OF_EFFECT_FULL_DAMAGE = ConvertUnitWeaponRealField('ua1f')
UNIT_WEAPON_RF_ATTACK_AREA_OF_EFFECT_MEDIUM_DAMAGE = ConvertUnitWeaponRealField('ua1h')
UNIT_WEAPON_RF_ATTACK_AREA_OF_EFFECT_SMALL_DAMAGE = ConvertUnitWeaponRealField('ua1q')
UNIT_WEAPON_RF_ATTACK_RANGE = ConvertUnitWeaponRealField('ua1r')
UNIT_WEAPON_BF_ATTACK_SHOW_UI = ConvertUnitWeaponBooleanField('uwu1')
UNIT_WEAPON_BF_ATTACKS_ENABLED = ConvertUnitWeaponBooleanField('uaen')
UNIT_WEAPON_BF_ATTACK_PROJECTILE_HOMING_ENABLED = ConvertUnitWeaponBooleanField('umh1')
UNIT_WEAPON_SF_ATTACK_PROJECTILE_ART = ConvertUnitWeaponStringField('ua1m')
MOVE_TYPE_UNKNOWN = ConvertMoveType(0)
MOVE_TYPE_FOOT = ConvertMoveType(1)
MOVE_TYPE_FLY = ConvertMoveType(2)
MOVE_TYPE_HORSE = ConvertMoveType(4)
MOVE_TYPE_HOVER = ConvertMoveType(8)
MOVE_TYPE_FLOAT = ConvertMoveType(16)
MOVE_TYPE_AMPHIBIOUS = ConvertMoveType(32)
MOVE_TYPE_UNBUILDABLE = ConvertMoveType(64)
TARGET_FLAG_NONE = ConvertTargetFlag(1)
TARGET_FLAG_GROUND = ConvertTargetFlag(2)
TARGET_FLAG_AIR = ConvertTargetFlag(4)
TARGET_FLAG_STRUCTURE = ConvertTargetFlag(8)
TARGET_FLAG_WARD = ConvertTargetFlag(16)
TARGET_FLAG_ITEM = ConvertTargetFlag(32)
TARGET_FLAG_TREE = ConvertTargetFlag(64)
TARGET_FLAG_WALL = ConvertTargetFlag(128)
TARGET_FLAG_DEBRIS = ConvertTargetFlag(256)
TARGET_FLAG_DECORATION = ConvertTargetFlag(512)
TARGET_FLAG_BRIDGE = ConvertTargetFlag(1024)
DEFENSE_TYPE_LIGHT = ConvertDefenseType(0)
DEFENSE_TYPE_MEDIUM = ConvertDefenseType(1)
DEFENSE_TYPE_LARGE = ConvertDefenseType(2)
DEFENSE_TYPE_FORT = ConvertDefenseType(3)
DEFENSE_TYPE_NORMAL = ConvertDefenseType(4)
DEFENSE_TYPE_HERO = ConvertDefenseType(5)
DEFENSE_TYPE_DIVINE = ConvertDefenseType(6)
DEFENSE_TYPE_NONE = ConvertDefenseType(7)
HERO_ATTRIBUTE_STR = ConvertHeroAttribute(1)
HERO_ATTRIBUTE_INT = ConvertHeroAttribute(2)
HERO_ATTRIBUTE_AGI = ConvertHeroAttribute(3)
ARMOR_TYPE_WHOKNOWS = ConvertArmorType(0)
ARMOR_TYPE_FLESH = ConvertArmorType(1)
ARMOR_TYPE_METAL = ConvertArmorType(2)
ARMOR_TYPE_WOOD = ConvertArmorType(3)
ARMOR_TYPE_ETHREAL = ConvertArmorType(4)
ARMOR_TYPE_STONE = ConvertArmorType(5)
REGENERATION_TYPE_NONE = ConvertRegenType(0)
REGENERATION_TYPE_ALWAYS = ConvertRegenType(1)
REGENERATION_TYPE_BLIGHT = ConvertRegenType(2)
REGENERATION_TYPE_DAY = ConvertRegenType(3)
REGENERATION_TYPE_NIGHT = ConvertRegenType(4)
UNIT_CATEGORY_GIANT = ConvertUnitCategory(1)
UNIT_CATEGORY_UNDEAD = ConvertUnitCategory(2)
UNIT_CATEGORY_SUMMONED = ConvertUnitCategory(4)
UNIT_CATEGORY_MECHANICAL = ConvertUnitCategory(8)
UNIT_CATEGORY_PEON = ConvertUnitCategory(16)
UNIT_CATEGORY_SAPPER = ConvertUnitCategory(32)
UNIT_CATEGORY_TOWNHALL = ConvertUnitCategory(64)
UNIT_CATEGORY_ANCIENT = ConvertUnitCategory(128)
UNIT_CATEGORY_NEUTRAL = ConvertUnitCategory(256)
UNIT_CATEGORY_WARD = ConvertUnitCategory(512)
UNIT_CATEGORY_STANDON = ConvertUnitCategory(1024)
UNIT_CATEGORY_TAUREN = ConvertUnitCategory(2048)
PATHING_FLAG_UNWALKABLE = ConvertPathingFlag(2)
PATHING_FLAG_UNFLYABLE = ConvertPathingFlag(4)
PATHING_FLAG_UNBUILDABLE = ConvertPathingFlag(8)
PATHING_FLAG_UNPEONHARVEST = ConvertPathingFlag(16)
PATHING_FLAG_BLIGHTED = ConvertPathingFlag(32)
PATHING_FLAG_UNFLOATABLE = ConvertPathingFlag(64)
PATHING_FLAG_UNAMPHIBIOUS = ConvertPathingFlag(128)
PATHING_FLAG_UNITEMPLACABLE = ConvertPathingFlag(256)
function Deg2Rad(degrees) end
function Rad2Deg(radians) end
function Sin(radians) end
function Cos(radians) end
function Tan(radians) end
function Asin(y) end
function Acos(x) end
function Atan(x) end
function Atan2(y, x) end
function SquareRoot(x) end
function Pow(x, power) end
function I2R(i) end
function R2I(r) end
function I2S(i) end
function R2S(r) end
function R2SW(r, width, precision) end
function S2I(s) end
function S2R(s) end
function GetHandleId(h) end
function SubString(source, startPos, endPos) end
function StringLength(s) end
function StringCase(source, upper) end
function StringHash(s) end
function GetLocalizedString(source) end
function GetLocalizedHotkey(source) end
function SetMapName(name) end
function SetMapDescription(description) end
function SetTeams(teamcount) end
function SetPlayers(playercount) end
function DefineStartLocation(whichStartLoc, x, y) end
function DefineStartLocationLoc(whichStartLoc, whichLocation) end
function SetStartLocPrioCount(whichStartLoc, prioSlotCount) end
function SetStartLocPrio(whichStartLoc, prioSlotIndex, otherStartLocIndex, priority) end
function GetStartLocPrioSlot(whichStartLoc, prioSlotIndex) end
function GetStartLocPrio(whichStartLoc, prioSlotIndex) end
function SetGameTypeSupported(whichGameType, value) end
function SetMapFlag(whichMapFlag, value) end
function SetGamePlacement(whichPlacementType) end
function SetGameSpeed(whichspeed) end
function SetGameDifficulty(whichdifficulty) end
function SetResourceDensity(whichdensity) end
function SetCreatureDensity(whichdensity) end
function GetTeams() end
function GetPlayers() end
function IsGameTypeSupported(whichGameType) end
function GetGameTypeSelected() end
function IsMapFlagSet(whichMapFlag) end
function GetGamePlacement() end
function GetGameSpeed() end
function GetGameDifficulty() end
function GetResourceDensity() end
function GetCreatureDensity() end
function GetStartLocationX(whichStartLocation) end
function GetStartLocationY(whichStartLocation) end
function GetStartLocationLoc(whichStartLocation) end
function SetPlayerTeam(whichPlayer, whichTeam) end
function SetPlayerStartLocation(whichPlayer, startLocIndex) end
function ForcePlayerStartLocation(whichPlayer, startLocIndex) end
function SetPlayerColor(whichPlayer, color) end
function SetPlayerAlliance(sourcePlayer, otherPlayer, whichAllianceSetting, value) end
function SetPlayerTaxRate(sourcePlayer, otherPlayer, whichResource, rate) end
function SetPlayerRacePreference(whichPlayer, whichRacePreference) end
function SetPlayerRaceSelectable(whichPlayer, value) end
function SetPlayerController(whichPlayer, controlType) end
function SetPlayerName(whichPlayer, name) end
function SetPlayerOnScoreScreen(whichPlayer, flag) end
function GetPlayerTeam(whichPlayer) end
function GetPlayerStartLocation(whichPlayer) end
function GetPlayerColor(whichPlayer) end
function GetPlayerSelectable(whichPlayer) end
function GetPlayerController(whichPlayer) end
function GetPlayerSlotState(whichPlayer) end
function GetPlayerTaxRate(sourcePlayer, otherPlayer, whichResource) end
function IsPlayerRacePrefSet(whichPlayer, pref) end
function GetPlayerName(whichPlayer) end
function CreateTimer() end
function DestroyTimer(whichTimer) end
function TimerStart(whichTimer, timeout, periodic, handlerFunc) end
function TimerGetElapsed(whichTimer) end
function TimerGetRemaining(whichTimer) end
function TimerGetTimeout(whichTimer) end
function PauseTimer(whichTimer) end
function ResumeTimer(whichTimer) end
function GetExpiredTimer() end
function CreateGroup() end
function DestroyGroup(whichGroup) end
function GroupAddUnit(whichGroup, whichUnit) end
function GroupRemoveUnit(whichGroup, whichUnit) end
function BlzGroupAddGroupFast(whichGroup, addGroup) end
function BlzGroupRemoveGroupFast(whichGroup, removeGroup) end
function GroupClear(whichGroup) end
function BlzGroupGetSize(whichGroup) end
function BlzGroupUnitAt(whichGroup, index) end
function GroupEnumUnitsOfType(whichGroup, unitname, filter) end
function GroupEnumUnitsOfPlayer(whichGroup, whichPlayer, filter) end
function GroupEnumUnitsOfTypeCounted(whichGroup, unitname, filter, countLimit) end
function GroupEnumUnitsInRect(whichGroup, r, filter) end
function GroupEnumUnitsInRectCounted(whichGroup, r, filter, countLimit) end
function GroupEnumUnitsInRange(whichGroup, x, y, radius, filter) end
function GroupEnumUnitsInRangeOfLoc(whichGroup, whichLocation, radius, filter) end
function GroupEnumUnitsInRangeCounted(whichGroup, x, y, radius, filter, countLimit) end
function GroupEnumUnitsInRangeOfLocCounted(whichGroup, whichLocation, radius, filter, countLimit) end
function GroupEnumUnitsSelected(whichGroup, whichPlayer, filter) end
function GroupImmediateOrder(whichGroup, order) end
function GroupImmediateOrderById(whichGroup, order) end
function GroupPointOrder(whichGroup, order, x, y) end
function GroupPointOrderLoc(whichGroup, order, whichLocation) end
function GroupPointOrderById(whichGroup, order, x, y) end
function GroupPointOrderByIdLoc(whichGroup, order, whichLocation) end
function GroupTargetOrder(whichGroup, order, targetWidget) end
function GroupTargetOrderById(whichGroup, order, targetWidget) end
function ForGroup(whichGroup, callback) end
function FirstOfGroup(whichGroup) end
function CreateForce() end
function DestroyForce(whichForce) end
function ForceAddPlayer(whichForce, whichPlayer) end
function ForceRemovePlayer(whichForce, whichPlayer) end
function BlzForceHasPlayer(whichForce, whichPlayer) end
function ForceClear(whichForce) end
function ForceEnumPlayers(whichForce, filter) end
function ForceEnumPlayersCounted(whichForce, filter, countLimit) end
function ForceEnumAllies(whichForce, whichPlayer, filter) end
function ForceEnumEnemies(whichForce, whichPlayer, filter) end
function ForForce(whichForce, callback) end
function Rect(minx, miny, maxx, maxy) end
function RectFromLoc(min, max) end
function RemoveRect(whichRect) end
function SetRect(whichRect, minx, miny, maxx, maxy) end
function SetRectFromLoc(whichRect, min, max) end
function MoveRectTo(whichRect, newCenterX, newCenterY) end
function MoveRectToLoc(whichRect, newCenterLoc) end
function GetRectCenterX(whichRect) end
function GetRectCenterY(whichRect) end
function GetRectMinX(whichRect) end
function GetRectMinY(whichRect) end
function GetRectMaxX(whichRect) end
function GetRectMaxY(whichRect) end
function CreateRegion() end
function RemoveRegion(whichRegion) end
function RegionAddRect(whichRegion, r) end
function RegionClearRect(whichRegion, r) end
function RegionAddCell(whichRegion, x, y) end
function RegionAddCellAtLoc(whichRegion, whichLocation) end
function RegionClearCell(whichRegion, x, y) end
function RegionClearCellAtLoc(whichRegion, whichLocation) end
function Location(x, y) end
function RemoveLocation(whichLocation) end
function MoveLocation(whichLocation, newX, newY) end
function GetLocationX(whichLocation) end
function GetLocationY(whichLocation) end
function GetLocationZ(whichLocation) end
function IsUnitInRegion(whichRegion, whichUnit) end
function IsPointInRegion(whichRegion, x, y) end
function IsLocationInRegion(whichRegion, whichLocation) end
function GetWorldBounds() end
function CreateTrigger() end
function DestroyTrigger(whichTrigger) end
function ResetTrigger(whichTrigger) end
function EnableTrigger(whichTrigger) end
function DisableTrigger(whichTrigger) end
function IsTriggerEnabled(whichTrigger) end
function TriggerWaitOnSleeps(whichTrigger, flag) end
function IsTriggerWaitOnSleeps(whichTrigger) end
function GetFilterUnit() end
function GetEnumUnit() end
function GetFilterDestructable() end
function GetEnumDestructable() end
function GetFilterItem() end
function GetEnumItem() end
function GetFilterPlayer() end
function GetEnumPlayer() end
function GetTriggeringTrigger() end
function GetTriggerEventId() end
function GetTriggerEvalCount(whichTrigger) end
function GetTriggerExecCount(whichTrigger) end
function ExecuteFunc(funcName) end
function And(operandA, operandB) end
function Or(operandA, operandB) end
function Not(operand) end
function Condition(func) end
function DestroyCondition(c) end
function Filter(func) end
function DestroyFilter(f) end
function DestroyBoolExpr(e) end
function TriggerRegisterVariableEvent(whichTrigger, varName, opcode, limitval) end
function TriggerRegisterTimerEvent(whichTrigger, timeout, periodic) end
function TriggerRegisterTimerExpireEvent(whichTrigger, t) end
function TriggerRegisterGameStateEvent(whichTrigger, whichState, opcode, limitval) end
function TriggerRegisterDialogEvent(whichTrigger, whichDialog) end
function TriggerRegisterDialogButtonEvent(whichTrigger, whichButton) end
function GetEventGameState() end
function TriggerRegisterGameEvent(whichTrigger, whichGameEvent) end
function GetWinningPlayer() end
function TriggerRegisterEnterRegion(whichTrigger, whichRegion, filter) end
function GetTriggeringRegion() end
function GetEnteringUnit() end
function TriggerRegisterLeaveRegion(whichTrigger, whichRegion, filter) end
function GetLeavingUnit() end
function TriggerRegisterTrackableHitEvent(whichTrigger, t) end
function TriggerRegisterTrackableTrackEvent(whichTrigger, t) end
function GetTriggeringTrackable() end
function GetClickedButton() end
function GetClickedDialog() end
function GetTournamentFinishSoonTimeRemaining() end
function GetTournamentFinishNowRule() end
function GetTournamentFinishNowPlayer() end
function GetTournamentScore(whichPlayer) end
function GetSaveBasicFilename() end
function TriggerRegisterPlayerEvent(whichTrigger, whichPlayer, whichPlayerEvent) end
function GetTriggerPlayer() end
function TriggerRegisterPlayerUnitEvent(whichTrigger, whichPlayer, whichPlayerUnitEvent, filter) end
function GetLevelingUnit() end
function GetLearningUnit() end
function GetLearnedSkill() end
function GetLearnedSkillLevel() end
function GetRevivableUnit() end
function GetRevivingUnit() end
function GetAttacker() end
function GetRescuer() end
function GetDyingUnit() end
function GetKillingUnit() end
function GetDecayingUnit() end
function GetConstructingStructure() end
function GetCancelledStructure() end
function GetConstructedStructure() end
function GetResearchingUnit() end
function GetResearched() end
function GetTrainedUnitType() end
function GetTrainedUnit() end
function GetDetectedUnit() end
function GetSummoningUnit() end
function GetSummonedUnit() end
function GetTransportUnit() end
function GetLoadedUnit() end
function GetSellingUnit() end
function GetSoldUnit() end
function GetBuyingUnit() end
function GetSoldItem() end
function GetChangingUnit() end
function GetChangingUnitPrevOwner() end
function GetManipulatingUnit() end
function GetManipulatedItem() end
function GetOrderedUnit() end
function GetIssuedOrderId() end
function GetOrderPointX() end
function GetOrderPointY() end
function GetOrderPointLoc() end
function GetOrderTarget() end
function GetOrderTargetDestructable() end
function GetOrderTargetItem() end
function GetOrderTargetUnit() end
function GetSpellAbilityUnit() end
function GetSpellAbilityId() end
function GetSpellAbility() end
function GetSpellTargetLoc() end
function GetSpellTargetX() end
function GetSpellTargetY() end
function GetSpellTargetDestructable() end
function GetSpellTargetItem() end
function GetSpellTargetUnit() end
function TriggerRegisterPlayerAllianceChange(whichTrigger, whichPlayer, whichAlliance) end
function TriggerRegisterPlayerStateEvent(whichTrigger, whichPlayer, whichState, opcode, limitval) end
function GetEventPlayerState() end
function TriggerRegisterPlayerChatEvent(whichTrigger, whichPlayer, chatMessageToDetect, exactMatchOnly) end
function GetEventPlayerChatString() end
function GetEventPlayerChatStringMatched() end
function TriggerRegisterDeathEvent(whichTrigger, whichWidget) end
function GetTriggerUnit() end
function TriggerRegisterUnitStateEvent(whichTrigger, whichUnit, whichState, opcode, limitval) end
function GetEventUnitState() end
function TriggerRegisterUnitEvent(whichTrigger, whichUnit, whichEvent) end
function GetEventDamage() end
function GetEventDamageSource() end
function GetEventDetectingPlayer() end
function TriggerRegisterFilterUnitEvent(whichTrigger, whichUnit, whichEvent, filter) end
function GetEventTargetUnit() end
function TriggerRegisterUnitInRange(whichTrigger, whichUnit, range, filter) end
function TriggerAddCondition(whichTrigger, condition) end
function TriggerRemoveCondition(whichTrigger, whichCondition) end
function TriggerClearConditions(whichTrigger) end
function TriggerAddAction(whichTrigger, actionFunc) end
function TriggerRemoveAction(whichTrigger, whichAction) end
function TriggerClearActions(whichTrigger) end
function TriggerSleepAction(timeout) end
function TriggerWaitForSound(s, offset) end
function TriggerEvaluate(whichTrigger) end
function TriggerExecute(whichTrigger) end
function TriggerExecuteWait(whichTrigger) end
function TriggerSyncStart() end
function TriggerSyncReady() end
function GetWidgetLife(whichWidget) end
function SetWidgetLife(whichWidget, newLife) end
function GetWidgetX(whichWidget) end
function GetWidgetY(whichWidget) end
function GetTriggerWidget() end
function CreateDestructable(objectid, x, y, face, scale, variation) end
function CreateDestructableZ(objectid, x, y, z, face, scale, variation) end
function CreateDeadDestructable(objectid, x, y, face, scale, variation) end
function CreateDeadDestructableZ(objectid, x, y, z, face, scale, variation) end
function RemoveDestructable(d) end
function KillDestructable(d) end
function SetDestructableInvulnerable(d, flag) end
function IsDestructableInvulnerable(d) end
function EnumDestructablesInRect(r, filter, actionFunc) end
function GetDestructableTypeId(d) end
function GetDestructableX(d) end
function GetDestructableY(d) end
function SetDestructableLife(d, life) end
function GetDestructableLife(d) end
function SetDestructableMaxLife(d, max) end
function GetDestructableMaxLife(d) end
function DestructableRestoreLife(d, life, birth) end
function QueueDestructableAnimation(d, whichAnimation) end
function SetDestructableAnimation(d, whichAnimation) end
function SetDestructableAnimationSpeed(d, speedFactor) end
function ShowDestructable(d, flag) end
function GetDestructableOccluderHeight(d) end
function SetDestructableOccluderHeight(d, height) end
function GetDestructableName(d) end
function GetTriggerDestructable() end
function CreateItem(itemid, x, y) end
function RemoveItem(whichItem) end
function GetItemPlayer(whichItem) end
function GetItemTypeId(i) end
function GetItemX(i) end
function GetItemY(i) end
function SetItemPosition(i, x, y) end
function SetItemDropOnDeath(whichItem, flag) end
function SetItemDroppable(i, flag) end
function SetItemPawnable(i, flag) end
function SetItemPlayer(whichItem, whichPlayer, changeColor) end
function SetItemInvulnerable(whichItem, flag) end
function IsItemInvulnerable(whichItem) end
function SetItemVisible(whichItem, show) end
function IsItemVisible(whichItem) end
function IsItemOwned(whichItem) end
function IsItemPowerup(whichItem) end
function IsItemSellable(whichItem) end
function IsItemPawnable(whichItem) end
function IsItemIdPowerup(itemId) end
function IsItemIdSellable(itemId) end
function IsItemIdPawnable(itemId) end
function EnumItemsInRect(r, filter, actionFunc) end
function GetItemLevel(whichItem) end
function GetItemType(whichItem) end
function SetItemDropID(whichItem, unitId) end
function GetItemName(whichItem) end
function GetItemCharges(whichItem) end
function SetItemCharges(whichItem, charges) end
function GetItemUserData(whichItem) end
function SetItemUserData(whichItem, data) end
function CreateUnit(id, unitid, x, y, face) end
function CreateUnitByName(whichPlayer, unitname, x, y, face) end
function CreateUnitAtLoc(id, unitid, whichLocation, face) end
function CreateUnitAtLocByName(id, unitname, whichLocation, face) end
function CreateCorpse(whichPlayer, unitid, x, y, face) end
function KillUnit(whichUnit) end
function RemoveUnit(whichUnit) end
function ShowUnit(whichUnit, show) end
function SetUnitState(whichUnit, whichUnitState, newVal) end
function SetUnitX(whichUnit, newX) end
function SetUnitY(whichUnit, newY) end
function SetUnitPosition(whichUnit, newX, newY) end
function SetUnitPositionLoc(whichUnit, whichLocation) end
function SetUnitFacing(whichUnit, facingAngle) end
function SetUnitFacingTimed(whichUnit, facingAngle, duration) end
function SetUnitMoveSpeed(whichUnit, newSpeed) end
function SetUnitFlyHeight(whichUnit, newHeight, rate) end
function SetUnitTurnSpeed(whichUnit, newTurnSpeed) end
function SetUnitPropWindow(whichUnit, newPropWindowAngle) end
function SetUnitAcquireRange(whichUnit, newAcquireRange) end
function SetUnitCreepGuard(whichUnit, creepGuard) end
function GetUnitAcquireRange(whichUnit) end
function GetUnitTurnSpeed(whichUnit) end
function GetUnitPropWindow(whichUnit) end
function GetUnitFlyHeight(whichUnit) end
function GetUnitDefaultAcquireRange(whichUnit) end
function GetUnitDefaultTurnSpeed(whichUnit) end
function GetUnitDefaultPropWindow(whichUnit) end
function GetUnitDefaultFlyHeight(whichUnit) end
function SetUnitOwner(whichUnit, whichPlayer, changeColor) end
function SetUnitColor(whichUnit, whichColor) end
function SetUnitScale(whichUnit, scaleX, scaleY, scaleZ) end
function SetUnitTimeScale(whichUnit, timeScale) end
function SetUnitBlendTime(whichUnit, blendTime) end
function SetUnitVertexColor(whichUnit, red, green, blue, alpha) end
function QueueUnitAnimation(whichUnit, whichAnimation) end
function SetUnitAnimation(whichUnit, whichAnimation) end
function SetUnitAnimationByIndex(whichUnit, whichAnimation) end
function SetUnitAnimationWithRarity(whichUnit, whichAnimation, rarity) end
function AddUnitAnimationProperties(whichUnit, animProperties, add) end
function SetUnitLookAt(whichUnit, whichBone, lookAtTarget, offsetX, offsetY, offsetZ) end
function ResetUnitLookAt(whichUnit) end
function SetUnitRescuable(whichUnit, byWhichPlayer, flag) end
function SetUnitRescueRange(whichUnit, range) end
function SetHeroStr(whichHero, newStr, permanent) end
function SetHeroAgi(whichHero, newAgi, permanent) end
function SetHeroInt(whichHero, newInt, permanent) end
function GetHeroStr(whichHero, includeBonuses) end
function GetHeroAgi(whichHero, includeBonuses) end
function GetHeroInt(whichHero, includeBonuses) end
function UnitStripHeroLevel(whichHero, howManyLevels) end
function GetHeroXP(whichHero) end
function SetHeroXP(whichHero, newXpVal, showEyeCandy) end
function GetHeroSkillPoints(whichHero) end
function UnitModifySkillPoints(whichHero, skillPointDelta) end
function AddHeroXP(whichHero, xpToAdd, showEyeCandy) end
function SetHeroLevel(whichHero, level, showEyeCandy) end
function GetHeroLevel(whichHero) end
function GetUnitLevel(whichUnit) end
function GetHeroProperName(whichHero) end
function SuspendHeroXP(whichHero, flag) end
function IsSuspendedXP(whichHero) end
function SelectHeroSkill(whichHero, abilcode) end
function GetUnitAbilityLevel(whichUnit, abilcode) end
function DecUnitAbilityLevel(whichUnit, abilcode) end
function IncUnitAbilityLevel(whichUnit, abilcode) end
function SetUnitAbilityLevel(whichUnit, abilcode, level) end
function ReviveHero(whichHero, x, y, doEyecandy) end
function ReviveHeroLoc(whichHero, loc, doEyecandy) end
function SetUnitExploded(whichUnit, exploded) end
function SetUnitInvulnerable(whichUnit, flag) end
function PauseUnit(whichUnit, flag) end
function IsUnitPaused(whichHero) end
function SetUnitPathing(whichUnit, flag) end
function ClearSelection() end
function SelectUnit(whichUnit, flag) end
function GetUnitPointValue(whichUnit) end
function GetUnitPointValueByType(unitType) end
function UnitAddItem(whichUnit, whichItem) end
function UnitAddItemById(whichUnit, itemId) end
function UnitAddItemToSlotById(whichUnit, itemId, itemSlot) end
function UnitRemoveItem(whichUnit, whichItem) end
function UnitRemoveItemFromSlot(whichUnit, itemSlot) end
function UnitHasItem(whichUnit, whichItem) end
function UnitItemInSlot(whichUnit, itemSlot) end
function UnitInventorySize(whichUnit) end
function UnitDropItemPoint(whichUnit, whichItem, x, y) end
function UnitDropItemSlot(whichUnit, whichItem, slot) end
function UnitDropItemTarget(whichUnit, whichItem, target) end
function UnitUseItem(whichUnit, whichItem) end
function UnitUseItemPoint(whichUnit, whichItem, x, y) end
function UnitUseItemTarget(whichUnit, whichItem, target) end
function GetUnitX(whichUnit) end
function GetUnitY(whichUnit) end
function GetUnitLoc(whichUnit) end
function GetUnitFacing(whichUnit) end
function GetUnitMoveSpeed(whichUnit) end
function GetUnitDefaultMoveSpeed(whichUnit) end
function GetUnitState(whichUnit, whichUnitState) end
function GetOwningPlayer(whichUnit) end
function GetUnitTypeId(whichUnit) end
function GetUnitRace(whichUnit) end
function GetUnitName(whichUnit) end
function GetUnitFoodUsed(whichUnit) end
function GetUnitFoodMade(whichUnit) end
function GetFoodMade(unitId) end
function GetFoodUsed(unitId) end
function SetUnitUseFood(whichUnit, useFood) end
function GetUnitRallyPoint(whichUnit) end
function GetUnitRallyUnit(whichUnit) end
function GetUnitRallyDestructable(whichUnit) end
function IsUnitInGroup(whichUnit, whichGroup) end
function IsUnitInForce(whichUnit, whichForce) end
function IsUnitOwnedByPlayer(whichUnit, whichPlayer) end
function IsUnitAlly(whichUnit, whichPlayer) end
function IsUnitEnemy(whichUnit, whichPlayer) end
function IsUnitVisible(whichUnit, whichPlayer) end
function IsUnitDetected(whichUnit, whichPlayer) end
function IsUnitInvisible(whichUnit, whichPlayer) end
function IsUnitFogged(whichUnit, whichPlayer) end
function IsUnitMasked(whichUnit, whichPlayer) end
function IsUnitSelected(whichUnit, whichPlayer) end
function IsUnitRace(whichUnit, whichRace) end
function IsUnitType(whichUnit, whichUnitType) end
function IsUnit(whichUnit, whichSpecifiedUnit) end
function IsUnitInRange(whichUnit, otherUnit, distance) end
function IsUnitInRangeXY(whichUnit, x, y, distance) end
function IsUnitInRangeLoc(whichUnit, whichLocation, distance) end
function IsUnitHidden(whichUnit) end
function IsUnitIllusion(whichUnit) end
function IsUnitInTransport(whichUnit, whichTransport) end
function IsUnitLoaded(whichUnit) end
function IsHeroUnitId(unitId) end
function IsUnitIdType(unitId, whichUnitType) end
function UnitShareVision(whichUnit, whichPlayer, share) end
function UnitSuspendDecay(whichUnit, suspend) end
function UnitAddType(whichUnit, whichUnitType) end
function UnitRemoveType(whichUnit, whichUnitType) end
function UnitAddAbility(whichUnit, abilityId) end
function UnitRemoveAbility(whichUnit, abilityId) end
function UnitMakeAbilityPermanent(whichUnit, permanent, abilityId) end
function UnitRemoveBuffs(whichUnit, removePositive, removeNegative) end
function UnitRemoveBuffsEx(whichUnit, removePositive, removeNegative, magic, physical, timedLife, aura, autoDispel) end
function UnitHasBuffsEx(whichUnit, removePositive, removeNegative, magic, physical, timedLife, aura, autoDispel) end
function UnitCountBuffsEx(whichUnit, removePositive, removeNegative, magic, physical, timedLife, aura, autoDispel) end
function UnitAddSleep(whichUnit, add) end
function UnitCanSleep(whichUnit) end
function UnitAddSleepPerm(whichUnit, add) end
function UnitCanSleepPerm(whichUnit) end
function UnitIsSleeping(whichUnit) end
function UnitWakeUp(whichUnit) end
function UnitApplyTimedLife(whichUnit, buffId, duration) end
function UnitIgnoreAlarm(whichUnit, flag) end
function UnitIgnoreAlarmToggled(whichUnit) end
function UnitResetCooldown(whichUnit) end
function UnitSetConstructionProgress(whichUnit, constructionPercentage) end
function UnitSetUpgradeProgress(whichUnit, upgradePercentage) end
function UnitPauseTimedLife(whichUnit, flag) end
function UnitSetUsesAltIcon(whichUnit, flag) end
function UnitDamagePoint(whichUnit, delay, radius, x, y, amount, attack, ranged, attackType, damageType, weaponType) end
function UnitDamageTarget(whichUnit, target, amount, attack, ranged, attackType, damageType, weaponType) end
function IssueImmediateOrder(whichUnit, order) end
function IssueImmediateOrderById(whichUnit, order) end
function IssuePointOrder(whichUnit, order, x, y) end
function IssuePointOrderLoc(whichUnit, order, whichLocation) end
function IssuePointOrderById(whichUnit, order, x, y) end
function IssuePointOrderByIdLoc(whichUnit, order, whichLocation) end
function IssueTargetOrder(whichUnit, order, targetWidget) end
function IssueTargetOrderById(whichUnit, order, targetWidget) end
function IssueInstantPointOrder(whichUnit, order, x, y, instantTargetWidget) end
function IssueInstantPointOrderById(whichUnit, order, x, y, instantTargetWidget) end
function IssueInstantTargetOrder(whichUnit, order, targetWidget, instantTargetWidget) end
function IssueInstantTargetOrderById(whichUnit, order, targetWidget, instantTargetWidget) end
function IssueBuildOrder(whichPeon, unitToBuild, x, y) end
function IssueBuildOrderById(whichPeon, unitId, x, y) end
function IssueNeutralImmediateOrder(forWhichPlayer, neutralStructure, unitToBuild) end
function IssueNeutralImmediateOrderById(forWhichPlayer, neutralStructure, unitId) end
function IssueNeutralPointOrder(forWhichPlayer, neutralStructure, unitToBuild, x, y) end
function IssueNeutralPointOrderById(forWhichPlayer, neutralStructure, unitId, x, y) end
function IssueNeutralTargetOrder(forWhichPlayer, neutralStructure, unitToBuild, target) end
function IssueNeutralTargetOrderById(forWhichPlayer, neutralStructure, unitId, target) end
function GetUnitCurrentOrder(whichUnit) end
function SetResourceAmount(whichUnit, amount) end
function AddResourceAmount(whichUnit, amount) end
function GetResourceAmount(whichUnit) end
function WaygateGetDestinationX(waygate) end
function WaygateGetDestinationY(waygate) end
function WaygateSetDestination(waygate, x, y) end
function WaygateActivate(waygate, activate) end
function WaygateIsActive(waygate) end
function AddItemToAllStock(itemId, currentStock, stockMax) end
function AddItemToStock(whichUnit, itemId, currentStock, stockMax) end
function AddUnitToAllStock(unitId, currentStock, stockMax) end
function AddUnitToStock(whichUnit, unitId, currentStock, stockMax) end
function RemoveItemFromAllStock(itemId) end
function RemoveItemFromStock(whichUnit, itemId) end
function RemoveUnitFromAllStock(unitId) end
function RemoveUnitFromStock(whichUnit, unitId) end
function SetAllItemTypeSlots(slots) end
function SetAllUnitTypeSlots(slots) end
function SetItemTypeSlots(whichUnit, slots) end
function SetUnitTypeSlots(whichUnit, slots) end
function GetUnitUserData(whichUnit) end
function SetUnitUserData(whichUnit, data) end
function Player(number) end
function GetLocalPlayer() end
function IsPlayerAlly(whichPlayer, otherPlayer) end
function IsPlayerEnemy(whichPlayer, otherPlayer) end
function IsPlayerInForce(whichPlayer, whichForce) end
function IsPlayerObserver(whichPlayer) end
function IsVisibleToPlayer(x, y, whichPlayer) end
function IsLocationVisibleToPlayer(whichLocation, whichPlayer) end
function IsFoggedToPlayer(x, y, whichPlayer) end
function IsLocationFoggedToPlayer(whichLocation, whichPlayer) end
function IsMaskedToPlayer(x, y, whichPlayer) end
function IsLocationMaskedToPlayer(whichLocation, whichPlayer) end
function GetPlayerRace(whichPlayer) end
function GetPlayerId(whichPlayer) end
function GetPlayerUnitCount(whichPlayer, includeIncomplete) end
function GetPlayerTypedUnitCount(whichPlayer, unitName, includeIncomplete, includeUpgrades) end
function GetPlayerStructureCount(whichPlayer, includeIncomplete) end
function GetPlayerState(whichPlayer, whichPlayerState) end
function GetPlayerScore(whichPlayer, whichPlayerScore) end
function GetPlayerAlliance(sourcePlayer, otherPlayer, whichAllianceSetting) end
function GetPlayerHandicap(whichPlayer) end
function GetPlayerHandicapXP(whichPlayer) end
function SetPlayerHandicap(whichPlayer, handicap) end
function SetPlayerHandicapXP(whichPlayer, handicap) end
function SetPlayerTechMaxAllowed(whichPlayer, techid, maximum) end
function GetPlayerTechMaxAllowed(whichPlayer, techid) end
function AddPlayerTechResearched(whichPlayer, techid, levels) end
function SetPlayerTechResearched(whichPlayer, techid, setToLevel) end
function GetPlayerTechResearched(whichPlayer, techid, specificonly) end
function GetPlayerTechCount(whichPlayer, techid, specificonly) end
function SetPlayerUnitsOwner(whichPlayer, newOwner) end
function CripplePlayer(whichPlayer, toWhichPlayers, flag) end
function SetPlayerAbilityAvailable(whichPlayer, abilid, avail) end
function SetPlayerState(whichPlayer, whichPlayerState, value) end
function RemovePlayer(whichPlayer, gameResult) end
function CachePlayerHeroData(whichPlayer) end
function SetFogStateRect(forWhichPlayer, whichState, where, useSharedVision) end
function SetFogStateRadius(forWhichPlayer, whichState, centerx, centerY, radius, useSharedVision) end
function SetFogStateRadiusLoc(forWhichPlayer, whichState, center, radius, useSharedVision) end
function FogMaskEnable(enable) end
function IsFogMaskEnabled() end
function FogEnable(enable) end
function IsFogEnabled() end
function CreateFogModifierRect(forWhichPlayer, whichState, where, useSharedVision, afterUnits) end
function CreateFogModifierRadius(forWhichPlayer, whichState, centerx, centerY, radius, useSharedVision, afterUnits) end
function CreateFogModifierRadiusLoc(forWhichPlayer, whichState, center, radius, useSharedVision, afterUnits) end
function DestroyFogModifier(whichFogModifier) end
function FogModifierStart(whichFogModifier) end
function FogModifierStop(whichFogModifier) end
function VersionGet() end
function VersionCompatible(whichVersion) end
function VersionSupported(whichVersion) end
function EndGame(doScoreScreen) end
function ChangeLevel(newLevel, doScoreScreen) end
function RestartGame(doScoreScreen) end
function ReloadGame() end
function SetCampaignMenuRace(r) end
function SetCampaignMenuRaceEx(campaignIndex) end
function ForceCampaignSelectScreen() end
function LoadGame(saveFileName, doScoreScreen) end
function SaveGame(saveFileName) end
function RenameSaveDirectory(sourceDirName, destDirName) end
function RemoveSaveDirectory(sourceDirName) end
function CopySaveGame(sourceSaveName, destSaveName) end
function SaveGameExists(saveName) end
function SyncSelections() end
function SetFloatGameState(whichFloatGameState, value) end
function GetFloatGameState(whichFloatGameState) end
function SetIntegerGameState(whichIntegerGameState, value) end
function GetIntegerGameState(whichIntegerGameState) end
function SetTutorialCleared(cleared) end
function SetMissionAvailable(campaignNumber, missionNumber, available) end
function SetCampaignAvailable(campaignNumber, available) end
function SetOpCinematicAvailable(campaignNumber, available) end
function SetEdCinematicAvailable(campaignNumber, available) end
function GetDefaultDifficulty() end
function SetDefaultDifficulty(g) end
function SetCustomCampaignButtonVisible(whichButton, visible) end
function GetCustomCampaignButtonVisible(whichButton) end
function DoNotSaveReplay() end
function DialogCreate() end
function DialogDestroy(whichDialog) end
function DialogClear(whichDialog) end
function DialogSetMessage(whichDialog, messageText) end
function DialogAddButton(whichDialog, buttonText, hotkey) end
function DialogAddQuitButton(whichDialog, doScoreScreen, buttonText, hotkey) end
function DialogDisplay(whichPlayer, whichDialog, flag) end
function ReloadGameCachesFromDisk() end
function InitGameCache(campaignFile) end
function SaveGameCache(whichCache) end
function StoreInteger(cache, missionKey, key, value) end
function StoreReal(cache, missionKey, key, value) end
function StoreBoolean(cache, missionKey, key, value) end
function StoreUnit(cache, missionKey, key, whichUnit) end
function StoreString(cache, missionKey, key, value) end
function SyncStoredInteger(cache, missionKey, key) end
function SyncStoredReal(cache, missionKey, key) end
function SyncStoredBoolean(cache, missionKey, key) end
function SyncStoredUnit(cache, missionKey, key) end
function SyncStoredString(cache, missionKey, key) end
function HaveStoredInteger(cache, missionKey, key) end
function HaveStoredReal(cache, missionKey, key) end
function HaveStoredBoolean(cache, missionKey, key) end
function HaveStoredUnit(cache, missionKey, key) end
function HaveStoredString(cache, missionKey, key) end
function FlushGameCache(cache) end
function FlushStoredMission(cache, missionKey) end
function FlushStoredInteger(cache, missionKey, key) end
function FlushStoredReal(cache, missionKey, key) end
function FlushStoredBoolean(cache, missionKey, key) end
function FlushStoredUnit(cache, missionKey, key) end
function FlushStoredString(cache, missionKey, key) end
function GetStoredInteger(cache, missionKey, key) end
function GetStoredReal(cache, missionKey, key) end
function GetStoredBoolean(cache, missionKey, key) end
function GetStoredString(cache, missionKey, key) end
function RestoreUnit(cache, missionKey, key, forWhichPlayer, x, y, facing) end
function InitHashtable() end
function SaveInteger(table, parentKey, childKey, value) end
function SaveReal(table, parentKey, childKey, value) end
function SaveBoolean(table, parentKey, childKey, value) end
function SaveStr(table, parentKey, childKey, value) end
function SavePlayerHandle(table, parentKey, childKey, whichPlayer) end
function SaveWidgetHandle(table, parentKey, childKey, whichWidget) end
function SaveDestructableHandle(table, parentKey, childKey, whichDestructable) end
function SaveItemHandle(table, parentKey, childKey, whichItem) end
function SaveUnitHandle(table, parentKey, childKey, whichUnit) end
function SaveAbilityHandle(table, parentKey, childKey, whichAbility) end
function SaveTimerHandle(table, parentKey, childKey, whichTimer) end
function SaveTriggerHandle(table, parentKey, childKey, whichTrigger) end
function SaveTriggerConditionHandle(table, parentKey, childKey, whichTriggercondition) end
function SaveTriggerActionHandle(table, parentKey, childKey, whichTriggeraction) end
function SaveTriggerEventHandle(table, parentKey, childKey, whichEvent) end
function SaveForceHandle(table, parentKey, childKey, whichForce) end
function SaveGroupHandle(table, parentKey, childKey, whichGroup) end
function SaveLocationHandle(table, parentKey, childKey, whichLocation) end
function SaveRectHandle(table, parentKey, childKey, whichRect) end
function SaveBooleanExprHandle(table, parentKey, childKey, whichBoolexpr) end
function SaveSoundHandle(table, parentKey, childKey, whichSound) end
function SaveEffectHandle(table, parentKey, childKey, whichEffect) end
function SaveUnitPoolHandle(table, parentKey, childKey, whichUnitpool) end
function SaveItemPoolHandle(table, parentKey, childKey, whichItempool) end
function SaveQuestHandle(table, parentKey, childKey, whichQuest) end
function SaveQuestItemHandle(table, parentKey, childKey, whichQuestitem) end
function SaveDefeatConditionHandle(table, parentKey, childKey, whichDefeatcondition) end
function SaveTimerDialogHandle(table, parentKey, childKey, whichTimerdialog) end
function SaveLeaderboardHandle(table, parentKey, childKey, whichLeaderboard) end
function SaveMultiboardHandle(table, parentKey, childKey, whichMultiboard) end
function SaveMultiboardItemHandle(table, parentKey, childKey, whichMultiboarditem) end
function SaveTrackableHandle(table, parentKey, childKey, whichTrackable) end
function SaveDialogHandle(table, parentKey, childKey, whichDialog) end
function SaveButtonHandle(table, parentKey, childKey, whichButton) end
function SaveTextTagHandle(table, parentKey, childKey, whichTexttag) end
function SaveLightningHandle(table, parentKey, childKey, whichLightning) end
function SaveImageHandle(table, parentKey, childKey, whichImage) end
function SaveUbersplatHandle(table, parentKey, childKey, whichUbersplat) end
function SaveRegionHandle(table, parentKey, childKey, whichRegion) end
function SaveFogStateHandle(table, parentKey, childKey, whichFogState) end
function SaveFogModifierHandle(table, parentKey, childKey, whichFogModifier) end
function SaveAgentHandle(table, parentKey, childKey, whichAgent) end
function SaveHashtableHandle(table, parentKey, childKey, whichHashtable) end
function SaveFrameHandle(table, parentKey, childKey, whichFrameHandle) end
function LoadInteger(table, parentKey, childKey) end
function LoadReal(table, parentKey, childKey) end
function LoadBoolean(table, parentKey, childKey) end
function LoadStr(table, parentKey, childKey) end
function LoadPlayerHandle(table, parentKey, childKey) end
function LoadWidgetHandle(table, parentKey, childKey) end
function LoadDestructableHandle(table, parentKey, childKey) end
function LoadItemHandle(table, parentKey, childKey) end
function LoadUnitHandle(table, parentKey, childKey) end
function LoadAbilityHandle(table, parentKey, childKey) end
function LoadTimerHandle(table, parentKey, childKey) end
function LoadTriggerHandle(table, parentKey, childKey) end
function LoadTriggerConditionHandle(table, parentKey, childKey) end
function LoadTriggerActionHandle(table, parentKey, childKey) end
function LoadTriggerEventHandle(table, parentKey, childKey) end
function LoadForceHandle(table, parentKey, childKey) end
function LoadGroupHandle(table, parentKey, childKey) end
function LoadLocationHandle(table, parentKey, childKey) end
function LoadRectHandle(table, parentKey, childKey) end
function LoadBooleanExprHandle(table, parentKey, childKey) end
function LoadSoundHandle(table, parentKey, childKey) end
function LoadEffectHandle(table, parentKey, childKey) end
function LoadUnitPoolHandle(table, parentKey, childKey) end
function LoadItemPoolHandle(table, parentKey, childKey) end
function LoadQuestHandle(table, parentKey, childKey) end
function LoadQuestItemHandle(table, parentKey, childKey) end
function LoadDefeatConditionHandle(table, parentKey, childKey) end
function LoadTimerDialogHandle(table, parentKey, childKey) end
function LoadLeaderboardHandle(table, parentKey, childKey) end
function LoadMultiboardHandle(table, parentKey, childKey) end
function LoadMultiboardItemHandle(table, parentKey, childKey) end
function LoadTrackableHandle(table, parentKey, childKey) end
function LoadDialogHandle(table, parentKey, childKey) end
function LoadButtonHandle(table, parentKey, childKey) end
function LoadTextTagHandle(table, parentKey, childKey) end
function LoadLightningHandle(table, parentKey, childKey) end
function LoadImageHandle(table, parentKey, childKey) end
function LoadUbersplatHandle(table, parentKey, childKey) end
function LoadRegionHandle(table, parentKey, childKey) end
function LoadFogStateHandle(table, parentKey, childKey) end
function LoadFogModifierHandle(table, parentKey, childKey) end
function LoadHashtableHandle(table, parentKey, childKey) end
function LoadFrameHandle(table, parentKey, childKey) end
function HaveSavedInteger(table, parentKey, childKey) end
function HaveSavedReal(table, parentKey, childKey) end
function HaveSavedBoolean(table, parentKey, childKey) end
function HaveSavedString(table, parentKey, childKey) end
function HaveSavedHandle(table, parentKey, childKey) end
function RemoveSavedInteger(table, parentKey, childKey) end
function RemoveSavedReal(table, parentKey, childKey) end
function RemoveSavedBoolean(table, parentKey, childKey) end
function RemoveSavedString(table, parentKey, childKey) end
function RemoveSavedHandle(table, parentKey, childKey) end
function FlushParentHashtable(table) end
function FlushChildHashtable(table, parentKey) end
function GetRandomInt(lowBound, highBound) end
function GetRandomReal(lowBound, highBound) end
function CreateUnitPool() end
function DestroyUnitPool(whichPool) end
function UnitPoolAddUnitType(whichPool, unitId, weight) end
function UnitPoolRemoveUnitType(whichPool, unitId) end
function PlaceRandomUnit(whichPool, forWhichPlayer, x, y, facing) end
function CreateItemPool() end
function DestroyItemPool(whichItemPool) end
function ItemPoolAddItemType(whichItemPool, itemId, weight) end
function ItemPoolRemoveItemType(whichItemPool, itemId) end
function PlaceRandomItem(whichItemPool, x, y) end
function ChooseRandomCreep(level) end
function ChooseRandomNPBuilding() end
function ChooseRandomItem(level) end
function ChooseRandomItemEx(whichType, level) end
function SetRandomSeed(seed) end
function SetTerrainFog(a, b, c, d, e) end
function ResetTerrainFog() end
function SetUnitFog(a, b, c, d, e) end
function SetTerrainFogEx(style, zstart, zend, density, red, green, blue) end
function DisplayTextToPlayer(toPlayer, x, y, message) end
function DisplayTimedTextToPlayer(toPlayer, x, y, duration, message) end
function DisplayTimedTextFromPlayer(toPlayer, x, y, duration, message) end
function ClearTextMessages() end
function SetDayNightModels(terrainDNCFile, unitDNCFile) end
function SetSkyModel(skyModelFile) end
function EnableUserControl(b) end
function EnableUserUI(b) end
function SuspendTimeOfDay(b) end
function SetTimeOfDayScale(r) end
function GetTimeOfDayScale() end
function ShowInterface(flag, fadeDuration) end
function PauseGame(flag) end
function UnitAddIndicator(whichUnit, red, green, blue, alpha) end
function AddIndicator(whichWidget, red, green, blue, alpha) end
function PingMinimap(x, y, duration) end
function PingMinimapEx(x, y, duration, red, green, blue, extraEffects) end
function EnableOcclusion(flag) end
function SetIntroShotText(introText) end
function SetIntroShotModel(introModelPath) end
function EnableWorldFogBoundary(b) end
function PlayModelCinematic(modelName) end
function PlayCinematic(movieName) end
function ForceUIKey(key) end
function ForceUICancel() end
function DisplayLoadDialog() end
function SetAltMinimapIcon(iconPath) end
function DisableRestartMission(flag) end
function CreateTextTag() end
function DestroyTextTag(t) end
function SetTextTagText(t, s, height) end
function SetTextTagPos(t, x, y, heightOffset) end
function SetTextTagPosUnit(t, whichUnit, heightOffset) end
function SetTextTagColor(t, red, green, blue, alpha) end
function SetTextTagVelocity(t, xvel, yvel) end
function SetTextTagVisibility(t, flag) end
function SetTextTagSuspended(t, flag) end
function SetTextTagPermanent(t, flag) end
function SetTextTagAge(t, age) end
function SetTextTagLifespan(t, lifespan) end
function SetTextTagFadepoint(t, fadepoint) end
function SetReservedLocalHeroButtons(reserved) end
function GetAllyColorFilterState() end
function SetAllyColorFilterState(state) end
function GetCreepCampFilterState() end
function SetCreepCampFilterState(state) end
function EnableMinimapFilterButtons(enableAlly, enableCreep) end
function EnableDragSelect(state, ui) end
function EnablePreSelect(state, ui) end
function EnableSelect(state, ui) end
function CreateTrackable(trackableModelPath, x, y, facing) end
function CreateQuest() end
function DestroyQuest(whichQuest) end
function QuestSetTitle(whichQuest, title) end
function QuestSetDescription(whichQuest, description) end
function QuestSetIconPath(whichQuest, iconPath) end
function QuestSetRequired(whichQuest, required) end
function QuestSetCompleted(whichQuest, completed) end
function QuestSetDiscovered(whichQuest, discovered) end
function QuestSetFailed(whichQuest, failed) end
function QuestSetEnabled(whichQuest, enabled) end
function IsQuestRequired(whichQuest) end
function IsQuestCompleted(whichQuest) end
function IsQuestDiscovered(whichQuest) end
function IsQuestFailed(whichQuest) end
function IsQuestEnabled(whichQuest) end
function QuestCreateItem(whichQuest) end
function QuestItemSetDescription(whichQuestItem, description) end
function QuestItemSetCompleted(whichQuestItem, completed) end
function IsQuestItemCompleted(whichQuestItem) end
function CreateDefeatCondition() end
function DestroyDefeatCondition(whichCondition) end
function DefeatConditionSetDescription(whichCondition, description) end
function FlashQuestDialogButton() end
function ForceQuestDialogUpdate() end
function CreateTimerDialog(t) end
function DestroyTimerDialog(whichDialog) end
function TimerDialogSetTitle(whichDialog, title) end
function TimerDialogSetTitleColor(whichDialog, red, green, blue, alpha) end
function TimerDialogSetTimeColor(whichDialog, red, green, blue, alpha) end
function TimerDialogSetSpeed(whichDialog, speedMultFactor) end
function TimerDialogDisplay(whichDialog, display) end
function IsTimerDialogDisplayed(whichDialog) end
function TimerDialogSetRealTimeRemaining(whichDialog, timeRemaining) end
function CreateLeaderboard() end
function DestroyLeaderboard(lb) end
function LeaderboardDisplay(lb, show) end
function IsLeaderboardDisplayed(lb) end
function LeaderboardGetItemCount(lb) end
function LeaderboardSetSizeByItemCount(lb, count) end
function LeaderboardAddItem(lb, label, value, p) end
function LeaderboardRemoveItem(lb, index) end
function LeaderboardRemovePlayerItem(lb, p) end
function LeaderboardClear(lb) end
function LeaderboardSortItemsByValue(lb, ascending) end
function LeaderboardSortItemsByPlayer(lb, ascending) end
function LeaderboardSortItemsByLabel(lb, ascending) end
function LeaderboardHasPlayerItem(lb, p) end
function LeaderboardGetPlayerIndex(lb, p) end
function LeaderboardSetLabel(lb, label) end
function LeaderboardGetLabelText(lb) end
function PlayerSetLeaderboard(toPlayer, lb) end
function PlayerGetLeaderboard(toPlayer) end
function LeaderboardSetLabelColor(lb, red, green, blue, alpha) end
function LeaderboardSetValueColor(lb, red, green, blue, alpha) end
function LeaderboardSetStyle(lb, showLabel, showNames, showValues, showIcons) end
function LeaderboardSetItemValue(lb, whichItem, val) end
function LeaderboardSetItemLabel(lb, whichItem, val) end
function LeaderboardSetItemStyle(lb, whichItem, showLabel, showValue, showIcon) end
function LeaderboardSetItemLabelColor(lb, whichItem, red, green, blue, alpha) end
function LeaderboardSetItemValueColor(lb, whichItem, red, green, blue, alpha) end
function CreateMultiboard() end
function DestroyMultiboard(lb) end
function MultiboardDisplay(lb, show) end
function IsMultiboardDisplayed(lb) end
function MultiboardMinimize(lb, minimize) end
function IsMultiboardMinimized(lb) end
function MultiboardClear(lb) end
function MultiboardSetTitleText(lb, label) end
function MultiboardGetTitleText(lb) end
function MultiboardSetTitleTextColor(lb, red, green, blue, alpha) end
function MultiboardGetRowCount(lb) end
function MultiboardGetColumnCount(lb) end
function MultiboardSetColumnCount(lb, count) end
function MultiboardSetRowCount(lb, count) end
function MultiboardSetItemsStyle(lb, showValues, showIcons) end
function MultiboardSetItemsValue(lb, value) end
function MultiboardSetItemsValueColor(lb, red, green, blue, alpha) end
function MultiboardSetItemsWidth(lb, width) end
function MultiboardSetItemsIcon(lb, iconPath) end
function MultiboardGetItem(lb, row, column) end
function MultiboardReleaseItem(mbi) end
function MultiboardSetItemStyle(mbi, showValue, showIcon) end
function MultiboardSetItemValue(mbi, val) end
function MultiboardSetItemValueColor(mbi, red, green, blue, alpha) end
function MultiboardSetItemWidth(mbi, width) end
function MultiboardSetItemIcon(mbi, iconFileName) end
function MultiboardSuppressDisplay(flag) end
function SetCameraPosition(x, y) end
function SetCameraQuickPosition(x, y) end
function SetCameraBounds(x1, y1, x2, y2, x3, y3, x4, y4) end
function StopCamera() end
function ResetToGameCamera(duration) end
function PanCameraTo(x, y) end
function PanCameraToTimed(x, y, duration) end
function PanCameraToWithZ(x, y, zOffsetDest) end
function PanCameraToTimedWithZ(x, y, zOffsetDest, duration) end
function SetCinematicCamera(cameraModelFile) end
function SetCameraRotateMode(x, y, radiansToSweep, duration) end
function SetCameraField(whichField, value, duration) end
function AdjustCameraField(whichField, offset, duration) end
function SetCameraTargetController(whichUnit, xoffset, yoffset, inheritOrientation) end
function SetCameraOrientController(whichUnit, xoffset, yoffset) end
function CreateCameraSetup() end
function CameraSetupSetField(whichSetup, whichField, value, duration) end
function CameraSetupGetField(whichSetup, whichField) end
function CameraSetupSetDestPosition(whichSetup, x, y, duration) end
function CameraSetupGetDestPositionLoc(whichSetup) end
function CameraSetupGetDestPositionX(whichSetup) end
function CameraSetupGetDestPositionY(whichSetup) end
function CameraSetupApply(whichSetup, doPan, panTimed) end
function CameraSetupApplyWithZ(whichSetup, zDestOffset) end
function CameraSetupApplyForceDuration(whichSetup, doPan, forceDuration) end
function CameraSetupApplyForceDurationWithZ(whichSetup, zDestOffset, forceDuration) end
function CameraSetTargetNoise(mag, velocity) end
function CameraSetSourceNoise(mag, velocity) end
function CameraSetTargetNoiseEx(mag, velocity, vertOnly) end
function CameraSetSourceNoiseEx(mag, velocity, vertOnly) end
function CameraSetSmoothingFactor(factor) end
function SetCineFilterTexture(filename) end
function SetCineFilterBlendMode(whichMode) end
function SetCineFilterTexMapFlags(whichFlags) end
function SetCineFilterStartUV(minu, minv, maxu, maxv) end
function SetCineFilterEndUV(minu, minv, maxu, maxv) end
function SetCineFilterStartColor(red, green, blue, alpha) end
function SetCineFilterEndColor(red, green, blue, alpha) end
function SetCineFilterDuration(duration) end
function DisplayCineFilter(flag) end
function IsCineFilterDisplayed() end
function SetCinematicScene(portraitUnitId, color, speakerTitle, text, sceneDuration, voiceoverDuration) end
function EndCinematicScene() end
function ForceCinematicSubtitles(flag) end
function GetCameraMargin(whichMargin) end
function GetCameraBoundMinX() end
function GetCameraBoundMinY() end
function GetCameraBoundMaxX() end
function GetCameraBoundMaxY() end
function GetCameraField(whichField) end
function GetCameraTargetPositionX() end
function GetCameraTargetPositionY() end
function GetCameraTargetPositionZ() end
function GetCameraTargetPositionLoc() end
function GetCameraEyePositionX() end
function GetCameraEyePositionY() end
function GetCameraEyePositionZ() end
function GetCameraEyePositionLoc() end
function NewSoundEnvironment(environmentName) end
function CreateSound(fileName, looping, is3D, stopwhenoutofrange, fadeInRate, fadeOutRate, eaxSetting) end
function CreateSoundFilenameWithLabel(fileName, looping, is3D, stopwhenoutofrange, fadeInRate, fadeOutRate, SLKEntryName) end
function CreateSoundFromLabel(soundLabel, looping, is3D, stopwhenoutofrange, fadeInRate, fadeOutRate) end
function CreateMIDISound(soundLabel, fadeInRate, fadeOutRate) end
function SetSoundParamsFromLabel(soundHandle, soundLabel) end
function SetSoundDistanceCutoff(soundHandle, cutoff) end
function SetSoundChannel(soundHandle, channel) end
function SetSoundVolume(soundHandle, volume) end
function SetSoundPitch(soundHandle, pitch) end
function SetSoundPlayPosition(soundHandle, millisecs) end
function SetSoundDistances(soundHandle, minDist, maxDist) end
function SetSoundConeAngles(soundHandle, inside, outside, outsideVolume) end
function SetSoundConeOrientation(soundHandle, x, y, z) end
function SetSoundPosition(soundHandle, x, y, z) end
function SetSoundVelocity(soundHandle, x, y, z) end
function AttachSoundToUnit(soundHandle, whichUnit) end
function StartSound(soundHandle) end
function StopSound(soundHandle, killWhenDone, fadeOut) end
function KillSoundWhenDone(soundHandle) end
function SetMapMusic(musicName, random, index) end
function ClearMapMusic() end
function PlayMusic(musicName) end
function PlayMusicEx(musicName, frommsecs, fadeinmsecs) end
function StopMusic(fadeOut) end
function ResumeMusic() end
function PlayThematicMusic(musicFileName) end
function PlayThematicMusicEx(musicFileName, frommsecs) end
function EndThematicMusic() end
function SetMusicVolume(volume) end
function SetMusicPlayPosition(millisecs) end
function SetThematicMusicPlayPosition(millisecs) end
function SetSoundDuration(soundHandle, duration) end
function GetSoundDuration(soundHandle) end
function GetSoundFileDuration(musicFileName) end
function VolumeGroupSetVolume(vgroup, scale) end
function VolumeGroupReset() end
function GetSoundIsPlaying(soundHandle) end
function GetSoundIsLoading(soundHandle) end
function RegisterStackedSound(soundHandle, byPosition, rectwidth, rectheight) end
function UnregisterStackedSound(soundHandle, byPosition, rectwidth, rectheight) end
function AddWeatherEffect(where, effectID) end
function RemoveWeatherEffect(whichEffect) end
function EnableWeatherEffect(whichEffect, enable) end
function TerrainDeformCrater(x, y, radius, depth, duration, permanent) end
function TerrainDeformRipple(x, y, radius, depth, duration, count, spaceWaves, timeWaves, radiusStartPct, limitNeg) end
function TerrainDeformWave(x, y, dirX, dirY, distance, speed, radius, depth, trailTime, count) end
function TerrainDeformRandom(x, y, radius, minDelta, maxDelta, duration, updateInterval) end
function TerrainDeformStop(deformation, duration) end
function TerrainDeformStopAll() end
function AddSpecialEffect(modelName, x, y) end
function AddSpecialEffectLoc(modelName, where) end
function AddSpecialEffectTarget(modelName, targetWidget, attachPointName) end
function DestroyEffect(whichEffect) end
function AddSpellEffect(abilityString, t, x, y) end
function AddSpellEffectLoc(abilityString, t, where) end
function AddSpellEffectById(abilityId, t, x, y) end
function AddSpellEffectByIdLoc(abilityId, t, where) end
function AddSpellEffectTarget(modelName, t, targetWidget, attachPoint) end
function AddSpellEffectTargetById(abilityId, t, targetWidget, attachPoint) end
function AddLightning(codeName, checkVisibility, x1, y1, x2, y2) end
function AddLightningEx(codeName, checkVisibility, x1, y1, z1, x2, y2, z2) end
function DestroyLightning(whichBolt) end
function MoveLightning(whichBolt, checkVisibility, x1, y1, x2, y2) end
function MoveLightningEx(whichBolt, checkVisibility, x1, y1, z1, x2, y2, z2) end
function GetLightningColorA(whichBolt) end
function GetLightningColorR(whichBolt) end
function GetLightningColorG(whichBolt) end
function GetLightningColorB(whichBolt) end
function SetLightningColor(whichBolt, r, g, b, a) end
function GetAbilityEffect(abilityString, t, index) end
function GetAbilityEffectById(abilityId, t, index) end
function GetAbilitySound(abilityString, t) end
function GetAbilitySoundById(abilityId, t) end
function GetTerrainCliffLevel(x, y) end
function SetWaterBaseColor(red, green, blue, alpha) end
function SetWaterDeforms(val) end
function GetTerrainType(x, y) end
function GetTerrainVariance(x, y) end
function SetTerrainType(x, y, terrainType, variation, area, shape) end
function IsTerrainPathable(x, y, t) end
function SetTerrainPathable(x, y, t, flag) end
function CreateImage(file, sizeX, sizeY, sizeZ, posX, posY, posZ, originX, originY, originZ, imageType) end
function DestroyImage(whichImage) end
function ShowImage(whichImage, flag) end
function SetImageConstantHeight(whichImage, flag, height) end
function SetImagePosition(whichImage, x, y, z) end
function SetImageColor(whichImage, red, green, blue, alpha) end
function SetImageRender(whichImage, flag) end
function SetImageRenderAlways(whichImage, flag) end
function SetImageAboveWater(whichImage, flag, useWaterAlpha) end
function SetImageType(whichImage, imageType) end
function CreateUbersplat(x, y, name, red, green, blue, alpha, forcePaused, noBirthTime) end
function DestroyUbersplat(whichSplat) end
function ResetUbersplat(whichSplat) end
function FinishUbersplat(whichSplat) end
function ShowUbersplat(whichSplat, flag) end
function SetUbersplatRender(whichSplat, flag) end
function SetUbersplatRenderAlways(whichSplat, flag) end
function SetBlight(whichPlayer, x, y, radius, addBlight) end
function SetBlightRect(whichPlayer, r, addBlight) end
function SetBlightPoint(whichPlayer, x, y, addBlight) end
function SetBlightLoc(whichPlayer, whichLocation, radius, addBlight) end
function CreateBlightedGoldmine(id, x, y, face) end
function IsPointBlighted(x, y) end
function SetDoodadAnimation(x, y, radius, doodadID, nearestOnly, animName, animRandom) end
function SetDoodadAnimationRect(r, doodadID, animName, animRandom) end
function StartMeleeAI(num, script) end
function StartCampaignAI(num, script) end
function CommandAI(num, command, data) end
function PauseCompAI(p, pause) end
function GetAIDifficulty(num) end
function RemoveGuardPosition(hUnit) end
function RecycleGuardPosition(hUnit) end
function RemoveAllGuardPositions(num) end
function Cheat(cheatStr) end
function IsNoVictoryCheat() end
function IsNoDefeatCheat() end
function Preload(filename) end
function PreloadEnd(timeout) end
function PreloadStart() end
function PreloadRefresh() end
function PreloadEndEx() end
function PreloadGenClear() end
function PreloadGenStart() end
function PreloadGenEnd(filename) end
function Preloader(filename) end
function AutomationSetTestType(testType) end
function AutomationTestStart(testName) end
function AutomationTestEnd() end
function AutomationTestingFinished() end
function BlzGetTriggerPlayerMouseX() end
function BlzGetTriggerPlayerMouseY() end
function BlzGetTriggerPlayerMousePosition() end
function BlzGetTriggerPlayerMouseButton() end
function BlzSetAbilityTooltip(abilCode, tooltip, level) end
function BlzSetAbilityActivatedTooltip(abilCode, tooltip, level) end
function BlzSetAbilityExtendedTooltip(abilCode, extendedTooltip, level) end
function BlzSetAbilityActivatedExtendedTooltip(abilCode, extendedTooltip, level) end
function BlzSetAbilityResearchTooltip(abilCode, researchTooltip, level) end
function BlzSetAbilityResearchExtendedTooltip(abilCode, researchExtendedTooltip, level) end
function BlzGetAbilityTooltip(abilCode, level) end
function BlzGetAbilityActivatedTooltip(abilCode, level) end
function BlzGetAbilityExtendedTooltip(abilCode, level) end
function BlzGetAbilityActivatedExtendedTooltip(abilCode, level) end
function BlzGetAbilityResearchTooltip(abilCode, level) end
function BlzGetAbilityResearchExtendedTooltip(abilCode, level) end
function BlzSetAbilityIcon(abilCode, iconPath) end
function BlzGetAbilityIcon(abilCode) end
function BlzSetAbilityActivatedIcon(abilCode, iconPath) end
function BlzGetAbilityActivatedIcon(abilCode) end
function BlzGetAbilityPosX(abilCode) end
function BlzGetAbilityPosY(abilCode) end
function BlzSetAbilityPosX(abilCode, x) end
function BlzSetAbilityPosY(abilCode, y) end
function BlzGetAbilityActivatedPosX(abilCode) end
function BlzGetAbilityActivatedPosY(abilCode) end
function BlzSetAbilityActivatedPosX(abilCode, x) end
function BlzSetAbilityActivatedPosY(abilCode, y) end
function BlzGetUnitMaxHP(whichUnit) end
function BlzSetUnitMaxHP(whichUnit, hp) end
function BlzGetUnitMaxMana(whichUnit) end
function BlzSetUnitMaxMana(whichUnit, mana) end
function BlzSetItemName(whichItem, name) end
function BlzSetItemDescription(whichItem, description) end
function BlzGetItemDescription(whichItem) end
function BlzSetItemTooltip(whichItem, tooltip) end
function BlzGetItemTooltip(whichItem) end
function BlzSetItemExtendedTooltip(whichItem, extendedTooltip) end
function BlzGetItemExtendedTooltip(whichItem) end
function BlzSetItemIconPath(whichItem, iconPath) end
function BlzGetItemIconPath(whichItem) end
function BlzSetUnitName(whichUnit, name) end
function BlzSetHeroProperName(whichUnit, heroProperName) end
function BlzGetUnitBaseDamage(whichUnit, weaponIndex) end
function BlzSetUnitBaseDamage(whichUnit, baseDamage, weaponIndex) end
function BlzGetUnitDiceNumber(whichUnit, weaponIndex) end
function BlzSetUnitDiceNumber(whichUnit, diceNumber, weaponIndex) end
function BlzGetUnitDiceSides(whichUnit, weaponIndex) end
function BlzSetUnitDiceSides(whichUnit, diceSides, weaponIndex) end
function BlzGetUnitAttackCooldown(whichUnit, weaponIndex) end
function BlzSetUnitAttackCooldown(whichUnit, cooldown, weaponIndex) end
function BlzSetSpecialEffectColorByPlayer(whichEffect, whichPlayer) end
function BlzSetSpecialEffectColor(whichEffect, r, g, b) end
function BlzSetSpecialEffectAlpha(whichEffect, alpha) end
function BlzSetSpecialEffectScale(whichEffect, scale) end
function BlzSetSpecialEffectPosition(whichEffect, x, y, z) end
function BlzSetSpecialEffectHeight(whichEffect, height) end
function BlzSetSpecialEffectTimeScale(whichEffect, timeScale) end
function BlzSetSpecialEffectTime(whichEffect, time) end
function BlzSetSpecialEffectOrientation(whichEffect, yaw, pitch, roll) end
function BlzSetSpecialEffectYaw(whichEffect, yaw) end
function BlzSetSpecialEffectPitch(whichEffect, pitch) end
function BlzSetSpecialEffectRoll(whichEffect, roll) end
function BlzSetSpecialEffectX(whichEffect, x) end
function BlzSetSpecialEffectY(whichEffect, y) end
function BlzSetSpecialEffectZ(whichEffect, z) end
function BlzSetSpecialEffectPositionLoc(whichEffect, loc) end
function BlzGetLocalSpecialEffectX(whichEffect) end
function BlzGetLocalSpecialEffectY(whichEffect) end
function BlzGetLocalSpecialEffectZ(whichEffect) end
function BlzSpecialEffectClearSubAnimations(whichEffect) end
function BlzSpecialEffectRemoveSubAnimation(whichEffect, whichSubAnim) end
function BlzSpecialEffectAddSubAnimation(whichEffect, whichSubAnim) end
function BlzPlaySpecialEffect(whichEffect, whichAnim) end
function BlzPlaySpecialEffectWithTimeScale(whichEffect, whichAnim, timeScale) end
function BlzGetAnimName(whichAnim) end
function BlzGetUnitArmor(whichUnit) end
function BlzSetUnitArmor(whichUnit, armorAmount) end
function BlzUnitHideAbility(whichUnit, abilId, flag) end
function BlzUnitDisableAbility(whichUnit, abilId, flag, hideUI) end
function BlzUnitCancelTimedLife(whichUnit) end
function BlzIsUnitSelectable(whichUnit) end
function BlzIsUnitInvulnerable(whichUnit) end
function BlzUnitInterruptAttack(whichUnit) end
function BlzGetUnitCollisionSize(whichUnit) end
function BlzGetAbilityManaCost(abilId, level) end
function BlzGetAbilityCooldown(abilId, level) end
function BlzSetUnitAbilityCooldown(whichUnit, abilId, level, cooldown) end
function BlzGetUnitAbilityCooldown(whichUnit, abilId, level) end
function BlzGetUnitAbilityCooldownRemaining(whichUnit, abilId) end
function BlzEndUnitAbilityCooldown(whichUnit, abilCode) end
function BlzGetUnitAbilityManaCost(whichUnit, abilId, level) end
function BlzSetUnitAbilityManaCost(whichUnit, abilId, level, manaCost) end
function BlzGetLocalUnitZ(whichUnit) end
function BlzDecPlayerTechResearched(whichPlayer, techid, levels) end
function BlzSetEventDamage(damage) end
function BlzGetEventDamageTarget() end
function BlzGetEventAttackType() end
function BlzGetEventDamageType() end
function BlzGetEventWeaponType() end
function BlzSetEventAttackType(attackType) end
function BlzSetEventDamageType(damageType) end
function BlzSetEventWeaponType(weaponType) end
function RequestExtraIntegerData(dataType, whichPlayer, param1, param2, param3, param4, param5, param6) end
function RequestExtraBooleanData(dataType, whichPlayer, param1, param2, param3, param4, param5, param6) end
function RequestExtraStringData(dataType, whichPlayer, param1, param2, param3, param4, param5, param6) end
function RequestExtraRealData(dataType, whichPlayer, param1, param2, param3, param4, param5, param6) end
function BlzGetUnitZ(whichUnit) end
function BlzEnableSelections(enableSelection, enableSelectionCircle) end
function BlzIsSelectionEnabled() end
function BlzIsSelectionCircleEnabled() end
function BlzCameraSetupApplyForceDurationSmooth(whichSetup, doPan, forcedDuration, easeInDuration, easeOutDuration, smoothFactor) end
function BlzEnableTargetIndicator(enable) end
function BlzIsTargetIndicatorEnabled() end
function BlzGetOriginFrame(frameType, index) end
function BlzEnableUIAutoPosition(enable) end
function BlzHideOriginFrames(enable) end
function BlzConvertColor(a, r, g, b) end
function BlzLoadTOCFile(TOCFile) end
function BlzCreateFrame(name, owner, priority, createContext) end
function BlzCreateSimpleFrame(name, owner, createContext) end
function BlzCreateFrameByType(typeName, name, owner, inherits, createContext) end
function BlzDestroyFrame(frame) end
function BlzFrameSetPoint(frame, point, relative, relativePoint, x, y) end
function BlzFrameSetAbsPoint(frame, point, x, y) end
function BlzFrameClearAllPoints(frame) end
function BlzFrameSetAllPoints(frame, relative) end
function BlzFrameSetVisible(frame, visible) end
function BlzFrameIsVisible(frame) end
function BlzGetFrameByName(name, createContext) end
function BlzFrameGetName(frame) end
function BlzFrameClick(frame) end
function BlzFrameSetText(frame, text) end
function BlzFrameGetText(frame) end
function BlzFrameSetTextSizeLimit(frame, size) end
function BlzFrameGetTextSizeLimit(frame) end
function BlzFrameSetTextColor(frame, color) end
function BlzFrameSetFocus(frame, flag) end
function BlzFrameSetModel(frame, modelFile, cameraIndex) end
function BlzFrameSetEnable(frame, enabled) end
function BlzFrameGetEnable(frame) end
function BlzFrameSetAlpha(frame, alpha) end
function BlzFrameGetAlpha(frame) end
function BlzFrameSetSpriteAnimate(frame, primaryProp, flags) end
function BlzFrameSetTexture(frame, texFile, flag, blend) end
function BlzFrameSetScale(frame, scale) end
function BlzFrameSetTooltip(frame, tooltip) end
function BlzFrameCageMouse(frame, enable) end
function BlzFrameSetValue(frame, value) end
function BlzFrameGetValue(frame) end
function BlzFrameSetMinMaxValue(frame, minValue, maxValue) end
function BlzFrameSetStepSize(frame, stepSize) end
function BlzFrameSetSize(frame, width, height) end
function BlzFrameSetVertexColor(frame, color) end
function BlzFrameSetLevel(frame, level) end
function BlzFrameSetParent(frame, parent) end
function BlzFrameGetParent(frame) end
function BlzFrameGetHeight(frame) end
function BlzFrameGetWidth(frame) end
function BlzFrameSetFont(frame, fileName, height, flags) end
function BlzFrameSetTextAlignment(frame, vert, horz) end
function BlzTriggerRegisterFrameEvent(whichTrigger, frame, eventId) end
function BlzGetTriggerFrame() end
function BlzGetTriggerFrameEvent() end
function BlzTriggerRegisterPlayerSyncEvent(whichTrigger, whichPlayer, prefix, fromServer) end
function BlzSendSyncData(prefix, data) end
function BlzGetTriggerSyncPrefix() end
function BlzGetTriggerSyncData() end
function BlzTriggerRegisterPlayerKeyEvent(whichTrigger, whichPlayer, key, metaKey, keyDown) end
function BlzGetTriggerPlayerKey() end
function BlzGetTriggerPlayerMetaKey() end
function BlzGetTriggerPlayerIsKeyDown() end
function BlzEnableCursor(enable) end
function BlzSetMousePos(x, y) end
function BlzGetLocalClientWidth() end
function BlzGetLocalClientHeight() end
function BlzIsLocalClientActive() end
function BlzGetMouseFocusUnit() end
function BlzChangeMinimapTerrainTex(texFile) end
function BlzGetLocale() end
function BlzGetSpecialEffectScale(whichEffect) end
function BlzSetSpecialEffectMatrixScale(whichEffect, x, y, z) end
function BlzResetSpecialEffectMatrix(whichEffect) end
function BlzGetUnitAbility(whichUnit, abilId) end
function BlzGetUnitAbilityByIndex(whichUnit, index) end
function BlzDisplayChatMessage(whichPlayer, recipient, message) end
function BlzPauseUnitEx(whichUnit, flag) end
function BlzBitOr(x, y) end
function BlzBitAnd(x, y) end
function BlzBitXor(x, y) end
function BlzGetAbilityBooleanField(whichAbility, whichField) end
function BlzGetAbilityIntegerField(whichAbility, whichField) end
function BlzGetAbilityRealField(whichAbility, whichField) end
function BlzGetAbilityStringField(whichAbility, whichField) end
function BlzGetAbilityBooleanLevelField(whichAbility, whichField, level) end
function BlzGetAbilityIntegerLevelField(whichAbility, whichField, level) end
function BlzGetAbilityRealLevelField(whichAbility, whichField, level) end
function BlzGetAbilityStringLevelField(whichAbility, whichField, level) end
function BlzGetAbilityBooleanLevelArrayField(whichAbility, whichField, level, index) end
function BlzGetAbilityIntegerLevelArrayField(whichAbility, whichField, level, index) end
function BlzGetAbilityRealLevelArrayField(whichAbility, whichField, level, index) end
function BlzGetAbilityStringLevelArrayField(whichAbility, whichField, level, index) end
function BlzSetAbilityBooleanField(whichAbility, whichField, value) end
function BlzSetAbilityIntegerField(whichAbility, whichField, value) end
function BlzSetAbilityRealField(whichAbility, whichField, value) end
function BlzSetAbilityStringField(whichAbility, whichField, value) end
function BlzSetAbilityBooleanLevelField(whichAbility, whichField, level, value) end
function BlzSetAbilityIntegerLevelField(whichAbility, whichField, level, value) end
function BlzSetAbilityRealLevelField(whichAbility, whichField, level, value) end
function BlzSetAbilityStringLevelField(whichAbility, whichField, level, value) end
function BlzSetAbilityBooleanLevelArrayField(whichAbility, whichField, level, index, value) end
function BlzSetAbilityIntegerLevelArrayField(whichAbility, whichField, level, index, value) end
function BlzSetAbilityRealLevelArrayField(whichAbility, whichField, level, index, value) end
function BlzSetAbilityStringLevelArrayField(whichAbility, whichField, level, index, value) end
function BlzAddAbilityBooleanLevelArrayField(whichAbility, whichField, level, value) end
function BlzAddAbilityIntegerLevelArrayField(whichAbility, whichField, level, value) end
function BlzAddAbilityRealLevelArrayField(whichAbility, whichField, level, value) end
function BlzAddAbilityStringLevelArrayField(whichAbility, whichField, level, value) end
function BlzRemoveAbilityBooleanLevelArrayField(whichAbility, whichField, level, value) end
function BlzRemoveAbilityIntegerLevelArrayField(whichAbility, whichField, level, value) end
function BlzRemoveAbilityRealLevelArrayField(whichAbility, whichField, level, value) end
function BlzRemoveAbilityStringLevelArrayField(whichAbility, whichField, level, value) end
function BlzGetItemAbilityByIndex(whichItem, index) end
function BlzGetItemAbility(whichItem, abilCode) end
function BlzItemAddAbility(whichItem, abilCode) end
function BlzGetItemBooleanField(whichItem, whichField) end
function BlzGetItemIntegerField(whichItem, whichField) end
function BlzGetItemRealField(whichItem, whichField) end
function BlzGetItemStringField(whichItem, whichField) end
function BlzSetItemBooleanField(whichItem, whichField, value) end
function BlzSetItemIntegerField(whichItem, whichField, value) end
function BlzSetItemRealField(whichItem, whichField, value) end
function BlzSetItemStringField(whichItem, whichField, value) end
function BlzItemRemoveAbility(whichItem, abilCode) end
function BlzGetUnitBooleanField(whichUnit, whichField) end
function BlzGetUnitIntegerField(whichUnit, whichField) end
function BlzGetUnitRealField(whichUnit, whichField) end
function BlzGetUnitStringField(whichUnit, whichField) end
function BlzSetUnitBooleanField(whichUnit, whichField, value) end
function BlzSetUnitIntegerField(whichUnit, whichField, value) end
function BlzSetUnitRealField(whichUnit, whichField, value) end
function BlzSetUnitStringField(whichUnit, whichField, value) end
function BlzGetUnitWeaponBooleanField(whichUnit, whichField, index) end
function BlzGetUnitWeaponIntegerField(whichUnit, whichField, index) end
function BlzGetUnitWeaponRealField(whichUnit, whichField, index) end
function BlzGetUnitWeaponStringField(whichUnit, whichField, index) end
function BlzSetUnitWeaponBooleanField(whichUnit, whichField, index, value) end
function BlzSetUnitWeaponIntegerField(whichUnit, whichField, index, value) end
function BlzSetUnitWeaponRealField(whichUnit, whichField, index, value) end
function BlzSetUnitWeaponStringField(whichUnit, whichField, index, value) end
|
local V = {
Name = "Scion tC",
Class = "prop_vehicle_jeep",
Category = "TDM Cars",
Author = "TheDanishMaster, Turn 10",
Information = "A drivable Scion tC by TheDanishMaster",
Model = "models/tdmcars/scion_tc.mdl",
KeyValues = {
vehiclescript = "scripts/vehicles/TDMCars/sciontc.txt"
}
}
list.Set("Vehicles", "sciontctdm", V)
|
local comm = require "comm"
local nmap = require "nmap"
local shortport = require "shortport"
local string = require "string"
description = [[
Detects the Java Debug Wire Protocol. This protocol is used by Java programs
to be debugged via the network. It should not be open to the public Internet,
as it does not provide any security against malicious attackers who can inject
their own bytecode into the debugged process.
Documentation for JDWP is available at
http://java.sun.com/javase/6/docs/technotes/guides/jpda/jdwp-spec.html
]]
author = "Michael Schierl <schierlm@gmx.de>"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"version"}
---
-- @output
-- PORT STATE SERVICE VERSION
-- 9999/tcp open jdwp Java Debug Wire Protocol (Reference Implementation) version 1.6 1.6.0_17
portrule = function(host, port)
-- JDWP will close the port if there is no valid handshake within 2
-- seconds, Service detection's NULL probe detects it as tcpwrapped.
return port.service == "tcpwrapped"
and port.protocol == "tcp" and port.state == "open"
and not(shortport.port_is_excluded(port.number,port.protocol))
end
action = function(host, port)
-- make sure we get at least one more packet after the JDWP-Handshake
-- response even if there is some delay; the handshake response has 14
-- bytes, so wait for 18 bytes here.
local status, result = comm.exchange(host, port, "JDWP-Handshake\0\0\0\11\0\0\0\1\0\1\1", {proto="tcp", bytes=18})
if (not status) then
return
end
-- match jdwp m|JDWP-Handshake| p/$1/ v/$3/ i/$2\n$4/
local match = {string.match(result, "^JDWP%-Handshake\0\0..\0\0\0\1\128\0\0\0\0..([^\0\n]*)\n([^\0]*)\0\0..\0\0..\0\0..([0-9._]+)\0\0..([^\0]*)")}
if match == nil or #match == 0 then
-- if we have one \128 (reply marker), it is at least not echo because the request did not contain \128
if (string.match(result,"^JDWP%-Handshake\0.*\128") ~= nil) then
port.version.name="jdwp"
port.version.product="unknown"
nmap.set_port_version(host, port)
end
return
end
port.version.name="jdwp"
port.version.product = match[1]
port.version.version = match[3]
-- port.version.extrainfo = match[2] .. "\n" .. match[4]
nmap.set_port_version(host, port)
return
end
|
if not HpwRewrite then return end
if SERVER then return end
if not HpwRewrite.BM then return end
HpwRewrite.VGUI = HpwRewrite.VGUI or { }
local infohelp
local WindowColor = Color(80, 80, 80)
local PlayerSpells = { }
local PlayerLSpells = { }
local ReceivedInfo = false
net.Receive("hpwrewrite_GivI", function()
table.Empty(PlayerSpells)
table.Empty(PlayerLSpells)
local lrn = net.ReadString()
local lrnbl = net.ReadString()
if lrn and lrn != "" then PlayerSpells = string.Explode("%", lrn) end
if lrnbl and lrnbl != "" then PlayerLSpells = string.Explode("%", lrnbl) end
ReceivedInfo = true
end)
local SpellLearning = false
local progress = 0
hook.Add("Think", "hpwrewrite_progressbarhandler", function()
if SpellLening != HpwRewrite.Learning then
SpellLearning = HpwRewrite.Learning
if not SpellLearning then progress = 0 end
end
if SpellLearning then
if HpwRewrite.LearningSpell then
progress = math.Approach(progress, HpwRewrite.LearningSpell.LearnTime, FrameTime())
end
end
end)
local cross = Material("vgui/hpwrewrite/cross")
function HpwRewrite.VGUI:CreateWindow(w, h, vis)
local win = vgui.Create("DFrame")
win:SetSize(w, h)
win:Center()
win:SetTitle("")
win:ShowCloseButton(false)
win:MakePopup()
win.Paint = function(self, w, h)
draw.RoundedBox(0, 0, 0, w, h, WindowColor)
draw.RoundedBox(0, 0, 0, w, 25, HpwRewrite.Colors.DarkGrey)
end
win.PaintOver = function(self, w, h)
surface.SetDrawColor(HpwRewrite.Colors.DarkGrey)
surface.DrawOutlinedRect(0, 0, w, h)
end
win.OnCloseButton = function(self) end
local old = win.Close
win.Close = function(win)
win:OnCloseButton()
if vis then
RememberCursorPosition()
win:SetVisible(false)
else
old(win)
end
end
win.SetupCloseButton = function(win)
if IsValid(win.CloseBtn) then
win.CloseBtn:SetPos(win:GetWide() - 25, 0)
return
end
local close = self:CreateButton("", win:GetWide() - 25, 0, 25, 25, win, function()
win:Close()
end)
close.DoSound = false
close.Paint = function(self, w, h)
surface.SetMaterial(cross)
surface.SetDrawColor(HpwRewrite.Colors.White)
surface.DrawTexturedRect(0, 0, w, h)
end
win.CloseBtn = close
end
win:SetupCloseButton()
return win
end
function HpwRewrite.VGUI:CreateButton(text, x, y, w, h, win, func)
local btn = vgui.Create("DButton", win)
btn.EnterAlpha = 0
btn.DoSound = true
btn.DrawDiff = true
btn.EnterColor = HpwRewrite.Colors.Blue
btn.OnCursorEntered = function(self)
if self.DoSound then surface.PlaySound("hpwrewrite/enterbtn.wav") end
self.entered = true
self.EnterAlpha = 255
end
local old = btn.Think
btn.Think = function(btn)
if old then old(btn) end
-- Preventing OnCursorExited bug
local x, y = btn:LocalCursorPos()
if btn.entered and not (x >= 0 and y >= 0 and x <= btn:GetWide() and y <= btn:GetTall()) then
btn.entered = false
end
end
btn.MainColor = HpwRewrite.Colors.DarkGrey2
btn.Paint = function(self, w, h)
local color = self.DrawDiff and (self.entered and self.EnterColor or self.MainColor) or self.MainColor
draw.RoundedBox(0, 0, 0, w, h, self.MainColor)
if self.DrawDiff then
local col = self.EnterColor
local color = Color(col.r, col.g, col.b, self.EnterAlpha)
draw.RoundedBox(0, 0, 0, w, h, color)
if not self.entered then
self.EnterAlpha = math.Approach(self.EnterAlpha, 0, RealFrameTime() * 4000)
end
end
draw.RoundedBox(0, 0, 0, w, h*0.4, Color(255, 255, 255, 1))
end
func = func or function() end
btn.DoClick = function(self)
surface.PlaySound("hpwrewrite/clickbtn.wav")
func(self)
end
btn:SetText(text)
btn:SetFont("HPW_gui1")
btn:SetPos(x, y)
btn:SetSize(w, h)
btn:SetColor(HpwRewrite.Colors.White)
return btn
end
local arrow = Material("vgui/hpwrewrite/arrow")
function HpwRewrite.VGUI:CreateScrollPanel(x, y, w, h, parent)
parent = parent or self.Window
if not IsValid(parent) then return end
local panel = vgui.Create("DScrollPanel", parent)
panel:SetPos(x, y)
panel:SetSize(w, h)
local bar = panel:GetVBar()
bar:SetWide(14)
local wval = 14
local Entered = false
bar.Paint = function(self, w, h)
draw.RoundedBox(0, w - wval, 0, wval, h, Color(20, 20, 20, (wval - 7) * 5))
end
bar.btnUp.Paint = function(self, w, h)
surface.SetMaterial(arrow)
surface.SetDrawColor(HpwRewrite.Colors.White)
surface.DrawTexturedRectRotated(w - wval + wval * 0.5, h * 0.5, 7, 7, 90)
end
bar.btnDown.Paint = function(self, w, h)
surface.SetMaterial(arrow)
surface.SetDrawColor(HpwRewrite.Colors.White)
surface.DrawTexturedRectRotated(w - wval + wval * 0.5, h * 0.5, 7, 7, -90)
end
local old = bar.Think
bar.Think = function(self)
old(self)
local w, h = self:GetWide(), self:GetTall()
local x, y = self:LocalCursorPos()
Entered = (x > 0 and x < w and y > 0 and y < h) or self.Dragging
wval = math.Approach(wval, Entered and w or w * 0.5, RealFrameTime() * 120)
end
local color = Color(0, 0, 0, 150)
bar.btnGrip.Paint = function(self, w, h)
draw.RoundedBox(0, w - wval, 0, wval, h, color)
end
local old = panel.PerformLayout
panel.PerformLayout = function(self, w, h)
old(self, w, h)
self.pnlCanvas:SetWide(self:GetWide())
end
panel.HPWColorDraw = HpwRewrite.Colors.DarkGrey
panel.Paint = function(self, w, h)
draw.RoundedBox(4, 0, 0, w, h, self.HPWColorDraw)
end
return panel
end
function HpwRewrite.VGUI:CreateSheet(x, y, w, h, parent)
parent = parent or self.Window
if not IsValid(parent) then return end
local sheet = vgui.Create("DPropertySheet", parent)
sheet.tabScroller:SetOverlap(-1)
sheet.tabScroller.btnLeft.Paint = function(self, w, h)
surface.SetMaterial(arrow)
surface.SetDrawColor(HpwRewrite.Colors.White)
surface.DrawTexturedRectRotated(w / 2, h / 2, w, h, 180)
end
sheet.tabScroller.btnRight.Paint = function(self, w, h)
surface.SetMaterial(arrow)
surface.SetDrawColor(HpwRewrite.Colors.White)
surface.DrawTexturedRectRotated(w / 2, h / 2, w, h, 0)
end
local old = sheet.tabScroller.PerformLayout
sheet.tabScroller.PerformLayout = function(self, w, h)
old(self, w, h)
self.btnRight:AlignBottom(12)
self.btnLeft:AlignBottom(12)
end
sheet.tabScroller:DockMargin(0, 0, 0, 0)
sheet:SetPos(x, y)
sheet:SetSize(w, h)
sheet:SetShowIcons(false)
return sheet
end
function HpwRewrite.VGUI:SetupSheetDrawing(sheet, activecolor)
local sizes = 0
activecolor = activecolor or WindowColor
local innactivecolor = Color(activecolor.r * 1.1, activecolor.g * 1.1, activecolor.b * 1.1)
for k, v in pairs(sheet.Items) do
v.Tab.Paint = function(self, w, h)
local color = self.Active and activecolor or HpwRewrite.Colors.DarkGrey2
if self.entered and not self.Active then color = innactivecolor end
h = h - 6
draw.RoundedBox(0, 0, 0, w, h, color)
end
v.Tab.OnCursorEntered = function(self) surface.PlaySound("hpwrewrite/enterbtn.wav") self.entered = true end
v.Tab.OnCursorExited = function(self) self.entered = false end
local old = v.Tab.DoClick
v.Tab.DoClick = function(self)
surface.PlaySound("hpwrewrite/clickbtn.wav")
old(self)
end
v.Tab:SetFont("HPW_gui1")
local w, h = v.Tab:GetContentSize()
v.Tab:SetSize(w + 10, h + 18)
v.Tab.ApplySchemeSettings = function(self)
self.Active = self:GetPropertySheet():GetActiveTab() == self
self:SetColor((self.Active and activecolor == HpwRewrite.Colors.White) and HpwRewrite.Colors.DarkGrey2 or HpwRewrite.Colors.White)
end
local old = v.Tab.PerformLayout
v.Tab.PerformLayout = function(self, w, h)
old(self, w, h)
if self.Image then
self.Image:SetPos(5, 4)
end
end
v.Panel:SetPos(sheet:GetPadding(), 28 + sheet:GetPadding())
end
sheet.Paint = function(self, w, h)
draw.RoundedBox(4, 0, 0, w, h, activecolor)
draw.RoundedBox(0, 0, 0, w, 28, HpwRewrite.Colors.DarkGrey)
end
end
function HpwRewrite.VGUI:CreateLabel(text, x, y, parent)
parent = parent or self.Window
if not IsValid(parent) then return end
local lab = vgui.Create("DLabel", parent)
lab:SetPos(x, y)
lab:SetText(text)
lab:SetFont("HPW_gui1")
lab:SizeToContents()
lab:SetColor(HpwRewrite.Colors.White)
return lab
end
--[[
function HpwRewrite.VGUI:OpenSwapMenu(name)
HpwRewrite.BM:LoadBinds(name)
local Dragging
local Waiting
local PosX = 0
local PosY = 0
local x = 5
local y = 29
local w, h = 86, 86
local win = self:CreateWindow(w * 9.7, h * 1.6)
win:SetTitle("Swap menu. Drag'n'Drop spells to change their positions")
win.lblTitle:SetFont("HPW_gui1")
local panels = { }
local function Load()
for k, v in pairs(panels) do if IsValid(v) then v:Remove() end end
table.Empty(panels)
for i = 1, 9 do
local x = x + (i - 1) * (w + 4)
local p = vgui.Create("Panel", win)
p:SetPos(x, y)
p:SetSize(w+16, h+16)
p.Index = i
p.Bind = HpwRewrite.BM.Binds[i]
local shift = 10
p.Paint = function() end
p.PaintOver = function(p)
local spell, key
if p.Bind then
spell = p.Bind.Spell
key = p.Bind.Key
end
HpwRewrite:DrawSpellRect(spell, key, 8, 8, w, h)
local w = w - 4
local h = h - 4
local color
if p == Dragging then
color = Color(0, 0, 0, 200)
end
if Dragging and Waiting == p.Index then
color = Color(0, 255, 0, 100)
elseif Waiting == p.Index then
color = Color(0, 155, 255, 100)
end
if color then
draw.RoundedBox(6, shift, shift, w, h, color)
end
end
if p.Bind then
p.OnMousePressed = function(p, ms)
if ms == 107 then
Dragging = p
PosX, PosY = p:LocalCursorPos()
end
end
end
p.OnCursorEntered = function(p)
Waiting = p.Index
end
p.OnCursorExited = function(p)
Waiting = nil
end
table.insert(panels, p)
end
end
Load()
hook.Add("DrawOverlay", "hpwrewrite_dragndrophandler", function()
if not IsValid(win) then hook.Remove("DrawOverlay", "hpwrewrite_dragndrophandler") return end
if Dragging then
local x, y = gui.MouseX(), gui.MouseY()
x = x - PosX
y = y - PosY
HpwRewrite:DrawSpellRect(Dragging.Bind.Spell, Dragging.Bind.Key, x, y, w, h)
end
end)
win.OnCloseButton = function() hook.Remove("DrawOverlay", "hpwrewrite_dragndrophandler") end
local oldThink = win.Think
win.Think = function(win)
oldThink(win)
if Dragging then
if not input.IsMouseDown(107) then
if Waiting then
HpwRewrite.BM:MoveBindTo(Dragging.Index, Waiting, name)
Load()
end
Dragging = nil
end
end
end
end]]
local options = {
["Give and don't save to player's data file"] = function(ply, spell)
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(2, 5)
net.WriteString(spell)
net.WriteEntity(ply)
net.SendToServer()
end,
["Give and save to player's data file"] = function(ply, spell)
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(3, 5)
net.WriteString(spell)
net.WriteEntity(ply)
net.SendToServer()
end,
["Give to player's learnable spells"] = function(ply, spell)
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(4, 5)
net.WriteString(spell)
net.WriteEntity(ply)
net.SendToServer()
end
}
local options2 = {
["Who has this? (From current session)"] = function(spell)
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(5, 5)
net.WriteString(spell)
net.SendToServer()
end,
["Who has this? (From data files)"] = function(spell)
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(6, 5)
net.WriteString(spell)
net.SendToServer()
end,
["Unlearn from everyone"] = function(spell)
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(7, 5)
net.WriteString(spell)
net.SendToServer()
end
}
----------------------
-- Main window code --
----------------------
local rememberSpell, rembemberTab
local closedTabs = { }
-- wont use any database table
local fName = "hpwrewrite/client/closedtabs.txt"
if not file.Exists(fName, "DATA") then
file.Write(fName, "")
else
local tabs = string.Explode("¤", file.Read(fName))
if tabs then
for k, v in pairs(tabs) do
closedTabs[v] = true
end
end
end
-- Saving closed spell categories tabs to not annoy player next game
hook.Add("ShutDown", "hpwrewrite_saveclosedtabs", function()
local data = ""
if next(closedTabs) != nil then for k, v in pairs(closedTabs) do if v then data = data .. "¤" .. k end end end
file.Write(fName, data)
end)
local function GetTime(total)
local hours = math.floor(total / 3600)
local mins = math.floor(total / 60 % 60)
local seconds = math.floor(total % 60)
return Format("%02d:%02d:%02d", hours, mins, seconds)
end
function HpwRewrite.VGUI:UpdateVgui()
if IsValid(self.Window) then
self.Window:Close()
self.Window = nil
end
end
local gradient = Material("gui/center_gradient")
local sheetWidth = 572
local function yesno(bool)
return bool and HpwRewrite.Language:GetWord("#yes") or HpwRewrite.Language:GetWord("#no")
end
function HpwRewrite.VGUI:OpenNewSpellManager()
if IsValid(self.Window) then
self.Window:SetVisible(true)
RestoreCursorPosition()
return self.Window
end
local win = self:CreateWindow(816, 630, true)
self.Window = win
local old = win.Paint
win.Paint = function(self, w, h)
old(self, w, h)
surface.SetDrawColor(HpwRewrite.Colors.DarkGrey)
local x = w - 228
surface.DrawLine(x, 0, x, h) -- Separating line
end
local desc = self:CreateScrollPanel(597, 33, 210, 559, win) -- That right info panel
local sheet = self:CreateSheet(0, 25, 588, 575)
win.SpellWindow = desc
win.Sheet = sheet
--[[local old = win.PerformLayout
win.PerformLayout = function(win, w, h)
win.Sheet:SetSize(w - 212, h - 25)
win.SpellWindow:SetPos(w - 203, 33)
win.SpellWindow:SetSize(195, h - 41)
win.ProgressBar:SetSize(w - 25, 24)
win:SetupCloseButton()
end]]
sheet:SetFadeTime(0)
-- Spell learning aka skillz progress bar
do
local bar = vgui.Create("DProgress", win)
bar:SetPos(0, 0)
bar:SetSize(792, 24)
win.ProgressBar = bar
local text = HpwRewrite.Language:GetWord("#progress")
local lab = self:CreateLabel(text .. "0%", 10, 4, bar)
bar.Think = function(self)
local fr = self:GetFraction()
local skill = HpwRewrite:SkillLevel()
if fr != skill then
self:SetFraction(Lerp(RealFrameTime(), fr, skill))
lab:SetText(text .. math.Round(fr * 100) .. "%")
lab:SetColor(HpwRewrite.Colors.White)
lab:SizeToContents()
end
end
bar.Paint = function(self, w, h)
draw.RoundedBox(0, 0, 0, w, h, HpwRewrite.Colors.DarkGrey2)
draw.RoundedBox(0, 0, 0, w * self:GetFraction(), h, HpwRewrite.Colors.Blue)
end
end
local function AddSpells() end -- Prototype
-- Creates info about some spell or skin
local infopanel
local function CreateInfoPanel(k)
local spell = HpwRewrite:GetSpell(k)
if not spell then return end
rememberSpell = k
if IsValid(infopanel) then infopanel:Remove() end
infopanel = vgui.Create("DPanel", desc)
infopanel.Paint = function() end
local pos = 0
local function createLab(text)
pos = pos + 16
return text != "" and self:CreateLabel(text, 10, pos, infopanel) or nil
end
local icon = HpwRewrite:GetSpellIcon(k)
if not icon:IsError() then
local img = icon:GetName()
icon = vgui.Create("DImage", infopanel)
icon:SetPos(16, 16)
icon:SetImage(img)
icon:SetSize(171, 171)
local old = icon.Paint
icon.Paint = function(self, w, h)
old(self, w, h)
-- Border
surface.SetDrawColor(HpwRewrite.Colors.DarkGrey)
surface.DrawOutlinedRect(0, 0, w, h)
end
pos = pos + 180
end
local spellName = createLab(k)
spellName:SetColor(HpwRewrite.Colors.LightBlue)
spellName:SetFont("HPW_fontSpells1")
spellName:SizeToContents()
if not HpwRewrite:PlayerHasSpell(nil, k) then
createLab("")
local text = (spell.IsSkin and HpwRewrite.Language:GetWord("#noskin") or HpwRewrite.Language:GetWord("#notlearned"))
createLab(text):SetColor(HpwRewrite.Colors.Blue)
else
createLab("")
local text = (spell.IsSkin and HpwRewrite.Language:GetWord("#haveskin") or HpwRewrite.Language:GetWord("#havelrndspell"))
createLab(text):SetColor(HpwRewrite.Colors.LightBlue)
end
if HpwRewrite:PlayerHasLearnableSpell(nil, k) then
createLab("")
createLab(HpwRewrite.Language:GetWord("#havebook")):SetColor(HpwRewrite.Colors.Blue)
if HpwRewrite:CanLearn(nil, k) then
createLab(HpwRewrite.Language:GetWord("#readytolearn")):SetColor(HpwRewrite.Colors.Blue)
createLab("")
end
end
createLab("")
local learninfo = HpwRewrite.Language:GetWord("#instantlrnbl")
if spell.LearnTime != 0 and not spell.InstantLearn or (spell.IsSkin and spell.ShouldLearn) then
learninfo = Format(HpwRewrite.Language:GetWord("#learntime"), GetTime(spell.LearnTime))
end
createLab(learninfo)
-- Main info
createLab("")
-- TODO: parse long named categories
if spell.Category then
if istable(spell.Category) then
createLab(HpwRewrite.Language:GetWord("#categories"))
for k, v in pairs(spell.Category) do
createLab("• " .. v)
end
else
createLab(HpwRewrite.Language:GetWord("#category"))
createLab("• " .. spell.Category)
end
createLab("")
end
createLab(HpwRewrite.Language:GetWord("#hasbook") .. yesno(spell.CreateEntity))
if spell.CreateEntity then createLab(HpwRewrite.Language:GetWord("#bookinqmenu") .. yesno(spell.ShowInSpawnmenu)) end
if spell.IsSkin then
createLab(HpwRewrite.Language:GetWord("#holdtype") .. spell.HoldType)
else
createLab(HpwRewrite.Language:GetWord("#isselfcastable") .. yesno(spell.CanSelfCast))
if spell.CanSelfCast then
createLab(HpwRewrite.Language:GetWord("#reversedselfcast") .. yesno(spell.ShouldReverseSelfCast))
end
--createLab("Is unforgivable: " .. yesno(spell.Unforgivable))
createLab(HpwRewrite.Language:GetWord("#accuracycost") .. spell.AccuracyDecreaseVal * 100 .. "%")
end
if spell.Description != "" then
createLab("")
createLab(HpwRewrite.Language:GetWord("#description")):SetColor(HpwRewrite.Colors.Blue)
local str = string.Explode("\n", spell.Description)
for i = 1, #str - 1 do
if str[i] then createLab(str[i]) end
end
end
if spell.IsSkin then
local names = { }
for k, v in pairs(HpwRewrite:GetSpells()) do
if v.OnlyWithSkin and table.HasValue(v.OnlyWithSkin, spell.Name) then
table.insert(names, v.Name)
end
end
if #names > 0 then
createLab("")
createLab(HpwRewrite.Language:GetWord("#exclusive")):SetColor(HpwRewrite.Colors.Blue)
for k, v in pairs(names) do createLab(v) end
end
end
if spell.SecretSpell then
createLab("")
createLab(HpwRewrite.Language:GetWord("#secretspell")):SetColor(HpwRewrite.Colors.Blue)
createLab("")
end
-- RESTRICTIOOONS
if spell.OnlyWithSkin then
createLab("")
createLab(HpwRewrite.Language:GetWord("#onlyavailable")):SetColor(HpwRewrite.Colors.Blue)
for k, v in pairs(spell.OnlyWithSkin) do createLab(v) end
end
if spell.OnlyIfLearned then
createLab("")
createLab(HpwRewrite.Language:GetWord("#requiredknowldg")):SetColor(HpwRewrite.Colors.Blue)
for k, v in pairs(spell.OnlyIfLearned) do
local reqS = createLab(v)
local w, h = reqS:GetContentSize()
local has = HpwRewrite:PlayerHasSpell(nil, v)
self:CreateLabel(has and "✓" or "✘", w + 14, pos, infopanel):SetColor(has and HpwRewrite.Colors.Green or HpwRewrite.Colors.Red)
end
end
if HpwRewrite:IsSpellInBlacklist(k) then
createLab("")
createLab(HpwRewrite.Language:GetWord("#blacklisted")):SetColor(HpwRewrite.Colors.Blue)
createLab("")
end
pos = pos + 32
local exists = HpwRewrite.FavouriteSpells[k]
local removeFav = HpwRewrite.Language:GetWord("#removefav")
local addFav = HpwRewrite.Language:GetWord("#addtofav")
local btn = self:CreateButton(exists and removeFav or addFav, 10, pos, 183, 25, infopanel, function(btn)
if exists then
HpwRewrite.DM:RemoveFromFavourites(k)
exists = false
btn:SetText(addFav)
else
HpwRewrite.DM:AddToFavourites(k)
exists = true
btn:SetText(removeFav)
end
AddSpells()
end)
if HpwRewrite:PlayerHasLearnableSpell(nil, k) then
pos = pos + 26
local btn = self:CreateButton(HpwRewrite.Language:GetWord("#startlrn"), 10, pos, 183, 25, infopanel, function()
net.Start("hpwrewrite_LrnS")
net.WriteString(k)
net.SendToServer()
end)
end
if HpwRewrite:PlayerHasSpell(nil, k) then
pos = pos + 26
local btn = self:CreateButton(HpwRewrite.Language:GetWord("#use"), 10, pos, 183, 25, infopanel, function()
HpwRewrite:RequestSpell(k)
end)
end
pos = pos + 31
local btn = self:CreateButton(HpwRewrite.Language:GetWord("#closepanel"), 10, pos, 183, 30, infopanel, function()
infopanel:Remove()
end)
local col = HpwRewrite.Colors.Blue
btn.MainColor = Color(col.r * 0.7, col.g * 0.7, col.b * 0.7)
infopanel:SetSize(195, pos + 45)
-- Looking for learning
do
local SpellLearning = false
local p
infopanel.Think = function()
if SpellLearning != HpwRewrite.Learning then
SpellLearning = HpwRewrite.Learning
if SpellLearning then
p = vgui.Create("DPanel", infopanel)
p:SetPos(0, pos + 49)
p:SetSize(195, 200)
p.Paint = function() end
local bar = vgui.Create("DProgress", p)
bar:SetPos(10, 0)
bar:SetSize(175, 25)
bar.Think = function()
local spell = HpwRewrite.LearningSpell
if spell then
local learntime = spell.LearnTime
bar:SetFraction(progress / learntime)
end
end
bar.Paint = function(self, w, h)
draw.RoundedBox(0, 0, 0, w, h, HpwRewrite.Colors.DarkGrey2)
draw.RoundedBox(0, 0, 0, w * self:GetFraction(), h, HpwRewrite.Colors.Blue)
end
local btn = self:CreateButton(HpwRewrite.Language:GetWord("#stoplrn"), 10, 35, 175, 25, p, function()
net.Start("hpwrewrite_LrnSt")
net.SendToServer()
end)
local lab = self:CreateLabel("", 10, 65, p)
lab.Think = function()
local spell = HpwRewrite.LearningSpell
if spell and HpwRewrite.LearningSpellName and progress then
local text = HpwRewrite.Language:GetWord("#learning") .. HpwRewrite.LearningSpellName .. " "
local learntime = spell.LearnTime
local timeleft = GetTime(math.Round((1 - bar:GetFraction()) * learntime))
--local msg2 = "Don't die or exit from the\ngame while learning.\n"
local msg1 = text .. math.Round((progress / learntime) * 100) .. "%\n" .. timeleft .. " left\n\n"
local msg1 = Format(HpwRewrite.Language:GetWord("#learningmsg"), text, math.Round((progress / learntime) * 100), "%\n", timeleft)
local msg2 = HpwRewrite.Language:GetWord("#warning")
lab:SetText(msg1 .. msg2)
lab:SizeToContents()
end
end
infopanel:SetSize(195, pos + 216)
else
if IsValid(p) then
p:Remove()
infopanel:SetSize(195, pos + 30)
end
end
end
end
infopanel:Think()
end
end
-- Adding tabs
local newspells
local spells
local skins = self:CreateScrollPanel()
local skinsButtons = { }
AddSpells = function(searchTerm)
-- Adding spell tree
if not newspells then
newspells = vgui.Create("HPWSpellTree", win)
newspells.CatchClick = function(newspells, name)
CreateInfoPanel(name)
if HpwRewrite:CanUseSpell(LocalPlayer(), name) and HpwRewrite.CVars.CloseOnSelect:GetBool() then win:Close() end
HpwRewrite:RequestSpell(name)
end
end
if newspells.Added then newspells:Update() end
newspells.Added = true
-- Adding spells with categories
if not spells then spells = self:CreateScrollPanel() end
if spells.SpellCats then
for k, v in pairs(spells.SpellCats) do
if IsValid(v) then v:Remove() end
end
spells.SpellCats = nil
end
spells.SpellCats = { }
local defaultSize = 30
for k, v in SortedPairs(HpwRewrite:GetCategories()) do
-- Adding spells to the category
if not spells.SpellCats[k] then
local spellCategory = vgui.Create("DPanel", spells)
spellCategory.Paint = function() end
spells.SpellCats[k] = spellCategory
local btn = self:CreateButton(k, 0, 0, sheetWidth, defaultSize, spellCategory, function()
closedTabs[k] = not closedTabs[k]
spellCategory.Hidden = closedTabs[k]
end)
btn.DoRightClick = btn.DoClick
btn:SetFont("HPW_gui3")
btn.MainColor = HpwRewrite.Colors.DarkGrey
btn.EnterColor = HpwRewrite.Colors.DarkGrey3
btn.DoSound = false
local old = btn.Paint
btn.Paint = function(btn, w, h)
old(btn, w, h)
surface.SetMaterial(gradient)
surface.SetDrawColor(HpwRewrite.Colors.DarkGrey5)
surface.DrawTexturedRect(0, 0, w, 1)
surface.DrawTexturedRect(0, h - 1, w, 1)
end
spellCategory.MainButton = btn
spellCategory.OtherButtons = { }
local useless = { }
local function getPos() return defaultSize + 1 + #spellCategory.OtherButtons * 25 end
local function findSpell(spellName)
if searchTerm != nil and searchTerm != "" then
return spellName:lower():find(searchTerm:lower())
end
return "N/A"
end
for a, b in SortedPairs(HpwRewrite:GetSpells()) do
local cat = b.Category
if type(cat) == "table" then
if table.HasValue(cat, k) then cat = k else cat = nil end
end
if (cat == k and not b.IsSkin) or (k == HpwRewrite.Language:GetWord("#favcategory") and HpwRewrite.FavouriteSpells[a]) then
if b.SecretSpell and not HpwRewrite:PlayerHasSpell(LocalPlayer(), a) then continue end
-- Don't create button if search doesn't match
if not findSpell(a) then continue end
if not HpwRewrite:CanUseSpell(LocalPlayer(), a) then
useless[a] = true
continue
end
local btn = self:CreateButton(a, 0, getPos(), sheetWidth, 24, spellCategory, function()
if HpwRewrite.CVars.CloseOnSelect:GetBool() then win:Close() end
CreateInfoPanel(a)
HpwRewrite:RequestSpell(a)
end)
btn.DoRightClick = function()
CreateInfoPanel(a)
end
--btn.DoSound = false
table.insert(spellCategory.OtherButtons, btn)
end
end
for a, b in SortedPairs(useless) do
local btn = self:CreateButton(a, 0, getPos(), sheetWidth, 24, spellCategory, function()
CreateInfoPanel(a)
end)
local learn = HpwRewrite:PlayerHasLearnableSpell(LocalPlayer(), a)
btn.DoRightClick = btn.DoClick
btn:SetColor(Color(0, 0, 0, 220))
btn.MainColor = learn and HpwRewrite.Colors.Green or HpwRewrite.Colors.DarkGrey5
btn.EnterColor = Color(btn.MainColor.r * 1.1, btn.MainColor.g * 1.1, btn.MainColor.b * 1.1)
btn.DoSound = false
table.insert(spellCategory.OtherButtons, btn)
end
spellCategory.Hidden = closedTabs[k]
end
end
spells.Think = function(spells)
local w = spells:GetWide()
for name, spellCategory in SortedPairs(spells.SpellCats) do
local size = defaultSize+1
local numBtns = #spellCategory.OtherButtons
if not spellCategory.Hidden then size = size + numBtns * 25 end
--local h = Lerp(RealFrameTime() * 12, spellCategory:GetTall(), size)
local h
if not spellCategory.LoadedSpells then
h = size
spellCategory.LoadedSpells = true
else
h = math.Approach(spellCategory:GetTall(), size, RealFrameTime() * 120 * numBtns)
end
spellCategory:SetSize(w, h)
spellCategory:Dock(TOP)
end
end
-- Updating skins
for k, v in pairs(skinsButtons) do
if IsValid(v) then v:Remove() end
skinsButtons[k] = nil
end
for k, v in SortedPairs(HpwRewrite:GetLearnedSpells()) do
if not v then continue end -- i don't remember for what this is but ill leave it
local skin = HpwRewrite:GetSkin(k)
if not skin then continue end
local btn = self:CreateButton("", 0, 0, sheetWidth, 60, skins, function()
HpwRewrite:RequestSpell(k)
CreateInfoPanel(k)
end)
btn:Dock(TOP)
btn:DockMargin(0, 0, 0, 1)
btn.DoRightClick = function()
CreateInfoPanel(k)
end
local oldPaint = btn.Paint
btn.Paint = function(self, w, h)
oldPaint(self, w, h)
local mat = HpwRewrite:GetSpellIcon(k)
if not mat:IsError() then
draw.RoundedBox(0, 5, 5, 50, 50, HpwRewrite.Colors.DarkGrey3)
surface.SetMaterial(mat)
surface.SetDrawColor(HpwRewrite.Colors.White)
surface.DrawTexturedRect(6, 6, 48, 48)
end
draw.SimpleText(k, "HPW_gui2", w / 2, h / 2 - 16, HpwRewrite.Colors.White, TEXT_ALIGN_CENTER)
end
table.insert(skinsButtons, btn)
end
end
-- Spell search bar
local spellSearch = vgui.Create("DTextEntry", win)
spellSearch:SetPos(0, 600)
spellSearch:SetSize(588, 30)
spellSearch:SetText("")
spellSearch:SetFont("HPW_gui1")
spellSearch:SetUpdateOnType(true)
spellSearch.Ghost = HpwRewrite.Language:GetWord("#searchspells")
spellSearch.OnValueChange = function(text)
if text:GetText() != "" then
local txt = text:GetText()
for k,v in SortedPairs(HpwRewrite:GetSpells()) do
if not v.IsSkin and txt:lower() == string.sub(k:lower(), 1, txt:len()) then
text.Ghost = txt .. string.sub(k, txt:len() + 1)
break
else
text.Ghost = ""
end
end
else
spellSearch.Ghost = HpwRewrite.Language:GetWord("#searchspells")
end
AddSpells(text:GetText())
end
local oldPaint = spellSearch.Paint
spellSearch.Paint = function(self, w, h)
oldPaint(self, w, h)
draw.SimpleText(spellSearch.Ghost, "HPW_gui1", 3, 7, Color(55, 55, 55, 150))
-- Background change if no results are found
for _, currentCat in pairs(spells.SpellCats) do
if type(currentCat.OtherButtons) == "table" and #currentCat.OtherButtons > 0 then return end
end
local color = Color(255, 0, 0, 80)
draw.RoundedBox(0, 0, 0, w, h, color)
end
-- Hide spell searchbar outside of spell list
local oldTabChanged = win.Sheet.OnActiveTabChanged
win.Sheet.OnActiveTabChanged = function(self, old, new)
oldTabChanged(self, old, new)
local tabName = HpwRewrite.Language:GetWord("#spelllist")
spellSearch:SetVisible(new:GetText() == tabName and old:GetText() != tabName)
end
AddSpells()
-- Infopanel sheet
local info = vgui.Create("DPanel", win)
do
info.Paint = function() end
local sheet2 = self:CreateSheet(0, 0, sheetWidth, 530, info)
local faq = self:CreateScrollPanel()
local pos = 10
-- F.A.Q
if HpwRewrite.Manuals.FAQ then
self:CreateLabel(HpwRewrite.Language:GetWord("#faq_msg1"), 10, pos, faq):SetColor(HpwRewrite.Colors.LightBlue)
pos = pos + 50
local btn = self:CreateButton(HpwRewrite.Language:GetWord("#bugsthread"), 415, 13, 120, 24, faq, function() gui.OpenURL("https://github.com/Ayditor/HPW_Rewrite/issues") end)
local btn = self:CreateButton(HpwRewrite.Language:GetWord("#qathread"), 415, 38, 120, 24, faq, function() gui.OpenURL("http://steamcommunity.com/workshop/filedetails/discussion/875498456/135510393202106420") end)
for k, v in pairs(HpwRewrite.Manuals.FAQ) do
self:CreateLabel(string.rep("_", 75), 10, pos, faq):SetColor(HpwRewrite.Colors.DarkGrey3)
pos = pos + 30
self:CreateLabel("Q: ", 10, pos, faq):SetColor(Color(0, 150, 255))
local question = string.Explode("\n", v.Q)
for _, str in pairs(question) do
self:CreateLabel(str, 30, pos, faq)
pos = pos + 16
end
self:CreateLabel("A: ", 10, pos, faq):SetColor(Color(0, 150, 255))
local answer = string.Explode("\n", v.A)
for _, str in pairs(answer) do
self:CreateLabel(str, 30, pos, faq)
pos = pos + 16
end
pos = pos + 15
end
self:CreateLabel("", 10, pos, faq)
end
local help = self:CreateScrollPanel()
-- Help buttons
do
local function createbtn(text, func)
local btn = self:CreateButton(text, 0, 0, 565, 25, help, func)
btn:Dock(TOP)
btn:DockMargin(0, 0, 0, 1)
return btn
end
local btn = createbtn(HpwRewrite.Language:GetWord("#updspells"), function()
net.Start("hpwrewrite_ClientRequest")
net.WriteUInt(4, 5)
net.SendToServer()
end)
local btn = createbtn(HpwRewrite.Language:GetWord("#emptymyspells"), function()
net.Start("hpwrewrite_ClientRequest")
net.WriteUInt(2, 5)
net.SendToServer()
end)
local btn = createbtn(HpwRewrite.Language:GetWord("#loadmyspells"), function()
net.Start("hpwrewrite_ClientRequest")
net.WriteUInt(5, 5)
net.SendToServer()
end)
local btn = createbtn(HpwRewrite.Language:GetWord("#getconfig"), function()
net.Start("hpwrewrite_ClientRequest")
net.WriteUInt(1, 5)
net.SendToServer()
end)
local name = HpwRewrite.Language:GetWord("#unlearnmyspells")
local yes = HpwRewrite.Language:GetWord("#yes")
local no = HpwRewrite.Language:GetWord("#no")
local sure = HpwRewrite.Language:GetWord("#sure")
local btn = createbtn(name, function()
Derma_Query(sure, name, yes, function()
net.Start("hpwrewrite_ClientRequest")
net.WriteUInt(3, 5)
net.SendToServer()
end, no)
end)
local btn = createbtn(HpwRewrite.Language:GetWord("#learneverything"), function()
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(14, 5)
net.SendToServer()
end)
local btn = createbtn(HpwRewrite.Language:GetWord("#getdebug"), function()
HpwRewrite.VGUI:OpenDebugInfoWindow()
end)
local btn = createbtn(HpwRewrite.Language:GetWord("#cleardebug"), function()
RunConsoleCommand("hpwrewrite_cl_cleardebug")
end)
local btn = createbtn(HpwRewrite.Language:GetWord("#copycvars"), function()
local text = ""
HpwRewrite:LogDebug("Copying convar values to clipboard...")
for k, v in pairs(HpwRewrite.CVars) do
text = text .. v:GetName() .. " " .. v:GetString() .. "\n"
end
SetClipboardText(text)
end)
local name = HpwRewrite.Language:GetWord("#resetcvars")
local sure2 = HpwRewrite.Language:GetWord("#sure2")
local btn = createbtn(name, function()
Derma_Query(sure2, name, yes, function()
for k, v in pairs(HpwRewrite.CVars) do
if string.find(v:GetName(), "hpwrewrite_cl") then
RunConsoleCommand(v:GetName(), v:GetDefault())
end
end
end, no)
end)
local btn = createbtn(HpwRewrite.Language:GetWord("#updwin"), function()
self:UpdateVgui()
self:OpenNewSpellManager()
end)
local btn = createbtn(HpwRewrite.Language:GetWord("#apidoc"), function()
gui.OpenURL("https://github.com/Ayditor/HPW_Rewrite/wiki/Wand-API")
end)
end
-- License, stuff
local other = self:CreateScrollPanel()
local pos = 10
local lab = self:CreateLabel(HpwRewrite.Language:GetWord("#license"), 0, 0, other)
lab:SetColor(HpwRewrite.Colors.LightBlue)
lab:SetFont("HPW_gui2")
lab:SizeToContents()
lab:Dock(TOP)
lab:DockMargin(10, 5, 0, 10)
for k, v in pairs(string.Explode("\n", HpwRewrite.Manuals.License)) do
local t = self:CreateLabel(v, 0, 0, other)
t:Dock(TOP)
t:DockMargin(10, 0, 0, 0)
end
-- Bugs
local lab = self:CreateLabel(HpwRewrite.Language:GetWord("#knownbugs"), 0, 0, other)
lab:SetColor(HpwRewrite.Colors.LightBlue)
lab:SetFont("HPW_gui2")
lab:SizeToContents()
lab:Dock(TOP)
lab:DockMargin(10, 5, 0, 10)
for k, v in pairs(HpwRewrite.Manuals.KnownBugs) do
local t = self:CreateLabel(Format("• %s", v), 0, 0, other)
t:Dock(TOP)
t:DockMargin(10, 0, 0, 0)
end
-- Contributors
local lab = self:CreateLabel(HpwRewrite.Language:GetWord("#contributors"), 0, 0, other)
lab:SetColor(HpwRewrite.Colors.LightBlue)
lab:SetFont("HPW_gui2")
lab:SizeToContents()
lab:Dock(TOP)
lab:DockMargin(10, 5, 0, 10)
-- Don't remove this piece of code
for k, v in SortedPairs(HpwRewrite.Manuals.Contributors) do
local t = self:CreateButton(k, 0, 0, 100, 20, other, function()
gui.OpenURL(v)
end)
t:Dock(TOP)
t:DockMargin(0, 1, 0, 0)
end
-- Client settings
local clientset = HpwRewrite.Language:GetWord("#clientsettings")
local clientopt = self:CreateScrollPanel()
clientopt:SetName(clientset)
clientopt.HPWColorDraw = HpwRewrite.Colors.White
local p = vgui.Create("ControlPanel", clientopt)
HpwRewrite.VGUI.CreateClientOptions(p)
local old = clientopt.PerformLayout
clientopt.PerformLayout = function(self, w, h)
old(self, w, h)
p:SetSize(self:GetWide(), p:GetTall())
end
-- Server settings
local serveropt
local serverset = HpwRewrite.Language:GetWord("#serversettings")
serveropt = self:CreateScrollPanel()
serveropt:SetName(serverset)
serveropt.HPWColorDraw = HpwRewrite.Colors.White
local p = vgui.Create("ControlPanel", serveropt)
HpwRewrite.VGUI.CreateServerOptions(p)
local old = serveropt.PerformLayout
serveropt.PerformLayout = function(self, w, h)
old(self, w, h)
p:SetSize(self:GetWide(), p:GetTall())
end
-- List of CVars
local cvarList = self:CreateScrollPanel()
local lab = self:CreateLabel(HpwRewrite.Language:GetWord("#helplistcvar"), 10, 10, cvarList)
local count = 0
local max = 1
for k, v in pairs(HpwRewrite.CVars) do
local len = string.len(k)
if len > max then max = len end
end
for k, v in SortedPairs(HpwRewrite.CVars) do
local lab = self:CreateLabel(Format("%s%s%s - %s", k, string.rep(" ", (max - string.len(k)) + 2), v:GetName(), v:GetString()), 10, 60 + (count * 16), cvarList)
lab:SetFont("DebugFixed")
lab:SizeToContents()
count = count + 1
end
sheet2:AddSheet(HpwRewrite.Language:GetWord("#faq"), faq)--, "icon16/information.png")
sheet2:AddSheet(HpwRewrite.Language:GetWord("#helpstuff"), help)--, "icon16/cog.png")
sheet2:AddSheet(HpwRewrite.Language:GetWord("#maininfo"), other)--, "icon16/book.png")
sheet2:AddSheet(clientset, clientopt)--, "icon16/cog_edit.png")
if (HpwRewrite.CheckAdmin(LocalPlayer())) then
sheet2:AddSheet(serverset, serveropt)--, "icon16/cog_edit.png")
end
sheet2:AddSheet(HpwRewrite.Language:GetWord("#listcvar"), cvarList)--, "icon16/script_gear.png")
self:SetupSheetDrawing(sheet2, HpwRewrite.Colors.DarkGrey5)
end
-- Binding GUI
local binding = self:CreateScrollPanel()
do
local tree = vgui.Create("DComboBox", binding)
tree:SetPos(10, 10)
tree:SetSize(436, 30)
tree:SetFont("HPW_gui1")
local function reload()
tree:Clear()
tree:SetText("")
local data, filename = HpwRewrite.DM:ReadBinds()
if data then
for k, v in pairs(data) do
tree:AddChoice(tostring(k))
end
end
end
reload()
local btns = { }
local oldname
-- Swap panel
local Dragging
local Waiting
local PosX = 0
local PosY = 0
local x = 15
local y = 175
local w, h = 55, 55
local swapIcons = { }
local function LoadSwapIcons()
for k, v in pairs(swapIcons) do
if IsValid(v) then v:Remove() end
swapIcons[k] = nil
end
for i = 1, 9 do
local x = x + (i - 1) * (w + 4)
local p = vgui.Create("Panel", binding)
p:SetPos(x, y)
p:SetSize(w+16, h+16)
p.Index = i
p.Bind = HpwRewrite.BM.Binds[i]
local shift = 10
p.Paint = function() end
p.PaintOver = function(p)
local spell, key
if p.Bind then
spell = p.Bind.Spell
key = p.Bind.Key
end
HpwRewrite:DrawSpellRect(spell, key, 8, 8, w, h)
local w = w - 4
local h = h - 4
local color
if p == Dragging then
color = Color(0, 0, 0, 200)
end
if Dragging and Waiting == p.Index then
color = Color(0, 255, 0, 100)
elseif Waiting == p.Index then
color = Color(0, 155, 255, 100)
end
if color then
draw.RoundedBox(6, shift, shift, w, h, color)
end
end
if p.Bind then
p.OnMousePressed = function(p, ms)
if ms == 107 then
surface.PlaySound("hpwrewrite/clickbtn.wav")
Dragging = p
PosX, PosY = p:LocalCursorPos()
end
end
end
p.OnCursorEntered = function(p)
surface.PlaySound("hpwrewrite/enterbtn.wav")
Waiting = p.Index
end
p.OnCursorExited = function(p)
Waiting = nil
end
table.insert(swapIcons, p)
end
end
hook.Add("DrawOverlay", "hpwrewrite_dragndrophandler", function()
if not IsValid(binding) or not binding:IsVisible() then
return
end
if Dragging then
local x, y = gui.MouseX(), gui.MouseY()
x = x - PosX
y = y - PosY
HpwRewrite:DrawSpellRect(Dragging.Bind.Spell, Dragging.Bind.Key, x, y, w, h)
end
end)
-- Main function to initialize binding GUI
-- from bind tree
local createtree = HpwRewrite.Language:GetWord("#createtree")
local createbind = HpwRewrite.Language:GetWord("#createbind")
local bindmenu = HpwRewrite.Language:GetWord("#bindingmenu")
local spellList = HpwRewrite.Language:GetWord("#bindspelllist")
local creator = HpwRewrite.Language:GetWord("#bindtreecreator")
local enter = HpwRewrite.Language:GetWord("#enter")
local untitled = HpwRewrite.Language:GetWord("#untitled")
local modifyBind = HpwRewrite.Language:GetWord("#modifybind")
local modifyKey = HpwRewrite.Language:GetWord("#modifykey")
local removeBind = HpwRewrite.Language:GetWord("#removebind")
local sure2 = HpwRewrite.Language:GetWord("#sure2")
local yes = HpwRewrite.Language:GetWord("#yes")
local no = HpwRewrite.Language:GetWord("#no")
local removetree = HpwRewrite.Language:GetWord("#removetree")
local function loadTree(ltree, name)
for k, v in pairs(btns) do if IsValid(v) then v:Remove() end end
table.Empty(btns)
for k, v in pairs(swapIcons) do
if IsValid(v) then v:Remove() end
swapIcons[k] = nil
end
if not ltree then return end
if not name then return end
HpwRewrite.BM:LoadBinds(name)
tree:SetText(name)
oldname = name
local function createBindingWindow(callback)
local win = self:CreateWindow(400, 100)
win:SetTitle(bindmenu)
win.lblTitle:SetFont("HPW_gui1")
local text = vgui.Create("DTextEntry", win)
text:SetPos(10, 30)
text:SetSize(180, 30)
text:SetText("")
text:SetFont("HPW_gui1")
text.Ghost = ""
text.OnTextChanged = function(text)
for k, v in SortedPairs(HpwRewrite:GetSpells()) do
local txt = text:GetValue()
text.ValidSpell = false
if txt == string.sub(k, 1, txt:len()) then
if txt == k then text.ValidSpell = true end
text.Ghost = k
break
else
text.Ghost = ""
end
end
end
local oldPaint = text.Paint
text.Paint = function(self, w, h)
oldPaint(self, w, h)
draw.SimpleText(self.Ghost, "HPW_gui1", 3, 7, Color(55, 55, 55, 150))
if self.ValidSpell != nil then
local color = Color(255, 0, 0, 80)
if self.ValidSpell then color = Color(0, 255, 0, 80) end
draw.RoundedBox(0, 0, 0, w, h, color)
end
end
local tree = vgui.Create("DComboBox", win)
tree:SetPos(200, 30)
tree:SetSize(190, 30)
tree:SetText(spellList)
for k, v in SortedPairs(HpwRewrite:GetLearnedSpells()) do
tree:AddChoice(k)
end
return win, text, tree
end
local btn = self:CreateButton(createbind, 0, 50, sheetWidth, 60, binding, function()
local win, text, tree = createBindingWindow()
local btn = self:CreateButton(enter, 10, 65, 380, 25, win, function(btn)
timer.Simple(RealFrameTime(), function()
if not IsValid(win) or not IsValid(btn) then return end
btn:SetText(HpwRewrite.Language:GetWord("#pressanykey"))
hook.Add("Think", "hpwrewrite_waitforkeybind", function()
for k, v in pairs(HpwRewrite.BM.Keys) do
if k >= 107 and input.IsMouseDown(k) or input.IsKeyDown(k) then
hook.Remove("Think", "hpwrewrite_waitforkeybind")
local val = tree:GetValue() != spellList and tree:GetValue() or text:GetValue()
if IsValid(win) and IsValid(win.CloseBtn) and not win.CloseBtn:IsDown() then
if not HpwRewrite.BM:AddBindSpell(val, k, name) then
HpwRewrite:DoNotify(Format(HpwRewrite.Language:GetWord("#bindingerror"), HpwRewrite.BM.Keys[k]), 1)
end
binding.ShouldUpdate = true
end
if IsValid(win) then win:Close() end
end
end
end)
end)
end)
end)
btn:SetFont("HPW_gui2")
table.insert(btns, btn)
table.insert(btns, self:CreateLabel(HpwRewrite.Language:GetWord("#dragndrop"), 22, 130, binding))
-- Loading swap icons
LoadSwapIcons()
-- Loading remove buttons
if #ltree > 0 then
table.insert(btns, self:CreateLabel(HpwRewrite.Language:GetWord("#foundbinds"), 22, 258, binding))
local function removeSpellBind(key, name)
local data, filename = HpwRewrite.BM:RemoveBindSpell(key, name)
if data and data[name] then
loadTree(data[name], name)
end
end
local function modifySpellBind(oldSpell, name)
local win, text, tree = createBindingWindow()
local btn = self:CreateButton(enter, 10, 65, 380, 25, win, function(btn)
local val = tree:GetValue() != spellList and tree:GetValue() or text:GetValue()
if IsValid(win) and IsValid(win.CloseBtn) and not win.CloseBtn:IsDown() then
if not HpwRewrite.BM:ModifyBind(oldSpell, val, name) then
HpwRewrite:DoNotify(Format(HpwRewrite.Language:GetWord("#bindingerrorspell"), val), 1)
end
binding.ShouldUpdate = true
end
if IsValid(win) then win:Close() end
end)
end
local function modifySpellBindKey(oldKey, name)
local win = self:CreateWindow(200, 100)
win:SetTitle(modifyBind)
win.lblTitle:SetFont("HPW_gui1")
local lbl = self:CreateLabel(HpwRewrite.Language:GetWord("#pressanykey"), 0, 0, win)
lbl:Dock(FILL)
lbl:SetContentAlignment(5)
timer.Simple(RealFrameTime(), function()
if not IsValid(win) then return end
hook.Add("Think", "hpwrewrite_waitforkeybind", function()
for k, v in pairs(HpwRewrite.BM.Keys) do
if k >= 107 and input.IsMouseDown(k) or input.IsKeyDown(k) then
hook.Remove("Think", "hpwrewrite_waitforkeybind")
local data, filename
if IsValid(win) and IsValid(win.CloseBtn) and not win.CloseBtn:IsDown() then
if not HpwRewrite.BM:ModifyBindKey(oldKey, k, name) then
HpwRewrite:DoNotify(Format(HpwRewrite.Language:GetWord("#bindingerror"), HpwRewrite.BM.Keys[k]), 1)
end
binding.ShouldUpdate = true
end
if IsValid(win) then win:Close() end
end
end
end)
end)
end
for k, v in pairs(ltree) do
table.insert(btns, self:CreateButton(HpwRewrite.BM.Keys[v.Key] .. " - " .. v.Spell, 0, 310 + (k - 1) * 26, 575, 25, binding, function()
-- Create menu to either modify/remove the selected bind
local menu = DermaMenu()
menu:AddOption(modifyBind, function()
modifySpellBind(v.Spell, name)
end):SetIcon("icon16/pencil.png")
menu:AddOption(modifyKey, function()
modifySpellBindKey(v.Key, name)
end):SetIcon("icon16/pencil.png")
menu:AddSpacer()
menu:AddOption(removeBind, function()
removeSpellBind(v.Key, name)
end):SetIcon("icon16/bin_closed.png")
menu:Open()
end))
end
end
end
local btn = self:CreateButton(HpwRewrite.Language:GetWord("#options"), 456, 12, 105, 26, binding, function()
local menu = DermaMenu()
local function createNamingWindow(title)
local win = self:CreateWindow(200, 100)
win:SetTitle(title)
win.lblTitle:SetFont("HPW_gui1")
local text = vgui.Create("DTextEntry", win)
text:SetPos(10, 30)
text:SetSize(180, 30)
text:SetText("")
text:SetFont("HPW_gui1")
return win, text
end
menu:AddOption(createtree, function()
local win, text = createNamingWindow(creator)
local btn = self:CreateButton(enter, 10, 65, 180, 25, win, function(btn)
local val = text:GetValue()
if not val or val == "" then val = untitled end
local data, filename = HpwRewrite.BM:CreateTree(val)
if data and data[val] then
reload()
loadTree(data[val], val)
end
win:Close()
end)
end)
if oldname then
local rename = Format(HpwRewrite.Language:GetWord("#renametree"), oldname)
local renamebindtree = HpwRewrite.Language:GetWord("#renamebindtree")
menu:AddOption(rename, function()
local win, text = createNamingWindow(renamebindtree)
local btn = self:CreateButton(enter, 10, 65, 180, 25, win, function(btn)
local val = text:GetValue()
local data, filename = HpwRewrite.DM:ReadBinds()
if data and data[oldname] then
data[val] = data[oldname]
data[oldname] = nil
file.Write(filename, util.TableToJSON(data))
reload()
loadTree(data[val], val)
end
win:Close()
end)
end)
local duplicate = Format(HpwRewrite.Language:GetWord("#duplicatetree"), oldname)
local duplicatebindtree = HpwRewrite.Language:GetWord("#duplicatebindtree")
menu:AddOption(duplicate, function()
local win, text = createNamingWindow(duplicatebindtree)
local btn = self:CreateButton(enter, 10, 65, 180, 25, win, function(btn)
local newname = text:GetValue()
local data, filename = HpwRewrite.DM:ReadBinds()
if data and data[oldname] and data[newname] == nil and oldname != newname then
data[newname] = data[oldname]
file.Write(filename, util.TableToJSON(data))
reload()
loadTree(data[newname], newname)
end
win:Close()
end)
end)
menu:AddSpacer()
local name = Format(removetree, oldname)
menu:AddOption(name, function()
Derma_Query(sure2, name, yes, function()
if oldname then HpwRewrite.BM:RemoveTree(oldname) end
HpwRewrite.BM:EmptyCurrentBinds()
reload()
loadTree()
end, no)
end)
end
menu:Open()
end)
-- Handlers
tree.OnSelect = function(panel, index, val)
local data, filename = HpwRewrite.DM:ReadBinds()
if data and data[val] then
loadTree(data[val], val)
end
end
binding.Think = function(self)
if self.ShouldUpdate then
if oldname then
local data, filename = HpwRewrite.DM:ReadBinds()
if data and data[oldname] then loadTree(data[oldname], oldname) end
end
self.ShouldUpdate = false
end
if Dragging then
if not input.IsMouseDown(107) then
if Waiting and oldname then
HpwRewrite.BM:MoveBindTo(Dragging.Index, Waiting, oldname)
LoadSwapIcons()
end
Dragging = nil
end
end
end
-- Loading from current tree
local data, filename = HpwRewrite.DM:ReadBinds()
local bind = HpwRewrite.BM.CurTree
if data and data[bind] then
loadTree(data[bind], bind)
end
end
-- Admin panel
local admin
admin = vgui.Create("DPanel", win)
admin.Paint = function() end
local sheet2 = self:CreateSheet(0, 0, sheetWidth, 530, admin)
-- Tab1 - player controlling
do
local buttons = { }
local height = 0
local function EmptyButtons()
for k, v in pairs(buttons) do
v:Remove()
buttons[k] = nil
end
height = 0
end
local spells = self:CreateScrollPanel(nil, nil, nil, nil, win, true)
local selplayer = LocalPlayer()
local InPlayerMenu = false
local function AddPlayers()
InPlayerMenu = false
EmptyButtons()
for k, v in pairs(player.GetAll()) do
local btn = self:CreateButton(v:Name(), 0, (k - 1) * 26, 565, 25, spells, function()
selplayer = v
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(10, 5)
net.WriteEntity(v)
net.SendToServer()
end)
table.insert(buttons, btn)
end
end
local old = spells.Paint
local learned = HpwRewrite.Language:GetWord("#learned")
local learnable = HpwRewrite.Language:GetWord("#learnable")
spells.Paint = function(spells, w, h)
old(spells, w, h)
surface.SetDrawColor(HpwRewrite.Colors.DarkGrey2)
surface.DrawLine(w / 2, 0, w / 2, height > 0 and 28 + height * 26 or 0)
draw.SimpleText(learned, "HPW_gui1", 16, 6, HpwRewrite.Colors.White, TEXT_ALIGN_LEFT)
draw.SimpleText(learnable, "HPW_gui1", w / 2 + 16, 6, HpwRewrite.Colors.White, TEXT_ALIGN_LEFT)
end
local plys = #player.GetAll()
local update = CurTime() + 0.2
local removelrnd = HpwRewrite.Language:GetWord("#removelrnd")
local removelrnbl = HpwRewrite.Language:GetWord("#removelrnbl")
local exit = HpwRewrite.Language:GetWord("#exitplayer")
spells.Think = function()
if ReceivedInfo and PlayerSpells and PlayerLSpells then
self.ShouldUpdate = true
InPlayerMenu = true
EmptyButtons()
height = 0
for k, v in pairs(PlayerSpells) do
local btn = self:CreateButton(v, 0, 30 + (k - 1) * 26, 277, 25, spells, function()
local menu = DermaMenu()
menu:AddOption(removelrnd, function()
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(8, 5)
net.WriteString(v)
net.WriteEntity(selplayer)
net.SendToServer()
end)
menu:Open()
end)
table.insert(buttons, btn)
height = math.max(height, k)
end
for k, v in pairs(PlayerLSpells) do
local btn = self:CreateButton(v, 280, 30 + (k - 1) * 26, 287, 25, spells, function()
local menu = DermaMenu()
menu:AddOption(removelrnbl, function()
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(9, 5)
net.WriteString(v)
net.WriteEntity(selplayer)
net.SendToServer()
end)
menu:Open()
end)
table.insert(buttons, btn)
height = math.max(height, k)
end
local name = ""
if IsValid(selplayer) then name = " " .. selplayer:Name() end
local btn = self:CreateButton(Format(exit, name), 0, 30 + height * 26, 565, 25, spells, AddPlayers)
btn.EnterColor = HpwRewrite.Colors.Red
table.insert(buttons, btn)
ReceivedInfo = false
end
if not InPlayerMenu and CurTime() > update then
local amount = #player.GetAll()
if plys != amount then AddPlayers() plys = amount end
update = CurTime() + 0.2
end
end
AddPlayers()
sheet2:AddSheet(HpwRewrite.Language:GetWord("#playerspells"), spells, "icon16/table.png")
end
-- Tab2 - manager
do
local spells = self:CreateScrollPanel(nil, nil, nil, nil, win, true)
local btn = self:CreateButton(Format(HpwRewrite.Language:GetWord("#foundspells"), table.Count(HpwRewrite:GetSpells())), 0, 0, 340, 25, spells, function()
end)
local btn = self:CreateButton(HpwRewrite.Language:GetWord("#printconfig"), 341, 0, 220, 25, spells, function()
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(13, 5)
net.SendToServer()
end)
local i = 1
local unknown = HpwRewrite.Language:GetWord("#unknownoption")
local enter = HpwRewrite.Language:GetWord("#enter")
local invalid = HpwRewrite.Language:GetWord("#invalidplayer")
local defaultSkin = HpwRewrite.Language:GetWord("#setdefskin")
local addtoblack = HpwRewrite.Language:GetWord("#inblacklist")
local addtoadminonly = HpwRewrite.Language:GetWord("#inadminonly")
for k, v in SortedPairs(HpwRewrite:GetSpells()) do
local yPos = i * 26
local btn = self:CreateButton(k, 0, yPos, 340, 25, spells, function()
local menu = DermaMenu()
for on, o in pairs(options) do
menu:AddOption(on, function()
local opt = options[on]
if not opt then
HpwRewrite:DoNotify(HpwRewrite.Language:GetWord("#unknown"), 1)
return
end
local win = self:CreateWindow(200, 100)
win:SetTitle(on)
win.lblTitle:SetFont("HPW_gui1")
local ply = vgui.Create("DComboBox", win)
ply:SetPos(10, 30)
ply:SetSize(180, 30)
ply:SetText("Player")
for a, b in pairs(player.GetAll()) do
ply:AddChoice(b:Name())
end
local btn = self:CreateButton(enter, 10, 65, 180, 25, win, function()
local sel
for a, b in pairs(player.GetAll()) do
if b:Name() == ply:GetValue() then
sel = b
break
end
end
if not sel then
HpwRewrite:DoNotify(invalid, 1)
return
end
opt(sel, k)
win:Close()
end)
end)
end
for on, o in pairs(options2) do
menu:AddOption(on, function() o(k) end)
end
if v.IsSkin then
menu:AddOption(defaultSkin, function()
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(1, 5)
net.WriteString(k)
net.SendToServer()
end)
end
menu:AddOption("Show info", function() CreateInfoPanel(k) end)
menu:Open()
end)
local btn = self:CreateButton(addtoblack, 341, yPos, 107, 25, spells, function()
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(11, 5)
net.WriteString(k)
net.SendToServer()
end)
local old = btn.Think
btn.Think = function(btn)
old(btn)
btn:SetColor(HpwRewrite:IsSpellInBlacklist(k) and HpwRewrite.Colors.Red or HpwRewrite.Colors.Green)
end
local btn = self:CreateButton(addtoadminonly, 449, yPos, 107, 25, spells, function()
net.Start("hpwrewrite_AdminFunctions")
net.WriteUInt(12, 5)
net.WriteString(k)
net.SendToServer()
end)
local old = btn.Think
btn.Think = function(btn)
old(btn)
btn:SetColor(HpwRewrite:IsSpellInAdminOnly(k) and HpwRewrite.Colors.Red or HpwRewrite.Colors.Green)
end
i = i + 1
end
sheet2:AddSheet(HpwRewrite.Language:GetWord("#manager"), spells, "icon16/report_edit.png")
end
self:SetupSheetDrawing(sheet2, HpwRewrite.Colors.DarkGrey5)
if not HpwRewrite.CVars.HideTree:GetBool() then
sheet:AddSheet(HpwRewrite.Language:GetWord("#maintree"), newspells)
end
sheet:AddSheet(HpwRewrite.Language:GetWord("#spelllist"), spells)
sheet:AddSheet(HpwRewrite.Language:GetWord("#wandskins"), skins)
sheet:AddSheet(HpwRewrite.Language:GetWord("#spellbinding"), binding)
sheet:AddSheet(HpwRewrite.Language:GetWord("#settingshelp"), info)
if (not game.SinglePlayer() or HpwRewrite.CVars.DebugMode:GetBool()) and HpwRewrite.CheckAdmin(LocalPlayer()) then
sheet:AddSheet(HpwRewrite.Language:GetWord("#adminpanel"), admin)
end
-- Updating window
do
local oldThink = win.Think
local SpellLearning = false
local oldSkin
local wand = HpwRewrite:GetWand(LocalPlayer())
if wand:IsValid() then oldSkin = wand:GetWandCurrentSkin() end
win.Think = function(win)
oldThink(win)
--win:SetSize(800 + math.sin(CurTime()) * 100, 600 + math.cos(CurTime()) * 100)
if not win.Escape then win.Escape = false end
local oldEscape = win.Escape
win.Escape = input.IsKeyDown(KEY_ESCAPE)
if win:IsVisible() and win.Escape != oldEscape and win.Escape then
win:Close()
if gui.IsGameUIVisible() then
gui.HideGameUI()
end
end
--[[if SpellLearning != HpwRewrite.Learning then
SpellLearning = HpwRewrite.Learning
if SpellLearning then
if HpwRewrite.LearningSpellName then
win.OldTitle = win.lblTitle:GetText()
win:SetTitle("Learning " .. HpwRewrite.LearningSpellName .. "...")
end
else
if win.OldTitle then win:SetTitle(win.OldTitle) end
end
end]]
if IsValid(wand) then
local newSkin = wand:GetWandCurrentSkin()
if newSkin != oldSkin then
self.ShouldUpdate = true
oldSkin = newSkin
end
end
if self.ShouldUpdate then
AddSpells()
if rememberSpell then CreateInfoPanel(rememberSpell) end
self.ShouldUpdate = false
end
rembemberTab = sheet:GetActiveTab():GetText()
end
end
if rememberSpell then CreateInfoPanel(rememberSpell) end
if rembemberTab then sheet:SwitchToName(rembemberTab) end
self:SetupSheetDrawing(sheet)
return win
end
|
-------------------------------
-- "Dracula" awesome theme --
-- By Tony A. (POPCORNrules) --
-------------------------------
local themes_path = require("gears.filesystem").get_themes_dir()
local current_theme_dir = os.getenv("HOME") .. "/.config/awesome/themes/dracula"
local dpi = require("beautiful.xresources").apply_dpi
-- {{{ Main
local theme = {}
theme.wallpaper = current_theme_dir .. "/wallpaper.png"
-- }}}
-- {{{ Styles
theme.font = "mononoki Nerd Font 9"
-- {{{ Colors
theme.fg_normal = "#9580FF"
theme.fg_focus = "#80FFEA"
theme.fg_urgent = "#FF9580"
theme.bg_normal = "#22212C"
theme.bg_focus = "#504C67"
theme.bg_urgent = theme.bg_normal
theme.bg_systray = theme.bg_normal
-- }}}
-- {{{ Borders
theme.useless_gap = dpi(0)
theme.border_width = dpi(2)
theme.border_normal = "#22212C"
theme.border_focus = "#504C67"
theme.border_marked = "#FF80BF"
-- }}}
-- {{{ Titlebars
theme.titlebar_bg_focus = "#504C67"
theme.titlebar_bg_normal = "#22212C"
-- }}}
-- There are other variable sets
-- overriding the default one when
-- defined, the sets are:
-- [taglist|tasklist]_[bg|fg]_[focus|urgent|occupied|empty|volatile]
-- titlebar_[normal|focus]
-- tooltip_[font|opacity|fg_color|bg_color|border_width|border_color]
-- Example:
--theme.taglist_bg_focus = "#FF80BF"
-- }}}
-- {{{ Widgets
-- You can add as many variables as
-- you wish and access them by using
-- beautiful.variable in your rc.lua
--theme.fg_widget = "#8AFF80
--theme.fg_center_widget = "#A2FF99"
--theme.fg_end_widget = "#FF5656"
--theme.bg_widget = "#494B4F"
--theme.border_widget = "#504C67"
-- }}}
-- {{{ Mouse finder
theme.mouse_finder_color = "#FF80BF"
-- mouse_finder_[timeout|animate_timeout|radius|factor]
-- }}}
-- {{{ Menu
-- Variables set for theming the menu:
-- menu_[bg|fg]_[normal|focus]
-- menu_[border_color|border_width]
theme.menu_height = dpi(15)
theme.menu_width = dpi(100)
-- }}}
-- {{{ Icons
-- {{{ Taglist
theme.taglist_squares_sel = current_theme_dir .. "/taglist/squarefz.png"
theme.taglist_squares_unsel = current_theme_dir .. "/taglist/squarez.png"
--theme.taglist_squares_resize = "false"
-- }}}
-- {{{ Misc
theme.awesome_icon = current_theme_dir .. "/awesome-icon.png"
theme.menu_submenu_icon = themes_path .. "default/submenu.png"
-- }}}
-- {{{ Layout
theme.layout_tile = current_theme_dir .. "/layouts/tile.png"
theme.layout_tileleft = current_theme_dir .. "/layouts/tileleft.png"
theme.layout_tilebottom = current_theme_dir .. "/layouts/tilebottom.png"
theme.layout_tiletop = current_theme_dir .. "/layouts/tiletop.png"
theme.layout_fairv = current_theme_dir .. "/layouts/fairv.png"
theme.layout_fairh = current_theme_dir .. "/layouts/fairh.png"
theme.layout_spiral = current_theme_dir .. "/layouts/spiral.png"
theme.layout_dwindle = current_theme_dir .. "/layouts/dwindle.png"
theme.layout_max = current_theme_dir .. "/layouts/max.png"
theme.layout_fullscreen = current_theme_dir .. "/layouts/fullscreen.png"
theme.layout_magnifier = current_theme_dir .. "/layouts/magnifier.png"
theme.layout_floating = current_theme_dir .. "/layouts/floating.png"
theme.layout_cornernw = current_theme_dir .. "/layouts/cornernw.png"
theme.layout_cornerne = current_theme_dir .. "/layouts/cornerne.png"
theme.layout_cornersw = current_theme_dir .. "/layouts/cornersw.png"
theme.layout_cornerse = current_theme_dir .. "/layouts/cornerse.png"
-- }}}
-- {{{ Titlebar
theme.titlebar_close_button_focus = current_theme_dir .. "/titlebar/close_focus.png"
theme.titlebar_close_button_normal = current_theme_dir .. "/titlebar/close_normal.png"
theme.titlebar_minimize_button_normal = themes_path .. "default/titlebar/minimize_normal.png"
theme.titlebar_minimize_button_focus = themes_path .. "default/titlebar/minimize_focus.png"
theme.titlebar_ontop_button_focus_active = current_theme_dir .. "/titlebar/ontop_focus_active.png"
theme.titlebar_ontop_button_normal_active = current_theme_dir .. "/titlebar/ontop_normal_active.png"
theme.titlebar_ontop_button_focus_inactive = current_theme_dir .. "/titlebar/ontop_focus_inactive.png"
theme.titlebar_ontop_button_normal_inactive = current_theme_dir .. "/titlebar/ontop_normal_inactive.png"
theme.titlebar_sticky_button_focus_active = current_theme_dir .. "/titlebar/sticky_focus_active.png"
theme.titlebar_sticky_button_normal_active = current_theme_dir .. "/titlebar/sticky_normal_active.png"
theme.titlebar_sticky_button_focus_inactive = current_theme_dir .. "/titlebar/sticky_focus_inactive.png"
theme.titlebar_sticky_button_normal_inactive = current_theme_dir .. "/titlebar/sticky_normal_inactive.png"
theme.titlebar_floating_button_focus_active = current_theme_dir .. "/titlebar/floating_focus_active.png"
theme.titlebar_floating_button_normal_active = current_theme_dir .. "/titlebar/floating_normal_active.png"
theme.titlebar_floating_button_focus_inactive = current_theme_dir .. "/titlebar/floating_focus_inactive.png"
theme.titlebar_floating_button_normal_inactive = current_theme_dir .. "/titlebar/floating_normal_inactive.png"
theme.titlebar_maximized_button_focus_active = current_theme_dir .. "/titlebar/maximized_focus_active.png"
theme.titlebar_maximized_button_normal_active = current_theme_dir .. "/titlebar/maximized_normal_active.png"
theme.titlebar_maximized_button_focus_inactive = current_theme_dir .. "/titlebar/maximized_focus_inactive.png"
theme.titlebar_maximized_button_normal_inactive = current_theme_dir .. "/titlebar/maximized_normal_inactive.png"
-- }}}
-- }}}
return theme
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
|
-- Called when chat message sent
function ChatControl(args)
-- Change players vehicle color
if args.text:sub(0,13) == "/vehicleColor" or args.text:sub(0,13) == "/vehiclecolor"then
-- Check if player is in vehicle
if args.player:InVehicle() == false then
args.player:SendChatMessage("You must be in a vehicle to set the color of a vehicle",
colorError)
return false
end
-- Make sure args has sub args
if args.text:len() < 14 then
return false
end
-- Cut command from args
local text = args.text:sub(15, args.text:len())
-- Find first space
local space1 = text:find("%s")
-- Return if no space
if space1 == nil then return false end
-- Convert space to number
space1 = tonumber(space1)
-- Find second space
local space2 = text:find("%s",space1+1)
-- Return if no second space
if space2 == nil then return false end
space2 = tonumber(space2)
-- Set vehicle color
local color = Color(
tonumber(text:sub(0,space1)),
tonumber(text:sub(space1+1,space2)),
tonumber(text:sub(space2+1,text:len())))
args.player:GetVehicle():SetColors( color, color )
args.player:SendChatMessage("Vehicle color set to this", color)
return false
end
-- Change the vehicle mass of your car
if args.text:sub(0,5) == "/mass" then
-- Return if not in vehicle
if args.player:InVehicle() == false then
args.player:SendChatMessage("You must be in a vehicle to set mass of a vehicle", colorError)
return false
end
-- Grab the mass value
local massv = args.text:sub(7,args.text:len())
-- Get vehicle
local veh = args.player:GetVehicle()
veh:SetMass(tonumber(massv))
args.player:SendChatMessage("Vehicle mass set to " .. massv, colorCommand)
return false
end
-- Repair vehicle
if args.text == "/repair" then
-- Return if not in vehicle
if args.player:InVehicle() == false then
args.player:SendChatMessage("You must be in a vehicle to repair a vehicle", colorError)
return false
end
-- Get vehicle
local veh = args.player:GetVehicle()
veh:SetHealth(100)
-- Make copy of properties
--[[local args2 = {}
args2.id = veh:GetModelId()
args2.color1, args2.color2 = veh:GetColors()
veh:Remove()
-- Put player in new vehicle
SpawnVehicle(args2, args.player)]]--
args.player:SendChatMessage("Vehicle repaired!", colorCommand)
return false
end
-- Spawn a vehicle and put them inside it.
if args.text:sub(0,8) == "/vehicle" then
local args2 = {id=tonumber(args.text:sub(10,args.text:len()))}
SpawnVehicle(args2, args.player)
return false
end
end
-- Set current vehicle color
function SetVehicleColor(args, player)
if args.color1 == nil then args.color1 = Color(255,255,255) end
if args.color2 == nil then args.color2 = args.color1 end
player:GetVehicle():SetColors( args.color1, args.color2 )
player:SendChatMessage("Vehicle color set to this", args.color1)
end
-- Call to spawn a vehicle
function SpawnVehicle(args, player)
-- Get out of vehicle if in one
if player:InVehicle() then
local veh = player:GetVehicle()
veh:Remove()
end
-- Vehicle spawn arguments
spawnArgs = {}
spawnArgs.model_id = args.id
spawnArgs.position = player:GetPosition()
spawnArgs.angle = player:GetAngle()
-- Create vehicle
local vehicle = Vehicle.Create(spawnArgs)
vehicle:SetDeathRemove(true)
vehicle:SetInvulnerable(false)
vehicle:SetUnoccupiedRemove(true)
player:EnterVehicle(vehicle, VehicleSeat.Driver)
-- Display chat message
Chat:Broadcast(player:GetName() .. " - Spawned Vehicle (" .. tostring(args.id) ..
": " .. Vehicle.GetNameByModelId(args.id) .. ")", colorCommand)
-- Try and set colors
local color1 = args.color1
if color1 == nil then return end
local color2 = args.color2
if color2 == nil then color2 = color1 end
vehicle:SetColors( color1, color2 )
end
Events:Subscribe("PlayerChat", ChatControl)
Network:Subscribe("SpawnVehicle", SpawnVehicle)
Network:Subscribe("SetVehicleColor", SetVehicleColor)
|
-- Simple 911 Command (With Location & Blip) --
-- Made By Chezza --
displayTime = 300 -- Refreshes Blips every 5 Minutes by Default --
-- Code --
blip = nil
blips = {}
Citizen.CreateThread(function()
TriggerEvent('chat:addSuggestion', '/911', 'Envia una llamada de entorno a la Policia!', {
{ name="Denuncia", help="Escribe tu denuncia aqui!" }
})
end)
Citizen.CreateThread(function()
TriggerEvent('chat:addSuggestion', '/entorno', 'Envia un entorno amistoso!', {
{ name="Entorno", help="Escribe tu entorno aqui!" }
})
end)
Citizen.CreateThread(function()
TriggerEvent('chat:addSuggestion', '/mecanico', 'Envia un aviso al mecanico!', {
{ name="Mecanico", help="Escribe tu aviso aqui!" }
})
end)
RegisterNetEvent('911:setBlip')
AddEventHandler('911:setBlip', function(name, x, y, z)
local blip = AddBlipForCoord(x, y, z)
SetBlipSprite(blip, 58)
SetBlipScale(blip, 1.0)
SetBlipColour(blip, 3)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString('Llamada al 911')
EndTextCommandSetBlipName(blip)
table.insert(blips, blip)
Wait(displayTime * 1000)
for i, blipq in pairs(blips) do
if blip == blipq then
RemoveBlip(blip)
end
end
end)
RegisterNetEvent('911:setBlipMecanico')
AddEventHandler('911:setBlipMecanico', function(name, x, y, z)
local blip = AddBlipForCoord(x, y, z)
SetBlipSprite(blip, 446)
SetBlipScale(blip, 1.0)
SetBlipColour(blip, 47)
BeginTextCommandSetBlipName("STRING")
AddTextComponentString('Llamada al Mecanico')
EndTextCommandSetBlipName(blip)
table.insert(blips, blip)
Wait(displayTime * 1000)
for i, blipq in pairs(blips) do
if blip == blipq then
RemoveBlip(blip)
end
end
end)
-- Command --
RegisterCommand('911', function(source, args)
local name = GetPlayerName(PlayerId())
local ped = GetPlayerPed(PlayerId())
local x, y, z = table.unpack(GetEntityCoords(ped, true))
local street = GetStreetNameAtCoord(x, y, z)
local location = GetStreetNameFromHashKey(street)
local msg = table.concat(args, ' ')
if args[1] == nil then
TriggerEvent('chat:addMessage', {
template = '<div style="padding: 3px; margin: 0.5vw; background-color: rgb(0, 154, 249); border-radius: 3px;"><i style="margin-left: 5px;" class="fas fa-phone-square"></i> {0}</div>',
args = {"^1911: ^7Porfavor, escribe aqui tu ^1Denuncia."}})
else
TriggerServerEvent('911', location, msg, x, y, z, name)
end
end)
RegisterCommand('entorno', function(source, args)
local name = GetPlayerName(PlayerId())
local ped = GetPlayerPed(PlayerId())
local x, y, z = table.unpack(GetEntityCoords(ped, true))
local street = GetStreetNameAtCoord(x, y, z)
local location = GetStreetNameFromHashKey(street)
local msg = table.concat(args, ' ')
if args[1] == nil then
TriggerEvent('chat:addMessage', {
template = '<div style="padding: 3px; margin: 0.5vw; background-color: rgb(72, 175, 201); border-radius: 3px;"><i style="margin-left: 5px;" class="fas fa-phone-square"></i> {0}</div>',
args = {"^1Entorno: ^7Porfavor, escribe aqui tu ^1Entorno."}})
else
TriggerServerEvent('entorno', location, msg, x, y, z, name)
end
end)
RegisterCommand('mecanico', function(source, args)
local name = GetPlayerName(PlayerId())
local ped = GetPlayerPed(PlayerId())
local x, y, z = table.unpack(GetEntityCoords(ped, true))
local street = GetStreetNameAtCoord(x, y, z)
local location = GetStreetNameFromHashKey(street)
local msg = table.concat(args, ' ')
if args[1] == nil then
TriggerEvent('chat:addMessage', {
template = '<div style="padding: 3px; margin: 0.5vw; background-color: rgb(223, 100, 0); border-radius: 3px;"><i style="margin-left: 5px;" class="fas fa-phone-square"></i> {0}</div>',
args = {"^1Mecanico: ^7Porfavor, escribe aqui tu ^1Aviso."}})
else
TriggerServerEvent('mecanico', location, msg, x, y, z, name)
end
end)
|
wrk.method = "PUT"
wrk.body = '["455","456","457","458","459","460","461","462","463","464","465","466","467","468","469","470","471","472","473","474","475","476","477","478","479","480","481","482","483","484"]'
wrk.headers["Content-Type"] = "application/json"
-- '["455","456","457","458","459","460","461","462","463","464","465","466","467","468","469","470","471","472","473","474","475","476","477","478","479","480","481","482","483","484","485","486","487","488","489","490","491","492","493","494","495","496","497","498","499","500","501","502","503","504","505","506","507","508","509","510","511","512","513","514","515","516","517","518","519","520","521","522","523","524","525","526","527","528","529","530","531","532","533","534","535","536","537","538","539","540","541","542","543","544","545","546","547","548","549","550","551","552","553","554"]'
|
vim.cmd [[
nnoremap <silent> ct :lua require('crates').toggle()<cr>
nnoremap <silent> cr :lua require('crates').reload()<cr>
nnoremap <silent> cv :lua require('crates').show_versions_popup()<cr>
nnoremap <silent> cf :lua require('crates').show_features_popup()<cr>
nnoremap <silent> cu :lua require('crates').update_crate()<cr>
vnoremap <silent> cu :lua require('crates').update_crates()<cr>
nnoremap <silent> ca :lua require('crates').update_all_crates()<cr>
nnoremap <silent> cU :lua require('crates').upgrade_crate()<cr>
vnoremap <silent> cU :lua require('crates').upgrade_crates()<cr>
nnoremap <silent> cA :lua require('crates').upgrade_all_crates()<cr>
]]
require("crates").setup()
|
function ARCreateStaticVBOs(vtype,vertcount,indexcount,doallocs)
local vsize = vtype:memsize()*vertcount
local vbo = vidbuffer.new(vidtype.vertex(),vidhint.draw(1),
vsize)
-- indices are either 16bit or 32bit depending on vertexcount
local is16bit = vertcount <= 65536
local isize = (is16bit and 2 or 4)*indexcount
local ibo = vidbuffer.new(vidtype.index(),vidhint.draw(1),
isize)
if (doallocs) then
ibo:localalloc(isize)
vbo:localalloc(vsize)
end
return vbo,ibo,is16bit
end
|
local socket = require("socket")
local http = require("socket.http")
require("love.timer")
function download_available_versions(server_url, timeout, max_size, timestamp_file)
local body = ""
local all_versions = {}
http.request{
url=server_url,
create=function()
local req_sock = socket.tcp()
-- note the second parameter here
if timeout then req_sock:settimeout(timeout, 't') end
return req_sock
end,
sink=function(chunk, err)
if chunk == nil then return false end
body = body..chunk
return max_size == nil or #body < max_size
end
}
if body ~= "" then
for w in body:gmatch('<a href="([/%w_-]+)%.love">') do
all_versions[#all_versions+1] = w:gsub("^/[/%w_-]+/", "")
end
end
if #all_versions > 0 then
table.sort(all_versions, function(a,b) return a>b end)
for i=1,#all_versions do
all_versions[i] = all_versions[i]..'.love'
end
if timestamp_file then
love.filesystem.write(timestamp_file, os.time())
end
end
love.thread.getChannel("download_available_versions"):push(all_versions)
end
function download_file(server_filepath, local_filepath)
local body = http.request(server_filepath)
love.filesystem.write(local_filepath, body)
love.thread.getChannel("download_file"):push(true)
end
function download_lastest_version(server_url, local_path, version_file, local_version)
download_available_versions(server_url, nil, nil)
local versions = nil
while versions == nil do
versions = love.thread.getChannel("download_available_versions"):pop()
love.timer.sleep(0.2)
end
if #versions > 0 and versions[1] ~= local_version then
download_file(server_url.."/"..versions[1], local_path..versions[1])
local downloaded = nil
while downloaded == nil do
downloaded = love.thread.getChannel("download_file"):pop()
love.timer.sleep(0.2)
end
if downloaded then
love.filesystem.write(version_file, versions[1])
love.thread.getChannel("download_lastest_version"):push(true)
return
end
end
love.thread.getChannel("download_lastest_version"):push(false)
end
local ftable = {
download_available_versions= download_available_versions,
download_file= download_file,
download_lastest_version= download_lastest_version,
}
ftable[select(1, ...)](select(2, ...))
|
package("opencolorio")
set_homepage("https://opencolorio.org/")
set_description("A complete color management solution geared towards motion picture production with an emphasis on visual effects and computer animation.")
set_license("BSD-3-Clause")
add_urls("https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/refs/tags/$(version).tar.gz",
"https://github.com/AcademySoftwareFoundation/OpenColorIO.git")
add_versions("v2.1.0", "81fc7853a490031632a69c73716bc6ac271b395e2ba0e2587af9995c2b0efb5f")
add_versions("v2.1.1", "16ebc3e0f21f72dbe90fe60437eb864f4d4de9c255ef8e212f837824fc9b8d9c")
add_deps("cmake", "expat", "yaml-cpp", "imath", "pystring")
if is_plat("windows") then
add_syslinks("user32", "gdi32")
elseif is_plat("macosx") then
add_frameworks("CoreFoundation", "CoreGraphics", "ColorSync", "IOKit")
end
on_load("windows", function (package)
if not package:config("shared") then
package:add("defines", "OpenColorIO_SKIP_IMPORTS")
end
end)
on_install("windows", "macosx", "linux", function (package)
local configs = {"-DOCIO_BUILD_APPS=OFF", "-DOCIO_BUILD_OPENFX=OFF", "-DOCIO_BUILD_PYTHON=OFF", "-DOCIO_BUILD_DOCS=OFF", "-DOCIO_BUILD_TESTS=OFF", "-DOCIO_BUILD_GPU_TESTS=OFF"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <OpenColorIO/OpenColorIO.h>
namespace OCIO = OCIO_NAMESPACE;
void test() {
OCIO::ConstConfigRcPtr config = OCIO::GetCurrentConfig();
OCIO::ConstProcessorRcPtr processor =
config->getProcessor(OCIO::ROLE_COMPOSITING_LOG, OCIO::ROLE_SCENE_LINEAR);
OCIO::ConstCPUProcessorRcPtr cpu = processor->getDefaultCPUProcessor();
}
]]}, {configs = {languages = "c++17"}}))
end)
|
local keyboard = {}
local state = {
down = {},
pressed = {},
released = {}
}
function keyboard.wasPressed(...)
for i,v in ipairs({...}) do
if state.pressed[v] == true then return true end
end
return false
end
function keyboard.wasReleased(...)
for i,v in ipairs({...}) do
if state.released[v] == true then return true end
end
return false
end
function keyboard.isDown(...)
for i,v in ipairs({...}) do
if state.down[v] == true then return true end
end
return false
end
function keyboard.keypressed(k)
state.down[k] = true
state.pressed[k] = true
end
function keyboard.keyreleased(k)
state.down[k] = false
state.released[k] = true
end
function keyboard.clear()
for i,v in pairs(state.pressed) do
state.pressed[i] = false
end
for i,v in pairs(state.released) do
state.released[i] = false
end
end
return keyboard
|
local NoobTacoUI, E, L, V, P, G = unpack(select(2, ...))
function NoobTacoUI:SetupTooltips()
-- TOOLTIPS ---------------------------------------------------------------
E.db["tooltip"]["textFontSize"] = 14
E.db["tooltip"]["font"] = "Montserrat-Bold"
E.db["tooltip"]["healthBar"]["height"] = 10
E.db["tooltip"]["healthBar"]["font"] = "Montserrat-Bold"
E.db["tooltip"]["healthBar"]["fontOutline"] = "NONE"
E.db["tooltip"]["smallTextFontSize"] = 14
E.db["tooltip"]["colorAlpha"] = 1
E.db["tooltip"]["headerFontSize"] = 14
end
|
local Rx = require 'rx'
-- Create an observable that produces a single value and print it.
Rx.Observable.of(42):subscribe(print)
|
slot0 = ClassLoader:aquireClass("BaseNode")
slot1 = ClassLoader:aquireClass("Tools")
slot2 = class_C("Timer", function ()
return slot0:create()
end)
slot2.REPEAT_FOREVER = -1
slot2.ctor = function (slot0)
slot0._paused = true
slot0._counter = 0
slot0._schemeSize = 0
slot0._schemes = {}
slot0._namedMaps = {}
end
slot2.onEnter = function (slot0)
slot0._entry = cc.Director:getInstance():getScheduler():scheduleScriptFunc(slot0:thisCall(slot1.scheduler, slot0), 0, false)
end
slot2.onExit = function (slot0)
cc.Director:getInstance():getScheduler():unscheduleScriptEntry(slot0._entry)
end
slot2.scheduler = function (slot0, slot1)
if not slot0._paused then
slot0._counter = slot0._counter + slot1
slot2 = slot0._schemeSize
slot3 = 1
for slot7 = 1, slot0._schemeSize, 1 do
slot0:processScheme(slot0._schemes[slot7], slot1)
if slot0._schemes[slot7] then
if slot3 ~= slot7 then
slot0._schemes[slot7].id = slot3
slot0._schemes[slot3] = slot0._schemes[slot7]
slot0._schemes[slot7] = nil
end
slot3 = slot3 + 1
end
end
for slot7 = slot2, slot0._schemeSize, 1 do
if slot0._schemes[slot7] then
if slot3 ~= slot7 then
slot0._schemes[slot3] = slot0._schemes[slot7]
slot0._schemes[slot7] = nil
end
slot3 = slot3 + 1
end
end
slot0._schemeSize = slot3 - 1
end
end
slot2.addScheme = function (slot0, slot1, slot2, slot3, slot4)
if slot4 and slot0._namedMaps[slot4] then
return
end
slot0._schemeSize = slot0._schemeSize + 1
slot0._schemes[slot0._schemeSize] = {
paused = false,
counter = 0,
removed = false,
task = slot1 or function ()
return
end,
interval = slot2 or 0,
repeat_times = slot3 or slot0.REPEAT_FOREVER,
name = slot4,
id = slot0._schemeSize
}
if slot4 then
slot0._namedMaps[slot4] = slot5
end
return slot5
end
slot2.processScheme = function (slot0, slot1, slot2)
if slot1 and not slot1.paused and slot1.repeat_times ~= 0 then
if slot1.interval == 0 then
slot1.task()
slot1.repeat_times = slot1.repeat_times - 1
else
slot1.counter = slot1.counter + slot2
while slot1.interval <= slot1.counter and slot1.repeat_times ~= 0 do
slot1.counter = slot1.counter - slot1.interval
slot1.task()
slot1.repeat_times = slot1.repeat_times - 1
end
end
if slot1.repeat_times == 0 then
slot0:removeScheme(slot1)
end
end
end
slot2.removeScheme = function (slot0, slot1)
if slot1 and not slot1.removed then
slot1.removed = true
slot0._schemes[slot1.id] = nil
if slot1.name then
slot0._namedMaps[slot1.name] = nil
end
end
end
slot2.resetScheme = function (slot0, slot1)
if slot1 and not slot1.removed then
slot1.counter = 0
end
end
slot2.pauseScheme = function (slot0, slot1)
if slot1 and not slot1.removed then
slot1.pause = true
end
end
slot2.startScheme = function (slot0, slot1)
if slot1 and not slot1.removed then
slot1.pause = false
end
end
slot2.removeSchemeByName = function (slot0, slot1)
slot0:removeScheme(slot0._namedMaps[slot1])
end
slot2.resetSchemeByName = function (slot0, slot1)
slot0:resetScheme(slot0._namedMaps[slot1])
end
slot2.pauseSchemeByName = function (slot0, slot1)
slot0:removeScheme(slot0._namedMaps[slot1])
end
slot2.startSchemeByName = function (slot0, slot1)
slot0:pauseScheme(slot0._namedMaps[slot1])
end
slot2.start = function (slot0)
slot0._paused = false
end
slot2.reset = function (slot0)
slot0._counter = 0
for slot4 = 1, slot0._schemeSize, 1 do
slot0:resetScheme(slot0._schemes[slot4])
end
end
slot2.pause = function (slot0)
slot0._paused = true
end
slot2.stop = function (slot0)
slot0._counter = 0
slot0._paused = true
for slot4 = 1, slot0._schemeSize, 1 do
slot0:removeScheme(slot0._schemes[slot4])
end
end
return slot2
|
local shared = require("scripts.stageapi.shared")
local mod = require("scripts.stageapi.mod")
StageAPI.LogMinor("Loading Custom Door Handler")
StageAPI.DoorToDirection = {
[DoorSlot.DOWN0] = Direction.DOWN,
[DoorSlot.DOWN1] = Direction.DOWN,
[DoorSlot.LEFT0] = Direction.LEFT,
[DoorSlot.LEFT1] = Direction.LEFT,
[DoorSlot.RIGHT0] = Direction.RIGHT,
[DoorSlot.RIGHT1] = Direction.RIGHT,
[DoorSlot.UP0] = Direction.UP,
[DoorSlot.UP1] = Direction.UP
}
StageAPI.DoorOffsetsByDirection = {
[Direction.DOWN] = Vector(0, -23),
[Direction.UP] = Vector(0, 23),
[Direction.LEFT] = Vector(23, 0),
[Direction.RIGHT] = Vector(-23, 0)
}
StageAPI.SecretDoorOffsetsByDirection = {
[Direction.DOWN] = Vector(0, 0),
[Direction.UP] = Vector(0, 0),
[Direction.LEFT] = Vector(0, 0),
[Direction.RIGHT] = Vector(0, 0)
}
function StageAPI.DirectionToDegrees(dir)
return dir * 90 - 90
end
StageAPI.CustomDoorGrid = StageAPI.CustomGrid("CustomDoor")
StageAPI.DoorTypes = {}
StageAPI.CustomDoor = StageAPI.Class("CustomDoor")
function StageAPI.CustomDoor:Init(name, anm2, openAnim, closeAnim, openedAnim, closedAnim, noAutoHandling, alwaysOpen, exitFunction, directionOffsets, transitionAnim)
self.NoAutoHandling = noAutoHandling
self.AlwaysOpen = alwaysOpen
self.Anm2 = anm2 or "gfx/grid/door_01_normaldoor.anm2"
self.OpenAnim = openAnim or "Open"
self.CloseAnim = closeAnim or "Close"
self.OpenedAnim = openedAnim or "Opened"
self.ClosedAnim = closedAnim or "Closed"
self.ExitFunction = exitFunction
self.DirectionOffsets = directionOffsets
self.TransitionAnim = transitionAnim
self.Name = name
StageAPI.DoorTypes[name] = self
end
StageAPI.CustomStateDoor = StageAPI.Class("CustomStateDoor")
function StageAPI.CustomStateDoor:Init(name, anm2, states, exitFunction, overlayAnm2, directionOffsets)
self.Anm2 = anm2 or "gfx/grid/door_01_normaldoor.anm2"
self.OverlayAnm2 = overlayAnm2 -- optional, uses a separate sprite rather than an overlay anim for overlay animations
self.States = states
self.ExitFunction = exitFunction
self.IsCustomStateDoor = true
self.DirectionOffsets = directionOffsets
StageAPI.DoorTypes[name] = self
end
function StageAPI.CustomStateDoor:SetDoorAnim(sprite, anim, frame, overlayAnim, overlayFrame, overlaySprite)
if anim then
if frame then
sprite:SetFrame(anim, frame)
elseif not sprite:IsPlaying(anim) and not sprite:IsFinished(anim) then
sprite:Play(anim, true)
end
end
if overlayAnim then
if overlayFrame then
if overlaySprite then
overlaySprite:SetFrame(overlayAnim, overlayFrame)
else
sprite:SetOverlayFrame(overlayAnim, overlayFrame)
end
elseif not overlaySprite and not sprite:IsOverlayPlaying(overlayAnim) and not sprite:IsOverlayFinished(overlayAnim) then
sprite:PlayOverlay(overlayAnim, true)
elseif overlaySprite and not overlaySprite:IsPlaying(overlayAnim) and not overlaySprite:IsFinished(overlayAnim) then
overlaySprite:Play(overlayAnim, true)
end
end
end
function StageAPI.CustomStateDoor:UpdateDoorSprite(sprite, stateData, triggerAnim, triggerOverlayAnim, overlaySprite)
if type(stateData) == "string" then
stateData = self.States[stateData]
end
local anim, overlayAnim
if not triggerAnim or not sprite:IsPlaying(triggerAnim) then
anim = stateData.Anim
end
if not triggerOverlayAnim or not ((overlaySprite and overlaySprite:IsPlaying(triggerOverlayAnim)) or sprite:IsOverlayPlaying(triggerOverlayAnim)) then
overlayAnim = stateData.OverlayAnim
end
self:SetDoorAnim(sprite, anim, stateData.Frame, overlayAnim, stateData.OverlayFrame, overlaySprite)
local renderOverlay = overlaySprite and ((triggerOverlayAnim and overlaySprite:IsPlaying(triggerOverlayAnim)) or overlayAnim)
return renderOverlay, not not anim, not not overlayAnim
end
function StageAPI.SpawnCustomDoor(slot, leadsTo, levelMapID, doorDataName, data, exitSlot, doorSprite, transitionAnim, exitPosition)
if type(levelMapID) == "table" then
levelMapID = levelMapID.Dimension
end
local persistData = {
Slot = slot,
ExitPosition = exitPosition,
ExitSlot = exitSlot or (slot + 2) % 4,
LeadsTo = leadsTo,
LevelMapID = levelMapID,
DoorDataName = doorDataName,
Data = data,
DoorSprite = doorSprite,
TransitionAnim = transitionAnim
}
if exitPosition then
persistData.ExitSlot = nil
end
local index = shared.Room:GetGridIndex(shared.Room:GetDoorSlotPosition(slot))
StageAPI.CustomDoorGrid:Spawn(index, nil, false, persistData)
end
function StageAPI.GetCustomDoors(doorDataName)
local ret = {}
local doors = StageAPI.GetCustomGrids(nil, "CustomDoor")
for _, door in ipairs(doors) do
if not doorDataName or door.PersistentData.DoorDataName == doorDataName then
ret[#ret + 1] = door
end
end
return ret
end
StageAPI.AddCallback("StageAPI", "POST_SPAWN_CUSTOM_GRID", 0, function(customGrid, force, respawning)
local index = customGrid.GridIndex
local persistData = customGrid.PersistentData
local doorData
if persistData.DoorDataName and StageAPI.DoorTypes[persistData.DoorDataName] then
doorData = StageAPI.DoorTypes[persistData.DoorDataName]
else
doorData = StageAPI.BaseDoors.Default
end
local door = Isaac.Spawn(StageAPI.E.Door.T, StageAPI.E.Door.V, 0, shared.Room:GetGridPosition(index), Vector.Zero, nil)
local data, sprite = door:GetData(), door:GetSprite()
sprite:Load(doorData.Anm2, true)
if persistData.DoorSprite then
data.DoorSprite = persistData.DoorSprite
end
door.RenderZOffset = -10000
sprite.Rotation = persistData.Slot * 90 - 90
if doorData.DirectionOffsets then
door.PositionOffset = doorData.DirectionOffsets[StageAPI.DoorToDirection[persistData.Slot]]
else
door.PositionOffset = StageAPI.DoorOffsetsByDirection[StageAPI.DoorToDirection[persistData.Slot]]
end
local opened
if doorData.IsCustomStateDoor then
if doorData.OverlayAnm2 then
data.OverlaySprite = Sprite()
data.OverlaySprite.Rotation = sprite.Rotation
data.OverlaySprite.Offset = sprite.Offset
data.OverlaySprite:Load(doorData.OverlayAnm2, true)
end
data.State = persistData.State
if not data.State then
data.State = "Default"
if shared.Room:IsClear() then
if doorData.States.DefaultCleared then
data.State = "DefaultCleared"
end
else
if doorData.States.DefaultUncleared then
data.State = "DefaultUncleared"
end
end
if type(doorData.States[data.State]) == "string" then
data.State = doorData.States[data.State]
end
end
local stateData = doorData.States[data.State]
if not stateData.PlayAtStart then
data.PreviousState = data.State
doorData:UpdateDoorSprite(sprite, stateData, nil, nil, data.OverlaySprite)
end
if stateData.Passable then
opened = true
else
opened = false
end
elseif not doorData.NoAutoHandling then
if doorData.AlwaysOpen then
sprite:Play(doorData.OpenedAnim, true)
elseif doorData.AlwaysOpen == false then
sprite:Play(doorData.ClosedAnim, true)
else
if shared.Room:IsClear() then
sprite:Play(doorData.OpenedAnim, true)
else
sprite:Play(doorData.ClosedAnim, true)
end
end
end
opened = opened or (opened == nil and (sprite:IsPlaying(doorData.OpenedAnim) or sprite:IsFinished(doorData.OpenedAnim)))
local grid = shared.Room:GetGridEntity(index)
if not grid then
StageAPI.LogErr("Custom door not find grid at", index, "slot",persistData.Slot)
end
if opened then
grid.CollisionClass = GridCollisionClass.COLLISION_WALL_EXCEPT_PLAYER
else
grid.CollisionClass = GridCollisionClass.COLLISION_WALL
end
data.DoorGridData = persistData
data.DoorData = doorData
data.Opened = opened
local callbacks = StageAPI.GetCallbacks("POST_SPAWN_CUSTOM_DOOR")
for _, callback in ipairs(callbacks) do
if not callback.Params[1] or callback.Params[1] == persistData.DoorDataName then
callback.Function(door, data, sprite, doorData, customGrid, force, respawning)
end
end
end, "CustomDoor")
mod:AddCallback(ModCallbacks.MC_POST_EFFECT_RENDER, function(_, door)
local data = door:GetData()
if data.OverlaySprite and data.RenderOverlay then
local rpos = Isaac.WorldToRenderPosition(door.Position) + shared.Room:GetRenderScrollOffset()
data.OverlaySprite:Render(rpos, Vector.Zero, Vector.Zero)
end
end, StageAPI.E.Door.V)
function StageAPI.SetDoorOpen(open, door)
local grid = shared.Room:GetGridEntityFromPos(door.Position)
if open then
grid.CollisionClass = GridCollisionClass.COLLISION_WALL_EXCEPT_PLAYER
else
grid.CollisionClass = GridCollisionClass.COLLISION_WALL
end
end
function StageAPI.IsRoomTopLeftShifted()
local tlPos = shared.Room:GetTopLeftPos()
local shape = shared.Room:GetRoomShape()
local data = StageAPI.WallData[shape]
if data then
local trueTL = shared.Room:GetGridPosition(data.TopLeft) + Vector(20, 20)
if trueTL.X ~= tlPos.X or trueTL.Y ~= tlPos.Y then
return true
end
end
return false
end
local framesWithoutDoorData = 0
local hadFrameWithoutDoorData = false
mod:AddCallback(ModCallbacks.MC_POST_EFFECT_UPDATE, function(_, door)
local data, sprite = door:GetData(), door:GetSprite()
local doorData = data.DoorData
if not doorData then
framesWithoutDoorData = framesWithoutDoorData + 1
hadFrameWithoutDoorData = true
return
end
if doorData.IsCustomStateDoor then
local stateData = doorData.States[data.State]
if data.State ~= data.PreviousState then
if stateData.StartAnim and not data.SkipStartAnim then
sprite:Play(stateData.StartAnim, true)
data.TriggerAnim = stateData.StartAnim
end
if stateData.StartOverlayAnim and not data.SkipStartOverlayAnim then
sprite:Play(stateData.StartOverlayAnim, true)
data.TriggerOverlayAnim = stateData.StartOverlayAnim
end
data.SkipStartAnim = nil
data.SkipStartOverlayAnim = nil
if not stateData.ChangeAfterTriggerAnim then
if stateData.Passable then
StageAPI.SetDoorOpen(true, door)
else
StageAPI.SetDoorOpen(false, door)
end
end
if stateData.StartFunction then
stateData.StartFunction(door, data, sprite, doorData, data.DoorGridData)
end
if stateData.StartSound then
if type(stateData.StartSound) == "table" then
shared.Sfx:Play(stateData.StartSound[1], stateData.StartSound[2] or 1, stateData.StartSound[3] or 0, stateData.StartSound[4] or false, stateData.StartSound[5] or 1)
else
shared.Sfx:Play(stateData.StartSound, 1, 0, false, 1)
end
end
data.PreviousState = data.State
end
if stateData.ChangeAfterTriggerAnim and data.TriggerAnim then
if sprite:IsFinished(data.TriggerAnim) then
if stateData.Passable then
StageAPI.SetDoorOpen(true, door)
else
StageAPI.SetDoorOpen(false, door)
end
end
end
local renderOverlay, animTriggerFinish, overlayTriggerFinish = doorData:UpdateDoorSprite(sprite, stateData, data.TriggerAnim, data.TriggerOverlayAnim, data.OverlaySprite)
data.RenderOverlay = renderOverlay
if not stateData.NoMemory then
if stateData.RememberAs then
data.DoorGridData.State = stateData.RememberAs
else
data.DoorGridData.State = data.State
end
end
if stateData.Triggers then
local trigger
if stateData.Triggers.Bomb then
if not data.CountedExplosions then
data.CountedExplosions = {}
end
for _, explosion in ipairs(Isaac.FindByType(EntityType.ENTITY_EFFECT, EffectVariant.BOMB_EXPLOSION, -1, false, false)) do
local hash = GetPtrHash(explosion)
local frame = explosion.FrameCount
if (not data.CountedExplosions[hash] or frame < data.CountedExplosions[hash]) and explosion.Position:DistanceSquared(door.Position) < 144 * 144 then
trigger = stateData.Triggers.Bomb
end
data.CountedExplosions[hash] = frame
end
end
if stateData.Triggers.EnteredThrough and shared.Level.EnterDoor == data.DoorGridData.Slot then
trigger = stateData.Triggers.EnteredThrough
end
if stateData.Triggers.Unclear and not shared.Room:IsClear() then
trigger = stateData.Triggers.Unclear
end
if stateData.Triggers.Clear and shared.Room:IsClear() then
trigger = stateData.Triggers.Clear
end
if (stateData.Triggers.Key or stateData.Triggers.Coin or stateData.Triggers.GoldKey) and shared.Room:IsClear() then
local touched = {}
for _, player in ipairs(shared.Players) do
if player:CollidesWithGrid() and player.Position:DistanceSquared(door.Position) < 40 * 40 then
touched[#touched + 1] = player
end
end
for _, player in ipairs(touched) do
if stateData.Triggers.GoldKey then
if player:HasGoldenKey() then
trigger = stateData.Triggers.GoldKey
break
end
end
if stateData.Triggers.Key then
local keyCount = player:GetNumKeys()
local hasGold = player:HasGoldenKey() and not stateData.Triggers.Key.NoGold
if keyCount > 0 or hasGold then
trigger = stateData.Triggers.Key
if not hasGold then
player:AddKeys(-1)
end
break
end
end
if stateData.Triggers.Coin then
local coinCount = player:GetNumCoins()
if coinCount > 0 then
trigger = stateData.Triggers.Coin
player:AddCoins(-1)
break
end
end
end
end
if stateData.Triggers.OverlayEvent then
if data.OverlaySprite:IsEventTriggered(stateData.Triggers.OverlayEvent.Event) then
trigger = stateData.Triggers.OverlayEvent
end
end
if stateData.Triggers.FinishOverlayTrigger and overlayTriggerFinish then
trigger = stateData.Triggers.FinishOverlayTrigger
end
if stateData.Triggers.FinishAnimTrigger and animTriggerFinish then
trigger = stateData.Triggers.FinishAnimTrigger
end
if stateData.Triggers.Function then
local active = stateData.Triggers.Function(door, data, sprite, doorData, data.DoorGridData)
if active then
trigger = active
end
end
if trigger then
if type(trigger) == "table" then
if trigger.State then
data.State = trigger.State
end
if trigger.Anim or trigger.OverlayAnim then
doorData:SetDoorAnim(sprite, trigger.Anim, nil, trigger.OverlayAnim, nil, data.OverlaySprite)
end
if trigger.Anim then
data.TriggerAnim = trigger.Anim
data.SkipStartAnim = true
end
if trigger.OverlayAnim then
data.TriggerOverlayAnim = trigger.OverlayAnim
data.SkipStartOverlayAnim = true
end
if trigger.Jingle then
local currentMusic = shared.Music:GetCurrentMusicID()
shared.Music:Play(trigger.Jingle, 1)
shared.Music:UpdateVolume()
shared.Music:Queue(currentMusic)
end
if trigger.Particle then
trigger.Particles = {trigger.Particle}
end
if trigger.Particles then
for _, particle in ipairs(trigger.Particles) do
local count, vel = particle.Count or 5, particle.Velocity or 5
if type(count) == "table" then
count = StageAPI.Random(count[1], count[2])
end
if type(vel) == "table" then
vel = StageAPI.Random(vel[1], vel[2])
end
for i = 1,count do
local direction = Vector.FromAngle(sprite.Rotation + StageAPI.Random(-90, 90))
if not shared.Room:IsPositionInRoom(door.Position + direction * 40, 0) then
direction = -direction
end
local part = Isaac.Spawn(particle.Type or 1000, particle.Variant or EffectVariant.ROCK_PARTICLE, particle.SubType or 0, door.Position, direction * vel, nil)
if particle.LifeSpan then
local lifespan = particle.LifeSpan
if type(lifespan) == "table" then
lifespan = StageAPI.Random(lifespan[1], lifespan[2])
end
part:ToEffect().LifeSpan = lifespan
end
if particle.Timeout then
local timeout = particle.Timeout
if type(timeout) == "table" then
timeout = StageAPI.Random(timeout[1], timeout[2])
end
part:ToEffect().Timeout = timeout
end
if particle.Rotation then
local rotation = particle.Rotation
if type(rotation) == "table" then
rotation = StageAPI.Random(rotation[1], rotation[2])
end
part:ToEffect().Rotation = rotation
end
end
end
end
else
data.State = trigger
end
end
end
if data.OverlaySprite then
data.OverlaySprite:Update()
end
elseif not doorData.NoAutoHandling and doorData.AlwaysOpen == nil then
if sprite:IsFinished(doorData.OpenAnim) then
StageAPI.SetDoorOpen(true, door)
sprite:Play(doorData.OpenedAnim, true)
elseif sprite:IsFinished(doorData.CloseAnim) then
StageAPI.SetDoorOpen(false, door)
sprite:Play(doorData.ClosedAnim, true)
end
if shared.Room:IsClear() and not data.Opened then
data.Opened = true
sprite:Play(doorData.OpenAnim, true)
elseif not shared.Room:IsClear() and data.Opened then
data.Opened = false
sprite:Play(doorData.CloseAnim, true)
end
end
local transitionStarted
for _, player in ipairs(shared.Players) do
local size = 32 + player.Size
if not shared.Room:IsPositionInRoom(player.Position, -16) and player.Position:DistanceSquared(door.Position) < size * size then
if doorData.ExitFunction then
doorData.ExitFunction(door, data, sprite, doorData, data.DoorGridData)
end
local leadsTo = data.DoorGridData.LeadsTo
local transitionAnim = data.DoorGridData.TransitionAnim or doorData.TransitionAnim or RoomTransitionAnim.WALK
if leadsTo then
transitionStarted = true
StageAPI.ExtraRoomTransition(leadsTo, StageAPI.DoorSlotToDirection[data.DoorGridData.Slot], transitionAnim, data.DoorGridData.LevelMapID, data.DoorGridData.Slot, data.DoorGridData.ExitSlot, data.DoorGridData.ExitPosition)
end
end
end
if transitionStarted then
for _, player in ipairs(shared.Players) do
player.Velocity = Vector.Zero
end
end
local callbacks = StageAPI.GetCallbacks("POST_CUSTOM_DOOR_UPDATE")
for _, callback in ipairs(callbacks) do
if not callback.Params[1] or callback.Params[1] == data.DoorGridData.DoorDataName then
callback.Function(door, data, sprite, doorData, data.DoorGridData)
end
end
end, StageAPI.E.Door.V)
mod:AddCallback(ModCallbacks.MC_POST_UPDATE, function()
if hadFrameWithoutDoorData then
hadFrameWithoutDoorData = false
elseif framesWithoutDoorData > 0 then
StageAPI.LogErr("Had no door data for " .. tostring(framesWithoutDoorData) .. " frames")
framesWithoutDoorData = 0
end
end)
|
--[[
ui编辑器多国语选择界面
]]
Panel = g_panel_mgr.new_panel_class('editor/dialog/select_multi_lang_panel')
-- overwrite
function Panel:init_panel(btn, content, callback)
self:add_key_event_callback('KEY_ESCAPE', function()
self:close_panel()
end)
self._layer.OnClick = function()
self:close_panel()
end
local pos = btn:convertToWorldSpace(ccp(0, 0))
self.bg:setPosition(pos)
self.edit:SetText(is_number(content) and tostring(content) or '0')
self.btnOK.OnClick = function()
local num = tonumber(self.edit:getText())
if num then
self:close_panel()
callback(math.round_number(num))
else
message('请输入合法的多国ID')
end
end
end
|
--[[
@author Sebastian "CrosRoad95" Jura <sebajura1234@gmail.com>
@copyright 2011-2021 Sebastian Jura <sebajura1234@gmail.com>
@license MIT
]]--
local b=createElement("text")
setElementData(b,"name","PRACA: Drwal\nZAROBEK:\nGRACZ 250PLN | PREMIUM 350PLN\nOPIS: Zbieranie drzew")
setElementPosition(b,300.12, 1141.27, 9.14)
createBlip(300.12, 1141.27, 9.14, 46,2,0,0,0,0,0,275)
local zone = createColCuboid(310.7600402832, 1144.9151611328, 7.1291146278381, 9, 11.7, 7.4)
local m1 = createMarker(300.12, 1141.27, 9.14-1, "cylinder", 1.5, 35, 142, 150)
vehs = {}
function removePreviousVehicles(plr)
for i,v in ipairs(getElementsByType("vehicle", resourceRoot)) do
local sby = getElementData(v, "zrespilGracz")
if sby and sby == plr and getPedOccupiedVehicle(plr) ~= v then
destroyElement(v)
end
end
end
addEventHandler("onMarkerHit", m1, function(el, md)
if getElementData(el, "zrespilGracz") then
--outputChatBox("Praca w trakcie przygotowania.", el)
return
end
if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("* Miejsce respu zajęte, poczekaj aż ktoś wyjedzie.",el) return end
local x,y,z = getElementPosition(el)
local bus = createVehicle(543, 314.92, 1151.88, 8.37+0.8, 0.81, -0.00, 85.51)
setElementData(bus,"vehicle:desc","Praca Drwala\n! Proszę zachować ostrożność !")
setElementData(bus, "zrespilGracz", el)
setElementData(bus, "vehicle:fuel", 100)
setElementData(bus, "vehicle:mileage", math.random(9018,31892))
setElementData(bus, "blokada:reczny_drwal", true)
--setVehiclePlateText(bus, " PRACA" )
setVehicleColor(bus, 0, 100, 0 )
setVehicleHandling(bus,"maxVelocity", 100.00) -- 40 + 10 = 50km/h
warpPedIntoVehicle(el, bus)
removePreviousVehicles(el)
triggerClientEvent(el, "STARTJobBus", resourceRoot, bus)
--setVehicleHandling(bus,"maxVelocity", 100.00) -- 40 + 10 = 50km/h
vehs[el] = bus
end)
addEvent("STOPJobBus", true)
addEventHandler("STOPJobBus", resourceRoot, function()
local pojazd = getPedOccupiedVehicle(localPlayer)
if pojazd then
destroyElement(pojazd)
end
end)
addEvent("destroyVeh", true)
addEventHandler("destroyVeh", getRootElement(),
function()
if vehs[source] then
if isElement(vehs[source]) then destroyElement(vehs[source]) end
end
end)
addEvent("onPlayerQuit", true)
addEventHandler ( "onPlayerQuit", getRootElement(), function()
if vehs[source] then
if isElement(vehs[source]) then destroyElement(vehs[source]) end
end
end)
|
-- Copyright 2006-2019 Robert Gieseke. See License.txt.
-- Sass CSS preprocessor LPeg lexer.
-- http://sass-lang.com
local lexer = require('lexer')
local token = lexer.token
local P, S = lpeg.P, lpeg.S
local lex = lexer.new('sass', {inherit = lexer.load('css')})
-- Line comments.
lex:add_rule('line_comment', token(lexer.COMMENT, '//' * lexer.nonnewline^0))
-- Variables.
lex:add_rule('variable', token(lexer.VARIABLE, '$' * (lexer.alnum + S('_-'))^1))
-- Mixins.
lex:add_rule('mixin', token('mixin', P('@') * lexer.word))
lex:add_style('mixin', lexer.STYLE_FUNCTION)
-- Fold points.
lex:add_fold_point(lexer.COMMENT, '//', lexer.fold_line_comments('//'))
return lex
|
kdrugs.config = {
-- darkrp config --
Lab = {
Maximum = 5, // max amount of drug labs a single player can buy
Price = 1500, // price of each drug lab
Allowed = { // jobs that can buy the drug lab
TEAM_GANG,
TEAM_MOB
}
},
Ingredients = {
Maximum = 15, // max amount of each ingredient a player can buy
Price = 50, // price of each ingredient
Allowed = { // jobs that can buy the ingredients
TEAM_GANG
}
}
}
|
-- Copyright 2021 gsdenys. All Rights Reserved.
--
-- 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.
--- perform log using print method
function stdout(level_, log_str)
msg =string.format('[%s] %s %s', level_.name, os.date("%Y-%m-%d %H:%M:%S"), log_str)
print(msg)
end
--- perform log using nginx log method
function nginx(level_, log_str)
_G.ngx.log(level_.value, log_str)
end
-- return performers
return {
['stdout'] = stdout,
['nginx'] = nginx
}
|
--[[ The number 12.7 is equal to the fraction 127/10, where the denominator is a power of ten. Can you express it as a common fraction where the denominator is a power of two? What about the number 5.5? "]]--
print("12.7 cannot be expressed as a fraction where the denominator is a power of two")
print("5.5 can be expressed as 101.1 in base 2. That is 11/2.")
|
hs.loadSpoon("SpoonInstall")
-- Vim Config {{{
local VimMode = hs.loadSpoon("VimMode")
local vim = VimMode:new()
-- Configure apps you do *not* want Vim mode enabled in
-- For example, you don't want this plugin overriding your control of Terminal
-- vim
vim
:disableForApp('Code')
:disableForApp('PyCharm')
:disableForApp('WebStorm')
:disableForApp('zoom.us')
:disableForApp('iTerm')
:disableForApp('iTerm2')
:disableForApp('Terminal')
-- If you want the screen to dim (a la Flux) when you enter normal mode
-- flip this to true.
vim:shouldDimScreenInNormalMode(false)
-- If you want to show an on-screen alert when you enter normal mode, set
-- this to true
vim:shouldShowAlertInNormalMode(true)
-- You can configure your on-screen alert font
vim:setAlertFont("Courier New")
-- Enter normal mode by typing a key sequence
vim:enterWithSequence('jk')
-- if you want to bind a single key to entering vim, remove the
-- :enterWithSequence('jk') line above and uncomment the bindHotKeys line
-- below:
--
-- To customize the hot key you want, see the mods and key parameters at:
-- https://www.hammerspoon.org/docs/hs.hotkey.html#bind
--
-- vim:bindHotKeys({ enter = { {'ctrl'}, ';' } })
-- }}}
-- Window Management {{{
-- Based on https://github.com/ztomer/.hammerspoon/blob/master/init.lua
-- init grid
hs.grid.MARGINX = 0
hs.grid.MARGINY = 0
hs.grid.GRIDWIDTH = 7
hs.grid.GRIDHEIGHT = 3
-- disable animation
hs.window.animationDuration = 0
-- hotkey mash
local mash = {"cmd"}
local mash_secondary = {"cmd", "ctrl"}
-- snap all newly launched windows
local function auto_tile(appName, event)
if event == hs.application.watcher.launched then
local app = hs.appfinder.appFromName(appName)
-- protect against unexpected restarting windows
if app == nil then
return
end
hs.fnutils.map(app:allWindows(), hs.grid.snap)
end
end
-- Moves all windows outside the view into the curent view
local function rescue_windows()
local screen = hs.screen.mainScreen()
local screenFrame = screen:fullFrame()
local wins = hs.window.visibleWindows()
for i,win in ipairs(wins) do
local frame = win:frame()
if not frame:inside(screenFrame) then
win:moveToScreen(screen, true, true)
end
end
end
local function init_wm_binding()
-- global operations
hs.hotkey.bind(mash_secondary, ';', function() hs.grid.snap(hs.window.focusedWindow()) end)
hs.hotkey.bind(mash_secondary, "'", function() hs.fnutils.map(hs.window.visibleWindows(), hs.grid.snap) end)
-- adjust grid size
hs.hotkey.bind(mash_secondary, '=', function() hs.grid.adjustWidth( 1) end)
hs.hotkey.bind(mash_secondary, '-', function() hs.grid.adjustWidth(-1) end)
hs.hotkey.bind(mash_secondary, ']', function() hs.grid.adjustHeight( 1) end)
hs.hotkey.bind(mash_secondary, '[', function() hs.grid.adjustHeight(-1) end)
-- change focus
hs.hotkey.bind(mash, 'H', function() hs.window.focusedWindow():focusWindowWest() end)
hs.hotkey.bind(mash, 'L', function() hs.window.focusedWindow():focusWindowEast() end)
hs.hotkey.bind(mash, 'K', function() hs.window.focusedWindow():focusWindowNorth() end)
hs.hotkey.bind(mash, 'J', function() hs.window.focusedWindow():focusWindowSouth() end)
hs.hotkey.bind(mash_secondary, 'M', hs.grid.maximizeWindow)
-- multi monitor
hs.hotkey.bind(mash_secondary, 'N', hs.grid.pushWindowNextScreen)
hs.hotkey.bind(mash_secondary, 'P', hs.grid.pushWindowPrevScreen)
-- move windows
hs.hotkey.bind(mash_secondary, 'H', hs.grid.pushWindowLeft)
hs.hotkey.bind(mash_secondary, 'J', hs.grid.pushWindowDown)
hs.hotkey.bind(mash_secondary, 'K', hs.grid.pushWindowUp)
hs.hotkey.bind(mash_secondary, 'L', hs.grid.pushWindowRight)
hs.hotkey.bind(mash_secondary, 'R', function() rescue_windows() end)
-- resize windows
hs.hotkey.bind(mash_secondary, 'Y', hs.grid.resizeWindowThinner)
hs.hotkey.bind(mash_secondary, 'U', hs.grid.resizeWindowTaller)
hs.hotkey.bind(mash_secondary, 'I', hs.grid.resizeWindowShorter)
hs.hotkey.bind(mash_secondary, 'O', hs.grid.resizeWindowWider)
-- Window Hints
-- hs.hotkey.bind(mash_secondary, '.', function() hs.hints.windowHints(hs.window.allWindows()) end)
hs.hotkey.bind(mash, '.', hs.hints.windowHints)
end
init_wm_binding()
-- hs.application.watcher.new(auto_tile):start()
-- }}}
-- Config Reloading {{{
function reloadConfig(files)
doReload = false
for _,file in pairs(files) do
if file:sub(-4) == ".lua" then
doReload = true
end
end
if doReload then
hs.reload()
end
end
myWatcher = hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", reloadConfig):start()
hs.notify.new({title="Hammerspoon", informativeText="Config loaded"}):send()
-- }}}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.