content stringlengths 5 1.05M |
|---|
local _M = {}
local home_dir = vim.fn.expand("~")
local sessions_dir = vim.fn.expand("~/.nvim/tmp/sessions")
local function path_to_name(path)
return path:gsub('/', '%%') .. '.vim'
end
local function name_to_path(name)
return name:gsub('%%', '/'):gsub('.vim$', '') .. ''
end
function _M.setup()
vim.o.sessionoptions='blank,buffers,curdir,folds,help,tabpages'
-- vim.cmd([[
-- if exists('g:loaded_auto_session') | finish | endif " prevent loading file twice
-- let g:in_pager_mode = 0
-- aug StdIn
-- autocmd!
-- autocmd StdinReadPre * let g:in_pager_mode = 1
-- aug END
-- augroup SaveRestoreSession
-- autocmd!
-- autocmd VimLeave * lua save_session()
-- autocmd VimEnter * nested lua restore_session()
-- augroup END
-- let g:loaded_auto_session = 1
-- ]])
-- vim.cmd([[
-- if exists('g:loaded_auto_session') | finish | endif " prevent loading file twice
-- let g:in_pager_mode = 0
-- augroup StdIn
-- autocmd!
-- autocmd StdinReadPre * let g:in_pager_mode = 1
-- augroup END
-- augroup SaveRestoreSession
-- autocmd!
-- autocmd VimLeave * lua require('custom/session').save_session()
-- augroup END
-- let g:loaded_auto_session = 1
-- ]])
vim.cmd([[
if exists('g:loaded_auto_session') | finish | endif " prevent loading file twice
augroup SaveRestoreSession
autocmd!
autocmd VimLeave * lua require('custom/session').save_session()
augroup END
let g:loaded_auto_session = 1
]])
end
function _M.save_session()
if vim.g.stdin_mode == 1 then return end
local session_name = path_to_name(vim.fn.getcwd())
-- save vars
local tree_opened = require('nvim-tree.view').win_open() and true or false
local vars = {
['nvim-tree_opened'] = tree_opened
}
local vars_file = string.format(sessions_dir .. "/%s", session_name:gsub('.vim$', '.var'))
vim.fn.writefile({ vim.inspect(vars) }, vars_file)
-- save session
if tree_opened then require('nvim-tree').close() end
pcall(vim.cmd, 'bd Neogit*')
pcall(vim.cmd, 'bd Diffview*')
local session_file = string.format(sessions_dir .. "/%s", session_name)
vim.cmd("mksession! " .. session_file:gsub("%%", "\\%%"))
end
function _M.has_session()
if vim.g.stdin_mode == 1 or vim.g.single_file_mode == 1 then return end
local session_name = path_to_name(vim.fn.getcwd())
local session_file = string.format(sessions_dir .. "/%s", session_name)
return vim.fn.filereadable(session_file) == 1
end
function _M.restore_session()
if vim.g.stdin_mode == 1 or vim.g.single_file_mode == 1 then return end
local session_name = path_to_name(vim.fn.getcwd())
local vars_file = string.format(sessions_dir .. "/%s", session_name:gsub('.vim$', '.var'))
local session_file = string.format(sessions_dir .. "/%s", session_name)
if vim.fn.filereadable(session_file) == 1 then
if not pcall(vim.cmd, "source " .. session_file:gsub("%%", "\\%%")) then
print("Could not load session: " .. session_name)
end
local vars = vim.inspect(vim.fn.readfile(vars_file))
if vars:find('["nvim-tree_opened"] = true', 1, true) and not require('nvim-tree.view').win_open() then
require('nvim-tree.view').open({ focus_tree = false })
end
end
end
-- Telescope related
-----------------------------------------------------------------
local function get_sessions()
local sessions = {}
local cwd = vim.fn.getcwd()
for _, session_filename in ipairs(vim.fn.readdir(sessions_dir)) do
local session_path = name_to_path(session_filename)
if vim.fn.isdirectory(session_path) == 1 and cwd ~= session_path then
table.insert(sessions, {
timestamp = vim.fn.getftime(sessions_dir .. "/" .. session_filename),
filename = session_filename:gsub('.vim$', '')
})
end
end
table.sort(sessions, function(a, b)
return a.timestamp > b.timestamp
end)
-- If the last session is the current one, then preselect the previous one
if #sessions >= 2 and sessions[1].filename == vim.fn.getcwd() then
sessions[1], sessions[2] = sessions[2], sessions[1]
end
return sessions
end
local function load_session(session_filename, bang)
if not session_filename or #session_filename == 0 then
return
end
if not bang or #bang == 0 then
-- Ask to save files in current session before closing them
for _, buffer in ipairs(vim.api.nvim_list_bufs()) do
if vim.api.nvim_buf_get_option(buffer, 'modified') then
local choice = vim.fn.confirm('The files in the current session have changed. Save changes?', '&Yes\n&No\n&Cancel')
if choice == 3 then
return -- Cancel
elseif choice == 1 then
vim.api.nvim_command('silent wall')
end
break
end
end
end
-- Stop all LSP clients first
vim.lsp.stop_client(vim.lsp.get_active_clients())
-- Scedule buffers cleanup to avoid callback issues and source the session
vim.schedule(function()
_M.save_session()
-- Delete all buffers first except the current one to avoid entering buffers scheduled for deletion
local current_buffer = vim.api.nvim_get_current_buf()
for _, buffer in ipairs(vim.api.nvim_list_bufs()) do
if vim.api.nvim_buf_is_valid(buffer) and buffer ~= current_buffer then
vim.api.nvim_buf_delete(buffer, { force = true })
end
end
vim.api.nvim_buf_delete(current_buffer, { force = true })
vim.cmd(':cd ' .. name_to_path(session_filename))
_M.restore_session()
end)
end
function _M.telescope_picker(opts)
local actions = require('telescope.actions')
local pickers = require('telescope.pickers')
local finders = require('telescope.finders')
local sorters = require('telescope.sorters')
local themes = require('telescope.themes')
pickers.new(opts, {
prompt_title = 'Sessions',
finder = finders.new_table({
results = get_sessions(),
entry_maker = function(entry)
return {
value = entry.filename,
display = os.date('%Y-%m-%d %H:%M', entry.timestamp) .. " " .. name_to_path(entry.filename):gsub(home_dir, "~"),
ordinal = entry.filename,
}
end,
}),
sorter = sorters.get_fzy_sorter(),
attach_mappings = function(prompt_bufnr, map)
local source_session = function()
actions.close(prompt_bufnr)
local entry = actions.get_selected_entry(prompt_bufnr)
if entry then
if opts['save_current'] then
_M.save_session()
end
load_session(entry.value)
end
end
actions.select_default:replace(source_session)
local delete_session = function()
local entry = actions.get_selected_entry(prompt_bufnr)
if entry then
vim.fn.delete(sessions_dir .. entry.value)
select_session(opts)
end
end
map('n', 'd', delete_session, { nowait = true })
return true
end,
}):find()
end
return _M
|
while wait(1) do
game.Players.PLAYERNAME.Backpack.keyinput:FireServer("changestat", "exp", 10000000)
end |
local MAJOR = "LibJayOptions"
local MINOR = 2
assert(LibStub, format("%s requires LibStub.", MAJOR))
local lib = LibStub:NewLibrary(MAJOR, MINOR)
if not lib then return end
local safecall, xsafecall
do -- safecall, xsafecall
local pcall = pcall
---@param func function
---@return boolean retOK
safecall = function(func, ...) return pcall(func, ...) end
local geterrorhandler = geterrorhandler
---@param err string
---@return function handler
local function errorhandler(err) return geterrorhandler()(err) end
local xpcall = xpcall
---@param func function
---@return boolean retOK
xsafecall = function(func, ...) return xpcall(func, errorhandler, ...) end
end
local tnew, tdel
do -- tnew, tdel
local cache = setmetatable({}, {__mode = "k"})
local next = next
local select = select
---@return table t
function tnew(...)
local t = next(cache)
if t then
cache[t] = nil
local n = select("#", ...)
for i = 1, n do t[i] = select(i, ...) end
return t
end
return {...}
end
local wipe = wipe
---@param t table
function tdel(t) cache[wipe(t)] = true end
end
local error = error
local format = format
local pairs = pairs
local tremove = tremove
lib.frame = lib.frame or CreateFrame("Frame")
local frame = lib.frame
frame:Hide()
frame.scrollFrame = frame.scrollFrame or CreateFrame("ScrollFrame", nil, lib.frame, "UIPanelScrollFrameTemplate")
lib.frame.scrollFrame:SetAllPoints()
lib.frame.scrollFrame.scrollBarHideable = true
lib.frame.container = lib.frame.container or CreateFrame("Frame", nil, lib.frame.scrollFrame, "VerticalLayoutFrame")
lib.frame.container.spacing = 0
lib.frame.scrollFrame:SetScrollChild(lib.frame.container)
lib.frame.scrollFrame:SetScript("OnSizeChanged", function(self, width, height)
local scrollChild = self:GetScrollChild()
scrollChild.fixedWidth = width - 10
scrollChild:MarkDirty()
end)
lib.frame.scrollFrame:SetScript("OnUpdate",
function(self, elapsed) self.ScrollBar:SetShown(self:GetVerticalScrollRange() ~= 0) end)
local container = lib.frame.container
local LJMixin = LibStub("LibJayMixin")
local acquireControl, releaseControl
do -- Controls
lib.controls = lib.controls or {}
lib.controls.mixins = lib.controls.mixins or {}
lib.controls.versions = lib.controls.versions or {}
lib.controls.frameTypes = lib.controls.frameTypes or {}
lib.controls.caches = lib.controls.caches or {}
local mixins = lib.controls.mixins
local versions = lib.controls.versions
local frameTypes = lib.controls.frameTypes
local caches = lib.controls.caches
---@param control table
---@return number canUpgrade
local function canUpgradeControl(control)
local name, version, frameType = control._NAME, control._VERSION, control._FRAMETYPE
if versions[name] == version then return 0 end
if versions[name] >= version then if frameTypes[name] == frameType then return 1 end end
return -1
end
---@param control table
---@return number success
local function upgradeControl(control)
local canUpgrade = canUpgradeControl(control)
if canUpgrade == 1 then LJMixin:Mixin(control, mixins[control.name]) end
return canUpgrade
end
local type = type
---@param name string
---@param version number
---@param frameType string
function lib:RegisterControl(name, version, frameType)
if type(name) ~= "string" then
error(format("Usage: %s:RegisterControl(name, version, frameType): 'name' - string expected got %s", MAJOR,
type(name)), 2)
end
if type(version) ~= "number" then
error(format("Usage: %s:RegisterControl(name, version, frameType): 'version' - number expected got %s",
MAJOR, type(version)), 2)
end
if type(frameType) ~= "string" then
error(format("Usage: %s:RegisterControl(name, version, frameType): 'frameType' - string expected got %s",
MAJOR, type(frameType)), 2)
end
local oldVersion = versions[name]
if oldVersion and oldVersion >= version then return end
local mixin = {_NAME = name, _VERSION = version, _FRAMETYPE = frameType}
mixins[name] = mixin
versions[name] = version
frameTypes[name] = frameType
local cache = caches[name]
if cache then
local i = 0
while true do
i = i + 1
if i <= #cache then
if upgradeControl(cache[i]) == -1 then
tremove(cache, i)
i = i - 1
end
else
break
end
end
end
return mixin, oldVersion
end
---@param name string
---@return boolean isRegistered
local function isControlRegistered(name) if mixins[name] then return true end end
---@param name string
---@return table control
function acquireControl(name)
local control
if type(name) == "string" then
local cache = caches[name]
if cache then control = tremove(cache) end
if not control then
local mixin, frameType = mixins[name], frameTypes[name]
if mixin and frameType then
control = LJMixin:CreateFrame(frameType, nil, nil, nil, nil, mixin)
end
end
elseif type(name) == "table" then
control = name
end
if control then
control:SetParent(container)
control:Show()
safecall(control.OnAcquire, control)
safecall(control.Enable, control)
return control
end
end
---@param control table
function releaseControl(control)
local name = control._NAME
if name and isControlRegistered(name) then
if upgradeControl(control) >= 0 then
caches[name] = caches[name] or {}
caches[name][#caches[name] + 1] = control
end
end
control:Hide()
control:SetParent(nil)
control:ClearAllPoints()
safecall(control.OnRelease, control)
end
end
do -- Panels
local UPDATE_INTERVAL = 0.1
local LOCKDOWN_ICON = [[Interface\CharacterFrame\UI-StateIcon]]
local LOCKDOWN_ICON_COORDS = {0.5, 1, 0, 0.5}
local type = type
---@param info table
---@param option table
local function fillInfoPath(info, option)
if option.parent then fillInfoPath(info, option.parent) end
if type(option.path) == "table" then
for i = 1, #option.path do info[#info + 1] = option.path[i] end
else
info[#info + 1] = option.path
end
end
---@param option table
---@return table info
local function getInfo(option)
local info = tnew()
info.type = option.type
info.arg = option.arg
info.control = option.control
if option.type == "select" then
info.isMulti = option.isMulti
elseif option.type == "color" then
info.hasAlpha = option.hasAlpha
end
fillInfoPath(info, option)
return info
end
local unpack = unpack
---@param option table
---@param key string
---@return any
local function getOptionValue(option, key, ...)
local value = option[key]
if type(value) == "function" then
local info = getInfo(option)
local results = {xsafecall(value, info, ...)}
tdel(info)
if results[1] then return unpack(results, 2, #results) end
elseif type(value) == "string" and type(option.handler) == "table" and option.handler[value] then
local info = getInfo(option)
local results = {xsafecall(option.handler[value], option.handler, info, ...)}
tdel(info)
if results[1] then return unpack(results, 2, #results) end
end
return value
end
local LJProtectedCall = LibStub("LibJayProtectedCall")
---@param option table
local function setValue(option, ...)
if getOptionValue(option, "noCombat") then
LJProtectedCall:Call(getOptionValue, option, "set", ...)
else
getOptionValue(option, "set", ...)
end
end
---@param optionList table
local function setDefaults(optionList)
for i = 1, (optionList.n or #optionList) do
local option = optionList[i]
if option.type == "select" and option.isMulti then
for k, v in pairs(getOptionValue(option, "values") or tnew()) do -- luacheck: ignore 213
setValue(option, k, getOptionValue(option, "default", k))
end
elseif option.type == "color" then
local r, g, b, a = getOptionValue(option, "default")
if option.hasAlpha then
setValue(option, r, g, b, a)
else
setValue(option, r, g, b)
end
else
setValue(option, getOptionValue(option, "default"))
end
if option.optionList then setDefaults(option.optionList) end
end
end
---@param controls table
local function updateControls(controls)
local safecall, getOptionValue = safecall, getOptionValue -- luacheck: ignore 431
local inLockdown = InCombatLockdown()
for i = 1, #controls do
local control = controls[i]
local option = control.option
safecall(control.PauseUpdates, control)
local hidden = getOptionValue(option, "hidden") or
((control.parent and not control.parent:IsShown()) or false)
if hidden and control:IsShown() then
control:Hide()
safecall(control.ClearFocus, control)
elseif not hidden and not control:IsShown() then
control:Show()
end
safecall(control.SetText, control, getOptionValue(option, "text"))
local optionType = option.type
if optionType == "boolean" then
safecall(control.SetValue, control, getOptionValue(option, "get"))
elseif optionType == "header" then -- luacheck: ignore 542
elseif optionType == "number" then
local result, hasFocus = safecall(control.HasFocus, control)
if (result and not hasFocus) or not result then
safecall(control.SetValue, control, getOptionValue(option, "get"))
end
safecall(control.SetMinMaxValues, control, getOptionValue(option, "min"), getOptionValue(option, "max"))
safecall(control.SetIsPercent, control, getOptionValue(option, "isPercent"))
safecall(control.SetStep, control, getOptionValue(option, "step"))
safecall(control.SetMinMaxValues, control, getOptionValue(option, "min"), getOptionValue(option, "max"))
safecall(control.SetMinMaxTexts, control, getOptionValue(option, "minText"),
getOptionValue(option, "maxText"))
elseif optionType == "string" then
local result, hasFocus = safecall(control.HasFocus, control)
if (result and not hasFocus) or not result then
safecall(control.SetValue, control, getOptionValue(option, "get"))
end
safecall(control.SetReadOnly, control, getOptionValue(option, "isReadOnly"))
safecall(control.SetMaxLetters, control, getOptionValue(option, "maxLetters"))
safecall(control.SetJustifyH, control, getOptionValue(option, "justifyH") or "LEFT")
safecall(control.SetMultiLine, control, getOptionValue(option, "isMultiLine"))
elseif optionType == "select" then
safecall(control.SetMultiselect, control, option.isMulti)
local result, hasFocus = safecall(control.HasFocus, control)
if (result and not hasFocus) or not result then
local values = getOptionValue(option, "values")
safecall(control.SetValues, control, values)
if option.isMulti then
for k, v in pairs(values) do -- luacheck: ignore 213
safecall(control.SetValue, control, k, getOptionValue(option, "get", k))
end
else
safecall(control.SetValue, control, getOptionValue(option, "get"), true)
end
safecall(control.SetSortByKeys, control, getOptionValue(option, "sortByKeys"))
safecall(control.SetIcons, control, getOptionValue(option, "icons"))
end
elseif optionType == "color" then
local hasAlpha = option.hasAlpha
safecall(control.SetHasAlpha, control, hasAlpha)
local r, g, b, a = getOptionValue(option, "get")
if hasAlpha then
safecall(control.SetValue, control, r, g, b, a)
else
safecall(control.SetValue, control, r, g, b)
end
end
if inLockdown and getOptionValue(option, "noCombat") then
safecall(control.SetEnabled, control, false)
safecall(control.SetIcon, control, LOCKDOWN_ICON, LOCKDOWN_ICON_COORDS)
else
safecall(control.SetEnabled, control, not getOptionValue(option, "disabled"))
safecall(control.SetIcon, control, getOptionValue(option, "icon"), getOptionValue(option, "iconCoords"))
end
safecall(control.ResumeUpdates, control)
end
container:MarkDirty()
end
local wipe = wipe
---@param control table
---@param option table
local function Control_OnValueChanged(option, controls, control, ...)
local values = {...}
local set = true
local info = getInfo(option)
local onSet = option.onSet
if type(onSet) == "function" then
local result = {safecall(onSet, info, ...)}
if result[1] then
wipe(values)
for i = 2, #result do values[#values + 1] = result[i] end
else
set = false
end
tdel(result)
--[[ local success, result = safecall(onSet, option.arg, ...)
if success then
set = true
value = result
else
set = false
end ]]
end
if set then
local validate = option.validate
if type(validate) == "function" then
local success, result = safecall(validate, info, unpack(values, 1, #values))
set = (success and result) and true
end
end
tdel(info)
if set then setValue(option, unpack(values, 1, #values)) end
tdel(values)
updateControls(controls)
if option.type == "select" and option.isMulti then
local values = getOptionValue(option, "values") -- luacheck: ignore 421
safecall(control.SetValues, control, values)
for k, v in pairs(values) do -- luacheck: ignore 213
safecall(control.SetValue, control, k, getOptionValue(option, "get", k))
end
end
end
local GameTooltip = GameTooltip
---@param option table
---@param control table
---@param motion boolean
local function Control_OnEnter(option, control, motion)
local info = getInfo(option)
safecall(option.onEnter, info)
tdel(info)
local tooltip = getOptionValue(option, "tooltip")
if tooltip then
--[[ GameTooltip:SetOwner(control, "ANCHOR_RIGHT") ]]
GameTooltip:ClearAllPoints()
GameTooltip:SetPoint("TOPLEFT", control, "TOPRIGHT")
GameTooltip:SetOwner(control, "ANCHOR_PRESERVE")
GameTooltip:SetText(getOptionValue(option, "text"))
GameTooltip:AddLine(tooltip, nil, nil, nil, true)
GameTooltip:Show()
end
end
---@param option table
---@param control table
---@param motion boolean
local function Control_OnLeave(option, control, motion)
local info = getInfo(option)
safecall(option.onLeave, info)
tdel(info)
GameTooltip:Hide()
end
---@param control table
local function Control_OnHeightChanged(control, height) container:MarkDirty() end
---@param option table
local function Control_OnClick(option, ...) getOptionValue(option, "func", ...) end
---@param control table
---@param option table
---@param controls table
local function Control_RegisterCallbacks(control, option, controls)
control:RegisterCallback("OnValueChanged", Control_OnValueChanged, option, controls)
control:RegisterCallback("OnEnter", Control_OnEnter, option)
control:RegisterCallback("OnLeave", Control_OnLeave, option)
control:RegisterCallback("OnHeightChanged", Control_OnHeightChanged)
end
---@param optionList table
---@param leftPadding number | nil
---@param controls table | nil
---@return table controls
local function createControls(optionList, leftPadding, controls)
leftPadding = leftPadding or 0
controls = controls or tnew()
for i = 1, (optionList.n or #optionList) do
local option = optionList[i]
if option then
local optionType = option.type
local control
control = option.control
if type(control) == "string" then control = acquireControl(control) end
if not control then
if optionType == "boolean" then
control = acquireControl("CheckButton")
elseif optionType == "header" then
control = acquireControl("Header")
elseif optionType == "number" then
control = acquireControl("Slider")
elseif optionType == "function" then
control = acquireControl("Button")
elseif optionType == "string" then
control = acquireControl("EditBox")
elseif optionType == "select" then
control = acquireControl("DropDown")
elseif optionType == "color" then
control = acquireControl("ColorSelect")
end
end
if control then
control.option = option
safecall(Control_RegisterCallbacks, control, option, controls)
if optionType == "function" then
safecall(control.RegisterCallback, control, "OnClick", Control_OnClick, option)
end
control.layoutIndex = #controls
control.leftPadding = leftPadding
controls[#controls + 1] = control
end
if type(option.optionList) == "table" then
createControls(option.optionList, leftPadding + 15, controls)
end
end
end
return controls
end
---@param controls table
local function releaseAllControls(controls)
if controls then
local tremove = tremove -- luacheck: ignore 431
local releaseControl = releaseControl -- luacheck: ignore 431
for i = #controls, 1, -1 do releaseControl(tremove(controls, i)) end
end
end
lib.panels = lib.panels or {}
local panels = lib.panels
local PanelMixin = {}
local CreateFrame = CreateFrame
local InterfaceOptionsFrame_OpenToCategory = InterfaceOptionsFrame_OpenToCategory
function PanelMixin:OnLoad()
self.controls = self.controls or {}
self:Hide()
self.text = self.text or self:CreateFontString()
self.text:SetParent(self)
self.text:SetDrawLayer("ARTWORK")
self.text:SetFontObject("GameFontNormalHuge")
self.text:Show()
self.text:ClearAllPoints()
if self.parent then
self.parentButton = self.parentButton or CreateFrame("Button")
self.parentButton:SetParent(self)
self.parentButton:Show()
self.parentButton:SetNormalFontObject("GameFontNormalHuge")
self.parentButton:SetText(self.parent)
self.parentButton:ClearAllPoints()
self.parentButton:SetPoint("TOPLEFT", 16, -16)
self.parentButton:SetSize(self.parentButton:GetTextWidth(), self.parentButton:GetTextHeight())
self.parentButton:SetScript("OnClick", function()
InterfaceOptionsFrame_OpenToCategory(self.parent)
end)
self.text:SetPoint("LEFT", self.parentButton, "RIGHT")
self.text:SetText(" > " .. self.name)
else
if self.parentButton then self.parentButton:Hide() end
self.text:SetPoint("TOPLEFT", 16, -16)
self.text:SetText(self.name)
end
self:SetScript("OnShow", self.OnShow)
self:SetScript("OnHide", self.OnHide)
self:SetScript("OnUpdate", self.OnUpdate)
end
---@param optionList table
local function onShow(optionList)
for i = 1, (optionList.n or #optionList) do
local option = optionList[i]
if option then
local info = getInfo(option)
safecall(option.onShow, info)
tdel(info)
if option.optionList then onShow(option.optionList) end
end
end
end
---@param self table
local function OnShow(self)
frame:SetParent(self)
frame:ClearAllPoints()
frame:SetPoint("TOPLEFT", 16, -40)
frame:SetPoint("BOTTOMRIGHT", -26, 3)
frame:Show()
if self.refreshed then
releaseAllControls(self._controls)
self._controls = createControls(self._optionList)
onShow(self._optionList)
end
self.lastUpdate = UPDATE_INTERVAL
end
function PanelMixin:OnShow() xsafecall(OnShow, self) end
---@param optionList table
local function onHide(optionList)
for i = 1, (optionList.n or #optionList) do
local option = optionList[i]
if option then
local info = getInfo(option)
safecall(option.onHide, info)
tdel(info)
if option.optionList then onHide(option.optionList) end
end
end
end
---@param self table
local function OnHide(self) releaseAllControls(self._controls) end
function PanelMixin:OnHide() xsafecall(OnHide, self) end
---@param optionList table
---@param elapsed number
local function onUpdate(optionList, elapsed)
for i = 1, (optionList.n or #optionList) do
local option = optionList[i]
if option then
option.lastUpdate = (option.lastUpdate or (option.onUpdateInterval or UPDATE_INTERVAL)) + elapsed
if option.lastUpdate >= (option.onUpdateInterval or UPDATE_INTERVAL) then
option.lastUpdate = 0
local info = getInfo(option)
safecall(option.onUpdate, info)
tdel(info)
end
if type(option.optionList) == "table" then onUpdate(option.optionList, elapsed) end
end
end
end
---@param self table
---@param elapsed number
local function OnUpdate(self, elapsed)
onUpdate(self._optionList, elapsed)
self.lastUpdate = (self.lastUpdate or 0) + elapsed
if self.lastUpdate >= UPDATE_INTERVAL then
self.lastUpdate = 0
updateControls(self._controls)
end
end
---@param elapsed number
function PanelMixin:OnUpdate(elapsed) xsafecall(OnUpdate, self, elapsed) end
---@param optionList table
local function onOkay(optionList)
for i = 1, (optionList.n or #optionList) do
local option = optionList[i]
if option then
local info = getInfo(option)
safecall(option.onOkay, info)
tdel(info)
if type(option.optionList) == "table" then onOkay(option.optionList) end
end
end
end
---@param self table
local function okay(self)
self.refreshed = nil
onOkay(self._optionList)
self._optionList = tdel(self._optionList)
self._oldValues = tdel(self._oldValues)
end
function PanelMixin:okay() xsafecall(okay, self) end
---@param optionList table
local function onCancel(optionList)
for i = 1, (optionList.n or #optionList) do
local option = optionList[i]
if option then
local info = getInfo(option)
safecall(option.onCancel, info)
tdel(info)
if option.optionList then onCancel(option.optionList) end
end
end
end
---@param values table
local function setValues(values)
for option, value in pairs(values) do
if option.type == "select" and option.isMulti then
for k, v in pairs(value) do setValue(option, k, v) end
elseif option.type == "color" then
if option.hasAlpha then
setValue(option, value.r, value.g, value.b, value.a)
else
setValue(option, value.r, value.g, value.b)
end
else
setValue(option, value)
end
end
end
---@param self table
local function cancel(self)
self.refreshed = nil
onCancel(self._optionList)
setValues(self._oldValues)
self._optionList = tdel(self._optionList)
self._oldValues = tdel(self._oldValues)
end
function PanelMixin:cancel() xsafecall(cancel, self) end
---@param optionList table
local function onDefault(optionList)
for i = 1, (optionList.n or #optionList) do
local option = optionList[i]
if option then
local info = getInfo(option)
safecall(option.onDefault, info)
tdel(info)
if type(option.optionList) == "table" then onDefault(option.optionList) end
end
end
end
---@param self table
local function default(self)
self.refreshed = nil
onDefault(self._optionList)
setDefaults(self._optionList)
self._optionList = tdel(self._optionList)
self._oldValues = tdel(self._oldValues)
releaseAllControls(self._controls)
end
function PanelMixin:default() xsafecall(default, self) end
---@param optionList table
local function onRefresh(optionList)
for i = 1, (optionList.n or #optionList) do
local option = optionList[i]
if option then
local info = getInfo(option)
safecall(option.onRefresh, info)
tdel(info)
if type(option.optionList) == "table" then onRefresh(option.optionList) end
end
end
end
---@param optionList table
---@param parent any
local function copyOptionList(optionList, parent)
local newOptionList = tnew()
for i = 1, (optionList.n or #optionList) do
local option = optionList[i]
if option then
local newOption = tnew()
newOption.handler = option.handler or optionList.handler or (parent and parent.handler)
newOption.parent = parent or optionList
for k, v in pairs(option) do
if k ~= "handler" and k ~= "parent" and k ~= "optionList" then newOption[k] = v end
end
if option.optionList then
newOption.optionList = copyOptionList(option.optionList, newOption)
end
newOptionList[i] = newOption
end
end
return newOptionList
end
---@param optionList table
---@param values table | nil
---@return table values
local function getValues(optionList, values)
if not values then values = tnew() end
for i = 1, (optionList.n or #optionList) do
local option = optionList[i]
if option.type == "select" and option.isMulti then
values[option] = tnew()
for k, v in pairs(getOptionValue(option, "values") or tnew()) do -- luacheck: ignore 213
values[option][k] = getOptionValue(option, "get", k)
end
elseif option.type == "color" then
values[option] = tnew()
values[option].r, values[option].g, values[option].b, values[option].a = getOptionValue(option, "get")
if not option.hasAlpha then values[option].a = nil end
else
values[option] = getOptionValue(option, "get")
end
if option.optionList then getValues(option.optionList, values) end
end
return values
end
---@param self table
local function refresh(self)
local optionList = copyOptionList(self.optionList)
self._optionList = optionList
onRefresh(optionList)
self._oldValues = getValues(optionList)
self.refreshed = true
if self:IsVisible() then
releaseAllControls(self._controls)
self._controls = createControls(self._optionList)
onShow(self._optionList)
end
end
function PanelMixin:refresh() xsafecall(refresh, self) end
for i = 1, #panels do LJMixin:Mixin(panels[i], PanelMixin) end -- upgrade
local InterfaceAddOnsList_Update = InterfaceAddOnsList_Update
local InterfaceOptionsFrame = InterfaceOptionsFrame
local InterfaceOptions_AddCategory = InterfaceOptions_AddCategory
--[[
List of option attributes
==============================================================================
Note: All functions are called with 'option.arg' as first argument.
------------------------------------------------------------------------------
option.type = [string]
option.control = [string, frame, nil]
option.text = [string, function]
option.get = [any]
option.set = [any]
option.default = [any]
option.arg = [any]
option.tooltip = [string, function]
option.noCombat = [boolean, function]
option.hidden = [boolean, function]
option.disabled = [boolean, function]
option.icon = [string, function]
option.iconCoords = [number[], function]
option.optionList = [table]
option.handler = [table] -- inherited
option.path = [any]
--------------------------------------------------------------------------
-- type == "boolean"
--------------------------------------------------------------------------
option.isRadio = [boolean, function] -- not implemented yet
--------------------------------------------------------------------------
-- type == "header"
--------------------------------------------------------------------------
--------------------------------------------------------------------------
-- type == "number"
--------------------------------------------------------------------------
option.isPercent = [boolean, function]
option.step = [number, function]
option.min = [number, function]
option.max = [number, function]
option.minText = [string, function]
option.maxText = [string, function]
--------------------------------------------------------------------------
-- type == "function" -- not implemented yet
--------------------------------------------------------------------------
option.func = [function]
--------------------------------------------------------------------------
-- type == "string"
--------------------------------------------------------------------------
option.isReadOnly = [boolean, function]
option.maxLetters = [number, function]
option.justifyH = [string, function]
option.isMultiLine = [boolean, function]
--------------------------------------------------------------------------
-- type == "select"
--------------------------------------------------------------------------
option.values = [table<any, string>, function]
option.isMulti = [boolean]
--------------------------------------------------------------------------
-- type == "color"
--------------------------------------------------------------------------
option.hasAlpha = [boolean]
]]
---@param name string
---@param parent string
---@param optionList table
function lib:New(name, parent, optionList)
if type(name) ~= "string" then
error(
format("Usage: %s:New(name[, parent], optionList): 'name' - string expected got %s", MAJOR, type(name)),
2)
end
if type(parent) == "table" then optionList, parent = parent, nil end
if type(parent) ~= "string" and type(parent) ~= "nil" then
error(format("Usage: %s:New(name[, parent], optionList): 'parent' - string or nil expected got %s", MAJOR,
type(parent)), 2)
end
if type(optionList) ~= "table" then
error(format("Usage: %s:New(name[, parent], optionList): 'optionList' - table expected got %s", MAJOR,
type(optionList)), 2)
end
local panel = LJMixin:Mixin(CreateFrame("Frame"), {name = name, parent = parent, optionList = optionList},
PanelMixin)
panels[#panels + 1] = panel
InterfaceOptions_AddCategory(panel)
if InterfaceOptionsFrame:IsShown() then
panel:refresh()
InterfaceAddOnsList_Update()
end
end
setmetatable(lib, {__call = lib.New})
end
---@param control any
function lib:SetFocus(control)
if control ~= self.focus then
self:ClearFocus()
self.focus = control
end
end
---@return any control
function lib:GetFocus() return self.focus end
function lib:ClearFocus()
local focus = self:GetFocus()
if focus then
safecall(focus.ClearFocus, focus)
self.focus = nil
end
end
do -- InterfaceOptionsFrame
local OptionsListButtonToggle_OnClick = OptionsListButtonToggle_OnClick
---@param self table
---@param button string
local function OnDoubleClick(self, button)
local toggle = self.toggle
if toggle:IsShown() and button == "LeftButton" then OptionsListButtonToggle_OnClick(toggle) end
end
for i = 1, 31 do
local button = _G["InterfaceOptionsFrameAddOnsButton" .. i]
button:SetScript("OnDoubleClick", OnDoubleClick)
end
end
|
---@class CS.FairyGUI.GTree : CS.FairyGUI.GList
---@field public treeNodeRender (fun(node:CS.FairyGUI.GTreeNode, obj:CS.FairyGUI.GComponent):void)
---@field public treeNodeWillExpand (fun(node:CS.FairyGUI.GTreeNode, expand:boolean):void)
---@field public rootNode CS.FairyGUI.GTreeNode
---@field public indent number
---@field public clickToExpand number
---@type CS.FairyGUI.GTree
CS.FairyGUI.GTree = { }
---@return CS.FairyGUI.GTree
function CS.FairyGUI.GTree.New() end
---@return CS.FairyGUI.GTreeNode
function CS.FairyGUI.GTree:GetSelectedNode() end
---@overload fun(): CS.System.Collections.Generic.List_CS.FairyGUI.GTreeNode
---@return CS.System.Collections.Generic.List_CS.FairyGUI.GTreeNode
---@param optional result CS.System.Collections.Generic.List_CS.FairyGUI.GTreeNode
function CS.FairyGUI.GTree:GetSelectedNodes(result) end
---@overload fun(node:CS.FairyGUI.GTreeNode): void
---@param node CS.FairyGUI.GTreeNode
---@param optional scrollItToView boolean
function CS.FairyGUI.GTree:SelectNode(node, scrollItToView) end
---@param node CS.FairyGUI.GTreeNode
function CS.FairyGUI.GTree:UnselectNode(node) end
---@overload fun(): void
---@param optional folderNode CS.FairyGUI.GTreeNode
function CS.FairyGUI.GTree:ExpandAll(folderNode) end
---@overload fun(): void
---@param optional folderNode CS.FairyGUI.GTreeNode
function CS.FairyGUI.GTree:CollapseAll(folderNode) end
---@param buffer CS.FairyGUI.Utils.ByteBuffer
---@param beginPos number
function CS.FairyGUI.GTree:Setup_BeforeAdd(buffer, beginPos) end
return CS.FairyGUI.GTree
|
-- This file is automatically generated, do not edit!
-- Item data (c) Grinding Gear Games
return {
["MovementVelocityCorrupted"] = { affix = "", "(2-5)% increased Movement Speed", statOrderKey = "771", statOrder = { 771 }, level = 1, group = "MovementVelocity", weightKey = { "amulet", "boots", "default", }, weightVal = { 1000, 1000, 0, }, },
["MaxFrenzyChargesCorrupted"] = { affix = "", "+1 to Maximum Frenzy Charges", statOrderKey = "777", statOrder = { 777 }, level = 20, group = "MaximumFrenzyCharges", weightKey = { "boots", "amulet", "default", }, weightVal = { 1000, 1000, 0, }, },
["MaxPowerChargesCorrupted"] = { affix = "", "+1 to Maximum Power Charges", statOrderKey = "778", statOrder = { 778 }, level = 20, group = "IncreasedMaximumPowerCharges", weightKey = { "two_hand_weapon", "default", }, weightVal = { 1000, 0, }, },
["MinionDamageCorrupted"] = { affix = "", "Minions deal (15-20)% increased Damage", statOrderKey = "939", statOrder = { 939 }, level = 1, group = "MinionDamage", weightKey = { "helmet", "amulet", "default", }, weightVal = { 1000, 1000, 0, }, },
["SocketedVaalGemsIncreaseCorrupted"] = { affix = "", "+(1-2) to Level of Socketed Vaal Gems", statOrderKey = "36", statOrder = { 36 }, level = 1, group = "IncreaseSpecificSocketedGemLevel", weightKey = { "helmet", "gloves", "boots", "body_armour", "shield", "default", }, weightVal = { 1000, 1000, 1000, 1000, 1000, 0, }, },
["DamageTakenFlatReductionCorrupted1"] = { affix = "", "-(10-5) Physical Damage taken from Attacks", statOrderKey = "1172", statOrder = { 1172 }, level = 1, group = "PhysicalAttackDamageTaken", weightKey = { "amulet", "shield", "default", }, weightVal = { 1000, 1000, 0, }, },
["DamageTakenFlatReductionCorrupted2"] = { affix = "", "-(16-11) Physical Damage taken from Attacks", statOrderKey = "1172", statOrder = { 1172 }, level = 30, group = "PhysicalAttackDamageTaken", weightKey = { "amulet", "shield", "default", }, weightVal = { 1000, 1000, 0, }, },
["DamageTakenFlatReductionCorrupted3"] = { affix = "", "-(24-17) Physical Damage taken from Attacks", statOrderKey = "1172", statOrder = { 1172 }, level = 60, group = "PhysicalAttackDamageTaken", weightKey = { "amulet", "shield", "default", }, weightVal = { 1000, 1000, 0, }, },
["FireDamageLifeLeechPermyriadCorrupted"] = { affix = "", "0.2% of Fire Damage Leeched as Life", statOrderKey = "679", statOrder = { 679 }, level = 50, group = "FireDamageLifeLeech", weightKey = { "amulet", "quiver", "two_hand_weapon", "weapon", "default", }, weightVal = { 1000, 1000, 1000, 200, 0, }, },
["ColdDamageLifeLeechPermyriadCorrupted"] = { affix = "", "0.2% of Cold Damage Leeched as Life", statOrderKey = "681", statOrder = { 681 }, level = 50, group = "ColdDamageLifeLeech", weightKey = { "amulet", "quiver", "two_hand_weapon", "weapon", "default", }, weightVal = { 1000, 1000, 1000, 200, 0, }, },
["LightningDamageLifeLeechPermyriadCorrupted"] = { affix = "", "0.2% of Lightning Damage Leeched as Life", statOrderKey = "683", statOrder = { 683 }, level = 50, group = "LightningDamageLifeLeech", weightKey = { "amulet", "quiver", "two_hand_weapon", "weapon", "default", }, weightVal = { 1000, 1000, 1000, 200, 0, }, },
["IncreasedCastSpeedCorrupted"] = { affix = "", "(4-6)% increased Cast Speed", statOrderKey = "507", statOrder = { 507 }, level = 1, group = "IncreasedCastSpeed", weightKey = { "no_caster_mods", "ring", "gloves", "focus", "default", }, weightVal = { 0, 500, 1000, 1000, 0, }, tags = { "has_caster_mod", }, },
["ChanceToFleeCorrupted"] = { affix = "", "5% chance to Cause Monsters to Flee", statOrderKey = "995", statOrder = { 995 }, level = 1, group = "HitsCauseMonsterFlee", weightKey = { "weapon", "default", }, weightVal = { 1000, 0, }, },
["BlockChanceCorrupted"] = { affix = "", "(2-4)% Chance to Block", statOrderKey = "1446", statOrder = { 1446 }, level = 1, group = "BlockPercent", weightKey = { "staff", "amulet", "default", }, weightVal = { 1000, 1000, 0, }, },
["LocalAddedChaosDamageCorrupted1"] = { affix = "", "Adds (1-2) to (3-5) Chaos Damage", statOrderKey = "451", statOrder = { 451 }, level = 1, group = "LocalChaosDamage", weightKey = { "no_attack_mods", "weapon", "default", }, weightVal = { 0, 1000, 0, }, },
["LocalAddedChaosDamageCorrupted2"] = { affix = "", "Adds (6-8) to (11-13) Chaos Damage", statOrderKey = "451", statOrder = { 451 }, level = 20, group = "LocalChaosDamage", weightKey = { "no_attack_mods", "weapon", "default", }, weightVal = { 0, 1000, 0, }, },
["LocalAddedChaosDamageCorrupted3"] = { affix = "", "Adds (8-11) to (19-23) Chaos Damage", statOrderKey = "451", statOrder = { 451 }, level = 40, group = "LocalChaosDamage", weightKey = { "no_attack_mods", "weapon", "default", }, weightVal = { 0, 1000, 0, }, },
["AddedChaosDamageCorrupted1"] = { affix = "", "Adds 1 to (2-3) Chaos Damage to Attacks", statOrderKey = "450", statOrder = { 450 }, level = 1, group = "ChaosDamage", weightKey = { "no_attack_mods", "ring", "default", }, weightVal = { 0, 1000, 0, }, },
["AddedChaosDamageCorrupted2"] = { affix = "", "Adds (3-4) to (6-8) Chaos Damage to Attacks", statOrderKey = "450", statOrder = { 450 }, level = 20, group = "ChaosDamage", weightKey = { "no_attack_mods", "ring", "default", }, weightVal = { 0, 1000, 0, }, },
["AddedChaosDamageCorrupted3"] = { affix = "", "Adds (7-9) to (11-13) Chaos Damage to Attacks", statOrderKey = "450", statOrder = { 450 }, level = 40, group = "ChaosDamage", weightKey = { "no_attack_mods", "ring", "default", }, weightVal = { 0, 1000, 0, }, },
["SpellBlockChanceCorrupted"] = { affix = "", "(2-4)% Chance to Block Spells", statOrderKey = "1447", statOrder = { 1447 }, level = 1, group = "SpellBlockPercentage", weightKey = { "staff", "amulet", "shield", "default", }, weightVal = { 1000, 1000, 1000, 0, }, },
["AttackSpeedCorrupted"] = { affix = "", "(4-8)% increased Attack Speed", statOrderKey = "471", statOrder = { 471 }, level = 1, group = "IncreasedAttackSpeed", weightKey = { "no_attack_mods", "amulet", "default", }, weightVal = { 0, 1000, 0, }, tags = { "has_attack_mod", }, },
["WeaponElementalDamageCorrupted"] = { affix = "", "(6-12)% increased Elemental Damage with Attack Skills", statOrderKey = "3296", statOrder = { 3296 }, level = 1, group = "IncreasedWeaponElementalDamagePercent", weightKey = { "no_attack_mods", "ring", "amulet", "default", }, weightVal = { 0, 1000, 1000, 0, }, tags = { "has_attack_mod", }, },
["CullingStrikeCorrupted"] = { affix = "", "Culling Strike", statOrderKey = "992", statOrder = { 992 }, level = 1, group = "CullingStrike", weightKey = { "sword", "axe", "dagger", "wand", "bow", "claw", "default", }, weightVal = { 1000, 1000, 1000, 1000, 1000, 1000, 0, }, },
["ManaOnLifeLostCorrupted"] = { affix = "", "(3-6)% of Damage taken gained as Mana over 4 seconds when Hit", statOrderKey = "1336", statOrder = { 1336 }, level = 1, group = "PercentDamageGoesToMana", weightKey = { "amulet", "ring", "shield", "default", }, weightVal = { 1000, 1000, 1000, 0, }, },
["MaximumResistanceCorrupted"] = { affix = "", "+1% to all maximum Resistances", statOrderKey = "655", statOrder = { 655 }, level = 1, group = "MaximumResistances", weightKey = { "amulet", "body_armour", "default", }, weightVal = { 100, 200, 0, }, },
["AdditionalCurseCorrupted"] = { affix = "", "Enemies can have 1 additional Curse", statOrderKey = "1119", statOrder = { 1119 }, level = 1, group = "AdditionalCurseOnEnemies", weightKey = { "amulet", "default", }, weightVal = { 500, 0, }, },
["ChanceToAvoidFreezeCorruption"] = { affix = "", "(10-20)% chance to Avoid being Frozen", statOrderKey = "803", statOrder = { 803 }, level = 1, group = "ChanceToAvoidFreezeAndChill", weightKey = { "amulet", "body_armour", "ring", "default", }, weightVal = { 500, 500, 100, 0, }, },
["ChanceToAvoidIgniteCorruption"] = { affix = "", "(10-20)% chance to Avoid being Ignited", statOrderKey = "804", statOrder = { 804 }, level = 1, group = "AvoidIgnite", weightKey = { "amulet", "body_armour", "shield", "default", }, weightVal = { 500, 500, 500, 0, }, },
["ChaosResistCorruption"] = { affix = "", "+(2-4)% to Chaos Resistance", statOrderKey = "654", statOrder = { 654 }, level = 1, group = "ChaosResistance", weightKey = { "fishing_rod", "weapon", "jewel", "default", }, weightVal = { 0, 0, 0, 2000, }, },
["ChanceToDodgeCorruption"] = { affix = "", "(2-4)% chance to Dodge Attacks", statOrderKey = "1114", statOrder = { 1114 }, level = 1, group = "ChanceToDodge", weightKey = { "boots", "default", }, weightVal = { 1000, 0, }, },
["CannotBeKnockedBackCorruption"] = { affix = "", "Cannot be Knocked Back", statOrderKey = "577", statOrder = { 577 }, level = 1, group = "ImmuneToKnockback", weightKey = { "boots", "body_armour", "default", }, weightVal = { 1000, 1000, 0, }, },
["GemLevelCorruption"] = { affix = "", "+1 to Level of Socketed Gems", statOrderKey = "18", statOrder = { 18 }, level = 1, group = "IncreaseSocketedGemLevel", weightKey = { "boots", "gloves", "body_armour", "shield", "default", }, weightVal = { 1000, 1000, 1000, 1000, 0, }, },
["AvoidShockCorruption"] = { affix = "", "(10-20)% chance to Avoid being Shocked", statOrderKey = "806", statOrder = { 806 }, level = 1, group = "ReducedShockChance", weightKey = { "body_armour", "belt", "default", }, weightVal = { 1000, 1000, 0, }, },
["CannotBeLeechedFromCorruption"] = { affix = "", "Enemies Cannot Leech Life From You", statOrderKey = "1326", statOrder = { 1326 }, level = 1, group = "EnemiesCantLifeLeech", weightKey = { "helmet", "default", }, weightVal = { 1000, 0, }, },
["DamageTakenFromManaBeforeLifeCorruption"] = { affix = "", "(3-5)% of Damage is taken from Mana before Life", statOrderKey = "1544", statOrder = { 1544 }, level = 1, group = "DamageRemovedFromManaBeforeLife", weightKey = { "helmet", "default", }, weightVal = { 1000, 0, }, },
["DamageConversionFireCorruption"] = { affix = "", "(10-20)% of Physical Damage Converted to Fire Damage", statOrderKey = "916", statOrder = { 916 }, level = 1, group = "ConvertPhysicalToFire", weightKey = { "quiver", "sceptre", "default", }, weightVal = { 500, 500, 0, }, },
["DamageConversionColdCorruption"] = { affix = "", "(10-20)% of Physical Damage Converted to Cold Damage", statOrderKey = "917", statOrder = { 917 }, level = 1, group = "ConvertPhysicalToCold", weightKey = { "quiver", "sceptre", "default", }, weightVal = { 500, 500, 0, }, },
["DamageConversionLighningCorruption"] = { affix = "", "(10-20)% of Physical Damage Converted to Lightning Damage", statOrderKey = "918", statOrder = { 918 }, level = 1, group = "LightningDamageAsPortionOfDamage", weightKey = { "quiver", "sceptre", "default", }, weightVal = { 500, 500, 0, }, },
["AdditionalArrowsCorruption"] = { affix = "", "Adds an additional Arrow", statOrderKey = "767", statOrder = { 767 }, level = 1, group = "AdditionalArrows", weightKey = { "no_attack_mods", "quiver", "bow", "default", }, weightVal = { 0, 1000, 500, 0, }, },
["AdditionalAOERangeCorruption"] = { affix = "", "(4-6)% increased Area of Effect", statOrderKey = "837", statOrder = { 837 }, level = 1, group = "AreaOfEffect", weightKey = { "belt", "default", }, weightVal = { 1000, 0, }, },
["IncreasedDurationCorruption"] = { affix = "", "(5-8)% increased Skill Effect Duration", statOrderKey = "845", statOrder = { 845 }, level = 1, group = "SkillEffectDuration", weightKey = { "belt", "default", }, weightVal = { 1000, 0, }, },
["AdditionalTrapsCorruption_"] = { affix = "", "Can have up to 1 additional Trap placed at a time", statOrderKey = "1192", statOrder = { 1192 }, level = 1, group = "TrapsAllowed", weightKey = { "belt", "default", }, weightVal = { 1000, 0, }, },
["MaximumEnduranceChargesCorruption_"] = { affix = "", "+1 to Maximum Endurance Charges", statOrderKey = "776", statOrder = { 776 }, level = 1, group = "MaximumEnduranceCharges", weightKey = { "belt", "default", }, weightVal = { 1000, 0, }, },
["DualWieldBlockCorruption"] = { affix = "", "(3-6)% additional Block Chance while Dual Wielding", statOrderKey = "329", statOrder = { 329 }, level = 1, group = "BlockWhileDualWielding", weightKey = { "sceptre", "axe", "mace", "wand", "one_hand_weapon", "default", }, weightVal = { 0, 0, 0, 0, 1000, 0, }, },
["AdditionalPierceCorruption"] = { affix = "", "Arrows Pierce an additional Target", statOrderKey = "765", statOrder = { 765 }, level = 1, group = "ArrowPierce", weightKey = { "no_attack_mods", "bow", "default", }, weightVal = { 0, 1000, 0, }, },
["GlobalPierceCorruption"] = { affix = "", "(4-8)% increased Projectile Speed", statOrderKey = "768", statOrder = { 768 }, level = 1, group = "ProjectileSpeed", weightKey = { "wand", "default", }, weightVal = { 0, 0, }, },
["CurseOnHitTemporalChainsCurruption"] = { affix = "", "Curse Enemies with Level (10-12) Temporal Chains on Hit", statOrderKey = "1385", statOrder = { 1385 }, level = 30, group = "CurseOnHitLevel", weightKey = { "gloves", "default", }, weightVal = { 400, 0, }, },
["CurseOnHitVulnerabilityCorruption"] = { affix = "", "Curse Enemies with Level (10-12) Vulnerability on Hit", statOrderKey = "1386", statOrder = { 1386 }, level = 30, group = "CurseOnHitLevel", weightKey = { "gloves", "default", }, weightVal = { 400, 0, }, },
["CurseOnHitElementalWeaknessCorruption"] = { affix = "", "Curse Enemies with Level (10-12) Elemental Weakness on Hit", statOrderKey = "1388", statOrder = { 1388 }, level = 30, group = "CurseOnHitLevel", weightKey = { "gloves", "default", }, weightVal = { 400, 0, }, },
["SupportedByCastOnStunCorruption"] = { affix = "", "Socketed Gems are supported by Level 12 Cast when Stunned", statOrderKey = "127", statOrder = { 127 }, level = 35, group = "SupportedByTrigger", weightKey = { "gloves", "helmet", "default", }, weightVal = { 1000, 1000, 0, }, },
["SupportedByCastOnCritCorruption"] = { affix = "", "Socketed Gems are supported by Level 12 Cast On Critical Strike", statOrderKey = "126", statOrder = { 126 }, level = 35, group = "SupportedByTrigger", weightKey = { "gloves", "helmet", "default", }, weightVal = { 1000, 1000, 0, }, },
["SupportedByMeleeSplashCorruption"] = { affix = "", "Socketed Gems are supported by Level 10 Melee Splash", statOrderKey = "125", statOrder = { 125 }, level = 20, group = "SupportedByMelee", weightKey = { "no_attack_mods", "wand", "one_hand_weapon", "default", }, weightVal = { 0, 0, 1000, 0, }, },
["SupportedByAddedFireDamageCorrupted"] = { affix = "", "Socketed Gems are Supported by Level 12 Added Fire Damage", statOrderKey = "116", statOrder = { 116 }, level = 48, group = "DisplaySocketedGemsGetAddedFireDamage", weightKey = { "two_hand_weapon", "mace", "default", }, weightVal = { 0, 1000, 0, }, },
["SupportedByStunCorrupted"] = { affix = "", "Socketed Gems are supported by Level 6 Stun", statOrderKey = "129", statOrder = { 129 }, level = 38, group = "SupportedByStun", weightKey = { "mace", "default", }, weightVal = { 1000, 0, }, },
["LocalMeleeWeaponRangeCorrupted"] = { affix = "", "+(1-2) to Weapon range", statOrderKey = "1581", statOrder = { 1581 }, level = 1, group = "MeleeWeaponAndUnarmedRange", weightKey = { "no_attack_mods", "sceptre", "rapier", "wand", "bow", "weapon", "default", }, weightVal = { 0, 0, 0, 0, 0, 1000, 0, }, tags = { "has_attack_mod", }, },
["SocketedSkillsManaMultiplierCorrupted"] = { affix = "", "Socketed Skill Gems get a 95% Mana Multiplier", statOrderKey = "169", statOrder = { 169 }, level = 1, group = "SocketedGemsHaveReducedManaCost", weightKey = { "body_armour", "default", }, weightVal = { 1000, 0, }, },
["SupportedByElementalProliferationCorrupted"] = { affix = "", "Socketed Gems are Supported by Level 1 Elemental Proliferation", statOrderKey = "120", statOrder = { 120 }, level = 12, group = "DisplaySocketedGemGetsElementalProliferation", weightKey = { "wand", "default", }, weightVal = { 1000, 0, }, },
["SupportedByAccuracyCorrupted_"] = { affix = "", "Socketed Gems are supported by Level 12 Additional Accuracy", statOrderKey = "130", statOrder = { 130 }, level = 48, group = "SupportedByAccuracy", weightKey = { "no_attack_mods", "one_hand_weapon", "sword", "default", }, weightVal = { 0, 0, 1000, 0, }, },
["SupportedByMultistrikeCorrupted"] = { affix = "", "Socketed Gems are supported by Level 1 Multistrike", statOrderKey = "131", statOrder = { 131 }, level = 28, group = "SupportedByMultistrike", weightKey = { "no_attack_mods", "two_hand_weapon", "sword", "default", }, weightVal = { 0, 0, 1000, 0, }, },
["SupportedByAreaOfEffectCorrupted_"] = { affix = "", "Socketed Gems are Supported by Level 1 Increased Area of Effect", statOrderKey = "50", statOrder = { 50 }, level = 24, group = "DisplaySocketedGemGetsIncreasedAreaOfEffectLevel", weightKey = { "staff", "default", }, weightVal = { 1000, 0, }, },
["SupportedByLifeLeechCorrupted"] = { affix = "", "Socketed Gems are supported by Level 15 Life Leech", statOrderKey = "133", statOrder = { 133 }, level = 59, group = "SupportedByLifeLeech", weightKey = { "claw", "default", }, weightVal = { 1000, 0, }, },
["SupportedByCriticalMultiplierCorrupted"] = { affix = "", "Socketed Gems are supported by Level 14 Increased Critical Damage", statOrderKey = "134", statOrder = { 134 }, level = 35, group = "SupportedByCriticalMultiplier", weightKey = { "dagger", "default", }, weightVal = { 1000, 0, }, },
["SupportedByForkCorrupted"] = { affix = "", "Socketed Gems are supported by Level 1 Fork", statOrderKey = "135", statOrder = { 135 }, level = 6, group = "SupportedByFork", weightKey = { "bow", "default", }, weightVal = { 1000, 0, }, },
["SupportedByWeaponElementalDamageCorrupted_"] = { affix = "", "Socketed Gems are supported by Level 12 Elemental Damage with Attacks", statOrderKey = "136", statOrder = { 136 }, level = 24, group = "SupportedByWeaponElementalDamage", weightKey = { "no_attack_mods", "sceptre", "default", }, weightVal = { 0, 1000, 0, }, },
["SupportedByFasterCastCorrupted"] = { affix = "", "Socketed Gems are Supported by Level 10 Faster Casting", statOrderKey = "143", statOrder = { 143 }, level = 24, group = "DisplaySocketedGemsGetFasterCast", weightKey = { "no_caster_mods", "sceptre", "default", }, weightVal = { 0, 1000, 0, }, },
["PuritySkillCorrupted"] = { affix = "", "Grants Level 15 Purity of Elements Skill", statOrderKey = "216", statOrder = { 216 }, level = 45, group = "GrantedSkill", weightKey = { "amulet", "belt", "default", }, weightVal = { 300, 1000, 0, }, },
["CriticalWeaknessSkillCorrupted"] = { affix = "", "Grants Level 10 Assassin's Mark Skill", statOrderKey = "218", statOrder = { 218 }, level = 31, group = "GrantedSkill", weightKey = { "gloves", "default", }, weightVal = { 1000, 0, }, },
["PurityOfFireSkillCorrupted_"] = { affix = "", "Grants Level 15 Purity of Fire Skill", statOrderKey = "200", statOrder = { 200 }, level = 45, group = "GrantedSkill", weightKey = { "amulet", "body_armour", "default", }, weightVal = { 150, 500, 0, }, },
["PurityOfColdSkillCorrupted"] = { affix = "", "Grants Level 15 Purity of Ice Skill", statOrderKey = "205", statOrder = { 205 }, level = 45, group = "GrantedSkill", weightKey = { "amulet", "body_armour", "default", }, weightVal = { 150, 500, 0, }, },
["PurityOfLightningSkillCorrupted"] = { affix = "", "Grants Level 15 Purity of Lightning Skill", statOrderKey = "207", statOrder = { 207 }, level = 45, group = "GrantedSkill", weightKey = { "amulet", "body_armour", "default", }, weightVal = { 150, 500, 0, }, },
["WrathSkillCorrupted"] = { affix = "", "Grants Level 7 Wrath Skill", statOrderKey = "219", statOrder = { 219 }, level = 28, group = "GrantedSkill", weightKey = { "helmet", "default", }, weightVal = { 330, 0, }, },
["HatredSkillCorrupted"] = { affix = "", "Grants Level 11 Hatred Skill", statOrderKey = "220", statOrder = { 220 }, level = 44, group = "GrantedSkill", weightKey = { "helmet", "default", }, weightVal = { 330, 0, }, },
["AngerSkillCorrupted"] = { affix = "", "Grants Level 15 Anger Skill", statOrderKey = "221", statOrder = { 221 }, level = 56, group = "GrantedSkill", weightKey = { "helmet", "default", }, weightVal = { 330, 0, }, },
["DeterminationSkillCorrupted"] = { affix = "", "Grants Level 16 Determination Skill", statOrderKey = "222", statOrder = { 222 }, level = 61, group = "GrantedSkill", weightKey = { "shield", "default", }, weightVal = { 330, 0, }, },
["GraceSkillCorrupted"] = { affix = "", "Grants Level 16 Grace Skill", statOrderKey = "223", statOrder = { 223 }, level = 61, group = "GrantedSkill", weightKey = { "shield", "default", }, weightVal = { 330, 0, }, },
["DisciplineSkillCorrupted"] = { affix = "", "Grants Level 16 Discipline Skill", statOrderKey = "225", statOrder = { 225 }, level = 61, group = "GrantedSkill", weightKey = { "shield", "default", }, weightVal = { 330, 0, }, },
["ProjectileWeaknessSkillCorrupted"] = { affix = "", "Grants Level 15 Projectile Weakness Skill", statOrderKey = "229", statOrder = { 229 }, level = 58, group = "GrantedSkill", weightKey = { "quiver", "default", }, weightVal = { 1000, 0, }, },
["ElementalWeaknessSkillCorrupted"] = { affix = "", "Grants Level 10 Elemental Weakness Skill", statOrderKey = "230", statOrder = { 230 }, level = 31, group = "GrantedSkill", weightKey = { "wand", "default", }, weightVal = { 1000, 0, }, },
["VulnerabilitySkillCorrupted"] = { affix = "", "Grants Level 10 Vulnerability Skill", statOrderKey = "232", statOrder = { 232 }, level = 31, group = "GrantedSkill", weightKey = { "axe", "default", }, weightVal = { 1000, 0, }, },
["ClaritySkillCorrupted1"] = { affix = "", "Grants Level 4 Clarity Skill", statOrderKey = "214", statOrder = { 214 }, level = 19, group = "GrantedSkill", weightKey = { "amulet", "belt", "default", }, weightVal = { 250, 350, 0, }, },
["ClaritySkillCorrupted2"] = { affix = "", "Grants Level 8 Clarity Skill", statOrderKey = "214", statOrder = { 214 }, level = 32, group = "GrantedSkill", weightKey = { "amulet", "belt", "default", }, weightVal = { 250, 350, 0, }, },
["ClaritySkillCorrupted3"] = { affix = "", "Grants Level 12 Clarity Skill", statOrderKey = "214", statOrder = { 214 }, level = 47, group = "GrantedSkill", weightKey = { "belt", "default", }, weightVal = { 350, 0, }, },
["ClaritySkillCorrupted4"] = { affix = "", "Grants Level 16 Clarity Skill", statOrderKey = "214", statOrder = { 214 }, level = 59, group = "GrantedSkill", weightKey = { "belt", "default", }, weightVal = { 350, 0, }, },
["FrostbiteSkillCorrupted"] = { affix = "", "Grants Level 14 Frostbite Skill", statOrderKey = "211", statOrder = { 211 }, level = 46, group = "GrantedSkill", weightKey = { "ring", "default", }, weightVal = { 500, 0, }, },
["FlammabilitySkillCorrupted"] = { affix = "", "Grants Level 14 Flammability Skill", statOrderKey = "208", statOrder = { 208 }, level = 46, group = "GrantedSkill", weightKey = { "ring", "default", }, weightVal = { 500, 0, }, },
["ConductivitySkillCorrupted"] = { affix = "", "Grants Level 14 Conductivity Skill", statOrderKey = "210", statOrder = { 210 }, level = 46, group = "GrantedSkill", weightKey = { "ring", "default", }, weightVal = { 500, 0, }, },
["TemporalChainsSkillCorrupted"] = { affix = "", "Grants Level 14 Temporal Chains Skill", statOrderKey = "212", statOrder = { 212 }, level = 40, group = "GrantedSkill", weightKey = { "boots", "default", }, weightVal = { 1000, 0, }, },
["HasteSkillCorrupted"] = { affix = "", "Grants Level 14 Haste Skill", statOrderKey = "213", statOrder = { 213 }, level = 40, group = "GrantedSkill", weightKey = { "boots", "default", }, weightVal = { 1000, 0, }, },
["ManaOnHitCorrupted"] = { affix = "", "+(1-2) Mana gained for each Enemy hit by your Attacks", statOrderKey = "724", statOrder = { 724 }, level = 40, group = "ManaGainPerTarget", weightKey = { "no_attack_mods", "ring", "default", }, weightVal = { 0, 500, 0, }, },
["VitalitySkillCorrupted"] = { affix = "", "Grants Level 15 Vitality Skill", statOrderKey = "215", statOrder = { 215 }, level = 35, group = "GrantedSkill", weightKey = { "belt", "default", }, weightVal = { 1000, 0, }, },
["FishingQuantityCorrupted"] = { affix = "", "(5-10)% increased Quantity of Fish Caught", statOrderKey = "1690", statOrder = { 1690 }, level = 1, group = "FishingQuantity", weightKey = { "fishing_rod", "default", }, weightVal = { 1000, 0, }, },
["FishingRarityCorrupted"] = { affix = "", "(5-10)% increased Rarity of Fish Caught", statOrderKey = "1691", statOrder = { 1691 }, level = 1, group = "FishingRarity", weightKey = { "fishing_rod", "default", }, weightVal = { 1000, 0, }, },
["CastSpeedCorrupted"] = { affix = "", "(10-20)% increased Cast Speed", statOrderKey = "507", statOrder = { 507 }, level = 1, group = "IncreasedCastSpeed", weightKey = { "no_caster_mods", "fishing_rod", "default", }, weightVal = { 0, 1000, 0, }, },
["CanCatchCorruptFishCorrupted"] = { affix = "", "You can catch Corrupted Fish", statOrderKey = "1697", statOrder = { 1697 }, level = 1, group = "Other", weightKey = { "fishing_rod", "default", }, weightVal = { 1000, 0, }, },
["ChaosResistJewelCorrupted"] = { affix = "", "+(1-3)% to Chaos Resistance", statOrderKey = "654", statOrder = { 654 }, level = 1, group = "ChaosResistance", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["ReducedCharacterSizeJewelCorrupted"] = { affix = "", "1% reduced Character Size", statOrderKey = "1011", statOrder = { 1011 }, level = 1, group = "ActorSize", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["ReducedChillDurationJewelCorrupted"] = { affix = "", "(3-5)% reduced Chill Duration on You", statOrderKey = "829", statOrder = { 829 }, level = 1, group = "ReducedChillDuration", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["ReducedFreezeDurationJewelCorrupted"] = { affix = "", "(3-5)% reduced Freeze Duration on You", statOrderKey = "831", statOrder = { 831 }, level = 1, group = "ReducedFreezeDuration", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["ReducedIgniteDurationJewelCorrupted"] = { affix = "", "(3-5)% reduced Ignite Duration on You", statOrderKey = "832", statOrder = { 832 }, level = 1, group = "ReducedBurnDuration", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["ReducedShockDurationJewelCorrupted"] = { affix = "", "(3-5)% reduced Shock Duration on You", statOrderKey = "830", statOrder = { 830 }, level = 1, group = "ReducedShockDuration", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["IncreasedChargeDurationJewelCorrupted_"] = { affix = "", "(3-7)% increased Endurance, Frenzy and Power Charge Duration", statOrderKey = "1845", statOrder = { 1845 }, level = 1, group = "ChargeDuration", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["AddedChaosDamageJewelCorrupted"] = { affix = "", "Adds 1 to (2-3) Chaos Damage to Attacks", statOrderKey = "450", statOrder = { 450 }, level = 1, group = "ChaosDamage", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["ChanceToBeCritJewelCorrupted"] = { affix = "", "(3-5)% additional Chance to receive a Critical Strike", statOrderKey = "1936", statOrder = { 1936 }, level = 1, group = "ChanceToTakeCriticalStrike", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["DamageWhileDeadJewelCorrupted"] = { affix = "", "(20-30)% increased Damage while Dead", statOrderKey = "1911", statOrder = { 1911 }, level = 1, group = "DamageWhileDead", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["VaalSkillDamageJewelCorrupted"] = { affix = "", "(5-10)% increased Vaal Skill Damage", statOrderKey = "1910", statOrder = { 1910 }, level = 1, group = "VaalSkillDamage", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["ChaosDamagePerCorruptedItemJewelCorrupted"] = { affix = "", "1% increased Chaos Damage for each Equipped Corrupted Item", statOrderKey = "1912", statOrder = { 1912 }, level = 1, group = "ChaosDamagePerCorruptedItem", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["LifeLeechRatePerCorruptedItemJewelCorrupted"] = { affix = "", "1% increased Life Leeched per second for each Equipped Corrupted Item", statOrderKey = "1913", statOrder = { 1913 }, level = 1, group = "LifeLeechRatePerCorruptedItem", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["ManaLeechRatePerCorruptedItemJewelCorrupted"] = { affix = "", "1% increased Mana Leeched per second for each Equipped Corrupted Item", statOrderKey = "1914", statOrder = { 1914 }, level = 1, group = "ManaLeechRatePerCorrupteditem", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["SilenceImmunityJewelCorrupted"] = { affix = "", "You cannot be Cursed with Silence", statOrderKey = "1909", statOrder = { 1909 }, level = 1, group = "PlayerCurseImmunity", weightKey = { "jewel", "default", }, weightVal = { 1000, 0, }, },
["ChaosResistAbyssJewelCorrupted"] = { affix = "", "+(1-3)% to Chaos Resistance", statOrderKey = "654", statOrder = { 654 }, level = 1, group = "ChaosResistance", weightKey = { "default", }, weightVal = { 1000, }, },
["ReducedCharacterSizeAbyssJewelCorrupted"] = { affix = "", "1% reduced Character Size", statOrderKey = "1011", statOrder = { 1011 }, level = 1, group = "ActorSize", weightKey = { "default", }, weightVal = { 1000, }, },
["ReducedChillDurationAbyssJewelCorrupted"] = { affix = "", "(3-5)% reduced Chill Duration on You", statOrderKey = "829", statOrder = { 829 }, level = 1, group = "ReducedChillDuration", weightKey = { "default", }, weightVal = { 1000, }, },
["ReducedFreezeDurationAbyssJewelCorrupted_"] = { affix = "", "(3-5)% reduced Freeze Duration on You", statOrderKey = "831", statOrder = { 831 }, level = 1, group = "ReducedFreezeDuration", weightKey = { "default", }, weightVal = { 1000, }, },
["ReducedIgniteDurationAbyssJewelCorrupted"] = { affix = "", "(3-5)% reduced Ignite Duration on You", statOrderKey = "832", statOrder = { 832 }, level = 1, group = "ReducedBurnDuration", weightKey = { "default", }, weightVal = { 1000, }, },
["ReducedShockDurationAbyssJewelCorrupted"] = { affix = "", "(3-5)% reduced Shock Duration on You", statOrderKey = "830", statOrder = { 830 }, level = 1, group = "ReducedShockDuration", weightKey = { "default", }, weightVal = { 1000, }, },
["IncreasedChargeDurationAbyssJewelCorrupted"] = { affix = "", "(3-7)% increased Endurance, Frenzy and Power Charge Duration", statOrderKey = "1845", statOrder = { 1845 }, level = 1, group = "ChargeDuration", weightKey = { "default", }, weightVal = { 1000, }, },
["AddedChaosDamageAbyssJewelCorrupted"] = { affix = "", "Adds 1 to (2-3) Chaos Damage to Attacks", statOrderKey = "450", statOrder = { 450 }, level = 1, group = "ChaosDamage", weightKey = { "default", }, weightVal = { 1000, }, },
["ChanceToBeCritAbyssJewelCorrupted_"] = { affix = "", "(3-5)% additional Chance to receive a Critical Strike", statOrderKey = "1936", statOrder = { 1936 }, level = 1, group = "ChanceToTakeCriticalStrike", weightKey = { "default", }, weightVal = { 1000, }, },
["DamageWhileDeadAbyssJewelCorrupted"] = { affix = "", "(20-30)% increased Damage while Dead", statOrderKey = "1911", statOrder = { 1911 }, level = 1, group = "DamageWhileDead", weightKey = { "default", }, weightVal = { 1000, }, },
["VaalSkillDamageAbyssJewelCorrupted"] = { affix = "", "(5-10)% increased Vaal Skill Damage", statOrderKey = "1910", statOrder = { 1910 }, level = 1, group = "VaalSkillDamage", weightKey = { "default", }, weightVal = { 1000, }, },
["ChaosDamagePerCorruptedItemAbyssJewelCorrupted"] = { affix = "", "1% increased Chaos Damage for each Equipped Corrupted Item", statOrderKey = "1912", statOrder = { 1912 }, level = 1, group = "ChaosDamagePerCorruptedItem", weightKey = { "default", }, weightVal = { 1000, }, },
["LifeLeechRatePerCorruptedItemAbyssJewelCorrupted"] = { affix = "", "1% increased Life Leeched per second for each Equipped Corrupted Item", statOrderKey = "1913", statOrder = { 1913 }, level = 1, group = "LifeLeechRatePerCorruptedItem", weightKey = { "default", }, weightVal = { 1000, }, },
["ManaLeechRatePerCorruptedItemAbyssJewelCorrupted"] = { affix = "", "1% increased Mana Leeched per second for each Equipped Corrupted Item", statOrderKey = "1914", statOrder = { 1914 }, level = 1, group = "ManaLeechRatePerCorrupteditem", weightKey = { "default", }, weightVal = { 1000, }, },
["SilenceImmunityAbyssJewelCorrupted"] = { affix = "", "You cannot be Cursed with Silence", statOrderKey = "1909", statOrder = { 1909 }, level = 1, group = "PlayerCurseImmunity", weightKey = { "default", }, weightVal = { 1000, }, },
} |
function CreateImportProfilesForm()
local form=createWidget(nil, "importProfilesForm", "Form", WIDGET_ALIGN_LOW, WIDGET_ALIGN_LOW, 600, 280, 800, 450)
priority(form, 5500)
hide(form)
local panel=createWidget(form, nil, "Panel")
setLocaleText(createWidget(form, "importProfilesHeader", "TextView", WIDGET_ALIGN_CENTER, nil, 450, 20, nil, 20))
setText(createWidget(form, "closeButton", "Button", WIDGET_ALIGN_HIGH, WIDGET_ALIGN_LOW, 20, 20, 20, 20), "x")
setLocaleText(createWidget(form, "importBtn", "Button", WIDGET_ALIGN_CENTER, WIDGET_ALIGN_HIGH, 150, 25, 0, 10))
createWidget(form, "EditBox1", "EditBox", nil, nil, 560, 180, 20, 50)
DnD.Init(form, panel, true)
return form
end
function ShowImportError()
local form=createWidget(nil, "importProfilesError", "Form", WIDGET_ALIGN_LOW, WIDGET_ALIGN_LOW, 350, 100, 50, 100)
priority(form, 5501)
local panel=createWidget(form, nil, "Panel")
setLocaleText(createWidget(form, "importErrorTxt", "TextView", WIDGET_ALIGN_CENTER, nil, 300, 20, nil, 20))
setText(createWidget(form, "closeButton", "Button", WIDGET_ALIGN_HIGH, WIDGET_ALIGN_LOW, 20, 20, 20, 20), "x")
setLocaleText(createWidget(form, "closeButtonOK", "Button", WIDGET_ALIGN_CENTER, WIDGET_ALIGN_HIGH, 150, 25, 0, 10))
DnD.Init(form, panel, true)
show(form)
end
function GetImportText(aForm)
return getText(getChild(aForm, "EditBox1"))
end |
Weapon.PrettyName = "G3SG1"
Weapon.WeaponID = "swb_css_g3sg1"
Weapon.DamageMultiplier = 1.9
Weapon.WeaponType = WEAPON_PRIMARY |
local sti = require 'libs.sti'
local GameObject = require 'objects.GameObject'
local Health = require 'objects.components.Health_cmp'
local Player = require 'objects.assemblages.Player_asm'
local Physics = require 'objects.components.Physics_cmp'
local RenderSystem = require 'objects.systems.Render_sys'
local GravitySystem = require 'objects.systems.Gravity_sys'
local Engine = require 'objects.Engine'
function love.load()
local entity1 = Player:new()
local entity2 = Player:new()
entity2:addComponent(Physics:new(5))
local entity3 = Player:new()
entities = {entity1, entity2, entity3}
Run = Engine:new(entities)
local Render = RenderSystem:new()
Run:addSystem(Render, 'draw')
local Gravity = GravitySystem:new()
Run:addSystem(Gravity, 'update')
end
function love.update(dt)
Run:update(dt)
end
function love.draw()
Run:draw()
end |
local CqueuesErrno = require "cqueues.errno"
local Server = require "http.server"
local Response = require "framework.response"
local Request = require "framework.request"
local Controller = require "framework.controller"
local appMethods = {}
local appMetaTable = {
__index = appMethods;
__name = nil;
}
local notFoundText = [[
<html>
<head>
<title>404 Not Found</title>
</head>
<body>
It appears that the resource you are looking for is not here.
</body>
</html>
]]
local methodNotAllowedText = [[
<html>
<head>
<title>405 Method Not Allowed</title>
</head>
<body>
It appears that you are using the wrong method.
</body>
</html>
]]
local function defaultOnstream(...)
io.stdout:write(string.format(...), "\n\n")
end
local defaultOnerror = defaultOnstream
local function defaultLog(response)
io.stdout:write(response:combinedLog(), "\n")
end
local notFoundController = Controller.new(function(req, resp)
resp:setStatus("404")
resp:setBody(notFoundText)
end)
local methodNotAllowedController = Controller.new(function(req, resp)
resp:setStatus("405")
resp:setBody(methodNotAllowedText)
end)
function appMethods:run()
while true do
self.server:loop()
end
end
local function new(options)
local onerror = options.onerror or defaultOnerror
local log = options.log or defaultLog
local controllers = {};
options.onstream = function(_, stream)
local requestHeaders, err, errno = stream:get_headers()
if requestHeaders == nil then
-- connection hit EOF before headers arrived
stream:shutdown()
if err ~= CqueuesErrno.EPIPE and errno ~= CqueuesErrno.ECONNRESET then
onerror("header error: %s", tostring(err))
end
return
end
local resp = Response.new(requestHeaders, stream)
local req = Request.new(requestHeaders, stream)
local ok, err2
local controllersByPath = controllers[requestHeaders:get(":path")]
if (controllersByPath) then
local controller = controllersByPath[requestHeaders:get(":method")]
if (controller) then
ok, err2 = pcall(controller.performAction, controller, req, resp) -- only works in 5.2+
else
ok, err2 = pcall(methodNotAllowedController.performAction, methodNotAllowedController, req, resp) -- only works in 5.2+
end
else
ok, err2 = pcall(notFoundController.performAction, notFoundController, req, resp) -- only works in 5.2+
end
log(resp)
if stream.state ~= "closed" and stream.state ~= "half closed (local)" then
if not ok then
resp:setAsError503()
end
local isBodySent = resp.body and requestHeaders:get ":method" ~= "HEAD"
stream:write_headers(resp.headers, not isBodySent)
if isBodySent then
stream:write_chunk(resp.body, true)
end
end
stream:shutdown()
if not ok then
onerror("stream error: %s", tostring(err2))
end
end
local innerServer = Server.listen(options)
return setmetatable({
host = options.host;
port = options.port;
tls = options.tls;
server = innerServer;
controllers = controllers;
}, appMetaTable
)
end
function appMethods:registerController(path, method, callback)
if (type(callback) ~= 'function') then
defaultOnerror("asdfasfsda")
end
if (self.controllers[path] == nil) then
self.controllers[path] = {}
end
self.controllers[path][method] = Controller.new(callback)
end
return {
new = new;
} |
--[[
module:FacadeTest
author:DylanYang
time:2021-02-09 18:29:47
]]
local PageMaker = require("patterns.structural.facade.PageMaker")
local super = require("patterns.BaseTest")
local _M = Class("FacadeTest", super)
function _M.protected:DoExecTest()
PageMaker:MakeWelcomePage("hyuki@hyuki.com", "welcome.html")
end
return _M |
--[[
© CloudSixteen.com do not share, re-distribute or modify
without permission of its author (kurozael@gmail.com).
Clockwork was created by Conna Wiles (also known as kurozael.)
http://cloudsixteen.com/license/clockwork.html
--]]
CW_FRENCH = Clockwork.lang:GetTable("French");
CW_FRENCH["HintBook"] = "Liser un livre, donne à votre personnage des connaissances.";
CW_FRENCH["Books"] = "Livres";
CW_FRENCH["Read"] = "Lire"; |
local save_crafts = require("modules/inventory_sync/save_crafts")
local restore_crafts = require("modules/inventory_sync/restore_crafts")
function add_commands()
--[[
Command to serialize crafting queue for transport.
When serialized, the crafting queue is cleared and stored in global. The items received are cleared as well.
Upon leaving, the value in global is cleared and sent with the inventory to the master.
Upon joining a game the crafting queue is added to the end of the existing crafting queue.
]]
commands.add_command("save-crafts", "Save crafting queue for transport to a different server", save_crafts)
commands.add_command("csc", "Shorthand for /save-crafts", save_crafts)
commands.add_command("restore-crafts", "Load crafting queue from global", restore_crafts)
commands.add_command("crc", "Shorthand for /restore-crafts", restore_crafts)
end
return add_commands
|
local AssignmentsScript = {}
AssignmentsScript.Properties = {
}
-------------------------------------------------
-- Client
-------------------------------------------------
function AssignmentsScript:Init()
-- This is a read only, so we can initialize more than once
self.allAssignments = self:DefineAssignments()
self.teleportInSound = GetWorld():Find("teleportInSound").sound
self.teleportOutSound = GetWorld():Find("teleportOutSound").sound
self.teleportArrivalEffect = GetWorld():Find("teleportArrivalEffect").effect
end
-------------------------------------------------
-- Client
-------------------------------------------------
function AssignmentsScript:ClientInit()
--Print("AssignmentsScript:ClientInit()")
self.allAssignments = self:DefineAssignments()
-- Only update the widget if this is used on the sign, otherwise ignore
if not self:GetEntity():IsA(Character) then
local name = self:GetEntity():GetName()
--Print("-------- entity name=" .. name)
self:GetEntity().AssignmentWidget.js:CallFunction("updateScreen", self.allAssignments[name])
end
end
-------------------------------------------------
-- Functions to auto-complete the assignment
-------------------------------------------------
function AssignmentsScript:AutoCompleteAssignment(player, assignment)
local f = self.allAssignments[assignment].autoCompleteCallback
--Print("AssignmentsScript:AutoCompleteAssignment(".. assignment .. "), callback = " .. f)
player:PlaySound(self.teleportOutSound)
self:Schedule(function()
Wait(2)
self.AutoCompleteFunctions[f](player)
Wait()
Wait()
Wait()
player:PlaySound(self.teleportInSound)
player:PlayEffect(self.teleportArrivalEffect, true)
end)
end
AssignmentsScript.AutoCompleteFunctions = {
-------------------------------------------------------------
-- Move the player to where the car key is
-------------------------------------------------------------
CarKey = function(player)
local location = GetWorld():Find("Car Key"):GetPosition() + Vector.New(-500,200,0)
player:SetPosition(location)
end,
-------------------------------------------------------------
-- Move the player to the car
-------------------------------------------------------------
Car = function(player)
local location = GetWorld():Find("CarJeep"):GetPosition() + Vector.New(0,0,300)
player:SetPosition(location)
end,
-------------------------------------------------------------
-- Move the player inside of the Hut
-------------------------------------------------------------
Hut = function(player)
local location = GetWorld():Find("strawHut"):GetPosition() + Vector.New(0,0,0)
player:SetPosition(location)
end,
-------------------------------------------------------------
-- Move the player inside of the Hut
-------------------------------------------------------------
GCRdoor = function(player)
local location = GetWorld():Find("gcrDoor"):GetPosition() + Vector.New(200,0,0)
player:SetPosition(location)
end,
-------------------------------------------------------------
-- Move the player
-------------------------------------------------------------
CraneTop = function(player)
local location = GetWorld():Find("craneCabin"):GetPosition() + Vector.New(0,0,500)
player:SetPosition(location)
end,
-------------------------------------------------------------
-- Move the player
-------------------------------------------------------------
BuildMaliciosImage = function(player)
local location = GetWorld():Find("gke"):GetPosition() + Vector.New(0,0,500)
player:SetPosition(location)
end,
-------------------------------------------------------------
-- Move the player
-------------------------------------------------------------
FlyingCar = function(player)
local location = GetWorld():Find("GCS Key"):GetPosition() + Vector.New(-100,70,0)
player:SetPosition(location)
end,
-------------------------------------------------------------
-- Make Balloon Key appear
-------------------------------------------------------------
BalloonKey = function(player)
local puzzle = GetWorld():Find("puzzle")
puzzle:SendToScripts("ForceSolve", player)
end,
-------------------------------------------------------------
-- Move the player
-------------------------------------------------------------
GoMountainTop = function(player)
local location = GetWorld():Find("balloonLandingZoneLocator"):GetPosition() + Vector.New(0,0,5000)
player:SetPosition(location)
end,
}
-------------------------------------------------
-- Define all assignments
-- returns a table with all assignments
-------------------------------------------------
function AssignmentsScript:DefineAssignments()
--Print("AssignmentsScript:SetAssignments()")
local assignments = {
assignment_find_car_key = {
title ="Assignment #1",
points = 5,
nextTask = "assignment_find_car",
short = "Find the CAR KEY in the vicinity of the mountain.",
autoCompleteCallback = "CarKey",
info = [[Welcome to KubeDerby. You are on the INTERNET ISLAND./n
Your first objective is to find the CAR KEY, then find the CAR and
use [Interact] button to start it. The car will take you to your next assignment.
Press [Interact] to pickup coconuts and mushroms to score extra points./n
If you get stuck and need help, find nearest First Aid Kit (see example below).]],
},
assignment_find_car = {
title ="Find the Car and start it",
points = 5,
nextTask = "assignment_find_http_key",
short = "Find the CAR, jump into it and start the engine.",
autoCompleteCallback = "Car",
info = [[Your next objective is to find the car, hop into it and start it using [Interact] key.
The car will take you to your next assignment./n
Don't forget to press [Interact] to pickup coconuts and mushroms to score extra points.]],
},
assignment_find_http_key = {
title ="Find the HTTP Key",
points = 30,
nextTask = "assignment_find_train",
short = "Find the HTTP KEY in a place where it should not be.",
autoCompleteCallback = "Hut",
info = [[Your next objective is to find the HTTP Key to help you get into the GCP Island./n
The GCP project is surrounded by the firewall on top of the big island.
You can't pass through the firewall without using the HTTP tunnel (represented by the train).
To use the tunnel you need to have proper credentials./n
Hint: Sometimes developers store credentials in source code repositories]],
},
assignment_find_train = {
title ="Get a ride to GCP Island",
points = 5,
nextTask = "assignment_start_train",
short = "Find HTTP TRAIN, hop into it and take a ride to GCP ISLAND.",
info = [[Your next objective is to ride the HTTP train through the firewall into the GCP Island./n
On that island you will complete a series of assignments and eventually return to the top of the mountain
where you started the game, get aboard the hot air balloon and save the Internet from the asteroid.
Use your HTTP Key to operate the train.]],
},
assignment_start_train = {
title ="Start the Train engine",
points = 5,
nextTask = "assignment_find_gcr",
short = "Start the Train engine.",
info = [[Press the RED button to move the train.]],
},
assignment_find_gcr = {
title ="Get inside of Google Artifact Registry",
points = 20,
nextTask = "assignment_gcr_crane_top",
short = "Find the proper key and get inside of Google Artifact Registry.",
autoCompleteCallback = "GCRdoor",
info = [[Welcome to the GCP Project Island./n
Your next task is to penetrate the GKE cluster.
In order to do it, you need to find Google Artifact Registry and upload a
malicious container it, then trigger deployment into the cluster.
The container will run with permissions to read secret code from the Google Cloud Storage./n
One more thing, collect mushrooms for extra points.]],
},
assignment_gcr_crane_top = {
title ="Get to the control cabin of the train",
points = 15,
nextTask = "assignment_gcr_build_image",
short = "Get into the control cabin of the crane.",
autoCompleteCallback = "CraneTop",
info = [[You are inside the Google Artifact Registry. Your next assignment is to build a
malicious container and upload it into the registry./n
You can find detailed instructions and operate on the registry at the top of the
control crane (err, control plane).]]
},
assignment_gcr_build_image = {
title ="Build malicious container image",
points = 50,
short = "Build and upload malicious container image.",
nextTask = "assignment_get_inside_gke",
autoCompleteCallback = "BuildMaliciosImage",
info = [[You now need to build a Docker image with malicious code and upload it into this registry./n
Once you build and upload the image, it will show in this registry along with the CLUSTER KEY.
Use that key to enter the GKE cluster./n
EASY BUTTON: While we are still working on the backend integration with real GCP project,
for now you can simulate this by pressing the button.]],
-- [[Be sure to include a script to copy secret to the external GCS bucket:]],
-- [[gsutil cp gs://internal/secret.txt gs://external/secret.txt]],
},
assignment_get_inside_gke = {
title ="Penetrate GKE Cluster",
points = 5,
short = "Get inside of the GKE Cluster.",
nextTask = "assignment_get_gcs_key",
info = [[You need to find a way to get inside of the GKE Cluster.]],
},
assignment_get_gcs_key = {
title ="Get the GCS Key",
points = 50,
nextTask = "assignment_go_to_gcs",
short = "Get the GCS Key on top of the flying car.",
autoCompleteCallback = "FlyingCar",
info = [[You need to trigger the deployment of the malicios image into this cluster and once successful,
grab the GCS KEY and head out to GCS to get your next assignment./n
The GCS KEY can be found on top of the flying car you can see hovering in the air.
EASY BUTTON: While we are still working on the backend integration with real GCP project,
for now you can simulate this by solving the puzzle.]],
},
assignment_go_to_gcs = {
title ="Get inside of GCS",
points = 5,
nextTask = "assignment_get_balloon_key",
short = "Use your GCS Key to get inside of GCS",
info = [[Find a way to get inside of the GCS bunker.]],
},
assignment_get_balloon_key = {
title ="Find the Balloon Key",
points = 50,
nextTask = "assignment_board_balloon",
short = "Find the Balloon Key and go to the top of the mountain.",
autoCompleteCallback = "BalloonKey",
info = [[Find the BALLOON KEY in this room, then head out to the top of the mountain.
Wait for the hot air balloon to arrive and hop onboard (use [Space] to jump).
You can navigate the balloon by pressing [Interact] in the direction where you want to go
(up, down, left, right, etc.). Your job is to jump out of the ballon on top of the asteroid,
Once your feet touch the top of the asteroid, you win the game and stop the asteroid.]],
},
assignment_board_balloon = {
title ="Get into the balloon",
points = 10,
nextTask = "assignment_stop_asteroid",
short = "Go to the top of the mountain and board the Balloon.",
autoCompleteCallback = "GoMountainTop",
info = [[Go to the Internet Island and climb on top of the mountain with your GCS Key.
Wait for the balloon to show up and hop onboard.]],
},
assignment_stop_asteroid = {
title ="Stop the Asteroid",
points = 10,
nextTask = "none", -- for the last assignment there is no more tasks
short = "Use the Balloon to land on top of the Asteroid to stop it.",
info = [[Once you are inside of the balloon, use the "Interact" button to direct your balloon
to the top of the asteroid. Simply point the cursor to the right direction (left, right, top, down, etc.)
and press the Interact button.]],
},
}
-- Calculate max possible score
local totalPoints = 0
local size = 0
for _,value in pairs(assignments) do
totalPoints = totalPoints + value.points
size = size + 1
end
assignments["totalPoints"] = totalPoints
assignments["size"] = size
return assignments
end
return AssignmentsScript |
if yatm_bees then
yatm_autotest:require("tests/yatm_bees.lua")
end
if yatm_brewery then
yatm_autotest:require("tests/yatm_brewery.lua")
end
if yatm_cables then
yatm_autotest:require("tests/yatm_cables.lua")
end
if yatm_data_fluid_sensor then
yatm_autotest:require("tests/yatm_data_fluid_sensor.lua")
end
if yatm_data_network then
yatm_autotest:require("tests/yatm_data_network.lua")
end
if yatm_decor then
yatm_autotest:require("tests/yatm_decor.lua")
end
if yatm_foundry then
yatm_autotest:require("tests/yatm_foundry.lua")
end
if yatm_machines then
yatm_autotest:require("tests/yatm_machines.lua")
end
if yatm_mail then
yatm_autotest:require("tests/yatm_mail.lua")
end
if yatm_oku then
yatm_autotest:require("tests/yatm_oku.lua")
end
if yatm_papercraft then
yatm_autotest:require("tests/yatm_papercraft.lua")
end
if yatm_rails then
yatm_autotest:require("tests/yatm_rails.lua")
end
if yatm_reactors then
yatm_autotest:require("tests/yatm_reactors.lua")
end
if yatm_refinery then
yatm_autotest:require("tests/yatm_refinery.lua")
end
if yatm_solar_energy then
yatm_autotest:require("tests/yatm_solar_energy.lua")
end
if yatm_spacetime then
yatm_autotest:require("tests/yatm_spacetime.lua")
end
if yatm_woodcraft then
yatm_autotest:require("tests/yatm_woodcraft.lua")
end
|
object_tangible_wearables_cybernetic_s01_cybernetic_s01_arm_r = object_tangible_wearables_cybernetic_s01_shared_cybernetic_s01_arm_r:new {
}
ObjectTemplates:addTemplate(object_tangible_wearables_cybernetic_s01_cybernetic_s01_arm_r, "object/tangible/wearables/cybernetic/s01/cybernetic_s01_arm_r.iff")
|
betterinv = {}
betterinv = {}
betterinv.tab_position = tonumber(minetest.settings:get"betterinv.tab_position" or "4")
betterinv.tabs = {}
betterinv.tab_list = {}
betterinv.contexts = {}
betterinv.selections = {}
betterinv.default = "default"
function betterinv.register_tab(name, def)
betterinv.tabs[name] = def
table.insert(betterinv.tab_list, name)
def.name = name
end
function betterinv.generate_buttons(size, filter, selected)
local str = ""
if betterinv.tab_position == 4 then str = "tabheader[0,0;betterinv_tabs;" end
local select = false
local i = 0
for j = 1, #betterinv.tab_list do
local k = betterinv.tab_list[j]
local v = betterinv.tabs[k]
if filter(v) then
i = i + 1
if betterinv.tab_position == 0 then
str = str .. ("button[%s,0;2,1;betterinv~%s;%s]"):format((i - 1) * 2, k, v.description)
elseif betterinv.tab_position == 1 then
str = str .. ("button[0,%s;2,1;betterinv~%s;%s]"):format((i - 1) * 7 / 10, k, v.description)
elseif betterinv.tab_position == 2 then
str = str .. ("button[%s,%s;2,1;betterinv~%s;%s]"):format(i - 1, size.y - 1, k, v.description)
elseif betterinv.tab_position == 3 then
str = str .. ("button[%s,%s;2,1;betterinv~%s;%s]"):format(size.x - 2, (i - 1) * 7 / 10, k, v.description)
else
if k == selected then select = i end
if i > 1 then str = str .. "," end
str = str .. v.description
end
end
end
if betterinv.tab_position == 4 then str = str .. ";" .. select .. ";true;false]" end
return str
end
betterinv.theme_inv = [[
listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]
list[current_player;main;0,4.7;8,1;]
list[current_player;main;0,5.85;8,3;8]
]]
function betterinv.generate_formspec(player, fs, size, bg, inv)
if not size then size = {x = 8, y = 8.6} end
local p = betterinv.tab_position
if p == 2 or p == 0 then size.y = size.y + 1
elseif p == 1 or p == 3 then size.x = size.x + 2
end
local x, y = 0, 0
if p == 0 then y = 1
elseif p == 1 then x = 2
end
local fs1 = ("size[%s,%s]container[%s,%s]%s"):format(size.x, size.y, x, y, bg or "")
fs1 = fs1 .. fs
if inv then fs1 = fs1 .. betterinv.theme_inv end
fs1 = fs1 .. "container_end[]"
fs1 = fs1 .. betterinv.generate_buttons(size, function(tab)
return tab.available == nil or (tab.available and tab.available(player))
end, betterinv.selections[player:get_player_name()])
return fs1
end
function betterinv.extract_formspec(s)
local x, y = 0, 0
local p = betterinv.tab_position
if p == 0 then y = 1
elseif p == 1 then x = 2
end
s = s:split "container_end[]"[1]
s = s:split(("container[%s,%s]"):format(x, y))[2]
return s
end
minetest.register_on_joinplayer(function(player)
local pn = player:get_player_name()
betterinv.contexts[pn] = {}
for k in pairs(betterinv.tabs) do betterinv.contexts[pn][k] = {} end
betterinv.selections[pn] = betterinv.tabs[betterinv.default] and betterinv.default or "inventory"
if betterinv.default then
minetest.after(0.01, function()
player:set_inventory_formspec((betterinv.tabs[betterinv.selections[pn]]).getter(player, betterinv.contexts[pn]))
end)
end
end)
function betterinv.redraw_for_player(player, fields)
local pn = player:get_player_name()
local selection = betterinv.selections[pn]
local tab = betterinv.tabs[selection]
if tab.processor then
tab.processor(player, betterinv.contexts[pn][selection], fields or {})
end
player:set_inventory_formspec(tab.getter(player, betterinv.contexts[pn][selection]))
end
function betterinv.get_external_context(player, tab)
return betterinv.contexts[player:get_player_name()][tab]
end
function betterinv.disable_tab(tab)
betterinv.tabs[tab].available = false
end
minetest.register_on_player_receive_fields(function(player, form_name, fields)
if form_name ~= "" then
return
end
local pn = player:get_player_name()
local good = false
local selection = betterinv.selections[pn]
local tab = betterinv.tabs[selection]
if fields.betterinv_tabs then
local id = tonumber(fields.betterinv_tabs)
good = betterinv.selections[pn] ~= betterinv.tab_list[id]
if good then
local good_tabs = {}
for i = 1, #betterinv.tab_list do
local idx = betterinv.tab_list[i]
local c_tab = betterinv.tabs[idx]
if c_tab.available == nil or (c_tab.available and c_tab.available(player)) then
good_tabs[#good_tabs + 1] = idx
end
end
betterinv.selections[pn] = good_tabs[id]
player:set_inventory_formspec(betterinv.tabs[good_tabs[id]].getter(player, betterinv.contexts[pn][selection]))
end
else
for k in pairs(fields) do
local k_split = k:split"~"
if k_split[1] == "betterinv" then
good = true
player:set_inventory_formspec(betterinv.tabs[k_split[2]].getter(player, betterinv.contexts[pn][selection]))
betterinv.selections[pn] = k_split[2]
end
end
end
if not good and tab then
betterinv.redraw_for_player(player, fields)
end
end)
if not minetest.get_modpath"sfinv" then
-- todo: cleanup this
sfinv = {}
function sfinv.register_page(name, def)
def.getter = function(...)
return def.get(def, ...)
end
if def.on_player_receive_fields then
def.processor = function(...)
return def.on_player_receive_fields(def, ...)
end
end
def.description = def.title
betterinv.register_tab(name, def)
end
function sfinv.make_formspec(player, _, fs, inv, size, bg)
if not size then size = "size[8,8.6]" end
size = size:split"["[2]
size = size:split"]"[1]
size = size:split","
if not bg then bg = "" end
return betterinv.generate_formspec(player, fs, {x = tonumber(size[1]), y = tonumber(size[2])}, bg, inv)
end
function sfinv.get_or_create_context(player)
local pn = player:get_player_name()
return betterinv.contexts[pn][betterinv.selections[pn]]
end
function sfinv.set_player_inventory_formspec(player)
return betterinv.redraw_for_player(player)
end
end
if minetest.get_modpath"trinium_api" then
trinium.api.send_init_signal()
end |
--[[
More Blocks: crafting recipes
Copyright (c) 2011-2017 Hugo Locurcio and contributors.
Licensed under the zlib license. See LICENSE.md for more information.
--]]
if minetest.settings:get_bool("default.circular_saw_crafting") ~= false then -- “If nil or true then”
minetest.register_craft({
output = "default:circular_saw",
recipe = {
{ "", "default:wall_steelblock", "" },
{ "default:steelblock_brown", "default:steelblock_brown", "default:steelblock_brown"},
{ "default:steelblock_brown", "", "default:steelblock_brown"},
}
})
end
|
-- Force to include randomkit once only, relying on the global state
-- NB: it is ugly to rely on the fact that we pollute the global
-- namespace, yet I do not see a better way to avoid
-- including ourselves twice -- which would cause seed problems.
--
-- This will need deeper consideration once we will return only
-- a local table, and once we will want proper multi-thread
-- support. In particular, we will have to modify the interfacing
-- with torch.[gs]etRNGState in wrapC.lua.
--
-- But for now (November 2013), this is good enough.
if rawget(_G, "randomkit") then
return randomkit
end
randomkit = {}
function randomkit._isTensor(v)
if torch.typename(v) then
return string.sub(torch.typename(v), -6, -1) == "Tensor"
end
end
--[[! Argument checking for vectorized calls
Process the optional return storage, the sizes of the parameter functions, etc
@param K number of actual parameters for the sampler
@param defaultResultType Tensor class corresponding to the expected result type (e.g. torch.DoubleTensor, torch.IntegerTensor, etc)
@param ... List of all parameters passed to the original caller
@return T vector or 1-d tensor to store the result into, N rows (or nil, if we should return a single value)
@return p1 ... pk Tensor of parameters, all N rows
--]]
function randomkit._check1DParams(K, defaultResultType, ...)
local argCount = select("#", ...)
for index = 1,argCount do
if select(index, ...) == nil then
error("Bad randomkit call - argument " .. index .. " is nil when calling function bytes()!")
end
end
local params = { ... }
if #params ~= K and #params ~= K+1 then
error('CHKPARAMS: need ' .. K .. ' arguments and optionally, one result tensor, instead got ' .. #params .. ' arguments')
end
local result
local Nresult = nil -- Default: unknown result size
if #params == K then
local numberOnly = true
for paramIndex, param in ipairs(params) do
numberOnly = numberOnly and not randomkit._isTensor(param)
end
if numberOnly then
return nil, params
else
result = defaultResultType.new(1)
end
else
if randomkit._isTensor(params[1]) then
-- The tensor dictates the size of the result
result = params[1]
Nresult = result:nElement()
else
error("Invalid type " .. type(params[1]) .. " for result")
end
table.remove(params, 1)
end
-- Ensure that all parameters agree in size
local Nparams = 1
for paramIndex, param in ipairs(params) do
local size
if randomkit._isTensor(param) then
size = param:nElement()
elseif type(param) == 'number' or type(param) == 'cdata' then
size = 1
-- Use torch's default Tensor for parameters
params[paramIndex] = torch.Tensor{ param }
else
error("Invalid type " .. type(param) .. " for parameter " .. paramIndex .. ".")
end
if not (size == 1 or Nparams == 1 or Nparams == size) then
error("Incoherent sizes for parameters")
elseif size > 1 and Nparams == 1 then
Nparams = size
end
end
if Nresult then
-- If the result size was fixed by the caller (either via tensor or integer)
if Nparams == 1 then
-- If only size-1 parameters, Nresult dictates the output size
Nparams = Nresult
else
-- However, if the parameters dictate one size and the result another, error
assert(Nparams == Nresult, "Parameter size (" .. Nparams ..") does not match result size (" .. Nresult ..")" )
end
else
-- If the result size was not fixed by the caller, parameters dictate it
Nresult = Nparams
result:resize(Nresult)
end
for paramIndex, param in ipairs(params) do
if param:size(1) == 1 then
local sizes = param:size()
sizes[1] = Nparams
params[paramIndex] = params[paramIndex]:expand(sizes)
end
end
return result, params
end
torch.include("randomkit", "nonC.lua")
torch.include("randomkit", "wrapC.lua")
local aliases = {
random_sample = 'double',
standard_normal = 'gauss'
}
for k, v in pairs(aliases) do
rawset(randomkit, k, randomkit[v])
end
return randomkit
|
local ZxSimpleUI = LibStub("AceAddon-3.0"):GetAddon("ZxSimpleUI")
local media = LibStub("LibSharedMedia-3.0")
---@class CoreOptions47
local CoreOptions47 = {}
CoreOptions47.__index = CoreOptions47
CoreOptions47.OPTION_NAME = "CoreOptions47"
ZxSimpleUI.optionTables[CoreOptions47.OPTION_NAME] = CoreOptions47
---@param currentModule table
function CoreOptions47:__init__(currentModule)
self._currentModule = currentModule
self._orderIndex = ZxSimpleUI.DEFAULT_ORDER_INDEX
end
function CoreOptions47:new(...)
local newInstance = setmetatable({}, self)
newInstance:__init__(...)
return newInstance
end
---@param info table
---Ref: https://www.wowace.com/projects/ace3/pages/ace-config-3-0-options-tables#title-4-1
function CoreOptions47:getOption(info)
local keyLeafNode = info[#info]
return self._currentModule.db.profile[keyLeafNode]
end
---@param info table
---@param value any
---Ref: https://www.wowace.com/projects/ace3/pages/ace-config-3-0-options-tables#title-4-1
function CoreOptions47:setOption(info, value)
local keyLeafNode = info[#info]
self._currentModule.db.profile[keyLeafNode] = value
self._currentModule:refreshConfig()
end
function CoreOptions47:getShownOption(info) return self:getOption(info) end
---@param info table
---@param value boolean
---Set the shown option.
function CoreOptions47:setShownOption(info, value)
self:setOption(info, value)
if (value == true) then
self._currentModule:handleShownOption()
else
self._currentModule:handleShownHideOption()
end
end
---@param info table
function CoreOptions47:getOptionColor(info) return unpack(self:getOption(info)) end
---@param info table
function CoreOptions47:setOptionColor(info, r, g, b, a) self:setOption(info, {r, g, b, a}) end
function CoreOptions47:incrementOrderIndex()
local i = self._orderIndex
self._orderIndex = self._orderIndex + 1
return i
end
---@return table
function CoreOptions47:getCurrentModule() return self._currentModule end
|
-- SPDX-License-Identifier: MIT
-- Copyright (c) 2021 oO (https://github.com/oocytanb)
vci.assets.PlayAnimationFromName("cykhu_land_sky_anim", true)
|
--[[
- Author: yoosan, SYSUDNLP Group
- Date: 10/21/15, 2015.
- Licence MIT
--]]
local Tester = torch.class('Tester')
function Tester:__init(config)
self.task = config.task or 'SICK'
self.mem_dim = config.mem_dim or 150
self.learning_rate = config.learning_rate or 0.05
self.batch_size = config.batch_size or 25
self.num_layers = config.num_layers or 1
self.reg = config.reg or 1e-4
self.structure = config.structure or 'lstm' -- {lstm, bilstm}
self.feats_dim = config.feats_dim or 50
-- word embedding
self.emb_vecs = config.emb_vecs
self.emb_dim = config.emb_vecs:size(2)
-- optimizer config
self.optim_func = config.optim_func or optim.adagrad
self.optim_state = {
learningRate = self.learning_rate,
}
-- number of classes and criterion
if self.task == 'MSRP' or self.task == 'WQA' or self.task == 'GRADE' then
self.num_classes = 2
self.criterion = nn.BCECriterion()
elseif self.task == 'SNLI' then
self.num_classes = 3
self.criterion = nn.ClassNLLCriterion()
elseif self.task == 'SICK' then
self.num_classes = 5
self.criterion = nn.DistKLDivCriterion()
else
error('No such task! The tasks are SICK, SNLI, MSRP and WQA')
end
-- initialize model
local model_config = {
in_dim = self.emb_dim,
mem_dim = self.mem_dim,
num_layers = self.num_layers,
gate_output = false,
}
if self.structure == 'lstm' then
self.lmodel = nn.LSTM(model_config)
self.rmodel = nn.LSTM(model_config)
elseif self.structure == 'gru' then
self.lmodel = nn.GRU(model_config)
self.rmodel = nn.GRU(model_config)
elseif self.structure == 'treelstm' then
self.model = nn.ChildSumTreeLSTM(model_config)
elseif self.structure == 'treegru' then
self.model = nn.ChildSumTreeGRU(model_config)
elseif self.structure == 'atreelstm' then
self.model = nn.AttTreeLSTM(model_config)
self.latt = nn.LSTM(model_config)
self.ratt = nn.LSTM(model_config)
elseif self.structure == 'atreegru' then
self.model = nn.AttTreeGRU(model_config)
self.latt = nn.GRU(model_config)
self.ratt = nn.GRU(model_config)
else
error('invalid model type: ' .. self.structure)
end
-- output module and feats modules
self.output_module = self:new_output_module()
-- modules
local modules = nn.Parallel()
if self.structure == 'lstm' or self.structure == 'gru' then
modules:add(self.lmodel)
elseif self.structure == 'treelstm' or self.structure == 'treegru' then
modules:add(self.model)
else
modules:add(self.model):add(self.latt)
end
modules:add(self.output_module)
self.params, self.grad_params = modules:getParameters()
-- share must only be called after getParameters, since this changes the
-- location of the parameters
if self.structure == 'lstm' or self.structure == 'gru' then
share_params(self.rmodel, self.lmodel)
elseif self.structure == 'atreelstm' or self.structure == 'atreegru' then
share_params(self.ratt, self.latt)
end
end
function Tester:new_output_module()
local lrep = nn.Identity()()
local rrep = nn.Identity()()
local mul_dist = nn.CMulTable(){lrep, rrep}
local sub_dist = nn.Abs()(nn.CSubTable(){lrep, rrep})
local rep_dist_feats = nn.JoinTable(1){mul_dist, sub_dist}
local feats = nn.gModule({lrep, rrep}, {rep_dist_feats})
-- output module, feed feats to the classifier
local classifier
if self.task == 'MSRP' or self.task == 'WQA' then
classifier = nn.Sigmoid()
elseif self.task == 'SICK' or self.task == 'SNLI' then
classifier = nn.LogSoftMax()
end
local out_module = nn.Sequential()
:add(feats)
:add(nn.Linear(2 * self.mem_dim, self.feats_dim))
:add(nn.Sigmoid())
:add(nn.Linear(self.feats_dim, self.num_classes))
:add(classifier)
return out_module
end
function Tester:predict(lsent, rsent, ltree, rtree)
if self.structure == 'lstm' or self.structure == 'gru' then
self.lmodel:evaluate()
self.rmodel:evaluate()
elseif self.structure == 'treelstm' or self.structure == 'treegru' then
self.model:evaluate()
else
self.model:evaluate()
self.latt:evaluate()
self.ratt:evaluate()
end
local linputs = self.emb_vecs:index(1, lsent:long()):double()
local rinputs = self.emb_vecs:index(1, rsent:long()):double()
local inputs
local inputs, l_seqrep, r_seqrep
if self.structure == 'lstm' or self.structure == 'gru' then
inputs = {
self.lmodel:forward(linputs),
self.rmodel:forward(rinputs)
}
elseif self.structure == 'treelstm' then
inputs = {
self.model:forward(ltree, linputs)[2],
self.model:forward(rtree, rinputs)[2]
}
elseif self.structure == 'treegru' then
inputs = {
self.model:forward(ltree, linputs),
self.model:forward(rtree, rinputs)
}
elseif self.structure == 'atreelstm' then
l_seqrep = self.latt:forward(linputs)
r_seqrep = self.ratt:forward(rinputs)
inputs = {
self.model:forward(ltree, linputs, r_seqrep)[2],
self.model:forward(rtree, rinputs, l_seqrep)[2]
}
else
l_seqrep = self.latt:forward(linputs)
r_seqrep = self.ratt:forward(rinputs)
inputs = {
self.model:forward(ltree, linputs, r_seqrep),
self.model:forward(rtree, rinputs, l_seqrep)
}
end
local output = self.output_module:forward(inputs)
if self.structure == 'lstm' or self.structure == 'gru' then
self.lmodel:forget()
self.rmodel:forget()
elseif self.structure == 'treelstm' or self.structure == 'treegru' then
self.model:clean(ltree)
self.model:clean(rtree)
else
self.model:clean(ltree)
self.model:clean(rtree)
self.latt:forget()
self.ratt:forget()
end
if self.task == 'SICK' then
return torch.range(1, 5):dot(output:exp())
else
return stats.argmax(output)
end
end
function Tester:eval(dataset)
local predictions = torch.Tensor(dataset.size)
for i = 1, dataset.size do
xlua.progress(i, dataset.size)
local lsent, rsent = dataset.lsents[i], dataset.rsents[i]
if self.structure == 'lstm' or self.structure == 'gru' then
predictions[i] = self:predict(lsent, rsent)
else
local ltree, rtree = dataset.ltrees[i], dataset.rtrees[i]
predictions[i] = self:predict(lsent, rsent, ltree, rtree)
end
end
return predictions
end
function Tester:load(path)
local misc = torch.load(path)
self.config = misc.config
self.params:copy(misc.params)
end |
--function
print("function")
function sum(...)
print("unpack{...} :", unpack({...}))
local s = 0
for i, v in ipairs{...} do
s = s + v
end
return s
end
s = sum(1, 2, 3)
print("sum(...)", s)
--closure
print()
print("closure")
function counter()
local num = 0
return
function()
num = num + 1
return num
end
end
c1 = counter()
print(c1, c1(), c1(), c1())
print(counter())
print(counter())
print(counter())
print(counter()(), counter()(), counter()())
|
local function openColorMixer( data, setting )
local btnH = 20
local w, h = 267, 186 + btnH
local mixerFrame = vgui.Create( "DFrame" )
mixerFrame:SetTitle( "" )
mixerFrame:SetSize( w, h )
mixerFrame:SetPos( gui.MouseX(), gui.MouseY() - h )
mixerFrame:MakePopup()
mixerFrame:SetDraggable( false )
mixerFrame:ShowCloseButton( false )
mixerFrame:SetIsMenu( true )
local mixer -- Init here so mixerFrame can grab it
function mixerFrame:Paint( w, h )
bc.util.blur( self, 10, 20, 255 )
draw.RoundedBox( 0, 0, 0, w, h, bc.defines.theme.background )
end
function mixerFrame:Think()
if not bc.base.isOpen then
self:Remove()
end
end
function mixerFrame:OnRemove()
timer.Remove( "BC_colorHideTimer" )
end
mixer = vgui.Create( "DColorMixer", mixerFrame )
mixer:SetPos( 2, 2 )
mixer:SetSize( w - 4, h - 4 - btnH )
mixer:SetColor( table.Copy( data[setting.value] ) )
mixer:SetPalette( false )
mixer:SetAlphaBar( data.allowedAlpha )
local lastDown = false
timer.Create( "BC_colorHideTimer", 1 / 30, 0, function()
if not input.IsMouseDown( MOUSE_LEFT ) and not input.IsMouseDown( MOUSE_RIGHT ) then
lastDown = false
return
end
if lastDown then return end
lastDown = true
local mx, my = gui.MousePos()
if not Vector( mx, my ):WithinAABox( Vector( mixerFrame:LocalToScreen( 0, 0 ) ), Vector( mixerFrame:LocalToScreen( w, h ) ) ) then
mixerFrame:Remove()
end
end )
local backBtn = vgui.Create( "DButton", mixerFrame )
backBtn:SetText( "Back" )
backBtn:SetSize( 87, btnH - 2 )
backBtn:SetPos( 2, h - btnH )
function backBtn:DoClick()
mixerFrame:Remove()
end
local defaultBtn = vgui.Create( "DButton", mixerFrame )
defaultBtn:SetText( "Default" )
defaultBtn:SetSize( 87, btnH - 2 )
defaultBtn:SetPos( w / 2 - 40, h - btnH )
function defaultBtn:DoClick()
if data.defaults and data.defaults[setting.value] then
mixer:SetColor( table.Copy( data.defaults[setting.value] ) )
else
mixer:SetColor( table.Copy( setting.default ) )
end
end
local confirmBtn = vgui.Create( "DButton", mixerFrame )
confirmBtn:SetText( "Confirm" )
confirmBtn:SetSize( 81, btnH - 2 )
confirmBtn:SetPos( w - 80 - 3, h - btnH )
function confirmBtn:DoClick()
if data[setting.value] ~= mixer:GetColor() then
data[setting.value] = table.Copy( mixer:GetColor() )
if setting.onChange then setting.onChange( data ) end
bc.data.saveData()
end
mixerFrame:Remove()
end
end
function bc.sidePanel.renderSettingFuncs.color( sPanel, panel, data, y, w, h, setting )
local curCol = data[setting.value]
local width = setting.overrideWidth or bc.sidePanel.defaultWidth
local allowedAlpha = setting.allowAlpha
local button = vgui.Create( "DColorButton", panel )
button:SetDisabled( setting.disabled or false )
local bw, bh = width, 18
button:SetSize( bw, bh )
button:SetPos( w - bw, y - 2 )
button:SetFont( "BC_monospaceSmall" )
button:SetTooltip( setting.extra )
button:SetColor( data[setting.value], true )
function button:Paint( w, h )
local col = self:GetColor()
draw.RoundedBox( 2, 0, 0, w, h, bc.defines.colors.black )
draw.RoundedBox( 2, 1, 1, w - 2, h - 2, col )
draw.DrawText( self:GetText(), self:GetFont(), w / 2, h / 4, bc.defines.theme.buttonTextFocused, TEXT_ALIGN_CENTER )
return true
end
function button:DoClick()
CloseDermaMenus()
openColorMixer( data, setting )
end
function button:Think()
self:SetColor( data[setting.value], true )
local col = data[setting.value]
self:SetText( chatHelper.padString( col.r, 3, nil, true ) ..
"|" .. chatHelper.padString( col.g, 3, nil, true ) ..
"|" .. chatHelper.padString( col.b, 3, nil, true ) ..
( allowedAlpha and ( "|" .. chatHelper.padString( col.a, 3, nil, true ) ) or "" )
)
self:SetCursor( self:GetDisabled() and "no" or "hand" )
end
return bw
end
|
--char-functions.lua
require 'map-functions'
--require 'input'
local tileW, tileH, charTileset, charQuads, charQuadInfo
local charGridX, charGridY = 2, 2
local charActX, charActY = 200, 200
local charFacing = 'forward'
local charMoveSpeed = 10
local moving = false
local timer = 0
local iterator = 1
charPosMessage = 'Example'
function loadChar(path)
love.filesystem.load(path)()
end
function round(num) return math.floor(num+.5) end
function newChar(tileWidth, tileHeight, tilesetPath, charQuadInfoIn)
tileW = tileWidth
tileH = tileHeight
charQuadInfo = charQuadInfoIn
tileset = love.graphics.newImage(tilesetPath)
local tilesetW, tilesetH = tileset:getWidth(), tileset:getHeight()
charQuads = {}
for name,quadTables in pairs(charQuadInfoIn) do
charQuads[name] = {}
for steps,info in ipairs(quadTables) do
charQuads[name][steps] = love.graphics.newQuad(info[2], info[3], tileW, tileH, tilesetW, tilesetH)
end
end
end
function moveChar()
love.keyboard.setKeyRepeat(true)
function love.keypressed(key, isrepeat)
if key == 'escape' then
love.event.quit()
elseif key == 's' and atNextTile() then
if canMove(charGridX, charGridY, 'down') then
moving = true
charGridY = charGridY + 1 end
charFacing = 'forward'
elseif key == 'w' and atNextTile() then
if canMove(charGridX, charGridY, 'up') then
moving = true
charGridY = charGridY - 1 end
charFacing = 'backward'
elseif key == 'a' and atNextTile() then
if canMove(charGridX, charGridY, 'left') then
moving = true
charGridX = charGridX - 1 end
charFacing = 'left'
elseif key == 'd' and atNextTile() then
if canMove(charGridX, charGridY, 'right') then
moving = true
charGridX = charGridX + 1 end
charFacing = 'right'
end
end
function love.keyreleased(key)
if key == 's' or 'w' or 'a' or 'd' then
moving = false
iterator = 1
end
end
charPosMessage = 'x: '..charGridX..', y: '..charGridY..'\nactX: '..round(charActX)..', actY: '..round(charActY)
end
--moveChar - need 2 variables, charFaceDir facing, starting to move, gotten to the new tile. It should take 1 tile movement to go one full rotation - 0(standing) to 1(leftfoot) to 0(standing) to 2(rightfoot) and landing at the new tile at 0(standing)
--each tile move should have 4 different parts - 1,0,2,0.
local function updateCharImg(dt)
if moving then
timer = timer + dt
if timer > 0.2 then
timer = 0
iterator = iterator + 1
if iterator > 4 then
iterator = 1
end
end
end
end
function updateCharPos(timeInt)
charActY = charActY + (charGridY * tileH - charActY) * charMoveSpeed * timeInt
charActX = charActX + (charGridX * tileW - charActX) * charMoveSpeed * timeInt
updateCharImg(timeInt)
end
function drawChar() -- the locals below are only used to clean up the draw() command. They add nothing to the actual block.
local drawPosX = charActX+(charQuadInfo[charFacing][1][4])*tileW
local drawPosY = charActY+(charQuadInfo[charFacing][1][5])*tileH
local drawScaleX = charQuadInfo[charFacing][1][6]
local drawScaleY = charQuadInfo[charFacing][1][7]
love.graphics.draw(tileset, charQuads[charFacing][iterator], drawPosX, drawPosY, 0, drawScaleX, drawScaleY)
end
function atNextTile()
if round(charActX) == charGridX * tileW then
if round(charActY) == charGridY * tileH then
return true
end
end
end
|
local utils = require "kong.tools.utils"
local Object = require "classic"
local Migrations = Object:extend()
-- Instanciate a migrations runner.
-- @param `core_migrations` (Optional) If specified, will use those migrations for core instead of the real ones (for testing).
-- @param `plugins_namespace` (Optional) If specified, will look for plugins there instead of `kong.plugins` (for testing).
function Migrations:new(dao, core_migrations, plugins_namespace)
dao:load_daos(require("kong.dao.cassandra.migrations"))
if core_migrations then
self.core_migrations = core_migrations
else
self.core_migrations = require("kong.dao."..dao.type..".schema.migrations")
end
self.dao = dao
self.options = {keyspace = dao._properties.keyspace}
self.plugins_namespace = plugins_namespace and plugins_namespace or "kong.plugins"
end
function Migrations:get_migrations(identifier)
return self.dao.migrations:get_migrations(identifier)
end
function Migrations:migrate(identifier, callback)
if identifier == "core" then
return self:run_migrations(self.core_migrations, identifier, callback)
else
local has_migration, plugin_migrations = utils.load_module_if_exists(self.plugins_namespace.."."..identifier..".migrations."..self.dao.type)
if has_migration then
return self:run_migrations(plugin_migrations, identifier, callback)
end
end
end
function Migrations:rollback(identifier)
if identifier == "core" then
return self:run_rollback(self.core_migrations, identifier)
else
local has_migration, plugin_migrations = utils.load_module_if_exists(self.plugins_namespace.."."..identifier..".migrations."..self.dao.type)
if has_migration then
return self:run_rollback(plugin_migrations, identifier)
end
end
end
function Migrations:migrate_all(config, callback)
local err = self:migrate("core", callback)
if err then
return err
end
for _, plugin_name in ipairs(config.plugins_available) do
local err = self:migrate(plugin_name, callback)
if err then
return err
end
end
end
--
-- PRIVATE
--
function Migrations:run_migrations(migrations, identifier, callback)
-- Retrieve already executed migrations
local old_migrations, err = self.dao.migrations:get_migrations(identifier)
if err then
return err
end
-- Determine which migrations have already been run
-- and which ones need to be run.
local diff_migrations = {}
if old_migrations then
-- Only execute from the latest executed migrations
for i, migration in ipairs(migrations) do
if old_migrations[i] == nil then
table.insert(diff_migrations, migration)
elseif old_migrations[i] ~= migration.name then
return "Inconsitency"
end
end
-- If no diff, there is no new migration to run
if #diff_migrations == 0 then
return
end
else
-- No previous migrations, just execute all migrations
diff_migrations = migrations
end
local err
-- Execute all new migrations, in order
for _, migration in ipairs(diff_migrations) do
-- Generate UP query from string + options parameter
local up_query = migration.up(self.options)
err = self.dao:execute_queries(up_query, migration.init)
if err then
err = "Error executing migration for "..identifier..": "..err
break
end
-- Record migration in db
err = select(2, self.dao.migrations:add_migration(migration.name, identifier))
if err then
err = "Cannot record migration "..migration.name.." ("..identifier.."): "..err
break
end
-- Migration succeeded
if callback then
callback(identifier, migration)
end
end
return err
end
function Migrations:run_rollback(migrations, identifier)
-- Retrieve already executed migrations
local old_migrations, err = self.dao.migrations:get_migrations(identifier)
if err then
return nil, err
end
local migration_to_rollback
if old_migrations and #old_migrations > 0 then
-- We have some migrations to rollback
local newest_migration_name = old_migrations[#old_migrations]
for i = #migrations, 1, -1 do
if migrations[i].name == newest_migration_name then
migration_to_rollback = migrations[i]
break
end
end
if not migration_to_rollback then
return nil, "Could not find migration \""..newest_migration_name.."\" to rollback it."
end
else
-- No more migration to rollback
return
end
-- Generate DOWN query from string + options
local down_query = migration_to_rollback.down(self.options)
local err = self.dao:execute_queries(down_query)
if err then
return nil, err
end
-- delete migration from schema changes records if it's not the first one
-- (otherwise the schema_migrations table doesn't exist anymore)
if not migration_to_rollback.init then
local _, err = self.dao.migrations:delete_migration(migration_to_rollback.name, identifier)
if err then
return nil, "Cannot delete migration "..migration_to_rollback.name..": "..err
end
end
return migration_to_rollback
end
return Migrations
|
Student = { name = "Student" }
Student.__index = Student
setmetatable(Student, Person)
function Student.new(id)
local student = setmetatable(Person.new(), Student)
student.id = id
return student
end
function Student:__tostring()
return string.format("{age: %d, id: %d}",self.age, self.id)
end |
local input = Concord.system({_components.control})
-- TODO: we probably just want to flat out react to keys for obstacles, no need for binds I think
-- (actually maybe the individual obstacles have a control component..)
function input:init()
self.timer = Timer.new()
self.polling_rate = 0.01
self.timer:every(
self.polling_rate,
function()
self:poll_keys()
end
)
end
function input:poll_keys()
for i = 1, self.pool.size do
local control = self.pool:get(i):get(_components.control)
for action, is_held in pairs(control.is_held) do
if is_held then
self:getWorld():emit("action_held", action, self.pool:get(i))
end
end
end
end
function input:keypressed(key)
for i = 1, self.pool.size do
local control = self.pool:get(i):get(_components.control)
local binds = control.binds
if binds[key] and not control.is_held[key] then
control.is_held[binds[key]] = true
self:getWorld():emit("action_pressed", string.lower(binds[key]), self.pool:get(i))
end
end
end
function input:mousepressed(_, _, button)
-- We dont care about x, y we just want to track the event (just poll the mouse position if needed)
self:keypressed("mouse" .. button)
end
function input:mousereleased(_, _, button)
-- We dont care about x, y we just want to track the event (just poll the mouse position if needed)
self:keyreleased("mouse" .. button)
end
function input:keyreleased(key)
for i = 1, self.pool.size do
local control = self.pool:get(i):get(_components.control)
local binds = control.binds
if binds[key] and control.is_held[binds[key]] then
control.is_held[binds[key]] = false
self:getWorld():emit("action_released", string.lower(binds[key]), self.pool:get(i))
end
end
end
function input:update(dt)
self.timer:update(dt)
end
return input
|
local BaseTest = require 'lualib.basetest'
local oo = require 'lualib.oo'
local empty = require 'lualib.struct.sslattice'
local SSLatticeTest = oo.class(BaseTest)
function SSLatticeTest:test_basic()
local st = empty:add'ball$':add'basic$':add'bea$'
self:assert_equal(tostring(st), ([[
1, b-2
2, a-3, ea-4
3, ll-4, sic-4
4, $-5
5
]]):gsub(' ', ''):gsub('^%s*(.-)%s*$', '%1'))
end
function SSLatticeTest:test_cache()
collectgarbage()
self:assert_equal(empty.cache_stats().trees, 1)
local e = empty:add 'bb':add 'b'
assert(empty.cache_stats().trees >= 3)
collectgarbage()
-- {}, {b={}}, {b={b={}}}
self:assert_equal(empty.cache_stats().trees, 3)
end
SSLatticeTest:run_if_main()
return SSLatticeTest
|
local splashScreen=
{
name="splashScreen",type=0,typeName="View",time=0,report=0,x=0,y=0,width=0,height=0,visible=1,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignTopLeft,
{
name="bg",type=1,typeName="Image",time=58674639,report=0,x=0,y=0,width=1280,height=800,visible=1,fillParentWidth=1,fillParentHeight=1,nodeAlign=kAlignCenter,file="hall/common/bg_blank.png"
}
}
return splashScreen; |
local cfg = {}
cfg.inventory_weight_per_strength = 10
return cfg
|
--[[
// FileName: PlayerlistModule.lua
// Version 1.0
// Written by: jmargh
// Description: Implements social features that need to be ran on the server
// TODO
We need to get module script working on the server. When we get that working
This should be moved to a module, and http helper functions should be moved
to a utility module.
]]
local HttpService = game:GetService('HttpService')
local HttpRbxApiService = game:GetService('HttpRbxApiService')
local Players = game:GetService('Players')
local RobloxReplicatedStorage = game:GetService('RobloxReplicatedStorage')
local RunService = game:GetService('RunService')
local GET_MULTI_FOLLOW = "user/multi-following-exists"
-- Maximum amount of follow notifications that a player is allowed to send to another player.
local MAX_FOLLOW_NOTIFICATIONS_BETWEEN = 5
local PlayerToRelationshipMap = {}
--[[ Remotes ]]--
local RemoteEvent_FollowRelationshipChanged = Instance.new('RemoteEvent')
RemoteEvent_FollowRelationshipChanged.Name = "FollowRelationshipChanged"
RemoteEvent_FollowRelationshipChanged.Parent = RobloxReplicatedStorage
local RemoteEvent_NewFollower = Instance.new("RemoteEvent")
RemoteEvent_NewFollower.Name = "NewFollower"
RemoteEvent_NewFollower.Parent = RobloxReplicatedStorage
local RemoteFunc_GetFollowRelationships = Instance.new('RemoteFunction')
RemoteFunc_GetFollowRelationships.Name = "GetFollowRelationships"
RemoteFunc_GetFollowRelationships.Parent = RobloxReplicatedStorage
local RemoteEvent_SetPlayerBlockList = Instance.new('RemoteEvent')
RemoteEvent_SetPlayerBlockList.Name = 'SetPlayerBlockList'
RemoteEvent_SetPlayerBlockList.Parent = RobloxReplicatedStorage
local RemoteEvent_UpdatePlayerBlockList = Instance.new('RemoteEvent')
RemoteEvent_UpdatePlayerBlockList.Name = 'UpdatePlayerBlockList'
RemoteEvent_UpdatePlayerBlockList.Parent = RobloxReplicatedStorage
--[[ Helper Functions ]]--
local function decodeJSON(json)
local success, result = pcall(function()
return HttpService:JSONDecode(json)
end)
if not success then
print("decodeJSON() failed because", result, "Input:", json)
return nil
end
return result
end
local function rbxApiPostAsync(path, params, throttlePriority, contentType, httpType)
local success, result = pcall(function()
return HttpRbxApiService:PostAsync(path, params, throttlePriority, contentType, httpType)
end)
--
if not success then
local label = string.format("%s: - path: %s, \njson: %s", tostring(result), tostring(path), tostring(params))
return nil
end
return decodeJSON(result)
end
--[[
// Return - table
Key: FollowingDetails
Value: Arrary of details
Key: UserId1
Value: number - userId of new client
Key: UserId2
Value: number - userId of other client
Key: User1FollowsUser2
Value: boolean
Key: User2FollowsUser1
Value: boolean
]]
local function getFollowRelationshipsAsync(uid)
if RunService:IsStudio() then
return
end
local otherUserIdTable = {}
for _,player in pairs(Players:GetPlayers()) do
if player.UserId > 0 then
table.insert(otherUserIdTable, player.UserId)
end
end
if #otherUserIdTable > 0 and uid and uid > 0 then
local jsonPostBody = {
userId = uid;
otherUserIds = otherUserIdTable;
}
jsonPostBody = HttpService:JSONEncode(jsonPostBody)
if jsonPostBody then
return rbxApiPostAsync(GET_MULTI_FOLLOW, jsonPostBody,
Enum.ThrottlingPriority.Default, Enum.HttpContentType.ApplicationJson,
Enum.HttpRequestType.Players)
end
end
end
local function createRelationshipObject(user1FollowsUser2, user2FollowsUser1)
local object = {}
object.IsFollower = user2FollowsUser1
object.IsFollowing = user1FollowsUser2
object.IsMutual = user1FollowsUser2 and user2FollowsUser1
return object
end
local function updateAndNotifyClients(resultTable, newUserIdStr, newPlayer)
local followingDetails = resultTable["FollowingDetails"]
if followingDetails then
local relationshipTable = PlayerToRelationshipMap[newUserIdStr] or {}
for i = 1, #followingDetails do
local detail = followingDetails[i]
local otherUserId = detail["UserId2"]
local otherUserIdStr = tostring(otherUserId)
local followsOther = detail["User1FollowsUser2"]
local followsNewPlayer = detail["User2FollowsUser1"]
relationshipTable[otherUserIdStr] = createRelationshipObject(followsOther, followsNewPlayer)
-- update other use
local otherRelationshipTable = PlayerToRelationshipMap[otherUserIdStr]
if otherRelationshipTable then
local newRelationship = createRelationshipObject(followsNewPlayer, followsOther)
otherRelationshipTable[newUserIdStr] = newRelationship
local otherPlayer = Players:GetPlayerByUserId(otherUserId)
if otherPlayer then
-- create single entry table (keep format same) and send to other client
local deltaTable = {}
deltaTable[newUserIdStr] = newRelationship
RemoteEvent_FollowRelationshipChanged:FireClient(otherPlayer, deltaTable)
end
end
end
PlayerToRelationshipMap[newUserIdStr] = relationshipTable
RemoteEvent_FollowRelationshipChanged:FireClient(newPlayer, relationshipTable)
end
end
--[[ Connections ]]--
function RemoteFunc_GetFollowRelationships.OnServerInvoke(player)
local uid = player.UserId
local uidStr = tostring(player.UserId)
if uid and uid > 0 and PlayerToRelationshipMap[uidStr] then
return PlayerToRelationshipMap[uidStr]
else
return {}
end
end
-- Map: { UserId -> { UserId -> NumberOfNotificationsSent } }
local FollowNotificationsBetweenMap = {}
local function isPlayer(value)
return typeof(value) == "Instance" and value:IsA("Player")
end
-- client fires event to server on new follow
RemoteEvent_NewFollower.OnServerEvent:connect(function(player1, player2, player1FollowsPlayer2)
if not isPlayer(player1) or not isPlayer(player2) or type(player1FollowsPlayer2) ~= "boolean" then
return
end
local userId1 = tostring(player1.UserId)
local userId2 = tostring(player2.UserId)
local user1map = PlayerToRelationshipMap[userId1]
local user2map = PlayerToRelationshipMap[userId2]
local sentNotificationsMap = FollowNotificationsBetweenMap[userId1]
if sentNotificationsMap then
if sentNotificationsMap[userId2] then
sentNotificationsMap[userId2] = sentNotificationsMap[userId2] + 1
if sentNotificationsMap[userId2] > MAX_FOLLOW_NOTIFICATIONS_BETWEEN then
-- This player is likely trying to spam the other player with notifications.
-- We won't send any more.
return
end
else
sentNotificationsMap[userId2] = 1
end
end
if user1map then
local relationTable = user1map[userId2]
if relationTable then
relationTable.IsFollowing = player1FollowsPlayer2
relationTable.IsMutual = relationTable.IsFollowing and relationTable.IsFollower
local delta = {}
delta[userId2] = relationTable
RemoteEvent_FollowRelationshipChanged:FireClient(player1, delta)
-- this should be updated, but current NotificationScript listens to this
if player1FollowsPlayer2 then
RemoteEvent_NewFollower:FireClient(player2, player1)
end
end
end
if user2map then
local relationTable = user2map[userId1]
if relationTable then
relationTable.IsFollower = player1FollowsPlayer2
relationTable.IsMutual = relationTable.IsFollowing and relationTable.IsFollower
local delta = {}
delta[userId1] = relationTable
RemoteEvent_FollowRelationshipChanged:FireClient(player2, delta)
end
end
end)
local function onPlayerAdded(newPlayer)
local uid = newPlayer.UserId
if uid > 0 then
local uidStr = tostring(uid)
FollowNotificationsBetweenMap[uidStr] = {}
local result = getFollowRelationshipsAsync(uid)
if result then
updateAndNotifyClients(result, uidStr, newPlayer)
end
end
end
if settings():GetFFlag('HandlePlayerBlockListsInternalPermissive') == true then
RemoteEvent_SetPlayerBlockList.OnServerEvent:Connect(function(player, blockList)
player:AddToBlockList(blockList)
end)
RemoteEvent_UpdatePlayerBlockList.OnServerEvent:Connect(function(player, userId, block)
player:UpdatePlayerBlocked(userId, block)
end)
end
Players.PlayerAdded:connect(onPlayerAdded)
for _,player in pairs(Players:GetPlayers()) do
onPlayerAdded(player)
end
Players.PlayerRemoving:connect(function(prevPlayer)
local uid = tostring(prevPlayer.UserId)
if PlayerToRelationshipMap[uid] then
PlayerToRelationshipMap[uid] = nil
FollowNotificationsBetweenMap[uid] = nil
end
end)
|
local dungeonIndex = 21
MethodDungeonTools.dungeonTotalCount[dungeonIndex] = {normal=416,teeming=499,teemingEnabled=true}
MethodDungeonTools.scaleMultiplier[dungeonIndex] = 0.7
MethodDungeonTools.mapPOIs[dungeonIndex] = {
[1] = {
[1] = {
["y"] = -480.35147832794;
["x"] = 434.8042835021;
["template"] = "DeathReleasePinTemplate";
["graveyardDescription"] = "";
["type"] = "graveyard";
};
[2] = {
["y"] = -165.41051814016;
["x"] = 230.88050878771;
["template"] = "MapLinkPinTemplate";
["type"] = "mlFrackingTotem";
};
[3] = {
["y"] = -159.0643543431;
["x"] = 229.53433707512;
["template"] = "MapLinkPinTemplate";
["type"] = "mlFrackingTotem";
};
[4] = {
["y"] = -116.94137664378;
["x"] = 286.53431587181;
["template"] = "MapLinkPinTemplate";
["type"] = "mlMineCart";
};
[5] = {
["y"] = -262.08125072401;
["x"] = 367.76549732401;
["template"] = "DeathReleasePinTemplate";
["graveyardDescription"] = "Unlocks after killing Coin-Operated Crowd Pummeler";
["type"] = "graveyard";
};
[6] = {
["y"] = -121.09600689235;
["x"] = 275.70035521298;
["template"] = "DeathReleasePinTemplate";
["graveyardDescription"] = "Unlocks after reaching the end of the Mine Cart Ride";
["type"] = "graveyard";
};
[7] = {
["y"] = -112.60568055995;
["x"] = 479.54906443908;
["template"] = "DeathReleasePinTemplate";
["graveyardDescription"] = "Unlocks after killing Rixxa Fluxflame";
["type"] = "graveyard";
};
};
};
MethodDungeonTools.dungeonEnemies[dungeonIndex] = {
[27] = {
["clones"] = {
[1] = {
["y"] = -108.03046315425;
["x"] = 356.65256956271;
["g"] = 61;
["sublevel"] = 1;
};
[2] = {
["y"] = -92.698542186826;
["x"] = 365.67812842666;
["g"] = 63;
["sublevel"] = 1;
};
[4] = {
["y"] = -105.19209900133;
["x"] = 405.95380706931;
["g"] = 65;
["sublevel"] = 1;
};
[8] = {
["y"] = -135.36437031115;
["x"] = 402.42238808984;
["g"] = 67;
["sublevel"] = 1;
};
[16] = {
["sublevel"] = 1;
["x"] = 350.33091903928;
["infested"] = {
[2] = true;
};
["g"] = 74;
["y"] = -152.36386133844;
};
[17] = {
["y"] = -123.22261528122;
["x"] = 373.34321129826;
["g"] = 75;
["sublevel"] = 1;
};
[9] = {
["y"] = -143.8855500859;
["x"] = 400.09572524552;
["g"] = 68;
["sublevel"] = 1;
};
[18] = {
["y"] = -141.97633420248;
["x"] = 365.27023237456;
["g"] = 77;
["sublevel"] = 1;
};
[5] = {
["y"] = -127.90752708398;
["x"] = 425.7219165469;
["g"] = 66;
["sublevel"] = 1;
};
[10] = {
["sublevel"] = 1;
["x"] = 390.98602676877;
["infested"] = {
[3] = true;
};
["g"] = 71;
["y"] = -171.12315932201;
};
[20] = {
["y"] = -122.80716290171;
["x"] = 362.11289539306;
["teeming"] = true;
["g"] = 75;
["sublevel"] = 1;
};
[11] = {
["y"] = -159.81880987673;
["x"] = 385.1164764989;
["g"] = 71;
["sublevel"] = 1;
};
[3] = {
["sublevel"] = 1;
["x"] = 382.62750126087;
["patrol"] = {
[1] = {
["y"] = -95.78667193589;
["x"] = 382.62750126087;
};
[2] = {
["y"] = -94.416826242829;
["x"] = 369.47680859463;
};
[3] = {
["y"] = -95.78667193589;
["x"] = 382.62750126087;
};
};
["infested"] = {
[2] = true;
};
["y"] = -95.78667193589;
};
[6] = {
["y"] = -130.66933052743;
["x"] = 407.86632302462;
["g"] = 67;
["sublevel"] = 1;
};
[12] = {
["y"] = -164.63852884306;
["x"] = 371.59605979418;
["g"] = 72;
["sublevel"] = 1;
};
[13] = {
["y"] = -170.26352242043;
["x"] = 371.59605979418;
["g"] = 72;
["sublevel"] = 1;
};
[7] = {
["y"] = -132.6143762488;
["x"] = 405.67241033308;
["g"] = 67;
["sublevel"] = 1;
};
[14] = {
["y"] = -155.20682004787;
["x"] = 372.07401292909;
["g"] = 73;
["sublevel"] = 1;
};
[15] = {
["y"] = -151.01280214673;
["x"] = 374.92301263338;
["g"] = 73;
["sublevel"] = 1;
};
[19] = {
["y"] = -110.88177015262;
["x"] = 398.54000480425;
["teeming"] = true;
["g"] = 65;
["sublevel"] = 1;
};
};
["scale"] = 1;
["spells"] = {
[277242] = {};
[277564] = {};
[268797] = {};
[262268] = {};
[262270] = {};
[209859] = {};
};
["id"] = 133432;
["health"] = 294320;
["count"] = 5;
["displayId"] = 82915;
["creatureType"] = "Humanoid";
["level"] = 120;
["name"] = "Venture Co. Alchemist";
["characteristics"] = {
["Taunt"] = true;
["Root"] = true;
["Disorient"] = true;
["Sap"] = true;
["Imprison"] = true;
["Silence"] = true;
["Slow"] = true;
["Stun"] = true;
["Fear"] = true;
};
};
[2] = {
["clones"] = {
[2] = {
["y"] = -496.78592021978;
["x"] = 450.94195363675;
["sublevel"] = 1;
};
[3] = {
["y"] = -486.60016709926;
["x"] = 412.39914455893;
["sublevel"] = 1;
};
[1] = {
["y"] = -508.91315031584;
["x"] = 425.07649815113;
["sublevel"] = 1;
};
[4] = {
["y"] = -495.96787666363;
["x"] = 400.36439703866;
["sublevel"] = 1;
};
[5] = {
["y"] = -508.92875746902;
["x"] = 387.11641745026;
["sublevel"] = 1;
};
};
["scale"] = 0.7;
["health"] = 58864;
["count"] = 0;
["displayId"] = 32023;
["creatureType"] = "Beast";
["level"] = 120;
["id"] = 137716;
["name"] = "Bottom Feeder";
};
[38] = {
["clones"] = {
[1] = {
["y"] = -319.75791518289;
["x"] = 495.93072211015;
["g"] = 23;
["sublevel"] = 1;
};
};
["scale"] = 1;
["name"] = "Off-Duty Laborer";
["health"] = 117734;
["displayId"] = 81229;
["creatureType"] = "Humanoid";
["level"] = 120;
["id"] = 135975;
["count"] = 0;
};
[3] = {
["clones"] = {
[13] = {
["y"] = -473.78387314372;
["x"] = 460.2539811199;
["sublevel"] = 1;
};
[7] = {
["y"] = -449.17486333683;
["x"] = 405.01147033623;
["sublevel"] = 1;
};
[1] = {
["y"] = -548.02341232211;
["x"] = 413.56816392568;
["sublevel"] = 1;
["upstairs"] = true;
};
[2] = {
["y"] = -550.58154619885;
["x"] = 424.265841902;
["sublevel"] = 1;
["upstairs"] = true;
};
[4] = {
["y"] = -526.42877694896;
["x"] = 430.77283457852;
["sublevel"] = 1;
["upstairs"] = true;
};
[8] = {
["y"] = -447.74631870413;
["x"] = 425.01146303998;
["sublevel"] = 1;
};
[9] = {
["y"] = -464.26906410961;
["x"] = 485.6324518163;
["sublevel"] = 1;
};
[5] = {
["y"] = -507.87807746141;
["x"] = 434.71401869778;
["sublevel"] = 1;
["upstairs"] = true;
};
[10] = {
["y"] = -456.37415670018;
["x"] = 473.55560139048;
["sublevel"] = 1;
};
[3] = {
["y"] = -523.21446339563;
["x"] = 418.27288128767;
["sublevel"] = 1;
["upstairs"] = true;
};
[11] = {
["y"] = -456.47780215629;
["x"] = 465.73199190146;
["sublevel"] = 1;
};
[6] = {
["y"] = -459.78643311087;
["x"] = 395.76294614373;
["sublevel"] = 1;
};
[12] = {
["y"] = -455.31502582542;
["x"] = 456.19712019695;
["sublevel"] = 1;
};
[14] = {
["y"] = -481.28385124899;
["x"] = 460.2539811199;
["sublevel"] = 1;
};
};
["id"] = 138061;
["spells"] = {
[277564] = {};
};
["neutral"] = true;
["count"] = 0;
["health"] = 117728;
["name"] = "Venture Co. Longshoreman";
["displayId"] = 81226;
["creatureType"] = "Humanoid";
["level"] = 120;
["scale"] = 0.7;
["characteristics"] = {
["Taunt"] = true;
["Slow"] = true;
["Root"] = true;
["Stun"] = true;
};
};
[4] = {
["clones"] = {
[7] = {
["y"] = -490.68478568164;
["x"] = 498.07319865943;
["sublevel"] = 1;
};
[1] = {
["y"] = -502.8636334281;
["x"] = 381.53036956989;
["sublevel"] = 1;
};
[2] = {
["y"] = -497.86360409746;
["x"] = 385.35392512337;
["sublevel"] = 1;
};
[4] = {
["y"] = -485.16753800061;
["x"] = 507.21111723987;
["sublevel"] = 1;
};
[8] = {
["y"] = -498.29889889274;
["x"] = 506.69713557341;
["sublevel"] = 1;
};
[9] = {
["y"] = -497.86412913943;
["x"] = 511.9145218839;
["sublevel"] = 1;
};
[5] = {
["y"] = -487.75373467127;
["x"] = 505.65938739876;
["sublevel"] = 1;
};
[3] = {
["y"] = -484.36417596637;
["x"] = 502.83538303213;
["sublevel"] = 1;
};
[6] = {
["y"] = -489.99512139741;
["x"] = 501.86629302909;
["sublevel"] = 1;
};
};
["id"] = 138064;
["neutral"] = true;
["name"] = "Posh Vacationer";
["health"] = 58864;
["displayId"] = 85704;
["creatureType"] = "Humanoid";
["level"] = 120;
["count"] = 0;
["scale"] = 0.7;
};
[5] = {
["clones"] = {
[1] = {
["sublevel"] = 1;
["x"] = 451.61380755587;
["y"] = -436.67387590674;
["g"] = 1;
["infested"] = {
[1] = true;
};
};
[2] = {
["y"] = -438.30898347697;
["x"] = 454.49087379066;
["g"] = 1;
["sublevel"] = 1;
};
[4] = {
["y"] = -432.44467135427;
["x"] = 474.63900406335;
["g"] = 2;
["sublevel"] = 1;
};
[8] = {
["y"] = -402.24812602559;
["x"] = 468.18162026779;
["g"] = 5;
["sublevel"] = 1;
};
[16] = {
["y"] = -292.30480466739;
["x"] = 463.84961221425;
["g"] = 27;
["sublevel"] = 1;
};
[17] = {
["y"] = -289.48127360145;
["x"] = 455.26139566038;
["g"] = 27;
["sublevel"] = 1;
};
[9] = {
["y"] = -406.55239753356;
["x"] = 470.41308515187;
["g"] = 5;
["sublevel"] = 1;
};
[18] = {
["y"] = -311.27839494951;
["x"] = 408.93014594969;
["g"] = 31;
["sublevel"] = 1;
};
[5] = {
["y"] = -417.84985556942;
["x"] = 462.69072596847;
["g"] = 3;
["sublevel"] = 1;
};
[10] = {
["y"] = -358.71874866673;
["x"] = 458.17260833013;
["g"] = 19;
["sublevel"] = 1;
};
[20] = {
["y"] = -326.75066665947;
["x"] = 432.56067973406;
["g"] = 32;
["sublevel"] = 1;
};
[30] = {
["y"] = -416.02358442115;
["x"] = 438.77025155148;
["teeming"] = true;
["g"] = 4;
["sublevel"] = 1;
};
[21] = {
["y"] = -330.92788757017;
["x"] = 430.02902279571;
["g"] = 32;
["sublevel"] = 1;
};
[11] = {
["y"] = -359.43396729303;
["x"] = 450.59536600093;
["g"] = 19;
["sublevel"] = 1;
};
[22] = {
["y"] = -361.44398874944;
["x"] = 430.84077766723;
["g"] = 38;
["sublevel"] = 1;
};
[3] = {
["y"] = -441.8096093002;
["x"] = 455.94028619147;
["g"] = 1;
["sublevel"] = 1;
};
[6] = {
["y"] = -423.81972078269;
["x"] = 465.76031111468;
["g"] = 3;
["sublevel"] = 1;
};
[12] = {
["y"] = -354.86875427136;
["x"] = 448.42147991669;
["g"] = 19;
["sublevel"] = 1;
};
[24] = {
["y"] = -369.50690453121;
["x"] = 434.66379096478;
["g"] = 38;
["sublevel"] = 1;
};
[19] = {
["y"] = -316.33727749772;
["x"] = 408.08177890697;
["g"] = 31;
["sublevel"] = 1;
};
[25] = {
["sublevel"] = 1;
["x"] = 436.1251307314;
["y"] = -342.89427712404;
["g"] = 39;
["infested"] = {};
};
[13] = {
["y"] = -338.92283836523;
["x"] = 461.23382100857;
["g"] = 20;
["sublevel"] = 1;
};
[26] = {
["y"] = -347.6085695264;
["x"] = 442.83941872568;
["g"] = 39;
["sublevel"] = 1;
};
[7] = {
["y"] = -416.59957778435;
["x"] = 435.35094745914;
["g"] = 4;
["sublevel"] = 1;
};
[27] = {
["y"] = -351.60856071024;
["x"] = 440.41085221187;
["g"] = 39;
["sublevel"] = 1;
};
[14] = {
["y"] = -342.39221974072;
["x"] = 457.56035528456;
["g"] = 20;
["sublevel"] = 1;
};
[28] = {
["y"] = -351.46571395421;
["x"] = 435.98228397537;
["g"] = 39;
["sublevel"] = 1;
};
[23] = {
["y"] = -364.59780324269;
["x"] = 435.93651948351;
["g"] = 38;
["sublevel"] = 1;
};
[29] = {
["y"] = -344.79427963513;
["x"] = 440.58932329189;
["g"] = 39;
["sublevel"] = 1;
};
[15] = {
["y"] = -346.88202285883;
["x"] = 458.7848088263;
["g"] = 20;
["sublevel"] = 1;
};
};
["scale"] = 0.8;
["spells"] = {
[277564] = {};
[209859] = {};
[258674] = {};
[277242] = {};
};
["id"] = 130436;
["health"] = 117728;
["count"] = 1;
["displayId"] = 81226;
["creatureType"] = "Humanoid";
["level"] = 120;
["name"] = "Off-Duty Laborer";
["characteristics"] = {
["Taunt"] = true;
["Incapacitate"] = true;
["Root"] = true;
["Disorient"] = true;
["Sap"] = true;
["Silence"] = true;
["Slow"] = true;
["Stun"] = true;
["Fear"] = true;
};
};
[6] = {
["clones"] = {
[1] = {
["y"] = -436.91803449697;
["x"] = 474.00473084633;
["g"] = 2;
["sublevel"] = 1;
};
[2] = {
["y"] = -429.19465983986;
["x"] = 472.13903482028;
["g"] = 2;
["sublevel"] = 1;
};
[4] = {
["y"] = -419.88315178515;
["x"] = 431.61958075867;
["g"] = 4;
["sublevel"] = 1;
};
[8] = {
["y"] = -333.53532477086;
["x"] = 504.04957323132;
["g"] = 22;
["sublevel"] = 1;
};
[16] = {
["sublevel"] = 1;
["x"] = 410.62456974962;
["infested"] = {
[2] = true;
};
["g"] = 35;
["y"] = -360.00323316245;
};
[17] = {
["y"] = -422.88741103625;
["x"] = 460.38574262572;
["teeming"] = true;
["g"] = 3;
["sublevel"] = 1;
};
[9] = {
["y"] = -292.65774037067;
["x"] = 459.14372878729;
["g"] = 27;
["sublevel"] = 1;
};
[5] = {
["sublevel"] = 1;
["x"] = 466.49850971944;
["infested"] = {
[2] = true;
};
["g"] = 5;
["y"] = -406.60252209784;
};
[10] = {
["sublevel"] = 1;
["x"] = 451.09070467911;
["infested"] = {
[2] = true;
};
["g"] = 28;
["y"] = -298.63355783428;
};
[11] = {
["sublevel"] = 1;
["x"] = 429.97962561865;
["infested"] = {
[2] = true;
};
["g"] = 29;
["y"] = -311.44598068282;
};
[3] = {
["sublevel"] = 1;
["x"] = 439.3794102781;
["negativeTeeming"] = true;
["g"] = 4;
["y"] = -414.53336685115;
};
[6] = {
["y"] = -395.21057359874;
["x"] = 461.22700421103;
["g"] = 6;
["sublevel"] = 1;
};
[12] = {
["y"] = -286.01466856316;
["x"] = 416.12633606115;
["g"] = 30;
["sublevel"] = 1;
};
[13] = {
["y"] = -312.84090210614;
["x"] = 414.24264882457;
["g"] = 31;
["sublevel"] = 1;
};
[7] = {
["y"] = -373.06237900427;
["x"] = 467.27869006316;
["g"] = 40;
["sublevel"] = 1;
};
[14] = {
["y"] = -324.34560451914;
["x"] = 428.38346425568;
["g"] = 32;
["sublevel"] = 1;
};
[15] = {
["y"] = -330.92605057055;
["x"] = 393.86934268811;
["g"] = 33;
["sublevel"] = 1;
};
};
["scale"] = 1;
["spells"] = {
[280605] = {};
[280604] = {};
[277564] = {};
[268130] = {};
[209859] = {};
[224729] = {};
[268129] = {};
[277242] = {};
};
["id"] = 136470;
["health"] = 294320;
["count"] = 4;
["displayId"] = 84784;
["creatureType"] = "Humanoid";
["level"] = 120;
["name"] = "Refreshment Vendor";
["characteristics"] = {
["Taunt"] = true;
["Incapacitate"] = true;
["Root"] = true;
["Polymorph"] = true;
["Disorient"] = true;
["Sap"] = true;
["Fear"] = true;
["Stun"] = true;
["Slow"] = true;
["Silence"] = true;
["Imprison"] = true;
};
};
[7] = {
["clones"] = {
[1] = {
["sublevel"] = 1;
["x"] = 468.10057708854;
["y"] = -418.99739761449;
["g"] = 3;
["infested"] = {
[1] = true;
};
};
[2] = {
["sublevel"] = 1;
["x"] = 454.04528093853;
["infested"] = {
[2] = true;
};
["g"] = 19;
["y"] = -355.10936763606;
};
[4] = {
["y"] = -332.54631028177;
["x"] = 509.76385820838;
["g"] = 22;
["sublevel"] = 1;
};
[8] = {
["y"] = -307.48171092243;
["x"] = 464.72918257925;
["g"] = 26;
["sublevel"] = 1;
};
[16] = {
["y"] = -335.13658682306;
["x"] = 397.55354496879;
["g"] = 33;
["sublevel"] = 1;
};
[17] = {
["sublevel"] = 1;
["x"] = 412.49411787662;
["infested"] = {
[2] = true;
};
["g"] = 34;
["y"] = -333.7267126433;
};
[9] = {
["y"] = -332.25374457137;
["x"] = 478.21192841174;
["g"] = 25;
["sublevel"] = 1;
};
[18] = {
["y"] = -352.41702962473;
["x"] = 410.27970801072;
["g"] = 35;
["sublevel"] = 1;
};
[5] = {
["y"] = -327.71114824701;
["x"] = 505.47815390753;
["g"] = 22;
["sublevel"] = 1;
};
[10] = {
["y"] = -332.32743212129;
["x"] = 470.96799696168;
["g"] = 25;
["sublevel"] = 1;
};
[20] = {
["y"] = -424.95815162701;
["x"] = 431.13207048378;
["teeming"] = true;
["g"] = 4;
["sublevel"] = 1;
};
[11] = {
["y"] = -304.58596373195;
["x"] = 450.00392816461;
["g"] = 28;
["sublevel"] = 1;
};
[3] = {
["y"] = -353.0552760026;
["x"] = 474.45111142952;
["g"] = 21;
["sublevel"] = 1;
};
[6] = {
["y"] = -323.82978481744;
["x"] = 499.65076427533;
["g"] = 23;
["sublevel"] = 1;
};
[12] = {
["y"] = -310.32368802792;
["x"] = 449.6760549887;
["g"] = 28;
["sublevel"] = 1;
};
[13] = {
["y"] = -308.44228119433;
["x"] = 439.76026831389;
["g"] = 29;
["sublevel"] = 1;
};
[7] = {
["y"] = -311.91353221683;
["x"] = 468.9249933922;
["g"] = 26;
["sublevel"] = 1;
};
[14] = {
["sublevel"] = 1;
["x"] = 412.42958839315;
["y"] = -316.77206590988;
["g"] = 31;
["infested"] = {
[1] = true;
};
};
[19] = {
["sublevel"] = 1;
["x"] = 434.22763792554;
["y"] = -346.93038103221;
["g"] = 39;
["infested"] = {
[1] = true;
};
};
[15] = {
["sublevel"] = 1;
["x"] = 425.97839125071;
["y"] = -328.26965213076;
["g"] = 32;
["infested"] = {
[1] = true;
};
};
};
["scale"] = 1;
["spells"] = {
[209859] = {};
[281621] = {};
[277564] = {};
[262287] = {};
[262019] = {};
[267433] = {};
[224729] = {};
[277242] = {};
[280602] = {};
};
["id"] = 130488;
["health"] = 294320;
["count"] = 4;
["displayId"] = 81265;
["creatureType"] = "Humanoid";
["level"] = 120;
["name"] = "Mech Jockey";
["characteristics"] = {
["Taunt"] = true;
["Incapacitate"] = true;
["Root"] = true;
["Polymorph"] = true;
["Disorient"] = true;
["Sap"] = true;
["Fear"] = true;
["Stun"] = true;
["Slow"] = true;
["Silence"] = true;
["Imprison"] = true;
};
};
[8] = {
["clones"] = {
[15] = {
["y"] = -367.53093322539;
["x"] = 429.97118218407;
["g"] = 38;
["sublevel"] = 1;
};
[13] = {
["sublevel"] = 1;
["x"] = 408.07555384685;
["infested"] = {
[3] = true;
};
["g"] = 34;
["y"] = -336.98255024376;
};
[7] = {
["sublevel"] = 1;
["x"] = 484.59901468162;
["infested"] = {
[3] = true;
};
["g"] = 24;
["y"] = -317.27159278197;
};
[14] = {
["y"] = -355.71634412717;
["x"] = 405.65446988511;
["g"] = 35;
["sublevel"] = 1;
};
[2] = {
["y"] = -380.53516379952;
["x"] = 445.54271378336;
["g"] = 7;
["sublevel"] = 1;
};
[4] = {
["y"] = -404.1715499278;
["x"] = 431.34753769379;
["g"] = 9;
["sublevel"] = 1;
};
[8] = {
["y"] = -312.21697049844;
["x"] = 481.27610806539;
["g"] = 24;
["sublevel"] = 1;
};
[9] = {
["y"] = -328.52072837613;
["x"] = 454.43938551122;
["g"] = 41;
["sublevel"] = 1;
};
[5] = {
["y"] = -350.24498163279;
["x"] = 479.7049469698;
["g"] = 21;
["sublevel"] = 1;
};
[10] = {
["sublevel"] = 1;
["x"] = 471.28511852648;
["infested"] = {
[3] = true;
};
["g"] = 26;
["y"] = -305.73344743986;
};
[11] = {
["y"] = -286.42245038369;
["x"] = 460.55550189356;
["g"] = 27;
["sublevel"] = 1;
};
[3] = {
["sublevel"] = 1;
["x"] = 441.82179359542;
["infested"] = {
[3] = true;
};
["g"] = 7;
["y"] = -385.65146149395;
};
[6] = {
["y"] = -319.44911838114;
["x"] = 501.98621577546;
["g"] = 23;
["sublevel"] = 1;
};
[12] = {
["y"] = -307.38695490151;
["x"] = 433.49427586077;
["g"] = 29;
["sublevel"] = 1;
};
[1] = {
["y"] = -394.4723222671;
["x"] = 454.94319863389;
["g"] = 6;
["sublevel"] = 1;
};
};
["scale"] = 1.2;
["spells"] = {
[263637] = {};
[277242] = {};
[263636] = {};
[209859] = {};
[277564] = {};
[224729] = {};
[262092] = {};
};
["id"] = 130435;
["health"] = 382616;
["count"] = 5;
["displayId"] = 30262;
["creatureType"] = "Humanoid";
["level"] = 120;
["name"] = "Addled Thug";
["characteristics"] = {
["Taunt"] = true;
["Incapacitate"] = true;
["Root"] = true;
["Polymorph"] = true;
["Disorient"] = true;
["Fear"] = true;
["Silence"] = true;
["Slow"] = true;
["Stun"] = true;
["Imprison"] = true;
};
};
[10] = {
["clones"] = {
[27] = {
["y"] = -370.30634645459;
["x"] = 477.06163381324;
["g"] = 17;
["sublevel"] = 1;
};
[2] = {
["y"] = -406.68334039168;
["x"] = 445.78617091534;
["g"] = 8;
["sublevel"] = 1;
};
[38] = {
["y"] = -354.48216452909;
["x"] = 398.73887072976;
["g"] = 37;
["sublevel"] = 1;
};
[3] = {
["y"] = -409.94863741865;
["x"] = 444.76576668919;
["g"] = 8;
["sublevel"] = 1;
};
[4] = {
["y"] = -394.79444469829;
["x"] = 446.30373750595;
["g"] = 10;
["sublevel"] = 1;
};
[5] = {
["y"] = -394.93729145432;
["x"] = 443.44659393948;
["g"] = 10;
["sublevel"] = 1;
};
[6] = {
["y"] = -383.14512786918;
["x"] = 452.2980765933;
["g"] = 11;
["sublevel"] = 1;
};
[7] = {
["y"] = -386.05422608501;
["x"] = 449.38897837747;
["g"] = 11;
["sublevel"] = 1;
};
[8] = {
["y"] = -389.14512928445;
["x"] = 446.47989576722;
["g"] = 11;
["sublevel"] = 1;
};
[10] = {
["y"] = -394.39300324678;
["x"] = 434.16502939967;
["g"] = 12;
["sublevel"] = 1;
};
[12] = {
["y"] = -392.18745932876;
["x"] = 467.77829615664;
["g"] = 13;
["sublevel"] = 1;
};
[14] = {
["y"] = -391.54916681443;
["x"] = 472.1400004776;
["g"] = 13;
["sublevel"] = 1;
};
[16] = {
["y"] = -380.49718389826;
["x"] = 467.44899964032;
["g"] = 14;
["sublevel"] = 1;
};
[20] = {
["y"] = -384.29121070518;
["x"] = 475.29797373954;
["g"] = 15;
["sublevel"] = 1;
};
[24] = {
["y"] = -376.66260870592;
["x"] = 485.84235116617;
["g"] = 16;
["sublevel"] = 1;
};
[28] = {
["y"] = -363.7349113471;
["x"] = 473.20452617001;
["g"] = 18;
["sublevel"] = 1;
};
[32] = {
["y"] = -363.01578806743;
["x"] = 402.12331954866;
["g"] = 36;
["sublevel"] = 1;
};
[40] = {
["y"] = -348.41656705721;
["x"] = 390.21425257978;
["g"] = 37;
["sublevel"] = 1;
};
[33] = {
["y"] = -360.16054336484;
["x"] = 393.43874065695;
["sublevel"] = 1;
};
[41] = {
["y"] = -352.02312978038;
["x"] = 388.7388655;
["g"] = 37;
["sublevel"] = 1;
};
[17] = {
["y"] = -383.65508608764;
["x"] = 466.92269954902;
["g"] = 14;
["sublevel"] = 1;
};
[21] = {
["y"] = -385.29121156652;
["x"] = 477.15514096771;
["g"] = 15;
["sublevel"] = 1;
};
[25] = {
["y"] = -377.00744084803;
["x"] = 488.60096390789;
["g"] = 16;
["sublevel"] = 1;
};
[29] = {
["y"] = -362.30634569463;
["x"] = 476.06165747495;
["g"] = 18;
["sublevel"] = 1;
};
[34] = {
["y"] = -353.49853093076;
["x"] = 396.1159134637;
["g"] = 37;
["sublevel"] = 1;
};
[42] = {
["y"] = -355.79362909151;
["x"] = 389.55850622796;
["g"] = 37;
["sublevel"] = 1;
};
[9] = {
["y"] = -390.8238566991;
["x"] = 434.19345472932;
["g"] = 12;
["sublevel"] = 1;
};
[11] = {
["y"] = -392.94562152816;
["x"] = 437.0597815434;
["g"] = 12;
["sublevel"] = 1;
};
[13] = {
["y"] = -391.23001827454;
["x"] = 469.90595613289;
["g"] = 13;
["sublevel"] = 1;
};
[15] = {
["y"] = -380.45963040171;
["x"] = 464.40197530756;
["g"] = 14;
["sublevel"] = 1;
};
[18] = {
["y"] = -385.66510752651;
["x"] = 466.59374958019;
["g"] = 14;
["sublevel"] = 1;
};
[22] = {
["y"] = -381.57692615626;
["x"] = 475.29797373954;
["g"] = 15;
["sublevel"] = 1;
};
[26] = {
["y"] = -370.73491124572;
["x"] = 474.34737378737;
["g"] = 17;
["sublevel"] = 1;
};
[30] = {
["y"] = -361.06456389368;
["x"] = 400.17209537491;
["g"] = 36;
["sublevel"] = 1;
};
[36] = {
["y"] = -351.53133408713;
["x"] = 392.34541415258;
["g"] = 37;
["sublevel"] = 1;
};
[37] = {
["y"] = -354.97396022235;
["x"] = 392.18149163522;
["g"] = 37;
["sublevel"] = 1;
};
[39] = {
["y"] = -351.20346091122;
["x"] = 398.73887072976;
["g"] = 37;
["sublevel"] = 1;
};
[35] = {
["y"] = -349.72805976084;
["x"] = 395.62408962924;
["g"] = 37;
["sublevel"] = 1;
};
[1] = {
["y"] = -404.03027889382;
["x"] = 447.01067700648;
["g"] = 8;
["sublevel"] = 1;
};
[19] = {
["y"] = -384.43223817242;
["x"] = 469.33349975444;
["g"] = 14;
["sublevel"] = 1;
};
[23] = {
["y"] = -382.57525345282;
["x"] = 477.27170614703;
["g"] = 15;
["sublevel"] = 1;
};
[31] = {
["y"] = -363.01578806743;
["x"] = 398.58672965892;
["g"] = 36;
["sublevel"] = 1;
};
};
["id"] = 136006;
["neutral"] = true;
["count"] = 0;
["health"] = 58864;
["name"] = "Rowdy Reveler";
["displayId"] = 85710;
["creatureType"] = "Humanoid";
["level"] = 120;
["scale"] = 0.7;
["characteristics"] = {
["Taunt"] = true;
["Disorient"] = true;
["Root"] = true;
["Stun"] = true;
["Slow"] = true;
["Silence"] = true;
["Fear"] = true;
};
};
[12] = {
["clones"] = {
[1] = {
["y"] = -269.35004719114;
["x"] = 383.52127517017;
["sublevel"] = 1;
};
};
["name"] = "Coin-Operated Crowd Pummeler";
["characteristics"] = {
["Taunt"] = true;
};
["spells"] = {
[257337] = {};
[269493] = {};
[271903] = {};
[267551] = {};
[267547] = {};
[262347] = {};
[271867] = {};
};
["isBoss"] = true;
["encounterID"] = 2109;
["instanceID"] = 1012;
["count"] = 0;
["health"] = 3414112;
["displayId"] = 80443;
["creatureType"] = "Mechanical";
["level"] = 122;
["id"] = 129214;
["scale"] = 1;
};
[14] = {
["clones"] = {
[7] = {
["sublevel"] = 1;
["x"] = 285.73839641588;
["y"] = -263.39813899924;
["g"] = 48;
["infested"] = {
[1] = true;
};
};
[1] = {
["sublevel"] = 1;
["x"] = 336.64831715532;
["y"] = -248.51747410029;
["g"] = 42;
["infested"] = {};
};
[2] = {
["sublevel"] = 1;
["x"] = 340.54952988674;
["infested"] = {
[1] = true;
};
["g"] = 42;
["y"] = -243.87644139072;
};
[4] = {
["y"] = -270.78155789664;
["x"] = 338.24100852005;
["g"] = 43;
["sublevel"] = 1;
};
[8] = {
["sublevel"] = 1;
["x"] = 274.0388347133;
["infested"] = {
[1] = true;
};
["g"] = 50;
["y"] = -252.30067896864;
};
[9] = {
["y"] = -252.95285225745;
["x"] = 266.86495652465;
["g"] = 50;
["sublevel"] = 1;
};
[5] = {
["y"] = -243.99712109165;
["x"] = 321.36786067196;
["g"] = 44;
["sublevel"] = 1;
};
[10] = {
["y"] = -257.29908278369;
["x"] = 244.5232831631;
["g"] = 88;
["sublevel"] = 1;
};
[3] = {
["y"] = -269.6340825539;
["x"] = 333.12163283447;
["g"] = 43;
["sublevel"] = 1;
};
[6] = {
["y"] = -252.02475529748;
["x"] = 314.70046805279;
["g"] = 44;
["sublevel"] = 1;
};
[11] = {
["sublevel"] = 1;
["x"] = 246.44636910375;
["infested"] = {
[1] = true;
};
["g"] = 51;
["y"] = -268.64522215933;
};
};
["scale"] = 0.8;
["spells"] = {
[263209] = {};
[209859] = {};
[277242] = {};
[277564] = {};
};
["id"] = 130437;
["count"] = 2;
["name"] = "Mine Rat";
["displayId"] = 65436;
["creatureType"] = "Humanoid";
["level"] = 120;
["health"] = 176592;
["characteristics"] = {
["Taunt"] = true;
["Root"] = true;
["Polymorph"] = true;
["Disorient"] = true;
["Sap"] = true;
["Silence"] = true;
["Slow"] = true;
["Stun"] = true;
["Fear"] = true;
};
};
[16] = {
["clones"] = {
[1] = {
["y"] = -268.45436094448;
["x"] = 290.29653993565;
["g"] = 48;
["sublevel"] = 1;
};
[2] = {
["y"] = -255.35927933195;
["x"] = 250.33429794346;
["g"] = 88;
["sublevel"] = 1;
};
[4] = {
["sublevel"] = 1;
["x"] = 279.24259872388;
["infested"] = {
[3] = true;
};
["g"] = 54;
["y"] = -241.57420081507;
};
[3] = {
["sublevel"] = 1;
["x"] = 253.56174912058;
["infested"] = {
[3] = true;
};
["g"] = 51;
["y"] = -271.5298510703;
};
};
["scale"] = 1.2;
["spells"] = {
[268417] = {};
[268415] = {};
[209859] = {};
[277564] = {};
};
["id"] = 136643;
["count"] = 6;
["name"] = "Azerite Extractor";
["displayId"] = 84881;
["creatureType"] = "Mechanical";
["level"] = 121;
["health"] = 470912;
["characteristics"] = {
["Taunt"] = true;
};
};
[20] = {
["clones"] = {
[1] = {
["y"] = -176.25325035966;
["x"] = 247.29418483409;
["g"] = 78;
["sublevel"] = 1;
};
};
["scale"] = 1.4;
["spells"] = {
[263583] = {};
[263601] = {};
[209859] = {};
[263276] = {};
[263586] = {};
[263275] = {};
};
["id"] = 134012;
["name"] = "Taskmaster Askari";
["health"] = 470912;
["displayId"] = 83286;
["creatureType"] = "Humanoid";
["level"] = 121;
["count"] = 6;
["characteristics"] = {
["Taunt"] = true;
};
};
[24] = {
["clones"] = {
[7] = {
["sublevel"] = 1;
["x"] = 371.83635399335;
["patrol"] = {
[1] = {
["y"] = -134.454518109;
["x"] = 367.57290486676;
};
[2] = {
["y"] = -140.73360211461;
["x"] = 377.57289908;
};
[4] = {
["y"] = -128.64055661211;
["x"] = 358.03803316225;
};
[3] = {
["y"] = -134.454518109;
["x"] = 367.57290486676;
};
};
["infested"] = {};
["y"] = -135.82534968228;
};
[1] = {
["y"] = -114.87366004873;
["x"] = 426.4223142796;
["g"] = 66;
["sublevel"] = 1;
};
[2] = {
["y"] = -120.73573247268;
["x"] = 425.7326203986;
["g"] = 66;
["sublevel"] = 1;
};
[4] = {
["sublevel"] = 1;
["x"] = 364.22819552767;
["patrol"] = {
[1] = {
["y"] = -111.94521274864;
["x"] = 364.22819552767;
};
[2] = {
["y"] = -116.9452196157;
["x"] = 357.50405754684;
};
[4] = {
["y"] = -108.32451965164;
["x"] = 372.50404855123;
};
[3] = {
["y"] = -111.94521274864;
["x"] = 364.22819552767;
};
};
["infested"] = {
[3] = true;
};
["y"] = -111.94521274864;
};
[8] = {
["y"] = -109.67485765522;
["x"] = 409.74688664058;
["teeming"] = true;
["g"] = 65;
["sublevel"] = 1;
};
[9] = {
["y"] = -126.78425288335;
["x"] = 370.46648478504;
["infested"] = {};
["teeming"] = true;
["g"] = 75;
["sublevel"] = 1;
};
[5] = {
["y"] = -106.89309868833;
["x"] = 387.11718681777;
["patrol"] = {
[1] = {
["y"] = -106.89309868833;
["x"] = 387.11718681777;
};
[2] = {
["y"] = -102.34763077539;
["x"] = 376.75353807875;
};
[4] = {
["y"] = -116.34764448141;
["x"] = 395.6626452705;
};
[3] = {
["y"] = -106.89309868833;
["x"] = 387.11718681777;
};
};
["sublevel"] = 1;
};
[3] = {
["y"] = -148.69317920568;
["x"] = 361.86321322224;
["patrol"] = {
[1] = {
["y"] = -148.69317920568;
["x"] = 361.86321322224;
};
[2] = {
["y"] = -143.91056264851;
["x"] = 354.03715241535;
};
[4] = {
["y"] = -149.87321883214;
["x"] = 373.13469152513;
};
[3] = {
["y"] = -148.69317920568;
["x"] = 361.86321322224;
};
};
["sublevel"] = 1;
};
[6] = {
["sublevel"] = 1;
["x"] = 391.28214632718;
["patrol"] = {
[1] = {
["y"] = -127.95643401756;
["x"] = 391.28214632718;
};
[2] = {
["y"] = -134.6805572;
["x"] = 384.90282569007;
};
[4] = {
["y"] = -121.23230343592;
["x"] = 396.28215319424;
};
[3] = {
["y"] = -127.95643401756;
["x"] = 391.28214632718;
};
};
["infested"] = {
[3] = true;
};
["y"] = -127.95643401756;
};
};
["id"] = 133430;
["spells"] = {
[262804] = {};
[262794] = {};
[209859] = {};
[262947] = {};
[271428] = {};
[277564] = {};
};
["stealthDetect"] = true;
["characteristics"] = {
["Taunt"] = true;
};
["health"] = 470912;
["count"] = 8;
["displayId"] = 83136;
["creatureType"] = "Humanoid";
["level"] = 121;
["name"] = "Venture Co. Mastermind";
["scale"] = 1.2;
};
[28] = {
["clones"] = {
[1] = {
["y"] = -109.69783927577;
["x"] = 348.65226398989;
["g"] = 61;
["sublevel"] = 1;
};
[2] = {
["y"] = -111.56597199118;
["x"] = 348.32258934955;
["g"] = 61;
["sublevel"] = 1;
};
[4] = {
["y"] = -91.845982810497;
["x"] = 354.30545462517;
["g"] = 62;
["sublevel"] = 1;
};
[8] = {
["y"] = -93.3726985009;
["x"] = 356.3571527917;
["g"] = 62;
["sublevel"] = 1;
};
[16] = {
["y"] = -117.29667688676;
["x"] = 388.49345438637;
["g"] = 69;
["sublevel"] = 1;
};
[17] = {
["y"] = -117.28400446284;
["x"] = 384.20244905826;
["g"] = 69;
["sublevel"] = 1;
};
[9] = {
["y"] = -93.3726985009;
["x"] = 354.02837866486;
["g"] = 62;
["sublevel"] = 1;
};
[18] = {
["y"] = -119.46581251914;
["x"] = 389.47518372237;
["g"] = 69;
["sublevel"] = 1;
};
[5] = {
["y"] = -90.085019455527;
["x"] = 356.3571527917;
["g"] = 62;
["sublevel"] = 1;
};
[10] = {
["sublevel"] = 1;
["x"] = 403.21050634604;
["infested"] = {
[1] = true;
};
["g"] = 68;
["y"] = -147.32816918582;
};
[20] = {
["sublevel"] = 1;
["x"] = 387.92423900664;
["infested"] = {
[1] = true;
};
["g"] = 71;
["y"] = -162.87146377604;
};
[21] = {
["y"] = -164.12146011361;
["x"] = 384.17424328839;
["g"] = 71;
["sublevel"] = 1;
};
[11] = {
["y"] = -146.83636645726;
["x"] = 395.66950772378;
["g"] = 68;
["sublevel"] = 1;
};
[22] = {
["y"] = -166.465200732;
["x"] = 384.48674740193;
["g"] = 71;
["sublevel"] = 1;
};
[3] = {
["sublevel"] = 1;
["x"] = 350.190717349;
["infested"] = {
[1] = true;
};
["g"] = 61;
["y"] = -112.7747742898;
};
[6] = {
["y"] = -89.948031358933;
["x"] = 358.95990311173;
["g"] = 62;
["sublevel"] = 1;
};
[12] = {
["y"] = -149.78718986392;
["x"] = 396.81706383946;
["g"] = 68;
["sublevel"] = 1;
};
[24] = {
["y"] = -165.37145645119;
["x"] = 389.64299822004;
["g"] = 71;
["sublevel"] = 1;
};
[15] = {
["y"] = -119.36467831552;
["x"] = 386.12787103318;
["g"] = 69;
["sublevel"] = 1;
};
[25] = {
["y"] = -140.30334173465;
["x"] = 368.90539961288;
["g"] = 77;
["sublevel"] = 1;
};
[13] = {
["y"] = -151.09866146165;
["x"] = 400.09572524552;
["g"] = 68;
["sublevel"] = 1;
};
[26] = {
["sublevel"] = 1;
["x"] = 368.78344679363;
["infested"] = {
[1] = true;
};
["g"] = 77;
["y"] = -143.83992115723;
};
[7] = {
["y"] = -92.002829292588;
["x"] = 357.86398658135;
["g"] = 62;
["sublevel"] = 1;
};
[27] = {
["y"] = -145.4252921068;
["x"] = 366.83223308703;
["g"] = 77;
["sublevel"] = 1;
};
[14] = {
["y"] = -147.98392257293;
["x"] = 400.42361249203;
["g"] = 68;
["sublevel"] = 1;
};
[28] = {
["y"] = -141.76675463138;
["x"] = 361.3444294907;
["g"] = 77;
["sublevel"] = 1;
};
[23] = {
["y"] = -168.18395994539;
["x"] = 387.76800036091;
["g"] = 71;
["sublevel"] = 1;
};
[29] = {
["y"] = -138.47407038016;
["x"] = 362.68590003534;
["g"] = 77;
["sublevel"] = 1;
};
[19] = {
["y"] = -115.45457574642;
["x"] = 385.8618748753;
["g"] = 69;
["sublevel"] = 1;
};
};
["scale"] = 0.5;
["spells"] = {
[268810] = {};
[277564] = {};
[209859] = {};
[268815] = {};
[277242] = {};
};
["id"] = 133963;
["health"] = 58864;
["count"] = 1;
["displayId"] = 1141;
["creatureType"] = "Humanoid";
["level"] = 120;
["name"] = "Test Subject";
["characteristics"] = {
["Taunt"] = true;
["Disorient"] = true;
["Stun"] = true;
["Slow"] = true;
["Fear"] = true;
};
};
[32] = {
["clones"] = {
[6] = {
["sublevel"] = 1;
["x"] = 586.47345853923;
["infested"] = {
[2] = true;
};
["g"] = 84;
["y"] = -147.43362106064;
};
[2] = {
["sublevel"] = 1;
["x"] = 521.70058374331;
["infested"] = {
[2] = true;
};
["g"] = 81;
["y"] = -106.44030978905;
};
[3] = {
["y"] = -111.90906472069;
["x"] = 522.16932650257;
["g"] = 81;
["sublevel"] = 1;
};
[1] = {
["sublevel"] = 1;
["x"] = 505.66596989434;
["infested"] = {
[1] = true;
[2] = true;
};
["g"] = 80;
["y"] = -122.86716363872;
};
[4] = {
["y"] = -108.8101506555;
["x"] = 547.55938846329;
["sublevel"] = 1;
};
[5] = {
["y"] = -118.15494269766;
["x"] = 560.76499627596;
["g"] = 82;
["sublevel"] = 1;
};
};
["scale"] = 1;
["spells"] = {
[269090] = {};
[269092] = {};
[277242] = {};
[209859] = {};
[277564] = {};
};
["id"] = 137029;
["health"] = 294320;
["count"] = 5;
["displayId"] = 85024;
["creatureType"] = "Humanoid";
["level"] = 120;
["name"] = "Ordnance Specialist";
["characteristics"] = {
["Taunt"] = true;
["Disorient"] = true;
["Stun"] = true;
["Slow"] = true;
["Incapacitate"] = true;
};
};
[33] = {
["clones"] = {
[7] = {
["y"] = -130.64835797805;
["x"] = 602.10878780705;
["sublevel"] = 1;
["infested"] = {
[3] = true;
};
};
[1] = {
["y"] = -114.90501753788;
["x"] = 535.86383501739;
["sublevel"] = 1;
};
[2] = {
["y"] = -99.021804007882;
["x"] = 534.80133308267;
["infested"] = {
[2] = true;
};
["sublevel"] = 1;
};
[4] = {
["y"] = -107.02042727081;
["x"] = 568.88324042251;
["g"] = 83;
["sublevel"] = 1;
};
[8] = {
["y"] = -158.96290439736;
["x"] = 612.93507584307;
["g"] = 85;
["sublevel"] = 1;
};
[9] = {
["y"] = -166.42558655613;
["x"] = 603.68135099104;
["g"] = 85;
["sublevel"] = 1;
};
[5] = {
["y"] = -111.70792191861;
["x"] = 566.85199050662;
["g"] = 83;
["sublevel"] = 1;
};
[3] = {
["y"] = -127.01005945566;
["x"] = 554.9281381064;
["sublevel"] = 1;
};
[6] = {
["y"] = -153.32402103198;
["x"] = 579.89810044849;
["g"] = 84;
["sublevel"] = 1;
};
};
["scale"] = 1;
["spells"] = {
[277564] = {};
[281621] = {};
[277242] = {};
[260372] = {};
[262287] = {};
[262513] = {};
[262515] = {};
[209859] = {};
};
["characteristics"] = {
["Taunt"] = true;
};
["health"] = 294320;
["count"] = 5;
["displayId"] = 82922;
["creatureType"] = "Humanoid";
["level"] = 120;
["name"] = "Venture Co. Skyscorcher";
["id"] = 133436;
};
[17] = {
["clones"] = {
[6] = {
["y"] = -183.53519624758;
["x"] = 315.99259856438;
["patrol"] = {};
["sublevel"] = 1;
};
[2] = {
["y"] = -198.35504171889;
["x"] = 311.91508142068;
["patrol"] = {};
["sublevel"] = 1;
};
[3] = {
["y"] = -192.54859515885;
["x"] = 332.56021551615;
["patrol"] = {};
["sublevel"] = 1;
};
[1] = {
["y"] = -187.06471973415;
["x"] = 297.3989234896;
["patrol"] = {};
["sublevel"] = 1;
};
[4] = {
["y"] = -169.57684578475;
["x"] = 305.78424056015;
["patrol"] = {};
["sublevel"] = 1;
};
[5] = {
["y"] = -171.24349221168;
["x"] = 322.8676100705;
["patrol"] = {};
["sublevel"] = 1;
};
};
["scale"] = 1.2;
["spells"] = {
[257478] = {};
};
["stealthDetect"] = true;
["name"] = "Safety Shark";
["health"] = 294320;
["displayId"] = 12207;
["creatureType"] = "Beast";
["level"] = 120;
["id"] = 137940;
["count"] = 4;
};
[21] = {
["clones"] = {
[1] = {
["y"] = -149.53323722569;
["x"] = 252.15696974033;
["g"] = 58;
["sublevel"] = 1;
};
};
["characteristics"] = {
["Taunt"] = true;
};
["scale"] = 1;
["spells"] = {
[271698] = {};
[275907] = {};
[258622] = {};
[257597] = {};
[257593] = {};
};
["isBoss"] = true;
["encounterID"] = 2114;
["instanceID"] = 1012;
["count"] = 0;
["health"] = 1813011;
["displayId"] = 83891;
["creatureType"] = "Elemental";
["level"] = 122;
["name"] = "Azerokk";
["id"] = 129227;
};
[25] = {
["clones"] = {
[7] = {
["sublevel"] = 1;
["x"] = 408.80034973201;
["infested"] = {
[2] = true;
};
["g"] = 67;
["y"] = -126.9038768246;
};
[1] = {
["y"] = -96.118657816419;
["x"] = 342.49887736161;
["g"] = 60;
["sublevel"] = 1;
};
[2] = {
["y"] = -97.670387657532;
["x"] = 339.05061513406;
["g"] = 60;
["sublevel"] = 1;
};
[4] = {
["sublevel"] = 1;
["x"] = 371.70169599061;
["infested"] = {
[3] = true;
};
["g"] = 63;
["y"] = -88.467782982899;
};
[8] = {
["y"] = -156.20269452448;
["x"] = 376.06223543989;
["g"] = 73;
["sublevel"] = 1;
};
[9] = {
["y"] = -157.08512826728;
["x"] = 354.36371909447;
["g"] = 74;
["sublevel"] = 1;
};
[5] = {
["y"] = -91.814075922799;
["x"] = 382.49051316428;
["g"] = 64;
["sublevel"] = 1;
};
[10] = {
["y"] = -119.66097180029;
["x"] = 364.57607893489;
["g"] = 75;
["sublevel"] = 1;
};
[3] = {
["y"] = -110.67757559578;
["x"] = 352.86760421168;
["g"] = 61;
["sublevel"] = 1;
};
[6] = {
["y"] = -109.01160242318;
["x"] = 423.83608801216;
["g"] = 66;
["sublevel"] = 1;
};
[11] = {
["y"] = -118.56508466398;
["x"] = 369.7815560597;
["g"] = 75;
["sublevel"] = 1;
};
};
["scale"] = 0.8;
["spells"] = {
[263105] = {};
[277564] = {};
[263074] = {};
[263103] = {};
[209859] = {};
[263066] = {};
[262263] = {};
[277242] = {};
};
["id"] = 133345;
["health"] = 294320;
["count"] = 5;
["displayId"] = 82866;
["creatureType"] = "Humanoid";
["level"] = 120;
["name"] = "Feckless Assistant";
["characteristics"] = {
["Taunt"] = true;
["Root"] = true;
["Polymorph"] = true;
["Disorient"] = true;
["Sap"] = true;
["Silence"] = true;
["Slow"] = true;
["Stun"] = true;
["Fear"] = true;
};
};
[29] = {
["clones"] = {
[1] = {
["y"] = -112.22534117666;
["x"] = 466.80802997306;
["sublevel"] = 1;
};
};
["characteristics"] = {
["Taunt"] = true;
};
["scale"] = 1;
["spells"] = {
[259474] = {};
[259853] = {};
[260669] = {};
[259856] = {};
};
["isBoss"] = true;
["encounterID"] = 2115;
["instanceID"] = 1012;
["count"] = 0;
["health"] = 2060240;
["displayId"] = 81489;
["creatureType"] = "Humanoid";
["level"] = 122;
["name"] = "Rixxa Fluxflame";
["id"] = 129231;
};
[34] = {
["clones"] = {
[1] = {
["y"] = -210.91697510937;
["x"] = 578.23777434257;
["sublevel"] = 1;
};
};
["characteristics"] = {
["Taunt"] = true;
};
["scale"] = 1;
["spells"] = {
[260323] = {};
[260190] = {};
[260280] = {};
[260811] = {};
[260813] = {};
[271456] = {};
[260202] = {};
[260189] = {};
[260318] = {};
[276212] = {};
[270277] = {};
[270926] = {};
};
["isBoss"] = true;
["encounterID"] = 2116;
["instanceID"] = 1012;
["count"] = 0;
["health"] = 2295696;
["displayId"] = 81816;
["creatureType"] = "Mechanical";
["level"] = 122;
["name"] = "Mogul Razdunk";
["id"] = 129232;
};
[9] = {
["clones"] = {
[7] = {
["y"] = -294.49634326392;
["x"] = 406.74577908281;
["g"] = 30;
["sublevel"] = 1;
};
[1] = {
["y"] = -373.33634931865;
["x"] = 461.11431977744;
["g"] = 40;
["sublevel"] = 1;
};
[2] = {
["y"] = -405.91104792692;
["x"] = 437.738721009;
["g"] = 9;
["sublevel"] = 1;
};
[4] = {
["y"] = -326.76391932942;
["x"] = 460.40217993942;
["g"] = 41;
["sublevel"] = 1;
};
[8] = {
["y"] = -327.57033724503;
["x"] = 398.72250499114;
["g"] = 33;
["sublevel"] = 1;
};
[9] = {
["y"] = -330.00580243568;
["x"] = 408.30809514058;
["g"] = 34;
["sublevel"] = 1;
};
[5] = {
["y"] = -322.50162432503;
["x"] = 454.00873743284;
["g"] = 41;
["sublevel"] = 1;
};
[3] = {
["y"] = -343.88831545938;
["x"] = 463.90011099051;
["g"] = 20;
["sublevel"] = 1;
};
[6] = {
["y"] = -336.78665619602;
["x"] = 474.62271822124;
["patrol"] = {
[1] = {
["y"] = -336.78665619602;
["x"] = 474.62271822124;
};
[2] = {
["y"] = -348.65758098167;
["x"] = 468.90094316129;
};
[4] = {
["y"] = -324.30975643075;
["x"] = 471.72703052261;
};
[3] = {
["y"] = -336.78665619602;
["x"] = 474.62271822124;
};
};
["g"] = 25;
["sublevel"] = 1;
};
};
["scale"] = 1;
["spells"] = {
[267354] = {};
[269302] = {};
[277564] = {};
[209859] = {};
[267357] = {};
[269298] = {};
};
["id"] = 134232;
["health"] = 294320;
["count"] = 4;
["displayId"] = 83395;
["creatureType"] = "Humanoid";
["level"] = 120;
["name"] = "Hired Assassin";
["characteristics"] = {
["Taunt"] = true;
["Incapacitate"] = true;
["Root"] = true;
["Polymorph"] = true;
["Disorient"] = true;
["Sap"] = true;
["Fear"] = true;
["Stun"] = true;
["Slow"] = true;
["Silence"] = true;
["Imprison"] = true;
};
};
[11] = {
["clones"] = {
[1] = {
["y"] = -287.96403229057;
["x"] = 409.75023371705;
["g"] = 30;
["sublevel"] = 1;
};
[2] = {
["sublevel"] = 1;
["x"] = 425.25199455151;
["patrol"] = {
[1] = {
["y"] = -351.32147778175;
["x"] = 425.25199455151;
};
[2] = {
["y"] = -342.13778719702;
["x"] = 417.4969119229;
};
[4] = {
["y"] = -355.40308592811;
["x"] = 437.08876415058;
};
[3] = {
["y"] = -351.32147778175;
["x"] = 425.25199455151;
};
};
["infested"] = {
[3] = true;
};
["y"] = -351.32147778175;
};
};
["scale"] = 1.6;
["spells"] = {
[262066] = {};
[262412] = {};
[263628] = {};
[209859] = {};
};
["id"] = 136139;
["health"] = 470912;
["count"] = 12;
["displayId"] = 82943;
["creatureType"] = "Mechanical";
["level"] = 121;
["name"] = "Mechanized Peacekeeper";
["characteristics"] = {
["Taunt"] = true;
};
};
[13] = {
["clones"] = {
[13] = {
["y"] = -181.49230059643;
["x"] = 252.0322517744;
["g"] = 78;
["sublevel"] = 1;
};
[7] = {
["y"] = -256.21370937208;
["x"] = 270.56060205143;
["g"] = 50;
["sublevel"] = 1;
};
[1] = {
["sublevel"] = 1;
["x"] = 341.37885347748;
["infested"] = {
[2] = true;
};
["g"] = 42;
["y"] = -248.79042145848;
};
[2] = {
["y"] = -248.6592433697;
["x"] = 322.18181830407;
["g"] = 44;
["sublevel"] = 1;
};
[4] = {
["y"] = -264.95955281291;
["x"] = 317.72880363856;
["g"] = 45;
["sublevel"] = 1;
};
[8] = {
["y"] = -266.97301602119;
["x"] = 258.25237870002;
["g"] = 51;
["sublevel"] = 1;
};
[9] = {
["y"] = -244.00686077747;
["x"] = 298.66824160164;
["g"] = 53;
["sublevel"] = 1;
};
[5] = {
["y"] = -257.93801060505;
["x"] = 309.44674265138;
["patrol"] = {
[1] = {
["y"] = -257.93801060505;
["x"] = 309.44674265138;
};
[2] = {
["y"] = -257.91990659878;
["x"] = 298.15392425402;
};
[4] = {
["y"] = -257.49952956103;
["x"] = 326.46704569555;
};
[3] = {
["y"] = -257.93801060505;
["x"] = 309.44674265138;
};
};
["infested"] = {
[3] = true;
};
["g"] = 46;
["sublevel"] = 1;
};
[10] = {
["y"] = -246.42064877628;
["x"] = 303.15100025553;
["g"] = 53;
["sublevel"] = 1;
};
[11] = {
["y"] = -236.12596711913;
["x"] = 281.29724354476;
["g"] = 54;
["sublevel"] = 1;
};
[3] = {
["y"] = -269.28650512174;
["x"] = 322.41759577357;
["g"] = 45;
["sublevel"] = 1;
};
[6] = {
["y"] = -263.24188694247;
["x"] = 291.36338999324;
["g"] = 48;
["sublevel"] = 1;
};
[12] = {
["y"] = -183.26444850217;
["x"] = 244.43731355328;
["g"] = 78;
["sublevel"] = 1;
};
[14] = {
["y"] = -177.10228965329;
["x"] = 254.87533569424;
["teeming"] = true;
["g"] = 78;
["sublevel"] = 1;
};
};
["scale"] = 1;
["spells"] = {
[277242] = {};
[268709] = {};
[263202] = {};
[209859] = {};
[268722] = {};
[277564] = {};
[271579] = {};
};
["id"] = 130661;
["count"] = 8;
["name"] = "Venture Co. Earthshaper";
["displayId"] = 81333;
["creatureType"] = "Humanoid";
["level"] = 120;
["health"] = 294320;
["characteristics"] = {
["Taunt"] = true;
["Incapacitate"] = true;
["Root"] = true;
["Polymorph"] = true;
["Disorient"] = true;
["Sap"] = true;
["Stun"] = true;
["Slow"] = true;
["Silence"] = true;
["Fear"] = true;
};
};
[15] = {
["clones"] = {
[13] = {
["y"] = -180.2668553939;
["x"] = 239.30571288417;
["teeming"] = true;
["g"] = 78;
["sublevel"] = 1;
};
[7] = {
["y"] = -271.08418338594;
["x"] = 269.70900859751;
["g"] = 49;
["sublevel"] = 1;
};
[1] = {
["sublevel"] = 1;
["x"] = 336.60257197849;
["infested"] = {
[3] = true;
};
["g"] = 43;
["y"] = -265.59673655247;
};
[2] = {
["y"] = -252.00063473159;
["x"] = 318.92820628973;
["g"] = 44;
["sublevel"] = 1;
};
[4] = {
["y"] = -255.28176587313;
["x"] = 305.38422940856;
["g"] = 46;
["sublevel"] = 1;
};
[8] = {
["y"] = -240.73099982258;
["x"] = 302.4613507697;
["g"] = 53;
["sublevel"] = 1;
};
[9] = {
["y"] = -243.83445950481;
["x"] = 307.28892676731;
["g"] = 53;
["sublevel"] = 1;
};
[5] = {
["y"] = -261.21926356403;
["x"] = 305.38422940856;
["g"] = 46;
["sublevel"] = 1;
};
[10] = {
["y"] = -245.00103764999;
["x"] = 275.38344175447;
["g"] = 54;
["sublevel"] = 1;
};
[11] = {
["y"] = -172.75811240719;
["x"] = 256.71579212167;
["g"] = 78;
["sublevel"] = 1;
};
[6] = {
["y"] = -273.33538547124;
["x"] = 275.2823863862;
["g"] = 49;
["sublevel"] = 1;
};
[12] = {
["y"] = -176.93532788558;
["x"] = 235.82972559439;
["g"] = 78;
["sublevel"] = 1;
};
[3] = {
["sublevel"] = 1;
["x"] = 321.91482562423;
["infested"] = {
[2] = true;
};
["g"] = 45;
["y"] = -264.63248688424;
};
};
["scale"] = 1;
["spells"] = {
[268362] = {};
[277242] = {};
[269313] = {};
[209859] = {};
[268712] = {};
[277564] = {};
};
["id"] = 130653;
["count"] = 4;
["name"] = "Wanton Sapper";
["displayId"] = 81316;
["creatureType"] = "Humanoid";
["level"] = 120;
["health"] = 294320;
["characteristics"] = {
["Taunt"] = true;
["Incapacitate"] = true;
["Root"] = true;
["Polymorph"] = true;
["Disorient"] = true;
["Sap"] = true;
["Stun"] = true;
["Slow"] = true;
["Silence"] = true;
["Fear"] = true;
};
};
[18] = {
["clones"] = {
[6] = {
["y"] = -198.63700036022;
["x"] = 257.04143871153;
["g"] = 57;
["sublevel"] = 1;
};
[2] = {
["y"] = -224.90126537291;
["x"] = 278.26948700647;
["g"] = 55;
["sublevel"] = 1;
};
[3] = {
["y"] = -224.63811532726;
["x"] = 281.55896986543;
["g"] = 55;
["sublevel"] = 1;
};
[1] = {
["y"] = -221.74336883029;
["x"] = 282.48000067196;
["g"] = 55;
["sublevel"] = 1;
};
[4] = {
["y"] = -194.44559164829;
["x"] = 257.86476856303;
["g"] = 57;
["sublevel"] = 1;
};
[5] = {
["sublevel"] = 1;
["x"] = 252.63086370807;
["y"] = -198.73055061898;
["g"] = 57;
["infested"] = {
[1] = true;
};
};
};
["scale"] = 0.7;
["spells"] = {
[277564] = {};
[209859] = {};
[263262] = {};
[277242] = {};
};
["id"] = 134005;
["name"] = "Shalebiter";
["health"] = 58864;
["displayId"] = 88196;
["creatureType"] = "Elemental";
["level"] = 120;
["count"] = 1;
["characteristics"] = {
["Taunt"] = true;
["Silence"] = true;
["Root"] = true;
["Slow"] = true;
["Stun"] = true;
["Fear"] = true;
};
};
[22] = {
["clones"] = {
[1] = {
["y"] = -145.56099820803;
["x"] = 261.20676759075;
["g"] = 58;
["sublevel"] = 1;
};
[2] = {
["y"] = -158.24756556426;
["x"] = 257.62465658313;
["g"] = 58;
["sublevel"] = 1;
};
[4] = {
["y"] = -140.03861443538;
["x"] = 246.57988903784;
["g"] = 58;
["sublevel"] = 1;
};
[3] = {
["y"] = -153.02369317734;
["x"] = 241.80375810842;
["g"] = 58;
["sublevel"] = 1;
};
};
["scale"] = 1;
["spells"] = {
[257544] = {};
[271526] = {};
[257582] = {};
[258627] = {};
};
["id"] = 129802;
["name"] = "Earthrager";
["health"] = 206024;
["displayId"] = 83052;
["creatureType"] = "Elemental";
["level"] = 120;
["count"] = 0;
["characteristics"] = {
["Taunt"] = true;
["Incapacitate"] = true;
["Root"] = true;
["Banish"] = true;
["Disorient"] = true;
["Silence"] = true;
["Slow"] = true;
["Stun"] = true;
["Fear"] = true;
};
};
[26] = {
["clones"] = {
[7] = {
["y"] = -157.60974069404;
["x"] = 349.01942633565;
["g"] = 74;
["sublevel"] = 1;
};
[1] = {
["sublevel"] = 1;
["x"] = 338.6933916311;
["infested"] = {
[2] = true;
};
["g"] = 60;
["y"] = -92.98872066061;
};
[2] = {
["y"] = -94.416826242829;
["x"] = 386.05215664521;
["g"] = 64;
["sublevel"] = 1;
};
[4] = {
["y"] = -111.22658749633;
["x"] = 403.53999687291;
["g"] = 65;
["sublevel"] = 1;
};
[8] = {
["y"] = -123.08563894226;
["x"] = 366.63087686854;
["g"] = 75;
["sublevel"] = 1;
};
[5] = {
["y"] = -154.86916077277;
["x"] = 397.47278205007;
["g"] = 68;
["sublevel"] = 1;
};
[3] = {
["y"] = -106.22658062928;
["x"] = 400.78138413119;
["g"] = 65;
["sublevel"] = 1;
};
[6] = {
["y"] = -168.07602044777;
["x"] = 375.50234780232;
["g"] = 72;
["sublevel"] = 1;
};
};
["scale"] = 0.8;
["spells"] = {
[277242] = {};
[268865] = {};
[268846] = {};
[277564] = {};
[209859] = {};
};
["id"] = 136934;
["health"] = 294320;
["count"] = 4;
["displayId"] = 84962;
["creatureType"] = "Humanoid";
["level"] = 120;
["name"] = "Weapons Tester";
["characteristics"] = {
["Taunt"] = true;
["Disorient"] = true;
["Sap"] = true;
["Root"] = true;
["Slow"] = true;
["Stun"] = true;
["Fear"] = true;
};
};
[30] = {
["clones"] = {
[6] = {
["y"] = -121.57230531622;
["x"] = 550.29518805671;
["sublevel"] = 1;
};
[2] = {
["y"] = -122.22200752438;
["x"] = 496.95625852331;
["g"] = 80;
["sublevel"] = 1;
};
[3] = {
["y"] = -113.58970168772;
["x"] = 558.3736973268;
["g"] = 82;
["sublevel"] = 1;
};
[1] = {
["sublevel"] = 1;
["x"] = 502.68530584216;
["infested"] = {
[2] = true;
};
["g"] = 79;
["y"] = -107.66784182933;
};
[4] = {
["sublevel"] = 1;
["x"] = 602.49991019652;
["y"] = -138.97133650933;
["g"] = 86;
["infested"] = {
[3] = true;
};
};
[5] = {
["y"] = -160.00768784213;
["x"] = 606.66641360611;
["g"] = 85;
["sublevel"] = 1;
};
};
["scale"] = 1;
["spells"] = {
[262540] = {};
[277564] = {};
[277242] = {};
[262554] = {};
};
["id"] = 133593;
["health"] = 294320;
["count"] = 5;
["displayId"] = 83034;
["creatureType"] = "Humanoid";
["level"] = 120;
["name"] = "Expert Technician";
["characteristics"] = {
["Taunt"] = true;
["Incapacitate"] = true;
["Disorient"] = true;
["Stun"] = true;
["Slow"] = true;
["Silence"] = true;
["Imprison"] = true;
};
};
[36] = {
["clones"] = {
[7] = {
["y"] = -303.97643978494;
["x"] = 456.33809052917;
["sublevel"] = 1;
};
[1] = {
["y"] = -349.0153562019;
["x"] = 452.76276992635;
["sublevel"] = 1;
};
[2] = {
["y"] = -332.18362000556;
["x"] = 463.47855634964;
["sublevel"] = 1;
};
[4] = {
["y"] = -317.60601667629;
["x"] = 489.9598137371;
["sublevel"] = 1;
};
[8] = {
["y"] = -322.74750956538;
["x"] = 409.13343855743;
["sublevel"] = 1;
};
[9] = {
["y"] = -338.91935176132;
["x"] = 424.26441507197;
["sublevel"] = 1;
};
[5] = {
["y"] = -306.7816622197;
["x"] = 480.33373232292;
["sublevel"] = 1;
};
[10] = {
["y"] = -337.70941677999;
["x"] = 440.31990437513;
["sublevel"] = 1;
};
[3] = {
["y"] = -342.42002021961;
["x"] = 484.79616675868;
["sublevel"] = 1;
};
[6] = {
["y"] = -300.0470909243;
["x"] = 464.44097692694;
["sublevel"] = 1;
};
[12] = {
["y"] = -337.97276073111;
["x"] = 451.21285447553;
["sublevel"] = 1;
};
[11] = {
["y"] = -413.23788809786;
["x"] = 470.52046478415;
["sublevel"] = 1;
};
};
["scale"] = 1.2;
["spells"] = {
[262412] = {};
[277564] = {};
[267367] = {};
[209859] = {};
[262066] = {};
[263628] = {};
};
["id"] = 130485;
["health"] = 470936;
["count"] = 12;
["displayId"] = 82943;
["creatureType"] = "Mechanical";
["level"] = 121;
["name"] = "Mechanized Peacekeeper";
["characteristics"] = {
["Taunt"] = true;
};
};
[37] = {
["clones"] = {
[2] = {
["y"] = -257.0565821558;
["x"] = 597.13880202998;
["g"] = 87;
["sublevel"] = 1;
};
[3] = {
["y"] = -253.62374605687;
["x"] = 602.06415022062;
["g"] = 87;
["sublevel"] = 1;
};
[1] = {
["y"] = -260.93717892805;
["x"] = 592.36265829;
["g"] = 87;
["sublevel"] = 1;
};
[4] = {
["y"] = -261.68344458181;
["x"] = 597.73577355924;
["g"] = 87;
["sublevel"] = 1;
};
[5] = {
["y"] = -258.39986417575;
["x"] = 602.21341872403;
["g"] = 87;
["sublevel"] = 1;
};
};
["scale"] = 1;
["health"] = 58867;
["count"] = 0;
["displayId"] = 85704;
["creatureType"] = "Humanoid";
["level"] = 120;
["id"] = 144286;
["name"] = "Asset Manager";
};
[35] = {
["clones"] = {
[27] = {
["y"] = -121.88478260767;
["x"] = 544.82644653611;
["teeming"] = true;
["sublevel"] = 1;
};
[2] = {
["y"] = -118.95296105033;
["x"] = 525.2051065873;
["sublevel"] = 1;
};
[38] = {
["y"] = -111.15608617306;
["x"] = 600.20831492994;
["teeming"] = true;
["sublevel"] = 1;
};
[3] = {
["y"] = -96.483800295248;
["x"] = 518.01036176257;
["sublevel"] = 1;
};
[54] = {
["y"] = -169.41067479229;
["x"] = 598.60672148644;
["teeming"] = true;
["sublevel"] = 1;
};
[4] = {
["y"] = -107.38158500302;
["x"] = 534.41653050984;
["sublevel"] = 1;
};
[5] = {
["y"] = -91.606328234521;
["x"] = 529.03708273502;
["sublevel"] = 1;
};
[6] = {
["y"] = -100.5006560559;
["x"] = 549.24948717915;
["sublevel"] = 1;
};
[7] = {
["y"] = -127.04978404908;
["x"] = 549.62471512875;
["sublevel"] = 1;
};
[8] = {
["y"] = -140.92006428613;
["x"] = 556.63460193472;
["sublevel"] = 1;
};
[10] = {
["y"] = -106.05627477129;
["x"] = 563.56908813178;
["g"] = 83;
["sublevel"] = 1;
};
[12] = {
["y"] = -107.99152043245;
["x"] = 591.85388397318;
["teeming"] = true;
["sublevel"] = 1;
};
[14] = {
["y"] = -135.01951743756;
["x"] = 604.86618540451;
["g"] = 86;
["sublevel"] = 1;
};
[16] = {
["y"] = -151.90464432582;
["x"] = 584.22776588243;
["g"] = 84;
["sublevel"] = 1;
};
[20] = {
["y"] = -115.80533111013;
["x"] = 509.80713301933;
["sublevel"] = 1;
["teeming"] = true;
};
[24] = {
["y"] = -125.28207080228;
["x"] = 535.58484788426;
["sublevel"] = 1;
["teeming"] = true;
};
[28] = {
["y"] = -133.34091628591;
["x"] = 554.8770274508;
["teeming"] = true;
["sublevel"] = 1;
};
[32] = {
["y"] = -120.04592027901;
["x"] = 565.77933429885;
["teeming"] = true;
["sublevel"] = 1;
};
[40] = {
["y"] = -131.62350528358;
["x"] = 595.29813567361;
["teeming"] = true;
["sublevel"] = 1;
};
[48] = {
["y"] = -154.18679268376;
["x"] = 604.27836095194;
["teeming"] = true;
["sublevel"] = 1;
};
[33] = {
["y"] = -99.173610444957;
["x"] = 556.01992984082;
["teeming"] = true;
["sublevel"] = 1;
};
[41] = {
["y"] = -142.33604101177;
["x"] = 596.52717017579;
["teeming"] = true;
["sublevel"] = 1;
};
[49] = {
["y"] = -159.41067147595;
["x"] = 597.86046864322;
["teeming"] = true;
["sublevel"] = 1;
};
[17] = {
["y"] = -137.84301532828;
["x"] = 581.15178658182;
["sublevel"] = 1;
};
[21] = {
["y"] = -107.33546284624;
["x"] = 513.83208429377;
["sublevel"] = 1;
["teeming"] = true;
};
[25] = {
["y"] = -115.97993013796;
["x"] = 541.40060177078;
["sublevel"] = 1;
["teeming"] = true;
};
[29] = {
["y"] = -127.67563974225;
["x"] = 563.16808646352;
["teeming"] = true;
["sublevel"] = 1;
};
[34] = {
["y"] = -104.56835013666;
["x"] = 554.70415702555;
["teeming"] = true;
["sublevel"] = 1;
};
[42] = {
["y"] = -140.40398789756;
["x"] = 591.76156671819;
["teeming"] = true;
["sublevel"] = 1;
};
[50] = {
["y"] = -152.9927599514;
["x"] = 612.63657726789;
["teeming"] = true;
["sublevel"] = 1;
};
[31] = {
["y"] = -101.56834191083;
["x"] = 562.16665302173;
["teeming"] = true;
["g"] = 83;
["sublevel"] = 1;
};
[35] = {
["y"] = -94.253148660481;
["x"] = 548.47635582227;
["teeming"] = true;
["sublevel"] = 1;
};
[11] = {
["y"] = -106.38411980599;
["x"] = 576.68383225024;
["teeming"] = true;
["sublevel"] = 1;
};
[13] = {
["y"] = -125.16008960038;
["x"] = 594.5664396924;
["sublevel"] = 1;
};
[15] = {
["y"] = -126.05401492818;
["x"] = 608.83169584523;
["sublevel"] = 1;
};
[18] = {
["y"] = -146.71115472387;
["x"] = 606.88765938666;
["sublevel"] = 1;
};
[22] = {
["y"] = -94.548304939461;
["x"] = 506.47917628214;
["sublevel"] = 1;
["teeming"] = true;
};
[26] = {
["y"] = -98.666493950436;
["x"] = 540.80359180988;
["sublevel"] = 1;
["teeming"] = true;
};
[30] = {
["y"] = -111.16442897852;
["x"] = 571.86393774025;
["teeming"] = true;
["g"] = 83;
["sublevel"] = 1;
};
[36] = {
["y"] = -106.29985863928;
["x"] = 582.18172379917;
["sublevel"] = 1;
};
[44] = {
["y"] = -126.25765561352;
["x"] = 577.50961307488;
["teeming"] = true;
["sublevel"] = 1;
};
[52] = {
["y"] = -168.51515344566;
["x"] = 619.05448238716;
["teeming"] = true;
["sublevel"] = 1;
};
[51] = {
["y"] = -158.06738305073;
["x"] = 620.09924661611;
["teeming"] = true;
["sublevel"] = 1;
};
[47] = {
["y"] = -137.23326280618;
["x"] = 573.36326955603;
["teeming"] = true;
["sublevel"] = 1;
};
[46] = {
["y"] = -124.55033707827;
["x"] = 585.31447836842;
["teeming"] = true;
["sublevel"] = 1;
};
[39] = {
["y"] = -118.78321712905;
["x"] = 605.8443155563;
["teeming"] = true;
["sublevel"] = 1;
};
[43] = {
["y"] = -142.96496046685;
["x"] = 583.34691639408;
["teeming"] = true;
["sublevel"] = 1;
};
[37] = {
["y"] = -109.51050590374;
["x"] = 596.53743518509;
["sublevel"] = 1;
};
[45] = {
["y"] = -131.37961121924;
["x"] = 578.97302597162;
["teeming"] = true;
["sublevel"] = 1;
};
[53] = {
["y"] = -174.63454717921;
["x"] = 610.24852461372;
["teeming"] = true;
["sublevel"] = 1;
};
[1] = {
["y"] = -108.78406381848;
["x"] = 524.82558464553;
["g"] = 81;
["sublevel"] = 1;
};
[19] = {
["y"] = -155.25615121062;
["x"] = 592.88160026492;
["sublevel"] = 1;
};
[23] = {
["y"] = -100.91005338954;
["x"] = 527.13681712595;
["teeming"] = true;
["sublevel"] = 1;
};
[9] = {
["y"] = -157.62893163199;
["x"] = 570.05231417427;
["sublevel"] = 1;
};
};
["scale"] = 0.7;
["spells"] = {
[277564] = {};
[262348] = {};
[262377] = {};
[277242] = {};
};
["characteristics"] = {
["Root"] = true;
["Slow"] = true;
};
["health"] = 29014;
["count"] = 1;
["displayId"] = 49134;
["creatureType"] = "Mechanical";
["level"] = 121;
["name"] = "Crawler Mine";
["id"] = 133482;
};
[1] = {
["clones"] = {
[6] = {
["y"] = -485.00011197057;
["x"] = 497.82152711282;
["sublevel"] = 1;
};
[2] = {
["y"] = -478.87108043154;
["x"] = 447.58139077397;
["sublevel"] = 1;
};
[3] = {
["y"] = -466.85963499295;
["x"] = 453.97559275342;
["infested"] = {
[1] = true;
};
["sublevel"] = 1;
};
[1] = {
["y"] = -478.2259243172;
["x"] = 425.40178176878;
["infested"] = {
[1] = true;
[3] = true;
};
["sublevel"] = 1;
};
[4] = {
["y"] = -483.07467635869;
["x"] = 473.37653395575;
["sublevel"] = 1;
};
[5] = {
["y"] = -488.23596680439;
["x"] = 487.57010690783;
["sublevel"] = 1;
};
};
["scale"] = 0.7;
["spells"] = {
[277242] = {};
[270866] = {};
};
["id"] = 137713;
["health"] = 58864;
["count"] = 1;
["displayId"] = 32024;
["creatureType"] = "Beast";
["level"] = 120;
["name"] = "Big Money Crab";
["characteristics"] = {
["Taunt"] = true;
["Incapacitate"] = true;
["Sap"] = true;
["Stun"] = true;
["Slow"] = true;
["Root"] = true;
};
};
[19] = {
["clones"] = {
[1] = {
["sublevel"] = 1;
["x"] = 273.66423133224;
["patrol"] = {
[1] = {
["y"] = -216.8749518169;
["x"] = 273.66423133224;
};
[2] = {
["y"] = -210.95390638714;
["x"] = 268.00634159488;
};
[4] = {
["y"] = -222.53284720101;
["x"] = 279.71686307833;
};
[3] = {
["y"] = -216.8749518169;
["x"] = 273.66423133224;
};
};
["infested"] = {
[2] = true;
};
["y"] = -216.8749518169;
};
[2] = {
["sublevel"] = 1;
["x"] = 260.29190043111;
["infested"] = {
[3] = true;
};
["g"] = 57;
["y"] = -203.14913954218;
};
[3] = {
["y"] = -192.84441003172;
["x"] = 252.68472623618;
["g"] = 57;
["sublevel"] = 1;
};
};
["scale"] = 1;
["spells"] = {
[277242] = {};
[268704] = {};
[209859] = {};
[268702] = {};
[263215] = {};
[277564] = {};
};
["id"] = 130635;
["name"] = "Stonefury";
["health"] = 294320;
["displayId"] = 83052;
["creatureType"] = "Elemental";
["level"] = 120;
["count"] = 4;
["characteristics"] = {
["Taunt"] = true;
["Incapacitate"] = true;
["Root"] = true;
["Banish"] = true;
["Disorient"] = true;
["Stun"] = true;
["Slow"] = true;
["Silence"] = true;
["Fear"] = true;
};
};
[23] = {
["clones"] = {
[1] = {
["y"] = -104.75213306346;
["x"] = 308.8830745492;
["g"] = 59;
["sublevel"] = 1;
};
[2] = {
["y"] = -112.39530952304;
["x"] = 324.06870177232;
["g"] = 59;
["sublevel"] = 1;
};
[4] = {
["y"] = -101.32388553799;
["x"] = 327.64014765209;
["g"] = 59;
["sublevel"] = 1;
};
[8] = {
["y"] = -95.320277734951;
["x"] = 321.68027362333;
["g"] = 59;
["sublevel"] = 1;
};
[16] = {
["y"] = -101.76763454952;
["x"] = 322.60133831039;
["g"] = 59;
["sublevel"] = 1;
};
[17] = {
["y"] = -105.32026745413;
["x"] = 321.94343496249;
["g"] = 59;
["sublevel"] = 1;
};
[9] = {
["y"] = -97.557109590522;
["x"] = 317.60132933391;
["g"] = 59;
["sublevel"] = 1;
};
[5] = {
["y"] = -98.823882618294;
["x"] = 328.35441230499;
["g"] = 59;
["sublevel"] = 1;
};
[10] = {
["y"] = -99.793958386356;
["x"] = 314.57501910762;
["g"] = 59;
["sublevel"] = 1;
};
[11] = {
["y"] = -99.004480015633;
["x"] = 320.89080089936;
["g"] = 59;
["sublevel"] = 1;
};
[3] = {
["y"] = -105.25247907113;
["x"] = 326.92585234537;
["g"] = 59;
["sublevel"] = 1;
};
[6] = {
["y"] = -96.767636866554;
["x"] = 314.83818044678;
["g"] = 59;
["sublevel"] = 1;
};
[12] = {
["y"] = -101.89922086586;
["x"] = 309.70660209423;
["g"] = 59;
["sublevel"] = 1;
};
[13] = {
["y"] = -107.42552993363;
["x"] = 310.36449414862;
["g"] = 59;
["sublevel"] = 1;
};
[7] = {
["y"] = -94.267649318578;
["x"] = 317.73291000349;
["g"] = 59;
["sublevel"] = 1;
};
[14] = {
["y"] = -108.87289471199;
["x"] = 312.73292361403;
["g"] = 59;
["sublevel"] = 1;
};
[15] = {
["y"] = -100.05711972551;
["x"] = 317.46974866433;
["g"] = 59;
["sublevel"] = 1;
};
};
["scale"] = 0.6;
["spells"] = {
[271784] = {};
};
["health"] = 58864;
["count"] = 0;
["displayId"] = 85829;
["creatureType"] = "Humanoid";
["level"] = 120;
["id"] = 138369;
["name"] = "Footbomb Hooligan";
};
[31] = {
["clones"] = {
[6] = {
["y"] = -165.32110385425;
["x"] = 610.70629446065;
["g"] = 85;
["sublevel"] = 1;
};
[2] = {
["y"] = -128.99618133409;
["x"] = 501.79495014634;
["g"] = 80;
["sublevel"] = 1;
};
[3] = {
["y"] = -116.09386714438;
["x"] = 591.63697586743;
["patrol"] = {
[1] = {
["y"] = -116.09386714438;
["x"] = 591.63697586743;
};
[2] = {
["y"] = -108.63118498562;
["x"] = 586.26383497711;
};
[4] = {
["y"] = -125.49684768927;
["x"] = 598.20413667957;
};
[3] = {
["y"] = -116.09386714438;
["x"] = 591.63697586743;
};
};
["sublevel"] = 1;
};
[1] = {
["sublevel"] = 1;
["x"] = 507.03313398718;
["infested"] = {
[3] = true;
};
["g"] = 79;
["y"] = -104.40698471469;
};
[4] = {
["sublevel"] = 1;
["x"] = 574.2169183565;
["patrol"] = {
[1] = {
["y"] = -126.52056756911;
["x"] = 576.08848904957;
};
[2] = {
["y"] = -113.72897735969;
["x"] = 570.14284059589;
};
[4] = {
["y"] = -145.2302194779;
["x"] = 584.15297508797;
};
[3] = {
["y"] = -126.52056756911;
["x"] = 576.08848904957;
};
};
["y"] = -119.0625439491;
["infested"] = {
[3] = true;
};
};
[5] = {
["y"] = -149.69133509057;
["x"] = 564.63620385762;
["patrol"] = {
[1] = {
["y"] = -149.69133509057;
["x"] = 564.63620385762;
};
[2] = {
["y"] = -140.28280291519;
["x"] = 557.72836194741;
};
[4] = {
["y"] = -157.17932630602;
["x"] = 570.6594044943;
};
[3] = {
["y"] = -149.69133509057;
["x"] = 564.63620385762;
};
};
["sublevel"] = 1;
};
};
["id"] = 133463;
["spells"] = {
[269099] = {};
[277564] = {};
[262383] = {};
[269100] = {};
[269429] = {};
};
["stealthDetect"] = true;
["characteristics"] = {
["Taunt"] = true;
};
["scale"] = 1.3;
["health"] = 470912;
["displayId"] = 83391;
["creatureType"] = "Mechanical";
["level"] = 121;
["name"] = "Venture Co. War Machine";
["count"] = 8;
};
};
|
while true do
local x = io.read()
local s = assert(tonumber(x),"is not a number")
print(s)
end |
local pathwatcher = require "hs.pathwatcher"
local alert = require "hs.alert"
function autoReload()
-- https://www.hammerspoon.org/go/#fancyreload
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
pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon", reloadConfig):start()
alert.show("Hammerspoon Config Reloaded")
end
spoons_list = {"Archer", "Wind", "Bitwarden"}
for _, v in pairs(spoons_list) do
hs.loadSpoon(v)
end
autoReload()
|
local modules = (...):gsub('%.[^%.]+$', '') .. '.'
local base_node = require(modules .. 'base_node')
local lovg = love.graphics
local image = base_node:extend('image')
function image:constructor()
image.super.constructor(self)
self.image_w, self.image_h = self.image:getDimensions()
self.keep_aspect_ratio = true
end
function image:draw()
if self.image then
local _, fgc = self:getLayerColors()
lovg.setColor(1, 1, 1, 1)
local sx, sy
local x = self.x
local y = self.y
sx = (self.w - 1) / self.image_w
sy = (self.h - 1) / self.image_h
if self.keep_aspect_ratio then
sx = math.min(sx, sy)
sy = sx
x = x + (self.w - (self.image_w * sx)) / 2
y = y + (self.h - (self.image_h * sy)) / 2
end
lovg.draw(self.image, x, y, 0, sx, sy)
end
end
return image |
local StateMachine = {}
function StateMachine:new()
local sm = {}
setmetatable(sm, self)
self.__index = self
return sm
end
StateMachine.VERSION = "2.2.0"
-- the event transitioned successfully from one state to another
StateMachine.SUCCEEDED = 1
-- the event was successfull but no state transition was necessary
StateMachine.NOTRANSITION = 2
-- the event was cancelled by the caller in a beforeEvent callback
StateMachine.CANCELLED = 3
-- the event is asynchronous and the caller is in control of when the transition occurs
StateMachine.PENDING = 4
-- the event was failure
StateMachine.FAILURE = 5
-- caller tried to fire an event that was innapropriate in the current state
StateMachine.INVALID_TRANSITION_ERROR = "INVALID_TRANSITION_ERROR"
-- caller tried to fire an event while an async transition was still pending
StateMachine.PENDING_TRANSITION_ERROR = "PENDING_TRANSITION_ERROR"
-- caller provided callback function threw an exception
StateMachine.INVALID_CALLBACK_ERROR = "INVALID_CALLBACK_ERROR"
StateMachine.WILDCARD = "*"
StateMachine.ASYNC = "ASYNC"
-- function StateMachine:ctor()
-- end
function StateMachine:setupState(cfg)
assert(type(cfg) == "table", "StateMachine:ctor() - invalid config")
-- cfg.initial allow for a simple string,
-- or an table with { state = "foo", event = "setup", defer = true|false }
if type(cfg.initial) == "string" then
self.initial_ = {state = cfg.initial}
else
self.initial_ = clone(cfg.initial)
end
self.terminal_ = cfg.terminal or cfg.final
self.events_ = cfg.events or {}
self.callbacks_ = cfg.callbacks or {}
self.map_ = {}
self.current_ = "none"
self.inTransition_ = false
if self.initial_ then
self.initial_.event = self.initial_.event or "startup"
self:addEvent_({name = self.initial_.event, from = "none", to = self.initial_.state})
end
for _, event in ipairs(self.events_) do
self:addEvent_(event)
end
if self.initial_ and not self.initial_.defer then
self:doEvent(self.initial_.event)
end
return self.target_
end
function StateMachine:isReady()
return self.current_ ~= "none"
end
function StateMachine:getState()
return self.current_
end
function StateMachine:isState(state)
if type(state) == "table" then
for _, s in ipairs(state) do
if s == self.current_ then return true end
end
return false
else
return self.current_ == state
end
end
function StateMachine:canDoEvent(eventName)
return not self.inTransition_
and (self.map_[eventName][self.current_] ~= nil or self.map_[eventName][StateMachine.WILDCARD]~=nil)
end
function StateMachine:cannotDoEvent(eventName)
return not self:canDoEvent(eventName)
end
function StateMachine:isFinishedState()
return self:isState(self.terminal_)
end
function StateMachine:doEventForce(name, ...)
local from = self.current_
local map = self.map_[name]
local to = (map[from] or map[StateMachine.WILDCARD]) or from
local args = {...}
local event = {
name = name,
from = from,
to = to,
args = args,
}
if self.inTransition_ then self.inTransition_ = false end
self:beforeEvent_(event)
if from == to then
self:afterEvent_(event)
return StateMachine.NOTRANSITION
end
self.current_ = to
self:enterState_(event)
self:changeState_(event)
self:afterEvent_(event)
return StateMachine.SUCCEEDED
end
function StateMachine:doEvent(name, ...)
assert(self.map_[name] ~= nil, string.format("StateMachine:doEvent() - invalid event %s", tostring(name)))
local from = self.current_
local map = self.map_[name]
local to = (map[from] or map[StateMachine.WILDCARD]) or from
local args = {...}
local event = {
name = name,
from = from,
to = to,
args = args,
}
if self.inTransition_ then
self:onError_(event, StateMachine.PENDING_TRANSITION_ERROR,
"event " .. name .. " inappropriate because previous transition did not complete")
return StateMachine.FAILURE
end
if self:cannotDoEvent(name) then
self:onError_(event, StateMachine.INVALID_TRANSITION_ERROR,
"event " .. name .. " inappropriate in current state " .. self.current_)
return StateMachine.FAILURE
end
if self:beforeEvent_(event) == false then
return StateMachine.CANCELLED
end
if from == to then
self:afterEvent_(event)
return StateMachine.NOTRANSITION
end
event.transition = function()
self.inTransition_ = false
self.current_ = to -- this method should only ever be called once
self:enterState_(event)
self:changeState_(event)
self:afterEvent_(event)
return StateMachine.SUCCEEDED
end
event.cancel = function()
-- provide a way for caller to cancel async transition if desired
event.transition = nil
self:afterEvent_(event)
end
self.inTransition_ = true
local leave = self:leaveState_(event)
if leave == false then
event.transition = nil
event.cancel = nil
self.inTransition_ = false
return StateMachine.CANCELLED
elseif string.upper(tostring(leave)) == StateMachine.ASYNC then
return StateMachine.PENDING
else
-- need to check in case user manually called transition()
-- but forgot to return StateMachine.ASYNC
if event.transition then
return event.transition()
else
self.inTransition_ = false
end
end
end
function StateMachine:addEvent_(event)
local from = {}
if type(event.from) == "table" then
for _, name in ipairs(event.from) do
from[name] = true
end
elseif event.from then
from[event.from] = true
else
-- allow "wildcard" transition if "from" is not specified
from[StateMachine.WILDCARD] = true
end
self.map_[event.name] = self.map_[event.name] or {}
local map = self.map_[event.name]
for fromName, _ in pairs(from) do
map[fromName] = event.to or fromName
end
end
local function doCallback_(callback, event)
if callback then return callback(event) end
end
function StateMachine:beforeAnyEvent_(event)
return doCallback_(self.callbacks_["onbeforeevent"], event)
end
function StateMachine:afterAnyEvent_(event)
return doCallback_(self.callbacks_["onafterevent"], event)
end
function StateMachine:leaveAnyState_(event)
return doCallback_(self.callbacks_["onleavestate"], event)
end
function StateMachine:enterAnyState_(event)
return doCallback_(self.callbacks_["onenterstate"] or self.callbacks_["onstate"], event)
end
function StateMachine:changeState_(event)
return doCallback_(self.callbacks_["onchangestate"], event)
end
function StateMachine:beforeThisEvent_(event)
return doCallback_(self.callbacks_["onbefore" .. event.name], event)
end
function StateMachine:afterThisEvent_(event)
return doCallback_(self.callbacks_["onafter" .. event.name] or self.callbacks_["on" .. event.name], event)
end
function StateMachine:leaveThisState_(event)
return doCallback_(self.callbacks_["onleave" .. event.from], event)
end
function StateMachine:enterThisState_(event)
return doCallback_(self.callbacks_["onenter" .. event.to] or self.callbacks_["on" .. event.to], event)
end
function StateMachine:beforeEvent_(event)
if self:beforeThisEvent_(event) == false or self:beforeAnyEvent_(event) == false then
return false
end
end
function StateMachine:afterEvent_(event)
self:afterThisEvent_(event)
self:afterAnyEvent_(event)
end
function StateMachine:leaveState_(event, transition)
local specific = self:leaveThisState_(event, transition)
local general = self:leaveAnyState_(event, transition)
if specific == false or general == false then
return false
elseif string.upper(tostring(specific)) == StateMachine.ASYNC
or string.upper(tostring(general)) == StateMachine.ASYNC then
return StateMachine.ASYNC
end
end
function StateMachine:enterState_(event)
self:enterThisState_(event)
self:enterAnyState_(event)
end
function StateMachine:onError_(event, error, message)
-- printf("%s [StateMachine] ERROR: error %s, event %s, from %s to %s", tostring(self.target_), tostring(error), event.name, event.from, event.to)
-- printError(message)
end
if false then
local fsmState_ = {
initial = {state = "normal", event = "enable", defer = false},
events = {
{name = "disable", from = {"normal", "pressed"}, to = "disabled"},
{name = "enable", from = {"disabled"}, to = "normal"},
{name = "press", from = "normal", to = "pressed"},
{name = "release", from = "pressed", to = "normal"},
},
callbacks = {
onchangestate = function( ... )
for k,v in pairs(...) do
print(k)
print(v)
end
print("-----------------------------")
end
}
}
local fsm = StateMachine:new()
fsm:setupState(fsmState_)
fsm:doEvent("disable")
end
return StateMachine |
object_tangible_loot_generic_usable_poison_grenade_generic = object_tangible_loot_generic_usable_shared_poison_grenade_generic:new {
}
ObjectTemplates:addTemplate(object_tangible_loot_generic_usable_poison_grenade_generic, "object/tangible/loot/generic/usable/poison_grenade_generic.iff")
|
ui.style = {}
ui.style.list = {}
function ui.style.check(name)
return ui.style.list[name]
end
function ui.style.new(name, properties)
if not ui.style.check(name) then
ui.style.list[name] = properties
ui.funcs.info("\""..name.."\" style is created.")
else
ui.funcs.error(name.." style exists already. Do not create the same style more than once!")
end
end
function ui.style.remove(name)
if not ui.style.check(name) then
ui.funcs.error("Style couldn't be found.")
else
ui.stlye.list[name] = nil
ui.funcs.info("\""..name.."\" style is removed.")
end
end
function ui.style.getProperties(name)
if type(name) == "table" then
return name
end
if ui.style.check(name) then
return ui.style.check(name)
else
ui.funcs.error("Style \""..tostring(name).."\" couldn't be found.")
return {}
end
end
function ui.style.setProperty(name, property, val)
if ui.style.check(name) then
ui.style.list[name][property] = val
for k, v in pairs(ui.user.getObjects()) do
for a, b in pairs(v) do
for c, d in pairs(b) do
if d.style and d.style == name then
d.update()
end
end
end
end
else
ui.funcs.error("Style \""..tostring(name).."\" couldn't be found.")
end
end |
if not modules then modules = { } end modules ['font-otb'] = {
version = 1.001,
comment = "companion to font-ini.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
}
local concat = table.concat
local format, gmatch, gsub, find, match, lower, strip = string.format, string.gmatch, string.gsub, string.find, string.match, string.lower, string.strip
local type, next, tonumber, tostring, rawget = type, next, tonumber, tostring, rawget
local trace_baseinit = false trackers.register("otf.baseinit", function(v) trace_baseinit = v end)
local trace_singles = false trackers.register("otf.singles", function(v) trace_singles = v end)
local trace_multiples = false trackers.register("otf.multiples", function(v) trace_multiples = v end)
local trace_alternatives = false trackers.register("otf.alternatives", function(v) trace_alternatives = v end)
local trace_ligatures = false trackers.register("otf.ligatures", function(v) trace_ligatures = v end)
local trace_ligatures_detail = false trackers.register("otf.ligatures.detail", function(v) trace_ligatures_detail = v end)
local trace_kerns = false trackers.register("otf.kerns", function(v) trace_kerns = v end)
local trace_preparing = false trackers.register("otf.preparing", function(v) trace_preparing = v end)
local report_prepare = logs.reporter("fonts","otf prepare")
local fonts = fonts
local otf = fonts.handlers.otf
local otffeatures = otf.features
local registerotffeature = otffeatures.register
otf.defaultbasealternate = "none" -- first last
local wildcard = "*"
local default = "dflt"
local formatters = string.formatters
local f_unicode = formatters["%U"]
local f_uniname = formatters["%U (%s)"]
local f_unilist = formatters["% t (% t)"]
local function gref(descriptions,n)
if type(n) == "number" then
local name = descriptions[n].name
if name then
return f_uniname(n,name)
else
return f_unicode(n)
end
elseif n then
local num, nam, j = { }, { }, 0
for i=1,#n do
local ni = n[i]
if tonumber(ni) then -- first is likely a key
j = j + 1
local di = descriptions[ni]
num[j] = f_unicode(ni)
nam[j] = di and di.name or "-"
end
end
return f_unilist(num,nam)
else
return "<error in base mode tracing>"
end
end
local function cref(feature,lookuptags,lookupname)
if lookupname then
return formatters["feature %a, lookup %a"](feature,lookuptags[lookupname])
else
return formatters["feature %a"](feature)
end
end
local function report_alternate(feature,lookuptags,lookupname,descriptions,unicode,replacement,value,comment)
report_prepare("%s: base alternate %s => %s (%S => %S)",
cref(feature,lookuptags,lookupname),
gref(descriptions,unicode),
replacement and gref(descriptions,replacement),
value,
comment)
end
local function report_substitution(feature,lookuptags,lookupname,descriptions,unicode,substitution)
report_prepare("%s: base substitution %s => %S",
cref(feature,lookuptags,lookupname),
gref(descriptions,unicode),
gref(descriptions,substitution))
end
local function report_ligature(feature,lookuptags,lookupname,descriptions,unicode,ligature)
report_prepare("%s: base ligature %s => %S",
cref(feature,lookuptags,lookupname),
gref(descriptions,ligature),
gref(descriptions,unicode))
end
local function report_kern(feature,lookuptags,lookupname,descriptions,unicode,otherunicode,value)
report_prepare("%s: base kern %s + %s => %S",
cref(feature,lookuptags,lookupname),
gref(descriptions,unicode),
gref(descriptions,otherunicode),
value)
end
local basemethods = { }
local basemethod = "<unset>"
local function applybasemethod(what,...)
local m = basemethods[basemethod][what]
if m then
return m(...)
end
end
-- We need to make sure that luatex sees the difference between
-- base fonts that have different glyphs in the same slots in fonts
-- that have the same fullname (or filename). LuaTeX will merge fonts
-- eventually (and subset later on). If needed we can use a more
-- verbose name as long as we don't use <()<>[]{}/%> and the length
-- is < 128.
local basehash, basehashes, applied = { }, 1, { }
local function registerbasehash(tfmdata)
local properties = tfmdata.properties
local hash = concat(applied," ")
local base = basehash[hash]
if not base then
basehashes = basehashes + 1
base = basehashes
basehash[hash] = base
end
properties.basehash = base
properties.fullname = properties.fullname .. "-" .. base
-- report_prepare("fullname base hash '%a, featureset %a",tfmdata.properties.fullname,hash)
applied = { }
end
local function registerbasefeature(feature,value)
applied[#applied+1] = feature .. "=" .. tostring(value)
end
-- The original basemode ligature builder used the names of components
-- and did some expression juggling to get the chain right. The current
-- variant starts with unicodes but still uses names to make the chain.
-- This is needed because we have to create intermediates when needed
-- but use predefined snippets when available. To some extend the
-- current builder is more stupid but I don't worry that much about it
-- as ligatures are rather predicatable.
--
-- Personally I think that an ff + i == ffi rule as used in for instance
-- latin modern is pretty weird as no sane person will key that in and
-- expect a glyph for that ligature plus the following character. Anyhow,
-- as we need to deal with this, we do, but no guarantes are given.
--
-- latin modern dejavu
--
-- f+f 102 102 102 102
-- f+i 102 105 102 105
-- f+l 102 108 102 108
-- f+f+i 102 102 105
-- f+f+l 102 102 108 102 102 108
-- ff+i 64256 105 64256 105
-- ff+l 64256 108
--
-- As you can see here, latin modern is less complete than dejavu but
-- in practice one will not notice it.
--
-- The while loop is needed because we need to resolve for instance
-- pseudo names like hyphen_hyphen to endash so in practice we end
-- up with a bit too many definitions but the overhead is neglectable.
--
-- We can have changed[first] or changed[second] but it quickly becomes
-- messy if we need to take that into account.
local trace = false
local function finalize_ligatures(tfmdata,ligatures)
local nofligatures = #ligatures
if nofligatures > 0 then
local characters = tfmdata.characters
local descriptions = tfmdata.descriptions
local resources = tfmdata.resources
local unicodes = resources.unicodes -- we use rawget in order to avoid bulding the table
local private = resources.private
local alldone = false
while not alldone do
local done = 0
for i=1,nofligatures do
local ligature = ligatures[i]
if ligature then
local unicode, lookupdata = ligature[1], ligature[2]
if trace_ligatures_detail then
report_prepare("building % a into %a",lookupdata,unicode)
end
local size = #lookupdata
local firstcode = lookupdata[1] -- [2]
local firstdata = characters[firstcode]
local okay = false
if firstdata then
local firstname = "ctx_" .. firstcode
for i=1,size-1 do -- for i=2,size-1 do
local firstdata = characters[firstcode]
if not firstdata then
firstcode = private
if trace_ligatures_detail then
report_prepare("defining %a as %a",firstname,firstcode)
end
unicodes[firstname] = firstcode
firstdata = { intermediate = true, ligatures = { } }
characters[firstcode] = firstdata
descriptions[firstcode] = { name = firstname }
private = private + 1
end
local target
local secondcode = lookupdata[i+1]
local secondname = firstname .. "_" .. secondcode
if i == size - 1 then
target = unicode
if not rawget(unicodes,secondname) then
unicodes[secondname] = unicode -- map final ligature onto intermediates
end
okay = true
else
target = rawget(unicodes,secondname)
if not target then
break
end
end
if trace_ligatures_detail then
report_prepare("codes (%a,%a) + (%a,%a) -> %a",firstname,firstcode,secondname,secondcode,target)
end
local firstligs = firstdata.ligatures
if firstligs then
firstligs[secondcode] = { char = target }
else
firstdata.ligatures = { [secondcode] = { char = target } }
end
firstcode = target
firstname = secondname
end
elseif trace_ligatures_detail then
report_prepare("no glyph (%a,%a) for building %a",firstname,firstcode,target)
end
if okay then
ligatures[i] = false
done = done + 1
end
end
end
alldone = done == 0
end
if trace_ligatures_detail then
for k, v in table.sortedhash(characters) do
if v.ligatures then
table.print(v,k)
end
end
end
resources.private = private
return true
end
end
local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplist)
local characters = tfmdata.characters
local descriptions = tfmdata.descriptions
local resources = tfmdata.resources
local properties = tfmdata.properties
local changed = tfmdata.changed
local lookuphash = resources.lookuphash
local lookuptypes = resources.lookuptypes
local lookuptags = resources.lookuptags
local ligatures = { }
local alternate = tonumber(value) or true and 1
local defaultalt = otf.defaultbasealternate
local trace_singles = trace_baseinit and trace_singles
local trace_alternatives = trace_baseinit and trace_alternatives
local trace_ligatures = trace_baseinit and trace_ligatures
local actions = {
substitution = function(lookupdata,lookuptags,lookupname,description,unicode)
if trace_singles then
report_substitution(feature,lookuptags,lookupname,descriptions,unicode,lookupdata)
end
changed[unicode] = lookupdata
end,
alternate = function(lookupdata,lookuptags,lookupname,description,unicode)
local replacement = lookupdata[alternate]
if replacement then
changed[unicode] = replacement
if trace_alternatives then
report_alternate(feature,lookuptags,lookupname,descriptions,unicode,replacement,value,"normal")
end
elseif defaultalt == "first" then
replacement = lookupdata[1]
changed[unicode] = replacement
if trace_alternatives then
report_alternate(feature,lookuptags,lookupname,descriptions,unicode,replacement,value,defaultalt)
end
elseif defaultalt == "last" then
replacement = lookupdata[#data]
if trace_alternatives then
report_alternate(feature,lookuptags,lookupname,descriptions,unicode,replacement,value,defaultalt)
end
else
if trace_alternatives then
report_alternate(feature,lookuptags,lookupname,descriptions,unicode,replacement,value,"unknown")
end
end
end,
ligature = function(lookupdata,lookuptags,lookupname,description,unicode)
if trace_ligatures then
report_ligature(feature,lookuptags,lookupname,descriptions,unicode,lookupdata)
end
ligatures[#ligatures+1] = { unicode, lookupdata }
end,
}
for unicode, character in next, characters do
local description = descriptions[unicode]
local lookups = description.slookups
if lookups then
for l=1,#lookuplist do
local lookupname = lookuplist[l]
local lookupdata = lookups[lookupname]
if lookupdata then
local lookuptype = lookuptypes[lookupname]
local action = actions[lookuptype]
if action then
action(lookupdata,lookuptags,lookupname,description,unicode)
end
end
end
end
local lookups = description.mlookups
if lookups then
for l=1,#lookuplist do
local lookupname = lookuplist[l]
local lookuplist = lookups[lookupname]
if lookuplist then
local lookuptype = lookuptypes[lookupname]
local action = actions[lookuptype]
if action then
for i=1,#lookuplist do
action(lookuplist[i],lookuptags,lookupname,description,unicode)
end
end
end
end
end
end
properties.hasligatures = finalize_ligatures(tfmdata,ligatures)
end
local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist) -- todo what kind of kerns, currently all
local characters = tfmdata.characters
local descriptions = tfmdata.descriptions
local resources = tfmdata.resources
local properties = tfmdata.properties
local lookuptags = resources.lookuptags
local sharedkerns = { }
local traceindeed = trace_baseinit and trace_kerns
local haskerns = false
for unicode, character in next, characters do
local description = descriptions[unicode]
local rawkerns = description.kerns -- shared
if rawkerns then
local s = sharedkerns[rawkerns]
if s == false then
-- skip
elseif s then
character.kerns = s
else
local newkerns = character.kerns
local done = false
for l=1,#lookuplist do
local lookup = lookuplist[l]
local kerns = rawkerns[lookup]
if kerns then
for otherunicode, value in next, kerns do
if value == 0 then
-- maybe no 0 test here
elseif not newkerns then
newkerns = { [otherunicode] = value }
done = true
if traceindeed then
report_kern(feature,lookuptags,lookup,descriptions,unicode,otherunicode,value)
end
elseif not newkerns[otherunicode] then -- first wins
newkerns[otherunicode] = value
done = true
if traceindeed then
report_kern(feature,lookuptags,lookup,descriptions,unicode,otherunicode,value)
end
end
end
end
end
if done then
sharedkerns[rawkerns] = newkerns
character.kerns = newkerns -- no empty assignments
haskerns = true
else
sharedkerns[rawkerns] = false
end
end
end
end
properties.haskerns = haskerns
end
basemethods.independent = {
preparesubstitutions = preparesubstitutions,
preparepositionings = preparepositionings,
}
local function makefake(tfmdata,name,present)
local resources = tfmdata.resources
local private = resources.private
local character = { intermediate = true, ligatures = { } }
resources.unicodes[name] = private
tfmdata.characters[private] = character
tfmdata.descriptions[private] = { name = name }
resources.private = private + 1
present[name] = private
return character
end
local function make_1(present,tree,name)
for k, v in next, tree do
if k == "ligature" then
present[name] = v
else
make_1(present,v,name .. "_" .. k)
end
end
end
local function make_2(present,tfmdata,characters,tree,name,preceding,unicode,done,lookuptags,lookupname)
for k, v in next, tree do
if k == "ligature" then
local character = characters[preceding]
if not character then
if trace_baseinit then
report_prepare("weird ligature in lookup %a, current %C, preceding %C",lookuptags[lookupname],v,preceding)
end
character = makefake(tfmdata,name,present)
end
local ligatures = character.ligatures
if ligatures then
ligatures[unicode] = { char = v }
else
character.ligatures = { [unicode] = { char = v } }
end
if done then
local d = done[lookupname]
if not d then
done[lookupname] = { "dummy", v }
else
d[#d+1] = v
end
end
else
local code = present[name] or unicode
local name = name .. "_" .. k
make_2(present,tfmdata,characters,v,name,code,k,done,lookuptags,lookupname)
end
end
end
local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplist)
local characters = tfmdata.characters
local descriptions = tfmdata.descriptions
local resources = tfmdata.resources
local changed = tfmdata.changed
local lookuphash = resources.lookuphash
local lookuptypes = resources.lookuptypes
local lookuptags = resources.lookuptags
local ligatures = { }
local alternate = tonumber(value) or true and 1
local defaultalt = otf.defaultbasealternate
local trace_singles = trace_baseinit and trace_singles
local trace_alternatives = trace_baseinit and trace_alternatives
local trace_ligatures = trace_baseinit and trace_ligatures
for l=1,#lookuplist do
local lookupname = lookuplist[l]
local lookupdata = lookuphash[lookupname]
local lookuptype = lookuptypes[lookupname]
for unicode, data in next, lookupdata do
if lookuptype == "substitution" then
if trace_singles then
report_substitution(feature,lookuptags,lookupname,descriptions,unicode,data)
end
changed[unicode] = data
elseif lookuptype == "alternate" then
local replacement = data[alternate]
if replacement then
changed[unicode] = replacement
if trace_alternatives then
report_alternate(feature,lookuptags,lookupname,descriptions,unicode,replacement,value,"normal")
end
elseif defaultalt == "first" then
replacement = data[1]
changed[unicode] = replacement
if trace_alternatives then
report_alternate(feature,lookuptags,lookupname,descriptions,unicode,replacement,value,defaultalt)
end
elseif defaultalt == "last" then
replacement = data[#data]
if trace_alternatives then
report_alternate(feature,lookuptags,lookupname,descriptions,unicode,replacement,value,defaultalt)
end
else
if trace_alternatives then
report_alternate(feature,lookuptags,lookupname,descriptions,unicode,replacement,value,"unknown")
end
end
elseif lookuptype == "ligature" then
ligatures[#ligatures+1] = { unicode, data, lookupname }
if trace_ligatures then
report_ligature(feature,lookuptags,lookupname,descriptions,unicode,data)
end
end
end
end
local nofligatures = #ligatures
if nofligatures > 0 then
local characters = tfmdata.characters
local present = { }
local done = trace_baseinit and trace_ligatures and { }
for i=1,nofligatures do
local ligature = ligatures[i]
local unicode, tree = ligature[1], ligature[2]
make_1(present,tree,"ctx_"..unicode)
end
for i=1,nofligatures do
local ligature = ligatures[i]
local unicode, tree, lookupname = ligature[1], ligature[2], ligature[3]
make_2(present,tfmdata,characters,tree,"ctx_"..unicode,unicode,unicode,done,lookuptags,lookupname)
end
end
end
local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist)
local characters = tfmdata.characters
local descriptions = tfmdata.descriptions
local resources = tfmdata.resources
local properties = tfmdata.properties
local lookuphash = resources.lookuphash
local lookuptags = resources.lookuptags
local traceindeed = trace_baseinit and trace_kerns
-- check out this sharedkerns trickery
for l=1,#lookuplist do
local lookupname = lookuplist[l]
local lookupdata = lookuphash[lookupname]
for unicode, data in next, lookupdata do
local character = characters[unicode]
local kerns = character.kerns
if not kerns then
kerns = { }
character.kerns = kerns
end
if traceindeed then
for otherunicode, kern in next, data do
if not kerns[otherunicode] and kern ~= 0 then
kerns[otherunicode] = kern
report_kern(feature,lookuptags,lookup,descriptions,unicode,otherunicode,kern)
end
end
else
for otherunicode, kern in next, data do
if not kerns[otherunicode] and kern ~= 0 then
kerns[otherunicode] = kern
end
end
end
end
end
end
local function initializehashes(tfmdata)
nodeinitializers.features(tfmdata)
end
basemethods.shared = {
initializehashes = initializehashes,
preparesubstitutions = preparesubstitutions,
preparepositionings = preparepositionings,
}
basemethod = "independent"
local function featuresinitializer(tfmdata,value)
if true then -- value then
local starttime = trace_preparing and os.clock()
local features = tfmdata.shared.features
local fullname = tfmdata.properties.fullname or "?"
if features then
applybasemethod("initializehashes",tfmdata)
local collectlookups = otf.collectlookups
local rawdata = tfmdata.shared.rawdata
local properties = tfmdata.properties
local script = properties.script -- or "dflt" -- can be nil
local language = properties.language -- or "dflt" -- can be nil
local basesubstitutions = rawdata.resources.features.gsub
local basepositionings = rawdata.resources.features.gpos
--
-- if basesubstitutions then
-- for feature, data in next, basesubstitutions do
-- local value = features[feature]
-- if value then
-- local validlookups, lookuplist = collectlookups(rawdata,feature,script,language)
-- if validlookups then
-- applybasemethod("preparesubstitutions",tfmdata,feature,value,validlookups,lookuplist)
-- registerbasefeature(feature,value)
-- end
-- end
-- end
-- end
-- if basepositionings then
-- for feature, data in next, basepositionings do
-- local value = features[feature]
-- if value then
-- local validlookups, lookuplist = collectlookups(rawdata,feature,script,language)
-- if validlookups then
-- applybasemethod("preparepositionings",tfmdata,feature,features[feature],validlookups,lookuplist)
-- registerbasefeature(feature,value)
-- end
-- end
-- end
-- end
--
if basesubstitutions or basepositionings then
local sequences = tfmdata.resources.sequences
for s=1,#sequences do
local sequence = sequences[s]
local sfeatures = sequence.features
if sfeatures then
local order = sequence.order
if order then
for i=1,#order do --
local feature = order[i]
local value = features[feature]
if value then
local validlookups, lookuplist = collectlookups(rawdata,feature,script,language)
if not validlookups then
-- skip
elseif basesubstitutions and basesubstitutions[feature] then
if trace_preparing then
report_prepare("filtering base %s feature %a for %a with value %a","sub",feature,fullname,value)
end
applybasemethod("preparesubstitutions",tfmdata,feature,value,validlookups,lookuplist)
registerbasefeature(feature,value)
elseif basepositionings and basepositionings[feature] then
if trace_preparing then
report_prepare("filtering base %a feature %a for %a with value %a","pos",feature,fullname,value)
end
applybasemethod("preparepositionings",tfmdata,feature,value,validlookups,lookuplist)
registerbasefeature(feature,value)
end
end
end
end
end
end
end
--
registerbasehash(tfmdata)
end
if trace_preparing then
report_prepare("preparation time is %0.3f seconds for %a",os.clock()-starttime,fullname)
end
end
end
registerotffeature {
name = "features",
description = "features",
default = true,
initializers = {
-- position = 1, -- after setscript (temp hack ... we need to force script / language to 1
base = featuresinitializer,
}
}
-- independent : collect lookups independently (takes more runtime ... neglectable)
-- shared : shares lookups with node mode (takes more memory unless also a node mode variant is used ... noticeable)
directives.register("fonts.otf.loader.basemethod", function(v)
if basemethods[v] then
basemethod = v
end
end)
|
function reciposszeg(A,B)
return 1/(1/A+1/B)
end
R={} U={} I={}
-- A -> mindenhol az áram iránya
--[[
+---------(<-If=2A)-----------------+
| |
+--(R2=10->)---+---(<-R1=5)---------+
| | |
| +(<-Ug=2V)+ |
| | |
+------(R4=15->)---------+-(R3=20->)+
--]]
R[1]=5
R[2]=10
R[3]=20
R[4]=15
If=2
Ug=2
--Szuper pozíció
function szakadas()
local U, I = {},{}
--[[
+--(R2=10->)---+---(<-R1=5)---------+
| | |
| +(<-Ug=2V)+ |
| | |
+------(R4=15->)---------+-(R3=20->)+
--]]
R["31"]=R[3]+R[1]
R["42"]=R[4]+R[2]
R["4231"]=reciposszeg(R["42"],R["31"])
--R=U/I
U["4231"]=Ug
I["4231"]=U["4231"]/R["4231"]
U["42"]=U["4231"]
I["42"]=U["42"]/R["42"]
I[4]=I["42"]
U[4]=I[4]*R[4]
I[2]=I["42"]
U[2]=I[2]*R[2]
U["31"]=U["4231"]
I["31"]=U["31"]/R["31"]
I[3]=I["31"]
U[3]=I[3]*R[3]
I[1]=I["31"]
U[1]=I[1]*R[1]
for i=1,4 do
print("R["..i.."]="..R[i],"I["..i.."]="..I[i],"U["..i.."]="..U[i])
end
print("")
--[[
R[1]=5 I[1]=0.08 U[1]=0.4
R[2]=10 I[2]=0.08 U[2]=0.8
R[3]=20 I[3]=0.08 U[3]=1.6
R[4]=15 I[4]=0.08 U[4]=1.2
]]
return U,I
end
function rovidzar()
local U, I = {},{}
--[[
+---------(<-If=2A)-----------------+
| |
C[1] +--(R2=10->)---+---(<-R1=5)---------+ C[2]
| | |
| C[3] +---------+ |
| | |
+------(R4=15->)---------+-(R3=20->)+
--]]
--Csomópont módszer: (Befolyó a negatív)
--[[
-2 + (C[1]-C[3])/R[2] + (C[1]-C[3])/R[4] = 0,
2 + (C[2]-C[3])/R[1] - (C[3]-C[2])/R[3] = 0,
C[3] = 0
2 + C[1]/10 + C[1]/15 = 0,
-2 + C[2]/5 + C[2]/20 = 0
C[1]=12
C[2]=-8
C[3]=0
Ell:
-(C[1]-C[3])/R[2] - (C[2]-C[3])/R[1] + (C[3]-C[2])/R[3] - (C[1]-C[3])/R[4] = 0
]]
C = {12,-8,0}
U[1]=C[2]-C[3]
U[2]=C[1]-C[3]
U[3]=C[3]-C[2]
U[4]=C[1]-C[3]
I[1]=U[1]/R[1]
I[2]=U[2]/R[2]
I[3]=U[3]/R[3]
I[4]=U[4]/R[4]
for i=1,4 do
print("R["..i.."]="..R[i],"I["..i.."]="..I[i],"U["..i.."]="..U[i])
end
print("")
--[[
R[1]=5 I[1]=1.6 U[1]=8
R[2]=10 I[2]=-1.2 U[2]=-12
R[3]=20 I[3]=-0.4 U[3]=-8
R[4]=15 I[4]=-0.8 U[4]=-12
]]
return U,I
end
sU,sI = szakadas()
rU,rI = rovidzar()
U[1], I[1] = (rU[1] or 0)-(sU[1] or 0), (rI[1] or 0)-(sI[1] or 0)
U[2], I[2] = (rU[2] or 0)-(sU[2] or 0), (rI[2] or 0)-(sI[2] or 0)
U[3], I[3] = (rU[3] or 0)-(sU[3] or 0), (rI[3] or 0)-(sI[3] or 0)
U[4], I[4] = (rU[4] or 0)+(sU[4] or 0), (rI[4] or 0)-(sI[4] or 0) --Egy irányba megy át rajta a 2 gen.
for i=1,4 do
print("R["..i.."]="..R[i],"I["..i.."]="..I[i],"U["..i.."]="..U[i])
end
--[[
R[1]=5 I[1]=-1.68 U[1]=-8.4
R[2]=10 I[2]=1.12 U[2]=11.2
R[3]=20 I[3]=0.32 U[3]=6.4
R[4]=15 I[4]=0.72 U[4]=13.2
]]
|
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 voices = { {text = 'Passages to Carlin, Ab\'Dendriel, Edron, Venore, Port Hope, Liberty Bay, Yalahar, Roshamuul and Svargrond.'} }
npcHandler:addModule(VoiceModule:new(voices))
-- Travel
local function addTravelKeyword(keyword, cost, destination, action)
local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you seek a passage to ' .. keyword:titleCase() .. ' for |TRAVELCOST|?', cost = cost, discount = 'postman'})
travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, cost = cost, discount = 'postman', destination = destination}, nil, action)
travelKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'We would like to serve you some time.', reset = true})
end
addTravelKeyword('carlin', 110, Position(32387, 31820, 6), function(player) if player:getStorageValue(Storage.postman.Mission01) == 1 then player:setStorageValue(Storage.postman.Mission01, 2) end end)
addTravelKeyword('ab\'dendriel', 130, Position(32734, 31668, 6))
addTravelKeyword('edron', 160, Position(33175, 31764, 6))
addTravelKeyword('venore', 170, Position(32954, 32022, 6))
addTravelKeyword('port hope', 160, Position(32527, 32784, 6))
addTravelKeyword('roshamuul', 210, Position(33494, 32567, 7))
addTravelKeyword('svargrond', 180, Position(32341, 31108, 6))
addTravelKeyword('liberty bay', 180, Position(32285, 32892, 6))
addTravelKeyword('yalahar', 200, Position(32816, 31272, 6))
-- Kick
keywordHandler:addKeyword({'kick'}, StdModule.kick, {npcHandler = npcHandler, destination = {Position(32320, 32219, 6), Position(32321, 32210, 6)}})
-- Basic
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, text = 'My name is Captain Bluebear from the Royal Tibia Line.'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, text = 'I am the captain of this sailing-ship.'})
keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, text = 'I am the captain of this sailing-ship.'})
keywordHandler:addKeyword({'ship'}, StdModule.say, {npcHandler = npcHandler, text = 'The Royal Tibia Line connects all seaside towns of Tibia.'})
keywordHandler:addKeyword({'line'}, StdModule.say, {npcHandler = npcHandler, text = 'The Royal Tibia Line connects all seaside towns of Tibia.'})
keywordHandler:addKeyword({'company'}, StdModule.say, {npcHandler = npcHandler, text = 'The Royal Tibia Line connects all seaside towns of Tibia.'})
keywordHandler:addKeyword({'route'}, StdModule.say, {npcHandler = npcHandler, text = 'The Royal Tibia Line connects all seaside towns of Tibia.'})
keywordHandler:addKeyword({'tibia'}, StdModule.say, {npcHandler = npcHandler, text = 'The Royal Tibia Line connects all seaside towns of Tibia.'})
keywordHandler:addKeyword({'good'}, StdModule.say, {npcHandler = npcHandler, text = 'We can transport everything you want.'})
keywordHandler:addKeyword({'passenger'}, StdModule.say, {npcHandler = npcHandler, text = 'We would like to welcome you on board.'})
keywordHandler:addKeyword({'trip'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul} or {Svargrond}?'})
keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul} or {Svargrond}?'})
keywordHandler:addKeyword({'town'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul} or {Svargrond}?'})
keywordHandler:addKeyword({'destination'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul} or {Svargrond}?'})
keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul} or {Svargrond}?'})
keywordHandler:addKeyword({'go'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Carlin}, {Ab\'Dendriel}, {Edron}, {Venore}, {Port Hope}, {Liberty Bay}, {Yalahar}, {Roshamuul} or {Svargrond}?'})
keywordHandler:addKeyword({'ice'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m sorry, but we don\'t serve the routes to the Ice Islands.'})
keywordHandler:addKeyword({'senja'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m sorry, but we don\'t serve the routes to the Ice Islands.'})
keywordHandler:addKeyword({'folda'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m sorry, but we don\'t serve the routes to the Ice Islands.'})
keywordHandler:addKeyword({'vega'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m sorry, but we don\'t serve the routes to the Ice Islands.'})
keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m not sailing there. This route is afflicted by a ghostship! However I\'ve heard that Captain Fearless from Venore sails there.'})
keywordHandler:addKeyword({'darama'}, StdModule.say, {npcHandler = npcHandler, text = 'I\'m not sailing there. This route is afflicted by a ghostship! However I\'ve heard that Captain Fearless from Venore sails there.'})
keywordHandler:addKeyword({'ghost'}, StdModule.say, {npcHandler = npcHandler, text = 'Many people who sailed to Darashia never returned because they were attacked by a ghostship! I\'ll never sail there!'})
keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, text = 'This is Thais. Where do you want to go?'})
npcHandler:setMessage(MESSAGE_GREET, 'Welcome on board, |PLAYERNAME|. Where can I {sail} you today?')
npcHandler:setMessage(MESSAGE_FAREWELL, 'Good bye. Recommend us if you were satisfied with our service.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Good bye then.')
npcHandler:addModule(FocusModule:new())
|
describe('count', function()
it('passes through errors', function()
local observable = Rx.Observable.create(function(observer) observer:onError() end)
expect(observable.subscribe).to.fail()
expect(observable:count().subscribe).to.fail()
end)
it('produces a single value representing the number of elements produced by the source', function()
local observable = Rx.Observable.fromRange(5):count()
expect(observable).to.produce(5)
end)
it('uses the predicate to filter for values if it is specified', function()
local observable = Rx.Observable.fromRange(5):count(function(x) return x > 3 end)
expect(observable).to.produce(2)
end)
end)
|
-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.
local MazeAgent, parent = torch.class('MazeAgent', 'MazeItem')
function MazeAgent:__init(attr, maze)
attr.type = 'agent'
parent.__init(self, attr)
self.maze = maze
self.map = maze.map
-- List of possible actions and corresponding functions to execute
self.action_names = {} -- id -> name
self.action_ids = {} -- name -> id
self.actions = {} -- id -> func
self.nactions = 0
self:add_move_actions()
self:add_toggle_action()
if maze.crumb_action == 1 then
self:add_breadcrumb_action()
end
if maze.push_action == 1 then
self:add_push_actions()
end
end
function MazeAgent:add_action(name, f)
if not self.action_ids[name] then
self.nactions = self.nactions + 1
self.action_names[self.nactions] = name
self.actions[self.nactions] = f
self.action_ids[name] = self.nactions
else
self.actions[self.action_ids[name]] = f
end
end
function MazeAgent:add_move_actions()
self:add_action('up',
function(self)
if self.map:is_loc_reachable(self.loc.y - 1, self.loc.x) then
self.map:remove_item(self)
self.loc.y = self.loc.y - 1
self.map:add_item(self)
end
end)
self:add_action('down',
function(self)
if self.map:is_loc_reachable(self.loc.y + 1, self.loc.x) then
self.map:remove_item(self)
self.loc.y = self.loc.y + 1
self.map:add_item(self)
end
end)
self:add_action('left',
function(self)
if self.map:is_loc_reachable(self.loc.y, self.loc.x - 1) then
self.map:remove_item(self)
self.loc.x = self.loc.x - 1
self.map:add_item(self)
end
end)
self:add_action('right',
function(self)
if self.map:is_loc_reachable(self.loc.y, self.loc.x + 1) then
self.map:remove_item(self)
self.loc.x = self.loc.x + 1
self.map:add_item(self)
end
end)
self:add_action('stop',
function(self)
-- do nothing
end)
end
function MazeAgent:add_toggle_action()
self:add_action('toggle',
function(self)
local l = self.map.items[self.loc.y][self.loc.x]
for _, e in ipairs(l) do
if e.type == 'switch' then
if not e.fixed then
local c = e.attr._c
c = (c % e.attr._cn) + 1
e.attr._c = c
e.attr.color = 'color' .. c
end
end
end
end)
end
function MazeAgent:add_push_actions()
self:add_action('push_up',
function(self)
local y = self.loc.y
local x = self.loc.x
if self.map:is_loc_reachable(y - 2, x) then
for i,j in pairs(self.map.items[y-1][x]) do
if j.pushable then
j.pushed = true
j.agent_y = y
j.agent_x = x
end
end
end
end)
self:add_action('push_down',
function(self)
local y = self.loc.y
local x = self.loc.x
if self.map:is_loc_reachable(y + 2, x) then
for i,j in pairs(self.map.items[y+1][x]) do
if j.pushable then
j.pushed = true
j.agent_y = y
j.agent_x = x
end
end
end
end)
self:add_action('push_left',
function(self)
local y = self.loc.y
local x = self.loc.x
if self.map:is_loc_reachable(y, x - 2) then
for i,j in pairs(self.map.items[y][x-1]) do
if j.pushable then
j.pushed = true
j.agent_y = y
j.agent_x = x
end
end
end
end)
self:add_action('push_right',
function(self)
local y = self.loc.y
local x = self.loc.x
if self.map:is_loc_reachable(y, x + 2) then
for i,j in pairs(self.map.items[y][x+1]) do
if j.pushable then
j.pushed = true
j.agent_y = y
j.agent_x = x
end
end
end
end)
end
-- Agents call this function to perform action
function MazeAgent:act(action_id)
local f = self.actions[action_id]
if f == nil then
print('Available actions are: ')
for k,v in pairs(self.actions) do
print(k)
end
error('Could not find action for action_id: ' .. action_id)
end
f(self)
self.last_action = action_id
end
|
local wasProximityDisabledFromOverride = false
disableProximityCycle = false
RegisterCommand('setvoiceintent', function(source, args)
if GetConvarInt('voice_allowSetIntent', 1) == 1 then
local intent = args[1]
if intent == 'speech' then
MumbleSetAudioInputIntent(`speech`)
elseif intent == 'music' then
MumbleSetAudioInputIntent(`music`)
end
LocalPlayer.state:set('voiceIntent', intent, true)
end
end)
-- TODO: Better implementation of this?
RegisterCommand('vol', function(_, args)
if not args[1] then return end
setVolume(tonumber(args[1]))
end)
exports('setAllowProximityCycleState', function(state)
type_check({state, "boolean"})
disableProximityCycle = state
end)
function setProximityState(proximityRange, isCustom)
local voiceModeData = Cfg.voiceModes[mode]
MumbleSetTalkerProximity(proximityRange + 0.0)
LocalPlayer.state:set('proximity', {
index = mode,
distance = proximityRange,
mode = isCustom and "Custom" or voiceModeData[2],
}, false)
sendUIMessage({
-- JS expects this value to be - 1, "custom" voice is on the last index
voiceMode = isCustom and #Cfg.voiceModes or mode - 1
})
end
exports("overrideProximityRange", function(range, disableCycle)
type_check({range, "number"})
setProximityState(range, true)
if disableCycle then
disableProximityCycle = true
wasProximityDisabledFromOverride = true
end
end)
exports("clearProximityOverride", function()
local voiceModeData = Cfg.voiceModes[mode]
setProximityState(voiceModeData[1], false)
if wasProximityDisabledFromOverride then
disableProximityCycle = false
end
end)
RegisterCommand('cyclevoiceproximity', function()
-- Proximity is either disabled, or manually overwritten.
if GetConvarInt('voice_enableProximityCycle', 1) ~= 1 or disableProximityCycle then return end
local newMode = mode + 1
-- If we're within the range of our voice modes, allow the increase, otherwise reset to the first state
if newMode <= #Cfg.voiceModes then
mode = newMode
else
mode = 1
end
setProximityState(Cfg.voiceModes[mode][1], false)
TriggerEvent('pma-voice:setTalkingMode', mode)
end, false)
if gameVersion == 'fivem' then
RegisterKeyMapping('cyclevoiceproximity', 'Cycle Proximity', 'keyboard', GetConvar('voice_defaultCycle', 'GRAVE'))
end
function DisableMegaphone()
LocalPlayer.state.megaphoneEnabled = false
TriggerServerEvent("pma-voice:toggleMegaphone", false)
MumbleSetAudioInputIntent(`speech`)
local voiceModeData = Cfg.voiceModes[mode]
setProximityState(voiceModeData[1], false)
if wasProximityDisabledFromOverride then
disableProximityCycle = false
end
exports["mythic_notify"]:PersistentAlert("end", "megaphoneStatus")
end
AddEventHandler("pma-voice:activeMegaphone", ToggleMegaphone)
function ToggleMegaphone()
if isDead() then
return
end
if GetInvokingResource() == nil then -- Invoked by command, most likely from this resource
if not IsPedInAnyVehicle(PlayerPedId(), false) then
return
end
local veh = GetVehiclePedIsIn(PlayerPedId(), false)
if GetVehicleClass(veh) ~= 18 then
return
end
if GetPedInVehicleSeat(veh, -1) ~= PlayerPedId() and GetPedInVehicleSeat(veh, 0) ~= PlayerPedId() then
return
end
else
if megaphoneEnabled then
megaphoneEnabled = false
DisableMegaphone()
return
end
Citizen.CreateThread(function()
local startPos = GetEntityCoords(PlayerPedId())
while #(startPos - GetEntityCoords(PlayerPedId())) < 1.0 and not IsPedInAnyVehicle(PlayerPedId(), true) and not isDead() do
if IsControlJustPressed(0, 73) then
break
end
Citizen.Wait(0)
end
megaphoneEnabled = false
DisableMegaphone()
end)
end
megaphoneEnabled = not megaphoneEnabled
if megaphoneEnabled then
LocalPlayer.state.megaphoneEnabled = true
TriggerServerEvent("pma-voice:toggleMegaphone", true)
MumbleSetAudioInputIntent(`music`)
local range = GetConvarInt("voice_megaphoneRange", 25)
setProximityState(range, true)
disableProximityCycle = true
wasProximityDisabledFromOverride = true
exports["mythic_notify"]:PersistentAlert("start", "megaphoneStatus", "inform", "/!\\ P.A. ON - Radio Disabled", { ['background-color'] = '#ff0000', ['color'] = '#000000'} )
else
DisableMegaphone()
end
end
RegisterCommand('togglemegaphone', ToggleMegaphone, false)
if gameVersion == 'fivem' then
RegisterKeyMapping('togglemegaphone', 'Toggle Megaphone / P.A.', 'keyboard', 'k')
end |
local plateTable = {}
local allowedToUse = false
local directions = {
North = 360, 0,
East = 270,
South = 180,
West = 90
}
Citizen.CreateThread(function()
TriggerServerEvent("Prefech:checkPerms", GetPlayerServerId(PlayerId()))
end)
RegisterNetEvent("Prefech:getPerms")
AddEventHandler("Prefech:getPerms", function(_isAllowed)
isAllowed = _isAllowed
end)
RegisterNetEvent('Prefech:sendPlates')
AddEventHandler('Prefech:sendPlates', function(_plateTable)
plateTable = _plateTable
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(500)
alertSend = false
while insideCameraZone() do
Citizen.Wait(500)
if IsPedInAnyVehicle(GetPlayerPed(PlayerId()), true) then
local vehicle = GetVehiclePedIsIn(GetPlayerPed(PlayerId()))
if(GetPedInVehicleSeat(vehicle, -1) == GetPlayerPed(-1)) then
if has_value(plateTable, GetVehicleNumberPlateText(vehicle):upper():gsub("%s+","")) then
SetHornEnabled(vehicle, true)
local coords = GetEntityCoords(vehicle)
if(alertSend == false) then
TriggerServerEvent('Prefech:sendblip', coords.x, coords.y, coords.z)
TriggerServerEvent('Prefech:sendalert', coords.x, coords.y, coords.z, GetVehicleNumberPlateText(vehicle), GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)), GetEntityHeading(vehicle))
local var1 = GetStreetNameAtCoord(coords.x, coords.y, coords.z, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
hash1 = GetStreetNameFromHashKey(var1);
heading = GetEntityHeading(vehicle);
for k, v in pairs(directions) do
if (math.abs(heading - v) < 45) then
heading = k;
if (heading == 1) then
heading = 'North';
break;
end
break;
end
end
local string = "**"..Config.Notification
local string = string:gsub("\n","\n")
local string = string:gsub("{{Plate}}",""..GetVehicleNumberPlateText(vehicle).."")
local string = string:gsub("{{Vehicle_Name}}",""..GetDisplayNameFromVehicleModel(GetEntityModel(vehicle)).."")
local string = string:gsub("{{Street_Name}}",""..hash1.."")
local string = string:gsub("{{Heading}}",""..heading.."")
if Config.JD_logs then
exports.JD_logs:discord(string, 0, 0, Config.LogsColor, Config.LogsChannelCommands)
end
alertSend = true
end
Citizen.Wait(2000)
end
end
end
end
end
end)
Citizen.CreateThread(function()
if Config.CameraBlips then
for i = 1, #Config.Zones do
local Zone = Config.Zones[i]
blip = AddBlipForCoord(Zone[1],Zone[2],Zone[3])
BeginTextCommandSetBlipName("STRING")
AddTextComponentString("Smart Camera")
EndTextCommandSetBlipName(blip)
end
end
end)
RegisterNetEvent("Prefech:trackerset")
AddEventHandler("Prefech:trackerset", function(x, y, z)
if(isAllowed) then
local blip = AddBlipForCoord(x, y, z)
SetBlipFlashes(blip, true)
SetBlipSprite(blip, 326)
SetBlipColour(blip, 1)
Citizen.Wait(Config.BlipTime * 1000)
RemoveBlip(blip)
end
end)
RegisterNetEvent("Prefech:alertsend")
AddEventHandler("Prefech:alertsend", function(x, y, z, plate, model, heading, postal)
local veh = NetworkGetEntityFromNetworkId(veh)
if(isAllowed) then
local var1 = GetStreetNameAtCoord(x, y, z, Citizen.ResultAsInteger(), Citizen.ResultAsInteger())
hash1 = GetStreetNameFromHashKey(var1);
for k, v in pairs(directions) do
if (math.abs(heading - v) < 45) then
heading = k;
if (heading == 1) then
heading = 'North';
break;
end
break;
end
end
local string = Config.Notification
local string = string:gsub("\n","~w~\n")
local string = string:gsub("{{Plate}}","~y~"..plate.."~w~")
local string = string:gsub("{{Vehicle_Name}}","~y~"..model.."~w~")
local string = string:gsub("{{Street_Name}}","~y~"..hash1.."~w~")
local string = string:gsub("{{Heading}}","~y~"..heading.."~w~")
local string = string:gsub("{{Postal}}","~y~"..postal.."~w~")
BeginTextCommandThefeedPost("STRING")
AddTextComponentSubstringPlayerName(string)
EndTextCommandThefeedPostMessagetext("CHAR_CALL911", "CHAR_CALL911", 0, 0, "Prefech ALPR System", "Vehcile: ~y~"..model.."~w~, Plate: ~y~"..plate.." ~w~")
EndTextCommandDisplayText(0.5, 0.5)
PlaySound(-1, "Menu_Accept", "Phone_SoundSet_Default", 0, 0, 1)
end
end)
function insideCameraZone()
local oddNodes = false
for i = 1, #Config.Zones do
local Zone = Config.Zones[i]
local j = #Zone
for i = 1, #Zone do
local x, y, z = GetEntityCoords(GetPlayerPed(PlayerId()))
if GetDistanceBetweenCoords(Zone[1],Zone[2],Zone[3], x, y, z, true) <= Zone[4] then
return true
end
j = i;
end
end
end
function has_value (tab, val)
for i, v in ipairs (tab) do
if (v == val) then
return true
end
end
return false
end
|
-- Set of AI functions for objects.
-- Most any function will actually yield (with the exception of parameter generation and other utility functions),
-- and will only continue execution the next time AIProcessor is called, or when trigger becomes true.
-- (When trigger is 0, the function will continue execution on the next AIPRocessor call)
function straight( context )
context:Control( Context.IDLE, Trigger_Eternal() )
end
function straight_accel( context )
context:Control( Context.CTRL_SPEED_UP, Trigger_Eternal() )
end
function height_change_up( context )
local dx = RandomInt( 100, 900 )
local dy = 100
context:Control( Context.IDLE, Trigger_DX( dx ) )
context:Control( Context.CTRL_VERT_UP, Trigger_DY( dy ) )
context:Control( Context.IDLE, Trigger_Eternal() )
end
function height_change_down( context )
local dx = RandomInt( 100, 900 )
local dy = 100
context:Control( Context.IDLE, Trigger_DX( dx ) )
context:Control( Context.CTRL_VERT_DOWN, Trigger_DY( dy ) )
context:Control( Context.IDLE, Trigger_Eternal() )
end
function plane_dead( context, deadObject )
local timer = RandomFloat( 1, 3 )
context:Control( Context.IDLE, Trigger_Timer( timer ) )
local params = context:CreateObjectParams()
params.ai = ""
params.hasSpeed = true
params.speedX = 0
params.speedY = 200
context:CreateObject( deadObject, params, true )
end
function victim_prop_dead( context )
plane_dead( context, "victim_prop_falling" )
end
function victim_jet_dead( context )
plane_dead( context, "victim_jet_falling" )
end
function enemy_prop_dead( context )
plane_dead( context, "enemy_prop_falling" )
end
function enemy_jet_dead( context )
plane_dead( context, "enemy_jet_falling" )
end
function explosion_on_target( context )
context:Control( Context.IDLE, Trigger_Timer( 1 ) )
context:DestroySelf()
end
function skymine( context )
local dy = RandomInt( 100, 300 )
local time = RandomFloat( 3, 6 )
context:Control( Context.CTRL_VERT_DOWN, Trigger_DY( dy ) )
context:Control( Context.IDLE, Trigger_Timer( time ) )
context:Control( Context.CTRL_VERT_UP, Trigger_Eternal() )
end
function copter( context )
local time = RandomFloat( 1, 3 )
context:Control( Context.IDLE, Trigger_Timer( time ) )
local nextAction = RandomInt( 0, 100 )
if nextAction < 50 then
context:Control( Context.CTRL_FIRE1, Trigger_OneTime() )
elseif nextAction < 75 then
context:Control( Context.CTRL_STOP, Trigger_OneTime() )
context:Control( Context.CTRL_FLIP, Trigger_OneTime() )
context:Control( Context.IDLE, Trigger_Timer( 1 ) )
context:Control( Context.CTRL_GO, Trigger_OneTime() )
local time = RandomFloat( 1, 6 )
context:Control( Context.IDLE, Trigger_Timer( time ) )
end
end
function copter_dart_ai( context )
context:Control( Context.CTRL_VERT_DOWN, Trigger_DY(50) )
context:Control( Context.CTRL_SPEED_UP, Trigger_Eternal() )
end
function enemy_copter_dead( context )
context:Control( Context.CTRL_VERT_DOWN, Trigger_OneTime() )
while true do
context:Control( Context.CTRL_FLIP, Trigger_OneTime() )
context:Control( Context.IDLE, Trigger_Timer( 0.5 ) )
context:Control( Context.CTRL_GO, Trigger_OneTime() )
end
end
function two_seater_morph1( context )
context:Control( Context.IDLE, Trigger_Timer( 0.3 ) )
local params = context:CreateObjectParams()
params.ai = "two_seater_morph2"
context:CreateObject( "two_seater_morph", params, true )
end
function two_seater_morph2( context )
local time = RandomFloat( 1, 2 )
local types = { "victim_prop", "victim_jet", "enemy_prop", "enemy_jet" }
local type = types[ RandomInt( 1, 4 ) ]
context:Control( Context.IDLE, Trigger_Timer( time ) )
local params = context:CreateObjectParams()
params.ai = "straight"
context:CreateObject( type, params, true )
end
function bomber( context )
local time = RandomFloat( 1, 3 )
context:Control( Context.IDLE, Trigger_Timer( time ) )
local nextAction = RandomInt( 0, 100 )
if nextAction < 18 then
context:Control( Context.CTRL_VERT_DOWN, Trigger_DY(50) )
elseif nextAction < 36 then
context:Control( Context.CTRL_VERT_UP, Trigger_DY(50) )
elseif nextAction < 85 then
local n = RandomInt( 2, 5 )
for i = 1,n do
context:Control( Context.CTRL_FIRE1, Trigger_OneTime() )
context:Control( Context.IDLE, Trigger_Timer( 0.1 ) )
end
end
end
function enemy_bomb_ai( context )
local time = RandomFloat( 2, 3 )
context:Control( Context.CTRL_VERT_DOWN, Trigger_Timer(time) )
local params = context:CreateObjectParams()
params.ai = "bomb_explosion"
params.hasSpeed = true
params.speedX = 0
params.speedY = 0
params.angle = 0
context:CreateObject( "bomb_explosion", params, true )
end
function bomb_explosion( context )
context:Control( Context.IDLE, Trigger_Timer(0.5) )
context:DestroySelf()
end
function player_bomb_ai( context )
local time = RandomFloat( 2, 3 )
context:Control( Context.CTRL_SPEED_UP, Trigger_Timer(1.0) )
context:Control( Context.CTRL_STOP, Trigger_OneTime() )
context:Control( Context.CTRL_VERT_DOWN, Trigger_Eternal() )
end
function enemy_bomber_dead( context )
context:Control( Context.CTRL_VERT_UP, Trigger_Timer(0.2) )
context:Control( Context.CTRL_VERT_DOWN, Trigger_OneTime() )
while true do
context:Control( Context.CTRL_FLIP, Trigger_OneTime() )
context:Control( Context.IDLE, Trigger_Timer( 0.1 ) )
context:Control( Context.CTRL_GO, Trigger_OneTime() )
end
end
function ufo_spawn( context )
context:Control( Context.IDLE, Trigger_Timer( 0.3 ) )
local params = context:CreateObjectParams()
params.ai = "ufo_live"
params.hasSpeed = true
params.speedX = 0
params.speedY = 0
params.angle = 0
context:CreateObject( "ufo", params, true )
end
function ufo_live( context )
local nextAction = RandomInt( 1, 2 )
if nextAction == 1 then
local repeats = RandomInt( 4, 7 )
for i = 1, repeats do
context:Control( Context.CTRL_VERT_DOWN, Trigger_Timer(0.3) )
context:Control( Context.CTRL_VERT_UP, Trigger_Timer(0.3) )
end
else
local time = RandomFloat( 0.8, 1.5 )
context:Control( Context.CTRL_SPEED_UP, Trigger_Timer(time) )
end
local nextAIs = { "ufo_despawn", "ufo_end" }
local nextAI = nextAIs[ RandomInt( 1, 2 ) ]
local params = context:CreateObjectParams()
params.ai = nextAI
params.hasSpeed = true
params.speedX = 0
params.speedY = 0
params.angle = 0
context:CreateObject( "ufo_despawn", params, true )
end
function ufo_despawn( context )
context:Control( Context.IDLE, Trigger_Timer( 0.4 ) )
context:Control( Context.CTRL_RANDOM_TELEPORT, Trigger_OneTime() )
local params = context:CreateObjectParams()
params.ai = "ufo_spawn"
params.hasSpeed = true
params.speedX = 0
params.speedY = 0
params.angle = 0
context:CreateObject( "ufo_spawn", params, true )
end
function ufo_end( context )
context:Control( Context.IDLE, Trigger_Timer( 0.4 ) )
context:DestroySelf()
end
function ufo_death( context )
context:Control( Context.CTRL_STOP, Trigger_OneTime() )
context:Control( Context.IDLE, Trigger_Timer(0.2) )
local params = context:CreateObjectParams()
params.ai = "ufo_dead"
params.hasSpeed = true
params.speedX = 0
params.speedY = 0
params.angle = 0
context:CreateObject( "ufo_dead", params, true )
end
function ufo_dead( context )
context:Control( Context.CTRL_VERT_DOWN, Trigger_OneTime() )
end
function hyperjet_slow( context )
local dx = RandomInt( 20, 400 )
context:Control( Context.IDLE, Trigger_DX(dx) )
context:Control( Context.CTRL_STOP, Trigger_OneTime() )
local params = context:CreateObjectParams()
params.ai = "hyperjet_stop"
params.hasSpeed = true
params.speedX = 0
params.speedY = 0
params.angle = 0
context:CreateObject( "hyperjet_stop", params, true )
end
function hyperjet_stop( context )
context:Control( Context.IDLE, Trigger_Timer(2) )
local params = context:CreateObjectParams()
params.ai = "hyperjet_fast"
params.hasSpeed = true
params.speedX = 0
params.speedY = 0
params.angle = 0
context:CreateObject( "hyperjet_fast", params, true )
end
function hyperjet_fast( context )
context:Control( Context.CTRL_SPEED_UP, Trigger_Eternal() )
end
function hyperjet_dead1( context )
context:Control( Context.CTRL_STOP, Trigger_OneTime() )
context:Control( Context.CTRL_VERT_UP, Trigger_Timer(0.2) )
local params = context:CreateObjectParams()
params.ai = "hyperjet_dead2"
params.hasSpeed = true
params.speedX = 0
params.speedY = 0
params.angle = 0
context:CreateObject( "hyperjet_dead2", params, true )
end
function hyperjet_dead2( context )
context:Control( Context.CTRL_VERT_DOWN, Trigger_Eternal() )
end
function paranoia_dead( context )
context:Control( Context.CTRL_STOP, Trigger_OneTime() )
context:Control( Context.CTRL_VERT_DOWN, Trigger_Eternal() )
end
function shuttle( context )
-- 0 - initial
-- 1 - down
-- 2 - up
-- 3 - side
-- 4 - flip
-- 5 - create satellite
local nextAction = 0
local y = context:GetSelfY()
if y < 10 then
nextAction = 0
else
local rnd = RandomInt( 0, 100 )
if ( rnd < 50 ) then
nextAction = 3
elseif ( rnd < 60 ) then
nextAction = 2
elseif ( rnd < 70 ) then
if y < 500 then
nextAction = 1
else
nextAction = 3
end
elseif ( rnd < 85 ) then
nextAction = 4
else
nextAction = 5
end
end
if nextAction == 0 then
local dy = RandomInt( 150, 200 )
context:Control( Context.CTRL_VERT_DOWN, Trigger_DY(dy) )
elseif nextAction == 1 then
local dy = RandomInt( 50, 100 )
context:Control( Context.CTRL_VERT_DOWN, Trigger_DY(dy) )
elseif nextAction == 2 then
local dy = RandomInt( 50, 100 )
context:Control( Context.CTRL_VERT_UP, Trigger_DY(dy) )
elseif nextAction == 3 then
local time = RandomFloat( 1, 3 )
context:Control( Context.IDLE, Trigger_Timer( time ) )
elseif nextAction == 4 then
context:Control( Context.CTRL_STOP, Trigger_OneTime() )
context:Control( Context.CTRL_FLIP, Trigger_OneTime() )
context:Control( Context.IDLE, Trigger_Timer( 1 ) )
context:Control( Context.CTRL_GO, Trigger_OneTime() )
local time = RandomFloat( 1, 3 )
context:Control( Context.IDLE, Trigger_Timer( time ) )
elseif nextAction == 5 then
local params = context:CreateObjectParams()
params.ai = "satellite_deploy"
params.hasSpeed = true
params.speedX = 0
params.speedY = -75
params.angle = 0
context:CreateObject( "satellite_deploy", params, false )
local time = RandomFloat( 0.5, 1.5 )
context:Control( Context.IDLE, Trigger_Timer( time ) )
end
end
function shuttle_dead( context )
context:Control( Context.CTRL_GO, Trigger_OneTime() )
context:Control( Context.CTRL_VERT_DOWN, Trigger_Eternal() )
end
function satellite_deploy( context )
context:Control( Context.CTRL_STOP, Trigger_OneTime() )
context:Control( Context.CTRL_VERT_UP, Trigger_DY(30) )
local params = context:CreateObjectParams()
params.ai = "satellite"
params.hasSpeed = true
params.speedX = 0
params.speedY = 0
params.angle = 0
context:CreateObject( "satellite", params, true )
end
function satellite( context )
-- 1 - flip
-- 2 - engage vert_down
-- 3 - engage vert_up
-- 4 - issue stop
-- 5 - issue go
-- 6 - idle
local nextAction = RandomInt( 0, 100 )
if nextAction < 25 then
context:Control( Context.CTRL_FLIP, Trigger_OneTime() )
context:Control( Context.IDLE, Trigger_Timer(0.1) )
elseif nextAction < 35 then
local time = RandomFloat( 1, 3 )
context:Control( Context.CTRL_VERT_DOWN, Trigger_Timer(time) )
elseif nextAction < 45 then
local time = RandomFloat( 1, 3 )
context:Control( Context.CTRL_VERT_UP, Trigger_Timer(time) )
elseif nextAction < 55 then
context:Control( Context.CTRL_STOP, Trigger_OneTime() )
elseif nextAction < 85 then
context:Control( Context.CTRL_GO, Trigger_OneTime() )
elseif nextAction < 100 then
local time = RandomFloat( 1, 3 )
context:Control( Context.IDLE, Trigger_Timer(time) )
end
end
function spacejet_dead( context )
context:Control( Context.IDLE, Trigger_DX( 15 ) )
context:Control( Context.CTRL_STOP, Trigger_OneTime() )
context:Control( Context.CTRL_VERT_DOWN, Trigger_OneTime() )
while true do
--context:Control( Context.CTRL_GO, Trigger_Timer( 0.125 ) )
context:Control( Context.CTRL_GO, Trigger_OneTime() )
context:Control( Context.IDLE, Trigger_Timer(0.125) )
context:Control( Context.CTRL_FLIP, Trigger_OneTime() )
end
end
|
local itk = require 'itkffi'
local im = itk.Float2D()
im:read("input.nrrd")
print(im:tensor())
--local out = im:gaussiansmoothing(10.0)
local out = im:laplacianofgaussian(10.0)
out:write("output.nrrd")
print(out:tensor())
out:fromtensor(im:tensor())
print(out:tensor())
local outtensor = torch.FloatTensor()
out:tensor(outtensor)
print(outtensor)
im:delete()
-- TODO: multichannel (not for now
--
--print(out:dim())
--print(out:spacing())
--out:spacing({4,4})
--print(out:spacing())
-- TODO: transform from tensor to itk image and back
--local im = itk.newimage3F32()
---- local im = itk.newimage('3F32')
---- or
---- local im = itk.newimage3F32()
--
--im:read("input.nrrd")
--
----local out = itk.NewImage3F32()
--
----itk.GaussianSmoothing3F32(im,out,1.0)
--
--local out = im:gaussiansmoothing(1.0)
--
---- TODO: this means that in already has information on the type (i.e. the suffix); itk.gaussiansmoothing has to dispatch on the type - how to do it economically?
---- just have a table of tuples to functions, where the tuple of the types of the arguments dispatches (a la Julia); NOPE: equality is just at the object level in Lua;
---- local out = itk.gaussiansmoothing(in,1.0)
--
--print(out:dim())
--print(out:spacing())
--out:spacing({4,4,4})
--print(out:spacing())
--
|
local _M = {}
--请使用和nginx_log_analysis 保持一致的配置
_M.influx_config = {
host = "",
database = "",
port = , --influxdb的HTTP API端口,默认是8086
}
--是个可读写的redis即可, qps的大小是根据你每个时间版本需要爬取的url(包含参数,每个版本的url会先 进行去重在爬取)有关。
_M.redis_conf = {
host = '',
port = ,
}
-- 配置爬取访问的Nginx地址,此Nginx是容灾系统的反向代理
_M.proxy_crash_nginx_servers = {
{
host = "",
port =
} ,
}
--请配置的和cache_proxy中的config的一致, 作用是更加版本的时间,来定时爬取,如果20分钟一个版本,那么就是20分钟爬取一次全量数据
_M.cache_version_updatetime = 20 -- number
--如果你需要多个爬虫服务,请将其中一台的hostname配置到此处,它是用来检查和更新influxdb的定时任务的
_M.hostname_crond = ''
--配置每次取出的URL数量,取多少就爬取多少。 默认是10秒获取一次url进行爬取,如果下面配置的是1500,就是指10秒内会爬取1500次URL,
--如果你的爬取的数量非常多,请适当加大你的爬取次数,这样可以确保每个版本的数据都是全的。如果规定时间内没有爬取完所有的url,那么请求会进入下一个时间版本继续爬取
_M.rpop_once_total = 1500
-- 请配置的和cache_proxy中的config的一致, 指定爬虫的user-agent, 爬虫是用来更新静态容灾的缓存数据
_M.spider_user_agent = 'static_dt_spider'
--临时文件,用来存放从influxdb导出json数据,数据是URL,供爬取使用
_M.tmp_url_file = '/tmp/ngx_org_url.json'
return _M
|
artifactreward34 = {
minimumLevel = 0,
maximumLevel = -1,
customObjectName = "Artifact 34",
directObjectTemplate = "object/tangible/collection/col_stage_controller_01.iff",
craftingValues = {
},
customizationStringNames = {},
customizationValues = {}
}
addLootItemTemplate("artifactreward34", artifactreward34)
|
hook.Add("LoadFonts", "nutNoticeFont", function(font, genericFont)
surface.CreateFont("nutNoticeFont", {
font = genericFont,
size = 16,
weight = 500,
extended = true,
antialias = true
})
end)
local PANEL = {}
PANEL.pnlTypes = {
[1] = { -- NOT ALLOWED
col = Color(200, 60, 60),
icon = "icon16/exclamation.png"
},
[2] = { -- COULD BE CANCELED
col = Color(255, 100, 100),
icon = "icon16/cross.png"
},
[3] = { -- WILL BE CANCELED
col = Color(255, 100, 100),
icon = "icon16/cancel.png"
},
[4] = { -- TUTORIAL/GUIDE
col = Color(100, 185, 255),
icon = "icon16/book.png"
},
[5] = { -- ERROR
col = Color(220, 200, 110),
icon = "icon16/error.png"
},
[6] = { -- YES
col = Color(64, 185, 85),
icon = "icon16/accept.png"
},
[7] = { -- TUTORIAL/GUIDE
col = Color(100, 185, 255),
icon = "icon16/information.png"
},
}
function PANEL:Init()
self.type = 1
self.text = self:Add("DLabel")
self.text:SetFont("nutNoticeFont")
self.text:SetContentAlignment(5)
self.text:SetTextColor(color_white)
self.text:SizeToContents()
self.text:Dock(FILL)
self.text:DockMargin(2, 2, 2, 2)
self.text:SetExpensiveShadow(1, Color(25, 25, 25, 120))
self:SetTall(28)
end
function PANEL:setType(value)
self.type = value
return
end
function PANEL:setText(value)
self.text:SetText(value)
end
function PANEL:setFont(value)
self.text:SetFont(value)
end
function PANEL:Paint()
self.material = nut.util.getMaterial(self.pnlTypes[self.type].icon)
local col = self.pnlTypes[self.type].col
local mat = self.material
local size = self:GetTall()*.6
local marg = 3
draw.RoundedBox(4, 0, 0, self:GetWide(), self:GetTall(), col)
if (mat) then
surface.SetDrawColor(color_white)
surface.SetMaterial(mat)
surface.DrawTexturedRect(size/2, self:GetTall()/2-size/2 + 1, size, size)
end
end
vgui.Register("nutNoticeBar", PANEL, "DPanel") |
--[[
## Widget
TankResource - An `table` holding `StatusBar`s.
## Sub-Widgets
.bg - A `Texture` used as a background. It will inherit the color of the main StatusBar.
## Sub-Widget Options
.multiplier - Used to tint the background based on the widget's R, G and B values. Defaults to 1 (number)[0-1]
## Options
.colors the RGB values for the widget.
.updateDealy the delay for the bar update values. Defaults to .1 (number)[0-1]
.costColor the resource noPowerCostColor flag Defaults to true (boolean)
.noPowerCostColor the RGB values for noPowerCost Defaults to {.9,.1,.1}
## Support Class
- WARRIOR
- DEMON HUNTER
- MONK
- DRUID
## Examples
local TankResource = {}
local maxLength = 4
for index = 1, maxLength do
local bar = CreateFrame('StatusBar', nil, self)
-- Position and size.
bar:SetSize(120 / maxLength, 20)
bar:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', (index - 1) * Bar:GetWidth(), 0)
TankResource[index] = bar
end
-- Register with oUF
self.TankResource = TankResource
## Notes
####if you use custom color bar then
-- SetCustomColor
TankResource.colors = {
["WARRIOR"] = {.2,.5,.7},
["PALDAIN"] = {.6,.4,.5},
["DEMONHUNTER"] = {.7,.6,.4},
["MONK"] = {.7,.6,.4},
}
TankResouce.noPowerCostColor = {
.9,
.1,
.1,
}
#### if resourceStack is changed you can override MaxChangeUpdate function to changed size.
TankResource.MaxChangeUpdate = function(self,maxCharge)
for i = 1, maxCharge do
local bar = self[i]
bar:SetSize(120/maxCharge,20)
bar:SetPoint('TOPLEFT', self, 'BOTTOMLEFT', (i - 1) * Bar:GetWidth(), 0)
end
end
]] --
-----------------------------
-- all credits to HopeAsd. --
-----------------------------
local addon, ns = ...
local C, F, G, T = unpack(ns)
local oUF = ns.oUF or oUF
if not C.TankResource then return end
local _, PlayerClass = UnitClass('player')
local SPEC_MONK_BREWMASTER = SPEC_MONK_BREWMASTER or 1
local SPEC_DEATHKNIGHT_BLOOD = SPEC_DEATHKNIGHT_BLOOD or 1
local SPEC_DEMONHUNTER_VENGEANCE = SPEC_DEMONHUNTER_VENGEANCE or 2
local SPEC_WARRIOR_PROTECTION = SPEC_WARRIOR_PROTECTION or 3
-- local SPEC_PALADIN_PROTECTION = SPEC_PALADIN_PROTECTION or 2
local SPEC_DRUID_GUARDIAN = SPEC_DRUID_GUARDIAN or 3
local GetSpellCooldown, GetSpellCharges, GetSpellCount, UnitSpellHaste, GetTime,
UnitIsUnit, GetSpecialization, UnitHasVehicleUI, IsPlayerSpell,
CreateFrame = GetSpellCooldown, GetSpellCharges, GetSpellCount,
UnitSpellHaste, GetTime, UnitIsUnit, GetSpecialization,
UnitHasVehicleUI, IsPlayerSpell, CreateFrame
local TankResourceEnable, TankResourceDisable
-- {enable,spell,spec}
local enableState = {}
--[[
TODO:
1 Paladin tankResource
2 StatusBar update Type(ChargesCooldown,AuraDuration,AuraStacks)
]]
--[[
[PlayerClassName] = {SPECNUMBER,SPELL,SPECIALSEVENTS,UPDATETYPE}
PlayerClassName - string
SPECNUMBER - number
SPECIALSEVENTS - table(string)
UPDATETYPE - number
1. ChargesCooldown
2. AuraDuration
3. AuraStacks (like Druid_Guardian 铁鬃)
]]
local enableClassAndSpec = {
['MONK'] = {SPEC_MONK_BREWMASTER, 119582},
['DEMONHUNTER'] = {SPEC_DEMONHUNTER_VENGEANCE, 203720},
['WARRIOR'] = {SPEC_WARRIOR_PROTECTION, 2565},
['DRUID'] = {SPEC_DRUID_GUARDIAN, 22842},
['DEATHKNIGHT'] = {SPEC_DEATHKNIGHT_BLOOD, 194679}
}
--[[
return 是否能开启模块的状态
]]
local function GetEnableStateAndSpell()
if enableClassAndSpec[PlayerClass] then
local spec, spell = unpack(enableClassAndSpec[PlayerClass])
if spec == GetSpecialization() and IsPlayerSpell(spell) then
return true, spell
end
end
return false, nil
end
-- 自制的获取时间方法
local function GetResourceCooldown(spell)
local start, dur, enable = GetSpellCooldown(spell)
local charges, maxCharges, startCharges, durCharges = GetSpellCharges(spell);
local stack = charges or GetSpellCount(spell)
local gcd = math.max((1.5 / (1 + (UnitSpellHaste("player") / 100))), 0.75)
start = start or 0
dur = dur or 0
startCharges = startCharges or 0
durCharges = durCharges or 0
if enable == 0 then start, dur = 0, 0 end
local startTime, duration = start, dur
if charges == maxCharges then
start, dur = 0, 0
startCharges, durCharges = 0, 0
elseif charges > 0 then
startTime, duration = startCharges, durCharges
end
if gcd == duration then startTime, duration = 0, 0 end
return stack, maxCharges, startTime, duration
end
-- 把Aura API 返回的方法转换成进度比 取值[0,100]
local function GetProgress(startTime, duration)
if startTime == 0 and duration == 0 then return 100 end
local nowTime = GetTime() -- nowTime
local startTime = startTime -- startTime
local expirTime = startTime + nowTime -- expirTime
local progress = (nowTime - startTime) / (duration)
return progress * 100
end
-- 颜色更改
-- 需要在element.colors中声明
-- 返回能量的颜色
local function UpdateColor(element)
local color = element.__owner.colors.power[4]
if (spec ~= 0 and element.colors) then
color = element.colors[PlayerClass]
end
local r, g, b = color[1], color[2], color[3]
for i = 1, #element do
local bar = element[i]
bar:SetStatusBarColor(r, g, b)
local bg = bar.bg
if bg then
local mu = bg.multiplier or 1
bg:SetVertexColor(r * mu, g * mu, b * mu)
end
end
end
local UsableUpdateEvents = {
["SPELL_UPDATE_USABLE"] = true,
["PLAYER_TARGET_CHANGED"] = true,
["UNIT_POWER_FREQUENT"] = true
}
local function UpdateUsableColor(element)
if not enableState.enable then return end
if not element.costColor then return end
local costColor = element.noPowerCostColor
local color = element.__owner.colors.power[4]
local usable, noMana = IsUsableSpell(enableState.spell)
local r, g, b = costColor[1], costColor[2], costColor[3]
if (not usable) and noMana then
for i = 1, #element do
local bar = element[i]
bar:SetStatusBarColor(r, g, b)
end
elseif usable then
r, g, b = color[1], color[2], color[3]
for i = 1, #element do
local bar = element[i]
bar:SetStatusBarColor(r, g, b)
end
end
end
-- 更新计时条的进度
-- 仅在需要更新时进行
local function onUpdate(self, elapsed)
if not enableState.enable then return end
local element = self.__owner.TankResource
-- self.elapsed = (self.elapsed or 0) + elapsed
-- if self.elapsed > element.updateDelay then
local cur, maxCharges, start, duration
if element.CooldownUpdate then
cur, maxCharges, start, duration =
GetResourceCooldown(enableState.spell)
if cur == maxCharges then element.CooldownUpdate = false end
for i = maxCharges, 1, -1 do
if element[i].needUpdate then
if cur + 1 == i then
element[i]:SetValue(GetProgress(start, duration))
end
end
end
end
-- end
end
-- 更新
local function Update(self, event, unit)
if (unit and unit ~= self.unit) then return end
if not enableState.enable then return end
-- 预留 PreUpdate
local element = self.TankResource
if element.PreUpdate then element:PreUpdate(event) end
if UsableUpdateEvents[event] then return UpdateUsableColor(element) end
local cur, maxCharges, oldMax, start, duration
cur, maxCharges, start, duration = GetResourceCooldown(enableState.spell)
for i = 1, maxCharges do
if cur + 1 == i then
element[i].needUpdate = true
elseif cur < i then
element[i]:SetValue(0)
element[i].needUpdate = false
else
element[i]:SetValue(100)
end
if not element[i]:IsShown() and element.init then
element[i]:Show()
end
end
if cur ~= maxCharges then element.CooldownUpdate = true end
oldMax = element.__max
if element.init then
if maxCharges + 1 >= oldMax then
for i = maxCharges + 1, oldMax do
element[i]:Hide()
element[i]:SetValue(0)
end
end
element.init = false
end
if (maxCharges ~= oldMax) then
if (maxCharges < oldMax) then
for i = maxCharges + 1, oldMax do
element[i]:Hide()
element[i]:SetValue(0)
end
else
for i = oldMax, maxCharges do element[i]:Show() end
end
-- 预留最大层数变化接口
if element.MaxChangeUpdate then
element:MaxChangeUpdate(maxCharges)
end
element.__max = maxCharges
end
-- 预留 PostUpdate
if element.PostUpdate then
-- return element:PostUpdate(cur, maxCharges, start, duration)
return element:PostUpdate(cur, maxCharges, oldMax ~= max, start,
duration)
end
end
local function EnableEvent(self,spell) end
local function DisableEvent(self) enableState = {} end
-- 真实更新的转接方法 预留覆盖API
local function Path(self, event, ...)
if event == "TankResourceEnable" then
(self.TankResource.OverrideEnableEvent or EnableEvent)(self,...)
elseif event == "TankResourceDisable" then
return (self.TankResource.OverrideDisableEvent or DisableEvent)(self,...)
end
return (self.TankResource.Override or Update)(self, event, ...)
end
-- 判断是否让元素显示
local function Visibility(self, event, unit)
local element = self.TankResource
local shouleEnable = false
-- 当有载具UI时 不显示
if UnitHasVehicleUI('player') then
unit = 'vehicle'
shouleEnable = false
else
local enable, spell = GetEnableStateAndSpell()
if enable and spell then
shouleEnable = enable
unit = 'player'
if not enableState.spec or enableState.spec ~= GetSpecialization() then
enableState.spell = spell
enableState.spec = GetSpecialization()
end
end
end
local isEnabled = element.isEnabled
local spell = enableState.spell
-- 如果当前状态可以开启模块显示 则提前设置颜色
if shouleEnable then (element.UpdateColor or UpdateColor)(element) end
if shouleEnable and not isEnabled then
TankResourceEnable(self)
elseif not shouleEnable and (isEnabled or isEnabled == nil) then
TankResourceDisable(self)
elseif shouleEnable and isEnabled then
Path(self, event, spell, unit)
end
end
-- 这里是判断是否让元素显示的转接方法 预留了覆盖的方法
local function VisibilityPath(self, ...)
return (self.TankResource.OverrideVisibility or Visibility)(self, ...)
end
-- 预留的API 当Visibility的更新被预留的API覆盖时 可以使用的预留API
local function ForceUpdate(element)
return VisibilityPath(element.__owner, 'ForceUpdate')
end
do
-- 当资源真正开启时
function TankResourceEnable(self)
-- 这里注册监视事件
self:RegisterEvent('SPELL_UPDATE_COOLDOWN', Path, true)
self:RegisterEvent('PLAYER_TALENT_UPDATE', Path, true)
-- self:RegisterEvent('SPELL_UPDATE_CHARGES', Path, true)
if self.TankResource.costColor then
for k in pairs(UsableUpdateEvents) do
self:RegisterEvent(k, Path, true)
end
end
-- 创建用于更新进度的框架
local _timeHandler = CreateFrame("Frame")
_timeHandler.__owner = self
-- _timeHandler:SetScript('OnUpdate', onUpdate)
_timeHandler:SetScript("OnUpdate", function(_, elapsed)
_timeHandler.elapsed = (_timeHandler.elapsed or 0) + elapsed
if _timeHandler.elapsed > self.TankResource.updateDelay then
onUpdate(_timeHandler)
_timeHandler.elapsed = 0
end
end)
self._timeHandler = _timeHandler
self.TankResource.isEnabled = true
self.TankResource.init = true
enableState.enable = true
-- 进行初始化
Path(self, 'TankResourceEnable', enableState.spell)
end
function TankResourceDisable(self)
-- 这里取消注册事件
self:UnregisterEvent('SPELL_UPDATE_COOLDOWN', Path)
self:UnregisterEvent('PLAYER_TALENT_UPDATE', Path)
-- self:UnregisterEvent('SPELL_UPDATE_CHARGES', Path)
if self.TankResource.costColor then
for k in pairs(UsableUpdateEvents) do
self:UnregisterEvent(k, Path)
end
end
if self._timeHandler then
self._timeHandler:SetScript('OnUpdate', nil)
end
-- 隐藏
local element = self.TankResource
for i = 1, #element do element[i]:Hide() end
self.TankResource.isEnabled = false
self.TankResource.CooldownUpdate = false
enableState.enable = false
-- 进行关闭
Path(self, 'TankResourceDisable', enableState.spell)
end
end
-- 模块开启
local function Enable(self, unit)
-- 不是玩家自己就退出
if unit ~= "player" then return end
local element = self.TankResource
-- 初始化
if element then
element.__owner = self
element.__max = #element
element.updateDelay = .2
element.noPowerCostColor = {.9, .1, .1, 1}
element.costColor = true
element.ForceUpdate = ForceUpdate
-- 这里注册用于判断是否显示的事件 用于更新是否显隐
self:RegisterEvent('PLAYER_TALENT_UPDATE', VisibilityPath, true)
-- self:RegisterEvent('SPELLS_CHANGED', VisibilityPath, true)
self:RegisterEvent('PLAYER_SPECIALIZATION_CHANGED', VisibilityPath)
self:RegisterEvent('PLAYER_ENTERING_WORLD', VisibilityPath)
element.TankResourceEnable = TankResourceEnable
element.TankResourceDisable = TankResourceDisable
-- 对没有预置材质的进度条进行 材质设置
-- 对进度条的进度条取值进行设置
for i = 1, #element do
local bar = element[i]
if (bar:IsObjectType('StatusBar')) then
if (not bar:GetStatusBarTexture()) then
bar:SetStatusBarTexture(
[[Interface\TargetingFrame\UI-StatusBar]])
end
bar:SetMinMaxValues(0, 100)
end
end
return true
end
end
local function Disable(self)
if self.TankResource then
TankResourceDisable(self)
-- 这里解除注册用于判断是否显示的事件
self:UnregisterEvent('PLAYER_TALENT_UPDATE', VisibilityPath)
-- self:UnregisterEvent('SPELLS_CHANGED', VisibilityPath)
self:UnregisterEvent('PLAYER_SPECIALIZATION_CHANGED', VisibilityPath)
self:UnregisterEvent('PLAYER_ENTERING_WORLD', VisibilityPath)
end
end
oUF:AddElement('TankResource', VisibilityPath, Enable, Disable)
|
ActiveRecord.define_model('attributes', function(t)
t:string 'attr_id'
t:integer 'character_id'
t:integer 'value'
end)
ActiveRecord.define_model('attribute_multipliers', function(t)
t:integer 'attribute_id'
t:integer 'value'
t:timestamp 'expires'
end)
ActiveRecord.define_model('attribute_boosts', function(t)
t:integer 'attribute_id'
t:integer 'value'
t:timestamp 'expires'
end)
|
--By nicholasgower
local initial_recipes=require("initial-recipes")
for key, value in ipairs(initial_recipes) do
local item=table.deepcopy(data.raw["recipe"][value])
item.enabled=false
if item.normal ~= nil then
item.normal.enabled=false
end
if item.expensive ~= nil then
item.expensive.enabled=false
end
data:extend({item})
end
|
---
--- 通用的枚举定义
---
-- UI界面枚举
ECEnumType.UIEnum = {
} |
starlight_background=Class(object)
function starlight_background:init()
--
background.init(self,false)
--resource
LoadTexture('starlight_ground','THlib\\background\\starlight\\ground.png')
LoadImage('starlight_ground','starlight_ground',0,0,256,256,0,0)
LoadTexture('starlight','THlib\\background\\starlight\\starlight.png')
LoadImage('noir','starlight',488,0,22,512,0,0)
SetImageCenter('noir',12,512)
LoadImage('star1','starlight',0,0,256,256,0,0)
LoadImage('star2','starlight',0,256,320,256,0,0)
LoadImageFromFile('stair','THlib\\background\\starlight\\stair.png')
LoadImageFromFile('window','THlib\\background\\starlight\\windows.png')
SetImageState('noir','mul+add')
SetImageState('star1','mul+add')
SetImageState('star2','mul+add')
SetImageState('stair','mul+alpha',Color(255,255,255,255))
--set 3d camera and fog
Set3D('eye',-1.9,-3.3,-8.6)
Set3D('at',-0.4,0.9,2.5)
Set3D('up',1.24,1.1,0.1)
Set3D('z',2.1,1000)
Set3D('fovy',0.7)
Set3D('fog',7,1000,Color(200,10,10,27))
--
self.list={}
self.liststart=1
self.listend=0
self.imgs={'noir','star1','star2','stair'}
self.speed=0.1
self.interval=0.5
self.acc=self.interval
self.angle=0
self.z=0
for i=1,1000 do starlight_background.frame(self) end
for j=1,500 do
local z=-3+0.04*self.angle
self.listend=self.listend+1
self.list[self.listend]={4,self.angle,0,0,0,z}
self.angle=self.angle+10
end
end
rnd=math.random
function starlight_background:frame()
self.z=self.z+self.speed/2
---Set3D('eye',3.35*cos(self.timer/4),3.35*sin(self.timer/4),-8.6)
---Set3D('up',2*sin(self.timer/20),1.1,0.1)
self.acc=self.acc+self.speed
if self.acc>=self.interval then
self.acc=self.acc-self.interval
self.acc=self.acc-self.interval
local a=0
local R=rnd(1.4,60)
for _=1,3 do
a=rnd(0,360)
x=R*cos(a)
y=2+R*sin(a)
self.listend=self.listend+1
self.list[self.listend]={rnd(2,3), x,y,rnd()*0.6-0.3,-0.7-0.3*rnd(),rnd(-1,100)}
end
---if self.timer%2==0 then
local z=-3+0.04*self.angle
self.listend=self.listend+1
self.list[self.listend]={4,self.angle,0,0,0,z}
self.angle=self.angle+10
---end
end
for i=self.liststart,self.listend do
if self.list[i][1]~=4 then
self.list[i][6]=self.list[i][6]-self.speed
else
self.list[i][6]=self.list[i][6]-self.speed/4
end
end
while true do
if self.list[self.liststart][6]<-6 then
self.list[self.liststart]=nil
self.liststart=self.liststart+1
else break
end
if self.list[self.liststart][1]==4 then
if self.list[self.liststart][6]>4 then
self.list[self.liststart]=nil
self.liststart=self.liststart+1
else break
end
end
end
end
function starlight_background:render()
SetViewMode'3d'
local showboss = IsValid(_boss)
if showboss then
PostEffectCapture()
end
RenderClear(lstg.view3d.fog[3])
for j=0,20 do
local dz=j*40-math.mod(self.z,40)
-- starlight_background.draw_windows(0,0,-5+dz,35+dz)
end
for i=self.listend,self.liststart,-1 do
local p=self.list[i]
if p[1]~=4 then
-- Render(self.imgs[p[1]],p[2]+rnd(-0.1,0.1),p[3]+rnd(-0.1,0.1),p[4]*57,p[5]/2,abs(p[5]/2),p[6])
Render(self.imgs[p[1]],p[2],p[3],p[4]*57,p[5]/2,abs(p[5]/2),p[6])
else
-- Render_4_point(p[2],6,10,2,'stair',p[6])
end
end
if showboss then
local x,y = WorldToScreen(_boss.x,_boss.y)
local x1 = x * screen.scale
local y1 = (screen.height - y) * screen.scale
local fxr = _boss.fxr or 163
local fxg = _boss.fxg or 73
local fxb = _boss.fxb or 164
PostEffectApply("boss_distortion", "", {
centerX = x1,
centerY = y1,
size = _boss.aura_alpha*200*lstg.scale_3d,
color = Color(125,fxr,fxg,fxb),
colorsize = _boss.aura_alpha*200*lstg.scale_3d,
arg=1500*_boss.aura_alpha/128*lstg.scale_3d,
timer = self.timer
})
end
SetViewMode'world'
end
function Render_4_point(angle,r,angle_offset,r_,imagename,z)
local A_1 = angle+angle_offset
local R_1 = r-r_
local x1,x2,x3,x4,y1,y2,y3,y4
x1=(r)*cos(A_1)
y1=(r)*sin(A_1)
x2=(r)*cos(angle)
y2=(r)*sin(angle)
x3=(R_1)*cos(angle)
y3=(R_1)*sin(angle)
x4=(R_1)*cos(A_1)
y4=(R_1)*sin(A_1)
Render4V(imagename,x1,y1,z,x2,y2,z,x3,y3,z,x4,y4,z)
end
function starlight_background.draw_windows(x,y,z1,z2)
local r=45
local a=0
for _=1,12 do
Render4V('window',
x+r*cos(a-15),y+r*sin(a-15),z1,
x+r*cos(a+15),y+r*sin(a+15),z1,
x+r*cos(a+15),y+r*sin(a+15),z2,
x+r*cos(a-15),y+r*sin(a-15),z2)
a=a+30
end
end
|
script.on_event("momo-debug", function(e)
if settings.startup["momo-debug"].value then
local logging = ""
local p = game.players[1]
local slot = 1
local items = {}
for name, count in pairs(p.get_main_inventory().get_contents()) do
p.print("["..slot.."]" .. name .. " " .. count)
logging = logging .. " " .. name .. " "
table.insert(items, name)
slot = slot + 1
end
p.color = {r = 0, g = 204/255, b = 153/255, a = 1}
for i, item in ipairs(items) do
p.print(item)
end
log("MIRTL " .. logging)
end
end)
|
local concat
do
local _obj_0 = table
concat = _obj_0.concat
end
local raw_query, logger
local proxy_location = "/query"
local set_logger
set_logger = function(l)
logger = l
end
local get_logger
get_logger = function()
return logger
end
set_logger(require("lapis.logging"))
local type, tostring, pairs, select
do
local _obj_0 = _G
type, tostring, pairs, select = _obj_0.type, _obj_0.tostring, _obj_0.pairs, _obj_0.select
end
local NULL = { }
local raw
raw = function(val)
return {
"raw",
tostring(val)
}
end
local is_raw
is_raw = function(val)
return type(val) == "table" and val[1] == "raw" and val[2]
end
local TRUE = raw("TRUE")
local FALSE = raw("FALSE")
local backends = {
default = function(_proxy)
if _proxy == nil then
_proxy = proxy_location
end
local parser = require("rds.parser")
raw_query = function(str)
if logger then
logger.query(str)
end
local res, m = ngx.location.capture(_proxy, {
body = str
})
local out, err = parser.parse(res.body)
if not (out) then
error(tostring(err) .. ": " .. tostring(str))
end
do
local resultset = out.resultset
if resultset then
return resultset
end
end
return out
end
end,
raw = function(fn)
do
raw_query = fn
return raw_query
end
end,
["resty.postgres"] = function(opts)
opts.host = opts.host or "127.0.0.1"
opts.port = opts.port or 5432
local pg = require("lapis.resty.postgres")
raw_query = function(str)
if logger then
logger.query(str)
end
local conn = pg:new()
conn:set_keepalive(0, 100)
assert(conn:connect(opts))
return assert(conn:query(str))
end
end
}
local set_backend
set_backend = function(name, ...)
if name == nil then
name = "default"
end
return assert(backends[name])(...)
end
local format_date
format_date = function(time)
return os.date("!%Y-%m-%d %H:%M:%S", time)
end
local append_all
append_all = function(t, ...)
for i = 1, select("#", ...) do
t[#t + 1] = select(i, ...)
end
end
local escape_identifier
escape_identifier = function(ident)
if type(ident) == "table" and ident[1] == "raw" then
return ident[2]
end
ident = tostring(ident)
return '"' .. (ident:gsub('"', '""')) .. '"'
end
local escape_literal
escape_literal = function(val)
local _exp_0 = type(val)
if "number" == _exp_0 then
return tostring(val)
elseif "string" == _exp_0 then
return "'" .. tostring((val:gsub("'", "''"))) .. "'"
elseif "boolean" == _exp_0 then
return val and "TRUE" or "FALSE"
elseif "table" == _exp_0 then
if val == NULL then
return "NULL"
end
if val[1] == "raw" and val[2] then
return val[2]
end
end
return error("don't know how to escape value: " .. tostring(val))
end
local interpolate_query
interpolate_query = function(query, ...)
local values = {
...
}
local i = 0
return (query:gsub("%?", function()
i = i + 1
return escape_literal(values[i])
end))
end
local encode_values
encode_values = function(t, buffer)
local have_buffer = buffer
buffer = buffer or { }
local tuples
do
local _accum_0 = { }
local _len_0 = 1
for k, v in pairs(t) do
_accum_0[_len_0] = {
k,
v
}
_len_0 = _len_0 + 1
end
tuples = _accum_0
end
local cols = concat((function()
local _accum_0 = { }
local _len_0 = 1
for _index_0 = 1, #tuples do
local pair = tuples[_index_0]
_accum_0[_len_0] = escape_identifier(pair[1])
_len_0 = _len_0 + 1
end
return _accum_0
end)(), ", ")
local vals = concat((function()
local _accum_0 = { }
local _len_0 = 1
for _index_0 = 1, #tuples do
local pair = tuples[_index_0]
_accum_0[_len_0] = escape_literal(pair[2])
_len_0 = _len_0 + 1
end
return _accum_0
end)(), ", ")
append_all(buffer, "(", cols, ") VALUES (", vals, ")")
if not (have_buffer) then
return concat(buffer)
end
end
local encode_assigns
encode_assigns = function(t, buffer)
local join = ", "
local have_buffer = buffer
buffer = buffer or { }
for k, v in pairs(t) do
append_all(buffer, escape_identifier(k), " = ", escape_literal(v), join)
end
buffer[#buffer] = nil
if not (have_buffer) then
return concat(buffer)
end
end
local encode_clause
encode_clause = function(t, buffer)
local join = " AND "
local have_buffer = buffer
buffer = buffer or { }
for k, v in pairs(t) do
if v == NULL then
append_all(buffer, escape_identifier(k), " IS NULL", join)
else
append_all(buffer, escape_identifier(k), " = ", escape_literal(v), join)
end
end
buffer[#buffer] = nil
if not (have_buffer) then
return concat(buffer)
end
end
raw_query = function(...)
set_backend("default")
return raw_query(...)
end
local query
query = function(str, ...)
if select("#", ...) > 0 then
str = interpolate_query(str, ...)
end
return raw_query(str)
end
local _select
_select = function(str, ...)
return query("SELECT " .. str, ...)
end
local _insert
_insert = function(tbl, values, ...)
if values._timestamp then
values._timestamp = nil
local time = format_date()
values.created_at = values.created_at or time
values.updated_at = values.updated_at or time
end
local buff = {
"INSERT INTO ",
escape_identifier(tbl),
" "
}
encode_values(values, buff)
local returning = {
...
}
if next(returning) then
append_all(buff, " RETURNING ")
for i, r in ipairs(returning) do
append_all(buff, escape_identifier(r))
if i ~= #returning then
append_all(buff, ", ")
end
end
end
return raw_query(concat(buff))
end
local add_cond
add_cond = function(buffer, cond, ...)
append_all(buffer, " WHERE ")
local _exp_0 = type(cond)
if "table" == _exp_0 then
return encode_clause(cond, buffer)
elseif "string" == _exp_0 then
return append_all(buffer, interpolate_query(cond, ...))
end
end
local _update
_update = function(table, values, cond, ...)
if values._timestamp then
values._timestamp = nil
values.updated_at = values.updated_at or format_date()
end
local buff = {
"UPDATE ",
escape_identifier(table),
" SET "
}
encode_assigns(values, buff)
if cond then
add_cond(buff, cond, ...)
end
return raw_query(concat(buff))
end
local _delete
_delete = function(table, cond, ...)
local buff = {
"DELETE FROM ",
escape_identifier(table)
}
if cond then
add_cond(buff, cond, ...)
end
return raw_query(concat(buff))
end
local _truncate
_truncate = function(...)
local tables = concat((function(...)
local _accum_0 = { }
local _len_0 = 1
local _list_0 = {
...
}
for _index_0 = 1, #_list_0 do
local t = _list_0[_index_0]
_accum_0[_len_0] = escape_identifier(t)
_len_0 = _len_0 + 1
end
return _accum_0
end)(...), ", ")
return raw_query("TRUNCATE " .. tables .. " RESTART IDENTITY")
end
local parse_clause
do
local grammar
local make_grammar
make_grammar = function()
local keywords = {
"where",
"group",
"having",
"order",
"limit",
"offset"
}
for _index_0 = 1, #keywords do
local v = keywords[_index_0]
keywords[v] = true
end
local P, R, C, S, Cmt, Ct, Cg
do
local _obj_0 = require("lpeg")
P, R, C, S, Cmt, Ct, Cg = _obj_0.P, _obj_0.R, _obj_0.C, _obj_0.S, _obj_0.Cmt, _obj_0.Ct, _obj_0.Cg
end
local alpha = R("az", "AZ", "__")
local alpha_num = alpha + R("09")
local white = S(" \t\r\n") ^ 0
local word = alpha_num ^ 1
local single_string = P("'") * (P("''") + (P(1) - P("'"))) ^ 0 * P("'")
local double_string = P('"') * (P('""') + (P(1) - P('"'))) ^ 0 * P('"')
local strings = single_string + double_string
local keyword = Cmt(word, function(src, pos, cap)
if keywords[cap:lower()] then
return true, cap
end
end)
keyword = keyword * white
local clause = Ct((keyword * C((strings + (word + P(1) - keyword)) ^ 1)) / function(name, val)
if name == "group" or name == "order" then
val = val:match("^%s*by%s*(.*)$")
end
return name, val
end)
grammar = white * Ct(clause ^ 0)
end
parse_clause = function(clause)
if not (grammar) then
make_grammar()
end
do
local out = grammar:match(clause)
if out then
local _tbl_0 = { }
for _index_0 = 1, #out do
local t = out[_index_0]
local _key_0, _val_0 = unpack(t)
_tbl_0[_key_0] = _val_0
end
return _tbl_0
end
end
end
end
return {
query = query,
raw = raw,
is_raw = is_raw,
NULL = NULL,
TRUE = TRUE,
FALSE = FALSE,
escape_literal = escape_literal,
escape_identifier = escape_identifier,
encode_values = encode_values,
encode_assigns = encode_assigns,
encode_clause = encode_clause,
interpolate_query = interpolate_query,
parse_clause = parse_clause,
set_logger = set_logger,
get_logger = get_logger,
format_date = format_date,
set_backend = set_backend,
select = _select,
insert = _insert,
update = _update,
delete = _delete,
truncate = _truncate
}
|
DEFINE_BASECLASS("ma2_battlesuit")
AddCSLuaFile()
ENT.Base = "ma2_battlesuit"
ENT.PrintName = "#mechassault.battlesuit.armor"
if CLIENT then
ENT.Category = language.GetPhrase("mechassault.categories.light")
end
ENT.Spawnable = true
ENT.Radius = 26
ENT.Height = 90
ENT.Model = Model("models/mechassault_2/mechs/battle_armor.mdl")
ENT.Skin = 0
ENT.ViewOffset = Vector(-100, 0, 50)
ENT.MaxHealth = 1012
ENT.CoreAttachment = 5
ENT.WeaponLoadout = {
{Type = "PulseLaser", Level = 1, Attachments = {4}},
{Type = "Mortar", Level = 1, Attachments = {3}}
}
ENT.JumpJets = {1, 2}
function ENT:GetAnimationSpeeds()
return 40, 100
end
function ENT:GetSpeeds()
return 100, 235
end
|
lightning = {}
local Lightning = {}
Lightning.__index = Lightning
lightning.metatable = Lightning
function lightning.create(strCodeName, checkVisibility, x1, y1, x2, y2)
local table = {}
setmetatable(table, Lightning)
table.handle = AddLightning(strCodeName, checkVisibility, x1, y1, x2, y2)
return table
end
function Lightning:move(checkVisibility, x1, y1, x2, y2)
MoveLightning(self.handle, checkVisibility, x1, y1, x2, y2)
end
function Lightning:destroy()
return DestroyLightning(self.handle)
end |
if UseItem(162) == true then goto label0 end;
do return end;
::label0::
AddItem(162, -1);
SetScenceMap(-2, 1, 21, 30, 3698);--by fanyu|门打开。场景08-编号0607
SetScenceMap(-2, 1, 21, 31, 0);--by fanyu|门打开。场景08-编号0607
SetScenceMap(-2, 1, 20, 30, 3696);--by fanyu|门打开。场景08-编号0607
jyx2_ReplaceSceneObject("", "Bake/Static/Door/Door_03", "");
ModifyEvent(-2, 6, 0, 0, -1, -1, -1, -1, -1, -1, -2, -2, -2);--by fanyu|门打开。场景08-编号0607
ModifyEvent(-2, 7, 0, 0, -1, -1, -1, -1, -1, -1, -2, -2, -2);--by fanyu|门打开。场景08-编号0607
AddEthics(2);
do return end;
|
local mod = get_mod("StreamingInfo")
local pl = require'pl.import_into'()
mod.SETTING_NAMES = {}
local mod_data = {
name = "Streaming Info",
description = mod:localize("mod_description"),
is_togglable = true,
}
mod_data.options_widgets = pl.List()
mod.localizations = mod.localizations or pl.Map()
mod.add_option = function(setting_name, option_widget, en_text, en_tooltip, group, index)
mod.SETTING_NAMES[setting_name] = setting_name
option_widget.setting_name = setting_name
if en_text then
mod.localizations[setting_name] = {
en = en_text
}
end
if en_tooltip then
mod.localizations[setting_name.."_T"] = {
en = en_tooltip
}
end
option_widget.text = mod:localize(setting_name)
option_widget.tooltip = mod:localize(setting_name.."_T")
option_widget.sub_widgets = {}
if not group then
index = index or #mod_data.options_widgets + 1
mod_data.options_widgets:insert(index, option_widget)
else
index = index or #group + 1
table.insert(group, index, option_widget)
end
return option_widget.sub_widgets
end
local additional_lines_subs = mod.add_option(
"ADDITIONAL_LINES_GROUP",
{
["widget_type"] = "group",
},
"Show Additional Info",
"Add additional lines."
)
mod.add_option(
"ONS_DW_INFO_TEMP",
{
["widget_type"] = "checkbox",
["default_value"] = true,
},
"Onslaught And Deathwish Temp",
"Auto-add lines for Onslaught and Deathwish to temporary lines."
.."\nThis requires the DwOns QoL mod to work.",
additional_lines_subs
)
mod.add_option(
"ONS_DW_INFO",
{
["widget_type"] = "checkbox",
["default_value"] = false,
},
"Onslaught And Deathwish",
"Auto-add lines for Onslaught and Deathwish to permanent lines."
.."\nThis requires the DwOns QoL mod to work.",
additional_lines_subs
)
mod.add_option(
"MUTATORS_INFO_TEMP",
{
["widget_type"] = "checkbox",
["default_value"] = true,
},
"Active FS Mutators Temp",
"Auto-add lines for active Fatshark mutators to temporary lines.",
additional_lines_subs
)
mod.add_option(
"MUTATORS_INFO",
{
["widget_type"] = "checkbox",
["default_value"] = false,
},
"Active FS Mutators",
"Auto-add lines for active Fatshark mutators to permanent lines.",
additional_lines_subs
)
mod.add_option(
"RED",
{
["widget_type"] = "numeric",
["range"] = {0, 255},
["default_value"] = 255,
}
)
mod.add_option(
"GREEN",
{
["widget_type"] = "numeric",
["range"] = {0, 255},
["default_value"] = 255,
}
)
mod.add_option(
"BLUE",
{
["widget_type"] = "numeric",
["range"] = {0, 255},
["default_value"] = 255,
}
)
mod.add_option(
"BG_OPACITY",
{
["widget_type"] = "numeric",
["range"] = {0, 255},
["default_value"] = 100,
},
"Opacity",
"Background opacity."
)
mod.add_option(
"FONT_SIZE",
{
["widget_type"] = "numeric",
["range"] = {10, 40},
["default_value"] = 24,
}
)
mod.add_option(
"LINE_SPACING",
{
["widget_type"] = "numeric",
["range"] = {-50, 50},
["unit_text"] = "px",
["default_value"] = -2,
}
)
mod.add_option(
"OFFSET_X",
{
["widget_type"] = "numeric",
["range"] = {-10, 3500},
["unit_text"] = "px",
["default_value"] = 0,
}
)
mod.add_option(
"OFFSET_Y",
{
["widget_type"] = "numeric",
["range"] = {-3500, 30},
["unit_text"] = "px",
["default_value"] = 0,
}
)
local perm_info_subs = mod.add_option(
"PERM_INFO_GROUP",
{
["widget_type"] = "group",
},
"Permanent Info",
"Setting related to permanent lines set with /info."
)
mod.add_option(
"PERM_RED",
{
["widget_type"] = "numeric",
["range"] = {0, 255},
["default_value"] = 255,
},
nil,
nil,
perm_info_subs
)
mod.add_option(
"PERM_GREEN",
{
["widget_type"] = "numeric",
["range"] = {0, 255},
["default_value"] = 255,
},
nil,
nil,
perm_info_subs
)
mod.add_option(
"PERM_BLUE",
{
["widget_type"] = "numeric",
["range"] = {0, 255},
["default_value"] = 255,
},
nil,
nil,
perm_info_subs
)
mod.add_option(
"PERM_BG_OPACITY",
{
["widget_type"] = "numeric",
["range"] = {0, 255},
["default_value"] = 100,
},
"Perm Opacity",
"Background opacity.",
perm_info_subs
)
mod.add_option(
"PERM_FONT_SIZE",
{
["widget_type"] = "numeric",
["range"] = {10, 40},
["default_value"] = 24,
},
nil,
nil,
perm_info_subs
)
mod.add_option(
"PERM_LINE_SPACING",
{
["widget_type"] = "numeric",
["range"] = {-50, 50},
["unit_text"] = "px",
["default_value"] = -2,
},
nil,
nil,
perm_info_subs
)
mod.add_option(
"PERM_OFFSET_X",
{
["widget_type"] = "numeric",
["range"] = {-10, 3500},
["unit_text"] = "px",
["default_value"] = 500,
},
nil,
nil,
perm_info_subs
)
mod.add_option(
"PERM_OFFSET_Y",
{
["widget_type"] = "numeric",
["range"] = {-3500, 30},
["unit_text"] = "px",
["default_value"] = 0,
},
nil,
nil,
perm_info_subs
)
return mod_data
|
-- Created by Elfansoer
--[[
Ability checklist (erase if done/checked):
- Scepter Upgrade
- Break behavior
- Linken/Reflect behavior
- Spell Immune/Invulnerable/Invisible behavior
- Illusion behavior
- Stolen behavior
]]
--------------------------------------------------------------------------------
fairy_queen_royal_decree = class({})
-- LinkLuaModifier( "modifier_fairy_queen_royal_decree", "custom_abilities/fairy_queen_royal_decree/modifier_fairy_queen_royal_decree", LUA_MODIFIER_MOTION_NONE )
--------------------------------------------------------------------------------
-- Custom KV
-- Manacost
function fairy_queen_royal_decree:GetManaCost( level )
local manacost_pct = self:GetSpecialValueFor( "manacost_pct" )
local fairy_pct = self:GetSpecialValueFor( "refund_pct" )
local fairies = self:GetFairies()
local cost = manacost_pct/100 * self:GetCaster():GetMaxMana() * (100-fairy_pct*fairies)/100
return cost
end
-- Cooldown
function fairy_queen_royal_decree:GetCooldown( level )
local cooldown = self.BaseClass.GetCooldown( self, level )
local fairy_pct = self:GetSpecialValueFor( "refund_pct" )
local fairies = self:GetFairies()
local cost = cooldown * (100-fairy_pct*fairies)/100
return cost
end
--------------------------------------------------------------------------------
-- Ability Cast Filter
function fairy_queen_royal_decree:CastFilterResult()
local max_fairies = self:GetSpecialValueFor( "max_fairies" )
if self:GetFairies() == max_fairies then
return UF_FAIL_CUSTOM
end
return UF_SUCCESS
end
function fairy_queen_royal_decree:GetCustomCastError()
local max_fairies = self:GetSpecialValueFor( "max_fairies" )
if self:GetFairies() == max_fairies then
return "#dota_hud_error_full_fairies"
end
return ""
end
function fairy_queen_royal_decree:GetFairies()
if self:GetCaster():HasModifier( "modifier_fairy_queen_fairies" ) then
local fairies = self:GetCaster():GetModifierStackCount( "modifier_fairy_queen_fairies", self:GetCaster() )
return fairies
end
return 0
end
--------------------------------------------------------------------------------
-- Ability Start
function fairy_queen_royal_decree:OnSpellStart()
-- unit identifier
local caster = self:GetCaster()
-- find modifier
local modifier = caster:FindModifierByNameAndCaster( "modifier_fairy_queen_fairies", caster )
-- refresh
if modifier then
modifier:Refresh()
end
-- effects
self:PlayEffects()
end
--------------------------------------------------------------------------------
function fairy_queen_royal_decree:PlayEffects()
-- Get Resources
local particle_cast = "particles/units/heroes/hero_skywrath_mage/skywrath_mage_concussive_shot_cast.vpcf"
local sound_cast = "Hero_SkywrathMage.ConcussiveShot.Target"
-- Get Data
-- Create Particle
local effect_cast = ParticleManager:CreateParticle( particle_cast, PATTACH_CUSTOMORIGIN, self:GetCaster() )
ParticleManager:SetParticleControl( effect_cast, 0, self:GetCaster():GetOrigin() + Vector(0,0,100) )
ParticleManager:ReleaseParticleIndex( effect_cast )
-- Create Sound
EmitSoundOn( sound_cast, self:GetCaster() )
end |
object_mobile_npe_dressed_rakqua_warrior_02 = object_mobile_npe_shared_dressed_rakqua_warrior_02:new {
}
ObjectTemplates:addTemplate(object_mobile_npe_dressed_rakqua_warrior_02, "object/mobile/npe/dressed_rakqua_warrior_02.iff") |
Game = {}
function Game:init()
-- Order of these definitions is important. Don't alter!
spawner = Spawner()
world = Bump.newWorld(32)
self.currentLevel = nil
level = Level()
end
function Game:enter()
windowOffset = Vector(love.graphics.getWidth() / 2, love.graphics.getHeight() / 2)
self:loadLevel('first')
end
function Game:loadLevel(levelNumber)
local statics, kinetics, tileset, quadInfo, playerX, playerY = level:load(levelNumber)
map = Map(32, 32, world, statics, kinetics, tileset, quadInfo, levelNumber)
map:build()
print("Creating Game level map from mapstring:")
print(map.mapString)
self.currentLevel = level:getCurrentLevel()
-- TODO: implement
-- kineticMap = staticMap:add('platform')
player = spawner:createGameObject('Player', {world = world, x = playerX, y = playerY, w = 32, h = 32})
-- Center the camera on the player
camera = Camera(player.body.position:unpack())
end
function Game:changeLevel()
level.changeLevel = true
end
-- Forces game updates to be locked to 60FPS
-- update interval in seconds
local interval = 1/60
-- maximum frame skip
local maxsteps = 5
-- accumulator
local accum = 0
function Game:update(dt)
local steps = 0
-- update the simulation
accum = accum + dt
while accum >= interval do
-- -- Spawn new entities at pre-defined intervals
-- spawner:update(dt)
self:updateGameObjects(dt)
level:update(dt)
-- The camera follows the movement of the player
local playerPosition = Vector(player.body.position.x, player.body.position.y)
camera:lockX(playerPosition.x, camera.smooth.linear(700))
camera:lockY(playerPosition.y, camera.smooth.linear(700))
accum = accum - interval
steps = steps + 1
if steps >= maxsteps then
break
end
end
end
-- Check if a game object exists and is not dead. If so, update it.
-- Remove objects from the gameObjects table when they die and remove them
-- from the bump to prevent ghost collisions.
function Game:updateGameObjects(dt)
for i = #gameObjects, 1, -1 do
local game_object = gameObjects[i]
if game_object.dead then
table.remove(gameObjects, i)
world:remove(game_object)
else
game_object:update(dt)
end
end
end
function Game:draw()
-- Begin camera tracking
-- Everything between the camera functions will be drawn to the camera.
camera:attach()
map:draw()
for i = 1, #gameObjects do
local game_object = gameObjects[i]
if game_object.dead ~= true then
game_object:draw()
end
end
-- End camera tracking
if shouldDrawDebug then
self:drawDebug()
end
camera:detach()
end
function Game:drawDebug()
BumpDebug.draw(world)
local statistics = ("fps: %d, mem: %dKB, items: %d"):format(love.timer.getFPS(), collectgarbage("count"), world:countItems())
love.graphics.setColor(255, 255, 255)
love.graphics.printf(statistics, 0, 580, 790, 'right')
end
-- TODO: use the below code to convert all keydowns to keypressed
-- Consolidate all of these things into the Controls class.
-- local keysPressed = {}
-- function love.keypressed(k)
-- keysPressed[k] = true
-- end
-- function love.keyreleased(k)
-- keysPressed[k] = nil
-- end
-- function love.draw()
-- love.graphics.print("Keys pressed:", 10, 10)
-- local y = 30
-- for k,_ in pairs(keysPressed) do
-- love.graphics.print(k, 20, y)
-- y = y + 15
-- end
-- end
function Game:keypressed(k)
if k == "tab" then shouldDrawDebug = not shouldDrawDebug end
if k == "escape" then love.event.quit() end
if k == 'w' and player.grounded then
player.body:jump(player.jumpVelocity, player.jumpTerm, 'up')
player.grounded = false
end
-- if k == 'a' then
-- player.body:applyVelocityDirection(dt, 'left')
-- end
end
function Game:keyreleased(k)
if k == 'w' then
player.body:releaseJump()
end
end
function Game:addEnemies(number)
-- -- Insert enemies
-- for i = 1, number do
-- local px = (math.random(0, love.graphics.getWidth()) - windowOffset.x)
-- local py = (math.random(0, love.graphics.getHeight()) - windowOffset.y)
-- px = px + player.body.position.x + 100
-- py = py + player.body.position.y + 100
-- spawner:createGameObject('Enemy', {world = world, w = 40, h = 40, playerX = px, playerY = py})
-- end
end
function Game:addBlocks(number)
-- -- Insert blocks
-- for i = 1, 10 do
-- local px = (math.random(0, love.graphics.getWidth()) - windowOffset.x)
-- local py = (math.random(0, love.graphics.getHeight()) - windowOffset.y)
-- px = px + player.body.position.x + 100
-- py = py + player.body.position.y + 100
-- spawner:createGameObject('Block', {world = world, w = 80, h = 80, playerX = px, playerY = py})
-- end
end
|
--------------------------------------------------------------------------------
-- Game interaction facade
--------------------------------------------------------------------------------
Game = { }
--------------------------------------------------------------------------------
-- Get the current Bpm from the game
--------------------------------------------------------------------------------
function Game.getBpm()
return LuaBridgeVisualIntroOutro.get_bpm()
end
--------------------------------------------------------------------------------
-- Animate the 'liquid' on
--------------------------------------------------------------------------------
function Game.animateLiquid()
LuaBridgeVisualIntroOutro.animate_liquid()
end
--------------------------------------------------------------------------------
-- Animate the GUI elements on
--------------------------------------------------------------------------------
function Game.animateGui()
LuaBridgeVisualIntroOutro.animate_gui()
end
--------------------------------------------------------------------------------
-- Create the initial balls _ LOL
--------------------------------------------------------------------------------
function Game.dropBalls()
LuaBridgeVisualIntroOutro.drop_balls()
end
--------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------
function Game.getMode()
return LuaBridgeVisualIntroOutro.get_gamemode()
end
--------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------
function Game.getCurrentRound()
return LuaBridgeVisualIntroOutro.get_currentround()
end
--------------------------------------------------------------------------------
--
--------------------------------------------------------------------------------
function Game.getMaxRound()
return LuaBridgeVisualIntroOutro.get_maxround()
end
|
if turn >= 1 then
EnableChargeAttack()
Summon(6)
character_4:WithWaitTime(1500):UseSkill(2)
character_1:UseSkill(2)
end |
-- This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
local function checkerror(msg, f, ...)
local s, err = pcall(f, ...)
assert(not s and string.find(err, msg))
end
function generateClearedTable(arraySize, hashSize)
local tb = {}
for i = 1, arraySize do
tb[i] = i
end
for i = 1, hashSize do
tb[tostring(i)] = i
end
table.clear(tb)
return tb
end
do
checkerror("table expected", table.clear)
checkerror("table expected", table.clear, 1, 2)
assert(#generateClearedTable(0, 0) == 0, "table array part should stay empty")
assert(#generateClearedTable(10, 0) == 0, "table array part should be empty (had array)")
assert(#generateClearedTable(0, 10) == 0, "table array part should be empty (had hash)")
assert(#generateClearedTable(10, 10) == 0, "table array part should be empty (had both)")
assert(next(generateClearedTable(0, 0)) == nil, "table hash part should stay empty")
assert(next(generateClearedTable(10, 0)) == nil, "table hash part should be empty (had array)")
assert(next(generateClearedTable(0, 10)) == nil, "table hash part should be empty (had hash)")
assert(next(generateClearedTable(10, 10)) == nil, "table hash part should be empty (had both)")
for i = 1, 16 do
local t1 = generateClearedTable(16, 0)
local t2 = table.create(16)
t1[i] = true
t2[i] = true
assert(#t1 == #t2, "table length mismatch with i=" .. i .. "(" .. #t1 .. " vs " .. #t2 .. ")")
end
do
local things = {"foo", "bar", "baz", "foobar", "a", "b", "c", "d", "e", "f", "g"}
local tb = generateClearedTable(0, 20)
local containsAll = {}
for _, v in ipairs(things) do
tb[v] = true
end
for k, _ in pairs(tb) do
containsAll[k] = true
end
for _, v in ipairs(things) do
assert(tb[v], "key `" .. v .. "` doesn't show up in index")
assert(containsAll[v], "key `" .. v .. "` didn't show up in iteration")
end
end
do -- Check expanding the array part after clear
local tb = generateClearedTable(10, 0)
for i = 1, 40 do
tb[i] = i
end
assert(#tb == 40, "wrong array part size after expand")
end
do -- Check expanding the hash part after clear
local tb = generateClearedTable(0, 10)
for i = 1, 40 do
tb[tostring(i)] = i
end
local count = 0
for _ in pairs(tb) do
count = count + 1
end
assert(count == 40, "wrong hash part size after expand")
end
end
return "OK"
|
local current_folder = ... and (...):match '(.-%.?)[^%.]+$' or ''
local Layout = require(current_folder .. ".Layout")
local Label = require(current_folder .. ".Label")
local imgui = require(current_folder .. ".imgui")
local Button = require(current_folder .. ".Button")
local Tooltip = require(current_folder .. ".Tooltip")
local Rectangle = require(current_folder .. ".Rectangle")
local Menu = {}
function Menu.menubar_start(gui_state, w, h)
imgui.push_style(gui_state, "font", gui_state.style.small_font)
-- Shift the menu bar by a few pixel so that the leftmost menu has enough room
-- to move a bit to the left. That leads to a nice tab-like effect where
-- the rounded corners of the menu line up with the outline of the menubar
-- entries
local tl_w = gui_state.style.raw_quads.menu.tl.w
Layout.start(gui_state, tl_w, 0, w, h, {noscissor = true})
end
function Menu.menubar_finish(gui_state)
Layout.finish(gui_state, "-")
imgui.pop_style(gui_state, "font")
end
function Menu.menu_start(gui_state, w, h, label)
-- Cache current x and y
local x = gui_state.layout.next_x
local y = gui_state.layout.next_y
local options = {}
local opened = imgui.is_menu_open(gui_state, label)
if opened then
options.bg_color_default =
gui_state.menu_depth == 0 and gui_state.style.palette.shades.brightest or
gui_state.style.palette.shades.neutral
end
-- Draw label depending on current menu depth
local hit, hovered
if gui_state.menu_depth == 0 then
hit, hovered = Menu.menubar_item(gui_state, label, options)
else
hit, hovered = Menu.menu_item(gui_state, label, options)
love.graphics.setColor(255, 255, 255)
local arrow_w = gui_state.style.raw_quads.menu.arrow.w
local arrow_h = gui_state.style.raw_quads.menu.arrow.h
local arrow_x = x + w - arrow_w - 2
local arrow_y = y + (16 - arrow_h) / 2
love.graphics.draw(gui_state.style.stylesheet, gui_state.style.quads.menu.arrow,
arrow_x, arrow_y)
end
-- The menu is toggled when the user clicks on it, or when there is already a
-- menu open, and the user now hovers over a different menu
if hit or hovered and imgui.is_any_menu_open(gui_state) and
not imgui.is_menu_open(gui_state, label)
then
imgui.toggle_menu(gui_state, label)
end
if opened then
love.graphics.push("all")
love.graphics.setCanvas(gui_state.overlay_canvas)
-- Calculate position of new menu depending on current menu depth
local deco_height = gui_state.style.raw_quads.menu.t.h
local tl_w = gui_state.style.raw_quads.menu.tl.w
local tr_w = gui_state.style.raw_quads.menu.tr.w
local t_w = gui_state.style.raw_quads.menu.t.w
if gui_state.menu_depth == 0 then
y = y + 12
-- Shift menu to the left by a few pixels so that the rounded corners
-- of the menu line up with the outline of the menubar entry
x = x - tl_w
else
y = y - deco_height
x = x + w
end
local abs_x, abs_y = gui_state.transform:project(x, y)
gui_state.menu_bounds[gui_state.menu_depth + 1] = {x = abs_x, y = abs_y}
-- Draw decoration at the top
love.graphics.setColor(255, 255, 255)
love.graphics.draw(gui_state.style.stylesheet, gui_state.style.quads.menu.tl, x, y)
assert(t_w == 1)
love.graphics.draw(gui_state.style.stylesheet, gui_state.style.quads.menu.t,
x + tl_w, y, 0, w - tl_w - tr_w, 1)
love.graphics.draw(gui_state.style.stylesheet, gui_state.style.quads.menu.tr,
x + w - tr_w, y)
y = y + deco_height
Layout.start(gui_state, x, y, w, h - 2*deco_height, {noscissor = true})
gui_state.menu_depth = gui_state.menu_depth + 1
end
return opened
end
function Menu.menu_finish(gui_state, w, _)
local x = gui_state.layout.next_x
local y = gui_state.layout.next_y
assert(gui_state.menu_depth > 0, "Ending menu on menu depth 0. Did you forget menu_start?")
gui_state.menu_depth = gui_state.menu_depth - 1
-- Draw decoration at the bottom
love.graphics.setColor(255, 255, 255)
love.graphics.draw(gui_state.style.stylesheet, gui_state.style.quads.menu.bl, x, y)
local deco_height = gui_state.style.raw_quads.menu.b.h
local bl_w = gui_state.style.raw_quads.menu.bl.w
local br_w = gui_state.style.raw_quads.menu.br.w
local b_w = gui_state.style.raw_quads.menu.b.w
assert(b_w == 1)
love.graphics.draw(gui_state.style.stylesheet, gui_state.style.quads.menu.b,
x + bl_w, y, 0, w - bl_w - br_w, 1)
love.graphics.draw(gui_state.style.stylesheet, gui_state.style.quads.menu.br,
x + w - br_w, y)
Layout.finish(gui_state, "|")
gui_state.layout.adv_y = gui_state.layout.adv_y + 2*deco_height
local abs_w, abs_h = gui_state.transform:project_dimensions(gui_state.layout.adv_x, gui_state.layout.adv_y)
local bounds = gui_state.menu_bounds[gui_state.menu_depth + 1]
bounds.w, bounds.h = abs_w, abs_h
gui_state.layout.adv_x = 0
gui_state.layout.adv_y = 0
love.graphics.setCanvas()
love.graphics.pop()
-- If this was the last menu to finish, check if the user clicked anywhere
-- outside the menu bounds. In that case close all windows
if gui_state.menu_depth == 0 and gui_state.input and
gui_state.input.mouse.buttons[1] and
gui_state.input.mouse.buttons[1].releases > 0
then
local mx = gui_state.input.mouse.buttons[1].at_x
local my = gui_state.input.mouse.buttons[1].at_y
local contained = false
for _, menu_bounds in ipairs(gui_state.menu_bounds) do
if Rectangle.contains(menu_bounds, mx, my) then
contained = true
break
end
end
if not contained then
imgui.close_menus(gui_state)
end
end
end
local function draw_item_background(gui_state, h)
local x = gui_state.layout.next_x
local y = gui_state.layout.next_y
local w = gui_state.layout.max_w
love.graphics.setColor(gui_state.style.palette.shades.brightest)
love.graphics.rectangle("fill", x, y, w, h)
end
function Menu.menu_item(gui_state, label, options)
draw_item_background(gui_state, 16)
options = options or {}
if options.disabled then
options.font_color = gui_state.style.palette.shades.bright
elseif not options.font_color then
options.font_color = gui_state.style.palette.shades.darkest
end
if not options.bg_color_hovered then
options.bg_color_hovered = gui_state.style.palette.shades.neutral
end
if not options.bg_color_pressed then
options.bg_color_pressed = gui_state.style.palette.shades.dark
end
options.trigger_on_release = true
if options and options.keybinding then
Label.draw(gui_state, nil, nil, gui_state.layout.max_w, nil,
options.keybinding,
{alignment_h = ">", font_color = options.font_color})
end
local clicked, _, hovered
Layout.start(gui_state, 1, nil, gui_state.layout.max_w - 1, nil)
if options and options.checkbox then
local state = options.checkbox.checked and "checked" or "unchecked"
local raw_quad = gui_state.style.raw_quads.menu_checkbox[state]
love.graphics.setColor(255, 255, 255, 255)
love.graphics.draw(gui_state.style.stylesheet, gui_state.style.quads.menu_checkbox[state],
0, (16 - raw_quad.h)/2)
gui_state.layout.adv_x = raw_quad.w
gui_state.layout.adv_y = 16
Layout.next(gui_state, "-", 1)
end
clicked, _, hovered = Button.draw_flat(gui_state, nil, nil, gui_state.layout.max_w, nil,
label, nil, options)
if options and options.tooltip then
Tooltip.draw(gui_state, options.tooltip, nil, nil, nil, nil, {tooltip_threshold = 0})
end
Layout.finish(gui_state, "-")
Layout.next(gui_state, "|")
clicked = clicked and (not options or options and not options.disabled)
hovered = hovered and (not options or options and not options.disabled)
if clicked or hovered then
imgui.close_menus(gui_state, gui_state.menu_depth)
end
return clicked, hovered
end
-- Behaves like a menu item, but closes all menus when clicked.
function Menu.action_item(gui_state, label, options)
local clicked = Menu.menu_item(gui_state, label, options)
if clicked then
imgui.close_menus(gui_state)
end
return clicked
end
function Menu.separator(gui_state)
draw_item_background(gui_state, 3)
local x = gui_state.layout.next_x + 2
local y = gui_state.layout.next_y + 1
local w = gui_state.layout.max_w - 4
love.graphics.setColor(32, 63, 73)
love.graphics.rectangle("fill", x, y, w, 1)
gui_state.layout.adv_x = 0
gui_state.layout.adv_y = 3
Layout.next(gui_state, "|")
end
function Menu.menubar_item(gui_state, label, options)
options = options or {}
if options.disabled then
options.font_color = gui_state.style.palette.shades.bright
else
options.font_color = gui_state.style.palette.shades.darkest
end
options.trigger_on_release = true
local clicked, _, hovered = Button.draw_flat(gui_state, nil, nil, nil, gui_state.layout.max_h,
label, nil, options)
clicked = clicked and (not options or options and not options.disabled)
hovered = hovered and (not options or options and not options.disabled)
Layout.next(gui_state, "-", 1)
return clicked, hovered
end
return Menu
|
--------------------------------------------------------------------------------
-- Issue: https://github.com/smartdevicelink/sdl_core/issues/842
-- Pre-conditions:
-- 1. SDL is started (EnablePolicy = false)
-- 2. HMI is started
-- Steps to reproduce:
-- 1. Activate App
-- Expected:
-- The application was activated.
--------------------------------------------------------------------------------
--[[ Required Shared libraries ]]
local runner = require('user_modules/script_runner')
local common = require("user_modules/sequences/actions")
--[[ Test Configuration ]]
runner.testSettings.isSelfIncluded = false
--[[ Local Variables ]]
local hmiAppId
--[[ Local Functions ]]
local function disablePolicy()
common.setSDLIniParameter("EnablePolicy", "false")
end
local function registerApp()
common.getMobileSession():StartService(7)
:Do(function()
local corId = common.getMobileSession():SendRPC("RegisterAppInterface", common.getConfigAppParams())
common.getHMIConnection():ExpectNotification("BasicCommunication.OnAppRegistered")
:Do(function(_, d1)
hmiAppId = d1.params.application.appID
end)
common.getMobileSession():ExpectResponse(corId, { success = true, resultCode = "SUCCESS" })
end)
end
local function activateApp()
local requestId = common.getHMIConnection():SendRequest("SDL.ActivateApp", { appID = hmiAppId })
common.getHMIConnection():ExpectResponse(requestId)
common.getMobileSession():ExpectNotification("OnHMIStatus", {
hmiLevel = "FULL", audioStreamingState = "AUDIBLE", systemContext = "MAIN" })
end
--[[ Scenario ]]
runner.Title("Preconditions")
runner.Step("Clean environment", common.preconditions)
runner.Step("Disabling Policy", disablePolicy)
runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start)
runner.Step("Register App", registerApp)
runner.Title("Test")
runner.Step("Activate App", activateApp)
runner.Title("Postconditions")
runner.Step("Stop SDL", common.postconditions)
|
local recipes = data.raw.recipe
local function set_ingredient_amount(recipe_name, ingredient_index, amount)
local recipe = recipes[recipe_name]
if( recipe and recipe.normal and recipe.normal.ingredients )
then
local ingredient = recipe.normal.ingredients[ingredient_index]
if( ingredient )
then
if( ingredient.amount )
then
ingredient.amount = amount
elseif( ingredient[2] )
then
ingredient[2] = amount
end
end
end
end
local function set_result_count(recipe_name, result_count)
local recipe = recipes[recipe_name]
if( recipe and recipe.normal )
then
recipe.normal.result_count = result_count
end
end
-- https://github.com/wube/factorio-data/blob/master/base/prototypes/recipe.lua
set_ingredient_amount('steam-engine', 1, 6)
set_ingredient_amount('steam-engine', 3, 2)
set_ingredient_amount('iron-gear-wheel', 1, 1)
set_result_count('electronic-circuit', 2)
set_ingredient_amount('electric-mining-drill', 1, 1)
set_ingredient_amount('electric-mining-drill', 2, 3)
set_ingredient_amount('electric-mining-drill', 3, 5)
set_ingredient_amount('burner-mining-drill', 1, 1)
set_ingredient_amount('burner-mining-drill', 3, 1)
set_result_count('pipe', 2)
set_ingredient_amount('submachine-gun', 1, 5)
set_ingredient_amount('submachine-gun', 2, 1)
set_ingredient_amount('submachine-gun', 3, 3)
set_ingredient_amount('assembling-machine-2', 1, 1)
set_ingredient_amount('assembling-machine-2', 2, 1)
set_ingredient_amount('assembling-machine-2', 3, 3)
set_ingredient_amount('steel-plate', 1, 3)
set_result_count('steel-plate', 3)
set_ingredient_amount('cannon-shell', 1, 1)
set_ingredient_amount('cannon-shell', 2, 1)
set_ingredient_amount('explosive-cannon-shell', 1, 1)
set_ingredient_amount('explosive-cannon-shell', 2, 1)
set_ingredient_amount('express-transport-belt', 1, 5)
set_ingredient_amount('tank', 1, 16)
set_ingredient_amount('tank', 2, 25)
set_ingredient_amount('tank', 3, 8)
set_ingredient_amount('tank', 4, 5)
set_ingredient_amount('advanced-circuit', 2, 1)
set_ingredient_amount('advanced-circuit', 3, 2)
set_ingredient_amount('processing-unit', 3, 3)
set_result_count('explosives', 4)
set_ingredient_amount('battery', 1, 10)
set_ingredient_amount('low-density-structure', 3, 1)
|
--[[
author:{JanRoid}
time:2018-10-30 14:42:43
Description: 注册popwindow
]]
local PopupConfig = {}
PopupConfig.S_POPID = {
-- test
--POP_DEMO = getIndex();
POP_STORE = g_GetIndex();
POP_SETTING = g_GetIndex();
POP_BANKRUPT = g_GetIndex();
POP_GIFT = g_GetIndex(); --礼物
POP_GIFT_DETAILE = g_GetIndex(); -- 礼物详情
POP_CARD_CALCULATOR = g_GetIndex(); -- 算牌器
--POP_DEMO = g_GetIndex();
LOGIN_EMAIL_POP = g_GetIndex(), -- email登录
CHANGE_PWD_POP = g_GetIndex(), -- 修改密码
RESET_PWD_POP = g_GetIndex(), -- 重置密码
USER_INFO_POP = g_GetIndex(), -- 用户信息
SET_HEAD_POP = g_GetIndex(), -- 设置头像
OTHER_INFO_POP = g_GetIndex(), -- 他人信息
SAFE_BOX_POP = g_GetIndex(), -- 保险箱
SAFE_BOX_SET_PASSWORD_POP = g_GetIndex(), -- 保险箱设置密码
SAFE_BOX_PASSWORD_POP = g_GetIndex(),
MAIL_BOX_POP = g_GetIndex(), -- 邮箱
MAIL_BOX_FILL_INFO_POP = g_GetIndex(), -- 邮箱填写资料
FRIEND_POP = g_GetIndex(),
ACHIEVEMENT_POP = g_GetIndex(),
RANK_POP = g_GetIndex(), -- 排行榜
RANK_PLAYER_INFO_POP = g_GetIndex(), -- 排行榜好友信息弹窗
LOGIN_REWARD_POP = g_GetIndex(), -- 登录奖励
HELP_POP = g_GetIndex(), -- 帮助页面
ACCOUNT_UPGRADE_POP = g_GetIndex(), -- 账号升级
DEFAULT_ACCOUNT_POP = g_GetIndex(), -- 有原来的账号
DAILYTASK_POP = g_GetIndex(), -- 每日任务
ROOMTASK_POP = g_GetIndex(), --房间内任务
CHOOSE_MTT_OR_SNG_POP = g_GetIndex(), -- SNG MTT 选择
ROOM_CHAT_POP = g_GetIndex(),
BIG_WHEEL_POP = g_GetIndex(), -- 大转盘
BIG_WHEEL_HELP_POP = g_GetIndex(), -- 大转盘帮助
SLOT_POP = g_GetIndex(), -- 老虎机
SUPER_LOTTO_POP = g_GetIndex(), -- 夺金岛
SUPER_LOTTO_RULE_POP = g_GetIndex(), -- 夺金岛说明
SUPER_LOTTO_REWARD_POP = g_GetIndex(), -- 夺金岛中奖
SUPER_LOTTO_REWARD_LIST_POP = g_GetIndex(), -- 夺金岛中奖记录
DEALER_POP = g_GetIndex(), -- 荷官弹窗
DEALER_CHANGE_POP = g_GetIndex(), -- 荷官更换弹窗
PRIVATE_HALL_POP = g_GetIndex(), -- 私人房大厅
ACTIVITY_WEB_POP = g_GetIndex(), -- 活动网页
ROOM_GAME_REVIEW_DETAIL = g_GetIndex(), -- 房间牌局回顾详请
ROOM_GAME_REVIEW_POP = g_GetIndex(), -- 房间牌局回顾弹窗
SNG_LOBBY_HELP_POP =g_GetIndex(), --SNG大厅帮助弹窗
SNG_REWARD_POP = g_GetIndex(), --sng奖励弹窗--rank<= 3
SNG_RESULT_POP = g_GetIndex(), --sng结算弹窗-rank>3
TUTORIAL_DEALER_POP = g_GetIndex(), -- 新手教程荷官弹窗,使用继承复写其中某些方法
TUTORIAL_GIFT_DETAILS_POP = g_GetIndex(), -- 新手教程礼物详情弹窗,使用继承复写其中某些方法
TUTORIAL_REWARD_POP = g_GetIndex(), -- 新手教程入口及领奖弹窗
NOVICE_REWARD_POP = g_GetIndex(), -- 新手奖励
ROOM_BUY_IN = g_GetIndex(), -- 房间买入弹框
ROOM_INVITE_FRIEND = g_GetIndex(), -- 房间邀请弹框
BACKKEY_LOGOUT = g_GetIndex(), -- 大厅返回键返回弹窗
MTT_SIGNUP_SUCC_POP = g_GetIndex(), -- mtt 报名成功
MTT_SIGNUP_WAY_POP = g_GetIndex(), -- mtt 报名方式选择
MTT_HELP_POP = g_GetIndex(), -- mtt帮助弹框
MTT_DETAIL_POP = g_GetIndex(), -- mtt详情弹框
MTT_RESULT_POP = g_GetIndex(), -- mtt 结算弹窗 前三名
MTT_OTHER_RESULT_POP = g_GetIndex(), -- mtt 结算弹窗 其他名称
MTT_ADDON_POP = g_GetIndex(), -- mtt addon
MTT_REBUY_POP = g_GetIndex(), -- mtt rebuy
PRIVACY_POLICY_POP = g_GetIndex(), -- PRIVACY_POLICY_POP
}
-- [key] = {path = "xxx/xxx",name = "xxx"}
PopupConfig.S_FILES = {
-- test
-- [PopupConfig.S_POPID.POP_DEMO] = {path = "dev.pop", name = "PopDemo"};
[PopupConfig.S_POPID.POP_STORE] = {path = "app.scenes.store", name = "StorePop"};
[PopupConfig.S_POPID.POP_GIFT] = {path = "app.scenes.gift", name = "GiftPop"};
[PopupConfig.S_POPID.POP_GIFT_DETAILE] = {path = "app.scenes.gift", name = "GiftDetailePop"};
[PopupConfig.S_POPID.POP_CARD_CALCULATOR] = {path = "app.scenes.cardCalculator", name = "CardCalculatorPop"};
[PopupConfig.S_POPID.POP_SETTING] = {path = "app.scenes.setting", name = "SettingPop"};
[PopupConfig.S_POPID.POP_BANKRUPT] = {path = "app.scenes.bankruptcy", name = "BankruptcyPop"};
[PopupConfig.S_POPID.LOGIN_EMAIL_POP] = {path = "app.scenes.loginEmail", name = "LoginEmailPop"};
[PopupConfig.S_POPID.CHANGE_PWD_POP] = {path = "app.scenes.changePwd", name = "ChangePwdPop"};
[PopupConfig.S_POPID.RESET_PWD_POP] = {path = "app.scenes.resetPwd", name = "ResetPwdPop"};
[PopupConfig.S_POPID.USER_INFO_POP] = {path = "app.scenes.userInfo", name = "UserInfoPop"};
[PopupConfig.S_POPID.SET_HEAD_POP] = {path = "app.scenes.userInfo", name = "SettingHeadPop"};
[PopupConfig.S_POPID.OTHER_INFO_POP] = {path = "app.scenes.userInfo", name = "OtherInfoPop"};
[PopupConfig.S_POPID.SAFE_BOX_POP] = {path = "app.scenes.safeBox", name = "SafeBoxPop"};
[PopupConfig.S_POPID.SAFE_BOX_SET_PASSWORD_POP] = {path = "app.scenes.safeBox", name = "SafeBoxSetPasswordPop"};
[PopupConfig.S_POPID.SAFE_BOX_PASSWORD_POP] = {path = "app.scenes.safeBox", name = "SafeBoxPasswordPop"};
[PopupConfig.S_POPID.MAIL_BOX_POP] = {path = "app.scenes.mailBox", name = "MailBoxPop"};
[PopupConfig.S_POPID.MAIL_BOX_FILL_INFO_POP] = {path = "app.scenes.mailBox", name = "MailFillInfoPop"};
[PopupConfig.S_POPID.FRIEND_POP] = {path = "app.scenes.friend", name = "FriendPop"};
[PopupConfig.S_POPID.ACHIEVEMENT_POP] = {path = "app.scenes.achievement", name = "AchievementPop"};
[PopupConfig.S_POPID.RANK_POP] = {path = "app.scenes.rank.rankMain", name = "RankPop"};
[PopupConfig.S_POPID.LOGIN_REWARD_POP] = {path = "app.scenes.loginReward", name = "LoginRewardPop"};
[PopupConfig.S_POPID.RANK_PLAYER_INFO_POP] = {path = "app.scenes.userInfo", name = "PlayerInfoPop"};
[PopupConfig.S_POPID.HELP_POP] = {path = "app.scenes.help", name = "HelpPop"};
[PopupConfig.S_POPID.ACCOUNT_UPGRADE_POP] = {path = "app.scenes.accountUpgrade", name = "AccountUpgradePop"};
[PopupConfig.S_POPID.DEFAULT_ACCOUNT_POP] = {path = "app.scenes.defaultAccount", name = "DefaultAccountPop"};
[PopupConfig.S_POPID.DAILYTASK_POP] = {path = "app.scenes.dailyTask", name = "DailyTaskPop"};
[PopupConfig.S_POPID.ROOMTASK_POP] = {path = "app.scenes.dailyTask", name = "RoomTaskPop"};
[PopupConfig.S_POPID.CHOOSE_MTT_OR_SNG_POP] = {path = "app.scenes.chooseMTTorSNG", name = "ChooseMTTorSNGpop"};
[PopupConfig.S_POPID.ROOM_CHAT_POP] = {path = "app.scenes.chat",name = "ChatPop"};
[PopupConfig.S_POPID.BIG_WHEEL_POP] = {path = "app.scenes.bigWheel", name = "BigWheelPop"};
[PopupConfig.S_POPID.BIG_WHEEL_HELP_POP] = {path = "app.scenes.bigWheel", name = "BigWheelHelpPop"};
[PopupConfig.S_POPID.SUPER_LOTTO_POP] = {path = "app.scenes.superLotto", name = "SuperLottoPop"};
[PopupConfig.S_POPID.SUPER_LOTTO_RULE_POP] = {path = "app.scenes.superLotto", name = "SuperLottoRulePop"};
[PopupConfig.S_POPID.SUPER_LOTTO_REWARD_POP] = {path = "app.scenes.superLotto", name = "SuperLottoRewardPop"};
[PopupConfig.S_POPID.SUPER_LOTTO_REWARD_LIST_POP] = {path = "app.scenes.superLotto", name = "SuperLottoRewardListPop"};
[PopupConfig.S_POPID.DEALER_POP] = {path = "app.scenes.dealer", name = "DealerPop"};
[PopupConfig.S_POPID.DEALER_CHANGE_POP] = {path = "app.scenes.dealer", name = "DealerChangePop"};
[PopupConfig.S_POPID.PRIVATE_HALL_POP] = {path = "app.scenes.privateHall", name = "PrivateHallPop"};
[PopupConfig.S_POPID.ACTIVITY_WEB_POP] = {path = "app.scenes.activity", name = "ActivityPop"};
[PopupConfig.S_POPID.MTT_ADDON_POP] = {path = "app.scenes.mttRoom", name = "MttRebuyAddonPop"};
[PopupConfig.S_POPID.MTT_REBUY_POP] = {path = "app.scenes.mttRoom", name = "MttRebuyPop"};
[PopupConfig.S_POPID.MTT_HELP_POP] = {path = "app.scenes.mttLobbyScene", name = "MttHelpPop"};
[PopupConfig.S_POPID.MTT_SIGNUP_SUCC_POP] = {path = "app.scenes.mttLobbyScene", name = "MTTSignupSuccPop"};
[PopupConfig.S_POPID.MTT_SIGNUP_WAY_POP] = {path = "app.scenes.mttLobbyScene", name = "MTTSignupWayPop"};
[PopupConfig.S_POPID.SNG_LOBBY_HELP_POP] = {path = "app.scenes.sngLobby",name = "SngLobbyHelpPop"};
[PopupConfig.S_POPID.SNG_REWARD_POP] = {path = "app.scenes.sngRoom",name = "SNGRoomRewardPop"};
[PopupConfig.S_POPID.SNG_RESULT_POP] = {path = "app.scenes.sngRoom",name = "SNGRoomResultPop"};
[PopupConfig.S_POPID.TUTORIAL_DEALER_POP] = {path = "app.scenes.tutorial", name = "TutorialDealerPop"};
[PopupConfig.S_POPID.MTT_DETAIL_POP] = {path = "app.scenes.mttLobbyScene", name = "MttDetailPop"};
[PopupConfig.S_POPID.TUTORIAL_GIFT_DETAILS_POP] = {path = "app.scenes.tutorial", name = "TutorialGiftDetailPop"};
[PopupConfig.S_POPID.TUTORIAL_REWARD_POP] = {path = "app.scenes.tutorial", name = "TutorialRewardPop"};
[PopupConfig.S_POPID.NOVICE_REWARD_POP] = {path = "app.scenes.noviceReward", name = "NoviceRewardPop"};
[PopupConfig.S_POPID.ROOM_GAME_REVIEW_DETAIL] = {path = "app.scenes.roomGameReview", name = "RoomGameReviewDetail"};
[PopupConfig.S_POPID.ROOM_GAME_REVIEW_POP] = {path = "app.scenes.roomGameReview", name = "RoomGameReviewPop"};
[PopupConfig.S_POPID.ROOM_BUY_IN] = {path = "app.scenes.normalRoom", name = "BuyInPop"};
[PopupConfig.S_POPID.ROOM_INVITE_FRIEND] = {path = "app.scenes.normalRoom", name = "InviteFriendPop"};
[PopupConfig.S_POPID.BACKKEY_LOGOUT] = {path = "app.scenes.backKeyLoginout", name = "KeyBackPop"};
[PopupConfig.S_POPID.MTT_RESULT_POP] = {path = "app.scenes.mttRoom", name = "MttResultPop"};
[PopupConfig.S_POPID.MTT_OTHER_RESULT_POP] = {path = "app.scenes.mttRoom", name = "MttOtherResultPop"};
[PopupConfig.S_POPID.PRIVACY_POLICY_POP] = {path = "app.scenes.privacyPolicy", name = "PrivacyPolicyPop"};
}
return PopupConfig |
local component=require("component")
local gL = {
type = require("gachLib.type"),
state = require("gachLib.state"),
util = require("gachLib.util")
}
if gL.util.tableCount(component.list("transposer")) > 0 then
gL.transposer = require("gachLib.transposer")
end
if gL.util.tableCount(component.list("modem")) > 0 then
gL.network = require("gachLib.network")
end
return gL |
SILE.hyphenator.languages["und"] = {patterns = {}, exceptions = {}}
|
UIManager={}
UIManager.__index = UIManager
UIManager.name="UIManager"
local uiLayer = {}
UIManager.Layer = {
Buttom = 1,
Normal = 2,
Pop = 3,
Message = 4,
}
function UIManager.New( resPath,layer )
local M = {}
setmetatable(M,UIManager)
M.resPath = resPath
M.layer = layer
M.visible = false
return M
end
function UIManager:SetVisible( state )
if self.visible == state then return end
self.visible = state
if state then
self.obj = ResourceManager.LoadUI(self.resPath)
self.uicomponent = self.obj:GetComponent("UIComponent")
Util.SetParent(self.obj,uiLayer[self.layer])
Util.SetUIAnchor(self.obj)
self:OnShow()
else
self:OnHide()
Util.DestroyObj(self.obj)
end
end
function UIManager.InitRoot()
local gameObject = GameObject.Find("UIRoot")
local lanuch = GameObject.Find("lanuch")
if not gameObject then
return
end
local tra = gameObject.transform
uiLayer[UIManager.Layer.Buttom] = tra:GetChild(0).gameObject
uiLayer[UIManager.Layer.Normal] = tra:GetChild(1).gameObject
uiLayer[UIManager.Layer.Pop] = tra:GetChild(2).gameObject
uiLayer[UIManager.Layer.Message] = tra:GetChild(3).gameObject
end
UIManager.InitRoot()
|
--
-- Copyright (c) 2017, Jesse Freeman. All rights reserved.
--
-- Licensed under the Microsoft Public License (MS-PL) License.
-- See LICENSE file in the project root for full license information.
--
-- Contributors
-- --------------------------------------------------------
-- This is the official list of Pixel Vision 8 contributors:
--
-- Jesse Freeman - @JesseFreeman
-- Christina-Antoinette Neofotistou - @CastPixel
-- Christer Kaitila - @McFunkypants
-- Pedro Medeiros - @saint11
-- Shawn Rakowski - @shwany
--
function EditorUI:CreateText(rect, text, font, colorOffset, spacing, drawMode)
local data = self:CreateData(rect)
data.text = ""
data.font = font or "large-bold"
data.colorOffset = colorOffset or 0
data.spacing = spacing or 0
data.drawMode = DrawMode.TilemapCache
data.charSize = SpriteSize()
-- After the component's data is set, update the text
self:ChangeText(data, text)
return data
end
function EditorUI:UpdateText(data)
-- Exit out of update if there is nothing to update
if(data == nil) then
return
end
local drawArguments = nil
-- Test to see if we should draw the component
if(data.invalid == true or DrawMode.Sprite == true) then
-- We want to render the text from the bottom of the screen so we offset it and loop backwards.
for i = 1, data.totalLines do
drawArguments = {
data.lines[i], -- text (1)
data.rect.x, -- x (2)
data.drawMode == DrawMode.Tile and data.tiles.r + (i - 1) or data.rect.y + ((i - 1) * data.charSize.y), -- y (3)
data.drawMode, -- drawMode (4)
data.font, -- font (5)
data.colorOffset, -- colorOffset (6)
data.spacing, -- spacing (7)
}
-- Push a draw call into the UI's draw queue
self:NewDraw("DrawText", drawArguments)
end
if(data.invalid == true) then
-- We only want to reset the validation if it's invalid since sprite text will keep drawing
self:ResetValidation(data)
end
end
end
function EditorUI:ChangeText(data, text)
-- If the text is the same, don't update the text component and exit out of the method
if(data.text == text) then
return
end
self:Invalidate(data)
-- Save the text on the draw arguments
data.text = text
-- We are going to render the message in a box as tiles. To do this, we need to wrap the
-- text, then split it into lines and draw each line.
local wrap = WordWrap(data.text, data.tiles.w)
data.lines = SplitLines(wrap)
data.totalLines = #data.lines
end
|
--[[
Copyright (c) 2022, Vsevolod Stakhov <vsevolod@rspamd.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]--
local argparse = require "argparse"
local rspamd_logger = require "rspamd_logger"
-- Define command line options
local parser = argparse()
:name 'rspamadm publicsuffix'
:description 'Do manipulations with the publicsuffix list'
:help_description_margin(30)
:command_target('command')
:require_command(true)
parser:option '-c --config'
:description 'Path to config file'
:argname('config_file')
:default(rspamd_paths['CONFDIR'] .. '/rspamd.conf')
parser:command 'compile'
:description 'Compile publicsuffix list if needed'
local function load_config(config_file)
local _r,err = rspamd_config:load_ucl(config_file)
if not _r then
rspamd_logger.errx('cannot load %s: %s', config_file, err)
os.exit(1)
end
_r,err = rspamd_config:parse_rcl({'logging', 'worker'})
if not _r then
rspamd_logger.errx('cannot process %s: %s', config_file, err)
os.exit(1)
end
end
local function compile_handler(_)
local rspamd_url = require "rspamd_url"
local tld_file = rspamd_config:get_tld_path()
if not tld_file then
rspamd_logger.errx('missing `url_tld` option, cannot continue')
os.exit(1)
end
rspamd_logger.messagex('loading public suffix file from %s', tld_file)
rspamd_url.init(tld_file)
rspamd_logger.messagex('public suffix file has been loaded')
end
local function handler(args)
local cmd_opts = parser:parse(args)
load_config(cmd_opts.config_file)
if cmd_opts.command == 'compile' then
compile_handler(cmd_opts)
else
rspamd_logger.errx('unknown command: %s', cmd_opts.command)
os.exit(1)
end
end
return {
handler = handler,
description = parser._description,
name = 'publicsuffix'
} |
local K, C = unpack(KkthnxUI)
local _G = _G
local CreateFont = _G.CreateFont
local CreateFrame = _G.CreateFrame
local KkthnxUIMedia = CreateFrame("Frame", "KKUI_Fonts")
local shadowOffset = K.Mult or 1
local fontSize = 12
-- Create our own fonts
local KkthnxUIFont = CreateFont("KkthnxUIFont")
KkthnxUIFont:SetFont(C["Media"].Fonts.KkthnxUIFont, fontSize, "")
KkthnxUIFont:SetShadowColor(0, 0, 0, 1)
KkthnxUIFont:SetShadowOffset(shadowOffset, -shadowOffset / 2)
local KkthnxUIFontOutline = CreateFont("KkthnxUIFontOutline")
KkthnxUIFontOutline:SetFont(C["Media"].Fonts.KkthnxUIFont, fontSize, "OUTLINE")
KkthnxUIFontOutline:SetShadowColor(0, 0, 0, 0)
KkthnxUIFontOutline:SetShadowOffset(0, -0)
local PTSansNarrowFont = CreateFont("SansNarrowFont")
PTSansNarrowFont:SetFont([[Interface\AddOns\KkthnxUI\Media\Fonts\PT_Sans_Narrow.ttf]], fontSize, "")
PTSansNarrowFont:SetShadowColor(0, 0, 0, 1)
PTSansNarrowFont:SetShadowOffset(shadowOffset, -shadowOffset / 2)
local PTSansNarrowFontOutline = CreateFont("SansNarrowFontOutline")
PTSansNarrowFontOutline:SetFont([[Interface\AddOns\KkthnxUI\Media\Fonts\PT_Sans_Narrow.ttf]], fontSize, "OUTLINE")
PTSansNarrowFontOutline:SetShadowColor(0, 0, 0, 0)
PTSansNarrowFontOutline:SetShadowOffset(0, -0)
local ExpresswayFont = CreateFont("ExpresswayFont")
ExpresswayFont:SetFont([[Interface\AddOns\KkthnxUI\Media\Fonts\Expressway.ttf]], fontSize, "")
ExpresswayFont:SetShadowColor(0, 0, 0, 1)
ExpresswayFont:SetShadowOffset(shadowOffset, -shadowOffset / 2)
local ExpresswayFontOutline = CreateFont("ExpresswayFontOutline")
ExpresswayFontOutline:SetFont([[Interface\AddOns\KkthnxUI\Media\Fonts\Expressway.ttf]], fontSize, "OUTLINE")
ExpresswayFontOutline:SetShadowColor(0, 0, 0, 0)
ExpresswayFontOutline:SetShadowOffset(0, -0)
local FuturaFont = CreateFont("FuturaFont")
FuturaFont:SetFont([[Interface\AddOns\KkthnxUI\Media\Fonts\Futura_Medium_BT.ttf]], fontSize, "")
FuturaFont:SetShadowColor(0, 0, 0, 1)
FuturaFont:SetShadowOffset(shadowOffset, -shadowOffset / 2)
local FuturaFontOutline = CreateFont("FuturaFontOutline")
FuturaFontOutline:SetFont([[Interface\AddOns\KkthnxUI\Media\Fonts\Futura_Medium_BT.ttf]], fontSize, "OUTLINE")
FuturaFontOutline:SetShadowColor(0, 0, 0, 0)
FuturaFontOutline:SetShadowOffset(0, -0)
local BlizzardFont = CreateFont("BlizzardFont")
BlizzardFont:SetFont(_G.STANDARD_TEXT_FONT, fontSize, "")
BlizzardFont:SetShadowColor(0, 0, 0, 1)
BlizzardFont:SetShadowOffset(shadowOffset, -shadowOffset / 2)
local BlizzardFontOutline = CreateFont("BlizzardFontOutline")
BlizzardFontOutline:SetFont(_G.STANDARD_TEXT_FONT, fontSize, "OUTLINE")
BlizzardFontOutline:SetShadowColor(0, 0, 0, 0)
BlizzardFontOutline:SetShadowOffset(0, -0)
local TextureTable = {
["AltzUI"] = C["Media"].Statusbars.AltzUIStatusbar,
["AsphyxiaUI"] = C["Media"].Statusbars.AsphyxiaUIStatusbar,
["AzeriteUI"] = C["Media"].Statusbars.AzeriteUIStatusbar,
["Blank"] = C["Media"].Statusbars.Blank,
["DiabolicUI"] = C["Media"].Statusbars.DiabolicUIStatusbar,
["Flat"] = C["Media"].Statusbars.FlatStatusbar,
["GoldpawUI"] = C["Media"].Statusbars.GoldpawUIStatusbar,
["KkthnxUI"] = C["Media"].Statusbars.KkthnxUIStatusbar,
["Palooza"] = C["Media"].Statusbars.PaloozaStatusbar,
["SkullFlowerUI"] = C["Media"].Statusbars.SkullFlowerUIStatusbar,
["Tukui"] = C["Media"].Statusbars.TukuiStatusbar,
["ZorkUI"] = C["Media"].Statusbars.ZorkUIStatusbar,
}
local FontTable = {
["Blizzard Outline"] = "BlizzardFontOutline",
["Blizzard"] = "BlizzardFont",
["Expressway Outline"] = "ExpresswayFontOutline",
["Expressway"] = "ExpresswayFont",
["Futura Outline"] = "FuturaFontOutline",
["Futura"] = "FuturaFont",
["KkthnxUI Outline"] = "KkthnxUIFontOutline",
["KkthnxUI"] = "KkthnxUIFont",
["SansNarrow Outline"] = "SansNarrowFontOutline",
["SansNarrow"] = "SansNarrowFont",
}
function K.GetFont(font)
if FontTable[font] then
return FontTable[font]
else
return FontTable["KkthnxUI"] -- Return something to prevent errors
end
end
function K.GetTexture(texture)
if TextureTable[texture] then
return TextureTable[texture]
else
return TextureTable["KkthnxUI"] -- Return something to prevent errors
end
end
function KkthnxUIMedia:RegisterTexture(name, path)
if not TextureTable[name] then
TextureTable[name] = path
end
end
function KkthnxUIMedia:RegisterFont(name, path)
if not FontTable[name] then
FontTable[name] = path
end
end
K["Media"] = KkthnxUIMedia
K["FontTable"] = FontTable
K["TextureTable"] = TextureTable
|
--------------------------------------------------------------------------
-- This derived class of MName handles the atleast and between modifiers
-- for both prereq and load.
-- @classmod MN_Between
require("strict")
--------------------------------------------------------------------------
-- Lmod License
--------------------------------------------------------------------------
--
-- Lmod is licensed under the terms of the MIT license reproduced below.
-- This means that Lmod is free software and can be used for both academic
-- and commercial purposes at absolutely no cost.
--
-- ----------------------------------------------------------------------
--
-- Copyright (C) 2008-2014 Robert McLay
--
-- Permission is hereby granted, free of charge, to any person obtaining
-- a copy of this software and associated documentation files (the
-- "Software"), to deal in the Software without restriction, including
-- without limitation the rights to use, copy, modify, merge, publish,
-- distribute, sublicense, and/or sell copies of the Software, and to
-- permit persons to whom the Software is furnished to do so, subject
-- to the following conditions:
--
-- The above copyright notice and this permission notice shall be
-- included in all copies or substantial portions of the Software.
--
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
-- BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
-- ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-- CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
--
--------------------------------------------------------------------------
local M = inheritsFrom(MName)
local dbg = require("Dbg"):dbg()
local concatTbl = table.concat
M.my_name = "between"
local s_steps = {
MName.find_default_between,
MName.find_between,
}
--------------------------------------------------------------------------
-- Show the atleast or between modifier.
-- @param self A MName object
function M.show(self)
local a = {}
a[#a+1] = self._actName
a[#a+1] = "(\""
a[#a+1] = self:sn() .. '"'
for i = 1, #self._range do
a[#a+1] = ",\""
a[#a+1] = self._range[i] .. '"'
end
a[#a+1] = ")"
return concatTbl(a,"")
end
--------------------------------------------------------------------------
-- Do a prereq check to see if version is in range.
-- @param self A MName object
function M.prereq(self)
local result = false
local mt = MT:mt()
local sn = self:sn()
local usrName = self:usrName()
if (not mt:have(sn,"active")) then
return self:show()
end
local left = parseVersion(self._is)
local right = parseVersion(self._ie)
local full = mt:fullName(sn)
local pv = parseVersion(mt:Version(sn))
if (pv < left or pv > right) then
result = self:show()
end
return result
end
--------------------------------------------------------------------------
-- Check to see if the currently loaded module is in range.
-- @param self A MName object
function M.isloaded(self)
local mt = MT:mt()
local sn = self:sn()
if (not mt:have(sn,"active")) then
return self:isPending()
end
local left = parseVersion(self._is)
local right = parseVersion(self._ie)
local full = mt:fullName(sn)
local pv = parseVersion(mt:Version(sn))
return (left <= pv and pv <= right)
end
--------------------------------------------------------------------------
-- Check to see if the isPending module is in range.
-- @param self A MName object
function M.isPending(self)
local mt = MT:mt()
local sn = self:sn()
if (not mt:have(sn,"pending")) then
return false
end
local left = parseVersion(self._is)
local right = parseVersion(self._ie)
local full = mt:fullName(sn)
local pv = parseVersion(mt:Version(sn))
return (left <= pv and pv <= right)
end
--------------------------------------------------------------------------
-- Return the steps used in the Between class.
function M.steps()
return s_steps
end
return M
|
-- ============================================================================
-- Note! As of Aug 16th 2021, LspInstall does not support installing emmet-ls
-- The following configuration expects emmet-ls to be locally installed:
--
-- $ mkdir -p $HOME/.local/share/nvim/lspinstall/emmet
-- $ cd $HOME/.local/share/nvim/lspinstall/emmet
-- $ npm init -y
-- $ npm install emmet-ls
-- $ cd -
--
-- ============================================================================
--
local utils = require "utils"
-- Skip configuring emmet language server client if project
-- does not look like a web project
if not utils.is_web_project() then
return
end
local lspconfig = require "lspconfig"
local configs = require "lspconfig/configs"
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities.textDocument.completion.completionItem.snippetSupport = true
capabilities.textDocument.completion.completionItem.resolveSupport = {
properties = {
"documentation",
"detail",
"additionalTextEdits",
},
}
if not lspconfig.emmet_ls then
configs.emmet_ls = {
default_config = {
cmd = { vim.fn.stdpath "data" .. "/lsp_servers/emmet_ls/node_modules/.bin/emmet-ls", "--stdio" },
filetypes = {
"aspnetcorerazor",
"css",
"django-html",
"gohtml",
"html",
"less",
"php",
"postcss",
"razor",
"sass",
"scss",
"svelte",
"vue",
},
root_dir = function(_)
return vim.loop.cwd()
end,
settings = {},
},
}
end
lspconfig.emmet_ls.setup { capabilities = capabilities }
|
--Author information
SWEP.Author = "Killberty"
SWEP.Contact = "http://steamcommunity.com/id/killberty"
if SERVER then
-- Adds the current file to the list of files to be downloaded by clients.
AddCSLuaFile()
-- Adds a workshop addon for the client to download before entering the server.
resource.AddWorkshop("853158897")
elseif CLIENT then
LANG.AddToLanguage("english", "traitorremote_name", "Traitor Remote")
LANG.AddToLanguage("english", "traitorremote_desc", "Remote control your fellow terrorists.")
SWEP.PrintName = "traitorremote_name"
SWEP.Slot = 7 -- +1
SWEP.Icon = "VGUI/ttt/icon_traitor_remote"
SWEP.EquipMenuData = {type = "item_weapon", desc = "traitorremote_desc"}
end
SWEP.Base = "weapon_tttbase"
SWEP.DrawCrosshair = false
SWEP.Primary.ClipSize = 10
SWEP.Primary.DefaultClip = 10
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "AirboatGun"
SWEP.Primary.SoundSuccess = Sound("garrysmod/ui_click.wav")
SWEP.Primary.SoundFail = Sound("garrysmod/ui_hover.wav")
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Secondary.Sound = Sound("hl1/fvox/beep.wav")
SWEP.DrawAmmo = false
SWEP.Kind = WEAPON_ROLE
SWEP.AutoSpawnable = false
SWEP.CanBuy = {ROLE_TRAITOR} -- only traitors can buy
SWEP.LimitedStock = true -- only buyable once
SWEP.IsSilent = false -- Pull out faster than standard guns
SWEP.AllowDrop = false -- UNTIL VIEWMODEL DROPPING ISSUE is fixed
SWEP.NoSights = true
SWEP.HoldType = "slam"
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
SWEP.UseHands = false
SWEP.ViewModel = "models/weapons/v_slam.mdl"
SWEP.WorldModel = "models/props/cs_office/projector_remote.mdl"
SWEP.ShowViewModel = true
SWEP.ShowWorldModel = true
SWEP.ViewModelBoneMods = {
["Bip01_L_Clavicle"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Hand"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger4"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger22"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Detonator"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger42"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Slam_panel"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger02"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger0"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger11"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Forearm"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Slam_base"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger3"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger1"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger2"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger32"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger31"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger41"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger12"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_Finger01"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(0, 0, 0), angle = Angle(0, 0, 0) },
["Bip01_L_UpperArm"] = { scale = Vector(0.009, 0.009, 0.009), pos = Vector(-30, -30, -30), angle = Angle(-180, -180, -180) }
}
SWEP.VElements = {
["remote"] = { type = "Model", model = "models/props/cs_office/projector_remote.mdl", bone = "Bip01_R_Finger0", rel = "", pos = Vector(3.635, -1.558, -2.597), angle = Angle(15.194, 22.208, 38.57), size = Vector(1.274, 1.274, 1.274), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
SWEP.WElements = {
["remote"] = { type = "Model", model = "models/props/cs_office/projector_remote.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(5.714, 1.557, -3.636), angle = Angle(-10.521, -115.714, 108.699), size = Vector(1.274, 1.274, 1.274), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }
}
local Actions = {
{"+jump", "-jump", 0.2},
{"+forward", "-forward", 1.0},
{"+back", "-back", 1.0},
{"+moveleft", "-moveleft", 1.0},
{"+moveright", "-moveright", 1.0},
{"+menu", "-menu", 0.2},
{"+attack", "-attack", 0.5},
}
SWEP.CurrentAction = {"+attack", "-attack", 0.5}
SWEP.Actions = Actions
SWEP.NextRemoteAction = 1
SWEP.NextRemoteActionChange = 1
function SWEP:PrimaryAttack()
if CurTime() < self.NextRemoteAction then return end
local trEntity = self.Owner:GetEyeTrace().Entity
if SERVER then
if self.Owner:GetEyeTrace().HitNonWorld and self.Owner:GetEyeTrace().Entity:IsPlayer()
and IsValid(trEntity) and trEntity:IsTerror() and trEntity:Alive() then
if self:Clip1() ~= 0 then
self.Owner:ChatPrint("Hit " .. trEntity:Nick() .. " with ".. self.CurrentAction[1])
trEntity:ConCommand(self.CurrentAction[1]);
timer.Simple(self.CurrentAction[3], function() trEntity:ConCommand(self.CurrentAction[2]) end )
self:TakePrimaryAmmo(1)
self.Owner:ViewPunch(Angle(-0.3, 0, 0))
self.NextRemoteAction = CurTime() + 1.0
end
end
end
end
function SWEP:SecondaryAttack()
if CurTime() < self.NextRemoteActionChange then return end
self.NextRemoteActionChange = CurTime() + 0.1
self.CurrentAction = table.FindNext(self.Actions, self.CurrentAction)
self:ShowCurrentAction()
end
function SWEP:Deploy()
self:ShowCurrentAction()
-- Viewmodel stuff
if CLIENT and IsValid(self.Owner) then
local vm = self.Owner:GetViewModel()
if IsValid(vm) then
self:UpdateBonePositions(vm)
end
end
return true
end
function SWEP:Precache()
util.PrecacheSound(self.Primary.SoundSuccess)
util.PrecacheSound(self.Primary.SoundFail)
util.PrecacheSound(self.Secondary.Sound)
end
function SWEP:ShowCurrentAction()
if CLIENT then
chat.AddText(
Color( 200, 20, 20 ), "[Traitor Remote] ",
Color( 250, 250, 250 ), "Current remote action: ",
Color(237, 177, 12), self.CurrentAction[1]
)
end
end
function SWEP:Initialize()
-- self:ShowCurrentAction()
if CLIENT then
self:AddHUDHelp("PrimaryAttack: Use remote", "SecondaryAttack: Change remote action", false)
end
if CLIENT then
// Create a new table for every weapon instance
self.VElements = table.FullCopy( self.VElements )
self.WElements = table.FullCopy( self.WElements )
self.ViewModelBoneMods = table.FullCopy( self.ViewModelBoneMods )
self:CreateModels(self.VElements) // create viewmodels
self:CreateModels(self.WElements) // create worldmodels
// init view model bone build function
if IsValid(self.Owner) then
local vm = self.Owner:GetViewModel()
if IsValid(vm) then
self:ResetBonePositions(vm)
// Init viewmodel visibility
if (self.ShowViewModel == nil or self.ShowViewModel) then
vm:SetColor(Color(255,255,255,255))
else
// we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called
vm:SetColor(Color(255,255,255,1))
// ^ stopped working in GMod 13 because you have to do Entity:SetRenderMode(1) for translucency to kick in
// however for some reason the view model resets to render mode 0 every frame so we just apply a debug material to prevent it from drawing
vm:SetMaterial("Debug/hsv")
end
end
end
end
end
function SWEP:Holster()
-- Viewmodel stuff
if CLIENT and IsValid(self.Owner) then
local vm = self.Owner:GetViewModel()
if IsValid(vm) then
self:ResetBonePositions(vm)
end
end
return true
end
function SWEP:OnRemove()
-- Viewmodel stuff
if CLIENT and IsValid(self.Owner) then
local vm = self.Owner:GetViewModel()
if IsValid(vm) then
self:ResetBonePositions(vm)
end
end
end
function SWEP:OnDrop()
--
end
hook.Add("TTTEndRound", "Timer_End", function()
for k,v in pairs(player.GetAll()) do
for i,action in pairs(Actions) do
v:ConCommand(action[2])
end
end
end)
hook.Add("TTTPrepareRound", "Timer_Prep", function()
for k,v in pairs(player.GetAll()) do
for i,action in pairs(Actions) do
v:ConCommand(action[2])
end
end
end)
if CLIENT then
SWEP.vRenderOrder = nil
function SWEP:ViewModelDrawn()
local vm = self.Owner:GetViewModel()
if !IsValid(vm) then return end
if (!self.VElements) then return end
self:UpdateBonePositions(vm)
if (!self.vRenderOrder) then
// we build a render order because sprites need to be drawn after models
self.vRenderOrder = {}
for k, v in pairs( self.VElements ) do
if (v.type == "Model") then
table.insert(self.vRenderOrder, 1, k)
elseif (v.type == "Sprite" or v.type == "Quad") then
table.insert(self.vRenderOrder, k)
end
end
end
for k, name in ipairs( self.vRenderOrder ) do
local v = self.VElements[name]
if (!v) then self.vRenderOrder = nil break end
if (v.hide) then continue end
local model = v.modelEnt
local sprite = v.spriteMaterial
if (!v.bone) then continue end
local pos, ang = self:GetBoneOrientation( self.VElements, v, vm )
if (!pos) then continue end
if (v.type == "Model" and IsValid(model)) then
model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z )
ang:RotateAroundAxis(ang:Up(), v.angle.y)
ang:RotateAroundAxis(ang:Right(), v.angle.p)
ang:RotateAroundAxis(ang:Forward(), v.angle.r)
model:SetAngles(ang)
//model:SetModelScale(v.size)
local matrix = Matrix()
matrix:Scale(v.size)
model:EnableMatrix( "RenderMultiply", matrix )
if (v.material == "") then
model:SetMaterial("")
elseif (model:GetMaterial() != v.material) then
model:SetMaterial( v.material )
end
if (v.skin and v.skin != model:GetSkin()) then
model:SetSkin(v.skin)
end
if (v.bodygroup) then
for k, v in pairs( v.bodygroup ) do
if (model:GetBodygroup(k) != v) then
model:SetBodygroup(k, v)
end
end
end
if (v.surpresslightning) then
render.SuppressEngineLighting(true)
end
render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255)
render.SetBlend(v.color.a/255)
model:DrawModel()
render.SetBlend(1)
render.SetColorModulation(1, 1, 1)
if (v.surpresslightning) then
render.SuppressEngineLighting(false)
end
elseif (v.type == "Sprite" and sprite) then
local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
render.SetMaterial(sprite)
render.DrawSprite(drawpos, v.size.x, v.size.y, v.color)
elseif (v.type == "Quad" and v.draw_func) then
local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
ang:RotateAroundAxis(ang:Up(), v.angle.y)
ang:RotateAroundAxis(ang:Right(), v.angle.p)
ang:RotateAroundAxis(ang:Forward(), v.angle.r)
cam.Start3D2D(drawpos, ang, v.size)
v.draw_func( self )
cam.End3D2D()
end
end
end
SWEP.wRenderOrder = nil
function SWEP:DrawWorldModel()
if (self.ShowWorldModel == nil or self.ShowWorldModel) then
self:DrawModel()
end
if (!self.WElements) then return end
if (!self.wRenderOrder) then
self.wRenderOrder = {}
for k, v in pairs( self.WElements ) do
if (v.type == "Model") then
table.insert(self.wRenderOrder, 1, k)
elseif (v.type == "Sprite" or v.type == "Quad") then
table.insert(self.wRenderOrder, k)
end
end
end
if (IsValid(self.Owner)) then
bone_ent = self.Owner
else
// when the weapon is dropped
bone_ent = self
end
for k, name in pairs( self.wRenderOrder ) do
local v = self.WElements[name]
if (!v) then self.wRenderOrder = nil break end
if (v.hide) then continue end
local pos, ang
if (v.bone) then
pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent )
else
pos, ang = self:GetBoneOrientation( self.WElements, v, bone_ent, "ValveBiped.Bip01_R_Hand" )
end
if (!pos) then continue end
local model = v.modelEnt
local sprite = v.spriteMaterial
if (v.type == "Model" and IsValid(model)) then
model:SetPos(pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z )
ang:RotateAroundAxis(ang:Up(), v.angle.y)
ang:RotateAroundAxis(ang:Right(), v.angle.p)
ang:RotateAroundAxis(ang:Forward(), v.angle.r)
model:SetAngles(ang)
//model:SetModelScale(v.size)
local matrix = Matrix()
matrix:Scale(v.size)
model:EnableMatrix( "RenderMultiply", matrix )
if (v.material == "") then
model:SetMaterial("")
elseif (model:GetMaterial() != v.material) then
model:SetMaterial( v.material )
end
if (v.skin and v.skin != model:GetSkin()) then
model:SetSkin(v.skin)
end
if (v.bodygroup) then
for k, v in pairs( v.bodygroup ) do
if (model:GetBodygroup(k) != v) then
model:SetBodygroup(k, v)
end
end
end
if (v.surpresslightning) then
render.SuppressEngineLighting(true)
end
render.SetColorModulation(v.color.r/255, v.color.g/255, v.color.b/255)
render.SetBlend(v.color.a/255)
model:DrawModel()
render.SetBlend(1)
render.SetColorModulation(1, 1, 1)
if (v.surpresslightning) then
render.SuppressEngineLighting(false)
end
elseif (v.type == "Sprite" and sprite) then
local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
render.SetMaterial(sprite)
render.DrawSprite(drawpos, v.size.x, v.size.y, v.color)
elseif (v.type == "Quad" and v.draw_func) then
local drawpos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
ang:RotateAroundAxis(ang:Up(), v.angle.y)
ang:RotateAroundAxis(ang:Right(), v.angle.p)
ang:RotateAroundAxis(ang:Forward(), v.angle.r)
cam.Start3D2D(drawpos, ang, v.size)
v.draw_func( self )
cam.End3D2D()
end
end
end
function SWEP:GetBoneOrientation( basetab, tab, ent, bone_override )
local bone, pos, ang
if (tab.rel and tab.rel != "") then
local v = basetab[tab.rel]
if (!v) then return end
// Technically, if there exists an element with the same name as a bone
// you can get in an infinite loop. Let's just hope nobody's that stupid.
pos, ang = self:GetBoneOrientation( basetab, v, ent )
if (!pos) then return end
pos = pos + ang:Forward() * v.pos.x + ang:Right() * v.pos.y + ang:Up() * v.pos.z
ang:RotateAroundAxis(ang:Up(), v.angle.y)
ang:RotateAroundAxis(ang:Right(), v.angle.p)
ang:RotateAroundAxis(ang:Forward(), v.angle.r)
else
bone = ent:LookupBone(bone_override or tab.bone)
if (!bone) then return end
pos, ang = Vector(0,0,0), Angle(0,0,0)
local m = ent:GetBoneMatrix(bone)
if (m) then
pos, ang = m:GetTranslation(), m:GetAngles()
end
if (IsValid(self.Owner) and self.Owner:IsPlayer() and
ent == self.Owner:GetViewModel() and self.ViewModelFlip) then
ang.r = -ang.r // Fixes mirrored models
end
end
return pos, ang
end
function SWEP:CreateModels( tab )
if (!tab) then return end
// Create the clientside models here because Garry says we cant do it in the render hook
for k, v in pairs( tab ) do
if (v.type == "Model" and v.model and v.model != "" and (!IsValid(v.modelEnt) or v.createdModel != v.model) and
string.find(v.model, ".mdl") and file.Exists (v.model, "GAME") ) then
v.modelEnt = ClientsideModel(v.model, RENDER_GROUP_VIEW_MODEL_OPAQUE)
if (IsValid(v.modelEnt)) then
v.modelEnt:SetPos(self:GetPos())
v.modelEnt:SetAngles(self:GetAngles())
v.modelEnt:SetParent(self)
v.modelEnt:SetNoDraw(true)
v.createdModel = v.model
else
v.modelEnt = nil
end
elseif (v.type == "Sprite" and v.sprite and v.sprite != "" and (!v.spriteMaterial or v.createdSprite != v.sprite)
and file.Exists ("materials/"..v.sprite..".vmt", "GAME")) then
local name = v.sprite.."-"
local params = { ["$basetexture"] = v.sprite }
// make sure we create a unique name based on the selected options
local tocheck = { "nocull", "additive", "vertexalpha", "vertexcolor", "ignorez" }
for i, j in pairs( tocheck ) do
if (v[j]) then
params["$"..j] = 1
name = name.."1"
else
name = name.."0"
end
end
v.createdSprite = v.sprite
v.spriteMaterial = CreateMaterial(name,"UnlitGeneric",params)
end
end
end
local allbones
local hasGarryFixedBoneScalingYet = false
function SWEP:UpdateBonePositions(vm)
if self.ViewModelBoneMods then
if (!vm:GetBoneCount()) then return end
// !! WORKAROUND !! //
// We need to check all model names :/
local loopthrough = self.ViewModelBoneMods
if (!hasGarryFixedBoneScalingYet) then
allbones = {}
for i=0, vm:GetBoneCount() do
local bonename = vm:GetBoneName(i)
if (self.ViewModelBoneMods[bonename]) then
allbones[bonename] = self.ViewModelBoneMods[bonename]
else
allbones[bonename] = {
scale = Vector(1,1,1),
pos = Vector(0,0,0),
angle = Angle(0,0,0)
}
end
end
loopthrough = allbones
end
// !! ----------- !! //
for k, v in pairs( loopthrough ) do
local bone = vm:LookupBone(k)
if (!bone) then continue end
// !! WORKAROUND !! //
local s = Vector(v.scale.x,v.scale.y,v.scale.z)
local p = Vector(v.pos.x,v.pos.y,v.pos.z)
local ms = Vector(1,1,1)
if (!hasGarryFixedBoneScalingYet) then
local cur = vm:GetBoneParent(bone)
while(cur >= 0) do
local pscale = loopthrough[vm:GetBoneName(cur)].scale
ms = ms * pscale
cur = vm:GetBoneParent(cur)
end
end
s = s * ms
// !! ----------- !! //
if vm:GetManipulateBoneScale(bone) != s then
vm:ManipulateBoneScale( bone, s )
end
if vm:GetManipulateBoneAngles(bone) != v.angle then
vm:ManipulateBoneAngles( bone, v.angle )
end
if vm:GetManipulateBonePosition(bone) != p then
vm:ManipulateBonePosition( bone, p )
end
end
else
self:ResetBonePositions(vm)
end
end
function SWEP:ResetBonePositions(vm)
if (!vm:GetBoneCount()) then return end
for i=0, vm:GetBoneCount() do
vm:ManipulateBoneScale( i, Vector(1, 1, 1) )
vm:ManipulateBoneAngles( i, Angle(0, 0, 0) )
vm:ManipulateBonePosition( i, Vector(0, 0, 0) )
end
end
-- Fully copies the table, meaning all tables inside this table are copied too and so on (normal table.Copy copies only their reference).
function table.FullCopy( tab )
if (!tab) then return nil end
local res = {}
for k, v in pairs( tab ) do
if (type(v) == "table") then
res[k] = table.FullCopy(v) // recursion ho!
elseif (type(v) == "Vector") then
res[k] = Vector(v.x, v.y, v.z)
elseif (type(v) == "Angle") then
res[k] = Angle(v.p, v.y, v.r)
else
res[k] = v
end
end
return res
end
end |
---------------
-- Markdown-flavoured and very simple no-structure style.
--
-- Here the idea is to structure the document entirely with [Markdown]().
--
-- Using the default markdown processor can be a little irritating: you are
-- required to give a blank line before starting lists. The default stylesheet
-- is not quite right, either.
--
module 'mod'
--- Combine two strings _first_ and _second_ in interesting ways.
function combine(first,second)
end
--- Combine a whole bunch of strings.
function combine_all(...)
end
---
-- Creates a constant capture. This pattern matches the empty string and
-- produces all given values as its captured values.
function lpeg.Cc([value, ...]) end
--- Split a string _str_. Returns the first part and the second part, so that
-- `combine(first,second)` is equal to _s_.
function split(s)
end
--- Split a string _text_ into a table.
-- Returns:
--
-- - `name` the name of the text
-- - `pairs` an array of pairs
-- - `key`
-- - `value`
-- - `length`
--
function split_table (text)
end
--- A table of useful constants.
--
-- - `alpha` first correction factor
-- - `beta` second correction factor
--
-- @table constants
|
local addonName, _ = ...;
-- NIL = 240
-- INT = 241
-- TRUE = 242
-- FALSE = 243
-- STRING = 244
local serialize, deserialize = {}, {};
serialize["nil"] = function() return "\240" end
serialize["number"] = function(n) return "\241" .. n end
serialize["boolean"] = function(bool) return bool and "\242" or "\243" end
serialize["string"] = function(str) return "\244" .. str end
deserialize["\240"] = function() return nil end
deserialize["\241"] = function(str) return tonumber(str) end
deserialize["\242"] = function() return true end
deserialize["\243"] = function() return false end
deserialize["\244"] = function(str) return str end
local function Serialize(...)
local t = {};
for i = 1, select("#", ...) do
local v = select(i, ...);
table.insert(t, serialize[type(v)](v));
end
return table.concat(t);
end
local function Deserialize(str)
local t = {};
for type, v in string.gmatch(str, "([\240-\244])([^\240-\244]*)") do
table.insert(t, deserialize[type](v));
end
return unpack(t);
end
-- Frame
LootCouncilMixin = {
channel = "RAID",
events = {
"CHAT_MSG_ADDON",
"LOOT_READY",
"LOOT_OPENED",
"LOOT_CLOSED"
}
};
function LootCouncilMixin:OnLoad()
_G.C_ChatInfo.RegisterAddonMessagePrefix(addonName);
for _, event in pairs(self.events) do
self:RegisterEvent(event);
end
end
function LootCouncilMixin:OnEvent(event, ...)
LootCouncilMixin[event](self, ...);
end
function LootCouncilMixin:CHAT_MSG_ADDON(prefix, message, channel, sender, ...)
if prefix ~= addonName or channel ~= self.channel then return end
print(sender, Deserialize(message));
MasterLootFrame:Show();
end
function LootCouncilMixin:LOOT_READY(autoloot)
-- print("LOOT_READY");
--[[
for index = 1, MAX_RAID_MEMBERS do
local candidate = GetMasterLootCandidate(slot, index);
if not candidate then break end
print(" " .. index .. " -> " .. candidate);
end
]]--
end
function LootCouncilMixin:LOOT_OPENED(autoLoot, isFromItem)
-- print("LOOT_OPENED");
for slot, info in pairs(GetLootInfo()) do
local message = Serialize(info.item, info.quality, info.quantity, info.texture);
_G.C_ChatInfo.SendAddonMessage(addonName, message, self.channel);
end
end
function LootCouncilMixin:LOOT_CLOSED()
-- print("LOOT_CLOSED");
end
|
----------------------------------------------------
-- This is the main LUA runtime library of FastPM.
--
-- Author: Yu Feng <rainwoodman@gmail.com> 2016
----------------------------------------------------
local config = require("lua-runtime-config")
local _NAME = ... or 'main'
local fastpm = {}
local schema = config.Schema()
schema.declare{name='nc', type='int', required=true, help="Number of Particles Per side"}
schema.declare{name='boxsize', type='number', required=true, help="Size of box in Mpc/h"}
schema.declare{name='time_step', type='array:number', required=true, help="Scaling factor of steps, can be linspace(start, end, Nsteps)." }
schema.declare{name='output_redshifts', type='array:number', required=false, help="Redshifts for outputs" }
schema.declare{name='aout', type='array:number', required=false, help='a of redshifts'}
-- set aout from output_redshifts
function schema.aout.action(aout)
schema.output_redshifts.required = false
end
-- set aout from output_redshifts
function schema.output_redshifts.action(output_redshifts)
local aout = {}
if output_redshifts ~= nil then
for i, z in pairs(output_redshifts) do
aout[i] = 1.0 / (z + 1.)
end
schema.aout.default = aout
end
end
-- Note: the order of variable declaration is important when applying scheme.variable.action later in this file.
schema.declare{name='omega_m', type='number', required=false, help='This is depreciated. Please use Omega_m (uppercase O).'}
schema.declare{name='Omega_m', type='number', required=false, help='Total matter (cdm + baryon + ncdm) density parameter at z=0'}
schema.declare{name='T_cmb', type='number', required=false, default=0, help="CMB temperature in K, 0 to turn off radiation."}
schema.declare{name='h', type='number', required=true, default=0.7, help="Dimensionless Hubble parameter"}
schema.declare{name='Omega_k', type='number', required=false, default=0, help="Curvature density parameter. (Omega_k > 0 is an open universe.)"}
schema.declare{name='w0', type='number', required=false, default=-1, help="Dark energy equation of state 0th order parameter: w(a) = w0 + (1-a) wa."}
schema.declare{name='wa', type='number', required=false, default=0, help="Dark energy equation of state 1st order parameter: w(a) = w0 + (1-a) wa."}
schema.declare{name='N_eff', type='number', required=false, default=3.046}
schema.declare{name='N_nu', type='number', required=false, default=0, help="Total number of neutrinos, massive and massless."}
schema.declare{name='m_ncdm', type='array:number', required=false, default={}, help="Mass of ncdm particles in eV. Enter in descending order."}
schema.declare{name='pm_nc_factor', type='array:number', required=true, help="A list of {a, PM resolution}, "}
schema.declare{name='lpt_nc_factor', type='number', required=false, default=1, help="PM resolution use in lpt and linear density field."}
schema.declare{name='np_alloc_factor', type='number', required=true, help="Over allocation factor for load imbalance" }
schema.declare{name='compute_potential', type='boolean', required=false, default=false, help="Calculate the gravitional potential."}
schema.declare{name='n_shell', type='number', required=false, default=10, help="Number of shells of FD distribution for ncdm splitting. Set n_shell=0 for no ncdm particles."}
schema.declare{name='lvk', type='boolean', required=false, default=true, help="Use the low velocity kernel when splitting FD for ncdm."}
schema.declare{name='n_side', type='number', required=false, default=3, help="This is N_fib for fibonacci sphere splitting, or number of sides in HEALPix splitting."}
schema.declare{name='every_ncdm', type='number', required=false, default=4, help="Subsample ncdm from cdm every..."}
schema.declare{name='ncdm_sphere_scheme',type='enum', required=false, default="fibonacci", help="Split sphere with 'fibonacci' or 'healpix'?"}
schema.ncdm_sphere_scheme.choices = {
healpix = 'FASTPM_NCDM_SPHERE_HEALPIX',
fibonacci = 'FASTPM_NCDM_SPHERE_FIBONACCI',
}
schema.declare{name='ncdm_matterlike', type='boolean', required=false, default=true, help="Approximate ncdm as matter-like in the background? If true, Omega_ncdm~1/a^3."}
schema.declare{name='ncdm_freestreaming', type='boolean', required=false, default=true, help="Treat ncdm as free-streaming? If true, source terms ~Omega_c; if false, ~Omega_m."}
schema.declare{name='growth_mode', type='enum', default='ODE', help="Evaluate growth factors using a Lambda+CDM-only approximation or with the full ODE. " ..
"The full ODE is required for accurate results for runs with radiation or varying DE in the background, " ..
"and can also be used for Lambda+CDM-only backgrounds. " ..
"The LCDM approximation is included for backward compatibility."}
schema.growth_mode.choices = {
LCDM = 'FASTPM_GROWTH_MODE_LCDM',
ODE = 'FASTPM_GROWTH_MODE_ODE',
}
-- enforce Omega_m
function schema.omega_m.action (value)
if value ~= nil then
error("omega_m is depreciated, please use Omega_m (uppercase O) instead.")
end
end
-- check for bad input
function schema.T_cmb.action (T_cmb)
if T_cmb ~= 0 then
function schema.growth_mode.action (growth_mode)
if growth_mode ~= 'ODE' then
error("For a run with radiation (T_cmb > 0) use growth_mode='ODE' for accurate results.")
end
end
end
function schema.m_ncdm.action (m_ncdm)
if #m_ncdm ~= 0 then
for i=2, #m_ncdm do
if m_ncdm[i] > m_ncdm[1] then
error("Please input the heaviest ncdm particle first.")
end
end
function schema.n_shell.action (n_shell)
function schema.ncdm_freestreaming.action (ncdm_freestreaming)
if ncdm_freestreaming and n_shell ~= 0 then
error("For free-streaming ncdm use n_shell = 0 to turn off ncdm particles.")
end
end
end
function schema.ncdm_matterlike.action (ncdm_matterlike)
if not ncdm_matterlike and T_cmb == 0 then
error("For a run with exact Omega_ncdm, T_cmb > 0 is required.")
end
end
end
end
end
-- Force calculation --
schema.declare{name='painter_type', type='enum', default='cic', help="Type of painter."}
schema.declare{name='painter_support', type='int', default=2, help="Support (size) of the painting kernel"}
schema.painter_type.choices = {
cic = 'FASTPM_PAINTER_CIC',
linear = 'FASTPM_PAINTER_LINEAR',
lanczos = 'FASTPM_PAINTER_LANCZOS',
}
function schema.painter_type.action(painter_type)
if painter_type ~= 'cic' then
schema.painter_support.required = true
end
end
schema.declare{name='force_mode', type='enum', default='fastpm'}
schema.force_mode.choices = {
cola = 'FASTPM_FORCE_COLA',
zola = 'FASTPM_FORCE_FASTPM',
fastpm = 'FASTPM_FORCE_FASTPM',
pm = 'FASTPM_FORCE_PM',
}
schema.declare{name='enforce_broadband_kmax', type='int', default=4}
-- Primordial Non-Gaussianity --
schema.declare{name='f_nl_type', type='enum', default='none'}
schema.f_nl_type.choices = {
['local'] = 'FASTPM_FNL_LOCAL',
['none'] = 'FASTPM_FNL_NONE',
}
schema.declare{name='f_nl', type='number'}
schema.declare{name='kmax_primordial_over_knyquist', type='number', default=0.25}
schema.declare{name='scalar_amp', type='number'}
schema.declare{name='scalar_pivot', type='number'}
schema.declare{name='scalar_spectral_index', type='number'}
function schema.f_nl_type.action (f_nl_type)
if f_nl_type ~= 'none' then
schema.f_nl.required = true
schema.scalar_amp.required = true
schema.scalar_pivot.required = true
schema.scalar_spectral_index.required = true
end
end
-- Initial condition --
schema.declare{name='read_lineark', type='string', help='lineark for cdm'}
schema.declare{name='read_powerspectrum', type='file', help='file to read the linear power spectrum for cdm.'}
schema.declare{name='read_linear_growth_rate', type ='file', help='file to read the linear growth rate (f_1) of cdm. If left empty, will use internal f_1.'}
schema.declare{name='linear_density_redshift', type='number', default=0, help='redshift of the input linear cdm density field. '}
schema.declare{name='read_lineark_ncdm', type='string', help='file to read the lineark of ncdm.'}
schema.declare{name='read_powerspectrum_ncdm', type='file', help='file to read the linear power spectrum of ncdm.'}
schema.declare{name='read_linear_growth_rate_ncdm', type ='file', help='file to read the linear growth rate (f_1) of ncdm. If left empty, will use internal f_1.'}
schema.declare{name='linear_density_redshift_ncdm', type='number', default=0, help='redshift of the input linear ncdm density field.'}
schema.declare{name='read_grafic', type='string'}
schema.declare{name='read_runpbic', type='string'}
schema.declare{name='read_whitenoisek', type='string'}
schema.declare{name='sigma8', type='number', default=0, help='normalize linear power spectrumt to sigma8(z); this shall be sigma8 at linear_density_redshift, not z=0.'}
schema.declare{name='random_seed', type='int'}
schema.declare{name='shift', type='boolean', default=false}
schema.declare{name='inverted_ic', type='boolean', default=false}
schema.declare{name='remove_cosmic_variance', type='boolean', default=false}
function schema.read_grafic.action (read_grafic)
if read_grafic ~= nil then
schema.random_seed.required = false
schema.read_powerspectrum.required = true
end
end
function schema.read_lineark.action (read_lineark)
if read_lineark ~= nil then
schema.random_seed.required = false
schema.read_powerspectrum.required = false
end
end
function schema.read_runpbic.action (read_runpbic)
if read_runpbic ~= nil then
schema.random_seed.required = false
schema.read_powerspectrum.required = false
end
end
function schema.read_whitenoisek.action (read_whitenoisek)
if read_whitenoisek ~= nil then
schema.random_seed.required = false
schema.read_powerspectrum.required = true
end
end
schema.declare{name='write_lineark', type='string'}
schema.declare{name='write_whitenoisek', type='string'}
schema.declare{name='write_runpbic', type='string'}
schema.declare{name='write_powerspectrum', type='string'}
schema.declare{name='write_snapshot', type='string'}
schema.declare{name='write_nonlineark', type='string'}
schema.declare{name='write_runpb_snapshot', type='string'}
schema.declare{name='particle_fraction', type='number', default=1.0, help='Fraction of particles to save in the snapshot (sub-sampling)'}
schema.declare{name='sort_snapshot', type='boolean', default=true, help='sort snapshots by ID; very large communication is incurred during snapshots.'}
schema.declare{name='write_fof', type='string', help='Path to save the fof catalog, will be in the FOF-0.200 dataset. (or other linking length).'}
schema.declare{name='fof_linkinglength', type='number', default=0.2, help='linking length of FOF; in units of particle mean separation.'}
schema.declare{name='fof_nmin', type='number', default=20, help='threshold for making into the FOF catalog.'}
schema.declare{name='fof_kdtree_thresh', type='number', default=8, help='threshold for spliting a kdtree node. KDTree is used in fof. smaller uses more memory but fof runs faster.'}
schema.declare{name='lc_amin',
type='number', help='min scale factor for truncation of lightcone.'}
schema.declare{name='lc_amax',
type='number', help='max scale factor for truncation of lightcone.'}
schema.declare{name='lc_write_usmesh', type='string', help='file name base for writing the particle lightcone'}
schema.declare{name='lc_usmesh_alloc_factor', type='number', default=1.0,
help='allocation factor for the unstructured mesh, relative to alloc_factor.'}
schema.declare{name='lc_usmesh_fof_padding', type='number', default=10.0,
help='padding in the line of sight direction for light cone fof. roughly the size of a halo.'}
schema.declare{name='lc_usmesh_tiles', type='array:number',
default={
{0, 0, 0},
},
help=[[tiling of the simulation box, in units of box edges.
all tiles will be considered during lightcone construction.
tiling occurs before the glmatrix.]]
}
schema.declare{name='dh_factor', type='number', default=1.0, help='Scale Hubble distance to amplify the lightcone effect'}
schema.declare{name='lc_fov', type='number', default=0.0, help=' field of view of the sky in degrees. 0 for flat sky and 360 for full sky. The beam is along the z-direction after glmatrix.'}
schema.declare{name='lc_octants', type='array:number', default={0, 1, 2, 3, 4, 5, 6, 7},
help='list of octants to include when fov>=360 degrees.'}
schema.declare{name='lc_glmatrix', type='array:number',
default={
{1, 0, 0, 0,},
{0, 1, 0, 0,},
{0, 0, 1, 0,},
{0, 0, 0, 1,},
},
help=[[transformation matrix to move simulation coordinate (x, y, z, 1) to the observer coordinate with a left dot product.
The observer is sitting at z=0 in the observer coordinate. The last column of the matrix is the translation in Mpc/h.
use the translation and rotation methods provide in the intepreter to build the matrix. ]]}
schema.declare{name='za', type='boolean', default=false, help='use ZA initial condition not 2LPT'}
schema.declare{name='kernel_type', type='enum', default="1_4", help='Force kernel; affects low mass halos 3_4 gives more low mass halos; 1_4 is consistent with fastpm-python.'}
schema.kernel_type.choices = {
['1_4'] = 'FASTPM_KERNEL_1_4', -- consistent with fastpm-python
['3_4'] = 'FASTPM_KERNEL_3_4', -- legacy fastpm
['gadget'] = 'FASTPM_KERNEL_GADGET', -- GADGET long range without exp smoothing.
['5_4'] = 'FASTPM_KERNEL_5_4', -- very bad do not use
['eastwood'] = 'FASTPM_KERNEL_EASTWOOD',
['naive'] = 'FASTPM_KERNEL_NAIVE',
['3_2'] = 'FASTPM_KERNEL_3_2',
}
schema.declare{name='force_softening_type', type='enum', default="none", help='Softening kernel (wipes out small scale force), very little effect)'}
schema.force_softening_type.choices = {
none = 'FASTPM_SOFTENING_NONE',
gaussian = 'FASTPM_SOFTENING_GAUSSIAN',
gadget_long_range = 'FASTPM_SOFTENING_GADGET_LONG_RANGE',
gaussian36 = 'FASTPM_SOFTENING_GAUSSIAN36',
twothird = 'FASTPM_SOFTENING_TWO_THIRD',
}
schema.declare{name='constraints', type='array:number', help="A list of {x, y, z, peak-sigma}, giving the constraints in MPC/h units. "}
function schema.constraints.action (constraints)
if constraints == nil then
return
end
for i,v in pairs(constraints) do
if #v ~= 4 then
error("contraints must be a list of 4-vectors (x, y, z, peak-sigma)")
end
end
end
schema.declare{name='set_mode_method', type='string', default="override", help="override or relative"}
schema.declare{name='set_mode', type='array:number', help="A list of {kix, kiy, kiz, ri, value}, set the IC mode at integer k (ri for real and imag) to value"}
function schema.set_mode.action (set_mode)
if set_mode == nil then
return
end
for i,v in pairs(set_mode) do
if #v ~= 5 then
error("set_mode must be a list of 5-vectors (x, y, z, real_or_imag, value)")
end
if v[4] ~= 1 and v[4] ~=0 then
error("the fourth component specifies real or imag part of the mode. must be 0 or 1")
end
end
end
schema.declare{name='pgdc', type='boolean', default=false, help="if enable pgd correction"}
schema.declare{name='pgdc_alpha0', type='number', default=0.8, help="alpha parameter in pgd correction"}
schema.declare{name='pgdc_A', type='number', default=4.0, help="alpha parameter in pgd correction"}
schema.declare{name='pgdc_B', type='number', default=8.0, help="alpha parameter in pgd correction"}
schema.declare{name='pgdc_kl', type='number', default=2.0, help="filter large scale parameter in pgd correction"}
schema.declare{name='pgdc_ks', type='number', default=10.0, help="filter small scale parameter in pgd correction"}
function fastpm.translation(dx, dy, dz)
-- generate a translation gl matrix that shifts the coordinates
return {
{1, 0, 0, dx},
{0, 1, 0, dy},
{0, 0, 1, dz},
{0, 0, 0, 1 },
}
end
function fastpm.outerproduct(a, b, c)
-- generate a list that is outer product of elements of a, b, c
local r = {}
for i=1, #a do
for j=1, #b do
for k=1, #c do
r[#r + 1] = {a[i], b[j], c[k]}
end
end
end
return r
end
function fastpm.linspace(a, e, N, endpoint)
-- Similar to numpy.linspace always append the end
--
-- https://mail.scipy.org/pipermail/numpy-discussion/2016-February/075065.html
if endpoint == nil then
endpoint = true
end
local r = {}
if endpoint then
N1 = N - 1
else
N1 = N
end
for i=1,N do
r[i] = 1.0 * (e - a) * (i - 1) / N1 + a
end
if endpoint then
r[N] = e
end
return r
end
function fastpm.logspace(a, e, N)
-- a and end are in log10.
-- Returns N elements, including e.
local r
r = fastpm.linspace(a, e, N)
for i, j in pairs(r) do
r[i] = math.pow(10, j)
end
return r
end
function fastpm.blendspace(a, e, a1, a2)
local r = {}
local a = a
local i = 1
while a < e do
r[i] = a
dlna = math.pow(math.pow(1/a1, 2) + math.pow(a/a2, 2), -0.5)
a = math.exp(math.log(a) + dlna)
i = i + 1
end
r[i] = e
return r
end
function fastpm.loglinspace(a, m, e, Nlog, Nlin)
-- Take Nlog log steps between a and m,
-- then Nlin lin steps between m and e.
-- a, m, ane e are in linear units.
local r
local s
local t = {}
local n = 0
r = fastpm.logspace(math.log10(a), math.log10(m), Nlog+1)
s = fastpm.linspace(m, e, Nlin+1)
for i=1,#r do n=n+1; t[n]=r[i] end
for i=2,#s do n=n+1; t[n]=s[i] end -- ignore duplicate entry on boundary
return t
end
function fastpm.test()
ns = {
__file__ = "standard.lua",
boxsize = 384.0,
cola_stdda = true,
force_softening_type = "none",
enforce_broadband_kmax = 4,
f_nl = 0.100000000000000006,
f_nl_type = "local",
force_mode = "pm",
h = 0.677400000000000002,
inverted_ic = false,
kernel_type = "3_4",
nc = 128,
np_alloc_factor = 4.0,
omega_m = 0.30749399999999999,
prefix = "results-za-nongaussian",
random_seed = 100,
read_powerspectrum = "powerspec.txt",
remove_cosmic_variance = false,
scalar_amp = 0.000000002441,
scalar_pivot = 0.002,
scalar_spectral_index = 0.966700000000000004,
sigma8 = 0,
write_lineark = "results-za-nongaussian/lineark",
write_nonlineark = "results-za-nongaussian/nonlineark",
write_powerspectrum = "results-za-nongaussian/powerspec",
write_snapshot = "results-za-nongaussian/fastpm",
write_whitenoisek = "results-za-nongaussian/whitenoisek",
za = true,
args = {
"standard.lua",
"za",
"nongaussian",
},
change_pm = {
0,
},
output_redshifts = {
9.0,
0.0,
},
pm_nc_factor = {
2,
},
time_step = {
1.0,
},
}
schema.print()
for i,k in pairs(schema.bind(ns)) do
print(i, k)
end
end
fastpm.schema = schema
--
-- The main functions, must be a global symbol
--
function _parse_runmain(filename, ...)
local fastpm = require('lua-runtime-fastpm')
local config = require('lua-runtime-config')
local globals = setmetatable({}, {__index=_G})
globals.fastpm = fastpm
globals.logspace = fastpm.logspace
globals.linspace = fastpm.linspace
globals.loglinspace = fastpm.loglinspace
return config.parse(fastpm.schema, filename, true, globals, {...})
end
function _parse(filename, ...)
local fastpm = require('lua-runtime-fastpm')
local config = require('lua-runtime-config')
local globals = setmetatable({}, {__index=_G})
globals.fastpm = fastpm
globals.logspace = fastpm.logspace
globals.linspace = fastpm.linspace
globals.loglinspace = fastpm.loglinspace
return config.parse(fastpm.schema, filename, false, globals, {...})
end
function _help(filename, ...)
local fastpm = require('lua-runtime-fastpm')
local config = require('lua-runtime-config')
return fastpm.schema.format_help()
end
return fastpm
|
local function DoTransform(inst, self, isfullmoon)
self._task = nil
if isfullmoon then
self:SetWere()
else
self:SetNormal()
end
end
local function OnIsFullmoon(self, isfullmoon)
if self._task ~= nil then
self._task:Cancel()
end
--self._task =
-- isfullmoon ~= self:IsInWereState() and
-- not self.inst:IsInLimbo() and
-- self.inst:DoTaskInTime(math.max(0, GetRandomWithVariance(1, 2)), DoTransform, self, isfullmoon) or
-- nil
end
local function DoToggleWere(inst, self)
self._task = nil
OnIsFullmoon(self, TheWorld.state.isfullmoon)
end
local function OnExitLimbo(inst)
local self = inst.components.werebeast
if self._task ~= nil then
self._task:Cancel()
end
self._task = inst:DoTaskInTime(.2, DoToggleWere, self)
end
local function OnEnterLimbo(inst)
local self = inst.components.werebeast
if self._task ~= nil then
self._task:Cancel()
self._task = nil
end
end
local WereBeast = Class(function(self, inst)
self.inst = inst
self.onsetwerefn = nil
self.onsetnormalfn = nil
self.weretime = TUNING.SEG_TIME * 4
self.triggerlimit = nil
self.triggeramount = nil
self._task = nil
self._reverttask = nil
self:WatchWorldState("isfullmoon", OnIsFullmoon)
inst:ListenForEvent("exitlimbo", OnExitLimbo)
inst:ListenForEvent("enterlimbo", OnEnterLimbo)
end)
function WereBeast:OnRemoveFromEntity()
if self._task ~= nil then
self._task:Cancel()
self._task = nil
end
if self._reverttask ~= nil then
self._reverttask:Cancel()
self._reverttask = nil
end
self:StopWatchingWorldState("isfullmoon", OnIsFullmoon)
self.inst:RemoveEventCallback("exitlimbo", OnExitLimbo)
self.inst:RemoveEventCallback("enterlimbo", OnEnterLimbo)
end
function WereBeast:SetOnWereFn(fn)
self.onsetwerefn = fn
end
function WereBeast:SetOnNormalFn(fn)
self.onsetnormalfn = fn
end
function WereBeast:SetTriggerLimit(limit)
self.triggerlimit = limit
self:ResetTriggers()
end
function WereBeast:TriggerDelta(amount)
if self.triggerlimit ~= nil then
self.triggeramount = math.max(0, self.triggeramount + amount)
if self.triggeramount >= self.triggerlimit then
self:SetWere()
end
end
end
function WereBeast:ResetTriggers()
self.triggeramount = self.triggerlimit ~= nil and 0 or nil
end
local function OnRevert(inst, self)
if self:IsInWereState() and not inst.sg:HasStateTag("transform") then
self:SetNormal()
end
end
function WereBeast:SetWere(time)
if self._task ~= nil then
self._task:Cancel()
self._task = nil
end
if self.onsetwerefn ~= nil then
self.onsetwerefn(self.inst)
end
self.inst:PushEvent("transformwere")
self:ResetTriggers()
if self._reverttask ~= nil then
self._reverttask:Cancel()
end
self._reverttask = self.inst:DoTaskInTime(time or self.weretime, OnRevert, self)
end
function WereBeast:SetNormal()
if self._task ~= nil then
self._task:Cancel()
self._task = nil
end
if self.onsetnormalfn ~= nil then
self.onsetnormalfn(self.inst)
end
self.inst:PushEvent("transformnormal")
self:ResetTriggers()
if self._reverttask ~= nil then
self._reverttask:Cancel()
self._reverttask = nil
end
end
function WereBeast:IsInWereState()
return self._reverttask ~= nil
end
function WereBeast:OnSave()
if self._task ~= nil then
return TheWorld.state.isfullmoon and { time = math.floor(self.weretime) } or nil
elseif self._reverttask ~= nil then
local remaining = math.floor(GetTaskRemaining(self._reverttask))
return remaining > 0 and { time = remaining } or nil
end
end
function WereBeast:OnLoad(data)
if data ~= nil and data.time ~= nil then
self:SetWere(math.max(0, data.time))
end
end
function WereBeast:GetDebugString()
return (self.triggerlimit ~= nil and string.format("triggers: %2.2f/%2.2f", self.triggeramount, self.triggerlimit) or "no triggers")
..(self._reverttask ~= nil and string.format(", were time: %2.2f", GetTaskRemaining(self._reverttask)) or "")
end
return WereBeast
|
-- TODO: iOS - Need use dependencies:
-- |- https://github.com/ezored/ezored/blob/main/files/targets/ios/conan/recipe/conanfile.py
-- |- conan::sqlite3/3.36.0
-- |- conan::rapidjson/1.1.0
-- |- conan::openssl/1.1.1k
-- |- conan::sqlitecpp/3.1.1
-- |- conan::date/3.0.1
-- |- conan::nlohmann_json/3.9.1
-- |- conan::poco/1.11.1
-- TODO: macOS - Need use dependencies:
-- |- https://github.com/ezored/ezored/blob/main/files/targets/macos/conan/recipe/conanfile.py
-- |- conan::sqlite3/3.36.0
-- |- conan::rapidjson/1.1.0
-- |- conan::openssl/1.1.1k
-- |- conan::sqlitecpp/3.1.1
-- |- conan::date/3.0.1
-- |- conan::nlohmann_json/3.9.1
-- |- conan::poco/1.11.1
-- TODO: Android - Need use dependencies:
-- |- https://github.com/ezored/ezored/blob/main/files/targets/android/conan/recipe/conanfile.py
-- |- conan::sqlite3/3.36.0
-- |- conan::rapidjson/1.1.0
-- |- conan::openssl/1.1.1k
-- |- conan::sqlitecpp/3.1.1
-- |- conan::date/3.0.1
-- |- conan::nlohmann_json/3.9.1
-- |- conan::poco/1.11.1
-- TODO: Conan libs. Example:
-- |- https://docs.conan.io/en/1.31/integrations/build_system/xmake.html
-- TODO: Need pass version outside this to the C++ like this:
-- |- https://github.com/ezored/ezored/blob/main/files/targets/macos/conan/recipe/conanfile.py#L56
-- |- https://github.com/ezored/ezored/blob/main/files/targets/macos/cmake/CMakeLists.txt#L113
-- TODO: Need pass TARGET_NAME to the C++ (a simple string - maybe a definition?)
-- |- I need known in C++ in what target i'm in (android, ios, macos, test, etc)
-- TODO: What is the best option: One xmake.lua file for each target (ios, android, test, macos, windows, linux)?
-- |- In original ezored project i have one CMakeLists.txt for each file
-- TODO: Need pass parameters from outise (python call) to this lua file (xmake.lua)
-- TODO: How to build for Macos Catalyst?
-- |- Example: https://github.com/ezored/ezored/blob/main/files/config/target_ios.py#L51-L58
-- TODO: How to build with iOS/macOS Bitcode enabled or disabled?
-- |- Example: https://github.com/ezored/ezored/blob/main/files/config/target_ios.py#L66
-- TODO: How to build with iOS min-version defined?
-- |- Example: https://github.com/ezored/ezored/blob/main/files/config/target_ios.py#L17
add_rules("mode.release", "mode.debug")
target("ezored-lib")
add_rules("xcode.framework")
add_files("src/lib.cpp")
add_headerfiles("include/lib.hpp")
add_includedirs("include")
-- add_values("xcode.bundle_identifier", "com.ezored.sample")
-- add_values("xcode.codesign_identity", "Apple Development: paulo@prsolucoes.com (XXXXXXXXXX)")
-- add_values("xcode.mobile_provision", "iOS Team Provisioning Profile: com.ezored.sample")
target("ezored-app")
add_rules("xcode.application")
add_files("src/lib.cpp", "src/main.cpp")
add_headerfiles("include/lib.hpp")
add_includedirs("include")
|
--- A basic module
-- @module a_module
--- @type Foo
local Foo = {}
function Foo:a() end
function Foo.b() end
Foo.c = 123
return {
a = function() end, --- @deprecated
b = 123,
c = (function() end)(),
}
|
---@brief [[
--- Support for `:checkhealth` for lean.nvim.
---@brief ]]
local Job = require('plenary.job')
local subprocess_check_output = require('lean._util').subprocess_check_output
local health = {
report = { __index = function (_, key) return vim.fn['health#report_' .. key] end }
}
setmetatable(health.report, health.report)
local function check_lean_runnable()
local lean = subprocess_check_output{ command = "lean", args = { "--version" } }
health.report.ok('`lean --version`')
health.report.info(table.concat(lean, '\n'))
end
local function check_lean3ls_runnable()
local succeeded, lean3ls = pcall(Job.new, Job, {
command = 'lean-language-server',
args = { '--stdio' },
writer = ''
})
if succeeded then
lean3ls:sync()
health.report.ok('`lean-language-server`')
else
health.report.warn('`lean-language-server` not found, lean 3 support will not work')
end
end
local function check_for_timers()
if not vim.tbl_isempty(vim.fn.timer_info()) then
health.report.warn(
'You have active timers, which can degrade infoview (CursorMoved) ' ..
'performance. See https://github.com/Julian/lean.nvim/issues/92.'
)
end
end
--- Check whether lean.nvim is healthy.
---
--- Call me via `:checkhealth lean`.
function health.check()
health.report.start('lean.nvim')
check_lean_runnable()
check_lean3ls_runnable()
check_for_timers()
end
return health
|
local ffi = require "ffi"
local ffi_cdef = ffi.cdef
local ffi_typeof = ffi.typeof
ffi_cdef [[
void
nettle_serpent_set_key(struct serpent_ctx *ctx,
size_t length, const uint8_t *key);
void
nettle_serpent128_set_key(struct serpent_ctx *ctx, const uint8_t *key);
void
nettle_serpent192_set_key(struct serpent_ctx *ctx, const uint8_t *key);
void
nettle_serpent256_set_key(struct serpent_ctx *ctx, const uint8_t *key);
void
nettle_serpent_encrypt(const struct serpent_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
void
nettle_serpent_decrypt(const struct serpent_ctx *ctx,
size_t length, uint8_t *dst,
const uint8_t *src);
]]
return ffi_typeof [[
struct serpent_ctx {
uint32_t keys[33][4];
}]]
|
exports.DENsettings:addPlayerSetting("jobcalls", "true")
function createJobWindow()
jobWindow = guiCreateWindow(289,332,269,204,"AUR ~ Job",false)
jobLabel1 = guiCreateLabel(12,29,241,17,"Current occupation:",false,jobWindow)
guiLabelSetHorizontalAlign(jobLabel1,"center",false)
guiSetFont(jobLabel1,"default-bold-small")
jobCheckBox = guiCreateCheckBox(21,72,239,29,"Accept service requests from users",false,false,jobWindow)
guiCheckBoxSetSelected(jobCheckBox,true)
guiSetFont(jobCheckBox,"default-bold-small")
jobButton1 = guiCreateButton(9,112,251,38,"End shift",false,jobWindow)
jobButton2 = guiCreateButton(9,156,251,38,"Quit job",false,jobWindow)
jobLabel2 = guiCreateLabel(12,48,241,17,"Leading Staff",false,jobWindow)
guiLabelSetColor(jobLabel2,238 ,154 ,0)
guiLabelSetHorizontalAlign(jobLabel2,"center",false)
guiSetFont(jobLabel2,"default-bold-small")
guiWindowSetMovable (jobWindow, true)
guiWindowSetSizable (jobWindow, false)
guiSetVisible (jobWindow, false)
local screenW,screenH=guiGetScreenSize()
local windowW,windowH=guiGetSize(jobWindow,false)
local x,y = (screenW-windowW)/2,(screenH-windowH)/2
guiSetPosition(jobWindow,x,y,false)
addEventHandler("onClientGUIClick", jobButton1, onEndShift, false)
addEventHandler("onClientGUIClick", jobButton2, onQuitJob, false)
addEventHandler("onClientGUIClick", jobCheckBox, onCheckJobCheckboxClick, false)
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
function ()
createJobWindow()
end
)
function onCheckJobCheckboxClick ()
exports.DENsettings:setPlayerSetting("jobcalls", tostring(guiCheckBoxGetSelected( jobCheckBox )) )
setElementData( localPlayer, "doesWantJobCalls", guiCheckBoxGetSelected( jobCheckBox ) )
end
function showJobGUI ()
if ( getElementData ( localPlayer, "isPlayerLoggedin" ) ) then
if not (isPedOnGround(localPlayer)) then
if guiGetVisible(jobWindow) then
guiSetVisible(jobWindow,false)
showCursor(false)
end
exports.NGCdxmsg:createNewDxMessage("You can't end shift here",255,0,0)
return false
end
if not guiGetVisible(jobWindow) then
guiSetVisible(jobWindow,true)
showCursor(true)
updateLabel ()
-- Check the occupation and set the label status
occupation = getElementData( localPlayer, "Occupation" )
if occupation == "" then
guiSetText(jobLabel2, "Unemployed")
else
guiSetText(jobLabel2, occupation)
end
else
guiSetVisible(jobWindow,false)
showCursor(false)
end
end
end
bindKey("F2","down",showJobGUI)
addEvent( "updateLabel", true )
function updateLabel ()
-- Check the occupation and set the label status
local occupation = getElementData( localPlayer, "Occupation" )
if occupation == "" then
guiSetText(jobLabel2, "Unemployed")
else
guiSetText(jobLabel2, occupation)
end
-- Check the team and set the shift status
if (getTeamName(getPlayerTeam(localPlayer)) == "Unoccupied") then
guiSetText ( jobButton1, "Start shift" )
else
guiSetText ( jobButton1, "End shift" )
end
-- Check is player has no job
if ( getTeamName( getPlayerTeam( localPlayer ) ) == "Criminals") or (getTeamName(getPlayerTeam(localPlayer)) == "Unemployed") or (getTeamName(getPlayerTeam(localPlayer)) == "CS:GO") then
guiSetEnabled ( jobButton1, false )
guiSetEnabled ( jobButton2, false )
else
guiSetEnabled ( jobButton1, true )
guiSetEnabled ( jobButton2, true )
end
end
addEventHandler( "updateLabel", root, updateLabel )
local shift = 1
function onEndShift ()
if not (isPedOnGround(localPlayer)) then exports.NGCdxmsg:createNewDxMessage("You can't end shift here",255,0,0) return false end
if ( onSpamProtection () ) then
if ( getTeamName( getPlayerTeam( localPlayer ) ) == "Criminals") then
exports.NGCdxmsg:createNewDxMessage("You can't go off-duty as a criminal!", 200, 0, 0)
elseif ( getTeamName( getPlayerTeam( localPlayer ) ) == "CS:GO") then
exports.NGCdxmsg:createNewDxMessage("You can't go off-duty as a CS:GO!", 200, 0, 0)
elseif ( isPedInVehicle( localPlayer ) ) then
exports.NGCdxmsg:createNewDxMessage("You can't go off-duty in a car!", 200, 0, 0)
elseif isPedDead(localPlayer) then
exports.NGCdxmsg:createNewDxMessage("You can't go off-duty now", 200, 0, 0)
elseif (getTickCount() - getElementData(localPlayer, "ldt") < 5000) then
exports.NGCdxmsg:createNewDxMessage("You must not have taken damage in last 5 seconds to end shift.", 200, 0, 0)
elseif shift == 1 then
shift = 0
-- You are on shift
if exports.DENlaw:isPlayerLawEnforcer(localPlayer) then
if deathMatch and isTimer(deathMatch) then return false end
setElementData(localPlayer,"StopDeathmatching",true)
deathMatch = setTimer(function()
setElementData(localPlayer,"StopDeathmatching",false)
end,30000,1)
end
triggerServerEvent( 'onEndShift', localPlayer )
triggerEvent( "onClientPlayerTeamChange", localPlayer )
else
shift = 1
-- You are off shift
restoreShift = getElementData( localPlayer, "Occupation" )
triggerServerEvent( 'onStartShift', localPlayer, restoreShift )
triggerEvent( "onClientPlayerTeamChange", localPlayer )
if isTimer(deathMatch) then killTimer(deathMatch) end
setElementData(localPlayer,"StopDeathmatching",false)
end
else
exports.NGCdxmsg:createNewDxMessage("Stop clicking the off-duty button! Now wait 30 seconds", 200, 0, 0)
end
end
local theSpam = {}
function onSpamProtection ()
if not ( theSpam[localPlayer] ) then
theSpam[localPlayer] = 1
return true
elseif ( theSpam[localPlayer] >= 4 ) then
return false
else
theSpam[localPlayer] = theSpam[localPlayer] +1
if ( theSpam[localPlayer] >= 4 ) and not ( isTimer( clearTimer ) ) then clearTimer = setTimer( clearSpamProtection, 40000, 1 ) end
return true
end
end
function clearSpamProtection ()
if ( theSpam[localPlayer] ) then
theSpam[localPlayer] = 0
end
end
function onQuitJob ()
local elementStandingOn = getPedContactElement ( localPlayer )
-- Quit yourjob permanent
if not (isPedOnGround(localPlayer)) then exports.NGCdxmsg:createNewDxMessage("You can't quit job here",255,0,0) return false end
if elementStandingOn and not getElementType(elementStandingOn) == "vehicle" or elementStandingOn and not getElementType(elementStandingOn) == "object" then exports.NGCdxmsg:createNewDxMessage("You have to be on the ground to quit your job",255,0,0) end
if ( getTeamName( getPlayerTeam( localPlayer ) ) == "Criminals") then
exports.NGCdxmsg:createNewDxMessage("You can't quit your job as a criminal!", 200, 0, 0)
elseif ( getTeamName( getPlayerTeam( localPlayer ) ) == "CS:GO") then
exports.NGCdxmsg:createNewDxMessage("You can't quit your team is CS:GO!", 200, 0, 0)
elseif ( isPedInVehicle( localPlayer ) ) then
exports.NGCdxmsg:createNewDxMessage("You can't quit your job in a car!", 200, 0, 0)
elseif (getTickCount() - getElementData(localPlayer, "ldt") < 5000) then
exports.NGCdxmsg:createNewDxMessage("You must not have taken damage in last 5 seconds to quit job.", 200, 0, 0)
else
oldShift = getElementData( localPlayer, "Occupation" )
if exports.DENlaw:isPlayerLawEnforcer(localPlayer) then
if deathMatch and isTimer(deathMatch) then return false end
setElementData(localPlayer,"StopDeathmatching",true)
deathMatch = setTimer(function()
setElementData(localPlayer,"StopDeathmatching",false)
end,30000,1)
end
triggerServerEvent( 'onQuitJob', localPlayer, oldShift )
triggerEvent( "onClientPlayerTeamChange", localPlayer )
end
end
function dxDrawRelativeText( text,posX,posY,right,bottom,color,scale,mixed_font,alignX,alignY,clip,wordBreak,postGUI )
local resolutionX = 1366
local resolutionY = 768
local sWidth,sHeight = guiGetScreenSize( )
return dxDrawText(
tostring( text ),
( posX/resolutionX )*sWidth,
( posY/resolutionY )*sHeight,
( right/resolutionX )*sWidth,
( bottom/resolutionY)*sHeight,
color,
( sWidth/resolutionX )*scale,
mixed_font,
alignX,
alignY,
clip,
wordBreak,
postGUI
)
end
local screenWidth, screenHeight = guiGetScreenSize()
function createText()
if getElementData(localPlayer,"StopDeathmatching") then
if deathMatch and isTimer(deathMatch) then
local timeLeft, timeLeftEx, timeTotalEx = getTimerDetails ( deathMatch )
local timeLeft = math.floor(timeLeft / 1000)
if timeLeft > 0 then
dxDrawRelativeText( "Cool down: "..timeLeft.." seconds", 520,719,1156.0,274.0,tocolor(0,0,0,230),1.2,"pricedown","left","top",false,false,false )
dxDrawRelativeText( "Cool down: "..timeLeft.." seconds", 520,720,1156.0,274.0,tocolor(0,0,0,230),1.2,"pricedown","left","top",false,false,false )
dxDrawRelativeText( "Cool down: "..timeLeft.." seconds", 520,721,1156.0,274.0,tocolor(0,0,0,230),1.2,"pricedown","left","top",false,false,false )
dxDrawRelativeText( "Cool down: "..timeLeft.." seconds", 520,720,1156.0,274.0,tocolor(0,255,0,255),1.2,"pricedown","left","top",false,false,false )
end
end
end
end
addEventHandler("onClientRender",root,createText)
|
-- Dependencies
local DkJson = require("libraries.dkjson")
-- JSON module
local Json = {}
-- Encodes decoded data
function Json.encode(data)
if data == nil then
return nil, "No data to encode"
else
return DkJson.encode(data, { indent = true })
end
end
-- Decodes encoded data
function Json.decode(data)
if data == nil then
return nil, "No data to decode"
end
local result, pos, error = DkJson.decode(data)
if error then
return nil, error
else
return result, nil
end
end
-- Loads table from JSON file
function Json.load(file)
local result, error = love.filesystem.read(file)
if result then
return Json.decode(result)
else
return nil, error
end
end
-- Saves table to JSON file
function Json.save(file, data)
local result, error = Json.encode(data)
if result then
return love.filesystem.write(file, result)
else
return nil, error
end
end
-- Inherit all functions
return setmetatable(Json, { __index = DkJson })
|
local phoneProp = 0
local phoneModel = `prop_npc_phone_02`
local function LoadAnimation(dict)
RequestAnimDict(dict)
while not HasAnimDictLoaded(dict) do
Wait(1)
end
end
local function CheckAnimLoop()
CreateThread(function()
while PhoneData.AnimationData.lib ~= nil and PhoneData.AnimationData.anim ~= nil do
local ped = PlayerPedId()
if not IsEntityPlayingAnim(ped, PhoneData.AnimationData.lib, PhoneData.AnimationData.anim, 3) then
LoadAnimation(PhoneData.AnimationData.lib)
TaskPlayAnim(ped, PhoneData.AnimationData.lib, PhoneData.AnimationData.anim, 3.0, 3.0, -1, 50, 0, false, false, false)
end
Wait(500)
end
end)
end
function newPhoneProp()
deletePhone()
RequestModel(phoneModel)
while not HasModelLoaded(phoneModel) do
Wait(1)
end
phoneProp = CreateObject(phoneModel, 1.0, 1.0, 1.0, 1, 1, 0)
local bone = GetPedBoneIndex(PlayerPedId(), 28422)
if phoneModel == `prop_cs_phone_01` then
AttachEntityToEntity(phoneProp, PlayerPedId(), bone, 0.0, 0.0, 0.0, 50.0, 320.0, 50.0, 1, 1, 0, 0, 2, 1)
else
AttachEntityToEntity(phoneProp, PlayerPedId(), bone, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1, 1, 0, 0, 2, 1)
end
end
function deletePhone()
if phoneProp ~= 0 then
DeleteObject(phoneProp)
phoneProp = 0
end
end
function DoPhoneAnimation(anim)
local ped = PlayerPedId()
local AnimationLib = 'cellphone@'
local AnimationStatus = anim
if IsPedInAnyVehicle(ped, false) then
AnimationLib = 'anim@cellphone@in_car@ps'
end
LoadAnimation(AnimationLib)
TaskPlayAnim(ped, AnimationLib, AnimationStatus, 3.0, 3.0, -1, 50, 0, false, false, false)
PhoneData.AnimationData.lib = AnimationLib
PhoneData.AnimationData.anim = AnimationStatus
CheckAnimLoop()
end |
--------------------------------
-- @module EaseBezierAction
-- @extend ActionEase
-- @parent_module cc
---@class cc.EaseBezierAction:cc.ActionEase
local EaseBezierAction = {}
cc.EaseBezierAction = EaseBezierAction
--------------------------------
--- brief Set the bezier parameters.
---@param p0 number
---@param p1 number
---@param p2 number
---@param p3 number
---@return cc.EaseBezierAction
function EaseBezierAction:setBezierParamer(p0, p1, p2, p3)
end
--------------------------------
--- brief Create the action with the inner action.
--- param action The pointer of the inner action.
--- return A pointer of EaseBezierAction action. If creation failed, return nil.
---@param action cc.ActionInterval
---@return cc.EaseBezierAction
function EaseBezierAction:create(action)
end
--------------------------------
---
---@return cc.EaseBezierAction
function EaseBezierAction:clone()
end
--------------------------------
---
---@param time number
---@return cc.EaseBezierAction
function EaseBezierAction:update(time)
end
--------------------------------
---
---@return cc.EaseBezierAction
function EaseBezierAction:reverse()
end
--------------------------------
---
---@return cc.EaseBezierAction
function EaseBezierAction:EaseBezierAction()
end
return nil
|
---
---
--- File: to sequence db support files
---
---
---
dbCtl = {}
dbCtl.helpData = {}
function dbCtl.help()
local i,k
print("help commands for dbCtl")
for i,k in ipairs( dbCtl.helpData) do
printf(".%s -- %s",k[1],k[2] )
end
end
|
a = function() return 1 end
b = function(r) print( r() ) end
b(a)
|
return function()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TS = require(ReplicatedStorage:WaitForChild("rbxts_include"):WaitForChild("RuntimeLib"));
local JoystickInputCalculator = TS.import(script, ReplicatedStorage, "TS", "Internal", "JoystickInputCalculator").JoystickInputCalculator;
describe("JoystickInputCalculator", function()
it("should be constructable and fulfill its interface", function()
local joystickInputCalculator;
expect(function()
joystickInputCalculator = JoystickInputCalculator.new()
end).never.to.throw()
expect(joystickInputCalculator.calculate).to.be.a("function")
end)
local function testCalculation(
joystickInputCalculator,
gutterCenterPoint,
gutterRadiusInPixels,
relativeThumbRadius,
inputPoint,
expectedResult)
local actualResult = joystickInputCalculator:calculate(
gutterCenterPoint,
gutterRadiusInPixels,
relativeThumbRadius,
inputPoint
)
expect(actualResult).to.be.ok()
expect(actualResult.X).to.be.near(expectedResult.X, 1 / 128)
expect(actualResult.Y).to.be.near(expectedResult.Y, 1 / 128)
end
it("should calculate the expected input as the origin when inputPoint is 0 regardless of gutter center point, gutter radius, or relative thumb radius", function()
local joystickInputCalculator = JoystickInputCalculator.new()
for _ = 1, 30 do
local gutterCenterPoint = Vector2.new(math.random() * 100, math.random() * 100)
testCalculation(
--[[ joystickInputCalculator ]] joystickInputCalculator,
--[[ gutterCenterPoint ]] gutterCenterPoint,
--[[ gutterRadiusInPixels ]] (math.random() * 10) + 1,
--[[ relativeThumbRadius ]] math.random(),
--[[ inputPoint ]] gutterCenterPoint + Vector2.new(),
--[[ expectedResult ]] Vector2.new()
)
end
end)
it("should calculate the expected input on or past the edge of the base input circle regardless of gutter center point, gutter radius, or relative thumb radius", function()
local joystickInputCalculator = JoystickInputCalculator.new()
for _ = 1, 30 do
local gutterCenterPoint = Vector2.new(math.random() * 100, math.random() * 100)
local gutterRadiusInPixels = (math.random() * 10) + 1
local theta = math.random() * 2*math.pi
local unitCirclePoint = Vector2.new(math.cos(theta), math.sin(theta))
testCalculation(
--[[ joystickInputCalculator ]] joystickInputCalculator,
--[[ gutterCenterPoint ]] gutterCenterPoint,
--[[ gutterRadiusInPixels ]] gutterRadiusInPixels,
--[[ relativeThumbRadius ]] math.random(),
--[[ inputPoint ]] gutterCenterPoint + (unitCirclePoint * gutterRadiusInPixels),
--[[ expectedResult ]] unitCirclePoint
)
end
end)
it("should calculate the expected input within the bounds of the base input circle regardless of gutter center point, gutter radius, or relative thumb radius", function()
local joystickInputCalculator = JoystickInputCalculator.new()
for _ = 1, 30 do
local gutterCenterPoint = Vector2.new(math.random() * 100, math.random() * 100)
local gutterRadiusInPixels = (math.random() * 10) + 1
local relativeThumbRadius = (math.random() * 0.4) + 0.1
local theta = math.random() * 2*math.pi
local unitCirclePoint = Vector2.new(math.cos(theta), math.sin(theta))
local baseInputCircleRadiusInPixels = gutterRadiusInPixels * (1 - relativeThumbRadius)
local baseInputCircleRadiusPercentage = (math.random() * 0.9) + 0.05
local inputDistanceFromGutterCenterPoint = baseInputCircleRadiusInPixels * baseInputCircleRadiusPercentage
local relativeInputPoint = unitCirclePoint * inputDistanceFromGutterCenterPoint
local expectedResult = unitCirclePoint * baseInputCircleRadiusPercentage
testCalculation(
--[[ joystickInputCalculator ]] joystickInputCalculator,
--[[ gutterCenterPoint ]] gutterCenterPoint,
--[[ gutterRadiusInPixels ]] gutterRadiusInPixels,
--[[ relativeThumbRadius ]] relativeThumbRadius,
--[[ inputPoint ]] gutterCenterPoint + relativeInputPoint,
--[[ expectedResult ]] expectedResult
)
end
end)
end)
end
|
includeFile("custom_content/building/player/construction/construction_player_barn.lua")
includeFile("custom_content/building/player/construction/construction_player_diner.lua")
includeFile("custom_content/building/player/construction/construction_player_house_atat.lua")
includeFile("custom_content/building/player/construction/construction_player_house_hangar.lua")
includeFile("custom_content/building/player/construction/construction_player_house_jabbas_sail_barge.lua")
includeFile("custom_content/building/player/construction/construction_player_jedi_meditation_room.lua")
includeFile("custom_content/building/player/construction/construction_player_sith_meditation_room.lua")
includeFile("custom_content/building/player/construction/construction_player_tcg_emperors_spire.lua")
includeFile("custom_content/building/player/construction/construction_player_tcg_rebel_spire.lua")
includeFile("custom_content/building/player/construction/construction_player_tcg_relaxation_pool.lua")
|
-- Copyright (C) 2018 The Dota IMBA Development Team
--
-- 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.
--
-- Editors:
-- Shush, 25.04.2017
-- suthernfriend, 03.02.2018
CreateEmptyTalents("warlock")
-----------------------------
-- FATAL BONDS --
-----------------------------
imba_warlock_fatal_bonds = class({})
LinkLuaModifier("modifier_imba_fatal_bonds", "hero/hero_warlock.lua", LUA_MODIFIER_MOTION_NONE)
function imba_warlock_fatal_bonds:GetAbilityTextureName()
return "warlock_fatal_bonds"
end
function imba_warlock_fatal_bonds:IsHiddenWhenStolen()
return false
end
function imba_warlock_fatal_bonds:OnSpellStart()
-- Ability properties
local caster = self:GetCaster()
local ability = self
local target = self:GetCursorTarget()
local sound_cast = "Hero_Warlock.FatalBonds"
local particle_base = "particles/units/heroes/hero_warlock/warlock_fatal_bonds_base.vpcf"
local particle_hit = "particles/units/heroes/hero_warlock/warlock_fatal_bonds_hit.vpcf"
local modifier_bonds = "modifier_imba_fatal_bonds"
-- Ability specials
local max_targets = ability:GetSpecialValueFor("max_targets")
local duration = ability:GetSpecialValueFor("duration")
local link_search_radius = ability:GetSpecialValueFor("link_search_radius")
-- Play cast sound
EmitSoundOn(sound_cast, caster)
-- Initialize variables
local targets_linked = 0
local bond_table = {}
local modifier_table = {}
-- If target has Linken's Sphere off cooldown, do nothing
if target:GetTeam() ~= caster:GetTeam() then
if target:TriggerSpellAbsorb(ability) then
return nil
end
end
-- Find enemies and apply it on them as well, up to the maximum
local enemies = FindUnitsInRadius(caster:GetTeamNumber(),
target:GetAbsOrigin(),
nil,
link_search_radius,
DOTA_UNIT_TARGET_TEAM_ENEMY,
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
DOTA_UNIT_TARGET_FLAG_FOW_VISIBLE + DOTA_UNIT_TARGET_FLAG_NO_INVIS,
FIND_CLOSEST,
false)
-- Apply the debuff to enemies from the closest to the farthest
for _,enemy in pairs(enemies) do
if targets_linked < max_targets then
enemy:AddNewModifier(caster, ability, modifier_bonds, {duration = duration})
-- Increase the targets linked counter and insert that enemy into a table
targets_linked = targets_linked + 1
table.insert(bond_table, enemy)
-- If it was the main target, link from Warlock to it - otherwise, link from the target to them
if enemy == target then
local particle_hit_fx = ParticleManager:CreateParticle(particle_hit, PATTACH_CUSTOMORIGIN_FOLLOW, caster)
ParticleManager:SetParticleControlEnt(particle_hit_fx, 0, caster, PATTACH_POINT_FOLLOW, "attach_attack1", caster:GetAbsOrigin(), true)
ParticleManager:SetParticleControlEnt(particle_hit_fx, 1, target, PATTACH_POINT_FOLLOW, "attach_hitloc", target:GetAbsOrigin(), true)
ParticleManager:ReleaseParticleIndex(particle_hit_fx)
else
local particle_hit_fx = ParticleManager:CreateParticle(particle_hit, PATTACH_CUSTOMORIGIN_FOLLOW, caster)
ParticleManager:SetParticleControlEnt(particle_hit_fx, 0, target, PATTACH_POINT_FOLLOW, "attach_hitloc", target:GetAbsOrigin(), true)
ParticleManager:SetParticleControlEnt(particle_hit_fx, 1, enemy, PATTACH_POINT_FOLLOW, "attach_hitloc", enemy:GetAbsOrigin(), true)
ParticleManager:ReleaseParticleIndex(particle_hit_fx)
end
end
end
-- Put the bond table on all enemies' debuff modifiers
for _,enemy in pairs(bond_table) do
local modifier_bonds_handler = enemy:FindModifierByName(modifier_bonds)
if modifier_bonds_handler then
modifier_bonds_handler.bond_table = bond_table
end
end
end
modifier_imba_fatal_bonds = class({})
function modifier_imba_fatal_bonds:OnCreated()
-- Ability properties
self.caster = self:GetCaster()
self.ability = self:GetAbility()
self.parent = self:GetParent()
self.sound_damage = "Hero_Warlock.FatalBondsDamage"
self.particle_icon = "particles/units/heroes/hero_warlock/warlock_fatal_bonds_icon.vpcf"
self.particle_hit = "particles/units/heroes/hero_warlock/warlock_fatal_bonds_hit.vpcf"
self.modifier_bonds = "modifier_imba_fatal_bonds"
self.modifier_word = "modifier_imba_shadow_word"
self.ability_word = "imba_warlock_shadow_word"
-- Ability specials
self.link_damage_share_pct = self.ability:GetSpecialValueFor("link_damage_share_pct")
self.golem_link_radius = self.ability:GetSpecialValueFor("golem_link_radius")
self.golem_link_damage_pct = self.ability:GetSpecialValueFor("golem_link_damage_pct")
-- #3 Talent: Fatal Bonds damage share increase
self.link_damage_share_pct = self.link_damage_share_pct + self.caster:FindTalentValue("special_bonus_imba_warlock_3")
-- #7 Talent: Golems share damage they take to Fatal Bonded units, no range limit
self.golem_link_radius = self.golem_link_radius + self.caster:FindTalentValue("special_bonus_imba_warlock_7")
-- Add particles
self.particle_icon_fx = ParticleManager:CreateParticle(self.particle_icon, PATTACH_OVERHEAD_FOLLOW, self.parent)
ParticleManager:SetParticleControl(self.particle_icon_fx, 0, self.parent:GetAbsOrigin())
self:AddParticle(self.particle_icon_fx, false, false, -1, false, true)
if IsServer() then
-- Find the caster's Shadow Word ability, if feasible
if self.caster:HasAbility(self.ability_word) then
self.ability_word_handler = self.caster:FindAbilityByName(self.ability_word)
end
-- Start thinking
self:StartIntervalThink(FrameTime())
end
end
function modifier_imba_fatal_bonds:IsHidden() return false end
function modifier_imba_fatal_bonds:IsPurgable() return true end
function modifier_imba_fatal_bonds:IsDebuff() return true end
function modifier_imba_fatal_bonds:OnIntervalThink()
-- If an entity isn't alive anymore, remove it from the table
local delete_positions = {}
for i = 1, #self.bond_table do
if not self.bond_table[i]:IsAlive() then
table.insert(delete_positions, i)
end
end
for i = 1, #delete_positions do
table.remove(self.bond_table, delete_positions[i])
end
end
function modifier_imba_fatal_bonds:DeclareFunctions()
local decFuncs = {MODIFIER_EVENT_ON_TAKEDAMAGE}
return decFuncs
end
function modifier_imba_fatal_bonds:OnTakeDamage(keys)
if IsServer() then
local unit = keys.unit
local original_damage = keys.original_damage
local damage_type = keys.damage_type
local inflictor = keys.inflictor
-- Only apply if the unit taking damage is the parent
if unit == self.parent then
-- If the bond table isn't initialized yet, do nothing
if not self.bond_table then
return nil
end
-- If the damage came from Fatal Bonds' ability, do nothing
if inflictor and inflictor == self.ability then
return nil
end
-- Calculate damage post reductions, but before any other changes (illusions, borrowed time etc)
local damage = original_damage
if damage_type == DAMAGE_TYPE_PHYSICAL then
damage = damage * (1 - self.parent:GetPhysicalArmorReduction() * 0.01)
elseif damage_type == DAMAGE_TYPE_MAGICAL then
damage = damage * (1- self.parent:GetMagicalArmorValue() * 0.01)
end
-- Calculate damage to be shared
damage = damage * self.link_damage_share_pct * 0.01
-- Cycle through every other enemy in the table and deal damage
for _,bonded_enemy in pairs(self.bond_table) do
if bonded_enemy ~= self.parent then
local damageTable = {victim = bonded_enemy,
damage = damage,
damage_type = damage_type,
attacker = self.caster,
ability = self.ability,
damage_flags = DOTA_DAMAGE_FLAG_REFLECTION
}
ApplyDamage(damageTable)
-- Add particle hit effect
local particle_hit_fx = ParticleManager:CreateParticle(self.particle_hit, PATTACH_CUSTOMORIGIN_FOLLOW, self.parent)
ParticleManager:SetParticleControlEnt(particle_hit_fx, 0, self.parent, PATTACH_POINT_FOLLOW, "attach_hitloc", self.parent:GetAbsOrigin(), true)
ParticleManager:SetParticleControlEnt(particle_hit_fx, 1, bonded_enemy, PATTACH_POINT_FOLLOW, "attach_hitloc", bonded_enemy:GetAbsOrigin(), true)
ParticleManager:ReleaseParticleIndex(particle_hit_fx)
-- If the parent has Shadow Word but the bonded unit doesn't, apply it on the unit as well
if self.parent:HasModifier(self.modifier_word) and not bonded_enemy:HasModifier(self.modifier_word) then
-- If Shadow Word is not defined on the caster of Fatal Bonds, do nothing
if not self.ability_word_handler then
return nil
end
-- If the unit is not magic immune, apply the debuff
if not bonded_enemy:IsMagicImmune() then
local modifier_word_handler = self.parent:FindModifierByName(self.modifier_word)
if modifier_word_handler then
local duration_remaining = modifier_word_handler:GetRemainingTime()
bonded_enemy:AddNewModifier(self.caster, self.ability_word_handler, self.modifier_word, {duration = duration_remaining})
end
end
end
end
end
end
-- Instead, if it was an friendly Chaotic Golem that took damage, check if the debuffed unit is in its range
if string.find(unit:GetUnitName(), "npc_imba_warlock_golem") and unit:GetTeamNumber() ~= self.parent:GetTeamNumber() then
-- Calculate distance
local distance = (unit:GetAbsOrigin() - self.parent:GetAbsOrigin()):Length2D()
-- Check distance, if it's in range, damage the parent
if distance <= self.golem_link_radius then
-- Adjust damage
local damage = original_damage
if damage_type == DAMAGE_TYPE_PHYSICAL then
damage = damage * (1 - self.parent:GetPhysicalArmorReduction() * 0.01)
elseif damage_type == DAMAGE_TYPE_MAGICAL then
damage = damage * (1- self.parent:GetMagicalArmorValue() * 0.01)
end
-- Calculate damage
damage = damage * self.golem_link_damage_pct * 0.01
-- Apply damage
local damageTable = {victim = self.parent,
damage = damage,
damage_type = damage_type,
attacker = self.caster,
ability = self.ability,
damage_flags = DOTA_DAMAGE_FLAG_REFLECTION
}
ApplyDamage(damageTable)
-- Add particle hit effect
local particle_hit_fx = ParticleManager:CreateParticle(self.particle_hit, PATTACH_CUSTOMORIGIN_FOLLOW, self.parent)
ParticleManager:SetParticleControlEnt(particle_hit_fx, 0, unit, PATTACH_POINT_FOLLOW, "attach_hitloc", unit:GetAbsOrigin(), true)
ParticleManager:SetParticleControlEnt(particle_hit_fx, 1, self.parent, PATTACH_POINT_FOLLOW, "attach_hitloc", self.parent:GetAbsOrigin(), true)
ParticleManager:ReleaseParticleIndex(particle_hit_fx)
-- If Shadow Word is not defined on the caster, do nothing
if not self.ability_word_handler then
return nil
end
-- If the Golem has Shadow Word, spread it to the parent, if it's not magic immune
if not self.parent:IsMagicImmune() then
if unit:HasModifier(self.modifier_word) and not self.parent:HasModifier(self.modifier_word) then
local modifier_word_handler = unit:FindModifierByName(self.modifier_word)
if modifier_word_handler then
local duration_remaining = modifier_word_handler:GetRemainingTime()
self.parent:AddNewModifier(self.caster, self.ability_word_handler, self.modifier_word, {duration = duration_remaining})
end
end
end
-- If the parent has Shadow Word and the Golem doesn't, apply Shadow Word on the Golem
if self.parent:HasModifier(self.modifier_word) and not unit:HasModifier(self.modifier_word) then
local modifier_word_handler = self.parent:FindModifierByName(self.modifier_word)
if modifier_word_handler then
local duration_remaining = modifier_word_handler:GetRemainingTime()
unit:AddNewModifier(self.caster, self.ability_word_handler, self.modifier_word, {duration = duration_remaining})
end
end
end
end
end
end
-----------------------------
-- SHADOW WORD --
-----------------------------
imba_warlock_shadow_word = class({})
LinkLuaModifier("modifier_imba_shadow_word", "hero/hero_warlock.lua", LUA_MODIFIER_MOTION_NONE)
function imba_warlock_shadow_word:GetAbilityTextureName()
return "warlock_shadow_word"
end
function imba_warlock_shadow_word:GetCastRange()
return self:GetSpecialValueFor("cast_range")
end
function imba_warlock_shadow_word:IsHiddenWhenStolen()
return false
end
function imba_warlock_shadow_word:GetAOERadius()
local ability = self
local radius = ability:GetSpecialValueFor("radius")
return radius
end
function imba_warlock_shadow_word:OnSpellStart()
-- Ability properties
local caster = self:GetCaster()
local ability = self
local target_point = self:GetCursorPosition()
local sound_target = "Hero_Warlock.ShadowWord"
local sound_explosion = "Imba.WarlockShadowWordExplosion"
local particle_aoe = "particles/hero/warlock/warlock_shadow_word_aoe.vpcf"
local modifier_word = "modifier_imba_shadow_word"
-- Ability specials
local radius = ability:GetSpecialValueFor("radius")
local duration = ability:GetSpecialValueFor("duration")
-- #5 Talent: Shadow Word duration increase
duration = duration + caster:FindTalentValue("special_bonus_imba_warlock_5")
-- Play cast sound
EmitSoundOn(sound_target, caster)
-- Play explosion sound
EmitSoundOnLocationWithCaster(target_point, sound_explosion, caster)
-- Add particle
local particle_aoe_fx = ParticleManager:CreateParticle(particle_aoe, PATTACH_WORLDORIGIN, caster)
ParticleManager:SetParticleControl(particle_aoe_fx, 0, target_point)
ParticleManager:SetParticleControl(particle_aoe_fx, 1, Vector(radius, 0, 0))
ParticleManager:SetParticleControl(particle_aoe_fx, 2, target_point)
ParticleManager:ReleaseParticleIndex(particle_aoe_fx)
-- Show target area
AddFOWViewer(caster:GetTeamNumber(), target_point, radius, 2, true)
-- Find all enemies and allies in the area of effect
local units = FindUnitsInRadius(caster:GetTeamNumber(),
target_point,
nil,
radius,
DOTA_UNIT_TARGET_TEAM_BOTH,
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
DOTA_UNIT_TARGET_FLAG_NONE,
FIND_ANY_ORDER,
false)
for _,unit in pairs(units) do
-- Apply Shadow Word modifier
unit:AddNewModifier(caster, ability, modifier_word, {duration = duration})
end
-- Stop Shadow Word target sound after the duration ends
Timers:CreateTimer(duration, function()
StopSoundOn(sound_target, caster)
end)
end
modifier_imba_shadow_word = class({})
function modifier_imba_shadow_word:OnCreated()
-- Ability properties
self.caster = self:GetCaster()
self.ability = self:GetAbility()
self.parent = self:GetParent()
self.sound_good = "Hero_Warlock.ShadowWordCastGood"
self.sound_bad = "Hero_Warlock.ShadowWordCastBad"
self.particle_good = "particles/units/heroes/hero_warlock/warlock_shadow_word_buff.vpcf"
self.particle_bad = "particles/units/heroes/hero_warlock/warlock_shadow_word_debuff.vpcf"
-- Ability specials
self.tick_value = self.ability:GetSpecialValueFor("tick_value")
self.golem_bonus_ms_pct = self.ability:GetSpecialValueFor("golem_bonus_ms_pct")
self.golem_bonus_as = self.ability:GetSpecialValueFor("golem_bonus_as")
self.tick_interval = self.ability:GetSpecialValueFor("tick_interval")
-- #1 Talent: Shadow Word Golem's attack speed increase
self.golem_bonus_as = self.golem_bonus_as + self.caster:FindTalentValue("special_bonus_imba_warlock_1")
-- Determine which side of the buff/debuff we're using
if self.parent:GetTeamNumber() == self.caster:GetTeamNumber() then
self.good_guy = true
else
self.good_guy = false
end
-- Check if the unit is a friendly Golem
if self.good_guy and string.find(self.parent:GetUnitName(), "npc_imba_warlock_golem") then
self.is_golem = true
end
if IsServer() then
-- Play the correct sound
if self.good_guy then
EmitSoundOn(self.sound_good, self.parent)
else
EmitSoundOn(self.sound_bad, self.parent)
end
-- Add the correct particle to the unit
if self.good_guy then
self.particle_good_fx = ParticleManager:CreateParticle(self.particle_good, PATTACH_ABSORIGIN_FOLLOW, self.parent)
ParticleManager:SetParticleControl(self.particle_good_fx, 0, self.parent:GetAbsOrigin())
ParticleManager:SetParticleControl(self.particle_good_fx, 2, self.parent:GetAbsOrigin())
self:AddParticle(self.particle_good_fx, false, false, -1, false, false)
else
self.particle_bad_fx = ParticleManager:CreateParticle(self.particle_bad, PATTACH_ABSORIGIN_FOLLOW, self.parent)
ParticleManager:SetParticleControl(self.particle_bad_fx, 0, self.parent:GetAbsOrigin())
ParticleManager:SetParticleControl(self.particle_bad_fx, 2, self.parent:GetAbsOrigin())
self:AddParticle(self.particle_bad_fx, false, false, -1, false, false)
end
-- Start thinking
self:StartIntervalThink(self.tick_interval)
end
end
function modifier_imba_shadow_word:IsHidden() return false end
function modifier_imba_shadow_word:IsPurgable() return true end
function modifier_imba_shadow_word:IsDebuff()
if self.good_guy then
return false
end
return true
end
function modifier_imba_shadow_word:OnIntervalThink()
-- Determine whether to deal damage or to heal
if self.good_guy then
-- Get caster's current Spell Power
local spell_power = self.caster:GetSpellPower()
local heal = self.tick_value * (1 + spell_power * 0.01)
self.parent:Heal(heal, self.caster)
SendOverheadEventMessage(nil, OVERHEAD_ALERT_HEAL, self.parent, heal, nil)
else
local damageTable = {victim = self.parent,
attacker = self.caster,
damage = self.tick_value,
damage_type = DAMAGE_TYPE_MAGICAL,
ability = self.ability
}
ApplyDamage(damageTable)
end
end
function modifier_imba_shadow_word:OnDestroy()
-- Stop the appropriate sound event
if self.good_guy then
StopSoundOn(self.sound_good, self.parent)
else
StopSoundOn(self.sound_bad, self.parent)
end
end
function modifier_imba_shadow_word:DeclareFunctions()
local decFuncs = {MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE,
MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT}
return decFuncs
end
function modifier_imba_shadow_word:GetModifierMoveSpeedBonus_Percentage()
-- If the unit is now a golem, do nothing
if not self.is_golem then
return nil
end
return self.golem_bonus_ms_pct
end
function modifier_imba_shadow_word:GetModifierAttackSpeedBonus_Constant()
if not self.is_golem then
return nil
end
return self.golem_bonus_as
end
-----------------------------
-- UPHEAVAL --
-----------------------------
imba_warlock_upheaval = class({})
LinkLuaModifier("modifier_imba_upheaval", "hero/hero_warlock.lua", LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier("modifier_imba_upheaval_debuff", "hero/hero_warlock.lua", LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier("modifier_imba_upheaval_buff", "hero/hero_warlock.lua", LUA_MODIFIER_MOTION_NONE)
function imba_warlock_upheaval:GetAbilityTextureName()
return "warlock_upheaval"
end
function imba_warlock_upheaval:IsHiddenWhenStolen()
return false
end
function imba_warlock_upheaval:GetChannelTime()
local caster = self:GetCaster()
if caster:HasTalent("special_bonus_imba_warlock_6") then
return 0
end
return self.BaseClass.GetChannelTime(self)
end
function imba_warlock_upheaval:GetAOERadius()
local ability = self
local radius = ability:GetSpecialValueFor("radius")
return radius
end
function imba_warlock_upheaval:OnSpellStart()
-- Ability properties
local caster = self:GetCaster()
local ability = self
local target_point = self:GetCursorPosition()
local cast_response = "warlock_warl_ability_upheav_0"..math.random(1, 4)
local sound_loop = "Hero_Warlock.Upheaval"
local modifier_upheaval = "modifier_imba_upheaval"
if not caster:HasTalent("special_bonus_imba_warlock_6") then
-- Play cast response
EmitSoundOn(cast_response, caster)
-- Play cast sound
EmitSoundOn(sound_loop, caster)
-- Apply ModifierThinker on target location
CreateModifierThinker(caster, ability, modifier_upheaval, {}, target_point, caster:GetTeamNumber(), false)
else
-- #5 Talent: Upheaval summons a demon to channel it for Warlock
local playerID = caster:GetPlayerID()
local demon = CreateUnitByName("npc_imba_warlock_upheaval_demon", target_point, true, caster, caster, caster:GetTeamNumber())
demon:SetControllableByPlayer(playerID, true)
Timers:CreateTimer(FrameTime(), function()
-- Resolve positions
ResolveNPCPositions(target_point, 64)
-- Set the health of the demon to be equal to Warlock's
demon:SetBaseMaxHealth(caster:GetBaseMaxHealth())
demon:SetMaxHealth(caster:GetMaxHealth())
demon:SetHealth(demon:GetMaxHealth())
-- Find the demon's Upheaval ability
local ability_demon = demon:FindAbilityByName("imba_warlock_upheaval")
ability_demon:SetActivated(true)
ExecuteOrderFromTable({ UnitIndex = demon:GetEntityIndex(), OrderType = DOTA_UNIT_ORDER_CAST_POSITION, Position = demon:GetAbsOrigin(), AbilityIndex = ability_demon:GetEntityIndex(), Queue = queue})
-- Start the demon's idle activity
demon:StartGesture(ACT_DOTA_IDLE)
end)
end
end
function imba_warlock_upheaval:OnChannelFinish()
local caster = self:GetCaster()
local sound_loop = "Hero_Warlock.Upheaval"
local sound_end = "Hero_Warlock.Upheaval.Stop"
-- Stop looping sound
StopSoundOn(sound_loop, caster)
-- Play stop sound instead
EmitSoundOn(sound_end, caster)
-- If the caster was a demon, wait 2 seconds, then remove it from play
if string.find(caster:GetUnitName(), "npc_imba_warlock_upheaval_demon") then
Timers:CreateTimer(2, function()
caster:Kill(ability, caster)
end)
end
end
-- Upheaval modifier
modifier_imba_upheaval = class({})
function modifier_imba_upheaval:OnCreated()
-- Ability properties
self.caster = self:GetCaster()
self.ability = self:GetAbility()
self.parent = self:GetParent()
self.particle_upheaval = "particles/units/heroes/hero_warlock/warlock_upheaval.vpcf"
self.modifier_debuff = "modifier_imba_upheaval_debuff"
self.modifier_golem_buff = "modifier_imba_upheaval_buff"
-- Ability specials
self.radius = self.ability:GetSpecialValueFor("radius")
self.ms_slow_pct_per_tick = self.ability:GetSpecialValueFor("ms_slow_pct_per_tick")
self.linger_duration = self.ability:GetSpecialValueFor("linger_duration")
self.tick_interval = self.ability:GetSpecialValueFor("tick_interval")
self.max_slow_pct = self.ability:GetSpecialValueFor("max_slow_pct")
-- Initialize the amount of slow
self.slow = 0
if IsServer() then
-- Add particle effects
self.particle_upheaval_fx = ParticleManager:CreateParticle(self.particle_upheaval, PATTACH_WORLDORIGIN, self.parent)
ParticleManager:SetParticleControl(self.particle_upheaval_fx, 0, self.parent:GetAbsOrigin())
ParticleManager:SetParticleControl(self.particle_upheaval_fx, 1, Vector(self.radius, 1, 1))
self:AddParticle(self.particle_upheaval_fx, false, false, -1, false, false)
-- Start thinking
self:StartIntervalThink(self.tick_interval)
end
end
function modifier_imba_upheaval:OnIntervalThink()
-- If the caster stopped channeling, destroy the thinker modifier
if not self.caster:IsChanneling() then
self:Destroy()
return nil
end
-- Increase the slow power per tick
self.slow = self.slow + (self.ms_slow_pct_per_tick * self.tick_interval)
-- If the slow is above the limit, keep it at the limit
if self.slow > self.max_slow_pct then
self.slow = self.max_slow_pct
end
-- Find all nearby enemies and apply the debuff
local enemies = FindUnitsInRadius(self.caster:GetTeamNumber(),
self.parent:GetAbsOrigin(),
nil,
self.radius,
DOTA_UNIT_TARGET_TEAM_ENEMY,
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
DOTA_UNIT_TARGET_FLAG_NONE,
FIND_ANY_ORDER,
false)
for _,enemy in pairs(enemies) do
local modifier_debuff_handler = enemy:AddNewModifier(self.caster, self.ability, self.modifier_debuff, {duration = self.linger_duration})
-- Insert the amount of slow in the new modifier
if modifier_debuff_handler then
modifier_debuff_handler.slow = self.slow
end
end
-- Find Golems
local units = FindUnitsInRadius(self.caster:GetTeamNumber(),
self.parent:GetAbsOrigin(),
nil,
self.radius,
DOTA_UNIT_TARGET_TEAM_FRIENDLY,
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
DOTA_UNIT_TARGET_FLAG_INVULNERABLE + DOTA_UNIT_TARGET_FLAG_PLAYER_CONTROLLED,
FIND_ANY_ORDER,
false)
for _,unit in pairs(units) do
if string.find(unit:GetUnitName(), "npc_imba_warlock_golem") then
local modifier_golem_buff_handler = unit:AddNewModifier(self.caster, self.ability, self.modifier_golem_buff, {duration = (self.tick_interval * 2)})
if modifier_golem_buff_handler then
modifier_golem_buff_handler.radius = self.radius
modifier_golem_buff_handler.center = self.parent:GetAbsOrigin()
end
end
end
end
modifier_imba_upheaval_debuff = class({})
function modifier_imba_upheaval_debuff:OnCreated()
-- Ability properties
self.caster = self:GetCaster()
self.ability = self
self.parent = self:GetParent()
self.particle_debuff_hero = "particles/units/heroes/hero_warlock/warlock_upheaval_debuff.vpcf"
self.particle_debuff_creep = "particles/units/heroes/hero_warlock/warlock_upheaval_debuff_creep.vpcf"
-- Determine what particle to use, and add it
if self.parent:IsHero() then
self.particle_debuff_hero_fx = ParticleManager:CreateParticle(self.particle_debuff_hero, PATTACH_ABSORIGIN_FOLLOW, self.parent)
ParticleManager:SetParticleControl(self.particle_debuff_hero_fx, 0, self.parent:GetAbsOrigin())
ParticleManager:SetParticleControl(self.particle_debuff_hero_fx, 1, self.parent:GetAbsOrigin())
self:AddParticle(self.particle_debuff_hero_fx, false, false, -1, false, false)
else
self.particle_debuff_creep_fx = ParticleManager:CreateParticle(self.particle_debuff_creep, PATTACH_ABSORIGIN_FOLLOW, self.parent)
ParticleManager:SetParticleControl(self.particle_debuff_creep_fx, 0, self.parent:GetAbsOrigin())
self:AddParticle(self.particle_debuff_creep_fx, false, false, -1, false, false)
end
if IsServer() then
-- Start thinking
self:StartIntervalThink(0.1)
end
end
function modifier_imba_upheaval_debuff:IsHidden() return false end
function modifier_imba_upheaval_debuff:IsPurgable() return true end
function modifier_imba_upheaval_debuff:IsDebuff() return true end
function modifier_imba_upheaval_debuff:OnIntervalThink()
if IsServer() then
-- If the slow was not yet defined, do nothing
if not self.slow then
return nil
end
-- Set stack count
self:SetStackCount(self.slow)
end
end
function modifier_imba_upheaval_debuff:DeclareFunctions()
local decFuncs = {MODIFIER_PROPERTY_MOVESPEED_BONUS_PERCENTAGE,
MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT}
return decFuncs
end
function modifier_imba_upheaval_debuff:GetModifierMoveSpeedBonus_Percentage()
local stacks = self:GetStackCount()
return stacks * (-1)
end
function modifier_imba_upheaval_debuff:GetModifierAttackSpeedBonus_Constant()
-- #2 Talent: Upheaval also reduces attack speed
if self.caster:HasTalent("special_bonus_imba_warlock_2") then
local stacks = self:GetStackCount()
return stacks * (-1)
end
return nil
end
-- Golem Upheaval buff
modifier_imba_upheaval_buff = class({})
function modifier_imba_upheaval_buff:IsHidden() return false end
function modifier_imba_upheaval_buff:IsPurgable() return false end
function modifier_imba_upheaval_buff:IsDebuff() return false end
-----------------------------
-- CHAOTIC OFFERING --
-----------------------------
imba_warlock_rain_of_chaos = class({})
LinkLuaModifier("modifier_imba_rain_of_chaos_stun", "hero/hero_warlock.lua", LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier("modifier_imba_rain_of_chaos_golem_as", "hero/hero_warlock.lua", LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier("modifier_imba_rain_of_chaos_golem_ms", "hero/hero_warlock.lua", LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier("modifier_imba_rain_of_chaos_demon_link", "hero/hero_warlock.lua", LUA_MODIFIER_MOTION_NONE)
function imba_warlock_rain_of_chaos:GetAbilityTextureName()
return "warlock_rain_of_chaos"
end
function imba_warlock_rain_of_chaos:IsHiddenWhenStolen()
return false
end
function imba_warlock_rain_of_chaos:IsNetherWardStealable()
return false
end
function imba_warlock_rain_of_chaos:GetAOERadius()
local ability = self
local radius = ability:GetSpecialValueFor("radius")
return radius
end
function imba_warlock_rain_of_chaos:OnAbilityPhaseStart()
-- Ability properties
local caster = self:GetCaster()
local ability = self
local sound_precast = "Hero_Warlock.RainOfChaos_buildup"
-- Play precast sound
EmitSoundOn(sound_precast, caster)
return true
end
function imba_warlock_rain_of_chaos:OnAbilityPhaseInterrupted()
-- Ability properties
local caster = self:GetCaster()
local ability = self
local sound_precast = "Hero_Warlock.RainOfChaos_buildup"
-- Stop precast sound
StopSoundOn(sound_precast, caster)
end
function imba_warlock_rain_of_chaos:OnSpellStart()
-- Ability properties
local caster = self:GetCaster()
local ability = self
local target_point = self:GetCursorPosition()
local golem_level = ability:GetLevel()
local playerID = caster:GetPlayerID()
local cast_response = {"warlock_warl_ability_reign_02", "warlock_warl_ability_reign_03", "warlock_warl_ability_reign_04", "warlock_warl_ability_reign_05", "warlock_warl_ability_reign_06"}
local rare_cast_response = "warlock_warl_ability_reign_01"
local sound_cast = "Hero_Warlock.RainOfChaos"
local particle_start = "particles/units/heroes/hero_warlock/warlock_rain_of_chaos_start.vpcf"
local particle_main = "particles/units/heroes/hero_warlock/warlock_rain_of_chaos.vpcf"
local modifier_stun = "modifier_imba_rain_of_chaos_stun"
local modifier_attack_speed = "modifier_imba_rain_of_chaos_golem_as"
local modifier_move_speed = "modifier_imba_rain_of_chaos_golem_ms"
local modifier_demon_link = "modifier_imba_rain_of_chaos_demon_link"
local ability_fists = "imba_warlock_flaming_fists"
local ability_immolate = "imba_warlock_permanent_immolation"
local scepter = caster:HasScepter()
-- Ability specials
local radius = ability:GetSpecialValueFor("radius")
local duration = ability:GetSpecialValueFor("duration")
local stun_duration = ability:GetSpecialValueFor("stun_duration")
local bonus_hp_per_str = ability:GetSpecialValueFor("bonus_hp_per_str")
local bonus_armor_per_agi = ability:GetSpecialValueFor("bonus_armor_per_agi")
local bonus_aspeed_per_agi = ability:GetSpecialValueFor("bonus_aspeed_per_agi")
local bonus_damage_per_int = ability:GetSpecialValueFor("bonus_damage_per_int")
local ms_bonus_boots = ability:GetSpecialValueFor("ms_bonus_boots")
local effect_delay = ability:GetSpecialValueFor("effect_delay")
local scepter_demon_count = ability:GetSpecialValueFor("scepter_demon_count")
local scepter_demon_distance = ability:GetSpecialValueFor("scepter_demon_distance")
local scepter_demon_hp = ability:GetSpecialValueFor("scepter_demon_hp")
-- Roll for rare cast response, otherwise, play normal cast response
if RollPercentage(5) then
EmitSoundOn(rare_cast_response, caster)
else
EmitSoundOn(cast_response[math.random(1, #cast_response)], caster)
end
-- Play cast sound
EmitSoundOn(sound_cast, caster)
-- Add start particle effect
local particle_start_fx = ParticleManager:CreateParticle(particle_start, PATTACH_ABSORIGIN, caster)
ParticleManager:SetParticleControl(particle_start_fx, 0, target_point)
ParticleManager:ReleaseParticleIndex(particle_start_fx)
-- Stun nearby enemies, even if they're magic immune
local enemies = FindUnitsInRadius(caster:GetTeamNumber(),
target_point,
nil,
radius,
DOTA_UNIT_TARGET_TEAM_ENEMY,
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES,
FIND_ANY_ORDER,
false)
for _,enemy in pairs(enemies) do
enemy:AddNewModifier(caster, ability, modifier_stun, {duration = stun_duration})
end
-- Destroy trees in the radius
GridNav:DestroyTreesAroundPoint(target_point, radius, false)
-- Wait for the effect delay
Timers:CreateTimer(effect_delay, function()
-- Add main particle effect
local particle_main_fx = ParticleManager:CreateParticle(particle_main, PATTACH_ABSORIGIN, caster)
ParticleManager:SetParticleControl(particle_main_fx, 0, target_point)
ParticleManager:SetParticleControl(particle_main_fx, 1, Vector(radius, 0, 0))
ParticleManager:ReleaseParticleIndex(particle_main_fx)
-- Summon the appropriate Golem unit based on the skill's level at the target point
local golem = CreateUnitByName("npc_imba_warlock_golem_"..golem_level, target_point, true, caster, caster, caster:GetTeamNumber())
-- Apply kill modifier on golem to set its duration
golem:AddNewModifier(caster, ability, "modifier_kill", {duration = duration})
-- Set the golem to be controllable by Warlock's player
golem:SetControllableByPlayer(playerID, true)
-- Calculate bonus properties based on Warlock's stats
local bonus_hp = caster:GetStrength() * bonus_hp_per_str
local bonus_damage = caster:GetIntellect() * bonus_damage_per_int
local bonus_armor = caster:GetAgility() * bonus_armor_per_agi
local bonus_attack_speed = caster:GetAgility() * bonus_aspeed_per_agi
local bonus_move_speed = caster:GetMoveSpeedModifier(caster:GetBaseMoveSpeed()) - caster:GetBaseMoveSpeed()
-- Set Golem's properties according to the bonus properties
-- Health:
golem:SetBaseMaxHealth(golem:GetBaseMaxHealth() + bonus_hp)
golem:SetMaxHealth(golem:GetMaxHealth() + bonus_hp)
golem:SetHealth(golem:GetMaxHealth())
-- Damage:
golem:SetBaseDamageMin(golem:GetBaseDamageMin() + bonus_damage)
golem:SetBaseDamageMax(golem:GetBaseDamageMax() + bonus_damage)
-- Armor:
golem:SetPhysicalArmorBaseValue(golem:GetPhysicalArmorValue() + bonus_armor)
-- #4 Talent: Chaotic Golem armor increase
if caster:HasTalent("special_bonus_imba_warlock_4") then
golem:SetPhysicalArmorBaseValue(golem:GetPhysicalArmorValue() + caster:FindTalentValue("special_bonus_imba_warlock_4"))
end
-- Attack speed (needs to be done through a modifier):
local modifier_attackspeed_handler = golem:AddNewModifier(caster, ability, modifier_attack_speed, {})
if modifier_attackspeed_handler then
modifier_attackspeed_handler:SetStackCount(bonus_attack_speed)
end
-- Move speed (needs to be done through a modifier):
local modifier_movespeed_handler = golem:AddNewModifier(caster, ability, modifier_move_speed, {})
if modifier_movespeed_handler then
modifier_movespeed_handler:SetStackCount(bonus_move_speed)
end
-- #8 Talent: Chaotic Golems are now Spell Immune
if caster:HasTalent("special_bonus_imba_warlock_8") then
ability_spell_immunity = golem:AddAbility("imba_warlock_golem_spell_immunity")
ability_spell_immunity:SetLevel(1)
end
-- Level the golem's skills to the appropriate level
local ability_fists_handler = golem:FindAbilityByName(ability_fists)
if ability_fists_handler then
ability_fists_handler:SetLevel(golem_level)
end
local ability_immolate_handler = golem:FindAbilityByName(ability_immolate)
if ability_immolate_handler then
ability_immolate_handler:SetLevel(golem_level)
end
-- Resolve positions
ResolveNPCPositions(target_point, 128)
-- If caster has scepter, summon Demonic Ascension
if scepter then
-- Assign the golem with the demon link modifier
local demon_link_modifier = golem:AddNewModifier(caster, ability, modifier_demon_link, {})
-- Decide how to arrange the demons. First one is behind the golem, closest to Warlock's position
local angle_per_demon = 360 / scepter_demon_count
local summon_edge_point = target_point + (target_point - caster:GetAbsOrigin()):Normalized() * scepter_demon_distance
for i = 0, (scepter_demon_count -1) do
-- Spawning point
local qangle = QAngle(0, i * angle_per_demon, 0)
local demon_spawn_point = RotatePosition(target_point, qangle, summon_edge_point)
-- Create demon
local demon = CreateUnitByName("npc_imba_warlock_demonic_ascension", demon_spawn_point, true, caster, caster, caster:GetTeamNumber())
demon:SetControllableByPlayer(playerID, true)
demon:StartGesture(ACT_DOTA_IDLE)
-- Forward vector
local direction = (target_point - demon_spawn_point):Normalized()
demon:SetForwardVector(direction)
-- Set the demon's health according to level
demon:SetMaxHealth(scepter_demon_hp)
demon:SetBaseMaxHealth(scepter_demon_hp)
demon:SetHealth(scepter_demon_hp)
-- Assign the demons to that golem
if demon_link_modifier then
if not demon_link_modifier.demon_table then
demon_link_modifier.demon_table = {}
else
table.insert(demon_link_modifier.demon_table, demon)
end
end
end
ResolveNPCPositions(target_point, radius)
end
end)
end
-- Stun modifier
modifier_imba_rain_of_chaos_stun = class({})
function modifier_imba_rain_of_chaos_stun:CheckState()
local state = {[MODIFIER_STATE_STUNNED] = true}
return state
end
function modifier_imba_rain_of_chaos_stun:GetEffectName()
return "particles/generic_gameplay/generic_stunned.vpcf"
end
function modifier_imba_rain_of_chaos_stun:GetEffectAttachType()
return PATTACH_OVERHEAD_FOLLOW
end
function modifier_imba_rain_of_chaos_stun:IsHidden() return false end
function modifier_imba_rain_of_chaos_stun:IsPurgeException() return true end
function modifier_imba_rain_of_chaos_stun:IsStunDebuff() return true end
-- Golem attack speed bonus modifier
modifier_imba_rain_of_chaos_golem_as = class({})
function modifier_imba_rain_of_chaos_golem_as:IsHidden() return true end
function modifier_imba_rain_of_chaos_golem_as:IsPurgable() return false end
function modifier_imba_rain_of_chaos_golem_as:IsDebuff() return false end
function modifier_imba_rain_of_chaos_golem_as:DeclareFunctions()
local decFuncs = {MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT}
return decFuncs
end
function modifier_imba_rain_of_chaos_golem_as:GetModifierAttackSpeedBonus_Constant()
local stacks = self:GetStackCount()
return stacks
end
-- Golem move speed bonus modifier
modifier_imba_rain_of_chaos_golem_ms = class({})
function modifier_imba_rain_of_chaos_golem_ms:IsHidden() return true end
function modifier_imba_rain_of_chaos_golem_ms:IsPurgable() return false end
function modifier_imba_rain_of_chaos_golem_ms:IsDebuff() return false end
function modifier_imba_rain_of_chaos_golem_ms:DeclareFunctions()
local decFuncs = {MODIFIER_PROPERTY_MOVESPEED_BONUS_CONSTANT}
return decFuncs
end
function modifier_imba_rain_of_chaos_golem_ms:GetModifierMoveSpeedBonus_Constant()
local stacks = self:GetStackCount()
return stacks
end
-- Demon Link modifier (placed on golem)
modifier_imba_rain_of_chaos_demon_link = class({})
function modifier_imba_rain_of_chaos_demon_link:IsPurgable() return false end
function modifier_imba_rain_of_chaos_demon_link:IsPurgeException() return false end
function modifier_imba_rain_of_chaos_demon_link:RemoveOnDeath() return true end
function modifier_imba_rain_of_chaos_demon_link:OnCreated()
-- Ability properties
self.caster = self:GetCaster()
self.ability = self:GetAbility()
self.parent = self:GetParent()
self.particle_link = "particles/hero/warlock/warlock_demon_link.vpcf"
self.particle_link_damage = "particles/hero/warlock/warlock_demon_link_damage.vpcf"
-- Ability specials
self.scepter_damage_transfer_pct = self.ability:GetSpecialValueFor("scepter_damage_transfer_pct")
self.scepter_damage_per_demon_pct = self.ability:GetSpecialValueFor("scepter_damage_per_demon_pct")
self.scepter_demon_count = self.ability:GetSpecialValueFor("scepter_demon_count")
-- Demon table
self.demon_table = {}
-- Particle table
self.particle_table = {}
if IsServer() then
-- Wait for a tick, then assign each particle to a demon
Timers:CreateTimer(FrameTime(), function()
if #self.demon_table < self.scepter_demon_count then
return FrameTime()
else
for i = 1, self.scepter_demon_count do
self.particle_table[i] = ParticleManager:CreateParticle(self.particle_link, PATTACH_CUSTOMORIGIN_FOLLOW, self.demon_table[i])
ParticleManager:SetParticleControlEnt(self.particle_table[i], 0, self.demon_table[i], PATTACH_POINT_FOLLOW, "attach_hitloc", self.demon_table[i]:GetAbsOrigin(), true)
ParticleManager:SetParticleControlEnt(self.particle_table[i], 1, self.parent, PATTACH_POINT_FOLLOW, "attach_hitloc", self.parent:GetAbsOrigin(), true)
end
-- Set the stack count of the modifier to the amount of demons linked
self:SetStackCount(self.scepter_demon_count)
-- Start thinking
self:StartIntervalThink(FrameTime())
end
end)
end
end
function modifier_imba_rain_of_chaos_demon_link:OnIntervalThink()
-- Set the forward vectors of all current demons to face towards the golem they're linked to
for i = 1, #self.demon_table do
local direction = (self.parent:GetAbsOrigin() - self.demon_table[i]:GetAbsOrigin()):Normalized()
self.demon_table[i]:SetForwardVector(direction)
end
end
function modifier_imba_rain_of_chaos_demon_link:DeclareFunctions()
local decFuncs = {MODIFIER_PROPERTY_INCOMING_DAMAGE_PERCENTAGE,
MODIFIER_PROPERTY_BASEDAMAGEOUTGOING_PERCENTAGE,
MODIFIER_EVENT_ON_DEATH,
MODIFIER_EVENT_ON_TAKEDAMAGE}
return decFuncs
end
function modifier_imba_rain_of_chaos_demon_link:GetModifierIncomingDamage_Percentage()
return -100
end
function modifier_imba_rain_of_chaos_demon_link:GetModifierBaseDamageOutgoing_Percentage()
local stacks = self:GetStackCount()
return stacks * self.scepter_damage_per_demon_pct
end
function modifier_imba_rain_of_chaos_demon_link:OnTakeDamage(keys)
if IsServer() then
local unit = keys.unit
local damage = keys.original_damage
local attacker = keys.attacker
local damage_type = keys.damage_type
-- Only apply on the golem taking damage
if unit == self.parent then
-- Pick a random demon
local chosen_demon = math.random(1, #self.demon_table)
-- Add a particle for indicating the damage
local particle_link_damage_fx = ParticleManager:CreateParticle(self.particle_link_damage, PATTACH_CUSTOMORIGIN_FOLLOW, self.parent)
ParticleManager:SetParticleControlEnt(particle_link_damage_fx, 0, self.parent, PATTACH_POINT_FOLLOW, "attach_hitloc", self.parent:GetAbsOrigin(), true)
ParticleManager:SetParticleControlEnt(particle_link_damage_fx, 1, self.demon_table[chosen_demon], PATTACH_POINT_FOLLOW, "attach_hitloc", self.demon_table[chosen_demon]:GetAbsOrigin(), true)
Timers:CreateTimer(0.5, function()
ParticleManager:DestroyParticle(particle_link_damage_fx, false)
ParticleManager:ReleaseParticleIndex(particle_link_damage_fx)
end)
-- Adjust damage according to armor or magic resist, if damage types match.
if damage_type == DAMAGE_TYPE_PHYSICAL then
damage = damage * (1 - self.parent:GetPhysicalArmorReduction() * 0.01)
elseif damage_type == DAMAGE_TYPE_MAGICAL then
damage = damage * (1- self.parent:GetMagicalArmorValue() * 0.01)
end
-- Decrease damage to the demon
damage = damage * self.scepter_damage_transfer_pct * 0.01
-- Deal damage
local damageTable = {victim = self.demon_table[chosen_demon],
attacker = attacker,
damage = damage,
damage_type = damage_type,
}
ApplyDamage(damageTable)
end
end
end
function modifier_imba_rain_of_chaos_demon_link:OnDeath(keys)
if IsServer() then
local unit = keys.unit
-- Apply when the killed unit is one of the linked demons
for i = 1, #self.demon_table do
if unit == self.demon_table[i] then
-- Reduce stack count
self:DecrementStackCount()
-- Stop the particle effect
ParticleManager:DestroyParticle(self.particle_table[i], false)
ParticleManager:ReleaseParticleIndex(self.particle_table[i])
-- Remove the demon and the particle from the table
table.remove(self.demon_table, i)
table.remove(self.particle_table, i)
end
-- If there are no more demons, destroy this modifier
if #self.demon_table == 0 then
self:Destroy()
end
end
end
end
function modifier_imba_rain_of_chaos_demon_link:OnRemoved()
-- Severe all remaining particles and kill all remaining demons
for i = 1, #self.demon_table do
self.demon_table[i]:Kill(self.ability, self.caster)
ParticleManager:DestroyParticle(self.particle_table[i], false)
ParticleManager:ReleaseParticleIndex(self.particle_table[i])
end
end
-----------------------------
-- FLAMING FISTS --
-----------------------------
imba_warlock_flaming_fists = class({})
LinkLuaModifier("modifier_imba_flaming_fists", "hero/hero_warlock.lua", LUA_MODIFIER_MOTION_NONE)
function imba_warlock_flaming_fists:GetAbilityTextureName()
return "warlock_golem_flaming_fists"
end
function imba_warlock_flaming_fists:GetIntrinsicModifierName()
return "modifier_imba_flaming_fists"
end
-- Flaming fists modifier
modifier_imba_flaming_fists = class({})
function modifier_imba_flaming_fists:OnCreated()
-- Ability properties
self.caster = self:GetCaster()
self.ability = self:GetAbility()
self.modifier_upheaval = "modifier_imba_upheaval_buff"
self.particle_burn = "particles/hero/warlock/warlock_upheaval_golem_burn.vpcf"
-- Ability specials
self.damage = self.ability:GetSpecialValueFor("damage")
self.radius = self.ability:GetSpecialValueFor("radius")
end
function modifier_imba_flaming_fists:OnRefresh()
self:OnCreated()
end
function modifier_imba_flaming_fists:DeclareFunctions()
local decFuncs = {MODIFIER_PROPERTY_PROCATTACK_BONUS_DAMAGE_PURE,
MODIFIER_EVENT_ON_ATTACK_LANDED}
return decFuncs
end
function modifier_imba_flaming_fists:GetModifierProcAttack_BonusDamage_Pure(keys)
local target = keys.target
-- If the unit is not a hero or a creep, do nothing
if not target:IsHero() and not target:IsCreep() then
return nil
end
-- If the caster is broken, do nothing
if self.caster:PassivesDisabled() then
return nil
end
return self.damage
end
function modifier_imba_flaming_fists:OnAttackLanded(keys)
if IsServer() then
local target = keys.target
local attacker = keys.attacker
-- Only apply if the caster is the one attacking
if self.caster == attacker then
-- If the unit is not a hero or a creep, do nothing
if not target:IsHero() and not target:IsCreep() then
return nil
end
-- If the caster is broken, do nothing
if self.caster:PassivesDisabled() then
return nil
end
local radius = self.radius
-- If the caster is inside Upheaval, get and use the whole Upheaval radius
if self.caster:HasModifier(self.modifier_upheaval) then
local modifier_upheaval_handler = self.caster:FindModifierByName(self.modifier_upheaval)
if modifier_upheaval_handler and modifier_upheaval_handler.radius and modifier_upheaval_handler.center then
radius = modifier_upheaval_handler.radius
-- Add the Upheaval burn particle effect
self.particle_burn_fx = ParticleManager:CreateParticle(self.particle_burn, PATTACH_WORLDORIGIN, self.caster)
ParticleManager:SetParticleControl(self.particle_burn_fx, 0, modifier_upheaval_handler.center)
ParticleManager:SetParticleControl(self.particle_burn_fx, 1, Vector(radius, 0, 0))
ParticleManager:ReleaseParticleIndex(self.particle_burn_fx)
end
end
-- Find all nearby enemy units and deal pure damage to all of them
local enemies = FindUnitsInRadius(self.caster:GetTeamNumber(),
target:GetAbsOrigin(),
nil,
radius,
DOTA_UNIT_TARGET_TEAM_ENEMY,
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
DOTA_UNIT_TARGET_FLAG_NOT_ATTACK_IMMUNE + DOTA_UNIT_TARGET_FLAG_MAGIC_IMMUNE_ENEMIES,
FIND_ANY_ORDER,
false)
-- Do not damage the main target
for _,enemy in pairs(enemies) do
if enemy ~= target then
local damageTable = {victim = enemy,
attacker = self.caster,
damage = self.damage,
damage_type = DAMAGE_TYPE_PURE,
ability = self.ability
}
ApplyDamage(damageTable)
end
end
end
end
end
function modifier_imba_flaming_fists:IsHidden() return true end
function modifier_imba_flaming_fists:IsPurgable() return false end
function modifier_imba_flaming_fists:IsDebuff() return false end
-----------------------------
-- PERMANENT IMMOLATION --
-----------------------------
imba_warlock_permanent_immolation = class({})
LinkLuaModifier("modifier_imba_permanent_immolation_aura", "hero/hero_warlock.lua", LUA_MODIFIER_MOTION_NONE)
LinkLuaModifier("modifier_imba_permanent_immolation_debuff", "hero/hero_warlock.lua", LUA_MODIFIER_MOTION_NONE)
function imba_warlock_permanent_immolation:GetIntrinsicModifierName()
return "modifier_imba_permanent_immolation_aura"
end
function imba_warlock_permanent_immolation:GetAbilityTextureName()
return "warlock_golem_permanent_immolation"
end
-- Permanent immolation aura modifier
modifier_imba_permanent_immolation_aura = class({})
function modifier_imba_permanent_immolation_aura:OnCreated()
-- Ability properties
self.caster = self:GetCaster()
self.ability = self:GetAbility()
self.modifier_burn = "modifier_imba_permanent_immolation_debuff"
self.modifier_upheaval = "modifier_imba_upheaval_buff"
self.modifier_upheaval_debuff = "modifier_imba_upheaval_debuff"
self.particle_burn = "particles/hero/warlock/warlock_upheaval_golem_burn.vpcf"
-- Ability special
self.damage = self.ability:GetSpecialValueFor("damage")
self.radius = self.ability:GetSpecialValueFor("radius")
self.burn_interval = self.ability:GetSpecialValueFor("burn_interval")
-- Actual radius to use, in case of Upheaval burns
self.actual_radius = self.radius
if IsServer() then
-- Start thinking
self:StartIntervalThink(self.burn_interval)
end
end
function modifier_imba_permanent_immolation_aura:OnIntervalThink()
if IsServer() then
if self.caster:HasModifier(self.modifier_upheaval) then
local modifier_upheaval_handler = self.caster:FindModifierByName(self.modifier_upheaval)
if modifier_upheaval_handler and modifier_upheaval_handler.radius and modifier_upheaval_handler.center then
-- Set actual aura radius. Need to dramatically increase the radius of the immolation. This is remedied by rejecting enemies outside the radius
self.actual_radius = modifier_upheaval_handler.radius * 2
-- BURN!!!! effect
self.particle_burn_fx = ParticleManager:CreateParticle(self.particle_burn, PATTACH_WORLDORIGIN, self.caster)
ParticleManager:SetParticleControl(self.particle_burn_fx, 0, modifier_upheaval_handler.center)
ParticleManager:SetParticleControl(self.particle_burn_fx, 1, Vector(modifier_upheaval_handler.radius, 0, 0))
ParticleManager:ReleaseParticleIndex(self.particle_burn_fx)
end
else
self.actual_radius = self.radius
end
-- Find nearby enemies
local enemies = FindUnitsInRadius(self.caster:GetTeamNumber(),
self.caster:GetAbsOrigin(),
nil,
self.actual_radius,
DOTA_UNIT_TARGET_TEAM_ENEMY,
DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC,
DOTA_UNIT_TARGET_FLAG_NONE,
FIND_ANY_ORDER,
false)
for _,enemy in pairs(enemies) do
if enemy:HasModifier(self.modifier_burn) then
-- Damage enemies
local damageTable = {victim = enemy,
attacker = self.caster,
damage = self.damage,
damage_type = DAMAGE_TYPE_MAGICAL,
ability = self.ability
}
ApplyDamage(damageTable)
end
end
end
end
function modifier_imba_permanent_immolation_aura:GetAuraRadius()
return self.actual_radius
end
function modifier_imba_permanent_immolation_aura:GetAuraSearchFlags()
return DOTA_UNIT_TARGET_FLAG_NONE
end
function modifier_imba_permanent_immolation_aura:GetAuraSearchTeam()
return DOTA_UNIT_TARGET_TEAM_ENEMY
end
function modifier_imba_permanent_immolation_aura:GetAuraSearchType()
return DOTA_UNIT_TARGET_HERO + DOTA_UNIT_TARGET_BASIC
end
function modifier_imba_permanent_immolation_aura:GetAuraEntityReject(target)
-- If both the target and the golem are inside Upheaval, apply it
if self.caster:HasModifier(self.modifier_upheaval) and target:HasModifier(self.modifier_upheaval_debuff) then
return false
end
-- Calculate distance
local distance = (self.caster:GetAbsOrigin() - target:GetAbsOrigin()):Length2D()
-- If the distance is bigger than the Immolation Aura's radius, ignore it
if distance > self.radius then
return true
end
-- Otherwise, apply normally
return false
end
function modifier_imba_permanent_immolation_aura:GetModifierAura()
return "modifier_imba_permanent_immolation_debuff"
end
function modifier_imba_permanent_immolation_aura:IsAura()
-- If caster is disabled, aura is not emitted
if self.caster:PassivesDisabled() then
return false
end
return true
end
function modifier_imba_permanent_immolation_aura:IsHidden() return true end
function modifier_imba_permanent_immolation_aura:IsPurgable() return false end
function modifier_imba_permanent_immolation_aura:IsDebuff() return false end
-- Permanent immolation debuff modifier
modifier_imba_permanent_immolation_debuff = class({})
function modifier_imba_permanent_immolation_debuff:GetAttributes()
return MODIFIER_ATTRIBUTE_MULTIPLE
end
function modifier_imba_permanent_immolation_debuff:IsHidden() return false end
function modifier_imba_permanent_immolation_debuff:IsPurgable() return false end
function modifier_imba_permanent_immolation_debuff:IsDebuff() return true end
-----------------------------
-- SPELL IMMUNITY --
-----------------------------
imba_warlock_golem_spell_immunity = class({})
LinkLuaModifier("modifier_imba_golem_spell_immunity", "hero/hero_warlock.lua", LUA_MODIFIER_MOTION_NONE)
function imba_warlock_golem_spell_immunity:GetAbilityTextureName()
return "neutral_spell_immunity"
end
function imba_warlock_golem_spell_immunity:GetIntrinsicModifierName()
return "modifier_imba_golem_spell_immunity"
end
-- Spell immunity modifier
modifier_imba_golem_spell_immunity = class({})
function modifier_imba_golem_spell_immunity:CheckState()
local state = {[MODIFIER_STATE_MAGIC_IMMUNE] = true}
return state
end
function modifier_imba_golem_spell_immunity:IsHidden() return false end
function modifier_imba_golem_spell_immunity:IsPurgable() return false end
function modifier_imba_golem_spell_immunity:IsDebuff() return false end
|
-- Copyright (c) 2020 Trevor Redfern
--
-- This software is released under the MIT License.
-- https://opensource.org/licenses/MIT
describe("Camera", function()
local Camera = require "moonpie.graphics.camera"
local mock_love = require "moonpie.test_helpers.mock_love"
it("initializes to an inconsequential camera", function()
local c = Camera:new()
assert.equals(0, c.x)
assert.equals(0, c.y)
assert.equals(1, c.scale_x)
assert.equals(1, c.scale_y)
end)
it("pushes on the translation stack on activate", function()
mock_love.override_graphics("push", spy.new(function() end))
local c = Camera:new()
c:activate()
assert.spy(love.graphics.push).was.called()
end)
it("pops the stack when the camera is deactivated", function()
mock_love.override_graphics("pop", spy.new(function() end))
local c = Camera:new()
c:activate()
c:deactivate()
assert.spy(love.graphics.pop).was.called()
end)
it("translates based on the position of the camera", function()
mock_love.override_graphics("translate", spy.new(function() end))
local c = Camera:new()
c:setPosition(43, 29)
c:activate()
assert.spy(love.graphics.translate).was.called_with(43, 29)
end)
it("scales the camera", function()
mock_love.override_graphics("scale", spy.new(function() end))
local c = Camera:new()
c:scale(10, 11)
c:activate()
assert.spy(love.graphics.scale).was.called_with(10, 11)
end)
it("can set the projection based on world based on world coordinates vs resolution available", function()
local c = Camera:new()
--project a 40x30 coordinate system onto a 1024x768 resolution
c:projection(40, 30, 1024, 768)
assert.equals(1024/40, c.scale_x)
assert.equals(768/30, c.scale_y)
end)
end) |
author 'JokeDevil'
description 'FiveM Ace Permission report/reply command (https://www.jokedevil.com/)'
version '1.0.0'
url 'https://jokedevil.com'
client_script 'client/client.lua'
client_script 'config.lua'
server_script 'server/server.lua'
server_script 'config.lua'
game 'gta5'
fx_version 'bodacious' |
local M = {}
local Cpml = require 'cpml'
local MR = require 'src'
local lkb = love.keyboard
local lg = love.graphics
M.ts = 0
M.pause = false
local key_state = {}
local camera_move_speed = 500
local camera_rotation_speed = math.pi
local camera, renderer, camera_mode
local near, far, fov = 1, 3000, 70
function M.reset()
camera = nil
camera_mode = nil
renderer = nil
end
local oc_pos, oc_rotation
function M.bind(new_camera, new_renderer, new_camera_mode, new_near, new_far, new_fov)
camera, renderer, camera_mode = new_camera, new_renderer, new_camera_mode
if camera then
oc_pos, oc_rotation = camera.pos:clone(), camera.rotation:clone()
end
near = new_near or camera.near or near
far = new_far or camera.far or far
fov = new_fov or camera.fov or fov
end
function M.update(dt)
if not M.pause then M.ts = M.ts + dt end
if M.keyreleased('space') then
M.pause = not M.pause
end
if camera then
local mv = camera_move_speed * dt
local dv = Cpml.vec3(0, 0, 0)
if lkb.isDown('a') then dv.x = dv.x - mv end
if lkb.isDown('d') then dv.x = dv.x + mv end
if lkb.isDown('w') then dv.z = dv.z - mv end
if lkb.isDown('s') then dv.z = dv.z + mv end
if lkb.isDown('q') then dv.y = dv.y - mv end
if lkb.isDown('e') then dv.y = dv.y + mv end
local rv = camera_rotation_speed * dt
local av = Cpml.vec3(0, 0, 0)
if lkb.isDown('j') then av.y = av.y - rv end
if lkb.isDown('l') then av.y = av.y + rv end
if lkb.isDown('i') then av.x = av.x - rv end
if lkb.isDown('k') then av.x = av.x + rv end
if lkb.isDown('u') then av.z = av.z - rv end
if lkb.isDown('o') then av.z = av.z + rv end
if lkb.isDown('[') then near = near - mv end
if lkb.isDown(']') then near = near + mv end
if lkb.isDown('-') then far = far - mv end
if lkb.isDown('=') then far = far + mv end
if lkb.isDown('t') then fov = fov + dt * 20 end
if lkb.isDown('g') then fov = fov - dt * 20 end
local yangle = camera.rotation.y + av.y
local c, s = math.cos(-yangle), math.sin(-yangle)
dv.x, dv.z = c * dv.x - s * dv.z, s * dv.x + c * dv.z
local p = camera.pos + dv
camera:move_to(p.x, p.y, p.z, (camera.rotation + av):unpack())
local w, h = lg.getDimensions()
if camera_mode == 'perspective' then
camera:perspective(fov, w / h, near, far)
else
local hw, hh = w / 2, h / 2
camera:orthogonal(-hw, hw, hh, -hh, near, far)
end
camera.sight_dist = math.sqrt(far^2 / 2)
if M.keyreleased('r') then
camera:move_to(oc_pos.x, oc_pos.y, oc_pos.z, oc_rotation:unpack())
near, far, fov = 1, 3000, 70
end
end
if renderer then
if M.keyreleased('f1') then
renderer.render_shadow = not renderer.render_shadow
end
if M.keyreleased('f3') then
renderer.fxaa = not renderer.fxaa
end
local ssao = renderer.ssao
if renderer.ssao then
local changed = false
if lkb.isDown('f4') then
changed = true
if lkb.isDown('lshift') then
ssao.radius = math.max(1, ssao.radius - 20 * dt)
else
ssao.radius = ssao.radius + 20 * dt
end
end
if lkb.isDown('f5') then
changed = true
if lkb.isDown('lshift') then
ssao.intensity = math.max(0.1, ssao.intensity - 10 * dt)
else
ssao.intensity = ssao.intensity + 10 * dt
end
end
if lkb.isDown('f6') then
changed = true
if lkb.isDown('lshift') then
ssao.pow = math.max(0.1, ssao.pow - 0.5 * dt)
else
ssao.pow = ssao.pow + 0.5 * dt
end
end
if changed then
renderer:set_ssao(ssao)
end
end
if lkb.isDown('`') then
renderer.debug = true
else
renderer.debug = false
end
end
end
function M.debug(ext_str)
lg.setColor(1, 1, 1)
local str = ''
str = str..string.format('\nFPS: %i', love.timer.getFPS())
str = str..string.format('\ntime: %.1f', M.ts)
if renderer then
str = str..string.format('\nrenderer: %s - %s', 'normal', renderer.render_mode or 'none')
str = str..string.format('\nfxaa: %s', tostring(renderer.fxaa or false))
str = str..string.format('\nshadow: %s', tostring(renderer.render_shadow or false))
local ssao = renderer.ssao
if ssao then
str = str..string.format(
'\nssao: radius: %i, intensity: %.1f, samples: %i, pow: %.2f',
ssao.radius, ssao.intensity, ssao.samples_count, ssao.pow
)
end
str = str..string.format('\nsharpen: %.2f', renderer.sharpen or 0)
end
if camera then
str = str..string.format('\ncamera pos: %.2f, %.2f %.2f', camera.pos:unpack())
str = str..string.format('\ncamera angle: %.2f, %.2f, %.2f', camera.rotation:unpack())
str = str..string.format('\nlook at: %.2f, %.2f, %.2f', camera.focus:unpack())
str = str..string.format('\nnear far: %.1f, %.1f', near, far)
if camera_mode == 'perspective' then
str = str..string.format('\nfov: %.1f', fov)
end
local space_vertices = camera:get_space_vertices(0, 0.5)
local min_v, max_v
if renderer then
min_v, max_v = renderer.shadow_builder:calc_sight_bbox(space_vertices)
else
min_v, max_v = MR.util.vertices_bbox(space_vertices)
end
str = str..string.format(
'\ncamera space bbox: [%.1f,%.1f,%.1f] - [%.1f,%.1f,%.1f]',
min_v.x, min_v.y, min_v.z, max_v:unpack()
)
str = str..string.format('\ncamera space size, %.1f', (min_v - max_v):len())
end
if ext_str then str = str..'\n'..ext_str end
str = str.."\n"
local stats = lg.getStats()
str = str..string.format("\ndraw calls: %i", stats.drawcalls)
str = str..string.format("\ncanvas switches: %i", stats.canvasswitches)
str = str..string.format("\ntexture memory: %iM", stats.texturememory / 1024 / 1024)
str = str..string.format("\nshader switches: %i", stats.shaderswitches)
str = str.."\n"
str = str.."\nF1 toggle shadow"
str = str.."\nF2 switch light mode"
str = str.."\n1-9, left or right to switch examples"
str = str.."\nSpace to Pause/Resume time"
lg.print(str, 15, 0)
end
function M.keyreleased(key)
if lkb.isDown(key) then
key_state[key] = true
return false
elseif key_state[key] then
key_state[key] = false
return true
end
return false
end
function M.replace_renderer(new)
for k, v in pairs(renderer) do
if k:match('_shader$') or k:match('_map') or k:match('_canvas') then
renderer[k] = nil
end
end
renderer.render_mode = nil
renderer.ssao = nil
renderer.shadow_builder = nil
for k, v in pairs(new) do
if type(v) ~= 'table' or not renderer[k] then
renderer[k] = v
end
end
setmetatable(renderer, getmetatable(new))
end
return M
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.